source: trunk/gdal/frmts/grass/pkg/configure.in

Last change on this file was 37160, checked in by Even Rouault, 8 years ago

frmts/grass/pkg/configure: add support for GRASS 7.2 (patch by Bas Couwenberg, fixes #6785)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.5 KB
Line 
1dnl ***************************************************************************
2dnl $Id: configure.in 37160 2017-01-17 07:34:22Z rouault $
3dnl
4dnl Project: GDAL GRASS Plugin
5dnl Purpose: Configure source file.
6dnl Author: Frank Warmerdam, warmerdam@pobox.com
7dnl
8dnl ***************************************************************************
9dnl Copyright (c) 2005, 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(Makefile.in)
36
37dnl We require autoconf 2.52+ for libtool support on cygwin/mingw hosts
38AC_PREREQ(2.52)
39
40dnl Checks for programs.
41AC_PROG_CC
42AC_PROG_CXX
43
44AC_PROG_RANLIB
45AC_COMPILER_PIC
46AC_LD_SHARED
47AC_COMPILER_WFLAGS
48
49dnl ---------------------------------------------------------------------------
50dnl Find GDAL
51dnl ---------------------------------------------------------------------------
52
53AC_ARG_WITH(gdal,
54[ --with-gdal[=PATH] GDAL (PATH is path to gdal-config)],,)
55
56if 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
70elif 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
80else
81
82 AC_MSG_ERROR([gdal required to build GDAL GRASS driver])
83
84fi
85
86LIBS="`$GDAL_CONFIG --libs` $LIBS"
87GDAL_INC=`$GDAL_CONFIG --cflags`
88
89AC_SUBST(GDAL_INC, $GDAL_INC)
90
91dnl ---------------------------------------------------------------------------
92dnl Where to put driver?
93dnl ---------------------------------------------------------------------------
94AC_ARG_WITH(autoload,[ --with-autoload[=DIR] Directory for autoload drivers],,)
95
96if test "$with_autoload" != "" ; then
97 AUTOLOAD_DIR=$with_autoload
98else
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
104fi
105
106AC_MSG_RESULT(using $AUTOLOAD_DIR as GDAL shared library autoload directory)
107AC_SUBST(AUTOLOAD_DIR,$AUTOLOAD_DIR)
108
109dnl ---------------------------------------------------------------------------
110dnl Find GRASS 5.7 or GRASS 7
111dnl ---------------------------------------------------------------------------
112
113GRASS_SETTING=no
114GRASS_INCLUDE=
115GRASS_GISBASE=
116export GRASS_INCLUDE GRASS_SETTING GRASS_GISBASE
117
118AC_ARG_WITH(grass,[ --with-grass[=ARG] Include GRASS support (ARG=GRASS install tree dir)],,)
119
120if test "$with_grass" = "no" ; then
121 AC_MSG_ERROR([grass required for this driver, please install GRASS 5.7 or later and rebuild])
122fi
123
124if 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
154fi
155
156AC_SUBST(GRASS_INCLUDE,$GRASS_INCLUDE)
157AC_SUBST(GRASS_GISBASE,$GRASS_GISBASE)
158
159dnl ---------------------------------------------------------------------------
160
161dnl ---------------------------------------------------------------------------
162dnl Find PostgreSQL (GRASS optional dependency)
163dnl ---------------------------------------------------------------------------
164
165AC_ARG_WITH(postgres_includes,[ --with-postgres-includes=DIR use PostgreSQL includes in DIR], postgres_includes="$withval", postgres_includes=no)
166
167PQ_INCLUDE=
168if test "x$postgres_includes" != "xno"; then
169# With PostgreSQL includes directory
170PQ_INCLUDE="-I$postgres_includes"
171fi
172
173AC_SUBST(PQ_INCLUDE)
174
175dnl ---------------------------------------------------------------------------
176
177rm -f conftest*
178
179AC_OUTPUT(Makefile)
180
181
182
Note: See TracBrowser for help on using the repository browser.