[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.
This commit is contained in:
Willy Tarreau 2007-12-02 11:28:59 +01:00
parent b698f0f4a2
commit 7b066db3bf
4 changed files with 39 additions and 1 deletions

View File

@ -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 $@ $<

View 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 $@ $>

View 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 $@ $<

View 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)