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
9 AC_ARG_WITH([libexecsmtpddir],
10 [AS_HELP_STRING([--with-libexecsmtpddir=DIR], ["OpenSMTPD libexec binary location [LIBEXECDIR/smtpd]"])],
11 [libexecsmtpddir=$withval],
12 [libexecsmtpddir="\${libexecdir}/smtpd"])
13 AC_SUBST([libexecsmtpddir], [$libexecsmtpddir])
17 AC_REPLACE_FUNCS([fgetln strtonum reallocarray recallocarray strcasestr])
19 AC_CHECK_FUNCS([asr_run pledge])
21 AC_CHECK_MEMBERS([struct sockaddr.sa_len], , ,
23 #include <netinet/in.h>
24 #include <sys/socket.h> ]
27 AC_CHECK_MEMBERS([struct sockaddr_storage.ss_len], , ,
29 #include <netinet/in.h>
30 #include <sys/socket.h> ]
33 AC_CHECK_MEMBERS([struct sockaddr_in.sin_len], , ,
35 #include <netinet/in.h>
36 #include <sys/socket.h> ]
39 AC_CHECK_MEMBERS([struct sockaddr_in6.sin6_len], , ,
41 #include <netinet/in.h>
42 #include <sys/socket.h> ]
45 dnl on OpenBSD, make sure to use libevent and libasr from base
46 dnl on other system, we *must* use the bundled libasr.
51 AC_SEARCH_LIBS([event_init], [event], [],
52 [AC_MSG_ERROR([requires libevent])])
55 PKG_CHECK_MODULES([libevent2], [libevent_core >= 2], [
56 AC_DEFINE([HAVE_EVENT2], 1, [1 if using event2])
57 CFLAGS="$libevent2_CFLAGS $CFLAGS"
58 LIBS="$libevent2_LIBS $LIBS"
59 ], [AC_MSG_ERROR([requires libevent])])
63 AC_SEARCH_LIBS([osmtpd_run], [opensmtpd], [], [
64 AC_MSG_ERROR([cannot find libopensmtpd])
67 # check compiler flags
68 AC_DEFUN([CC_ADD_CHECK_FLAGS], [
69 AC_MSG_CHECKING([if $CC supports $1 flag])
71 CFLAGS="$CFLAGS -Werror $1"
72 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])], [
74 CFLAGS="$old_CFLAGS $1"
80 CC_ADD_CHECK_FLAGS([-Wall])
81 CC_ADD_CHECK_FLAGS([-Wstrict-prototypes])
82 CC_ADD_CHECK_FLAGS([-Wmissing-prototypes])
83 CC_ADD_CHECK_FLAGS([-Wmissing-declarations])
84 CC_ADD_CHECK_FLAGS([-Wshadow])
85 dnl CC_ADD_CHECK_FLAGS([-Wcast-qual])
86 CC_ADD_CHECK_FLAGS([-Wpointer-arith])
87 CC_ADD_CHECK_FLAGS([-Wsign-compare])
89 dnl to build asr warning-free
90 dnl CC_ADD_CHECK_FLAGS([-Wno-pointer-sign])
91 dnl CC_ADD_CHECK_FLAGS([-Wno-unused-function])
92 dnl CC_ADD_CHECK_FLAGS([-Wno-deprecated-declarations])
94 AS_IF([test "x$need_libasr" = xyes], [
95 AM_CFLAGS="$AM_CFLAGS -I\${top_srcdir}/compat/libasr"
97 AM_CONDITIONAL([NEED_LIBASR], [test "x$need_libasr" = xyes])
100 AC_CONFIG_HEADERS([config.h])
101 AC_CONFIG_FILES([GNUmakefile compat/Makefile compat/libasr/Makefile])