1
0
Fork 0

Cleaned up the autoconf GDAL/OGR detection.

This commit is contained in:
Ralf Gerlich 2007-11-09 16:32:44 +01:00
parent 01f5b80457
commit 6933f75b11
4 changed files with 57 additions and 29 deletions

18
.gitignore vendored Normal file
View file

@ -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

0
autogen.sh Normal file → Executable file
View file

View file

@ -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_DEFINE([HAVE_OGR],[],[Use OGR])
AC_ARG_WITH(gdal, AC_ARG_WITH(gdal,
[ --with-gdal[=path/gdal-config] enable GDAL/OGR support (gdal-config with path, \ AC_HELP_STRING([--with-gdal[=path/gdal-config]],
e.g. '--with-gdal=/usr/local/bin/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 if test "$with_gdal" != "no" ; then
GDAL_CONFIG="$with_gdal" if test "`basename xx/$with_gdal`" = "gdal-config" ; then
AC_MSG_RESULT(yes) # gdal-config was specified
fi GDAL_CONFIG="$with_gdal"
with_gdal="yes"
if test "$with_gdal" = "no" ; then else
AC_MSG_RESULT(no) # gdal-config was not specified, but GDAL/OGR wasn't disabled
else AC_PATH_PROG(GDAL_CONFIG, gdal-config, no)
AC_MSG_RESULT(yes) if test "$GDAL_CONFIG" = "no" ; then
AC_PATH_PROG(GDAL_CONFIG, gdal-config, no) with_gdal="no"
fi
if test "$GDAL_CONFIG" = "no" ; then
AC_MSG_ERROR([*** couldn't find gdal-config])
fi fi
GDAL_LIBS= GDAL_LIBS=
GDAL_CFLAGS= GDAL_CFLAGS=
USE_GDAL= USE_GDAL=
USE_OGR= 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_LIBS=`"$GDAL_CONFIG" --libs`
GDAL_DEP_LIBS=`"$GDAL_CONFIG" --dep-libs` GDAL_DEP_LIBS=`"$GDAL_CONFIG" --dep-libs`
GDAL_CFLAGS=`"$GDAL_CONFIG" --cflags` GDAL_CFLAGS=`"$GDAL_CONFIG" --cflags`
USE_GDAL=1 have_gdal=yes
AC_MSG_CHECKING([for OGR...])
if test `"$GDAL_CONFIG" --ogr-enabled` = "yes" ; then if test `"$GDAL_CONFIG" --ogr-enabled` = "yes" ; then
AC_DEFINE(HAVE_OGR) AC_MSG_RESULT(yes)
USE_OGR=1 have_ogr=yes
else
AC_MSG_RESULT(no)
fi fi
else
AC_MSG_RESULT(no)
fi fi
GDAL_LIBS="$GDAL_LIBS $GDAL_DEP_LIBS" GDAL_LIBS="$GDAL_LIBS $GDAL_DEP_LIBS"
if test "$USE_OGR" = "1"; then
OGR_DECODE=OGRDecode
fi
AC_SUBST(GDAL_LIBS) AC_SUBST(GDAL_LIBS)
AC_SUBST(GDAL_CFLAGS) AC_SUBST(GDAL_CFLAGS)
AC_SUBST(USE_GDAL)
AC_SUBST(USE_OGR)
AC_SUBST(OGR_DECODE)
fi fi
AM_CONDITIONAL(WANT_OGRDECODE, test x$have_ogr = xyes -a x$enable_ogrdecode != xno)
dnl Check for MS Windows environment dnl Check for MS Windows environment
AC_CHECK_HEADER(windows.h) 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 "Please see README.newmat for more details."
echo echo
fi fi
dnl :mode=text:indentSize=2:

View file

@ -12,7 +12,10 @@ SUBDIRS = \
Terra \ Terra \
TerraFit \ TerraFit \
Tower \ Tower \
UserDef \ UserDef
$(OGR_DECODE)
if WANT_OGRDECODE
SUBDIRS+=OGRDecode
endif
EXTRA_SUBDIRS=OGRDecode EXTRA_SUBDIRS=OGRDecode