2 dnl $XFree86: xc/lib/fontconfig/configure.in,v 1.2 2002/05/21 17:08:42 keithp Exp $
4 dnl Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc.
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.
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.
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)
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)
41 # Checks for programs.
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_MAJOR)
54 AC_SUBST(PACKAGE_MINOR)
55 AC_SUBST(PACKAGE_REVISION)
60 AC_DEFINE_UNQUOTED(PACKAGE_MAJOR,$PACKAGE_MAJOR)
61 AC_DEFINE_UNQUOTED(PACKAGE_MINOR,$PACKAGE_MINOR)
62 AC_DEFINE_UNQUOTED(PACKAGE_REVISION,$PACKAGE_REVISION)
64 # Checks for header files.
67 AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h])
69 # Checks for typedefs, structures, and compiler characteristics.
73 # Checks for library functions.
75 AC_CHECK_FUNCS([memmove memset strchr strrchr strtol getopt getopt_long])
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/'"'`'
81 DSO_PIC_CFLAGS='-fPIC -DPIC'
83 MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
84 DSO_LDOPTS='-shared -h $@'
86 DSO_PIC_CFLAGS='-KPIC -DPIC'
92 AC_SUBST(DSO_PIC_CFLAGS)
95 # Using x libraries, set X font directory
100 X_FONT_DIR="$x_libraries/X11/fonts"
101 AC_DEFINE_UNQUOTED(X_FONT_DIR,$X_FONT_DIR)
107 # Check freetype configuration
109 case "$freetype_config" in
113 AC_CHECK_PROG(ft_config,freetype-config,freetype-config,no)
116 ft_config="$freetype_config"
120 case "$freetype_includes" in
130 freetype_includes="`$ft_config --cflags`"
135 freetype_includes="-I$freetype_includes"
139 case "$freetype_lib" in
149 freetype_lib="`$ft_config --libs`"
154 freetype_lib="-L$freetype_lib -lfreetype"
159 LIBS="$LIBS $freetype_lib"
160 saved_CPPFLAGS="$CPPFLAGS"
161 CPPFLAGS="$CPPFLAGS $freetype_includes"
162 AC_CHECK_HEADERS(freetype/freetype.h)
164 case "$ac_cv_header_freetype_freetype_h" in
166 CPPFLAGS="$saved_CPPFLAGS"
170 AC_CHECK_FUNCS(FT_Init_FreeType)
171 case "$ac_cv_func_FT_Init_FreeType" in
173 CPPFLAGS="$saved_CPPFLAGS"
177 AC_DEFINE(HAVE_FREETYPE)
183 case "$default_fonts" in
185 FC_DEFAULT_FONTS="/usr/share/fonts"
186 AC_DEFINE_UNQUOTED(FC_DEFAULT_FONTS, "/usr/share/fonts")
189 FC_DEFAULT_FONTS="$default_fonts"
190 AC_DEFINE_UNQUOTED(FC_DEFAULT_FONTS, "$default_fonts")
194 AC_SUBST(FC_DEFAULT_FONTS)
197 # Check expat/libxml2 configuration
226 case "$expat_includes" in
228 expat_include_path=""
231 expat_include_path="-I$expat_includes"
238 expat_library="-lexpat"
241 expat_library="-L$expat/lib -lexpat"
248 expat_library="-L$expat_lib -lexpat"
252 saved_CPPFLAGS="$CPPFLAGS"
253 CPPFLAGS="$CPPFLAGS $expat_include_path"
255 LIBS="$LIBS $expat_library"
257 AC_CHECK_HEADER(expat.h)
258 case "$ac_cv_header_expat_h" in
260 AC_CHECK_HEADER(xmlparse.h)
261 case "$ac_cv_header_xmlparse_h" in
263 have_expat_header=no;
267 AC_SUBST(HAVE_XMLPARSE_H)
268 AC_DEFINE_UNQUOTED(HAVE_XMLPARSE_H,$HAVE_XMLPARSE_H)
269 have_expat_header=yes
274 have_expat_header=yes
277 case "$have_expat_header" in
279 CPPFLAGS="$saved_CPPFLAGS"
284 AC_CHECK_FUNCS(XML_ParserCreate)
285 case "$ac_cv_func_XML_ParserCreate" in
287 CPPFLAGS="$saved_CPPFLAGS"
294 AC_DEFINE_UNQUOTED(HAVE_EXPAT,$HAVE_EXPAT)
307 case "$xml2_includes" in
312 xml2_include_path="-I$xml2_includes"
319 xml2_library="-lxml2"
322 xml2_library="-L$xml2/lib -lxml2"
329 xml2_library="-L$xml2_lib -lxml2"
333 saved_CPPFLAGS="$CPPFLAGS"
334 CPPFLAGS="$CPPFLAGS $xml2_include_path"
336 LIBS="$LIBS $xml2_library"
338 AC_CHECK_HEADER(libxml/parser.h)
339 case "$ac_cv_header_libxml_parser_h" in
341 CPPFLAGS="$saved_CPPFLAGS"
346 AC_CHECK_FUNCS(xmlInitParser)
347 case "$ac_cv_func_xmlInitParser" in
349 CPPFLAGS="$saved_CPPFLAGS"
356 AC_DEFINE_UNQUOTED(HAVE_XML2,$HAVE_XML2)
365 case "$expat""$xml2" in
367 AC_MSG_ERROR([cannot find either libxml2 or expat])
376 fontconfig/Makefile])