Mercurial > dovecot > core-2.2
changeset 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 |
files | Makefile.am cc-wrapper.sh.in configure.ac dovecot.m4 |
diffstat | 4 files changed, 27 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/Makefile.am Thu Jul 14 20:53:46 2016 +0200 +++ b/Makefile.am Mon Aug 08 13:12:15 2016 +0300 @@ -13,7 +13,6 @@ COPYING.LGPL \ COPYING.MIT \ ChangeLog \ - cc-wrapper.sh.in \ update-version.sh \ run-test-valgrind.supp \ $(conf_DATA)
--- a/cc-wrapper.sh.in Thu Jul 14 20:53:46 2016 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -#!/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
--- a/configure.ac Thu Jul 14 20:53:46 2016 +0200 +++ b/configure.ac Mon Aug 08 13:12:15 2016 +0300 @@ -2860,14 +2860,7 @@ LDFLAGS="\$(NOPLUGIN_LDFLAGS) $LDFLAGS" AC_SUBST(NOPLUGIN_LDFLAGS) -if test "$with_gnu_ld" = yes -a "$want_shared_libs" = "no"; 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. - sed "s:@CC@:$CC:" < $srcdir/cc-wrapper.sh.in > cc-wrapper.sh - chmod +x cc-wrapper.sh - CC=`pwd`/cc-wrapper.sh -fi +DC_CC_WRAPPER if test "$docdir" = ""; then dnl docdir supported only by autoconf v2.59c and later
--- 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 +])