This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
POSIX::asctime pod: Note it always returns English
[perl5.git] / Configure
index a01c409..90ea4bd 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -234,7 +234,6 @@ useopcode=''
 useposix=''
 extras=''
 d_bsd=''
-usedefaultstrict=''
 d_eunice=''
 d_xenix=''
 eunicefix=''
@@ -515,6 +514,7 @@ d_gai_strerror=''
 d_Gconvert=''
 d_getaddrinfo=''
 d_getcwd=''
+d_getenv_preserves_other_thread=''
 d_getespwnam=''
 d_getfsstat=''
 d_getgrent=''
@@ -1336,6 +1336,7 @@ archname64=''
 use64bitall=''
 use64bitint=''
 usecbacktrace=''
+usedefaultstrict=''
 dtrace=''
 usedtrace=''
 usefaststdio=''
@@ -5388,23 +5389,24 @@ default|recommended)
        # is to add the flag to the flags passed to the compiler at link time,
        # as that way the compiler can do the right implementation dependant
        # thing. (NWC)
-       case "$osname" in
-       amigaos) ;; # -fstack-protector builds but doesn't work
-       *)      case "$gccversion" in
-               ?*)     set stack-protector-strong -fstack-protector-strong
-                       eval $checkccflag
-                       case "$dflt" in
-                       *-fstack-protector-strong*) ;; # It got added.
-                       *) # Try the plain/older -fstack-protector.
-                          set stack-protector -fstack-protector
-                          eval $checkccflag
-                          ;;
-                       esac
-                       ;;
+       case "$ccflags" in
+       *-fno-stack-protector*)
+           echo "Do not add -fstack-protector nor -fstack-protector-strong" 2>&1
+           ;;
+       *) case "$gccversion" in
+          ?*)  set stack-protector-strong -fstack-protector-strong
+               eval $checkccflag
+               case "$dflt" in
+               *-fstack-protector-strong*) ;; # It got added.
+               *) # Try the plain/older -fstack-protector.
+                  set stack-protector -fstack-protector
+                  eval $checkccflag
+                  ;;
                esac
                ;;
+           esac
+           ;;
        esac
-       ;;
 esac
 
 case "$mips_type" in
@@ -14205,6 +14207,86 @@ eval $inlibc
 set getcwd d_getcwd
 eval $inlibc
 
+: check for getenv behavior
+case "$d_getenv_preserves_other_thread" in
+'')
+$echo "Checking to see if getenv() preserves a different thread's results" >&4
+$cat >try.c <<EOCP
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#  include <stdlib.h>
+#endif
+#include <stdio.h>
+#include <string.h>
+#$i_pthread I_PTHREAD
+#ifdef I_PTHREAD
+#  include <pthread.h>
+#endif
+
+void *
+thread_start(void * arg)
+{
+    (void *) getenv("HOME");
+}
+
+int main() {
+    char * main_buffer;
+    char save_main_buffer[1000];
+    pthread_t subthread;
+    pthread_attr_t attr;
+
+    main_buffer = getenv("PATH");
+
+    /* If too large for our generous allowance, return we couldn't figure it
+     * out. */
+    if (strlen(main_buffer) >= sizeof(save_main_buffer)) {
+        exit(2);
+    }
+
+    strcpy(save_main_buffer, main_buffer);
+
+    if (pthread_attr_init(&attr) != 0) {
+        exit(2);
+    }
+
+    if (pthread_create(&subthread, &attr, thread_start, NULL) != 0) {
+        exit(2);
+    }
+
+    if (pthread_join(subthread, NULL) != 0) {
+        exit(2);
+    }
+
+    exit(! strcmp(main_buffer, save_main_buffer) == 0);
+}
+EOCP
+val=
+set try
+if eval $compile_ok; then
+        $run ./try
+        rc=$?
+        case "$rc" in
+            0) echo "getenv() didn't destroy another thread's buffer" >&4
+              val=$define
+               ;;
+            1) echo "getenv() does destroy another thread's buffer" >&4
+              val=$undef
+               ;;
+            *) echo "Couldn't determine if getenv() destroys another thread's return value (code=$rc); assuming it does" >&4
+              val=$undef
+               ;;
+        esac
+else
+    echo "(I can't seem to compile the test program.)" >&4
+    echo "Assuming that your C library's getenv destroys another thread's return value." >&4
+    val=$undef
+fi
+set d_getenv_preserves_other_thread
+eval $setvar
+$rm_try
+;;
+esac
+
 : see if getespwnam exists
 set getespwnam d_getespwnam
 eval $inlibc
@@ -20313,34 +20395,6 @@ EOCP
        ;;
 esac
 
-: Ask about strict by default.
-case "$usedefaultstrict" in
-    $define|true|[Yy]*)
-       dflt="y"
-       ;;
-    *)
-       dflt="n"
-       ;;
-    esac
-
-cat <<EOM
-
-EXPERIMENTAL: Perl can now be built with strict on by default when not
-invoked with -e or -E. This is a diagnostic tool for development.
-
-Unless you are familiar with this feature, you should probably answer 'no'.
-
-EOM
-
-rp='Would you like to build perl with strict enabled by default?'
-. ./myread
-case "$ans" in
-y|Y) val="$define" ;;
-*)   val="$undef"  ;;
-esac
-set usedefaultstrict
-eval $setvar
-
 : Include . in @INC
 $cat <<EOM
 
@@ -21511,6 +21565,9 @@ int
 main(int ac, char **av)
 {
   signal(SIGSEGV, exit);
+#ifdef SIGBUS
+  signal(SIGBUS,  exit);
+#endif
 
   myprintf("%s%cs all right, then\n", "that", '\'');
   exit(0);
@@ -22686,6 +22743,34 @@ case "$uidsign" in
        ;;
 esac
 
+: Ask about strict by default.
+case "$usedefaultstrict" in
+    $define|true|[Yy]*)
+       dflt="y"
+       ;;
+    *)
+       dflt="n"
+       ;;
+    esac
+
+cat <<EOM
+
+EXPERIMENTAL: Perl can now be built with strict on by default when not
+invoked with -e or -E. This is a diagnostic tool for development.
+
+Unless you are familiar with this feature, you should probably answer 'no'.
+
+EOM
+
+rp='Would you like to build perl with strict enabled by default?'
+. ./myread
+case "$ans" in
+y|Y) val="$define" ;;
+*)   val="$undef"  ;;
+esac
+set usedefaultstrict
+eval $setvar
+
 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
 echo " "
 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
@@ -24197,7 +24282,6 @@ d_eofnblk='$d_eofnblk'
 d_erf='$d_erf'
 d_erfc='$d_erfc'
 d_eunice='$d_eunice'
-usedefaultstrict='$usedefaultstrict'
 d_exp2='$d_exp2'
 d_expm1='$d_expm1'
 d_faststdio='$d_faststdio'
@@ -24248,6 +24332,7 @@ d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
 d_getaddrinfo='$d_getaddrinfo'
 d_getcwd='$d_getcwd'
+d_getenv_preserves_other_thread='$d_getenv_preserves_other_thread'
 d_getespwnam='$d_getespwnam'
 d_getfsstat='$d_getfsstat'
 d_getgrent='$d_getgrent'
@@ -25142,6 +25227,7 @@ use64bitall='$use64bitall'
 use64bitint='$use64bitint'
 usecbacktrace='$usecbacktrace'
 usecrosscompile='$usecrosscompile'
+usedefaultstrict='$usedefaultstrict'
 usedevel='$usedevel'
 usedl='$usedl'
 usedtrace='$usedtrace'