]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
add a search for GeoIP2 libraries in configure
authorEvan Hunt <each@isc.org>
Tue, 11 Jun 2019 22:59:31 +0000 (15:59 -0700)
committerEvan Hunt <each@isc.org>
Tue, 2 Jul 2019 19:28:14 +0000 (12:28 -0700)
- "--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 fea6b5bf101b1fd034a6aaf6c61c688934b07724)
(cherry picked from commit 6a7e80579680244444b9337d05bae38472b9a0c7)

31 files changed:
aclocal.m4
bin/check/Makefile.in
bin/confgen/Makefile.in
bin/delv/Makefile.in
bin/dig/Makefile.in
bin/dnssec/Makefile.in
bin/named/Makefile.in
bin/named/config.c
bin/nsupdate/Makefile.in
bin/rndc/Makefile.in
bin/tests/Makefile.in
bin/tests/optional/Makefile.in
bin/tests/system/pipelined/Makefile.in
bin/tests/system/rsabigexponent/Makefile.in
bin/tests/system/tkey/Makefile.in
bin/tools/Makefile.in
config.h.in
configure
configure.ac
lib/bind9/Makefile.in
lib/dns/Makefile.in
lib/dns/geoip2.c [new file with mode: 0644]
lib/dns/tests/Makefile.in
lib/irs/tests/Makefile.in
lib/isccfg/Makefile.in
lib/isccfg/tests/Makefile.in
lib/samples/Makefile.in
m4/ax_restore_flags.m4 [new file with mode: 0644]
m4/ax_save_flags.m4 [new file with mode: 0644]
make/rules.in
util/copyrights

index b667d3abcbb1f805f2ec5b93f26ab95620da0d72..09c291121862f04861a71b32cb53ffbff4782f96 100644 (file)
@@ -288,6 +288,8 @@ AS_VAR_COPY([$1], [pkg_cv_][$1])
 AS_VAR_IF([$1], [""], [$5], [$4])dnl
 ])dnl PKG_CHECK_VAR
 
+m4_include([m4/ax_restore_flags.m4])
+m4_include([m4/ax_save_flags.m4])
 m4_include([libtool.m4/libtool.m4])
 m4_include([libtool.m4/ltoptions.m4])
 m4_include([libtool.m4/ltsugar.m4])
index c124e80367cabbad7e512918f298937c4dbaf14a..3048ec39c5fe4e8d7123737b155dad344d74b64c 100644 (file)
@@ -7,8 +7,6 @@
 # See the COPYRIGHT file distributed with this work for additional
 # information regarding copyright ownership.
 
-# $Id: Makefile.in,v 1.36 2009/12/05 23:31:40 each Exp $
-
 srcdir =       @srcdir@
 VPATH =                @srcdir@
 top_srcdir =   @top_srcdir@
@@ -23,7 +21,7 @@ CINCLUDES =   ${BIND9_INCLUDES} ${DNS_INCLUDES} ${ISCCFG_INCLUDES} \
 CDEFINES =     @CRYPTO@ -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@
 ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@
index 87f13dda4b808137719ed88f595e0eb331fd9bd3..bc7dc5be5e36a2aee60d3b106563644759f956d6 100644 (file)
@@ -7,8 +7,6 @@
 # See the COPYRIGHT file distributed with this work for additional
 # information regarding copyright ownership.
 
-# $Id: Makefile.in,v 1.8 2009/12/05 23:31:40 each Exp $
-
 srcdir =       @srcdir@
 VPATH =                @srcdir@
 top_srcdir =   @top_srcdir@
@@ -31,7 +29,7 @@ ISCCFGLIBS =  ../../lib/isccfg/libisccfg.@A@
 ISCCCLIBS =    ../../lib/isccc/libisccc.@A@
 ISCLIBS =      ../../lib/isc/libisc.@A@
 ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@
-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@
index e2d2802262f635b205a5fc15251b62b8acaf589d..b826223ef0d4b940e5fd895dcc2a0e6839760303 100644 (file)
@@ -23,7 +23,7 @@ CDEFINES =    @CRYPTO@ -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@
 ISCLIBS =      ../../lib/isc/libisc.@A@
 IRSLIBS =      ../../lib/irs/libirs.@A@
index a9830a9119b9577e7a723c9da087c48eb002fb05..f039be623e4f6332fb88233ea72f6440759660d4 100644 (file)
@@ -25,7 +25,7 @@ CDEFINES =    -DVERSION=\"${VERSION}\" @CRYPTO@
 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@
 ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@
index 2239ad14570595177d7d840ef54ba65efacbe5be..d9380542da4f84946111db53e25fb1e1987a1a88 100644 (file)
@@ -7,8 +7,6 @@
 # See the COPYRIGHT file distributed with this work for additional
 # information regarding copyright ownership.
 
