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.
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.9.92)
37 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
39 dnl libtool versioning
41 dnl bump revision when fixing bugs
42 dnl bump current and age, reset revision to zero when adding APIs
43 dnl bump current, leave age, reset revision to zero when changing/removing APIS
46 AC_SUBST(LIBT_CURRENT)
47 AC_SUBST(LIBT_REVISION)
50 LIBT_VERSION_INFO="$LIBT_CURRENT:$LIBT_REVISION:$LIBT_AGE"
51 AC_SUBST(LIBT_VERSION_INFO)
53 LIBT_CURRENT_MINUS_AGE=`expr $LIBT_CURRENT - $LIBT_AGE`
54 AC_SUBST(LIBT_CURRENT_MINUS_AGE)
56 dnl ==========================================================================
58 AC_CONFIG_HEADERS(config.h)
68 AC_MSG_CHECKING([for RM macro])
69 _predefined_rm=`make -p -f /dev/null 2>/dev/null|grep '^RM ='|sed -e 's/^RM = //'`
70 if test "x$_predefined_rm" = "x"; then
71 AC_MSG_RESULT([no predefined RM])
72 AC_CHECK_PROG(RM, rm, [rm -f])
74 AC_MSG_RESULT($_predefined_rm)
77 dnl ==========================================================================
86 AM_CONDITIONAL(OS_WIN32, test "$os_win32" = "yes")
88 if test "$os_win32" = "yes"; then
89 AC_CHECK_PROG(ms_librarian, lib.exe, yes, no)
91 AM_CONDITIONAL(MS_LIB_AVAILABLE, test x$ms_librarian = xyes)
94 if test "x$GCC" = "xyes"; then
95 WARN_CFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes \
96 -Wmissing-prototypes -Wmissing-declarations \
97 -Wnested-externs -fno-strict-aliasing"
98 AC_DEFINE_UNQUOTED(HAVE_WARNING_CPP_DIRECTIVE,1,
99 [Can use #warning in C files])
101 AC_SUBST(WARN_CFLAGS)
104 dnl ==========================================================================
106 AM_CONDITIONAL(CROSS_COMPILING, test $cross_compiling = yes)
107 AM_CONDITIONAL(ENABLE_SHARED, test "$enable_shared" = "yes")
109 dnl ==========================================================================
112 [AC_HELP_STRING([--with-arch=ARCH],
113 [Force architecture to ARCH])],
114 arch="$withval", arch=auto)
116 if test "x$arch" != xauto; then
117 AC_DEFINE_UNQUOTED([FC_ARCHITECTURE], "$arch", [Architecture prefix to use for cache file names])
121 dnl ==========================================================================
123 # Checks for header files.
126 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])
128 # Checks for typedefs, structures, and compiler characteristics.
133 # Checks for library functions.
136 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 posix_fadvise fstatvfs fstatfs])
139 if test "x$ac_cv_func_fstatvfs" = "xyes"; then
140 AC_CHECK_MEMBERS([struct statvfs.f_basetype, struct statvfs.f_fstypename],,,
141 [#include <sys/statvfs.h>])
143 if test "x$ac_cv_func_fstatfs" = "xyes"; then
144 AC_CHECK_MEMBERS([struct statfs.f_flags, struct statfs.f_fstypename],,, [
145 #ifdef HAVE_SYS_VFS_H
148 #ifdef HAVE_SYS_STATFS_H
149 #include <sys/statfs.h>
151 #ifdef HAVE_SYS_PARAM_H
152 #include <sys/param.h>
154 #ifdef HAVE_SYS_MOUNT_H
155 #include <sys/mount.h>
158 AC_CHECK_MEMBERS([struct dirent.d_type],,,
159 [#include <dirent.h>])
163 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
164 AC_DEFINE(USE_REGEX,,[Use regex])
171 [AC_HELP_STRING([--enable-iconv],
172 [Use iconv to support non-Unicode SFNT name])],
174 AC_ARG_WITH(libiconv,
175 [AC_HELP_STRING([--with-libiconv=DIR],
176 [Use libiconv in DIR])],
177 [if test "x$withval" = "xyes"; then
178 libiconv_prefix=$prefix
180 libiconv_prefix=$withval
182 [libiconv_prefix=auto])
183 AC_ARG_WITH(libiconv-includes,
184 [AC_HELP_STRING([--with-libiconv-includes=DIR],
185 [Use libiconv includes in DIR])],
186 [libiconv_includes=$withval],
187 [libiconv_includes=auto])
188 AC_ARG_WITH(libiconv-lib,
189 [AC_HELP_STRING([--with-libiconv-lib=DIR],
190 [Use libiconv library in DIR])],
191 [libiconv_lib=$withval],
194 # if no libiconv,libiconv-includes,libiconv-lib are specified,
195 # libc's iconv has a priority.
196 if test "$libiconv_includes" != "auto" -a -r ${libiconv_includes}/iconv.h; then
197 libiconv_cflags="-I${libiconv_includes}"
198 elif test "$libiconv_prefix" != "auto" -a -r ${libiconv_prefix}/include/iconv.h; then
199 libiconv_cflags="-I${libiconv_prefix}/include"
204 if test "x$libiconv_cflags" != "x"; then
205 if test "$libiconv_lib" != "auto" -a -d ${libiconv_lib}; then
206 libiconv_libs="-L${libiconv_lib} -liconv"
207 elif test "$libiconv_prefix" != "auto" -a -d ${libiconv_prefix}/lib; then
208 libiconv_libs="-L${libiconv_prefix}/lib -liconv"
210 libiconv_libs="-liconv"
215 if test "x$enable_iconv" != "xno"; then
216 AC_MSG_CHECKING([for a usable iconv])
217 if test "x$libiconv_cflags" != "x" -o "x$libiconv_libs" != "x"; then
218 iconvsaved_CFLAGS="$CFLAGS"
219 iconvsaved_LIBS="$LIBS"
220 CFLAGS="$CFLAGS $libiconv_cflags"
221 LIBS="$LIBS $libiconv_libs"
223 AC_TRY_LINK([#include <iconv.h>],
224 [iconv_open ("from", "to");],
225 [iconv_type="libiconv"
229 CFLAGS="$iconvsaved_CFLAGS"
230 LIBS="$iconvsaved_LIBS"
231 ICONV_CFLAGS="$libiconv_cflags"
232 ICONV_LIBS="$libiconv_libs"
234 if test "x$use_iconv" = "x0"; then
235 AC_TRY_LINK([#include <iconv.h>],
236 [iconv_open ("from", "to");],
239 [iconv_type="not found"
243 AC_MSG_RESULT([$iconv_type])
244 AC_SUBST(ICONV_CFLAGS)
247 AC_DEFINE_UNQUOTED(USE_ICONV,$use_iconv,[Use iconv.])
249 # Checks for FreeType
251 PKG_CHECK_MODULES(FREETYPE, freetype2)
253 AC_SUBST(FREETYPE_LIBS)
254 AC_SUBST(FREETYPE_CFLAGS)
256 fontconfig_save_libs="$LIBS"
257 fontconfig_save_cflags="$CFLAGS"
258 LIBS="$LIBS $FREETYPE_LIBS"
259 CFLAGS="$CFLAGS $FREETYPE_CFLAGS"
260 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)
261 AC_CHECK_MEMBER(FT_Bitmap_Size.y_ppem,
262 HAVE_FT_BITMAP_SIZE_Y_PPEM=1,
263 HAVE_FT_BITMAP_SIZE_Y_PPEM=0,
264 [#include <ft2build.h>
265 #include FT_FREETYPE_H])
266 AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,$HAVE_FT_BITMAP_SIZE_Y_PPEM,
267 [FT_Bitmap_Size structure includes y_ppem field])
268 CFLAGS="$fontconfig_save_cflags"
269 LIBS="$fontconfig_save_libs"
272 # Check expat configuration
275 [AC_HELP_STRING([--with-expat=DIR],
276 [Use Expat in DIR])],
277 [expat_prefix=$withval],
279 AC_ARG_WITH(expat-includes,
280 [AC_HELP_STRING([--with-expat-includes=DIR],
281 [Use Expat includes in DIR])],
282 [expat_includes=$withval],
283 [expat_includes=auto])
284 AC_ARG_WITH(expat-lib,
285 [AC_HELP_STRING([--with-expat-lib=DIR])],
286 [expat_lib=$withval],
289 if test "$enable_libxml2" != "yes"; then
290 use_pkgconfig_for_expat=yes
291 if test "$expat_prefix" = "auto" -a "$expat_includes" = "auto" -a "$expat_lib" = "auto"; then
292 PKG_CHECK_MODULES(EXPAT, expat,,use_pkgconfig_for_expat=no)
294 use_pkgconfig_for_expat=no
296 if test "x$use_pkgconfig_for_expat" = "xno"; then
297 if test "$expat_includes" != "auto" -a -r ${expat_includes}/expat.h; then
298 EXPAT_CFLAGS="-I${expat_includes}"
299 elif test "$expat_prefix" != "auto" -a -r ${expat_prefix}/include/expat.h; then
300 EXPAT_CFLAGS="-I${expat_prefix}/include"
304 if test "$expat_lib" != "auto"; then
305 EXPAT_LIBS="-L${expat_lib} -lexpat"
306 elif test "$expat_prefix" != "auto"; then
307 EXPAT_LIBS="-L${expat_prefix}/lib -lexpat"
313 expatsaved_CPPFLAGS="$CPPFLAGS"
314 expatsaved_LIBS="$LIBS"
315 CPPFLAGS="$CPPFLAGS $EXPAT_CFLAGS"
316 LIBS="$LIBS $EXPAT_LIBS"
318 AC_CHECK_HEADER(expat.h)
319 if test "$ac_cv_header_expat_h" = "no"; then
320 AC_CHECK_HEADER(xmlparse.h)
321 if test "$ac_cv_header_xmlparse_h" = "yes"; then
323 AC_SUBST(HAVE_XMLPARSE_H)
324 AC_DEFINE_UNQUOTED(HAVE_XMLPARSE_H,$HAVE_XMLPARSE_H,
325 [Use xmlparse.h instead of expat.h])
328 *** expat is required. or try to use --enable-libxml2])
331 AC_CHECK_FUNCS(XML_SetDoctypeDeclHandler)
332 if test "$ac_cv_func_XML_SetDoctypeDeclHandler" = "no"; then
334 *** expat is required. or try to use --enable-libxml2])
336 CPPFLAGS="$expatsaved_CPPFLAGS"
337 LIBS="$expatsaved_LIBS"
339 AC_SUBST(EXPAT_CFLAGS)
344 # Check libxml2 configuration
346 AC_ARG_ENABLE(libxml2,
347 [AC_HELP_STRING([--enable-libxml2],
348 [Use libxml2 instead of Expat])])
350 if test "$enable_libxml2" = "yes"; then
351 PKG_CHECK_MODULES([LIBXML2], [libxml-2.0 >= 2.6])
352 AC_DEFINE_UNQUOTED(ENABLE_LIBXML2,1,[Use libxml2 instead of Expat])
354 AC_SUBST(LIBXML2_CFLAGS)
355 AC_SUBST(LIBXML2_LIBS)
359 # Set default font directory
362 AC_ARG_WITH(default-fonts,
363 [AC_HELP_STRING([--with-default-fonts=DIR],
364 [Use fonts from DIR when config is busted])],
365 default_fonts="$withval", default_fonts=yes)
367 case "$default_fonts" in
369 if test "$os_win32" = "yes"; then
370 FC_DEFAULT_FONTS="WINDOWSFONTDIR"
371 AC_DEFINE_UNQUOTED(FC_DEFAULT_FONTS, "WINDOWSFONTDIR",
372 [Windows font directory])
374 FC_DEFAULT_FONTS="/usr/share/fonts"
375 AC_DEFINE_UNQUOTED(FC_DEFAULT_FONTS, "/usr/share/fonts",
376 [System font directory])
380 FC_DEFAULT_FONTS="$default_fonts"
381 AC_DEFINE_UNQUOTED(FC_DEFAULT_FONTS, "$default_fonts",
382 [System font directory])
386 AC_SUBST(FC_DEFAULT_FONTS)
389 # Add more fonts if available. By default, add only the directories
390 # with outline fonts; those with bitmaps can be added as desired in
391 # local.conf or ~/.fonts.conf
393 AC_ARG_WITH(add-fonts,
394 [AC_HELP_STRING([--with-add-fonts=DIR1,DIR2,...],
395 [Find additional fonts in DIR1,DIR2,... ])],
396 add_fonts="$withval", add_fonts=yes)
401 for dir in /usr/X11R6/lib/X11 /usr/X11/lib/X11 /usr/lib/X11; do
402 case x"$FC_ADD_FONTS" in
405 if test -d "$sub"; then
406 case x$FC_ADD_FONTS in
411 FC_ADD_FONTS="$FC_ADD_FONTS,$sub"
418 AC_DEFINE_UNQUOTED(FC_ADD_FONTS,"$add_fonts",[Additional font directories])
424 FC_ADD_FONTS="$add_fonts"
425 AC_DEFINE_UNQUOTED(FC_ADD_FONTS,"$add_fonts",[Additional font directories])
429 AC_SUBST(FC_ADD_FONTS)
433 case "$FC_ADD_FONTS" in
437 FC_FONTPATH=`echo $FC_ADD_FONTS |
438 sed -e 's/^/<dir>/' -e 's/$/<\/dir>/' -e 's/,/<\/dir> <dir>/g'`
442 AC_SUBST(FC_FONTPATH)
445 # Set default cache directory path
447 AC_ARG_WITH(cache-dir,
448 [AC_HELP_STRING([--with-cache-dir=DIR],
449 [Use DIR to store cache files [default=LOCALSTATEDIR/cache/fontconfig]])],
450 fc_cachedir="$withval", fc_cachedir=yes)
454 if test "$os_win32" = "yes"; then
455 fc_cachedir="WINDOWSTEMPDIR_FONTCONFIG_CACHE"
457 fc_cachedir='${localstatedir}/cache/${PACKAGE}'
463 AC_SUBST(fc_cachedir)
464 FC_CACHEDIR=${fc_cachedir}
465 AC_SUBST(FC_CACHEDIR)
467 FC_FONTDATE=`LC_ALL=C date`
469 AC_SUBST(FC_FONTDATE)
472 # Set configuration paths
475 AC_ARG_WITH(templatedir,
476 [AC_HELP_STRING([--with-templatedir=DIR],
477 [Use DIR to store the configuration template files [default=DATADIR/fontconfig/conf.avail]])],
478 [templatedir="$withval"],
480 AC_ARG_WITH(baseconfigdir,
481 [AC_HELP_STRING([--with-baseconfigdir=DIR],
482 [Use DIR to store the base configuration files [default=SYSCONFDIR/fonts]])],
483 [baseconfigdir="$withval"],
485 AC_ARG_WITH(configdir,
486 [AC_HELP_STRING([--with-configdir=DIR],
487 [Use DIR to store active configuration files [default=BASECONFIGDIR/conf.d]])],
488 [configdir="$withval"],
491 [AC_HELP_STRING([--with-xmldir=DIR],
492 [Use DIR to store XML schema files [default=DATADIR/xml/fontconfig]])],
496 case "$templatedir" in
498 templatedir='${datadir}'/fontconfig/conf.avail
503 case "$baseconfigdir" in
505 baseconfigdir='${sysconfdir}'/fonts
512 configdir='${baseconfigdir}'/conf.d
519 xmldir='${datadir}'/xml/fontconfig
525 TEMPLATEDIR=${templatedir}
526 BASECONFIGDIR=${baseconfigdir}
527 CONFIGDIR=${configdir}
529 AC_SUBST(templatedir)
530 AC_SUBST(TEMPLATEDIR)
531 AC_SUBST(baseconfigdir)
532 AC_SUBST(BASECONFIGDIR)
539 # Let people not build/install docs if they don't have docbook
542 AC_CHECK_PROG(HASDOCBOOK, docbook2html, yes, no)
544 AM_CONDITIONAL(USEDOCBOOK, test "x$HASDOCBOOK" = xyes)
548 # Check if docs exist or can be created
550 if test x$HASDOCBOOK = xno; then
551 if test -f $srcdir/doc/fonts-conf.5; then
559 [AC_HELP_STRING([--disable-docs],
560 [Don't build and install documentation])],
562 enable_docs=$default_docs)
564 AM_CONDITIONAL(ENABLE_DOCS, test "x$enable_docs" = xyes)
566 if test "x$enable_docs" = xyes; then
569 cat $srcdir/doc/*.fncs | awk '
570 /^@TITLE@/ { if (!done) { printf ("%s\n", $2); done = 1; } }
571 /^@FUNC@/ { if (!done) { printf ("%s\n", $2); done = 1; } }
572 /^@@/ { done = 0; }' > $tmp
573 DOCMAN3=`cat $tmp | awk '{ printf ("%s.3 ", $1); }'`
574 echo DOCMAN3 $DOCMAN3
585 dnl Figure out what cache format suffix to use for this architecture
587 AC_CHECK_SIZEOF([void *])
588 AC_CHECK_ALIGNOF([double])
590 dnl include the header file for workaround of miscalculating size on autoconf
591 dnl particularly for fat binaries
592 AH_BOTTOM([#include "config-fixups.h"])
598 fc-glyphname/Makefile