X-Git-Url: https://unix4lyfe.org/gitweb/darkstat/blobdiff_plain/db8ddd7f6ca3a8bcb5fc8170a1b05427dc5e83c9..f5bd555f2371566b87c249c27ee696e332a861b3:/configure.ac diff --git a/configure.ac b/configure.ac index 805570c..cd530a4 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,6 @@ -AC_INIT(darkstat, 3.0.0-git) +# Need at least 2.64 for PACKAGE_URL +AC_PREREQ([2.64]) +AC_INIT(darkstat, 3.0.0-git, , , http://unix4lyfe.org/darkstat/) AC_CONFIG_SRCDIR([darkstat.c]) AC_CONFIG_HEADER([config.h]) @@ -40,6 +42,16 @@ AC_DEFINE_UNQUOTED(PRIVDROP_USER, "$_pdu", [User to privdrop to.]) AC_PROG_INSTALL AC_PROG_CC +m4_pattern_allow([^AM_DEFAULT_VERBOSITY$]) +AC_ARG_ENABLE([silent-rules], +[ --enable-silent-rules less verbose build output (undo: 'make V=1') + --disable-silent-rules verbose build output (undo: 'make V=0')]) +case $enable_silent_rules in +no) AM_DEFAULT_VERBOSITY=1;; +*) AM_DEFAULT_VERBOSITY=0;; +esac +AC_SUBST([AM_DEFAULT_VERBOSITY]) + # Let user disable debugging symbols so we create smaller binaries. AC_MSG_CHECKING(if we want debug code) AC_ARG_ENABLE(debug, AS_HELP_STRING([--disable-debug], @@ -68,108 +80,39 @@ else CFLAGS="$save_cflags" fi -AC_ARG_ENABLE(mad-warnings, AS_HELP_STRING([--enable-mad-warnings], - [turn on lots of compile-time warnings, this needs GCC and is only - really useful for development]), +AC_MSG_CHECKING(if your C compiler has a link-time optimizer) +if test x$GCC = xyes; then + save_cflags="$CFLAGS" + CFLAGS="-flto $CFLAGS" + if (eval $ac_link) 2>/dev/null; then + AC_MSG_RESULT(sure does) + else + AC_MSG_RESULT(no) + CFLAGS="$save_cflags" + fi +else + AC_MSG_RESULT(skipped) +fi + +AC_ARG_ENABLE(warnings, AS_HELP_STRING([--enable-warnings], + [turn on lots of compile-time warnings, + these are only useful for development]), [if test "x$enableval" = "xyes" ; then - AC_MSG_CHECKING(if your C compiler throws mad warnings) + AC_MSG_CHECKING(if your C compiler has gcc-like --extra-warnings) save_cflags="$CFLAGS" - CFLAGS="$CFLAGS -fdiagnostics-show-option \ --Wabi \ --Waddress \ --Waggregate-return \ --Wall \ --Warray-bounds \ --Wbad-function-cast \ --Wcast-align \ --Wcast-qual \ --Wchar-subscripts \ --Wclobbered \ --Wcomment \ --Wcoverage-mismatch \ --Wdeclaration-after-statement \ --Wdisabled-optimization \ --Wempty-body \ --Wextra \ --Wfloat-equal \ --Wformat \ --Wformat=2 \ --Wformat-nonliteral \ --Wformat-security \ --Wformat-y2k \ --Wignored-qualifiers \ --Wimplicit \ --Wimplicit-function-declaration \ --Wimplicit-int \ --Winit-self \ --Winline \ --Winvalid-pch \ --Wlogical-op \ --Wlong-long \ --Wmain \ --Wmissing-braces \ --Wmissing-declarations \ --Wmissing-field-initializers \ --Wmissing-format-attribute \ --Wmissing-include-dirs \ --Wmissing-noreturn \ --Wmissing-parameter-type \ --Wmissing-prototypes \ --Wnested-externs \ --Wnonnull \ --Wold-style-declaration \ --Wold-style-definition \ --Wpacked \ --Wpacked-bitfield-compat \ --Wparentheses \ --Wpointer-arith \ --Wpointer-sign \ --Wredundant-decls \ --Wreturn-type \ --Wsequence-point \ --Wshadow \ --Wsign-compare \ --Wstrict-aliasing -fstrict-aliasing \ --Wstrict-overflow=5 -fstrict-overflow \ --Wstrict-prototypes \ --Wswitch \ --Wswitch-default \ --Wswitch-enum \ --Wsync-nand \ --Wtrigraphs \ --Wtype-limits \ --Wundef \ --Wuninitialized \ --Wunknown-pragmas \ --Wunsafe-loop-optimizations \ --Wunused \ --Wunused-function \ --Wunused-label \ --Wunused-parameter \ --Wunused-value \ --Wunused-variable \ --Wvariadic-macros \ --Wvla \ --Wvolatile-register-var \ --Wwrite-strings \ -" - -# the above are valid for gcc version 4.4.3 -# we skip: -#-pedantic -#-Wc++-compat -#-Wconversion -#-Wfatal-errors -#-Wpadded -#-Wsign-conversion -#-Wstack-protector -#-Wsystem-headers -#-Wtraditional -#-Wtraditional-conversion -#-Wunreachable-code + CFLAGS="$CFLAGS -fdiagnostics-show-option --all-warnings --extra-warnings" + if (eval $ac_link) 2>/dev/null; then + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(no) + CFLAGS="$save_cflags" + fi + AC_MSG_CHECKING(if your C compiler has clang-like -Weverything) + save_cflags="$CFLAGS" + CFLAGS="$CFLAGS -Weverything" if (eval $ac_link) 2>/dev/null; then - AC_MSG_RESULT(sure does) + AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) CFLAGS="$save_cflags" @@ -201,11 +144,24 @@ END # Check for Solaris. # Must do at least socket and nsl before checking for libpcap. -AC_CHECK_LIB(nsl, gethostbyname) -AC_CHECK_LIB(socket, socket) -AC_CHECK_LIB(resolv, inet_aton) +AC_SEARCH_LIBS(gethostbyname, [nsl], [], + [AC_MSG_ERROR([gethostbyname() not found])]) +AC_SEARCH_LIBS(socket, [socket], [], + [AC_MSG_ERROR([socket() not found])]) +AC_SEARCH_LIBS(hstrerror, [resolv], [], + [AC_MSG_ERROR([hstrerror() not found])]) + +# Solaris need sys/filio.h for FIONBIO +AC_CHECK_HEADERS(sys/filio.h) + +# This is the modern way. Older systems use the ioctl method. +AC_SEARCH_LIBS(getifaddrs, [c], + [AC_CHECK_HEADERS(ifaddrs.h)]) + +# Some OSes (Solaris) need sys/sockio.h for SIOCGIFADDR +AC_CHECK_HEADERS(sys/sockio.h) # Check for libpcap AC_ARG_WITH(pcap, AS_HELP_STRING([--with-pcap=DIR], @@ -242,33 +198,26 @@ if test -n "$PCAP_BROKEN" ; then cat <