[1835] | 1 | From 71ec6d24f675082d09926f87db2bfad639d6df74 Mon Sep 17 00:00:00 2001 |
---|
| 2 | From: Simon Wilkinson <sxw@inf.ed.ac.uk> |
---|
| 3 | Date: Tue, 27 Apr 2010 13:02:20 +0100 |
---|
| 4 | Subject: [PATCH 1/8] Linux: Add autoconf macro for structure checks |
---|
| 5 | |
---|
| 6 | Add a new autoconf macro for doing structure element checks. |
---|
| 7 | |
---|
| 8 | Reviewed-on: http://gerrit.openafs.org/1853 |
---|
| 9 | Reviewed-by: Derrick Brashear <shadow@dementia.org> |
---|
| 10 | Tested-by: Derrick Brashear <shadow@dementia.org> |
---|
| 11 | (cherry picked from commit 02f2c7cb3734d44dc90b77d631909373daefacd3) |
---|
| 12 | |
---|
| 13 | Change-Id: Id7768128e058805baf8d44f2610f3345b25ac973 |
---|
| 14 | [andersk@mit.edu: Remove modifications of existing structure checks] |
---|
| 15 | Signed-off-by: Anders Kaseorg <andersk@mit.edu> |
---|
| 16 | Reviewed-on: http://gerrit.openafs.org/3992 |
---|
| 17 | Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk> |
---|
| 18 | Tested-by: BuildBot <buildbot@rampaginggeek.com> |
---|
| 19 | Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com> |
---|
| 20 | Reviewed-by: Russ Allbery <rra@stanford.edu> |
---|
| 21 | Reviewed-on: http://gerrit.openafs.org/4037 |
---|
| 22 | Reviewed-by: Derrick Brashear <shadow@dementia.org> |
---|
| 23 | Tested-by: Derrick Brashear <shadow@dementia.org> |
---|
| 24 | --- |
---|
| 25 | src/cf/linux-test1.m4 | 14 ++++++++++++++ |
---|
| 26 | 1 files changed, 14 insertions(+), 0 deletions(-) |
---|
| 27 | |
---|
| 28 | diff --git a/src/cf/linux-test1.m4 b/src/cf/linux-test1.m4 |
---|
| 29 | index 0b40eb7..2da3bb8 100644 |
---|
| 30 | --- a/src/cf/linux-test1.m4 |
---|
| 31 | +++ b/src/cf/linux-test1.m4 |
---|
| 32 | @@ -84,3 +84,17 @@ AC_DEFUN([LINUX_KBUILD_USES_EXTRA_CFLAGS], [ |
---|
| 33 | ac_linux_kbuild_requires_extra_cflags=yes) |
---|
| 34 | CPPFLAGS="$save_CPPFLAGS" |
---|
| 35 | AC_MSG_RESULT($ac_linux_kbuild_requires_extra_cflags)]) |
---|
| 36 | + |
---|
| 37 | +dnl AC_CHECK_LINUX_STRUCT([structure], [element], [includes]) |
---|
| 38 | +AC_DEFUN([AC_CHECK_LINUX_STRUCT], |
---|
| 39 | + [AS_VAR_PUSHDEF([ac_linux_struct], [ac_cv_linux_struct_$1_has_$2])dnl |
---|
| 40 | + AC_CACHE_CHECK([for $2 in struct $1], [ac_linux_struct], |
---|
| 41 | + [AC_TRY_KBUILD([#include <linux/$3>], |
---|
| 42 | + [struct $1 _test; printk("%x\n", &_test.$2); ], |
---|
| 43 | + AS_VAR_SET([ac_linux_struct], [yes]), |
---|
| 44 | + AS_VAR_SET([ac_linux_struct], [no])) |
---|
| 45 | + ]) |
---|
| 46 | + AS_IF([test AS_VAR_GET([ac_linux_struct]) = yes], |
---|
| 47 | + [AC_DEFINE(AS_TR_CPP(STRUCT_$1_HAS_$2), 1, |
---|
| 48 | + [Define if kernel struct $1 has the $2 element])]) |
---|
| 49 | + ]) |
---|
| 50 | -- |
---|
| 51 | 1.7.3.4 |
---|
| 52 | |
---|