build system new files and diffs

Patrice Dumas pertusus at FREE.FR
Sat Oct 1 08:07:33 EDT 2005


Hello,

Here is the next try of patches and files for the buildsystem. Once again
I resend everything. Tell me if you prefer that I don't resend what I
didn't modify.

* grads-gcc4.diff: build fixes for gcc4/fedora core
* grads-configure.in-special_macros_dyn.diff: use different macros when
  configuring with --enable-dyn-supplibs and without.
* grads-libsx_no_freq.diff: use 2 possible interfaces for libsx.
* ga_lib_readline.m4, gd.m4, hdf.m4, libdap.m4, libnc-dap.m4, libsx.m4,
  netcdf.m4, netcdf_header.m4, udunits.m4: files containing the macros
  used for detection and configuration of libraries, when
  --enable-dyn-supplibs is set.
  If used with the 2 following patches they should go to ./etc.
  ga_lib_readline.m4 is a slightly modified version of vl_lib_readline.m4
  found in the ac_archive. libdap.m4 and libnc-dap.m4 come from opendap.

* grads-Makefile.am-AUTOMAKE_ACLOCAL_flags.diff: add flags for autoreconf.
  They assume that additional m4 files are in ./etc or .
* grads-src-Makefile.am-latsnc-dods.diff: add a specific compile command
  for lats with dods, otherwise dods support cannot be compiled in separately
  from netcdf.
* grads-bootstrap-aclocal_flags.diff: add flags for aclocal. They assume
  that additional m4 files are in ./etc or .

grads-libsx_no_freq.diff and grads-configure.in-special_macros_dyn.diff
depends on each others.

grads-configure.in-special_macros_dyn.diff depends on the .m4 files.

I don't think it is worth bothering with using the cache as even the
autoconf internal cache shouldn't be used for the netcdf.h detection.
Still the change proposed with ga_lib_readline.m4 should be applied, but
this may be postponed until these patches are applied.

This set works flawlessly for me.

--
Pat
-------------- next part --------------
diff -u --recursive -x Makefile.in -x configure -x aclocal.m4 grads-1.9b4-configure/src/gauser.c grads-1.9b4/src/gauser.c
--- grads-1.9b4-configure/src/gauser.c  2005-05-18 20:51:01.000000000 +0200
+++ grads-1.9b4/src/gauser.c    2005-08-11 23:25:56.000000000 +0200
@@ -42,6 +42,7 @@
 #endif

 /* int gxhpng (char *, int, int, int, int); */
+int gxhpng (char *, int, int, int, int, char *, char *, int) ;

 /*mf 971022 --- expose Mike Fiorino's global struct to these routines for warning level setting mf*/
 extern struct gamfcmn mfcmn;
Seulement dans grads-1.9b4/src: gauser-c.o
Seulement dans grads-1.9b4/src: gauser-dods.o
Seulement dans grads-1.9b4/src: gauser-hdf.o
Seulement dans grads-1.9b4/src: gauser-nc.o
Seulement dans grads-1.9b4/src: gautil.o
Seulement dans grads-1.9b4/src: gautil.sa.o
Seulement dans grads-1.9b4/src: gd13gif.o
Seulement dans grads-1.9b4/src: gradsc
Seulement dans grads-1.9b4/src: gradsdods
Seulement dans grads-1.9b4/src: gradshdf
Seulement dans grads-1.9b4/src: gradsnc
Seulement dans grads-1.9b4/src: grads.o
Seulement dans grads-1.9b4/src: gribmap
Seulement dans grads-1.9b4/src: gribmap.o
Seulement dans grads-1.9b4/src: gribscan
Seulement dans grads-1.9b4/src: gribscan.o
Seulement dans grads-1.9b4/src: gscrpt.o
Seulement dans grads-1.9b4/src: gsgui.o
Seulement dans grads-1.9b4/src: gxchpl.o
Seulement dans grads-1.9b4/src: gxcntr.o
diff -u --recursive -x Makefile.in -x configure -x aclocal.m4 grads-1.9b4-configure/src/gxdxwd.c grads-1.9b4/src/gxdxwd.c
--- grads-1.9b4-configure/src/gxdxwd.c  2002-10-28 20:08:33.000000000 +0100
+++ grads-1.9b4/src/gxdxwd.c    2005-08-11 15:55:33.000000000 +0200
@@ -6,6 +6,7 @@
 #include <config.h>
 #endif

+#include <stdlib.h>
 #include <stdio.h>
 #include <errno.h>

@@ -22,7 +23,7 @@
  *              writting.
  */

-char *calloc();
+/* char *calloc(); */

 #include "X11/XWDFile.h"

Seulement dans grads-1.9b4/src: gxdxwd.o
Seulement dans grads-1.9b4/src: gxeps
Seulement dans grads-1.9b4/src: gxeps.o
diff -u --recursive -x Makefile.in -x configure -x aclocal.m4 grads-1.9b4-configure/src/gxhpng.c grads-1.9b4/src/gxhpng.c
--- grads-1.9b4-configure/src/gxhpng.c  2004-03-12 17:14:04.000000000 +0100
+++ grads-1.9b4/src/gxhpng.c    2005-08-12 08:35:10.000000000 +0200
@@ -379,6 +379,11 @@

 int gdCompareInt(const void *a, const void *b);

+int gdCompareInt(const void *a, const void *b)
+{
+       return (*(const int *)a) - (*(const int *)b);
+}
+
 /* Version of gdImageFilledPolygon to invoke my local
    version of gdImageLne.  Nothing else changed... B.Doty 5/31/01 */

-------------- next part --------------
--- grads-1.9b4-orig/configure.in       2005-05-23 17:04:40.000000000 +0200
+++ grads-1.9b4/configure.in    2005-09-30 23:15:58.000000000 +0200
@@ -66,6 +66,8 @@
     [Use pre-1.9 non-canonical names for supplib directories]),
     [old_supplibs="yes"])

+ga_dyn_supplibs=no
+
 AC_ARG_ENABLE(dyn-supplibs, AC_HELP_STRING([--enable-dyn-supplibs],
     [Use dynamic (shared object) system libraries, if present, for optional features. This will produce smaller, but possibly less portable, binaries. By default, only static libraries from a GrADS supplibs distribution will be used for optional feature support to maximize binary portability.]),
     [ GA_ENABLE_DYNAMIC() ])
@@ -258,11 +260,21 @@
 use_readline=no
 if test "$with_readline" != "no" ; then
   echo "Check GrADS command line editing support..."
-  GA_CHECK_READLINE([use_readline=yes])
+  if test "$ga_dyn_supplibs" = "yes" ; then
+  # GA_LIB_READLINE adds the required -l to LIBS
+    GA_LIB_READLINE([
+      use_readline=yes
+      readline_libs=""
+    ])
+  else
+    GA_CHECK_READLINE([use_readline=yes])
+  fi
 fi
 if test $use_readline = "yes" ; then
   echo "+ Command line editing enabled"
-  GA_SET_LIB_VAR(readline_libs, readline)
+  if test "$ga_dyn_supplibs" = "no" ; then
+    GA_SET_LIB_VAR(readline_libs, readline)
+  fi
   AC_SUBST(readline_libs)
   AC_DEFINE(READLINE, 1, [Enable command line editing])
   AC_DEFINE(MM_READLINE,,[Enhanced readline with history])
