]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[MINOR] store the build options to report with -vv
authorWilly Tarreau <w@1wt.eu>
Sun, 2 Dec 2007 10:28:59 +0000 (11:28 +0100)
committerWilly Tarreau <w@1wt.eu>
Sun, 2 Dec 2007 10:28:59 +0000 (11:28 +0100)
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.

Makefile
Makefile.bsd
Makefile.osx
src/haproxy.c

index aa523cd848cd373b0b0809185473b744c744bfee..25c460f22db03449acbfa2cbb9dc25dc2060039b 100644 (file)
--- 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 $@ $<
 
index d85ae00494cd3e37e757d805a97b124f310d8565..d05ad553b76e6b680490b0c8045a945f40e4e2a6 100644 (file)
@@ -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 $@ $>
 
index 586d4498732e63af4d4e9a7d9aaf7322ac02ee5b..f2469bc66911dfc58eba29e560cbc3a823d4e6ea 100644 (file)
@@ -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 $@ $<
 
index 791f64b42c3f9200672edeed0fd2f567839c2b49..887c162e85c8dd528496d2ad1f182003ec2a80a1 100644 (file)
@@ -171,6 +171,27 @@ void display_version()
        printf("Copyright 2000-2007 Willy Tarreau <w@1wt.eu>\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 <cfgfile> [ -vdV"
                "D ] [ -n <maxconn> ] [ -N <maxpconn> ]\n"
                "        [ -p <pidfile> ] [ -m <max megs> ]\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)