-# $Id: Makefile.in,v 1.42.332.1 2011/03/16 06:37:51 each Exp $
-
 srcdir =       @srcdir@
 VPATH =                @srcdir@
 top_srcdir =   @top_srcdir@
@@ -23,7 +21,7 @@ CDEFINES =    -DVERSION=\"${VERSION}\" @USE_PKCS11@ @PKCS11_ENGINE@ \
                @CRYPTO@ -DPK11_LIB_LOCATION=\"@PKCS11_PROVIDER@\"
 CWARNINGS =
 
-DNSLIBS =      ../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@
+DNSLIBS =      ../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@
 ISCLIBS =      ../../lib/isc/libisc.@A@
 ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@
 
index 1c413973d066b580c7d04f58ec85f174525849e7..e7a61c9086c5446c63714770862c239c15e25d7a 100644 (file)
@@ -45,13 +45,14 @@ DLZDRIVER_LIBS =    @DLZ_DRIVER_LIBS@
 CINCLUDES =    -I${srcdir}/include -I${srcdir}/unix/include -I. \
                ${LWRES_INCLUDES} ${DNS_INCLUDES} ${BIND9_INCLUDES} \
                ${ISCCFG_INCLUDES} ${ISCCC_INCLUDES} ${ISC_INCLUDES} \
-               ${DLZDRIVER_INCLUDES} ${DBDRIVER_INCLUDES} @DST_OPENSSL_INC@
+               ${DLZDRIVER_INCLUDES} ${DBDRIVER_INCLUDES} ${MAXMINDDB_CFLAGS} \
+               @DST_OPENSSL_INC@
 
 CDEFINES =      @CONTRIB_DLZ@ @USE_PKCS11@ @PKCS11_ENGINE@ @CRYPTO@
 
 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@
@@ -82,10 +83,13 @@ SUBDIRS =   unix
 TARGETS =      named@EXEEXT@ lwresd@EXEEXT@
 
 GEOIPLINKOBJS = geoip.@O@
+GEOIP2LINKOBJS = geoip.@O@
 
 OBJS =         builtin.@O@ client.@O@ config.@O@ control.@O@ \
-               controlconf.@O@ fuzz.@O@ @GEOIPLINKOBJS@ interfacemgr.@O@ \
-               listenlist.@O@ log.@O@ logconf.@O@ main.@O@ notify.@O@ \
+               controlconf.@O@ fuzz.@O@ \
+               @GEOIPLINKOBJS@ @GEOIP2LINKOBJS@ \
+               interfacemgr.@O@ listenlist.@O@ log.@O@ logconf.@O@ \
+               main.@O@ notify.@O@ \
                query.@O@ server.@O@ sortlist.@O@ statschannel.@O@ \
                tkeyconf.@O@ tsigconf.@O@ update.@O@ xfrout.@O@ \
                zoneconf.@O@ \
@@ -98,10 +102,13 @@ UOBJS =            unix/os.@O@ unix/dlz_dlopen_driver.@O@
 SYMOBJS =      symtbl.@O@
 
 GEOIPLINKSRCS = geoip.c
+GEOIP2LINKSRCS = geoip.c
 
 SRCS =         builtin.c client.c config.c control.c \
-               controlconf.c fuzz.c @GEOIPLINKSRCS@ interfacemgr.c \
-               listenlist.c log.c logconf.c main.c notify.c \
+               controlconf.c fuzz.c \
+               @GEOIPLINKSRCS@ @GEOIP2LINKSRCS@ \
+               interfacemgr.c \ listenlist.c log.c logconf.c \
+               main.c notify.c \
                query.c server.c sortlist.c statschannel.c \
                tkeyconf.c tsigconf.c update.c xfrout.c \
                zoneconf.c \
@@ -135,6 +142,7 @@ config.@O@: config.c
                -DDYNDB_LIBDIR=\"@libdir@/bind\" \
                -DNS_LOCALSTATEDIR=\"${localstatedir}\" \
                -DNS_SYSCONFDIR=\"${sysconfdir}\" \
+               -DMAXMINDDB_PREFIX=\"@MAXMINDDB_PREFIX@\" \
                -c ${srcdir}/config.c
 
 server.@O@: server.c
index 7584efba9432088ebc06636a380e74bccd18302b..323231c1bfabb3f4e14a250007f4fc9c3309cbae 100644 (file)
@@ -70,6 +70,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\
index 0276f691e59c9176535e917145fe71ed700ea78b..5332516ff740264d34920d381b39e35beaec9c0d 100644 (file)
@@ -7,8 +7,6 @@
 # See the COPYRIGHT file distributed with this work for additional
 # information regarding copyright ownership.
 
-# $Id: Makefile.in,v 1.36 2009/12/05 23:31:40 each Exp $
-
 srcdir =       @srcdir@
 VPATH =                @srcdir@
 top_srcdir =   @top_srcdir@
