From: Ben Hutchings Subject: [PATCH] Change configure script to use Kbuild for compile tests Last-Update: 2010-05-23 Kbuild is the only proper way to build modules. Calling the compiler directly will tend to result in false negatives. 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 @@ -1654,11 +1654,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]) @@ -1735,20 +1730,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 <$INCLUDE_AUTOCONF_H> -#else -#include -#endif +KBUILD_TRY_COMPILE([ #include #include ],[ @@ -1757,10 +1764,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 @@ -1770,17 +1775,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 <$INCLUDE_AUTOCONF_H> -#else -#include -#endif +KBUILD_TRY_COMPILE([ #include ],[ char buf[128]; @@ -1788,10 +1783,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 @@ -1801,17 +1794,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 <$INCLUDE_AUTOCONF_H> -#else -#include -#endif +KBUILD_TRY_COMPILE([ #include void f(const char *fmt, ...) { @@ -1826,10 +1809,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 @@ -1839,17 +1820,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 <$INCLUDE_AUTOCONF_H> -#else -#include -#endif +KBUILD_TRY_COMPILE([ #include ],[ char buf[128]; @@ -1857,10 +1828,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 @@ -1870,17 +1839,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 <$INCLUDE_AUTOCONF_H> -#else -#include -#endif +KBUILD_TRY_COMPILE([ #include ],[ unsigned int i; @@ -1888,10 +1847,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 @@ -1901,17 +1858,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 <$INCLUDE_AUTOCONF_H> -#else -#include -#endif +KBUILD_TRY_COMPILE([ #include #include #include @@ -1922,10 +1869,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 @@ -1935,27 +1879,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 <$INCLUDE_AUTOCONF_H> -#else -#include -#endif +KBUILD_TRY_COMPILE([ #include ],[ 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 @@ -1965,17 +1896,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 <$INCLUDE_AUTOCONF_H> -#else -#include -#endif +KBUILD_TRY_COMPILE([ #include #include ],[ @@ -1984,10 +1905,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 @@ -1997,17 +1915,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 <$INCLUDE_AUTOCONF_H> -#else -#include -#endif +KBUILD_TRY_COMPILE([ #include ],[ int (*func)(); @@ -2015,10 +1923,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) @@ -2027,17 +1932,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 <$INCLUDE_AUTOCONF_H> -#else -#include -#endif +KBUILD_TRY_COMPILE([ #include ],[ int (*func)(); @@ -2045,10 +1940,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) @@ -2057,17 +1949,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 <$INCLUDE_AUTOCONF_H> -#else -#include -#endif +KBUILD_TRY_COMPILE([ #include ],[ void (*func)(unsigned int); @@ -2075,10 +1957,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 @@ -2089,17 +1968,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 <$INCLUDE_AUTOCONF_H> -#else -#include -#endif +KBUILD_TRY_COMPILE([ #include ],[ unsigned long (*func)(unsigned int); @@ -2107,10 +1976,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 @@ -2121,17 +1987,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 <$INCLUDE_AUTOCONF_H> -#else -#include -#endif +KBUILD_TRY_COMPILE([ #include #include ],[ @@ -2140,10 +1996,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 @@ -2153,17 +2007,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 <$INCLUDE_AUTOCONF_H> -#else -#include -#endif +KBUILD_TRY_COMPILE([ #include ],[ struct tty_struct tty; @@ -2171,10 +2015,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) @@ -2184,17 +2025,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 <$INCLUDE_AUTOCONF_H> -#else -#include -#endif +KBUILD_TRY_COMPILE([ #include #include "media/v4l2-dev.h" ],[ @@ -2203,10 +2034,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 @@ -2218,17 +2047,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 <$INCLUDE_AUTOCONF_H> -#else -#include -#endif +KBUILD_TRY_COMPILE([ #include #include "media/v4l2-dev.h" ],[ @@ -2237,10 +2056,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 @@ -2269,17 +2086,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 <$INCLUDE_AUTOCONF_H> -#else -#include -#endif +KBUILD_TRY_COMPILE([ #include ],[ static pgprot_t p; @@ -2287,10 +2094,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 @@ -2298,17 +2103,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 <$INCLUDE_AUTOCONF_H> -#else -#include -#endif +KBUILD_TRY_COMPILE([ #include ],[ static pgprot_t p; @@ -2316,10 +2111,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 @@ -2328,17 +2121,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 <$INCLUDE_AUTOCONF_H> -#else -#include -#endif +KBUILD_TRY_COMPILE([ #include ],[ void * (*func)(size_t, size_t, int); @@ -2346,10 +2129,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 @@ -2359,17 +2139,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 <$INCLUDE_AUTOCONF_H> -#else -#include -#endif +KBUILD_TRY_COMPILE([ #include ],[ char * (*func)(const char *, int); @@ -2377,10 +2147,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 @@ -2390,13 +2157,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 +KBUILD_TRY_COMPILE([ #include ],[ char * (*func)(const char *, int); @@ -2404,10 +2165,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 @@ -2417,17 +2175,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 <$INCLUDE_AUTOCONF_H> -#else -#include -#endif +KBUILD_TRY_COMPILE([ #include ],[ void * (*func)(size_t, int); @@ -2435,10 +2183,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 @@ -2449,27 +2194,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 <$INCLUDE_AUTOCONF_H> -#else -#include -#endif +KBUILD_TRY_COMPILE([ #include ],[ 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 @@ -2480,17 +2212,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 <$INCLUDE_AUTOCONF_H> -#else -#include -#endif +KBUILD_TRY_COMPILE([ #include ],[ void (*func)(struct pci_dev *, int); @@ -2498,10 +2220,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 @@ -2511,17 +2230,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 <$INCLUDE_AUTOCONF_H> -#else -#include -#endif +KBUILD_TRY_COMPILE([ #include ],[ struct pci_dev dev; @@ -2529,10 +2238,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 @@ -2543,17 +2249,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 <$INCLUDE_AUTOCONF_H> -#else -#include -#endif +KBUILD_TRY_COMPILE([ #include ],[ struct pci_dev *pci; @@ -2561,10 +2257,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 @@ -2573,17 +2266,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 <$INCLUDE_AUTOCONF_H> -#else -#include -#endif +KBUILD_TRY_COMPILE([ #include ],[ void (*func)(struct file_operations *, int, struct device *); @@ -2591,10 +2274,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 @@ -2607,20 +2287,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 <$INCLUDE_AUTOCONF_H> -#else -#include -#endif -#ifdef __alpha__ /* it's required (at least for 2.2.18) */ -#include -#endif +KBUILD_TRY_COMPILE([ #include ],[ struct fasync_struct *fa; @@ -2629,10 +2296,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 @@ -2642,27 +2306,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 <$INCLUDE_AUTOCONF_H> -#else -#include -#endif +KBUILD_TRY_COMPILE([ #include ],[ 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 @@ -2672,17 +2323,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 <$INCLUDE_AUTOCONF_H> -#else -#include -#endif +KBUILD_TRY_COMPILE([ #include ],[ #ifndef init_MUTEX @@ -2692,10 +2333,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 @@ -2890,17 +2528,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 <$INCLUDE_AUTOCONF_H> -#else -#include -#endif + KBUILD_TRY_COMPILE([ #include ],[ struct class_simple *(*foo)(struct module *, char *) = class_simple_create; @@ -2908,10 +2536,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 @@ -2923,17 +2548,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 <$INCLUDE_AUTOCONF_H> -#else -#include -#endif + KBUILD_TRY_COMPILE([ #include ],[ static struct device_driver driver; @@ -2941,10 +2556,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 @@ -2956,27 +2568,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 <$INCLUDE_AUTOCONF_H> -#else -#include -#endif + KBUILD_TRY_COMPILE([ #include ],[ 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 @@ -2988,17 +2587,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 <$INCLUDE_AUTOCONF_H> -#else -#include -#endif + KBUILD_TRY_COMPILE([ #include ],[ struct class_device dev; @@ -3006,10 +2595,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 @@ -3021,17 +2607,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 <$INCLUDE_AUTOCONF_H> -#else -#include -#endif + KBUILD_TRY_COMPILE([ #include ],[ irq_handler_t handle = 0; @@ -3039,10 +2615,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 @@ -3053,17 +2626,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 <$INCLUDE_AUTOCONF_H> -#else -#include -#endif +KBUILD_TRY_COMPILE([ #include #include ],[ @@ -3071,10 +2634,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 @@ -3084,17 +2644,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 <$INCLUDE_AUTOCONF_H> -#else -#include -#endif +KBUILD_TRY_COMPILE([ #include #include ],[ @@ -3102,10 +2652,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 @@ -3115,17 +2662,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 <$INCLUDE_AUTOCONF_H> -#else -#include -#endif +KBUILD_TRY_COMPILE([ #include #include ],[ @@ -3135,10 +2672,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 @@ -3151,20 +2685,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 <$INCLUDE_AUTOCONF_H> -#else -#include -#endif + KBUILD_TRY_COMPILE([ #include ],[ int *x = (int *)init_utsname(); @@ -3172,10 +2693,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) @@ -3189,17 +2708,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 <$INCLUDE_AUTOCONF_H> -#else -#include -#endif + KBUILD_TRY_COMPILE([ #include ],[ int a = is_power_of_2(2); @@ -3207,10 +2716,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) @@ -3224,17 +2731,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 <$INCLUDE_AUTOCONF_H> -#else -#include -#endif + KBUILD_TRY_COMPILE([ #include ],[ unsigned long (*x)(unsigned long); @@ -3242,10 +2739,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) @@ -3257,17 +2751,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 <$INCLUDE_AUTOCONF_H> -#else -#include -#endif + KBUILD_TRY_COMPILE([ #include ],[ struct pnp_driver pnp; @@ -3275,10 +2759,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 @@ -3290,27 +2771,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 <$INCLUDE_AUTOCONF_H> -#else -#include -#endif + KBUILD_TRY_COMPILE([ #include ],[ 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) @@ -3322,17 +2790,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 <$INCLUDE_AUTOCONF_H> -#else -#include -#endif + KBUILD_TRY_COMPILE([ #include ],[ struct file_operations ops; @@ -3341,10 +2799,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 @@ -3356,20 +2811,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)