diff options
Diffstat (limited to 'macros')
-rw-r--r-- | macros/ChangeLog | 8 | ||||
-rw-r--r-- | macros/Makefile.am | 1 | ||||
-rw-r--r-- | macros/autogen.sh | 7 | ||||
-rw-r--r-- | macros/compiler-flags.m4 | 45 |
4 files changed, 58 insertions, 3 deletions
diff --git a/macros/ChangeLog b/macros/ChangeLog index 7b0de54844..789dec8220 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 3bb9e94c11..494835ea97 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 8248c0c328..cbd6a06157 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 0000000000..953e8ebb5b --- /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" +]) |