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.
This commit is contained in:
Michael Forney
2018-10-16 20:03:05 -07:00
parent 96bcd25021
commit 6673d9ab52
11 changed files with 31 additions and 10 deletions

View File

@@ -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

View File

@@ -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',

1
probe/SIZEOF_LONG Normal file
View File

@@ -0,0 +1 @@
_Static_assert(SIZEOF_LONG == sizeof(long), "incorrect size");

2
probe/SIZEOF_SIZE_T Normal file
View File

@@ -0,0 +1,2 @@
#include <stddef.h>
_Static_assert(SIZEOF_SIZE_T == sizeof(size_t), "incorrect size");

2
probe/SIZEOF_TIME_T Normal file
View File

@@ -0,0 +1,2 @@
#include <sys/types.h>
_Static_assert(SIZEOF_TIME_T == sizeof(time_t), "incorrect size");

View File

@@ -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')