]> git.wh0rd.org - fontconfig.git/blame - configure.in
Remove all .cvsignore files
[fontconfig.git] / configure.in
CommitLineData
20fa60c9
KP
1dnl
2dnl $Id$
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
16dnl KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
17dnl INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
18dnl EVENT SHALL KEITH PACKARD 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.
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
0945cbe7 36AM_INIT_AUTOMAKE(fontconfig, 2.3.96)
6ae6acf3 37AM_MAINTAINER_MODE
24330d27 38
20fa60c9
KP
39dnl libtool versioning
40
ff3f1f98
KP
41LT_CURRENT=1
42LT_REVISION=4
daeed6e0
TL
43AC_SUBST(LT_CURRENT)
44AC_SUBST(LT_REVISION)
ff3f1f98
KP
45LT_AGE=0
46
47LT_VERSION_INFO="$LT_CURRENT:$LT_REVISION:$LT_AGE"
48AC_SUBST(LT_VERSION_INFO)
20fa60c9 49
daeed6e0
TL
50LT_CURRENT_MINUS_AGE=`expr $LT_CURRENT - $LT_AGE`
51AC_SUBST(LT_CURRENT_MINUS_AGE)
52
20fa60c9
KP
53dnl ==========================================================================
54
20fa60c9 55AM_CONFIG_HEADER(config.h)
fb9545b1 56
24330d27 57AC_PROG_CC
24330d27 58AC_PROG_INSTALL
24330d27 59AC_PROG_LN_S
daeed6e0 60AC_LIBTOOL_WIN32_DLL
20fa60c9
KP
61AM_PROG_LIBTOOL
62AC_PROG_MAKE_SET
63
daeed6e0
TL
64dnl ==========================================================================
65
66case "$host" in
67 *-*-mingw*)
68 os_win32=yes
69 ;;
70 *)
71 os_win32=no
72esac
73AM_CONDITIONAL(OS_WIN32, test "$os_win32" = "yes")
74
75if test "$os_win32" = "yes"; then
76 AC_CHECK_PROG(ms_librarian, lib.exe, yes, no)
77fi
78AM_CONDITIONAL(MS_LIB_AVAILABLE, test x$ms_librarian = xyes)
79
6ae6acf3 80WARN_CFLAGS=""
6ae6acf3
KP
81if test "x$GCC" = "xyes"; then
82 WARN_CFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes \
83 -Wmissing-prototypes -Wmissing-declarations \
84 -Wnested-externs -fno-strict-aliasing"
5b8e43a4
KP
85 AC_DEFINE_UNQUOTED(HAVE_WARNING_CPP_DIRECTIVE,1,
86 [Can use #warning in C files])
6ae6acf3
KP
87fi
88AC_SUBST(WARN_CFLAGS)
89
5b8e43a4 90
daeed6e0
TL
91dnl ==========================================================================
92
d8ae9c92
KP
93AM_CONDITIONAL(CROSS_COMPILING, test $cross_compiling = yes)
94
95dnl ==========================================================================
96
97# Setup for compiling build tools (fc-glyphname, etc)
98AC_MSG_CHECKING([for a C compiler for build tools])
99if test $cross_compiling = yes; then
100 AC_CHECK_PROGS(CC_FOR_BUILD, gcc cc)
101else
102 CC_FOR_BUILD=$CC
103fi
104AC_MSG_RESULT([$CC_FOR_BUILD])
105AC_SUBST(CC_FOR_BUILD)
106
107AC_MSG_CHECKING([for suffix of executable build tools])
108if test $cross_compiling = yes; then
109 cat >conftest.c <<\_______EOF
110int
111main ()
112{
113 exit (0);
114}
115_______EOF
116 for i in .exe ""; do
117 compile="$CC_FOR_BUILD conftest.c -o conftest$i"
118 if AC_TRY_EVAL(compile); then
119 if (./conftest) 2>&AC_FD_CC; then
120 EXEEXT_FOR_BUILD=$i
121 break
122 fi
123 fi
124 done
125 rm -f conftest*
126 if test "${EXEEXT_FOR_BUILD+set}" != set; then
127 AC_MSG_ERROR([Cannot determine suffix of executable build tools])
128 fi
129else
130 EXEEXT_FOR_BUILD=$EXEEXT
131fi
132AC_MSG_RESULT([$EXEEXT_FOR_BUILD])
133AC_SUBST(EXEEXT_FOR_BUILD)
134
135dnl ==========================================================================
136
2b629781
KP
137AC_ARG_WITH(arch, [ --with-arch=ARCH Force architecture to ARCH], arch="$withval", arch=auto)
138
139if test $cross_compiling = yes; then
140 case "$arch" in
141 auto)
142 AC_MSG_ERROR([Cannot autodetect architecture in cross compile environment]
143 [Use --with-arch=ARCH to specify architecture])
144 ;;
145 esac
146fi
147
148ARCHITECTURE=$arch
149AC_SUBST(ARCHITECTURE)
150
151dnl ==========================================================================
152
fb9545b1
KP
153# Checks for header files.
154AC_HEADER_DIRENT
155AC_HEADER_STDC
73775d8f 156AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h])
fb9545b1
KP
157
158# Checks for typedefs, structures, and compiler characteristics.
159AC_C_CONST
44415a07 160AC_C_INLINE
fb9545b1
KP
161AC_TYPE_PID_T
162
163# Checks for library functions.
fb9545b1 164AC_FUNC_VPRINTF
d6217cc6 165AC_FUNC_MMAP
73775d8f
PL
166AC_CHECK_FUNCS([geteuid getuid link memmove memset mkstemp strchr strrchr strtol getopt getopt_long sysconf ftruncate chsize rand_r])
167
168#
169# Checks for iconv
170#
171AC_MSG_CHECKING([for a usable iconv])
172ICONV_LIBS=""
173AC_TRY_LINK([#include <iconv.h>],
174 [iconv_open ("from", "to");],
175 [use_iconv=1],
176 [use_iconv=0])
177if test x$use_iconv = x1; then
178 AC_MSG_RESULT([libc])
179else
180 # try using libiconv
181 fontconfig_save_libs="$LIBS"
182 LIBS="$LIBS -liconv"
183
184 AC_TRY_LINK([#include <iconv.h>],
185 [iconv_open ("from", "to");],
186 [use_iconv=true],
187 [use_iconv=false])
188
189 if test x$use_iconv = x1; then
190 ICONV_LIBS="-liconv"
191 AC_MSG_RESULT([libiconv])
192 else
193 AC_MSG_RESULT([no])
194 fi
195
196 LIBS="$fontconfig_save_libs"
197fi
198AC_SUBST(ICONV_LIBS)
199AC_DEFINE_UNQUOTED(USE_ICONV,$use_iconv,[Use iconv.])
fb9545b1 200
446bb9c9 201#
20fa60c9 202# Checks for FreeType
fb9545b1 203#
24330d27 204
3910f322 205AC_ARG_WITH(freetype-config, [ --with-freetype-config=PROG Use FreeType configuration program PROG], freetype_config=$withval, freetype_config=yes)
24330d27 206
20fa60c9
KP
207if test "$freetype_config" = "yes"; then
208 AC_PATH_PROG(ft_config,freetype-config,no)
209 if test "$ft_config" = "no"; then
210 AC_MSG_ERROR([You must have freetype installed; see http://www.freetype.org/])
211 fi
212else
213 ft_config="$freetype_config"
214fi
24330d27 215
996580dc
KP
216FREETYPE_CFLAGS="`$ft_config --cflags`"
217FREETYPE_LIBS="`$ft_config --libs`"
24330d27 218
20fa60c9
KP
219AC_SUBST(FREETYPE_LIBS)
220AC_SUBST(FREETYPE_CFLAGS)
fb9545b1 221
aefb2c41 222#
79621aa5
KP
223# Check to see whether we have:
224# FT_Get_Next_Char
225# FT_Get_BDF_Property
226# FT_Get_PS_Font_Info
656c69d6 227# FT_Has_PS_Glyph_Names
aefb2c41
KP
228#
229
4f38fa81
KP
230fontconfig_save_libs="$LIBS"
231fontconfig_save_cflags="$CFLAGS"
20fa60c9 232LIBS="$LIBS $FREETYPE_LIBS"
4f38fa81 233CFLAGS="$CFLAGS $FREETYPE_CFLAGS"
537e3d23 234AC_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)
208a720f
KP
235AC_CHECK_MEMBER(FT_Bitmap_Size.y_ppem,
236 HAVE_FT_BITMAP_SIZE_Y_PPEM=1,
237 HAVE_FT_BITMAP_SIZE_Y_PPEM=0,
4f38fa81
KP
238[#include <ft2build.h>
239#include FT_FREETYPE_H])
4f38fa81
KP
240AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,$HAVE_FT_BITMAP_SIZE_Y_PPEM,
241 [FT_Bitmap_Size structure includes y_ppem field])
6ae6acf3
KP
242CFLAGS="$fontconfig_save_cflags"
243LIBS="$fontconfig_save_libs"
fb9545b1 244
fa244f3d
KP
245#
246# Check expat configuration
247#
24330d27 248
20fa60c9 249AC_ARG_WITH(expat, [ --with-expat=DIR Use Expat in DIR], expat=$withval, expat=yes)
3910f322
KP
250AC_ARG_WITH(expat-includes, [ --with-expat-includes=DIR Use Expat includes in DIR], expat_includes=$withval, expat_includes=yes)
251AC_ARG_WITH(expat-lib, [ --with-expat-lib=DIR Use Expat library in DIR], expat_lib=$withval, expat_lib=yes)
20fa60c9 252
e99f0f0a
PL
253if test "$enable_libxml2" != "yes"; then
254 case "$expat" in
255 no)
24330d27 256 ;;
e99f0f0a
PL
257 *)
258 case "$expat_includes" in
59e149e7 259 yes)
e99f0f0a
PL
260 case "$expat" in
261 yes)
262 ;;
263 *)
264 EXPAT_CFLAGS="-I$expat/include"
265 ;;
266 esac
267 ;;
268 no)
269 EXPAT_CFLAGS=""
59e149e7
KP
270 ;;
271 *)
e99f0f0a 272 EXPAT_CFLAGS="-I$expat_includes"
59e149e7
KP
273 ;;
274 esac
e99f0f0a 275 case "$expat_lib" in
fa244f3d 276 yes)
e99f0f0a
PL
277 case "$expat" in
278 yes)
279 EXPAT_LIBS="-lexpat"
280 ;;
281 *)
282 EXPAT_LIBS="-L$expat/lib -lexpat"
283 ;;
284 esac
285 ;;
286 no)
fb9545b1
KP
287 ;;
288 *)
e99f0f0a 289 EXPAT_LIBS="-L$expat_lib -lexpat"
fb9545b1
KP
290 ;;
291 esac
fb9545b1 292
e99f0f0a
PL
293 expatsaved_CPPFLAGS="$CPPFLAGS"
294 CPPFLAGS="$CPPFLAGS $EXPAT_CFLAGS"
295 expatsaved_LIBS="$LIBS"
296 LIBS="$LIBS $EXPAT_LIBS"
fb9545b1 297
e99f0f0a
PL
298 AC_CHECK_HEADER(expat.h)
299 case "$ac_cv_header_expat_h" in
fb9545b1 300 no)
e99f0f0a
PL
301 AC_CHECK_HEADER(xmlparse.h)
302 case "$ac_cv_header_xmlparse_h" in
303 no)
304 have_expat_header=no;
305 ;;
306 yes)
307 HAVE_XMLPARSE_H=1
308 AC_SUBST(HAVE_XMLPARSE_H)
309 AC_DEFINE_UNQUOTED(HAVE_XMLPARSE_H,$HAVE_XMLPARSE_H,
310 [Use xmlparse.h instead of expat.h])
311 have_expat_header=yes
312 ;;
313 esac
fb9545b1
KP
314 ;;
315 yes)
fb9545b1
KP
316 have_expat_header=yes
317 ;;
318 esac
e99f0f0a
PL
319 case "$have_expat_header" in
320 no)
a6a66da0
NL
321 expat=no
322 ;;
e99f0f0a
PL
323 yes)
324 AC_CHECK_FUNCS(XML_SetDoctypeDeclHandler)
325 case "$ac_cv_func_XML_SetDoctypeDeclHandler" in
326 yes)
327 HAVE_EXPAT=1
328 AC_SUBST(HAVE_EXPAT)
329 AC_DEFINE_UNQUOTED(HAVE_EXPAT,$HAVE_EXPAT,
330 [Found a useable expat library])
331 ;;
332 *)
333 expat=no
334 ;;
335 esac
336 ;;
fb9545b1 337 esac
e99f0f0a
PL
338 CPPFLAGS="$expatsaved_CPPFLAGS"
339 LIBS="$expatsaved_LIBS"
24330d27
KP
340 ;;
341 esac
fb9545b1 342
e99f0f0a
PL
343 AC_SUBST(EXPAT_CFLAGS)
344 AC_SUBST(EXPAT_LIBS)
345
346 case "$expat" in
347 no)
348 EXPAT_CFLAGS=""
349 EXPAT_LIBS=""
350
351 AC_MSG_WARN([Cannot find usable expat library. Trying to use libxml2 as fallback.])
352 ;;
353 esac
354fi
355
356#
357# Check libxml2 configuration
358#
359
360AC_ARG_ENABLE(libxml2, [ --enable-libxml2 Use libxml2 instead of Expat])
361
b17cf498
PL
362PKG_PROG_PKG_CONFIG
363
e99f0f0a
PL
364if test "$enable_libxml2" = "yes" -o "$expat" = "no"; then
365 PKG_CHECK_MODULES([LIBXML2], [libxml-2.0 >= 2.6])
366 AC_DEFINE_UNQUOTED(ENABLE_LIBXML2,1,[Use libxml2 instead of Expat])
367
368 AC_SUBST(LIBXML2_CFLAGS)
369 AC_SUBST(LIBXML2_LIBS)
370fi
24330d27 371
20fa60c9
KP
372#
373# Set default font directory
374#
375
3910f322 376AC_ARG_WITH(default-fonts, [ --with-default-fonts=DIR Use fonts from DIR when config is busted], default_fonts="$withval", default_fonts=yes)
20fa60c9
KP
377
378case "$default_fonts" in
379yes)
ee1d8125
TL
380 if test "$os_win32" = "yes"; then
381 FC_DEFAULT_FONTS="WINDOWSFONTDIR"
382 AC_DEFINE_UNQUOTED(FC_DEFAULT_FONTS, "WINDOWSFONTDIR",
383 [Windows font directory])
384 else
385 FC_DEFAULT_FONTS="/usr/share/fonts"
386 AC_DEFINE_UNQUOTED(FC_DEFAULT_FONTS, "/usr/share/fonts",
387 [System font directory])
388 fi
20fa60c9
KP
389 ;;
390*)
391 FC_DEFAULT_FONTS="$default_fonts"
392 AC_DEFINE_UNQUOTED(FC_DEFAULT_FONTS, "$default_fonts",
393 [System font directory])
394 ;;
395esac
396
397AC_SUBST(FC_DEFAULT_FONTS)
398
399#
af82b48c
KP
400# Add more fonts if available. By default, add only the directories
401# with outline fonts; those with bitmaps can be added as desired in
402# local.conf or ~/.fonts.conf
20fa60c9 403#
3910f322 404AC_ARG_WITH(add-fonts, [ --with-add-fonts=DIR1,DIR2,...Find additional fonts in DIR1,DIR2,... ], add_fonts="$withval", add_fonts=yes)
20fa60c9 405
af82b48c 406case "$add_fonts" in
20fa60c9 407yes)
af82b48c 408 FC_ADD_FONTS=""
bf0093b7 409 for dir in /usr/X11R6/lib/X11 /usr/X11/lib/X11 /usr/lib/X11; do
af82b48c 410 case x"$FC_ADD_FONTS" in
20fa60c9 411 x)
2d9c79c0
KP
412 sub="$dir/fonts"
413 if test -d "$sub"; then
414 case x$FC_ADD_FONTS in
415 x)
416 FC_ADD_FONTS="$sub"
417 ;;
418 *)
419 FC_ADD_FONTS="$FC_ADD_FONTS,$sub"
420 ;;
421 esac
20fa60c9
KP
422 fi
423 ;;
424 esac
425 done
af82b48c 426 AC_DEFINE_UNQUOTED(FC_ADD_FONTS,"$add_fonts",[Additional font directories])
20fa60c9
KP
427 ;;
428no)
af82b48c 429 FC_ADD_FONTS=""
20fa60c9
KP
430 ;;
431*)
af82b48c
KP
432 FC_ADD_FONTS="$add_fonts"
433 AC_DEFINE_UNQUOTED(FC_ADD_FONTS,"$add_fonts",[Additional font directories])
20fa60c9
KP
434 ;;
435esac
436
af82b48c 437AC_SUBST(FC_ADD_FONTS)
20fa60c9
KP
438
439FC_FONTPATH=""
440
af82b48c 441case "$FC_ADD_FONTS" in
20fa60c9
KP
442"")
443 ;;
444*)
af82b48c
KP
445 FC_FONTPATH=`echo $FC_ADD_FONTS |
446 sed -e 's/^/<dir>/' -e 's/$/<\/dir>/' -e 's/,/<\/dir> <dir>/g'`
20fa60c9
KP
447 ;;
448esac
449
450AC_SUBST(FC_FONTPATH)
451
7410e40b
PL
452#
453# Set default cache directory path
454#
455AC_ARG_WITH(cache-dir, [ --with-cache-dir=DIR Use DIR to store cache files (default /var/cache/fontconfig)], fc_cachedir="$withval", fc_cachedir=yes)
456
457case $fc_cachedir in
458no|yes)
459 fc_cachedir=`eval echo "${localstatedir}/cache/"${PACKAGE}`
460 ;;
461*)
462 ;;
463esac
464AC_SUBST(fc_cachedir)
465FC_CACHEDIR=${fc_cachedir}
466AC_SUBST(FC_CACHEDIR)
467
4f27c1c0 468FC_FONTDATE=`LC_ALL=C date`
20fa60c9
KP
469
470AC_SUBST(FC_FONTDATE)
471
472AC_ARG_WITH(confdir, [ --with-confdir=DIR Use DIR to store configuration files (default /etc/fonts)], confdir="$withval", confdir=yes)
473
474#
475# Set CONFDIR and FONTCONFIG_PATH
476#
477
478case "$confdir" in
479no|yes)
ad9b233c 480 confdir='${sysconfdir}'/fonts
20fa60c9
KP
481 ;;
482*)
483 ;;
484esac
485AC_SUBST(confdir)
ad9b233c 486CONFDIR=${confdir}
20fa60c9
KP
487AC_DEFINE_UNQUOTED(CONFDIR, "$CONFDIR",[Font configuration directory])
488AC_SUBST(CONFDIR)
489
490#
491# Find out what language orthographies are included
492#
493
394b2bf0 494ORTH_FILES=`cd ${srcdir}/fc-lang && echo *.orth`
20fa60c9 495AC_SUBST(ORTH_FILES)
446bb9c9 496
9238fc06
KP
497#
498# Let people not build/install docs if they don't have docbook
499#
500
501AC_CHECK_PROG(HASDOCBOOK, docbook2html, yes, no)
502
2b45ef3a 503AM_CONDITIONAL(USEDOCBOOK, test "x$HASDOCBOOK" = xyes)
9238fc06 504
2b45ef3a
KP
505default_docs="yes"
506#
507# Check if docs exist or can be created
508#
509if test x$HASDOCBOOK = xno; then
510 if test -f doc/fonts-conf.5; then
511 :
512 else
513 default_docs="no"
514 fi
9238fc06
KP
515fi
516
2b45ef3a
KP
517AC_ARG_ENABLE(docs, [ --disable-docs Don't build and install documentation],,enable_docs=$default_docs)
518
9238fc06
KP
519AM_CONDITIONAL(ENABLE_DOCS, test "x$enable_docs" = xyes)
520
2b45ef3a
KP
521if test "x$enable_docs" = xyes; then
522 DOCSRC="doc"
4cbc3ee8
KP
523 tmp=funcs.$$
524 cat $srcdir/doc/*.fncs | awk '
525 /^@TITLE@/ { if (!done) { printf ("%s\n", $2); done = 1; } }
526 /^@FUNC@/ { if (!done) { printf ("%s\n", $2); done = 1; } }
527 /^@@/ { done = 0; }' > $tmp
528 DOCMAN3=`cat $tmp | awk '{ printf ("%s.3 ", $1); }'`
529 echo DOCMAN3 $DOCMAN3
530 rm -f $tmp
2b45ef3a
KP
531else
532 DOCSRC=""
4cbc3ee8 533 DOCMAN3=""
2b45ef3a
KP
534fi
535
536AC_SUBST(DOCSRC)
4cbc3ee8 537AC_SUBST(DOCMAN3)
2b45ef3a 538
0da305f7
KP
539#
540# Figure out where to install documentation
541#
542
af82b48c 543AC_ARG_WITH(docdir, [ --with-docdir=DIR Use DIR to store documentation files (default ${datadir}/doc/fontconfig)], confdir="$withval")
0da305f7
KP
544
545if test "x$with_docdir" = "x" ; then
546 DOCDIR='${datadir}/doc/fontconfig'
547else
548 DOCDIR=$with_docdir
549fi
550
551AC_SUBST(DOCDIR)
552
ea44e218 553
20fa60c9
KP
554AC_OUTPUT([
555Makefile
556fontconfig/Makefile
557fc-lang/Makefile
7769c321 558fc-glyphname/Makefile
192296d8 559fc-case/Makefile
2b629781 560fc-arch/Makefile
20fa60c9 561src/Makefile
daeed6e0 562src/fontconfig.def
414f7202 563conf.d/Makefile
20fa60c9 564fc-cache/Makefile
f28f090d 565fc-cat/Makefile
20fa60c9 566fc-list/Makefile
440e7054 567fc-match/Makefile
0da305f7 568doc/Makefile
fddb839b 569doc/version.sgml
44d90378 570test/Makefile
20fa60c9
KP
571fontconfig.spec
572fontconfig.pc
573fonts.conf
daeed6e0 574fontconfig-zip
20fa60c9 575])