]> git.wh0rd.org - fontconfig.git/blame_incremental - configure.in
Bump libtool revision in preparation for release
[fontconfig.git] / configure.in
... / ...
CommitLineData
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 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 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_INIT(fonts.dtd)
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
36AM_INIT_AUTOMAKE(fontconfig, 2.7.3)
37m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
38AM_MAINTAINER_MODE
39
40dnl libtool versioning
41
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
45LIBT_CURRENT=5
46LIBT_REVISION=4
47AC_SUBST(LIBT_CURRENT)
48AC_SUBST(LIBT_REVISION)
49LIBT_AGE=4
50
51LIBT_VERSION_INFO="$LIBT_CURRENT:$LIBT_REVISION:$LIBT_AGE"
52AC_SUBST(LIBT_VERSION_INFO)
53
54LIBT_CURRENT_MINUS_AGE=`expr $LIBT_CURRENT - $LIBT_AGE`
55AC_SUBST(LIBT_CURRENT_MINUS_AGE)
56
57dnl ==========================================================================
58
59AM_CONFIG_HEADER(config.h)
60
61AC_PROG_CC
62AC_PROG_INSTALL
63AC_PROG_LN_S
64AC_LIBTOOL_WIN32_DLL
65AM_PROG_LIBTOOL
66DOLT
67AC_PROG_MAKE_SET
68
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
85WARN_CFLAGS=""
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"
90 AC_DEFINE_UNQUOTED(HAVE_WARNING_CPP_DIRECTIVE,1,
91 [Can use #warning in C files])
92fi
93AC_SUBST(WARN_CFLAGS)
94
95
96dnl ==========================================================================
97
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
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
158# Checks for header files.
159AC_HEADER_DIRENT
160AC_HEADER_STDC
161AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h])
162
163# Checks for typedefs, structures, and compiler characteristics.
164AC_C_CONST
165AC_C_INLINE
166AC_TYPE_PID_T
167
168# Checks for library functions.
169AC_FUNC_VPRINTF
170AC_FUNC_MMAP
171AC_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#
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");],
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"
202fi
203AC_SUBST(ICONV_LIBS)
204AC_DEFINE_UNQUOTED(USE_ICONV,$use_iconv,[Use iconv.])
205
206#
207# Checks for FreeType
208#
209
210AC_ARG_WITH(freetype-config, [ --with-freetype-config=PROG Use FreeType configuration program PROG], freetype_config=$withval, freetype_config=yes)
211
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
220
221FREETYPE_CFLAGS="`$ft_config --cflags`"
222FREETYPE_LIBS="`$ft_config --libs`"
223
224AC_SUBST(FREETYPE_LIBS)
225AC_SUBST(FREETYPE_CFLAGS)
226
227fontconfig_save_libs="$LIBS"
228fontconfig_save_cflags="$CFLAGS"
229LIBS="$LIBS $FREETYPE_LIBS"
230CFLAGS="$CFLAGS $FREETYPE_CFLAGS"
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)
232AC_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])
237AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,$HAVE_FT_BITMAP_SIZE_Y_PPEM,
238 [FT_Bitmap_Size structure includes y_ppem field])
239CFLAGS="$fontconfig_save_cflags"
240LIBS="$fontconfig_save_libs"
241
242#
243# Check expat configuration
244#
245
246AC_ARG_WITH(expat, [ --with-expat=DIR Use Expat in DIR], expat=$withval, expat=yes)
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)
249
250if 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
351fi
352
353#
354# Check libxml2 configuration
355#
356
357AC_ARG_ENABLE(libxml2, [ --enable-libxml2 Use libxml2 instead of Expat])
358
359PKG_PROG_PKG_CONFIG
360
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
368
369#
370# Set default font directory
371#
372
373AC_ARG_WITH(default-fonts, [ --with-default-fonts=DIR Use fonts from DIR when config is busted], default_fonts="$withval", default_fonts=yes)
374
375case "$default_fonts" in
376yes)
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 ;;
392esac
393
394AC_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#
401AC_ARG_WITH(add-fonts, [ --with-add-fonts=DIR1,DIR2,...Find additional fonts in DIR1,DIR2,... ], add_fonts="$withval", add_fonts=yes)
402
403case "$add_fonts" in
404yes)
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 ;;
425no)
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 ;;
432esac
433
434AC_SUBST(FC_ADD_FONTS)
435
436FC_FONTPATH=""
437
438case "$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 ;;
445esac
446
447AC_SUBST(FC_FONTPATH)
448
449#
450# Set default cache directory path
451#
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)
453
454case $fc_cachedir in
455no|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 ;;
464esac
465AC_SUBST(fc_cachedir)
466FC_CACHEDIR=${fc_cachedir}
467AC_SUBST(FC_CACHEDIR)
468
469FC_FONTDATE=`LC_ALL=C date`
470
471AC_SUBST(FC_FONTDATE)
472
473AC_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
479case "$confdir" in
480no|yes)
481 confdir='${sysconfdir}'/fonts
482 ;;
483*)
484 ;;
485esac
486AC_SUBST(confdir)
487CONFDIR=${confdir}
488AC_DEFINE_UNQUOTED(CONFDIR, "$CONFDIR",[Font configuration directory])
489AC_SUBST(CONFDIR)
490
491#
492# Let people not build/install docs if they don't have docbook
493#
494
495AC_CHECK_PROG(HASDOCBOOK, docbook2html, yes, no)
496
497AM_CONDITIONAL(USEDOCBOOK, test "x$HASDOCBOOK" = xyes)
498
499default_docs="yes"
500#
501# Check if docs exist or can be created
502#
503if test x$HASDOCBOOK = xno; then
504 if test -f $srcdir/doc/fonts-conf.5; then
505 :
506 else
507 default_docs="no"
508 fi
509fi
510
511AC_ARG_ENABLE(docs, [ --disable-docs Don't build and install documentation],,enable_docs=$default_docs)
512
513AM_CONDITIONAL(ENABLE_DOCS, test "x$enable_docs" = xyes)
514
515if 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
525else
526 DOCSRC=""
527 DOCMAN3=""
528fi
529
530AC_SUBST(DOCSRC)
531AC_SUBST(DOCMAN3)
532
533AC_OUTPUT([
534Makefile
535fontconfig/Makefile
536fc-lang/Makefile
537fc-glyphname/Makefile
538fc-case/Makefile
539fc-arch/Makefile
540src/Makefile
541conf.d/Makefile
542fc-cache/Makefile
543fc-cat/Makefile
544fc-list/Makefile
545fc-match/Makefile
546fc-query/Makefile
547fc-scan/Makefile
548doc/Makefile
549doc/version.sgml
550test/Makefile
551fontconfig.spec
552fontconfig.pc
553fontconfig-zip
554])