From: Jarkko Hietaniemi <jhi@iki.fi>
Date: Thu, 20 May 1999 07:14:39 +0000 (+0000)
Subject: Patches to fflushing in SunOS 4 from Andy Dougherty
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a71cd7cdf387023b3454db0a31c91c286865db8f;p=p5sagit%2Fp5-mst-13.2.git

Patches to fflushing in SunOS 4 from Andy Dougherty
(via private email).

p4raw-id: //depot/cfgperl@3437
---

diff --git a/Configure b/Configure
index 4a78ff7..eb93907 100755
--- a/Configure
+++ b/Configure
@@ -20,7 +20,7 @@
 
 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
 #
-# Generated on Fri May 14 10:24:50 EET DST 1999 [metaconfig 3.0 PL70]
+# Generated on Thu May 20 10:07:46 EET DST 1999 [metaconfig 3.0 PL70]
 # (with additional metaconfig patches by perlbug@perl.com)
 
 cat >/tmp/c1$$ <<EOF
@@ -10978,7 +10978,10 @@ $cat >try.c <<EOCP
 #include <unistd.h>
 #endif
 #$d_sysconf HAS_SYSCONF
-#$stdio_stream_array
+#$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
+#ifdef HAS_STDIO_STREAM_ARRAY
+# define STDIO_STREAM_ARRAY $stdio_stream_array
+#endif
 int main() {
   FILE* p = fopen("try.out", "w");
 #ifdef TRY_FPUTC
@@ -11050,6 +11053,9 @@ case "$fflushNULL" in
 '') 	set try -DTRY_FFLUSH_NULL $output
 	$rm -f try.out
 	if eval $compile; then
+	        $cat >&4 <<EOM
+(This test may fail, saying "Core dumped" or something equally evil.)
+EOM
 	    	./try$exe_ext 2>/dev/null
 		if $test -s try.out -a "X$?" = X42; then
 			fflushNULL="`$cat try.out`"
@@ -11087,6 +11093,9 @@ case "$fflushall" in
 '') 	set try -DTRY_FFLUSH_ALL $output
 	$rm -f try.out
 	if eval $compile; then
+	        $cat >&4 <<EOM
+(Also this test may fail.)
+EOM
 	    	./try$exe_ext 2>/dev/null
 		if $test -s try.out -a "X$?" = X42; then
 			fflushall="`$cat try.out`"
