1#                                               -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
4AC_PREREQ(2.61)
5AC_INIT(librasterlite2, 1.0.0-rc0, a.furieri@lqt.it)
6AC_LANG(C)
7AC_CONFIG_AUX_DIR([.])
8AC_CONFIG_MACRO_DIR([m4])
9
10AM_INIT_AUTOMAKE
11AM_MAINTAINER_MODE
12AM_CONFIG_HEADER(config.h)
13
14# enabling huge-file support (64 bit file pointers)
15AH_TEMPLATE([_LARGE_FILE],
16            [Must be defined in order to enable huge-file support.])
17AC_DEFINE(_LARGE_FILE)
18AH_TEMPLATE([_FILE_OFFSET_BITS],
19            [Must be =64 in order to enable huge-file support.])
20AC_DEFINE(_FILE_OFFSET_BITS, 64)
21AH_TEMPLATE([_LARGEFILE_SOURCE],
22            [Must be defined in order to enable huge-file support.])
23AC_DEFINE(_LARGEFILE_SOURCE)
24
25# disablibg debug support
26AH_TEMPLATE([NDEBUG],
27            [Must be defined in order to disable debug mode.])
28AC_DEFINE(NDEBUG)
29AH_TEMPLATE([TARGET_CPU],
30            [Should contain a text-string describing the intended target CPU])
31
32
33# Checks for header files.
34AC_CHECK_HEADERS(stdlib.h,, [AC_MSG_ERROR([cannot find stdlib.h, bailing out])])
35AC_CHECK_HEADERS(stdio.h,, [AC_MSG_ERROR([cannot find stdio.h, bailing out])])
36AC_CHECK_HEADERS(string.h,, [AC_MSG_ERROR([cannot find string.h, bailing out])])
37AC_CHECK_HEADERS(memory.h,, [AC_MSG_ERROR([cannot find memory.h, bailing out])])
38AC_CHECK_HEADERS(math.h,,[AC_MSG_ERROR([cannot find math.h, bailing out])])
39AC_CHECK_HEADERS(float.h,,[AC_MSG_ERROR([cannot find float.h, bailing out])])
40AC_CHECK_HEADERS(jpeglib.h,, [AC_MSG_ERROR([cannot find jpeglib.h, bailing out])])
41AC_CHECK_HEADERS(jerror.h,, [AC_MSG_ERROR([cannot find jerror.h, bailing out])])
42AC_CHECK_HEADERS(png.h,, [AC_MSG_ERROR([cannot find png.h, bailing out])])
43AC_CHECK_HEADERS(zlib.h,, [AC_MSG_ERROR([cannot find zlib.h, bailing out])])
44AC_CHECK_HEADERS(gif_lib.h,, [AC_MSG_ERROR([cannot find gif_lib.h, bailing out])])
45AC_CHECK_HEADERS(lzma.h,, [AC_MSG_ERROR([cannot find lzma.h, bailing out])])
46
47#
48# testing GeoTiff headers
49# on some systems they are located on -/include
50# on other systems they are on -/include/geotiff
51# or even on -/include/libgeotiff
52#
53# this patch was kindly contributed by Brad Hards
54# 2011-09-02
55#
56AC_CHECK_HEADERS(geotiff/geotiff.h)
57AC_CHECK_HEADERS(libgeotiff/geotiff.h)
58AC_CHECK_HEADERS(geotiff.h)
59if test x"$ac_cv_header_geotiff_geotiff_h" != x"yes" &&
60    test x"$ac_cv_header_libgeotiff_geotiff_h" != x"yes" &&
61    test x"$ac_cv_header_geotiff_h" != x"yes";
62then
63    AC_MSG_ERROR(['libgeotiff' is required but the header (geotiff.h) doesn't seem to be installed on this system])
64fi
65
66
67# Checks for programs.
68AC_PROG_CXX
69AC_PROG_CC
70AC_PROG_CPP
71AC_PROG_INSTALL
72AC_PROG_LN_S
73AC_PROG_MAKE_SET
74AC_LIBTOOL_WIN32_DLL
75AC_PROG_LIBTOOL
76
77# Checks for typedefs, structures, and compiler characteristics.
78AC_C_CONST
79AC_TYPE_OFF_T
80AC_TYPE_SIZE_T
81AC_HEADER_TIME
82AC_STRUCT_TM
83AC_C_VOLATILE
84
85# Checks for library functions.
86AC_FUNC_LSTAT
87AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
88AC_FUNC_MEMCMP
89AC_FUNC_STAT
90AC_FUNC_STRFTIME
91AC_CHECK_FUNCS([sqrt strcasecmp strerror strncasecmp strstr strerror])
92
93# gcov support
94AC_ARG_ENABLE(gcov, AC_HELP_STRING([--enable-gcov],[turn on code coverage analysis tools]))
95if test "x$enable_gcov" = "xyes"; then
96    dnl Check for -fprofile-arcs and -ftest-coverage option
97    CFLAGS=$CFLAGS" -fprofile-arcs -ftest-coverage -g"
98    GCOV_FLAGS="-lgcov"
99fi
100
101AC_CONFIG_FILES([Makefile \
102		headers/Makefile \
103		src/Makefile \
104		test/Makefile \
105		test/sql_stmt_tests/Makefile \
106		test/sql_stmt_security_tests/Makefile \
107		tools/Makefile \
108		examples/Makefile \
109		Doxyfile \
110		rasterlite2.pc])
111
112# exporting the TARGET_CPU string
113rl2_cpu=`$CC -dumpmachine`
114AC_DEFINE_UNQUOTED([TARGET_CPU], ["$rl2_cpu"])
115
116# Checks for installed libraries
117AC_CHECK_LIB(z,inflateInit_,,AC_MSG_ERROR(['libz' is required but it doesn't seems to be installed on this system.]),-lm)
118AC_CHECK_LIB(jpeg,jpeg_start_compress,,AC_MSG_ERROR(['libjpeg' is required but it doesn't seems to be installed on this system.]),-lm)
119AC_CHECK_LIB(gif,DGifSlurp,,AC_MSG_ERROR(['libpng' is required but it doesn't seems to be installed on this system.]),-lm)
120AC_CHECK_LIB(tiff,TIFFClientOpen,,AC_MSG_ERROR(['libtiff' is required but it doesn't seems to be installed on this system.]),-lm)
121AC_CHECK_LIB(geotiff,GTIFSetFromProj4,,AC_MSG_ERROR(['libgeotiff' [>= v.1.2.5] is required but it doesn't seems to be installed on this system.]),-lm)
122
123PKG_CHECK_MODULES([LIBPNG], [libpng], , AC_MSG_ERROR(['libpng' is required but it doesn't seems to be installed on this system.]))
124AC_SUBST(LIBPNG_CFLAGS)
125AC_SUBST(LIBPNG_LIBS)
126
127PKG_CHECK_MODULES([LIBWEBP], [libwebp], , AC_MSG_ERROR(['libwebp' is required but it doesn't seems to be installed on this system.]))
128AC_SUBST(LIBWEBP_CFLAGS)
129AC_SUBST(LIBWEBP_LIBS)
130
131PKG_CHECK_MODULES([LIBLZMA], [liblzma], , AC_MSG_ERROR(['liblzma' is required but it doesn't seems to be installed on this system.]))
132AC_SUBST(LIBLZMA_CFLAGS)
133AC_SUBST(LIBLZMA_LIBS)
134
135PKG_CHECK_MODULES([LIBSPATIALITE], [spatialite], , AC_MSG_ERROR(['libspatialite' is required but it doesn't seem to be installed on this system.]))
136AC_SUBST(LIBSPATIALITE_CFLAGS)
137AC_SUBST(LIBSPATIALITE_LIBS)
138
139PKG_CHECK_MODULES([LIBCAIRO], [cairo], , AC_MSG_ERROR(['libcairo' is required but it doesn't seems to be installed on this system.]))
140AC_SUBST(LIBCAIRO_CFLAGS)
141AC_SUBST(LIBCAIRO_LIBS)
142
143PKG_CHECK_MODULES([LIBCURL], [libcurl], , AC_MSG_ERROR(['libcurl' is required but it doesn't seem to be installed on this system.]))
144AC_SUBST(LIBCURL_CFLAGS)
145AC_SUBST(LIBCURL_LIBS)
146
147PKG_CHECK_MODULES([LIBXML2], [libxml-2.0], , AC_MSG_ERROR(['libxml2' is required but it doesn't seem to be installed on this system.]))
148AC_SUBST(LIBXML2_CFLAGS)
149AC_SUBST(LIBXML2_LIBS)
150
151# Checking for MinGW
152AM_CONDITIONAL([MINGW], [test "$target_alias" = "mingw32"])
153
154AC_OUTPUT
155