Commit ad866e2c9aa54afc8d2a702ae078b43055d5bd4b

Werner Lemberg 2012-06-30T07:59:28

Fix `checking if gcc static flag -static works' test. On my linux build tree, I receive yes answer in in every package I build except freetype for this test checking if gcc static flag `-static' works On freetype, no is received, unless bzip2 and zlib are disabled using ./configure --without-bzip2 --without-zlib The reason is that bzip2 and zlib tests add `-lz' and `-lbz2' to LDFLAGS and this broke static flag test. * builds/unix/configure.raw: Update CFLAGS and LDFLAGS only after LT_INIT has run.

diff --git a/ChangeLog b/ChangeLog
index 0b1e438..c7cadad 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2012-06-30  Gilles Espinasse  <g.esp@free.fr>
+
+	Fix `checking if gcc static flag -static works' test.
+
+	On my linux build tree, I receive yes answer in in every package I
+	build except freetype for this test checking if gcc static flag
+	`-static' works
+
+	On freetype, no is received, unless bzip2 and zlib are disabled using
+
+	  ./configure --without-bzip2 --without-zlib
+
+	The reason is that bzip2 and zlib tests add `-lz' and `-lbz2' to
+	LDFLAGS and this broke static flag test.
+
+	* builds/unix/configure.raw: Update CFLAGS and LDFLAGS only after
+	LT_INIT has run.
+
 2012-06-28  Infinality  <infinality@infinality.net>
 
 	[truetype] Fix various artifacts.
diff --git a/builds/unix/configure.raw b/builds/unix/configure.raw
index 76fa0ca..78c8fb1 100644
--- a/builds/unix/configure.raw
+++ b/builds/unix/configure.raw
@@ -253,8 +253,6 @@ if test x$with_zlib != xno && test -z "$LIBZ"; then
   AC_CHECK_LIB([z], [gzsetparams], [AC_CHECK_HEADER([zlib.h], [LIBZ='-lz'])])
 fi
 if test x$with_zlib != xno && test -n "$LIBZ"; then
-  CFLAGS="$CFLAGS -DFT_CONFIG_OPTION_SYSTEM_ZLIB"
-  LDFLAGS="$LDFLAGS $LIBZ"
   SYSTEM_ZLIB=yes
 fi
 
@@ -268,8 +266,7 @@ if test x$with_bzip2 != xno && test -z "$LIBBZ2"; then
   AC_CHECK_LIB([bz2], [BZ2_bzDecompress], [AC_CHECK_HEADER([bzlib.h], [LIBBZ2='-lbz2'])])
 fi
 if test x$with_bzip2 != xno && test -n "$LIBBZ2"; then
-  CFLAGS="$CFLAGS -DFT_CONFIG_OPTION_USE_BZIP2"
-  LDFLAGS="$LDFLAGS $LIBBZ2"
+  SYSTEM_LIBBZ2=yes
 fi
 
 # Some options handling SDKs/archs in CFLAGS should be copied
@@ -688,18 +685,29 @@ esac
 AC_SUBST([ftmac_c])
 AC_SUBST([LIBZ])
 AC_SUBST([LIBBZ2])
-AC_SUBST([CFLAGS])
-AC_SUBST([LDFLAGS])
 AC_SUBST([FT2_EXTRA_LIBS])
 AC_SUBST([SYSTEM_ZLIB])
 
-
 LT_INIT(win32-dll)
 
 AC_SUBST([hardcode_libdir_flag_spec])
 AC_SUBST([wl])
 AC_SUBST([build_libtool_libs])
 
+# changing LDFLAGS value should only be done after
+# lt_cv_prog_compiler_static_works test
+if test x$SYSTEM_ZLIB = xyes; then
+  CFLAGS="$CFLAGS -DFT_CONFIG_OPTION_SYSTEM_ZLIB"
+  LDFLAGS="$LDFLAGS $LIBZ"
+fi
+
+if test x$SYSTEM_LIBBZ2 = xyes; then
+  CFLAGS="$CFLAGS -DFT_CONFIG_OPTION_USE_BZIP2"
+  LDFLAGS="$LDFLAGS $LIBBZ2"
+fi
+
+AC_SUBST([CFLAGS])
+AC_SUBST([LDFLAGS])
 
 # configuration file -- stay in 8.3 limit
 #