Avoid "touch" in the testsuite. Some older implementations suffer from timestamp truncation bugs, so the assumption that touching a file sets its mtime to be greater than or equal to previously-created files is not correct. For these test cases, we can just append something to the files instead; the file contents are completely irrelevant.
Improve str.gob testcase on non-GNU compilers. Checking for -Wformat warnings from the compiler is not going to work well on non-GNU toolchains, or even on old GNU toolchains where the warning is not enabled by default, or if the user specified something like -w in CFLAGS. Adapt the test to check whether the compiler produces such warnings and produce a skipped result if not.
Avoid using reserved identifiers. In C, all identifiers beginning with an underscore followed by either another underscore or an uppercase letter are reserved for use by the implementation in all contexts. Let's avoid such identifiers in the program proper. Since most problems are declarations like 'typedef struct _Foo Foo;' we can just change this without too much issue. The generated code still does this sort of thing, but unfortunately would be a more significant change as this behaviour is documented.
Allow building against Glib 1.x. In reality, we barely depend on any glib-2 features in the tool itself (of course, the output does require it). Other than very minor additions and pointlessly renamed functions, the only real new feature is the locale-independent g_ascii_xxx case conversions. As we already have an abstraction of these in place it is very easy to just substitute a gnulib-based replacement when configure determines they are unavailable. At the moment, configure does not know how to automatically find glib-1.x, so manually setting LIBGLIB_CFLAGS and LIBGLIB_LIBS is required to build against it. This is probably fine.
Fix testsuite on ancient GLib. Some test cases use private data members and these fail with glib-2.0 as this feature was added somewhere around glib-2.4 or so. Since the program itself works fine with glib-2.0, add a configure check to skip affected tests in this scenario.
Avoid more GLib deprecation warnings. The g_string_sprintf and g_string_sprintfa macros throw deprecation warnings with recent GLib versions. It seems these have been simple shims over g_string_printf and g_string_append_printf, respectively, since approximately forever ago (before GLib 2.0). Should be safe to just switch, then.
Convert command-line options processing to getopt_long. Instead of a hand-written command-line options parser, let's use getopt_long which is hopefully a bit more straightforward to modify. Care has been taken to preserve the current option semantics as closely as possible, including the weird --m4 option behaviour. The Gnulib getopt-gnu module is used for portability.
Expand --no-touch-headers to include the private header. It seems incredibly bizarre that --no-touch-headers does not impact generation of the private header file. Even though this behaviour is documented in the man page, I'm going to go out on a limb and posit that nobody using this option wants or relies on the current behaviour. So let's just change it to make sense.
Improve --version output. A program's version text, when requested by the user, is not an error message. Kind of silly to direct it to the standard error stream. Adjust the program so that version text goes to standard output, and format the message to be consistent with the GNU coding standards.
Make --help output go to standard output. A program's help text, when requested by the user, is not an error message. Kind of silly to direct it to the standard error stream. Adjust the program so that help text goes to standard output, which is consistent with the GNU coding standards. For actual errors, print a simplified usage message to standard error instead of the full help text because otherwise the actual error message is going to scroll right off the screen.