From f91909b3b074f5464bd87f1c48e8a768c22422e3 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Mon, 2 Jul 2007 17:32:09 +0200 Subject: [PATCH] configure: Make the libssl soname check depend on the header check. --- configure | 316 ++++++++++++++++++----------------- configure.ac | 9 +- dlls/wininet/netconnection.c | 30 ++-- 3 files changed, 178 insertions(+), 177 deletions(-) diff --git a/configure b/configure index 74a77991211..97208d28ec5 100755 --- a/configure +++ b/configure @@ -13824,6 +13824,166 @@ cat >>confdefs.h <<_ACEOF _ACEOF +fi + +fi + +if test "$ac_cv_header_openssl_err_h" = "yes" -a "$ac_cv_header_openssl_ssl_h" = "yes" +then + { echo "$as_me:$LINENO: checking for -lssl" >&5 +echo $ECHO_N "checking for -lssl... $ECHO_C" >&6; } +if test "${ac_cv_lib_soname_ssl+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_soname_save_LIBS=$LIBS +LIBS="-lssl $LIBS" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char SSL_library_init (); +int +main () +{ +return SSL_library_init (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + case "$LIBEXT" in + dll) ;; + dylib) ac_cv_lib_soname_ssl=`otool -L conftest$ac_exeext | grep "libssl\\.[0-9A-Za-z.]*dylib" | sed -e "s/^.*\/\(libssl\.[0-9A-Za-z.]*dylib\).*$/\1/"';2,$d'` ;; + *) ac_cv_lib_soname_ssl=`$ac_cv_path_LDD conftest$ac_exeext | grep "libssl\\.$LIBEXT" | sed -e "s/^.*\(libssl\.$LIBEXT[^ ]*\).*$/\1/"';2,$d'` ;; + esac +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + LIBS=$ac_check_soname_save_LIBS +fi +if test "x$ac_cv_lib_soname_ssl" = "x"; then + { echo "$as_me:$LINENO: result: not found" >&5 +echo "${ECHO_T}not found" >&6; } + +else + { echo "$as_me:$LINENO: result: $ac_cv_lib_soname_ssl" >&5 +echo "${ECHO_T}$ac_cv_lib_soname_ssl" >&6; } + +cat >>confdefs.h <<_ACEOF +#define SONAME_LIBSSL "$ac_cv_lib_soname_ssl" +_ACEOF + + +fi + + { echo "$as_me:$LINENO: checking for -lcrypto" >&5 +echo $ECHO_N "checking for -lcrypto... $ECHO_C" >&6; } +if test "${ac_cv_lib_soname_crypto+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_soname_save_LIBS=$LIBS +LIBS="-lcrypto $LIBS" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char BIO_new_socket (); +int +main () +{ +return BIO_new_socket (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + case "$LIBEXT" in + dll) ;; + dylib) ac_cv_lib_soname_crypto=`otool -L conftest$ac_exeext | grep "libcrypto\\.[0-9A-Za-z.]*dylib" | sed -e "s/^.*\/\(libcrypto\.[0-9A-Za-z.]*dylib\).*$/\1/"';2,$d'` ;; + *) ac_cv_lib_soname_crypto=`$ac_cv_path_LDD conftest$ac_exeext | grep "libcrypto\\.$LIBEXT" | sed -e "s/^.*\(libcrypto\.$LIBEXT[^ ]*\).*$/\1/"';2,$d'` ;; + esac +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + LIBS=$ac_check_soname_save_LIBS +fi +if test "x$ac_cv_lib_soname_crypto" = "x"; then + { echo "$as_me:$LINENO: result: not found" >&5 +echo "${ECHO_T}not found" >&6; } + +else + { echo "$as_me:$LINENO: result: $ac_cv_lib_soname_crypto" >&5 +echo "${ECHO_T}$ac_cv_lib_soname_crypto" >&6; } + +cat >>confdefs.h <<_ACEOF +#define SONAME_LIBCRYPTO "$ac_cv_lib_soname_crypto" +_ACEOF + + fi fi @@ -15316,162 +15476,6 @@ cat >>confdefs.h <<_ACEOF _ACEOF -fi - -{ echo "$as_me:$LINENO: checking for -lssl" >&5 -echo $ECHO_N "checking for -lssl... $ECHO_C" >&6; } -if test "${ac_cv_lib_soname_ssl+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_soname_save_LIBS=$LIBS -LIBS="-lssl $LIBS" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char SSL_library_init (); -int -main () -{ -return SSL_library_init (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - case "$LIBEXT" in - dll) ;; - dylib) ac_cv_lib_soname_ssl=`otool -L conftest$ac_exeext | grep "libssl\\.[0-9A-Za-z.]*dylib" | sed -e "s/^.*\/\(libssl\.[0-9A-Za-z.]*dylib\).*$/\1/"';2,$d'` ;; - *) ac_cv_lib_soname_ssl=`$ac_cv_path_LDD conftest$ac_exeext | grep "libssl\\.$LIBEXT" | sed -e "s/^.*\(libssl\.$LIBEXT[^ ]*\).*$/\1/"';2,$d'` ;; - esac -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_check_soname_save_LIBS -fi -if test "x$ac_cv_lib_soname_ssl" = "x"; then - { echo "$as_me:$LINENO: result: not found" >&5 -echo "${ECHO_T}not found" >&6; } - -else - { echo "$as_me:$LINENO: result: $ac_cv_lib_soname_ssl" >&5 -echo "${ECHO_T}$ac_cv_lib_soname_ssl" >&6; } - -cat >>confdefs.h <<_ACEOF -#define SONAME_LIBSSL "$ac_cv_lib_soname_ssl" -_ACEOF - - -fi - -{ echo "$as_me:$LINENO: checking for -lcrypto" >&5 -echo $ECHO_N "checking for -lcrypto... $ECHO_C" >&6; } -if test "${ac_cv_lib_soname_crypto+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_soname_save_LIBS=$LIBS -LIBS="-lcrypto $LIBS" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char BIO_new_socket (); -int -main () -{ -return BIO_new_socket (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - case "$LIBEXT" in - dll) ;; - dylib) ac_cv_lib_soname_crypto=`otool -L conftest$ac_exeext | grep "libcrypto\\.[0-9A-Za-z.]*dylib" | sed -e "s/^.*\/\(libcrypto\.[0-9A-Za-z.]*dylib\).*$/\1/"';2,$d'` ;; - *) ac_cv_lib_soname_crypto=`$ac_cv_path_LDD conftest$ac_exeext | grep "libcrypto\\.$LIBEXT" | sed -e "s/^.*\(libcrypto\.$LIBEXT[^ ]*\).*$/\1/"';2,$d'` ;; - esac -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_check_soname_save_LIBS -fi -if test "x$ac_cv_lib_soname_crypto" = "x"; then - { echo "$as_me:$LINENO: result: not found" >&5 -echo "${ECHO_T}not found" >&6; } - -else - { echo "$as_me:$LINENO: result: $ac_cv_lib_soname_crypto" >&5 -echo "${ECHO_T}$ac_cv_lib_soname_crypto" >&6; } - -cat >>confdefs.h <<_ACEOF -#define SONAME_LIBCRYPTO "$ac_cv_lib_soname_crypto" -_ACEOF - - fi { echo "$as_me:$LINENO: checking for -ljpeg" >&5 diff --git a/configure.ac b/configure.ac index 6dc6d491182..bd64583de9b 100644 --- a/configure.ac +++ b/configure.ac @@ -985,6 +985,13 @@ then WINE_CHECK_SONAME(fontconfig,FcInit) fi +dnl **** Check for SSL **** +if test "$ac_cv_header_openssl_err_h" = "yes" -a "$ac_cv_header_openssl_ssl_h" = "yes" +then + WINE_CHECK_SONAME(ssl,SSL_library_init) + WINE_CHECK_SONAME(crypto,BIO_new_socket) +fi + dnl **** Check for gcc specific options **** AC_SUBST(EXTRACFLAGS,"") @@ -1133,8 +1140,6 @@ WINE_CHECK_SONAME(Xcursor,XcursorImageLoadCursor,,,[$X_LIBS -lX11 $X_EXTRA_LIBS] WINE_CHECK_SONAME(freetype,FT_Init_FreeType,,,[$X_LIBS]) WINE_CHECK_SONAME(GL,glXQueryExtension,,,[$X_LIBS $X_EXTRA_LIBS]) WINE_CHECK_SONAME(txc_dxtn,fetch_2d_texel_rgba_dxt1) -WINE_CHECK_SONAME(ssl,SSL_library_init) -WINE_CHECK_SONAME(crypto,BIO_new_socket) WINE_CHECK_SONAME(jpeg,jpeg_start_decompress) diff --git a/dlls/wininet/netconnection.c b/dlls/wininet/netconnection.c index 1d080803acb..eca9a8c5fe1 100644 --- a/dlls/wininet/netconnection.c +++ b/dlls/wininet/netconnection.c @@ -68,17 +68,10 @@ WINE_DEFAULT_DEBUG_CHANNEL(wininet); * SSL stuff should use crypt32.dll */ -#if defined HAVE_OPENSSL_SSL_H && defined HAVE_OPENSSL_ERR_H +#ifdef SONAME_LIBSSL #include -#ifndef SONAME_LIBSSL -#define SONAME_LIBSSL "libssl" SONAME_EXT -#endif -#ifndef SONAME_LIBCRYPTO -#define SONAME_LIBCRYPTO "libcrypto" SONAME_EXT -#endif - static void *OpenSSL_ssl_handle; static void *OpenSSL_crypto_handle; @@ -120,7 +113,7 @@ BOOL NETCON_init(WININET_NETCONNECTION *connection, BOOL useSSL) connection->socketFD = -1; if (useSSL) { -#if defined HAVE_OPENSSL_SSL_H && defined HAVE_OPENSSL_ERR_H +#ifdef SONAME_LIBSSL TRACE("using SSL connection\n"); if (OpenSSL_ssl_handle) /* already initialized everything */ return TRUE; @@ -278,7 +271,7 @@ static int sock_get_error( int err ) BOOL NETCON_create(WININET_NETCONNECTION *connection, int domain, int type, int protocol) { -#if defined HAVE_OPENSSL_SSL_H && defined HAVE_OPENSSL_ERR_H +#ifdef SONAME_LIBSSL if (connection->useSSL) return FALSE; #endif @@ -302,7 +295,7 @@ BOOL NETCON_close(WININET_NETCONNECTION *connection) if (!NETCON_connected(connection)) return FALSE; -#if defined HAVE_OPENSSL_SSL_H && defined HAVE_OPENSSL_ERR_H +#ifdef SONAME_LIBSSL if (connection->useSSL) { HeapFree(GetProcessHeap(),0,connection->peek_msg_mem); @@ -328,7 +321,7 @@ BOOL NETCON_close(WININET_NETCONNECTION *connection) } return TRUE; } -#if defined HAVE_OPENSSL_SSL_H && defined HAVE_OPENSSL_ERR_H +#ifdef SONAME_LIBSSL static BOOL check_hostname(X509 *cert, char *hostname) { /* FIXME: implement */ @@ -341,7 +334,7 @@ static BOOL check_hostname(X509 *cert, char *hostname) */ BOOL NETCON_secure_connect(WININET_NETCONNECTION *connection, LPCWSTR hostname) { -#if defined HAVE_OPENSSL_SSL_H && defined HAVE_OPENSSL_ERR_H +#ifdef SONAME_LIBSSL long verify_res; X509 *cert; int len; @@ -479,7 +472,7 @@ BOOL NETCON_send(WININET_NETCONNECTION *connection, const void *msg, size_t len, } else { -#if defined HAVE_OPENSSL_SSL_H && defined HAVE_OPENSSL_ERR_H +#ifdef SONAME_LIBSSL if (flags) FIXME("SSL_write doesn't support any flags (%08x)\n", flags); *sent = pSSL_write(connection->ssl_s, msg, len); @@ -516,7 +509,7 @@ BOOL NETCON_recv(WININET_NETCONNECTION *connection, void *buf, size_t len, int f } else { -#if defined HAVE_OPENSSL_SSL_H && defined HAVE_OPENSSL_ERR_H +#ifdef SONAME_LIBSSL if (flags & ~(MSG_PEEK|MSG_WAITALL)) FIXME("SSL_read does not support the following flag: %08x\n", flags); @@ -583,7 +576,7 @@ BOOL NETCON_query_data_available(WININET_NETCONNECTION *connection, DWORD *avail return FALSE; *available = 0; -#if defined HAVE_OPENSSL_SSL_H +#ifdef SONAME_LIBSSL if (connection->peek_msg) *available = connection->peek_len; #endif @@ -664,7 +657,7 @@ BOOL NETCON_getNextLine(WININET_NETCONNECTION *connection, LPSTR lpszBuffer, LPD } else { -#if defined HAVE_OPENSSL_SSL_H && defined HAVE_OPENSSL_ERR_H +#ifdef SONAME_LIBSSL long prev_timeout; DWORD nRecv = 0; BOOL success = TRUE; @@ -708,8 +701,7 @@ BOOL NETCON_getNextLine(WININET_NETCONNECTION *connection, LPSTR lpszBuffer, LPD LPCVOID NETCON_GetCert(WININET_NETCONNECTION *connection) { - -#if defined HAVE_OPENSSL_SSL_H && defined HAVE_OPENSSL_ERR_H +#ifdef SONAME_LIBSSL X509* cert; unsigned char* buffer,*p; INT len;