Add an autoconf check for the curses library.
authorGuus Sliepen <guus@tinc-vpn.org>
Sun, 15 May 2011 10:06:21 +0000 (12:06 +0200)
committerGuus Sliepen <guus@tinc-vpn.org>
Sun, 15 May 2011 10:06:21 +0000 (12:06 +0200)
configure.in
m4/curses.m4 [new file with mode: 0644]

index 7c050139b4ca3ee5db7e7155d15da2489659bf94..ccc0d26c04a6ddef10589c49b9f72e31bc190e5c 100644 (file)
@@ -154,6 +154,7 @@ dnl These are defined in files in m4/
 
 AC_ARG_WITH(libgcrypt, AC_HELP_STRING([--with-libgcrypt], [enable use of libgcrypt instead of OpenSSL])], [])
 
+tinc_CURSES
 tinc_LIBEVENT
 tinc_ZLIB
 tinc_LZO
diff --git a/m4/curses.m4 b/m4/curses.m4
new file mode 100644 (file)
index 0000000..1001f49
--- /dev/null
@@ -0,0 +1,38 @@
+dnl Check to find the curses headers/libraries
+
+AC_DEFUN([tinc_CURSES],
+[
+  AC_ARG_ENABLE([curses],
+    AS_HELP_STRING([--disable-curses], [disable curses support]))
+  AS_IF([test "x$enable_curses" != "xno"], [
+  AC_DEFINE(HAVE_CURSES, 1, [have curses support])
+    AC_ARG_WITH(curses,
+      AS_HELP_STRING([--with-curses=DIR], [curses base directory, or:]),
+      [curses="$withval"
+       CPPFLAGS="$CPPFLAGS -I$withval/include"
+       LDFLAGS="$LDFLAGS -L$withval/lib"]
+    )
+
+    AC_ARG_WITH(curses-include,
+      AS_HELP_STRING([--with-curses-include=DIR], [curses headers directory]),
+      [curses_include="$withval"
+       CPPFLAGS="$CPPFLAGS -I$withval"]
+    )
+
+    AC_ARG_WITH(curses-lib,
+      AS_HELP_STRING([--with-curses-lib=DIR], [curses library directory]),
+      [curses_lib="$withval"
+       LDFLAGS="$LDFLAGS -L$withval"]
+    )
+
+    AC_CHECK_HEADERS(curses.h,
+      [],
+      [AC_MSG_ERROR("curses header files not found."); break]
+    )
+
+    AC_CHECK_LIB(curses, initscr,
+      [LIBS="$LIBS -lcurses"],
+      [AC_MSG_ERROR("curses libraries not found.")]
+    )
+  ])
+])