]> git.wh0rd.org - fontconfig.git/blame_incremental - configure.in
Avoid #warning directives on non-GCC compilers. (bug 7683)
[fontconfig.git] / configure.in
... / ...
CommitLineData
1dnl
2dnl $Id$
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 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.
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.3.95)
37AM_MAINTAINER_MODE
38
39dnl libtool versioning
40
41LT_CURRENT=1
42LT_REVISION=4
43AC_SUBST(LT_CURRENT)
44AC_SUBST(LT_REVISION)
45LT_AGE=0
46
47LT_VERSION_INFO="$LT_CURRENT:$LT_REVISION:$LT_AGE"
48AC_SUBST(LT_VERSION_INFO)
49
50LT_CURRENT_MINUS_AGE=`expr $LT_CURRENT - $LT_AGE`
51AC_SUBST(LT_CURRENT_MINUS_AGE)
52
53dnl ==========================================================================
54
55AM_CONFIG_HEADER(config.h)
56
57AC_PROG_CC
58AC_PROG_INSTALL
59AC_PROG_LN_S
60AC_LIBTOOL_WIN32_DLL
61AM_PROG_LIBTOOL
62AC_PROG_MAKE_SET
63
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
80WARN_CFLAGS=""
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"
85 AC_DEFINE_UNQUOTED(HAVE_WARNING_CPP_DIRECTIVE,1,
86 [Can use #warning in C files])
87fi
88AC_SUBST(WARN_CFLAGS)
89
90
91dnl ==========================================================================
92
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
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
153# Checks for header files.
154AC_HEADER_DIRENT
155AC_HEADER_STDC
156AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h])
157
158# Checks for typedefs, structures, and compiler characteristics.
159AC_C_CONST
160AC_C_INLINE
161AC_TYPE_PID_T
162
163# Checks for library functions.
164AC_FUNC_VPRINTF
165AC_FUNC_MMAP
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.])
200
201#
202# Checks for FreeType
203#
204
205AC_ARG_WITH(freetype-config, [ --with-freetype-config=PROG Use FreeType configuration program PROG], freetype_config=$withval, freetype_config=yes)
206
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
215
216FREETYPE_CFLAGS="`$ft_config --cflags`"
217FREETYPE_LIBS="`$ft_config --libs`"
218
219AC_SUBST(FREETYPE_LIBS)
220AC_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
230fontconfig_save_libs="$LIBS"
231fontconfig_save_cflags="$CFLAGS"
232LIBS="$LIBS $FREETYPE_LIBS"
233CFLAGS="$CFLAGS $FREETYPE_CFLAGS"
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)
235AC_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])
240AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,$HAVE_FT_BITMAP_SIZE_Y_PPEM,
241 [FT_Bitmap_Size structure includes y_ppem field])
242CFLAGS="$fontconfig_save_cflags"
243LIBS="$fontconfig_save_libs"
244
245#
246# Check expat configuration
247#
248
249AC_ARG_WITH(expat, [ --with-expat=DIR Use Expat in DIR], expat=$withval, expat=yes)
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)
252
253if 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
354fi
355
356#
357# Check libxml2 configuration
358#
359
360AC_ARG_ENABLE(libxml2, [ --enable-libxml2 Use libxml2 instead of Expat])
361
362PKG_PROG_PKG_CONFIG
363
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
371
372#
373# Set default font directory
374#
375
376AC_ARG_WITH(default-fonts, [ --with-default-fonts=DIR Use fonts from DIR when config is busted], default_fonts="$withval", default_fonts=yes)
377
378case "$default_fonts" in
379yes)
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 ;;
395esac
396
397AC_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#
404AC_ARG_WITH(add-fonts, [ --with-add-fonts=DIR1,DIR2,...Find additional fonts in DIR1,DIR2,... ], add_fonts="$withval", add_fonts=yes)
405
406case "$add_fonts" in
407yes)
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 ;;
428no)
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 ;;
435esac
436
437AC_SUBST(FC_ADD_FONTS)
438
439FC_FONTPATH=""
440
441case "$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 ;;
448esac
449
450AC_SUBST(FC_FONTPATH)
451
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
468FC_FONTDATE=`LC_ALL=C date`
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)
480 confdir='${sysconfdir}'/fonts
481 ;;
482*)
483 ;;
484esac
485AC_SUBST(confdir)
486CONFDIR=${confdir}
487AC_DEFINE_UNQUOTED(CONFDIR, "$CONFDIR",[Font configuration directory])
488AC_SUBST(CONFDIR)
489
490#
491# Find out what language orthographies are included
492#
493
494ORTH_FILES=`cd ${srcdir}/fc-lang && echo *.orth`
495AC_SUBST(ORTH_FILES)
496
497#
498# Let people not build/install docs if they don't have docbook
499#
500
501AC_CHECK_PROG(HASDOCBOOK, docbook2html, yes, no)
502
503AM_CONDITIONAL(USEDOCBOOK, test "x$HASDOCBOOK" = xyes)
504
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
515fi
516
517AC_ARG_ENABLE(docs, [ --disable-docs Don't build and install documentation],,enable_docs=$default_docs)
518
519AM_CONDITIONAL(ENABLE_DOCS, test "x$enable_docs" = xyes)
520
521if 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
531else
532 DOCSRC=""
533 DOCMAN3=""
534fi
535
536AC_SUBST(DOCSRC)
537AC_SUBST(DOCMAN3)
538
539#
540# Figure out where to install documentation
541#
542
543AC_ARG_WITH(docdir, [ --with-docdir=DIR Use DIR to store documentation files (default ${datadir}/doc/fontconfig)], confdir="$withval")
544
545if test "x$with_docdir" = "x" ; then
546 DOCDIR='${datadir}/doc/fontconfig'
547else
548 DOCDIR=$with_docdir
549fi
550
551AC_SUBST(DOCDIR)
552
553
554AC_OUTPUT([
555Makefile
556fontconfig/Makefile
557fc-lang/Makefile
558fc-glyphname/Makefile
559fc-case/Makefile
560fc-arch/Makefile
561src/Makefile
562src/fontconfig.def
563conf.d/Makefile
564fc-cache/Makefile
565fc-cat/Makefile
566fc-list/Makefile
567fc-match/Makefile
568doc/Makefile
569doc/version.sgml
570test/Makefile
571fontconfig.spec
572fontconfig.pc
573fonts.conf
574fontconfig-zip
575])