[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6. Writing Tests

If the existing feature tests don't do something you need, you have to write new ones. These macros are the building blocks. They provide ways for other macros to check whether various kinds of features are available and report the results.

This chapter contains some suggestions and some of the reasons why the existing tests are written the way they are. You can also learn a lot about how to write Autoconf tests by looking at the existing ones. If something goes wrong in one or more of the Autoconf tests, this information can help you understand the assumptions behind them, which might help you figure out how to best solve the problem.

These macros check the output of the compiler system of the current language (see section 6.1 Language Choice). They do not cache the results of their tests for future use (see section 7.3 Caching Results), because they don't know enough about the information they are checking for to generate a cache variable name. They also do not print any messages, for the same reason. The checks for particular kinds of features call these macros and do cache their results and print messages about what they're checking for.

When you write a feature test that could be applicable to more than one software package, the best thing to do is encapsulate it in a new macro. See section 9. Writing Autoconf Macros, for how to do that.

6.1 Language Choice  Selecting which language to use for testing
6.2 Writing Test Programs  Forging source files for compilers
6.3 Running the Preprocessor  Detecting preprocessor symbols
6.4 Running the Compiler  Detecting language or header features
6.5 Running the Linker  Detecting library features
6.6 Checking Run Time Behavior  Testing for run-time features
6.7 Systemology  A zoology of operating systems
6.8 Multiple Cases  Tests for several possible values


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated by Jeff Bailey on December, 24 2002 using texi2html