summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2019-07-10 19:04:30 -0700
committerMichael Forney <mforney@mforney.org>2019-07-10 19:06:26 -0700
commite8de3964688787b9d6b14ce173a254b0fc2e38ad (patch)
tree041e6f07ad8ca50f4330865646df88650f15d7d2
parent95238ca682eadca3dd1b839b69e375d61e16af24 (diff)
pixman, nasm: Probe for __builtin_clz
-rw-r--r--pkg/nasm/config.h (renamed from pkg/nasm/config/config.h)2
-rw-r--r--pkg/nasm/gen.lua9
-rw-r--r--pkg/pixman/config.h4
-rw-r--r--pkg/pixman/gen.lua20
-rw-r--r--probe/HAVE___BUILTIN_CLZ4
-rw-r--r--probe/gen.lua1
6 files changed, 32 insertions, 8 deletions
diff --git a/pkg/nasm/config/config.h b/pkg/nasm/config.h
index 8757047f..aa5fcad4 100644
--- a/pkg/nasm/config/config.h
+++ b/pkg/nasm/config.h
@@ -129,7 +129,7 @@
#define HAVE___BUILTIN_BSWAP16 1
#define HAVE___BUILTIN_BSWAP32 1
#define HAVE___BUILTIN_BSWAP64 1
-#define HAVE___BUILTIN_CLZ 1
+/* probe HAVE___BUILTIN_CLZ */
#define HAVE___BUILTIN_CLZL 1
#define HAVE___BUILTIN_CLZLL 1
#define HAVE___BUILTIN_CONSTANT_P 1
diff --git a/pkg/nasm/gen.lua b/pkg/nasm/gen.lua
index 96994eb6..a03e340a 100644
--- a/pkg/nasm/gen.lua
+++ b/pkg/nasm/gen.lua
@@ -1,6 +1,6 @@
cflags{
'-D HAVE_CONFIG_H',
- '-I $dir',
+ '-I $outdir',
'-I $srcdir',
'-I $srcdir/include',
'-I $srcdir/x86',
@@ -9,6 +9,13 @@ cflags{
'-I $srcdir/output',
}
+build('cat', '$outdir/config/config.h', {
+ '$builddir/probe/HAVE___BUILTIN_CLZ',
+ '$dir/config.h',
+})
+
+pkg.deps = {'$outdir/config/config.h'}
+
lib('libnasm.a', [[
stdlib/(snprintf.c vsnprintf.c strlcpy.c strnlen.c strrchrnul.c)
nasmlib/(
diff --git a/pkg/pixman/config.h b/pkg/pixman/config.h
index 5725db3e..4135d6e1 100644
--- a/pkg/pixman/config.h
+++ b/pkg/pixman/config.h
@@ -1,6 +1,8 @@
/* #undef AC_APPLE_UNIVERSAL_BUILD */
#define HAVE_ALARM 1
-#define HAVE_BUILTIN_CLZ /**/
+#ifdef HAVE___BUILTIN_CLZ
+# define HAVE_BUILTIN_CLZ /**/
+#endif
#define HAVE_DLFCN_H 1
#define HAVE_FEDIVBYZERO 1
/* #undef HAVE_FEENABLEEXCEPT */
diff --git a/pkg/pixman/gen.lua b/pkg/pixman/gen.lua
index addc5bd7..99583ff2 100644
--- a/pkg/pixman/gen.lua
+++ b/pkg/pixman/gen.lua
@@ -1,9 +1,14 @@
cflags{
'-D HAVE_CONFIG_H',
- '-I $dir',
+ '-I $outdir',
'-I $outdir/include',
}
+build('cat', '$outdir/config.h', {
+ '$builddir/probe/HAVE___BUILTIN_CLZ',
+ '$dir/config.h',
+})
+
build('sed', '$outdir/include/pixman-version.h', '$srcdir/pixman/pixman-version.h.in', {
expr={
'-e s,@PIXMAN_VERSION_MAJOR@,0,',
@@ -11,16 +16,21 @@ build('sed', '$outdir/include/pixman-version.h', '$srcdir/pixman/pixman-version.
'-e s,@PIXMAN_VERSION_MICRO@,0,',
},
})
+
pkg.hdrs = {
copy('$outdir/include', '$srcdir/pixman', {'pixman.h'}),
'$outdir/include/pixman-version.h',
}
+pkg.deps = {
+ '$dir/headers',
+ '$outdir/config.h',
+}
-- processor-specific features
cflags{'-D USE_SSE2=1', '-D USE_SSSE3=1', '-D USE_X86_MMX=1'}
-cc('pixman/pixman-mmx.c', {'$dir/headers'}, {cflags='$cflags -mmmx -Winline'})
-cc('pixman/pixman-sse2.c', {'$dir/headers'}, {cflags='$cflags -msse2 -Winline'})
-cc('pixman/pixman-ssse3.c', {'$dir/headers'}, {cflags='$cflags -mssse3 -Winline'})
+cc('pixman/pixman-mmx.c', nil, {cflags='$cflags -mmmx -Winline'})
+cc('pixman/pixman-sse2.c', nil, {cflags='$cflags -msse2 -Winline'})
+cc('pixman/pixman-ssse3.c', nil, {cflags='$cflags -mssse3 -Winline'})
local cpuobjs = {'pixman-mmx.c.o', 'pixman-sse2.c.o', 'pixman-ssse3.c.o'}
lib('libpixman.a', expand{'pixman/', {
@@ -55,6 +65,6 @@ lib('libpixman.a', expand{'pixman/', {
'pixman-trap.c',
'pixman-utils.c',
cpuobjs,
-}}, {'$dir/headers'})
+}})
fetch 'git'
diff --git a/probe/HAVE___BUILTIN_CLZ b/probe/HAVE___BUILTIN_CLZ
new file mode 100644
index 00000000..30a3b972
--- /dev/null
+++ b/probe/HAVE___BUILTIN_CLZ
@@ -0,0 +1,4 @@
+unsigned x = -1;
+int main(void) {
+ return __builtin_clz(x);
+}
diff --git a/probe/gen.lua b/probe/gen.lua
index 56d470ec..489f6733 100644
--- a/probe/gen.lua
+++ b/probe/gen.lua
@@ -5,6 +5,7 @@ end
probe('HAVE_IMMINTRIN_H')
probe('HAVE__MM_MOVEMASK_EPI8')
probe('HAVE__THREAD_LOCAL')
+probe('HAVE___BUILTIN_CLZ')
local function probesize(var)
build('probesize', '$outdir/'..var, {'$dir/'..var, '|', 'scripts/probe-size.sh'}, {var=var})