Blob


1 AC_INIT([filter-dnsbl], [v0.4], [https://src.imperialat.at/?action=summary&path=filter-dnsbl.git])
2 AC_CONFIG_AUX_DIR(etc)
3 AC_CONFIG_LIBOBJ_DIR(compat)
4 AC_CANONICAL_HOST
5 AM_INIT_AUTOMAKE([-Wall foreign subdir-objects])
6 AC_PROG_CC
7 AC_USE_SYSTEM_EXTENSIONS
9 AC_ARG_WITH([Werror],
10 AS_HELP_STRING([--with-Werror],
11 [Add the compiler flag -Werror]))
13 PKG_PROG_PKG_CONFIG
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.
21 need_libasr=yes
22 case "$host_os" in
23 *openbsd*)
24 need_libasr=no
25 AC_SEARCH_LIBS([event_init], [event], [],
26 [AC_MSG_ERROR([requires libevent])])
27 ;;
28 *)
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])])
34 ;;
35 esac
37 AC_SEARCH_LIBS([osmtpd_run], [opensmtpd], [], [
38 AC_MSG_ERROR([cannot find libopensmtpd])
39 ])
41 dnl after all the function checks, add optional support for -Werror
42 AS_IF([test "x$with_Werror" = "xyes"], [
43 CFLAGS="$CFLAGS -Werror"
44 ])
46 # check compiler flags
47 AC_DEFUN([CC_ADD_CHECK_FLAGS], [
48 AC_MSG_CHECKING([if $CC supports $1 flag])
49 old_CFLAGS="$CFLAGS"
50 CFLAGS="$CFLAGS -Werror $1"
51 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])], [
52 AC_MSG_RESULT(yes)
53 CFLAGS="$old_CFLAGS $1"
54 ], [
55 AC_MSG_RESULT(no)
56 CFLAGS="$old_CFLAGS"
57 ])
58 ])
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"
75 ])
76 AM_CONDITIONAL([NEED_LIBASR], [test "x$need_libasr" = xyes])
78 AC_SUBST([AM_CFLAGS])
79 AC_CONFIG_HEADERS([config.h])
80 AC_CONFIG_FILES([Makefile compat/Makefile compat/libasr/Makefile])
82 AC_OUTPUT