2 .\" Title: configurator
3 .\" Author: [see the "AUTHOR" section]
4 .\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
10 .TH "CONFIGURATOR" "1" "03/01/2018" "\ \&" "\ \&"
11 .\" -----------------------------------------------------------------
12 .\" * Define some portability stuff
13 .\" -----------------------------------------------------------------
14 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15 .\" http://bugs.debian.org/507673
16 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
17 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20 .\" -----------------------------------------------------------------
21 .\" * set default formatting
22 .\" -----------------------------------------------------------------
23 .\" disable hyphenation
25 .\" disable justification (adjust text to left margin only)
27 .\" -----------------------------------------------------------------
28 .\" * MAIN CONTENT STARTS HERE *
29 .\" -----------------------------------------------------------------
31 configurator \- Generate a simple config\&.h or variable file
34 \fBconfigurator\fR [\fIOPTIONS\fR] [\fICC\fR] [\fICFLAGS\fR\&...]
37 \fBconfigurator\fR is a standalone C program which evaluates the C environment using code snippets\&.
39 The C compiler (and flags) can be provided on the command\-line, otherwise built\-in defaults are used\&.
41 It has a builtin set of tests, to which more can be added\&. By default it produces a C header file to standard output, but it can also produce a file containing simple "key=value" lines suitable for parsing by \fBsh\fR or \fBmake\fR\&.
46 Print out every test result; specified twice, print out each test too\&.
56 \fB\-\-var\-file=<file>\fR
58 Output results in format
61 \fI<file>\fR, or stdout if
64 \fI\-\fR\&. Default is not to output this\&.
67 \fB\-\-header\-file=<file>\fR
69 Output C\-style header to
74 \fB\-\-autotools\-style\fR
76 Produce output to stdout like autotools\*(Aq configure script\&. This usually means you want to use
77 \fB\-\-header\-file\fR
78 so that doesn\(cqt mix with stdout\&.
83 Override option to set compiler output file\&.
86 \fB\-\-configurator\-cc=<command>\fR
88 This gives the real compiler command to use for tests, instead of the first commandline argument or the default\&.
91 \fB\-\-extra\-tests\fR
93 Read additional tests from stdin, see
99 The header output is \fI#ifndef/#define\fR idempotent\-wrapped using \fICCAN_CONFIG_H\fR, and defines \fI_GNU_SOURCE\fR\&. It also defines \fICCAN_COMPILER\fR, \fICCAN_CFLAGS\fR and \fICCAN_OUTPUT_EXE_CFLAG\fR as either the built\-in definitions or those provided on the command line\&. The remainder is \fI#define\fR of the test names followed by a \fI0\fR or \fI1\fR: note that this means you should use \fI#if\fR not \fI#ifdef\fR to test features in your C programs!
101 The var\-file output is simply the test names followed by \fI=1\fR or \fI=0\fR\&.
104 Extra tests must be formatted as \fI<key>=<value>\fR pairs, with leading whitespace and \fI#\fR lines ignored\&.
106 The first three lines are always the same:
110 Define the variable set by the test, e\&.g\&.
111 \fIvar=HAVE_FOO\fR\&.
114 \fBdesc=<description>\fR
116 The description printed out with
117 \fB\-\-autotools\-style\fR, e\&.g\&.
123 The set of strings defining how to treat the code snippet\&. It must include one of
128 \fIDEFINES_EVERYTHING\fR
129 which control the boilerplate to surround the file, and may include
134 \fIMAY_NOT_COMPILE\fR\&. e\&.g\&.
135 \fIINSIDE_MAIN|EXECUTE\fR\&.
138 The following styles are defined:
142 means we put a simple boilerplate main below it\&.
147 put a simple boilerplate main below it, which references
149 (to avoid any unused warnings)\&.
154 put this inside main()\&. This also means it must exit with status 0 if it compiles, unless
159 \fBDEFINES_EVERYTHING\fR
161 don\(cqt add any boilerplate at all\&.
166 this is an execution test; it must compile, but may not exit with status 0 when run\&.
169 \fBMAY_NOT_COMPILE\fR
171 Only useful with EXECUTE: don\(cqt get upset if it doesn\(cqt compile\&.
174 The following lines are optional, and may follow in any order:
176 \fBdepends=<varnames>\fR
178 A space\-separates set of vars which must pass to even try to pass this one\&. If the var begins with
180 then the dependency must fail to try this one\&. e\&.g\&.
181 \fIdepends=HAVE_UCONTEXT !HAVE_VALGRIND_MEMCHECK_H\fR\&.
184 \fBlink=<linkargs>\fR
186 Extra arguments for linking with this test, e\&.g\&.
192 Extra flags for compiling with this test, e\&.g\&.
193 \fIflags=\-fopenmp\fR\&.
196 \fBoverrides=<varname>\fR
198 Tests to force passing if this one passes\&. e\&.g\&.
199 \fIoverrides=HAVE_SOME_FOO\fR\&.
202 The final line is the code to test, itself, either as a single \fIcode=<oneline>\fR or as multiple lines starting with \fIcode=\fR and ending with \fI/*END*/\fR on a line by itself\&. e\&.g\&. \fIcode=return 0;\fR\&.
205 It will exit with non\-zero status if it has a problem\&. \fB1\fR means bad commandline options\&. \fB2\fR means some operational problem creating and running tests\&. \fB3\fR means a bad test\&. \fB4\fR means failure to parse an extra test\&.
208 Rusty Russell wrote \fBconfigurator\fR\&.
211 Main web site: http://ccodearchive\&.net/
213 Wiki: https://github\&.com/rustyrussell/ccan/wiki/
216 This program is under the MIT\-style BSD license; see code for details\&.