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 the author(s) not be used in
11 dnl advertising or publicity pertaining to distribution of the software without
12 dnl specific, written prior permission. The authors make 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.
29 dnl ==========================================================================
31 dnl ==========================================================================
33 dnl This is the package version number, not the shared library
34 dnl version. This same version number must appear in fontconfig/fontconfig.h
35 dnl Yes, it is a pain to synchronize version numbers. Unfortunately, it's
36 dnl not possible to extract the version number here from fontconfig.h
37 AM_INIT_AUTOMAKE(fontconfig, 2.10.1)
38 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 AC_CONFIG_HEADERS(config.h)
60 AC_CONFIG_MACRO_DIR([m4])
70 AC_MSG_CHECKING([for RM macro])
71 _predefined_rm=`make -p -f /dev/null 2>/dev/null|grep '^RM ='|sed -e 's/^RM = //'`
72 if test "x$_predefined_rm" = "x"; then
73 AC_MSG_RESULT([no predefined RM])
74 AC_CHECK_PROG(RM, rm, [rm -f])
76 AC_MSG_RESULT($_predefined_rm)
79 dnl ==========================================================================
88 AM_CONDITIONAL(OS_WIN32, test "$os_win32" = "yes")
90 if test "$os_win32" = "yes"; then
91 AC_CHECK_PROG(ms_librarian, lib.exe, yes, no)
93 AM_CONDITIONAL(MS_LIB_AVAILABLE, test x$ms_librarian = xyes)
96 if test "x$GCC" = "xyes"; then
97 WARN_CFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes \
98 -Wmissing-prototypes -Wmissing-declarations \
99 -Wnested-externs -fno-strict-aliasing"
100 AC_DEFINE_UNQUOTED(HAVE_WARNING_CPP_DIRECTIVE,1,
101 [Can use #warning in C files])
103 AC_SUBST(WARN_CFLAGS)
106 dnl ==========================================================================
108 AM_CONDITIONAL(CROSS_COMPILING, test $cross_compiling = yes)
109 AM_CONDITIONAL(ENABLE_SHARED, test "$enable_shared" = "yes")
111 dnl ==========================================================================
114 [AC_HELP_STRING([--with-arch=ARCH],
115 [Force architecture to ARCH])],
116 arch="$withval", arch=auto)
118 if test "x$arch" != xauto; then
119 AC_DEFINE_UNQUOTED([FC_ARCHITECTURE], "$arch", [Architecture prefix to use for cache file names])
123 dnl ==========================================================================
125 # Checks for header files.
128 AC_CHECK_HEADERS([fcntl.h regex.h stdlib.h string.h unistd.h sys/vfs.h sys/statfs.h sys/param.h sys/mount.h])
130 # Checks for typedefs, structures, and compiler characteristics.
133 AC_C_FLEXIBLE_ARRAY_MEMBER
136 # Checks for library functions.
139 AC_CHECK_FUNCS([geteuid getuid link memmove memset mkstemp strchr strrchr strtol getopt getopt_long sysconf ftruncate chsize rand random lrand48 random_r rand_r regcomp regerror regexec regfree fstatvfs fstatfs])
141 dnl AC_CHECK_FUNCS doesn't check for header files.
142 dnl posix_fadvise() may be not available in older libc.
143 AC_MSG_CHECKING([for posix_fadvise])
144 AC_LINK_IFELSE([AC_LANG_SOURCE([[
147 return posix_fadvise(0, 0, 0, 0);
151 AC_DEFINE([HAVE_POSIX_FADVISE], [1], [Define to 1 if you have the `posix_fadvise' function.])
152 ],[AC_MSG_RESULT([no])])
155 if test "x$ac_cv_func_fstatvfs" = "xyes"; then
156 AC_CHECK_MEMBERS([struct statvfs.f_basetype, struct statvfs.f_fstypename],,,
157 [#include <sys/statvfs.h>])
159 if test "x$ac_cv_func_fstatfs" = "xyes"; then
160 AC_CHECK_MEMBERS([struct statfs.f_flags, struct statfs.f_fstypename],,, [
161 #ifdef HAVE_SYS_VFS_H
164 #ifdef HAVE_SYS_STATFS_H
165 #include <sys/statfs.h>
167 #ifdef HAVE_SYS_PARAM_H
168 #include <sys/param.h>
170 #ifdef HAVE_SYS_MOUNT_H
171 #include <sys/mount.h>
174 AC_CHECK_MEMBERS([struct dirent.d_type],,,
175 [#include <dirent.h>])
179 if test "x$ac_cv_func_regcomp" = "xyes" -a "x$ac_cv_func_regerror" = "xyes" -a "x$ac_cv_func_regexec" = "xyes" -a "x$ac_cv_func_regfree"; then
180 AC_DEFINE(USE_REGEX,,[Use regex])
187 [AC_HELP_STRING([--enable-iconv],
188 [Use iconv to support non-Unicode SFNT name])],
190 AC_ARG_WITH(libiconv,
191 [AC_HELP_STRING([--with-libiconv=DIR],
192 [Use libiconv in DIR])],
193 [if test "x$withval" = "xyes"; then
194 libiconv_prefix=$prefix
196 libiconv_prefix=$withval
198 [libiconv_prefix=auto])
199 AC_ARG_WITH(libiconv-includes,
200 [AC_HELP_STRING([--with-libiconv-includes=DIR],
201 [Use libiconv includes in DIR])],
202 [libiconv_includes=$withval],
203 [libiconv_includes=auto])
204 AC_ARG_WITH(libiconv-lib,
205 [AC_HELP_STRING([--with-libiconv-lib=DIR],
206 [Use libiconv library in DIR])],
207 [libiconv_lib=$withval],
210 # if no libiconv,libiconv-includes,libiconv-lib are specified,
211 # libc's iconv has a priority.
212 if test "$libiconv_includes" != "auto" -a -r ${libiconv_includes}/iconv.h; then
213 libiconv_cflags="-I${libiconv_includes}"
214 elif test "$libiconv_prefix" != "auto" -a -r ${libiconv_prefix}/include/iconv.h; then
215 libiconv_cflags="-I${libiconv_prefix}/include"
220 if test "x$libiconv_cflags" != "x"; then
221 if test "$libiconv_lib" != "auto" -a -d ${libiconv_lib}; then
222 libiconv_libs="-L${libiconv_lib} -liconv"
223 elif test "$libiconv_prefix" != "auto" -a -d ${libiconv_prefix}/lib; then
224 libiconv_libs="-L${libiconv_prefix}/lib -liconv"
226 libiconv_libs="-liconv"
231 if test "x$enable_iconv" != "xno"; then
232 AC_MSG_CHECKING([for a usable iconv])
233 if test "x$libiconv_cflags" != "x" -o "x$libiconv_libs" != "x"; then
234 iconvsaved_CFLAGS="$CFLAGS"
235 iconvsaved_LIBS="$LIBS"
236 CFLAGS="$CFLAGS $libiconv_cflags"
237 LIBS="$LIBS $libiconv_libs"
239 AC_TRY_LINK([#include <iconv.h>],
240 [iconv_open ("from", "to");],
241 [iconv_type="libiconv"
245 CFLAGS="$iconvsaved_CFLAGS"
246 LIBS="$iconvsaved_LIBS"
247 ICONV_CFLAGS="$libiconv_cflags"
248 ICONV_LIBS="$libiconv_libs"
250 if test "x$use_iconv" = "x0"; then
251 AC_TRY_LINK([#include <iconv.h>],
252 [iconv_open ("from", "to");],
255 [iconv_type="not found"
259 AC_MSG_RESULT([$iconv_type])
260 AC_SUBST(ICONV_CFLAGS)
263 AC_DEFINE_UNQUOTED(USE_ICONV,$use_iconv,[Use iconv.])
265 # Checks for FreeType
267 PKG_CHECK_MODULES(FREETYPE, freetype2)
269 AC_SUBST(FREETYPE_LIBS)
270 AC_SUBST(FREETYPE_CFLAGS)
272 fontconfig_save_libs="$LIBS"
273 fontconfig_save_cflags="$CFLAGS"
274 LIBS="$LIBS $FREETYPE_LIBS"
275 CFLAGS="$CFLAGS $FREETYPE_CFLAGS"
276 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)
277 AC_CHECK_MEMBER(FT_Bitmap_Size.y_ppem,
278 HAVE_FT_BITMAP_SIZE_Y_PPEM=1,
279 HAVE_FT_BITMAP_SIZE_Y_PPEM=0,
280 [#include <ft2build.h>
281 #include FT_FREETYPE_H])
282 AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,$HAVE_FT_BITMAP_SIZE_Y_PPEM,
283 [FT_Bitmap_Size structure includes y_ppem field])
284 CFLAGS="$fontconfig_save_cflags"
285 LIBS="$fontconfig_save_libs"
288 # Check expat configuration
291 [AC_HELP_STRING([--with-expat=DIR],
292 [Use Expat in DIR])],
293 [expat_prefix=$withval],
295 AC_ARG_WITH(expat-includes,
296 [AC_HELP_STRING([--with-expat-includes=DIR],
297 [Use Expat includes in DIR])],
298 [expat_includes=$withval],
299 [expat_includes=auto])
300 AC_ARG_WITH(expat-lib,
301 [AC_HELP_STRING([--with-expat-lib=DIR])],
302 [expat_lib=$withval],
305 if test "$enable_libxml2" != "yes"; then
306 use_pkgconfig_for_expat=yes
307 if test "$expat_prefix" = "auto" -a "$expat_includes" = "auto" -a "$expat_lib" = "auto"; then
308 PKG_CHECK_MODULES(EXPAT, expat,,use_pkgconfig_for_expat=no)
310 use_pkgconfig_for_expat=no
312 if test "x$use_pkgconfig_for_expat" = "xno"; then
313 if test "$expat_includes" != "auto" -a -r ${expat_includes}/expat.h; then
314 EXPAT_CFLAGS="-I${expat_includes}"
315 elif test "$expat_prefix" != "auto" -a -r ${expat_prefix}/include/expat.h; then
316 EXPAT_CFLAGS="-I${expat_prefix}/include"
320 if test "$expat_lib" != "auto"; then
321 EXPAT_LIBS="-L${expat_lib} -lexpat"
322 elif test "$expat_prefix" != "auto"; then
323 EXPAT_LIBS="-L${expat_prefix}/lib -lexpat"
329 expatsaved_CPPFLAGS="$CPPFLAGS"
330 expatsaved_LIBS="$LIBS"
331 CPPFLAGS="$CPPFLAGS $EXPAT_CFLAGS"
332 LIBS="$LIBS $EXPAT_LIBS"
334 AC_CHECK_HEADER(expat.h)
335 if test "$ac_cv_header_expat_h" = "no"; then
336 AC_CHECK_HEADER(xmlparse.h)
337 if test "$ac_cv_header_xmlparse_h" = "yes"; then
339 AC_SUBST(HAVE_XMLPARSE_H)
340 AC_DEFINE_UNQUOTED(HAVE_XMLPARSE_H,$HAVE_XMLPARSE_H,
341 [Use xmlparse.h instead of expat.h])
344 *** expat is required. or try to use --enable-libxml2])
347 AC_CHECK_FUNCS(XML_SetDoctypeDeclHandler)
348 if test "$ac_cv_func_XML_SetDoctypeDeclHandler" = "no"; then
350 *** expat is required. or try to use --enable-libxml2])
352 CPPFLAGS="$expatsaved_CPPFLAGS"
353 LIBS="$expatsaved_LIBS"
355 AC_SUBST(EXPAT_CFLAGS)
360 # Check libxml2 configuration
362 AC_ARG_ENABLE(libxml2,
363 [AC_HELP_STRING([--enable-libxml2],
364 [Use libxml2 instead of Expat])])
366 if test "$enable_libxml2" = "yes"; then
367 PKG_CHECK_MODULES([LIBXML2], [libxml-2.0 >= 2.6])
368 AC_DEFINE_UNQUOTED(ENABLE_LIBXML2,1,[Use libxml2 instead of Expat])
370 AC_SUBST(LIBXML2_CFLAGS)
371 AC_SUBST(LIBXML2_LIBS)
373 fc_saved_CFLAGS="$CFLAGS"
374 CFLAGS="$CFLAGS $LIBXML2_CFLAGS"
375 AC_MSG_CHECKING([SAX1 support in libxml2])
376 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
377 #include <libxml/xmlversion.h>
378 #if !defined(LIBXML_SAX1_ENABLED)
379 # include "error: No SAX1 support in libxml2"
381 ]])], [AC_MSG_RESULT([found])], [AC_MSG_ERROR([
382 *** SAX1 support in libxml2 is required. enable it or use expat instead.])])
383 CFLAGS="$fc_saved_CFLAGS"
387 # Set default font directory
390 AC_ARG_WITH(default-fonts,
391 [AC_HELP_STRING([--with-default-fonts=DIR],
392 [Use fonts from DIR when config is busted])],
393 default_fonts="$withval", default_fonts=yes)
395 case "$default_fonts" in
397 if test "$os_win32" = "yes"; then
398 FC_DEFAULT_FONTS="WINDOWSFONTDIR"
399 AC_DEFINE_UNQUOTED(FC_DEFAULT_FONTS, "WINDOWSFONTDIR",
400 [Windows font directory])
402 FC_DEFAULT_FONTS="/usr/share/fonts"
403 AC_DEFINE_UNQUOTED(FC_DEFAULT_FONTS, "/usr/share/fonts",
404 [System font directory])
408 FC_DEFAULT_FONTS="$default_fonts"
409 AC_DEFINE_UNQUOTED(FC_DEFAULT_FONTS, "$default_fonts",
410 [System font directory])
414 AC_SUBST(FC_DEFAULT_FONTS)
417 # Add more fonts if available. By default, add only the directories
418 # with outline fonts; those with bitmaps can be added as desired in
419 # local.conf or ~/.fonts.conf
421 AC_ARG_WITH(add-fonts,
422 [AC_HELP_STRING([--with-add-fonts=DIR1,DIR2,...],
423 [Find additional fonts in DIR1,DIR2,... ])],
424 add_fonts="$withval", add_fonts=yes)
429 for dir in /usr/X11R6/lib/X11 /usr/X11/lib/X11 /usr/lib/X11; do
430 case x"$FC_ADD_FONTS" in
433 if test -d "$sub"; then
434 case x$FC_ADD_FONTS in
439 FC_ADD_FONTS="$FC_ADD_FONTS,$sub"
446 AC_DEFINE_UNQUOTED(FC_ADD_FONTS,"$add_fonts",[Additional font directories])
452 FC_ADD_FONTS="$add_fonts"
453 AC_DEFINE_UNQUOTED(FC_ADD_FONTS,"$add_fonts",[Additional font directories])
457 AC_SUBST(FC_ADD_FONTS)
461 case "$FC_ADD_FONTS" in
465 FC_FONTPATH=`echo $FC_ADD_FONTS |
466 sed -e 's/^/<dir>/' -e 's/$/<\/dir>/' -e 's/,/<\/dir> <dir>/g'`
470 AC_SUBST(FC_FONTPATH)
473 # Set default cache directory path
475 AC_ARG_WITH(cache-dir,
476 [AC_HELP_STRING([--with-cache-dir=DIR],
477 [Use DIR to store cache files [default=LOCALSTATEDIR/cache/fontconfig]])],
478 fc_cachedir="$withval", fc_cachedir=yes)
482 if test "$os_win32" = "yes"; then
483 fc_cachedir="WINDOWSTEMPDIR_FONTCONFIG_CACHE"
485 fc_cachedir='${localstatedir}/cache/${PACKAGE}'
491 AC_SUBST(fc_cachedir)
492 FC_CACHEDIR=${fc_cachedir}
493 AC_SUBST(FC_CACHEDIR)
495 FC_FONTDATE=`LC_ALL=C date`
497 AC_SUBST(FC_FONTDATE)
500 # Set configuration paths
503 AC_ARG_WITH(templatedir,
504 [AC_HELP_STRING([--with-templatedir=DIR],
505 [Use DIR to store the configuration template files [default=DATADIR/fontconfig/conf.avail]])],
506 [templatedir="$withval"],
508 AC_ARG_WITH(baseconfigdir,
509 [AC_HELP_STRING([--with-baseconfigdir=DIR],
510 [Use DIR to store the base configuration files [default=SYSCONFDIR/fonts]])],
511 [baseconfigdir="$withval"],
513 AC_ARG_WITH(configdir,
514 [AC_HELP_STRING([--with-configdir=DIR],
515 [Use DIR to store active configuration files [default=BASECONFIGDIR/conf.d]])],
516 [configdir="$withval"],
519 [AC_HELP_STRING([--with-xmldir=DIR],
520 [Use DIR to store XML schema files [default=DATADIR/xml/fontconfig]])],
524 case "$templatedir" in
526 templatedir='${datadir}'/fontconfig/conf.avail
531 case "$baseconfigdir" in
533 baseconfigdir='${sysconfdir}'/fonts
540 configdir='${baseconfigdir}'/conf.d
547 xmldir='${datadir}'/xml/fontconfig
553 TEMPLATEDIR=${templatedir}
554 BASECONFIGDIR=${baseconfigdir}
555 CONFIGDIR=${configdir}
557 AC_SUBST(templatedir)
558 AC_SUBST(TEMPLATEDIR)
559 AC_SUBST(baseconfigdir)
560 AC_SUBST(BASECONFIGDIR)
567 # Let people not build/install docs if they don't have docbook
570 AC_CHECK_PROG(HASDOCBOOK, docbook2html, yes, no)
572 AM_CONDITIONAL(USEDOCBOOK, test "x$HASDOCBOOK" = xyes)
576 # Check if docs exist or can be created
578 if test x$HASDOCBOOK = xno; then
579 if test -f $srcdir/doc/fonts-conf.5; then
587 [AC_HELP_STRING([--disable-docs],
588 [Don't build and install documentation])],
590 enable_docs=$default_docs)
592 AM_CONDITIONAL(ENABLE_DOCS, test "x$enable_docs" = xyes)
594 if test "x$enable_docs" = xyes; then
597 cat $srcdir/doc/*.fncs | awk '
598 /^@TITLE@/ { if (!done) { printf ("%s\n", $2); done = 1; } }
599 /^@FUNC@/ { if (!done) { printf ("%s\n", $2); done = 1; } }
600 /^@@/ { done = 0; }' > $tmp
601 DOCMAN3=`cat $tmp | awk '{ printf ("%s.3 ", $1); }'`
602 echo DOCMAN3 $DOCMAN3
613 dnl Figure out what cache format suffix to use for this architecture
615 AC_CHECK_SIZEOF([void *])
616 AC_CHECK_ALIGNOF([double])
618 dnl include the header file for workaround of miscalculating size on autoconf
619 dnl particularly for fat binaries
620 AH_BOTTOM([#include "config-fixups.h"])
626 fc-glyphname/Makefile