commit: 6673d9ab5267ff9cfc85f22c38fed5c5e0916df5
parent 96bcd25021135928929e629fb9d3a86571e11e26
Author: Michael Forney <mforney@mforney.org>
Date: Tue, 16 Oct 2018 20:03:05 -0700
curl: Probe for size of size_t, time_t and long
There are still several more SIZEOF_* constants in curl_config.h,
but they seem to match for architectures we care about.
Diffstat:
6 files changed, 26 insertions(+), 5 deletions(-)
diff --git a/pkg/curl/curl_config.h b/pkg/curl/curl_config.h
@@ -295,12 +295,12 @@
#define SEND_TYPE_RETV ssize_t
#define SIZEOF_CURL_OFF_T 8
#define SIZEOF_INT 4
-#define SIZEOF_LONG 8
+/* probe SIZEOF_LONG */
/* #undef SIZEOF_LONG_LONG */
#define SIZEOF_OFF_T 8
#define SIZEOF_SHORT 2
-#define SIZEOF_SIZE_T 8
-#define SIZEOF_TIME_T 8
+/* probe SIZEOF_SIZE_T */
+/* probe SIZEOF_TIME_T */
#define STDC_HEADERS 1
#define STRERROR_R_TYPE_ARG3 size_t
#define TIME_WITH_SYS_TIME 1
diff --git a/pkg/curl/gen.lua b/pkg/curl/gen.lua
@@ -2,7 +2,7 @@ cflags{
'-D HAVE_CONFIG_H',
'-D BUILDING_LIBCURL',
'-D CURL_STATICLIB',
- '-I $dir',
+ '-I $outdir',
'-I $outdir/include/curl',
'-I $outdir/include',
'-I $srcdir/lib',
@@ -11,6 +11,13 @@ cflags{
'-I $builddir/pkg/zlib/include',
}
+build('cat', '$outdir/curl_config.h', {
+ '$dir/curl_config.h',
+ '$builddir/probe/SIZEOF_LONG',
+ '$builddir/probe/SIZEOF_SIZE_T',
+ '$builddir/probe/SIZEOF_TIME_T',
+})
+
pkg.hdrs = copy('$outdir/include/curl', '$srcdir/include/curl', {
'curl.h',
'curlver.h',
@@ -22,6 +29,7 @@ pkg.hdrs = copy('$outdir/include/curl', '$srcdir/include/curl', {
'system.h',
})
pkg.deps = {
+ '$outdir/curl_config.h',
'$dir/headers',
'pkg/libressl/headers',
'pkg/zlib/headers',
diff --git a/probe/SIZEOF_LONG b/probe/SIZEOF_LONG
@@ -0,0 +1 @@
+_Static_assert(SIZEOF_LONG == sizeof(long), "incorrect size");
diff --git a/probe/SIZEOF_SIZE_T b/probe/SIZEOF_SIZE_T
@@ -0,0 +1,2 @@
+#include <stddef.h>
+_Static_assert(SIZEOF_SIZE_T == sizeof(size_t), "incorrect size");
diff --git a/probe/SIZEOF_TIME_T b/probe/SIZEOF_TIME_T
@@ -0,0 +1,2 @@
+#include <sys/types.h>
+_Static_assert(SIZEOF_TIME_T == sizeof(time_t), "incorrect size");
diff --git a/probe/gen.lua b/probe/gen.lua
@@ -1,6 +1,14 @@
local function probe(var)
- build('probe', '$outdir/'..var, '$dir/'..var, {var=var})
+ build('probe', '$outdir/'..var, {'$dir/'..var, '|', 'scripts/probe.sh'}, {var=var})
end
probe('HAVE_IMMINTRIN_H')
probe('HAVE__MM_MOVEMASK_EPI8')
+
+local function probesize(var)
+ build('probesize', '$outdir/'..var, {'$dir/'..var, '|', 'scripts/probe-size.sh'}, {var=var})
+end
+
+probesize('SIZEOF_LONG')
+probesize('SIZEOF_SIZE_T')
+probesize('SIZEOF_TIME_T')