summaryrefslogtreecommitdiff
blob: 76ef052a4a2d54965c26c4f7e1a2d6a2c1ae485a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -2,7 +2,12 @@
 
 bin_PROGRAMS = pinger
 man_MANS = pinger.1
+if HAVE_GTK_2
 bin_SCRIPTS = gtkpinger
+endif
+if HAVE_GTK_3
+bin_SCRIPTS = gtkpinger
+endif
 
   P_SOURCES = timefunc.c parse.c ping.c pinger.c dns.c log.c timefunc.h parse.h ping.h globals.h fake_gtk.h dns.h log.h
 if HAVE_CURSES
--- a/configure.in
+++ b/configure.in
@@ -54,34 +54,46 @@
 AC_HEADER_TIME
 AM_INADDRT
 
+PKG_PROG_PKG_CONFIG()
+
 dnl GTK3/GTK2 tests
 dnl Note: PKG_CHECK_MODULES cannot be used conditionaly due to sharing the tests and depending on it
 AC_ARG_ENABLE([gtk], AS_HELP_STRING([--enable-gtk[[[=version]]]], [Build with GTK+ interface. Supported versions are gtk2 and gtk3. Default is gtk2.]))
-PKG_CHECK_MODULES(GTK, [ gtk+-2.0 >= 2.4 ], HAVE_GTK_2=1; )
-AC_SUBST(GTK_CFLAGS)
-AC_SUBST(GTK_LIBS)
-PKG_CHECK_MODULES(GTK3, [ gtk+-3.0 >= 3.12 ], HAVE_GTK_3=1)
-AC_SUBST(GTK3_CFLAGS)
-AC_SUBST(GTK3_LIBS)
 
 if test "x$enableval" = "x" || test "x$enableval" = "xgtk2"; then
+PKG_CHECK_MODULES(GTK, [ gtk+-2.0 >= 2.4 ], HAVE_GTK_2=1,[])
+AC_SUBST(GTK_CFLAGS)
+AC_SUBST(GTK_LIBS)
 CFLAGS="$CFLAGS $GTK_CFLAGS"
 LIBS="$LIBS $GTK_LIBS"
 HAVE_GTK_3=0
 AC_DEFINE(HAVE_GTK_2, 1, Found GTK+ 2.x support)
 elif test "x$enableval" = "xgtk3"; then
+PKG_CHECK_MODULES(GTK3, [ gtk+-3.0 >= 3.12 ], HAVE_GTK_3=1,[])
+AC_SUBST(GTK3_CFLAGS)
+AC_SUBST(GTK3_LIBS)
 CFLAGS="$CFLAGS $GTK3_CFLAGS"
 LIBS="$LIBS $GTK3_LIBS"
 HAVE_GTK_2=0
 AC_DEFINE(HAVE_GTK_3, 1, Found GTK+ 3.x support)
 else
-echo "Sorry, the value $enableval is not supported as argument of --enable-gtk."
-exit 1
+HAVE_GTK_2=0
+HAVE_GTK_3=0
 fi
 
-dnl Check for additional external libraries etc..
+AC_ARG_ENABLE(ncurses, [  --enable-ncurses        enable ncurses support],
+	[if test "$enableval" = no; then no_ncurses=yes; fi])
+if test x$no_ncurses != xyes; then
+PKG_CHECK_MODULES(ncurses, ncurses,[
+	AC_DEFINE([HAVE_LIBNCURSES], [1], found ncurses library)
+	HAVE_CURSES=1
+	LIBS="$LIBS $ncurses_LIBS"
+	CFLAGS="$CFLAGS $ncurses_CFLAGS"],
 AC_CHECK_LIB(ncurses, initscr, HAVE_CURSES=1; LIBS="$LIBS -lncurses";
 	AC_DEFINE([HAVE_LIBNCURSES], [1], found ncurses library))
+	)
+fi
+dnl Check for additional external libraries etc..
 AC_CHECK_LIB(intl, libintl_gettext, LIBS="$LIBS -lintl")
 AC_CHECK_LIB(pthread, pthread_create, LIBS="$LIBS -lpthread", AC_MSG_ERROR(Pthread required and not found. Please check if you have libpthread in your system and specify using CFLAGS and LDFLAGS when configure))