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
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
|
AC_PREREQ(2.59)
m4_define([spectre_major_version], [0])
m4_define([spectre_minor_version], [2])
m4_define([spectre_micro_version], [3])
m4_define([spectre_version],
[spectre_major_version.spectre_minor_version.spectre_micro_version])
AC_INIT(libspectre, [spectre_version])
AC_CONFIG_HEADERS(config.h)
AM_INIT_AUTOMAKE([1.7])
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
AM_MAINTAINER_MODE
# libtool versioning
#
# See http://sources.redhat.com/autobook/autobook/autobook_91.html#SEC91 for details
#
## increment if the interface has additions, changes, removals.
LT_CURRENT=2
## increment any time the source changes; set to
## 0 if you increment CURRENT
LT_REVISION=3
## increment if any interfaces have been added; set to 0
## if any interfaces have been changed or removed. removal has
## precedence over adding, so set to 0 if both happened.
LT_AGE=1
VERSION_INFO="$LT_CURRENT:$LT_REVISION:$LT_AGE"
AC_SUBST(VERSION_INFO)
LT_CURRENT_MINUS_AGE=`expr $LT_CURRENT - $LT_AGE`
AC_SUBST(LT_CURRENT_MINUS_AGE)
AC_SUBST(LT_CURRENT)
AC_SUBST(LT_REVISION)
AC_SUBST(LT_AGE)
SPECTRE_MAJOR_VERSION=spectre_major_version
SPECTRE_MINOR_VERSION=spectre_minor_version
SPECTRE_MICRO_VERSION=spectre_micro_version
SPECTRE_VERSION=spectre_major_version.spectre_minor_version.spectre_micro_version
AC_SUBST(SPECTRE_MAJOR_VERSION)
AC_SUBST(SPECTRE_MINOR_VERSION)
AC_SUBST(SPECTRE_MICRO_VERSION)
AC_SUBST(SPECTRE_VERSION)
AC_PROG_LIBTOOL
AC_PROG_CC
AC_ISC_POSIX
AC_PROG_CC_STDC
AC_STDC_HEADERS
AC_C_BIGENDIAN
AC_CHECK_FUNC(vasprintf, [ AC_DEFINE(HAVE_VASPRINTF, 1, [Define if the 'vasprintf' function is available.]) ])
AC_CHECK_FUNC(_vscprintf, [ AC_DEFINE(HAVE__VSCPRINTF, 1, [Define if the '_vscprintf' function is available.]) ])
LIBGS_REQUIRED="8.62"
AC_CHECK_LIB(gs, gsapi_new_instance, have_libgs=yes, have_libgs=no)
if test "x$have_libgs" = "xyes"; then
LIB_GS="-lgs"
save_LIBS=$LIBS
LIBS="$LIBS -lgs"
AC_LANG_PUSH(C)
AC_MSG_CHECKING([for libgs >= $LIBGS_REQUIRED])
AC_RUN_IFELSE([AC_LANG_PROGRAM(
[[
#include <ghostscript/iapi.h>
]],
[[
gsapi_revision_t gsrev;
if (gsapi_revision (&gsrev, sizeof (gsrev)) != 0)
return 1;
if (gsrev.revision < `echo "$LIBGS_REQUIRED" | sed -e 's/\.//'`)
return 1;
]])],
[have_libgs=yes],
[have_libgs=no],
[have_libgs=yes]
)
AC_MSG_RESULT($have_libgs)
AC_LANG_POP(C)
LIBS=$save_LIBS
if test "x$have_libgs" = "xno"; then
AC_MSG_ERROR([You need libgs >= $LIBGS_REQUIRED in order to compile libspectre])
fi
else
AC_MSG_ERROR([You need libgs in order to compile libspectre])
fi
AC_SUBST(LIB_GS)
AC_ARG_ENABLE(asserts,
AS_HELP_STRING([--enable-asserts],[include assertion checks]),
enable_asserts=$enableval,
enable_asserts=$USE_MAINTAINER_MODE)
if test x$enable_asserts = xno; then
AC_DEFINE(SPECTRE_DISABLE_ASSERT,[1],[Disable assertion checking])
fi
AC_ARG_ENABLE(checks,
AS_HELP_STRING([--enable-checks],[include sanity checks on public API]),
enable_checks=$enableval,
enable_checks=yes)
if test x$enable_checks = xno; then
AC_DEFINE(SPECTRE_DISABLE_CHECKS,[1],[Disable public API sanity checking])
fi
dnl Test
AC_ARG_ENABLE(test,
[AC_HELP_STRING([--enable-test], [Compile tests])],enable_test="$enableval",enable_test=yes)
if test "x$enable_test" = "xyes"; then
PKG_CHECK_MODULES(CAIRO, cairo cairo-png, enable_test=yes,enable_test=no)
if test "x$enable_test" != "xyes"; then
AC_MSG_WARN("Tests disabled since required cairo library was not found")
fi
fi
AM_CONDITIONAL(ENABLE_TEST, test x$enable_test = xyes)
dnl ===========================================================================
dnl check compiler flags (From cairo)
AC_DEFUN([SPECTRE_CC_TRY_FLAG], [
AC_MSG_CHECKING([whether $CC supports $1])
spectre_save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $1"
AC_COMPILE_IFELSE([ ], [spectre_cc_flag=yes], [spectre_cc_flag=no])
CFLAGS="$spectre_save_CFLAGS"
if test "x$spectre_cc_flag" = "xyes"; then
ifelse([$2], , :, [$2])
else
ifelse([$3], , :, [$3])
fi
AC_MSG_RESULT([$spectre_cc_flag])
])
dnl Use lots of warning flags with with gcc and compatible compilers
dnl Note: if you change the following variable, the cache is automatically
dnl skipped and all flags rechecked. So there's no need to do anything
dnl else. If for any reason you need to force a recheck, just change
dnl MAYBE_WARN in an ignorable way (like adding whitespace)
MAYBE_WARN="-Wall -Wextra -pedantic \
-Wsign-compare -Werror-implicit-function-declaration \
-Wpointer-arith -Wstrict-prototypes \
-Wmissing-prototypes -Wmissing-declarations -Wnested-externs \
-Wpacked -Wswitch-enum \
-Wstrict-aliasing=2 -Winit-self -Wunsafe-loop-optimizations \
-Wdeclaration-after-statement \
-Wno-missing-field-initializers -Wno-unused-parameter \
-Wno-attributes -Wno-long-long -Winline"
# invalidate cached value if MAYBE_WARN has changed
if test "x$spectre_cv_warn_maybe" != "x$MAYBE_WARN"; then
unset spectre_cv_warn_cflags
fi
AC_CACHE_CHECK([for supported warning flags], spectre_cv_warn_cflags, [
echo
WARN_CFLAGS=""
# Some warning options are not supported by all versions of
# gcc, so test all desired options against the current
# compiler.
#
# Note that there are some order dependencies
# here. Specifically, an option that disables a warning will
# have no net effect if a later option then enables that
# warnings, (perhaps implicitly). So we put some grouped
# options (-Wall and -Wextra) up front and the -Wno options
# last.
for W in $MAYBE_WARN; do
SPECTRE_CC_TRY_FLAG([$W], [WARN_CFLAGS="$WARN_CFLAGS $W"])
done
spectre_cv_warn_cflags=$WARN_CFLAGS
spectre_cv_warn_maybe=$MAYBE_WARN
AC_MSG_CHECKING([which warning flags were supported])])
WARN_CFLAGS="$spectre_cv_warn_cflags"
SPECTRE_CFLAGS="$SPECTRE_CFLAGS $WARN_CFLAGS"
AC_SUBST(SPECTRE_CFLAGS)
dnl **********************************
dnl *** va_copy checks (from GLib) ***
dnl **********************************
dnl we currently check for all three va_copy possibilities, so we get
dnl all results in config.log for bug reports.
AC_CACHE_CHECK([for an implementation of va_copy()],spectre_cv_va_copy,[
AC_LINK_IFELSE([#include <stdarg.h>
#include <stdlib.h>
void f (int i, ...) {
va_list args1, args2;
va_start (args1, i);
va_copy (args2, args1);
if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
exit (1);
va_end (args1); va_end (args2);
}
int main() {
f (0, 42);
return 0;
}],
[spectre_cv_va_copy=yes],
[spectre_cv_va_copy=no])
])
AC_CACHE_CHECK([for an implementation of __va_copy()],spectre_cv___va_copy,[
AC_LINK_IFELSE([#include <stdarg.h>
#include <stdlib.h>
void f (int i, ...) {
va_list args1, args2;
va_start (args1, i);
__va_copy (args2, args1);
if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
exit (1);
va_end (args1); va_end (args2);
}
int main() {
f (0, 42);
return 0;
}],
[spectre_cv___va_copy=yes],
[spectre_cv___va_copy=no])
])
if test "x$spectre_cv_va_copy" = "xyes"; then
spectre_va_copy_func=va_copy
else if test "x$spectre_cv___va_copy" = "xyes"; then
spectre_va_copy_func=__va_copy
fi
fi
if test -n "$spectre_va_copy_func"; then
AC_DEFINE_UNQUOTED(SPECTRE_VA_COPY,$spectre_va_copy_func,[A 'va_copy' style function])
fi
AC_LANG_PUSH(C)
AC_CACHE_CHECK([whether va_lists can be copied by value],
spectre_cv_va_val_copy,
[AC_RUN_IFELSE([AC_LANG_PROGRAM(
[[
#include <stdarg.h>
#include <stdlib.h>
]],
[[
void f (int i, ...) {
va_list args1, args2;
va_start (args1, i);
args2 = args1;
if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
exit (1);
va_end (args1); va_end (args2);
}
int main() {
f (0, 42);
return 0;
}
]])],
[spectre_cv_va_val_copy=yes],
[spectre_cv_va_val_copy=no],
[spectre_cv_va_val_copy=yes])
])
AC_LANG_POP(C)
if test "x$spectre_cv_va_val_copy" = "xno"; then
AC_DEFINE(SPECTRE_VA_COPY_AS_ARRAY,1, ['va_lists' cannot be copies as values])
fi
AC_OUTPUT([
Makefile
Doxyfile
libspectre/Makefile
libspectre/spectre-version.h
test/Makefile
libspectre.pc
])
|