@@ -2197,115 +2197,18 @@ dnl Common setup macro for openssl
21972197dnl
21982198AC_DEFUN ( [ PHP_SETUP_OPENSSL] ,[
21992199 found_openssl=no
2200- unset OPENSSL_INCDIR
2201- unset OPENSSL_LIBDIR
22022200
22032201 dnl Empty variable means 'no'
22042202 test -z "$PHP_OPENSSL" && PHP_OPENSSL=no
22052203 test -z "$PHP_IMAP_SSL" && PHP_IMAP_SSL=no
22062204
2207- dnl Fallbacks for different configure options
22082205 if test "$PHP_OPENSSL" != "no"; then
2209- PHP_OPENSSL_DIR=$PHP_OPENSSL
2210- elif test "$PHP_IMAP_SSL" != "no"; then
2211- PHP_OPENSSL_DIR=$PHP_IMAP_SSL
2212- fi
2213-
2214- dnl First try to find pkg-config
2215- if test -z "$PKG_CONFIG"; then
2216- AC_PATH_PROG ( PKG_CONFIG , pkg-config , no )
2217- fi
2218-
2219- dnl If pkg-config is found try using it
2220- if test "$PHP_OPENSSL_DIR" = "yes" && test -x "$PKG_CONFIG" && $PKG_CONFIG --exists openssl; then
2221- if $PKG_CONFIG --atleast-version=1.0.1 openssl; then
2222- found_openssl=yes
2223- OPENSSL_LIBS=`$PKG_CONFIG --libs openssl`
2224- OPENSSL_INCS=`$PKG_CONFIG --cflags-only-I openssl`
2225- OPENSSL_INCDIR=`$PKG_CONFIG --variable=includedir openssl`
2226- else
2227- AC_MSG_ERROR ( [ OpenSSL version 1.0.1 or greater required.] )
2228- fi
2229-
2230- if test -n "$OPENSSL_LIBS"; then
2231- PHP_EVAL_LIBLINE($OPENSSL_LIBS, $1 )
2232- fi
2233- if test -n "$OPENSSL_INCS"; then
2234- PHP_EVAL_INCLINE($OPENSSL_INCS)
2235- fi
2236- fi
2237-
2238- dnl If pkg-config fails for some reason, revert to the old method
2239- if test "$found_openssl" = "no"; then
2240-
2241- if test "$PHP_OPENSSL_DIR" = "yes"; then
2242- PHP_OPENSSL_DIR="/usr/local/ssl /usr/local /usr /usr/local/openssl"
2243- fi
2244-
2245- for i in $PHP_OPENSSL_DIR; do
2246- if test -r $i/include/openssl/evp.h; then
2247- OPENSSL_INCDIR=$i/include
2248- fi
2249- if test -r $i/$PHP_LIBDIR/libssl.a -o -r $i/$PHP_LIBDIR/libssl.$SHLIB_SUFFIX_NAME; then
2250- OPENSSL_LIBDIR=$i/$PHP_LIBDIR
2251- fi
2252- test -n "$OPENSSL_INCDIR" && test -n "$OPENSSL_LIBDIR" && break
2253- done
2254-
2255- if test -z "$OPENSSL_INCDIR"; then
2256- AC_MSG_ERROR ( [ Cannot find OpenSSL's <evp.h>] )
2257- fi
2258-
2259- if test -z "$OPENSSL_LIBDIR"; then
2260- AC_MSG_ERROR ( [ Cannot find OpenSSL's libraries] )
2261- fi
2262-
2263- old_CPPFLAGS=$CPPFLAGS
2264- CPPFLAGS=-I$OPENSSL_INCDIR
2265- AC_MSG_CHECKING ( [ for OpenSSL version] )
2266- AC_EGREP_CPP ( yes ,[
2267- #include <openssl/opensslv.h>
2268- #if OPENSSL_VERSION_NUMBER >= 0x10001001L
2269- yes
2270- #endif
2271- ] ,[
2272- AC_MSG_RESULT ( [ >= 1.0.1] )
2273- ] ,[
2274- AC_MSG_ERROR ( [ OpenSSL version 1.0.1 or greater required.] )
2275- ] )
2276- CPPFLAGS=$old_CPPFLAGS
2277-
2278- PHP_ADD_INCLUDE($OPENSSL_INCDIR)
2279-
2280- PHP_CHECK_LIBRARY(crypto, CRYPTO_free, [
2281- PHP_ADD_LIBRARY(crypto,,$1 )
2282- ] ,[
2283- AC_MSG_ERROR ( [ libcrypto not found!] )
2284- ] ,[
2285- -L$OPENSSL_LIBDIR
2286- ] )
2287-
2288- old_LIBS=$LIBS
2289- LIBS="$LIBS -lcrypto"
2290- PHP_CHECK_LIBRARY(ssl, SSL_CTX_set_ssl_version, [
2291- found_openssl=yes
2292- ] ,[
2293- AC_MSG_ERROR ( [ libssl not found!] )
2294- ] ,[
2295- -L$OPENSSL_LIBDIR
2296- ] )
2297- LIBS=$old_LIBS
2298- PHP_ADD_LIBRARY(ssl,,$1 )
2299- PHP_ADD_LIBRARY(crypto,,$1 )
2300-
2301- PHP_ADD_LIBPATH($OPENSSL_LIBDIR, $1 )
2206+ PKG_CHECK_MODULES([ OPENSSL] , [ openssl >= 1.0.1] , [ found_openssl=yes] )
23022207 fi
23032208
23042209 if test "$found_openssl" = "yes"; then
2305- dnl For apache 1.3.x static build
2306- OPENSSL_INCDIR_OPT=-I$OPENSSL_INCDIR
2307- AC_SUBST ( OPENSSL_INCDIR_OPT )
2308-
2210+ PHP_EVAL_LIBLINE($OPENSSL_LIBS, $1 )
2211+ PHP_EVAL_INCLINE($OPENSSL_CFLAGS)
23092212ifelse ( [ $2 ] ,[ ] ,: ,[ $2 ] )
23102213ifelse ( [ $3 ] ,[ ] ,,[ else $3 ] )
23112214 fi
0 commit comments