1 # serial 6 -*- Autoconf -*-
2 # Enable extensions on systems that normally disable them.
4 # Copyright (C) 2003, 2006, 2007, 2009 Free Software Foundation, Inc.
5 # This file is free software; the Free Software Foundation
6 # gives unlimited permission to copy and/or distribute it,
7 # with or without modifications, as long as this notice is preserved.
9 # This definition of AC_USE_SYSTEM_EXTENSIONS is stolen from CVS
10 # Autoconf. Perhaps we can remove this once we can assume Autoconf
11 # 2.62 or later everywhere, but since CVS Autoconf mutates rapidly
12 # enough in this area it's likely we'll need to redefine
13 # AC_USE_SYSTEM_EXTENSIONS for quite some time.
15 m4_version_prereq([2.62],, [
17 # AC_USE_SYSTEM_EXTENSIONS
18 # ------------------------
19 # Enable extensions on systems that normally disable them,
20 # typically due to standards-conformance issues.
21 # Remember that #undef in AH_VERBATIM gets replaced with #define by
22 # AC_DEFINE. The goal here is to define all known feature-enabling
23 # macros, then, if reports of conflicts are made, disable macros that
24 # cause problems on some platforms (such as __EXTENSIONS__).
25 AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS],
26 [AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
27 AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
29 AC_CHECK_HEADER([minix/config.h], [MINIX=yes], [MINIX=])
30 if test "$MINIX" = yes; then
31 AC_DEFINE([_POSIX_SOURCE], [1],
32 [Define to 1 if you need to in order for `stat' and other
34 AC_DEFINE([_POSIX_1_SOURCE], [2],
35 [Define to 2 if the system does not provide POSIX.1 features
36 except with this defined.])
37 AC_DEFINE([_MINIX], [1],
38 [Define to 1 if on MINIX.])
41 AH_VERBATIM([__EXTENSIONS__],
42 [/* Enable extensions on AIX 3, Interix. */
46 /* Enable GNU extensions on systems that have them. */
50 /* Enable threading extensions on Solaris. */
51 #ifndef _POSIX_PTHREAD_SEMANTICS
52 # undef _POSIX_PTHREAD_SEMANTICS
54 /* Enable extensions on HP NonStop. */
55 #ifndef _TANDEM_SOURCE
56 # undef _TANDEM_SOURCE
58 /* Enable general extensions on Solaris. */
59 #ifndef __EXTENSIONS__
60 # undef __EXTENSIONS__
63 AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__],
64 [ac_cv_safe_to_define___extensions__],
67 # define __EXTENSIONS__ 1
68 AC_INCLUDES_DEFAULT])],
69 [ac_cv_safe_to_define___extensions__=yes],
70 [ac_cv_safe_to_define___extensions__=no])])
71 test $ac_cv_safe_to_define___extensions__ = yes &&
72 AC_DEFINE([__EXTENSIONS__])
73 AC_DEFINE([_ALL_SOURCE])
74 AC_DEFINE([_GNU_SOURCE])
75 AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
76 AC_DEFINE([_TANDEM_SOURCE])
77 ])# AC_USE_SYSTEM_EXTENSIONS