Upstream | cc2ee17 | 1970-01-12 13:46:40 +0000 | [diff] [blame^] | 1 | dnl Handle the 2.4 module inside module/ |
| 2 | AC_DEFUN([AX_CONFIG_MODULE], |
| 3 | [ |
| 4 | if test ! -f $KINC/linux/autoconf.h; then |
| 5 | AC_MSG_ERROR([no suitably configured kernel include tree found]) |
| 6 | fi |
| 7 | |
| 8 | dnl --- Get Linux kernel version and compile parameters --- |
| 9 | |
| 10 | AC_SUBST(KVERS) |
| 11 | AC_MSG_CHECKING([for kernel version]) |
| 12 | dnl it's like this to handle mandrake's fubar version.h - bug #471448 |
| 13 | eval KVERS=`gcc -I$KINC -E -dM $KINC/linux/version.h | grep -w UTS_RELEASE | awk '{print $[]3}'` |
| 14 | AC_MSG_RESULT([$KVERS]) |
| 15 | case "$KVERS" in |
| 16 | 2.2.*|2.4.*) ;; |
| 17 | *) AC_MSG_ERROR([Unsupported kernel version]) |
| 18 | esac |
| 19 | |
| 20 | dnl Check for the minimal kernel version supported |
| 21 | AC_MSG_CHECKING([kernel version]) |
| 22 | AX_KERNEL_VERSION(2, 2, 10, <=, AC_MSG_RESULT([ok]), AC_MSG_ERROR([check html documentation install section])) |
| 23 | |
| 24 | dnl linux/spinlock.h added at some point in past |
| 25 | AC_MSG_CHECKING([for $KINC/linux/spinlock.h]) |
| 26 | if test -f $KINC/linux/spinlock.h; then |
| 27 | EXTRA_CFLAGS_MODULE="$EXTRA_CFLAGS_MODULE -DHAVE_LINUX_SPINLOCK_HEADER" |
| 28 | AC_MSG_RESULT([yes]) |
| 29 | else |
| 30 | AC_MSG_RESULT([no]) |
| 31 | fi |
| 32 | |
| 33 | AC_MSG_CHECKING([for rtc_lock]) |
| 34 | gcc -I$KINC -E $KINC/linux/mc146818rtc.h | grep rtc_lock >/dev/null |
| 35 | if test "$?" -eq 0; then |
| 36 | EXTRA_CFLAGS_MODULE="$EXTRA_CFLAGS_MODULE -DRTC_LOCK" |
| 37 | AC_MSG_RESULT([yes]) |
| 38 | else |
| 39 | AC_MSG_RESULT([no]) |
| 40 | fi |
| 41 | |
| 42 | arch="unknown" |
| 43 | AC_MSG_CHECKING(for x86 architecture) |
| 44 | AX_KERNEL_OPTION(CONFIG_X86, x86=1, x86=0) |
| 45 | AX_KERNEL_OPTION(CONFIG_X86_WP_WORKS_OK, x86=1, x86=$x86) |
| 46 | AX_MSG_RESULT_YN($x86) |
| 47 | test "$x86" = 1 && arch="x86" |
| 48 | |
| 49 | if test "$arch" = "unknown"; then |
| 50 | AC_MSG_CHECKING(for ia64 architecture) |
| 51 | AX_KERNEL_OPTION(CONFIG_IA64, ia64=1, ia64=0) |
| 52 | AX_MSG_RESULT_YN($ia64) |
| 53 | test "$ia64" = 1 && arch="ia64" |
| 54 | fi |
| 55 | |
| 56 | test "$arch" = "unknown" && AC_MSG_ERROR(Unsupported architecture) |
| 57 | |
| 58 | dnl check to see if kernel verion appropriate for arch |
| 59 | AC_MSG_CHECKING(arch/kernel version combination) |
| 60 | case "$arch" in |
| 61 | ia64) |
| 62 | AX_KERNEL_VERSION(2, 4, 18, <, AC_MSG_RESULT([ok]), |
| 63 | AC_MSG_ERROR([unsupported arch/kernel])) ;; |
| 64 | *) AC_MSG_RESULT([ok]) |
| 65 | esac |
| 66 | |
| 67 | dnl for now we do not support PREEMPT patch |
| 68 | AC_MSG_CHECKING([for preempt patch]) |
| 69 | AX_KERNEL_OPTION(CONFIG_PREEMPT,preempt=1,preempt=0) |
| 70 | AX_MSG_RESULT_YN([$preempt]) |
| 71 | test "$preempt" = 0 || AC_MSG_ERROR([unsupported kernel configuration : CONFIG_PREEMPT]) |
| 72 | |
| 73 | AC_SUBST(KINC) |
| 74 | |
| 75 | MODINSTALLDIR=/lib/modules/$KVERS |
| 76 | |
| 77 | OPROFILE_MODULE_ARCH=$arch |
| 78 | AC_SUBST(OPROFILE_MODULE_ARCH) |
| 79 | ] |
| 80 | ) |