@@ -29,7 +27,7 @@ CDEFINES =    -DVERSION=\"${VERSION}\" @CRYPTO@ @USE_GSSAPI@
 CWARNINGS =
 
 LWRESLIBS =    ../../lib/lwres/liblwres.@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@
 ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@
index 67c7b7d2b50f591b303f2de7bbc9af65b2f692ef..1e63b553b53b744159a021e34cd74e3e61015b8b 100644 (file)
@@ -7,8 +7,6 @@
 # See the COPYRIGHT file distributed with this work for additional
 # information regarding copyright ownership.
 
-# $Id: Makefile.in,v 1.49 2009/12/05 23:31:40 each Exp $
-
 srcdir =       @srcdir@
 VPATH =                @srcdir@
 top_srcdir =   @top_srcdir@
@@ -27,7 +25,7 @@ ISCCFGLIBS =  ../../lib/isccfg/libisccfg.@A@
 ISCCCLIBS =    ../../lib/isccc/libisccc.@A@
 ISCLIBS =      ../../lib/isc/libisc.@A@
 ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@
-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@
index de6813058d377d9085210079d5bda4249b8c3024..f34069adbfcdb448d52da643c22df368cd2249da 100644 (file)
@@ -20,7 +20,7 @@ CDEFINES =    @CRYPTO@
 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@ @ISC_OPENSSL_LIBS@
 ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ @ISC_OPENSSL_LIBS@
 ISCCFGLIBS =   ../../lib/isccfg/libisccfg.@A@
index 4442a808c49228b1e1624697591d326eabcef20b..97d10242442e717b1884e9d615e5dfde0606535d 100644 (file)
@@ -21,7 +21,7 @@ CDEFINES =    @CRYPTO@ @USE_GSSAPI@
 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@ @ISC_OPENSSL_LIBS@
 ISCNOSYMLIBS = ../../../lib/isc/libisc-nosymtbl.@A@ @ISC_OPENSSL_LIBS@
 ISCCFGLIBS =   ../../../lib/isccfg/libisccfg.@A@
index f140d525db5775507e42702ce9665fb907850a0e..8bb1097e8368642ef7ac2040ddfe9a4e21edf4ae 100644 (file)
@@ -20,7 +20,7 @@ CINCLUDES =   ${DNS_INCLUDES} ${ISC_INCLUDES} @DST_OPENSSL_INC@
 CDEFINES =     @CRYPTO@
 CWARNINGS =
 
-DNSLIBS =      ../../../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@
+DNSLIBS =      ../../../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@
 ISCLIBS =      ../../../../lib/isc/libisc.@A@ @ISC_OPENSSL_LIBS@
 
 DNSDEPLIBS =   ../../../../lib/dns/libdns.@A@
index af2b0f1e70e08e64e8d6032c45467fba6ddb49d8..83b41b8b4796152c2e7693c12249e0147312918b 100644 (file)
@@ -7,8 +7,6 @@
 # See the COPYRIGHT file distributed with this work for additional
 # information regarding copyright ownership.
 
-# $Id$
-
 srcdir =       @srcdir@
 VPATH =                @srcdir@
 top_srcdir =   @top_srcdir@
@@ -22,7 +20,7 @@ CINCLUDES =   ${DNS_INCLUDES} ${ISC_INCLUDES} @DST_OPENSSL_INC@
 CDEFINES =     @CRYPTO@
 CWARNINGS =
 
-DNSLIBS =      ../../../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@
+DNSLIBS =      ../../../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@
 ISCLIBS =      ../../../../lib/isc/libisc.@A@ @ISC_OPENSSL_LIBS@
 
 DNSDEPLIBS =   ../../../../lib/dns/libdns.@A@
index 252b6c061d82c0ed150d81c443c7e0645c1c4e0a..df275ca01f7e4eae328e08bde0465324d1c94811 100644 (file)
@@ -7,8 +7,6 @@
 # See the COPYRIGHT file distributed with this work for additional
 # information regarding copyright ownership.
 
-# $Id: Makefile.in,v 1.14 2009/12/05 23:31:40 each Exp $
-
 srcdir =       @srcdir@
 VPATH =                @srcdir@
 top_srcdir =   @top_srcdir@
@@ -22,7 +20,7 @@ CINCLUDES =   ${DNS_INCLUDES} ${ISC_INCLUDES} @DST_OPENSSL_INC@
 CDEFINES =     @CRYPTO@
 CWARNINGS =
 
-DNSLIBS =      ../../../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@
+DNSLIBS =      ../../../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@
 ISCLIBS =      ../../../../lib/isc/libisc.@A@ @ISC_OPENSSL_LIBS@
 
 DNSDEPLIBS =   ../../../../lib/dns/libdns.@A@
index 7bf2af4cea5f4a68b7cc92b4f911a6df2feb079b..9352155dfd2f55c1f957a40ab3aa570348086008 100644 (file)
@@ -17,12 +17,13 @@ VERSION=@BIND9_VERSION@
 
 CINCLUDES =    ${DNS_INCLUDES} ${ISC_INCLUDES} \
                ${ISCCFG_INCLUDES} ${LWRES_INCLUDES} \
