autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem with cl and autoconf


From: Paul Eggert
Subject: Re: Problem with cl and autoconf
Date: Fri, 11 Feb 2005 11:14:46 -0800
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.4 (gnu/linux)

Alexandre Duret-Lutz <address@hidden> writes:

> I wonder if it wouldn't make sense to have
>   exec </dev/null
> right in the initialization of configure.

Now why didn't I think of that?  Thanks; that simplifies the code as well.
I installed this:

2005-02-11  Paul Eggert  <address@hidden>

        * lib/autoconf/general.m4 (_AC_INIT_DEFAULTS): Redirect stdin
        from /dev/null, as "configure" shouldn't read stdin, and this
        insulates us from problems (e.g., when testing for "cl").
        Suggested by Alexandre Duret-Lutz.  Also, do this redirection
        before invoking "hostname" or "uname".
        (_AC_PREPROC_IFELSE, _AC_COMPILE_IFELSE,
        _AC_LINK_IFELSE): Undo previous change, as it's no longer needed.
        * lib/autoconf/c.m4 (AC_PROG_CC, AC_PROG_CXX): Don't bother with
        "</dev/null" since it's now done at the top of 'configure'.
        * lib/autoconf/fortran.m4 (_AC_PROG_FC): Likewise.
        * lib/autoconf/programs.m4 (_AC_PATH_PROG_FLAVOR_GNU): Likewise.
        Also, replace grep with shell pattern-matching, to save a process.

