SYNOPSIS

deconfig [-d] [-f] [-i] [-q] [directory]

DESCRIPTION

Generate a patch that removes unneeded autotools guard symbols qnd config.h inclusions from a C or C++ code tree under a specified directory. If no directory is specified, "." is assumed. The directory may be read-only, as nothing in it is modified by this tool.

Looks for a config.h file in or anywhere underneath the directory, failing if none is found. Uses that file to get a list of autotools guard symbols to check. If the symbol is recognized as portable, it is added to a kill list. "Portable" refers to features of C11 (ISO/IEC 9899:2011) or POSIX/SUSv2 (2008).

Once the kill list has been gathered, each source file in a temporary copy of the tree is processed with unifdef(1) to remove all guards on the kill list so their code sections are unconditionally compiled. Any config.h inclusions that become unnecessary because all the conditionals they control are gone are also removed. Then a diff is generated between the source and modified-copy trees and sent to standard output.

Some code sections for obsolete pre-POSIX interfaces are unconditionally removed by the diff.

The patch will also create a file named "config.mk" that is a makefile snippet containing definitions for residual symbols as a set of CFLAGS appends. The patch may also generate a "tests.mk" file containing specifications for tests to be performed by configure(1).

Before the diff section proper, you may see a list of residual symbols which do not correspond to POSIX features and for which deconfig does not know how to generate tests into tests.mk.

A residual is suppressed if the Makefile in the top-level directory cntains any of (1) a -D option defining the symbol, (2) a -U option explicitly making the symbol undefined, or (3) a CHECK line for the symbol as recognized by configure(1).

If there are no such residuals, the generated patch also deletes config.h.

In addition to removing guard symbols, this tool also replaces certain macros defined by autotools to set up fixed-length types on older systems into C99 standard types defined in <stdint.h>. In very old code you may need to insert an inclusion of this file.

The output of this command can be fed to patch(1). Any portability warnings will go to standard error. Note: the -p1 option of patch will be required.

These options modify deconfig’s behavior:

-d

Enable debugging messages and display of processing passes. This is probably of interest only to deconfig developers.

-f

Don’t scan a directory. Instead, read a config.h from standard input and do a portability analysis of the feature guards. Also ships CHECK directives that can be used by configure. Finishes the report with statistics.

-i

Invert, reporting on guards that can be removed and not emitting a diff.

-q

Suppress portability warnings.

This tool is intended to be used with makemake(1) to reduce a build recipe using autotools to bare Makefiles.

LIMITATIONS

To do its job, deconfig relies on a large table of features (include-file names, function names, and type names) known to be in C11 and POSIX/SuSv2 as of 2008. This table is not complete, and you may see it report guard symbols as portability problems that it should not. These instances should be reported to the maintainers as bugs.

REPORTING BUGS

Report bugs to Eric S. Raymond <esr@thyrsus.com>. The project page is at http://catb.org/~esr/autodafe

SEE ALSO

makemake(1), configure(1).