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
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
|
AC_PREREQ([2.57])
AC_INIT([spice-gtk], [m4_esyscmd(build-aux/git-version-gen .tarball-version)],
[spice-devel@lists.freedesktop.org])
AC_CONFIG_MACRO_DIR([m4])
AM_CONFIG_HEADER([config.h])
AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE([foreign dist-bzip2 -Wall -Werror])
LT_INIT
AM_MAINTAINER_MODE
IT_PROG_INTLTOOL([0.40.0])
AM_GNU_GETTEXT_VERSION([0.17])
AM_GNU_GETTEXT([external])
AC_SUBST([GETTEXT_PACKAGE], [spice-gtk])
AC_DEFINE([GETTEXT_PACKAGE], [PACKAGE_TARNAME], [Define to the gettext package name.])
SPICE_GTK_LOCALEDIR=[${datadir}/locale]
AC_SUBST(SPICE_GTK_LOCALEDIR)
GTK_DOC_CHECK([1.14],[--flavour no-tmpl])
# Define default SPICE_COMMON_SRCDIR
SPICE_COMMON_SRCDIR='$(top_srcdir)'/common
AS_IF([test "$CFLAGS" = ""], [], [_cflags_is_set=yes])
AC_PROG_CC
AC_PROG_CC_C99
if test x"$ac_cv_prog_cc_c99" = xno; then
AC_MSG_ERROR([C99 compiler is required.])
fi
AS_IF([test "$CXXFLAGS" = ""], [], [_cxxflags_is_set=yes])
AC_PROG_CXX
AC_PROG_INSTALL
AC_CANONICAL_HOST
AC_PROG_LIBTOOL
AM_PROG_CC_C_O
AC_C_BIGENDIAN
AC_PATH_PROGS(PYTHON, python2 python)
RRA_LD_VERSION_SCRIPT
# Check for the CPU we are using
#
AC_MSG_CHECKING(for x86 or x86-64 platform)
case $host_cpu in
i386|i486|i586|i686|i786|k6|k7|arm|armv7)
variant=32
;;
x86_64)
variant=64
;;
*)
AC_MSG_RESULT(no)
echo Only x86 and x86-64 are supported
exit 1
esac
AC_MSG_RESULT($variant bit)
AM_CONDITIONAL([X86_64], [test "$variant" = 64])
AC_MSG_CHECKING([for native Win32])
case "$host" in
*-*-mingw*)
os_win32=yes
;;
*)
os_win32=no
;;
esac
AC_MSG_RESULT([$os_win32])
case $host in
*-*-linux*)
os_linux=yes
;;
esac
dnl =========================================================================
dnl Check OS target
AC_MSG_CHECKING([for some Win32 platform])
case "$host" in
*-*-mingw*|*-*-cygwin*)
platform_win32=yes
;;
*)
platform_win32=no
;;
esac
AC_MSG_RESULT([$platform_win32])
if test "$platform_win32" = yes; then
red_target=windows
else
red_target=x11
fi
AC_SUBST(red_target)
AM_CONDITIONAL(OS_WIN32, test "$os_win32" = "yes")
AM_CONDITIONAL(OS_UNIX, test "$os_win32" != "yes")
AM_CONDITIONAL(OS_LINUX, test "$os_linux" = "yes")
dnl =========================================================================
dnl Chek optional features
PKG_CHECK_MODULES(PROTOCOL, spice-protocol >= 0.6.3)
AC_SUBST(PROTOCOL_CFLAGS)
SPICE_REQUIRES=""
PKG_CHECK_MODULES(PIXMAN, pixman-1 >= 0.17.7)
AC_SUBST(PIXMAN_CFLAGS)
AC_SUBST(PIXMAN_LIBS)
SPICE_REQUIRES+=" pixman-1 >= 0.17.7"
PKG_CHECK_MODULES(CELT051, celt051 >= 0.5.1.1)
AC_SUBST(CELT051_CFLAGS)
AC_SUBST(CELT051_LIBS)
AC_SUBST(CELT051_LIBDIR)
SPICE_REQUIRES+=" celt051 >= 0.5.1.1"
PKG_CHECK_MODULES(SSL, openssl)
AC_SUBST(SSL_CFLAGS)
AC_SUBST(SSL_LIBS)
SPICE_REQUIRES+=" openssl"
PKG_CHECK_MODULES(GTK2, gtk+-2.0)
AC_SUBST(GTK2_CFLAGS)
AC_SUBST(GTK2_LIBS)
PKG_CHECK_MODULES(GLIB2, glib-2.0 >= 2.22)
AC_SUBST(GLIB2_CFLAGS)
AC_SUBST(GLIB2_LIBS)
PKG_CHECK_MODULES(GOBJECT2, gobject-2.0)
AC_SUBST(GOBJECT2_CFLAGS)
AC_SUBST(GOBJECT2_LIBS)
PKG_CHECK_MODULES(GIO, gio-2.0 >= 2.10.0)
AC_SUBST(GIO_CFLAGS)
AC_SUBST(GIO_LIBS)
AC_ARG_WITH([pulse],
AS_HELP_STRING([--without-pulse], [Ignore presence of PulseAudio and disable it]))
AS_IF([test "x$with_pulse" != "xno"],
[PKG_CHECK_MODULES(PULSE, libpulse libpulse-mainloop-glib, [have_pulse=yes], [have_pulse=no])],
[have_pulse=no])
AS_IF([test "x$have_pulse" = "xyes"],
[AC_DEFINE([HAVE_PULSE], 1, [Have pulseaudio?])],
[AS_IF([test "x$with_pulse" = "xyes"],
[AC_MSG_ERROR([PulseAudio requested but not found])
])
])
AM_CONDITIONAL([HAVE_PULSE], [test "x$have_pulse" = "xyes"])
AC_SUBST(PULSE_CFLAGS)
AC_SUBST(PULSE_LIBS)
# Add parameter for (partial) static linkage of spice client.
# this is used to achive single binary package for all (?) distros.
AC_ARG_ENABLE(static-linkage,
AS_HELP_STRING([--enable-static-linkage], [will generate spice client binary with static linkage to external libraries]),
[SPICEC_STATIC_LINKAGE_BSTATIC=["-Wl,-Bstatic"];
SPICEC_STATIC_LINKAGE_BDYNAMIC=["-Wl,-Bdynamic"]])
AS_IF([test "$_cflags_is_set" = "yes"], [], [
CFLAGS="-g -O2"
])
AS_IF([test "$_cxxflags_is_set" = "yes"], [], [
CXXFLAGS="-g -O2"
])
AC_CHECK_LIB(jpeg, jpeg_destroy_decompress,
AC_MSG_CHECKING([for jpeglib.h])
AC_TRY_CPP(
[#include <stdio.h>
#undef PACKAGE
#undef VERSION
#undef HAVE_STDLIB_H
#include <jpeglib.h>],
JPEG_LIBS='-ljpeg'
AC_MSG_RESULT($jpeg_ok),
AC_MSG_ERROR([jpeglib.h not found])),
AC_MSG_ERROR([libjpeg not found]))
AC_SUBST(JPEG_LIBS)
AC_CHECK_LIB(z, deflate, Z_LIBS='-lz', AC_MSG_ERROR([zlib not found]))
AC_SUBST(Z_LIBS)
WITH_UCONTEXT=1
AC_ARG_WITH(coroutine,
AS_HELP_STRING([--with-coroutine=ucontext/gthread], [use ucontext or GThread for coroutines]),
[],[with_coroutine=ucontext])
case $with_coroutine in
ucontext)
;;
gthread)
;;
*)
AC_MSG_ERROR(Unsupported coroutine type)
esac
if test "$with_coroutine" = "ucontext"; then
AC_CHECK_FUNC(makecontext, [],[with_coroutine=gthread])
AC_CHECK_FUNC(swapcontext, [],[with_coroutine=gthread])
AC_CHECK_FUNC(getcontext, [],[with_coroutine=gthread])
fi
if test "$with_coroutine" = "gthread"; then
PKG_CHECK_MODULES(GTHREAD, gthread-2.0 > 2.0.0)
WITH_UCONTEXT=0
fi
AC_SUBST(GTHREAD_CFLAGS)
AC_SUBST(GTHREAD_LIBS)
AC_DEFINE_UNQUOTED(WITH_UCONTEXT,[$WITH_UCONTEXT], [Whether to use ucontext coroutine impl])
AM_CONDITIONAL(WITH_UCONTEXT, [test "$WITH_UCONTEXT" != "0"])
GOBJECT_INTROSPECTION_CHECK([0.6.7])
PKG_CHECK_MODULES([GOBJECT_INTROSPECTION],
[gobject-introspection-1.0 >= 0.9.4],
[has_symbol_prefix=yes], [:])
AM_CONDITIONAL([G_IR_SCANNER_SYMBOL_PREFIX], [test "x$has_symbol_prefix" = "xyes"])
AC_ARG_WITH(python,
AS_HELP_STRING([--with-python], [build python bindings]),
[case "${withval}" in
yes|no) ;;
*) AC_MSG_ERROR([bad value ${withval} for python option]) ;;
esac],[withval=yes])
WITH_PYTHON=$withval
if test "$WITH_PYTHON" = "yes"; then
PKG_CHECK_MODULES(PYGTK, pygtk-2.0 >= 2.0.0)
AC_SUBST(PYGTK_CFLAGS)
AC_SUBST(PYGTK_LIBS)
AM_PATH_PYTHON
AC_MSG_CHECKING([whether $PYTHON version >= 2.0])
HAVE_PYTHON_REQUIRED=no
AM_PYTHON_CHECK_VERSION([$PYTHON], [2.0],
[HAVE_PYTHON_REQUIRED="yes"],
[HAVE_PYTHON_REQUIRED="no"])
AC_MSG_RESULT($HAVE_PYTHON_REQUIRED)
if test "x$HAVE_PYTHON_REQUIRED" != "xyes"
then
AC_MSG_ERROR("No suitable python found")
fi
AM_CHECK_PYTHON_HEADERS(have_python_headers=yes,have_python_headers=no)
if test "x$have_python_headers" != "xyes"
then
AC_MSG_ERROR("No python development headers found")
fi
fi
AM_CONDITIONAL(WITH_PYTHON, [test "$WITH_PYTHON" = "yes"])
dnl ===========================================================================
dnl check compiler flags
AC_DEFUN([SPICE_CC_TRY_FLAG], [
AC_MSG_CHECKING([whether $CC supports $1])
spice_save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $1"
AC_COMPILE_IFELSE([ ], [spice_cc_flag=yes], [spice_cc_flag=no])
CFLAGS="$spice_save_CFLAGS"
if test "x$spice_cc_flag" = "xyes"; then
ifelse([$2], , :, [$2])
else
ifelse([$3], , :, [$3])
fi
AC_MSG_RESULT([$spice_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)
dnl MAYBE_WARN="-Wall -Wno-sign-compare -Werror -Wno-deprecated-declarations"
MAYBE_WARN="-Wall -Wno-sign-compare -Wno-deprecated-declarations"
AC_ARG_ENABLE(werror,
AS_HELP_STRING([--enable-werror], [Use -Werror (if supported)]),
set_werror="$enableval",[
if test -d $srcdir/.git; then
is_git_version=true
set_werror=yes
else
set_werror=no
fi
])
# invalidate cached value if MAYBE_WARN has changed
if test "x$spice_cv_warn_maybe" != "x$MAYBE_WARN"; then
unset spice_cv_warn_cflags
fi
AC_CACHE_CHECK([for supported warning flags], spice_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
SPICE_CC_TRY_FLAG([$W], [WARN_CFLAGS="$WARN_CFLAGS $W"])
done
if test "$set_werror" != "no"; then
SPICE_CC_TRY_FLAG(["-Werror"], [WARN_CFLAGS="$WARN_CFLAGS -Werror"])
fi
spice_cv_warn_cflags=$WARN_CFLAGS
spice_cv_warn_maybe=$MAYBE_WARN
AC_MSG_CHECKING([which warning flags were supported])])
WARN_CFLAGS="$spice_cv_warn_cflags"
SPICE_CFLAGS="$SPICE_CFLAGS $WARN_CFLAGS"
# We only wish to enable attribute(warn_unused_result) if we can prevent
# gcc from generating thousands of warnings about the misapplication of the
# attribute to void functions and variables.
AC_MSG_CHECKING([how to enable unused result warnings])
warn_unused_result=""
if echo $WARN_CFLAGS | grep -e '-Wno-attributes' >/dev/null; then
AC_TRY_COMPILE([__attribute__((__warn_unused_result__))
int f (int i) { return i; }], [],
[warn_unused_result="__attribute__((__warn_unused_result__))"])
fi
AC_DEFINE_UNQUOTED([WARN_UNUSED_RESULT], [$warn_unused_result],
[Define to the value your compiler uses to support the warn-unused-result attribute])
AC_MSG_RESULT([$warn_unused_result])
AC_SUBST(SPICE_CFLAGS)
SPICE_GLIB_CFLAGS="$PROTOCOL_CFLAGS $PIXMAN_CFLAGS $CELT051_CFLAGS $PULSE_CFLAGS $GLIB2_CFLAGS $GIO_CFLAGS $GOBJECT2_CFLAGS $SSL_CFLAGS"
SPICE_GTK_CFLAGS="$SPICE_GLIB_CFLAGS $GTK2_CFLAGS "
AC_SUBST(SPICE_GLIB_CFLAGS)
AC_SUBST(SPICE_GTK_CFLAGS)
dnl =========================================================================
dnl -fvisibility stuff
have_gcc4=no
AC_MSG_CHECKING(for -fvisibility)
AC_COMPILE_IFELSE([
#if defined(__GNUC__) && (__GNUC__ >= 4)
#else
error Need GCC 4.0 for visibility
#endif
int main () { return 0; }
], have_gcc4=yes)
if test "x$have_gcc4" = "xyes"; then
VISIBILITY_HIDDEN_CFLAGS="-fvisibility=hidden"
fi
AC_MSG_RESULT($have_gcc4)
AC_SUBST(VISIBILITY_HIDDEN_CFLAGS)
AC_SUBST(SPICE_COMMON_SRCDIR)
AC_SUBST(SPICE_REQUIRES)
AC_SUBST([SPICEC_STATIC_LINKAGE_BSTATIC])
AC_SUBST([SPICEC_STATIC_LINKAGE_BDYNAMIC])
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
AC_OUTPUT([
Makefile
spice-client-glib.pc
spice-client-gtk.pc
common/Makefile
common/win/Makefile
common/win/my_getopt-1.5/Makefile
po/Makefile.in
python_modules/Makefile
gtk/Makefile
doc/Makefile
doc/reference/Makefile
])
dnl ==========================================================================
echo "
Spice-Gtk $VERSION
==============
prefix: ${prefix}
c compiler: ${CC}
c++ compiler: ${CXX}
Coroutine: ${with_coroutine}
Now type 'make' to build $PACKAGE
"
|