commit: 1acbd4da02eb82a035c00a2f484364453469ff06
parent fe0aae18e5024fc8027846fcec45fb5f1b7a11c9
Author: Michael Forney <mforney@mforney.org>
Date: Thu, 27 Jun 2019 15:16:39 -0700
Detect TLS support in compiler
Diffstat:
6 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/pkg/e2fsprogs/config.h b/pkg/e2fsprogs/config.h
@@ -227,7 +227,9 @@
#endif
/* #undef STACK_DIRECTION */
#define STDC_HEADERS 1
-#define TLS __thread
+#ifdef HAVE__THREAD_LOCAL
+# define TLS _Thread_local
+#endif
#define USE_POSIX_THREADS 1
/* #undef USE_POSIX_THREADS_WEAK */
/* #undef USE_PTH_THREADS */
diff --git a/pkg/e2fsprogs/gen.lua b/pkg/e2fsprogs/gen.lua
@@ -10,9 +10,10 @@ cflags{
}
build('cat', '$outdir/config.h', {
- '$dir/config.h',
+ '$builddir/probe/HAVE__THREAD_LOCAL',
'$builddir/probe/SIZEOF_LONG',
'$builddir/probe/SIZEOF_TIME_T',
+ '$dir/config.h',
})
set('subst', {
diff --git a/pkg/util-linux/config.h b/pkg/util-linux/config.h
@@ -200,7 +200,9 @@
#define HAVE_TERM_H 1
#define HAVE_TIMEGM 1
#define HAVE_TIMER_CREATE 1
-#define HAVE_TLS 1
+#ifdef HAVE__THREAD_LOCAL
+# define HAVE_TLS 1
+#endif
#define HAVE_TM_GMTOFF 1
#define HAVE_TM_ZONE 1
/* #undef HAVE_TZNAME */
diff --git a/pkg/util-linux/gen.lua b/pkg/util-linux/gen.lua
@@ -1,12 +1,16 @@
set('version', '2.34.0')
cflags{
'-include $dir/config.h',
- '-I $dir',
'-I $outdir',
'-I $srcdir/include',
'-I $srcdir/libuuid/src',
}
+build('cat', '$outdir/config.h', {
+ '$builddir/probe/HAVE__THREAD_LOCAL',
+ '$dir/config.h',
+})
+
build('sed', '$outdir/libsmartcols.h', '$srcdir/libsmartcols/src/libsmartcols.h.in', {
expr='s,@LIBSMARTCOLS_VERSION@,$version,',
})
@@ -21,6 +25,7 @@ build('sed', '$outdir/libfdisk.h', '$srcdir/libfdisk/src/libfdisk.h.in', {
pkg.hdrs = copy('$outdir/include/uuid', '$srcdir/libuuid/src', {'uuid.h'})
pkg.deps = {
+ '$outdir/config.h',
'$outdir/libsmartcols.h',
'$outdir/libfdisk.h',
}
diff --git a/probe/HAVE__THREAD_LOCAL b/probe/HAVE__THREAD_LOCAL
@@ -0,0 +1,4 @@
+_Thread_local int x;
+int main(void) {
+ return x;
+}
diff --git a/probe/gen.lua b/probe/gen.lua
@@ -4,6 +4,7 @@ end
probe('HAVE_IMMINTRIN_H')
probe('HAVE__MM_MOVEMASK_EPI8')
+probe('HAVE__THREAD_LOCAL')
local function probesize(var)
build('probesize', '$outdir/'..var, {'$dir/'..var, '|', 'scripts/probe-size.sh'}, {var=var})