1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 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 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
|
dnl Process this file with autoconf to produce a configure script.
AC_INIT()
PACKAGE=fakebo
VERSION=0.4.1
AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
dnl Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_MAKE_SET
dnl Checks for libraries.
dnl Checks for header files.
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(fcntl.h limits.h syslog.h unistd.h pwd.h arpa/inet.h netinet/tcp.h sys/select.h getopt.h)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_PID_T
AC_HEADER_TIME
AC_STRUCT_TM
dnl Checks for library functions.
AC_TYPE_SIGNAL
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(select socket strstr strtol openlog sigaction waitpid gethostbyname getprotobyname)
if test "$ac_cv_func_sigaction" = no; then
AC_CHECK_FUNCS(signal)
fi
if test "$ac_cv_func_waitpid" = no; then
AC_CHECK_FUNCS(wait3)
fi
if test "$ac_cv_func_socket" = no; then
AC_CHECK_LIB(socket, socket, [LIBS="$LIBS -lsocket"])
fi
if test "$ac_cv_func_gethostbyname" = no; then
AC_CHECK_LIB(nsl, gethostbyname, [LIBS="$LIBS -lnsl"])
fi
dnl test for -Wall
AC_MSG_CHECKING([whether the C compiler accepts -Wall])
oldCFLAGS="$CFLAGS"; CFLAGS="-Wall"
AC_TRY_COMPILE(,,
AC_MSG_RESULT(yes); CFLAGS="$oldCFLAGS $CFLAGS",
AC_MSG_RESULT(no); CFLAGS="$oldCFLAGS")
dnl system dependent checks
AC_C_BIGENDIAN
AC_CHECK_SIZEOF(unsigned int,4)
AC_CHECK_SIZEOF(unsigned long,4)
dnl custom checks
dnl check for structure linger
AC_MSG_CHECKING(for struct linger)
AC_CACHE_VAL(cf_cv_have_struct_linger,[
AC_TRY_COMPILE([#include <sys/socket.h>],
[struct linger dummy],
[cf_cv_have_struct_linger=yes],
[cf_cv_have_struct_linger=no])
])
AC_MSG_RESULT($cf_cv_have_struct_linger)
if test "$cf_cv_have_struct_linger" = yes; then
AC_DEFINE(HAVE_STRUCT_LINGER)
fi
dnl check if compiler tries to align longs by itself (bad for us!)
AC_MSG_CHECKING(for compiler alignment)
AC_CACHE_VAL(cf_cv_compiler_align,[
AC_TRY_RUN([int main(void) {
struct { char c; long l; } s;
return sizeof(s)==sizeof(s.c)+sizeof(s.l) ? 1:0; } ],
[cf_cv_compiler_align=yes],
[cf_cv_compiler_align=no])
])
AC_MSG_RESULT($cf_cv_compiler_align)
if test "$cf_cv_compiler_align" = yes; then
dnl check for __attribute__((packed))
AC_MSG_CHECKING([for structure packing via __attribute__((packed))])
AC_CACHE_VAL(cf_cv_have_attrib_packed,[
AC_TRY_COMPILE(,
[struct { int i __attribute__((packed)); } s; ],
[cf_cv_have_attrib_packed=yes],
[cf_cv_have_attrib_packed=no])
])
AC_MSG_RESULT($cf_cv_have_attrib_packed)
if test "$cf_cv_have_attrib_packed" = no; then
AC_MSG_CHECKING(for structure packing via pragma)
AC_CACHE_VAL(cf_cv_have_pragma_pack,[
AC_TRY_RUN([int main(void) {
#pragma pack(1) /* has to be in column 1 ! */
struct { char c; long l; } s;
return sizeof(s)==sizeof(s.c)+sizeof(s.l) ? 0:1; } ],
[cf_cv_have_pragma_pack=yes],
[cf_cv_have_pragma_pack=no])
])
AC_MSG_RESULT($cf_cv_have_pragma_pack)
AC_DEFINE(HAVE_PRAGMA_PACK)
fi
if test "$cf_cv_have_attrib_packed" = no -a "$cf_cv_have_pragma_pack" = no ; then
AC_MSG_ERROR(We really need compiler to leave our structures alone...)
fi
if test "$cf_cv_have_attrib_packed" = yes; then
AC_DEFINE(HAVE_ATTRIB_PACKED)
fi
fi
AC_ARG_ENABLE(debug, [ --enable-debug Enable debug meesages in log], AC_DEFINE(DEBUG))
AC_ARG_ENABLE(memwatch, [ --enable-memwatch Enable memwatch for debugging], AC_DEFINE(MEMWATCH))
AM_CONDITIONAL(MEMWATCH, test "${enable_memwatch+set}" = set -a -e $srcdir/memwatch.c -a -e $srcdir/memwatch.h)
AC_ARG_ENABLE(static, [ --enable-static Enable static compilation], [test "$GCC" = yes && CFLAGS="$CFLAGS -static" && echo "configured for static compilation"])
AM_CONFIG_HEADER(config.h)
AC_OUTPUT(Makefile fakebo.1 fakebo.spec)
|