linux-under-under-smp-under-under-never-needs-to-be-defined-in-rhconfig-20010715
[openafs.git] / src / cf / linux-test3.m4
1 AC_DEFUN(LINUX_NEED_RHCONFIG,[
2 RHCONFIG_SP=""
3 RHCONFIG_MP=""
4 if test "x$enable_redhat_buildsys" = "xyes"; then
5   AC_MSG_WARN(Configured to build from a Red Hat SPEC file)
6 else
7   AC_MSG_CHECKING(for redhat kernel configuration)
8   if test -f "${LINUX_KERNEL_PATH}/include/linux/rhconfig.h"; then
9     ac_linux_rhconfig=yes
10     RHCONFIG_SP="-D__BOOT_KERNEL_UP=1 -D__BOOT_KERNEL_SMP=0"
11     RHCONFIG_MP="-D__BOOT_KERNEL_UP=0 -D__BOOT_KERNEL_SMP=1"
12     AC_MSG_RESULT($ac_linux_rhconfig)
13     if test ! -f "/boot/kernel.h"; then
14         AC_MSG_WARN([/boot/kernel.h does not exist. build may fail])
15     fi
16   else
17     ac_linux_rhconfig=no
18     AC_MSG_RESULT($ac_linux_rhconfig)
19   fi
20 fi
21 AC_SUBST(RHCONFIG_SP)
22 AC_SUBST(RHCONFIG_MP)
23 ])
24
25 AC_DEFUN(LINUX_WHICH_MODULES,[
26 if test "x$enable_redhat_buildsys" = "xyes"; then
27   MPS=Default
28 else
29   save_CPPFLAGS="$CPPFLAGS"
30   CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $RHCONFIG_SP $CPPFLAGS"
31   AC_MSG_CHECKING(if kernel uses MODVERSIONS)
32   AC_CACHE_VAL(ac_cv_linux_config_modversions,[
33   AC_TRY_COMPILE(
34 [#include <linux/config.h>
35 ],
36 [#ifndef CONFIG_MODVERSIONS
37 lose;
38 #endif
39 ],
40   ac_cv_linux_config_modversions=yes,
41   ac_cv_linux_config_modversions=no)])
42   AC_MSG_RESULT($ac_cv_linux_config_modversions)
43   AC_MSG_CHECKING(which kernel modules to build)
44   if test "x$ac_linux_rhconfig" = "xyes" -o "x$ac_cv_linux_config_modversions" = "xno"; then
45       MPS="MP SP"
46   else
47   AC_CACHE_VAL(ac_cv_linux_config_smp, [
48   AC_TRY_COMPILE(
49 [#include <linux/config.h>
50 ],
51 [#ifndef CONFIG_SMP
52 lose;
53 #endif
54 ],
55   ac_cv_linux_config_smp=yes,
56   ac_cv_linux_config_smp=no)])
57   dnl AC_MSG_RESULT($ac_cv_linux_config_smp)
58       if test "x$ac_cv_linux_config_smp" = "xyes"; then
59           MPS=MP
60       else
61           MPS=SP
62       fi
63   fi
64   CPPFLAGS=$save_CPPFLAGS
65   AC_MSG_RESULT($MPS)
66 fi
67 AC_SUBST(MPS)
68 ])
69