configure.in 11.3 KB
Newer Older
Keith Packard's avatar
Keith Packard committed
1
2
3
dnl 
dnl  $Id$
dnl 
4
dnl  Copyright © 2003 Keith Packard
Keith Packard's avatar
Keith Packard committed
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
dnl 
dnl  Permission to use, copy, modify, distribute, and sell this software and its
dnl  documentation for any purpose is hereby granted without fee, provided that
dnl  the above copyright notice appear in all copies and that both that
dnl  copyright notice and this permission notice appear in supporting
dnl  documentation, and that the name of Keith Packard not be used in
dnl  advertising or publicity pertaining to distribution of the software without
dnl  specific, written prior permission.  Keith Packard makes no
dnl  representations about the suitability of this software for any purpose.  It
dnl  is provided "as is" without express or implied warranty.
dnl 
dnl  KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
dnl  INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
dnl  EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
dnl  CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
dnl  DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
dnl  TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
dnl  PERFORMANCE OF THIS SOFTWARE.
23
dnl
Keith Packard's avatar
Keith Packard committed
24
dnl Process this file with autoconf to create configure.
Keith Packard's avatar
Keith Packard committed
25

26
27
AC_INIT(fonts.dtd)

Keith Packard's avatar
Keith Packard committed
28
29
30
dnl ==========================================================================
dnl                               Versioning              
dnl ==========================================================================
31

32
33
34
35
dnl This is the package version number, not the shared library
dnl version.  This same version number must appear in fontconfig/fontconfig.h
dnl Yes, it is a pain to synchronize version numbers.  Unfortunately, it's
dnl not possible to extract the version number here from fontconfig.h
Keith Packard's avatar
Keith Packard committed
36
AM_INIT_AUTOMAKE(fontconfig, 2.3.0)
37
AM_MAINTAINER_MODE
Keith Packard's avatar
Keith Packard committed
38

Keith Packard's avatar
Keith Packard committed
39
40
dnl libtool versioning

41
42
LT_CURRENT=1
LT_REVISION=4
Tor Lillqvist's avatar
Tor Lillqvist committed
43
44
AC_SUBST(LT_CURRENT)
AC_SUBST(LT_REVISION)
45
46
47
48
LT_AGE=0

LT_VERSION_INFO="$LT_CURRENT:$LT_REVISION:$LT_AGE"
AC_SUBST(LT_VERSION_INFO)
Keith Packard's avatar
Keith Packard committed
49

Tor Lillqvist's avatar
Tor Lillqvist committed
50
51
52
LT_CURRENT_MINUS_AGE=`expr $LT_CURRENT - $LT_AGE`
AC_SUBST(LT_CURRENT_MINUS_AGE)

Keith Packard's avatar
Keith Packard committed
53
54
55
dnl ==========================================================================

AM_CONFIG_HEADER(config.h)
56

Keith Packard's avatar
Keith Packard committed
57
58
59
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LN_S
Tor Lillqvist's avatar
Tor Lillqvist committed
60
AC_LIBTOOL_WIN32_DLL
Keith Packard's avatar
Keith Packard committed
61
62
63
AM_PROG_LIBTOOL
AC_PROG_MAKE_SET

Tor Lillqvist's avatar
Tor Lillqvist committed
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
dnl ==========================================================================

case "$host" in
  *-*-mingw*)
    os_win32=yes
    ;;
  *)
    os_win32=no
esac
AM_CONDITIONAL(OS_WIN32, test "$os_win32" = "yes")

if test "$os_win32" = "yes"; then
  AC_CHECK_PROG(ms_librarian, lib.exe, yes, no)
fi
AM_CONDITIONAL(MS_LIB_AVAILABLE, test x$ms_librarian = xyes)

80
81
82
83
84
85
86
87
88
WARN_CFLAGS=""

if test "x$GCC" = "xyes"; then
	WARN_CFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes \
	-Wmissing-prototypes -Wmissing-declarations \
	-Wnested-externs -fno-strict-aliasing"
fi
AC_SUBST(WARN_CFLAGS)

Tor Lillqvist's avatar
Tor Lillqvist committed
89
90
dnl ==========================================================================

91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
AM_CONDITIONAL(CROSS_COMPILING, test $cross_compiling = yes)

dnl ==========================================================================

