diff options
author | Ray Strode <rstrode@redhat.com> | 2010-10-12 13:29:10 -0400 |
---|---|---|
committer | Ray Strode <rstrode@redhat.com> | 2010-10-12 13:29:10 -0400 |
commit | b584a06d987d09e20d1fdb717bf22dee4175d14f (patch) | |
tree | f5e822ea5966b3c0ad003a033a8e40ba5ca2eedf /configure.ac | |
parent | 05a04e94616da13e079da47e92ac0b4f064b990b (diff) |
configure: drop GNOME specific bits
Since this is a freedesktop project, we probably
shouldn't rely on gnome-common.
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 84 |
1 files changed, 79 insertions, 5 deletions
diff --git a/configure.ac b/configure.ac index 2778c27..ec2e8bf 100644 --- a/configure.ac +++ b/configure.ac @@ -29,11 +29,7 @@ PKG_CHECK_MODULES(GIO, gio-2.0 gio-unix-2.0) PKG_CHECK_MODULES(DBUS_GLIB, dbus-glib-1) PKG_CHECK_MODULES(POLKIT, polkit-gobject-1) -GNOME_COMMON_INIT -GNOME_DEBUG_CHECK -GNOME_COMPILE_WARNINGS([maximum]) -GNOME_CXX_WARNINGS -GNOME_MAINTAINER_MODE_DEFINES +AM_MAINTAINER_MODE([enable]) # client library dependencies LIBACCOUNTSSERVICE_LIBS="$GLIB_LIBS $DBUS_GLIB_LIBS" @@ -45,6 +41,84 @@ GOBJECT_INTROSPECTION_CHECK([0.9.12]) LIBACCOUNTSSERVICE_GIR_INCLUDES="GLib-2.0 GObject-2.0 DBusGLib-1.0" AC_SUBST(LIBACCOUNTSSERVICE_GIR_INCLUDES) + +AC_ARG_ENABLE(more-warnings, + AS_HELP_STRING([--enable-more-warnings], + [Maximum compiler warnings]), + set_more_warnings="$enableval",[ + if test -d $srcdir/.git; then + set_more_warnings=yes + else + set_more_warnings=no + fi]) + +AC_MSG_CHECKING(for more warnings) +if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then + AC_MSG_RESULT(yes) + MAYBE_WARN="\ + -Wall -Wextra \ + -Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes \ + -Wwrite-strings -Wnested-externs -Wpointer-arith \ + -Wswitch-enum -Wstrict-aliasing=2 -Winit-self -Wunsafe-loop-optimizations \ + -Wno-missing-field-initializers -Wno-unused-parameter \ + -Wcast-align -Wsign-compare -Wp,-D_FORTIFY_SOURCE=2" +elif test "$GCC" = "yes"; then + AC_MSG_RESULT(no) + MAYBE_WARN="-Wall -Wno-sign-compare -Wno-deprecated-declarations" +else + AC_MSG_RESULT(no) +fi + +# invalidate cached value if MAYBE_WARN has changed +if test "x$accountsservice_cv_warn_maybe" != "x$MAYBE_WARN"; then + unset accountsservice_cv_warn_cflags +fi + +AC_DEFUN([ACCOUNTSSERVICE_CC_TRY_FLAG], [ + AC_MSG_CHECKING([whether $CC supports $1]) + + accountsservice_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $1" + + AC_COMPILE_IFELSE([ ], [accountsservice_cc_flag=yes], [accountsservice_cc_flag=no]) + CFLAGS="$accountsservice_save_CFLAGS" + + if test "x$accountsservice_cc_flag" = "xyes"; then + ifelse([$2], , :, [$2]) + else + ifelse([$3], , :, [$3]) + fi + AC_MSG_RESULT([$accountsservice_cc_flag]) +]) + +AC_CACHE_CHECK([for supported warning flags], accountsservice_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 + ACCOUNTSSERVICE_CC_TRY_FLAG([$W], [WARN_CFLAGS="$WARN_CFLAGS $W"]) + done + + accountsservice_cv_warn_cflags=$WARN_CFLAGS + accountsservice_cv_warn_maybe=$MAYBE_WARN + + AC_MSG_CHECKING([which warning flags were supported]) +]) + +WARN_CFLAGS="$accountsservice_cv_warn_cflags" +AC_SUBST(WARN_CFLAGS) + dnl --------------------------------------------------------------------------- dnl - DocBook Documentation dnl --------------------------------------------------------------------------- |