| 1 | dnl ***************************************************************************
|
|---|
| 2 | dnl $Id: configure.in 37160 2017-01-17 07:34:22Z rouault $
|
|---|
| 3 | dnl
|
|---|
| 4 | dnl Project: GDAL GRASS Plugin
|
|---|
| 5 | dnl Purpose: Configure source file.
|
|---|
| 6 | dnl Author: Frank Warmerdam, warmerdam@pobox.com
|
|---|
| 7 | dnl
|
|---|
| 8 | dnl ***************************************************************************
|
|---|
| 9 | dnl Copyright (c) 2005, Frank Warmerdam
|
|---|
| 10 | dnl
|
|---|
| 11 | dnl Permission is hereby granted, free of charge, to any person obtaining a
|
|---|
| 12 | dnl copy of this software and associated documentation files (the "Software"),
|
|---|
| 13 | dnl to deal in the Software without restriction, including without limitation
|
|---|
| 14 | dnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|---|
| 15 | dnl and/or sell copies of the Software, and to permit persons to whom the
|
|---|
| 16 | dnl Software is furnished to do so, subject to the following conditions:
|
|---|
| 17 | dnl
|
|---|
| 18 | dnl The above copyright notice and this permission notice shall be included
|
|---|
| 19 | dnl in all copies or substantial portions of the Software.
|
|---|
| 20 | dnl
|
|---|
| 21 | dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|---|
| 22 | dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|---|
| 23 | dnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|---|
| 24 | dnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|---|
| 25 | dnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|---|
| 26 | dnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|---|
| 27 | dnl DEALINGS IN THE SOFTWARE.
|
|---|
| 28 | dnl ***************************************************************************
|
|---|
| 29 |
|
|---|
| 30 | dnl Disable configure caching ... it causes lots of hassles.
|
|---|
| 31 | define([AC_CACHE_LOAD], )
|
|---|
| 32 | define([AC_CACHE_SAVE], )
|
|---|
| 33 |
|
|---|
| 34 | dnl Process this file with autoconf to produce a configure script.
|
|---|
| 35 | AC_INIT(Makefile.in)
|
|---|
| 36 |
|
|---|
| 37 | dnl We require autoconf 2.52+ for libtool support on cygwin/mingw hosts
|
|---|
| 38 | AC_PREREQ(2.52)
|
|---|
| 39 |
|
|---|
| 40 | dnl Checks for programs.
|
|---|
| 41 | AC_PROG_CC
|
|---|
| 42 | AC_PROG_CXX
|
|---|
| 43 |
|
|---|
| 44 | AC_PROG_RANLIB
|
|---|
| 45 | AC_COMPILER_PIC
|
|---|
| 46 | AC_LD_SHARED
|
|---|
| 47 | AC_COMPILER_WFLAGS
|
|---|
| 48 |
|
|---|
| 49 | dnl ---------------------------------------------------------------------------
|
|---|
| 50 | dnl Find GDAL
|
|---|
| 51 | dnl ---------------------------------------------------------------------------
|
|---|
| 52 |
|
|---|
| 53 | AC_ARG_WITH(gdal,
|
|---|
| 54 | [ --with-gdal[=PATH] GDAL (PATH is path to gdal-config)],,)
|
|---|
| 55 |
|
|---|
| 56 | if test "$with_gdal" = "yes" -o "$with_gdal" = "" ; then
|
|---|
| 57 |
|
|---|
| 58 | if test "`basename xx/$with_gdal`" = "gdal-config" ; then
|
|---|
| 59 | GDAL_CONFIG="$with_gdal"
|
|---|
| 60 | fi
|
|---|
| 61 |
|
|---|
| 62 | if test -z "$GDAL_CONFIG" ; then
|
|---|
| 63 | AC_PATH_PROG(GDAL_CONFIG, gdal-config, no)
|
|---|
| 64 | fi
|
|---|
| 65 |
|
|---|
| 66 | if test "$GDAL_CONFIG" = "no" ; then
|
|---|
| 67 | AC_MSG_ERROR([couldn't find gdal-config])
|
|---|
| 68 | fi
|
|---|
| 69 |
|
|---|
| 70 | elif test -n "$with_gdal" -a "$with_gdal" != "no" ; then
|
|---|
| 71 |
|
|---|
| 72 | GDAL_CONFIG=$with_gdal
|
|---|
| 73 |
|
|---|
| 74 | if test -f "$GDAL_CONFIG" -a -x "$GDAL_CONFIG" ; then
|
|---|
| 75 | AC_MSG_RESULT([user supplied gdal-config ($GDAL_CONFIG)])
|
|---|
| 76 | else
|
|---|
| 77 | AC_MSG_ERROR(['$GDAL_CONFIG' is not an executable. Make sure you use --with-gdal=/path/to/gdal-config])
|
|---|
| 78 | fi
|
|---|
| 79 |
|
|---|
| 80 | else
|
|---|
| 81 |
|
|---|
| 82 | AC_MSG_ERROR([gdal required to build GDAL GRASS driver])
|
|---|
| 83 |
|
|---|
| 84 | fi
|
|---|
| 85 |
|
|---|
| 86 | LIBS="`$GDAL_CONFIG --libs` $LIBS"
|
|---|
| 87 | GDAL_INC=`$GDAL_CONFIG --cflags`
|
|---|
| 88 |
|
|---|
| 89 | AC_SUBST(GDAL_INC, $GDAL_INC)
|
|---|
| 90 |
|
|---|
| 91 | dnl ---------------------------------------------------------------------------
|
|---|
| 92 | dnl Where to put driver?
|
|---|
| 93 | dnl ---------------------------------------------------------------------------
|
|---|
| 94 | AC_ARG_WITH(autoload,[ --with-autoload[=DIR] Directory for autoload drivers],,)
|
|---|
| 95 |
|
|---|
| 96 | if test "$with_autoload" != "" ; then
|
|---|
| 97 | AUTOLOAD_DIR=$with_autoload
|
|---|
| 98 | else
|
|---|
| 99 | if $GDAL_CONFIG --autoload > /dev/null 2>&1 ; then
|
|---|
| 100 | AUTOLOAD_DIR=`$GDAL_CONFIG --autoload`
|
|---|
| 101 | else
|
|---|
| 102 | AUTOLOAD_DIR=`$GDAL_CONFIG --prefix`/lib/gdalplugins
|
|---|
| 103 | fi
|
|---|
| 104 | fi
|
|---|
| 105 |
|
|---|
| 106 | AC_MSG_RESULT(using $AUTOLOAD_DIR as GDAL shared library autoload directory)
|
|---|
| 107 | AC_SUBST(AUTOLOAD_DIR,$AUTOLOAD_DIR)
|
|---|
| 108 |
|
|---|
| 109 | dnl ---------------------------------------------------------------------------
|
|---|
| 110 | dnl Find GRASS 5.7 or GRASS 7
|
|---|
| 111 | dnl ---------------------------------------------------------------------------
|
|---|
| 112 |
|
|---|
| 113 | GRASS_SETTING=no
|
|---|
| 114 | GRASS_INCLUDE=
|
|---|
| 115 | GRASS_GISBASE=
|
|---|
| 116 | export GRASS_INCLUDE GRASS_SETTING GRASS_GISBASE
|
|---|
| 117 |
|
|---|
| 118 | AC_ARG_WITH(grass,[ --with-grass[=ARG] Include GRASS support (ARG=GRASS install tree dir)],,)
|
|---|
| 119 |
|
|---|
| 120 | if test "$with_grass" = "no" ; then
|
|---|
| 121 | AC_MSG_ERROR([grass required for this driver, please install GRASS 5.7 or later and rebuild])
|
|---|
| 122 | fi
|
|---|
| 123 |
|
|---|
| 124 | if test "$with_grass" != "yes" ; then
|
|---|
| 125 |
|
|---|
| 126 | AC_CHECK_LIB(grass_gis,G_read_compressed,GRASS_SETTING=grass72+,GRASS_SETTING=no,-L$with_grass/lib -lgrass_datetime)
|
|---|
| 127 | if test "$GRASS_SETTING" = "no" ; then
|
|---|
| 128 | AC_CHECK_LIB(grass_gis,G_is_initialized,GRASS_SETTING=grass70+,GRASS_SETTING=no,-L$with_grass/lib -lgrass_datetime)
|
|---|
| 129 | if test "$GRASS_SETTING" = "no" ; then
|
|---|
| 130 | AC_CHECK_LIB(grass_gis,G_asprintf,GRASS_SETTING=grass57+,GRASS_SETTING=no,-L$with_grass/lib -lgrass_datetime)
|
|---|
| 131 | fi
|
|---|
| 132 | fi
|
|---|
| 133 |
|
|---|
| 134 | if test "$GRASS_SETTING" != "no" ; then
|
|---|
| 135 | if test "$GRASS_SETTING" = "grass72+" ; then
|
|---|
| 136 | G_RASTLIBS="-lgrass_raster -lgrass_imagery"
|
|---|
| 137 | G_VECTLIBS="-lgrass_vector -lgrass_dig2 -lgrass_dgl -lgrass_rtree -lgrass_linkm -lgrass_dbmiclient -lgrass_dbmibase"
|
|---|
| 138 | LIBS="-L$with_grass/lib $G_VECTLIBS $G_RASTLIBS -lgrass_gproj -lgrass_gmath -lgrass_gis -lgrass_datetime -lgrass_btree2 -lgrass_ccmath $LIBS"
|
|---|
| 139 | elif test "$GRASS_SETTING" = "grass70+" ; then
|
|---|
| 140 | G_RASTLIBS="-lgrass_raster -lgrass_imagery"
|
|---|
| 141 | G_VECTLIBS="-lgrass_vector -lgrass_dig2 -lgrass_dgl -lgrass_rtree -lgrass_linkm -lgrass_dbmiclient -lgrass_dbmibase"
|
|---|
| 142 | LIBS="-L$with_grass/lib $G_VECTLIBS $G_RASTLIBS -lgrass_gproj -lgrass_gmath -lgrass_gis -lgrass_datetime $LIBS"
|
|---|
| 143 | else
|
|---|
| 144 | G_RASTLIBS="-lgrass_I"
|
|---|
| 145 | G_VECTLIBS="-lgrass_vect -lgrass_dig2 -lgrass_dgl -lgrass_rtree -lgrass_linkm -lgrass_dbmiclient -lgrass_dbmibase"
|
|---|
| 146 | LIBS="-L$with_grass/lib $G_VECTLIBS $G_RASTLIBS -lgrass_gproj -lgrass_vask -lgrass_gmath -lgrass_gis -lgrass_datetime $LIBS"
|
|---|
| 147 | fi
|
|---|
| 148 | GRASS_INCLUDE="-I$with_grass/include"
|
|---|
| 149 | GRASS_GISBASE="$with_grass"
|
|---|
| 150 | HAVE_GRASS=yes
|
|---|
| 151 | else
|
|---|
| 152 | AC_MSG_ERROR([--with-grass=$with_grass requested, but libraries not found!])
|
|---|
| 153 | fi
|
|---|
| 154 | fi
|
|---|
| 155 |
|
|---|
| 156 | AC_SUBST(GRASS_INCLUDE,$GRASS_INCLUDE)
|
|---|
| 157 | AC_SUBST(GRASS_GISBASE,$GRASS_GISBASE)
|
|---|
| 158 |
|
|---|
| 159 | dnl ---------------------------------------------------------------------------
|
|---|
| 160 |
|
|---|
| 161 | dnl ---------------------------------------------------------------------------
|
|---|
| 162 | dnl Find PostgreSQL (GRASS optional dependency)
|
|---|
| 163 | dnl ---------------------------------------------------------------------------
|
|---|
| 164 |
|
|---|
| 165 | AC_ARG_WITH(postgres_includes,[ --with-postgres-includes=DIR use PostgreSQL includes in DIR], postgres_includes="$withval", postgres_includes=no)
|
|---|
| 166 |
|
|---|
| 167 | PQ_INCLUDE=
|
|---|
| 168 | if test "x$postgres_includes" != "xno"; then
|
|---|
| 169 | # With PostgreSQL includes directory
|
|---|
| 170 | PQ_INCLUDE="-I$postgres_includes"
|
|---|
| 171 | fi
|
|---|
| 172 |
|
|---|
| 173 | AC_SUBST(PQ_INCLUDE)
|
|---|
| 174 |
|
|---|
| 175 | dnl ---------------------------------------------------------------------------
|
|---|
| 176 |
|
|---|
| 177 | rm -f conftest*
|
|---|
| 178 |
|
|---|
| 179 | AC_OUTPUT(Makefile)
|
|---|
| 180 |
|
|---|
| 181 |
|
|---|
| 182 |
|
|---|