-               ${BIND9_INCLUDES} @DST_OPENSSL_INC@
+               ${BIND9_INCLUDES} ${MAXMINDDB_CFLAGS} \
+               @DST_OPENSSL_INC@
 
 CDEFINES =     @CRYPTO@ -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@ @DNS_CRYPTO_LIBS@
 ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@
index 4ecaa8fd44a00ba26c6f11b5f9aee381bbcc61c4..8ae76925688956712acd467e7458a9ffaee1e7c3 100644 (file)
@@ -270,6 +270,9 @@ int sigwait(const unsigned int *set, int *sig);
 /* 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
 
index a205b7e09362bbdb0932b1968e0945d90ee5ce03..ce0f5d8697a04786d9d0d3047e0bba490f22a763 100755 (executable)
--- a/configure
+++ b/configure
@@ -876,6 +876,11 @@ ISC_PLATFORM_HAVEGSSAPI
 KRB5_CONFIG
 GEOIPLINKOBJS
 GEOIPLINKSRCS
+GEOIP2LINKOBJS
+GEOIP2LINKSRCS
+MAXMINDDB_PREFIX
+MAXMINDDB_LIBS
+MAXMINDDB_CFLAGS
 LWRES_PLATFORM_NEEDSYSSELECTH
 ISC_PLATFORM_NEEDSYSSELECTH
 ISC_PLATFORM_HAVEDEVPOLL
@@ -974,6 +979,7 @@ infodir
 docdir
 oldincludedir
 includedir
+runstatedir
 localstatedir
 sharedstatedir
 sysconfdir
@@ -1027,6 +1033,7 @@ enable_kqueue
 enable_epoll
 enable_devpoll
 with_geoip
+with_geoip2
 with_gssapi
 with_randomdev
 enable_threads
@@ -1100,6 +1107,9 @@ CPP
 PKG_CONFIG
 PKG_CONFIG_PATH
 PKG_CONFIG_LIBDIR
+MAXMINDDB_CFLAGS
+MAXMINDDB_LIBS
+MAXMINDDB_PREFIX
 CMOCKA_CFLAGS
 CMOCKA_LIBS
 KYUA'
@@ -1141,6 +1151,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}'
@@ -1393,6 +1404,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=* \
@@ -1530,7 +1550,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.
@@ -1683,6 +1703,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]
@@ -1771,7 +1792,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-gssapi=PATH|/path/krb5-config
                           Specify path for system-supplied GSSAPI
                           [default=auto]
@@ -1843,6 +1866,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
   CMOCKA_CFLAGS
               C compiler flags for CMOCKA, overriding pkg-config
   CMOCKA_LIBS linker flags for CMOCKA, overriding pkg-config
@@ -14616,17 +14645,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
+
+
+
+           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
 
 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"
@@ -27300,7 +27718,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"
@@ -27379,7 +27798,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)"
 
     test "yes" = "$enable_fixed" || \
index 6cc1089534a3a99cf22eb357a940bb8071abef7c..94e03a72240d5fc02df5764503e4a7890ea12f41 100644 (file)
@@ -722,13 +722,64 @@ AC_C_BIGENDIAN
 #
 # GeoIP support?
 #
-GEOIPLINKSRCS=
-GEOIPLINKOBJS=
+geoip2_default="no"
 AC_ARG_WITH(geoip,
            AS_HELP_STRING([--with-geoip=PATH],
-                          [Build with GeoIP support (yes|no|path)]),
-           use_geoip="$withval", use_geoip="no")
+                          [Build with legacy GeoIP support (yes|no|path)]),
+                           [
+                            use_geoip="$withval"
+                            geoip2_default="no"
+                           ],
+                           [use_geoip="no"])
+AC_ARG_WITH([geoip2],
+           [AS_HELP_STRING([--with-geoip2=PATH],
+                           [Build with MaxMind GeoIP2 support (auto|yes|no|path) [default=no]])],
+           [], with_geoip2="$geoip2_default")
+
+# specifying both --with-geoip and --with-geoip2 is an error.
+AS_IF([test "no" != "$with_geoip2" && test "no" != "$use_geoip"],
+      [AC_MSG_ERROR([--with-geoip and --with-geoip2 are incompatible])])
+
+GEOIP2LINKSRCS=
+GEOIP2LINKOBJS=
+AS_CASE([$with_geoip2],
+       [no],[],
+       [auto],[PKG_CHECK_MODULES([MAXMINDDB], [libmaxminddb],
+                                     [AC_DEFINE([HAVE_GEOIP2], [1], [Build with GeoIP2 support])
+                                      PKG_CHECK_VAR([MAXMINDDB_PREFIX], [libmaxminddb], [prefix], [], [AC_MSG_ERROR([libmaxminddb prefix not found in pkg-config; set MAXMINDDB_PREFIX in the environment])])
+                                      GEOIP2LINKSRCS='${GEOIP2LINKSRCS}'
+                                      GEOIP2LINKOBJS='${GEOIP2LINKOBJS}'
+                                     ],[:])],
+       [yes],[PKG_CHECK_MODULES([MAXMINDDB], [libmaxminddb],
+                                     [AC_DEFINE([HAVE_GEOIP2], [1], [Build with GeoIP2 support])
+                                      PKG_CHECK_VAR([MAXMINDDB_PREFIX], [libmaxminddb], [prefix], [], [AC_MSG_ERROR([libmaxminddb prefix not found in pkg-config; set MAXMINDDB_PREFIX in the environment])])
+                                      GEOIP2LINKSRCS='${GEOIP2LINKSRCS}'
+                                      GEOIP2LINKOBJS='${GEOIP2LINKOBJS}'
+                                     ])],
+       [ # default
+           AX_SAVE_FLAGS([geoip2])
+           MAXMINDDB_CFLAGS="-I$with_geoip2/include"
+           MAXMINDDB_LIBS="-L$with_geoip2/libs"
+           CFLAGS="$CFLAGS $MAXMINDDB_CFLAGS"
+           LDFLAGS="$LDFLAGS $MAXMINDDB_LIBS"
+           AC_SEARCH_LIBS([MMDB_open], [maxminddb],
+                          [AC_DEFINE([HAVE_GEOIP2], [1], [Build with GeoIP2 support])
+                           GEOIP2LINKSRCS='${GEOIP2LINKSRCS}'
+                           GEOIP2LINKOBJS='${GEOIP2LINKOBJS}'
+                           MAXMINDDB_LIBS="$MAXMINDDB_LIBS $ac_cv_search_mmdb_open"
+                           AC_MSG_NOTICE([GeoIP2 default database path set to $with_geoip2/share/GeoIP])
+                           AS_VAR_COPY([MAXMINDDB_PREFIX], [$with_geoip2])
+                          ],
+                          [AC_MSG_ERROR([GeoIP2 requested, but libmaxminddb not found])])
+       ])
+AC_ARG_VAR([MAXMINDDB_PREFIX], [value of prefix for MAXMINDDB, overriding pkg-config])
+AC_SUBST([MAXMINDDB_CFLAGS])
+AC_SUBST([MAXMINDDB_LIBS])
+AC_SUBST([GEOIP2LINKSRCS])
+AC_SUBST([GEOIP2LINKOBJS])
 
+GEOIPLINKSRCS=
+GEOIPLINKOBJS=
 if test "yes" = "$use_geoip"
 then
        for d in /usr /usr/local /opt/local
@@ -743,8 +794,6 @@ fi
 
 case "$use_geoip" in
        no|'')
-               AC_MSG_CHECKING([for GeoIP support])
-               AC_MSG_RESULT([disabled])
                ;;
        *)
                if test -d "$use_geoip" -o -L "$use_geoip"
@@ -5538,7 +5587,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"
@@ -5617,7 +5667,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)"
 
     test "yes" = "$enable_fixed" || \
index 3c983302491dd13d085cbb8cbb283155688b953c..73a55989f8344c38057abb62e823405d5ce779a2 100644 (file)
@@ -7,8 +7,6 @@
 # See the COPYRIGHT file distributed with this work for additional
 # information regarding copyright ownership.
 
-# $Id: Makefile.in,v 1.14 2009/12/05 23:31:40 each Exp $
-
 srcdir =       @srcdir@
 VPATH =                @srcdir@
 top_srcdir =   @top_srcdir@
@@ -27,7 +25,7 @@ CWARNINGS =
 
 ISCLIBS =      ../../lib/isc/libisc.@A@
 ISCCFGLIBS =    ../../lib/isccfg/libisccfg.@A@
-DNSLIBS =    ../../lib/dns/libdns.@A@
+DNSLIBS =      ../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@
 
 ISCDEPLIBS =   ../../lib/isc/libisc.@A@
 ISCCFGDEPLIBS =        ../../lib/isccfg/libisccfg.@A@
index f6868d15879960ec51b4f668656ddeff822c90f4..7f09bd68732d6ee5d5b4fee6f33dae0842975485 100644 (file)
@@ -27,7 +27,8 @@ VERSION=@BIND9_VERSION@
 USE_ISC_SPNEGO = @USE_ISC_SPNEGO@
 
 CINCLUDES =    -I. -I${top_srcdir}/lib/dns -Iinclude ${DNS_INCLUDES} \
-               ${ISC_INCLUDES} @DST_OPENSSL_INC@ @DST_GSSAPI_INC@
+               ${ISC_INCLUDES} ${MAXMINDDB_CFLAGS} \
+               @DST_OPENSSL_INC@ @DST_GSSAPI_INC@
 
 CDEFINES =     -DUSE_MD5 @CRYPTO@ @USE_GSSAPI@ ${USE_ISC_SPNEGO}
 
@@ -37,7 +38,7 @@ ISCLIBS =     ../../lib/isc/libisc.@A@
 
 ISCDEPLIBS =   ../../lib/isc/libisc.@A@
 
-LIBS =         @LIBS@
+LIBS =         ${MAXMINDDB_LIBS} @LIBS@
 
 # Alphabetically
 
@@ -57,6 +58,7 @@ DSTOBJS =     @DST_EXTRA_OBJS@ @OPENSSLLINKOBJS@ @PKCS11LINKOBJS@ \
                gssapi_link.@O@ gssapictx.@O@ hmac_link.@O@ key.@O@
 
 GEOIPLINKOBJS = geoip.@O@
+GEOIP2LINKOBJS = geoip2.@O@
 
 DNSTAPOBJS = dnstap.@O@ dnstap.pb-c.@O@
 
@@ -82,7 +84,7 @@ DNSOBJS =     acache.@O@ acl.@O@ adb.@O@ badcache.@O@ byaddr.@O@ \
 PORTDNSOBJS =  client.@O@ ecdb.@O@
 
 OBJS=          @DNSTAPOBJS@ ${DNSOBJS} ${OTHEROBJS} ${DSTOBJS} \
-               ${PORTDNSOBJS} @GEOIPLINKOBJS@
+               ${PORTDNSOBJS} @GEOIPLINKOBJS@ @GEOIP2LINKOBJS@
 
 
 # Alphabetically
@@ -103,6 +105,7 @@ DSTSRCS =   @DST_EXTRA_SRCS@ @OPENSSLLINKSRCS@ @PKCS11LINKSRCS@ \
                hmac_link.c key.c
 
 GEOIPLINKSRCS = geoip.c
+GEOIPL2INKSRCS = geoip2.c
 
 DNSTAPSRCS = dnstap.c dnstap.pb-c.c
 
@@ -123,7 +126,8 @@ DNSSRCS =   acache.c acl.c adb.c badcache. byaddr.c \
                version.c view.c xfrin.c zone.c zonekey.c zt.c ${OTHERSRCS}
 PORTDNSSRCS =  client.c ecdb.c
 
-SRCS = ${DSTSRCS} ${DNSSRCS} ${PORTDNSSRCS} @DNSTAPSRCS@ @GEOIPLINKSRCS@
+SRCS = ${DSTSRCS} ${DNSSRCS} \
+       ${PORTDNSSRCS} @DNSTAPSRCS@ @GEOIPLINKSRCS@ @GEOIP2LINKSRCS@
 
 SUBDIRS =      include
 TARGETS =      timestamp
diff --git a/lib/dns/geoip2.c b/lib/dns/geoip2.c
new file mode 100644 (file)
index 0000000..029d855
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * See the COPYRIGHT file distributed with this work for additional
+ * information regarding copyright ownership.
+ */
+
+/*! \file */
+
+#include <dns/geoip.h>
+
+#include <isc/util.h>
+
+bool
+dns_geoip_match(const isc_netaddr_t *reqaddr,
+               const dns_geoip_databases_t *geoip,
+               const dns_geoip_elem_t *elt)
+{
+       UNUSED(reqaddr);
+       UNUSED(geoip);
+       UNUSED(elt);
+
+       return (false);
+}
+
+void
+dns_geoip_shutdown(void) {
+       return;
+}
index 0897579cb40ea8080af8be4d8a62ff6a8f06c9b5..90dc3a69c54d506ba5f13adb14d4eadef698cb8e 100644 (file)
@@ -21,7 +21,7 @@ CDEFINES =    @CRYPTO@ -DTESTS="\"${top_builddir}/lib/dns/tests/\""
 
 ISCLIBS =      ../../isc/libisc.@A@
 ISCDEPLIBS =   ../../isc/libisc.@A@
