patches for build system
Patrice Dumas
pertusus at FREE.FR
Mon Aug 15 18:07:10 EDT 2005
Hi,
I don't know where the development of grads is discussed, so I try here.
I have a patche that allows for a better detection of DODS/opendap:
acinclude.m4:
* better quoting of GA_CHECK_LIB
* add $ before {ga_supplib_dir}
configure.in:
* if dods isn't detected with GA_CHECK_DODS, then use the AC_CHECK_NC_DODS
macro to find libnc-dap
It should be used with the attached m4 files libdap.m4 and libnc-dap.m4 that
should find a wide range of opendap versions and define AC_CHECK_NC_DODS.
I hope that these file will appear in a future release of libdap/libnc-dap.
--
Pat
-------------- next part --------------
diff -u --recursive -x Makefile.in -x configure -x aclocal.m4 grads-1.9b4-orig/acinclude.m4 grads-1.9b4-configure/acinclude.m4
--- grads-1.9b4-orig/acinclude.m4 2003-10-02 16:01:15.000000000 +0200
+++ grads-1.9b4-configure/acinclude.m4 2005-08-12 08:33:26.000000000 +0200
@@ -165,10 +165,10 @@
dnl enabled, just calls AC_CHECK_LIB. If not, checks for the presence
dnl of a file "libname.a" in the supplibs directory.
dnl args: library-name, extra-libs, action-if-found, action-if-not-found
-AC_DEFUN(GA_CHECK_LIB,
+AC_DEFUN([GA_CHECK_LIB],
[
if test "${ga_dyn_supplibs}" = "yes" ; then
- AC_CHECK_LIB($1, $2, $3, $4)
+ AC_CHECK_LIB([$1], [$2], [$3], [$4])
else
AC_MSG_CHECKING([for lib$1.a in supplibs])
if test -f "${ga_supplib_dir}/lib/lib$1.a" ; then
@@ -324,7 +324,7 @@
AC_DEFUN(GA_CHECK_NC,
[
# Check libs and headers for netCDF support
- GA_SET_FLAGS([-I{ga_supplib_dir}/include/nc])
+ GA_SET_FLAGS([-I${ga_supplib_dir}/include/nc])
ga_check_nc="no"
AC_CHECK_HEADER(udunits.h,
@@ -356,7 +356,7 @@
AC_DEFUN(GA_CHECK_HDF,
[
# Check libs and headers for HDF support
- GA_SET_FLAGS([-I{ga_supplib_dir}/include/hdf])
+ GA_SET_FLAGS([-I${ga_supplib_dir}/include/hdf])
ga_check_hdf="no"
AC_CHECK_HEADER(udunits.h,
@@ -394,7 +394,7 @@
AC_DEFUN(GA_CHECK_DODS,
[
# Check libs and headers for DODS support
- GA_SET_FLAGS([-I{ga_supplib_dir}/include/dods])
+ GA_SET_FLAGS([-I${ga_supplib_dir}/include/dods])
ga_check_dods="no"
AC_CHECK_HEADER(udunits.h,
diff -u --recursive -x Makefile.in -x configure -x aclocal.m4 grads-1.9b4-orig/configure.in grads-1.9b4-configure/configure.in
--- grads-1.9b4-orig/configure.in 2005-05-23 17:04:40.000000000 +0200
+++ grads-1.9b4-configure/configure.in 2005-08-12 14:40:35.000000000 +0200
@@ -383,15 +383,25 @@
use_dods=no
+dods_ncdap=no
if test "$with_dods" != "no" ; then
GA_CHECK_DODS([use_dods=yes])
+ if test "z$use_dods" = "zno" -a "${ga_dyn_supplibs}" = "yes" ; then
+ AC_CHECK_HEADER([udunits.h],
+ [ AC_CHECK_HEADER([netcdf.h],
+ [ GA_CHECK_LIB([udunits], [utInit],
+ [AC_CHECK_NC_DODS([dods_ncdap=yes; use_dods=yes])])
+ ])
+ ])
+ fi
fi
if test $use_dods = "yes" ; then
extra_bins="$extra_bins gradsdods"
- GA_SET_LIB_VAR(dods_libs, [udunits www rx z])
-
+ if test "z$dods_ncdap" = "zno" ; then
+ GA_SET_LIB_VAR(dods_libs, [udunits www rx z])
+ fi
GA_CHECK_LIB(gadods, main, [use_gadods=yes], [use_gadods=no])
if test $use_gadods = "yes" ; then
@@ -404,7 +414,11 @@
echo "+ gradsdods (OPeNDAP/netCDF) build enabled - gridded interface only"
fi
- dods_libs="$dods_rep_libs $dods_rep_libs $dods_libs"
+ if test "z$dods_ncdap" = "zyes" ; then
+ dods_libs="$NC_DAP_LIBS -ludunits"
+ else
+ dods_libs="$dods_rep_libs $dods_rep_libs $dods_libs"
+ fi
AC_SUBST(dods_libs)
AC_SUBST(gadods_def)
else
-------------- next part --------------
# Configure macros for Libdap
# Patrice Dumas 2005 based on freetype2.m4 from Marcelo Magallon 2001-10-26,
# based on gtk.m4 by Owen Taylor
# AC_CHECK_DODS is also based on code from gdal configure.in
# AC_CHECK_LIBDAP([MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
# Test for Libdap and define DAP_CFLAGS and DAP_LIBS.
# Check that the version is above MINIMUM-VERSION
# use when linking with a c++ aware linker, with a c linker you may also
# need -lstdc++
AC_DEFUN([AC_CHECK_LIBDAP],
[
AC_PATH_PROG([DAP_CONFIG], [dap-config], [no])
dap_min_version=m4_if([$1], [], [3.5.0], [$1])
AC_MSG_CHECKING([for libdap version >= $dap_min_version])
dap_no=""
if test "$DAP_CONFIG" = "no" ; then
dap_no=yes
else
dap_config_major_version=`$DAP_CONFIG --version | sed 's/^libdap \([[0-9]]\)*\.\([[0-9]]*\)\.\([[0-9]]*\)$/\1/'`
dap_config_minor_version=`$DAP_CONFIG --version | sed 's/^libdap \([[0-9]]\)*\.\([[0-9]]*\)\.\([[0-9]]*\)$/\2/'`
dap_config_micro_version=`$DAP_CONFIG --version | sed 's/^libdap \([[0-9]]\)*\.\([[0-9]]*\)\.\([[0-9]]*\)$/\2/'`
dap_min_major_version=`echo $dap_min_version | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
dap_min_minor_version=`echo $dap_min_version | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
dap_min_micro_version=`echo $dap_min_version | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
dap_config_is_lt=""
if test $dap_config_major_version -lt $dap_min_major_version ; then
dap_config_is_lt=yes
else
if test $dap_config_major_version -eq $dap_min_major_version ; then
if test $dap_config_minor_version -lt $dap_min_minor_version ; then
dap_config_is_lt=yes
else
if test $dap_config_minor_version -eq $dap_min_minor_version ; then
if test $dap_config_micro_version -lt $dap_min_micro_version ; then
dap_config_is_lt=yes
fi
fi
fi
fi
fi
if test x$dap_config_is_lt = xyes ; then
dap_no=yes
else
DAP_LIBS="`$DAP_CONFIG --libs`"
DAP_CFLAGS="`$DAP_CONFIG --cflags`"
fi
fi
if test x$dap_no = x ; then
AC_MSG_RESULT([yes])
m4_if([$2], [], [:], [$2])
else
AC_MSG_RESULT([no])
if test "$DAP_CONFIG" = "no" ; then
AC_MSG_NOTICE([The dap-config script could not be found.])
else
if test x$dap_config_is_lt = xyes ; then
AC_MSG_NOTICE([the installed libdap library is too old.])
fi
fi
DAP_LIBS=""
DAP_CFLAGS=""
m4_if([$3], [], [:], [$3])
fi
AC_SUBST([DAP_CFLAGS])
AC_SUBST([DAP_LIBS])
])
# AC_CHECK_DODS([ ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
# Test for Libdap or older versions. Define DAP_CFLAGS and DAP_LIBS and
# optionnaly DAP_ROOT
AC_DEFUN([AC_CHECK_DODS],
[
AC_ARG_WITH(dods_root,
[ --with-dods-root[=ARG] DODS root fallback ],
,,)
ac_dods_ok='no'
AC_CHECK_LIBDAP([],[ac_dods_ok='yes'],[ac_dods_ok='no'])
if test "z$ac_dods_ok" = "zno" ; then
AC_PATH_PROG([OPENDAP_CONFIG], [opendap-config], [no])
AC_MSG_CHECKING([for libdap with opendap-config])
if test "$OPENDAP_CONFIG" = "no" ; then
ac_dods_ok='no'
AC_MSG_RESULT([no])
else
DAP_LIBS="`$OPENDAP_CONFIG --libs`"
DAP_CFLAGS="`$OPENDAP_CONFIG --cflags`"
ac_dods_ok='yes'
AC_MSG_RESULT([yes])
fi
fi
DAP_ROOT=
if test "z$ac_dods_ok" = "zno" ; then
AC_MSG_CHECKING(DODS specific root)
if test -z "$with_dods_root" -o "$with_dods_root" = "no"; then
AC_MSG_RESULT(disabled)
else
AC_MSG_RESULT([$with_dods_root])
DODS_ROOT=$with_dods_root
DODS_LIB=$with_dods_root/lib
DODS_INC=$with_dods_root/include
DODS_BIN=$with_dods_root/bin
dnl Add the DODS libraries to LIBS
if test -x $DODS_BIN/opendap-config ; then
dnl OPeNDAP 3.4 and earlier lack opendap-config, but use it if avail.
DAP_LIBS="`$DODS_BIN/opendap-config --libs`"
DAP_CFLAGS="`$DODS_BIN/opendap-config --cflags`"
ac_dods_ok='yes'
else
dnl Otherwise try to put things together in a more primitive way.
DAP_LIBS="-L$DODS_LIB -ldap++ -lpthread"
DAP_CFLAGS="-I$DODS_INC"
ac_dods_curl='yes'
dnl Add curl to LIBS; it might be local to DODS or generally installed
AC_MSG_CHECKING([For curl and libxml2])
if test -x $DODS_BIN/curl-config; then
DAP_LIBS="$DAP_LIBS `$DODS_BIN/curl-config --libs`"
elif which curl-config > /dev/null 2>&1; then
DAP_LIBS="$DAP_LIBS `curl-config --libs`"
else
AC_MSG_WARN([You gave a dods root, but I can't find curl!])
ac_dods_curl='no'
fi
ac_dods_xml2='yes'
if test -x $DODS_BIN/xml2-config; then
DAP_LIBS="$DAP_LIBS `$DODS_BIN/xml2-config --libs`"
elif which xml2-config > /dev/null 2>&1; then
DAP_LIBS="$DAP_LIBS `xml2-config --libs`"
else
AC_MSG_WARN([You gave a dods root, but I can't find xml2!])
ac_dods_xml2='no'
fi
AC_LANG_PUSH([C++])
if test $ac_dods_xml2 = 'yes' -a $ac_dods_curl = 'yes'; then
AC_MSG_RESULT([yes])
dnl We check that linking is succesfull
ac_save_LIBS="$LIBS"
ac_save_CFLAGS="$CFLAGS"
LIBS="$LIBS $DAP_LIBS"
CFLAGS="$CFLAGS $DAP_CFLAGS"
AC_MSG_NOTICE([Checking for DODS with curl and libxml2])
AC_CHECK_LIB([dap++],[main],[ac_dods_ok='yes'],[ac_dods_ok='no'])
LIBS=$ac_save_LIBS
CFLAGS=$ac_save_CFLAGS
if test "z$ac_dods_ok" = "zno"; then
DAP_LIBS="$DAP_LIBS -lrx"
ac_save_LIBS="$LIBS"
ac_save_CFLAGS="$CFLAGS"
LIBS="$LIBS $DAP_LIBS"
CFLAGS="$CFLAGS $DAP_CFLAGS"
AC_MSG_NOTICE([Checking for DODS with curl, libxml2 and librx])
AC_CHECK_LIB([dap++],[main],[ac_dods_ok='yes'],[ac_dods_ok='no'])
LIBS=$ac_save_LIBS
CFLAGS=$ac_save_CFLAGS
fi
else
AC_MSG_RESULT([no])
fi
if test $ac_dods_ok = 'no'; then
dnl assume it is an old version of DODS
AC_MSG_NOTICE([Checking for DODS with libwww and librx])
DAP_LIBS="-L$DODS_LIB -lwww -ldap++ -lpthread -lrx"
DAP_CFLAGS="-I$DODS_INC"
ac_save_LIBS="$LIBS"
ac_save_CFLAGS="$CFLAGS"
LIBS="$LIBS $DAP_LIBS"
CFLAGS="$CFLAGS $DAP_CFLAGS"
AC_CHECK_LIB([dap++],[main],[ac_dods_ok='yes'],[ac_dods_ok='no'])
LIBS=$ac_save_LIBS
CFLAGS=$ac_save_CFLAGS
fi
AC_LANG_POP
fi
AC_MSG_CHECKING([for DODS in a specific root])
if test "z$ac_dods_ok" = "zyes"; then
AC_MSG_RESULT([yes])
AC_MSG_NOTICE([setting DAP_ROOT directory to $DODS_ROOT])
DAP_ROOT="$DODS_ROOT"
else
AC_MSG_RESULT([no])
fi
fi
fi
if test "x$ac_dods_ok" = "xyes" ; then
m4_if([$1], [], [:], [$1])
else
DAP_LIBS=""
DAP_CFLAGS=""
m4_if([$2], [], [:], [$2])
fi
AC_SUBST([DAP_CFLAGS])
AC_SUBST([DAP_LIBS])
AC_SUBST([DAP_ROOT])
])
-------------- next part --------------
# Configure macro for Libnc-dap
# Patrice Dumas 2005 based on freetype2.m4 from Marcelo Magallon 2001-10-26,
# based on gtk.m4 by Owen Taylor
# AC_CHECK_LIBNC_DAP([MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
# Test for Libnc-dap and define NC_DAP_CFLAGS and NC_DAP_LIBS.
# Check that the version is above MINIMUM-VERSION
AC_DEFUN([AC_CHECK_LIBNC_DAP],
[
AC_PATH_PROG([NC_DAP_CONFIG], [ncdap-config], [no])
ncdap_min_version=m4_if([$1], [], [3.5.0], [$1])
AC_MSG_CHECKING([for libnc-dap version >= $ncdap_min_version])
ncdap_no=""
if test "$NC_DAP_CONFIG" = "no" ; then
ncdap_no=yes
else
ncdap_config_major_version=`$NC_DAP_CONFIG --version | sed 's/^libnc-dap \([[0-9]]\)*\.\([[0-9]]*\)\.\([[0-9]]*\)$/\1/'`
ncdap_config_minor_version=`$NC_DAP_CONFIG --version | sed 's/^libnc-dap \([[0-9]]\)*\.\([[0-9]]*\)\.\([[0-9]]*\)$/\2/'`
ncdap_config_micro_version=`$NC_DAP_CONFIG --version | sed 's/^libnc-dap \([[0-9]]\)*\.\([[0-9]]*\)\.\([[0-9]]*\)$/\2/'`
ncdap_min_major_version=`echo $ncdap_min_version | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
ncdap_min_minor_version=`echo $ncdap_min_version | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
ncdap_min_micro_version=`echo $ncdap_min_version | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
ncdap_config_is_lt=""
if test $ncdap_config_major_version -lt $ncdap_min_major_version ; then
ncdap_config_is_lt=yes
else
if test $ncdap_config_major_version -eq $ncdap_min_major_version ; then
if test $ncdap_config_minor_version -lt $ncdap_min_minor_version ; then
ncdap_config_is_lt=yes
else
if test $ncdap_config_minor_version -eq $ncdap_min_minor_version ; then
if test $ncdap_config_micro_version -lt $ncdap_min_micro_version ; then
ncdap_config_is_lt=yes
fi
fi
fi
fi
fi
if test x$ncdap_config_is_lt = xyes ; then
ncdap_no=yes
else
NC_DAP_LIBS="`$NC_DAP_CONFIG --libs`"
NC_DAP_CFLAGS="`$NC_DAP_CONFIG --cflags`"
fi
fi
if test x$ncdap_no = x ; then
AC_MSG_RESULT([yes])
m4_if([$2], [], [:], [$2])
else
AC_MSG_RESULT([no])
if test "$NC_DAP_CONFIG" = "no" ; then
AC_MSG_NOTICE([The ncdap-config script could not be found.])
else
if test x$ncdap_config_is_lt = xyes ; then
AC_MSG_NOTICE([the installed libnc-dap library is too old.])
fi
fi
NC_DAP_LIBS=""
NC_DAP_CFLAGS=""
m4_if([$3], [], [:], [$3])
fi
AC_SUBST([NC_DAP_CFLAGS])
AC_SUBST([NC_DAP_LIBS])
])
# AC_FC_CHECK_LIBNC_DAP([MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
# Test for Libnc-dap and define NC_DAP_FFLAGS and NC_DAP_FLIBS with flags
# for fortran.
# Check that the version is above MINIMUM-VERSION
AC_DEFUN([AC_FC_CHECK_LIBNC_DAP],
[
libnc_fc_dap_ok="no"
AC_CHECK_LIBNC_DAP([$1],[libnc_fc_dap_ok="yes"],[libnc_fc_dap_ok="no"])
if test $libnc_fc_dap_ok = "yes"; then
NC_DAP_FLIBS="`$NC_DAP_CONFIG --flibs`"
NC_DAP_FFLAGS="$NC_DAP_CFLAGS"
m4_if([$2], [], [:], [$2])
else
m4_if([$3], [], [:], [$3])
NC_DAP_FLIBS=""
NC_DAP_FFLAGS=""
fi
AC_SUBST([NC_DAP_FFLAGS])
AC_SUBST([NC_DAP_FLIBS])
])
# AC_CHECK_NC_DODS([ ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
# Test for Libnc-dap or older versions. Define NC_DAP_CFLAGS and NC_DAP_LIBS.
# use AC_CHECK_DODS if the flags cannot be found easily
AC_DEFUN([AC_CHECK_NC_DODS],
[
ac_ncdods_ok='no'
AC_CHECK_LIBNC_DAP([],[ac_ncdods_ok='yes'],[ac_ncdods_ok='no'])
if test "z$ac_ncdods_ok" = "zno" ; then
AC_PATH_PROG([OPENNC_DAP_CONFIG], [opendap-config], [no])
AC_MSG_CHECKING([for libnc-dap with opendap-config])
if test "$OPENNC_DAP_CONFIG" = "no" ; then
ac_ncdods_ok='no'
AC_MSG_RESULT([no])
else
NC_DAP_LIBS="`$OPENNC_DAP_CONFIG --libs-nc`"
NC_DAP_CFLAGS="`$OPENNC_DAP_CONFIG --cflags`"
ac_ncdods_ok='yes'
AC_MSG_RESULT([yes])
fi
fi
if test "z$ac_ncdods_ok" = "zno" ; then
ac_ncdods_dap_ok='no'
AC_CHECK_DODS([ac_ncdods_dap_ok='yes'],[ac_ncdods_dap_ok='no'])
if test "z$ac_ncdods_dap_ok" = 'zyes'; then
NC_DAP_LIBS="$DAP_LIBS -lnc-dods -ldap++"
NC_DAP_CFLAGS="$DAP_CFLAGS"
AC_LANG_PUSH([C++])
dnl We check that linking is succesfull
ac_save_LIBS="$LIBS"
ac_save_CFLAGS="$CFLAGS"
LIBS="$LIBS $NC_DAP_LIBS"
CFLAGS="$CFLAGS $NC_DAP_CFLAGS"
AC_CHECK_FUNC([nc_open],[ac_ncdods_ok='yes'],[ac_ncdods_ok='no'])
LIBS=$ac_save_LIBS
CFLAGS=$ac_save_CFLAGS
AC_LANG_POP
fi
fi
if test "x$ac_ncdods_ok" = "xyes" ; then
m4_if([$1], [], [:], [$1])
else
NC_DAP_LIBS=""
NC_DAP_CFLAGS=""
m4_if([$2], [], [:], [$2])
fi
AC_SUBST([NC_DAP_CFLAGS])
AC_SUBST([NC_DAP_LIBS])
])
More information about the gradsusr
mailing list