AC_INIT([filter-dnsbl], [v0.4], [https://src.imperialat.at/?action=summary&path=filter-dnsbl.git]) AC_CONFIG_AUX_DIR(etc) AC_CONFIG_LIBOBJ_DIR(compat) AC_CANONICAL_HOST AM_INIT_AUTOMAKE([-Wall foreign subdir-objects]) AC_PROG_CC AC_USE_SYSTEM_EXTENSIONS AC_ARG_WITH([libexecsmtpddir], [AS_HELP_STRING([--with-libexecsmtpddir=DIR], ["OpenSMTPD libexec binary location [LIBEXECDIR/smtpd]"])], [libexecsmtpddir=$withval], [libexecsmtpddir="\${libexecdir}/smtpd"]) AC_SUBST([libexecsmtpddir], [$libexecsmtpddir]) PKG_PROG_PKG_CONFIG AC_REPLACE_FUNCS([fgetln strtonum reallocarray recallocarray strcasestr]) AC_CHECK_FUNCS([asr_run pledge]) AC_CHECK_MEMBERS([struct sockaddr.sa_len], , , [ #include #include #include ] ) AC_CHECK_MEMBERS([struct sockaddr_storage.ss_len], , , [ #include #include #include ] ) AC_CHECK_MEMBERS([struct sockaddr_in.sin_len], , , [ #include #include #include ] ) AC_CHECK_MEMBERS([struct sockaddr_in6.sin6_len], , , [ #include #include #include ] ) dnl on OpenBSD, make sure to use libevent and libasr from base dnl on other system, we *must* use the bundled libasr. need_libasr=yes case "$host_os" in *openbsd*) need_libasr=no AC_SEARCH_LIBS([event_init], [event], [], [AC_MSG_ERROR([requires libevent])]) ;; *) PKG_CHECK_MODULES([libevent2], [libevent_core >= 2], [ AC_DEFINE([HAVE_EVENT2], 1, [1 if using event2]) CFLAGS="$libevent2_CFLAGS $CFLAGS" LIBS="$libevent2_LIBS $LIBS" ], [AC_MSG_ERROR([requires libevent])]) ;; esac AC_SEARCH_LIBS([osmtpd_run], [opensmtpd], [], [ AC_MSG_ERROR([cannot find libopensmtpd]) ]) # check compiler flags AC_DEFUN([CC_ADD_CHECK_FLAGS], [ AC_MSG_CHECKING([if $CC supports $1 flag]) old_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -Werror $1" AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])], [ AC_MSG_RESULT(yes) CFLAGS="$old_CFLAGS $1" ], [ AC_MSG_RESULT(no) CFLAGS="$old_CFLAGS" ]) ]) CC_ADD_CHECK_FLAGS([-Wall]) CC_ADD_CHECK_FLAGS([-Wstrict-prototypes]) CC_ADD_CHECK_FLAGS([-Wmissing-prototypes]) CC_ADD_CHECK_FLAGS([-Wmissing-declarations]) CC_ADD_CHECK_FLAGS([-Wshadow]) dnl CC_ADD_CHECK_FLAGS([-Wcast-qual]) CC_ADD_CHECK_FLAGS([-Wpointer-arith]) CC_ADD_CHECK_FLAGS([-Wsign-compare]) dnl to build asr warning-free dnl CC_ADD_CHECK_FLAGS([-Wno-pointer-sign]) dnl CC_ADD_CHECK_FLAGS([-Wno-unused-function]) dnl CC_ADD_CHECK_FLAGS([-Wno-deprecated-declarations]) AS_IF([test "x$need_libasr" = xyes], [ AM_CFLAGS="$AM_CFLAGS -I\${top_srcdir}/compat/libasr" ]) AM_CONDITIONAL([NEED_LIBASR], [test "x$need_libasr" = xyes]) AC_SUBST([AM_CFLAGS]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_FILES([GNUmakefile compat/Makefile compat/libasr/Makefile]) AC_OUTPUT