root/tags/gdal_1_1_5/configure.in

Revision 2476, 12.8 kB (checked in by warmerda, 7 years ago)

fixed bug 75 on --with-libz handling

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(GDALmake.opt.in)
3 AC_CONFIG_HEADER(port/cpl_config.h)
4
5 dnl Checks for programs.
6 AC_PROG_CC
7 AC_PROG_CXX
8 AC_PROG_RANLIB
9
10 dnl We always want to check /usr/local for stuff.
11 LIBS="$LIBS -L/usr/local/lib"
12 CFLAGS="$CFLAGS -I/usr/local/include"
13 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
14
15 dnl Checks for libraries.
16 AC_CHECK_LIB(dl,dlopen,,,)
17 AC_CHECK_LIB(dbmalloc,malloc_chain_check,,,)
18 AC_CHECK_LIB(m,main,,,)
19
20 dnl Checks for header files.
21 AC_HEADER_STDC
22 AC_CHECK_HEADERS(fcntl.h unistd.h dbmalloc.h dlfcn.h)
23
24 dnl Checks for library functions.
25 MY_TEST_BIGENDIAN
26 AC_FUNC_VPRINTF
27 AC_CHECK_FUNC(vsnprintf, AC_DEFINE(HAVE_VSNPRINTF))
28
29 dnl Check for 64 bit file API
30 AC_HAVE_LONG_LONG
31 AC_UNIX_STDIO_64
32
33 OPT_GDAL_FORMATS=
34 EXTRA_INCLUDES=
35
36
37 dnl ---------------------------------------------------------------------------
38 dnl Check if libz is available.
39 dnl ---------------------------------------------------------------------------
40
41 AC_ARG_WITH(libz,[  --with-libz[=ARG]       Include libz support (ARG=internal or libz directory)],,)
42
43 if test "$with_libz" = "external" -o "$with_libz" = "" ; then
44
45   AC_CHECK_LIB(z,deflateInit_,LIBZ_SETTING=external,LIBZ_SETTING=internal,)
46
47   if test "$LIBZ_SETTING" = "external" ; then   
48     LIBS="-lz $LIBS"
49   else
50     echo "Using internal libz implementation."
51   fi
52
53 elif test "$with_libz" = "internal" ; then
54   LIBZ_SETTING=internal
55   echo "Using internal libz implementation."
56
57 else
58
59   LIBZ_SETTING=external
60   LIBS="-L$with_libz -L$with_libz -lz $LIBS"
61
62   echo "using $with_libz for libz."
63 fi
64
65 AC_SUBST(LIBZ_SETTING,$LIBZ_SETTING)
66
67 if test "$LIBZ_SETTING" = "internal" ; then
68   OPT_GDAL_FORMATS="zlib $OPT_GDAL_FORMATS"
69 fi
70
71 dnl ---------------------------------------------------------------------------
72 dnl Check if GRASS library is available.
73 dnl ---------------------------------------------------------------------------
74
75 AC_ARG_WITH(grass,[  --with-grass[=ARG]      Include GRASS support (ARG=no or libgrass path)],,)
76
77 if test "$with_grass" = "no" ; then
78
79   GRASS_SETTING=no
80
81   echo "GRASS support disabled."
82
83 elif test "$with_grass" = "yes" -o "$with_grass" = "" ; then
84
85   AC_CHECK_LIB(grass5,G_gisinit_2,GRASS_SETTING=external,GRASS_SETTING=no,)
86
87   if test "$GRASS_SETTING" = "external" ; then   
88     LIBS="-lgrass5 $LIBS"
89   fi
90
91 else
92
93   GRASS_SETTING=external
94   LIBS="-L$with_grass -L$with_grass/lib -lgrass5 $LIBS"
95   EXTRA_INCLUDES="-I$with_grass -I$with_grass/include $EXTRA_INCLUDES"
96
97   echo "using libgrass from $with_grass."
98 fi
99
100 AC_SUBST(GRASS_SETTING,$GRASS_SETTING)
101
102 if test "$GRASS_SETTING" != "no" ; then
103   OPT_GDAL_FORMATS="grass $OPT_GDAL_FORMATS"
104 fi
105
106 dnl ---------------------------------------------------------------------------
107 dnl Check if cfitsio library is available.
108 dnl ---------------------------------------------------------------------------
109
110 AC_ARG_WITH(cfitsio,[  --with-cfitsio[=ARG]      Include FITS support (ARG=no or libcfitsio path)],,)
111
112 if test "$with_cfitsio" = "no" ; then
113
114   FITS_SETTING=no
115
116   echo "FITS support disabled."
117
118 elif test "$with_cfitsio" = "yes" -o "$with_cfitsio" = "" ; then
119
120   AC_CHECK_LIB(cfitsio,ffopen,FITS_SETTING=external,FITS_SETTING=no,)
121
122   if test "$FITS_SETTING" = "external" ; then   
123     LIBS="-lcfitsio $LIBS"
124     echo "using pre-installed libcfitsio."
125   else
126     echo "libcfitsio not found - FITS support disabled"
127   fi
128
129 else
130
131   FITS_SETTING=external
132   LIBS="-L$with_cfitsio -L$with_cfitsio/lib -lcfitsio $LIBS"
133   EXTRA_INCLUDES="-I$with_cfitsio -I$with_cfitsio/include $EXTRA_INCLUDES"
134
135   echo "using libcfitsio from $with_cfitsio."
136 fi
137
138 AC_SUBST(FITS_SETTING,$FITS_SETTING)
139
140 if test "$FITS_SETTING" != "no" ; then
141   OPT_GDAL_FORMATS="fits $OPT_GDAL_FORMATS"
142 fi
143
144 dnl ---------------------------------------------------------------------------
145 dnl Select a PNG Library to use, or disable driver.
146 dnl ---------------------------------------------------------------------------
147
148 AC_ARG_WITH(png,[  --with-png[=ARG]        Include PNG support (ARG=internal, no or path)],,)
149
150 if test "$with_png" = "no" ; then
151
152   PNG_SETTING=no
153
154   echo "png support disabled."
155
156 elif test "$with_png" = "yes" -o "$with_png" = "" ; then
157
158   AC_CHECK_LIB(png,png_set_IHDR,PNG_SETTING=external,PNG_SETTING=internal,$LIBS)
159   AC_CHECK_HEADERS(png.h)
160
161   if test "$PNG_SETTING" = "external" -a "$ac_cv_header_png_h" = "no" ; then   
162     PNG_SETTING=internal
163   fi
164   if test "$PNG_SETTING" = "external" ; then   
165     LIBS="-lpng $LIBS"
166     echo "using pre-installed libpng."
167   else
168     echo "using internal png code."
169   fi
170
171 elif test "$with_png" = "internal" ; then
172
173   PNG_SETTING=internal
174
175   echo "using internal png code."
176
177 else
178
179   PNG_SETTING=external
180   LIBS="-L$with_png -L$with_png/lib -lpng $LIBS"
181   EXTRA_INCLUDES="-I$with_png -I$with_png/include $EXTRA_INCLUDES"
182
183   echo "using libpng from $with_png."
184
185 fi
186
187 AC_SUBST(PNG_SETTING,$PNG_SETTING)
188
189 if test "$PNG_SETTING" != "no" ; then
190   OPT_GDAL_FORMATS="png $OPT_GDAL_FORMATS"
191 fi
192
193 dnl ---------------------------------------------------------------------------
194 dnl Select a libtiff library to use.
195 dnl ---------------------------------------------------------------------------
196
197 AC_ARG_WITH(libtiff,[  --with-libtiff=ARG      Libtiff library to use (ARG=internal, yes or path)],,)
198
199 if test "$with_libtiff" = "yes" -o "$with_libtiff" = "" ; then
200
201   AC_CHECK_LIB(tiff,TIFFWriteCheck,TIFF_SETTING=external,TIFF_SETTING=internal,)
202
203   dnl Cygwin takes a somewhat restrictive view of what should be exported
204   dnl from the dll, so don't use the external library if missing semi-private
205   dnl functions.
206   if test "$TIFF_SETTING" = "external" ; then
207     AC_CHECK_LIB(tiff,_TIFFsetDoubleArray,TIFF_SETTING=external,TIFF_SETTING=internal,)
208   fi
209
210   if test "$TIFF_SETTING" = "external" ; then   
211     LIBS="-ltiff $LIBS"
212     echo "using pre-installed libtiff."
213   else
214     echo "using internal TIFF code."
215   fi
216
217 elif test "$with_libtiff" = "internal" ; then
218
219   TIFF_SETTING=internal
220
221   echo "using internal TIFF code."
222
223 else
224
225   TIFF_SETTING=external
226   if test -r $with_libtiff/tiff.h ; then
227     LIBS="-L$with_libtiff -ltiff $LIBS"
228     EXTRA_INCLUDES="-I$with_libtiff $EXTRA_INCLUDES"
229   else
230     LIBS="-L$with_libtiff/lib -ltiff $LIBS"
231     EXTRA_INCLUDES="-I$with_libtiff/include $EXTRA_INCLUDES"
232   fi
233
234   echo "using libtiff from $with_libtiff."
235 fi
236
237 AC_SUBST(TIFF_SETTING,$TIFF_SETTING)
238
239 dnl ---------------------------------------------------------------------------
240 dnl Select a libgeotiff library to use.
241 dnl ---------------------------------------------------------------------------
242
243 AC_ARG_WITH(geotiff,[  --with-geotiff=ARG      Libgeotiff library to use (ARG=internal, yes or path)],,)
244
245 if test "$with_geotiff" = "yes" -o "$with_geotiff" = "" ; then
246
247   AC_CHECK_LIB(geotiff,GTIFGetDefn,GEOTIFF_SETTING=external,GEOTIFF_SETTING=internal,)
248
249   if test "$GEOTIFF_SETTING" = "external" ; then   
250     LIBS="-lgeotiff $LIBS"
251     echo "using pre-installed libgeotiff."
252   else
253     echo "using internal GeoTIFF code."
254   fi
255
256 elif test "$with_geotiff" = "internal" ; then
257
258   GEOTIFF_SETTING=internal
259
260   echo "using internal GeoTIFF code."
261
262 else
263
264   GEOTIFF_SETTING=external
265   if test -r $with_geotiff/libgeotiff.a ; then
266     LIBS="-L$with_geotiff -lgeotiff $LIBS"
267     EXTRA_INCLUDES="-I$with_libtiff $EXTRA_INCLUDES"
268   else
269     LIBS="-L$with_geotiff/lib -lgeotiff $LIBS"
270     EXTRA_INCLUDES="-I$with_libtiff/include $EXTRA_INCLUDES"
271   fi
272
273   echo "using libgeotiff from $with_geotiff."
274 fi
275
276 AC_SUBST(GEOTIFF_SETTING,$GEOTIFF_SETTING)
277
278 dnl ---------------------------------------------------------------------------
279 dnl Select a JPEG Library to use, or disable driver.
280 dnl ---------------------------------------------------------------------------
281
282 AC_ARG_WITH(jpeg,[  --with-jpeg[=ARG]       Include JPEG support (ARG=internal, no or path)],,)
283
284 if test "$with_jpeg" = "no" ; then
285
286   JPEG_SETTING=no
287
288   echo "jpeg support disabled."
289
290 elif test "$with_jpeg" = "yes" -o "$with_jpeg" = "" ; then
291
292   AC_CHECK_LIB(jpeg,jpeg_read_scanlines,JPEG_SETTING=external,JPEG_SETTING=internal,)
293   AC_CHECK_HEADERS(jpeglib.h)
294
295   if test "$JPEG_SETTING" = "external" -a "$ac_cv_header_jpeglib_h" = "no" ; then
296     JPEG_SETTING=internal
297   fi
298
299   if test "$JPEG_SETTING" = "external" -a "$TIFF_SETTING" = "internal" ; then
300     AC_MSG_CHECKING([for width_in_blocks in jpeglib.h])
301
302     rm -f conftest.c
303     echo '#include "jpeglib.h"' >> conftest.c
304     echo 'int main() { jpeg_component_info *compptr=0; int i; i = comptr->width_in_blocks; }' >> conftest.c
305     if test -z "`${CC} -o conftest conftest.c 2>&1`" ; then
306       AC_MSG_RESULT([yes])
307     else
308       AC_MSG_RESULT([no])
309       JPEG_SETTING=internal
310     fi
311     rm -f conftest*
312   fi
313
314   if test "$JPEG_SETTING" = "external" ; then   
315     LIBS="-ljpeg $LIBS"
316     echo "using pre-installed libjpeg."
317   else
318     echo "using internal jpeg code."
319   fi
320
321 elif test "$with_jpeg" = "internal" ; then
322
323   JPEG_SETTING=internal
324
325   echo "using internal jpeg code."
326
327 else
328
329   JPEG_SETTING=external
330   LIBS="-L$with_jpeg -L$with_jpeg/lib -ljpeg $LIBS"
331   EXTRA_INCLUDES="-I$with_jpeg -I$with_jpeg/include $EXTRA_INCLUDES"
332
333   echo "using libjpeg from $with_jpeg."
334
335 fi
336
337 AC_SUBST(JPEG_SETTING,$JPEG_SETTING)
338
339 if test "$JPEG_SETTING" != "no" ; then
340   OPT_GDAL_FORMATS="jpeg $OPT_GDAL_FORMATS"
341 fi
342
343 dnl ---------------------------------------------------------------------------
344 dnl Select a GIF Library to use, or disable driver.
345 dnl ---------------------------------------------------------------------------
346
347 AC_ARG_WITH(gif,[  --with-gif[=ARG]        Include GIF support (ARG=internal, no or path)],,)
348
349 if test "$with_gif" = "no" ; then
350
351   GIF_SETTING=no
352
353   echo "gif support disabled."
354
355 elif test "$with_gif" = "yes" -o "$with_gif" = "" ; then
356
357   AC_CHECK_LIB(gif,DGifOpenFileName,GIF_SETTING=external,GIF_SETTING=internal,)
358
359   if test "$GIF_SETTING" = "external" ; then   
360     LIBS="-lgif $LIBS"
361     echo "using pre-installed libgif."
362   else
363     echo "using internal gif code."
364   fi
365
366 elif test "$with_gif" = "internal" ; then
367
368   GIF_SETTING=internal
369
370   echo "using internal gif code."
371
372 else
373
374   GIF_SETTING=external
375   LIBS="-L$with_gif -L$with_gif/lib -lgif $LIBS"
376   EXTRA_INCLUDES="-I$with_gif -I$with_gif/include $EXTRA_INCLUDES"
377
378   echo "using libgif from $with_gif."
379
380 fi
381
382 AC_SUBST(GIF_SETTING,$GIF_SETTING)
383
384 if test "$GIF_SETTING" != "no" ; then
385   OPT_GDAL_FORMATS="gif $OPT_GDAL_FORMATS"
386 fi
387
388 dnl ---------------------------------------------------------------------------
389 dnl Select an OGDI Library to use, or disable driver.
390 dnl ---------------------------------------------------------------------------
391
392 OGDI_INCLUDE=
393 export OGDI_INCLUDE
394
395 AC_ARG_WITH(ogdi,[  --with-ogdi[=ARG]       Include OGDI support (ARG=path)],,)
396
397 if test "$with_ogdi" = "no" ; then
398
399   HAVE_OGDI=no
400
401   echo "ogdi support disabled."
402
403 elif test "$with_ogdi" = "yes" -o "$with_ogdi" = "" ; then
404
405   AC_CHECK_LIB(ogdi,cln_GetLayerCapabilities,HAVE_OGDI=yes,HAVE_OGDI=no,)
406
407   if test "$HAVE_OGDI" = "yes" ; then   
408     LIBS="-logdi $LIBS"
409   fi
410
411 else
412
413   HAVE_OGDI=yes
414   LIBS="-L$with_ogdi -L$with_ogdi/lib -logdi $LIBS"
415   OGDI_INCLUDE="-I$with_ogdi -I$with_ogdi/include"
416
417   echo "using libogdi from $with_ogdi."
418
419 fi
420
421 AC_SUBST(HAVE_OGDI,$HAVE_OGDI)
422 AC_SUBST(OGDI_INCLUDE,$OGDI_INCLUDE)
423
424 if test "$HAVE_OGDI" != "no" ; then
425   OPT_GDAL_FORMATS="ogdi $OPT_GDAL_FORMATS"
426 fi
427
428 dnl ---------------------------------------------------------------------------
429
430 AC_SUBST(OPT_GDAL_FORMATS,$OPT_GDAL_FORMATS)
431 AC_SUBST(EXTRA_INCLUDES,$EXTRA_INCLUDES)
432
433 dnl ---------------------------------------------------------------------------
434
435 AC_ARG_WITH(ogr,[  --without-ogr           Don't build OGR into shared library],,)
436
437 if test "$with_ogr" = yes -o x"$with_ogr" = x ; then
438   echo checking for OGR ... enabled
439   OGR_ENABLED=yes
440 else
441   echo checking for OGR ... disabled by user
442   OGR_ENABLED=no
443 fi
444 AC_SUBST(OGR_ENABLED,$OGR_ENABLED)
445
446 dnl ---------------------------------------------------------------------------
447 dnl Select an PostgreSQL Library to use, or disable driver.
448 dnl ---------------------------------------------------------------------------
449
450 PG_CONFIG=no
451
452 AC_ARG_WITH(pg,[  --with-pg[=ARG]         Include PostgreSQL OGR Support (ARG=path to pg_config)],,)
453
454 if test "$with_pg" = "yes" -o "$with_pg" = "" ; then
455   AC_PATH_PROG(PG_CONFIG, pg_config, no)
456 else
457   PG_CONFIG=$with_pg
458 fi
459
460 AC_MSG_CHECKING([for PostgreSQL])
461
462 if test "$PG_CONFIG" = "no" ; then
463
464   HAVE_PG=no
465   PG_LIB=
466   PG_INC=
467
468   AC_MSG_RESULT([no])
469
470 else
471
472   HAVE_PG=yes
473   PG_LIB="-L`$PG_CONFIG --libdir` -lpq"
474   PG_INC="-I`$PG_CONFIG --includedir`"
475
476   AC_MSG_RESULT([yes])
477
478 fi
479
480 AC_SUBST(HAVE_PG,$HAVE_PG)
481 AC_SUBST(PG_INC,$PG_INC)
482 AC_SUBST(PG_LIB,$PG_LIB)
483
484 dnl ---------------------------------------------------------------------------
485
486 AC_COMPILER_WFLAGS
487 AC_COMPILER_PIC
488 AC_LD_SHARED
489
490 dnl ---------------------------------------------------------------------------
491 dnl Python Checks
492 dnl ---------------------------------------------------------------------------
493
494 AC_ARG_WITH(python,[  --without-python        Disable Python],,)
495
496 AM_PATH_PYTHON
497 AM_INIT_PYEXEC_MOD
498 AM_CHECK_NUMPY
499
500 AC_OUTPUT(GDALmake.opt)
Note: See TracBrowser for help on using the browser.