More Chip patches:
[p5sagit/p5-mst-13.2.git] / Configure
index b8618cb..952a685 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -63,6 +63,9 @@ if test -d c:/. -a -n "$OS2_SHELL"; then
        PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
        OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
 fi
+if test -d c:/. -a -n "$DJDIR"; then
+        p_=\;
+fi
 
 : Proper PATH setting
 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
@@ -493,6 +496,7 @@ i_netdb=''
 i_neterrno=''
 i_niin=''
 i_sysin=''
+d_pthreads_created_joinable=''
 d_pwage=''
 d_pwchange=''
 d_pwclass=''
@@ -603,7 +607,6 @@ installprivlib=''
 privlib=''
 privlibexp=''
 prototype=''
-pthreads_created_joinable=''
 randbits=''
 installscript=''
 scriptdir=''
@@ -1822,7 +1825,7 @@ EOM
                osf1|mls+)      case "$5" in
                                alpha)
                                        osname=dec_osf
-                                       osvers=`echo "$3" | sed 's/^[vt]//'`
+                                       osvers=`echo "$3" | sed 's/^[xvt]//'`
                                        ;;
                        hp*)    osname=hp_osf1  ;;
                        mips)   osname=mips_osf1 ;;
@@ -1900,6 +1903,10 @@ EOM
                        set X $myuname
                        osname=os2
                        osvers="$5"
+                       if test -n "$DJDIR"; then
+                               osname=dos
+                               osvers=djgpp
+                       fi
                fi
        fi
        
@@ -2099,8 +2106,15 @@ esac
 rp='What is your architecture name'
 . ./myread
 case "$usethreads" in
-$define)  archname="$ans-thread"
-          echo "usethreads selected... architecture name is now $archname." >&4
+$define)  echo "Threads selected." >&4
+          case "$ans" in
+          *-thread) echo "...and architecture name already ends in -thread." >&4
+                    archname="$ans"
+                    ;;
+          *)        archname="$ans-thread"
+                    echo "...setting architecture name to $archname." >&4
+                    ;;
+          esac
           ;;
 *)        archname="$ans" ;;
 esac
@@ -5450,13 +5464,13 @@ fi
 
 cat <<EOM
 
-Previous version of $package used the standard IO mechanisms as defined in
-<stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
+Previous version of $package used the standard IO mechanisms as defined
+in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
-the default and is the only supported mechanism.  This abstraction
-layer can use AT&T's sfio (if you already have sfio installed) or
-fall back on standard IO.  This PerlIO abstraction layer is
-experimental and may cause problems with some extension modules.
+the default.  This abstraction layer can use AT&T's sfio (if you already
+have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
+problems with some extension modules.  Using PerlIO with stdio is safe,
+but it is slower than plain stdio and therefore is not the default.
 
 If this doesn't make any sense to you, just accept the default 'n'.
 EOM
@@ -6613,10 +6627,6 @@ eval $inlibc
 set gethostbyaddr d_gethbadd
 eval $inlibc
 
-: see if getnetbyaddr exists
-set getnetbyaddr d_getnbadd
-eval $inlibc
-
 : see if gethostent exists
 set gethostent d_gethent
 eval $inlibc
@@ -6625,6 +6635,10 @@ eval $inlibc
 set getlogin d_getlogin
 eval $inlibc
 
+: see if getnetbyaddr exists
+set getnetbyaddr d_getnbadd
+eval $inlibc
+
 : see if getpgid exists
 set getpgid d_getpgid
 eval $inlibc
@@ -8266,7 +8280,7 @@ eval $inhdr
 
 case "$i_db" in
 $define)
-       : Check db version.  We can not use version 2.
+       : Check db version.
        echo " "
        echo "Checking Berkeley DB version ..." >&4
        $cat >try.c <<EOCP
