Mercurial > dovecot > core-2.2
diff dovecot.m4 @ 20935:6339a2e61a01
Moved cc-wrapper.sh handling to dovecot.m4
When configuring Dovecot --without-shared-libs and pointing external plugins
to uninstalled sources --with-dovecot, any binaries complied for plugins
weren't using cc-wrapper.sh, which could have caused runtime failures when
they attempted to load plugins dynamically. Now it's possible to add
DC_CC_WRAPPER to plugins' configure.ac to build with the cc-wrapper.sh.
author | Timo Sirainen <timo.sirainen@dovecot.fi> |
---|---|
date | Mon, 08 Aug 2016 13:12:15 +0300 |
parents | 187ecbcb19e4 |
children | 9f2b885776a1 |
line wrap: on
line diff
--- a/dovecot.m4 Thu Jul 14 20:53:46 2016 +0200 +++ b/dovecot.m4 Mon Aug 08 13:12:15 2016 +0300 @@ -6,7 +6,7 @@ # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. -# serial 23 +# serial 24 AC_DEFUN([DC_DOVECOT_MODULEDIR],[ AC_ARG_WITH(moduledir, @@ -137,3 +137,28 @@ DC_PLUGIN_DEPS DC_DOVECOT_TEST_WRAPPER ]) + +AC_DEFUN([DC_CC_WRAPPER],[ + if test "$want_shared_libs" != "yes"; then + # want_shared_libs=no is for internal use. the liblib.la check is for plugins + if test "$want_shared_libs" = "no" || echo "$LIBDOVECOT" | grep "/liblib.la" > /dev/null; then + if test "$with_gnu_ld" = yes; then + # libtool can't handle using whole-archive flags, so we need to do this + # with a CC wrapper.. shouldn't be much of a problem, since most people + # are building with shared libs. + cat > cc-wrapper.sh <<EOF +#!/bin/sh + +if echo "\$[*]" | grep -- -ldl > /dev/null; then + # the binary uses plugins. make sure we include everything from .a libs + exec $CC -Wl,--whole-archive \$[*] -Wl,--no-whole-archive +else + exec $CC \$[*] +fi +EOF + chmod +x cc-wrapper.sh + CC=`pwd`/cc-wrapper.sh + fi + fi + fi +])