Remove unnecessary -l options from LDFLAGS.
authorBruno Haible <bruno@clisp.org>
Wed, 26 Dec 2007 14:59:53 +0000 (15:59 +0100)
committerBruno Haible <bruno@clisp.org>
Wed, 26 Dec 2007 14:59:53 +0000 (15:59 +0100)
ChangeLog
gnulib-tool

index 7aacc8e..1f035ff 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2007-12-22  Bruno Haible  <bruno@clisp.org>
+
+       * gnulib-tool (func_emit_tests_Makefile_am): Replace local_ldadd with
+       two variables local_ldadd_before, local_ldadd_last.
+
 2007-12-20  Eric Blake  <ebb9@byu.net>
 
        Work around circular library issue when cross-compiling.
index 1cdb902..9be0604 100755 (executable)
@@ -1919,14 +1919,21 @@ func_emit_tests_Makefile_am ()
   echo "  -I${testsbase_inverse} -I\$(srcdir)/${testsbase_inverse} \\"
   echo "  -I${testsbase_inverse}/${sourcebase-lib} -I\$(srcdir)/${testsbase_inverse}/${sourcebase-lib}"
   echo
-  local_ldadd=''
+  local_ldadd_before=''
+  local_ldadd_after=''
   if $use_libtests; then
-    local_ldadd=' libtests.a $(LIBTESTS_LIBDEPS)'
+    # All test programs need to be linked with libtests.a.
+    # It needs to be passed to the linker before ${libname}.${libext}, since
+    # the tests-related modules depend on the main modules.
+    # It also needs to be passed to the linker after ${libname}.${libext}
+    # because the latter might contain incomplete modules (such as the 'error'
+    # module whose dependency to 'progname' is voluntarily omitted).
+    # The LIBTESTS_LIBDEPS can be passed to the linker once or twice, it does
+    # not matter.
+    local_ldadd_before=' libtests.a'
+    local_ldadd_after=' libtests.a $(LIBTESTS_LIBDEPS)'
   fi
-  # local_ldadd must be listed first, since it often depends on non-test
-  # modules; it must also be listed last, since it can include modules
-  # such as progname that satisfy dependencies of non-test modules.
-  echo "LDADD =${local_ldadd} ${testsbase_inverse}/${sourcebase-lib}/${libname}.${libext}${local_ldadd}"
+  echo "LDADD =${local_ldadd_before} ${testsbase_inverse}/${sourcebase-lib}/${libname}.${libext}${local_ldadd_after}"
   echo
   if $use_libtests; then
     echo "libtests_a_SOURCES ="