Commit 6a7e8057 authored by Evan Hunt's avatar Evan Hunt
Browse files

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.

(cherry picked from commit fea6b5bf)
parent 38e10a82
......@@ -291,6 +291,8 @@ AS_VAR_IF([$1], [""], [$5], [$4])dnl
m4_include([m4/ax_check_openssl.m4])
m4_include([m4/ax_posix_shell.m4])
m4_include([m4/ax_pthread.m4])
m4_include([m4/ax_restore_flags.m4])
m4_include([m4/ax_save_flags.m4])
m4_include([m4/libtool.m4])
m4_include([m4/ltoptions.m4])
m4_include([m4/ltsugar.m4])
......
......@@ -21,7 +21,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@
ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ @OPENSSL_LIBS@
......
......@@ -29,7 +29,7 @@ ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@
ISCCCLIBS = ../../lib/isccc/libisccc.@A@
ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@
ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ @OPENSSL_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@
......
......@@ -23,7 +23,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@
ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@
IRSLIBS = ../../lib/irs/libirs.@A@
......
......@@ -25,7 +25,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@
ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ @OPENSSL_LIBS@
......
......@@ -20,7 +20,7 @@ CINCLUDES = ${DNS_INCLUDES} ${ISC_INCLUDES} @OPENSSL_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@
ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ @OPENSSL_LIBS@
......
......@@ -46,13 +46,14 @@ CINCLUDES = -I${srcdir}/include -I${srcdir}/unix/include -I. \
${NS_INCLUDES} ${DNS_INCLUDES} \
${BIND9_INCLUDES} ${ISCCFG_INCLUDES} ${ISCCC_INCLUDES} \
${ISC_INCLUDES} ${DLZDRIVER_INCLUDES} \
${DBDRIVER_INCLUDES} @OPENSSL_INCLUDES@
${DBDRIVER_INCLUDES} ${MAXMINDDB_CFLAGS} \
@OPENSSL_INCLUDES@
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@
......@@ -85,9 +86,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@ \
......@@ -98,9 +101,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 \
......@@ -132,6 +137,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
......
......@@ -66,6 +66,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@
ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ @OPENSSL_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@
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@
ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ @OPENSSL_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@
ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ @OPENSSL_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@
ISCNOSYMLIBS = ../../../lib/isc/libisc-nosymtbl.@A@ @OPENSSL_LIBS@
ISCCFGLIBS = ../../../lib/isccfg/libisccfg.@A@
......
......@@ -20,7 +20,7 @@ CINCLUDES = ${DNS_INCLUDES} ${ISC_INCLUDES} @OPENSSL_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@
DNSDEPLIBS = ../../../../lib/dns/libdns.@A@
......
......@@ -20,7 +20,7 @@ CINCLUDES = ${DNS_INCLUDES} ${ISC_INCLUDES} @OPENSSL_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@
DNSDEPLIBS = ../../../../lib/dns/libdns.@A@
......
......@@ -20,7 +20,7 @@ CINCLUDES = ${DNS_INCLUDES} ${ISC_INCLUDES} @OPENSSL_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@
DNSDEPLIBS = ../../../../lib/dns/libdns.@A@
......
......@@ -16,12 +16,13 @@ VERSION=@BIND9_VERSION@
@BIND9_MAKE_INCLUDES@
CINCLUDES = ${DNS_INCLUDES} ${ISC_INCLUDES} ${ISCCFG_INCLUDES} \
${BIND9_INCLUDES} @OPENSSL_INCLUDES@
${BIND9_INCLUDES} ${MAXMINDDB_CFLAGS} \
@OPENSSL_INCLUDES@
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@
ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ @OPENSSL_LIBS@
......
......@@ -168,6 +168,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
......@@ -844,6 +849,7 @@ infodir
docdir
oldincludedir
includedir
runstatedir
localstatedir
sharedstatedir
sysconfdir
......@@ -896,6 +902,7 @@ enable_kqueue
enable_epoll
enable_devpoll
with_geoip
with_geoip2
with_locktype
with_libtool
with_openssl
......@@ -956,6 +963,9 @@ LT_SYS_LIBRARY_PATH
PKG_CONFIG
PKG_CONFIG_PATH
PKG_CONFIG_LIBDIR
MAXMINDDB_CFLAGS
MAXMINDDB_LIBS
MAXMINDDB_PREFIX
OPENSSL_CFLAGS
OPENSSL_LIBS
LIBIDN2_CFLAGS
......@@ -1001,6 +1011,7 @@ datadir='${datarootdir}'
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
runstatedir='${localstatedir}/run'
includedir='${prefix}/include'
oldincludedir='/usr/include'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
......@@ -1253,6 +1264,15 @@ do
| -silent | --silent | --silen | --sile | --sil)
silent=yes ;;
 
-runstatedir | --runstatedir | --runstatedi | --runstated \
| --runstate | --runstat | --runsta | --runst | --runs \
| --run | --ru | --r)
ac_prev=runstatedir ;;
-runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
| --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
| --run=* | --ru=* | --r=*)
runstatedir=$ac_optarg ;;
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
......@@ -1390,7 +1410,7 @@ fi
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
datadir sysconfdir sharedstatedir localstatedir includedir \
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
libdir localedir mandir
libdir localedir mandir runstatedir
do
eval ac_val=\$$ac_var
# Remove trailing slashes.
......@@ -1543,6 +1563,7 @@ Fine tuning of the installation directories:
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
--runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
......@@ -1629,7 +1650,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=no]
--with-locktype=ARG Specify mutex lock type (adaptive or standard)
--with-libtool use GNU libtool
--with-openssl=DIR root of the OpenSSL directory
......@@ -1692,6 +1715,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
......@@ -14140,17 +14169,410 @@ $as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h
#
# GeoIP support?
#
GEOIPLINKSRCS=
GEOIPLINKOBJS=
geoip2_default="no"
 
# 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
# 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