Skip to contentSkip to conversation

[4989] Fix gnutls autodetection when using a cross-compiler.

Qemu-devel Anthony Liguori 1 participant 1 message Aug 6, 2008

lore
Share & tools
lore
#0 lore raw

Revision: 4989

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4989
Author:   aliguori
Date:     2008-08-06 16:55:50 +0000 (Wed, 06 Aug 2008)

Log Message:
-----------
Fix gnutls autodetection when using a cross-compiler.

It is not enough to check for pkg-config gnutls. You may be using a cross-compiler and have gnutls available on the host but not for the target. This patch changes the detection to try and build an application using gnutls and whatever compiler is available.

Modified Paths:
--------------
trunk/configure

Modified: trunk/configure
===================================================================

configure +12 -5
@@ -737,12 +737,19 @@
 ##########################################
 # VNC TLS detection
 if test "$vnc_tls" = "yes" ; then
-  `pkg-config gnutls` || vnc_tls="no"
+cat > $TMPC <<EOF
+#include <gnutls/gnutls.h>
+int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
+EOF
+    vnc_tls_cflags=`pkg-config --cflags gnutls 2> /dev/null`
+    vnc_tls_libs=`pkg-config --libs gnutls 2> /dev/null`
+    if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_tls_cflags $TMPC \
+           $vnc_tls_libs 2> /dev/null ; then
+	:
+    else
+	vnc_tls="no"
+    fi
 fi
-if test "$vnc_tls" = "yes" ; then
-  vnc_tls_cflags=`pkg-config --cflags gnutls`
-  vnc_tls_libs=`pkg-config --libs gnutls`
-fi
 
 ##########################################
 # vde libraries probe