added patch for overloading constants, made PERL_OBJECT-aware
[p5sagit/p5-mst-13.2.git] / Configure
index 65b1872..ffd7e08 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -20,7 +20,7 @@
 
 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
 #
-# Generated on Wed May 13 13:35:54 EDT 1998 [metaconfig 3.0 PL70]
+# Generated on Tue Jun  9 14:56:54 EDT 1998 [metaconfig 3.0 PL70]
 
 cat >/tmp/c1$$ <<EOF
 ARGGGHHHH!!!!!
@@ -140,13 +140,14 @@ esac
 
 : Configure runs within the UU subdirectory
 test -d UU || mkdir UU
-CDPATH=''
+CDPATH='.'
 cd UU && rm -f ./*
 
 dynamic_ext=''
 extensions=''
 known_extensions=''
 static_ext=''
+nonxs_ext=''
 useopcode=''
 useposix=''
 d_bsd=''
@@ -357,6 +358,7 @@ d_htonl=''
 d_inetaton=''
 d_isascii=''
 d_killpg=''
+d_lchown=''
 d_link=''
 d_locconv=''
 d_lockf=''
@@ -374,7 +376,7 @@ d_memmove=''
 d_memset=''
 d_mkdir=''
 d_mkfifo=''
-d_mkstemp=''
+d_mknod=''
 d_mktime=''
 d_msg=''
 d_msgctl=''
@@ -480,6 +482,9 @@ d_times=''
 d_truncate=''
 d_tzname=''
 d_umask=''
+d_semctl_semid_ds=''
+d_semctl_semun=''
+d_union_semun=''
 d_vfork=''
 usevfork=''
 d_voidsig=''
@@ -585,6 +590,7 @@ plibpth=''
 xlibpth=''
 libs=''
 lns=''
+devtype=''
 lseektype=''
 make_set_make=''
 d_mymalloc=''
@@ -917,6 +923,23 @@ else
 fi
 rm -f try
 
+
+: Save command line options in file UU/cmdline.opt for later use in
+: generating config.sh.
+cat > cmdline.opt <<EOSH
+# Configure command line arguments.
+config_arg0='$0'
+config_args='$*'
+config_argc=$#
+EOSH
+argn=1
+for arg in "$@"; do
+       cat >>cmdline.opt <<EOSH
+config_arg$argn='$arg'
+EOSH
+       argn=`expr $argn + 1`
+done
+
 : produce awk script to parse command line options
 cat >options.awk <<'EOF'
 BEGIN {
@@ -4020,15 +4043,19 @@ $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
 echo " "
 echo "Checking for GNU C Library..." >&4
 cat >gnulibc.c <<EOM
+#include <stdio.h>
 int
 main()
 {
-       return __libc_main();
+#ifdef __GLIBC__
+    exit(0);
+#else
+    exit(1);
+#endif
 }
 EOM
 set gnulibc
-if eval $compile && \
-  ./gnulibc | $contains '^GNU C Library'; then
+if eval $compile_ok && ./gnulibc; then
        val="$define"
        echo "You are using the GNU C Library"
 else
@@ -6192,10 +6219,14 @@ main()
        $xxx i32;
        double f, g;
        int result = 0;
+       char str[16];
        signal(SIGFPE, blech);
 
-       /* Don't let compiler optimize the test away */
-       sscanf("2147483647", "%lf", &f); /* f = (double) 0x7fffffff; */
+       /* Don't let compiler optimize the test away.  Store the number 
+          in a writable string for gcc to pass to sscanf under HP/UX.
+       */
+       sprintf(str, "2147483647");
+       sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
        g = 10 * f;
        i32  = ($xxx) g;
 
@@ -6248,11 +6279,17 @@ main()
        unsigned int aint;
        unsigned short ashort;
        int result = 0;
+       char str[16];
+       
        /* Frustrate gcc-2.7.2's optimizer which failed this test with
           a direct f = -123. assignment.  gcc-2.8.0 reportedly
           optimized the whole file away
        */
