+ s:%reldir%:lib:g;
+
+ # If we installed a dirstamp prerequisite for this target, don't
+ # emit the mkdir line which creates the output directory.
+ if ($have_dirstamp && m|\$[({]MKDIR_P[})][ '"]*lib/|) {
+ drop unless s/^(\t\$[({](AM_V_GEN|gl_V_at)[})]).*/\1:/;
+ }
+ undef $have_dirstamp if /^\t/;
+} continue { s/(\n.)/\\\1/g; print; };
+
+# Define a bunch of fake programs which will ensure Automake produces the
+# necessary dirstamp rules, as unfortunately we cannot know in advance which
+# will be generated, and the usual Automake behaviour where generated rules
+# are suppressed by rules in Makefile.am doesn't actaully work for these.
+print <<EOF foreach (keys %gl_dirstamps);
+EXTRA_PROGRAMS += $_/gl-dirstamp
+${\(y|/|_|r)}_gl_dirstamp_SOURCES =
+EOF
+
+print <<'EOF' if ($use_libtool);
+gnulib_lt_objects = $(libgnu_la_OBJECTS) $(gl_LTLIBOBJS)
+gnulib_objects = $(gnulib_lt_objects)
+gnulib_all_symfiles = $(gnulib_lt_objects:.lo=.glsym)
+$(gnulib_objects): $(gnulib_headers)
+EOF
+print <<'EOF' if (!$use_libtool);
+gnulib_objects = $(libgnu_a_OBJECTS) $(gl_LIBOBJS)
+gnulib_all_symfiles = $(gnulib_objects:.@OBJEXT@=.glsym)
+$(gnulib_objects): $(gnulib_headers)
+EOF
+
+print @cleanfiles;
+
+print <<'EOF';
+if FALSE
+], [dnl M4 code follows
+
+AC_SUBST([GLSRC], [lib])
+AC_CONFIG_LIBOBJ_DIR([lib])
+
+AC_DEFUN_ONCE([DX_GLSYM_PREFIX],
+[AC_REQUIRE([DX_AUTOMAKE_COMPAT])AC_REQUIRE([DX_EXPORTED_SH])dnl
+AC_SUBST([GLSYM_PREFIX], [$1])dnl
+AC_SUBST([gnulib_symfiles], ['$(gnulib_all_symfiles)'])])
+EOF
+
+print <<'EOF' if ($for_library);
+AC_CONFIG_COMMANDS_PRE([DX_GLSYM_PREFIX([${PACKAGE}__])])
+EOF
+
+print <<'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