This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regcomp.c: Add assertions
[perl5.git] / Configure
index 91f20b8..95909f2 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -600,6 +600,7 @@ d_localtime_r=''
 d_localtime_r_needs_tzset=''
 localtime_r_proto=''
 d_locconv=''
+d_lc_monetary_2008=''
 d_lockf=''
 d_ldexpl=''
 d_longdbl=''
@@ -835,6 +836,7 @@ d_times=''
 d_tmpnam_r=''
 tmpnam_r_proto=''
 d_truncate=''
+d_truncl=''
 d_ttyname_r=''
 ttyname_r_proto=''
 d_tzname=''
@@ -956,6 +958,7 @@ d_pwgecos=''
 d_pwpasswd=''
 d_pwquota=''
 i_pwd=''
+i_quadmath=''
 i_shadow=''
 i_socks=''
 i_stdbool=''
@@ -1258,6 +1261,7 @@ libswanted_uselargefiles=''
 uselargefiles=''
 uselongdouble=''
 usemorebits=''
+usequadmath=''
 usemultiplicity=''
 nm_opt=''
 nm_so_opt=''
@@ -4443,6 +4447,16 @@ esac
 set usemultiplicity
 eval $setvar
 
+: Check if usequadmath is requested
+case "$usequadmath" in
+"$define"|true|[yY]*)
+       usequadmath="$define"
+        # if usequadmath enabled also enable uselongdouble
+       uselongdouble="$define"
+       ;;
+*)     usequadmath="$undef" ;;
+esac
+
 : Check if morebits is requested
 case "$usemorebits" in
 "$define"|true|[yY]*)
@@ -5166,6 +5180,9 @@ esac
 case "$usecbacktrace" in
 "$define") libswanted="$libswanted bfd" ;;
 esac
+case "$usequadmath" in
+"$define") libswanted="$libswanted quadmath" ;;
+esac
 libsfound=''
 libsfiles=''
 libsdirs=''
@@ -5383,8 +5400,15 @@ default|recommended)
        # as that way the compiler can do the right implementation dependant
        # thing. (NWC)
        case "$gccversion" in
-       ?*)     set stack-protector -fstack-protector
+       ?*)     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
        ;;
@@ -5527,6 +5551,12 @@ case "$ldflags" in
 esac
 # See note above about -fstack-protector
 case "$ccflags" in
+*-fstack-protector-strong*)
+       case "$dflt" in
+       *-fstack-protector-strong*) ;; # Don't add it again
+       *) dflt="$dflt -fstack-protector-strong" ;;
+       esac
+       ;;
 *-fstack-protector*)
        case "$dflt" in
        *-fstack-protector*) ;; # Don't add it again
@@ -6780,6 +6810,10 @@ eval $setvar
 set ldexpl d_ldexpl
 eval $inlibc
 
+: see if this is a quadmath.h system
+set quadmath.h i_quadmath
+eval $inhdr
+
 : check for length of long double
 case "${d_longdbl}${longdblsize}" in
 $define)
@@ -6827,11 +6861,18 @@ $cat <<EOP >try.c
 #ifdef I_STDLIB
 #include <stdlib.h>
 #endif
-#include <stdio.h>
+#$usequadmath USE_QUADMATH
+#$i_quadmath I_QUADMATH
+#if defined(USE_QUADMATH) && defined(I_QUADMATH)
+#include <quadmath.h>
+static const __float128 d = -0.1Q;
+#else
 static const long double d = -0.1L;
+#endif
+#include <stdio.h>
 int main() {
   unsigned const char* b = (unsigned const char*)(&d);
-#if LDBL_MANT_DIG == 113 && LONGDBLSIZE == 16
+#if (LDBL_MANT_DIG == 113 || FLT128_MANT_DIG == 113) && LONGDBLSIZE == 16
   if (b[0] == 0x9A && b[1] == 0x99 && b[15] == 0xBF) {
     /* IEEE 754 128-bit little-endian */
     printf("1\n");
@@ -8398,6 +8439,12 @@ EOM
        esac
 
        case "$ldflags" in
+           *-fstack-protector-strong*)
+               case "$dflt" in
+                   *-fstack-protector-strong*) ;; # Don't add it again
+                   *) dflt="$dflt -fstack-protector-strong" ;;
+               esac
+               ;;
            *-fstack-protector*)
                case "$dflt" in
                    *-fstack-protector*) ;; # Don't add it again
