Hello Ralf,
to better support Interix aka MS Services for Unix[1], I would like to suggest applying the attached diff. Interix requires, such as AIX, #define _ALL_SOURCE 1 to enable all functions in the system headers. To not have to change all the configure.ac files around, I suggest to keep the name at AC_AIX.Thanks for the patch, this supports it: <http://support.microsoft.com/?scid=kb%3Ben-us%3B891755&x=17&y=16>. It should have a NEWS entry and a manual update, too. Could you run the Autoconf test suite (make check) with it on Interix to see how it fares? (I wonder whether the macro should keep the same name, get a new name together with a backward compatibility AU_DEFUN of AC_AIX, or just be a separate macro that also gets required by AC_USE_SYSTEM_EXTENSIONS.)
thanks for the link and for pointing out the existence of AC_USE_SYSTEM_EXTENSIONS. I think this is the right place to also require AC_INTERIX. (I first read the docs for 2.59 as these are the latest docs in Debian because of licensing issues.)
I prepared a bigger patch now, I think however, that Jerker might be right when he suggests to check for GCC before #define _ALL_SOURCE 1. The MS article explicitely mentions it, I can't verify if there are any problems for non-GCC, because I currently only use GCC.
The patch doesn't include the check for GCC, simply because I don't know what's the standard way to write it. I also don't know if/how there must be included a relationship, so that the result from checking for GCC is known before this test.
As I have no idea on what could be against a standard, I list below some of the functions that only get declared if _ALL_SOURCE is defined on Interix. The list is by far not complete! I currently can't imagine why these declarations could break more than they fix with non-GCC compilers. So I'm not sure if one should check for GCC first. OTOH, if someone uses non-GCC, he could supply CPPFLAGS=-D_ALL_SOURCE explicitely. Don't know which is better. The only breaking thing on non-GCC I can imagine is dlfcn.h, as only with GCC one can create and use shared libs on Interix.
Anyway, I applied the attached patch to 2.61 and then run the test suite. The results are also attached. The docs maybe should mention which functionality gets enabled by AC_INTERIX, but I have no idea on how to summarize it. I can do further tests/changes if required.
Martin ctype.h: -------- #if defined(_ALL_SOURCE) || defined(_XOPEN_SOURCE) || (__STDC__ - 0 == 0) /* XPG4 extensions */ extern int __cdecl _tolower(int); extern int __cdecl _toupper(int); extern int __cdecl isascii(int); extern int __cdecl toascii(int); #endif /* defined(_ALL_SOURCE) ... */ #if defined(_ALL_SOURCE) || (__STDC__ - 0 == 0) extern int __cdecl isblank(int c); #endif /*defined(_ALL_SOURCE) || (__STDC__ - 0 == 0)*/ #if defined(_ALL_SOURCE) || defined(_XOPEN_SOURCE) || (__STDC__ - 0 == 0) /* _to*() must be macros */ #define _tolower(_c) ( (_c)-'A'+'a' ) #define _toupper(_c) ( (_c)-'a'+'A' ) #define isascii(_c) ( (unsigned)(_c) < 0x80 ) #define toascii(_c) ( (_c) & 0x7f ) #endif /* defined(_ALL_SOURCE) .. */ dirent.h: --------- #if defined(_ALL_SOURCE) || defined(_XOPEN_SOURCE) || (__STDC__ - 0 == 0) extern void __cdecl seekdir (DIR *, long int); extern long int __cdecl telldir (DIR *); #endif /* defined(_ALL_SOURCE) || ... */ #if defined(_ALL_SOURCE) extern int __cdecl dirfd(DIR *); extern DIR* __cdecl wcs_opendir(const wchar_t * ); /* scandir() and alphasort() are 4.3 bsd extensions * that are becoming quite popular. */ extern int scandir(const char *, struct dirent **[], int (*)(struct dirent *), int (*)(const void *, const void *)); extern int alphasort(const void *, const void *); #endif /* defined(_ALL_SOURCE) */ dlfcn.h: -------- #ifdef _ALL_SOURCE #define RTLD_BINDING_MASK 0x3 /* Mask of binding time value. */ #endif #ifdef _ALL_SOURCE /* If the first argument of `dlsym' is set to RTLD_NEXT the run-time address of the symbol called NAME in the next shared object is returned. The "next" relation is defined by the order the shared objects were loaded. */ #define RTLD_NEXT ((void *) -1l) #endif #ifdef _ALL_SOURCE /* Fill in *INFO with the following information about ADDRESS. Returns 0 iff no shared object's segments contain that address. */ typedef struct { const char *dli_fname; /* File name of defining object. */ void *dli_fbase; /* Load address of that object. */ const char *dli_sname; /* Name of nearest symbol. */ void *dli_saddr; /* Exact value of nearest symbol. */ } Dl_info; extern int dladdr (void *__address, Dl_info *__info); #endif errno.h: -------- #if defined(_ALL_SOURCE) #define MAX_ERRNO 95 #endif /* defined(_ALL_SOURCE) */ fcntl.h: -------- #if defined(_ALL_SOURCE) || defined(_XOPEN_SOURCE) #define O_SYNC 0x00000010 /* Synchronous write option */ #endif /*defined(_ALL_SOURCE) || defined(_XOPEN_SOURCE)*/ #if defined(_ALL_SOURCE) /* * 4.2 BSD flock() support */ #define LOCK_SH 1 #define LOCK_EX 2 #define LOCK_NB 4 #define LOCK_UN 8 extern int __cdecl flock(int fd, int operation); /* widechar version of open() */ extern int __cdecl wcs_open(const wchar_t *, int, ...); #endif /*_ALL_SOURCE*/ ftw.h: ------ #if defined (_ALL_SOURCE) \ || !defined(_XOPEN_SOURCE) \ || (defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)) #define FTW_SL 6 /* symbolic link */ #define FTW_SLN 7 /* symbolic link without target */ #endif /*defined (_ALL_SOURCE) || (defined(_XOPEN_SOURCE) .. */ glob.h: ------- #if defined(_ALL_SOURCE) #define GLOB_ALTDIRFUNC 0x0040 /* Use alternately specified directory funcs. */ #define GLOB_BRACE 0x0080 /* Expand braces ala csh. */ #define GLOB_MAGCHAR 0x0100 /* Pattern had globbing characters. */ #define GLOB_NOMAGIC 0x0200 /* GLOB_NOCHECK without magic chars (csh). */ #define GLOB_QUOTE 0x0400 /* Quote special chars with \. */ #define GLOB_TILDE 0x0800 /* Expand tilde names from the passwd file. */ #define GLOB_LIMIT 0x1000 /* limit number of returned paths */ #endif /*_ALL_SOURCE*/ grp.h: ------ #if defined(_ALL_SOURCE) \ || (__STDC__ - 0 == 0 && !defined(_POSIX_C_SOURCE)) \ || (defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE_EXTENDED==1)) struct group * _CRTAPI1 getgrent(void); void _CRTAPI1 setgrent(void); void _CRTAPI1 endgrent(void); #endif /* defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE_EXTENDED == 1) */ limits.h: --------- #if defined(_ALL_SOURCE) \ || (__STDC__ - 0 == 0) && !defined(_POSIX_C_SOURCE) \ && !defined(_XOPEN_SOURCE) /* * Minimum and maximum values for 64-bit types * Define all the various well-known flavors of symbols * */ #define ULLONG_MAX ((u_quad_t)0-1) /* 0xffffffffffffffff */ #define LLONG_MAX ((quad_t)(ULLONG_MAX>>1)) /* 0x7fffffffffffffff */ #define LLONG_MIN ((quad_t)((-LLONG_MAX)-1)) /* 0x8000000000000000 */ #define LONG_LONG_MIN LLONG_MIN #define LONG_LONG_MAX LLONG_MAX #define ULONG_LONG_MAX ULLONG_MAX #define QUAD_MIN LLONG_MIN #define QUAD_MAX LLONG_MAX #define UQUAD_MAX ULLONG_MAX #endif /* defined(_ALL_SOURCE) ... */ #if defined(_ALL_SOURCE) \ || (defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 199506L)) extern long __cdecl _sysconf(int); /* private interface */ /* * POSIX.1c pthread constants */ #define PTHREAD_STACK_MIN ((size_t)_sysconf(_SC_THREAD_STACK_MIN)) #define PTHREAD_KEYS_MAX _POSIX_THREAD_KEYS_MAX #endif // defined(_ALL_SOURCE) || ... (POSIX_C_SOURCE >= 199506L) #if defined(_ALL_SOURCE) || (__STDC__ - 0 == 0) || \ defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) /* * POSIX2 SYMBOLIC CONSTANTS * * POSIX 1003.2-1992 table 2-17 */ #define _POSIX2_BC_BASE_MAX 99 #define _POSIX2_BC_DIM_MAX 2048 #define _POSIX2_BC_SCALE_MAX 99 #define _POSIX2_BC_STRING_MAX 1000 #define _POSIX2_COLL_WEIGHTS_MAX 2 #define _POSIX2_EXPR_NEST_MAX 32 #define _POSIX2_LINE_MAX 2048 #define _POSIX2_RE_DUP_MAX 255 #define _POSIX2_VERSION 199209L #define COLL_WEIGHTS_MAX 4 #define EXPR_NEST_MAX 32 #define LINE_MAX 2048 #define RE_DUP_MAX 255 /* * additional XPG 4.2 symbolic constants * * (System Interfaces and Headers, issue 4, rev 2, pg 776) */ #define CHARCLASS_NAME_MAX 32 #define NL_LANGMAX 32 #define NL_NMAX 16 #define NL_MSGMAX 32767 #define NL_SETMAX 255 #define NL_TEXTMAX _POSIX2_LINE_MAX #define NL_ARGMAX 30 /* * POSIX 1003.2-1992 Section B.2.1 Table B-3 */ #define BC_BASE_MAX LINE_MAX #define BC_DIM_MAX 65535 #define BC_SCALE_MAX LINE_MAX #define BC_STRING_MAX LINE_MAX #endif /* defined(_ALL_SOURCE) ... */ #if defined(_ALL_SOURCE) || defined(_XOPEN_SOURCE) #define _XOPEN_IOV_MAX INT_MAX #endif /*defined(_ALL_SOURCE) || defined(_XOPEN_SOURCE)*/ math.h: ------- #if defined(_ALL_SOURCE) || defined(_XOPEN_SOURCE) \|| (__STDC__ - 0 == 0 && !defined(_POSIX_C_SOURCE))
/*l * external variable that goes with gamma() and lgamma(). */ extern int signgam; #define M_E 2.7182818284590452354 /* e */ #define M_LOG2E 1.4426950408889634074 /* log 2e */ #define M_LOG10E 0.43429448190325182765 /* log 10e */ #define M_LN2 0.69314718055994530942 /* log e2 */ #define M_LN10 2.30258509299404568402 /* log e10 */ #define M_PI 3.14159265358979323846 /* pi */ #define M_PI_2 1.57079632679489661923 /* pi/2 */ #define M_PI_4 0.78539816339744830962 /* pi/4 */ #define M_1_PI 0.31830988618379067154 /* 1/pi */ #define M_2_PI 0.63661977236758134308 /* 2/pi */ #define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */ #define M_SQRT2 1.41421356237309504880 /* sqrt(2) */ #define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */ #define MAXFLOAT ((float)3.40282346638528860e+38) /* Prototypes */ extern double __cdecl erf(double); extern double __cdecl erfc(double); extern double __cdecl gamma(double); extern double __cdecl hypot(double, double); extern double __cdecl j0(double); extern double __cdecl j1(double); extern double __cdecl jn(int, double); extern double __cdecl lgamma(double); extern double __cdecl y0(double); extern double __cdecl y1(double); extern double __cdecl yn(int, double); extern int __cdecl isnan(double); stdio.h: -------- #if defined(_ALL_SOURCE) || defined(_POSIX_C_SOURCE) \ || defined(_XOPEN_SOURCE) || (__STDC__ - 0 == 0) /* * Functions defined in POSIX 1003.1. */ #define L_ctermid 1024 /* size for ctermid(); PATH_MAX */ char * __cdecl ctermid (char *); FILE * __cdecl fdopen (int, const char *); int __cdecl fileno (FILE *); #endif /* _ALL_SOURCE ... */#if (__STDC__ - 0 == 0) || _POSIX_C_SOURCE >= 2 || defined(_ALL_SOURCE) \
|| defined(_XOPEN_SOURCE) /* POSIX.2-1992 and XOPEN */ int __cdecl pclose (FILE *); FILE* __cdecl popen (const char *, const char *); #endif /* POSIX.2 */ #if defined(_ALL_SOURCE) || defined(_XOPEN_SOURCE) \|| ((__STDC__ - 0 == 0) && !defined(POSIX_C_SOURCE))
extern char* __cdecl tempnam (const char *, const char *); extern int __cdecl getopt(int, char * const [], const char *); /* EXTERNAL VARIABLES for getopt() */ extern char *optarg; extern int optind, opterr, optopt; #define L_cuserid 16 /* size for cuserid(); UT_NAMESIZE */ extern char * __cdecl cuserid(char *); extern int __cdecl getw(FILE *); extern int __cdecl putw (int, FILE *); #endif /*defined(_ALL_SOURCE) || defined(_XOPEN_SOURCE) .... */ stdlib.h: --------- #if defined(_ALL_SOURCE) extern size_t __cdecl wcsntombs(char*, const wchar_t *, size_t, size_t); extern size_t __cdecl mbsntowcs(wchar_t *, const char*, size_t, size_t); /* * arc4 related header definitions */ u_int32_t arc4random(void); void arc4random_stir(void); void arc4random_addrandom(u_char *, int); #endif /* defined(_ALL_SOURCE) */ string.h: --------- #if defined(_ALL_SOURCE) extern char * __cdecl mbsrchr(const char *, char); #endif #if defined(_ALL_SOURCE) || defined(_XOPEN_SOURCE) \ || (__STDC__ - 0 == 0 && !defined(_POSIX_C_SOURCE)) extern void* __cdecl memccpy(void *, const void *, int, unsigned int); #endif /* defined(_ALL_SOURCE) ... */ #if defined(_ALL_SOURCE) \|| (defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE_EXTENDED==1)) \
|| (__STDC__ - 0 == 0 && !defined(_POSIX_C_SOURCE)) extern char* __cdecl strdup(const char *); #endif /* defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE_EXTENDED == 1) */ #if defined(_ALL_SOURCE) #include <strings.h> /* include other BSD definitions */ extern char *strsignal(int); /* Linux/Solaris compatibility */ extern char *strsigname(int); /* strncat(), strncpy() replacements from OpenBSD/FreeBsd */ extern size_t strlcpy(char *, const char *, size_t ); extern size_t strlcat(char *, const char *, size_t ); #endif /* defined(_ALL_SOURCE) */ time.h: ------- #if defined(_ALL_SOURCE) || defined(_XOPEN_SOURCE) \ || (__STDC__ - 0 == 0 && !defined(_POSIX_C_SOURCE)) extern char * __cdecl strptime(const char *, const char *, struct tm *); extern long int timezone; /* diff. in seconds between UTC and local time*/ extern int daylight; /* non-zero if daylight savings time active */ #endif /* defined(_ALL_SOURCE) || defined(_XOPEN_SOURCE) */ #if defined(_ALL_SOURCE) \ || (defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE_EXTENDED==1)) \ || (__STDC__ - 0 == 0 && !defined(_POSIX_C_SOURCE)) extern struct tm* getdate(const char *); extern int getdate_err; /* errors for getdate() */ #endif /* defined(_ALL_SOURCE) || defined(_XOPEN_SOURCE) */
diff -Nur autoconf-2.61.orig/doc/autoconf.texi autoconf-2.61/doc/autoconf.texi --- autoconf-2.61.orig/doc/autoconf.texi Fri Nov 17 01:16:27 2006 +++ autoconf-2.61/doc/autoconf.texi Wed Aug 29 14:39:58 2007 @@ -7297,6 +7297,13 @@ functions. Should be called before any macros that run the C compiler. @end defmac [EMAIL PROTECTED] AC_INTERIX [EMAIL PROTECTED] [EMAIL PROTECTED] _ALL_SOURCE +If on @acronym{Interix} and using @acronym{GCC}, define @code{_ALL_SOURCE}. +Should be called before any macros that run the C compiler. [EMAIL PROTECTED] defmac + @defmac AC_GNU_SOURCE @acindex{GNU_SOURCE} @cvindex _GNU_SOURCE @@ -7344,7 +7351,7 @@ @code{_POSIX_PTHREAD_SEMANTICS}, which are macros used by Solaris. It also defines @code{_TANDEM_SOURCE} for the @acronym{HP} NonStop platform. This macro also has the combined effects of @code{AC_GNU_SOURCE}, [EMAIL PROTECTED], and @code{AC_MINIX}. [EMAIL PROTECTED], @code{AC_INTERIX}, and @code{AC_MINIX}. @end defmac diff -Nur autoconf-2.61.orig/lib/autoconf/specific.m4 autoconf-2.61/lib/autoconf/specific.m4 --- autoconf-2.61.orig/lib/autoconf/specific.m4 Tue Oct 24 21:34:09 2006 +++ autoconf-2.61/lib/autoconf/specific.m4 Wed Aug 29 14:36:18 2007 @@ -393,6 +393,7 @@ AC_REQUIRE([AC_GNU_SOURCE]) AC_REQUIRE([AC_AIX]) + AC_REQUIRE([AC_INTERIX]) AC_REQUIRE([AC_MINIX]) AH_VERBATIM([__EXTENSIONS__], @@ -453,6 +454,30 @@ AC_DEFINE(_ALL_SOURCE)], [AC_MSG_RESULT([no])]) ])# AC_AIX + + +# AC_INTERIX +# ---------- +AC_DEFUN([AC_INTERIX], +[AH_VERBATIM([_ALL_SOURCE], +[/* Define to 1 if on Interix. + System headers sometimes define this. + We just want to avoid a redefinition error message. */ [EMAIL PROTECTED]:@ifndef _ALL_SOURCE [EMAIL PROTECTED]:@ undef _ALL_SOURCE [EMAIL PROTECTED]:@endif])dnl +AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl +AC_BEFORE([$0], [AC_RUN_IFELSE])dnl +AC_MSG_CHECKING([for Interix]) +AC_EGREP_CPP(yes, +[#ifdef __INTERIX + yes +#endif +], +[AC_MSG_RESULT([yes]) +AC_DEFINE(_ALL_SOURCE)], +[AC_MSG_RESULT([no])]) +])# AC_INTERIX # AC_MINIX
make-check.log.gz
Description: Binary data