Skip to content
Myr

Add --config option printing ./configure options used

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Nicolas Williams · committed by Nico Williams · parent 7d64381 · Browse files · 4 files+56 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

4 files+56 added−4 removed

  • other:+56 added−4 removed

4 files+56 added−4 removed

modified:docs/content/manual/manual.yml+19 added
299 unmodified lines
300 * `--version` / `-V`:301302 Output the jq version and exit with zero.303304 * `--build-configuration`:305306 Output the build configuration of jq and exit with zero.307 This output has no supported format or structure and may change308 without notice in future releases.309310 * `--help` / `-h`:311312 Output the jq help and exit with zero.313
1659 unmodified lines
1973 input: '[ { "_a": { "__b": 2 } } ]'1974 output:1975 - '[{"a":{"b":2}}]'19761977 - title: "`$JQ_BUILD_CONFIGURATION`"1978 body: |19791980 This builtin binding shows the jq executable's build1981 configuration. Its value has no particular format, but1982 it can be expected to be at least the `./configure`1983 command-line arguments, and may be enriched in the1984 future to include the version strings for the build1985 tooling used.19861987 Note that this can be overriden in the command-line1988 with `--arg` and related options.19891990 - title: "`$ENV`, `env`"1991 body: |19921993 `$ENV` is an object representing the environment variables as
1709 unmodified lines
modified:src/main.c+15 added
31 unmodified lines
32#include "jq.h"33#include "jv_alloc.h"34#include "util.h"35#include "src/version.h"36#include "src/config_opts.inc"3738int jq_testsuite(jv lib_dirs, int verbose, int argc, char* argv[]);3940static const char* progname;
65 unmodified lines
106#ifdef WIN32107 " -b, --binary open input/output streams in binary mode;\n"108#endif109 " -V, --version show the version;\n"110 " --build-configuration show jq's build configuration;\n"111 " -h, --help show the help;\n"112 " -- terminates argument processing;\n\n"113 "Named arguments are also available as $ARGS.named[], while\n"114 "positional arguments are available as $ARGS.positional[].\n");
466 unmodified lines
581 printf("jq-%s\n", JQ_VERSION);582 ret = JQ_OK;583 goto out;584 }585 if (isoption(argv[i], 0, "build-configuration", &short_opts)) {586 printf("%s\n", JQ_CONFIG);587 ret = JQ_OK;588 goto out;589 }590 if (isoption(argv[i], 0, "run-tests", &short_opts)) {591 i++;592 // XXX Pass program_arguments, even a whole jq_state *, through;593 // could be useful for testing
89 unmodified lines
683 jq_set_attr(jq, jv_string("PROGRAM_ORIGIN"), jq_realpath(jv_string(dirname(program_origin))));684 ARGS = JV_OBJECT(jv_string("positional"), ARGS,685 jv_string("named"), jv_copy(program_arguments));686 program_arguments = jv_object_set(program_arguments, jv_string("ARGS"), jv_copy(ARGS));687 if (!jv_object_has(jv_copy(program_arguments), jv_string("JQ_BUILD_CONFIGURATION")))688 program_arguments = jv_object_set(program_arguments,689 jv_string("JQ_BUILD_CONFIGURATION"),690 jv_string(JQ_CONFIG)); /* named arguments */691 compiled = jq_compile_args(jq, skip_shebang(jv_string_value(data)), jv_copy(program_arguments));692 free(program_origin);693 jv_free(data);694 } else {695 jq_set_attr(jq, jv_string("PROGRAM_ORIGIN"), jq_realpath(jv_string("."))); // XXX is this good?696 ARGS = JV_OBJECT(jv_string("positional"), ARGS,697 jv_string("named"), jv_copy(program_arguments));698 program_arguments = jv_object_set(program_arguments, jv_string("ARGS"), jv_copy(ARGS));699 if (!jv_object_has(jv_copy(program_arguments), jv_string("JQ_BUILD_CONFIGURATION")))700 program_arguments = jv_object_set(program_arguments,701 jv_string("JQ_BUILD_CONFIGURATION"),702 jv_string(JQ_CONFIG)); /* named arguments */703 compiled = jq_compile_args(jq, program, jv_copy(program_arguments));704 }705 if (!compiled){706 ret = JQ_ERROR_COMPILE;
84 unmodified lines
modified:jq.1.prebuilt+12 added
233 unmodified lines
234.IP235Output the jq version and exit with zero\.236.237.TP238\fB\-\-build\-configuration\fR:239.240.IP241Output the build configuration of jq and exit with zero\. This output has no supported format or structure and may change without notice in future releases\.242.243.TP244\fB\-\-help\fR / \fB\-h\fR:245.246.IP247Output the jq help and exit with zero\.
1903 unmodified lines
2151.fi2152.2153.IP "" 02154.2155.SS "$JQ_BUILD_CONFIGURATION"2156This builtin binding shows the jq executable\'s build configuration\. Its value has no particular format, but it can be expected to be at least the \fB\./configure\fR command\-line arguments, and may be enriched in the future to include the version strings for the build tooling used\.2157.2158.P2159Note that this can be overriden in the command\-line with \fB\-\-arg\fR and related options\.2160.2161.SS "$ENV, env"2162\fB$ENV\fR is an object representing the environment variables as set when the jq program started\.2163.2164.P
1965 unmodified lines
modified:Makefile.am+10 added-4 removed
31 unmodified lines
32# While there is some autoconf macro support for lex/flex, it doesn't support33# header file creation so we'll use good old make34if MAINTAINER_MODE35BUILT_SOURCES = src/lexer.h src/lexer.c src/parser.h src/parser.c \36 src/builtin.inc src/version.h36 src/builtin.inc src/config_opts.inc src/version.h37src/lexer.c: src/lexer.l38 $(AM_V_LEX) flex -o src/lexer.c --header-file=src/lexer.h $<39src/lexer.h: src/lexer.c40else41BUILT_SOURCES = src/builtin.inc src/version.h41BUILT_SOURCES = src/builtin.inc src/config_opts.inc src/version.h42.y.c:43 $(AM_V_YACC) echo "NOT building parser.c!"44.l.c:45 $(AM_V_LEX) echo "NOT building lexer.c!"
62 unmodified lines
108 @ $(generate_ver); test "x`cat src/version.h 2>/dev/null`" = "x$$ver" || touch .remake-version-h109src/version.h: .remake-version-h110 mkdir -p src111 $(AM_V_GEN) $(generate_ver); echo "$$ver" > $@112src/main.c: src/version.h112src/config_opts.inc:113 mkdir -p src114 $(AM_V_GEN) if test -x ./config.status; then \115 ./config.status --config; \116 else echo "(unknown)"; \117 fi | sed -e 's/\\/\\\\/g' -e 's/"/\\"/g' -e 's/^/"/' -e 's/$$/"/' -e 's/^/#define JQ_CONFIG /' > $@118src/main.c: src/version.h src/config_opts.inc119120src/builtin.inc: $(srcdir)/src/builtin.jq121 mkdir -p src122 $(AM_V_GEN) sed -e 's/\\/\\\\/g' -e 's/"/\\"/g' -e 's/^/"/' -e 's/$$/\\n"/' $(srcdir)/src/builtin.jq > $@123src/builtin.o: src/builtin.inc124119CLEANFILES = src/version.h .remake-version-h src/builtin.inc125CLEANFILES = src/version.h .remake-version-h src/builtin.inc src/config_opts.inc126127bin_PROGRAMS = jq128jq_SOURCES = src/main.c src/version.h129jq_LDFLAGS = -static-libtool-libs
124 unmodified lines