This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Abstract the specific use of SvCUR in GVs for detecting variables on
[perl5.git] / Configure
index 7be96c6..d1d4f70 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -26,7 +26,7 @@
 
 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
 #
-# Generated on Tue Sep  6 16:35:32 CEST 2005 [metaconfig 3.0 PL70]
+# Generated on Wed Feb 15 09:59:58 CET 2006 [metaconfig 3.0 PL70]
 # (with additional metaconfig patches by perlbug@perl.org)
 
 cat >c1$$ <<EOF
@@ -362,6 +362,7 @@ d_chown=''
 d_chroot=''
 d_chsize=''
 d_class=''
+d_clearenv=''
 d_closedir=''
 d_void_closedir=''
 d_cmsghdr_s=''
@@ -440,6 +441,7 @@ d_fsync=''
 d_ftello=''
 d_ftime=''
 d_gettimeod=''
+d_futimes=''
 d_Gconvert=''
 d_getcwd=''
 d_getespwnam=''
@@ -550,6 +552,8 @@ longlongsize=''
 d_lseekproto=''
 d_lstat=''
 d_madvise=''
+d_malloc_good_size=''
+d_malloc_size=''
 d_mblen=''
 d_mbstowcs=''
 d_mbtowc=''
@@ -677,6 +681,8 @@ d_sigaction=''
 d_sigprocmask=''
 d_sigsetjmp=''
 usesitecustomize=''
+d_snprintf=''
+d_vsnprintf=''
 d_sockatmark=''
 d_sockatmarkproto=''
 d_msg_ctrunc=''
@@ -692,6 +698,7 @@ sockethdr=''
 socketlib=''
 d_socklen_t=''
 d_socks5_init=''
+d_sprintf_returns_strlen=''
 d_sqrtl=''
 d_srand48_r=''
 srand48_r_proto=''
@@ -762,6 +769,7 @@ d_semctl_semid_ds=''
 d_semctl_semun=''
 d_union_semun=''
 d_unordered=''
+d_unsetenv=''
 d_usleep=''
 d_usleepproto=''
 d_ustat=''
@@ -3122,18 +3130,21 @@ EOM
                domainos) osname=apollo
                        osvers="$3"
                        ;;
-               dgux)   osname=dgux 
+               dgux)   osname=dgux
+                       osvers="$3"
+                       ;;
+               dragonfly) osname=dragonfly
                        osvers="$3"
                        ;;
                dynixptx*) osname=dynixptx
                        osvers=`echo "$4"|sed 's/^v//'`
                        ;;
-               freebsd) osname=freebsd 
+               freebsd) osname=freebsd
                        osvers="$3" ;;
                genix)  osname=genix ;;
                gnu)    osname=gnu
                        osvers="$3" ;;
-               hp*)    osname=hpux 
+               hp*)    osname=hpux
                        osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
                        ;;
                irix*)  osname=irix
@@ -3229,7 +3240,7 @@ EOM
                        *freebsd*) ;;
                        svr*)
                                : svr4.x or possibly later
-                               case "svr$3" in 
+                               case "svr$3" in
                                ${osname}*)
                                        osname=svr$3
                                        osvers=$4
@@ -3292,7 +3303,7 @@ EOM
                        osvers="$5"
                fi
        fi
-       
+
         case "$targetarch" in
         '') ;;
         *)  hostarch=$osname
@@ -5889,7 +5900,7 @@ if $test -r $rsrc/patchlevel.h;then
        api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
        api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
        api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
