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