samba: add --enable-libunwind option

Upstream-Status: Pending

This let the end user explicitly enable/disable libunwind support.
---
 configure |   28 ++++++++++++++++++++++++++--
 1 file changed, 26 insertions(+), 2 deletions(-)

diff -urpN a/source3/configure b/source3/configure
--- a/source3/configure
+++ b/source3/configure
@@ -1007,6 +1007,7 @@ with_included_iniparser
 with_static_modules
 with_shared_modules
 enable_dmalloc
+enable_libunwind
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1670,6 +1671,7 @@ Optional Features:
   --enable-avahi          Enable Avahi support (default=auto)
   --enable-pthreadpool    Enable pthreads pool helper support (default=no)
   --enable-dmalloc        Enable heap debugging [default=no]
+  --enable-libunwind      Enable libunwind support if available (default=no)
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
@@ -16458,7 +16460,7 @@ done
 
 
 # Find a method of generating a stack trace
-for ac_header in execinfo.h libexc.h libunwind.h
+for ac_header in execinfo.h libexc.h
 do :
   as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
 ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
@@ -16684,6 +16686,13 @@ fi
 
 LIBS="$save_LIBS"
 
+# Check whether --enable-libunwind was given.
+if test "${enable_libunwind+set}" = set; then :
+  enableval=$enable_libunwind;
+fi
+
+if test "x$enable_libunwind" != xno
+then
 # Note that all the libunwind symbols in the API are defined to internal
 # platform-specific version, so we must include libunwind.h before checking
 # any of them.
@@ -16691,6 +16700,21 @@ LIBS="$save_LIBS"
 $as_echo_n "checking for libunwind... " >&6; }
 save_LIBS=$LIBS
 
+# Check for libunwind.h present
+for ac_header in libunwind.h
+do :
+  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+eval as_val=\$$as_ac_Header
+   if test "x$as_val" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
 UNWIND_ARCH="unknown"
 if test x"$UNAME_I" != x"unknown"; then
 	UNWIND_ARCH="$UNAME_I"
@@ -16877,7 +16901,7 @@ fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 fi
-
+fi
 
 
 for ac_func in _dup _dup2 _opendir _readdir _seekdir _telldir _closedir
