Use pkg-config for detecting libpng and libbz2 also. * builds/unix/configure.raw (HAVE_PKG): New variable. Search for libbz2 using `pkg-config'; s/BZ2/BZIP2/. Search for libpng using `pkg-config'. Fix definition of `LIBHARFBUZZ' variable. * builds/unix/freetype-config.in ($libs): Updated. * builds/unix/freetype2.in: Add `URL' field. Update `Requires.private' and `Libs.private'. * builds/unix/unix-def.in: Updated.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253
diff --git a/ChangeLog b/ChangeLog
index aba2426..9bf5d7e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
2014-03-01 Werner Lemberg <wl@gnu.org>
+ Use pkg-config for detecting libpng and libbz2 also.
+
+ * builds/unix/configure.raw (HAVE_PKG): New variable.
+ Search for libbz2 using `pkg-config'; s/BZ2/BZIP2/.
+ Search for libpng using `pkg-config'.
+ Fix definition of `LIBHARFBUZZ' variable.
+ * builds/unix/freetype-config.in ($libs): Updated.
+ * builds/unix/freetype2.in: Add `URL' field.
+ Update `Requires.private' and `Libs.private'.
+ * builds/unix/unix-def.in: Updated.
+
+2014-03-01 Werner Lemberg <wl@gnu.org>
+
Add configure support for HarfBuzz.
* builds/unix/pkg.m4: New file.
diff --git a/builds/unix/configure.raw b/builds/unix/configure.raw
index 70ee00a..ca0048c 100644
--- a/builds/unix/configure.raw
+++ b/builds/unix/configure.raw
@@ -2,7 +2,7 @@
#
# Process this file with autoconf to produce a configure script.
#
-# Copyright 2001-2013 by
+# Copyright 2001-2014 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
@@ -284,52 +284,62 @@ if test x$with_zlib != xno && test -n "$LIBZ"; then
fi
+# All library tests below use `pkg-config'. The `XXX_PKG' variables are for
+# the `Requires.private' field in `freetype2.pc'; we use the `HAVE_PKG' flag
+# to insert commas between the entries.
+HAVE_PKG=no
+
+
# check for system libbz2
+HAVE_LIBBZIP2=no
# don't quote AS_HELP_STRING!
AC_ARG_WITH([bzip2],
AS_HELP_STRING([--without-bzip2],
[do not support bzip2 compressed fonts]))
-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
- SYSTEM_LIBBZ2=yes
+if test x$with_bzip2 != xno; then
+ BZIP2_PKG="bzip2"
+ # as a side effect, this call sets and creates output variables
+ # BZIP2_CFLAGS and BZIP2_LIBS
+ PKG_CHECK_MODULES([BZIP2], [$BZIP2_PKG])
+ LIBBZIP2=`$PKG_CONFIG --libs-only-l "$BZIP2_PKG"`
+ HAVE_LIBBZIP2=yes
+ AC_MSG_RESULT([$BZIP2_LIBS])
+ if test $HAVE_PKG = no; then
+ HAVE_PKG=yes
+ else
+ BZIP2_PKG=", $BZIP2_PKG"
+ fi
fi
# check for system libpng
HAVE_LIBPNG=no
+# don't quote AS_HELP_STRING!
AC_ARG_WITH([png],
AS_HELP_STRING([--without-png],
[do not support png compressed OpenType embedded bitmaps]))
if test x$with_png != xno; then
- AC_MSG_CHECKING([for libpng])
- if test -z "$LIBPNG_CFLAGS" -a -z "$LIBPNG_LDFLAGS"; then
- if ! which libpng-config >/dev/null; then
- AC_MSG_ERROR([`libpng-config' not found;
-either set the LIBPNG_CFLAGS and LIBPNG_LDFLAGS environment variables,
-or pass `--without-png' to the `configure' script.])
- elif test ${cross_compiling} = yes; then
- AC_MSG_ERROR([`libpng-config' should not be used in cross-building;
-either set the LIBPNG_CFLAGS and LIBPNG_LDFLAGS environment variables,
-or pass `--without-png' to the `configure' script.])
- fi
- LIBPNG="`libpng-config --libs`"
- LIBPNG_CFLAGS="`libpng-config --cflags`"
- LIBPNG_LDFLAGS="`libpng-config --ldflags`"
- fi
+ LIBPNG_PKG="libpng"
+ # as a side effect, this call sets and creates output variables
+ # LIBPNG_CFLAGS and LIBPNG_LIBS
+ PKG_CHECK_MODULES([LIBPNG], [$LIBPNG_PKG])
+ LIBPNG=`$PKG_CONFIG --libs-only-l "$LIBPNG_PKG"`
HAVE_LIBPNG=yes
- AC_MSG_RESULT([$LIBPNG_LDFLAGS])
+ AC_MSG_RESULT([$LIBPNG_LIBS])
+ if test $HAVE_PKG = no; then
+ HAVE_PKG=yes
+ else
+ LIBPNG_PKG=", $LIBPNG_PKG"
+ fi
fi
# check for system libharfbuzz
HAVE_HARFBUZZ=no
+# don't quote AS_HELP_STRING!
AC_ARG_WITH([harfbuzz],
AS_HELP_STRING([--without-harfbuzz],
[do not use improved auto-hinting of OpenType fonts]))
@@ -338,10 +348,14 @@ if test x$with_harfbuzz != xno; then
# as a side effect, this call sets and creates output variables
# HARFBUZZ_CFLAGS and HARFBUZZ_LIBS
PKG_CHECK_MODULES([HARFBUZZ], [$HARFBUZZ_PKG])
- # directly create and set output variable LIBHARFBUZZ
- _PKG_CONFIG([LIBHARFBUZZ], [libs-only-l], [$HARFBUZZ_PKG])
+ LIBHARFBUZZ=`$PKG_CONFIG --libs-only-l "$HARFBUZZ_PKG"`
HAVE_LIBHARFBUZZ=yes
AC_MSG_RESULT([$HARFBUZZ_LIBS])
+ if test $HAVE_PKG = no; then
+ HAVE_PKG=yes
+ else
+ HARFBUZZ_PKG=", $HARFBUZZ_PKG"
+ fi
fi
@@ -760,12 +774,14 @@ esac
AC_SUBST([ftmac_c])
AC_SUBST([LIBZ])
-AC_SUBST([LIBBZ2])
+AC_SUBST([LIBBZIP2])
AC_SUBST([LIBPNG])
-# LIBHARFBUZZ has already been substituted above
+AC_SUBST([LIBHARFBUZZ])
AC_SUBST([FT2_EXTRA_LIBS])
AC_SUBST([SYSTEM_ZLIB])
+AC_SUBST([BZIP2_PKG])
+AC_SUBST([LIBPNG_PKG])
AC_SUBST([HARFBUZZ_PKG])
LT_INIT(win32-dll)
@@ -776,18 +792,19 @@ 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"
+if test x$HAVE_LIBBZIP2 = xyes; then
+ CFLAGS="$CFLAGS $LIBBZIP2_CFLAGS -DFT_CONFIG_OPTION_USE_BZIP2"
+ LDFLAGS="$LDFLAGS $LIBBZIP2_LIBS"
fi
if test x$HAVE_LIBPNG = xyes; then
CFLAGS="$CFLAGS $LIBPNG_CFLAGS -DFT_CONFIG_OPTION_USE_PNG"
- LDFLAGS="$LDFLAGS $LIBPNG_LDFLAGS"
+ LDFLAGS="$LDFLAGS $LIBPNG_LIBS"
fi
if test x$HAVE_LIBHARFBUZZ = xyes; then
CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS -DFT_CONFIG_OPTION_USE_HARFBUZZ"
diff --git a/builds/unix/freetype-config.in b/builds/unix/freetype-config.in
index 7913f5f..7221d83 100644
--- a/builds/unix/freetype-config.in
+++ b/builds/unix/freetype-config.in
@@ -137,7 +137,7 @@ if test "$echo_cflags" = "yes" ; then
fi
if test "$echo_libs" = "yes" ; then
- libs="-lfreetype %LIBZ% %LIBBZ2% %LIBPNG% %LIBHARFBUZZ% %FT2_EXTRA_LIBS%"
+ libs="-lfreetype %LIBZ% %LIBBZIP2% %LIBPNG% %LIBHARFBUZZ% %FT2_EXTRA_LIBS%"
if test "${SYSROOT}$libdir" != "/usr/lib" &&
test "${SYSROOT}$libdir" != "/usr/lib64"; then
echo -L${SYSROOT}$libdir $libs
diff --git a/builds/unix/freetype2.in b/builds/unix/freetype2.in
index 86b20a7..9747e09 100644
--- a/builds/unix/freetype2.in
+++ b/builds/unix/freetype2.in
@@ -4,10 +4,11 @@ libdir="%libdir%"
includedir="%includedir%/freetype2"
Name: FreeType 2
+URL: http://freetype.org
Description: A free, high-quality, and portable font engine.
Version: %ft_version%
Requires:
-Requires.private: %HARFBUZZ_PKG%
+Requires.private: %BZIP2_PKG%%LIBPNG_PKG%%HARFBUZZ_PKG%
Libs: -L${libdir} -lfreetype
-Libs.private: %LIBZ% %LIBBZ2% %LIBPNG% %FT2_EXTRA_LIBS%
+Libs.private: %LIBZ% %FT2_EXTRA_LIBS%
Cflags: -I${includedir}
diff --git a/builds/unix/unix-def.in b/builds/unix/unix-def.in
index 058aa13..2e5f9e5 100644
--- a/builds/unix/unix-def.in
+++ b/builds/unix/unix-def.in
@@ -63,12 +63,14 @@ version_info := @version_info@
# Variables needed for `freetype-config' and `freetype.pc'.
#
FT2_EXTRA_LIBS := @FT2_EXTRA_LIBS@
-LIBBZ2 := @LIBBZ2@
LIBZ := @LIBZ@
+LIBBZIP2 := @LIBBZIP2@
LIBPNG := @LIBPNG@
LIBHARFBUZZ := @LIBHARFBUZZ@
build_libtool_libs := @build_libtool_libs@
ft_version := @ft_version@
+BZIP2_PKG := @BZIP2_PKG@
+LIBPNG_PKG := @LIBPNG_PKG@
HARFBUZZ_PKG := @HARFBUZZ_PKG@
# The directory where all library files are placed.
@@ -105,8 +107,8 @@ NO_OUTPUT := 2> /dev/null
$(OBJ_BUILD)/freetype-config: $(TOP_DIR)/builds/unix/freetype-config.in
rm -f $@ $@.tmp
sed -e 's|%FT2_EXTRA_LIBS%|$(FT2_EXTRA_LIBS)|' \
- -e 's|%LIBBZ2%|$(LIBBZ2)|' \
-e 's|%LIBZ%|$(LIBZ)|' \
+ -e 's|%LIBBZIP2%|$(LIBBZIP2)|' \
-e 's|%LIBPNG%|$(LIBPNG)|' \
-e 's|%LIBHARFBUZZ%|$(LIBHARFBUZZ)|' \
-e 's|%build_libtool_libs%|$(build_libtool_libs)|' \
@@ -124,9 +126,9 @@ $(OBJ_BUILD)/freetype-config: $(TOP_DIR)/builds/unix/freetype-config.in
$(OBJ_BUILD)/freetype2.pc: $(TOP_DIR)/builds/unix/freetype2.in
rm -f $@ $@.tmp
sed -e 's|%FT2_EXTRA_LIBS%|$(FT2_EXTRA_LIBS)|' \
- -e 's|%LIBBZ2%|$(LIBBZ2)|' \
-e 's|%LIBZ%|$(LIBZ)|' \
- -e 's|%LIBPNG%|$(LIBPNG)|' \
+ -e 's|%BZIP2_PKG%|$(BZIP2_PKG)|' \
+ -e 's|%LIBPNG_PKG%|$(LIBPNG_PKG)|' \
-e 's|%HARFBUZZ_PKG%|$(HARFBUZZ_PKG)|' \
-e 's|%build_libtool_libs%|$(build_libtool_libs)|' \
-e 's|%exec_prefix%|$(exec_prefix)|' \