From 7944cce19e4de4207a4ef20569155118acebd406 Mon Sep 17 00:00:00 2001
From: Guus Sliepen <guus@tinc-vpn.org>
Date: Sat, 25 Jun 2011 00:06:06 +0200
Subject: [PATCH] Don't use AM_CONDITIONAL for CURSES.

For some reason, this doesn't work when cross-compiling for Windows.
---
 m4/curses.m4    | 1 -
 src/Makefile.am | 7 ++-----
 src/top.c       | 4 ++++
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/m4/curses.m4 b/m4/curses.m4
index 408ae282..50a90a5a 100644
--- a/m4/curses.m4
+++ b/m4/curses.m4
@@ -38,5 +38,4 @@ AC_DEFUN([tinc_CURSES],
   ])
 
   AC_SUBST(CURSES_LIBS)
-  AM_CONDITIONAL(CURSES, test "$curses" = true)
 ])
diff --git a/src/Makefile.am b/src/Makefile.am
index 60709fb7..4f7c3c88 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -12,16 +12,13 @@ tincd_SOURCES = \
 
 tincctl_SOURCES = \
 	utils.c getopt.c getopt1.c dropin.c \
-	list.c tincctl.c rsagen.c
+	list.c tincctl.c rsagen.c top.c
 
 if TUNEMU
 tincd_SOURCES += bsd/tunemu.c
 endif
 
-if CURSES
-tincctl_SOURCES += top.c
 tincctl_LDADD = $(CURSES_LIBS)
-endif
 
 nodist_tincd_SOURCES = device.c
 
@@ -32,7 +29,7 @@ INCLUDES = @INCLUDES@ -I$(top_builddir)
 noinst_HEADERS = \
 	xalloc.h utils.h getopt.h list.h splay_tree.h dropin.h fake-getaddrinfo.h fake-getnameinfo.h fake-gai-errnos.h ipv6.h ipv4.h ethernet.h \
 	buffer.h cipher.h conf.h connection.h control.h control_common.h crypto.h device.h digest.h edge.h graph.h logger.h meta.h net.h netutl.h node.h process.h \
-	protocol.h route.h rsa.h rsagen.h subnet.h bsd/tunemu.h
+	protocol.h route.h rsa.h rsagen.h subnet.h top.h bsd/tunemu.h
 
 LIBS = @LIBS@ @LIBGCRYPT_LIBS@
 
diff --git a/src/top.c b/src/top.c
index b71bcb85..a457e080 100644
--- a/src/top.c
+++ b/src/top.c
@@ -19,6 +19,8 @@
 
 #include "system.h"
 
+#ifdef HAVE_CURSES
+
 #include <curses.h>
 
 #include "control_common.h"
@@ -310,3 +312,5 @@ void top(int fd) {
 
 	endwin();
 }
+
+#endif
-- 
2.39.5