1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-27 06:50:23 +03:00

Thu Mar 01 16:17:48 EST 2007 Mark McLoughlin <markmc@redhat.com>

* acinclude.m4: add LIBVIRT_COMPILE_WARNINGS, copied from
        GNOME but with a few more flags we'd been using.

        * configure.in: use that instead of setting CFLAGS
        directly.

        * proxy/Makefile.am, python/Makefile.am, qemud/Makefile.am,
          src/Makefile.am, tests/Makefile.am: use $(WARN_CFLAGS)
This commit is contained in:
Mark McLoughlin 2007-03-01 16:18:55 +00:00
parent b48326ecd0
commit 51d5609843
8 changed files with 109 additions and 11 deletions

View File

@ -1,3 +1,14 @@
Thu Mar 01 16:17:48 EST 2007 Mark McLoughlin <markmc@redhat.com>
* acinclude.m4: add LIBVIRT_COMPILE_WARNINGS, copied from
GNOME but with a few more flags we'd been using.
* configure.in: use that instead of setting CFLAGS
directly.
* proxy/Makefile.am, python/Makefile.am, qemud/Makefile.am,
src/Makefile.am, tests/Makefile.am: use $(WARN_CFLAGS)
Thu Mar 01 16:00:12 EST 2007 Mark McLoughlin <markmc@redhat.com>
Fix from Richard W.M. Jones <rjones@redhat.com>

90
acinclude.m4 Normal file
View File

@ -0,0 +1,90 @@
dnl
dnl Taken from gnome-common/macros2/gnome-compiler-flags.m4
dnl
dnl We've added:
dnl -Wextra -Wshadow -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Winline -Wredundant-decls
dnl
AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[
dnl ******************************
dnl More compiler warnings
dnl ******************************
AC_ARG_ENABLE(compile-warnings,
AC_HELP_STRING([--enable-compile-warnings=@<:@no/minimum/yes/maximum/error@:>@],
[Turn on compiler warnings]),,
[enable_compile_warnings="m4_default([$1],[yes])"])
warnCFLAGS=
if test "x$GCC" != xyes; then
enable_compile_warnings=no
fi
warning_flags=
realsave_CFLAGS="$CFLAGS"
case "$enable_compile_warnings" in
no)
warning_flags=
;;
minimum)
warning_flags="-Wall"
;;
yes)
warning_flags="-Wall -Wmissing-prototypes"
;;
maximum|error)
warning_flags="-Wall -Wmissing-prototypes -Wnested-externs -Wpointer-arith"
warning_flags="$warning_flags -Wextra -Wshadow -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Winline -Wredundant-decls"
CFLAGS="$warning_flags $CFLAGS"
for option in -Wno-sign-compare; do
SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $option"
AC_MSG_CHECKING([whether gcc understands $option])
AC_TRY_COMPILE([], [],
has_option=yes,
has_option=no,)
CFLAGS="$SAVE_CFLAGS"
AC_MSG_RESULT($has_option)
if test $has_option = yes; then
warning_flags="$warning_flags $option"
fi
unset has_option
unset SAVE_CFLAGS
done
unset option
if test "$enable_compile_warnings" = "error" ; then
warning_flags="$warning_flags -Werror"
fi
;;
*)
AC_MSG_ERROR(Unknown argument '$enable_compile_warnings' to --enable-compile-warnings)
;;
esac
CFLAGS="$realsave_CFLAGS"
AC_MSG_CHECKING(what warning flags to pass to the C compiler)
AC_MSG_RESULT($warning_flags)
AC_ARG_ENABLE(iso-c,
AC_HELP_STRING([--enable-iso-c],
[Try to warn if code is not ISO C ]),,
[enable_iso_c=no])
AC_MSG_CHECKING(what language compliance flags to pass to the C compiler)
complCFLAGS=
if test "x$enable_iso_c" != "xno"; then
if test "x$GCC" = "xyes"; then
case " $CFLAGS " in
*[\ \ ]-ansi[\ \ ]*) ;;
*) complCFLAGS="$complCFLAGS -ansi" ;;
esac
case " $CFLAGS " in
*[\ \ ]-pedantic[\ \ ]*) ;;
*) complCFLAGS="$complCFLAGS -pedantic" ;;
esac
fi
fi
AC_MSG_RESULT($complCFLAGS)
WARN_CFLAGS="$warning_flags $complCFLAGS"
AC_SUBST(WARN_CFLAGS)
])

