summaryrefslogtreecommitdiffstats
path: root/configure.ac
blob: 28d098c12873637b635ab7ea88fb580af34efae6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
dnl AM_CONFIG_HEADER(config.h)

AC_PREREQ([2.63])
AC_INIT([GeoIP], [1.6.12],[support@maxmind.com],[GeoIP])
AC_CONFIG_AUX_DIR([.])
AC_CONFIG_SRCDIR([libGeoIP/GeoIP.c])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE(1.10.0)
AC_GNU_SOURCE
GEOIP_VERSION_INFO=`echo $VERSION | awk -F. '{ printf "%d:%d:%d", $1+$2, $3, $2 }'`
AC_SUBST(GEOIP_VERSION_INFO)

AC_PROG_CC
AC_PROG_LIBTOOL

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_TYPE_OFF_T
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T

AC_C_BIGENDIAN([AC_DEFINE(BIG_ENDIAN_HOST,1)],[AC_DEFINE(LITTLE_ENDIAN_HOST,1)])

AC_CHECK_FUNC(getopt, AC_DEFINE(HAVE_GETOPT))
AC_CHECK_FUNC(gettimeofday, AC_DEFINE(HAVE_GETTIMEOFDAY))
AC_CHECK_FUNC(pread, AC_DEFINE(HAVE_PREAD))
AC_CHECK_FUNC(vasprintf, AC_DEFINE(HAVE_VASPRINTF))
AC_CHECK_FUNC(vsnprintf, AC_DEFINE(HAVE_VSNPRINTF))
AC_CHECK_FUNC(vsprintf, AC_DEFINE(HAVE_VSPRINTF))

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)])
	])

AC_CHECK_FUNCS([ memset memchr munmap strrchr socket strchr strdup strstr ])

AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_FUNC_MMAP

AC_ARG_ENABLE([data-files],
    AS_HELP_STRING([--disable-data-files], [Install library without installing data files]))

AS_IF([test "x$enable_data_files" != xno],
    AC_SUBST([GEOIP_DB_FILE],[GeoIP.dat]))

case $host_os in
    mingw* )
        # To do: Check for and add -Wl,--high-entropy-va if it's supported.
        LDFLAGS="$LDFLAGS -lwsock32 -lws2_32 -Wl,--dynamicbase -Wl,--nxcompat"
        ;;
esac


AC_OUTPUT([
Makefile
GeoIP.spec
geoip.pc
libGeoIP/Makefile
apps/Makefile
man/Makefile
test/Makefile
])