Hi Vincent,

For example, a simple script like this in the main configure may be enough (or maybe wrapped into an autoconf macro) :
echo a >file
if test `cat file` != a
then
 echo \`cat\` bug detected.
 echo Please run configure from on a binmode filesystem
 echo or use the igncr trick
 exit 1
fi

At which point the user goes:

 "igncr trick" ?  What "igncr trick" ?

So we would have to be a bit more explicit. How about modifying the configure patch already suggested to perform the cat check instead ? I have attached a patch that should do this, although I have not checked it - would you care to try it out for me ?

Cheers
  Nick


Index: configure.ac
===================================================================
--- configure.ac        (revision 125308)
+++ configure.ac        (working copy)
@@ -965,6 +965,7 @@ case "${host}" in
     host_makefile_frag="config/mh-djgpp"
     ;;
   *-cygwin*)
+    ACX_CHECK_CYGWIN_CAT_WORKS
     host_makefile_frag="config/mh-cygwin"
     ;;
   *-mingw32*)
Index: configure
===================================================================
--- configure   (revision 125308)
+++ configure   (working copy)
@@ -2676,6 +2676,32 @@ case "${host}" in
     host_makefile_frag="config/mh-djgpp"
     ;;
   *-cygwin*)
+
+echo "$as_me:$LINENO: checking to see if cat works as expected" >&5
+echo $ECHO_N "checking to see if cat works as expected... $ECHO_C" >&6
+echo a >cygwin-cat-check
+if test `cat cygwin-cat-check` == a ; then
+  echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+  { { echo "$as_me:$LINENO: error: The cat command does not ignore carriage 
return characters.
+  Please either mount the build directory in binary mode or run the following
+  commands before running any configure script:
+set -o igncr
+export SHELLOPTS
+  " >&5
+echo "$as_me: error: The cat command does not ignore carriage return 
characters.
+  Please either mount the build directory in binary mode or run the following
+  commands before running any configure script:
+set -o igncr
+export SHELLOPTS
+  " >&2;}
+   { (exit 1); exit 1; }; }
+rm cygwin-cat-check
+fi
+
     host_makefile_frag="config/mh-cygwin"
     ;;
   *-mingw32*)
Index: config/acx.m4
===================================================================
--- config/acx.m4       (revision 125308)
+++ config/acx.m4       (working copy)
@@ -597,3 +597,25 @@ AC_DEFUN([ACX_BUGURL],[
   AC_SUBST(REPORT_BUGS_TO)
   AC_SUBST(REPORT_BUGS_TEXI)
 ])
+
+dnl ####
+dnl # ACX_CHECK_CYGWIN_CAT_WORKS
+dnl # On Cygwin hosts, check that the cat command ignores 
+dnl # carriage returns as otherwise builds will not work.
+dnl # See binutils PR 4334 for more details.
+AC_DEFUN([ACX_CHECK_CYGWIN_CAT_WORKS],[
+AC_MSG_CHECKING([to see if cat works as expected])
+echo a >cygwin-cat-check
+if test `cat cygwin-cat-check` == a ; then
+  AC_MSG_RESULT(yes)
+else
+  AC_MSG_RESULT(no)
+  AC_MSG_ERROR([The cat command does not ignore carriage return characters.
+  Please either mount the build directory in binary mode or run the following
+  commands before running any configure script:
+set -o igncr
+export SHELLOPTS 
+  ])
+rm cygwin-cat-check
+fi
+])
_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to