# Setup for compiling build tools (fc-glyphname, etc)
AC_MSG_CHECKING([for a C compiler for build tools])
if test $cross_compiling = yes; then
  AC_CHECK_PROGS(CC_FOR_BUILD, gcc cc)
else
  CC_FOR_BUILD=$CC
fi
AC_MSG_RESULT([$CC_FOR_BUILD])
AC_SUBST(CC_FOR_BUILD)

AC_MSG_CHECKING([for suffix of executable build tools])
if test $cross_compiling = yes; then
  cat >conftest.c <<\_______EOF
int
main ()
{
  exit (0);
}
_______EOF
  for i in .exe ""; do
    compile="$CC_FOR_BUILD conftest.c -o conftest$i"
    if AC_TRY_EVAL(compile); then
      if (./conftest) 2>&AC_FD_CC; then
	EXEEXT_FOR_BUILD=$i
	break
      fi
    fi
  done
  rm -f conftest*
  if test "${EXEEXT_FOR_BUILD+set}" != set; then
    AC_MSG_ERROR([Cannot determine suffix of executable build tools])
  fi
else
  EXEEXT_FOR_BUILD=$EXEEXT
fi
AC_MSG_RESULT([$EXEEXT_FOR_BUILD])
AC_SUBST(EXEEXT_FOR_BUILD)

dnl ==========================================================================

135
136
137
# Checks for header files.
AC_HEADER_DIRENT
AC_HEADER_STDC
138
AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h iconv.h])
139
140
141
142
143
144
145

# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_PID_T

# Checks for library functions.
AC_FUNC_VPRINTF
146
AC_CHECK_FUNCS([geteuid getuid link memmove memset mkstemp strchr strrchr strtol getopt getopt_long iconv])
147

148
#
Keith Packard's avatar
Keith Packard committed
149
# Checks for FreeType
150
#
Keith Packard's avatar
Keith Packard committed
151

152
AC_ARG_WITH(freetype-config, [  --with-freetype-config=PROG   Use FreeType configuration program PROG], freetype_config=$withval, freetype_config=yes)
Keith Packard's avatar
Keith Packard committed
153

Keith Packard's avatar
Keith Packard committed
154
155
156
157
158
159
160
161
if test "$freetype_config" = "yes"; then 
	AC_PATH_PROG(ft_config,freetype-config,no)
	if test "$ft_config" = "no"; then
		AC_MSG_ERROR([You must have freetype installed; see http://www.freetype.org/])
	fi
else
	ft_config="$freetype_config"
fi
Keith Packard's avatar
Keith Packard committed
162

Keith Packard's avatar
Keith Packard committed
163
164
FREETYPE_CFLAGS="`$ft_config --cflags`"
FREETYPE_LIBS="`$ft_config --libs`"
Keith Packard's avatar
Keith Packard committed
165

Keith Packard's avatar
Keith Packard committed
166
167
AC_SUBST(FREETYPE_LIBS)
AC_SUBST(FREETYPE_CFLAGS)
168

169
#
170
171
172
173
# Check to see whether we have:
#  FT_Get_Next_Char
#  FT_Get_BDF_Property
#  FT_Get_PS_Font_Info
174
#  FT_Has_PS_Glyph_Names
175
176
#

177
178
fontconfig_save_libs="$LIBS"
fontconfig_save_cflags="$CFLAGS"
Keith Packard's avatar
Keith Packard committed
179
LIBS="$LIBS $FREETYPE_LIBS"
180
CFLAGS="$CFLAGS $FREETYPE_CFLAGS"
181
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)
182
183
184
AC_CHECK_MEMBER(FT_Bitmap_Size.y_ppem,
		HAVE_FT_BITMAP_SIZE_Y_PPEM=1,
		HAVE_FT_BITMAP_SIZE_Y_PPEM=0,
185
186
187
188
[#include <ft2build.h>
#include FT_FREETYPE_H])
AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,$HAVE_FT_BITMAP_SIZE_Y_PPEM,
		   [FT_Bitmap_Size structure includes y_ppem field])
189
190
CFLAGS="$fontconfig_save_cflags"
LIBS="$fontconfig_save_libs"
191

192
193
194
#
# Check expat configuration
#
Keith Packard's avatar
Keith Packard committed
195

Keith Packard's avatar
Keith Packard committed
196
AC_ARG_WITH(expat,             [  --with-expat=DIR              Use Expat in DIR], expat=$withval, expat=yes)
197
198
AC_ARG_WITH(expat-includes,    [  --with-expat-includes=DIR     Use Expat includes in DIR], expat_includes=$withval, expat_includes=yes)
AC_ARG_WITH(expat-lib,         [  --with-expat-lib=DIR          Use Expat library in DIR], expat_lib=$withval, expat_lib=yes)
Keith Packard's avatar
Keith Packard committed
199

200
case "$expat" in
Keith Packard's avatar
Keith Packard committed
201
202
no)
	;;
203
204
*)
	case "$expat_includes" in
