From: Simon Wilkinson Date: Tue, 27 Apr 2010 16:41:22 +0000 (+0100) Subject: Linux: Add general autoconf macro for Linux kernel X-Git-Tag: debian/1.4.14+dfsg-2~14 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=09ee69e2ff1e9b41e16edb970db7e143ec4ad42d;p=packages%2Fo%2Fopenafs.git Linux: Add general autoconf macro for Linux kernel 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 Tested-by: Derrick Brashear (cherry picked from commit a89d6b029d059d01b8bbfc18b9ee6e3f5a964b85) Change-Id: I40730801f21bd058c66e475c4a5d2b67ace04cfb [andersk@mit.edu: Remove reimplementation of existing check macros] Signed-off-by: Anders Kaseorg Reviewed-on: http://gerrit.openafs.org/3993 Reviewed-by: Simon Wilkinson Tested-by: BuildBot Reviewed-by: Russ Allbery (cherry picked from commit 62c7e0b01e225708f525a9e6019fa11531b06aa4) --- diff --git a/src/cf/linux-test1.m4 b/src/cf/linux-test1.m4 index 2da3bb892..3115cdb65 100644 --- a/src/cf/linux-test1.m4 +++ b/src/cf/linux-test1.m4 @@ -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 ], - [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 ], + [struct $1 _test; printk("%x\n", &_test.$2); ], + AS_TR_CPP(STRUCT_$1_HAS_$2), + [Define if kernel struct $1 has the $2 element]) ]) diff --git a/src/cf/linux-test4.m4 b/src/cf/linux-test4.m4 index 89fccf55e..3f22f7a0d 100644 --- a/src/cf/linux-test4.m4 +++ b/src/cf/linux-test4.m4 @@ -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 #include ], [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], [