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