tags 521745 + patch
thanks

After some trial and error, I got it working per the attached patch,
which ended up having to cover not only make_kbuild_makefile.mk but
also linux-test3.m4, as a handful of tests (most critically for
linux/seq_file.h) were looking for headers directly rather than making
use of AC_TRY_KBUILD.  Propagating the fixes to the latter turned out
to be easier said than done, as configure.in appears to be stale;
please correct that when you get a chance!

-- 
Aaron M. Ucko, KB1CJC (amu at alum.mit.edu, ucko at debian.org)
http://www.mit.edu/~amu/ | http://stuff.mit.edu/cgi/finger/[email protected]

--- openafs/src/libafs/make_kbuild_makefile.pl.dist	2007-06-04 23:56:14.000000000 -0400
+++ openafs/src/libafs/make_kbuild_makefile.pl	2009-03-30 18:06:47.000000000 -0400
@@ -90,12 +90,61 @@
   symlink($deps{$_}, "$KDIR/$src") or die "$KDIR/$src: $!\n";
 }
 
-foreach $src (qw(h sys netinet)) {
-  if (-e "$KDIR/$src" || -l "$KDIR/$src") {
-    unlink("$KDIR/$src") or die "$KDIR/$src: $!\n";
+%remap = ('h' => 'linux', 'netinet' => 'linux', 'sys' => 'linux');
+if (-f "$vars{LINUX_KERNEL_PATH}/include/linux/types.h") {
+  foreach $src (keys %remap) {
+    if (-e "$KDIR/$src" || -l "$KDIR/$src") {
+      unlink("$KDIR/$src") or die "$KDIR/$src: $!\n";
+    }
+    symlink("$vars{LINUX_KERNEL_PATH}/include/linux", "$KDIR/$src")
+      or die "$KDIR/$src: $!\n";
+  }
+} else {
+  foreach $src (keys %remap) {
+    system ('rm', '-rf', "$KDIR/$src"); # too crude?
+    mkdir("$KDIR/$src", 0777) or die "$KDIR/$src: $!\n";
+  }
+  %seen = ();
+  @q = <$KDIR/*.[Sc]>;
+  @include_dirs = map { /^\// ? $_ : "$KDIR/$_" }
+    split /[\s\\]*-I/, $vars{COMMON_INCLUDE};
+  push @include_dirs, "$vars{TOP_SRCDIR}/../include/rx", "$vars{TOP_SRCDIR}/rx";
+  while (@q) {
+    $src = shift @q;
+    $content = new IO::File($src, O_RDONLY) or die "$src: $!\n";
+  LINE:
+    while (<$content>) {
+      chomp;
+      if (/^\s*#\s*include\s*[<"](?:\.\.\/)?([^\/>"]*)(.*?)[>"]/) {
+	$inc = "$1$2";
+	if (exists $seen{$inc}) {
+	  next;
+	} elsif (exists $remap{$1}  &&  $2 !~ /.\//) {
+	  $H = new IO::File("$KDIR/$inc", O_WRONLY|O_CREAT|O_TRUNC, 0666)
+	    or die "$KDIR/$inc: $!\n";
+	  print $H "#include <linux$2>\n";
+	  $H->close() or die "$KDIR/$inc: $!\n";
+	} else {
+	  for $dir (@include_dirs) {
+	    if (-f "$dir/$inc") {
+	      push @q, "$dir/$inc";
+	      $seen{$inc} = 1;
+	      next LINE;
+	    }
+	  }
+	  if ($1 =~ /^(arpa|asm|.*fs|i?net|kern|ksys|linux|mach|rpc|scsi|vm)$/
+	      ||  !length($2)) {
+	    # Safe to ignore silently.
+	  } else {
+	    warn "Ignoring $_ ($inc not found)\n";
+	  }
+	}
+	$seen{$inc} = 1;
+      } elsif (/^\s*#\s*include/) {
+	warn "Ignoring $_ (unrecognized syntax)\n";
+      }
+    }
   }
-  symlink("$vars{LINUX_KERNEL_PATH}/include/linux", "$KDIR/$src")
-    or die "$KDIR/$src: $!\n";
 }
 
 $cflags = "$vars{CFLAGS} $vars{COMMON_INCLUDE}";
--- openafs/src/cf/linux-test3.m4.dist	2006-11-09 18:14:30.000000000 -0500
+++ openafs/src/cf/linux-test3.m4	2009-03-30 18:31:43.000000000 -0400
@@ -1,12 +1,8 @@
 AC_DEFUN([LINUX_KERNEL_LINUX_SYSCALL_H],[
   AC_MSG_CHECKING(for linux/syscall.h in kernel)
-  if test -f "${LINUX_KERNEL_PATH}/include/linux/syscall.h"; then
-    ac_linux_syscall=yes
-    AC_MSG_RESULT($ac_linux_syscall)
-  else
-    ac_linux_syscall=no
-    AC_MSG_RESULT($ac_linux_syscall)
-  fi
+  AC_TRY_KBUILD([#include <linux/syscall.h>], [],
+    [ac_linux_syscall=yes], [ac_linux_syscall=no])
+  AC_MSG_RESULT($ac_linux_syscall)
 ])
 
 AC_DEFUN([LINUX_NEED_RHCONFIG],[
@@ -16,17 +12,16 @@
   AC_MSG_WARN(Configured to build from a Red Hat SPEC file)
 else
   AC_MSG_CHECKING(for redhat kernel configuration)
-  if test -f "${LINUX_KERNEL_PATH}/include/linux/rhconfig.h"; then
-    ac_linux_rhconfig=yes
+  AC_TRY_KBUILD([#include <linux/rhconfig.h>], [],
+    [ac_linux_rhconfig=yes], [ac_linux_rhconfig=no])
+  AC_MSG_RESULT($ac_linux_rhconfig)
+  if test $ac_linux_rhconfig = yes; then
     RHCONFIG_SP="-D__BOOT_KERNEL_UP=1 -D__BOOT_KERNEL_SMP=0"
     RHCONFIG_MP="-D__BOOT_KERNEL_UP=0 -D__BOOT_KERNEL_SMP=1"
     AC_MSG_RESULT($ac_linux_rhconfig)
     if test ! -f "/boot/kernel.h"; then
         AC_MSG_WARN([/boot/kernel.h does not exist. build may fail])
     fi
-  else
-    ac_linux_rhconfig=no
-    AC_MSG_RESULT($ac_linux_rhconfig)
   fi
 fi
 AC_SUBST(RHCONFIG_SP)
@@ -76,11 +71,9 @@
 
 AC_DEFUN([LINUX_KERNEL_SELINUX],[
 AC_MSG_CHECKING(for SELinux kernel)
-save_CPPFLAGS="$CPPFLAGS"
-CPPFLAGS="-I${LINUX_KERNEL_PATH}/include $CPPFLAGS"
 AC_CACHE_VAL(ac_cv_linux_kernel_is_selinux,
 [
-AC_TRY_COMPILE(
+AC_TRY_KBUILD(
   [#include <linux/autoconf.h>],
   [#ifndef CONFIG_SECURITY_SELINUX
    #error not SELINUX
@@ -88,15 +81,11 @@
   ac_cv_linux_kernel_is_selinux=yes,
   ac_cv_linux_kernel_is_selinux=no)])
 AC_MSG_RESULT($ac_cv_linux_kernel_is_selinux)
-CPPFLAGS="$save_CPPFLAGS"])
+])
 
 AC_DEFUN([LINUX_KERNEL_LINUX_SEQ_FILE_H],[
   AC_MSG_CHECKING(for linux/seq_file.h in kernel)
-  if test -f "${LINUX_KERNEL_PATH}/include/linux/seq_file.h"; then
-    ac_linux_seq_file=yes
-    AC_MSG_RESULT($ac_linux_seq_file)
-  else
-    ac_linux_seq_file=no
-    AC_MSG_RESULT($ac_linux_seq_file)
-  fi
+  AC_TRY_KBUILD([#include <linux/seq_file.h>], [],
+    [ac_linux_seq_file=yes], [ac_linux_seq_file=no])
+  AC_MSG_RESULT($ac_linux_seq_file)
 ])
--- openafs/configure.dist	2009-03-27 12:20:01.000000000 -0400
+++ openafs/configure	2009-03-30 18:52:59.000000000 -0400
@@ -11274,28 +11274,194 @@
 
   { $as_echo "$as_me:$LINENO: checking for linux/syscall.h in kernel" >&5
 $as_echo_n "checking for linux/syscall.h in kernel... " >&6; }
-  if test -f "${LINUX_KERNEL_PATH}/include/linux/syscall.h"; then
-    ac_linux_syscall=yes
-    { $as_echo "$as_me:$LINENO: result: $ac_linux_syscall" >&5
-$as_echo "$ac_linux_syscall" >&6; }
+
+  if test $AFS_SYSKVERS -ge 26 ; then
+      rm -fr conftest.dir
+  if test "x$ac_linux_kbuild_requires_extra_cflags" = "xyes" ; then
+    CFLAGS_PREFIX='EXTRA_'
+  fi
+  if mkdir conftest.dir &&
+    cat >conftest.dir/Makefile <<_ACEOF &&
+${CFLAGS_PREFIX}CFLAGS += $CPPFLAGS
+
+obj-m += conftest.o
+_ACEOF
+    cat >conftest.dir/conftest.c <<\_ACEOF &&
+/* confdefs.h */
+_ACEOF
+    cat confdefs.h >>conftest.dir/conftest.c &&
+    cat >>conftest.dir/conftest.c <<\_ACEOF &&
+/* end confdefs.h */
+#include <linux/module.h>
+#include <linux/syscall.h>
+
+void conftest(void)
+{
+
+}
+
+MODULE_LICENSE("http://www.openafs.org/dl/license10.html";);
+_ACEOF
+    echo make -C $LINUX_KERNEL_PATH M=$SRCDIR_PARENT/conftest.dir modules KBUILD_VERBOSE=1 >&5 &&
+    make -C $LINUX_KERNEL_PATH M=$SRCDIR_PARENT/conftest.dir modules KBUILD_VERBOSE=1 >&5 2>conftest.err &&
+    ! grep -i "^WARNING: .* undefined!$" conftest.err >/dev/null 2>&1
+    then ac_linux_syscall=yes
+    else
+      sed '/^ *+/d' conftest.err >&5
+      echo "$as_me: failed using Makefile:" >&5
+      sed 's/^/| /' conftest.dir/Makefile >&5
+      echo "$as_me: and program was:" >&5
+      sed 's/^/| /' conftest.dir/conftest.c >&5
+      ac_linux_syscall=no
+  fi; rm -fr conftest.err conftest.dir
   else
-    ac_linux_syscall=no
-    { $as_echo "$as_me:$LINENO: result: $ac_linux_syscall" >&5
-$as_echo "$ac_linux_syscall" >&6; }
+
+  ac_save_CPPFLAGS="$CPPFLAGS"
+  CPPFLAGS="-I$LINUX_KERNEL_PATH/include -D__KERNEL__ -Werror-implicit-function-declaration $CPPFLAGS"
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+#include <linux/kernel.h>
+#include <linux/syscall.h>
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_linux_syscall=yes
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_linux_syscall=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  CPPFLAGS="$ac_save_CPPFLAGS"
   fi
+  { $as_echo "$as_me:$LINENO: result: $ac_linux_syscall" >&5
+$as_echo "$ac_linux_syscall" >&6; }
 
 
   { $as_echo "$as_me:$LINENO: checking for linux/seq_file.h in kernel" >&5
 $as_echo_n "checking for linux/seq_file.h in kernel... " >&6; }
-  if test -f "${LINUX_KERNEL_PATH}/include/linux/seq_file.h"; then
-    ac_linux_seq_file=yes
-    { $as_echo "$as_me:$LINENO: result: $ac_linux_seq_file" >&5
-$as_echo "$ac_linux_seq_file" >&6; }
+
+  if test $AFS_SYSKVERS -ge 26 ; then
+      rm -fr conftest.dir
+  if test "x$ac_linux_kbuild_requires_extra_cflags" = "xyes" ; then
+    CFLAGS_PREFIX='EXTRA_'
+  fi
+  if mkdir conftest.dir &&
+    cat >conftest.dir/Makefile <<_ACEOF &&
+${CFLAGS_PREFIX}CFLAGS += $CPPFLAGS
+
+obj-m += conftest.o
+_ACEOF
+    cat >conftest.dir/conftest.c <<\_ACEOF &&
+/* confdefs.h */
+_ACEOF
+    cat confdefs.h >>conftest.dir/conftest.c &&
+    cat >>conftest.dir/conftest.c <<\_ACEOF &&
+/* end confdefs.h */
+#include <linux/module.h>
+#include <linux/seq_file.h>
+
+void conftest(void)
+{
+
+}
+
+MODULE_LICENSE("http://www.openafs.org/dl/license10.html";);
+_ACEOF
+    echo make -C $LINUX_KERNEL_PATH M=$SRCDIR_PARENT/conftest.dir modules KBUILD_VERBOSE=1 >&5 &&
+    make -C $LINUX_KERNEL_PATH M=$SRCDIR_PARENT/conftest.dir modules KBUILD_VERBOSE=1 >&5 2>conftest.err &&
+    ! grep -i "^WARNING: .* undefined!$" conftest.err >/dev/null 2>&1
+    then ac_linux_seq_file=yes
+    else
+      sed '/^ *+/d' conftest.err >&5
+      echo "$as_me: failed using Makefile:" >&5
+      sed 's/^/| /' conftest.dir/Makefile >&5
+      echo "$as_me: and program was:" >&5
+      sed 's/^/| /' conftest.dir/conftest.c >&5
+      ac_linux_seq_file=no
+  fi; rm -fr conftest.err conftest.dir
   else
-    ac_linux_seq_file=no
-    { $as_echo "$as_me:$LINENO: result: $ac_linux_seq_file" >&5
-$as_echo "$ac_linux_seq_file" >&6; }
+
+  ac_save_CPPFLAGS="$CPPFLAGS"
+  CPPFLAGS="-I$LINUX_KERNEL_PATH/include -D__KERNEL__ -Werror-implicit-function-declaration $CPPFLAGS"
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+#include <linux/kernel.h>
+#include <linux/seq_file.h>
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_linux_seq_file=yes
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_linux_seq_file=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  CPPFLAGS="$ac_save_CPPFLAGS"
   fi
+  { $as_echo "$as_me:$LINENO: result: $ac_linux_seq_file" >&5
+$as_echo "$ac_linux_seq_file" >&6; }
 
 
   { $as_echo "$as_me:$LINENO: checking for 3rd argument in posix_lock_file found in new kernels" >&5
@@ -11401,18 +11567,64 @@
 
 { $as_echo "$as_me:$LINENO: checking for SELinux kernel" >&5
 $as_echo_n "checking for SELinux kernel... " >&6; }
-save_CPPFLAGS="$CPPFLAGS"
-CPPFLAGS="-I${LINUX_KERNEL_PATH}/include $CPPFLAGS"
 if test "${ac_cv_linux_kernel_is_selinux+set}" = set; then
   $as_echo_n "(cached) " >&6
 else
 
-cat >conftest.$ac_ext <<_ACEOF
+
+  if test $AFS_SYSKVERS -ge 26 ; then
+      rm -fr conftest.dir
+  if test "x$ac_linux_kbuild_requires_extra_cflags" = "xyes" ; then
+    CFLAGS_PREFIX='EXTRA_'
+  fi
+  if mkdir conftest.dir &&
+    cat >conftest.dir/Makefile <<_ACEOF &&
+${CFLAGS_PREFIX}CFLAGS += $CPPFLAGS
+
+obj-m += conftest.o
+_ACEOF
+    cat >conftest.dir/conftest.c <<\_ACEOF &&
+/* confdefs.h */
+_ACEOF
+    cat confdefs.h >>conftest.dir/conftest.c &&
+    cat >>conftest.dir/conftest.c <<\_ACEOF &&
+/* end confdefs.h */
+#include <linux/module.h>
+#include <linux/autoconf.h>
+
+void conftest(void)
+{
+#ifndef CONFIG_SECURITY_SELINUX
+   #error not SELINUX
+   #endif
+}
+
+MODULE_LICENSE("http://www.openafs.org/dl/license10.html";);
+_ACEOF
+    echo make -C $LINUX_KERNEL_PATH M=$SRCDIR_PARENT/conftest.dir modules KBUILD_VERBOSE=1 >&5 &&
+    make -C $LINUX_KERNEL_PATH M=$SRCDIR_PARENT/conftest.dir modules KBUILD_VERBOSE=1 >&5 2>conftest.err &&
+    ! grep -i "^WARNING: .* undefined!$" conftest.err >/dev/null 2>&1
+    then ac_cv_linux_kernel_is_selinux=yes
+    else
+      sed '/^ *+/d' conftest.err >&5
+      echo "$as_me: failed using Makefile:" >&5
+      sed 's/^/| /' conftest.dir/Makefile >&5
+      echo "$as_me: and program was:" >&5
+      sed 's/^/| /' conftest.dir/conftest.c >&5
+      ac_cv_linux_kernel_is_selinux=no
+  fi; rm -fr conftest.err conftest.dir
+  else
+
+  ac_save_CPPFLAGS="$CPPFLAGS"
+  CPPFLAGS="-I$LINUX_KERNEL_PATH/include -D__KERNEL__ -Werror-implicit-function-declaration $CPPFLAGS"
+  cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
+
+#include <linux/kernel.h>
 #include <linux/autoconf.h>
 int
 main ()
@@ -11451,11 +11663,13 @@
 fi
 
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  CPPFLAGS="$ac_save_CPPFLAGS"
+  fi
 fi
 
 { $as_echo "$as_me:$LINENO: result: $ac_cv_linux_kernel_is_selinux" >&5
 $as_echo "$ac_cv_linux_kernel_is_selinux" >&6; }
-CPPFLAGS="$save_CPPFLAGS"
+
 
   { $as_echo "$as_me:$LINENO: checking for 5th argument in sock_create found in some SELinux kernels" >&5
 $as_echo_n "checking for 5th argument in sock_create found in some SELinux kernels... " >&6; }
@@ -11882,8 +12096,99 @@
 else
   { $as_echo "$as_me:$LINENO: checking for redhat kernel configuration" >&5
 $as_echo_n "checking for redhat kernel configuration... " >&6; }
-  if test -f "${LINUX_KERNEL_PATH}/include/linux/rhconfig.h"; then
-    ac_linux_rhconfig=yes
+
+  if test $AFS_SYSKVERS -ge 26 ; then
+      rm -fr conftest.dir
+  if test "x$ac_linux_kbuild_requires_extra_cflags" = "xyes" ; then
+    CFLAGS_PREFIX='EXTRA_'
+  fi
+  if mkdir conftest.dir &&
+    cat >conftest.dir/Makefile <<_ACEOF &&
+${CFLAGS_PREFIX}CFLAGS += $CPPFLAGS
+
+obj-m += conftest.o
+_ACEOF
+    cat >conftest.dir/conftest.c <<\_ACEOF &&
+/* confdefs.h */
+_ACEOF
+    cat confdefs.h >>conftest.dir/conftest.c &&
+    cat >>conftest.dir/conftest.c <<\_ACEOF &&
+/* end confdefs.h */
+#include <linux/module.h>
+#include <linux/rhconfig.h>
+
+void conftest(void)
+{
+
+}
+
+MODULE_LICENSE("http://www.openafs.org/dl/license10.html";);
+_ACEOF
+    echo make -C $LINUX_KERNEL_PATH M=$SRCDIR_PARENT/conftest.dir modules KBUILD_VERBOSE=1 >&5 &&
+    make -C $LINUX_KERNEL_PATH M=$SRCDIR_PARENT/conftest.dir modules KBUILD_VERBOSE=1 >&5 2>conftest.err &&
+    ! grep -i "^WARNING: .* undefined!$" conftest.err >/dev/null 2>&1
+    then ac_linux_rhconfig=yes
+    else
+      sed '/^ *+/d' conftest.err >&5
+      echo "$as_me: failed using Makefile:" >&5
+      sed 's/^/| /' conftest.dir/Makefile >&5
+      echo "$as_me: and program was:" >&5
+      sed 's/^/| /' conftest.dir/conftest.c >&5
+      ac_linux_rhconfig=no
+  fi; rm -fr conftest.err conftest.dir
+  else
+
+  ac_save_CPPFLAGS="$CPPFLAGS"
+  CPPFLAGS="-I$LINUX_KERNEL_PATH/include -D__KERNEL__ -Werror-implicit-function-declaration $CPPFLAGS"
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+#include <linux/kernel.h>
+#include <linux/rhconfig.h>
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_linux_rhconfig=yes
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_linux_rhconfig=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  CPPFLAGS="$ac_save_CPPFLAGS"
+  fi
+  { $as_echo "$as_me:$LINENO: result: $ac_linux_rhconfig" >&5
+$as_echo "$ac_linux_rhconfig" >&6; }
+  if test $ac_linux_rhconfig = yes; then
     RHCONFIG_SP="-D__BOOT_KERNEL_UP=1 -D__BOOT_KERNEL_SMP=0"
     RHCONFIG_MP="-D__BOOT_KERNEL_UP=0 -D__BOOT_KERNEL_SMP=1"
     { $as_echo "$as_me:$LINENO: result: $ac_linux_rhconfig" >&5
@@ -11892,10 +12197,6 @@
         { $as_echo "$as_me:$LINENO: WARNING: /boot/kernel.h does not exist. build may fail" >&5
 $as_echo "$as_me: WARNING: /boot/kernel.h does not exist. build may fail" >&2;}
     fi
-  else
-    ac_linux_rhconfig=no
-    { $as_echo "$as_me:$LINENO: result: $ac_linux_rhconfig" >&5
-$as_echo "$ac_linux_rhconfig" >&6; }
   fi
 fi
 
--- openafs/configure-libafs.dist	2008-09-22 22:09:32.000000000 -0400
+++ openafs/configure-libafs	2009-03-30 18:40:26.000000000 -0400
@@ -10780,28 +10780,192 @@
 
   { echo "$as_me:$LINENO: checking for linux/syscall.h in kernel" >&5
 echo $ECHO_N "checking for linux/syscall.h in kernel... $ECHO_C" >&6; }
-  if test -f "${LINUX_KERNEL_PATH}/include/linux/syscall.h"; then
-    ac_linux_syscall=yes
-    { echo "$as_me:$LINENO: result: $ac_linux_syscall" >&5
-echo "${ECHO_T}$ac_linux_syscall" >&6; }
+
+  if test $AFS_SYSKVERS -ge 26 ; then
+      rm -fr conftest.dir
+  if test "x$ac_linux_kbuild_requires_extra_cflags" = "xyes" ; then
+    CFLAGS_PREFIX='EXTRA_'
+  fi
+  if mkdir conftest.dir &&
+    cat >conftest.dir/Makefile <<_ACEOF &&
+${CFLAGS_PREFIX}CFLAGS += $CPPFLAGS
+
+obj-m += conftest.o
+_ACEOF
+    cat >conftest.dir/conftest.c <<\_ACEOF &&
+/* confdefs.h */
+_ACEOF
+    cat confdefs.h >>conftest.dir/conftest.c &&
+    cat >>conftest.dir/conftest.c <<\_ACEOF &&
+/* end confdefs.h */
+#include <linux/module.h>
+#include <linux/syscall.h>
+
+void conftest(void)
+{
+
+}
+
+MODULE_LICENSE("http://www.openafs.org/dl/license10.html";);
+_ACEOF
+    echo make -C $LINUX_KERNEL_PATH M=$SRCDIR_PARENT/conftest.dir modules KBUILD_VERBOSE=1 >&5 &&
+    make -C $LINUX_KERNEL_PATH M=$SRCDIR_PARENT/conftest.dir modules KBUILD_VERBOSE=1 >&5 2>conftest.err &&
+    ! grep -i "^WARNING: .* undefined!$" conftest.err >/dev/null 2>&1
+    then ac_linux_syscall=yes
+    else
+      sed '/^ *+/d' conftest.err >&5
+      echo "$as_me: failed using Makefile:" >&5
+      sed 's/^/| /' conftest.dir/Makefile >&5
+      echo "$as_me: and program was:" >&5
+      sed 's/^/| /' conftest.dir/conftest.c >&5
+      ac_linux_syscall=no
+  fi; rm -fr conftest.err conftest.dir
   else
-    ac_linux_syscall=no
-    { echo "$as_me:$LINENO: result: $ac_linux_syscall" >&5
-echo "${ECHO_T}$ac_linux_syscall" >&6; }
+
+  ac_save_CPPFLAGS="$CPPFLAGS"
+  CPPFLAGS="-I$LINUX_KERNEL_PATH/include -D__KERNEL__ -Werror-implicit-function-declaration $CPPFLAGS"
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+#include <linux/kernel.h>
+#include <linux/syscall.h>
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_linux_syscall=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_linux_syscall=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  CPPFLAGS="$ac_save_CPPFLAGS"
   fi
+  { echo "$as_me:$LINENO: result: $ac_linux_syscall" >&5
+echo "${ECHO_T}$ac_linux_syscall" >&6; }
 
 
   { echo "$as_me:$LINENO: checking for linux/seq_file.h in kernel" >&5
 echo $ECHO_N "checking for linux/seq_file.h in kernel... $ECHO_C" >&6; }
-  if test -f "${LINUX_KERNEL_PATH}/include/linux/seq_file.h"; then
-    ac_linux_seq_file=yes
-    { echo "$as_me:$LINENO: result: $ac_linux_seq_file" >&5
-echo "${ECHO_T}$ac_linux_seq_file" >&6; }
+
+  if test $AFS_SYSKVERS -ge 26 ; then
+      rm -fr conftest.dir
+  if test "x$ac_linux_kbuild_requires_extra_cflags" = "xyes" ; then
+    CFLAGS_PREFIX='EXTRA_'
+  fi
+  if mkdir conftest.dir &&
+    cat >conftest.dir/Makefile <<_ACEOF &&
+${CFLAGS_PREFIX}CFLAGS += $CPPFLAGS
+
+obj-m += conftest.o
+_ACEOF
+    cat >conftest.dir/conftest.c <<\_ACEOF &&
+/* confdefs.h */
+_ACEOF
+    cat confdefs.h >>conftest.dir/conftest.c &&
+    cat >>conftest.dir/conftest.c <<\_ACEOF &&
+/* end confdefs.h */
+#include <linux/module.h>
+#include <linux/seq_file.h>
+
+void conftest(void)
+{
+
+}
+
+MODULE_LICENSE("http://www.openafs.org/dl/license10.html";);
+_ACEOF
+    echo make -C $LINUX_KERNEL_PATH M=$SRCDIR_PARENT/conftest.dir modules KBUILD_VERBOSE=1 >&5 &&
+    make -C $LINUX_KERNEL_PATH M=$SRCDIR_PARENT/conftest.dir modules KBUILD_VERBOSE=1 >&5 2>conftest.err &&
+    ! grep -i "^WARNING: .* undefined!$" conftest.err >/dev/null 2>&1
+    then ac_linux_seq_file=yes
+    else
+      sed '/^ *+/d' conftest.err >&5
+      echo "$as_me: failed using Makefile:" >&5
+      sed 's/^/| /' conftest.dir/Makefile >&5
+      echo "$as_me: and program was:" >&5
+      sed 's/^/| /' conftest.dir/conftest.c >&5
+      ac_linux_seq_file=no
+  fi; rm -fr conftest.err conftest.dir
   else
-    ac_linux_seq_file=no
-    { echo "$as_me:$LINENO: result: $ac_linux_seq_file" >&5
-echo "${ECHO_T}$ac_linux_seq_file" >&6; }
+
+  ac_save_CPPFLAGS="$CPPFLAGS"
+  CPPFLAGS="-I$LINUX_KERNEL_PATH/include -D__KERNEL__ -Werror-implicit-function-declaration $CPPFLAGS"
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+#include <linux/kernel.h>
+#include <linux/seq_file.h>
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_linux_seq_file=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_linux_seq_file=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  CPPFLAGS="$ac_save_CPPFLAGS"
   fi
+  { echo "$as_me:$LINENO: result: $ac_linux_seq_file" >&5
+echo "${ECHO_T}$ac_linux_seq_file" >&6; }
 
 
   { echo "$as_me:$LINENO: checking for 3rd argument in posix_lock_file found in new kernels" >&5
@@ -10906,18 +11070,64 @@
 
 { echo "$as_me:$LINENO: checking for SELinux kernel" >&5
 echo $ECHO_N "checking for SELinux kernel... $ECHO_C" >&6; }
-save_CPPFLAGS="$CPPFLAGS"
-CPPFLAGS="-I${LINUX_KERNEL_PATH}/include $CPPFLAGS"
 if test "${ac_cv_linux_kernel_is_selinux+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
-cat >conftest.$ac_ext <<_ACEOF
+
+  if test $AFS_SYSKVERS -ge 26 ; then
+      rm -fr conftest.dir
+  if test "x$ac_linux_kbuild_requires_extra_cflags" = "xyes" ; then
+    CFLAGS_PREFIX='EXTRA_'
+  fi
+  if mkdir conftest.dir &&
+    cat >conftest.dir/Makefile <<_ACEOF &&
+${CFLAGS_PREFIX}CFLAGS += $CPPFLAGS
+
+obj-m += conftest.o
+_ACEOF
+    cat >conftest.dir/conftest.c <<\_ACEOF &&
+/* confdefs.h */
+_ACEOF
+    cat confdefs.h >>conftest.dir/conftest.c &&
+    cat >>conftest.dir/conftest.c <<\_ACEOF &&
+/* end confdefs.h */
+#include <linux/module.h>
+#include <linux/autoconf.h>
+
+void conftest(void)
+{
+#ifndef CONFIG_SECURITY_SELINUX
+   #error not SELINUX
+   #endif
+}
+
+MODULE_LICENSE("http://www.openafs.org/dl/license10.html";);
+_ACEOF
+    echo make -C $LINUX_KERNEL_PATH M=$SRCDIR_PARENT/conftest.dir modules KBUILD_VERBOSE=1 >&5 &&
+    make -C $LINUX_KERNEL_PATH M=$SRCDIR_PARENT/conftest.dir modules KBUILD_VERBOSE=1 >&5 2>conftest.err &&
+    ! grep -i "^WARNING: .* undefined!$" conftest.err >/dev/null 2>&1
+    then ac_cv_linux_kernel_is_selinux=yes
+    else
+      sed '/^ *+/d' conftest.err >&5
+      echo "$as_me: failed using Makefile:" >&5
+      sed 's/^/| /' conftest.dir/Makefile >&5
+      echo "$as_me: and program was:" >&5
+      sed 's/^/| /' conftest.dir/conftest.c >&5
+      ac_cv_linux_kernel_is_selinux=no
+  fi; rm -fr conftest.err conftest.dir
+  else
+
+  ac_save_CPPFLAGS="$CPPFLAGS"
+  CPPFLAGS="-I$LINUX_KERNEL_PATH/include -D__KERNEL__ -Werror-implicit-function-declaration $CPPFLAGS"
+  cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
+
+#include <linux/kernel.h>
 #include <linux/autoconf.h>
 int
 main ()
@@ -10955,11 +11165,13 @@
 fi
 
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  CPPFLAGS="$ac_save_CPPFLAGS"
+  fi
 fi
 
 { echo "$as_me:$LINENO: result: $ac_cv_linux_kernel_is_selinux" >&5
 echo "${ECHO_T}$ac_cv_linux_kernel_is_selinux" >&6; }
-CPPFLAGS="$save_CPPFLAGS"
+
 
   { echo "$as_me:$LINENO: checking for 5th argument in sock_create found in some SELinux kernels" >&5
 echo $ECHO_N "checking for 5th argument in sock_create found in some SELinux kernels... $ECHO_C" >&6; }
@@ -11279,8 +11491,98 @@
 else
   { echo "$as_me:$LINENO: checking for redhat kernel configuration" >&5
 echo $ECHO_N "checking for redhat kernel configuration... $ECHO_C" >&6; }
-  if test -f "${LINUX_KERNEL_PATH}/include/linux/rhconfig.h"; then
-    ac_linux_rhconfig=yes
+
+  if test $AFS_SYSKVERS -ge 26 ; then
+      rm -fr conftest.dir
+  if test "x$ac_linux_kbuild_requires_extra_cflags" = "xyes" ; then
+    CFLAGS_PREFIX='EXTRA_'
+  fi
+  if mkdir conftest.dir &&
+    cat >conftest.dir/Makefile <<_ACEOF &&
+${CFLAGS_PREFIX}CFLAGS += $CPPFLAGS
+
+obj-m += conftest.o
+_ACEOF
+    cat >conftest.dir/conftest.c <<\_ACEOF &&
+/* confdefs.h */
+_ACEOF
+    cat confdefs.h >>conftest.dir/conftest.c &&
+    cat >>conftest.dir/conftest.c <<\_ACEOF &&
+/* end confdefs.h */
+#include <linux/module.h>
+#include <linux/rhconfig.h>
+
+void conftest(void)
+{
+
+}
+
+MODULE_LICENSE("http://www.openafs.org/dl/license10.html";);
+_ACEOF
+    echo make -C $LINUX_KERNEL_PATH M=$SRCDIR_PARENT/conftest.dir modules KBUILD_VERBOSE=1 >&5 &&
+    make -C $LINUX_KERNEL_PATH M=$SRCDIR_PARENT/conftest.dir modules KBUILD_VERBOSE=1 >&5 2>conftest.err &&
+    ! grep -i "^WARNING: .* undefined!$" conftest.err >/dev/null 2>&1
+    then ac_linux_rhconfig=yes
+    else
+      sed '/^ *+/d' conftest.err >&5
+      echo "$as_me: failed using Makefile:" >&5
+      sed 's/^/| /' conftest.dir/Makefile >&5
+      echo "$as_me: and program was:" >&5
+      sed 's/^/| /' conftest.dir/conftest.c >&5
+      ac_linux_rhconfig=no
+  fi; rm -fr conftest.err conftest.dir
+  else
+
+  ac_save_CPPFLAGS="$CPPFLAGS"
+  CPPFLAGS="-I$LINUX_KERNEL_PATH/include -D__KERNEL__ -Werror-implicit-function-declaration $CPPFLAGS"
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+#include <linux/kernel.h>
+#include <linux/rhconfig.h>
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_linux_rhconfig=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_linux_rhconfig=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  CPPFLAGS="$ac_save_CPPFLAGS"
+  fi
+  { echo "$as_me:$LINENO: result: $ac_linux_rhconfig" >&5
+echo "${ECHO_T}$ac_linux_rhconfig" >&6; }
+  if test $ac_linux_rhconfig = yes; then
     RHCONFIG_SP="-D__BOOT_KERNEL_UP=1 -D__BOOT_KERNEL_SMP=0"
     RHCONFIG_MP="-D__BOOT_KERNEL_UP=0 -D__BOOT_KERNEL_SMP=1"
     { echo "$as_me:$LINENO: result: $ac_linux_rhconfig" >&5
@@ -11289,10 +11591,6 @@
         { echo "$as_me:$LINENO: WARNING: /boot/kernel.h does not exist. build may fail" >&5
 echo "$as_me: WARNING: /boot/kernel.h does not exist. build may fail" >&2;}
     fi
-  else
-    ac_linux_rhconfig=no
-    { echo "$as_me:$LINENO: result: $ac_linux_rhconfig" >&5
-echo "${ECHO_T}$ac_linux_rhconfig" >&6; }
   fi
 fi
 

Reply via email to