]> git.wh0rd.org Git - fontconfig.git/blob - configure.in
Various config changes plus a couple of optimizations from Owen
[fontconfig.git] / configure.in
1 dnl
2 dnl $XFree86: xc/lib/fontconfig/configure.in,v 1.7 2002/08/01 15:57:25 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
27 AC_INIT(fontconfig, 1.0.1, fonts@xfree86.org)
28 AC_CONFIG_AUX_DIR(config)
29 AC_CONFIG_HEADER(config.h)
30
31 AC_ARG_WITH(freetype_includes, [  --with-freetype-includes=DIR  Use FreeType includes in DIR], freetype_includes=$withval, freetype_includes=yes)
32 AC_ARG_WITH(freetype_lib,      [  --with-freetype-lib=DIR       Use FreeType library in DIR], freetype_lib=$withval, freetype_lib=yes)
33 AC_ARG_WITH(freetype_config,   [  --with-freetype-config=PROG   Use FreeType configuration program PROG], freetype_config=$withval, freetype_config=yes)
34 AC_ARG_WITH(expat,             [  --with-expat=DIR              Use Expat in DIR], expat=$withval, expat=yes)
35 AC_ARG_WITH(expat_includes,    [  --with-expat-includes=DIR     Use Expat includes in DIR], expat_includes=$withval, expat_includes=yes)
36 AC_ARG_WITH(expat_lib,         [  --with-expat-lib=DIR          Use Expat library in DIR], expat_lib=$withval, expat_lib=yes)
37 AC_ARG_WITH(default_fonts,     [  --with-default-fonts=DIR      Use fonts from DIR when config is busted], defaultfonts="$withval", default_fonts=yes)
38 AC_ARG_WITH(confdir,           [  --with-confdir=DIR            Use DIR to store configuration files (default /etc/fonts)], confdir="$withval", confdir=yes)
39
40 # Checks for programs.
41 AC_PROG_CC
42 AC_PROG_INSTALL
43 AC_PROG_LN_S
44 AC_PATH_X
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_VERSION)
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     AC_CANONICAL_HOST
84     
85     MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
86     DSO_CFLAGS=''
87     DSO_PIC_CFLAGS='-KPIC -DPIC'
88     
89     case "$host" in
90     *solaris*)
91         DSO_LDOPTS='-G -z text -z defs -h $@'
92         LIBS="$LIBS -lc"
93         ;;
94     *)
95         DSO_LDOPTS='-shared -h $@'
96         ;;
97     esac
98 fi
99
100 AC_SUBST(MKSHLIB)
101 AC_SUBST(DSO_LDOPTS)
102 AC_SUBST(DSO_CFLAGS)
103 AC_SUBST(DSO_PIC_CFLAGS)
104
105 #
106 # Using x libraries, set X font directory
107 case "$no_x" in
108 yes)
109         ;;
110 *)
111         X_FONT_DIR="$x_libraries/X11/fonts"
112         AC_DEFINE_UNQUOTED(X_FONT_DIR,$X_FONT_DIR)
113         ;;
114 esac
115 AC_SUBST(X_FONT_DIR)
116
117 #
118 # Check freetype configuration
119 #
120 case "$freetype_config" in
121 no)
122         ;;
123 yes)
124         AC_CHECK_PROG(ft_config,freetype-config,freetype-config,no)
125         ;;
126 *)
127         ft_config="$freetype_config"
128         ;;
129 esac
130
131 case "$freetype_includes" in
132 no)
133         FREETYPE_CFLAGS=""
134         ;;
135 yes)
136         case "$ft_config" in
137         no)
138                 FREETYPE_CFLAGS=""
139                 ;;
140         *)
141                 FREETYPE_CFLAGS="`$ft_config --cflags`"
142                 ;;
143         esac
144         ;;
145 *)
146         FREETYPE_CFLAGS="-I$freetype_includes"
147         ;;
148 esac
149
150 case "$freetype_lib" in
151 no)
152         freetype_lib=""
153         ;;
154 yes)
155         case "$ft_config" in
156         no)
157                 freetype_lib=""
158                 ;;
159         *)
160                 freetype_lib="`$ft_config --libs`"
161                 ;;
162         esac
163         ;;
164 *)
165         freetype_lib="-L$freetype_lib -lfreetype"
166         ;;
167 esac
168
169 saved_LIBS="$LIBS"
170 LIBS="$LIBS $freetype_lib"
171 saved_CPPFLAGS="$CPPFLAGS"
172 CPPFLAGS="$CPPFLAGS $FREETYPE_CFLAGS"
173 AC_CHECK_HEADERS(freetype/freetype.h)
174
175 case "$ac_cv_header_freetype_freetype_h" in
176 no)
177         CPPFLAGS="$saved_CPPFLAGS"
178         LIBS="$saved_LIBS"
179         ;;
180 yes)
181         AC_CHECK_FUNCS(FT_Init_FreeType)
182         case "$ac_cv_func_FT_Init_FreeType" in
183         no)
184                 CPPFLAGS="$saved_CPPFLAGS"
185                 LIBS="$saved_LIBS"
186                 ;;
187         yes)
188                 AC_DEFINE(HAVE_FREETYPE)
189                 AC_SUBST(FREETYPE_CFLAGS)
190                 ;;
191         esac
192         ;;
193 esac
194
195 case "$default_fonts" in
196 yes)
197         FC_DEFAULT_FONTS="/usr/share/fonts"
198         AC_DEFINE_UNQUOTED(FC_DEFAULT_FONTS, "/usr/share/fonts")
199         ;;
200 *)
201         FC_DEFAULT_FONTS="$default_fonts"
202         AC_DEFINE_UNQUOTED(FC_DEFAULT_FONTS, "$default_fonts")
203         ;;
204 esac
205
206 AC_SUBST(FC_DEFAULT_FONTS)
207
208 #
209 # Set CONFDIR and FONTCONFIG_PATH
210 #
211
212 case "$confdir" in
213 no|yes)
214         confdir=/etc/fonts
215         ;;
216 *)
217         ;;
218 esac
219 AC_SUBST(confdir)
220 CONFDIR='${confdir}'
221 AC_DEFINE_UNQUOTED(CONFDIR, "$CONFDIR")
222 AC_SUBST(CONFDIR)
223
224 #
225 # Check expat configuration
226 #
227
228 case "$expat" in
229 no)
230         ;;
231 *)
232         case "$expat_includes" in
233         yes|no)
234                 expat_include_path=""
235                 ;;
236         *)
237                 expat_include_path="-I$expat_includes"
238                 ;;
239         esac
240         case "$expat_lib" in
241         yes)
242                 case "$expat" in
243                 yes)
244                         expat_library="-lexpat"
245                         ;;
246                 *)
247                         expat_library="-L$expat/lib -lexpat"
248                         ;;
249                 esac
250                 ;;
251         no)
252                 ;;
253         *)
254                 expat_library="-L$expat_lib -lexpat"
255                 ;;
256         esac
257
258         saved_CPPFLAGS="$CPPFLAGS"
259         CPPFLAGS="$CPPFLAGS $expat_include_path"
260         saved_LIBS="$LIBS"
261         LIBS="$LIBS $expat_library"
262
263         AC_CHECK_HEADER(expat.h)
264         case "$ac_cv_header_expat_h" in
265         no)
266                 AC_CHECK_HEADER(xmlparse.h)
267                 case "$ac_cv_header_xmlparse_h" in
268                 no)
269                         have_expat_header=no;
270                         ;;
271                 yes)
272                         HAVE_XMLPARSE_H=1
273                         AC_SUBST(HAVE_XMLPARSE_H)
274                         AC_DEFINE_UNQUOTED(HAVE_XMLPARSE_H,$HAVE_XMLPARSE_H)
275                         have_expat_header=yes
276                         ;;
277                 esac
278                 ;;
279         yes)
280                 have_expat_header=yes
281                 ;;
282         esac
283         case "$have_expat_header" in
284         no)
285                 CPPFLAGS="$saved_CPPFLAGS"
286                 LIBS="$saved_LIBS"
287                 expat=no
288                 ;;
289         yes)
290                 AC_CHECK_FUNCS(XML_ParserCreate)
291                 case "$ac_cv_func_XML_ParserCreate" in
292                 no)
293                         CPPFLAGS="$saved_CPPFLAGS"
294                         LIBS="$saved_LIBS"
295                         expat=no
296                         ;;
297                 yes)
298                         HAVE_EXPAT=1
299                         AC_SUBST(HAVE_EXPAT)
300                         AC_DEFINE_UNQUOTED(HAVE_EXPAT,$HAVE_EXPAT)
301                         ;;
302                 esac
303                 ;;
304         esac
305         ;;
306 esac
307         
308         
309 case "$expat" in
310 no)
311         AC_MSG_ERROR([cannot find expat library])
312         ;;
313 esac
314
315 AC_OUTPUT([Makefile
316           config/Makedefs
317           src/Makefile
318           fc-cache/Makefile
319           fc-list/Makefile
320           fontconfig/Makefile
321           fontconfig.pc
322           fontconfig-config])
323