From: David Schleef Date: Thu, 7 Aug 2003 02:46:16 +0000 (+0000) Subject: Add detection for kernel major/minor version X-Git-Tag: r0_7_69~262 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=836cbc3861ff38d919e9a5553c22741b71a97c76;p=comedi.git Add detection for kernel major/minor version --- diff --git a/configure.ac b/configure.ac index 85621811..cac693b9 100644 --- a/configure.ac +++ b/configure.ac @@ -16,8 +16,7 @@ AC_SUBST(VERSION) AC_PROG_CC -#DS_LINUX_2_4() -DS_LINUX_2_6() +DS_LINUX() #ERROR_CFLAGS="-Werror" diff --git a/m4/linux.m4 b/m4/linux.m4 index eb84b33c..2eafbdc9 100644 --- a/m4/linux.m4 +++ b/m4/linux.m4 @@ -1,7 +1,8 @@ AC_DEFUN(DS_LINUX_DIR, - [AC_ARG_WITH([linuxdir], +[ + AC_ARG_WITH([linuxdir], [AC_HELP_STRING([--with-linuxdir], [specify path to Linux source directory])], [LINUX_DIR="${withval}"], @@ -45,9 +46,36 @@ AC_DEFUN(DS_TRY_LINUX_DIR, AC_MSG_RESULT($result) ]) -AC_DEFUN(DS_LINUX_2_6, +AC_DEFUN(DS_LINUX, [ DS_LINUX_DIR() + + AC_MSG_CHECKING([Linux version]) + + LINUX_VERSION=$(grep UTS_RELEASE ${LINUX_DIR}/include/linux/version.h | \ + sed 's/[[^"]]*"\(.*\)\{1\}"/\1/') + + AC_MSG_RESULT([$LINUX_VERSION]) + + LINUX_VERSION_MAJOR=$(echo ${LINUX_VERSION} | cut -d. -f1) + LINUX_VERSION_MINOR=$(echo ${LINUX_VERSION} | cut -d. -f2) + + case $LINUX_VERSION_MAJOR.$LINUX_VERSION_MINOR in + 2.6) + DS_LINUX_2_6() + ;; + 2.[01234]) + DS_LINUX_2_4() + ;; + *) + AC_MSG_ERROR([Unknown Linux major.minor $LINUX_VERSION_MAJOR.$LINUX_VERSION_MINOR]) + ;; + esac + +]) + +AC_DEFUN(DS_LINUX_2_6, +[ AC_MSG_CHECKING(for Linux CFLAGS) tmpdir="`pwd`/tmp-noicrwa" @@ -100,7 +128,6 @@ EOF AC_DEFUN(DS_LINUX_2_4, [ - DS_LINUX_DIR() AC_MSG_CHECKING(for Linux CFLAGS) tmpdir="`pwd`/tmp-noicrwa"