This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
fix problems from Carp's partial EBCDIC support
[perl5.git] / Configure
index 34dfc5f..3259249 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -438,14 +438,6 @@ d_dlerror=''
 d_dlopen=''
 d_dlsymun=''
 d_dosuid=''
-d_double_has_inf=''
-d_double_has_nan=''
-d_double_has_negative_zero=''
-d_double_has_subnormals=''
-d_double_style_cray=''
-d_double_style_ibm=''
-d_double_style_ieee=''
-d_double_style_vax=''
 d_suidsafe=''
 d_drand48_r=''
 drand48_r_proto=''
@@ -643,12 +635,12 @@ d_log1p=''
 d_log2=''
 d_logb=''
 d_ldexpl=''
-d_longdbl=''
 d_long_double_style_ieee=''
 d_long_double_style_ieee_doubledouble=''
 d_long_double_style_ieee_extended=''
 d_long_double_style_ieee_std=''
 d_long_double_style_vax=''
+d_longdbl=''
 longdblkind=''
 longdblsize=''
 d_longlong=''
@@ -945,6 +937,7 @@ d_wcstombs=''
 d_wcsxfrm=''
 d_wctomb=''
 d_writev=''
+default_inc_excludes_dot=''
 dlext=''
 bin_ELF=''
 cccdlflags=''
@@ -956,6 +949,7 @@ lddlflags=''
 usedl=''
 doublesize=''
 dtraceobject=''
+dtracexnolibs=''
 ebcdic=''
 fflushNULL=''
 fflushall=''
@@ -1133,6 +1127,14 @@ d_PRIeldbl=''
 d_PRIfldbl=''
 d_PRIgldbl=''
 d_SCNfldbl=''
+d_double_has_inf=''
+d_double_has_nan=''
+d_double_has_negative_zero=''
+d_double_has_subnormals=''
+d_double_style_cray=''
+d_double_style_ibm=''
+d_double_style_ieee=''
+d_double_style_vax=''
 doublekind=''
 sPRIEUldbl=''
 sPRIFUldbl=''
@@ -2894,7 +2896,6 @@ case "$lns" in
 *)     echo "No symbolic links, so not testing for their testing..." >&4
        ;;
 esac
-echo " "
 
 : Make symlinks util
 case "$mksymlinks" in
@@ -10295,7 +10296,7 @@ case "$doublekind" in
 1|2|3|4|5|6|7|8) d_double_style_ieee=$define ;;
 9|10|11) d_double_style_vax=$define ;;
 12|13) d_double_style_ibm=$define ;;
-14) double_style_cray=$define ;;
+14) d_double_style_cray=$define ;;
 esac
 case "$d_double_style_ieee" in
 $define)
@@ -17112,8 +17113,9 @@ $volatile int bletched = 0;
 $signal_t blech(int s) { bletched = 1; }
 #endif
 
-int checkit($nvtype d, char *where) {
-    unsigned char *p = (char *)&d;
+int checkit($nvtype d, const char *where) {
+    void *v = &d;
+    unsigned char *p = (unsigned char *)v;
     unsigned char *end = p + sizeof(d);
     int fail = 0;
 
@@ -17123,7 +17125,7 @@ int checkit($nvtype d, char *where) {
     if (!fail)
        return 0;
 
-    p = (char *)&d;
+    p = (unsigned char *)v;
     printf("No - %s: 0x", where);
     while (p < end)
        printf ("%02X", *p++);
@@ -20625,6 +20627,34 @@ EOCP
        ;;
 esac
 
+: Include . in @INC
+$cat <<EOM
+
+Historically Perl has provided a final fallback of the current working
+directory '.' when searching for a library. This, however, can lead to
+problems when a Perl program which loads optional modules is called from
+a shared directory. This can lead to executing unexpected code.
+
+EOM
+
+# When changing to exclude by default:
+case "$default_inc_excludes_dot" in
+    $undef|false|[nN]*) dflt="n" ;;
+    *)                  dflt="y" ;;
+esac
+# To turn exclude off by default:
+#case "$default_inc_excludes_dot" in
+#    $define|true|[yY]*) dflt="y" ;;
+#    *)                  dflt="n" ;;
+#esac
+
+rp='Exclude '.' from @INC by default? '
+. ./myread
+case "$ans" in
+    [nN]|undef) default_inc_excludes_dot="$undef"  ;;
+    *)          default_inc_excludes_dot="$define" ;;
+esac
+
 : Check what kind of inf/nan your system has
 $echo "Checking the kind of infinities and nans you have..." >&4
 $echo "(The following tests may crash.  That's okay.)" >&4
