Extend CONFIG_DEBUG_LOCK_ALLOC check
[zfs.git] / configure
index f891e1a..6b198f8 100755 (executable)
--- a/configure
+++ b/configure
@@ -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,23 +12526,74 @@ _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: error:
-       *** Kernel built with CONFIG_DEBUG_LOCK_ALLOC which is
-       *** incompatible with the CDDL license.  You must rebuild
-       *** your kernel without this option." >&2;}
-   { (exit 1); exit 1; }; }
+
+               { $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: no" >&5
-$as_echo "no" >&6; }
-
+                       { $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 enabled." >&2;}
+   { (exit 1); exit 1; }; }
 
 
 
        rm -Rf build
 
 
+               EXTRA_KCFLAGS="$tmp_flags"
 
 
-fi
-
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
 
-       if test "$ZFS_META_LICENSE" = GPL; then
+               { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_GPL_ONLY_SYMBOLS 1
-_ACEOF
 
 
 fi
 
+       rm -Rf build
+
+
+
+
 
 
        { $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,23 +18619,74 @@ _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: error:
-       *** Kernel built with CONFIG_DEBUG_LOCK_ALLOC which is
-       *** incompatible with the CDDL license.  You must rebuild
-       *** your kernel without this option." >&2;}
-   { (exit 1); exit 1; }; }
+
+               { $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: no" >&5
-$as_echo "no" >&6; }
-
+                       { $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 enabled." >&2;}
+   { (exit 1); exit 1; }; }
 
 
 
        rm -Rf build
 
 
+               EXTRA_KCFLAGS="$tmp_flags"
 
 
-fi
-
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
 
-       if test "$ZFS_META_LICENSE" = GPL; then
+               { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_GPL_ONLY_SYMBOLS 1
-_ACEOF
 
 
 fi
 
+       rm -Rf build
+
+
+
+
 
 
        { $as_echo "$as_me:$LINENO: checking block device operation prototypes" >&5