Browse Source

try adding -ldl to libs if standard openssl test fails (patch submitted upstream)

miguelfreitas
Miguel Freitas 11 years ago
parent
commit
8e81548ca0
  1. 22
      m4/ax_check_openssl.m4

22
m4/ax_check_openssl.m4

@ -32,14 +32,14 @@
# and this notice are preserved. This file is offered as-is, without any # and this notice are preserved. This file is offered as-is, without any
# warranty. # warranty.
#serial 6 #serial 8
AU_ALIAS([CHECK_SSL], [AX_CHECK_OPENSSL]) AU_ALIAS([CHECK_SSL], [AX_CHECK_OPENSSL])
AC_DEFUN([AX_CHECK_OPENSSL], [ AC_DEFUN([AX_CHECK_OPENSSL], [
found=false found=false
AC_ARG_WITH(openssl, AC_ARG_WITH([openssl],
AS_HELP_STRING([--with-openssl=DIR], [AS_HELP_STRING([--with-openssl=DIR],
[root of the OpenSSL directory]), [root of the OpenSSL directory])],
[ [
case "$withval" in case "$withval" in
"" | y | ye | yes | n | no) "" | y | ye | yes | n | no)
@ -51,7 +51,7 @@ AC_DEFUN([AX_CHECK_OPENSSL], [
], [ ], [
# if pkg-config is installed and openssl has installed a .pc file, # if pkg-config is installed and openssl has installed a .pc file,
# then use that information and don't search ssldirs # then use that information and don't search ssldirs
AC_PATH_PROG(PKG_CONFIG, pkg-config) AC_PATH_PROG([PKG_CONFIG], [pkg-config])
if test x"$PKG_CONFIG" != x""; then if test x"$PKG_CONFIG" != x""; then
OPENSSL_LDFLAGS=`$PKG_CONFIG openssl --libs-only-L 2>/dev/null` OPENSSL_LDFLAGS=`$PKG_CONFIG openssl --libs-only-L 2>/dev/null`
if test $? = 0; then if test $? = 0; then
@ -106,7 +106,16 @@ AC_DEFUN([AX_CHECK_OPENSSL], [
LIBS="$OPENSSL_LIBS $LIBS" LIBS="$OPENSSL_LIBS $LIBS"
CPPFLAGS="$OPENSSL_INCLUDES $CPPFLAGS" CPPFLAGS="$OPENSSL_INCLUDES $CPPFLAGS"
AC_LINK_IFELSE( AC_LINK_IFELSE(
AC_LANG_PROGRAM([#include <openssl/ssl.h>], [SSL_new(NULL)]), [AC_LANG_PROGRAM([#include <openssl/ssl.h>], [SSL_new(NULL)])],
[
AC_MSG_RESULT([yes])
$1
], [
# try adding -ldl to libs before giving up
OPENSSL_LIBS="$OPENSSL_LIBS -ldl"
LIBS="$OPENSSL_LIBS $save_LIBS"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([#include <openssl/ssl.h>], [SSL_new(NULL)])],
[ [
AC_MSG_RESULT([yes]) AC_MSG_RESULT([yes])
$1 $1
@ -114,6 +123,7 @@ AC_DEFUN([AX_CHECK_OPENSSL], [
AC_MSG_RESULT([no]) AC_MSG_RESULT([no])
$2 $2
]) ])
])
CPPFLAGS="$save_CPPFLAGS" CPPFLAGS="$save_CPPFLAGS"
LDFLAGS="$save_LDFLAGS" LDFLAGS="$save_LDFLAGS"
LIBS="$save_LIBS" LIBS="$save_LIBS"

Loading…
Cancel
Save