1AC_PREREQ(2.60) 2 3m4_define(axa_major_version, 2) 4m4_define(axa_minor_version, 2) 5m4_define(axa_patchlevel_version, 0) 6m4_define(axa_version, 7 axa_major_version.axa_minor_version.axa_patchlevel_version) 8 9AC_INIT([axa], 10 [axa_version()], 11 [https://github.com/farsightsec/axa/issues], 12 [axa], 13 [https://github.com/farsightsec/axa]) 14PACKAGE_DESCRIPTION="Farsight Security Advanced Exchange Access (AXA)" 15AC_SUBST(PACKAGE_DESCRIPTION) 16AC_CONFIG_SRCDIR([axa/axa.h]) 17AC_CONFIG_AUX_DIR([build-aux]) 18AM_INIT_AUTOMAKE([foreign 1.11 -Wall -Wno-portability silent-rules subdir-objects]) 19AC_PROG_CC_STDC 20AC_USE_SYSTEM_EXTENSIONS 21AC_SYS_LARGEFILE 22AC_CONFIG_MACRO_DIR([m4]) 23AM_SILENT_RULES([yes]) 24LT_INIT 25 26AXA_MAJOR_VERSION=axa_major_version() 27AXA_MINOR_VERSION=axa_minor_version() 28AXA_PATCHLEVEL_VERSION=axa_patchlevel_version() 29AXA_VERSION=axa_version() 30 31AC_SUBST(AXA_MAJOR_VERSION) 32AC_SUBST(AXA_MINOR_VERSION) 33AC_SUBST(AXA_PATCHLEVEL_VERSION) 34AC_SUBST(AXA_VERSION) 35 36my_CFLAGS=" \ 37-Wextra -Wall -Wbad-function-cast -Wcast-align -Wmissing-noreturn \ 38-Wnested-externs -Wpointer-arith -Wshadow -Wwrite-strings \ 39-Wdeclaration-after-statement -Wswitch-enum \ 40-Wunused \ 41-Wunreachable-code \ 42-Wuninitialized \ 43-Wno-unknown-pragmas \ 44-Wmissing-declarations -Wmissing-prototypes \ 45-Wsign-compare -Wchar-subscripts \ 46-Wstrict-prototypes -Wshadow \ 47-Wformat-security \ 48-Wno-unused-command-line-argument" 49AC_SUBST([my_CFLAGS]) 50 51AC_CHECK_FUNCS([floor gettimeofday]) 52 53AC_CONFIG_HEADERS(config.h) 54 55PKG_PROG_PKG_CONFIG 56if test -n "$PKG_CONFIG"; then 57 if $PKG_CONFIG --variable=pc_path pkg-config 2>/dev/null | grep -q /libdata/; then 58 PKG_INSTALLDIR(['${prefix}/libdata/pkgconfig']) 59 else 60 PKG_INSTALLDIR 61 fi 62fi 63 64LT_LIB_M 65 66MY_CHECK_LIBPCAP 67 68MY_CHECK_LIBPROTOBUF_C 69 70save_LIBS="$LIBS" 71AC_SEARCH_LIBS([strlcpy], 72 [bsd], 73 [strlcpy_LIBS="$LIBS"], 74 [AC_MSG_ERROR([could not find libbsd, it can be downloaded here: http://libbsd.freedesktop.org/wiki/])] 75 ) 76LIBS="$save_LIBS" 77AC_SUBST(strlcpy_LIBS) 78 79PKG_CHECK_MODULES([libedit], [libedit], [], [MY_CHECK_LIBEDIT]) 80 81save_CPPFLAGS="$CPPFLAGS" 82CPPFLAGS="$libedit_CFLAGS" 83AC_MSG_CHECKING(libedit has unicode) 84AC_CHECK_TYPES([el_rfunc_t], 85 AC_DEFINE([LIBEDIT_IS_UNICODE], [1], 86 [Define if libedit has unicode support.]), 87 [], [[#include <histedit.h>]]) 88CPPFLAGS="$save_CPPFLAGS" 89 90PKG_CHECK_MODULES([libnmsg], [libnmsg >= 0.9.1]) 91 92#AC_CHECK_FUNCS([nmsg_get_version]) 93#AC_CHECK_FUNCS([wdns_get_version]) 94 95PKG_CHECK_MODULES([libwdns], [libwdns]) 96 97PKG_CHECK_MODULES([libssl], [libssl]) 98 99PKG_CHECK_MODULES([libcrypto], [libcrypto]) 100 101AC_CHECK_HEADER([zlib.h], [], [ AC_MSG_ERROR([required header file not found]) ]) 102AC_CHECK_LIB([z], [deflate], [], [ AC_MSG_ERROR([required library not found]) ]) 103AC_CHECK_LIB([lmdb], [mdb_env_open], [], [ AC_MSG_ERROR([required library not found]) ]) 104 105AC_ARG_WITH([yajl], AS_HELP_STRING([--without-yajl], [Disable yajl support])) 106if test "x$with_yajl" != "xno"; then 107 PKG_CHECK_MODULES([yajl], [yajl >= 2.1.0]) 108 AC_DEFINE([HAVE_YAJL], [1], [Define to 1 if yajl support is enabled.]) 109 use_yajl="true" 110else 111 use_yajl="false" 112fi 113AM_CONDITIONAL([HAVE_YAJL], [test "$use_yajl" = "true"]) 114 115PKG_CHECK_MODULES([check], [check >= 0.9.10], 116 [CHECK_MOD_MSG="yes"], [CHECK_MOD_MSG="no"]) 117 118AC_PATH_PROG([DOXYGEN], [doxygen]) 119AM_CONDITIONAL([HAVE_DOXYGEN], [test -n "$DOXYGEN"]) 120if test -n "$DOXYGEN"; then 121 DOC_HTML_MSG="yes, doxygen available: $DOXYGEN" 122 AC_MSG_CHECKING(doxygen version) 123 installed_version=`$DOXYGEN --version 2>/dev/null` 124 AS_VERSION_COMPARE($installed_version, "1.8.3", 125 DOXYGEN_version="oldish", 126 DOXYGEN_version="newish", 127 DOXYGEN_version="newish") 128 AC_MSG_RESULT($DOXYGEN_version) 129 AC_CONFIG_FILES([Doxyfile]) 130 DOXYGEN_INPUT="${srcdir}/axa ${srcdir}/README.md" 131 AC_SUBST(DOXYGEN_INPUT) 132 if test $DOXYGEN_version = "oldish"; then 133 AC_MSG_WARN(old Doxygen version found API documentation may not render as intended consider upgrading to version 1.8.3 or newer) 134 fi 135else 136 DOC_HTML_MSG="no, doxygen not available" 137fi 138 139save_CPPFLAGS="$CPPFLAGS" 140CPPFLAGS="$libnmsg_CFLAGS $libprotobuf_c_CFLAGS" 141AC_CHECK_HEADERS([nmsg/base/dnsqr.pb-c.h nmsg/base/encode.pb-c.h nmsg/base/packet.pb-c.h nmsg/sie/newdomain.pb-c.h], 142 [], 143 [AC_MSG_ERROR([required header file not found])]) 144CPPFLAGS="$save_CPPFLAGS" 145 146AX_DEFINE_DIR([CONFDIR], [sysconfdir/axa], [config dir for axa]) 147AC_DEFINE_UNQUOTED(AXACONFDIR,"$CONFDIR",[config dir for axa]) 148 149AC_CONFIG_FILES([Makefile axa/libaxa.pc axa/version.h]) 150 151AC_CONFIG_FILES([sratool/sratool.man sratool/radtool.man sratool/options.man 152 sratunnel/sratunnel.man sratunnel/radtunnel.man 153 tools/axa_link_certs.man tools/axa_make_cert.man 154 tools/axa_server_cert.man tools/axa_tsindextool.man]) 155 156AC_CONFIG_FILES([tools/axa_link_certs], 157 [chmod +x tools/axa_link_certs]) 158AC_CONFIG_FILES([tools/axa_make_cert], 159 [chmod +x tools/axa_make_cert]) 160AC_CONFIG_FILES([tools/axa_server_cert], 161 [chmod +x tools/axa_server_cert]) 162 163AC_CONFIG_FILES([tests/test-tools-without-server.sh], 164 [chmod +x tests/test-tools-without-server.sh]) 165 166AC_CONFIG_FILES([tests/test-config], 167 [chmod 600 tests/test-config]) 168 169AC_CONFIG_FILES([tests/test-config-badperms], 170 [chmod 640 tests/test-config-badperms]) 171 172AC_OUTPUT 173AC_MSG_RESULT([ 174 $PACKAGE $VERSION 175 176 compiler: ${CC} 177 cflags: ${CFLAGS} 178 ldflags: ${LDFLAGS} 179 libs: ${LIBS} 180 181 prefix: ${prefix} 182 sysconfdir: ${sysconfdir} 183 libdir: ${libdir} 184 includedir: ${includedir} 185 pkgconfigdir: ${pkgconfigdir} 186 187 building html docs: ${DOC_HTML_MSG} 188 189 yajl support: ${use_yajl} 190 make check available: ${CHECK_MOD_MSG} 191]) 192