Extend CONFIG_DEBUG_LOCK_ALLOC check

The CONFIG_DEBUG_LOCK_ALLOC check at configure time was added to
detect when mutex_lock() is defined as a GPL-only symbol.  However,
the check as written only inferred this from this configuration
setting, it never actually checked.  This change introduces that
missing check to prevent false positives.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
This commit is contained in:
Brian Behlendorf
2012-05-21 12:59:58 -07:00
parent c421831192
commit e5b8562277
2 changed files with 244 additions and 66 deletions
Vendored
+182 -44
View File
@@ -12396,6 +12396,19 @@ $as_echo "$SPL_SYMBOLS" >&6; }
if test "$ZFS_META_LICENSE" = GPL; then
cat >>confdefs.h <<\_ACEOF
#define HAVE_GPL_ONLY_SYMBOLS 1
_ACEOF
fi
{ $as_echo "$as_me:$LINENO: checking whether Linux was built with CONFIG_PREEMPT" >&5
$as_echo_n "checking whether Linux was built with CONFIG_PREEMPT... " >&6; }
@@ -12466,9 +12479,9 @@ fi
if test "$ZFS_META_LICENSE" = CDDL; then
{ $as_echo "$as_me:$LINENO: checking whether Linux was built with CONFIG_DEBUG_LOCK_ALLOC" >&5
{ $as_echo "$as_me:$LINENO: checking whether Linux was built with CONFIG_DEBUG_LOCK_ALLOC" >&5
$as_echo_n "checking whether Linux was built with CONFIG_DEBUG_LOCK_ALLOC... " >&6; }
@@ -12513,16 +12526,85 @@ _ACEOF
{ $as_echo "$as_me:$LINENO: result: yes" >&5
$as_echo "yes" >&6; }
{ { $as_echo "$as_me:$LINENO: error:
*** Kernel built with CONFIG_DEBUG_LOCK_ALLOC which is
*** incompatible with the CDDL license. You must rebuild
*** your kernel without this option." >&5
{ $as_echo "$as_me:$LINENO: checking whether mutex_lock() is GPL-only" >&5
$as_echo_n "checking whether mutex_lock() is GPL-only... " >&6; }
tmp_flags="$EXTRA_KCFLAGS"
cat confdefs.h - <<_ACEOF >conftest.c
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <linux/module.h>
#include <linux/mutex.h>
MODULE_LICENSE("$ZFS_META_LICENSE");
int
main (void)
{
struct mutex lock;
mutex_init(&lock);
mutex_lock(&lock);
mutex_unlock(&lock);
;
return 0;
}
_ACEOF
rm -Rf build && mkdir -p build
echo "obj-m := conftest.o" >build/Makefile
if { ac_try='cp conftest.c build && make modules -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } >/dev/null && { ac_try='test -s build/conftest.o'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
{ $as_echo "$as_me:$LINENO: result: no" >&5
$as_echo "no" >&6; }
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
{ $as_echo "$as_me:$LINENO: result: yes" >&5
$as_echo "yes" >&6; }
{ { $as_echo "$as_me:$LINENO: error:
*** Kernel built with CONFIG_DEBUG_LOCK_ALLOC which is incompatible
*** with the CDDL license. You must rebuild your kernel without
*** this option enabled." >&5
$as_echo "$as_me: error:
*** Kernel built with CONFIG_DEBUG_LOCK_ALLOC which is
*** incompatible with the CDDL license. You must rebuild
*** your kernel without this option." >&2;}
*** Kernel built with CONFIG_DEBUG_LOCK_ALLOC which is incompatible
*** with the CDDL license. You must rebuild your kernel without
*** this option enabled." >&2;}
{ (exit 1); exit 1; }; }
fi
rm -Rf build
EXTRA_KCFLAGS="$tmp_flags"
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
@@ -12540,19 +12622,6 @@ fi
fi
if test "$ZFS_META_LICENSE" = GPL; then
cat >>confdefs.h <<\_ACEOF
#define HAVE_GPL_ONLY_SYMBOLS 1
_ACEOF
fi
{ $as_echo "$as_me:$LINENO: checking block device operation prototypes" >&5
@@ -18420,6 +18489,19 @@ $as_echo "$SPL_SYMBOLS" >&6; }
if test "$ZFS_META_LICENSE" = GPL; then
cat >>confdefs.h <<\_ACEOF
#define HAVE_GPL_ONLY_SYMBOLS 1
_ACEOF
fi
{ $as_echo "$as_me:$LINENO: checking whether Linux was built with CONFIG_PREEMPT" >&5
$as_echo_n "checking whether Linux was built with CONFIG_PREEMPT... " >&6; }
@@ -18490,9 +18572,9 @@ fi
if test "$ZFS_META_LICENSE" = CDDL; then
{ $as_echo "$as_me:$LINENO: checking whether Linux was built with CONFIG_DEBUG_LOCK_ALLOC" >&5
{ $as_echo "$as_me:$LINENO: checking whether Linux was built with CONFIG_DEBUG_LOCK_ALLOC" >&5
$as_echo_n "checking whether Linux was built with CONFIG_DEBUG_LOCK_ALLOC... " >&6; }
@@ -18537,16 +18619,85 @@ _ACEOF
{ $as_echo "$as_me:$LINENO: result: yes" >&5
$as_echo "yes" >&6; }
{ { $as_echo "$as_me:$LINENO: error:
*** Kernel built with CONFIG_DEBUG_LOCK_ALLOC which is
*** incompatible with the CDDL license. You must rebuild
*** your kernel without this option." >&5
{ $as_echo "$as_me:$LINENO: checking whether mutex_lock() is GPL-only" >&5
$as_echo_n "checking whether mutex_lock() is GPL-only... " >&6; }
tmp_flags="$EXTRA_KCFLAGS"
cat confdefs.h - <<_ACEOF >conftest.c
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <linux/module.h>
#include <linux/mutex.h>
MODULE_LICENSE("$ZFS_META_LICENSE");
int
main (void)
{
struct mutex lock;
mutex_init(&lock);
mutex_lock(&lock);
mutex_unlock(&lock);
;
return 0;
}
_ACEOF
rm -Rf build && mkdir -p build
echo "obj-m := conftest.o" >build/Makefile
if { ac_try='cp conftest.c build && make modules -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } >/dev/null && { ac_try='test -s build/conftest.o'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
{ $as_echo "$as_me:$LINENO: result: no" >&5
$as_echo "no" >&6; }
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
{ $as_echo "$as_me:$LINENO: result: yes" >&5
$as_echo "yes" >&6; }
{ { $as_echo "$as_me:$LINENO: error:
*** Kernel built with CONFIG_DEBUG_LOCK_ALLOC which is incompatible
*** with the CDDL license. You must rebuild your kernel without
*** this option enabled." >&5
$as_echo "$as_me: error:
*** Kernel built with CONFIG_DEBUG_LOCK_ALLOC which is
*** incompatible with the CDDL license. You must rebuild
*** your kernel without this option." >&2;}
*** Kernel built with CONFIG_DEBUG_LOCK_ALLOC which is incompatible
*** with the CDDL license. You must rebuild your kernel without
*** this option enabled." >&2;}
{ (exit 1); exit 1; }; }
fi
rm -Rf build
EXTRA_KCFLAGS="$tmp_flags"
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
@@ -18564,19 +18715,6 @@ fi
fi
if test "$ZFS_META_LICENSE" = GPL; then
cat >>confdefs.h <<\_ACEOF
#define HAVE_GPL_ONLY_SYMBOLS 1
_ACEOF
fi
{ $as_echo "$as_me:$LINENO: checking block device operation prototypes" >&5