Luis Lavena wrote:
> Wouldn't be better if X11 presence is detected at configure time and
> x11 example excluded from compilation if not possible to build it?

The attached patch works for me when cross-compiling for MinGW, in
that it excludes the x11 example. Try it out. Comments welcome.


//Peter
>From 4774d500e724bc4e548f743a0cb644ab05599474 Mon Sep 17 00:00:00 2001
From: Peter Stuge <pe...@stuge.se>
Date: Mon, 13 Feb 2012 00:34:27 +0100
Subject: [PATCH] example/x11: Build only when sys/un.h is found by configure

The example can't be built on systems without AF_UNIX sockets.
---
 configure.ac        |    3 ++-
 example/Makefile.am |    6 +++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 5f94099..6ab89e8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -220,7 +220,8 @@ AC_HELP_STRING([--disable-hidden-symbols],[Leave all 
symbols with default visibi
 AC_CHECK_HEADERS([errno.h fcntl.h stdio.h stdlib.h unistd.h sys/uio.h])
 AC_CHECK_HEADERS([sys/select.h sys/socket.h sys/ioctl.h sys/time.h])
 AC_CHECK_HEADERS([arpa/inet.h netinet/in.h])
-AC_CHECK_HEADERS([sys/un.h])
+AC_CHECK_HEADERS([sys/un.h], [have_sys_un_h=yes], [have_sys_un_h=no])
+AM_CONDITIONAL([HAVE_SYS_UN_H], test "x$have_sys_un_h" = xyes)
 
 case $host in
   *-*-cygwin* | *-*-cegcc*)
diff --git a/example/Makefile.am b/example/Makefile.am
index 26cbf8a..8c6636f 100644
--- a/example/Makefile.am
+++ b/example/Makefile.am
@@ -7,7 +7,11 @@ noinst_PROGRAMS = direct_tcpip ssh2 scp scp_nonblock scp_write 
        \
  scp_write_nonblock sftp sftp_nonblock sftp_write sftp_write_nonblock  \
  sftp_mkdir sftp_mkdir_nonblock sftp_RW_nonblock sftp_write_sliding    \
  sftpdir sftpdir_nonblock ssh2_exec ssh2_agent ssh2_echo sftp_append   \
- subsystem_netconf tcpip-forward x11
+ subsystem_netconf tcpip-forward
+
+if HAVE_SYS_UN_H
+noinst_PROGRAMS += x11
+endif
 
 AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/example
 LDADD = $(top_builddir)/src/libssh2.la
-- 
1.7.4.1.343.ga91df.dirty

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

Reply via email to