| 1 |
# Public macros for the TeX Live (TL) tree. |
| 2 |
# Copyright (C) 2009 Peter Breitenlohner <[email protected]> |
| 3 |
# |
| 4 |
# This file is free software; the copyright holder |
| 5 |
# gives unlimited permission to copy and/or distribute it, |
| 6 |
# with or without modifications, as long as this notice is preserved. |
| 7 |
|
| 8 |
# serial 0 |
| 9 |
|
| 10 |
# KPSE_FONTCONFIG_FLAGS |
| 11 |
# --------------------- |
| 12 |
# Provide the configure option '--with-fontconfig' and check for |
| 13 |
# installed fontconfig headers and library. |
| 14 |
# Check or set the cache variables kpse_cv_have_fontconfig, |
| 15 |
# kpse_cv_fontconfig_includes, and kpse_cv_fontconfig_libs. |
| 16 |
# If found set the Make variables FONTCONFIG_INCLUDES and FONTCONFIG_LIBS |
| 17 |
# to the CPPFLAGS and LIBS required for the installed '-lfontconfig' |
| 18 |
# library and define HAVE_LIBFONTCONFIG. |
| 19 |
AC_DEFUN([KPSE_FONTCONFIG_FLAGS], |
| 20 |
[AC_REQUIRE([_KPSE_CHECK_PKG_CONFIG])[]dnl |
| 21 |
AC_ARG_WITH([fontconfig-includes], |
| 22 |
AS_HELP_STRING([--with-fontconfig-includes=DIR], |
| 23 |
[fontconfig headers installed in DIR]))[]dnl |
| 24 |
AC_ARG_WITH([fontconfig-libdir], |
| 25 |
AS_HELP_STRING([--with-fontconfig-libdir=DIR], |
| 26 |
[fontconfig library installed in DIR]))[]dnl |
| 27 |
AC_CACHE_CHECK([for installed fontconfig headers and library], |
| 28 |
[kpse_cv_have_fontconfig], |
| 29 |
[kpse_save_CPPFLAGS=$CPPFLAGS |
| 30 |
kpse_save_LIBS=$LIBS |
| 31 |
kpse_cv_fontconfig_includes= |
| 32 |
kpse_cv_fontconfig_libs='-lfontconfig' |
| 33 |
if test "x$with_fontconfig_includes:$with_fontconfig_libdir" != x:; then |
| 34 |
if test "x$with_fontconfig_includes" != x; then |
| 35 |
kpse_cv_fontconfig_includes="-I$with_fontconfig_includes" |
| 36 |
fi |
| 37 |
if test "x$with_fontconfig_libdir" != x; then |
| 38 |
kpse_cv_fontconfig_libs="-L$with_fontconfig_libdir $kpse_cv_fontconfig_libs" |
| 39 |
fi |
| 40 |
elif $PKG_CONFIG fontconfig; then |
| 41 |
kpse_cv_fontconfig_includes=`$PKG_CONFIG fontconfig --cflags` |
| 42 |
kpse_cv_fontconfig_libs=`$PKG_CONFIG fontconfig --libs` |
| 43 |
fi |
| 44 |
CPPFLAGS="$kpse_cv_fontconfig_includes $CPPFLAGS" |
| 45 |
LIBS="$kpse_cv_fontconfig_libs $LIBS" |
| 46 |
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <fontconfig/fontconfig.h>]], |
| 47 |
[[FcObjectSet *os; FcInit();]])], |
| 48 |
[kpse_cv_have_fontconfig=yes], |
| 49 |
[kpse_cv_have_fontconfig=no]) |
| 50 |
CPPFLAGS=$kpse_save_CPPFLAGS |
| 51 |
LIBS=$kpse_save_LIBS]) |
| 52 |
if test "x$kpse_cv_have_fontconfig" = xyes; then |
| 53 |
FONTCONFIG_INCLUDES=$kpse_cv_fontconfig_includes |
| 54 |
FONTCONFIG_LIBS=$kpse_cv_fontconfig_libs |
| 55 |
AC_DEFINE([HAVE_LIBFONTCONFIG], 1, [Define if you have libfontconfig.]) |
| 56 |
fi |
| 57 |
AC_SUBST([FONTCONFIG_INCLUDES]) |
| 58 |
AC_SUBST([FONTCONFIG_LIBS]) |
| 59 |
]) # KPSE_FONTCONFIG_FLAGS |