commit: e8de3964688787b9d6b14ce173a254b0fc2e38ad
parent 95238ca682eadca3dd1b839b69e375d61e16af24
Author: Michael Forney <mforney@mforney.org>
Date: Wed, 10 Jul 2019 19:04:30 -0700
pixman, nasm: Probe for __builtin_clz
Diffstat:
7 files changed, 214 insertions(+), 190 deletions(-)
diff --git a/pkg/nasm/config.h b/pkg/nasm/config.h
@@ -0,0 +1,183 @@
+/* #undef ABORT_ON_PANIC */
+/* #undef AC_APPLE_UNIVERSAL_BUILD */
+/* #undef CFLAG_FDATA_SECTIONS */
+/* #undef CFLAG_FFUNCTION_SECTIONS */
+/* #undef CFLAG_FGNU89_INLINE */
+/* #undef CFLAG_FLTO */
+#define CFLAG_FNO_COMMON 1
+/* #undef CFLAG_FNO_OMIT_FRAME_POINTER */
+/* #undef CFLAG_FSANITIZE_ADDRESS */
+/* #undef CFLAG_FSANITIZE_UNDEFINED */
+#define CFLAG_FVISIBILITY_HIDDEN 1
+#define CFLAG_FWRAPV 1
+/* #undef CFLAG_GGDB3 */
+#define CFLAG_PEDANTIC 1
+#define CFLAG_U_STRICT_ANSI 1
+#define CFLAG_W 1
+#define CFLAG_WALL 1
+#define CFLAG_WC90_C99_COMPAT 1
+/* #undef CFLAG_WERROR */
+#define CFLAG_WERROR_ATTRIBUTES 1
+#define CFLAG_WERROR_COMMENT 1
+#define CFLAG_WERROR_IMPLICIT 1
+#define CFLAG_WERROR_MISSING_BRACES 1
+#define CFLAG_WERROR_MISSING_DECLARATIONS 1
+#define CFLAG_WERROR_MISSING_PROTOTYPES 1
+#define CFLAG_WERROR_POINTER_ARITH 1
+#define CFLAG_WERROR_RETURN_TYPE 1
+/* #undef CFLAG_WERROR_STRICT_PROTOTYPES */
+#define CFLAG_WERROR_TRIGRAPHS 1
+/* #undef CFLAG_WERROR_UNKNOWN_WARNING_OPTION */
+#define CFLAG_WERROR_VLA 1
+#define CFLAG_WLONG_LONG 1
+/* #undef CFLAG_WL_GC_SECTIONS */
+/* #undef CFLAG_WPEDANTIC_MS_FORMAT */
+#define CFLAG_WSHIFT_NEGATIVE_VALUE 1
+#define CFLAG_WSTRINGOP_TRUNCATION 1
+#define HAVE_ACCESS 1
+/* #undef HAVE_CANONICALIZE_FILE_NAME */
+/* #undef HAVE_CPU_TO_LE16 */
+/* #undef HAVE_CPU_TO_LE32 */
+/* #undef HAVE_CPU_TO_LE64 */
+#define HAVE_DECL_STRCASECMP 1
+#define HAVE_DECL_STRICMP 0
+#define HAVE_DECL_STRLCPY 1
+#define HAVE_DECL_STRNCASECMP 1
+#define HAVE_DECL_STRNICMP 0
+#define HAVE_DECL_STRNLEN 1
+#define HAVE_DECL_STRRCHRNUL 0
+#define HAVE_DECL_STRSEP 1
+#define HAVE_ENDIAN_H 1
+#define HAVE_FACCESSAT 1
+#define HAVE_FCNTL_H 1
+#define HAVE_FILENO 1
+#define HAVE_FSEEKO 1
+#define HAVE_FSTAT 1
+#define HAVE_FTRUNCATE 1
+#define HAVE_FUNC_ATTRIBUTE_ALLOC_SIZE 1
+#define HAVE_FUNC_ATTRIBUTE_COLD 1
+#define HAVE_FUNC_ATTRIBUTE_CONST 1
+#define HAVE_FUNC_ATTRIBUTE_ERROR 1
+#define HAVE_FUNC_ATTRIBUTE_FORMAT 1
+#define HAVE_FUNC_ATTRIBUTE_MALLOC 1
+#define HAVE_FUNC_ATTRIBUTE_NORETURN 1
+#define HAVE_FUNC_ATTRIBUTE_PURE 1
+#define HAVE_FUNC_ATTRIBUTE_RETURNS_NONNULL 1
+#define HAVE_FUNC_ATTRIBUTE_SENTINEL 1
+#define HAVE_GETGID 1
+#define HAVE_GETPAGESIZE 1
+#define HAVE_GETUID 1
+#define HAVE_HTOLE16 1
+#define HAVE_HTOLE32 1
+#define HAVE_HTOLE64 1
+/* #undef HAVE_INTRIN_H */
+#define HAVE_INTTYPES_H 1
+/* #undef HAVE_IO_H */
+/* #undef HAVE_MACHINE_ENDIAN_H */
+#define HAVE_MEMORY_H 1
+#define HAVE_MMAP 1
+#define HAVE_PATHCONF 1
+#define HAVE_REALPATH 1
+#define HAVE_SNPRINTF 1
+#define HAVE_STAT 1
+#define HAVE_STDBOOL_H 1
+#define HAVE_STDC_INLINE 1
+#define HAVE_STDINT_H 1
+#define HAVE_STDLIB_H 1
+#define HAVE_STDNORETURN_H 1
+#define HAVE_STRCASECMP 1
+/* #undef HAVE_STRICMP */
+#define HAVE_STRINGS_H 1
+#define HAVE_STRING_H 1
+#define HAVE_STRLCPY 1
+#define HAVE_STRNCASECMP 1
+/* #undef HAVE_STRNICMP */
+#define HAVE_STRNLEN 1
+/* #undef HAVE_STRRCHRNUL */
+#define HAVE_STRSEP 1
+#define HAVE_STRUCT_STAT 1
+/* #undef HAVE_STRUCT__STATI64 */
+#define HAVE_SYSCONF 1
+/* #undef HAVE_SYS_ENDIAN_H */
+#define HAVE_SYS_MMAN_H 1
+#define HAVE_SYS_PARAM_H 1
+#define HAVE_SYS_STAT_H 1
+#define HAVE_SYS_TYPES_H 1
+#define HAVE_UINTPTR_T 1
+#define HAVE_UNISTD_H 1
+#define HAVE_VSNPRINTF 1
+/* #undef HAVE__ACCESS */
+/* #undef HAVE__BITSCANREVERSE */
+/* #undef HAVE__BITSCANREVERSE64 */
+#define HAVE__BOOL 1
+/* #undef HAVE__BYTESWAP_UINT64 */
+/* #undef HAVE__BYTESWAP_ULONG */
+/* #undef HAVE__BYTESWAP_USHORT */
+/* #undef HAVE__CHSIZE */
+/* #undef HAVE__CHSIZE_S */
+/* #undef HAVE__FILELENGTHI64 */
+/* #undef HAVE__FILENO */
+/* #undef HAVE__FSEEKI64 */
+/* #undef HAVE__FSTATI64 */
+/* #undef HAVE__FULLPATH */
+/* #undef HAVE__SNPRINTF */
+/* #undef HAVE__STATI64 */
+/* #undef HAVE__VSNPRINTF */
+/* #undef HAVE___BSWAP_16 */
+/* #undef HAVE___BSWAP_32 */
+/* #undef HAVE___BSWAP_64 */
+#define HAVE___BUILTIN_BSWAP16 1
+#define HAVE___BUILTIN_BSWAP32 1
+#define HAVE___BUILTIN_BSWAP64 1
+/* probe HAVE___BUILTIN_CLZ */
+#define HAVE___BUILTIN_CLZL 1
+#define HAVE___BUILTIN_CLZLL 1
+#define HAVE___BUILTIN_CONSTANT_P 1
+#define HAVE___BUILTIN_EXPECT 1
+/* #undef HAVE___CPU_TO_LE16 */
+/* #undef HAVE___CPU_TO_LE32 */
+/* #undef HAVE___CPU_TO_LE64 */
+#define PACKAGE_BUGREPORT ""
+#define PACKAGE_NAME ""
+#define PACKAGE_STRING ""
+#define PACKAGE_TARNAME ""
+#define PACKAGE_URL ""
+#define PACKAGE_VERSION ""
+#define STDC_HEADERS 1
+#ifndef _ALL_SOURCE
+# define _ALL_SOURCE 1
+#endif
+#ifndef _GNU_SOURCE
+# define _GNU_SOURCE 1
+#endif
+#ifndef _POSIX_PTHREAD_SEMANTICS
+# define _POSIX_PTHREAD_SEMANTICS 1
+#endif
+#ifndef _TANDEM_SOURCE
+# define _TANDEM_SOURCE 1
+#endif
+#ifndef __EXTENSIONS__
+# define __EXTENSIONS__ 1
+#endif
+/* #undef WORDS_BIGENDIAN */
+#define WORDS_LITTLEENDIAN 1
+#ifndef _DARWIN_USE_64_BIT_INODE
+# define _DARWIN_USE_64_BIT_INODE 1
+#endif
+/* #undef _FILE_OFFSET_BITS */
+/* #undef _LARGEFILE_SOURCE */
+/* #undef _LARGE_FILES */
+/* #undef _MINIX */
+/* #undef _POSIX_1_SOURCE */
+/* #undef _POSIX_SOURCE */
+/* #undef const */
+#ifndef __cplusplus
+/* #undef inline */
+#endif
+#define restrict __restrict
+#if defined __SUNPRO_CC && !defined __RESTRICT
+# define _Restrict
+# define __restrict__
+#endif
+/* #undef size_t */
+/* #undef uintptr_t */
diff --git a/pkg/nasm/config/config.h b/pkg/nasm/config/config.h
@@ -1,183 +0,0 @@
-/* #undef ABORT_ON_PANIC */
-/* #undef AC_APPLE_UNIVERSAL_BUILD */
-/* #undef CFLAG_FDATA_SECTIONS */
-/* #undef CFLAG_FFUNCTION_SECTIONS */
-/* #undef CFLAG_FGNU89_INLINE */
-/* #undef CFLAG_FLTO */
-#define CFLAG_FNO_COMMON 1
-/* #undef CFLAG_FNO_OMIT_FRAME_POINTER */
-/* #undef CFLAG_FSANITIZE_ADDRESS */
-/* #undef CFLAG_FSANITIZE_UNDEFINED */
-#define CFLAG_FVISIBILITY_HIDDEN 1
-#define CFLAG_FWRAPV 1
-/* #undef CFLAG_GGDB3 */
-#define CFLAG_PEDANTIC 1
-#define CFLAG_U_STRICT_ANSI 1
-#define CFLAG_W 1
-#define CFLAG_WALL 1
-#define CFLAG_WC90_C99_COMPAT 1
-/* #undef CFLAG_WERROR */
-#define CFLAG_WERROR_ATTRIBUTES 1
-#define CFLAG_WERROR_COMMENT 1
-#define CFLAG_WERROR_IMPLICIT 1
-#define CFLAG_WERROR_MISSING_BRACES 1
-#define CFLAG_WERROR_MISSING_DECLARATIONS 1
-#define CFLAG_WERROR_MISSING_PROTOTYPES 1
-#define CFLAG_WERROR_POINTER_ARITH 1
-#define CFLAG_WERROR_RETURN_TYPE 1
-/* #undef CFLAG_WERROR_STRICT_PROTOTYPES */
-#define CFLAG_WERROR_TRIGRAPHS 1
-/* #undef CFLAG_WERROR_UNKNOWN_WARNING_OPTION */
-#define CFLAG_WERROR_VLA 1
-#define CFLAG_WLONG_LONG 1
-/* #undef CFLAG_WL_GC_SECTIONS */
-/* #undef CFLAG_WPEDANTIC_MS_FORMAT */
-#define CFLAG_WSHIFT_NEGATIVE_VALUE 1
-#define CFLAG_WSTRINGOP_TRUNCATION 1
-#define HAVE_ACCESS 1
-/* #undef HAVE_CANONICALIZE_FILE_NAME */
-/* #undef HAVE_CPU_TO_LE16 */
-/* #undef HAVE_CPU_TO_LE32 */
-/* #undef HAVE_CPU_TO_LE64 */
-#define HAVE_DECL_STRCASECMP 1
-#define HAVE_DECL_STRICMP 0
-#define HAVE_DECL_STRLCPY 1
-#define HAVE_DECL_STRNCASECMP 1
-#define HAVE_DECL_STRNICMP 0
-#define HAVE_DECL_STRNLEN 1
-#define HAVE_DECL_STRRCHRNUL 0
-#define HAVE_DECL_STRSEP 1
-#define HAVE_ENDIAN_H 1
-#define HAVE_FACCESSAT 1
-#define HAVE_FCNTL_H 1
-#define HAVE_FILENO 1
-#define HAVE_FSEEKO 1
-#define HAVE_FSTAT 1
-#define HAVE_FTRUNCATE 1
-#define HAVE_FUNC_ATTRIBUTE_ALLOC_SIZE 1
-#define HAVE_FUNC_ATTRIBUTE_COLD 1
-#define HAVE_FUNC_ATTRIBUTE_CONST 1
-#define HAVE_FUNC_ATTRIBUTE_ERROR 1
-#define HAVE_FUNC_ATTRIBUTE_FORMAT 1
-#define HAVE_FUNC_ATTRIBUTE_MALLOC 1
-#define HAVE_FUNC_ATTRIBUTE_NORETURN 1
-#define HAVE_FUNC_ATTRIBUTE_PURE 1
-#define HAVE_FUNC_ATTRIBUTE_RETURNS_NONNULL 1
-#define HAVE_FUNC_ATTRIBUTE_SENTINEL 1
-#define HAVE_GETGID 1
-#define HAVE_GETPAGESIZE 1
-#define HAVE_GETUID 1
-#define HAVE_HTOLE16 1
-#define HAVE_HTOLE32 1
-#define HAVE_HTOLE64 1
-/* #undef HAVE_INTRIN_H */
-#define HAVE_INTTYPES_H 1
-/* #undef HAVE_IO_H */
-/* #undef HAVE_MACHINE_ENDIAN_H */
-#define HAVE_MEMORY_H 1
-#define HAVE_MMAP 1
-#define HAVE_PATHCONF 1
-#define HAVE_REALPATH 1
-#define HAVE_SNPRINTF 1
-#define HAVE_STAT 1
-#define HAVE_STDBOOL_H 1
-#define HAVE_STDC_INLINE 1
-#define HAVE_STDINT_H 1
-#define HAVE_STDLIB_H 1
-#define HAVE_STDNORETURN_H 1
-#define HAVE_STRCASECMP 1
-/* #undef HAVE_STRICMP */
-#define HAVE_STRINGS_H 1
-#define HAVE_STRING_H 1
-#define HAVE_STRLCPY 1
-#define HAVE_STRNCASECMP 1
-/* #undef HAVE_STRNICMP */
-#define HAVE_STRNLEN 1
-/* #undef HAVE_STRRCHRNUL */
-#define HAVE_STRSEP 1
-#define HAVE_STRUCT_STAT 1
-/* #undef HAVE_STRUCT__STATI64 */
-#define HAVE_SYSCONF 1
-/* #undef HAVE_SYS_ENDIAN_H */
-#define HAVE_SYS_MMAN_H 1
-#define HAVE_SYS_PARAM_H 1
-#define HAVE_SYS_STAT_H 1
-#define HAVE_SYS_TYPES_H 1
-#define HAVE_UINTPTR_T 1
-#define HAVE_UNISTD_H 1
-#define HAVE_VSNPRINTF 1
-/* #undef HAVE__ACCESS */
-/* #undef HAVE__BITSCANREVERSE */
-/* #undef HAVE__BITSCANREVERSE64 */
-#define HAVE__BOOL 1
-/* #undef HAVE__BYTESWAP_UINT64 */
-/* #undef HAVE__BYTESWAP_ULONG */
-/* #undef HAVE__BYTESWAP_USHORT */
-/* #undef HAVE__CHSIZE */
-/* #undef HAVE__CHSIZE_S */
-/* #undef HAVE__FILELENGTHI64 */
-/* #undef HAVE__FILENO */
-/* #undef HAVE__FSEEKI64 */
-/* #undef HAVE__FSTATI64 */
-/* #undef HAVE__FULLPATH */
-/* #undef HAVE__SNPRINTF */
-/* #undef HAVE__STATI64 */
-/* #undef HAVE__VSNPRINTF */
-/* #undef HAVE___BSWAP_16 */
-/* #undef HAVE___BSWAP_32 */
-/* #undef HAVE___BSWAP_64 */
-#define HAVE___BUILTIN_BSWAP16 1
-#define HAVE___BUILTIN_BSWAP32 1
-#define HAVE___BUILTIN_BSWAP64 1
-#define HAVE___BUILTIN_CLZ 1
-#define HAVE___BUILTIN_CLZL 1
-#define HAVE___BUILTIN_CLZLL 1
-#define HAVE___BUILTIN_CONSTANT_P 1
-#define HAVE___BUILTIN_EXPECT 1
-/* #undef HAVE___CPU_TO_LE16 */
-/* #undef HAVE___CPU_TO_LE32 */
-/* #undef HAVE___CPU_TO_LE64 */
-#define PACKAGE_BUGREPORT ""
-#define PACKAGE_NAME ""
-#define PACKAGE_STRING ""
-#define PACKAGE_TARNAME ""
-#define PACKAGE_URL ""
-#define PACKAGE_VERSION ""
-#define STDC_HEADERS 1
-#ifndef _ALL_SOURCE
-# define _ALL_SOURCE 1
-#endif
-#ifndef _GNU_SOURCE
-# define _GNU_SOURCE 1
-#endif
-#ifndef _POSIX_PTHREAD_SEMANTICS
-# define _POSIX_PTHREAD_SEMANTICS 1
-#endif
-#ifndef _TANDEM_SOURCE
-# define _TANDEM_SOURCE 1
-#endif
-#ifndef __EXTENSIONS__
-# define __EXTENSIONS__ 1
-#endif
-/* #undef WORDS_BIGENDIAN */
-#define WORDS_LITTLEENDIAN 1
-#ifndef _DARWIN_USE_64_BIT_INODE
-# define _DARWIN_USE_64_BIT_INODE 1
-#endif
-/* #undef _FILE_OFFSET_BITS */
-/* #undef _LARGEFILE_SOURCE */
-/* #undef _LARGE_FILES */
-/* #undef _MINIX */
-/* #undef _POSIX_1_SOURCE */
-/* #undef _POSIX_SOURCE */
-/* #undef const */
-#ifndef __cplusplus
-/* #undef inline */
-#endif
-#define restrict __restrict
-#if defined __SUNPRO_CC && !defined __RESTRICT
-# define _Restrict
-# define __restrict__
-#endif
-/* #undef size_t */
-/* #undef uintptr_t */
diff --git 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
@@ -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
@@ -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
@@ -0,0 +1,4 @@
+unsigned x = -1;
+int main(void) {
+ return __builtin_clz(x);
+}
diff --git 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})