-       sscanf("-123.", "%lf", &f);  /* f = -123.; */
+       /* Store the number in a writable string for gcc to pass to 
+          sscanf under HP/UX.
+       */
+       sprintf(str, "-123");
+       sscanf(str, "%lf", &f);  /* f = -123.; */
 
        signal(SIGFPE, blech);
        along = (unsigned long)f;
@@ -6264,7 +6301,8 @@ main()
                result |= 1;
        if (ashort != (unsigned short)-123)
                result |= 1;
-       sscanf("1073741824.", "%lf", &f); /* f = (double)0x40000000; */
+       sprintf(str, "1073741824.");
+       sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
        f = f + f;
        along = 0;
        along = (unsigned long)f;
@@ -6283,7 +6321,8 @@ main()
        if (result)
                exit(result);
        signal(SIGFPE, blech_in_list);
-       sscanf("123.", "%lf", &f);  /* f = 123.; */
+       sprintf(str, "123.");
+       sscanf(str, "%lf", &f);  /* f = 123.; */
        along = dummy_long((unsigned long)f);
        aint = dummy_int((unsigned int)f);
        ashort = dummy_short((unsigned short)f);
@@ -7190,6 +7229,38 @@ $rm -f isascii*
 set killpg d_killpg
 eval $inlibc
 
+: see if lchown exists
+echo " "
+$cat > try.c <<'EOCP'
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char lchown(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char lchown();
+int main() {
+    /*  The GNU C library defines this for functions which it implements
+        to always fail with ENOSYS.  Some functions are actually named
+       something starting with __ and the normal name is an alias.  */
+#if defined (__stub_lchown) || defined (__stub___lchown)
+choke me
+#else
+lchown();
+#endif
+; return 0; }
+EOCP
+set try
+if eval $compile; then
+    $echo "lchown() found." >&4
+    val="$define"
+else
+    $echo "lchown() NOT found." >&4
+    val="$undef"
+fi
+set d_lchown
+eval $setvar
+
 : see if link exists
 set link d_link
 eval $inlibc
@@ -7328,8 +7399,8 @@ eval $inlibc
 set mkfifo d_mkfifo
 eval $inlibc
 
-: see if mkstemp exists
-set mkstemp d_mkstemp
+: see if mknod exists
+set mknod d_mknod
 eval $inlibc
 
 : see if mktime exists
@@ -7912,6 +7983,165 @@ fi
 set d_sem
 eval $setvar
 
+: see whether sys/sem.h defines union semun
+echo " "
+$cat > try.c <<'END'
+#include <sys/types.h>
+#include <sys/ipc.h>
+#include <sys/sem.h>
+int main () { union semun semun; semun.buf = 0; }
+END
+set try
+if eval $compile; then
+    echo "You have union semun in <sys/sem.h>." >&4
+    val="$define"
+else
+    echo "You do not have union semun in <sys/sem.h>." >&4
+    val="$undef"
+fi
+$rm -f try try.c
+set d_union_semun
+eval $setvar
+
+: see how to do semctl IPC_STAT
+case "$d_sem" in
+$define)
+    : see whether semctl IPC_STAT can use union semun
+    echo " "
+    $cat > try.c <<END
+#include <sys/types.h>
+#include <sys/ipc.h>
+#include <sys/sem.h>
+#include <sys/stat.h>
+#include <stdio.h>
+#include <errno.h>
+#ifndef errno
+extern int errno;
+#endif
+#$d_union_semun HAS_UNION_SEMUN
+int main() {
+    union semun
+#ifndef HAS_UNION_SEMUN
+    {
+       int val;
+       struct semid_ds *buf;
+       unsigned short *array;
+    }
+#endif
+    arg;
+    int sem, st;
+
+#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
+    sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
+    if (sem > -1) {
+       struct semid_ds argbuf;
+       arg.buf = &argbuf;
+#      ifdef IPC_STAT
+       st = semctl(sem, 0, IPC_STAT, arg);
+       if (st == 0)
+           printf("semun\n");
+       else
+#      endif /* IPC_STAT */
+           printf("semctl IPC_STAT failed: errno = %d\n", errno);
+#      ifdef IPC_RMID
+       if (semctl(sem, 0, IPC_RMID, arg) != 0)
+#      endif /* IPC_RMID */
+           printf("semctl IPC_RMID failed: errno = %d\n", errno);
+    } else
+#endif /* IPC_PRIVATE && ... */
+       printf("semget failed: errno = %d\n", errno);
+  return 0;
+}
+END
+    val="$undef"
+    set try
+    if eval $compile; then
+       xxx=`./try`
+        case "$xxx" in
+        semun) val="$define" ;;
+        esac
+    fi
+    $rm -f try try.c
+    set d_semctl_semun
+    eval $setvar
+    case "$d_semctl_semun" in
+    $define)
+        echo "You can use union semun for semctl IPC_STAT." >&4
+       also='also'
+        ;;
+    *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
+       also=''
+        ;;
+    esac
+
+    : see whether semctl IPC_STAT can use struct semid_ds pointer
+    $cat > try.c <<'END'
+#include <sys/types.h>
+#include <sys/ipc.h>
+#include <sys/sem.h>
+#include <sys/stat.h>
+#include <stdio.h>
+#include <errno.h>
+#ifndef errno
+extern int errno;
+#endif
+int main() {
+    struct semid_ds arg;
+    int sem, st;
+
+#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
+    sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
+    if (sem > -1) {
+#      ifdef IPC_STAT
+       st = semctl(sem, 0, IPC_STAT, &arg);
+       if (st == 0)
+           printf("semid_ds\n");
+       else
+#      endif /* IPC_STAT */
+           printf("semctl IPC_STAT failed: errno = %d\n", errno);
+#      ifdef IPC_RMID
+       if (semctl(sem, 0, IPC_RMID, &arg) != 0)
+#      endif /* IPC_RMID */
+           printf("semctl IPC_RMID failed: errno = %d\n", errno);
+    } else
+#endif /* IPC_PRIVATE && ... */
+       printf("semget failed: errno = %d\n", errno);
+
+    return 0;
+}
+END
+    val="$undef"
+    set try
+    if eval $compile; then
+        xxx=`./try`
+        case "$xxx" in
+        semid_ds) val="$define" ;;
+        esac
+    fi
+    $rm -f try try.c
+    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
+        ;;
+    *)  echo "You cannot use struct semid_ds * for semctl IPC_STAT." >&4
+        ;;
+    esac
+    ;;
+*)  val="$undef"
+
+    # We do not have the full sem*(2) library, so assume we can not
+    # use either.
+
+    set d_semctl_semun
+    eval $setvar
+
+    set d_semctl_semid_ds
+    eval $setvar
+    ;;
+esac
+
 : see if setegid exists
 set setegid d_setegid
 eval $inlibc