@@ -20632,13 +20662,17 @@ $cat >try.c <<EOP
 #define DOUBLESIZE $doublesize
 #$d_longdbl HAS_LONG_DOUBLE
 #ifdef HAS_LONG_DOUBLE
-#define LONGDBLSIZE $longdblsize
-#define LONGDBLKIND $longdblkind
+#define LONG_DOUBLESIZE $longdblsize
+#define LONG_DOUBLEKIND $longdblkind
 #endif
 #$i_math I_MATH
+#$i_string I_STRING
 #ifdef I_MATH
 #include <math.h>
 #endif
+#ifdef I_STRING
+#  include <string.h>
+#endif
 #include <stdio.h>
 /* Note that whether the sign bit is on or off
  * for NaN depends on the CPU/FPU, and possibly
@@ -20655,7 +20689,8 @@ $cat >try.c <<EOP
  * to even mention, causing immediate SIGFPE or equivalent: this is
  * the case with VAX floating point, for example.
  */
-static void bytes(unsigned char *p, unsigned int n) {
+static void bytes(void *v, unsigned int n) {
+  unsigned char *p = (unsigned char *)v;
   int i;
   for (i = 0; i < n; i++) {
     printf("0x%02x%s", p[i], i < n - 1 ? ", " : "\n");
@@ -20670,16 +20705,15 @@ int main(int argc, char *argv[]) {
 #ifdef HAS_LONG_DOUBLE
    long double ldinf = (long double)exp(1e9);
    long double ldnan = (long double)sqrt(-1.0);
-#endif
-  if (argc == 2) {
-    switch (argv[1][0]) {
-    case '1': bytes(&dinf, sizeof(dinf)); break;
-    case '2': bytes(&dnan, sizeof(dnan)); break;
-#ifdef HAS_LONG_DOUBLE
 # if LONG_DOUBLEKIND == 3 || LONG_DOUBLEKIND == 4
 /* the 80-bit long doubles might have garbage in their excess bytes */
     memset((char *)&ldinf + 10, '\0', LONG_DOUBLESIZE - 10);
+    memset((char *)&ldnan + 10, '\0', LONG_DOUBLESIZE - 10);
 # endif
+  if (argc == 2) {
+    switch (argv[1][0]) {
+    case '1': bytes(&dinf, sizeof(dinf)); break;
+    case '2': bytes(&dnan, sizeof(dnan)); break;
     case '3': bytes(&ldinf, sizeof(ldinf)); break;
     case '4': bytes(&ldnan, sizeof(ldnan)); break;
 #endif
@@ -20810,17 +20844,17 @@ else
     esac
 fi
 # In case the program crashed the values are empty, turn them undef.
-case "$dblinfbytes" in
-'') dblinfbytes=$undef ;;
+case "$doubleinfbytes" in
+'') doubleinfbytes=$undef ;;
 esac
-case "$dblnanbytes" in
-'') dblnanbytes=$undef ;;
+case "$doublenanbytes" in
+'') doublenanbytes=$undef ;;
 esac
-case "$ldblinfbytes" in
-'') ldblinfbytes=$undef ;;
+case "$longdblinfbytes" in
+'') longdblinfbytes=$undef ;;
 esac
-case "$ldblnanbytes" in
-'') ldblnanbytes=$undef ;;
+case "$longdblnanbytes" in
+'') longdblnanbytes=$undef ;;
 esac
 $rm_try
 
@@ -20938,12 +20972,38 @@ randseedtype=U32
 : object file that uses at least one of the probes defined in the .d file
 case "$usedtrace" in
 $define)