-DNSLIBS =      ../libdns.@A@ @DNS_CRYPTO_LIBS@
+DNSLIBS =      ../libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@
 DNSDEPLIBS =   ../libdns.@A@
 
 LIBS =         @LIBS@ @CMOCKA_LIBS@
index 5089b6cd212974de177e95ee3bac678f78c8d98e..536fa5928636406d7834469220d415a2a9c2c4db 100644 (file)
@@ -20,7 +20,7 @@ CDEFINES =    -DTESTS="\"${top_builddir}/lib/irs/tests/\""
 
 CFGLIBS =      ../../isccfg/libisccfg.@A@
 CFGDEPLIBS =   ../../isccfg/libisccfg.@A@
-DNSLIBS =      ../../dns/libdns.@A@ @DNS_CRYPTO_LIBS@
+DNSLIBS =      ../../dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@
 DNSDEPLIBS =   ../../dns/libdns.@A@
 ISCLIBS =      ../../isc/libisc.@A@
 ISCDEPLIBS =   ../../isc/libisc.@A@
index f459bd54a0027b0fba2757e7dd592348e237d7fd..b97657d9b889e52d415ce717d300183e12b79147 100644 (file)
@@ -23,7 +23,7 @@ CDEFINES =
 CWARNINGS =
 
 ISCLIBS =      ../../lib/isc/libisc.@A@
