File: configure.ac

package info (click to toggle)
librttopo 1.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, sid, stretch
  • size: 1,732 kB
  • ctags: 1,648
  • sloc: ansic: 31,501; sh: 77; makefile: 54
file content (128 lines) | stat: -rw-r--r-- 4,849 bytes parent folder | download
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ(2.61)
AC_INIT(librttopo, 1.0.0, strk@kbt.io)
AC_LANG(C)
AC_CONFIG_MACRO_DIR([m4])

AM_INIT_AUTOMAKE([foreign])
AM_MAINTAINER_MODE
AM_CONFIG_HEADER(src/rttopo_config.h)

# disabling debug support
AH_TEMPLATE([NDEBUG],
            [Must be defined in order to disable debug mode.])
AC_DEFINE(NDEBUG)
AH_TEMPLATE([LIBRTGEOM_VERSION],
            [RTTOPO library version.])
AC_DEFINE_UNQUOTED([LIBRTGEOM_VERSION], ["$VERSION"], [rtgeom version])
AC_SUBST([LIBRTGEOM_VERSION])
AH_TEMPLATE([RTGEOM_GEOS_VERSION],
            [RTTOPO GEOS version.])
AH_TEMPLATE([RTGEOM_DEBUG_LEVEL],
            [RTGEOM Debug Level.])
AC_DEFINE(RTGEOM_DEBUG_LEVEL)
AC_DEFINE_UNQUOTED([RTGEOM_DEBUG_LEVEL], [0], [debug level])

# Checks for header files.
AC_CHECK_HEADERS(stdlib.h,, [AC_MSG_ERROR([cannot find stdlib.h, bailing out])])
AC_CHECK_HEADERS(stdio.h,, [AC_MSG_ERROR([cannot find stdio.h, bailing out])])
AC_CHECK_HEADERS(string.h,, [AC_MSG_ERROR([cannot find string.h, bailing out])])
AC_CHECK_HEADERS(math.h,, [AC_MSG_ERROR([cannot find math.h, bailing out])])
AC_CHECK_HEADERS(float.h,, [AC_MSG_ERROR([cannot find float.h, bailing out])])
AC_CHECK_HEADERS(inttypes.h,, [AC_MSG_ERROR([cannot find inttypes.h, bailing out])])
AC_CHECK_HEADERS(stdint.h,, [AC_MSG_ERROR([cannot find stdint.h, bailing out])])
AC_CHECK_HEADERS(ctype.h,, [AC_MSG_ERROR([cannot find ctype.h, bailing out])])
AC_CHECK_HEADERS(errno.h,, [AC_MSG_ERROR([cannot find errno.h, bailing out])])
AC_CHECK_HEADERS(assert.h,, [AC_MSG_ERROR([cannot find assert.h, bailing out])])
AC_CHECK_HEADERS(stdarg.h,, [AC_MSG_ERROR([cannot find stdarg.h, bailing out])])


# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_LIBTOOL_WIN32_DLL
AC_PROG_LIBTOOL

# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_STRUCT_TM
AC_C_VOLATILE

# Checks for library functions.
AC_FUNC_LSTAT
AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
AC_FUNC_MEMCMP
AC_FUNC_STAT
AC_FUNC_STRFTIME
AC_CHECK_FUNCS([memset sqrt strcasecmp strerror strncasecmp strstr fdatasync ftruncate getcwd gettimeofday localtime_r memmove strerror])

AC_CONFIG_FILES([Makefile \
		src/Makefile \
		headers/Makefile \
		headers/librttopo_geom.h \
		rttopo.pc])

#-----------------------------------------------------------------------
#   --with-geosconfig
#
AC_ARG_WITH([geosconfig],
    [AS_HELP_STRING([--with-geosconfig=FILE], [specify an alternative geos-config file])],
	[GEOSCONFIG="$withval"], [GEOSCONFIG=""])
if test "x$GEOSCONFIG" = "x"; then
    # GEOSCONFIG was not specified, so search within the current path
    AC_PATH_PROG([GEOSCONFIG], [geos-config])
    # If we couldn't find geos-config, display an error
    if test "x$GEOSCONFIG" = "x"; then
            AC_MSG_ERROR([could not find geos-config within the current path. You may need to try re-running configure with a --with-geosconfig parameter.])
    fi
else
    # GEOSCONFIG was specified; display a message to the user
    if test "x$GEOSCONFIG" = "xyes"; then
            AC_MSG_ERROR([you must specify a parameter to --with-geosconfig, e.g. --with-geosconfig=/path/to/geos-config])
    else
            if test -f $GEOSCONFIG; then
                    AC_MSG_RESULT([Using user-specified geos-config file: $GEOSCONFIG])
            else
                    AC_MSG_ERROR([the user-specified geos-config file $GEOSCONFIG does not exist])
            fi
    fi
fi
# Extract the linker and include flags
GEOS_LDFLAGS=`$GEOSCONFIG --ldflags`
GEOS_CFLAGS=-I`$GEOSCONFIG --includes`
AC_SUBST([GEOS_LDFLAGS])
AC_SUBST([GEOS_CFLAGS])
# Ensure that we can parse geos_c.h
CPPFLAGS_SAVE="$CPPFLAGS"
CPPFLAGS="$GEOS_CFLAGS"
AC_CHECK_HEADERS([geos_c.h],, [AC_MSG_ERROR([could not find geos_c.h - you may need to specify the directory of a geos-config file using --with-geosconfig])])
CPPFLAGS="$CPPFLAGS_SAVE"
# Ensure we can link against libgeos_c
LIBS_SAVE="$LIBS"
LIBS="$GEOS_LDFLAGS"
AC_SEARCH_LIBS(GEOSContext_setErrorMessageHandler_r,geos_c,,AC_MSG_ERROR([could not find libgeos_c (or obsolete 'libgeos_c' < v.3.5.0 found) - you may need to specify the directory of a geos-config file using --with-geosconfig]))
LIBS="$LIBS_SAVE"
LIBS="$LIBS $GEOS_LDFLAGS -lgeos_c"
GEOS_MAJOR_VERSION=`$GEOSCONFIG --version | cut -d. -f1 | sed 's/[[^0-9]]//g'`
GEOS_MINOR_VERSION=`$GEOSCONFIG --version | cut -d. -f2 | sed 's/[[^0-9]]//g'`
RTGEOM_GEOS_VERSION="$GEOS_MAJOR_VERSION$GEOS_MINOR_VERSION"
AC_DEFINE_UNQUOTED([RTGEOM_GEOS_VERSION], [$RTGEOM_GEOS_VERSION], [GEOS library version])
AC_SUBST([RTGEOM_GEOS_VERSION])

# SRID stuff
SRID_MAX=999999
SRID_USR_MAX=998999
AC_SUBST([SRID_MAX])
AC_SUBST([SRID_USR_MAX])

AC_OUTPUT