root/tags/gdal_1_2_4/configure.in

Revision 6709, 44.2 kB (checked in by dron, 4 years ago)

Search for assert.h header.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 dnl Disable configure caching ... it causes lots of hassles.
2 define([AC_CACHE_LOAD], )
3 define([AC_CACHE_SAVE], )
4
5 dnl Process this file with autoconf to produce a configure script.
6 AC_INIT(GDALmake.opt.in)
7 AC_CONFIG_HEADER(port/cpl_config.h)
8
9 dnl We require autoconf 2.52+ for libtool support on cygwin/mingw hosts
10 AC_PREREQ(2.52)
11
12 dnl Compute the canonical target-system type variable $target
13 AC_CANONICAL_TARGET
14
15 dnl Checks for programs.
16 AC_PROG_CC
17 AC_PROG_CXX
18 AC_LIBTOOL_WIN32_DLL
19 AC_PROG_LIBTOOL
20
21 dnl switch between libtool and native build system
22 AC_ARG_WITH(libtool, [  --without-libtool          Don't use libtool to build the library],,)
23
24 if test "$with_libtool" = "no"; then
25   AC_PROG_RANLIB
26   AC_LD_SHARED
27   AC_COMPILER_PIC
28 else
29   with_libtool=yes
30 fi
31 AC_SUBST(HAVE_LIBTOOL,$with_libtool)
32
33 dnl Checks for libraries.
34 AC_CHECK_LIB(dl,dlopen,,,)
35
36 dnl We don't need to add math library at all targets
37 case "$target_os" in
38     cygwin* | mingw32* | beos* | darwin*)
39         ;;
40     *)
41         AC_CHECK_LIB(m,main,,,)
42         ;;
43 esac
44
45 dnl Checks for header files.
46 AC_HEADER_STDC
47 AC_CHECK_HEADERS(assert.h fcntl.h unistd.h dbmalloc.h dlfcn.h stdint.h limits.h locale.h)
48
49 AC_C_BIGENDIAN
50
51 dnl Check for 64 bit file API
52 AC_HAVE_LONG_LONG
53 AC_UNIX_STDIO_64
54
55 AC_CHECK_SIZEOF(int)
56 AC_CHECK_SIZEOF(long)
57 dnl Some compilers (IBM VisualAge) has these types defined, so check it here.
58 dnl These types are used in internal libtiff.
59 AC_CHECK_TYPES([int8, int16, int32],,,
60 [
61 #if HAVE_INTTYPES_H
62 # include <inttypes.h>
63 #endif
64 ])
65
66 dnl We need the following lines for libtiff too.
67 HAVE_IEEEFP=1
68 AC_DEFINE_UNQUOTED(HAVE_IEEEFP, $HAVE_IEEEFP, [Define as 0 or 1 according to the floating point format suported by the machine])
69
70 dnl Check the native cpu bit order (also libtiff stuff).
71 AC_MSG_CHECKING([native cpu bit order])
72 case "$target_cpu" in
73     i*86*)
74         HOST_FILLORDER=FILLORDER_LSB2MSB
75         AC_MSG_RESULT([lsb2msb])
76         ;;
77     *)
78         HOST_FILLORDER=FILLORDER_MSB2LSB
79         AC_MSG_RESULT([msb2lsb])
80         ;;
81 esac
82 AC_DEFINE_UNQUOTED(HOST_FILLORDER, $HOST_FILLORDER, [Set the native cpu bit order (FILLORDER_LSB2MSB or FILLORDER_MSB2LSB)])
83
84
85 dnl Checks for library functions.
86 AC_FUNC_VPRINTF
87 AC_CHECK_FUNCS(vsnprintf)
88 AC_CHECK_FUNCS(snprintf)
89 AC_CHECK_FUNCS(atoll)
90
91 dnl Make sure at least these are checked under C++.  Prototypes missing on
92 dnl some platforms.
93
94 AC_LANG_PUSH(C++)
95 AC_CHECK_FUNC_CUSTOM(gmtime_r,[#include <time.h>],[time_t t; struct tm ltime; t = time(0); gmtime_r( &t, &ltime );])
96 AC_CHECK_FUNC_CUSTOM(localtime_r,[#include <time.h>],[time_t t; struct tm ltime; t = time(0); localtime_r( &t, &ltime );])
97 AC_LANG_POP(C++)
98
99 AC_CHECK_FUNC(setlocale)
100
101 OPT_GDAL_FORMATS=
102 EXTRA_INCLUDES=
103
104 dnl ---------------------------------------------------------------------------
105 dnl Check if user requests /usr/local to be included.
106 dnl ---------------------------------------------------------------------------
107
108 AC_MSG_CHECKING([for local include/lib path])
109
110 AC_ARG_WITH(local,[  --with-local[=dir]      Include /usr/local or other local tree for INCLUDE/LIBS],,)
111
112 if test "$with_local" != "no" -a "$with_local" != "" ; then
113  
114   if test "$with_local" = "yes" ; then
115     ADD_PREFIX=/usr/local
116   else
117     ADD_PREFIX=$with_local
118   fi
119
120   AC_MSG_RESULT(adding $ADD_PREFIX)
121
122   LIBS="$LIBS -L$ADD_PREFIX/lib"
123   CFLAGS="$CFLAGS -I$ADD_PREFIX/include"
124   CPPFLAGS="$CPPFLAGS -I$ADD_PREFIX/include"
125 else
126   AC_MSG_RESULT([none])
127 fi
128
129 dnl ---------------------------------------------------------------------
130 dnl ENABLE THREADS ONLY IF REQUESTED.
131 dnl ---------------------------------------------------------------------
132
133 THREAD_LIB=""
134 THREAD_FLAG=""
135
136 AC_ARG_WITH(threads,
137 [  --with-threads[=linkopt]Include thread safe support],,)
138
139 if test "$with_threads" = "yes" ; then
140
141   AC_CHECK_LIB(pthread,pthread_create,THREAD_FLAG=-DCPL_MULTIPROC_PTHREAD,,,)
142
143   if test -n "$THREAD_FLAG" ; then
144       THREAD_LIB="-lpthread"
145   fi
146
147 elif test -n "$with_threads" -a "$with_threads" != "no" ; then
148
149   THREAD_FLAG=-DCPL_MULTIPROC_PTHREAD
150   THREAD_LIB="$with_threads" 
151
152   AC_CHECKING(whether we should include thread/mutex support...)
153   AC_MSG_RESULT([        using threads with link options "$THREAD_LIB".])
154
155 else
156   AC_CHECKING(whether we should include thread/mutex support...)
157   AC_MSG_RESULT([        thread safe support disabled.])
158 fi
159
160 CFLAGS="$CFLAGS $THREAD_FLAG"
161 CXXFLAGS="$CXXFLAGS $THREAD_FLAG"
162 LIBS="$THREAD_LIB $LIBS"
163
164 dnl ---------------------------------------------------------------------------
165 dnl Check if libz is available.
166 dnl ---------------------------------------------------------------------------
167
168 AC_ARG_WITH(libz,[  --with-libz[=ARG]       Include libz support (ARG=internal or libz directory)],,)
169
170 if test "$with_libz" = "external" -o "$with_libz" = "" -o "$with_libz" = "yes" ; then
171
172   AC_CHECK_LIB(z,deflateInit_,LIBZ_SETTING=external,LIBZ_SETTING=internal,)
173
174   if test "$LIBZ_SETTING" = "external" ; then
175     AC_MSG_RESULT([using pre-installed libz])
176   fi
177
178 elif test "$with_libz" != "no" -a "$with_libz" != "internal" ; then
179
180   LIBS="-L$with_libz -L$with_libz/lib $LIBS"
181   LIBZ_SETTING=external
182   AC_MSG_RESULT([using libz library from $with_libz])
183
184 fi
185
186 if test "$LIBZ_SETTING" = "external" ; then
187   LIBS="-lz $LIBS"
188 elif test "$with_libz" = "no" ; then
189   LIBZ_SETTING=no
190   AC_MSG_RESULT([not using libz at all.])
191 else
192   LIBZ_SETTING=internal
193   OPT_GDAL_FORMATS="zlib $OPT_GDAL_FORMATS"
194   AC_MSG_RESULT([using internal libz code.])
195 fi
196
197 AC_SUBST(LIBZ_SETTING,$LIBZ_SETTING)
198
199 dnl ---------------------------------------------------------------------------
200 dnl Check if we should build with GRASS support.
201 dnl ---------------------------------------------------------------------------
202
203 GRASS_SETTING=no
204 GRASS_INCLUDE=
205 export GRASS_INCLUDE GRASS_SETTING
206
207 AC_ARG_WITH(grass,[  --with-grass[=ARG]      Include GRASS support (ARG=GRASS install tree dir)],,)
208
209 AC_ARG_WITH(libgrass,[  --with-libgrass[=ARG]    Include GRASS support based on libgrass (GRASS 5.0)],,)
210
211 # default use of grass libraries off since we can't easily auto-find them.
212 if test "$with_grass" = "" ; then
213   with_grass=no
214 fi
215
216 # Check for GRASS 5.7.0 or later library use.
217 if test "$with_grass" != "yes" -a "$with_grass" != "no" ; then
218
219   AC_CHECK_LIB(grass_gis,G_asprintf,GRASS_SETTING=grass57+,GRASS_SETTING=no,-L$with_grass/lib -lgrass_datetime)
220    
221   if test "$GRASS_SETTING" = "grass57+" ; then   
222     LIBS="-L$with_grass/lib -lgrass_I -lgrass_vask -lgrass_gmath -lgrass_gis -lgrass_datetime $LIBS"
223     GRASS_INCLUDE="-I$with_grass/include"
224   else
225     AC_MSG_ERROR([--with-grass=$with_grass requested, but libraries not found!])
226   fi
227
228 # Check if libgrass is disabled.
229 elif test "$with_libgrass" = "no" ; then
230
231   echo "GRASS support disabled."
232
233 elif test "$with_libgrass" = "yes" -o "$with_libgrass" = "" ; then
234
235   AC_CHECK_LIB(grass5,G_gisinit_2,GRASS_SETTING=libgrass,GRASS_SETTING=no,)
236
237   if test "$GRASS_SETTING" = "libgrass" ; then   
238     LIBS="-lgrass5 $LIBS"
239   fi
240
241 else
242
243   AC_CHECK_LIB(grass5,G_gisinit_2,GRASS_SETTING=libgrass,GRASS_SETTING=no,-L$with_libgrass/lib)
244
245   if test "$GRASS_SETTING" = "libgrass" ; then   
246     LIBS="-L$with_libgrass -L$with_libgrass/lib -lgrass5 $LIBS"
247     GRASS_INCLUDE="-I$with_libgrass -I$with_libgrass/include $EXTRA_INCLUDES"
248   else
249     AC_MSG_ERROR([--with-libgrass=$with_grass requested, but libgrass5 not found!])
250   fi
251 fi
252
253 AC_SUBST(GRASS_SETTING,$GRASS_SETTING)
254 AC_SUBST(GRASS_INCLUDE,$GRASS_INCLUDE)
255
256 if test "$GRASS_SETTING" != "no" ; then
257   OPT_GDAL_FORMATS="grass $OPT_GDAL_FORMATS"
258 fi
259
260 dnl ---------------------------------------------------------------------------
261 dnl Check if cfitsio library is available.
262 dnl ---------------------------------------------------------------------------
263
264 AC_ARG_WITH(cfitsio,[  --with-cfitsio[=ARG]    Include FITS support (ARG=no or libcfitsio path)],,)
265
266 if test "$with_cfitsio" = "no" ; then
267
268   FITS_SETTING=no
269
270   echo "FITS support disabled."
271
272 elif test "$with_cfitsio" = "yes" -o "$with_cfitsio" = "" ; then
273
274   AC_CHECK_LIB(cfitsio,ffopen,FITS_SETTING=external,FITS_SETTING=no,)
275
276   if test "$FITS_SETTING" = "external" ; then   
277     LIBS="-lcfitsio $LIBS"
278     echo "using pre-installed libcfitsio."
279   else
280     echo "libcfitsio not found - FITS support disabled"
281   fi
282
283 else
284
285   FITS_SETTING=external
286   LIBS="-L$with_cfitsio -L$with_cfitsio/lib -lcfitsio $LIBS"
287   EXTRA_INCLUDES="-I$with_cfitsio -I$with_cfitsio/include $EXTRA_INCLUDES"
288
289   echo "using libcfitsio from $with_cfitsio."
290 fi
291
292 AC_SUBST(FITS_SETTING,$FITS_SETTING)
293
294 if test "$FITS_SETTING" != "no" ; then
295   OPT_GDAL_FORMATS="fits $OPT_GDAL_FORMATS"
296 fi
297
298 dnl ---------------------------------------------------------------------------
299 dnl Check if netcdf library is available.
300 dnl ---------------------------------------------------------------------------
301
302 AC_ARG_WITH(netcdf,[  --with-netcdf[=ARG]     Include netCDF support (ARG=no or netCDF tree prefix)],,)
303
304 if test "$with_netcdf" = "no" ; then
305
306   NETCDF_SETTING=no
307
308   echo "netCDF support disabled."
309
310 elif test "$with_netcdf" = "yes" -o "$with_netcdf" = "" ; then
311
312   AC_CHECK_LIB(netcdf,nc_open,NETCDF_SETTING=yes,NETCDF_SETTING=no,)
313
314   if test "$NETCDF_SETTING" = "yes" ; then   
315     LIBS="-lnetcdf $LIBS"
316     echo "using pre-installed libnetcdf."
317   else
318     echo "libnetcdf not found - netCDF support disabled"
319   fi
320
321 else
322
323   NETCDF_SETTING=yes
324   LIBS="-L$with_netcdf -L$with_netcdf/lib -lnetcdf $LIBS"
325   EXTRA_INCLUDES="-I$with_netcdf -I$with_netcdf/include $EXTRA_INCLUDES"
326
327   echo "using libnetcdf from $with_netcdf."
328 fi
329
330 AC_SUBST(NETCDF_SETTING,$NETCDF_SETTING)
331
332 if test "$NETCDF_SETTING" != "no" ; then
333   OPT_GDAL_FORMATS="netcdf $OPT_GDAL_FORMATS"
334 fi
335
336 dnl ---------------------------------------------------------------------------
337 dnl Select a PNG Library to use, or disable driver.
338 dnl ---------------------------------------------------------------------------
339
340 AC_ARG_WITH(png,[  --with-png[=ARG]        Include PNG support (ARG=internal, no or path)],,)
341
342 if test "$with_png" = "no" ; then
343
344   PNG_SETTING=no
345
346   echo "png support disabled."
347
348 elif test "$with_png" = "yes" -o "$with_png" = "" ; then
349
350   AC_CHECK_LIB(png,png_set_IHDR,PNG_SETTING=external,PNG_SETTING=internal,$LIBS)
351   AC_CHECK_HEADERS(png.h)
352
353   if test "$PNG_SETTING" = "external" -a "$ac_cv_header_png_h" = "no" ; then   
354     PNG_SETTING=internal
355   fi
356   if test "$PNG_SETTING" = "external" ; then   
357     LIBS="-lpng $LIBS"
358     echo "using pre-installed libpng."
359   else
360     echo "using internal png code."
361   fi
362
363 elif test "$with_png" = "internal" ; then
364
365   PNG_SETTING=internal
366
367   echo "using internal png code."
368
369 else
370
371   PNG_SETTING=external
372   LIBS="-L$with_png -L$with_png/lib -lpng $LIBS"
373   EXTRA_INCLUDES="-I$with_png -I$with_png/include $EXTRA_INCLUDES"
374
375   echo "using libpng from $with_png."
376
377 fi
378
379 AC_SUBST(PNG_SETTING,$PNG_SETTING)
380
381 if test "$PNG_SETTING" != "no" ; then
382   OPT_GDAL_FORMATS="png $OPT_GDAL_FORMATS"
383 fi
384
385 dnl ---------------------------------------------------------------------------
386 dnl Select a libtiff library to use.
387 dnl ---------------------------------------------------------------------------
388
389 AC_ARG_WITH(libtiff,[  --with-libtiff=ARG    Libtiff library to use (ARG=internal, yes or path)],,)
390
391 if test "$with_libtiff" = "yes" -o "$with_libtiff" = "" ; then
392
393   # We now effectively require libtiff 3.6.0.
394   AC_CHECK_LIB(tiff,TIFFGetTagListCount,TIFF_SETTING=external,TIFF_SETTING=internal,)
395
396   dnl Cygwin takes a somewhat restrictive view of what should be exported
397   dnl from the dll, so don't use the external library if missing semi-private
398   dnl functions.
399   if test "$TIFF_SETTING" = "external" ; then
400     AC_CHECK_LIB(tiff,_TIFFsetDoubleArray,TIFF_SETTING=external,TIFF_SETTING=internal,)
401   fi
402
403   if test "$TIFF_SETTING" = "external" ; then   
404     LIBS="-ltiff $LIBS"
405     echo "using pre-installed libtiff."
406   else
407     echo "using internal TIFF code."
408   fi
409
410 elif test "$with_libtiff" = "internal" ; then
411
412   TIFF_SETTING=internal
413
414   echo "using internal TIFF code."
415
416 else
417
418   TIFF_SETTING=external
419   if test -r $with_libtiff/tiff.h ; then
420     LIBS="-L$with_libtiff -ltiff $LIBS"
421     EXTRA_INCLUDES="-I$with_libtiff $EXTRA_INCLUDES"
422   else
423     LIBS="-L$with_libtiff/lib -ltiff $LIBS"
424     EXTRA_INCLUDES="-I$with_libtiff/include $EXTRA_INCLUDES"
425   fi
426
427   echo "using libtiff from $with_libtiff."
428 fi
429
430 AC_SUBST(TIFF_SETTING,$TIFF_SETTING)
431
432 dnl ---------------------------------------------------------------------------
433 dnl Select a libgeotiff library to use.
434 dnl ---------------------------------------------------------------------------
435
436 AC_ARG_WITH(geotiff,[  --with-geotiff=ARG    Libgeotiff library to use (ARG=internal, yes or path)],,)
437
438 if test "$with_geotiff" = "yes" -o "$with_geotiff" = "" ; then
439
440   if test "$TIFF_SETTING" = "internal" ; then
441     GEOTIFF_SETTING=internal
442   else
443     dnl We now require libgeotiff 1.2.1 (for XTIFFClientOpen).
444     AC_CHECK_LIB(geotiff,XTIFFClientOpen,GEOTIFF_SETTING=external,GEOTIFF_SETTING=internal,)
445
446   fi
447
448   if test "$GEOTIFF_SETTING" = "external" ; then   
449     LIBS="-lgeotiff $LIBS"
450     echo "using pre-installed libgeotiff."
451   else
452     echo "using internal GeoTIFF code."
453   fi
454
455 elif test "$with_geotiff" = "internal" ; then
456
457   GEOTIFF_SETTING=internal
458
459   echo "using internal GeoTIFF code."
460
461 else
462
463   GEOTIFF_SETTING=external
464   if test -r $with_geotiff/libgeotiff.a ; then
465     LIBS="-L$with_geotiff -lgeotiff $LIBS"
466     EXTRA_INCLUDES="-I$with_geotiff $EXTRA_INCLUDES"
467   else
468     LIBS="-L$with_geotiff/lib -lgeotiff $LIBS"
469     EXTRA_INCLUDES="-I$with_geotiff/include $EXTRA_INCLUDES"
470   fi
471
472   echo "using libgeotiff from $with_geotiff."
473 fi
474
475 AC_SUBST(GEOTIFF_SETTING,$GEOTIFF_SETTING)
476
477 dnl ---------------------------------------------------------------------------
478 dnl Select a JPEG Library to use, or disable driver.
479 dnl ---------------------------------------------------------------------------
480
481 AC_ARG_WITH(jpeg,[  --with-jpeg[=ARG]       Include JPEG support (ARG=internal, no or path)],,)
482
483 if test "$with_jpeg" = "no" ; then
484
485   JPEG_SETTING=no
486
487   echo "jpeg support disabled."
488
489 elif test "$with_jpeg" = "yes" -o "$with_jpeg" = "" ; then
490
491   AC_CHECK_LIB(jpeg,jpeg_read_scanlines,JPEG_SETTING=external,JPEG_SETTING=internal,)
492   AC_CHECK_HEADERS(jpeglib.h)
493
494   if test "$JPEG_SETTING" = "external" -a "$ac_cv_header_jpeglib_h" = "no" ; then
495     JPEG_SETTING=internal
496   fi
497
498   if test "$JPEG_SETTING" = "external" -a "$TIFF_SETTING" = "internal" ; then
499     AC_MSG_CHECKING([for width_in_blocks in jpeglib.h])
500
501     rm -f conftest.c
502     echo '#include <stdio.h>' >> conftest.c
503     echo '#include "jpeglib.h"' >> conftest.c
504     echo 'int main() { jpeg_component_info *comptr=0; int i; i = comptr->width_in_blocks; }' >> conftest.c
505     if test -z "`${CC} -o conftest conftest.c 2>&1`" ; then
506       AC_MSG_RESULT([yes])
507     else
508       AC_MSG_RESULT([no])
509       JPEG_SETTING=internal
510     fi
511     rm -f conftest*
512   fi
513
514   if test "$JPEG_SETTING" = "external" ; then   
515     LIBS="-ljpeg $LIBS"
516     echo "using pre-installed libjpeg."
517   else
518     echo "using internal jpeg code."
519   fi
520
521 elif test "$with_jpeg" = "internal" ; then
522
523   JPEG_SETTING=internal
524
525   echo "using internal jpeg code."
526
527 else
528
529   JPEG_SETTING=external
530   LIBS="-L$with_jpeg -L$with_jpeg/lib -ljpeg $LIBS"
531   EXTRA_INCLUDES="-I$with_jpeg -I$with_jpeg/include $EXTRA_INCLUDES"
532
533   echo "using libjpeg from $with_jpeg."
534
535 fi
536
537 AC_SUBST(JPEG_SETTING,$JPEG_SETTING)
538
539 if test "$JPEG_SETTING" != "no" ; then
540   OPT_GDAL_FORMATS="jpeg $OPT_GDAL_FORMATS"
541 fi
542
543 dnl ---------------------------------------------------------------------------
544 dnl Select a GIF Library to use, or disable driver.
545 dnl ---------------------------------------------------------------------------
546
547 AC_ARG_WITH(gif,[  --with-gif[=ARG]        Include GIF support (ARG=internal, no or path)],,)
548
549 if test "$with_gif" = "no" ; then
550
551   GIF_SETTING=no
552
553   echo "gif support disabled."
554
555 elif test "$with_gif" = "yes" -o "$with_gif" = "" ; then
556
557   AC_CHECK_LIB(gif,DGifOpenFileName,GIF_SETTING=external,GIF_SETTING=internal,)
558
559   if test "$GIF_SETTING" = "external" ; then   
560     LIBS="-lgif $LIBS"
561     echo "using pre-installed libgif."
562   else
563     echo "using internal gif code."
564   fi
565
566 elif test "$with_gif" = "internal" ; then
567
568   GIF_SETTING=internal
569
570   echo "using internal gif code."
571
572 else
573
574   GIF_SETTING=external
575   LIBS="-L$with_gif -L$with_gif/lib -lgif $LIBS"
576   EXTRA_INCLUDES="-I$with_gif -I$with_gif/include $EXTRA_INCLUDES"
577
578   echo "using libgif from $with_gif."
579
580 fi
581
582 AC_SUBST(GIF_SETTING,$GIF_SETTING)
583
584 if test "$GIF_SETTING" != "no" ; then
585   OPT_GDAL_FORMATS="gif $OPT_GDAL_FORMATS"
586 fi
587
588 dnl ---------------------------------------------------------------------------
589 dnl Select an OGDI Library to use, or disable driver.
590 dnl ---------------------------------------------------------------------------
591
592 OGDI_INCLUDE=
593 export OGDI_INCLUDE
594
595 AC_ARG_WITH(ogdi,[  --with-ogdi[=ARG]       Include OGDI support (ARG=path)],,)
596
597 if test "$with_ogdi" = "no" ; then
598
599   HAVE_OGDI=no
600
601   echo "ogdi support disabled."
602
603 elif test "$with_ogdi" = "yes" -o "$with_ogdi" = "" ; then
604
605   AC_CHECK_LIB(ogdi31,cln_GetLayerCapabilities,HAVE_OGDI=yes,HAVE_OGDI=no,)
606
607   if test "$HAVE_OGDI" = "yes" ; then   
608     LIBS="-logdi31 $LIBS"
609   fi
610
611 else
612
613   HAVE_OGDI=yes
614   LIBS="-L$with_ogdi -L$with_ogdi/lib -logdi31 $LIBS"
615   OGDI_INCLUDE="-I$with_ogdi -I$with_ogdi/include"
616
617   echo "using libogdi31 from $with_ogdi."
618
619 fi
620
621 AC_SUBST(HAVE_OGDI,$HAVE_OGDI)
622 AC_SUBST(OGDI_INCLUDE,$OGDI_INCLUDE)
623
624 if test "$HAVE_OGDI" != "no" ; then
625   OPT_GDAL_FORMATS="ogdi $OPT_GDAL_FORMATS"
626 fi
627
628 dnl ---------------------------------------------------------------------------
629 dnl Select FME_HOME or disable FME support.
630 dnl ---------------------------------------------------------------------------
631
632 X_FME_HOME=
633 export X_FME_HOME
634
635 AC_ARG_WITH(fme,[  --with-fme[=ARG]        Include FMEObjects support (ARG=FME_HOME path)],,)
636
637 AC_MSG_CHECKING([for FMEObjects])
638
639 if test "$with_fme" = "no" ; then
640
641   AC_MSG_RESULT([disabled by user])
642
643 elif test "$with_fme" = "yes" ; then
644
645   if test "$FME_HOME" = "" ; then
646     AC_MSG_ERROR([no, FME_HOME not defined!])
647   elif test -f $FME_HOME/fmeobjects/cpp/isession.h ; then
648     AC_MSG_RESULT([yes])
649     X_FME_HOME=$FME_HOME
650   else
651     AC_MSG_ERROR([FME_HOME defined, but $FME_HOME/fmeobjects/cpp/issesion.h not found.])
652   fi
653    
654 elif test "$with_fme" = "" ; then
655
656   if test "$FME_HOME" = "" ; then
657     AC_MSG_RESULT([no])
658   elif test -f $FME_HOME/fmeobjects/cpp/isession.h ; then
659     AC_MSG_RESULT([yes])
660     X_FME_HOME=$FME_HOME
661   else
662     AC_MSG_RESULT([no, FME_HOME defined, but $FME_HOME/fmeobjects/cpp/issesion.h not found.])
663   fi
664    
665 else
666
667   if test -f $with_fme/fmeobjects/cpp/isession.h ; then
668     AC_MSG_RESULT([yes])
669     X_FME_HOME=$with_fme
670   else
671     AC_MSG_ERROR([$with_fme/fmeobjects/cpp/issesion.h not found!])
672   fi
673  
674 fi
675
676 AC_SUBST(X_FME_HOME,$X_FME_HOME)
677
678 dnl ---------------------------------------------------------------------------
679 dnl Select an HDF4 Library to use, or disable driver.
680 dnl
681 dnl We assume the user will have libjpeg and libz from other sources when
682 dnl linking against static HDF4 libraries.
683 dnl ---------------------------------------------------------------------------
684
685 HDF4_INCLUDE=
686 export HDF4_INCLUDE
687
688 AC_ARG_WITH(hdf4,[  --with-hdf4[=ARG]       Include HDF4 support (ARG=path)],,)
689
690 if test "$with_hdf4" = "no" ; then
691
692   HAVE_HDF4=no
693
694   echo "hdf4 support disabled."
695
696 elif test "$with_hdf4" = "yes" -o "$with_hdf4" = "" ; then
697
698   AC_CHECK_LIB(mfhdf,SDreaddata,HAVE_HDF4=yes,HAVE_HDF4=no,-ldf)
699
700   if test "$HAVE_HDF4" = "yes" ; then   
701     LIBS="-lmfhdf -ldf $LIBS"
702   fi
703
704 dnl Some Linux distros install hdf include files here.
705   if test "$HAVE_HDF4" = "yes" -a -r /usr/include/hdf/hdf.h ; then
706     HDF4_INCLUDE="-I/usr/include/hdf"
707   fi
708
709 else
710
711   if test -d $with_hdf4/lib ; then
712     HDF_LIB_DIR=$with_hdf4/lib
713   else
714     HDF_LIB_DIR=$with_hdf4
715   fi
716
717   ORIG_LIBS="$LIBS"
718   LIBS="-L$HDF_LIB_DIR $LIBS"
719
720   AC_CHECK_LIB(mfhdf,SDreaddata,HDF_LIB_NAME="-lmfhdf -ldf",HDF_LIB_NAME=missing,-ldf)
721   if test "$HDF_LIB_NAME" = "missing" ; then
722     AC_CHECK_LIB(hdf4,SDreaddata,HDF_LIB_NAME=-lhdf4,HDF_LIB_NAME=missing,)
723   fi
724
725 dnl Check again, with -ldf, -ljpeg and -lz this time.
726   if test "$HDF_LIB_NAME" = "missing" ; then
727     unset ac_cv_lib_mfhdf_SDreaddata
728     AC_CHECK_LIB(mfhdf,SDreaddata,HDF_LIB_NAME="-lmfhdf -ldf",HDF_LIB_NAME=missing,-ldf -ljpeg -lz)
729   fi
730
731 dnl Not found... again, with -lsz.
732   if test "$HDF_LIB_NAME" = "missing" ; then
733     unset ac_cv_lib_mfhdf_SDreaddata
734     AC_CHECK_LIB(mfhdf,SDreaddata,HDF_LIB_NAME="-lmfhdf -ldf -lsz",HDF_LIB_NAME=missing,-ldf -lsz -ljpeg -lz)
735   fi
736
737   if test "$HDF_LIB_NAME" = "missing" ; then
738     AC_MSG_ERROR([HDF4 support requested with arg $with_hdf4, but neither hdf4 nor mfhdf lib found])
739   fi
740
741   LIBS="-L$HDF_LIB_DIR $HDF_LIB_NAME $ORIG_LIBS"
742
743   if test -r "$with_hdf4/hdf/hdf.h" ; then
744     HDF4_INCLUDE="-I$with_hdf4/hdf"
745   elif test -r "$with_hdf4/include/hdf/hdf.h" ; then
746     HDF4_INCLUDE="-I$with_hdf4/include/hdf"
747   elif test -r "$with_hdf4/include/hdf.h" ; then
748     HDF4_INCLUDE="-I$with_hdf4/include"
749   elif test -r "$with_hdf4/hdf.h" ; then
750     HDF4_INCLUDE="-I$wHDF4_INCLUDEith_hdf4"
751   fi
752
753   HAVE_HDF4=yes
754 fi
755
756 AC_SUBST(HAVE_HDF4,$HAVE_HDF4)
757 AC_SUBST(HDF4_INCLUDE,$HDF4_INCLUDE)
758
759 if test "$HAVE_HDF4" != "no" ; then
760   OPT_GDAL_FORMATS="hdf4 $OPT_GDAL_FORMATS"
761 fi
762
763 dnl ---------------------------------------------------------------------------
764 dnl Select a JasPer Library to use, or disable driver.
765 dnl ---------------------------------------------------------------------------
766
767 AC_ARG_WITH(jasper,[  --with-jasper[=ARG]     Include JPEG-2000 support via JasPer library (ARG=path)],,)
768
769 if test "$with_jasper" = "no" ; then
770
771   HAVE_JASPER=no
772
773   AC_MSG_NOTICE([JasPer (JPEG2000) support disabled.])
774
775 elif test "$with_jasper" = "yes" -o "$with_jasper" = "" ; then
776
777   AC_CHECK_LIB(jasper,jpc_decode,HAVE_JASPER=yes,HAVE_JASPER=no,)
778   AC_CHECK_LIB(jasper,jp2_decode,HAVE_JASPER=yes,HAVE_JASPER=no,)
779   AC_CHECK_LIB(jasper,pgx_decode,HAVE_JASPER=yes,HAVE_JASPER=no,)
780
781   if test "$HAVE_JASPER" = "yes" ; then   
782     LIBS="-ljasper $LIBS"
783   fi
784 else
785
786   HAVE_JASPER=yes
787   LIBS="-L$with_jasper -L$with_jasper/lib -ljasper $LIBS"
788   EXTRA_INCLUDES="-I$with_jasper -I$with_jasper/include $EXTRA_INCLUDES"
789
790   AC_MSG_NOTICE([using JasPer library from $with_jasper.])
791 fi
792
793 if test "$HAVE_JASPER" != "no" ; then
794   OPT_GDAL_FORMATS="jpeg2000 $OPT_GDAL_FORMATS"
795  
796   dnl Test whether we have UUID JasPer hack
797
798   AC_CHECK_LIB(jasper,jp2_encode_uuid,HAVE_JASPER_UUID=yes,HAVE_JASPER_UUID=no,)
799
800   if test "$HAVE_JASPER_UUID" = "yes" ; then
801     AC_MSG_NOTICE([hacked JasPer version found (JasPer UUID), GeoJP2 enabled.])
802     JASPER_FLAGS=-DHAVE_JASPER_UUID
803   else
804     AC_MSG_NOTICE([hacked JasPer version not found, GeoJP2 disabled.])
805   fi
806 fi
807
808 AC_SUBST(HAVE_JASPER,$HAVE_JASPER)
809 AC_SUBST(JASPER_FLAGS,$JASPER_FLAGS)
810
811 dnl ---------------------------------------------------------------------------
812 dnl Select a ECW Library to use, or disable driver.
813 dnl ---------------------------------------------------------------------------
814
815 AC_ARG_WITH(ecw,[  --with-ecw[=ARG]        Include ECW support (ARG=ECW SDK Path, yes or no)],,)
816
817 if test "$with_ecw" = "no" ; then
818
819   ECW_SETTING=no
820
821   echo "ECW support disabled."
822
823 elif test "$with_ecw" = "yes" -o "$with_ecw" = "" ; then
824
825   AC_CHECK_LIB(NCSEcw,NCScbmOpenFileView,ECW_SETTING=yes,ECW_SETTING=no,)
826
827   if test "$ECW_SETTING" = "yes" ; then   
828     LIBS="-lNCSEcw $LIBS"
829   fi
830
831 else
832
833   AC_MSG_CHECKING([for libNCSEcw.so])
834   ECW_SETTING=yes
835   if test -r $with_ecw/lib/libNCSEcw.so ; then
836     LIBS="-L$with_ecw/lib -lNCSEcw $LIBS"
837     AC_MSG_RESULT([found in $with_ecw/lib.])
838   elif test -r $with_ecw/bin/libNCSEcw.so ; then
839     LIBS="-L$with_ecw/bin -lNCSEcw $LIBS"
840     AC_MSG_RESULT([found in $with_ecw/bin.])
841   else
842     AC_MSG_ERROR([not found in $with_ecw/lib or $with_ecw/bin.])
843   fi
844
845   AC_MSG_CHECKING([for NCSECWClient.h in $with_ecw/include])
846   if test -r $with_ecw/include/NCSECWClient.h ; then 
847     AC_MSG_RESULT([found.])
848     EXTRA_INCLUDES="-I$with_ecw/include $EXTRA_INCLUDES"
849   else
850     AC_MSG_ERROR([not found.])
851   fi
852 fi
853
854 AC_SUBST(ECW_SETTING,$ECW_SETTING)
855
856 if test "$ECW_SETTING" != "no" ; then
857   OPT_GDAL_FORMATS="ecw $OPT_GDAL_FORMATS"
858 fi
859
860 dnl ---------------------------------------------------------------------------
861 dnl Select Kakadu library or disable driver.
862 dnl ---------------------------------------------------------------------------
863
864 AC_MSG_CHECKING([for Kakadu JPEG2000 support])
865
866 AC_ARG_WITH(kakadu,[  --with-kakadu[=ARG]     Include Kakadu/JPEG2000 support],,)
867
868 if test "$with_kakadu" = "no" -o "$with_kakadu" = "" ; then
869   KAKDIR=
870   AC_MSG_RESULT([not requested.])
871   HAVE_KAKADU=no
872 elif test "$with_kakadu" = "yes" ; then
873   AC_MSG_ERROR([
874 For JPEG2000 support using Kakadu you need provide the path to the Kakadu
875 build directory.  Note that Kakadu is *not* free software.])
876 else
877   KAKDIR=$with_kakadu
878   OPT_GDAL_FORMATS="jp2kak $OPT_GDAL_FORMATS"
879   LIBS="$LIBS -lkdu"
880   AC_MSG_RESULT([requested.])
881   HAVE_KAKADU=yes
882 fi
883
884 AC_SUBST(KAKDIR,$KAKDIR)
885
886 dnl ---------------------------------------------------------------------------
887 dnl Select MrSID library or disable driver.
888 dnl ---------------------------------------------------------------------------
889
890 AC_ARG_WITH(mrsid,[  --with-mrsid[=ARG]      Include MrSID support (ARG=path to MrSID DSDK or no)],,)
891
892 if test "x$with_mrsid" = "xno"  -o "x$with_mrsid" = "x" ; then
893
894   HAVE_MRSID=no
895
896   AC_MSG_NOTICE([MrSID support disabled.])
897
898 else
899
900   AC_MSG_CHECKING([for MrSIDImage.h in $with_mrsid/include])
901   if test -r "$with_mrsid/include/MrSIDImage.h" ; then
902     AC_MSG_RESULT([found.])
903
904     HAVE_MRSID=yes
905     MRSID_INCLUDE="-I$with_mrsid/include"
906     LIBS="-lMrSIDDecode -llt_xTrans -lpthread $LIBS"
907     MRSID_FLAGS=-DMRSID_DSDK_VERSION_32
908
909     if test -r "$with_mrsid/bin/lib/libMrSIDDecode.a" ; then
910       LIBS="-L$with_mrsid/bin/lib $LIBS"
911     else
912       LIBS="-L$with_mrsid/lib $LIBS"
913     fi
914
915     AC_MSG_CHECKING([for lt_colorSpace.h in $with_mrsid/include])
916     if test -r "$with_mrsid/include/lt_colorSpace.h" ; then 
917       AC_MSG_RESULT([found MrSID DSDK version 3.1.x.])
918       MRSID_FLAGS=-DMRSID_DSDK_VERSION_31
919     else
920       AC_MSG_RESULT([not found.])
921     fi
922
923   else
924     AC_MSG_RESULT([not found.])
925
926     AC_MSG_CHECKING([for lt_base.h in $with_mrsid/include/support])
927     if test -r "$with_mrsid/include/support/lt_base.h" ; then
928       AC_MSG_RESULT([found MrSID DSDK version 4.0.x.])
929
930       HAVE_MRSID=yes
931       MRSID_INCLUDE="-I$with_mrsid/include/base -I$with_mrsid/include/metadata -I$with_mrsid/include/mrsid_readers -I$with_mrsid/include/j2k_readers -I$with_mrsid/include/support"
932       LIBS="-lltidsdk -lpthread $LIBS"
933
934       if test -r "$with_mrsid/lib/libltidsdk.a" ; then
935         LIBS="-L$with_mrsid/lib $LIBS"
936       else
937         LIBS="-L$with_mrsid/lib/Release $LIBS"
938       fi
939
940       AC_MSG_CHECKING([for MG3ImageWriter.h in $with_mrsid/include/mrsid_writers])
941       if test -r "$with_mrsid/include/mrsid_writers/MG3ImageWriter.h" ; then
942         AC_MSG_RESULT([found MrSID ESDK version 4.0.x.])
943         MRSID_FLAGS="-DMRSID_ESDK_VERSION_40 $MRSID_FLAGS"
944         MRSID_INCLUDE="-I$with_mrsid/include/mrsid_writers -I$with_mrsid/include/j2k_writers $MRSID_INCLUDE"
945         LIBS="-L$with_mrsid/3rd-party/lib/Release -lcryptopp -lltiesdk $LIBS"
946       fi
947
948     else
949       HAVE_MRSID=no
950       AC_MSG_ERROR([not found.])
951     fi
952   fi
953
954 fi
955
956 AC_SUBST(HAVE_MRSID,$HAVE_MRSID)
957 AC_SUBST(MRSID_INCLUDE,$MRSID_INCLUDE)
958 AC_SUBST(MRSID_FLAGS,$MRSID_FLAGS)
959
960 if test "$HAVE_MRSID" != "no" ; then
961   CPPFLAGS="-D_REENTRANT $CPPFLAGS"
962   OPT_GDAL_FORMATS="mrsid $OPT_GDAL_FORMATS"
963 fi
964
965 dnl ---------------------------------------------------------------------------
966
967 AC_ARG_WITH(bsb,[  --without-bsb         Disable BSB format (legal issues pending)],,)
968
969 if test "$with_bsb" = yes -o x"$with_bsb" = x ; then
970   echo checking for BSB ... enabled
971   OPT_GDAL_FORMATS="bsb $OPT_GDAL_FORMATS"
972 else
973   echo checking for BSB ... disabled by user
974 fi
975
976 dnl ---------------------------------------------------------------------------
977
978 AC_SUBST(OPT_GDAL_FORMATS,$OPT_GDAL_FORMATS)
979
980 dnl ---------------------------------------------------------------------------
981
982 AC_ARG_WITH(ogr,[  --without-ogr         Don't build OGR into shared library],,)
983
984 if test "$with_ogr" = yes -o x"$with_ogr" = x ; then
985   echo checking for OGR ... enabled
986   OGR_ENABLED=yes
987 else
988   echo checking for OGR ... disabled by user
989   OGR_ENABLED=no
990 fi
991 AC_SUBST(OGR_ENABLED,$OGR_ENABLED)
992
993 dnl ---------------------------------------------------------------------------
994 dnl Select an PostgreSQL Library to use, or disable driver.
995 dnl ---------------------------------------------------------------------------
996
997 PG_CONFIG=no
998
999 AC_ARG_WITH(pg,[  --with-pg[=ARG]         Include PostgreSQL OGR Support (ARG=path to pg_config)],,)
1000
1001 if test "$with_pg" = "yes" -o "$with_pg" = "" ; then
1002   AC_PATH_PROG(PG_CONFIG, pg_config, no)
1003 else
1004   PG_CONFIG=$with_pg
1005 fi
1006
1007 AC_MSG_CHECKING([for PostgreSQL])
1008
1009 if test "$PG_CONFIG" = "no" ; then
1010
1011   HAVE_PG=no
1012   PG_LIB=
1013   PG_INC=
1014
1015   AC_MSG_RESULT([no])LIBZ
1016
1017 else
1018   if test -d $PG_CONFIG ; then
1019       AC_MSG_RESULT([no])
1020       AC_MSG_ERROR([--with-pg argument is a directory.  It should be the path to the pg_config script, often somewhere like /usr/local/pgsql/bin/pg_config.])
1021   fi
1022
1023   if test \! -x $PG_CONFIG ; then
1024       AC_MSG_RESULT([no])
1025       AC_MSG_ERROR([--with-pg argument is a not an executable file.  It should be the path to the pg_config script, often somewhere like /usr/local/pgsql/bin/pg_config.])
1026   fi
1027
1028   HAVE_PG=yes
1029   PG_LIB="-L`$PG_CONFIG --libdir` -lpq"
1030   PG_INC="-I`$PG_CONFIG --includedir`"
1031
1032   AC_MSG_RESULT([yes])
1033
1034 fi
1035
1036 AC_SUBST(HAVE_PG,$HAVE_PG)
1037 AC_SUBST(PG_INC,$PG_INC)
1038 AC_SUBST(PG_LIB,$PG_LIB)
1039
1040 dnl ---------------------------------------------------------------------------
1041 dnl Select an MySQL Library to use, or disable driver.
1042 dnl ---------------------------------------------------------------------------
1043
1044 MYSQL_CONFIG=no
1045
1046 AC_ARG_WITH(pg,[  --with-mysql[=ARG]      Include MySQL (ARG=path to mysql_config)],,)
1047
1048 if test "$with_mysql" = "yes" -o "$with_mysql" = "" ; then
1049   AC_PATH_PROG(MYSQL_CONFIG, mysql_config, no)
1050 else
1051   MYSQL_CONFIG=$with_mysql
1052 fi
1053
1054 AC_MSG_CHECKING([for MySQL])
1055
1056 if test "$MYSQL_CONFIG" = "no" ; then
1057
1058   HAVE_MYSQL=no
1059   MYSQL_LIB=
1060   MYSQL_INC=
1061
1062   AC_MSG_RESULT([no])
1063
1064 else
1065   if test -d $MYSQL_CONFIG ; then
1066       AC_MSG_RESULT([no])
1067       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.])
1068   fi
1069
1070   if test \! -x $MYSQL_CONFIG ; then
1071       AC_MSG_RESULT([no])
1072       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.])
1073   fi
1074
1075   HAVE_MYSQL=yes
1076   MYSQL_LIB="`$MYSQL_CONFIG --libs`"
1077   MYSQL_INC="`$MYSQL_CONFIG --include`"
1078
1079   AC_MSG_RESULT([yes])
1080
1081 fi
1082
1083 AC_SUBST(HAVE_MYSQL,$HAVE_MYSQL)
1084 AC_SUBST(MYSQL_INC,$MYSQL_INC)
1085 AC_SUBST(MYSQL_LIB,$MYSQL_LIB)
1086
1087 dnl ---------------------------------------------------------------------------
1088 dnl Check for xerces configuration.
1089 dnl ---------------------------------------------------------------------------
1090
1091 HAVE_XERCES=no
1092
1093 AC_MSG_CHECKING([for Xerces C++])
1094
1095 AC_ARG_WITH(xerces,[  --with-xerces         Include Xerces C++ XML Parser support (for GML)],,)
1096 AC_ARG_WITH(xerces_inc,[  --with-xerces-inc=dir Xerces C++ include directory],,)
1097 AC_ARG_WITH(xerces_lib,
1098 [  --with-xerces-lib=opts Xerces C++ link option(s)
1099                              ie. -L/usr/local/lib -lxerces-c1_6_0 -lpthread],,)
1100
1101 if test "$with_xerces" = "" -o "$with_xerces" = "no" ; then
1102
1103   AC_MSG_RESULT([disabled])
1104
1105 else
1106
1107   if test "$with_xerces" = "yes" ; then
1108     if test -d /usr/local/include/xercesc ; then
1109       with_xerces=/usr/local
1110     else
1111       with_xerces=/usr
1112     fi
1113   fi
1114
1115   if test "$with_xerces_lib" != "" ; then
1116     LIBS="$with_xerces_lib $LIBS"
1117   else
1118     if test -f $with_xerces/lib/libxerces-c.so ; then
1119       LIBS="-L$with_xerces/lib -lxerces-c -lpthread $LIBS"
1120     elif test -f $with_xerces/lib/libxerces-c1_6_0.so ; then
1121       LIBS="-lxerces-c1_6_0 -lpthread $LIBS"
1122       LIBS="-L$with_xerces/lib $LIBS"
1123     else
1124       LIBS="-L$with_xerces/lib -lxerces-c -lpthread $LIBS"
1125     fi
1126   fi
1127   if test "$with_xerces_inc" != "" ; then
1128     XERCES_INCLUDE="-I$with_xerces_inc -I$with_xerces_inc/xercesc"
1129   else
1130     XERCES_INCLUDE="-I$with_xerces/include -I$with_xerces/include/xercesc"
1131   fi
1132
1133   echo '#include <util/PlatformUtils.hpp>' > conftest.cpp
1134   echo '#ifdef XERCES_CPP_NAMESPACE_USE' >> conftest.cpp
1135   echo 'XERCES_CPP_NAMESPACE_USE' >> conftest.cpp
1136   echo '#endif' >> conftest.cpp
1137   echo 'int main() {  XMLPlatformUtils::Initialize(); }' >> conftest.cpp
1138   CMD="${CXX} ${XERCES_INCLUDE} ${CPPFLAGS} -o conftest conftest.cpp $LIBS"
1139
1140   if test -z "`$CMD 2>&1`" ; then
1141     HAVE_XERCES=yes
1142     AC_MSG_RESULT([yes])
1143   else
1144     AC_MSG_RESULT([requested, but compile or link fails!])
1145
1146     echo
1147     echo $CMD
1148     echo
1149     $CMD
1150     echo
1151    
1152     AC_MSG_ERROR([Please correct Xerces options, or don't enable Xerces.])
1153   fi
1154   rm -f conftest*
1155
1156 fi
1157
1158 AC_SUBST(HAVE_XERCES,$HAVE_XERCES)
1159 AC_SUBST(XERCES_INCLUDE,$XERCES_INCLUDE)
1160
1161 dnl ---------------------------------------------------------------------------
1162 dnl Check for ODBC support.
1163 dnl ---------------------------------------------------------------------------
1164
1165 AC_ARG_WITH(odbc,[  --with-odbc[=ARG]       Include ODBC support (ARG=no or path)],,)
1166
1167 if test "$with_odbc" = "no" ; then
1168
1169   ODBC_SETTING=no
1170
1171   echo "ODBC support disabled."
1172
1173 elif test "$with_odbc" = "yes" -o "$with_odbc" = "" ; then
1174
1175   AC_CHECK_LIB(odbc,SQLConnect,ODBC_SETTING=yes,ODBC_SETTING=no,)
1176
1177   if test "$ODBC_SETTING" = "yes" ; then
1178     if test -f /usr/local/include/sql.h -o -f /usr/include/sql.h ; then
1179       ODBC_SETTING=yes
1180     else
1181       echo "odbc library found, but sql.h missing, ODBC support disabled."
1182       ODBC_SETTING=no
1183     fi
1184   fi
1185
1186   if test "$ODBC_SETTING" = "yes"  ; then   
1187     LIBS="-lodbc $LIBS"
1188   fi
1189
1190 else
1191
1192   ODBC_SETTING=yes
1193   LIBS="-L$with_odbc -L$with_odbc/lib -lodbc $LIBS"
1194   EXTRA_INCLUDES="-I$with_odbc -I$with_odbc/include $EXTRA_INCLUDES"
1195
1196   echo "using odbc library from $with_odbc."
1197 fi
1198
1199 AC_SUBST(ODBC_SETTING,$ODBC_SETTING)
1200
1201 dnl ---------------------------------------------------------------------------
1202 dnl Check for OCI support.
1203 dnl ---------------------------------------------------------------------------
1204
1205 AC_ARG_WITH(oci,[  --with-oci=ARG        Include OCI (Oracle) support (ARG=no or path)],,)
1206
1207 if test "$with_oci" = "no" ; then
1208
1209   HAVE_OCI=no
1210
1211   AC_MSG_RESULT([OCI support disabled.])
1212 elif  test "$with_oci" = "yes" -o "$with_oci" = "" ; then
1213
1214   AC_CHECK_LIB(clntsh,OCIBindByName,HAVE_OCI=yes,HAVE_OCI=no,)
1215
1216   if test "$HAVE_OCI" = "yes" ; then
1217     AC_MSG_RESULT([using pre-installed libclntsh])
1218   fi
1219 else
1220
1221   HAVE_OCI=yes
1222   ORACLE_HOME="$with_oci"
1223   OCI_INCLUDE="-I$ORACLE_HOME/rdbms/demo -I$ORACLE_HOME/rdbms/public"
1224   LIBS="-L$ORACLE_HOME/lib $LIBS"
1225
1226   AC_MSG_RESULT([using OCI library from $with_oci])
1227 fi
1228
1229 if test "$HAVE_OCI" = "yes" ; then
1230   LIBS="-lclntsh $LIBS"
1231 fi
1232
1233 AC_SUBST(HAVE_OCI,$HAVE_OCI)
1234 AC_SUBST(OCI_INCLUDE,$OCI_INCLUDE)
1235
1236 dnl ---------------------------------------------------------------------------
1237 dnl Check for DODS.
1238 dnl ---------------------------------------------------------------------------
1239
1240 HAVE_DODS=no
1241
1242 AC_MSG_CHECKING(Checking for DODS)
1243 AC_ARG_WITH(dods_root,
1244     [  --with-dods-root[=ARG]  Include DODS support (ARG=no or absolute path)],
1245     ,,)
1246
1247 if test -z "$with_dods_root" -o "$with_dods_root" = "no"; then
1248     AC_MSG_RESULT(disabled)
1249 else
1250     DODS_LIB=$with_dods_root/lib
1251     DODS_INC=$with_dods_root/include
1252     DODS_BIN=$with_dods_root/bin
1253
1254     dnl Add the DODS libraries to LIBS
1255     if test -x $DODS_BIN/opendap-config ; then
1256       dnl OPeNDAP 3.4 and earlier lack opendap-config, but use it if avail.
1257       LIBS="$LIBS `$DODS_BIN/opendap-config --libs`"
1258     else
1259       dnl Otherwise try to put things together in a more primitive way.
1260       LIBS="$LIBS -L$DODS_LIB -ldap++ -lpthread -lrx"
1261    
1262       dnl Add curl to LIBS; it might be local to DODS or generally installed
1263       if test -x $DODS_BIN/curl-config; then
1264           LIBS="$LIBS  `$DODS_BIN/curl-config --libs`"
1265       elif which curl-config > /dev/null 2>&1; then
1266           LIBS="$LIBS  `curl-config --libs`"
1267       else
1268           AC_MSG_ERROR([You gave a dods root, but I can't find curl!])
1269       fi
1270
1271       if test -x $DODS_BIN/xml2-config; then
1272           LIBS="$LIBS `$DODS_BIN/xml2-config --libs`"
1273       elif which xml2-config > /dev/null 2>&1; then
1274           LIBS="$LIBS  `xml2-config --libs`"
1275       else
1276           AC_MSG_ERROR([You gave a dods root, but I can't find xml2!])
1277       fi
1278     fi
1279
1280     OPT_GDAL_FORMATS="dods $OPT_GDAL_FORMATS"
1281     DODSDEF=-DFRMT_dods
1282     AC_MSG_RESULT(setting DODS root directory to $with_dods_root)
1283     HAVE_DODS=yes
1284 fi
1285
1286 dnl This is used by the GNUmakefile in frmts/dods (via GDALmake.opt)
1287 AC_SUBST(DODS_INC)
1288
1289 dnl ---------------------------------------------------------------------------
1290 dnl Check for SQLite.
1291 dnl ---------------------------------------------------------------------------
1292
1293 HAVE_SQLITE=no
1294
1295 AC_MSG_CHECKING(Checking for SQLite)
1296 AC_ARG_WITH(sqlite,
1297     [  --with-sqlite[=ARG]     Include SQLite support (ARG=no or absolute path)],
1298     ,,)
1299    
1300 if test -z "$with_sqlite" -o "$with_sqlite" = "no"; then
1301     AC_MSG_RESULT(disabled)
1302 else
1303     if test "$with_sqlite" = "yes" ; then
1304         LIBS="$LIBS -lsqlite3"
1305         SQLITE_INC=""
1306         AC_MSG_RESULT(enabled)
1307     else