changeset 9538:d0239bddf621

use OCTAVE_CHECK_LIB to check for zlib
author John W. Eaton <jwe@octave.org>
date Mon, 17 Aug 2009 19:52:18 -0400
parents 8f8cb45ad674
children 41a74dcd14df
files ChangeLog Makeconf.in configure.in mkoctfile.cc.in mkoctfile.in octave-bug.cc.in octave-bug.in src/ChangeLog src/Makefile.in src/oct-conf.h.in src/toplev.cc
diffstat 11 files changed, 100 insertions(+), 48 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Aug 17 18:57:48 2009 -0400
+++ b/ChangeLog	Mon Aug 17 19:52:18 2009 -0400
@@ -1,3 +1,23 @@
+2009-08-17  John W. Eaton  <jwe@octave.org>
+
+	* mkoctfile.in, mkoctfile.cc.in (FFTW3_LDFLAGS, FFTW3_LIBS,
+	FFTW3F_LDFLAGS, FFTW3F_LIBS): Substitute instead of FFTW_LIBS.
+	(FFTW_LIBS): Define from FFTW3_LDFLAGS, FFTW3_LIBS,
+	FFTW3F_LDFLAGS, and FFTW3F_LIBS variables.
+
+	* octave-bug.cc.in, octave-bug.in (Z_CPPFLAGS, Z_LDFLAGS):
+	Substitute and display them.
+	(Z_LIBS): Rename from ZLIB_LIBS.
+	* configure.in: Use OCTAVE_CHECK_LIBRARY to check for ZLIB.
+	Print Z_CPPFLAGS and Z_LDFLAGS in the summary.
+	* Makeconf.in (Z_CPPFLAGS, Z_LDFLAGS): New variables.
+	(Z_LIBS): Rename from ZLIB_LIBS.
+	(do-subst-config-vals): Substitute them.
+
+	(ALL_CPPFLAGS): New variable.
+	(%.o : %.c, %.o : %.cc, pic/%.o : %.c, pic/%.o : %.cc):
+	Use $(ALL_CPPFLAGS) instead of $(CPPFLAGS) in command.
+
 2009-08-17  John W. Eaton  <jwe@octave.org>
 
 	* octave-bug.in, octave-bug.cc.in: Include AMD_CPPFLAGS,
--- a/Makeconf.in	Mon Aug 17 18:57:48 2009 -0400
+++ b/Makeconf.in	Mon Aug 17 19:52:18 2009 -0400
@@ -229,7 +229,11 @@
 
 FT2_LIBS = @FT2_LIBS@
 HDF5_LIBS = @HDF5_LIBS@
-ZLIB_LIBS = @ZLIB_LIBS@
+
+Z_CPPFLAGS = @Z_CPPFLAGS@
+Z_LDFLAGS = @Z_LDFLAGS@
+Z_LIBS = @Z_LIBS@
+
 GRAPHICS_LIBS = @GRAPHICS_LIBS@
 
 QHULL_CPPFLAGS = @QHULL_CPPFLAGS@
@@ -289,6 +293,8 @@
 DL_LIBS = @DL_LIBS@
 LIBS = @LIBS@
 
