s:\$\(builddir\):\$\(top_builddir\)/lib:g;
} continue { print };
-print "\$(libgnu_la_OBJECTS): \$(gnulib_headers)\n";
+print <<'EOF';
+gnulib_lt_objects = $(libgnu_la_OBJECTS) $(gl_LTLIBOBJS)
+$(gnulib_lt_objects): $(gnulib_headers)
+EOF
# Some filenames are AC_SUBSTed by the Gnulib macros, and thus we need to
# prepend lib/ if and only if they're not empty. Unfortunately, make is not
print M4OUT "dnl This file was generated by fix-gnulib.pl\n";
print M4OUT "AC_DEFUN([$m4macro], [dnl\n";
+ print M4OUT <<'EOF';
+m4_foreach([gl_objvar], [[gl_LIBOBJS], [gl_LTLIBOBJS]], [dnl
+set x $gl_objvar; shift
+gl_objvar=
+while test ${#} -gt 0; do
+ gl_objvar="$gl_objvar lib/${1}"; shift
+done
+])
+EOF
+
foreach (@vars) {
print M4OUT "$_=\${$_:+lib/\$$_}\n";
}