Package: etpan-ng
Version: 0.7.1-5.1
Severity: important
Tags: patch
User: [email protected]
Usertags: origin-ubuntu ubuntu-patch oneiric

etpan-ng fails to build with a linker that defaults to --as-needed, as
shown in this Ubuntu bug report:

  https://bugs.launchpad.net/ubuntu/+source/etpan-ng/+bug/770741

This happens because 'libetpan-config --libs' returns linker options and
libraries all mixed together, but they need to be picked apart so that
the libraries can correctly come after C files / objects.  For a similar
case, see:

  
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=commitdiff;h=f2481f3df4521e731da36afe7f0fe19a5c93e46d

The attached patch fixes this in etpan-ng.

  * Separate the output of 'libetpan-config --libs' into components suitable
    for LDFLAGS and LIBS, fixing build failure with 'ld --as-needed'.

--- etpan-ng-0.7.1.orig/configure.in
+++ etpan-ng-0.7.1/configure.in
@@ -127,7 +127,16 @@
   AC_CHECK_HEADER(libetpan/libetpan.h, [libetpan=yes])
   if test "x$libetpan" = "xyes"; then
     AC_MSG_CHECKING([whether libetpan-config hints compiles and links fine])
-    LDFLAGS="$LDFLAGS `$libetpanconfig --libs 2>/dev/null`"
+    for opt in `$libetpanconfig --libs 2>/dev/null`; do
+      case $opt in
+       -l*)
+         LIBS="$LIBS $opt"
+         ;;
+       *)
+         LDFLAGS="$LDFLAGS $opt"
+         ;;
+      esac
+    done
     AC_TRY_LINK([], [db_mailstorage_init();], [libetpan=yes], [libetpan=no])
     AC_MSG_RESULT([$libetpan])
   fi
--- etpan-ng-0.7.1.orig/configure
+++ etpan-ng-0.7.1/configure
@@ -4775,7 +4775,16 @@
   if test "x$libetpan" = "xyes"; then
     echo "$as_me:$LINENO: checking whether libetpan-config hints compiles and 
links fine" >&5
 echo $ECHO_N "checking whether libetpan-config hints compiles and links 
fine... $ECHO_C" >&6
-    LDFLAGS="$LDFLAGS `$libetpanconfig --libs 2>/dev/null`"
+    for opt in `$libetpanconfig --libs 2>/dev/null`; do
+      case $opt in
+       -l*)
+         LIBS="$LIBS $opt"
+         ;;
+       *)
+         LDFLAGS="$LDFLAGS $opt"
+         ;;
+      esac
+    done
     cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF

-- 
Colin Watson                                       [[email protected]]



-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to