configure.ac revision 953daeba
1dnl 2dnl fontconfig/configure.in 3dnl 4dnl Copyright © 2003 Keith Packard 5dnl 6dnl Permission to use, copy, modify, distribute, and sell this software and its 7dnl documentation for any purpose is hereby granted without fee, provided that 8dnl the above copyright notice appear in all copies and that both that 9dnl copyright notice and this permission notice appear in supporting 10dnl documentation, and that the name of the author(s) not be used in 11dnl advertising or publicity pertaining to distribution of the software without 12dnl specific, written prior permission. The authors make no 13dnl representations about the suitability of this software for any purpose. It 14dnl is provided "as is" without express or implied warranty. 15dnl 16dnl THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 17dnl INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO 18dnl EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR 19dnl CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 20dnl DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 21dnl TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 22dnl PERFORMANCE OF THIS SOFTWARE. 23dnl 24dnl Process this file with autoconf to create configure. 25 26AC_PREREQ(2.61) 27 28dnl ========================================================================== 29dnl Versioning 30dnl ========================================================================== 31 32dnl This is the package version number, not the shared library 33dnl version. This same version number must appear in fontconfig/fontconfig.h 34dnl Yes, it is a pain to synchronize version numbers. Unfortunately, it's 35dnl not possible to extract the version number here from fontconfig.h 36AC_INIT([fontconfig], [2.12.4], [https://bugs.freedesktop.org/enter_bug.cgi?product=fontconfig]) 37AM_INIT_AUTOMAKE([1.11 parallel-tests dist-bzip2]) 38m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) 39 40dnl ========================================================================== 41 42AC_CONFIG_HEADERS(config.h) 43AC_CONFIG_MACRO_DIR([m4]) 44 45AC_PROG_CC 46AC_USE_SYSTEM_EXTENSIONS 47AC_SYS_LARGEFILE 48AC_PROG_INSTALL 49AC_PROG_LN_S 50AC_PROG_MAKE_SET 51PKG_PROG_PKG_CONFIG 52m4_ifdef([PKG_INSTALLDIR], [PKG_INSTALLDIR], AC_SUBST([pkgconfigdir], ${libdir}/pkgconfig)) 53 54AM_MISSING_PROG([GIT], [git]) 55AM_MISSING_PROG([GPERF], [gperf]) 56AM_PATH_PYTHON(,, [:]) 57AM_CONDITIONAL([HAVE_PYTHON], [test "$PYTHON" != :]) 58 59AC_MSG_CHECKING([for RM macro]) 60_predefined_rm=`make -p -f /dev/null 2>/dev/null|grep '^RM ='|sed -e 's/^RM = //'` 61if test "x$_predefined_rm" = "x"; then 62 AC_MSG_RESULT([no predefined RM]) 63 AC_CHECK_PROG(RM, rm, [rm -f]) 64else 65 AC_MSG_RESULT($_predefined_rm) 66fi 67 68dnl Initialize libtool 69LT_PREREQ([2.2]) 70LT_INIT([disable-static win32-dll]) 71 72dnl libtool versioning 73 74dnl bump revision when fixing bugs 75dnl bump current and age, reset revision to zero when adding APIs 76dnl bump current, leave age, reset revision to zero when changing/removing APIS 77LIBT_CURRENT=10 78LIBT_REVISION=4 79AC_SUBST(LIBT_CURRENT) 80AC_SUBST(LIBT_REVISION) 81LIBT_AGE=9 82 83LIBT_VERSION_INFO="$LIBT_CURRENT:$LIBT_REVISION:$LIBT_AGE" 84AC_SUBST(LIBT_VERSION_INFO) 85 86LIBT_CURRENT_MINUS_AGE=`expr $LIBT_CURRENT - $LIBT_AGE` 87AC_SUBST(LIBT_CURRENT_MINUS_AGE) 88 89PKGCONFIG_REQUIRES= 90PKGCONFIG_REQUIRES_PRIVATELY= 91 92dnl ========================================================================== 93 94case "$host" in 95 *-*-mingw*) 96 os_win32=yes 97 ;; 98 *) 99 os_win32=no 100esac 101AM_CONDITIONAL(OS_WIN32, test "$os_win32" = "yes") 102 103if test "$os_win32" = "yes"; then 104 AC_CHECK_PROG(ms_librarian, lib.exe, yes, no) 105fi 106AM_CONDITIONAL(MS_LIB_AVAILABLE, test x$ms_librarian = xyes) 107 108AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"]) 109WARN_CFLAGS="" 110WARNING_CPP_DIRECTIVE="no" 111if test "x$GCC" = "xyes"; then 112 WARN_CFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes \ 113 -Wmissing-prototypes -Wmissing-declarations \ 114 -Wnested-externs -fno-strict-aliasing" 115 WARNING_CPP_DIRECTIVE="yes" 116elif test "x$SUNCC" = "xyes"; then 117 WARN_CFLAGS="-v -fd" 118 WARNING_CPP_DIRECTIVE="yes" 119fi 120if test "x$WARNING_CPP_DIRECTIVE" = "xyes"; then 121 AC_DEFINE_UNQUOTED(HAVE_WARNING_CPP_DIRECTIVE,1, 122 [Can use #warning in C files]) 123fi 124AC_SUBST(WARN_CFLAGS) 125 126 127dnl ========================================================================== 128 129AX_CC_FOR_BUILD() 130AC_ARG_VAR(CC_FOR_BUILD, [build system C compiler]) 131AM_CONDITIONAL(CROSS_COMPILING, test $cross_compiling = yes) 132AM_CONDITIONAL(ENABLE_SHARED, test "$enable_shared" = "yes") 133 134dnl ========================================================================== 135 136AC_ARG_WITH(arch, 137 [AC_HELP_STRING([--with-arch=ARCH], 138 [Force architecture to ARCH])], 139 arch="$withval", arch=auto) 140 141if test "x$arch" != xauto; then 142 AC_DEFINE_UNQUOTED([FC_ARCHITECTURE], "$arch", [Architecture prefix to use for cache file names]) 143fi 144 145 146dnl ========================================================================== 147 148# Checks for header files. 149AC_HEADER_DIRENT 150AC_HEADER_STDC 151AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h sys/statvfs.h sys/vfs.h sys/statfs.h sys/param.h sys/mount.h]) 152AX_CREATE_STDINT_H([src/fcstdint.h]) 153 154# Checks for typedefs, structures, and compiler characteristics. 155AC_C_CONST 156AC_C_INLINE 157AC_C_FLEXIBLE_ARRAY_MEMBER 158AC_TYPE_PID_T 159 160# Checks for library functions. 161AC_FUNC_VPRINTF 162AC_FUNC_MMAP 163AC_CHECK_FUNCS([link mkstemp mkostemp _mktemp_s mkdtemp getopt getopt_long getprogname getexecname rand random lrand48 random_r rand_r readlink fstatvfs fstatfs lstat]) 164 165dnl AC_CHECK_FUNCS doesn't check for header files. 166dnl posix_fadvise() may be not available in older libc. 167AC_CHECK_SYMBOL([posix_fadvise], [fcntl.h], [fc_func_posix_fadvise=1], [fc_func_posix_fadvise=0]) 168AC_DEFINE_UNQUOTED([HAVE_POSIX_FADVISE], [$fc_func_posix_fadvise], [Define to 1 if you have the 'posix_fadvise' function.]) 169 170# 171AC_CHECK_MEMBERS([struct stat.st_mtim],,, [#include <sys/stat.h>]) 172 173# 174if test "x$ac_cv_func_fstatvfs" = "xyes"; then 175 AC_CHECK_MEMBERS([struct statvfs.f_basetype, struct statvfs.f_fstypename],,, 176 [#include <sys/statvfs.h>]) 177fi 178if test "x$ac_cv_func_fstatfs" = "xyes"; then 179 AC_CHECK_MEMBERS([struct statfs.f_flags, struct statfs.f_fstypename],,, [ 180#ifdef HAVE_SYS_VFS_H 181#include <sys/vfs.h> 182#endif 183#ifdef HAVE_SYS_STATFS_H 184#include <sys/statfs.h> 185#endif 186#ifdef HAVE_SYS_PARAM_H 187#include <sys/param.h> 188#endif 189#ifdef HAVE_SYS_MOUNT_H 190#include <sys/mount.h> 191#endif]) 192fi 193AC_CHECK_MEMBERS([struct dirent.d_type],,, 194 [#include <dirent.h>]) 195 196# Check the argument type of the gperf hash/lookup function 197AC_MSG_CHECKING([The type of len parameter of gperf hash/lookup function]) 198fc_gperf_test="$(echo 'foo' | gperf -L ANSI-C)" 199AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 200 #include <string.h> 201 202 const char *in_word_set(register const char *, register size_t); 203 $fc_gperf_test 204 ]])], [FC_GPERF_SIZE_T=size_t], 205 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 206 #include <string.h> 207 208 const char *in_word_set(register const char *, register unsigned int); 209 $fc_gperf_test 210 ]])], [FC_GPERF_SIZE_T="unsigned int"], 211 [AC_MSG_ERROR([Unable to determine the type of the len parameter of the gperf hash/lookup function])] 212)]) 213AC_DEFINE_UNQUOTED(FC_GPERF_SIZE_T, $FC_GPERF_SIZE_T, [The type of len parameter of the gperf hash/lookup function]) 214AC_MSG_RESULT($FC_GPERF_SIZE_T) 215 216# 217# Checks for iconv 218# 219AC_ARG_ENABLE(iconv, 220 [AC_HELP_STRING([--enable-iconv], 221 [Use iconv to support non-Unicode SFNT name])], 222 ,enable_iconv=no) 223AC_ARG_WITH(libiconv, 224 [AC_HELP_STRING([--with-libiconv=DIR], 225 [Use libiconv in DIR])], 226 [if test "x$withval" = "xyes"; then 227 libiconv_prefix=$prefix 228 else 229 libiconv_prefix=$withval 230 fi], 231 [libiconv_prefix=auto]) 232AC_ARG_WITH(libiconv-includes, 233 [AC_HELP_STRING([--with-libiconv-includes=DIR], 234 [Use libiconv includes in DIR])], 235 [libiconv_includes=$withval], 236 [libiconv_includes=auto]) 237AC_ARG_WITH(libiconv-lib, 238 [AC_HELP_STRING([--with-libiconv-lib=DIR], 239 [Use libiconv library in DIR])], 240 [libiconv_lib=$withval], 241 [libiconv_lib=auto]) 242 243# if no libiconv,libiconv-includes,libiconv-lib are specified, 244# libc's iconv has a priority. 245if test "$libiconv_includes" != "auto" -a -r ${libiconv_includes}/iconv.h; then 246 libiconv_cflags="-I${libiconv_includes}" 247elif test "$libiconv_prefix" != "auto" -a -r ${libiconv_prefix}/include/iconv.h; then 248 libiconv_cflags="-I${libiconv_prefix}/include" 249else 250 libiconv_cflags="" 251fi 252libiconv_libs="" 253if test "x$libiconv_cflags" != "x"; then 254 if test "$libiconv_lib" != "auto" -a -d ${libiconv_lib}; then 255 libiconv_libs="-L${libiconv_lib} -liconv" 256 elif test "$libiconv_prefix" != "auto" -a -d ${libiconv_prefix}/lib; then 257 libiconv_libs="-L${libiconv_prefix}/lib -liconv" 258 else 259 libiconv_libs="-liconv" 260 fi 261fi 262 263use_iconv=0 264if test "x$enable_iconv" != "xno"; then 265 AC_MSG_CHECKING([for a usable iconv]) 266 if test "x$libiconv_cflags" != "x" -o "x$libiconv_libs" != "x"; then 267 iconvsaved_CFLAGS="$CFLAGS" 268 iconvsaved_LIBS="$LIBS" 269 CFLAGS="$CFLAGS $libiconv_cflags" 270 LIBS="$LIBS $libiconv_libs" 271 272 AC_TRY_LINK([#include <iconv.h>], 273 [iconv_open ("from", "to");], 274 [iconv_type="libiconv" 275 use_iconv=1 276 ICONV_CFLAGS="$libiconv_cflags" 277 ICONV_LIBS="$libiconv_libs" 278 ], 279 [use_iconv=0]) 280 281 CFLAGS="$iconvsaved_CFLAGS" 282 LIBS="$iconvsaved_LIBS" 283 fi 284 if test "x$use_iconv" = "x0"; then 285 AC_TRY_LINK([#include <iconv.h>], 286 [iconv_open ("from", "to");], 287 [iconv_type="libc" 288 use_iconv=1], 289 [iconv_type="not found" 290 use_iconv=0]) 291 fi 292 293 AC_MSG_RESULT([$iconv_type]) 294 AC_SUBST(ICONV_CFLAGS) 295 AC_SUBST(ICONV_LIBS) 296fi 297AC_DEFINE_UNQUOTED(USE_ICONV,$use_iconv,[Use iconv.]) 298# 299# Checks for FreeType 300# 301PKG_CHECK_MODULES(FREETYPE, freetype2) 302PKGCONFIG_REQUIRES="$PKGCONFIG_REQUIRES freetype2" 303 304AC_SUBST(FREETYPE_LIBS) 305AC_SUBST(FREETYPE_CFLAGS) 306 307fontconfig_save_libs="$LIBS" 308fontconfig_save_cflags="$CFLAGS" 309LIBS="$LIBS $FREETYPE_LIBS" 310CFLAGS="$CFLAGS $FREETYPE_CFLAGS" 311 312dnl See http://git.savannah.gnu.org/cgit/freetype/freetype2.git/tree/docs/VERSIONS.TXT for versioning in freetype 313dnl 314dnl The outcome of the family property has been changed in freetype-2.7.1. 315dnl Our test cases relies on it and need to update the dependency to get it success. 316dnl However it isn't exactly required to run fontconfig itself. 317dnl so adding another test here for compatibility. it might be simplified in the future. 318PKG_CHECK_EXISTS([freetype2 = 19.0.13], [have_freetype_2_7_1=yes], [have_freetype_2_7_1=no]) 319PKG_CHECK_EXISTS([freetype2 >= 20.0.14], 320 [AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ 321 #include <ft2build.h> 322 #include FT_CONFIG_OPTIONS_H 323 #ifndef PCF_CONFIG_OPTION_LONG_FAMILY_NAMES 324 # error "No pcf long family names support" 325 #endif 326 ]])], [have_pcf_long_family_names=yes], [have_pcf_long_family_names=no])], 327 [have_pcf_long_family_names=no]) 328AM_CONDITIONAL(FREETYPE_PCF_LONG_FAMILY_NAMES, test "x$have_freetype_2_7_1" = xyes -o "x$have_pcf_long_family_names" = xyes) 329 330AC_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) 331AC_CHECK_MEMBER(FT_Bitmap_Size.y_ppem, 332 HAVE_FT_BITMAP_SIZE_Y_PPEM=1, 333 HAVE_FT_BITMAP_SIZE_Y_PPEM=0, 334[#include <ft2build.h> 335#include FT_FREETYPE_H]) 336AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,$HAVE_FT_BITMAP_SIZE_Y_PPEM, 337 [FT_Bitmap_Size structure includes y_ppem field]) 338AC_CHECK_MEMBERS([TT_OS2.usLowerOpticalPointSize, TT_OS2.usUpperOpticalPointSize], [], [], [[ 339#include <ft2build.h> 340#include FT_FREETYPE_H 341#include FT_TRUETYPE_TABLES_H]]) 342 343CFLAGS="$fontconfig_save_cflags" 344LIBS="$fontconfig_save_libs" 345 346# 347# Check expat configuration 348# 349AC_ARG_WITH(expat, 350 [AC_HELP_STRING([--with-expat=DIR], 351 [Use Expat in DIR])], 352 [expat_prefix=$withval], 353 [expat_prefix=auto]) 354AC_ARG_WITH(expat-includes, 355 [AC_HELP_STRING([--with-expat-includes=DIR], 356 [Use Expat includes in DIR])], 357 [expat_includes=$withval], 358 [expat_includes=auto]) 359AC_ARG_WITH(expat-lib, 360 [AC_HELP_STRING([--with-expat-lib=DIR])], 361 [expat_lib=$withval], 362 [expat_lib=auto]) 363 364if test "$enable_libxml2" != "yes"; then 365 use_pkgconfig_for_expat=yes 366 if test "$expat_prefix" = "auto" -a "$expat_includes" = "auto" -a "$expat_lib" = "auto"; then 367 PKG_CHECK_MODULES(EXPAT, expat,,use_pkgconfig_for_expat=no) 368 else 369 use_pkgconfig_for_expat=no 370 fi 371 if test "x$use_pkgconfig_for_expat" = "xno"; then 372 if test "$expat_includes" != "auto" -a -r ${expat_includes}/expat.h; then 373 EXPAT_CFLAGS="-I${expat_includes}" 374 elif test "$expat_prefix" != "auto" -a -r ${expat_prefix}/include/expat.h; then 375 EXPAT_CFLAGS="-I${expat_prefix}/include" 376 else 377 EXPAT_CFLAGS="" 378 fi 379 if test "$expat_lib" != "auto"; then 380 EXPAT_LIBS="-L${expat_lib} -lexpat" 381 elif test "$expat_prefix" != "auto"; then 382 EXPAT_LIBS="-L${expat_prefix}/lib -lexpat" 383 else 384 EXPAT_LIBS="-lexpat" 385 fi 386 else 387 PKGCONFIG_REQUIRES_PRIVATELY="$PKGCONFIG_REQUIRES_PRIVATELY expat" 388 fi 389 390 expatsaved_CPPFLAGS="$CPPFLAGS" 391 expatsaved_LIBS="$LIBS" 392 CPPFLAGS="$CPPFLAGS $EXPAT_CFLAGS" 393 LIBS="$LIBS $EXPAT_LIBS" 394 395 AC_CHECK_HEADER(expat.h) 396 if test "$ac_cv_header_expat_h" = "no"; then 397 AC_CHECK_HEADER(xmlparse.h) 398 if test "$ac_cv_header_xmlparse_h" = "yes"; then 399 HAVE_XMLPARSE_H=1 400 AC_SUBST(HAVE_XMLPARSE_H) 401 AC_DEFINE_UNQUOTED(HAVE_XMLPARSE_H,$HAVE_XMLPARSE_H, 402 [Use xmlparse.h instead of expat.h]) 403 else 404 AC_MSG_ERROR([ 405*** expat is required. or try to use --enable-libxml2]) 406 fi 407 fi 408 AC_CHECK_FUNCS(XML_SetDoctypeDeclHandler) 409 if test "$ac_cv_func_XML_SetDoctypeDeclHandler" = "no"; then 410 AC_MSG_ERROR([ 411*** expat is required. or try to use --enable-libxml2]) 412 fi 413 CPPFLAGS="$expatsaved_CPPFLAGS" 414 LIBS="$expatsaved_LIBS" 415 416 AC_SUBST(EXPAT_CFLAGS) 417 AC_SUBST(EXPAT_LIBS) 418fi 419 420# 421# Check libxml2 configuration 422# 423AC_ARG_ENABLE(libxml2, 424 [AC_HELP_STRING([--enable-libxml2], 425 [Use libxml2 instead of Expat])]) 426 427if test "$enable_libxml2" = "yes"; then 428 PKG_CHECK_MODULES([LIBXML2], [libxml-2.0 >= 2.6]) 429 PKGCONFIG_REQUIRES_PRIVATELY="$PKGCONFIG_REQUIRES_PRIVATELY libxml-2.0" 430 AC_DEFINE_UNQUOTED(ENABLE_LIBXML2,1,[Use libxml2 instead of Expat]) 431 432 AC_SUBST(LIBXML2_CFLAGS) 433 AC_SUBST(LIBXML2_LIBS) 434 435 fc_saved_CFLAGS="$CFLAGS" 436 CFLAGS="$CFLAGS $LIBXML2_CFLAGS" 437 AC_MSG_CHECKING([SAX1 support in libxml2]) 438 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ 439 #include <libxml/xmlversion.h> 440 #if !defined(LIBXML_SAX1_ENABLED) 441 # include "error: No SAX1 support in libxml2" 442 #endif 443 ]])], [AC_MSG_RESULT([found])], [AC_MSG_ERROR([ 444*** SAX1 support in libxml2 is required. enable it or use expat instead.])]) 445 CFLAGS="$fc_saved_CFLAGS" 446fi 447 448# 449# Set default hinting 450# 451 452AC_ARG_WITH(default-hinting, 453 [AC_HELP_STRING([--with-default-hinting=NAME], 454 [Enable your preferred hinting configuration (none/slight/medium/full) [default=slight]])], 455 preferred_hinting="$withval", preferred_hinting=slight) 456 457case "$preferred_hinting" in 458none|slight|medium|full) 459 PREFERRED_HINTING="$preferred_hinting" 460 AC_SUBST(PREFERRED_HINTING) 461 ;; 462*) 463 AC_MSG_ERROR([Invalid hinting. please choose one of none, slight, medium, or full]) 464 ;; 465esac 466 467# 468# Set default font directory 469# 470 471AC_ARG_WITH(default-fonts, 472 [AC_HELP_STRING([--with-default-fonts=DIR], 473 [Use fonts from DIR when config is busted])], 474 default_fonts="$withval", default_fonts=yes) 475 476case "$default_fonts" in 477yes) 478 if test "$os_win32" = "yes"; then 479 FC_DEFAULT_FONTS="WINDOWSFONTDIR" 480 AC_DEFINE_UNQUOTED(FC_DEFAULT_FONTS, "WINDOWSFONTDIR", 481 [Windows font directory]) 482 else 483 FC_DEFAULT_FONTS="/usr/share/fonts" 484 AC_DEFINE_UNQUOTED(FC_DEFAULT_FONTS, "/usr/share/fonts", 485 [System font directory]) 486 fi 487 ;; 488*) 489 FC_DEFAULT_FONTS="$default_fonts" 490 AC_DEFINE_UNQUOTED(FC_DEFAULT_FONTS, "$default_fonts", 491 [System font directory]) 492 ;; 493esac 494 495AC_SUBST(FC_DEFAULT_FONTS) 496 497# 498# Add more fonts if available. By default, add only the directories 499# with outline fonts; those with bitmaps can be added as desired in 500# local.conf or ~/.fonts.conf 501# 502AC_ARG_WITH(add-fonts, 503 [AC_HELP_STRING([--with-add-fonts=DIR1,DIR2,...], 504 [Find additional fonts in DIR1,DIR2,... ])], 505 add_fonts="$withval", add_fonts=yes) 506 507case "$add_fonts" in 508yes) 509 FC_ADD_FONTS="" 510 for dir in /usr/X11R6/lib/X11 /usr/X11/lib/X11 /usr/lib/X11; do 511 case x"$FC_ADD_FONTS" in 512 x) 513 sub="$dir/fonts" 514 if test -d "$sub"; then 515 case x$FC_ADD_FONTS in 516 x) 517 FC_ADD_FONTS="$sub" 518 ;; 519 *) 520 FC_ADD_FONTS="$FC_ADD_FONTS,$sub" 521 ;; 522 esac 523 fi 524 ;; 525 esac 526 done 527 AC_DEFINE_UNQUOTED(FC_ADD_FONTS,"$add_fonts",[Additional font directories]) 528 ;; 529no) 530 FC_ADD_FONTS="" 531 ;; 532*) 533 FC_ADD_FONTS="$add_fonts" 534 AC_DEFINE_UNQUOTED(FC_ADD_FONTS,"$add_fonts",[Additional font directories]) 535 ;; 536esac 537 538AC_SUBST(FC_ADD_FONTS) 539 540FC_FONTPATH="" 541 542case "$FC_ADD_FONTS" in 543"") 544 ;; 545*) 546 FC_FONTPATH=`echo $FC_ADD_FONTS | 547 sed -e 's/^/<dir>/' -e 's/$/<\/dir>/' -e 's/,/<\/dir> <dir>/g'` 548 ;; 549esac 550 551AC_SUBST(FC_FONTPATH) 552 553# 554# Set default cache directory path 555# 556AC_ARG_WITH(cache-dir, 557 [AC_HELP_STRING([--with-cache-dir=DIR], 558 [Use DIR to store cache files [default=LOCALSTATEDIR/cache/fontconfig]])], 559 fc_cachedir="$withval", fc_cachedir=yes) 560 561case $fc_cachedir in 562no|yes) 563 if test "$os_win32" = "yes"; then 564 fc_cachedir="LOCAL_APPDATA_FONTCONFIG_CACHE" 565 else 566 fc_cachedir='${localstatedir}/cache/${PACKAGE}' 567 fi 568 ;; 569*) 570 ;; 571esac 572AC_SUBST(fc_cachedir) 573FC_CACHEDIR=${fc_cachedir} 574AC_SUBST(FC_CACHEDIR) 575 576FC_FONTDATE=`LC_ALL=C date` 577 578AC_SUBST(FC_FONTDATE) 579 580# 581# Set configuration paths 582# 583 584AC_ARG_WITH(templatedir, 585 [AC_HELP_STRING([--with-templatedir=DIR], 586 [Use DIR to store the configuration template files [default=DATADIR/fontconfig/conf.avail]])], 587 [templatedir="$withval"], 588 [templatedir=yes]) 589AC_ARG_WITH(baseconfigdir, 590 [AC_HELP_STRING([--with-baseconfigdir=DIR], 591 [Use DIR to store the base configuration files [default=SYSCONFDIR/fonts]])], 592 [baseconfigdir="$withval"], 593 [baseconfigdir=yes]) 594AC_ARG_WITH(configdir, 595 [AC_HELP_STRING([--with-configdir=DIR], 596 [Use DIR to store active configuration files [default=BASECONFIGDIR/conf.d]])], 597 [configdir="$withval"], 598 [configdir=yes]) 599AC_ARG_WITH(xmldir, 600 [AC_HELP_STRING([--with-xmldir=DIR], 601 [Use DIR to store XML schema files [default=DATADIR/xml/fontconfig]])], 602 [xmldir="$withval"], 603 [xmldir=yes]) 604 605case "$templatedir" in 606no|yes) 607 templatedir='${datadir}'/fontconfig/conf.avail 608 ;; 609*) 610 ;; 611esac 612case "$baseconfigdir" in 613no|yes) 614 baseconfigdir='${sysconfdir}'/fonts 615 ;; 616*) 617 ;; 618esac 619case "$configdir" in 620no|yes) 621 configdir='${BASECONFIGDIR}'/conf.d 622 ;; 623*) 624 ;; 625esac 626case "$xmldir" in 627no|yes) 628 xmldir='${datadir}'/xml/fontconfig 629 ;; 630*) 631 ;; 632esac 633 634TEMPLATEDIR=${templatedir} 635BASECONFIGDIR=${baseconfigdir} 636CONFIGDIR=${configdir} 637XMLDIR=${xmldir} 638AC_SUBST(TEMPLATEDIR) 639AC_SUBST(BASECONFIGDIR) 640AC_SUBST(CONFIGDIR) 641AC_SUBST(XMLDIR) 642 643 644dnl =========================================================================== 645 646# 647# Thread-safety primitives 648# 649 650AC_CACHE_CHECK([for Intel atomic primitives], fc_cv_have_intel_atomic_primitives, [ 651 fc_cv_have_intel_atomic_primitives=false 652 AC_TRY_LINK([ 653 void memory_barrier (void) { __sync_synchronize (); } 654 int atomic_add (int *i) { return __sync_fetch_and_add (i, 1); } 655 int mutex_trylock (int *m) { return __sync_lock_test_and_set (m, 1); } 656 void mutex_unlock (int *m) { __sync_lock_release (m); } 657 ], [], fc_cv_have_intel_atomic_primitives=true 658 ) 659]) 660if $fc_cv_have_intel_atomic_primitives; then 661 AC_DEFINE(HAVE_INTEL_ATOMIC_PRIMITIVES, 1, [Have Intel __sync_* atomic primitives]) 662fi 663 664AC_CACHE_CHECK([for Solaris atomic operations], fc_cv_have_solaris_atomic_ops, [ 665 fc_cv_have_solaris_atomic_ops=false 666 AC_TRY_LINK([ 667 #include <atomic.h> 668 /* This requires Solaris Studio 12.2 or newer: */ 669 #include <mbarrier.h> 670 void memory_barrier (void) { __machine_rw_barrier (); } 671 int atomic_add (volatile unsigned *i) { return atomic_add_int_nv (i, 1); } 672 void *atomic_ptr_cmpxchg (volatile void **target, void *cmp, void *newval) { return atomic_cas_ptr (target, cmp, newval); } 673 ], [], fc_cv_have_solaris_atomic_ops=true 674 ) 675]) 676if $fc_cv_have_solaris_atomic_ops; then 677 AC_DEFINE(HAVE_SOLARIS_ATOMIC_OPS, 1, [Have Solaris __machine_*_barrier and atomic_* operations]) 678fi 679 680if test "$os_win32" = no && ! $have_pthread; then 681 AC_CHECK_HEADERS(sched.h) 682 AC_SEARCH_LIBS(sched_yield,rt,AC_DEFINE(HAVE_SCHED_YIELD, 1, [Have sched_yield])) 683fi 684 685have_pthread=false 686if test "$os_win32" = no; then 687 AX_PTHREAD([have_pthread=true]) 688fi 689if $have_pthread; then 690 LIBS="$PTHREAD_LIBS $LIBS" 691 CFLAGS="$CFLAGS $PTHREAD_CFLAGS" 692 CC="$PTHREAD_CC" 693 AC_DEFINE(HAVE_PTHREAD, 1, [Have POSIX threads]) 694fi 695AM_CONDITIONAL(HAVE_PTHREAD, $have_pthread) 696 697 698dnl =========================================================================== 699 700# 701# Let people not build/install docs if they don't have docbook 702# 703 704AC_CHECK_PROG(HASDOCBOOK, docbook2html, yes, no) 705 706AM_CONDITIONAL(USEDOCBOOK, test "x$HASDOCBOOK" = xyes) 707 708default_docs="yes" 709# 710# Check if docs exist or can be created 711# 712if test x$HASDOCBOOK = xno; then 713 if test -f $srcdir/doc/fonts-conf.5; then 714 : 715 else 716 default_docs="no" 717 fi 718fi 719 720AC_ARG_ENABLE(docs, 721 [AC_HELP_STRING([--disable-docs], 722 [Don't build and install documentation])], 723 , 724 enable_docs=$default_docs) 725 726AM_CONDITIONAL(ENABLE_DOCS, test "x$enable_docs" = xyes) 727 728if test "x$enable_docs" = xyes; then 729 tmp=funcs.$$ 730 cat $srcdir/doc/*.fncs | awk ' 731 /^@TITLE@/ { if (!done) { printf ("%s\n", $2); done = 1; } } 732 /^@FUNC@/ { if (!done) { printf ("%s\n", $2); done = 1; } } 733 /^@@/ { done = 0; }' > $tmp 734 DOCMAN3=`cat $tmp | awk '{ printf ("%s.3 ", $1); }'` 735 echo DOCMAN3 $DOCMAN3 736 rm -f $tmp 737else 738 DOCMAN3="" 739fi 740AC_SUBST(DOCMAN3) 741 742 743dnl Figure out what cache format suffix to use for this architecture 744AC_C_BIGENDIAN 745AC_CHECK_SIZEOF([void *]) 746AC_CHECK_ALIGNOF([double]) 747AC_CHECK_ALIGNOF([void *]) 748 749dnl include the header file for workaround of miscalculating size on autoconf 750dnl particularly for fat binaries 751AH_BOTTOM([#include "config-fixups.h"]) 752 753dnl 754dnl 755AC_SUBST(PKGCONFIG_REQUIRES) 756AC_SUBST(PKGCONFIG_REQUIRES_PRIVATELY) 757 758dnl 759AC_CONFIG_FILES([ 760Makefile 761fontconfig/Makefile 762fc-lang/Makefile 763fc-glyphname/Makefile 764fc-blanks/Makefile 765fc-case/Makefile 766src/Makefile 767conf.d/Makefile 768fc-cache/Makefile 769fc-cat/Makefile 770fc-list/Makefile 771fc-match/Makefile 772fc-pattern/Makefile 773fc-query/Makefile 774fc-scan/Makefile 775fc-validate/Makefile 776doc/Makefile 777doc/version.sgml 778test/Makefile 779fontconfig.spec 780fontconfig.pc 781fontconfig-zip 782]) 783AC_OUTPUT 784