[Pkg-alsa-devel] Bug#531668: alsa-driver autoconf script is broken

Ben Hutchings ben at decadent.org.uk
Sat Mar 27 02:28:34 UTC 2010


On Sun, 2009-12-20 at 02:22 +0000, Ben Hutchings wrote:
> The alsa-driver configure script performs file and compile checks
> without using kbuild.  This is bound to fail sometimes, as has happened
> here.  The attached patches fix the worst problems.  You will of course
> need to regenerate the configure script after applying these.
> 
> Note, there are still compiler errors when building against 2.6.32.  But
> I am not going to fix all this package's bugs.

Here's another patch which fixes more brain-dead checks in the configure
scripts:

--- alsa-driver-1.0.21+dfsg/configure.in~	2010-03-27 01:33:53.000000000 +0000
+++ alsa-driver-1.0.21+dfsg/configure.in	2010-03-27 01:57:37.000000000 +0000
@@ -126,82 +126,14 @@
   fi
   AC_MSG_RESULT(yes)
 ])
-CHECK_REQUIRED_KERNEL_HEADER([linux/version.h])
-CHECK_REQUIRED_KERNEL_HEADER([linux/autoconf.h])
 
 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/linux/version.h; then
-  KERNDIR=$kernelbuild
-else
-  KERNDIR=$CONFIG_SND_KERNELSRC
-fi
-AC_TRY_RUN([
-#include <stdio.h>
-#include <ctype.h>
-#include <stdlib.h>
-#include "$KERNDIR/include/linux/version.h"
-#ifndef UTS_RELEASE
-#include "$KERNDIR/include/linux/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_KERNELDIR" && make kernelversion 2>/dev/null)"
+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`
--- END ---

Finally you need to remove include/linux/utsrelease.h as it is
preventing the real header from being included.

Ben.

-- 
Ben Hutchings
Once a job is fouled up, anything done to improve it makes it worse.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 828 bytes
Desc: This is a digitally signed message part
URL: <http://lists.alioth.debian.org/pipermail/pkg-alsa-devel/attachments/20100327/27b97fcf/attachment.pgp>


More information about the Pkg-alsa-devel mailing list