dnl Process this file with autoconf to produce a configure script. AC_INIT(healthd.c) AC_CONFIG_HEADER(config.h) dnl System type AC_CANONICAL_HOST dnl Checks for programs. AC_PROG_CC AC_PROG_INSTALL dnl Checks for libraries. AC_CHECK_LIB(wrap, hosts_access) AC_CHECK_LIB(io, inb) AC_CHECK_LIB(i386, i386_iopl) AC_MSG_CHECKING([whether to enable remotely reading the full config]) AC_ARG_ENABLE(full_config, [ --enable-full-config Enable remotely reading the full config --disable-full-config Enable remotely reading the full config], [ case "$enableval" in no) AC_MSG_RESULT(no) full_config=no ;; *) AC_MSG_RESULT(yes) AC_DEFINE(FULL_CONFIG) full_config=yes ;; esac ], [ case "$enableval" in *) AC_MSG_RESULT(no) full_config=no ;; esac ]) if test "$full_config" = "yes"; then CPPFLAGS="-DFULL_CONFIG $CPPFLAGS" fi dnl dnl This section to check for IPv6 was copied from dnl raccoon-20000719a from www.kame.net dnl ---- start ---- AC_MSG_CHECKING([whether to enable ipv6]) AC_ARG_ENABLE(ipv6, [ --enable-ipv6 Enable ipv6 (with ipv4) support --disable-ipv6 Disable ipv6 support], [ case "$enableval" in no) AC_MSG_RESULT(no) ipv6=no ;; *) AC_MSG_RESULT(yes) AC_DEFINE(INET6) ipv6=yes ;; esac ], AC_TRY_RUN([ /* AF_INET6 avalable check */ #include #include main() { exit(0); if (socket(AF_INET6, SOCK_STREAM, 0) < 0) exit(1); else exit(0); } ], AC_MSG_RESULT(yes) AC_DEFINE(ENABLE_IPV6) ipv6=yes, AC_MSG_RESULT(no) ipv6=no, AC_MSG_RESULT(no) ipv6=no )) ipv6type=unknown ipv6lib=none ipv6libdir=none if test "$ipv6" = "yes"; then AC_MSG_CHECKING([ipv6 stack type]) for i in inria kame linux toshiba v6d zeta; do ipv6trylibc=no case $i in inria) dnl http://www.kame.net/ AC_EGREP_CPP(yes, [dnl #include #ifdef IPV6_INRIA_VERSION yes #endif], [ipv6type=$i; ipv6lib=inet6; ipv6libdir=/usr/lib; ipv6trylibc=yes CPPFLAGS="-DINET6 $CPPFLAGS"]) ;; kame) dnl http://www.kame.net/ AC_EGREP_CPP(yes, [dnl #include #ifdef __KAME__ yes #endif], [ipv6type=$i; ipv6lib=inet6; ipv6libdir=/usr/local/v6/lib; ipv6trylibc=yes CPPFLAGS="-DINET6 $CPPFLAGS"]) ;; linux) dnl http://www.v6.linux.or.jp/ if test -d /usr/inet6; then ipv6type=$i ipv6lib=inet6 ipv6libdir=/usr/inet6/lib CPPFLAGS="-DINET6 -I/usr/inet6/include $CPPFLAGS" fi ;; toshiba) AC_EGREP_CPP(yes, [dnl #include #ifdef _TOSHIBA_INET6 yes #endif], [ipv6type=$i; ipv6lib=inet6; ipv6libdir=/usr/local/v6/lib; CPPFLAGS="-DINET6 $CPPFLAGS"]) ;; v6d) AC_EGREP_CPP(yes, [dnl #include #ifdef __V6D__ yes #endif], [ipv6type=$i; ipv6lib=v6; ipv6libdir=/usr/local/v6/lib; CPPFLAGS="-I/usr/local/v6/include $CPPFLAGS"]) ;; zeta) AC_EGREP_CPP(yes, [dnl #include #ifdef _ZETA_MINAMI_INET6 yes #endif], [ipv6type=$i; ipv6lib=inet6; ipv6libdir=/usr/local/v6/lib; CPPFLAGS="-DINET6 $CPPFLAGS"]) ;; esac if test "$ipv6type" != "unknown"; then break fi done AC_MSG_RESULT($ipv6type) fi if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then echo "using lib$ipv6lib for getaddrinfo" LIBS="$LIBS -L$ipv6libdir -l$ipv6lib" else if test "$ipv6trylibc" = "yes"; then echo 'using libc for getaddrinfo' else echo "Fatal: no $ipv6lib library found. " echo "cannot continue. You need to fetch lib$ipv6lib.a " echo "from appropriate ipv6 kit and compile beforehand." exit 1 fi fi fi if test "$ipv6" = "yes"; then AC_MSG_CHECKING(for advanced API support) AC_CACHE_VAL(racoon_cv_advapi, [dnl AC_TRY_COMPILE([#ifndef INET6 #define INET6 #endif #include #include ], [struct in6_pktinfo a;], [racoon_cv_advapi="yes"], [racoon_cv_advapi="no"])]) AC_MSG_RESULT($racoon_cv_advapi) if test "$racoon_cv_advapi" = yes; then AC_DEFINE(ADVAPI) fi fi AC_MSG_CHECKING(getaddrinfo bug) AC_TRY_RUN([ #include #include #include #include #include main() { int passive, gaierr, inet4 = 0, inet6 = 0; struct addrinfo hints, *ai, *aitop; char straddr[INET6_ADDRSTRLEN], strport[16]; for (passive = 0; passive <= 1; passive++) { memset(&hints, 0, sizeof(hints)); hints.ai_family = AF_UNSPEC; hints.ai_flags = passive ? AI_PASSIVE : 0; hints.ai_socktype = SOCK_STREAM; if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) { (void)gai_strerror(gaierr); goto bad; } for (ai = aitop; ai; ai = ai->ai_next) { if (ai->ai_addr == NULL || ai->ai_addrlen == 0 || getnameinfo(ai->ai_addr, ai->ai_addrlen, straddr, sizeof(straddr), strport, sizeof(strport), NI_NUMERICHOST|NI_NUMERICSERV) != 0) { goto bad; } switch (ai->ai_family) { case AF_INET: if (strcmp(strport, "54321") != 0) { goto bad; } if (passive) { if (strcmp(straddr, "0.0.0.0") != 0) { goto bad; } } else { if (strcmp(straddr, "127.0.0.1") != 0) { goto bad; } } inet4++; break; case AF_INET6: if (strcmp(strport, "54321") != 0) { goto bad; } if (passive) { if (strcmp(straddr, "::") != 0) { goto bad; } } else { if (strcmp(straddr, "::1") != 0) { goto bad; } } inet6++; break; case AF_UNSPEC: goto bad; break; default: /* another family support? */ break; } } } if (!(inet4 == 0 || inet4 == 2)) goto bad; if (!(inet6 == 0 || inet6 == 2)) goto bad; if (aitop) freeaddrinfo(aitop); exit(0); bad: if (aitop) freeaddrinfo(aitop); exit(1); } ], AC_MSG_RESULT(good) buggygetaddrinfo=no, AC_MSG_RESULT(buggy) buggygetaddrinfo=yes, AC_MSG_RESULT(buggy) buggygetaddrinfo=yes) if test "$buggygetaddrinfo" = "yes"; then if test "$ipv6" = "yes"; then echo 'Fatal: You must get working getaddrinfo() function.' echo ' or you can specify "--disable-ipv6"'. exit 1 else CPPFLAGS="$CPPFLAGS -I./missing" fi fi AC_REPLACE_FUNCS(getaddrinfo getnameinfo) dnl ---- end ---- dnl Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS(fcntl.h sys/ioctl.h sys/time.h syslog.h unistd.h) AC_CHECK_HEADERS(machine/smb.h,[AC_DEFINE(HAVE_SMBUS)]) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_HEADER_TIME dnl Checks for library functions. AC_PROG_GCC_TRADITIONAL AC_TYPE_SIGNAL AC_CHECK_FUNCS(select socket strerror strtod strtol) AC_OUTPUT(Makefile)