Skip to content

Commit

Permalink
[configure] properly detect if curl was compiled statically with openssl
Browse files Browse the repository at this point in the history
  • Loading branch information
wsnipex committed Jul 18, 2014
1 parent 910a908 commit efd7836
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions configure.in
Expand Up @@ -558,6 +558,8 @@ AC_PROG_MAKE_SET
PKG_PROG_PKG_CONFIG
MAKE="${MAKE:-make}"
OBJDUMP="${OBJDUMP:-objdump}"
READELF="${READELF:-readelf}"
NM="${NM:-nm}"

# host detection and setup
case $host in
Expand Down Expand Up @@ -1054,17 +1056,25 @@ AC_CHECK_HEADER([jpeglib.h],, AC_MSG_ERROR($missing_library))
AC_CHECK_HEADER([ogg/ogg.h],, AC_MSG_ERROR($missing_library))
AC_CHECK_HEADER([vorbis/vorbisfile.h],, AC_MSG_ERROR($missing_library))
AC_CHECK_HEADER([libmodplug/modplug.h],, AC_MSG_ERROR($missing_library))
AC_CHECK_HEADER([curl/curl.h],, AC_MSG_ERROR($missing_library))
AC_CHECK_HEADER([FLAC/stream_decoder.h],, AC_MSG_ERROR($missing_library))

# we need to check for the header because if it exists we set the openssl
# and gcrypt MT callback hooks. This is mostly so that libcurl operates
# in MT manner correctly.
AC_MSG_CHECKING([for CRYPTO_set_locking_callback(0)])
AC_TRY_LINK([],[CRYPTO_set_locking_callback(0);],
[have_curl_static=yes],
[have_curl_static=no])
AC_MSG_RESULT($have_curl_static)
AC_CHECK_HEADER([curl/curl.h],, AC_MSG_ERROR($missing_library))
XB_FIND_SONAME([CURL], [curl])
AC_MSG_CHECKING([for CRYPTO_set_locking_callback(0) in $CURL_SONAME])
if test "$host_vendor" = "apple" ; then
libchecker="$NM"
searchpattern="T [_]?CRYPTO_set_locking_call"
else
libchecker="$READELF -s"
searchpattern="CRYPTO_set_locking_call"
fi
if test $($libchecker $CURL_FILENAME | grep -Eq "${searchpattern}" ; echo $?) -eq 0 ; then
AC_MSG_RESULT(yes)
AC_DEFINE([HAS_CURL_STATIC], [1], [Whether OpenSSL inside libcurl is static.])
else
AC_MSG_RESULT(no)
fi

AC_CHECK_HEADER([openssl/crypto.h], AC_DEFINE([HAVE_OPENSSL],[1],[Define if we have openssl]),)
AC_CHECK_HEADER([gcrypt.h], gcrypt_headers_available=yes,gcrypt_headers_available=no)
if test "$gcrypt_headers_available" = "yes"; then
Expand Down Expand Up @@ -1209,7 +1219,6 @@ fi
fi

XB_FIND_SONAME([OGG], [ogg])
XB_FIND_SONAME([CURL], [curl])
XB_FIND_SONAME([FLAC], [FLAC])
XB_FIND_SONAME([VORBIS], [vorbis])
XB_FIND_SONAME([VORBISFILE], [vorbisfile])
Expand Down Expand Up @@ -1442,11 +1451,6 @@ else
AC_DEFINE([HAVE_LIBSSH], [1], [Whether to use libSSH library.])
fi

# libcurl
if test "x$have_curl_static" = "xyes"; then
AC_DEFINE([HAS_CURL_STATIC], [1], [Whether OpenSSL inside libcurl is static.])
fi

# libRTMP
if test "$use_librtmp" != "no"; then
AC_CHECK_HEADERS([librtmp/log.h librtmp/amf.h librtmp/rtmp.h],,
Expand Down

0 comments on commit efd7836

Please sign in to comment.