Writing a Module for Hyrax
From OPeNDAP Documentation
⧼opendap2-jumptonavigation⧽
Other guides:
Autoconf documentation: http://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/html_node/index.html#Top
Including the library ...
It's often easiest for people building from source code if the data access API used by the handler is included in the source.
Support three options:
- using --enable-local-API
- using --with-API-prefix
- finding a copy installed on the build OS
Here's how
GDAL_FOUND=
AC_ARG_WITH(gdal,[ AS_HELP_STRING ([--with-gdal], [Use the copy of GDAL at this location]) ])
# with_gdal_prefix="$withval", with_gdal_prefix="")
if test -n "$with_gdal_prefix" -a -x $with_gdal_prefix/bin/gdal-config
then
AC_MSG_NOTICE([Using $with_gdal_prefix as the GDAL prefix directory.])
GDAL_LDFLAGS="`$with_gdal_prefix/bin/gdal-config --libs`"
GDAL_CFLAGS="`$with_gdal_prefix/bin/gdal-config --cflags`"
GDAL_FOUND="yes"
elif test -n "$with_gdal_prefix"
then
AC_MSG_ERROR([You set the gdal-prefix directory to $with_gdal_prefix, but gdal-config is not there.])
fi
AC_ARG_ENABLE(local-gdal, [ AS_HELP_STRING ([--enable_local-gdal], [Build and use the local copy of GDAL]) ])
AC_MSG_NOTICE([enable_local_gdal: >$enable_local_gdal<])
if test -n "$enable_local_gdal" -a "$enable_local_gdal" = "yes"
then
AC_MSG_NOTICE([Building the local GDAL library.])
gdal_prx=`pwd`/gdal-1.9.1/build
if (cd gdal-1.9.1 && ./configure --prefix=$gdal_prx --disable-shared && make -j9 && make install)
then
GDAL_LDFLAGS="`$gdal_prx/bin/gdal-config --libs`"
GDAL_CFLAGS="`$gdal_prx/bin/gdal-config --cflags`"
AC_SUBST([GDAL_LDFLAGS])
AC_SUBST([GDAL_CFLAGS])
GDAL_FOUND="yes"
# AC_MSG_NOTICE(["GDAL_LDFLAGS status >$GDAL_LDFLAGS<"])
# AC_MSG_NOTICE(["GDAL_CFLAGS status >$GDAL_CFLAGS<"])
else
AC_MSG_ERROR([I could not build GDAL.])
fi
fi
if test -z "$GDAL_FOUND"
then
AX_LIB_GDAL([1.7.2])
if test ! -z "$GDAL_CFLAGS" -a ! -z "$GDAL_LDFLAGS"; then
GDAL_FOUND="yes"
fi
fi
if test -z "$GDAL_FOUND"
then
AC_MSG_ERROR([I could not find GDAL.])
fi