@@ -9250,6 +9480,11 @@ EOM
 *)  groupstype="$gidtype";;
 esac
 
+: see what type is used for devices
+rp="What is the type used for device numbers on this system?"
+set dev_t devtype long stdio.h sys/types.h
+eval $typedef_ask
+
 : see what type lseek is declared as in the kernel
 rp="What is the type used for lseek's offset on this system?"
 set off_t lseektype long stdio.h sys/types.h
@@ -10644,6 +10879,7 @@ cd $rsrc/ext
 : If we are using the old config.sh, known_extensions may contain
 : old or inaccurate or duplicate values.
 known_extensions=''
+nonxs_extensions=''
 : We do not use find because it might not be available.
 : We do not just use MANIFEST because the user may have dropped
 : some additional extensions into the source tree and expect them
@@ -10656,17 +10892,27 @@ for xxx in * ; do
                else
                        if $test -d $xxx; then
                                cd $xxx
+                               zzz=$known_extensions
                                for yyy in * ; do
                                if $test -f $yyy/$yyy.xs; then
                                        known_extensions="$known_extensions $xxx/$yyy"
                                fi
                                done
                                cd ..
+                               if $test "$zzz" = "$known_extensions"; then
+                                       if $test -f $xxx/Makefile.PL; then
+                                               known_extensions="$known_extensions $xxx"
+                                               nonxs_extensions="$nonxs_extensions $xxx"
+                                       fi
+                               fi
                        fi
                fi 
                ;;
        esac
 done
