summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederic Culot <calcurse@culot.org>2009-01-23 21:08:31 +0000
committerFrederic Culot <calcurse@culot.org>2009-01-23 21:08:31 +0000
commit08aaf496fce35c4335dab19a4426442153592840 (patch)
treeb9b60d5e084f21b4ed011113d6087af77945044f
parentd8861f877ec1e52ff03781fa2246e7343a9387ae (diff)
downloadcalcurse-08aaf496fce35c4335dab19a4426442153592840.zip
configuration script improved to link with ncursesw if ncurses is not found
-rwxr-xr-xChangeLog5
-rwxr-xr-xconfigure.ac31
2 files changed, 27 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index 62a04af..ef9c1da 100755
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-01-23 Frederic Culot <frederic@culot.org>
+
+ * configure.ac: improve configuration script to be able to link
+ with ncursesw if ncurses is not available
+
2009-01-22 Frederic Culot <frederic@culot.org>
* src/notify.c (notify_stop_main_thread): avoid a possible
diff --git a/configure.ac b/configure.ac
index 815a993..1da0051 100755
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
-# $calcurse: configure.ac,v 1.29 2009/01/22 18:11:56 culot Exp $
+# $calcurse: configure.ac,v 1.30 2009/01/23 21:08:31 culot Exp $
#-------------------------------------------------------------------------------
# Init
@@ -27,14 +27,27 @@ AC_CHECK_HEADERS([ctype.h getopt.h locale.h math.h signal.h stdbool.h stdio.h \
#-------------------------------------------------------------------------------
# Checks for system libs
#-------------------------------------------------------------------------------
-AC_CHECK_HEADERS([ncurses.h], [
- AC_CHECK_LIB(ncurses, initscr, [
- LIBS="$LIBS -lncurses"
- AC_DEFINE(HAVE_LIBNCURSES, 1,
- [Define to 1 if you have the 'ncurses' library (-lncurses).])
- ],
- AC_MSG_ERROR(The ncurses library is required in order to build calcurse!))
-], AC_MSG_ERROR(The ncurses header is required in order to build calcurse!))
+AC_CHECK_FUNC(initscr,,
+[
+ available_ncurses="none"
+ for lib in ncursesw ncurses
+ do
+ AC_CHECK_LIB($lib, initscr,
+ [available_ncurses="$lib"; break])
+ done
+ if test "$available_ncurses" = none; then
+ AC_MSG_ERROR(Either ncurses or ncursesw library is required to build calcurse!)
+ elif test "$available_ncurses" = ncursesw; then
+ AC_CHECK_HEADERS([ncursesw/ncurses.h],,
+ [AC_CHECK_HEADERS([ncurses.h],,
+ AC_MSG_ERROR([Missing ncursesw header file]))])
+ else
+ AC_CHECK_HEADERS([ncurses/ncurses.h],,
+ [AC_CHECK_HEADERS([ncurses.h],,
+ AC_MSG_ERROR([Missing ncurses header file]))])
+ fi
+ LIBS="$LIBS -l$available_ncurses"
+])
AC_CHECK_HEADERS([pthread.h], [
AC_CHECK_LIB(pthread, pthread_create, [