2008-09-03 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>

Use pkg-config if is is available.
	* m4/openssl.m4
pull/1/head
Tatsuhiro Tsujikawa 2008-09-03 14:44:57 +00:00
parent 2439cad4ac
commit 8164c069d9
3 changed files with 90 additions and 38 deletions

View File

@ -1,3 +1,8 @@
2008-09-03 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Use pkg-config if is is available.
* m4/openssl.m4
2008-09-03 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
DEFAULT_ANNOUNCE_INTERVAL: unsigned int -> time_t

42
configure vendored
View File

@ -6499,12 +6499,33 @@ if test "x$openssl_prefix" = "x"; then
openssl_prefix="/usr/local"
fi
openssl_prefix_lib=$openssl_prefix/lib
openssl_prefix_include=$openssl_prefix/include
LIBS_save=$LIBS
CPPFLAGS_save=$CPPFLAGS
PKG_CONFIG="$openssl_prefix/bin/pkg-config"
if test -x $PKG_CONFIG; then
{ echo "$as_me:$LINENO: checking checking availability of openssl using pkg-config" >&5
echo $ECHO_N "checking checking availability of openssl using pkg-config... $ECHO_C" >&6; }
$PKG_CONFIG --exists openssl
if test "$?" = "0"; then
# Use pkg-config to detect LIBS and CFLAGS
OPENSSL_LIBS=`$PKG_CONFIG --libs openssl`
OPENSSL_CFLAGS=`$PKG_CONFIG --cflags openssl`
LIBS="$OPENSSL_LIBS $LIBS"
CPPFLAGS="$OPENSSL_CFLAGS $CPPFLAGS"
have_openssl=yes
{ echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6; }
else
{ echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6; }
fi
fi
if test "x$have_openssl" != "xyes"; then
openssl_prefix_lib=$openssl_prefix/lib
openssl_prefix_include=$openssl_prefix/include
LIBS="-L$openssl_prefix_lib $LIBS"
CPPFLAGS="-I$openssl_prefix_include $CPPFLAGS"
@ -6570,10 +6591,9 @@ fi
{ echo "$as_me:$LINENO: result: $ac_cv_lib_ssl_SSL_library_init" >&5
echo "${ECHO_T}$ac_cv_lib_ssl_SSL_library_init" >&6; }
if test $ac_cv_lib_ssl_SSL_library_init = yes; then
have_openssl=yes; LIBS="-lssl $LIBS"
have_openssl=yes LIBS="-lssl $LIBS"
fi
if test "x$have_openssl" = "xyes"; then
have_openssl=no
{ echo "$as_me:$LINENO: checking for main in -lcrypto" >&5
@ -6635,12 +6655,20 @@ if test $ac_cv_lib_crypto_main = yes; then
have_openssl=yes; LIBS="-lcrypto $LIBS"
fi
if test "x$have_openssl" = "xyes"; then
OPENSSL_LIBS="-L$openssl_prefix_lib -lssl -lcrypto"
OPENSSL_CFLAGS="-I$openssl_prefix_include"
fi
fi
fi
if test "x$have_openssl" = "xyes"; then
cat >>confdefs.h <<\_ACEOF
#define HAVE_LIBSSL 1
_ACEOF
# check whether EVP_DigestInit_ex exists. Old openssl doesn't have it.
for ac_func in EVP_DigestInit_ex
do
@ -6742,10 +6770,9 @@ cat >>confdefs.h <<\_ACEOF
_ACEOF
fi
OPENSSL_LIBS="-L$openssl_prefix_lib -lssl -lcrypto"
OPENSSL_CFLAGS="-I$openssl_prefix_include"
# search for sha256 support
for ac_func in EVP_sha256
do
@ -6841,7 +6868,6 @@ fi
done
fi
fi
LIBS=$LIBS_save
CPPFLAGS=$CPPFLAGS_save

View File

@ -9,35 +9,56 @@ if test "x$openssl_prefix" = "x"; then
openssl_prefix="/usr/local"
fi
openssl_prefix_lib=$openssl_prefix/lib
openssl_prefix_include=$openssl_prefix/include
LIBS_save=$LIBS
CPPFLAGS_save=$CPPFLAGS
PKG_CONFIG="$openssl_prefix/bin/pkg-config"
if test -x $PKG_CONFIG; then
AC_MSG_CHECKING([checking availability of openssl using pkg-config])
$PKG_CONFIG --exists openssl
if test "$?" = "0"; then
# Use pkg-config to detect LIBS and CFLAGS
OPENSSL_LIBS=`$PKG_CONFIG --libs openssl`
OPENSSL_CFLAGS=`$PKG_CONFIG --cflags openssl`
LIBS="$OPENSSL_LIBS $LIBS"
CPPFLAGS="$OPENSSL_CFLAGS $CPPFLAGS"
have_openssl=yes
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
fi
if test "x$have_openssl" != "xyes"; then
openssl_prefix_lib=$openssl_prefix/lib
openssl_prefix_include=$openssl_prefix/include
LIBS="-L$openssl_prefix_lib $LIBS"
CPPFLAGS="-I$openssl_prefix_include $CPPFLAGS"
AC_CHECK_LIB([ssl], [SSL_library_init], [have_openssl=yes; LIBS="-lssl $LIBS"])
AC_CHECK_LIB([ssl], [SSL_library_init], [have_openssl=yes LIBS="-lssl $LIBS"])
if test "x$have_openssl" = "xyes"; then
have_openssl=no
AC_CHECK_LIB([crypto], [main], [have_openssl=yes; LIBS="-lcrypto $LIBS"])
if test "x$have_openssl" = "xyes"; then
OPENSSL_LIBS="-L$openssl_prefix_lib -lssl -lcrypto"
OPENSSL_CFLAGS="-I$openssl_prefix_include"
fi
fi
fi
if test "x$have_openssl" = "xyes"; then
AC_DEFINE([HAVE_LIBSSL], [1], [Define to 1 if you have openssl.])
dnl check whether EVP_DigestInit_ex exists. Old openssl doesn't have it.
# check whether EVP_DigestInit_ex exists. Old openssl doesn't have it.
AC_CHECK_FUNCS([EVP_DigestInit_ex], [have_digestinit_ex=yes])
if test "x$have_digestinit_ex" = "x"; then
AC_DEFINE([HAVE_OLD_LIBSSL], [1], [Define to 1 if you have old openssl.])
fi
OPENSSL_LIBS="-L$openssl_prefix_lib -lssl -lcrypto"
OPENSSL_CFLAGS="-I$openssl_prefix_include"
AC_SUBST(OPENSSL_LIBS)
AC_SUBST(OPENSSL_CFLAGS)
dnl search for sha256 support
# search for sha256 support
AC_CHECK_FUNCS([EVP_sha256])
fi
fi
LIBS=$LIBS_save
CPPFLAGS=$CPPFLAGS_save