From: Ben Hutchings Subject: [PATCH] Don't check autoconf.h or version.h directly Last-Update: 2010-05-23 The generated headers may be installed in various different places. Don't make assumptions about where they are. Use 'make kernelversion' to check the version. Index: alsa-driver-1.0.23+dfsg/configure.in =================================================================== --- alsa-driver-1.0.23+dfsg.orig/configure.in 2010-05-28 19:14:23.000000000 +0200 +++ alsa-driver-1.0.23+dfsg/configure.in 2010-05-28 19:14:23.000000000 +0200 @@ -212,77 +212,11 @@ dnl Check for kernel version... AC_MSG_CHECKING(for kernel version) -KERNEL_INC="-I$CONFIG_SND_KERNELSRC/include" -MAKE_ADDS="" -if test -n "$kernelbuild"; then - kpath="" - if test -d "$kernelbuild/include"; then - kpath="-I$kernelbuild/include" - fi - if test -d "$kernelbuild/include2"; then - kpath="$kpath -I$kernelbuild/include2" - MAKE_ADDS="O=$kernelbuild" - fi - KERNEL_INC="$kpath $KERNEL_INC" -fi -HACK_KERNEL_INC="" -ac_save_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS $KERNEL_INC $HACK_KERNEL_INC" -if test -n "$kernelbuild" -a -f $kernelbuild/include/$INCLUDE_VERSION_H; then - KERNDIR=$kernelbuild -else - KERNDIR=$CONFIG_SND_KERNELSRC -fi -AC_TRY_RUN([ -#include -#include -#include -#include "$KERNDIR/include/$INCLUDE_VERSION_H" -#ifndef UTS_RELEASE -#include "$KERNDIR/include/$INCLUDE_UTSRELEASE_H" -#endif -int main() -{ - FILE *f; - char kversion[128]; - char kpatchlevel[128]; - char ksublevel[128]; - char kextra[128]; - char *ptr, *dptr; -#ifdef UTS_RELEASE - f=fopen("./conftestdata","w"); - if (f) { - for (ptr = UTS_RELEASE, dptr = kversion; *ptr != '\0' && isdigit(*ptr); ptr++, dptr++) - *dptr = *ptr; - *dptr = '\0'; - if (*ptr == '.') - ptr++; - for (dptr = kpatchlevel; *ptr != '\0' && isdigit(*ptr); ptr++, dptr++) - *dptr = *ptr; - *dptr = '\0'; - if (*ptr == '.') - ptr++; - for (dptr = ksublevel; *ptr != '\0' && isdigit(*ptr); ptr++, dptr++) - *dptr = *ptr; - *dptr = '\0'; - for (dptr = kextra; *ptr != '\0'; ptr++, dptr++) - *dptr = *ptr; - *dptr = '\0'; - fprintf(f,"%s:%s:%s:%s\n",kversion,kpatchlevel,ksublevel,kextra); - fclose(f); - } - exit(0); -#else - exit(1); -#endif -}],kaversion=`cat conftestdata`, -kaversion="", -kaversion="") -CFLAGS="$ac_save_CFLAGS" -kversion=`echo $kaversion | cut -d : -f 1` -kpatchlevel=`echo $kaversion | cut -d : -f 2` -ksublevel=`echo $kaversion | cut -d : -f 3` -kextraversion=`echo $kaversion | cut -d : -f 4` +kaversion=`cd "$CONFIG_SND_KERNELSRC" && env -u MAKELEVEL make kernelversion` +kversion=`echo $kaversion | cut -d . -f 1` +kpatchlevel=`echo $kaversion | cut -d . -f 2` +ksublevel=`echo $kaversion | cut -d . -f 3` +kextraversion=`echo $kaversion | cut -d . -f 4` kversion=`expr $kversion + 0` kpatchlevel=`expr $kpatchlevel + 0` ksublevel=`expr $ksublevel + 0`