Index: .fossil-settings/ignore-glob ================================================================== --- .fossil-settings/ignore-glob +++ .fossil-settings/ignore-glob @@ -8,10 +8,11 @@ Makefile config.status pkgIndex.tcl tcltls.so tcltls.a +tcltls.a.linkadd tls.o tlsBIO.o tlsIO.o tlsX509.o tls.tcl.h Index: Makefile.in ================================================================== --- Makefile.in +++ Makefile.in @@ -60,10 +60,11 @@ # distribution tarball distclean: clean rm -f config.log config.status rm -f dh_params.h.new dh_params.h rm -f Makefile pkgIndex.tcl + rm -f tcltls.a.linkadd # Clean the local build directory back to only thing things that exist in # version control system mrproper: distclean rm -f @srcdir@/tls.tcl.h Index: aclocal/tcltls_openssl.m4 ================================================================== --- aclocal/tcltls_openssl.m4 +++ aclocal/tcltls_openssl.m4 @@ -47,23 +47,34 @@ TCLTLS_SSL_LIBS="-L$openssldir/lib -lssl -lcrypto" fi TCLTLS_SSL_CFLAGS="-I$openssldir/include" TCLTLS_SSL_CPPFLAGS="-I$openssldir/include" fi + + pkgConfigExtraArgs='' + if test "$TCLEXT_BUILD" = "static"; then + pkgConfigExtraArgs='--static' + fi dnl Use pkg-config to find the libraries 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`" || AC_MSG_ERROR([Unable to get OpenSSL Configuration]) + TCLTLS_SSL_LIBS="`"${PKGCONFIG}" openssl --libs $pkgConfigExtraArgs`" || AC_MSG_ERROR([Unable to get OpenSSL Configuration]) fi if test -z "$TCLTLS_SSL_CFLAGS"; then - TCLTLS_SSL_CFLAGS="`"${PKGCONFIG}" openssl --cflags-only-other`" || AC_MSG_ERROR([Unable to get OpenSSL Configuration]) + 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`" || AC_MSG_ERROR([Unable to get OpenSSL Configuration]) + TCLTLS_SSL_CPPFLAGS="`"${PKGCONFIG}" openssl --cflags-only-I $pkgConfigExtraArgs`" || AC_MSG_ERROR([Unable to get OpenSSL Configuration]) + fi + + 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 fi dnl Save compile-altering variables we are changing SAVE_LIBS="${LIBS}" SAVE_CFLAGS="${CFLAGS}"