configure.ac 1.96 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14
#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.67])
AC_INIT([codes-net], [0.2], [http://trac.mcs.anl.gov/projects/codes/newticket],[],[http://trac.mcs.anl.gov/projects/codes/wiki])

AC_CANONICAL_TARGET
AC_CANONICAL_SYSTEM
AC_CANONICAL_HOST

AM_INIT_AUTOMAKE([foreign subdir-objects -Wall])

m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])

15
AC_CONFIG_SRCDIR([INSTALL])
16 17 18 19 20 21 22 23 24
AC_CONFIG_HEADERS([codes_net_config.h])

# Checks for programs.
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_CXX
AC_PROG_CXXCPP
AC_PROG_RANLIB

Jonathan Jenkins's avatar
Jonathan Jenkins committed
25 26 27
# Check for C99 
AC_PROG_CC_C99

28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
AC_REQUIRE_CPP

# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([stdlib.h string.h unistd.h execinfo.h pthread.h malloc.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_TYPE_INT8_T
AC_TYPE_INT16_T
AC_TYPE_INT32_T
AC_TYPE_INT64_T
AC_TYPE_UINT8_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T

# Checks for library functions.
AC_CHECK_FUNCS([memset])
AC_CHECK_LIB([pthread],[pthread_create],,[AC_MSG_ERROR([Could not find pthread_create!])])
AC_CHECK_LIB([m],[sqrt],,[AC_MSG_ERROR([Could not find sqrt!])])

USE_CODES_BASE=UNKNOWN
AC_ARG_WITH(codes-base,
       [  --with-codes-base=<dir>         Location of codes-base installation],
       [
        AC_CHECK_FILE(${withval}/lib/pkgconfig/codes-base.pc)
        USE_CODES_BASE=${withval}
       ],
       [
        AC_MSG_ERROR([Requires --with-codes-base])
       ])
CODES_BASE_LIBS=`PKG_CONFIG_PATH=${withval}/lib/pkgconfig pkg-config codes-base --libs`
CODES_BASE_CFLAGS=`PKG_CONFIG_PATH=${withval}/lib/pkgconfig pkg-config codes-base --cflags`
AC_SUBST(CODES_BASE_LIBS)
AC_SUBST(CODES_BASE_CFLAGS)

# put include files in a codes/ subdir 
includedir="${includedir}/codes"

Philip Carns's avatar
Philip Carns committed
71 72 73
if test "x$srcdir" != "x."; then
    AC_CONFIG_LINKS([tests/conf:$srcdir/tests/conf])
fi
74
AC_CONFIG_FILES([Makefile])
Philip Carns's avatar
Philip Carns committed
75
AC_OUTPUT(maint/codes-net.pc)