]> git.wh0rd.org Git - fontconfig.git/blob - configure.in
add shared library support for Tru64 UNIX and IRIX (bug #14)
[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    *irix6*)
95         DSO_LDOPTS='-shared -rpath $(libdir) -set_version sgi1.0 -soname $@'
96         LIBS="$LIBS -lc"
97         ;;
98     *osf[[123]]*)
99         # since the library is using soname-style versioning, don't use
100         # internal versioning, via -set_version.
101         DSO_LDOPTS='-shared -rpath $(libdir) -soname $@'
102         LIBS="$LIBS -lc"
103         ;;
104     *osf[[45]]*)
105         # since the library is using soname-style versioning, don't use
106         # internal versioning, via -set_version.
107         DSO_LDOPTS='-shared -msym -rpath $(libdir) -soname $@'
108         LIBS="$LIBS -lc"
109         ;;
110     *)
111         DSO_LDOPTS='-shared -h $@'
112         ;;
113     esac
114 fi
115
116 AC_SUBST(MKSHLIB)
117 AC_SUBST(DSO_LDOPTS)
118 AC_SUBST(DSO_CFLAGS)
119 AC_SUBST(DSO_PIC_CFLAGS)
120
121 #
122 # Using x libraries, set X font directory
123 case "$no_x" in
124 yes)
125         ;;
126 *)
127         X_FONT_DIR="$x_libraries/X11/fonts"
128         AC_DEFINE_UNQUOTED(X_FONT_DIR,$X_FONT_DIR)
129         ;;
130 esac
131 AC_SUBST(X_FONT_DIR)
132
133 #
134 # Check freetype configuration
135 #
136 case "$freetype_config" in
137 no)
138         ;;
139 yes)
140         AC_CHECK_PROG(ft_config,freetype-config,freetype-config,no)
141         ;;
142 *)
143         ft_config="$freetype_config"
144         ;;
145 esac
146
147 case "$freetype_includes" in
148 no)
149         FREETYPE_CFLAGS=""
150         ;;
151 yes)
152         case "$ft_config" in
153         no)
154                 FREETYPE_CFLAGS=""
155                 ;;
156         *)
157                 FREETYPE_CFLAGS="`$ft_config --cflags`"
158                 ;;
159         esac
160         ;;
161 *)
162         FREETYPE_CFLAGS="-I$freetype_includes"
163         ;;
164 esac
165
166 case "$freetype_lib" in
167 no)
168         freetype_lib=""
169         ;;
170 yes)
171         case "$ft_config" in
172         no)
173                 freetype_lib=""
174                 ;;
175         *)
176                 freetype_lib="`$ft_config --libs`"
177                 ;;
178         esac
179         ;;
180 *)
181         freetype_lib="-L$freetype_lib -lfreetype"
182         ;;
183 esac
184
185 saved_LIBS="$LIBS"
186 LIBS="$LIBS $freetype_lib"
187 saved_CPPFLAGS="$CPPFLAGS"
188 CPPFLAGS="$CPPFLAGS $FREETYPE_CFLAGS"
189 AC_CHECK_HEADERS(freetype/freetype.h)
190
191 case "$ac_cv_header_freetype_freetype_h" in
192 no)
193         CPPFLAGS="$saved_CPPFLAGS"
194         LIBS="$saved_LIBS"
195         ;;
196 yes)
197         AC_CHECK_FUNCS(FT_Init_FreeType)
198         case "$ac_cv_func_FT_Init_FreeType" in
199         no)
200                 CPPFLAGS="$saved_CPPFLAGS"
201                 LIBS="$saved_LIBS"
202                 ;;
203         yes)
204                 AC_DEFINE(HAVE_FREETYPE)
205                 AC_SUBST(FREETYPE_CFLAGS)
206                 ;;
207         esac
208         ;;
209 esac
210
211 case "$default_fonts" in
212 yes)
213         FC_DEFAULT_FONTS="/usr/share/fonts"
214         AC_DEFINE_UNQUOTED(FC_DEFAULT_FONTS, "/usr/share/fonts")
215         ;;
216 *)
217         FC_DEFAULT_FONTS="$default_fonts"
218         AC_DEFINE_UNQUOTED(FC_DEFAULT_FONTS, "$default_fonts")
219         ;;
220 esac
221
222 AC_SUBST(FC_DEFAULT_FONTS)
223
224 #
225 # Set CONFDIR and FONTCONFIG_PATH
226 #
227
228 case "$confdir" in
229 no|yes)
230         confdir=/etc/fonts
231         ;;
232 *)
233         ;;
234 esac
235 AC_SUBST(confdir)
236 CONFDIR='${confdir}'
237 AC_DEFINE_UNQUOTED(CONFDIR, "$CONFDIR")
238 AC_SUBST(CONFDIR)
239
240 #
241 # Check expat configuration
242 #
243
244 case "$expat" in
245 no)
246         ;;
247 *)
248         case "$expat_includes" in
249         yes|no)
250                 expat_include_path=""
251                 ;;
252         *)
253                 expat_include_path="-I$expat_includes"
254                 ;;
255         esac
256         case "$expat_lib" in
257         yes)
258                 case "$expat" in
259                 yes)
260                         expat_library="-lexpat"
261                         ;;
262                 *)
263                         expat_library="-L$expat/lib -lexpat"
264                         ;;
265                 esac
266                 ;;
267         no)
268                 ;;
269         *)
270                 expat_library="-L$expat_lib -lexpat"
271                 ;;
272         esac
273
274         saved_CPPFLAGS="$CPPFLAGS"
275         CPPFLAGS="$CPPFLAGS $expat_include_path"
276         saved_LIBS="$LIBS"
277         LIBS="$LIBS $expat_library"
278
279         AC_CHECK_HEADER(expat.h)
280         case "$ac_cv_header_expat_h" in
281         no)
282                 AC_CHECK_HEADER(xmlparse.h)
283                 case "$ac_cv_header_xmlparse_h" in
284                 no)
285                         have_expat_header=no;
286                         ;;
287                 yes)
288                         HAVE_XMLPARSE_H=1
289                         AC_SUBST(HAVE_XMLPARSE_H)
290                         AC_DEFINE_UNQUOTED(HAVE_XMLPARSE_H,$HAVE_XMLPARSE_H)
291                         have_expat_header=yes
292                         ;;
293                 esac
294                 ;;
295         yes)
296                 have_expat_header=yes
297                 ;;
298         esac
299         case "$have_expat_header" in
300         no)
301                 CPPFLAGS="$saved_CPPFLAGS"
302                 LIBS="$saved_LIBS"
303                 expat=no
304                 ;;
305         yes)
306                 AC_CHECK_FUNCS(XML_ParserCreate)
307                 case "$ac_cv_func_XML_ParserCreate" in
308                 no)
309                         CPPFLAGS="$saved_CPPFLAGS"
310                         LIBS="$saved_LIBS"
311                         expat=no
312                         ;;
313                 yes)
314                         HAVE_EXPAT=1
315                         AC_SUBST(HAVE_EXPAT)
316                         AC_DEFINE_UNQUOTED(HAVE_EXPAT,$HAVE_EXPAT)
317                         ;;
318                 esac
319                 ;;
320         esac
321         ;;
322 esac
323         
324         
325 case "$expat" in
326 no)
327         AC_MSG_ERROR([cannot find expat library])
328         ;;
329 esac
330
331 AC_OUTPUT([Makefile
332           config/Makedefs
333           fc-lang/Makefile
334           src/Makefile
335           fc-cache/Makefile
336           fc-list/Makefile
337           fontconfig/Makefile
338           fontconfig.pc
339           fontconfig-config])
340