Skip to content

Commit

Permalink
Link libssl_iostream_openssl statically when using --disable-shared
Browse files Browse the repository at this point in the history
  • Loading branch information
sirainen committed Sep 5, 2024
1 parent 4a8fc15 commit 9aff99c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
2 changes: 2 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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])

Expand Down
10 changes: 8 additions & 2 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
9 changes: 9 additions & 0 deletions src/imaptest.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 9aff99c

Please sign in to comment.