rpms/grads/devel grads-build_system.patch, NONE, 1.1 grads-dap_build_fixes.patch, NONE, 1.1 .cvsignore, 1.2, 1.3 grads.spec, 1.20, 1.21 libdap.m4, 1.1, 1.2 libnc-dap.m4, 1.2, 1.3 sources, 1.2, 1.3 grads-build_fixes.diff, 1.2, NONE grads-conditionnal_lats.diff, 1.1, NONE grads_dap-no_lats.patch, 1.1, NONE

Patrice Dumas (pertusus) fedora-extras-commits at redhat.com
Wed Aug 22 10:49:05 UTC 2007


Author: pertusus

Update of /cvs/extras/rpms/grads/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv16866

Modified Files:
	.cvsignore grads.spec libdap.m4 libnc-dap.m4 sources 
Added Files:
	grads-build_system.patch grads-dap_build_fixes.patch 
Removed Files:
	grads-build_fixes.diff grads-conditionnal_lats.diff 
	grads_dap-no_lats.patch 
Log Message:
* Wed Aug 22 2007 Patrice Dumas <pertusus at free.fr> 1.9b4-21
- source is modified, use another name than upstream
- clarify licenses
- keep timestamps
- rework patches
- use newer libdap and libnc-dap autoconf macros


grads-build_system.patch:

--- NEW FILE grads-build_system.patch ---
diff -up grads-1.9b4/src/config.h.in.build_system grads-1.9b4/src/config.h.in
--- grads-1.9b4/src/config.h.in.build_system	2004-12-15 22:00:03.000000000 +0100
+++ grads-1.9b4/src/config.h.in	2007-08-22 10:36:54.000000000 +0200
@@ -61,6 +61,9 @@
 /* Define to 1 if you have the <unistd.h> header file. */
 #undef HAVE_UNISTD_H
 
+/* prepend sd_ to netcdf symbols */
+#undef HDF_SD_NETCDF
+
 /* Enhanced readline with history */
 #undef MM_READLINE
 
@@ -88,6 +91,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
 
@@ -116,5 +122,11 @@
 /* Define to empty if `const' does not conform to ANSI C. */
 #undef const
 
-/* Define to `long' if <sys/types.h> does not define. */
+/* Define to `long int' if <sys/types.h> does not define. */
 #undef off_t
+
+
+#ifdef HDF_SD_NETCDF
+#include "gawrapsd.h"
+#endif
+
diff -up grads-1.9b4/src/Makefile.am.build_system grads-1.9b4/src/Makefile.am
--- grads-1.9b4/src/Makefile.am.build_system	2004-12-15 22:00:03.000000000 +0100
+++ grads-1.9b4/src/Makefile.am	2007-08-22 10:36:43.000000000 +0200
@@ -63,7 +63,7 @@ hdr_png             = gd13gif.h mtables.
 hdr_lats            = lats.h latsint.h latsparm.h latstime.h \
                       fgrib.h fgrib_init.h 
 noinst_HEADERS	    = $(hdr_core) $(hdr_x11) $(hdr_sdf) $(hdr_png) $(hdr_gui) \
-                      $(hdr_lats) $(hdr_img) $(hdr_pc) $(hdr_bufr)
+                      $(hdr_pc) $(hdr_bufr)
 
 # Get rid of buildinfo.h on "make distclean"
 DISTCLEANFILES	       = buildinfo.h
@@ -198,10 +198,13 @@ EXTRA_gradsnc_SOURCES    = galats.c lats
 
 # Object files that should not be reused by the other GrADS binaries,
 # plus libraries needed by this GrADS binary
-gradsnc_LDADD	       = latsnc-nc.o gaddes-nc.o gacfg-nc.o gaio-nc.o \
+gradsnc_LDADD	       = gaddes-nc.o gacfg-nc.o gaio-nc.o \
 			gauser-nc.o gasdf-nc.o \
 			$(common_ldadd) \
 			$(nc_libs)
+if USELATS
+gradsnc_LDADD        += latsnc-nc.o
+endif
 
 # Custom compilation for object files specific to this GrADS binary
 COMPILE_NC 		= $(COMPILE) -I$(supp_include_dir)/nc \
