]> granicus.if.org Git - strace/commitdiff
Import warnings.m4 from gnulib
authorDmitry V. Levin <ldv@altlinux.org>
Thu, 9 Sep 2010 17:41:15 +0000 (17:41 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Thu, 9 Sep 2010 23:20:25 +0000 (23:20 +0000)
* m4/warnings.m4: Replace with warnings.m4 from gnulib.
* configure.ac: Use gl_WARN_ADD from new warnings.m4.
* Makefile.am (AM_CFLAGS): Update for new warnings.m4.

Makefile.am
configure.ac
m4/warnings.m4

index 53fb0adc679ddc6e87da8bcdbe97ac1da9471752..32345028482c33cc629cf80dc9f985afb3f39a8b 100644 (file)
@@ -10,8 +10,8 @@ OS            = @opsys@
 ARCH           = @arch@
 
 ACLOCAL_AMFLAGS = -I m4
-AM_CFLAGS = $(WARNFLAGS)
-INCLUDES = -I$(srcdir)/$(OS)/$(ARCH) -I$(srcdir)/$(OS)
+AM_CFLAGS = $(WARN_CFLAGS)
+AM_CPPFLAGS = -I$(srcdir)/$(OS)/$(ARCH) -I$(srcdir)/$(OS)
 
 strace_SOURCES = strace.c syscall.c count.c util.c desc.c file.c ipc.c \
                 io.c ioctl.c mem.c net.c process.c bjm.c quota.c \
index 96a9a66abac6a3321ee0a77bd8a74ae11fc3326f..3a392aa20b669790bf8a32394adc441ef3ef1cb9 100644 (file)
@@ -171,15 +171,13 @@ in the compilation directory.])
        fi
 fi
 
-AC_WARNFLAGS
+gl_WARN_ADD([-Wall])
 if test "x$opsys" = "xsunos4"
 then
-       if test -n "$GCC"
-       then
-               # SunOS 4.x header files don't declare int functions.
-               WARNFLAGS="$WARNFLAGS -Wno-implicit"
-       fi
+       # SunOS 4.x header files don't declare int functions.
+       gl_WARN_ADD([-Wno-implicit])
 fi
+AC_SUBST([WARN_CFLAGS])
 
 AC_PROG_CPP
 AC_PROG_GCC_TRADITIONAL
index ef0341bf6e581795a93e8342ee5d8b3dc4472af0..dad5c1f29c66aeebca880e65f9084fc4930a2e81 100644 (file)
@@ -1,12 +1,36 @@
-dnl ### A macro to set gcc warning flags.
-define(AC_WARNFLAGS,
-[AC_SUBST(WARNFLAGS)
-if test -z "$WARNFLAGS"
-then
-       if test -n "$GCC"
-       then
-               # If we're using gcc we want warning flags.
-               WARNFLAGS=-Wall
-       fi
-fi
+# warnings.m4 serial 2
+dnl Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Simon Josefsson
+
+# gl_AS_VAR_APPEND(VAR, VALUE)
+# ----------------------------
+# Provide the functionality of AS_VAR_APPEND if Autoconf does not have it.
+m4_ifdef([AS_VAR_APPEND],
+[m4_copy([AS_VAR_APPEND], [gl_AS_VAR_APPEND])],
+[m4_define([gl_AS_VAR_APPEND],
+[AS_VAR_SET([$1], [AS_VAR_GET([$1])$2])])])
+
+# gl_WARN_ADD(PARAMETER, [VARIABLE = WARN_CFLAGS])
+# ------------------------------------------------
+# Adds parameter to WARN_CFLAGS if the compiler supports it.  For example,
+# gl_WARN_ADD([-Wparentheses]).
+AC_DEFUN([gl_WARN_ADD],
+[AS_VAR_PUSHDEF([gl_Warn], [gl_cv_warn_$1])dnl
+AC_CACHE_CHECK([whether compiler handles $1], [gl_Warn], [
+  save_CPPFLAGS="$CPPFLAGS"
+  CPPFLAGS="${CPPFLAGS} $1"
+  AC_PREPROC_IFELSE([AC_LANG_PROGRAM([])],
+                    [AS_VAR_SET([gl_Warn], [yes])],
+                    [AS_VAR_SET([gl_Warn], [no])])
+  CPPFLAGS="$save_CPPFLAGS"
+])
+AS_VAR_PUSHDEF([gl_Flags], m4_if([$2], [], [[WARN_CFLAGS]], [[$2]]))dnl
+AS_VAR_IF([gl_Warn], [yes], [gl_AS_VAR_APPEND([gl_Flags], [" $1"])])
+AS_VAR_POPDEF([gl_Flags])dnl
+AS_VAR_POPDEF([gl_Warn])dnl
+m4_ifval([$2], [AS_LITERAL_IF([$2], [AC_SUBST([$2])], [])])dnl
 ])