Commit fea6b5bf authored by Evan Hunt's avatar Evan Hunt

add a search for GeoIP2 libraries in configure

- "--with-geoip" is used to enable the legacy GeoIP library.
- "--with-geoip2" is used to enable the new GeoIP2 library
  (libmaxminddb), and is on by default if the library is found.
- using both "--with-geoip" and "--with-geoip2" at the same time
  is an error.
- an attempt is made to determine the default GeoIP2 database path at
  compile time if pkg-config is able to report the module prefix. if
  this fails, it will be necessary to set the path in named.conf with
  geoip-directory
- Makefiles have been updated, and a stub lib/dns/geoip2.c has been
  added for the eventual GeoIP2 search implementation.
parent cc1292d6
......@@ -22,7 +22,7 @@ CINCLUDES = ${NS_INCLUDES} ${BIND9_INCLUDES} ${DNS_INCLUDES} ${ISCCFG_INCLUDES}
CDEFINES = -DNAMED_CONFFILE=\"${sysconfdir}/named.conf\"
CWARNINGS =
DNSLIBS = ../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@
DNSLIBS = ../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@
ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@
ISCLIBS = ../../lib/isc/libisc.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS}
ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS}
......
......@@ -29,7 +29,7 @@ ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@
ISCCCLIBS = ../../lib/isccc/libisccc.@A@
ISCLIBS = ../../lib/isc/libisc.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS}
ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS}
DNSLIBS = ../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@
DNSLIBS = ../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@
BIND9LIBS = ../../lib/bind9/libbind9.@A@
ISCCFGDEPLIBS = ../../lib/isccfg/libisccfg.@A@
......
......@@ -24,7 +24,7 @@ CDEFINES = -DVERSION=\"${VERSION}\" \
CWARNINGS =
ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@
DNSLIBS = ../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@
DNSLIBS = ../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@
ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS}
ISCLIBS = ../../lib/isc/libisc.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS}
IRSLIBS = ../../lib/irs/libirs.@A@
......
......@@ -26,7 +26,7 @@ CDEFINES = -DVERSION=\"${VERSION}\"
CWARNINGS =
ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@
DNSLIBS = ../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@
DNSLIBS = ../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@
BIND9LIBS = ../../lib/bind9/libbind9.@A@
ISCLIBS = ../../lib/isc/libisc.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS}
ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS}
......
......@@ -21,7 +21,7 @@ CINCLUDES = ${DNS_INCLUDES} ${ISC_INCLUDES} \
CDEFINES = -DVERSION=\"${VERSION}\"
CWARNINGS =
DNSLIBS = ../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@
DNSLIBS = ../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@
ISCLIBS = ../../lib/isc/libisc.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS}
ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS}
......
......@@ -49,13 +49,14 @@ CINCLUDES = -I${srcdir}/include -I${srcdir}/unix/include -I. \
${DBDRIVER_INCLUDES} \
${OPENSSL_CFLAGS} \
${JSON_C_CFLAGS} \
${LIBXML2_CFLAGS}
${LIBXML2_CFLAGS} \
${MAXMINDDB_CFLAGS}
CDEFINES = @CONTRIB_DLZ@
CWARNINGS =
DNSLIBS = ../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@
DNSLIBS = ../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@
ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@
ISCCCLIBS = ../../lib/isccc/libisccc.@A@
ISCLIBS = ../../lib/isc/libisc.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS}
......@@ -88,9 +89,11 @@ SUBDIRS = unix
TARGETS = named@EXEEXT@
GEOIPLINKOBJS = geoip.@O@
GEOIP2LINKOBJS = geoip.@O@
OBJS = builtin.@O@ config.@O@ control.@O@ \
controlconf.@O@ fuzz.@O@ @GEOIPLINKOBJS@ \
controlconf.@O@ fuzz.@O@ \
@GEOIPLINKOBJS@ @GEOIP2LINKOBJS@ \
log.@O@ logconf.@O@ main.@O@ \
server.@O@ statschannel.@O@ \
tkeyconf.@O@ tsigconf.@O@ zoneconf.@O@ \
......@@ -101,9 +104,11 @@ UOBJS = unix/os.@O@ unix/dlz_dlopen_driver.@O@
SYMOBJS = symtbl.@O@
GEOIPLINKSRCS = geoip.c
GEOIP2LINKSRCS = geoip.c
SRCS = builtin.c config.c control.c \
controlconf.c fuzz.c @GEOIPLINKSRCS@ \
controlconf.c fuzz.c \
@GEOIPLINKSRCS@ @GEOIP2LINKSRCS@ \
log.c logconf.c main.c \
server.c statschannel.c \
tkeyconf.c tsigconf.c zoneconf.c \
......@@ -135,6 +140,7 @@ config.@O@: config.c
-DDYNDB_LIBDIR=\"@libdir@/bind\" \
-DNAMED_LOCALSTATEDIR=\"${localstatedir}\" \
-DNAMED_SYSCONFDIR=\"${sysconfdir}\" \
-DMAXMINDDB_PREFIX=\"@MAXMINDDB_PREFIX@\" \
-c ${srcdir}/config.c
server.@O@: server.c
......
......@@ -64,6 +64,9 @@ options {\n\
#ifndef WIN32
" files unlimited;\n"
#endif
#ifdef HAVE_GEOIP2
" geoip-directory \"" MAXMINDDB_PREFIX "/share/GeoIP2\";\n"
#endif
"\
# has-old-clients <obsolete>;\n\
heartbeat-interval 60;\n\
......
......@@ -26,7 +26,7 @@ CINCLUDES = ${DNS_INCLUDES} ${BIND9_INCLUDES} ${ISC_INCLUDES} \
CDEFINES = -DVERSION=\"${VERSION}\" @USE_GSSAPI@
CWARNINGS =
DNSLIBS = ../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@
DNSLIBS = ../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@
BIND9LIBS = ../../lib/bind9/libbind9.@A@
ISCLIBS = ../../lib/isc/libisc.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS}
ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS}
......
......@@ -17,7 +17,7 @@ CINCLUDES = -I${srcdir}/include -I${srcdir}/unix/include -I. \
${NS_INCLUDES} ${DNS_INCLUDES} \
${ISCCFG_INCLUDES} ${ISC_INCLUDES}
DNSLIBS = ../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@
DNSLIBS = ../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@
ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@
ISCLIBS = ../../lib/isc/libisc.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS}
NSLIBS = ../../lib/ns/libns.@A@
......
......@@ -25,7 +25,7 @@ ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@
ISCCCLIBS = ../../lib/isccc/libisccc.@A@
ISCLIBS = ../../lib/isc/libisc.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS}
ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS}
DNSLIBS = ../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@
DNSLIBS = ../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@
BIND9LIBS = ../../lib/bind9/libbind9.@A@
ISCCFGDEPLIBS = ../../lib/isccfg/libisccfg.@A@
......
......@@ -20,7 +20,7 @@ CDEFINES =
CWARNINGS =
BACKTRACECFLAGS = @BACKTRACECFLAGS@
DNSLIBS = ../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@
DNSLIBS = ../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@
ISCLIBS = ../../lib/isc/libisc.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS}
ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS}
ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@
......
......@@ -22,7 +22,7 @@ CWARNINGS =
BACKTRACECFLAGS = @BACKTRACECFLAGS@
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
DNSLIBS = ../../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@
DNSLIBS = ../../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@
ISCLIBS = ../../../lib/isc/libisc.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS}
ISCNOSYMLIBS = ../../../lib/isc/libisc-nosymtbl.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS}
ISCCFGLIBS = ../../../lib/isccfg/libisccfg.@A@
......
......@@ -118,5 +118,7 @@ LIBXML2_LIBS="@LIBXML2_LIBS@"
HAVEXMLSTATS=${LIBXML2_LIBS:+1}
JSON_C_LIBS="@JSON_C_LIBS@"
HAVEJSONSTATS=${JSON_C_LIBS:+1}
MAXMINDDB_LIBS="@MAXMINDDB_LIBS@"
HAVEGEOIP2=${MAXMINDDB_LIBS:+1}
ZLIB=@ZLIB@
NZD=@NZD_TOOLS@
......@@ -21,7 +21,7 @@ CINCLUDES = ${DNS_INCLUDES} ${ISC_INCLUDES} \
CDEFINES =
CWARNINGS =
DNSLIBS = ../../../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@
DNSLIBS = ../../../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@
ISCLIBS = ../../../../lib/isc/libisc.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS}
DNSDEPLIBS = ../../../../lib/dns/libdns.@A@
......
......@@ -21,7 +21,7 @@ CINCLUDES = ${DNS_INCLUDES} ${ISC_INCLUDES} \
CDEFINES =
CWARNINGS =
DNSLIBS = ../../../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@
DNSLIBS = ../../../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@
ISCLIBS = ../../../../lib/isc/libisc.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS}
DNSDEPLIBS = ../../../../lib/dns/libdns.@A@
......
......@@ -21,7 +21,7 @@ CINCLUDES = ${DNS_INCLUDES} ${ISC_INCLUDES} \
CDEFINES =
CWARNINGS =
DNSLIBS = ../../../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@
DNSLIBS = ../../../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@
ISCLIBS = ../../../../lib/isc/libisc.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS}
DNSDEPLIBS = ../../../../lib/dns/libdns.@A@
......
......@@ -17,12 +17,13 @@ VERSION=@BIND9_VERSION@
CINCLUDES = ${DNS_INCLUDES} ${ISC_INCLUDES} ${ISCCFG_INCLUDES} \
${BIND9_INCLUDES} \
${OPENSSL_CFLAGS}
${OPENSSL_CFLAGS} \
${MAXMINDDB_CFLAGS}
CDEFINES = -DVERSION=\"${VERSION}\"
CWARNINGS =
DNSLIBS = ../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@
DNSLIBS = ../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@
BIND9LIBS = ../../lib/bind9/libbind9.@A@
ISCLIBS = ../../lib/isc/libisc.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS}
ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS}
......
......@@ -171,6 +171,9 @@
/* Build with GeoIP support */
#undef HAVE_GEOIP
/* Build with GeoIP2 support */
#undef HAVE_GEOIP2
/* Build with GeoIP City IPv6 support */
#undef HAVE_GEOIP_CITY_V6
......
......@@ -754,6 +754,11 @@ PTHREAD_CC
ax_pthread_config
GEOIPLINKOBJS
GEOIPLINKSRCS
GEOIP2LINKOBJS
GEOIP2LINKSRCS
MAXMINDDB_PREFIX
MAXMINDDB_LIBS
MAXMINDDB_CFLAGS
ISC_PLATFORM_NORETURN_POST
ISC_PLATFORM_NORETURN_PRE
expanded_sysconfdir
......@@ -900,6 +905,7 @@ enable_kqueue
enable_epoll
enable_devpoll
with_geoip
with_geoip2
with_locktype
with_libtool
enable_pthread_rwlock
......@@ -961,6 +967,9 @@ LT_SYS_LIBRARY_PATH
PKG_CONFIG
PKG_CONFIG_PATH
PKG_CONFIG_LIBDIR
MAXMINDDB_CFLAGS
MAXMINDDB_LIBS
MAXMINDDB_PREFIX
OPENSSL_CFLAGS
OPENSSL_LIBS
LIBXML2_CFLAGS
......@@ -1642,7 +1651,9 @@ Optional Packages:
--with-python=PATH specify path to Python interpreter
--with-python-install-dir=PATH
installation directory for Python modules
--with-geoip=PATH Build with GeoIP support (yes|no|path)
--with-geoip=PATH Build with legacy GeoIP support (yes|no|path)
--with-geoip2=PATH Build with MaxMind GeoIP2 support (auto|yes|no|path)
[default=$geoip2_default]
--with-locktype=ARG Specify mutex lock type (adaptive or standard)
--with-libtool use GNU libtool
--with-openssl=DIR root of the OpenSSL directory
......@@ -1708,6 +1719,12 @@ Some influential environment variables:
directories to add to pkg-config's search path
PKG_CONFIG_LIBDIR
path overriding pkg-config's built-in search path
MAXMINDDB_CFLAGS
C compiler flags for MAXMINDDB, overriding pkg-config
MAXMINDDB_LIBS
linker flags for MAXMINDDB, overriding pkg-config
MAXMINDDB_PREFIX
value of prefix for libmaxminddb, overriding pkg-config
OPENSSL_CFLAGS
C compiler flags for OPENSSL, overriding pkg-config
OPENSSL_LIBS
......@@ -14419,17 +14436,415 @@ $as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h
#
# GeoIP support?
#
GEOIPLINKSRCS=
GEOIPLINKOBJS=
geoip2_default="auto"
# Check whether --with-geoip was given.
if test "${with_geoip+set}" = set; then :
withval=$with_geoip; use_geoip="$withval"
withval=$with_geoip;
use_geoip="$withval"
geoip2_default="no"
else
use_geoip="no"
fi
# Check whether --with-geoip2 was given.
if test "${with_geoip2+set}" = set; then :
withval=$with_geoip2;
else
with_geoip2="$geoip2_default"
fi
# --with-geoip2 should be turned on by default if the library exists.
#
# --with-geoip is not on by default, but can be turned on if the library
# exists. if it is turned on, --with-geoip2 is suppressed.
#
# specifying both --with-geoip and --with-geoip2 is an error.
if test "no" != "$with_geoip2" && test "no" != "$use_geoip"; then :
as_fn_error $? "--with-geoip and --with-geoip2 are incompatible" "$LINENO" 5
fi
GEOIP2LINKSRCS=
GEOIP2LINKOBJS=
case $with_geoip2 in #(
no) :
;; #(
auto) :
pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libmaxminddb" >&5
$as_echo_n "checking for libmaxminddb... " >&6; }
if test -n "$MAXMINDDB_CFLAGS"; then
pkg_cv_MAXMINDDB_CFLAGS="$MAXMINDDB_CFLAGS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libmaxminddb\""; } >&5
($PKG_CONFIG --exists --print-errors "libmaxminddb") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_MAXMINDDB_CFLAGS=`$PKG_CONFIG --cflags "libmaxminddb" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
fi
else
pkg_failed=untried
fi
if test -n "$MAXMINDDB_LIBS"; then
pkg_cv_MAXMINDDB_LIBS="$MAXMINDDB_LIBS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libmaxminddb\""; } >&5
($PKG_CONFIG --exists --print-errors "libmaxminddb") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_MAXMINDDB_LIBS=`$PKG_CONFIG --libs "libmaxminddb" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
fi
else
pkg_failed=untried
fi
if test $pkg_failed = yes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
_pkg_short_errors_supported=yes
else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
MAXMINDDB_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libmaxminddb" 2>&1`
else
MAXMINDDB_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libmaxminddb" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$MAXMINDDB_PKG_ERRORS" >&5
:
elif test $pkg_failed = untried; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
:
else
MAXMINDDB_CFLAGS=$pkg_cv_MAXMINDDB_CFLAGS
MAXMINDDB_LIBS=$pkg_cv_MAXMINDDB_LIBS
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
$as_echo "#define HAVE_GEOIP2 1" >>confdefs.h
if test -n "$MAXMINDDB_PREFIX"; then
pkg_cv_MAXMINDDB_PREFIX="$MAXMINDDB_PREFIX"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libmaxminddb\""; } >&5
($PKG_CONFIG --exists --print-errors "libmaxminddb") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_MAXMINDDB_PREFIX=`$PKG_CONFIG --variable="prefix" "libmaxminddb" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
fi
else
pkg_failed=untried
fi
MAXMINDDB_PREFIX=$pkg_cv_MAXMINDDB_PREFIX
if test "x$MAXMINDDB_PREFIX" = x""; then :
as_fn_error $? "libmaxminddb prefix not found in pkg-config; set MAXMINDDB_PREFIX in the environment" "$LINENO" 5
fi
GEOIP2LINKSRCS='${GEOIP2LINKSRCS}'
GEOIP2LINKOBJS='${GEOIP2LINKOBJS}'
fi ;; #(
yes) :
pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libmaxminddb" >&5
$as_echo_n "checking for libmaxminddb... " >&6; }
if test -n "$MAXMINDDB_CFLAGS"; then
pkg_cv_MAXMINDDB_CFLAGS="$MAXMINDDB_CFLAGS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libmaxminddb\""; } >&5
($PKG_CONFIG --exists --print-errors "libmaxminddb") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_MAXMINDDB_CFLAGS=`$PKG_CONFIG --cflags "libmaxminddb" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
fi
else
pkg_failed=untried
fi
if test -n "$MAXMINDDB_LIBS"; then
pkg_cv_MAXMINDDB_LIBS="$MAXMINDDB_LIBS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libmaxminddb\""; } >&5
($PKG_CONFIG --exists --print-errors "libmaxminddb") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_MAXMINDDB_LIBS=`$PKG_CONFIG --libs "libmaxminddb" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
fi
else
pkg_failed=untried
fi
if test $pkg_failed = yes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
_pkg_short_errors_supported=yes
else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
MAXMINDDB_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libmaxminddb" 2>&1`
else
MAXMINDDB_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libmaxminddb" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$MAXMINDDB_PKG_ERRORS" >&5
as_fn_error $? "Package requirements (libmaxminddb) were not met:
$MAXMINDDB_PKG_ERRORS
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables MAXMINDDB_CFLAGS
and MAXMINDDB_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details." "$LINENO" 5
elif test $pkg_failed = untried; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full
path to pkg-config.
Alternatively, you may set the environment variables MAXMINDDB_CFLAGS
and MAXMINDDB_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
To get pkg-config, see <http://pkg-config.freedesktop.org/>.
See \`config.log' for more details" "$LINENO" 5; }
else
MAXMINDDB_CFLAGS=$pkg_cv_MAXMINDDB_CFLAGS
MAXMINDDB_LIBS=$pkg_cv_MAXMINDDB_LIBS
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
$as_echo "#define HAVE_GEOIP2 1" >>confdefs.h
if test -n "$MAXMINDDB_PREFIX"; then
pkg_cv_MAXMINDDB_PREFIX="$MAXMINDDB_PREFIX"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libmaxminddb\""; } >&5
($PKG_CONFIG --exists --print-errors "libmaxminddb") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_MAXMINDDB_PREFIX=`$PKG_CONFIG --variable="prefix" "libmaxminddb" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
fi
else
pkg_failed=untried
fi
MAXMINDDB_PREFIX=$pkg_cv_MAXMINDDB_PREFIX
if test "x$MAXMINDDB_PREFIX" = x""; then :
as_fn_error $? "libmaxminddb prefix not found in pkg-config; set MAXMINDDB_PREFIX in the environment" "$LINENO" 5
fi
GEOIP2LINKSRCS='${GEOIP2LINKSRCS}'
GEOIP2LINKOBJS='${GEOIP2LINKOBJS}'
fi ;; #(
*) :
# default
CCASFLAGS_geoip2_ax_save_flags=$CCASFLAGS
CFLAGS_geoip2_ax_save_flags=$CFLAGS
CPPFLAGS_geoip2_ax_save_flags=$CPPFLAGS
CXXFLAGS_geoip2_ax_save_flags=$CXXFLAGS
ERLCFLAGS_geoip2_ax_save_flags=$ERLCFLAGS
FCFLAGS_geoip2_ax_save_flags=$FCFLAGS
FCLIBS_geoip2_ax_save_flags=$FCLIBS
FFLAGS_geoip2_ax_save_flags=$FFLAGS
FLIBS_geoip2_ax_save_flags=$FLIBS
GCJFLAGS_geoip2_ax_save_flags=$GCJFLAGS
JAVACFLAGS_geoip2_ax_save_flags=$JAVACFLAGS
LDFLAGS_geoip2_ax_save_flags=$LDFLAGS
LIBS_geoip2_ax_save_flags=$LIBS
OBJCFLAGS_geoip2_ax_save_flags=$OBJCFLAGS
OBJCXXFLAGS_geoip2_ax_save_flags=$OBJCXXFLAGS
UPCFLAGS_geoip2_ax_save_flags=$UPCFLAGS
VALAFLAGS_geoip2_ax_save_flags=$VALAFLAGS
MAXMINDDB_CFLAGS="-I$with_geoip2/include"
MAXMINDDB_LIBS="-L$with_geoip2/libs"
CFLAGS="$CFLAGS $MAXMINDDB_CFLAGS"
LDFLAGS="$LDFLAGS $MAXMINDDB_LIBS"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing MMDB_open" >&5
$as_echo_n "checking for library containing MMDB_open... " >&6; }
if ${ac_cv_search_MMDB_open+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_func_search_save_LIBS=$LIBS
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char MMDB_open ();
int
main ()
{
return MMDB_open ();
;
return 0;
}
_ACEOF
for ac_lib in '' maxminddb; do
if test -z "$ac_lib"; then
ac_res="none required"
else
ac_res=-l$ac_lib
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
fi
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_search_MMDB_open=$ac_res
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext
if ${ac_cv_search_MMDB_open+:} false; then :
break
fi
done
if ${ac_cv_search_MMDB_open+:} false; then :
else
ac_cv_search_MMDB_open=no
fi
rm conftest.$ac_ext
LIBS=$ac_func_search_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_MMDB_open" >&5
$as_echo "$ac_cv_search_MMDB_open" >&6; }
ac_res=$ac_cv_search_MMDB_open
if test "$ac_res" != no; then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
$as_echo "#define HAVE_GEOIP2 1" >>confdefs.h
GEOIP2LINKSRCS='${GEOIP2LINKSRCS}'
GEOIP2LINKOBJS='${GEOIP2LINKOBJS}'
MAXMINDDB_LIBS="$MAXMINDDB_LIBS $ac_cv_search_mmdb_open"
{ $as_echo "$as_me:${as_lineno-$LINENO}: GeoIP2 default database path set to $with_geoip2/share/GeoIP" >&5
$as_echo "$as_me: GeoIP2 default database path set to $with_geoip2/share/GeoIP" >&6;}
eval MAXMINDDB_PREFIX=\$$with_geoip2
else
as_fn_error $? "GeoIP2 requested, but libmaxminddb not found" "$LINENO" 5
fi
;;
esac
GEOIPLINKSRCS=
GEOIPLINKOBJS=
if test "yes" = "$use_geoip"
then
for d in /usr /usr/local /opt/local
......@@ -14444,10 +14859,6 @@ fi
case "$use_geoip" in
no|'')
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GeoIP support" >&5
$as_echo_n "checking for GeoIP support... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: disabled" >&5
$as_echo "disabled" >&6; }
;;
*)
if test -d "$use_geoip" -o -L "$use_geoip"
......@@ -25319,7 +25730,8 @@ report() {
test "large" = "$use_tuning" && echo " Large-system tuning (--with-tuning)"
test "no" = "$use_dnstap" || \
echo " Allow 'dnstap' packet logging (--enable-dnstap)"
test "no" = "$use_geoip" || echo " GeoIP access control (--with-geoip)"
test -z "$MAXMINDDB_LIBS" || echo " GeoIP2 access control (--with-geoip2)"
test "no" = "$use_geoip" || echo " Legacy GeoIP access control (--with-geoip)"
test "no" = "$use_gssapi" || echo " GSS-API (--with-gssapi)"
if test "yes" = "$enable_full_report" -o "aes" != "$with_cc_alg"; then
echo " Algorithm: $with_cc_alg"
......@@ -25383,7 +25795,7 @@ report() {
test "no" = "$use_dnstap" && \
echo " Allow 'dnstap' packet logging (--enable-dnstap)"
test "no" = "$use_geoip" && echo " GeoIP access control (--with-geoip)"
test -z "$MAXMINDDB_LIBS" && echo " GeoIP2 access control (--with-geoip2)"
test "no" = "$use_gssapi" && echo " GSS-API (--with-gssapi)"