[1835] | 1 | From 0b40abe79e44c98adbbd5adb80ac2f10e6d1316a Mon Sep 17 00:00:00 2001 |
---|
| 2 | From: Simon Wilkinson <sxw@inf.ed.ac.uk> |
---|
| 3 | Date: Tue, 27 Apr 2010 17:41:22 +0100 |
---|
| 4 | Subject: [PATCH 2/8] Linux: Add general autoconf macro for Linux kernel |
---|
| 5 | |
---|
| 6 | Add AC_CHECK_LINUX_BUILD() to do a standardised Linux build, which |
---|
| 7 | takes a "checking" message, the autoconf variable to use to cache |
---|
| 8 | the results, headers and code to run, preprocessor variable to |
---|
| 9 | define, and a description of that variable. |
---|
| 10 | |
---|
| 11 | Reviewed-on: http://gerrit.openafs.org/1854 |
---|
| 12 | Reviewed-by: Derrick Brashear <shadow@dementia.org> |
---|
| 13 | Tested-by: Derrick Brashear <shadow@dementia.org> |
---|
| 14 | (cherry picked from commit a89d6b029d059d01b8bbfc18b9ee6e3f5a964b85) |
---|
| 15 | |
---|
| 16 | Change-Id: I75c5efbf69b54e0f0b1aedcb157992e13c6a8aa7 |
---|
| 17 | [andersk@mit.edu: Remove reimplementation of existing check macros] |
---|
| 18 | Signed-off-by: Anders Kaseorg <andersk@mit.edu> |
---|
| 19 | Reviewed-on: http://gerrit.openafs.org/3993 |
---|
| 20 | Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk> |
---|
| 21 | Tested-by: BuildBot <buildbot@rampaginggeek.com> |
---|
| 22 | Reviewed-by: Russ Allbery <rra@stanford.edu> |
---|
| 23 | Reviewed-on: http://gerrit.openafs.org/4038 |
---|
| 24 | Reviewed-by: Derrick Brashear <shadow@dementia.org> |
---|
| 25 | Tested-by: Derrick Brashear <shadow@dementia.org> |
---|
| 26 | --- |
---|
| 27 | src/cf/linux-test1.m4 | 28 ++++++++++++++++++---------- |
---|
| 28 | src/cf/linux-test4.m4 | 11 +++++------ |
---|
| 29 | 2 files changed, 23 insertions(+), 16 deletions(-) |
---|
| 30 | |
---|
| 31 | diff --git a/src/cf/linux-test1.m4 b/src/cf/linux-test1.m4 |
---|
| 32 | index 2da3bb8..3115cdb 100644 |
---|
| 33 | --- a/src/cf/linux-test1.m4 |
---|
| 34 | +++ b/src/cf/linux-test1.m4 |
---|
| 35 | @@ -85,16 +85,24 @@ AC_DEFUN([LINUX_KBUILD_USES_EXTRA_CFLAGS], [ |
---|
| 36 | CPPFLAGS="$save_CPPFLAGS" |
---|
| 37 | AC_MSG_RESULT($ac_linux_kbuild_requires_extra_cflags)]) |
---|
| 38 | |
---|
| 39 | +dnl AC_CHECK_LINUX_BUILD([msg], [var], [includes], [code], [define]) |
---|
| 40 | +AC_DEFUN([AC_CHECK_LINUX_BUILD], |
---|
| 41 | + [AS_VAR_PUSHDEF([ac_linux_build], [$2])dnl |
---|
| 42 | + AC_CACHE_CHECK([$1], [ac_linux_build], |
---|
| 43 | + [AC_TRY_KBUILD([$3], [$4], |
---|
| 44 | + AS_VAR_SET([ac_linux_build], [yes]), |
---|
| 45 | + AS_VAR_SET([ac_linux_build], [no])) |
---|
| 46 | + ]) |
---|
| 47 | + AS_IF([test AS_VAR_GET([ac_linux_build]) = yes], |
---|
| 48 | + [AC_DEFINE([$5],1,[$6])]) |
---|
| 49 | + ]) |
---|
| 50 | + |
---|
| 51 | dnl AC_CHECK_LINUX_STRUCT([structure], [element], [includes]) |
---|
| 52 | AC_DEFUN([AC_CHECK_LINUX_STRUCT], |
---|
| 53 | - [AS_VAR_PUSHDEF([ac_linux_struct], [ac_cv_linux_struct_$1_has_$2])dnl |
---|
| 54 | - AC_CACHE_CHECK([for $2 in struct $1], [ac_linux_struct], |
---|
| 55 | - [AC_TRY_KBUILD([#include <linux/$3>], |
---|
| 56 | - [struct $1 _test; printk("%x\n", &_test.$2); ], |
---|
| 57 | - AS_VAR_SET([ac_linux_struct], [yes]), |
---|
| 58 | - AS_VAR_SET([ac_linux_struct], [no])) |
---|
| 59 | - ]) |
---|
| 60 | - AS_IF([test AS_VAR_GET([ac_linux_struct]) = yes], |
---|
| 61 | - [AC_DEFINE(AS_TR_CPP(STRUCT_$1_HAS_$2), 1, |
---|
| 62 | - [Define if kernel struct $1 has the $2 element])]) |
---|
| 63 | + [AC_CHECK_LINUX_BUILD([for $2 in struct $1], |
---|
| 64 | + [ac_cv_linux_struct_$1_has_$2], |
---|
| 65 | + [#include <linux/$3>], |
---|
| 66 | + [struct $1 _test; printk("%x\n", &_test.$2); ], |
---|
| 67 | + AS_TR_CPP(STRUCT_$1_HAS_$2), |
---|
| 68 | + [Define if kernel struct $1 has the $2 element]) |
---|
| 69 | ]) |
---|
| 70 | diff --git a/src/cf/linux-test4.m4 b/src/cf/linux-test4.m4 |
---|
| 71 | index 89fccf5..3f22f7a 100644 |
---|
| 72 | --- a/src/cf/linux-test4.m4 |
---|
| 73 | +++ b/src/cf/linux-test4.m4 |
---|
| 74 | @@ -675,18 +675,17 @@ struct nameidata _nameidata; |
---|
| 75 | |
---|
| 76 | |
---|
| 77 | AC_DEFUN([LINUX_IOP_I_PERMISSION_TAKES_NAMEIDATA], [ |
---|
| 78 | - AC_MSG_CHECKING([whether inode_operations.permission takes a nameidata]) |
---|
| 79 | - AC_CACHE_VAL([ac_cv_linux_func_i_permission_takes_nameidata], [ |
---|
| 80 | - AC_TRY_KBUILD( |
---|
| 81 | + AC_CHECK_LINUX_BUILD([whether inode_operations.permission takes a nameidata], |
---|
| 82 | + [ac_cv_linux_func_i_permission_takes_nameidata], |
---|
| 83 | [#include <linux/fs.h> |
---|
| 84 | #include <linux/namei.h>], |
---|
| 85 | [struct inode _inode; |
---|
| 86 | struct dentry _dentry; |
---|
| 87 | struct nameidata _nameidata; |
---|
| 88 | (void)_inode.i_op->permission(&_inode, 0, &_nameidata);], |
---|
| 89 | - ac_cv_linux_func_i_permission_takes_nameidata=yes, |
---|
| 90 | - ac_cv_linux_func_i_permission_takes_nameidata=no)]) |
---|
| 91 | - AC_MSG_RESULT($ac_cv_linux_func_i_permission_takes_nameidata)]) |
---|
| 92 | + [IOP_PERMISSION_TAKES_NAMEIDATA], |
---|
| 93 | + [define if your iops.permission takes a nameidata argument]) |
---|
| 94 | +]) |
---|
| 95 | |
---|
| 96 | |
---|
| 97 | AC_DEFUN([LINUX_IOP_I_PUT_LINK_TAKES_COOKIE], [ |
---|
| 98 | -- |
---|
| 99 | 1.7.3.4 |
---|
| 100 | |
---|