$NetBSD: patch-configure,v 1.3 2014/08/29 10:29:15 richard Exp $

reinstate patch as upstream patch not yet in [1.6.2] release.
http://git.gnupg.org/cgi-bin/gitweb.cgi?p=libgcrypt.git;a=commitdiff;h=43376891c01f4aff1fbfb23beafebb5adfd0868c

--- configure.orig	2014-08-21 13:14:09.000000000 +0000
+++ configure
@@ -16455,13 +16455,63 @@ $as_echo "#define HAVE_GCC_INLINE_ASM_BM
 
 fi
 
+#
+# Check whether GCC assembler needs "-Wa,--divide" to correctly handle
+# constant division
+#
+if test $amd64_as_feature_detection = yes; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether GCC assembler handles division correctly" >&5
+$as_echo_n "checking whether GCC assembler handles division correctly... " >&6; }
+if ${gcry_cv_gcc_as_const_division_ok+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  gcry_cv_gcc_as_const_division_ok=no
+        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+__asm__("xorl \$(123456789/12345678), %ebp;\n\t");
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  gcry_cv_gcc_as_const_division_ok=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcry_cv_gcc_as_const_division_ok" >&5
+$as_echo "$gcry_cv_gcc_as_const_division_ok" >&6; }
+  if test "$gcry_cv_gcc_as_const_division_ok" = "no" ; then
+    #
+    # Add '-Wa,--divide' to CPPFLAGS and try check again.
+    #
+    _gcc_cppflags_save="$CPPFLAGS"
+    CPPFLAGS="$CPPFLAGS -Wa,--divide"
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether GCC assembler handles division correctly with \"-Wa,--divide\"" >&5
+$as_echo_n "checking whether GCC assembler handles division correctly with \"-Wa,--divide\"... " >&6; }
+if ${gcry_cv_gcc_as_const_division_with_wadivide_ok+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  gcry_cv_gcc_as_const_division_with_wadivide_ok=no
+          cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+__asm__("xorl \$(123456789/12345678), %ebp;\n\t");
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  gcry_cv_gcc_as_const_division_with_wadivide_ok=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcry_cv_gcc_as_const_division_with_wadivide_ok" >&5
+$as_echo "$gcry_cv_gcc_as_const_division_with_wadivide_ok" >&6; }
+    if test "$gcry_cv_gcc_as_const_division_with_wadivide_ok" = "no" ; then
+      CPPFLAGS="$_gcc_cppflags_save"
+    fi
+  fi
+fi
 
 #
 # Check whether GCC assembler supports features needed for our amd64
 # implementations
 #
 if test $amd64_as_feature_detection = yes; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether GCC assembler is compatible for amd64 assembly implementations" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether GCC assembler is compatible for amd64 assembly implementations" >&5
 $as_echo_n "checking whether GCC assembler is compatible for amd64 assembly implementations... " >&6; }
 if ${gcry_cv_gcc_amd64_platform_as_ok+:} false; then :
   $as_echo_n "(cached) " >&6
@@ -16481,6 +16531,11 @@ __asm__(
 		"asmfunc:\n\t"
                 ".size asmfunc,.-asmfunc;\n\t"
                 ".type asmfunc,@function;\n\t"
+                /* Test if assembler allows use of '/' for constant division
+                 * (Solaris/x86 issue). If previous constant division check
+                 * and "-Wa,--divide" workaround failed, this causes assembly
+                 * to be disable on this machine. */
+                 "xorl \$(123456789/12345678), %ebp;\n\t"
             );
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
