From 760aa881f4d4c6e87c4c409e61f322bfe229879b Mon Sep 17 00:00:00 2001 From: Simon Wilkinson Date: Tue, 27 Apr 2010 13:02:20 +0100 Subject: [PATCH] Linux: Add autoconf macro for structure checks Add a new autoconf macro for doing structure element checks. Reviewed-on: http://gerrit.openafs.org/1853 Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear (cherry picked from commit 02f2c7cb3734d44dc90b77d631909373daefacd3) Change-Id: I3639293928a821ba41456b79fd1425711f6e36f4 [andersk@mit.edu: Remove modifications of existing structure checks] Signed-off-by: Anders Kaseorg Reviewed-on: http://gerrit.openafs.org/3992 Reviewed-by: Simon Wilkinson Tested-by: BuildBot Reviewed-by: Marc Dionne Reviewed-by: Russ Allbery (cherry picked from commit 166019b13bf9e9be3983533ff59ae4a23e4cc9ea) --- src/cf/linux-test1.m4 | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/cf/linux-test1.m4 b/src/cf/linux-test1.m4 index 0b40eb75a..2da3bb892 100644 --- a/src/cf/linux-test1.m4 +++ b/src/cf/linux-test1.m4 @@ -84,3 +84,17 @@ AC_DEFUN([LINUX_KBUILD_USES_EXTRA_CFLAGS], [ ac_linux_kbuild_requires_extra_cflags=yes) CPPFLAGS="$save_CPPFLAGS" AC_MSG_RESULT($ac_linux_kbuild_requires_extra_cflags)]) + +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])]) + ]) -- 2.39.5