AC_PREREQ(2.61) AC_INIT([IPA],[2.0.4],[simon@comsys.ntu-kpi.kiev.ua]) AM_INIT_AUTOMAKE([-Wall -Werror foreign]) AC_REVISION([$Id: configure.ac,v 1.3.2.8 2007/07/20 09:53:37 simon Exp $]) AC_CONFIG_HEADERS([src/config.h]) AC_CONFIG_FILES([Makefile src/Makefile man/Makefile man/ru.KOI8-R/Makefile]) # Checks for programs. AC_PROG_CC AM_PROG_CC_C_O AC_LANG([C]) # Configure options. AC_ARG_ENABLE([gcc-warns], AS_HELP_STRING([--disable-gcc-warns], [do not use -W flags for GCC compiler]), with_gcc_warns=${enableval}, with_gcc_warns=yes ) AC_ARG_ENABLE([gcc-more-warns], AS_HELP_STRING([--enable-gcc-more-warns], [add more -W flags for GCC compiler]), with_gcc_more_warns=${enableval}, with_gcc_more_warns=no ) AC_ARG_WITH([libltdl], AS_HELP_STRING([--with-libltdl], [use libtool's ltdl interface]), with_libltdl=${withval}, with_libltdl=no ) AC_ARG_WITH([pthread], AS_HELP_STRING([--with-pthread], [enable support for multi-threaded modules]), [if test "${withval}" = "yes"; then AC_DEFINE(WITH_PTHREAD, [1], [Enable support for multi-threaded modules.]) fi] ) AC_ARG_WITH([piddir], AS_HELP_STRING([--with-piddir=DIR], [directory for PID-file [[/var/run]]]), piddir=${withval}, piddir=/var/run ) AC_ARG_WITH([sockdir], AS_HELP_STRING([--with-sockdir=DIR], [directory for control socket [[/var/run]]]), sockdir=${withval}, sockdir=/var/run ) AC_ARG_WITH([mandir-ru], AS_HELP_STRING([--with-mandir-ru=DIR], [subdirectory for Russian manual pages [[ru.KOI8-R]]]), mandir_ru=${withval}, mandir_ru=ru.KOI8-R ) AC_ARG_ENABLE([memfunc-debug], AS_HELP_STRING([--enable-memfunc-debug], [enable debugging of ipa_memfunc functions]), [if test "${enableval}" = "yes"; then AC_DEFINE(WITH_MEMFUNC_DEBUG, [1], [Enable debugging of ipa_memfunc functions.]) fi] ) AC_ARG_ENABLE([ctl-creds], AS_HELP_STRING([--enable-ctl-creds], [enable checking ipactl's commands credentials]), [if test "${enableval}" = "yes"; then AC_DEFINE(CTL_CHECK_CREDS, [1], [Enable checking ipactl's commands credentials.]) fi] ) AC_ARG_ENABLE([autorules], AS_HELP_STRING([--disable-autorules], [remove dynamic rules support]), with_autorules=${enableval}, with_autorules=yes ) AC_ARG_ENABLE([rules], AS_HELP_STRING([--disable-rules], [remove static rules support]), with_rules=${enableval}, with_rules=yes ) AC_ARG_ENABLE([limits], AS_HELP_STRING([--disable-limits], [remove limits support (including sublimits)]), with_limits=${enableval}, with_limits=yes ) AC_ARG_ENABLE([sublimits], AS_HELP_STRING([--disable-sublimits], [remove sublimits support]), with_sublimits=${enableval}, with_sublimits=yes ) AC_ARG_ENABLE([thresholds], AS_HELP_STRING([--disable-thresholds], [remove thresholds support]), with_thresholds=${enableval}, with_thresholds=yes ) if test "${with_rules}" = "no" -a "${with_autorules}" = "no"; then AC_MSG_ERROR([you cannot remove support for both static and dynamic rules]) fi if test "${with_rules}" = "yes"; then AC_DEFINE(WITH_RULES, [1], [Enable static rules support.]) fi if test "${with_autorules}" = "yes"; then AC_DEFINE(WITH_AUTORULES, [1], [Enable dynamic rules support.]) fi if test "${with_limits}" = "yes"; then AC_DEFINE(WITH_LIMITS, [1], [Enable limits support (including sublimits).]) fi if test "${with_thresholds}" = "yes"; then AC_DEFINE(WITH_THRESHOLDS, [1], [Enable thresholds support.]) fi if test "${with_limits}" = "yes" -a "${with_sublimits}" = "yes"; then AC_DEFINE(WITH_SUBLIMITS, [1], [Enable sublimits support.]) fi # Check for libraries. if test "${with_libltdl}" = "no"; then AC_SEARCH_LIBS(dlopen, dl, have_dlopen=yes, have_dlopen=no ) fi if test "${with_libltdl}" = "yes" -o "${have_dlopen}" = "no"; then AC_SEARCH_LIBS(lt_dlopen, ltdl, AC_DEFINE(USE_LIBLTDL, [1], [Use libtool's ltdl interface.]), AC_MSG_ERROR([could not find API for loading modules]) ) fi AC_SEARCH_LIBS(socket, socket) # Checks for header files. AC_CHECK_HEADERS([paths.h]) # Checks for typedefs, structures, and compiler characteristics. AC_TYPE_INT32_T AC_TYPE_UINT32_T AC_TYPE_INT64_T AC_TYPE_UINT64_T AC_CHECK_SIZEOF([long]) AC_CHECK_TYPES([u_char, u_int, u_long]) AC_CHECK_MEMBER([struct tm.tm_gmtoff], AC_DEFINE(HAVE_TM_GMTOFF, [1], [Define to 1 if struct tm has tm_gmtoff field.]), [], [#include ] ) AC_LANG_WERROR AC_MSG_CHECKING([attribute "format"]) AC_COMPILE_IFELSE( [AC_LANG_SOURCE([[ #include #include void bar(const char *, ...) __attribute__ ((format (printf, 1, 2))); void bar(const char *format, ...) { va_list ap; va_start(ap, format); vprintf(format, ap); va_end(ap); } ]])], [AC_MSG_RESULT([yes]); AC_DEFINE(HAVE_ATTR_FORMAT, [1], [Define to 1 if you have the "format" attribute.])], [AC_MSG_RESULT([no])] ) AC_MSG_CHECKING([attribute "noreturn"]) AC_COMPILE_IFELSE( [AC_LANG_SOURCE([[ #include void bar(void) __attribute__ ((noreturn)); void bar(void) { exit(0); } ]])], [AC_MSG_RESULT([yes]); AC_DEFINE(ATTR_NORETURN, [__attribute__ ((noreturn))], ["noreturn" attribute.])], [AC_MSG_RESULT([no]); AC_DEFINE(ATTR_NORETURN, [], ["noreturn" attribute.])] ) AC_MSG_CHECKING([attribute "packed"]) AC_COMPILE_IFELSE( [AC_LANG_SOURCE([[ struct bar { int x; } __attribute__ ((packed)); ]])], [AC_MSG_RESULT([yes]); AC_DEFINE(ATTR_PACKED, [__attribute__ ((packed))], ["packed" attribute.])], [AC_MSG_RESULT([no]); AC_DEFINE(ATTR_PACKED, [], ["packed" attribute.])] ) AC_MSG_CHECKING([attribute "unused"]) AC_COMPILE_IFELSE( [AC_LANG_SOURCE([[ int x __attribute__((unused)); int bar(int y __attribute__((unused))) { return 0; } ]])], [AC_MSG_RESULT([yes]); AC_DEFINE(ATTR_UNUSED, [__attribute__ ((unused))], ["unused" attribute.])], [AC_MSG_RESULT([no]); AC_DEFINE(ATTR_UNUSED, [], ["unused" attribute.])] ) ac_[]_AC_LANG_ABBREV[]_werror_flag= # Some systems incorrectly place macro variables in and # , so it is better to include both of them. AC_CHECK_DECLS(PRIu64, [have_PRIu64=yes], [have_PRIu64=no], [ #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif ] ) AC_DEFUN([MY_CHECK_PRINTF_UINT64], [ AC_MSG_CHECKING([whether printf accepts uint64_t for %$1]) AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include #include #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifndef UINT64_MAX # ifdef UINT64_C # define UINT64_MAX UINT64_C(0xffffffffffffffff) # else # define UINT64_MAX 0xffffffffffffffffULL # endif #endif int main(void) { char buf[21]; if (snprintf(buf, sizeof buf, "%$1", UINT64_MAX) != 20) return 1; return strcmp(buf, "18446744073709551615") == 0 ? 0 : 1; } ]])], [AC_MSG_RESULT([yes]); my_cv_printf_uint64_$1=yes], [AC_MSG_RESULT([no]); my_cv_printf_uint64_$1=no], [AC_MSG_RESULT([no]); my_cv_printf_uint64_$1=no] ) ]) if test "${have_PRIu64}" = "no"; then if test ${ac_cv_sizeof_long} -eq 4; then MY_CHECK_PRINTF_UINT64(llu) if test "${my_cv_printf_uint64_llu}" = "yes"; then AC_DEFINE(PRIu64, ["llu"], [PRIu64 conversion specifier for printf.]) else MY_CHECK_PRINTF_UINT64(qu) if test "${my_cv_printf_uint64_qu}" = "yes"; then AC_DEFINE(PRIu64, ["qu"], [PRIu64 conversion specifier for printf.]) else AC_MSG_ERROR([could not find good printf conversion specifier for uint64_t]) fi fi else AC_DEFINE(PRIu64, ["lu"], [PRIu64 conversion specifier for printf.]) fi fi # Checks for library functions. AC_CHECK_FUNCS([closefrom vsyslog]) # Finish configuration. if test "${GCC}" = "yes" -a ${with_gcc_warns} = "yes"; then CFLAGS="${CFLAGS} -Wall -Wformat -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wshadow -Wstrict-prototypes -Wswitch -Wunused" if test "${with_gcc_more_warns}" = "yes"; then CFLAGS="${CFLAGS} -W -Wcast-align -Wcast-qual -Wredundant-decls -Wwrite-strings" fi fi AC_SUBST(piddir) AC_SUBST(sockdir) AC_SUBST(mandir_ru) AH_TOP([/* $Revision: 1.3.2.8 $ */]) AH_BOTTOM([#include "config_add.h"]) AC_OUTPUT