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