summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 564bf1c)
raw | patch | inline | side by side (parent: 564bf1c)
author | Florian Forster <ff@octo.it> | |
Fri, 10 Jan 2014 11:28:02 +0000 (12:28 +0100) | ||
committer | Florian Forster <ff@octo.it> | |
Fri, 10 Jan 2014 11:28:02 +0000 (12:28 +0100) |
configure.ac | patch | blob | history | |
src/Makefile.am | patch | blob | history | |
src/oping.c | patch | blob | history |
diff --git a/configure.ac b/configure.ac
index 6eb4b4b9aa4b8af98abe7a53875855e7ef36ce2a..f9be869823222ccc4ea30ccdb8dadd37c502e345 100644 (file)
--- a/configure.ac
+++ b/configure.ac
AC_MSG_ERROR(cannot find nanosleep)))
AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$nanosleep_needs_rt" = "xyes")
-with_ncurses="yes"
-AC_CHECK_HEADERS(ncursesw/ncurses.h, [with_ncurses="yes"], [with_ncurses="no"])
+with_ncurses="no"
+AC_CHECK_HEADERS(ncursesw/ncurses.h ncurses.h, [with_ncurses="yes"], [])
if test "x$with_ncurses" = "xyes"
then
- AC_CHECK_LIB(ncursesw, mvwprintw, [with_ncurses="yes"], [with_ncurses="no"])
+ have_ncursesw="no"
+ have_ncurses="no"
+ NCURSES_LIB=""
+
+ AC_CHECK_LIB(ncursesw, mvwprintw, [have_ncursesw="yes"], [have_ncursesw="no"])
+ AC_CHECK_LIB(ncurses, mvwprintw, [have_ncurses="yes"], [have_ncurses="no"])
+
+ if test "x$have_ncursesw" = "xyes"; then
+ NCURSES_LIB="-lncursesw"
+ else if test "x$have_ncurses" = "xyes"; then
+ NCURSES_LIB="-lncurses"
+ else
+ with_ncurses="no"
+ fi; fi
+ AC_SUBST(NCURSES_LIB)
fi
AM_CONDITIONAL(BUILD_WITH_LIBNCURSES, test "x$with_ncurses" = "xyes")
diff --git a/src/Makefile.am b/src/Makefile.am
index c26688395091ba84e99ed3e8cccd67b401505b4c..844e0a4d0eefe569c6cacca3fb3ee4be248d4026 100644 (file)
--- a/src/Makefile.am
+++ b/src/Makefile.am
noping_SOURCES = oping.c
noping_CPPFLAGS = $(AM_CPPFLAGS) -DUSE_NCURSES=1
-noping_LDADD = liboping.la -lm -lncursesw
+noping_LDADD = liboping.la -lm $(NCURSES_LIB)
if BUILD_WITH_LIBRT
noping_LDADD += -lrt
endif
diff --git a/src/oping.c b/src/oping.c
index a19c42064b3a22758263cfa3ba2724db48507d0c..4a605534e7e608694d475443ca615328c42b5156 100644 (file)
--- a/src/oping.c
+++ b/src/oping.c
# define NCURSES_OPAQUE 1
/* http://newsgroups.derkeiler.com/Archive/Rec/rec.games.roguelike.development/2010-09/msg00050.html */
# define _X_OPEN_SOURCE_EXTENDED
-# include <ncursesw/ncurses.h>
+
+# if HAVE_NCURSESW_NCURSES_H
+# include <ncursesw/ncurses.h>
+# elif HAVE_NCURSES_H
+# include <ncurses.h>
+# endif
# define OPING_GREEN 1
# define OPING_YELLOW 2
#if USE_NCURSES
static _Bool has_utf8() /* {{{ */
{
+# if HAVE_NCURSESW_NCURSES_H
if (!opt_utf8)
{
/* Automatically determine */
opt_utf8 = 1;
}
return ((_Bool) (opt_utf8 - 1));
+# else
+ return (0);
+# endif
} /* }}} _Bool has_utf8 */
static int update_prettyping_graph (ping_context_t *ctx, /* {{{ */