]> git.wh0rd.org - fontconfig.git/blame - configure.in
Bump libtool revision in preparation for release
[fontconfig.git] / configure.in
CommitLineData
20fa60c9 1dnl
e690fbb2 2dnl fontconfig/configure.in
20fa60c9 3dnl
46b51147 4dnl Copyright © 2003 Keith Packard
20fa60c9
KP
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 Keith Packard not be used in
11dnl advertising or publicity pertaining to distribution of the software without
12dnl specific, written prior permission. Keith Packard makes no
13dnl representations about the suitability of this software for any purpose. It
14dnl is provided "as is" without express or implied warranty.
15dnl
3074a73b 16dnl THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
20fa60c9 17dnl INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
3074a73b 18dnl EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR
20fa60c9
KP
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.
fb9545b1 23dnl
20fa60c9 24dnl Process this file with autoconf to create configure.
24330d27 25
8fc10a72
KP
26AC_INIT(fonts.dtd)
27
20fa60c9
KP
28dnl ==========================================================================
29dnl Versioning
30dnl ==========================================================================
fa244f3d 31
ff3f1f98
KP
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
b322eb4d 36AM_INIT_AUTOMAKE(fontconfig, 2.7.3)
247c4f3d 37m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
6ae6acf3 38AM_MAINTAINER_MODE
24330d27 39
20fa60c9
KP
40dnl libtool versioning
41
4984242e
KP
42dnl bump revision when fixing bugs
43dnl bump current and age, reset revision to zero when adding APIs
44dnl bump current, leave age, reset revision to zero when changing/removing APIS
50d937b0 45LIBT_CURRENT=5
2e44cbe1 46LIBT_REVISION=4
19d124dc
KP
47AC_SUBST(LIBT_CURRENT)
48AC_SUBST(LIBT_REVISION)
50d937b0 49LIBT_AGE=4
ff3f1f98 50
19d124dc
KP
51LIBT_VERSION_INFO="$LIBT_CURRENT:$LIBT_REVISION:$LIBT_AGE"
52AC_SUBST(LIBT_VERSION_INFO)
20fa60c9 53
19d124dc
KP
54LIBT_CURRENT_MINUS_AGE=`expr $LIBT_CURRENT - $LIBT_AGE`
55AC_SUBST(LIBT_CURRENT_MINUS_AGE)
daeed6e0 56
20fa60c9
KP
57dnl ==========================================================================
58
20fa60c9 59AM_CONFIG_HEADER(config.h)
fb9545b1 60
24330d27 61AC_PROG_CC
24330d27 62AC_PROG_INSTALL
24330d27 63AC_PROG_LN_S
daeed6e0 64AC_LIBTOOL_WIN32_DLL
20fa60c9 65AM_PROG_LIBTOOL
ef9db2e2 66DOLT
20fa60c9
KP
67AC_PROG_MAKE_SET
68
daeed6e0
TL
69dnl ==========================================================================
70
71case "$host" in
72 *-*-mingw*)
73 os_win32=yes
74 ;;
75 *)
76 os_win32=no
77esac
78AM_CONDITIONAL(OS_WIN32, test "$os_win32" = "yes")
79
80if test "$os_win32" = "yes"; then
81 AC_CHECK_PROG(ms_librarian, lib.exe, yes, no)
82fi
83AM_CONDITIONAL(MS_LIB_AVAILABLE, test x$ms_librarian = xyes)
84
6ae6acf3 85WARN_CFLAGS=""
6ae6acf3
KP
86if test "x$GCC" = "xyes"; then
87 WARN_CFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes \
88 -Wmissing-prototypes -Wmissing-declarations \
89 -Wnested-externs -fno-strict-aliasing"
5b8e43a4
KP
90 AC_DEFINE_UNQUOTED(HAVE_WARNING_CPP_DIRECTIVE,1,
91 [Can use #warning in C files])
6ae6acf3
KP
92fi
93AC_SUBST(WARN_CFLAGS)
94
5b8e43a4 95
daeed6e0
TL
96dnl ==========================================================================
97
d8ae9c92
KP
98AM_CONDITIONAL(CROSS_COMPILING, test $cross_compiling = yes)
99
100dnl ==========================================================================
101
102# Setup for compiling build tools (fc-glyphname, etc)
103AC_MSG_CHECKING([for a C compiler for build tools])
104if test $cross_compiling = yes; then
105 AC_CHECK_PROGS(CC_FOR_BUILD, gcc cc)
106else
107 CC_FOR_BUILD=$CC
108fi
109AC_MSG_RESULT([$CC_FOR_BUILD])
110AC_SUBST(CC_FOR_BUILD)
111
112AC_MSG_CHECKING([for suffix of executable build tools])
113if test $cross_compiling = yes; then
114 cat >conftest.c <<\_______EOF
115int
116main ()
117{
118 exit (0);
119}
120_______EOF
121 for i in .exe ""; do
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
125 EXEEXT_FOR_BUILD=$i
126 break
127 fi
128 fi
129 done
130 rm -f conftest*
131 if test "${EXEEXT_FOR_BUILD+set}" != set; then
132 AC_MSG_ERROR([Cannot determine suffix of executable build tools])
133 fi
134else
135 EXEEXT_FOR_BUILD=$EXEEXT
136fi
137AC_MSG_RESULT([$EXEEXT_FOR_BUILD])
138AC_SUBST(EXEEXT_FOR_BUILD)
139
140dnl ==========================================================================
141
2b629781
KP
142AC_ARG_WITH(arch, [ --with-arch=ARCH Force architecture to ARCH], arch="$withval", arch=auto)
143
144if test $cross_compiling = yes; then
145 case "$arch" in
146 auto)
147 AC_MSG_ERROR([Cannot autodetect architecture in cross compile environment]
148 [Use --with-arch=ARCH to specify architecture])
149 ;;
150 esac
151fi
152
153ARCHITECTURE=$arch
154AC_SUBST(ARCHITECTURE)
155
156dnl ==========================================================================
157
fb9545b1
KP
158# Checks for header files.
159AC_HEADER_DIRENT
160AC_HEADER_STDC
73775d8f 161AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h])
fb9545b1
KP
162
163# Checks for typedefs, structures, and compiler characteristics.
164AC_C_CONST
44415a07 165AC_C_INLINE
fb9545b1
KP
166AC_TYPE_PID_T
167
168# Checks for library functions.
fb9545b1 169AC_FUNC_VPRINTF
d6217cc6 170AC_FUNC_MMAP
cc104e6a 171AC_CHECK_FUNCS([geteuid getuid link memmove memset mkstemp strchr strrchr strtol getopt getopt_long sysconf ftruncate chsize rand random lrand48])
73775d8f
PL
172
173#
174# Checks for iconv
175#
176AC_MSG_CHECKING([for a usable iconv])
177ICONV_LIBS=""
178AC_TRY_LINK([#include <iconv.h>],
179 [iconv_open ("from", "to");],
180 [use_iconv=1],
181 [use_iconv=0])
182if test x$use_iconv = x1; then
183 AC_MSG_RESULT([libc])
184else
185 # try using libiconv
186 fontconfig_save_libs="$LIBS"
187 LIBS="$LIBS -liconv"
188
189 AC_TRY_LINK([#include <iconv.h>],
190 [iconv_open ("from", "to");],
34918278
KP
191 [use_iconv=1],
192 [use_iconv=0])
73775d8f
PL
193
194 if test x$use_iconv = x1; then
195 ICONV_LIBS="-liconv"
196 AC_MSG_RESULT([libiconv])
197 else
198 AC_MSG_RESULT([no])
199 fi
200
201 LIBS="$fontconfig_save_libs"
202fi
203AC_SUBST(ICONV_LIBS)
204AC_DEFINE_UNQUOTED(USE_ICONV,$use_iconv,[Use iconv.])
fb9545b1 205
446bb9c9 206#
20fa60c9 207# Checks for FreeType
fb9545b1 208#
24330d27 209
3910f322 210AC_ARG_WITH(freetype-config, [ --with-freetype-config=PROG Use FreeType configuration program PROG], freetype_config=$withval, freetype_config=yes)
24330d27 211
20fa60c9
KP
212if 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/])
216 fi
217else
218 ft_config="$freetype_config"
219fi
24330d27 220
996580dc
KP
221FREETYPE_CFLAGS="`$ft_config --cflags`"
222FREETYPE_LIBS="`$ft_config --libs`"
24330d27 223
20fa60c9
KP
224AC_SUBST(FREETYPE_LIBS)
225AC_SUBST(FREETYPE_CFLAGS)
fb9545b1 226
4f38fa81
KP
227fontconfig_save_libs="$LIBS"
228fontconfig_save_cflags="$CFLAGS"
20fa60c9 229LIBS="$LIBS $FREETYPE_LIBS"
4f38fa81 230CFLAGS="$CFLAGS $FREETYPE_CFLAGS"
00c0972a 231AC_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)
208a720f
KP
232AC_CHECK_MEMBER(FT_Bitmap_Size.y_ppem,
233 HAVE_FT_BITMAP_SIZE_Y_PPEM=1,
234 HAVE_FT_BITMAP_SIZE_Y_PPEM=0,
4f38fa81
KP
235[#include <ft2build.h>
236#include FT_FREETYPE_H])
4f38fa81
KP
237AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,$HAVE_FT_BITMAP_SIZE_Y_PPEM,
238 [FT_Bitmap_Size structure includes y_ppem field])
6ae6acf3
KP
239CFLAGS="$fontconfig_save_cflags"
240LIBS="$fontconfig_save_libs"
fb9545b1 241
fa244f3d
KP
242#
243# Check expat configuration
244#
24330d27 245
20fa60c9 246AC_ARG_WITH(expat, [ --with-expat=DIR Use Expat in DIR], expat=$withval, expat=yes)
3910f322
KP
247AC_ARG_WITH(expat-includes, [ --with-expat-includes=DIR Use Expat includes in DIR], expat_includes=$withval, expat_includes=yes)
248AC_ARG_WITH(expat-lib, [ --with-expat-lib=DIR Use Expat library in DIR], expat_lib=$withval, expat_lib=yes)
20fa60c9 249
e99f0f0a
PL
250if test "$enable_libxml2" != "yes"; then
251 case "$expat" in
252 no)
24330d27 253 ;;
e99f0f0a
PL
254 *)
255 case "$expat_includes" in
59e149e7 256 yes)
e99f0f0a
PL
257 case "$expat" in
258 yes)
259 ;;
260 *)
261 EXPAT_CFLAGS="-I$expat/include"
262 ;;
263 esac
264 ;;
265 no)
266 EXPAT_CFLAGS=""
59e149e7
KP
267 ;;
268 *)
e99f0f0a 269 EXPAT_CFLAGS="-I$expat_includes"
59e149e7
KP
270 ;;
271 esac
e99f0f0a 272 case "$expat_lib" in
fa244f3d 273 yes)
e99f0f0a
PL
274 case "$expat" in
275 yes)
276 EXPAT_LIBS="-lexpat"
277 ;;
278 *)
279 EXPAT_LIBS="-L$expat/lib -lexpat"
280 ;;
281 esac
282 ;;
283 no)
fb9545b1
KP
284 ;;
285 *)
e99f0f0a 286 EXPAT_LIBS="-L$expat_lib -lexpat"
fb9545b1
KP
287 ;;
288 esac
fb9545b1 289
e99f0f0a
PL
290 expatsaved_CPPFLAGS="$CPPFLAGS"
291 CPPFLAGS="$CPPFLAGS $EXPAT_CFLAGS"
292 expatsaved_LIBS="$LIBS"
293 LIBS="$LIBS $EXPAT_LIBS"
fb9545b1 294
e99f0f0a
PL
295 AC_CHECK_HEADER(expat.h)
296 case "$ac_cv_header_expat_h" in
fb9545b1 297 no)
e99f0f0a
PL
298 AC_CHECK_HEADER(xmlparse.h)
299 case "$ac_cv_header_xmlparse_h" in
300 no)
301 have_expat_header=no;
302 ;;
303 yes)
304 HAVE_XMLPARSE_H=1
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
309 ;;
310 esac
fb9545b1
KP
311 ;;
312 yes)
fb9545b1
KP
313 have_expat_header=yes
314 ;;
315 esac
e99f0f0a
PL
316 case "$have_expat_header" in
317 no)
a6a66da0
NL
318 expat=no
319 ;;
e99f0f0a
PL
320 yes)
321 AC_CHECK_FUNCS(XML_SetDoctypeDeclHandler)
322 case "$ac_cv_func_XML_SetDoctypeDeclHandler" in
323 yes)
324 HAVE_EXPAT=1
325 AC_SUBST(HAVE_EXPAT)
326 AC_DEFINE_UNQUOTED(HAVE_EXPAT,$HAVE_EXPAT,
327 [Found a useable expat library])
328 ;;
329 *)
330 expat=no
331 ;;
332 esac
333 ;;
fb9545b1 334 esac
e99f0f0a
PL
335 CPPFLAGS="$expatsaved_CPPFLAGS"
336 LIBS="$expatsaved_LIBS"
24330d27
KP
337 ;;
338 esac
fb9545b1 339
e99f0f0a
PL
340 AC_SUBST(EXPAT_CFLAGS)
341 AC_SUBST(EXPAT_LIBS)
342
343 case "$expat" in
344 no)
345 EXPAT_CFLAGS=""
346 EXPAT_LIBS=""
347
348 AC_MSG_WARN([Cannot find usable expat library. Trying to use libxml2 as fallback.])
349 ;;
350 esac
351fi
352
353#
354# Check libxml2 configuration
355#
356
357AC_ARG_ENABLE(libxml2, [ --enable-libxml2 Use libxml2 instead of Expat])
358
b17cf498
PL
359PKG_PROG_PKG_CONFIG
360
e99f0f0a
PL
361if 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])
364
365 AC_SUBST(LIBXML2_CFLAGS)
366 AC_SUBST(LIBXML2_LIBS)
367fi
24330d27 368
20fa60c9
KP
369#
370# Set default font directory
371#
372
3910f322 373AC_ARG_WITH(default-fonts, [ --with-default-fonts=DIR Use fonts from DIR when config is busted], default_fonts="$withval", default_fonts=yes)
20fa60c9
KP
374
375case "$default_fonts" in
376yes)
ee1d8125
TL
377 if test "$os_win32" = "yes"; then
378 FC_DEFAULT_FONTS="WINDOWSFONTDIR"
379 AC_DEFINE_UNQUOTED(FC_DEFAULT_FONTS, "WINDOWSFONTDIR",
380 [Windows font directory])
381 else
382 FC_DEFAULT_FONTS="/usr/share/fonts"
383 AC_DEFINE_UNQUOTED(FC_DEFAULT_FONTS, "/usr/share/fonts",
384 [System font directory])
385 fi
20fa60c9
KP
386 ;;
387*)
388 FC_DEFAULT_FONTS="$default_fonts"
389 AC_DEFINE_UNQUOTED(FC_DEFAULT_FONTS, "$default_fonts",
390 [System font directory])
391 ;;
392esac
393
394AC_SUBST(FC_DEFAULT_FONTS)
395
396#
af82b48c
KP
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
20fa60c9 400#
3910f322 401AC_ARG_WITH(add-fonts, [ --with-add-fonts=DIR1,DIR2,...Find additional fonts in DIR1,DIR2,... ], add_fonts="$withval", add_fonts=yes)
20fa60c9 402
af82b48c 403case "$add_fonts" in
20fa60c9 404yes)
af82b48c 405 FC_ADD_FONTS=""
bf0093b7 406 for dir in /usr/X11R6/lib/X11 /usr/X11/lib/X11 /usr/lib/X11; do
af82b48c 407 case x"$FC_ADD_FONTS" in
20fa60c9 408 x)
2d9c79c0
KP
409 sub="$dir/fonts"
410 if test -d "$sub"; then
411 case x$FC_ADD_FONTS in
412 x)
413 FC_ADD_FONTS="$sub"
414 ;;
415 *)
416 FC_ADD_FONTS="$FC_ADD_FONTS,$sub"
417 ;;
418 esac
20fa60c9
KP
419 fi
420 ;;
421 esac
422 done
af82b48c 423 AC_DEFINE_UNQUOTED(FC_ADD_FONTS,"$add_fonts",[Additional font directories])
20fa60c9
KP
424 ;;
425no)
af82b48c 426 FC_ADD_FONTS=""
20fa60c9
KP
427 ;;
428*)
af82b48c
KP
429 FC_ADD_FONTS="$add_fonts"
430 AC_DEFINE_UNQUOTED(FC_ADD_FONTS,"$add_fonts",[Additional font directories])
20fa60c9
KP
431 ;;
432esac
433
af82b48c 434AC_SUBST(FC_ADD_FONTS)
20fa60c9
KP
435
436FC_FONTPATH=""
437
af82b48c 438case "$FC_ADD_FONTS" in
20fa60c9
KP
439"")
440 ;;
441*)
af82b48c
KP
442 FC_FONTPATH=`echo $FC_ADD_FONTS |
443 sed -e 's/^/<dir>/' -e 's/$/<\/dir>/' -e 's/,/<\/dir> <dir>/g'`
20fa60c9
KP
444 ;;
445esac
446
447AC_SUBST(FC_FONTPATH)
448
7410e40b
PL
449#
450# Set default cache directory path
451#
36ae1d95 452AC_ARG_WITH(cache-dir, [ --with-cache-dir=DIR Use DIR to store cache files (default LOCALSTATEDIR/cache/fontconfig)], fc_cachedir="$withval", fc_cachedir=yes)
7410e40b
PL
453
454case $fc_cachedir in
455no|yes)
8a3dc488
TL
456 if test "$os_win32" = "yes"; then
457 fc_cachedir="WINDOWSTEMPDIR_FONTCONFIG_CACHE"
458 else
c08216c6 459 fc_cachedir='${localstatedir}/cache/${PACKAGE}'
8a3dc488 460 fi
7410e40b
PL
461 ;;
462*)
463 ;;
464esac
465AC_SUBST(fc_cachedir)
466FC_CACHEDIR=${fc_cachedir}
467AC_SUBST(FC_CACHEDIR)
468
4f27c1c0 469FC_FONTDATE=`LC_ALL=C date`
20fa60c9
KP
470
471AC_SUBST(FC_FONTDATE)
472
36ae1d95 473AC_ARG_WITH(confdir, [ --with-confdir=DIR Use DIR to store configuration files (default SYSCONFDIR/fonts)], confdir="$withval", confdir=yes)
20fa60c9
KP
474
475#
476# Set CONFDIR and FONTCONFIG_PATH
477#
478
479case "$confdir" in
480no|yes)
ad9b233c 481 confdir='${sysconfdir}'/fonts
20fa60c9
KP
482 ;;
483*)
484 ;;
485esac
486AC_SUBST(confdir)
ad9b233c 487CONFDIR=${confdir}
20fa60c9
KP
488AC_DEFINE_UNQUOTED(CONFDIR, "$CONFDIR",[Font configuration directory])
489AC_SUBST(CONFDIR)
490
9238fc06
KP
491#
492# Let people not build/install docs if they don't have docbook
493#
494
495AC_CHECK_PROG(HASDOCBOOK, docbook2html, yes, no)
496
2b45ef3a 497AM_CONDITIONAL(USEDOCBOOK, test "x$HASDOCBOOK" = xyes)
9238fc06 498
2b45ef3a
KP
499default_docs="yes"
500#
501# Check if docs exist or can be created
502#
503if test x$HASDOCBOOK = xno; then
2cae0512 504 if test -f $srcdir/doc/fonts-conf.5; then
2b45ef3a
KP
505 :
506 else
507 default_docs="no"
508 fi
9238fc06
KP
509fi
510
2b45ef3a
KP
511AC_ARG_ENABLE(docs, [ --disable-docs Don't build and install documentation],,enable_docs=$default_docs)
512
9238fc06
KP
513AM_CONDITIONAL(ENABLE_DOCS, test "x$enable_docs" = xyes)
514
2b45ef3a
KP
515if test "x$enable_docs" = xyes; then
516 DOCSRC="doc"
4cbc3ee8
KP
517 tmp=funcs.$$
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
524 rm -f $tmp
2b45ef3a
KP
525else
526 DOCSRC=""
4cbc3ee8 527 DOCMAN3=""
2b45ef3a
KP
528fi
529
530AC_SUBST(DOCSRC)
4cbc3ee8 531AC_SUBST(DOCMAN3)
2b45ef3a 532
20fa60c9
KP
533AC_OUTPUT([
534Makefile
535fontconfig/Makefile
536fc-lang/Makefile
7769c321 537fc-glyphname/Makefile
192296d8 538fc-case/Makefile
2b629781 539fc-arch/Makefile
20fa60c9 540src/Makefile
414f7202 541conf.d/Makefile
20fa60c9 542fc-cache/Makefile
f28f090d 543fc-cat/Makefile
20fa60c9 544fc-list/Makefile
440e7054 545fc-match/Makefile
77c0d8bc 546fc-query/Makefile
6bffe1a9 547fc-scan/Makefile
0da305f7 548doc/Makefile
fddb839b 549doc/version.sgml
44d90378 550test/Makefile
20fa60c9
KP
551fontconfig.spec
552fontconfig.pc
daeed6e0 553fontconfig-zip
20fa60c9 554])