]> git.wh0rd.org - fontconfig.git/blob - configure.in
More autoconf cleanup for fontconfig
[fontconfig.git] / configure.in
1 dnl
2 dnl $XFree86: xc/lib/fontconfig/configure.in,v 1.2 2002/05/21 17:08:42 keithp Exp $
3 dnl
4 dnl Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc.
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
25 # Process this file with autoconf to produce a configure script.
26 AC_INIT(fontconfig, 1.0.1, fonts@xfree86.org)
27 AC_CONFIG_AUX_DIR(config)
28 AC_CONFIG_HEADER(config.h)
29
30 AC_ARG_WITH(freetype_includes, [ --with-freetype-includes=DIR Use FreeType includes in DIR], freetype_includes=$withval, freetype_includes=yes)
31 AC_ARG_WITH(freetype_lib, [ --with-freetype-lib=DIR Use FreeType library in DIR], freetype_lib=$withval, freetype_lib=yes)
32 AC_ARG_WITH(freetype_config, [ --with-freeetype-config=PROG Use FreeType configuration program PROG], freetype_config=$withval, freetype_config=yes)
33 AC_ARG_WITH(expat, [ --with-expat=DIR Use Expat in DIR instead of xml2], expat=$withval, expat=maybe)
34 AC_ARG_WITH(expat_includes, [ --with-expat-includes=DIR Use Expat includes in DIR], expat_includes=$withval, expat_includes=yes)
35 AC_ARG_WITH(expat_lib, [ --with-expat-lib=DIR Use Expat library in DIR], expat_lib=$withval, expat_lib=yes)
36 AC_ARG_WITH(xml2, [ --with-xml2=DIR Use Libxml2 in DIR instead of expat], xml2=$withval, xml2=maybe)
37 AC_ARG_WITH(xml2_includes, [ --with-xml2-includes=DIR Use Libxml2 includes in DIR], xml2_includes=$withval, xml2_includes=yes)
38 AC_ARG_WITH(xml2_lib, [ --with-xml2-lib=DIR Use Libxml2 library in DIR], xml2_lib=$withval, xml2_lib=yes)
39 AC_ARG_WITH(default_fonts, [ --with-default-fonts=DIR Use fonts from DIR when config is busted], defaultfonts="$withval", default_fonts=yes)
40
41 # Checks for programs.
42 AC_PROG_CC
43 AC_PROG_INSTALL
44 AC_PROG_LN_S
45 AC_PATH_X
46
47 PACKAGE_VERSION=1.0.1
48
49 # Set major version
50 PACKAGE_MAJOR=`echo $PACKAGE_VERSION | awk -F . '{ print $1 }'`
51 PACKAGE_MINOR=`echo $PACKAGE_VERSION | awk -F . '{ print $2 }'`
52 PACKAGE_REVISION=`echo $PACKAGE_VERSION | awk -F . '{ print $3 }'`
53 AC_SUBST(PACKAGE_MAJOR)
54 AC_SUBST(PACKAGE_MINOR)
55 AC_SUBST(PACKAGE_REVISION)
56
57 OBJEXT="o"
58 AC_SUBST(OBJEXT)
59
60 AC_DEFINE_UNQUOTED(PACKAGE_MAJOR,$PACKAGE_MAJOR)
61 AC_DEFINE_UNQUOTED(PACKAGE_MINOR,$PACKAGE_MINOR)
62 AC_DEFINE_UNQUOTED(PACKAGE_REVISION,$PACKAGE_REVISION)
63
64 # Checks for header files.
65 AC_HEADER_DIRENT
66 AC_HEADER_STDC
67 AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h])
68
69 # Checks for typedefs, structures, and compiler characteristics.
70 AC_C_CONST
71 AC_TYPE_PID_T
72
73 # Checks for library functions.
74 AC_FUNC_VPRINTF
75 AC_CHECK_FUNCS([memmove memset strchr strrchr strtol getopt getopt_long])
76
77 if test "$GCC" = "yes"; then
78 MKSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
79 DSO_LDOPTS='-shared -Wl,-h,`echo $@ | sed '"'s/\.so\.\([[0-9][0-9]]*\).*/.so.\1/'"'`'
80 DSO_CFLAGS=''
81 DSO_PIC_CFLAGS='-fPIC -DPIC'
82 else
83 MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
84 DSO_LDOPTS='-shared -h $@'
85 DSO_CFLAGS=''
86 DSO_PIC_CFLAGS='-KPIC -DPIC'
87 fi
88
89 AC_SUBST(MKSHLIB)
90 AC_SUBST(DSO_LDOPTS)
91 AC_SUBST(DSO_CFLAGS)
92 AC_SUBST(DSO_PIC_CFLAGS)
93
94 #
95 # Using x libraries, set X font directory
96 case "$no_x" in
97 yes)
98 ;;
99 *)
100 X_FONT_DIR="$x_libraries/X11/fonts"
101 AC_DEFINE_UNQUOTED(X_FONT_DIR,$X_FONT_DIR)
102 ;;
103 esac
104 AC_SUBST(X_FONT_DIR)
105
106 #
107 # Check freetype configuration
108 #
109 case "$freetype_config" in
110 no)
111 ;;
112 yes)
113 AC_CHECK_PROG(ft_config,freetype-config,freetype-config,no)
114 ;;
115 *)
116 ft_config="$freetype_config"
117 ;;
118 esac
119
120 case "$freetype_includes" in
121 no)
122 freetype_includes=""
123 ;;
124 yes)
125 case "$ft_config" in
126 no)
127 freetype_includes=""
128 ;;
129 *)
130 freetype_includes="`$ft_config --cflags`"
131 ;;
132 esac
133 ;;
134 *)
135 freetype_includes="-I$freetype_includes"
136 ;;
137 esac
138
139 case "$freetype_lib" in
140 no)
141 freetype_lib=""
142 ;;
143 yes)
144 case "$ft_config" in
145 no)
146 freetype_lib=""
147 ;;
148 *)
149 freetype_lib="`$ft_config --libs`"
150 ;;
151 esac
152 ;;
153 *)
154 freetype_lib="-L$freetype_lib -lfreetype"
155 ;;
156 esac
157
158 saved_LIBS="$LIBS"
159 LIBS="$LIBS $freetype_lib"
160 saved_CPPFLAGS="$CPPFLAGS"
161 CPPFLAGS="$CPPFLAGS $freetype_includes"
162 AC_CHECK_HEADERS(freetype/freetype.h)
163
164 case "$ac_cv_header_freetype_freetype_h" in
165 no)
166 CPPFLAGS="$saved_CPPFLAGS"
167 LIBS="$saved_LIBS"
168 ;;
169 yes)
170 AC_CHECK_FUNCS(FT_Init_FreeType)
171 case "$ac_cv_func_FT_Init_FreeType" in
172 no)
173 CPPFLAGS="$saved_CPPFLAGS"
174 LIBS="$saved_LIBS"
175 ;;
176 yes)
177 AC_DEFINE(HAVE_FREETYPE)
178 ;;
179 esac
180 ;;
181 esac
182
183 case "$default_fonts" in
184 yes)
185 FC_DEFAULT_FONTS="/usr/share/fonts"
186 AC_DEFINE_UNQUOTED(FC_DEFAULT_FONTS, "/usr/share/fonts")
187 ;;
188 *)
189 FC_DEFAULT_FONTS="$default_fonts"
190 AC_DEFINE_UNQUOTED(FC_DEFAULT_FONTS, "$default_fonts")
191 ;;
192 esac
193
194 AC_SUBST(FC_DEFAULT_FONTS)
195
196 #
197 # Check expat/libxml2 configuration
198 #
199
200 case "$expat" in
201 maybe)
202 ;;
203 no)
204 xml2=yes
205 ;;
206 *)
207 xml2=no
208 ;;
209 esac
210
211 case "$xml2" in
212 maybe)
213 ;;
214 no)
215 expat=yes
216 ;;
217 *)
218 expat=no
219 ;;
220 esac
221
222 case "$expat" in
223 no)
224 ;;
225 *)
226 case "$expat_includes" in
227 yes|no)
228 expat_include_path=""
229 ;;
230 *)
231 expat_include_path="-I$expat_includes"
232 ;;
233 esac
234 case "$expat_lib" in
235 yes)
236 case "$expat" in
237 yes|maybe)
238 expat_library="-lexpat"
239 ;;
240 *)
241 expat_library="-L$expat/lib -lexpat"
242 ;;
243 esac
244 ;;
245 no)
246 ;;
247 *)
248 expat_library="-L$expat_lib -lexpat"
249 ;;
250 esac
251
252 saved_CPPFLAGS="$CPPFLAGS"
253 CPPFLAGS="$CPPFLAGS $expat_include_path"
254 saved_LIBS="$LIBS"
255 LIBS="$LIBS $expat_library"
256
257 AC_CHECK_HEADER(expat.h)
258 case "$ac_cv_header_expat_h" in
259 no)
260 AC_CHECK_HEADER(xmlparse.h)
261 case "$ac_cv_header_xmlparse_h" in
262 no)
263 have_expat_header=no;
264 ;;
265 yes)
266 HAVE_XMLPARSE_H=1
267 AC_SUBST(HAVE_XMLPARSE_H)
268 AC_DEFINE_UNQUOTED(HAVE_XMLPARSE_H,$HAVE_XMLPARSE_H)
269 have_expat_header=yes
270 ;;
271 esac
272 ;;
273 yes)
274 have_expat_header=yes
275 ;;
276 esac
277 case "$have_expat_header" in
278 no)
279 CPPFLAGS="$saved_CPPFLAGS"
280 LIBS="$saved_LIBS"
281 expat=no
282 ;;
283 yes)
284 AC_CHECK_FUNCS(XML_ParserCreate)
285 case "$ac_cv_func_XML_ParserCreate" in
286 no)
287 CPPFLAGS="$saved_CPPFLAGS"
288 LIBS="$saved_LIBS"
289 expat=no
290 ;;
291 yes)
292 HAVE_EXPAT=1
293 AC_SUBST(HAVE_EXPAT)
294 AC_DEFINE_UNQUOTED(HAVE_EXPAT,$HAVE_EXPAT)
295 xml2=no
296 ;;
297 esac
298 ;;
299 esac
300 ;;
301 esac
302
303 case "$xml2" in
304 no)
305 ;;
306 *)
307 case "$xml2_includes" in
308 yes|no)
309 xml2_include_path=""
310 ;;
311 *)
312 xml2_include_path="-I$xml2_includes"
313 ;;
314 esac
315 case "$xml2_lib" in
316 yes)
317 case "$xml2" in
318 yes|maybe)
319 xml2_library="-lxml2"
320 ;;
321 *)
322 xml2_library="-L$xml2/lib -lxml2"
323 ;;
324 esac
325 ;;
326 no)
327 ;;
328 *)
329 xml2_library="-L$xml2_lib -lxml2"
330 ;;
331 esac
332
333 saved_CPPFLAGS="$CPPFLAGS"
334 CPPFLAGS="$CPPFLAGS $xml2_include_path"
335 saved_LIBS="$LIBS"
336 LIBS="$LIBS $xml2_library"
337
338 AC_CHECK_HEADER(libxml/parser.h)
339 case "$ac_cv_header_libxml_parser_h" in
340 no)
341 CPPFLAGS="$saved_CPPFLAGS"
342 LIBS="$saved_LIBS"
343 xml2=no
344 ;;
345 yes)
346 AC_CHECK_FUNCS(xmlInitParser)
347 case "$ac_cv_func_xmlInitParser" in
348 no)
349 CPPFLAGS="$saved_CPPFLAGS"
350 LIBS="$saved_LIBS"
351 xml2=no
352 ;;
353 yes)
354 HAVE_XML2=1
355 AC_SUBST(HAVE_XML2)
356 AC_DEFINE_UNQUOTED(HAVE_XML2,$HAVE_XML2)
357 expat=no
358 ;;
359 esac
360 ;;
361 esac
362 ;;
363 esac
364
365 case "$expat""$xml2" in
366 nono)
367 AC_MSG_ERROR([cannot find either libxml2 or expat])
368 ;;
369 esac
370
371 AC_OUTPUT([Makefile
372 config/Makedefs
373 src/Makefile
374 fc-cache/Makefile
375 fc-list/Makefile
376 fontconfig/Makefile])
377