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