Commit 4370e92d authored by Daniel Stenberg's avatar Daniel Stenberg
Browse files

set LD_LIBRARY_PATH properly even when the openssl lib dir is found using

pkg-config
parent 50e9522a
Loading
Loading
Loading
Loading
+16 −8
Original line number Original line Diff line number Diff line
@@ -768,20 +768,24 @@ if test X"$OPT_SSL" != Xno; then
      dnl only do pkg-config magic when not cross-compiling
      dnl only do pkg-config magic when not cross-compiling
      PKGTEST="yes"
      PKGTEST="yes"
    fi
    fi
    EXTRA_SSL=/usr/local/ssl ;;
    PREFIX_OPENSSL=/usr/local/ssl
    LIB_OPENSSL="$PREFIX_OPENSSL/lib$libsuff"
    ;;
  off)
  off)
    dnl no --with-ssl option given, just check default places
    dnl no --with-ssl option given, just check default places
    if test x$cross_compiling != xyes; then
    if test x$cross_compiling != xyes; then
      dnl only do pkg-config magic when not cross-compiling
      dnl only do pkg-config magic when not cross-compiling
      PKGTEST="yes"
      PKGTEST="yes"
    fi
    fi
    EXTRA_SSL= ;;
    PREFIX_OPENSSL=
    ;;
  *)
  *)
    dnl check the given --with-ssl spot
    dnl check the given --with-ssl spot
    PKGTEST="no"
    PKGTEST="no"
    EXTRA_SSL=$OPT_SSL
    PREFIX_OPENSSL=$OPT_SSL
    LDFLAGS="$LDFLAGS -L$EXTRA_SSL/lib$libsuff"
    LIB_OPENSSL="$PREFIX_OPENSSL/lib$libsuff"
    CPPFLAGS="$CPPFLAGS -I$EXTRA_SSL/include/openssl -I$EXTRA_SSL/include"
    LDFLAGS="$LDFLAGS -L$LIB_OPENSSL"
    CPPFLAGS="$CPPFLAGS -I$PREFIX_OPENSSL/include/openssl -I$PREFIX_OPENSSL/include"
    ;;
    ;;
  esac
  esac


@@ -803,6 +807,8 @@ if test X"$OPT_SSL" != Xno; then
        SSL_LDFLAGS=`$PKGCONFIG --libs-only-L openssl 2>/dev/null`
        SSL_LDFLAGS=`$PKGCONFIG --libs-only-L openssl 2>/dev/null`
        SSL_CPPFLAGS=`$PKGCONFIG --cflags-only-I openssl 2>/dev/null`
        SSL_CPPFLAGS=`$PKGCONFIG --cflags-only-I openssl 2>/dev/null`


	LIB_OPENSSL=`echo $SSL_LDFLAGS | sed -e 's/-L//g'`

        dnl use the values pkg-config reported
        dnl use the values pkg-config reported
        LIBS="$LIBS $SSL_LIBS"
        LIBS="$LIBS $SSL_LIBS"
        CPPFLAGS="$CPPFLAGS $SSL_CPPFLAGS"
        CPPFLAGS="$CPPFLAGS $SSL_CPPFLAGS"
@@ -832,8 +838,8 @@ if test X"$OPT_SSL" != Xno; then
     HAVECRYPTO="yes"
     HAVECRYPTO="yes"
     LIBS="-lcrypto $LIBS"
     LIBS="-lcrypto $LIBS"
     ],[
     ],[
     LDFLAGS="$CLEANLDFLAGS -L$EXTRA_SSL/lib$libsuff"
     LDFLAGS="$CLEANLDFLAGS -L$LIB_OPENSSL"
     CPPFLAGS="$CLEANCPPFLAGS -I$EXTRA_SSL/include/openssl -I$EXTRA_SSL/include"
     CPPFLAGS="$CLEANCPPFLAGS -I$PREFIX_OPENSSL/include/openssl -I$PREFIX_OPENSSL/include"
     AC_CHECK_LIB(crypto, CRYPTO_add_lock,[
     AC_CHECK_LIB(crypto, CRYPTO_add_lock,[
       HAVECRYPTO="yes"
       HAVECRYPTO="yes"
       LIBS="-lcrypto $LIBS"], [
       LIBS="-lcrypto $LIBS"], [
@@ -921,8 +927,9 @@ if test X"$OPT_SSL" != Xno; then
    dnl when the ssl shared libs were found in a path that the run-time linker
    dnl when the ssl shared libs were found in a path that the run-time linker
    dnl doesn't search through, we need to add it to LD_LIBRARY_PATH to
    dnl doesn't search through, we need to add it to LD_LIBRARY_PATH to
    dnl prevent further configure tests to fail due to this
    dnl prevent further configure tests to fail due to this
    LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$EXTRA_SSL/lib$libsuff"
    LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$LIB_OPENSSL"
    export LD_LIBRARY_PATH
    export LD_LIBRARY_PATH
    AC_MSG_NOTICE([Added $LIB_OPENSSL to LD_LIBRARY_PATH])
  fi
  fi


fi
fi
@@ -1023,6 +1030,7 @@ if test "$OPENSSL_ENABLED" != "1"; then


        LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$gtlsprefix/lib$libsuff"
        LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$gtlsprefix/lib$libsuff"
        export LD_LIBRARY_PATH
        export LD_LIBRARY_PATH
        AC_MSG_NOTICE([Added $gtlsprefix/lib$libsuff to LD_LIBRARY_PATH])
      fi
      fi


    fi
    fi