Skip to content

Commit

Permalink
compile for other kernel versions
Browse files Browse the repository at this point in the history
Signed-off-by: Karsten Keil <kkeil@linux-pingi.de>
  • Loading branch information
Karsten Keil committed Mar 16, 2010
1 parent c859e27 commit 9dbfc71
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 9 deletions.
14 changes: 14 additions & 0 deletions acinclude.m4
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,17 @@ AC_DEFUN([AC_PROG_IFNAMES], [
dnl missing ifnames is not fatal
])

AC_DEFUN([AC_PROG_KERNEL_BUILD_DIR], [
AC_ARG_WITH([kerneldir],
AS_HELP_STRING([--with-kerneldir=<path>], [path to the kernel build directory]), [
if test -d $withval
then
KERNEL_BUILD_DIR=$withval
else
AC_MSG_ERROR([kernel build directory ($withval) does not exist])
fi
],
[
KERNEL_BUILD_DIR=
])
])
40 changes: 40 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,46 @@ AC_PROG_SORT

# Checks for library functions.

# define kernel build directory

AC_PROG_KERNEL_BUILD_DIR

if test -z "$KERNEL_BUILD_DIR"; then
if test -z "$KERNEL_VERSION"; then
KERNEL_VERSION=`uname -r`
fi
KERNEL_MOD_DIR=/lib/modules/$KERNEL_VERSION
KERNEL_BUILD_DIR=$KERNEL_MOD_DIR/build
KERNEL_SOURCE_DIR=$KERNEL_MOD_DIR/source
else
if test -d $KERNEL_BUILD_DIR/source; then
KERNEL_SOURCE_DIR=$KERNEL_BUILD_DIR/source
else
KERNEL_SOURCE_DIR=$KERNEL_BUILD_DIR
fi

fi

if test -d $KERNEL_BUILD_DIR -a -d $KERNEL_SOURCE_DIR; then
if test -f $KERNEL_BUILD_DIR/include/linux/version.h; then
vcl=`$GREP LINUX_VERSION_CODE $KERNEL_BUILD_DIR/include/linux/version.h`
KVERSION=`echo $vcl |$AWK '{printf ("%d.%d.%d",$3 / 65536, (($3/256)%256),$3 % 256)}'`
else
AC_MSG_ERROR([cannot find $KERNEL_BUILD_DIR/include/linux/version.h])
fi
if test x$KERNEL_BUILD_DIR = x$KERNEL_SOURCE_DIR; then
AC_MSG_NOTICE([Configured for $KVERSION kernel source $KERNEL_SOURCE_DIR])
else
AC_MSG_NOTICE([Configured for $KVERSION kernel build $KERNEL_BUILD_DIR source $KERNEL_SOURCE_DIR])
fi
else
AC_MSG_ERROR([kernel build tree does not exist build:$KERNEL_BUILD_DIR / source:$KERNEL_SOURCE_DIR])
fi

AC_SUBST(KERNEL_BUILD_DIR)
AC_SUBST(KERNEL_SOURCE_DIR)
AC_SUBST(KVERSION)

AC_CONFIG_FILES([
Makefile
standalone/Makefile
Expand Down
12 changes: 3 additions & 9 deletions standalone/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,9 @@ export INSTALL_PREFIX
#PATH to linux source/headers
#LINUX=/usr/src/linux

ifndef KVERS
KVERS:=$(shell uname -r)
endif

MODS := /lib/modules/$(KVERS)
LINUX := $(MODS)/build
LINUX_SOURCE := $(MODS)/source


LINUX := @KERNEL_BUILD_DIR@
LINUX_SOURCE := @KERNEL_SOURCE_DIR@
KVERSION := @KVERSION@

SDIRS := $(filter-out %.tmp_versions,$(shell $(FIND) ../drivers/isdn -type d -print))
SDIRS += $(filter-out %.tmp_versions,$(shell $(FIND) ../include/ -type d -print))
Expand Down

0 comments on commit 9dbfc71

Please sign in to comment.