diff --git a/Porting/Glossary b/Porting/Glossary
index b132560..070027b 100644
--- a/Porting/Glossary
+++ b/Porting/Glossary
@@ -4,11 +4,6 @@ programs (e.g. I_UNISTD) are already described in config_h.SH.  [`configpm'
 generates pod documentation for Config.pm from this file--please try to keep
 the formatting regular.]
 
-Mcc (Loc.U):
-	This variable is be used internally by Configure to determine the
-	full pathname (if any) of the Mcc program.  After Configure runs,
-	the value is reset to a plain "Mcc" and is not useful.
-
 _a (Unix.U):
 	This variable defines the extension used for ordinary libraries.
 	For unix, it is '.a'.  The '.' is included.  Other possible
@@ -280,15 +275,6 @@ csh (Loc.U):
 	full pathname (if any) of the csh program.  After Configure runs,
 	the value is reset to a plain "csh" and is not useful.
 
-d_Gconvert (d_gconvert.U):
-	This variable holds what Gconvert is defined as to convert
-	floating point numbers into strings. It could be 'gconvert'
-	or a more complex macro emulating gconvert with gcvt() or sprintf.
-	Possible values are:
-	d_Gconvert='gconvert((x),(n),(t),(b))'
-	d_Gconvert='gcvt((x),(n),(b))'
-	d_Gconvert='sprintf((b),"%.*g",(n),(x))'
-
 d_access (d_access.U):
 	This variable conditionally defines HAS_ACCESS if the access() system
 	call is available to check for access permissions using real IDs.
@@ -612,6 +598,15 @@ d_ftruncate64 (io64.U):
 	This variable conditionally defines the HAS_FTRUNCATE64 symbol, which
 	indicates to the C program that the ftruncate64() routine is available.
 
+d_Gconvert (d_gconvert.U):
+	This variable holds what Gconvert is defined as to convert
+	floating point numbers into strings. It could be 'gconvert'
+	or a more complex macro emulating gconvert with gcvt() or sprintf.
+	Possible values are:
+	d_Gconvert='gconvert((x),(n),(t),(b))'
+	d_Gconvert='gcvt((x),(n),(b))'
+	d_Gconvert='sprintf((b),"%.*g",(n),(x))'
+
 d_getgrent (d_getgrent.U):
 	This variable conditionally defines the HAS_GETGRENT symbol, which
 	indicates to the C program that the getgrent() routine is available
@@ -862,6 +857,11 @@ d_mbtowc (d_mbtowc.U):
 	indicates to the C program that the mbtowc() routine is available
 	to convert multibyte to a wide character.
 
+d_memchr (d_memchr.U):
+	This variable conditionally defines the HAS_MEMCHR symbol, which
+	indicates to the C program that the memchr() routine is available
+	to locate characters within a C string.
+
 d_memcmp (d_memcmp.U):
 	This variable conditionally defines the HAS_MEMCMP symbol, which
 	indicates to the C program that the memcmp() routine is available
@@ -1356,6 +1356,10 @@ d_stdio_ptr_lval (d_stdstdio.U):
 	This variable conditionally defines STDIO_PTR_LVALUE if the
 	FILE_ptr macro can be used as an lvalue.
 
+d_stdio_stream_array (stdio_streams.U):
+	This variable tells whether there is an array holding
+	the stdio streams.
+
 d_stdiobase (d_stdstdio.U):
 	This variable conditionally defines USE_STDIO_BASE if this system
 	has a FILE structure declaring a usable _base field (or equivalent)
@@ -1651,6 +1655,15 @@ extensions (Extensions.U):
 	and is typically used to test whether a particular extesion 
 	is available.
 
+fflushall (fflushall.U):
+	This symbol, if defined, tells that to flush
+	all pending stdio output one must loop through all
+	the stdio file handles stored in an array and fflush them.
+
+fflushNULL (fflushall.U):
+	This symbol, if defined, tells that fflush(NULL) does flush
+	all pending stdio output.
+
 find (Loc.U):
 	This variable is defined but not used by Configure.
 	The value is a plain '' and is not useful.
@@ -1848,6 +1861,10 @@ i_neterrno (i_neterrno.U):
 	indicates to the C program that <net/errno.h> exists and should
 	be included.
 
+i_netinettcp (i_netinettcp.U):
+	This variable conditionally defines the I_NETINET_TCP symbol,
+	and indicates whether a C program should include <netinet/tcp.h>.
+
 i_niin (i_niin.U):
 	This variable conditionally defines I_NETINET_IN, which indicates
 	to the C program that it should include <netinet/in.h>. Otherwise,
@@ -2302,6 +2319,11 @@ man3ext (man3dir.U):
 	have: one of 'n', 'l', or '3'.  The Makefile must supply the '.'.
 	See man3dir.
 
+Mcc (Loc.U):
+	This variable is be used internally by Configure to determine the
+	full pathname (if any) of the Mcc program.  After Configure runs,
+	the value is reset to a plain "Mcc" and is not useful.
+
 medium (models.U):
 	This variable contains a flag which will tell the C compiler and loader
 	to produce a program running with a medium memory model.  If the
@@ -2834,6 +2856,10 @@ stdio_ptr (d_stdstdio.U):
 	_ptr field (or equivalent) of stdio.h's FILE structure.  This will
 	be used to define the macro FILE_ptr(fp).
 
+stdio_stream_array (stdio_streams.U):
+	This variable tells the name of the array holding the stdio streams.
+	Usual values include _iob, __iob, and __sF.
+
 strings (i_string.U):
 	This variable holds the full path of the string header that will be
 	used. Typically /usr/include/string.h or /usr/include/strings.h.
diff --git a/Porting/config.sh b/Porting/config.sh
index 57d80ff..fc3bacf 100644
--- a/Porting/config.sh
+++ b/Porting/config.sh
@@ -8,7 +8,7 @@
 
 # Package name      : perl5
 # Source directory  : .
-# Configuration time: Mon Apr 19 22:33:54 EET DST 1999
+# Configuration time: Thu May 20 09:56:03 EET DST 1999
 # Configured by     : jhi
 # Target system     : osf1 alpha.hut.fi v4.0 878 alpha 
 
@@ -52,10 +52,10 @@ cc='cc'
 cccdlflags=' '
 ccdlflags='  -Wl,-rpath,/opt/perl/lib/5.00556/alpha-dec_osf-thread/CORE'
 ccflags='-pthread -std -DLANGUAGE_C'
-ccsymbols='LANGUAGE_C=1 SYSTYPE_BSD=1 _LONGLONG=1 __LANGUAGE_C__=1'
+ccsymbols='__LANGUAGE_C__=1 _LONGLONG=1 LANGUAGE_C=1 SYSTYPE_BSD=1'
 cf_by='jhi'
 cf_email='yourname@yourhost.yourplace.com'
-cf_time='Mon Apr 19 22:33:54 EET DST 1999'
+cf_time='Thu May 20 09:56:03 EET DST 1999'
 chgrp=''
 chmod=''
 chown=''
@@ -67,7 +67,7 @@ cp='cp'
 cpio=''
 cpp='cpp'
 cpp_stuff='42'
-cppccsymbols='_SYSTYPE_BSD=1 __alpha=1 __osf__=1 __unix__=1 unix=1'
+cppccsymbols='__alpha=1 __osf__=1 __unix__=1 _SYSTYPE_BSD=1 unix=1'
 cppflags='-pthread -std -DLANGUAGE_C'
 cpplast=''
 cppminus=''
@@ -207,6 +207,7 @@ d_madvise='define'
 d_mblen='define'
 d_mbstowcs='define'
 d_mbtowc='define'
+d_memchr='define'
 d_memcmp='define'
 d_memcpy='define'
 d_memmove='define'
@@ -319,6 +320,7 @@ d_statfsflags='define'
 d_statvfs='define'
 d_stdio_cnt_lval='define'
 d_stdio_ptr_lval='define'
+d_stdio_stream_array='define'
 d_stdiobase='define'
 d_stdstdio='define'
 d_store64='undef'
@@ -373,7 +375,7 @@ dlext='so'
 dlsrc='dl_dlopen.xs'
 doublesize='8'
 drand01='drand48()'
-dynamic_ext='B DB_File Data/Dumper Devel/Peek Fcntl IO IPC/SysV NDBM_File ODBM_File Opcode POSIX SDBM_File Socket Thread attrs re'
+dynamic_ext='B ByteLoader DB_File Data/Dumper Devel/Peek Fcntl IO IPC/SysV NDBM_File ODBM_File Opcode POSIX SDBM_File Socket Thread attrs re'
 eagain='EAGAIN'
 ebcdic='undef'
 echo='echo'
@@ -382,7 +384,9 @@ emacs=''
 eunicefix=':'
 exe_ext=''
 expr='expr'
-extensions='B DB_File Data/Dumper Devel/Peek Fcntl IO IPC/SysV NDBM_File ODBM_File Opcode POSIX SDBM_File Socket Thread attrs re Errno'
+extensions='B ByteLoader DB_File Data/Dumper Devel/Peek Fcntl IO IPC/SysV NDBM_File ODBM_File Opcode POSIX SDBM_File Socket Thread attrs re Errno'
+fflushNULL='define'
+fflushall='undef'
 find=''
 firstmakefile='makefile'
 flex=''
@@ -425,6 +429,7 @@ i_mntent='undef'
 i_ndbm='define'
 i_netdb='define'
 i_neterrno='undef'
+i_netinettcp='define'
 i_niin='define'
 i_poll='define'
 i_pthread='define'
@@ -481,11 +486,11 @@ installsitearch='/opt/perl/lib/site_perl/5.00556/alpha-dec_osf-thread'
 installsitelib='/opt/perl/lib/site_perl/5.00556'
 installusrbinperl='define'
 intsize='4'
-known_extensions='B DB_File Data/Dumper Devel/Peek Fcntl GDBM_File IO IPC/SysV NDBM_File ODBM_File Opcode POSIX SDBM_File Socket Thread attrs re'
+known_extensions='B ByteLoader DB_File Data/Dumper Devel/Peek Fcntl GDBM_File IO IPC/SysV NDBM_File ODBM_File Opcode POSIX SDBM_File Socket Thread attrs re'
 ksh=''
 large=''
 ld='ld'
-lddlflags='-shared -expect_unresolved "*" -O -msym -s'
+lddlflags='-shared -expect_unresolved "*" -msym -s'
 ldflags=''
 less='less'
 lib_ext='.a'
@@ -628,6 +633,7 @@ stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)'
 stdio_cnt='((fp)->_cnt)'
 stdio_filbuf=''
 stdio_ptr='((fp)->_ptr)'
+stdio_stream_array='_iob'
 strings='/usr/include/string.h'
 submit=''
 subversion='56'
diff --git a/Porting/config_H b/Porting/config_H
index db1d35d..135308a 100644
--- a/Porting/config_H
+++ b/Porting/config_H
@@ -17,7 +17,7 @@
 /*
  * Package name      : perl5
  * Source directory  : .
- * Configuration time: Mon Apr 19 22:33:54 EET DST 1999
+ * Configuration time: Thu May 20 09:56:03 EET DST 1999
  * Configured by     : jhi
  * Target system     : osf1 alpha.hut.fi v4.0 878 alpha 
  */
@@ -1686,6 +1686,12 @@
 #define LONGLONGSIZE 8		/**/
 #endif
 
+/* HAS_MEMCHR:
+ *	This symbol, if defined, indicates that the memchr routine is available
+ *	to locate characters within a C string.
+ */
+#define HAS_MEMCHR	/**/
+
 /* HAS_MMAP:
  *	This symbol, if defined, indicates that the mmap system call is
  *	available to map a file into memory.
@@ -2199,6 +2205,18 @@
  */
 #define USE_DYNAMIC_LOADING		/**/
 
+/* FFLUSH_NULL:
+ *	This symbol, if defined, tells that fflush(NULL) does flush
+ *	all pending stdio output.
+ */
+/* FFLUSH_ALL:
+ *	This symbol, if defined, tells that to flush
+ *	all pending stdio output one must loop through all
+ *	the stdio file handles stored in an array and fflush them.
+ */
+#define	FFLUSH_NULL 		/**/
+/*#define	FFLUSH_ALL 		/ **/
+
 /* DB_Prefix_t:
  *	This symbol contains the type of the prefix structure element
  *	in the <db.h> header file.  In older versions of DB, it was
@@ -2230,6 +2248,12 @@
  */
 /*#define	I_MNTENT		/ **/
 
+/* I_NETINET_TCP:
+ *     This symbol, if defined, indicates to the C program that it should
+ *     include <netinet/tcp.h>.
+ */
+#define   I_NETINET_TCP                /**/
+
 /* I_POLL:
  *	This symbol, if defined, indicates that <poll.h> exists and
  *	should be included.
@@ -2431,6 +2455,17 @@
 /*#define    HAS_FTELLO64		/ **/
 /*#define   HAS_TMPFILE64	/ **/
 
+/* HAS_STDIO_STREAM_ARRAY:
+ *	This symbol, if defined, tells that there is an array
+ *	holding the stdio streams.
+ */
+/* STDIO_STREAM_ARRAY:
+ *	This symbol tells the name of the array holding the stdio streams.
+ *	Usual values include _iob, __iob, and __sF.
+ */
+#define	HAS_STDIO_STREAM_ARRAY	/**/
+#define STDIO_STREAM_ARRAY	_iob
+
 /* USE_64_BITS:
  *	This symbol, if defined, indicates that 64-bit interfaces should
  *	be used when available.  If not defined, the native default interfaces
diff --git a/config_h.SH b/config_h.SH
index 5bc9274..ae4ba19 100644
--- a/config_h.SH
+++ b/config_h.SH
@@ -2226,7 +2226,7 @@ sed <<!GROK!THIS! >config.h -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un-
 /* FFLUSH_ALL:
  *	This symbol, if defined, tells that to flush
  *	all pending stdio output one must loop through all
- *	the stdio file handles and fflush them.
+ *	the stdio file handles stored in an array and fflush them.
  */
 #$fflushNULL	FFLUSH_NULL 		/**/
 #$fflushall	FFLUSH_ALL 		/**/
diff --git a/hints/sunos_4_1.sh b/hints/sunos_4_1.sh
index 4585d79..6d94bdb 100644
--- a/hints/sunos_4_1.sh
+++ b/hints/sunos_4_1.sh
@@ -25,8 +25,12 @@ d_tzname='undef'
 # The gcc fix-includes script exposes those incorrect prototypes.
 # There may be other examples as well.  Volunteers are welcome to
 # track them all down :-).  In the meantime, we'll just skip unistd.h
-# for SunOS in most of the code.   (However, see ext/POSIX/hints/sunos_4.pl.)
+# for SunOS in most of the code.   
+# However, see ext/POSIX/hints/sunos_4.pl for one exception.
 i_unistd='undef'
+# See util.c for another:  We need _SC_OPEN_MAX, which is in
+# <unistd.h>.
+util_cflags='ccflags="$ccflags -DI_UNISTD"'
 
 cat << 'EOM' >&4