diff options
author | Harlan Stenn <stenn@ntp.org> | 2011-08-27 04:06:49 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2011-08-28 14:31:28 -0400 |
commit | 674dc3d34ed0e46890f9db35402841527f2432f3 (patch) | |
tree | 7918b8231565ecc9b2b1e48b42cbd312186c4a57 /m4 | |
parent | b260065ab6306cdeeb08f426cedbf709332ec82f (diff) | |
download | libevent-674dc3d34ed0e46890f9db35402841527f2432f3.tar.gz |
Provide the autoconf m4 macros for the new OpenSSL via pkg-config stuff.
Diffstat (limited to 'm4')
-rw-r--r-- | m4/libevent_openssl.m4 | 47 | ||||
-rw-r--r-- | m4/ntp_pkg_config.m4 | 27 |
2 files changed, 74 insertions, 0 deletions
diff --git a/m4/libevent_openssl.m4 b/m4/libevent_openssl.m4 new file mode 100644 index 00000000..7b273255 --- /dev/null +++ b/m4/libevent_openssl.m4 @@ -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"]) +]) diff --git a/m4/ntp_pkg_config.m4 b/m4/ntp_pkg_config.m4 new file mode 100644 index 00000000..1bce8a6e --- /dev/null +++ b/m4/ntp_pkg_config.m4 @@ -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 + |