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