@@ -8279,13 +8293,33 @@ $define)
 #include <db.h>
 main()
 {
-#ifdef DB_VERSION_MAJOR        /* DB version >= 2: not yet. */
-    printf("You have Berkeley DB Version %d.%d\n",
-               DB_VERSION_MAJOR, DB_VERSION_MINOR);
-    printf("Perl currently only supports up to version 1.86.\n");
-    exit(2);
+#ifdef DB_VERSION_MAJOR        /* DB version >= 2 */
+    int Major, Minor, Patch ;
+    (void)db_version(&Major, &Minor, &Patch) ;
+    printf("You have Berkeley DB Version 2 or greater\n");
+
+    printf("db.h is from Berkeley DB Version %d.%d.%d\n",
+               DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
+    printf("libdb is from Berkeley DB Version %d.%d.%d\n",
+               Major, Minor, Patch) ;
+
+    /* check that db.h & libdb are compatible */
+    if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
+       printf("db.h and libdb are incompatible\n") ;
+        exit(3);       
+    }
+
+    printf("db.h and libdb are compatible\n") ;
+    /* needs to be >= 2.05 */
+    if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) {
+       printf("but Perl needs Berkeley DB 2.0.5 or greater\n") ;
+        exit(2);       
+    }
+
+    exit(0);
 #else
 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
+    printf("You have Berkeley DB Version 1\n");
     exit(0);   /* DB version < 2: the coast is clear. */
 #else
     exit(1);   /* <db.h> not Berkeley DB? */
@@ -8294,7 +8328,7 @@ main()
 }
 EOCP
        if $cc $optimize $ccflags $ldflags -o try try.c $libs && ./try; then
-               echo 'Looks OK.  (Perl supports up to version 1.86).' >&4
+               echo 'Looks OK.' >&4
        else
                echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
                i_db=$undef
@@ -8325,6 +8359,8 @@ define)
 #endif
 #include <sys/types.h>
 #include <db.h>
+
+#ifndef DB_VERSION_MAJOR
 u_int32_t hash_cb (ptr, size)
 const void *ptr;
 size_t size;
@@ -8335,6 +8371,7 @@ main()
 {
        info.hash = hash_cb;
 }
+#endif
 EOCP
        if $cc $ccflags -c try.c >try.out 2>&1 ; then
                if $contains warning try.out >>/dev/null 2>&1 ; then
@@ -8367,6 +8404,8 @@ define)
 #endif
 #include <sys/types.h>
 #include <db.h>
+
+#ifndef DB_VERSION_MAJOR
 size_t prefix_cb (key1, key2)
 const DBT *key1;
 const DBT *key2;
@@ -8377,6 +8416,7 @@ main()
 {
        info.prefix = prefix_cb;
 }
+#endif
 EOCP
        if $cc $ccflags -c try.c  >try.out 2>&1 ; then
                if $contains warning try.out >>/dev/null 2>&1 ; then
@@ -8552,24 +8592,6 @@ EOM
 *)  groupstype="$gidtype";;
 esac
 
-case "$usethreads" in
-$define)
-
-    : see if sched_yield exists
-    set sched_yield d_sched_yield
-    eval $inlibc
-    
-    : see if pthread_yield exists
-    set pthread_yield d_pthread_yield
-    eval $inlibc
-
-    ;;
-*)
-    d_sched_yield=$undef
-    d_pthread_yield=$undef
-    ;;
-esac
-
 : see what type lseek is declared as in the kernel
 set off_t lseektype long stdio.h sys/types.h
 eval $typedef
@@ -9289,8 +9311,10 @@ EOCP
                            if $cc $ccflags -c -DGethbadd_addr_t="$xxx" -DGethbadd_alen_t="$yyy" try.c >/dev/null 2>&1 ; then
                                gethbadd_addr_type="$xxx"
                                gethbadd_alen_type="$yyy"
-                               echo "Your system uses $xxx for the 1st argument to gethostbyaddr." >&4
-                               echo "and the the 2nd argument to gethostbyaddr is $yyy." >&4
+                               $cat >&4 <<EOM
+Your system uses $xxx for the 1st argument to gethostbyaddr.
+and the 2nd argument to gethostbyaddr is $yyy.
+EOM
                                break
                            fi
                    done
