autoconf: Language Choice

1 
1 6.1 Language Choice
1 ===================
1 
1 Autoconf-generated `configure' scripts check for the C compiler and its
1 features by default.  Packages that use other programming languages
1 (maybe more than one, e.g., C and C++) need to test features of the
1 compilers for the respective languages.  The following macros determine
1 which programming language is used in the subsequent tests in
1 `configure.ac'.
1 
1  -- Macro: AC_LANG (LANGUAGE)
1      Do compilation tests using the compiler, preprocessor, and file
1      extensions for the specified LANGUAGE.
1 
1      Supported languages are:
1 
1     `C'
1           Do compilation tests using `CC' and `CPP' and use extension
1           `.c' for test programs.  Use compilation flags: `CPPFLAGS'
1           with `CPP', and both `CPPFLAGS' and `CFLAGS' with `CC'.
1 
1     `C++'
1           Do compilation tests using `CXX' and `CXXCPP' and use
1           extension `.C' for test programs.  Use compilation flags:
1           `CPPFLAGS' with `CXXCPP', and both `CPPFLAGS' and `CXXFLAGS'
1           with `CXX'.
1 
1     `Fortran 77'
1           Do compilation tests using `F77' and use extension `.f' for
1           test programs.  Use compilation flags: `FFLAGS'.
1 
1     `Fortran'
1           Do compilation tests using `FC' and use extension `.f' (or
1           whatever has been set by `AC_FC_SRCEXT') for test programs.
1           Use compilation flags: `FCFLAGS'.
1 
1     `Erlang'
1           Compile and execute tests using `ERLC' and `ERL' and use
1           extension `.erl' for test Erlang modules.  Use compilation
1           flags: `ERLCFLAGS'.
1 
1     `Objective C'
1           Do compilation tests using `OBJC' and `OBJCPP' and use
1           extension `.m' for test programs.  Use compilation flags:
1           `CPPFLAGS' with `OBJCPP', and both `CPPFLAGS' and `OBJCFLAGS'
1           with `OBJC'.
1 
1     `Objective C++'
1           Do compilation tests using `OBJCXX' and `OBJCXXCPP' and use
1           extension `.mm' for test programs.  Use compilation flags:
1           `CPPFLAGS' with `OBJCXXCPP', and both `CPPFLAGS' and
1           `OBJCXXFLAGS' with `OBJCXX'.
1 
1     `Go'
1           Do compilation tests using `GOC' and use extension `.go' for
1           test programs.  Use compilation flags `GOFLAGS'.
1 
1  -- Macro: AC_LANG_PUSH (LANGUAGE)
1      Remember the current language (as set by `AC_LANG') on a stack, and
1      then select the LANGUAGE.  Use this macro and `AC_LANG_POP' in
1      macros that need to temporarily switch to a particular language.
1 
1  -- Macro: AC_LANG_POP ([LANGUAGE])
1      Select the language that is saved on the top of the stack, as set
1      by `AC_LANG_PUSH', and remove it from the stack.
1 
1      If given, LANGUAGE specifies the language we just _quit_.  It is a
1      good idea to specify it when it's known (which should be the
1      case...), since Autoconf detects inconsistencies.
1 
1           AC_LANG_PUSH([Fortran 77])
1           # Perform some tests on Fortran 77.
1           # ...
1           AC_LANG_POP([Fortran 77])
1 
1  -- Macro: AC_LANG_ASSERT (LANGUAGE)
1      Check statically that the current language is LANGUAGE.  You
1      should use this in your language specific macros to avoid that
1      they be called with an inappropriate language.
1 
1      This macro runs only at `autoconf' time, and incurs no cost at
1      `configure' time.  Sadly enough and because Autoconf is a two
1      layer language (1), the macros `AC_LANG_PUSH' and `AC_LANG_POP'
1      cannot be "optimizing", therefore as much as possible you ought to
1      avoid using them to wrap your code, rather, require from the user
1      to run the macro with a correct current language, and check it
1      with `AC_LANG_ASSERT'.  And anyway, that may help the user
1      understand she is running a Fortran macro while expecting a result
1      about her Fortran 77 compiler...
1 
1  -- Macro: AC_REQUIRE_CPP
1      Ensure that whichever preprocessor would currently be used for
1      Macros::) with an argument of either `AC_PROG_CPP' or
1      `AC_PROG_CXXCPP', depending on which language is current.
1 
1    ---------- Footnotes ----------
1 
1    (1) Because M4 is not aware of Sh code, especially conditionals,
1 some optimizations that look nice statically may produce incorrect
1 results at runtime.
1