@@ -274,15 +286,29 @@


 use_gui=no
+use_freq=yes
 if test "$with_gui" != "no" ; then
    echo "Check GrADS GUI support..."
-   GA_CHECK_GUI([use_gui=yes])
+   if test "$ga_dyn_supplibs" = "yes" ; then
+     GA_CHECK_LIBSX([use_gui=yes;use_freq=yes],[use_gui=yes;use_freq=no])
+   else
+     GA_CHECK_GUI([use_gui=yes])
+   fi
 fi
 if test $use_gui = "yes" ; then
   AC_DEFINE(USEGUI, 1, [Enable GUI widgets])
   echo "+ GUI enabled"
-  GA_SET_LIB_VAR(gui_libs, [sx freq])
-  gui_libs="$gui_libs -lXaw -lXmu -lXt $guilibadd"
+  if test "$ga_dyn_supplibs" = "yes" ; then
+    gui_libs="$GA_LIBSX_LIBS $guilibadd"
+  else
+    GA_SET_LIB_VAR(gui_libs, [sx freq])
+    gui_libs="$gui_libs -lXaw -lXmu -lXt $guilibadd"
+  fi
+  if test $use_freq = yes; then
+     AC_DEFINE(USEFREQ, 1, [Use GetFile from freq])
+  else
+     AC_DEFINE(USEFREQ, 0, [Use GetFile from freq])
+  fi
   AC_SUBST(gui_libs)
 else
   AC_DEFINE(USEGUI, 0, [Enable GUI widgets])
@@ -294,13 +320,24 @@
 use_printim=no
 if test "$with_printim" != "no" ; then
   echo "Check GrADS printim support..."
