summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xConfigure46
-rw-r--r--config_h.SH6
-rw-r--r--perl.h6
3 files changed, 53 insertions, 5 deletions
diff --git a/Configure b/Configure
index 4a9ea7019e..890bfd472c 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 Thu May 13 15:54:16 EET DST 1999 [metaconfig 3.0 PL70]
+# Generated on Thu May 13 16:42:40 EET DST 1999 [metaconfig 3.0 PL70]
# (with additional metaconfig patches by perlbug@perl.com)
cat >/tmp/c1$$ <<EOF
@@ -404,6 +404,7 @@ d_madvise=''
d_mblen=''
d_mbstowcs=''
d_mbtowc=''
+d_memchr=''
d_memcmp=''
d_memcpy=''
d_memmove=''
@@ -8680,6 +8681,10 @@ eval $inlibc
set mbtowc d_mbtowc
eval $inlibc
+: see if memchr exists
+set memchr d_memchr
+eval $inlibc
+
: see if memcmp exists
set memcmp d_memcmp
eval $inlibc
@@ -10965,7 +10970,13 @@ $cat >try.c <<EOCP
#$d_sysconf HAS_SYSCONF
int main() {
FILE* p = fopen("try.out", "w");
+#ifdef TRY_FPUTC
fputc('x', p);
+#else
+# ifdef TRY_FPRINTF
+ fprintf(p, "x");
+# endif
+#endif
#ifdef TRY_FFLUSH_NULL
fflush(NULL);
#endif
@@ -10997,17 +11008,41 @@ int main() {
_exit(42);
}
EOCP
+: first we have to find out how _not_ to flush
+if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
+ output=''
+ set try -DTRY_FPUTC
+ $rm -f try.out
+ if eval $compile_ok; then
+ ./try$exe_ext 2>/dev/null
+ if $test ! -s try.out -a "X$?" = X42; then
+ output=-DTRY_FPUTC
+ fi
+ fi
+ case "$output" in
+ '')
+ set try -DTRY_FPRINTF
+ $rm -f try.out
+ if eval $compile_ok; then
+ ./try$exe_ext 2>/dev/null
+ if $test ! -s try.out -a "X$?" = X42; then
+ output=-DTRY_FPRINTF
+ fi
+ fi
+ ;;
+ esac
+fi
: check for fflush NULL behaviour
case "$fflushNULL" in
-'') set try -DTRY_FFLUSH_NULL
+'') set try -DTRY_FFLUSH_NULL $output
$rm -f try.out
if eval $compile_ok; then
./try$exe_ext 2>/dev/null
if $test -s try.out -a "X$?" = X42; then
fflushNULL="`$cat try.out`"
fi
- $rm -f core try.core core.try.*
fi
+ $rm -f core try.core core.try.*
case "$fflushNULL" in
x) cat >&4 <<EOM
Your fflush(NULL) works okay.
@@ -11036,15 +11071,15 @@ $define|true|[yY]*)
esac
: check for fflush all behaviour
case "$fflushall" in
-'') set try -DTRY_FFLUSH_ALL
+'') set try -DTRY_FFLUSH_ALL $output
$rm -f try.out
if eval $compile_ok; then
./try$exe_ext 2>/dev/null
if $test -s try.out -a "X$?" = X42; then
fflushall="`$cat try.out`"
fi
- $rm -f core try.core core.try.*
fi
+ $rm -f core try.core core.try.*
case "$fflushall" in
x) cat >&4 <<EOM
Flushing explicitly all the stdio streams works.
@@ -12991,6 +13026,7 @@ d_madvise='$d_madvise'
d_mblen='$d_mblen'
d_mbstowcs='$d_mbstowcs'
d_mbtowc='$d_mbtowc'
+d_memchr='$d_memchr'
d_memcmp='$d_memcmp'
d_memcpy='$d_memcpy'
d_memmove='$d_memmove'
diff --git a/config_h.SH b/config_h.SH
index 1899e6c584..6059a7caff 100644
--- a/config_h.SH
+++ b/config_h.SH
@@ -1700,6 +1700,12 @@ sed <<!GROK!THIS! >config.h -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un-
#define LONGLONGSIZE $longlongsize /**/
#endif
+/* HAS_MEMCHR:
+ * This symbol, if defined, indicates that the memchr routine is available
+ * to locate characters within a C string.
+ */
+#$d_memchr HAS_MEMCHR /**/
+
/* HAS_MMAP:
* This symbol, if defined, indicates that the mmap system call is
* available to map a file into memory.
diff --git a/perl.h b/perl.h
index b6fe80563a..cee3d09412 100644
--- a/perl.h
+++ b/perl.h
@@ -502,6 +502,12 @@ Free_t Perl_mfree _((Malloc_t where));
# endif
#endif
+#ifndef memchr
+# ifndef HAS_MEMCHR
+# define memchr(s,c,n) ninstr((char*)(s), ((char*)(s)) + n, &(c), &(c) + 1)
+# endif
+#endif
+
#ifndef HAS_BCMP
# ifndef bcmp
# define bcmp(s1,s2,l) memcmp(s1,s2,l)