From ad118caa9f690114d11384b0813f30980cc333f3 Mon Sep 17 00:00:00 2001 From: Nick Alcock Date: Tue, 4 Jun 2019 15:04:49 +0100 Subject: libctf: work on platforms without O_CLOEXEC. (Not tested on any such platforms, since I don't have access to any at the moment. Testing encouraged.) libctf/ * configure.ac: Check for O_CLOEXEC. * ctf-decls.h (O_CLOEXEC): Define (to 0), if need be. * config.h.in: Regenerate. --- libctf/configure.ac | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'libctf/configure.ac') diff --git a/libctf/configure.ac b/libctf/configure.ac index beb90ba..2a1a80b 100644 --- a/libctf/configure.ac +++ b/libctf/configure.ac @@ -133,6 +133,22 @@ esac AM_CONDITIONAL(NEED_CTF_QSORT_R, test "${ac_cv_libctf_qsort_r_signature}" = unknown) +AC_CACHE_CHECK([for O_CLOEXEC], [ac_cv_libctf_macro_O_CLOEXEC], + [AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[#include + #ifndef O_CLOEXEC + choke me; + #endif + ]], + [[return O_CLOEXEC;]])], + [ac_cv_libctf_macro_O_CLOEXEC=yes], + [ac_cv_libctf_macro_O_CLOEXEC=no])]) + +if test $ac_cv_libctf_macro_O_CLOEXEC = yes; then + AC_DEFINE([HAVE_O_CLOEXEC], 1, + [Whether the platform has a definition of O_CLOEXEC.]) +fi + AC_CONFIG_FILES(Makefile) AC_CONFIG_HEADERS(config.h) AC_OUTPUT -- cgit v1.1