@@ -15663,6 +15710,98 @@ EOCP
 
     esac
 
+: check for fpclassify
+echo " "
+echo "Checking to see if you have fpclassify..." >&4
+$cat >try.c <<EOCP
+#$i_math I_MATH
+#ifdef I_MATH
+#include <math.h>
+#endif
+int main() { return fpclassify(1.0) == FP_NORMAL ? 0 : 1; }
+EOCP
+set try
+if eval $compile; then
+       val="$define"
+       echo "You have fpclassify."
+else
+       val="$undef"
+       echo "You do not have fpclassify."
+fi
+$rm_try
+set d_fpclassify
+eval $setvar
+
+: check for isfinite
+echo " "
+echo "Checking to see if you have isfinite..." >&4
+$cat >try.c <<EOCP
+#$i_math I_MATH
+#ifdef I_MATH
+#include <math.h>
+#endif
+int main() { return isfinite(0.0); }
+EOCP
+set try
+if eval $compile; then
+       val="$define"
+       echo "You have isfinite."
+else
+       val="$undef"
+       echo "You do not have isfinite."
+fi
+$rm_try
+set d_isfinite
+eval $setvar
+
+: check for isinf
+echo " "
+echo "Checking to see if you have isinf..." >&4
+$cat >try.c <<EOCP
+#$i_math I_MATH
+#ifdef I_MATH
+#include <math.h>
+#endif
+int main() { return isinf(0.0); }
+EOCP
+set try
+if eval $compile; then
+       val="$define"
+       echo "You have isinf."
+else
+       val="$undef"
+       echo "You do not have isinf."
+fi
+$rm_try
+set d_isinf
+eval $setvar
+
+: check for isnan
+echo " "
+echo "Checking to see if you have isnan..." >&4
+$cat >try.c <<EOCP
+#$i_math I_MATH
+#ifdef I_MATH
+#include <math.h>
+#endif
+int main() { return isnan(0.0); }
+EOCP
+set try
+if eval $compile; then
+       val="$define"
+       echo "You have isnan."
+else
+       val="$undef"
+       echo "You do not have isnan."
+fi
+$rm_try
+set d_isnan
+eval $setvar
+
+: see if this is a quadmath.h system
+set quadmath.h i_quadmath
+eval $inhdr
+
 : see if link exists
 set link d_link
 eval $inlibc
@@ -15790,6 +15929,27 @@ $rm_try
 set localeconv d_locconv
 eval $inlibc
 
+: see if libc has the POSIX.1-2008 currency locale rules
+case "$d_locconv:$d_lc_monetary_2008" in
+  $define:)
+       $cat >try.c <<EOCP
+#include <locale.h>
+int main() {
+       struct lconv *lc = localeconv();
+       char int_p_cs_precedes = lc->int_p_cs_precedes;
+       return 0;
+}
+EOCP
+       set try
+       if eval $compile; then
+               d_lc_monetary_2008="$define"
+       else
+               d_lc_monetary_2008="$undef"
+       fi;
+       $rm_try
+       ;;
+esac
+
 : see if lockf exists
 set lockf d_lockf
 eval $inlibc
@@ -15906,6 +16066,10 @@ eval $inlibc
 set scalbnl d_scalbnl
 eval $inlibc
 
+: see if truncl exists
+set truncl d_truncl
+eval $inlibc
+
 : see if modfl exists
 set modfl d_modfl
 eval $inlibc
@@ -15984,10 +16148,14 @@ if $test "$uselongdouble" = "$define"; then
        message="$message sqrtl"
     fi
     if $test "$d_modfl" != "$define"; then
-       if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
-           echo "You have both aintl and copysignl, so I can emulate modfl."
+       if $test "$d_truncl:$d_copysignl" = "$define:$define"; then
+           echo "You have both truncl and copysignl, so I can emulate modfl."
        else
