]> git.wh0rd.org - fontconfig.git/blob - configure.in
Switch to automake
[fontconfig.git] / configure.in
1 dnl
2 dnl $Id$
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 KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
17 dnl INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
18 dnl EVENT SHALL KEITH PACKARD 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 dnl ==========================================================================
27 dnl Versioning
28 dnl ==========================================================================
29
30 dnl The version number is also in fontconfig/fontconfig.h
31 AC_INIT(ChangeLog,1.0.3,fontconfig@fontconfig.org)
32
33 FONTCONFIG_HEADER=fontconfig/fontconfig.h
34 FONTCONFIG_MAJOR=`awk '/^#define FC_MAJOR/ { print $3 }' $FONTCONFIG_HEADER`
35 FONTCONFIG_MINOR=`awk '/^#define FC_MINOR/ { print $3 }' $FONTCONFIG_HEADER`
36 FONTCONFIG_REVISION=`awk '/^#define FC_REVISION/ { print $3 }' $FONTCONFIG_HEADER`
37 FONTCONFIG_VERSION="$FONTCONFIG_MAJOR.$FONTCONFIG_MINOR.$FONTCONFIG_REVISION"
38
39 AC_SUBST(FONTCONFIG_MAJOR)
40 AC_SUBST(FONTCONFIG_MINOR)
41 AC_SUBST(FONTCONFIG_REVISION)
42 AC_SUBST(FONTCONFIG_VERSION)
43
44 dnl libtool versioning
45
46 LT_VERSION_NUMBER="$FONTCONFIG_MAJOR:$FONTCONFIG_MINOR:$FONTCONFIG_REVISION"
47 AC_SUBST(LT_VERSION_NUMBER)
48
49 dnl ==========================================================================
50
51 AM_INIT_AUTOMAKE(fontconfig, $FONTCONFIG_VERSION)
52
53 AM_CONFIG_HEADER(config.h)
54
55 AC_PROG_CC
56 AC_PROG_INSTALL
57 AC_PROG_LN_S
58 AM_PROG_LIBTOOL
59 AC_PROG_MAKE_SET
60
61 # Checks for header files.
62 AC_HEADER_DIRENT
63 AC_HEADER_STDC
64 AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h])
65
66 # Checks for typedefs, structures, and compiler characteristics.
67 AC_C_CONST
68 AC_TYPE_PID_T
69
70 # Checks for library functions.
71 AC_FUNC_VPRINTF
72 AC_CHECK_FUNCS([memmove memset strchr strrchr strtol getopt getopt_long])
73
74 #
75 # Checks for FreeType
76 #
77
78 AC_ARG_WITH(freetype_config, [ --with-freetype-config=PROG Use FreeType configuration program PROG], freetype_config=$withval, freetype_config=yes)
79
80 if test "$freetype_config" = "yes"; then
81 AC_PATH_PROG(ft_config,freetype-config,no)
82 if test "$ft_config" = "no"; then
83 AC_MSG_ERROR([You must have freetype installed; see http://www.freetype.org/])
84 fi
85 else
86 ft_config="$freetype_config"
87 fi
88
89 FREETYPE_CFLAGS="$($ft_config --cflags)"
90 FREETYPE_LIBS="$($ft_config --libs)"
91
92 AC_SUBST(FREETYPE_LIBS)
93 AC_SUBST(FREETYPE_CFLAGS)
94
95 #
96 # Check to see whether we have FT_Get_First_Char(), new in 2.0.9
97 #
98
99 fontconfig_save_libs=$LIBS
100 LIBS="$LIBS $FREETYPE_LIBS"
101 AC_CHECK_FUNCS(FT_Get_First_Char)
102 LIBS=$fontconfig_save_libs
103
104 #
105 # Check expat configuration
106 #
107
108 AC_ARG_WITH(expat, [ --with-expat=DIR Use Expat in DIR], expat=$withval, expat=yes)
109 AC_ARG_WITH(expat_includes, [ --with-expat-includes=DIR Use Expat includes in DIR], expat_includes=$withval, expat_includes=yes)
110 AC_ARG_WITH(expat_lib, [ --with-expat-lib=DIR Use Expat library in DIR], expat_lib=$withval, expat_lib=yes)
111
112 case "$expat" in
113 no)
114 ;;
115 *)
116 case "$expat_includes" in
117 yes|no)
118 EXPAT_CFLAGS=""
119 ;;
120 *)
121 EXPAT_CFLAGS="-I$expat_includes"
122 ;;
123 esac
124 case "$expat_lib" in
125 yes)
126 case "$expat" in
127 yes)
128 EXPAT_LIBS="-lexpat"
129 ;;
130 *)
131 EXPAT_LIBS="-L$expat/lib -lexpat"
132 ;;
133 esac
134 ;;
135 no)
136 ;;
137 *)
138 EXPAT_LIBS="-L$expat_lib -lexpat"
139 ;;
140 esac
141
142 expatsaved_CPPFLAGS="$CPPFLAGS"
143 CPPFLAGS="$CPPFLAGS $EXPAT_CFLAGS"
144 expatsaved_LIBS="$LIBS"
145 LIBS="$LIBS $EXPAT_LIBS"
146
147 AC_CHECK_HEADER(expat.h)
148 case "$ac_cv_header_expat_h" in
149 no)
150 AC_CHECK_HEADER(xmlparse.h)
151 case "$ac_cv_header_xmlparse_h" in
152 no)
153 have_expat_header=no;
154 ;;
155 yes)
156 HAVE_XMLPARSE_H=1
157 AC_SUBST(HAVE_XMLPARSE_H)
158 AC_DEFINE_UNQUOTED(HAVE_XMLPARSE_H,$HAVE_XMLPARSE_H,
159 [Use xmlparse.h instead of expat.h])
160 have_expat_header=yes
161 ;;
162 esac
163 ;;
164 yes)
165 have_expat_header=yes
166 ;;
167 esac
168 case "$have_expat_header" in
169 no)
170 expat=no
171 ;;
172 yes)
173 AC_CHECK_FUNCS(XML_ParserCreate)
174 case "$ac_cv_func_XML_ParserCreate" in
175 no)
176 expat=no
177 ;;
178 yes)
179 HAVE_EXPAT=1
180 AC_SUBST(HAVE_EXPAT)
181 AC_DEFINE_UNQUOTED(HAVE_EXPAT,$HAVE_EXPAT,
182 [Found a useable expat library])
183 ;;
184 esac
185 ;;
186 esac
187 CPPFLAGS="$saved_CPPFLAGS"
188 LIBS="$saved_LIBS"
189 ;;
190 esac
191 AC_SUBST(EXPAT_LIBS)
192 AC_SUBST(EXPAT_CFLAGS)
193
194 case "$expat" in
195 no)
196 AC_MSG_ERROR([cannot find expat library])
197 ;;
198 esac
199
200 #
201 # Set default font directory
202 #
203
204 AC_ARG_WITH(default_fonts, [ --with-default-fonts=DIR Use fonts from DIR when config is busted], defaultfonts="$withval", default_fonts=yes)
205
206 case "$default_fonts" in
207 yes)
208 FC_DEFAULT_FONTS="/usr/share/fonts"
209 AC_DEFINE_UNQUOTED(FC_DEFAULT_FONTS, "/usr/share/fonts",
210 [System font directory])
211 ;;
212 *)
213 FC_DEFAULT_FONTS="$default_fonts"
214 AC_DEFINE_UNQUOTED(FC_DEFAULT_FONTS, "$default_fonts",
215 [System font directory])
216 ;;
217 esac
218
219 AC_SUBST(FC_DEFAULT_FONTS)
220
221 #
222 # Add X fonts if available
223 #
224 AC_ARG_WITH(x_fonts, [ --with-x-fonts=DIR Find X fonts in DIR ], x_fonts="$withval", x_fonts=yes)
225
226 case "$x_fonts" in
227 yes)
228 FC_X_FONTS=""
229 for dir in /usr/X11R6/lib /usr/X11/lib /usr/lib/X11; do
230 case x"$FC_X_FONTS" in
231 x)
232 if test -d "$dir/fonts"; then
233 FC_X_FONTS="$dir/fonts"
234 fi
235 ;;
236 esac
237 done
238 AC_DEFINE_UNQUOTED(FC_X_FONTS,"$x_fonts",[X font directory])
239 ;;
240 no)
241 FC_X_FONTS=""
242 ;;
243 *)
244 FC_X_FONTS="$x_fonts"
245 AC_DEFINE_UNQUOTED(FC_X_FONTS,"$x_fonts",[X font directory])
246 ;;
247 esac
248
249 AC_SUBST(FC_X_FONTS)
250
251 FC_FONTPATH=""
252
253 case "$FC_X_FONTS" in
254 "")
255 ;;
256 *)
257 FC_FONTPATH="<dir>$FC_X_FONTS</dir>"
258 ;;
259 esac
260
261 AC_SUBST(FC_FONTPATH)
262
263 FC_FONTDATE=`date`
264
265 AC_SUBST(FC_FONTDATE)
266
267 AC_ARG_WITH(confdir, [ --with-confdir=DIR Use DIR to store configuration files (default /etc/fonts)], confdir="$withval", confdir=yes)
268
269 #
270 # Set CONFDIR and FONTCONFIG_PATH
271 #
272
273 case "$confdir" in
274 no|yes)
275 confdir=/etc/fonts
276 ;;
277 *)
278 ;;
279 esac
280 AC_SUBST(confdir)
281 CONFDIR='${confdir}'
282 AC_DEFINE_UNQUOTED(CONFDIR, "$CONFDIR",[Font configuration directory])
283 AC_SUBST(CONFDIR)
284
285 #
286 # Find out what language orthographies are included
287 #
288
289 ORTH_FILES=`cd fc-lang && echo *.orth`
290 AC_SUBST(ORTH_FILES)
291
292 AC_OUTPUT([
293 Makefile
294 fontconfig/Makefile
295 fc-lang/Makefile
296 src/Makefile
297 fc-cache/Makefile
298 fc-list/Makefile
299 fontconfig.spec
300 fontconfig.pc
301 fonts.conf
302 ])