linux26-build-update-20060126
[openafs.git] / src / cf / linux-test3.m4
1 AC_DEFUN([LINUX_KERNEL_LINUX_SYSCALL_H],[
2   AC_MSG_CHECKING(for linux/syscall.h in kernel)
3   if test -f "${LINUX_KERNEL_PATH}/include/linux/syscall.h"; then
4     ac_linux_syscall=yes
5     AC_MSG_RESULT($ac_linux_syscall)
6   else
7     ac_linux_syscall=no
8     AC_MSG_RESULT($ac_linux_syscall)
9   fi
10 ])
11
12 AC_DEFUN([LINUX_NEED_RHCONFIG],[
13 RHCONFIG_SP=""
14 RHCONFIG_MP=""
15 if test "x$enable_redhat_buildsys" = "xyes"; then
16   AC_MSG_WARN(Configured to build from a Red Hat SPEC file)
17 else
18   AC_MSG_CHECKING(for redhat kernel configuration)
19   if test -f "${LINUX_KERNEL_PATH}/include/linux/rhconfig.h"; then
20     ac_linux_rhconfig=yes
21     RHCONFIG_SP="-D__BOOT_KERNEL_UP=1 -D__BOOT_KERNEL_SMP=0"
22     RHCONFIG_MP="-D__BOOT_KERNEL_UP=0 -D__BOOT_KERNEL_SMP=1"
23     AC_MSG_RESULT($ac_linux_rhconfig)
24     if test ! -f "/boot/kernel.h"; then
25         AC_MSG_WARN([/boot/kernel.h does not exist. build may fail])
26     fi
27   else
28     ac_linux_rhconfig=no
29     AC_MSG_RESULT($ac_linux_rhconfig)
30   fi
31 fi
32 AC_SUBST(RHCONFIG_SP)
33 AC_SUBST(RHCONFIG_MP)
34 ])
35
36 AC_DEFUN([LINUX_WHICH_MODULES],[
37 if test "x$enable_redhat_buildsys" = "xyes"; then
38   MPS=Default
39 else
40   save_CPPFLAGS="$CPPFLAGS"
41   CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $RHCONFIG_SP $CPPFLAGS"
42   AC_MSG_CHECKING(which kernel modules to build)
43   if test "x$ac_linux_rhconfig" = "xyes"; then
44       MPS="MP SP"
45   else
46   AC_CACHE_VAL(ac_cv_linux_config_smp, [
47   AC_TRY_COMPILE(
48 [#include <linux/config.h>
49 ],
50 [#ifndef CONFIG_SMP
51 lose;
52 #endif
53 ],
54   ac_cv_linux_config_smp=yes,
55   ac_cv_linux_config_smp=no)])
56   dnl AC_MSG_RESULT($ac_cv_linux_config_smp)
57       if test "x$ac_cv_linux_config_smp" = "xyes"; then
58           MPS=MP
59       else
60           MPS=SP
61       fi
62   fi
63   CPPFLAGS=$save_CPPFLAGS
64   AC_MSG_RESULT($MPS)
65 fi
66 AC_SUBST(MPS)
67 ])
68
69 AC_DEFUN([LINUX_KERNEL_SELINUX],[
70 AC_MSG_CHECKING(for SELinux kernel)
71 save_CPPFLAGS="$CPPFLAGS"
72 CPPFLAGS="-I${LINUX_KERNEL_PATH}/include $CPPFLAGS"
73 AC_CACHE_VAL(ac_cv_linux_kernel_is_selinux,
74 [
75 AC_TRY_COMPILE(
76   [#include <linux/autoconf.h>],
77   [#ifndef CONFIG_SECURITY_SELINUX
78    #error not SELINUX
79    #endif],
80   ac_cv_linux_kernel_is_selinux=yes,
81   ac_cv_linux_kernel_is_selinux=no)])
82 AC_MSG_RESULT($ac_cv_linux_kernel_is_selinux)
83 CPPFLAGS="$save_CPPFLAGS"])
84
85 AC_DEFUN([LINUX_KERNEL_SOCK_CREATE],[
86 AC_MSG_CHECKING(for 5th argument in sock_create found in some SELinux kernels)
87 save_CPPFLAGS="$CPPFLAGS"
88 CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ -DKBUILD_BASENAME=\\"libafs\\" $CPPFLAGS"
89 AC_CACHE_VAL(ac_cv_linux_kernel_sock_create_v,
90 [
91 AC_TRY_COMPILE(
92   [#include <linux/net.h>],
93   [
94   sock_create(0,0,0,0,0)
95   ],
96   ac_cv_linux_kernel_sock_create_v=yes,
97   ac_cv_linux_kernel_sock_create_v=no)])
98 AC_MSG_RESULT($ac_cv_linux_kernel_sock_create_v)
99 CPPFLAGS="$save_CPPFLAGS"])
100
101 AC_DEFUN([LINUX_KERNEL_PAGE_FOLLOW_LINK],[
102 AC_MSG_CHECKING(for page_follow_link_light vs page_follow_link)
103 save_CPPFLAGS="$CPPFLAGS"
104 CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-default -Werror-implicit-function-declaration -DKBUILD_BASENAME=\"libafs\" -D__KERNEL__ $CPPFLAGS"
105 AC_CACHE_VAL(ac_cv_linux_kernel_page_follow_link,
106 [
107 AC_TRY_COMPILE(
108   [#include <linux/fs.h>],
109   [
110   page_follow_link(0,0)
111   ],
112   ac_cv_linux_kernel_page_follow_link=yes,
113   ac_cv_linux_kernel_page_follow_link=no)])
114 AC_MSG_RESULT($ac_cv_linux_kernel_page_follow_link)
115 CPPFLAGS="$save_CPPFLAGS"])
116
117 AC_DEFUN([LINUX_KERNEL_LINUX_SEQ_FILE_H],[
118   AC_MSG_CHECKING(for linux/seq_file.h in kernel)
119   if test -f "${LINUX_KERNEL_PATH}/include/linux/seq_file.h"; then
120     ac_linux_seq_file=yes
121     AC_MSG_RESULT($ac_linux_seq_file)
122   else
123     ac_linux_seq_file=no
124     AC_MSG_RESULT($ac_linux_seq_file)
125   fi
126 ])