summaryrefslogtreecommitdiff
path: root/configure.ac
blob: 58090f4e180c8babcd2446c18004810de02eb0e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
dnl 
dnl  $Id$
dnl 
dnl  Copyright © 2003 Keith Packard
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.
dnl
dnl Process this file with autoconf to create configure.

AC_PREREQ([2.57])

AC_INIT([libXfont],
	1.4.3,
	[keithp@keithp.com],
	libXfont)
dnl
dnl This is the package version number, not the shared library
dnl version.  This same version number must appear in Xfont.h
dnl Yes, it is a pain to synchronize version numbers.  Unfortunately, it's
dnl not possible to extract the version number here from Xfont.h
dnl
AM_INIT_AUTOMAKE([foreign dist-bzip2])
AM_CONFIG_HEADER(config.h)
AC_CONFIG_HEADERS([include/X11/fonts/fontconf.h])

# Check for progs
AC_PROG_CC
AC_PROG_LIBTOOL
dnl If the first PKG_CHECK_MODULES appears inside a conditional, pkg-config
dnl must first be located explicitly.
PKG_PROG_PKG_CONFIG

# Look for headers
AC_CHECK_HEADERS([endian.h])

#
# select libraries to include
#

AC_ARG_ENABLE(freetype, [ --enable-freetype ],[XFONT_FREETYPE=$enableval],[XFONT_FREETYPE=no])
AM_CONDITIONAL(XFONT_FREETYPE, [test x$XFONT_FREETYPE = xyes])
if test x$XFONT_FREETYPE = xyes; then
	AC_DEFINE(XFONT_FREETYPE,1,[Support FreeType fonts])
	AC_ARG_WITH(freetype-config, [  --with-freetype-config=PROG   Use FreeType configuration program PROG], freetype_config=$withval, freetype_config=yes)
	
	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
	
	FREETYPE_CFLAGS="`$ft_config --cflags`"
	FREETYPE_LIBS="`$ft_config --libs`"
	
else
	FREETYPE_CFLAGS=""
	FREETYPE_LIBS=""
fi
AC_SUBST(FREETYPE_LIBS)
AC_SUBST(FREETYPE_CFLAGS)

AC_ARG_ENABLE(fontcache, [ --disable-fontcache ],[XFONT_FONTCACHE=$enableval],[XFONT_FONTCACHE=yes])
AM_CONDITIONAL(XFONT_FONTCACHE, [test x$XFONT_FONTCACHE = xyes])
if test x$XFONT_FONTCACHE = xyes; then
	AC_DEFINE(XFONT_FONTCACHE,1,[Support the font caching extension])
	PKG_CHECK_MODULES(FONTCACHEPROTO, fontcacheproto)
else
	FONTCACHEPROTO_CFLAGS=""
fi
AC_SUBST(FONTCACHEPROTO_CFLAGS)

AC_ARG_ENABLE(fc, [ --enable-fc ],[XFONT_FC=$enableval],[XFONT_FC=no])
AM_CONDITIONAL(XFONT_FC, [test x$XFONT_FC = xyes])
if test x$XFONT_FC = xyes; then
	AC_DEFINE(XFONT_FC,1,[Support the X Font Services Protocol])
fi

AC_ARG_ENABLE(builtins, [ --disable-builtins ], [XFONT_BUILTINS=$enableval], [XFONT_BUILTINS=yes])
AM_CONDITIONAL(XFONT_BUILTINS, [test "x$XFONT_BUILTINS" = xyes ])
if test "x$XFONT_BUILTINS" = xyes; then
	AC_DEFINE(XFONT_BUILTINS,1,[Support built-in fonts])
fi

AC_ARG_ENABLE(bitmap, [ --disable-bitmap ], [XFONT_BITMAP=$enableval], [XFONT_BITMAP=yes])
AM_CONDITIONAL(XFONT_BITMAP, [test "x$XFONT_BITMAP" = xyes ])
if test "x$XFONT_BITMAP" = xyes; then
	AC_DEFINE(XFONT_BITMAP,1,[Support bitmap font files])
fi

AC_ARG_ENABLE(type1, [ --disable-type1 ], [XFONT_TYPE1=$enableval], [XFONT_TYPE1=yes])
AM_CONDITIONAL(XFONT_TYPE1, [test "x$XFONT_TYPE1" = xyes ])
if test "x$XFONT_TYPE1" = xyes; then
	AC_DEFINE(XFONT_TYPE1,1,[Support Type 1 font files])
fi

if test "x$XFONT_BULITINS" = xyes -o "x$XFONT_BITMAP" = xyes -o "x$XFONT_FREETYPE" = xyes; then
	XFONT_FONTFILE=yes
else
	XFONT_FONTFILE=no
fi
AM_CONDITIONAL(XFONT_FONTFILE, [test "x$XFONT_FONTFILE" = xyes])
if test "x$XFONT_FONTFILE" = xyes; then
	AC_DEFINE(XFONT_FONTFILE,,[Support fonts in files])
fi

AC_CHECK_LIB(z, gzopen, [Z_LIBS=-lz
AC_SUBST(Z_LIBS)], AC_MSG_ERROR([*** zlib is required]))

AC_DEFINE(PCFFORMAT,,[Support PCF format fonts])
AC_DEFINE(X_GZIP_FONT_COMPRESSION,1,[Support gzip fonts])
X_GZIP_FONT_COMPRESSION=1
AC_SUBST(X_GZIP_FONT_COMPRESSION)

AC_CHECK_LIB(m, hypot, [MATH_LIBS=-lm
AC_SUBST(MATH_LIBS)], AC_MSG_ERROR([*** libm is required]))

PKG_CHECK_MODULES(XFONT, xproto xtrans fontsproto)

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

CFLAGS="$CFLAGS $XFONT_CFLAGS"
LIBS="$LIBS $XFONT_LIBS"

AC_OUTPUT([Makefile
	   src/fontcache/Makefile
	   src/fontfile/Makefile
	   src/FreeType/Makefile
	   src/builtins/Makefile
	   src/bitmap/Makefile
	   src/Type1/Makefile
	   src/fc/Makefile
	   src/util/Makefile
	   src/stubs/Makefile
           xfont.pc])