fix x, add history

This commit is contained in:
David MacKenzie 1994-08-23 20:24:36 +00:00
parent 69a53ee988
commit d5c63cb83e
5 changed files with 595 additions and 196 deletions

11
TODO
View File

@ -18,8 +18,7 @@ Required for 2.0:
------------------------------------------------------------------------------
* Fix AC_ARG_{ENABLE,WITH}, and AC_PATH_X*, and AC_REQUIRE
interrupting messages.
* Fix AC_ARG_{ENABLE,WITH}, and AC_REQUIRE interrupting messages.
------------------------------------------------------------------------------
@ -39,6 +38,14 @@ functions (POSIX, NIS) that do everything necessary, instead.
------------------------------------------------------------------------------
* Add a --indent option to autoconf to call shindent.
------------------------------------------------------------------------------
* Doc: Add indexes of concepts, env vars.
------------------------------------------------------------------------------
* Supply a template Makefile.in that people can adapt (what GNU hello
was going to be).

View File

@ -1444,45 +1444,48 @@ fi
dnl
AC_DEFUN(AC_PATH_X,
[AC_REQUIRE_CPP()dnl Set CPP; we run AC_PATH_X_DIRECT conditionally.
# If we find X, set shell vars x_includes and x_libraries to the paths.
no_x=yes
if test "x$with_x" != xno; then
# If we find X, set shell vars x_includes and x_libraries to the
# paths, otherwise set no_x=yes.
# Uses ac_ vars as temps to allow command line to override cache and checks.
# --without-x overrides everything else, but does not touch the cache.
AC_MSG_CHECKING(for X)
# Command line options override cache.
# FIXME We need to allow --x=includes= to work, I think.
test -n "$x_includes" && ac_cv_x_includes="$x_includes"
test -n "$x_libraries" && ac_cv_x_includes="$x_libraries"
if test "${ac_cv_x_includes+set}" = set &&
test "${ac_cv_x_libraries+set}" = set; then
AC_VERBOSE(using cached values for ac_cv_x_includes and ac_cv_x_libraries)
if test "x$with_x" = xno; then
no_x=yes
else
if test "x$x_includes" != xNONE && test "x$x_libraries" != xNONE; then
no_x=
else
AC_CACHE_VAL(ac_cv_path_x,
[# One or both of the vars are not set, and there is no cached value.
no_x=yes
AC_PATH_X_XMKMF
fi
if test "${ac_cv_x_includes+set}" != set ||
test "${ac_cv_x_libraries+set}" != set; then
if test "$no_x" = yes; then
AC_PATH_X_DIRECT
fi
test -z "$ac_cv_x_includes" && ac_cv_x_includes=NONE
test -z "$ac_cv_x_libraries" && ac_cv_x_libraries=NONE
if test "$no_x" = yes; then
ac_cv_path_x="no_x=yes"
else
ac_cv_path_x="no_x= ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries"
fi])dnl
fi
eval "$ac_cv_path_x"
fi # $with_x != no
# FIXME can we reliably distinguish cache values that are set to empty
# from those that aren't set?
if test -z "$x_includes" && test "$ac_cv_x_includes" != NONE; then
x_includes="$ac_cv_x_includes"
if test "$no_x" = yes; then
AC_MSG_RESULT(no)
else
test "x$x_includes" = xNONE && x_includes=$ac_x_includes
test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries
ac_cv_path_x="no_x= ac_x_includes=$x_includes ac_x_libraries=$x_libraries"
AC_MSG_RESULT([libraries $x_libraries, headers $x_includes])
fi
if test -z "$x_libraries" && test "$ac_cv_x_libraries" != NONE; then
x_libraries="$ac_cv_x_libraries"
fi
test -n "$x_includes" && AC_VERBOSE(X11 headers are in $x_includes)
test -n "$x_libraries" && AC_VERBOSE(X11 libraries are in $x_libraries)
fi # No --with-x=no.
])dnl
dnl
dnl Internal subroutine of AC_PATH_X.
dnl Set ac_x_includes, ac_x_libraries, and no_x (initially yes).
AC_DEFUN(AC_PATH_X_XMKMF,
[AC_CHECKING(for X include and library files with xmkmf)
rm -fr conftestdir
[rm -fr conftestdir
if mkdir conftestdir; then
cd conftestdir
# Make sure to not put "make" in the Imakefile rules, since we grep it out.
@ -1501,11 +1504,11 @@ EOF
fi
case "$ac_im_incroot" in
/usr/include) ;;
*) test -z "$ac_cv_x_includes" && ac_cv_x_includes="$ac_im_incroot" ;;
*) ac_x_includes="$ac_im_incroot" ;;
esac
case "$ac_im_usrlibdir" in
/usr/lib | /lib) ;;
*) test -z "$ac_cv_x_libraries" && ac_cv_x_libraries="$ac_im_usrlibdir" ;;
*) ac_x_libraries="$ac_im_usrlibdir" ;;
esac
fi
cd ..
@ -1514,12 +1517,12 @@ fi
])dnl
dnl
dnl Internal subroutine of AC_PATH_X.
dnl Set ac_x_includes, ac_x_libraries, and no_x (initially yes).
AC_DEFUN(AC_PATH_X_DIRECT,
[AC_CHECKING(for X include and library files directly)
test -z "$x_direct_test_library" && x_direct_test_library=Xt
[test -z "$x_direct_test_library" && x_direct_test_library=Xt
test -z "$x_direct_test_include" && x_direct_test_include=X11/Intrinsic.h
AC_TRY_CPP([#include <$x_direct_test_include>], no_x=,
for ac_dir in \
AC_TRY_CPP([#include <$x_direct_test_include>], [no_x= ac_x_includes=],
[ for ac_dir in \
/usr/X11R6/include \
/usr/X11R5/include \
/usr/X11R4/include \
@ -1557,16 +1560,15 @@ AC_TRY_CPP([#include <$x_direct_test_include>], no_x=,
; \
do
if test -r "$ac_dir/$x_direct_test_include"; then
test -z "$ac_cv_x_includes" && ac_cv_x_includes=$ac_dir
no_x=
no_x= ac_x_includes=$ac_dir
break
fi
done)
done])
# Check for the libraries. First see if replacing the include by
# lib works.
AC_HAVE_LIBRARY("$x_direct_test_library", no_x=,
for ac_dir in `echo "$ac_cv_x_includes" | sed s/include/lib/` \
AC_CHECK_LIB("$x_direct_test_library", main, [no_x= ac_x_libraries=],
[for ac_dir in `echo "$ac_x_includes" | sed s/include/lib/` \
/usr/X11R6/lib \
/usr/X11R5/lib \
/usr/X11R4/lib \
@ -1605,61 +1607,58 @@ for ac_dir in `echo "$ac_cv_x_includes" | sed s/include/lib/` \
do
for ac_extension in a so sl; do
if test -r $ac_dir/lib${x_direct_test_library}.$ac_extension; then
test -z "$ac_cv_x_libraries" && ac_cv_x_libraries=$ac_dir
no_x=
no_x= ac_x_libraries=$ac_dir
break 2
fi
done
done)])dnl
done])])dnl
dnl
dnl Find additional X libraries, magic flags, etc.
AC_DEFUN(AC_PATH_XTRA,
[AC_REQUIRE([AC_OS_ISC])dnl
AC_REQUIRE([AC_PATH_X])dnl
AC_CHECKING(for additional X libraries and flags)
if test -n "$x_includes"; then
X_CFLAGS="$X_CFLAGS -I$x_includes"
elif test "$no_x" = yes; then
if test "$no_x" = yes; then
# Not all programs may use this symbol, but it does not hurt to define it.
X_CFLAGS="$X_CFLAGS -DX_DISPLAY_MISSING"
fi
# It would be nice to have a more robust check for the -R ld option than
# just checking for Solaris.
# It would also be nice to do this for all -L options, not just this one.
if test -n "$x_libraries"; then
X_LIBS="$X_LIBS -L$x_libraries"
if test "`(uname) 2>/dev/null`" = SunOS &&
uname -r | grep '^5' >/dev/null; then
X_LIBS="$X_LIBS -R$x_libraries"
fi
fi
# Check for additional X libraries.
if test "$ISC" = yes; then
X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl_s -linet"
else
# Martyn.Johnson@cl.cam.ac.uk says this is needed for Ultrix, if the X
# libraries were built with DECnet support. And karl@cs.umb.edu says
# the Alpha needs dnet_stub (dnet does not exist).
AC_CHECK_LIB(dnet, dnet_ntoa,
[X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet" ac_have_dnet=yes], ac_have_dnet=no)
if test "$ac_have_dnet" = no; then
AC_CHECK_LIB(dnet_stub, dnet_ntoa,
[X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"])
if test -n "$x_includes"; then
X_CFLAGS="$X_CFLAGS -I$x_includes"
fi
# lieder@skyler.mavd.honeywell.com says without -lsocket,
# socket/setsockopt and other routines are undefined under SCO ODT 2.0.
# But -lsocket is broken on IRIX, according to simon@lia.di.epfl.ch.
if test "`(uname) 2>/dev/null`" != IRIX; then
AC_CHECK_LIB(socket, socket, [X_EXTRA_LIBS="$X_EXTRA_LIBS -lsocket"])
# It would be nice to have a more robust check for the -R ld option than
# just checking for Solaris.
# It would also be nice to do this for all -L options, not just this one.
if test -n "$x_libraries"; then
X_LIBS="$X_LIBS -L$x_libraries"
if test "`(uname) 2>/dev/null`" = SunOS &&
uname -r | grep '^5' >/dev/null; then
X_LIBS="$X_LIBS -R$x_libraries"
fi
fi
# Check for additional X libraries.
if test "$ISC" = yes; then
X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl_s -linet"
else
# Martyn.Johnson@cl.cam.ac.uk says this is needed for Ultrix, if the X
# libraries were built with DECnet support. And karl@cs.umb.edu says
# the Alpha needs dnet_stub (dnet does not exist).
AC_CHECK_LIB(dnet, dnet_ntoa,
[X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet" ac_have_dnet=yes], ac_have_dnet=no)
if test "$ac_have_dnet" = no; then
AC_CHECK_LIB(dnet_stub, dnet_ntoa,
[X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"])
fi
# lieder@skyler.mavd.honeywell.com says without -lsocket,
# socket/setsockopt and other routines are undefined under SCO ODT 2.0.
# But -lsocket is broken on IRIX, according to simon@lia.di.epfl.ch.
if test "`(uname) 2>/dev/null`" != IRIX; then
AC_CHECK_LIB(socket, socket, [X_EXTRA_LIBS="$X_EXTRA_LIBS -lsocket"])
fi
fi
fi
#
AC_VERBOSE(X compiler flags: $X_CFLAGS)
AC_VERBOSE(X library flags: $X_LIBS)
AC_VERBOSE(extra X libraries: $X_EXTRA_LIBS)
AC_SUBST(X_CFLAGS)dnl
AC_SUBST(X_LIBS)dnl
AC_SUBST(X_EXTRA_LIBS)dnl

View File

@ -105,6 +105,7 @@ package. This is edition @value{EDITION}, for Autoconf version @value{VERSION}.
* Site Default Values:: Providing local defaults for @code{configure}.
* Old Macro Names:: Backward compatibility macros.
* Example:: Sample Autoconf input files.
* History:: History of Autoconf.
* Preprocessor Symbol Index:: Index of C preprocessor symbols defined.
* Macro Index:: Index of Autoconf macros.
@ -189,6 +190,14 @@ An Example
* Sample configure.in:: An example of a @file{configure} template.
* Sample Makefile.in:: An example of a @file{Makefile} template.
History of Autoconf
* Genesis:: Prehistory and naming of @code{configure}.
* Exodus:: The plagues of @code{m4} and Perl.
* Leviticus:: The priestly code of portability arrives.
* Numbers:: Listing of growth and contributors.
* Deuteronomy:: Approaching the promises of easy configuration.
@end menu
@node Introduction, Distributing, Top, Top
@ -1239,12 +1248,12 @@ library, in case only some of them use the code in @code{LIBOBJS}.
If this macro finds @file{alloca.h}, it defines @code{HAVE_ALLOCA_H}.
This macro does not try to get @code{alloca} from the SVR3 @file{libPW}
or the SVR4 @file{libucb} because those libraries contain some
incompatible functions that cause trouble. Some versions do not even
contain @code{alloca} or contain a buggy version. If you still want to
use their @code{alloca}, use @code{ar} to extract @file{alloca.o} from
them instead of compiling @file{alloca.c}.
This macro does not try to get @code{alloca} from the System V R3
@file{libPW} or the System V R4 @file{libucb} because those libraries
contain some incompatible functions that cause trouble. Some versions
do not even contain @code{alloca} or contain a buggy version. If you
still want to use their @code{alloca}, use @code{ar} to extract
@file{alloca.o} from them instead of compiling @file{alloca.c}.
Source files that use @code{alloca} should start with a piece of code
like the following, to declare it properly. Note that in some versions
@ -2958,19 +2967,21 @@ error (in case the file doesn't exist) of @code{grep} to
whether it found a match.
To check whether the Autoconf macros have already defined a certain C
preprocessor symbol, you can use a @code{case} statement like this:
preprocessor symbol, test the value of the appropriate cache variable,
as in this example:
@example
case "$DEFS" in
*HAVE_FOO*) ;;
*) LIBOBJS="$LIBOBJS foo.o" ;;
esac
AC_CHECK_FUNC(vprintf, AC_DEFINE(HAVE_VPRINTF))
if test "$ac_cv_func_vprintf" != yes; then
AC_CHECK_FUNC(_doprnt, AC_DEFINE(HAVE_DOPRNT))
fi
@end example
@noindent
Make sure to enclose the variable name you are checking (usually
@code{DEFS}) in double quotes, because otherwise some old versions of
@code{bash} misinterpret the statement.
Unlike in Autoconf version 1, there is no shell variable @code{DEFS} set
while @code{configure} is running. This difference is because properly
quoting the contents of that variable turned out to be too cumbersome to
do every time @code{AC_DEFINE} is called.
@node Test Programs, Multiple Cases, Checking for Symbols, Writing Macros
@section Test Programs
@ -3805,7 +3816,7 @@ removed
@code{AC_OS_DYNIX}
@end table
@node Example, Preprocessor Symbol Index, Old Macro Names, Top
@node Example, History, Old Macro Names, Top
@chapter An Example
Here are sample @file{configure.in} and @file{Makefile.in} files, to
@ -3889,8 +3900,8 @@ RTAPELIB = @@RTAPELIB@@
CFLAGS = -g
LDFLAGS = -g
prefix = /usr/local
exec_prefix = $(prefix)
prefix = @@prefix@@
exec_prefix = @@exec_prefix@@
binprefix =
manprefix =
@ -3986,7 +3997,193 @@ dist: $(DISTFILES)
rm -rf `cat .fname` .fname
@end example
@node Preprocessor Symbol Index, Macro Index, Example, Top
@node History, Preprocessor Symbol Index, Example, Top
@chapter History of Autoconf
You may be wondering, Why was Autoconf originally written? How did it
get into its present form? (Why does it look like gorilla spit?) If
you're not wondering, then this chapter contains no information useful
to you, and you might as well skip it. If you @emph{are} wondering,
then let there be light.
@menu
* Genesis:: Prehistory and naming of @code{configure}.
* Exodus:: The plagues of @code{m4} and Perl.
* Leviticus:: The priestly code of portability arrives.
* Numbers:: Listing of growth and contributors.
* Deuteronomy:: Approaching the promises of easy configuration.
@end menu
@node Genesis, Exodus, , History
@section Genesis
In June 1991 I was maintaining many of the GNU utilities for the Free
Software Foundation. As they were ported to more platforms and more
programs were added, the number of @samp{-D} options that users had to
select in the @file{Makefile} (around 20) became burdensome. Especially
for me---I had to test each new release on a bunch of different systems.
So I wrote a little shell script to guess some of the correct settings
for the fileutils package, and released it as part of fileutils 2.0.
That @code{configure} script worked well enough that the next month I
adapted it (by hand) to create similar @code{configure} scripts for
several other GNU utilities packages. Brian Berliner also adapted one
of my scripts for his CVS revision control system.
Later that summer, I learned that Richard Stallman and Richard Pixley
were developing similar scripts to use in the GNU compiler tools; so I
adapted my @code{configure} scripts to support their evolving interface:
using the file name @file{Makefile.in} as the templates; adding
@samp{+srcdir}, the first option (of many); and creating
@file{config.status} files.
@node Exodus, Leviticus, Genesis, History
@section Exodus
As I got feedback from users, I incorporated many improvements, using
Emacs to search and replace, cut and paste, similar changes in each of
the scripts. As I adapted more GNU utilities packages to use
@code{configure} scripts, updating them all by hand became burdensome.
Rich Murphey, the maintainer of the GNU graphics utilities, sent me mail
saying that the @code{configure} scripts were great, and asking if I had
a program for generating them that I could send him. No, I thought, but
I should! So I started to work out how to generate them. And the
journey from the bondage of hand-written @file{configure} scripts to the
promise of Autoconf began.
I looked briefly into using Larry Wall's Metaconfig program, but I
decided not to for several reasons. The @code{Configure} scripts it
produces are interactive, which I find quite inconvenient; I didn't like
the ways it checked for some features (such as library functions); it
was not being maintained, and its scripts didn't work on many modern
systems (such as System V R4 and NeXT); it wasn't very flexible in what
it could do in response to a feature's presence or absence; I found it
confusing to learn; and it was too big and complex for my needs (I
didn't realize then how much Autoconf would eventually have to grow). I
considered using Perl to generate my style of @code{configure} scripts,
but decided that @code{m4} was better suited to the job of simple
textual substitutions: it gets in the way less, because output is
implicit. Plus, everyone already has it. (Initially I didn't rely on
the GNU extensions to @code{m4}.) Also, some of my friends at the
University of Maryland had recently been putting @code{m4} front ends on
several programs, including @code{tvtwm}, and I was interested in trying
out a new language.
@node Leviticus, Numbers, Exodus, History
@section Leviticus
Since my @code{configure} scripts determine the system's capabilities
automatically, with no interactive user intervention, I decided to call
the program that generates them Autoconfig. But with a version number
tacked on, that name would be too long for System V R3 file systems, so
I shortened it to Autoconf.
I called together a group of priests of portability (er, alpha testers)
to give me feedback as I encapsulated pieces of my handwritten scripts
in @code{m4} macros and continued to add features and improve the
techniques used in the checks. Prominent among the testers were
@ifinfo
Franc,ois
@end ifinfo
@tex
Fran\c cois
@end tex
Pinard, who came up with the idea of making an @file{autoconf} shell
script to run @code{m4} and check for unresolved macro calls; Karl
Berry, who championed standardizing the @code{HAVE_@var{feature}} form
for C preprocessor symbols; and Ian Taylor, who added support for
creating a C header file as an alternative to putting @samp{-D} options
in a @file{Makefile}, so he could use it in his UUCP package. The alpha
testers cheerfully adjusted their files again and again as the names and
calling conventions of the Autoconf macros changed from release to
release. They all contributed many specific checks, great ideas, and
bug fixes.
@node Numbers, Deuteronomy, Leviticus, History
@section Numbers
In July 1992, after months of alpha testing, I released Autoconf 1.0,
and converted many of GNU packages to use it. I was surprised by how
positive the reaction to it was. More people started using it than I
could keep track of, including people working on software that wasn't
part of the GNU Project (such as TCL, FSP, @TeX{}, and Kerberos v5).
Autoconf continued to improve rapidly, as many people using the
@code{configure} scripts reported problems they encountered.
Autoconf turned out to be a good torture test for @code{m4}
implementations. Unix @code{m4} started to dump core because of the
length of the macros that Autoconf defined, and several bugs showed up
in GNU @code{m4} as well. Eventually, we realized that we needed to use
some features that only GNU @code{m4} has. BSD @code{m4}, in
particular, has an impoverished set of builtin macros; the System V
version is better, but still doesn't have everything we need.
More development occurred as people put Autoconf under more stresses
(and to uses I'd never imagined). Karl Berry added checks for X11.
david zuhn contributed C++ support.
@ifinfo
Franc,ois
@end ifinfo
@tex
Fran\c cois
@end tex
Pinard made it diagnose invalid arguments. Jim Blandy bravely coerced
it into configuring GNU Emacs, laying the groundwork for several later
improvements. Roland McGrath got it to configure the GNU C Library,
wrote the @code{autoheader} script to automate the creation of C header
file templates, and added a @samp{--verbose} option to @code{configure}.
Noah Friedman added the @samp{--macrodir} option and @code{AC_MACRODIR}
environment variable. Roland and Noah improved the quoting protection
in @code{AC_DEFINE} and fixed many bugs, especially when I got sick of
dealing with portability problems from February through June, 1993.
@node Deuteronomy, , Numbers, History
@section Deuteronomy
A long wish list for major features had accumulated, and the effect of
several years of patching by various people had left some residual
cruft. In April 1994, while working for Cygnus Support, I began a major
revision of Autoconf. I added most of the features of the Cygnus
@code{configure} that Autoconf had lacked; for example, support for
using @file{config.sub} and options like @samp{--host}, derived from
work that david zuhn and Ken Raeburn contributed while converting GNU
@code{as} to use Autoconf. Rob Savoye required the ability to run
@code{configure} scripts in subdirectories when he made DejaGNU use
Autoconf.
I added more features in response to other peoples' requests. Many
people had asked for @code{configure} scripts to share the results of
the checks between runs, because (particularly when configuring a large
source tree, like Cygnus does) they were frustratingly slow. Mike
Haertel suggested adding site-specific initialization scripts. People
distributing software that had to unpack on MS-DOS asked for a way to
override the @file{.in} extension on the file names. Jim Avera did an
extensive examination of the problems with quoting in @code{AC_DEFINE}
and contributed significant improvements to it. Richard Stallman asked
that compiler output be sent to @file{config.log} instead of
@file{/dev/null}, to help people debug the Emacs @code{configure}
script.
I made some other changes because of my dissatisfaction with the quality
of the program. I made the messages showing results of the checks less
ambiguous, always printing a result. I regularized the names of the
macros and cleaned up coding style inconsistencies. I added several
useful auxiliary utilities that I had developed to help convert source
code packages to use Autoconf. And I began a testsuite, because
experience had shown that Autoconf had a pronounced tendency to regress
when we changed it.
Again, several alpha testers gave invaluable feedback, especially
@ifinfo
Franc,ois
@end ifinfo
@tex
Fran\c cois
@end tex
Pinard, Rob Savoye, and Ken Raeburn.
Finally, version 2.0 was ready.
@node Preprocessor Symbol Index, Macro Index, History, Top
@unnumbered Preprocessor Symbol Index
This is an alphabetical list of the C preprocessor symbols that the

View File

@ -105,6 +105,7 @@ package. This is edition @value{EDITION}, for Autoconf version @value{VERSION}.
* Site Default Values:: Providing local defaults for @code{configure}.
* Old Macro Names:: Backward compatibility macros.
* Example:: Sample Autoconf input files.
* History:: History of Autoconf.
* Preprocessor Symbol Index:: Index of C preprocessor symbols defined.
* Macro Index:: Index of Autoconf macros.
@ -189,6 +190,14 @@ An Example
* Sample configure.in:: An example of a @file{configure} template.
* Sample Makefile.in:: An example of a @file{Makefile} template.
History of Autoconf
* Genesis:: Prehistory and naming of @code{configure}.
* Exodus:: The plagues of @code{m4} and Perl.
* Leviticus:: The priestly code of portability arrives.
* Numbers:: Listing of growth and contributors.
* Deuteronomy:: Approaching the promises of easy configuration.
@end menu
@node Introduction, Distributing, Top, Top
@ -1239,12 +1248,12 @@ library, in case only some of them use the code in @code{LIBOBJS}.
If this macro finds @file{alloca.h}, it defines @code{HAVE_ALLOCA_H}.
This macro does not try to get @code{alloca} from the SVR3 @file{libPW}
or the SVR4 @file{libucb} because those libraries contain some
incompatible functions that cause trouble. Some versions do not even
contain @code{alloca} or contain a buggy version. If you still want to
use their @code{alloca}, use @code{ar} to extract @file{alloca.o} from
them instead of compiling @file{alloca.c}.
This macro does not try to get @code{alloca} from the System V R3
@file{libPW} or the System V R4 @file{libucb} because those libraries
contain some incompatible functions that cause trouble. Some versions
do not even contain @code{alloca} or contain a buggy version. If you
still want to use their @code{alloca}, use @code{ar} to extract
@file{alloca.o} from them instead of compiling @file{alloca.c}.
Source files that use @code{alloca} should start with a piece of code
like the following, to declare it properly. Note that in some versions
@ -2958,19 +2967,21 @@ error (in case the file doesn't exist) of @code{grep} to
whether it found a match.
To check whether the Autoconf macros have already defined a certain C
preprocessor symbol, you can use a @code{case} statement like this:
preprocessor symbol, test the value of the appropriate cache variable,
as in this example:
@example
case "$DEFS" in
*HAVE_FOO*) ;;
*) LIBOBJS="$LIBOBJS foo.o" ;;
esac
AC_CHECK_FUNC(vprintf, AC_DEFINE(HAVE_VPRINTF))
if test "$ac_cv_func_vprintf" != yes; then
AC_CHECK_FUNC(_doprnt, AC_DEFINE(HAVE_DOPRNT))
fi
@end example
@noindent
Make sure to enclose the variable name you are checking (usually
@code{DEFS}) in double quotes, because otherwise some old versions of
@code{bash} misinterpret the statement.
Unlike in Autoconf version 1, there is no shell variable @code{DEFS} set
while @code{configure} is running. This difference is because properly
quoting the contents of that variable turned out to be too cumbersome to
do every time @code{AC_DEFINE} is called.
@node Test Programs, Multiple Cases, Checking for Symbols, Writing Macros
@section Test Programs
@ -3805,7 +3816,7 @@ removed
@code{AC_OS_DYNIX}
@end table
@node Example, Preprocessor Symbol Index, Old Macro Names, Top
@node Example, History, Old Macro Names, Top
@chapter An Example
Here are sample @file{configure.in} and @file{Makefile.in} files, to
@ -3889,8 +3900,8 @@ RTAPELIB = @@RTAPELIB@@
CFLAGS = -g
LDFLAGS = -g
prefix = /usr/local
exec_prefix = $(prefix)
prefix = @@prefix@@
exec_prefix = @@exec_prefix@@
binprefix =
manprefix =
@ -3986,7 +3997,193 @@ dist: $(DISTFILES)
rm -rf `cat .fname` .fname
@end example
@node Preprocessor Symbol Index, Macro Index, Example, Top
@node History, Preprocessor Symbol Index, Example, Top
@chapter History of Autoconf
You may be wondering, Why was Autoconf originally written? How did it
get into its present form? (Why does it look like gorilla spit?) If
you're not wondering, then this chapter contains no information useful
to you, and you might as well skip it. If you @emph{are} wondering,
then let there be light.
@menu
* Genesis:: Prehistory and naming of @code{configure}.
* Exodus:: The plagues of @code{m4} and Perl.
* Leviticus:: The priestly code of portability arrives.
* Numbers:: Listing of growth and contributors.
* Deuteronomy:: Approaching the promises of easy configuration.
@end menu
@node Genesis, Exodus, , History
@section Genesis
In June 1991 I was maintaining many of the GNU utilities for the Free
Software Foundation. As they were ported to more platforms and more
programs were added, the number of @samp{-D} options that users had to
select in the @file{Makefile} (around 20) became burdensome. Especially
for me---I had to test each new release on a bunch of different systems.
So I wrote a little shell script to guess some of the correct settings
for the fileutils package, and released it as part of fileutils 2.0.
That @code{configure} script worked well enough that the next month I
adapted it (by hand) to create similar @code{configure} scripts for
several other GNU utilities packages. Brian Berliner also adapted one
of my scripts for his CVS revision control system.
Later that summer, I learned that Richard Stallman and Richard Pixley
were developing similar scripts to use in the GNU compiler tools; so I
adapted my @code{configure} scripts to support their evolving interface:
using the file name @file{Makefile.in} as the templates; adding
@samp{+srcdir}, the first option (of many); and creating
@file{config.status} files.
@node Exodus, Leviticus, Genesis, History
@section Exodus
As I got feedback from users, I incorporated many improvements, using
Emacs to search and replace, cut and paste, similar changes in each of
the scripts. As I adapted more GNU utilities packages to use
@code{configure} scripts, updating them all by hand became burdensome.
Rich Murphey, the maintainer of the GNU graphics utilities, sent me mail
saying that the @code{configure} scripts were great, and asking if I had
a program for generating them that I could send him. No, I thought, but
I should! So I started to work out how to generate them. And the
journey from the bondage of hand-written @file{configure} scripts to the
promise of Autoconf began.
I looked briefly into using Larry Wall's Metaconfig program, but I
decided not to for several reasons. The @code{Configure} scripts it
produces are interactive, which I find quite inconvenient; I didn't like
the ways it checked for some features (such as library functions); it
was not being maintained, and its scripts didn't work on many modern
systems (such as System V R4 and NeXT); it wasn't very flexible in what
it could do in response to a feature's presence or absence; I found it
confusing to learn; and it was too big and complex for my needs (I
didn't realize then how much Autoconf would eventually have to grow). I
considered using Perl to generate my style of @code{configure} scripts,
but decided that @code{m4} was better suited to the job of simple
textual substitutions: it gets in the way less, because output is
implicit. Plus, everyone already has it. (Initially I didn't rely on
the GNU extensions to @code{m4}.) Also, some of my friends at the
University of Maryland had recently been putting @code{m4} front ends on
several programs, including @code{tvtwm}, and I was interested in trying
out a new language.
@node Leviticus, Numbers, Exodus, History
@section Leviticus
Since my @code{configure} scripts determine the system's capabilities
automatically, with no interactive user intervention, I decided to call
the program that generates them Autoconfig. But with a version number
tacked on, that name would be too long for System V R3 file systems, so
I shortened it to Autoconf.
I called together a group of priests of portability (er, alpha testers)
to give me feedback as I encapsulated pieces of my handwritten scripts
in @code{m4} macros and continued to add features and improve the
techniques used in the checks. Prominent among the testers were
@ifinfo
Franc,ois
@end ifinfo
@tex
Fran\c cois
@end tex
Pinard, who came up with the idea of making an @file{autoconf} shell
script to run @code{m4} and check for unresolved macro calls; Karl
Berry, who championed standardizing the @code{HAVE_@var{feature}} form
for C preprocessor symbols; and Ian Taylor, who added support for
creating a C header file as an alternative to putting @samp{-D} options
in a @file{Makefile}, so he could use it in his UUCP package. The alpha
testers cheerfully adjusted their files again and again as the names and
calling conventions of the Autoconf macros changed from release to
release. They all contributed many specific checks, great ideas, and
bug fixes.
@node Numbers, Deuteronomy, Leviticus, History
@section Numbers
In July 1992, after months of alpha testing, I released Autoconf 1.0,
and converted many of GNU packages to use it. I was surprised by how
positive the reaction to it was. More people started using it than I
could keep track of, including people working on software that wasn't
part of the GNU Project (such as TCL, FSP, @TeX{}, and Kerberos v5).
Autoconf continued to improve rapidly, as many people using the
@code{configure} scripts reported problems they encountered.
Autoconf turned out to be a good torture test for @code{m4}
implementations. Unix @code{m4} started to dump core because of the
length of the macros that Autoconf defined, and several bugs showed up
in GNU @code{m4} as well. Eventually, we realized that we needed to use
some features that only GNU @code{m4} has. BSD @code{m4}, in
particular, has an impoverished set of builtin macros; the System V
version is better, but still doesn't have everything we need.
More development occurred as people put Autoconf under more stresses
(and to uses I'd never imagined). Karl Berry added checks for X11.
david zuhn contributed C++ support.
@ifinfo
Franc,ois
@end ifinfo
@tex
Fran\c cois
@end tex
Pinard made it diagnose invalid arguments. Jim Blandy bravely coerced
it into configuring GNU Emacs, laying the groundwork for several later
improvements. Roland McGrath got it to configure the GNU C Library,
wrote the @code{autoheader} script to automate the creation of C header
file templates, and added a @samp{--verbose} option to @code{configure}.
Noah Friedman added the @samp{--macrodir} option and @code{AC_MACRODIR}
environment variable. Roland and Noah improved the quoting protection
in @code{AC_DEFINE} and fixed many bugs, especially when I got sick of
dealing with portability problems from February through June, 1993.
@node Deuteronomy, , Numbers, History
@section Deuteronomy
A long wish list for major features had accumulated, and the effect of
several years of patching by various people had left some residual
cruft. In April 1994, while working for Cygnus Support, I began a major
revision of Autoconf. I added most of the features of the Cygnus
@code{configure} that Autoconf had lacked; for example, support for
using @file{config.sub} and options like @samp{--host}, derived from
work that david zuhn and Ken Raeburn contributed while converting GNU
@code{as} to use Autoconf. Rob Savoye required the ability to run
@code{configure} scripts in subdirectories when he made DejaGNU use
Autoconf.
I added more features in response to other peoples' requests. Many
people had asked for @code{configure} scripts to share the results of
the checks between runs, because (particularly when configuring a large
source tree, like Cygnus does) they were frustratingly slow. Mike
Haertel suggested adding site-specific initialization scripts. People
distributing software that had to unpack on MS-DOS asked for a way to
override the @file{.in} extension on the file names. Jim Avera did an
extensive examination of the problems with quoting in @code{AC_DEFINE}
and contributed significant improvements to it. Richard Stallman asked
that compiler output be sent to @file{config.log} instead of
@file{/dev/null}, to help people debug the Emacs @code{configure}
script.
I made some other changes because of my dissatisfaction with the quality
of the program. I made the messages showing results of the checks less
ambiguous, always printing a result. I regularized the names of the
macros and cleaned up coding style inconsistencies. I added several
useful auxiliary utilities that I had developed to help convert source
code packages to use Autoconf. And I began a testsuite, because
experience had shown that Autoconf had a pronounced tendency to regress
when we changed it.
Again, several alpha testers gave invaluable feedback, especially
@ifinfo
Franc,ois
@end ifinfo
@tex
Fran\c cois
@end tex
Pinard, Rob Savoye, and Ken Raeburn.
Finally, version 2.0 was ready.
@node Preprocessor Symbol Index, Macro Index, History, Top
@unnumbered Preprocessor Symbol Index
This is an alphabetical list of the C preprocessor symbols that the

View File

@ -1444,45 +1444,48 @@ fi
dnl
AC_DEFUN(AC_PATH_X,
[AC_REQUIRE_CPP()dnl Set CPP; we run AC_PATH_X_DIRECT conditionally.
# If we find X, set shell vars x_includes and x_libraries to the paths.
no_x=yes
if test "x$with_x" != xno; then
# If we find X, set shell vars x_includes and x_libraries to the
# paths, otherwise set no_x=yes.
# Uses ac_ vars as temps to allow command line to override cache and checks.
# --without-x overrides everything else, but does not touch the cache.
AC_MSG_CHECKING(for X)
# Command line options override cache.
# FIXME We need to allow --x=includes= to work, I think.
test -n "$x_includes" && ac_cv_x_includes="$x_includes"
test -n "$x_libraries" && ac_cv_x_includes="$x_libraries"
if test "${ac_cv_x_includes+set}" = set &&
test "${ac_cv_x_libraries+set}" = set; then
AC_VERBOSE(using cached values for ac_cv_x_includes and ac_cv_x_libraries)
if test "x$with_x" = xno; then
no_x=yes
else
if test "x$x_includes" != xNONE && test "x$x_libraries" != xNONE; then
no_x=
else
AC_CACHE_VAL(ac_cv_path_x,
[# One or both of the vars are not set, and there is no cached value.
no_x=yes
AC_PATH_X_XMKMF
fi
if test "${ac_cv_x_includes+set}" != set ||
test "${ac_cv_x_libraries+set}" != set; then
if test "$no_x" = yes; then
AC_PATH_X_DIRECT
fi
test -z "$ac_cv_x_includes" && ac_cv_x_includes=NONE
test -z "$ac_cv_x_libraries" && ac_cv_x_libraries=NONE
if test "$no_x" = yes; then
ac_cv_path_x="no_x=yes"
else
ac_cv_path_x="no_x= ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries"
fi])dnl
fi
eval "$ac_cv_path_x"
fi # $with_x != no
# FIXME can we reliably distinguish cache values that are set to empty
# from those that aren't set?
if test -z "$x_includes" && test "$ac_cv_x_includes" != NONE; then
x_includes="$ac_cv_x_includes"
if test "$no_x" = yes; then
AC_MSG_RESULT(no)
else
test "x$x_includes" = xNONE && x_includes=$ac_x_includes
test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries
ac_cv_path_x="no_x= ac_x_includes=$x_includes ac_x_libraries=$x_libraries"
AC_MSG_RESULT([libraries $x_libraries, headers $x_includes])
fi
if test -z "$x_libraries" && test "$ac_cv_x_libraries" != NONE; then
x_libraries="$ac_cv_x_libraries"
fi
test -n "$x_includes" && AC_VERBOSE(X11 headers are in $x_includes)
test -n "$x_libraries" && AC_VERBOSE(X11 libraries are in $x_libraries)
fi # No --with-x=no.
])dnl
dnl
dnl Internal subroutine of AC_PATH_X.
dnl Set ac_x_includes, ac_x_libraries, and no_x (initially yes).
AC_DEFUN(AC_PATH_X_XMKMF,
[AC_CHECKING(for X include and library files with xmkmf)
rm -fr conftestdir
[rm -fr conftestdir
if mkdir conftestdir; then
cd conftestdir
# Make sure to not put "make" in the Imakefile rules, since we grep it out.
@ -1501,11 +1504,11 @@ EOF
fi
case "$ac_im_incroot" in
/usr/include) ;;
*) test -z "$ac_cv_x_includes" && ac_cv_x_includes="$ac_im_incroot" ;;
*) ac_x_includes="$ac_im_incroot" ;;
esac
case "$ac_im_usrlibdir" in
/usr/lib | /lib) ;;
*) test -z "$ac_cv_x_libraries" && ac_cv_x_libraries="$ac_im_usrlibdir" ;;
*) ac_x_libraries="$ac_im_usrlibdir" ;;
esac
fi
cd ..
@ -1514,12 +1517,12 @@ fi
])dnl
dnl
dnl Internal subroutine of AC_PATH_X.
dnl Set ac_x_includes, ac_x_libraries, and no_x (initially yes).
AC_DEFUN(AC_PATH_X_DIRECT,
[AC_CHECKING(for X include and library files directly)
test -z "$x_direct_test_library" && x_direct_test_library=Xt
[test -z "$x_direct_test_library" && x_direct_test_library=Xt
test -z "$x_direct_test_include" && x_direct_test_include=X11/Intrinsic.h
AC_TRY_CPP([#include <$x_direct_test_include>], no_x=,
for ac_dir in \
AC_TRY_CPP([#include <$x_direct_test_include>], [no_x= ac_x_includes=],
[ for ac_dir in \
/usr/X11R6/include \
/usr/X11R5/include \
/usr/X11R4/include \
@ -1557,16 +1560,15 @@ AC_TRY_CPP([#include <$x_direct_test_include>], no_x=,
; \
do
if test -r "$ac_dir/$x_direct_test_include"; then
test -z "$ac_cv_x_includes" && ac_cv_x_includes=$ac_dir
no_x=
no_x= ac_x_includes=$ac_dir
break
fi
done)
done])
# Check for the libraries. First see if replacing the include by
# lib works.
AC_HAVE_LIBRARY("$x_direct_test_library", no_x=,
for ac_dir in `echo "$ac_cv_x_includes" | sed s/include/lib/` \
AC_CHECK_LIB("$x_direct_test_library", main, [no_x= ac_x_libraries=],
[for ac_dir in `echo "$ac_x_includes" | sed s/include/lib/` \
/usr/X11R6/lib \
/usr/X11R5/lib \
/usr/X11R4/lib \
@ -1605,61 +1607,58 @@ for ac_dir in `echo "$ac_cv_x_includes" | sed s/include/lib/` \
do
for ac_extension in a so sl; do
if test -r $ac_dir/lib${x_direct_test_library}.$ac_extension; then
test -z "$ac_cv_x_libraries" && ac_cv_x_libraries=$ac_dir
no_x=
no_x= ac_x_libraries=$ac_dir
break 2
fi
done
done)])dnl
done])])dnl
dnl
dnl Find additional X libraries, magic flags, etc.
AC_DEFUN(AC_PATH_XTRA,
[AC_REQUIRE([AC_OS_ISC])dnl
AC_REQUIRE([AC_PATH_X])dnl
AC_CHECKING(for additional X libraries and flags)
if test -n "$x_includes"; then
X_CFLAGS="$X_CFLAGS -I$x_includes"
elif test "$no_x" = yes; then
if test "$no_x" = yes; then
# Not all programs may use this symbol, but it does not hurt to define it.
X_CFLAGS="$X_CFLAGS -DX_DISPLAY_MISSING"
fi
# It would be nice to have a more robust check for the -R ld option than
# just checking for Solaris.
# It would also be nice to do this for all -L options, not just this one.
if test -n "$x_libraries"; then
X_LIBS="$X_LIBS -L$x_libraries"
if test "`(uname) 2>/dev/null`" = SunOS &&
uname -r | grep '^5' >/dev/null; then
X_LIBS="$X_LIBS -R$x_libraries"
fi
fi
# Check for additional X libraries.
if test "$ISC" = yes; then
X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl_s -linet"
else
# Martyn.Johnson@cl.cam.ac.uk says this is needed for Ultrix, if the X
# libraries were built with DECnet support. And karl@cs.umb.edu says
# the Alpha needs dnet_stub (dnet does not exist).
AC_CHECK_LIB(dnet, dnet_ntoa,
[X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet" ac_have_dnet=yes], ac_have_dnet=no)
if test "$ac_have_dnet" = no; then
AC_CHECK_LIB(dnet_stub, dnet_ntoa,
[X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"])
if test -n "$x_includes"; then
X_CFLAGS="$X_CFLAGS -I$x_includes"
fi
# lieder@skyler.mavd.honeywell.com says without -lsocket,
# socket/setsockopt and other routines are undefined under SCO ODT 2.0.
# But -lsocket is broken on IRIX, according to simon@lia.di.epfl.ch.
if test "`(uname) 2>/dev/null`" != IRIX; then
AC_CHECK_LIB(socket, socket, [X_EXTRA_LIBS="$X_EXTRA_LIBS -lsocket"])
# It would be nice to have a more robust check for the -R ld option than
# just checking for Solaris.
# It would also be nice to do this for all -L options, not just this one.
if test -n "$x_libraries"; then
X_LIBS="$X_LIBS -L$x_libraries"
if test "`(uname) 2>/dev/null`" = SunOS &&
uname -r | grep '^5' >/dev/null; then
X_LIBS="$X_LIBS -R$x_libraries"
fi
fi
# Check for additional X libraries.
if test "$ISC" = yes; then
X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl_s -linet"
else
# Martyn.Johnson@cl.cam.ac.uk says this is needed for Ultrix, if the X
# libraries were built with DECnet support. And karl@cs.umb.edu says
# the Alpha needs dnet_stub (dnet does not exist).
AC_CHECK_LIB(dnet, dnet_ntoa,
[X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet" ac_have_dnet=yes], ac_have_dnet=no)
if test "$ac_have_dnet" = no; then
AC_CHECK_LIB(dnet_stub, dnet_ntoa,
[X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"])
fi
# lieder@skyler.mavd.honeywell.com says without -lsocket,
# socket/setsockopt and other routines are undefined under SCO ODT 2.0.
# But -lsocket is broken on IRIX, according to simon@lia.di.epfl.ch.
if test "`(uname) 2>/dev/null`" != IRIX; then
AC_CHECK_LIB(socket, socket, [X_EXTRA_LIBS="$X_EXTRA_LIBS -lsocket"])
fi
fi
fi
#
AC_VERBOSE(X compiler flags: $X_CFLAGS)
AC_VERBOSE(X library flags: $X_LIBS)
AC_VERBOSE(extra X libraries: $X_EXTRA_LIBS)
AC_SUBST(X_CFLAGS)dnl
AC_SUBST(X_LIBS)dnl
AC_SUBST(X_EXTRA_LIBS)dnl