rewhack the compiler checking and fix some minor bugs

This commit is contained in:
David MacKenzie 1996-11-20 00:21:34 +00:00
parent 091c6ec533
commit 27baa892d9
14 changed files with 409 additions and 232 deletions

3
AUTHORS Normal file
View File

@ -0,0 +1,3 @@
Written by David MacKenzie, with help from
Franc,ois Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor,
Roland McGrath, Noah Friedman, david d zuhn, and many others.

View File

@ -1,3 +1,32 @@
Tue Nov 19 10:29:06 1996 David J MacKenzie <djm@catapult.va.pubnix.com>
* acgeneral.m4 (AC_TRY_RUN_NATIVE): Fail if linking fails, and
remove conftest* before running success code, like in AC_TRY_LINK.
(AC_TRY_RUN): Don't require AC_C_CROSS.
(AC_TRY_COMPILER): New macro.
(AC_LANG_C, AC_LANG_CPLUSPLUS): Set cross_compiling.
* acspecific.m4 (AC_PROG_CC_WORKS, AC_PROG_CXX_WORKS): Use
AC_TRY_COMPILER instead of AC_TRY_LINK.
(AC_PROG_CC_GNU, AC_PROG_CC_G): Split out of AC_PROG_CC.
(AC_PROG_CXX_GNU, AC_PROG_CXX_G): Split out of AC_PROG_CXX.
For the *_G macros, make the cache variable names non-GNU-specific.
(AC_C_CROSS): Mark obsolete, and otherwise a no-op.
* AUTHORS: New file.
* Makefile.in (DISTFILES): Add it.
* acspecific.m4 (AC_FUNC_MMAP): Update the getpagesize
declarations from getpagesize.h. Check for unistd.h.
* acgeneral.m4 (AC_OUTPUT_FILES): Run the eval in a subshell.
* acfunctions: Map fnmatch, strftime, getpgrp, setpgrp to their
own macros.
* acgeneral.m4 (AC_OUTPUT_HEADER): Check that $CONFIG_HEADERS is
unset, not that it's empty.
Mon Nov 18 10:24:50 1996 David J MacKenzie <djm@catapult.va.pubnix.com>
* Version 2.11.

View File

@ -61,7 +61,7 @@ M4FILES = autoconf.m4 acgeneral.m4 acoldnames.m4 acspecific.m4 autoheader.m4
# Files that can be generated, but should be up to date for a distribution.
DISTDEP = info Makefile
# Files to distribute.
DISTFILES = COPYING ChangeLog ChangeLog.1 INSTALL \
DISTFILES = AUTHORS COPYING ChangeLog ChangeLog.1 INSTALL \
Makefile.in NEWS README TODO $(M4FILES) \
acconfig.h acfunctions acheaders acidentifiers \
acmakevars acprograms autoconf.info* \

4
NEWS
View File

@ -1,3 +1,7 @@
Major changes in release 2.12:
* Bug fixes.
Major changes in release 2.11:
* AC_PROG_CC and AC_PROG_CXX check whether the compiler works.

13
TODO
View File

@ -482,10 +482,7 @@ From: bostic@bsdi.com (Keith Bostic)
------------------------------------------------------------------------------
Combine AC_PROG_CC_WORKS with AC_C_CROSS. If the compiler exits with
a 0 status and produces a non-empty output file, consider it working.
If the output file is runnable, consider it native, also.
Perhaps also have AC_PROG_CC_WORKS try to link an invalid program, and
Perhaps also have AC_TRY_COMPILER try to link an invalid program, and
die if the compiler seemed to succeed--in which case it's not usable
with autoconf scripts.
@ -609,3 +606,11 @@ From: "Joel N. Weber II" <nemo@koa.iolani.honolulu.hi.us>
------------------------------------------------------------------------------
Merge the two lex macros, AC_PROG_LEX and AC_DECL_YYTEXT?
------------------------------------------------------------------------------
Is it safe to remove the getpagesize references from AC_FUNC_MMAP?
------------------------------------------------------------------------------

View File

@ -14,12 +14,16 @@ memset AC_HEADER_STDC
index AC_HEADER_STDC
rindex AC_HEADER_STDC
getgroups AC_TYPE_GETGROUPS
getpgrp AC_FUNC_GETPGRP
setpgrp AC_FUNC_SETPGRP
signal AC_TYPE_SIGNAL
alloca AC_FUNC_ALLOCA
fnmatch AC_FUNC_FNMATCH
getloadavg AC_FUNC_GETLOADAVG
mmap AC_FUNC_MMAP
setvbuf AC_FUNC_SETVBUF_REVERSED
strcoll AC_FUNC_STRCOLL
strftime AC_FUNC_STRFTIME
utime AC_FUNC_UTIME_NULL
vfork AC_FUNC_VFORK
vprintf AC_FUNC_VPRINTF
@ -28,7 +32,6 @@ vsprintf AC_FUNC_VPRINTF
wait3 AC_FUNC_WAIT3
# Others.
fnmatch AC_CHECK_FUNCS
ftime AC_CHECK_FUNCS
gethostname AC_CHECK_FUNCS
gettimeofday AC_CHECK_FUNCS
@ -49,7 +52,6 @@ stime AC_CHECK_FUNCS
strcspn AC_CHECK_FUNCS
strdup AC_CHECK_FUNCS
strerror AC_CHECK_FUNCS
strftime AC_CHECK_FUNCS
strspn AC_CHECK_FUNCS
strstr AC_CHECK_FUNCS
strtod AC_CHECK_FUNCS

View File

