diff --git a/configure.ac b/configure.ac index 3b139b3..8ac0015 100644 --- a/configure.ac +++ b/configure.ac @@ -27,6 +27,8 @@ BINARY_LDFLAGS="$PIE_LDFLAGS $RELRO_LDFLAGS" AC_SUBST(BINARY_CFLAGS) AC_SUBST(BINARY_LDFLAGS) +AM_CONDITIONAL(STATIC_OPENSSL, test "$enable_shared" != "yes") + AS_IF([test "$AR_FLAGS" = "cru"], [AR_FLAGS="cr"], []) AC_SUBST([AR_FLAGS]) diff --git a/src/Makefile.am b/src/Makefile.am index 84375f7..aba2947 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -43,8 +43,14 @@ noinst_HEADERS = \ user.h imaptest_CFLAGS = $(AM_CPPFLAGS) $(BINARY_CFLAGS) -imaptest_LDADD = $(LIBDOVECOT_SMTP) $(LIBDOVECOT) $(LIBDOVECOT_SSL) -lm $(BINARY_LDFLAGS) -imaptest_DEPENDENCIES = $(LIBDOVECOT_SMTP_DEPS) $(LIBDOVECOT_DEPS) $(LIBDOVECOT_SSL_DEPS) +imaptest_LDADD = $(LIBDOVECOT_SMTP) $(LIBDOVECOT) -lm $(BINARY_LDFLAGS) +imaptest_DEPENDENCIES = $(LIBDOVECOT_SMTP_DEPS) $(LIBDOVECOT_DEPS) + +if STATIC_OPENSSL +AM_CPPFLAGS += -DSTATIC_OPENSSL +imaptest_LDADD += $(LIBDOVECOT_OPENSSL) $(DOVECOT_SSL_LIBS) +imaptest_DEPENDENCIES = $(LIBDOVECOT_OPENSSL_DEPS) +endif EXTRA_DIST = \ tests/append \ diff --git a/src/imaptest.c b/src/imaptest.c index 0de6469..23a0cf2 100644 --- a/src/imaptest.c +++ b/src/imaptest.c @@ -11,6 +11,9 @@ #include "home-expand.h" #include "smtp-address.h" #include "dsasl-client.h" +#ifdef STATIC_OPENSSL +# include "iostream-openssl.h" +#endif #include "settings.h" #include "mailbox.h" @@ -791,6 +794,9 @@ int main(int argc ATTR_UNUSED, char *argv[]) mailboxes_init(); clients_init(); dsasl_clients_init(); +#ifdef STATIC_OPENSSL + ssl_iostream_openssl_init(); +#endif i_array_init(&clients, CLIENTS_COUNT); if (testpath == NULL) @@ -818,6 +824,9 @@ int main(int argc ATTR_UNUSED, char *argv[]) o_stream_destroy(&results_output); } +#ifdef STATIC_OPENSSL + ssl_iostream_openssl_deinit(); +#endif dsasl_clients_deinit(); lib_signals_deinit(); io_loop_destroy(&ioloop);