summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorChristophe Fergeau <cfergeau@redhat.com>2013-08-13 17:56:45 +0200
committerChristophe Fergeau <cfergeau@redhat.com>2013-08-13 18:40:29 +0200
commitd7730acae904b75c11664b4cf90a7653f94d9636 (patch)
treee6ffd12c51d4bad35805f7e4f0065545f64b76c8 /m4
Import basic library framework
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Diffstat (limited to 'm4')
-rw-r--r--m4/manywarnings.m4222
-rw-r--r--m4/virt-compile-warnings.m4235
-rw-r--r--m4/virt-coverage.m421
-rw-r--r--m4/virt-gettext.m418
-rw-r--r--m4/virt-gtk-misc.m47
-rw-r--r--m4/virt-introspection.m426
-rw-r--r--m4/virt-win32.m420
-rw-r--r--m4/warnings.m470
8 files changed, 619 insertions, 0 deletions
diff --git a/m4/manywarnings.m4 b/m4/manywarnings.m4
new file mode 100644
index 0000000..be6d4c9
--- /dev/null
+++ b/m4/manywarnings.m4
@@ -0,0 +1,222 @@
+# manywarnings.m4 serial 5
+dnl Copyright (C) 2008-2013 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Simon Josefsson
+
+# gl_MANYWARN_COMPLEMENT(OUTVAR, LISTVAR, REMOVEVAR)
+# --------------------------------------------------
+# Copy LISTVAR to OUTVAR except for the entries in REMOVEVAR.
+# Elements separated by whitespace. In set logic terms, the function
+# does OUTVAR = LISTVAR \ REMOVEVAR.
+AC_DEFUN([gl_MANYWARN_COMPLEMENT],
+[
+ gl_warn_set=
+ set x $2; shift
+ for gl_warn_item
+ do
+ case " $3 " in
+ *" $gl_warn_item "*)
+ ;;
+ *)
+ gl_warn_set="$gl_warn_set $gl_warn_item"
+ ;;
+ esac
+ done
+ $1=$gl_warn_set
+])
+
+# gl_MANYWARN_ALL_GCC(VARIABLE)
+# -----------------------------
+# Add all documented GCC warning parameters to variable VARIABLE.
+# Note that you need to test them using gl_WARN_ADD if you want to
+# make sure your gcc understands it.
+AC_DEFUN([gl_MANYWARN_ALL_GCC],
+[
+ dnl First, check for some issues that only occur when combining multiple
+ dnl gcc warning categories.
+ AC_REQUIRE([AC_PROG_CC])
+ if test -n "$GCC"; then
+
+ dnl Check if -W -Werror -Wno-missing-field-initializers is supported
+ dnl with the current $CC $CFLAGS $CPPFLAGS.
+ AC_MSG_CHECKING([whether -Wno-missing-field-initializers is supported])
+ AC_CACHE_VAL([gl_cv_cc_nomfi_supported], [
+ gl_save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -W -Werror -Wno-missing-field-initializers"
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([[]], [[]])],
+ [gl_cv_cc_nomfi_supported=yes],
+ [gl_cv_cc_nomfi_supported=no])
+ CFLAGS="$gl_save_CFLAGS"])
+ AC_MSG_RESULT([$gl_cv_cc_nomfi_supported])
+
+ if test "$gl_cv_cc_nomfi_supported" = yes; then
+ dnl Now check whether -Wno-missing-field-initializers is needed
+ dnl for the { 0, } construct.
+ AC_MSG_CHECKING([whether -Wno-missing-field-initializers is needed])
+ AC_CACHE_VAL([gl_cv_cc_nomfi_needed], [
+ gl_save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -W -Werror"
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[void f (void)
+ {
+ typedef struct { int a; int b; } s_t;
+ s_t s1 = { 0, };
+ }
+ ]],
+ [[]])],
+ [gl_cv_cc_nomfi_needed=no],
+ [gl_cv_cc_nomfi_needed=yes])
+ CFLAGS="$gl_save_CFLAGS"
+ ])
+ AC_MSG_RESULT([$gl_cv_cc_nomfi_needed])
+ fi
+
+ dnl Next, check if -Werror -Wuninitialized is useful with the
+ dnl user's choice of $CFLAGS; some versions of gcc warn that it
+ dnl has no effect if -O is not also used
+ AC_MSG_CHECKING([whether -Wuninitialized is supported])
+ AC_CACHE_VAL([gl_cv_cc_uninitialized_supported], [
+ gl_save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -Werror -Wuninitialized"
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([[]], [[]])],
+ [gl_cv_cc_uninitialized_supported=yes],
+ [gl_cv_cc_uninitialized_supported=no])
+ CFLAGS="$gl_save_CFLAGS"])
+ AC_MSG_RESULT([$gl_cv_cc_uninitialized_supported])
+
+ fi
+
+ # List all gcc warning categories.
+ gl_manywarn_set=
+ for gl_manywarn_item in \
+ -W \
+ -Wabi \
+ -Waddress \
+ -Waggressive-loop-optimizations \
+ -Wall \
+ -Warray-bounds \
+ -Wattributes \
+ -Wbad-function-cast \
+ -Wbuiltin-macro-redefined \
+ -Wcast-align \
+ -Wchar-subscripts \
+ -Wclobbered \
+ -Wcomment \
+ -Wcomments \
+ -Wcoverage-mismatch \
+ -Wcpp \
+ -Wdeprecated \
+ -Wdeprecated-declarations \
+ -Wdisabled-optimization \
+ -Wdiv-by-zero \
+ -Wdouble-promotion \
+ -Wempty-body \
+ -Wendif-labels \
+ -Wenum-compare \
+ -Wextra \
+ -Wformat-contains-nul \
+ -Wformat-extra-args \
+ -Wformat-nonliteral \
+ -Wformat-security \
+ -Wformat-y2k \
+ -Wformat-zero-length \
+ -Wfree-nonheap-object \
+ -Wignored-qualifiers \
+ -Wimplicit \
+ -Wimplicit-function-declaration \
+ -Wimplicit-int \
+ -Winit-self \
+ -Winline \
+ -Wint-to-pointer-cast \
+ -Winvalid-memory-model \
+ -Winvalid-pch \
+ -Wjump-misses-init \
+ -Wlogical-op \
+ -Wmain \
+ -Wmaybe-uninitialized \
+ -Wmissing-braces \
+ -Wmissing-declarations \
+ -Wmissing-field-initializers \
+ -Wmissing-include-dirs \
+ -Wmissing-parameter-type \
+ -Wmissing-prototypes \
+ -Wmudflap \
+ -Wmultichar \
+ -Wnarrowing \
+ -Wnested-externs \
+ -Wnonnull \
+ -Wnormalized=nfc \
+ -Wold-style-declaration \
+ -Wold-style-definition \
+ -Woverflow \
+ -Woverlength-strings \
+ -Woverride-init \
+ -Wpacked \
+ -Wpacked-bitfield-compat \
+ -Wparentheses \
+ -Wpointer-arith \
+ -Wpointer-sign \
+ -Wpointer-to-int-cast \
+ -Wpragmas \
+ -Wreturn-local-addr \
+ -Wreturn-type \
+ -Wsequence-point \
+ -Wshadow \
+ -Wsizeof-pointer-memaccess \
+ -Wstack-protector \
+ -Wstrict-aliasing \
+ -Wstrict-overflow \
+ -Wstrict-prototypes \
+ -Wsuggest-attribute=const \
+ -Wsuggest-attribute=format \
+ -Wsuggest-attribute=noreturn \
+ -Wsuggest-attribute=pure \
+ -Wswitch \
+ -Wswitch-default \
+ -Wsync-nand \
+ -Wsystem-headers \
+ -Wtrampolines \
+ -Wtrigraphs \
+ -Wtype-limits \
+ -Wuninitialized \
+ -Wunknown-pragmas \
+ -Wunsafe-loop-optimizations \
+ -Wunused \
+ -Wunused-but-set-parameter \
+ -Wunused-but-set-variable \
+ -Wunused-function \
+ -Wunused-label \
+ -Wunused-local-typedefs \
+ -Wunused-macros \
+ -Wunused-parameter \
+ -Wunused-result \
+ -Wunused-value \
+ -Wunused-variable \
+ -Wvarargs \
+ -Wvariadic-macros \
+ -Wvector-operation-performance \
+ -Wvla \
+ -Wvolatile-register-var \
+ -Wwrite-strings \
+ \
+ ; do
+ gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item"
+ done
+
+ # Disable specific options as needed.
+ if test "$gl_cv_cc_nomfi_needed" = yes; then
+ gl_manywarn_set="$gl_manywarn_set -Wno-missing-field-initializers"
+ fi
+
+ if test "$gl_cv_cc_uninitialized_supported" = no; then
+ gl_manywarn_set="$gl_manywarn_set -Wno-uninitialized"
+ fi
+
+ $1=$gl_manywarn_set
+])
diff --git a/m4/virt-compile-warnings.m4 b/m4/virt-compile-warnings.m4
new file mode 100644
index 0000000..337021f
--- /dev/null
+++ b/m4/virt-compile-warnings.m4
@@ -0,0 +1,235 @@
+dnl
+dnl Enable all known GCC compiler warnings, except for those
+dnl we can't yet cope with
+dnl
+AC_DEFUN([LIBVIRT_BUILDER_COMPILE_WARNINGS],[
+ dnl ******************************
+ dnl More compiler warnings
+ dnl ******************************
+
+ 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])
+
+ # List of warnings that are not relevant / wanted
+
+ # Don't care about C++ compiler compat
+ dontwarn="$dontwarn -Wc++-compat"
+ dontwarn="$dontwarn -Wabi"
+ dontwarn="$dontwarn -Wdeprecated"
+ # Don't care about ancient C standard compat
+ dontwarn="$dontwarn -Wtraditional"
+ # Don't care about ancient C standard compat
+ dontwarn="$dontwarn -Wtraditional-conversion"
+ # Ignore warnings in /usr/include
+ dontwarn="$dontwarn -Wsystem-headers"
+ # Happy for compiler to add struct padding
+ dontwarn="$dontwarn -Wpadded"
+ # GCC very confused with -O2
+ dontwarn="$dontwarn -Wunreachable-code"
+ # Too many to deal with
+ dontwarn="$dontwarn -Wconversion"
+ # Too many to deal with
+ dontwarn="$dontwarn -Wsign-conversion"
+ # GNULIB gettext.h violates
+ dontwarn="$dontwarn -Wvla"
+ # Many GNULIB header violations
+ dontwarn="$dontwarn -Wundef"
+ # Need to allow bad cast for execve()
+ dontwarn="$dontwarn -Wcast-qual"
+ # We need to use long long in many places
+ dontwarn="$dontwarn -Wlong-long"
+ # We allow manual list of all enum cases without default:
+ dontwarn="$dontwarn -Wswitch-default"
+ # We allow optional default: instead of listing all enum values
+ dontwarn="$dontwarn -Wswitch-enum"
+ # Not a problem since we don't use -fstrict-overflow
+ dontwarn="$dontwarn -Wstrict-overflow"
+ # Not a problem since we don't use -funsafe-loop-optimizations
+ dontwarn="$dontwarn -Wunsafe-loop-optimizations"
+ # Things like virAsprintf mean we can't use this
+ dontwarn="$dontwarn -Wformat-nonliteral"
+ # Gnulib's stat-time.h violates this
+ dontwarn="$dontwarn -Waggregate-return"
+ # gcc 4.4.6 complains this is C++ only; gcc 4.7.0 implies this from -Wall
+ dontwarn="$dontwarn -Wenum-compare"
+
+ # gcc 4.2 treats attribute(format) as an implicit attribute(nonnull),
+ # which triggers spurious warnings for our usage
+ AC_CACHE_CHECK([whether the C compiler's -Wformat allows NULL strings],
+ [lv_cv_gcc_wformat_null_works], [
+ save_CFLAGS=$CFLAGS
+ CFLAGS='-Wunknown-pragmas -Werror -Wformat'
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+ #include <stddef.h>
+ static __attribute__ ((__format__ (__printf__, 1, 2))) int
+ foo (const char *fmt, ...) { return !fmt; }
+ ]], [[
+ return foo(NULL);
+ ]])],
+ [lv_cv_gcc_wformat_null_works=yes],
+ [lv_cv_gcc_wformat_null_works=no])
+ CFLAGS=$save_CFLAGS])
+
+ # Gnulib uses '#pragma GCC diagnostic push' to silence some
+ # warnings, but older gcc doesn't support this.
+ AC_CACHE_CHECK([whether pragma GCC diagnostic push works],
+ [lv_cv_gcc_pragma_push_works], [
+ save_CFLAGS=$CFLAGS
+ CFLAGS='-Wunknown-pragmas -Werror'
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+ #pragma GCC diagnostic push
+ #pragma GCC diagnostic pop
+ ]])],
+ [lv_cv_gcc_pragma_push_works=yes],
+ [lv_cv_gcc_pragma_push_works=no])
+ CFLAGS=$save_CFLAGS])
+ if test $lv_cv_gcc_pragma_push_works = no; then
+ dontwarn="$dontwarn -Wmissing-prototypes"
+ dontwarn="$dontwarn -Wmissing-declarations"
+ dontwarn="$dontwarn -Wcast-align"
+ else
+ AC_DEFINE_UNQUOTED([WORKING_PRAGMA_PUSH], 1,
+ [Define to 1 if gcc supports pragma push/pop])
+ fi
+
+ dnl Check whether strchr(s, char variable) causes a bogus compile
+ dnl warning, which is the case with GCC < 4.6 on some glibc
+ AC_CACHE_CHECK([whether the C compiler's -Wlogical-op gives bogus warnings],
+ [lv_cv_gcc_wlogical_op_broken], [
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="-O2 -Wlogical-op -Werror"
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+ #include <string.h>
+ ]], [[
+ const char *haystack;
+ char needle;
+ return strchr(haystack, needle) == haystack;]])],
+ [lv_cv_gcc_wlogical_op_broken=no],
+ [lv_cv_gcc_wlogical_op_broken=yes])
+ CFLAGS="$save_CFLAGS"])
+
+ # We might fundamentally need some of these disabled forever, but
+ # ideally we'd turn many of them on
+ dontwarn="$dontwarn -Wfloat-equal"
+ dontwarn="$dontwarn -Wdeclaration-after-statement"
+ dontwarn="$dontwarn -Wcast-qual"
+ dontwarn="$dontwarn -Wconversion"
+ dontwarn="$dontwarn -Wsign-conversion"
+ dontwarn="$dontwarn -Wpacked"
+ dontwarn="$dontwarn -Wunused-macros"
+ dontwarn="$dontwarn -Woverlength-strings"
+ dontwarn="$dontwarn -Wstack-protector"
+
+ # Get all possible GCC warnings
+ gl_MANYWARN_ALL_GCC([maybewarn])
+
+ # Remove the ones we don't want, blacklisted earlier
+ gl_MANYWARN_COMPLEMENT([wantwarn], [$maybewarn], [$dontwarn])
+
+ # Check for $CC support of each warning
+ for w in $wantwarn; do
+ gl_WARN_ADD([$w])
+ done
+
+ # GNULIB uses '-W' (aka -Wextra) which includes a bunch of stuff.
+ # Unfortunately, this means you can't simply use '-Wsign-compare'
+ # with gl_MANYWARN_COMPLEMENT
+ # So we have -W enabled, and then have to explicitly turn off...
+ gl_WARN_ADD([-Wno-sign-compare])
+
+ # GNULIB expects this to be part of -Wc++-compat, but we turn
+ # that one off, so we need to manually enable this again
+ gl_WARN_ADD([-Wjump-misses-init])
+
+ # GNULIB turns on -Wformat=2 which implies -Wformat-nonliteral,
+ # so we need to manually re-exclude it. Also, older gcc 4.2
+ # added an implied ATTRIBUTE_NONNULL on any parameter marked
+ # ATTRIBUTE_FMT_PRINT, which causes -Wformat failure on our
+ # intentional use of virReportError(code, NULL).
+ gl_WARN_ADD([-Wno-format-nonliteral])
+ if test $lv_cv_gcc_wformat_null_works = no; then
+ gl_WARN_ADD([-Wno-format])
+ fi
+
+ # This should be < 256 really. Currently we're down to 4096,
+ # but using 1024 bytes sized buffers (mostly for virStrerror)
+ # stops us from going down further
+ gl_WARN_ADD([-Wframe-larger-than=4096])
+ dnl gl_WARN_ADD([-Wframe-larger-than=256])
+
+ # Silence certain warnings in gnulib, and use improved glibc headers
+ AC_DEFINE([lint], [1],
+ [Define to 1 if the compiler is checking for lint.])
+ AH_VERBATIM([FORTIFY_SOURCE],
+ [/* Enable compile-time and run-time bounds-checking, and some warnings,
+ without upsetting newer glibc. */
+ #if !defined _FORTIFY_SOURCE && defined __OPTIMIZE__ && __OPTIMIZE__
+ # define _FORTIFY_SOURCE 2
+ #endif
+ ])
+
+ # Extra special flags
+ dnl -fstack-protector stuff passes gl_WARN_ADD with gcc
+ dnl on Mingw32, but fails when actually used
+ case $host in
+ *-*-linux*)
+ dnl Fedora only uses -fstack-protector, but doesn't seem to
+ dnl be great overhead in adding -fstack-protector-all instead
+ dnl gl_WARN_ADD([-fstack-protector])
+ gl_WARN_ADD([-fstack-protector-all])
+ gl_WARN_ADD([--param=ssp-buffer-size=4])
+ dnl Even though it supports it, clang complains about
+ dnl use of --param=ssp-buffer-size=4 unless used with
+ dnl the -c arg. It doesn't like it when used with args
+ dnl that just link together .o files. Unfortunately
+ dnl we can't avoid that with automake, so we must turn
+ dnl off the following clang specific warning
+ gl_WARN_ADD([-Wno-unused-command-line-argument])
+ ;;
+ *-*-freebsd*)
+ dnl FreeBSD ships old gcc 4.2.1 which doesn't handle
+ dnl -fstack-protector-all well
+ gl_WARN_ADD([-fstack-protector])
+
+ gl_WARN_ADD([-Wno-unused-command-line-argument])
+ ;;
+ esac
+ gl_WARN_ADD([-fexceptions])
+ gl_WARN_ADD([-fasynchronous-unwind-tables])
+ gl_WARN_ADD([-fdiagnostics-show-option])
+ gl_WARN_ADD([-funit-at-a-time])
+
+ # Need -fipa-pure-const in order to make -Wsuggest-attribute=pure
+ # fire even without -O.
+ gl_WARN_ADD([-fipa-pure-const])
+ # We should eventually enable this, but right now there are at
+ # least 75 functions triggering warnings.
+ gl_WARN_ADD([-Wno-suggest-attribute=pure])
+ gl_WARN_ADD([-Wno-suggest-attribute=const])
+
+ if test "$set_werror" = "yes"
+ then
+ gl_WARN_ADD([-Werror])
+ fi
+
+ dnl Needed to keep compile quiet on python 2.4
+ save_WARN_CFLAGS=$WARN_CFLAGS
+ WARN_CFLAGS=
+ gl_WARN_ADD([-Wno-redundant-decls])
+ WARN_PYTHON_CFLAGS=$WARN_CFLAGS
+ AC_SUBST(WARN_PYTHON_CFLAGS)
+ WARN_CFLAGS=$save_WARN_CFLAGS
+
+ if test "$gl_cv_warn_c__Wlogical_op" = yes &&
+ test "$lv_cv_gcc_wlogical_op_broken" = yes; then
+ AC_DEFINE_UNQUOTED([BROKEN_GCC_WLOGICALOP], 1,
+ [Define to 1 if gcc -Wlogical-op reports false positives on strchr])
+ fi
+])
diff --git a/m4/virt-coverage.m4 b/m4/virt-coverage.m4
new file mode 100644
index 0000000..faa887a
--- /dev/null
+++ b/m4/virt-coverage.m4
@@ -0,0 +1,21 @@
+AC_DEFUN([LIBVIRT_BUILDER_COVERAGE],[
+ AC_ARG_ENABLE([test-coverage],
+ [ --enable-test-coverage turn on code coverage instrumentation],
+ [case "${enableval}" in
+ yes|no) ;;
+ *) AC_MSG_ERROR([bad value ${enableval} for test-coverage option]) ;;
+ esac],
+ [enableval=no])
+ enable_coverage=$enableval
+
+ if test "${enable_coverage}" = yes; then
+ save_WARN_CFLAGS=$WARN_CFLAGS
+ WARN_CFLAGS=
+ gl_WARN_ADD([-fprofile-arcs])
+ gl_WARN_ADD([-ftest-coverage])
+ COVERAGE_FLAGS=$WARN_CFLAGS
+ AC_SUBST([COVERAGE_CFLAGS], [$COVERAGE_FLAGS])
+ AC_SUBST([COVERAGE_LDFLAGS], [$COVERAGE_FLAGS])
+ WARN_CFLAGS=$save_WARN_CFLAGS
+ fi
+])
diff --git a/m4/virt-gettext.m4 b/m4/virt-gettext.m4
new file mode 100644
index 0000000..504272d
--- /dev/null
+++ b/m4/virt-gettext.m4
@@ -0,0 +1,18 @@
+AC_DEFUN([LIBVIRT_BUILDER_GETTEXT],[
+ # Autoconf 2.61a.99 and earlier don't support linking a file only
+ # in VPATH builds. But since GNUmakefile is for maintainer use
+ # only, it does not matter if we skip the link with older autoconf.
+ # Automake 1.10.1 and earlier try to remove GNUmakefile in non-VPATH
+ # builds, so use a shell variable to bypass this.
+ GNUmakefile=GNUmakefile
+ m4_if(m4_version_compare([2.61a.100],
+ m4_defn([m4_PACKAGE_VERSION])), [1], [],
+ [AC_CONFIG_LINKS([$GNUmakefile:$GNUmakefile], [],
+ [GNUmakefile=$GNUmakefile])])
+
+ GETTEXT_PACKAGE=libvirt-builder
+ AC_SUBST(GETTEXT_PACKAGE)
+ AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],"$GETTEXT_PACKAGE", [GETTEXT package name])
+
+ dnl IT_PROG_INTLTOOL([0.35.0])
+])
diff --git a/m4/virt-gtk-misc.m4 b/m4/virt-gtk-misc.m4
new file mode 100644
index 0000000..4efec6b
--- /dev/null
+++ b/m4/virt-gtk-misc.m4
@@ -0,0 +1,7 @@
+AC_DEFUN([LIBVIRT_BUILDER_GTK_MISC],[
+ GTK_DOC_CHECK([1.10],[--flavour no-tmpl])
+
+ # Setup GLIB_MKENUMS to use glib-mkenums even if GLib is uninstalled.
+ GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0`
+ AC_SUBST(GLIB_MKENUMS)
+])
diff --git a/m4/virt-introspection.m4 b/m4/virt-introspection.m4
new file mode 100644
index 0000000..5325b48
--- /dev/null
+++ b/m4/virt-introspection.m4
@@ -0,0 +1,26 @@
+AC_DEFUN([LIBVIRT_BUILDER_INTROSPECTION],[
+ AC_ARG_ENABLE([introspection],
+ AS_HELP_STRING([--enable-introspection], [enable GObject introspection]),
+ [], [enable_introspection=check])
+
+ if test "x$enable_introspection" != "xno" ; then
+ PKG_CHECK_MODULES([GOBJECT_INTROSPECTION],
+ [gobject-introspection-1.0 >= $GOBJECT_INTROSPECTION_REQUIRED],
+ [enable_introspection=yes],
+ [
+ if test "x$enable_introspection" = "xcheck"; then
+ enable_introspection=no
+ else
+ AC_MSG_ERROR([gobject-introspection is not available])
+ fi
+ ])
+ if test "x$enable_introspection" = "xyes" ; then
+ AC_DEFINE([WITH_GOBJECT_INTROSPECTION], [1], [enable GObject introspection support])
+ AC_SUBST(GOBJECT_INTROSPECTION_CFLAGS)
+ AC_SUBST(GOBJECT_INTROSPECTION_LIBS)
+ AC_SUBST([G_IR_SCANNER], [$($PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0)])
+ AC_SUBST([G_IR_COMPILER], [$($PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0)])
+ fi
+ fi
+ AM_CONDITIONAL([WITH_INTROSPECTION], [test "x$enable_introspection" = "xyes"])
+])
diff --git a/m4/virt-win32.m4 b/m4/virt-win32.m4
new file mode 100644
index 0000000..090565e
--- /dev/null
+++ b/m4/virt-win32.m4
@@ -0,0 +1,20 @@
+AC_DEFUN([LIBVIRT_BUILDER_WIN32],[
+ dnl Extra link-time flags for Cygwin.
+ dnl Copied from libxml2 configure.in, but I removed mingw changes
+ dnl for now since I'm not supporting mingw at present. - RWMJ
+ CYGWIN_EXTRA_LDFLAGS=
+ CYGWIN_EXTRA_LIBADD=
+ MINGW_EXTRA_LDFLAGS=
+ case "$host" in
+ *-*-cygwin*)
+ CYGWIN_EXTRA_LDFLAGS="-no-undefined"
+ CYGWIN_EXTRA_LIBADD="${INTLLIBS}"
+ ;;
+ *-*-mingw*)
+ MINGW_EXTRA_LDFLAGS="-no-undefined"
+ ;;
+ esac
+ AC_SUBST([CYGWIN_EXTRA_LDFLAGS])
+ AC_SUBST([CYGWIN_EXTRA_LIBADD])
+ AC_SUBST([MINGW_EXTRA_LDFLAGS])
+])
diff --git a/m4/warnings.m4 b/m4/warnings.m4
new file mode 100644
index 0000000..1848732
--- /dev/null
+++ b/m4/warnings.m4
@@ -0,0 +1,70 @@
+# warnings.m4 serial 8
+dnl Copyright (C) 2008-2013 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Simon Josefsson
+
+# gl_AS_VAR_APPEND(VAR, VALUE)
+# ----------------------------
+# Provide the functionality of AS_VAR_APPEND if Autoconf does not have it.
+m4_ifdef([AS_VAR_APPEND],
+[m4_copy([AS_VAR_APPEND], [gl_AS_VAR_APPEND])],
+[m4_define([gl_AS_VAR_APPEND],
+[AS_VAR_SET([$1], [AS_VAR_GET([$1])$2])])])
+
+
+# gl_COMPILER_OPTION_IF(OPTION, [IF-SUPPORTED], [IF-NOT-SUPPORTED],
+# [PROGRAM = AC_LANG_PROGRAM()])
+# -----------------------------------------------------------------
+# Check if the compiler supports OPTION when compiling PROGRAM.
+#
+# FIXME: gl_Warn must be used unquoted until we can assume Autoconf
+# 2.64 or newer.
+AC_DEFUN([gl_COMPILER_OPTION_IF],
+[AS_VAR_PUSHDEF([gl_Warn], [gl_cv_warn_[]_AC_LANG_ABBREV[]_$1])dnl
+AS_VAR_PUSHDEF([gl_Flags], [_AC_LANG_PREFIX[]FLAGS])dnl
+AC_CACHE_CHECK([whether _AC_LANG compiler handles $1], m4_defn([gl_Warn]), [
+ gl_save_compiler_FLAGS="$gl_Flags"
+ gl_AS_VAR_APPEND(m4_defn([gl_Flags]), [" $gl_unknown_warnings_are_errors $1"])
+ AC_COMPILE_IFELSE([m4_default([$4], [AC_LANG_PROGRAM([])])],
+ [AS_VAR_SET(gl_Warn, [yes])],
+ [AS_VAR_SET(gl_Warn, [no])])
+ gl_Flags="$gl_save_compiler_FLAGS"
+])
+AS_VAR_IF(gl_Warn, [yes], [$2], [$3])
+AS_VAR_POPDEF([gl_Flags])dnl
+AS_VAR_POPDEF([gl_Warn])dnl
+])
+
+# gl_UNKNOWN_WARNINGS_ARE_ERRORS
+# ------------------------------
+# Clang doesn't complain about unknown warning options unless one also
+# specifies -Wunknown-warning-option -Werror. Detect this.
+AC_DEFUN([gl_UNKNOWN_WARNINGS_ARE_ERRORS],
+[gl_COMPILER_OPTION_IF([-Werror -Wunknown-warning-option],
+ [gl_unknown_warnings_are_errors='-Wunknown-warning-option -Werror'],
+ [gl_unknown_warnings_are_errors=])])
+
+# gl_WARN_ADD(OPTION, [VARIABLE = WARN_CFLAGS],
+# [PROGRAM = AC_LANG_PROGRAM()])
+# ---------------------------------------------
+# Adds parameter to WARN_CFLAGS if the compiler supports it when
+# compiling PROGRAM. For example, gl_WARN_ADD([-Wparentheses]).
+#
+# If VARIABLE is a variable name, AC_SUBST it.
+AC_DEFUN([gl_WARN_ADD],
+[AC_REQUIRE([gl_UNKNOWN_WARNINGS_ARE_ERRORS])
+gl_COMPILER_OPTION_IF([$1],
+ [gl_AS_VAR_APPEND(m4_if([$2], [], [[WARN_CFLAGS]], [[$2]]), [" $1"])],
+ [],
+ [$3])
+m4_ifval([$2],
+ [AS_LITERAL_IF([$2], [AC_SUBST([$2])])],
+ [AC_SUBST([WARN_CFLAGS])])dnl
+])
+
+# Local Variables:
+# mode: autoconf
+# End: