fcntl_flags.m4 1.1 KB

123456789101112131415161718192021222324252627
  1. dnl Copyright (C) 2012 Data Differential LLC
  2. dnl Copyright (C) 2011 Keyur Govande
  3. dnl This file is free software; Keyur Govande
  4. dnl gives unlimited permission to copy and/or distribute it,
  5. dnl with or without modifications, as long as this notice is preserved.
  6. dnl ---------------------------------------------------------------------------
  7. dnl Macro: FCNTL_FLAGS
  8. dnl ---------------------------------------------------------------------------
  9. AC_DEFUN([FCNTL_FLAGS],
  10. [
  11. AC_CACHE_CHECK([for O_CLOEXEC], [ac_cv_o_cloexec], [
  12. AC_LANG_PUSH([C])
  13. save_CFLAGS="$CFLAGS"
  14. CFLAGS="$CFLAGS -I${srcdir}"
  15. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <fcntl.h>], [ int flags= O_CLOEXEC])], [ac_cv_o_cloexec="yes"], [ac_cv_o_cloexec="no"])
  16. AC_LANG_POP
  17. CFLAGS="$save_CFLAGS"
  18. ])
  19. AS_IF([test "x$ac_cv_o_cloexec" = "xyes"],[ AC_DEFINE(HAVE_O_CLOEXEC, 1, [Define to 1 if you have O_CLOEXEC defined])])
  20. ])
  21. dnl ---------------------------------------------------------------------------
  22. dnl End Macro: FCNTL_FLAGS
  23. dnl ---------------------------------------------------------------------------