+    case "$dtracexnolibs" in
+    $define|true|[yY]*)
+        dtracexnolibs=$define
+       $dtrace -h -xnolibs -s ../perldtrace.d -o perldtrace.h
+       ;;
+    ' '|'')
+        if $dtrace -h -xnolibs -s ../perldtrace.d -o perldtrace.h 2>&1 ; then
+            dtracexnolibs=$define
+            echo "Your dtrace accepts -xnolibs"
+       elif $dtrace -h -s ../perldtrace.d -o perldtrace.h 2>&1 ; then
+            dtracexnolibs=$undef
+            echo "Your dtrace doesn't accept -xnolibs"
+       else
+             echo "Your dtrace doesn't work at all, try building without dtrace support" >&4
+            exit 1
+       fi
+       ;;
+    *)
+        dtracexnolibs=$undef
+       $dtrace -h -s ../perldtrace.d -o perldtrace.h
+       ;;
+    esac
+    case $dtracexnolibs in
+    $define) xnolibs=-xnolibs ;;
+    *) xnolibs= ;;
+    esac
+
     case "$dtraceobject" in
     $define|true|[yY]*)
         dtraceobject=$define
         ;;
     ' '|'')
-        $dtrace -h -s ../perldtrace.d -o perldtrace.h
         $cat >try.c <<EOM
 #include "perldtrace.h"
 int main(void) {
@@ -20953,14 +21013,14 @@ int main(void) {
 EOM
         dtraceobject=$undef
         if $cc -c -o try.o $optimize $ccflags try.c \
-                    && $dtrace -G -s ../perldtrace.d try.o >/dev/null 2>&1; then
+                    && $dtrace -G $xnolibs -s ../perldtrace.d try.o >/dev/null 2>&1; then
                 dtraceobject=$define
             echo "Your dtrace builds an object file"
         fi
-        $rm -f try.c try.o perldtrace.o
         ;;
     *) dtraceobject=$undef ;;
     esac
+    $rm_try perldtrace.o perldtrace.h
 esac
 
 : Determine if this is an EBCDIC system
@@ -23000,7 +23060,7 @@ main(int argc, char **argv) {
        return 4;
     }
 
-    buffer = malloc(size);
+    buffer = (char *)malloc(size);
     if (!buffer) {
        perror("malloc");
        return 5;
@@ -23099,7 +23159,7 @@ main(int argc, char **argv) {
        return 2;
     }
 
-    buffer = malloc(size);
+    buffer = (char *)malloc(size);
     if (!buffer) {
        perror("malloc");
        return 3;
@@ -24627,13 +24687,13 @@ d_lockf='$d_lockf'
 d_log1p='$d_log1p'
 d_log2='$d_log2'
 d_logb='$d_logb'
-d_longdbl='$d_longdbl'
-d_longlong='$d_longlong'
 d_long_double_style_ieee='$d_long_double_style_ieee'
 d_long_double_style_ieee_doubledouble='$d_long_double_style_ieee_doubledouble'
 d_long_double_style_ieee_extended='$d_long_double_style_ieee_extended'
 d_long_double_style_ieee_std='$d_long_double_style_ieee_std'
 d_long_double_style_vax='$d_long_double_style_vax'
+d_longdbl='$d_longdbl'
+d_longlong='$d_longlong'
 d_lrint='$d_lrint'
 d_lrintl='$d_lrintl'
 d_lround='$d_lround'
@@ -24913,6 +24973,7 @@ db_prefixtype='$db_prefixtype'
 db_version_major='$db_version_major'
 db_version_minor='$db_version_minor'
 db_version_patch='$db_version_patch'
+default_inc_excludes_dot='$default_inc_excludes_dot'
 direntrytype='$direntrytype'
 dlext='$dlext'
 dlsrc='$dlsrc'
@@ -24925,6 +24986,7 @@ drand01='$drand01'
 drand48_r_proto='$drand48_r_proto'
 dtrace='$dtrace'
 dtraceobject='$dtraceobject'
+dtracexnolibs='$dtracexnolibs'
 dynamic_ext='$dynamic_ext'
 eagain='$eagain'
 ebcdic='$ebcdic'