Re: RFC: Adding a check to the top level configure script for a binary-mounted cygwin-hosted build directory

Nick Clifton
2007-05-24T09:47:39Z

[-- Attachment #1: Type: text/plain, Size: 571 bytes --]

Hi Paolo, Hi Alex,

> I haven't looked at the patch yet, but as an aside, I think this should
> also go into the main autoconf distribution; there is no reason why
> somebody should build under a text-mode mounted directory.

I agree, I think it would be very good to have this check available in
the main autoconf sources.

I am attaching an updated patch which fixes a couple of problems
uncovered in the first version:

* I was not escaping the square brackets in the awk script.
* The check for the "binmode" string needed to be stricter.

Cheers
Nick

[-- Attachment #2: pr4334.patch.2 --]
[-- Type: text/plain, Size: 1690 bytes --]

Index: configure.ac
===================================================================
RCS file: /cvs/src/src/configure.ac,v
retrieving revision 1.10
diff -c -3 -p -r1.10 configure.ac
*** configure.ac 21 Mar 2007 20:11:06 -0000 1.10
--- configure.ac 24 May 2007 09:45:14 -0000
*************** case "${host}" in
*** 965,970 ****
--- 965,971 ----
host_makefile_frag="config/mh-djgpp"
;;
*-cygwin*)
+ ACX_CHECK_CYGWIN_BINMOUNTED_BUILDDIR
host_makefile_frag="config/mh-cygwin"
;;
*-mingw32*)
Index: config/acx.m4
===================================================================
RCS file: /cvs/src/src/config/acx.m4,v
retrieving revision 1.25
diff -c -3 -p -r1.25 acx.m4
*** config/acx.m4 26 Mar 2007 15:38:25 -0000 1.25
--- config/acx.m4 24 May 2007 09:45:14 -0000
*************** AC_DEFUN([ACX_BUGURL],[
*** 597,599 ****
--- 597,618 ----
AC_SUBST(REPORT_BUGS_TO)
AC_SUBST(REPORT_BUGS_TEXI)
])
+
+ dnl ####
+ dnl # ACX_CHECK_CYGWIN_BINMOUNTED_BUILDDIR
+ dnl # On Cygwin hosts, check that the build directory is mounted in
+ dnl # binmode as builds will not work if it is mounted in textmode.
+ dnl # See binutils PR 4334 for more details about why textmode is a problem.
+ AC_DEFUN([ACX_CHECK_CYGWIN_BINMOUNTED_BUILDDIR],[
+ AC_MSG_CHECKING([build directory to see if it is mounted in binmode])
+ build_dir=`pwd`
+ build_dir_mount_point=`df ${build_dir} | awk '/[[0-9]]%/{print $NF;}'`
+ is_binmode=`mount | grep "${build_dir_mount_point} " | grep binmode`
+ if test $? == 0 ; then
+ AC_MSG_RESULT(yes)
+ else
+ AC_MSG_RESULT(no)
+ AC_MSG_ERROR([The build directory is not mounted in binmode])
+ fi
+ ])
+
\ No newline at end of file