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
+ [turn on lots of compile-time warnings, these are GCC-specific and only
really 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 can emit certain 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-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-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 \
-Wswitch \
-Wswitch-default \
-Wswitch-enum \
--Wsync-nand \
-Wtrigraphs \
--Wtype-limits \
-Wundef \
-Wuninitialized \
-Wunknown-pragmas \
-Wunused-value \
-Wunused-variable \
-Wvariadic-macros \
--Wvla \
-Wvolatile-register-var \
-Wwrite-strings \
"
+# The above are valid for gcc version 4.2.1.
-# the above are valid for gcc version 4.4.3
-# we skip:
+ if (eval $ac_link) 2>/dev/null; then
+ AC_MSG_RESULT(yes)
+
+ AC_MSG_CHECKING(if your C compiler can emit certain other warnings)
+ save_cflags="$CFLAGS"
+ CFLAGS="$CFLAGS \
+-Warray-bounds \
+-Wclobbered \
+-Wcoverage-mismatch \
+-Wempty-body \
+-Wignored-qualifiers \
+-Wlogical-op \
+-Wmissing-parameter-type \
+-Wold-style-declaration \
+-Wpacked-bitfield-compat \
+-Wsync-nand \
+-Wtype-limits \
+-Wvla \
+"
+# The above are valid for gcc version 4.4.3.
+# We skip the following entirely:
#-pedantic
+#-Wabi
#-Wc++-compat
#-Wconversion
#-Wfatal-errors
+#-Wlong-long
#-Wpadded
#-Wsign-conversion
#-Wstack-protector
#-Wtraditional-conversion
#-Wunreachable-code
- if (eval $ac_link) 2>/dev/null; then
- AC_MSG_RESULT(sure does)
+ if (eval $ac_link) 2>/dev/null; then
+ AC_MSG_RESULT(yes)
+ else
+ AC_MSG_RESULT(no)
+ CFLAGS="$save_cflags"
+ fi
+
else
AC_MSG_RESULT(no)
CFLAGS="$save_cflags"
[AC_MSG_ERROR([gethostbyname() not found])])
AC_SEARCH_LIBS(socket, [socket], [],
[AC_MSG_ERROR([socket() not found])])
-AC_SEARCH_LIBS(inet_aton, [resolv], [],
- [AC_MSG_ERROR([inet_aton() 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)
AC_MSG_ERROR([can't find usable libpcap])
fi
-
-# Check for BSD routines.
-AC_CHECK_FUNC(setproctitle,
- AC_DEFINE(HAVE_REAL_SETPROCTITLE, 1,
- [Define to 1 if your C lib has setproctitle().]))
-AC_CHECK_FUNC(strlcpy,
- AC_DEFINE(HAVE_REAL_STRLCPY, 1,
- [Define to 1 if your C lib has strlcpy().]))
-AC_CHECK_FUNC(strlcat,
- AC_DEFINE(HAVE_REAL_STRLCAT, 1,
- [Define to 1 if your C lib has strlcat().]))
-
-# We might find these in libbsd.
+# If not in libc, we might find these in libbsd.
AC_SEARCH_LIBS(setproctitle, [bsd],
AC_DEFINE(HAVE_SETPROCTITLE, 1,
[Define to 1 if you have setproctitle().]))
AC_DEFINE(HAVE_STRLCAT, 1,
[Define to 1 if you have strlcat().]))
+AC_CHECK_HEADERS(bsd/string.h)
+AC_CHECK_HEADERS(bsd/unistd.h)
AC_CONFIG_FILES([Makefile darkstat.8])
AC_OUTPUT