|
From: Arlindo da S. <da...@al...> - 2008-07-25 15:01:22
|
On Fri, Jul 25, 2008 at 9:16 AM, Jennifer Adams <jm...@co...> wrote:
> I have got it to work by creating a new macro in acinclude.m4:
> dnl GA_SET_INCLUDE_VAR : Puts necessary options to compile with include
> directories given
> dnl into a shell variable.
> dnl args: : shell-variable-name, list-of-directories
> AC_DEFUN([GA_SET_INCLUDE_VAR],
> [
> ga_include_prefix='-I$(supp_include_dir)/'
> for ga_include_name in $2 ; do
> $1="$$1 ${ga_include_prefix}${ga_include_name}"
> done
> ])
>
This works and is more flexible than what I had done which was to have
this macro in Makefile.am that assumed a prescribed supplib structure:
INCLUDES = -I$(supp_include_dir) \
-I$(supp_include_dir)/curl \
-I$(supp_include_dir)/xml2 \
-I$(supp_include_dir)/gd \
-I$(supp_include_dir)/gadap \
-I$(supp_include_dir)/udunits \
-I$(supp_include_dir)/hdf \
-I$(supp_include_dir)/jpeg \
-I$(supp_include_dir)/libpng \
-I$(supp_include_dir)/zlib \
-I$(supp_include_dir)/X11/neXtaw \
-I$(supp_include_dir)/libsx \
-I$(supp_include_dir)/grib2c \
-I$(supp_include_dir)/jasper \
$(X_CFLAGS) $(XAW_CFLAGS) $(GD_CFLAGS) \
$(HDF4_CFLAGS)
Where are you defining the list of subdirectories to be searched?
> Now configure.ac has this:
> use_nc=no
> if test "$with_nc" != "no" ; then
> echo "Checking netcdf support..."
> GA_CHECK_NC([use_nc=yes], {})
> fi
> if test $use_nc = "yes" ; then
> GA_SET_INCLUDE_VAR(nc_include, [netcdf])
> AC_SUBST(nc_include)
> if test $use_hdf = "yes" ; then
> GA_SET_LIB_VAR(nc_libs, [netcdf])
> else
> GA_SET_LIB_VAR(nc_libs, [netcdf udunits])
> fi
> AC_SUBST(nc_libs)
> AC_DEFINE(USESDF, 1, [Enable netcdf])
> echo "+ netcdf enabled"
> else
> AC_DEFINE(USESDF, 0, [Enable netcdf])
> echo "- netcdf disabled"
> fi
> echo
> And my Makefile has this:
> nc_include = -I$(supp_include_dir)/netcdf
How would you handle the cases when netcdf is not coming from the
supplibs? In our case, NC_CFLAGS/NCDAP_CFLAGS are defined outside the
Makefile. Pat has macros to either use the supplibs or else discover
netcdf in the system and set NC_CFLAGS accordingly; so this logic is
outside the Makefile.
Note: "Why then the INCLUDES macro above with the list of directories
under the supplibs?", you ask. In this case the suplibs would not be
found (could set SUPPLIBS to /dev/null). Having INCLUDES in
configure.ac, or even in the m4 macro GA_DEF_SUPPLIBS would be a
better solution.
Arlindo.
--
Arlindo da Silva
da...@al...
|