-DNSLIBS =      ../../lib/dns/libdns.@A@
+DNSLIBS =      ../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@
 ISCCFGLIBS =   ../../lib/cfg/libisccfg.@A@
 
 ISCDEPLIBS =   ../../lib/isc/libisc.@A@
index 521e1cc4287ef1e96cb1fd600a5729aab0cccfb0..3064152b6b671b83ea4a553bfb3ca388c00b34c5 100644 (file)
@@ -22,7 +22,7 @@ CDEFINES =    @CRYPTO@ -DTESTS="\"${top_builddir}/lib/dns/tests/\""
 
 ISCLIBS =      ../../isc/libisc.@A@
 ISCDEPLIBS =   ../../isc/libisc.@A@
-DNSLIBS =      ../../dns/libdns.@A@ @DNS_CRYPTO_LIBS@
+DNSLIBS =      ../../dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@
 DNSDEPLIBS =   ../../dns/libdns.@A@
 ISCCFGLIBS =   ../libisccfg.@A@
 ISCCFGDEPLIBS = ../libisccfg.@A@
index 7abdd8e80f9ce6dfb7994f94ad005f10b9a96d3d..6abe81c2aca85245c7a6f1808cfa15061dd73d7d 100644 (file)
@@ -25,7 +25,7 @@ CDEFINES =    @CRYPTO@ -DVERSION=\"${VERSION}\" \
 CWARNINGS =
 
 ISCLIBS =      ../isc/libisc.@A@
