3
dnl This is main autoconf bootstrap script of libLAS project.
5
m4_define([liblas_version_major], [1])
6
m4_define([liblas_version_minor], [2])
7
m4_define([liblas_version_micro], [1])
8
m4_define([liblas_version],
9
[liblas_version_major.liblas_version_minor.liblas_version_micro])
12
AC_INIT([las], [liblas_version], [hobu.inc@gmail.com],[liblas-src])
15
RELEASE_VERSION=liblas_version
16
AC_SUBST([RELEASE_VERSION])
18
dnl #########################################################################
19
dnl Default compilation flags
20
dnl #########################################################################
22
m4_define([debug_default],[no])
24
CFLAGS="-Wall -Wno-long-long -pedantic $CFLAGS"
25
CXXFLAGS="-Wall -Wno-long-long -pedantic -std=c++98 $CXXFLAGS"
27
dnl #########################################################################
28
dnl Checks for programs.
29
dnl #########################################################################
31
AM_INIT_AUTOMAKE([dist-bzip2])
39
dnl #########################################################################
40
dnl Check platform endianness
41
dnl #########################################################################
45
dnl #########################################################################
46
dnl Checks for header files.
47
dnl #########################################################################
49
AC_CHECK_HEADERS([string.h],, [AC_MSG_ERROR([cannot find string.h, bailing out])])
50
AC_CHECK_HEADERS([stdio.h],, [AC_MSG_ERROR([cannot find stdio.h, bailing out])])
51
AC_CHECK_HEADERS([stdlib.h],, [AC_MSG_ERROR([cannot find stdlib.h, bailing out])])
57
dnl #########################################################################
58
dnl Build mode configuration (debug/optimized)
59
dnl #########################################################################
61
AC_ARG_ENABLE([debug],
62
AC_HELP_STRING([--enable-debug=ARG], [Enable debug compilation mode @<:@yes|no@:>@, default=debug_default]),,)
64
AC_MSG_CHECKING([for debug enabled])
66
if test "x$enable_debug" = "xyes"; then
67
CFLAGS="$CFLAGS -g -DDEBUG"
68
CXXFLAGS="$CXXFLAGS -g -DDEBUG"
71
CFLAGS="$CFLAGS -O3 -DNDEBUG"
72
CXXFLAGS="$CXXFLAGS -O3 -DNDEBUG"
76
dnl #########################################################################
77
dnl Definition of custom Autoconf macros
78
dnl #########################################################################
84
AC_DEFUN([AC_HAVE_LONG_LONG],
86
AC_MSG_CHECKING([for 64bit integer type])
88
echo 'int main() { long long off=0; }' >> conftest.c
89
if test -z "`${CC} -o conftest conftest.c 2>&1`" ; then
90
AC_DEFINE(HAVE_LONG_LONG, 1, [Define to 1, if your compiler supports long long data type])
91
AC_MSG_RESULT([long long])
105
USE_GDAL_SOURCE_TREE="no"
107
dnl #########################################################################
108
dnl Determine GDAL Support
109
dnl #########################################################################
112
AC_HELP_STRING([--with-gdal=ARG], [Path to gdal-config]),,)
113
AC_MSG_CHECKING([for GDAL])
115
if test "$with_gdal" = "no" -o "$with_gdal" = "" ; then
119
dnl Check if full path to gdal-config provided
120
if test "`basename xx/$with_gdal`" = "gdal-config" ; then
121
AC_MSG_RESULT([GDAL enabled with provided gdal-config])
122
GDAL_CONFIG="$with_gdal"
123
elif test -f ${with_gdal}/frmts/gtiff/libgeotiff/geotiff.h; then
124
GDAL_INC="-I$with_gdal/port -I$with_gdal/ogr -I$with_gdal/alg -I$with_gdal/frmts"
125
GDAL_PREFIX="$with_gdal"
130
USE_GDAL_SOURCE_TREE="yes"
131
LIBS="-L${with_gdal}/.libs -lgdal -L${with_gdal}/ -lgdal $LIBS"
132
AC_MSG_RESULT([GDAL and GeoTIFF enabled with provided GDAL source tree])
134
dnl --with-gdal=yes given, so try to find gdal-config in PATH
135
GDAL_CONFIG_TMP=`which gdal-config`
136
if test "`basename xx/${GDAL_CONFIG_TMP}`" = "gdal-config" ; then
137
AC_MSG_RESULT([GDAL enabled with gdal-config found in PATH])
138
GDAL_CONFIG=${GDAL_CONFIG_TMP}
140
AC_MSG_ERROR([--with-gdal should be yes, a path to gdal-config, or a path to GDAL's source tree])
145
if test "$GDAL_CONFIG" != "no" ; then
147
dnl if we are already yes, we don't need to run gdal-config
148
if test "$GDAL_CONFIG" != "yes" ; then
150
GDAL_VERSION=`$GDAL_CONFIG --version`
151
AC_MSG_RESULT([$GDAL_CONFIG reports version $GDAL_VERSION])
152
LIBS="`$GDAL_CONFIG --libs` $LIBS"
153
GDAL_INC=`$GDAL_CONFIG --cflags`
154
GDAL_PREFIX=`$GDAL_CONFIG --prefix`
155
OGR=`$GDAL_CONFIG --ogr-enabled`
156
if test "$OGR" != "yes" ; then
157
AC_MSG_ERROR([$GDAL_CONFIG says OGR is not enabled])
164
AC_SUBST([GDAL_PREFIX])
165
AM_CONDITIONAL([GDAL_IS_CONFIG], [test ! x$GDAL_CONFIG = xno])
167
dnl #########################################################################
168
dnl Determine GeoTIFF Support
169
dnl #########################################################################
171
AC_ARG_WITH([geotiff],
172
AC_HELP_STRING([--with-geotiff=ARG], [libgeotiff library to use (no or path)]),,)
174
if test "$with_geotiff" != "no" -a "$with_geotiff" != "" -a "${GEOTIFF_CONFIG}" != "yes" ; then
175
dnl We now require libgeotiff 1.2.5 (for ST_Create the simpletags stuff).
176
dnl first check if $with_geotiff/lib has the library:
177
AC_CHECK_LIB([geotiff], [ST_Create],
178
[GEOTIFF_CONFIG=external], [GEOTIFF_CONFIG=no],
179
[-L$with_geotiff/lib])
182
if test "${GEOTIFF_CONFIG}" != "no" ; then
183
dnl libgeotiff 1.2.5, is first version with geo_simpletags.h
184
AC_MSG_CHECKING([for geo_simpletags.h of libgeotiff >= 1.2.5])
185
if test -f ${with_geotiff}/include/geo_simpletags.h ; then
186
GEOTIFF_INC="-I$with_geotiff/include"
188
elif test -f ${with_geotiff}/include/geotiff/geo_simpletags.h ; then
189
GEOTIFF_INC="-I$with_geotiff/include/geotiff"
191
elif test -f ${with_gdal}/frmts/gtiff/libgeotiff/geo_simpletags.h ; then
192
GEOTIFF_INC="-I$with_gdal/frmts/gtiff/libgeotiff/ -I$with_gdal/frmts/gtiff/libtiff"
193
AC_MSG_RESULT([yes, from GDAL])
200
AC_MSG_CHECKING([for libgeotiff])
201
if test "${GEOTIFF_CONFIG}" = "no" ; then
205
if test "${USE_GDAL_SOURCE_TREE}" != "yes" ; then
206
LIBS="-L$with_geotiff/lib -lgeotiff $LIBS"
210
AC_MSG_RESULT([use GDAL source])
214
AC_SUBST([GEOTIFF_INC])
215
AC_SUBST([GEOTIFF_PREFIX])
216
AM_CONDITIONAL([GEOTIFF_IS_CONFIG], [test ! x$GEOTIFF_CONFIG = xno])
218
dnl #########################################################################
219
dnl If GDAL was requested, but geotiff is not configured, complain
220
dnl #########################################################################
222
if test "${HAVE_GDAL}" != "no" ; then
223
if test "${GEOTIFF_CONFIG}" = "no" -a "${USE_GDAL_SOURCE_TREE}" != "yes"; then
224
AC_MSG_ERROR([You must configure a libgeotiff if you are using GDAL binaries. You can configure using a GDAL source tree without libgeotiff, but not from binaries.])
228
dnl #########################################################################
229
dnl Determine other features of compiler
230
dnl #########################################################################
234
dnl #########################################################################
235
dnl Checks for library functions.
236
dnl #########################################################################
238
AC_CHECK_FUNCS([gettimeofday bzero memset memcpy bcopy])
240
dnl #########################################################################
241
dnl Generate makefiles
242
dnl #########################################################################
256
dnl #########################################################################
257
dnl Print configuration summary
258
dnl #########################################################################
261
LOC_MSG([libLAS configuration summary:])
263
LOC_MSG([ Version..................: ${RELEASE_VERSION}])
264
LOC_MSG([ Installation directory...: ${prefix}])
265
LOC_MSG([ C compiler...............: ${CC} ${CFLAGS}])
266
LOC_MSG([ C++ compiler.............: ${CXX} ${CXXFLAGS}])
267
LOC_MSG([ Debugging support........: ${enable_debug}])
268
LOC_MSG([ GDAL support.............: ${HAVE_GDAL}])
269
if test "${HAVE_GDAL}" != "no" ; then
270
LOC_MSG([ - gdal-config...........: ${GDAL_CONFIG}])
271
if test -n "${GDAL_INC}" ; then
272
LOC_MSG([ - INCLUDE directories...: ${GDAL_INC}])
275
LOC_MSG([ GeoTIFF SRS support......: ${HAVE_GEOTIFF}])
276
if test "${HAVE_GEOTIFF}" != "no" ; then
277
LOC_MSG([ - libgeotiff............: ${GEOTIFF_CONFIG}])
278
if test -n "${GEOTIFF_INC}" ; then
279
LOC_MSG([ - INCLUDE directories...: ${GEOTIFF_INC}])
283
LOC_MSG([ LIBS.....................: ${LIBS}])
285
LOC_MSG([ libLAS - http://liblas.org])