Next: C Compiler, Previous: Specific Compiler Characteristics, Up: Compilers and Preprocessors
Define
SIZEOF_
type-or-expr (see Standard Symbols) to be the size in bytes of type-or-expr, which may be either a type or an expression returning a value that has a size. If the expression `sizeof (type-or-expr)' is invalid, the result is 0. includes is a series of include directives, defaulting toAC_INCLUDES_DEFAULT
(see Default Includes), which are used prior to the expression under test.This macro now works even when cross-compiling. The unused argument was used when cross-compiling.
For example, the call
AC_CHECK_SIZEOF([int *])defines
SIZEOF_INT_P
to be 8 on DEC Alpha AXP systems.
Define
ALIGNOF_
type (see Standard Symbols) to be the alignment in bytes of type. `type y;' must be valid as a structure member declaration. If `type' is unknown, the result is 0. If no includes are specified, the default includes are used (see Default Includes).
Store into the shell variable var the value of the integer expression. The value should fit in an initializer in a C variable of type
signed long
. To support cross compilation (in which case, the macro only works on hosts that use twos-complement arithmetic), it should be possible to evaluate the expression at compile-time. If no includes are specified, the default includes are used (see Default Includes).Execute action-if-fails if the value cannot be determined correctly.
Normally Autoconf ignores warnings generated by the compiler, linker, and preprocessor. If this macro is used, warnings count as fatal errors for the current language. This macro is useful when the results of configuration are used where warnings are unacceptable; for instance, if parts of a program are built with the GCC -Werror option. If the whole program is built using -Werror it is often simpler to put -Werror in the compiler flags (
CFLAGS
, etc.).
OpenMP (http://www.openmp.org/) specifies extensions of C, C++, and Fortran that simplify optimization of shared memory parallelism, which is a common problem on multicore CPUs.
If the current language is C, the macro
AC_OPENMP
sets the variableOPENMP_CFLAGS
to the C compiler flags needed for supporting OpenMP.OPENMP_CFLAGS
is set to empty if the compiler already supports OpenMP, if it has no way to activate OpenMP support, or if the user rejects OpenMP support by invoking `configure' with the `--disable-openmp' option.
OPENMP_CFLAGS
needs to be used when compiling programs, when preprocessing program source, and when linking programs. Therefore you need to add$(OPENMP_CFLAGS)
to theCFLAGS
of C programs that use OpenMP. If you preprocess OpenMP-specific C code, you also need to add$(OPENMP_CFLAGS)
toCPPFLAGS
. The presence of OpenMP support is revealed at compile time by the preprocessor macro_OPENMP
.Linking a program with
OPENMP_CFLAGS
typically adds one more shared library to the program's dependencies, so its use is recommended only on programs that actually require OpenMP.If the current language is C++,
AC_OPENMP
sets the variableOPENMP_CXXFLAGS
, suitably for the C++ compiler. The same remarks hold as for C.If the current language is Fortran 77 or Fortran,
AC_OPENMP
sets the variableOPENMP_FFLAGS
orOPENMP_FCFLAGS
, respectively. Similar remarks as for C hold, except thatCPPFLAGS
is not used for Fortran, and no preprocessor macro signals OpenMP support.