GNU Info

Info Node: (autoconf.info)Writing Tests

(autoconf.info)Writing Tests


Next: Results Prev: Existing Tests Up: Top
Enter node , (file) or (file)node

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 C compiler system.  They do not
cache the results of their tests for future use (Note: 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 C 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.  Note: Writing Macros, for how to do that.

Examining Declarations
Detecting header files and declarations.
Examining Syntax
Detecting language syntax features.
Examining Libraries
Detecting functions and global variables.
Run Time
Testing for run-time features.
Portable Shell
Shell script portability pitfalls.
Testing Values and Files
Checking strings and files.
Multiple Cases
Tests for several possible values.
Language Choice
Selecting which language to use for testing.

automatically generated by info2www version 1.2.2.9