AC_INIT
AC_CONFIG_SRCDIR([src/nd.h])
AC_SUBST(version_major)
AC_SUBST(version_minor)
version_major=0.4
version_minor=7
AC_DEFINE_UNQUOTED(VERSION_MAJOR, "$version_major", [Major package version])
AC_DEFINE_UNQUOTED(VERSION_MINOR, "$version_minor", [Minor package version])
AM_INIT_AUTOMAKE(netdude, "$version_major.$version_minor")
AM_CONFIG_HEADER([config.h])
dnl Commands for funkier shtool output:
BLD_ON=`./shtool echo -n -e %B`
BLD_OFF=`./shtool echo -n -e %b`
AC_PROG_CC
AC_PROG_MAKE_SET
AC_LIBLTDL_CONVENIENCE
AC_CONFIG_SUBDIRS(libltdl)
AC_LIBTOOL_DLOPEN
AM_PROG_LIBTOOL
AC_DEFINE(LT_NON_POSIX_NAMESPACE, 1, [For libtool -- what exactly was this for again???])
AC_CANONICAL_HOST
AC_C_BIGENDIAN
AM_CONDITIONAL(SOLARIS_HOST, false)
AM_CONDITIONAL(LINUX_HOST, false)
AM_CONDITIONAL(BSD_HOST, false)
AM_CONDITIONAL(APPLE_HOST, false)
case "$host" in
*-solaris*)
AC_DEFINE(SOLARIS_HOST, 1, [Whether this is a Solaris host])
AM_CONDITIONAL(SOLARIS_HOST, true)
;;
*-linux*)
AC_DEFINE(LINUX_HOST, 1, [Whether this is a Linux host])
AM_CONDITIONAL(LINUX_HOST, true)
;;
*bsd*)
AC_DEFINE(BSD_HOST, 1, [Whether this is a BSD host])
AM_CONDITIONAL(BSD_HOST, true)
;;
*-apple*)
AC_DEFINE(BSD_HOST, 1, [Whether this is a BSD host])
AM_CONDITIONAL(BSD_HOST, true)
AC_DEFINE(APPLE_HOST, 1, [Whether this is an Apple host])
AM_CONDITIONAL(APPLE_HOST, true)
;;
esac
dnl ##################################################
dnl # Set PACKAGE_PREFIX in config.h.
dnl ##################################################
if test "x${prefix}" = "xNONE"; then
AC_DEFINE_UNQUOTED(PACKAGE_PREFIX, "${ac_default_prefix}", [The installation prefix of the package])
else
AC_DEFINE_UNQUOTED(PACKAGE_PREFIX, "${prefix}", [The installation prefix of the package])
fi
dnl ##################################################
dnl # Set PACKAGE_LOCALE_DIR in config.h.
dnl ##################################################
if test "x${prefix}" = "xNONE"; then
AC_DEFINE_UNQUOTED(PACKAGE_LOCALE_DIR, "${ac_default_prefix}/${DATADIRNAME}/locale", [The locale dir of the package])
else
AC_DEFINE_UNQUOTED(PACKAGE_LOCALE_DIR, "${prefix}/${DATADIRNAME}/locale", [The locale dir of the package])
fi
dnl ##################################################
dnl # Set PACKAGE_DATA_DIR in config.h.
dnl ##################################################
if test "x${datadir}" = 'x${prefix}/share'; then
if test "x${prefix}" = "xNONE"; then
AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${ac_default_prefix}/share/${PACKAGE}", [The data dir of the package])
else
AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${prefix}/share/${PACKAGE}", [The data dir of the package])
fi
else
AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${datadir}/${PACKAGE}", [The data dir of the package])
fi
dnl ##################################################
dnl # Set PACKAGE_SOURCE_DIR in config.h.
dnl ##################################################
packagesrcdir=`cd $srcdir && pwd`
AC_DEFINE_UNQUOTED(PACKAGE_SOURCE_DIR, "${packagesrcdir}", [The source dir of the package])
dnl ##################################################
dnl # Set PACKAGE_INCLUDE_DIR in config.h
dnl ##################################################
if test "x${includedir}" = 'x${prefix}/include'; then
if test "x${prefix}" = "xNONE"; then
AC_DEFINE_UNQUOTED(PACKAGE_INCLUDE_DIR, "${ac_default_prefix}/include", [The header dir being used])
else
AC_DEFINE_UNQUOTED(PACKAGE_INCLUDE_DIR, "${prefix}/include", [The header dir being used])
fi
else
packageincludedir=`eval eval eval eval "echo $includedir"`
AC_DEFINE_UNQUOTED(PACKAGE_INCLUDE_DIR, "${packageincludedir}", [The header dir being used])
fi
dnl ##################################################
dnl # Check for GTK.
dnl ##################################################
AC_ARG_WITH(gtk,
AC_HELP_STRING([--with-gtk=DIR], [Use GTK in
]),
[CFLAGS="$CFLAGS -I$withval/include"
LIBS="-L$withval/lib $LIBS"])
AC_PATH_GENERIC(gtk,, [
AC_SUBST(gtk_libs)
AC_SUBST(gtk_cflags)],
AC_MSG_ERROR(Cannot find GTK: Is gtk-config in path?))
gtk_libs=`gtk-config --libs`
gtk_cflags=`gtk-config --cflags`
dnl ##################################################
dnl # Check for libnetdude
dnl ##################################################
AC_ARG_WITH(lndtool,
AC_HELP_STRING([--with-lndtool=FILE], [Use given lndtool]),
[ lndtool="$withval" ],
[ AC_PATH_PROG(lndtool, lndtool,
AC_MSG_ERROR(Cannot find lndtool: is it in path?)) ])
LIBNETDUDE_CFLAGS=`$lndtool --cflags`
LIBNETDUDE_DIR=`$lndtool --plugin-dir`
LIBNETDUDE_LIBS=`$lndtool --libs`
AC_SUBST(LIBNETDUDE_CFLAGS)
AC_SUBST(LIBNETDUDE_DIR)
AC_SUBST(LIBNETDUDE_LIBS)
dnl ##################################################
dnl # Check for FAM, the file alteration monitor.
dnl ##################################################
AC_ARG_WITH(fam,
AC_HELP_STRING([--with-fam=DIR], [Use fam in ]),
[CPPFLAGS="$CPPFLAGS -I$withval/include"; LDFLAGS="$LDFLAGS -L$withval/lib"])
AC_CHECK_HEADERS([fam.h], , fam_header_ok="no")
AC_CHECK_LIB(fam, main, , fam_lib_ok="no")
if test "$fam_header_ok" = "no" -o "$fam_lib_ok" = "no"; then
fam="no"
else
fam="yes"
fi;
##################################################
# Check for gtk-doc.
##################################################
AC_ARG_WITH(html-dir, [ --with-html-dir=PATH path to installed docs ])
if test "x$with_html_dir" = "x" ; then
HTML_DIR='${datadir}/gtk-doc/html'
else
HTML_DIR=$with_html_dir
fi
AC_SUBST(HTML_DIR)
AC_CHECK_PROG(GTKDOC, gtkdoc-mkdb, true, false)
gtk_doc_min_version_maj=0
gtk_doc_min_version_min=6
if $GTKDOC ; then
gtk_doc_version=`gtkdoc-mkdb --version`
AC_MSG_CHECKING([gtk-doc version ($gtk_doc_version) >= $gtk_doc_min_version_maj.$gtk_doc_min_version_min])
if perl < "$gtk_doc_min_version_maj") ||
(("\$1" == "$gtk_doc_min_version_maj") &&
("\$2" >= "$gtk_doc_min_version_min")))) ? 0 : 1);
EOF
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
GTKDOC=false
fi
fi
dnl Let people disable the gtk-doc stuff.
AC_ARG_ENABLE(gtk-doc, [ --enable-gtk-doc Use gtk-doc to build documentation [default=auto]], enable_gtk_doc="$enableval", enable_gtk_doc=auto)
if test x$enable_gtk_doc = xauto ; then
if test x$GTKDOC = xtrue ; then
enable_gtk_doc=yes
else
enable_gtk_doc=no
fi
fi
AM_CONDITIONAL(ENABLE_GTK_DOC, test x$enable_gtk_doc = xyes)
dnl ##################################################
dnl # Debugging enable/disable switch
dnl ##################################################
AC_ARG_ENABLE(debugging,
AC_HELP_STRING([--enable-debugging], [Use debugging macros to produce helpful output (disabled by default)]),
debugging="yes",
debugging="no")
if test x$debugging = xyes; then
AC_DEFINE_UNQUOTED(ND_DEBUG, 1, [Enable debugging output])
fi
dnl AC_OUTPUT_COMMANDS([if test ! -e intl/libintl.h; then ln -s libgnuintl.h intl/libintl.h; fi])
dnl Make sure our version of the mkhtml utility is executable:
AC_CONFIG_COMMANDS([mkhtml], [chmod 755 $ac_top_srcdir/doc/netdude-manual/mkhtml])
dnl ##################################################
dnl # Release build enable/disable switch
dnl ##################################################
AC_DEFINE_UNQUOTED(RELEASE, 1, [Enable release build])
AC_CONFIG_FILES([
Makefile
src/Makefile
plugins/Makefile
plugins/ChecksumFix/Makefile
plugins/BPF-Filter/Makefile
protocols/Makefile
protocols/arp/Makefile
protocols/ether/Makefile
protocols/fddi/Makefile
protocols/icmp/Makefile
protocols/ip/Makefile
protocols/linux-sll/Makefile
protocols/snap/Makefile
protocols/tcp/Makefile
protocols/udp/Makefile
pixmaps/Makefile
doc/Makefile
doc/netdude-manual/Makefile
])
AC_OUTPUT
dnl ##################################################
dnl # Print summary
dnl ##################################################
echo
echo " "${BLD_ON}"Netdude $version_major Configuration Summary"${BLD_OFF}
echo "===================================================="
echo
echo " libnetdude configuration: "${BLD_ON}"$lndtool"${BLD_OFF}
echo " FAM support: "${BLD_ON}"$fam"${BLD_OFF}
echo " Debugging enabled: "${BLD_ON}"$debugging"${BLD_OFF}
echo
echo " Setup finished. Now run:"
echo
echo " $ "${BLD_ON}"make"${BLD_OFF}
echo " # "${BLD_ON}"make install"${BLD_OFF}
echo
echo " (or use "${BLD_ON}"gmake"${BLD_OFF}" when make on your platform isn't GNU make)"
echo