build: deal with newer glibc vs. FORTIFY_SOURCE

Recent glibc (for whatever stupid reason) decided to issue a #warning
when FORTIFY_SOURCE is requested but not possible, due to compilation
without optimization.  But when debugging sources, we don't want our
use of -Werror to kill compilation just because glibc wants to be
chatty; when debugging, we don't care about source fortification.

* configure.ac (FORTIFY_SOURCE): Make conditional on optimization.

Signed-off-by: Eric Blake <eblake@redhat.com>
maint: update copyright year

* all files: Run 'make update-copyright'.
build: get missing from automake, not gnulib

Automake recently changed 'missing' in a backwards-incompatible
manner (that is, the 'missing' from newer automake won't meet the
usage pattern of a makefile generated by an older automake).
While this has since been fixed, the consensus was that gnulib
should not be tracking 'missing' in the first place, since it is
too heavily tied to automake internals and not independently
useful.  We can prepare for this by getting 'missing' as part of
our bootstrap process instead of linking into gnulib.

See https://lists.gnu.org/archive/html/automake-patches/2012-06/msg00154.html
for more discussion.

* build-aux/missing: Break link to gnulib.
* .gitignore: Reflect this.

Signed-off-by: Eric Blake <eblake@redhat.com>
bootstrap: avoid undefined variables

EXIT_SUCCESS, EXIT_FAILURE, and exit_cmd were used uninitialized,
with potentially disastrous results depending on what was inherited
in from the calling environment.

* bootstrap (func_fatal_error, func_usage, func_help)
(func_version): Use constants, not undefined variables; propagate
any write failures.
(func_missing_arg): Drop duplicate declaration.  Preinitialize
exit_cmd.
Reported by Stefano Lattarini.
doc: fix misuse of @xref

Texinfo states that @xref must start a sentence.

* doc/m4.texinfo (Inhibiting Invocation): Reword.

Signed-off-by: Eric Blake <eblake@redhat.com>
build: silence gcc warning

Our next gnulib update will automatically turn on -Wformat=2, which
overrides our attempt to avoid -Wformat-nonliteral.  But for newer
gcc, we don't need to blindly ignore the warning; instead, we can
target just the audited code while leaving the warning to apply to
the rest of the code.  And for older gcc, we just don't use the
warning (that is, warnings are a moving target, and it is fine if
we only target newer gcc for full warnings).

* configure.ac (M4_cv_gcc_pragma_push_works): New test.
(-Wformat-nonliteral): Disable for older gcc.
* src/format.c (expand_format): Mark our only uses of nonliteral
format as being safe.

Signed-off-by: Eric Blake <eblake@redhat.com>
build: mark several pure functions

Found by using gcc 4.7.0's -Wsuggest-attribute=pure.

* src/m4.h (M4_GNUC_PURE): New macro.
* src/m4.c (fault_handler): Mark pure.
* src/builtin.c (find_builtin_by_addr, find_builtin_by_name):
Likewise.
* src/symtab.c (hash): Likewise.

Signed-off-by: Eric Blake <eblake@redhat.com>
build: pick up latest gnulib fixes

It's been quite a while (2393 commits).

* gnulib: Update to latest.
* m4/gnulib-cache.m4: Regenerate.
* missing: Break symlink in order to work around automake version
mismatch issue.
* .gitignore: Update.
* .cvsignore: Likewise.

Signed-off-by: Eric Blake <eblake@redhat.com>
build: add more compiler checking

Enable a bit more gcc warning coverage.

* configure.ac (nw): Turn on some warnings that no longer trigger
a gcc warning, or where we reduce the scope of unwarned code.
* src/m4.h (progname): Drop redundant declaration.
* src/builtin.c (includes): Use header for program_name.

Signed-off-by: Eric Blake <eblake@redhat.com>
maint: drop CVS cruft

These days, no one is complaining about using git as the primary
interface.  Anyone still using CVS can maintain their own ignore files.

* .cvsignore: Remove.
* build-aux/.cvsignore: Likewise.
* checks/.cvsignore: Likewise.
* doc/.cvsignore: Likewise.
* examples/.cvsignore: Likewise.
* src/.cvsignore: Likewise.

