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> 2014-03-01 Werner Lemberg <wl@gnu.org>
Add configure support for HarfBuzz. Add configure support for HarfBuzz.

View File

@ -2,7 +2,7 @@
# #
# Process this file with autoconf to produce a configure script. # 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. # David Turner, Robert Wilhelm, and Werner Lemberg.
# #
# This file is part of the FreeType project, and may only be used, modified, # 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 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 # check for system libbz2
HAVE_LIBBZIP2=no
# don't quote AS_HELP_STRING! # don't quote AS_HELP_STRING!
AC_ARG_WITH([bzip2], AC_ARG_WITH([bzip2],
AS_HELP_STRING([--without-bzip2], AS_HELP_STRING([--without-bzip2],
[do not support bzip2 compressed fonts])) [do not support bzip2 compressed fonts]))
if test x$with_bzip2 != xno && test -z "$LIBBZ2"; then if test x$with_bzip2 != xno; then
AC_CHECK_LIB([bz2], BZIP2_PKG="bzip2"
[BZ2_bzDecompress], # as a side effect, this call sets and creates output variables
[AC_CHECK_HEADER([bzlib.h], [LIBBZ2='-lbz2'])]) # BZIP2_CFLAGS and BZIP2_LIBS
fi PKG_CHECK_MODULES([BZIP2], [$BZIP2_PKG])
if test x$with_bzip2 != xno && test -n "$LIBBZ2"; then LIBBZIP2=`$PKG_CONFIG --libs-only-l "$BZIP2_PKG"`
SYSTEM_LIBBZ2=yes HAVE_LIBBZIP2=yes
AC_MSG_RESULT([$BZIP2_LIBS])
if test $HAVE_PKG = no; then
HAVE_PKG=yes
else
BZIP2_PKG=", $BZIP2_PKG"
fi
fi fi
# check for system libpng # check for system libpng
HAVE_LIBPNG=no HAVE_LIBPNG=no
# don't quote AS_HELP_STRING!
AC_ARG_WITH([png], AC_ARG_WITH([png],
AS_HELP_STRING([--without-png], AS_HELP_STRING([--without-png],
[do not support png compressed OpenType embedded bitmaps])) [do not support png compressed OpenType embedded bitmaps]))
if test x$with_png != xno; then if test x$with_png != xno; then
AC_MSG_CHECKING([for libpng]) LIBPNG_PKG="libpng"
if test -z "$LIBPNG_CFLAGS" -a -z "$LIBPNG_LDFLAGS"; then # as a side effect, this call sets and creates output variables
if ! which libpng-config >/dev/null; then # LIBPNG_CFLAGS and LIBPNG_LIBS
AC_MSG_ERROR([`libpng-config' not found; PKG_CHECK_MODULES([LIBPNG], [$LIBPNG_PKG])
either set the LIBPNG_CFLAGS and LIBPNG_LDFLAGS environment variables, LIBPNG=`$PKG_CONFIG --libs-only-l "$LIBPNG_PKG"`
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
HAVE_LIBPNG=yes 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 fi
# check for system libharfbuzz # check for system libharfbuzz
HAVE_HARFBUZZ=no HAVE_HARFBUZZ=no
# don't quote AS_HELP_STRING!
AC_ARG_WITH([harfbuzz], AC_ARG_WITH([harfbuzz],
AS_HELP_STRING([--without-harfbuzz], AS_HELP_STRING([--without-harfbuzz],
[do not use improved auto-hinting of OpenType fonts])) [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 # as a side effect, this call sets and creates output variables
# HARFBUZZ_CFLAGS and HARFBUZZ_LIBS # HARFBUZZ_CFLAGS and HARFBUZZ_LIBS
PKG_CHECK_MODULES([HARFBUZZ], [$HARFBUZZ_PKG]) PKG_CHECK_MODULES([HARFBUZZ], [$HARFBUZZ_PKG])
# directly create and set output variable LIBHARFBUZZ LIBHARFBUZZ=`$PKG_CONFIG --libs-only-l "$HARFBUZZ_PKG"`
_PKG_CONFIG([LIBHARFBUZZ], [libs-only-l], [$HARFBUZZ_PKG])
HAVE_LIBHARFBUZZ=yes HAVE_LIBHARFBUZZ=yes
AC_MSG_RESULT([$HARFBUZZ_LIBS]) AC_MSG_RESULT([$HARFBUZZ_LIBS])
if test $HAVE_PKG = no; then
HAVE_PKG=yes
else
HARFBUZZ_PKG=", $HARFBUZZ_PKG"
fi
fi fi
@ -760,12 +774,14 @@ esac
AC_SUBST([ftmac_c]) AC_SUBST([ftmac_c])
AC_SUBST([LIBZ]) AC_SUBST([LIBZ])
AC_SUBST([LIBBZ2]) AC_SUBST([LIBBZIP2])
AC_SUBST([LIBPNG]) AC_SUBST([LIBPNG])
# LIBHARFBUZZ has already been substituted above AC_SUBST([LIBHARFBUZZ])
AC_SUBST([FT2_EXTRA_LIBS]) AC_SUBST([FT2_EXTRA_LIBS])
AC_SUBST([SYSTEM_ZLIB]) AC_SUBST([SYSTEM_ZLIB])
AC_SUBST([BZIP2_PKG])
AC_SUBST([LIBPNG_PKG])
AC_SUBST([HARFBUZZ_PKG]) AC_SUBST([HARFBUZZ_PKG])
LT_INIT(win32-dll) LT_INIT(win32-dll)
@ -776,18 +792,19 @@ AC_SUBST([build_libtool_libs])
# changing LDFLAGS value should only be done after # changing LDFLAGS value should only be done after
# lt_cv_prog_compiler_static_works test # lt_cv_prog_compiler_static_works test
if test x$SYSTEM_ZLIB = xyes; then if test x$SYSTEM_ZLIB = xyes; then
CFLAGS="$CFLAGS -DFT_CONFIG_OPTION_SYSTEM_ZLIB" CFLAGS="$CFLAGS -DFT_CONFIG_OPTION_SYSTEM_ZLIB"
LDFLAGS="$LDFLAGS $LIBZ" LDFLAGS="$LDFLAGS $LIBZ"
fi fi
if test x$SYSTEM_LIBBZ2 = xyes; then if test x$HAVE_LIBBZIP2 = xyes; then
CFLAGS="$CFLAGS -DFT_CONFIG_OPTION_USE_BZIP2" CFLAGS="$CFLAGS $LIBBZIP2_CFLAGS -DFT_CONFIG_OPTION_USE_BZIP2"
LDFLAGS="$LDFLAGS $LIBBZ2" LDFLAGS="$LDFLAGS $LIBBZIP2_LIBS"
fi fi
if test x$HAVE_LIBPNG = xyes; then if test x$HAVE_LIBPNG = xyes; then
CFLAGS="$CFLAGS $LIBPNG_CFLAGS -DFT_CONFIG_OPTION_USE_PNG" CFLAGS="$CFLAGS $LIBPNG_CFLAGS -DFT_CONFIG_OPTION_USE_PNG"
LDFLAGS="$LDFLAGS $LIBPNG_LDFLAGS" LDFLAGS="$LDFLAGS $LIBPNG_LIBS"
fi fi
if test x$HAVE_LIBHARFBUZZ = xyes; then if test x$HAVE_LIBHARFBUZZ = xyes; then
CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS -DFT_CONFIG_OPTION_USE_HARFBUZZ" CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS -DFT_CONFIG_OPTION_USE_HARFBUZZ"

View File

@ -137,7 +137,7 @@ if test "$echo_cflags" = "yes" ; then
fi fi
if test "$echo_libs" = "yes" ; then 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" && if test "${SYSROOT}$libdir" != "/usr/lib" &&
test "${SYSROOT}$libdir" != "/usr/lib64"; then test "${SYSROOT}$libdir" != "/usr/lib64"; then
echo -L${SYSROOT}$libdir $libs echo -L${SYSROOT}$libdir $libs

View File

@ -4,10 +4,11 @@ libdir="%libdir%"
includedir="%includedir%/freetype2" includedir="%includedir%/freetype2"
Name: FreeType 2 Name: FreeType 2
URL: http://freetype.org
Description: A free, high-quality, and portable font engine. Description: A free, high-quality, and portable font engine.
Version: %ft_version% Version: %ft_version%
Requires: Requires:
Requires.private: %HARFBUZZ_PKG% Requires.private: %BZIP2_PKG%%LIBPNG_PKG%%HARFBUZZ_PKG%
Libs: -L${libdir} -lfreetype Libs: -L${libdir} -lfreetype
Libs.private: %LIBZ% %LIBBZ2% %LIBPNG% %FT2_EXTRA_LIBS% Libs.private: %LIBZ% %FT2_EXTRA_LIBS%
Cflags: -I${includedir} Cflags: -I${includedir}

View File

@ -63,12 +63,14 @@ version_info := @version_info@
# Variables needed for `freetype-config' and `freetype.pc'. # Variables needed for `freetype-config' and `freetype.pc'.
# #
FT2_EXTRA_LIBS := @FT2_EXTRA_LIBS@ FT2_EXTRA_LIBS := @FT2_EXTRA_LIBS@
LIBBZ2 := @LIBBZ2@
LIBZ := @LIBZ@ LIBZ := @LIBZ@
LIBBZIP2 := @LIBBZIP2@
LIBPNG := @LIBPNG@ LIBPNG := @LIBPNG@
LIBHARFBUZZ := @LIBHARFBUZZ@ LIBHARFBUZZ := @LIBHARFBUZZ@
build_libtool_libs := @build_libtool_libs@ build_libtool_libs := @build_libtool_libs@
ft_version := @ft_version@ ft_version := @ft_version@
BZIP2_PKG := @BZIP2_PKG@
LIBPNG_PKG := @LIBPNG_PKG@
HARFBUZZ_PKG := @HARFBUZZ_PKG@ HARFBUZZ_PKG := @HARFBUZZ_PKG@
# The directory where all library files are placed. # 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 $(OBJ_BUILD)/freetype-config: $(TOP_DIR)/builds/unix/freetype-config.in
rm -f $@ $@.tmp rm -f $@ $@.tmp
sed -e 's|%FT2_EXTRA_LIBS%|$(FT2_EXTRA_LIBS)|' \ sed -e 's|%FT2_EXTRA_LIBS%|$(FT2_EXTRA_LIBS)|' \
-e 's|%LIBBZ2%|$(LIBBZ2)|' \
-e 's|%LIBZ%|$(LIBZ)|' \ -e 's|%LIBZ%|$(LIBZ)|' \
-e 's|%LIBBZIP2%|$(LIBBZIP2)|' \
-e 's|%LIBPNG%|$(LIBPNG)|' \ -e 's|%LIBPNG%|$(LIBPNG)|' \
-e 's|%LIBHARFBUZZ%|$(LIBHARFBUZZ)|' \ -e 's|%LIBHARFBUZZ%|$(LIBHARFBUZZ)|' \
-e 's|%build_libtool_libs%|$(build_libtool_libs)|' \ -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 $(OBJ_BUILD)/freetype2.pc: $(TOP_DIR)/builds/unix/freetype2.in
rm -f $@ $@.tmp rm -f $@ $@.tmp
sed -e 's|%FT2_EXTRA_LIBS%|$(FT2_EXTRA_LIBS)|' \ sed -e 's|%FT2_EXTRA_LIBS%|$(FT2_EXTRA_LIBS)|' \
-e 's|%LIBBZ2%|$(LIBBZ2)|' \
-e 's|%LIBZ%|$(LIBZ)|' \ -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|%HARFBUZZ_PKG%|$(HARFBUZZ_PKG)|' \
-e 's|%build_libtool_libs%|$(build_libtool_libs)|' \ -e 's|%build_libtool_libs%|$(build_libtool_libs)|' \
-e 's|%exec_prefix%|$(exec_prefix)|' \ -e 's|%exec_prefix%|$(exec_prefix)|' \