Index: lib/autoconf/c.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/c.m4,v
retrieving revision 1.194
diff -p -u -r1.194 c.m4
--- lib/autoconf/c.m4   5 Feb 2005 07:04:08 -0000       1.194
+++ lib/autoconf/c.m4   11 Feb 2005 18:51:00 -0000
@@ -476,9 +476,9 @@ test -z "$CC" && AC_MSG_FAILURE([no acce
 echo "$as_me:$LINENO:" \
      "checking for _AC_LANG compiler version" >&AS_MESSAGE_LOG_FD
 ac_compiler=`set X $ac_compile; echo $[2]`
-_AC_EVAL([$ac_compiler --version </dev/null >&AS_MESSAGE_LOG_FD])
-_AC_EVAL([$ac_compiler -v </dev/null >&AS_MESSAGE_LOG_FD])
-_AC_EVAL([$ac_compiler -V </dev/null >&AS_MESSAGE_LOG_FD])
+_AC_EVAL([$ac_compiler --version >&AS_MESSAGE_LOG_FD])
+_AC_EVAL([$ac_compiler -v >&AS_MESSAGE_LOG_FD])
+_AC_EVAL([$ac_compiler -V >&AS_MESSAGE_LOG_FD])
 
 m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl
 m4_expand_once([_AC_COMPILER_OBJEXT])[]dnl
@@ -705,9 +705,9 @@ AC_CHECK_TOOLS(CXX,
 echo "$as_me:$LINENO:" \
      "checking for _AC_LANG compiler version" >&AS_MESSAGE_LOG_FD
 ac_compiler=`set X $ac_compile; echo $[2]`
-_AC_EVAL([$ac_compiler --version </dev/null >&AS_MESSAGE_LOG_FD])
-_AC_EVAL([$ac_compiler -v </dev/null >&AS_MESSAGE_LOG_FD])
-_AC_EVAL([$ac_compiler -V </dev/null >&AS_MESSAGE_LOG_FD])
+_AC_EVAL([$ac_compiler --version >&AS_MESSAGE_LOG_FD])
+_AC_EVAL([$ac_compiler -v >&AS_MESSAGE_LOG_FD])
+_AC_EVAL([$ac_compiler -V >&AS_MESSAGE_LOG_FD])
 
 m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl
 m4_expand_once([_AC_COMPILER_OBJEXT])[]dnl
Index: lib/autoconf/fortran.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/fortran.m4,v
retrieving revision 1.185
diff -p -u -r1.185 fortran.m4
--- lib/autoconf/fortran.m4     5 Feb 2005 05:09:44 -0000       1.185
+++ lib/autoconf/fortran.m4     11 Feb 2005 18:51:01 -0000
@@ -364,9 +364,9 @@ AC_CHECK_TOOLS([]_AC_FC[],
 echo "$as_me:__oline__:" \
      "checking for _AC_LANG compiler version" >&AS_MESSAGE_LOG_FD
 ac_compiler=`set X $ac_compile; echo $[2]`
-_AC_EVAL([$ac_compiler --version </dev/null >&AS_MESSAGE_LOG_FD])
-_AC_EVAL([$ac_compiler -v </dev/null >&AS_MESSAGE_LOG_FD])
-_AC_EVAL([$ac_compiler -V </dev/null >&AS_MESSAGE_LOG_FD])
+_AC_EVAL([$ac_compiler --version >&AS_MESSAGE_LOG_FD])
+_AC_EVAL([$ac_compiler -v >&AS_MESSAGE_LOG_FD])
+_AC_EVAL([$ac_compiler -V >&AS_MESSAGE_LOG_FD])
 rm -f a.out
 
 m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl
Index: lib/autoconf/general.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/general.m4,v
retrieving revision 1.844
diff -p -u -r1.844 general.m4
--- lib/autoconf/general.m4     11 Feb 2005 00:40:31 -0000      1.844
+++ lib/autoconf/general.m4     11 Feb 2005 18:51:01 -0000
@@ -377,13 +377,13 @@ AU_ALIAS([AC_FD_MSG], [AS_MESSAGE_FD])
 m4_define([_AC_INIT_DEFAULTS],
 [m4_divert_push([DEFAULTS])dnl
 
+exec </dev/null AS_MESSAGE_FD>&1
+
 # Name of the host.
 # hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
 # so uname gets run too.
 ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
 
-exec AS_MESSAGE_FD>&1
-
 #
 # Initializations.
 #
@@ -2133,7 +2133,7 @@ AC_DEFUN([AC_RUN_LOG],
 # to expand ac_cpp.
 AC_DEFUN([_AC_PREPROC_IFELSE],
 [m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])dnl
-if _AC_EVAL_STDERR([$ac_cpp conftest.$ac_ext]) </dev/null >/dev/null; then
+if _AC_EVAL_STDERR([$ac_cpp conftest.$ac_ext]) >/dev/null; then
   if test -s conftest.err; then
     ac_cpp_err=$ac_[]_AC_LANG_ABBREV[]_preproc_warn_flag
     ac_cpp_err=$ac_cpp_err$ac_[]_AC_LANG_ABBREV[]_werror_flag
@@ -2218,7 +2218,7 @@ AC_DEFUN([AC_EGREP_HEADER],
 m4_define([_AC_COMPILE_IFELSE],
 [m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])dnl
 rm -f conftest.$ac_objext
-AS_IF([_AC_EVAL_STDERR($ac_compile) </dev/null &&
+AS_IF([_AC_EVAL_STDERR($ac_compile) &&
         AC_TRY_COMMAND([test -z "$ac_[]_AC_LANG_ABBREV[]_werror_flag"
                         || test ! -s conftest.err]) &&
         AC_TRY_COMMAND([test -s conftest.$ac_objext])],
@@ -2259,7 +2259,7 @@ AU_DEFUN([AC_TRY_COMPILE],
 m4_define([_AC_LINK_IFELSE],
 [m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])dnl
 rm -f conftest.$ac_objext conftest$ac_exeext
-AS_IF([_AC_EVAL_STDERR($ac_link) </dev/null &&
+AS_IF([_AC_EVAL_STDERR($ac_link) &&
         AC_TRY_COMMAND([test -z "$ac_[]_AC_LANG_ABBREV[]_werror_flag"
                         || test ! -s conftest.err]) &&
         AC_TRY_COMMAND([test -s conftest$ac_exeext])],
Index: lib/autoconf/programs.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/programs.m4,v
retrieving revision 1.40
diff -p -u -r1.40 programs.m4
--- lib/autoconf/programs.m4    4 Feb 2005 22:21:18 -0000       1.40
+++ lib/autoconf/programs.m4    11 Feb 2005 18:51:01 -0000
@@ -497,12 +497,13 @@ dnl   # for best performing tool in a li
 # ----------------------------------------------------------------
 m4_define([_AC_PATH_PROG_FLAVOR_GNU],
 [# Check for GNU $1
-if "$1" --version 2>&1 < /dev/null | grep 'GNU' >/dev/null; then
-  $2
+case `"$1" --version 2>&1` in
+*GNU*)
+  $2;;
 m4_ifval([$3],
-[else
-  $3
-])fi
+[*)
+  $3;;
+])esac
 ])# _AC_PATH_PROG_FLAVOR_GNU
 
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]