Jerker Bäck <jerker.back@xxxxxxx> writes: > The macro always fails to test the MS compiler resulting in the wrong > "#define SETVBUF_REVERSED 1", but succeed in testing gcc. In this case, both > compilers are using the same C-library (Interix BSD LIBC). Why is that? I haven't a clue, but I do have a fix. Let's just declare that macro obsolete. For several years, it has caused far more trouble (by giving the wrong answer on modern hosts) than it has cured (by giving the right answer on long-ago-obsolete hosts). We can't maintain it any more, since we lack access to ancient hosts where it's needed. So let's get rid of it. I installed the following into Autoconf. 2006-11-27 Paul Eggert <eggert@xxxxxxxxxxx> Turn AC_FUNC_SETVBUF_REVERSED into a noop. It's been obsolete for years and is too hard to maintain now. The last straw was reported by Jerker Baeck in <http://lists.gnu.org/archive/html/autoconf/2006-11/msg00102.html>. * NEWS: AC_FUNC_SETVBUF_REVERSED is now obsolete. * doc/autoconf.texi (Particular Functions): Move AC_FUNC_SETVBUF_REVERSED from here... (Obsolete Macros): ... to here. Say that it does nothing now. * lib/autoconf/functions.m4 (AC_FUNC_SETVBUF_REVERSED): Turn into (almost) a no-op. Index: NEWS =================================================================== RCS file: /cvsroot/autoconf/autoconf/NEWS,v retrieving revision 1.415 diff -u -r1.415 NEWS --- NEWS 27 Nov 2006 22:47:33 -0000 1.415 +++ NEWS 28 Nov 2006 03:28:50 -0000 @@ -1,5 +1,12 @@ * Major changes in Autoconf 2.61a (??) +** AC_FUNC_SETVBUF_REVERSED is now obsolete. It is still defined for backward + compatibility but it does nothing. The macro was already + obsolescent, as the last systems to have the problem were those + based on SVR2, which became obsolete in 1987. The macro had bugs + on some modern systems and could no longer be maintained reliably + due to lack of ancient systems to test it on. + ** config.status now uses awk instead of sed for most substitutions, for speed. It is now documented that Makefile.in should not contain overlapping variable occurrences, e.g., @VAR1@VAR2@. Autoconf's Index: doc/autoconf.texi =================================================================== RCS file: /cvsroot/autoconf/autoconf/doc/autoconf.texi,v retrieving revision 1.1111 diff -u -r1.1111 autoconf.texi --- doc/autoconf.texi 27 Nov 2006 22:47:33 -0000 1.1111 +++ doc/autoconf.texi 28 Nov 2006 03:28:51 -0000 @@ -4782,19 +4782,6 @@ New programs need not use these macros. @end defmac -@defmac AC_FUNC_SETVBUF_REVERSED -@acindex{FUNC_SETVBUF_REVERSED} -@cvindex SETVBUF_REVERSED -@c @fuindex setvbuf -@prindex @code{setvbuf} -If @code{setvbuf} takes the buffering type as its second argument and -the buffer pointer as the third, instead of the other way around, define -@code{SETVBUF_REVERSED}. - -This macro is obsolescent, as no current systems have the bug. -New programs need not use this macro. -@end defmac - @defmac AC_FUNC_STRCOLL @acindex{FUNC_STRCOLL} @cvindex HAVE_STRCOLL @@ -16607,6 +16594,19 @@ @code{AC_CHECK_FUNC} @end defmac +@defmac AC_FUNC_SETVBUF_REVERSED +@acindex{FUNC_SETVBUF_REVERSED} +@cvindex SETVBUF_REVERSED +@c @fuindex setvbuf +@prindex @code{setvbuf} +Do nothing. Formerly, this macro checked whether @code{setvbuf} takes +the buffering type as its second argument and the buffer pointer as the +third, instead of the other way around, and defined +@code{SETVBUF_REVERSED}. However, the last systems to have the problem +were those based on SVR2, which became obsolete in 1987, and the macro +is no longer needed. +@end defmac + @defmac AC_FUNC_WAIT3 @acindex{FUNC_WAIT3} @cvindex HAVE_WAIT3 Index: lib/autoconf/functions.m4 =================================================================== RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/functions.m4,v retrieving revision 1.115 diff -u -r1.115 functions.m4 --- lib/autoconf/functions.m4 28 Nov 2006 00:26:45 -0000 1.115 +++ lib/autoconf/functions.m4 28 Nov 2006 03:28:51 -0000 @@ -1670,48 +1670,9 @@ # AC_FUNC_SETVBUF_REVERSED # ------------------------ AC_DEFUN([AC_FUNC_SETVBUF_REVERSED], -[AC_REQUIRE([AC_C_PROTOTYPES])dnl -AC_CACHE_CHECK(whether setvbuf arguments are reversed, - ac_cv_func_setvbuf_reversed, - [ac_cv_func_setvbuf_reversed=no - AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [[#include <stdio.h> -# ifdef PROTOTYPES - int (setvbuf) (FILE *, int, char *, size_t); -# endif]], - [[char buf; return setvbuf (stdout, _IOLBF, &buf, 1);]])], - [AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [[#include <stdio.h> -# ifdef PROTOTYPES - int (setvbuf) (FILE *, int, char *, size_t); -# endif]], - [[char buf; return setvbuf (stdout, &buf, _IOLBF, 1);]])], - [# It compiles and links either way, so it must not be declared - # with a prototype and most likely this is a K&R C compiler. - # Try running it. - AC_RUN_IFELSE( - [AC_LANG_PROGRAM( - [AC_INCLUDES_DEFAULT], - [[/* This call has the arguments reversed. - A reversed system may check and see that the address of buf - is not _IOLBF, _IONBF, or _IOFBF, and return nonzero. */ - char buf; - if (setvbuf (stdout, _IOLBF, &buf, 1) != 0) - return 1; - putchar ('\r'); - return 0; /* Non-reversed systems SEGV here. */]])], - [ac_cv_func_setvbuf_reversed=yes], - [], - [[: # Assume setvbuf is not reversed when cross-compiling.]])] - ac_cv_func_setvbuf_reversed=yes)])]) -if test $ac_cv_func_setvbuf_reversed = yes; then - AC_DEFINE(SETVBUF_REVERSED, 1, - [Define to 1 if the `setvbuf' function takes the buffering type as - its second argument and the buffer pointer as the third, as on - System V before release 3.]) -fi +[AC_DIAGNOSE([obsolete], +[The macro `$0' is obsolete. Remove it and all references to SETVBUF_REVERSED.])dnl +AC_CACHE_VAL([ac_cv_func_setvbuf_reversed], [ac_cv_func_setvbuf_reversed=no]) ])# AC_FUNC_SETVBUF_REVERSED _______________________________________________ Autoconf mailing list Autoconf@xxxxxxx http://lists.gnu.org/mailman/listinfo/autoconf