2N/A# serial 9 -*- Autoconf -*-
2N/A# Enable extensions on systems that normally disable them.
2N/A
2N/A# Copyright (C) 2003, 2006-2010 Free Software Foundation, Inc.
2N/A# This file is free software; the Free Software Foundation
2N/A# gives unlimited permission to copy and/or distribute it,
2N/A# with or without modifications, as long as this notice is preserved.
2N/A
2N/A# This definition of AC_USE_SYSTEM_EXTENSIONS is stolen from CVS
2N/A# Autoconf. Perhaps we can remove this once we can assume Autoconf
2N/A# 2.62 or later everywhere, but since CVS Autoconf mutates rapidly
2N/A# enough in this area it's likely we'll need to redefine
2N/A# AC_USE_SYSTEM_EXTENSIONS for quite some time.
2N/A
2N/A# If autoconf reports a warning
2N/A# warning: AC_COMPILE_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS
2N/A# or warning: AC_RUN_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS
2N/A# the fix is
2N/A# 1) to ensure that AC_USE_SYSTEM_EXTENSIONS is never directly invoked
2N/A# but always AC_REQUIREd,
2N/A# 2) to ensure that for each occurrence of
2N/A# AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
2N/A# or
2N/A# AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
2N/A# the corresponding gnulib module description has 'extensions' among
2N/A# its dependencies. This will ensure that the gl_USE_SYSTEM_EXTENSIONS
2N/A# invocation occurs in gl_EARLY, not in gl_INIT.
2N/A
2N/A# AC_USE_SYSTEM_EXTENSIONS
2N/A# ------------------------
2N/A# Enable extensions on systems that normally disable them,
2N/A# typically due to standards-conformance issues.
2N/A# Remember that #undef in AH_VERBATIM gets replaced with #define by
2N/A# AC_DEFINE. The goal here is to define all known feature-enabling
2N/A# macros, then, if reports of conflicts are made, disable macros that
2N/A# cause problems on some platforms (such as __EXTENSIONS__).
2N/AAC_DEFUN_ONCE([AC_USE_SYSTEM_EXTENSIONS],
2N/A[AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
2N/AAC_BEFORE([$0], [AC_RUN_IFELSE])dnl
2N/A
2N/A AC_REQUIRE([AC_CANONICAL_HOST])
2N/A
2N/A AC_CHECK_HEADER([minix/config.h], [MINIX=yes], [MINIX=])
2N/A if test "$MINIX" = yes; then
2N/A AC_DEFINE([_POSIX_SOURCE], [1],
2N/A [Define to 1 if you need to in order for `stat' and other
2N/A things to work.])
2N/A AC_DEFINE([_POSIX_1_SOURCE], [2],
2N/A [Define to 2 if the system does not provide POSIX.1 features
2N/A except with this defined.])
2N/A AC_DEFINE([_MINIX], [1],
2N/A [Define to 1 if on MINIX.])
2N/A fi
2N/A
2N/A dnl HP-UX 11.11 defines mbstate_t only if _XOPEN_SOURCE is defined to 500,
2N/A dnl regardless of whether the flags -Ae or _D_HPUX_SOURCE=1 are already
2N/A dnl provided.
2N/A case "$host_os" in
2N/A hpux*)
2N/A AC_DEFINE([_XOPEN_SOURCE], [500],
2N/A [Define to 500 only on HP-UX.])
2N/A ;;
2N/A esac
2N/A
2N/A AH_VERBATIM([__EXTENSIONS__],
2N/A[/* Enable extensions on AIX 3, Interix. */
2N/A#ifndef _ALL_SOURCE
2N/A# undef _ALL_SOURCE
2N/A#endif
2N/A/* Enable GNU extensions on systems that have them. */
2N/A#ifndef _GNU_SOURCE
2N/A# undef _GNU_SOURCE
2N/A#endif
2N/A/* Enable threading extensions on Solaris. */
2N/A#ifndef _POSIX_PTHREAD_SEMANTICS
2N/A# undef _POSIX_PTHREAD_SEMANTICS
2N/A#endif
2N/A/* Enable extensions on HP NonStop. */
2N/A#ifndef _TANDEM_SOURCE
2N/A# undef _TANDEM_SOURCE
2N/A#endif
2N/A/* Enable general extensions on Solaris. */
2N/A#ifndef __EXTENSIONS__
2N/A# undef __EXTENSIONS__
2N/A#endif
2N/A])
2N/A AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__],
2N/A [ac_cv_safe_to_define___extensions__],
2N/A [AC_COMPILE_IFELSE(
2N/A [AC_LANG_PROGRAM([[
2N/A# define __EXTENSIONS__ 1
2N/A ]AC_INCLUDES_DEFAULT])],
2N/A [ac_cv_safe_to_define___extensions__=yes],
2N/A [ac_cv_safe_to_define___extensions__=no])])
2N/A test $ac_cv_safe_to_define___extensions__ = yes &&
2N/A AC_DEFINE([__EXTENSIONS__])
2N/A AC_DEFINE([_ALL_SOURCE])
2N/A AC_DEFINE([_GNU_SOURCE])
2N/A AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
2N/A AC_DEFINE([_TANDEM_SOURCE])
2N/A])# AC_USE_SYSTEM_EXTENSIONS
2N/A
2N/A# gl_USE_SYSTEM_EXTENSIONS
2N/A# ------------------------
2N/A# Enable extensions on systems that normally disable them,
2N/A# typically due to standards-conformance issues.
2N/AAC_DEFUN_ONCE([gl_USE_SYSTEM_EXTENSIONS],
2N/A[
2N/A dnl Require this macro before AC_USE_SYSTEM_EXTENSIONS.
2N/A dnl gnulib does not need it. But if it gets required by third-party macros
2N/A dnl after AC_USE_SYSTEM_EXTENSIONS is required, autoconf 2.62..2.63 emit a
2N/A dnl warning: "AC_COMPILE_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS".
2N/A dnl Note: We can do this only for one of the macros AC_AIX, AC_GNU_SOURCE,
2N/A dnl AC_MINIX. If people still use AC_AIX or AC_MINIX, they are out of luck.
2N/A AC_REQUIRE([AC_GNU_SOURCE])
2N/A
2N/A AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
2N/A])