]> git.wh0rd.org - fontconfig.git/blob - configure.in
Bump libtool revision in preparation for release
[fontconfig.git] / configure.in
1 dnl
2 dnl fontconfig/configure.in
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 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.
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.7.3)
37 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
38 AM_MAINTAINER_MODE
39
40 dnl libtool versioning
41
42 dnl bump revision when fixing bugs
43 dnl bump current and age, reset revision to zero when adding APIs
44 dnl bump current, leave age, reset revision to zero when changing/removing APIS
45 LIBT_CURRENT=5
46 LIBT_REVISION=4
47 AC_SUBST(LIBT_CURRENT)
48 AC_SUBST(LIBT_REVISION)
49 LIBT_AGE=4
50
51 LIBT_VERSION_INFO="$LIBT_CURRENT:$LIBT_REVISION:$LIBT_AGE"
52 AC_SUBST(LIBT_VERSION_INFO)
53
54 LIBT_CURRENT_MINUS_AGE=`expr $LIBT_CURRENT - $LIBT_AGE`
55 AC_SUBST(LIBT_CURRENT_MINUS_AGE)
56
57 dnl ==========================================================================
58
59 AM_CONFIG_HEADER(config.h)
60
61 AC_PROG_CC
62 AC_PROG_INSTALL
63 AC_PROG_LN_S
64 AC_LIBTOOL_WIN32_DLL
65 AM_PROG_LIBTOOL
66 DOLT
67 AC_PROG_MAKE_SET
68
69 dnl ==========================================================================
70
71 case "$host" in
72 *-*-mingw*)
73 os_win32=yes
74 ;;
75 *)
76 os_win32=no
77 esac
78 AM_CONDITIONAL(OS_WIN32, test "$os_win32" = "yes")
79
80 if test "$os_win32" = "yes"; then
81 AC_CHECK_PROG(ms_librarian, lib.exe, yes, no)
82 fi
83 AM_CONDITIONAL(MS_LIB_AVAILABLE, test x$ms_librarian = xyes)
84
85 WARN_CFLAGS=""
86 if test "x$GCC" = "xyes"; then
87 WARN_CFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes \
88 -Wmissing-prototypes -Wmissing-declarations \
89 -Wnested-externs -fno-strict-aliasing"
90 AC_DEFINE_UNQUOTED(HAVE_WARNING_CPP_DIRECTIVE,1,
91 [Can use #warning in C files])
92 fi
93 AC_SUBST(WARN_CFLAGS)
94
95
96 dnl ==========================================================================
97
98 AM_CONDITIONAL(CROSS_COMPILING, test $cross_compiling = yes)
99
100 dnl ==========================================================================
101
102 # Setup for compiling build tools (fc-glyphname, etc)
103 AC_MSG_CHECKING([for a C compiler for build tools])
104 if test $cross_compiling = yes; then
105 AC_CHECK_PROGS(CC_FOR_BUILD, gcc cc)
106 else
107 CC_FOR_BUILD=$CC
108 fi
109 AC_MSG_RESULT([$CC_FOR_BUILD])
110 AC_SUBST(CC_FOR_BUILD)
111
112 AC_MSG_CHECKING([for suffix of executable build tools])
113 if test $cross_compiling = yes; then
114 cat >conftest.c <<\_______EOF
115 int
116 main ()
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
134 else
135 EXEEXT_FOR_BUILD=$EXEEXT
136 fi
137 AC_MSG_RESULT([$EXEEXT_FOR_BUILD])
138 AC_SUBST(EXEEXT_FOR_BUILD)
139
140 dnl ==========================================================================
141
142 AC_ARG_WITH(arch, [ --with-arch=ARCH Force architecture to ARCH], arch="$withval", arch=auto)
143
144 if 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
151 fi
152
153 ARCHITECTURE=$arch
154 AC_SUBST(ARCHITECTURE)
155
156 dnl ==========================================================================
157
158 # Checks for header files.
159 AC_HEADER_DIRENT
160 AC_HEADER_STDC
161 AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h])
162
163 # Checks for typedefs, structures, and compiler characteristics.
164 AC_C_CONST
165 AC_C_INLINE
166 AC_TYPE_PID_T
167
168 # Checks for library functions.
169 AC_FUNC_VPRINTF
170 AC_FUNC_MMAP
171 AC_CHECK_FUNCS([geteuid getuid link memmove memset mkstemp strchr strrchr strtol getopt getopt_long sysconf ftruncate chsize rand random lrand48])
172
173 #
174 # Checks for iconv
175 #
176 AC_MSG_CHECKING([for a usable iconv])
177 ICONV_LIBS=""
178 AC_TRY_LINK([#include <iconv.h>],
179 [iconv_open ("from", "to");],
180 [use_iconv=1],
181 [use_iconv=0])
182 if test x$use_iconv = x1; then
183 AC_MSG_RESULT([libc])
184 else
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");],
191 [use_iconv=1],
192 [use_iconv=0])
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"
202 fi
203 AC_SUBST(ICONV_LIBS)
204 AC_DEFINE_UNQUOTED(USE_ICONV,$use_iconv,[Use iconv.])
205
206 #
207 # Checks for FreeType
208 #
209
210 AC_ARG_WITH(freetype-config, [ --with-freetype-config=PROG Use FreeType configuration program PROG], freetype_config=$withval, freetype_config=yes)
211
212 if 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
217 else
218 ft_config="$freetype_config"
219 fi
220
221 FREETYPE_CFLAGS="`$ft_config --cflags`"
222 FREETYPE_LIBS="`$ft_config --libs`"
223
224 AC_SUBST(FREETYPE_LIBS)
225 AC_SUBST(FREETYPE_CFLAGS)
226
227 fontconfig_save_libs="$LIBS"
228 fontconfig_save_cflags="$CFLAGS"
229 LIBS="$LIBS $FREETYPE_LIBS"
230 CFLAGS="$CFLAGS $FREETYPE_CFLAGS"
231 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)
232 AC_CHECK_MEMBER(FT_Bitmap_Size.y_ppem,
233 HAVE_FT_BITMAP_SIZE_Y_PPEM=1,
234 HAVE_FT_BITMAP_SIZE_Y_PPEM=0,
235 [#include <ft2build.h>
236 #include FT_FREETYPE_H])
237 AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,$HAVE_FT_BITMAP_SIZE_Y_PPEM,
238 [FT_Bitmap_Size structure includes y_ppem field])
239 CFLAGS="$fontconfig_save_cflags"
240 LIBS="$fontconfig_save_libs"
241
242 #
243 # Check expat configuration
244 #
245
246 AC_ARG_WITH(expat, [ --with-expat=DIR Use Expat in DIR], expat=$withval, expat=yes)
247 AC_ARG_WITH(expat-includes, [ --with-expat-includes=DIR Use Expat includes in DIR], expat_includes=$withval, expat_includes=yes)
248 AC_ARG_WITH(expat-lib, [ --with-expat-lib=DIR Use Expat library in DIR], expat_lib=$withval, expat_lib=yes)
249
250 if test "$enable_libxml2" != "yes"; then
251 case "$expat" in
252 no)
253 ;;
254 *)
255 case "$expat_includes" in
256 yes)
257 case "$expat" in
258 yes)
259 ;;
260 *)
261 EXPAT_CFLAGS="-I$expat/include"
262 ;;
263 esac
264 ;;
265 no)
266 EXPAT_CFLAGS=""
267 ;;
268 *)
269 EXPAT_CFLAGS="-I$expat_includes"
270 ;;
271 esac
272 case "$expat_lib" in
273 yes)
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)
284 ;;
285 *)
286 EXPAT_LIBS="-L$expat_lib -lexpat"
287 ;;
288 esac
289
290 expatsaved_CPPFLAGS="$CPPFLAGS"
291 CPPFLAGS="$CPPFLAGS $EXPAT_CFLAGS"
292 expatsaved_LIBS="$LIBS"
293 LIBS="$LIBS $EXPAT_LIBS"
294
295 AC_CHECK_HEADER(expat.h)
296 case "$ac_cv_header_expat_h" in
297 no)
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
311 ;;
312 yes)
313 have_expat_header=yes
314 ;;
315 esac
316 case "$have_expat_header" in
317 no)
318 expat=no
319 ;;
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 ;;
334 esac
335 CPPFLAGS="$expatsaved_CPPFLAGS"
336 LIBS="$expatsaved_LIBS"
337 ;;
338 esac
339
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
351 fi
352
353 #
354 # Check libxml2 configuration
355 #
356
357 AC_ARG_ENABLE(libxml2, [ --enable-libxml2 Use libxml2 instead of Expat])
358
359 PKG_PROG_PKG_CONFIG
360
361 if 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)
367 fi
368
369 #
370 # Set default font directory
371 #
372
373 AC_ARG_WITH(default-fonts, [ --with-default-fonts=DIR Use fonts from DIR when config is busted], default_fonts="$withval", default_fonts=yes)
374
375 case "$default_fonts" in
376 yes)
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
386 ;;
387 *)
388 FC_DEFAULT_FONTS="$default_fonts"
389 AC_DEFINE_UNQUOTED(FC_DEFAULT_FONTS, "$default_fonts",
390 [System font directory])
391 ;;
392 esac
393
394 AC_SUBST(FC_DEFAULT_FONTS)
395
396 #
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
400 #
401 AC_ARG_WITH(add-fonts, [ --with-add-fonts=DIR1,DIR2,...Find additional fonts in DIR1,DIR2,... ], add_fonts="$withval", add_fonts=yes)
402
403 case "$add_fonts" in
404 yes)
405 FC_ADD_FONTS=""
406 for dir in /usr/X11R6/lib/X11 /usr/X11/lib/X11 /usr/lib/X11; do
407 case x"$FC_ADD_FONTS" in
408 x)
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
419 fi
420 ;;
421 esac
422 done
423 AC_DEFINE_UNQUOTED(FC_ADD_FONTS,"$add_fonts",[Additional font directories])
424 ;;
425 no)
426 FC_ADD_FONTS=""
427 ;;
428 *)
429 FC_ADD_FONTS="$add_fonts"
430 AC_DEFINE_UNQUOTED(FC_ADD_FONTS,"$add_fonts",[Additional font directories])
431 ;;
432 esac
433
434 AC_SUBST(FC_ADD_FONTS)
435
436 FC_FONTPATH=""
437
438 case "$FC_ADD_FONTS" in
439 "")
440 ;;
441 *)
442 FC_FONTPATH=`echo $FC_ADD_FONTS |
443 sed -e 's/^/<dir>/' -e 's/$/<\/dir>/' -e 's/,/<\/dir> <dir>/g'`
444 ;;
445 esac
446
447 AC_SUBST(FC_FONTPATH)
448
449 #
450 # Set default cache directory path
451 #
452 AC_ARG_WITH(cache-dir, [ --with-cache-dir=DIR Use DIR to store cache files (default LOCALSTATEDIR/cache/fontconfig)], fc_cachedir="$withval", fc_cachedir=yes)
453
454 case $fc_cachedir in
455 no|yes)
456 if test "$os_win32" = "yes"; then
457 fc_cachedir="WINDOWSTEMPDIR_FONTCONFIG_CACHE"
458 else
459 fc_cachedir='${localstatedir}/cache/${PACKAGE}'
460 fi
461 ;;
462 *)
463 ;;
464 esac
465 AC_SUBST(fc_cachedir)
466 FC_CACHEDIR=${fc_cachedir}
467 AC_SUBST(FC_CACHEDIR)
468
469 FC_FONTDATE=`LC_ALL=C date`
470
471 AC_SUBST(FC_FONTDATE)
472
473 AC_ARG_WITH(confdir, [ --with-confdir=DIR Use DIR to store configuration files (default SYSCONFDIR/fonts)], confdir="$withval", confdir=yes)
474
475 #
476 # Set CONFDIR and FONTCONFIG_PATH
477 #
478
479 case "$confdir" in
480 no|yes)
481 confdir='${sysconfdir}'/fonts
482 ;;
483 *)
484 ;;
485 esac
486 AC_SUBST(confdir)
487 CONFDIR=${confdir}
488 AC_DEFINE_UNQUOTED(CONFDIR, "$CONFDIR",[Font configuration directory])
489 AC_SUBST(CONFDIR)
490
491 #
492 # Let people not build/install docs if they don't have docbook
493 #
494
495 AC_CHECK_PROG(HASDOCBOOK, docbook2html, yes, no)
496
497 AM_CONDITIONAL(USEDOCBOOK, test "x$HASDOCBOOK" = xyes)
498
499 default_docs="yes"
500 #
501 # Check if docs exist or can be created
502 #
503 if test x$HASDOCBOOK = xno; then
504 if test -f $srcdir/doc/fonts-conf.5; then
505 :
506 else
507 default_docs="no"
508 fi
509 fi
510
511 AC_ARG_ENABLE(docs, [ --disable-docs Don't build and install documentation],,enable_docs=$default_docs)
512
513 AM_CONDITIONAL(ENABLE_DOCS, test "x$enable_docs" = xyes)
514
515 if test "x$enable_docs" = xyes; then
516 DOCSRC="doc"
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
525 else
526 DOCSRC=""
527 DOCMAN3=""
528 fi
529
530 AC_SUBST(DOCSRC)
531 AC_SUBST(DOCMAN3)
532
533 AC_OUTPUT([
534 Makefile
535 fontconfig/Makefile
536 fc-lang/Makefile
537 fc-glyphname/Makefile
538 fc-case/Makefile
539 fc-arch/Makefile
540 src/Makefile
541 conf.d/Makefile
542 fc-cache/Makefile
543 fc-cat/Makefile
544 fc-list/Makefile
545 fc-match/Makefile
546 fc-query/Makefile
547 fc-scan/Makefile
548 doc/Makefile
549 doc/version.sgml
550 test/Makefile
551 fontconfig.spec
552 fontconfig.pc
553 fontconfig-zip
554 ])