-DNSLIBS =      ../dns/libdns.@A@ @DNS_CRYPTO_LIBS@
+DNSLIBS =      ../dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@
 ISCCFGLIBS =   ../isccfg/libisccfg.@A@
 IRSLIBS =      ../irs/libirs.@A@
 
diff --git a/m4/ax_restore_flags.m4 b/m4/ax_restore_flags.m4
new file mode 100644 (file)
index 0000000..8f2adf2
--- /dev/null
@@ -0,0 +1,52 @@
+# ===========================================================================
+#     https://www.gnu.org/software/autoconf-archive/ax_restore_flags.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_RESTORE_FLAGS([namespace])
+#
+# DESCRIPTION
+#
+#   Restore common compilation flags from temporary variables.
+#
+#   Compilation flags includes: CPPFLAGS, CFLAGS, CXXFLAGS, LDFLAGS, LIBS,
+#   OBJCFLAGS.
+#
+#   By default these flags are restored to a global (empty) namespace, but
+#   user could restore from specific NAMESPACE by using
+#   AX_RESTORE_FLAGS(NAMESPACE) macro.
+#
+#   Typical usage is like:
+#
+#     AX_SAVE_FLAGS(mypackage)
+#     CPPFLAGS="-Imypackagespath ${CPPFLAGS}"
+#     dnl ... do some detection ...
+#     AX_RESTORE_FLAGS(mypackage)
+#
+# LICENSE
+#
+#   Copyright (c) 2009 Filippo Giunchedi <filippo@esaurito.net>
+#   Copyright (c) 2011 The Board of Trustees of the Leland Stanford Junior University
+#   Copyright (c) 2011 Russ Allbery <rra@stanford.edu>
+#   Copyright (c) 2013 Bastien ROUCARIES <roucaries.bastien+autoconf@gmail.com>
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved. This file is offered as-is, without any
+#   warranty.
+
+#serial 7
+
+# save one flag in name space
+AC_DEFUN([_AX_RESTORE_ONE_FLAG],[dnl
+  AS_VAR_PUSHDEF([_ax_restore_flag_var], [$2[]_$1[]_ax_save_flags])
+  AS_VAR_COPY($2[],_ax_restore_flag_var)
+  AS_VAR_POPDEF([_ax_restore_flag_var])
+])
+
+AC_DEFUN([AX_RESTORE_FLAGS], [dnl
+   m4_foreach([FLAG], dnl
+             [_AX_SAVE_FLAGS_LIST()], dnl
+             [_AX_RESTORE_ONE_FLAG([$1],FLAG)])
+])
diff --git a/m4/ax_save_flags.m4 b/m4/ax_save_flags.m4
new file mode 100644 (file)
index 0000000..5bc7c6c
--- /dev/null
@@ -0,0 +1,71 @@
+# ===========================================================================
+#      https://www.gnu.org/software/autoconf-archive/ax_save_flags.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_SAVE_FLAGS([NAMESPACE])
+#
+# DESCRIPTION
+#
+#   Save common compilation flags into temporary variables.
+#
+#   Compilation flags includes: CPPFLAGS, CFLAGS, CXXFLAGS, LDFLAGS, LIBS,
+#   OBJCFLAGS.
+#
+#   By default these flags are saved to a global (empty) namespace, but user
+#   could specify a specific NAMESPACE to AX_SAVE_FLAGS macro and latter
+#   restore it by using AX_RESTORE_FLAGS(NAMESPACE).
+#
+#     AX_SAVE_FLAGS(mypackage)
+#     CPPFLAGS="-Imypackagespath ${CPPFLAGS}"
+#     dnl .. do some detection ...
+#     AX_RESTORE_FLAGS(mypackage)
+#
+# LICENSE
+#
+#   Copyright (c) 2009 Filippo Giunchedi <filippo@esaurito.net>
+#   Copyright (c) 2011 The Board of Trustees of the Leland Stanford Junior University
+#   Copyright (c) 2011 Russ Allbery <rra@stanford.edu>
+#   Copyright (c) 2013 Bastien ROUCARIES <roucaries.bastien+autoconf@gmail.com>
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved. This file is offered as-is, without any
+#   warranty.
+
+#serial 8
+
+# list of flag to save
+AC_DEFUN([_AX_SAVE_FLAGS_LIST],[dnl
+[CCASFLAGS],dnl
+[CFLAGS],dnl
+[CPPFLAGS],dnl
+[CXXFLAGS],dnl
+[ERLCFLAGS],dnl
+[FCFLAGS],dnl
+[FCLIBS],dnl
+[FFLAGS],dnl
+[FLIBS],dnl
+[GCJFLAGS],dnl
+[JAVACFLAGS],dnl
+[LDFLAGS],dnl
+[LIBS],dnl
+[OBJCFLAGS],dnl
+[OBJCXXFLAGS],dnl
+[UPCFLAGS],dnl
+[VALAFLAGS]dnl
+])
+
+# save one flag in name space
+AC_DEFUN([_AX_SAVE_ONE_FLAG],[
+  AS_VAR_PUSHDEF([_ax_save_flag_var], [$2[]_$1[]_ax_save_flags])
+  AS_VAR_COPY(_ax_save_flag_var, $2[])
+  AS_VAR_POPDEF([_ax_save_flag_var])
+])
+
+AC_DEFUN([AX_SAVE_FLAGS],[dnl
+   m4_foreach([FLAG], dnl
+             [_AX_SAVE_FLAGS_LIST()], dnl
+             [_AX_SAVE_ONE_FLAG([$1],FLAG)])
+])
index 8804a5a4b6f092176d6783f126de90eda4454907..30605a09c8c35af8c440be853ddc41c16510708b 100644 (file)
@@ -118,6 +118,9 @@ LFS_CFLAGS = @LFS_CFLAGS@
 LFS_LDFLAGS = @LFS_LDFLAGS@
 LFS_LIBS = @LFS_LIBS@
 
