From c48692f5d95d3be27fe47dfc3e2274e6d50c9464 Mon Sep 17 00:00:00 2001
From: Gerardo Di Iorio <arete74@gmail.com>
Date: Wed, 19 May 2010 19:25:56 +0200
Subject: [PATCH] libgcrypt fix build for cross compiling

Signed-off-by: Gerardo Di Iorio <arete74@gmail.com>
---
 .../libgcrypt-00-ac_cv_sys_symbol_underscore.patch |   27 ++++++++++++++++++++
 .../libgcrypt/libgcrypt-01-reconfigure.patch       |   27 ++++++++++++++++++++
 package/security/libgcrypt/libgcrypt.conf          |    1 +
 3 files changed, 55 insertions(+), 0 deletions(-)
 create mode 100755 package/security/libgcrypt/libgcrypt-00-ac_cv_sys_symbol_underscore.patch
 create mode 100755 package/security/libgcrypt/libgcrypt-01-reconfigure.patch

diff --git a/package/security/libgcrypt/libgcrypt-00-ac_cv_sys_symbol_underscore.patch b/package/security/libgcrypt/libgcrypt-00-ac_cv_sys_symbol_underscore.patch
new file mode 100755
index 0000000..95db0fb
--- /dev/null
+++ b/package/security/libgcrypt/libgcrypt-00-ac_cv_sys_symbol_underscore.patch
@@ -0,0 +1,27 @@
+diff --git a/acinclude.m4 b/acinclude.m4
+index a7bc0fa..1a5bffc 100644
+--- a/acinclude.m4
++++ b/acinclude.m4
+@@ -76,13 +76,14 @@ case "${host}" in
+     i386-emx-os2 | i[3456]86-pc-os2*emx | i386-pc-msdosdjgpp)
+         ac_cv_sys_symbol_underscore=yes
+         ;;
+-    *)
+-      if test "$cross_compiling" = yes; then
+-        if test "x$ac_cv_sys_symbol_underscore" = x ; then
+-           ac_cv_sys_symbol_underscore=yes
+-        fi
+-      else
+-         tmp_do_check="yes"
++    *) if test -z "$ac_cv_sys_symbol_underscore"; then
++         if test "$cross_compiling" = yes; then
++           if test "x$ac_cv_sys_symbol_underscore" = x ; then
++              ac_cv_sys_symbol_underscore=yes
++           fi
++         else
++            tmp_do_check="yes"
++         fi
+       fi
+        ;;
+ esac
+ 
diff --git a/package/security/libgcrypt/libgcrypt-01-reconfigure.patch b/package/security/libgcrypt/libgcrypt-01-reconfigure.patch
new file mode 100755
index 0000000..87d29a2
--- /dev/null
+++ b/package/security/libgcrypt/libgcrypt-01-reconfigure.patch
@@ -0,0 +1,27 @@
+diff --git a/configure b/configure
+index 70a6d50..8f55d95 100755
+--- a/configure
++++ b/configure
+@@ -22306,14 +22306,15 @@ case "${host}" in
+     i386-emx-os2 | i345686-pc-os2*emx | i386-pc-msdosdjgpp)
+         ac_cv_sys_symbol_underscore=yes
+         ;;
+-    *)
+-      if test "$cross_compiling" = yes; then
+-        if test "x$ac_cv_sys_symbol_underscore" = x ; then
+-           ac_cv_sys_symbol_underscore=yes
++    *)if test -z "$ac_cv_sys_symbol_underscore";then
++        if test "$cross_compiling" = yes; then
++            if test "x$ac_cv_sys_symbol_underscore" = x ; then
++                ac_cv_sys_symbol_underscore=yes
++            fi
++        else
++            tmp_do_check="yes"
++        fi
+         fi
+-      else
+-         tmp_do_check="yes"
+-      fi
+        ;;
+ esac
+ if test "$tmp_do_check" = "yes"; then
diff --git a/package/security/libgcrypt/libgcrypt.conf b/package/security/libgcrypt/libgcrypt.conf
index 52ad0d1..63a1945 100644
--- a/package/security/libgcrypt/libgcrypt.conf
+++ b/package/security/libgcrypt/libgcrypt.conf
@@ -15,4 +15,5 @@
 
 if ! atstage native; then
 	var_append extraconfopt ' ' "--with-gpg-error-prefix=$root/`pkgprefix libgpg-error`"
+	hook_add preconf 5 "echo 'ac_cv_sys_symbol_underscore=no' >> ./config.cache"
 fi
-- 
1.6.5.5

