BUILD: compat: always set _POSIX_VERSION to ease comparisons
authorWilly Tarreau <w@1wt.eu>
Tue, 5 Aug 2025 13:59:11 +0000 (15:59 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 1 Oct 2025 14:44:10 +0000 (16:44 +0200)
Sometimes we need to compare it to known versions, let's make sure it's
always defined. We set it to zero if undefined so that it cannot match
any comparison.

(cherry picked from commit e921fe894f6b992414e595be9450a9092f4df48e)
Signed-off-by: Amaury Denoyelle <adenoyelle@haproxy.com>
(cherry picked from commit a04c2d7ac5e4071da95230b128911d5b78bc996a)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 319077ed41e46975cbcb3f9e2d3b8af5623d42ce)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>

include/haproxy/compat.h

index 1bc25ab..87e565d 100644 (file)
@@ -119,6 +119,11 @@ typedef struct { } empty_t;
 })
 #endif
 
+/* always set a _POSIX_VERSION if there isn't any, in order to ease compares */
+#ifndef _POSIX_VERSION
+# define _POSIX_VERSION 0
+#endif
+
 /* this is for libc5 for example */
 #ifndef TCP_NODELAY
 #define TCP_NODELAY     1