Commit c68fed87 authored by Daniel Stenberg's avatar Daniel Stenberg
Browse files

configure: fix the -ldl check for openssl, add -lpthread check

The check for if -ldl is needed to build with (a statically built)
openssl was broken. This repairs the check, and adds a check for
-lpthread as well since OpenSSL 1.1.0+ does in fact require -lpthread so
only adding -ldl for a static openssl build is no longer enough.

Reported-by: Jay Satiro
Ref: #1426
Closes #1427
parent d87bd46c
Loading
Loading
Loading
Loading
+42 −44
Original line number Original line Diff line number Diff line
@@ -5,7 +5,7 @@
#                            | (__| |_| |  _ <| |___
#                            | (__| |_| |  _ <| |___
#                             \___|\___/|_| \_\_____|
#                             \___|\___/|_| \_\_____|
#
#
# Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
# Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
#
#
# This software is licensed as described in the file COPYING, which
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# you should have received as part of this distribution. The terms
@@ -1517,52 +1517,50 @@ if test "$curl_ssl_msg" = "$init_ssl_msg" && test X"$OPT_SSL" != Xno; then
     AC_CHECK_LIB(crypto, HMAC_Init_ex,[
     AC_CHECK_LIB(crypto, HMAC_Init_ex,[
       HAVECRYPTO="yes"
       HAVECRYPTO="yes"
       LIBS="-lcrypto $LIBS"], [
       LIBS="-lcrypto $LIBS"], [
       LDFLAGS="$CLEANLDFLAGS"
       CPPFLAGS="$CLEANCPPFLAGS"
       LIBS="$CLEANLIBS"
       ])
    ])



  if test X"$HAVECRYPTO" = X"yes"; then
       dnl still no, but what about with -ldl?
     AC_MSG_CHECKING([OpenSSL linking without -ldl])
       AC_MSG_CHECKING([OpenSSL linking with -ldl])
     saved_libs=$LIBS
       LIBS="-ldl $LIBS"
       AC_TRY_LINK(
       AC_TRY_LINK(
       [
       [
          #include <openssl/evp.h>
         #include <openssl/err.h>
       ],
       ],
       [
       [
          SSLeay_add_all_algorithms();
         ERR_clear_error();
       ],
       ],
       [
       [
         AC_MSG_RESULT(yes)
         AC_MSG_RESULT(yes)
          LIBS="$saved_libs"
         HAVECRYPTO="yes"
       ],
       ],
       [
       [
         AC_MSG_RESULT(no)
         AC_MSG_RESULT(no)
          AC_MSG_CHECKING([OpenSSL linking with -ldl])
         dnl ok, so what about bouth -ldl and -lpthread?
          LIBS="-ldl $LIBS"

         AC_MSG_CHECKING([OpenSSL linking with -ldl and -lpthread])
         LIBS="-lpthread $LIBS"
         AC_TRY_LINK(
         AC_TRY_LINK(
         [
         [
            #include <openssl/evp.h>
           #include <openssl/err.h>
         ],
         ],
         [
         [
            SSLeay_add_all_algorithms();
           ERR_clear_error();
         ],
         ],
         [
         [
           AC_MSG_RESULT(yes)
           AC_MSG_RESULT(yes)
            LIBS="$saved_libs -ldl"
           HAVECRYPTO="yes"
         ],
         ],
         [
         [
           AC_MSG_RESULT(no)
           AC_MSG_RESULT(no)
            LIBS="$saved_libs"
           LDFLAGS="$CLEANLDFLAGS"
          ]
           CPPFLAGS="$CLEANCPPFLAGS"
          )
           LIBS="$CLEANLIBS"


        ]
         ])
     )


  fi
       ])

     ])
  ])


  if test X"$HAVECRYPTO" = X"yes"; then
  if test X"$HAVECRYPTO" = X"yes"; then
    dnl This is only reasonable to do if crypto actually is there: check for
    dnl This is only reasonable to do if crypto actually is there: check for