@@ -56,10 +56,20 @@ PHP_ARG_WITH([external-libcrypt],
56
56
[ no] ,
57
57
[ no] )
58
58
59
- if test "$PHP_EXTERNAL_LIBCRYPT" != "no"; then
59
+ AH_TEMPLATE ( [ PHP_USE_PHP_CRYPT_R] ,
60
+ [ Define to 1 if PHP uses its own crypt_r, and to 0 if using the external crypt
61
+ library.] )
62
+
63
+ AS_VAR_IF ( [ PHP_EXTERNAL_LIBCRYPT] , [ no] , [
64
+ AC_DEFINE ( [ PHP_USE_PHP_CRYPT_R] , [ 1] )
65
+ PHP_ADD_SOURCES([ PHP_EXT_DIR([ standard] )] ,
66
+ [ crypt_freesec.c crypt_blowfish.c crypt_sha512.c crypt_sha256.c php_crypt_r.c] )
67
+ ] , [
60
68
PHP_CHECK_FUNC(crypt, crypt)
61
69
PHP_CHECK_FUNC(crypt_r, crypt)
62
70
AC_CHECK_HEADERS ( [ crypt.h] )
71
+ AS_VAR_IF ( [ ac_cv_func_crypt] , [ yes] ,,
72
+ [ AC_MSG_ERROR ( [ Cannot use external libcrypt as crypt() is missing.] ) ] )
63
73
AS_VAR_IF ( [ ac_cv_func_crypt_r] , [ yes] ,
64
74
[ PHP_CRYPT_R_STYLE] ,
65
75
[ AC_MSG_ERROR ( [ Cannot use external libcrypt as crypt_r() is missing.] ) ] )
@@ -78,12 +88,8 @@ if test "$PHP_EXTERNAL_LIBCRYPT" != "no"; then
78
88
#include <string.h>
79
89
80
90
int main(void) {
81
- #ifdef HAVE_CRYPT
82
91
char *encrypted = crypt("rasmuslerdorf","rl");
83
92
return !encrypted || strcmp(encrypted,"rl.3StKT.4T8M");
84
- #else
85
- return 1;
86
- #endif
87
93
}] ] ) ] ,[
88
94
ac_cv_crypt_des=yes
89
95
] ,[
@@ -106,12 +112,8 @@ int main(void) {
106
112
#include <string.h>
107
113
108
114
int main(void) {
109
- #ifdef HAVE_CRYPT
110
115
char *encrypted = crypt("rasmuslerdorf","_J9..rasm");
111
116
return !encrypted || strcmp(encrypted,"_J9..rasmBYk8r9AiWNc");
112
- #else
113
- return 1;
114
- #endif
115
117
}] ] ) ] ,[
116
118
ac_cv_crypt_ext_des=yes
117
119
] ,[
@@ -134,7 +136,6 @@ int main(void) {
134
136
#include <string.h>
135
137
136
138
int main(void) {
137
- #ifdef HAVE_CRYPT
138
139
char salt[ 15] , answer[ 40] ;
139
140
char *encrypted;
140
141
@@ -147,9 +148,6 @@ int main(void) {
147
148
strcat(answer,"rISCgZzpwk3UhDidwXvin0");
148
149
encrypted = crypt("rasmuslerdorf",salt);
149
150
return !encrypted || strcmp(encrypted,answer);
150
- #else
151
- return 1;
152
- #endif
153
151
}] ] ) ] ,[
154
152
ac_cv_crypt_md5=yes
155
153
] ,[
@@ -172,7 +170,6 @@ int main(void) {
172
170
#include <string.h>
173
171
174
172
int main(void) {
175
- #ifdef HAVE_CRYPT
176
173
char salt[ 30] , answer[ 70] ;
177
174
char *encrypted;
178
175
@@ -182,9 +179,6 @@ int main(void) {
182
179
strcpy(&answer[ 29] ,"nIdrcHdxcUxWomQX9j6kvERCFjTg7Ra");
183
180
encrypted = crypt("rasmuslerdorf",salt);
184
181
return !encrypted || strcmp(encrypted,answer);
185
- #else
186
- return 1;
187
- #endif
188
182
}] ] ) ] ,[
189
183
ac_cv_crypt_blowfish=yes
190
184
] ,[
@@ -207,7 +201,6 @@ int main(void) {
207
201
#include <string.h>
208
202
209
203
int main(void) {
210
- #ifdef HAVE_CRYPT
211
204
char salt[ 21] , answer[ 21+86] ;
212
205
char *encrypted;
213
206
@@ -216,9 +209,6 @@ int main(void) {
216
209
strcat(answer, "EeHCRjm0bljalWuALHSTs1NB9ipEiLEXLhYeXdOpx22gmlmVejnVXFhd84cEKbYxCo.XuUTrW.RLraeEnsvWs/");
217
210
encrypted = crypt("rasmuslerdorf",salt);
218
211
return !encrypted || strcmp(encrypted,answer);
219
- #else
220
- return 1;
221
- #endif
222
212
}] ] ) ] ,[
223
213
ac_cv_crypt_sha512=yes
224
214
] ,[
@@ -241,7 +231,6 @@ int main(void) {
241
231
#include <string.h>
242
232
243
233
int main(void) {
244
- #ifdef HAVE_CRYPT
245
234
char salt[ 21] , answer[ 21+43] ;
246
235
char *encrypted;
247
236
@@ -250,9 +239,6 @@ int main(void) {
250
239
strcat(answer, "cFAm2puLCujQ9t.0CxiFIIvFi4JyQx5UncCt/xRIX23");
251
240
encrypted = crypt("rasmuslerdorf",salt);
252
241
return !encrypted || strcmp(encrypted,answer);
253
- #else
254
- return 1;
255
- #endif
256
242
}] ] ) ] ,[
257
243
ac_cv_crypt_sha256=yes
258
244
] ,[
@@ -266,12 +252,8 @@ int main(void) {
266
252
AC_MSG_ERROR ( [ Cannot use external libcrypt as some algo are missing] )
267
253
fi
268
254
269
- AC_DEFINE_UNQUOTED ( PHP_USE_PHP_CRYPT_R , 0 , [ Whether PHP has to use its own crypt_r] )
270
- else
271
- AC_DEFINE_UNQUOTED ( PHP_USE_PHP_CRYPT_R , 1 , [ Whether PHP has to use its own crypt_r] )
272
-
273
- PHP_ADD_SOURCES(PHP_EXT_DIR(standard), crypt_freesec.c crypt_blowfish.c crypt_sha512.c crypt_sha256.c php_crypt_r.c)
274
- fi
255
+ AC_DEFINE ( [ PHP_USE_PHP_CRYPT_R] , [ 0] )
256
+ ] )
275
257
276
258
AS_VAR_IF ( [ cross_compiling] , [ no] , [ AC_FUNC_FNMATCH ] ,
277
259
[ AS_CASE ( [ $host_alias] , [ *linux*] ,
0 commit comments