linux-look-for-syscall-h-in-kernel-20030519
[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(if kernel uses MODVERSIONS)
43   AC_CACHE_VAL(ac_cv_linux_config_modversions,[
44   AC_TRY_COMPILE(
45 [#include <linux/config.h>
46 ],
47 [#ifndef CONFIG_MODVERSIONS
48 lose;
49 #endif
50 ],
51   ac_cv_linux_config_modversions=yes,
52   ac_cv_linux_config_modversions=no)])
53   AC_MSG_RESULT($ac_cv_linux_config_modversions)
54   AC_MSG_CHECKING(which kernel modules to build)
55   if test "x$ac_linux_rhconfig" = "xyes" -o "x$ac_cv_linux_config_modversions" = "xno"; then
56       MPS="MP SP"
57   else
58   AC_CACHE_VAL(ac_cv_linux_config_smp, [
59   AC_TRY_COMPILE(
60 [#include <linux/config.h>
61 ],
62 [#ifndef CONFIG_SMP
63 lose;
64 #endif
65 ],
66   ac_cv_linux_config_smp=yes,
67   ac_cv_linux_config_smp=no)])
68   dnl AC_MSG_RESULT($ac_cv_linux_config_smp)
69       if test "x$ac_cv_linux_config_smp" = "xyes"; then
70           MPS=MP
71       else
72           MPS=SP
73       fi
74   fi
75   CPPFLAGS=$save_CPPFLAGS
76   AC_MSG_RESULT($MPS)
77 fi
78 AC_SUBST(MPS)
79 ])
80