summaryrefslogtreecommitdiff
path: root/configure.in
blob: e90780405e7308f2658209209dd4a9a498791c2c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
AC_INIT(src/cairo.h)

dnl ===========================================================================

# Package version number, (as distinct from shared library version)
CAIRO_VERSION=0.2.0

# libtool shared library version

# Increment if the interface has additions, changes, removals.
LT_CURRENT=1

# Increment any time the source changes; set to
# 0 if you increment CURRENT
LT_REVISION=0

# Increment if any interfaces have been added; set to 0
# if any interfaces have been removed. removal has
# precedence over adding, so set to 0 if both happened.
LT_AGE=0

VERSION_INFO="$LT_CURRENT:$LT_REVISION:$LT_AGE"
AC_SUBST(VERSION_INFO)

dnl ===========================================================================

AM_INIT_AUTOMAKE(cairo, $CAIRO_VERSION)
AM_CONFIG_HEADER(config.h)

AM_MAINTAINER_MODE

AC_PROG_CC
AC_PROG_CPP
AM_PROG_LIBTOOL
AC_STDC_HEADERS

dnl ===========================================================================

AC_ARG_ENABLE(xlib,
  [  --disable-xlib          Disable cairo's Xlib backend],
  [use_xlib=$enableval], [use_xlib=yes])

if test "x$use_xlib" = "xyes"; then
  dnl Check for Xrender header files if the Xrender package is not installed:
  PKG_CHECK_MODULES(XRENDER, xrender >= 0.6, [
    XRENDER_REQUIRES=xrender
    use_xlib=yes], [
      AC_CHECK_HEADER(X11/extensions/Xrender.h, [
      AC_PATH_XTRA
      XRENDER_LIBS="$X_LIBS -lXrender -lXext -lX11 $X_EXTRA_LIBS"
      use_xlib=yes], [
		use_xlib="no (requires Xrender http://freedesktop.org/software/xlibs)"])])
fi

if test "x$use_xlib" != "xyes"; then
  XLIB_SURFACE_FEATURE=CAIRO_HAS_NO_XLIB_SURFACE
  AM_CONDITIONAL(CAIRO_HAS_XLIB_SURFACE, false)
else
  XLIB_SURFACE_FEATURE=CAIRO_HAS_XLIB_SURFACE
  AM_CONDITIONAL(CAIRO_HAS_XLIB_SURFACE, true)
fi

CAIRO_CFLAGS="$CAIRO_CFLAGS $XRENDER_CFLAGS"
CAIRO_LIBS="$CAIRO_LIBS $XRENDER_LIBS"

AC_SUBST(XLIB_SURFACE_FEATURE)
AC_SUBST(XRENDER_REQUIRES)

dnl ===========================================================================

AC_ARG_ENABLE(xcb,
  [  --disable-xcb           Disable cairo's XCB backend],
  [use_xcb=$enableval], [use_xcb=yes])

if test "x$use_xcb" = "xyes"; then
  PKG_CHECK_MODULES(XCB, xcb, [use_xcb=yes], [
  use_xcb="no (requires XCB http://freedesktop.org/software/xcb)"])
fi

if test "x$use_xcb" != "xyes"; then
  XCB_SURFACE_FEATURE=CAIRO_HAS_NO_XCB_SURFACE
  AM_CONDITIONAL(CAIRO_HAS_XCB_SURFACE, false)
else
  XCB_SURFACE_FEATURE=CAIRO_HAS_XCB_SURFACE
  AM_CONDITIONAL(CAIRO_HAS_XCB_SURFACE, true)
fi

CAIRO_CFLAGS="$CAIRO_CFLAGS $XCB_CFLAGS"
CAIRO_LIBS="$CAIRO_LIBS $XCB_LIBS"

AC_SUBST(XCB_SURFACE_FEATURE)

dnl ===========================================================================

AC_ARG_ENABLE(ps,
  [  --disable-ps            Disable cairo's PostScript backend],
  [use_ps=$enableval], [use_ps=yes])

if test "x$use_ps" != "xyes"; then
  PS_SURFACE_FEATURE=CAIRO_HAS_NO_PS_SURFACE
  AM_CONDITIONAL(CAIRO_HAS_PS_SURFACE, false)
else
  PS_SURFACE_FEATURE=CAIRO_HAS_PS_SURFACE
  PS_LIBS=-lz
  AM_CONDITIONAL(CAIRO_HAS_PS_SURFACE, true)
fi

CAIRO_LIBS="$CAIRO_LIBS $PS_LIBS"

AC_SUBST(PS_SURFACE_FEATURE)
AC_SUBST(PS_LIBS)

dnl ===========================================================================

AC_ARG_ENABLE(png,
  [  --disable-png           Disable cairo's PNG backend],
  [use_png=$enableval], [use_png=yes])

if test "x$use_png" = "xyes"; then
  PKG_CHECK_MODULES(PNG, libpng12, [
    PNG_REQUIRES=libpng12
    use_png=yes], [
      PKG_CHECK_MODULES(PNG, libpng10, [
      PNG_REQUIRES=libpng10
      use_png=yes], [use_png="no (requires libpng http://www.libpng.org)"])])
fi

if test "x$use_png" != "xyes"; then
  PNG_SURFACE_FEATURE=CAIRO_HAS_NO_PNG_SURFACE
  AM_CONDITIONAL(CAIRO_HAS_PNG_SURFACE, false)
else
  PNG_SURFACE_FEATURE=CAIRO_HAS_PNG_SURFACE
  AM_CONDITIONAL(CAIRO_HAS_PNG_SURFACE, true)
fi

CAIRO_CFLAGS="$CAIRO_CFLAGS $PNG_CFLAGS"
CAIRO_LIBS="$CAIRO_LIBS $PNG_LIBS"

AC_SUBST(PNG_SURFACE_FEATURE)
AC_SUBST(PNG_REQUIRES)

dnl ===========================================================================

AC_ARG_ENABLE(glitz,
  [  --disable-glitz         Disable cairo's glitz backend],
  [use_glitz=$enableval], [use_glitz=yes])

if test "x$use_glitz" = "xyes"; then
  PKG_CHECK_MODULES(GLITZ, glitz >= 0.3.0, [
    GLITZ_REQUIRES=glitz
    use_glitz=yes], [use_glitz="no (requires glitz http://freedesktop.org/software/glitz)"])
fi

if test "x$use_glitz" != "xyes"; then
  GLITZ_SURFACE_FEATURE=CAIRO_HAS_NO_GLITZ_SURFACE
  AM_CONDITIONAL(CAIRO_HAS_GLITZ_SURFACE, false)  
else
  GLITZ_SURFACE_FEATURE=CAIRO_HAS_GLITZ_SURFACE
  AM_CONDITIONAL(CAIRO_HAS_GLITZ_SURFACE, true)
fi

CAIRO_CFLAGS="$CAIRO_CFLAGS $GLITZ_CFLAGS"
CAIRO_LIBS="$CAIRO_LIBS $GLITZ_LIBS"

AC_SUBST(GLITZ_SURFACE_FEATURE)
AC_SUBST(GLITZ_REQUIRES)

dnl ===========================================================================

AC_ARG_ENABLE(sanity-checking,
  [  --disable-sanity        Disable cairo's sanity checking routines],
  [check_sanity=$enableval], [check_sanity=yes])

if test "x$check_sanity" != "xyes"; then
  SANITY_CHECKING_FEATURE=CAIRO_NO_SANITY_CHECKING
else
  SANITY_CHECKING_FEATURE=CAIRO_DO_SANITY_CHECKING
fi

AC_SUBST(SANITY_CHECKING_FEATURE)

dnl ===========================================================================

PKG_CHECK_MODULES(FONTCONFIG, fontconfig)
CAIRO_CFLAGS="$CAIRO_CFLAGS $FONTCONFIG_CFLAGS"
CAIRO_LIBS="$CAIRO_LIBS $FONTCONFIG_LIBS"

PKG_CHECK_MODULES(PIXMAN, libpixman >= 0.1.2)
CAIRO_CFLAGS="$CAIRO_CFLAGS $PIXMAN_CFLAGS"
CAIRO_LIBS="$CAIRO_LIBS $PIXMAN_LIBS"

# Test for freetype2 separate from pkg-config since at least up to
# 2003-06-07, there was no freetype2.pc in the release.
#
# Freetype versions come in three forms:
#   release (such as 2.1.5)
#   libtool (such as 9.4.3) (returned by freetype-config)
#   platform-specific/soname (such as 6.3.4)
# and they recommend you never use the platform-specific version
# (see docs/VERSION.DLL in freetype2 sources)
#
# Set these as appropriate:

# release number - for information only
FREETYPE_MIN_RELEASE=2.1.0
# libtool-specific version - this is what is checked
FREETYPE_MIN_VERSION=8.0.2

if test -z "$FREETYPE_CONFIG"; then
  AC_PATH_PROG(FREETYPE_CONFIG, freetype-config, no)
fi
if test "$FREETYPE_CONFIG" = "no" ; then
  AC_MSG_ERROR(No freetype-config script found in path or FREETYPE_CONFIG)
fi

AC_MSG_CHECKING(freetype2 libtool version)

FREETYPE_VERSION=`$FREETYPE_CONFIG --version`

VERSION_DEC=`echo $FREETYPE_VERSION | awk -F. '{printf("%d\n", 10000*$1 + 100*$2 + $3)};'`
MIN_VERSION_DEC=`echo $FREETYPE_MIN_VERSION | awk -F. '{printf("%d\n", 10000*$1 + 100*$2 + $3)};'`
if test $VERSION_DEC -lt $MIN_VERSION_DEC; then
  AC_MSG_ERROR($FREETYPE_VERSION - version $FREETYPE_MIN_VERSION from release $FREETYPE_MIN_RELEASE required)
fi
AC_MSG_RESULT($FREETYPE_VERSION - OK)

FREETYPE_CFLAGS=`$FREETYPE_CONFIG --cflags`
FREETYPE_LIBS=`$FREETYPE_CONFIG --libs`
AC_SUBST(FREETYPE_CFLAGS)
AC_SUBST(FREETYPE_LIBS)

CAIRO_CFLAGS="$CAIRO_CFLAGS $FREETYPE_CFLAGS"
CAIRO_LIBS="$CAIRO_LIBS $FREETYPE_LIBS"

dnl ===========================================================================

dnl Checks for precise integer types
AC_CHECK_TYPES([uint64_t, uint128_t])

dnl Use lots of warning flags with GCC

WARN_CFLAGS=""

if test "x$GCC" = "xyes"; then
	WARN_CFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes \
	-Wmissing-prototypes -Wmissing-declarations \
	-Wnested-externs -fno-strict-aliasing"
fi

CAIRO_CFLAGS="$CAIRO_CFLAGS $WARN_CFLAGS"
CAIRO_LIBS="$CAIRO_LIBS -lm"

AC_SUBST(CAIRO_CFLAGS)
AC_SUBST(CAIRO_LIBS)

dnl ===========================================================================

AC_OUTPUT([
cairo.pc
Makefile
src/Makefile
src/cairo-features.h
test/Makefile
])

dnl ===========================================================================

echo ""
echo "cairo will be compiled with the following backends:"
echo "  Xlib: $use_xlib"
echo "  XCB: $use_xcb"
echo "  PostScript: $use_ps"
echo "  PNG: $use_png"
echo "  glitz: $use_glitz"
echo ""