+MAXMINDDB_CFLAGS = @MAXMINDDB_CFLAGS@
+MAXMINDDB_LIBS = @MAXMINDDB_LIBS@
+
 .SUFFIXES:
 .SUFFIXES: .c .@O@
 
index 7fae33a59cae74cacedafd335bd3881c0d723232..49659c1c1f30cbbcca13fe8131d7272d83710125 100644 (file)
 ./lib/dns/gen-win32.h                          C       1999,2000,2001,2004,2005,2006,2007,2009,2014,2016,2018,2019
 ./lib/dns/gen.c                                        C       1998,1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2012,2013,2014,2015,2016,2017,2018,2019
 ./lib/dns/geoip.c                              C       2013,2014,2015,2016,2018,2019
+./lib/dns/geoip2.c                             C       2019
 ./lib/dns/gssapi_link.c                                C       2000,2001,2002,2004,2005,2006,2007,2008,2009,2011,2012,2013,2014,2015,2016,2018,2019
 ./lib/dns/gssapictx.c                          C       2000,2001,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019
 ./lib/dns/hmac_link.c                          C.NAI   1999,2000,2001,2002,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019
 ./libtool.m4/ltversion.m4                      X       2012,2018,2019
 ./libtool.m4/lt~obsolete.m4                    X       2012,2018,2019
 ./ltmain.sh                                    X       1999,2000,2001,2003,2004,2006,2009,2012,2018,2019
+./m4/ax_restore_flags.m4                       X       2019
+./m4/ax_save_flags.m4                          X       2019
 ./make/Makefile.in                             MAKE    1998,1999,2000,2001,2004,2007,2012,2016,2018,2019
 ./make/includes.in                             MAKE    1999,2000,2001,2004,2005,2007,2012,2014,2016,2018,2019
 ./make/mkdep.in                                        X       1999,2000,2001,2006,2011,2014,2018,2019