1 AC_INIT([filter-dnsbl], [v0.4], [https://src.imperialat.at/?action=summary&path=filter-dnsbl.git])
3 AC_CONFIG_LIBOBJ_DIR(compat)
5 AM_INIT_AUTOMAKE([-Wall foreign subdir-objects])
7 AC_USE_SYSTEM_EXTENSIONS
10 AS_HELP_STRING([--with-Werror],
11 [Add the compiler flag -Werror]))
15 AC_REPLACE_FUNCS([fgetln strtonum reallocarray recallocarray strcasestr])
17 AC_CHECK_FUNCS([asr_run pledge])
19 dnl on OpenBSD, make sure to use libevent and libasr from base
20 dnl on other system, we *must* use the bundled libasr.
25 AC_SEARCH_LIBS([event_init], [event], [],
26 [AC_MSG_ERROR([requires libevent])])
29 PKG_CHECK_MODULES([libevent2], [libevent_core >= 2], [
30 AC_DEFINE([HAVE_EVENT2], 1, [1 if using event2])
31 CFLAGS="$libevent2_CFLAGS $CFLAGS"
32 LIBS="$libevent2_LIBS $LIBS"
33 ], [AC_MSG_ERROR([requires libevent])])
37 AC_SEARCH_LIBS([osmtpd_run], [opensmtpd], [], [
38 AC_MSG_ERROR([cannot find libopensmtpd])
41 dnl after all the function checks, add optional support for -Werror
42 AS_IF([test "x$with_Werror" = "xyes"], [
43 CFLAGS="$CFLAGS -Werror"
46 # check compiler flags
47 AC_DEFUN([CC_ADD_CHECK_FLAGS], [
48 AC_MSG_CHECKING([if $CC supports $1 flag])
50 CFLAGS="$CFLAGS -Werror $1"
51 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])], [
53 CFLAGS="$old_CFLAGS $1"
59 CC_ADD_CHECK_FLAGS([-Wall])
60 CC_ADD_CHECK_FLAGS([-Wstrict-prototypes])
61 CC_ADD_CHECK_FLAGS([-Wmissing-prototypes])
62 CC_ADD_CHECK_FLAGS([-Wmissing-declarations])
63 CC_ADD_CHECK_FLAGS([-Wshadow])
64 dnl CC_ADD_CHECK_FLAGS([-Wcast-qual])
65 CC_ADD_CHECK_FLAGS([-Wpointer-arith])
66 CC_ADD_CHECK_FLAGS([-Wsign-compare])
68 dnl to build asr warning-free
69 dnl CC_ADD_CHECK_FLAGS([-Wno-pointer-sign])
70 dnl CC_ADD_CHECK_FLAGS([-Wno-unused-function])
71 dnl CC_ADD_CHECK_FLAGS([-Wno-deprecated-declarations])
73 AS_IF([test "x$need_libasr" = xyes], [
74 AM_CFLAGS="$AM_CFLAGS -I\${top_srcdir}/compat/libasr"
76 AM_CONDITIONAL([NEED_LIBASR], [test "x$need_libasr" = xyes])
79 AC_CONFIG_HEADERS([config.h])
80 AC_CONFIG_FILES([Makefile compat/Makefile compat/libasr/Makefile])