205
206
207
208
209
210
211
212
213
214
	yes)
		case "$expat" in
		yes)
			;;
		*)
			EXPAT_CFLAGS="-I$expat/include"
			;;
		esac
		;;
	no)
Keith Packard's avatar
Keith Packard committed
215
		EXPAT_CFLAGS=""
216
217
		;;
	*)
Keith Packard's avatar
Keith Packard committed
218
		EXPAT_CFLAGS="-I$expat_includes"
219
220
221
222
223
		;;
	esac
	case "$expat_lib" in
	yes)
		case "$expat" in
224
		yes)
Keith Packard's avatar
Keith Packard committed
225
			EXPAT_LIBS="-lexpat"
226
227
			;;
		*)
Keith Packard's avatar
Keith Packard committed
228
			EXPAT_LIBS="-L$expat/lib -lexpat"
229
230
231
			;;
		esac
		;;
Keith Packard's avatar
Keith Packard committed
232
233
234
	no)
		;;
	*)
Keith Packard's avatar
Keith Packard committed
235
		EXPAT_LIBS="-L$expat_lib -lexpat"
236
237
238
		;;
	esac

Keith Packard's avatar
Keith Packard committed
239
240
241
242
	expatsaved_CPPFLAGS="$CPPFLAGS"
	CPPFLAGS="$CPPFLAGS $EXPAT_CFLAGS"
	expatsaved_LIBS="$LIBS"
	LIBS="$LIBS $EXPAT_LIBS"
243
244
245
246
247
248
249
250
251
252
253
254

	AC_CHECK_HEADER(expat.h)
	case "$ac_cv_header_expat_h" in
	no)
		AC_CHECK_HEADER(xmlparse.h)
		case "$ac_cv_header_xmlparse_h" in
		no)
			have_expat_header=no;
			;;
		yes)
			HAVE_XMLPARSE_H=1
			AC_SUBST(HAVE_XMLPARSE_H)
Keith Packard's avatar
Keith Packard committed
255
256
			AC_DEFINE_UNQUOTED(HAVE_XMLPARSE_H,$HAVE_XMLPARSE_H,
			[Use xmlparse.h instead of expat.h])
257
258
259
260
261
262
263
264
265
266
267
268
269
			have_expat_header=yes
			;;
		esac
		;;
	yes)
		have_expat_header=yes
		;;
	esac
	case "$have_expat_header" in
	no)
		expat=no
		;;
	yes)
270
		AC_CHECK_FUNCS(XML_SetDoctypeDeclHandler)
Noah Levitt's avatar
Noah Levitt committed
271
		case "$ac_cv_func_XML_SetDoctypeDeclHandler" in
272
273
274
		yes)
			HAVE_EXPAT=1
			AC_SUBST(HAVE_EXPAT)
Keith Packard's avatar
Keith Packard committed
275
276
			AC_DEFINE_UNQUOTED(HAVE_EXPAT,$HAVE_EXPAT,
			[Found a useable expat library])
277
			;;
Noah Levitt's avatar
Noah Levitt committed
278
279
280
		*)
			expat=no
			;;
281
		esac
Keith Packard's avatar
Keith Packard committed
282
283
		;;
	esac
Noah Levitt's avatar
Noah Levitt committed
284
285
	CPPFLAGS="$expatsaved_CPPFLAGS"
	LIBS="$expatsaved_LIBS"
Keith Packard's avatar
Keith Packard committed
286
287
	;;
esac
Keith Packard's avatar
Keith Packard committed
288
289
AC_SUBST(EXPAT_LIBS)
AC_SUBST(EXPAT_CFLAGS)
290
	
