Integrate AC_PROG_CC_STDC into AC_PROG_CC.

* lib/autoconf/c.m4 (AC_PROG_CC_STDC): Rename to _AC_PROG_CC_STDC.
AU_DEFUN old name.  Use _AC_COMPILE_IFELSE.
(AC_PROG_CC): Call _AC_PROG_CC_STDC.
(AC_C_INLINE): Do not require AC_PROG_CC_STDC.
(AC_C_CONST): Same.
(AC_C_INLINE): Same.
(AC_C_PROTOTYPES): Same.  Require AC_PROG_CC instead.
* doc/autoconf.texi, NEWS: Document.
* tests/mktests.sh (au_exclude_list): Add AC_PROG_CC_STDC and
AC_C_CROSS.
This commit is contained in:
Peter Eisentraut 2002-04-02 18:22:08 +00:00
parent 3aec90e1cb
commit 931312faea
6 changed files with 60 additions and 42 deletions

View File

@ -1,3 +1,18 @@
2002-04-02 Peter Eisentraut <peter_e@gmx.net>
Integrate AC_PROG_CC_STDC into AC_PROG_CC.
* lib/autoconf/c.m4 (AC_PROG_CC_STDC): Rename to _AC_PROG_CC_STDC.
AU_DEFUN old name. Use _AC_COMPILE_IFELSE.
(AC_PROG_CC): Call _AC_PROG_CC_STDC.
(AC_C_INLINE): Do not require AC_PROG_CC_STDC.
(AC_C_CONST): Same.
(AC_C_INLINE): Same.
(AC_C_PROTOTYPES): Same. Require AC_PROG_CC instead.
* doc/autoconf.texi, NEWS: Document.
* tests/mktests.sh (au_exclude_list): Add AC_PROG_CC_STDC and
AC_C_CROSS.
2002-04-02 Akim Demaille <akim@epita.fr>
* lib/m4sugar/m4sh.m4 (AS_SHELL_SANITIZE): Invoke

4
NEWS
View File

