Browse Source

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

miguelfreitas
Miguel Freitas 10 years ago
parent
commit
8e81548ca0
  1. 30
      m4/ax_check_openssl.m4

30
m4/ax_check_openssl.m4

@ -24,22 +24,22 @@
# #
# LICENSE # LICENSE
# #
# Copyright (c) 2009, 2010 Zmanda Inc. <http://www.zmanda.com/> # Copyright (c) 2009,2010 Zmanda Inc. <http://www.zmanda.com/>
# Copyright (c) 2009, 2010 Dustin J. Mitchell <dustin@zmanda.com> # Copyright (c) 2009,2010 Dustin J. Mitchell <dustin@zmanda.com>
# #
# Copying and distribution of this file, with or without modification, are # Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice # permitted in any medium without royalty provided the copyright notice
# 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,13 +106,23 @@ 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]) AC_MSG_RESULT([yes])
$1 $1
], [ ], [
AC_MSG_RESULT([no]) # try adding -ldl to libs before giving up
$2 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])
$1
], [
AC_MSG_RESULT([no])
$2
])
]) ])
CPPFLAGS="$save_CPPFLAGS" CPPFLAGS="$save_CPPFLAGS"
LDFLAGS="$save_LDFLAGS" LDFLAGS="$save_LDFLAGS"

Loading…
Cancel
Save