Commit 25df340d authored by Ralf Müller's avatar Ralf Müller
Browse files

Simplify the configure run

Use CPPFLAGS/LDFLAGS instead of seprarate variables for each library e.g.
NETCDF_INCLUDE/NETCDF_LDFLAGS The the binary can only call one single version
of each library function, so there is no need to pass each library separately. 
refs #949
parent a934c4b8
......@@ -16779,9 +16779,6 @@ fi
;; #(
*) :
ZLIB_ROOT=$with_zlib
LDFLAGS_org="$LDFLAGS"
CPPFLAGS_org="$CPPFLAGS"
LIBS_org="$LIBS"
LDFLAGS="-L$ZLIB_ROOT/lib $LDFLAGS"
CPPFLAGS="-I$ZLIB_ROOT/include $CPPFLAGS"
for ac_header in zlib.h
......@@ -16854,9 +16851,6 @@ $as_echo "#define HAVE_LIBZ 1" >>confdefs.h
 
fi
 
LDFLAGS="$LDFLAGS_org"
CPPFLAGS="$CPPFLAGS_org"
LIBS="$LIBS_org"
ZLIB_INCLUDE=" -I$ZLIB_ROOT/include"
 
ZLIB_LDFLAGS=" -L$ZLIB_ROOT/lib -lz"
......@@ -17030,10 +17024,7 @@ fi
*) :
SZLIB_ROOT=$with_szlib
if test -d "$SZLIB_ROOT"; then :
LDFLAGS_org="$LDFLAGS"
CPPFLAGS_org="$CPPFLAGS"
LIBS_org="$LIBS"
LDFLAGS="-L$SZLIB_ROOT/lib $LDFLAGS"
LDFLAGS="-L$SZLIB_ROOT/lib $LDFLAGS"
CPPFLAGS="-I$SZLIB_ROOT/include $CPPFLAGS"
for ac_header in szlib.h
do :
......@@ -17107,9 +17098,6 @@ else
as_fn_error $? "Could not link to szlib" "$LINENO" 5
fi
 
LDFLAGS="$LDFLAGS_org"
CPPFLAGS="$CPPFLAGS_org"
LIBS="$LIBS_org"
SZLIB_LDFLAGS=" -L$SZLIB_ROOT/lib -lsz"
 
SZLIB_INCLUDE=" -I$SZLIB_ROOT/include"
......@@ -17284,10 +17272,7 @@ fi
*) :
HDF5_ROOT=$with_hdf5
if test -d "$HDF5_ROOT"; then :
LDFLAGS_org="$LDFLAGS"
CPPFLAGS_org="$CPPFLAGS"
LIBS_org="$LIBS"
LDFLAGS="-L$HDF5_ROOT/lib $LDFLAGS"
LDFLAGS="-L$HDF5_ROOT/lib $LDFLAGS"
CPPFLAGS="-I$HDF5_ROOT/include $CPPFLAGS"
for ac_header in hdf5.h
do :
......@@ -17427,9 +17412,6 @@ $as_echo "$as_me: Cannot link to hdf5 high level interface! It is required for n
have_hdf5_hl=no
fi
 
LDFLAGS="$LDFLAGS_org"
CPPFLAGS="$CPPFLAGS_org"
LIBS="$LIBS_org"
if test "x$have_libhdf5_hl" = 'xyes'; then :
HDF5_LDFLAGS=" -L$HDF5_ROOT/lib -lhdf5_hl -lhdf5"
 
......@@ -17544,10 +17526,7 @@ fi
*) :
NETCDF_ROOT=$with_netcdf
if test -d "$NETCDF_ROOT"; then :
LDFLAGS_org="$LDFLAGS"
CPPFLAGS_org="$CPPFLAGS"
LIBS_org="$LIBS"
LDFLAGS="-L$NETCDF_ROOT/lib $LDFLAGS"
LDFLAGS="-L$NETCDF_ROOT/lib $LDFLAGS"
CPPFLAGS="-I$NETCDF_ROOT/include $CPPFLAGS"
for ac_header in netcdf.h
do :
......@@ -17621,9 +17600,6 @@ else
as_fn_error $? "Could not link to netcdf library" "$LINENO" 5
fi
 
LDFLAGS="$LDFLAGS_org"
CPPFLAGS="$CPPFLAGS_org"
LIBS="$LIBS_org"
NETCDF_LDFLAGS=" -L$NETCDF_ROOT/lib -lnetcdf"
 
