summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaja R Harinath <harinath@src.gnome.org>1998-08-20 21:23:52 +0000
committerRaja R Harinath <harinath@src.gnome.org>1998-08-20 21:23:52 +0000
commit37c14ac6197e8cc05039b526b037e7ae9688ea21 (patch)
tree95284992096ae91ad7ae1aff42da8d1a14acd337
parentf6a0c095e6c2e8f681f17c3f10789508e7b0076d (diff)
downloadgnome-common-37c14ac6197e8cc05039b526b037e7ae9688ea21.tar.gz
New file. Defines the GNOME_COMPILER_WARNINGS macro. Add
* compiler-flags.m4: New file. Defines the GNOME_COMPILER_WARNINGS macro. * autogen.sh (conf_flags): Add `--enable-compile-warnings' to list of flags passed to `configure'. * Makefile.am (MACROS): Add compiler-flags.m4. svn path=/trunk/; revision=340
-rw-r--r--macros/ChangeLog8
-rw-r--r--macros/Makefile.am1
-rw-r--r--macros/autogen.sh7
-rw-r--r--macros/compiler-flags.m445
4 files changed, 58 insertions, 3 deletions
diff --git a/macros/ChangeLog b/macros/ChangeLog
index 7b0de54..789dec8 100644
--- a/macros/ChangeLog
+++ b/macros/ChangeLog
@@ -1,3 +1,11 @@
+1998-08-20 Raja R Harinath <harinath@cs.umn.edu>
+
+ * compiler-flags.m4: New file. Defines the
+ GNOME_COMPILER_WARNINGS macro.
+ * autogen.sh (conf_flags): Add `--enable-compile-warnings' to list
+ of flags passed to `configure'.
+ * Makefile.am (MACROS): Add compiler-flags.m4.
+
1998-08-18 Martin Baulig <martin@home-of-linux.org>
* gnome-libgtop-check.m4: make it require libgtop >= 0.25.0.
diff --git a/macros/Makefile.am b/macros/Makefile.am
index 3bb9e94..494835e 100644
--- a/macros/Makefile.am
+++ b/macros/Makefile.am
@@ -1,6 +1,7 @@
## Please update this variable if any new macros are created
MACROS= \
aclocal-include.m4 \
+ compiler-flags.m4 \
curses.m4 \
gnome-fileutils.m4 \
gnome-guile-checks.m4 \
diff --git a/macros/autogen.sh b/macros/autogen.sh
index 8248c0c..cbd6a06 100644
--- a/macros/autogen.sh
+++ b/macros/autogen.sh
@@ -73,9 +73,10 @@ do
done
if test x$NOCONFIGURE = x; then
-echo running $srcdir/configure --enable-maintainer-mode "$@"
-$srcdir/configure --enable-maintainer-mode "$@" \
+conf_flags="--enable-maintainer-mode --enable-compile-warnings" #--enable-iso-c
+echo running $srcdir/configure $conf_flags "$@"
+$srcdir/configure $conf_flags "$@" \
&& echo Now type \`make\' to compile the $PKG_NAME
else
echo Skipping configure process.
-fi \ No newline at end of file
+fi
diff --git a/macros/compiler-flags.m4 b/macros/compiler-flags.m4
new file mode 100644
index 0000000..953e8eb
--- /dev/null
+++ b/macros/compiler-flags.m4
@@ -0,0 +1,45 @@
+dnl GNOME_COMPILE_WARNINGS
+dnl Turn on many useful compiler warnings
+dnl For now, only works on GCC
+AC_DEFUN([GNOME_COMPILE_WARNINGS],[
+ AC_ARG_ENABLE(compile-warnings,
+ [ --enable-compile-warnings=[no/minimum/yes] Turn on compiler warnings.],,enable_compile_warnings=minimum)
+
+ AC_MSG_CHECKING(what warning flags to pass to the C compiler)
+ warnCFLAGS=
+ if test "x$enable_compile_warnings" != "xno"; then
+ if test "x$GCC" = "xyes"; then
+ case " $CFLAGS " in
+ *[\ \ ]-Wall[\ \ ]*) ;;
+ *) warnCFLAGS="-Wall" ;;
+ esac
+
+ if test "x$enable_compile_warnings" = "xyes"; then
+ warnCFLAGS="$warnCFLAGS -W -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith"
+ fi
+ fi
+ fi
+ AC_MSG_RESULT($warnCFLAGS)
+
+ AC_ARG_ENABLE(iso-c,
+ [ --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)
+ CFLAGS="$CFLAGS $warnCFLAGS $complCFLAGS"
+])