diff options
| author | Michael Forney <mforney@mforney.org> | 2019-06-27 15:16:39 -0700 |
|---|---|---|
| committer | Michael Forney <mforney@mforney.org> | 2019-06-27 18:18:34 -0700 |
| commit | 1acbd4da02eb82a035c00a2f484364453469ff06 (patch) | |
| tree | baf1d665ad859818b63a523d105a5d8329446df1 | |
| parent | fe0aae18e5024fc8027846fcec45fb5f1b7a11c9 (diff) | |
Detect TLS support in compiler
| -rw-r--r-- | pkg/e2fsprogs/config.h | 4 | ||||
| -rw-r--r-- | pkg/e2fsprogs/gen.lua | 3 | ||||
| -rw-r--r-- | pkg/util-linux/config.h | 4 | ||||
| -rw-r--r-- | pkg/util-linux/gen.lua | 7 | ||||
| -rw-r--r-- | probe/HAVE__THREAD_LOCAL | 4 | ||||
| -rw-r--r-- | probe/gen.lua | 1 |
6 files changed, 19 insertions, 4 deletions
diff --git a/pkg/e2fsprogs/config.h b/pkg/e2fsprogs/config.h index 5f53c893..80cd9925 100644 --- 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 index 96fb876f..57a06301 100644 --- 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 index eb40fd42..9ef60753 100644 --- 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 index 7101697f..7cf5a177 100644 --- 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 new file mode 100644 index 00000000..fe1a4e57 --- /dev/null +++ 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 index 321f283c..56d470ec 100644 --- 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}) |
