-
Notifications
You must be signed in to change notification settings - Fork 13
/
config.m4
87 lines (73 loc) · 2.61 KB
/
config.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
dnl
dnl $Id: config.m4 340051 2016-09-18 19:40:29Z ab $
dnl
AC_MSG_CHECKING(whether we should enable wide char support)
AC_ARG_ENABLE(ncursesw,
[ --enable-ncursesw Enable wide char support ],
[
PHP_NCURSESW=$enableval
AC_MSG_RESULT($enableval)
],
[
PHP_NCURSESW=no
AC_MSG_RESULT(no)
])
PHP_ARG_WITH(ncurses, for ncurses support,
[ --with-ncurses[=DIR] Include ncurses support (CLI/CGI only)])
if test "$PHP_NCURSES" != "no"; then
if test "$PHP_NCURSESW" != "no"; then
ncurses_name=ncursesw
panel_name=panelw
else
ncurses_name=ncurses
panel_name=panel
fi
SEARCH_PATH="$PHP_NCURSES /usr/local /usr"
for dir in $SEARCH_PATH; do
for subdir in include/$ncurses_name include; do
if test -d $dir/$subdir; then
if test -r $dir/$subdir/ncurses.h; then
NCURSES_DIR=$dir
NCURSES_INCDIR=$dir/$subdir
AC_DEFINE(HAVE_NCURSES_H,1,[ ])
break 2
elif test -r $dir/$subdir/curses.h; then
NCURSES_DIR=$dir
NCURSES_INCDIR=$dir/$subdir
break 2
fi
fi
done
done
if test -z "$NCURSES_DIR"; then
AC_MSG_RESULT(not found)
AC_MSG_ERROR(Please reinstall the $ncurses_name distribution)
fi
# --with-ncurses -> add include path
PHP_ADD_INCLUDE($NCURSES_INCDIR)
# --with-ncurses -> check for lib and symbol presence
LIBNAME=$ncurses_name
LIBSYMBOL=initscr
PHP_CHECK_LIBRARY($LIBNAME, $LIBSYMBOL, [
AC_DEFINE(HAVE_NCURSESLIB,1,[ ])
PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $NCURSES_DIR/$PHP_LIBDIR, NCURSES_SHARED_LIBADD)
PHP_CHECK_LIBRARY($panel_name, new_panel, [
AC_DEFINE(HAVE_NCURSES_PANEL,1,[ ])
PHP_ADD_LIBRARY_WITH_PATH($panel_name, $NCURSES_DIR/$PHP_LIBDIR, NCURSES_SHARED_LIBADD)
], [], [
-L$NCURSES_DIR/$PHP_LIBDIR -l$LIBNAME -lm
])
], [
AC_MSG_ERROR(Wrong ncurses lib version or lib not found)
], [
-L$NCURSES_DIR/$PHP_LIBDIR -lm
])
AC_CHECK_LIB($LIBNAME, color_set, [AC_DEFINE(HAVE_NCURSES_COLOR_SET, 1, [ ])])
AC_CHECK_LIB($LIBNAME, slk_color, [AC_DEFINE(HAVE_NCURSES_SLK_COLOR, 1, [ ])])
AC_CHECK_LIB($LIBNAME, slk_attr, [AC_DEFINE(HAVE_NCURSES_SLK_ATTR, 1, [ ])])
AC_CHECK_LIB($LIBNAME, assume_default_colors, [AC_DEFINE(HAVE_NCURSES_ASSUME_DEFAULT_COLORS, 1, [ ])])
AC_CHECK_LIB($LIBNAME, use_extended_names, [AC_DEFINE(HAVE_NCURSES_USE_EXTENDED_NAMES, 1, [ ])])
AC_CHECK_LIB($LIBNAME, define_key, [AC_DEFINE(HAVE_NCURSES_DEFINE_KEY, 1, [ ])])
PHP_NEW_EXTENSION(ncurses, ncurses.c ncurses_fe.c ncurses_functions.c, $ext_shared, cli)
PHP_SUBST(NCURSES_SHARED_LIBADD)
fi