Signed-off-by: Eric Blake <eblake@redhat.com>
maint: merge gitignore files

Now that we aren't mirroring .cvsignore files off of the
.gitignore files, we don't need to maintain a hierarchy.

* build-aux/.gitignore: Delete.
* checks/.gitignore: Likewise.
* doc/.gitignore: Likewise.
* examples/.gitignore: Likewise.
* src/.gitignore: Likewise.
* .gitignore: Cover rules from deleted files.

Signed-off-by: Eric Blake <eblake@redhat.com>
maint: convert the last hand-written Makefile to automake

* checks/Makefile.in: Rename ...
* checks/Makefile.am: ... like this, and simplify and adjust to
make it proper as Automake input.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Copyright-paperwork-exempt: yes
maint: enable gcc warnings during git development

Anyone building from git can be assumed to have a new enough gcc
to make warnings by default worthwhile.  Tarballs still default to
no warnings, and if a developer has an issue with the default, they
can still use ./configure --disable-gcc-warnings.

* configure.ac (gl_gcc_warnings): Alter default based on environment.

Signed-off-by: Eric Blake <eblake@redhat.com>
maint: drop more CVS cruft

Commit 47c48ce was intended to remove all CVS support, but missed
some pieces.

* bootstrap (Version control): Don't generate .cvsignore or
prepopulate m4/.gitignore.
* .gitignore: Allow m4/gnulib-cache.m4 manually.
Reported by Stefano Lattarini.

Signed-off-by: Eric Blake <eblake@redhat.com>
doc: improve prehistory discussion

* doc/m4.texinfo (History): Describe M6 and related processors.
From a suggestion by Doug McIlroy in
<http://lists.gnu.org/archive/html/m4-discuss/2012-05/msg00004.html>.
Also, improve citation quality by giving URLs and so forth.
build: avoid problematic gcc 4.4 warnings

Warnings that make sense under newer gcc can cause spurious
failures under older gcc; it's nice to allow out-of-the-box
development on stable releases while still getting the benefit
of improved warning detection in bleeding-edge setups.

* configure.ac (nw): Disable gcc warnings that cause build
failures under RHEL 6.3.
* gnulib: Update to latest.

Signed-off-by: Eric Blake <eblake@redhat.com>
build: update to latest gnulib

* gnulib: Update to latest.

Signed-off-by: Eric Blake <eblake@redhat.com>
maint: move syntax check exemptions into cfg.mk

It's easier to maintain exemptions in a single file than it is
to maintain a bunch of hidden .x files.

* .x-sc_prohibit_tab_based_indentation: Delete file.
* .x-update-copyright: Likewise.
* Makefile.am (syntax_check_exceptions): Delete rule.
* cfg.mk (exclude_file_name_regexp): Move exemptions here.
(local-checks-to-skip): Re-enable copyright check.

Signed-off-by: Eric Blake <eblake@redhat.com>
maint: enable tight_scope syntax check

I noticed that 'make syntax-check' was outputting a warning about
the tight_scope rule being worthless.  This makes the rule work,
ensuring that we use 'static' where possible.

* src/Makefile.am (m4_SOURCES): Move m4.h...
(noinst_HEADERS): ...into separate listing for syntax check.
* src/m4.h: Add 'extern' to function declarations.
(expansion_level): Declare extern variable here...
* src/debug.c: ...not here.

Signed-off-by: Eric Blake <eblake@redhat.com>
maint: update to latest gnulib

Upstream gnulib has added several improvements:

- the regex module allows for rational range interprtation (that
is, guaranteeing that the regex "[a-z]" evaluates to the same 26
bytes as in ASCII, even when in a non-C locale).  Technically,
m4 isn't yet using non-C locales, so I don't know if this will
make much difference, but it can't hurt to include
- various build fixes that I found while smoke-testing on
alternative platforms
- bump the copyright year to 2013 (I'll do m4 next)

* gnulib: Update to latest, for rational range regex, build fixes,
copyright update.
* m4/gnulib-cache.m4: Regenerate.
* NEWS: Document this.

Signed-off-by: Eric Blake <eblake@redhat.com>