@@ -296,11 +299,14 @@ gradsdods_LINK         = $(CXX) $(AM_CFL
 
 # 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	       = gaddes-dods.o gacfg-dods.o gaio-dods.o \
 			gauser-dods.o gasdf-dods.o \
 			$(common_ldadd) \
 			$(dods_libs) \
 			$(dods_darwin_libs)
+if USELATS
+gradsdods_LDADD        += latsnc-nc.o
+endif
 
 # Custom compilation for object files specific to this GrADS binary
 COMPILE_DODS 		= $(COMPILE) -I$(supp_include_dir)/dods \
diff -up grads-1.9b4/configure.in.build_system grads-1.9b4/configure.in
--- grads-1.9b4/configure.in.build_system	2005-05-23 17:04:40.000000000 +0200
+++ grads-1.9b4/configure.in	2007-08-22 10:36:43.000000000 +0200
@@ -274,14 +274,24 @@ echo
 
 
 use_gui=no
+use_new_gui=no
 if test "$with_gui" != "no" ; then
    echo "Check GrADS GUI support..."
    GA_CHECK_GUI([use_gui=yes])
+   if test $use_gui = no; then
+      GA_CHECK_NEW_GUI([use_new_gui=yes; 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])
+  if test $use_new_gui = no; then
+    GA_SET_LIB_VAR(gui_libs, [sx freq])
+    AC_DEFINE(USEFREQ, 1, [Use GetFile from freq])
+  else
+    GA_SET_LIB_VAR([gui_libs], [sx])
+    AC_DEFINE(USEFREQ, 0, [Use GetFile from freq])
+  fi
   gui_libs="$gui_libs -lXaw -lXmu -lXt $guilibadd"
   AC_SUBST(gui_libs)
 else
@@ -366,6 +376,11 @@ else
 fi
 echo
 
+AH_BOTTOM([
+#ifdef HDF_SD_NETCDF
+#include "gawrapsd.h"
+#endif
+])
 
 use_hdf=no
 if test "$with_hdf" != "no" ; then
@@ -373,6 +388,13 @@ if test "$with_hdf" != "no" ; then
 fi
 if test $use_hdf = "yes" ; then
     GA_SET_LIB_VAR(hdf_libs, [mfhdf df jpeg udunits z])
+    if test "${ga_dyn_supplibs}" = "yes"; then
+      ac_save_LIBS="$LIBS"
+      LIBS="$LIBS $hdf_libs"
+      AC_CHECK_FUNC([sd_ncopen],
+        [AC_DEFINE([HDF_SD_NETCDF],[],[prepend sd_ to netcdf symbols])])
+      LIBS="$ac_save_LIBS"
+    fi
     AC_SUBST(hdf_libs)
     extra_bins="$extra_bins gradshdf"
     echo "+ gradshdf (HDF-SDS/netCDF) build enabled"
@@ -383,15 +405,25 @@ echo
 
 
 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 +436,11 @@ if test $use_dods = "yes" ; then
        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
diff -up grads-1.9b4/acinclude.m4.build_system grads-1.9b4/acinclude.m4
--- grads-1.9b4/acinclude.m4.build_system	2003-10-02 16:01:15.000000000 +0200
+++ grads-1.9b4/acinclude.m4	2007-08-22 10:41:24.000000000 +0200
@@ -12,7 +12,7 @@ dnl GA_SET_FLAGS : Adds supplibs to the 
 dnl 		   compiler or linker flags given, and saves original settings
 dnl 		   for restoration by GA_UNSET_FLAGS
 dnl  args: 	   extra-CPP-flags, extra-LD-flags
-AC_DEFUN(GA_SET_FLAGS,
+AC_DEFUN([GA_SET_FLAGS],
 [
   # Use to make temporary changes to -I and -L paths 
   # Just for use during tests, because configure and make may run 
@@ -27,7 +27,7 @@ AC_DEFUN(GA_SET_FLAGS,
 
 dnl GA_UNSET_FLAGS : Undoes changes to compiler and linker flags made by GA_SET_FLAGS.
 dnl  args:	     none
-AC_DEFUN(GA_UNSET_FLAGS,
+AC_DEFUN([GA_UNSET_FLAGS],
 [
   # Use to undo temporary changes to -I and -L paths 
   CPPFLAGS=$ga_saved_cppflags
@@ -37,7 +37,7 @@ AC_DEFUN(GA_UNSET_FLAGS,
 
 
 dnl GA_ENABLE_DYNAMIC : Enables dynamic compilation.
-AC_DEFUN(GA_ENABLE_DYNAMIC,
+AC_DEFUN([GA_ENABLE_DYNAMIC],
 [ 
   # Just set a flag variable. I put this here instead of configure.in
   # because this variable is used by other macros.  
@@ -52,7 +52,7 @@ dnl		      which is the architecture nam
 dnl		      build system, then just plain "supplibs". If SUPPLIBS is 
 dnl		      set, then it overrides all of these. 
 dnl args: paths-to-search (eg. [. ..])
-AC_DEFUN(GA_SET_SUPPLIBS,
+AC_DEFUN([GA_SET_SUPPLIBS],
 [ 
 
   AC_MSG_CHECKING([for supplibs directory])
@@ -144,7 +144,7 @@ dnl                  a shell variable. I
 dnl                  have the form '-lname'. If not, they will have the form 
 dnl		     'supplib_dir/libname.a'. 
 dnl   args:	   : shell-variable-name, list-of-libraries (e.g. [readline termcap])
-AC_DEFUN(GA_SET_LIB_VAR,
+AC_DEFUN([GA_SET_LIB_VAR],
 [
   if test "${ga_dyn_supplibs}" = "yes" ; then
      ga_lib_prefix='-l'
@@ -165,10 +165,10 @@ dnl GA_CHECK_LIB : Checks for the presen
 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], [$5])
   else 
      AC_MSG_CHECKING([for lib$1.a in supplibs])
      if test -f "${ga_supplib_dir}/lib/lib$1.a" ; then
@@ -187,15 +187,15 @@ AC_DEFUN(GA_CHECK_LIB,
 dnl GA_CHECK_READLINE : Checks whether GrADS can be built with readline features 
 dnl  		      	enabled.
 dnl  args : 		action-if-yes, action-if-no
-AC_DEFUN(GA_CHECK_READLINE,
+AC_DEFUN([GA_CHECK_READLINE],
 [ 
   # Check libs and headers for readline
   GA_SET_FLAGS
 
   ga_check_readline="no"
 
-  AC_CHECK_HEADER(readline/readline.h,
-    [ AC_CHECK_HEADER(readline/history.h, 
+  AC_CHECK_HEADER([readline/readline.h],
+    [ AC_CHECK_HEADER([readline/history.h], 
       [ AC_SEARCH_LIBS(tgetent, [termcap ncurses],  
       	[ GA_CHECK_LIB(readline, readline, [ga_check_readline="yes"]) 
 	])
@@ -218,7 +218,7 @@ AC_DEFUN(GA_CHECK_READLINE,
 dnl GA_CHECK_GUI : Checks whether GrADS can be built with GUI features 
 dnl  		      	enabled.
 dnl  args : 		action-if-yes, action-if-no
-AC_DEFUN(GA_CHECK_GUI,
+AC_DEFUN([GA_CHECK_GUI],
 [
   # Check libs and headers for GUI widgets
   GA_SET_FLAGS([$X_CFLAGS], [$X_LIBS])
@@ -249,12 +249,44 @@ AC_DEFUN(GA_CHECK_GUI,
   GA_UNSET_FLAGS
 ])
 
+dnl GA_CHECK_NEW_GUI : Checks whether GrADS can be built with GUI features 
+dnl  		      	enabled. Check libsx without freq.
+dnl  args : 		action-if-yes, action-if-no
+AC_DEFUN([GA_CHECK_NEW_GUI],
+[
+  # Check libs and headers for GUI widgets
+  GA_SET_FLAGS([$X_CFLAGS], [$X_LIBS])
 
+  ga_check_new_gui="no"
+  AC_CHECK_HEADER([libsx.h],
+  [ AC_CHECK_LIB([Xt],[main],
+    [ AC_CHECK_LIB([Xaw],[main],
+      [ AC_CHECK_LIB([Xmu],[main],
+	  [ GA_CHECK_LIB([sx],[GetFile],
+	    [ ga_check_new_gui="yes"
+            ],
+	    [ ga_check_new_gui="no"
+            ],
+            [-lXaw -lXmu -lXt])
+        ])
+      ])
+    ])
+  ])
+  if test $ga_check_new_gui = "yes" ; then
+    $1 
+    true #dummy command
+  else
+    $2
+    true #dummy command
+  fi
+
+  GA_UNSET_FLAGS
+])
 
 dnl GA_CHECK_GD : Checks whether GrADS can be built with printim command 
 dnl  		      	enabled.
 dnl  args : 		action-if-yes, action-if-no
-AC_DEFUN(GA_CHECK_GD,
+AC_DEFUN([GA_CHECK_GD],
 [
   # Check libs and headers for printim (GD interface)
   GA_SET_FLAGS
@@ -288,7 +320,7 @@ AC_DEFUN(GA_CHECK_GD,
 dnl GA_CHECK_IMG : Checks whether GrADS can be built with wi command 
 dnl  		      	enabled.
 dnl  args : 		action-if-yes, action-if-no
-AC_DEFUN(GA_CHECK_IMG,
+AC_DEFUN([GA_CHECK_IMG],
 [
   # Check libs and headers for wi (ImageMagick interface)
   GA_SET_FLAGS([$X_CFLAGS], [$X_LIBS])
@@ -321,10 +353,10 @@ AC_DEFUN(GA_CHECK_IMG,
 
 dnl GA_CHECK_NC : Checks whether gradsnc (netCDF-enabled) binary can be built
 dnl  args : 	  action-if-yes, action-if-no
-AC_DEFUN(GA_CHECK_NC,
+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,
@@ -353,10 +385,10 @@ AC_DEFUN(GA_CHECK_NC,
 dnl GA_CHECK_HDF : Checks whether gradshdf (netCDF/HDF-SDS-enabled) binary 
 dnl 		   can be built
 dnl  args : 	   action-if-yes, action-if-no
-AC_DEFUN(GA_CHECK_HDF,
+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,
@@ -391,10 +423,10 @@ AC_DEFUN(GA_CHECK_HDF,
 dnl GA_CHECK_NC : Checks whether gradsdods (OPeNDAP-enabled) binary can be 
 dnl 		  built
 dnl args :        action-if-yes, action-if-no
-AC_DEFUN(GA_CHECK_DODS,
+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,

grads-dap_build_fixes.patch:

--- NEW FILE grads-dap_build_fixes.patch ---
diff -Naur grads-1.9b4/src/gacfg.c grads-1.9b4_new/src/gacfg.c
--- grads-1.9b4/src/gacfg.c   2005-05-18 14:29:17.000000000 +0000
+++ grads-1.9b4_new/src/gacfg.c 2005-11-03 13:18:45.000000000 +0000
@@ -32,6 +32,7 @@
  */
 
 #include <stdio.h>
+#include <string.h>
 #include "grads.h"
 #include "buildinfo.h"
 
diff -Naur grads-1.9b4/src/gaexpr.c grads-1.9b4_new/src/gaexpr.c
--- grads-1.9b4/src/gaexpr.c  2005-05-18 14:48:36.000000000 +0000
+++ grads-1.9b4_new/src/gaexpr.c        2005-11-03 11:22:27.000000000 +0000
@@ -13,6 +13,7 @@
 #endif
 
 #include <stdio.h>
+#include <string.h>
 #include <math.h>
 #include "grads.h"
 
diff -Naur grads-1.9b4/src/gaio.c grads-1.9b4_new/src/gaio.c
--- grads-1.9b4/src/gaio.c    2005-05-23 17:59:01.000000000 +0000
+++ grads-1.9b4_new/src/gaio.c  2005-11-03 11:37:35.000000000 +0000
@@ -22,6 +22,7 @@
 #include "grads.h"
 #include <math.h>
 #include <stdio.h>
+#include <string.h>
 #if USESDF == 1
 #include <netcdf.h>
 #if USEHDF == 1
diff -Naur grads-1.9b4/src/gasdf.c grads-1.9b4_new/src/gasdf.c
--- grads-1.9b4/src/gasdf.c   2005-05-18 14:29:17.000000000 +0000
+++ grads-1.9b4_new/src/gasdf.c 2005-11-04 10:02:05.000000000 +0000
@@ -5785,7 +5785,11 @@
   /* Turn off automatic error handling. */
   ncopts = 0;
 
+#if USEHDF == 1
   if (ncattname (cdfid, varid, attnum, name) == -1) {
+#else
+  if (nc_inq_attname(cdfid, varid, attnum, name) == -1) {
+#endif
     ncopts = oldncopts ;
     return Failure;
   }
@@ -5813,10 +5817,23 @@
   /* Turn off automatic error handling. */
   ncopts = 0;
 
+#if USEHDF == 1
   if (ncattinq (cdfid, varid, aname, atype, alen) == -1) {
     ncopts = oldncopts ;
     return Failure;
   }
+#else
+  if (nc_inq_atttype(cdfid, varid, aname, atype) != NC_NOERR) {
+    ncopts = oldncopts ;
+    return Failure;
+  }
+  size_t templen;
+  if (nc_inq_attlen(cdfid, varid, aname, &templen) != NC_NOERR) {
+    ncopts = oldncopts ;
+    return Failure;
+  }
+  *alen = (int) templen;
+#endif
 
   /* Allocate space for values. */
   if ((*atype == NC_BYTE) || (*atype == NC_CHAR))  {
@@ -5831,6 +5848,7 @@
     *adata = (double *) malloc (sizeof (double) * *alen);
   }  else {
     ncopts = oldncopts ;
+    printf("UNKNOWN TYPE HERE !\n");
     return Failure;
   }
 
@@ -5840,10 +5858,65 @@
   }
 
   /* Retrieve values. */
+#if USEHDF == 1
   if (ncattget (cdfid, varid, aname, (void *) (*adata)) == -1) {
     ncopts = oldncopts ;
     return Failure;
   }
+#else
+  switch (*atype)
+  {
+     case NC_BYTE:
+       if (nc_get_att_uchar(cdfid, varid, aname, (unsigned char *) *adata) != NC_NOERR)
+       {
+         ncopts = oldncopts ;
+         return Failure;
+       }
+       break;
+     case NC_CHAR:
+       if (nc_get_att_text(cdfid, varid, aname, (char *) *adata) != NC_NOERR)
+       {
+         ncopts = oldncopts ;
+         return Failure;
+       }
+       break;
+     case NC_SHORT:
+       if (nc_get_att_short(cdfid, varid, aname, (short *) *adata) != NC_NOERR)
+       {
+         ncopts = oldncopts ;
+         return Failure;
+       }
+       break;
+     case NC_LONG:
+       if (nc_get_att_int(cdfid, varid, aname, (int *) *adata) != NC_NOERR)
+       {
+         ncopts = oldncopts ;
+         return Failure;
+       }
+       break;
+     case NC_FLOAT:
+       if (nc_get_att_float(cdfid, varid, aname, (float *) *adata) != NC_NOERR)
+       {
+         ncopts = oldncopts ;
+         return Failure;
+       }
+       break;
+     case NC_DOUBLE:
+       if (nc_get_att_double(cdfid, varid, aname, (double *) *adata) != NC_NOERR)
+       {
+         ncopts = oldncopts ;
+         return Failure;
+       }
+       break;
+     default:
+       if (nc_get_att_text(cdfid, varid, aname, (char *) *adata) != NC_NOERR)
+       {
+         ncopts = oldncopts ;
+         return Failure;
+       }
+       break;
+  }
+#endif
 
   /* If character, set last byte to null. */
   if (*atype == NC_CHAR)  {
diff -Naur grads-1.9b4/src/gxdxwd.c grads-1.9b4_new/src/gxdxwd.c
--- grads-1.9b4/src/gxdxwd.c  2002-10-28 19:08:33.000000000 +0000
+++ grads-1.9b4_new/src/gxdxwd.c        2005-11-03 13:37:45.000000000 +0000
@@ -7,6 +7,7 @@
 #endif
 
 #include <stdio.h>
+#include <stdlib.h>
 #include <errno.h>
 
 #include <X11/Xos.h>
@@ -22,7 +23,7 @@
  *              writting.
  */
 
-char *calloc();
+/* char *calloc(); */
 
 #include "X11/XWDFile.h"
 
@@ -92,6 +91,7 @@
     int bw;
     Window dummywin;
     XWDFileHeader header;
+    char mytmp[64];
 
     
     /*
@@ -232,7 +232,8 @@
      * Write out the color maps, if any
      */
 
-    if (debug) outl("xwd: Dumping %d colors.\n", ncolors);
+    sprintf(mytmp, "xwd: Dumping %d colors.\n", ncolors);
+    if (debug) outl(mytmp);
 /*
     {
     int icineca=0;
diff -Naur grads-1.9b4/src/gxeps.c grads-1.9b4_new/src/gxeps.c
--- grads-1.9b4/src/gxeps.c   2004-02-27 14:42:11.000000000 +0000
+++ grads-1.9b4_new/src/gxeps.c 2005-11-03 14:45:16.000000000 +0000
@@ -6,6 +6,8 @@
 #include <config.h>
 #endif
 
+#include <stdlib.h>
+
 /***********************************************************
  * GXEPS a grads metafile to PostScript converter
  * Copyright (c) 1999 - 2001 Matthias Munnich
diff -Naur grads-1.9b4/src/gxhpng.c grads-1.9b4_new/src/gxhpng.c
--- grads-1.9b4/src/gxhpng.c  2004-03-12 16:14:04.000000000 +0000
+++ grads-1.9b4_new/src/gxhpng.c        2005-11-03 11:56:53.000000000 +0000
@@ -6,7 +6,6 @@
 #include <config.h>
 #endif
 
-
 /* Rasterize current metafile buffer via gd library.  Loosly based
    on the gxpng utility:
 
@@ -455,7 +452,7 @@
                                im->polyInts[ints++] = (y-y1) * (x2-x1) / (y2-y1) + x1;
			}
		}
-		qsort(im->polyInts, ints, sizeof(int), gdCompareInt);
+		qsort(im->polyInts, ints, sizeof(int), (void *) gdCompareInt);

		for (i=0; (i < (ints)); i+=2) {
                        gdImageLne(im, im->polyInts[i], y,
diff -Naur grads-1.9b4/src/gxX.c grads-1.9b4_new/src/gxX.c
--- grads-1.9b4/src/gxX.c     2005-05-18 14:29:17.000000000 +0000
+++ grads-1.9b4_new/src/gxX.c   2005-11-03 11:28:15.000000000 +0000
@@ -270,7 +270,7 @@
 
   /* Set up icon pixmap */
 
-  icon_pixmap = XCreateBitmapFromData(display, win, icon_bitmap_bits,
+  icon_pixmap = XCreateBitmapFromData(display, win, (char *) icon_bitmap_bits,
                 icon_bitmap_width, icon_bitmap_height);
 
   /* Set standard properties */
@@ -402,7 +402,7 @@
   if (xfnam) flist = XListFonts (display, xfnam, 1, &i);
   else flist = NULL;
   if (flist==NULL) {
-    flist = XListFonts (display, "-adobe-helvetica-bold-r-normal--??-100*", 1, &i);
+    flist = XListFonts (display, "-adobe-helvetica-bold-r-normal-*-100*", 1, &i);
   }
   if (flist==NULL) {
     flist = XListFonts (display, "-adobe-helvetica-bold-r-normal-*-120*", 1, &i);
@@ -418,7 +418,7 @@
   if (xfnam) flist = XListFonts (display, xfnam, 1, &i);
   else flist = NULL;
   if (flist==NULL) {
-    flist = XListFonts (display, "-adobe-helvetica-bold-o-normal--??-100*", 1, &i);
+    flist = XListFonts (display, "-adobe-helvetica-bold-o-normal-*-100*", 1, &i);
   }
   if (flist==NULL) {
     flist = XListFonts (display, "-adobe-helvetica-bold-o-normal-*-120*", 1, &i);
@@ -3267,7 +3267,7 @@
   }
 
   if (typ>1) {
-    stipple_pixmap = XCreateBitmapFromData(display, win, bitmap_bits,
+    stipple_pixmap = XCreateBitmapFromData(display, win, (char *) bitmap_bits,
		     bitmap_width, bitmap_height);
     XSetStipple(display, gc, stipple_pixmap);
     XSetFillStyle(display, gc, FillStippled);
diff -u --recursive grads-1.9b4-orig/src/gauser.c grads-1.9b4-rpm/src/gauser.c
--- grads-1.9b4-orig/src/gauser.c	2005-05-18 20:51:01.000000000 +0200
+++ grads-1.9b4-rpm/src/gauser.c	2006-02-17 15:19:32.000000000 +0100
@@ -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;
--- grads-1.9b4-orig/src/gxhpng.c	2004-03-12 17:14:04.000000000 +0100
+++ grads-1.9b4-rpm/src/gxhpng.c	2006-02-17 15:19:32.000000000 +0100
@@ -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 */
 


Index: .cvsignore
===================================================================
RCS file: /cvs/extras/rpms/grads/devel/.cvsignore,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- .cvsignore	20 Dec 2005 12:16:26 -0000	1.2
+++ .cvsignore	22 Aug 2007 10:48:32 -0000	1.3
@@ -1 +1 @@
-grads-src-1.9b4.tar.gz
+grads-src-free-1.9b4.tar.gz


Index: grads.spec
===================================================================
RCS file: /cvs/extras/rpms/grads/devel/grads.spec,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- grads.spec	1 Feb 2007 15:58:52 -0000	1.20
+++ grads.spec	22 Aug 2007 10:48:32 -0000	1.21
@@ -1,12 +1,22 @@
 Name:           grads
 Version:        1.9b4
-Release:        20%{?dist}
+Release:        21%{?dist}
 Summary:        Tool for easy acces, manipulation, and visualization of data
 
 Group:          Applications/Engineering
-License:        GPL
+# gxeps is under the MIT, other programs are GPLv2
+License:        GPLv2 and MIT
 URL:            http://grads.iges.org/grads/grads.html
-Source0:        ftp://grads.iges.org/grads/1.9/grads-src-%{version}.tar.gz
+
+# original tarball contains non free code
+#Source0:        ftp://grads.iges.org/grads/1.9/grads-src-%{version}.tar.gz
+Source0:        grads-src-free-%{version}.tar.gz
+# Use these files to remove files with GPL incompatible licences. In the
+# SOURCES directory with grads tarball and grads-removed-files-list, do
+# sh grads-remove-files
+Source100:      grads-remove-files
+Source101:      grads-removed-files-list
+
 # opendap/DODS detection
 Source3:        libdap.m4
 Source4:        libnc-dap.m4
@@ -19,15 +29,9 @@
 Source5:        grads-README.xorg
 # include file that changes netcdf names to netcdf hdf names
 Source7:        gawrapsd.h
-# Use these files to remove files with GPL incompatible licences. In the
-# SOURCES directory with grads tarball and grads-removed-files-list, do
-# sh grads-remove-files
-Source100:      grads-remove-files
-Source101:      grads-removed-files-list
 
-Patch:          grads-build_fixes.diff
-Patch1:         grads_dap-no_lats.patch
-Patch2:         grads-conditionnal_lats.diff
+Patch0:          grads-build_system.patch
+Patch1:         grads-dap_build_fixes.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 BuildRequires:  hdf-devel 
@@ -37,6 +41,7 @@
 BuildRequires:  zlib-devel libjpeg-devel gd-devel
 BuildRequires:  ncurses-devel libpng-devel
 BuildRequires:  libXmu-devel libX11-devel
+BuildRequires:  pkgconfig
 BuildRequires:  automake
 
 # in a separate package now
@@ -52,21 +57,21 @@
 
 %prep
 %setup -q
-%patch -p1
-%patch -P 1 -p1
-%patch -P 2 -p1
+%patch0 -p1 -b .build_system
+%patch1 -p1 -b .dap_build_fixes
 # change path to datas to %{_datadir}/%{name}
 sed -i -e 's@/usr/local/lib/grads@%{_datadir}/%{name}@' src/gx.h
 # no need to copy grib notice anymore, since it is in a separate package
-#cp %{SOURCE2} .
-cp %{SOURCE6} .
+#cp -p %{SOURCE2} .
+cp -p %{SOURCE6} .
 # copy hdf include wrapper file
-cp %{SOURCE7} src
+cp -p %{SOURCE7} src
 # concatenate autoconf m4 files
+cp -p acinclude.m4 acinclude.m4.save
 cat %{SOURCE3} %{SOURCE4} %{SOURCE8} acinclude.m4 > acinclude.m4.new
 cp acinclude.m4.new acinclude.m4
 # README for use with xorg
-cp %{SOURCE5} README.xorg
+cp -p %{SOURCE5} README.xorg
 # fix perms
 chmod a-x src/*.c src/*.h
 chmod a-x COPYRIGHT
@@ -79,14 +84,17 @@
 %configure --without-gui --without-lats LDFLAGS="-L%{_libdir}/netcdf-3/ -L%{_libdir}/hdf/" CPPFLAGS="-I%{_includedir}/netcdf-3/ -I%{_includedir}/hdf/" --enable-dyn-supplibs
 
 make %{?_smp_mflags}
-cp -r doc html
+
+rm -rf __fedora_docs
+mkdir __fedora_docs
+cp -a doc __fedora_docs/html
 
 
 %install
 rm -rf $RPM_BUILD_ROOT
 make install DESTDIR=$RPM_BUILD_ROOT
 %{__install} -d -m755 $RPM_BUILD_ROOT%{_datadir}/%{name}
-%{__install} -m644 data/*.dat data/*res $RPM_BUILD_ROOT%{_datadir}/%{name}
+%{__install} -p -m644 data/*.dat data/*res $RPM_BUILD_ROOT%{_datadir}/%{name}
 
 
 %clean
@@ -95,7 +103,7 @@
 
 %files
 %defattr(-,root,root,-)
-%doc COPYRIGHT html README.xorg grads-copyright_summary
+%doc COPYRIGHT __fedora_docs/html README.xorg grads-copyright_summary
 %{_bindir}/bufrscan
 %{_bindir}/gradsc
 %{_bindir}/gradsdods
@@ -113,6 +121,13 @@
 
 
 %changelog
+* Wed Aug 22 2007 Patrice Dumas <pertusus at free.fr> 1.9b4-21
+- source is modified, use another name than upstream
+- clarify licenses
+- keep timestamps
+- rework patches
+- use newer libdap and libnc-dap autoconf macros
+
 * Thu Feb  1 2007 Patrice Dumas <pertusus at free.fr> 1.9b4-20
 - rebuild to link against ncurses instead termcap (#226759)
 


Index: libdap.m4
===================================================================
RCS file: /cvs/extras/rpms/grads/devel/libdap.m4,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- libdap.m4	20 Dec 2005 12:16:26 -0000	1.1
+++ libdap.m4	22 Aug 2007 10:48:32 -0000	1.2
@@ -1,7 +1,26 @@
+# -*- mode: autoconf -*-
 # 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
+#
+# 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.
@@ -11,61 +30,100 @@
 
 AC_DEFUN([AC_CHECK_LIBDAP],
 [
-  AC_PATH_PROG([DAP_CONFIG], [dap-config], [no])
   dap_min_version=m4_if([$1], [], [3.5.0], [$1])
+  dap_no=
+  dap_pkgconfig_libdap=yes 
+  PKG_CHECK_MODULES([DAP],[libdap >= $dap_min_version],,
+    [dap_pkgconfig_libdap=no])
+  PKG_CHECK_MODULES([DAP_CLIENT],[libdapclient >= $dap_min_version],,
+    [dap_pkgconfig_libdap=no])
+  PKG_CHECK_MODULES([DAP_SERVER],[libdapserver >= $dap_min_version],,
+    [dap_pkgconfig_libdap=no])
+  
+  if test $dap_pkgconfig_libdap = no; then
+    AC_PATH_PROG([DAP_CONFIG], [dap-config], [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`"
+        if ($DAP_CONFIG --client-libs 2>&1 | grep unknown) >/dev/null 2>&1; then
+          DAP_CLIENT_LIBS=$DAP_LIBS
+          DAP_SERVER_LIBS=$DAP_LIBS
+        else
+          DAP_CLIENT_LIBS="`$DAP_CONFIG --client-libs`"
+          DAP_SERVER_LIBS="`$DAP_CONFIG --server-libs`"
+        fi
+        DAP_CFLAGS="`$DAP_CONFIG --cflags`"
+      fi
+    fi
+  else
+     DAP_STATIC_LIBS="`$PKG_CONFIG --static --libs libdap`"
+     DAP_CLIENT_STATIC_LIBS="`$PKG_CONFIG --static --libs libdapclient`"
+     DAP_SERVER_STATIC_LIBS="`$PKG_CONFIG --static --libs libdapserver`"
+  fi
   AC_MSG_CHECKING([for libdap version >= $dap_min_version])
-  dap_no=""
-  if test "$DAP_CONFIG" = "no" ; then
-     dap_no=yes
+  if test x$dap_no = x ; then
+    AC_MSG_RESULT([yes])
+    m4_if([$2], [], [:], [$2])
   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_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
+  if test x"$DAP_CFLAGS" != x -a x"$DAP_CLIENT_CFLAGS" = x ; then
+    DAP_CLIENT_CFLAGS=$DAP_CFLAGS
+  fi
+  if test x"$DAP_CFLAGS" != x -a x"$DAP_SERVER_CFLAGS" = x ; then
+    DAP_SERVER_CFLAGS=$DAP_CFLAGS
+  fi
+  if test x"$DAP_STATIC_LIBS" = x ; then
+    DAP_STATIC_LIBS=$DAP_LIBS
+    DAP_CLIENT_STATIC_LIBS=$DAP_CLIENT_LIBS
+    DAP_SERVER_STATIC_LIBS=$DAP_SERVER_LIBS
+  fi
+  AC_SUBST([DAP_CFLAGS])
+  AC_SUBST([DAP_CLIENT_CFLAGS])
+  AC_SUBST([DAP_SERVER_CFLAGS])
+  AC_SUBST([DAP_LIBS])
+  AC_SUBST([DAP_CLIENT_LIBS])
+  AC_SUBST([DAP_SERVER_LIBS])
+  AC_SUBST([DAP_STATIC_LIBS])
+  AC_SUBST([DAP_CLIENT_STATIC_LIBS])
+  AC_SUBST([DAP_SERVER_STATIC_LIBS])
 ]) 
 
 # AC_CHECK_DODS([ ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
@@ -74,129 +132,183 @@
 
 AC_DEFUN([AC_CHECK_DODS],
 [
-  AC_ARG_WITH(dods_root,
-    [  --with-dods-root[=ARG] DODS root fallback ],
+  AC_ARG_WITH([dods_root],
+    [AS_HELP_STRING([--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)
+  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
-      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"
+      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_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"
+      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_CHECK_LIB([dap++],[main],[ac_dods_ok='yes'],[ac_dods_ok='no'])
+           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
-        AC_LANG_POP
+         fi
       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])
+      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
+     if test "z$DAP_CLIENT_LIBS" = 'z' ; then
+       DAP_CLIENT_LIBS=$DAP_LIBS
+       DAP_SERVER_LIBS=$DAP_LIBS
+     fi
+     if test x"$DAP_CFLAGS" != x -a x"$DAP_CLIENT_CFLAGS" = x ; then
+        DAP_CLIENT_CFLAGS=$DAP_CFLAGS
+     fi
+     if test x"$DAP_CFLAGS" != x -a x"$DAP_SERVER_CFLAGS" = x ; then
+       DAP_SERVER_CFLAGS=$DAP_CFLAGS
+     fi
+     if test x"$DAP_STATIC_LIBS" = x ; then
+       DAP_STATIC_LIBS=$DAP_LIBS
+       DAP_CLIENT_STATIC_LIBS=$DAP_CLIENT_LIBS
+       DAP_SERVER_STATIC_LIBS=$DAP_SERVER_LIBS
+     fi
      m4_if([$1], [], [:], [$1])
   else
      DAP_LIBS=""
      DAP_CFLAGS=""
+     DAP_CLIENT_LIBS=""
+     DAP_SERVER_LIBS=""
      m4_if([$2], [], [:], [$2])
   fi
-  AC_SUBST([DAP_CFLAGS])
-  AC_SUBST([DAP_LIBS])
-  AC_SUBST([DAP_ROOT])
+dnl done above
+dnl  AC_SUBST([DAP_CFLAGS])
+dnl  AC_SUBST([DAP_CLIENT_CFLAGS])
+dnl  AC_SUBST([DAP_SERVER_CFLAGS])
+dnl  AC_SUBST([DAP_LIBS])
+dnl  AC_SUBST([DAP_CLIENT_LIBS])
+dnl  AC_SUBST([DAP_SERVER_LIBS])
+dnl  AC_SUBST([DAP_STATIC_LIBS])
+dnl  AC_SUBST([DAP_CLIENT_STATIC_LIBS])
+dnl  AC_SUBST([DAP_SERVER_STATIC_LIBS])
+dnl  AC_SUBST([DAP_ROOT])
 ])


Index: libnc-dap.m4
===================================================================
RCS file: /cvs/extras/rpms/grads/devel/libnc-dap.m4,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- libnc-dap.m4	22 Jul 2006 15:51:43 -0000	1.2
+++ libnc-dap.m4	22 Aug 2007 10:48:32 -0000	1.3
@@ -28,13 +28,24 @@
 [
   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_DAP_HEADER([],[ncdap_header_ok='yes'],
-    [ncdap_header_ok='no'],[3])
-  CPPFLAGS=$ncdap_save_CPPFLAGS
+
+  ncdap_pkgconfig_libncdap=yes
+  ncdap_min_version=m4_if([$1], [], [3.5.0], [$1])
+  PKG_CHECK_MODULES([NC_DAP],[libnc-dap >= $ncdap_min_version],,
+    [ncdap_pkgconfig_libncdap=no])
+
+  if test $ncdap_pkgconfig_libncdap = yes ; then
+    ncdap_lib_ok=yes
+    ncdap_header_ok=yes
+  else
+    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_DAP_HEADER([],[ncdap_header_ok='yes'],
+      [ncdap_header_ok='no'],[3])
+    CPPFLAGS=$ncdap_save_CPPFLAGS
+  fi
 
   if test "$ncdap_lib_ok" = 'yes' -a "$ncdap_header_ok" = 'yes' ; then
     m4_if([$2], [], [:], [$2])
@@ -132,10 +143,25 @@
 # 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
+# the old way of finding libs is used first to allow the user to 
+# specify a root with the 'old style' nc-dods all-in-a-root.
 AC_DEFUN([AC_CHECK_NC_DODS],
 [
   ncdods_header_ok='no'
   ncdods_lib_ok='no'
+  
+# we find lib using pkg-config now, before we set NC_DAP_* to something else, 
+# and we keep the result. 
+  ncdods_pkgconfig_ncdods=yes
+  PKG_CHECK_MODULES([NC_DAP],[libnc-dap],,
+    [ncdods_pkgconfig_ncdods=no])
+  if test $ncdods_pkgconfig_ncdods = yes ; then
+    ncdods_pkgconfig_NC_DAP_LIBS=$NC_DAP_LIBS
+    ncdods_pkgconfig_NC_DAP_CFLAGS=$NC_DAP_CFLAGS
+    NC_DAP_LIBS=
+    NC_DAP_CFLAGS=
+  fi
+
   AC_CHECK_NC_DODS_LIB([ncdods_lib_ok='yes'],
      [ncdods_lib_ok='no'])
   ncdods_save_CPPFLAGS=$CPPFLAGS
@@ -144,6 +170,16 @@
     [ncdods_header_ok='no'])
   CPPFLAGS=$ncdods_save_CPPFLAGS
 
+# if the 'old style' failed and pkg-config succeded, use pkg-config
+  if test "$ncdods_lib_ok" = 'no' -o "$ncdods_header_ok" = 'no' ; then
+    if test $ncdods_pkgconfig_ncdods = 'yes' ; then
+      NC_DAP_LIBS=$ncdods_pkgconfig_NC_DAP_LIBS
+      NC_DAP_CFLAGS=$ncdods_pkgconfig_NC_DAP_CFLAGS
+      ncdods_lib_ok=yes
+      ncdods_header_ok=yes
+    fi
+  fi
+
   if test "$ncdods_lib_ok" = 'yes' -a "$ncdods_header_ok" = 'yes' ; then
     m4_if([$1], [], [:], [$1])
   else


Index: sources
===================================================================
RCS file: /cvs/extras/rpms/grads/devel/sources,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- sources	20 Dec 2005 12:16:26 -0000	1.2
+++ sources	22 Aug 2007 10:48:32 -0000	1.3
@@ -1 +1 @@
-22e04f84df73d4aa72fe468c7f43b1c3  grads-src-1.9b4.tar.gz
+22e04f84df73d4aa72fe468c7f43b1c3  grads-src-free-1.9b4.tar.gz


--- grads-build_fixes.diff DELETED ---


--- grads-conditionnal_lats.diff DELETED ---


--- grads_dap-no_lats.patch DELETED ---




More information about the fedora-extras-commits mailing list