@@ -9303,7 +9327,7 @@ EOCP
                    gethbadd_addr_type="$ans"
 
                    # Remove the "const" if needed.
-                   gethbadd_addr_type=`echo $gethbadd_addr_type | sed 's/^const //'`
+                   gethbadd_addr_type=`echo "$gethbadd_addr_type" | sed 's/^const //'`
 
                    rp='What is the type for the 2nd argument to gethostbyaddr ?'
                    dflt="Size_t"
@@ -9311,6 +9335,11 @@ EOCP
                    gethbadd_alen_type="$ans"
            fi
            $rm -f try.[co]
+        else
+           $cat >&4 <<EOM
+Your system uses $gethbadd_addr_type for the 1st argument to gethostbyaddr.
+and the 2nd argument to gethostbyaddr is $gethbadd_alen_type.
+EOM
        fi
        ;;
 *)     gethbadd_addr_type='void *'
@@ -9323,7 +9352,7 @@ esac
 : getnetbyaddr.
 case "$d_getnbadd" in
 $define)
-        if test "X$getnbadd_addr_type" = X -o "X$getnbadd_alen_type" = X; then
+        if test "X$getnbadd_net_type" = X; then
            $cat <<EOM
 
 Checking to see what type of arguments are expected by getnetbyaddr().
@@ -9370,6 +9399,8 @@ EOCP
                    getnbadd_net_type="$ans"
            fi
            $rm -f try.[co]
+       else
+           echo "Your system uses $getnbadd_net_type for the 1st argument to getnetbyaddr." >&4
        fi
        ;;
 *)     getnbadd_net_type='long'
@@ -9919,51 +9950,87 @@ eval $setvar
 
 : test whether pthreads are created in joinable -- aka undetached -- state
 if test "X$usethreads" != X; then
-echo " "
-echo 'Checking whether pthreads are created joinable.' >&4
+    if test "X$d_pthreads_created_joinable" = X; then
+       echo >&4 "Checking whether pthreads are created joinable."
        $cat >try.c <<EOCP
-/* Note: this program returns 1 if detached, 0 if not.
- * Easier this way because the PTHREAD_CREATE_DETACHED is more
- * portable than the obsolete PTHREAD_CREATE_UNDETACHED.
- * Testing for joinable (aka undetached) as opposed to detached
- * is then again logically more sensible because that's
- * the more modern default state in the pthreads implementations. */
 #include <pthread.h>
 #include <stdio.h>
 int main() {
     pthread_attr_t attr;
     int detachstate;
-    pthread_attr_init(&attr);
-    pthread_attr_getdetachstate(&attr, &detachstate);
     printf("%s\n",
-           detachstate == PTHREAD_CREATE_DETACHED ?
-           "detached" : "joinable");
+       pthread_attr_init(&attr) == 0 &&
+        pthread_attr_getdetachstate(&attr, &detachstate) == 0 &&
+        detachstate == PTHREAD_CREATE_DETACHED ?
+        "detached" : "joinable");
     exit(0);
 }
 EOCP
-    if $cc $ccflags $ldflags -o try try.c $libs >/dev/null 2>&1; then
-       yyy=`./try`
-    else
-       echo "(I can't seem to compile the test program--assuming they are.)"
-       yyy=joinable
+       if $cc $ccflags $ldflags -o try try.c $libs >/dev/null 2>&1; then
+           yyy=`./try`
+           case "$yyy" in
+           detached)
+               echo "Nope, they aren't."
+               ;;
+           *)
+               echo "Yup, they are."
+               ;;
+           esac
+       else
+           echo "(I can't execute the test program--assuming they are.)"
+           yyy=joinable
+       fi
+       case "$yyy" in
+       detached)
+           val="$undef"
+           ;;
+       *)
+           val="$define"
+           ;;
+       esac
+       set d_pthreads_created_joinable
+       eval $setvar
+       $rm -f try try.*
     fi
