1
- PHP_ARG_WITH([ libedit ] ,
2
- [ for libedit readline replacement ] ,
3
- [ AS_HELP_STRING ( [ --with-libedit ] ,
4
- [ Include libedit readline replacement (CLI/CGI only)] ) ] )
1
+ PHP_ARG_WITH([ readline ] ,
2
+ [ for readline support ] ,
3
+ [ AS_HELP_STRING ( [ --with-readline ] ,
4
+ [ Include readline support using the libedit library (CLI/CGI only)] ) ] )
5
5
6
- if test "$PHP_LIBEDIT" = "no"; then
7
- PHP_ARG_WITH([ readline] ,
8
- [ for readline support] ,
9
- [ AS_HELP_STRING ( [ [ --with-readline[ =DIR] ] ] ,
10
- [ Include readline support (CLI/CGI only)] ) ] )
11
- else
12
- dnl "register" the --with-readline option to prevent invalid "unknown
13
- dnl configure option" warning
14
- php_with_readline=no
15
- fi
16
-
17
- if test "$PHP_READLINE" && test "$PHP_READLINE" != "no"; then
18
- for i in $PHP_READLINE /usr/local /usr; do
19
- AS_IF ( [ test -f $i/include/readline/readline.h] , [ READLINE_DIR=$i; break;] )
20
- done
21
-
22
- AS_VAR_IF ( [ READLINE_DIR] ,,
23
- [ AC_MSG_ERROR ( [ Please reinstall readline - I cannot find readline.h] ) ] )
24
-
25
- PHP_ADD_INCLUDE([ $READLINE_DIR/include] )
26
-
27
- PHP_READLINE_LIBS=""
28
- AC_CHECK_LIB ( [ ncurses] , [ tgetent] , [
29
- PHP_ADD_LIBRARY([ ncurses] ,, [ READLINE_SHARED_LIBADD] )
30
- PHP_READLINE_LIBS="$PHP_READLINE_LIBS -lncurses"
31
- ] ,
32
- [ AC_CHECK_LIB ( [ termcap] , [ tgetent] , [
33
- PHP_ADD_LIBRARY([ termcap] ,, [ READLINE_SHARED_LIBADD] )
34
- PHP_READLINE_LIBS="$PHP_READLINE_LIBS -ltermcap"
35
- ] )
36
- ] )
37
-
38
- PHP_CHECK_LIBRARY([ readline] , [ readline] ,
39
- [ PHP_ADD_LIBRARY_WITH_PATH([ readline] ,
40
- [ $READLINE_DIR/$PHP_LIBDIR] ,
41
- [ READLINE_SHARED_LIBADD] )] ,
42
- [ AC_MSG_FAILURE ( [ The readline library not found.] ) ] ,
43
- [ -L$READLINE_DIR/$PHP_LIBDIR $PHP_READLINE_LIBS] )
44
-
45
- PHP_CHECK_LIBRARY([ readline] , [ rl_callback_read_char] ,
46
- [ AC_DEFINE ( [ HAVE_RL_CALLBACK_READ_CHAR] , [ 1] ) ] ,
47
- [ ] ,
48
- [ -L$READLINE_DIR/$PHP_LIBDIR $PHP_READLINE_LIBS] )
49
-
50
- PHP_CHECK_LIBRARY([ readline] , [ rl_on_new_line] ,
51
- [ AC_DEFINE ( [ HAVE_RL_ON_NEW_LINE] , [ 1] ) ] ,
52
- [ ] ,
53
- [ -L$READLINE_DIR/$PHP_LIBDIR $PHP_READLINE_LIBS] )
54
-
55
- PHP_CHECK_LIBRARY([ readline] , [ rl_completion_matches] ,
56
- [ AC_DEFINE ( [ HAVE_RL_COMPLETION_MATCHES] , [ 1] ) ] ,
57
- [ ] ,
58
- [ -L$READLINE_DIR/$PHP_LIBDIR $PHP_READLINE_LIBS] )
59
-
60
- CFLAGS_SAVE=$CFLAGS
61
- LDFLAGS_SAVE=$LDFLAGS
62
- LIBS_SAVE=$LIBS
63
- CFLAGS="$CFLAGS $INCLUDES"
64
- LDFLAGS="$LDFLAGS -L$READLINE_DIR/$PHP_LIBDIR"
65
- LIBS="$LIBS -lreadline"
66
-
67
- dnl Sanity and minimum version check if readline library has variable
68
- dnl rl_pending_input.
69
- AC_CHECK_DECL ( [ rl_pending_input] ,, [ AC_MSG_FAILURE ( [
70
- Invalid readline installation detected. Try --with-libedit instead.
71
- ] ) ] , [
72
- #include <stdio.h>
73
- #include <readline/readline.h>
74
- ] )
75
-
76
- AC_CHECK_DECL ( [ rl_erase_empty_line] ,
77
- [ AC_DEFINE ( [ HAVE_ERASE_EMPTY_LINE] , [ 1] ) ] ,, [
78
- #include <stdio.h>
79
- #include <readline/readline.h>
80
- ] )
81
- CFLAGS=$CFLAGS_SAVE
82
- LDFLAGS=$LDFLAGS_SAVE
83
- LIBS=$LIBS_SAVE
6
+ if test "$PHP_READLINE" != "no"; then
7
+ AS_VAR_IF ( [ PHP_READLINE] , [ yes] ,,
8
+ [ AC_MSG_WARN ( [ m4_text_wrap ( [
9
+ The directory argument is not supported anymore, rely on pkg-config.
10
+ Replace '--with-readline=$PHP_READLINE' with '--with-realine' and use
11
+ environment variables 'PKG_CONFIG_PATH', 'EDIT_LIBS', or 'EDIT_CFLAGS'.
12
+ ] ) ] ) ] )
84
13
85
- AC_DEFINE ( [ HAVE_HISTORY_LIST] , [ 1] )
86
- AC_DEFINE ( [ HAVE_LIBREADLINE] , [ 1] ,
87
- [ Define to 1 if readline extension uses the 'readline' library.] )
88
-
89
- elif test "$PHP_LIBEDIT" != "no"; then
90
- AS_VAR_IF ( [ PHP_LIBEDIT] , [ yes] ,,
91
- [ AC_MSG_WARN ( m4_text_wrap ( [
92
- The libedit directory argument is not supported anymore, rely on
93
- pkg-config. Replace '--with-libedit=$PHP_LIBEDIT' with '--with-libedit'
94
- and use environment variables 'PKG_CONFIG_PATH', 'EDIT_LIBS', or
95
- 'EDIT_CFLAGS'.
96
- ] ) ) ] )
97
-
98
- PKG_CHECK_MODULES([ EDIT] , [ libedit] )
99
- PHP_EVAL_LIBLINE([ $EDIT_LIBS] , [ READLINE_SHARED_LIBADD] )
100
- PHP_EVAL_INCLINE([ $EDIT_CFLAGS] )
14
+ PHP_SETUP_EDIT([ READLINE_SHARED_LIBADD] )
101
15
102
16
AC_CHECK_LIB ( [ ncurses] , [ tgetent] ,
103
17
[ PHP_ADD_LIBRARY([ ncurses] ,, [ READLINE_SHARED_LIBADD] )] ,
@@ -111,28 +25,26 @@ elif test "$PHP_LIBEDIT" != "no"; then
111
25
112
26
PHP_CHECK_LIBRARY([ edit] , [ rl_callback_read_char] ,
113
27
[ AC_DEFINE ( [ HAVE_RL_CALLBACK_READ_CHAR] , [ 1] ,
114
- [ Define to 1 if edit/readline library has the 'rl_callback_read_char'
115
- function.] ) ] ,
28
+ [ Define to 1 if edit library has the 'rl_callback_read_char' function.] ) ] ,
116
29
[ ] ,
117
30
[ $READLINE_SHARED_LIBADD] )
118
31
119
32
PHP_CHECK_LIBRARY([ edit] , [ rl_on_new_line] ,
120
33
[ AC_DEFINE ( [ HAVE_RL_ON_NEW_LINE] , [ 1] ,
121
- [ Define to 1 if edit/readline library has the 'rl_on_new_line'
122
- function.] ) ] ,
34
+ [ Define to 1 if edit library has the 'rl_on_new_line' function.] ) ] ,
123
35
[ ] ,
124
36
[ $READLINE_SHARED_LIBADD] )
125
37
126
38
PHP_CHECK_LIBRARY([ edit] , [ rl_completion_matches] ,
127
39
[ AC_DEFINE ( [ HAVE_RL_COMPLETION_MATCHES] , [ 1] ,
128
- [ Define to 1 if edit/readline library has the 'rl_completion_matches'
40
+ [ Define to 1 if edit library has the 'rl_completion_matches'
129
41
function.] ) ] ,
130
42
[ ] ,
131
43
[ $READLINE_SHARED_LIBADD] )
132
44
133
45
PHP_CHECK_LIBRARY([ edit] , [ history_list] ,
134
46
[ AC_DEFINE ( [ HAVE_HISTORY_LIST] , [ 1] ,
135
- [ Define to 1 if edit/readline library has the 'history_list' function.] ) ] ,
47
+ [ Define to 1 if edit library has the 'history_list' function.] ) ] ,
136
48
[ ] ,
137
49
[ $READLINE_SHARED_LIBADD] )
138
50
@@ -142,17 +54,12 @@ elif test "$PHP_LIBEDIT" != "no"; then
142
54
LIBS="$LIBS $EDIT_LIBS"
143
55
AC_CHECK_DECL ( [ rl_erase_empty_line] ,
144
56
[ AC_DEFINE ( [ HAVE_ERASE_EMPTY_LINE] , [ 1] ,
145
- [ Define to 1 if edit/readline library has the 'rl_erase_empty_line'
146
- global variable.] ) ] ,,
57
+ [ Define to 1 if edit library has the 'rl_erase_empty_line' global
58
+ variable.] ) ] ,,
147
59
[ #include <editline/readline.h>] )
148
60
CFLAGS=$CFLAGS_SAVE
149
61
LIBS=$LIBS_SAVE
150
62
151
- AC_DEFINE ( [ HAVE_LIBEDIT] , [ 1] ,
152
- [ Define to 1 if readline extension uses the 'libedit' library.] )
153
- fi
154
-
155
- if test "$PHP_READLINE" != "no" || test "$PHP_LIBEDIT" != "no"; then
156
63
dnl Add -Wno-strict-prototypes as depends on user libs
157
64
PHP_NEW_EXTENSION([ readline] ,
158
65
[ readline.c readline_cli.c] ,
0 commit comments