]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
Linux: Add autoconf macro for structure checks
authorSimon Wilkinson <sxw@inf.ed.ac.uk>
Tue, 27 Apr 2010 12:02:20 +0000 (13:02 +0100)
committerRuss Allbery <rra@debian.org>
Mon, 28 Feb 2011 23:57:15 +0000 (15:57 -0800)
Add a new autoconf macro for doing structure element checks.

Reviewed-on: http://gerrit.openafs.org/1853
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit 02f2c7cb3734d44dc90b77d631909373daefacd3)

Change-Id: I3639293928a821ba41456b79fd1425711f6e36f4
[andersk@mit.edu: Remove modifications of existing structure checks]
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Reviewed-on: http://gerrit.openafs.org/3992
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com>
Reviewed-by: Russ Allbery <rra@stanford.edu>
(cherry picked from commit 166019b13bf9e9be3983533ff59ae4a23e4cc9ea)

src/cf/linux-test1.m4

index 0b40eb75a5ab6d5a4ae586a9b3f909827f55b69f..2da3bb89207d1607a455623c4eb4c95e6a37fc66 100644 (file)
@@ -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 <linux/$3>],
+                 [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])])
+ ])