configuration script improved to link with ncursesw if ncurses is not found

This commit is contained in:
Frederic Culot 2009-01-23 21:08:31 +00:00
parent d8861f877e
commit 08aaf496fc
2 changed files with 27 additions and 9 deletions

View File

@ -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> 2009-01-22 Frederic Culot <frederic@culot.org>
* src/notify.c (notify_stop_main_thread): avoid a possible * src/notify.c (notify_stop_main_thread): avoid a possible

View File

@ -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 # 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 # Checks for system libs
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
AC_CHECK_HEADERS([ncurses.h], [ AC_CHECK_FUNC(initscr,,
AC_CHECK_LIB(ncurses, initscr, [ [
LIBS="$LIBS -lncurses" available_ncurses="none"
AC_DEFINE(HAVE_LIBNCURSES, 1, for lib in ncursesw ncurses
[Define to 1 if you have the 'ncurses' library (-lncurses).]) do
], AC_CHECK_LIB($lib, initscr,
AC_MSG_ERROR(The ncurses library is required in order to build calcurse!)) [available_ncurses="$lib"; break])
], AC_MSG_ERROR(The ncurses header is required in order to build calcurse!)) 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_HEADERS([pthread.h], [
AC_CHECK_LIB(pthread, pthread_create, [ AC_CHECK_LIB(pthread, pthread_create, [