1# -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
4AC_PREREQ(2.59)
5
6m4_define([sidx_version_major], [1])
7m4_define([sidx_version_minor], [8])
8m4_define([sidx_version_micro], [5])
9m4_define([sidx_version],
10          [sidx_version_major.sidx_version_minor.sidx_version_micro])
11
12AC_INIT([spatialindex], [sidx_version], [mhadji@gmail.com], [spatialindex-src])
13AC_CANONICAL_BUILD
14AC_CONFIG_MACRO_DIR([m4])
15
16debug_default="no"
17
18CFLAGS="-Wall -Wno-long-long -pedantic $CFLAGS"
19CXXFLAGS="-Wall -Wno-long-long -pedantic -std=c++98 $CXXFLAGS"
20
21# Checks for programs.
22AC_PROG_CXX
23AC_PROG_CXXCPP
24AC_PROG_INSTALL
25AC_PROG_LN_S
26AC_PROG_MAKE_SET
27AC_PROG_LIBTOOL
28AM_INIT_AUTOMAKE([dist-bzip2 subdir-objects])
29
30# Checks for header files.
31AC_CHECK_HEADERS(fcntl.h,, [AC_MSG_ERROR([cannot find fcntl.h, bailing out])])
32AC_CHECK_HEADERS(unistd.h,, [AC_MSG_ERROR([cannot find unistd.h, bailing out])])
33AC_CHECK_HEADERS(sys/types.h,, [AC_MSG_ERROR([cannot find sys/types.h, bailing out])])
34AC_CHECK_HEADERS(sys/stat.h,, [AC_MSG_ERROR([cannot find sys/stat.h, bailing out])])
35
36AC_CHECK_HEADERS(pthread.h, [
37#ifndef ANDROID
38LIBS="$LIBS -lpthread"
39#endif])
40
41AC_CHECK_HEADERS(sys/resource.h,, [AC_MSG_ERROR([cannot find sys/resource.h, bailing out])])
42AC_CHECK_HEADERS(sys/time.h,, [AC_MSG_ERROR([cannot find sys/time.h, bailing out])])
43AC_CHECK_HEADERS(stdint.h,, [AC_MSG_ERROR([cannot find stdint.h, bailing out])])
44AC_CHECK_HEADERS(features.h)
45
46#MH_CXX_HEADER_TOOLS
47
48LIBS="$LIBS"
49
50AC_ARG_ENABLE(debug, [  --enable-debug=[no/yes] turn on debugging [default=$debug_default]],, enable_debug=$debug_default)
51
52if test "x$enable_debug" = "xyes"; then
53	CXXFLAGS="$CXXFLAGS -g -DDEBUG"
54	AC_MSG_RESULT(checking wether debug information is enabled... yes)
55else
56	CXXFLAGS="$CXXFLAGS -O2 -DNDEBUG"
57	AC_MSG_RESULT(checking wether debug information is enabled... no)
58fi
59
60# Checks for library functions.
61AC_CHECK_FUNCS([gettimeofday memset memcpy bcopy srand48])
62
63AM_CONDITIONAL([RAND_IS_CONFIG], [test "x$HAVE_SRAND48" = xtrue])
64
65AC_CONFIG_FILES([	Makefile
66					include/Makefile
67					src/Makefile
68					src/libspatialindex.pc
69					src/capi/Makefile
70					src/spatialindex/Makefile
71					src/storagemanager/Makefile
72					src/rtree/Makefile
73					src/mvrtree/Makefile
74					src/tprtree/Makefile
75		 			src/tools/Makefile
76		 			test/Makefile
77					test/geometry/Makefile
78					test/rtree/Makefile
79					test/mvrtree/Makefile
80					test/tprtree/Makefile])
81
82AC_OUTPUT
83
84