]> git.wh0rd.org - fontconfig.git/blob - configure.in
Make default confdir point to sysconfdir
[fontconfig.git] / configure.in
1 dnl
2 dnl $Id$
3 dnl
4 dnl Copyright © 2003 Keith Packard
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 dnl Process this file with autoconf to create configure.
25
26 AC_INIT(fonts.dtd)
27
28 dnl ==========================================================================
29 dnl Versioning
30 dnl ==========================================================================
31
32 dnl This is the package version number, not the shared library version number
33 dnl The shared library version lives in fontconfig/fontconfig.h
34 AM_INIT_AUTOMAKE(fontconfig, 2.1.90)
35
36 FONTCONFIG_HEADER=fontconfig/fontconfig.h
37 FONTCONFIG_MAJOR=`awk '/^#define FC_MAJOR/ { print $3 }' $FONTCONFIG_HEADER`
38 FONTCONFIG_MINOR=`awk '/^#define FC_MINOR/ { print $3 }' $FONTCONFIG_HEADER`
39 FONTCONFIG_REVISION=`awk '/^#define FC_REVISION/ { print $3 }' $FONTCONFIG_HEADER`
40
41 AC_SUBST(FONTCONFIG_MAJOR)
42 AC_SUBST(FONTCONFIG_MINOR)
43 AC_SUBST(FONTCONFIG_REVISION)
44
45 dnl libtool versioning
46
47 LT_VERSION_NUMBER="$FONTCONFIG_MAJOR:$FONTCONFIG_MINOR:$FONTCONFIG_REVISION"
48 AC_SUBST(LT_VERSION_NUMBER)
49
50 dnl ==========================================================================
51
52 AM_CONFIG_HEADER(config.h)
53
54 AC_PROG_CC
55 AC_PROG_INSTALL
56 AC_PROG_LN_S
57 AM_PROG_LIBTOOL
58 AC_PROG_MAKE_SET
59
60 # Checks for header files.
61 AC_HEADER_DIRENT
62 AC_HEADER_STDC
63 AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h])
64
65 # Checks for typedefs, structures, and compiler characteristics.
66 AC_C_CONST
67 AC_TYPE_PID_T
68
69 # Checks for library functions.
70 AC_FUNC_VPRINTF
71 AC_CHECK_FUNCS([memmove memset strchr strrchr strtol getopt getopt_long])
72
73 #
74 # Checks for FreeType
75 #
76
77 AC_ARG_WITH(freetype_config, [ --with-freetype-config=PROG Use FreeType configuration program PROG], freetype_config=$withval, freetype_config=yes)
78
79 if test "$freetype_config" = "yes"; then
80 AC_PATH_PROG(ft_config,freetype-config,no)
81 if test "$ft_config" = "no"; then
82 AC_MSG_ERROR([You must have freetype installed; see http://www.freetype.org/])
83 fi
84 else
85 ft_config="$freetype_config"
86 fi
87
88 FREETYPE_CFLAGS="$($ft_config --cflags)"
89 FREETYPE_LIBS="$($ft_config --libs)"
90
91 AC_SUBST(FREETYPE_LIBS)
92 AC_SUBST(FREETYPE_CFLAGS)
93
94 #
95 # Check to see whether we have FT_Get_First_Char(), new in 2.0.9
96 #
97
98 fontconfig_save_libs=$LIBS
99 LIBS="$LIBS $FREETYPE_LIBS"
100 AC_CHECK_FUNCS(FT_Get_First_Char)
101 LIBS=$fontconfig_save_libs
102
103 #
104 # Check expat configuration
105 #
106
107 AC_ARG_WITH(expat, [ --with-expat=DIR Use Expat in DIR], expat=$withval, expat=yes)
108 AC_ARG_WITH(expat_includes, [ --with-expat-includes=DIR Use Expat includes in DIR], expat_includes=$withval, expat_includes=yes)
109 AC_ARG_WITH(expat_lib, [ --with-expat-lib=DIR Use Expat library in DIR], expat_lib=$withval, expat_lib=yes)
110
111 case "$expat" in
112 no)
113 ;;
114 *)
115 case "$expat_includes" in
116 yes|no)
117 EXPAT_CFLAGS=""
118 ;;
119 *)
120 EXPAT_CFLAGS="-I$expat_includes"
121 ;;
122 esac
123 case "$expat_lib" in
124 yes)
125 case "$expat" in
126 yes)
127 EXPAT_LIBS="-lexpat"
128 ;;
129 *)
130 EXPAT_LIBS="-L$expat/lib -lexpat"
131 ;;
132 esac
133 ;;
134 no)
135 ;;
136 *)
137 EXPAT_LIBS="-L$expat_lib -lexpat"
138 ;;
139 esac
140
141 expatsaved_CPPFLAGS="$CPPFLAGS"
142 CPPFLAGS="$CPPFLAGS $EXPAT_CFLAGS"
143 expatsaved_LIBS="$LIBS"
144 LIBS="$LIBS $EXPAT_LIBS"
145
146 AC_CHECK_HEADER(expat.h)
147 case "$ac_cv_header_expat_h" in
148 no)
149 AC_CHECK_HEADER(xmlparse.h)
150 case "$ac_cv_header_xmlparse_h" in
151 no)
152 have_expat_header=no;
153 ;;
154 yes)
155 HAVE_XMLPARSE_H=1
156 AC_SUBST(HAVE_XMLPARSE_H)
157 AC_DEFINE_UNQUOTED(HAVE_XMLPARSE_H,$HAVE_XMLPARSE_H,
158 [Use xmlparse.h instead of expat.h])
159 have_expat_header=yes
160 ;;
161 esac
162 ;;
163 yes)
164 have_expat_header=yes
165 ;;
166 esac
167 case "$have_expat_header" in
168 no)
169 expat=no
170 ;;
171 yes)
172 AC_CHECK_FUNCS(XML_ParserCreate)
173 case "$ac_cv_func_XML_ParserCreate" in
174 no)
175 expat=no
176 ;;
177 yes)
178 HAVE_EXPAT=1
179 AC_SUBST(HAVE_EXPAT)
180 AC_DEFINE_UNQUOTED(HAVE_EXPAT,$HAVE_EXPAT,
181 [Found a useable expat library])
182 ;;
183 esac
184 ;;
185 esac
186 CPPFLAGS="$saved_CPPFLAGS"
187 LIBS="$saved_LIBS"
188 ;;
189 esac
190 AC_SUBST(EXPAT_LIBS)
191 AC_SUBST(EXPAT_CFLAGS)
192
193 case "$expat" in
194 no)
195 AC_MSG_ERROR([cannot find expat library])
196 ;;
197 esac
198
199 #
200 # Set default font directory
201 #
202
203 AC_ARG_WITH(default_fonts, [ --with-default-fonts=DIR Use fonts from DIR when config is busted], defaultfonts="$withval", default_fonts=yes)
204
205 case "$default_fonts" in
206 yes)
207 FC_DEFAULT_FONTS="/usr/share/fonts"
208 AC_DEFINE_UNQUOTED(FC_DEFAULT_FONTS, "/usr/share/fonts",
209 [System font directory])
210 ;;
211 *)
212 FC_DEFAULT_FONTS="$default_fonts"
213 AC_DEFINE_UNQUOTED(FC_DEFAULT_FONTS, "$default_fonts",
214 [System font directory])
215 ;;
216 esac
217
218 AC_SUBST(FC_DEFAULT_FONTS)
219
220 #
221 # Add X fonts if available
222 #
223 AC_ARG_WITH(x_fonts, [ --with-x-fonts=DIR Find X fonts in DIR ], x_fonts="$withval", x_fonts=yes)
224
225 case "$x_fonts" in
226 yes)
227 FC_X_FONTS=""
228 for dir in /usr/X11R6/lib /usr/X11/lib /usr/lib/X11; do
229 case x"$FC_X_FONTS" in
230 x)
231 if test -d "$dir/fonts"; then
232 FC_X_FONTS="$dir/fonts"
233 fi
234 ;;
235 esac
236 done
237 AC_DEFINE_UNQUOTED(FC_X_FONTS,"$x_fonts",[X font directory])
238 ;;
239 no)
240 FC_X_FONTS=""
241 ;;
242 *)
243 FC_X_FONTS="$x_fonts"
244 AC_DEFINE_UNQUOTED(FC_X_FONTS,"$x_fonts",[X font directory])
245 ;;
246 esac
247
248 AC_SUBST(FC_X_FONTS)
249
250 FC_FONTPATH=""
251
252 case "$FC_X_FONTS" in
253 "")
254 ;;
255 *)
256 FC_FONTPATH="<dir>$FC_X_FONTS</dir>"
257 ;;
258 esac
259
260 AC_SUBST(FC_FONTPATH)
261
262 FC_FONTDATE=`date`
263
264 AC_SUBST(FC_FONTDATE)
265
266 AC_ARG_WITH(confdir, [ --with-confdir=DIR Use DIR to store configuration files (default /etc/fonts)], confdir="$withval", confdir=yes)
267
268 #
269 # Set CONFDIR and FONTCONFIG_PATH
270 #
271
272 case "$confdir" in
273 no|yes)
274 confdir='${sysconfdir}'/fonts
275 ;;
276 *)
277 ;;
278 esac
279 AC_SUBST(confdir)
280 CONFDIR=${confdir}
281 AC_DEFINE_UNQUOTED(CONFDIR, "$CONFDIR",[Font configuration directory])
282 AC_SUBST(CONFDIR)
283
284 #
285 # Find out what language orthographies are included
286 #
287
288 ORTH_FILES=`cd fc-lang && echo *.orth`
289 AC_SUBST(ORTH_FILES)
290
291 #
292 # Let people not build/install docs if they don't have docbook
293 #
294
295 AC_CHECK_PROG(HASDOCBOOK, docbook2html, yes, no)
296
297 AC_ARG_ENABLE(docs, [ --disable-docs Don't build and install documentation],,enable_docs=yes)
298
299 if test "x$enable_docs" = xyes; then
300 if test "x$HASDOCBOOK" != xyes; then
301 enable_docs=no
302 fi
303 fi
304
305 AM_CONDITIONAL(ENABLE_DOCS, test "x$enable_docs" = xyes)
306
307 #
308 # Figure out where to install documentation
309 #
310
311 AC_ARG_WITH(docdir, [ --with-docdir=DIR Use DIR to store documentation files (default ${datadir}/doc/fontconfig)], confdir="$withval")
312
313 if test "x$with_docdir" = "x" ; then
314 DOCDIR='${datadir}/doc/fontconfig'
315 else
316 DOCDIR=$with_docdir
317 fi
318
319 AC_SUBST(DOCDIR)
320
321 AC_OUTPUT([
322 Makefile
323 fontconfig/Makefile
324 fc-lang/Makefile
325 src/Makefile
326 fc-cache/Makefile
327 fc-list/Makefile
328 doc/Makefile
329 test/Makefile
330 fontconfig.spec
331 fontconfig.pc
332 fonts.conf
333 ])