From d395b58ffa88cb9b98b0fcafe9c334f8e453089c Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 6 Jun 2018 13:04:27 +0930 Subject: [PATCH] ccan: update to have new configurator. Signed-off-by: Rusty Russell --- Makefile | 2 +- ccan/README | 2 +- ccan/tools/configurator/configurator.1 | 216 ++++++++++ ccan/tools/configurator/configurator.c | 520 +++++++++++++++++++------ 4 files changed, 623 insertions(+), 117 deletions(-) create mode 100644 ccan/tools/configurator/configurator.1 diff --git a/Makefile b/Makefile index 436e1b78f..9a8853efd 100644 --- a/Makefile +++ b/Makefile @@ -336,7 +336,7 @@ update-ccan: mv ccan ccan.old DIR=$$(pwd)/ccan; cd ../ccan && ./tools/create-ccan-tree -a $$DIR `cd $$DIR.old/ccan && find * -name _info | sed s,/_info,, | sort` $(CCAN_NEW) mkdir -p ccan/tools/configurator - cp ../ccan/tools/configurator/configurator.c ccan/tools/configurator/ + cp ../ccan/tools/configurator/configurator.c ../ccan/doc/configurator.1 ccan/tools/configurator/ $(MAKE) ccan/config.h grep -v '^CCAN version:' ccan.old/README > ccan/README echo CCAN version: `git -C ../ccan describe` >> ccan/README diff --git a/ccan/README b/ccan/README index 69db7ae64..effdcf745 100644 --- a/ccan/README +++ b/ccan/README @@ -1,3 +1,3 @@ CCAN imported from http://ccodearchive.net. -CCAN version: init-2423-g696c9b68 +CCAN version: init-2432-gd830ca0e diff --git a/ccan/tools/configurator/configurator.1 b/ccan/tools/configurator/configurator.1 new file mode 100644 index 000000000..aaa92c527 --- /dev/null +++ b/ccan/tools/configurator/configurator.1 @@ -0,0 +1,216 @@ +'\" t +.\" Title: configurator +.\" Author: [see the "AUTHOR" section] +.\" Generator: DocBook XSL Stylesheets v1.79.1 +.\" Date: 03/01/2018 +.\" Manual: \ \& +.\" Source: \ \& +.\" Language: English +.\" +.TH "CONFIGURATOR" "1" "03/01/2018" "\ \&" "\ \&" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +configurator \- Generate a simple config\&.h or variable file +.SH "SYNOPSIS" +.sp +\fBconfigurator\fR [\fIOPTIONS\fR] [\fICC\fR] [\fICFLAGS\fR\&...] +.SH "DESCRIPTION" +.sp +\fBconfigurator\fR is a standalone C program which evaluates the C environment using code snippets\&. +.sp +The C compiler (and flags) can be provided on the command\-line, otherwise built\-in defaults are used\&. +.sp +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\&. +.SH "OPTIONS" +.PP +\fB\-v\fR +.RS 4 +Print out every test result; specified twice, print out each test too\&. +.RE +.PP +\fB\-vv\fR +.RS 4 +Shortcut for two +\fB\-v\fR +options\&. +.RE +.PP +\fB\-\-var\-file=\fR +.RS 4 +Output results in format +\fI=\fR +to +\fI\fR, or stdout if +\fI\fR +is +\fI\-\fR\&. Default is not to output this\&. +.RE +.PP +\fB\-\-header\-file=\fR +.RS 4 +Output C\-style header to +\fI\fR +instead out stdout\&. +.RE +.PP +\fB\-\-autotools\-style\fR +.RS 4 +Produce output to stdout like autotools\*(Aq configure script\&. This usually means you want to use +\fB\-\-header\-file\fR +so that doesn\(cqt mix with stdout\&. +.RE +.PP +\fB\-O\fR +.RS 4 +Override option to set compiler output file\&. +.RE +.PP +\fB\-\-configurator\-cc=\fR +.RS 4 +This gives the real compiler command to use for tests, instead of the first commandline argument or the default\&. +.RE +.PP +\fB\-\-extra\-tests\fR +.RS 4 +Read additional tests from stdin, see +\fIEXTRA TESTS\fR +below\&. +.RE +.SH "OUTPUT" +.sp +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! +.sp +The var\-file output is simply the test names followed by \fI=1\fR or \fI=0\fR\&. +.SH "EXTRA TESTS" +.sp +Extra tests must be formatted as \fI=\fR pairs, with leading whitespace and \fI#\fR lines ignored\&. +.sp +The first three lines are always the same: +.PP +\fBvar=\fR +.RS 4 +Define the variable set by the test, e\&.g\&. +\fIvar=HAVE_FOO\fR\&. +.RE +.PP +\fBdesc=\fR +.RS 4 +The description printed out with +\fB\-\-autotools\-style\fR, e\&.g\&. +\fIfoo support\fR\&. +.RE +.PP +\fBstyle=