Blame


1 734e1bdf 2025-12-20 op AC_INIT([filter-dnsbl], [v0.4], [https://src.imperialat.at/?action=summary&path=filter-dnsbl.git])
2 734e1bdf 2025-12-20 op AC_CONFIG_AUX_DIR(etc)
3 734e1bdf 2025-12-20 op AC_CONFIG_LIBOBJ_DIR(compat)
4 734e1bdf 2025-12-20 op AC_CANONICAL_HOST
5 734e1bdf 2025-12-20 op AM_INIT_AUTOMAKE([-Wall foreign subdir-objects])
6 734e1bdf 2025-12-20 op AC_PROG_CC
7 734e1bdf 2025-12-20 op AC_USE_SYSTEM_EXTENSIONS
8 734e1bdf 2025-12-20 op
9 734e1bdf 2025-12-20 op AC_ARG_WITH([Werror],
10 734e1bdf 2025-12-20 op AS_HELP_STRING([--with-Werror],
11 734e1bdf 2025-12-20 op [Add the compiler flag -Werror]))
12 734e1bdf 2025-12-20 op
13 734e1bdf 2025-12-20 op PKG_PROG_PKG_CONFIG
14 734e1bdf 2025-12-20 op
15 734e1bdf 2025-12-20 op AC_REPLACE_FUNCS([fgetln strtonum reallocarray recallocarray strcasestr])
16 734e1bdf 2025-12-20 op
17 734e1bdf 2025-12-20 op AC_CHECK_FUNCS([asr_run pledge])
18 734e1bdf 2025-12-20 op
19 734e1bdf 2025-12-20 op dnl on OpenBSD, make sure to use libevent and libasr from base
20 734e1bdf 2025-12-20 op dnl on other system, we *must* use the bundled libasr.
21 734e1bdf 2025-12-20 op need_libasr=yes
22 734e1bdf 2025-12-20 op case "$host_os" in
23 734e1bdf 2025-12-20 op *openbsd*)
24 734e1bdf 2025-12-20 op need_libasr=no
25 734e1bdf 2025-12-20 op AC_SEARCH_LIBS([event_init], [event], [],
26 734e1bdf 2025-12-20 op [AC_MSG_ERROR([requires libevent])])
27 734e1bdf 2025-12-20 op ;;
28 734e1bdf 2025-12-20 op *)
29 734e1bdf 2025-12-20 op PKG_CHECK_MODULES([libevent2], [libevent_core >= 2], [
30 734e1bdf 2025-12-20 op AC_DEFINE([HAVE_EVENT2], 1, [1 if using event2])
31 734e1bdf 2025-12-20 op CFLAGS="$libevent2_CFLAGS $CFLAGS"
32 734e1bdf 2025-12-20 op LIBS="$libevent2_LIBS $LIBS"
33 734e1bdf 2025-12-20 op ], [AC_MSG_ERROR([requires libevent])])
34 734e1bdf 2025-12-20 op ;;
35 734e1bdf 2025-12-20 op esac
36 734e1bdf 2025-12-20 op
37 734e1bdf 2025-12-20 op AC_SEARCH_LIBS([osmtpd_run], [opensmtpd], [], [
38 734e1bdf 2025-12-20 op AC_MSG_ERROR([cannot find libopensmtpd])
39 734e1bdf 2025-12-20 op ])
40 734e1bdf 2025-12-20 op
41 734e1bdf 2025-12-20 op dnl after all the function checks, add optional support for -Werror
42 734e1bdf 2025-12-20 op AS_IF([test "x$with_Werror" = "xyes"], [
43 734e1bdf 2025-12-20 op CFLAGS="$CFLAGS -Werror"
44 734e1bdf 2025-12-20 op ])
45 734e1bdf 2025-12-20 op
46 734e1bdf 2025-12-20 op # check compiler flags
47 734e1bdf 2025-12-20 op AC_DEFUN([CC_ADD_CHECK_FLAGS], [
48 734e1bdf 2025-12-20 op AC_MSG_CHECKING([if $CC supports $1 flag])
49 734e1bdf 2025-12-20 op old_CFLAGS="$CFLAGS"
50 734e1bdf 2025-12-20 op CFLAGS="$CFLAGS -Werror $1"
51 734e1bdf 2025-12-20 op AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])], [
52 734e1bdf 2025-12-20 op AC_MSG_RESULT(yes)
53 734e1bdf 2025-12-20 op CFLAGS="$old_CFLAGS $1"
54 734e1bdf 2025-12-20 op ], [
55 734e1bdf 2025-12-20 op AC_MSG_RESULT(no)
56 734e1bdf 2025-12-20 op CFLAGS="$old_CFLAGS"
57 734e1bdf 2025-12-20 op ])
58 734e1bdf 2025-12-20 op ])
59 734e1bdf 2025-12-20 op CC_ADD_CHECK_FLAGS([-Wall])
60 734e1bdf 2025-12-20 op CC_ADD_CHECK_FLAGS([-Wstrict-prototypes])
61 734e1bdf 2025-12-20 op CC_ADD_CHECK_FLAGS([-Wmissing-prototypes])
62 734e1bdf 2025-12-20 op CC_ADD_CHECK_FLAGS([-Wmissing-declarations])
63 734e1bdf 2025-12-20 op CC_ADD_CHECK_FLAGS([-Wshadow])
64 734e1bdf 2025-12-20 op dnl CC_ADD_CHECK_FLAGS([-Wcast-qual])
65 734e1bdf 2025-12-20 op CC_ADD_CHECK_FLAGS([-Wpointer-arith])
66 734e1bdf 2025-12-20 op CC_ADD_CHECK_FLAGS([-Wsign-compare])
67 734e1bdf 2025-12-20 op
68 734e1bdf 2025-12-20 op dnl to build asr warning-free
69 734e1bdf 2025-12-20 op dnl CC_ADD_CHECK_FLAGS([-Wno-pointer-sign])
70 734e1bdf 2025-12-20 op dnl CC_ADD_CHECK_FLAGS([-Wno-unused-function])
71 734e1bdf 2025-12-20 op dnl CC_ADD_CHECK_FLAGS([-Wno-deprecated-declarations])
72 734e1bdf 2025-12-20 op
73 734e1bdf 2025-12-20 op AS_IF([test "x$need_libasr" = xyes], [
74 734e1bdf 2025-12-20 op AM_CFLAGS="$AM_CFLAGS -I\${top_srcdir}/compat/libasr"
75 734e1bdf 2025-12-20 op ])
76 734e1bdf 2025-12-20 op AM_CONDITIONAL([NEED_LIBASR], [test "x$need_libasr" = xyes])
77 734e1bdf 2025-12-20 op
78 734e1bdf 2025-12-20 op AC_SUBST([AM_CFLAGS])
79 734e1bdf 2025-12-20 op AC_CONFIG_HEADERS([config.h])
80 734e1bdf 2025-12-20 op AC_CONFIG_FILES([Makefile compat/Makefile compat/libasr/Makefile])
81 734e1bdf 2025-12-20 op
82 734e1bdf 2025-12-20 op AC_OUTPUT