Add comments.
[gnulib.git] / m4 / extensions.m4
1 # serial 2  -*- 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 # This file is only needed in autoconf <= 2.59.  Newer versions of autoconf
10 # have a macro AC_USE_SYSTEM_EXTENSIONS with identical semantics.
11
12 # gl_USE_SYSTEM_EXTENSIONS
13 # ------------------------
14 # Enable extensions on systems that normally disable them,
15 # typically due to standards-conformance issues.
16 m4_ifdef([AC_USE_SYSTEM_EXTENSIONS],
17   [AC_DEFUN([gl_USE_SYSTEM_EXTENSIONS],
18     [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])])],
19   [AC_DEFUN([gl_USE_SYSTEM_EXTENSIONS], [
20     AC_BEFORE([$0], [AC_COMPILE_IFELSE])
21     AC_BEFORE([$0], [AC_RUN_IFELSE])
22
23     AC_REQUIRE([AC_GNU_SOURCE])
24     AC_REQUIRE([AC_AIX])
25     AC_REQUIRE([AC_MINIX])
26
27     AH_VERBATIM([__EXTENSIONS__],
28 [/* Enable extensions on Solaris.  */
29 #ifndef __EXTENSIONS__
30 # undef __EXTENSIONS__
31 #endif
32 #ifndef _POSIX_PTHREAD_SEMANTICS
33 # undef _POSIX_PTHREAD_SEMANTICS
34 #endif])
35     AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__],
36       [ac_cv_safe_to_define___extensions__],
37       [AC_COMPILE_IFELSE(
38          [AC_LANG_PROGRAM([
39             #define __EXTENSIONS__ 1
40             AC_INCLUDES_DEFAULT])],
41          [ac_cv_safe_to_define___extensions__=yes],
42          [ac_cv_safe_to_define___extensions__=no])])
43     test $ac_cv_safe_to_define___extensions__ = yes &&
44       AC_DEFINE([__EXTENSIONS__])
45     AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
46 ])])