* Major changes in Autoconf 2.59e
** Autoconf no longer depends on whether m4wrap is FIFO (as Posix requires)
- or LIFO (as in GNU m4 1.4.x). GNU m4 2.0 is expected to conform to Posix
+ or LIFO (as in GNU M4 1.4.x). GNU M4 2.0 is expected to conform to Posix
here, so m4wrap/m4_wrap users should no longer depend on LIFO behavior.
* Major changes in Autoconf 2.59d
especially useful for initial "bootstrapping" of fresh CVS checkouts.
** AC_CONFIG_MACRO_DIR
- Use this macro to declare the directory for local m4 macros for aclocal.
+ Use this macro to declare the directory for local M4 macros for aclocal.
** AC_LIBOBJS
No longer includes twice the same file in LIBOBJS if invoked
Released 2002-12-03 by Paul Eggert.
Bug fixes for problems with AIX linker, with freestanding C compilers,
-with GNU m4 limitations, and with obsolete copies of GNU documents.
+with GNU M4 limitations, and with obsolete copies of GNU documents.
The Free Documentation License has been upgraded from 1.1 to 1.2.
\f
** Use of Automake
All the standard GNU Makefile targets are supported. The layout has
-changed: m4/ holds the m4 extensions Autoconf needs for its
+changed: m4/ holds the M4 extensions Autoconf needs for its
configuration, doc/ contains the documentation, and tests/ contains
the test suite.
internals of version 1. Future releases of those packages will have
updated configure.in files.
-It's best to use GNU m4 1.3 (or later) with Autoconf version 2.
-Autoconf now makes heavy use of m4 diversions, which were implemented
-inefficiently in GNU m4 releases before 1.3.
+It's best to use GNU M4 1.3 (or later) with Autoconf version 2.
+Autoconf now makes heavy use of M4 diversions, which were implemented
+inefficiently in GNU M4 releases before 1.3.
\f
Major changes in Autoconf 2.0:
* New macros AC_HAVE_POUNDBANG, AC_TIME_WITH_SYS_TIME, AC_LONG_DOUBLE,
AC_GETGROUPS_T, AC_DEFINE_UNQUOTED.
* autoconf and autoheader use the M4 environment variable to determine the
- name of the m4 program to use.
+ name of the M4 program to use.
* The --macrodir option to autoconf and autoheader specifies the directory
in which acspecific.m4, acgeneral.m4, etc. reside if not the default.
* autoconf and autoheader can take `-' as their file names, which means to
expansion done by the shell. If you don't want this, use
AC_DEFINE_UNQUOTED instead.
* Much textual processing done with external calls to tr and sed have been
- internalized with builtin m4 `patsubst' and `translit' calls.
+ internalized with builtin M4 `patsubst' and `translit' calls.
* AC_OUTPUT doesn't hardwire the file names it outputs. Instead, you can
set the shell variables `gen_files' and `gen_config' to the list of
file names to output.
Frequent Autoconf Questions, with answers
* Distributing:: Distributing @command{configure} scripts
-* Why GNU m4:: Why not use the standard M4?
+* Why GNU M4:: Why not use the standard M4?
* Bootstrapping:: Autoconf and @acronym{GNU} M4 require each other?
* Why Not Imake:: Why @acronym{GNU} uses @command{configure} instead of Imake
* Defining Directories:: Passing @code{datadir} to program
@node The GNU Build System
@chapter The @acronym{GNU} Build System
-@cindex GNU build system
+@cindex @acronym{GNU} build system
Autoconf solves an important problem---reliable discovery of
system-specific build and runtime information---but this is only one
infrastructure to a source package. If you use @command{autopoint},
your @file{configure.ac} should invoke both @code{AM_GNU_GETTEXT} and
@code{AM_GNU_GETTEXT_VERSION(@var{gettext-version})}. @xref{autopoint
-Invocation, , Invoking the @code{autopoint} Program, gettext, GNU
-@code{gettext} utilities}, for further details.
+Invocation, , Invoking the @code{autopoint} Program, gettext,
+@acronym{GNU} @code{gettext} utilities}, for further details.
@noindent
@command{autoreconf} accepts the following options:
@defvar oldincludedir
@ovindex oldincludedir
-The directory for installing C header files for non-GCC compilers.
+The directory for installing C header files for non-@acronym{GCC} compilers.
@end defvar
@defvar pdfdir
On various old systems, e.g., HP-UX 9, @code{sscanf} requires that its
input string be writable (though it doesn't actually change it). This
can be a problem when using @command{gcc} since it normally puts
-constant strings in read-only memory
-(@pxref{Incompatibilities, Incompatibilities of GCC, , gcc, Using and
+constant strings in read-only memory (@pxref{Incompatibilities,
+Incompatibilities of @acronym{GCC}, , gcc, Using and
Porting the @acronym{GNU} Compiler Collection}). Apparently in some cases even
having format strings read-only can be a problem.
@item @file{limits.h}
C99 says that @file{limits.h} defines @code{LLONG_MIN},
@code{LLONG_MAX}, and @code{ULLONG_MAX}, but many almost-C99
-environments (e.g., default GCC 4.0.2 + glibc 2.4) do not define them.
+environments (e.g., default @acronym{GCC} 4.0.2 + glibc 2.4) do not
+define them.
@item @file{inttypes.h} vs.@: @file{stdint.h}
@hdrindex{inttypes.h}
execute when one of the function declarations is needed, otherwise
@var{action-if-found} is executed.
-This macro uses an m4 list as first argument:
+This macro uses an M4 list as first argument:
@example
AC_CHECK_DECLS([strdup])
AC_CHECK_DECLS([strlen])
members. If @var{action-if-not-found} is given, it is executed for each
of the members that could not be found.
-This macro uses m4 lists:
+This macro uses M4 lists:
@example
AC_CHECK_MEMBERS([struct stat.st_rdev, struct stat.st_blksize])
@end example
when one of the types is found. If @var{action-if-not-found} is given,
it is executed when one of the types is not found.
-This macro uses m4 lists:
+This macro uses M4 lists:
@example
AC_CHECK_TYPES([ptrdiff_t])
AC_CHECK_TYPES([unsigned long long int, uintmax_t])
preprocessor. If this macro is used, warnings count as fatal
errors for the current language. This macro is useful when the
results of configuration are used where warnings are unacceptable; for
-instance, if parts of a program are built with the GCC @option{-Werror}
+instance, if parts of a program are built with the @acronym{GCC}
+@option{-Werror}
option. If the whole program is built using @option{-Werror} it is
often simpler to put @option{-Werror} in the compiler flags (@code{CFLAGS},
etc.).
If using the @acronym{GNU} C compiler, set shell variable @code{GCC} to
@samp{yes}. If output variable @code{CFLAGS} was not already set, set
it to @option{-g -O2} for the @acronym{GNU} C compiler (@option{-O2} on systems
-where GCC does not accept @option{-g}), or @option{-g} for other compilers.
+where @acronym{GCC} does not accept @option{-g}), or @option{-g} for
+other compilers.
@end defmac
@defmac AC_PROG_CC_C_O
as this generally yields better results in practice. However, using a
C++ compiler to compile C code is not recommended or supported, and
installers who run into trouble in this area should get a C compiler
-like GCC to compile their C code.
+like @acronym{GCC} to compile their C code.
This macro is obsolescent, as current C compilers support @code{const}.
New programs need not use this macro.
@acindex{C_TYPEOF}
@cvindex HAVE_TYPEOF
@cvindex typeof
-If the C compiler supports GCC's @code{typeof} syntax either directly or
+If the C compiler supports @acronym{GCC}'s @code{typeof} syntax either
+directly or
through a different spelling of the keyword (e.g., @code{__typeof__}),
define @code{HAVE_TYPEOF}. If the support is available only through a
different spelling, define @code{typeof} to that spelling.
whether it exists), organize the program to ensure that it never invokes
that function. You can do this by calling it in another function that is
never invoked. You can't do it by putting it after a call to
-@code{exit}, because GCC version 2 knows that @code{exit} never returns
+@code{exit}, because @acronym{GCC} version 2 knows that @code{exit}
+never returns
and optimizes out any code that follows it in the same block.
If you include any header files, be sure to call the functions
relevant to them with the correct number of arguments, even if they are
-just 0, to avoid compilation errors due to prototypes. GCC version 2
+just 0, to avoid compilation errors due to prototypes. @acronym{GCC}
+version 2
has internal prototypes for several functions that it automatically
inlines; for example, @code{memcpy}. To avoid errors when checking for
them, either pass them the correct number of arguments or redeclare them
The Autoconf suite, including M4sugar, M4sh, and Autotest, in addition
to Autoconf per se, heavily rely on M4. All these different uses
-revealed common needs factored into a layer over @command{m4}:
+revealed common needs factored into a layer over M4:
@command{autom4te}@footnote{
@c
Yet another great name from Lars J. Aas.
@noindent
@evindex M4
where the @var{files} are directly passed to @command{m4}. By default,
-@acronym{GNU} m4 is found during configure, but the environment variable
+@acronym{GNU} M4 is found during configuration, but the environment
+variable
@env{M4} can be set to tell @command{autom4te} where to look. In addition
to the regular expansion, it handles the replacement of the quadrigraphs
(@pxref{Quadrigraphs}), and of @samp{__oline__}, the current line in the
@acronym{GNU} Build System: @command{autoheader} uses them to build
@file{config.h.in}, @command{autoreconf} to determine what
@acronym{GNU} Build System components are used, @command{automake} to
-``parse'' @file{configure.ac} etc. To save the long runs of
-@command{m4}, traces are cached while performing regular expansion,
+``parse'' @file{configure.ac} etc. To avoid recomputation,
+traces are cached while performing regular expansion,
and conversely. This cache is (actually, the caches are) stored in
the directory @file{autom4te.cache}. @emph{It can safely be removed}
at any moment (especially if for some reason @command{autom4te}
@acronym{GNU} M4 versions through 1.4.x, however, reprocess them in
reverse order. Your code should not depend on the order.
+Also, Posix requires @code{m4wrap} to ignore its second and succeeding
+arguments, but @acronym{GNU} M4 versions through 1.4.x concatenate the
+arguments with intervening spaces. Your code should not pass more than
+one argument.
+
You are encouraged to end @var{text} with @samp{[]}, to avoid unexpected
token pasting between consecutive invocations of @code{m4_wrap}, as in:
@defmac m4_foreach (@var{var}, @var{list}, @var{expression})
@msindex{foreach}
-Loop over the comma-separated m4 list @var{list}, assigning each value
+Loop over the comma-separated M4 list @var{list}, assigning each value
to @var{var}, and expand @var{expression}. The following example
outputs two lines:
You can refer to any arguments passed to the macro as @samp{$1},
@samp{$2}, etc. @xref{Definitions, , How to define new macros, m4.info,
-@acronym{GNU} m4}, for more complete information on writing M4 macros.
+@acronym{GNU} M4}, for more complete information on writing M4 macros.
Be sure to properly quote both the @var{macro-body} @emph{and} the
@var{macro-name} to avoid any problems if the macro happens to have
standard Posix options @option{-A}, @option{-j}, @option{-N}, or
@option{-t}, or the @acronym{XSI} option @option{-s}. The only
supported Posix option is @option{-v}, and the only supported
-@acronym{XSI} options are those in @option{-bcdox}. The BSD
+@acronym{XSI} options are those in @option{-bcdox}. The @acronym{BSD}
@command{hexdump} program can be used instead.
This problem no longer exists in Mac OS X 10.4.3.
@command{touch} fails. One way to work around this is to reword the
affected simple-commands so that they always succeed, e.g., @samp{touch
T || :; rm -f U}.
-However, even this approach can run into common bugs in BSD
+However, even this approach can run into common bugs in @acronym{BSD}
implementations of the @option{-e} option of @command{sh} and
@command{set} (@pxref{Limitations of Builtins}), so if you are worried
-about porting to buggy BSD shells it may be simpler to migrate
+about porting to buggy @acronym{BSD} shells it may be simpler to migrate
complicated @command{make} actions into separate scripts.
@node Special Chars in Names
Several standards have been developed to help make your programs more
portable. If you write programs with these standards in mind, you can
have greater confidence that your programs work on a wide variety
-of systems. @xref{Standards, , Language Standards Supported by GCC,
-gcc, Using the GNU Compiler Collection (GCC)}, for a list of C-related
+of systems. @xref{Standards, , Language Standards Supported by
+@acronym{GCC}, gcc, Using the @acronym{GNU} Compiler Collection
+(@acronym{GCC})}, for a list of C-related
standards. Many programs also assume the
@uref{http://www.opengroup.org/susv3, Posix standard}.
even though the C standard requires @code{INT_MIN % -1} to yield zero
because the expression does not overflow.
-GCC users might consider using the
+@acronym{GCC} users might consider using the
@option{-ftrapv} option if they are worried about porting their code to
the rare platforms where signed integer overflow does not wrap around
after addition, subtraction, or multiplication.
potential portability problem, e.g., by allocating an extra unused array
element at the start or end.
-@uref{http://valgrind.org/, Valgrind} can catch many overruns. GCC
+@uref{http://valgrind.org/, Valgrind} can catch many overruns.
+@acronym{GCC}
users might also consider using the @option{-fmudflap} option to catch
overruns.
Using @code{int} values to index into an array or compute array sizes
causes problems on typical 64-bit hosts where an array index might
-be @math{2^31} or larger.
+be @math{2^31} or larger. Index values of type @code{size_t} avoid this
+problem, but cannot be negative. Index values of type @code{ptrdiff_t}
+are signed, and are wide enough in practice.
If you add or multiply two numbers to calculate an array size, e.g.,
@code{malloc (x * sizeof y + z)}, havoc ensues if the addition or
within certain limits. The time-related functions can overflow their
buffers if given timestamps out of range (e.g., a year less than -999
or greater than 9999). Time-related buffer overflows cannot happen with
-recent-enough versions of the GNU C library, but are possible with other
+recent-enough versions of the @acronym{GNU} C library, but are possible
+with other
implementations. The @code{gets} function is the worst, since it almost
invariably overflows its buffer when presented with an input line larger
than the buffer.
@menu
* Distributing:: Distributing @command{configure} scripts
-* Why GNU m4:: Why not use the standard M4?
+* Why GNU M4:: Why not use the standard M4?
* Bootstrapping:: Autoconf and @acronym{GNU} M4 require each other?
* Why Not Imake:: Why @acronym{GNU} uses @command{configure} instead of Imake
* Defining Directories:: Passing @code{datadir} to program
same terms as the rest of your package. @file{install-sh} is from the X
Consortium and is not copyrighted.
-@node Why GNU m4
+@node Why GNU M4
@section Why Require @acronym{GNU} M4?
@display