dnl $Header: /cvsroot/dhcp-agent/dhcp-agent/configure.ac,v 1.15 2003/07/15 11:01:27 actmodern Exp $ dnl dnl Second try at writing a more coherent configure script. dnl We've layed it out per the gnu autoconf manual dnl Please look at: dnl http://www.gnu.org/manual/autoconf/html_node/configure.ac-Layout.html#configure.ac%20Layout dnl before making any changes. dnl dnl -- tmh@whitefang.com dnl dnl init dnl AC_PREREQ(2.57) AC_INIT([dhcp-agent],[0.41],[tmh@whitefang.com]) AM_INIT_AUTOMAKE([dhcp-agent], [0.41]) AC_CONFIG_SRCDIR([src/dhcp-client.c]) dnl dnl command line options dnl dnl fail-on-warning option for strict compilation FAIL_ON_WARNING="no" AC_ARG_ENABLE(fail-on-warning, AC_HELP_STRING([--enable-fail-on-warning], [fail on compiler warning (default is NO)]), [case "${enableval}" in yes | y) FAIL_ON_WARNING="yes" ;; no | n) FAIL_ON_WARNING="no" ;; *) AC_MSG_ERROR(bad value ${enableval} for --enable-fail-on-warning) ;; esac]) dnl allow user to pick HTML documentation AC_ARG_ENABLE(htmldoc, AC_HELP_STRING([--enable-htmldoc], [generate html documentation (default is NO)]), [case "${enableval}" in yes) htmldoc=true ;; no) htmldoc=false ;; *) AC_MSG_ERROR(bad value ${enableval} for --enable-htmldoc) ;; esac],[htmldoc=false]) AM_CONDITIONAL(HTMLDOC, test x$htmldoc = xtrue) dnl allow user to pick where dhcp-agent does its work dnl check for CC, INSTALL, and sane make AC_PROG_CC AC_PROG_INSTALL AC_PROG_MAKE_SET AC_PROG_LIBTOOL dnl check header files we should have AC_HEADER_STDC AC_CHECK_HEADERS(inttypes.h signal.h varargs.h stdarg.h sys/utsname.h getopt.h) dnl dnl check for types dnl AC_CHECK_TYPE(sig_atomic_t, [AC_DEFINE(HAVE_SIG_ATOMIC_T, 1, [have sigatomic_t])], [], [#include ]) AC_CHECK_TYPE(struct bpf_timeval, [AC_DEFINE(HAVE_BPF_TIMEVAL, 1, [have struct bpf_timeval])], [], [#include #include #include #include ]) dnl try finding or generating our own C99 stdint macros AC_WF_TRY_PRI_MACROS if test "x$have_primacros" = "x"; then dnl this ought to work -- i think :-) echo > stdint_marcos.h echo "#define PRIi8 \"i\"" >> stdint_marcos.h echo "#define PRIi16 \"i\"" >> stdint_marcos.h echo "#define PRIi32 \"i\"" >> stdint_marcos.h echo "#define PRIu8 \"u\"" >> stdint_marcos.h echo "#define PRIu16 \"u\"" >> stdint_marcos.h echo "#define PRIu32 \"u\"" >> stdint_marcos.h echo "#define SCNi8 \"hhi\"" >> stdint_marcos.h echo "#define SCNi16 \"hi\"" >> stdint_marcos.h echo "#define SCNi32 \"i\"" >> stdint_marcos.h echo "#define SCNu8 \"hhu\"" >> stdint_marcos.h echo "#define SCNu16 \"hu\"" >> stdint_marcos.h echo "#define SCNu32 \"u\"" >> stdint_marcos.h AC_DEFINE(HAVE_STDINT_MARCOS_H, 1, [ generated our own primacros ]) echo " done!" fi AC_TYPE_SIGNAL dnl check for functions AC_CHECK_FUNCS(strdup uname calloc daemon rename sysconf getrusage getprogname) dnl other checks dnl check if kill(pid, 0) can be used to detect a process AC_WF_CHECK_KILL_SIGNAL_DETECT dnl check for BPF_IMMEDIATE flag AC_WF_CHECK_BPF_IMMEDIATE dnl check for __progname AC_MSG_CHECKING(for __progname) AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include #include extern const char *__progname; ]], [[ __progname = 0; ]])],[ have_progname="yes" ],[ have_progname="no" ]) if test $have_progname = "yes"; then AC_DEFINE(HAVE_PROGNAME, 1, [have __progname var ]) AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi dnl pcap sifting if test -z "$pcap_prefix"; then dnl excessive pcap sifting AC_WF_CHECK_PCAP_LIB_DIR PCAP_LIB="-L$ac_pcap_lib_dir -lpcap" AC_WF_CHECK_PCAP_HEADER_DIR PCAP_INC="-I$ac_pcap_header_dir" else dnl if we've been passed the correct options just force a set. PCAP_INC="-I$pcap_prefix/include" PCAP_LIB="-L$pcap_prefix/lib -lpcap" fi dnl check for pcap_freecode AC_MSG_CHECKING([pcap_freecode in pcap]) LIBS=$PCAP_LIB AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ pcap_freecode(); ]])],[ have_pcap_freecode="yes" ],[ have_pcap_freecode="no" ]) LIBS= if test x$have_pcap_freecode = "xyes"; then AC_MSG_RESULT([found]) AC_DEFINE(HAVE_PCAP_FREECODE, 1, [have pcap_freecode()]) else AC_MSG_RESULT([not found]) AC_MSG_WARN([you don't seem to have an up to date libpcap installed. i could not find pcap_freecode() because of this you may encounter a small memory leak. please considering updating to the latest pcap distribution from http://www.tcpdump.org/]) fi AC_MSG_CHECKING(BIOCIMMEDIATE) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include #include #include ]], [[ ioctl(0, BIOCIMMEDIATE, NULL);]])],[AC_MSG_RESULT(found) AC_DEFINE(HAVE_BPF_IMMEDIATE, 1, [have BPF_IMMEDIATE])],[AC_MSG_RESULT(not found)]) dnl dnl libdnet sifting; actually it's a lot more well behaved dnl than pcap. dnl begin by looking for dnet-config if we find it, then dnl just use it to get the include and lib dirs. dnl AC_PATH_PROGS(DNET_PATH, [dnet-config], [no]) if test $DNET_PATH = "no"; then AC_MSG_ERROR([libdnet not found. get a copy from http://libdnet.sourceforge.net]) else DNET_LIB="`dnet-config --libs`" DNET_INC="`dnet-config --cflags`" fi AC_PATH_PROGS(GUILE_PATH, [guile-config], [no]) if test $GUILE_PATH = "no"; then AC_MSG_ERROR([could not find guile on this system. get a copy from http://www.gnu.org/software/guile]) else GUILE_LIB="`guile-config link`" GUILE_INC="`guile-config compile`" fi if test x$htmldoc = "xtrue"; then AC_PATH_PROGS(TEXI2HTML_PATH, [texi2html], [no]) if test $TEXI2HTML_PATH = "no"; then AC_MSG_ERROR([you selected --enable-htmldoc and no texi2html has been found. please install texi2html first.]) fi; fi dnl dnl setup paths so they can be passed to the Makefile.in dnl dhcpsysconfdir="${sysconfdir}/${PACKAGE_NAME}" dhcplocalstatedir="${localstatedir}/${PACKAGE_NAME}" dhcpsysconf_clientdir="${dhcpsysconfdir}/dhcp-client" dhcplocalstate_clientdir="${dhcplocalstatedir}/dhcp-client" dhcpsysconf_serverdir="${dhcpsysconfdir}/dhcp-server" dhcplocalstate_serverdir="${dhcplocalstatedir}/dhcp-server" dhcpdocdir="/doc/dhcp-agent" AC_SUBST(PCAP_LIB) AC_SUBST(PCAP_INC) AC_SUBST(DNET_LIB) AC_SUBST(DNET_INC) AC_SUBST(GUILE_LIB) AC_SUBST(GUILE_INC) AC_SUBST(dhcpsysconfdir) AC_SUBST(dhcpsysconf_clientdir) AC_SUBST(dhcpsysconf_serverdir) AC_SUBST(dhcplocalstatedir) AC_SUBST(dhcplocalstate_clientdir) AC_SUBST(dhcplocalstate_serverdir) AC_SUBST(infodir) AC_SUBST(dhcpdocdir) if test x"${FAIL_ON_WARNING}" = "xyes"; then CFLAGS="${CFLAGS} -Werror" fi AC_CONFIG_HEADERS([config.h]) AC_CONFIG_FILES([Makefile src/Makefile man/Makefile tests/Makefile conf/Makefile conf/dhcp-client/Makefile conf/dhcp-server/Makefile doc/Makefile contrib/Makefile]) AC_OUTPUT echo echo "DHCP Agent build configuration successful!" echo