@ -52,7 +52,7 @@ dnl
divert(-1)dnl Throw away output until AC_INIT is called.
changequote([, ])
define(AC_ACVERSION, 2.11)
define(AC_ACVERSION, 2.11.1)
dnl Some old m4's don't support m4exit. But they provide
dnl equivalent functionality by core dumping because of the
@ -1178,6 +1178,7 @@ ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&AC_FD_CC'
ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&AC_FD_CC'
cross_compiling=$ac_cv_prog_cc_cross
])
dnl AC_LANG_CPLUSPLUS()
@ -1188,6 +1189,7 @@ ac_ext=C
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&AC_FD_CC'
ac_link='${CXX-g++} -o conftest $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&AC_FD_CC'
cross_compiling=$ac_cv_prog_cxx_cross
])
dnl Push the current language on a stack.
@ -1420,6 +1422,31 @@ fi
undefine([AC_VAR_NAME])dnl
])
dnl Check whether the current compiler produces executables, and
dnl whether those executables are native to the build system.
dnl Before calling this, call AC_LANG_* to set the right language.
dnl AC_TRY_COMPILER(TEST-PROGRAM, WORKING-CACHE-ID, CROSS-CACHE-ID)
AC_DEFUN(AC_TRY_COMPILER,
[cat > conftest.$ac_ext <<EOF
[#]line __oline__ "configure"
#include "confdefs.h"
[$1]
EOF
if AC_TRY_EVAL(ac_link) && test -s conftest; then
[$2]=yes
# If we can't run a trivial program, we are probably using a cross compiler.
if (./conftest; exit) 2>/dev/null; then
[$3]=no
else
[$3]=yes
fi
else
echo "configure: failed program was:" >&AC_FD_CC
cat conftest.$ac_ext >&AC_FD_CC
[$2]=no
fi
rm -fr conftest*])
dnl ### Checking for libraries
@ -1630,8 +1657,7 @@ ifelse([$4], , , [ rm -rf conftest*
$4
])dnl
fi
rm -f conftest*]
)
rm -f conftest*])
dnl ### Checking for run-time features
@ -1640,8 +1666,7 @@ dnl ### Checking for run-time features
dnl AC_TRY_RUN(PROGRAM, [ACTION-IF-TRUE [, ACTION-IF-FALSE
dnl [, ACTION-IF-CROSS-COMPILING]]])
AC_DEFUN(AC_TRY_RUN,
[AC_REQUIRE([AC_C_CROSS])dnl
if test "$cross_compiling" = yes; then
[if test "$cross_compiling" = yes; then
ifelse([$4], ,
[errprint(__file__:__line__: warning: [AC_TRY_RUN] called without default to allow cross compiling
)dnl
@ -1664,9 +1689,10 @@ extern "C" void exit(int);
])dnl
[$1]
EOF
AC_TRY_EVAL(ac_link)
if test -s conftest && (./conftest; exit) 2>/dev/null; then
ifelse([$2], , :, [$2])
if AC_TRY_EVAL(ac_link) && test -s conftest && (./conftest; exit) 2>/dev/null
then
ifelse([$2], , :, [rm -rf conftest*
$2])
else
echo "configure: failed program was:" >&AC_FD_CC
cat conftest.$ac_ext >&AC_FD_CC
@ -2081,7 +2107,8 @@ s%@srcdir@%$srcdir%g
s%@top_srcdir@%$top_srcdir%g
ifdef([AC_PROVIDE_AC_PROG_INSTALL], [s%@INSTALL@%$INSTALL%g
])dnl
" $ac_given_srcdir/$ac_file_in | eval "$ac_sed_cmds" > $ac_file
dnl The parens around the eval prevent an "illegal io" in Ultrix sh.
" $ac_given_srcdir/$ac_file_in | (eval "$ac_sed_cmds") > $ac_file
dnl This would break Makefile dependencies.
dnl if cmp -s $ac_file conftest.out 2>/dev/null; then
dnl echo "$ac_file is unchanged"
@ -2120,7 +2147,7 @@ ac_eC=' '
ac_eD='%g'
changequote([, ])dnl
if test -z "$CONFIG_HEADERS"; then
if test "${CONFIG_HEADERS+set}" != set; then
EOF
dnl Support passing AC_CONFIG_HEADER a value containing shell variables.
cat >> $CONFIG_STATUS <<EOF

View File

@ -79,39 +79,20 @@ if test -z "$CC"; then
fi
AC_PROG_CC_WORKS
AC_CACHE_CHECK(whether we are using GNU C, ac_cv_prog_gcc,
[dnl The semicolon is to pacify NeXT's syntax-checking cpp.
cat > conftest.c <<EOF
#ifdef __GNUC__
yes;
#endif
EOF
if AC_TRY_COMMAND(${CC-cc} -E conftest.c) | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gcc=yes
else
ac_cv_prog_gcc=no
fi])
AC_PROG_CC_GNU
if test $ac_cv_prog_gcc = yes; then
GCC=yes
dnl Check whether -g works even if CFLAGS is set, in case the package
dnl Check whether -g works, even if CFLAGS is set, in case the package
dnl plays around with CFLAGS (such as to build both debugging and
dnl normal versions of a library), tasteless as that idea is.
ac_test_CFLAGS="${CFLAGS+set}"
ac_save_CFLAGS="$CFLAGS"
CFLAGS=
AC_CACHE_CHECK(whether ${CC-cc} accepts -g, ac_cv_prog_gcc_g,
[echo 'void f(){}' > conftest.c
if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
ac_cv_prog_gcc_g=yes
else
ac_cv_prog_gcc_g=no
fi
rm -f conftest*
])
AC_PROG_CC_G
if test "$ac_test_CFLAGS" = set; then
CFLAGS="$ac_save_CFLAGS"
elif test $ac_cv_prog_gcc_g = yes; then
elif test $ac_cv_prog_cc_g = yes; then
CFLAGS="-g -O2"
else
CFLAGS="-O2"
@ -127,39 +108,20 @@ AC_DEFUN(AC_PROG_CXX,
AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++, gcc)
AC_PROG_CXX_WORKS
AC_CACHE_CHECK(whether we are using GNU C++, ac_cv_prog_gxx,
[dnl The semicolon is to pacify NeXT's syntax-checking cpp.
cat > conftest.C <<EOF
#ifdef __GNUC__
yes;
#endif
EOF
if AC_TRY_COMMAND(${CXX-g++} -E conftest.C) | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gxx=yes
else
ac_cv_prog_gxx=no
fi])
AC_PROG_CXX_GNU
if test $ac_cv_prog_gxx = yes; then
GXX=yes
dnl Check whether -g works even if CXXFLAGS is set, in case the package
dnl Check whether -g works, even if CXXFLAGS is set, in case the package
dnl plays around with CXXFLAGS (such as to build both debugging and
dnl normal versions of a library), tasteless as that idea is.
ac_test_CXXFLAGS="${CXXFLAGS+set}"
ac_save_CXXFLAGS="$CXXFLAGS"
CXXFLAGS=
AC_CACHE_CHECK(whether ${CXX-g++} accepts -g, ac_cv_prog_gxx_g,
[echo 'void f(){}' > conftest.cc
if test -z "`${CXX-g++} -g -c conftest.cc 2>&1`"; then
ac_cv_prog_gxx_g=yes
else
ac_cv_prog_gxx_g=no
fi
rm -f conftest*
])
dnl
AC_PROG_CXX_G
if test "$ac_test_CXXFLAGS" = set; then
CXXFLAGS="$ac_save_CXXFLAGS"
elif test $ac_cv_prog_gxx_g = yes; then
elif test $ac_cv_prog_cxx_g = yes; then
CXXFLAGS="-g -O2"
else
CXXFLAGS="-O2"
@ -174,34 +136,82 @@ AC_DEFUN(AC_PROG_CC_WORKS,
[AC_MSG_CHECKING([whether the C compiler ($CC $CFLAGS $LDFLAGS) works])
AC_LANG_SAVE
AC_LANG_C
dnl We can't try running a program here because we don't know yet if
dnl we're cross-compiling. And we can't check for that first, because the
dnl cross-compiling test being fooled by non-working compiler installations
dnl is the reason we're doing this in the first place.
AC_TRY_LINK(, , ac_cv_prog_cc_works=yes, ac_cv_prog_cc_works=no)
AC_TRY_COMPILER([main(){return(0);}], ac_cv_prog_cc_works, ac_cv_prog_cc_cross)
AC_LANG_RESTORE
AC_MSG_RESULT($ac_cv_prog_cc_works)
if test $ac_cv_prog_cc_works = no; then
AC_MSG_ERROR([Installation or configuration problem: C compiler cannot create executables.])
AC_MSG_ERROR([installation or configuration problem: C compiler cannot create executables.])
fi
AC_MSG_CHECKING([whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler])
AC_MSG_RESULT($ac_cv_prog_cc_cross)
cross_compiling=$ac_cv_prog_cc_cross
])
AC_DEFUN(AC_PROG_CXX_WORKS,
[AC_MSG_CHECKING([whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works])
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
dnl We can't try running a program here because we don't know yet if
dnl we're cross-compiling. And we can't check for that first, because the
dnl cross-compiling test being fooled by non-working compiler installations
dnl is the reason we're doing this in the first place.
AC_TRY_LINK(, , ac_cv_prog_cxx_works=yes, ac_cv_prog_cxx_works=no)
AC_TRY_COMPILER([main(){return(0);}], ac_cv_prog_cxx_works, ac_cv_prog_cxx_cross)
AC_LANG_RESTORE
AC_MSG_RESULT($ac_cv_prog_cxx_works)
if test $ac_cv_prog_cxx_works = no; then
AC_MSG_ERROR([Installation or configuration problem: C++ compiler cannot create executables.])
AC_MSG_ERROR([installation or configuration problem: C++ compiler cannot create executables.])
fi
AC_MSG_CHECKING([whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler])
AC_MSG_RESULT($ac_cv_prog_cxx_cross)
cross_compiling=$ac_cv_prog_cxx_cross
])
AC_DEFUN(AC_PROG_CC_GNU,
[AC_CACHE_CHECK(whether we are using GNU C, ac_cv_prog_gcc,
[dnl The semicolon is to pacify NeXT's syntax-checking cpp.
cat > conftest.c <<EOF
#ifdef __GNUC__
yes;
#endif
EOF
if AC_TRY_COMMAND(${CC-cc} -E conftest.c) | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gcc=yes
else
ac_cv_prog_gcc=no
fi])])
AC_DEFUN(AC_PROG_CXX_GNU,
[AC_CACHE_CHECK(whether we are using GNU C++, ac_cv_prog_gxx,
[dnl The semicolon is to pacify NeXT's syntax-checking cpp.
cat > conftest.C <<EOF
#ifdef __GNUC__
yes;
#endif
EOF
if AC_TRY_COMMAND(${CXX-g++} -E conftest.C) | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gxx=yes
else
ac_cv_prog_gxx=no
fi])])
AC_DEFUN(AC_PROG_CC_G,
[AC_CACHE_CHECK(whether ${CC-cc} accepts -g, ac_cv_prog_cc_g,
[echo 'void f(){}' > conftest.c
if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
ac_cv_prog_cc_g=yes
else
ac_cv_prog_cc_g=no
fi
rm -f conftest*
])])
AC_DEFUN(AC_PROG_CXX_G,
[AC_CACHE_CHECK(whether ${CXX-g++} accepts -g, ac_cv_prog_cxx_g,
[echo 'void f(){}' > conftest.cc
if test -z "`${CXX-g++} -g -c conftest.cc 2>&1`"; then
ac_cv_prog_cxx_g=yes
else
ac_cv_prog_cxx_g=no
fi
rm -f conftest*
])])
AC_DEFUN(AC_PROG_GCC_TRADITIONAL,
[AC_REQUIRE([AC_PROG_CC])dnl
AC_REQUIRE([AC_PROG_CPP])dnl
@ -827,7 +837,8 @@ fi
])
AC_DEFUN(AC_FUNC_MMAP,
[AC_CHECK_FUNCS(getpagesize)
[AC_CHECK_HEADERS(unistd.h)
AC_CHECK_FUNCS(getpagesize)
AC_CACHE_CHECK(for working mmap, ac_cv_func_mmap_fixed_mapped,
[AC_TRY_RUN([
/* Thanks to Mike Haertel and Jim Avera for this test.
@ -855,25 +866,46 @@ AC_CACHE_CHECK(for working mmap, ac_cv_func_mmap_fixed_mapped,
#include <fcntl.h>
#include <sys/mman.h>
/* This mess was copied from the GNU getpagesize.h. */
#ifndef HAVE_GETPAGESIZE
# include <sys/param.h>
# ifdef EXEC_PAGESIZE
# define getpagesize() EXEC_PAGESIZE
# else
# ifdef NBPG
# define getpagesize() NBPG * CLSIZE
# ifndef CLSIZE
# define CLSIZE 1
# endif
# else
# ifdef NBPC
# define getpagesize() NBPC
# else
# define getpagesize() PAGESIZE /* SVR4 */
# endif
# endif
# ifdef HAVE_UNISTD_H
# include <unistd.h>
# endif
#endif
/* Assume that all systems that can run configure have sys/param.h. */
# ifndef HAVE_SYS_PARAM_H
# define HAVE_SYS_PARAM_H 1
# endif
# ifdef _SC_PAGESIZE
# define getpagesize() sysconf(_SC_PAGESIZE)
# else /* no _SC_PAGESIZE */
# ifdef HAVE_SYS_PARAM_H
# include <sys/param.h>
# ifdef EXEC_PAGESIZE
# define getpagesize() EXEC_PAGESIZE
# else /* no EXEC_PAGESIZE */
# ifdef NBPG
# define getpagesize() NBPG * CLSIZE
# ifndef CLSIZE
# define CLSIZE 1
# endif /* no CLSIZE */
# else /* no NBPG */
# ifdef NBPC
# define getpagesize() NBPC
# else /* no NBPC */
# ifdef PAGESIZE
# define getpagesize() PAGESIZE
# endif /* PAGESIZE */
# endif /* no NBPC */
# endif /* no NBPG */
# endif /* no EXEC_PAGESIZE */
# else /* no HAVE_SYS_PARAM_H */
# define getpagesize() 8192 /* punt totally */
# endif /* no HAVE_SYS_PARAM_H */
# endif /* no _SC_PAGESIZE */
#endif /* no HAVE_GETPAGESIZE */
#ifdef __cplusplus
extern "C" { void *malloc(unsigned); }
@ -1533,12 +1565,7 @@ dnl ### Checks for compiler characteristics
AC_DEFUN(AC_C_CROSS,
[# If we cannot run a trivial program, we are probably using a cross compiler.
AC_CACHE_CHECK(whether using a cross-compiler, ac_cv_c_cross,
[AC_TRY_RUN([main(){return(0);}],
ac_cv_c_cross=no, ac_cv_c_cross=yes, ac_cv_c_cross=yes)])
cross_compiling=$ac_cv_c_cross
])
[AC_OBSOLETE([$0], [; it has been merged into AC_PROG_CC])])
AC_DEFUN(AC_C_CHAR_UNSIGNED,
[AC_CACHE_CHECK(whether char is unsigned, ac_cv_c_char_unsigned,

View File

@ -6,8 +6,8 @@
@c @setchapternewpage odd
@c %**end of header
@set EDITION 2.11
@set VERSION 2.11
@set EDITION 2.11.1
@set VERSION 2.11.1
@set UPDATED November 1996
@iftex
@ -1500,14 +1500,21 @@ fastest implementation.
@ovindex CC
@ovindex CFLAGS
Determine a C compiler to use. If @code{CC} is not already set in the
environment, check for @code{gcc}, and use @code{cc} if it's not found.
environment, check for @code{gcc}, and use @code{cc} if that's not found.
Set output variable @code{CC} to the name of the compiler found.
If using the GNU C compiler, set shell variable @code{GCC} to
@samp{yes}, empty otherwise. If output variable @code{CFLAGS} was
not already set, set it to @samp{-g -O} for the GNU C compiler
(@samp{-O} on systems where GCC does not accept @samp{-g}), or @samp{-g}
not already set, set it to @samp{-g -O2} for the GNU C compiler
(@samp{-O2} on systems where GCC does not accept @samp{-g}), or @samp{-g}
for other compilers.
If the C compiler being used does not produce executables that can run
on the system where @code{configure} is being run, set the shell
variable @code{cross_compiling} to @samp{yes}, otherwise @samp{no}.
In other words, this tests whether the build system type is different
from the host system type (the target system type is irrelevant to this
test). @xref{Manual Configuration}, for more on support for cross compiling.
@end defmac
@defmac AC_PROG_CC_C_O
@ -1544,9 +1551,16 @@ last resort set @code{CXX} to @code{gcc}.
If using the GNU C++ compiler, set shell variable @code{GXX} to
@samp{yes}, empty otherwise. If output variable @code{CXXFLAGS} was
not already set, set it to @samp{-g -O} for the GNU C++ compiler
(@samp{-O} on systems where G++ does not accept @samp{-g}), or @samp{-g}
not already set, set it to @samp{-g -O2} for the GNU C++ compiler
(@samp{-O2} on systems where G++ does not accept @samp{-g}), or @samp{-g}
for other compilers.
If the C++ compiler being used does not produce executables that can run
on the system where @code{configure} is being run, set the shell
variable @code{cross_compiling} to @samp{yes}, otherwise @samp{no}.
In other words, this tests whether the build system type is different
from the host system type (the target system type is irrelevant to this
test). @xref{Manual Configuration}, for more on support for cross compiling.
@end defmac
@defmac AC_PROG_CXXCPP
@ -2944,8 +2958,7 @@ compiling.
If the C compiler being used does not produce executables that run on
the system where @code{configure} is being run, then the test program is
not run. If the optional shell commands @var{action-if-cross-compiling}
are given, they are run instead and this macro calls @code{AC_C_CROSS}
if it has not already been called. Otherwise, @code{configure} prints
are given, they are run instead. Otherwise, @code{configure} prints
an error message and exits.
@end defmac
@ -2965,18 +2978,13 @@ the correct values for the target system (@pxref{Caching Results}).
To provide a default for calls of @code{AC_TRY_RUN} that are embedded in
other macros, including a few of the ones that come with Autoconf, you
can call @code{AC_C_CROSS} before running them. Then, if the shell
can call @code{AC_PROG_CC} before running them. Then, if the shell
variable @code{cross_compiling} is set to @samp{yes}, use an alternate
method to get the results instead of calling the macros.
@defmac AC_C_CROSS
@maindex C_CROSS
If the C compiler being used does not produce executables that can run
on the system where @code{configure} is being run, set the shell
variable @code{cross_compiling} to @samp{yes}, otherwise @samp{no}.
In other words, this tests whether the build system type is different
from the host system type (the target system type is irrelevant to this
test). @xref{Manual Configuration}, for more on support for cross compiling.
This macro is obsolete; it does nothing.
@end defmac
@node Guidelines, Test Functions, Test Programs, Run Time
@ -3171,13 +3179,17 @@ compiler is used in tests that follow in @file{configure.in}.
@defmac AC_LANG_C
@maindex LANG_C
Do compilation tests using @code{CC} and @code{CPP} and use extension
@file{.c} for test programs.
@file{.c} for test programs. Set the shell variable
@code{cross_compiling} to the value computed by @code{AC_PROG_CC} if it
has been run, empty otherwise.
@end defmac
@defmac AC_LANG_CPLUSPLUS
@maindex LANG_CPLUSPLUS
Do compilation tests using @code{CXX} and @code{CXXCPP} and use
extension @file{.C} for test programs.
extension @file{.C} for test programs. Set the shell variable
@code{cross_compiling} to the value computed by @code{AC_PROG_CXX} if
it has been run, empty otherwise.
@end defmac
@defmac AC_LANG_SAVE

View File

@ -61,7 +61,7 @@ M4FILES = autoconf.m4 acgeneral.m4 acoldnames.m4 acspecific.m4 autoheader.m4
# Files that can be generated, but should be up to date for a distribution.
DISTDEP = info Makefile
# Files to distribute.
DISTFILES = COPYING ChangeLog ChangeLog.1 INSTALL \
DISTFILES = AUTHORS COPYING ChangeLog ChangeLog.1 INSTALL \
Makefile.in NEWS README TODO $(M4FILES) \
acconfig.h acfunctions acheaders acidentifiers \
acmakevars acprograms autoconf.info* \

View File

@ -6,8 +6,8 @@
@c @setchapternewpage odd
@c %**end of header
@set EDITION 2.11
@set VERSION 2.11
@set EDITION 2.11.1
@set VERSION 2.11.1
@set UPDATED November 1996
@iftex
@ -1500,14 +1500,21 @@ fastest implementation.
@ovindex CC
@ovindex CFLAGS
Determine a C compiler to use. If @code{CC} is not already set in the
environment, check for @code{gcc}, and use @code{cc} if it's not found.
environment, check for @code{gcc}, and use @code{cc} if that's not found.
Set output variable @code{CC} to the name of the compiler found.
If using the GNU C compiler, set shell variable @code{GCC} to
@samp{yes}, empty otherwise. If output variable @code{CFLAGS} was
not already set, set it to @samp{-g -O} for the GNU C compiler
(@samp{-O} on systems where GCC does not accept @samp{-g}), or @samp{-g}
not already set, set it to @samp{-g -O2} for the GNU C compiler
(@samp{-O2} on systems where GCC does not accept @samp{-g}), or @samp{-g}
for other compilers.
If the C compiler being used does not produce executables that can run
on the system where @code{configure} is being run, set the shell
variable @code{cross_compiling} to @samp{yes}, otherwise @samp{no}.
In other words, this tests whether the build system type is different
from the host system type (the target system type is irrelevant to this
test). @xref{Manual Configuration}, for more on support for cross compiling.
@end defmac
@defmac AC_PROG_CC_C_O
@ -1544,9 +1551,16 @@ last resort set @code{CXX} to @code{gcc}.
If using the GNU C++ compiler, set shell variable @code{GXX} to
@samp{yes}, empty otherwise. If output variable @code{CXXFLAGS} was
not already set, set it to @samp{-g -O} for the GNU C++ compiler
(@samp{-O} on systems where G++ does not accept @samp{-g}), or @samp{-g}
not already set, set it to @samp{-g -O2} for the GNU C++ compiler
(@samp{-O2} on systems where G++ does not accept @samp{-g}), or @samp{-g}
for other compilers.
If the C++ compiler being used does not produce executables that can run
on the system where @code{configure} is being run, set the shell
variable @code{cross_compiling} to @samp{yes}, otherwise @samp{no}.
In other words, this tests whether the build system type is different
from the host system type (the target system type is irrelevant to this
test). @xref{Manual Configuration}, for more on support for cross compiling.
@end defmac
@defmac AC_PROG_CXXCPP
@ -2944,8 +2958,7 @@ compiling.
If the C compiler being used does not produce executables that run on
the system where @code{configure} is being run, then the test program is
not run. If the optional shell commands @var{action-if-cross-compiling}
are given, they are run instead and this macro calls @code{AC_C_CROSS}
if it has not already been called. Otherwise, @code{configure} prints
are given, they are run instead. Otherwise, @code{configure} prints
an error message and exits.
@end defmac
@ -2965,18 +2978,13 @@ the correct values for the target system (@pxref{Caching Results}).
To provide a default for calls of @code{AC_TRY_RUN} that are embedded in
other macros, including a few of the ones that come with Autoconf, you
can call @code{AC_C_CROSS} before running them. Then, if the shell
can call @code{AC_PROG_CC} before running them. Then, if the shell
variable @code{cross_compiling} is set to @samp{yes}, use an alternate
method to get the results instead of calling the macros.
@defmac AC_C_CROSS
@maindex C_CROSS
If the C compiler being used does not produce executables that can run
on the system where @code{configure} is being run, set the shell
variable @code{cross_compiling} to @samp{yes}, otherwise @samp{no}.
In other words, this tests whether the build system type is different
from the host system type (the target system type is irrelevant to this
test). @xref{Manual Configuration}, for more on support for cross compiling.
This macro is obsolete; it does nothing.
@end defmac
@node Guidelines, Test Functions, Test Programs, Run Time
@ -3171,13 +3179,17 @@ compiler is used in tests that follow in @file{configure.in}.
@defmac AC_LANG_C
@maindex LANG_C
Do compilation tests using @code{CC} and @code{CPP} and use extension
@file{.c} for test programs.
@file{.c} for test programs. Set the shell variable
@code{cross_compiling} to the value computed by @code{AC_PROG_CC} if it
has been run, empty otherwise.
@end defmac
@defmac AC_LANG_CPLUSPLUS
@maindex LANG_CPLUSPLUS
Do compilation tests using @code{CXX} and @code{CXXCPP} and use
extension @file{.C} for test programs.
extension @file{.C} for test programs. Set the shell variable
@code{cross_compiling} to the value computed by @code{AC_PROG_CXX} if
it has been run, empty otherwise.
@end defmac
@defmac AC_LANG_SAVE

View File

@ -52,7 +52,7 @@ dnl
divert(-1)dnl Throw away output until AC_INIT is called.
changequote([, ])
define(AC_ACVERSION, 2.11)
define(AC_ACVERSION, 2.11.1)
dnl Some old m4's don't support m4exit. But they provide
dnl equivalent functionality by core dumping because of the
@ -1178,6 +1178,7 @@ ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&AC_FD_CC'
ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&AC_FD_CC'
cross_compiling=$ac_cv_prog_cc_cross
])
dnl AC_LANG_CPLUSPLUS()
@ -1188,6 +1189,7 @@ ac_ext=C
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&AC_FD_CC'
ac_link='${CXX-g++} -o conftest $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&AC_FD_CC'
cross_compiling=$ac_cv_prog_cxx_cross
])
dnl Push the current language on a stack.
@ -1420,6 +1422,31 @@ fi
undefine([AC_VAR_NAME])dnl
])
dnl Check whether the current compiler produces executables, and
dnl whether those executables are native to the build system.
dnl Before calling this, call AC_LANG_* to set the right language.
dnl AC_TRY_COMPILER(TEST-PROGRAM, WORKING-CACHE-ID, CROSS-CACHE-ID)
AC_DEFUN(AC_TRY_COMPILER,
[cat > conftest.$ac_ext <<EOF
[#]line __oline__ "configure"
#include "confdefs.h"
[$1]
EOF
if AC_TRY_EVAL(ac_link) && test -s conftest; then
[$2]=yes
# If we can't run a trivial program, we are probably using a cross compiler.
if (./conftest; exit) 2>/dev/null; then
[$3]=no
else
[$3]=yes
fi
else
echo "configure: failed program was:" >&AC_FD_CC
cat conftest.$ac_ext >&AC_FD_CC
[$2]=no
fi
rm -fr conftest*])
dnl ### Checking for libraries
@ -1630,8 +1657,7 @@ ifelse([$4], , , [ rm -rf conftest*
$4
])dnl
fi
rm -f conftest*]
)
rm -f conftest*])
dnl ### Checking for run-time features
@ -1640,8 +1666,7 @@ dnl ### Checking for run-time features
dnl AC_TRY_RUN(PROGRAM, [ACTION-IF-TRUE [, ACTION-IF-FALSE
dnl [, ACTION-IF-CROSS-COMPILING]]])
AC_DEFUN(AC_TRY_RUN,
[AC_REQUIRE([AC_C_CROSS])dnl
if test "$cross_compiling" = yes; then
[if test "$cross_compiling" = yes; then
ifelse([$4], ,
[errprint(__file__:__line__: warning: [AC_TRY_RUN] called without default to allow cross compiling
)dnl
@ -1664,9 +1689,10 @@ extern "C" void exit(int);
])dnl
[$1]
EOF
AC_TRY_EVAL(ac_link)
if test -s conftest && (./conftest; exit) 2>/dev/null; then
ifelse([$2], , :, [$2])
if AC_TRY_EVAL(ac_link) && test -s conftest && (./conftest; exit) 2>/dev/null
then
ifelse([$2], , :, [rm -rf conftest*
$2])
else
echo "configure: failed program was:" >&AC_FD_CC
cat conftest.$ac_ext >&AC_FD_CC
@ -2081,7 +2107,8 @@ s%@srcdir@%$srcdir%g
s%@top_srcdir@%$top_srcdir%g
ifdef([AC_PROVIDE_AC_PROG_INSTALL], [s%@INSTALL@%$INSTALL%g
])dnl
" $ac_given_srcdir/$ac_file_in | eval "$ac_sed_cmds" > $ac_file
dnl The parens around the eval prevent an "illegal io" in Ultrix sh.
" $ac_given_srcdir/$ac_file_in | (eval "$ac_sed_cmds") > $ac_file
dnl This would break Makefile dependencies.
dnl if cmp -s $ac_file conftest.out 2>/dev/null; then
dnl echo "$ac_file is unchanged"
@ -2120,7 +2147,7 @@ ac_eC=' '
ac_eD='%g'
changequote([, ])dnl
if test -z "$CONFIG_HEADERS"; then
if test "${CONFIG_HEADERS+set}" != set; then
EOF
dnl Support passing AC_CONFIG_HEADER a value containing shell variables.
cat >> $CONFIG_STATUS <<EOF

View File

@ -79,39 +79,20 @@ if test -z "$CC"; then
fi
AC_PROG_CC_WORKS
AC_CACHE_CHECK(whether we are using GNU C, ac_cv_prog_gcc,
[dnl The semicolon is to pacify NeXT's syntax-checking cpp.
cat > conftest.c <<EOF
#ifdef __GNUC__
yes;
#endif
EOF
if AC_TRY_COMMAND(${CC-cc} -E conftest.c) | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gcc=yes
else
ac_cv_prog_gcc=no
fi])
AC_PROG_CC_GNU
if test $ac_cv_prog_gcc = yes; then
GCC=yes
dnl Check whether -g works even if CFLAGS is set, in case the package
dnl Check whether -g works, even if CFLAGS is set, in case the package
dnl plays around with CFLAGS (such as to build both debugging and
dnl normal versions of a library), tasteless as that idea is.
ac_test_CFLAGS="${CFLAGS+set}"
ac_save_CFLAGS="$CFLAGS"
CFLAGS=
AC_CACHE_CHECK(whether ${CC-cc} accepts -g, ac_cv_prog_gcc_g,
[echo 'void f(){}' > conftest.c
if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
ac_cv_prog_gcc_g=yes
else
ac_cv_prog_gcc_g=no
fi
rm -f conftest*
])
AC_PROG_CC_G
if test "$ac_test_CFLAGS" = set; then
CFLAGS="$ac_save_CFLAGS"
elif test $ac_cv_prog_gcc_g = yes; then
elif test $ac_cv_prog_cc_g = yes; then
CFLAGS="-g -O2"
else
CFLAGS="-O2"
@ -127,39 +108,20 @@ AC_DEFUN(AC_PROG_CXX,
AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++, gcc)
AC_PROG_CXX_WORKS
AC_CACHE_CHECK(whether we are using GNU C++, ac_cv_prog_gxx,
[dnl The semicolon is to pacify NeXT's syntax-checking cpp.
cat > conftest.C <<EOF
#ifdef __GNUC__
yes;
#endif
EOF
if AC_TRY_COMMAND(${CXX-g++} -E conftest.C) | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gxx=yes
else
ac_cv_prog_gxx=no
fi])
AC_PROG_CXX_GNU
if test $ac_cv_prog_gxx = yes; then
GXX=yes
dnl Check whether -g works even if CXXFLAGS is set, in case the package
dnl Check whether -g works, even if CXXFLAGS is set, in case the package
dnl plays around with CXXFLAGS (such as to build both debugging and
dnl normal versions of a library), tasteless as that idea is.
ac_test_CXXFLAGS="${CXXFLAGS+set}"
ac_save_CXXFLAGS="$CXXFLAGS"
CXXFLAGS=
AC_CACHE_CHECK(whether ${CXX-g++} accepts -g, ac_cv_prog_gxx_g,
[echo 'void f(){}' > conftest.cc
if test -z "`${CXX-g++} -g -c conftest.cc 2>&1`"; then
ac_cv_prog_gxx_g=yes
else
ac_cv_prog_gxx_g=no
fi
rm -f conftest*
])
dnl
AC_PROG_CXX_G
if test "$ac_test_CXXFLAGS" = set; then
CXXFLAGS="$ac_save_CXXFLAGS"
elif test $ac_cv_prog_gxx_g = yes; then
elif test $ac_cv_prog_cxx_g = yes; then
CXXFLAGS="-g -O2"
else
CXXFLAGS="-O2"
@ -174,34 +136,82 @@ AC_DEFUN(AC_PROG_CC_WORKS,
[AC_MSG_CHECKING([whether the C compiler ($CC $CFLAGS $LDFLAGS) works])
AC_LANG_SAVE
AC_LANG_C
dnl We can't try running a program here because we don't know yet if
dnl we're cross-compiling. And we can't check for that first, because the
dnl cross-compiling test being fooled by non-working compiler installations
dnl is the reason we're doing this in the first place.
AC_TRY_LINK(, , ac_cv_prog_cc_works=yes, ac_cv_prog_cc_works=no)
AC_TRY_COMPILER([main(){return(0);}], ac_cv_prog_cc_works, ac_cv_prog_cc_cross)
AC_LANG_RESTORE
AC_MSG_RESULT($ac_cv_prog_cc_works)
if test $ac_cv_prog_cc_works = no; then
AC_MSG_ERROR([Installation or configuration problem: C compiler cannot create executables.])
AC_MSG_ERROR([installation or configuration problem: C compiler cannot create executables.])
fi
AC_MSG_CHECKING([whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler])
AC_MSG_RESULT($ac_cv_prog_cc_cross)
cross_compiling=$ac_cv_prog_cc_cross
])
AC_DEFUN(AC_PROG_CXX_WORKS,
[AC_MSG_CHECKING([whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works])
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
dnl We can't try running a program here because we don't know yet if
dnl we're cross-compiling. And we can't check for that first, because the
dnl cross-compiling test being fooled by non-working compiler installations
dnl is the reason we're doing this in the first place.
AC_TRY_LINK(, , ac_cv_prog_cxx_works=yes, ac_cv_prog_cxx_works=no)
AC_TRY_COMPILER([main(){return(0);}], ac_cv_prog_cxx_works, ac_cv_prog_cxx_cross)
AC_LANG_RESTORE
AC_MSG_RESULT($ac_cv_prog_cxx_works)
if test $ac_cv_prog_cxx_works = no; then
AC_MSG_ERROR([Installation or configuration problem: C++ compiler cannot create executables.])
AC_MSG_ERROR([installation or configuration problem: C++ compiler cannot create executables.])
fi
AC_MSG_CHECKING([whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler])
AC_MSG_RESULT($ac_cv_prog_cxx_cross)
cross_compiling=$ac_cv_prog_cxx_cross
])
AC_DEFUN(AC_PROG_CC_GNU,
[AC_CACHE_CHECK(whether we are using GNU C, ac_cv_prog_gcc,
[dnl The semicolon is to pacify NeXT's syntax-checking cpp.
cat > conftest.c <<EOF
#ifdef __GNUC__
yes;
#endif
EOF
if AC_TRY_COMMAND(${CC-cc} -E conftest.c) | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gcc=yes
else
ac_cv_prog_gcc=no
fi])])
AC_DEFUN(AC_PROG_CXX_GNU,
[AC_CACHE_CHECK(whether we are using GNU C++, ac_cv_prog_gxx,
[dnl The semicolon is to pacify NeXT's syntax-checking cpp.
cat > conftest.C <<EOF
#ifdef __GNUC__
yes;
#endif
EOF
if AC_TRY_COMMAND(${CXX-g++} -E conftest.C) | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gxx=yes
else
ac_cv_prog_gxx=no
fi])])
AC_DEFUN(AC_PROG_CC_G,
[AC_CACHE_CHECK(whether ${CC-cc} accepts -g, ac_cv_prog_cc_g,
[echo 'void f(){}' > conftest.c
if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
ac_cv_prog_cc_g=yes
else
ac_cv_prog_cc_g=no
fi
rm -f conftest*
])])
AC_DEFUN(AC_PROG_CXX_G,
[AC_CACHE_CHECK(whether ${CXX-g++} accepts -g, ac_cv_prog_cxx_g,
[echo 'void f(){}' > conftest.cc
if test -z "`${CXX-g++} -g -c conftest.cc 2>&1`"; then
ac_cv_prog_cxx_g=yes
else
ac_cv_prog_cxx_g=no
fi
rm -f conftest*
])])
AC_DEFUN(AC_PROG_GCC_TRADITIONAL,
[AC_REQUIRE([AC_PROG_CC])dnl
AC_REQUIRE([AC_PROG_CPP])dnl
@ -827,7 +837,8 @@ fi
])
AC_DEFUN(AC_FUNC_MMAP,
[AC_CHECK_FUNCS(getpagesize)
[AC_CHECK_HEADERS(unistd.h)
AC_CHECK_FUNCS(getpagesize)
AC_CACHE_CHECK(for working mmap, ac_cv_func_mmap_fixed_mapped,
[AC_TRY_RUN([
/* Thanks to Mike Haertel and Jim Avera for this test.
@ -855,25 +866,46 @@ AC_CACHE_CHECK(for working mmap, ac_cv_func_mmap_fixed_mapped,
#include <fcntl.h>
#include <sys/mman.h>
/* This mess was copied from the GNU getpagesize.h. */
#ifndef HAVE_GETPAGESIZE
# include <sys/param.h>
# ifdef EXEC_PAGESIZE
# define getpagesize() EXEC_PAGESIZE
# else
# ifdef NBPG
# define getpagesize() NBPG * CLSIZE
# ifndef CLSIZE
# define CLSIZE 1
# endif
# else
# ifdef NBPC
# define getpagesize() NBPC
# else
# define getpagesize() PAGESIZE /* SVR4 */
# endif
# endif
# ifdef HAVE_UNISTD_H
# include <unistd.h>
# endif
#endif
/* Assume that all systems that can run configure have sys/param.h. */
# ifndef HAVE_SYS_PARAM_H
# define HAVE_SYS_PARAM_H 1
# endif
# ifdef _SC_PAGESIZE
# define getpagesize() sysconf(_SC_PAGESIZE)
# else /* no _SC_PAGESIZE */
# ifdef HAVE_SYS_PARAM_H
# include <sys/param.h>
# ifdef EXEC_PAGESIZE
# define getpagesize() EXEC_PAGESIZE
# else /* no EXEC_PAGESIZE */
# ifdef NBPG
# define getpagesize() NBPG * CLSIZE
# ifndef CLSIZE
# define CLSIZE 1
# endif /* no CLSIZE */
# else /* no NBPG */
# ifdef NBPC
# define getpagesize() NBPC
# else /* no NBPC */
# ifdef PAGESIZE
# define getpagesize() PAGESIZE
# endif /* PAGESIZE */
# endif /* no NBPC */
# endif /* no NBPG */
# endif /* no EXEC_PAGESIZE */
# else /* no HAVE_SYS_PARAM_H */
# define getpagesize() 8192 /* punt totally */
# endif /* no HAVE_SYS_PARAM_H */
# endif /* no _SC_PAGESIZE */
#endif /* no HAVE_GETPAGESIZE */
#ifdef __cplusplus
extern "C" { void *malloc(unsigned); }
@ -1533,12 +1565,7 @@ dnl ### Checks for compiler characteristics
AC_DEFUN(AC_C_CROSS,
[# If we cannot run a trivial program, we are probably using a cross compiler.
AC_CACHE_CHECK(whether using a cross-compiler, ac_cv_c_cross,
[AC_TRY_RUN([main(){return(0);}],
ac_cv_c_cross=no, ac_cv_c_cross=yes, ac_cv_c_cross=yes)])
cross_compiling=$ac_cv_c_cross
])
[AC_OBSOLETE([$0], [; it has been merged into AC_PROG_CC])])
AC_DEFUN(AC_C_CHAR_UNSIGNED,
[AC_CACHE_CHECK(whether char is unsigned, ac_cv_c_char_unsigned,

View File

@ -14,12 +14,16 @@ memset AC_HEADER_STDC
index AC_HEADER_STDC
rindex AC_HEADER_STDC
getgroups AC_TYPE_GETGROUPS
getpgrp AC_FUNC_GETPGRP
setpgrp AC_FUNC_SETPGRP
signal AC_TYPE_SIGNAL
alloca AC_FUNC_ALLOCA
fnmatch AC_FUNC_FNMATCH
getloadavg AC_FUNC_GETLOADAVG
mmap AC_FUNC_MMAP
setvbuf AC_FUNC_SETVBUF_REVERSED
strcoll AC_FUNC_STRCOLL
strftime AC_FUNC_STRFTIME
utime AC_FUNC_UTIME_NULL
vfork AC_FUNC_VFORK
vprintf AC_FUNC_VPRINTF
@ -28,7 +32,6 @@ vsprintf AC_FUNC_VPRINTF
wait3 AC_FUNC_WAIT3
# Others.
fnmatch AC_CHECK_FUNCS
ftime AC_CHECK_FUNCS
gethostname AC_CHECK_FUNCS
gettimeofday AC_CHECK_FUNCS
@ -49,7 +52,6 @@ stime AC_CHECK_FUNCS
strcspn AC_CHECK_FUNCS
strdup AC_CHECK_FUNCS
strerror AC_CHECK_FUNCS
strftime AC_CHECK_FUNCS
strspn AC_CHECK_FUNCS
strstr AC_CHECK_FUNCS
strtod AC_CHECK_FUNCS