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

Ben Hutchings ben at decadent.org.uk
Sat Mar 27 04:06:10 UTC 2010


Here is a debdiff for all the required changes in alsa-driver to work
with 2.6.32.  This adds a call to autoconf at build time and modifies a
couple of existing patches accordingly.  You should also delete
debian/patches/disable_gcc_version_check2.patch.

Ben.

diff -u alsa-driver-1.0.21+dfsg/debian/control alsa-driver-1.0.21+dfsg/debian/control
--- alsa-driver-1.0.21+dfsg/debian/control
+++ alsa-driver-1.0.21+dfsg/debian/control
@@ -4,7 +4,7 @@
 Maintainer: Debian ALSA Maintainers <pkg-alsa-devel at lists.alioth.debian.org>
 Uploaders: Jordi Mallach <jordi at debian.org>, Elimar Riesebieter <riesebie at lxtec.de>
 Build-Depends-Indep: bzip2, cpio
-Build-Depends: debhelper (>= 7), quilt (>= 0.40), po-debconf
+Build-Depends: debhelper (>= 7), quilt (>= 0.40), po-debconf, autoconf (>= 2.60)
 Standards-Version: 3.8.3
 Homepage: http://www.alsa-project.org/
 Vcs-Svn: svn://svn.debian.org/pkg-alsa/trunk/alsa-driver
diff -u alsa-driver-1.0.21+dfsg/debian/rules alsa-driver-1.0.21+dfsg/debian/rules
--- alsa-driver-1.0.21+dfsg/debian/rules
+++ alsa-driver-1.0.21+dfsg/debian/rules
@@ -20,7 +20,8 @@
 	dh_testdir
 	dh_testroot
 	debconf-updatepo
-	-$(RM) build-stamp
+	-$(RM) build-stamp configure configure-stamp
+	-$(RM) -r autom4te.cache
 	-$(RM) include/isapnp.h
 	-$(RM) -r debian/patched
 	-$(RM) debian/files
@@ -37,6 +38,7 @@
 configure: debian/stamp-patched configure-stamp
 configure-stamp:
 	dh_testdir
+	autoconf
 	touch configure-stamp
 
 build: configure build-stamp