-       perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
+       perl_patchlevel=`egrep 'define PERL_PATCHNUM [0-9][0-9]|,"MAINT[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
 else
        revision=0
        patchlevel=0
@@ -5900,8 +5911,8 @@ else
        perl_patchlevel=0
        $echo "(You do not have patchlevel.h.  Eek.)"
 fi
-if $test -r $rsrc/.patch ; then  
-       if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
+if $test -r $rsrc/.patch ; then
+       if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
                perl_patchlevel=`cat $rsrc/.patch`
        fi
 fi
@@ -7884,7 +7895,7 @@ if "$useshrplib"; then
        solaris)
                xxx="-R $shrpdir"
                ;;
-       freebsd|netbsd|openbsd|interix)
+       freebsd|netbsd|openbsd|interix|dragonfly)
                xxx="-Wl,-R$shrpdir"
                ;;
        bsdos|linux|irix*|dec_osf|gnu*)
@@ -10501,6 +10512,10 @@ eval $inlibc
 set class d_class
 eval $inlibc
 
+: see if clearenv exists
+set clearenv d_clearenv
+eval $inlibc
+
 hasstruct='varname=$1; struct=$2; shift; shift;
 while $test $# -ge 2; do
        case "$1" in
@@ -12546,6 +12561,41 @@ case "$longsize" in
 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
 esac
 
+d_futimes="$undef"
+: check for a working futimes
+echo " "
+echo "Checking for a working futimes()" >&4
+$cat >try.c <<EOCP
+#include <stdio.h>
+#include <sys/time.h>
+#include <errno.h>
+#include <fcntl.h>
+
+int main ()
+{
+    int fd, rv;
+    fd = open ("try.c", O_RDWR);
+    if (-1 == fd) exit (1);
+    rv = futimes (fd, NULL);
+    exit (rv == -1 ? errno : 0);
+}
+EOCP
+set try
+if eval $compile; then
+    `$run ./try`
+    rc=$?
+    case "$rc" in
+       0)  echo "Yes, it does" >&4
+           d_futimes="$define"
+           ;;
+       *)  echo "No, it has futimes, but it isn't working ($rc) (probably harmless)\n" >&4
+           ;;
+    esac
+else
+    echo "No, it does not (probably harmless)\n" >&4
+fi
+$rm -f try.* try core core.try.*
+
 : see if getcwd exists
 set getcwd d_getcwd
 eval $inlibc
@@ -14247,6 +14297,14 @@ eval $inlibc
 set madvise d_madvise
 eval $inlibc
 
+: see if malloc_size exists
+set malloc_size d_malloc_size
+eval $inlibc
+
+: see if malloc_size_good exists
+set malloc_good_size d_malloc_good_size
+eval $inlibc
+
 : see if mblen exists
 set mblen d_mblen
 eval $inlibc
@@ -15689,9 +15747,9 @@ $define)
 #endif
 END
     : see whether semctl IPC_STAT can use union semun
-    val="$undef"
     case "$d_semctl_semun" in
     '')
+      val="$undef"
       $cat > try.c <<END
 #include <sys/types.h>
 #include <sys/ipc.h>
@@ -15730,7 +15788,7 @@ int main() {
            printf("semctl IPC_STAT failed: errno = %d\n", errno);
 #      ifdef IPC_RMID
        if (semctl(sem, 0, IPC_RMID, arg) != 0)
-#      endif /* IPC_RMID */
+#      endif /* IPC_RMID */
            printf("semctl IPC_RMID failed: errno = %d\n", errno);
     } else
 #endif /* IPC_PRIVATE && ... */
@@ -15746,10 +15804,10 @@ END
           esac
       fi
       $rm -f try try.c
+      set d_semctl_semun
+      eval $setvar
       ;;
     esac
-    set d_semctl_semun
-    eval $setvar
     case "$d_semctl_semun" in
     $define)
         echo "You can use union semun for semctl IPC_STAT." >&4
@@ -15761,9 +15819,9 @@ END
     esac
 
     : see whether semctl IPC_STAT can use struct semid_ds pointer
-    val="$undef"
     case "$d_semctl_semid_ds" in
     '')
+      val="$undef"
       $cat > try.c <<'END'
 #include <sys/types.h>
 #include <sys/ipc.h>
@@ -15808,10 +15866,10 @@ END
           esac
       fi
       $rm -f try try.c
+      set d_semctl_semid_ds
+      eval $setvar
       ;;
     esac
-    set d_semctl_semid_ds
-    eval $setvar
     case "$d_semctl_semid_ds" in
     $define)
         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
@@ -16483,6 +16541,71 @@ set d_sigsetjmp
 eval $setvar
 $rm -f try.c try
 
+: see if snprintf exists
+set snprintf d_snprintf
+eval $inlibc
+
+: see if vsnprintf exists
+set vsnprintf d_vsnprintf
+eval $inlibc
+
+case "$d_snprintf-$d_vsnprintf" in
+"$define-$define")
+    $cat <<EOM
+Checking whether your snprintf() and vsnprintf() work okay...
+EOM
+    $cat >try.c <<'EOCP'
+/* v?snprintf testing logic courtesy of Russ Allbery.
+ * According to C99:
+ * - if the buffer is too short it still must be \0-terminated
+ * - if the buffer is too short the potentially required length
+ *   must be returned and not -1
+ * - if the buffer is NULL the potentially required length
+ *   must be returned and not -1 or core dump
+ */
+#include <stdio.h>
+#include <stdarg.h>
+
+char buf[2];
+
+int test (char *format, ...)
+{
+    va_list args;
+    int count;
+
+    va_start (args, format);
+    count = vsnprintf (buf, sizeof buf, format, args);
+    va_end (args);
+    return count;
+}
+
+int main ()
+{
+    return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
+             && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
+}
+EOCP
+    set try
+    if eval $compile; then
+       `$run ./try`
+       case "$?" in
+       0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
+       *) cat <<EOM >&4
+Your snprintf() and snprintf() don't seem to be working okay.
+EOM
+          d_snprintf="$undef"
+          d_vsnprintf="$undef"
+          ;;
+       esac
+    else
+       echo "(I can't seem to compile the test program--assuming they don't)"
+       d_snprintf="$undef"
+       d_vsnprintf="$undef"
+    fi
+    $rm -f try.* try core core.try.*
+    ;;
+esac
+
 : see if sockatmark exists
 set sockatmark d_sockatmark
 eval $inlibc
@@ -16496,6 +16619,68 @@ eval $hasproto
 set socks5_init d_socks5_init
 eval $inlibc
 
+: see if sprintf returns the length of the string in the buffer as per ANSI
+$echo "Checking whether sprintf returns the length of the string..." >&4
+$cat <<EOP >try.c
+#include <stdio.h>
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
+#$i_string I_STRING
+#ifdef I_STRING
+#  include <string.h>
+#else
+#  include <strings.h>
+#endif
+#$i_math I_MATH
+#ifdef I_MATH
+#include <math.h>
+#endif
+
+char buffer[256];
+
+int check (size_t expect, int test) {
+  size_t got = strlen(buffer);
+  if (expect == got)
+    return 0;
+
+  printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
+       test, buffer);
+  exit (test);
+}
+
+int main(int argc, char **argv) {
+  int test = 0;
+
+  check(sprintf(buffer, ""), ++test);
+  check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
+  check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
+
+  return 0;
+}
+EOP
+set try
+
+d_sprintf_returns_strlen="$undef"
+if eval $compile; then
+    xxx="`$run ./try`"
+    case "$?" in
+       0) cat >&4 <<EOM
+sprintf returns the length of the string (as ANSI says it should)
+EOM
+       d_sprintf_returns_strlen="$define"
+       ;;
+       *) cat >&4 <<EOM
+sprintf does not return the length of the string (how old is this system?)
+EOM
+       d_sprintf_returns_strlen="$undef"
+        ;;
+    esac
+fi
+
+$rm -f try.* try
+
 : see if srand48_r exists
 set srand48_r d_srand48_r
 eval $inlibc
@@ -17450,6 +17635,10 @@ eval $inlibc
 set unordered d_unordered
 eval $inlibc
 
+: see if unsetenv exists
+set unsetenv d_unsetenv
+eval $inlibc
+
 : see if usleep exists
 set usleep d_usleep
 eval $inlibc
@@ -19082,7 +19271,15 @@ if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
        $run ./foobar >/dev/null 2>&1; then
        echo "$ar appears to generate random libraries itself."
        orderlib=false
-       ranlib=":"
+       if [ "X$ranlib" = "X" ]; then
+           ranlib=":"
+       fi
+elif $ar s bar$_a >/dev/null 2>&1 &&
+       $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
+       $run ./foobar >/dev/null 2>&1; then
+               echo "a table of contents needs to be added with '$ar s'."
+               orderlib=false
+               ranlib="$ar s"
 elif $ar ts bar$_a >/dev/null 2>&1 &&
        $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
        $run ./foobar >/dev/null 2>&1; then
@@ -19107,7 +19304,7 @@ else
                ranlib=":"
        fi
 fi
-$rm -f foo* bar* 
+$rm -f foo* bar*
 
 : check for type of arguments to select. 
 case "$selecttype" in
@@ -19695,7 +19892,8 @@ $rm -f try try.*
 
 : see what type of char stdio uses.
 echo " "
-echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
+echo '#include <stdio.h>' > stdio.c
+$cppstdin $cppminus < stdio.c > stdioh
 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
        echo "Your stdio uses unsigned chars." >&4
        stdchar="unsigned char"
@@ -19703,9 +19901,7 @@ else
        echo "Your stdio uses signed chars." >&4
        stdchar="char"
 fi
-$rm -f stdioh
-
-
+$rm -f stdio.* stdioh
 
 : see what type uids are declared as in the kernel
 echo " "
@@ -20088,16 +20284,26 @@ cat <<EOSH > Cppsym.try
 $startsh
 cat <<'EOCP' > try.c
 #include <stdio.h>
+#if cpp_stuff == 1
+#define STRINGIFY(a)    "a"
+#endif
+#if cpp_stuff == 42
+#define StGiFy(a)  #a
+#define STRINGIFY(a)    StGiFy(a)
+#endif
+#if $cpp_stuff != 1 && $cpp_stuff != 42
+#   include "Bletch: How does this C preprocessor stringify macros?"
+#endif
 int main() {
 EOCP
 $awk \\
 EOSH
 cat <<'EOSH' >> Cppsym.try
 'length($1) > 0 {
-    printf "#ifdef %s\n#if %s+0\nprintf(\"%s=%%ld\\n\", (long)%s);\n#else\nprintf(\"%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
-    printf "#ifdef _%s\n#if _%s+0\nprintf(\"_%s=%%ld\\n\", (long)_%s);\n#else\nprintf(\"_%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
-    printf "#ifdef __%s\n#if __%s+0\nprintf(\"__%s=%%ld\\n\", (long)__%s);\n#else\nprintf(\"__%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
-    printf "#ifdef __%s__\n#if __%s__+0\nprintf(\"__%s__=%%ld\\n\", (long)__%s__);\n#else\nprintf(\"__%s__\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
+    printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
+    printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
+    printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
+    printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
 }'      >> try.c
 echo 'return 0;}' >> try.c
 EOSH
@@ -20107,7 +20313,7 @@ case "$osname-$gccversion" in
 irix-) ccflags="\$ccflags -woff 1178" ;;
 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
 esac
-$cc -o try $optimize \$ccflags $ldflags try.c $libs && $run ./try
+$cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
 EOSH
 chmod +x Cppsym.try
 $eunicefix Cppsym.try
 
 $awk '/\=/ { print $0; next }
        { print $0"=1" }' ccsym.raw >ccsym.list
-$awk '/\=/ { print $0; next }
-       { print $0"=1" }' Cppsym.true >ccsym.true
-$comm -13 ccsym.true ccsym.list >ccsym.own
-$comm -12 ccsym.true ccsym.list >ccsym.com
-$comm -23 ccsym.true ccsym.list >ccsym.cpp
+$comm -13 Cppsym.true ccsym.list >ccsym.own
+$comm -12 Cppsym.true ccsym.list >ccsym.com
+$comm -23 Cppsym.true ccsym.list >ccsym.cpp
 also=''
 if $test -z ccsym.raw; then
        echo "Your C compiler doesn't seem to define any symbols!" >&4
@@ -20961,6 +21165,7 @@ d_chown='$d_chown'
 d_chroot='$d_chroot'
 d_chsize='$d_chsize'
 d_class='$d_class'
+d_clearenv='$d_clearenv'
 d_closedir='$d_closedir'
 d_cmsghdr_s='$d_cmsghdr_s'
 d_const='$d_const'
@@ -21029,6 +21234,7 @@ d_fstatvfs='$d_fstatvfs'
 d_fsync='$d_fsync'
 d_ftello='$d_ftello'
 d_ftime='$d_ftime'
+d_futimes='$d_futimes'
 d_getcwd='$d_getcwd'
 d_getespwnam='$d_getespwnam'
 d_getfsstat='$d_getfsstat'
@@ -21112,6 +21318,8 @@ d_longlong='$d_longlong'
 d_lseekproto='$d_lseekproto'
 d_lstat='$d_lstat'
 d_madvise='$d_madvise'
+d_malloc_good_size='$d_malloc_good_size'
+d_malloc_size='$d_malloc_size'
 d_mblen='$d_mblen'
 d_mbstowcs='$d_mbstowcs'
 d_mbtowc='$d_mbtowc'
@@ -21243,12 +21451,14 @@ d_shmget='$d_shmget'
 d_sigaction='$d_sigaction'
 d_sigprocmask='$d_sigprocmask'
 d_sigsetjmp='$d_sigsetjmp'
+d_snprintf='$d_snprintf'
 d_sockatmark='$d_sockatmark'
 d_sockatmarkproto='$d_sockatmarkproto'
 d_socket='$d_socket'
 d_socklen_t='$d_socklen_t'
 d_sockpair='$d_sockpair'
 d_socks5_init='$d_socks5_init'
+d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
 d_sqrtl='$d_sqrtl'
 d_srand48_r='$d_srand48_r'
 d_srandom_r='$d_srandom_r'
@@ -21309,6 +21519,7 @@ d_umask='$d_umask'
 d_uname='$d_uname'
 d_union_semun='$d_union_semun'
 d_unordered='$d_unordered'
+d_unsetenv='$d_unsetenv'
 d_usleep='$d_usleep'
 d_usleepproto='$d_usleepproto'
 d_ustat='$d_ustat'
@@ -21322,6 +21533,7 @@ d_voidsig='$d_voidsig'
 d_voidtty='$d_voidtty'
 d_volatile='$d_volatile'
 d_vprintf='$d_vprintf'
+d_vsnprintf='$d_vsnprintf'
 d_wait4='$d_wait4'
 d_waitpid='$d_waitpid'
 d_wcstombs='$d_wcstombs'