* m4/extensions.m4 (gl_USE_SYSTEM_EXTENSIONS): Undo previous
[gnulib.git] / m4 / extensions.m4
1 # serial 3  -*- Autoconf -*-
2 # Enable extensions on systems that normally disable them.
3
4 # Copyright (C) 2003, 2006 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.
8
9 # The main body of this macro is stolen from CVS Autoconf.  Perhaps we
10 # can replace it with AC_USE_SYSTEM_EXTENSIONS once we can assume
11 # Autoconf 2.61 or later everywhere, but since CVS Autoconf mutates
12 # rapidly enough in this area it's likely that we'll need
13 # gl_USE_SYSTEM_EXTENSIONS for quite some time.
14
15 # _gl_TANDEM_SOURCE
16
17 # gl_USE_SYSTEM_EXTENSIONS
18 # ------------------------
19 # Enable extensions on systems that normally disable them,
20 # typically due to standards-conformance issues.
21 AC_DEFUN([gl_USE_SYSTEM_EXTENSIONS],
22 [
23   AC_BEFORE([$0], [AC_COMPILE_IFELSE])
24   AC_BEFORE([$0], [AC_RUN_IFELSE])
25
26   AC_REQUIRE([AC_GNU_SOURCE])
27   AC_REQUIRE([AC_AIX])
28   AC_REQUIRE([AC_MINIX])
29
30   AH_VERBATIM([__EXTENSIONS__],
31 [/* Enable extensions on Solaris.  */
32 #ifndef __EXTENSIONS__
33 # undef __EXTENSIONS__
34 #endif
35 #ifndef _POSIX_PTHREAD_SEMANTICS
36 # undef _POSIX_PTHREAD_SEMANTICS
37 #endif
38 #ifndef _TANDEM_SOURCE
39 # undef _TANDEM_SOURCE
40 #endif])
41   AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__],
42     [gl_cv_safe_to_define___extensions__],
43     [AC_COMPILE_IFELSE(
44        [AC_LANG_PROGRAM([
45 #         define __EXTENSIONS__ 1
46           AC_INCLUDES_DEFAULT])],
47        [gl_cv_safe_to_define___extensions__=yes],
48        [gl_cv_safe_to_define___extensions__=no])])
49   test $gl_cv_safe_to_define___extensions__ = yes &&
50     AC_DEFINE([__EXTENSIONS__])
51   AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
52   AC_DEFINE([_TANDEM_SOURCE])
53 ])