Git init
[framework/uifw/xorg/lib/libxfont.git] / configure.ac
1 dnl  Copyright © 2003 Keith Packard
2 dnl 
3 dnl  Permission to use, copy, modify, distribute, and sell this software and its
4 dnl  documentation for any purpose is hereby granted without fee, provided that
5 dnl  the above copyright notice appear in all copies and that both that
6 dnl  copyright notice and this permission notice appear in supporting
7 dnl  documentation, and that the name of Keith Packard not be used in
8 dnl  advertising or publicity pertaining to distribution of the software without
9 dnl  specific, written prior permission.  Keith Packard makes no
10 dnl  representations about the suitability of this software for any purpose.  It
11 dnl  is provided "as is" without express or implied warranty.
12 dnl 
13 dnl  KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
14 dnl  INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
15 dnl  EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
16 dnl  CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
17 dnl  DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 dnl  TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 dnl  PERFORMANCE OF THIS SOFTWARE.
20 dnl
21 dnl Process this file with autoconf to create configure.
22
23 AC_PREREQ([2.60])
24
25 AC_INIT([libXfont],
26         [1.4.3],
27         [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
28         libXfont)
29 # Autoheader generates config.h.in. No new lines allowed in the list.
30 AC_CONFIG_HEADERS([config.h include/X11/fonts/fontconf.h])
31 dnl
32 dnl This is the package version number, not the shared library
33 dnl version.  This same version number must appear in Xfont.h
34 dnl Yes, it is a pain to synchronize version numbers.  Unfortunately, it's
35 dnl not possible to extract the version number here from Xfont.h
36 dnl
37 AM_INIT_AUTOMAKE([foreign dist-bzip2])
38 AM_MAINTAINER_MODE
39
40 # Require xorg-macros minimum of 1.10 for DocBook XML documentation
41 m4_ifndef([XORG_MACROS_VERSION],
42           [m4_fatal([must install xorg-macros 1.10 or later before running autoconf/autogen])])
43 XORG_MACROS_VERSION(1.10)
44 XORG_DEFAULT_OPTIONS
45 XORG_ENABLE_DEVEL_DOCS
46 XORG_WITH_XMLTO(0.0.20)
47 XORG_WITH_FOP
48 XORG_CHECK_SGML_DOCTOOLS(1.5)
49
50 # Check for progs
51 AC_PROG_CC
52 AC_PROG_LIBTOOL
53 dnl If the first PKG_CHECK_MODULES appears inside a conditional, pkg-config
54 dnl must first be located explicitly.
55 PKG_PROG_PKG_CONFIG
56
57 # Look for headers
58 AC_CHECK_HEADERS([endian.h poll.h sys/poll.h])
59 AC_CHECK_FUNCS([poll])
60
61 #
62 # select libraries to include
63 #
64
65 XFONT_FONTFILE=no
66
67 #
68 # Scalable fonts in files:
69 #       FreeType
70 #       Bitstream Speedo rasterizer
71 #
72 AC_ARG_ENABLE(freetype, [ --disable-freetype],[XFONT_FREETYPE=$enableval],[XFONT_FREETYPE=yes])
73 AM_CONDITIONAL(XFONT_FREETYPE, [test x$XFONT_FREETYPE = xyes])
74 if test x$XFONT_FREETYPE = xyes; then
75         AC_DEFINE(XFONT_FREETYPE,1,[Support FreeType rasterizer for nearly all font file formats])
76         AC_ARG_WITH(freetype-config, [  --with-freetype-config=PROG   Use FreeType configuration program PROG], freetype_config=$withval, freetype_config=auto)
77         
78         if test "$freetype_config" = "auto" ; then
79                 PKG_CHECK_MODULES(FREETYPE, freetype2, 
80                         freetype_config=no, freetype_config=yes)
81         fi
82
83         if test "$freetype_config" = "yes"; then 
84                 AC_PATH_PROG(ft_config,freetype-config,no)
85                 if test "$ft_config" = "no"; then
86                         AC_MSG_ERROR([You must have freetype installed; see http://www.freetype.org/])
87                 fi
88         else
89                 ft_config="$freetype_config"
90         fi
91
92         if test "$freetype_config" != "no"; then        
93                 FREETYPE_CFLAGS="`$ft_config --cflags`"
94                 FREETYPE_LIBS="`$ft_config --libs`"
95         fi
96         FREETYPE_REQUIRES="freetype2"
97         XFONT_FONTFILE=yes
98 else
99         FREETYPE_CFLAGS=""
100         FREETYPE_LIBS=""
101         FREETYPE_REQUIRES=""
102 fi
103 AC_SUBST(FREETYPE_LIBS)
104 AC_SUBST(FREETYPE_CFLAGS)
105 AC_SUBST(FREETYPE_REQUIRES)
106
107 #
108 # Bitmap fonts in files:
109 #       Builtins (gzipped pcf format in .text segment)
110 #       PCF
111 #       BDF
112 #       SNF
113 #
114
115 AC_DEFINE(X_GZIP_FONT_COMPRESSION,1,[Support gzip for bitmap fonts])
116 X_GZIP_FONT_COMPRESSION=1
117 AC_SUBST(X_GZIP_FONT_COMPRESSION)
118 AC_CHECK_LIB(z, gzopen, [Z_LIBS=-lz], AC_MSG_ERROR([*** zlib is required]))
119
120 AC_ARG_WITH(bzip2, 
121         AS_HELP_STRING([--with-bzip2], 
122                         [Support bzip2 compressed bitmap fonts]),
123         [], [with_bzip2=no])
124 if test "x$with_bzip2" = xyes; then
125         AC_CHECK_LIB(bz2, BZ2_bzopen, [Z_LIBS="$Z_LIBS -lbz2"],
126                 AC_MSG_ERROR([*** libbz2 is required for bzip2 support]))
127         AC_DEFINE(X_BZIP2_FONT_COMPRESSION,1,[Support bzip2 for bitmap fonts])
128 fi
129 AM_CONDITIONAL(X_BZIP2_FONT_COMPRESSION, [test "x$with_bzip2" = xyes ])
130 AC_SUBST(Z_LIBS)
131
132 AC_ARG_ENABLE(builtins, [ --disable-builtins ], [XFONT_BUILTINS=$enableval], [XFONT_BUILTINS=yes])
133 AM_CONDITIONAL(XFONT_BUILTINS, [test "x$XFONT_BUILTINS" = xyes ])
134 if test "x$XFONT_BUILTINS" = xyes; then
135         AC_DEFINE(XFONT_BUILTINS,1,[Support built-in fonts])
136         XFONT_BITMAP=yes
137 fi
138
139 AC_ARG_ENABLE(pcfformat, [ --disable-pcfformat ], [XFONT_PCFFORMAT=$enableval], [XFONT_PCFFORMAT=yes])
140 AM_CONDITIONAL(XFONT_PCFFORMAT, [test "x$XFONT_PCFFORMAT" = xyes])
141 if test "x$XFONT_PCFFORMAT" = xyes; then
142         AC_DEFINE(XFONT_PCFFORMAT,1,[Support pcf format bitmap font files])
143         XFONT_BITMAP=yes
144 fi
145
146 AC_ARG_ENABLE(bdfformat, [ --disable-bdfformat ], [XFONT_BDFFORMAT=$enableval], [XFONT_BDFFORMAT=yes])
147 AM_CONDITIONAL(XFONT_BDFFORMAT, [test "x$XFONT_BDFFORMAT" = xyes])
148 if test "x$XFONT_BDFFORMAT" = xyes; then
149         AC_DEFINE(XFONT_BDFFORMAT,1,[Support bdf format bitmap font files])
150         XFONT_BITMAP=yes
151 fi
152
153 AC_ARG_ENABLE(snfformat, [ --disable-snfformat ], [XFONT_SNFFORMAT=$enableval], [XFONT_SNFFORMAT=yes])
154 AM_CONDITIONAL(XFONT_SNFFORMAT, [test "x$XFONT_SNFFORMAT" = xyes])
155 if test "x$XFONT_SNFFORMAT" = xyes; then
156         AC_DEFINE(XFONT_SNFFORMAT,1,[Support snf format bitmap font files])
157         XFONT_BITMAP=yes
158 fi
159
160 AM_CONDITIONAL(XFONT_BITMAP, [test "x$XFONT_BITMAP" = xyes ])
161 if test "x$XFONT_BITMAP" = xyes; then
162         AC_DEFINE(XFONT_BITMAP,1,[Support bitmap font files])
163         XFONT_FONTFILE=yes
164 fi
165
166 AM_CONDITIONAL(XFONT_FONTFILE, [test "x$XFONT_FONTFILE" = xyes])
167 if test "x$XFONT_FONTFILE" = xyes; then
168         AC_DEFINE(XFONT_FONTFILE,1,[Support fonts in files])
169 fi
170
171 #
172 # Support connection to font servers?
173 #
174
175 AC_ARG_ENABLE(fc, [ --disable-fc ],[XFONT_FC=$enableval],[XFONT_FC=yes])
176 AM_CONDITIONAL(XFONT_FC, [test "x$XFONT_FC" = xyes])
177 if test "x$XFONT_FC" = xyes; then
178         AC_DEFINE(XFONT_FC,1,[Support the X Font Services Protocol])
179 fi
180
181
182 AC_CHECK_LIB(m, hypot, [MATH_LIBS=-lm
183 AC_SUBST(MATH_LIBS)], AC_MSG_ERROR([*** libm is required]))
184
185 PKG_CHECK_MODULES(XFONT, xproto xtrans fontsproto fontenc)
186
187 # Transport selection macro from xtrans.m4
188 XTRANS_CONNECTION_FLAGS
189
190 case $host_os in
191     linux*)
192         OS_CFLAGS="-D_XOPEN_SOURCE"
193         ;;
194     darwin*)
195         OS_CFLAGS="-Wl,-flat_namespace"
196         ;;
197     *)
198         OS_CFLAGS=
199         ;;
200 esac
201 AC_SUBST([OS_CFLAGS])
202
203 AC_OUTPUT([Makefile
204            doc/Makefile
205            src/Makefile
206            src/fontfile/Makefile
207            src/FreeType/Makefile
208            src/builtins/Makefile
209            src/bitmap/Makefile
210            src/fc/Makefile
211            src/util/Makefile
212            src/stubs/Makefile
213            xfont.pc])