NETCDF_INCLUDE=" -I$NETCDF_ROOT/include"
......
......@@ -36,16 +36,10 @@ AC_ARG_WITH([zlib],
AC_SUBST([ZLIB_INCLUDE],[])
AC_SUBST([ZLIB_LDFLAGS],[" -lz"])],
[*],[ZLIB_ROOT=$with_zlib
LDFLAGS_org="$LDFLAGS"
CPPFLAGS_org="$CPPFLAGS"
LIBS_org="$LIBS"
LDFLAGS="-L$ZLIB_ROOT/lib $LDFLAGS"
CPPFLAGS="-I$ZLIB_ROOT/include $CPPFLAGS"
AC_CHECK_HEADERS(zlib.h)
AC_SEARCH_LIBS([deflate],[z],[AC_DEFINE([HAVE_LIBZ],[1],[Define 1 for ZLIB support])])
LDFLAGS="$LDFLAGS_org"
CPPFLAGS="$CPPFLAGS_org"
LIBS="$LIBS_org"
AC_SUBST([ZLIB_INCLUDE],[" -I$ZLIB_ROOT/include"])
AC_SUBST([ZLIB_LDFLAGS],[" -L$ZLIB_ROOT/lib -lz"])])],
[AC_CHECK_HEADERS(zlib.h)
......@@ -67,19 +61,13 @@ AC_ARG_WITH([szlib],
AC_SUBST([SZLIB_INCLUDE],[""])],
[*],[SZLIB_ROOT=$with_szlib
AS_IF([test -d "$SZLIB_ROOT"],
[LDFLAGS_org="$LDFLAGS"
CPPFLAGS_org="$CPPFLAGS"
LIBS_org="$LIBS"
LDFLAGS="-L$SZLIB_ROOT/lib $LDFLAGS"
[LDFLAGS="-L$SZLIB_ROOT/lib $LDFLAGS"
CPPFLAGS="-I$SZLIB_ROOT/include $CPPFLAGS"
AC_CHECK_HEADERS(szlib.h)
AC_SEARCH_LIBS([SZ_BufftoBuffCompress],
[sz],
[AC_DEFINE([HAVE_LIBSZ],[1],[Define to 1 for SZIP support])],
[AC_MSG_ERROR([Could not link to szlib])])
LDFLAGS="$LDFLAGS_org"
CPPFLAGS="$CPPFLAGS_org"
LIBS="$LIBS_org"
AC_SUBST([SZLIB_LDFLAGS],[" -L$SZLIB_ROOT/lib -lsz"])
AC_SUBST([SZLIB_INCLUDE],[" -I$SZLIB_ROOT/include"])],
[AC_MSG_NOTICE([$SZLIB_ROOT is not a directory! SZLIB suppressed])])])],
......@@ -108,10 +96,7 @@ AC_ARG_WITH([hdf5],
AC_SUBST([HDF5_INCLUDE],[""])],
[*],[HDF5_ROOT=$with_hdf5
AS_IF([test -d "$HDF5_ROOT"],
[LDFLAGS_org="$LDFLAGS"
CPPFLAGS_org="$CPPFLAGS"
LIBS_org="$LIBS"
LDFLAGS="-L$HDF5_ROOT/lib $LDFLAGS"
[LDFLAGS="-L$HDF5_ROOT/lib $LDFLAGS"
CPPFLAGS="-I$HDF5_ROOT/include $CPPFLAGS"
AC_CHECK_HEADERS([hdf5.h])
AC_SEARCH_LIBS([H5Fopen],
......@@ -126,9 +111,6 @@ AC_ARG_WITH([hdf5],
--with-zlib option. If HDF5 was also built with szlib, then the location of szlib must also be \
specified with the --with-szlib option..])
have_hdf5_hl=no])
LDFLAGS="$LDFLAGS_org"
CPPFLAGS="$CPPFLAGS_org"
LIBS="$LIBS_org"
AS_IF([test "x$have_libhdf5_hl" = 'xyes'],
[AC_SUBST([HDF5_LDFLAGS],[" -L$HDF5_ROOT/lib -lhdf5_hl -lhdf5"])],
[AC_SUBST([HDF5_LDFLAGS],[" -L$HDF5_ROOT/lib -lhdf5"])])
......@@ -152,19 +134,13 @@ AC_ARG_WITH([netcdf],
AC_SUBST([NETCDF_INCLUDE],[""])],
[*],[NETCDF_ROOT=$with_netcdf
AS_IF([test -d "$NETCDF_ROOT"],
[LDFLAGS_org="$LDFLAGS"
CPPFLAGS_org="$CPPFLAGS"
LIBS_org="$LIBS"
LDFLAGS="-L$NETCDF_ROOT/lib $LDFLAGS"
[LDFLAGS="-L$NETCDF_ROOT/lib $LDFLAGS"
CPPFLAGS="-I$NETCDF_ROOT/include $CPPFLAGS"
AC_CHECK_HEADERS([netcdf.h])
AC_SEARCH_LIBS([nc_open],
[netcdf],
[AC_DEFINE([HAVE_LIBNETCDF],[1],[Define to 1 for NETCDF support])],
[AC_MSG_ERROR([Could not link to netcdf library])])
LDFLAGS="$LDFLAGS_org"
CPPFLAGS="$CPPFLAGS_org"
LIBS="$LIBS_org"
AC_SUBST([NETCDF_LDFLAGS],[" -L$NETCDF_ROOT/lib -lnetcdf"])
AC_SUBST([NETCDF_INCLUDE],[" -I$NETCDF_ROOT/include"])],
[AC_MSG_NOTICE([$NETCDF_ROOT is not a directory! NETCDF suppressed])])])],
......
......@@ -262,14 +262,9 @@ cdo_SOURCES += Arith.c \
vinterp.h \
zaxis.c
cdo_CPPFLAGS = -I$(top_srcdir)/libcdi/src @SZLIB_INCLUDE@ @HDF5_INCLUDE@ @NETCDF_INCLUDE@ @PROJ_INCLUDE@
cdo_LDADD = $(top_builddir)/libcdi/src/libcdi.la @LIBS@
cdo_LDFLAGS = @HDF5_LDFLAGS@ \
@NETCDF_LDFLAGS@ \
@GRIB_API_LDFLAGS@ \
@ZLIB_LDFLAGS@ \
@SZLIB_LDFLAGS@ \
@PROJ_LDFLAGS@
cdo_CPPFLAGS = -I$(top_srcdir)/libcdi/src
cdo_LDADD = $(top_builddir)/libcdi/src/libcdi.la
cdo_LDFLAGS =
if ENABLE_ALL_STATIC
cdo_LDFLAGS += -all-static
......
......@@ -163,8 +163,7 @@ cdo_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
$(LDFLAGS) -o $@
am_cdotest_OBJECTS = cdotest-cdotest.$(OBJEXT)
cdotest_OBJECTS = $(am_cdotest_OBJECTS)
am__DEPENDENCIES_1 = $(top_builddir)/libcdi/src/libcdi.la
cdotest_DEPENDENCIES = $(am__DEPENDENCIES_1)
cdotest_DEPENDENCIES = $(cdo_LDADD)
cdotest_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(cdotest_LDFLAGS) \
$(LDFLAGS) -o $@
......@@ -384,10 +383,9 @@ cdo_SOURCES = cdo.c Arith.c Arithc.c Arithdays.c Arithlat.c CDItest.c \
readline.c realtime.c remap.h remaplib.c specspace.c \
specspace.h statistic.c statistic.h table.c timebase.h timer.c \
userlog.c util.c util.h vinterp.c vinterp.h zaxis.c
cdo_CPPFLAGS = -I$(top_srcdir)/libcdi/src @SZLIB_INCLUDE@ @HDF5_INCLUDE@ @NETCDF_INCLUDE@ @PROJ_INCLUDE@
cdo_LDADD = $(top_builddir)/libcdi/src/libcdi.la @LIBS@
cdo_LDFLAGS = @HDF5_LDFLAGS@ @NETCDF_LDFLAGS@ @GRIB_API_LDFLAGS@ \
@ZLIB_LDFLAGS@ @SZLIB_LDFLAGS@ @PROJ_LDFLAGS@ $(am__append_1)
cdo_CPPFLAGS = -I$(top_srcdir)/libcdi/src
cdo_LDADD = $(top_builddir)/libcdi/src/libcdi.la
cdo_LDFLAGS = $(am__append_1)
cdotest_SOURCES = cdo_int.h \
cdotest.c
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment