Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,9 @@ CWARNFLAGS := -Werror -Wall -Wundef -Wmissing-prototypes -Wmissing-declarations
CDEBUGFLAGS := -std=gnu11 -g -fstack-protector
CFLAGS = $(CPPFLAGS) $(CWARNFLAGS) $(CDEBUGFLAGS) -I $(CCANDIR) $(EXTERNAL_INCLUDE_FLAGS) -I . -I/usr/local/include $(FEATURES) $(COVFLAGS) $(DEV_CFLAGS) -DSHACHAIN_BITS=48 -DJSMN_PARENT_LINKS $(PIE_CFLAGS)

# We can get configurator to run a different compile cmd to cross-configure.
CONFIGURATOR_CC := $(CC)

LDFLAGS = $(PIE_LDFLAGS)
LDLIBS = -L/usr/local/lib -lm -lgmp -lsqlite3 $(COVFLAGS)

Expand Down Expand Up @@ -263,8 +266,8 @@ ALL_PROGRAMS += ccan/ccan/cdump/tools/cdump-enumstr
# Can't add to ALL_OBJS, as that makes a circular dep.
ccan/ccan/cdump/tools/cdump-enumstr.o: $(CCAN_HEADERS) Makefile

ccan/config.h: ccan/tools/configurator/configurator
if $< $(CC) -static > $@.new; then mv $@.new $@; else rm $@.new; exit 1; fi
ccan/config.h: ccan/tools/configurator/configurator Makefile
if $< --configurator-cc="$(CONFIGURATOR_CC)" $(CC) $(CFLAGS) > $@.new; then mv $@.new $@; else rm $@.new; exit 1; fi

gen_version.h: FORCE
@(echo "#define VERSION \"`git describe --always --dirty`\"" && echo "#define VERSION_NAME \"$(NAME)\"" && echo "#define BUILD_FEATURES \"$(FEATURES)\"") > $@.new
Expand Down
2 changes: 1 addition & 1 deletion ccan/README
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
CCAN imported from http://ccodearchive.net.

CCAN version: init-2402-gec1f7161
CCAN version: init-2403-g8502a66a
14 changes: 12 additions & 2 deletions ccan/tools/configurator/configurator.c
Original file line number Diff line number Diff line change
Expand Up @@ -670,13 +670,15 @@ int main(int argc, const char *argv[])
const char *default_args[]
= { "", DEFAULT_COMPILER, DEFAULT_FLAGS, NULL };
const char *outflag = DEFAULT_OUTPUT_EXE_FLAG;
const char *configurator_cc = NULL;
const char *orig_cc;

if (argc > 0)
progname = argv[0];

while (argc > 1) {
if (strcmp(argv[1], "--help") == 0) {
printf("Usage: configurator [-v] [-O<outflag>] [<compiler> <flags>...]\n"
printf("Usage: configurator [-v] [-O<outflag>] [--configurator-cc=<compiler-for-tests>] [<compiler> <flags>...]\n"
" <compiler> <flags> will have \"<outflag> <outfile> <infile.c>\" appended\n"
"Default: %s %s %s\n",
DEFAULT_COMPILER, DEFAULT_FLAGS,
Expand All @@ -701,6 +703,10 @@ int main(int argc, const char *argv[])
argc--;
argv++;
verbose += 2;
} else if (strncmp(argv[1], "--configurator-cc=", 18) == 0) {
configurator_cc = argv[1] + 18;
argc--;
argv++;
} else {
break;
}
Expand All @@ -709,6 +715,10 @@ int main(int argc, const char *argv[])
if (argc == 1)
argv = default_args;

orig_cc = argv[1];
if (configurator_cc)
argv[1] = configurator_cc;

cmd = connect_args(argv, outflag, OUTPUT_FILE " " INPUT_FILE);
for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
run_test(cmd, &tests[i]);
Expand All @@ -723,7 +733,7 @@ int main(int argc, const char *argv[])
printf("#ifndef _GNU_SOURCE\n");
printf("#define _GNU_SOURCE /* Always use GNU extensions. */\n");
printf("#endif\n");
printf("#define CCAN_COMPILER \"%s\"\n", argv[1]);
printf("#define CCAN_COMPILER \"%s\"\n", orig_cc);
cmd = connect_args(argv + 1, "", "");
printf("#define CCAN_CFLAGS \"%s\"\n", cmd);
free(cmd);
Expand Down