291
292
case "$expat" in
no)
293
	AC_MSG_ERROR([Cannot find usable expat library. This could mean that your version is too old.])
294
295
	;;
esac
Keith Packard's avatar
Keith Packard committed
296

Keith Packard's avatar
Keith Packard committed
297
298
299
300
#
# Set default font directory
#

301
AC_ARG_WITH(default-fonts,     [  --with-default-fonts=DIR      Use fonts from DIR when config is busted], default_fonts="$withval", default_fonts=yes)
Keith Packard's avatar
Keith Packard committed
302
303
304

case "$default_fonts" in
yes)
305
306
307
308
309
310
311
312
313
	if test "$os_win32" = "yes"; then
		FC_DEFAULT_FONTS="WINDOWSFONTDIR"
		AC_DEFINE_UNQUOTED(FC_DEFAULT_FONTS, "WINDOWSFONTDIR", 
				   [Windows font directory])
	else
		FC_DEFAULT_FONTS="/usr/share/fonts"
		AC_DEFINE_UNQUOTED(FC_DEFAULT_FONTS, "/usr/share/fonts", 
				   [System font directory])
	fi
Keith Packard's avatar
Keith Packard committed
314
315
316
317
318
319
320
321
322
323
324
	;;
*)
	FC_DEFAULT_FONTS="$default_fonts"
	AC_DEFINE_UNQUOTED(FC_DEFAULT_FONTS, "$default_fonts",
			   [System font directory])
	;;
esac

AC_SUBST(FC_DEFAULT_FONTS)

#
325
326
327
# Add more fonts if available.  By default, add only the directories
# with outline fonts; those with bitmaps can be added as desired in
# local.conf or ~/.fonts.conf
Keith Packard's avatar
Keith Packard committed
328
#
329
AC_ARG_WITH(add-fonts,        [  --with-add-fonts=DIR1,DIR2,...Find additional fonts in DIR1,DIR2,... ], add_fonts="$withval", add_fonts=yes)
Keith Packard's avatar
Keith Packard committed
330

331
case "$add_fonts" in
Keith Packard's avatar
Keith Packard committed
332
yes)
333
	FC_ADD_FONTS=""
334
	for dir in /usr/X11R6/lib/X11 /usr/X11/lib/X11 /usr/lib/X11; do
335
		case x"$FC_ADD_FONTS" in
Keith Packard's avatar
Keith Packard committed
336
		x)
337
338
339
340
341
342
343
344
345
346
			sub="$dir/fonts"
			if test -d "$sub"; then
				case x$FC_ADD_FONTS in
				x)
					FC_ADD_FONTS="$sub"
					;;
				*)
					FC_ADD_FONTS="$FC_ADD_FONTS,$sub"
					;;
				esac
Keith Packard's avatar
Keith Packard committed
347
348
349
350
			fi
			;;
		esac
	done
351
	AC_DEFINE_UNQUOTED(FC_ADD_FONTS,"$add_fonts",[Additional font directories])
Keith Packard's avatar
Keith Packard committed
352
353
	;;
no)
354
	FC_ADD_FONTS=""
Keith Packard's avatar
Keith Packard committed
355
356
	;;
*)
357
358
	FC_ADD_FONTS="$add_fonts"
	AC_DEFINE_UNQUOTED(FC_ADD_FONTS,"$add_fonts",[Additional font directories])
Keith Packard's avatar
Keith Packard committed
359
360
361
	;;
esac

362
AC_SUBST(FC_ADD_FONTS)
Keith Packard's avatar
Keith Packard committed
363
364
365

FC_FONTPATH=""

366
case "$FC_ADD_FONTS" in
Keith Packard's avatar
Keith Packard committed
367
368
369
"")
	;;
*)
370
371
	FC_FONTPATH=`echo $FC_ADD_FONTS | 
			sed -e 's/^/<dir>/' -e 's/$/<\/dir>/' -e 's/,/<\/dir> <dir>/g'`
Keith Packard's avatar
Keith Packard committed
372
373
374
375
376
	;;
esac

AC_SUBST(FC_FONTPATH)

377
FC_FONTDATE=`LC_ALL=C date`
Keith Packard's avatar
Keith Packard committed
378
379
380
381
382
383
384
385
386
387
388

AC_SUBST(FC_FONTDATE)

