Provide the autoconf m4 macros for the new OpenSSL via pkg-config stuff.

This commit is contained in:
Harlan Stenn 2011-08-27 04:06:49 -04:00 committed by Nick Mathewson
parent b260065ab6
commit 674dc3d34e
2 changed files with 74 additions and 0 deletions

47
m4/libevent_openssl.m4 Normal file
View File

@ -0,0 +1,47 @@
dnl ######################################################################
dnl OpenSSL support
AC_DEFUN([LIBEVENT_OPENSSL], [
AC_REQUIRE([NTP_PKG_CONFIG])dnl
case "$enable_openssl" in
yes)
have_openssl=no
case "$PKG_CONFIG" in
'')
;;
*)
OPENSSL_LIBS=`$PKG_CONFIG --libs openssl 2>/dev/null`
case "$OPENSSL_LIBS" in
'') ;;
*) OPENSSL_LIBS="$OPENSSL_LIBS $EV_LIB_GDI $EV_LIB_WS32"
have_openssl=yes
;;
esac
OPENSSL_INCS=`$PKG_CONFIG --cflags openssl 2>/dev/null`
;;
esac
case "$have_openssl" in
yes) ;;
*)
save_LIBS="$LIBS"
LIBS=""
OPENSSL_LIBS=""
AC_SEARCH_LIBS([SSL_new], [ssl],
[have_openssl=yes
OPENSSL_LIBS="$LIBS -lcrypto $EV_LIB_GDI $EV_LIB_WS32"],
[have_openssl=no],
[-lcrypto $EV_LIB_GDI $EV_LIB_WS32])
LIBS="$save_LIBS"
;;
esac
AC_SUBST(OPENSSL_INCS)
AC_SUBST(OPENSSL_LIBS)
case "$have_openssl" in
yes) AC_DEFINE(HAVE_OPENSSL, 1, [Define if the system has openssl]) ;;
esac
;;
esac
# check if we have and should use openssl
AM_CONDITIONAL(OPENSSL, [test "$enable_openssl" != "no" && test "$have_openssl" = "yes"])
])

27
m4/ntp_pkg_config.m4 Normal file
View File

@ -0,0 +1,27 @@
dnl NTP_PKG_CONFIG -*- Autoconf -*-
dnl
dnl Look for pkg-config, which must be at least
dnl $ntp_pkgconfig_min_version.
dnl
AC_DEFUN([NTP_PKG_CONFIG], [
dnl lower the minimum version if you find an earlier one works
ntp_pkgconfig_min_version='0.15.0'
AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
AS_UNSET([ac_cv_path_PKG_CONFIG])
AS_UNSET([ac_cv_path_ac_pt_PKG_CONFIG])
case "$PKG_CONFIG" in
/*)
AC_MSG_CHECKING([if pkg-config is at least version $ntp_pkgconfig_min_version])
if $PKG_CONFIG --atleast-pkgconfig-version $ntp_pkgconfig_min_version; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
PKG_CONFIG=""
fi
;;
esac
]) dnl NTP_PKG_CONFIG