4 # 1. The version is SPICE_MAJOR.SPICE_MINOR.SPICE_MICRO
5 # 2. It is generated via a two stage process:
7 # 2. run configure which calls git-version-gen.
8 # 3. Follow these rules for setting the next tag (aka tarball version):
9 # 1. SPICE_MAJOR remains 0 until a major change is done.
10 # 2. Increment SPICE_MINOR to next even value on a significant release,
11 # updating the release schedule: http://www.spice-space.org/page/Releases
12 # 3. Increment SPICE_MINOR otherwise.
13 # 4. Follow the libtool manual for the so version:
14 # http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
16 m4_define([SPICE_CURRENT], [9])
17 m4_define([SPICE_REVISION], [0])
18 m4_define([SPICE_AGE], [8])
20 # Note on the library name on linux (SONAME) produced by libtool (for reference, gleaned
21 # from looking at libtool 2.4.2)
23 # libspice-servver.so.current-age.age.revision
25 AC_INIT(spice, [m4_esyscmd(build-aux/git-version-gen .tarball-version)],
26 [spice-devel@lists.freedesktop.org], spice)
28 AC_CONFIG_MACRO_DIR([m4])
29 AM_CONFIG_HEADER([config.h])
32 # For automake >= 1.12
33 m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
35 AM_INIT_AUTOMAKE([dist-bzip2 no-dist-gzip subdir-objects])
40 if test x"$ac_cv_prog_cc_c99" = xno; then
41 AC_MSG_ERROR([C99 compiler is required.])
49 AC_PATH_PROGS(PYTHON, python2 python)
52 AC_CHECK_HEADERS([sys/time.h])
53 AC_CHECK_HEADERS([execinfo.h])
56 AC_DEFINE([__STDC_FORMAT_MACROS],[],[Force definition of format macros for C++])
58 SPICE_LT_VERSION=m4_format("%d:%d:%d", SPICE_CURRENT, SPICE_REVISION, SPICE_AGE)
59 AC_SUBST(SPICE_LT_VERSION)
61 # Check for the CPU we are using
63 AC_MSG_CHECKING(for x86, x86-64 or armv6+ platform)
65 i386|i486|i586|i686|i786|k6|k7|armv6|armv6l|armv6hl|armv7|armv7l|armv7hl)
73 echo Only x86 and x86-64 are supported
76 AC_MSG_RESULT($variant bit)
77 AM_CONDITIONAL([X86_64], [test "$variant" = 64])
79 AC_MSG_CHECKING([for native Win32])
88 AC_MSG_RESULT([$os_win32])
96 dnl =========================================================================
99 AC_MSG_CHECKING([for some Win32 platform])
101 *-*-mingw*|*-*-cygwin*)
108 AC_MSG_RESULT([$platform_win32])
109 if test "$platform_win32" = yes; then
115 AM_CONDITIONAL(OS_WIN32, test "$os_win32" = "yes")
116 AM_CONDITIONAL(OS_UNIX, test "$os_win32" != "yes")
117 AM_CONDITIONAL(OS_LINUX, test "$os_linux" = "yes")
119 dnl =========================================================================
120 dnl Chek optional features
121 AC_ARG_ENABLE(tunnel,
122 [ --enable-tunnel Enable network redirection],,
123 [enable_tunnel="no"])
124 AS_IF([test x"$enable_tunnel" != "xno"], [enable_tunnel="yes"])
125 AM_CONDITIONAL(SUPPORT_TUNNEL, test "x$enable_tunnel" != "xno")
126 if test "x$enable_tunnel" != "xno"; then
127 AC_DEFINE([USE_TUNNEL], [1], [Define if supporting tunnel proxying])
131 [ --enable-gui Enable start dialog with CEGUI],,
133 AS_IF([test x"$enable_gui" != "xno"], [enable_gui="yes"])
134 AM_CONDITIONAL(SUPPORT_GUI, test "x$enable_gui" != "xno")
136 AC_ARG_ENABLE(opengl,
137 [ --enable-opengl Enable opengl requirement / support (not recommended)],,
138 [enable_opengl="no"])
139 AS_IF([test x"$enable_opengl" != "xno"], [enable_opengl="yes"])
140 AM_CONDITIONAL(SUPPORT_GL, test "x$enable_opengl" = "xyes")
142 AC_ARG_ENABLE(smartcard,
143 [ --enable-smartcard Enable network redirection],,
144 [enable_smartcard="no"])
145 AS_IF([test x"$enable_smartcard" != "xno"], [enable_smartcard="yes"])
146 AM_CONDITIONAL(SUPPORT_SMARTCARD, test "x$enable_smartcard" != "xno")
147 if test "x$enable_smartcard" = "xyes"; then
148 AC_DEFINE([USE_SMARTCARD], [1], [Define if supporting smartcard proxying])
151 AC_ARG_ENABLE(client,
152 [ --enable-client Enable spice client],,
153 [enable_client="no"])
154 AS_IF([test x"$enable_client" != "xno"], [enable_client="yes"])
155 AM_CONDITIONAL(SUPPORT_CLIENT, test "x$enable_client" = "xyes")
157 AC_ARG_ENABLE(automated_tests,
158 [ --enable-automated-tests Enable automated tests using snappy (part of spice--gtk)],,
159 [enable_automated_tests="no"])
160 AS_IF([test x"$enable_automated_tests" != "xno"], [enable_automated_tests="yes"])
161 AM_CONDITIONAL(SUPPORT_AUTOMATED_TESTS, test "x$enable_automated_tests" != "xno")
164 dnl =========================================================================
167 AC_CONFIG_SUBDIRS([spice-common])
168 COMMON_CFLAGS='-I ${top_srcdir}/spice-common/ -I ${top_srcdir}/spice-common/spice-protocol/'
169 AC_SUBST(COMMON_CFLAGS)
174 AC_CHECK_LIB(rt, clock_gettime,
175 AC_DEFINE([HAVE_CLOCK_GETTIME], 1, [Defined if we have clock_gettime()])
180 if test "$red_target" = "windows"; then
181 SPICE_NONPKGCONFIG_LIBS+=" -lpthreadGC2 -lversion -lmsimg32 $LIBM"
183 SPICE_NONPKGCONFIG_LIBS+=" -pthread $LIBM $LIBRT"
186 dnl The client needs a yield function
187 AC_MSG_CHECKING(for posix yield function)
188 for yield_func in pthread_yield pthread_yield_np sched_yield \
190 spice_save_CPPFLAGS="$CPPFLAGS"
191 CPPFLAGS="$CPPFLAGS $SPICE_NONPKGCONFIG_LIBS"
192 AC_TRY_LINK([#include <pthread.h>],
194 [posix_yield_func="$yield_func"
196 CPPFLAGS="$spice_save_CPPFLAGS"
198 if test x"$posix_yield_func" = xnone; then
199 AC_MSG_ERROR([No posix yield function found])
201 AC_MSG_RESULT($posix_yield_func)
202 posix_yield_func="$posix_yield_func()"
204 AC_DEFINE_UNQUOTED([POSIX_YIELD_FUNC],$posix_yield_func,[The POSIX RT yield function])
208 if test "x$enable_gui" = "xyes" && test "x$enable_client" = "xyes" ; then
209 PKG_CHECK_MODULES(CEGUI06, CEGUI-0.6 >= 0.6.0 CEGUI-0.6 < 0.7.0,
211 AC_SUBST(CEGUI06_CFLAGS)
212 AC_SUBST(CEGUI06_LIBS)
213 AC_DEFINE([USE_GUI], [1], [Define to build with CEGUI support])
216 PKG_CHECK_MODULES(CEGUI, CEGUI >= 0.6.0 CEGUI < 0.7.0)
217 AC_SUBST(CEGUI_CFLAGS)
219 AC_DEFINE([USE_GUI], [1], [Define to build with CEGUI support])
223 if test "x$enable_tunnel" = "xyes"; then
224 PKG_CHECK_MODULES(SLIRP, slirp)
225 AC_SUBST(SLIRP_CFLAGS)
227 SPICE_REQUIRES+=" slirp"
228 AC_DEFINE([HAVE_SLIRP], [], [Define if we have slirp])
231 if test "x$enable_smartcard" = "xyes"; then
232 PKG_CHECK_MODULES(CAC_CARD, libcacard >= 0.1.2)
233 SMARTCARD_LIBS="$CAC_CARD_LIBS"
234 SMARTCARD_CFLAGS="$CAC_CARD_CFLAGS"
235 AC_SUBST(SMARTCARD_LIBS)
236 AC_SUBST(SMARTCARD_CFLAGS)
237 SPICE_REQUIRES+=" libcacard >= 0.1.2"
241 PKG_CHECK_MODULES([GLIB2], [glib-2.0 >= 2.22])
242 SPICE_REQUIRES+=" glib-2.0 >= 2.22"
244 PKG_CHECK_MODULES(PIXMAN, pixman-1 >= 0.17.7)
245 AC_SUBST(PIXMAN_CFLAGS)
246 AC_SUBST(PIXMAN_LIBS)
247 SPICE_REQUIRES+=" pixman-1 >= 0.17.7"
249 PKG_CHECK_MODULES(CELT051, celt051 >= 0.5.1.1)
250 AC_SUBST(CELT051_CFLAGS)
251 AC_SUBST(CELT051_LIBS)
252 AC_SUBST(CELT051_LIBDIR)
253 SPICE_REQUIRES+=" celt051 >= 0.5.1.1"
255 if test ! -e client/generated_marshallers.cpp; then
256 AC_MSG_CHECKING([for pyparsing python module])
257 echo "import pyparsing" | ${PYTHON} - >/dev/null 2>&1
258 if test $? -ne 0 ; then
259 AC_MSG_RESULT([not found])
260 AC_MSG_ERROR([pyparsing python module is required to compile this package])
262 AC_MSG_RESULT([found])
265 if test "$os_linux" = yes; then
266 PKG_CHECK_MODULES(ALSA, alsa)
267 AC_SUBST(ALSA_CFLAGS)
271 PKG_CHECK_MODULES(SSL, openssl)
274 SPICE_REQUIRES+=" openssl"
276 # These are commented out because the gl libraries on RHEL 5 do not have pkgconfig files
278 # PKG_CHECK_MODULES(GL, gl glu)
279 # AC_SUBST(GL_CFLAGS)
281 # SPICE_REQUIRES+=" gl glu"
283 if test "x$enable_opengl" = "xyes"; then
284 AC_CHECK_LIB(GL, glBlendFunc, GL_LIBS="$GL_LIBS -lGL", enable_opengl=no)
285 AC_CHECK_LIB(GLU, gluSphere, GL_LIBS="$GL_LIBS -lGLU", enable_opengl=no)
286 AC_DEFINE([USE_OPENGL], [1], [Define to build with OpenGL support])
287 AC_DEFINE([GL_GLEXT_PROTOTYPES], [], [Enable GLExt prototypes])
289 if test "x$enable_opengl" = "xno"; then
290 AC_MSG_ERROR([GL libraries not available])
296 SPICE_NONPKGCONFIG_LIBS+=" $GL_LIBS"
298 if test "x$red_target" = "xx11" && test "x$enable_client" = "xyes" ; then
299 PKG_CHECK_MODULES(XRANDR, xrandr)
300 PKG_CHECK_MODULES(XFIXES, xfixes)
301 PKG_CHECK_MODULES(MISC_X, x11 xext xrender)
302 AC_SUBST(XRANDR_CFLAGS)
303 AC_SUBST(XRANDR_LIBS)
304 AC_SUBST(MISC_X_CFLAGS)
305 AC_SUBST(MISC_X_LIBS)
307 PKG_CHECK_MODULES(XRANDR12,
315 AM_CONDITIONAL([HAVE_XRANDR12], [test "x$have_xrandr12" = "xyes"])
316 if test "x$have_xrandr12" = "xyes" ; then
317 AC_DEFINE([HAVE_XRANDR12], [], [Define if we have XRANDR 12])
320 # Add parameter for libXinerama
321 AC_ARG_ENABLE([xinerama],
322 [AS_HELP_STRING([--disable-xinerama],
323 [disable Xinerama library @<:@default=no@:>@])])
325 if test "x$enable_xinerama" != "xno"; then
326 PKG_CHECK_MODULES(XINERAMA,
334 if test "x$enable_xinerama" = "xyes" && test "x$have_xinerama" = "xno"; then
335 AC_MSG_ERROR([Requested Xinerama library was not found])
338 AM_CONDITIONAL([HAVE_XINERAMA], [test "x$have_xinerama" = "xyes"])
339 if test "x$have_xinerama" = "xyes" ; then
340 AC_DEFINE([HAVE_XINERAMA], [], [Define if we have Xinerama])
341 AC_SUBST(XINERAMA_CFLAGS)
342 AC_SUBST(XINERAMA_LIBS)
343 SPICE_REQUIRES+=" xinerama"
346 # Add parameter for (partial) static linkage of spice client.
347 # this is used to achive single binary package for all (?) distros.
348 AC_ARG_ENABLE(static-linkage,
349 [ --enable-static-linkage will generate spice client binary with static linkage to external libraries ],,
350 [enable_static_linkage="no"])
351 AS_IF([test x"$enable_static_linkage" != "xno"],
352 [SPICEC_STATIC_LINKAGE_BSTATIC=["-Wl,-Bstatic"]])
354 AC_CHECK_LIB(jpeg, jpeg_destroy_decompress,
355 AC_MSG_CHECKING([for jpeglib.h])
361 #include <jpeglib.h>],
363 AC_MSG_RESULT($jpeg_ok),
364 AC_MSG_ERROR([jpeglib.h not found])),
365 AC_MSG_ERROR([libjpeg not found]))
368 AC_CHECK_LIB(z, deflate, Z_LIBS='-lz', AC_MSG_ERROR([zlib not found]))
371 dnl Cyrus SASL, check from gtk-vnc
373 [AS_HELP_STRING([--with-sasl],
374 [use cyrus SASL for authentication @<:@default=check@:>@])],
381 if test "x$with_sasl" != "xno"; then
382 if test "x$with_sasl" != "xyes" && test "x$with_sasl" != "xcheck"; then
383 SASL_CFLAGS="-I$with_sasl"
384 SASL_LIBS="-L$with_sasl"
389 CFLAGS="$CFLAGS $SASL_CFLAGS"
390 LIBS="$LIBS $SASL_LIBS"
391 AC_CHECK_HEADER([sasl/sasl.h],[],[
392 if test "x$with_sasl" != "xcheck" ; then
397 if test "x$with_sasl" != "xno" ; then
398 AC_CHECK_LIB([sasl2], [sasl_client_init],[with_sasl2=yes],[with_sasl2=no])
400 if test "x$with_sasl2" = "xno" && test "x$with_sasl" != "xno" ; then
401 AC_CHECK_LIB([sasl], [sasl_client_init],[with_sasl=yes],[with_sasl=no])
403 if test "x$with_sasl2" = "xyes"; then
404 SASL_LIBS="$SASL_LIBS -lsasl2"
405 elif test "x$with_sasl" = "xyes"; then
406 SASL_LIBS="$SASL_LIBS -lsasl"
408 AC_MSG_ERROR([Missing required Cyrus SASL development package])
412 if test "x$with_sasl2" = "xyes" || test "x$with_sasl" = "xyes" ; then
413 AC_DEFINE_UNQUOTED([HAVE_SASL], 1,
414 [whether Cyrus SASL is available for authentication])
418 AM_CONDITIONAL([HAVE_SASL], [test "x$with_sasl2" = "xyes" || test "x$with_sasl" = "xyes"])
419 AC_SUBST([SASL_CFLAGS])
420 AC_SUBST([SASL_LIBS])
422 if test "x$enable_automated_tests" = "xyes"; then
423 AC_MSG_CHECKING([for snappy])
424 snappy --help >/dev/null 2>&1
425 if test $? -ne 0 ; then
426 AC_MSG_RESULT([not found])
427 AC_MSG_ERROR([snappy was not found, this module is part of spice-gtk andis required to compile this package])
429 AC_MSG_RESULT([found])
432 dnl ===========================================================================
433 dnl check compiler flags
435 SPICE_COMPILE_WARNINGS
437 # use ximage.h for win32 build if it is found (no package for mingw32 atm)
438 if test $os_win32 == "yes" ; then
439 AC_MSG_CHECKING([for cximage])
444 return CXIMAGE_FORMAT_RAW;
447 AC_MSG_RESULT([found])
450 ,[AC_MSG_RESULT([missing])
451 CXIMAGE_CFLAGS='-DDISABLE_CXIMAGE'
456 AC_SUBST(CXIMAGE_CFLAGS)
458 # check for windres for mingw32 builds
459 if test $os_win32 == "yes" ; then
460 AC_CHECK_PROGS(WINDRES,i686-pc-mingw32-windres mingw-windres mingw32-windres,false)
464 AC_SUBST(WARN_CFLAGS)
465 AC_SUBST(CFLAGS_CFLAGS)
467 dnl =========================================================================
468 dnl -fvisibility stuff
471 AC_MSG_CHECKING(for -fvisibility)
472 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
473 #if defined(__GNUC__) && (__GNUC__ >= 4)
475 error Need GCC 4.0 for visibility
477 int main () { return 0; }
480 if test "x$have_gcc4" = "xyes" && test ! "$os_win32" = "yes" ; then
481 VISIBILITY_HIDDEN_CFLAGS="-fvisibility=hidden"
483 AC_MSG_RESULT($have_gcc4)
484 AC_SUBST(VISIBILITY_HIDDEN_CFLAGS)
486 dnl ensure linker supports ---version-script option before using it
487 AC_CACHE_CHECK([if -Wl,--version-script works], [spice_cv_ld_version_script],
488 [save_LDFLAGS="$LDFLAGS"
489 LDFLAGS="$LDFLAGS -Wl,--version-script=$srcdir/server/spice-server.syms"
490 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
491 [spice_cv_ld_version_script=yes], [spice_cv_ld_version_script=no])
492 LDFLAGS="$save_LDFLAGS"])
493 AM_CONDITIONAL([HAVE_LD_VERSION_SCRIPT],
494 [test x"$spice_cv_ld_version_script" = xyes])
496 AC_SUBST(SPICE_REQUIRES)
497 AC_SUBST(SPICE_NONPKGCONFIG_CFLAGS)
498 AC_SUBST(SPICE_NONPKGCONFIG_LIBS)
500 AC_SUBST([SPICEC_STATIC_LINKAGE_BSTATIC])
502 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
508 server/tests/Makefile
512 dnl ==========================================================================
523 Build Spice client: ${enable_client}
524 " ; if test "x$enable_client" == "xyes"; then echo "\
525 Have XRANDR 1.2: ${have_xrandr12}
527 Have Xinerama: ${have_xinerama}
529 Red target: ${red_target}
531 OpenGL: ${enable_opengl}
535 Support tunneling: ${enable_tunnel}
537 Smartcard: ${enable_smartcard}
539 SASL support: ${enable_sasl}
541 Automated tests: ${enable_automated_tests}
544 if test $os_win32 == "yes" ; then
546 " Copy & Paste Images: ${have_cximage}
551 " Now type 'make' to build $PACKAGE