]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
libreplace: require TLS support if pthread support is available
authorRalph Boehme <slow@samba.org>
Tue, 15 Nov 2022 10:30:28 +0000 (11:30 +0100)
committerRalph Boehme <slow@samba.org>
Thu, 5 Jan 2023 11:33:37 +0000 (11:33 +0000)
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
lib/replace/replace.h
lib/replace/wscript

index de50761d00076c48e1b7dd1bc531fe8ab4a007dc..b15f3d14c8a36336af7166a88016b480896b987e 100644 (file)
@@ -1082,4 +1082,16 @@ static inline bool hex_byte(const char *in, uint8_t *out)
 #include <sys/atomic.h>
 #endif
 
+/*
+ * This handles the case of missing pthread support and ensures code can use
+ * __thread unconditionally, such that when built on a platform without pthread
+ * support, the __thread qualifier is an empty define.
+ */
+#ifndef HAVE___THREAD
+# ifdef HAVE_PTHREAD
+# error Configure failed to detect pthread library with missing TLS support
+# endif
+#define HAVE___THREAD
+#endif
+
 #endif /* _LIBREPLACE_REPLACE_H */
index 18059fab61718d461c8288d8ba1265933d14e6af..82c5a8a477b0a2b679dc2cf3b23d4ee6feee2240 100644 (file)
@@ -686,6 +686,9 @@ syscall(SYS_copy_file_range,0,NULL,0,NULL,0,0);
         addmain=False,
         msg='Checking for __thread local storage')
 
+    if conf.CONFIG_SET('HAVE_PTHREAD') and not conf.CONFIG_SET('HAVE___THREAD'):
+        conf.fatal('Missing required TLS support in pthread library')
+
     conf.CHECK_FUNCS_IN('crypt', 'crypt', checklibc=True)
     conf.CHECK_FUNCS_IN('crypt_r', 'crypt', checklibc=True)
     conf.CHECK_FUNCS_IN('crypt_rn', 'crypt', checklibc=True)