(Invoking autoconf): A better help on --trace.
(Defining Symbols): Advocate a proper use of the quotes in m4
code, including if the quotes are sometimes useless. It is bad,
very bad not to quote properly, so quote all the examples
properly.
(Cache Files): Use a unary call to define, instead of an empty
$2.
(Using System Type): Watch out TeX wrapping.
(Pretty Help Strings): Don't give too long a snippet of --help.
Promote the coding style of Autoconf. Quote properly.
+2000-02-08 Akim Demaille <akim@epita.fr>
+
+ * doc/autoconf.texi (Introduction): m4 1.4 is now required.
+ (Invoking autoconf): A better help on --trace.
+ (Defining Symbols): Advocate a proper use of the quotes in m4
+ code, including if the quotes are sometimes useless. It is bad,
+ very bad not to quote properly, so quote all the examples
+ properly.
+ (Cache Files): Use a unary call to define, instead of an empty
+ $2.
+ (Using System Type): Watch out TeX wrapping.
+ (Pretty Help Strings): Don't give too long a snippet of --help.
+ Promote the coding style of Autoconf. Quote properly.
+
2000-02-08 Akim Demaille <akim@epita.fr>
* acgeneral.m4 (AC_PRO): Use AC_PROVIDE instead of defining
scripts, Autoconf scripts can support cross-compiling, if some care is
taken in writing them.
-There are several jobs related to making portable software packages
-that Autoconf currently does not do. Among these are automatically
-creating @file{Makefile} files with all of the standard targets, and
-supplying replacements for standard library functions and header files on
-systems that lack them. Work is in progress to add those features in
-the future.
+@c FIXME: Tom, your cue is here.
+There are several jobs related to making portable software packages that
+Autoconf currently does not do. Among these are automatically creating
+@file{Makefile} files with all of the standard targets, and supplying
+replacements for standard library functions and header files on systems
+that lack them. Work is in progress to add those features in the
+future.
Autoconf imposes some restrictions on the names of macros used with
@code{#if} in C programs (@pxref{Preprocessor Symbol Index}).
Autoconf requires GNU @code{m4} in order to generate the scripts. It
-uses features that some UNIX versions of @code{m4} do not have. It also
-overflows internal limits of some versions of @code{m4}, including GNU
-@code{m4} 1.0. You must use version 1.1 or later of GNU @code{m4}.
-Using version 1.3 or later will be much faster than 1.1 or 1.2.
+uses features that some UNIX versions of @code{m4} do not have,
+including GNU @code{m4} 1.3. You must use version 1.4 or later of GNU
+@code{m4}.
@xref{Upgrading}, for information about upgrading from version 1.
@xref{History}, for the story of Autoconf's development.
To encourage consistency, here is a suggested order for calling the
Autoconf macros. Generally speaking, the things near the end of this
list could depend on things earlier in it. For example, library
-functions could be affected by typedefs and libraries.
+functions could be affected by types and libraries.
@display
@group
checks for programs
checks for libraries
checks for header files
-checks for typedefs
+checks for types
checks for structures
checks for compiler characteristics
checks for library functions
@item --trace=@var{macro}
@itemx -t @var{macro}
List the calls to @var{macro}. Multiple calls to @samp{--trace} list
-several macros. It is advised to use this feature instead of parsing
+several macros. It is often needed to check the content of a
+@file{configure.in} file, but it is extremely fragile and error prone to
+try to parse it. It is suggested to rely upon @samp{--trace} to scan
@file{configure.in}.
The output is composed of separated lines for each macro call. Each
@item --output=@var{file}
@itemx -o @var{file}
-Save output (script or traces) to @var{file}. The file @samp{-} stands
+Save output (script or trace) to @var{file}. The file @samp{-} stands
for the standard output.
@end table
program into your @file{Makefile.in} files.
@end defmac
+@defmac AC_PROG_GNU_M4
+@maindex PROG_GNU_M4
+@ovindex GNU_M4
+If GNU @code{m4} version 1.4 or above is found, set output variable
+@code{M4} to @samp{m4}.
+@end defmac
+
+
@defmac AC_PROG_LEX
@maindex PROG_LEX
@ovindex LEX
appropriate cache variable, as in this example:
@example
-AC_CHECK_FUNC(vprintf, AC_DEFINE(HAVE_VPRINTF))
+AC_CHECK_FUNC(vprintf, [AC_DEFINE(HAVE_VPRINTF)])
if test "$ac_cv_func_vprintf" != yes; then
-AC_CHECK_FUNC(_doprnt, AC_DEFINE(HAVE_DOPRNT))
+AC_CHECK_FUNC(_doprnt, [AC_DEFINE(HAVE_DOPRNT)])
fi
@end example
newlines. That is, do this:
@example
-AC_CHECK_HEADER(elf.h, AC_DEFINE(SVR4) LIBS="$LIBS -lelf")
+AC_CHECK_HEADER(elf.h, [AC_DEFINE(SVR4) LIBS="$LIBS -lelf"])
@end example
@noindent
@example
AC_CHECK_HEADER(elf.h,
- AC_DEFINE(SVR4)
- LIBS="$LIBS -lelf")
+ [AC_DEFINE(SVR4)
+ LIBS="$LIBS -lelf"])
@end example
@noindent
instead of this:
@example
-AC_CHECK_HEADER(elf.h, AC_DEFINE(SVR4); LIBS="$LIBS -lelf")
+AC_CHECK_HEADER(elf.h, [AC_DEFINE(SVR4); LIBS="$LIBS -lelf"])
@end example
@node Setting Output Variables, Caching Results, Defining Symbols, Results
by redefining the cache macros at the start of @file{configure.in}:
@example
-define([AC_CACHE_LOAD], )dnl
-define([AC_CACHE_SAVE], )dnl
+define([AC_CACHE_LOAD])dnl
+define([AC_CACHE_SAVE])dnl
AC_INIT(@r{whatever})
@r{ ... rest of configure.in ...}
@end example
The full path names to files, including programs.
@item PROG
The base names of programs.
-@item STRUCT
-Definitions of C structures in header files.
+@item MEMBER
+Members of aggregates.
@item SYS
Operating system features.
@item TYPE
For example, this call:
@example
-AC_CONFIG_LINKS(host.h:config/$@{machine@}.h object.h:config/$@{obj_format@}.h)
+AC_CONFIG_LINKS(host.h:config/$@{machine@}.h
+ object.h:config/$@{obj_format@}.h)
@end example
@noindent
@file{@var{srcdir}/config/$@{machine@}.h}, and @file{object.h}, which is a link
to @file{@var{srcdir}/config/$@{obj_format@}.h}.
-The tempting value @samp{.} for @var{dest} is made invalid: it makes it
+The tempting value @samp{.} for @var{dest} is invalid: it makes it
impossible for @samp{config.status} to guess the links to establish. It
-is therefore valid to run
+is then valid to run
@example
./config.status host.h object.h
@end example
would have been written:
@example
-AC_LINK_FILES(config/$@{machine@}.h config/$@{obj_format@}.h, host.h object.h)
+AC_LINK_FILES(config/$@{machine@}.h config/$@{obj_format@}.h,
+ host.h object.h)
@end example
@end defmac
@example
AC_DEFUN(TEST_MACRO,
-[
- AC_ARG_WITH(foo,
- AC_HELP_STRING([--with-foo], [use foo (default is NO)],
- ac_cv_use_foo=$withval, ac_cv_use_foo=no)
- AC_CACHE_CHECK(whether to use foo, ac_cv_use_foo, ac_cv_use_foo=no)
-])
+[AC_ARG_WITH(foo,
+ AC_HELP_STRING([--with-foo], [use foo (default is NO)],
+ ac_cv_use_foo=$withval, ac_cv_use_foo=no)
+AC_CACHE_CHECK(whether to use foo, ac_cv_use_foo, ac_cv_use_foo=no)])
@end example
Please note that the call to @code{AC_HELP_STRING} is @strong{unquoted}.
this:
@example
-Features and packages:
- --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
- --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
- --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
- --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
- --x-includes=DIR X include files are in DIR
- --x-libraries=DIR X library files are in DIR
-
--enable and --with options recognized:
--with-foo use foo (default is NO)
@end example
@example
AC_DEFUN(MY_ARG_WITH,
-[
- AC_ARG_WITH($1,
- AC_HELP_STRING([--with-$1], [use $1 (default is $2)]),
- ac_cv_use_$1=$withval, ac_cv_use_$1=no)
-
- AC_CACHE_CHECK(whether to use $1, ac_cv_use_$1, ac_cv_use_$1=$2)
-])
+[AC_ARG_WITH([$1],
+ AC_HELP_STRING([--with-$1], [use $1 (default is $2)]),
+ ac_cv_use_$1=$withval, ac_cv_use_$1=no)
+AC_CACHE_CHECK(whether to use $1, ac_cv_use_$1, ac_cv_use_$1=$2)])
@end example
@end defmac
__line__
@end example
+Autoconf requires version 1.4 or above of GNU @code{m4} because it
+uses frozen state files.
+
Since only software maintainers need to use Autoconf, and since GNU
@code{m4} is simple to configure and install, it seems reasonable to
require GNU @code{m4} to be installed also. Many maintainers of GNU and
@section How Can I Bootstrap?
@display
-If Autoconf requires GNU @code{m4} and GNU @code{m4} has an
-Autoconf @code{configure} script, how do I bootstrap? It seems
-like a chicken and egg problem!
+If Autoconf requires GNU @code{m4} and GNU @code{m4} has an Autoconf
+@code{configure} script, how do I bootstrap? It seems like a chicken
+and egg problem!
@end display
This is a misunderstanding. Although GNU @code{m4} does come with a
scripts, Autoconf scripts can support cross-compiling, if some care is
taken in writing them.
-There are several jobs related to making portable software packages
-that Autoconf currently does not do. Among these are automatically
-creating @file{Makefile} files with all of the standard targets, and
-supplying replacements for standard library functions and header files on
-systems that lack them. Work is in progress to add those features in
-the future.
+@c FIXME: Tom, your cue is here.
+There are several jobs related to making portable software packages that
+Autoconf currently does not do. Among these are automatically creating
+@file{Makefile} files with all of the standard targets, and supplying
+replacements for standard library functions and header files on systems
+that lack them. Work is in progress to add those features in the
+future.
Autoconf imposes some restrictions on the names of macros used with
@code{#if} in C programs (@pxref{Preprocessor Symbol Index}).
Autoconf requires GNU @code{m4} in order to generate the scripts. It
-uses features that some UNIX versions of @code{m4} do not have. It also
-overflows internal limits of some versions of @code{m4}, including GNU
-@code{m4} 1.0. You must use version 1.1 or later of GNU @code{m4}.
-Using version 1.3 or later will be much faster than 1.1 or 1.2.
+uses features that some UNIX versions of @code{m4} do not have,
+including GNU @code{m4} 1.3. You must use version 1.4 or later of GNU
+@code{m4}.
@xref{Upgrading}, for information about upgrading from version 1.
@xref{History}, for the story of Autoconf's development.
To encourage consistency, here is a suggested order for calling the
Autoconf macros. Generally speaking, the things near the end of this
list could depend on things earlier in it. For example, library
-functions could be affected by typedefs and libraries.
+functions could be affected by types and libraries.
@display
@group
checks for programs
checks for libraries
checks for header files
-checks for typedefs
+checks for types
checks for structures
checks for compiler characteristics
checks for library functions
@item --trace=@var{macro}
@itemx -t @var{macro}
List the calls to @var{macro}. Multiple calls to @samp{--trace} list
-several macros. It is advised to use this feature instead of parsing
+several macros. It is often needed to check the content of a
+@file{configure.in} file, but it is extremely fragile and error prone to
+try to parse it. It is suggested to rely upon @samp{--trace} to scan
@file{configure.in}.
The output is composed of separated lines for each macro call. Each
@item --output=@var{file}
@itemx -o @var{file}
-Save output (script or traces) to @var{file}. The file @samp{-} stands
+Save output (script or trace) to @var{file}. The file @samp{-} stands
for the standard output.
@end table
program into your @file{Makefile.in} files.
@end defmac
+@defmac AC_PROG_GNU_M4
+@maindex PROG_GNU_M4
+@ovindex GNU_M4
+If GNU @code{m4} version 1.4 or above is found, set output variable
+@code{M4} to @samp{m4}.
+@end defmac
+
+
@defmac AC_PROG_LEX
@maindex PROG_LEX
@ovindex LEX
appropriate cache variable, as in this example:
@example
-AC_CHECK_FUNC(vprintf, AC_DEFINE(HAVE_VPRINTF))
+AC_CHECK_FUNC(vprintf, [AC_DEFINE(HAVE_VPRINTF)])
if test "$ac_cv_func_vprintf" != yes; then
-AC_CHECK_FUNC(_doprnt, AC_DEFINE(HAVE_DOPRNT))
+AC_CHECK_FUNC(_doprnt, [AC_DEFINE(HAVE_DOPRNT)])
fi
@end example
newlines. That is, do this:
@example
-AC_CHECK_HEADER(elf.h, AC_DEFINE(SVR4) LIBS="$LIBS -lelf")
+AC_CHECK_HEADER(elf.h, [AC_DEFINE(SVR4) LIBS="$LIBS -lelf"])
@end example
@noindent
@example
AC_CHECK_HEADER(elf.h,
- AC_DEFINE(SVR4)
- LIBS="$LIBS -lelf")
+ [AC_DEFINE(SVR4)
+ LIBS="$LIBS -lelf"])
@end example
@noindent
instead of this:
@example
-AC_CHECK_HEADER(elf.h, AC_DEFINE(SVR4); LIBS="$LIBS -lelf")
+AC_CHECK_HEADER(elf.h, [AC_DEFINE(SVR4); LIBS="$LIBS -lelf"])
@end example
@node Setting Output Variables, Caching Results, Defining Symbols, Results
by redefining the cache macros at the start of @file{configure.in}:
@example
-define([AC_CACHE_LOAD], )dnl
-define([AC_CACHE_SAVE], )dnl
+define([AC_CACHE_LOAD])dnl
+define([AC_CACHE_SAVE])dnl
AC_INIT(@r{whatever})
@r{ ... rest of configure.in ...}
@end example
The full path names to files, including programs.
@item PROG
The base names of programs.
-@item STRUCT
-Definitions of C structures in header files.
+@item MEMBER
+Members of aggregates.
@item SYS
Operating system features.
@item TYPE
For example, this call:
@example
-AC_CONFIG_LINKS(host.h:config/$@{machine@}.h object.h:config/$@{obj_format@}.h)
+AC_CONFIG_LINKS(host.h:config/$@{machine@}.h
+ object.h:config/$@{obj_format@}.h)
@end example
@noindent
@file{@var{srcdir}/config/$@{machine@}.h}, and @file{object.h}, which is a link
to @file{@var{srcdir}/config/$@{obj_format@}.h}.
-The tempting value @samp{.} for @var{dest} is made invalid: it makes it
+The tempting value @samp{.} for @var{dest} is invalid: it makes it
impossible for @samp{config.status} to guess the links to establish. It
-is therefore valid to run
+is then valid to run
@example
./config.status host.h object.h
@end example
would have been written:
@example
-AC_LINK_FILES(config/$@{machine@}.h config/$@{obj_format@}.h, host.h object.h)
+AC_LINK_FILES(config/$@{machine@}.h config/$@{obj_format@}.h,
+ host.h object.h)
@end example
@end defmac
@example
AC_DEFUN(TEST_MACRO,
-[
- AC_ARG_WITH(foo,
- AC_HELP_STRING([--with-foo], [use foo (default is NO)],
- ac_cv_use_foo=$withval, ac_cv_use_foo=no)
- AC_CACHE_CHECK(whether to use foo, ac_cv_use_foo, ac_cv_use_foo=no)
-])
+[AC_ARG_WITH(foo,
+ AC_HELP_STRING([--with-foo], [use foo (default is NO)],
+ ac_cv_use_foo=$withval, ac_cv_use_foo=no)
+AC_CACHE_CHECK(whether to use foo, ac_cv_use_foo, ac_cv_use_foo=no)])
@end example
Please note that the call to @code{AC_HELP_STRING} is @strong{unquoted}.
this:
@example
-Features and packages:
- --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
- --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
- --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
- --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
- --x-includes=DIR X include files are in DIR
- --x-libraries=DIR X library files are in DIR
-
--enable and --with options recognized:
--with-foo use foo (default is NO)
@end example
@example
AC_DEFUN(MY_ARG_WITH,
-[
- AC_ARG_WITH($1,
- AC_HELP_STRING([--with-$1], [use $1 (default is $2)]),
- ac_cv_use_$1=$withval, ac_cv_use_$1=no)
-
- AC_CACHE_CHECK(whether to use $1, ac_cv_use_$1, ac_cv_use_$1=$2)
-])
+[AC_ARG_WITH([$1],
+ AC_HELP_STRING([--with-$1], [use $1 (default is $2)]),
+ ac_cv_use_$1=$withval, ac_cv_use_$1=no)
+AC_CACHE_CHECK(whether to use $1, ac_cv_use_$1, ac_cv_use_$1=$2)])
@end example
@end defmac
__line__
@end example
+Autoconf requires version 1.4 or above of GNU @code{m4} because it
+uses frozen state files.
+
Since only software maintainers need to use Autoconf, and since GNU
@code{m4} is simple to configure and install, it seems reasonable to
require GNU @code{m4} to be installed also. Many maintainers of GNU and
@section How Can I Bootstrap?
@display
-If Autoconf requires GNU @code{m4} and GNU @code{m4} has an
-Autoconf @code{configure} script, how do I bootstrap? It seems
-like a chicken and egg problem!
+If Autoconf requires GNU @code{m4} and GNU @code{m4} has an Autoconf
+@code{configure} script, how do I bootstrap? It seems like a chicken
+and egg problem!
@end display
This is a misunderstanding. Although GNU @code{m4} does come with a