@ -9,6 +9,10 @@
- config.status 2.53 may fail on some architectures where `mkdir -p'
fails on existing directories.
** Macros
- AC_PROG_CC_STDC is integrated into AC_PROG_CC.
* Major changes in Autoconf 2.53

View File

@ -4770,6 +4770,19 @@ this:
AC_PROG_CC(cl egcs gcc cc)
@end example
If the C compiler is not in @sc{ansi} C mode by default, try to add an
option to output variable @code{CC} to make it so. This macro tries
various options that select @sc{ansi} C on some system or another. It
considers the compiler to be in @sc{ansi} C mode if it handles function
prototypes correctly.
After calling this macro you can check whether the C compiler has been
set to accept @sc{ansi} C; if not, the shell variable
@code{ac_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source
code in @sc{ansi} C, you can make an un-@sc{ansi}fied copy of it by
using the program @code{ansi2knr}, which comes with Automake. See also
under @code{AC_C_PROTOTYPES} below.
If using the @sc{gnu} C compiler, set shell variable @code{GCC} to
@samp{yes}. If output variable @code{CFLAGS} was not already set, set
it to @option{-g -O2} for the @sc{gnu} C compiler (@option{-O2} on systems
@ -4787,22 +4800,6 @@ macro was created for @sc{gnu} Make to choose the default C compilation
rule.
@end defmac
@defmac AC_PROG_CC_STDC
@acindex PROG_CC_STDC
@ovindex CC
If the C compiler is not in @sc{ansi} C mode by default, try to add an
option to output variable @code{CC} to make it so. This macro tries
various options that select @sc{ansi} C on some system or another. It
considers the compiler to be in @sc{ansi} C mode if it handles function
prototypes correctly.
If you use this macro, you should check after calling it whether the C
compiler has been set to accept @sc{ansi} C; if not, the shell variable
@code{ac_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source
code in @sc{ansi} C, you can make an un-@sc{ansi}fied copy of it by
using the program @code{ansi2knr}, which comes with Automake.
@end defmac
@defmac AC_PROG_CPP
@acindex PROG_CPP
@ -4941,8 +4938,8 @@ found in macros such as this:
@cvindex PROTOTYPES
@cvindex __PROTOTYPES
@cvindex PARAMS
Check to see if function prototypes are understood by the compiler. If
so, define @code{PROTOTYPES} and @code{__PROTOTYPES}.
If function prototypes are understood by the compiler (as determined by
@code{AC_PROG_CC}), define @code{PROTOTYPES} and @code{__PROTOTYPES}.
In the case the compiler does not handle
prototypes, you should use @code{ansi2knr}, which comes with the
Automake distribution, to unprotoize function definitions. For
@ -11819,6 +11816,11 @@ AC_CONFIG_COMMANDS([default], [[echo "Square brackets: []"]])
@code{AC_PREFIX_PROGRAM}
@end defmac
@defmac AC_PROG_CC_STDC
@acindex PROG_CC_STDC
This macro has been integrated into @code{AC_PROG_CC_STDC}.
@end defmac
@defmac AC_PROGRAMS_CHECK
@acindex PROGRAMS_CHECK
@code{AC_CHECK_PROGS}

View File

@ -432,6 +432,7 @@ m4_expand_once([_AC_COMPILER_OBJEXT])[]dnl
_AC_LANG_COMPILER_GNU
GCC=`test $ac_compiler_gnu = yes && echo yes`
_AC_PROG_CC_G
_AC_PROG_CC_STDC
# Some people use a C++ compiler to compile C. Since we use `exit',
# in C++ we need to declare it. In case someone uses the same compiler
# for both compiling C and C++ we need to have the C++ compiler decide
@ -723,24 +724,15 @@ fi
# 4b. C compiler characteristics. #
# -------------------------------- #
# AC_PROG_CC_STDC
# ---------------
# _AC_PROG_CC_STDC
# ----------------
# If the C compiler in not in ANSI C mode by default, try to add an
# option to output variable @code{CC} to make it so. This macro tries
# various options that select ANSI C on some system or another. It
# considers the compiler to be in ANSI C mode if it handles function
# prototypes correctly.
AC_DEFUN([AC_PROG_CC_STDC],
[AC_REQUIRE([AC_PROG_CC])dnl
AC_BEFORE([$0], [AC_C_INLINE])dnl
AC_BEFORE([$0], [AC_C_CONST])dnl
dnl Force this before AC_PROG_CPP. Some cpp's, eg on HPUX, require
dnl a magic option to avoid problems with ANSI preprocessor commands
dnl like #elif.
dnl FIXME: can't do this because then AC_AIX won't work due to a
dnl circular dependency.
dnl AC_BEFORE([$0], [AC_PROG_CPP])
AC_MSG_CHECKING([for $CC option to accept ANSI C])
AC_DEFUN([_AC_PROG_CC_STDC],
[AC_MSG_CHECKING([for $CC option to accept ANSI C])
AC_CACHE_VAL(ac_cv_prog_cc_stdc,
[ac_cv_prog_cc_stdc=no
ac_save_CC=$CC
@ -784,8 +776,8 @@ char **argv;]],
for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
do
CC="$ac_save_CC $ac_arg"
AC_COMPILE_IFELSE([],
[ac_cv_prog_cc_stdc=$ac_arg
_AC_COMPILE_IFELSE([],
[ac_cv_prog_cc_stdc=$ac_arg
break])
done
rm -f conftest.$ac_ext conftest.$ac_objext
@ -798,7 +790,13 @@ case "x$ac_cv_prog_cc_stdc" in
AC_MSG_RESULT([$ac_cv_prog_cc_stdc])
CC="$CC $ac_cv_prog_cc_stdc" ;;
esac
])# AC_PROG_CC_STDC
])# _AC_PROG_CC_STDC
# AC_PROG_CC_STDC
# ---------------
# Has been merged into AC_PROG_CC.
AU_DEFUN([AC_PROG_CC_STDC], [])
# AC_C_CROSS
@ -927,8 +925,7 @@ esac
# inline function, only builtin types.
#
AC_DEFUN([AC_C_INLINE],
[AC_REQUIRE([AC_PROG_CC_STDC])dnl
AC_CACHE_CHECK([for inline], ac_cv_c_inline,
[AC_CACHE_CHECK([for inline], ac_cv_c_inline,
[ac_cv_c_inline=no
for ac_kw in inline __inline__ __inline; do
AC_COMPILE_IFELSE([AC_LANG_SOURCE(
@ -954,8 +951,7 @@ esac
# AC_C_CONST
# ----------
AC_DEFUN([AC_C_CONST],
[AC_REQUIRE([AC_PROG_CC_STDC])dnl
AC_CACHE_CHECK([for an ANSI C-conforming const], ac_cv_c_const,
[AC_CACHE_CHECK([for an ANSI C-conforming const], ac_cv_c_const,
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
[[/* FIXME: Include the comments suggested by Paul. */
#ifndef __cplusplus
@ -1022,8 +1018,7 @@ fi
# volatile away unless it is really necessary to allow the user's code
# to compile cleanly. Benign compiler failures should be tolerated.
AC_DEFUN([AC_C_VOLATILE],
[AC_REQUIRE([AC_PROG_CC_STDC])dnl
AC_CACHE_CHECK([for working volatile], ac_cv_c_volatile,
[AC_CACHE_CHECK([for working volatile], ac_cv_c_volatile,
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [
volatile int x;
int * volatile y;])],
@ -1063,7 +1058,7 @@ fi
# Check if the C compiler supports prototypes, included if it needs
# options.
AC_DEFUN([AC_C_PROTOTYPES],
[AC_REQUIRE([AC_PROG_CC_STDC])dnl
[AC_REQUIRE([AC_PROG_CC])dnl
AC_MSG_CHECKING([for function prototypes])
if test "$ac_cv_prog_cc_stdc" != no; then
AC_MSG_RESULT([yes])

View File

@ -13,6 +13,5 @@ AT_CHECK_MACRO([AC_PROG_CC_C_O])
AT_CHECK_MACRO([AC_PROG_GCC_TRADITIONAL])
# Obsolete macros.
AT_CHECK_AU_MACRO([AC_C_CROSS])
AT_CHECK_AU_MACRO([AC_LANG_C])
AT_CHECK_AU_MACRO([AC_LANG_CPLUSPLUS])

View File

@ -152,11 +152,14 @@ ac_exclude_egrep=`echo "$exclude_list$ac_exclude_list" | tr '
# need arguments and are tested elsewhere.
# AC_INIT and AC_OUTPUT
# are already in `configure.ac'.
# AC_C_CROSS and AC_PROG_CC_STDC
# are empty.
# AC_CYGWIN, AC_MINGW32, AC_EMXOS2
# are using AC_REQUIRE.
au_exclude_list='^AC_LANG_RESTORE$
^AC_LINK_FILES|AC_PREREQ$
^AC_(INIT|OUTPUT)$
^AC_C_CROSS|AC_PROG_CC_STDC$
^AC_(CYGWIN|MINGW32|EMXOS2)$'