blob: 339388a6aad243cb5c224c024b4fb6e4f31bc8c8 [file] [log] [blame]
AC_INIT(libGeoIP/GeoIP.c)
dnl AM_CONFIG_HEADER(config.h)
VERSION=1.4.0
PACKAGE=GeoIP
GEOIP_VERSION_INFO=`echo $VERSION | awk -F. '{ printf "%d:%d:%d", $1+$2, $3, $2 }'`
AC_SUBST(GEOIP_VERSION_INFO)
AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
AC_PROG_CC
AC_PROG_LIBTOOL
AC_ARG_WITH(dbdir,
[ --with-dbdir=\"dir\" Default directories to look for Geo-IP Database files.
(Default: DATADIR/GeoIP)],
[DEFAULT_DBDIR="$with_dbdir"
AC_DEFINE_UNQUOTED(DEFAULT_DBDIR,"$with_dbdir")])
AC_ARG_WITH(city,
[ --with-city=\"no\" Enable/disable support for GeoIP City Edition. (yes)])
if test "$with_city" = "no" ; then
echo Disabling GeoIP City Edition support
WITH_CITY=1
else
echo Enabling GeoIP City Edition support
WITH_CITY=0
fi
AC_SUBST(WITH_CITY)
AM_CONDITIONAL(WITH_CITY, test "$with_city" != "no")
AC_CHECK_TYPE(byte,[AC_DEFINE(HAVE_BYTE_TYPEDEF)],[])
AC_CHECK_TYPE(ushort,[AC_DEFINE(HAVE_USHORT_TYPEDEF)],[])
AC_CHECK_TYPE(ulong,[AC_DEFINE(HAVE_ULONG_TYPEDEF)],[])
AC_CHECK_TYPE(u16,[AC_DEFINE(HAVE_U16_TYPEDEF)],[])
AC_CHECK_TYPE(u32,[AC_DEFINE(HAVE_U32_TYPEDEF)],[])
AC_C_BIGENDIAN([AC_DEFINE(BIG_ENDIAN_HOST,1)],[AC_DEFINE(LITTLE_ENDIAN_HOST,1)])
AC_CHECK_HEADERS(stdint.h)
AC_CHECK_HEADERS(zlib.h, , AC_MSG_ERROR(Zlib header (zlib.h) not found. Tor requires zlib to build. You may need to install a zlib development package.))
AC_CHECK_FUNC(gethostbyname, AC_DEFINE(HAVE_GETHOSTBYNAME),
AC_CHECK_LIB(nsl, gethostbyname, AC_DEFINE(HAVE_GETHOSTBYNAME)
LIBS="${LIBS} -lsocket -lnsl"))
AC_CHECK_FUNC(gethostbyname_r, [
AC_DEFINE(HAVE_GETHOSTBYNAME_R)
# We look for the one that returns `int'.
# Hopefully this check is robust enough.
AC_EGREP_HEADER(int.*gethostbyname_r, netdb.h, [
AC_DEFINE(GETHOSTBYNAME_R_RETURNS_INT)])
])
GEOIPSHAREPATH=""
tmpset="$datadir/GeoIP"
while test "x$tmpset" != "x$GEOIPSHAREPATH"; do
GEOIPSHAREPATH="$tmpset"
eval tmpset="$tmpset"
done
if test "x$DEFAULT_DBDIR" = "x"; then
AC_DEFINE_UNQUOTED(DEFAULT_DBDIR,"$GEOIPSHAREPATH")
fi
AC_OUTPUT([
Makefile
GeoIP.spec
libGeoIP/Makefile
apps/Makefile
conf/Makefile
data/Makefile
man/Makefile
test/Makefile
])