@@ -2231,117 +2231,21 @@ dnl Common setup macro for openssl
2231
2231
dnl
2232
2232
AC_DEFUN ( [ PHP_SETUP_OPENSSL] ,[
2233
2233
found_openssl=no
2234
- unset OPENSSL_INCDIR
2235
- unset OPENSSL_LIBDIR
2236
2234
2237
2235
dnl Empty variable means 'no'
2238
2236
test -z "$PHP_OPENSSL" && PHP_OPENSSL=no
2239
2237
test -z "$PHP_IMAP_SSL" && PHP_IMAP_SSL=no
2240
2238
2241
- dnl Fallbacks for different configure options
2242
- if test "$PHP_OPENSSL" != "no"; then
2243
- PHP_OPENSSL_DIR=$PHP_OPENSSL
2244
- elif test "$PHP_IMAP_SSL" != "no"; then
2245
- PHP_OPENSSL_DIR=$PHP_IMAP_SSL
2246
- fi
2247
-
2248
- dnl First try to find pkg-config
2249
- if test -z "$PKG_CONFIG"; then
2250
- AC_PATH_PROG ( PKG_CONFIG , pkg-config , no )
2251
- fi
2252
-
2253
- dnl If pkg-config is found try using it
2254
- if test "$PHP_OPENSSL_DIR" = "yes" && test -x "$PKG_CONFIG" && $PKG_CONFIG --exists openssl; then
2255
- if $PKG_CONFIG --atleast-version=1.0.1 openssl; then
2256
- found_openssl=yes
2257
- OPENSSL_LIBS=`$PKG_CONFIG --libs openssl`
2258
- OPENSSL_INCS=`$PKG_CONFIG --cflags-only-I openssl`
2259
- OPENSSL_INCDIR=`$PKG_CONFIG --variable=includedir openssl`
2260
- else
2261
- AC_MSG_ERROR ( [ OpenSSL version 1.0.1 or greater required.] )
2262
- fi
2239
+ if test "$PHP_OPENSSL" = "yes"; then
2240
+ PKG_CHECK_MODULES([ OPENSSL] , [ openssl >= 1.0.1] , [ found_openssl=yes] ,
2241
+ [ AC_MSG_ERROR ( [ OpenSSL version 1.0.1 or greater required.] ) ] )
2263
2242
2264
2243
if test -n "$OPENSSL_LIBS"; then
2265
2244
PHP_EVAL_LIBLINE($OPENSSL_LIBS, $1 )
2266
2245
fi
2267
- if test -n "$OPENSSL_INCS"; then
2268
- PHP_EVAL_INCLINE($OPENSSL_INCS)
2269
- fi
2270
- fi
2271
-
2272
- dnl If pkg-config fails for some reason, revert to the old method
2273
- if test "$found_openssl" = "no"; then
2274
-
2275
- if test "$PHP_OPENSSL_DIR" = "yes"; then
2276
- PHP_OPENSSL_DIR="/usr/local/ssl /usr/local /usr /usr/local/openssl"
2277
- fi
2278
-
2279
- for i in $PHP_OPENSSL_DIR; do
2280
- if test -r $i/include/openssl/evp.h; then
2281
- OPENSSL_INCDIR=$i/include
2282
- fi
2283
- if test -r $i/$PHP_LIBDIR/libssl.a -o -r $i/$PHP_LIBDIR/libssl.$SHLIB_SUFFIX_NAME; then
2284
- OPENSSL_LIBDIR=$i/$PHP_LIBDIR
2285
- fi
2286
- test -n "$OPENSSL_INCDIR" && test -n "$OPENSSL_LIBDIR" && break
2287
- done
2288
-
2289
- if test -z "$OPENSSL_INCDIR"; then
2290
- AC_MSG_ERROR ( [ Cannot find OpenSSL's <evp.h>] )
2291
- fi
2292
-
2293
- if test -z "$OPENSSL_LIBDIR"; then
2294
- AC_MSG_ERROR ( [ Cannot find OpenSSL's libraries] )
2246
+ if test -n "$OPENSSL_CFLAGS"; then
2247
+ PHP_EVAL_INCLINE($OPENSSL_CFLAGS)
2295
2248
fi
2296
-
2297
- old_CPPFLAGS=$CPPFLAGS
2298
- CPPFLAGS=-I$OPENSSL_INCDIR
2299
- AC_MSG_CHECKING ( [ for OpenSSL version] )
2300
- AC_EGREP_CPP ( yes ,[
2301
- #include <openssl/opensslv.h>
2302
- #if OPENSSL_VERSION_NUMBER >= 0x10001001L
2303
- yes
2304
- #endif
2305
- ] ,[
2306
- AC_MSG_RESULT ( [ >= 1.0.1] )
2307
- ] ,[
2308
- AC_MSG_ERROR ( [ OpenSSL version 1.0.1 or greater required.] )
2309
- ] )
2310
- CPPFLAGS=$old_CPPFLAGS
2311
-
2312
- PHP_ADD_INCLUDE($OPENSSL_INCDIR)
2313
-
2314
- PHP_CHECK_LIBRARY(crypto, CRYPTO_free, [
2315
- PHP_ADD_LIBRARY(crypto,,$1 )
2316
- ] ,[
2317
- AC_MSG_ERROR ( [ libcrypto not found!] )
2318
- ] ,[
2319
- -L$OPENSSL_LIBDIR
2320
- ] )
2321
-
2322
- old_LIBS=$LIBS
2323
- LIBS="$LIBS -lcrypto"
2324
- PHP_CHECK_LIBRARY(ssl, SSL_CTX_set_ssl_version, [
2325
- found_openssl=yes
2326
- ] ,[
2327
- AC_MSG_ERROR ( [ libssl not found!] )
2328
- ] ,[
2329
- -L$OPENSSL_LIBDIR
2330
- ] )
2331
- LIBS=$old_LIBS
2332
- PHP_ADD_LIBRARY(ssl,,$1 )
2333
- PHP_ADD_LIBRARY(crypto,,$1 )
2334
-
2335
- PHP_ADD_LIBPATH($OPENSSL_LIBDIR, $1 )
2336
- fi
2337
-
2338
- if test "$found_openssl" = "yes"; then
2339
- dnl For apache 1.3.x static build
2340
- OPENSSL_INCDIR_OPT=-I$OPENSSL_INCDIR
2341
- AC_SUBST ( OPENSSL_INCDIR_OPT )
2342
-
2343
- ifelse ( [ $2 ] ,[ ] ,: ,[ $2 ] )
2344
- ifelse ( [ $3 ] ,[ ] ,,[ else $3 ] )
2345
2249
fi
2346
2250
] )
2347
2251
0 commit comments