forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.m4
124 lines (103 loc) · 3.18 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
dnl
dnl $Id$
dnl
PHP_ARG_WITH(libedit,for libedit readline replacement,
[ --with-libedit[=DIR] Include libedit readline replacement (CLI/CGI only)])
if test "$PHP_LIBEDIT" = "no"; then
PHP_ARG_WITH(readline,for readline support,
[ --with-readline[=DIR] Include readline support (CLI/CGI only)])
else
dnl "register" the --with-readline option to preven invalid "unknown configure option" warning
php_with_readline=no
fi
if test "$PHP_READLINE" && test "$PHP_READLINE" != "no"; then
for i in $PHP_READLINE /usr/local /usr; do
test -f $i/include/readline/readline.h && READLINE_DIR=$i && break
done
if test -z "$READLINE_DIR"; then
AC_MSG_ERROR(Please reinstall readline - I cannot find readline.h)
fi
PHP_ADD_INCLUDE($READLINE_DIR/include)
PHP_READLINE_LIBS=""
AC_CHECK_LIB(ncurses, tgetent,
[
PHP_ADD_LIBRARY(ncurses,,READLINE_SHARED_LIBADD)
PHP_READLINE_LIBS="$PHP_READLINE_LIBS -lncurses"
],[
AC_CHECK_LIB(termcap, tgetent,
[
PHP_ADD_LIBRARY(termcap,,READLINE_SHARED_LIBADD)
PHP_READLINE_LIBS="$PHP_READLINE_LIBS -ltermcap"
])
])
PHP_CHECK_LIBRARY(readline, readline,
[
PHP_ADD_LIBRARY_WITH_PATH(readline, $READLINE_DIR/$PHP_LIBDIR, READLINE_SHARED_LIBADD)
], [
AC_MSG_ERROR(readline library not found)
], [
-L$READLINE_DIR/$PHP_LIBDIR $PHP_READLINE_LIBS
])
PHP_CHECK_LIBRARY(readline, rl_pending_input,
[], [
AC_MSG_ERROR([invalid readline installation detected. Try --with-libedit instead.])
], [
-L$READLINE_DIR/$PHP_LIBDIR $PHP_READLINE_LIBS
])
PHP_CHECK_LIBRARY(readline, rl_callback_read_char,
[
AC_DEFINE(HAVE_RL_CALLBACK_READ_CHAR, 1, [ ])
],[],[
-L$READLINE_DIR/$PHP_LIBDIR $PHP_READLINE_LIBS
])
PHP_CHECK_LIBRARY(edit, rl_on_new_line,
[
AC_DEFINE(HAVE_RL_ON_NEW_LINE, 1, [ ])
],[],[
-L$READLINE_DIR/$PHP_LIBDIR $PHP_READLINE_LIBS
])
AC_DEFINE(HAVE_LIBREADLINE, 1, [ ])
elif test "$PHP_LIBEDIT" != "no"; then
for i in $PHP_LIBEDIT /usr/local /usr; do
test -f $i/include/editline/readline.h && LIBEDIT_DIR=$i && break
done
if test -z "$LIBEDIT_DIR"; then
AC_MSG_ERROR(Please reinstall libedit - I cannot find readline.h)
fi
PHP_ADD_INCLUDE($LIBEDIT_DIR/include)
AC_CHECK_LIB(ncurses, tgetent,
[
PHP_ADD_LIBRARY(ncurses,,READLINE_SHARED_LIBADD)
],[
AC_CHECK_LIB(termcap, tgetent,
[
PHP_ADD_LIBRARY(termcap,,READLINE_SHARED_LIBADD)
])
])
PHP_CHECK_LIBRARY(edit, readline,
[
PHP_ADD_LIBRARY_WITH_PATH(edit, $LIBEDIT_DIR/$PHP_LIBDIR, READLINE_SHARED_LIBADD)
], [
AC_MSG_ERROR(edit library required by readline not found)
], [
-L$READLINE_DIR/$PHP_LIBDIR
])
PHP_CHECK_LIBRARY(edit, rl_callback_read_char,
[
AC_DEFINE(HAVE_RL_CALLBACK_READ_CHAR, 1, [ ])
],[],[
-L$READLINE_DIR/$PHP_LIBDIR
])
PHP_CHECK_LIBRARY(edit, rl_on_new_line,
[
AC_DEFINE(HAVE_RL_ON_NEW_LINE, 1, [ ])
],[],[
-L$READLINE_DIR/$PHP_LIBDIR
])
AC_DEFINE(HAVE_LIBEDIT, 1, [ ])
fi
if test "$PHP_READLINE" != "no" || test "$PHP_LIBEDIT" != "no"; then
AC_CHECK_FUNCS([rl_completion_matches])
PHP_NEW_EXTENSION(readline, readline.c readline_cli.c, $ext_shared, cli)
PHP_SUBST(READLINE_SHARED_LIBADD)
fi