From 644c2853a171a3853bdb2d084287ff2e02dbca4f Mon Sep 17 00:00:00 2001
From: Marc Dionne <marc.c.dionne@gmail.com>
Date: Fri, 28 Jan 2011 19:03:39 -0500
Subject: [PATCH 3/8] Linux: allow compile flags to be passed to AC_CHECK_LINUX_BUILD

Some linux autoconf tests require particular compile flags such as
-Werror.  Add a parameter to the AC_CHECK_LINUX_BUILD macro that
lets the caller pass in any needed special flags.

Reviewed-on: http://gerrit.openafs.org/3769
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit ca38c9546e323b59189670b80740510fb9ec5269)

Change-Id: If4daa7b1202e30046d22bda5eca6b191130945ea
[andersk@mit.edu: Remove modifications of existing tests]
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Reviewed-on: http://gerrit.openafs.org/3996
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Russ Allbery <rra@stanford.edu>
Reviewed-on: http://gerrit.openafs.org/4039
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
---
 src/cf/linux-test1.m4 |    7 +++++--
 src/cf/linux-test4.m4 |    3 ++-
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/cf/linux-test1.m4 b/src/cf/linux-test1.m4
index 3115cdb..97a520f 100644
--- a/src/cf/linux-test1.m4
+++ b/src/cf/linux-test1.m4
@@ -85,13 +85,16 @@ AC_DEFUN([LINUX_KBUILD_USES_EXTRA_CFLAGS], [
     CPPFLAGS="$save_CPPFLAGS"
     AC_MSG_RESULT($ac_linux_kbuild_requires_extra_cflags)])
 
-dnl AC_CHECK_LINUX_BUILD([msg], [var], [includes], [code], [define])
+dnl AC_CHECK_LINUX_BUILD([msg], [var], [includes], [code], [define], [CFLAGS])
 AC_DEFUN([AC_CHECK_LINUX_BUILD],
  [AS_VAR_PUSHDEF([ac_linux_build], [$2])dnl
   AC_CACHE_CHECK([$1], [ac_linux_build],
-   [AC_TRY_KBUILD([$3], [$4],
+   [save_CPPFLAGS="$CPPFLAGS"
+     CPPFLAGS="$CPPFLAGS $7"
+     AC_TRY_KBUILD([$3], [$4],
 		  AS_VAR_SET([ac_linux_build], [yes]),
 		  AS_VAR_SET([ac_linux_build], [no]))
+     CPPFLAGS="$save_CPPFLAGS"
    ])
   AS_IF([test AS_VAR_GET([ac_linux_build]) = yes],
         [AC_DEFINE([$5],1,[$6])])
diff --git a/src/cf/linux-test4.m4 b/src/cf/linux-test4.m4
index 3f22f7a..67ddf91 100644
--- a/src/cf/linux-test4.m4
+++ b/src/cf/linux-test4.m4
@@ -684,7 +684,8 @@ struct dentry _dentry;
 struct nameidata _nameidata;
 (void)_inode.i_op->permission(&_inode, 0, &_nameidata);],
 		       [IOP_PERMISSION_TAKES_NAMEIDATA],
-		       [define if your iops.permission takes a nameidata argument])
+		       [define if your iops.permission takes a nameidata argument],
+		       [])
 ])
 
 
-- 
1.7.3.4