-  GA_CHECK_GD([use_printim=yes], [])
+  if test "$ga_dyn_supplibs" = "yes" ; then
+    GA_SUPP_CHECK_GD([
+      use_printim=yes
+      printim_libs="$GA_GD_LIBS"
+      LDFLAGS="$LDFLAGS $GA_GD_LDFLAGS"
+      CPPFLAGS="$CPPFLAGS $GA_GD_CPPFLAGS"
+    ])
+  else
+    GA_CHECK_GD([use_printim=yes], [])
+  fi
 fi

 if test $use_printim = "yes" ; then
   AC_DEFINE(GXPNG, 1, [Enable printim using GD library \
                        (http://www.boutell.com/gd) for PNG/GIF images])
-  GA_SET_LIB_VAR(printim_libs, [gd png z])
+  if test "$ga_dyn_supplibs" = "no" ; then
+    GA_SET_LIB_VAR(printim_libs, [gd png z])
+  fi
   AC_SUBST(printim_libs)
   extra_utils="$extra_utils gxtran"
   echo "+ printim enabled"
@@ -354,10 +391,23 @@

 use_nc=no
 if test "$with_nc" != "no" ; then
-     GA_CHECK_NC([use_nc=yes])
+  if test "$ga_dyn_supplibs" = "yes" ; then
+    GA_CHECK_UDUNITS([
+      AC_CHECK_NETCDF([
+        LDFLAGS="$LDFLAGS $NC_LDFLAGS"
+        CPPFLAGS="$CPPFLAGS $NC_CPPFLAGS"
+        use_nc=yes
+        nc_libs="$NC_LIBS $GA_UDUNITS_LIBS"
+      ])
+    ])
+  else
+    GA_CHECK_NC([use_nc=yes])
+  fi
 fi
 if test $use_nc = "yes" ; then
-  GA_SET_LIB_VAR(nc_libs, [netcdf udunits])
+  if test "$ga_dyn_supplibs" = "no" ; then
+    GA_SET_LIB_VAR(nc_libs, [netcdf udunits])
+  fi
   AC_SUBST(nc_libs)
   extra_bins="$extra_bins gradsnc"
   echo "+ gradsnc (plain netCDF) build enabled"
@@ -369,13 +419,26 @@

 use_hdf=no
 if test "$with_hdf" != "no" ; then
-  GA_CHECK_HDF([use_hdf=yes])
+  if test "$ga_dyn_supplibs" = "yes" ; then
+    GA_CHECK_UDUNITS([
+      GA_SUPP_CHECK_HDF([
+        LDFLAGS="$LDFLAGS $GA_HDF_LDFLAGS"
+        CPPFLAGS="$CPPFLAGS $GA_HDF_CPPFLAGS"
+        use_hdf=yes
+        hdf_libs="$GA_HDF_LIBS $GA_UDUNITS_LIBS"
+      ])
+    ])
+  else
+    GA_CHECK_HDF([use_hdf=yes])
+  fi
 fi
 if test $use_hdf = "yes" ; then
+  if test "$ga_dyn_supplibs" = "no" ; then
     GA_SET_LIB_VAR(hdf_libs, [mfhdf df jpeg udunits z])
-    AC_SUBST(hdf_libs)
-    extra_bins="$extra_bins gradshdf"
-    echo "+ gradshdf (HDF-SDS/netCDF) build enabled"
+  fi
+  AC_SUBST(hdf_libs)
+  extra_bins="$extra_bins gradshdf"
+  echo "+ gradshdf (HDF-SDS/netCDF) build enabled"
 else
   echo "- gradshdf (HDF-SDS/netCDF) build disabled"
 fi
@@ -384,22 +447,38 @@

 use_dods=no
 if test "$with_dods" != "no" ; then
-  GA_CHECK_DODS([use_dods=yes])
+  if test "$ga_dyn_supplibs" = "yes" ; then
+    GA_CHECK_UDUNITS([
+      AC_CHECK_NC_DODS([
+        CPPFLAGS="$CPPFLAGS $NC_DAP_CFLAGS"
+        dods_libs="$GA_UDUNITS_LIBS $NC_DAP_LIBS"
+        use_dods=yes
+      ])
+    ])
+  else
+    GA_CHECK_DODS([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 "$ga_dyn_supplibs" = "no" ; 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
-       dods_rep_libs="-lgadods -lnc-dods -ldap++"
+       if test "$ga_dyn_supplibs" = "no" ; then
+         dods_rep_libs="-lgadods -lnc-dods -ldap++"
+       else
+         dods_rep_libs="-lgadods"
+       fi
        gadods_def="-DUSEGADODS=1"
        echo "+ gradsdods (OPeNDAP/netCDF) build enabled - gridded and station interfaces"
     else
-       dods_rep_libs="-lnc-dods -ldap++"
+       if test "$ga_dyn_supplibs" = "no" ; then
+         dods_rep_libs="-lnc-dods -ldap++"
+       fi
        gadods_def="-DUSEGADODS=0"
        echo "+ gradsdods (OPeNDAP/netCDF) build enabled - gridded interface only"
     fi
-------------- next part --------------
Seulement dans grads-1.9b4/src: bufrscan.o
Seulement dans grads-1.9b4/src: bufrstn.o
Seulement dans grads-1.9b4/src: buildinfo.h
Seulement dans grads-1.9b4/src: config.h
diff -u --recursive --exclude aclocal.m4 --exclude configure --exclude Makefile.in --exclude bootstrap grads-1.9b4-orig/src/config.h.in grads-1.9b4/src/config.h.in
--- grads-1.9b4-orig/src/config.h.in    2004-12-15 22:00:03.000000000 +0100
+++ grads-1.9b4/src/config.h.in 2005-08-16 12:05:39.000000000 +0200
@@ -88,6 +88,9 @@
 /* Define to 1 if you have the ANSI C header files. */
 #undef STDC_HEADERS

+/* Use GetFile from freq */
+#undef USEFREQ
+
 /* Enable GUI widgets */
 #undef USEGUI

Seulement dans grads-1.9b4/src: config.h.in~
Seulement dans grads-1.9b4/src: fgbds.o
Seulement dans grads-1.9b4/src: fgutil.o
Seulement dans grads-1.9b4/src: gabufr.o
Seulement dans grads-1.9b4/src: gabufrtbl.o
Seulement dans grads-1.9b4/src: gacfg-c.o
Seulement dans grads-1.9b4/src: gacfg-dods.o
Seulement dans grads-1.9b4/src: gacfg-hdf.o
Seulement dans grads-1.9b4/src: gacfg-nc.o
Seulement dans grads-1.9b4/src: gaddes-c.o
Seulement dans grads-1.9b4/src: gaddes-dods.o
Seulement dans grads-1.9b4/src: gaddes-hdf.o
Seulement dans grads-1.9b4/src: gaddes-nc.o
Seulement dans grads-1.9b4/src: gaddes.sa.o
Seulement dans grads-1.9b4/src: gaexpr.o
Seulement dans grads-1.9b4/src: gafunc.o
Seulement dans grads-1.9b4/src: gagmap.o
diff -u --recursive --exclude aclocal.m4 --exclude configure --exclude Makefile.in --exclude bootstrap grads-1.9b4-orig/src/gagui.c grads-1.9b4/src/gagui.c
--- grads-1.9b4-orig/src/gagui.c        2002-10-28 20:08:33.000000000 +0100
+++ grads-1.9b4/src/gagui.c     2005-08-16 12:15:04.000000000 +0200
@@ -38,7 +38,9 @@
 #include <time.h>

 #include "libsx.h"
-#include "freq.h"
+#if USEFREQ == 1
+#include "freq.h"
+#endif
 #include "grads.h"
 #include "gx.h"

@@ -341,8 +343,20 @@
 }

 /*
+ * define SimpleGetFile, it is not part of libsx.
+ */
+char *SimpleGetFile(char *path)
+{
+#if USEFREQ == 0
+   return GetFile("Simple file requestor", path, NULL, NULL);
+#else
+   return GetFile(path);
+#endif
+}
+
+/*
  * CB_Load() - Callback function for the load button.  This just calls
- *          GetFile() to get a file name. In case of "open" or "sdfopen",
+ *          SimpleGetFile() to get a file name. In case of "open" or "sdfopen",
  *          the file becomes the default and the user is asked to select a
  *          variable from this file.
  */
@@ -356,7 +370,7 @@
   else if(strstr(data,"exec"))    last_path = last_path_exec;
   else if(strstr(data,"run"))     last_path = last_path_run;
   else                            last_path = NULL;
-  fname = GetFile(last_path);
+  fname = SimpleGetFile(last_path);

   if(fname)
     {
@@ -979,7 +993,7 @@
   WinInfo *wi=(WinInfo *)arg;
   char *fname;

-  fname = GetFile(wi->cur_path);
+  fname = SimpleGetFile(wi->cur_path);
   if (fname)
    {
      SetTextWidgetText(wi->text_widget, fname, TRUE);
@@ -1126,7 +1140,7 @@


   fname = (char *) data;
-  if ( !strcmp(fname,"NULL") ) fname = GetFile(NULL);
+  if ( !strcmp(fname,"NULL") ) fname = SimpleGetFile(NULL);
   if ( !fname ) return;

   this = MakeWindow("GrADS Text Viewer", SAME_DISPLAY, NONEXCLUSIVE_WINDOW);
@@ -1151,7 +1165,7 @@
   WinInfo *wi;

   fname = (char *)data;
-  if ( !strcmp(fname,"NULL") ) fname = GetFile(NULL);
+  if ( !strcmp(fname,"NULL") ) fname = SimpleGetFile(NULL);
   if ( !fname ) return;

   this = MakeWindow("GrADS Text Editor", SAME_DISPLAY, NONEXCLUSIVE_WINDOW);
Seulement dans grads-1.9b4/src: gagui.o
Seulement dans grads-1.9b4/src: gagx.o
Seulement dans grads-1.9b4/src: gaio-c.o
Seulement dans grads-1.9b4/src: gaio-dods.o
Seulement dans grads-1.9b4/src: gaio-hdf.o
Seulement dans grads-1.9b4/src: gaio-nc.o
Seulement dans grads-1.9b4/src: galats.o
Seulement dans grads-1.9b4/src: gamach.o
Seulement dans grads-1.9b4/src: gasdf-dods.o
Seulement dans grads-1.9b4/src: gasdf-hdf.o
Seulement dans grads-1.9b4/src: gasdf-nc.o
Seulement dans grads-1.9b4/src: gauser-hdf.o
Seulement dans grads-1.9b4/src: gauser-nc.o
Seulement dans grads-1.9b4/src: gautil.o
Seulement dans grads-1.9b4/src: gautil.sa.o
Seulement dans grads-1.9b4/src: gd13gif.o
Seulement dans grads-1.9b4/src: gradsc
Seulement dans grads-1.9b4/src: gradsdods
Seulement dans grads-1.9b4/src: gradshdf
Seulement dans grads-1.9b4/src: gradsnc
Seulement dans grads-1.9b4/src: grads.o
Seulement dans grads-1.9b4/src: gribmap
Seulement dans grads-1.9b4/src: gribmap.o
Seulement dans grads-1.9b4/src: gribscan
Seulement dans grads-1.9b4/src: gribscan.o
Seulement dans grads-1.9b4/src: gscrpt.o
diff -u --recursive --exclude aclocal.m4 --exclude configure --exclude Makefile.in --exclude bootstrap grads-1.9b4-orig/src/gsgui.c grads-1.9b4/src/gsgui.c
--- grads-1.9b4-orig/src/gsgui.c        2002-10-28 20:08:33.000000000 +0100
+++ grads-1.9b4/src/gsgui.c     2005-08-16 12:15:42.000000000 +0200
@@ -29,7 +29,9 @@
 #include <stdlib.h>

 #include "libsx.h"
+#if USEFREQ == 1
 #include "freq.h"
+#endif
 #include "gagui.h"

 /* Supported widget types */
Seulement dans grads-1.9b4/src: gsgui.o
Seulement dans grads-1.9b4/src: gxchpl.o
Seulement dans grads-1.9b4/src: gxcntr.o
Seulement dans grads-1.9b4/src: gxmeta.sa.o
Seulement dans grads-1.9b4/src: gxps
Seulement dans grads-1.9b4/src: gxps.o
Seulement dans grads-1.9b4/src: gxshad.o
Seulement dans grads-1.9b4/src: gxstrm.o
Seulement dans grads-1.9b4/src: gxsubs.o
Seulement dans grads-1.9b4/src: gxtran
Seulement dans grads-1.9b4/src: gxtran.o
Seulement dans grads-1.9b4/src: gxwmap.o
Seulement dans grads-1.9b4/src: gxX.o
Seulement dans grads-1.9b4/src: latsgribmap.o
Seulement dans grads-1.9b4/src: latsgrib.o
Seulement dans grads-1.9b4/src: latsint.o
Seulement dans grads-1.9b4/src: latsnc-nc.o
Seulement dans grads-1.9b4/src: latsnc.o
Seulement dans grads-1.9b4/src: lats.o
Seulement dans grads-1.9b4/src: latsstat.o
Seulement dans grads-1.9b4/src: latstime.o
Seulement dans grads-1.9b4/src: Makefile
Seulement dans grads-1.9b4/src: stamp-h
Seulement dans grads-1.9b4/src: stamp-h1
Seulement dans grads-1.9b4/src: stnmap
Seulement dans grads-1.9b4/src: stnmap.o
Seulement dans grads-1.9b4/src: wgrib
Seulement dans grads-1.9b4/src: wgrib.o
-------------- next part --------------
--- grads-1.9b4-orig/Makefile.am        2003-10-02 16:01:15.000000000 +0200
+++ grads-1.9b4/Makefile.am     2005-09-25 18:25:24.000000000 +0200
@@ -6,6 +6,8 @@
 SUBDIRS=src

 EXTRA_DIST=COPYRIGHT INSTALL
+AUTOMAKE_OPTIONS = foreign
+ACLOCAL_AMFLAGS= -I etc

 BINDISTFILES=COPYRIGHT INSTALL

-------------- next part --------------
--- grads-1.9b4-orig/src/Makefile.am    2004-12-15 22:00:03.000000000 +0100
+++ grads-1.9b4/src/Makefile.am 2005-09-30 22:46:49.000000000 +0200
@@ -296,7 +296,7 @@

 # Object files that should not be reused by the other GrADS binaries,
 # plus libraries needed by this GrADS binary
-gradsdods_LDADD               = latsnc-nc.o gaddes-dods.o gacfg-dods.o gaio-dods.o \
+gradsdods_LDADD               = latsnc-dods.o gaddes-dods.o gacfg-dods.o gaio-dods.o \
                        gauser-dods.o gasdf-dods.o \
                        $(common_ldadd) \
                        $(dods_libs) \
@@ -304,7 +304,7 @@

 # Custom compilation for object files specific to this GrADS binary
 COMPILE_DODS           = $(COMPILE) -I$(supp_include_dir)/dods \
-                         -DUSESDF=1 -DUSEHDF=0 -DUSEDODS=1 $(gadods_def)
+                         -DUSESDF=1 -DUSEHDF=0 -DUSEDODS=1 -DGOT_NETCDF=1 $(gadods_def)

 gaddes-dods.o: $(srcdir)/gaddes.c
        $(COMPILE_DODS) -o gaddes-dods.o -c $(srcdir)/gaddes.c
@@ -316,6 +316,8 @@
        $(COMPILE_DODS) -o gauser-dods.o -c $(srcdir)/gauser.c
 gasdf-dods.o: $(srcdir)/gasdf.c
        $(COMPILE_DODS) -o gasdf-dods.o -c $(srcdir)/gasdf.c
+latsnc-dods.o: $(srcdir)/latsnc.c
+       $(COMPILE_DODS) -o latsnc-dods.o -c $(srcdir)/latsnc.c
 endif

 ##############################################################
-------------- next part --------------
--- grads-1.9b4-orig/bootstrap  2003-07-04 22:25:54.000000000 +0200
+++ grads-1.9b4/bootstrap       2005-09-26 02:36:14.000000000 +0200
@@ -1,6 +1,6 @@
 #!/bin/sh
 mkdir -p etc
-aclocal
+aclocal -I etc
 autoheader
 touch config.h.in
 touch src/stamp-h
-------------- next part --------------
dnl @synopsis GA_LIB_READLINE
dnl  args :             action-if-found, action-if-not-found
dnl                     it is found if readline is found and has
dnl                     history
dnl
dnl Searches for a readline compatible library.  If found, defines
dnl `HAVE_LIBREADLINE'.  If the found library has the `add_history'
dnl function, sets also `HAVE_READLINE_HISTORY'.  Also checks for the
dnl locations of the necessary include files and sets `HAVE_READLINE_H'
dnl or `HAVE_READLINE_READLINE_H' and `HAVE_READLINE_HISTORY_H' or
dnl 'HAVE_HISTORY_H' if the corresponding include files exists.
dnl
dnl The libraries that may be readline compatible are `libedit',
dnl `libeditline' and `libreadline'.  Sometimes we need to link a termcap
dnl library for readline to work, this macro tests these cases too by
dnl trying to link with `libtermcap', `libcurses' or `libncurses' before
dnl giving up.
dnl
dnl Here is an example of how to use the information provided by this
dnl macro to perform the necessary includes or declarations in a C file:
dnl
dnl   #ifdef HAVE_LIBREADLINE
dnl   #  if defined(HAVE_READLINE_READLINE_H)
dnl   #    include <readline/readline.h>
dnl   #  elif defined(HAVE_READLINE_H)
dnl   #    include <readline.h>
dnl   #  else /* !defined(HAVE_READLINE_H) */
dnl   extern char *readline ();
dnl   #  endif /* !defined(HAVE_READLINE_H) */
dnl   char *cmdline = NULL;
dnl   #else /* !defined(HAVE_READLINE_READLINE_H) */
dnl     /* no readline */
dnl   #endif /* HAVE_LIBREADLINE */
dnl
dnl   #ifdef HAVE_READLINE_HISTORY
dnl   #  if defined(HAVE_READLINE_HISTORY_H)
dnl   #    include <readline/history.h>
dnl   #  elif defined(HAVE_HISTORY_H)
dnl   #    include <history.h>
dnl   #  else /* !defined(HAVE_HISTORY_H) */
dnl   extern void add_history ();
dnl   extern int write_history ();
dnl   extern int read_history ();
dnl   #  endif /* defined(HAVE_READLINE_HISTORY_H) */
dnl     /* no history */
dnl   #endif /* HAVE_READLINE_HISTORY */
dnl
dnl
dnl @version 1.1
dnl @author Ville Laurikari <vl at iki.fi>
dnl
dnl Pat: add args, rename to GA_LIB_READLINE
AC_DEFUN([GA_LIB_READLINE], [
  AC_CACHE_CHECK([for a readline compatible library],
                 vl_cv_lib_readline, [
    ORIG_LIBS="$LIBS"
    for readline_lib in readline edit editline; do
      for termcap_lib in "" termcap curses ncurses; do
        if test -z "$termcap_lib"; then
          TRY_LIB="-l$readline_lib"
        else
          TRY_LIB="-l$readline_lib -l$termcap_lib"
        fi
        LIBS="$ORIG_LIBS $TRY_LIB"
        AC_TRY_LINK_FUNC(readline, vl_cv_lib_readline="$TRY_LIB")
        if test -n "$vl_cv_lib_readline"; then
          break
        fi
      done
      if test -n "$vl_cv_lib_readline"; then
        break
      fi
    done
    if test -z "$vl_cv_lib_readline"; then
      vl_cv_lib_readline="no"
      LIBS="$ORIG_LIBS"
    fi
  ])

  if test "$vl_cv_lib_readline" != "no"; then
    AC_DEFINE(HAVE_LIBREADLINE, 1,
              [Define if you have a readline compatible library])
    AC_CHECK_HEADERS(readline.h readline/readline.h)
    AC_CACHE_CHECK([whether readline supports history],
                   vl_cv_lib_readline_history, [
      vl_cv_lib_readline_history="no"
      AC_TRY_LINK_FUNC(add_history, vl_cv_lib_readline_history="yes")
    ])
    if test "$vl_cv_lib_readline_history" = "yes"; then
      AC_DEFINE(HAVE_READLINE_HISTORY, 1,
                [Define if your readline library has \`add_history'])
      AC_CHECK_HEADERS(history.h readline/history.h)
      m4_if([$1], [], [:], [$1])
    else
      m4_if([$2], [], [:], [$2])
    fi
  fi
])dnl
-------------- next part --------------
dnl GA_SUPP_CHECK_GD : check for gd library
dnl args :             action-if-yes, action-if-no

AC_DEFUN([GA_SUPP_CHECK_GD],
[
  ga_check_gd="no"
  GA_GD_LIBS=
  GA_GD_CPPFLAGS=
  GA_GD_LDFLAGS=
  ac_save_LIBS="$LIBS"
  ac_save_CFPPLAGS="$CPPFLAGS"
  ac_save_LDFLAGS="$LDFLAGS"
  AC_PATH_PROG([GD_CONFIG],[gdlib-config],[no])
  if test "$GD_CONFIG" != "no"; then
     GA_GD_LIBS=`$GD_CONFIG --libs`
     GA_GD_CPPFLAGS=`$GD_CONFIG --cflags`
     GA_GD_LDFLAGS=`$GD_CONFIG --ldflags`
     LDFLAGS="$LDFLAGS $GA_GD_LDFLAGS"
     LIBS="$LIBS $GA_GD_LIBS"
     AC_CHECK_HEADER([gd.h],
     [  AC_CHECK_LIB([gd], [gdImageCreate],
        [  ga_check_gd=yes
           GA_GD_LIBS="-lgd $GA_GD_LIBS"
        ],
        [
           GA_GD_LDFLAGS=
           GA_GD_LIBS=
           LIBS="$ac_save_LIBS"
           LDFLAGS="$ac_save_LDFLAGS"
        ])
     ],
     [
       GA_GD_CPPFLAGS=
       CPPFLAGS="$ac_save_CPPFLAGS"
     ])
  fi
  if test $ga_check_gd = 'no'; then
     AC_CHECK_HEADER([gd.h],
     [ AC_SEARCH_LIBS([tgetstr], [termcap ncurses],
        [ AC_CHECK_LIB([z], [compress],
          [ AC_CHECK_LIB([png], [main],
            [ AC_CHECK_LIB([gd], [gdImageCreate],
              [ ga_check_gd=yes
                GA_GD_LIBS='-lgd -lpng -lz'
              ])
            ])
          ])
        ])
     ])
  fi

  if test $ga_check_gd = 'yes'; then
     m4_if([$1], [], [:], [$1])
  else
     m4_if([$2], [], [:], [$2])
  fi

  LIBS="$ac_save_LIBS"
  CPPFLAGS="$ac_save_CPPFLAGS"
  LDFLAGS="$ac_save_LDFLAGS"

  AC_SUBST([GA_GD_LIBS])
  AC_SUBST([GA_GD_LDFLAGs])
  AC_SUBST([GA_GD_CPPFLAGS])
])
-------------- next part --------------
dnl GA_SUPP_CHECK_HDF : Check for hdf
dnl args :             action-if-yes, action-if-no

AC_DEFUN([GA_SUPP_CHECK_HDF],
[
  AC_ARG_WITH([hdf_include],
            [AS_HELP_STRING([--with-hdf-include=ARG],[hdf include directory])],
            [HDF_PATH_INC=$withval],
            [HDF_PATH_INC=""])

  AC_ARG_WITH([hdf_libdir],
            [AS_HELP_STRING([--with-hdf-libdir=ARG],[hdf library directory])],
            [HDF_PATH_LIBDIR=$withval],
            [HDF_PATH_LIBDIR=""])

  ga_check_hdf='no'
  GA_HDF_LDFLAGS=
  AS_IF([test "z$HDF_PATH_LIBDIR" != "z"],[GA_HDF_LDFLAGS="-L$HDF_PATH_LIBDIR"])

  ga_hdf_save_LDFLAGS=$LDFLAGS
  LDFLAGS="$LDFLAGS $GA_HDF_LDFLAGS"
  AC_CHECK_LIB([z],[compress],
  [ AC_CHECK_LIB([jpeg],[main],
    [ AC_CHECK_LIB([df],[main],
      [ AC_CHECK_LIB([mfhdf],[ncopen],
        [ ga_check_hdf="yes"
          GA_HDF_LIBS='-lmfhdf -ldf -ljpeg -lz'
        ],[],[-ldf -ljpeg -lz])
      ])
    ])
  ])
  LDFLAGS="$ga_hdf_save_LDFLAGS"

  GA_HDF_CPPFLAGS=
  AS_IF([test "z$HDF_PATH_INC" != "z"],[GA_HDF_CPPFLAGS="-I$HDF_PATH_INC"])

  ga_hdf_h='no'
  ga_hdf_save_CPPFLAGS=$CPPFLAGS
  CPPFLAGS="$CPPFLAGS $GA_HDF_CPPFLAGS"
  AC_CHECK_HEADER([mfhdf.h],
    [AC_CHECK_NETCDF_HEADER([],[ga_hdf_h='yes'])])
  CPPFLAGS="$ga_hdf_save_CPPFLAGS"

  if test "$ga_hdf_h" = 'yes' -a "$ga_check_hdf" = 'yes' ; then
     m4_if([$1], [], [:], [$1])
  else
     m4_if([$2], [], [:], [$2])
  fi
  AC_SUBST([GA_HDF_LIBS])
  AC_SUBST([GA_HDF_CPPFLAGS])
  AC_SUBST([GA_HDF_LDFLAGS])
])

-------------- next part --------------
# -*- mode: autoconf -*-
# Configure macros for Libdap
#
# Code for version detection and comparison comes from freetype2.m4
# Marcelo Magallon 2001-10-26, based on gtk.m4 by Owen Taylor
#
# Copyright 2001, 2003 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT.  By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
#
# As a special exception to the FreeType project license, this file may be
# distributed as part of a program that contains a configuration script
# generated by Autoconf, under the same distribution terms as the rest of
# that program.
#
# modified by Patrice Dumas 2005 for libdap
#
# AC_CHECK_DODS is 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],
    [AS_HELP_STRING([--with-dods-root=ARG],[DODS root fallback])],
    ,,)

  ac_dods_ok='no'
  DAP_ROOT=
  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'
    elif test -x "$DODS_BIN/dap-config" ; then
      dnl for OPeNDAP 3.5
      DAP_LIBS="`$DODS_BIN/dap-config --libs`"
      DAP_CFLAGS="`$DODS_BIN/dap-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])
      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_dods_curl='no'
      fi
      if test $ac_dods_curl = 'no' ; then
         AC_MSG_RESULT([no])
         dnl AC_MSG_WARN([You gave a dods root, but I can't find curl!])
      else
         AC_MSG_RESULT([yes])
      fi


      AC_MSG_CHECKING([For libxml2])
      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_dods_xml2='no'
      fi
      if test $ac_dods_xml2 = 'no' ; then
         AC_MSG_RESULT([no])
         dnl AC_MSG_WARN([You gave a dods root, but I can't find xml2!])
      else
         AC_MSG_RESULT([yes])
      fi

      AC_LANG_PUSH([C++])
      if test $ac_dods_xml2 = 'yes' -a $ac_dods_curl = 'yes'; then
         dnl We check that linking is succesfull
         ac_save_LIBS=$LIBS
         ac_save_CFLAGS=$CFLAGS
         LIBS="$LIBS $DAP_LIBS"
         CFLAGS="$CFLAGS $DAP_CFLAGS"
         dnl AC_CHECK_LIB is not used because it caches results
         dnl AC_CHECK_LIB([dap++],[main],[ac_dods_ok='yes'],[ac_dods_ok='no'])
         AC_MSG_CHECKING([for DODS with curl and libxml2])
         AC_LINK_IFELSE([AC_LANG_CALL([],[main])],[
           ac_dods_ok='yes'
           AC_MSG_RESULT([yes])
         ],[
           ac_dods_ok='no'
           AC_MSG_RESULT([no])
         ])
         LIBS=$ac_save_LIBS
         CFLAGS=$ac_save_CFLAGS
         if test "z$ac_dods_ok" = "zno"; then
           ac_save_LIBS=$LIBS
           ac_save_CFLAGS=$CFLAGS
           LIBS="$LIBS $DAP_LIBS -lrx"
           CFLAGS="$CFLAGS $DAP_CFLAGS"
           AC_MSG_CHECKING([for DODS with curl, libxml2 and librx])
           AC_LINK_IFELSE([AC_LANG_CALL([],[main])],[
               AC_MSG_RESULT([yes])
               ac_dods_ok='yes'
               DAP_LIBS="$DAP_LIBS -lrx"
           ],[
               ac_dods_ok='no'
               AC_MSG_RESULT([no])
           ])
           LIBS=$ac_save_LIBS
           CFLAGS=$ac_save_CFLAGS
         fi
      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 -ldap++ -lwww -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
  if test "z$ac_dods_ok" = "zno" ; then
     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
  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 --------------
# -*- mode: autoconf -*-
# Configure macro for Libnc-dap
#
# Code for version detection and comparison comes from freetype2.m4
# Marcelo Magallon 2001-10-26, based on gtk.m4 by Owen Taylor
#
# Copyright 2001, 2003 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT.  By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
#
# As a special exception to the FreeType project license, this file may be
# distributed as part of a program that contains a configuration script
# generated by Autoconf, under the same distribution terms as the rest of
# that program.
#
# Patrice Dumas 2005 Libnc-dap specific code

# 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
# Check for the inclusion of a netcdf.h header file with netcdf 3 interface
AC_DEFUN([AC_CHECK_LIBNC_DAP],
[
  ncdap_header_ok='no'
  ncdap_lib_ok='no'
  AC_CHECK_LIBNC_DAP_LIB([$1],[ncdap_lib_ok='yes'],
     [ncdap_lib_ok='no'])
  ncdap_save_CPPFLAGS=$CPPFLAGS
  CPPFLAGS="$CPPFLAGS $NC_DAP_CFLAGS"
  AC_CHECK_NETCDF_HEADER([],[ncdap_header_ok='yes'],
    [ncdap_header_ok='no'],[3])
  CPPFLAGS=$ncdap_save_CPPFLAGS

  if test "$ncdap_lib_ok" = 'yes' -a "$ncdap_header_ok" = 'yes' ; then
    m4_if([$2], [], [:], [$2])
  else
    m4_if([$3], [], [:], [$3])
  fi
])

# AC_CHECK_LIBNC_DAP_LIB([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_LIB],
[
  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_ok='no'
  if test "$NC_DAP_CONFIG" = "no" ; then
     ncdap_ok='no'
  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='no'
     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_ok='no'
     else
       NC_DAP_LIBS="`$NC_DAP_CONFIG --libs`"
       NC_DAP_CFLAGS="`$NC_DAP_CONFIG --cflags`"
     fi
   fi
   if test "x$ncdap_ok" = 'xyes' ; 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_LIB([$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.
# check for the netcdf.h file inclusion
AC_DEFUN([AC_CHECK_NC_DODS],
[
  ncdods_header_ok='no'
  ncdods_lib_ok='no'
  AC_CHECK_NC_DODS_LIB([ncdods_lib_ok='yes'],
     [ncdods_lib_ok='no'])
  ncdods_save_CPPFLAGS=$CPPFLAGS
  CPPFLAGS="$CPPFLAGS $NC_DAP_CFLAGS"
  AC_CHECK_NETCDF_HEADER([],[ncdods_header_ok='yes'],
    [ncdods_header_ok='no'])
  CPPFLAGS=$ncdods_save_CPPFLAGS

  if test "$ncdods_lib_ok" = 'yes' -a "$ncdods_header_ok" = 'yes' ; then
    m4_if([$1], [], [:], [$1])
  else
    m4_if([$2], [], [:], [$2])
  fi
])

# AC_CHECK_NC_DODS_LIB([ 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 first
AC_DEFUN([AC_CHECK_NC_DODS_LIB],
[
  ac_ncdods_ok='no'
  ac_ncdods_dap_ok='no'
  NC_DAP_LIBS=
  NC_DAP_CFLAGS=
  dnl it may happen that the cflags are not the ones associated
  dnl with -L and -l flags, however even in that case the most recent
  dnl netcdf.h should be picked up and things should go smoothly
  AC_PATH_PROG([OPENNC_DAP_CONFIG], [opendap-config], [no])
  if test "$OPENNC_DAP_CONFIG" != "no" ; then
     NC_DAP_CFLAGS="`$OPENNC_DAP_CONFIG --cflags`"
  fi
  AC_PATH_PROG([NC_DAP_CONFIG], [ncdap-config], [no])
  if test "$NC_DAP_CONFIG" != "no" ; then
     NC_DAP_CFLAGS="`$NC_DAP_CONFIG --cflags`"
  fi
  AC_CHECK_DODS([ac_ncdods_dap_ok='yes'],[ac_ncdods_dap_ok='no'])
  if test "z$ac_ncdods_dap_ok" = 'zyes'; then
     if test "z$DAP_ROOT" != "z" ; then
        NC_DAP_CFLAGS=$DAP_ROOT/include
     fi
     dnl We check that linking is succesfull
     dnl instead of using a C++ compiler we add -lstdc++
     dnl AC_LANG_PUSH([C++])
     NC_DAP_LIBS="-lnc-dap $DAP_LIBS -ldap"
     ac_save_LIBS=$LIBS
     LIBS="$LIBS $NC_DAP_LIBS -lstdc++"
     AC_MSG_CHECKING([for nc_open with -lnc-dap -ldap])
     AC_LINK_IFELSE([AC_LANG_CALL([],[nc_open])],
       [ ac_ncdods_ok='yes'
         AC_MSG_RESULT([yes])
       ],[ ac_ncdods_ok='no'
         AC_MSG_RESULT([no])
       ])
     LIBS=$ac_save_LIBS
     if test $ac_ncdods_ok = 'no' ; then
       NC_DAP_LIBS="-lnc-dods $DAP_LIBS -ldap++"
       LIBS="$LIBS $NC_DAP_LIBS -lstdc++"
       AC_MSG_CHECKING([for nc_open with -lnc-dods -ldap++])
       AC_LINK_IFELSE([AC_LANG_CALL([],[nc_open])],
         [ ac_ncdods_ok='yes'
           AC_MSG_RESULT([yes])
         ],[ ac_ncdods_ok='no'
           AC_MSG_RESULT([no])
         ])
       LIBS=$ac_save_LIBS
     fi
     dnl AC_LANG_POP
  fi
  if test $ac_ncdods_ok = no ; then
    AC_CHECK_LIBNC_DAP_LIB([],[ac_ncdods_ok='yes'],[ac_ncdods_ok='no'])
    if test "z$ac_ncdods_ok" = "zno" ; then
      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`"
        ac_ncdods_ok='yes'
        AC_MSG_RESULT([yes])
      fi
    fi
  fi
  if test "x$ac_ncdods_ok" = "xyes" ; then
     m4_if([$1], [], [:], [$1])
  else
     m4_if([$2], [], [:], [$2])
  fi
  AC_SUBST([NC_DAP_CFLAGS])
  AC_SUBST([NC_DAP_LIBS])
])
-------------- next part --------------
dnl GA_CHECK_XAW : Check for Xaw
dnl args :             action-if-yes, action-if-no
AC_DEFUN([GA_CHECK_XAW],
[
   AC_REQUIRE([AC_PATH_XTRA])
   GA_XAW_LIBS=
   ac_save_LIBS="$LIBS"
   ac_save_CFLAGS="$CFLAGS"
   LIBS="$LIBS $X_PRE_LIBS $X_LIBS $X_EXTRA_LIBS"
   CFLAGS="$CFLAGS $X_CFLAGS"
   ga_use_xaw='no'
   AC_CHECK_LIB([Xt],[main],
   [ AC_CHECK_LIB([Xaw],[main],
     [ AC_CHECK_LIB([Xmu],[main],
       [
         ga_use_xaw='yes'
         GA_XAW_LIBS="-lXaw -lXmu -lXt"
       ])
     ])
   ])

   CFLAGS="$ac_save_CFLAGS"
   LIBS="$ac_save_LIBS"
   if test "z$ga_use_xaw" = "zyes"; then
      m4_if([$1], [], [:], [$1])
   else
      m4_if([$2], [], [:], [$2])
   fi
   AC_SUBST([GA_XAW_LIBS])
])

dnl GA_CHECK_LIBSX : Checks whether GrADS can be built with libsx
dnl                     enabled.
dnl  args :             action-if-yes, action-if-no
AC_DEFUN([GA_CHECK_LIBSX],
[
# Check libs and headers for GUI widgets
  GA_LIBSX_LIBS=
  ac_save_LIBS="$LIBS"
  ac_save_CFLAGS="$CFLAGS"
  LIBS="$LIBS $X_PRE_LIBS $X_LIBS $X_EXTRA_LIBS"
  CFLAGS="$CFLAGS $X_CFLAGS"
  ga_use_libsx='no'
  ga_libsx_header='no'
  ga_libsx_freq_header='no'

  GA_CHECK_XAW([ga_xaw_found='yes'],[ga_xaw_found='no'])
  if test "z$ga_xaw_found" = "zyes"; then
     LIBS="$LIBS $GA_XAW_LIBS"

    AC_CHECK_HEADER([libsx.h],
    [ AC_CHECK_HEADER([freq.h],
      [
         ga_libsx_freq_header='yes'
      ])
      ga_libsx_header='yes'
    ])

    if test "z$ga_libsx_header" = "zyes"; then
      if test "z$ga_libsx_freq_header" = "zyes"; then
        AC_CHECK_LIB([freq],[main],
        [ AC_CHECK_LIB([sx],[GetFile],
          [ ga_use_libsx='freq'
            GA_LIBSX_LIBS="-lsx -lfreq $GA_XAW_LIBS"
          ])
        ])
      fi
      if test "z$ga_use_libsx" = "zno"; then
         AC_CHECK_LIB([sx],[GetFile],
         [  ga_use_libsx='yes'
            GA_LIBSX_LIBS="-lsx $GA_XAW_LIBS"
         ])
      fi
    fi
  fi

  if test "z$ga_use_libsx" = "zfreq" ; then
      m4_if([$1], [], [:], [$1])
  else
      if test "z$ga_use_libsx" = "zyes" ; then
         m4_if([$2], [], [:], [$2])
      else
         m4_if([$3], [], [:], [$3])
      fi
  fi
  AC_SUBST([GA_LIBSX_LIBS])
  CFLAGS="$ac_save_CFLAGS"
  LIBS="$ac_save_LIBS"
])
-------------- next part --------------
dnl example of use
dnl AC_CHECK_NETCDF(
dnl   [
dnl       LIBS="$LIBS $NC_LIBS"
dnl       LDFLAGS="$LDFLAGS $NC_LDFLAGS"
dnl       CPPFLAGS="$CPPFLAGS $NC_CPPFLAGS"
dnl   ],
dnl   [
dnl       echo "*** Use --with-netcdf for the root netcdf directory."
dnl       echo "*** Otherwise use --with-netcdf-include switch for includes directory"
dnl       echo "*** and --with-netcdf-libdir switch for libraries directory."
dnl       AC_MSG_ERROR([netcdf library and netcdf headers are required.])
dnl   ]
dnl )

# Check for the netcdf library.
# AC_CHECK_NETCDF([ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND],[INTERFACE-NR])
# if interface number is given, check for a specific interface
# sets NC_LDFLAGS, NC_LIBS, and, by calling other macros
# NC_CPPFLAGS and maybe NC_NETCDF_3_CPPFLAG
AC_DEFUN([AC_CHECK_NETCDF],
[
  AC_ARG_WITH([netcdf],
            [AS_HELP_STRING([--with-netcdf=ARG],[netcdf directory])],
            [NC_PATH=$withval],
            [NC_PATH=""])

  AC_ARG_WITH([netcdf_include],
            [AS_HELP_STRING([--with-netcdf-include=ARG],[netcdf include directory])],
            [NC_PATH_INC=$withval],
            [NC_PATH_INC=""])

  AC_ARG_WITH([netcdf_libdir],
            [AS_HELP_STRING([--with-netcdf-libdir=ARG],[netcdf library directory])],
            [NC_PATH_LIBDIR=$withval],
            [NC_PATH_LIBDIR=""])

  AS_IF([test "z$NC_PATH_LIBDIR" = "z"],
    [AS_IF([test "z$NC_PATH" != "z"],
      [NC_PATH_LIBDIR="$NC_PATH/lib"])])

  AS_IF([test "z$NC_PATH_INC" = "z"],
    [AS_IF([test "z$NC_PATH" != "z"],
      [NC_PATH_INC="$NC_PATH/include"])])

  ac_netcdf_ok='no'

  NC_LIBS=
  NC_LDFLAGS=
  ac_nc_save_LDFLAGS=$LDFLAGS
  ac_nc_save_LIBS=$LIBS
  AS_IF([test "z$NC_PATH_LIBDIR" != "z"],[LDFLAGS="$LDFLAGS -L$NC_PATH_LIBDIR"])
  LDFLAGS="$LDFLAGS -L${NC_PATH_LIBDIR}"
  ac_check_func_checked='ncopen'
  ac_check_interface=
dnl the interface number isn't quoted with "" otherwise a newline
dnl following the number isn't stripped.
  m4_if([$3],[],[:],[ac_check_interface=$3])
  AS_IF([test "z$ac_check_interface" = 'z3'],
    [ac_check_func_checked='nc_open'])
dnl the autoconf internal cache isn't avoided because we really check for
dnl libnetcdf, other libraries that implement the same api have other names
dnl  AC_LINK_IFELSE([AC_LANG_CALL([],[$ac_check_func_checked])],
  AC_CHECK_LIB([netcdf],[$ac_check_func_checked],
    [
      ac_netcdf_ok='yes'
      NC_LIBS="-lnetcdf"
      NC_LDFLAGS="-L$NC_PATH_LIBDIR"
    ],
    [
      ac_netcdf_ok='no'
    ])
  LDFLAGS=$ac_nc_save_LDFLAGS

  AC_SUBST([NC_LDFLAGS])
  AC_SUBST([NC_LIBS])

  AC_CHECK_NETCDF_HEADER([$NC_PATH_INC],
    [ac_netcdf_header='yes'],
    [ac_netcdf_header='no'],
    [$3])

  AS_IF([test "$ac_netcdf_ok" = 'no' -o "$ac_netcdf_header" = 'no'],
    [m4_if([$2], [], [:], [$2])],
    [m4_if([$1], [], [:], [$1])])
])

-------------- next part --------------
# Check for the netcdf header.
# AC_CHECK_NETCDF_HEADER([INCLUDE-DIR],[ACTION-IF-FOUND],
# [ACTION-IF-NOT-FOUND],[INTERFACE-NR])
# if interface number is given, check for a specific interface
# sets NC_CPPFLAGS and maybe NC_NETCDF_3_CPPFLAG
AC_DEFUN([AC_CHECK_NETCDF_HEADER],
[
  NC_CPPFLAGS=
  ac_netcdf_h='no'
  ac_netcdf_h_compile='no'
  ac_netcdf_h_preproc='no'
  ac_nc_include_dir=
  ac_nc_header_interface=

  ac_nc_save_CPPFLAGS=$CPPFLAGS
  m4_if([$1],[],[:],[
    ac_nc_include_dir="$1"
    AS_IF([test "z$ac_nc_include_dir" != "z"],
       [CPPFLAGS="$CPPFLAGS -I$ac_nc_include_dir"])
  ])
  m4_if([$4],[],[:],[ac_nc_header_interface=$4])
dnl dont use AC_CHECK_HEADERS to avoid autoconf internal caching
  AC_MSG_CHECKING([for netcdf.h with compiler])
  AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <netcdf.h>]])],
    [
      AC_MSG_RESULT([yes])
      ac_netcdf_h_compile='yes'
    ],
    [
      AC_MSG_RESULT([no])
      ac_netcdf_h_compile='no'
    ])
    AC_MSG_CHECKING([for netcdf.h with preprocessor])
    AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <netcdf.h>]])],
    [
      AC_MSG_RESULT([yes])
      ac_netcdf_h_preproc='yes'
    ],
    [
      AC_MSG_RESULT([no])
      ac_netcdf_h_preproc='no (ignored...)'
    ])
  CPPFLAGS="$ac_nc_save_CPPFLAGS"
  AS_IF([test $ac_netcdf_h_compile = 'yes'],
    [ac_netcdf_h='yes'
    AS_IF([test "z$ac_nc_header_interface" = 'z3'],
      [AC_CHECK_NETCDF_3_HEADER([$1],
         [ac_netcdf_h='yes'],[ac_netcdf_h='no'])])
    ])

  AS_IF([test "$ac_netcdf_h" = 'yes'],
    [
      AS_IF([test "z$ac_nc_include_dir" != "z"],
        [NC_CPPFLAGS="-I$ac_nc_include_dir"])
      m4_if([$2], [], [:], [$2])
    ],
    [m4_if([$3], [], [:], [$3])])

  AC_SUBST([NC_CPPFLAGS])
])

AC_DEFUN([AC_CHECK_NETCDF_3_HEADER],
[
  NC_NETCDF_3_CPPFLAG=
  ac_check_netcdf_3_include=
  ac_check_netcdf_3_header='no'
  ac_nc_save_CPPFLAGS=$CPPFLAGS
  AC_MSG_CHECKING([for netcdf 3 interface])
  m4_if([$1],[],[:],[
    ac_check_netcdf_3_include="$1"
  ])
  AS_IF([test "z$ac_check_netcdf_3_include" != "z"],
    [CPPFLAGS="$CPPFLAGS -I$ac_check_netcdf_3_include"])
  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <netcdf.h>]],
    [[int status;
int ncid;
status = nc_open("foo.nc", 0, &ncid);
char vernum;
vernum = *nc_inq_libvers();]])],
    [
      AS_IF([test "z$ac_check_netcdf_3_include" != "z"],
        [NC_NETCDF_3_CPPFLAG="-I$ac_check_netcdf_3_include"])
      ac_check_netcdf_3_header='yes'
    ],[ac_check_netcdf_3_header='no'])
  CPPFLAGS=$ac_nc_save_CPPFLAGS
  AS_IF([test "$ac_check_netcdf_3_header" = 'yes'],
    [
      AC_MSG_RESULT([yes])
      m4_if([$2], [], [:], [$2])
    ],
    [
      AC_MSG_RESULT([no])
      m4_if([$3], [], [:], [$3])
    ])

  AC_SUBST([NC_NETCDF_3_CPPFLAG])
])
-------------- next part --------------
dnl GA_CHECK_UDUNITS : Check for udunits
dnl args :             action-if-yes, action-if-no

AC_DEFUN([GA_CHECK_UDUNITS],
[
  ga_use_udunits='no'
  AC_CHECK_HEADER([udunits.h],
  [  AC_CHECK_LIB([udunits],[utInit],
     [  ga_use_udunits='yes'
        GA_UDUNITS_LIBS='-ludunits'
     ])
  ])

  if test "z$ga_use_udunits" = "zyes" ; then
      m4_if([$1], [], [:], [$1])
  else
      m4_if([$2], [], [:], [$2])
  fi
  AC_SUBST([GA_UDUNITS_LIBS])
])


More information about the gradsusr mailing list