View File

@ -50,6 +50,8 @@ test "x$U" != "x" && AC_MSG_ERROR(Compiler not ANSI compliant)
AM_PROG_LIBTOOL
LIBVIRT_COMPILE_WARNINGS(maximum)
dnl Specific dir for HTML output ?
AC_ARG_WITH(html-dir, AC_HELP_STRING([--with-html-dir=path],
[path to base html directory, default $datadir/doc/html]),
@ -71,13 +73,6 @@ else
fi
AC_SUBST(STATIC_BINARIES)
dnl
dnl make CFLAGS very pedantic at least during the devel phase for everybody
dnl
if test "${GCC}" = "yes" ; then
CFLAGS="-g -O -W -Wformat -Wunused -Wimplicit -Wreturn-type -Wswitch -Wcomment -Wtrigraphs -Wformat -Wchar-subscripts -Wuninitialized -Wparentheses -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wredundant-decls -Wall"
fi
dnl --enable-debug=(yes|no)
AC_ARG_ENABLE(debug,
AC_HELP_STRING([--enable-debug=no/yes],

View File

@ -3,7 +3,7 @@
INCLUDES = -I$(top_builddir)/include -I@top_srcdir@/include \
-I@top_srcdir@/proxy -I@top_srcdir@/src @LIBXML_CFLAGS@ \
-DPROXY -DLOCALEBASEDIR=\""$(datadir)/locale"\" \
-DGETTEXT_PACKAGE=\"$(PACKAGE)\"
-DGETTEXT_PACKAGE=\"$(PACKAGE)\" $(WARN_CFLAGS)
libexec_PROGRAMS = libvirt_proxy

View File

@ -3,6 +3,7 @@
SUBDIRS= . tests
INCLUDES = \
$(WARN_CFLAGS) \
-I$(PYTHON_INCLUDES) \
-I$(top_srcdir)/include \
-I$(top_builddir)/include \

View File

@ -14,7 +14,7 @@ libvirt_qemud_SOURCES = qemud.c internal.h protocol.h \
#-D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D_POSIX_C_SOURCE=199506L
libvirt_qemud_CFLAGS = \
-I$(top_srcdir)/include -I$(top_builddir)/include $(LIBXML_CFLAGS) \
-Wall -Wextra -DLOCAL_STATE_DIR="\"$(localstatedir)\"" \
$(WARN_CFLAGS) -DLOCAL_STATE_DIR="\"$(localstatedir)\"" \
-DSYSCONF_DIR="\"$(sysconfdir)\""
libvirt_qemud_LDFLAGS = $(LIBXML_LIBS) $(SYSFS_LIBS)
libvirt_qemud_DEPENDENCIES =

View File

@ -3,7 +3,7 @@
INCLUDES = -I$(top_builddir)/include -I@top_srcdir@/include @LIBXML_CFLAGS@ -I@top_srcdir@/qemud \
-DBINDIR=\""$(libexecdir)"\" -DSBINDIR=\""$(sbindir)"\" -DLOCALEBASEDIR=\""$(datadir)/locale"\" \
-DLOCAL_STATE_DIR=\""$(localstatedir)"\" \
-DGETTEXT_PACKAGE=\"$(PACKAGE)\"
-DGETTEXT_PACKAGE=\"$(PACKAGE)\" $(WARN_CFLAGS)
DEPS = libvirt.la
LDADDS = @STATIC_BINARIES@ libvirt.la
VIRSH_LIBS = @VIRSH_LIBS@

View File

@ -18,7 +18,8 @@ INCLUDES = \
@LIBXML_CFLAGS@ \
-D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=199506L \
-DGETTEXT_PACKAGE=\"$(PACKAGE)\" \
$(COVERAGE_CFLAGS)
$(COVERAGE_CFLAGS) \
$(WARN_CFLAGS)
LDADDS = \
@STATIC_BINARIES@ \