summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUri Lublin <uril@redhat.com>2009-12-30 15:34:56 +0200
committerYaniv Kamay <ykamay@redhat.com>2010-01-10 19:44:02 +0200
commitc3418952ebd29aff612ee8dd96af5bdd9c5dad7a (patch)
treef577106e1a1dab94677c79af6df519c5b455020f
parentb298008eaccf9afc418e486b012f7f023d5e0867 (diff)
downloadspice-c3418952ebd29aff612ee8dd96af5bdd9c5dad7a.tar.gz
spice-c3418952ebd29aff612ee8dd96af5bdd9c5dad7a.tar.xz
spice-c3418952ebd29aff612ee8dd96af5bdd9c5dad7a.zip
configure.ac: move most checks to configure.ac.shared (subdir config)
... and m4_include it in configure.ac Later all configure.ac in subdirs will m4_include it too. This patch changes nothing really, just moves lines from one file to another. Signed-off-by: Uri Lublin <uril@redhat.com>
-rw-r--r--configure.ac237
-rw-r--r--configure.ac.shared245
2 files changed, 250 insertions, 232 deletions
diff --git a/configure.ac b/configure.ac
index 43b8ec61..7b2b2d51 100644
--- a/configure.ac
+++ b/configure.ac
@@ -7,72 +7,15 @@ m4_define([SPICE_MICRO], 1)
AC_INIT(spice, [SPICE_MAJOR.SPICE_MINOR.SPICE_MICRO], [], spice)
AC_CONFIG_MACRO_DIR([m4])
-AM_CONFIG_HEADER([config.h])
-AC_CONFIG_AUX_DIR(.)
-AM_INIT_AUTOMAKE([dist-bzip2])
-AM_MAINTAINER_MODE
+m4_include(configure.ac.shared)
-AS_IF([test "$CFLAGS" = ""], [], [_cflags_is_set=yes])
-AC_PROG_CC
-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
SPICE_LT_VERSION=m4_format("%d:%d:%d", SPICE_MAJOR, SPICE_MINOR, SPICE_MICRO)
AC_SUBST(SPICE_LT_VERSION)
-# 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)
- 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
@@ -80,84 +23,9 @@ else
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 Check deps
-AC_CHECK_LIBM
-AC_SUBST(LIBM)
-
-AC_CHECK_LIB(rt, clock_gettime,
- AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [Defined if we have clock_gettime()])
- LIBRT=-lrt
- )
-AC_SUBST(LIBRT)
-
-SPICE_NONPKGCONFIG_LIBS+=" $LIBM $LIBRT"
-
-SPICE_REQUIRES=""
-
-PKG_CHECK_MODULES(LOG4CPP, log4cpp)
-AC_SUBST(LOG4CPP_CFLAGS)
-AC_SUBST(LOG4CPP_LIBS)
-SPICE_REQUIRES+=" log4cpp"
-
-PKG_CHECK_MODULES(QCAIRO, qcairo >= 1.4.6)
-AC_SUBST(QCAIRO_CFLAGS)
-AC_SUBST(QCAIRO_LIBS)
-QCAIRO_LIBDIR=`pkg-config --variable=libdir qcairo`
-AC_SUBST(QCAIRO_LIBDIR)
-SPICE_REQUIRES+=" qcairo >= 1.4.6"
-
-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(FFMPEG, libavcodec libavutil)
-AC_SUBST(FFMPEG_CFLAGS)
-AC_SUBST(FFMPEG_LIBS)
-FFMPEG_LIBDIR=`pkg-config --variable=libdir libavutil`
-AC_SUBST(FFMPEG_LIBDIR)
-SPICE_REQUIRES+=" libavcodec libavutil"
-
-saved_CPPFLAGS="$CPPFLAGS"
-CPPFLAGS="$CPPFLAGS $FFMPEG_CFLAGS"
-AC_CHECK_HEADER(avcodec.h, AVCODEC_PREFIX="", AVCODEC_PREFIX="libavcodec/")
-CPPFLAGS="$saved_CPPFLAGS"
-AC_SUBST([AVCODEC_PREFIX])
-
-PKG_CHECK_MODULES(ALSA, alsa)
-AC_SUBST(ALSA_CFLAGS)
-AC_SUBST(ALSA_LIBS)
-SPICE_REQUIRES+=" alsa"
-
-PKG_CHECK_MODULES(SSL, openssl)
-AC_SUBST(SSL_CFLAGS)
-AC_SUBST(SSL_LIBS)
-SPICE_REQUIRES+=" openssl"
-
-# These are commented out because the gl libraries on RHEL 5 do not have pkgconfig files
-#
-# PKG_CHECK_MODULES(GL, gl glu)
-# AC_SUBST(GL_CFLAGS)
-# AC_SUBST(GL_LIBS)
-# SPICE_REQUIRES+=" gl glu"
-
-have_gl=yes
-AC_CHECK_LIB(GL, glBlendFunc, GL_LIBS="$GL_LIBS -lGL", have_gl=no)
-AC_CHECK_LIB(GLU, gluSphere, GL_LIBS="$GL_LIBS -lGLU", have_gl=no)
-
-if test "x$have_gl" = "xno"; then
- AC_MSG_ERROR([GL libraries not available])
-fi
-
-AC_SUBST(GL_LIBS)
-SPICE_NONPKGCONFIG_LIBS+=" $GL_LIBS"
PKG_CHECK_MODULES(XRANDR, xrandr)
AC_SUBST(XRANDR_CFLAGS)
@@ -174,103 +42,11 @@ if test "x$have_xrandr12" = "xyes" ; then
AC_DEFINE([HAVE_XRANDR12], [], [Define if we have XRANDR 12])
fi
-# 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,
- [ --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 -O3"
-])
-
-
-AS_IF([test "$_cxxflags_is_set" = "yes"], [], [
- CXXFLAGS="-g -O3"
-])
-
-
-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 -Werror -Wno-deprecated-declarations"
-
-
-# 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
-
- 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(WARN_CFLAGS)
-AC_SUBST(CFLAGS_CFLAGS)
+PKG_CHECK_MODULES(LOG4CPP, log4cpp)
+AC_SUBST(LOG4CPP_CFLAGS)
+AC_SUBST(LOG4CPP_LIBS)
+SPICE_REQUIRES+=" log4cpp"
dnl =========================================================================
dnl -fvisibility stuff
@@ -296,9 +72,6 @@ AC_SUBST(SPICE_REQUIRES)
AC_SUBST(SPICE_NONPKGCONFIG_CFLAGS)
AC_SUBST(SPICE_NONPKGCONFIG_LIBS)
-AC_SUBST([SPICEC_STATIC_LINKAGE_BSTATIC])
-AC_SUBST([SPICEC_STATIC_LINKAGE_BDYNAMIC])
-
AC_OUTPUT([
Makefile
spice.pc
diff --git a/configure.ac.shared b/configure.ac.shared
new file mode 100644
index 00000000..93ad6893
--- /dev/null
+++ b/configure.ac.shared
@@ -0,0 +1,245 @@
+dnl
+dnl this file is shared by all spice configure.ac files, that
+dnl m4_include(<myname>)
+dnl
+
+AM_CONFIG_HEADER([config.h])
+AC_CONFIG_AUX_DIR(.)
+
+AM_INIT_AUTOMAKE([dist-bzip2])
+AM_MAINTAINER_MODE
+
+AS_IF([test "$CFLAGS" = ""], [], [_cflags_is_set=yes])
+AC_PROG_CC
+AS_IF([test "$CXXFLAGS" = ""], [], [_cxxflags_is_set=yes])
+AC_PROG_CXX
+AC_PROG_INSTALL
+AC_CANONICAL_HOST
+AM_PROG_CC_C_O
+
+# 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)
+ 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])
+
+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 Check Dependencies
+
+SPICE_REQUIRES=""
+
+AC_CHECK_LIBM
+AC_SUBST(LIBM)
+
+AC_CHECK_LIB(rt, clock_gettime,
+ AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [Defined if we have clock_gettime()])
+ LIBRT=-lrt
+ )
+AC_SUBST(LIBRT)
+
+SPICE_NONPKGCONFIG_LIBS+=" $LIBM $LIBRT"
+
+PKG_CHECK_MODULES(QCAIRO, qcairo >= 1.4.6)
+AC_SUBST(QCAIRO_CFLAGS)
+AC_SUBST(QCAIRO_LIBS)
+QCAIRO_LIBDIR=`pkg-config --variable=libdir qcairo`
+AC_SUBST(QCAIRO_LIBDIR)
+SPICE_REQUIRES+=" qcairo >= 1.4.6"
+
+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(FFMPEG, libavcodec libavutil)
+AC_SUBST(FFMPEG_CFLAGS)
+AC_SUBST(FFMPEG_LIBS)
+FFMPEG_LIBDIR=`pkg-config --variable=libdir libavutil`
+AC_SUBST(FFMPEG_LIBDIR)
+SPICE_REQUIRES+=" libavcodec libavutil"
+
+saved_CPPFLAGS="$CPPFLAGS"
+CPPFLAGS="$CPPFLAGS $FFMPEG_CFLAGS"
+AC_CHECK_HEADER(avcodec.h, AVCODEC_PREFIX="", AVCODEC_PREFIX="libavcodec/")
+CPPFLAGS="$saved_CPPFLAGS"
+AC_SUBST([AVCODEC_PREFIX])
+
+PKG_CHECK_MODULES(ALSA, alsa)
+AC_SUBST(ALSA_CFLAGS)
+AC_SUBST(ALSA_LIBS)
+SPICE_REQUIRES+=" alsa"
+
+PKG_CHECK_MODULES(SSL, openssl)
+AC_SUBST(SSL_CFLAGS)
+AC_SUBST(SSL_LIBS)
+SPICE_REQUIRES+=" openssl"
+
+# These are commented out because the gl libraries on RHEL 5 do not have pkgconfig files
+#
+# PKG_CHECK_MODULES(GL, gl glu)
+# AC_SUBST(GL_CFLAGS)
+# AC_SUBST(GL_LIBS)
+# SPICE_REQUIRES+=" gl glu"
+
+have_gl=yes
+AC_CHECK_LIB(GL, glBlendFunc, GL_LIBS="$GL_LIBS -lGL", have_gl=no)
+AC_CHECK_LIB(GLU, gluSphere, GL_LIBS="$GL_LIBS -lGLU", have_gl=no)
+
+if test "x$have_gl" = "xno"; then
+ AC_MSG_ERROR([GL libraries not available])
+fi
+
+AC_SUBST(GL_LIBS)
+SPICE_NONPKGCONFIG_LIBS+=" $GL_LIBS"
+
+
+
+dnl =========================================================================
+dnl configure arguments
+
+# 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,
+ [ --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"]])
+
+AC_SUBST([SPICEC_STATIC_LINKAGE_BSTATIC])
+AC_SUBST([SPICEC_STATIC_LINKAGE_BDYNAMIC])
+
+
+dnl ===========================================================================
+dnl check compiler flags
+
+AS_IF([test "$_cflags_is_set" = "yes"], [], [
+ CFLAGS="-g -O3"
+])
+
+AS_IF([test "$_cxxflags_is_set" = "yes"], [], [
+ CXXFLAGS="-g -O3"
+])
+
+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 -Werror -Wno-deprecated-declarations"
+
+
+# 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
+
+ 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(WARN_CFLAGS)
+AC_SUBST(CFLAGS_CFLAGS)