From 6933f75b11a0013db3f11f7da5cf48a87be2f75c Mon Sep 17 00:00:00 2001 From: Ralf Gerlich Date: Fri, 9 Nov 2007 16:32:44 +0100 Subject: [PATCH] Cleaned up the autoconf GDAL/OGR detection. --- .gitignore | 18 +++++++++++++ autogen.sh | 0 configure.ac | 61 ++++++++++++++++++++++++-------------------- src/Prep/Makefile.am | 7 +++-- 4 files changed, 57 insertions(+), 29 deletions(-) create mode 100644 .gitignore mode change 100644 => 100755 autogen.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..ddecb497 --- /dev/null +++ b/.gitignore @@ -0,0 +1,18 @@ +Makefile +Makefile.in +.deps +*.o +*.a +COPYING +INSTALL +VERSION +aclocal.m4 +autom4te.cache +config.guess +config.log +config.status +config.sub +configure +depcomp +install-sh +missing diff --git a/autogen.sh b/autogen.sh old mode 100644 new mode 100755 diff --git a/configure.ac b/configure.ac index 8d9f6951..1807ddcb 100644 --- a/configure.ac +++ b/configure.ac @@ -101,54 +101,59 @@ AC_ARG_WITH(sgi-opengl, [ --with-sgi-opengl Build against SGI's opengl.dl AC_DEFINE([HAVE_OGR],[],[Use OGR]) AC_ARG_WITH(gdal, -[ --with-gdal[=path/gdal-config] enable GDAL/OGR support (gdal-config with path, \ -e.g. '--with-gdal=/usr/local/bin/gdal-config')]) + AC_HELP_STRING([--with-gdal[=path/gdal-config]], + [enable GDAL/OGR support (gdal-config with path, + e.g. '--with-gdal=/usr/local/bin/gdal-config', + default: enabled if gdal-config is in PATH)])) -AC_MSG_CHECKING(whether to use GDAL) +AC_ARG_ENABLE(ogrdecode, + AC_HELP_STRING([--disable-ogrdecode], + [enable ogrdecode tool (default depending on OGR availability)])) -if test "`basename xx/$with_gdal`" = "gdal-config" ; then - GDAL_CONFIG="$with_gdal" - AC_MSG_RESULT(yes) -fi - -if test "$with_gdal" = "no" ; then - AC_MSG_RESULT(no) -else - AC_MSG_RESULT(yes) - AC_PATH_PROG(GDAL_CONFIG, gdal-config, no) - - if test "$GDAL_CONFIG" = "no" ; then - AC_MSG_ERROR([*** couldn't find gdal-config]) +if test "$with_gdal" != "no" ; then + if test "`basename xx/$with_gdal`" = "gdal-config" ; then + # gdal-config was specified + GDAL_CONFIG="$with_gdal" + with_gdal="yes" + else + # gdal-config was not specified, but GDAL/OGR wasn't disabled + AC_PATH_PROG(GDAL_CONFIG, gdal-config, no) + if test "$GDAL_CONFIG" = "no" ; then + with_gdal="no" + fi fi GDAL_LIBS= GDAL_CFLAGS= USE_GDAL= USE_OGR= - - if test "$GDAL_CONFIG" != "" ; then + + AC_MSG_CHECKING([for GDAL...]) + if test -x "$GDAL_CONFIG"; then + AC_MSG_RESULT(yes) GDAL_LIBS=`"$GDAL_CONFIG" --libs` GDAL_DEP_LIBS=`"$GDAL_CONFIG" --dep-libs` GDAL_CFLAGS=`"$GDAL_CONFIG" --cflags` - USE_GDAL=1 + have_gdal=yes + AC_MSG_CHECKING([for OGR...]) if test `"$GDAL_CONFIG" --ogr-enabled` = "yes" ; then - AC_DEFINE(HAVE_OGR) - USE_OGR=1 + AC_MSG_RESULT(yes) + have_ogr=yes + else + AC_MSG_RESULT(no) fi + else + AC_MSG_RESULT(no) fi GDAL_LIBS="$GDAL_LIBS $GDAL_DEP_LIBS" - if test "$USE_OGR" = "1"; then - OGR_DECODE=OGRDecode - fi AC_SUBST(GDAL_LIBS) AC_SUBST(GDAL_CFLAGS) - AC_SUBST(USE_GDAL) - AC_SUBST(USE_OGR) - AC_SUBST(OGR_DECODE) fi +AM_CONDITIONAL(WANT_OGRDECODE, test x$have_ogr = xyes -a x$enable_ogrdecode != xno) + dnl Check for MS Windows environment AC_CHECK_HEADER(windows.h) @@ -497,3 +502,5 @@ if test "x$ac_cv_header_newmat_newmat_h" != "xyes"; then echo "Please see README.newmat for more details." echo fi + +dnl :mode=text:indentSize=2: diff --git a/src/Prep/Makefile.am b/src/Prep/Makefile.am index e4e2ffd1..12b55ce0 100644 --- a/src/Prep/Makefile.am +++ b/src/Prep/Makefile.am @@ -12,7 +12,10 @@ SUBDIRS = \ Terra \ TerraFit \ Tower \ - UserDef \ - $(OGR_DECODE) + UserDef + +if WANT_OGRDECODE + SUBDIRS+=OGRDecode +endif EXTRA_SUBDIRS=OGRDecode