mtr_SOURCES += asn.c asn.h
endif
-EXTRA_mtr_SOURCES = curses.c \
- gtk.c
+EXTRA_mtr_SOURCES = curses.c
+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_DEPENDENCIES = $(GTK_OBJ) $(CURSES_OBJ)
-mtr_LDFLAGS = $(GTK_OBJ) $(CURSES_OBJ)
-mtr_LDADD = $(GLIB_LIBS) $(RESOLV_LIBS)
+mtr_CFLAGS = $(GTK_CFLAGS) $(NCURSES_CFLAGS)
+mtr_LDADD = $(GTK_LIBS) $(NCURSES_LDADD) $(RESOLV_LIBS)
[AM_SILENT_RULES([yes])],
[AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
-AC_SUBST([GTK_OBJ])
AC_SUBST([CURSES_OBJ])
-
-GTK_OBJ=gtk.o
CURSES_OBJ=curses.o
AC_PROG_CC
# Find GTK
AC_ARG_WITH([gtk],
- [AS_HELP_STRING([--without-gtk], [Do not try to use GTK+ at all])],
+ [AS_HELP_STRING([--without-gtk], [Build without the GTK+2.0 interface])],
[], [with_gtk=yes])
-AS_IF([test "x$with_gtk" = "xyes"], [WANTS_GTK=yes], [WANTS_GTK=no])
-
-m4_ifndef([AM_PATH_GTK_2_0],
- [m4_defun([AM_PATH_GTK_2_0], [
- AC_MSG_ERROR([dnl
-Could not locate the gtk2 automake macros, these are usually located in
- .../share/aclocal/gtk-2.0.m4
-Before running bootstrap try setting the environment variable
- ACLOCAL_PATH="/own/dir"
-or configure --without-gtk.])
- ])
-])
-
-AS_IF([test "x$WANTS_GTK" = "xyes"], [
- AM_PATH_GTK_2_0([2.6.0], [
- CFLAGS="$CFLAGS $GTK_CFLAGS"
- LIBS="$LIBS $GTK_LIBS -lm"
- ], [
- AC_MSG_WARN([Building without GTK2 display support])
- AC_DEFINE([NO_GTK], [1], [Define if you don't have the GTK+ libraries available.])
- GTK_OBJ=""
- ])
-], [
- AC_DEFINE([NO_GTK], [1], [Define if you don't have the GTK+ libraries available.])
- GTK_OBJ=""
+AS_IF([test "x$with_gtk" = "xyes"],
+ [PKG_CHECK_MODULES([GTK], [gtk+-2.0],
+ [AC_DEFINE([HAVE_GTK], [1], [Define if gtk+-2.0 library available])],
+ [with_gtk=no])
])
+AM_CONDITIONAL([WITH_GTK], [test "x$with_gtk" = xyes])
# Enable ipinfo
AC_ARG_WITH([ipinfo],
#include "mtr-curses.h"
#endif
-#ifdef NO_GTK
+#ifdef HAVE_GTK
+#include "mtr-gtk.h"
+#else
// No support for gtk mode, allow the calls to remain in the code.
#define gtk_open()
#define gtk_close()
#define gtk_redraw()
#define gtk_keyaction() 0
#define gtk_loop() {fprintf (stderr, "No GTK support. Sorry.\n"); exit(EXIT_FAILURE); }
-#else
-#include "mtr-gtk.h"
#endif
#ifdef NO_SPLIT
#define DEFAULT_DISPLAY DisplayCurses
#endif
-#ifdef NO_GTK
-#define UNUSED_IF_NO_GTK UNUSED
-#else
+#ifdef HAVE_GTK
#define UNUSED_IF_NO_GTK
+#else
+#define UNUSED_IF_NO_GTK UNUSED
#endif
void display_detect(int *argc UNUSED_IF_NO_GTK, char ***argv UNUSED_IF_NO_GTK)
{
DisplayMode = DEFAULT_DISPLAY;
-#ifndef NO_GTK
+#ifdef HAVE_GTK
if(gtk_detect(argc, argv)) {
DisplayMode = DisplayGTK;
}