[gradsusr] Request for some changes in configure.ac

Stephen Woodbridge stephenwoodbridge37 at gmail.com
Fri Jan 4 16:03:49 EST 2019


Hi Jennifer,

To followup on our discussions about Ubuntu, I would like to request 
some changes to configure.ac, It has been 10+- years since I have played 
with autotools so I'm not sure I should be the one making changes. That 
said, the first step is to get configure to check for all the dependent 
libs. I made changes to configure.ac see attached diff. Now on Ubuntu, I 
can run:

#!/bin/sh

LIB=/usr/lib/x86_64-linux-gnu
SUPPLIBS=/usr/local/lib/grads/2.2/supplibs

./configure \
   --with-geotiff-libdir=$LIB \
   --with-hdf4-libdir=/usr/lib \
   --with-hdf5-include=/usr/include/hdf5/serial/ \
   --with-hdf5-libdir=/usr/lib/x86_64-linux-gnu/hdf5/serial/ \
   --with-udunits-include=$SUPPLIBS/include \
   --with-udunits-libdir=$SUPPLIBS/lib \
   --with-netcdf-include=/usr/include \
   --with-netcdf-libdir=$LIB \

and I get the following:

   +-------------------------------+
   |                               |
   |  GrADS will be built with:    |
   |                               |
   |  - GUI disabled               |
   |  + READLINE enabled           |
   |  + GEOTIFF enabled            |
   |  + SHAPEFILE enabled          |
   |  + GD enabled                 |
   |  + CAIRO enabled              |
   |  + GRIB2 enabled              |
   |  + HDF4 enabled               |
   |  + HDF5 enabled               |
   |  + NETCDF4 enabled            |
   |  + OPeNDAP enabled            |
   |     for grids only            |
   |                               |
   +-------------------------------+

but it fails to compile, because the Makefile needs some work:

# make
Making all in src
make[1]: Entering directory '/home/woodbri/work/grads/grads-2.2.1/src'
make  all-am
make[2]: Entering directory '/home/woodbri/work/grads/grads-2.2.1/src'
/bin/bash ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I.  
-I. -I..//include   -g -O2 -rdynamic -c -o libgxpGD_la-gxprintGD.lo 
`test -f 'gxprintGD.c' || echo './'`gxprintGD.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I. -I..//include -g -O2 
-rdynamic -c gxprintGD.c  -fPIC -DPIC -o .libs/libgxpGD_la-gxprintGD.o
/bin/bash ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I.  
-I. -I..//include   -g -O2 -rdynamic -c -o libgxpGD_la-gxGD.lo `test -f 
'gxGD.c' || echo './'`gxGD.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I. -I..//include -g -O2 
-rdynamic -c gxGD.c  -fPIC -DPIC -o .libs/libgxpGD_la-gxGD.o
/bin/bash ../libtool  --tag=CC   --mode=link gcc  -g -O2 -rdynamic 
-version-info 1:0:1 -L/usr/lib/x86_64-linux-gnu -o libgxpGD.la -rpath 
/home/woodbri/work/grads/grads-2.2.1/lib libgxpGD_la-gxprintGD.lo 
libgxpGD_la-gxGD.lo -L..//lib -L/usr/lib/x86_64-linux-gnu  -lgd -lm
../libtool: line 6000: cd: ..//lib: No such file or directory
libtool: link: cannot determine absolute directory name of `..//lib'
Makefile:721: recipe for target 'libgxpGD.la' failed
make[2]: *** [libgxpGD.la] Error 1

I think what needs to happen in the configure script is that is needs to 
set variables for where it finds the libs and includes for each package, 
then bring the forward into the Makefile. For example above 
-I..//include is assuming ../supplibs/include rather than the actual 
place the include was found and likewise the same needs to happen at 
linking. While ubuntu has the same version of libjasper, the include on 
ubuntu is located at /usr/include/jasper/jasper.h but in supplibs at 
include/jasper.h this will mean that -I/usr/include/jasper needs to be 
set for ubuntu but -I$SUPPLIBS/include is set for your environment, etc.

