From 4571690e600e37b889f46cfc0735cd22a1eb57d9 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Thu, 10 May 2012 10:49:39 -0700 Subject: [PATCH] Fix ENGINE_by_id() and dtls1_stop_timer() checks with non-system OpenSSL If we use AC_CHECK_LIB(-lssl, ...) then it'll use the system libssl even when configured with --with-openssl= to use something different. So switch to using AC_LINK_IFELSE and use $OPENSSL_LIBS (which should be correct) instead. Signed-off-by: David Woodhouse --- configure.ac | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/configure.ac b/configure.ac index 5860fb0..1ea35e3 100644 --- a/configure.ac +++ b/configure.ac @@ -240,14 +240,28 @@ AC_CHECK_HEADER([if_tun.h], [AC_CHECK_HEADER([net/tun/if_tun.h], [AC_DEFINE([IF_TUN_HDR], ["net/tun/if_tun.h"])])])])]) -AC_CHECK_LIB(ssl, ENGINE_by_id, - AC_DEFINE(HAVE_ENGINE, [1], [OpenSSL has ENGINE support]), - AC_MSG_NOTICE([Building without OpenSSL TPM ENGINE support]), - ${OPENSSL_LIBS}) +oldLIBS="$LIBS" +LIBS="$LIBS $OPENSSL_LIBS" -AC_CHECK_LIB(ssl, dtls1_stop_timer, - AC_DEFINE(HAVE_DTLS1_STOP_TIMER, [1], [OpenSSL has dtls1_stop_timer() function]), - ,,${OPENSSL_LIBS}) +AC_MSG_CHECKING([for ENGINE_by_id() in OpenSSL]) +AC_LINK_IFELSE([AC_LANG_PROGRAM( + [#include ], + [ENGINE_by_id("foo");])], + [AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_ENGINE, [1], [OpenSSL has ENGINE support])], + [AC_MSG_RESULT(no) + AC_MSG_NOTICE([Building without OpenSSL TPM ENGINE support])]) + +AC_MSG_CHECKING([for dtls1_stop_timer() in OpenSSL]) +AC_LINK_IFELSE([AC_LANG_PROGRAM( + [#include + #include + extern void dtls1_stop_timer(SSL *);], + [dtls1_stop_timer(NULL);])], + [AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_DTLS1_STOP_TIMER, [1], [OpenSSL has dtls1_stop_timer() function])], + [AC_MSG_RESULT(no)]) +LIBS="$oldLIBS" AC_PATH_PROG(PYTHON, [python], [], $PATH:/bin:/usr/bin) if (test -n "${ac_cv_path_PYTHON}"); then -- 2.7.4