dnl Process this file with autoconf to produce a configure script. AC_INIT(ndpmon.c) CFLAGS="-O2" dnl find and test the C compiler AC_PROG_CC AC_LANG_C AC_PROG_MAKE_SET dnl ##################################################### dnl Set the directory for variable data dnl ##################################################### case $prefix in /usr ) VARDATADIR="/var" ;; *) VARDATADIR="/var/local" ;; esac dnl Possible to modify it with --with-var-datadir found_var=no AC_MSG_CHECKING(for custom variable data directory) AC_ARG_WITH([var-datadir], [--with-var-datadir=DIR Put Variable Data in DIR], [VARDATADIR=$withval]) for testdir in $xml2_dir /usr/local /usr ; do if test -x "${testdir}/include/libxml2" -a $found_xml2 = no ; then CFLAGS="$CFLAGS -I${testdir}/include" LIBS="$LIBS -L${testdir}/lib -lxml2" found_xml2=$testdir fi done dnl ##################################################### dnl OS Type dnl ##################################################### AC_MSG_CHECKING(OS Type) case $OSTYPE in linux-gnu | linux-gnueabi | linux | Linux ) AC_MSG_RESULT($OSTYPE) OPTIONS="$OPTIONS -D_LINUX_" MAKEDIR="make -C ./plugins/mac_resolv" ;; FreeBSD* | freebsd* | Darwin* | darwin* ) AC_MSG_RESULT($OSTYPE) CFLAGS="$CFLAGS -fno-strict-aliasing -pipe " OPTIONS="$OPTIONS -D_FREEBSD_" MAKEDIR="make -C ./plugins/mac_resolv" ;; openbsd4.1* | openbsd* | OpenBSD* ) dnl Does not seem to work, dunno why..... AC_MSG_RESULT($OSTYPE) CFLAGS="$CFLAGS -fno-strict-aliasing -pipe " OPTIONS="$OPTIONS -D_OPENBSD_" MAKEDIR="make -I" ;; netbsd* | NetBSD* ) AC_MSG_RESULT($OSTYPE) CFLAGS="$CFLAGS -fno-strict-aliasing -pipe " OPTIONS="$OPTIONS -D_OPENBSD_" MAKEDIR="cd ./plugins/mac_resolv;make;cd -" ;; *) dnl Recheck for OpenBSD with uname os=`uname` case $os in OpenBSD* | openbsd* ) AC_MSG_RESULT($os) CFLAGS="$CFLAGS -fno-strict-aliasing -pipe " OPTIONS="$OPTIONS -D_OPENBSD_" MAKEDIR="cd ./plugins/mac_resolv;make;cd -" ;; NetBSD* | netbsd* ) AC_MSG_RESULT($OSTYPE) CFLAGS="$CFLAGS -fno-strict-aliasing -pipe " OPTIONS="$OPTIONS -D_OPENBSD_" MAKEDIR="cd ./plugins/mac_resolv;make;cd -" ;; *) AC_MSG_ERROR([Only Linux, Mac Os X, FreeBSD, NetBSD and OpenBSD are supported. Please contact the author to know how you can add more OS types.]) ;; esac esac dnl ##################################################### dnl Checks for libxml2 dnl ##################################################### found_xml2=no xml2_dir=/usr/local AC_MSG_CHECKING(for libxml2) AC_ARG_WITH([libxml2], [--with-libxml2=DIR Use libxml2 in DIR], [xml2_dir=$withval]) for testdir in $xml2_dir /usr/local /usr ; do if test -x "${testdir}/include/libxml2" -a $found_xml2 = no ; then CFLAGS="$CFLAGS -I${testdir}/include" LIBS="$LIBS -L${testdir}/lib -lxml2" found_xml2=$testdir fi done if test $found_xml2 = no ; then AC_MSG_RESULT(no) AC_ERROR(Please install libxml2-dev) else AC_MSG_RESULT($found_xml2) fi dnl ##################################################### dnl Checks for libpcap dnl ##################################################### found_pcap=no pcap_dir=/usr/local AC_MSG_CHECKING(for libpcap) AC_ARG_WITH([libpcap], [--with-libpcap=DIR Use libpcap in DIR], [pcap_dir=$withval]) for testdir in $pcap_dir /usr/local /usr ; do if test -f "${testdir}/include/pcap.h" -a $found_pcap = no ; then CFLAGS="$CFLAGS -I${testdir}/include" LIBS="$LIBS -L${testdir}/lib -lpcap" found_pcap=$testdir fi done if test $found_pcap = no ; then AC_MSG_RESULT(no) AC_ERROR(Please install libpcap-dev) else AC_MSG_RESULT($found_pcap) fi dnl ##################################################### dnl Enable the debugging dnl ##################################################### debug_enable=no AC_ARG_ENABLE(debug, [--enable-debug enable use of extra debugging information [default=no]],debug_enable=yes) AC_MSG_CHECKING(for -g during building) if test "$debug_enable" = "yes"; then CFLAGS="$CFLAGS -g" AC_MSG_RESULT("Extra debugging information activated") else AC_MSG_RESULT("Extra debugging information NOT activated") fi dnl ##################################################### dnl Enable the mac_resolv plugin dnl ##################################################### AC_ARG_ENABLE(mac-resolv, [--enable-mac-resolv enable MAC Manufacturer Resolution [default=no]],enable_mac_resolv=yes) AC_MSG_CHECKING(for MAC Resolution) if test "$enable_mac_resolv" = "yes"; then OBJ="$OBJ plugins/mac_resolv/mac_resolv.o" CFLAGS="$CFLAGS -I./plugins/mac_resolv" OPTIONS="$OPTIONS -D_MACRESOLUTION_" AC_MSG_RESULT("MAC Manufacturer Resolution activated") else AC_MSG_RESULT("MAC Manufacturer Resolution NOT activated") fi AC_HEADER_STDC AC_HAVE_HEADERS(stdlib.h errno.h signal.h stdio.h string.h sys/stat.h sys/wait.h unistd.h syslog.h) AC_HAVE_HEADERS(stdio.h time.h netinet/in.h netinet/ether.h netinet/ip6.h netinet/icmp6.h pcap.h time.h arpa/inet.h) dnl AC_HAVE_HEADERS(libxml/parser.h libxml/tree.h libxml/xpath.h libxml/encoding.h libxml/xmlwriter.h) AC_CHECK_FUNCS(getaddrinfo socket ntohs inet_pton inet_ntop,,AC_MSG_ERROR([Required standard library function missing])) AC_SUBST(CFLAGS) AC_SUBST(LIBS) AC_SUBST(OBJ) AC_SUBST(OPTIONS) AC_SUBST(MAKEDIR) AC_SUBST(VARDATADIR) dnl read Makefile.in and write Makefile AC_OUTPUT([Makefile ndpmon.sh plugins/mac_resolv/Makefile ndpmon_defs.h config_ndpmon.xml neighbor_list.xml])