mtr_SOURCES += asn.c asn.h
endif
-EXTRA_mtr_SOURCES = curses.c
+if WITH_NCURSES
+mtr_SOURCES += curses.c
+endif
if WITH_GTK
mtr_SOURCES += gtk.c
endif
-mtr_DEPENDENCIES = $(CURSES_OBJ)
-mtr_LDFLAGS = $(CURSES_OBJ)
mtr_INCLUDES = $(GLIB_CFLAGS) -I$(top_builddir) -I$(top_srcdir)
mtr_CFLAGS = $(GTK_CFLAGS) $(NCURSES_CFLAGS)
-mtr_LDADD = $(GTK_LIBS) $(NCURSES_LDADD) $(RESOLV_LIBS)
+mtr_LDADD = $(GTK_LIBS) $(NCURSES_LIBS) $(RESOLV_LIBS)
[AM_SILENT_RULES([yes])],
[AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
-AC_SUBST([CURSES_OBJ])
-CURSES_OBJ=curses.o
-
AC_PROG_CC
# Check pkg-config availability.
sys/xti.h \
])
-# Find ncursses.
-AC_SEARCH_LIBS([initscr],
- [ncurses curses cursesX],
- [],
- [AC_MSG_WARN([Building without curses display support])
- AC_DEFINE([NO_CURSES], [1], [Define if you don't have the curses libraries available.])
- CURSES_OBJ=])
-
-AC_CHECK_LIB([ncurses],
- [use_default_colors],
- [AC_DEFINE([HAVE_USE_DEFAULT_COLORS],
- [1],
- [Define this if your curses library has the use_default_colors() command.])
- ])
-
# Check functions.
AC_CHECK_FUNCS([ \
- attron \
fcntl \
])
])
AM_CONDITIONAL([WITH_GTK], [test "x$with_gtk" = xyes])
+# Find ncurses
+AC_ARG_WITH([ncurses],
+ [AS_HELP_STRING([--without-ncurses], [Build without the ncurses interface])],
+ [], [with_ncurses=yes])
+AS_IF([test "x$with_ncurses" = "xyes"],
+ [PKG_CHECK_MODULES([NCURSES], [ncurses], [
+ AC_DEFINE([HAVE_NCURSES], [1], [Define if ncurses library available])
+ AC_CHECK_LIB([ncurses],
+ [use_default_colors],
+ [AC_DEFINE([HAVE_USE_DEFAULT_COLORS], [1],
+ [Define this if your curses library has the use_default_colors() command.]
+ )
+ ])
+ ],
+ [with_ncurses=no])
+])
+AM_CONDITIONAL([WITH_NCURSES], [test "x$with_ncurses" = xyes])
+
# Enable ipinfo
AC_ARG_WITH([ipinfo],
[AS_HELP_STRING([--without-ipinfo], [Do not try to use ipinfo lookup at all])],
extern int DisplayMode;
-#ifdef NO_CURSES
+#ifdef HAVE_NCURSES
+#include "mtr-curses.h"
+#else
// No support for curses mode, allow the calls to remain in the code.
#define mtr_curses_open()
#define mtr_curses_close()
#define mtr_curses_redraw()
#define mtr_curses_keyaction() 0
#define mtr_curses_clear()
-#else
-#include "mtr-curses.h"
#endif
#ifdef HAVE_GTK
#define asn_close()
#endif
-#ifdef NO_CURSES
-#define DEFAULT_DISPLAY DisplayReport
-#else
+#ifdef HAVE_NCURSES
#define DEFAULT_DISPLAY DisplayCurses
+#else
+#define DEFAULT_DISPLAY DisplayReport
#endif
#ifdef HAVE_GTK
#include "net.h"
#include "split.h"
-#ifdef NO_CURSES
-#include <sys/time.h>
-#include <sys/types.h>
-#include <unistd.h>
-#else
-/* Use the curses variant */
-
-#if defined(HAVE_NCURSES_H)
+#ifdef HAVE_NCURSES
+# if defined(HAVE_NCURSES_H)
# include <ncurses.h>
-#elif defined(HAVE_NCURSES_CURSES_H)
+# elif defined(HAVE_NCURSES_CURSES_H)
# include <ncurses/curses.h>
-#elif defined(HAVE_CURSES_H)
+# elif defined(HAVE_CURSES_H)
# include <curses.h>
-#else
+# else
# error No curses header file available
-#endif
-
+# endif
+#else
+# include <sys/time.h>
+# include <sys/types.h>
+# include <unistd.h>
#endif
int split_keyaction(void)
{
-#ifdef NO_CURSES
+#ifdef HAVE_NCURSES
+ char c = getch();
+#else
fd_set readfds;
struct timeval tv;
char c;
read (0, &c, 1);
} else
return 0;
-#else
- char c = getch();
#endif
#if DEBUG