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.0)
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)
108 dnl ==========================================================================
111 [AC_HELP_STRING([--with-arch=ARCH],
112 [Force architecture to ARCH])],
113 arch="$withval", arch=auto)
115 if test "x$arch" != xauto; then
116 AC_DEFINE_UNQUOTED([FC_ARCHITECTURE], "$arch", [Architecture prefix to use for cache file names])
120 dnl ==========================================================================
122 # Checks for header files.
125 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])
127 # Checks for typedefs, structures, and compiler characteristics.
132 # Checks for library functions.
135 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])
138 if test "x$ac_cv_func_fstatvfs" = "xyes"; then
139 AC_CHECK_MEMBERS([struct statvfs.f_basetype, struct statvfs.f_fstypename],,,
140 [#include <sys/statvfs.h>])
142 if test "x$ac_cv_func_fstatfs" = "xyes"; then
143 AC_CHECK_MEMBERS([struct statfs.f_flags, struct statfs.f_fstypename],,, [
144 #ifdef HAVE_SYS_VFS_H
147 #ifdef HAVE_SYS_STATFS_H
148 #include <sys/statfs.h>
150 #ifdef HAVE_SYS_PARAM_H
151 #include <sys/param.h>
153 #ifdef HAVE_SYS_MOUNT_H
154 #include <sys/mount.h>
160 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
161 AC_DEFINE(USE_REGEX,,[Use regex])
168 [AC_HELP_STRING([--enable-iconv],
169 [Use iconv to support non-Unicode SFNT name])],
171 AC_ARG_WITH(libiconv,
172 [AC_HELP_STRING([--with-libiconv=DIR],
173 [Use libiconv in DIR])],
174 [if test "x$withval" = "xyes"; then
175 libiconv_prefix=$prefix
177 libiconv_prefix=$withval
179 [libiconv_prefix=auto])
180 AC_ARG_WITH(libiconv-includes,
181 [AC_HELP_STRING([--with-libiconv-includes=DIR],
182 [Use libiconv includes in DIR])],
183 [libiconv_includes=$withval],
184 [libiconv_includes=auto])
185 AC_ARG_WITH(libiconv-lib,
186 [AC_HELP_STRING([--with-libiconv-lib=DIR],
187 [Use libiconv library in DIR])],
188 [libiconv_lib=$withval],
191 # if no libiconv,libiconv-includes,libiconv-lib are specified,
192 # libc's iconv has a priority.
193 if test "$libiconv_includes" != "auto" -a -r ${libiconv_includes}/iconv.h; then
194 libiconv_cflags="-I${libiconv_includes}"
195 elif test "$libiconv_prefix" != "auto" -a -r ${libiconv_prefix}/include/iconv.h; then
196 libiconv_cflags="-I${libiconv_prefix}/include"
201 if test "x$libiconv_cflags" != "x"; then
202 if test "$libiconv_lib" != "auto" -a -d ${libiconv_lib}; then
203 libiconv_libs="-L${libiconv_lib} -liconv"
204 elif test "$libiconv_prefix" != "auto" -a -d ${libiconv_prefix}/lib; then
205 libiconv_libs="-L${libiconv_prefix}/lib -liconv"
207 libiconv_libs="-liconv"
212 if test "x$enable_iconv" != "xno"; then
213 AC_MSG_CHECKING([for a usable iconv])
214 if test "x$libiconv_cflags" != "x" -o "x$libiconv_libs" != "x"; then
215 iconvsaved_CFLAGS="$CFLAGS"
216 iconvsaved_LIBS="$LIBS"
217 CFLAGS="$CFLAGS $libiconv_cflags"
218 LIBS="$LIBS $libiconv_libs"
220 AC_TRY_LINK([#include <iconv.h>],
221 [iconv_open ("from", "to");],
222 [iconv_type="libiconv"
226 CFLAGS="$iconvsaved_CFLAGS"
227 LIBS="$iconvsaved_LIBS"
228 ICONV_CFLAGS="$libiconv_cflags"
229 ICONV_LIBS="$libiconv_libs"
231 if test "x$use_iconv" = "x0"; then
232 AC_TRY_LINK([#include <iconv.h>],
233 [iconv_open ("from", "to");],
236 [iconv_type="not found"
240 AC_MSG_RESULT([$iconv_type])
241 AC_SUBST(ICONV_CFLAGS)
244 AC_DEFINE_UNQUOTED(USE_ICONV,$use_iconv,[Use iconv.])
246 # Checks for FreeType
248 PKG_CHECK_MODULES(FREETYPE, freetype2)
250 AC_SUBST(FREETYPE_LIBS)
251 AC_SUBST(FREETYPE_CFLAGS)
253 fontconfig_save_libs="$LIBS"
254 fontconfig_save_cflags="$CFLAGS"
255 LIBS="$LIBS $FREETYPE_LIBS"
256 CFLAGS="$CFLAGS $FREETYPE_CFLAGS"
257 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)
258 AC_CHECK_MEMBER(FT_Bitmap_Size.y_ppem,
259 HAVE_FT_BITMAP_SIZE_Y_PPEM=1,
260 HAVE_FT_BITMAP_SIZE_Y_PPEM=0,
261 [#include <ft2build.h>
262 #include FT_FREETYPE_H])
263 AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,$HAVE_FT_BITMAP_SIZE_Y_PPEM,
264 [FT_Bitmap_Size structure includes y_ppem field])
265 CFLAGS="$fontconfig_save_cflags"
266 LIBS="$fontconfig_save_libs"
269 # Check expat configuration
272 [AC_HELP_STRING([--with-expat=DIR],
273 [Use Expat in DIR])],
274 [expat_prefix=$withval],
276 AC_ARG_WITH(expat-includes,
277 [AC_HELP_STRING([--with-expat-includes=DIR],
278 [Use Expat includes in DIR])],
279 [expat_includes=$withval],
280 [expat_includes=auto])
281 AC_ARG_WITH(expat-lib,
282 [AC_HELP_STRING([--with-expat-lib=DIR])],
283 [expat_lib=$withval],
286 if test "$enable_libxml2" != "yes"; then
287 use_pkgconfig_for_expat=yes
288 if test "$expat_prefix" = "auto" -a "$expat_includes" = "auto" -a "$expat_lib" = "auto"; then
289 PKG_CHECK_MODULES(EXPAT, expat,,use_pkgconfig_for_expat=no)
291 use_pkgconfig_for_expat=no
293 if test "x$use_pkgconfig_for_expat" = "xno"; then
294 if test "$expat_includes" != "auto" -a -r ${expat_includes}/expat.h; then
295 EXPAT_CFLAGS="-I${expat_includes}"
296 elif test "$expat_prefix" != "auto" -a -r ${expat_prefix}/include/expat.h; then
297 EXPAT_CFLAGS="-I${expat_prefix}/include"
301 if test "$expat_lib" != "auto"; then
302 EXPAT_LIBS="-L${expat_lib} -lexpat"
303 elif test "$expat_prefix" != "auto"; then
304 EXPAT_LIBS="-L${expat_prefix}/lib -lexpat"
310 expatsaved_CPPFLAGS="$CPPFLAGS"
311 expatsaved_LIBS="$LIBS"
312 CPPFLAGS="$CPPFLAGS $EXPAT_CFLAGS"
313 LIBS="$LIBS $EXPAT_LIBS"
315 AC_CHECK_HEADER(expat.h)
316 if test "$ac_cv_header_expat_h" = "no"; then
317 AC_CHECK_HEADER(xmlparse.h)
318 if test "$ac_cv_header_xmlparse_h" = "yes"; then
320 AC_SUBST(HAVE_XMLPARSE_H)
321 AC_DEFINE_UNQUOTED(HAVE_XMLPARSE_H,$HAVE_XMLPARSE_H,
322 [Use xmlparse.h instead of expat.h])
325 *** expat is required. or try to use --enable-libxml2])
328 AC_CHECK_FUNCS(XML_SetDoctypeDeclHandler)
329 if test "$ac_cv_func_XML_SetDoctypeDeclHandler" = "no"; then
331 *** expat is required. or try to use --enable-libxml2])
333 CPPFLAGS="$expatsaved_CPPFLAGS"
334 LIBS="$expatsaved_LIBS"
336 AC_SUBST(EXPAT_CFLAGS)
341 # Check libxml2 configuration
343 AC_ARG_ENABLE(libxml2,
344 [AC_HELP_STRING([--enable-libxml2],
345 [Use libxml2 instead of Expat])])
347 if test "$enable_libxml2" = "yes"; then
348 PKG_CHECK_MODULES([LIBXML2], [libxml-2.0 >= 2.6])
349 AC_DEFINE_UNQUOTED(ENABLE_LIBXML2,1,[Use libxml2 instead of Expat])
351 AC_SUBST(LIBXML2_CFLAGS)
352 AC_SUBST(LIBXML2_LIBS)
356 # Set default font directory
359 AC_ARG_WITH(default-fonts,
360 [AC_HELP_STRING([--with-default-fonts=DIR],
361 [Use fonts from DIR when config is busted])],
362 default_fonts="$withval", default_fonts=yes)
364 case "$default_fonts" in
366 if test "$os_win32" = "yes"; then
367 FC_DEFAULT_FONTS="WINDOWSFONTDIR"
368 AC_DEFINE_UNQUOTED(FC_DEFAULT_FONTS, "WINDOWSFONTDIR",
369 [Windows font directory])
371 FC_DEFAULT_FONTS="/usr/share/fonts"
372 AC_DEFINE_UNQUOTED(FC_DEFAULT_FONTS, "/usr/share/fonts",
373 [System font directory])
377 FC_DEFAULT_FONTS="$default_fonts"
378 AC_DEFINE_UNQUOTED(FC_DEFAULT_FONTS, "$default_fonts",
379 [System font directory])
383 AC_SUBST(FC_DEFAULT_FONTS)
386 # Add more fonts if available. By default, add only the directories
387 # with outline fonts; those with bitmaps can be added as desired in
388 # local.conf or ~/.fonts.conf
390 AC_ARG_WITH(add-fonts,
391 [AC_HELP_STRING([--with-add-fonts=DIR1,DIR2,...],
392 [Find additional fonts in DIR1,DIR2,... ])],
393 add_fonts="$withval", add_fonts=yes)
398 for dir in /usr/X11R6/lib/X11 /usr/X11/lib/X11 /usr/lib/X11; do
399 case x"$FC_ADD_FONTS" in
402 if test -d "$sub"; then
403 case x$FC_ADD_FONTS in
408 FC_ADD_FONTS="$FC_ADD_FONTS,$sub"
415 AC_DEFINE_UNQUOTED(FC_ADD_FONTS,"$add_fonts",[Additional font directories])
421 FC_ADD_FONTS="$add_fonts"
422 AC_DEFINE_UNQUOTED(FC_ADD_FONTS,"$add_fonts",[Additional font directories])
426 AC_SUBST(FC_ADD_FONTS)
430 case "$FC_ADD_FONTS" in
434 FC_FONTPATH=`echo $FC_ADD_FONTS |
435 sed -e 's/^/<dir>/' -e 's/$/<\/dir>/' -e 's/,/<\/dir> <dir>/g'`
439 AC_SUBST(FC_FONTPATH)
442 # Set default cache directory path
444 AC_ARG_WITH(cache-dir,
445 [AC_HELP_STRING([--with-cache-dir=DIR],
446 [Use DIR to store cache files [default=LOCALSTATEDIR/cache/fontconfig]])],
447 fc_cachedir="$withval", fc_cachedir=yes)
451 if test "$os_win32" = "yes"; then
452 fc_cachedir="WINDOWSTEMPDIR_FONTCONFIG_CACHE"
454 fc_cachedir='${localstatedir}/cache/${PACKAGE}'
460 AC_SUBST(fc_cachedir)
461 FC_CACHEDIR=${fc_cachedir}
462 AC_SUBST(FC_CACHEDIR)
464 FC_FONTDATE=`LC_ALL=C date`
466 AC_SUBST(FC_FONTDATE)
469 # Set configuration paths
472 AC_ARG_WITH(templatedir,
473 [AC_HELP_STRING([--with-templatedir=DIR],
474 [Use DIR to store the configuration template files [default=DATADIR/fontconfig/conf.avail]])],
475 [templatedir="$withval"],
477 AC_ARG_WITH(baseconfigdir,
478 [AC_HELP_STRING([--with-baseconfigdir=DIR],
479 [Use DIR to store the base configuration files [default=SYSCONFDIR/fonts]])],
480 [baseconfigdir="$withval"],
482 AC_ARG_WITH(configdir,
483 [AC_HELP_STRING([--with-configdir=DIR],
484 [Use DIR to store active configuration files [default=BASECONFIGDIR/conf.d]])],
485 [configdir="$withval"],
488 [AC_HELP_STRING([--with-xmldir=DIR],
489 [Use DIR to store XML schema files [default=DATADIR/xml/fontconfig]])],
493 case "$templatedir" in
495 templatedir='${datadir}'/fontconfig/conf.avail
500 case "$baseconfigdir" in
502 baseconfigdir='${sysconfdir}'/fonts
509 configdir='${baseconfigdir}'/conf.d
516 xmldir='${datadir}'/xml/fontconfig
522 TEMPLATEDIR=${templatedir}
523 BASECONFIGDIR=${baseconfigdir}
524 CONFIGDIR=${configdir}
526 AC_SUBST(templatedir)
527 AC_SUBST(TEMPLATEDIR)
528 AC_SUBST(baseconfigdir)
529 AC_SUBST(BASECONFIGDIR)
536 # Let people not build/install docs if they don't have docbook
539 AC_CHECK_PROG(HASDOCBOOK, docbook2html, yes, no)
541 AM_CONDITIONAL(USEDOCBOOK, test "x$HASDOCBOOK" = xyes)
545 # Check if docs exist or can be created
547 if test x$HASDOCBOOK = xno; then
548 if test -f $srcdir/doc/fonts-conf.5; then
556 [AC_HELP_STRING([--disable-docs],
557 [Don't build and install documentation])],
559 enable_docs=$default_docs)
561 AM_CONDITIONAL(ENABLE_DOCS, test "x$enable_docs" = xyes)
563 if test "x$enable_docs" = xyes; then
566 cat $srcdir/doc/*.fncs | awk '
567 /^@TITLE@/ { if (!done) { printf ("%s\n", $2); done = 1; } }
568 /^@FUNC@/ { if (!done) { printf ("%s\n", $2); done = 1; } }
569 /^@@/ { done = 0; }' > $tmp
570 DOCMAN3=`cat $tmp | awk '{ printf ("%s.3 ", $1); }'`
571 echo DOCMAN3 $DOCMAN3
582 dnl Figure out what cache format suffix to use for this architecture
584 AC_CHECK_SIZEOF([void *])
585 AC_CHECK_ALIGNOF([double])
587 dnl include the header file for workaround of miscalculating size on autoconf
588 dnl particularly for fat binaries
589 AH_BOTTOM([#include "config-fixups.h"])
595 fc-glyphname/Makefile