1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-06-12 17:14:46 +02:00

Bundle with GeoIP classic library and add geoip_classic placeholder.

This library we can safely bundle because it is GPLv2.
This commit is contained in:
Bram Matthys
2021-08-17 14:10:31 +02:00
parent 9ff56089ad
commit ed7bf1daf5
7 changed files with 274 additions and 3 deletions
+67
View File
@@ -312,3 +312,70 @@ else
AC_MSG_RESULT([no])
fi
])
dnl For geoip-api-c
AC_DEFUN([CHECK_GEOIP_CLASSIC],
[
AC_ARG_ENABLE(geoip_classic,
[AC_HELP_STRING([--enable-geoip-classic=no/yes],[enable GeoIP Classic support])],
[enable_geoip_classic=$enableval],
[enable_geoip_classic=no])
AS_IF([test "x$enable_geoip_classic" = "xyes"],
[
dnl First see if the system provides it
has_system_geoip_classic="no"
PKG_CHECK_MODULES([GEOIP_CLASSIC], [geoip >= 1.6.0],[has_system_geoip_classic=yes
AS_IF([test "x$PRIVATELIBDIR" != "x"], [rm -f "$PRIVATELIBDIR/"libGeoIP.*])],[has_system_geoip_classic=no])])
dnl Otherwise fallback to our own..
AS_IF([test "$has_system_geoip_classic" = "no"],[
dnl REMEMBER TO CHANGE WITH A NEW GEOIP LIBRARY RELEASE!
geoip_classic_version="1.6.12"
AC_MSG_RESULT(extracting GeoIP Classic library)
cur_dir=`pwd`
cd extras
dnl remove old directory to force a recompile...
dnl and remove its installation prefix just to clean things up.
rm -rf GeoIP-$geoip_classic_version geoip-classic
if test "x$ac_cv_path_GUNZIP" = "x" ; then
tar xfz geoip-classic.tar.gz
else
cp geoip-classic.tar.gz geoip-classic.tar.gz.bak
gunzip -f geoip-classic.tar.gz
cp geoip-classic.tar.gz.bak geoip-classic.tar.gz
tar xf geoip-classic.tar
fi
AC_MSG_RESULT(configuring GeoIP Classic library)
cd GeoIP-$geoip_classic_version
save_cflags="$CFLAGS"
CFLAGS="$orig_cflags"
export CFLAGS
./configure --prefix=$cur_dir/extras/geoip-classic --libdir=$PRIVATELIBDIR --enable-shared --disable-static || exit 1
CFLAGS="$save_cflags"
AC_MSG_RESULT(compiling GeoIP Classic library)
$ac_cv_prog_MAKER || exit 1
AC_MSG_RESULT(installing GeoIP Classic library)
$ac_cv_prog_MAKER install || exit 1
GEOIP_CLASSIC_CFLAGS="-I$cur_dir/extras/geoip-classic/include"
AC_SUBST(GEOIP_CLASSIC_CFLAGS)
GEOIP_CLASSIC_LIBS=
dnl See c-ares's compilation section for more info on this hack.
dnl ensure that we're linking against the bundled version
dnl (we only reach this code if linking against the bundled version is desired).
AS_IF([test -n "$ac_cv_path_PKGCONFIG"],
[GEOIP_CLASSIC_LIBS="`$ac_cv_path_PKGCONFIG --libs geoip.pc`"])
dnl For when pkg-config isn't available
AS_IF([test -z "$GEOIP_CLASSIC_LIBS"],
[GEOIP_CLASSIC_LIBS="-L$PRIVATELIBDIR -lGeoIP"])
cd $cur_dir
])
AC_SUBST(GEOIP_CLASSIC_LIBS)
AC_SUBST(GEOIP_CLASSIC_CFLAGS)
GEOIP_CLASSIC_OBJECTS="geoip_classic.so"
AC_SUBST(GEOIP_CLASSIC_OBJECTS)
]) dnl AS_IF(enable_geoip_classic)
])