Index: Makefile.in ================================================================== --- Makefile.in +++ Makefile.in @@ -43,11 +43,11 @@ rm -f tls.tcl.h.new.1 mv tls.tcl.h.new.2 tls.tcl.h # Create default DH parameters dh_params.h: @srcdir@/gen_dh_params Makefile - @srcdir@/gen_dh_params @GEN_DH_PARAMS_ARGS@ > dh_params.h.new + sh @srcdir@/gen_dh_params @GEN_DH_PARAMS_ARGS@ > dh_params.h.new mv dh_params.h.new dh_params.h # Generic target for building files from the "srcdir" # tree -- the default target will not match paths .c.o: Index: aclocal/tcltls_openssl.m4 ================================================================== --- aclocal/tcltls_openssl.m4 +++ aclocal/tcltls_openssl.m4 @@ -20,10 +20,11 @@ ]) AC_DEFUN([TCLTLS_SSL_OPENSSL], [ openssldir='' + opensslpkgconfigdir='' AC_ARG_WITH([ssl-dir], AS_HELP_STRING( [--with-ssl-dir=], [deprecated, use --with-openssl-dir -- currently has the same meaning] ), [ @@ -35,10 +36,18 @@ [--with-openssl-dir=], [path to root directory of OpenSSL or LibreSSL installation] ), [ openssldir="$withval" ] + ) + AC_ARG_WITH([openssl-pkgconfig], + AS_HELP_STRING( + [--with-openssl-pkgconfig=], + [path to root directory of OpenSSL or LibreSSL pkgconfigdir] + ), [ + opensslpkgconfigdir="$withval" + ] ) if test -n "$openssldir"; then if test -e "$openssldir/libssl.$SHOBJEXT"; then TCLTLS_SSL_LIBS="-L$openssldir -lssl -lcrypto" @@ -54,10 +63,21 @@ if test "$TCLEXT_BUILD" = "static" -o "$TCLEXT_TLS_STATIC_SSL" = 'yes'; then pkgConfigExtraArgs='--static' fi dnl Use pkg-config to find the libraries + dnl Temporarily update PKG_CONFIG_PATH + PKG_CONFIG_PATH_SAVE="${PKG_CONFIG_PATH}" + if test -n "${opensslpkgconfigdir}"; then + if ! test -f "${opensslpkgconfigdir}/openssl.pc"; then + AC_MSG_ERROR([Unable to locate ${opensslpkgconfigdir}/openssl.pc]) + fi + + PKG_CONFIG_PATH="${opensslpkgconfigdir}${PATH_SEPARATOR}${PKG_CONFIG_PATH}" + export PKG_CONFIG_PATH + fi + AC_ARG_VAR([TCLTLS_SSL_LIBS], [libraries to pass to the linker for OpenSSL or LibreSSL]) AC_ARG_VAR([TCLTLS_SSL_CFLAGS], [C compiler flags for OpenSSL or LibreSSL]) AC_ARG_VAR([TCLTLS_SSL_CPPFLAGS], [C preprocessor flags for OpenSSL or LibreSSL]) if test -z "$TCLTLS_SSL_LIBS"; then TCLTLS_SSL_LIBS="`"${PKGCONFIG}" openssl --libs $pkgConfigExtraArgs`" || AC_MSG_ERROR([Unable to get OpenSSL Configuration]) @@ -66,10 +86,11 @@ TCLTLS_SSL_CFLAGS="`"${PKGCONFIG}" openssl --cflags-only-other $pkgConfigExtraArgs`" || AC_MSG_ERROR([Unable to get OpenSSL Configuration]) fi if test -z "$TCLTLS_SSL_CPPFLAGS"; then TCLTLS_SSL_CPPFLAGS="`"${PKGCONFIG}" openssl --cflags-only-I $pkgConfigExtraArgs`" || AC_MSG_ERROR([Unable to get OpenSSL Configuration]) fi + PKG_CONFIG_PATH="${PKG_CONFIG_PATH_SAVE}" if test "$TCLEXT_BUILD" = "static"; then dnl If we are doing a static build, save the linker flags for other programs to consume rm -f tcltls.a.linkadd AS_ECHO(["$TCLTLS_SSL_LIBS"]) > tcltls.a.linkadd @@ -108,13 +129,13 @@ SAVE_LIBS="${LIBS}" SAVE_CFLAGS="${CFLAGS}" SAVE_CPPFLAGS="${CPPFLAGS}" dnl Update compile-altering variables to include the OpenSSL libraries - LIBS="${SAVE_LIBS} ${TCLTLS_SSL_LIBS}" - CFLAGS="${SAVE_CFLAGS} ${TCLTLS_SSL_CFLAGS}" - CPPFLAGS="${SAVE_CPPFLAGS} ${TCLTLS_SSL_CPPFLAGS}" + LIBS="${TCLTLS_SSL_LIBS} ${SAVE_LIBS} ${TCLTLS_SSL_LIBS}" + CFLAGS="${TCLTLS_SSL_CFLAGS} ${SAVE_CFLAGS} ${TCLTLS_SSL_CFLAGS}" + CPPFLAGS="${TCLTLS_SSL_CPPFLAGS} ${SAVE_CPPFLAGS} ${TCLTLS_SSL_CPPFLAGS}" dnl Verify that basic functionality is there AC_LANG_PUSH(C) AC_MSG_CHECKING([if a basic OpenSSL program works]) AC_LINK_IFELSE([AC_LANG_PROGRAM([ Index: configure.ac ================================================================== --- configure.ac +++ configure.ac @@ -1,7 +1,7 @@ dnl Define ourselves -AC_INIT(tcltls, 1.7.12) +AC_INIT(tcltls, 1.7.13) dnl Checks for programs. AC_PROG_CC AC_PROG_MAKE_SET AC_PROG_INSTALL @@ -202,13 +202,13 @@ AC_MSG_ERROR([Unsupported SSL library: $tcltls_ssl_lib]) ] ) dnl Determine how to use this SSL library AC_MSG_CHECKING([how to use $tcltls_ssl_lib]) -LIBS="${LIBS} ${TCLTLS_SSL_LIBS}" -CFLAGS="${CFLAGS} ${TCLTLS_SSL_CFLAGS}" -CPPFLAGS="${CPPFLAGS} ${TCLTLS_SSL_CPPFLAGS}" +LIBS="${TCLTLS_SSL_LIBS} ${LIBS} ${TCLTLS_SSL_LIBS}" +CFLAGS="${TCLTLS_SSL_CFLAGS} ${CFLAGS} ${TCLTLS_SSL_CFLAGS}" +CPPFLAGS="${TCLTLS_SSL_CPPFLAGS} ${CPPFLAGS} ${TCLTLS_SSL_CPPFLAGS}" AC_MSG_RESULT([$TCLTLS_SSL_CPPFLAGS $TCLTLS_SSL_CFLAGS $TCLTLS_SSL_LIBS]) dnl Sync the RPATH if requested if test "$TCLEXT_BUILD" != 'static'; then if test "$TCLEXT_TLS_STATIC_SSL" = 'yes'; then