[master] 458d50d Use pkg-config for curses, if possible
guillaume quintard
gquintard at users.noreply.github.com
Mon Nov 6 14:36:07 UTC 2017
commit 458d50d5c92f576d8701db0861cb261a4b5984b0
Author: Guillaume Quintard <guillaume at varnish-software.com>
Date: Mon Oct 30 15:58:22 2017 +0100
Use pkg-config for curses, if possible
diff --git a/bin/varnishhist/Makefile.am b/bin/varnishhist/Makefile.am
index 9c58a86..9fa07e5 100644
--- a/bin/varnishhist/Makefile.am
+++ b/bin/varnishhist/Makefile.am
@@ -18,4 +18,4 @@ varnishhist_LDADD = \
$(top_builddir)/lib/libvarnishapi/libvarnishapi.la \
-lm \
@SAN_LDFLAGS@ \
- @CURSES_LIB@ ${RT_LIBS} ${PTHREAD_LIBS}
+ @CURSES_LIBS@ ${RT_LIBS} ${PTHREAD_LIBS}
diff --git a/bin/varnishstat/Makefile.am b/bin/varnishstat/Makefile.am
index c13bcd3..129e75f 100644
--- a/bin/varnishstat/Makefile.am
+++ b/bin/varnishstat/Makefile.am
@@ -18,4 +18,4 @@ varnishstat_CFLAGS = \
varnishstat_LDADD = \
$(top_builddir)/lib/libvarnishapi/libvarnishapi.la \
@SAN_LDFLAGS@ \
- @CURSES_LIB@ ${RT_LIBS} ${LIBM} ${PTHREAD_LIBS}
+ @CURSES_LIBS@ ${RT_LIBS} ${LIBM} ${PTHREAD_LIBS}
diff --git a/bin/varnishtop/Makefile.am b/bin/varnishtop/Makefile.am
index d6923c1..d26fd03 100644
--- a/bin/varnishtop/Makefile.am
+++ b/bin/varnishtop/Makefile.am
@@ -17,4 +17,4 @@ varnishtop_CFLAGS = \
varnishtop_LDADD = \
$(top_builddir)/lib/libvarnishapi/libvarnishapi.la \
@SAN_LDFLAGS@ \
- @CURSES_LIB@ ${RT_LIBS} ${LIBM} ${PTHREAD_LIBS}
+ @CURSES_LIBS@ ${RT_LIBS} ${LIBM} ${PTHREAD_LIBS}
diff --git a/configure.ac b/configure.ac
index 9d72283..42ed74a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -82,11 +82,6 @@ _VARNISH_CHECK_LIB(nsl, getaddrinfo)
AC_SUBST(NET_LIBS, "${SOCKET_LIBS} ${NSL_LIBS}")
-AX_WITH_CURSES
-if test "x$ax_cv_curses" != xyes; then
- AC_MSG_ERROR([requires an X/Open-compatible Curses library])
-fi
-
# Userland slab allocator from Solaris, ported to other systems
AC_CHECK_HEADERS([umem.h], [_VARNISH_CHECK_LIB(umem, umem_alloc)])
@@ -187,6 +182,21 @@ AC_CHECK_HEADERS([edit/readline/readline.h],
])
])
+PKG_CHECK_MODULES([CURSES], [ncursesw], [], [
+ PKG_CHECK_MODULES([CURSES], [ncurses], [], [
+ PKG_CHECK_MODULES([CURSES], [curses], [], [
+AX_WITH_CURSES
+if test "x$ax_cv_curses" != xyes; then
+ AC_MSG_ERROR([requires an X/Open-compatible Curses library])
+fi
+CURSES_LIBS="$CURSES_LIB"
+ ])
+ ])
+])
+AC_SUBST([CURSES_LIBS])
+
+AC_CHECK_HEADERS([ncursesw/curses.h ncursesw.h ncurses/curses.h ncurses.h curses.h])
+
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([sys/endian.h])
More information about the varnish-commit
mailing list