]> git.wh0rd.org - fontconfig.git/blob - configure.in
Make conf.avail and conf.d work
[fontconfig.git] / configure.in
1 dnl
2 dnl $Id$
3 dnl
4 dnl Copyright © 2003 Keith Packard
5 dnl
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 Keith Packard not be used in
11 dnl advertising or publicity pertaining to distribution of the software without
12 dnl specific, written prior permission. Keith Packard makes 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.
15 dnl
16 dnl KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
17 dnl INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
18 dnl EVENT SHALL KEITH PACKARD 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.
23 dnl
24 dnl Process this file with autoconf to create configure.
25
26 AC_INIT(fonts.dtd)
27
28 dnl ==========================================================================
29 dnl Versioning
30 dnl ==========================================================================
31
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.3.96)
37 AM_MAINTAINER_MODE
38
39 dnl libtool versioning
40
41 LT_CURRENT=1
42 LT_REVISION=4
43 AC_SUBST(LT_CURRENT)
44 AC_SUBST(LT_REVISION)
45 LT_AGE=0
46
47 LT_VERSION_INFO="$LT_CURRENT:$LT_REVISION:$LT_AGE"
48 AC_SUBST(LT_VERSION_INFO)
49
50 LT_CURRENT_MINUS_AGE=`expr $LT_CURRENT - $LT_AGE`
51 AC_SUBST(LT_CURRENT_MINUS_AGE)
52
53 dnl ==========================================================================
54
55 AM_CONFIG_HEADER(config.h)
56
57 AC_PROG_CC
58 AC_PROG_INSTALL
59 AC_PROG_LN_S
60 AC_LIBTOOL_WIN32_DLL
61 AM_PROG_LIBTOOL
62 AC_PROG_MAKE_SET
63
64 dnl ==========================================================================
65
66 case "$host" in
67 *-*-mingw*)
68 os_win32=yes
69 ;;
70 *)
71 os_win32=no
72 esac
73 AM_CONDITIONAL(OS_WIN32, test "$os_win32" = "yes")
74
75 if test "$os_win32" = "yes"; then
76 AC_CHECK_PROG(ms_librarian, lib.exe, yes, no)
77 fi
78 AM_CONDITIONAL(MS_LIB_AVAILABLE, test x$ms_librarian = xyes)
79
80 WARN_CFLAGS=""
81 if test "x$GCC" = "xyes"; then
82 WARN_CFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes \
83 -Wmissing-prototypes -Wmissing-declarations \
84 -Wnested-externs -fno-strict-aliasing"
85 AC_DEFINE_UNQUOTED(HAVE_WARNING_CPP_DIRECTIVE,1,
86 [Can use #warning in C files])
87 fi
88 AC_SUBST(WARN_CFLAGS)
89
90
91 dnl ==========================================================================
92
93 AM_CONDITIONAL(CROSS_COMPILING, test $cross_compiling = yes)
94
95 dnl ==========================================================================
96
97 # Setup for compiling build tools (fc-glyphname, etc)
98 AC_MSG_CHECKING([for a C compiler for build tools])
99 if test $cross_compiling = yes; then
100 AC_CHECK_PROGS(CC_FOR_BUILD, gcc cc)
101 else
102 CC_FOR_BUILD=$CC
103 fi
104 AC_MSG_RESULT([$CC_FOR_BUILD])
105 AC_SUBST(CC_FOR_BUILD)
106
107 AC_MSG_CHECKING([for suffix of executable build tools])
108 if test $cross_compiling = yes; then
109 cat >conftest.c <<\_______EOF
110 int
111 main ()
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
129 else
130 EXEEXT_FOR_BUILD=$EXEEXT
131 fi
132 AC_MSG_RESULT([$EXEEXT_FOR_BUILD])
133 AC_SUBST(EXEEXT_FOR_BUILD)
134
135 dnl ==========================================================================
136
137 AC_ARG_WITH(arch, [ --with-arch=ARCH Force architecture to ARCH], arch="$withval", arch=auto)
138
139 if 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
146 fi
147
148 ARCHITECTURE=$arch
149 AC_SUBST(ARCHITECTURE)
150
151 dnl ==========================================================================
152
153 # Checks for header files.
154 AC_HEADER_DIRENT
155 AC_HEADER_STDC
156 AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h])
157
158 # Checks for typedefs, structures, and compiler characteristics.
159 AC_C_CONST
160 AC_C_INLINE
161 AC_TYPE_PID_T
162
163 # Checks for library functions.
164 AC_FUNC_VPRINTF
165 AC_FUNC_MMAP
166 AC_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 #
171 AC_MSG_CHECKING([for a usable iconv])
172 ICONV_LIBS=""
173 AC_TRY_LINK([#include <iconv.h>],
174 [iconv_open ("from", "to");],
175 [use_iconv=1],
176 [use_iconv=0])
177 if test x$use_iconv = x1; then
178 AC_MSG_RESULT([libc])
179 else
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"
197 fi
198 AC_SUBST(ICONV_LIBS)
199 AC_DEFINE_UNQUOTED(USE_ICONV,$use_iconv,[Use iconv.])
200
201 #
202 # Checks for FreeType
203 #
204
205 AC_ARG_WITH(freetype-config, [ --with-freetype-config=PROG Use FreeType configuration program PROG], freetype_config=$withval, freetype_config=yes)
206
207 if 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
212 else
213 ft_config="$freetype_config"
214 fi
215
216 FREETYPE_CFLAGS="`$ft_config --cflags`"
217 FREETYPE_LIBS="`$ft_config --libs`"
218
219 AC_SUBST(FREETYPE_LIBS)
220 AC_SUBST(FREETYPE_CFLAGS)
221
222 #
223 # Check to see whether we have:
224 # FT_Get_Next_Char
225 # FT_Get_BDF_Property
226 # FT_Get_PS_Font_Info
227 # FT_Has_PS_Glyph_Names
228 #
229
230 fontconfig_save_libs="$LIBS"
231 fontconfig_save_cflags="$CFLAGS"
232 LIBS="$LIBS $FREETYPE_LIBS"
233 CFLAGS="$CFLAGS $FREETYPE_CFLAGS"
234 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)
235 AC_CHECK_MEMBER(FT_Bitmap_Size.y_ppem,
236 HAVE_FT_BITMAP_SIZE_Y_PPEM=1,
237 HAVE_FT_BITMAP_SIZE_Y_PPEM=0,
238 [#include <ft2build.h>
239 #include FT_FREETYPE_H])
240 AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,$HAVE_FT_BITMAP_SIZE_Y_PPEM,
241 [FT_Bitmap_Size structure includes y_ppem field])
242 CFLAGS="$fontconfig_save_cflags"
243 LIBS="$fontconfig_save_libs"
244
245 #
246 # Check expat configuration
247 #
248
249 AC_ARG_WITH(expat, [ --with-expat=DIR Use Expat in DIR], expat=$withval, expat=yes)
250 AC_ARG_WITH(expat-includes, [ --with-expat-includes=DIR Use Expat includes in DIR], expat_includes=$withval, expat_includes=yes)
251 AC_ARG_WITH(expat-lib, [ --with-expat-lib=DIR Use Expat library in DIR], expat_lib=$withval, expat_lib=yes)
252
253 if test "$enable_libxml2" != "yes"; then
254 case "$expat" in
255 no)
256 ;;
257 *)
258 case "$expat_includes" in
259 yes)
260 case "$expat" in
261 yes)
262 ;;
263 *)
264 EXPAT_CFLAGS="-I$expat/include"
265 ;;
266 esac
267 ;;
268 no)
269 EXPAT_CFLAGS=""
270 ;;
271 *)
272 EXPAT_CFLAGS="-I$expat_includes"
273 ;;
274 esac
275 case "$expat_lib" in
276 yes)
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)
287 ;;
288 *)
289 EXPAT_LIBS="-L$expat_lib -lexpat"
290 ;;
291 esac
292
293 expatsaved_CPPFLAGS="$CPPFLAGS"
294 CPPFLAGS="$CPPFLAGS $EXPAT_CFLAGS"
295 expatsaved_LIBS="$LIBS"
296 LIBS="$LIBS $EXPAT_LIBS"
297
298 AC_CHECK_HEADER(expat.h)
299 case "$ac_cv_header_expat_h" in
300 no)
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
314 ;;
315 yes)
316 have_expat_header=yes
317 ;;
318 esac
319 case "$have_expat_header" in
320 no)
321 expat=no
322 ;;
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 ;;
337 esac
338 CPPFLAGS="$expatsaved_CPPFLAGS"
339 LIBS="$expatsaved_LIBS"
340 ;;
341 esac
342
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
354 fi
355
356 #
357 # Check libxml2 configuration
358 #
359
360 AC_ARG_ENABLE(libxml2, [ --enable-libxml2 Use libxml2 instead of Expat])
361
362 PKG_PROG_PKG_CONFIG
363
364 if 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)
370 fi
371
372 #
373 # Set default font directory
374 #
375
376 AC_ARG_WITH(default-fonts, [ --with-default-fonts=DIR Use fonts from DIR when config is busted], default_fonts="$withval", default_fonts=yes)
377
378 case "$default_fonts" in
379 yes)
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
389 ;;
390 *)
391 FC_DEFAULT_FONTS="$default_fonts"
392 AC_DEFINE_UNQUOTED(FC_DEFAULT_FONTS, "$default_fonts",
393 [System font directory])
394 ;;
395 esac
396
397 AC_SUBST(FC_DEFAULT_FONTS)
398
399 #
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
403 #
404 AC_ARG_WITH(add-fonts, [ --with-add-fonts=DIR1,DIR2,...Find additional fonts in DIR1,DIR2,... ], add_fonts="$withval", add_fonts=yes)
405
406 case "$add_fonts" in
407 yes)
408 FC_ADD_FONTS=""
409 for dir in /usr/X11R6/lib/X11 /usr/X11/lib/X11 /usr/lib/X11; do
410 case x"$FC_ADD_FONTS" in
411 x)
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
422 fi
423 ;;
424 esac
425 done
426 AC_DEFINE_UNQUOTED(FC_ADD_FONTS,"$add_fonts",[Additional font directories])
427 ;;
428 no)
429 FC_ADD_FONTS=""
430 ;;
431 *)
432 FC_ADD_FONTS="$add_fonts"
433 AC_DEFINE_UNQUOTED(FC_ADD_FONTS,"$add_fonts",[Additional font directories])
434 ;;
435 esac
436
437 AC_SUBST(FC_ADD_FONTS)
438
439 FC_FONTPATH=""
440
441 case "$FC_ADD_FONTS" in
442 "")
443 ;;
444 *)
445 FC_FONTPATH=`echo $FC_ADD_FONTS |
446 sed -e 's/^/<dir>/' -e 's/$/<\/dir>/' -e 's/,/<\/dir> <dir>/g'`
447 ;;
448 esac
449
450 AC_SUBST(FC_FONTPATH)
451
452 #
453 # Set default cache directory path
454 #
455 AC_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
457 case $fc_cachedir in
458 no|yes)
459 fc_cachedir=`eval echo "${localstatedir}/cache/"${PACKAGE}`
460 ;;
461 *)
462 ;;
463 esac
464 AC_SUBST(fc_cachedir)
465 FC_CACHEDIR=${fc_cachedir}
466 AC_SUBST(FC_CACHEDIR)
467
468 FC_FONTDATE=`LC_ALL=C date`
469
470 AC_SUBST(FC_FONTDATE)
471
472 AC_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
478 case "$confdir" in
479 no|yes)
480 confdir='${sysconfdir}'/fonts
481 ;;
482 *)
483 ;;
484 esac
485 AC_SUBST(confdir)
486 CONFDIR=${confdir}
487 AC_DEFINE_UNQUOTED(CONFDIR, "$CONFDIR",[Font configuration directory])
488 AC_SUBST(CONFDIR)
489
490 #
491 # Find out what language orthographies are included
492 #
493
494 ORTH_FILES=`cd ${srcdir}/fc-lang && echo *.orth`
495 AC_SUBST(ORTH_FILES)
496
497 #
498 # Let people not build/install docs if they don't have docbook
499 #
500
501 AC_CHECK_PROG(HASDOCBOOK, docbook2html, yes, no)
502
503 AM_CONDITIONAL(USEDOCBOOK, test "x$HASDOCBOOK" = xyes)
504
505 default_docs="yes"
506 #
507 # Check if docs exist or can be created
508 #
509 if test x$HASDOCBOOK = xno; then
510 if test -f doc/fonts-conf.5; then
511 :
512 else
513 default_docs="no"
514 fi
515 fi
516
517 AC_ARG_ENABLE(docs, [ --disable-docs Don't build and install documentation],,enable_docs=$default_docs)
518
519 AM_CONDITIONAL(ENABLE_DOCS, test "x$enable_docs" = xyes)
520
521 if test "x$enable_docs" = xyes; then
522 DOCSRC="doc"
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
531 else
532 DOCSRC=""
533 DOCMAN3=""
534 fi
535
536 AC_SUBST(DOCSRC)
537 AC_SUBST(DOCMAN3)
538
539 #
540 # Figure out where to install documentation
541 #
542
543 AC_ARG_WITH(docdir, [ --with-docdir=DIR Use DIR to store documentation files (default ${datadir}/doc/fontconfig)], confdir="$withval")
544
545 if test "x$with_docdir" = "x" ; then
546 DOCDIR='${datadir}/doc/fontconfig'
547 else
548 DOCDIR=$with_docdir
549 fi
550
551 AC_SUBST(DOCDIR)
552
553
554 AC_OUTPUT([
555 Makefile
556 fontconfig/Makefile
557 fc-lang/Makefile
558 fc-glyphname/Makefile
559 fc-case/Makefile
560 fc-arch/Makefile
561 src/Makefile
562 src/fontconfig.def
563 conf.avail/Makefile
564 conf.d/Makefile
565 fc-cache/Makefile
566 fc-cat/Makefile
567 fc-list/Makefile
568 fc-match/Makefile
569 doc/Makefile
570 doc/version.sgml
571 test/Makefile
572 fontconfig.spec
573 fontconfig.pc
574 fonts.conf
575 fontconfig-zip
576 ])