* extensions.m4 (gl_USE_SYSTEM_EXTENSIONS): Use "=" with "test", not "==".
[gnulib.git] / m4 / extensions.m4
1 # Enable extensions on systems that normally disable them.
2
3 # Copyright (C) 2003, 2006 Free Software Foundation, Inc.
4 # This file is free software; the Free Software Foundation
5 # gives unlimited permission to copy and/or distribute it,
6 # with or without modifications, as long as this notice is preserved.
7
8 # gl_USE_SYSTEM_EXTENSIONS
9 # ------------------------
10 # Enable extensions on systems that normally disable them,
11 # typically due to standards-conformance issues.
12 AC_DEFUN([gl_USE_SYSTEM_EXTENSIONS], [
13   AC_BEFORE([$0], [AC_COMPILE_IFELSE])
14   AC_BEFORE([$0], [AC_RUN_IFELSE])
15
16   AC_REQUIRE([AC_GNU_SOURCE])
17   AC_REQUIRE([AC_AIX])
18   AC_REQUIRE([AC_MINIX])
19
20   AH_VERBATIM([__EXTENSIONS__],
21 [/* Enable extensions on Solaris.  */
22 #ifndef __EXTENSIONS__
23 # undef __EXTENSIONS__
24 #endif
25 #ifndef _POSIX_PTHREAD_SEMANTICS
26 # undef _POSIX_PTHREAD_SEMANTICS
27 #endif])
28   AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__],
29     [ac_cv_safe_to_define___extensions__],
30     [AC_COMPILE_IFELSE(
31        [AC_LANG_PROGRAM([
32           #define __EXTENSIONS__ 1
33           AC_INCLUDES_DEFAULT])],
34        [ac_cv_safe_to_define___extensions__=yes],
35        [ac_cv_safe_to_define___extensions__=no])])
36   test $ac_cv_safe_to_define___extensions__ = yes &&
37     AC_DEFINE([__EXTENSIONS__])
38   AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
39 ])