1dnl *************************************************************************** 2dnl $Id$ 3dnl 4dnl Project: GDAL 5dnl Purpose: Configure source file. 6dnl Author: Frank Warmerdam, warmerdam@pobox.com 7dnl 8dnl *************************************************************************** 9dnl Copyright (c) 2000, Frank Warmerdam 10dnl 11dnl Permission is hereby granted, free of charge, to any person obtaining a 12dnl copy of this software and associated documentation files (the "Software"), 13dnl to deal in the Software without restriction, including without limitation 14dnl the rights to use, copy, modify, merge, publish, distribute, sublicense, 15dnl and/or sell copies of the Software, and to permit persons to whom the 16dnl Software is furnished to do so, subject to the following conditions: 17dnl 18dnl The above copyright notice and this permission notice shall be included 19dnl in all copies or substantial portions of the Software. 20dnl 21dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 22dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23dnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 24dnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25dnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26dnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 27dnl DEALINGS IN THE SOFTWARE. 28dnl *************************************************************************** 29 30dnl Disable configure caching ... it causes lots of hassles. 31define([AC_CACHE_LOAD], ) 32define([AC_CACHE_SAVE], ) 33 34dnl Process this file with autoconf to produce a configure script. 35AC_INIT(GDALmake.opt.in) 36AC_SUBST(PACKAGE, gdal) 37AC_CONFIG_MACRO_DIR(m4) 38AC_CONFIG_HEADERS([port/cpl_config.h:port/cpl_config.h.in]) 39AH_BOTTOM([#include "cpl_config_extras.h"]) 40 41dnl We require autoconf 2.52+ for libtool support on cygwin/mingw hosts 42AC_PREREQ(2.52) 43 44dnl Compute the canonical host-system (the system we are building for) 45dnl type variable $host 46AC_CANONICAL_HOST 47 48dnl Enable as much warnings as possible 49AX_CFLAGS_WARN_ALL(C_WFLAGS) 50AX_CXXFLAGS_WARN_ALL(CXX_WFLAGS) 51 52dnl Remove -Wdeclaration-after-statement that is no longer appropriate in C99 53C_WFLAGS=`echo "$C_WFLAGS " | sed "s/-Wdeclaration-after-statement //"` 54 55dnl For ICC: it needs -we10006 instead of -Werror to turn unknown options to errors 56dnl Some gcc/clang versions might succeed on this test, so also include -Werror in ERROR_ON_UNKNOWN_OPTIONS 57AX_CHECK_COMPILE_FLAG([-Werror -we10006],[ERROR_ON_UNKNOWN_OPTIONS="-Werror -we10006"],[ERROR_ON_UNKNOWN_OPTIONS="-Werror"]) 58 59dnl A few ICC warnings to turn off 60dnl warning #188: enumerated type mixed with another type (needed on libcsf) 61dnl warning #1684: conversion from pointer to same-sized integral type (potential portability problem) (needed on frmts/mrf) 62dnl warning #2259: non-pointer conversion from "size_t={unsigned long}" to "int" may lose significant bits 63dnl warning #2304: non-explicit constructor with single argument may cause implicit type conversion 64dnl warning #3280: declaration hides member 65dnl remark #11074: Inlining inhibited by limit max-size 66dnl remark #11076: To get full report use -qopt-report=4 -qopt-report-phase ipo 67AX_CHECK_COMPILE_FLAG([-diag-disable 188,1684,2259,2304,3280,11074,11076],[C_WFLAGS="$C_WFLAGS -diag-disable 188,1684,2259,2304,3280,11074,11076" CXX_WFLAGS="$CXX_WFLAGS -diag-disable 188,1684,2259,2304,3280,11074,11076"],,[$ERROR_ON_UNKNOWN_OPTIONS]) 68 69AX_CHECK_COMPILE_FLAG([-Wextra],[C_WFLAGS="$C_WFLAGS -Wextra" CXX_WFLAGS="$CXX_WFLAGS -Wextra"],,[$ERROR_ON_UNKNOWN_OPTIONS]) 70AX_CHECK_COMPILE_FLAG([-Winit-self],[C_WFLAGS="$C_WFLAGS -Winit-self" CXX_WFLAGS="$CXX_WFLAGS -Winit-self"],,[$ERROR_ON_UNKNOWN_OPTIONS]) 71AX_CHECK_COMPILE_FLAG([-Wunused-parameter], [C_WFLAGS="$C_WFLAGS -Wunused-parameter" CXX_WFLAGS="$CXX_WFLAGS -Wunused-parameter" NO_UNUSED_PARAMETER_FLAG="-Wno-unused-parameter"],,[$ERROR_ON_UNKNOWN_OPTIONS]) 72AX_CHECK_COMPILE_FLAG([-Wmissing-prototypes], [C_WFLAGS="$C_WFLAGS -Wmissing-prototypes"],,[$ERROR_ON_UNKNOWN_OPTIONS]) 73AX_CHECK_COMPILE_FLAG([-Wmissing-declarations], [C_WFLAGS="$C_WFLAGS -Wmissing-declarations"],,[$ERROR_ON_UNKNOWN_OPTIONS]) 74AX_CHECK_COMPILE_FLAG([-Wformat], [C_WFLAGS="$C_WFLAGS -Wformat" CXX_WFLAGS="$CXX_WFLAGS -Wformat"],,[$ERROR_ON_UNKNOWN_OPTIONS]) 75AX_CHECK_COMPILE_FLAG([-Wformat -Werror=format-security -Wno-format-nonliteral], [C_WFLAGS="$C_WFLAGS -Werror=format-security -Wno-format-nonliteral" CXX_WFLAGS="$CXX_WFLAGS -Werror=format-security -Wno-format-nonliteral"],,[$ERROR_ON_UNKNOWN_OPTIONS]) 76AX_CHECK_COMPILE_FLAG([-Wshorten-64-to-32], [C_WFLAGS="$C_WFLAGS -Wshorten-64-to-32" CXX_WFLAGS="$CXX_WFLAGS -Wshorten-64-to-32"],,[$ERROR_ON_UNKNOWN_OPTIONS]) 77AX_CHECK_COMPILE_FLAG([-Wlogical-op], [C_WFLAGS="$C_WFLAGS -Wlogical-op" CXX_WFLAGS="$CXX_WFLAGS -Wlogical-op" NO_LOGICAL_OP_FLAG="-Wno-logical-op"],,[$ERROR_ON_UNKNOWN_OPTIONS]) 78AX_CHECK_COMPILE_FLAG([-Wshadow], [C_WFLAGS="$C_WFLAGS -Wshadow" CXX_WFLAGS="$CXX_WFLAGS -Wshadow"],,[$ERROR_ON_UNKNOWN_OPTIONS]) 79AX_CHECK_COMPILE_FLAG([-Wmissing-include-dirs], [C_WFLAGS="$C_WFLAGS -Wmissing-include-dirs" CXX_WFLAGS="$CXX_WFLAGS -Wmissing-include-dirs"],,[$ERROR_ON_UNKNOWN_OPTIONS]) 80 81dnl Error out on things that will fail with MSVC 82AX_CHECK_COMPILE_FLAG([-Werror=vla], [C_WFLAGS="$C_WFLAGS -Werror=vla" CXX_WFLAGS="$CXX_WFLAGS -Werror=vla"],,[$ERROR_ON_UNKNOWN_OPTIONS]) 83 84dnl -Wclobbered is not reliable on most gcc versions 85dnl AX_CHECK_COMPILE_FLAG([-Wno-clobbered], [C_WFLAGS="$C_WFLAGS -Wno-clobbered" CXX_WFLAGS="$CXX_WFLAGS -Wno-clobbered"],,[$ERROR_ON_UNKNOWN_OPTIONS]) 86 87dnl Warn when macros __TIME__, __DATE__ or __TIMESTAMP__ are encountered as they might prevent bit-wise-identical reproducible compilations. 88AX_CHECK_COMPILE_FLAG([-Wdate-time], [C_WFLAGS="$C_WFLAGS -Wdate-time" CXX_WFLAGS="$CXX_WFLAGS -Wdate-time"],,[$ERROR_ON_UNKNOWN_OPTIONS]) 89 90dnl GCC 6 warnings 91AX_CHECK_COMPILE_FLAG([-Wnull-dereference], [C_WFLAGS="$C_WFLAGS -Wnull-dereference" CXX_WFLAGS="$CXX_WFLAGS -Wnull-dereference"],,[$ERROR_ON_UNKNOWN_OPTIONS]) 92AX_CHECK_COMPILE_FLAG([-Wduplicated-cond], [C_WFLAGS="$C_WFLAGS -Wduplicated-cond" CXX_WFLAGS="$CXX_WFLAGS -Wduplicated-cond"],,[$ERROR_ON_UNKNOWN_OPTIONS]) 93 94dnl GCC 7 warnings 95dnl Do not enable yet. Causes warning in alg/gdalthinplate.cpp due to armadillo templates 96dnl AX_CHECK_COMPILE_FLAG([-Wduplicated-branches], [C_WFLAGS="$C_WFLAGS -Wduplicated-branches" CXX_WFLAGS="$CXX_WFLAGS -Wduplicated-branches"],,[$ERROR_ON_UNKNOWN_OPTIONS]) 97 98dnl GCC 8 warnings 99AC_LANG_PUSH([C++]) 100AX_CHECK_COMPILE_FLAG([-Wextra-semi], [CXX_WFLAGS="$CXX_WFLAGS -Wextra-semi"],,[$ERROR_ON_UNKNOWN_OPTIONS]) 101AC_LANG_POP([C++]) 102 103AX_CHECK_COMPILE_FLAG([-Wno-sign-compare], [NO_SIGN_COMPARE="-Wno-sign-compare"],,[$ERROR_ON_UNKNOWN_OPTIONS]) 104 105dnl clang >= 3.9 106AX_CHECK_COMPILE_FLAG([-Wcomma], [C_WFLAGS="$C_WFLAGS -Wcomma" CXX_WFLAGS="$CXX_WFLAGS -Wcomma"],,[$ERROR_ON_UNKNOWN_OPTIONS]) 107 108dnl clang and gcc 5 109AX_CHECK_COMPILE_FLAG([-Wfloat-conversion], [C_WFLAGS="$C_WFLAGS -Wfloat-conversion" CXX_WFLAGS="$CXX_WFLAGS -Wfloat-conversion"],,[$ERROR_ON_UNKNOWN_OPTIONS]) 110 111dnl clang >= 3.2 112AX_CHECK_COMPILE_FLAG([-Wdocumentation -Wno-documentation-deprecated-sync], [C_WFLAGS="$C_WFLAGS -Wdocumentation -Wno-documentation-deprecated-sync" CXX_WFLAGS="$CXX_WFLAGS -Wdocumentation -Wno-documentation-deprecated-sync"],,[$ERROR_ON_UNKNOWN_OPTIONS]) 113 114dnl C++ specific stuff 115 116AC_LANG_PUSH([C++]) 117AX_CHECK_COMPILE_FLAG([-Wunused-private-field], [CXX_WFLAGS="$CXX_WFLAGS -Wunused-private-field"],,[$ERROR_ON_UNKNOWN_OPTIONS]) 118AX_CHECK_COMPILE_FLAG([-Wmissing-declarations], [CXX_WFLAGS="$CXX_WFLAGS -Wmissing-declarations"],,[$ERROR_ON_UNKNOWN_OPTIONS]) 119AX_CHECK_COMPILE_FLAG([-Wnon-virtual-dtor], [CXX_WFLAGS="$CXX_WFLAGS -Wnon-virtual-dtor" NO_NON_VIRTUAL_DTOR_FLAG="-Wno-non-virtual-dtor"],,[$ERROR_ON_UNKNOWN_OPTIONS]) 120AX_CHECK_COMPILE_FLAG([-Wold-style-cast], [WARN_OLD_STYLE_CAST="-Wold-style-cast"],,[$ERROR_ON_UNKNOWN_OPTIONS]) 121AX_CHECK_COMPILE_FLAG([-Weffc++], [WARN_EFFCPLUSPLUS="-Weffc++"],,[$ERROR_ON_UNKNOWN_OPTIONS]) 122 123dnl g++-4.8 complain a bit too much with -Weffc++ 124if test "$WARN_EFFCPLUSPLUS" != ""; then 125 SAVED_CXXFLAGS=$CXXFLAGS 126 CXXFLAGS="$CXXFLAGS $WARN_EFFCPLUSPLUS -Werror" 127 AC_MSG_CHECKING([if -Weffc++ should be enabled]) 128 AC_COMPILE_IFELSE([AC_LANG_PROGRAM( 129 [[ 130 class Base {}; 131 class A: public Base {}; 132 ]])], 133 [AC_MSG_RESULT([yes])], 134 [WARN_EFFCPLUSPLUS=""] 135 [AC_MSG_RESULT([no])]) 136 CXXFLAGS=$SAVED_CXXFLAGS 137fi 138 139dnl Clang enables -Woverloaded-virtual if -Wall is defined, but not GCC 140AX_CHECK_COMPILE_FLAG([-Woverloaded-virtual], [CXX_WFLAGS="$CXX_WFLAGS -Woverloaded-virtual"],,[$ERROR_ON_UNKNOWN_OPTIONS]) 141 142dnl Forbid use of 'or', 'and', ... alias operators 143AX_CHECK_COMPILE_FLAG([-fno-operator-names], [CXX_WFLAGS="$CXX_WFLAGS -fno-operator-names"],,[$ERROR_ON_UNKNOWN_OPTIONS]) 144 145HAVE_GCC_WARNING_ZERO_AS_NULL_POINTER_CONSTANT=no 146AX_CHECK_COMPILE_FLAG([-Wzero-as-null-pointer-constant], [CXX_WFLAGS="$CXX_WFLAGS -Wzero-as-null-pointer-constant" HAVE_GCC_WARNING_ZERO_AS_NULL_POINTER_CONSTANT=yes],,[$ERROR_ON_UNKNOWN_OPTIONS]) 147if test "$HAVE_GCC_WARNING_ZERO_AS_NULL_POINTER_CONSTANT" = "yes"; then 148AC_DEFINE_UNQUOTED(HAVE_GCC_WARNING_ZERO_AS_NULL_POINTER_CONSTANT, 1, 149 [Define to 1 if the compiler supports -Wzero-as-null-pointer-constant]) 150fi 151 152AC_LANG_POP([C++]) 153 154CXX14_SUPPORT=no 155AC_ARG_WITH([cpp14], 156 AS_HELP_STRING([--with-cpp14], 157 [Enable C++14 compiler options]),,) 158 159AC_MSG_CHECKING([if use C++14 compiler options]) 160if test "$with_cpp14" = "yes"; then 161 dnl Check C++ compiler compatibility with C++14 162 AC_MSG_CHECKING([C++ compiler compatibility with C++14]) 163 AX_CXX_COMPILE_STDCXX([14],[noext],[optional]) 164 165 if [test "$HAVE_CXX14" = "1"]; then 166 CXX14_SUPPORT=yes 167 fi 168 AC_MSG_RESULT([enabled]) 169else 170 AC_MSG_RESULT([disabled by user]) 171fi 172AC_SUBST(CXX14_SUPPORT,$CXX14_SUPPORT) 173 174if [test "$CXX14_SUPPORT" = "no"]; then 175 AX_CXX_COMPILE_STDCXX_11([noext],[mandatory]) 176fi 177 178dnl Available in GCC 5.1 179AC_LANG_PUSH([C++]) 180 AX_CHECK_COMPILE_FLAG([-Wsuggest-override], [CXX_WFLAGS="$CXX_WFLAGS -Wsuggest-override"],,[$ERROR_ON_UNKNOWN_OPTIONS]) 181AC_LANG_POP([C++]) 182 183dnl Enable -Wimplicit-fallthrough only if C++11 is enabled since CPL_FALLTHROUGH is only active then 184AC_LANG_PUSH([C++]) 185SAVED_CXXFLAGS=$CXXFLAGS 186CXXFLAGS="$CXXFLAGS $ERROR_ON_UNKNOWN_OPTIONS -Wimplicit-fallthrough" 187AC_MSG_CHECKING([if -Wimplicit-fallthrough can be enabled]) 188AC_COMPILE_IFELSE([AC_LANG_PROGRAM( 189 [[#if !(__cplusplus >= 201103L && ( (defined(__clang__) && (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >=7))) || ((defined(__GNUC__) && __GNUC__ >= 7)) ) ) 190 #error "not (C++11 and (clang >= 3.7 or gcc >= 7))" 191 #endif]])], 192 [CXX_WFLAGS="$CXX_WFLAGS -Wimplicit-fallthrough"] 193 [AC_MSG_RESULT([yes])], 194 [AC_MSG_RESULT([no])]) 195CXXFLAGS=$SAVED_CXXFLAGS 196AC_LANG_POP([C++]) 197 198AC_SUBST(CXX_WFLAGS,$CXX_WFLAGS) 199AC_SUBST(C_WFLAGS,$C_WFLAGS) 200AC_SUBST(NO_UNUSED_PARAMETER_FLAG,$NO_UNUSED_PARAMETER_FLAG) 201AC_SUBST(NO_SIGN_COMPARE,$NO_SIGN_COMPARE) 202AC_SUBST(NO_NON_VIRTUAL_DTOR_FLAG,$NO_NON_VIRTUAL_DTOR_FLAG) 203AC_SUBST(NO_LOGICAL_OP_FLAG,$NO_LOGICAL_OP_FLAG) 204AC_SUBST(WARN_OLD_STYLE_CAST,$WARN_OLD_STYLE_CAST) 205AC_SUBST(WARN_EFFCPLUSPLUS,$WARN_EFFCPLUSPLUS) 206 207dnl Checks for programs. 208AC_PROG_CC 209AC_PROG_CC_C99 210AC_PROG_CXX 211AC_LIBTOOL_WIN32_DLL 212AC_PROG_LIBTOOL 213 214dnl Check that CXX is really a working compiler 215AC_LANG_PUSH([C++]) 216AC_COMPILE_IFELSE([AC_LANG_PROGRAM( 217 [[#ifndef __cplusplus 218 #error "broken C++" 219 #endif]])],, 220 [CXX=;]) 221AC_LANG_POP([C++]) 222 223if test "x$CXX" = x ; then 224 AC_MSG_ERROR("You don't have a working C++ compiler.") 225fi 226 227AC_MSG_CHECKING([for std::isnan]) 228AC_LANG_PUSH([C++]) 229AC_COMPILE_IFELSE([AC_LANG_PROGRAM( 230 [[#include <cmath> 231 int CPLIsNan(float f) { return std::isnan(f); }]])], 232 [ 233 AC_MSG_RESULT([yes]) 234 AC_DEFINE_UNQUOTED(HAVE_STD_IS_NAN, 1, 235 [Define to 1 if you have the `std::isnan' function.]) 236 ], [ 237 AC_MSG_RESULT([no]) 238 ]) 239AC_LANG_POP([C++]) 240 241dnl switch between libtool and native build system 242AC_ARG_WITH(libtool, [ --without-libtool Don't use libtool to build the library],,) 243 244if test "$with_libtool" = "no"; then 245AC_PROG_RANLIB 246 247dnl AC_COMPILER_PIC as expanded by autoconf-2.68 doesn't work for the C++ part with clang++ 3.0 that doesn't like compiling .c programs 248dnl so we inline the expanded code and fix it at hand. 249dnl AC_COMPILER_PIC 250 echo 'void f(){}' > conftest.c 251 if test -z "`${CC-cc} $CFLAGS -fPIC -c conftest.c 2>&1`"; then 252 CFLAGS="$CFLAGS -fPIC" 253 fi 254 echo 'void f(){}' > conftest.cpp 255 if test -z "`${CXX-g++} $CXXFLAGS -fPIC -c conftest.cpp 2>&1`"; then 256 CXXFLAGS="$CXXFLAGS -fPIC" 257 fi 258 rm -f conftest* 259 260dnl Trick so that LD_SHARED test works with sanitizer flags with clang 261SAVED_CFLAGS=$CFLAGS 262CFLAGS=`echo "$CFLAGS " | sed "s/-fsanitize=undefined //" | sed "s/-fsanitize=address //" | sed "s/-fsanitize=unsigned-integer-overflow //"` 263AC_LD_SHARED 264CFLAGS=$SAVED_CFLAGS 265else 266with_libtool=yes 267fi 268AC_SUBST(HAVE_LIBTOOL,$with_libtool) 269 270dnl Checks for libraries. 271AC_CHECK_LIB(dl,dlopen,,,) 272 273dnl Needed on Solaris. 274AC_CHECK_LIB(rt,nanosleep,,,) 275 276dnl We don't need to add math library to all targets 277case "${host_os}" in 278 cygwin* | mingw32* | pw32* | beos* | darwin*) 279 ;; 280 *) 281 AC_CHECK_LIB(m,sin,,,) 282 ;; 283esac 284 285dnl Checks for header files. 286AC_HEADER_STDC 287AC_CHECK_HEADERS(assert.h fcntl.h unistd.h dbmalloc.h dlfcn.h stdint.h limits.h locale.h values.h float.h errno.h direct.h) 288 289dnl Check for userfaultfd support 290AC_CHECK_HEADERS([linux/userfaultfd.h], [ENABLE_UFFD="yes"], [ENABLE_UFFD="no"], []) 291AC_SUBST(ENABLE_UFFD,$ENABLE_UFFD) 292 293dnl cpl_vsil_unix_stdio_64.h requires linux/fs.h on Linux, and this isn't 294dnl installed by default on Alpine 295case "${host_os}" in 296 linux*) 297 AC_CHECK_HEADERS([linux/fs.h], [], [AC_MSG_ERROR([Unable to find linux/fs.h header])]) 298 ;; 299 *) 300 ;; 301esac 302 303AC_C_BIGENDIAN 304 305dnl Check for 64 bit file API 306AC_CHECK_TYPES([long long]) 307AC_UNIX_STDIO_64 308 309AC_CHECK_SIZEOF(int) 310AC_CHECK_SIZEOF(unsigned long) 311AC_CHECK_SIZEOF(void*) 312dnl Some compilers (IBM VisualAge) has these types defined, so check it here. 313dnl These types are used in internal libtiff. 314AC_CHECK_TYPES([int8, int16, int32],,, 315[ 316#if HAVE_INTTYPES_H 317# include <inttypes.h> 318#endif 319]) 320AC_CHECK_TYPES(uintptr_t) 321 322dnl We need the following lines for libtiff too. 323HAVE_IEEEFP=1 324AC_DEFINE_UNQUOTED(HAVE_IEEEFP, $HAVE_IEEEFP, [Define as 0 or 1 according to the floating point format supported by the machine]) 325 326dnl Checks for library functions. 327AC_FUNC_VPRINTF 328AC_CHECK_FUNCS(snprintf vsnprintf) 329AC_CHECK_FUNCS(atoll) 330AC_CHECK_FUNCS(strtoll) 331AC_CHECK_FUNCS(strtoull) 332AC_CHECK_FUNCS(strtof) 333AC_CHECK_FUNCS(getcwd) 334 335dnl Check for declarations 336AC_CHECK_DECLS(strtof) 337 338AC_CHECK_FUNCS(readlink) 339AC_CHECK_FUNCS(lstat) 340AC_CHECK_FUNCS(posix_spawnp) 341AC_CHECK_FUNCS(posix_memalign) 342AC_CHECK_FUNCS(vfork) 343AC_CHECK_FUNCS(mmap) 344AC_CHECK_FUNCS(sigaction) 345AC_CHECK_FUNCS(statvfs) 346AC_CHECK_FUNCS(statvfs64) 347AC_CHECK_FUNCS(getrlimit) 348 349AC_MSG_CHECKING([for RLIMIT_AS]) 350AC_TRY_COMPILE( 351 [ 352#include <sys/time.h> 353#include <sys/resource.h> 354 ], [ 355 return RLIMIT_AS; 356 ], 357 [ 358 AC_MSG_RESULT([yes]) 359 AC_DEFINE_UNQUOTED(HAVE_RLIMIT_AS, 1, 360 [Define to 1 if you have the `RLIMIT_AS' constant.]) 361 ], [ 362 AC_MSG_RESULT([no]) 363]) 364 365 366dnl Make sure at least these are checked under C++. Prototypes missing on 367dnl some platforms. 368 369AC_LANG_PUSH(C++) 370AC_CHECK_FUNC_CUSTOM(gmtime_r,[#include <time.h>],[time_t t; struct tm ltime; t = time(0); gmtime_r( &t, <ime );]) 371AC_CHECK_FUNC_CUSTOM(localtime_r,[#include <time.h>],[time_t t; struct tm ltime; t = time(0); localtime_r( &t, <ime );]) 372AC_LANG_POP(C++) 373 374AC_MSG_CHECKING([for uselocale]) 375AC_LANG_PUSH(C++) 376AC_TRY_COMPILE( 377 [ 378#define _XOPEN_SOURCE 700 379#include <locale.h> 380 ], [ 381 locale_t alocale = newlocale (LC_NUMERIC_MASK, "C", 0); 382 locale_t oldlocale = uselocale(alocale); 383 uselocale(oldlocale); 384 freelocale(alocale); 385 return 0; 386 ], 387 [ 388 AC_MSG_RESULT([yes]) 389 AC_DEFINE_UNQUOTED(HAVE_USELOCALE, 1, 390 [Define to 1 if you have the `uselocale' function.]) 391 ], [ 392 AC_MSG_RESULT([no]) 393]) 394AC_LANG_POP(C++) 395 396 397OPT_GDAL_FORMATS= 398EXTRA_INCLUDES= 399 400dnl --------------------------------------------------------------------------- 401dnl Check for --enable-debug 402dnl --------------------------------------------------------------------------- 403 404AC_MSG_CHECKING([to enable debug build]) 405 406AC_ARG_ENABLE(debug, 407 AS_HELP_STRING([--enable-debug], 408 [enable debugging (disabled by default)]), 409 [HAVE_DEBUG=$enableval], [HAVE_DEBUG=yes]) 410 411CFLAGS_NOFTRAPV="$CFLAGS" 412CXXFLAGS_NOFTRAPV="$CXXFLAGS" 413 414if test "x$enable_debug" = "xyes" ; then 415 416 dnl Try to strip out optimization. 417 418 CXXFLAGS=`echo "$CXXFLAGS " | sed "s/-O2 //"` 419 CFLAGS=`echo "$CFLAGS " | sed "s/-O2 //"` 420 CXXFLAGS=`echo "$CXXFLAGS" | sed "s/-O //"` 421 CFLAGS=`echo "$CFLAGS" | sed "s/-O //"` 422 423 dnl remove existing -g to avoid duplicates. 424 425 CXXFLAGS=`echo "$CXXFLAGS" | sed "s/-g //"` 426 CFLAGS=`echo "$CFLAGS" | sed "s/-g //"` 427 428 dnl add -g and -DDEBUG 429 430 CXXFLAGS="$CXXFLAGS -g -DDEBUG" 431 CFLAGS="$CFLAGS -g -DDEBUG" 432 433 CFLAGS_NOFTRAPV="$CFLAGS" 434 CXXFLAGS_NOFTRAPV="$CXXFLAGS" 435 436 AC_MSG_RESULT([yes, modified CFLAGS="$CFLAGS"]) 437 438 # Some clang version on 32 bits have linking error with 64bit operations (undefined reference to `__mulodi4') 439 AC_MSG_CHECKING([whether -ftrapv can be used]) 440 rm -f testftrapv.c 441 echo 'int main(int argc, char** argv) { return (long long)argc * argc; } ' > testftrapv.c 442 if test -z "`${CC} ${CFLAGS} -ftrapv testftrapv.c -o testftrapv 2>&1`" ; then 443 AC_MSG_RESULT([yes]) 444 CFLAGS="$CFLAGS -ftrapv" 445 CXXFLAGS="$CXXFLAGS -ftrapv" 446 else 447 AC_MSG_RESULT([no]) 448 fi 449 rm -f testftrapv.* testftrapv 450 451else 452 AC_MSG_RESULT([no, CFLAGS="$CFLAGS"]) 453fi 454 455AC_SUBST(CFLAGS_NOFTRAPV,$CFLAGS_NOFTRAPV) 456AC_SUBST(CXXFLAGS_NOFTRAPV,$CXXFLAGS_NOFTRAPV) 457 458dnl --------------------------------------------------------------------------- 459dnl Check if GCC 4.1 atomic builtins are really available 460dnl (some GCC versions are broken w.r.t this on some exotic architectures...) 461dnl --------------------------------------------------------------------------- 462 463AC_MSG_CHECKING([whether GCC 4.1 atomic builtins are available]) 464 465rm -f atomicbuiltins.c 466echo 'int main(int argc, char** argv) { int i; __sync_add_and_fetch(&i, 1); __sync_sub_and_fetch(&i, 1); __sync_bool_compare_and_swap(&i, 0, 1); return 0; } ' > atomicbuiltins.c 467if test -z "`${CC} ${CFLAGS} atomicbuiltins.c -o atomicbuiltins 2>&1`" ; then 468 HAVE_GCC_ATOMIC_BUILTINS=yes 469 AC_MSG_RESULT([yes]) 470 AC_DEFINE_UNQUOTED(HAVE_GCC_ATOMIC_BUILTINS,1, [Define to 1 if GCC atomic builtins are available]) 471else 472 HAVE_GCC_ATOMIC_BUILTINS=no 473 AC_MSG_RESULT([no]) 474fi 475rm -rf atomicbuiltins.* atomicbuiltins 476 477AC_SUBST(HAVE_GCC_ATOMIC_BUILTINS,$HAVE_GCC_ATOMIC_BUILTINS) 478 479dnl --------------------------------------------------------------------------- 480dnl Check if GCC bswap builtins are available 481dnl --------------------------------------------------------------------------- 482 483AC_MSG_CHECKING([whether GCC bswap builtins are available]) 484 485rm -f bswapbuiltins.c 486echo '#include <x86intrin.h>' > bswapbuiltins.c 487echo 'int main(int argc, char** argv) { (void)__builtin_bswap32(0); (void)__builtin_bswap64(0); return 0; } ' >> bswapbuiltins.c 488if test -z "`${CC} ${CFLAGS} bswapbuiltins.c -o bswapbuiltins 2>&1`" ; then 489 HAVE_GCC_BSWAP=yes 490 AC_MSG_RESULT([yes]) 491 AC_DEFINE_UNQUOTED(HAVE_GCC_BSWAP,1, [Define to 1 if GCC bswap builtins are available]) 492else 493 HAVE_GCC_BSWAP=no 494 AC_MSG_RESULT([no]) 495fi 496rm -rf bswapbuiltins.* bswapbuiltins 497 498AC_SUBST(HAVE_GCC_BSWAP,$HAVE_GCC_BSWAP) 499 500dnl --------------------------------------------------------------------------- 501dnl Check if __uint128_t is available and usable 502dnl --------------------------------------------------------------------------- 503 504AC_MSG_CHECKING([for __uint128_t]) 505AC_TRY_COMPILE( 506 [ 507 ], [ 508 unsigned long long v1 = 1024ULL; 509 unsigned long long v2 = 0x8000000000000000ULL; 510 __uint128_t u = ((__uint128_t)v1)*((__uint128_t)v2); 511 return u == 0; 512 ], 513 [ 514 AC_MSG_RESULT([yes]) 515 AC_DEFINE_UNQUOTED(HAVE_UINT128_T, 1, 516 [Define to 1 if the system has the type __uint128_t]) 517 ], [ 518 AC_MSG_RESULT([no]) 519]) 520 521dnl --------------------------------------------------------------------------- 522dnl Check SSE availability 523dnl --------------------------------------------------------------------------- 524 525AC_ARG_WITH(sse, 526[ --with-sse[=ARG] Detect SSE availability for some optimized routines (ARG=yes(default), no)],,) 527 528AC_MSG_CHECKING([whether SSE is available at compile time]) 529 530if test "$with_sse" = "yes" -o "$with_sse" = ""; then 531 532 rm -f detectsse.cpp 533 echo '#ifdef __SSE__' > detectsse.cpp 534 echo '#include <xmmintrin.h>' >> detectsse.cpp 535 echo 'void foo() { float fEpsilon = 0.0000000000001f; __m128 xmm_small = _mm_load1_ps(&fEpsilon); } int main() { return 0; }' >> detectsse.cpp 536 echo '#else' >> detectsse.cpp 537 echo 'some_error' >> detectsse.cpp 538 echo '#endif' >> detectsse.cpp 539 if test -z "`${CXX} ${CXXFLAGS} ${CPPFLAGS} -o detectsse detectsse.cpp 2>&1`" ; then 540 AC_MSG_RESULT([yes]) 541 SSEFLAGS="" 542 HAVE_SSE_AT_COMPILE_TIME=yes 543 else 544 if test -z "`${CXX} ${CXXFLAGS} ${CPPFLAGS} -msse -o detectsse detectsse.cpp 2>&1`" ; then 545 AC_MSG_RESULT([yes]) 546 SSEFLAGS="-msse" 547 HAVE_SSE_AT_COMPILE_TIME=yes 548 else 549 AC_MSG_RESULT([no]) 550 if test "$with_sse" = "yes"; then 551 AC_MSG_ERROR([--with-sse was requested, but SSE is not available]) 552 fi 553 fi 554 fi 555 556 dnl On Solaris, the presence of SSE instructions is flagged in the binary 557 dnl and prevent it to run on non SSE hardware even if the instructions are 558 dnl not executed. So if the user did not explicitly requires SSE, test that 559 dnl we can run SSE binaries 560 if test "$HAVE_SSE_AT_COMPILE_TIME" = "yes"; then 561 case $host_os in 562 solaris*) 563 AC_MSG_CHECKING([whether SSE is available and needed at runtime]) 564 if ./detectsse; then 565 AC_MSG_RESULT([yes]) 566 else 567 AC_MSG_RESULT([no]) 568 if test "$with_sse" = "yes"; then 569 echo "Caution: the generated binaries will not run on this system." 570 else 571 echo "Disabling SSE as it is not explicitly required" 572 HAVE_SSE_AT_COMPILE_TIME="" 573 SSEFLAGS="" 574 fi 575 fi 576 ;; 577 esac 578 fi 579 580 if test "$HAVE_SSE_AT_COMPILE_TIME" = "yes"; then 581 CFLAGS="-DHAVE_SSE_AT_COMPILE_TIME $CFLAGS" 582 CXXFLAGS="-DHAVE_SSE_AT_COMPILE_TIME $CXXFLAGS" 583 fi 584 585 rm -rf detectsse* 586else 587 AC_MSG_RESULT([no]) 588fi 589 590AC_SUBST(SSEFLAGS,$SSEFLAGS) 591 592dnl --------------------------------------------------------------------------- 593dnl Check SSSE3 availability 594dnl --------------------------------------------------------------------------- 595 596AC_ARG_WITH(ssse3, 597[ --with-ssse3[=ARG] Detect SSSE3 availability for some optimized routines (ARG=yes(default), no)],,) 598 599AC_MSG_CHECKING([whether SSSE3 is available at compile time]) 600 601if test "$with_ssse3" = "yes" -o "$with_ssse3" = ""; then 602 603 rm -f detectssse3.cpp 604 echo '#ifdef __SSSE3__' > detectssse3.cpp 605 echo '#include <tmmintrin.h>' >> detectssse3.cpp 606 echo 'void foo() { __m128i xmm_i = _mm_set1_epi16(0); xmm_i = _mm_shuffle_epi8(xmm_i, xmm_i); } int main() { return 0; }' >> detectssse3.cpp 607 echo '#else' >> detectssse3.cpp 608 echo 'some_error' >> detectssse3.cpp 609 echo '#endif' >> detectssse3.cpp 610 if test -z "`${CXX} ${CXXFLAGS} ${CPPFLAGS} -o detectssse3 detectssse3.cpp 2>&1`" ; then 611 AC_MSG_RESULT([yes]) 612 SSSE3FLAGS="" 613 HAVE_SSSE3_AT_COMPILE_TIME=yes 614 else 615 if test -z "`${CXX} ${CXXFLAGS} ${CPPFLAGS} -mssse3 -o detectssse3 detectssse3.cpp 2>&1`" ; then 616 AC_MSG_RESULT([yes]) 617 SSSE3FLAGS="-mssse3" 618 HAVE_SSSE3_AT_COMPILE_TIME=yes 619 else 620 AC_MSG_RESULT([no]) 621 if test "$with_ssse3" = "yes"; then 622 AC_MSG_ERROR([--with-ssse3 was requested, but SSSE3 is not available]) 623 fi 624 fi 625 fi 626 627 dnl On Solaris, the presence of SSSE3 instructions is flagged in the binary 628 dnl and prevent it to run on non SSSE3 hardware even if the instructions are 629 dnl not executed. So if the user did not explicitly requires SSSE3, test that 630 dnl we can run SSSE3 binaries 631 if test "$HAVE_SSSE3_AT_COMPILE_TIME" = "yes"; then 632 case $host_os in 633 solaris*) 634 AC_MSG_CHECKING([whether SSSE3 is available and needed at runtime]) 635 if ./detectssse3; then 636 AC_MSG_RESULT([yes]) 637 else 638 AC_MSG_RESULT([no]) 639 if test "$with_ssse3" = "yes"; then 640 echo "Caution: the generated binaries will not run on this system." 641 else 642 echo "Disabling SSSE3 as it is not explicitly required" 643 HAVE_SSSE3_AT_COMPILE_TIME="" 644 SSSE3FLAGS="" 645 fi 646 fi 647 ;; 648 esac 649 fi 650 651 if test "$HAVE_SSSE3_AT_COMPILE_TIME" = "yes"; then 652 CFLAGS="-DHAVE_SSSE3_AT_COMPILE_TIME $CFLAGS" 653 CXXFLAGS="-DHAVE_SSSE3_AT_COMPILE_TIME $CXXFLAGS" 654 fi 655 656 rm -rf detectssse3* 657else 658 AC_MSG_RESULT([no]) 659fi 660 661AC_SUBST(SSSE3FLAGS,$SSSE3FLAGS) 662 663dnl --------------------------------------------------------------------------- 664dnl Check AVX availability 665dnl --------------------------------------------------------------------------- 666 667AC_ARG_WITH(avx, 668[ --with-avx[=ARG] Detect AVX availability for some optimized routines (ARG=yes(default), no)],,) 669 670AC_MSG_CHECKING([whether AVX is available at compile time]) 671 672if test "$with_avx" = "yes" -o "$with_avx" = ""; then 673 674 rm -f detectavx.cpp 675 echo '#ifdef __AVX__' > detectavx.cpp 676 echo '#include <immintrin.h>' >> detectavx.cpp 677 echo 'int foo() { unsigned int nXCRLow, nXCRHigh;' >> detectavx.cpp 678 echo '__asm__ ("xgetbv" : "=a" (nXCRLow), "=d" (nXCRHigh) : "c" (0));' >> detectavx.cpp 679 echo 'float fEpsilon = 0.0000000000001f;' >> detectavx.cpp 680 echo '__m256 ymm_small = _mm256_set_ps(fEpsilon,fEpsilon,fEpsilon,fEpsilon,fEpsilon,fEpsilon,fEpsilon,fEpsilon);' >> detectavx.cpp 681 echo 'return (int)nXCRLow + _mm256_movemask_ps(ymm_small); }' >> detectavx.cpp 682 echo 'int main(int argc, char**) { if( argc == 0 ) return foo(); return 0; }' >> detectavx.cpp 683 echo '#else' >> detectavx.cpp 684 echo 'some_error' >> detectavx.cpp 685 echo '#endif' >> detectavx.cpp 686 if test -z "`${CXX} ${CXXFLAGS} ${CPPFLAGS} -o detectavx detectavx.cpp 2>&1`" ; then 687 AC_MSG_RESULT([yes]) 688 AVXFLAGS="" 689 HAVE_AVX_AT_COMPILE_TIME=yes 690 else 691 if test -z "`${CXX} ${CXXFLAGS} ${CPPFLAGS} -mavx -o detectavx detectavx.cpp 2>&1`" ; then 692 AC_MSG_RESULT([yes]) 693 AVXFLAGS="-mavx" 694 HAVE_AVX_AT_COMPILE_TIME=yes 695 else 696 AC_MSG_RESULT([no]) 697 if test "$with_avx" = "yes"; then 698 AC_MSG_ERROR([--with-avx was requested, but AVX is not available]) 699 fi 700 fi 701 fi 702 703 dnl On Solaris, the presence of AVX instructions is flagged in the binary 704 dnl and prevent it to run on non AVX hardware even if the instructions are 705 dnl not executed. So if the user did not explicitly requires AVX, test that 706 dnl we can run AVX binaries 707 if test "$HAVE_AVX_AT_COMPILE_TIME" = "yes"; then 708 case $host_os in 709 solaris*) 710 AC_MSG_CHECKING([whether AVX is available and needed at runtime]) 711 if ./detectavx; then 712 AC_MSG_RESULT([yes]) 713 else 714 AC_MSG_RESULT([no]) 715 if test "$with_avx" = "yes"; then 716 echo "Caution: the generated binaries will not run on this system." 717 else 718 echo "Disabling AVX as it is not explicitly required" 719 AVXFLAGS="" 720 HAVE_AVX_AT_COMPILE_TIME="" 721 fi 722 fi 723 ;; 724 esac 725 fi 726 727 if test "$HAVE_AVX_AT_COMPILE_TIME" = "yes"; then 728 CFLAGS="-DHAVE_AVX_AT_COMPILE_TIME $CFLAGS" 729 CXXFLAGS="-DHAVE_AVX_AT_COMPILE_TIME $CXXFLAGS" 730 fi 731 732 rm -rf detectavx* 733else 734 AC_MSG_RESULT([no]) 735fi 736 737AC_SUBST(AVXFLAGS,$AVXFLAGS) 738 739dnl --------------------------------------------------------------------------- 740dnl Check for --enable-lto 741dnl --------------------------------------------------------------------------- 742 743AC_MSG_CHECKING([to enable LTO (link time optimization) build]) 744 745AC_ARG_ENABLE(lto, 746 AS_HELP_STRING([--enable-lto], 747 [enable LTO(link time optimization) (disabled by default)])) 748 749CXXFLAGS_NO_LTO_IF_AVX_NONDEFAULT="$CXXFLAGS" 750CXXFLAGS_NO_LTO_IF_SSSE3_NONDEFAULT="$CXXFLAGS" 751 752if test "x$enable_lto" = "xyes" ; then 753 754 dnl remove existing -g. 755 756 CXXFLAGS=`echo "$CXXFLAGS" | sed "s/-g //"` 757 CFLAGS=`echo "$CFLAGS" | sed "s/-g //"` 758 759 dnl add -flto 760 761 CXXFLAGS="$CXXFLAGS -flto" 762 CFLAGS="$CFLAGS -flto" 763 LDFLAGS="$LDFLAGS -flto" 764 765 dnl in case we have avx available by default, then we can compile everything 766 dnl with -flto 767 if test "$HAVE_AVX_AT_COMPILE_TIME" = "yes"; then 768 if test "$AVXFLAGS" = ""; then 769 CXXFLAGS_NO_LTO_IF_AVX_NONDEFAULT="$CXXFLAGS" 770 fi 771 fi 772 if test "$HAVE_SSSE3_AT_COMPILE_TIME" = "yes"; then 773 if test "$SSSE3FLAGS" = ""; then 774 CXXFLAGS_NO_LTO_IF_SSSE3_NONDEFAULT="$CXXFLAGS" 775 fi 776 fi 777 778 AC_MSG_RESULT([yes]) 779else 780 AC_MSG_RESULT([no]) 781fi 782 783AC_SUBST(CXXFLAGS_NO_LTO_IF_AVX_NONDEFAULT,$CXXFLAGS_NO_LTO_IF_AVX_NONDEFAULT) 784AC_SUBST(CXXFLAGS_NO_LTO_IF_SSSE3_NONDEFAULT,$CXXFLAGS_NO_LTO_IF_SSSE3_NONDEFAULT) 785 786dnl --------------------------------------------------------------------------- 787dnl Check if we need -lws2_32 (mingw) 788dnl --------------------------------------------------------------------------- 789 790echo "#include <winsock2.h>" > test_ws2_32.c 791echo "#include <ws2tcpip.h>" >> test_ws2_32.c 792echo "void foo() {}" >> test_ws2_32.c 793 794if test -z "`${CC} -c test_ws2_32.c 2>&1`" ; then 795 LIBS="$LIBS -lws2_32" 796fi 797rm -f test_ws2_32* 798 799dnl --------------------------------------------------------------------------- 800dnl Check if we need -lpsapi (mingw) 801dnl --------------------------------------------------------------------------- 802 803echo "#include <windows.h>" > test_psapi.c 804echo "#include <psapi.h>" >> test_psapi.c 805echo "void foo() {}" >> test_psapi.c 806 807if test -z "`${CC} -c test_psapi.c 2>&1`" ; then 808 LIBS="$LIBS -lpsapi" 809fi 810rm -f test_psapi* 811 812 813dnl --------------------------------------------------------------------------- 814dnl Check if we have getaddrinfo 815dnl --------------------------------------------------------------------------- 816 817echo "#include <sys/types.h>" > test_getaddrinfo.c 818echo "#include <sys/socket.h>" >> test_getaddrinfo.c 819echo "#include <netdb.h>" >> test_getaddrinfo.c 820echo "void test() { getaddrinfo(0,0,0,0); }" >> test_getaddrinfo.c 821 822HAVE_GETADDRINFO=NO 823if test -z "`${CC} -c test_getaddrinfo.c 2>&1`" ; then 824 AC_DEFINE_UNQUOTED(HAVE_GETADDRINFO,1, [Define to 1 if you have the `getaddrinfo' function.]) 825fi 826rm -f test_getaddrinfo* 827 828dnl --------------------------------------------------------------------------- 829dnl Check if user requests hiding internal symbols 830dnl --------------------------------------------------------------------------- 831 832AC_ARG_WITH(hide_internal_symbols,[ --with-hide-internal-symbols[=ARG] Try to hide internal symbols (ARG=yes/no)],,) 833 834HAVE_HIDE_INTERNAL_SYMBOLS=no 835 836if test "$with_hide_internal_symbols" = "yes"; then 837 838 AC_MSG_CHECKING([whether we should hide internal symbols]) 839 840 rm -f hiddensymbols.c 841 echo 'int visible() { return 0; } __attribute__ ((visibility("default")))' >> hiddensymbols.c 842 echo 'int hidden() { return 0; }' >> hiddensymbols.c 843 if test -z "`${CC} -fvisibility=hidden -c hiddensymbols.c 2>&1`" ; then 844 HAVE_HIDE_INTERNAL_SYMBOLS=yes 845 else 846 HAVE_HIDE_INTERNAL_SYMBOLS=no 847 fi 848 if test "$HAVE_HIDE_INTERNAL_SYMBOLS" = "yes"; then 849 AC_MSG_RESULT([yes]) 850 CFLAGS="$CFLAGS -fvisibility=hidden" 851 CXXFLAGS="$CXXFLAGS -fvisibility=hidden" 852 CFLAGS_NOFTRAPV="$CFLAGS_NOFTRAPV -fvisibility=hidden" 853 CXXFLAGS_NOFTRAPV="$CXXFLAGS_NOFTRAPV -fvisibility=hidden" 854 CXXFLAGS_NO_LTO_IF_AVX_NONDEFAULT="$CXXFLAGS_NO_LTO_IF_AVX_NONDEFAULT -fvisibility=hidden" 855 CXXFLAGS_NO_LTO_IF_SSSE3_NONDEFAULT="$CXXFLAGS_NO_LTO_IF_SSSE3_NONDEFAULT -fvisibility=hidden" 856 else 857 AC_MSG_RESULT([no]) 858 fi 859 rm -f hiddensymbols.* 860else 861 AC_MSG_CHECKING([whether we should hide internal symbols]) 862 AC_MSG_RESULT([no]) 863fi 864 865if test "$HAVE_HIDE_INTERNAL_SYMBOLS" = "yes" ; then 866 AC_DEFINE_UNQUOTED(USE_GCC_VISIBILITY_FLAG,1, [Define to 1 if you want to use the -fvisibility GCC flag]) 867fi 868 869AC_SUBST(HAVE_HIDE_INTERNAL_SYMBOLS,$HAVE_HIDE_INTERNAL_SYMBOLS) 870 871dnl --------------------------------------------------------------------------- 872dnl Check if user requests renaming internal libtiff symbols 873dnl --------------------------------------------------------------------------- 874 875AC_ARG_WITH(rename_internal_libtiff_symbols,[ --with-rename-internal-libtiff-symbols[=ARG] Prefix internal libtiff symbols with gdal_ (ARG=yes/no)],,) 876 877if test "$HAVE_HIDE_INTERNAL_SYMBOLS" = "yes" ; then 878 with_rename_internal_libtiff_symbols=yes 879 if test "x$with_rename_internal_libtiff_symbols" = "x$no"; then 880 with_rename_internal_libtiff_symbols=no 881 fi 882else 883 with_rename_internal_libtiff_symbols=no 884 if test "x$with_rename_internal_libtiff_symbols" = "x$yes" -o "x$with_rename_internal_libtiff_symbols" = "x"; then 885 with_rename_internal_libtiff_symbols=yes 886 fi 887fi 888 889AC_SUBST(RENAME_INTERNAL_LIBTIFF_SYMBOLS,$with_rename_internal_libtiff_symbols) 890 891dnl --------------------------------------------------------------------------- 892dnl Check if user requests renaming internal libgeotiff symbols 893dnl --------------------------------------------------------------------------- 894 895AC_ARG_WITH(rename_internal_libgeotiff_symbols,[ --with-rename-internal-libgeotiff-symbols[=ARG] Prefix internal libgeotiff symbols with gdal_ (ARG=yes/no)],,) 896 897if test "$HAVE_HIDE_INTERNAL_SYMBOLS" = "yes" ; then 898 with_rename_internal_libgeotiff_symbols=yes 899 if test "x$with_rename_internal_libgeotiff_symbols" = "x$no"; then 900 with_rename_internal_libgeotiff_symbols=no 901 fi 902else 903 with_rename_internal_libgeotiff_symbols=no 904 if test "x$with_rename_internal_libgeotiff_symbols" = "x$yes" -o "x$with_rename_internal_libgeotiff_symbols" = "x"; then 905 with_rename_internal_libgeotiff_symbols=yes 906 fi 907fi 908 909AC_SUBST(RENAME_INTERNAL_LIBGEOTIFF_SYMBOLS,$with_rename_internal_libgeotiff_symbols) 910 911dnl --------------------------------------------------------------------------- 912dnl Check if user requests renaming internal shapelib symbols 913dnl --------------------------------------------------------------------------- 914 915AC_ARG_WITH(rename_internal_shapelib_symbols,[ --with-rename-internal-shapelib-symbols[=ARG] Prefix internal shapelib symbols with gdal_ (ARG=yes/no)],,) 916 917if test "$HAVE_HIDE_INTERNAL_SYMBOLS" = "yes" ; then 918 with_rename_internal_shapelib_symbols=yes 919 if test "x$with_rename_internal_shapelib_symbols" = "x$no"; then 920 with_rename_internal_shapelib_symbols=no 921 fi 922else 923 with_rename_internal_shapelib_symbols=no 924 if test "x$with_rename_internal_shapelib_symbols" = "x$yes" -o "x$with_rename_internal_shapelib_symbols" = "x"; then 925 with_rename_internal_shapelib_symbols=yes 926 fi 927fi 928AC_SUBST(RENAME_INTERNAL_SHAPELIB_SYMBOLS,$with_rename_internal_shapelib_symbols) 929 930 931dnl --------------------------------------------------------------------------- 932dnl Check if user requests /usr/local to be included. 933dnl --------------------------------------------------------------------------- 934 935AC_MSG_CHECKING([for local include/lib path]) 936 937AC_ARG_WITH(local,[ --with-local[=dir] Include /usr/local or other local tree for INCLUDE/LIBS],,) 938 939if test "$with_local" != "no" -a "$with_local" != "" ; then 940 941 if test "$with_local" = "yes" ; then 942 ADD_PREFIX=/usr/local 943 else 944 ADD_PREFIX=$with_local 945 fi 946 947 AC_MSG_RESULT(adding $ADD_PREFIX) 948 949 LIBS="$LIBS -L$ADD_PREFIX/lib" 950 CPPFLAGS="$CPPFLAGS -I$ADD_PREFIX/include" 951else 952 AC_MSG_RESULT([none]) 953fi 954 955dnl --------------------------------------------------------------------- 956dnl ENABLE THREADS ONLY IF REQUESTED. 957dnl --------------------------------------------------------------------- 958 959THREAD_LIB="" 960THREAD_FLAG="" 961PTHREAD_ENABLED="no" 962 963AC_ARG_WITH(threads, 964[ --with-threads[=ARG] Include thread safe support (ARG=yes(default), no or linkopt)],,) 965 966if test "$with_threads" = "yes" -o "$with_threads" = "" ; then 967 968 AC_CHECK_LIB(pthread,pthread_create,THREAD_FLAG=CPL_MULTIPROC_PTHREAD,,,) 969 970 if test -n "$THREAD_FLAG" ; then 971 THREAD_LIB="-lpthread" 972 else 973 # For Android, pthread_create is in Bionic libc 974 unset ac_cv_lib_pthread_pthread_create 975 AC_CHECK_LIB(c,pthread_create,THREAD_FLAG=CPL_MULTIPROC_PTHREAD,,,) 976 fi 977 978 AC_MSG_CHECKING([for PTHREAD_MUTEX_RECURSIVE]) 979 980 AC_TRY_COMPILE( 981 [ 982#define _GNU_SOURCE 983#include <pthread.h> 984 ], [ 985 return (PTHREAD_MUTEX_RECURSIVE); 986 ], 987 [ 988 AC_MSG_RESULT([yes]) 989 AC_DEFINE_UNQUOTED(HAVE_PTHREAD_MUTEX_RECURSIVE, 1, 990 [Define to 1 if you have the `PTHREAD_MUTEX_RECURSIVE' constant.]) 991 ], [ 992 AC_MSG_RESULT([no]) 993 ]) 994 995 996 997 AC_MSG_CHECKING([for PTHREAD_MUTEX_ADAPTIVE_NP]) 998 999 AC_TRY_COMPILE( 1000 [ 1001#define _GNU_SOURCE 1002#include <pthread.h> 1003 ], [ 1004 return PTHREAD_MUTEX_ADAPTIVE_NP; 1005 ], 1006 [ 1007 AC_MSG_RESULT([yes]) 1008 AC_DEFINE_UNQUOTED(HAVE_PTHREAD_MUTEX_ADAPTIVE_NP, 1, 1009 [Define to 1 if you have the `PTHREAD_MUTEX_ADAPTIVE_NP' constant.]) 1010 ], [ 1011 AC_MSG_RESULT([no]) 1012 ]) 1013 1014 AC_MSG_CHECKING([for pthread_spinlock_t]) 1015 1016 AC_TRY_COMPILE( 1017 [ 1018#define _GNU_SOURCE 1019#include <pthread.h> 1020 ], [ 1021 pthread_spinlock_t spin; 1022 return 1; 1023 ], 1024 [ 1025 AC_MSG_RESULT([yes]) 1026 AC_DEFINE_UNQUOTED(HAVE_PTHREAD_SPINLOCK, 1, 1027 [Define to 1 if you have the `pthread_spinlock_t' type.]) 1028 ], [ 1029 AC_MSG_RESULT([no]) 1030 ]) 1031 1032elif test "$with_threads" != "no" ; then 1033 1034 THREAD_FLAG=CPL_MULTIPROC_PTHREAD 1035 THREAD_LIB="$with_threads" 1036 1037 AC_CHECKING(whether we should include thread/mutex support...) 1038 AC_MSG_RESULT([ using threads with link options "$THREAD_LIB".]) 1039 1040else 1041 AC_CHECKING(whether we should include thread/mutex support...) 1042 AC_MSG_RESULT([ thread safe support disabled.]) 1043fi 1044 1045if test "$THREAD_FLAG" = "CPL_MULTIPROC_PTHREAD" ; then 1046 AC_DEFINE_UNQUOTED(CPL_MULTIPROC_PTHREAD,1, [Define if you want to use pthreads based multiprocessing support]) 1047 PTHREAD_ENABLED="yes" 1048fi 1049 1050LIBS="$THREAD_LIB $LIBS" 1051 1052dnl --------------------------------------------------------------------------- 1053dnl Check if mremap() with 5 args is available 1054dnl --------------------------------------------------------------------------- 1055 1056AC_MSG_CHECKING([for 5 args mremap()]) 1057 1058AC_TRY_COMPILE( 1059[ 1060#define _GNU_SOURCE 1061#include <sys/mman.h> 1062], [ 1063return (mremap(0,0,0,0,0)); 1064], 1065[ 1066AC_MSG_RESULT([yes]) 1067AC_DEFINE_UNQUOTED(HAVE_5ARGS_MREMAP, 1, 1068 [Define to 1 if you have the 5 args `mremap' function.]) 1069], [ 1070AC_MSG_RESULT([no]) 1071]) 1072 1073dnl --------------------------------------------------------------------------- 1074dnl Check if _SC_PHYS_PAGES is available 1075dnl --------------------------------------------------------------------------- 1076 1077AC_MSG_CHECKING([for _SC_PHYS_PAGES]) 1078 1079AC_TRY_COMPILE( 1080[ 1081#include <unistd.h> 1082], [ 1083return (sysconf(_SC_PHYS_PAGES)); 1084], 1085[ 1086AC_MSG_RESULT([yes]) 1087AC_DEFINE_UNQUOTED(HAVE_SC_PHYS_PAGES, 1, 1088 [Define to 1 if you have the _SC_PHYS_PAGES' constant.]) 1089], [ 1090AC_MSG_RESULT([no]) 1091]) 1092 1093dnl '--------------------------------------------------------------------------- 1094dnl Remove possible system library paths from a *_LIB variable to prevent other, perhaps unrelated, system libraries 1095dnl from shadowing custom libraries of the same name the user might have installed e.g. under /usr/local. 1096dnl System library paths are things like /lib, /usr/lib, /lib64, /usr/lib64, and /usr/lib/x86_64-linux-gnu. 1097dnl There may be others as well, that will need be addressed as they arise. We avoid wildcards such as 1098dnl /usr/lib/* to avoid potential cases such as /usr/lib/mysql/lib, which might not have an /etc/ld.so.conf.d 1099dnl entry and would not shadow any possible custom installs anyway: 1100 1101AC_DEFUN([STRIP_SYSTEM_LIBRARY_PATHS],[ 1102 if echo "x" | sed -E "s/x/y/" >/dev/null 2>/dev/null; then 1103 STRIPPED_LIBRARY_NAME="$(echo [$1] | sed -E 's:-L/(usr/)?(lib(64)?|lib/x86_64-linux-gnu)/*[[[:space:]]]+::')" 1104 elif echo "x" | sed -r "s/x/y/" >/dev/null 2>/dev/null; then 1105 dnl Compatibility with older GNU sed that doesn't support -E 1106 STRIPPED_LIBRARY_NAME="$(echo [$1] | sed -r 's:-L/(usr/)?(lib(64)?|lib/x86_64-linux-gnu)/*[[[:space:]]]+::')" 1107 else 1108 STRIPPED_LIBRARY_NAME="$(echo [$1])" 1109 fi 1110]) 1111 1112dnl --------------------------------------------------------------------------- 1113dnl Check if libz is available. 1114dnl --------------------------------------------------------------------------- 1115 1116AC_ARG_WITH(libz,[ --with-libz[=ARG] Include libz support (ARG=internal or libz directory)],,) 1117 1118if test "$with_libz" = "external" -o "$with_libz" = "" -o "$with_libz" = "yes" ; then 1119 1120 AC_CHECK_LIB(z,deflateInit_,LIBZ_SETTING=external,LIBZ_SETTING=internal,) 1121 1122 if test "$LIBZ_SETTING" = "external" ; then 1123 AC_CHECK_LIB(z,inflateCopy,LIBZ_SETTING=external,LIBZ_SETTING=internal,) 1124 if test "$LIBZ_SETTING" = "external" ; then 1125 AC_MSG_RESULT([using pre-installed libz]) 1126 else 1127 AC_MSG_RESULT([using internal libz code as inflateCopy is missing]) 1128 fi 1129 else 1130 AC_MSG_RESULT([using internal libz code as deflateInit_ is missing]) 1131 fi 1132 1133elif test "$with_libz" != "no" -a "$with_libz" != "internal" ; then 1134 1135 LIBS="-L$with_libz -L$with_libz/lib $LIBS" 1136 1137 AC_CHECK_LIB(z,deflateInit_,LIBZ_SETTING=external,LIBZ_SETTING=internal,-L$with_libz -L$with_libz/lib -lz) 1138 if test "$LIBZ_SETTING" = "external" ; then 1139 AC_CHECK_LIB(z,inflateCopy,LIBZ_SETTING=external,LIBZ_SETTING=internal,-L$with_libz -L$with_libz/lib -lz) 1140 if test "$LIBZ_SETTING" = "external" ; then 1141 AC_MSG_RESULT([using libz library from $with_libz]) 1142 else 1143 AC_MSG_RESULT([using internal libz code as inflateCopy from $with_libz is missing]) 1144 fi 1145 else 1146 AC_MSG_RESULT([using internal libz code as deflateInit_ from $with_libz is missing]) 1147 fi 1148 1149fi 1150 1151if test "$LIBZ_SETTING" = "external" ; then 1152 LIBS="-lz $LIBS" 1153 if test "$with_libz" != "" -a "$with_libz" != "yes" -a "$with_libz" != "external" ; then 1154 EXTRA_INCLUDES="-I$with_libz -I$with_libz/include $EXTRA_INCLUDES" 1155 fi 1156elif test "$with_libz" = "no" ; then 1157 LIBZ_SETTING=no 1158 AC_MSG_RESULT([not using libz at all.]) 1159else 1160 LIBZ_SETTING=internal 1161 OPT_GDAL_FORMATS="zlib $OPT_GDAL_FORMATS" 1162 AC_MSG_RESULT([using internal libz code.]) 1163fi 1164 1165AC_SUBST(LIBZ_SETTING,$LIBZ_SETTING) 1166 1167dnl --------------------------------------------------------------------------- 1168dnl Check for libdeflate. 1169dnl --------------------------------------------------------------------------- 1170 1171LIBDEFLATE_SETTING=no 1172 1173AC_ARG_WITH(libdeflate, 1174 AS_HELP_STRING([--with-libdeflate], 1175 [enable libdeflate usage (optional for faster Deflate support (still requires zlib) (ARG=yes/no/prefix), enabled by default)]),,) 1176 1177if test "$with_libdeflate" != "no" ; then 1178 1179 if test "$with_libdeflate" != "" -a "$with_libdeflate" != "yes"; then 1180 AC_CHECK_LIB(deflate, libdeflate_zlib_decompress, [libdeflate_lib=yes], [libdeflate_lib=no],-L$with_libdeflate/lib) 1181 else 1182 AC_CHECK_LIB(deflate, libdeflate_zlib_decompress, [libdeflate_lib=yes], [libdeflate_lib=no]) 1183 fi 1184 1185 if test "$libdeflate_lib" = "no" -a "$with_libdeflate" = "yes"; then 1186 AC_MSG_ERROR([libdeflate library not found]) 1187 fi 1188 1189 if test "$with_libdeflate" != "" -a "$with_libdeflate" != "yes"; then 1190 if test -r "$with_libdeflate/include/libdeflate.h" ; then 1191 libdeflate_h=yes 1192 else 1193 libdeflate_h=no 1194 fi 1195 else 1196 AC_CHECK_HEADER(libdeflate.h, [libdeflate_h=yes], [libdeflate_h=no]) 1197 fi 1198 if test "$libdeflate_h" = "no" -a "$with_libdeflate" = "yes"; then 1199 AC_MSG_ERROR([libdeflate headers not found]) 1200 fi 1201 1202 if test "$libdeflate_lib" = "yes" -a "$libdeflate_h" = "yes" ; then 1203 LIBDEFLATE_SETTING=yes 1204 fi 1205 1206fi 1207 1208if test "$LIBDEFLATE_SETTING" = "yes" ; then 1209 if test "$with_libdeflate" != "" -a "$with_libdeflate" != "yes"; then 1210 EXTRA_INCLUDES="-I$with_libdeflate/include $EXTRA_INCLUDES" 1211 LIBS="-L$with_libdeflate/lib -ldeflate $LIBS" 1212 else 1213 LIBS="-ldeflate $LIBS" 1214 fi 1215fi 1216 1217AC_SUBST(LIBDEFLATE_SETTING,$LIBDEFLATE_SETTING) 1218 1219dnl --------------------------------------------------------------------------- 1220dnl Check for iconv/libiconv. 1221dnl A rationale for this macro is described in "GNU `gettext' utilities" 1222dnl manual at 1223dnl http://www.gnu.org/software/gettext/manual/html_node/AM_005fICONV.html 1224dnl --------------------------------------------------------------------------- 1225AM_ICONV 1226 1227dnl Extra test needed for GCC 4.5 on Solaris 11, where there is 1228dnl a different behavior if the tests are compiled with gcc or g++. 1229dnl So we introduce a ICONV_CPP_CONST that must be used instead of 1230dnl ICONV_CONST when used from .cpp files. 1231if test "$am_func_iconv" = "yes"; then 1232 rm -f testiconv.* 1233 echo '#include <iconv.h>' > testiconv.cpp 1234 echo 'int main(int argc, char** argv) { iconv_t cd = 0; return iconv (cd, (const char **) 0, 0, 0, 0); } ' >> testiconv.cpp 1235 if test -z "`${CXX} ${CXXFLAGS} ${CPPFLAGS} testiconv.cpp -c 2>&1`" ; then 1236 AC_MSG_RESULT([using ICONV_CPP_CONST="const"]) 1237 ICONV_CPP_CONST="const" 1238 else 1239 AC_MSG_RESULT([using ICONV_CPP_CONST=""]) 1240 ICONV_CPP_CONST="" 1241 fi 1242 rm -f testiconv.* 1243 1244 AC_DEFINE_UNQUOTED(ICONV_CPP_CONST,$ICONV_CPP_CONST, [For.cpp files, define as const if the declaration of iconv() needs const.]) 1245fi 1246 1247dnl --------------------------------------------------------------------------- 1248dnl Bash completions 1249dnl --------------------------------------------------------------------------- 1250 1251AC_ARG_WITH([bash-completion], 1252 AS_HELP_STRING([--with-bash-completion[=ARG]], 1253 [Install Bash completions (ARG=yes or path)]),,) 1254 1255if test "x$with_bash_completion" = "xno" -o "x$with_bash_completion" = "x"; then 1256 AC_MSG_NOTICE([Bash completions not requested]) 1257elif test "x$with_bash_completion" = "xyes"; then 1258 PKG_CHECK_VAR(bashcompdir, [bash-completion], [completionsdir], , 1259 bashcompdir="${sysconfdir}/bash_completion.d") 1260 AC_SUBST(bashcompdir) 1261else 1262 AC_SUBST(bashcompdir, $with_bash_completion) 1263fi 1264 1265dnl --------------------------------------------------------------------------- 1266dnl Select a JPEG Library to use, or disable driver. 1267dnl libtiff could depend on it so it must appear before. 1268dnl --------------------------------------------------------------------------- 1269 1270AC_ARG_WITH(jpeg,[ --with-jpeg[=ARG] Include JPEG support (ARG=internal, no or path)],,) 1271 1272if test "$with_jpeg" = "no" ; then 1273 1274 JPEG_SETTING=no 1275 1276 echo "jpeg support disabled." 1277 1278elif test "$with_jpeg" = "yes" -o "$with_jpeg" = "" ; then 1279 1280 AC_CHECK_LIB(jpeg,jpeg_read_scanlines,JPEG_SETTING=external,JPEG_SETTING=internal,) 1281 AC_CHECK_HEADERS(jpeglib.h) 1282 1283 if test "$JPEG_SETTING" = "external" -a "$ac_cv_header_jpeglib_h" = "no" ; then 1284 JPEG_SETTING=internal 1285 fi 1286 1287 if test "$JPEG_SETTING" = "external" -a "$TIFF_SETTING" = "internal" ; then 1288 AC_MSG_CHECKING([for width_in_blocks in jpeglib.h]) 1289 1290 rm -f conftest.c 1291 echo '#include <stdio.h>' >> conftest.c 1292 echo '#include "jpeglib.h"' >> conftest.c 1293 echo 'int main() { jpeg_component_info *comptr=0; int i; i = comptr->width_in_blocks; }' >> conftest.c 1294 if test -z "`${CC} ${CPPFLAGS} ${CFLAGS} -c conftest.c 2>&1`" ; then 1295 AC_MSG_RESULT([yes]) 1296 else 1297 AC_MSG_RESULT([no]) 1298 JPEG_SETTING=internal 1299 fi 1300 rm -f conftest* 1301 fi 1302 1303 if test "$JPEG_SETTING" = "external" ; then 1304 LIBS="-ljpeg $LIBS" 1305 echo "using pre-installed libjpeg." 1306 else 1307 echo "using internal jpeg code." 1308 fi 1309 1310elif test "$with_jpeg" = "internal" ; then 1311 1312 JPEG_SETTING=internal 1313 1314 echo "using internal jpeg code." 1315 1316else 1317 1318 JPEG_SETTING=external 1319 LIBS="-L$with_jpeg -L$with_jpeg/lib -ljpeg $LIBS" 1320 EXTRA_INCLUDES="-I$with_jpeg -I$with_jpeg/include $EXTRA_INCLUDES" 1321 1322 echo "using libjpeg from $with_jpeg." 1323 1324fi 1325 1326AC_SUBST(JPEG_SETTING,$JPEG_SETTING) 1327 1328if test "$JPEG_SETTING" != "no" ; then 1329 OPT_GDAL_FORMATS="jpeg $OPT_GDAL_FORMATS" 1330fi 1331 1332 1333 1334 1335dnl --------------------------------------------------------------------------- 1336dnl Select a libtiff library to use. 1337dnl Proj depends on it so it must appear before. 1338dnl --------------------------------------------------------------------------- 1339 1340AC_ARG_WITH(libtiff,[ --with-libtiff=ARG Libtiff library to use (ARG=internal, yes or path)],,) 1341 1342AC_MSG_CHECKING([for libtiff]) 1343 1344if test "x${with_libtiff}" = "xyes" -o "x${with_libtiff}" = "x" ; then 1345 1346 dnl Only automatically pick up the external libtiff if it is >= 4.0. 1347 AC_CHECK_LIB(tiff,TIFFScanlineSize64,TIFF_SETTING=external HAVE_BIGTIFF=yes,TIFF_SETTING=internal HAVE_BIGTIFF=yes,) 1348 1349 if test "$TIFF_SETTING" = "external" ; then 1350 LIBS="-ltiff $LIBS" 1351 AC_MSG_RESULT([using pre-installed libtiff.]) 1352 else 1353 AC_MSG_RESULT([using internal TIFF code.]) 1354 fi 1355 1356elif test "x${with_libtiff}" = "xno" ; then 1357 1358 AC_MSG_ERROR([libtiff is a required dependency]) 1359 1360elif test "x${with_libtiff}" = "xinternal" ; then 1361 1362 TIFF_SETTING=internal 1363 HAVE_BIGTIFF=yes 1364 1365 AC_MSG_RESULT([using internal TIFF code.]) 1366 1367else 1368 1369 TIFF_SETTING=external 1370 if test -r "$with_libtiff/tiff.h" ; then 1371 LIBS="-L$with_libtiff -ltiff $LIBS" 1372 EXTRA_INCLUDES="-I$with_libtiff $EXTRA_INCLUDES" 1373 else 1374 LIBS="-L$with_libtiff/lib -ltiff $LIBS" 1375 EXTRA_INCLUDES="-I$with_libtiff/include $EXTRA_INCLUDES" 1376 fi 1377 1378 AC_MSG_RESULT([using libtiff from ${with_libtiff}.]) 1379 1380 dnl Check for the BigTIFF enabled library (libtiff >= 4.0) 1381 AC_CHECK_LIB(tiff,TIFFScanlineSize64,HAVE_BIGTIFF=yes,HAVE_BIGTIFF=no,) 1382 1383fi 1384 1385if test "${HAVE_BIGTIFF}" != "yes" ; then 1386 AC_MSG_ERROR([libtiff >= 4.0 is required.]) 1387fi 1388 1389AC_SUBST(TIFF_SETTING,${TIFF_SETTING}) 1390 1391dnl --------------------------------------------------------------------------- 1392dnl Check for curl (i.e. for wcs). 1393dnl Proj depends on it so it must appear before. 1394dnl --------------------------------------------------------------------------- 1395CURL_SETTING=no 1396CURL_INC= 1397CURL_LIB= 1398 1399AC_ARG_WITH(curl, 1400 [ --with-curl[=ARG] Include curl (ARG=path to curl-config.)],,,) 1401 1402dnl Clear some cache variables 1403unset ac_cv_path_LIBCURL 1404 1405if test "`basename xx/$with_curl`" = "curl-config" ; then 1406 LIBCURL_CONFIG="$with_curl" 1407elif test "$with_curl" = "no" ; then 1408 LIBCURL_CONFIG=no 1409else 1410 AC_PATH_PROG(LIBCURL_CONFIG, curl-config, no) 1411fi 1412 1413if test "$LIBCURL_CONFIG" != "no" ; then 1414 1415 CURL_VERNUM=`$LIBCURL_CONFIG --vernum` 1416 CURL_VER=`$LIBCURL_CONFIG --version | awk '{print $2}'` 1417 1418 AC_MSG_RESULT([ found libcurl version $CURL_VER]) 1419 1420 AC_CHECK_LIB(curl,curl_global_init,CURL_SETTING=yes,CURL_SETTING=no,`$LIBCURL_CONFIG --libs`) 1421 1422fi 1423 1424AC_SUBST(CURL_SETTING,$CURL_SETTING) 1425AC_SUBST(CURL_INC, $CURL_INC) 1426AC_SUBST(CURL_LIB, $CURL_LIB) 1427 1428dnl --------------------------------------------------------------------------- 1429dnl Check for SQLite 1430dnl Proj depends on it so it must appear before. 1431dnl --------------------------------------------------------------------------- 1432 1433SQLITE3_REQ_VERSION="3.0.0" 1434AX_LIB_SQLITE3($SQLITE3_REQ_VERSION) 1435 1436if test "$HAVE_SQLITE3" = "yes"; then 1437 LIBS="$SQLITE3_LDFLAGS $LIBS" 1438 AC_CHECK_LIB(sqlite3,sqlite3_column_table_name,SQLITE_HAS_COLUMN_METADATA=yes,SQLITE_HAS_COLUMN_METADATA=no,$LIBS) 1439fi 1440 1441AC_SUBST([SQLITE_INC], $SQLITE3_CFLAGS) 1442AC_SUBST([HAVE_SQLITE], $HAVE_SQLITE3) 1443AC_SUBST([SQLITE_HAS_COLUMN_METADATA], $SQLITE_HAS_COLUMN_METADATA) 1444HAVE_SQLITE=$HAVE_SQLITE3 1445 1446dnl --------------------------------------------------------------------------- 1447dnl PROJ.6 related stuff 1448dnl --------------------------------------------------------------------------- 1449 1450AC_MSG_CHECKING([for PROJ >= 6 library]) 1451 1452AC_ARG_WITH(proj,[ --with-proj=ARG Compile with PROJ.x (ARG=yes or path)],,) 1453 1454AC_ARG_WITH(proj-extra-lib-for-test, 1455 [ --with-proj-extra-lib-for-test=ARG Additional libraries to pass the detection test, but not used for libgdal linking (i.e. -lcurl -ltiff ...). Mainly for static libproj],,,) 1456 1457PROJ_INCLUDE="" 1458if test "x$with_proj" = "xno" ; then 1459 1460 AC_MSG_ERROR([PROJ >= 6 is a required dependency.]) 1461 1462else 1463 1464 if test "x$with_proj" = "xyes" -o "x$with_proj" = "x"; then 1465 ORIG_LIBS="$LIBS" 1466 LIBS="-lproj $with_proj_extra_lib_for_test $ORIG_LIBS" 1467 AC_LANG_PUSH([C++]) 1468 AC_CHECK_LIB(proj,proj_create_from_wkt,PROJ_FOUND=yes,PROJ_FOUND=no,) 1469 AC_LANG_POP([C++]) 1470 if test "$PROJ_FOUND" = "no"; then 1471 AC_LANG_PUSH([C++]) 1472 AC_CHECK_LIB(proj,internal_proj_create_from_wkt,PROJ_FOUND=yes,PROJ_FOUND=no,) 1473 AC_LANG_POP([C++]) 1474 if test "$PROJ_FOUND" = "yes"; then 1475 PROJ_INCLUDE="-DPROJ_RENAME_SYMBOLS" 1476 fi 1477 fi 1478 if test "$PROJ_FOUND" = "no"; then 1479 LIBS="-linternalproj $ORIG_LIBS" 1480 AC_LANG_PUSH([C++]) 1481 AC_CHECK_LIB(internalproj,internal_proj_create_from_wkt,PROJ_FOUND=yes,PROJ_FOUND=no,) 1482 AC_LANG_POP([C++]) 1483 if test "$PROJ_FOUND" = "yes"; then 1484 PROJ_INCLUDE="-DPROJ_RENAME_SYMBOLS" 1485 fi 1486 fi 1487 if test "$PROJ_FOUND" = "no"; then 1488 AC_MSG_ERROR([PROJ 6 symbols not found]) 1489 fi 1490 AC_CHECK_HEADERS([proj.h]) 1491 if test "$ac_cv_header_proj_h" = "yes" ; then 1492 AC_MSG_NOTICE([proj.h found]) 1493 else 1494 AC_MSG_ERROR([proj.h not found]) 1495 fi 1496 else 1497 ORIG_LIBS="$LIBS" 1498 LIBS="-L$with_proj/lib -lproj $with_proj_extra_lib_for_test $ORIG_LIBS" 1499 AC_LANG_PUSH([C++]) 1500 AC_CHECK_LIB(proj,proj_create_from_wkt,PROJ_FOUND=yes,PROJ_FOUND=no,) 1501 AC_LANG_POP([C++]) 1502 if test "$PROJ_FOUND" = "no"; then 1503 LIBS="-L$with_proj/lib -lproj $with_proj_extra_lib_for_test $ORIG_LIBS" 1504 unset ac_cv_lib_proj_proj_create_from_wkt 1505 AC_LANG_PUSH([C++]) 1506 AC_CHECK_LIB(proj,proj_create_from_wkt,PROJ_FOUND=yes,PROJ_FOUND=no,) 1507 AC_LANG_POP([C++]) 1508 fi 1509 if test "$PROJ_FOUND" = "no"; then 1510 LIBS="-L$with_proj/lib64 -lproj $with_proj_extra_lib_for_test $ORIG_LIBS" 1511 unset ac_cv_lib_proj_proj_create_from_wkt 1512 AC_LANG_PUSH([C++]) 1513 AC_CHECK_LIB(proj,proj_create_from_wkt,PROJ_FOUND=yes,PROJ_FOUND=no,) 1514 AC_LANG_POP([C++]) 1515 fi 1516 if test "$PROJ_FOUND" = "no"; then 1517 LIBS="-L$with_proj/lib -lproj $with_proj_extra_lib_for_test $ORIG_LIBS" 1518 AC_LANG_PUSH([C++]) 1519 AC_CHECK_LIB(proj,internal_proj_create_from_wkt,PROJ_FOUND=yes,PROJ_FOUND=no,) 1520 AC_LANG_POP([C++]) 1521 if test "$PROJ_FOUND" = "no"; then 1522 LIBS="-L$with_proj/lib -lproj $with_proj_extra_lib_for_test $ORIG_LIBS" 1523 unset ac_cv_lib_proj_internal_proj_create_from_wkt 1524 AC_LANG_PUSH([C++]) 1525 AC_CHECK_LIB(proj,internal_proj_create_from_wkt,PROJ_FOUND=yes,PROJ_FOUND=no,) 1526 AC_LANG_POP([C++]) 1527 fi 1528 if test "$PROJ_FOUND" = "yes"; then 1529 PROJ_INCLUDE="-DPROJ_RENAME_SYMBOLS" 1530 fi 1531 fi 1532 if test "$PROJ_FOUND" = "no"; then 1533 LIBS="-L$with_proj/lib -linternalproj $with_proj_extra_lib_for_test $ORIG_LIBS" 1534 AC_LANG_PUSH([C++]) 1535 AC_CHECK_LIB(internalproj,internal_proj_create_from_wkt,PROJ_FOUND=yes,PROJ_FOUND=no,) 1536 AC_LANG_POP([C++]) 1537 if test "$PROJ_FOUND" = "no"; then 1538 LIBS="-L$with_proj/lib -linternalproj $with_proj_extra_lib_for_test $ORIG_LIBS" 1539 unset ac_cv_lib_internal_proj_internal_proj_create_from_wkt 1540 AC_LANG_PUSH([C++]) 1541 AC_CHECK_LIB(internalproj,internal_proj_create_from_wkt,PROJ_FOUND=yes,PROJ_FOUND=no,) 1542 AC_LANG_POP([C++]) 1543 fi 1544 if test "$PROJ_FOUND" = "yes"; then 1545 PROJ_INCLUDE="-DPROJ_RENAME_SYMBOLS" 1546 fi 1547 fi 1548 if test "$PROJ_FOUND" = "no"; then 1549 AC_MSG_ERROR([PROJ 6 symbols not found]) 1550 fi 1551 if test -r "$with_proj/include/proj.h" ; then 1552 PROJ_INCLUDE="$PROJ_INCLUDE -I$with_proj/include" 1553 AC_MSG_NOTICE([proj.h found]) 1554 else 1555 AC_MSG_ERROR([proj.h not found]) 1556 fi 1557 fi 1558fi 1559 1560AC_SUBST(PROJ_INCLUDE) 1561 1562dnl --------------------------------------------------------------------------- 1563dnl Check for SpatiaLite. 1564dnl --------------------------------------------------------------------------- 1565 1566AC_MSG_CHECKING(for spatialite) 1567 1568AC_ARG_WITH(spatialite, 1569 [ --with-spatialite=ARG Include SpatiaLite support (ARG=no(default), yes, dlopen (only supported for Spatialite >= 4.1.2) or path)], 1570 ,,) 1571 1572AC_ARG_WITH(spatialite-soname, 1573 [ --with-spatialite-soname=ARG Spatialite shared object name (e.g. libspatialite.so), only used if --with-spatialite=dlopen], 1574 ,,) 1575 1576HAVE_SPATIALITE=no 1577 1578if test -z "$with_spatialite" -o "$with_spatialite" = "no"; then 1579 AC_MSG_RESULT(disabled) 1580elif test "$with_spatialite" = "yes"; then 1581 AC_CHECK_HEADERS(sqlite3.h) 1582 if test "$ac_cv_header_sqlite3_h" = "yes"; then 1583 AC_MSG_CHECKING([for spatialite.h in /usr/include or /usr/local/include]) 1584 if test -f "/usr/include/spatialite.h" -o -f "/usr/local/include/spatialite.h"; then 1585 AC_MSG_RESULT(found) 1586 AC_CHECK_LIB(spatialite,spatialite_init,SPATIALITE_INIT_FOUND=yes,SPATIALITE_INIT_FOUND=no,-lsqlite3) 1587 if test "$SPATIALITE_INIT_FOUND" = "yes"; then 1588 HAVE_SPATIALITE=yes 1589 SPATIALITE_LIBS="-lspatialite -lsqlite3" 1590 LIBS="$LIBS $SPATIALITE_LIBS" 1591 HAVE_SQLITE3=yes 1592 fi 1593 else 1594 AC_MSG_RESULT(not found : spatialite support disabled) 1595 fi 1596 fi 1597elif test "$with_spatialite" = "dlopen"; then 1598 HAVE_SPATIALITE=dlopen 1599 AC_MSG_RESULT(dlopen) 1600 1601 if test "$with_spatialite_soname" != ""; then 1602 SPATIALITE_SONAME="$with_spatialite_soname" 1603 else 1604 SPATIALITE_SONAME="spatialite.so" 1605 fi 1606else 1607 AC_CHECK_LIB(spatialite,spatialite_init,SPATIALITE_INIT_FOUND=yes,SPATIALITE_INIT_FOUND=no,-L$with_spatialite/lib -lspatialite) 1608 1609 if test -f "$with_spatialite/include/spatialite.h" -a \ 1610 "$SPATIALITE_INIT_FOUND" = "yes"; then 1611 1612 if test "$HAVE_SQLITE3" = "yes"; then 1613 SPATIALITE_INC="-I$with_spatialite/include" 1614 HAVE_SPATIALITE=yes 1615 SPATIALITE_LIBS="-L$with_spatialite/lib -lspatialite" 1616 LIBS="$SQLITE3_LDFLAGS $LIBS $SPATIALITE_LIBS" 1617 AC_MSG_RESULT(spatialite enabled) 1618 else 1619 AC_MSG_RESULT(spatialite disabled) 1620 fi 1621 else 1622 AC_MSG_RESULT(disabled) 1623 fi 1624fi 1625 1626if test "$HAVE_SPATIALITE" = "yes"; then 1627 AC_CHECK_LIB(spatialite,spatialite_target_cpu,SPATIALITE_412_OR_LATER=yes,SPATIALITE_412_OR_LATER=no) 1628fi 1629 1630AC_SUBST([HAVE_SPATIALITE], $HAVE_SPATIALITE) 1631AC_SUBST([SPATIALITE_SONAME], $SPATIALITE_SONAME) 1632AC_SUBST([SPATIALITE_INC], $SPATIALITE_INC) 1633AC_SUBST([SPATIALITE_412_OR_LATER], $SPATIALITE_412_OR_LATER) 1634 1635dnl --------------------------------------------------------------------------- 1636dnl Check if liblzma is available. 1637dnl --------------------------------------------------------------------------- 1638 1639AC_ARG_WITH(liblzma,[ --with-liblzma[=ARG] Include liblzma support (ARG=yes/no)],,) 1640 1641if test "$with_liblzma" = "yes" ; then 1642 AC_CHECK_LIB(lzma,lzma_code,LIBLZMA_SETTING=yes,LIBLZMA_SETTING=no,) 1643 AC_CHECK_HEADERS(lzma.h) 1644 1645 if test "$LIBLZMA_SETTING" = "yes" -a "$ac_cv_header_lzma_h" = "yes" ; then 1646 LIBS="-llzma $LIBS" 1647 else 1648 LIBLZMA_SETTING=no 1649 fi 1650else 1651 LIBLZMA_SETTING=no 1652fi 1653 1654AC_SUBST(LIBLZMA_SETTING,$LIBLZMA_SETTING) 1655 1656 1657dnl --------------------------------------------------------------------------- 1658dnl Check if zstd is available. 1659dnl --------------------------------------------------------------------------- 1660 1661AC_ARG_WITH(zstd,[ --with-zstd[=ARG] Include zstd support (ARG=yes/no/installation_prefix)],,) 1662 1663if test "$with_zstd" = "" -o "$with_zstd" = "yes" ; then 1664 AC_CHECK_LIB(zstd,ZSTD_decompressStream,ZSTD_SETTING=yes,ZSTD_SETTING=no,) 1665 1666 if test "$ZSTD_SETTING" = "yes" ; then 1667 LIBS="-lzstd $LIBS" 1668 else 1669 if test "$with_zstd" = "yes" ; then 1670 AC_MSG_ERROR([libzstd not found]) 1671 else 1672 echo "libzstd not found - ZSTD support disabled" 1673 fi 1674 fi 1675elif test "$with_zstd" != "" -a "$with_zstd" != "no"; then 1676 1677 AC_CHECK_LIB(zstd,ZSTD_decompressStream,ZSTD_SETTING=yes,ZSTD_SETTING=no,-L$with_zstd/lib) 1678 1679 if test "$ZSTD_SETTING" = "yes" -a -f "$with_zstd/include/zstd.h" ; then 1680 LIBS="-L$with_zstd/lib -lzstd $LIBS" 1681 EXTRA_INCLUDES="-I$with_zstd/include $EXTRA_INCLUDES" 1682 else 1683 AC_MSG_ERROR([libzstd not found]) 1684 fi 1685 1686else 1687 ZSTD_SETTING=no 1688fi 1689 1690AC_SUBST(ZSTD_SETTING,$ZSTD_SETTING) 1691 1692dnl --------------------------------------------------------------------------- 1693dnl Set up drivers and formats 1694dnl --------------------------------------------------------------------------- 1695 1696GDALFORMATS_ENABLED= 1697GDALFORMATS_DISABLED= 1698OGRFORMATS_ENABLED= 1699OGRFORMATS_ENABLED_CFLAGS= 1700OGRFORMATS_DISABLED= 1701 1702AC_DEFUN([INTERNAL_FORMATS],[aaigrid adrg aigrid airsar arg blx bmp bsb cals ceos ceos2 coasp cosar ctg dimap dted elas envisat ers esric fit gff gsg gxf hf2 idrisi ilwis ingr iris iso8211 jaxapalsar jdem kmlsuperoverlay l1b leveller map mrf msgn ngsgeoid nitf northwood pds prf r raw rmf rs2 safe saga sdts sentinel2 sgi sigdem srtmhgt stacta terragen tga til tsx usgsdem xpm xyz zmap]) 1703AC_DEFUN([INTERNAL_OPT_FORMATS],[grib ozi pdf rik]) 1704AC_DEFUN([INTERNAL_DRIVERS],[arcgen avc cad csv dgn dxf edigeo flatgeobuf geoconcept georss gml gmt gpsbabel gpx gtm jml mapml mvt ntf openfilegdb pgdump rec s57 selafin shape svg sxf tiger vdv wasp])dnl 1705AC_DEFUN([CURL_FORMATS],[eeda plmosaic rda wcs wms wmts daas ogcapi])dnl 1706AC_DEFUN([CURL_DRIVERS],[amigocloud carto cloudant couchdb csw elastic ngw plscenes wfs])dnl 1707AC_DEFUN([SQLITE_FORMATS],[rasterlite mbtiles])dnl 1708AC_DEFUN([SQLITE_DRIVERS],[gpkg vfk osm])dnl 1709AC_DEFUN([EXPAT_DRIVERS],[ods xlsx lvbag])dnl 1710AC_DEFUN([XERCES_DRIVERS],[nas ili gmlas])dnl 1711AC_DEFUN([ODBC_DRIVERS],[odbc pgeo mssqlspatial geomedia walk])dnl 1712 1713AC_ARG_ENABLE(all-optional-drivers, AS_HELP_STRING([--disable-all-optional-drivers], [disable all non-mandatory internal drivers. Individual drivers can be added with --enable-driver-XXX])) 1714if test "x$enable_all_optional_drivers" = "xno"; then : 1715 all_drivers_disabled=yes 1716else 1717 all_drivers_disabled=no 1718fi 1719 1720m4_define([ARG_DRIVER_ENABLED],[dnl 1721cur_driver_enabled=yes 1722requested=m4_join([_],[$enable_driver],$1) 1723if test "$all_drivers_disabled" = "yes"; then : 1724 if test "x$requested" = "xyes"; then : 1725 cur_driver_enabled=yes 1726 else 1727 cur_driver_enabled=no 1728 fi 1729else 1730 if test "x$requested" != "xno"; then : 1731 cur_driver_enabled=yes 1732 else 1733 cur_driver_enabled=no 1734 fi 1735fi 1736]) 1737 1738 1739 1740m4_foreach_w([frmt], INTERNAL_FORMATS, 1741[ 1742AC_ARG_ENABLE(driver-frmt, AS_HELP_STRING([--disable-driver-frmt], [disable frmt driver support (enabled by default)]))dnl 1743ARG_DRIVER_ENABLED(frmt) 1744if test "$cur_driver_enabled" = "yes"; then : 1745 GDALFORMATS_ENABLED="$GDALFORMATS_ENABLED frmt" 1746 m4_join([_],[INTERNAL_FORMAT],frmt,[ENABLED])=yes 1747else 1748 GDALFORMATS_DISABLED="$GDALFORMATS_DISABLED frmt" 1749 m4_join([_],[INTERNAL_FORMAT],frmt,[ENABLED])=no 1750fi 1751]) 1752 1753m4_foreach_w([frmt],INTERNAL_OPT_FORMATS, 1754[ 1755AC_ARG_ENABLE(driver-frmt, AS_HELP_STRING([--disable-driver-frmt], [disable frmt format support (enabled by default, requires dependency)]))dnl 1756ARG_DRIVER_ENABLED(frmt) 1757if test "$cur_driver_enabled" = "yes"; then : 1758 m4_join([_],[INTERNAL_FORMAT],frmt,[ENABLED])=yes 1759else 1760 GDALFORMATS_DISABLED="$GDALFORMATS_DISABLED frmt" 1761 m4_join([_],[INTERNAL_FORMAT],frmt,[ENABLED])=no 1762fi 1763]) 1764 1765m4_define([_OGRDEFINE],[m4_join([],[-D],m4_toupper([$1]),[_ENABLED])]) 1766 1767m4_foreach_w([frmt],INTERNAL_DRIVERS, 1768[ 1769AC_ARG_ENABLE(driver-frmt, AS_HELP_STRING([--disable-driver-frmt], [disable frmt driver support (enabled by default)]))dnl 1770ARG_DRIVER_ENABLED(frmt) 1771if test "$cur_driver_enabled" = "yes"; then : 1772 OGRFORMATS_ENABLED="$OGRFORMATS_ENABLED frmt" 1773 m4_join([_],[INTERNAL_FORMAT],frmt,[ENABLED])=yes 1774 OGRFORMATS_ENABLED_CFLAGS="$OGRFORMATS_ENABLED_CFLAGS _OGRDEFINE(frmt)" 1775else 1776 OGRFORMATS_DISABLED="$OGRFORMATS_DISABLED frmt" 1777 m4_join([_],[INTERNAL_FORMAT],frmt,[ENABLED])=no 1778fi 1779]) 1780 1781AC_DEFUN([INTERNAL_DRIVERS_WITH_SAME_NAME_AS_FORMAT],[idrisi pds sdts])dnl 1782m4_foreach_w([frmt],INTERNAL_DRIVERS_WITH_SAME_NAME_AS_FORMAT, 1783[ 1784driver_enabled=m4_join([_],[$INTERNAL_FORMAT],frmt,[ENABLED]) 1785if test "x$driver_enabled" != "xno"; then : 1786 OGRFORMATS_ENABLED="$OGRFORMATS_ENABLED frmt" 1787 OGRFORMATS_ENABLED_CFLAGS="$OGRFORMATS_ENABLED_CFLAGS _OGRDEFINE(frmt)" 1788else 1789 OGRFORMATS_DISABLED="$OGRFORMATS_DISABLED frmt" 1790fi 1791]) 1792 1793m4_foreach_w([frmt],CURL_FORMATS, 1794[ 1795AC_ARG_ENABLE(driver-frmt, AS_HELP_STRING([--disable-driver-frmt], [disable frmt format support (enabled by default, requires curl)]))dnl 1796ARG_DRIVER_ENABLED(frmt) 1797if test "$cur_driver_enabled" = "yes"; then : 1798 m4_join([_],[INTERNAL_FORMAT],frmt,[ENABLED])=yes 1799else 1800 GDALFORMATS_DISABLED="$GDALFORMATS_DISABLED frmt" 1801 m4_join([_],[INTERNAL_FORMAT],frmt,[ENABLED])=no 1802fi 1803]) 1804 1805m4_foreach_w([frmt],CURL_DRIVERS, 1806[ 1807AC_ARG_ENABLE(driver-frmt, AS_HELP_STRING([--disable-driver-frmt], [disable frmt driver support (enabled by default, requires curl)]))dnl 1808ARG_DRIVER_ENABLED(frmt) 1809if test "$cur_driver_enabled" = "yes"; then : 1810 m4_join([_],[INTERNAL_FORMAT],frmt,[ENABLED])=yes 1811else 1812 OGRFORMATS_DISABLED="$OGRFORMATS_DISABLED frmt" 1813 m4_join([_],[INTERNAL_FORMAT],frmt,[ENABLED])=no 1814fi 1815]) 1816 1817m4_foreach_w([frmt],SQLITE_FORMATS, 1818[ 1819AC_ARG_ENABLE(driver-frmt, AS_HELP_STRING([--disable-driver-frmt], [disable frmt format support (enabled by default, requires sqlite3)]))dnl 1820ARG_DRIVER_ENABLED(frmt) 1821if test "$cur_driver_enabled" = "yes"; then : 1822 m4_join([_],[INTERNAL_FORMAT],frmt,[ENABLED])=yes 1823else 1824 GDALFORMATS_DISABLED="$GDALFORMATS_DISABLED frmt" 1825 m4_join([_],[INTERNAL_FORMAT],frmt,[ENABLED])=no 1826fi 1827]) 1828 1829m4_foreach_w([frmt],SQLITE_DRIVERS, 1830[ 1831AC_ARG_ENABLE(driver-frmt, AS_HELP_STRING([--disable-driver-frmt], [disable frmt driver support (enabled by default, requires sqlite3)]))dnl 1832ARG_DRIVER_ENABLED(frmt) 1833if test "$cur_driver_enabled" = "yes"; then : 1834 m4_join([_],[INTERNAL_FORMAT],frmt,[ENABLED])=yes 1835else 1836 OGRFORMATS_DISABLED="$OGRFORMATS_DISABLED frmt" 1837 m4_join([_],[INTERNAL_FORMAT],frmt,[ENABLED])=no 1838fi 1839]) 1840 1841m4_foreach_w([frmt],EXPAT_DRIVERS, 1842[ 1843AC_ARG_ENABLE(driver-frmt, AS_HELP_STRING([--disable-driver-frmt], [disable frmt driver support (enabled by default, requires expat)]))dnl 1844ARG_DRIVER_ENABLED(frmt) 1845if test "$cur_driver_enabled" = "yes"; then : 1846 m4_join([_],[INTERNAL_FORMAT],frmt,[ENABLED])=yes 1847else 1848 OGRFORMATS_DISABLED="$OGRFORMATS_DISABLED frmt" 1849 m4_join([_],[INTERNAL_FORMAT],frmt,[ENABLED])=no 1850fi 1851]) 1852 1853m4_foreach_w([frmt],XERCES_DRIVERS, 1854[ 1855AC_ARG_ENABLE(driver-frmt, AS_HELP_STRING([--disable-driver-frmt], [disable frmt driver support (enabled by default, requires xerces-c)]))dnl 1856ARG_DRIVER_ENABLED(frmt) 1857if test "$cur_driver_enabled" = "yes"; then : 1858 m4_join([_],[INTERNAL_FORMAT],frmt,[ENABLED])=yes 1859else 1860 OGRFORMATS_DISABLED="$OGRFORMATS_DISABLED frmt" 1861 m4_join([_],[INTERNAL_FORMAT],frmt,[ENABLED])=no 1862fi 1863]) 1864 1865m4_foreach_w([frmt],ODBC_DRIVERS, 1866[ 1867AC_ARG_ENABLE(driver-frmt, AS_HELP_STRING([--disable-driver-frmt], [disable frmt driver support (enabled by default, requires odbc)]))dnl 1868ARG_DRIVER_ENABLED(frmt) 1869if test "$cur_driver_enabled" = "yes"; then : 1870 m4_join([_],[INTERNAL_FORMAT],frmt,[ENABLED])=yes 1871else 1872 OGRFORMATS_DISABLED="$OGRFORMATS_DISABLED frmt" 1873 m4_join([_],[INTERNAL_FORMAT],frmt,[ENABLED])=no 1874fi 1875]) 1876 1877AC_SUBST(OGRFORMATS_ENABLED,$OGRFORMATS_ENABLED) 1878AC_SUBST(OGRFORMATS_ENABLED_CFLAGS,$OGRFORMATS_ENABLED_CFLAGS) 1879AC_SUBST(GDALFORMATS_ENABLED,$GDALFORMATS_ENABLED) 1880 1881if test "$LIBZ_SETTING" != "no" ; then 1882 if test "x$INTERNAL_FORMAT_rik_ENABLED" = "xyes"; then 1883 GDALFORMATS_ENABLED="$GDALFORMATS_ENABLED rik" 1884 fi 1885 if test "x$INTERNAL_FORMAT_ozi_ENABLED" = "xyes"; then 1886 GDALFORMATS_ENABLED="$GDALFORMATS_ENABLED ozi" 1887 fi 1888fi 1889 1890if test "$CURL_SETTING" = "yes" ; then 1891 1892 CURL_INC=`$LIBCURL_CONFIG --cflags` 1893 CURL_LIB=`$LIBCURL_CONFIG --libs` 1894m4_foreach_w([frmt],CURL_FORMATS,[ 1895 driver_enabled=m4_join([_],[$INTERNAL_FORMAT],frmt,[ENABLED]) 1896 if test "x$driver_enabled" = "xyes"; then 1897 GDALFORMATS_ENABLED="$GDALFORMATS_ENABLED frmt" 1898 fi 1899]) 1900m4_foreach_w([frmt],CURL_DRIVERS,[ 1901 driver_enabled=m4_join([_],[$INTERNAL_FORMAT],frmt,[ENABLED]) 1902 if test "x$driver_enabled" = "xyes"; then 1903 OGRFORMATS_ENABLED="$OGRFORMATS_ENABLED frmt" 1904 OGRFORMATS_ENABLED_CFLAGS="$OGRFORMATS_ENABLED_CFLAGS _OGRDEFINE(frmt)" 1905 fi 1906]) 1907 1908fi 1909 1910if test "$HAVE_SQLITE3" = "yes"; then 1911m4_foreach_w([frmt],SQLITE_FORMATS,[ 1912 driver_enabled=m4_join([_],[$INTERNAL_FORMAT],frmt,[ENABLED]) 1913 if test "x$driver_enabled" = "xyes"; then 1914 GDALFORMATS_ENABLED="$GDALFORMATS_ENABLED frmt" 1915 fi 1916]) 1917 1918m4_foreach_w([frmt],SQLITE_DRIVERS,[ 1919 driver_enabled=m4_join([_],[$INTERNAL_FORMAT],frmt,[ENABLED]) 1920 if test "x$driver_enabled" = "xyes"; then 1921 OGRFORMATS_ENABLED="$OGRFORMATS_ENABLED frmt" 1922 OGRFORMATS_ENABLED_CFLAGS="$OGRFORMATS_ENABLED_CFLAGS _OGRDEFINE(frmt)" 1923 fi 1924]) 1925 1926fi 1927 1928dnl --------------------------------------------------------------------------- 1929dnl Select an PostgreSQL Library to use, or disable driver. 1930dnl --------------------------------------------------------------------------- 1931 1932PG_CONFIG=no 1933 1934AC_ARG_WITH(pg, 1935 AS_HELP_STRING([--with-pg[=ARG]], 1936 [Include PostgreSQL GDAL/OGR Support (ARG=yes,no)]),,) 1937 1938if test "x$with_pg" = "xyes" -o "x$with_pg" = "x" ; then 1939 PG_CONFIG=yes 1940elif test "x$with_pg" != "xno"; then 1941 AC_MSG_ERROR([Only --with-pg=yes/no supported]) 1942fi 1943 1944AC_MSG_CHECKING([for PostgreSQL]) 1945 1946if test "x$PG_CONFIG" = "xno" ; then 1947 1948 HAVE_PG=no 1949 PG_LIB= 1950 PG_INC= 1951 1952 AC_MSG_RESULT([no]) 1953 1954else 1955 1956 PKG_PROG_PKG_CONFIG([0.21]) 1957 PKG_CHECK_MODULES([PQ],[libpq > 9.1], [HAVE_PG=yes], [HAVE_PG=no]) 1958 1959 if test "${HAVE_PG}" = "yes" ; then 1960 PG_LIB="${PQ_LIBS}" 1961 PG_INC="${PQ_CFLAGS}" 1962 SAVED_LIBS="${LIBS}" 1963 LIBS="${PG_LIB}" 1964 AC_CHECK_LIB(pq,PQconnectdb,HAVE_PG=yes,HAVE_PG=no) 1965 LIBS="${SAVED_LIBS}" 1966 if test "${HAVE_PG}" = "yes" ; then 1967 LIBS="${PG_LIB} ${LIBS}" 1968 fi 1969 else 1970 if test "x$with_pg" = "xyes"; then 1971 AC_MSG_ERROR([--with-pg was requested, but libpq is not available]) 1972 fi 1973 fi 1974 1975fi 1976 1977AC_SUBST(HAVE_PG,$HAVE_PG) 1978AC_SUBST(PG_INC,$PG_INC) 1979AC_SUBST(PG_LIB,$PG_LIB) 1980 1981dnl --------------------------------------------------------------------------- 1982dnl Check if we should build with GRASS support. 1983dnl --------------------------------------------------------------------------- 1984 1985GRASS_SETTING=no 1986GRASS_INCLUDE= 1987HAVE_GRASS=no 1988export GRASS_INCLUDE GRASS_SETTING 1989 1990AC_ARG_WITH(grass,[ --with-grass[=ARG] Include GRASS support (GRASS 5.7+, ARG=GRASS install tree dir)],,) 1991 1992AC_ARG_WITH(libgrass,[ --with-libgrass[=ARG] Include GRASS support based on libgrass (GRASS 5.0+)],,) 1993 1994# default use of grass libraries off since we can't easily auto-find them. 1995if test "$with_grass" = "" ; then 1996 with_grass=no 1997fi 1998 1999# Check for GRASS 5.7.0 or later library use. 2000# TODO: separate libs for rasters and vectors 2001if test "$with_grass" != "yes" -a "$with_grass" != "no" ; then 2002 2003 AC_CHECK_LIB(grass_gis,G_is_initialized,GRASS_SETTING=grass70+,GRASS_SETTING=no,-L$with_grass/lib -lgrass_datetime) 2004 if test "$GRASS_SETTING" = "no" ; then 2005 AC_CHECK_LIB(grass_gis,G_asprintf,GRASS_SETTING=grass57+,GRASS_SETTING=no,-L$with_grass/lib -lgrass_datetime) 2006 fi 2007 2008 if test "$GRASS_SETTING" != "no" ; then 2009 if test "$GRASS_SETTING" = "grass70+" ; then 2010 G_RASTLIBS="-lgrass_raster -lgrass_imagery" 2011 G_VECTLIBS="-lgrass_vector -lgrass_dig2 -lgrass_dgl -lgrass_rtree -lgrass_linkm -lgrass_dbmiclient -lgrass_dbmibase" 2012 LIBS="-L$with_grass/lib $G_VECTLIBS $G_RASTLIBS -lgrass_gproj -lgrass_gmath -lgrass_gis -lgrass_datetime $LIBS" 2013 else 2014 G_RASTLIBS="-lgrass_I" 2015 G_VECTLIBS="-lgrass_vect -lgrass_dig2 -lgrass_dgl -lgrass_rtree -lgrass_linkm -lgrass_dbmiclient -lgrass_dbmibase" 2016 LIBS="-L$with_grass/lib $G_VECTLIBS $G_RASTLIBS -lgrass_gproj -lgrass_vask -lgrass_gmath -lgrass_gis -lgrass_datetime $LIBS" 2017 fi 2018 GRASS_INCLUDE="-I$with_grass/include" 2019 GRASS_GISBASE="$with_grass" 2020 HAVE_GRASS=yes 2021 else 2022 AC_MSG_ERROR([--with-grass=$with_grass requested, but libraries not found!]) 2023 fi 2024 2025# Check if libgrass is disabled. 2026elif test "$with_libgrass" = "no" ; then 2027 2028 echo "GRASS support disabled." 2029 2030elif test "$with_libgrass" = "yes" -o "$with_libgrass" = "" ; then 2031 2032 AC_CHECK_LIB(grass5,G_gisinit_2,GRASS_SETTING=libgrass,GRASS_SETTING=no,) 2033 2034 if test "$GRASS_SETTING" = "libgrass" ; then 2035 LIBS="-lgrass5 $LIBS" 2036 fi 2037 2038else 2039 2040 AC_CHECK_LIB(grass5,G_gisinit_2,GRASS_SETTING=libgrass,GRASS_SETTING=no,-L$with_libgrass/lib) 2041 2042 if test "$GRASS_SETTING" = "libgrass" ; then 2043 LIBS="-L$with_libgrass -L$with_libgrass/lib -lgrass5 $LIBS" 2044 GRASS_INCLUDE="-I$with_libgrass -I$with_libgrass/include $EXTRA_INCLUDES" 2045 else 2046 AC_MSG_ERROR([--with-libgrass=$with_grass requested, but libgrass5 not found!]) 2047 fi 2048fi 2049 2050AC_SUBST(GRASS_SETTING,$GRASS_SETTING) 2051AC_SUBST(GRASS_INCLUDE,$GRASS_INCLUDE) 2052AC_SUBST(GRASS_GISBASE,$GRASS_GISBASE) 2053AC_SUBST(HAVE_GRASS) 2054 2055if test "$GRASS_SETTING" != "no" ; then 2056 OPT_GDAL_FORMATS="grass $OPT_GDAL_FORMATS" 2057fi 2058 2059dnl --------------------------------------------------------------------------- 2060dnl Check if cfitsio library is available. 2061dnl --------------------------------------------------------------------------- 2062 2063AC_ARG_WITH(cfitsio,[ --with-cfitsio[=ARG] Include FITS support (ARG=no or libcfitsio path)],,) 2064 2065if test "$with_cfitsio" = "no" ; then 2066 2067 FITS_SETTING=no 2068 2069 echo "FITS support disabled." 2070 2071elif test "$with_cfitsio" = "yes" -o "$with_cfitsio" = "" ; then 2072 2073 AC_CHECK_LIB(cfitsio,ffopen,FITS_SETTING=external,FITS_SETTING=no,) 2074 2075 if test "$FITS_SETTING" = "external" ; then 2076 LIBS="-lcfitsio $LIBS" 2077 echo "using pre-installed libcfitsio." 2078 else 2079 echo "libcfitsio not found - FITS support disabled" 2080 fi 2081 2082dnl Fedora has cfitsio headers in /usr/include/cfitsio 2083 if test "$FITS_SETTING" = "external" -a -d /usr/include/cfitsio ; then 2084 EXTRA_INCLUDES="-I/usr/include/cfitsio $EXTRA_INCLUDES" 2085 fi 2086 2087else 2088 2089 FITS_SETTING=external 2090 LIBS="-L$with_cfitsio -L$with_cfitsio/lib -lcfitsio $LIBS" 2091 EXTRA_INCLUDES="-I$with_cfitsio -I$with_cfitsio/include $EXTRA_INCLUDES" 2092 2093 echo "using libcfitsio from $with_cfitsio." 2094fi 2095 2096AC_SUBST(FITS_SETTING,$FITS_SETTING) 2097 2098if test "$FITS_SETTING" != "no" ; then 2099 OPT_GDAL_FORMATS="fits $OPT_GDAL_FORMATS" 2100fi 2101 2102dnl --------------------------------------------------------------------------- 2103dnl Check if PCRaster (libcsf) library is available. 2104dnl --------------------------------------------------------------------------- 2105 2106AC_ARG_WITH(pcraster,[ --with-pcraster[=ARG] Include PCRaster (libcsf) support (ARG=internal, no or path)],,) 2107 2108if test "$with_pcraster" = "no" ; then 2109 2110 PCRASTER_SETTING=no 2111 2112 echo "PCRaster support disabled." 2113 2114elif test "$with_pcraster" = "yes" -o "$with_pcraster" = "" ; then 2115 2116 AC_CHECK_LIB(csf,Mopen,PCRASTER_SETTING=external,PCRASTER_SETTING=internal,$LIBS) 2117 AC_CHECK_HEADERS(csf.h) 2118 2119 if test "$PCRASTER_SETTING" = "external" -a "$ac_cv_header_csf_h" = "no" ; then 2120 PCRASTER_SETTING=internal 2121 fi 2122 2123 if test "$PCRASTER_SETTING" = "external" ; then 2124 LIBS="-lcsf $LIBS" 2125 echo "using pre-installed libcsf." 2126 else 2127 echo "using internal csf code." 2128 fi 2129 2130elif test "$with_pcraster" = "internal" ; then 2131 2132 PCRASTER_SETTING=internal 2133 2134 echo "using internal csf code." 2135 2136else 2137 2138 PCRASTER_SETTING=external 2139 LIBS="-L$with_pcraster/lib -lcsf $LIBS" 2140 EXTRA_INCLUDES="-I$with_pcraster/include $EXTRA_INCLUDES" 2141 2142 echo "using libcsf from $with_pcraster." 2143 2144fi 2145 2146AC_SUBST(PCRASTER_SETTING,$PCRASTER_SETTING) 2147 2148if test "$PCRASTER_SETTING" != "no" ; then 2149 OPT_GDAL_FORMATS="pcraster $OPT_GDAL_FORMATS" 2150fi 2151 2152dnl --------------------------------------------------------------------------- 2153dnl Select a PNG Library to use, or disable driver. 2154dnl --------------------------------------------------------------------------- 2155 2156AC_ARG_WITH([png], [ --with-png[=ARG] Include PNG support (ARG=internal, no or path)],,) 2157 2158AC_MSG_CHECKING([for libpng]) 2159 2160if test "$with_png" = "no" ; then 2161 2162 PNG_SETTING=no 2163 2164 echo "png support disabled." 2165 2166elif test "$with_png" = "yes" -o "$with_png" = "" ; then 2167 2168 AC_CHECK_LIB([png], [png_set_IHDR], [PNG_SETTING=external], [PNG_SETTING=internal], [$LIBS]) 2169 AC_CHECK_HEADERS([png.h]) 2170 2171 if test "$PNG_SETTING" = "external" -a "$ac_cv_header_png_h" = "no" ; then 2172 PNG_SETTING=internal 2173 fi 2174 if test "$PNG_SETTING" = "external" ; then 2175 LIBS="-lpng $LIBS" 2176 echo "using pre-installed libpng." 2177 else 2178 echo "using internal png code." 2179 fi 2180 2181elif test "$with_png" = "internal" ; then 2182 2183 PNG_SETTING=internal 2184 2185 echo "using internal png code." 2186 2187else 2188 2189 PNG_SETTING=external 2190 LIBS="-L$with_png -L$with_png/lib -lpng $LIBS" 2191 EXTRA_INCLUDES="-I$with_png -I$with_png/include $EXTRA_INCLUDES" 2192 2193 echo "using libpng from $with_png." 2194 2195fi 2196 2197AC_SUBST([PNG_SETTING], [$PNG_SETTING]) 2198 2199if test "$PNG_SETTING" != "no" ; then 2200 OPT_GDAL_FORMATS="png $OPT_GDAL_FORMATS" 2201 if test "x$INTERNAL_FORMAT_grib_ENABLED" = "xyes"; then 2202 GDALFORMATS_ENABLED="$GDALFORMATS_ENABLED grib" 2203 fi 2204fi 2205 2206dnl --------------------------------------------------------------------------- 2207dnl Enable DDS driver. 2208dnl --------------------------------------------------------------------------- 2209 2210AC_ARG_WITH([dds], [ --with-dds[=ARG] Include DDS support (ARG=no, or path)],,) 2211 2212AC_MSG_CHECKING([for libcrunch]) 2213 2214if test "$with_dds" = "no" -o "$with_dds" = ""; then 2215 2216 DDS_SETTING="no" 2217 CRUNCHDIR="" 2218 2219 echo "dds support disabled." 2220 2221else 2222 2223 DDS_SETTING=yes 2224 CRUNCHDIR="$with_dds" 2225 LIBS="-L$with_dds/lib/ -lcrunch $LIBS" 2226 echo "using libcrunch from $with_dds." 2227 2228fi 2229 2230AC_SUBST(CRUNCHDIR,$CRUNCHDIR) 2231AC_SUBST([DDS_SETTING], [$DDS_SETTING]) 2232 2233if test "$DDS_SETTING" != "no" ; then 2234 OPT_GDAL_FORMATS="dds $OPT_GDAL_FORMATS" 2235fi 2236 2237dnl --------------------------------------------------------------------------- 2238dnl Check if GTA library is available. 2239dnl --------------------------------------------------------------------------- 2240 2241AC_ARG_WITH([gta],[ --with-gta[=ARG] Include GTA support (ARG=no or libgta tree prefix)],,) 2242 2243if test "$with_gta" = "no" ; then 2244 2245 GTA_SETTING=no 2246 2247 echo "GTA support disabled." 2248 2249elif test "$with_gta" = "yes" -o "$with_gta" = "" ; then 2250 2251 AC_CHECK_LIB([gta], [gta_version], [GTA_SETTING=yes], [GTA_SETTING=no],) 2252 2253 if test "$GTA_SETTING" = "yes" ; then 2254 LIBS="-lgta $LIBS" 2255 echo "using pre-installed libgta." 2256 else 2257 echo "libgta not found - GTA support disabled" 2258 fi 2259 2260else 2261 2262 GTA_SETTING=yes 2263 LIBS="-L$with_gta -L$with_gta/lib -lgta $LIBS" 2264 EXTRA_INCLUDES="-I$with_gta -I$with_gta/include $EXTRA_INCLUDES" 2265 2266 echo "using libgta from $with_gta." 2267fi 2268 2269AC_SUBST([GTA_SETTING], [$GTA_SETTING]) 2270 2271if test "$GTA_SETTING" != "no" ; then 2272 OPT_GDAL_FORMATS="gta $OPT_GDAL_FORMATS" 2273fi 2274 2275dnl --------------------------------------------------------------------------- 2276dnl Select PCIDSK options. 2277dnl --------------------------------------------------------------------------- 2278 2279AC_ARG_WITH([pcidsk], [ --with-pcidsk[=ARG] Path to external PCIDSK SDK or internal (default)],,) 2280 2281AC_MSG_CHECKING([for PCIDSK]) 2282 2283PCIDSK_LIB= 2284PCIDSK_INCLUDE= 2285 2286if test "$with_pcidsk" = "no" ; then 2287 2288 PCIDSK_SETTING=no 2289 2290 echo "pcidsk support disabled." 2291 2292elif test "$with_pcidsk" = "" -o "$with_pcidsk" = "yes" -o "$with_pcidsk" = "internal" ; then 2293 2294 PCIDSK_SETTING=internal 2295 2296 echo "using internal libpcidsk." 2297 2298else 2299 2300 PCIDSK_SETTING=external 2301 PCIDSK_LIB="-L$with_pcidsk/lib -lpcidsk" 2302 PCIDSK_INCLUDE="-I$with_pcidsk/include -I$with_pcidsk/include/pcidsk" 2303 2304 echo "using libpcidsk from $with_pcidsk." 2305 2306fi 2307 2308if test "$with_pcidsk" != "no" ; then 2309 2310 AC_SUBST([PCIDSK_SETTING], [$PCIDSK_SETTING]) 2311 AC_SUBST([PCIDSK_LIB], [$PCIDSK_LIB]) 2312 AC_SUBST([PCIDSK_INCLUDE], [$PCIDSK_INCLUDE]) 2313 2314fi 2315 2316dnl --------------------------------------------------------------------------- 2317dnl Select a libgeotiff library to use. 2318dnl --------------------------------------------------------------------------- 2319 2320GEOTIFF_INCLUDE= 2321AC_ARG_WITH(geotiff,[ --with-geotiff=ARG Libgeotiff library to use (ARG=internal, yes or path)],,) 2322 2323if test "$with_geotiff" = "yes" -o "$with_geotiff" = "" ; then 2324 2325 if test "$TIFF_SETTING" = "internal" ; then 2326 GEOTIFF_SETTING=internal 2327 else 2328 dnl We now require libgeotiff 1.5.0 2329 AC_CHECK_LIB(geotiff,GTIFAttachPROJContext,GEOTIFF_SETTING=external,GEOTIFF_SETTING=internal) 2330 2331 fi 2332 2333 if test "$GEOTIFF_SETTING" = "external" ; then 2334 2335 dnl Now search for headers 2336 if test -r /usr/include/geotiff.h ; then 2337 GEOTIFF_INCLUDE= 2338 dnl Debian (at least some versions of it) install in /usr/include/geotiff 2339 elif test -r /usr/include/geotiff/geotiff.h ; then 2340 GEOTIFF_INCLUDE="-I/usr/include/geotiff" 2341 dnl Fedora and OpenSuse in /usr/include/libgeotiff (#4706) 2342 elif test -r /usr/include/libgeotiff/geotiff.h ; then 2343 GEOTIFF_INCLUDE="-I/usr/include/libgeotiff" 2344 else 2345 AC_CHECK_HEADERS([geotiff.h]) 2346 if test "$ac_cv_header_geotiff_h" = "no" ; then 2347 AC_MSG_ERROR([cannot find geotiff.h]) 2348 fi 2349 fi 2350 2351 LIBS="-lgeotiff $LIBS" 2352 echo "using pre-installed libgeotiff." 2353 2354 else 2355 2356 echo "using internal GeoTIFF code." 2357 2358 fi 2359 2360elif test "$with_geotiff" = "internal" ; then 2361 2362 GEOTIFF_SETTING=internal 2363 2364 echo "using internal GeoTIFF code." 2365 2366elif test "x${with_geotiff}" = "xno" ; then 2367 2368 AC_MSG_ERROR([libgeotiff is a required dependency]) 2369 2370else 2371 2372 GEOTIFF_SETTING=external 2373 2374 dnl We now require libgeotiff 1.5.0 2375 dnl first check if $with_geotiff/lib has the library: 2376 AC_CHECK_LIB(geotiff,GTIFAttachPROJContext,GEOTIFF_SETTING=external,GEOTIFF_SETTING=not_found,-L$with_geotiff/lib) 2377 2378 if test $GEOTIFF_SETTING = "external" ; then 2379 LIBS="-L$with_geotiff/lib -lgeotiff $LIBS" 2380 if test -d $with_geotiff/include ; then 2381 EXTRA_INCLUDES="-I$with_geotiff/include $EXTRA_INCLUDES" 2382 fi 2383 else 2384 dnl check if $with_geotiff itself contains the header and library (e.g. as an uninstalled build directory would) 2385 AC_CHECK_LIB(geotiff,GTIFAttachPROJContext,GEOTIFF_SETTING=external,AC_MSG_ERROR([We require at least GeoTIFF 1.5.0. Consider using the one supplied with GDAL]),-L$with_geotiff) 2386 if test $GEOTIFF_SETTING = "external" ; then 2387 LIBS="-L$with_geotiff -lgeotiff $LIBS" 2388 EXTRA_INCLUDES="-I$with_geotiff $EXTRA_INCLUDES" 2389 fi 2390 fi 2391 2392 echo "using libgeotiff from $with_geotiff." 2393fi 2394 2395AC_SUBST(GEOTIFF_SETTING,$GEOTIFF_SETTING) 2396AC_SUBST(GEOTIFF_INCLUDE,$GEOTIFF_INCLUDE) 2397 2398 2399dnl --------------------------------------------------------------------------- 2400dnl Check for CharLS 2401dnl --------------------------------------------------------------------------- 2402 2403AC_ARG_WITH(charls, 2404 AS_HELP_STRING([--with-charls],[Include JPEG-Lossless support]),,) 2405 2406HAVE_CHARLS=no 2407CHARLS_INC= 2408 2409if test "$with_charls" = "yes" -o "$with_charls" = "" ; then 2410 dnl CharLS 2.1 2411 AC_CHECK_HEADERS([charls/version.h]) 2412 if test "$ac_cv_header_charls_version_h" = "yes"; then 2413 AC_LANG_PUSH([C++]) 2414 AC_CHECK_LIB(charls,JpegLsDecode,HAVE_CHARLS=yes) 2415 AC_LANG_POP([C++]) 2416 if test "$HAVE_CHARLS" = "yes"; then 2417 LIBS="-lcharls $LIBS" 2418 CHARLS_INC="-DCHARLS_2_1" 2419 else 2420 AC_LANG_PUSH([C++]) 2421 AC_CHECK_LIB(CharLS,JpegLsDecode,HAVE_CHARLS=yes) 2422 AC_LANG_POP([C++]) 2423 if test "$HAVE_CHARLS" = "yes"; then 2424 LIBS="-lCharLS $LIBS" 2425 CHARLS_INC="-DCHARLS_2_1" 2426 fi 2427 fi 2428 else 2429 dnl CharLS 1.x 2430 AC_CHECK_HEADERS([CharLS/interface.h]) 2431 if test "$ac_cv_header_CharLS_interface_h" = "yes"; then 2432 AC_CHECK_LIB(CharLS,JpegLsDecode,HAVE_CHARLS=yes) 2433 if test "$HAVE_CHARLS" = "yes"; then 2434 LIBS="-lCharLS $LIBS" 2435 CHARLS_INC="-DCHARLS_INTERFACE_H" 2436 fi 2437 else 2438 dnl CharLS 2.0 2439 AC_CHECK_HEADERS([CharLS/charls.h]) 2440 if test "$ac_cv_header_CharLS_charls_h" = "yes"; then 2441 AC_LANG_PUSH([C++]) 2442 AC_CHECK_LIB(CharLS,JpegLsDecode,HAVE_CHARLS=yes) 2443 AC_LANG_POP([C++]) 2444 if test "$HAVE_CHARLS" = "yes"; then 2445 LIBS="-lCharLS $LIBS" 2446 CHARLS_INC="-DCHARLS_2" 2447 fi 2448 fi 2449 fi 2450 fi 2451fi 2452 2453AC_SUBST(HAVE_CHARLS,$HAVE_CHARLS) 2454AC_SUBST(CHARLS_INC,$CHARLS_INC) 2455 2456dnl --------------------------------------------------------------------------- 2457dnl Check for BSB in the local tree. 2458dnl --------------------------------------------------------------------------- 2459 2460AC_ARG_WITH([jpeg12], 2461 AS_HELP_STRING([--without-jpeg12], 2462 [Disable JPEG 8/12bit TIFF support]),,) 2463 2464TIFF_JPEG12_ENABLED=no 2465AC_MSG_CHECKING([for jpeg12]) 2466if test "$with_jpeg12" = no ; then 2467 JPEG12_ENABLED=no 2468 AC_MSG_RESULT([disabled by user]) 2469 2470elif test "$JPEG_SETTING" = "internal" -a "$TIFF_SETTING" = "internal" ; then 2471 AC_MSG_RESULT([enabled]) 2472 JPEG12_ENABLED=yes 2473 TIFF_JPEG12_ENABLED=yes 2474 2475elif test "$with_jpeg12" = yes ; then 2476 AC_MSG_RESULT([enabled]) 2477 JPEG12_ENABLED=yes 2478 2479 echo '#include <stdlib.h>' > check_jpeg_abi.c 2480 echo '#include <stdio.h>' >> check_jpeg_abi.c 2481 echo '#include "jpeglib.h"' >> check_jpeg_abi.c 2482 echo '#if JPEG_LIB_VERSION == 62' >> check_jpeg_abi.c 2483 echo 'int main() { return 0; }' >> check_jpeg_abi.c 2484 echo '#else' >> check_jpeg_abi.c 2485 echo '#error "ABI difference"' >> check_jpeg_abi.c 2486 echo '#endif' >> check_jpeg_abi.c 2487 if test -z "`${CC} ${CFLAGS} ${EXTRA_INCLUDES} check_jpeg_abi.c -c -o check_jpeg_abi.o 2>&1`" ; then 2488 TIFF_JPEG12_ENABLED=yes 2489 else 2490 TIFF_JPEG12_ENABLED=no 2491 AC_MSG_WARN([Internal libjpeg12 has not the same ABI as libjpeg 8 bit. Disabling JPEG-in-TIFF 12 bit]) 2492 fi 2493 rm -f check_jpeg_abi.* 2494 2495else 2496 JPEG12_ENABLED=no 2497 AC_MSG_RESULT([disabled, libjpeg or libtiff not internal]) 2498fi 2499 2500AC_SUBST(JPEG12_ENABLED,$JPEG12_ENABLED) 2501AC_SUBST(TIFF_JPEG12_ENABLED,$TIFF_JPEG12_ENABLED) 2502 2503dnl --------------------------------------------------------------------------- 2504dnl Select a GIF Library to use, or disable driver. 2505dnl --------------------------------------------------------------------------- 2506 2507AC_ARG_WITH(gif,[ --with-gif[=ARG] Include GIF support (ARG=internal, no or path)],,) 2508 2509if test "$with_gif" = "no" ; then 2510 2511 GIF_SETTING=no 2512 2513 echo "gif support disabled." 2514 2515elif test "$with_gif" = "yes" -o "$with_gif" = "" ; then 2516 2517 AC_CHECK_LIB(gif,DGifOpenFileName,GIF_SETTING=external,GIF_SETTING=internal,) 2518 AC_CHECK_HEADERS(gif_lib.h) 2519 2520 if test "$GIF_SETTING" = "external" ; then 2521 LIBS="-lgif $LIBS" 2522 echo "using pre-installed libgif." 2523 else 2524 echo "using internal gif code." 2525 fi 2526 2527elif test "$with_gif" = "internal" ; then 2528 2529 GIF_SETTING=internal 2530 2531 echo "using internal gif code." 2532 2533else 2534 2535 GIF_SETTING=external 2536 LIBS="-L$with_gif -L$with_gif/lib -lgif $LIBS" 2537 EXTRA_INCLUDES="-I$with_gif -I$with_gif/include $EXTRA_INCLUDES" 2538 2539 echo "using libgif from $with_gif." 2540 2541fi 2542 2543AC_SUBST(GIF_SETTING,$GIF_SETTING) 2544 2545if test "$GIF_SETTING" != "no" ; then 2546 OPT_GDAL_FORMATS="gif $OPT_GDAL_FORMATS" 2547fi 2548 2549dnl --------------------------------------------------------------------------- 2550dnl Select an OGDI Library to use, or disable driver. 2551dnl --------------------------------------------------------------------------- 2552 2553OGDI_INCLUDE= 2554export OGDI_INCLUDE 2555 2556AC_ARG_WITH(ogdi,[ --with-ogdi[=ARG] Include OGDI support (ARG=path)],,) 2557 2558if test "$with_ogdi" = "no" ; then 2559 2560 HAVE_OGDI=no 2561 2562 echo "ogdi support disabled." 2563 2564elif test "$with_ogdi" = "yes" -o "$with_ogdi" = "" ; then 2565 2566 PKG_CHECK_MODULES([OGDI], [ogdi], [HAVE_OGDI=yes], [:]) 2567 if test "$HAVE_OGDI" = yes; then 2568 OGDI_INCLUDE=$OGDI_CFLAGS 2569 LIBS="$OGDI_LIBS $LIBS" 2570 else 2571 AC_CHECK_HEADERS(ecs.h) 2572 if test "$ac_cv_header_ecs_h" = "no" ; then 2573 if test -f "/usr/include/ogdi/ecs.h"; then 2574 OGDI_INCLUDE="-I/usr/include/ogdi" 2575 elif test -f "/usr/local/include/ogdi/ecs.h"; then 2576 OGDI_INCLUDE="-I/usr/local/include/ogdi" 2577 elif test -f "/usr/include/ecs.h"; then 2578 OGDI_INCLUDE="-I/usr/include" 2579 elif test -f "/usr/local/include/ecs.h"; then 2580 OGDI_INCLUDE="-I/usr/local/include" 2581 fi 2582 fi 2583 2584 if test "$OGDI_INCLUDE" != "" -o "$ac_cv_header_ecs_h" = "yes"; then 2585 AC_CHECK_LIB(ogdi,cln_GetLayerCapabilities,HAVE_OGDI=yes,HAVE_OGDI=no,) 2586 if test "$HAVE_OGDI" = "yes" ; then 2587 LIBS="-logdi $LIBS" 2588 else 2589 dnl For backward compatibility. Retry with ogdi31 as a name 2590 AC_CHECK_LIB(ogdi31,cln_GetLayerCapabilities,HAVE_OGDI=yes,HAVE_OGDI=no,) 2591 if test "$HAVE_OGDI" = "yes" ; then 2592 LIBS="-logdi31 $LIBS" 2593 fi 2594 fi 2595 else 2596 HAVE_OGDI=no 2597 fi 2598 fi 2599 2600else 2601 2602 AC_CHECK_LIB(ogdi,cln_GetLayerCapabilities,HAVE_OGDI=yes,HAVE_OGDI=no,-L$with_ogdi -L$with_ogdi/lib -logdi) 2603 if test "$HAVE_OGDI" = "yes" ; then 2604 if test -f "$with_ogdi/ecs.h" -o -f "$with_ogdi/include/ecs.h"; then 2605 LIBS="-L$with_ogdi -L$with_ogdi/lib -logdi $LIBS" 2606 OGDI_INCLUDE="-I$with_ogdi -I$with_ogdi/include" 2607 2608 echo "using libogdi from $with_ogdi." 2609 else 2610 HAVE_OGDI=no 2611 AC_MSG_ERROR([ecs.h not found.]) 2612 fi 2613 else 2614 dnl For backward compatibility. Retry with ogdi31 as a name 2615 AC_CHECK_LIB(ogdi31,cln_GetLayerCapabilities,HAVE_OGDI=yes,HAVE_OGDI=no,-L$with_ogdi -L$with_ogdi/lib -logdi31) 2616 if test "$HAVE_OGDI" = "yes" ; then 2617 if test -f "$with_ogdi/ecs.h" -o -f "$with_ogdi/include/ecs.h"; then 2618 LIBS="-L$with_ogdi -L$with_ogdi/lib -logdi31 $LIBS" 2619 OGDI_INCLUDE="-I$with_ogdi -I$with_ogdi/include" 2620 2621 echo "using libogdi31 from $with_ogdi." 2622 else 2623 HAVE_OGDI=no 2624 AC_MSG_ERROR([ecs.h not found.]) 2625 fi 2626 else 2627 AC_MSG_ERROR([libogdi not found.]) 2628 fi 2629 fi 2630 2631fi 2632 2633AC_SUBST(HAVE_OGDI,$HAVE_OGDI) 2634AC_SUBST(OGDI_INCLUDE,$OGDI_INCLUDE) 2635 2636dnl --------------------------------------------------------------------------- 2637dnl Select FME_HOME or disable FME support. 2638dnl --------------------------------------------------------------------------- 2639 2640X_FME_HOME= 2641export X_FME_HOME 2642 2643AC_ARG_WITH(fme,[ --with-fme[=ARG] Include FMEObjects support (ARG=FME_HOME path)],,) 2644 2645AC_MSG_CHECKING([for FMEObjects]) 2646 2647if test "$with_fme" = "no" ; then 2648 2649 AC_MSG_RESULT([disabled by user]) 2650 2651elif test "$with_fme" = "yes" ; then 2652 2653 if test "$FME_HOME" = "" ; then 2654 AC_MSG_ERROR([no, FME_HOME not defined!]) 2655 elif test -f $FME_HOME/fmeobjects/cpp/isession.h ; then 2656 AC_MSG_RESULT([yes]) 2657 X_FME_HOME=$FME_HOME 2658 else 2659 AC_MSG_ERROR([FME_HOME defined, but $FME_HOME/fmeobjects/cpp/issesion.h not found.]) 2660 fi 2661 2662elif test "$with_fme" = "" ; then 2663 2664 if test "$FME_HOME" = "" ; then 2665 AC_MSG_RESULT([no]) 2666 elif test -f $FME_HOME/fmeobjects/cpp/isession.h ; then 2667 AC_MSG_RESULT([yes]) 2668 X_FME_HOME=$FME_HOME 2669 else 2670 AC_MSG_RESULT([no, FME_HOME defined, but $FME_HOME/fmeobjects/cpp/issesion.h not found.]) 2671 fi 2672 2673else 2674 2675 if test -f $with_fme/fmeobjects/cpp/isession.h ; then 2676 AC_MSG_RESULT([yes]) 2677 X_FME_HOME=$with_fme 2678 else 2679 AC_MSG_ERROR([$with_fme/fmeobjects/cpp/issesion.h not found!]) 2680 fi 2681 2682fi 2683 2684AC_SUBST(X_FME_HOME,$X_FME_HOME) 2685 2686dnl --------------------------------------------------------------------------- 2687dnl Select a SOSI lib to use, or disable driver. 2688dnl --------------------------------------------------------------------------- 2689 2690AC_ARG_WITH(sosi,[ --with-sosi[=ARG] Include SOSI support (ARG=SOSI lib Path, yes or no)],,) 2691 2692if test -z "$with_sosi" -o "$with_sosi" = "no" ; then 2693 2694 SOSI_ENABLED=no 2695 2696 echo "SOSI support disabled." 2697 2698elif test "$with_sosi" = "yes" ; then 2699 2700 AC_MSG_CHECKING([for libfyba]) 2701 2702 rm -f testfyba.* 2703 rm -f testfyba 2704 echo "#include <fyba.h>" > testfyba.cpp 2705 echo "int main() { LC_Init(); return 0; }" >> testfyba.cpp 2706 if test -r /usr/include/fyba -a -z "`${CXX} ${CXXFLAGS} ${CPPFLAGS} -I/usr/include/fyba -DLINUX testfyba.cpp -lfyba -lfygm -lfyut -o testfyba 2>&1`" ; then 2707 AC_MSG_RESULT([found]) 2708 SOSI_ENABLED=yes 2709 SOSI_LIB="-lfyba -lfygm -lfyut" 2710 SOSI_INC="-I/usr/include/fyba" 2711 else 2712 AC_MSG_RESULT([not found]) 2713 AC_MSG_CHECKING([for libfyba.a, libfygm.a and libfyut.a in /usr/local/lib]) 2714 if test -r /usr/local/lib/libfyba.a -a -r /usr/local/lib/libfygm.a -a -r /usr/local/lib/libfyut.a ; then 2715 AC_MSG_RESULT([found]) 2716 SOSI_ENABLED=yes 2717 SOSI_LIB="/usr/local/lib/libfyba.a /usr/local/lib/libfygm.a /usr/local/lib/libfyut.a" 2718 else 2719 AC_MSG_ERROR([not found.]) 2720 fi 2721 2722 AC_MSG_CHECKING([for fyba.h, fygm.h and fyut.h in /usr/local/include/fyba]) 2723 if test -r /usr/local/include/fyba/fyba.h -a -r /usr/local/include/fyba/fygm.h -a -r /usr/local/include/fyba/fyut.h ; then 2724 AC_MSG_RESULT([found]) 2725 SOSI_ENABLED=yes 2726 SOSI_INC="-I/usr/local/include/fyba" 2727 else 2728 AC_MSG_ERROR([not found.]) 2729 fi 2730 fi 2731 2732 rm -f testfyba.* 2733 rm -f testfyba 2734else 2735 2736 AC_MSG_CHECKING([for libfyba.a, libfygm.a and libfyut.a in $with_sosi/lib]) 2737 if test -r $with_sosi/lib/libfyba.a -a -r $with_sosi/lib/libfygm.a -a -r $with_sosi/lib/libfyut.a ; then 2738 AC_MSG_RESULT([found.]) 2739 SOSI_LIB="$with_sosi/lib/libfyba.a $with_sosi/lib/libfygm.a $with_sosi/lib/libfyut.a" 2740 SOSI_ENABLED=yes 2741 else 2742 AC_MSG_ERROR([not found.]) 2743 fi 2744 2745 AC_MSG_CHECKING([for fyba.h in $with_sosi/include/fyba]) 2746 if test -r $with_sosi/include/fyba/fyba.h -a -r $with_sosi/include/fyba/fygm.h -a -r $with_sosi/include/fyba/fyut.h ; then 2747 AC_MSG_RESULT([found.]) 2748 SOSI_INC="-I$with_sosi/include/fyba" 2749 SOSI_ENABLED=yes 2750 else 2751 AC_MSG_ERROR([not found.]) 2752 fi 2753 2754fi 2755 2756AC_SUBST(SOSI_ENABLED, $SOSI_ENABLED) 2757AC_SUBST(SOSI_LIB, $SOSI_LIB) 2758AC_SUBST(SOSI_INC, $SOSI_INC) 2759 2760dnl --------------------------------------------------------------------------- 2761dnl MongoCXX driver 2762dnl --------------------------------------------------------------------------- 2763 2764AC_ARG_WITH(mongocxx,[ --with-mongocxx[=ARG] Include MongoCXX support (ARG=Path, yes or no)],,) 2765 2766MONGODB_ENABLED=no 2767 2768if test "$with_mongocxx" = "no" ; then 2769 2770 echo "MONGODB support disabled." 2771 2772elif test "$with_mongocxx" = "yes" -o "$with_mongocxx" = "" ; then 2773 2774 AC_MSG_CHECKING([for MongoCXX]) 2775 2776 rm -f testmongocxx.* 2777 rm -f testmongocxx 2778 echo "#include <mongo/client/dbclient.h>" > testmongocxx.cpp 2779 echo "using namespace mongo;" >> testmongocxx.cpp 2780 echo "int main() { client::initialize(client::Options()); return 0; }" >> testmongocxx.cpp 2781 if test -z "`${CXX} ${CXXFLAGS} ${CPPFLAGS} testmongocxx.cpp -lmongoclient -lboost_system -lboost_thread -lboost_regex -o testmongocxx 2>&1`" ; then 2782 AC_MSG_RESULT([MongoCXX found]) 2783 MONGODB_ENABLED="yes" 2784 MONGODB_LIB=" -lmongoclient -lboost_system -lboost_thread -lboost_regex" 2785 else 2786 if test "$with_mongocxx" = "yes"; then 2787 AC_MSG_ERROR([MongoCXX not found.]) 2788 else 2789 AC_MSG_RESULT([MongoCXX not found.]) 2790 fi 2791 fi 2792 rm -f testmongocxx.* 2793 rm -f testmongocxx 2794 2795else 2796 2797 AC_ARG_WITH(boost-lib-path, 2798 [ --with-boost-lib-path=ARG Path to boost libraries for mongocxx client],,,) 2799 2800 AC_MSG_CHECKING([for libmongoclient.so in in $with_mongocxx/lib]) 2801 MONGODB_ENABLED=yes 2802 if test -r $with_mongocxx/lib/libmongoclient.so; then 2803 AC_MSG_RESULT([found.]) 2804 MONGODB_LIB="-L$with_mongocxx/lib -lmongoclient" 2805 elif test -r $with_mongocxx/lib/libmongoclient.dylib; then 2806 AC_MSG_RESULT([found.]) 2807 MONGODB_LIB="-L$with_mongocxx/lib -lmongoclient" 2808 else 2809 AC_MSG_ERROR([not found.]) 2810 fi 2811 2812 if test "$with_boost_lib_path" = "" ; then 2813 MONGODB_LIB="$MONGODB_LIB -lboost_system -lboost_thread -lboost_regex" 2814 else 2815 MONGODB_LIB="$MONGODB_LIB -L$with_boost_lib_path -lboost_system -lboost_thread -lboost_regex" 2816 fi 2817 2818 AC_MSG_CHECKING([for mongo/client/dbclient.h in $with_mongocxx/include]) 2819 if test -r $with_mongocxx/include/mongo/client/dbclient.h ; then 2820 AC_MSG_RESULT([found.]) 2821 MONGODB_INC="-I$with_mongocxx/include" 2822 else 2823 AC_MSG_ERROR([not found.]) 2824 fi 2825 2826fi 2827 2828AC_SUBST(MONGODB_ENABLED, $MONGODB_ENABLED) 2829AC_SUBST(MONGODB_LIB, $MONGODB_LIB) 2830AC_SUBST(MONGODB_INC, $MONGODB_INC) 2831 2832 2833dnl --------------------------------------------------------------------------- 2834dnl MongoCXXv3 driver 2835dnl --------------------------------------------------------------------------- 2836 2837AC_ARG_WITH(mongocxxv3,[ --with-mongocxxv3[=ARG] Include MongoCXXv3 support (ARG=yes or no)],,) 2838 2839MONGOCXXV3_ENABLED=no 2840 2841if test "$with_mongocxxv3" = "no" ; then 2842 2843 echo "MONGODBv3 support disabled." 2844 2845elif test "$with_mongocxxv3" = "yes" -o "$with_mongocxxv3" = "" ; then 2846 2847 PKG_PROG_PKG_CONFIG([0.21]) 2848 PKG_CHECK_MODULES([MONGOCXXV3], [libmongocxx >= 3.4.0], [MONGOCXXV3_ENABLED=yes], [MONGOCXXV3_ENABLED=no]) 2849 2850 if test "$MONGOCXXV3_ENABLED" = "no" -a "$with_mongocxxv3" = "yes" ; then 2851 AC_MSG_ERROR([mongocxxv3 requested but no found]) 2852 fi 2853 2854fi 2855 2856AC_SUBST(MONGOCXXV3_ENABLED, $MONGOCXXV3_ENABLED) 2857AC_SUBST(MONGOCXXV3_LIBS, $MONGOCXXV3_LIBS) 2858AC_SUBST(MONGOCXXV3_CFLAGS, $MONGOCXXV3_CFLAGS) 2859 2860 2861dnl --------------------------------------------------------------------------- 2862dnl Select an HDF4 Library to use, or disable driver. 2863dnl 2864dnl We assume the user will have libjpeg and libz from other sources when 2865dnl linking against static HDF4 libraries. 2866dnl --------------------------------------------------------------------------- 2867 2868HDF4_INCLUDE="" 2869 2870AC_ARG_WITH(hdf4,[ --with-hdf4[=ARG] Include HDF4 support (ARG=path)],,) 2871 2872if test x"$with_hdf4" = x"no" ; then 2873 2874 HAVE_HDF4=no 2875 2876 echo "hdf4 support disabled." 2877 2878else 2879 2880 if test x"$with_hdf4" = x"yes" -o x"$with_hdf4" = x"" ; then 2881dnl Fedora has hdf static libraries in /usr/lib/hdf 2882 if test -d /usr/lib64/hdf; then 2883 HDF_LIB_DIR="/usr/lib64/hdf" 2884 elif test -d /usr/lib/hdf; then 2885 HDF_LIB_DIR="/usr/lib/hdf" 2886 else 2887 HDF_LIB_DIR="" 2888 fi 2889 else 2890 if test -d $with_hdf4/lib ; then 2891 HDF_LIB_DIR="$with_hdf4/lib" 2892 else 2893 HDF_LIB_DIR="$with_hdf4" 2894 fi 2895 fi 2896 2897 ORIG_LIBS="$LIBS" 2898 if test "$HDF_LIB_DIR" != "" ; then 2899 LIBS="-L$HDF_LIB_DIR $LIBS" 2900 fi 2901 2902dnl Debian supplies the HDF4 library which does not conflict with NetCDF. 2903dnl Test for Debian flavor first. Hint: install the libhdf4-alt-dev package. 2904 AC_CHECK_LIB(mfhdfalt,SDreaddata,HDF_LIB_NAME="-lmfhdfalt -ldfalt",HDF_LIB_NAME=missing,-ldfalt) 2905 2906dnl If it fails, test again for normal libmfhdf/libdf 2907 if test "$HDF_LIB_NAME" = "missing" ; then 2908 unset ac_cv_lib_mfhdf_SDreaddata 2909 AC_CHECK_LIB(mfhdf,SDreaddata,HDF_LIB_NAME="-lmfhdf -ldf",HDF_LIB_NAME=missing,-ldf) 2910 if test "$HDF_LIB_NAME" = "missing" ; then 2911 unset ac_cv_lib_mfhdf_SDreaddata 2912 AC_CHECK_LIB(hdf4,SDreaddata,HDF_LIB_NAME=-lhdf4,HDF_LIB_NAME=missing,) 2913 fi 2914 fi 2915 2916dnl Test again, with -ldf, -ljpeg and -lz this time. 2917 if test "$HDF_LIB_NAME" = "missing" ; then 2918 unset ac_cv_lib_mfhdf_SDreaddata 2919 AC_CHECK_LIB(mfhdf,SDreaddata,HDF_LIB_NAME="-lmfhdf -ldf",HDF_LIB_NAME=missing,-ldf -ljpeg -lz) 2920 fi 2921 2922dnl Not found... again, with -lsz. 2923 if test "$HDF_LIB_NAME" = "missing" ; then 2924 unset ac_cv_lib_mfhdf_SDreaddata 2925 AC_CHECK_LIB(mfhdf,SDreaddata,HDF_LIB_NAME="-lmfhdf -ldf -lsz",HDF_LIB_NAME=missing,-ldf -lsz -ljpeg -lz) 2926 fi 2927 2928 if test "$HDF_LIB_NAME" != "missing" ; then 2929 2930 if test "$HDF_LIB_DIR" != "" ; then 2931 LIBS="-L$HDF_LIB_DIR $HDF_LIB_NAME $ORIG_LIBS" 2932 else 2933 LIBS="$HDF_LIB_NAME $ORIG_LIBS" 2934 fi 2935 2936 dnl HDF4 library newer than 4.2.5 has a SDreset_maxopenfiles/SDget_maxopenfiles interface 2937 dnl which allows opening many HDF files simultaneously (the max number of files was previously 2938 dnl hardcoded and too low, smth. like 32). Search for it and use if available. 2939 AC_CHECK_LIB(mfhdfalt,SDget_maxopenfiles,HDF4_HAS_MAXOPENFILES=yes,HDF4_HAS_MAXOPENFILES=no,$HDF_LIB_NAME) 2940 if test "$HDF4_HAS_MAXOPENFILES" = "no" ; then 2941 AC_CHECK_LIB(mfhdf,SDget_maxopenfiles,HDF4_HAS_MAXOPENFILES=yes,HDF4_HAS_MAXOPENFILES=no,$HDF_LIB_NAME) 2942 fi 2943 2944 dnl Now search for headers 2945 if test "$with_hdf4" = "yes" -o "$with_hdf4" = "" -a -r /usr/include/hdf/hdf.h ; then 2946 HDF4_INCLUDE="-I/usr/include/hdf" 2947 elif test -r "$with_hdf4/hdf/hdf.h" ; then 2948 HDF4_INCLUDE="-I$with_hdf4/hdf" 2949 elif test -r "$with_hdf4/include/hdf/hdf.h" ; then 2950 HDF4_INCLUDE="-I$with_hdf4/include/hdf" 2951 elif test -r "$with_hdf4/include/hdf.h" ; then 2952 HDF4_INCLUDE="-I$with_hdf4/include" 2953 elif test -r "$with_hdf4/hdf.h" ; then 2954 HDF4_INCLUDE="-I$with_hdf4" 2955 fi 2956 2957 HAVE_HDF4=yes 2958 2959 else 2960 2961 if test x"$with_hdf4" != x"" ; then 2962 AC_MSG_ERROR([HDF4 support requested with arg "$with_hdf4", but neither hdf4 nor mfhdf lib found]) 2963 else 2964 LIBS="$ORIG_LIBS" 2965 HAVE_HDF4=no 2966 fi 2967 2968 fi 2969 2970fi 2971 2972AC_SUBST(HAVE_HDF4,$HAVE_HDF4) 2973AC_SUBST(HDF4_INCLUDE,$HDF4_INCLUDE) 2974AC_SUBST(HDF4_HAS_MAXOPENFILES,$HDF4_HAS_MAXOPENFILES) 2975 2976if test "$HAVE_HDF4" != "no" ; then 2977 OPT_GDAL_FORMATS="hdf4 $OPT_GDAL_FORMATS" 2978fi 2979 2980 2981dnl --------------------------------------------------------------------------- 2982dnl Select an HDF5 Library to use, or disable driver. 2983dnl 2984dnl --------------------------------------------------------------------------- 2985 2986HDF5_INCLUDE="" 2987 2988AC_ARG_WITH(hdf5,[ --with-hdf5[=ARG] Include HDF5 support (ARG=path)],,) 2989 2990if test "$with_hdf5" = "no" ; then 2991 2992 HAVE_HDF5=no 2993 2994 echo "hdf5 support disabled." 2995 2996elif test "$with_hdf5" = "yes" -o "$with_hdf5" = "" ; then 2997 2998 HDF5_CFLAGS="" 2999 HDF5_LIBS="" 3000 PKG_PROG_PKG_CONFIG([0.21]) # check and set $PKG_CONFIG 3001 PKG_CHECK_MODULES([HDF5], [hdf5], [HAVE_HDF5=yes], [HAVE_HDF5=no]) 3002 3003 if test "$HAVE_HDF5" = "yes"; then 3004 3005 # Test that the package found is for the right architecture 3006 saved_LIBS="$LIBS" 3007 LIBS="$HDF5_LIBS" 3008 AC_CHECK_LIB(hdf5,H5Fopen, [HAVE_HDF5=yes], [HAVE_HDF5=no]) 3009 LIBS="$saved_LIBS" 3010 3011 if test "$HAVE_HDF5" = "yes"; then 3012 LIBS="$HDF5_LIBS $LIBS" 3013 HDF5_INCLUDE="$HDF5_CFLAGS" 3014 fi 3015 3016 else 3017 3018 AC_CHECK_LIB(hdf5,H5Fopen,HAVE_HDF5=yes,HAVE_HDF5=no,) 3019 3020 if test "$HAVE_HDF5" = "yes" ; then 3021 LIBS="-lhdf5 $LIBS" 3022 fi 3023 3024 dnl Some Linux distros install hdf include files here. 3025 if test "$HAVE_HDF5" = "yes" -a -r /usr/include/hdf5.h ; then 3026 HDF5_INCLUDE="-I/usr/include" 3027 fi 3028 fi 3029 3030else 3031 3032 if test -d $with_hdf5/lib ; then 3033 HDF5_LIB_DIR=$with_hdf5/lib 3034 else 3035 HDF5_LIB_DIR=$with_hdf5 3036 fi 3037 3038 ORIG_LIBS="$LIBS" 3039 LIBS="-L$HDF5_LIB_DIR $LIBS -lhdf5" 3040 3041 AC_CHECK_LIB(hdf5,H5Fopen,HDF5_LIB_NAME="-lhdf5 ",HDF5_LIB_NAME=missing,-lhdf5) 3042 3043 if test "$HDF5_LIB_NAME" = "missing" ; then 3044 AC_MSG_ERROR([HDF5 support requested with arg $with_hdf5, but no hdf5 lib found]) 3045 fi 3046 3047 LIBS="-L$HDF5_LIB_DIR $HDF5_LIB_NAME $ORIG_LIBS" 3048 3049 if test -r "$with_hdf5/hdf5/hdf5.h" ; then 3050 HDF5_INCLUDE="-I$with_hdf5/hdf5" 3051 elif test -r "$with_hdf5/include/hdf5/hdf5.h" ; then 3052 HDF5_INCLUDE="-I$with_hdf5/include/hdf5" 3053 elif test -r "$with_hdf5/include/hdf5.h" ; then 3054 HDF5_INCLUDE="-I$with_hdf5/include" 3055 elif test -r "$with_hdf5/hdf.h" ; then 3056 HDF5_INCLUDE="-I$with_hdf5" 3057 fi 3058 3059 HAVE_HDF5=yes 3060fi 3061 3062AC_SUBST(HAVE_HDF5,$HAVE_HDF5) 3063AC_SUBST(HDF5_INCLUDE,$HDF5_INCLUDE) 3064 3065if test "$HAVE_HDF5" != "no" ; then 3066 OPT_GDAL_FORMATS="hdf5 $OPT_GDAL_FORMATS" 3067fi 3068 3069dnl --------------------------------------------------------------------------- 3070dnl Check if kealib library is available. 3071dnl --------------------------------------------------------------------------- 3072 3073KEA_CONFIG=no 3074 3075AC_ARG_WITH(kea,[ --with-kea[=ARG] Include kealib (ARG=path to kea-config) [[default=yes]]],,) 3076 3077if test "$with_kea" = "yes" -o "x$with_kea" = "x" ; then 3078 AC_PATH_PROG(KEA_CONFIG, kea-config, no) 3079else 3080 KEA_CONFIG=$with_kea 3081fi 3082 3083AC_MSG_CHECKING([for kea]) 3084 3085if test "$KEA_CONFIG" = "no" ; then 3086 3087 HAVE_KEA=no 3088 KEA_LIB= 3089 KEA_INC= 3090 3091 AC_MSG_RESULT([no]) 3092 3093else 3094 if test -d $KEA_CONFIG ; then 3095 AC_MSG_RESULT([no]) 3096 AC_MSG_ERROR([--with-kea argument is a directory. It should be the path to the kea_config script, often somewhere like /usr/local/bin/kea_config.]) 3097 fi 3098 3099 if test \! -x $KEA_CONFIG ; then 3100 AC_MSG_RESULT([no]) 3101 AC_MSG_ERROR([--with-kea argument is a not an executable file. It should be the path to the kea_config script, often somewhere like /usr/local/bin/kea_config.]) 3102 fi 3103 3104 HAVE_KEA=yes 3105 KEA_LIB="`$KEA_CONFIG --libs --hdflibs`" 3106 KEA_INC="`$KEA_CONFIG --cflags --hdfcflags`" 3107 AC_MSG_RESULT([yes]) 3108fi 3109 3110AC_SUBST(HAVE_KEA,$HAVE_KEA) 3111AC_SUBST(KEA_INC,$KEA_INC) 3112AC_SUBST(KEA_LIB,$KEA_LIB) 3113 3114if test "$HAVE_KEA" != "no" ; then 3115 OPT_GDAL_FORMATS="kea $OPT_GDAL_FORMATS" 3116fi 3117 3118dnl --------------------------------------------------------------------------- 3119dnl Check if netcdf library is available. 3120dnl --------------------------------------------------------------------------- 3121 3122NETCDF_SETTING= 3123NETCDF_MEM= 3124NETCDF_ROOT= 3125NETCDF_HAS_NC4= 3126NETCDF_HAS_HDF4= 3127NETCDF_NCCONFIG= 3128 3129AC_ARG_WITH([netcdf],[ --with-netcdf[=ARG] Include netCDF support (ARG=no or netCDF tree prefix)],,) 3130 3131if test "$with_netcdf" = "no" ; then 3132 3133 NETCDF_SETTING=no 3134 NETCDF_MEM=no 3135 3136 echo "netCDF support disabled." 3137 3138else 3139 3140 dnl find nc-config location 3141 unset ac_cv_path_NETCDF_NCCONFIG 3142 if test "$with_netcdf" = "yes" -o "$with_netcdf" = "" ; then 3143 AC_PATH_PROG(NETCDF_NCCONFIG, nc-config, no) 3144 else 3145 tmp_path="$with_netcdf/bin$PATH_SEPARATOR$with_netcdf" 3146 AC_PATH_PROG(NETCDF_NCCONFIG, nc-config, no, $tmp_path) 3147 fi 3148 3149 dnl test nc-config 3150 if test "$NETCDF_NCCONFIG" = "no" ; then 3151 echo " did not find nc-config, some features may be missing" 3152 echo " use --with-netcdf=/path/to/netcdf or add nc-config to PATH" 3153 NETCDF_NCCONFIG= 3154 elif test "`$NETCDF_NCCONFIG --version`" = "" ; then 3155 echo "did not get netCDF version from $NETCDF_NCCONFIG ... using fallback" 3156 NETCDF_NCCONFIG= 3157 fi 3158 3159 dnl test linking using flags from nc-config 3160 if test "$NETCDF_NCCONFIG" != "" ; then 3161 3162 AC_MSG_CHECKING([libnetcdf compiler and linker flags with nc-config]) 3163 NETCDF_VERSION=`$NETCDF_NCCONFIG --version` 3164 NETCDF_PREFIX=`$NETCDF_NCCONFIG --prefix` 3165 NETCDF_INCLUDEDIR=`$NETCDF_NCCONFIG --includedir` 3166 NETCDF_LIBS=`$NETCDF_NCCONFIG --libs` 3167 STRIP_SYSTEM_LIBRARY_PATHS("${NETCDF_LIBS}") 3168 NETCDF_LIBS="$STRIPPED_LIBRARY_NAME" 3169 echo "" 3170 AC_MSG_RESULT([ got version="$NETCDF_VERSION", prefix="$NETCDF_PREFIX", 3171 libs="$NETCDF_LIBS", includedir="$NETCDF_INCLUDEDIR"]) 3172 3173 AC_CHECK_LIB([netcdf], [nc_open], [NETCDF_SETTING=yes], [NETCDF_SETTING=no], $NETCDF_LIBS) 3174 3175 if test "$NETCDF_SETTING" = "yes" ; then 3176 EXTRA_INCLUDES="-I$NETCDF_INCLUDEDIR $EXTRA_INCLUDES" 3177 NETCDF_ROOT=$NETCDF_PREFIX 3178 LIBS="$NETCDF_LIBS $LIBS" 3179 fi 3180 3181dnl previous behavior without nc-config 3182 3183dnl test linking using default settings 3184elif test "$with_netcdf" = "yes" -o "$with_netcdf" = "" ; then 3185 3186 AC_CHECK_LIB([netcdf], [nc_open], [NETCDF_SETTING=yes], [NETCDF_SETTING=no],) 3187 3188 if test "$NETCDF_SETTING" = "yes" ; then 3189 3190 dnl Fedora has netcdf headers in /usr/include/netcdf 3191 if test -d /usr/include/netcdf ; then 3192 EXTRA_INCLUDES="-I/usr/include/netcdf $EXTRA_INCLUDES" 3193 NETCDF_ROOT="/usr" 3194 dnl RHEL 5 has netcdf headers in /usr/include/netcdf-3 3195 elif test -d /usr/include/netcdf-3 ; then 3196 EXTRA_INCLUDES="-I/usr/include/netcdf-3 $EXTRA_INCLUDES" 3197 NETCDF_ROOT="/usr" 3198 dnl ubuntu and fedora have netcdf headers in /usr/include 3199 elif test -f /usr/include/netcdf.h ; then 3200 NETCDF_ROOT="/usr" 3201 dnl try /usr/local 3202 elif test -f /usr/local/include/netcdf.h ; then 3203 NETCDF_ROOT="/usr/local" 3204 dnl print warning if include cannot be found 3205 else 3206 echo "using pre-installed libnetcdf." 3207 echo -n "libnetcdf is installed but its location cannot be found, " 3208 echo "use --with-netcdf=/path_to_netcdf for proper support" 3209 fi 3210 NETCDF_INCLUDEDIR="$NETCDF_ROOT/include/" 3211 3212 LIBS="-lnetcdf $LIBS" 3213 if test "$NETCDF_ROOT" != "" ; then 3214 echo "using pre-installed libnetcdf from "$NETCDF_ROOT 3215 fi 3216 3217 else 3218 echo "libnetcdf not found ... netCDF support disabled" 3219 fi 3220 3221dnl test linking using --with_netcdf dir 3222else 3223 3224 AC_CHECK_LIB([netcdf], [nc_open], [NETCDF_SETTING=yes], [NETCDF_SETTING=no],-L$with_netcdf -L$with_netcdf/lib) 3225 3226 if test "$NETCDF_SETTING" = "yes" ; then 3227 3228 NETCDF_SETTING=yes 3229 NETCDF_ROOT="$with_netcdf" 3230 3231 if test -d $with_netcdf/lib ; then 3232 LIBS="-L$with_netcdf/lib -lnetcdf $LIBS" 3233 EXTRA_INCLUDES="-I$with_netcdf/include $EXTRA_INCLUDES" 3234 else 3235 LIBS="-L$with_netcdf -lnetcdf $LIBS" 3236 EXTRA_INCLUDES="-I$with_netcdf $EXTRA_INCLUDES" 3237 fi 3238 NETCDF_INCLUDEDIR="$with_netcdf/include/" 3239 3240 echo "using libnetcdf from $with_netcdf" 3241 3242 else 3243 echo "libnetcdf not found in "$with_netcdf" ... netCDF support disabled" 3244 fi 3245 3246fi 3247 3248dnl test for NC4 and HDF4 support with nc-config 3249 if test "$NETCDF_SETTING" = "yes" ; then 3250 3251 if test "$NETCDF_NCCONFIG" != "" ; then 3252 3253 AC_MSG_CHECKING([for netcdf-4 (and HDF5) support in libnetcdf]) 3254 if test "x$($NETCDF_NCCONFIG --has-nc4)" = "xyes"; then : 3255 AC_MSG_RESULT([yes]) 3256 NETCDF_HAS_NC4=yes 3257 else 3258 AC_MSG_RESULT([no]) 3259 NETCDF_HAS_NC4=no 3260 fi 3261 3262 AC_MSG_CHECKING([for HDF4 support in libnetcdf]) 3263 if test "x$($NETCDF_NCCONFIG --has-hdf4)" = "xyes"; then : 3264 AC_MSG_RESULT([yes]) 3265 NETCDF_HAS_HDF4=yes 3266 else 3267 AC_MSG_RESULT([no]) 3268 NETCDF_HAS_HDF4=no 3269 fi 3270 3271 else 3272 NETCDF_HAS_NC4=no 3273 NETCDF_HAS_HDF4=no 3274 fi 3275fi 3276 3277fi 3278 3279dnl export results 3280 3281AC_SUBST([NETCDF_SETTING], [$NETCDF_SETTING]) 3282 3283if test "$NETCDF_SETTING" != "no" ; then 3284 3285 AC_CHECK_HEADERS([$NETCDF_INCLUDEDIR/netcdf_mem.h], [NETCDF_MEM=yes], [NETCDF_MEM=no], [#include <$NETCDF_INCLUDEDIR/netcdf.h>]) 3286 3287 AC_SUBST([NETCDF_MEM], [$NETCDF_MEM]) 3288 AC_SUBST([NETCDF_ROOT], [$NETCDF_ROOT]) 3289 AC_SUBST([NETCDF_HAS_NC4], [$NETCDF_HAS_NC4]) 3290 AC_SUBST([NETCDF_HAS_HDF4], [$NETCDF_HAS_HDF4]) 3291 3292 OPT_GDAL_FORMATS="netcdf $OPT_GDAL_FORMATS" 3293 3294fi 3295 3296 3297dnl --------------------------------------------------------------------------- 3298dnl Select a JasPer Library to use, or disable driver. 3299dnl --------------------------------------------------------------------------- 3300 3301AC_ARG_WITH(jasper,[ --with-jasper[=ARG] Include JPEG-2000 support via JasPer library (ARG=path)],,) 3302 3303if test "$with_jasper" = "no" ; then 3304 3305 HAVE_JASPER=no 3306 3307 AC_MSG_NOTICE([JasPer (JPEG2000) support disabled.]) 3308 3309elif test "$with_jasper" = "yes" -o "$with_jasper" = "" ; then 3310 3311 AC_CHECK_LIB(jasper,jpc_decode,HAVE_JASPER=yes,HAVE_JASPER=no,) 3312 AC_CHECK_LIB(jasper,jp2_decode,HAVE_JASPER=yes,HAVE_JASPER=no,) 3313 AC_CHECK_LIB(jasper,pgx_decode,HAVE_JASPER=yes,HAVE_JASPER=no,) 3314 3315 if test "$HAVE_JASPER" = "yes" ; then 3316 LIBS="-ljasper $LIBS" 3317 fi 3318else 3319 3320 HAVE_JASPER=yes 3321 LIBS="-L$with_jasper -L$with_jasper/lib -ljasper $LIBS" 3322 EXTRA_INCLUDES="-I$with_jasper -I$with_jasper/include $EXTRA_INCLUDES" 3323 3324 AC_MSG_NOTICE([using JasPer library from $with_jasper.]) 3325fi 3326 3327if test "$HAVE_JASPER" != "no" ; then 3328 OPT_GDAL_FORMATS="jpeg2000 $OPT_GDAL_FORMATS" 3329 3330 dnl Test whether we have UUID JasPer hack 3331 3332 AC_CHECK_LIB(jasper,jp2_encode_uuid,HAVE_JASPER_UUID=yes,HAVE_JASPER_UUID=no,) 3333 3334 if test "$HAVE_JASPER_UUID" = "yes" ; then 3335 AC_MSG_NOTICE([hacked JasPer version found (JasPer UUID), GeoJP2 enabled.]) 3336 JASPER_FLAGS=-DHAVE_JASPER_UUID 3337 else 3338 AC_MSG_NOTICE([hacked JasPer version not found, GeoJP2 disabled.]) 3339 fi 3340fi 3341 3342AC_SUBST([HAVE_JASPER],$HAVE_JASPER) 3343AC_SUBST([JASPER_FLAGS],$JASPER_FLAGS) 3344 3345 3346dnl --------------------------------------------------------------------------- 3347dnl Select a OpenJPEG Library to use, or disable driver. 3348dnl --------------------------------------------------------------------------- 3349 3350AC_ARG_WITH(openjpeg,[ --with-openjpeg Include JPEG-2000 support via OpenJPEG 2.x library],,) 3351 3352HAVE_OPENJPEG=no 3353 3354if test "$with_openjpeg" = "no" ; then 3355 3356 AC_MSG_NOTICE([OpenJPEG (JPEG2000) support disabled.]) 3357 3358else 3359 3360 PKG_PROG_PKG_CONFIG([0.21]) 3361 PKG_CHECK_MODULES([OPENJPEG], [libopenjp2 >= 2.1.0], 3362 [OPENJPEG_VERSION=`$PKG_CONFIG --modversion libopenjp2`], 3363 [OPENJPEG_VERSION=;]) 3364 3365 if test -n "$OPENJPEG_CFLAGS"; then 3366 3367 # Test that the package found is for the right architecture 3368 saved_LIBS="$LIBS" 3369 LIBS="$OPENJPEG_LIBS" 3370 AC_CHECK_LIB(openjp2,opj_setup_decoder, [HAVE_OPENJPEG=yes], [HAVE_OPENJPEG=no]) 3371 LIBS="$saved_LIBS" 3372 3373 if test "$HAVE_OPENJPEG" = "yes"; then 3374 EXTRA_INCLUDES="$OPENJPEG_CFLAGS $EXTRA_INCLUDES" 3375 LIBS="$OPENJPEG_LIBS $LIBS" 3376 fi 3377 fi 3378fi 3379 3380if test "$HAVE_OPENJPEG" != "no" ; then 3381 OPT_GDAL_FORMATS="openjpeg $OPT_GDAL_FORMATS" 3382fi 3383 3384dnl --------------------------------------------------------------------------- 3385dnl Select a FGDB API to use, or disable driver. 3386dnl --------------------------------------------------------------------------- 3387 3388AC_ARG_WITH(fgdb,[ --with-fgdb[=ARG] Include ESRI File Geodatabase support (ARG=FGDP API Path, yes or no)],,) 3389 3390FGDB_ENABLED=no 3391FGDB_LIB= 3392 3393if test "$with_fgdb" = "no" ; then 3394 3395 echo "FGDB support disabled." 3396 3397elif test "$with_fgdb" = "yes" -o "$with_fgdb" = "" ; then 3398 3399 AC_MSG_CHECKING([for FileGDBAPI]) 3400 3401 rm -f testfgdb.* 3402 rm -f testfgdb 3403 echo "#include <FileGDBAPI.h>" > testfgdb.cpp 3404 echo "using namespace FileGDBAPI;" >> testfgdb.cpp 3405 echo "int main() { Geodatabase oDB; std::wstring osStr; ::OpenGeodatabase(osStr, oDB); return 0; }" >> testfgdb.cpp 3406 if test -z "`${CXX} ${CXXFLAGS} ${CPPFLAGS} testfgdb.cpp -lFileGDBAPI -lfgdbunixrtl -o testfgdb 2>&1`" ; then 3407 AC_MSG_RESULT([FileGDBAPI found]) 3408 FGDB_ENABLED="yes" 3409 FGDB_LIB="-lFileGDBAPI -lfgdbunixrtl" 3410 else 3411 if test "$with_fgdb" = "yes"; then 3412 AC_MSG_ERROR([FileGDBAPI not found.]) 3413 else 3414 AC_MSG_RESULT([FileGDBAPI not found.]) 3415 fi 3416 fi 3417 rm -f testfgdb.* 3418 rm -f testfgdb 3419 3420else 3421 3422 AC_MSG_CHECKING([for libFileGDBAPI.so in in $with_fgdb/lib]) 3423 FGDB_ENABLED=yes 3424 if test -r $with_fgdb/lib/libFileGDBAPI.so -a -r $with_fgdb/lib/libfgdbunixrtl.so ; then 3425 AC_MSG_RESULT([found.]) 3426 FGDB_LIB="-L$with_fgdb/lib -lFileGDBAPI -lfgdbunixrtl" 3427 elif test -r $with_fgdb/lib/libFileGDBAPI.dylib -a -r $with_fgdb/lib/libfgdbunixrtl.dylib ; then 3428 AC_MSG_RESULT([found.]) 3429 FGDB_LIB="-L$with_fgdb/lib -lFileGDBAPI -lfgdbunixrtl" 3430 else 3431 AC_MSG_ERROR([not found.]) 3432 fi 3433 3434 AC_MSG_CHECKING([for FileGDBAPI.h in $with_fgdb/include]) 3435 if test -r $with_fgdb/include/FileGDBAPI.h ; then 3436 AC_MSG_RESULT([found.]) 3437 FGDB_INC="-I$with_fgdb/include" 3438 else 3439 AC_MSG_ERROR([not found.]) 3440 fi 3441 3442fi 3443 3444if test "$FGDB_LIB" != ""; then 3445 dnl pj_datums is not a function but an object, but for linking that doesn't matter. 3446 AC_CHECK_LIB(FileGDBAPI,pj_datums,FGDB_HAS_PROJ4=yes,FGDB_HAS_PROJ4=no,$FGDB_LIB) 3447fi 3448 3449AC_SUBST(FGDB_ENABLED, $FGDB_ENABLED) 3450AC_SUBST(FGDB_LIB, $FGDB_LIB) 3451AC_SUBST(FGDB_INC, $FGDB_INC) 3452 3453dnl --------------------------------------------------------------------------- 3454dnl Select a ECW Library to use, or disable driver. 3455dnl --------------------------------------------------------------------------- 3456ECW_FLAGS= 3457ECW_LIBS= 3458ECW_INCLUDE= 3459ECW_54= 3460 3461AC_ARG_WITH(ecw,[ --with-ecw[=ARG] Include ECW support (ARG=ECW SDK Path, yes or no)],,) 3462 3463if test ! -z "`uname | grep Darwin`" ; then 3464 CARBON_FRAMEWORK="-framework Carbon" 3465else 3466 CARBON_FRAMEWORK= 3467fi 3468 3469if test "$with_ecw" = "no" ; then 3470 3471 ECW_SETTING=no 3472 3473 echo "ECW support disabled." 3474 3475elif test "$with_ecw" = "yes" -o "$with_ecw" = "" ; then 3476 3477 AC_CHECK_LIB(NCSEcw,NCScbmOpenFileView,ECW_SETTING=yes,ECW_SETTING=no,-lNCSCnet -lNCSUtil) 3478 3479 if test "$ECW_SETTING" = "yes" ; then 3480 ECW_LIBS="-lNCSEcw -lNCSEcwC -lNCSCnet -lNCSUtil" 3481 fi 3482 3483 if test "$ECW_SETTING" = "no" ; then 3484 AC_CHECK_LIB(ecwj2,NCScbmOpenFileView,ECW_SETTING=yes,ECW_SETTING=no,$CARBON_FRAMEWORK) 3485 if test "$ECW_SETTING" = "yes" ; then 3486 ECW_LIBS="-lecwj2 $CARBON_FRAMEWORK" 3487 fi 3488 fi 3489else 3490 3491 AC_MSG_CHECKING([for libNCSEcw.a or libecwj2]) 3492 ECW_ARCH=x86 3493 ECW_CONF="release" 3494 ECW_FLAGS="-DLINUX -DX86 -DPOSIX -DHAVE_COMPRESS -DECW_COMPRESS_RW_SDK_VERSION" 3495 ECW_FRAMEWORK_COCOA="" 3496 if test "`arch`" = "x86_64" ; then 3497 ECW_ARCH="x64" 3498 fi 3499 if test ! -z "`uname | grep Darwin`" ; then 3500 ECW_ARCH="" 3501 ECW_CONF="" 3502 ECW_FLAGS="" 3503 ECW_FRAMEWORK_COCOA=" -framework Cocoa " 3504 fi 3505 3506 ECW_SETTING=yes 3507 if test -r $with_ecw/lib/libNCSCnet.so -o -r $with_ecw/lib/libNCSCnet.dylib ; then 3508 ECW_LIBS="-L$with_ecw/lib -lNCSEcw -lNCSEcwC -lNCSCnet -lNCSUtil" 3509 AC_MSG_RESULT([found in $with_ecw/lib.]) 3510 elif test -r $with_ecw/lib/libNCSCNet.so -o -r $with_ecw/lib/libNCSCNet.dylib ; then 3511 ECW_LIBS="-L$with_ecw/lib -lNCSEcw -lNCSEcwC -lNCSCNet -lNCSUtil" 3512 AC_MSG_RESULT([found in $with_ecw/lib.]) 3513 elif test -r $with_ecw/bin/libNCSEcw.so -o -r $with_ecw/bin/libNCSEcw.dylib ; then 3514 ECW_LIBS="-L$with_ecw/bin -lNCSEcw -lNCSEcwC -lNCSCnet -lNCSUtil" 3515 AC_MSG_RESULT([found in $with_ecw/bin.]) 3516 elif test -r $with_ecw/lib/libecwj2.dylib ; then 3517 ECW_LIBS="-L$with_ecw/lib -lecwj2 $CARBON_FRAMEWORK" 3518 AC_MSG_RESULT([found libecwj2 in $with_ecw/lib.]) 3519 3520 # ECW SDK 5.0 style and also for the case where license type is included in path i.e. specific license type is requested. 3521 elif test -r $with_ecw/lib/$ECW_ARCH/$ECW_CONF/libNCSEcw.a ; then 3522 # Test if we must use the newabi/cpp11abi version (SDK 5.4+) 3523 if test -r $with_ecw/lib/newabi/$ECW_ARCH/$ECW_CONF/libNCSEcw.a || test -r $with_ecw/lib/cpp11abi/$ECW_ARCH/$ECW_CONF/libNCSEcw.a; then 3524 if test -d $with_ecw/lib/newabi; then 3525 ECW_ABIDIR=newabi 3526 else 3527 ECW_ABIDIR=cpp11abi 3528 fi 3529 echo "#include <string>" > testnewabi.cpp 3530 echo "namespace NCS { class CString { public: static std::wstring Utf8Decode (const std::string &sUtf8); }; }" >> testnewabi.cpp 3531 echo "int main() { return static_cast<int>(NCS::CString::Utf8Decode(std::string()).size()); }" >> testnewabi.cpp 3532 if test -z "`${CXX} ${CXXFLAGS} ${CPPFLAGS} testnewabi.cpp -L$with_ecw/lib/$ECW_ABIDIR/$ECW_ARCH/$ECW_CONF -lNCSEcw -o testnewabi 2>&1`" ; then 3533 ECW_LIBDIR=$with_ecw/lib/$ECW_ABIDIR/$ECW_ARCH/$ECW_CONF 3534 ECW_LIBS="-L$ECW_LIBDIR -lNCSEcw $ECW_FRAMEWORK_COCOA" 3535 with_ecw=$with_ecw/$ecw_license_type 3536 ECW_54="yes" 3537 AC_MSG_RESULT([found Intergraph 5.4+ SDK with ${ECW_ABIDIR} in ${ECW_LIBDIR}.]) 3538 rm -f testnewabi.* 3539 rm -f testnewabi 3540 break 3541 fi 3542 rm -f testnewabi.* 3543 rm -f testnewabi 3544 fi 3545 if test "$ECW_LIBS" = ""; then 3546 ECW_LIBDIR=$with_ecw/lib/$ECW_ARCH/$ECW_CONF 3547 ECW_LIBS="-L$ECW_LIBDIR -lNCSEcw $ECW_FRAMEWORK_COCOA" 3548 AC_MSG_RESULT([found Intergraph 5.x+ SDK in ${ECW_LIBDIR}.]) 3549 fi 3550 # ECWJP2 SDK 5.1 style 3551 elif test -d $with_ecw; then 3552 for ecw_license_type in "Desktop_Read-Write" "Server_Read-Only_EndUser" "Server_Read-Only" "Server_Read-Write" "Desktop_Read-Only" 3553 do 3554 # Test if we must use the newabi/cpp11abi version (SDK 5.4+) 3555 if test -r $with_ecw/$ecw_license_type/lib/newabi/$ECW_ARCH/$ECW_CONF/libNCSEcw.a || test -r $with_ecw/$ecw_license_type/lib/cpp11abi/$ECW_ARCH/$ECW_CONF/libNCSEcw.a; then 3556 if test -d $with_ecw/lib/newabi; then 3557 ECW_ABIDIR=newabi 3558 else 3559 ECW_ABIDIR=cpp11abi 3560 fi 3561 echo "#include <string>" > testnewabi.cpp 3562 echo "namespace NCS { class CString { public: static std::wstring Utf8Decode (const std::string &sUtf8); }; }" >> testnewabi.cpp 3563 echo "int main() { return static_cast<int>(NCS::CString::Utf8Decode(std::string()).size()); }" >> testnewabi.cpp 3564 if test -z "`${CXX} ${CXXFLAGS} ${CPPFLAGS} testnewabi.cpp -L$with_ecw/$ecw_license_type/lib/$ECW_ABIDIR/$ECW_ARCH/$ECW_CONF -lNCSEcw -o testnewabi 2>&1`" ; then 3565 ECW_LIBDIR=$with_ecw/$ecw_license_type/lib/$ECW_ABIDIR/$ECW_ARCH/$ECW_CONF 3566 ECW_LIBS="-L$ECW_LIBDIR -lNCSEcw $ECW_FRAMEWORK_COCOA" 3567 with_ecw=$with_ecw/$ecw_license_type 3568 AC_MSG_RESULT([found Intergraph 5.4+ SDK with ${ECW_ABIDIR} in ${ECW_LIBDIR}.]) 3569 ECW_54="yes" 3570 rm -f testnewabi.* 3571 rm -f testnewabi 3572 break 3573 fi 3574 rm -f testnewabi.* 3575 rm -f testnewabi 3576 fi 3577 if test "$ECW_LIBS" = ""; then 3578 ECW_LIBDIR=$with_ecw/$ecw_license_type/lib/$ECW_ARCH/$ECW_CONF 3579 if test -r $ECW_LIBDIR/libNCSEcw.a; then 3580 ECW_LIBS="-L$ECW_LIBDIR -lNCSEcw $ECW_FRAMEWORK_COCOA" 3581 with_ecw=$with_ecw/$ecw_license_type 3582 AC_MSG_RESULT([found Intergraph 5.x+ SDK in ${ECW_LIBDIR}.]) 3583 break 3584 fi 3585 fi 3586 done 3587 else 3588 AC_MSG_ERROR([not found in $with_ecw.]) 3589 fi 3590 3591 AC_MSG_CHECKING([for NCSECWClient.h in $with_ecw/include]) 3592 if test -r $with_ecw/include/NCSECWClient.h ; then 3593 AC_MSG_RESULT([found.]) 3594 ECW_INCLUDE="-I$with_ecw/include" 3595 else 3596 AC_MSG_ERROR([not found.]) 3597 fi 3598 AC_MSG_CHECKING([for ECWJP2BuildNumber.h in $with_ecw/include]) 3599 if test -r $with_ecw/include/ECWJP2BuildNumber.h ; then 3600 AC_MSG_RESULT([found.]) 3601 ECW_FLAGS="-DHAVE_ECW_BUILDNUMBER_H $ECW_FLAGS" 3602 else 3603 AC_MSG_RESULT([not found.]) 3604 fi 3605fi 3606 3607AC_SUBST(ECW_SETTING,$ECW_SETTING) 3608AC_SUBST(ECW_LIBS,$ECW_LIBS) 3609AC_SUBST(ECW_FLAGS,$ECW_FLAGS) 3610AC_SUBST(ECW_INCLUDE,$ECW_INCLUDE) 3611 3612if test "$ECW_SETTING" != "no" ; then 3613 OPT_GDAL_FORMATS="ecw $OPT_GDAL_FORMATS" 3614fi 3615 3616dnl --------------------------------------------------------------------------- 3617dnl Select Kakadu library or disable driver. 3618dnl --------------------------------------------------------------------------- 3619 3620AC_MSG_CHECKING([for Kakadu JPEG2000 support]) 3621 3622AC_ARG_WITH(kakadu,[ --with-kakadu[=ARG] Include Kakadu/JPEG2000 support],,) 3623 3624if test "$with_kakadu" = "no" -o "$with_kakadu" = "" ; then 3625 KAKDIR= 3626 AC_MSG_RESULT([not requested.]) 3627 HAVE_KAKADU=no 3628elif test "$with_kakadu" = "yes" ; then 3629 AC_MSG_ERROR([ 3630For JPEG2000 support using Kakadu you need provide the path to the Kakadu 3631build directory. Note that Kakadu is *not* free software.]) 3632else 3633 KAKDIR=$with_kakadu 3634 OPT_GDAL_FORMATS="jp2kak jpipkak $OPT_GDAL_FORMATS" 3635 LIBS="$LIBS -L$with_kakadu/lib -lkdu" 3636 AC_MSG_RESULT([requested.]) 3637 HAVE_KAKADU=yes 3638fi 3639 3640AC_SUBST(KAKDIR,$KAKDIR) 3641 3642dnl --------------------------------------------------------------------------- 3643dnl Select MrSID library or disable driver. 3644dnl --------------------------------------------------------------------------- 3645MRSID_FLAGS= 3646HAVE_MRSID=no 3647 3648AC_ARG_WITH(mrsid,[ --with-mrsid[=ARG] Include MrSID support (ARG=path to MrSID DSDK or no)],,) 3649 3650AC_ARG_WITH(jp2mrsid,[ --with-jp2mrsid[=ARG] Enable MrSID JPEG2000 support (ARG=yes/no)],,) 3651 3652if test "x$with_mrsid" = "xno" -o "x$with_mrsid" = "x" ; then 3653 3654 HAVE_MRSID=no 3655 3656 AC_MSG_NOTICE([MrSID support disabled.]) 3657 3658else 3659 3660 MRSID_BASE="$with_mrsid/include" 3661 3662 AC_MSG_CHECKING([for lt_base.h in $MRSID_BASE/support]) 3663 if test -r "$MRSID_BASE/support/lt_base.h" ; then 3664 3665 AC_MSG_RESULT([found MrSID DSDK version 4.x or newer.]) 3666 HAVE_MRSID=yes 3667 MRSID_INCLUDE="-I$MRSID_BASE/base -I$MRSID_BASE/metadata -I$MRSID_BASE/mrsid_readers -I$MRSID_BASE/j2k_readers -I$MRSID_BASE/support" 3668 3669 else 3670 3671 AC_MSG_RESULT([not found.]) 3672 3673 AC_MSG_CHECKING([for lt_base.h in $MRSID_BASE]) 3674 if test -r "$MRSID_BASE/lt_base.h" ; then 3675 3676 AC_MSG_RESULT([found MrSID DSDK version 7.x or newer.]); 3677 HAVE_MRSID=yes 3678 MRSID_INCLUDE="-I$MRSID_BASE" 3679 3680 fi 3681 3682 fi 3683 3684 if test $HAVE_MRSID = yes ; then 3685 3686 MRSID_LIBS="-lpthread" 3687 3688 if test -r "$with_mrsid/lib/libltiesdk.a" ; then # v8+ esdk contains dsdk 3689 _LIBPART=lib 3690 MRSID_LIBS="-lltiesdk $MRSID_LIBS" 3691 elif test -e "$with_mrsid/lib/libltidsdk.a" \ 3692 -o -e "$with_mrsid/lib/libltidsdk.so" \ 3693 -o -e "$with_mrsid/lib/libltidsdk.dylib" ; then 3694 _LIBPART=lib 3695 MRSID_LIBS="-lltidsdk $MRSID_LIBS" 3696 else 3697 _LIBPART=lib/Release 3698 MRSID_LIBS="-lltidsdk $MRSID_LIBS" 3699 fi 3700 3701 AC_MSG_CHECKING([for MG3ImageWriter.h in $with_mrsid/include/mrsid_writers]) 3702 if test -r "$with_mrsid/include/mrsid_writers/MG3ImageWriter.h" ; then 3703 AC_MSG_RESULT([found MrSID ESDK version 4.x or newer.]) 3704 MRSID_FLAGS="-DMRSID_ESDK $MRSID_FLAGS" 3705 MRSID_INCLUDE="-I$with_mrsid/include/mrsid_writers -I$with_mrsid/include/j2k_writers $MRSID_INCLUDE" 3706 if test -r $with_mrsid/3rd-party/lib/Release/libcryptopp.a ; then 3707 MRSID_LIBS="-lltiesdk -lcryptopp -lxmlparse $MRSID_LIBS" 3708 else 3709 MRSID_LIBS="-lltiesdk -lxmlparse $MRSID_LIBS" 3710 fi 3711 else 3712 AC_MSG_RESULT([no encoding support.]) 3713 fi 3714 3715 AC_MSG_CHECKING([for MrSID JPEG2000 support]) 3716 if test "x$with_jp2mrsid" = "xyes" -a "$HAVE_KAKADU" = "yes" ; then 3717 # SDK v8 or later don't seem to conflict with Kakadu 3718 major_version=`cat $with_mrsid/include/lti_version.h | grep MAJOR | sed 's/#define LTI_SDK_MAJOR[ ]*\(.*\)/\1/'` 3719 if test "x$major_version" != "x"; then 3720 if test "$major_version" -ge 8; then 3721 V8_OR_LATER=yes 3722 fi 3723 fi 3724 if test "x$V8_OR_LATER" = "x"; then 3725 AC_MSG_ERROR([MrSID JPEG2000 support requested, but this is incompatible with use of standalone Kakadu]) 3726 fi 3727 fi 3728 3729 MRSID_KAKADU_LIB="" 3730 if test "$HAVE_KAKADU" = "no" ; then 3731 if test x"$with_jp2mrsid" = x"" -o x"$with_jp2mrsid" = x"yes" ; then 3732 if test -r "$with_mrsid/3rd-party/$_LIBPART/libltikdu.a" ; then 3733 with_jp2mrsid=yes 3734 MRSID_KAKADU_LIB=-lltikdu 3735 elif test -r "$with_mrsid/3rd-party/$_LIBPART/liblt_kakadu.a" ; then 3736 with_jp2mrsid=yes 3737 MRSID_KAKADU_LIB=-llt_kakadu 3738 elif test -e "$with_mrsid/lib/libltidsdk.so" \ 3739 -o -e "$with_mrsid/lib/libltidsdk.dylib"; then # v8+ .so has kdu 3740 with_jp2mrsid=yes 3741 elif test x"$with_jp2mrsid" = x"yes" ; then 3742 AC_MSG_ERROR([MrSID JPEG2000 support requested, but libltikdu.a not found.]) 3743 else 3744 with_jp2mrsid=no 3745 fi 3746 fi 3747 fi 3748 3749 if test "x$with_jp2mrsid" = "xyes" ; then 3750 MRSID_LIBS="$MRSID_LIBS $MRSID_KAKADU_LIB" 3751 MRSID_FLAGS="-DMRSID_J2K $MRSID_FLAGS" 3752 AC_MSG_RESULT([enabled]) 3753 else 3754 AC_MSG_RESULT([disabled]) 3755 fi 3756 3757 MRSID_LIBS="-L$with_mrsid/$_LIBPART $MRSID_LIBS" 3758 MRSID_LIBS="-L$with_mrsid/3rd-party/$_LIBPART $MRSID_LIBS" 3759 3760 else 3761 HAVE_MRSID=no 3762 AC_MSG_RESULT([not found.]) 3763 AC_MSG_ERROR([ MrSID requested, but components not found.]) 3764 fi 3765fi 3766 3767AC_SUBST(MRSID_INCLUDE,$MRSID_INCLUDE) 3768AC_SUBST(MRSID_FLAGS,$MRSID_FLAGS) 3769AC_SUBST(MRSID_LIBS,$MRSID_LIBS) 3770 3771if test "$HAVE_MRSID" != "no" ; then 3772 CPPFLAGS="-D_REENTRANT $CPPFLAGS" 3773 OPT_GDAL_FORMATS="mrsid $OPT_GDAL_FORMATS" 3774fi 3775 3776dnl --------------------------------------------------------------------------- 3777dnl Select MrSID/MG4 Lidar library or disable driver. 3778dnl --------------------------------------------------------------------------- 3779 3780MRSID_LIDAR_FLAGS= 3781HAVE_MRSID_LIDAR=no 3782 3783AC_ARG_WITH(mrsid_lidar,[ --with-mrsid_lidar[=ARG] Include MrSID/MG4 LiDAR support (ARG=path to LizardTech LiDAR SDK or no)],,) 3784 3785if test "x$with_mrsid_lidar" = "xno" -o "x$with_mrsid_lidar" = "x" ; then 3786 HAVE_MRSID_LIDAR=no 3787 AC_MSG_NOTICE([MrSID/MG4 Lidar support disabled.]) 3788else 3789 MRSID_LIDAR_BASE="$with_mrsid_lidar" 3790 3791 if test -r "$MRSID_LIDAR_BASE/include/lidar/Version.h" ; then 3792 AC_MSG_RESULT([found LizardTech LiDAR SDK 1.1 or newer.]) 3793 HAVE_MRSID_LIDAR=yes 3794 else 3795 HAVE_MRSID_LIDAR=no 3796 AC_MSG_RESULT([not found.]) 3797 AC_MSG_ERROR([ MrSID/MG4 Lidar requested, but components not found.]) 3798 fi 3799 3800 if test $HAVE_MRSID_LIDAR = yes ; then 3801 if test -e "$MRSID_LIDAR_BASE/lib/liblti_lidar_dsdk.so" \ 3802 -o -e "$MRSID_LIDAR_BASE/lib/liblti_lidar_dsdk.dylib"; then 3803 MRSID_LIDAR_LIBS="-L$MRSID_LIDAR_BASE/lib -llti_lidar_dsdk" 3804 MRSID_LIDAR_INCLUDE="-I$MRSID_LIDAR_BASE/include" 3805 else 3806 MRSID_LIDAR_LIBS="-L$MRSID_LIDAR_BASE/lib/Release -llti_lidar_dsdk" 3807 MRSID_LIDAR_INCLUDE="-I$MRSID_LIDAR_BASE/include" 3808 fi 3809 fi 3810fi 3811 3812AC_SUBST(MRSID_LIDAR_INCLUDE,$MRSID_LIDAR_INCLUDE) 3813AC_SUBST(MRSID_LIDAR_LIBS,$MRSID_LIDAR_LIBS) 3814 3815if test "$HAVE_MRSID_LIDAR" != "no" ; then 3816 OPT_GDAL_FORMATS="mrsid_lidar $OPT_GDAL_FORMATS" 3817fi 3818 3819dnl --------------------------------------------------------------------------- 3820dnl Check if LuraTech library is available. 3821dnl --------------------------------------------------------------------------- 3822 3823AC_ARG_WITH(jp2lura,[ --with-j2lura[=ARG] Include JP2Lua support (ARG=no, lura SDK install path)],,) 3824 3825AC_MSG_CHECKING([for JP2Lura support]) 3826 3827HAVE_JP2LURA=no 3828JP2LURA_INCLUDE= 3829 3830if test "$with_jp2lura" != "" -a "$with_jp2lura" != "no" ; then 3831 AC_MSG_CHECKING([for lwf_jp2.h]) 3832 if test -f "$with_jp2lura/include/lwf_jp2.h"; then 3833 AC_MSG_RESULT([yes]) 3834 else 3835 AC_MSG_RESULT([no]) 3836 AC_MSG_ERROR([JP2Lura support requested but header not found]) 3837 fi 3838 JP2LURA_INCLUDE="-I$with_jp2lura/include" 3839 3840 # mingw support 3841 if test -f "$with_jp2lura/library/lwf_jp2.lib"; then 3842 ln -s "$with_jp2lura/library/lwf_jp2.lib" "$with_jp2lura/library/lib_lwf_jp2.a" 3843 fi 3844 3845 ORIG_LIBS="$LIBS" 3846 LIBS="-L$with_jp2lura/library" 3847 3848 AC_CHECK_LIB(_lwf_jp2,JP2_Decompress_SetLicense,HAVE_JP2LURA="yes",,-lm) 3849 3850 if test "$HAVE_JP2LURA" = "no" ; then 3851 AC_MSG_ERROR([JP2Lura support requested but library not found]) 3852 fi 3853 3854 LIBS="-L$with_jp2lura/library -l_lwf_jp2 -lm $ORIG_LIBS" 3855fi 3856 3857AC_SUBST([JP2LURA_INCLUDE], [$JP2LURA_INCLUDE]) 3858 3859if test "$HAVE_JP2LURA" != "no" ; then 3860 OPT_GDAL_FORMATS="jp2lura $OPT_GDAL_FORMATS" 3861fi 3862 3863dnl --------------------------------------------------------------------------- 3864dnl Enable MSG format if EUMETSAT Wavelet Transform Software 3865dnl available in the local tree 3866dnl --------------------------------------------------------------------------- 3867 3868AC_ARG_WITH([msg], 3869 AS_HELP_STRING([--with-msg[=ARG]], 3870 [Enable MSG driver (ARG=yes or no)]),,) 3871 3872HAVE_MSG=no 3873HAVE_EUMETSATWT=no 3874 3875if test "x$with_msg" = "xyes" ; then 3876 AC_MSG_CHECKING([for EUMETSAT Wavelet Transformation Software]) 3877 3878 if test -d "frmts/msg/PublicDecompWT" -a \ 3879 -f "frmts/msg/PublicDecompWT/COMP/Inc/CImage.h"; then 3880 HAVE_EUMETSATWT=yes 3881 else 3882 HAVE_EUMETSATWT=no 3883 fi 3884 AC_MSG_RESULT([$HAVE_EUMETSATWT]) 3885fi 3886 3887AC_MSG_CHECKING([for MSG]) 3888 3889if test "x$with_msg" = "xyes" -o "x$with_msg" = "x" \ 3890 -a "x$HAVE_EUMETSATWT" = "xyes"; then 3891 OPT_GDAL_FORMATS="msg $OPT_GDAL_FORMATS" 3892 HAVE_MSG=yes 3893 AC_MSG_RESULT([enabled]) 3894else 3895 HAVE_MSG=no 3896 AC_MSG_RESULT([not requested]) 3897fi 3898 3899 3900dnl --------------------------------------------------------------------------- 3901dnl Check for GeoRaster in the local tree. 3902dnl --------------------------------------------------------------------------- 3903 3904ORACLE_OCI_REQ_VERSION="10.0.1" 3905AX_LIB_ORACLE_OCI($ORACLE_OCI_REQ_VERSION) 3906 3907if test "$HAVE_ORACLE_OCI" = "yes"; then 3908 OPT_GDAL_FORMATS="georaster $OPT_GDAL_FORMATS" 3909 HAVE_GEORASTER=yes 3910else 3911 HAVE_GEORASTER=no 3912fi 3913 3914 3915dnl --------------------------------------------------------------------------- 3916 3917AC_SUBST([OPT_GDAL_FORMATS], [$OPT_GDAL_FORMATS]) 3918 3919dnl --------------------------------------------------------------------------- 3920 3921GNM_ENABLED=yes 3922 3923AC_ARG_WITH(gnm,[ --with-gnm Build GNM into shared library],,) 3924 3925if test "$with_gnm" = "no" ; then 3926 GNM_ENABLED=no 3927 AC_MSG_RESULT([disabled by user]) 3928else 3929 GNM_ENABLED=yes 3930 AC_MSG_RESULT([enabled]) 3931fi 3932AC_SUBST(GNM_ENABLED,$GNM_ENABLED) 3933 3934dnl --------------------------------------------------------------------------- 3935dnl Select an MySQL Library to use, or disable driver. 3936dnl --------------------------------------------------------------------------- 3937 3938MYSQL_CONFIG=no 3939 3940AC_ARG_WITH(mysql,[ --with-mysql[=ARG] Include MySQL (ARG=path to mysql_config) [[default=no]]],,) 3941 3942if test "$with_mysql" = "yes" ; then 3943 AC_PATH_PROG(MYSQL_CONFIG, mysql_config, no) 3944else 3945 if test "x$with_mysql" != "x" ; then 3946 MYSQL_CONFIG=$with_mysql 3947 fi 3948fi 3949 3950AC_MSG_CHECKING([for MySQL]) 3951 3952if test "$MYSQL_CONFIG" = "no" ; then 3953 3954 HAVE_MYSQL=no 3955 MYSQL_LIB= 3956 MYSQL_INC= 3957 3958 AC_MSG_RESULT([no]) 3959 3960else 3961 if test -d $MYSQL_CONFIG ; then 3962 AC_MSG_RESULT([no]) 3963 AC_MSG_ERROR([--with-mysql argument is a directory. It should be the path to the mysql_config script, often somewhere like /usr/local/bin/mysql_config.]) 3964 fi 3965 3966 if test \! -x $MYSQL_CONFIG ; then 3967 AC_MSG_RESULT([no]) 3968 AC_MSG_ERROR([--with-mysql argument is a not an executable file. It should be the path to the mysql_config script, often somewhere like /usr/local/bin/mysql_config.]) 3969 fi 3970 3971 MYSQL_VERSION="`$MYSQL_CONFIG --version`" 3972 MYSQL_MAJOR_VERSION=${MYSQL_VERSION%%'.'*} 3973 3974 if test $MYSQL_MAJOR_VERSION -le 3 ; then 3975 HAVE_MYSQL=no 3976 AC_MSG_RESULT([no, mysql is pre-4.x]) 3977 else 3978 HAVE_MYSQL=yes 3979 MYSQL_LIB="`$MYSQL_CONFIG --libs`" 3980 STRIP_SYSTEM_LIBRARY_PATHS("${MYSQL_LIB}") 3981 MYSQL_LIB="$STRIPPED_LIBRARY_NAME" 3982 MYSQL_INC="`$MYSQL_CONFIG --include`" 3983 AC_MSG_RESULT([yes]) 3984 fi 3985fi 3986 3987AC_SUBST(HAVE_MYSQL,$HAVE_MYSQL) 3988AC_SUBST(MYSQL_INC,$MYSQL_INC) 3989AC_SUBST(MYSQL_LIB,$MYSQL_LIB) 3990 3991dnl --------------------------------------------------------------------------- 3992dnl INGRES support. 3993dnl --------------------------------------------------------------------------- 3994 3995AC_ARG_WITH(ingres,[ --with-ingres=ARG Include Ingres (ARG=$II_SYSTEM)],,) 3996 3997AC_MSG_CHECKING([for Ingres]) 3998 3999if test "$with_ingres" = "no" -o "x$with_ingres" = "x" ; then 4000 HAVE_INGRES=no 4001 II_SYSTEM= 4002 INGRES_LIB= 4003 INGRES_INC= 4004 AC_MSG_RESULT([no]) 4005elif test "$with_ingres" = "yes" ; then 4006 AC_MSG_ERROR([--with-ingres requires a path argument ($II_SYSTEM)]) 4007else 4008 HAVE_INGRES=yes 4009 II_SYSTEM=$with_ingres 4010 INGRES_LIB="-L$II_SYSTEM/ingres/lib \ 4011 -liiapi.1 -lcompat.1 -lq.1 -lframe.1" 4012 INGRES_INC=-I$II_SYSTEM/ingres/files 4013fi 4014 4015AC_SUBST(HAVE_INGRES,$HAVE_INGRES) 4016AC_SUBST(II_SYSTEM,$II_SYSTEM) 4017AC_SUBST(INGRES_LIB,$INGRES_LIB) 4018AC_SUBST(INGRES_INC,$INGRES_INC) 4019 4020dnl --------------------------------------------------------------------------- 4021dnl Check for Xerces C++ Parser support. 4022dnl --------------------------------------------------------------------------- 4023 4024XERCES_REQ_VERSION="3.1.0" 4025AX_LIB_XERCES($XERCES_REQ_VERSION) 4026 4027if test "$HAVE_XERCES" = "yes"; then 4028 LIBS="$XERCES_LDFLAGS $LIBS" 4029 4030m4_foreach_w([frmt],XERCES_DRIVERS,[ 4031 driver_enabled=m4_join([_],[$INTERNAL_FORMAT],frmt,[ENABLED]) 4032 if test "x$driver_enabled" = "xyes"; then 4033 OGRFORMATS_ENABLED="$OGRFORMATS_ENABLED frmt" 4034 OGRFORMATS_ENABLED_CFLAGS="$OGRFORMATS_ENABLED_CFLAGS _OGRDEFINE(frmt)" 4035 fi 4036]) 4037 4038fi 4039 4040AC_SUBST([HAVE_XERCES], $HAVE_XERCES) 4041AC_SUBST([XERCES_INCLUDE], $XERCES_CFLAGS) 4042 4043dnl --------------------------------------------------------------------------- 4044dnl Check for Expat configuration. 4045dnl --------------------------------------------------------------------------- 4046 4047dnl Expat 1.95.0 released in 2000-09-28 4048EXPAT_REQ_VERSION="1.95.0" 4049AX_LIB_EXPAT($EXPAT_REQ_VERSION) 4050 4051if test "$HAVE_EXPAT" = "yes"; then 4052 LIBS="$EXPAT_LDFLAGS $LIBS" 4053 4054m4_foreach_w([frmt],EXPAT_DRIVERS,[ 4055 driver_enabled=m4_join([_],[$INTERNAL_FORMAT],frmt,[ENABLED]) 4056 if test "x$driver_enabled" = "xyes"; then 4057 OGRFORMATS_ENABLED="$OGRFORMATS_ENABLED frmt" 4058 OGRFORMATS_ENABLED_CFLAGS="$OGRFORMATS_ENABLED_CFLAGS _OGRDEFINE(frmt)" 4059 fi 4060]) 4061 4062fi 4063 4064AC_SUBST([HAVE_EXPAT], $HAVE_EXPAT) 4065AC_SUBST([EXPAT_INCLUDE], $EXPAT_CFLAGS) 4066 4067dnl --------------------------------------------------------------------------- 4068dnl Check for Google libkml support. 4069dnl --------------------------------------------------------------------------- 4070 4071LIBKML_REQ_VERSION="1.3.0" 4072AX_LIB_LIBKML($LIBKML_REQ_VERSION) 4073 4074if test "$HAVE_LIBKML" = "yes"; then 4075 LIBS="$LIBKML_LDFLAGS $LIBS" 4076fi 4077 4078AC_SUBST([HAVE_LIBKML], $HAVE_LIBKML) 4079AC_SUBST([LIBKML_INCLUDE], $LIBKML_CFLAGS) 4080 4081dnl --------------------------------------------------------------------------- 4082dnl Check for ODBC support. 4083dnl --------------------------------------------------------------------------- 4084 4085AC_ARG_WITH(odbc,[ --with-odbc[=ARG] Include ODBC support (ARG=no or path)],,) 4086 4087if test "$with_odbc" = "no" ; then 4088 4089 ODBC_SETTING=no 4090 4091 echo "ODBC support disabled." 4092 4093elif test "$with_odbc" = "yes" -o "$with_odbc" = "" ; then 4094 ODBC_SETTING=no 4095 4096 echo "check for unixODBC" 4097 AC_CHECK_LIB(odbc,SQLConnect,[ODBC_LIBS="-lodbc -lodbcinst"]) 4098 AC_CHECK_LIB(odbcinst,SQLInstallDriverEx,ODBC_SETTING=yes) 4099 4100 if test "$ODBC_SETTING" = "no" ; then 4101 echo "check for windows ODBC" 4102 AC_CHECK_LIB(odbc32,main,[ODBC_LIBS="-lodbc32 -lodbccp32"]) 4103 AC_CHECK_LIB(odbccp32,SQLInstallDriverEx,ODBC_SETTING=yes) 4104 fi 4105 4106 if test "$ODBC_SETTING" = "yes" ; then 4107 AC_CHECK_HEADERS(sql.h,,[ODBC_SETTING=no], 4108[#ifdef _WIN32 4109# include <windows.h> 4110#endif 4111]) 4112 if test "$ODBC_SETTING" = "no" ; then 4113 if test -f /usr/local/include/sql.h ; then 4114 ODBC_SETTING=yes 4115 echo "using sql.h from /usr/local/include" 4116 elif test -f /usr/include/sql.h ; then 4117 ODBC_SETTING=yes 4118 echo "using sql.h from /usr/include" 4119 else 4120 echo "sql.h not found" 4121 fi 4122 fi 4123 fi 4124 4125 if test "$ODBC_SETTING" = "yes" ; then 4126 LIBS="$ODBC_LIBS $LIBS" 4127 fi 4128 4129else 4130 4131 ODBC_SETTING=yes 4132 ODBC_LIBS="" 4133 AC_CHECK_LIB(odbc,SQLConnect,ODBC_LIBS="-lodbc -lodbcinst") 4134 AC_CHECK_LIB(odbc32,main,ODBC_LIBS="-lodbc32 -lodbccp32") 4135 if test "$ODBC_LIBS" = ""; then 4136 AC_MSG_ERROR([Cannot find ODBC libs]) 4137 fi 4138 LIBS="-L$with_odbc -L$with_odbc/lib $ODBC_LIBS $LIBS" 4139 EXTRA_INCLUDES="-I$with_odbc -I$with_odbc/include $EXTRA_INCLUDES" 4140 4141 echo "using odbc library from $with_odbc." 4142fi 4143 4144if test "$ODBC_SETTING" = "yes" ; then 4145m4_foreach_w([frmt],ODBC_DRIVERS,[ 4146 driver_enabled=m4_join([_],[$INTERNAL_FORMAT],frmt,[ENABLED]) 4147 if test "x$driver_enabled" = "xyes"; then 4148 OGRFORMATS_ENABLED="$OGRFORMATS_ENABLED frmt" 4149 OGRFORMATS_ENABLED_CFLAGS="$OGRFORMATS_ENABLED_CFLAGS _OGRDEFINE(frmt)" 4150 fi 4151]) 4152fi 4153 4154AC_SUBST(ODBC_SETTING,$ODBC_SETTING) 4155 4156dnl --------------------------------------------------------------------------- 4157dnl Check for OCI support. 4158dnl --------------------------------------------------------------------------- 4159 4160ORACLE_OCI_REQ_VERSION="8.1.7" 4161AX_LIB_ORACLE_OCI($ORACLE_OCI_REQ_VERSION) 4162 4163if test "$HAVE_ORACLE_OCI" = "yes"; then 4164 OCI_INCLUDE="$ORACLE_OCI_CFLAGS" 4165 LIBS="$ORACLE_OCI_LDFLAGS $LIBS" 4166fi 4167 4168AC_SUBST([HAVE_OCI], [$HAVE_ORACLE_OCI]) 4169AC_SUBST([OCI_INCLUDE], $[OCI_INCLUDE]) 4170 4171dnl --------------------------------------------------------------------------- 4172dnl Check for DODS. 4173dnl --------------------------------------------------------------------------- 4174 4175HAVE_DODS=no 4176 4177AC_MSG_CHECKING(for DODS) 4178AC_ARG_WITH(dods_root, 4179 [ --with-dods-root[=ARG] Include DODS support (ARG=no or absolute path)], 4180 ,,) 4181 4182if test -z "$with_dods_root" -o "$with_dods_root" = "no"; then 4183 AC_MSG_RESULT(disabled) 4184elif test "$with_dods_root" = "yes" ; then 4185 AC_MSG_ERROR([--with-dods-root requires path to dods root as argument]) 4186else 4187 DODS_LIB=$with_dods_root/lib 4188 DODS_INC="-I$with_dods_root/include" 4189 if test -d "$with_dods_root/include/libdap"; then 4190 DODS_INC="$DODS_INC -I$with_dods_root/include/libdap"; 4191 elif test -d "$with_dods_root/include/dap"; then 4192 DODS_INC="$DODS_INC -I$with_dods_root/include/dap"; 4193 fi 4194 DODS_BIN=$with_dods_root/bin 4195 4196 dnl Check libdap version the sane way (if possible through dap-config) 4197 if test -x $DODS_BIN/dap-config ; then 4198 LIBDAP_VER=`${DODS_BIN}/dap-config --version |awk '{print \$2}'` 4199 LIBDAP_CFLAGS=`${DODS_BIN}/dap-config --cflags` 4200 dnl The dods driver needs LIBDAP_320 and LIBDAP_39 defined to include the right headers 4201 DODS_INC="$DODS_INC $LIBDAP_CFLAGS -DLIBDAP_310 -DLIBDAP_39" 4202 dnl libs from dap-config gets added further down 4203 AC_MSG_RESULT([libdap $LIBDAP_VER]) 4204 else 4205 PKG_PROG_PKG_CONFIG([0.21]) 4206 PKG_CHECK_MODULES(LIBDAP,[libdap], [HAVE_LIBDAP=yes], [HAVE_LIBDAP=no]) 4207 4208 if test "${HAVE_LIBDAP}" = "yes"; then 4209 dnl The dods driver needs LIBDAP_320 and LIBDAP_39 defined to include the right headers 4210 DODS_INC="$DODS_INC $LIBDAP_CFLAGS -DLIBDAP_310 -DLIBDAP_39" 4211 else 4212 dnl Check the version by compiling test programs 4213 4214 dnl Test if we have libdap >= 3.10 4215 dnl From libdap 3.10, AISConnect.h has been renamed as Connect.h 4216 rm -f islibdappost310.* 4217 echo '#include "Connect.h"' > islibdappost310.cpp 4218 echo 'int main(int argc, char** argv) { return 0; } ' >> islibdappost310.cpp 4219 if test -z "`${CXX} ${CXXFLAGS} ${CPPFLAGS} islibdappost310.cpp -c ${DODS_INC} ${CPPFLAGS} 2>&1`" ; then 4220 dnl yes, libdap >= 3.10 4221 DODS_INC="$DODS_INC -DLIBDAP_310 -DLIBDAP_39" 4222 AC_MSG_RESULT([libdap >= 3.10]) 4223 else 4224 AC_MSG_RESULT([libdap < 3.10]) 4225 4226 dnl Test if we have libdap < 3.9 4227 dnl Before libdap < 3.9, DAS derived from AttrTable class 4228 dnl I wish they had defines with version numbers instead of this test ! 4229 rm -f islibdappre39.* 4230 echo '#include "DAS.h"' > islibdappre39.cpp 4231 echo '#include "AttrTable.h"' >> islibdappre39.cpp 4232 echo 'using namespace libdap;' >> islibdappre39.cpp 4233 echo 'int main(int argc, char** argv) { DAS oDAS; AttrTable& oAttrTable = oDAS; } ' >> islibdappre39.cpp 4234 if test -z "`${CXX} ${CXXFLAGS} ${CPPFLAGS} islibdappre39.cpp -c ${DODS_INC} 2>&1`" ; then 4235 dnl yes, libdap < 3.9 4236 AC_MSG_RESULT([libdap < 3.9]) 4237 else 4238 DODS_INC="$DODS_INC -DLIBDAP_39" 4239 AC_MSG_RESULT([libdap >= 3.9]) 4240 fi 4241 rm -f islibdappre39.* 4242 4243 fi 4244 rm -f islibdappost310.* 4245 fi 4246 fi 4247 4248 4249 dnl Add the DODS libraries to LIBS 4250 if test -x $DODS_BIN/opendap-config ; then 4251 dnl OPeNDAP 3.4 and earlier lack opendap-config, but use it if avail. 4252 LIBS="$LIBS `$DODS_BIN/opendap-config --libs`" 4253 elif test -x $DODS_BIN/dap-config ; then 4254 dnl OPeNDAP 3.4 and earlier lack opendap-config, but use it if avail. 4255 LIBS="$LIBS `$DODS_BIN/dap-config --libs`" 4256 elif test "${HAVE_LIBDAP}" = "yes"; then 4257 LIBS="$LIBS $LIBDAP_LIBS" 4258 else 4259 dnl Otherwise try to put things together in a more primitive way. 4260 LIBS="$LIBS -L$DODS_LIB -ldap++ -lpthread -lrx" 4261 4262 dnl Add curl to LIBS; it might be local to DODS or generally installed 4263 if test -x $DODS_BIN/curl-config; then 4264 LIBS="$LIBS `$DODS_BIN/curl-config --libs`" 4265 elif which curl-config > /dev/null 2>&1; then 4266 LIBS="$LIBS `curl-config --libs`" 4267 else 4268 AC_MSG_ERROR([You gave a dods root, but I can't find curl!]) 4269 fi 4270 4271 if test -x $DODS_BIN/xml2-config; then 4272 LIBS="$LIBS `$DODS_BIN/xml2-config --libs`" 4273 elif which xml2-config > /dev/null 2>&1; then 4274 LIBS="$LIBS `xml2-config --libs`" 4275 else 4276 AC_MSG_ERROR([You gave a dods root, but I can't find xml2!]) 4277 fi 4278 fi 4279 4280 OPT_GDAL_FORMATS="dods $OPT_GDAL_FORMATS" 4281 DODSDEF=-DFRMT_dods 4282 AC_MSG_RESULT(setting DODS root directory to $with_dods_root) 4283 HAVE_DODS=yes 4284fi 4285 4286dnl This is used by the GNUmakefile in frmts/dods (via GDALmake.opt) 4287AC_SUBST(DODS_INC) 4288 4289dnl --------------------------------------------------------------------------- 4290dnl Check for libxml2. 4291dnl --------------------------------------------------------------------------- 4292 4293HAVE_LIBXML2=no 4294LIBXML2_INC= 4295LIBXML2_LIB= 4296 4297AC_ARG_WITH(xml2, 4298 [ --with-xml2[=ARG] Include libxml2 (ARG=yes/no)],,,) 4299 4300if test "x$with_xml2" = "xyes" -o "x$with_xml2" = "x" ; then 4301 4302 PKG_PROG_PKG_CONFIG([0.21]) 4303 PKG_CHECK_MODULES(LIBXML2,[libxml-2.0], [HAVE_LIBXML2=yes], [HAVE_LIBXML2=no]) 4304 4305 if test "${HAVE_LIBXML2}" = "yes"; then 4306 SAVED_LIBS="${LIBS}" 4307 LIBS="${LIBXML2_LIBS}" 4308 AC_CHECK_LIB(xml2,xmlParseDoc,HAVE_LIBXML2=yes,HAVE_LIBXML2=no) 4309 LIBS="${SAVED_LIBS}" 4310 fi 4311 4312 if test "${HAVE_LIBXML2}" = "yes"; then 4313 LIBXML2_INC="${LIBXML2_CFLAGS}" 4314 LIBXML2_LIB="${LIBXML2_LIBS}" 4315 else 4316 if test "x$with_xml2" = "xyes"; then 4317 AC_MSG_ERROR([--with-xml2 was requested, but libxml2 is not available]) 4318 fi 4319 fi 4320elif test "x$with_xml2" != "xno"; then 4321 AC_MSG_ERROR([Only --with-xml2=yes/no supported]) 4322fi 4323 4324AC_SUBST(HAVE_LIBXML2,$HAVE_LIBXML2) 4325AC_SUBST(LIBXML2_INC, $LIBXML2_INC) 4326AC_SUBST(LIBXML2_LIB, $LIBXML2_LIB) 4327 4328dnl --------------------------------------------------------------------------- 4329dnl Check for librasterlite2. 4330dnl --------------------------------------------------------------------------- 4331 4332AC_ARG_WITH(rasterlite2, 4333 [ --with-rasterlite2=ARG Include RasterLite2 support (ARG=no(default), yes or path)], 4334 ,,) 4335 4336HAVE_RASTERLITE2=no 4337RASTERLITE2_CFLAGS= 4338 4339if test -z "$with_rasterlite2" -o "$with_rasterlite2" = "no"; then 4340 AC_MSG_NOTICE([rasterlite2 support disabled]) 4341elif test "$with_rasterlite2" = "yes"; then 4342 AC_CHECK_HEADERS(rasterlite2/rasterlite2.h) 4343 if test "$ac_cv_header_rasterlite2_rasterlite2_h" = "yes"; then 4344 AC_CHECK_LIB(rasterlite2,rl2_load_raw_tiles_into_dbms,HAVE_RASTERLITE2=yes,HAVE_RASTERLITE2=no,) 4345 if test "$HAVE_RASTERLITE2" = "yes"; then 4346 LIBS="$LIBS -lrasterlite2 -lsqlite3" 4347 else 4348 AC_MSG_ERROR([did not find rl2_load_raw_tiles_into_dbms]) 4349 fi 4350 else 4351 AC_MSG_ERROR([did not find rasterlite2.h]) 4352 fi 4353else 4354 AC_MSG_CHECKING([for include/rasterlite2/rasterlite2.h]) 4355 if test -f "$with_rasterlite2/include/rasterlite2/rasterlite2.h"; then 4356 AC_MSG_RESULT([found]) 4357 AC_CHECK_LIB(rasterlite2,rl2_load_raw_tiles_into_dbms,HAVE_RASTERLITE2=yes,HAVE_RASTERLITE2=no,-L$with_rasterlite2/lib) 4358 if test "$HAVE_RASTERLITE2" = "yes"; then 4359 RASTERLITE2_CFLAGS="-I$with_rasterlite2/include" 4360 LIBS="$LIBS -L$with_rasterlite2/lib -lrasterlite2 -lsqlite3" 4361 else 4362 AC_MSG_ERROR([did not find rl2_load_raw_tiles_into_dbms]) 4363 fi 4364 else 4365 AC_MSG_ERROR([did not find rasterlite2.h]) 4366 fi 4367fi 4368 4369AC_SUBST([HAVE_RASTERLITE2], $HAVE_RASTERLITE2) 4370AC_SUBST([RASTERLITE2_CFLAGS], $RASTERLITE2_CFLAGS) 4371 4372dnl --------------------------------------------------------------------------- 4373dnl Check for PCRE. 4374dnl --------------------------------------------------------------------------- 4375 4376HAVE_PCRE=no 4377 4378AC_ARG_WITH(pcre, 4379 [ --with-pcre Include libpcre support (REGEXP support for SQLite)], 4380 ,,) 4381 4382if test "$with_pcre" = "no"; then 4383 AC_MSG_RESULT(disabled) 4384 HAVE_PCRE=no 4385else 4386 AC_CHECK_HEADERS([pcre.h]) 4387 if test "$ac_cv_header_pcre_h" = "no" ; then 4388 if test "$with_pcre" = "yes"; then 4389 AC_MSG_ERROR([cannot find pcre.h]) 4390 fi 4391 else 4392 AC_CHECK_LIB(pcre,pcre_compile,HAVE_PCRE=yes,HAVE_PCRE=no,) 4393 if test "$HAVE_PCRE" = "yes" ; then 4394 HAVE_PCRE=yes 4395 LIBS="$LIBS -lpcre" 4396 else 4397 if test "$with_pcre" = "yes"; then 4398 AC_MSG_ERROR([cannot find libpcre]) 4399 fi 4400 fi 4401 fi 4402fi 4403 4404AC_SUBST(HAVE_PCRE) 4405 4406dnl --------------------------------------------------------------------------- 4407dnl Check for Teigha. 4408dnl --------------------------------------------------------------------------- 4409 4410TEIGHA_DIR= 4411TEIGHA_CPPFLAGS= 4412 4413AC_MSG_CHECKING(Checking for Teigha) 4414AC_ARG_WITH(teigha, 4415 [ --with-teigha[=path] Include Teigha DWG/DGN support], 4416 ,,) 4417 4418if test -z "$with_teigha" -o "$with_teigha" = "no"; then 4419 AC_MSG_RESULT(disabled) 4420 HAVE_TEIGHA=no 4421else 4422 AC_MSG_RESULT(enabled) 4423 4424 AC_ARG_WITH(teigha-plt, 4425 [ --with-teigha-plt[=platform] Teigha platform], 4426 ,,) 4427 if test "x$with_teigha_plt" != "x" ; then 4428 TEIGHA_DIR=$with_teigha 4429 HAVE_TEIGHA=yes 4430 TEIGHA_PLT=$with_teigha_plt 4431 LIBS="${LIBS} ${TEIGHA_DIR}/bin/${TEIGHA_PLT}/TG_Db.tx" 4432 if test -f "${TEIGHA_DIR}/bin/${TEIGHA_PLT}/TD_DbEntities.tx"; then 4433 LIBS="${LIBS} ${TEIGHA_DIR}/bin/${TEIGHA_PLT}/TD_DbEntities.tx" 4434 LIBS="${LIBS} ${TEIGHA_DIR}/lib/${TEIGHA_PLT}/libTD_DrawingsExamplesCommon.a" 4435 fi 4436 LIBS="${LIBS} ${TEIGHA_DIR}/lib/${TEIGHA_PLT}/libTG_ExamplesCommon.a" 4437 LIBS="${LIBS} ${TEIGHA_DIR}/lib/${TEIGHA_PLT}/libTD_ExamplesCommon.a" 4438 LIBS="${LIBS} ${TEIGHA_DIR}/lib/${TEIGHA_PLT}/libTD_Key.a" 4439 LIBS="${LIBS} -L${TEIGHA_DIR}/bin/${TEIGHA_PLT} -lTD_Db" 4440 if test -f "${TEIGHA_DIR}/bin/${TEIGHA_PLT}/libTD_DbCore.*"; then 4441 LIBS="${LIBS} -L${TEIGHA_DIR}/bin/${TEIGHA_PLT} -lTD_DbCore" 4442 fi 4443 LIBS="${LIBS} -L${TEIGHA_DIR}/bin/${TEIGHA_PLT} -lTD_DbRoot" 4444 LIBS="${LIBS} -L${TEIGHA_DIR}/bin/${TEIGHA_PLT} -lTD_Gi" 4445 LIBS="${LIBS} -L${TEIGHA_DIR}/bin/${TEIGHA_PLT} -lTD_SpatialIndex" 4446 LIBS="${LIBS} -L${TEIGHA_DIR}/bin/${TEIGHA_PLT} -lTD_Root" 4447 LIBS="${LIBS} -L${TEIGHA_DIR}/bin/${TEIGHA_PLT} -lTD_Ge" 4448 if test -f "${TEIGHA_DIR}/bin/${TEIGHA_PLT}/libTD_Zlib.*"; then 4449 LIBS="${LIBS} -L${TEIGHA_DIR}/bin/${TEIGHA_PLT} -lTD_Zlib" 4450 fi 4451 LIBS="${LIBS} -L${TEIGHA_DIR}/bin/${TEIGHA_PLT} -lTD_Alloc" 4452 LIBS="${LIBS} -L${TEIGHA_DIR}/bin/${TEIGHA_PLT} -loless" 4453 if test -f "${TEIGHA_DIR}/bin/${TEIGHA_PLT}/liblibcrypto.*"; then 4454 LIBS="${LIBS} -L${TEIGHA_DIR}/bin/${TEIGHA_PLT} -llibcrypto" 4455 fi 4456 if test -f "${TEIGHA_DIR}/bin/${TEIGHA_PLT}/libTD_Db.so"; then 4457 TEIGHA_CPPFLAGS="-D_TOOLKIT_IN_DLL_" 4458 fi 4459 else 4460 AC_MSG_ERROR([--with-teigha-plt not specified]) 4461 fi 4462fi 4463 4464AC_SUBST(TEIGHA_DIR) 4465AC_SUBST(HAVE_TEIGHA) 4466AC_SUBST(TEIGHA_CPPFLAGS) 4467 4468dnl --------------------------------------------------------------------------- 4469dnl Select Informix DataBlade support 4470dnl --------------------------------------------------------------------------- 4471 4472HAVE_IDB=no 4473 4474AC_ARG_WITH(idb,[ --with-idb=DIR Include Informix DataBlade support (DIR points to Informix root)],,) 4475 4476if test x"${with_idb}" = x"no" ; then 4477 AC_MSG_NOTICE(["IBM Informix DataBlade support disabled."]) 4478else 4479 if test x"${with_idb}" = x ; then 4480 with_idb=$INFORMIXDIR 4481 fi 4482 4483 if test -e "${with_idb}/incl/c++/it.h" ; then 4484 4485 LIBS_DIRS="-L${with_idb}/lib/ -L${with_idb}/lib/esql" 4486 LIBS_ESQL="-lifsql -lifasf -lifgen -lifos -lifgls -lifglx ${with_idb}/lib/esql/checkapi.o" 4487 LIBS_LIBMI="-L${with_idb}/lib/dmi -lifdmi" 4488 LIBS_CPPIF="-L${with_idb}/lib/c++ -lifc++" 4489 4490 IDB_INC="-I${with_idb}/incl/ -I${with_idb}/incl/dmi -I${with_idb}/incl/c++" 4491 IDB_LIB="${LIBS_CPPIF} ${LIBS_LIBMI} ${LIBS_DIRS} ${LIBS_ESQL}" 4492 4493 ax_save_LIBS="${LIBS}" 4494 LIBS="${IDB_LIB} -ldl -lcrypt" 4495 AC_CHECK_LIB(ifsql,ifx_srvinfo,HAVE_IDB=yes,HAVE_IDB=no,) 4496 LIBS="${ax_save_LIBS}" 4497 4498 fi 4499 4500 if test "${HAVE_IDB}" = "yes" ; then 4501 AC_MSG_NOTICE([using Informix C++ client library from $with_idb.]) 4502 else 4503 AC_MSG_NOTICE([IBM Informix DataBlade not supported.]) 4504 fi 4505 4506fi 4507 4508AC_SUBST(HAVE_IDB,${HAVE_IDB}) 4509AC_SUBST(IDB_INC,${IDB_INC}) 4510AC_SUBST(IDB_LIB,${IDB_LIB}) 4511 4512dnl --------------------------------------------------------------------------- 4513dnl Check if webp library is available. 4514dnl --------------------------------------------------------------------------- 4515 4516AC_ARG_WITH(webp,[ --with-webp[=ARG] Include WEBP support (ARG=no, yes or libwebp install root path)],,) 4517 4518WEBP_SETTING=no 4519 4520if test "$with_webp" = "yes" -o "$with_webp" = "" ; then 4521 4522 AC_CHECK_LIB(webp,WebPDecodeRGB,WEBP_SETTING=yes,WEBP_SETTING=no,) 4523 4524 if test "$WEBP_SETTING" = "yes" ; then 4525 LIBS="-lwebp $LIBS" 4526 else 4527 echo "libwebp not found - WEBP support disabled" 4528 fi 4529 4530elif test "$with_webp" != "no" -a "$with_webp" != ""; then 4531 4532 AC_CHECK_LIB(webp,WebPDecodeRGB,WEBP_SETTING=yes,WEBP_SETTING=no,-L$with_webp/lib -lwebp) 4533 4534 if test "$WEBP_SETTING" = "yes" ; then 4535 LIBS="-L$with_webp/lib -lwebp $LIBS" 4536 EXTRA_INCLUDES="-I$with_webp/include $EXTRA_INCLUDES" 4537 else 4538 echo "libwebp not found - WEBP support disabled" 4539 fi 4540 4541fi 4542 4543AC_SUBST(WEBP_SETTING,$WEBP_SETTING) 4544 4545if test "$WEBP_SETTING" != "no" ; then 4546 OPT_GDAL_FORMATS="webp $OPT_GDAL_FORMATS" 4547fi 4548 4549dnl --------------------------------------------------------------------------- 4550dnl Check if geos library is available. 4551dnl --------------------------------------------------------------------------- 4552 4553GEOS_INIT(3.1.0) 4554if test "${HAVE_GEOS}" = "yes" ; then 4555 AC_MSG_NOTICE([Using C API from GEOS $GEOS_VERSION]) 4556 STRIP_SYSTEM_LIBRARY_PATHS("${GEOS_LIBS}") 4557 GEOS_LIBS="$STRIPPED_LIBRARY_NAME" 4558 LIBS="${GEOS_LIBS} ${LIBS}" 4559fi 4560 4561dnl --------------------------------------------------------------------------- 4562dnl Check if SFCGAL library is available. 4563dnl --------------------------------------------------------------------------- 4564 4565SFCGAL_INIT(1.2.2) 4566if test "${HAVE_SFCGAL}" = "yes" ; then 4567 AC_MSG_NOTICE([Using C API from SFCGAL $SFCGAL_VERSION]) 4568 STRIP_SYSTEM_LIBRARY_PATHS("${SFCGAL_LIBS}") 4569 SFCGAL_LIBS="$STRIPPED_LIBRARY_NAME" 4570 LIBS="${SFCGAL_LIBS} ${LIBS}" 4571fi 4572 4573dnl --------------------------------------------------------------------------- 4574dnl Check if QHull library is available. 4575dnl --------------------------------------------------------------------------- 4576 4577AC_ARG_WITH(qhull,[ --with-qhull[=ARG] Include QHull support (ARG=no, yes, internal)],,) 4578 4579QHULL_SETTING=no 4580 4581if test "$with_qhull" = "no" ; then 4582 4583 AC_MSG_NOTICE([QHull support disabled.]) 4584 4585elif test "$with_qhull" = "yes" -o "$with_qhull" = "" ; then 4586 4587 # Only qhull 2012 is reliable on certain datasets. Older Ubuntu have 4588 # qhull/qhull.h 4589 AC_CHECK_HEADERS([qhull/libqhull.h]) 4590 if test "$ac_cv_header_qhull_libqhull_h" = "yes"; then 4591 AC_CHECK_LIB(qhull,qh_new_qhull,QHULL_SETTING=yes,QHULL_SETTING=no,) 4592 if test "$QHULL_SETTING" = "yes"; then 4593 QHULL_SETTING=external 4594 QHULL_INCLUDE_SUBDIR_IS_LIBQHULL=0 4595 LIBS="-lqhull $LIBS" 4596 fi 4597 fi 4598 AC_CHECK_HEADERS([libqhull/libqhull.h]) 4599 if test "$ac_cv_header_libqhull_libqhull_h" = "yes"; then 4600 AC_CHECK_LIB(qhull,qh_new_qhull,QHULL_SETTING=yes,QHULL_SETTING=no,) 4601 if test "$QHULL_SETTING" = "yes"; then 4602 QHULL_SETTING=external 4603 QHULL_INCLUDE_SUBDIR_IS_LIBQHULL=1 4604 LIBS="-lqhull $LIBS" 4605 fi 4606 fi 4607 4608 if test "$QHULL_SETTING" = "no" ; then 4609 if test "$with_qhull" = "yes"; then 4610 AC_MSG_ERROR([--with-qhull requested, but library not found!]) 4611 else 4612 QHULL_SETTING=internal 4613 QHULL_INCLUDE_SUBDIR_IS_LIBQHULL=1 4614 fi 4615 fi 4616else 4617 QHULL_SETTING=internal 4618 QHULL_INCLUDE_SUBDIR_IS_LIBQHULL=1 4619fi 4620 4621AC_SUBST([QHULL_SETTING],$QHULL_SETTING) 4622AC_SUBST([QHULL_INCLUDE_SUBDIR_IS_LIBQHULL],$QHULL_INCLUDE_SUBDIR_IS_LIBQHULL) 4623 4624dnl --------------------------------------------------------------------------- 4625dnl Check if opencl library is available. 4626dnl --------------------------------------------------------------------------- 4627 4628OPENCL_SETTING=no 4629OPENCL_FLAGS= 4630OPENCL_LIB= 4631 4632AC_ARG_WITH(opencl, 4633 [ --with-opencl[=ARG] Include OpenCL (GPU) support],,,) 4634 4635AC_MSG_CHECKING([for OpenCL support]) 4636 4637if test "$with_opencl" = "yes" ; then 4638 4639 AC_ARG_WITH(opencl-include, 4640 [ --with-opencl-include=ARG OpenCL Include directory (with a CL subdirectory)],,,) 4641 4642 OPENCL_SETTING=yes 4643 4644 if test "x$with_opencl_include" = "x" ; then 4645 OPENCL_FLAGS=-DHAVE_OPENCL 4646 if test -z "`uname | grep Darwin`" ; then 4647 AC_CHECK_HEADERS([CL/opencl.h]) 4648 if test "$ac_cv_header_CL_opencl_h" = "no" ; then 4649 AC_MSG_ERROR([cannot find CL/opencl.h]) 4650 fi 4651 fi 4652 else 4653 OPENCL_FLAGS="-I$with_opencl_include -DHAVE_OPENCL" 4654 fi 4655 4656 AC_ARG_WITH(opencl-lib, 4657 [ --with-opencl-lib=ARG OpenCL Link Flags (i.e. -L/xxx -lOpenCL)],,,) 4658 4659 if test "x$with_opencl_lib" = "x" ; then 4660 if test ! -z "`uname | grep Darwin`" ; then 4661 OPENCL_LIB="-framework OpenCL" 4662 else 4663 AC_CHECK_LIB(OpenCL,clGetPlatformIDs,OPENCL_LIB=-lOpenCL,OPENCL_LIB=missing) 4664 if test "$OPENCL_LIB" = "missing"; then 4665 AC_MSG_ERROR([--with-opencl requested, but libraries not found!]) 4666 fi 4667 fi 4668 else 4669 OPENCL_LIB="$with_opencl_lib" 4670 fi 4671 4672fi 4673 4674AC_MSG_RESULT([$OPENCL_SETTING]) 4675 4676AC_SUBST(OPENCL_FLAGS, $OPENCL_FLAGS) 4677AC_SUBST(OPENCL_LIB, $OPENCL_LIB) 4678 4679 4680dnl --------------------------------------------------------------------------- 4681dnl Check if FreeXL library is available. 4682dnl --------------------------------------------------------------------------- 4683 4684AC_ARG_WITH(freexl,[ --with-freexl[=ARG] Include freexl support (ARG=no, yes (default) or libfreexl install path)],,) 4685 4686AC_MSG_CHECKING([for FreeXL support]) 4687 4688HAVE_FREEXL=no 4689FREEXL_INCLUDE= 4690 4691if test "$with_freexl" = "" -o "$with_freexl" = "yes" ; then 4692 AC_CHECK_HEADERS(freexl.h) 4693 AC_CHECK_LIB(freexl,freexl_open,FREEXL_LIBS="-lfreexl",FREEXL_LIBS=missing) 4694 4695 if test "$FREEXL_LIBS" = "missing"; then 4696 unset ac_cv_lib_freexl_freexl_open 4697 AC_CHECK_LIB(freexl,freexl_open,FREEXL_LIBS="-lfreexl -lm",FREEXL_LIBS=missing,-lm) 4698 fi 4699 4700 if test "$FREEXL_LIBS" = "missing"; then 4701 unset ac_cv_lib_freexl_freexl_open 4702 AC_CHECK_LIB(freexl,freexl_open,FREEXL_LIBS="-lfreexl -liconv",FREEXL_LIBS=missing,-liconv) 4703 fi 4704 4705 if test "$FREEXL_LIBS" = "missing"; then 4706 unset ac_cv_lib_freexl_freexl_open 4707 AC_CHECK_LIB(freexl,freexl_open,FREEXL_LIBS="-lfreexl -liconv -lm",FREEXL_LIBS=missing,-liconv -lm) 4708 fi 4709 4710 if test "$FREEXL_LIBS" = "missing"; then 4711 unset ac_cv_lib_freexl_freexl_open 4712 AC_CHECK_LIB(freexl,freexl_open,FREEXL_LIBS="-lfreexl -liconv -lcharset",FREEXL_LIBS=missing,-liconv -lcharset) 4713 fi 4714 4715 if test "$FREEXL_LIBS" != "missing" -a "$ac_cv_header_freexl_h" = "yes" ; then 4716 4717 # Check that freexl is recent enough 4718 rm -f testrlist.* 4719 echo '#include <freexl.h>' > testfreexl.c 4720 echo 'int main(int argc, char** argv) { FreeXL_CellValue s; freexl_get_cell_value (0,0,0,&s); return 0; } ' >> testfreexl.c 4721 if test -z "`${CC} ${CFLAGS} testfreexl.c -c 2>&1`" ; then 4722 HAVE_FREEXL=yes 4723 LIBS="$FREEXL_LIBS $LIBS" 4724 else 4725 HAVE_FREEXL=no 4726 AC_MSG_RESULT([freexl too old. Needs freexl >= 1.0]) 4727 fi 4728 rm -f testfreexl.* 4729 4730 else 4731 HAVE_FREEXL=no 4732 echo "libfreexl not found - FreeXL support disabled" 4733 fi 4734 4735elif test "$with_freexl" != "no"; then 4736 4737 AC_CHECK_LIB(freexl,freexl_open,FREEXL_LIBS="-L$with_freexl/lib -lfreexl",FREEXL_LIBS=missing,-L$with_freexl/lib) 4738 4739 if test "$FREEXL_LIBS" = "missing"; then 4740 unset ac_cv_lib_freexl_freexl_open 4741 AC_CHECK_LIB(freexl,freexl_open,FREEXL_LIBS="-L$with_freexl/lib -lfreexl -lm",FREEXL_LIBS=missing,-L$with_freexl/lib -lm) 4742 fi 4743 4744 if test "$FREEXL_LIBS" = "missing"; then 4745 unset ac_cv_lib_freexl_freexl_open 4746 AC_CHECK_LIB(freexl,freexl_open,FREEXL_LIBS="-L$with_freexl/lib -lfreexl -liconv",FREEXL_LIBS=missing,-L$with_freexl/lib -liconv) 4747 fi 4748 4749 if test "$FREEXL_LIBS" = "missing"; then 4750 unset ac_cv_lib_freexl_freexl_open 4751 AC_CHECK_LIB(freexl,freexl_open,FREEXL_LIBS="-L$with_freexl/lib -lfreexl -liconv -lm",FREEXL_LIBS=missing,-L$with_freexl/lib -liconv -lm) 4752 fi 4753 4754 if test "$FREEXL_LIBS" = "missing"; then 4755 unset ac_cv_lib_freexl_freexl_open 4756 AC_CHECK_LIB(freexl,freexl_open,FREEXL_LIBS="-L$with_freexl/lib -lfreexl -liconv -lcharset",FREEXL_LIBS=missing,-L$with_freexl/lib -liconv -lcharset) 4757 fi 4758 4759 if test "$FREEXL_LIBS" != "missing" -a -f "$with_freexl/include/freexl.h" ; then 4760 4761 # Check that freexl is recent enough 4762 rm -f testrlist.* 4763 echo '#include <freexl.h>' > testfreexl.c 4764 echo 'int main(int argc, char** argv) { FreeXL_CellValue s; freexl_get_cell_value (0,0,0,&s); return 0; } ' >> testfreexl.c 4765 if test -z "`${CC} ${CFLAGS} -I$with_freexl/include testfreexl.c -c 2>&1`" ; then 4766 HAVE_FREEXL=yes 4767 LIBS="$FREEXL_LIBS $LIBS" 4768 FREEXL_INCLUDE="-I$with_freexl/include" 4769 else 4770 HAVE_FREEXL=no 4771 AC_MSG_RESULT([freexl too old. Needs freexl >= 1.0]) 4772 fi 4773 rm -f testfreexl.* 4774 4775 else 4776 HAVE_FREEXL=no 4777 echo "libfreexl not found - FreeXL support disabled" 4778 fi 4779 4780fi 4781 4782AC_SUBST(HAVE_FREEXL, $HAVE_FREEXL) 4783AC_SUBST(FREEXL_INCLUDE, $FREEXL_INCLUDE) 4784 4785 4786dnl --------------------------------------------------------------------------- 4787dnl Check if libjson-c is available. 4788dnl --------------------------------------------------------------------------- 4789 4790AC_ARG_WITH(libjson-c,[ --with-libjson-c[=ARG] Include libjson-c support (ARG=internal or libjson-c directory)],,) 4791 4792if test "$with_libjson_c" = "external" -o "$with_libjson_c" = "" -o "$with_libjson_c" = "yes" ; then 4793 AC_CHECK_LIB(json-c,json_object_set_serializer,LIBJSONC_SETTING=external,LIBJSONC_SETTING=internal,) 4794elif test "$with_libjson_c" = "internal" ; then 4795 LIBJSONC_SETTING=internal 4796elif test "$with_libjson_c" != "no"; then 4797 LIBS="-L$with_libjson_c/lib $LIBS" 4798 AC_CHECK_LIB(json-c,json_object_set_serializer,LIBJSONC_SETTING=external,LIBJSONC_SETTING=internal,-L$with_libjson_c/lib) 4799else 4800 AC_MSG_ERROR([libjson-c (internal or external) is required]) 4801fi 4802 4803if test "$LIBJSONC_SETTING" = "external" ; then 4804 AC_MSG_RESULT([using pre-installed libjson-c]) 4805 LIBS="-ljson-c $LIBS" 4806 if test "$with_libjson_c" != "" -a "$with_libjson_c" != "yes" -a "$with_libjson_c" != "external" ; then 4807 JSON_INCLUDE="-I$with_libjson_c/include/json-c" 4808 elif test -f "/usr/include/json-c/json.h"; then 4809 JSON_INCLUDE="-I/usr/include/json-c" 4810 elif test -f "/usr/local/include/json-c/json.h"; then 4811 JSON_INCLUDE="-I/usr/local/include/json-c" 4812 else 4813 AC_MSG_ERROR([could not find json-c/json.h]) 4814 fi 4815else 4816 JSON_INCLUDE="-I\$(GDAL_ROOT)/ogr/ogrsf_frmts/geojson/libjson" 4817 AC_MSG_RESULT([using internal libjson-c code]) 4818fi 4819 4820AC_SUBST(LIBJSONC_SETTING,$LIBJSONC_SETTING) 4821AC_SUBST(JSON_INCLUDE,$JSON_INCLUDE) 4822 4823 4824dnl --------------------------------------------------------------------------- 4825dnl Check if we must enable PAM 4826dnl --------------------------------------------------------------------------- 4827 4828AC_MSG_CHECKING([whether to enable PAM]) 4829 4830AC_ARG_WITH(pam,[ --without-pam Disable PAM (.aux.xml) support],,) 4831 4832export PAM_SETTING= 4833 4834if test "x$with_pam" = "xno" ; then 4835 AC_MSG_RESULT([no]) 4836else 4837 AC_MSG_RESULT([yes]) 4838 PAM_SETTING=-DPAM_ENABLED 4839fi 4840 4841AC_SUBST(PAM_SETTING, $PAM_SETTING) 4842 4843dnl --------------------------------------------------------------------------- 4844dnl Check if the PDF driver should be built as a plugin 4845dnl --------------------------------------------------------------------------- 4846 4847AC_MSG_CHECKING([whether to build PDF driver as a plugin]) 4848 4849AC_ARG_ENABLE(pdf_plugin, 4850 AS_HELP_STRING([--enable-pdf-plugin], 4851 [enable PDF driver as a plugin (included in libgdal by default)]),,) 4852 4853PDF_PLUGIN=no 4854if test "x$enable_pdf_plugin" = "xyes" ; then 4855 4856 if test "$with_libtool" = "yes"; then 4857 AC_MSG_ERROR([--enable-pdf-plugin not supported together --with-libtool]) 4858 fi 4859 4860 PDF_PLUGIN=yes 4861 4862 AC_MSG_RESULT([yes]) 4863else 4864 AC_MSG_RESULT([no]) 4865fi 4866 4867AC_SUBST(PDF_PLUGIN, $PDF_PLUGIN) 4868if test "$PDF_PLUGIN" != "yes" ; then 4869 if test "x$INTERNAL_FORMAT_pdf_ENABLED" = "xyes"; then 4870 if test "$LIBZ_SETTING" != "no" ; then 4871 GDALFORMATS_ENABLED="$GDALFORMATS_ENABLED pdf" 4872 fi 4873 fi 4874fi 4875 4876 4877dnl --------------------------------------------------------------------------- 4878dnl Check if libpoppler is available 4879dnl --------------------------------------------------------------------------- 4880 4881AC_ARG_WITH(poppler,[ --with-poppler[=ARG] Include poppler(for PDF) support (ARG=no(default), yes or poppler install path)],,) 4882 4883HAVE_POPPLER=no 4884POPPLER_MAJOR_VERSION= 4885POPPLER_MINOR_VERSION= 4886 4887AC_MSG_CHECKING([for poppler]) 4888 4889if test "$with_poppler" != "no" -a "$with_poppler" != ""; then 4890 4891 PKG_PROG_PKG_CONFIG([0.21]) 4892 PKG_CHECK_MODULES([POPPLER], [poppler >= 0.23.0], 4893 [POPPLER_VERSION=`$PKG_CONFIG --modversion poppler`], [POPPLER_VERSION=]) 4894 if test "$POPPLER_VERSION" != ""; then 4895 HAVE_POPPLER=yes 4896 POPPLER_MAJOR_VERSION=`echo $POPPLER_VERSION | cut -d'.' -f1` 4897 POPPLER_MINOR_VERSION=`echo $POPPLER_VERSION | cut -d'.' -f2 | sed -e 's/^0//'` 4898 POPPLER_CFLAGS=`echo $POPPLER_CFLAGS $POPPLER_CFLAGS | sed "s/include\/poppler/include/"` 4899 fi 4900else 4901 AC_MSG_RESULT([disabled]) 4902fi 4903 4904if test "$HAVE_POPPLER" = "yes" -a "$PDF_PLUGIN" = "no"; then 4905 LIBS="${POPPLER_LIBS} ${LIBS}" 4906fi 4907 4908AC_SUBST(HAVE_POPPLER, $HAVE_POPPLER) 4909AC_SUBST(POPPLER_MAJOR_VERSION, $POPPLER_MAJOR_VERSION) 4910AC_SUBST(POPPLER_MINOR_VERSION, $POPPLER_MINOR_VERSION) 4911AC_SUBST(POPPLER_CFLAGS, $POPPLER_CFLAGS) 4912AC_SUBST(POPPLER_PLUGIN_LIB, $POPPLER_LIBS) 4913 4914dnl --------------------------------------------------------------------------- 4915dnl Check if libpodofo is available 4916dnl --------------------------------------------------------------------------- 4917 4918AC_ARG_WITH(podofo,[ --with-podofo[=ARG] Include podofo(for PDF) support (ARG=no(default), yes or podofo install path)],,) 4919 4920HAVE_PODOFO=no 4921 4922AC_MSG_CHECKING([for podofo]) 4923 4924if test "$with_podofo" != "no" -a "$with_podofo" != ""; then 4925 4926 AC_ARG_WITH(podofo-lib, 4927 [ --with-podofo-lib=ARG podofo Link Flags (i.e. -L/xxx -lpodofo ...). Mainly for static libpodofo],,,) 4928 4929 if test "$with_podofo" = "yes" ; then 4930 TEST_PODOFO_INC="-I/usr/include -I/usr/include/podofo" 4931 PODOFO_LIB="-lpodofo" 4932 else 4933 TEST_PODOFO_INC="-I$with_podofo/include -I$with_podofo/include/podofo" 4934 PODOFO_LIB="-L$with_podofo/lib -lpodofo" 4935 fi 4936 4937 if test "x$with_podofo_lib" = "x" ; then 4938 rm -f testpodofo.* 4939 echo '#include <podofo.h>' > testpodofo.cpp 4940 echo 'int main(int argc, char** argv) { PoDoFo::PdfError::EnableDebug( 0 ); return 0; } ' >> testpodofo.cpp 4941 ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS} testpodofo.cpp -o testpodofo ${TEST_PODOFO_INC} ${PODOFO_LIB} 2>/dev/null 4942 RETVAL=$? 4943 if test $RETVAL -eq 0; then 4944 HAVE_PODOFO=yes 4945 if test "$PDF_PLUGIN" = "no"; then 4946 LIBS="${PODOFO_LIB} ${LIBS}" 4947 fi 4948 PODOFO_INC=$TEST_PODOFO_INC 4949 PODOFO_PLUGIN_LIB="${PODOFO_LIB}" 4950 AC_MSG_RESULT([yes]) 4951 fi 4952 rm -f testpodofo.* 4953 rm -f testpodofo 4954 fi 4955 4956 if test "$HAVE_PODOFO" = "no"; then 4957 if test "x$with_podofo_lib" != "x" ; then 4958 PODOFO_LIB="$with_podofo_lib" 4959 else 4960 # This may be a static libpodofo.a, so add dependent libraries. 4961 PODOFO_LIB="$PODOFO_LIB -lfreetype -lfontconfig -lpthread" 4962 fi 4963 4964 AC_ARG_WITH(podofo-extra-lib-for-test, 4965 [ --with-podofo-extra-lib-for-test=ARG Additional libraries to pass the detection test, but not used for libgdal linking (i.e. -ljpeg ...). Mainly for static libpodofo],,,) 4966 4967 if test "x$with_podofo_extra_lib_for_test" = "x" ; then 4968 TEST_PODOFO_LIB="$PODOFO_LIB" 4969 else 4970 TEST_PODOFO_LIB="$PODOFO_LIB $with_podofo_extra_lib_for_test" 4971 fi 4972 4973 rm -f testpodofo.* 4974 echo '#include <podofo.h>' > testpodofo.cpp 4975 echo 'int main(int argc, char** argv) { PoDoFo::PdfError::EnableDebug( 0 ); return 0; } ' >> testpodofo.cpp 4976 ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS} testpodofo.cpp -o testpodofo ${TEST_PODOFO_INC} ${TEST_PODOFO_LIB} 2>/dev/null 4977 RETVAL=$? 4978 if test $RETVAL -eq 0; then 4979 HAVE_PODOFO=yes 4980 if test "$PDF_PLUGIN" = "no"; then 4981 LIBS="${PODOFO_LIB} ${LIBS}" 4982 fi 4983 PODOFO_INC=$TEST_PODOFO_INC 4984 PODOFO_PLUGIN_LIB="${PODOFO_LIB}" 4985 AC_MSG_RESULT([yes]) 4986 else 4987 AC_MSG_RESULT([no]) 4988 fi 4989 rm -f testpodofo.* 4990 rm -f testpodofo 4991 fi 4992else 4993 AC_MSG_RESULT([disabled]) 4994fi 4995 4996AC_SUBST(HAVE_PODOFO, $HAVE_PODOFO) 4997AC_SUBST(PODOFO_INC, $PODOFO_INC) 4998AC_SUBST(PODOFO_PLUGIN_LIB, $PODOFO_PLUGIN_LIB) 4999 5000dnl --------------------------------------------------------------------------- 5001dnl Check if libpdfium is available 5002dnl 5003dnl Support for open-source PDFium library 5004dnl 5005dnl Copyright (C) 2015 Klokan Technologies GmbH (http://www.klokantech.com/) 5006dnl Author: Martin Mikita <martin.mikita@klokantech.com>, xmikit00 @ FIT VUT Brno 5007dnl Copyright 2019 Even Rouault 5008dnl --------------------------------------------------------------------------- 5009 5010AC_ARG_WITH(pdfium,[ --with-pdfium[=ARG] Include pdfium (for PDF) support (ARG=no(default), yes or pdfium install path)],,) 5011 5012HAVE_PDFIUM=no 5013 5014AC_MSG_CHECKING([for pdfium]) 5015 5016if test "$with_pdfium" != "no" -a "$with_pdfium" != ""; then 5017 5018 if test "$with_pdfium" = "yes" ; then 5019 PDFIUM_INC="-I/usr/include/pdfium" 5020 PDFIUM_LIB="-lpdfium" 5021 else 5022 PDFIUM_INC="-I$with_pdfium/include/pdfium" 5023 PDFIUM_LIB="-L$with_pdfium/lib -lpdfium" 5024 fi 5025 5026 PDFIUM_LIB="$PDFIUM_LIB -ljpeg -lpng -lz -llcms2 -lpthread -lm -lstdc++" 5027 5028 if test ! -z "`uname | grep Darwin`" ; then 5029 PDFIUM_LIB="-stdlib=libstdc++ $PDFIUM_LIB" 5030 fi 5031 5032 rm -f testpdfium.* 5033 echo '#include "public/fpdfview.h"' > testpdfium.cpp 5034 echo '#include "core/fpdfapi/page/cpdf_page.h"' >> testpdfium.cpp 5035 echo '#include "constants/transparency.h"' >> testpdfium.cpp # specific to pdfium_build_gdal_3_2 5036 echo 'int main(int argc, char** argv) { FPDF_InitLibrary(); FPDF_DestroyLibrary(); return 0; } ' >> testpdfium.cpp 5037 TEST_CXX_FLAGS="" 5038 if test ! -z "`uname | grep Darwin`" ; then 5039 TEST_CXX_FLAGS="$TEST_CXX_FLAGS -stdlib=libstdc++" 5040 fi 5041 if ${CXX} ${CXXFLAGS} ${CPPFLAGS} $TEST_CXX_FLAGS -std=c++14 testpdfium.cpp -o testpdfium ${PDFIUM_INC} ${PDFIUM_LIB} >/dev/null 2>/dev/null; then 5042 HAVE_PDFIUM=yes 5043 CXXFLAGS="$TEST_CXX_FLAGS $CXXFLAGS" 5044 if test "$PDF_PLUGIN" = "no"; then 5045 LIBS="${PDFIUM_LIB} ${LIBS}" 5046 fi 5047 PDFIUM_PLUGIN_LIB="${PDFIUM_LIB}" 5048 AC_MSG_RESULT([yes]) 5049 fi 5050 rm -f testpdfium.* 5051 rm -f testpdfium 5052 5053 if test "$HAVE_PDFIUM" = "no" -a "$with_pdfium" != ""; then 5054 AC_MSG_ERROR([pdfium requested but not found. Must come from https://github.com/rouault/pdfium_build_gdal_3_2]) 5055 fi 5056else 5057 AC_MSG_RESULT([disabled]) 5058fi 5059 5060AC_SUBST(HAVE_PDFIUM, $HAVE_PDFIUM) 5061AC_SUBST(PDFIUM_INC, $PDFIUM_INC) 5062AC_SUBST(PDFIUM_PLUGIN_LIB, $PDFIUM_PLUGIN_LIB) 5063 5064dnl --------------------------------------------------------------------------- 5065dnl Get/override version. 5066dnl --------------------------------------------------------------------------- 5067 5068 5069AC_ARG_WITH(gdal-ver,[ --with-gdal-ver=ARG Override GDAL version ],,) 5070GDAL_VERSION_MAJOR=`grep "#*define.GDAL_VERSION_MAJOR.*" gcore/gdal_version.h.in | awk '{print $4}'` 5071GDAL_VERSION_MINOR=`grep "#*define.GDAL_VERSION_MINOR.*" gcore/gdal_version.h.in | awk '{print $4}'` 5072GDAL_VERSION_REV=`grep "#*define.GDAL_VERSION_REV.*" gcore/gdal_version.h.in | awk '{print $4}'` 5073 5074AC_MSG_RESULT([checking GDAL version information from gdal_version.h.in: $GDAL_VERSION_MAJOR.$GDAL_VERSION_MINOR.$GDAL_VERSION_REV]) 5075 5076AC_SUBST(GDAL_VERSION_MAJOR, "$GDAL_VERSION_MAJOR") 5077AC_SUBST(GDAL_VERSION_MINOR, "$GDAL_VERSION_MINOR") 5078AC_SUBST(GDAL_VERSION_REV, "$GDAL_VERSION_REV") 5079 5080if test "x$with_gdal_ver" != "x"; then 5081 5082 GDAL_VER=$with_gdal_ver 5083 AC_MSG_RESULT([ overridden GDAL version: $GDAL_VER]) 5084else 5085 5086 GDAL_VER=$GDAL_VERSION_MAJOR.$GDAL_VERSION_MINOR.$GDAL_VERSION_REV 5087 5088fi 5089 5090AC_SUBST(GDAL_VER, $GDAL_VER) 5091echo $GDAL_VER > VERSION 5092 5093dnl --------------------------------------------------------------------------- 5094dnl MacOS X Framework Build 5095 5096if test ! -z "`uname | grep Darwin`" ; then 5097 5098 CXXFLAGS="$ARCHFLAGS $CXXFLAGS" 5099 CFLAGS="$ARCHFLAGS $CFLAGS" 5100 LIBS="$ARCHFLAGS $LIBS" 5101 5102 MACOSX_FRAMEWORK=no 5103 AC_ARG_WITH(macosx-framework,[ --with-macosx-framework Build and install GDAL as a Mac OS X Framework],,) 5104 AC_MSG_CHECKING([for Mac OS X Framework build]) 5105 if test "$with_macosx_framework" = yes ; then 5106 MACOSX_FRAMEWORK=yes 5107 AC_MSG_RESULT([enabled]) 5108 AC_DEFINE_UNQUOTED(MACOSX_FRAMEWORK,1, [Define for Mac OSX Framework build]) 5109 prefix="/Library/Frameworks/GDAL.framework/Versions/${GDAL_VERSION_MAJOR}.${GDAL_VERSION_MINOR}" 5110 exec_prefix='${prefix}' 5111 includedir='${prefix}/Headers' 5112 datadir='${prefix}/Resources/gdal' 5113 libdir='${exec_prefix}' 5114 bindir='${exec_prefix}/Programs' 5115 docdir='${prefix}/Resources/doc' 5116 mandir='${prefix}/Resources/man' 5117 else 5118 AC_MSG_RESULT([disabled]) 5119 fi 5120 AC_SUBST(MACOSX_FRAMEWORK, $MACOSX_FRAMEWORK) 5121fi 5122 5123AC_SUBST(EXTRA_INCLUDES,$EXTRA_INCLUDES) 5124 5125dnl --------------------------------------------------------------------------- 5126dnl Check whether we need to add specific suffix for executables (.EXE when 5127dnl building for Windows). This test should work for the case of 5128dnl cross-compilation too. 5129dnl --------------------------------------------------------------------------- 5130case "${host_os}" in 5131 cygwin* | mingw* | pw32*) 5132 EXE_EXT=.exe 5133 SO_EXT=dll 5134 ;; 5135 *) 5136 EXE_EXT= 5137 ;; 5138esac 5139 5140AC_SUBST(EXE_EXT) 5141AC_SUBST(SO_EXT) 5142 5143dnl --------------------------------------------------------------------------- 5144dnl Which "true" program should we use? 5145dnl --------------------------------------------------------------------------- 5146BINTRUE=/bin/true 5147 5148if test -f /bin/true.exe ; then 5149 BINTRUE=/bin/true.exe 5150fi 5151if test -f /usr/bin/true ; then 5152 BINTRUE=/usr/bin/true 5153fi 5154 5155export BINTRUE 5156 5157AC_SUBST(BINTRUE,$BINTRUE) 5158 5159dnl --------------------------------------------------------------------------- 5160dnl Capture GDAL_PREFIX for the cpl_config.h include file. 5161dnl --------------------------------------------------------------------------- 5162 5163if test "$prefix" = "NONE" ; then 5164 GDAL_PREFIX=/usr/local 5165else 5166 GDAL_PREFIX=${prefix} 5167fi 5168 5169export GDAL_PREFIX 5170AC_DEFINE_UNQUOTED(GDAL_PREFIX,["]$GDAL_PREFIX["], [--prefix directory for GDAL install]) 5171 5172dnl --------------------------------------------------------------------------- 5173dnl Perl bindings. 5174dnl --------------------------------------------------------------------------- 5175 5176BINDINGS= 5177 5178AC_ARG_WITH(perl,[ --with-perl Enable perl bindings],,) 5179 5180AC_MSG_CHECKING([for perl bindings]) 5181if test "$with_perl" = "yes" ; then 5182 BINDINGS="perl $BINDINGS" 5183 AC_MSG_RESULT([enabled]) 5184else 5185 AC_MSG_RESULT([disabled]) 5186fi 5187 5188dnl --------------------------------------------------------------------------- 5189dnl NG Python bindings. 5190dnl --------------------------------------------------------------------------- 5191 5192AC_ARG_WITH(python,[ --with-python=ARG Enable python bindings (ARG=yes, no, or path to python binary)],,) 5193 5194AC_MSG_CHECKING([for python bindings]) 5195if test "$with_python" = "yes" ; then 5196 dnl 5197 dnl Check for Python executable in PATH 5198 dnl 5199 AC_CHECK_PROGS([PYTHON], [python python3 python2]) 5200 if test "x$PYTHON" = "x"; then 5201 AC_MSG_ERROR([--with-python requested, but Python not found!]) 5202 fi 5203elif test "x$with_python" != "x" -a "$with_python" != "no" ; then 5204 PYTHON="$with_python" 5205 if test "`$PYTHON -c 'print(1)'`" != "1"; then 5206 AC_MSG_ERROR([--with-python requested, but Python not found!]) 5207 fi 5208 AC_MSG_RESULT([enabled]) 5209else 5210 PYTHON="" 5211 AC_MSG_RESULT([disabled]) 5212fi 5213 5214if test "x$PYTHON" != "x"; then 5215 BINDINGS="python $BINDINGS" 5216 5217 AC_MSG_CHECKING([for python setuptools]) 5218 SETUPTEST='try: 5219 import setuptools 5220 print(1) 5221except ImportError: 5222 pass' 5223 PY_HAVE_SETUPTOOLS=`$PYTHON -c "$SETUPTEST"` 5224 if test "$PY_HAVE_SETUPTOOLS" = "1"; then 5225 AC_MSG_RESULT([found]) 5226 else 5227 AC_MSG_RESULT([not found]) 5228 fi 5229fi 5230 5231AC_SUBST([PY_HAVE_SETUPTOOLS]) 5232AC_SUBST([BINDINGS]) 5233 5234dnl --------------------------------------------------------------------------- 5235dnl Java support 5236dnl --------------------------------------------------------------------------- 5237 5238AC_ARG_WITH(java,[ --with-java Include Java support (ARG=yes, no or JDK home path) [[default=no]]],,) 5239 5240AC_MSG_CHECKING([whether we should include Java support]) 5241 5242JAVA_HOME="" 5243JAVA_INC="" 5244mac_java_fw="" 5245 5246if test "x$with_java" = "xyes"; then 5247 5248dnl Ubuntu 5249 JAVA_6_TEST_DIR= 5250 JAVA_7_TEST_DIR= 5251 JAVA_8_TEST_DIR= 5252 JAVA_MAC_TEST_DIR= 5253 case "$host_cpu" in 5254 i*86*) 5255 JAVA_6_TEST_DIR=/usr/lib/jvm/java-6-openjdk-i386 5256 JAVA_7_TEST_DIR=/usr/lib/jvm/java-7-openjdk-i386 5257 JAVA_8_TEST_DIR=/usr/lib/jvm/java-8-openjdk-i386 5258 ;; 5259 x86_64*) 5260 JAVA_6_TEST_DIR=/usr/lib/jvm/java-6-openjdk-amd64 5261 JAVA_7_TEST_DIR=/usr/lib/jvm/java-7-openjdk-amd64 5262 JAVA_8_TEST_DIR=/usr/lib/jvm/java-8-openjdk-amd64 5263 ;; 5264 *) 5265 ;; 5266 esac 5267 case "${host_os}" in 5268 darwin*) 5269 JAVA_MAC_TEST_DIR=$(/usr/libexec/java_home) 5270 ;; 5271 esac 5272 5273 if test "x$JAVA_8_TEST_DIR" != "x" -a -d "$JAVA_8_TEST_DIR/include"; then 5274 with_java="$JAVA_8_TEST_DIR" 5275 5276 elif test "x$JAVA_7_TEST_DIR" != "x" -a -d "$JAVA_7_TEST_DIR/include"; then 5277 with_java="$JAVA_7_TEST_DIR" 5278 5279 elif test "x$JAVA_6_TEST_DIR" != "x" -a -d "$JAVA_6_TEST_DIR/include"; then 5280 with_java="$JAVA_6_TEST_DIR" 5281 5282 elif test -d /usr/lib/jvm/java-6-openjdk; then 5283 with_java="/usr/lib/jvm/java-6-openjdk" 5284 5285dnl RHEL6 5286 elif test -d /usr/lib/jvm/java-openjdk; then 5287 with_java="/usr/lib/jvm/java-openjdk" 5288 5289 5290dnl OpenSolaris 5291 elif test -d /usr/java; then 5292 with_java="/usr/java" 5293 5294dnl Mac OS X 5295 elif test "x$JAVA_MAC_TEST_DIR" != "x"; then 5296 if test -d "$JAVA_MAC_TEST_DIR/bundle"; then 5297 # Mac default 1.6.0_x framework 5298 # test for ./bundle first, since older installs also have ./include 5299 with_java="$JAVA_MAC_TEST_DIR" 5300 mac_java_fw="JavaVM" 5301 elif test -d "$JAVA_MAC_TEST_DIR/include"; then 5302 # Oracle Java install 5303 with_java="$JAVA_MAC_TEST_DIR" 5304 fi 5305 else 5306 AC_MSG_ERROR("cannot find JDK root directory.") 5307 fi 5308 5309 if test \! -d "$with_java/include" && test \! -d "$with_java/bundle"; then 5310 AC_MSG_ERROR("$with_java is not a valid JDK.") 5311 fi 5312fi 5313 5314if test "x$JAVA_INC" != "x"; then 5315 AC_MSG_RESULT([yes]) 5316elif test "x$with_java" != "x" -a "x$with_java" != "xno"; then 5317 5318 if test -d "$with_java/bundle" && test -d "/System/Library/Frameworks/JavaVM.framework/Headers"; then 5319 # Mac default 1.6.0_x framework 5320 # test for ./bundle first, since older installs also have ./include 5321 JAVA_HOME="$with_java" 5322 JAVA_INC="-I/System/Library/Frameworks/JavaVM.framework/Headers" 5323 mac_java_fw="JavaVM" 5324 AC_MSG_RESULT([yes]) 5325 elif test -d "$with_java/include"; then 5326 if test -d "$with_java/include/linux"; then 5327 JAVA_HOME="$with_java" 5328 JAVA_INC="-I$JAVA_HOME/include -I$JAVA_HOME/include/linux" 5329 AC_MSG_RESULT([yes]) 5330 elif test -d "$with_java/include/solaris"; then 5331 JAVA_HOME="$with_java" 5332 JAVA_INC="-I$JAVA_HOME/include -I$JAVA_HOME/include/solaris" 5333 AC_MSG_RESULT([yes]) 5334 elif test -d "$with_java/include/freebsd"; then 5335 JAVA_HOME="$with_java" 5336 JAVA_INC="-I$JAVA_HOME/include -I$JAVA_HOME/include/freebsd" 5337 AC_MSG_RESULT([yes]) 5338 elif test -d "$with_java/include/darwin"; then 5339 # Oracle Java install, use instead of Mac default 1.6.0_x 5340 JAVA_HOME="$with_java" 5341 JAVA_INC="-I$JAVA_HOME/include -I$JAVA_HOME/include/darwin" 5342 AC_MSG_RESULT([yes]) 5343 else 5344 AC_MSG_ERROR("Cannot find $with_java/include/linux or solaris or freebsd or darwin directory.") 5345 fi 5346 else 5347 AC_MSG_ERROR("Cannot find $with_java/include or <mac_java_framework>/Headers directory.") 5348 fi 5349 5350else 5351 AC_MSG_RESULT([no]) 5352fi 5353 5354AC_SUBST(JAVA_HOME,$JAVA_HOME) 5355AC_SUBST(JAVA_INC,$JAVA_INC) 5356 5357dnl --------------------------------------------------------------------------- 5358dnl HDFS support 5359dnl --------------------------------------------------------------------------- 5360 5361AC_ARG_WITH(hdfs,[ --with-hdfs[=ARG] Include HDFS support (ARG=Path or no)],,) 5362 5363HDFS_ENABLED=no 5364 5365if test -z "$with_hdfs" -o "$with_hdfs" = "no" ; then 5366 AC_MSG_RESULT([HDFS support not requested.]) 5367else 5368 if test "$JAVA_HOME"; then 5369 JNI_LIB="-L$(find $JAVA_HOME | grep libjvm | head -1 | sed "s/[[^/]]*$//") -ljvm" 5370 else 5371 AC_MSG_ERROR([HDFS support requires java support (--with-java). $JAVA_HOME]) 5372 fi 5373 if echo $JNI_LIB | grep $JAVA_HOME; then 5374 AC_MSG_CHECKING([for HDFS in $with_hdfs]) 5375 AC_CHECK_LIB(hdfs,hdfsConnect,HAVE_HDFS_LIB=yes,HAVE_HDFS_LIB=no,$JNI_LIB -L$with_hdfs/lib/native) 5376 AC_CHECK_FILE($with_hdfs/include/hdfs.h,HAVE_HDFS_HEADER=yes,HAVE_HDFS_HEADER=no) 5377 if test "$HAVE_HDFS_LIB" = "yes" -a "$HAVE_HDFS_HEADER" = "yes"; then 5378 AC_MSG_RESULT([HDFS support enabled.]) 5379 HDFS_ENABLED=yes 5380 HDFS_LIB="-L$with_hdfs/lib/native -lhdfs" 5381 HDFS_INC="-I$with_hdfs/include" 5382 else 5383 AC_MSG_ERROR([HDFS support not enabled.]) 5384 fi 5385 else 5386 AC_MSG_ERROR([Unable to find libjvm.]) 5387 fi 5388fi 5389 5390AC_SUBST(HDFS_ENABLED,$HDFS_ENABLED) 5391AC_SUBST(HDFS_LIB,$HDFS_LIB) 5392AC_SUBST(HDFS_INC,$HDFS_INC) 5393AC_SUBST(JNI_LIB,$JNI_LIB) 5394 5395dnl --------------------------------------------------------------------------- 5396dnl TileDB support 5397dnl --------------------------------------------------------------------------- 5398 5399AC_ARG_WITH(tiledb,[ --with-tiledb[=ARG] Include TileDB support (ARG=no, yes or tiledb install root path)],,) 5400 5401TILEDB_SETTING=no 5402 5403if test "$with_tiledb" = "yes" -o "$with_tiledb" = "" ; then 5404 5405 AC_CHECK_LIB(tiledb,tiledb_coords,TILEDB_SETTING=yes,TILEDB_SETTING=no,) 5406 5407 if test "$TILEDB_SETTING" = "yes" ; then 5408 LIBS="-ltiledb $LIBS" 5409 else 5410 echo "libtiledb not found - TileDB support disabled" 5411 fi 5412 5413elif test "$with_tiledb" != "no" -a "$with_tiledb" != ""; then 5414 5415 AC_CHECK_LIB(tiledb,tiledb_coords,TILEDB_SETTING=yes,TILEDB_SETTING=no,-L$with_tiledb/lib -ltiledb) 5416 5417 if test "$TILEDB_SETTING" = "yes" ; then 5418 LIBS="-L$with_tiledb/lib -ltiledb $LIBS" 5419 EXTRA_INCLUDES="-I$with_tiledb/include $EXTRA_INCLUDES" 5420 else 5421 echo "libtiledb not found - TileDB support disabled" 5422 fi 5423 5424fi 5425 5426AC_SUBST(TILEDB_SETTING,$TILEDB_SETTING) 5427 5428if test "$TILEDB_SETTING" != "no" ; then 5429 OPT_GDAL_FORMATS="tiledb $OPT_GDAL_FORMATS" 5430fi 5431 5432dnl --------------------------------------------------------------------------- 5433dnl MDB driver 5434dnl --------------------------------------------------------------------------- 5435 5436AC_ARG_WITH(mdb,[ --with-mdb Include MDB driver],,) 5437 5438AC_MSG_CHECKING([whether we should include MDB support]) 5439 5440MDB_ENABLED=no 5441JVM_LIB="" 5442 5443if test "$with_mdb" = "yes" ; then 5444 if test "x$JAVA_INC" = "x"; then 5445 AC_MSG_ERROR("--with-java must be specified.") 5446 fi 5447 5448 AC_ARG_WITH(jvm-lib, [ --with-jvm-lib=[ARG] ARG is dlopen or points to Java libjvm path],,) 5449 5450 AC_ARG_WITH(jvm-lib-add-rpath,[ --with-jvm-lib-add-rpath Add the libjvm path to the RPATH (no by default)],,) 5451 5452 if test "x$with_jvm_lib" = "xdlopen"; then 5453 AC_DEFINE_UNQUOTED(JVM_LIB_DLOPEN, 1, [Define to 1 if libjvm.so should be dlopen'd]) 5454 JVM_LIB="-ldl" 5455 elif test "x$with_jvm_lib" != "x"; then 5456 if test -d "$with_jvm_lib"; then 5457 saved_LDFLAGS="$LDFLAGS" 5458 LDFLAGS="$LDFLAGS -L$with_jvm_lib" 5459 if test "x$mac_java_fw" != "x"; then 5460 AC_CHECK_FW_FUNC($mac_java_fw,JNI_CreateJavaVM,HAS_LIB_JVM=yes,HAS_LIB_JVM=no,) 5461 else 5462 AC_CHECK_LIB(jvm,JNI_CreateJavaVM,HAS_LIB_JVM=yes,HAS_LIB_JVM=no,) 5463 fi 5464 LDFLAGS="$saved_LDFLAGS" 5465 if test "$HAS_LIB_JVM" = "yes"; then 5466 JVM_LIB="-L$with_jvm_lib -ljvm" 5467 if test "x$mac_java_fw" != "x"; then 5468 JVM_LIB="-framework $mac_java_fw" 5469 fi 5470 if test "x$with_jvm_lib_add_rpath" = "xyes"; then 5471 case "${host_os}" in 5472 darwin*) 5473 if test "x$mac_java_fw" = "x"; then 5474 JVM_LIB="-Wl,-rpath,$with_jvm_lib -L$with_jvm_lib -lazy-ljvm" 5475 fi 5476 ;; 5477 *) 5478 JVM_LIB="-Wl,-rpath=$with_jvm_lib $JVM_LIB" 5479 ;; 5480 esac 5481 fi 5482 else 5483 AC_MSG_ERROR("--with-jvm-lib must point to a directory with a libjvm.") 5484 fi 5485 else 5486 AC_MSG_ERROR("--with-jvm-lib must point to a directory.") 5487 fi 5488 elif test "x$JAVA_HOME" != "x"; then 5489 TEST_DIR="$JAVA_HOME/jre/lib/amd64/server" 5490 if test -d "$JAVA_HOME/jre/lib/server"; then 5491 # Oracle Java install on Mac 5492 TEST_DIR="$JAVA_HOME/jre/lib/server" 5493 fi 5494 if test "x$mac_java_fw" != "x"; then 5495 # Mac default 1.6.0_x framework, TEST_DIR not used 5496 TEST_DIR="$with_java" 5497 fi 5498 if test "x$JVM_LIB" = "x" -a -d "$TEST_DIR"; then 5499 unset ac_cv_lib_jvm_JNI_CreateJavaVM 5500 saved_LDFLAGS="$LDFLAGS" 5501 LDFLAGS="$LDFLAGS -L$TEST_DIR" 5502 if test "x$mac_java_fw" != "x"; then 5503 AC_CHECK_FW_FUNC($mac_java_fw,JNI_CreateJavaVM,HAS_LIB_JVM=yes,HAS_LIB_JVM=no,) 5504 else 5505 AC_CHECK_LIB(jvm,JNI_CreateJavaVM,HAS_LIB_JVM=yes,HAS_LIB_JVM=no,) 5506 fi 5507 LDFLAGS="$saved_LDFLAGS" 5508 if test "$HAS_LIB_JVM" = "yes"; then 5509 JVM_LIB="-L$TEST_DIR -ljvm" 5510 if test "x$mac_java_fw" != "x"; then 5511 JVM_LIB="-framework $mac_java_fw" 5512 fi 5513 if test "x$with_jvm_lib_add_rpath" = "xyes"; then 5514 case "${host_os}" in 5515 darwin*) 5516 if test "x$mac_java_fw" = "x"; then 5517 JVM_LIB="-Wl,-rpath,$TEST_DIR -L$TEST_DIR -lazy-ljvm" 5518 fi 5519 ;; 5520 *) 5521 JVM_LIB="-Wl,-rpath=$TEST_DIR $JVM_LIB" 5522 ;; 5523 esac 5524 fi 5525 fi 5526 fi 5527 5528 TEST_DIR="$JAVA_HOME/jre/lib/i386/server" 5529 if test "x$JVM_LIB" = "x" -a -d "$TEST_DIR"; then 5530 unset ac_cv_lib_jvm_JNI_CreateJavaVM 5531 saved_LDFLAGS="$LDFLAGS" 5532 LDFLAGS="$LDFLAGS -L$TEST_DIR" 5533 AC_CHECK_LIB(jvm,JNI_CreateJavaVM,HAS_LIB_JVM=yes,HAS_LIB_JVM=no,) 5534 LDFLAGS="$saved_LDFLAGS" 5535 if test "$HAS_LIB_JVM" = "yes"; then 5536 JVM_LIB="-L$TEST_DIR -ljvm" 5537 if test "x$with_jvm_lib_add_rpath" = "xyes"; then 5538 JVM_LIB="-Wl,-rpath=$TEST_DIR $JVM_LIB" 5539 fi 5540 fi 5541 fi 5542 5543 if test "x$JVM_LIB" = "x"; then 5544 AC_MSG_ERROR("--with-jvm-lib must be specified.") 5545 fi 5546 else 5547 AC_MSG_ERROR("--with-jvm-lib must be specified.") 5548 fi 5549 5550 MDB_ENABLED=yes 5551 AC_MSG_RESULT([yes]) 5552 5553else 5554 AC_MSG_RESULT([no]) 5555fi 5556 5557AC_SUBST(MDB_ENABLED,$MDB_ENABLED) 5558AC_SUBST(JVM_LIB,$JVM_LIB) 5559 5560 5561dnl --------------------------------------------------------------------------- 5562dnl Select Rasdaman or disable driver. 5563dnl --------------------------------------------------------------------------- 5564 5565RASDAMAN_ENABLED=no 5566 5567AC_CHECKING(whether we should include rasdaman support) 5568AC_ARG_WITH(rasdaman, 5569[ --with-rasdaman[=DIR] Include rasdaman support (DIR is rasdaman's install dir).],,) 5570 5571if test "$with_rasdaman" = "yes" ; then 5572 5573 AC_CHECK_LIB(raslib,main,RASDAMAN_ENABLED=yes,,,) 5574 5575 if test -n "$RASDAMAN_ENABLED" ; then 5576 RASDAMAN_LIB="-lrasodmg -lclientcomm -lcompression -lnetwork -lraslib" 5577 OPT_GDAL_FORMATS="rasdaman $OPT_GDAL_FORMATS" 5578 AC_MSG_RESULT([ using rasdaman from system libs.]) 5579 else 5580 AC_MSG_WARN([ rasdaman not found in system libs... use --with-rasdaman=DIR.]) 5581 fi 5582 5583elif test -n "$with_rasdaman" -a "$with_rasdaman" != "no" ; then 5584 5585 RASDAMAN_DIR=$with_rasdaman 5586 5587 if test -f $RASDAMAN_DIR/include/rasdaman.hh -a -d$RASDAMAN_DIR/lib ; then 5588 RASDAMAN_INC=-I$RASDAMAN_DIR/include 5589 RASDAMAN_LIB="-L$RASDAMAN_DIR/lib -lrasodmg -lclientcomm -lcompression -lnetwork -lraslib" 5590 else 5591 AC_MSG_ERROR("Could not find rasdaman.hh or libraslib.a in $RASDAMAN_DIR.") 5592 fi 5593 5594 RASDAMAN_ENABLED=yes 5595 OPT_GDAL_FORMATS="rasdaman $OPT_GDAL_FORMATS" 5596 AC_MSG_RESULT([ using rasdaman from $RASDAMAN_DIR.]) 5597 5598else 5599 5600 AC_MSG_RESULT([ rasdaman support not requested.]) 5601fi 5602 5603AC_SUBST(RASDAMAN_ENABLED,$RASDAMAN_ENABLED) 5604AC_SUBST(RASDAMAN_INC, $RASDAMAN_INC) 5605AC_SUBST(RASDAMAN_LIB, $RASDAMAN_LIB) 5606 5607dnl --------------------------------------------------------------------------- 5608dnl RDB support 5609dnl --------------------------------------------------------------------------- 5610 5611AC_ARG_WITH(rdb,[ --with-rdb[=ARG] Include RDB support (ARG=no, yes or RDB SDK root path)],,) 5612 5613RDB_SETTING=no 5614 5615if test "$with_rdb" = "yes" -o "$with_rdb" = "" ; then 5616 5617 AC_CHECK_LIB(rdb,rdb_library_name,RDB_SETTING=yes,RDB_SETTING=no,) 5618 5619 if test "$RDB_SETTING" = "yes" ; then 5620 LIBS="-lrdb $LIBS" 5621 else 5622 echo "librdb not found - RDB support disabled" 5623 fi 5624 5625elif test "$with_rdb" != "no" -a "$with_rdb" != ""; then 5626 5627 AC_CHECK_LIB(rdb,rdb_library_name,RDB_SETTING=yes,RDB_SETTING=no,-L$with_rdb/library -lrdb) 5628 5629 if test "$RDB_SETTING" = "yes" ; then 5630 LIBS="-L$with_rdb/library -lrdb $LIBS" 5631 EXTRA_INCLUDES="-I$with_rdb/interface/cpp/ -I$with_rdb/interface/c/ $EXTRA_INCLUDES" 5632 else 5633 echo "librdb not found - RDB support disabled" 5634 fi 5635 5636fi 5637 5638AC_SUBST(RDB_SETTING,$RDB_SETTING) 5639 5640if test "$RDB_SETTING" != "no" ; then 5641 OPT_GDAL_FORMATS="rdb $OPT_GDAL_FORMATS" 5642fi 5643 5644 5645dnl --------------------------------------------------------------------------- 5646dnl Armadillo support 5647dnl --------------------------------------------------------------------------- 5648 5649AC_ARG_WITH(armadillo,[ --with-armadillo=ARG Include Armadillo support for faster TPS transform computation (ARG=yes/no/path to armadillo install root) [[default=no]]],,) 5650 5651AC_MSG_CHECKING([whether we should include Armadillo support]) 5652 5653HAVE_ARMADILLO=no 5654 5655if test "$with_armadillo" = "yes" ; then 5656 rm -f testarmadillo.* 5657 rm -f testarmadillo 5658 echo '#include <armadillo>' > testarmadillo.cpp 5659 echo 'int main(int argc, char** argv) { arma::mat matInput(2,2); const arma::mat& matInv = arma::inv(matInput); return 0; } ' >> testarmadillo.cpp 5660 if test -z "`${CXX} ${CXXFLAGS} ${CPPFLAGS} testarmadillo.cpp -o testarmadillo -larmadillo 2>&1`" ; then 5661 HAVE_ARMADILLO=yes 5662 LIBS="-larmadillo ${LIBS}" 5663 AC_MSG_RESULT([yes]) 5664 else 5665 dnl Try adding -llapack (#4923) 5666 if test -z "`${CXX} ${CXXFLAGS} ${CPPFLAGS} testarmadillo.cpp -o testarmadillo -larmadillo -llapack 2>&1`" ; then 5667 HAVE_ARMADILLO=yes 5668 LIBS="-larmadillo -llapack ${LIBS}" 5669 AC_MSG_RESULT([yes]) 5670 else 5671 # clang 3.4 needs linking against libstdc++ (ubuntu 14.04) 5672 if test -z "`${CXX} ${CXXFLAGS} ${CPPFLAGS} testarmadillo.cpp -o testarmadillo -larmadillo -lstdc++ 2>&1`" ; then 5673 HAVE_ARMADILLO=yes 5674 LIBS="-larmadillo -lstdc++ ${LIBS}" 5675 AC_MSG_RESULT([yes]) 5676 else 5677 AC_MSG_RESULT([no]) 5678 fi 5679 fi 5680 fi 5681 rm -f testarmadillo.* 5682 rm -f testarmadillo 5683 5684elif test -n "$with_armadillo" -a "$with_armadillo" != "no" ; then 5685 5686 rm -f testarmadillo.* 5687 rm -f testarmadillo 5688 echo '#include <armadillo>' > testarmadillo.cpp 5689 echo 'int main(int argc, char** argv) { arma::mat matInput(2,2); const arma::mat& matInv = arma::inv(matInput); return 0; } ' >> testarmadillo.cpp 5690 if test -z "`${CXX} ${CXXFLAGS} ${CPPFLAGS} -I$with_armadillo/include testarmadillo.cpp -o testarmadillo -L$with_armadillo/lib -larmadillo 2>&1`" ; then 5691 HAVE_ARMADILLO=yes 5692 LIBS="-L$with_armadillo/lib -larmadillo ${LIBS}" 5693 EXTRA_INCLUDES="-I$with_armadillo/include $EXTRA_INCLUDES" 5694 AC_MSG_RESULT([yes]) 5695 else 5696 dnl Try adding -llapack (#4923) 5697 if test -z "`${CXX} ${CXXFLAGS} ${CPPFLAGS} -I$with_armadillo/include testarmadillo.cpp -o testarmadillo -L$with_armadillo/lib -larmadillo -llapack 2>&1`" ; then 5698 HAVE_ARMADILLO=yes 5699 LIBS="-L$with_armadillo/lib -larmadillo -llapack ${LIBS}" 5700 EXTRA_INCLUDES="-I$with_armadillo/include $EXTRA_INCLUDES" 5701 AC_MSG_RESULT([yes]) 5702 else 5703 AC_MSG_RESULT([no]) 5704 fi 5705 fi 5706 rm -f testarmadillo.* 5707 rm -f testarmadillo 5708 5709else 5710 AC_MSG_RESULT([no]) 5711fi 5712 5713AC_SUBST(HAVE_ARMADILLO,$HAVE_ARMADILLO) 5714 5715dnl --------------------------------------------------------------------------- 5716dnl libcryptopp 5717dnl --------------------------------------------------------------------------- 5718 5719AC_ARG_WITH(cryptopp,[ --with-cryptopp[=ARG] Include cryptopp support (ARG=yes, no or path)],,) 5720 5721HAVE_CRYPTOPP=no 5722USE_ONLY_CRYPTODLL_ALG=yes 5723 5724AC_MSG_CHECKING([for cryptopp]) 5725 5726if test "$with_cryptopp" = "no" ; then 5727 5728 AC_MSG_RESULT([disabled]) 5729 5730elif test "$with_cryptopp" = "yes" -o "$with_cryptopp" = "" ; then 5731 5732 rm -f testcryptopp.* 5733 echo '#include <cryptopp/aes.h>' > testcryptopp.cpp 5734 # Catch issue with clang++ (https://groups.google.com/forum/#!topic/cryptopp-users/DfWHy3bT0KI) 5735 echo '#include <cryptopp/osrng.h>' >> testcryptopp.cpp 5736 echo 'int main(int argc, char** argv) { CryptoPP::AES::Encryption oEnc; return 0; } ' >> testcryptopp.cpp 5737 ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS} testcryptopp.cpp -o testcryptopp -lcryptopp 2>/dev/null 5738 RETVAL=$? 5739 if test $RETVAL -eq 0; then 5740 HAVE_CRYPTOPP=yes 5741 LIBS="-lcryptopp ${LIBS}" 5742 AC_MSG_RESULT([yes]) 5743 else 5744 AC_MSG_RESULT([no]) 5745 if test "$with_cryptopp" = "yes"; then 5746 AC_MSG_ERROR([--with-cryptopp was requested, but not available]) 5747 fi 5748 fi 5749 rm -f testcryptopp.* 5750 rm -f testcryptopp 5751 5752 if test "$HAVE_CRYPTOPP" = "yes"; then 5753 5754 AC_MSG_CHECKING([if cryptopp has all cipher methods builtin]) 5755 rm -f testcryptopp.* 5756 echo '#include <cryptopp/blowfish.h>' > testcryptopp.cpp 5757 echo 'int main(int argc, char** argv) { CryptoPP::Blowfish::Encryption oEnc; return 0; } ' >> testcryptopp.cpp 5758 ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS} testcryptopp.cpp -o testcryptopp -lcryptopp 2>/dev/null 5759 RETVAL=$? 5760 if test $RETVAL -eq 0; then 5761 USE_ONLY_CRYPTODLL_ALG=no 5762 AC_MSG_RESULT([yes]) 5763 else 5764 USE_ONLY_CRYPTODLL_ALG=yes 5765 AC_MSG_RESULT([no]) 5766 fi 5767 rm -f testcryptopp.* 5768 rm -f testcryptopp 5769 fi 5770 5771else 5772 5773 rm -f testcryptopp.* 5774 echo '#include <cryptopp/aes.h>' > testcryptopp.cpp 5775 # Catch issue with clang++ (https://groups.google.com/forum/#!topic/cryptopp-users/DfWHy3bT0KI) 5776 echo '#include <cryptopp/osrng.h>' >> testcryptopp.cpp 5777 echo 'int main(int argc, char** argv) { CryptoPP::AES::Encryption oEnc; return 0; } ' >> testcryptopp.cpp 5778 ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS} testcryptopp.cpp -I$with_cryptopp/include -o testcryptopp -L$with_cryptopp/lib -lcryptopp 2>/dev/null 5779 RETVAL=$? 5780 if test $RETVAL -eq 0; then 5781 HAVE_CRYPTOPP=yes 5782 LIBS="-L$with_cryptopp/lib -lcryptopp ${LIBS}" 5783 EXTRA_INCLUDES="-I$with_cryptopp/include $EXTRA_INCLUDES" 5784 AC_MSG_RESULT([yes]) 5785 else 5786 AC_MSG_RESULT([no]) 5787 fi 5788 rm -f testcryptopp.* 5789 rm -f testcryptopp 5790 5791 if test "$HAVE_CRYPTOPP" = "yes"; then 5792 5793 AC_MSG_CHECKING([if cryptopp has all cipher methods builtin]) 5794 rm -f testcryptopp.* 5795 echo '#include <cryptopp/blowfish.h>' > testcryptopp.cpp 5796 echo 'int main(int argc, char** argv) { CryptoPP::Blowfish::Encryption oEnc; return 0; } ' >> testcryptopp.cpp 5797 ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS} testcryptopp.cpp -I$with_cryptopp/include -o testcryptopp -L$with_cryptopp/lib -lcryptopp 2>/dev/null 5798 RETVAL=$? 5799 if test $RETVAL -eq 0; then 5800 USE_ONLY_CRYPTODLL_ALG=no 5801 AC_MSG_RESULT([yes]) 5802 else 5803 USE_ONLY_CRYPTODLL_ALG=yes 5804 AC_MSG_RESULT([no]) 5805 fi 5806 rm -f testcryptopp.* 5807 rm -f testcryptopp 5808 fi 5809 5810fi 5811 5812AC_SUBST(HAVE_CRYPTOPP,$HAVE_CRYPTOPP) 5813AC_SUBST(USE_ONLY_CRYPTODLL_ALG,$USE_ONLY_CRYPTODLL_ALG) 5814 5815dnl --------------------------------------------------------------------------- 5816dnl crypto 5817dnl --------------------------------------------------------------------------- 5818 5819AC_ARG_WITH(crypto,[ --with-crypto[=ARG] Include crypto (from openssl) support (ARG=yes, no or path)],,) 5820 5821HAVE_OPENSSL_CRYPTO=no 5822 5823AC_MSG_CHECKING([for crypto]) 5824 5825if test "$with_crypto" = "no" ; then 5826 5827 AC_MSG_RESULT([disabled]) 5828 5829elif test "$with_crypto" = "yes" -o \( "$with_crypto" = "" -a "$HAVE_CRYPTOPP" = "no" \) ; then 5830 5831 AC_CHECK_LIB(crypto,EVP_sha256,HAVE_OPENSSL_CRYPTO=yes) 5832 if test "$HAVE_OPENSSL_CRYPTO" = "yes"; then 5833 AC_CHECK_HEADERS([openssl/bio.h]) 5834 if test "$ac_cv_header_openssl_bio_h" = "no"; then 5835 HAVE_OPENSSL_CRYPTO=no 5836 else 5837 LIBS="-lcrypto $LIBS" 5838 fi 5839 fi 5840fi 5841 5842AC_SUBST(HAVE_OPENSSL_CRYPTO,$HAVE_OPENSSL_CRYPTO) 5843 5844dnl --------------------------------------------------------------------------- 5845dnl Whether to include LERC in the build 5846dnl --------------------------------------------------------------------------- 5847 5848AC_ARG_WITH(lerc, 5849 [ --with-lerc[=ARG] Include libLerc support(ARG=yes/no/internal/path). Internal liblerc is required for MRF Lerc support. Internal or external libLerc may be used for internal libtiff Lerc support.],,,) 5850 5851HAVE_LERC=no 5852AC_MSG_CHECKING([for LERC]) 5853if test "$with_lerc" = "internal"; then 5854 if test "$ac_cv_c_bigendian" = "yes"; then 5855 AC_MSG_RESULT([disabled on big-endian]) 5856 else 5857 HAVE_LERC=internal 5858 AC_MSG_RESULT([enabled, internal]) 5859 fi 5860elif test "$with_lerc" = "no"; then 5861 HAVE_LERC=no 5862 AC_MSG_RESULT([disabled by user]) 5863elif test "$with_lerc" = "yes" -o "x$with_lerc" = "x" ; then 5864 lerc_lib_name="LercLib" 5865 AC_CHECK_LIB("$lerc_lib_name", lerc_decode, [lerc_lib=yes], [lerc_lib=no],) 5866 if test "$lerc_lib" = "no" ; then 5867 lerc_lib_name="Lerc" 5868 AC_CHECK_LIB("$lerc_lib_name", lerc_decode, [lerc_lib=yes], [lerc_lib=no],) 5869 fi 5870 if test "$lerc_lib" = "no" -a "$with_lerc" = "yes"; then 5871 AC_MSG_ERROR([lerc library not found]) 5872 fi 5873 5874 AC_CHECK_HEADER(Lerc_c_api.h, [lerc_c_api_h=yes], [lerc_c_api_h=no]) 5875 if test "$lerc_c_api_h" = "no" -a "$with_lerc" = "yes"; then 5876 AC_MSG_ERROR([Liblerc headers not found]) 5877 fi 5878 5879 if test "$lerc_lib" = "yes" -a "$lerc_c_api_h" = "yes"; then 5880 HAVE_LERC=external 5881 LIBS="$LIBS -l$lerc_lib_name" 5882 else 5883 if test "$ac_cv_c_bigendian" = "yes"; then 5884 AC_MSG_RESULT([disabled on big-endian]) 5885 else 5886 HAVE_LERC=internal 5887 AC_MSG_RESULT([enabled, internal]) 5888 fi 5889 fi 5890else 5891 5892 ORIG_LIBS="$LIBS" 5893 LIBS="-L$with_lerc/lib $LIBS" 5894 lerc_lib_name="LercLib" 5895 AC_CHECK_LIB("$lerc_lib_name", lerc_decode, [lerc_lib=yes], [lerc_lib=no],) 5896 if test "$lerc_lib" = "no" ; then 5897 lerc_lib_name="Lerc" 5898 AC_CHECK_LIB("$lerc_lib_name", lerc_decode, [lerc_lib=yes], [lerc_lib=no],) 5899 fi 5900 if test "$lerc_lib" = "no"; then 5901 AC_MSG_ERROR([lerc library not found]) 5902 fi 5903 5904 LIBS="-L$with_lerc/lib -l$lerc_lib_name $ORIG_LIBS" 5905 5906 if ! test -f "$with_lerc/include/Lerc_c_api.h"; then 5907 AC_MSG_ERROR([Liblerc headers not found]) 5908 fi 5909 5910 HAVE_LERC=external 5911 LERC_INCLUDE="-I$with_lerc/include" 5912fi 5913 5914AC_SUBST(HAVE_LERC,$HAVE_LERC) 5915AC_SUBST(LERC_INCLUDE,$LERC_INCLUDE) 5916 5917dnl --------------------------------------------------------------------------- 5918dnl Whether to include NULL driver in the build 5919dnl --------------------------------------------------------------------------- 5920 5921AC_ARG_WITH([null], 5922 AS_HELP_STRING([--with-null], 5923 [Enable NULL driver (only useful for development purposes]),,) 5924 5925AC_MSG_CHECKING([for NULL]) 5926if test "$with_null" = "yes" ; then 5927 OPT_GDAL_FORMATS="null $OPT_GDAL_FORMATS" 5928 AC_MSG_RESULT([enabled]) 5929else 5930 AC_MSG_RESULT([disabled]) 5931fi 5932 5933dnl --------------------------------------------------------------------------- 5934dnl Detect OpenEXR 5935dnl --------------------------------------------------------------------------- 5936 5937AC_ARG_WITH(exr,[ --with-exr Include EXR support via OpenEXR library],,) 5938 5939HAVE_EXR=no 5940EXR_CFLAGS="" 5941 5942if test "$with_exr" = "no" ; then 5943 5944 AC_MSG_NOTICE([EXR support disabled.]) 5945 5946else 5947 5948 PKG_PROG_PKG_CONFIG([0.21]) 5949 PKG_CHECK_MODULES([EXR], [OpenEXR >= 2.2], [HAVE_EXR=yes], [HAVE_EXR=no]) 5950 5951 if test -n "$EXR_CFLAGS"; then 5952 5953 # Test that the package found is for the right architecture 5954 saved_LIBS="$LIBS" 5955 LIBS="$EXR_LIBS" 5956 AC_CHECK_LIB(IlmImf,ImfTiledInputReadTile, [HAVE_EXR=yes], [HAVE_EXR=no]) 5957 LIBS="$saved_LIBS" 5958 5959 if test "$HAVE_EXR" = "yes"; then 5960 OPT_GDAL_FORMATS="exr $OPT_GDAL_FORMATS" 5961 LIBS="$EXR_LIBS $LIBS" 5962 else 5963 EXR_CFLAGS="" 5964 fi 5965 fi 5966fi 5967 5968AC_SUBST(EXR_CFLAGS,$EXR_CFLAGS) 5969 5970dnl --------------------------------------------------------------------------- 5971dnl Detect libheif 5972dnl --------------------------------------------------------------------------- 5973 5974AC_ARG_WITH(heif,[ --with-heif Include HEIF support via libheif library],,) 5975 5976HAVE_HEIF=no 5977HEIF_CFLAGS="" 5978 5979if test "$with_heif" = "no" ; then 5980 5981 AC_MSG_NOTICE([HEIF support disabled.]) 5982 5983else 5984 5985 PKG_PROG_PKG_CONFIG([0.21]) 5986 PKG_CHECK_MODULES([HEIF], [libheif >= 1.1], [], [HAVE_HEIF=no]) 5987 5988 if test -n "$HEIF_LIBS"; then 5989 5990 # Test that the package found is for the right architecture 5991 saved_LIBS="$LIBS" 5992 LIBS="$HEIF_LIBS" 5993 AC_CHECK_LIB(heif,heif_context_get_list_of_top_level_image_IDs, [HAVE_HEIF=yes], [HAVE_HEIF=no]) 5994 LIBS="$saved_LIBS" 5995 5996 if test "$HAVE_HEIF" = "yes"; then 5997 OPT_GDAL_FORMATS="heif $OPT_GDAL_FORMATS" 5998 LIBS="$HEIF_LIBS $LIBS" 5999 else 6000 HEIF_CFLAGS="" 6001 fi 6002 fi 6003fi 6004 6005AC_SUBST(HEIF_CFLAGS,$HEIF_CFLAGS) 6006 6007dnl --------------------------------------------------------------------------- 6008dnl Test if sprintf can be overloaded with _XOPEN_SOURCE being defined or other, 6009dnl includes being included before, which mingw64 4.8 doesn't like (#6390) 6010dnl --------------------------------------------------------------------------- 6011 6012AC_MSG_CHECKING([if sprintf can be overloaded for GDAL compilation]) 6013echo '#define _XOPEN_SOURCE' > testdeprecated.cpp 6014echo '#include <vector>' >> testdeprecated.cpp 6015echo '#include <stdio.h>' >> testdeprecated.cpp 6016echo 'extern "C"' >> testdeprecated.cpp 6017echo '{' >> testdeprecated.cpp 6018echo 'int sprintf(char *str, const char* fmt, ...);' >> testdeprecated.cpp 6019echo '}' >> testdeprecated.cpp 6020${CXX} ${CXXFLAGS} ${CPPFLAGS} testdeprecated.cpp -c 2>/dev/null 6021RETVAL=$? 6022if test $RETVAL -eq 0; then 6023 AC_MSG_RESULT([yes]) 6024else 6025 CPPFLAGS="$CPPFLAGS -DDONT_DEPRECATE_SPRINTF" 6026 AC_MSG_RESULT([no]) 6027fi 6028rm -f testdeprecated.* 6029rm -f testdeprecated 6030 6031dnl Use -municode for mingw 6032case "${host_os}" in 6033 mingw32*) 6034 AC_MSG_CHECKING([if mingw supports wmain]) 6035 rm -f testwmain* 6036 echo '#include <wchar.h>' > testwmain.cpp 6037 echo '#include <stdlib.h>' >> testwmain.cpp 6038 echo 'extern "C" int wmain( int argc, wchar_t ** argv_w );' >> testwmain.cpp 6039 echo 'extern "C" int wmain( int , wchar_t ** ) { return 0; } ' >> testwmain.cpp 6040 ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS} testwmain.cpp -o testwmain.exe -municode 2>/dev/null 6041 RETVAL=$? 6042 rm -f testwmain* 6043 if test $RETVAL -eq 0; then 6044 AC_MSG_RESULT([yes]) 6045 CXXFLAGS="$CXXFLAGS -DSUPPORTS_WMAIN" 6046 LDFLAGS="$LDFLAGS -municode" 6047 else 6048 AC_MSG_RESULT([no]) 6049 fi 6050 ;; 6051 *) 6052 ;; 6053esac 6054 6055AC_OUTPUT(GDALmake.opt) 6056 6057dnl --------------------------------------------------------------------------- 6058dnl Display configuration status 6059dnl --------------------------------------------------------------------------- 6060 6061LOC_MSG() 6062LOC_MSG([GDAL is now configured for ${host}]) 6063LOC_MSG() 6064LOC_MSG([ Installation directory: ${prefix}]) 6065LOC_MSG([ C compiler: ${CC} ${CFLAGS}]) 6066LOC_MSG([ C++ compiler: ${CXX} ${CXXFLAGS}]) 6067LOC_MSG([ C++14 support: ${CXX14_SUPPORT}]) 6068LOC_MSG() 6069LOC_MSG([ LIBTOOL support: ${with_libtool}]) 6070LOC_MSG() 6071LOC_MSG([ Armadillo support: ${HAVE_ARMADILLO}]) 6072LOC_MSG([ CFITSIO support: ${FITS_SETTING}]) 6073LOC_MSG([ crypto/openssl support: ${HAVE_OPENSSL_CRYPTO}]) 6074LOC_MSG([ cryptopp support: ${HAVE_CRYPTOPP}]) 6075LOC_MSG([ cURL support (wms/wcs/...):${CURL_SETTING}]) 6076LOC_MSG([ DDS support: ${DDS_SETTING}]) 6077LOC_MSG([ DODS support: ${HAVE_DODS}]) 6078LOC_MSG([ ECW support: ${ECW_SETTING}]) 6079LOC_MSG([ Expat support: ${HAVE_EXPAT}]) 6080LOC_MSG([ EXR support: ${HAVE_EXR}]) 6081LOC_MSG([ FGDB support: ${FGDB_ENABLED}]) 6082LOC_MSG([ FreeXL support: ${HAVE_FREEXL}]) 6083LOC_MSG([ GEORASTER support: ${HAVE_GEORASTER}]) 6084LOC_MSG([ GEOS support: ${HAVE_GEOS}]) 6085LOC_MSG([ Google libkml support: ${HAVE_LIBKML}]) 6086LOC_MSG([ GRASS support: ${GRASS_SETTING}]) 6087LOC_MSG([ GTA support: ${GTA_SETTING}]) 6088LOC_MSG([ HDF4 support: ${HAVE_HDF4}]) 6089LOC_MSG([ HDF5 support: ${HAVE_HDF5}]) 6090LOC_MSG([ HDFS support: ${HDFS_ENABLED}]) 6091LOC_MSG([ HEIF support: ${HAVE_HEIF}]) 6092LOC_MSG([ INFORMIX DataBlade support:${HAVE_IDB}]) 6093LOC_MSG([ Ingres support: ${HAVE_INGRES}]) 6094LOC_MSG([ JP2Lura support: ${HAVE_JP2LURA}]) 6095LOC_MSG([ JPEG 12 bit: ${JPEG12_ENABLED}]) 6096LOC_MSG([ JPEG-in-TIFF 12 bit: ${TIFF_JPEG12_ENABLED}]) 6097if test "x$HAVE_JASPER_UUID" != "x" ; then 6098 LOC_MSG([ JPEG JasPer support: ${HAVE_JASPER} (GeoJP2=${HAVE_JASPER_UUID})]) 6099else 6100 LOC_MSG([ JPEG JasPer support: ${HAVE_JASPER}]) 6101fi 6102LOC_MSG([ JPEG-Lossless/CharLS: ${HAVE_CHARLS}]) 6103LOC_MSG([ Kakadu support: ${HAVE_KAKADU}]) 6104LOC_MSG([ Kea support: ${HAVE_KEA}]) 6105LOC_MSG([ LERC support: ${HAVE_LERC}]) 6106LOC_MSG([ libdeflate support: ${LIBDEFLATE_SETTING}]) 6107LOC_MSG([ LIBGEOTIFF support: ${GEOTIFF_SETTING}]) 6108LOC_MSG([ LIBGIF support: ${GIF_SETTING}]) 6109LOC_MSG([ LIBJPEG support: ${JPEG_SETTING}]) 6110LOC_MSG([ LIBLZMA support: ${LIBLZMA_SETTING}]) 6111LOC_MSG([ LIBPNG support: ${PNG_SETTING}]) 6112LOC_MSG([ LIBTIFF support: ${TIFF_SETTING} (BigTIFF=${HAVE_BIGTIFF})]) 6113LOC_MSG([ libxml2 support: ${HAVE_LIBXML2}]) 6114LOC_MSG([ LIBZ support: ${LIBZ_SETTING}]) 6115LOC_MSG([ MDB support: ${MDB_ENABLED}]) 6116LOC_MSG([ MongoCXX v3 support: ${MONGOCXXV3_ENABLED}]) 6117LOC_MSG([ MongoDB support: ${MONGODB_ENABLED}]) 6118LOC_MSG([ MrSID/MG4 Lidar support: ${HAVE_MRSID_LIDAR}]) 6119LOC_MSG([ MrSID support: ${HAVE_MRSID}]) 6120LOC_MSG([ MSG support: ${HAVE_MSG}]) 6121LOC_MSG([ MySQL support: ${HAVE_MYSQL}]) 6122if test "$NETCDF_SETTING" = "yes" ; then 6123 LOC_MSG([ NetCDF has netcdf_mem.h: ${NETCDF_MEM}]) 6124fi 6125LOC_MSG([ NetCDF support: ${NETCDF_SETTING}]) 6126LOC_MSG([ OCI support: ${HAVE_OCI}]) 6127LOC_MSG([ ODBC support: ${ODBC_SETTING}]) 6128LOC_MSG([ OGDI support: ${HAVE_OGDI}]) 6129LOC_MSG([ OpenCL support: ${OPENCL_SETTING}]) 6130LOC_MSG([ OpenJPEG support: ${HAVE_OPENJPEG}]) 6131LOC_MSG([ PCIDSK support: ${PCIDSK_SETTING}]) 6132LOC_MSG([ PCRaster support: ${PCRASTER_SETTING}]) 6133LOC_MSG([ PCRE support: ${HAVE_PCRE}]) 6134LOC_MSG([ PDFium support: ${HAVE_PDFIUM}]) 6135LOC_MSG([ Podofo support: ${HAVE_PODOFO}]) 6136LOC_MSG([ Poppler support: ${HAVE_POPPLER}]) 6137LOC_MSG([ PostgreSQL support: ${HAVE_PG}]) 6138LOC_MSG([ QHull support: ${QHULL_SETTING}]) 6139LOC_MSG([ Rasdaman support: ${RASDAMAN_ENABLED}]) 6140LOC_MSG([ RasterLite2 support: ${HAVE_RASTERLITE2}]) 6141LOC_MSG([ RDB support: ${RDB_SETTING}]) 6142LOC_MSG([ SFCGAL support: ${HAVE_SFCGAL}]) 6143LOC_MSG([ SOSI support: ${SOSI_ENABLED}]) 6144LOC_MSG([ SpatiaLite support: ${HAVE_SPATIALITE}]) 6145if test "x$SPATIALITE_SONAME" != "x"; then 6146 LOC_MSG([ SpatiaLite shared obj name:${SPATIALITE_SONAME}]) 6147fi 6148LOC_MSG([ SQLite support: ${HAVE_SQLITE}]) 6149LOC_MSG([ Teigha (DWG and DGNv8): ${HAVE_TEIGHA}]) 6150LOC_MSG([ TileDB support: ${TILEDB_SETTING}]) 6151LOC_MSG([ userfaultfd support: ${ENABLE_UFFD}]) 6152LOC_MSG([ WebP support: ${WEBP_SETTING}]) 6153LOC_MSG([ Xerces-C support: ${HAVE_XERCES}]) 6154LOC_MSG([ ZSTD support: ${ZSTD_SETTING}]) 6155 6156LOC_MSG() 6157if test ! -z "`uname | grep Darwin`" ; then 6158 LOC_MSG([ Mac OS X Framework : ${MACOSX_FRAMEWORK}]) 6159fi 6160LOC_MSG() 6161if test -z "$BINDINGS"; then 6162 WHAT_BINDINGS="no" 6163else 6164 WHAT_BINDINGS="$BINDINGS" 6165fi 6166LOC_MSG([ misc. gdal formats: ${GDALFORMATS_ENABLED}]) 6167LOC_MSG([ misc. ogr formats: ${OGRFORMATS_ENABLED}]) 6168LOC_MSG() 6169LOC_MSG([ disabled gdal formats: ${GDALFORMATS_DISABLED}]) 6170LOC_MSG([ disabled ogr formats: ${OGRFORMATS_DISABLED}]) 6171LOC_MSG() 6172LOC_MSG([ SWIG Bindings: ${WHAT_BINDINGS}]) 6173LOC_MSG() 6174LOC_MSG([ PROJ >= 6: yes]) 6175LOC_MSG([ enable GNM building: ${GNM_ENABLED}]) 6176LOC_MSG([ enable pthread support: ${PTHREAD_ENABLED}]) 6177LOC_MSG([ enable POSIX iconv support:${am_cv_func_iconv}]) 6178LOC_MSG([ hide internal symbols: ${HAVE_HIDE_INTERNAL_SYMBOLS}]) 6179LOC_MSG() 6180 6181if test "$HAVE_PODOFO" = "yes" -a "$HAVE_POPPLER" = "yes" -a "$HAVE_PDFIUM" = "yes"; then 6182 AC_MSG_WARN([--with-podofo, --with-poppler and --with-pdfium available. This is unusual setup, but will work. Pdfium will be used by default...]) 6183elif test "$HAVE_PODOFO" = "yes" -a "$HAVE_POPPLER" = "yes" ; then 6184 AC_MSG_WARN([--with-podofo and --with-poppler are both available. This is unusual setup, but will work. Poppler will be used by default...]) 6185elif test "$HAVE_POPPLER" = "yes" -a "$HAVE_PDFIUM" = "yes" ; then 6186 AC_MSG_WARN([--with-poppler and --with-pdfium are both available. This is unusual setup, but will work. Pdfium will be used by default...]) 6187elif test "$HAVE_PODOFO" = "yes" -a "$HAVE_PDFIUM" = "yes" ; then 6188 AC_MSG_WARN([--with-podofo and --with-pdfium are both available. This is unusual setup, but will work. Pdfium will be used by default...]) 6189fi 6190 6191if test "$HAVE_LIBXML2" = "yes" -a "$FGDB_ENABLED" = "yes"; then 6192 AC_MSG_WARN([--with-libxml2 and --with-fgdb are both available. There might be some incompatibility between system libxml2 and the embedded copy within libFileGDBAPI]) 6193fi 6194 6195if test "$HAVE_CRYPTOPP" = "yes" -a "$HAVE_OPENSSL_CRYPTO" = "yes"; then 6196 AC_MSG_WARN([--with-crypto and --with-cryptopp available. This is unusual setup, but will work.]) 6197fi 6198 6199if test "$HAVE_TEIGHA" = "yes" -a "$ECW_54" = "yes"; then 6200 AC_MSG_WARN([Both Teigha SDK and ECW SDK >= 5.4 found. This was found to cause crashes in ECW driver.]) 6201fi 6202