ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/libstatgrab/acinclude.m4
Revision: 1.3
Committed: Sat Jan 6 01:01:36 2007 UTC (17 years, 9 months ago) by tdb
Branch: MAIN
CVS Tags: LIBSTATGRAB_0_17, LIBSTATGRAB_0_16, LIBSTATGRAB_0_15, LIBSTATGRAB_0_14, HEAD
Changes since 1.2: +2 -4 lines
Log Message:
Fix bug in curses detection - LIBS was not properly reset.
Also remove to redundant variable declarations.

File Contents

# User Rev Content
1 tdb 1.1 dnl Available from the GNU Autoconf Macro Archive at:
2     dnl http://www.gnu.org/software/ac-archive/htmldoc/mp_with_curses.html
3     dnl (Hacked by tdb for libstatgrab)
4 tdb 1.3 dnl $Id: acinclude.m4,v 1.2 2006/12/01 14:21:16 tdb Exp $
5 tdb 1.1 AC_DEFINE([HAVE_CURSES_H], [], [Define to 1 if you have the <curses.h> header file.])
6     AC_DEFINE([HAVE_NCURSES_H], [], [Define to 1 if you have the <ncurses.h> header file.])
7 tdb 1.2 AC_DEFINE([CURSES_HEADER_FILE], [], [Set to the location of the curses header file.])
8 tdb 1.1 AC_DEFUN([MP_WITH_CURSES],
9 tdb 1.2 [AC_ARG_WITH(ncurses, [ --without-ncurses Do not use ncurses],,)
10    
11 tdb 1.1 mp_save_LIBS="$LIBS"
12     mp_save_CPPFLAGS="$CPPFLAGS"
13     CURSES_LIB=""
14 tdb 1.2
15     if test "$with_ncurses" != no
16     then
17     AC_CACHE_CHECK([for working ncurses - ncurses.h], mp_cv_ncurses1,
18     [LIBS="$mp_save_LIBS $SAIDARLIBS -lncurses"
19     CPPFLAGS="$mp_save_CPPFLAGS $SAIDARCPPFLAGS"
20     AC_TRY_LINK(
21     [#include <ncurses.h>],
22     [chtype a; int b=A_STANDOUT, c=KEY_LEFT; initscr(); ],
23     mp_cv_ncurses1=yes, mp_cv_ncurses1=no)])
24     if test "$mp_cv_ncurses1" = yes
25     then
26     AC_DEFINE([HAVE_NCURSES_H])
27     AC_DEFINE([CURSES_HEADER_FILE], [<ncurses.h>])
28     CURSES_LIB="-lncurses"
29     else
30     AC_CACHE_CHECK([for working ncurses - ncurses/ncurses.h], mp_cv_ncurses2,
31     [LIBS="$mp_save_LIBS $SAIDARLIBS -lncurses"
32     CPPFLAGS="$mp_save_CPPFLAGS $SAIDARCPPFLAGS"
33     AC_TRY_LINK(
34     [#include <ncurses/ncurses.h>],
35     [chtype a; int b=A_STANDOUT, c=KEY_LEFT; initscr(); ],
36     mp_cv_ncurses2=yes, mp_cv_ncurses2=no)])
37     if test "$mp_cv_ncurses2" = yes
38     then
39     AC_DEFINE([HAVE_NCURSES_H])
40     AC_DEFINE([CURSES_HEADER_FILE], [<ncurses/ncurses.h>])
41     CURSES_LIB="-lncurses"
42     fi
43     fi
44     fi
45    
46     if test ! "$CURSES_LIB"
47 tdb 1.1 then
48     AC_CACHE_CHECK([for working curses], mp_cv_curses,
49 tdb 1.3 [LIBS="$mp_save_LIBS $SAIDARLIBS -lcurses"
50 tdb 1.2 CPPFLAGS="$mp_save_CPPFLAGS $SAIDARCPPFLAGS"
51 tdb 1.1 AC_TRY_LINK(
52     [#include <curses.h>],
53     [chtype a; int b=A_STANDOUT, c=KEY_LEFT; initscr(); ],
54     mp_cv_curses=yes, mp_cv_curses=no)])
55     if test "$mp_cv_curses" = yes
56     then
57 tdb 1.2 AC_DEFINE([HAVE_CURSES_H])
58     AC_DEFINE([CURSES_HEADER_FILE], [<curses.h>])
59 tdb 1.1 CURSES_LIB="-lcurses"
60     fi
61     fi
62 tdb 1.2
63 tdb 1.1 if test ! "$CURSES_LIB"
64     then
65 tdb 1.2 AC_MSG_WARN([Unable to find curses or ncurses; disabling saidar])
66     AM_CONDITIONAL(SAIDAR, false)
67 tdb 1.1 fi
68 tdb 1.2
69 tdb 1.1 SAIDARLIBS="$SAIDARLIBS $CURSES_LIB"
70     LIBS="$mp_save_LIBS"
71     CPPFLAGS="$mp_save_CPPFLAGS"
72     ])dnl