]> git.wh0rd.org Git - fontconfig.git/blob - configure.in
Add pkgconfig control file and fontconfig-config script
[fontconfig.git] / configure.in
1 dnl
2 dnl $XFree86: xc/lib/fontconfig/configure.in,v 1.3 2002/05/21 17:48:15 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_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     MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
85     DSO_LDOPTS='-shared -h $@'
86     DSO_CFLAGS=''
87     DSO_PIC_CFLAGS='-KPIC -DPIC'
88 fi
89
90 AC_SUBST(MKSHLIB)
91 AC_SUBST(DSO_LDOPTS)
92 AC_SUBST(DSO_CFLAGS)
93 AC_SUBST(DSO_PIC_CFLAGS)
94
95 #
96 # Using x libraries, set X font directory
97 case "$no_x" in
98 yes)
99         ;;
100 *)
101         X_FONT_DIR="$x_libraries/X11/fonts"
102         AC_DEFINE_UNQUOTED(X_FONT_DIR,$X_FONT_DIR)
103         ;;
104 esac
105 AC_SUBST(X_FONT_DIR)
106
107 #
108 # Check freetype configuration
109 #
110 case "$freetype_config" in
111 no)
112         ;;
113 yes)
114         AC_CHECK_PROG(ft_config,freetype-config,freetype-config,no)
115         ;;
116 *)
117         ft_config="$freetype_config"
118         ;;
119 esac
120
121 case "$freetype_includes" in
122 no)
123         FREETYPE_CFLAGS=""
124         ;;
125 yes)
126         case "$ft_config" in
127         no)
128                 FREETYPE_CFLAGS=""
129                 ;;
130         *)
131                 FREETYPE_CFLAGS="`$ft_config --cflags`"
132                 ;;
133         esac
134         ;;
135 *)
136         FREETYPE_CFLAGS="-I$freetype_includes"
137         ;;
138 esac
139
140 case "$freetype_lib" in
141 no)
142         freetype_lib=""
143         ;;
144 yes)
145         case "$ft_config" in
146         no)
147                 freetype_lib=""
148                 ;;
149         *)
150                 freetype_lib="`$ft_config --libs`"
151                 ;;
152         esac
153         ;;
154 *)
155         freetype_lib="-L$freetype_lib -lfreetype"
156         ;;
157 esac
158
159 saved_LIBS="$LIBS"
160 LIBS="$LIBS $freetype_lib"
161 saved_CPPFLAGS="$CPPFLAGS"
162 CPPFLAGS="$CPPFLAGS $FREETYPE_CFLAGS"
163 AC_CHECK_HEADERS(freetype/freetype.h)
164
165 case "$ac_cv_header_freetype_freetype_h" in
166 no)
167         CPPFLAGS="$saved_CPPFLAGS"
168         LIBS="$saved_LIBS"
169         ;;
170 yes)
171         AC_CHECK_FUNCS(FT_Init_FreeType)
172         case "$ac_cv_func_FT_Init_FreeType" in
173         no)
174                 CPPFLAGS="$saved_CPPFLAGS"
175                 LIBS="$saved_LIBS"
176                 ;;
177         yes)
178                 AC_DEFINE(HAVE_FREETYPE)
179                 AC_SUBST(FREETYPE_CFLAGS)
180                 ;;
181         esac
182         ;;
183 esac
184
185 case "$default_fonts" in
186 yes)
187         FC_DEFAULT_FONTS="/usr/share/fonts"
188         AC_DEFINE_UNQUOTED(FC_DEFAULT_FONTS, "/usr/share/fonts")
189         ;;
190 *)
191         FC_DEFAULT_FONTS="$default_fonts"
192         AC_DEFINE_UNQUOTED(FC_DEFAULT_FONTS, "$default_fonts")
193         ;;
194 esac
195
196 AC_SUBST(FC_DEFAULT_FONTS)
197
198 #
199 # Check expat/libxml2 configuration
200 #
201
202 case "$expat" in
203 maybe)
204         ;;
205 no)
206         xml2=yes
207         ;;
208 *)
209         xml2=no
210         ;;
211 esac
212
213 case "$xml2" in
214 maybe)
215         ;;
216 no)
217         expat=yes
218         ;;
219 *)
220         expat=no
221         ;;
222 esac
223
224 case "$expat" in
225 no)
226         ;;
227 *)
228         case "$expat_includes" in
229         yes|no)
230                 expat_include_path=""
231                 ;;
232         *)
233                 expat_include_path="-I$expat_includes"
234                 ;;
235         esac
236         case "$expat_lib" in
237         yes)
238                 case "$expat" in
239                 yes|maybe)
240                         expat_library="-lexpat"
241                         ;;
242                 *)
243                         expat_library="-L$expat/lib -lexpat"
244                         ;;
245                 esac
246                 ;;
247         no)
248                 ;;
249         *)
250                 expat_library="-L$expat_lib -lexpat"
251                 ;;
252         esac
253
254         saved_CPPFLAGS="$CPPFLAGS"
255         CPPFLAGS="$CPPFLAGS $expat_include_path"
256         saved_LIBS="$LIBS"
257         LIBS="$LIBS $expat_library"
258
259         AC_CHECK_HEADER(expat.h)
260         case "$ac_cv_header_expat_h" in
261         no)
262                 AC_CHECK_HEADER(xmlparse.h)
263                 case "$ac_cv_header_xmlparse_h" in
264                 no)
265                         have_expat_header=no;
266                         ;;
267                 yes)
268                         HAVE_XMLPARSE_H=1
269                         AC_SUBST(HAVE_XMLPARSE_H)
270                         AC_DEFINE_UNQUOTED(HAVE_XMLPARSE_H,$HAVE_XMLPARSE_H)
271                         have_expat_header=yes
272                         ;;
273                 esac
274                 ;;
275         yes)
276                 have_expat_header=yes
277                 ;;
278         esac
279         case "$have_expat_header" in
280         no)
281                 CPPFLAGS="$saved_CPPFLAGS"
282                 LIBS="$saved_LIBS"
283                 expat=no
284                 ;;
285         yes)
286                 AC_CHECK_FUNCS(XML_ParserCreate)
287                 case "$ac_cv_func_XML_ParserCreate" in
288                 no)
289                         CPPFLAGS="$saved_CPPFLAGS"
290                         LIBS="$saved_LIBS"
291                         expat=no
292                         ;;
293                 yes)
294                         HAVE_EXPAT=1
295                         AC_SUBST(HAVE_EXPAT)
296                         AC_DEFINE_UNQUOTED(HAVE_EXPAT,$HAVE_EXPAT)
297                         xml2=no
298                         ;;
299                 esac
300                 ;;
301         esac
302         ;;
303 esac
304         
305 case "$xml2" in
306 no)
307         ;;
308 *)
309         case "$xml2_includes" in
310         yes|no)
311                 xml2_include_path=""
312                 ;;
313         *)
314                 xml2_include_path="-I$xml2_includes"
315                 ;;
316         esac
317         case "$xml2_lib" in
318         yes)
319                 case "$xml2" in
320                 yes|maybe)
321                         xml2_library="-lxml2"
322                         ;;
323                 *)
324                         xml2_library="-L$xml2/lib -lxml2"
325                         ;;
326                 esac
327                 ;;
328         no)
329                 ;;
330         *)
331                 xml2_library="-L$xml2_lib -lxml2"
332                 ;;
333         esac
334
335         saved_CPPFLAGS="$CPPFLAGS"
336         CPPFLAGS="$CPPFLAGS $xml2_include_path"
337         saved_LIBS="$LIBS"
338         LIBS="$LIBS $xml2_library"
339
340         AC_CHECK_HEADER(libxml/parser.h)
341         case "$ac_cv_header_libxml_parser_h" in
342         no)
343                 CPPFLAGS="$saved_CPPFLAGS"
344                 LIBS="$saved_LIBS"
345                 xml2=no
346                 ;;
347         yes)
348                 AC_CHECK_FUNCS(xmlInitParser)
349                 case "$ac_cv_func_xmlInitParser" in
350                 no)
351                         CPPFLAGS="$saved_CPPFLAGS"
352                         LIBS="$saved_LIBS"
353                         xml2=no
354                         ;;
355                 yes)
356                         HAVE_XML2=1
357                         AC_SUBST(HAVE_XML2)
358                         AC_DEFINE_UNQUOTED(HAVE_XML2,$HAVE_XML2)
359                         expat=no
360                         ;;
361                 esac
362                 ;;
363         esac
364         ;;
365 esac
366         
367 case "$expat""$xml2" in
368 nono)
369         AC_MSG_ERROR([cannot find either libxml2 or expat])
370         ;;
371 esac
372
373 AC_OUTPUT([Makefile
374           config/Makedefs
375           src/Makefile
376           fc-cache/Makefile
377           fc-list/Makefile
378           fontconfig/Makefile
379           fontconfig.pc
380           fontconfig-config])
381