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.
This commit is contained in:
Werner Lemberg 2014-03-01 12:32:20 +01:00
parent 86026a47b3
commit 00c79ed968
5 changed files with 72 additions and 39 deletions

View File

@ -1,3 +1,16 @@
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.

View File

@ -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"

View File

@ -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

View File

@ -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}

View File

@ -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)|' \