Message-ID: <35A33C50.99A06D38@catalysis.nsk.su> Date: Wed, 08 Jul 1998 15:30:56 +0600 From: Alexey Yakovlev Organization: Inst. of Catalysis MIME-Version: 1.0 To: Andris Pavenis CC: djgpp AT delorie DOT com, Craig Burley Subject: Re: Inconsistencies between g77 v0.5.23 and v0.5.19 References: Content-Type: text/plain; charset=koi8-r Content-Transfer-Encoding: 7bit Precedence: bulk On Mon, 6 Jul 1998, Alexey Yakovlev wrote: > Hi all. > The I/O library in libg2c of g77 v0.5.23 was compiled incorrectly. > It opens an "unformatted" file as text which causes CR->CRLF conversion > on output. The runtime library of g77 under DJGPP has to be compiled > with NON_ANSI_RW_MODES undefined. Perhaps, one has to rebuild g77-0.5.23 > for DJGPP or, at least, libg2c.a. > Hi! There is one more point here. The libc's tmpfile() function opens a temporary file in the default O_TEXT mode. The function is called when a Fortran's scratch file is opened in any mode (FORMATTED or UNFORMATTED, SEQUENTIAL or DIRECT) and this leads to the same problem. The solution could be either to set _fmode variable to O_BINARY in f_open() or to compile libg2c with -DNON_ANSI_STDIO flag. I tested them both and either works for me. Perhaps the later is better because it doesn't involve code changes. My question is how to make configure script to add -DNON_ANSI_STDIO to definitions for DJGPP. As to the NON_ANSI_RW_MODES case, it can be handled in configure.in in the way as it is done for cygwin. With best regards. Alexey Yakovlev Here I include the patch for gcc-2.81/f/runtime/configure.in to fix the NON_ANSI_RW_MODES. However it doesn't fix the 'SCRATCH' bug. --- configure.in Sat Apr 25 16:22:18 1998 +++ configure_dj.in Tue Jul 7 12:35:46 1998 @@ -123,6 +123,18 @@ g77_cv_sys_mingw32=no)) AC_MSG_RESULT($g77_cv_sys_mingw32) +# ditto for djgpp. +AC_MSG_CHECKING([for djgpp]) +AC_CACHE_VAL(g77_cv_sys_djgpp, + AC_EGREP_CPP(yes, + [#ifdef __GO32__ + yes +#endif +], + g77_cv_sys_djgpp=yes, + g77_cv_sys_djgpp=no)) +AC_MSG_RESULT($g77_cv_sys_djgpp) + AC_CHECK_HEADER(fcntl.h, test $g77_cv_header_posix = yes && AC_DEFINE(_POSIX_SOURCE), @@ -222,7 +234,9 @@ yes #endif ], is_unix=yes, is_unix=no) -if test $g77_cv_sys_cygwin32 = yes || test $g77_cv_sys_mingw32 = yes; then +if test $g77_cv_sys_cygwin32 = yes \ + || test $g77_cv_sys_djgpp = yes \ + || test $g77_cv_sys_mingw32 = yes; then AC_MSG_RESULT(no) else if test $is_unix = yes; then