]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: show Built with PCRE version
authorLukas Tribus <luky-37@hotmail.com>
Mon, 12 Sep 2016 21:42:07 +0000 (21:42 +0000)
committerWilly Tarreau <w@1wt.eu>
Tue, 13 Sep 2016 05:55:51 +0000 (07:55 +0200)
Inspired by PCRE's pcre_version.c and improved with Willy's
suggestions. Reusable parts have been added to
include/common/standard.h.

include/common/standard.h
src/haproxy.c

index d4f2448ef1ebca982c26f4fa1f26a28e16cbab64..33a3054b5b0c40fc366e798a902b988a6e9bff08 100644 (file)
@@ -1140,4 +1140,13 @@ static inline void *my_realloc2(void *ptr, size_t size)
        return ret;
 }
 
+/* HAP_STRING() makes a string from a literal while HAP_XSTRING() first
+ * evaluates the argument and is suited to pass macros.
+ *
+ * They allow macros like PCRE_MAJOR to be defined without quotes, which
+ * is convenient for applications that want to test its value.
+ */
+#define HAP_STRING(...) #__VA_ARGS__
+#define HAP_XSTRING(...) HAP_STRING(__VA_ARGS__)
+
 #endif /* _COMMON_STANDARD_H */
index 98a6a17ee663d1e8e18c9356dd32c9f09382a604..6d0681c646988a40e969984813aabcfbe4ac682d 100644 (file)
@@ -352,6 +352,9 @@ void display_build_opts()
 #endif
 
 #ifdef USE_PCRE
+       printf("Built with PCRE version : %s\n", (HAP_XSTRING(Z PCRE_PRERELEASE)[1] == 0)?
+               HAP_XSTRING(PCRE_MAJOR.PCRE_MINOR PCRE_DATE) :
+               HAP_XSTRING(PCRE_MAJOR.PCRE_MINOR) HAP_XSTRING(PCRE_PRERELEASE PCRE_DATE));
        printf("Running on PCRE version : %s", pcre_version());
        printf("\nPCRE library supports JIT : ");
 #ifdef USE_PCRE_JIT