diff -u alsa-driver-1.0.21+dfsg/debian/changelog alsa-driver-1.0.21+dfsg/debian/changelog
--- alsa-driver-1.0.21+dfsg/debian/changelog
+++ alsa-driver-1.0.21+dfsg/debian/changelog
@@ -1,3 +1,12 @@
+alsa-driver (1.0.21+dfsg-2.1) unstable; urgency=low
+
+  * Fix configure script to use kbuild so that it works with Debian kernel
+    packages (Closes: #531668)
+  * Run autoconf at package build time
+  * Add missing #include to asihpi
+
+ -- Ben Hutchings <ben at decadent.org.uk>  Sat, 27 Mar 2010 02:30:02 +0000
+
 alsa-driver (1.0.21+dfsg-2) unstable; urgency=low
 
   [ Elimar Rieseieter ]
diff -u alsa-driver-1.0.21+dfsg/debian/patches/series alsa-driver-1.0.21+dfsg/debian/patches/series
--- alsa-driver-1.0.21+dfsg/debian/patches/series
+++ alsa-driver-1.0.21+dfsg/debian/patches/series
@@ -2,6 +2,9 @@
-disable_gcc_version_check2.patch
 core_oss_framepointer.patch
 debian_makefile_depmod.patch
 remove_maestro3.patch
 debian_dfsg_configure.patch
 hp_dv4t_msi.patch
+distinguish_kernel_makefile_and_source_dirs.patch
+use_kbuild_not_ac_try_compile.patch
+fix_version_check.patch
+fix_asihpi_includes.patch
diff -u alsa-driver-1.0.21+dfsg/debian/patches/disable_gcc_version_check1.patch alsa-driver-1.0.21+dfsg/debian/patches/disable_gcc_version_check1.patch
--- alsa-driver-1.0.21+dfsg/debian/patches/disable_gcc_version_check1.patch
+++ alsa-driver-1.0.21+dfsg/debian/patches/disable_gcc_version_check1.patch
@@ -1,9 +1,6 @@
 # disable_gcc_version_check1.patch by Thomas Hood
 #
 # Disable GCC version check in configure.in
-# disable_gcc_version_check2.dpatch is the result of running autoconf
-# after this patch has been applied. autom4te.cache can be deleted before
-# patching.
 Index: alsa-driver-1.0.21+dfsg/configure.in
 ===================================================================
 --- alsa-driver-1.0.21+dfsg.orig/configure.in	2009-09-04 20:49:33.000000000 +0200
diff -u alsa-driver-1.0.21+dfsg/debian/patches/debian_dfsg_configure.patch alsa-driver-1.0.21+dfsg/debian/patches/debian_dfsg_configure.patch
--- alsa-driver-1.0.21+dfsg/debian/patches/debian_dfsg_configure.patch
+++ alsa-driver-1.0.21+dfsg/debian/patches/debian_dfsg_configure.patch
@@ -1,40 +1,38 @@
 Prevent to not configure cs46xx, korg1212, maestro3, ymfpci. These drivers do
 have binary code in sorce.
-Index: alsa-driver-1.0.21+dfsg/configure
-===================================================================
---- alsa-driver-1.0.21+dfsg.orig/configure	2009-09-04 20:52:28.000000000 +0200
-+++ alsa-driver-1.0.21+dfsg/configure	2009-09-04 20:52:28.000000000 +0200
-@@ -1853,16 +1853,16 @@
-                             msnd-pinnacle, msnd-classic, pc98-cs4232, ad1889,
-                             als300, als4000, ali5451, atiixp, atiixp-modem,
-                             au8810, au8820, au8830, aw2, azt3328, bt87x,
--                            ca0106, cmipci, oxygen, cs4281, cs46xx, cs5530,
-+                            ca0106, cmipci, oxygen, cs4281, cs5530,
-                             cs5535audio, ctxfi, darla20, gina20, layla20,
-                             darla24, gina24, layla24, mona, mia, echo3g,
-                             indigo, indigoio, indigodj, indigoiox, indigodjx,
-                             emu10k1x, ens1370, ens1371, es1938, es1968,
-                             fm801, hda-intel, hdsp, hdspm, hifier, ice1712,
--                            ice1724, intel8x0, intel8x0m, korg1212, lx6464es,
--                            maestro3, mixart, nm256, pcxhr, riptide, rme32,
-+                            ice1724, intel8x0, intel8x0m, lx6464es,
-+                            mixart, nm256, pcxhr, riptide, rme32,
-                             rme96, rme9652, sis7019, sonicvibes, trident,
--                            via82xx, via82xx-modem, virtuoso, vx222, ymfpci,
-+                            via82xx, via82xx-modem, virtuoso, vx222,
-                             pdplus, asihpi, powermac, ps3, aoa,
-                             aoa-fabric-layout, aoa-onyx, aoa-tas, aoa-toonie,
-                             aoa-soundbus, aoa-soundbus-i2s, armaaci,
-@@ -1909,7 +1909,7 @@
-                           Possible options are:
-                             seq-hrtimer-default, seq-rtctimer-default,
-                             support-old-api, pcm-xrun-debug, ac97-power-save,
--                            sb16-csp, bt87x-overclock, cs46xx-new-dsp,
-+                            sb16-csp, bt87x-overclock,
-                             fm801-tea575x-bool, hda-hwdep, hda-reconfig,
-                             hda-input-beep, hda-input-jack, hda-patch-loader,
-                             hda-codec-realtek, hda-codec-analog,
-@@ -12587,23 +12587,6 @@
+--- alsa-driver-1.0.21+dfsg.orig/acinclude.m4
++++ alsa-driver-1.0.21+dfsg/acinclude.m4
+@@ -546,16 +546,16 @@
+   [                          msnd-pinnacle, msnd-classic, pc98-cs4232, ad1889, ]
+   [                          als300, als4000, ali5451, atiixp, atiixp-modem, ]
+   [                          au8810, au8820, au8830, aw2, azt3328, bt87x, ]
+-  [                          ca0106, cmipci, oxygen, cs4281, cs46xx, cs5530, ]
++  [                          ca0106, cmipci, oxygen, cs4281, cs5530, ]
+   [                          cs5535audio, ctxfi, darla20, gina20, layla20, ]
+   [                          darla24, gina24, layla24, mona, mia, echo3g, ]
+   [                          indigo, indigoio, indigodj, indigoiox, indigodjx, ]
+   [                          emu10k1x, ens1370, ens1371, es1938, es1968, ]
+   [                          fm801, hda-intel, hdsp, hdspm, hifier, ice1712, ]
+-  [                          ice1724, intel8x0, intel8x0m, korg1212, lx6464es, ]
+-  [                          maestro3, mixart, nm256, pcxhr, riptide, rme32, ]
++  [                          ice1724, intel8x0, intel8x0m, lx6464es, ]
++  [                          mixart, nm256, pcxhr, riptide, rme32, ]
+   [                          rme96, rme9652, sis7019, sonicvibes, trident, ]
+-  [                          via82xx, via82xx-modem, virtuoso, vx222, ymfpci, ]
++  [                          via82xx, via82xx-modem, virtuoso, vx222, ]
+   [                          pdplus, asihpi, powermac, ps3, aoa, ]
+   [                          aoa-fabric-layout, aoa-onyx, aoa-tas, aoa-toonie, ]
+   [                          aoa-soundbus, aoa-soundbus-i2s, armaaci, ]
+@@ -607,7 +607,7 @@
+   [                        Possible options are: ]
+   [                          seq-hrtimer-default, seq-rtctimer-default, ]
+   [                          support-old-api, pcm-xrun-debug, ac97-power-save, ]
+-  [                          sb16-csp, bt87x-overclock, cs46xx-new-dsp, ]
++  [                          sb16-csp, bt87x-overclock, ]
+   [                          fm801-tea575x-bool, hda-hwdep, hda-reconfig, ]
+   [                          hda-input-beep, hda-input-jack, hda-patch-loader, ]
+   [                          hda-codec-realtek, hda-codec-analog, ]
+@@ -1385,23 +1385,6 @@
        CONFIG_SND_CS4281="m"
      fi
    fi
@@ -58,7 +56,7 @@
    if alsa_check_kconfig_card "cs5530"; then
      if ( test "$CONFIG_SND_PCI" = "y" -o "$CONFIG_SND_PCI" = "m" ) &&
        ( test "$CONFIG_ISA_DMA_API" = "y" -o "$CONFIG_ISA_DMA_API" = "m" ); then
-@@ -13054,13 +13037,6 @@
+@@ -1852,13 +1835,6 @@
        CONFIG_SND_INTEL8X0M="m"
      fi
    fi
@@ -72,7 +70,7 @@
    if alsa_check_kconfig_card "lx6464es"; then
      if ( test "$CONFIG_SND_PCI" = "y" -o "$CONFIG_SND_PCI" = "m" ); then
        CONFIG_SND_TIMER="m"
-@@ -13068,16 +13044,6 @@
+@@ -1866,16 +1846,6 @@
        CONFIG_SND_LX6464ES="m"
      fi
    fi
@@ -89,7 +87,7 @@
    if alsa_check_kconfig_card "mixart"; then
      if ( test "$CONFIG_SND_PCI" = "y" -o "$CONFIG_SND_PCI" = "m" ); then
        CONFIG_SND_TIMER="m"
-@@ -13220,20 +13186,6 @@
+@@ -2018,20 +1988,6 @@
        CONFIG_SND_VX222="m"
      fi
    fi
only in patch2:
unchanged:
--- alsa-driver-1.0.21+dfsg.orig/debian/patches/use_kbuild_not_ac_try_compile.patch
+++ alsa-driver-1.0.21+dfsg/debian/patches/use_kbuild_not_ac_try_compile.patch
@@ -0,0 +1,1396 @@
+From: Ben Hutchings <ben at decadent.org.uk>
+Subject: [PATCH] Change configure script to use Kbuild for compile tests
+
+Kbuild is the only proper way to build modules.  Calling the compiler
+directly will tend to result in false negatives.
+
+--- a/configure.in
++++ b/configure.in
+@@ -1559,11 +1559,6 @@
+ fi
+ AC_SUBST(msmp)
+ 
+-KERNEL_CHECK_CFLAGS="-Wall -fno-strict-aliasing $CFLAGS $KERNEL_INC $HACK_KERNEL_INC -Iinclude -nostdinc -iwithprefix include"
+-if test "$NEW_KBUILD" = "y"; then
+-  KERNEL_CHECK_CFLAGS="$KERNEL_CHECK_CFLAGS -DKBUILD_STR(s)=#s -DKBUILD_BASENAME=KBUILD_STR(dummy) -DKBUILD_MODNAME=KBUILD_BASENAME"
+-fi
+-
+ dnl Check for video device support... (2.2 kernels excluded due to API incompatibility)
+ if test $kpatchlevel -gt 2; then
+ CHECK_KERNEL_CONFIG(CONFIG_VIDEO_DEV, [Video device support in kernel])
+@@ -1640,20 +1635,32 @@
+ fi
+ AC_SUBST(CONFIG_PNP)
+ 
++dnl Replacement for AC_TRY_COMPILE using kbuild
++AC_DEFUN([KBUILD_TRY_COMPILE], [
++dir="$(mktemp -d)"
++if test -z "$dir"; then
++  echo >&2 "failed to create temporary directory"
++  exit 1
++fi
++echo >"$dir"/test.c '[$1]
++void not_main(void)
++{
++	[$2];
++}'
++echo >"$dir"/Makefile 'obj-y += test.o
++EXTRA_CFLAGS := [$5]'
++if make -C "$CONFIG_SND_KERNELDIR" SUBDIRS="$dir" >&5 2>&1; then
++  [$3]
++else
++  [$4]
++fi
++rm -rf "$dir"
++])
++
+ dnl Check for strlcpy...
+ AC_MSG_CHECKING(for strlcpy)
+ strlcpy="0"
+-ac_save_CFLAGS="$CFLAGS"
+-ac_save_CC="$CC"
+-CFLAGS="$KERNEL_CHECK_CFLAGS -Werror"
+-CC=$KCC
+-AC_TRY_COMPILE([
+-#define __KERNEL__
+-#ifdef CONFIG_HAVE_DEPRECATED_CONFIG_H
+-#include <linux/autoconf.h>
+-#else
+-#include <linux/config.h>
+-#endif
++KBUILD_TRY_COMPILE([
+ #include <linux/kernel.h>
+ #include <linux/string.h>
+ ],[
+@@ -1662,10 +1669,8 @@
+ ],
+     AC_MSG_RESULT(yes);strlcpy="1",
+     AC_MSG_RESULT(no);strlcpy="0",
+-    AC_MSG_RESULT(unknown);strlcpy="0"
++    -Werror
+ )
+-CFLAGS=$ac_save_CFLAGS
+-CC=$ac_save_CC
+ CONFIG_HAVE_STRLCPY=$strlcpy
+ dnl AC_SUBST(CONFIG_HAVE_STRLCPY)
+ if test "$CONFIG_HAVE_STRLCPY" = "1"; then
+@@ -1675,17 +1680,7 @@
+ dnl Check for snprintf...
+ AC_MSG_CHECKING(for snprintf)
+ snprintf="0"
+-ac_save_CFLAGS="$CFLAGS"
+-ac_save_CC="$CC"
+-CFLAGS="$KERNEL_CHECK_CFLAGS -Werror"
+-CC=$KCC
+-AC_TRY_COMPILE([
+-#define __KERNEL__
+-#ifdef CONFIG_HAVE_DEPRECATED_CONFIG_H
+-#include <linux/autoconf.h>
+-#else
+-#include <linux/config.h>
+-#endif
++KBUILD_TRY_COMPILE([
+ #include <linux/kernel.h>
+ ],[
+   char buf[128];
+@@ -1693,10 +1688,8 @@
+ ],
+     AC_MSG_RESULT(yes);snprintf="1",
+     AC_MSG_RESULT(no);snprintf="0",
+-    AC_MSG_RESULT(unknown);snprintf="0"
++    -Werror
+ )
+-CFLAGS=$ac_save_CFLAGS
+-CC=$ac_save_CC
+ CONFIG_HAVE_SNPRINTF=$snprintf
+ dnl AC_SUBST(CONFIG_HAVE_SNPRINTF)
+ if test "$CONFIG_HAVE_SNPRINTF" = "1"; then
+@@ -1706,17 +1699,7 @@
+ dnl Check for vsnprintf...
+ AC_MSG_CHECKING(for vsnprintf)
+ vsnprintf="0"
+-ac_save_CFLAGS="$CFLAGS"
+-ac_save_CC="$CC"
+-CFLAGS="$KERNEL_CHECK_CFLAGS -Werror"
+-CC=$KCC
+-AC_TRY_COMPILE([
+-#define __KERNEL__
+-#ifdef CONFIG_HAVE_DEPRECATED_CONFIG_H
+-#include <linux/autoconf.h>
+-#else
+-#include <linux/config.h>
+-#endif
++KBUILD_TRY_COMPILE([
+ #include <linux/kernel.h>
+ void f(const char *fmt, ...)
+ {
+@@ -1731,10 +1714,8 @@
+ ],
+     AC_MSG_RESULT(yes);vsnprintf="1",
+     AC_MSG_RESULT(no);vsnprintf="0",
+-    AC_MSG_RESULT(unknown);vsnprintf="0"
++    -Werror
+ )
+-CFLAGS=$ac_save_CFLAGS
+-CC=$ac_save_CC
+ CONFIG_HAVE_VSNPRINTF=$vsnprintf
+ dnl AC_SUBST(CONFIG_HAVE_VSNPRINTF)
+ if test "$CONFIG_HAVE_VSNPRINTF" = "1"; then
+@@ -1744,17 +1725,7 @@
+ dnl Check for scnprintf...
+ AC_MSG_CHECKING(for scnprintf)
+ scnprintf="0"
+-ac_save_CFLAGS="$CFLAGS"
+-ac_save_CC="$CC"
+-CFLAGS="$KERNEL_CHECK_CFLAGS -Werror"
+-CC=$KCC
+-AC_TRY_COMPILE([
+-#define __KERNEL__
+-#ifdef CONFIG_HAVE_DEPRECATED_CONFIG_H
+-#include <linux/autoconf.h>
+-#else
+-#include <linux/config.h>
+-#endif
++KBUILD_TRY_COMPILE([
+ #include <linux/kernel.h>
+ ],[
+   char buf[128];
+@@ -1762,10 +1733,8 @@
+ ],
+     AC_MSG_RESULT(yes);scnprintf="1",
+     AC_MSG_RESULT(no);scnprintf="0",
+-    AC_MSG_RESULT(unknown);scnprintf="0"
++    -Werror
+ )
+-CFLAGS=$ac_save_CFLAGS
+-CC=$ac_save_CC
+ CONFIG_HAVE_SCNPRINTF=$scnprintf
+ dnl AC_SUBST(CONFIG_HAVE_SCNPRINTF)
+ if test "$CONFIG_HAVE_SCNPRINTF" = "1"; then
+@@ -1775,17 +1744,7 @@
+ dnl Check for sscanf...
+ AC_MSG_CHECKING(for sscanf)
+ sscanf="0"
+-ac_save_CFLAGS="$CFLAGS"
+-ac_save_CC="$CC"
+-CFLAGS="$KERNEL_CHECK_CFLAGS -Werror"
+-CC=$KCC
+-AC_TRY_COMPILE([
+-#define __KERNEL__
+-#ifdef CONFIG_HAVE_DEPRECATED_CONFIG_H
+-#include <linux/autoconf.h>
+-#else
+-#include <linux/config.h>
+-#endif
++KBUILD_TRY_COMPILE([
+ #include <linux/kernel.h>
+ ],[
+   unsigned int i;
+@@ -1793,10 +1752,8 @@
+ ],
+     AC_MSG_RESULT(yes);sscanf="1",
+     AC_MSG_RESULT(no);sscanf="0",
+-    AC_MSG_RESULT(unknown);sscanf="0"
++    -Werror
+ )
+-CFLAGS=$ac_save_CFLAGS
+-CC=$ac_save_CC
+ CONFIG_HAVE_SSCANF=$sscanf
+ dnl AC_SUBST(CONFIG_HAVE_SSCANF)
+ if test "$CONFIG_HAVE_SSCANF" = "1"; then
+@@ -1806,17 +1763,7 @@
+ dnl Check for vmalloc_to_page...
+ AC_MSG_CHECKING(for vmalloc_to_page)
+ vmalloc_to_page="0"
+-ac_save_CFLAGS="$CFLAGS"
+-ac_save_CC="$CC"
+-CFLAGS="$KERNEL_CHECK_CFLAGS"
+-CC=$KCC
+-AC_TRY_COMPILE([
+-#define __KERNEL__
+-#ifdef CONFIG_HAVE_DEPRECATED_CONFIG_H
+-#include <linux/autoconf.h>
+-#else
+-#include <linux/config.h>
+-#endif
++KBUILD_TRY_COMPILE([
+ #include <linux/time.h>
+ #include <linux/sched.h>
+ #include <linux/interrupt.h>
+@@ -1827,10 +1774,7 @@
+ ],
+     AC_MSG_RESULT(yes);vmalloc_to_page="1",
+     AC_MSG_RESULT(no);vmalloc_to_page="0",
+-    AC_MSG_RESULT(unknown);vmalloc_to_page="0"
+ )
+-CFLAGS=$ac_save_CFLAGS
+-CC=$ac_save_CC
+ CONFIG_HAVE_VMALLOC_TO_PAGE=$vmalloc_to_page
+ dnl AC_SUBST(CONFIG_HAVE_VMALLOC_TO_PAGE)
+ if test "$CONFIG_HAVE_VMALLOC_TO_PAGE" = "1"; then
+@@ -1840,27 +1784,14 @@
+ dnl Check for old kmod...
+ AC_MSG_CHECKING(for old kmod)
+ old_kmod="0"
+-ac_save_CFLAGS="$CFLAGS"
+-ac_save_CC="$CC"
+-CFLAGS="$KERNEL_CHECK_CFLAGS"
+-CC=$KCC
+-AC_TRY_COMPILE([
+-#define __KERNEL__
+-#ifdef CONFIG_HAVE_DEPRECATED_CONFIG_H
+-#include <linux/autoconf.h>
+-#else
+-#include <linux/config.h>
+-#endif
++KBUILD_TRY_COMPILE([
+ #include <linux/kmod.h>
+ ],[
+ 	request_module("abcd", "def", "ixj");
+ ],
+     AC_MSG_RESULT(no);old_kmod="0",
+     AC_MSG_RESULT(yes);old_kmod="1",
+-    AC_MSG_RESULT(unknown);old_kmod="1"
+ )
+-CFLAGS=$ac_save_CFLAGS
+-CC=$ac_save_CC
+ CONFIG_HAVE_OLD_REQUEST_MODULE=$old_kmod
+ dnl AC_SUBST(CONFIG_HAVE_OLD_REQUEST_MODULE)
+ if test "$CONFIG_HAVE_OLD_REQUEST_MODULE" = "1"; then
+@@ -1870,17 +1801,7 @@
+ dnl Check for PDE...
+ AC_MSG_CHECKING(for PDE)
+ pde_defined="0"
+-ac_save_CFLAGS="$CFLAGS"
+-ac_save_CC="$CC"
+-CFLAGS="$KERNEL_CHECK_CFLAGS"
+-CC=$KCC
+-AC_TRY_COMPILE([
+-#define __KERNEL__
+-#ifdef CONFIG_HAVE_DEPRECATED_CONFIG_H
+-#include <linux/autoconf.h>
+-#else
+-#include <linux/config.h>
+-#endif
++KBUILD_TRY_COMPILE([
+ #include <linux/fs.h>
+ #include <linux/proc_fs.h>
+ ],[
+@@ -1889,10 +1810,7 @@
+ ],
+     AC_MSG_RESULT(yes);pde_defined="1",
+     AC_MSG_RESULT(no);pde_defined="0",
+-    AC_MSG_RESULT(unknown);pde_defined="0"
+ )
+-CFLAGS=$ac_save_CFLAGS
+-CC=$ac_save_CC
+ CONFIG_HAVE_PDE=$pde_defined
+ dnl AC_SUBST(CONFIG_HAVE_PDE)
+ if test "$CONFIG_HAVE_PDE" = "1"; then
+@@ -1902,17 +1820,7 @@
+ dnl Check for pci_consistent_set_dma_mask()
+ AC_MSG_CHECKING(for pci_set_consistent_dma_mask)
+ pci_consistent_defined="0"
+-ac_save_CFLAGS="$CFLAGS"
+-ac_save_CC="$CC"
+-CFLAGS="$KERNEL_CHECK_CFLAGS"
+-CC=$KCC
+-AC_TRY_COMPILE([
+-#define __KERNEL__
+-#ifdef CONFIG_HAVE_DEPRECATED_CONFIG_H
+-#include <linux/autoconf.h>
+-#else
+-#include <linux/config.h>
+-#endif
++KBUILD_TRY_COMPILE([
+ #include <linux/pci.h>
+ ],[
+ 	int (*func)();
+@@ -1920,10 +1828,7 @@
+ ],
+     AC_MSG_RESULT(yes);pci_consistent_defined="1",
+     AC_MSG_RESULT(no);pci_consistent_defined="0",
+-    AC_MSG_RESULT(unknown);pci_consistent_defined="0"
+ )
+-CFLAGS=$ac_save_CFLAGS
+-CC=$ac_save_CC
+ CONFIG_HAVE_PCI_CONSISTENT_DMA_MASK=$pci_consistent_defined
+ if test "$CONFIG_HAVE_PCI_CONSISTENT_DMA_MASK" = "1"; then
+   AC_DEFINE(CONFIG_HAVE_PCI_CONSISTENT_DMA_MASK)
+@@ -1932,17 +1837,7 @@
+ dnl Check for pci_set_dev_present()
+ AC_MSG_CHECKING(for pci_dev_present)
+ pci_consistent_defined="0"
+-ac_save_CFLAGS="$CFLAGS"
+-ac_save_CC="$CC"
+-CFLAGS="$KERNEL_CHECK_CFLAGS"
+-CC=$KCC
+-AC_TRY_COMPILE([
+-#define __KERNEL__
+-#ifdef CONFIG_HAVE_DEPRECATED_CONFIG_H
+-#include <linux/autoconf.h>
+-#else
+-#include <linux/config.h>
+-#endif
++KBUILD_TRY_COMPILE([
+ #include <linux/pci.h>
+ ],[
+ 	int (*func)();
+@@ -1950,10 +1845,7 @@
+ ],
+     AC_MSG_RESULT(yes);pci_dev_present_defined="1",
+     AC_MSG_RESULT(no);pci_dev_present_defined="0",
+-    AC_MSG_RESULT(unknown);pci_dev_present_defined="0"
+ )
+-CFLAGS=$ac_save_CFLAGS
+-CC=$ac_save_CC
+ CONFIG_HAVE_PCI_DEV_PRESENT=$pci_dev_present_defined
+ if test "$CONFIG_HAVE_PCI_DEV_PRESENT" = "1"; then
+   AC_DEFINE(CONFIG_HAVE_PCI_DEV_PRESENT)
+@@ -1962,17 +1854,7 @@
+ dnl Check for msleep
+ AC_MSG_CHECKING(for msleep)
+ msleep="0"
+-ac_save_CFLAGS="$CFLAGS"
+-ac_save_CC="$CC"
+-CFLAGS="$KERNEL_CHECK_CFLAGS"
+-CC=$KCC
+-AC_TRY_COMPILE([
+-#define __KERNEL__
+-#ifdef CONFIG_HAVE_DEPRECATED_CONFIG_H
+-#include <linux/autoconf.h>
+-#else
+-#include <linux/config.h>
+-#endif
++KBUILD_TRY_COMPILE([
+ #include <linux/delay.h>
+ ],[
+   void (*func)(unsigned int);
+@@ -1980,10 +1862,7 @@
+ ],
+     AC_MSG_RESULT(yes);msleep="1",
+     AC_MSG_RESULT(no);msleep="0",
+-    AC_MSG_RESULT(unknown);msleep="0"
+ )
+-CFLAGS=$ac_save_CFLAGS
+-CC=$ac_save_CC
+ CONFIG_HAVE_MSLEEP=$msleep
+ dnl AC_SUBST(CONFIG_HAVE_MSLEEP)
+ if test "$CONFIG_HAVE_MSLEEP" = "1"; then
+@@ -1994,17 +1873,7 @@
+ if test "$CONFIG_HAVE_MSLEEP" = "1"; then
+ AC_MSG_CHECKING(for msleep_interrupt)
+ msleep_interrupt="0"
+-ac_save_CFLAGS="$CFLAGS"
+-ac_save_CC="$CC"
+-CFLAGS="$KERNEL_CHECK_CFLAGS"
+-CC=$KCC
+-AC_TRY_COMPILE([
+-#define __KERNEL__
+-#ifdef CONFIG_HAVE_DEPRECATED_CONFIG_H
+-#include <linux/autoconf.h>
+-#else
+-#include <linux/config.h>
+-#endif
++KBUILD_TRY_COMPILE([
+ #include <linux/delay.h>
+ ],[
+   unsigned long (*func)(unsigned int);
+@@ -2012,10 +1881,7 @@
+ ],
+     AC_MSG_RESULT(yes);msleep_interruptible="1",
+     AC_MSG_RESULT(no);msleep_interruptible="0",
+-    AC_MSG_RESULT(unknown);msleep_interruptible="0"
+ )
+-CFLAGS=$ac_save_CFLAGS
+-CC=$ac_save_CC
+ CONFIG_HAVE_MSLEEP_INTERRUPTIBLE=$msleep_interruptible
+ dnl AC_SUBST(CONFIG_HAVE_MSLEEP_INTERRUPTIBLE)
+ if test "$CONFIG_HAVE_MSLEEP_INTERRUPTIBLE" = "1"; then
+@@ -2026,17 +1892,7 @@
+ dnl Check for msecs_to_jiffies
+ AC_MSG_CHECKING(for msecs_to_jiffies)
+ msecs_to_jiffies="0"
+-ac_save_CFLAGS="$CFLAGS"
+-ac_save_CC="$CC"
+-CFLAGS="$KERNEL_CHECK_CFLAGS -Iinclude"
+-CC=$KCC
+-AC_TRY_COMPILE([
+-#define __KERNEL__
+-#ifdef CONFIG_HAVE_DEPRECATED_CONFIG_H
+-#include <linux/autoconf.h>
+-#else
+-#include <linux/config.h>
+-#endif
++KBUILD_TRY_COMPILE([
+ #include <linux/jiffies.h>
+ #include <linux/time.h>
+ ],[
+@@ -2045,10 +1901,8 @@
+ ],
+     AC_MSG_RESULT(yes);msecs_to_jiffies="1",
+     AC_MSG_RESULT(no);msecs_to_jiffies="0",
+-    AC_MSG_RESULT(unknown);msecs_to_jiffies="0"
++    -Iinclude
+ )
+-CFLAGS=$ac_save_CFLAGS
+-CC=$ac_save_CC
+ CONFIG_HAVE_MSECS_TO_JIFFIES=$msecs_to_jiffies
+ dnl AC_SUBST(CONFIG_HAVE_MSECS_TO_JIFFIES)
+ if test "$CONFIG_HAVE_MSECS_TO_JIFFIES" = "1"; then
+@@ -2058,17 +1912,7 @@
+ dnl Check for tty->count is the atomic type
+ AC_MSG_CHECKING(for tty->count is the atomic type)
+ tty_count_atomic="0"
+-ac_save_CFLAGS="$CFLAGS"
+-ac_save_CC="$CC"
+-CFLAGS="$KERNEL_CHECK_CFLAGS"
+-CC=$KCC
+-AC_TRY_COMPILE([
+-#define __KERNEL__
+-#ifdef CONFIG_HAVE_DEPRECATED_CONFIG_H
+-#include <linux/autoconf.h>
+-#else
+-#include <linux/config.h>
+-#endif
++KBUILD_TRY_COMPILE([
+ #include <linux/tty.h>
+ ],[
+ 	struct tty_struct tty;
+@@ -2076,10 +1920,7 @@
+ ],
+     AC_MSG_RESULT(yes);tty_count_atomic="1",
+     AC_MSG_RESULT(no);tty_count_atomic="0",
+-    AC_MSG_RESULT(unknown);tty_count_atomic="0"
+ )
+-CFLAGS=$ac_save_CFLAGS
+-CC=$ac_save_CC
+ CONFIG_HAVE_TTY_COUNT_ATOMIC=$tty_count_atomic
+ if test "$CONFIG_HAVE_TTY_COUNT_ATOMIC" = "1"; then
+   AC_DEFINE(CONFIG_HAVE_TTY_COUNT_ATOMIC)
+@@ -2089,17 +1930,7 @@
+ if test "$CONFIG_VIDEO_DEV" = "y"; then
+ AC_MSG_CHECKING(for video_get_drvdata)
+ video_get_drvdata="0"
+-ac_save_CFLAGS="$CFLAGS"
+-ac_save_CC="$CC"
+-CFLAGS="$KERNEL_CHECK_CFLAGS -Iinclude"
+-CC=$KCC
+-AC_TRY_COMPILE([
+-#define __KERNEL__
+-#ifdef CONFIG_HAVE_DEPRECATED_CONFIG_H
+-#include <linux/autoconf.h>
+-#else
+-#include <linux/config.h>
+-#endif
++KBUILD_TRY_COMPILE([
+ #include <linux/videodev.h>
+ #include "media/v4l2-dev.h"
+ ],[
+@@ -2108,10 +1939,8 @@
+ ],
+     AC_MSG_RESULT(yes);video_get_drvdata="1",
+     AC_MSG_RESULT(no);video_get_drvdata="0",
+-    AC_MSG_RESULT(unknown);video_get_drvdata="0"
++    -Iinclude
+ )
+-CFLAGS=$ac_save_CFLAGS
+-CC=$ac_save_CC
+ CONFIG_HAVE_VIDEO_GET_DRVDATA=$video_get_drvdata
+ dnl AC_SUBST(CONFIG_HAVE_VIDEO_GET_DRVDATA)
+ if test "$CONFIG_HAVE_VIDEO_GET_DRVDATA" = "1"; then
+@@ -2123,17 +1952,7 @@
+ if test "$CONFIG_HAVE_VIDEO_GET_DRVDATA" = "1"; then
+ AC_MSG_CHECKING(for video_drvdata)
+ video_drvdata="0"
+-ac_save_CFLAGS="$CFLAGS"
+-ac_save_CC="$CC"
+-CFLAGS="$KERNEL_CHECK_CFLAGS -Iinclude"
+-CC=$KCC
+-AC_TRY_COMPILE([
+-#define __KERNEL__
+-#ifdef CONFIG_HAVE_DEPRECATED_CONFIG_H
+-#include <linux/autoconf.h>
+-#else
+-#include <linux/config.h>
+-#endif
++KBUILD_TRY_COMPILE([
+ #include <linux/videodev.h>
+ #include "media/v4l2-dev.h"
+ ],[
+@@ -2142,10 +1961,8 @@
+ ],
+     AC_MSG_RESULT(yes);video_drvdata="1",
+     AC_MSG_RESULT(no);video_drvdata="0",
+-    AC_MSG_RESULT(unknown);video_drvdata="0"
++    -Iinclude
+ )
+-CFLAGS=$ac_save_CFLAGS
+-CC=$ac_save_CC
+ CONFIG_HAVE_VIDEO_DRVDATA=$video_drvdata
+ dnl AC_SUBST(CONFIG_HAVE_VIDEO_DRVDATA)
+ if test "$CONFIG_HAVE_VIDEO_DRVDATA" = "1"; then
+@@ -2174,17 +1991,7 @@
+ dnl Check for old io_remap_page_range()
+ AC_MSG_CHECKING(for io_remap_pfn_range)
+ io_remap_pfn_range="0"
+-ac_save_CFLAGS="$CFLAGS"
+-ac_save_CC="$CC"
+-CFLAGS="$KERNEL_CHECK_CFLAGS -Werror-implicit-function-declaration"
+-CC=$KCC
+-AC_TRY_COMPILE([
+-#define __KERNEL__
+-#ifdef CONFIG_HAVE_DEPRECATED_CONFIG_H
+-#include <linux/autoconf.h>
+-#else
+-#include <linux/config.h>
+-#endif
++KBUILD_TRY_COMPILE([
+ #include <linux/mm.h>
+ ],[
+   static pgprot_t p;
+@@ -2192,10 +1999,8 @@
+ ],
+     AC_MSG_RESULT(yes);io_remap_pfn_range="1",
+     AC_MSG_RESULT(no);io_remap_pfn_range="0",
+-    AC_MSG_RESULT(unknown);io_remap_pfn_range="0"
++    -Werror-implicit-function-declaration
+ )
+-CFLAGS=$ac_save_CFLAGS
+-CC=$ac_save_CC
+ if test "$io_remap_pfn_range" = "1"; then
+   AC_DEFINE(CONFIG_HAVE_IO_REMAP_PFN_RANGE)
+ fi
+@@ -2203,17 +2008,7 @@
+ if test "$io_remap_pfn_range" != "1"; then
+ AC_MSG_CHECKING(for new io_remap_page_range)
+ new_io_remap="0"
+-ac_save_CFLAGS="$CFLAGS"
+-ac_save_CC="$CC"
+-CFLAGS="$KERNEL_CHECK_CFLAGS -Werror-implicit-function-declaration"
+-CC=$KCC
+-AC_TRY_COMPILE([
+-#define __KERNEL__
+-#ifdef CONFIG_HAVE_DEPRECATED_CONFIG_H
+-#include <linux/autoconf.h>
+-#else
+-#include <linux/config.h>
+-#endif
++KBUILD_TRY_COMPILE([
+ #include <linux/mm.h>
+ ],[
+   static pgprot_t p;
+@@ -2221,10 +2016,8 @@
+ ],
+     AC_MSG_RESULT(yes);new_io_remap="1",
+     AC_MSG_RESULT(no);new_io_remap="0",
+-    AC_MSG_RESULT(unknown);new_io_remap="0"
++    -Werror-implicit-function-declaration
+ )
+-CFLAGS=$ac_save_CFLAGS
+-CC=$ac_save_CC
+ if test "$new_io_remap" != "1"; then
+   AC_DEFINE(CONFIG_OLD_IO_REMAP_PAGE_RANGE)
+ fi
+@@ -2233,17 +2026,7 @@
+ dnl Check for kcalloc()
+ AC_MSG_CHECKING(for kcalloc)
+ kcalloc="0"
+-ac_save_CFLAGS="$CFLAGS"
+-ac_save_CC="$CC"
+-CFLAGS="$KERNEL_CHECK_CFLAGS"
+-CC=$KCC
+-AC_TRY_COMPILE([
+-#define __KERNEL__
+-#ifdef CONFIG_HAVE_DEPRECATED_CONFIG_H
+-#include <linux/autoconf.h>
+-#else
+-#include <linux/config.h>
+-#endif
++KBUILD_TRY_COMPILE([
+ #include <linux/slab.h>
+ ],[
+   void * (*func)(size_t, size_t, int);
+@@ -2251,10 +2034,7 @@
+ ],
+     AC_MSG_RESULT(yes);kcalloc="1",
+     AC_MSG_RESULT(no);kcalloc="0",
+-    AC_MSG_RESULT(unknown);kcalloc="0"
+ )
+-CFLAGS=$ac_save_CFLAGS
+-CC=$ac_save_CC
+ CONFIG_HAVE_KCALLOC=$kcalloc
+ dnl AC_SUBST(CONFIG_HAVE_KCALLOC)
+ if test "$CONFIG_HAVE_KCALLOC" = "1"; then
+@@ -2264,17 +2044,7 @@
+ dnl Check for kstrdup()
+ AC_MSG_CHECKING(for kstrdup)
+ kstrdup="0"
+-ac_save_CFLAGS="$CFLAGS"
+-ac_save_CC="$CC"
+-CFLAGS="$KERNEL_CHECK_CFLAGS"
+-CC=$KCC
+-AC_TRY_COMPILE([
+-#define __KERNEL__
+-#ifdef CONFIG_HAVE_DEPRECATED_CONFIG_H
+-#include <linux/autoconf.h>
+-#else
+-#include <linux/config.h>
+-#endif
++KBUILD_TRY_COMPILE([
+ #include <linux/string.h>
+ ],[
+   char * (*func)(const char *, int);
+@@ -2282,10 +2052,7 @@
+ ],
+     AC_MSG_RESULT(yes);kstrdup="1",
+     AC_MSG_RESULT(no);kstrdup="0",
+-    AC_MSG_RESULT(unknown);kstrdup="0"
+ )
+-CFLAGS=$ac_save_CFLAGS
+-CC=$ac_save_CC
+ CONFIG_HAVE_KSTRDUP=$kstrdup
+ dnl AC_SUBST(CONFIG_HAVE_KSTRDUP)
+ if test "$CONFIG_HAVE_KSTRDUP" = "1"; then
+@@ -2295,13 +2062,7 @@
+ dnl Check for kstrdup()
+ AC_MSG_CHECKING(for kstrndup)
+ kstrdup="0"
+-ac_save_CFLAGS="$CFLAGS"
+-ac_save_CC="$CC"
+-CFLAGS="$KERNEL_CHECK_CFLAGS"
+-CC=$KCC
+-AC_TRY_COMPILE([
+-#define __KERNEL__
+-#include <linux/config.h>
++KBUILD_TRY_COMPILE([
+ #include <linux/string.h>
+ ],[
+   char * (*func)(const char *, int);
+@@ -2309,10 +2070,7 @@
+ ],
+     AC_MSG_RESULT(yes);kstrndup="1",
+     AC_MSG_RESULT(no);kstrndup="0",
+-    AC_MSG_RESULT(unknown);kstrndup="0"
+ )
+-CFLAGS=$ac_save_CFLAGS
+-CC=$ac_save_CC
+ CONFIG_HAVE_KSTRNDUP=$kstrndup
+ dnl AC_SUBST(CONFIG_HAVE_KSTNRDUP)
+ if test "$CONFIG_HAVE_KSTRNDUP" = "1"; then
+@@ -2322,17 +2080,7 @@
+ dnl Check for kzalloc()
+ AC_MSG_CHECKING(for kzalloc)
+ kzalloc="0"
+-ac_save_CFLAGS="$CFLAGS"
+-ac_save_CC="$CC"
+-CFLAGS="$KERNEL_CHECK_CFLAGS"
+-CC=$KCC
+-AC_TRY_COMPILE([
+-#define __KERNEL__
+-#ifdef CONFIG_HAVE_DEPRECATED_CONFIG_H
+-#include <linux/autoconf.h>
+-#else
+-#include <linux/config.h>
+-#endif
++KBUILD_TRY_COMPILE([
+ #include <linux/slab.h>
+ ],[
+   void * (*func)(size_t, int);
+@@ -2340,10 +2088,7 @@
+ ],
+     AC_MSG_RESULT(yes);kzalloc="1",
+     AC_MSG_RESULT(no);kzalloc="0",
+-    AC_MSG_RESULT(unknown);kzalloc="0"
+ )
+-CFLAGS=$ac_save_CFLAGS
+-CC=$ac_save_CC
+ CONFIG_HAVE_KZALLOC=$kzalloc
+ dnl AC_SUBST(CONFIG_HAVE_KZALLOC)
+ if test "$CONFIG_HAVE_KZALLOC" = "1"; then
+@@ -2354,27 +2099,14 @@
+ if test "$kversion.$kpatchlevel" = "2.6"; then
+ AC_MSG_CHECKING(for create_workqueue with flags)
+ workqueue2="0"
+-ac_save_CFLAGS="$CFLAGS"
+-ac_save_CC="$CC"
+-CFLAGS="$KERNEL_CHECK_CFLAGS"
+-CC=$KCC
+-AC_TRY_COMPILE([
+-#define __KERNEL__
+-#ifdef CONFIG_HAVE_DEPRECATED_CONFIG_H
+-#include <linux/autoconf.h>
+-#else
+-#include <linux/config.h>
+-#endif
++KBUILD_TRY_COMPILE([
+ #include <linux/workqueue.h>
+ ],[
+     create_workqueue("abcd", 0);
+ ],
+     AC_MSG_RESULT(yes);workqueue2="1",
+     AC_MSG_RESULT(no);workqueue2="0",
+-    AC_MSG_RESULT(unknown);workqueue2="0"
+ )
+-CFLAGS=$ac_save_CFLAGS
+-CC=$ac_save_CC
+ CONFIG_CREATE_WORKQUEUE_FLAGS=$workqueue2
+ dnl AC_SUBST(CONFIG_CREATE_WORKQUEUE_FLAGS)
+ if test "$CONFIG_CREATE_WORKQUEUE_FLAGS" = "1"; then
+@@ -2385,17 +2117,7 @@
+ dnl Check for pci_ioremap_bar
+ AC_MSG_CHECKING(for pci_ioremap_bar)
+ pci_ioremap_bar="0"
+-ac_save_CFLAGS="$CFLAGS"
+-ac_save_CC="$CC"
+-CFLAGS="$KERNEL_CHECK_CFLAGS"
+-CC=$KCC
+-AC_TRY_COMPILE([
+-#define __KERNEL__
+-#ifdef CONFIG_HAVE_DEPRECATED_CONFIG_H
+-#include <linux/autoconf.h>
+-#else
+-#include <linux/config.h>
+-#endif
++KBUILD_TRY_COMPILE([
+ #include <linux/pci.h>
+ ],[
+   void (*func)(struct pci_dev *, int);
+@@ -2403,10 +2125,7 @@
+ ],
+     AC_MSG_RESULT(yes);pci_ioremap_bar="1",
+     AC_MSG_RESULT(no);pci_ioremap_bar="0",
+-    AC_MSG_RESULT(unknown);pci_ioremap_bar="0"
+ )
+-CFLAGS=$ac_save_CFLAGS
+-CC=$ac_save_CC
+ CONFIG_HAVE_PCI_IOREMAP_BAR=$pci_ioremap_bar
+ dnl AC_SUBST(CONFIG_HAVE_PCI_IOREMAP_BAR)
+ if test "$CONFIG_HAVE_PCI_IOREMAP_BAR" = "1"; then
+@@ -2416,17 +2135,7 @@
+ dnl Check for saved_config_space in pci_dev
+ AC_MSG_CHECKING(for saved_config_space in pci_dev)
+ pci_saved_config="0"
+-ac_save_CFLAGS="$CFLAGS"
+-ac_save_CC="$CC"
+-CFLAGS="$KERNEL_CHECK_CFLAGS"
+-CC=$KCC
+-AC_TRY_COMPILE([
+-#define __KERNEL__
+-#ifdef CONFIG_HAVE_DEPRECATED_CONFIG_H
+-#include <linux/autoconf.h>
+-#else
+-#include <linux/config.h>
+-#endif
++KBUILD_TRY_COMPILE([
+ #include <linux/pci.h>
+ ],[
+   struct pci_dev dev;
+@@ -2434,10 +2143,7 @@
+ ],
+     AC_MSG_RESULT(yes);pci_saved_config="1",
+     AC_MSG_RESULT(no);pci_saved_config="0",
+-    AC_MSG_RESULT(unknown);pci_saved_config="0"
+ )
+-CFLAGS=$ac_save_CFLAGS
+-CC=$ac_save_CC
+ CONFIG_HAVE_PCI_SAVED_CONFIG=$pci_saved_config
+ dnl AC_SUBST(CONFIG_HAVE_PCI_SAVED_CONFIG)
+ if test "$CONFIG_HAVE_PCI_SAVED_CONFIG" = "1"; then
+@@ -2448,17 +2154,7 @@
+ dnl Check for new pci_save_state()
+ AC_MSG_CHECKING(for new pci_save_state)
+ new_pci_save_state="0"
+-ac_save_CFLAGS="$CFLAGS"
+-ac_save_CC="$CC"
+-CFLAGS="$KERNEL_CHECK_CFLAGS"
+-CC=$KCC
+-AC_TRY_COMPILE([
+-#define __KERNEL__
+-#ifdef CONFIG_HAVE_DEPRECATED_CONFIG_H
+-#include <linux/autoconf.h>
+-#else
+-#include <linux/config.h>
+-#endif
++KBUILD_TRY_COMPILE([
+ #include <linux/pci.h>
+ ],[
+   struct pci_dev *pci;
+@@ -2466,10 +2162,7 @@
+ ],
+     AC_MSG_RESULT(yes);new_pci_save_state="1",
+     AC_MSG_RESULT(no);new_pci_save_state="0",
+-    AC_MSG_RESULT(unknown);new_pci_save_state="0"
+ )
+-CFLAGS=$ac_save_CFLAGS
+-CC=$ac_save_CC
+ if test "$new_pci_save_state" = "1"; then
+   AC_DEFINE(CONFIG_HAVE_NEW_PCI_SAVE_STATE)
+ fi
+@@ -2478,17 +2171,7 @@
+ dnl Check for register_sound_special_device
+ AC_MSG_CHECKING(for register_sound_special_device)
+ msleep="0"
+-ac_save_CFLAGS="$CFLAGS"
+-ac_save_CC="$CC"
+-CFLAGS="$KERNEL_CHECK_CFLAGS"
+-CC=$KCC
+-AC_TRY_COMPILE([
+-#define __KERNEL__
+-#ifdef CONFIG_HAVE_DEPRECATED_CONFIG_H
+-#include <linux/autoconf.h>
+-#else
+-#include <linux/config.h>
+-#endif
++KBUILD_TRY_COMPILE([
+ #include <linux/sound.h>
+ ],[
+   void (*func)(struct file_operations *, int, struct device *);
+@@ -2496,10 +2179,7 @@
+ ],
+     AC_MSG_RESULT(yes);reg_sp="1",
+     AC_MSG_RESULT(no);reg_sp="0",
+-    AC_MSG_RESULT(unknown);reg_sp="0"
+ )
+-CFLAGS=$ac_save_CFLAGS
+-CC=$ac_save_CC
+ CONFIG_HAVE_REGISTER_SOUND_SPECIAL_DEVICE=$reg_sp
+ dnl AC_SUBST(CONFIG_HAVE_REGISTER_SOUND_SPECIAL_DEVICE)
+ if test "$CONFIG_HAVE_REGISTER_SOUND_SPECIAL_DEVICE" = "1"; then
+@@ -2512,20 +2192,7 @@
+ dnl Check for old kill_fasync...
+ AC_MSG_CHECKING(for old kill_fasync)
+ oldkfasync="0"
+-ac_save_CFLAGS="$CFLAGS"
+-ac_save_CC="$CC"
+-CFLAGS="$CFLAGS $KERNEL_INC $HACK_KERNEL_INC"
+-CC=$KCC
+-AC_TRY_COMPILE([
+-#define __KERNEL__
+-#ifdef CONFIG_HAVE_DEPRECATED_CONFIG_H
+-#include <linux/autoconf.h>
+-#else
+-#include <linux/config.h>
+-#endif
+-#ifdef __alpha__ /* it's required (at least for 2.2.18) */
+-#include <asm/current.h>
+-#endif
++KBUILD_TRY_COMPILE([
+ #include <linux/fs.h>
+ ],[
+  struct fasync_struct *fa;
+@@ -2534,10 +2201,7 @@
+ ],
+     AC_MSG_RESULT(yes);oldkfasync="1",
+     AC_MSG_RESULT(no);oldkfasync="0",
+-    AC_MSG_RESULT(unknown);oldkfasync="0"
+ )
+-CFLAGS=$ac_save_CFLAGS
+-CC=$ac_save_CC
+ CONFIG_OLD_KILL_FASYNC=$oldkfasync
+ dnl AC_SUBST(CONFIG_OLD_KILL_FASYNC)
+ if test "$CONFIG_OLD_KILL_FASYNC" = "1"; then
+@@ -2547,27 +2211,14 @@
+ dnl Check for dma_addr_t
+ AC_MSG_CHECKING(for dma_addr_t)
+ dma_addr_t="0"
+-ac_save_CFLAGS="$CFLAGS"
+-ac_save_CC="$CC"
+-CFLAGS="$CFLAGS $KERNEL_INC $HACK_KERNEL_INC"
+-CC=$KCC
+-AC_TRY_COMPILE([
+-#define __KERNEL__
+-#ifdef CONFIG_HAVE_DEPRECATED_CONFIG_H
+-#include <linux/autoconf.h>
+-#else
+-#include <linux/config.h>
+-#endif
++KBUILD_TRY_COMPILE([
+ #include <asm/types.h>
+ ],[
+  dma_addr_t addr;
+ ],
+     AC_MSG_RESULT(yes);dma_addr_t="1",
+     AC_MSG_RESULT(no);dma_addr_t="0",
+-    AC_MSG_RESULT(unknown);dma_addr_t="0"
+ )
+-CFLAGS=$ac_save_CFLAGS
+-CC=$ac_save_CC
+ CONFIG_HAVE_DMA_ADDR_T=$dma_addr_t
+ dnl AC_SUBST(CONFIG_HAVE_DMA_ADDR_T)
+ if test "$CONFIG_HAVE_DMA_ADDR_T" = "1"; then
+@@ -2577,17 +2228,7 @@
+ dnl Check for MUTEX macros
+ AC_MSG_CHECKING(for MUTEX macros)
+ have_mutex_macros="0"
+-ac_save_CFLAGS="$CFLAGS"
+-ac_save_CC="$CC"
+-CFLAGS="$CFLAGS $KERNEL_INC $HACK_KERNEL_INC"
+-CC=$KCC
+-AC_TRY_COMPILE([
+-#define __KERNEL__
+-#ifdef CONFIG_HAVE_DEPRECATED_CONFIG_H
+-#include <linux/autoconf.h>
+-#else
+-#include <linux/config.h>
+-#endif
++KBUILD_TRY_COMPILE([
+ #include <asm/semaphore.h>
+ ],[
+ #ifndef init_MUTEX
+@@ -2597,10 +2238,7 @@
+ ],
+     AC_MSG_RESULT(yes);have_mutex_macros="1",
+     AC_MSG_RESULT(no);have_mutex_macros="0",
+-    AC_MSG_RESULT(unknown);have_mutex_macros="0"
+ )
+-CFLAGS=$ac_save_CFLAGS
+-CC=$ac_save_CC
+ CONFIG_HAVE_MUTEX_MACROS=$have_mutex_macros
+ dnl AC_SUBST(CONFIG_HAVE_MUTEX_MACROS)
+ if test "$CONFIG_HAVE_MUTEX_MACROS" = "1"; then
+@@ -2738,17 +2376,7 @@
+ if test "$kversion.$kpatchlevel" = "2.6"; then
+   AC_MSG_CHECKING(for class_simple)
+   class_simple="0"
+-  ac_save_CFLAGS="$CFLAGS"
+-  ac_save_CC="$CC"
+-  CFLAGS="$KERNEL_CHECK_CFLAGS"
+-  CC=$KCC
+-  AC_TRY_COMPILE([
+-#define __KERNEL__
+-#ifdef CONFIG_HAVE_DEPRECATED_CONFIG_H
+-#include <linux/autoconf.h>
+-#else
+-#include <linux/config.h>
+-#endif
++  KBUILD_TRY_COMPILE([
+ #include <linux/device.h>
+ ],[
+   struct class_simple *(*foo)(struct module *, char *) = class_simple_create;
+@@ -2756,10 +2384,7 @@
+ ],
+     AC_MSG_RESULT(yes);class_simple="1",
+     AC_MSG_RESULT(no);class_simple="0",
+-    AC_MSG_RESULT(unknown);class_simple="0"
+ )
+-  CFLAGS=$ac_save_CFLAGS
+-  CC=$ac_save_CC
+   CONFIG_SND_HAVE_CLASS_SIMPLE=$class_simple
+   dnl AC_SUBST(CONFIG_SND_HAVE_CLASS_SIMPLE)
+   if test "$CONFIG_SND_HAVE_CLASS_SIMPLE" = "1"; then
+@@ -2771,17 +2396,7 @@
+ if test "$kversion.$kpatchlevel" = "2.6"; then
+   AC_MSG_CHECKING(for old driver suspend/resume callbacks)
+   old_driver_suspend="0"
+-  ac_save_CFLAGS="$CFLAGS"
+-  ac_save_CC="$CC"
+-  CFLAGS="$KERNEL_CHECK_CFLAGS"
+-  CC=$KCC
+-  AC_TRY_COMPILE([
+-#define __KERNEL__
+-#ifdef CONFIG_HAVE_DEPRECATED_CONFIG_H
+-#include <linux/autoconf.h>
+-#else
+-#include <linux/config.h>
+-#endif
++  KBUILD_TRY_COMPILE([
+ #include <linux/device.h>
+ ],[
+   static struct device_driver driver;
+@@ -2789,10 +2404,7 @@
+ ],
+     AC_MSG_RESULT(yes);old_driver_suspend="1",
+     AC_MSG_RESULT(no);old_driver_suspend="0",
+-    AC_MSG_RESULT(unknown);old_driver_suspend="0"
+ )
+-  CFLAGS=$ac_save_CFLAGS
+-  CC=$ac_save_CC
+   CONFIG_SND_OLD_DRIVER_SUSPEND=$old_driver_suspend
+   dnl AC_SUBST(CONFIG_SND_OLD_DRIVER_SUSPEND)
+   if test "$CONFIG_SND_OLD_DRIVER_SUSPEND" = "1"; then
+@@ -2804,27 +2416,14 @@
+ if test "$kversion.$kpatchlevel" = "2.6"; then
+   AC_MSG_CHECKING(for removal of page-reservation for nopage/mmap)
+   remove_page_reserve="0"
+-  ac_save_CFLAGS="$CFLAGS"
+-  ac_save_CC="$CC"
+-  CFLAGS="$KERNEL_CHECK_CFLAGS"
+-  CC=$KCC
+-  AC_TRY_COMPILE([
+-#define __KERNEL__
+-#ifdef CONFIG_HAVE_DEPRECATED_CONFIG_H
+-#include <linux/autoconf.h>
+-#else
+-#include <linux/config.h>
+-#endif
++  KBUILD_TRY_COMPILE([
+ #include <linux/mm.h>
+ ],[
+   void (*func)(struct vm_area_struct *, pte_t, unsigned long) = print_bad_pte;
+ ],
+     AC_MSG_RESULT(yes);remove_page_reserve="1",
+     AC_MSG_RESULT(no);remove_page_reserve="0",
+-    AC_MSG_RESULT(unknown);remove_page_reserve="0"
+ )
+-  CFLAGS=$ac_save_CFLAGS
+-  CC=$ac_save_CC
+   CONFIG_SND_REMOVE_PAGE_RESERVE=$remove_page_reserve
+   dnl AC_SUBST(CONFIG_SND_REMOVE_PAGE_RESERVE)
+   if test "$CONFIG_SND_REMOVE_PAGE_RESERVE" = "1"; then
+@@ -2836,17 +2435,7 @@
+ if test "$kversion.$kpatchlevel" = "2.6"; then
+   AC_MSG_CHECKING(for nested class_device)
+   nested_class_device="0"
+-  ac_save_CFLAGS="$CFLAGS"
+-  ac_save_CC="$CC"
+-  CFLAGS="$KERNEL_CHECK_CFLAGS"
+-  CC=$KCC
+-  AC_TRY_COMPILE([
+-#define __KERNEL__
+-#ifdef CONFIG_HAVE_DEPRECATED_CONFIG_H
+-#include <linux/autoconf.h>
+-#else
+-#include <linux/config.h>
+-#endif
++  KBUILD_TRY_COMPILE([
+ #include <linux/device.h>
+ ],[
+   struct class_device dev;
+@@ -2854,10 +2443,7 @@
+ ],
+     AC_MSG_RESULT(yes);nested_class_device="1",
+     AC_MSG_RESULT(no);nested_class_device="0",
+-    AC_MSG_RESULT(unknown);nested_class_device="0"
+ )
+-  CFLAGS=$ac_save_CFLAGS
+-  CC=$ac_save_CC
+   CONFIG_SND_NESTED_CLASS_DEVICE=$nested_class_device
+   dnl AC_SUBST(CONFIG_SND_NESTED_CLASS_DEVICE)
+   if test "$CONFIG_SND_NESTED_CLASS_DEVICE" = "1"; then
+@@ -2869,17 +2455,7 @@
+ if test "$kversion.$kpatchlevel" = "2.6"; then
+   AC_MSG_CHECKING(for new IRQ handler)
+   new_irq_handler="0"
+-  ac_save_CFLAGS="$CFLAGS"
+-  ac_save_CC="$CC"
+-  CFLAGS="$KERNEL_CHECK_CFLAGS"
+-  CC=$KCC
+-  AC_TRY_COMPILE([
+-#define __KERNEL__
+-#ifdef CONFIG_HAVE_DEPRECATED_CONFIG_H
+-#include <linux/autoconf.h>
+-#else
+-#include <linux/config.h>
+-#endif
++  KBUILD_TRY_COMPILE([
+ #include <linux/interrupt.h>
+ ],[
+   irq_handler_t handle = 0;
+@@ -2887,10 +2463,7 @@
+ ],
+     AC_MSG_RESULT(yes);new_irq_handler="1",
+     AC_MSG_RESULT(no);new_irq_handler="0",
+-    AC_MSG_RESULT(unknown);new_irq_handler="0"
+ )
+-  CFLAGS=$ac_save_CFLAGS
+-  CC=$ac_save_CC
+   CONFIG_SND_NEW_IRQ_HANDLER=$new_irq_handler
+   dnl AC_SUBST(CONFIG_SND_NEW_IRQ_HANDLER)
+   if test "$CONFIG_SND_NEW_IRQ_HANDLER" = "1"; then
+@@ -2901,17 +2474,7 @@
+ dnl Check for gfp_t...
+ AC_MSG_CHECKING(for gfp_t)
+ gfp_t="0"
+-ac_save_CFLAGS="$CFLAGS"
+-ac_save_CC="$CC"
+-CFLAGS="$KERNEL_CHECK_CFLAGS"
+-CC=$KCC
+-AC_TRY_COMPILE([
+-#define __KERNEL__
+-#ifdef CONFIG_HAVE_DEPRECATED_CONFIG_H
+-#include <linux/autoconf.h>
+-#else
+-#include <linux/config.h>
+-#endif
++KBUILD_TRY_COMPILE([
+ #include <linux/types.h>
+ #include <linux/gfp.h>
+ ],[
+@@ -2919,10 +2482,7 @@
+ ],
+     AC_MSG_RESULT(yes);gfp_t="1",
+     AC_MSG_RESULT(no);gfp_t="0",
+-    AC_MSG_RESULT(unknown);gfp_t="0"
+ )
+-CFLAGS=$ac_save_CFLAGS
+-CC=$ac_save_CC
+ CONFIG_HAVE_GFP_T=$gfp_t
+ dnl AC_SUBST(CONFIG_HAVE_GFP_T)
+ if test "$CONFIG_HAVE_GFP_T" = "1"; then
+@@ -2932,17 +2492,7 @@
+ dnl Check for GFP_DMA32...
+ AC_MSG_CHECKING(for GFP_DMA32)
+ gfp_dma32="0"
+-ac_save_CFLAGS="$CFLAGS"
+-ac_save_CC="$CC"
+-CFLAGS="$KERNEL_CHECK_CFLAGS"
+-CC=$KCC
+-AC_TRY_COMPILE([
+-#define __KERNEL__
+-#ifdef CONFIG_HAVE_DEPRECATED_CONFIG_H
+-#include <linux/autoconf.h>
+-#else
+-#include <linux/config.h>
+-#endif
++KBUILD_TRY_COMPILE([
+ #include <linux/types.h>
+ #include <linux/gfp.h>
+ ],[
+@@ -2950,10 +2500,7 @@
+ ],
+     AC_MSG_RESULT(yes);gfp_dma32="1",
+     AC_MSG_RESULT(no);gfp_dma32="0",
+-    AC_MSG_RESULT(unknown);gfp_dma32="0"
+ )
+-CFLAGS=$ac_save_CFLAGS
+-CC=$ac_save_CC
+ CONFIG_HAVE_GFP_DMA32=$gfp_dma32
+ dnl AC_SUBST(CONFIG_HAVE_GFP_DMA32)
+ if test "$CONFIG_HAVE_GFP_DMA32" = "1"; then
+@@ -2963,17 +2510,7 @@
+ dnl Check for page_to_pfn...
+ AC_MSG_CHECKING(for page_to_pfn)
+ page_to_pfn="0"
+-ac_save_CFLAGS="$CFLAGS"
+-ac_save_CC="$CC"
+-CFLAGS="$KERNEL_CHECK_CFLAGS"
+-CC=$KCC
+-AC_TRY_COMPILE([
+-#define __KERNEL__
+-#ifdef CONFIG_HAVE_DEPRECATED_CONFIG_H
+-#include <linux/autoconf.h>
+-#else
+-#include <linux/config.h>
+-#endif
++KBUILD_TRY_COMPILE([
+ #include <linux/types.h>
+ #include <linux/mm.h>
+ ],[
+@@ -2983,10 +2520,7 @@
+ ],
+     AC_MSG_RESULT(yes);page_to_pfn="1",
+     AC_MSG_RESULT(no);page_to_pfn="0",
+-    AC_MSG_RESULT(unknown);page_to_pfn="0"
+ )
+-CFLAGS=$ac_save_CFLAGS
+-CC=$ac_save_CC
+ CONFIG_HAVE_PAGE_TO_PFN=$page_to_pfn
+ dnl AC_SUBST(CONFIG_HAVE_PAGE_TO_PFN)
+ if test "$CONFIG_HAVE_PAGE_TO_PFN" = "1"; then
+@@ -2999,20 +2533,7 @@
+ else
+ AC_MSG_CHECKING(for init_utsname)
+   init_utsname="0"
+-  ac_save_CFLAGS="$CFLAGS"
+-  ac_save_CC="$CC"
+-  CFLAGS="$KERNEL_CHECK_CFLAGS -Werror"
+-  if test "$CONFIG_HAVE_DEPRECATED_CONFIG_H" = "1"; then
+-    CFLAGS="$CFLAGS -DCONFIG_HAVE_DEPRECATED_CONFIG_H=1"
+-  fi
+-  CC=$KCC
+-  AC_TRY_COMPILE([
+-#define __KERNEL__
+-#ifdef CONFIG_HAVE_DEPRECATED_CONFIG_H
+-#include <linux/autoconf.h>
+-#else
+-#include <linux/config.h>
+-#endif
++  KBUILD_TRY_COMPILE([
+ #include <linux/utsname.h>
+ ],[
+   int *x = (int *)init_utsname();
+@@ -3020,10 +2541,8 @@
+ ],
+     AC_MSG_RESULT(yes);init_utsname="1",
+     AC_MSG_RESULT(no);init_utsname="0",
+-    AC_MSG_RESULT(unknown);init_utsname="0"
++    -Werror
+ )
+-  CFLAGS=$ac_save_CFLAGS
+-  CC=$ac_save_CC
+   CONFIG_HAVE_INIT_UTSNAME=$init_utsname
+ fi
+ dnl AC_SUBST(CONFIG_HAVE_INIT_UTSNAME)
+@@ -3037,17 +2556,7 @@
+ else
+ AC_MSG_CHECKING(for is_power_of_2)
+   is_power_of_2="0"
+-  ac_save_CFLAGS="$CFLAGS"
+-  ac_save_CC="$CC"
+-  CFLAGS="$KERNEL_CHECK_CFLAGS -Werror"
+-  CC=$KCC
+-  AC_TRY_COMPILE([
+-#define __KERNEL__
+-#ifdef CONFIG_HAVE_DEPRECATED_CONFIG_H
+-#include <linux/autoconf.h>
+-#else
+-#include <linux/config.h>
+-#endif
++  KBUILD_TRY_COMPILE([
+ #include <linux/log2.h>
+ ],[
+   int a = is_power_of_2(2);
+@@ -3055,10 +2564,8 @@
+ ],
+     AC_MSG_RESULT(yes);is_power_of_2="1",
+     AC_MSG_RESULT(no);is_power_of_2="0",
+-    AC_MSG_RESULT(unknown);is_power_of_2="0"
++    -Werror
+ )
+-  CFLAGS=$ac_save_CFLAGS
+-  CC=$ac_save_CC
+   CONFIG_HAVE_IS_POWER_OF_2=$is_power_of_2
+ fi
+ dnl AC_SUBST(CONFIG_HAVE_IS_POWER_OF_2)
+@@ -3072,17 +2579,7 @@
+ else
+   AC_MSG_CHECKING(for __ffs)
+   have_ffs="0"
+-  ac_save_CFLAGS="$CFLAGS"
+-  ac_save_CC="$CC"
+-  CFLAGS="$KERNEL_CHECK_CFLAGS"
+-  CC=$KCC
+-  AC_TRY_COMPILE([
+-#define __KERNEL__
+-#ifdef CONFIG_HAVE_DEPRECATED_CONFIG_H
+-#include <linux/autoconf.h>
+-#else
+-#include <linux/config.h>
+-#endif
++  KBUILD_TRY_COMPILE([
+ #include <linux/bitops.h>
+ ],[
+   unsigned long (*x)(unsigned long);
+@@ -3090,10 +2587,7 @@
+ ],
+     AC_MSG_RESULT(yes);have_ffs="1",
+     AC_MSG_RESULT(no);have_ffs="0",
+-    AC_MSG_RESULT(unknown);have_ffs="0"
+ )
+-  CFLAGS=$ac_save_CFLAGS
+-  CC=$ac_save_CC
+   CONFIG_HAVE_FFS=$have_ffs
+ fi
+ dnl AC_SUBST(CONFIG_HAVE_FFS)
+@@ -3105,17 +2599,7 @@
+ if test "$CONFIG_PNP_KERNEL" = "y"; then
+   AC_MSG_CHECKING(for PnP suspend/resume)
+   pnp_suspend="0"
+-  ac_save_CFLAGS="$CFLAGS"
+-  ac_save_CC="$CC"
+-  CFLAGS="$KERNEL_CHECK_CFLAGS"
+-  CC=$KCC
+-  AC_TRY_COMPILE([
+-#define __KERNEL__
+-#ifdef CONFIG_HAVE_DEPRECATED_CONFIG_H
+-#include <linux/autoconf.h>
+-#else
+-#include <linux/config.h>
+-#endif
++  KBUILD_TRY_COMPILE([
+ #include <linux/pnp.h>
+ ],[
+   struct pnp_driver pnp;
+@@ -3123,10 +2607,7 @@
+ ],
+     AC_MSG_RESULT(yes);pnp_suspend="1",
+     AC_MSG_RESULT(no);pnp_suspend="0",
+-    AC_MSG_RESULT(unknown);pnp_suspend="0"
+ )
+-  CFLAGS=$ac_save_CFLAGS
+-  CC=$ac_save_CC
+   CONFIG_HAVE_PNP_SUSPEND=$pnp_suspend
+   dnl AC_SUBST(CONFIG_HAVE_PNP_SUSPEND)
+   if test "$CONFIG_HAVE_PNP_SUSPEND" = "1"; then
+@@ -3138,27 +2619,14 @@
+ if test "$kversion.$kpatchlevel" = "2.6"; then
+   AC_MSG_CHECKING(for device_create_drvdata)
+   device_create_drvdata="0"
+-  ac_save_CFLAGS="$CFLAGS"
+-  ac_save_CC="$CC"
+-  CFLAGS="$KERNEL_CHECK_CFLAGS"
+-  CC=$KCC
+-  AC_TRY_COMPILE([
+-#define __KERNEL__
+-#ifdef CONFIG_HAVE_DEPRECATED_CONFIG_H
+-#include <linux/autoconf.h>
+-#else
+-#include <linux/config.h>
+-#endif
++  KBUILD_TRY_COMPILE([
+ #include <linux/device.h>
+ ],[
+   struct device *(*foo)() = device_create_drvdata;
+ ],
+     AC_MSG_RESULT(yes);device_create_drvdata="1",
+     AC_MSG_RESULT(no);device_create_drvdata="0",
+-    AC_MSG_RESULT(unknown);device_create_drvdata="0"
+ )
+-  CFLAGS=$ac_save_CFLAGS
+-  CC=$ac_save_CC
+   CONFIG_SND_HAS_DEVICE_CREATE_DRVDATA=$device_create_drvdata
+   if test "$CONFIG_SND_HAS_DEVICE_CREATE_DRVDATA" = "1"; then
+     AC_DEFINE(CONFIG_SND_HAS_DEVICE_CREATE_DRVDATA)
+@@ -3170,17 +2638,7 @@
+ if test "$kversion.$kpatchlevel" = "2.6"; then
+   AC_MSG_CHECKING(for new unlocked/compat_ioctl)
+   new_ioctl="0"
+-  ac_save_CFLAGS="$CFLAGS"
+-  ac_save_CC="$CC"
+-  CFLAGS="$KERNEL_CHECK_CFLAGS"
+-  CC=$KCC
+-  AC_TRY_COMPILE([
+-#define __KERNEL__
+-#ifdef CONFIG_HAVE_DEPRECATED_CONFIG_H
+-#include <linux/autoconf.h>
+-#else
+-#include <linux/config.h>
+-#endif
++  KBUILD_TRY_COMPILE([
+ #include <linux/fs.h>
+ ],[
+   struct file_operations ops;
+@@ -3189,10 +2647,7 @@
+ ],
+     AC_MSG_RESULT(yes);new_ioctl="1",
+     AC_MSG_RESULT(no);new_ioctl="0",
+-    AC_MSG_RESULT(unknown);new_ioctl="0"
+ )
+-  CFLAGS=$ac_save_CFLAGS
+-  CC=$ac_save_CC
+   CONFIG_SND_HAVE_NEW_IOCTL=$new_ioctl
+   dnl AC_SUBST(CONFIG_SND_HAVE_NEW_IOCTL)
+   if test "$CONFIG_SND_HAVE_NEW_IOCTL" = "1"; then
+@@ -3204,20 +2659,13 @@
+ dnl compiler support for _Bool
+ AC_MSG_CHECKING(for builtin _Bool support)
+ builtin_bool="0"
+-ac_save_CFLAGS="$CFLAGS"
+-ac_save_CC="$CC"
+-CFLAGS="$KERNEL_CHECK_CFLAGS"
+-CC=$KCC
+-AC_TRY_COMPILE([],[
++KBUILD_TRY_COMPILE([],[
+   _Bool b;
+   b = (_Bool)0;
+ ],
+   AC_MSG_RESULT(yes);builtin_bool="1",
+   AC_MSG_RESULT(no);builtin_bool="0",
+-  AC_MSG_RESULT(unknown);builtin_bool="1"
+ )
+-CFLAGS=$ac_save_CFLAGS
+-CC=$ac_save_CC
+ CONFIG_SND_HAS_BUILTIN_BOOL=$builtin_bool
+ if test "$CONFIG_SND_HAS_BUILTIN_BOOL" = "1"; then
+   AC_DEFINE(CONFIG_SND_HAS_BUILTIN_BOOL)
only in patch2:
unchanged:
--- alsa-driver-1.0.21+dfsg.orig/debian/patches/fix_version_check.patch
+++ alsa-driver-1.0.21+dfsg/debian/patches/fix_version_check.patch
@@ -0,0 +1,97 @@
+From: Ben Hutchings <ben at decadent.org.uk>
+Subject: [PATCH] Don't check autoconf.h or version.h directly
+
+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.
+
+--- a/configure.in	2010-03-27 01:33:53.000000000 +0000
++++ b/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" && 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`
only in patch2:
unchanged:
--- alsa-driver-1.0.21+dfsg.orig/debian/patches/distinguish_kernel_makefile_and_source_dirs.patch
+++ alsa-driver-1.0.21+dfsg/debian/patches/distinguish_kernel_makefile_and_source_dirs.patch
@@ -0,0 +1,304 @@
+From: Ben Hutchings <ben at decadent.org.uk>
+Subject: [PATCH] Distinguish kernel makefile and source directories
+
+The directory containing the top-level makefile is not the one
+containing source and/or headers when using Debian or SUSE kernel
+packages.  With current Debian kernel packages, the header file
+checks produce false negatives.
+
+--- a/configure.in
++++ b/configure.in
+@@ -61,8 +61,8 @@
+ CPP="`basename $CPP` $CPP_save"
+ fi
+ 
+-dnl Check for directory with kernel source...
+-AC_MSG_CHECKING(for directory with kernel source)
++dnl Check for directory with kernel top-level makefile...
++AC_MSG_CHECKING(for directory with kernel top-level makefile)
+ if test -d "/lib/modules/`uname -r`/source" -o -L "/lib/modules/`uname -r`/source"; then
+   DEFAULT_KERNEL_DIR="/lib/modules/`uname -r`/source"
+   DEFAULT_KERNEL_BUILD="/lib/modules/`uname -r`/build"
+@@ -72,7 +72,7 @@
+   DEFAULT_KERNEL_DIR="/usr/src/linux"
+ fi
+ AC_ARG_WITH(kernel,
+-  [  --with-kernel=dir       give the directory with kernel sources]
++  [  --with-kernel=dir       give the directory with kernel top-level makefile]
+   [                        [[/usr/src/linux]]],
+   [kerneldir="$withval"
+    DEFAULT_KERNEL_BUILD=""],
+@@ -81,6 +81,25 @@
+ CONFIG_SND_KERNELDIR=$(cd "$kerneldir" && pwd)
+ AC_MSG_RESULT($kerneldir)
+ 
++dnl Check for directory with kernel source/headers...
++AC_MSG_CHECKING(for directory with kernel headers)
++dir="$(mktemp -d)"
++if test -z "$dir"; then
++  echo >&2 "failed to create temporary directory"
++  exit 1
++fi
++echo "\$(warning KBUILD_SRC=\$(KBUILD_SRC))" > "$dir"/Makefile
++kernelsrc=$(make -C "$CONFIG_SND_KERNELDIR" M="$dir" 2>&1 >/dev/null | \
++	    sed -n "s#^$dir/Makefile:.*: KBUILD_SRC=\(.*\)\$#\1#; T; p; q")
++rm -rf "$dir"
++if test -z "$kernelsrc"; then
++  AC_MSG_RESULT(failed)
++  exit 1
++else
++  CONFIG_SND_KERNELSRC="$kernelsrc"
++  AC_MSG_RESULT($kernelsrc)
++fi
++
+ dnl Check for directory with kernel build tree...
+ AC_MSG_CHECKING(for directory with kernel build)
+ AC_ARG_WITH(build,
+@@ -93,11 +112,11 @@
+ 
+ AC_DEFUN([CHECK_REQUIRED_KERNEL_HEADER], [
+   AC_MSG_CHECKING(for kernel $1)
+-  if ! test -r $CONFIG_SND_KERNELDIR/include/$1; then
++  if ! test -r $CONFIG_SND_KERNELSRC/include/$1; then
+     if test -z "$kernelbuild" -o ! -f $kernelbuild/include/$1; then
+       AC_MSG_RESULT(no)
+       cat << EOF
+-The file $CONFIG_SND_KERNELDIR/include/$1 does not exist.
++The file $CONFIG_SND_KERNELSRC/include/$1 does not exist.
+ Please install the package with full kernel sources for your distribution
+ or use --with-kernel=dir option to specify another directory with kernel
+ sources (default is $DEFAULT_KERNEL_DIR).
+@@ -112,7 +131,7 @@
+ 
+ dnl Check for kernel version...
+ AC_MSG_CHECKING(for kernel version)
+-KERNEL_INC="-I$CONFIG_SND_KERNELDIR/include"
++KERNEL_INC="-I$CONFIG_SND_KERNELSRC/include"
+ MAKE_ADDS=""
+ if test -n "$kernelbuild"; then
+   kpath=""
+@@ -131,7 +150,7 @@
+ if test -n "$kernelbuild" -a -f $kernelbuild/include/linux/version.h; then
+   KERNDIR=$kernelbuild
+ else
+-  KERNDIR=$CONFIG_SND_KERNELDIR
++  KERNDIR=$CONFIG_SND_KERNELSRC
+ fi
+ AC_TRY_RUN([
+ #include <stdio.h>
+@@ -187,7 +206,7 @@
+ kpatchlevel=`expr $kpatchlevel + 0`
+ ksublevel=`expr $ksublevel + 0`
+ if test -z "$kversion" || test -z "$kpatchlevel" || test -z "$ksublevel"; then
+-  echo "failed (probably missing $CONFIG_SND_KERNELDIR/include/linux/version.h)"
++  echo "failed (probably missing $CONFIG_SND_KERNELSRC/include/linux/version.h)"
+   exit 1
+ fi
+ kaversion="$kversion.$kpatchlevel.$ksublevel$kextraversion"
+@@ -206,7 +225,7 @@
+ if test -n "$kernelbuild" -a -f $kernelbuild/include/linux/compile.h; then
+   KERNDIR=$kernelbuild
+ else
+-  KERNDIR=$CONFIG_SND_KERNELDIR
++  KERNDIR=$CONFIG_SND_KERNELSRC
+ fi
+ 
+ AC_TRY_RUN([
+@@ -356,7 +375,7 @@
+   if test -n "$kernelbuild" -a \( -f "$kernelbuild/include/$1" -o -f "$kernelbuild/include2/$1" -o -f "$kernelbuild/arch/$ARCHDIR/include/$1" \) ; then
+     KERNDIR=$kernelbuild
+   else
+-    KERNDIR=$CONFIG_SND_KERNELDIR
++    KERNDIR=$CONFIG_SND_KERNELSRC
+   fi
+   if test -n "$3"; then
+     eval $3=""
+@@ -393,7 +412,7 @@
+   if test -n "$kernelbuild" -a \( -f "$kernelbuild/include/$1" -o -f "$kernelbuild/include2/$1" -o -f "$kernelbuild/arch/$ARCHDIR/include/$1" \) ; then
+     KERNDIR=$kernelbuild
+   else
+-    KERNDIR=$CONFIG_SND_KERNELDIR
++    KERNDIR=$CONFIG_SND_KERNELSRC
+   fi
+   if grep -q $2 "$KERNDIR/include/$1" "$KERNDIR/include2/$1" "$KERNDIR/arch/$ARCHDIR/include/$1" > /dev/null 2>&1; then
+     AC_MSG_RESULT(no)
+@@ -420,7 +439,7 @@
+   if test -n "$kernelbuild" -a -f "$kernelbuild/include/linux/autoconf.h"; then
+     KERNDIR=$kernelbuild
+   else
+-    KERNDIR=$CONFIG_SND_KERNELDIR
++    KERNDIR=$CONFIG_SND_KERNELSRC
+   fi
+   boolchk=""
+   AC_TRY_RUN([
+@@ -451,7 +470,7 @@
+   if test -n "$kernelbuild" -a -f "$kernelbuild/include/linux/autoconf.h"; then
+     KERNDIR=$kernelbuild
+   else
+-    KERNDIR=$CONFIG_SND_KERNELDIR
++    KERNDIR=$CONFIG_SND_KERNELSRC
+   fi
+   boolchk=""
+   AC_TRY_RUN([
+@@ -482,7 +501,7 @@
+   if test -n "$kernelbuild" -a -f "$kernelbuild/include/linux/autoconf.h"; then
+     KERNDIR=$kernelbuild
+   else
+-    KERNDIR=$CONFIG_SND_KERNELDIR
++    KERNDIR=$CONFIG_SND_KERNELSRC
+   fi
+   tristatechk=""
+   AC_TRY_RUN([
+@@ -528,7 +547,7 @@
+   AC_MSG_CHECKING(for exported symbol $2)
+   ac_save_CFLAGS="$CFLAGS"
+   boolchk=""
+-  if grep EXPORT_SYMBOL "$CONFIG_SND_KERNELDIR/kernel/ksyms.c" | grep "$2" > /dev/null; then
++  if grep EXPORT_SYMBOL "$CONFIG_SND_KERNELSRC/kernel/ksyms.c" | grep "$2" > /dev/null; then
+     AC_MSG_RESULT(yes);boolchk="y"
+     AC_DEFINE($1)
+   else
+@@ -591,6 +610,8 @@
+ dnl define kernel directory now
+ AC_DEFINE_UNQUOTED(CONFIG_SND_KERNELDIR, "$CONFIG_SND_KERNELDIR")
+ AC_SUBST(CONFIG_SND_KERNELDIR)
++AC_DEFINE_UNQUOTED(CONFIG_SND_KERNELSRC, "$CONFIG_SND_KERNELSRC")
++AC_SUBST(CONFIG_SND_KERNELSRC)
+ AC_SUBST(MAKE_ADDS)
+ 
+ dnl update include/sound/version.h
+@@ -988,8 +1009,8 @@
+ 	fi
+     fi
+     c_opts="-D__powerpc__ -fsigned-char -fno-builtin -msoft-float -ffixed-r2 -Wno-uninitialized -mmultiple -mstring"
+-    if test -d $CONFIG_SND_KERNELDIR/arch/ppc/include; then
+-      KERNEL_INC="$KERNEL_INC -I$CONFIG_SND_KERNELDIR/arch/ppc/include"
++    if test -d $CONFIG_SND_KERNELSRC/arch/ppc/include; then
++      KERNEL_INC="$KERNEL_INC -I$CONFIG_SND_KERNELSRC/arch/ppc/include"
+     fi
+     CONFIG_PPC=y
+     CONFIG_PPC32=y
+@@ -1145,8 +1166,8 @@
+       ARCHDIR=$ARCH
+       ;;
+    esac
+-   if test -d $CONFIG_SND_KERNELDIR/arch/$ARCHDIR/include; then
+-      KERNEL_INC="$KERNEL_INC -I$CONFIG_SND_KERNELDIR/arch/$ARCHDIR/include"
++   if test -d $CONFIG_SND_KERNELSRC/arch/$ARCHDIR/include; then
++      KERNEL_INC="$KERNEL_INC -I$CONFIG_SND_KERNELSRC/arch/$ARCHDIR/include"
+    fi
+ fi
+ 
+@@ -1160,8 +1181,8 @@
+       CONFIG_X86_32=y
+     fi
+     for i in include/asm-x86 include/asm-i386 include2/asm-x86 include2/asm-i386 arch/x86/include/asm; do
+-      if test -r $CONFIG_SND_KERNELDIR/$i/mach-default/mach_apic.h; then
+-        mach_dir="$CONFIG_SND_KERNELDIR/$i"
++      if test -r $CONFIG_SND_KERNELSRC/$i/mach-default/mach_apic.h; then
++        mach_dir="$CONFIG_SND_KERNELSRC/$i"
+ 	break
+       fi  
+       if test -n "$kernelbuild" -a -r $kernelbuild/$i/mach-default/mach_apic.h; then
+@@ -1172,8 +1193,8 @@
+     ;;
+   x86_64)
+     for i in include/asm-x86 include2/asm-x86 arch/x86/include/asm; do
+-      if test -r $CONFIG_SND_KERNELDIR/$i/mach-default/mach_apic.h; then
+-        mach_dir="$CONFIG_SND_KERNELDIR/$i"
++      if test -r $CONFIG_SND_KERNELSRC/$i/mach-default/mach_apic.h; then
++        mach_dir="$CONFIG_SND_KERNELSRC/$i"
+ 	break
+       fi  
+       if test -n "$kernelbuild" -a -r $kernelbuild/$i/mach-default/mach_apic.h; then
+@@ -1194,8 +1215,8 @@
+ 	checkarch="$ARCH"
+ 	;;
+     esac
+-    if test -d $CONFIG_SND_KERNELDIR/arch/$checkarch/include; then
+-	KERNEL_INC="$KERNEL_INC -I$CONFIG_SND_KERNELDIR/arch/$checkarch/include"
++    if test -d $CONFIG_SND_KERNELSRC/arch/$checkarch/include; then
++	KERNEL_INC="$KERNEL_INC -I$CONFIG_SND_KERNELSRC/arch/$checkarch/include"
+     fi
+ fi
+ 
+@@ -1208,7 +1229,7 @@
+   if test -n "$kernelbuild" -a -f "$kernelbuild/include/linux/autoconf.h"; then
+     KERNDIR=$kernelbuild
+   else
+-    KERNDIR=$CONFIG_SND_KERNELDIR
++    KERNDIR=$CONFIG_SND_KERNELSRC
+   fi
+   AC_TRY_RUN([
+ #include <stdio.h>
+@@ -1259,7 +1280,7 @@
+ 	if test -n "$kernelbuild" -a -f "$kernelbuild/include/linux/autoconf.h"; then
+ 	  KERNDIR=$kernelbuild
+ 	else
+-	  KERNDIR=$CONFIG_SND_KERNELDIR
++	  KERNDIR=$CONFIG_SND_KERNELSRC
+ 	fi
+ 	AC_TRY_RUN([
+ #include <stdio.h>
+@@ -1333,7 +1354,7 @@
+ CONFIG_SGI=""
+ if test "$CONFIG_MIPS" = "y"; then
+   AC_MSG_CHECKING(for SGI/MIPS (HAL2) architecture)
+-  if test -r "$CONFIG_SND_KERNELDIR/include/asm/sgi/sgihpc.h"; then
++  if test -r "$CONFIG_SND_KERNELSRC/include/asm/sgi/sgihpc.h"; then
+     CONFIG_SGI="y"
+   fi
+   if test "$CONFIG_SGI" = "y"; then
+@@ -1391,7 +1412,7 @@
+ if test -n "$kernelbuild" -a \( -f "$kernelbuild/include/$1" -o -f "$kernelbuild/include2/$1" \) ; then
+   KERNDIR=$kernelbuild
+ else
+-  KERNDIR=$CONFIG_SND_KERNELDIR
++  KERNDIR=$CONFIG_SND_KERNELSRC
+ fi
+ deprecated_config_h="0"
+ if test -r $KERNDIR/include/linux/config.h ; then
+@@ -1552,7 +1573,7 @@
+ dnl Check for ISA PnP driver in kernel...
+ AC_MSG_CHECKING(for ISA PnP driver in kernel)
+ CONFIG_ISAPNP_KERNEL=
+-if test -r $CONFIG_SND_KERNELDIR/include/linux/isapnp.h; then
++if test -r $CONFIG_SND_KERNELSRC/include/linux/isapnp.h; then
+   AC_MSG_RESULT(yes)
+   AC_DEFINE(CONFIG_ISAPNP_KERNEL)
+   CONFIG_ISAPNP_KERNEL=y
+@@ -1564,7 +1585,7 @@
+ dnl Check for PnP layer (2.5+) in kernel...
+ AC_MSG_CHECKING(for PnP driver in kernel)
+ CONFIG_PNP_KERNEL=
+-if test -r $CONFIG_SND_KERNELDIR/include/linux/pnp.h; then
++if test -r $CONFIG_SND_KERNELSRC/include/linux/pnp.h; then
+   AC_MSG_RESULT(yes)
+   AC_DEFINE(CONFIG_PNP_KERNEL)
+   CONFIG_PNP_KERNEL=y
+@@ -3332,6 +3353,8 @@
+     kernconf="$kernelbuild/include/linux/autoconf.h"
+   elif test -r  $CONFIG_SND_KERNELDIR/include/linux/autoconf.h ; then
+     kernconf="$CONFIG_SND_KERNELDIR/include/linux/autoconf.h"
++  elif test -r  $CONFIG_SND_KERNELSRC/include/linux/autoconf.h ; then
++    kernconf="$CONFIG_SND_KERNELSRC/include/linux/autoconf.h"
+   else
+       cat << EOF
+ File include/linux/autoconf.h does not exist in kernel tree.
+--- alsa-driver-1.0.21+dfsg.orig/include/pci_ids_compat.h.in
++++ alsa-driver-1.0.21+dfsg/include/pci_ids_compat.h.in
+@@ -1,5 +1,5 @@
+ #ifndef LINUX_2_2
+-#include "@CONFIG_SND_KERNELDIR@/include/linux/pci_ids.h"
++#include "@CONFIG_SND_KERNELSRC@/include/linux/pci_ids.h"
+ #endif
+ 
+ /* bt87x */
+--- alsa-driver-1.0.21+dfsg.orig/include/i2c-id_compat.h.in
++++ alsa-driver-1.0.21+dfsg/include/i2c-id_compat.h.in
+@@ -1,4 +1,4 @@
+-#include "@CONFIG_SND_KERNELDIR@/include/linux/i2c-id.h"
++#include "@CONFIG_SND_KERNELSRC@/include/linux/i2c-id.h"
+ 
+ #ifndef I2C_DRIVERID_WM8731
+ #define I2C_DRIVERID_WM8731		89	/* Wolfson WM8731 audio codec */
only in patch2:
unchanged:
--- alsa-driver-1.0.21+dfsg.orig/debian/patches/fix_asihpi_includes.patch
+++ alsa-driver-1.0.21+dfsg/debian/patches/fix_asihpi_includes.patch
@@ -0,0 +1,15 @@
+From: Ben Hutchings <ben at decadent.org.uk>
+Subject: [PATCH] Include <linux/sched.h> in hpios_linux_kernel.c
+
+Needed for declaration of schedule_timeout_uninterruptible().
+
+--- a/pci/asihpi/hpios_linux_kernel.c
++++ b/pci/asihpi/hpios_linux_kernel.c
+@@ -23,6 +23,7 @@
+ #define SOURCEFILE_NAME "hpios_linux_kernel.c"
+ #include "hpidebug.h"
+ #include <linux/delay.h>
++#include <linux/sched.h>
+ 
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2 , 6 , 14)
+ void HpiOs_DelayMicroSeconds(
--- END ---

-- 
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/94e99755/attachment-0001.pgp>


More information about the Pkg-alsa-devel mailing list