aboutsummaryrefslogtreecommitdiffstats
path: root/tools/m4
diff options
context:
space:
mode:
authorRoger Pau Monne <roger.pau@entel.upc.edu>2012-03-13 15:23:35 +0000
committerRoger Pau Monne <roger.pau@entel.upc.edu>2012-03-13 15:23:35 +0000
commit65da4913214120ddc95bd846cb3649a29f87146a (patch)
tree0184962f72ff86a39430e6a0958ee15fcbcfb977 /tools/m4
parent77b8dfec88acdc71138e3af7e2603ad8d72eb926 (diff)
downloadxen-65da4913214120ddc95bd846cb3649a29f87146a.tar.gz
xen-65da4913214120ddc95bd846cb3649a29f87146a.tar.bz2
xen-65da4913214120ddc95bd846cb3649a29f87146a.zip
autoconf: add check for curses library
Check for a curses compatible library (curses or ncurses basically). One of those is needed to compile Xen tools (gtraceview and xentop). Modify Makefiles/sources to use configure output (fetch CURSES_LIBS from tools/Tools.mk and header to include from tools/config.h) Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Diffstat (limited to 'tools/m4')
-rw-r--r--tools/m4/curses.m420
1 files changed, 20 insertions, 0 deletions
diff --git a/tools/m4/curses.m4 b/tools/m4/curses.m4
new file mode 100644
index 0000000000..c1e483f80d
--- /dev/null
+++ b/tools/m4/curses.m4
@@ -0,0 +1,20 @@
+AC_DEFUN([AX_CHECK_CURSES], [
+AC_CHECK_HEADER([curses.h], [
+ AC_CHECK_LIB([curses], [clear], [curses="y"], [curses="n"])
+], [curses="n"])
+AC_CHECK_HEADER([ncurses.h], [
+ AC_CHECK_LIB([ncurses], [clear], [ncurses="y"], [ncurses="n"])
+], [ncurses="n"])
+AS_IF([test "$curses" = "n" && test "$ncurses" = "n"], [
+ AC_MSG_ERROR([Unable to find a suitable curses library])
+])
+# Prefer ncurses over curses if both are present
+AS_IF([test "$ncurses" = "y"], [
+ CURSES_LIBS="-lncurses"
+ AC_DEFINE([INCLUDE_CURSES_H], [<ncurses.h>], [Define curses header to use])
+], [
+ CURSES_LIBS="-lcurses"
+ AC_DEFINE([INCLUDE_CURSES_H], [<curses.h>], [Define curses header to use])
+])
+AC_SUBST(CURSES_LIBS)
+])