It looks like this is happening for some libs like readline, geotiff, 
shapelib, but not for the additional dependent libs like png15, zlib, 
jpeg, jasper or curl. And we should probably be tracking the include 
locations also.

So more work will need to be done on configure.ac to capture these 
locations, before changes to Makefile.am or Makefile.in are attempted. 
So much to relearn about autotools :)

Does this seem like the way to go? Thoughts,

   -Steve



---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
-------------- next part --------------
diff --git a/configure.ac b/configure.ac
index 0663fbd..9d8b020 100644
--- a/configure.ac
+++ b/configure.ac
@@ -410,7 +410,7 @@ fi
 
 
 # check in supplibs directory for the additional dependent libs
-if test "Z$ga_supplib_dir" != "Z" ; then 
+#if test "Z$ga_supplib_dir" != "Z" ; then 
   echo looking in $ga_supplib_dir for additional dependent libs
 
   # png15
@@ -420,6 +420,9 @@ if test "Z$ga_supplib_dir" != "Z" ; then
   GA_SET_FLAGS([])
   AC_CHECK_LIB([png15], [main], [have_png=yes])
   GA_UNSET_FLAGS
+  if test "$have_png" != "yes" ; then
+    AC_CHECK_LIB([png15], [main], [have_png=yes])
+  fi
 
   # zlib
   echo 
@@ -430,6 +433,12 @@ if test "Z$ga_supplib_dir" != "Z" ; then
   [ AC_CHECK_LIB([z], [compress], [have_zlib=yes])
   ])
   GA_UNSET_FLAGS
+  if test "$have_zlib" != "yes" ; then
+    AC_CHECK_HEADER([zlib.h], 
+      [ AC_CHECK_LIB([z], [compress], [have_zlib=yes])
+    ])
+  fi
+
 
   # jpeg
   echo 
@@ -438,6 +447,9 @@ if test "Z$ga_supplib_dir" != "Z" ; then
   GA_SET_FLAGS([])
   AC_CHECK_LIB([jpeg], [main], [have_jpeg=yes])
   GA_UNSET_FLAGS
+  if test "$have_jpeg" != "yes" ; then
+    AC_CHECK_LIB([jpeg], [main], [have_jpeg=yes])
+  fi
 
   # jasper
   echo 
@@ -445,9 +457,18 @@ if test "Z$ga_supplib_dir" != "Z" ; then
   echo ------
   GA_SET_FLAGS([jasper])
   AC_CHECK_HEADER([jasper.h],
-  [ AC_CHECK_LIB([jasper], [main], [have_jasper=yes])
+    [ AC_CHECK_HEADER([jasper/jasper.h],
+      [ AC_CHECK_LIB([jasper], [main], [have_jasper=yes])
+    ])
   ])
   GA_UNSET_FLAGS
+  if test "$have_jasper" != "yes" ; then
+    AC_CHECK_HEADER([jasper.h],
+      [ AC_CHECK_HEADER([jasper/jasper.h],
+        [ AC_CHECK_LIB([jasper], [main], [have_jasper=yes])
+      ])
+    ])
+  fi
 
   # xml2
   echo 
@@ -471,7 +492,7 @@ if test "Z$ga_supplib_dir" != "Z" ; then
   ])
   GA_UNSET_FLAGS	
 
-fi
+#fi
 
 # * * * GD * * *
 echo 
@@ -664,6 +685,7 @@ if test "$have_udunits" = "no" -a "$ga_dyn_supplibs" = "yes" ; then
 #    udunits_libs="$UDUNITS_LIBS"
   ])
 fi
+echo have_udunits=$have_udunits
 
 
 # * * * HDF4 * * *


More information about the gradsusr mailing list