manpagez: man pages & more
info autoconf
Home | html | info | man

File: autoconf.info,  Node: Generic Compiler Characteristics,  Next: C Compiler,  Prev: Specific Compiler Characteristics,  Up: Compilers and Preprocessors

5.10.2 Generic Compiler Characteristics
---------------------------------------

 -- Macro: AC_CHECK_SIZEOF (TYPE-OR-EXPR, [UNUSED], [INCLUDES =
          AC_INCLUDES_DEFAULT])
     Define ‘SIZEOF_TYPE-OR-EXPR’ (*note 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 to ‘AC_INCLUDES_DEFAULT’
     (*note 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.

     This macro caches its result in the ‘ac_cv_sizeof_TYPE-OR-EXPR’
     variable, with ‘*’ mapped to ‘p’ and other characters not suitable
     for a variable name mapped to underscores.

 -- Macro: AC_CHECK_ALIGNOF (TYPE, [INCLUDES = AC_INCLUDES_DEFAULT])
     Define ‘ALIGNOF_TYPE’ (*note 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 (*note
     Default Includes::).

     This macro caches its result in the ‘ac_cv_alignof_TYPE-OR-EXPR’
     variable, with ‘*’ mapped to ‘p’ and other characters not suitable
     for a variable name mapped to underscores.

 -- Macro: AC_COMPUTE_INT (VAR, EXPRESSION, [INCLUDES =
          AC_INCLUDES_DEFAULT], [ACTION-IF-FAILS])
     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, it should be
     possible to evaluate the expression at compile-time.  If no
     INCLUDES are specified, the default includes are used (*note
     Default Includes::).

     Execute ACTION-IF-FAILS if the value cannot be determined
     correctly.

 -- Macro: AC_LANG_WERROR
     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.).

 -- Macro: AC_OPENMP
     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 multi-core CPUs.

     If the current language is C, the macro ‘AC_OPENMP’ sets the
     variable ‘OPENMP_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 the ‘CFLAGS’ of C programs
     that use OpenMP.  If you preprocess OpenMP-specific C code, you
     also need to add ‘$(OPENMP_CFLAGS)’ to ‘CPPFLAGS’.  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 variable
     ‘OPENMP_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 variable ‘OPENMP_FFLAGS’ or ‘OPENMP_FCFLAGS’, respectively.
     Similar remarks as for C hold, except that ‘CPPFLAGS’ is not used
     for Fortran, and no preprocessor macro signals OpenMP support.

     For portability, it is best to avoid spaces between ‘#’ and ‘pragma
     omp’.  That is, write ‘#pragma omp’, not ‘# pragma omp’.  The Sun
     WorkShop 6.2 C compiler chokes on the latter.

     This macro caches its result in the ‘ac_cv_prog_c_openmp’,
     ‘ac_cv_prog_cxx_openmp’, ‘ac_cv_prog_f77_openmp’, or
     ‘ac_cv_prog_fc_openmp’ variable, depending on the current language.

     *Caution:* Some of the compiler options that ‘AC_OPENMP’ tests,
     mean "enable OpenMP" to one compiler, but "write output to a file
     named ‘mp’ or ‘penmp’" to other compilers.  We cannot guarantee
     that the implementation of ‘AC_OPENMP’ will not overwrite an
     existing file with either of these names.

     Therefore, as a defensive measure, a ‘configure’ script that uses
     ‘AC_OPENMP’ will issue an error and stop (before doing any of the
     operations that might overwrite these files) upon encountering
     either of these files in its working directory.  ‘autoconf’ will
     also issue an error if it finds either of these files in the same
     directory as a ‘configure.ac’ that uses ‘AC_OPENMP’.

     If you have files with either of these names at the top level of
     your source tree, and you need to use ‘AC_OPENMP’, we recommend you
     either change their names or move them into a subdirectory.

© manpagez.com 2000-2024
Individual documents may contain additional copyright information.