sigsegv: avoid unlikely undefined behavior
[gnulib.git] / m4 / open-cloexec.m4
blob6defdfb4005fbfab8b61919a22c205089acccb40
1 # open-cloexec.m4
2 # serial 1
3 dnl Copyright 2017-2024 Free Software Foundation, Inc.
4 dnl This file is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
8 # Test whether O_CLOEXEC is defined.
10 AC_DEFUN([gl_PREPROC_O_CLOEXEC],
12   AC_CACHE_CHECK([for O_CLOEXEC],
13     [gl_cv_macro_O_CLOEXEC],
14     [AC_COMPILE_IFELSE(
15        [AC_LANG_PROGRAM([[#include <fcntl.h>
16                           #ifndef O_CLOEXEC
17                             choke me;
18                           #endif
19                         ]],
20                         [[return O_CLOEXEC;]])],
21        [gl_cv_macro_O_CLOEXEC=yes],
22        [gl_cv_macro_O_CLOEXEC=no])])