summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog12
-rw-r--r--build_shared/Makefile_build.am_fragment2
-rw-r--r--configure.in19
-rw-r--r--examples/Makefile.am_fragment3
-rw-r--r--scripts/dk-warn.m4114
-rw-r--r--scripts/macros.m462
-rw-r--r--tests/Makefile.am_fragment2
-rw-r--r--tools/extra_defs_gen/Makefile.am2
8 files changed, 143 insertions, 73 deletions
diff --git a/ChangeLog b/ChangeLog
index 1d2d75e3..21b95f71 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
2009-03-26 Daniel Elstner <danielk@openismus.com>
+ * scripts/dk-warn.m4: New file defining DK_ARG_ENABLE_WARNINGS().
+ * scripts/macros.m4: Remove the old GTKMM_ARG_ENABLE_WARNINGS().
+ * configure.in: Use new macro DK_ARG_ENABLE_WARNINGS() to set the
+ Makefile variable $(GLIBMM_WXXFLAGS).
+ * build_shared/Makefile_build.am_fragment (all_includes): Prepend
+ $(GLIBMM_WXXFLAGS).
+ * tools/extra_defs_gen/Makefile.am (INCLUDES): ditto,
+ * examples/Makefile.am_fragment (all_includes): ditto,
+ * tests/Makefile.am_fragment (INCLUDES): ditto.
+
+2009-03-26 Daniel Elstner <danielk@openismus.com>
+
* gio/src/emblemedicon.hg: Remove stray semicolons to get rid of
compiler warnings.
diff --git a/build_shared/Makefile_build.am_fragment b/build_shared/Makefile_build.am_fragment
index 2707becf..8a62bb06 100644
--- a/build_shared/Makefile_build.am_fragment
+++ b/build_shared/Makefile_build.am_fragment
@@ -29,7 +29,7 @@ common_ldflags = -version-info $(sublib_libversion) $(no_undefined)
all_includes = -I$(top_builddir)/$(sublib_topdir) -I$(top_srcdir)/$(sublib_topdir) \
-I$(top_builddir)/glib -I$(top_srcdir)/glib -I$(top_builddir) \
-I$(top_builddir)/gio -I$(top_srcdir)/gio \
- $(sublib_cflags) $(GTHREAD_CFLAGS)
+ $(GLIBMM_WXXFLAGS) $(sublib_cflags) $(GTHREAD_CFLAGS)
dist_sources = $(files_all_built_cc) $(files_all_extra_cc) $(files_all_built_h) $(files_all_extra_h)
DISTFILES = $(DIST_COMMON) $(dist_sources) $(TEXINFOS) $(EXTRA_DIST)
diff --git a/configure.in b/configure.in
index c01fa278..1e238547 100644
--- a/configure.in
+++ b/configure.in
@@ -199,7 +199,7 @@ if test x"$os_win32" = xyes; then
fi
fi
-AC_LANG_CPLUSPLUS
+AC_LANG([C++])
AC_CXX_BOOL(,config_error=yes)
AC_CXX_NAMESPACES(,config_error=yes)
@@ -243,18 +243,23 @@ GTKMM_ARG_ENABLE_FULLDOCS()
GLIBMM_ARG_ENABLE_DEBUG_REFCOUNTING()
# Evaluate the --enable-warnings=level option.
-GTKMM_ARG_ENABLE_WARNINGS()
+DK_ARG_ENABLE_WARNINGS([GLIBMM_WXXFLAGS],
+ [-Wall],
+ [-pedantic -Wall -Wextra])
# Add an --enable-use-deprecations configure option:
AC_ARG_ENABLE(deprecations,
[AC_HELP_STRING([--enable-use-deprecations],
[warn about deprecated usages [default=no]])],,
[enable_deprecations=no])
-
-if test "x$enable_use_deprecations" = "xyes"; then
- DISABLE_DEPRECATED_CFLAGS="-DG_DISABLE_DEPRECATED"
- AC_SUBST(DISABLE_DEPRECATED_CFLAGS)
-fi
+
+AS_IF([test "x$enable_use_deprecations" = xyes],
+[
+DISABLE_DEPRECATED_CFLAGS='-DG_DISABLE_DEPRECATED'
+],[
+DISABLE_DEPRECATED_CFLAGS=
+])
+AC_SUBST([DISABLE_DEPRECATED_CFLAGS])
#Offer the ability to omit some API from the library,
#to reduce the code size:
diff --git a/examples/Makefile.am_fragment b/examples/Makefile.am_fragment
index 6cedaa1f..e7af4bc9 100644
--- a/examples/Makefile.am_fragment
+++ b/examples/Makefile.am_fragment
@@ -6,7 +6,8 @@ LIBS = $(local_glibmm_lib) $(local_giomm_lib) $(GLIBMM_LIBS)
all_includes = -I$(top_builddir)/glib -I$(top_srcdir)/glib \
-I$(top_builddir)/gio -I$(top_srcdir)/gio \
- $(GLIBMM_CFLAGS) $(DISABLE_DEPRECATED_CFLAGS) $(DISABLE_DEPRECATED_API_CFLAGS)
+ $(GLIBMM_WXXFLAGS) $(GLIBMM_CFLAGS) \
+ $(DISABLE_DEPRECATED_CFLAGS) $(DISABLE_DEPRECATED_API_CFLAGS)
DEFS = @DEFS@
DEFAULT_INCLUDES =
diff --git a/scripts/dk-warn.m4 b/scripts/dk-warn.m4
new file mode 100644
index 00000000..03ac88c7
--- /dev/null
+++ b/scripts/dk-warn.m4
@@ -0,0 +1,114 @@
+## Copyright (c) 2004-2007 Daniel Elstner <daniel.kitta@gmail.com>
+##
+## This file is part of danielk's Autostuff.
+##
+## danielk's Autostuff is free software; you can redistribute it and/or
+## modify it under the terms of the GNU General Public License as published
+## by the Free Software Foundation; either version 2 of the License, or (at
+## your option) any later version.
+##
+## danielk's Autostuff is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+## for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with danielk's Autostuff; if not, write to the Free Software Foundation,
+## Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+#serial 20070116
+
+## DK_ARG_ENABLE_WARNINGS(variable, min-flags, max-flags, [deprecation-prefixes])
+##
+## Provide the --enable-warnings configure argument, set to "min" by default.
+## <min-flags> and <max-flags> should be space-separated lists of compiler
+## warning flags to use with --enable-warnings=min or --enable-warnings=max,
+## respectively. Warning level "fatal" is the same as "max" but in addition
+## enables -Werror mode.
+##
+## If not empty, <deprecation-prefixes> should be a list of module prefixes
+## which is expanded to -D<module>_DISABLE_DEPRECATED flags if fatal warnings
+## are enabled, too.
+##
+AC_DEFUN([DK_ARG_ENABLE_WARNINGS],
+[dnl
+m4_if([$3],, [AC_FATAL([3 arguments expected])])[]dnl
+dnl
+AC_ARG_ENABLE([warnings], [AS_HELP_STRING(
+ [--enable-warnings=@<:@min|max|fatal|no@:>@],
+ [control compiler pickyness @<:@min@:>@])],
+ [dk_enable_warnings=$enableval],
+ [dk_enable_warnings=min])[]dnl
+
+dk_lang=
+case $ac_compile in
+ *'$CXXFLAGS '*)
+ dk_lang='C++'
+ dk_cc=$CXX
+ dk_conftest=conftest.${ac_ext-cc}
+ ;;
+ *'$CFLAGS '*)
+ dk_lang=C
+ dk_cc=$CC
+ dk_conftest=conftest.${ac_ext-c}
+ ;;
+esac
+
+AS_IF([test "x$dk_lang" != x],
+[
+ AC_MSG_CHECKING([which $dk_lang compiler warning flags to use])
+
+ case $dk_enable_warnings in
+ no) dk_warning_flags=;;
+ max) dk_warning_flags="$3";;
+ fatal) dk_warning_flags="$3 -Werror";;
+ *) dk_warning_flags="$2";;
+ esac
+
+ dk_deprecation_flags=
+m4_if([$4],,, [
+ AS_IF([test "x$dk_enable_warnings" = xfatal],
+ [
+ dk_deprecation_prefixes="$4"
+ for dk_prefix in $dk_deprecation_prefixes
+ do
+ dk_deprecation_flags="${dk_deprecation_flags}-D${dk_prefix}_DISABLE_DEPRECATED "
+ done
+ ])
+])[]dnl
+ dk_tested_flags=
+
+ AS_IF([test "x$dk_warning_flags" != x],
+ [
+ # Keep in mind that the dummy source must be devoid of any
+ # problems that might cause diagnostics.
+ AC_LANG_CONFTEST([AC_LANG_SOURCE(
+ [[int main(int argc, char** argv) { return (argv != 0) ? argc : 0; }]])])
+
+ for dk_flag in $dk_warning_flags
+ do
+ # Test whether the compiler accepts the flag. GCC doesn't bail
+ # out when given an unsupported flag but prints a warning, so
+ # check the compiler output instead.
+ dk_cc_out=`$dk_cc $dk_tested_flags $dk_flag -c "$dk_conftest" 2>&1 || echo failed`
+ rm -f "conftest.${OBJEXT-o}"
+
+ AS_IF([test "x$dk_cc_out" = x],
+ [
+ AS_IF([test "x$dk_tested_flags" = x],
+ [dk_tested_flags=$dk_flag],
+ [dk_tested_flags="$dk_tested_flags $dk_flag"])
+ ], [
+ echo "$dk_cc_out" >&AS_MESSAGE_LOG_FD
+ ])
+ done
+
+ rm -f "$dk_conftest"
+ ])
+ dk_all_flags=$dk_deprecation_flags$dk_tested_flags
+ AC_SUBST([$1], [$dk_all_flags])
+
+ test "x$dk_all_flags" != x || dk_all_flags=none
+ AC_MSG_RESULT([$dk_all_flags])
+])
+])
diff --git a/scripts/macros.m4 b/scripts/macros.m4
index 71afb22b..14708e47 100644
--- a/scripts/macros.m4
+++ b/scripts/macros.m4
@@ -70,65 +70,3 @@ AC_DEFUN([GLIBMM_ARG_ENABLE_DEBUG_REFCOUNTING],
}
fi
])
-
-
-## GTKMM_ARG_ENABLE_WARNINGS()
-##
-## Provide the --enable-warnings configure argument, set to 'minimum'
-## by default.
-##
-AC_DEFUN([GTKMM_ARG_ENABLE_WARNINGS],
-[
- AC_ARG_ENABLE([warnings],
- [ --enable-warnings=[[none|minimum|maximum|hardcore]]
- Control compiler pickyness. [[default=minimum]]],
- [gtkmm_enable_warnings="$enableval"],
- [gtkmm_enable_warnings='minimum'])
-
- AC_MSG_CHECKING([for compiler warning flags to use])
-
- gtkmm_warning_flags=''
-
- case "$gtkmm_enable_warnings" in
- minimum|yes) gtkmm_warning_flags='-Wall -Wno-long-long';;
- maximum) gtkmm_warning_flags='-pedantic -W -Wall -Wno-long-long';;
- hardcore) gtkmm_warning_flags='-pedantic -W -Wall -Wno-long-long -Werror';;
- esac
-
- gtkmm_use_flags=''
-
- if test "x$gtkmm_warning_flags" != "x"
- then
- echo 'int foo() { return 0; }' > conftest.cc
-
- for flag in $gtkmm_warning_flags
- do
- # Test whether the compiler accepts the flag. GCC doesn't bail
- # out when given an unsupported flag but prints a warning, so
- # check the compiler output instead.
- gtkmm_cxx_out="`$CXX $flag -c conftest.cc 2>&1`"
- rm -f conftest.$OBJEXT
- test "x${gtkmm_cxx_out}" = "x" && \
- gtkmm_use_flags="${gtkmm_use_flags:+$gtkmm_use_flags }$flag"
- done
-
- rm -f conftest.cc
- gtkmm_cxx_out=''
- fi
-
- if test "x$gtkmm_use_flags" != "x"
- then
- for flag in $gtkmm_use_flags
- do
- case " $CXXFLAGS " in
- *" $flag "*) ;; # don't add flags twice
- *) CXXFLAGS="${CXXFLAGS:+$CXXFLAGS }$flag";;
- esac
- done
- else
- gtkmm_use_flags='none'
- fi
-
- AC_MSG_RESULT([$gtkmm_use_flags])
-])
-
diff --git a/tests/Makefile.am_fragment b/tests/Makefile.am_fragment
index ef247243..a72c2bf1 100644
--- a/tests/Makefile.am_fragment
+++ b/tests/Makefile.am_fragment
@@ -1,7 +1,7 @@
INCLUDES = \
-I$(top_builddir)/glib -I$(top_srcdir)/glib \
-I$(top_builddir)/gio -I$(top_srcdir)/gio \
- $(GLIBMM_CFLAGS) $(GTHREAD_CFLAGS)
+ $(GLIBMM_WXXFLAGS) $(GLIBMM_CFLAGS) $(GTHREAD_CFLAGS)
LIBS = $(top_builddir)/glib/glibmm/libglibmm-2.4.la \
$(top_builddir)/gio/giomm/libgiomm-2.4.la \
diff --git a/tools/extra_defs_gen/Makefile.am b/tools/extra_defs_gen/Makefile.am
index 8a830d6f..31d1ea3c 100644
--- a/tools/extra_defs_gen/Makefile.am
+++ b/tools/extra_defs_gen/Makefile.am
@@ -21,7 +21,7 @@ sublib_include_HEADERS = $(files_h)
# Build the generate_properties_defs utility executable.
# This is not used to build the rest of glibmm.
-INCLUDES = $(GLIBMM_CFLAGS) $(GIOMM_CFLAGS)
+INCLUDES = $(GLIBMM_WXXFLAGS) $(GLIBMM_CFLAGS) $(GIOMM_CFLAGS)
LIBS = $(GLIBMM_LIBS) $(GIOMM_LIBS)
noinst_PROGRAMS = generate_extra_defs generate_defs_gio