1 # serial 6 -*- Autoconf -*- 2 # Enable extensions on systems that normally disable them. 3 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. 8 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. 14 15 m4_version_prereq([2.62],, [ 16 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 28 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 33 things to work.]) 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.]) 39 fi 40 41 AH_VERBATIM([__EXTENSIONS__], 42 [/* Enable extensions on AIX 3, Interix. */ 43 #ifndef _ALL_SOURCE 44 # undef _ALL_SOURCE 45 #endif 46 /* Enable GNU extensions on systems that have them. */ 47 #ifndef _GNU_SOURCE 48 # undef _GNU_SOURCE 49 #endif 50 /* Enable threading extensions on Solaris. */ 51 #ifndef _POSIX_PTHREAD_SEMANTICS 52 # undef _POSIX_PTHREAD_SEMANTICS 53 #endif 54 /* Enable extensions on HP NonStop. */ 55 #ifndef _TANDEM_SOURCE 56 # undef _TANDEM_SOURCE 57 #endif 58 /* Enable general extensions on Solaris. */ 59 #ifndef __EXTENSIONS__ 60 # undef __EXTENSIONS__ 61 #endif 62 ]) 63 AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__], 64 [ac_cv_safe_to_define___extensions__], 65 [AC_COMPILE_IFELSE( 66 [AC_LANG_PROGRAM([ 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 78 79 ]) 80