From 71ec6d24f675082d09926f87db2bfad639d6df74 Mon Sep 17 00:00:00 2001 From: Simon Wilkinson Date: Tue, 27 Apr 2010 13:02:20 +0100 Subject: [PATCH 1/8] 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: Id7768128e058805baf8d44f2610f3345b25ac973 [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 Reviewed-on: http://gerrit.openafs.org/4037 Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear --- src/cf/linux-test1.m4 | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-) diff --git a/src/cf/linux-test1.m4 b/src/cf/linux-test1.m4 index 0b40eb7..2da3bb8 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])]) + ]) -- 1.7.3.4