From: Willy Tarreau Date: Sun, 2 Dec 2007 10:28:59 +0000 (+0100) Subject: [MINOR] store the build options to report with -vv X-Git-Tag: v1.3.14~17 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7b066db3bf8f24410794d641a7e35adae1e3e97d;p=thirdparty%2Fhaproxy.git [MINOR] store the build options to report with -vv Sometimes it is useful to find out how a given binary version was built. The build compiler and options are now provided for this, and it's possible to get them with the -vv option. --- diff --git a/Makefile b/Makefile index aa523cd848..25c460f22d 100644 --- a/Makefile +++ b/Makefile @@ -245,6 +245,11 @@ objsize: haproxy %.o: %.c $(CC) $(CFLAGS) -c -o $@ $< +src/haproxy.o: src/haproxy.c + $(CC) $(CFLAGS) -DBUILD_TARGET='"$(TARGET)"' -DBUILD_CC='"$(CC)"' \ + -DBUILD_CPU='"$(CPU)"' -DBUILD_REGEX='"$(REGEX)"' \ + -DBUILD_OPTS='"$(COPTS)"' -c -o $@ $< + src/dlmalloc.o: $(DLMALLOC_SRC) $(CC) $(CFLAGS) -DDEFAULT_MMAP_THRESHOLD=$(DLMALLOC_THRES) -c -o $@ $< diff --git a/Makefile.bsd b/Makefile.bsd index d85ae00494..d05ad553b7 100644 --- a/Makefile.bsd +++ b/Makefile.bsd @@ -119,6 +119,11 @@ haproxy: $(OBJS) $(OPT_OBJS) .c.o: $(CC) $(CFLAGS) -c -o $@ $> +src/haproxy.o: src/haproxy.c + $(CC) $(CFLAGS) -DBUILD_TARGET='"$(TARGET)"' -DBUILD_CC='"$(CC)"' \ + -DBUILD_CPU='"$(CPU)"' -DBUILD_REGEX='"$(REGEX)"' \ + -DBUILD_OPTS='"$(COPTS)"' -c -o $@ $> + src/dlmalloc.o: $(DLMALLOC_SRC) $(CC) $(CFLAGS) -DDEFAULT_MMAP_THRESHOLD=$(DLMALLOC_THRES) -c -o $@ $> diff --git a/Makefile.osx b/Makefile.osx index 586d449873..f2469bc669 100644 --- a/Makefile.osx +++ b/Makefile.osx @@ -116,6 +116,11 @@ haproxy: $(OBJS) .c.o: $(CC) $(CFLAGS) -c -o $@ $< +src/haproxy.o: src/haproxy.c + $(CC) $(CFLAGS) -DBUILD_TARGET='"$(TARGET)"' -DBUILD_CC='"$(CC)"' \ + -DBUILD_CPU='"$(CPU)"' -DBUILD_REGEX='"$(REGEX)"' \ + -DBUILD_OPTS='"$(COPTS)"' -c -o $@ $< + src/dlmalloc.o: $(DLMALLOC_SRC) $(CC) $(CFLAGS) -DDEFAULT_MMAP_THRESHOLD=$(DLMALLOC_THRES) -c -o $@ $< diff --git a/src/haproxy.c b/src/haproxy.c index 791f64b42c..887c162e85 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -171,6 +171,27 @@ void display_version() printf("Copyright 2000-2007 Willy Tarreau \n\n"); } +void display_build_opts() +{ + printf("Build options :" +#ifdef BUILD_TARGET + "\n TARGET = " BUILD_TARGET +#endif +#ifdef BUILD_CPU + "\n CPU = " BUILD_CPU +#endif +#ifdef BUILD_REGEX + "\n REGEX = " BUILD_REGEX +#endif +#ifdef BUILD_CC + "\n CC = " BUILD_CC +#endif +#ifdef BUILD_OPTS + "\n COPTS = " BUILD_OPTS +#endif + "\n\n"); +} + /* * This function prints the command line usage and exits */ @@ -181,7 +202,7 @@ void usage(char *name) "Usage : %s -f [ -vdV" "D ] [ -n ] [ -N ]\n" " [ -p ] [ -m ]\n" - " -v displays version\n" + " -v displays version ; -vv shows known build options.\n" " -d enters debug mode ; -db only disables background mode.\n" " -V enters verbose mode (disables quiet mode)\n" " -D goes daemon ; implies -q\n" @@ -432,6 +453,8 @@ void init(int argc, char **argv) /* 1 arg */ if (*flag == 'v') { display_version(); + if (flag[1] == 'v') /* -vv */ + display_build_opts(); exit(0); } #if defined(ENABLE_EPOLL)