diff options
Diffstat (limited to 'contrib/libf2c/libI77')
29 files changed, 557 insertions, 138 deletions
diff --git a/contrib/libf2c/libI77/Makefile.in b/contrib/libf2c/libI77/Makefile.in index 1ff6b60..544f24e 100644 --- a/contrib/libf2c/libI77/Makefile.in +++ b/contrib/libf2c/libI77/Makefile.in @@ -1,7 +1,7 @@ # Makefile for GNU F77 compiler runtime. # Copyright 1990 - 1994 by AT&T Bell Laboratories and Bellcore (see the # file `Notice'). -# Portions of this file Copyright (C) 1995, 1996, 1998 Free Software Foundation, Inc. +# Portions of this file Copyright (C) 1995, 1996, 1998, 2001 Free Software Foundation, Inc. # Contributed by Dave Love (d.love@dl.ac.uk). # #This file is part of GNU Fortran. @@ -81,6 +81,18 @@ ${srcdir}/configure: configure.in rm -f config.cache cd ${srcdir} && autoconf +# autoheader might not change config.h.in, so touch a stamp file. +${srcdir}/config.h.in: stamp-h.in; @true +${srcdir}/stamp-h.in: configure.in + (cd ${srcdir} && autoheader) + @rm -f ${srcdir}/stamp-h.in + echo timestamp > ${srcdir}/stamp-h.in + +config.h: stamp-h; @true +stamp-h: config.h.in config.status + CONFIG_FILES= CONFIG_HEADERS=config.h $(SHELL) config.status + echo timestamp > stamp-h + VersionI.o: Version.c $(CC) -c $(ALL_CFLAGS) -o $@ $(srcdir)/Version.c @@ -90,7 +102,7 @@ dfe.o: fio.h dfe.o: dfe.c fmt.h dolio.o: dolio.c due.o: due.c fio.h -endfile.o: endfile.c fio.h rawio.h +endfile.o: endfile.c fio.h rawio.h config.h err.o: err.c fio.h rawio.h fmt.o: fio.h fmt.o: fmt.c fmt.h diff --git a/contrib/libf2c/libI77/Version.c b/contrib/libf2c/libI77/Version.c index 64b31bc..0ff447f 100644 --- a/contrib/libf2c/libI77/Version.c +++ b/contrib/libf2c/libI77/Version.c @@ -1,9 +1,9 @@ -static char junk[] = "\n@(#) LIBI77 VERSION pjw,dmg-mods 19991115\n"; +static char junk[] = "\n@(#) LIBI77 VERSION pjw,dmg-mods 20001205\n"; /* */ -char __G77_LIBI77_VERSION__[] = "0.5.26 20000711 (prerelease)"; +char __G77_LIBI77_VERSION__[] = "0.5.26 20011023 (release)"; /* 2.01 $ format added @@ -314,6 +314,15 @@ wrtfmt.c: /* Compiling libf2c with -DALWAYS_FLUSH should prevent losing */ /* any data in buffers should the program fault. It also */ /* makes the program run more slowly. */ +/* 20 April 2000: rsne.c, xwsne.c: tweaks that only matter if ftnint and */ +/* ftnlen are of different fundamental types (different numbers */ +/* of bits). Since these files will not compile when this */ +/* change matters, the above VERSION string remains unchanged. */ +/* 4 July 2000: adjustments to permit compilation by C++ compilers; */ +/* VERSION string remains unchanged. NOT APPLIED FOR G77 */ +/* 5 Dec. 2000: lread.c: under namelist input, when reading a logical array, */ +/* treat Tstuff= and Fstuff= as new assignments rather than as */ +/* logical constants. */ diff --git a/contrib/libf2c/libI77/backspace.c b/contrib/libf2c/libI77/backspace.c index 1968801..b2bd416 100644 --- a/contrib/libf2c/libI77/backspace.c +++ b/contrib/libf2c/libI77/backspace.c @@ -1,3 +1,4 @@ +#include "config.h" #include <sys/types.h> #include "f2c.h" #include "fio.h" diff --git a/contrib/libf2c/libI77/close.c b/contrib/libf2c/libI77/close.c index bbc5bac..79a3493 100644 --- a/contrib/libf2c/libI77/close.c +++ b/contrib/libf2c/libI77/close.c @@ -1,3 +1,4 @@ +#include "config.h" #include "f2c.h" #include "fio.h" #ifdef KR_headers diff --git a/contrib/libf2c/libI77/config.h.in b/contrib/libf2c/libI77/config.h.in new file mode 100644 index 0000000..58f83af --- /dev/null +++ b/contrib/libf2c/libI77/config.h.in @@ -0,0 +1,47 @@ +/* config.h.in. Generated automatically from configure.in by autoheader. */ + +/* Define to empty if the keyword does not work. */ +#undef const + +/* Define to `long' if <sys/types.h> doesn't define. */ +#undef off_t + +/* Define if you need to in order for stat and other things to work. */ +#undef _POSIX_SOURCE + +/* Define to `unsigned' if <sys/types.h> doesn't define. */ +#undef size_t + +/* Define if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define if you have the ftruncate function. */ +#undef HAVE_FTRUNCATE + +/* Define if you have the mkstemp function. */ +#undef HAVE_MKSTEMP + +/* Define if you have the tempnam function. */ +#undef HAVE_TEMPNAM + +/* Define if fcntl.h is missing. */ +#undef NO_FCNTL + +/* Define if fcntl.h is missing. */ +#undef OPEN_DECL + +/* Define if we do not have Unix Stdio. */ +#undef NON_UNIX_STDIO + +/* Define if we use strlen. */ +#undef USE_STRLEN + +/* Define if we have non ANSI RW modes. */ +#undef NON_ANSI_RW_MODES + +/* Always defined. */ +#undef NO_EOF_CHAR_CHECK + +/* Define to skip f2c undefs. */ +#undef Skip_f2c_Undefs + diff --git a/contrib/libf2c/libI77/configure b/contrib/libf2c/libI77/configure index 69868c5..ec7988e8 100755 --- a/contrib/libf2c/libI77/configure +++ b/contrib/libf2c/libI77/configure @@ -522,12 +522,16 @@ fi + + + + # For g77 we'll set CC to point at the built gcc, but this will get it into # the makefiles # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:531: checking for $ac_word" >&5 +echo "configure:535: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -557,7 +561,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:561: checking for $ac_word" >&5 +echo "configure:565: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -608,7 +612,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:612: checking for $ac_word" >&5 +echo "configure:616: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -639,55 +643,9 @@ fi test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } fi -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:644: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 - -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -cat > conftest.$ac_ext << EOF - -#line 655 "configure" -#include "confdefs.h" - -main(){return(0);} -EOF -if { (eval echo configure:660: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - ac_cv_prog_cc_works=yes - # If we can't run a trivial program, we are probably using a cross compiler. - if (./conftest; exit) 2>/dev/null; then - ac_cv_prog_cc_cross=no - else - ac_cv_prog_cc_cross=yes - fi -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - ac_cv_prog_cc_works=no -fi -rm -fr conftest* -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 -if test $ac_cv_prog_cc_works = no; then - { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } -fi -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:686: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 -echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 -cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:691: checking whether we are using GNU C" >&5 +echo "configure:649: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -696,7 +654,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:700: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:658: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -715,7 +673,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:719: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:677: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -750,7 +708,7 @@ fi test "$AR" || AR=ar echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:754: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:712: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -780,7 +738,7 @@ fi # Sanity check for the cross-compilation case: echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:784: checking how to run the C preprocessor" >&5 +echo "configure:742: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -795,13 +753,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext <<EOF -#line 799 "configure" +#line 757 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:805: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:763: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -812,13 +770,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext <<EOF -#line 816 "configure" +#line 774 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:822: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:780: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -829,13 +787,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext <<EOF -#line 833 "configure" +#line 791 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:839: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:797: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -861,17 +819,17 @@ echo "$ac_t""$CPP" 1>&6 ac_safe=`echo "stdio.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for stdio.h""... $ac_c" 1>&6 -echo "configure:865: checking for stdio.h" >&5 +echo "configure:823: checking for stdio.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 870 "configure" +#line 828 "configure" #include "confdefs.h" #include <stdio.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:875: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:833: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -899,12 +857,12 @@ fi echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:903: checking for ANSI C header files" >&5 +echo "configure:861: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 908 "configure" +#line 866 "configure" #include "confdefs.h" #include <stdlib.h> #include <stdarg.h> @@ -912,7 +870,7 @@ else #include <float.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:916: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:874: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -929,7 +887,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 933 "configure" +#line 891 "configure" #include "confdefs.h" #include <string.h> EOF @@ -947,7 +905,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 951 "configure" +#line 909 "configure" #include "confdefs.h" #include <stdlib.h> EOF @@ -968,7 +926,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext <<EOF -#line 972 "configure" +#line 930 "configure" #include "confdefs.h" #include <ctype.h> #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -979,7 +937,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:983: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:941: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -1004,12 +962,12 @@ fi echo $ac_n "checking for posix""... $ac_c" 1>&6 -echo "configure:1008: checking for posix" >&5 +echo "configure:966: checking for posix" >&5 if eval "test \"`echo '$''{'g77_cv_header_posix'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1013 "configure" +#line 971 "configure" #include "confdefs.h" #include <sys/types.h> #include <unistd.h> @@ -1035,12 +993,12 @@ echo "$ac_t""$g77_cv_header_posix" 1>&6 # We can rely on the GNU library being posix-ish. I guess checking the # header isn't actually like checking the functions, though... echo $ac_n "checking for GNU library""... $ac_c" 1>&6 -echo "configure:1039: checking for GNU library" >&5 +echo "configure:997: checking for GNU library" >&5 if eval "test \"`echo '$''{'g77_cv_lib_gnu'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1044 "configure" +#line 1002 "configure" #include "confdefs.h" #include <stdio.h> #ifdef __GNU_LIBRARY__ @@ -1064,12 +1022,12 @@ echo "$ac_t""$g77_cv_lib_gnu" 1>&6 # Apparently cygwin needs to be special-cased. echo $ac_n "checking for cyg\`win'32""... $ac_c" 1>&6 -echo "configure:1068: checking for cyg\`win'32" >&5 +echo "configure:1026: checking for cyg\`win'32" >&5 if eval "test \"`echo '$''{'g77_cv_sys_cygwin32'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1073 "configure" +#line 1031 "configure" #include "confdefs.h" #ifdef __CYGWIN32__ yes @@ -1092,12 +1050,12 @@ echo "$ac_t""$g77_cv_sys_cygwin32" 1>&6 # ditto for mingw32. echo $ac_n "checking for mingw32""... $ac_c" 1>&6 -echo "configure:1096: checking for mingw32" >&5 +echo "configure:1054: checking for mingw32" >&5 if eval "test \"`echo '$''{'g77_cv_sys_mingw32'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1101 "configure" +#line 1059 "configure" #include "confdefs.h" #ifdef __MINGW32__ yes @@ -1121,17 +1079,17 @@ echo "$ac_t""$g77_cv_sys_mingw32" 1>&6 ac_safe=`echo "fcntl.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for fcntl.h""... $ac_c" 1>&6 -echo "configure:1125: checking for fcntl.h" >&5 +echo "configure:1083: checking for fcntl.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1130 "configure" +#line 1088 "configure" #include "confdefs.h" #include <fcntl.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1135: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1093: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1156,7 +1114,8 @@ else cat >> confdefs.h <<\EOF #define NO_FCNTL 1 EOF - cat >> confdefs.h <<\EOF + + cat >> confdefs.h <<\EOF #define OPEN_DECL 1 EOF @@ -1164,12 +1123,12 @@ fi echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:1168: checking for working const" >&5 +echo "configure:1127: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1173 "configure" +#line 1132 "configure" #include "confdefs.h" int main() { @@ -1218,7 +1177,7 @@ ccp = (char const *const *) p; ; return 0; } EOF -if { (eval echo configure:1222: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1181: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -1239,12 +1198,12 @@ EOF fi echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:1243: checking for size_t" >&5 +echo "configure:1202: checking for size_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1248 "configure" +#line 1207 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -1277,12 +1236,12 @@ fi # Apparently positive result on cygwin loses re. NON_UNIX_STDIO # (as of cygwin b18). Likewise on mingw. echo $ac_n "checking for fstat""... $ac_c" 1>&6 -echo "configure:1281: checking for fstat" >&5 +echo "configure:1240: checking for fstat" >&5 if eval "test \"`echo '$''{'ac_cv_func_fstat'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1286 "configure" +#line 1245 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char fstat(); below. */ @@ -1305,7 +1264,7 @@ fstat(); ; return 0; } EOF -if { (eval echo configure:1309: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1268: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_fstat=yes" else @@ -1325,7 +1284,7 @@ else fi echo $ac_n "checking need for NON_UNIX_STDIO""... $ac_c" 1>&6 -echo "configure:1329: checking need for NON_UNIX_STDIO" >&5 +echo "configure:1288: checking need for NON_UNIX_STDIO" >&5 if test $g77_cv_sys_cygwin32 = yes \ || test $g77_cv_sys_mingw32 = yes \ || test $ac_cv_func_fstat = no; then @@ -1338,15 +1297,125 @@ else echo "$ac_t""no" 1>&6 fi +for ac_func in ftruncate +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:1304: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1309 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:1332: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +for ac_func in mkstemp +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:1359: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1364 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:1387: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + for ac_func in tempnam do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1345: checking for $ac_func" >&5 +echo "configure:1414: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1350 "configure" +#line 1419 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -1369,7 +1438,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:1373: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1442: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1399,19 +1468,19 @@ done # However, on my sunos4/gcc setup unistd.h leads us wrongly to believe # we're posix-conformant, so always do the test. echo $ac_n "checking for ansi/posix sprintf result""... $ac_c" 1>&6 -echo "configure:1403: checking for ansi/posix sprintf result" >&5 +echo "configure:1472: checking for ansi/posix sprintf result" >&5 if test "$cross_compiling" = yes; then g77_cv_sys_sprintf_ansi=no else cat > conftest.$ac_ext <<EOF -#line 1408 "configure" +#line 1477 "configure" #include "confdefs.h" #include <stdio.h> /* does sprintf return the number of chars transferred? */ main () {char foo[2]; (sprintf(foo, "1") == 1) ? exit(0) : exit(1);} EOF -if { (eval echo configure:1415: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1484: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then g77_cv_sys_sprintf_ansi=yes else @@ -1442,9 +1511,9 @@ fi # define NON_ANSI_RW_MODES on unix (can't hurt) echo $ac_n "checking NON_ANSI_RW_MODES""... $ac_c" 1>&6 -echo "configure:1446: checking NON_ANSI_RW_MODES" >&5 +echo "configure:1515: checking NON_ANSI_RW_MODES" >&5 cat > conftest.$ac_ext <<EOF -#line 1448 "configure" +#line 1517 "configure" #include "confdefs.h" #ifdef unix yes @@ -1488,6 +1557,40 @@ cat >> confdefs.h <<\EOF EOF +echo $ac_n "checking for off_t""... $ac_c" 1>&6 +echo "configure:1562: checking for off_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1567 "configure" +#include "confdefs.h" +#include <sys/types.h> +#if STDC_HEADERS +#include <stdlib.h> +#include <stddef.h> +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "(^|[^a-zA-Z_0-9])off_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_off_t=yes +else + rm -rf conftest* + ac_cv_type_off_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_off_t" 1>&6 +if test $ac_cv_type_off_t = no; then + cat >> confdefs.h <<\EOF +#define off_t long +EOF + +fi + + cat >> confdefs.h <<\EOF #define Skip_f2c_Undefs 1 EOF @@ -1556,19 +1659,7 @@ fi trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 -# Transform confdefs.h into DEFS. -# Protect against shell expansion while executing Makefile rules. -# Protect against Makefile macro expansion. -cat > conftest.defs <<\EOF -s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g -s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g -s%\[%\\&%g -s%\]%\\&%g -s%\$%$$%g -EOF -DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` -rm -f conftest.defs - +DEFS=-DHAVE_CONFIG_H # Without the "./", some shells look in PATH for config.status. : ${CONFIG_STATUS=./config.status} @@ -1605,7 +1696,7 @@ done ac_given_srcdir=$srcdir -trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +trap 'rm -fr `echo "Makefile config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 EOF cat >> $CONFIG_STATUS <<EOF @@ -1736,6 +1827,113 @@ s%@top_srcdir@%$top_srcdir%g fi; done rm -f conftest.s* +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. +# +# ac_d sets the value in "#define NAME VALUE" lines. +ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' +ac_dC='\3' +ac_dD='%g' +# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". +ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='\([ ]\)%\1#\2define\3' +ac_uC=' ' +ac_uD='\4%g' +# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_eB='$%\1#\2define\3' +ac_eC=' ' +ac_eD='%g' + +if test "${CONFIG_HEADERS+set}" != set; then +EOF +cat >> $CONFIG_STATUS <<EOF + CONFIG_HEADERS="config.h" +EOF +cat >> $CONFIG_STATUS <<\EOF +fi +for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + echo creating $ac_file + + rm -f conftest.frag conftest.in conftest.out + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + cat $ac_file_inputs > conftest.in + +EOF + +# Transform confdefs.h into a sed script conftest.vals that substitutes +# the proper values into config.h.in to produce config.h. And first: +# Protect against being on the right side of a sed subst in config.status. +# Protect against being in an unquoted here document in config.status. +rm -f conftest.vals +cat > conftest.hdr <<\EOF +s/[\\&%]/\\&/g +s%[\\$`]%\\&%g +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp +s%ac_d%ac_u%gp +s%ac_u%ac_e%gp +EOF +sed -n -f conftest.hdr confdefs.h > conftest.vals +rm -f conftest.hdr + +# This sed command replaces #undef with comments. This is necessary, for +# example, in the case of _POSIX_SOURCE, which is predefined and required +# on some systems where configure will not decide to define it. +cat >> conftest.vals <<\EOF +s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */% +EOF + +# Break up conftest.vals because some shells have a limit on +# the size of here documents, and old seds have small limits too. + +rm -f conftest.tail +while : +do + ac_lines=`grep -c . conftest.vals` + # grep -c gives empty output for an empty file on some AIX systems. + if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi + # Write a limited-size here document to conftest.frag. + echo ' cat > conftest.frag <<CEOF' >> $CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS + echo 'CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in +' >> $CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail + rm -f conftest.vals + mv conftest.tail conftest.vals +done +rm -f conftest.vals + +cat >> $CONFIG_STATUS <<\EOF + rm -f conftest.frag conftest.h + echo "/* $ac_file. Generated automatically by configure. */" > conftest.h + cat conftest.in >> conftest.h + rm -f conftest.in + if cmp -s $ac_file conftest.h 2>/dev/null; then + echo "$ac_file is unchanged" + rm -f conftest.h + else + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + fi + rm -f $ac_file + mv conftest.h $ac_file + fi +fi; done + EOF cat >> $CONFIG_STATUS <<EOF diff --git a/contrib/libf2c/libI77/configure.in b/contrib/libf2c/libI77/configure.in index 2b34830..20f2628 100644 --- a/contrib/libf2c/libI77/configure.in +++ b/contrib/libf2c/libI77/configure.in @@ -1,5 +1,5 @@ # Process this file with autoconf to produce a configure script. -# Copyright (C) 1995, 1997, 1998 Free Software Foundation, Inc. +# Copyright (C) 1995, 1997, 1998, 2001 Free Software Foundation, Inc. # Contributed by Dave Love (d.love@dl.ac.uk). # #This file is part of GNU Fortran. @@ -21,8 +21,14 @@ AC_PREREQ(2.12.1) AC_INIT(ftell_.c) +AC_CONFIG_HEADER(config.h) dnl Checks for programs. + +dnl FIXME AC_PROG_CC wants CC to be able to link things, but it may +dnl not be able to. +define([AC_PROG_CC_WORKS],[]) + # For g77 we'll set CC to point at the built gcc, but this will get it into # the makefiles AC_PROG_CC @@ -107,7 +113,8 @@ AC_MSG_RESULT($g77_cv_sys_mingw32) AC_CHECK_HEADER(fcntl.h, test $g77_cv_header_posix = yes && AC_DEFINE(_POSIX_SOURCE), - AC_DEFINE(NO_FCNTL) AC_DEFINE(OPEN_DECL)) + AC_DEFINE(NO_FCNTL, 1, [Define if fcntl.h is missing.]) + AC_DEFINE(OPEN_DECL, 1, [Define if fcntl.h is missing.])) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST @@ -124,11 +131,13 @@ if test $g77_cv_sys_cygwin32 = yes \ || test $g77_cv_sys_mingw32 = yes \ || test $ac_cv_func_fstat = no; then AC_MSG_RESULT(yes) - AC_DEFINE(NON_UNIX_STDIO) + AC_DEFINE(NON_UNIX_STDIO, 1, [Define if we do not have Unix Stdio.]) else AC_MSG_RESULT(no) fi +AC_CHECK_FUNCS(ftruncate) +AC_CHECK_FUNCS(mkstemp) AC_CHECK_FUNCS(tempnam) # posix will guarantee the right behaviour for sprintf, else we can't be @@ -155,7 +164,7 @@ AC_MSG_RESULT($g77_cv_sys_sprintf_ansi) # The cygwin patch takes steps to avoid defining USE_STRLEN here -- I don't # understand why. if test $g77_cv_sys_sprintf_ansi != yes; then - AC_DEFINE(USE_STRLEN) + AC_DEFINE(USE_STRLEN, 1, [Define if we use strlen.]) fi # define NON_ANSI_RW_MODES on unix (can't hurt) @@ -176,7 +185,7 @@ if test $g77_cv_sys_cygwin32 = yes || test $g77_cv_sys_mingw32 = yes; then AC_MSG_RESULT(no) else if test $is_unix = yes; then - AC_DEFINE(NON_ANSI_RW_MODES) + AC_DEFINE(NON_ANSI_RW_MODES, 1, [Define if we have non ANSI RW modes.]) AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) @@ -184,9 +193,11 @@ else fi # This EOF_CHAR is a misfeature on unix. -AC_DEFINE(NO_EOF_CHAR_CHECK) +AC_DEFINE(NO_EOF_CHAR_CHECK, 1, [Always defined.]) + +AC_TYPE_OFF_T -AC_DEFINE(Skip_f2c_Undefs) +AC_DEFINE(Skip_f2c_Undefs, 1, [Define to skip f2c undefs.]) AC_OUTPUT(Makefile) diff --git a/contrib/libf2c/libI77/dfe.c b/contrib/libf2c/libI77/dfe.c index f639ab5..e90b16d 100644 --- a/contrib/libf2c/libI77/dfe.c +++ b/contrib/libf2c/libI77/dfe.c @@ -1,3 +1,4 @@ +#include "config.h" #include "f2c.h" #include "fio.h" #include "fmt.h" diff --git a/contrib/libf2c/libI77/dolio.c b/contrib/libf2c/libI77/dolio.c index 4b5a2ca..1e0c377 100644 --- a/contrib/libf2c/libI77/dolio.c +++ b/contrib/libf2c/libI77/dolio.c @@ -1,3 +1,4 @@ +#include "config.h" #include "f2c.h" #ifdef __cplusplus diff --git a/contrib/libf2c/libI77/due.c b/contrib/libf2c/libI77/due.c index cb80a39..df34133 100644 --- a/contrib/libf2c/libI77/due.c +++ b/contrib/libf2c/libI77/due.c @@ -1,3 +1,4 @@ +#include "config.h" #include "f2c.h" #include "fio.h" diff --git a/contrib/libf2c/libI77/endfile.c b/contrib/libf2c/libI77/endfile.c index f7a78e1..980c91d 100644 --- a/contrib/libf2c/libI77/endfile.c +++ b/contrib/libf2c/libI77/endfile.c @@ -1,6 +1,10 @@ +#include "config.h" #include "f2c.h" #include "fio.h" +#include <sys/types.h> +#include <unistd.h> + #ifdef KR_headers extern char *strcpy(); extern FILE *tmpfile(); @@ -38,6 +42,7 @@ integer f_end(alist *a) return(b->useek ? t_runc(a) : 0); } +#ifndef HAVE_FTRUNCATE static int #ifdef KR_headers copy(from, len, to) FILE *from, *to; register long len; @@ -56,6 +61,7 @@ copy(FILE *from, register long len, FILE *to) } return 0; } +#endif /* !defined(HAVE_FTRUNCATE) */ int #ifdef KR_headers @@ -66,8 +72,11 @@ t_runc(alist *a) { long loc, len; unit *b; - FILE *bf, *tf; - int rc = 0; + int rc; + FILE *bf; +#ifndef HAVE_FTRUNCATE + FILE *tf; +#endif /* !defined(HAVE_FTRUNCATE) */ b = &f__units[a->aunit]; if(b->url) @@ -77,6 +86,8 @@ t_runc(alist *a) len=ftell(bf); if (loc >= len || b->useek == 0 || b->ufnm == NULL) return(0); +#ifndef HAVE_FTRUNCATE + rc = 0; fclose(b->ufd); if (!loc) { if (!(bf = fopen(b->ufnm, f__w_mode[b->ufmt]))) @@ -118,6 +129,10 @@ done1: fclose(tf); done: f__cf = b->ufd = bf; +#else /* !defined(HAVE_FTRUNCATE) */ + fflush(b->ufd); + rc = ftruncate(fileno(b->ufd), (off_t)loc); +#endif /* !defined(HAVE_FTRUNCATE) */ if (rc) err(a->aerr,111,"endfile"); return 0; diff --git a/contrib/libf2c/libI77/err.c b/contrib/libf2c/libI77/err.c index e7ac23a..6784cdd 100644 --- a/contrib/libf2c/libI77/err.c +++ b/contrib/libf2c/libI77/err.c @@ -1,3 +1,4 @@ +#include "config.h" #ifndef NON_UNIX_STDIO #define _INCLUDE_POSIX_SOURCE /* for HP-UX */ #define _INCLUDE_XOPEN_SOURCE /* for HP-UX */ diff --git a/contrib/libf2c/libI77/fmt.c b/contrib/libf2c/libI77/fmt.c index 8f08952..793dceb 100644 --- a/contrib/libf2c/libI77/fmt.c +++ b/contrib/libf2c/libI77/fmt.c @@ -1,3 +1,4 @@ +#include "config.h" #include "f2c.h" #include "fio.h" #include "fmt.h" diff --git a/contrib/libf2c/libI77/fmtlib.c b/contrib/libf2c/libI77/fmtlib.c index 91483fc..69c0d9b 100644 --- a/contrib/libf2c/libI77/fmtlib.c +++ b/contrib/libf2c/libI77/fmtlib.c @@ -1,5 +1,6 @@ /* @(#)fmtlib.c 1.2 */ #define MAXINTLENGTH 23 +#include "config.h" #include "f2c.h" #ifndef Allow_TYQUAD diff --git a/contrib/libf2c/libI77/ftell_.c b/contrib/libf2c/libI77/ftell_.c index 1bd03be..1f6d87f 100644 --- a/contrib/libf2c/libI77/ftell_.c +++ b/contrib/libf2c/libI77/ftell_.c @@ -1,3 +1,4 @@ +#include "config.h" #include "f2c.h" #include "fio.h" diff --git a/contrib/libf2c/libI77/ilnw.c b/contrib/libf2c/libI77/ilnw.c index abc6409..58fca0d 100644 --- a/contrib/libf2c/libI77/ilnw.c +++ b/contrib/libf2c/libI77/ilnw.c @@ -1,3 +1,4 @@ +#include "config.h" #include "f2c.h" #include "fio.h" #include "lio.h" diff --git a/contrib/libf2c/libI77/inquire.c b/contrib/libf2c/libI77/inquire.c index 963d4c3..71eb700 100644 --- a/contrib/libf2c/libI77/inquire.c +++ b/contrib/libf2c/libI77/inquire.c @@ -1,3 +1,4 @@ +#include "config.h" #include "f2c.h" #include "fio.h" #include <string.h> diff --git a/contrib/libf2c/libI77/lread.c b/contrib/libf2c/libI77/lread.c index 3d40059..d546efc 100644 --- a/contrib/libf2c/libI77/lread.c +++ b/contrib/libf2c/libI77/lread.c @@ -1,3 +1,4 @@ +#include "config.h" #include <ctype.h> #include "f2c.h" #include "fio.h" @@ -339,11 +340,93 @@ l_C(Void) return(0); } + static char nmLbuf[256], *nmL_next; + static int (*nmL_getc_save)(Void); +#ifdef KR_headers + static int (*nmL_ungetc_save)(/* int, FILE* */); +#else + static int (*nmL_ungetc_save)(int, FILE*); +#endif + + static int +nmL_getc(Void) +{ + int rv; + if (rv = *nmL_next++) + return rv; + l_getc = nmL_getc_save; + l_ungetc = nmL_ungetc_save; + return (*l_getc)(); + } + + static int +#ifdef KR_headers +nmL_ungetc(x, f) int x; FILE *f; +#else +nmL_ungetc(int x, FILE *f) +#endif +{ + f = f; /* banish non-use warning */ + return *--nmL_next = x; + } + + static int +#ifdef KR_headers +Lfinish(ch, dot, rvp) int ch, dot, *rvp; +#else +Lfinish(int ch, int dot, int *rvp) +#endif +{ + char *s, *se; + static char what[] = "namelist input"; + + s = nmLbuf + 2; + se = nmLbuf + sizeof(nmLbuf) - 1; + *s++ = ch; + while(!issep(GETC(ch)) && ch!=EOF) { + if (s >= se) { + nmLbuf_ovfl: + return *rvp = err__fl(f__elist->cierr,131,what); + } + *s++ = ch; + if (ch != '=') + continue; + if (dot) + return *rvp = err__fl(f__elist->cierr,112,what); + got_eq: + *s = 0; + nmL_getc_save = l_getc; + l_getc = nmL_getc; + nmL_ungetc_save = l_ungetc; + l_ungetc = nmL_ungetc; + nmLbuf[1] = *(nmL_next = nmLbuf) = ','; + *rvp = f__lcount = 0; + return 1; + } + if (dot) + goto done; + for(;;) { + if (s >= se) + goto nmLbuf_ovfl; + *s++ = ch; + if (!isblnk(ch)) + break; + if (GETC(ch) == EOF) + goto done; + } + if (ch == '=') + goto got_eq; + done: + Ungetc(ch, f__cf); + return 0; + } + static int l_L(Void) { - int ch; - if(f__lcount>0) return(0); + int ch, rv, sawdot; + if(f__lcount>0) + return(0); f__lcount = 1; f__ltype=0; GETC(ch); @@ -357,15 +440,23 @@ l_L(Void) err(f__elist->cierr,(EOF),"lread"); GETC(ch); } - if(ch == '.') GETC(ch); + sawdot = 0; + if(ch == '.') { + sawdot = 1; + GETC(ch); + } switch(ch) { case 't': case 'T': + if (nml_read && Lfinish(ch, sawdot, &rv)) + return rv; f__lx=1; break; case 'f': case 'F': + if (nml_read && Lfinish(ch, sawdot, &rv)) + return rv; f__lx=0; break; default: diff --git a/contrib/libf2c/libI77/open.c b/contrib/libf2c/libI77/open.c index 3e4c8bc..56bbc52 100644 --- a/contrib/libf2c/libI77/open.c +++ b/contrib/libf2c/libI77/open.c @@ -1,6 +1,7 @@ /* Define _XOPEN_SOURCE to get tempnam prototype with glibc et al -- more general than _INCLUDE_XOPEN_SOURCE used elsewhere `for HP-UX'. */ #define _XOPEN_SOURCE 1 +#include "config.h" #include "f2c.h" #include "fio.h" #include <string.h> @@ -133,10 +134,11 @@ integer f_open(olist *a) #endif { unit *b; integer rv; - char buf[256], *s; + char buf[256], *s, *env; cllist x; int ufmt; FILE *tf; + int fd, len; #ifndef NON_UNIX_STDIO int n; #endif @@ -209,6 +211,19 @@ integer f_open(olist *a) case 's': case 'S': b->uscrtch=1; +#ifdef HAVE_MKSTEMP /* Allow use of TMPDIR preferentially. */ + env = getenv("TMPDIR"); + if (!env) env = getenv("TEMP"); + if (!env) env = "/tmp"; + len = strlen(env); + if (len > 256 - sizeof "/tmp.FXXXXXX") + err (a->oerr, 132, "open"); + strcpy(buf, env); + strcat(buf, "/tmp.FXXXXXX"); + fd = mkstemp(buf); + if (fd == -1 || close(fd)) + err (a->oerr, 132, "open"); +#else /* ! defined (HAVE_MKSTEMP) */ #ifdef HAVE_TEMPNAM /* Allow use of TMPDIR preferentially. */ s = tempnam (0, buf); if (strlen (s) >= sizeof (buf)) @@ -223,6 +238,7 @@ integer f_open(olist *a) (void) mktemp(buf); #endif #endif /* ! defined (HAVE_TEMPNAM) */ +#endif /* ! defined (HAVE_MKSTEMP) */ goto replace; case 'n': case 'N': diff --git a/contrib/libf2c/libI77/rdfmt.c b/contrib/libf2c/libI77/rdfmt.c index f2b1211..6ddd369 100644 --- a/contrib/libf2c/libI77/rdfmt.c +++ b/contrib/libf2c/libI77/rdfmt.c @@ -1,3 +1,4 @@ +#include "config.h" #include <ctype.h> #include "f2c.h" #include "fio.h" diff --git a/contrib/libf2c/libI77/rsfe.c b/contrib/libf2c/libI77/rsfe.c index a79cd79..1be4531 100644 --- a/contrib/libf2c/libI77/rsfe.c +++ b/contrib/libf2c/libI77/rsfe.c @@ -1,4 +1,5 @@ /* read sequential formatted external */ +#include "config.h" #include "f2c.h" #include "fio.h" #include "fmt.h" diff --git a/contrib/libf2c/libI77/rsne.c b/contrib/libf2c/libI77/rsne.c index c9d5f10..a0d0bfe 100644 --- a/contrib/libf2c/libI77/rsne.c +++ b/contrib/libf2c/libI77/rsne.c @@ -1,3 +1,4 @@ +#include "config.h" #include "f2c.h" #include "fio.h" #include "lio.h" @@ -302,8 +303,8 @@ x_rsne(cilist *a) Vardesc *v; dimen *dn, *dn0, *dn1; ftnlen *dims, *dims1; - ftnlen b, b0, b1, ex, no, no1, nomax, size, span; - ftnint type; + ftnlen b, b0, b1, ex, no, nomax, size, span; + ftnint no1, type; char *vaddr; long iva, ivae; dimen dimens[MAXDIM], substr; @@ -338,7 +339,7 @@ x_rsne(cilist *a) #endif } have_amp: - if (ch = getname(buf,(int) sizeof(buf))) + if (ch = getname(buf,sizeof(buf))) return ch; nl = (Namelist *)a->cifmt; if (strcmp(buf, nl->name)) @@ -393,7 +394,7 @@ x_rsne(cilist *a) if (ch <= ' ' && ch >= 0 || ch == ',') continue; Ungetc(ch,f__cf); - if (ch = getname(buf,(int) sizeof(buf))) + if (ch = getname(buf,sizeof(buf))) return ch; goto havename; } diff --git a/contrib/libf2c/libI77/stamp-h.in b/contrib/libf2c/libI77/stamp-h.in new file mode 100644 index 0000000..9788f70 --- /dev/null +++ b/contrib/libf2c/libI77/stamp-h.in @@ -0,0 +1 @@ +timestamp diff --git a/contrib/libf2c/libI77/sue.c b/contrib/libf2c/libI77/sue.c index eacb1d6..e7dbba0 100644 --- a/contrib/libf2c/libI77/sue.c +++ b/contrib/libf2c/libI77/sue.c @@ -1,3 +1,4 @@ +#include "config.h" #include "f2c.h" #include "fio.h" extern uiolen f__reclen; diff --git a/contrib/libf2c/libI77/typesize.c b/contrib/libf2c/libI77/typesize.c index 1cb20ff..7f42aa1 100644 --- a/contrib/libf2c/libI77/typesize.c +++ b/contrib/libf2c/libI77/typesize.c @@ -1,3 +1,4 @@ +#include "config.h" #include "f2c.h" ftnlen f__typesize[] = { 0, 0, sizeof(shortint), sizeof(integer), diff --git a/contrib/libf2c/libI77/util.c b/contrib/libf2c/libI77/util.c index ccaad2d..8280ac0 100644 --- a/contrib/libf2c/libI77/util.c +++ b/contrib/libf2c/libI77/util.c @@ -1,3 +1,4 @@ +#include "config.h" #ifndef NON_UNIX_STDIO #define _INCLUDE_POSIX_SOURCE /* for HP-UX */ #define _INCLUDE_XOPEN_SOURCE /* for HP-UX */ diff --git a/contrib/libf2c/libI77/wrtfmt.c b/contrib/libf2c/libI77/wrtfmt.c index 477c40f..37006ba 100644 --- a/contrib/libf2c/libI77/wrtfmt.c +++ b/contrib/libf2c/libI77/wrtfmt.c @@ -1,3 +1,4 @@ +#include "config.h" #include "f2c.h" #include "fio.h" #include "fmt.h" diff --git a/contrib/libf2c/libI77/wsle.c b/contrib/libf2c/libI77/wsle.c index f8555d7..386e867 100644 --- a/contrib/libf2c/libI77/wsle.c +++ b/contrib/libf2c/libI77/wsle.c @@ -1,3 +1,4 @@ +#include "config.h" #include "f2c.h" #include "fio.h" #include "fmt.h" diff --git a/contrib/libf2c/libI77/xwsne.c b/contrib/libf2c/libI77/xwsne.c index 71f6f1d..96fdd02 100644 --- a/contrib/libf2c/libI77/xwsne.c +++ b/contrib/libf2c/libI77/xwsne.c @@ -1,3 +1,4 @@ +#include "config.h" #include "f2c.h" #include "fio.h" #include "lio.h" @@ -24,10 +25,9 @@ x_wsne(cilist *a) Namelist *nl; char *s; Vardesc *v, **vd, **vde; - ftnint *number, type; + ftnint number, type; ftnlen *dims; ftnlen size; - static ftnint one = 1; extern ftnlen f__typesize[]; nl = (Namelist *)a->cifmt; @@ -49,7 +49,7 @@ x_wsne(cilist *a) PUT(*s++); PUT(' '); PUT('='); - number = (dims = v->dims) ? dims + 1 : &one; + number = (dims = v->dims) ? dims[1] : 1; type = v->type; if (type < 0) { size = -type; @@ -57,7 +57,7 @@ x_wsne(cilist *a) } else size = f__typesize[type]; - l_write(number, v->addr, size, type); + l_write(&number, v->addr, size, type); if (vd < vde) { if (f__recpos+2 >= L_len) nl_donewrec(); |