+ALL_CPPFLAGS = $(CPPFLAGS) $(Z_CPPFLAGS)
+
 ## Use sort to remove duplicates.
 SPARSE_CPPFLAGS = \
   $(sort $(AMD_CPPFLAGS) $(CAMD_CPPFLAGS) $(COLAMD_CPPFLAGS) \
@@ -463,19 +469,19 @@
 	$(FC) -c $(ALL_FFLAGS) -o $@ $<
 
 %.o : %.c
-	$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $< -o $@
+	$(CC) -c $(ALL_CPPFLAGS) $(ALL_CFLAGS) $< -o $@
 
 %.o : %.cc
-	$(CXX) -c $(CPPFLAGS) $(ALL_CXXFLAGS) $< -o $@
+	$(CXX) -c $(ALL_CPPFLAGS) $(ALL_CXXFLAGS) $< -o $@
 
 pic/%.o : %.f
 	$(FC) -c $(FPICFLAG) $(ALL_FFLAGS) $< -o $@
 
 pic/%.o : %.c
-	$(CC) -c $(CPPFLAGS) $(CPICFLAG) $(ALL_CFLAGS) $< -o $@
+	$(CC) -c $(ALL_CPPFLAGS) $(CPICFLAG) $(ALL_CFLAGS) $< -o $@
 
 pic/%.o : %.cc
-	$(CXX) -c $(CPPFLAGS) $(CXXPICFLAG) $(ALL_CXXFLAGS) $< -o $@
+	$(CXX) -c $(ALL_CPPFLAGS) $(CXXPICFLAG) $(ALL_CXXFLAGS) $< -o $@
 
 # Here is a rule for generating dependencies for .cc files:
 
@@ -661,7 +667,9 @@
   -e "s|%OCTAVE_CONF_XTRA_CXXFLAGS%|\"${XTRA_CXXFLAGS}\"|" \
   -e "s|%OCTAVE_CONF_YACC%|\"${YACC}\"|" \
   -e "s|%OCTAVE_CONF_YFLAGS%|\"${YFLAGS}\"|" \
-  -e "s|%OCTAVE_CONF_ZLIB_LIBS%|\"${ZLIB_LIBS}\"|" \
+  -e "s|%OCTAVE_CONF_Z_CPPFLAGS%|\"${Z_CPPFLAGS}\"|" \
+  -e "s|%OCTAVE_CONF_Z_LDFLAGS%|\"${Z_LDFLAGS}\"|" \
+  -e "s|%OCTAVE_CONF_Z_LIBS%|\"${Z_LIBS}\"|" \
   -e "s|%OCTAVE_CONF_config_opts%|\"${config_opts}\"|" | \
   $(SED)  -e "s|%OCTAVE_CONF_DEFS%|\"${UGLY_DEFS}\"|" > $@-t
 $(simple-move-if-change-rule)
--- a/configure.in	Mon Aug 17 18:57:48 2009 -0400
+++ b/configure.in	Mon Aug 17 19:52:18 2009 -0400
@@ -490,31 +490,13 @@
 
 ### Check for ZLIB library.
 
-WITH_ZLIB=true
-AC_ARG_WITH(zlib,
-  [AS_HELP_STRING([--without-zlib], [don't use zlib])],
-  with_zlib=$withval, with_zlib=yes)
-
-zlib_lib=
-if test "$with_zlib" = yes; then
-  zlib_lib="z"
-elif test "$with_zlib" != no; then
-  zlib_lib="$with_zlib"
-fi
+OCTAVE_CHECK_LIBRARY(z, ZLIB,
+  [ZLIB library not found.  Octave will not be able to save or load compressed data files or HDF5 files.],
+  [zlib.h], [gzclearerr])
 
-ZLIB_LIBS=
-WITH_ZLIB=false
-if test -n "$zlib_lib"; then
-  AC_CHECK_LIB($zlib_lib, gzclearerr, [
-    AC_CHECK_HEADERS(zlib.h, [
-      WITH_ZLIB=true
-      ZLIB_LIBS="-l$zlib_lib"
-      AC_DEFINE(HAVE_ZLIB, 1, [Define if ZLIB is available.])])])
-fi
-AC_SUBST(ZLIB_LIBS)
+### Check for HDF5 library.
 
-if $WITH_ZLIB; then
-  ### Check for HDF5 library.
+if $WITH_Z; then
 
   WITH_HDF5=true
   AC_ARG_WITH(hdf5,
@@ -536,7 +518,7 @@
         WITH_HDF5=true
         HDF5_LIBS="-l$hdf5_lib"
         save_LIBS="$LIBS"
-        LIBS="$HDF5_LIBS $ZLIB_LIBS $LIBS"
+        LIBS="$HDF5_LIBS $Z_LIBS $LIBS"
 	AC_CHECK_LIB($hdf5_lib, H5Gget_num_objs, [
           OCTAVE_HDF5_HAS_REQUIRED_API
           if test $WITH_HDF5; then
@@ -553,9 +535,6 @@
         ;;
     esac
   fi
-else
-  warn_zlib="ZLIB library not found.  Octave will not be able to save or load compressed data files or HDF5 files."
-  AC_MSG_WARN($warn_zlib)
 fi
 AC_SUBST(HDF5_LIBS)
 
@@ -2103,7 +2082,9 @@
   UMFPACK libraries:    $UMFPACK_LIBS
   X11 include flags:    $X11_INCFLAGS
   X11 libraries:        $X11_LIBS
-  ZLIB libraries:       $ZLIB_LIBS
+  Z CPPFLAGS:           $Z_CPPFLAGS
+  Z LDFLAGS:            $Z_LDFLAGS
+  Z libraries:          $Z_LIBS
 
   Default pager:        $DEFAULT_PAGER
   gnuplot:              $GNUPLOT
--- a/mkoctfile.cc.in	Mon Aug 17 18:57:48 2009 -0400
+++ b/mkoctfile.cc.in	Mon Aug 17 19:52:18 2009 -0400
@@ -224,7 +224,10 @@
   vars["READLINE_LIBS"] = "-lreadline";
   vars["LIBCRUFT"] = "-lcruft";
   vars["BLAS_LIBS"] = get_variable ("BLAS_LIBS", %OCTAVE_CONF_BLAS_LIBS%);
-  vars["FFTW_LIBS"] = get_variable ("FFTW_LIBS", %OCTAVE_CONF_FFTW_LIBS%);
+  vars["FFTW3_LDFLAGS"] = get_variable ("FFTW3_LDFLAGS", %OCTAVE_CONF_FFTW3_LDFLAGS%);
+  vars["FFTW3_LIBS"] = get_variable ("FFTW3_LIBS", %OCTAVE_CONF_FFTW3_LIBS%);
+  vars["FFTW3F_LDFLAGS"] = get_variable ("FFTW3F_LDFLAGS", %OCTAVE_CONF_FFTW3F_LDFLAGS%);
+  vars["FFTW3F_LIBS"] = get_variable ("FFTW3F_LIBS", %OCTAVE_CONF_FFTW3F_LIBS%);
   vars["LIBS"] = get_variable ("LIBS", %OCTAVE_CONF_LIBS%);
   vars["FLIBS"] = get_variable ("FLIBS", %OCTAVE_CONF_FLIBS%);
   vars["LD_CXX"] = get_variable ("LD_CXX", %OCTAVE_CONF_LD_CXX%);
@@ -245,6 +248,9 @@
 
   vars["OCTAVE_LIBS"] = vars["LIBOCTINTERP"] + " " + vars["LIBOCTAVE"]
     + " " + vars["SPECIAL_MATH_LIB"] + " " + vars["LIBCRUFT"];
+
+  vars["FFTW_LIBS"] = vars["FFTW3_LDFLAGS"] + " " + vars["FFTW3_LIBS"]
+    + " " | vars["FFTW3F_LDFLAGS"] + " " + vars["FFTW3F_LIBS"];
 }
 
 static string usage_msg = "usage: mkoctfile [options] file ...";
--- a/mkoctfile.in	Mon Aug 17 18:57:48 2009 -0400
+++ b/mkoctfile.in	Mon Aug 17 19:52:18 2009 -0400
@@ -93,7 +93,10 @@
 : ${READLINE_LIBS=-lreadline}
 : ${LIBCRUFT=-lcruft}
 : ${BLAS_LIBS=%OCTAVE_CONF_BLAS_LIBS%}
-: ${FFTW_LIBS=%OCTAVE_CONF_FFTW_LIBS%}
+: ${FFTW3_LDFLAGS=%OCTAVE_CONF_FFTW3_LDFLAGS%}
+: ${FFTW3_LIBS=%OCTAVE_CONF_FFTW3_LIBS%}
+: ${FFTW3F_LDFLAGS=%OCTAVE_CONF_FFTW3F_LDFLAGS%}
+: ${FFTW3F_LIBS=%OCTAVE_CONF_FFTW3F_LIBS%}
 : ${LIBS=%OCTAVE_CONF_LIBS%}
 : ${FLIBS=%OCTAVE_CONF_FLIBS%}
 : ${LD_CXX=%OCTAVE_CONF_LD_CXX%}
@@ -113,6 +116,8 @@
 
 # Local variables.
 
+FFTW_LIBS="$FFTW3_LDFLAGS $FFTW3_LIBS $FFTW3F_LDFLAGS $FFTW3F_LIBS"
+
 usage_msg="usage: mkoctfile [options] file ..."
 
 version_msg="mkoctfile, version $OCTAVE_VERSION"
--- a/octave-bug.cc.in	Mon Aug 17 18:57:48 2009 -0400
+++ b/octave-bug.cc.in	Mon Aug 17 19:52:18 2009 -0400
@@ -150,7 +150,9 @@
   vars["UMFPACK_LIBS"] = %UMFPACK_LIBS%;
   vars["X11_INCFLAGS"] = %X11_INCFLAGS%;
   vars["X11_LIBS"] = %X11_LIBS%;
-  vars["ZLIB_LIBS"] = %ZLIB_LIBS%;
+  vars["Z_CPPFLAGS"] = %Z_CPPFLAGS%;
+  vars["Z_LDFLAGS"] = %Z_LDFLAGS%;
+  vars["Z_LIBS"] = %Z_LIBS%;
 
   vars["DEFS"] = %OCTAVE_CONF_DEFS%;
 
@@ -284,7 +286,9 @@
   os << "UMFPACK_LIBS:      " << vars["UMFPACK_LIBS"] << endl;
   os << "X11_INCFLAGS:      " << vars["X11_INCFLAGS"] << endl;
   os << "X11_LIBS:          " << vars["X11_LIBS"] << endl;
-  os << "ZLIB_LIBS:         " << vars["ZLIB_LIBS"] << endl;
+  os << "Z_CPPFLAGS:        " << vars["Z_CPPFLAGS"] << endl;
+  os << "Z_LDFLAGS:         " << vars["Z_LDFLAGS"] << endl;
+  os << "Z_LIBS:            " << vars["Z_LIBS"] << endl;
   os << "DEFS:" << endl << vars["DEFS"] << endl;
   os << endl;
 
--- a/octave-bug.in	Mon Aug 17 18:57:48 2009 -0400
+++ b/octave-bug.in	Mon Aug 17 19:52:18 2009 -0400
@@ -102,7 +102,9 @@
 UMFPACK_LIBS=%UMFPACK_LIBS%
 X11_INCFLAGS=%X11_INCFLAGS%
 X11_LIBS=%X11_LIBS%
-ZLIB_LIBS=%ZLIB_LIBS%
+Z_CPPFLAGS=%Z_CPPFLAGS%
+Z_LDFLAGS=%Z_LDFLAGS%
+Z_LIBS=%Z_LIBS%
 
 DEFS=%OCTAVE_CONF_DEFS%
 
@@ -345,7 +347,9 @@
 UMFPACK_LIBS:      $UMFPACK_LIBS
 X11_INCFLAGS:      $X11_INCFLAGS
 X11_LIBS:          $X11_LIBS
-ZLIB_LIBS:         $ZLIB_LIBS
+Z_CPPFLAGS:        $Z_CPPFLAGS
+Z_LDFLAGS:         $Z_LDFLAGS
+Z_LIBS:            $Z_LIBS
 DEFS:
 
 EOF
--- a/src/ChangeLog	Mon Aug 17 18:57:48 2009 -0400
+++ b/src/ChangeLog	Mon Aug 17 19:52:18 2009 -0400
@@ -1,3 +1,8 @@
+2009-08-17  John W. Eaton  <jwe@octave.org>
+
+	* oct-conf.h.in: New #defines for ZLIB_CPPFLAGS and ZLIB_LDFLAGS.
+	* toplev.cc (octave_config_info): Include them in the list.
+
 2009-08-17  John W. Eaton  <jwe@octave.org>
 
 	* Makefile.in (OCTINTERP_LINK_DEPS): Include FFTW_LDFLAGS,
--- a/src/Makefile.in	Mon Aug 17 18:57:48 2009 -0400
+++ b/src/Makefile.in	Mon Aug 17 19:52:18 2009 -0400
@@ -286,7 +286,17 @@
 DOC_FILES := $(sort $(DEF_FILES))
 
 ifeq ($(ENABLE_DYNAMIC_LINKING), true)
-  OCTAVE_LIBS = $(LIBOCTINTERP)
+  OCTAVE_LIBS = -L. $(LIBOCTINTERP) \
+    -L../liboctave $(LIBOCTAVE) \
+    -L../libcruft $(LIBCRUFT) \
+    $(FFTW_LDFLAGS) $(FFTW_LIBS) \
+    $(GRAPHICS_LDFLAGS) $(GRAPHICS_LIBS) \
+    $(FT2_LDFLAGS) $(FT2_LIBS) \
+    $(HDF5_LIBS) $(Z_LDFLAGS) $(Z_LIBS) \
+    $(OPENGL_LIBS) $(X11_LIBS) $(CARBON_LIBS) \
+    $(READLINE_LIBS) $(TERM_LIBS) \
+    $(LIBGLOB) \
+    $(LIBS)
 else
   ## FIXME -- this list is probably not complete now.  It may not even
   ## be possible to build a statically linked copy of Octave that is
@@ -306,7 +316,7 @@
     $(MAGICK_LIBS) \
     $(GRAPHICS_LDFLAGS) $(GRAPHICS_LIBS) \
     $(FT2_LDFLAGS) $(FT2_LIBS) \
-    $(HDF5_LIBS) $(ZLIB_LIBS) \
+    $(HDF5_LIBS) $(Z_LDFLAGS) $(Z_LIBS) \
     $(OPENGL_LIBS) $(X11_LIBS) $(CARBON_LIBS) \
     $(READLINE_LIBS) $(TERM_LIBS) \
     $(LIBPLPLOT) $(LIBGLOB) \
@@ -316,7 +326,7 @@
 OCTINTERP_LINK_DEPS = $(RLD_FLAG) -L../liboctave $(LIBOCTAVE) \
   -L../libcruft $(LIBCRUFT) \
   $(FFTW_LDFLAGS) $(FFTW_LIBS) \
-  $(HDF5_LIBS) $(ZLIB_LIBS) \
+  $(HDF5_LIBS) $(Z_LDFLAGS) $(Z_LIBS) \
   $(OPENGL_LIBS) $(X11_LIBS) $(CARBON_LIBS) \
   $(READLINE_LIBS) \
   $(LIBS)
@@ -390,8 +400,7 @@
 	$(LD_CXX) $(CPPFLAGS) $(ALL_CXXFLAGS) $(RDYNAMIC_FLAG) \
 	$(ALL_LDFLAGS) -o $@ main.o $(DLD_STATIC_OBJ) \
 	$(RLD_FLAG) \
-	-L. $(LIBOCTINTERP) -L../liboctave $(LIBOCTAVE) \
-	-L../libcruft $(LIBCRUFT)
+	$(OCTAVE_LIBS)
 
 stmp-pic: pic
 	@if [ -f stmp-pic ]; then \
--- a/src/oct-conf.h.in	Mon Aug 17 18:57:48 2009 -0400
+++ b/src/oct-conf.h.in	Mon Aug 17 19:52:18 2009 -0400
@@ -497,8 +497,16 @@
 #define OCTAVE_CONF_YFLAGS %OCTAVE_CONF_YFLAGS%
 #endif
 
-#ifndef OCTAVE_CONF_ZLIB_LIBS
-#define OCTAVE_CONF_ZLIB_LIBS %OCTAVE_CONF_ZLIB_LIBS%
+#ifndef OCTAVE_CONF_Z_CPPFLAGS
+#define OCTAVE_CONF_Z_CPPFLAGS %OCTAVE_CONF_Z_CPPFLAGS%
+#endif
+
+#ifndef OCTAVE_CONF_Z_LDFLAGS
+#define OCTAVE_CONF_Z_LDFLAGS %OCTAVE_CONF_Z_LDFLAGS%
+#endif
+
+#ifndef OCTAVE_CONF_Z_LIBS
+#define OCTAVE_CONF_Z_LIBS %OCTAVE_CONF_Z_LIBS%
 #endif
 
 #ifndef OCTAVE_CONF_config_opts
--- a/src/toplev.cc	Mon Aug 17 18:57:48 2009 -0400
+++ b/src/toplev.cc	Mon Aug 17 19:52:18 2009 -0400
@@ -1304,7 +1304,9 @@
       { false, "XTRA_CXXFLAGS", OCTAVE_CONF_XTRA_CXXFLAGS },
       { false, "YACC", OCTAVE_CONF_YACC },
       { false, "YFLAGS", OCTAVE_CONF_YFLAGS },
-      { false, "ZLIB_LIBS", OCTAVE_CONF_ZLIB_LIBS },
+      { false, "Z_CPPFLAGS", OCTAVE_CONF_Z_CPPFLAGS },
+      { false, "Z_LDFLAGS", OCTAVE_CONF_Z_LDFLAGS },
+      { false, "Z_LIBS", OCTAVE_CONF_Z_LIBS },
       { false, "api_version", OCTAVE_API_VERSION },
       { true, "archlibdir", OCTAVE_ARCHLIBDIR },
       { true, "bindir", OCTAVE_BINDIR },