]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
Linux: Add general autoconf macro for Linux kernel
authorSimon Wilkinson <sxw@inf.ed.ac.uk>
Tue, 27 Apr 2010 16:41:22 +0000 (17:41 +0100)
committerRuss Allbery <rra@debian.org>
Mon, 28 Feb 2011 23:57:40 +0000 (15:57 -0800)
Add AC_CHECK_LINUX_BUILD() to do a standardised Linux build, which
takes a "checking" message, the autoconf variable to use to cache
the results, headers and code to run, preprocessor variable to
define, and a description of that variable.

Reviewed-on: http://gerrit.openafs.org/1854
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit a89d6b029d059d01b8bbfc18b9ee6e3f5a964b85)

Change-Id: I40730801f21bd058c66e475c4a5d2b67ace04cfb
[andersk@mit.edu: Remove reimplementation of existing check macros]
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Reviewed-on: http://gerrit.openafs.org/3993
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Russ Allbery <rra@stanford.edu>
(cherry picked from commit 62c7e0b01e225708f525a9e6019fa11531b06aa4)

src/cf/linux-test1.m4
src/cf/linux-test4.m4

index 2da3bb89207d1607a455623c4eb4c95e6a37fc66..3115cdb6552aeb9c8dbdf7f0a58279ee5432370b 100644 (file)
@@ -85,16 +85,24 @@ 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])
+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],
+                 AS_VAR_SET([ac_linux_build], [yes]),
+                 AS_VAR_SET([ac_linux_build], [no]))
+   ])
+  AS_IF([test AS_VAR_GET([ac_linux_build]) = yes],
+        [AC_DEFINE([$5],1,[$6])])
+ ])
+
 dnl AC_CHECK_LINUX_STRUCT([structure], [element], [includes])
 AC_DEFUN([AC_CHECK_LINUX_STRUCT],
- [AS_VAR_PUSHDEF([ac_linux_struct], [ac_cv_linux_struct_$1_has_$2])dnl
-  AC_CACHE_CHECK([for $2 in struct $1], [ac_linux_struct],
-   [AC_TRY_KBUILD([#include <linux/$3>],
-                 [struct $1 _test; printk("%x\n", &_test.$2); ],
-                 AS_VAR_SET([ac_linux_struct], [yes]),
-                 AS_VAR_SET([ac_linux_struct], [no]))
-   ])
-  AS_IF([test AS_VAR_GET([ac_linux_struct]) = yes],
-       [AC_DEFINE(AS_TR_CPP(STRUCT_$1_HAS_$2), 1,
-                  [Define if kernel struct $1 has the $2 element])])
+ [AC_CHECK_LINUX_BUILD([for $2 in struct $1],
+                      [ac_cv_linux_struct_$1_has_$2],
+                      [#include <linux/$3>],
+                      [struct $1 _test; printk("%x\n", &_test.$2); ],
+                      AS_TR_CPP(STRUCT_$1_HAS_$2),
+                      [Define if kernel struct $1 has the $2 element])
  ])
index 89fccf55e019f4413e6078de8a70ebe3dccbbf5e..3f22f7a0dc3d5cdd9f5899f70e83e7675f399147 100644 (file)
@@ -675,18 +675,17 @@ struct nameidata _nameidata;
 
 
 AC_DEFUN([LINUX_IOP_I_PERMISSION_TAKES_NAMEIDATA], [
-  AC_MSG_CHECKING([whether inode_operations.permission takes a nameidata])
-  AC_CACHE_VAL([ac_cv_linux_func_i_permission_takes_nameidata], [
-    AC_TRY_KBUILD(
+  AC_CHECK_LINUX_BUILD([whether inode_operations.permission takes a nameidata],
+                      [ac_cv_linux_func_i_permission_takes_nameidata],
 [#include <linux/fs.h>
 #include <linux/namei.h>],
 [struct inode _inode;
 struct dentry _dentry;
 struct nameidata _nameidata;
 (void)_inode.i_op->permission(&_inode, 0, &_nameidata);],
-      ac_cv_linux_func_i_permission_takes_nameidata=yes,
-      ac_cv_linux_func_i_permission_takes_nameidata=no)])
-  AC_MSG_RESULT($ac_cv_linux_func_i_permission_takes_nameidata)])
+                      [IOP_PERMISSION_TAKES_NAMEIDATA],
+                      [define if your iops.permission takes a nameidata argument])
+])
 
 
 AC_DEFUN([LINUX_IOP_I_PUT_LINK_TAKES_COOKIE], [