Go to the first, previous, next, last section, table of contents.
CC
is not already set in the
environment, check for gcc
and cc
, then for other C
compilers. Set output variable CC
to the name of the compiler
found.
This macro may, however, be invoked with an optional first argument
which, if specified, must be a space separated list of C compilers to
search for. This just gives the user an opportunity to specify an
alternative search list for the C compiler. For example, if you didn't
like the default order, then you could invoke AC_PROG_CC
like
this:
AC_PROG_CC(cl egcs gcc cc)
If using the GNU C compiler, set shell variable GCC
to
`yes'. If output variable CFLAGS
was not already set, set
it to @option{-g -O2} for the GNU C compiler (@option{-O2} on systems
where GCC does not accept @option{-g}), or @option{-g} for other compilers.
NO_MINUS_C_MINUS_O
. This macro actually
tests both the compiler found by AC_PROG_CC
, and, if different,
the first cc
in the path. The test fails if one fails. This
macro was created for GNU Make to choose the default C compilation
rule.
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.
If you use this macro, you should check after calling it whether the C
compiler has been set to accept ANSI C; if not, the shell variable
ac_cv_prog_cc_stdc
is set to `no'. If you wrote your source
code in ANSI C, you can make an un-ANSIfied copy of it by
using the program ansi2knr
, which comes with Automake.
CPP
to a command that runs the
C preprocessor. If `$CC -E' doesn't work, `/lib/cpp' is used.
It is only portable to run CPP
on files with a `.c'
extension.
If the current language is C (see section Language Choice), many of the
specific test macros use the value of CPP
indirectly by calling
AC_TRY_CPP
, AC_CHECK_HEADER
, AC_EGREP_HEADER
, or
AC_EGREP_CPP
.
Some preprocessors don't indicate missing include files by the error status. For such preprocessors an internal variable is set that causes other macros to check the standard error from the preprocessor and consider the test failed if any warnings have been reported.
The following macros check for C compiler or machine architecture
features. To check for characteristics not listed here, use
AC_TRY_COMPILE
(see section Examining Syntax) or AC_TRY_RUN
(see section Checking Run Time Behavior)
WORDS_BIGENDIAN
.
const
, define const
to be empty. Some C compilers that do
not define __STDC__
do support const
; some compilers that
define __STDC__
do not completely support const
. Programs
can simply use const
as if every C compiler supported it; for
those that don't, the `Makefile' or configuration header file will
define it as empty.
Occasionally installers use a C++ compiler to compile C code, typically
because they lack a C compiler. This causes problems with const
,
because C and C++ treat const
differently. For example:
const int foo;
is valid in C but not in C++. These differences unfortunately cannot be
papered over by defining const
to be empty.
If autoconf
detects this situation, it leaves const
alone,
as this generally yields better results in practice. However, using a
C++ compiler to compile C code is not recommended or supported, and
installers who run into trouble in this area should get a C compiler
like GCC to compile their C code.
volatile
,
define volatile
to be empty. Programs can simply use
volatile
as if every C compiler supported it; for those that do
not, the `Makefile' or configuration header will define it as
empty.
If the correctness of your program depends on the semantics of
volatile
, simply defining it to be empty does, in a sense, break
your code. However, given that the compiler does not support
volatile
, you are at its mercy anyway. At least your
program will compile, when it wouldn't before.
In general, the volatile
keyword is a feature of ANSI C, so
you might expect that volatile
is available only when
__STDC__
is defined. However, Ultrix 4.3's native compiler does
support volatile, but does not defined __STDC__
.
inline
, do nothing.
Otherwise define inline
to __inline__
or __inline
if it accepts one of those, otherwise define inline
to be empty.
char
is unsigned, define __CHAR_UNSIGNED__
,
unless the C compiler predefines it.
long double
type, define
HAVE_LONG_DOUBLE
. Some C compilers that do not define
__STDC__
do support the long double
type; some compilers
that define __STDC__
do not support long double
.
HAVE_STRINGIZE
. The stringizing operator is `#' and is
found in macros such as this:
#define x(y) #y
ansi2knr
, which comes with the
Automake distribution, to unprotoize function definitions. For
function prototypes, you should first define PARAMS
:
#ifndef PARAMS # if PROTOTYPES # define PARAMS(protos) protos # else /* no PROTOTYPES */ # define PARAMS(protos) () # endif /* no PROTOTYPES */ #endif
then use it this way:
size_t my_strlen PARAMS ((const char *));
CC
if using the
GNU C compiler and ioctl
does not work properly without
@option{-traditional}. That usually happens when the fixed header files
have not been installed on an old system. Since recent versions of the
GNU C compiler fix the header files automatically when installed,
this is becoming a less prevalent problem.
Go to the first, previous, next, last section, table of contents.