dnl Path to linker (possibly with options) used by Linux.
dnl LINUX_AS
dnl Assembler used by Linux.
+dnl LINUX_MODULE_STYLE
+dnl Style of module building (2.4.0, 2.6.0, 2.6.6)
dnl LINUX_MODULE_EXT
dnl Module extension (.o or .ko)
dnl LINUX_MODPOST
AS_LINUX_MACHINE()
dnl check if the user supplied an rpm target arch
dnl override the LINUX_MACHINE value if he did
- AS_LINUX_RPM_TARGET($LINUX_KERNEL_RELEASE)
+ AS_LINUX_RPM_TARGET()
dnl find the kernel source tree for the given uname -r
- AS_LINUX_DIR($LINUX_KERNEL_RELEASE)
+ AS_LINUX_DIR()
dnl check if user supplied an EXTRAVERSION, and if not get from uname -r
AS_LINUX_EXTRAVERSION($LINUX_KERNEL_RELEASE)
dnl check if user supplied a config file; if not, guess a good one
fi
if test "${LINUX_DIR}" = "default" ; then
- dir="/lib/modules/`uname -r`/build";
+ dir="/lib/modules/$LINUX_KERNEL_RELEASE/build";
AS_TRY_LINUX_DIR([${dir}], [LINUX_DIR=${dir}], )
fi
if test "${LINUX_DIR}" = "default" ; then
dnl first argument is the kernel release building for
AC_DEFUN([AS_LINUX_RPM_TARGET],
[
- RELEASE=$1
+ RELEASE=$LINUX_KERNEL_RELEASE
AC_ARG_WITH([rpm-target],
[AC_HELP_STRING([--with-rpm-target=TARGET],
[specify the target arch to build for])],
dnl if we have rpm, try to guess the target of the kernel
dnl we want to build for using rpm
AC_PATH_PROG(RPM, rpm, yes, no)
- if test "x$RPM" = "xyes"
- then
- if rpm -q kernel-$RELEASE > /dev/null
- then
- LINUX_RPM_TARGET=`rpm -q --queryformat %{arch} kernel-$RELEASE`
+ if test "x$RPM" != "xno" ; then
+ AC_MSG_CHECKING([if rpm can be used to query packages])
+ if rpm -qa >/dev/null 2>/dev/null ; then
+ rpm_check=yes
else
- AC_MSG_NOTICE([Cannot guess target arch, consider setting it using --with-rpm-target])
+ rpm_check=no
+ fi
+ AC_MSG_RESULT($rpm_check)
+
+ if test "x$rpm_check" = yes ; then
+ if rpm -q kernel-$RELEASE > /dev/null
+ then
+ LINUX_RPM_TARGET=`rpm -q --queryformat %{arch} kernel-$RELEASE`
+ else
+ AC_MSG_NOTICE([Cannot guess target arch, consider setting it using --with-rpm-target])
+ fi
fi
fi
fi
rm -rf ${tmpdir}
LINUX_MODULE_EXT=".ko"
+ LINUX_MODULE_STYLE="2.6.6"
LINUX_CFLAGS="$LINUX_CFLAGS $LINUX_CFLAGS_MODULE"
AC_SUBST(LINUX_LD)
AC_SUBST(LINUX_AS)
AC_SUBST(LINUX_MODULE_EXT)
+ AC_SUBST(LINUX_MODULE_STYLE)
+ AC_SUBST(LINUX_MODPOST)
AC_MSG_RESULT([$LINUX_CFLAGS])
rm -rf ${tmpdir}
LINUX_MODULE_EXT=".o"
+ LINUX_MODULE_STYLE="2.4.0"
LINUX_CFLAGS="$LINUX_CFLAGS $LINUX_MODFLAGS"
AC_SUBST(LINUX_LD)
AC_SUBST(LINUX_AS)
AC_SUBST(LINUX_MODULE_EXT)
+ AC_SUBST(LINUX_MODULE_STYLE)
AC_MSG_RESULT([ok])
STRIP="$STRIP"
CFLAGS="$CFLAGS $LINUX_CFLAGS"
LINUX_DIR="$LINUX_DIR"
+LINUX_MODULE_STYLE="$LINUX_MODULE_STYLE"
+DEPMOD="$DEPMOD"
+LINUX_KERNELRELEASE="$LINUX_KERNELRELEASE"
mode=\$[1]
shift
esac
done
- if test "\$LINUX_MODULE_EXT" = .ko ; then
+ case "\$LINUX_MODULE_STYLE" in
+ 2.6.6)
set -x
mkdir -p .mods
echo \$LINUX_LD -r -o \$target.ko .mods/\$target.mod.o .mods/\$target.o
\$LINUX_LD -r -o \$target.ko .mods/\$target.mod.o .mods/\$target.o
set +x
- else
+
+ ;;
+ 2.6.0)
+ ;;
+ 2.4.0)
echo \$LINUX_LD -r -o \$target.ko \$[*]
\$LINUX_LD -r -o \$target.ko \$[*]
- fi
+ ;;
+ esac
;;
--install)
echo uninstall "\$module_src" "\$module_dest"
rm -f "\$module_dest"
;;
+--finish)
+ # run depmod here
+ if [ "$prefix" = "/" ] ; then
+ \$DEPMOD -ae \$LINUX_KERNELRELEASE
+ fi
+ ;;
*)
echo Unknown mode \$mode >&2
exit 1