Node:Language Choice, Previous:Multiple Cases, Up:Writing Tests



Language Choice

Autoconf-generated configure scripts check for the C compiler and its features by default. Packages that use other programming languages (maybe more than one, e.g. C and C++) need to test features of the compilers for the respective languages. The following macros determine which programming language is used in the subsequent tests in configure.ac.

AC_LANG (language) Macro
Do compilation tests using the compiler, preprocessor and file extensions for the specified language.

Supported languages are:

C
Do compilation tests using CC and CPP and use extension .c for test programs.
C++
Do compilation tests using CXX and CXXCPP and use extension .C for test programs.
Fortran 77
Do compilation tests using F77 and use extension .f for test programs.

AC_LANG_PUSH (language) Macro
Remember the current language (as set by AC_LANG) on a stack, and then select the language. Use this macro and AC_LANG_POP in macros that need to temporarily switch to a particular language.

AC_LANG_POP ([language]) Macro
Select the language that is saved on the top of the stack, as set by AC_LANG_PUSH, and remove it from the stack.

If given, language specifies the language we just quit. It is a good idea to specify it when it's known (which should be the case...), since Autoconf will detect inconsistencies.

AC_LANG_PUSH(Fortran 77)
# Perform some tests on Fortran 77.
# ...
AC_LANG_POP(Fortran 77)

AC_REQUIRE_CPP Macro
Ensure that whichever preprocessor would currently be used for tests has been found. Calls AC_REQUIRE (see Prerequisite Macros) with an argument of either AC_PROG_CPP or AC_PROG_CXXCPP, depending on which language is current.