+set X $nonxs_extensions
+shift
+nonxs_extensions="$*"
 set X $known_extensions
 shift
 known_extensions="$*"
@@ -10716,7 +10962,11 @@ for xxx in $known_extensions ; do
                true|$define|y) avail_ext="$avail_ext $xxx" ;;
                esac
                ;;
-       *)      avail_ext="$avail_ext $xxx"
+       *)
+               case " $nonxs_extensions " in
+               *" $xxx "*) ;;
+               *) avail_ext="$avail_ext $xxx" ;;
+               esac
                ;;
        esac
 done
@@ -10725,6 +10975,19 @@ set X $avail_ext
 shift
 avail_ext="$*"
 
+: Now see which nonxs extensions are supported on this system.
+nonxs_ext=''
+for xxx in $nonxs_extensions ; do
+       case "$xxx" in
+       *)      nonxs_ext="$nonxs_ext $xxx"
+               ;;
+       esac
+done
+
+set X $nonxs_ext
+shift
+nonxs_ext="$*"
+
 case $usedl in
 $define)
        $cat <<EOM
@@ -10755,6 +11018,7 @@ EOM
                esac
                ;;
        esac
+       : Exclude those that are not xs extensions
        case "$dflt" in
        '')     dflt=none;;
        esac
@@ -10770,7 +11034,7 @@ EOM
                : Exclude those already listed in dynamic linking
                dflt=''
                for xxx in $avail_ext; do
-                       case " $dynamic_ext " in
+                       case " $dynamic_ext $nonxs_ext " in
                        *" $xxx "*) ;;
                        *) dflt="$dflt $xxx" ;;
                        esac
@@ -11043,6 +11307,7 @@ d_index='$d_index'
 d_inetaton='$d_inetaton'
 d_isascii='$d_isascii'
 d_killpg='$d_killpg'
+d_lchown='$d_lchown'
 d_link='$d_link'
 d_locconv='$d_locconv'
 d_lockf='$d_lockf'
@@ -11058,7 +11323,7 @@ d_memmove='$d_memmove'
 d_memset='$d_memset'
 d_mkdir='$d_mkdir'
 d_mkfifo='$d_mkfifo'
-d_mkstemp='$d_mkstemp'
+d_mknod='$d_mknod'
 d_mktime='$d_mktime'
 d_msg='$d_msg'
 d_msgctl='$d_msgctl'
@@ -11098,6 +11363,8 @@ d_seekdir='$d_seekdir'
 d_select='$d_select'
 d_sem='$d_sem'
 d_semctl='$d_semctl'
+d_semctl_semid_ds='$d_semctl_semid_ds'
+d_semctl_semun='$d_semctl_semun'
 d_semget='$d_semget'
 d_semop='$d_semop'
 d_setegid='$d_setegid'
@@ -11162,6 +11429,7 @@ d_truncate='$d_truncate'
 d_tzname='$d_tzname'
 d_umask='$d_umask'
 d_uname='$d_uname'
+d_union_semun='$d_union_semun'
 d_vfork='$d_vfork'
 d_void_closedir='$d_void_closedir'
 d_voidsig='$d_voidsig'
@@ -11177,6 +11445,7 @@ date='$date'
 db_hashtype='$db_hashtype'
 db_prefixtype='$db_prefixtype'
 defvoidused='$defvoidused'
+devtype='$devtype'
 direntrytype='$direntrytype'
 dlext='$dlext'
 dlsrc='$dlsrc'
@@ -11348,6 +11617,7 @@ path_sep='$path_sep'
 perl='$perl'
 perladmin='$perladmin'
 perlpath='$perlpath'
+nonxs_ext='$nonxs_ext'
 pg='$pg'
 phostname='$phostname'
 pidtype='$pidtype'
@@ -11444,6 +11714,9 @@ zcat='$zcat'
 zip='$zip'
 EOT
 
+: Add in command line options if available
+$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
+
 : add special variables
 $test -f $src/patchlevel.h && \
 awk '/^#define/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh