b70f81949b70dd309916e15ae44123720c049b13
[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   AC_TRY_KBUILD([#include <linux/rhconfig.h>], [],
9     [ac_linux_rhconfig=yes], [ac_linux_rhconfig=no])
10   AC_MSG_RESULT($ac_linux_rhconfig)
11   if test x"$ac_linux_rhconfig" = xyes; then
12     RHCONFIG_SP="-D__BOOT_KERNEL_UP=1 -D__BOOT_KERNEL_SMP=0"
13     RHCONFIG_MP="-D__BOOT_KERNEL_UP=0 -D__BOOT_KERNEL_SMP=1"
14     AC_MSG_RESULT($ac_linux_rhconfig)
15     if test ! -f "/boot/kernel.h"; then
16         AC_MSG_WARN([/boot/kernel.h does not exist. build may fail])
17     fi
18   fi
19 fi
20 AC_SUBST(RHCONFIG_SP)
21 AC_SUBST(RHCONFIG_MP)
22 ])
23
24
25 dnl This depends on LINUX_CONFIG_H_EXISTS running first!
26
27 AC_DEFUN([LINUX_WHICH_MODULES],[
28 if test "x$enable_redhat_buildsys" = "xyes"; then
29   MPS=Default
30 else
31   save_CPPFLAGS="$CPPFLAGS"
32   CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $RHCONFIG_SP $CPPFLAGS"
33   AC_MSG_CHECKING(which kernel modules to build)
34   if test "x$ac_cv_linux_header_config_h" = "xyes"; then
35     CPPFLAGS="-DCONFIG_H_EXISTS $CPPFLAGS"
36   fi
37   if test "x$ac_linux_rhconfig" = "xyes"; then
38       MPS="MP SP"
39   else
40   AC_CACHE_VAL(ac_cv_linux_config_smp, [
41   AC_TRY_KBUILD(
42 [#ifdef CONFIG_H_EXISTS
43 #include <linux/config.h>
44 #endif
45 ],
46 [#ifndef CONFIG_SMP
47 lose;
48 #endif
49 ],
50   ac_cv_linux_config_smp=yes,
51   ac_cv_linux_config_smp=no)])
52   dnl AC_MSG_RESULT($ac_cv_linux_config_smp)
53       if test "x$ac_cv_linux_config_smp" = "xyes"; then
54           MPS=MP
55       else
56           MPS=SP
57       fi
58   fi
59   CPPFLAGS=$save_CPPFLAGS
60   AC_MSG_RESULT($MPS)
61 fi
62 AC_SUBST(MPS)
63 ])
64