DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH
 

(autoconf.info.gz) Test Programs

Info Catalog (autoconf.info.gz) Run Time (autoconf.info.gz) Guidelines
 
 Running Test Programs
 ---------------------
 
    Use the following macro if you need to test run-time behavior of the
 system while configuring.
 
  - Macro: AC_TRY_RUN (PROGRAM, [ACTION-IF-TRUE], [ACTION-IF-FALSE],
           [ACTION-IF-CROSS-COMPILING])
      If PROGRAM compiles and links successfully and returns an exit
      status of 0 when executed, run shell commands ACTION-IF-TRUE.
      Otherwise, run shell commands ACTION-IF-FALSE.
 
      This macro double quotes PROGRAM, the text of a program in the
      current language ( Language Choice), on which shell
      variable and back quote substitutions are performed.  This macro
      uses `CFLAGS' or `CXXFLAGS', `CPPFLAGS', `LDFLAGS', and `LIBS'
      when compiling.
 
      If the C compiler being used does not produce executables that run
      on the system where `configure' is being run, then the test
      program is not run.  If the optional shell commands
      ACTION-IF-CROSS-COMPILING are given, they are run instead.
      Otherwise, `configure' prints an error message and exits.
 
      In the ACTION-IF-FALSE section, the exit status of the program is
      available in the shell variable `$?', but be very careful to limit
      yourself to positive values smaller than 127; bigger values should
      be saved into a file by the PROGRAM.  Note also that you have
      simply no guarantee that this exit status is issued by the
      PROGRAM, or by the failure of its compilation.  In other words,
      use this feature if sadist only, it was reestablished because the
      Autoconf maintainers grew tired of receiving "bug reports".
 
    Try to provide a pessimistic default value to use when
 cross-compiling makes run-time tests impossible.  You do this by
 passing the optional last argument to `AC_TRY_RUN'.  `autoconf' prints
 a warning message when creating `configure' each time it encounters a
 call to `AC_TRY_RUN' with no ACTION-IF-CROSS-COMPILING argument given.
 You may ignore the warning, though users will not be able to configure
 your package for cross-compiling.  A few of the macros distributed with
 Autoconf produce this warning message.
 
    To configure for cross-compiling you can also choose a value for
 those parameters based on the canonical system name ( Manual
 Configuration).  Alternatively, set up a test results cache file with
 the correct values for the host system ( Caching Results).
 
    To provide a default for calls of `AC_TRY_RUN' that are embedded in
 other macros, including a few of the ones that come with Autoconf, you
 can call `AC_PROG_CC' before running them.  Then, if the shell variable
 `cross_compiling' is set to `yes', use an alternate method to get the
 results instead of calling the macros.
 
Info Catalog (autoconf.info.gz) Run Time (autoconf.info.gz) Guidelines
automatically generated byinfo2html