summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2017-05-12 06:31:28 -0700
committerKaz Kylheku <kaz@kylheku.com>2017-05-12 06:31:28 -0700
commitfffdf3f4287dd8636657969a7e39e5a544cdb885 (patch)
treee668b1bb05b91b44f5f10f6dcb6c9afa2a2802d2
parent45521a7f766a044dfd75f79b79a775791ba5b483 (diff)
downloadtxr-fffdf3f4287dd8636657969a7e39e5a544cdb885.tar.gz
txr-fffdf3f4287dd8636657969a7e39e5a544cdb885.tar.bz2
txr-fffdf3f4287dd8636657969a7e39e5a544cdb885.zip
ffi: darwin port: missing types.
* configure: detect clockid_t and loff_t, providing HAVE_CLOCKID_T and HAVE_LOFF_T config macros. * ffi.c (ffi_init_extra_types): Register clockid-t and loff-t types only if available.
-rwxr-xr-xconfigure38
-rw-r--r--ffi.c4
2 files changed, 42 insertions, 0 deletions
diff --git a/configure b/configure
index a59cdaf9..c9b26f23 100755
--- a/configure
+++ b/configure
@@ -2825,6 +2825,44 @@ else
printf "no\n"
fi
+printf "Checking for clockid_t ... "
+cat > conftest.c <<!
+#include <sys/types.h>
+
+int main(void)
+{
+ clockid_t cid = CLOCK_REALTIME;
+ return 0;
+}
+!
+
+if conftest ; then
+ printf "yes\n"
+ printf "#define HAVE_CLOCKID_T 1\n" >> config.h
+ have_sys_types=y
+else
+ printf "no\n"
+fi
+
+printf "Checking for loff_t ... "
+cat > conftest.c <<!
+#include <sys/types.h>
+
+int main(void)
+{
+ loff_t lo = 0;
+ return 0;
+}
+!
+
+if conftest ; then
+ printf "yes\n"
+ printf "#define HAVE_LOFF_T 1\n" >> config.h
+ have_sys_types=y
+else
+ printf "no\n"
+fi
+
#
# Dependent variables
#
diff --git a/ffi.c b/ffi.c
index ab640591..d34a1bb6 100644
--- a/ffi.c
+++ b/ffi.c
@@ -1779,8 +1779,10 @@ static void ffi_init_extra_types(void)
type_by_size[(blkcnt_t) -1 > 0][sizeof (blkcnt_t)]);
ffi_typedef(intern(lit("blksize-t"), user_package),
type_by_size[(blksize_t) -1 > 0][sizeof (blksize_t)]);
+#if HAVE_CLOCKID_T
ffi_typedef(intern(lit("clockid-t"), user_package),
type_by_size[(clockid_t) -1 > 0][sizeof (clockid_t)]);
+#endif
ffi_typedef(intern(lit("dev-t"), user_package),
type_by_size[(dev_t) -1 > 0][sizeof (dev_t)]);
ffi_typedef(intern(lit("fsblkcnt-t"), user_package),
@@ -1795,8 +1797,10 @@ static void ffi_init_extra_types(void)
type_by_size[(ino_t) -1 > 0][sizeof (ino_t)]);
ffi_typedef(intern(lit("key-t"), user_package),
type_by_size[(key_t) -1 > 0][sizeof (key_t)]);
+#if HAVE_LOFF_T
ffi_typedef(intern(lit("loff-t"), user_package),
type_by_size[(loff_t) -1 > 0][sizeof (loff_t)]);
+#endif
ffi_typedef(intern(lit("mode-t"), user_package),
type_by_size[(mode_t) -1 > 0][sizeof (mode_t)]);
ffi_typedef(intern(lit("nlink-t"), user_package),