AC_ARG_WITH(confdir,           [  --with-confdir=DIR            Use DIR to store configuration files (default /etc/fonts)], confdir="$withval", confdir=yes)

#
# Set CONFDIR and FONTCONFIG_PATH
#

case "$confdir" in
no|yes)
389
	confdir='${sysconfdir}'/fonts
Keith Packard's avatar
Keith Packard committed
390
391
392
393
394
	;;
*)
	;;
esac
AC_SUBST(confdir)
395
CONFDIR=${confdir}
Keith Packard's avatar
Keith Packard committed
396
397
398
399
400
401
402
AC_DEFINE_UNQUOTED(CONFDIR, "$CONFDIR",[Font configuration directory])
AC_SUBST(CONFDIR)

#
# Find out what language orthographies are included
#

403
ORTH_FILES=`cd ${srcdir}/fc-lang && echo *.orth`
Keith Packard's avatar
Keith Packard committed
404
AC_SUBST(ORTH_FILES)
405

Keith Packard's avatar
Keith Packard committed
406
407
408
409
410
411
#
# Let people not build/install docs if they don't have docbook
#

AC_CHECK_PROG(HASDOCBOOK, docbook2html, yes, no)

412
AM_CONDITIONAL(USEDOCBOOK, test "x$HASDOCBOOK" = xyes)
Keith Packard's avatar
Keith Packard committed
413

414
415
416
417
418
419
420
421
422
423
default_docs="yes"
#
# Check if docs exist or can be created
#
if test x$HASDOCBOOK = xno; then
	if test -f doc/fonts-conf.5; then
		:
	else
		default_docs="no"
	fi
Keith Packard's avatar
Keith Packard committed
424
425
fi

426
427
AC_ARG_ENABLE(docs,           [  --disable-docs                Don't build and install documentation],,enable_docs=$default_docs)

Keith Packard's avatar
Keith Packard committed
428
429
AM_CONDITIONAL(ENABLE_DOCS, test "x$enable_docs" = xyes)

430
431
if test "x$enable_docs" = xyes; then
	DOCSRC="doc"
432
433
434
435
436
437
438
439
	tmp=funcs.$$
	cat $srcdir/doc/*.fncs | awk '
	/^@TITLE@/	{ if (!done) { printf ("%s\n", $2); done = 1; } }
	/^@FUNC@/	{ if (!done) { printf ("%s\n", $2); done = 1; } }
	/^@@/		{ done = 0; }' > $tmp
	DOCMAN3=`cat $tmp | awk '{ printf ("%s.3 ", $1); }'`
	echo DOCMAN3 $DOCMAN3
	rm -f $tmp
440
441
else
	DOCSRC=""
442
	DOCMAN3=""
443
444
445
fi

AC_SUBST(DOCSRC)
446
AC_SUBST(DOCMAN3)
447

448
449
450
451
#
# Figure out where to install documentation
#

452
AC_ARG_WITH(docdir,           [  --with-docdir=DIR             Use DIR to store documentation files (default ${datadir}/doc/fontconfig)], confdir="$withval")
453
454
455
456
457
458
459
460
461

if test "x$with_docdir" = "x" ; then
  DOCDIR='${datadir}/doc/fontconfig'
else
  DOCDIR=$with_docdir
fi

AC_SUBST(DOCDIR)

Keith Packard's avatar
Keith Packard committed
462
463
464
465
AC_OUTPUT([
Makefile 
fontconfig/Makefile
fc-lang/Makefile
466
fc-glyphname/Makefile
467
fc-case/Makefile
Keith Packard's avatar
Keith Packard committed
468
src/Makefile
Tor Lillqvist's avatar
Tor Lillqvist committed
469
src/fontconfig.def
470
conf.d/Makefile
Keith Packard's avatar
Keith Packard committed
471
472
fc-cache/Makefile
fc-list/Makefile
473
fc-match/Makefile
474
doc/Makefile
475
doc/version.sgml
Keith Packard's avatar
Keith Packard committed
476
test/Makefile
Keith Packard's avatar
Keith Packard committed
477
478
479
fontconfig.spec
fontconfig.pc
fonts.conf
Tor Lillqvist's avatar
Tor Lillqvist committed
480
fontconfig-zip
Keith Packard's avatar
Keith Packard committed
481
])