-    case "$yyy" in
-    joinable)
-      val="$define"
-      echo "Yup, they are."
-      ;;
-    *)
-      val="$undef"
-      echo "Nope, they aren't."
-      ;;
-    esac
-    set d_pthreads_created_joinable
-    eval $setvar
-    $rm -f try try.*
 else
-    d_pthreads_created_joinable=$undef
+    d_pthreads_created_joinable="$undef"
 fi
 
+: see whether the various POSIXish _yields exist within given cccmd
+$cat >try.c <<EOP
+#include <pthread.h>
+main() {
+       YIELD();
+       exit(0);
+}
+EOP
+: see if pthread_yield exists within given cccmd,
+: if we do not usethreads this may well end up undef.
+if $cc $ccflags -DYIELD=pthread_yield $ldflags -o try try.c $libs > /dev/null 2>&1; then
+    val="$define"
+    echo 'pthread_yield() found.' >&4
+else
+    val="$undef"
+    echo 'pthread_yield() NOT found.' >&4
+fi
+set d_pthread_yield
+eval $setvar
+
+: see if sched_yield exists within given cccmd,
+: if we do not usethreads this may well end up undef.
+if $cc $ccflags -DYIELD=sched_yield $ldflags -o try try.c $libs > /dev/null 2>&1; then
+    val="$define"
+    echo 'sched_yield() found.' >&4
+else
+    val="$undef"
+    echo 'sched_yield() NOT found.' >&4
+fi
+set d_sched_yield
+eval $setvar
+
+: common to both the pthread_yield and sched_yield tests
+rm -f try try.*
+
 echo " "
 echo "Looking for extensions..." >&4
 cd ../ext
@@ -10001,35 +10068,35 @@ cd ../UU
 avail_ext=''
 for xxx in $known_extensions ; do
     case "$xxx" in
-    DB_File) case "$i_db" in 
+    DB_File|db_file) case "$i_db" in
            $define) avail_ext="$avail_ext $xxx" ;;
            esac
            ;;
-    GDBM_File) case "$i_gdbm" in 
+    GDBM_File|gdbm_fil) case "$i_gdbm" in 
            $define) avail_ext="$avail_ext $xxx" ;;
            esac
            ;;
-    NDBM_File) case "$i_ndbm" in 
+    NDBM_File|ndbm_fil) case "$i_ndbm" in
            $define) avail_ext="$avail_ext $xxx" ;;
            esac
            ;;
-    ODBM_File) case "${i_dbm}${i_rpcsvcdbm}" in 
+    ODBM_File|odbm_fil) case "${i_dbm}${i_rpcsvcdbm}" in
            *"${define}"*) avail_ext="$avail_ext $xxx" ;;
            esac
            ;;
-    POSIX) case "$useposix" in 
+    POSIX|posix) case "$useposix" in
            true|define|y) avail_ext="$avail_ext $xxx" ;;
            esac
            ;;
-    Opcode) case "$useopcode" in 
+    Opcode|opcode) case "$useopcode" in
            true|define|y) avail_ext="$avail_ext $xxx" ;;
            esac
            ;;
-    Socket) case "$d_socket" in 
+    Socket|socket) case "$d_socket" in 
            $define) avail_ext="$avail_ext $xxx" ;;
            esac
            ;;
-    Thread) case "$usethreads" in 
+    Thread|thread) case "$usethreads" in 
            $define) avail_ext="$avail_ext $xxx" ;;
            esac
            ;;
@@ -10340,6 +10407,7 @@ d_pipe='$d_pipe'
 d_poll='$d_poll'
 d_portable='$d_portable'
 d_pthread_yield='$d_pthread_yield'
+d_pthreads_created_joinable='$d_pthreads_created_joinable'
 d_pwage='$d_pwage'
 d_pwchange='$d_pwchange'
 d_pwclass='$d_pwclass'
@@ -10608,7 +10676,6 @@ prefixexp='$prefixexp'
 privlib='$privlib'
 privlibexp='$privlibexp'
 prototype='$prototype'
-pthreads_created_joinable='$pthreads_created_joinable'
 randbits='$randbits'
 ranlib='$ranlib'
 rd_nodata='$rd_nodata'