]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: fix kFreeBSD build.
authorDavid Carlier <devnexen@gmail.com>
Fri, 4 Mar 2022 15:50:48 +0000 (15:50 +0000)
committerWilly Tarreau <w@1wt.eu>
Fri, 4 Mar 2022 16:19:12 +0000 (17:19 +0100)
kFreeBSD needs to be treated as a distinct target from FreeBSD
since the underlying system libc is the GNU one. Thus, relying
only on __GLIBC__ no longer suffice.

- freebsd-glibc new target, key difference is including crypt.h
  and linking to libdl like linux.
- cpu affinity available but the api is still the FreeBSD's.
- enabling auxiliary data access only for Linux.

Patch based on preliminary work done by @bigon.

closes #1555

Makefile
include/haproxy/cpuset-t.h
src/tools.c

index 964b7fbb56b135e2f0b09a1390f22ea399e2ee6f..46da6fbbb4344cb67074b4e54fb4460a0f553c06 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -177,8 +177,8 @@ DOCDIR = $(PREFIX)/doc/haproxy
 #### TARGET system
 # Use TARGET=<target_name> to optimize for a specific target OS among the
 # following list (use the default "generic" if uncertain) :
-#    linux-glibc, linux-glibc-legacy, linux-musl, solaris, freebsd, dragonfly,
-#    openbsd, netbsd, cygwin, haiku, aix51, aix52, aix72-gcc, osx, generic,
+#    linux-glibc, linux-glibc-legacy, linux-musl, solaris, freebsd, freebsd-glibc,
+#    dragonfly, openbsd, netbsd, cygwin, haiku, aix51, aix52, aix72-gcc, osx, generic,
 #    custom
 TARGET =
 
@@ -412,6 +412,13 @@ ifeq ($(TARGET),freebsd)
     USE_ACCEPT4 USE_CLOSEFROM USE_GETADDRINFO USE_PROCCTL)
 endif
 
+# kFreeBSD glibc
+ifeq ($(TARGET),freebsd-glibc)
+  set_target_defaults = $(call default_opts, \
+    USE_POLL USE_TPROXY USE_LIBCRYPT USE_THREAD USE_CPU_AFFINITY USE_KQUEUE   \
+    USE_ACCEPT4 USE_GETADDRINFO USE_CRYPT_H USE_DL)
+endif
+
 # DragonFlyBSD 4.3 and above
 ifeq ($(TARGET),dragonfly)
   set_target_defaults = $(call default_opts, \
index 5f812aa17aa3c135a398e774122038119a0fbaa7..984df8d839cd0b779b976742139245f17cfc7ec0 100644 (file)
@@ -16,7 +16,7 @@
 
 #include <haproxy/api-t.h>
 
-#if defined(__linux__) || defined(__DragonFly__)
+#if defined(__linux__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__)
 
 # define CPUSET_REPR cpu_set_t
 # define CPUSET_USE_CPUSET
index c48a9698ca802e27c03eea687680eb309dd62231..f62032b9c19de97dbeccee56296197f58b3f7c97 100644 (file)
@@ -43,7 +43,7 @@ extern void *__elf_aux_vector;
 #include <netinet/in.h>
 #include <arpa/inet.h>
 
-#if defined(__GLIBC__) && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 16))
+#if defined(__linux__) && defined(__GLIBC__) && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 16))
 #include <sys/auxv.h>
 #endif
 
@@ -4791,7 +4791,7 @@ const char *get_exec_path()
 {
        const char *ret = NULL;
 
-#if defined(__GLIBC__) && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 16))
+#if defined(__linux__) && defined(__GLIBC__) && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 16))
        long execfn = getauxval(AT_EXECFN);
 
        if (execfn && execfn != ENOENT)