-           message="$message modfl"
+           if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
+               echo "You have both aintl and copysignl, so I can emulate modfl."
+           else
+               message="$message modfl"
+           fi
        fi
     fi
     if $test "$d_frexpl" != "$define"; then
@@ -16162,6 +16330,48 @@ define:define)
        ;;
 esac
 
+case "$usequadmath:$i_quadmath" in
+define:define)
+  nvtype="__float128"
+  nvsize=16
+  case "$libs" in
+  *quadmath*) ;;
+  *) $cat <<EOM >&4
+
+*** You requested the use of the quadmath library, but you
+*** do not seem to have the quadmath library installed.
+*** Cannot continue, aborting.
+EOM
+    exit 1
+    ;;
+  esac
+  ;;
+define:*) $cat <<EOM >&4
+
+*** You requested the use of the quadmath library, but you
+*** do not seem to have the required header, <quadmath.h>.
+EOM
+  case "$gccversion" in
+  [23].*|4.[0-5]*)
+   $cat <<EOM >&4
+*** Your gcc looks a bit old:
+*** $gccversion
+EOM
+    ;;
+  '')
+   $cat <<EOM >&4
+*** You are not running a gcc.
+EOM
+    ;;
+  esac
+  $cat <<EOM >&4
+*** For the quadmath library you need at least gcc 4.6.
+*** Cannot continue, aborting.
+EOM
+  exit 1
+  ;;
+esac
+
 $echo "(IV will be "$ivtype", $ivsize bytes)"
 $echo "(UV will be "$uvtype", $uvsize bytes)"
 $echo "(NV will be "$nvtype", $nvsize bytes)"
@@ -20463,20 +20673,29 @@ else
        fi
 fi
 
-if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
+if $test X"$usequadmath" = X"$define"; then
+    nveformat='"Qe"'
+    nvfformat='"Qf"'
+    nvgformat='"Qg"'
+    nvEUformat='"QE"'
+    nvFUformat='"QF"'
+    nvGUformat='"QG"'
+else
+    if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
        nveformat="$sPRIeldbl"
        nvfformat="$sPRIfldbl"
        nvgformat="$sPRIgldbl"
        nvEUformat="$sPRIEUldbl"
        nvFUformat="$sPRIFUldbl"
        nvGUformat="$sPRIGUldbl"
-else
+    else
        nveformat='"e"'
        nvfformat='"f"'
        nvgformat='"g"'
        nvEUformat='"E"'
        nvFUformat='"F"'
        nvGUformat='"G"'
+    fi
 fi
 
 case "$ivdformat" in
@@ -23459,6 +23678,7 @@ d_localtime64='$d_localtime64'
 d_localtime_r='$d_localtime_r'
 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
 d_locconv='$d_locconv'
+d_lc_monetary_2008='$d_lc_monetary_2008'
 d_lockf='$d_lockf'
 d_longdbl='$d_longdbl'
 d_longlong='$d_longlong'
@@ -23672,6 +23892,7 @@ d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
 d_tm_tm_zone='$d_tm_tm_zone'
 d_tmpnam_r='$d_tmpnam_r'
 d_truncate='$d_truncate'
+d_truncl='$d_truncl'
 d_ttyname_r='$d_ttyname_r'
 d_tzname='$d_tzname'
 d_u32align='$d_u32align'
@@ -23840,6 +24061,7 @@ i_poll='$i_poll'
 i_prot='$i_prot'
 i_pthread='$i_pthread'
 i_pwd='$i_pwd'
+i_quadmath='$i_quadmath'
 i_rpcsvcdbm='$i_rpcsvcdbm'
 i_sgtty='$i_sgtty'
 i_shadow='$i_shadow'
@@ -24218,6 +24440,7 @@ usensgetexecutablepath='$usensgetexecutablepath'
 useopcode='$useopcode'
 useperlio='$useperlio'
 useposix='$useposix'
+usequadmath='$usequadmath'
 usereentrant='$usereentrant'
 userelocatableinc='$userelocatableinc'
 useshrplib='$useshrplib'