Fix problem with _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H on VMS.
[gnulib.git] / gnulib-tool
index 39ac977..1cdb902 100755 (executable)
@@ -1923,7 +1923,10 @@ func_emit_tests_Makefile_am ()
   if $use_libtests; then
     local_ldadd=' libtests.a $(LIBTESTS_LIBDEPS)'
   fi
-  echo "LDADD =${local_ldadd} ${testsbase_inverse}/${sourcebase-lib}/${libname}.${libext}"
+  # 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
   if $use_libtests; then
     echo "libtests_a_SOURCES ="
@@ -1932,6 +1935,8 @@ func_emit_tests_Makefile_am ()
     echo "libtests_a_LIBADD = \$(${macro_prefix}tests_LIBOBJS)"
     echo "libtests_a_DEPENDENCIES = \$(${macro_prefix}tests_LIBOBJS)"
     echo "EXTRA_libtests_a_SOURCES ="
+    # The circular dependency in LDADD requires this.
+    echo "AM_LIBTOOLFLAGS = --preserve-dup-deps"
     echo
   fi
   cat allsnippets.tmp \