2 dnl fontconfig/configure.in
4 dnl Copyright © 2003 Keith Packard
6 dnl Permission to use, copy, modify, distribute, and sell this software and its
7 dnl documentation for any purpose is hereby granted without fee, provided that
8 dnl the above copyright notice appear in all copies and that both that
9 dnl copyright notice and this permission notice appear in supporting
10 dnl documentation, and that the name of Keith Packard not be used in
11 dnl advertising or publicity pertaining to distribution of the software without
12 dnl specific, written prior permission. Keith Packard makes no
13 dnl representations about the suitability of this software for any purpose. It
14 dnl is provided "as is" without express or implied warranty.
16 dnl THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
17 dnl INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
18 dnl EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR
19 dnl CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
20 dnl DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
21 dnl TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
22 dnl PERFORMANCE OF THIS SOFTWARE.
24 dnl Process this file with autoconf to create configure.
28 dnl ==========================================================================
30 dnl ==========================================================================
32 dnl This is the package version number, not the shared library
33 dnl version. This same version number must appear in fontconfig/fontconfig.h
34 dnl Yes, it is a pain to synchronize version numbers. Unfortunately, it's
35 dnl not possible to extract the version number here from fontconfig.h
36 AM_INIT_AUTOMAKE(fontconfig, 2.7.3)
37 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
40 dnl libtool versioning
42 dnl bump revision when fixing bugs
43 dnl bump current and age, reset revision to zero when adding APIs
44 dnl bump current, leave age, reset revision to zero when changing/removing APIS
47 AC_SUBST(LIBT_CURRENT)
48 AC_SUBST(LIBT_REVISION)
51 LIBT_VERSION_INFO="$LIBT_CURRENT:$LIBT_REVISION:$LIBT_AGE"
52 AC_SUBST(LIBT_VERSION_INFO)
54 LIBT_CURRENT_MINUS_AGE=`expr $LIBT_CURRENT - $LIBT_AGE`
55 AC_SUBST(LIBT_CURRENT_MINUS_AGE)
57 dnl ==========================================================================
59 AM_CONFIG_HEADER(config.h)
69 dnl ==========================================================================
78 AM_CONDITIONAL(OS_WIN32, test "$os_win32" = "yes")
80 if test "$os_win32" = "yes"; then
81 AC_CHECK_PROG(ms_librarian, lib.exe, yes, no)
83 AM_CONDITIONAL(MS_LIB_AVAILABLE, test x$ms_librarian = xyes)
86 if test "x$GCC" = "xyes"; then
87 WARN_CFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes \
88 -Wmissing-prototypes -Wmissing-declarations \
89 -Wnested-externs -fno-strict-aliasing"
90 AC_DEFINE_UNQUOTED(HAVE_WARNING_CPP_DIRECTIVE,1,
91 [Can use #warning in C files])
96 dnl ==========================================================================
98 AM_CONDITIONAL(CROSS_COMPILING, test $cross_compiling = yes)
100 dnl ==========================================================================
102 # Setup for compiling build tools (fc-glyphname, etc)
103 AC_MSG_CHECKING([for a C compiler for build tools])
104 if test $cross_compiling = yes; then
105 AC_CHECK_PROGS(CC_FOR_BUILD, gcc cc)
109 AC_MSG_RESULT([$CC_FOR_BUILD])
110 AC_SUBST(CC_FOR_BUILD)
112 AC_MSG_CHECKING([for suffix of executable build tools])
113 if test $cross_compiling = yes; then
114 cat >conftest.c <<\_______EOF
122 compile="$CC_FOR_BUILD conftest.c -o conftest$i"
123 if AC_TRY_EVAL(compile); then
124 if (./conftest) 2>&AC_FD_CC; then
131 if test "${EXEEXT_FOR_BUILD+set}" != set; then
132 AC_MSG_ERROR([Cannot determine suffix of executable build tools])
135 EXEEXT_FOR_BUILD=$EXEEXT
137 AC_MSG_RESULT([$EXEEXT_FOR_BUILD])
138 AC_SUBST(EXEEXT_FOR_BUILD)
140 dnl ==========================================================================
142 AC_ARG_WITH(arch, [ --with-arch=ARCH Force architecture to ARCH], arch="$withval", arch=auto)
144 if test $cross_compiling = yes; then
147 AC_MSG_ERROR([Cannot autodetect architecture in cross compile environment]
148 [Use --with-arch=ARCH to specify architecture])
154 AC_SUBST(ARCHITECTURE)
156 dnl ==========================================================================
158 # Checks for header files.
161 AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h])
163 # Checks for typedefs, structures, and compiler characteristics.
168 # Checks for library functions.
171 AC_CHECK_FUNCS([geteuid getuid link memmove memset mkstemp strchr strrchr strtol getopt getopt_long sysconf ftruncate chsize rand random lrand48])
176 AC_MSG_CHECKING([for a usable iconv])
178 AC_TRY_LINK([#include <iconv.h>],
179 [iconv_open ("from", "to");],
182 if test x$use_iconv = x1; then
183 AC_MSG_RESULT([libc])
186 fontconfig_save_libs="$LIBS"
189 AC_TRY_LINK([#include <iconv.h>],
190 [iconv_open ("from", "to");],
194 if test x$use_iconv = x1; then
196 AC_MSG_RESULT([libiconv])
201 LIBS="$fontconfig_save_libs"
204 AC_DEFINE_UNQUOTED(USE_ICONV,$use_iconv,[Use iconv.])
207 # Checks for FreeType
210 AC_ARG_WITH(freetype-config, [ --with-freetype-config=PROG Use FreeType configuration program PROG], freetype_config=$withval, freetype_config=yes)
212 if test "$freetype_config" = "yes"; then
213 AC_PATH_PROG(ft_config,freetype-config,no)
214 if test "$ft_config" = "no"; then
215 AC_MSG_ERROR([You must have freetype installed; see http://www.freetype.org/])
218 ft_config="$freetype_config"
221 FREETYPE_CFLAGS="`$ft_config --cflags`"
222 FREETYPE_LIBS="`$ft_config --libs`"
224 AC_SUBST(FREETYPE_LIBS)
225 AC_SUBST(FREETYPE_CFLAGS)
227 fontconfig_save_libs="$LIBS"
228 fontconfig_save_cflags="$CFLAGS"
229 LIBS="$LIBS $FREETYPE_LIBS"
230 CFLAGS="$CFLAGS $FREETYPE_CFLAGS"
231 AC_CHECK_FUNCS(FT_Get_Next_Char FT_Get_BDF_Property FT_Get_PS_Font_Info FT_Has_PS_Glyph_Names FT_Get_X11_Font_Format FT_Select_Size)
232 AC_CHECK_MEMBER(FT_Bitmap_Size.y_ppem,
233 HAVE_FT_BITMAP_SIZE_Y_PPEM=1,
234 HAVE_FT_BITMAP_SIZE_Y_PPEM=0,
235 [#include <ft2build.h>
236 #include FT_FREETYPE_H])
237 AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,$HAVE_FT_BITMAP_SIZE_Y_PPEM,
238 [FT_Bitmap_Size structure includes y_ppem field])
239 CFLAGS="$fontconfig_save_cflags"
240 LIBS="$fontconfig_save_libs"
243 # Check expat configuration
246 AC_ARG_WITH(expat, [ --with-expat=DIR Use Expat in DIR], expat=$withval, expat=yes)
247 AC_ARG_WITH(expat-includes, [ --with-expat-includes=DIR Use Expat includes in DIR], expat_includes=$withval, expat_includes=yes)
248 AC_ARG_WITH(expat-lib, [ --with-expat-lib=DIR Use Expat library in DIR], expat_lib=$withval, expat_lib=yes)
250 if test "$enable_libxml2" != "yes"; then
255 case "$expat_includes" in
261 EXPAT_CFLAGS="-I$expat/include"
269 EXPAT_CFLAGS="-I$expat_includes"
279 EXPAT_LIBS="-L$expat/lib -lexpat"
286 EXPAT_LIBS="-L$expat_lib -lexpat"
290 expatsaved_CPPFLAGS="$CPPFLAGS"
291 CPPFLAGS="$CPPFLAGS $EXPAT_CFLAGS"
292 expatsaved_LIBS="$LIBS"
293 LIBS="$LIBS $EXPAT_LIBS"
295 AC_CHECK_HEADER(expat.h)
296 case "$ac_cv_header_expat_h" in
298 AC_CHECK_HEADER(xmlparse.h)
299 case "$ac_cv_header_xmlparse_h" in
301 have_expat_header=no;
305 AC_SUBST(HAVE_XMLPARSE_H)
306 AC_DEFINE_UNQUOTED(HAVE_XMLPARSE_H,$HAVE_XMLPARSE_H,
307 [Use xmlparse.h instead of expat.h])
308 have_expat_header=yes
313 have_expat_header=yes
316 case "$have_expat_header" in
321 AC_CHECK_FUNCS(XML_SetDoctypeDeclHandler)
322 case "$ac_cv_func_XML_SetDoctypeDeclHandler" in
326 AC_DEFINE_UNQUOTED(HAVE_EXPAT,$HAVE_EXPAT,
327 [Found a useable expat library])
335 CPPFLAGS="$expatsaved_CPPFLAGS"
336 LIBS="$expatsaved_LIBS"
340 AC_SUBST(EXPAT_CFLAGS)
348 AC_MSG_WARN([Cannot find usable expat library. Trying to use libxml2 as fallback.])
354 # Check libxml2 configuration
357 AC_ARG_ENABLE(libxml2, [ --enable-libxml2 Use libxml2 instead of Expat])
361 if test "$enable_libxml2" = "yes" -o "$expat" = "no"; then
362 PKG_CHECK_MODULES([LIBXML2], [libxml-2.0 >= 2.6])
363 AC_DEFINE_UNQUOTED(ENABLE_LIBXML2,1,[Use libxml2 instead of Expat])
365 AC_SUBST(LIBXML2_CFLAGS)
366 AC_SUBST(LIBXML2_LIBS)
370 # Set default font directory
373 AC_ARG_WITH(default-fonts, [ --with-default-fonts=DIR Use fonts from DIR when config is busted], default_fonts="$withval", default_fonts=yes)
375 case "$default_fonts" in
377 if test "$os_win32" = "yes"; then
378 FC_DEFAULT_FONTS="WINDOWSFONTDIR"
379 AC_DEFINE_UNQUOTED(FC_DEFAULT_FONTS, "WINDOWSFONTDIR",
380 [Windows font directory])
382 FC_DEFAULT_FONTS="/usr/share/fonts"
383 AC_DEFINE_UNQUOTED(FC_DEFAULT_FONTS, "/usr/share/fonts",
384 [System font directory])
388 FC_DEFAULT_FONTS="$default_fonts"
389 AC_DEFINE_UNQUOTED(FC_DEFAULT_FONTS, "$default_fonts",
390 [System font directory])
394 AC_SUBST(FC_DEFAULT_FONTS)
397 # Add more fonts if available. By default, add only the directories
398 # with outline fonts; those with bitmaps can be added as desired in
399 # local.conf or ~/.fonts.conf
401 AC_ARG_WITH(add-fonts, [ --with-add-fonts=DIR1,DIR2,...Find additional fonts in DIR1,DIR2,... ], add_fonts="$withval", add_fonts=yes)
406 for dir in /usr/X11R6/lib/X11 /usr/X11/lib/X11 /usr/lib/X11; do
407 case x"$FC_ADD_FONTS" in
410 if test -d "$sub"; then
411 case x$FC_ADD_FONTS in
416 FC_ADD_FONTS="$FC_ADD_FONTS,$sub"
423 AC_DEFINE_UNQUOTED(FC_ADD_FONTS,"$add_fonts",[Additional font directories])
429 FC_ADD_FONTS="$add_fonts"
430 AC_DEFINE_UNQUOTED(FC_ADD_FONTS,"$add_fonts",[Additional font directories])
434 AC_SUBST(FC_ADD_FONTS)
438 case "$FC_ADD_FONTS" in
442 FC_FONTPATH=`echo $FC_ADD_FONTS |
443 sed -e 's/^/<dir>/' -e 's/$/<\/dir>/' -e 's/,/<\/dir> <dir>/g'`
447 AC_SUBST(FC_FONTPATH)
450 # Set default cache directory path
452 AC_ARG_WITH(cache-dir, [ --with-cache-dir=DIR Use DIR to store cache files (default LOCALSTATEDIR/cache/fontconfig)], fc_cachedir="$withval", fc_cachedir=yes)
456 if test "$os_win32" = "yes"; then
457 fc_cachedir="WINDOWSTEMPDIR_FONTCONFIG_CACHE"
459 fc_cachedir='${localstatedir}/cache/${PACKAGE}'
465 AC_SUBST(fc_cachedir)
466 FC_CACHEDIR=${fc_cachedir}
467 AC_SUBST(FC_CACHEDIR)
469 FC_FONTDATE=`LC_ALL=C date`
471 AC_SUBST(FC_FONTDATE)
473 AC_ARG_WITH(confdir, [ --with-confdir=DIR Use DIR to store configuration files (default SYSCONFDIR/fonts)], confdir="$withval", confdir=yes)
476 # Set CONFDIR and FONTCONFIG_PATH
481 confdir='${sysconfdir}'/fonts
488 AC_DEFINE_UNQUOTED(CONFDIR, "$CONFDIR",[Font configuration directory])
492 # Let people not build/install docs if they don't have docbook
495 AC_CHECK_PROG(HASDOCBOOK, docbook2html, yes, no)
497 AM_CONDITIONAL(USEDOCBOOK, test "x$HASDOCBOOK" = xyes)
501 # Check if docs exist or can be created
503 if test x$HASDOCBOOK = xno; then
504 if test -f $srcdir/doc/fonts-conf.5; then
511 AC_ARG_ENABLE(docs, [ --disable-docs Don't build and install documentation],,enable_docs=$default_docs)
513 AM_CONDITIONAL(ENABLE_DOCS, test "x$enable_docs" = xyes)
515 if test "x$enable_docs" = xyes; then
518 cat $srcdir/doc/*.fncs | awk '
519 /^@TITLE@/ { if (!done) { printf ("%s\n", $2); done = 1; } }
520 /^@FUNC@/ { if (!done) { printf ("%s\n", $2); done = 1; } }
521 /^@@/ { done = 0; }' > $tmp
522 DOCMAN3=`cat $tmp | awk '{ printf ("%s.3 ", $1); }'`
523 echo DOCMAN3 $DOCMAN3
537 fc-glyphname/Makefile