diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1998-01-16 12:13:05 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1998-01-16 12:13:05 +0000 |
commit | 3db12e8b236ac8f88db8eb4690d10e4a3b8dbcd4 (patch) | |
tree | b3c086e437cab449f90ba637710daed0ddfec4c4 | |
parent | 4207990990f8c8da414710816c32ae5fd0ae6987 (diff) |
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | array.c | 4 | ||||
-rw-r--r-- | bignum.c | 4 | ||||
-rw-r--r-- | class.c | 4 | ||||
-rw-r--r-- | compar.c | 4 | ||||
-rw-r--r--[-rwxr-xr-x] | config.guess | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | config.sub | 0 | ||||
-rw-r--r-- | configure | 4038 | ||||
-rw-r--r-- | configure.bat | 10 | ||||
-rw-r--r-- | defines.h | 4 | ||||
-rw-r--r-- | dir.c | 4 | ||||
-rw-r--r-- | dln.c | 4 | ||||
-rw-r--r-- | dln.h | 6 | ||||
-rw-r--r-- | enum.c | 4 | ||||
-rw-r--r-- | env.h | 6 | ||||
-rw-r--r-- | error.c | 4 | ||||
-rw-r--r-- | eval.c | 4 | ||||
-rw-r--r-- | ext/Setup.nt | 24 | ||||
-rw-r--r-- | ext/dbm/dbm.c | 4 | ||||
-rw-r--r-- | ext/etc/etc.c | 4 | ||||
-rw-r--r-- | ext/fcntl/fcntl.c | 2 | ||||
-rw-r--r-- | ext/md5/md5init.c | 2 | ||||
-rw-r--r-- | ext/socket/socket.c | 4 | ||||
-rw-r--r-- | ext/tkutil/tkutil.c | 4 | ||||
-rw-r--r-- | file.c | 4 | ||||
-rw-r--r-- | gc.c | 4 | ||||
-rw-r--r-- | hash.c | 4 | ||||
-rw-r--r-- | inits.c | 4 | ||||
-rw-r--r--[-rwxr-xr-x] | install-sh | 0 | ||||
-rw-r--r-- | io.c | 4 | ||||
-rw-r--r-- | io.h | 6 | ||||
-rw-r--r-- | lib/e2mmap1_0.rb | 6 | ||||
-rw-r--r-- | lib/getopts.rb | 6 | ||||
-rw-r--r-- | lib/parsearg.rb | 6 | ||||
-rw-r--r-- | lib/sync.rb | 6 | ||||
-rw-r--r-- | lib/thread.rb | 2 | ||||
-rw-r--r-- | lib/tk.rb | 2 | ||||
-rw-r--r-- | lib/tkcanvas.rb | 2 | ||||
-rw-r--r-- | lib/tkclass.rb | 2 | ||||
-rw-r--r-- | lib/tkcore.rb | 2 | ||||
-rw-r--r-- | lib/tkentry.rb | 2 | ||||
-rw-r--r-- | lib/tkscrollbox.rb | 2 | ||||
-rw-r--r-- | lib/tktext.rb | 2 | ||||
-rw-r--r-- | lib/tkthcore.rb | 2 | ||||
-rw-r--r-- | main.c | 4 | ||||
-rw-r--r-- | math.c | 4 | ||||
-rw-r--r-- | missing/dir.h | 370 | ||||
-rw-r--r-- | missing/file.h | 63 | ||||
-rw-r--r-- | missing/nt.c | 4382 | ||||
-rw-r--r-- | missing/nt.h | 10 | ||||
-rw-r--r-- | missing/setenv.c | 8 | ||||
-rw-r--r-- | missing/strdup.c | 4 | ||||
-rw-r--r-- | missing/strstr.c | 2 | ||||
-rw-r--r-- | node.h | 4 | ||||
-rw-r--r-- | numeric.c | 4 | ||||
-rw-r--r-- | object.c | 4 | ||||
-rw-r--r-- | pack.c | 4 | ||||
-rw-r--r-- | parse.y | 4 | ||||
-rw-r--r-- | process.c | 4 | ||||
-rw-r--r-- | random.c | 4 | ||||
-rw-r--r-- | range.c | 4 | ||||
-rw-r--r-- | re.c | 4 | ||||
-rw-r--r-- | re.h | 6 | ||||
-rw-r--r-- | ruby.c | 4 | ||||
-rw-r--r-- | ruby.h | 4 | ||||
-rw-r--r-- | sample/biorhythm.rb | 4 | ||||
-rw-r--r--[-rwxr-xr-x] | sample/from.rb | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | sample/getopts.test | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | sample/less.rb | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | sample/mpart.rb | 0 | ||||
-rw-r--r-- | sample/ruby-mode.el | 2 | ||||
-rw-r--r--[-rwxr-xr-x] | sample/time.rb | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | sample/uumerge.rb | 0 | ||||
-rw-r--r-- | sig.h | 2 | ||||
-rw-r--r-- | signal.c | 4 | ||||
-rw-r--r-- | sprintf.c | 4 | ||||
-rw-r--r-- | string.c | 4 | ||||
-rw-r--r-- | struct.c | 4 | ||||
-rw-r--r-- | time.c | 4 | ||||
-rw-r--r-- | variable.c | 4 | ||||
-rw-r--r-- | version.c | 6 | ||||
-rw-r--r-- | win32/Makefile | 466 | ||||
-rwxr-xr-x[-rw-r--r--] | win32/ntsetup.bat | 20 | ||||
-rw-r--r-- | win32/ruby.def | 110 | ||||
-rw-r--r-- | x68/_dtos18.c | 2 | ||||
-rw-r--r-- | x68/_round.c | 2 | ||||
-rw-r--r-- | x68/fconvert.c | 2 |
86 files changed, 6894 insertions, 2855 deletions
@@ -2,8 +2,8 @@ array.c - - $Author: matz $ - $Date: 1996/12/25 10:42:18 $ + $Author$ + $Date$ created at: Fri Aug 6 09:46:12 JST 1993 Copyright (C) 1993-1996 Yukihiro Matsumoto @@ -2,8 +2,8 @@ bignum.c - - $Author: matz $ - $Date: 1996/12/25 10:42:19 $ + $Author$ + $Date$ created at: Fri Jun 10 00:48:55 JST 1994 ************************************************/ @@ -2,8 +2,8 @@ class.c - - $Author: matz $ - $Date: 1996/12/25 08:54:44 $ + $Author$ + $Date$ created at: Tue Aug 10 15:05:44 JST 1993 Copyright (C) 1993-1995 Yukihiro Matsumoto @@ -2,8 +2,8 @@ compar.c - - $Author: matz $ - $Date: 1996/12/25 09:19:05 $ + $Author$ + $Date$ created at: Thu Aug 26 14:39:48 JST 1993 Copyright (C) 1993-1996 Yukihiro Matsumoto diff --git a/config.guess b/config.guess index 91dad5ee6a..91dad5ee6a 100755..100644 --- a/config.guess +++ b/config.guess diff --git a/config.sub b/config.sub index 002d408812..002d408812 100755..100644 --- a/config.sub +++ b/config.sub diff --git a/configure b/configure new file mode 100644 index 0000000000..dd18efc8b4 --- /dev/null +++ b/configure @@ -0,0 +1,4038 @@ +#! /bin/sh + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.12 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: +ac_help="$ac_help +--without-gcc never use gcc" +ac_help="$ac_help +--disable-thread never use user-level thread" +ac_help="$ac_help +--enable-fat-binary build a NeXT Multi Architecture Binary. " +ac_help="$ac_help +--with-dln-a-out use dln_a_out if possible" +ac_help="$ac_help +--with-static-linked-ext link external modules statically" + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Initialize some other variables. +subdirs= +MFLAGS= MAKEFLAGS= +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 + +ac_prev= +for ac_option +do + + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$ac_optarg" ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file="$ac_optarg" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix="$ac_optarg" ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he) + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat << EOF +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names +EOF + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$ac_optarg" ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir="$ac_optarg" ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir="$ac_optarg" ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir="$ac_optarg" ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir="$ac_optarg" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir="$ac_optarg" ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir="$ac_optarg" ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir="$ac_optarg" ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix="$ac_optarg" ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix="$ac_optarg" ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix="$ac_optarg" ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name="$ac_optarg" ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir="$ac_optarg" ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir="$ac_optarg" ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site="$ac_optarg" ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir="$ac_optarg" ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir="$ac_optarg" ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.12" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval "with_${ac_package}=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes="$ac_optarg" ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries="$ac_optarg" ;; + + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *) + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" + ;; + + esac +done + +if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +fi + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac +done + +# NLS nuisances. +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. +if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo > confdefs.h + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file=ruby.h + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says [email protected]. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + + + +# Check whether --with-gcc or --without-gcc was given. +if test "${with_gcc+set}" = set; then + withval="$with_gcc" + + case $withval in + no) CC=cc + without_gcc=yes;; + yes) CC=gcc + without_gcc=no;; + *) CC=$withval + without_gcc=$withval;; + esac +else + without_gcc=no +fi + +if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC" +then + { echo "configure: error: cached CC is different -- throw away $cache_file +(it is also a good idea to do 'make clean' before compiling)" 1>&2; exit 1; } +fi + +rb_thread=yes +# Check whether --enable-thread or --disable-thread was given. +if test "${enable_thread+set}" = set; then + enableval="$enable_thread" + + rb_thread=$enableval + +fi + +if test $rb_thread = yes; then + cat >> confdefs.h <<\EOF +#define THREAD 1 +EOF + +fi + +ac_aux_dir= +for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + + +# Make sure we can run config.sub. +if $ac_config_sub sun4 >/dev/null 2>&1; then : +else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } +fi + +echo $ac_n "checking host system type""... $ac_c" 1>&6 +echo "configure:597: checking host system type" >&5 + +host_alias=$host +case "$host_alias" in +NONE) + case $nonopt in + NONE) + if host_alias=`$ac_config_guess`; then : + else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } + fi ;; + *) host_alias=$nonopt ;; + esac ;; +esac + +host=`$ac_config_sub $host_alias` +host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$host" 1>&6 + + + +fat_binary=no +# Check whether --enable-fat-binary or --disable-fat-binary was given. +if test "${enable_fat_binary+set}" = set; then + enableval="$enable_fat_binary" + fat_binary=$enableval +fi + +if test "$fat_binary" = yes ; then + + echo $ac_n "checking target architecture ""... $ac_c" 1>&6 +echo "configure:629: checking target architecture " >&5 + + if test "$TARGET_ARCHS" = "" ; then + if test `/usr/bin/arch` = "m68k" ; then + TARGET_ARCHS="m68k i486" + else + TARGET_ARCHS="m68k `/usr/bin/arch`" + fi + fi + # /usr/lib/arch_tool -archify_list $TARGET_ARCHS + for archs in $TARGET_ARCHS + do + ARCH_FLAG="$ARCH_FLAG -arch $archs " + echo -n " $archs" + done + cat >> confdefs.h <<\EOF +#define NEXT_FAT_BINARY 1 +EOF + + echo "." +fi + + +if test "$program_transform_name" = s,x,x,; then + program_transform_name= +else + # Double any \ or $. echo might interpret backslashes. + cat <<\EOF_SED > conftestsed +s,\\,\\\\,g; s,\$,$$,g +EOF_SED + program_transform_name="`echo $program_transform_name|sed -f conftestsed`" + rm -f conftestsed +fi +test "$program_prefix" != NONE && + program_transform_name="s,^,${program_prefix},; $program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s,\$\$,${program_suffix},; $program_transform_name" + +# sed with no file args requires a program. +test "$program_transform_name" = "" && program_transform_name="s,x,x," + + +# Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:675: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:704: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + ac_prog_rejected=no + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_save_ifs" +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# -gt 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 +echo "configure:752: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +cat > conftest.$ac_ext <<EOF +#line 762 "configure" +#include "confdefs.h" +main(){return(0);} +EOF +if { (eval echo configure:766: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + ac_cv_prog_cc_works=yes + # If we can't run a trivial program, we are probably using a cross compiler. + if (./conftest; exit) 2>/dev/null; then + ac_cv_prog_cc_cross=no + else + ac_cv_prog_cc_cross=yes + fi +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_prog_cc_works=no +fi +rm -fr conftest* + +echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 +if test $ac_cv_prog_cc_works = no; then + { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } +fi +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 +echo "configure:786: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 +cross_compiling=$ac_cv_prog_cc_cross + +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +echo "configure:791: checking whether we are using GNU C" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <<EOF +#ifdef __GNUC__ + yes; +#endif +EOF +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:800: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + +if test $ac_cv_prog_gcc = yes; then + GCC=yes + ac_test_CFLAGS="${CFLAGS+set}" + ac_save_CFLAGS="$CFLAGS" + CFLAGS= + echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +echo "configure:815: checking whether ${CC-cc} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_cc_g=yes +else + ac_cv_prog_cc_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 + if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" + elif test $ac_cv_prog_cc_g = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-O2" + fi +else + GCC= + test "${CFLAGS+set}" = set || CFLAGS="-g" +fi + +echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 +echo "configure:843: checking how to run the C preprocessor" >&5 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then +if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + # This must be in double quotes, not single quotes, because CPP may get + # substituted into the Makefile and "${CC-cc}" will confuse make. + CPP="${CC-cc} -E" + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. + cat > conftest.$ac_ext <<EOF +#line 858 "configure" +#include "confdefs.h" +#include <assert.h> +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:864: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP="${CC-cc} -E -traditional-cpp" + cat > conftest.$ac_ext <<EOF +#line 875 "configure" +#include "confdefs.h" +#include <assert.h> +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:881: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP=/lib/cpp +fi +rm -f conftest* +fi +rm -f conftest* + ac_cv_prog_CPP="$CPP" +fi + CPP="$ac_cv_prog_CPP" +else + ac_cv_prog_CPP="$CPP" +fi +echo "$ac_t""$CPP" 1>&6 + +if test $ac_cv_prog_gcc = yes; then + echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6 +echo "configure:905: checking whether ${CC-cc} needs -traditional" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_pattern="Autoconf.*'x'" + cat > conftest.$ac_ext <<EOF +#line 911 "configure" +#include "confdefs.h" +#include <sgtty.h> +Autoconf TIOCGETP +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "$ac_pattern" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_prog_gcc_traditional=yes +else + rm -rf conftest* + ac_cv_prog_gcc_traditional=no +fi +rm -f conftest* + + + if test $ac_cv_prog_gcc_traditional = no; then + cat > conftest.$ac_ext <<EOF +#line 929 "configure" +#include "confdefs.h" +#include <termio.h> +Autoconf TCGETA +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "$ac_pattern" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_prog_gcc_traditional=yes +fi +rm -f conftest* + + fi +fi + +echo "$ac_t""$ac_cv_prog_gcc_traditional" 1>&6 + if test $ac_cv_prog_gcc_traditional = yes; then + CC="$CC -traditional" + fi +fi + +for ac_prog in 'bison -y' byacc +do +# Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:955: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_YACC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$YACC"; then + ac_cv_prog_YACC="$YACC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_YACC="$ac_prog" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +YACC="$ac_cv_prog_YACC" +if test -n "$YACC"; then + echo "$ac_t""$YACC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +test -n "$YACC" && break +done +test -n "$YACC" || YACC="yacc" + +# Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:987: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="ranlib" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +for ac_prog in ar aal +do +# Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1019: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_AR="$ac_prog" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +AR="$ac_cv_prog_AR" +if test -n "$AR"; then + echo "$ac_t""$AR" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +test -n "$AR" && break +done +test -n "$AR" || AR="ar" + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:1059: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + for ac_prog in ginstall installbsd scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + # OSF/1 installbsd also uses dspmsg, but is usable. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 +echo "configure:1109: checking whether ${MAKE-make} sets \${MAKE}" >&5 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftestmake <<\EOF +all: + @echo 'ac_maketemp="${MAKE}"' +EOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftestmake +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$ac_t""yes" 1>&6 + SET_MAKE= +else + echo "$ac_t""no" 1>&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + + +# checks for UNIX variants that set C preprocessor variables +ac_safe=`echo "minix/config.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for minix/config.h""... $ac_c" 1>&6 +echo "configure:1139: checking for minix/config.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1144 "configure" +#include "confdefs.h" +#include <minix/config.h> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1149: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + MINIX=yes +else + echo "$ac_t""no" 1>&6 +MINIX= +fi + +if test "$MINIX" = yes; then + cat >> confdefs.h <<\EOF +#define _POSIX_SOURCE 1 +EOF + + cat >> confdefs.h <<\EOF +#define _POSIX_1_SOURCE 2 +EOF + + cat >> confdefs.h <<\EOF +#define _MINIX 1 +EOF + +fi + + +case "$host_os" in +nextstep*) ;; +human*) ;; +*) LIBS="-lm $LIBS";; +esac +echo $ac_n "checking for crypt in -lcrypt""... $ac_c" 1>&6 +echo "configure:1193: checking for crypt in -lcrypt" >&5 +ac_lib_var=`echo crypt'_'crypt | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lcrypt $LIBS" +cat > conftest.$ac_ext <<EOF +#line 1201 "configure" +#include "confdefs.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 crypt(); + +int main() { +crypt() +; return 0; } +EOF +if { (eval echo configure:1212: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo crypt | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <<EOF +#define $ac_tr_lib 1 +EOF + + LIBS="-lcrypt $LIBS" + +else + echo "$ac_t""no" 1>&6 +fi + +echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6 +echo "configure:1240: checking for dlopen in -ldl" >&5 +ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-ldl $LIBS" +cat > conftest.$ac_ext <<EOF +#line 1248 "configure" +#include "confdefs.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 dlopen(); + +int main() { +dlopen() +; return 0; } +EOF +if { (eval echo configure:1259: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo dl | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <<EOF +#define $ac_tr_lib 1 +EOF + + LIBS="-ldl $LIBS" + +else + echo "$ac_t""no" 1>&6 +fi + # Dynamic linking for SunOS/Solaris and SYSV +echo $ac_n "checking for shl_load in -ldld""... $ac_c" 1>&6 +echo "configure:1287: checking for shl_load in -ldld" >&5 +ac_lib_var=`echo dld'_'shl_load | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-ldld $LIBS" +cat > conftest.$ac_ext <<EOF +#line 1295 "configure" +#include "confdefs.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 shl_load(); + +int main() { +shl_load() +; return 0; } +EOF +if { (eval echo configure:1306: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo dld | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <<EOF +#define $ac_tr_lib 1 +EOF + + LIBS="-ldld $LIBS" + +else + echo "$ac_t""no" 1>&6 +fi + # Dynamic linking for HP-UX + +ac_header_dirent=no +for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6 +echo "configure:1339: checking for $ac_hdr that defines DIR" >&5 +if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1344 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <$ac_hdr> +int main() { +DIR *dirp = 0; +; return 0; } +EOF +if { (eval echo configure:1352: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + eval "ac_cv_header_dirent_$ac_safe=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_dirent_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_dirent_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <<EOF +#define $ac_tr_hdr 1 +EOF + ac_header_dirent=$ac_hdr; break +else + echo "$ac_t""no" 1>&6 +fi +done +# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. +if test $ac_header_dirent = dirent.h; then +echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6 +echo "configure:1377: checking for opendir in -ldir" >&5 +ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-ldir $LIBS" +cat > conftest.$ac_ext <<EOF +#line 1385 "configure" +#include "confdefs.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 opendir(); + +int main() { +opendir() +; return 0; } +EOF +if { (eval echo configure:1396: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + LIBS="$LIBS -ldir" +else + echo "$ac_t""no" 1>&6 +fi + +else +echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6 +echo "configure:1418: checking for opendir in -lx" >&5 +ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lx $LIBS" +cat > conftest.$ac_ext <<EOF +#line 1426 "configure" +#include "confdefs.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 opendir(); + +int main() { +opendir() +; return 0; } +EOF +if { (eval echo configure:1437: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + LIBS="$LIBS -lx" +else + echo "$ac_t""no" 1>&6 +fi + +fi + +echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 +echo "configure:1460: checking for ANSI C header files" >&5 +if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1465 "configure" +#include "confdefs.h" +#include <stdlib.h> +#include <stdarg.h> +#include <string.h> +#include <float.h> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1473: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + rm -rf conftest* + ac_cv_header_stdc=yes +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. +cat > conftest.$ac_ext <<EOF +#line 1490 "configure" +#include "confdefs.h" +#include <string.h> +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "memchr" >/dev/null 2>&1; then + : +else + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. +cat > conftest.$ac_ext <<EOF +#line 1508 "configure" +#include "confdefs.h" +#include <stdlib.h> +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "free" >/dev/null 2>&1; then + : +else + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. +if test "$cross_compiling" = yes; then + : +else + cat > conftest.$ac_ext <<EOF +#line 1529 "configure" +#include "confdefs.h" +#include <ctype.h> +#define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int main () { int i; for (i = 0; i < 256; i++) +if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); +exit (0); } + +EOF +if { (eval echo configure:1540: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + : +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_header_stdc=no +fi +rm -fr conftest* +fi + +fi +fi + +echo "$ac_t""$ac_cv_header_stdc" 1>&6 +if test $ac_cv_header_stdc = yes; then + cat >> confdefs.h <<\EOF +#define STDC_HEADERS 1 +EOF + +fi + +for ac_hdr in stdlib.h unistd.h limits.h sys/file.h sys/ioctl.h pwd.h \ + sys/select.h sys/time.h sys/times.h sys/param.h sys/wait.h\ + syscall.h a.out.h string.h utime.h memory.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:1569: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1574 "configure" +#include "confdefs.h" +#include <$ac_hdr> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1579: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <<EOF +#define $ac_tr_hdr 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + + +echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6 +echo "configure:1607: checking for uid_t in sys/types.h" >&5 +if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1612 "configure" +#include "confdefs.h" +#include <sys/types.h> +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "uid_t" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_uid_t=yes +else + rm -rf conftest* + ac_cv_type_uid_t=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_type_uid_t" 1>&6 +if test $ac_cv_type_uid_t = no; then + cat >> confdefs.h <<\EOF +#define uid_t int +EOF + + cat >> confdefs.h <<\EOF +#define gid_t int +EOF + +fi + +echo $ac_n "checking for size_t""... $ac_c" 1>&6 +echo "configure:1641: checking for size_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1646 "configure" +#include "confdefs.h" +#include <sys/types.h> +#if STDC_HEADERS +#include <stdlib.h> +#include <stddef.h> +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_size_t=yes +else + rm -rf conftest* + ac_cv_type_size_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_size_t" 1>&6 +if test $ac_cv_type_size_t = no; then + cat >> confdefs.h <<\EOF +#define size_t unsigned +EOF + +fi + +echo $ac_n "checking for st_blksize in struct stat""... $ac_c" 1>&6 +echo "configure:1674: checking for st_blksize in struct stat" >&5 +if eval "test \"`echo '$''{'ac_cv_struct_st_blksize'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1679 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <sys/stat.h> +int main() { +struct stat s; s.st_blksize; +; return 0; } +EOF +if { (eval echo configure:1687: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_struct_st_blksize=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_struct_st_blksize=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_struct_st_blksize" 1>&6 +if test $ac_cv_struct_st_blksize = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_ST_BLKSIZE 1 +EOF + +fi + +save_LIBOJBS="$LIBOBJS" +echo $ac_n "checking for st_blocks in struct stat""... $ac_c" 1>&6 +echo "configure:1709: checking for st_blocks in struct stat" >&5 +if eval "test \"`echo '$''{'ac_cv_struct_st_blocks'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1714 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <sys/stat.h> +int main() { +struct stat s; s.st_blocks; +; return 0; } +EOF +if { (eval echo configure:1722: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_struct_st_blocks=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_struct_st_blocks=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_struct_st_blocks" 1>&6 +if test $ac_cv_struct_st_blocks = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_ST_BLOCKS 1 +EOF + +else + LIBOBJS="$LIBOBJS fileblocks.o" +fi + +LIBOBJS="$save_LIBOBJS" +echo $ac_n "checking for st_rdev in struct stat""... $ac_c" 1>&6 +echo "configure:1746: checking for st_rdev in struct stat" >&5 +if eval "test \"`echo '$''{'ac_cv_struct_st_rdev'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1751 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <sys/stat.h> +int main() { +struct stat s; s.st_rdev; +; return 0; } +EOF +if { (eval echo configure:1759: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_struct_st_rdev=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_struct_st_rdev=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_struct_st_rdev" 1>&6 +if test $ac_cv_struct_st_rdev = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_ST_RDEV 1 +EOF + +fi + + +echo $ac_n "checking size of short""... $ac_c" 1>&6 +echo "configure:1781: checking size of short" >&5 +if eval "test \"`echo '$''{'ac_cv_sizeof_short'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <<EOF +#line 1789 "configure" +#include "confdefs.h" +#include <stdio.h> +main() +{ + FILE *f=fopen("conftestval", "w"); + if (!f) exit(1); + fprintf(f, "%d\n", sizeof(short)); + exit(0); +} +EOF +if { (eval echo configure:1800: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + ac_cv_sizeof_short=`cat conftestval` +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_sizeof_short=0 +fi +rm -fr conftest* +fi + +fi +echo "$ac_t""$ac_cv_sizeof_short" 1>&6 +cat >> confdefs.h <<EOF +#define SIZEOF_SHORT $ac_cv_sizeof_short +EOF + + +echo $ac_n "checking size of int""... $ac_c" 1>&6 +echo "configure:1820: checking size of int" >&5 +if eval "test \"`echo '$''{'ac_cv_sizeof_int'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <<EOF +#line 1828 "configure" +#include "confdefs.h" +#include <stdio.h> +main() +{ + FILE *f=fopen("conftestval", "w"); + if (!f) exit(1); + fprintf(f, "%d\n", sizeof(int)); + exit(0); +} +EOF +if { (eval echo configure:1839: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + ac_cv_sizeof_int=`cat conftestval` +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_sizeof_int=0 +fi +rm -fr conftest* +fi + +fi +echo "$ac_t""$ac_cv_sizeof_int" 1>&6 +cat >> confdefs.h <<EOF +#define SIZEOF_INT $ac_cv_sizeof_int +EOF + + +echo $ac_n "checking size of long""... $ac_c" 1>&6 +echo "configure:1859: checking size of long" >&5 +if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <<EOF +#line 1867 "configure" +#include "confdefs.h" +#include <stdio.h> +main() +{ + FILE *f=fopen("conftestval", "w"); + if (!f) exit(1); + fprintf(f, "%d\n", sizeof(long)); + exit(0); +} +EOF +if { (eval echo configure:1878: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + ac_cv_sizeof_long=`cat conftestval` +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_sizeof_long=0 +fi +rm -fr conftest* +fi + +fi +echo "$ac_t""$ac_cv_sizeof_long" 1>&6 +cat >> confdefs.h <<EOF +#define SIZEOF_LONG $ac_cv_sizeof_long +EOF + + +echo $ac_n "checking size of void*""... $ac_c" 1>&6 +echo "configure:1898: checking size of void*" >&5 +if eval "test \"`echo '$''{'ac_cv_sizeof_voidp'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <<EOF +#line 1906 "configure" +#include "confdefs.h" +#include <stdio.h> +main() +{ + FILE *f=fopen("conftestval", "w"); + if (!f) exit(1); + fprintf(f, "%d\n", sizeof(void*)); + exit(0); +} +EOF +if { (eval echo configure:1917: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + ac_cv_sizeof_voidp=`cat conftestval` +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_sizeof_voidp=0 +fi +rm -fr conftest* +fi + +fi +echo "$ac_t""$ac_cv_sizeof_voidp" 1>&6 +cat >> confdefs.h <<EOF +#define SIZEOF_VOIDP $ac_cv_sizeof_voidp +EOF + + + +echo $ac_n "checking type of array argument to getgroups""... $ac_c" 1>&6 +echo "configure:1938: checking type of array argument to getgroups" >&5 +if eval "test \"`echo '$''{'ac_cv_type_getgroups'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + ac_cv_type_getgroups=cross +else + cat > conftest.$ac_ext <<EOF +#line 1946 "configure" +#include "confdefs.h" + +/* Thanks to Mike Rendell for this test. */ +#include <sys/types.h> +#define NGID 256 +#undef MAX +#define MAX(x, y) ((x) > (y) ? (x) : (y)) +main() +{ + gid_t gidset[NGID]; + int i, n; + union { gid_t gval; long lval; } val; + + val.lval = -1; + for (i = 0; i < NGID; i++) + gidset[i] = val.gval; + n = getgroups (sizeof (gidset) / MAX (sizeof (int), sizeof (gid_t)) - 1, + gidset); + /* Exit non-zero if getgroups seems to require an array of ints. This + happens when gid_t is short but getgroups modifies an array of ints. */ + exit ((n > 0 && gidset[n] != val.gval) ? 1 : 0); +} + +EOF +if { (eval echo configure:1971: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + ac_cv_type_getgroups=gid_t +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_type_getgroups=int +fi +rm -fr conftest* +fi + +if test $ac_cv_type_getgroups = cross; then + cat > conftest.$ac_ext <<EOF +#line 1985 "configure" +#include "confdefs.h" +#include <unistd.h> +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "getgroups.*int.*gid_t" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_getgroups=gid_t +else + rm -rf conftest* + ac_cv_type_getgroups=int +fi +rm -f conftest* + +fi +fi + +echo "$ac_t""$ac_cv_type_getgroups" 1>&6 +cat >> confdefs.h <<EOF +#define GETGROUPS_T $ac_cv_type_getgroups +EOF + + +echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 +echo "configure:2009: checking return type of signal handlers" >&5 +if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2014 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <signal.h> +#ifdef signal +#undef signal +#endif +#ifdef __cplusplus +extern "C" void (*signal (int, void (*)(int)))(int); +#else +void (*signal ()) (); +#endif + +int main() { +int i; +; return 0; } +EOF +if { (eval echo configure:2031: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_type_signal=void +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_type_signal=int +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_type_signal" 1>&6 +cat >> confdefs.h <<EOF +#define RETSIGTYPE $ac_cv_type_signal +EOF + + +# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works +# for constant arguments. Useless! +echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6 +echo "configure:2052: checking for working alloca.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2057 "configure" +#include "confdefs.h" +#include <alloca.h> +int main() { +char *p = alloca(2 * sizeof(int)); +; return 0; } +EOF +if { (eval echo configure:2064: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + ac_cv_header_alloca_h=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_header_alloca_h=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_header_alloca_h" 1>&6 +if test $ac_cv_header_alloca_h = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_ALLOCA_H 1 +EOF + +fi + +echo $ac_n "checking for alloca""... $ac_c" 1>&6 +echo "configure:2085: checking for alloca" >&5 +if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2090 "configure" +#include "confdefs.h" + +#ifdef __GNUC__ +# define alloca __builtin_alloca +#else +# if HAVE_ALLOCA_H +# include <alloca.h> +# else +# ifdef _AIX + #pragma alloca +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ +char *alloca (); +# endif +# endif +# endif +#endif + +int main() { +char *p = (char *) alloca(1); +; return 0; } +EOF +if { (eval echo configure:2113: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + ac_cv_func_alloca_works=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_func_alloca_works=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_func_alloca_works" 1>&6 +if test $ac_cv_func_alloca_works = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_ALLOCA 1 +EOF + +fi + +if test $ac_cv_func_alloca_works = no; then + # The SVR3 libPW and SVR4 libucb both contain incompatible functions + # that cause trouble. Some versions do not even contain alloca or + # contain a buggy version. If you still want to use their alloca, + # use ar to extract alloca.o from them instead of compiling alloca.c. + ALLOCA=alloca.o + cat >> confdefs.h <<\EOF +#define C_ALLOCA 1 +EOF + + +echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 +echo "configure:2145: checking whether alloca needs Cray hooks" >&5 +if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2150 "configure" +#include "confdefs.h" +#if defined(CRAY) && ! defined(CRAY2) +webecray +#else +wenotbecray +#endif + +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "webecray" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_os_cray=yes +else + rm -rf conftest* + ac_cv_os_cray=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_os_cray" 1>&6 +if test $ac_cv_os_cray = yes; then +for ac_func in _getb67 GETB67 getb67; do + echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:2175: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2180 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); 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 $ac_func(); + +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_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:2203: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<EOF +#define CRAY_STACKSEG_END $ac_func +EOF + + break +else + echo "$ac_t""no" 1>&6 +fi + +done +fi + +echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 +echo "configure:2230: checking stack direction for C alloca" >&5 +if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + ac_cv_c_stack_direction=0 +else + cat > conftest.$ac_ext <<EOF +#line 2238 "configure" +#include "confdefs.h" +find_stack_direction () +{ + static char *addr = 0; + auto char dummy; + if (addr == 0) + { + addr = &dummy; + return find_stack_direction (); + } + else + return (&dummy > addr) ? 1 : -1; +} +main () +{ + exit (find_stack_direction() < 0); +} +EOF +if { (eval echo configure:2257: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + ac_cv_c_stack_direction=1 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_c_stack_direction=-1 +fi +rm -fr conftest* +fi + +fi + +echo "$ac_t""$ac_cv_c_stack_direction" 1>&6 +cat >> confdefs.h <<EOF +#define STACK_DIRECTION $ac_cv_c_stack_direction +EOF + +fi + +echo $ac_n "checking for pid_t""... $ac_c" 1>&6 +echo "configure:2279: checking for pid_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2284 "configure" +#include "confdefs.h" +#include <sys/types.h> +#if STDC_HEADERS +#include <stdlib.h> +#include <stddef.h> +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "pid_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_pid_t=yes +else + rm -rf conftest* + ac_cv_type_pid_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_pid_t" 1>&6 +if test $ac_cv_type_pid_t = no; then + cat >> confdefs.h <<\EOF +#define pid_t int +EOF + +fi + +ac_safe=`echo "vfork.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for vfork.h""... $ac_c" 1>&6 +echo "configure:2313: checking for vfork.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2318 "configure" +#include "confdefs.h" +#include <vfork.h> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:2323: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define HAVE_VFORK_H 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi + +echo $ac_n "checking for working vfork""... $ac_c" 1>&6 +echo "configure:2348: checking for working vfork" >&5 +if eval "test \"`echo '$''{'ac_cv_func_vfork_works'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + echo $ac_n "checking for vfork""... $ac_c" 1>&6 +echo "configure:2354: checking for vfork" >&5 +if eval "test \"`echo '$''{'ac_cv_func_vfork'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2359 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char vfork(); 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 vfork(); + +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_vfork) || defined (__stub___vfork) +choke me +#else +vfork(); +#endif + +; return 0; } +EOF +if { (eval echo configure:2382: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_func_vfork=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_vfork=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'vfork`\" = yes"; then + echo "$ac_t""yes" 1>&6 + : +else + echo "$ac_t""no" 1>&6 +fi + +else + cat > conftest.$ac_ext <<EOF +#line 2403 "configure" +#include "confdefs.h" +/* Thanks to Paul Eggert for this test. */ +#include <stdio.h> +#include <sys/types.h> +#include <sys/stat.h> +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif +#ifdef HAVE_VFORK_H +#include <vfork.h> +#endif +/* On some sparc systems, changes by the child to local and incoming + argument registers are propagated back to the parent. + The compiler is told about this with #include <vfork.h>, + but some compilers (e.g. gcc -O) don't grok <vfork.h>. + Test for this by using a static variable whose address + is put into a register that is clobbered by the vfork. */ +static +#ifdef __cplusplus +sparc_address_test (int arg) +#else +sparc_address_test (arg) int arg; +#endif +{ + static pid_t child; + if (!child) { + child = vfork (); + if (child < 0) { + perror ("vfork"); + _exit(2); + } + if (!child) { + arg = getpid(); + write(-1, "", 0); + _exit (arg); + } + } +} +main() { + pid_t parent = getpid (); + pid_t child; + + sparc_address_test (); + + child = vfork (); + + if (child == 0) { + /* Here is another test for sparc vfork register problems. + This test uses lots of local variables, at least + as many local variables as main has allocated so far + including compiler temporaries. 4 locals are enough for + gcc 1.40.3 on a Solaris 4.1.3 sparc, but we use 8 to be safe. + A buggy compiler should reuse the register of parent + for one of the local variables, since it will think that + parent can't possibly be used any more in this routine. + Assigning to the local variable will thus munge parent + in the parent process. */ + pid_t + p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(), + p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid(); + /* Convince the compiler that p..p7 are live; otherwise, it might + use the same hardware register for all 8 local variables. */ + if (p != p1 || p != p2 || p != p3 || p != p4 + || p != p5 || p != p6 || p != p7) + _exit(1); + + /* On some systems (e.g. IRIX 3.3), + vfork doesn't separate parent from child file descriptors. + If the child closes a descriptor before it execs or exits, + this munges the parent's descriptor as well. + Test for this by closing stdout in the child. */ + _exit(close(fileno(stdout)) != 0); + } else { + int status; + struct stat st; + + while (wait(&status) != child) + ; + exit( + /* Was there some problem with vforking? */ + child < 0 + + /* Did the child fail? (This shouldn't happen.) */ + || status + + /* Did the vfork/compiler bug occur? */ + || parent != getpid() + + /* Did the file descriptor bug occur? */ + || fstat(fileno(stdout), &st) != 0 + ); + } +} +EOF +if { (eval echo configure:2498: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + ac_cv_func_vfork_works=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_func_vfork_works=no +fi +rm -fr conftest* +fi + +fi + +echo "$ac_t""$ac_cv_func_vfork_works" 1>&6 +if test $ac_cv_func_vfork_works = no; then + cat >> confdefs.h <<\EOF +#define vfork fork +EOF + +fi + +for ac_func in dup2 setenv memmove mkdir strcasecmp strerror strftime\ + strstr strtoul strdup crypt flock +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:2524: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2529 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); 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 $ac_func(); + +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_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:2552: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + +else + echo "$ac_t""no" 1>&6 +LIBOBJS="$LIBOBJS ${ac_func}.o" +fi +done + + +for ac_func in fmod killpg random wait4 waitpid syscall getcwd\ + truncate chsize times utimes fcntl lockf setitimer\ + setruid seteuid setreuid setrgid setegid setregid\ + setpgrp2 getpgid getgroups getpriority\ + dlopen sigprocmask sigaction _setjmp +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:2585: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2590 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); 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 $ac_func(); + +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_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:2613: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +if test "$ac_cv_func_strftime" = no; then + echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6 +echo "configure:2639: checking whether struct tm is in sys/time.h or time.h" >&5 +if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2644 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <time.h> +int main() { +struct tm *tp; tp->tm_sec; +; return 0; } +EOF +if { (eval echo configure:2652: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_struct_tm=time.h +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_struct_tm=sys/time.h +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_struct_tm" 1>&6 +if test $ac_cv_struct_tm = sys/time.h; then + cat >> confdefs.h <<\EOF +#define TM_IN_SYS_TIME 1 +EOF + +fi + +echo $ac_n "checking for tm_zone in struct tm""... $ac_c" 1>&6 +echo "configure:2673: checking for tm_zone in struct tm" >&5 +if eval "test \"`echo '$''{'ac_cv_struct_tm_zone'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2678 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <$ac_cv_struct_tm> +int main() { +struct tm tm; tm.tm_zone; +; return 0; } +EOF +if { (eval echo configure:2686: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_struct_tm_zone=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_struct_tm_zone=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_struct_tm_zone" 1>&6 +if test "$ac_cv_struct_tm_zone" = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_TM_ZONE 1 +EOF + +else + echo $ac_n "checking for tzname""... $ac_c" 1>&6 +echo "configure:2706: checking for tzname" >&5 +if eval "test \"`echo '$''{'ac_cv_var_tzname'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2711 "configure" +#include "confdefs.h" +#include <time.h> +#ifndef tzname /* For SGI. */ +extern char *tzname[]; /* RS6000 and others reject char **tzname. */ +#endif +int main() { +atoi(*tzname); +; return 0; } +EOF +if { (eval echo configure:2721: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + ac_cv_var_tzname=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_var_tzname=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_var_tzname" 1>&6 + if test $ac_cv_var_tzname = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_TZNAME 1 +EOF + + fi +fi + + cat > conftest.$ac_ext <<EOF +#line 2743 "configure" +#include "confdefs.h" + +int main() { +extern int daylight; int i = daylight; +; return 0; } +EOF +if { (eval echo configure:2750: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + cat >> confdefs.h <<\EOF +#define HAVE_DAYLIGHT 1 +EOF + +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* +fi + +if test "$ac_cv_func_sigprocmask" = yes && test "$ac_cv_func_sigaction" = yes; then + cat >> confdefs.h <<\EOF +#define POSIX_SIGNAL 1 +EOF + +else + echo $ac_n "checking for BSD signal semantics""... $ac_c" 1>&6 +echo "configure:2770: checking for BSD signal semantics" >&5 + if eval "test \"`echo '$''{'rb_cv_bsd_signal'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <<EOF +#line 2778 "configure" +#include "confdefs.h" + +#include <stdio.h> +#include <signal.h> + +void +sig_handler(dummy) + int dummy; +{ +} + +int +main() +{ + signal(SIGINT, sig_handler); + kill(getpid(), SIGINT); + kill(getpid(), SIGINT); + return 0; +} + +EOF +if { (eval echo configure:2800: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + rb_cv_bsd_signal=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + rb_cv_bsd_signal=no +fi +rm -fr conftest* +fi + +fi + + echo "$ac_t""$rb_cv_bsd_signal" 1>&6 + if test "$rb_cv_bsd_signal" = yes; then + cat >> confdefs.h <<\EOF +#define BSD_SIGNAL 1 +EOF + + fi +fi + +if test "$ac_cv_func_setpgrp2" = yes; then + cat >> confdefs.h <<\EOF +#define BSD_GETPGRP getpgrp2 +EOF + + cat >> confdefs.h <<\EOF +#define BSD_SETPGRP setpgrp2 +EOF + +else + echo $ac_n "checking whether getpgrp() has arg""... $ac_c" 1>&6 +echo "configure:2834: checking whether getpgrp() has arg" >&5 + if eval "test \"`echo '$''{'rb_cv_bsdgetpgrp'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2839 "configure" +#include "confdefs.h" +#include <unistd.h> +int main() { +getpgrp(0); +; return 0; } +EOF +if { (eval echo configure:2846: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + rb_cv_bsdgetpgrp=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + rb_cv_bsdgetpgrp=no +fi +rm -f conftest* +fi + + echo "$ac_t""$rb_cv_bsdgetpgrp" 1>&6 + if test "$rb_cv_bsdgetpgrp" = yes; then + cat >> confdefs.h <<\EOF +#define BSD_GETPGRP getpgrp +EOF + + fi + + echo $ac_n "checking whether setpgrp() has args""... $ac_c" 1>&6 +echo "configure:2867: checking whether setpgrp() has args" >&5 + if eval "test \"`echo '$''{'rb_cv_bsdsetpgrp'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2872 "configure" +#include "confdefs.h" +#include <unistd.h> +int main() { +setpgrp(1, 1); +; return 0; } +EOF +if { (eval echo configure:2879: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + rb_cv_bsdsetpgrp=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + rb_cv_bsdsetpgrp=no +fi +rm -f conftest* +fi + + echo "$ac_t""$rb_cv_bsdsetpgrp" 1>&6 + if test "$rb_cv_bsdsetpgrp" = yes; then + cat >> confdefs.h <<\EOF +#define BSD_SETPGRP setpgrp +EOF + + fi +fi + +echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6 +echo "configure:2901: checking whether byte ordering is bigendian" >&5 +if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_cv_c_bigendian=unknown +# See if sys/param.h defines the BYTE_ORDER macro. +cat > conftest.$ac_ext <<EOF +#line 2908 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <sys/param.h> +int main() { + +#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN + bogus endian macros +#endif +; return 0; } +EOF +if { (eval echo configure:2919: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + # It does; now see whether it defined to BIG_ENDIAN or not. +cat > conftest.$ac_ext <<EOF +#line 2923 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <sys/param.h> +int main() { + +#if BYTE_ORDER != BIG_ENDIAN + not big endian +#endif +; return 0; } +EOF +if { (eval echo configure:2934: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_c_bigendian=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_c_bigendian=no +fi +rm -f conftest* +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* +if test $ac_cv_c_bigendian = unknown; then +if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <<EOF +#line 2954 "configure" +#include "confdefs.h" +main () { + /* Are we little or big endian? From Harbison&Steele. */ + union + { + long l; + char c[sizeof (long)]; + } u; + u.l = 1; + exit (u.c[sizeof (long) - 1] == 1); +} +EOF +if { (eval echo configure:2967: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + ac_cv_c_bigendian=no +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_c_bigendian=yes +fi +rm -fr conftest* +fi + +fi +fi + +echo "$ac_t""$ac_cv_c_bigendian" 1>&6 +if test $ac_cv_c_bigendian = yes; then + cat >> confdefs.h <<\EOF +#define WORDS_BIGENDIAN 1 +EOF + +fi + +echo $ac_n "checking whether char is unsigned""... $ac_c" 1>&6 +echo "configure:2991: checking whether char is unsigned" >&5 +if eval "test \"`echo '$''{'ac_cv_c_char_unsigned'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$GCC" = yes; then + # GCC predefines this symbol on systems where it applies. +cat > conftest.$ac_ext <<EOF +#line 2998 "configure" +#include "confdefs.h" +#ifdef __CHAR_UNSIGNED__ + yes +#endif + +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "yes" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_c_char_unsigned=yes +else + rm -rf conftest* + ac_cv_c_char_unsigned=no +fi +rm -f conftest* + +else +if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <<EOF +#line 3020 "configure" +#include "confdefs.h" +/* volatile prevents gcc2 from optimizing the test away on sparcs. */ +#if !defined(__STDC__) || __STDC__ != 1 +#define volatile +#endif +main() { + volatile char c = 255; exit(c < 0); +} +EOF +if { (eval echo configure:3030: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + ac_cv_c_char_unsigned=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_c_char_unsigned=no +fi +rm -fr conftest* +fi + +fi +fi + +echo "$ac_t""$ac_cv_c_char_unsigned" 1>&6 +if test $ac_cv_c_char_unsigned = yes && test "$GCC" != yes; then + cat >> confdefs.h <<\EOF +#define __CHAR_UNSIGNED__ 1 +EOF + +fi + + +echo $ac_n "checking count field in FILE structures""... $ac_c" 1>&6 +echo "configure:3055: checking count field in FILE structures" >&5 +if eval "test \"`echo '$''{'rb_cv_fcnt'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 3060 "configure" +#include "confdefs.h" +#include <stdio.h> +int main() { +FILE *f = stdin; f->_cnt = 0; +; return 0; } +EOF +if { (eval echo configure:3067: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + rb_cv_fcnt="_cnt" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* +if test "$rb_cv_fcnt" = ""; then + cat > conftest.$ac_ext <<EOF +#line 3077 "configure" +#include "confdefs.h" +#include <stdio.h> +int main() { +FILE *f = stdin; f->__cnt = 0; +; return 0; } +EOF +if { (eval echo configure:3084: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + rb_cv_fcnt="__cnt" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* +fi +if test "$rb_cv_fcnt" = ""; then + cat > conftest.$ac_ext <<EOF +#line 3095 "configure" +#include "confdefs.h" +#include <stdio.h> +int main() { +FILE *f = stdin; f->_r = 0; +; return 0; } +EOF +if { (eval echo configure:3102: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + rb_cv_fcnt="_r" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* +fi +if test "$rb_cv_fcnt" = ""; then + cat > conftest.$ac_ext <<EOF +#line 3113 "configure" +#include "confdefs.h" +#include <stdio.h> +int main() { +FILE *f = stdin; f->readCount = 0; +; return 0; } +EOF +if { (eval echo configure:3120: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + rb_cv_fcnt="readCount" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + rb_cv_fcnt="not found" +fi +rm -f conftest* +fi +fi + +if test "$rb_cv_fcnt" = "not found"; then + echo "$ac_t""not found(OK if using GNU libc)" 1>&6 +else + echo "$ac_t""$rb_cv_fcnt" 1>&6 + cat >> confdefs.h <<EOF +#define FILE_COUNT $rb_cv_fcnt +EOF + +fi + +if test "$ac_cv_func_getpwent" = yes; then + echo $ac_n "checking struct passwd""... $ac_c" 1>&6 +echo "configure:3145: checking struct passwd" >&5 + cat > conftest.$ac_ext <<EOF +#line 3147 "configure" +#include "confdefs.h" +#include <pwd.h> +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "pw_change" >/dev/null 2>&1; then + rm -rf conftest* + cat >> confdefs.h <<\EOF +#define PW_CHANGE 1 +EOF + +fi +rm -f conftest* + + cat > conftest.$ac_ext <<EOF +#line 3162 "configure" +#include "confdefs.h" +#include <pwd.h> +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "pw_quota" >/dev/null 2>&1; then + rm -rf conftest* + cat >> confdefs.h <<\EOF +#define PW_QUOTA 1 +EOF + +fi +rm -f conftest* + + cat > conftest.$ac_ext <<EOF +#line 3177 "configure" +#include "confdefs.h" +#include <pwd.h> +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "pw_age" >/dev/null 2>&1; then + rm -rf conftest* + cat >> confdefs.h <<\EOF +#define PW_AGE 1 +EOF + +fi +rm -f conftest* + + cat > conftest.$ac_ext <<EOF +#line 3192 "configure" +#include "confdefs.h" +#include <pwd.h> +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "pw_class" >/dev/null 2>&1; then + rm -rf conftest* + cat >> confdefs.h <<\EOF +#define PW_CLASS 1 +EOF + +fi +rm -f conftest* + + cat > conftest.$ac_ext <<EOF +#line 3207 "configure" +#include "confdefs.h" +#include <pwd.h> +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "pw_comment" >/dev/null 2>&1; then + rm -rf conftest* + cat >> confdefs.h <<\EOF +#define PW_COMMENT 1 +EOF + +fi +rm -f conftest* + + cat > conftest.$ac_ext <<EOF +#line 3222 "configure" +#include "confdefs.h" +#include <pwd.h> +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "pw_expire" >/dev/null 2>&1; then + rm -rf conftest* + cat >> confdefs.h <<\EOF +#define PW_EXPIRE 1 +EOF + +fi +rm -f conftest* + + echo "$ac_t""done" 1>&6 +fi + +# Check whether --with-dln-a-out or --without-dln-a-out was given. +if test "${with_dln_a_out+set}" = set; then + withval="$with_dln_a_out" + + case $withval in + yes) with_dln_a_out=yes;; + *) with_dln_a_out=no;; + esac +else + with_dln_a_out=no +fi + + +case "$host_os" in + linux*) + echo $ac_n "checking whether ELF binaries are produced""... $ac_c" 1>&6 +echo "configure:3255: checking whether ELF binaries are produced" >&5 + if eval "test \"`echo '$''{'rb_cv_linux_elf'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + : +else + cat > conftest.$ac_ext <<EOF +#line 3263 "configure" +#include "confdefs.h" + +/* Test for whether ELF binaries are produced */ +#include <fcntl.h> +#include <stdlib.h> +main() { + char buffer[4]; + int i=open("conftest",O_RDONLY); + if(i==-1) + exit(1); /* fail */ + if(read(i,&buffer[0],4)<4) + exit(1); /* fail */ + if(buffer[0] != 127 || buffer[1] != 'E' || + buffer[2] != 'L' || buffer[3] != 'F') + exit(1); /* fail */ + exit(0); /* succeed (yes, it's ELF) */ +} + +EOF +if { (eval echo configure:3283: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + rb_cv_linux_elf=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + rb_cv_linux_elf=no +fi +rm -fr conftest* +fi + +fi + + echo "$ac_t""$rb_cv_linux_elf" 1>&6 + if test "$rb_cv_linux_elf" = no; then + with_dln_a_out=yes + host_os=linux-a.out + else + LDFLAGS="-rdynamic" + fi;; +esac + + + +STATIC= + +if test "$with_dln_a_out" != yes; then + rb_cv_dlopen=unknown + echo $ac_n "checking whether OS depend dynamic link works""... $ac_c" 1>&6 +echo "configure:3313: checking whether OS depend dynamic link works" >&5 + if test "$GCC" = yes; then + case "$host_os" in + nextstep*) ;; + human*) ;; + *) CCDLFLAGS=-fpic;; + esac + else + case "$host_os" in + hpux*) CCDLFLAGS='+z';; + solaris*|irix*) CCDLFLAGS='-K pic' ;; + sunos*) CCDLFLAGS='-pic' ;; + esix*|uxpds*) CCDLFLAGS='-Kpic' ;; + *) CCDLFLAGS='' ;; + esac + fi + + case "$host_os" in + hpux*) DLDFLAGS="-E" + LDSHARED='ld -b' + LDFLAGS="-Wl,-E" + rb_cv_dlopen=yes;; + solaris*) LDSHARED='ld -G' + rb_cv_dlopen=yes;; + sunos*) LDSHARED='ld -assert nodefinitions' + rb_cv_dlopen=yes;; + irix*) LDSHARED='ld -ignore_unresolved' + rb_cv_dlopen=yes;; + sysv4*) LDSHARED='ld -G' + rb_cv_dlopen=yes;; + esix*|uxpds*) LDSHARED="ld -G" + rb_cv_dlopen=yes ;; + linux*) LDSHARED="gcc -shared" + rb_cv_dlopen=yes ;; + freebsd*) LDSHARED="ld -Bshareable" + rb_cv_dlopen=yes ;; + netbsd*) LDSHARED="ld -Bshareable" + rb_cv_dlopen=yes ;; + openbsd*) LDSHARED="ld -Bshareable" + rb_cv_dlopen=yes ;; + nextstep*) LDSHARED='cc -r' + LDFLAGS="-u libsys_s" + DLDFLAGS="$ARCH_FLAG" + rb_cv_dlopen=yes ;; + aix*) LDSHARED='../../miniruby ../aix_ld.rb $(TARGET)' + rb_cv_dlopen=yes ;; + human*) DLDFLAGS='' + LDSHARED='' + LDFLAGS='' ;; + *) LDSHARED='ld' ;; + esac + echo "$ac_t""$rb_cv_dlopen" 1>&6 +fi + +dln_a_out_works=no +if test "$ac_cv_header_a_out_h" = yes; then + if test "$with_dln_a_out" = yes || test "$rb_cv_dlopen" = unknown; then + echo $ac_n "checking whether matz's dln works""... $ac_c" 1>&6 +echo "configure:3371: checking whether matz's dln works" >&5 + cat confdefs.h > config.h + if eval "test \"`echo '$''{'rb_cv_dln_a_out'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 3377 "configure" +#include "confdefs.h" + +#define USE_DLN_A_OUT +#include "dln.c" + +int main() { + +; return 0; } +EOF +if { (eval echo configure:3387: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + rb_cv_dln_a_out=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + rb_cv_dln_a_out=no +fi +rm -f conftest* +fi + + echo "$ac_t""$rb_cv_dln_a_out" 1>&6 + if test "$rb_cv_dln_a_out" = yes; then + dln_a_out_works=yes + cat >> confdefs.h <<\EOF +#define USE_DLN_A_OUT 1 +EOF + + fi + fi +fi + +if test "$dln_a_out_works" = yes; then + if test "$GCC" = yes; then + STATIC=-static + else + STATIC=-Bstatic + fi + DLEXT=o + cat >> confdefs.h <<\EOF +#define DLEXT ".o" +EOF + + CCDLFLAGS= +else + case "$host_os" in + hpux*) DLEXT=sl + cat >> confdefs.h <<\EOF +#define DLEXT ".sl" +EOF +;; + nextstep*) DLEXT=o + cat >> confdefs.h <<\EOF +#define DLEXT ".o" +EOF +;; + *) DLEXT=so + cat >> confdefs.h <<\EOF +#define DLEXT ".so" +EOF +;; + esac +fi + +if test "$with_dln_a_out" = yes; then + STRIP=true +else + STRIP=strip +fi + +case "$host_os" in + linux*) + STRIP='strip -S -x';; + nextstep*) + STRIP='strip -A -n';; +esac + +EXTSTATIC= +# Check whether --with-static-linked-ext or --without-static-linked-ext was given. +if test "${with_static_linked_ext+set}" = set; then + withval="$with_static_linked_ext" + case $withval in + yes) STATIC= + EXTSTATIC=static;; + *) ;; + esac +fi + + +case "$host_os" in + human*) + echo $ac_n "checking for _harderr in -lsignal""... $ac_c" 1>&6 +echo "configure:3470: checking for _harderr in -lsignal" >&5 +ac_lib_var=`echo signal'_'_harderr | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lsignal $LIBS" +cat > conftest.$ac_ext <<EOF +#line 3478 "configure" +#include "confdefs.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 _harderr(); + +int main() { +_harderr() +; return 0; } +EOF +if { (eval echo configure:3489: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo signal | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <<EOF +#define $ac_tr_lib 1 +EOF + + LIBS="-lsignal $LIBS" + +else + echo "$ac_t""no" 1>&6 +fi + + echo $ac_n "checking for hmemset in -lhmem""... $ac_c" 1>&6 +echo "configure:3517: checking for hmemset in -lhmem" >&5 +ac_lib_var=`echo hmem'_'hmemset | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lhmem $LIBS" +cat > conftest.$ac_ext <<EOF +#line 3525 "configure" +#include "confdefs.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 hmemset(); + +int main() { +hmemset() +; return 0; } +EOF +if { (eval echo configure:3536: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo hmem | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <<EOF +#define $ac_tr_lib 1 +EOF + + LIBS="-lhmem $LIBS" + +else + echo "$ac_t""no" 1>&6 +fi + + for ac_func in select +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:3566: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 3571 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); 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 $ac_func(); + +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_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:3594: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + + echo $ac_n "checking whether PD libc _dtos18 fail to convert big number""... $ac_c" 1>&6 +echo "configure:3619: checking whether PD libc _dtos18 fail to convert big number" >&5 + if eval "test \"`echo '$''{'rb_cv_missing__dtos18'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <<EOF +#line 3627 "configure" +#include "confdefs.h" + +#include <stdio.h> +main () +{ + char buf[256]; + sprintf (buf, "%g", 1e+300); + exit (strcmp (buf, "1e+300") ? 0 : 1); +} + +EOF +if { (eval echo configure:3639: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + rb_cv_missing__dtos18=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + rb_cv_missing__dtos18=no +fi +rm -fr conftest* +fi + +fi + + echo "$ac_t""$rb_cv_missing__dtos18" 1>&6 + if test "$rb_cv_missing__dtos18" = yes; then + cat >> confdefs.h <<\EOF +#define MISSING__DTOS18 1 +EOF + + fi + echo $ac_n "checking whether PD libc fconvert fail to round""... $ac_c" 1>&6 +echo "configure:3661: checking whether PD libc fconvert fail to round" >&5 + if eval "test \"`echo '$''{'rb_cv_missing_fconvert'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <<EOF +#line 3669 "configure" +#include "confdefs.h" + +#include <stdio.h> +#include <math.h> +main () +{ + char buf[256]; + sprintf (buf, "%f", log(exp(1.0))); + exit (strcmp (buf, "1.000000") ? 0 : 1); +} + +EOF +if { (eval echo configure:3682: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + rb_cv_missing_fconvert=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + rb_cv_missing_fconvert=no +fi +rm -fr conftest* +fi + +fi + + echo "$ac_t""$rb_cv_missing_fconvert" 1>&6 + if test "$rb_cv_missing_fconvert" = yes; then + cat >> confdefs.h <<\EOF +#define MISSING_FCONVERT 1 +EOF + + fi + LIBOBJS="$LIBOBJS x68.o" + CFLAGS="$CFLAGS -fansi-only -cc1-stack=196608 -cpp-stack=2694144" + binsuffix=.x + setup=Setup.x68 + ;; + *) + binsuffix= + setup=Setup + ;; +esac + + + +if test "$prefix" = NONE; then + prefix=$ac_default_prefix +fi + +if test "$fat_binary" = yes ; then + CFLAGS="$CFLAGS -pipe $ARCH_FLAG" +fi + +cat >> confdefs.h <<EOF +#define RUBY_LIB "${prefix}/lib/ruby" +EOF + + +if test "$fat_binary" = yes ; then + arch="fat-${host_os}" + + cat >> confdefs.h <<EOF +#define RUBY_THIN_ARCHLIB "${prefix}/lib/ruby/" __ARCHITECTURE__ "-${host_os}" +EOF + + + cat >> confdefs.h <<EOF +#define RUBY_ARCHLIB "${prefix}/lib/ruby/${arch}" +EOF + + cat >> confdefs.h <<EOF +#define RUBY_PLATFORM __ARCHITECTURE__ "-${host_os}" +EOF + +else + arch="${host_cpu}-${host_os}" + cat >> confdefs.h <<EOF +#define RUBY_ARCHLIB "${prefix}/lib/ruby/${arch}" +EOF + + cat >> confdefs.h <<EOF +#define RUBY_PLATFORM "${arch}" +EOF + +fi + +echo "creating config.h" +cat confdefs.h > config.h + +trap '' 1 2 15 +cat > confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + case `(ac_space=' '; set) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +cat > conftest.defs <<\EOF +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g +s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g +s%\[%\\&%g +s%\]%\\&%g +s%\$%$$%g +EOF +DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` +rm -f conftest.defs + + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS <<EOF +#! /bin/sh +# Generated automatically by configure. +# Run this file to recreate the current configuration. +# This directory was configured as follows, +# on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.12" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir +ac_given_INSTALL="$INSTALL" + +trap 'rm -fr `echo "Makefile ext/extmk.rb" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS <<EOF + +# Protect against being on the right side of a sed subst in config.status. +sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; + s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g +s%@host@%$host%g +s%@host_alias@%$host_alias%g +s%@host_cpu@%$host_cpu%g +s%@host_vendor@%$host_vendor%g +s%@host_os@%$host_os%g +s%@CC@%$CC%g +s%@CPP@%$CPP%g +s%@YACC@%$YACC%g +s%@RANLIB@%$RANLIB%g +s%@AR@%$AR%g +s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_DATA@%$INSTALL_DATA%g +s%@SET_MAKE@%$SET_MAKE%g +s%@LIBOBJS@%$LIBOBJS%g +s%@ALLOCA@%$ALLOCA%g +s%@DLDFLAGS@%$DLDFLAGS%g +s%@STATIC@%$STATIC%g +s%@CCDLFLAGS@%$CCDLFLAGS%g +s%@LDSHARED@%$LDSHARED%g +s%@DLEXT@%$DLEXT%g +s%@STRIP@%$STRIP%g +s%@EXTSTATIC@%$EXTSTATIC%g +s%@binsuffix@%$binsuffix%g +s%@setup@%$setup%g +s%@arch@%$arch%g + +CEOF +EOF + +cat >> $CONFIG_STATUS <<\EOF + +# Split the substitutions into bite-sized pieces for seds with +# small command number limits, like on Digital OSF/1 and HP-UX. +ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. +ac_file=1 # Number of current file. +ac_beg=1 # First line for current file. +ac_end=$ac_max_sed_cmds # Line after last line for current file. +ac_more_lines=: +ac_sed_cmds="" +while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi +EOF + +cat >> $CONFIG_STATUS <<EOF + +CONFIG_FILES=\${CONFIG_FILES-"Makefile ext/extmk.rb"} +EOF +cat >> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +s%@INSTALL@%$INSTALL%g +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +fi; done +rm -f conftest.s* + +EOF +cat >> $CONFIG_STATUS <<EOF + +EOF +cat >> $CONFIG_STATUS <<\EOF + +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + diff --git a/configure.bat b/configure.bat index 84e5191bbe..35f9d4893d 100644 --- a/configure.bat +++ b/configure.bat @@ -1,5 +1,5 @@ -@echo off
-sed -f top.sed Makefile.in >Makefile
-sed -f top.sed ext/extmk.rb.in > ext\extmk.rb
-copy ext\Setup.dj ext\Setup
-copy config.dj config.h
+@echo off +sed -f top.sed Makefile.in >Makefile +sed -f top.sed ext/extmk.rb.in > ext\extmk.rb +copy ext\Setup.dj ext\Setup +copy config.dj config.h @@ -2,8 +2,8 @@ defines.h - - $Author: matz $ - $Date: 1996/12/25 10:42:25 $ + $Author$ + $Date$ created at: Wed May 18 00:21:44 JST 1994 ************************************************/ @@ -2,8 +2,8 @@ dir.c - - $Author: matz $ - $Date: 1996/12/25 10:42:28 $ + $Author$ + $Date$ created at: Wed Jan 5 09:51:01 JST 1994 Copyright (C) 1993-1996 Yukihiro Matsumoto @@ -2,8 +2,8 @@ dln.c - - $Author: matz $ - $Date: 1996/12/25 01:28:23 $ + $Author$ + $Date$ created at: Tue Jan 18 17:05:06 JST 1994 Copyright (C) 1993-1996 Yukihiro Matsumoto @@ -2,9 +2,9 @@ dln.h - - $Author: matz $ - $Revision: 1.2 $ - $Date: 1996/12/25 04:47:17 $ + $Author$ + $Revision$ + $Date$ created at: Wed Jan 19 16:53:09 JST 1994 ************************************************/ @@ -2,8 +2,8 @@ enum.c - - $Author: matz $ - $Date: 1996/12/25 10:42:29 $ + $Author$ + $Date$ created at: Fri Oct 1 15:15:19 JST 1993 Copyright (C) 1993-1996 Yukihiro Matsumoto @@ -2,9 +2,9 @@ env.h - - $Author: matz $ - $Revision: 1.8 $ - $Date: 1996/12/25 10:42:30 $ + $Author$ + $Revision$ + $Date$ created at: Mon Jul 11 11:53:03 JST 1994 ************************************************/ @@ -2,8 +2,8 @@ error.c - - $Author: matz $ - $Date: 1996/12/25 10:42:31 $ + $Author$ + $Date$ created at: Mon Aug 9 16:11:34 JST 1993 Copyright (C) 1993-1996 Yukihiro Matsumoto @@ -2,8 +2,8 @@ eval.c - - $Author: matz $ - $Date: 1996/12/25 08:54:45 $ + $Author$ + $Date$ created at: Thu Jun 10 14:22:17 JST 1993 Copyright (C) 1993-1997 Yukihiro Matsumoto diff --git a/ext/Setup.nt b/ext/Setup.nt index 8e43179f9e..b469709585 100644 --- a/ext/Setup.nt +++ b/ext/Setup.nt @@ -1,12 +1,12 @@ -option nodynamic
-
-#GD
-#curses
-#dbm
-#etc
-fcntl
-kconv
-#marshal
-md5
-socket
-#tkutil
+option nodynamic + +#GD +#curses +#dbm +#etc +fcntl +kconv +#marshal +md5 +socket +#tkutil diff --git a/ext/dbm/dbm.c b/ext/dbm/dbm.c index 5107aab279..ea0ac1930f 100644 --- a/ext/dbm/dbm.c +++ b/ext/dbm/dbm.c @@ -2,8 +2,8 @@ dbm.c - - $Author: matz $ - $Date: 1995/01/10 10:42:24 $ + $Author$ + $Date$ created at: Mon Jan 24 15:59:52 JST 1994 Copyright (C) 1995 Yukihiro Matsumoto diff --git a/ext/etc/etc.c b/ext/etc/etc.c index 5cab110449..20cd9295ed 100644 --- a/ext/etc/etc.c +++ b/ext/etc/etc.c @@ -2,8 +2,8 @@ etc.c - - $Author: matz $ - $Date: 1995/01/10 10:42:32 $ + $Author$ + $Date$ created at: Tue Mar 22 18:39:19 JST 1994 ************************************************/ diff --git a/ext/fcntl/fcntl.c b/ext/fcntl/fcntl.c index 977d5951a8..17aacb13c3 100644 --- a/ext/fcntl/fcntl.c +++ b/ext/fcntl/fcntl.c @@ -2,7 +2,7 @@ fcntl.c - - $Author: matz $ + $Author$ created at: Mon Apr 7 18:53:05 JST 1997 Copyright (C) 1997 Yukihiro Matsumoto diff --git a/ext/md5/md5init.c b/ext/md5/md5init.c index 762d53edc9..47f913792f 100644 --- a/ext/md5/md5init.c +++ b/ext/md5/md5init.c @@ -2,7 +2,7 @@ md5init.c - - $Author: matz $ + $Author$ created at: Fri Aug 2 09:24:12 JST 1996 Copyright (C) 1995 Yukihiro Matsumoto diff --git a/ext/socket/socket.c b/ext/socket/socket.c index be9118d0a8..9128e26de7 100644 --- a/ext/socket/socket.c +++ b/ext/socket/socket.c @@ -2,8 +2,8 @@ socket.c - - $Author: matz $ - $Date: 1995/01/10 10:42:55 $ + $Author$ + $Date$ created at: Thu Mar 31 12:21:29 JST 1994 ************************************************/ diff --git a/ext/tkutil/tkutil.c b/ext/tkutil/tkutil.c index 5e6b77b9af..540995eb82 100644 --- a/ext/tkutil/tkutil.c +++ b/ext/tkutil/tkutil.c @@ -2,8 +2,8 @@ tk.c - - $Author: matz $ - $Date: 1995/11/03 00:47:55 $ + $Author$ + $Date$ created at: Fri Nov 3 00:47:54 JST 1995 ************************************************/ @@ -2,8 +2,8 @@ file.c - - $Author: matz $ - $Date: 1996/12/25 10:42:36 $ + $Author$ + $Date$ created at: Mon Nov 15 12:24:34 JST 1993 Copyright (C) 1993-1996 Yukihiro Matsumoto @@ -2,8 +2,8 @@ gc.c - - $Author: matz $ - $Date: 1996/12/25 09:54:47 $ + $Author$ + $Date$ created at: Tue Oct 5 09:44:46 JST 1993 Copyright (C) 1993-1996 Yukihiro Matsumoto @@ -2,8 +2,8 @@ hash.c - - $Author: matz $ - $Date: 1996/12/25 10:42:26 $ + $Author$ + $Date$ created at: Mon Nov 22 18:51:18 JST 1993 Copyright (C) 1993-1997 Yukihiro Matsumoto @@ -2,8 +2,8 @@ inits.c - - $Author: matz $ - $Date: 1996/12/25 10:42:38 $ + $Author$ + $Date$ created at: Tue Dec 28 16:01:58 JST 1993 Copyright (C) 1993-1996 Yukihiro Matsumoto diff --git a/install-sh b/install-sh index 89fc9b098b..89fc9b098b 100755..100644 --- a/install-sh +++ b/install-sh @@ -2,8 +2,8 @@ io.c - - $Author: matz $ - $Date: 1996/12/25 10:42:39 $ + $Author$ + $Date$ created at: Fri Oct 15 18:08:59 JST 1993 Copyright (C) 1993-1996 Yukihiro Matsumoto @@ -2,9 +2,9 @@ io.h - - $Author: matz $ - $Revision: 1.3 $ - $Date: 1996/12/25 11:06:42 $ + $Author$ + $Revision$ + $Date$ created at: Fri Nov 12 16:47:09 JST 1993 Copyright (C) 1993-1996 Yukihiro Matsumoto diff --git a/lib/e2mmap1_0.rb b/lib/e2mmap1_0.rb index c5797fd573..d245dec975 100644 --- a/lib/e2mmap1_0.rb +++ b/lib/e2mmap1_0.rb @@ -1,8 +1,8 @@ # # e2mmap.rb - # $Release Version: 1.0$ -# $Revision: 1.4 $ -# $Date: 1997/08/18 07:12:12 $ +# $Revision$ +# $Date$ # by Keiju ISHITSUKA # # -- @@ -10,7 +10,7 @@ # module Exception2MessageMapper - RCS_ID='-$Header: /home/keiju/var/src/var.lib/ruby/RCS/e2mmap.rb,v 1.4 1997/08/18 07:12:12 keiju Exp keiju $-' + RCS_ID='-$Header$-' E2MM = Exception2MessageMapper def E2MM.extend_to(b) diff --git a/lib/getopts.rb b/lib/getopts.rb index d25437515d..6929f7e4fd 100644 --- a/lib/getopts.rb +++ b/lib/getopts.rb @@ -2,8 +2,8 @@ # # getopts.rb - # $Release Version: $ -# $Revision: 1.1 $ -# $Date: 1996/11/10 05:01:15 $ +# $Revision$ +# $Date$ # by Yasuo OHBA(SHL Japan Inc. Technology Dept.) # # -- @@ -11,7 +11,7 @@ # # -$RCS_ID="$Header: /home/jammy/current/ruby/RCS/getopts.rb,v 1.1 1996/11/10 05:01:15 jammy Exp $" +$RCS_ID="$Header$" def isSingle(lopt) if lopt.index(":") diff --git a/lib/parsearg.rb b/lib/parsearg.rb index 569ed260f7..a0ef90f018 100644 --- a/lib/parsearg.rb +++ b/lib/parsearg.rb @@ -2,8 +2,8 @@ # # parsearg.rb - parse arguments # $Release Version: $ -# $Revision: 1.3 $ -# $Date: 1996/11/12 06:48:51 $ +# $Revision$ +# $Date$ # by Yasuo OHBA(SHL Japan Inc. Technology Dept.) # # -- @@ -11,7 +11,7 @@ # # -$RCS_ID="$Header: /home/jammy/current/ruby/RCS/parsearg.rb,v 1.3 1996/11/12 06:48:51 jammy Exp $" +$RCS_ID="$Header$" load("getopts.rb") diff --git a/lib/sync.rb b/lib/sync.rb index fd18291ca9..3e57ed0e57 100644 --- a/lib/sync.rb +++ b/lib/sync.rb @@ -1,8 +1,8 @@ # # sync.rb - ���������2-�ե��������å����饹 # $Release Version: 0.1$ -# $Revision: 1.3 $ -# $Date: 1997/08/18 07:17:08 $ +# $Revision$ +# $Date$ # by Keiju ISHITSUKA # # -- @@ -39,7 +39,7 @@ end require "finalize.rb" module Sync_m - RCS_ID='-$Header: /home/keiju/var/src/var.lib/ruby/RCS/sync.rb,v 1.3 1997/08/18 07:17:08 keiju Exp keiju $-' + RCS_ID='-$Header$-' UN = :UN SH = :SH diff --git a/lib/thread.rb b/lib/thread.rb index 30f77ddbeb..4f294cc9a3 100644 --- a/lib/thread.rb +++ b/lib/thread.rb @@ -1,6 +1,6 @@ # # thread.rb - thread support classes -# $Date: 1996/05/21 09:29:21 $ +# $Date$ # by Yukihiro Matsumoto <[email protected]> # @@ -1,6 +1,6 @@ # # tk.rb - Tk interface for ruby -# $Date: 1995/11/03 08:17:15 $ +# $Date$ # by Yukihiro Matsumoto <[email protected]> if defined? Thread and $tk_thread_safe diff --git a/lib/tkcanvas.rb b/lib/tkcanvas.rb index de727c3e79..a02db097fd 100644 --- a/lib/tkcanvas.rb +++ b/lib/tkcanvas.rb @@ -1,6 +1,6 @@ # # tkcanvas.rb - Tk canvas classes -# $Date: 1995/11/11 11:17:15 $ +# $Date$ # by Yukihiro Matsumoto <[email protected]> require "tk" diff --git a/lib/tkclass.rb b/lib/tkclass.rb index 17f57f581d..0b33d4ec8b 100644 --- a/lib/tkclass.rb +++ b/lib/tkclass.rb @@ -1,6 +1,6 @@ # # tkclass.rb - Tk classes -# $Date: 1995/11/11 19:17:15 $ +# $Date$ # by Yukihiro Matsumoto <[email protected]> require "tk" diff --git a/lib/tkcore.rb b/lib/tkcore.rb index 9fd2c88efc..c151b0af9e 100644 --- a/lib/tkcore.rb +++ b/lib/tkcore.rb @@ -1,6 +1,6 @@ # # tkcore.rb - Tk interface modue without thread -# $Date: 1996/11/09 22:51:15 $ +# $Date$ # by Yukihiro Matsumoto <[email protected]> require "tkutil" diff --git a/lib/tkentry.rb b/lib/tkentry.rb index 7c13e3bdb1..bcf092a15c 100644 --- a/lib/tkentry.rb +++ b/lib/tkentry.rb @@ -1,6 +1,6 @@ # # tkentry.rb - Tk entry classes -# $Date: 1995/12/07 15:01:10 $ +# $Date$ # by Yukihiro Matsumoto <[email protected]> require 'tk.rb' diff --git a/lib/tkscrollbox.rb b/lib/tkscrollbox.rb index 76844ed90a..8d129b2f4b 100644 --- a/lib/tkscrollbox.rb +++ b/lib/tkscrollbox.rb @@ -1,7 +1,7 @@ # # tkscrollbox.rb - Tk Listbox with Scrollbar # as an example of Composite Widget -# $Date: 1995/12/12 18:21:01 $ +# $Date$ # by Yukihiro Matsumoto <[email protected]> require 'tk.rb' diff --git a/lib/tktext.rb b/lib/tktext.rb index 91a60529d1..2488f77793 100644 --- a/lib/tktext.rb +++ b/lib/tktext.rb @@ -1,6 +1,6 @@ # # tktext.rb - Tk text classes -# $Date: 1995/12/07 08:37:10 $ +# $Date$ # by Yukihiro Matsumoto <[email protected]> require 'tk.rb' diff --git a/lib/tkthcore.rb b/lib/tkthcore.rb index b89850cb73..a6648502bd 100644 --- a/lib/tkthcore.rb +++ b/lib/tkthcore.rb @@ -1,6 +1,6 @@ # # tkthcore.rb - Tk interface modue using thread -# $Date: 1996/11/09 22:49:15 $ +# $Date$ # by Yukihiro Matsumoto <[email protected]> require "tkutil" @@ -2,8 +2,8 @@ main.c - - $Author: matz $ - $Date: 1996/12/25 09:32:03 $ + $Author$ + $Date$ created at: Fri Aug 19 13:19:58 JST 1994 ************************************************/ @@ -2,8 +2,8 @@ math.c - - $Author: matz $ - $Date: 1996/12/25 09:28:03 $ + $Author$ + $Date$ created at: Tue Jan 25 14:12:56 JST 1994 Copyright (C) 1993-1996 Yukihiro Matsumoto diff --git a/missing/dir.h b/missing/dir.h index 51904c6f88..5c6281fdc2 100644 --- a/missing/dir.h +++ b/missing/dir.h @@ -1,188 +1,188 @@ -/* $RCSfile: dir.h,v $$Revision: 4.0.1.1 $$Date: 91/06/07 11:22:10 $
- *
- * (C) Copyright 1987, 1990 Diomidis Spinellis.
- *
- * You may distribute under the terms of either the GNU General Public
- * License or the Artistic License, as specified in the README file.
- *
- * $Log: dir.h,v $
- * Revision 4.0.1.1 91/06/07 11:22:10 lwall
- * patch4: new copyright notice
- *
- * Revision 4.0 91/03/20 01:34:20 lwall
- * 4.0 baseline.
- *
- * Revision 3.0.1.1 90/03/27 16:07:08 lwall
- * patch16: MSDOS support
- *
- * Revision 1.1 90/03/18 20:32:29 dds
- * Initial revision
- *
- *
- */
-
-/*
- * defines the type returned by the directory(3) functions
- */
-
-#ifndef __DIR_INCLUDED
-#define __DIR_INCLUDED
-
-/*Directory entry size */
-#ifdef DIRSIZ
-#undef DIRSIZ
-#endif
-#define DIRSIZ(rp) (sizeof(struct direct))
-
-/*
- * Structure of a directory entry
- */
-struct direct {
- ino_t d_ino; /* inode number (not used by MS-DOS) */
- int d_namlen; /* Name length */
- char d_name[256]; /* file name */
-};
-
-struct _dir_struc { /* Structure used by dir operations */
- char *start; /* Starting position */
- char *curr; /* Current position */
- long size; /* Size of string table */
- long nfiles; /* number if filenames in table */
- struct direct dirstr; /* Directory structure to return */
-};
-
-typedef struct _dir_struc DIR; /* Type returned by dir operations */
-
-DIR *cdecl opendir(char *filename);
-struct direct *readdir(DIR *dirp);
-long telldir(DIR *dirp);
-void seekdir(DIR *dirp,long loc);
-void rewinddir(DIR *dirp);
-void closedir(DIR *dirp);
-
-#endif /* __DIR_INCLUDED */
-/* $RCSfile: dir.h,v $$Revision: 4.0.1.1 $$Date: 91/06/07 11:22:10 $
- *
- * (C) Copyright 1987, 1990 Diomidis Spinellis.
- *
- * You may distribute under the terms of either the GNU General Public
- * License or the Artistic License, as specified in the README file.
- *
- * $Log: dir.h,v $
- * Revision 4.0.1.1 91/06/07 11:22:10 lwall
- * patch4: new copyright notice
- *
- * Revision 4.0 91/03/20 01:34:20 lwall
- * 4.0 baseline.
- *
- * Revision 3.0.1.1 90/03/27 16:07:08 lwall
- * patch16: MSDOS support
- *
- * Revision 1.1 90/03/18 20:32:29 dds
- * Initial revision
- *
- *
- */
-
-/*
- * defines the type returned by the directory(3) functions
- */
-
-#ifndef __DIR_INCLUDED
-#define __DIR_INCLUDED
-
-/*Directory entry size */
-#ifdef DIRSIZ
-#undef DIRSIZ
-#endif
-#define DIRSIZ(rp) (sizeof(struct direct))
-
-/*
- * Structure of a directory entry
- */
-struct direct {
- ino_t d_ino; /* inode number (not used by MS-DOS) */
- int d_namlen; /* Name length */
- char d_name[256]; /* file name */
-};
-
-struct _dir_struc { /* Structure used by dir operations */
- char *start; /* Starting position */
- char *curr; /* Current position */
- struct direct dirstr; /* Directory structure to return */
-};
-
-typedef struct _dir_struc DIR; /* Type returned by dir operations */
-
-DIR *cdecl opendir(char *filename);
-struct direct *readdir(DIR *dirp);
-long telldir(DIR *dirp);
-void seekdir(DIR *dirp,long loc);
-void rewinddir(DIR *dirp);
-void closedir(DIR *dirp);
-
-#endif /* __DIR_INCLUDED */
-/* $RCSfile: dir.h,v $$Revision: 4.0.1.1 $$Date: 91/06/07 11:22:10 $
- *
- * (C) Copyright 1987, 1990 Diomidis Spinellis.
- *
- * You may distribute under the terms of either the GNU General Public
- * License or the Artistic License, as specified in the README file.
- *
- * $Log: dir.h,v $
- * Revision 4.0.1.1 91/06/07 11:22:10 lwall
- * patch4: new copyright notice
- *
- * Revision 4.0 91/03/20 01:34:20 lwall
- * 4.0 baseline.
- *
- * Revision 3.0.1.1 90/03/27 16:07:08 lwall
- * patch16: MSDOS support
- *
- * Revision 1.1 90/03/18 20:32:29 dds
- * Initial revision
- *
- *
- */
-
-/*
- * defines the type returned by the directory(3) functions
- */
-
-#ifndef __DIR_INCLUDED
-#define __DIR_INCLUDED
-
-/*Directory entry size */
-#ifdef DIRSIZ
-#undef DIRSIZ
-#endif
-#define DIRSIZ(rp) (sizeof(struct direct))
-
-/*
- * Structure of a directory entry
- */
-struct direct {
- ino_t d_ino; /* inode number (not used by MS-DOS) */
- int d_namlen; /* Name length */
- char d_name[256]; /* file name */
-};
-
-struct _dir_struc { /* Structure used by dir operations */
- char *start; /* Starting position */
- char *curr; /* Current position */
- struct direct dirstr; /* Directory structure to return */
-};
-
-typedef struct _dir_struc DIR; /* Type returned by dir operations */
-
-DIR *cdecl opendir(char *filename);
-struct direct *readdir(DIR *dirp);
-long telldir(DIR *dirp);
-void seekdir(DIR *dirp,long loc);
-void rewinddir(DIR *dirp);
-void closedir(DIR *dirp);
-
-#endif /* __DIR_INCLUDED */
+/* $RCSfile: dir.h,v $$Revision: 4.0.1.1 $$Date: 91/06/07 11:22:10 $ + * + * (C) Copyright 1987, 1990 Diomidis Spinellis. + * + * You may distribute under the terms of either the GNU General Public + * License or the Artistic License, as specified in the README file. + * + * $Log: dir.h,v $ + * Revision 4.0.1.1 91/06/07 11:22:10 lwall + * patch4: new copyright notice + * + * Revision 4.0 91/03/20 01:34:20 lwall + * 4.0 baseline. + * + * Revision 3.0.1.1 90/03/27 16:07:08 lwall + * patch16: MSDOS support + * + * Revision 1.1 90/03/18 20:32:29 dds + * Initial revision + * + * + */ + +/* + * defines the type returned by the directory(3) functions + */ + +#ifndef __DIR_INCLUDED +#define __DIR_INCLUDED + +/*Directory entry size */ +#ifdef DIRSIZ +#undef DIRSIZ +#endif +#define DIRSIZ(rp) (sizeof(struct direct)) + +/* + * Structure of a directory entry + */ +struct direct { + ino_t d_ino; /* inode number (not used by MS-DOS) */ + int d_namlen; /* Name length */ + char d_name[256]; /* file name */ +}; + +struct _dir_struc { /* Structure used by dir operations */ + char *start; /* Starting position */ + char *curr; /* Current position */ + long size; /* Size of string table */ + long nfiles; /* number if filenames in table */ + struct direct dirstr; /* Directory structure to return */ +}; + +typedef struct _dir_struc DIR; /* Type returned by dir operations */ + +DIR *cdecl opendir(char *filename); +struct direct *readdir(DIR *dirp); +long telldir(DIR *dirp); +void seekdir(DIR *dirp,long loc); +void rewinddir(DIR *dirp); +void closedir(DIR *dirp); + +#endif /* __DIR_INCLUDED */ +/* $RCSfile: dir.h,v $$Revision: 4.0.1.1 $$Date: 91/06/07 11:22:10 $ + * + * (C) Copyright 1987, 1990 Diomidis Spinellis. + * + * You may distribute under the terms of either the GNU General Public + * License or the Artistic License, as specified in the README file. + * + * $Log: dir.h,v $ + * Revision 4.0.1.1 91/06/07 11:22:10 lwall + * patch4: new copyright notice + * + * Revision 4.0 91/03/20 01:34:20 lwall + * 4.0 baseline. + * + * Revision 3.0.1.1 90/03/27 16:07:08 lwall + * patch16: MSDOS support + * + * Revision 1.1 90/03/18 20:32:29 dds + * Initial revision + * + * + */ + +/* + * defines the type returned by the directory(3) functions + */ + +#ifndef __DIR_INCLUDED +#define __DIR_INCLUDED + +/*Directory entry size */ +#ifdef DIRSIZ +#undef DIRSIZ +#endif +#define DIRSIZ(rp) (sizeof(struct direct)) + +/* + * Structure of a directory entry + */ +struct direct { + ino_t d_ino; /* inode number (not used by MS-DOS) */ + int d_namlen; /* Name length */ + char d_name[256]; /* file name */ +}; + +struct _dir_struc { /* Structure used by dir operations */ + char *start; /* Starting position */ + char *curr; /* Current position */ + struct direct dirstr; /* Directory structure to return */ +}; + +typedef struct _dir_struc DIR; /* Type returned by dir operations */ + +DIR *cdecl opendir(char *filename); +struct direct *readdir(DIR *dirp); +long telldir(DIR *dirp); +void seekdir(DIR *dirp,long loc); +void rewinddir(DIR *dirp); +void closedir(DIR *dirp); + +#endif /* __DIR_INCLUDED */ +/* $RCSfile: dir.h,v $$Revision: 4.0.1.1 $$Date: 91/06/07 11:22:10 $ + * + * (C) Copyright 1987, 1990 Diomidis Spinellis. + * + * You may distribute under the terms of either the GNU General Public + * License or the Artistic License, as specified in the README file. + * + * $Log: dir.h,v $ + * Revision 4.0.1.1 91/06/07 11:22:10 lwall + * patch4: new copyright notice + * + * Revision 4.0 91/03/20 01:34:20 lwall + * 4.0 baseline. + * + * Revision 3.0.1.1 90/03/27 16:07:08 lwall + * patch16: MSDOS support + * + * Revision 1.1 90/03/18 20:32:29 dds + * Initial revision + * + * + */ + +/* + * defines the type returned by the directory(3) functions + */ + +#ifndef __DIR_INCLUDED +#define __DIR_INCLUDED + +/*Directory entry size */ +#ifdef DIRSIZ +#undef DIRSIZ +#endif +#define DIRSIZ(rp) (sizeof(struct direct)) + +/* + * Structure of a directory entry + */ +struct direct { + ino_t d_ino; /* inode number (not used by MS-DOS) */ + int d_namlen; /* Name length */ + char d_name[256]; /* file name */ +}; + +struct _dir_struc { /* Structure used by dir operations */ + char *start; /* Starting position */ + char *curr; /* Current position */ + struct direct dirstr; /* Directory structure to return */ +}; + +typedef struct _dir_struc DIR; /* Type returned by dir operations */ + +DIR *cdecl opendir(char *filename); +struct direct *readdir(DIR *dirp); +long telldir(DIR *dirp); +void seekdir(DIR *dirp,long loc); +void rewinddir(DIR *dirp); +void closedir(DIR *dirp); + +#endif /* __DIR_INCLUDED */ /* $RCSfile: dir.h,v $$Revision: 4.0.1.1 $$Date: 91/06/07 11:22:10 $ * * (C) Copyright 1987, 1990 Diomidis Spinellis. diff --git a/missing/file.h b/missing/file.h index d8b8402852..0207dddb3a 100644 --- a/missing/file.h +++ b/missing/file.h @@ -1,31 +1,32 @@ -/* This is file FILE.H */
-/*
-** Copyright (C) 1991 DJ Delorie, 24 Kirsten Ave, Rochester NH 03867-2954
-**
-** This file is distributed under the terms listed in the document
-** "copying.dj", available from DJ Delorie at the address above.
-** A copy of "copying.dj" should accompany this file; if not, a copy
-** should be available from where this file was obtained. This file
-** may not be distributed without a verbatim copy of "copying.dj".
-**
-** This file is distributed WITHOUT ANY WARRANTY; without even the implied
-** warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-*/
-
-#ifndef _FILE_H_
-#define _FILE_H_
-
-#include <fcntl.h>
-
-#define L_SET 0
-#define L_CURR 1
-#define L_INCR 1
-#define L_XTND 2
-
-
-#define F_OK 0 /* does file exist */
-#define X_OK 1 /* is it executable by caller */
-#define W_OK 2 /* is it writable by caller */
-#define R_OK 4 /* is it readable by caller */
-
-#endif
+/* This is file FILE.H */ +/* +** Copyright (C) 1991 DJ Delorie, 24 Kirsten Ave, Rochester NH 03867-2954 +** +** This file is distributed under the terms listed in the document +** "copying.dj", available from DJ Delorie at the address above. +** A copy of "copying.dj" should accompany this file; if not, a copy +** should be available from where this file was obtained. This file +** may not be distributed without a verbatim copy of "copying.dj". +** +** This file is distributed WITHOUT ANY WARRANTY; without even the implied +** warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +*/ + +#ifndef _FILE_H_ +#define _FILE_H_ + +#include <fcntl.h> + +#define L_SET 0 +#define L_CURR 1 +#define L_INCR 1 +#define L_XTND 2 + + +#define F_OK 0 /* does file exist */ + +#define X_OK 1 /* is it executable by caller */ +#define W_OK 2 /* is it writable by caller */ +#define R_OK 4 /* is it readable by caller */ + +#endif diff --git a/missing/nt.c b/missing/nt.c index 7210e1b33b..1cd81fd28c 100644 --- a/missing/nt.c +++ b/missing/nt.c @@ -1,2191 +1,2191 @@ -/*
- * Copyright (c) 1993, Intergraph Corporation
- *
- * You may distribute under the terms of either the GNU General Public
- * License or the Artistic License, as specified in the perl README file.
- *
- * Various Unix compatibility functions and NT specific functions.
- *
- * Some of this code was derived from the MSDOS port(s) and the OS/2 port.
- *
- */
-
-#include "ruby.h"
-#include <fcntl.h>
-#include <process.h>
-#include <sys/stat.h>
-/* #include <sys/wait.h> */
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <assert.h>
-
-#include <windows.h>
-#include <winbase.h>
-#include <wincon.h>
-#include "nt.h"
-#include "dir.h"
-#ifndef index
-#define index(x, y) strchr((x), (y))
-#endif
-
-#ifndef bool
-#define bool int
-#endif
-
-bool NtSyncProcess = TRUE;
-#if 0 // declared in header file
-extern char **environ;
-#define environ _environ
-#endif
-
-static bool NtHasRedirection (char *);
-static int valid_filename(char *s);
-static void StartSockets ();
-static char *str_grow(struct RString *str, size_t new_size);
-
-char *NTLoginName;
-
-DWORD Win32System = (DWORD)-1;
-
-static DWORD
-IdOS(void)
-{
- static OSVERSIONINFO osver;
-
- if (osver.dwPlatformId != Win32System) {
- memset(&osver, 0, sizeof(OSVERSIONINFO));
- osver.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
- GetVersionEx(&osver);
- Win32System = osver.dwPlatformId;
- }
- return (Win32System);
-}
-
-static int
-IsWin95(void) {
- return (IdOS() == VER_PLATFORM_WIN32_WINDOWS);
-}
-
-static int
-IsWinNT(void) {
- return (IdOS() == VER_PLATFORM_WIN32_NT);
-}
-
-
-/* simulate flock by locking a range on the file */
-
-
-#define LK_ERR(f,i) ((f) ? (i = 0) : (errno = GetLastError()))
-#define LK_LEN 0xffff0000
-
-int
-flock(int fd, int oper)
-{
- OVERLAPPED o;
- int i = -1;
- HANDLE fh;
-
- fh = (HANDLE)_get_osfhandle(fd);
- memset(&o, 0, sizeof(o));
-
- if(IsWinNT()) {
- switch(oper) {
- case LOCK_SH: /* shared lock */
- LK_ERR(LockFileEx(fh, 0, 0, LK_LEN, 0, &o),i);
- break;
- case LOCK_EX: /* exclusive lock */
- LK_ERR(LockFileEx(fh, LOCKFILE_EXCLUSIVE_LOCK, 0, LK_LEN, 0, &o),i);
- break;
- case LOCK_SH|LOCK_NB: /* non-blocking shared lock */
- LK_ERR(LockFileEx(fh, LOCKFILE_FAIL_IMMEDIATELY, 0, LK_LEN, 0, &o),i);
- break;
- case LOCK_EX|LOCK_NB: /* non-blocking exclusive lock */
- LK_ERR(LockFileEx(fh,
- LOCKFILE_EXCLUSIVE_LOCK|LOCKFILE_FAIL_IMMEDIATELY,
- 0, LK_LEN, 0, &o),i);
- if(errno == EDOM) errno = EWOULDBLOCK;
- break;
- case LOCK_UN: /* unlock lock */
- if (UnlockFileEx(fh, 0, LK_LEN, 0, &o)) {
- i = 0;
- }
- else {
- /* GetLastError() must returns `ERROR_NOT_LOCKED' */
- errno = EWOULDBLOCK;
- }
- if(errno == EDOM) errno = EWOULDBLOCK;
- break;
- default: /* unknown */
- errno = EINVAL;
- break;
- }
- }
- else if(IsWin95()) {
- switch(oper) {
- case LOCK_EX:
- while(i == -1) {
- LK_ERR(LockFile(fh, 0, 0, LK_LEN, 0), i);
- if(errno != EDOM && i == -1) break;
- }
- break;
- case LOCK_EX | LOCK_NB:
- LK_ERR(LockFile(fh, 0, 0, LK_LEN, 0), i);
- if(errno == EDOM) errno = EWOULDBLOCK;
- break;
- case LOCK_UN:
- LK_ERR(UnlockFile(fh, 0, 0, LK_LEN, 0), i);
- if(errno == EDOM) errno = EWOULDBLOCK;
- break;
- default:
- errno = EINVAL;
- break;
- }
- }
- return i;
-}
-
-#undef LK_ERR
-#undef LK_LEN
-
-
-#undef const
-FILE *fdopen(int, const char *);
-
-#if 0
-void
-sleep(unsigned int len)
-{
- time_t end;
-
- end = time((time_t *)0) + len;
- while (time((time_t *)0) < end)
- ;
-}
-#endif
-
-//
-// Initialization stuff
-//
-void
-NtInitialize(int *argc, char ***argv) {
-
- WORD version;
- int ret;
-
- //
- // subvert cmd.exe\'s feeble attempt at command line parsing
- //
- *argc = NtMakeCmdVector((char *)GetCommandLine(), argv, TRUE);
-
- //
- // Now set up the correct time stuff
- //
-
- tzset();
-
- // Initialize Winsock
- // StartSockets();
-}
-
-
-char *getlogin()
-{
- char buffer[200];
- int len = 200;
- extern char *NTLoginName;
-
- if (NTLoginName == NULL) {
- if (GetUserName(buffer, &len)) {
- NTLoginName = ALLOC_N(char, len+1);
- strncpy(NTLoginName, buffer, len);
- NTLoginName[len] = '\0';
- }
- else {
- NTLoginName = "<Unknown>";
- }
- }
- return NTLoginName;
-}
-
-
-
-#if 1
-// popen stuff
-
-//
-// use these so I can remember which index is which
-//
-
-#define NtPipeRead 0 // index of pipe read descriptor
-#define NtPipeWrite 1 // index of pipe write descriptor
-
-#define NtPipeSize 1024 // size of pipe buffer
-
-#define MYPOPENSIZE 256 // size of book keeping structure
-
-struct {
- int inuse;
- int pid;
- HANDLE oshandle;
- FILE *pipe;
-} MyPopenRecord[MYPOPENSIZE];
-
-int SafeFree(char **vec, int vecc)
-{
- // vec
- // |
- // V ^---------------------V
- // +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
- // | | | .... | NULL | | ..... |\0 | | ..... |\0 |...
- // +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
- // |- elements+1 -| ^ 1st element ^ 2nd element
-
- char *p;
-
- p = (char *)(vec - (vecc * sizeof (char *) + 1));
- free(p);
-
- return 0;
-}
-
-
-static char *szInternalCmds[] = {
- "cd",
- "chdir",
- "cls",
- "copy",
- "date",
- "del",
- "dir",
- "echo",
- "erase",
- "label",
- "md",
- "mkdir",
- "path",
- "rd",
- "rem",
- "ren",
- "rename",
- "rmdir",
- "set",
- "start",
- "time",
- "type",
- "ver",
- "vol",
-};
-
-int
-isInternalCmd(char *cmd)
-{
- int fRet;
- char **vec;
- int vecc = NtMakeCmdVector(cmd, &vec, FALSE);
-
- SafeFree (vec, vecc);
-
- return 0;
-}
-
-
-FILE *
-mypopen (char *cmd, char *mode)
-{
- FILE *fp;
- int saved, reading;
- int pipemode;
- int pipes[2];
- int pid;
- int slot;
- static initialized = 0;
-
- //
- // if first time through, intialize our book keeping structure
- //
-
- if (!initialized++) {
- for (slot = 0; slot < MYPOPENSIZE; slot++)
- MyPopenRecord[slot].inuse = FALSE;
- }
-
- //printf("mypopen %s\n", cmd);
-
- //
- // find a free popen slot
- //
-
- for (slot = 0; slot < MYPOPENSIZE && MyPopenRecord[slot].inuse; slot++)
- ;
-
- if (slot > MYPOPENSIZE) {
- return NULL;
- }
-
- //
- // Figure out what we\'re doing...
- //
-
- reading = (*mode == 'r') ? TRUE : FALSE;
- pipemode = (*(mode+1) == 'b') ? O_BINARY : O_TEXT;
-
- //
- // Now get a pipe
- //
-
-#if 0
- if (_pipe(pipes, NtPipeSize, pipemode) == -1) {
- return NULL;
- }
-
- if (reading) {
-
- //
- // we\'re reading from the pipe, so we must hook up the
- // write end of the pipe to the new processes stdout.
- // To do this we must save our file handle from stdout
- // by _dup\'ing it, then setting our stdout to be the pipe\'s
- // write descriptor. We must also make the write handle
- // inheritable so the new process can use it.
-
- if ((saved = _dup(fileno(stdout))) == -1) {
- _close(pipes[NtPipeRead]);
- _close(pipes[NtPipeWrite]);
- return NULL;
- }
- if (_dup2 (pipes[NtPipeWrite], fileno(stdout)) == -1) {
- _close(pipes[NtPipeRead]);
- _close(pipes[NtPipeWrite]);
- return NULL;
- }
- }
- else {
- //
- // must be writing to the new process. Do the opposite of
- // the above, i.e. hook up the processes stdin to the read
- // end of the pipe.
- //
-
- if ((saved = _dup(fileno(stdin))) == -1) {
- _close(pipes[NtPipeRead]);
- _close(pipes[NtPipeWrite]);
- return NULL;
- }
- if (_dup2(pipes[NtPipeRead], fileno(stdin)) == -1) {
- _close(pipes[NtPipeRead]);
- _close(pipes[NtPipeWrite]);
- return NULL;
- }
- }
-
- //
- // Start the new process. Must set _fileinfo to non-zero value
- // for file descriptors to be inherited. Reset after the process
- // is started.
- //
-
- if (NtHasRedirection(cmd)) {
- docmd:
- pid = spawnlpe(_P_NOWAIT, "cmd.exe", "/c", cmd, 0, environ);
- if (pid == -1) {
- _close(pipes[NtPipeRead]);
- _close(pipes[NtPipeWrite]);
- return NULL;
- }
- }
- else {
- char **vec;
- int vecc = NtMakeCmdVector(cmd, &vec, FALSE);
-
- //pid = spawnvpe (_P_NOWAIT, vec[0], vec, environ);
- pid = spawnvpe (_P_WAIT, vec[0], vec, environ);
- if (pid == -1) {
- goto docmd;
- }
- Safefree (vec, vecc);
- }
-
- if (reading) {
-
- //
- // We need to close our instance of the inherited pipe write
- // handle now that it's been inherited so that it will actually close
- // when the child process ends.
- //
-
- if (_close(pipes[NtPipeWrite]) == -1) {
- _close(pipes[NtPipeRead]);
- return NULL;
- }
- if (_dup2 (saved, fileno(stdout)) == -1) {
- _close(pipes[NtPipeRead]);
- return NULL;
- }
- _close(saved);
-
- //
- // Now get a stream pointer to return to the calling program.
- //
-
- if ((fp = (FILE *) fdopen(pipes[NtPipeRead], mode)) == NULL) {
- return NULL;
- }
- }
- else {
-
- //
- // need to close our read end of the pipe so that it will go
- // away when the write end is closed.
- //
-
- if (_close(pipes[NtPipeRead]) == -1) {
- _close(pipes[NtPipeWrite]);
- return NULL;
- }
- if (_dup2 (saved, fileno(stdin)) == -1) {
- _close(pipes[NtPipeWrite]);
- return NULL;
- }
- _close(saved);
-
- //
- // Now get a stream pointer to return to the calling program.
- //
-
- if ((fp = (FILE *) fdopen(pipes[NtPipeWrite], mode)) == NULL) {
- _close(pipes[NtPipeWrite]);
- return NULL;
- }
- }
-
- //
- // do the book keeping
- //
-
- MyPopenRecord[slot].inuse = TRUE;
- MyPopenRecord[slot].pipe = fp;
- MyPopenRecord[slot].pid = pid;
-
- return fp;
-#else
- {
- int p[2];
-
- BOOL fRet;
- HANDLE hInFile, hOutFile, hStdin, hStdout;
- LPCSTR lpApplicationName = NULL;
- LPTSTR lpCommandLine;
- LPTSTR lpCmd2 = NULL;
- DWORD dwCreationFlags;
- STARTUPINFO aStartupInfo;
- PROCESS_INFORMATION aProcessInformation;
- SECURITY_ATTRIBUTES sa;
- int fd;
-
- sa.nLength = sizeof (SECURITY_ATTRIBUTES);
- sa.lpSecurityDescriptor = NULL;
- sa.bInheritHandle = TRUE;
-
- if (!reading) {
- FILE *fp;
-
- fp = (_popen)(cmd, mode);
-
- MyPopenRecord[slot].inuse = TRUE;
- MyPopenRecord[slot].pipe = fp;
- MyPopenRecord[slot].pid = -1;
-
- if (!fp)
- Fatal("cannot open pipe \"%s\" (%s)", cmd, strerror(errno));
- return fp;
- }
-
-
- fRet = CreatePipe(&hInFile, &hOutFile, &sa, 2048L);
- if (!fRet)
- Fatal("cannot open pipe \"%s\" (%s)", cmd, strerror(errno));
-
- memset(&aStartupInfo, 0, sizeof (STARTUPINFO));
- memset(&aProcessInformation, 0, sizeof (PROCESS_INFORMATION));
- aStartupInfo.cb = sizeof (STARTUPINFO);
- aStartupInfo.dwFlags = STARTF_USESTDHANDLES;
-
- if (reading) {
- aStartupInfo.hStdInput = GetStdHandle(STD_OUTPUT_HANDLE);//hStdin;
- aStartupInfo.hStdError = INVALID_HANDLE_VALUE;
- //for save
- DuplicateHandle(GetCurrentProcess(), GetStdHandle(STD_OUTPUT_HANDLE),
- GetCurrentProcess(), &hStdout,
- 0, FALSE, DUPLICATE_SAME_ACCESS
- );
- //for redirect
- DuplicateHandle(GetCurrentProcess(), GetStdHandle(STD_INPUT_HANDLE),
- GetCurrentProcess(), &hStdin,
- 0, TRUE, DUPLICATE_SAME_ACCESS
- );
- aStartupInfo.hStdOutput = hOutFile;
- }
- else {
- aStartupInfo.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE); //hStdout;
- aStartupInfo.hStdError = INVALID_HANDLE_VALUE;
- // for save
- DuplicateHandle(GetCurrentProcess(), GetStdHandle(STD_INPUT_HANDLE),
- GetCurrentProcess(), &hStdin,
- 0, FALSE, DUPLICATE_SAME_ACCESS
- );
- //for redirect
- DuplicateHandle(GetCurrentProcess(), GetStdHandle(STD_OUTPUT_HANDLE),
- GetCurrentProcess(), &hStdout,
- 0, TRUE, DUPLICATE_SAME_ACCESS
- );
- aStartupInfo.hStdInput = hInFile;
- }
-
- dwCreationFlags = (NORMAL_PRIORITY_CLASS);
-
- lpCommandLine = cmd;
- if (NtHasRedirection(cmd) || isInternalCmd(cmd)) {
- lpApplicationName = getenv("COMSPEC");
- lpCmd2 = malloc(strlen(lpApplicationName) + 1 + strlen(cmd) + sizeof (" /c "));
- if (lpCmd2 == NULL)
- Fatal("Mypopen: malloc failed");
- sprintf(lpCmd2, "%s %s%s", lpApplicationName, " /c ", cmd);
- lpCommandLine = lpCmd2;
- }
-
- fRet = CreateProcess(lpApplicationName, lpCommandLine, &sa, &sa,
- sa.bInheritHandle, dwCreationFlags, NULL, NULL, &aStartupInfo, &aProcessInformation);
-
- if (!fRet) {
- CloseHandle(hInFile);
- CloseHandle(hOutFile);
- Fatal("cannot fork for \"%s\" (%s)", cmd, strerror(errno));
- }
-
- CloseHandle(aProcessInformation.hThread);
-
- if (reading) {
- HANDLE hDummy;
-
- fd = _open_osfhandle((long)hInFile, (_O_RDONLY | pipemode));
- CloseHandle(hOutFile);
- DuplicateHandle(GetCurrentProcess(), hStdout,
- GetCurrentProcess(), &hDummy,
- 0, TRUE, (DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE)
- );
- }
- else {
- HANDLE hDummy;
-
- fd = _open_osfhandle((long)hOutFile, (_O_WRONLY | pipemode));
- CloseHandle(hInFile);
- DuplicateHandle(GetCurrentProcess(), hStdin,
- GetCurrentProcess(), &hDummy,
- 0, TRUE, (DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE)
- );
- }
-
- if (fd == -1)
- Fatal("cannot open pipe \"%s\" (%s)", cmd, strerror(errno));
-
-
- if ((fp = (FILE *) fdopen(fd, mode)) == NULL)
- return NULL;
-
- if (lpCmd2)
- free(lpCmd2);
-
- MyPopenRecord[slot].inuse = TRUE;
- MyPopenRecord[slot].pipe = fp;
- MyPopenRecord[slot].oshandle = (reading ? hInFile : hOutFile);
- MyPopenRecord[slot].pid = (int)aProcessInformation.hProcess;
- return fp;
- }
-#endif
-}
-
-int
-mypclose(FILE *fp)
-{
- int i;
- int exitcode;
-
- Sleep(100);
- for (i = 0; i < MYPOPENSIZE; i++) {
- if (MyPopenRecord[i].inuse && MyPopenRecord[i].pipe == fp)
- break;
- }
- if (i >= MYPOPENSIZE) {
- Fatal("Invalid file pointer passed to mypclose!\n");
- }
-
- //
- // get the return status of the process
- //
-
-#if 0
- if (_cwait(&exitcode, MyPopenRecord[i].pid, WAIT_CHILD) == -1) {
- if (errno == ECHILD) {
- fprintf(stderr, "mypclose: nosuch child as pid %x\n",
- MyPopenRecord[i].pid);
- }
- }
-#else
- for (;;) {
- if (GetExitCodeProcess((HANDLE)MyPopenRecord[i].pid, &exitcode)) {
- if (exitcode == STILL_ACTIVE) {
- //printf("Process is Active.\n");
- Sleep(100);
- TerminateProcess((HANDLE)MyPopenRecord[i].pid, 0); // ugly...
- continue;
- }
- else if (exitcode == 0) {
- //printf("done.\n");
- break;
- }
- else {
- //printf("never.\n");
- break;
- }
- }
- }
-#endif
-
-
- //
- // close the pipe
- //
- CloseHandle(MyPopenRecord[i].oshandle);
- fflush(fp);
- fclose(fp);
-
- //
- // free this slot
- //
-
- MyPopenRecord[i].inuse = FALSE;
- MyPopenRecord[i].pipe = NULL;
- MyPopenRecord[i].pid = 0;
-
- return exitcode;
-}
-#endif
-
-#if 1
-
-
-typedef char* CHARP;
-/*
- * The following code is based on the do_exec and do_aexec functions
- * in file doio.c
- */
-
-int
-do_spawn(cmd)
-char *cmd;
-{
- register char **a;
- register char *s;
- char **argv;
- int status;
- char *shell, *cmd2;
- int mode = NtSyncProcess ? P_WAIT : P_NOWAIT;
-
- /* save an extra exec if possible */
- if ((shell = getenv("RUBYSHELL")) != 0) {
- if (NtHasRedirection(cmd)) {
- int i;
- char *p;
- char *argv[4];
- char *cmdline = ALLOC_N(char, (strlen(cmd) * 2 + 1));
-
- p=cmdline;
- *p++ = '"';
- for (s=cmd; *s;) {
- if (*s == '"')
- *p++ = '\\'; /* Escape d-quote */
- *p++ = *s++;
- }
- *p++ = '"';
- *p = '\0';
-
- /* fprintf(stderr, "do_spawn: %s %s\n", shell, cmdline); */
- argv[0] = shell;
- argv[1] = "-c";
- argv[2] = cmdline;
- argv[4] = NULL;
- status = spawnvpe(mode, argv[0], argv, environ);
- /* return spawnle(mode, shell, shell, "-c", cmd, (char*)0, environ); */
- free(cmdline);
- return status;
- }
- }
- else if ((shell = getenv("COMSPEC")) != 0) {
- if (NtHasRedirection(cmd) /* || isInternalCmd(cmd) */) {
- do_comspec_shell:
- return spawnle(mode, shell, shell, "/c", cmd, (char*)0, environ);
- }
- }
-
- argv = ALLOC_N(CHARP, (strlen(cmd) / 2 + 2));
- cmd2 = ALLOC_N(char, (strlen(cmd) + 1));
- strcpy(cmd2, cmd);
- a = argv;
- for (s = cmd2; *s;) {
- while (*s && isspace(*s)) s++;
- if (*s)
- *(a++) = s;
- while (*s && !isspace(*s)) s++;
- if (*s)
- *s++ = '\0';
- }
- *a = NULL;
- if (argv[0]) {
- if ((status = spawnvpe(mode, argv[0], argv, environ)) == -1) {
- free(argv);
- free(cmd2);
- return -1;
- }
- }
- free(cmd2);
- free(argv);
- return status;
-}
-
-#endif
-
-typedef struct _NtCmdLineElement {
- struct _NtCmdLineElement *next, *prev;
- char *str;
- int len;
- int flags;
-} NtCmdLineElement;
-
-//
-// Possible values for flags
-//
-
-#define NTGLOB 0x1 // element contains a wildcard
-#define NTMALLOC 0x2 // string in element was malloc'ed
-#define NTSTRING 0x4 // element contains a quoted string
-
-NtCmdLineElement *NtCmdHead = NULL, *NtCmdTail = NULL;
-
-void
-NtFreeCmdLine(void)
-{
- NtCmdLineElement *ptr;
-
- while(NtCmdHead) {
- ptr = NtCmdHead;
- NtCmdHead = NtCmdHead->next;
- free(ptr);
- }
- NtCmdHead = NtCmdTail = NULL;
-}
-
-//
-// This function expands wild card characters that were spotted
-// during the parse phase. The idea here is to call FindFirstFile and
-// FindNextFile with the wildcard pattern specified, and splice in the
-// resulting list of new names. If the wildcard pattern doesn\'t match
-// any existing files, just leave it in the list.
-//
-
-void
-NtCmdGlob (NtCmdLineElement *patt)
-{
- WIN32_FIND_DATA fd;
- HANDLE fh;
- char buffer[512];
- NtCmdLineElement *tmphead, *tmptail, *tmpcurr;
-
- strncpy(buffer, patt->str, patt->len);
- buffer[patt->len] = '\0';
- if ((fh = FindFirstFile (buffer, &fd)) == INVALID_HANDLE_VALUE) {
- return;
- }
- tmphead = tmptail = NULL;
- do {
- tmpcurr = ALLOC(NtCmdLineElement);
- if (tmpcurr == NULL) {
- fprintf(stderr, "Out of Memory in globbing!\n");
- while (tmphead) {
- tmpcurr = tmphead;
- tmphead = tmphead->next;
- free(tmpcurr->str);
- free(tmpcurr);
- }
- return;
- }
- memset (tmpcurr, 0, sizeof(*tmpcurr));
- tmpcurr->len = strlen(fd.cFileName);
- tmpcurr->str = ALLOC_N(char, tmpcurr->len+1);
- if (tmpcurr->str == NULL) {
- fprintf(stderr, "Out of Memory in globbing!\n");
- while (tmphead) {
- tmpcurr = tmphead;
- tmphead = tmphead->next;
- free(tmpcurr->str);
- free(tmpcurr);
- }
- return;
- }
- strcpy(tmpcurr->str, fd.cFileName);
- tmpcurr->flags |= NTMALLOC;
- if (tmptail) {
- tmptail->next = tmpcurr;
- tmpcurr->prev = tmptail;
- tmptail = tmpcurr;
- }
- else {
- tmptail = tmphead = tmpcurr;
- }
- } while(FindNextFile(fh, &fd));
-
- //
- // ok, now we\'ve got a list of files that matched the wildcard
- // specification. Put it in place of the pattern structure.
- //
-
- tmphead->prev = patt->prev;
- tmptail->next = patt->next;
-
- if (tmphead->prev)
- tmphead->prev->next = tmphead;
-
- if (tmptail->next)
- tmptail->next->prev = tmptail;
-
- //
- // Now get rid of the pattern structure
- //
-
- if (patt->flags & NTMALLOC)
- free(patt->str);
- // free(patt); //TODO: memory leak occures here. we have to fix it.
-}
-
-//
-// Check a command string to determine if it has I/O redirection
-// characters that require it to be executed by a command interpreter
-//
-
-static bool
-NtHasRedirection (char *cmd)
-{
- int inquote = 0;
- char quote = '\0';
- char *ptr ;
-
- //
- // Scan the string, looking for redirection (< or >) or pipe
- // characters (|) that are not in a quoted string
- //
-
- for (ptr = cmd; *ptr; ptr++) {
-
- switch (*ptr) {
-
- case '\'':
- case '\"':
- if (inquote) {
- if (quote == *ptr) {
- inquote = 0;
- quote = '\0';
- }
- }
- else {
- quote = *ptr;
- inquote++;
- }
- break;
-
- case '>':
- case '<':
-
- if (!inquote)
- return TRUE;
- }
- }
- return FALSE;
-}
-
-
-int
-NtMakeCmdVector (char *cmdline, char ***vec, int InputCmd)
-{
- int cmdlen = strlen(cmdline);
- int done, instring, globbing, quoted, len;
- int newline, need_free = 0, i;
- int elements, strsz;
- int slashes = 0;
- char *ptr, *base, *buffer;
- char **vptr;
- char quote;
- NtCmdLineElement *curr;
-
- //
- // just return if we don\'t have a command line
- //
-
- if (cmdlen == 0) {
- *vec = NULL;
- return 0;
- }
-
- //
- // strip trailing white space
- //
-
- ptr = cmdline+(cmdlen - 1);
- while(ptr >= cmdline && isspace(*ptr))
- --ptr;
- *++ptr = '\0';
-
- //
- // check for newlines and formfeeds. If we find any, make a new
- // command string that replaces them with escaped sequences (\n or \f)
- //
-
- for (ptr = cmdline, newline = 0; *ptr; ptr++) {
- if (*ptr == '\n' || *ptr == '\f')
- newline++;
- }
-
- if (newline) {
- base = ALLOC_N(char, strlen(cmdline) + 1 + newline + slashes);
- if (base == NULL) {
- fprintf(stderr, "malloc failed!\n");
- return 0;
- }
- for (i = 0, ptr = base; (unsigned) i < strlen(cmdline); i++) {
- switch (cmdline[i]) {
- case '\n':
- *ptr++ = '\\';
- *ptr++ = 'n';
- break;
- default:
- *ptr++ = cmdline[i];
- }
- }
- *ptr = '\0';
- cmdline = base;
- need_free++;
- }
-
- //
- // Ok, parse the command line, building a list of CmdLineElements.
- // When we\'ve finished, and it\'s an input command (meaning that it\'s
- // the processes argv), we\'ll do globing and then build the argument
- // vector.
- // The outer loop does one interation for each element seen.
- // The inner loop does one interation for each character in the element.
- //
-
- for (done = 0, ptr = cmdline; *ptr;) {
-
- //
- // zap any leading whitespace
- //
-
- while(isspace(*ptr))
- ptr++;
- base = ptr;
-
- for (done = newline = globbing = instring = quoted = 0;
- *ptr && !done; ptr++) {
-
- //
- // Switch on the current character. We only care about the
- // white-space characters, the wild-card characters, and the
- // quote characters.
- //
-
- switch (*ptr) {
- case ' ':
- case '\t':
-#if 0
- case '/': // have to do this for NT/DOS option strings
-
- //
- // check to see if we\'re parsing an option switch
- //
-
- if (*ptr == '/' && base == ptr)
- continue;
-#endif
- //
- // if we\'re not in a string, then we\'re finished with this
- // element
- //
-
- if (!instring)
- done++;
- break;
-
- case '*':
- case '?':
-
- //
- // record the fact that this element has a wildcard character
- // N.B. Don\'t glob if inside a single quoted string
- //
-
- if (!(instring && quote == '\''))
- globbing++;
- break;
-
- case '\n':
-
- //
- // If this string contains a newline, mark it as such so
- // we can replace it with the two character sequence "\n"
- // (cmd.exe doesn\'t like raw newlines in strings...sigh).
- //
-
- newline++;
- break;
-
- case '\'':
- case '\"':
-
- //
- // if we\'re already in a string, see if this is the
- // terminating close-quote. If it is, we\'re finished with
- // the string, but not neccessarily with the element.
- // If we\'re not already in a string, start one.
- //
-
- if (instring) {
- if (quote == *ptr) {
- instring = 0;
- quote = '\0';
- }
- }
- else {
- instring++;
- quote = *ptr;
- quoted++;
- }
- break;
- }
- }
-
- //
- // need to back up ptr by one due to last increment of for loop
- // (if we got out by seeing white space)
- //
-
- if (*ptr)
- ptr--;
-
- //
- // when we get here, we\'ve got a pair of pointers to the element,
- // base and ptr. Base points to the start of the element while ptr
- // points to the character following the element.
- //
-
- curr = ALLOC(NtCmdLineElement);
- if (curr == NULL) {
- NtFreeCmdLine();
- fprintf(stderr, "Out of memory!!\n");
- *vec = NULL;
- return 0;
- }
- memset (curr, 0, sizeof(*curr));
-
- len = ptr - base;
-
- //
- // if it\'s an input vector element and it\'s enclosed by quotes,
- // we can remove them.
- //
-
- if (InputCmd &&
- ((base[0] == '\"' && base[len-1] == '\"') ||
- (base[0] == '\'' && base[len-1] == '\''))) {
- base++;
- len -= 2;
- }
-
- curr->str = base;
- curr->len = len;
- curr->flags |= (globbing ? NTGLOB : 0);
-
- //
- // Now put it in the list of elements
- //
- if (NtCmdTail) {
- NtCmdTail->next = curr;
- curr->prev = NtCmdTail;
- NtCmdTail = curr;
- }
- else {
- NtCmdHead = NtCmdTail = curr;
- }
- }
-
- if (InputCmd) {
-
- //
- // When we get here we\'ve finished parsing the command line. Now
- // we need to run the list, expanding any globbing patterns.
- //
-
- for(curr = NtCmdHead; curr; curr = curr->next) {
- if (curr->flags & NTGLOB) {
- NtCmdGlob(curr);
- }
- }
- }
-
- //
- // Almost done!
- // Count up the elements, then allocate space for a vector of pointers
- // (argv) and a string table for the elements.
- //
-
- for (elements = 0, strsz = 0, curr = NtCmdHead; curr; curr = curr->next) {
- elements++;
- strsz += (curr->len + 1);
- }
-
- len = (elements+1)*sizeof(char *) + strsz;
- buffer = ALLOC_N(char, len);
- if (buffer == NULL) {
- fprintf(stderr, "Out of memory!!\n");
- NtFreeCmdLine();
- *vec = NULL;
- return 0;
- }
-
- memset (buffer, 0, len);
-
- //
- // make vptr point to the start of the buffer
- // and ptr point to the area we\'ll consider the string table.
- //
- // buffer (*vec)
- // |
- // V ^---------------------V
- // +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
- // | | | .... | NULL | | ..... |\0 | | ..... |\0 |...
- // +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
- // |- elements+1 -| ^ 1st element ^ 2nd element
-
- vptr = (char **) buffer;
-
- ptr = buffer + (elements+1) * sizeof(char *);
-
- for (curr = NtCmdHead; curr; curr = curr->next) {
- strncpy (ptr, curr->str, curr->len);
- ptr[curr->len] = '\0';
- *vptr++ = ptr;
- ptr += curr->len + 1;
- }
- NtFreeCmdLine();
- *vec = (char **) buffer;
- return elements;
-}
-
-
-#if 1
-//
-// UNIX compatible directory access functions for NT
-//
-
-//
-// File names are converted to lowercase if the
-// CONVERT_TO_LOWER_CASE variable is defined.
-//
-
-#define CONVERT_TO_LOWER_CASE
-#define PATHLEN 1024
-
-//
-// The idea here is to read all the directory names into a string table
-// (separated by nulls) and when one of the other dir functions is called
-// return the pointer to the current file name.
-//
-
-DIR *
-opendir(char *filename)
-{
- DIR *p;
- long len;
- long idx;
- char scannamespc[PATHLEN];
- char *scanname = scannamespc;
- struct stat sbuf;
- WIN32_FIND_DATA FindData;
- HANDLE fh;
- char root[PATHLEN];
- char volname[PATHLEN];
- DWORD serial, maxname, flags;
- BOOL downcase;
- char *dummy;
-
- //
- // check to see if we\'ve got a directory
- //
-
- if (stat (filename, &sbuf) < 0 ||
- sbuf.st_mode & _S_IFDIR == 0) {
- return NULL;
- }
-
- //
- // check out the file system characteristics
- //
- if (GetFullPathName(filename, PATHLEN, root, &dummy)) {
- if (dummy = strchr(root, '\\'))
- *++dummy = '\0';
- if (GetVolumeInformation(root, volname, PATHLEN,
- &serial, &maxname, &flags, 0, 0)) {
- downcase = !(flags & FS_CASE_SENSITIVE);
- }
- }
- else {
- downcase = TRUE;
- }
-
- //
- // Get us a DIR structure
- //
-
- p = xcalloc(sizeof(DIR), 1);
- if (p == NULL)
- return NULL;
-
- //
- // Create the search pattern
- //
-
- strcpy(scanname, filename);
-
- if (index("/\\", *(scanname + strlen(scanname) - 1)) == NULL)
- strcat(scanname, "/*");
- else
- strcat(scanname, "*");
-
- //
- // do the FindFirstFile call
- //
-
- fh = FindFirstFile (scanname, &FindData);
- if (fh == INVALID_HANDLE_VALUE) {
- return NULL;
- }
-
- //
- // now allocate the first part of the string table for the
- // filenames that we find.
- //
-
- idx = strlen(FindData.cFileName)+1;
- p->start = ALLOC_N(char, idx);
- strcpy (p->start, FindData.cFileName);
- if (downcase)
- strlwr(p->start);
- p->nfiles++;
-
- //
- // loop finding all the files that match the wildcard
- // (which should be all of them in this directory!).
- // the variable idx should point one past the null terminator
- // of the previous string found.
- //
- while (FindNextFile(fh, &FindData)) {
- len = strlen (FindData.cFileName);
-
- //
- // bump the string table size by enough for the
- // new name and it's null terminator
- //
-
- #define Renew(x, y, z) (x = (z *)realloc(x, y))
-
- Renew (p->start, idx+len+1, char);
- if (p->start == NULL) {
- Fatal ("opendir: malloc failed!\n");
- }
- strcpy(&p->start[idx], FindData.cFileName);
- if (downcase)
- strlwr(&p->start[idx]);
- p->nfiles++;
- idx += len+1;
- }
- FindClose(fh);
- p->size = idx;
- p->curr = p->start;
- return p;
-}
-
-
-//
-// Readdir just returns the current string pointer and bumps the
-// string pointer to the next entry.
-//
-
-struct direct *
-readdir(DIR *dirp)
-{
- int len;
- static int dummy = 0;
-
- if (dirp->curr) {
-
- //
- // first set up the structure to return
- //
-
- len = strlen(dirp->curr);
- strcpy(dirp->dirstr.d_name, dirp->curr);
- dirp->dirstr.d_namlen = len;
-
- //
- // Fake inode
- //
- dirp->dirstr.d_ino = dummy++;
-
- //
- // Now set up for the next call to readdir
- //
-
- dirp->curr += len + 1;
- if (dirp->curr >= (dirp->start + dirp->size)) {
- dirp->curr = NULL;
- }
-
- return &(dirp->dirstr);
-
- } else
- return NULL;
-}
-
-//
-// Telldir returns the current string pointer position
-//
-
-long
-telldir(DIR *dirp)
-{
- return (long) dirp->curr; /* ouch! pointer to long cast */
-}
-
-//
-// Seekdir moves the string pointer to a previously saved position
-// (Saved by telldir).
-
-void
-seekdir(DIR *dirp, long loc)
-{
- dirp->curr = (char *) loc; /* ouch! long to pointer cast */
-}
-
-//
-// Rewinddir resets the string pointer to the start
-//
-
-void
-rewinddir(DIR *dirp)
-{
- dirp->curr = dirp->start;
-}
-
-//
-// This just free\'s the memory allocated by opendir
-//
-
-void
-closedir(DIR *dirp)
-{
- free(dirp->start);
- free(dirp);
-}
-#endif
-
-
-//
-// 98.2% of this code was lifted from the OS2 port. (JCW)
-//
-
-#if 0
-// add_suffix is in util.c too.
-/*
- * Suffix appending for in-place editing under MS-DOS and OS/2 (and now NT!).
- *
- * Here are the rules:
- *
- * Style 0: Append the suffix exactly as standard perl would do it.
- * If the filesystem groks it, use it. (HPFS will always
- * grok it. So will NTFS. FAT will rarely accept it.)
- *
- * Style 1: The suffix begins with a '.'. The extension is replaced.
- * If the name matches the original name, use the fallback method.
- *
- * Style 2: The suffix is a single character, not a '.'. Try to add the
- * suffix to the following places, using the first one that works.
- * [1] Append to extension.
- * [2] Append to filename,
- * [3] Replace end of extension,
- * [4] Replace end of filename.
- * If the name matches the original name, use the fallback method.
- *
- * Style 3: Any other case: Ignore the suffix completely and use the
- * fallback method.
- *
- * Fallback method: Change the extension to ".$$$". If that matches the
- * original name, then change the extension to ".~~~".
- *
- * If filename is more than 1000 characters long, we die a horrible
- * death. Sorry.
- *
- * The filename restriction is a cheat so that we can use buf[] to store
- * assorted temporary goo.
- *
- * Examples, assuming style 0 failed.
- *
- * suffix = ".bak" (style 1)
- * foo.bar => foo.bak
- * foo.bak => foo.$$$ (fallback)
- * foo.$$$ => foo.~~~ (fallback)
- * makefile => makefile.bak
- *
- * suffix = "~" (style 2)
- * foo.c => foo.c~
- * foo.c~ => foo.c~~
- * foo.c~~ => foo~.c~~
- * foo~.c~~ => foo~~.c~~
- * foo~~~~~.c~~ => foo~~~~~.$$$ (fallback)
- *
- * foo.pas => foo~.pas
- * makefile => makefile.~
- * longname.fil => longname.fi~
- * longname.fi~ => longnam~.fi~
- * longnam~.fi~ => longnam~.$$$
- *
- */
-
-
-static char suffix1[] = ".$$$";
-static char suffix2[] = ".~~~";
-
-#define ext (&buf[1000])
-
-#define strEQ(s1,s2) (strcmp(s1,s2) == 0)
-
-void
-add_suffix(struct RString *str, char *suffix)
-{
- int baselen;
- int extlen = strlen(suffix);
- char *s, *t, *p;
- int slen;
- char buf[1024];
-
- if (str->len > 1000)
- Fatal("Cannot do inplace edit on long filename (%d characters)", str->len);
-
- /* Style 0 */
- slen = str->len;
- str_cat(str, suffix, extlen);
- if (valid_filename(str->ptr)) return;
-
- /* Fooey, style 0 failed. Fix str before continuing. */
- str->ptr[str->len = slen] = '\0';
-
- slen = extlen;
- t = buf; baselen = 0; s = str->ptr;
- while ( (*t = *s) && *s != '.') {
- baselen++;
- if (*s == '\\' || *s == '/') baselen = 0;
- s++; t++;
- }
- p = t;
-
- t = ext; extlen = 0;
- while (*t++ = *s++) extlen++;
- if (extlen == 0) { ext[0] = '.'; ext[1] = 0; extlen++; }
-
- if (*suffix == '.') { /* Style 1 */
- if (strEQ(ext, suffix)) goto fallback;
- strcpy(p, suffix);
- } else if (suffix[1] == '\0') { /* Style 2 */
- if (extlen < 4) {
- ext[extlen] = *suffix;
- ext[++extlen] = '\0';
- } else if (baselen < 8) {
- *p++ = *suffix;
- } else if (ext[3] != *suffix) {
- ext[3] = *suffix;
- } else if (buf[7] != *suffix) {
- buf[7] = *suffix;
- } else goto fallback;
- strcpy(p, ext);
- } else { /* Style 3: Panic */
-fallback:
- (void)memcpy(p, strEQ(ext, suffix1) ? suffix2 : suffix1, 5);
- }
- str_grow(str, strlen(buf));
- memcpy(str->ptr, buf, str->len);
-}
-#endif
-
-static int
-valid_filename(char *s)
-{
- int fd;
-
- //
- // if the file exists, then it\'s a valid filename!
- //
-
- if (_access(s, 0) == 0) {
- return 1;
- }
-
- //
- // It doesn\'t exist, so see if we can open it.
- //
-
- if ((fd = _open(s, _O_CREAT, 0666)) >= 0) {
- close(fd);
- _unlink (s); // don\'t leave it laying around
- return 1;
- }
- return 0;
-}
-
-
-//
-// This is a clone of fdopen so that we can handle the
-// brain damaged version of sockets that NT gets to use.
-//
-// The problem is that sockets are not real file handles and
-// cannot be fdopen\'ed. This causes problems in the do_socket
-// routine in doio.c, since it tries to create two file pointers
-// for the socket just created. We\'ll fake out an fdopen and see
-// if we can prevent perl from trying to do stdio on sockets.
-//
-
-FILE *
-fdopen (int fd, const char *mode)
-{
- FILE *fp;
- char sockbuf[80];
- int optlen;
- int retval;
- extern int errno;
-
- retval = getsockopt((SOCKET)fd, SOL_SOCKET, SO_TYPE, sockbuf, &optlen);
- if (retval == SOCKET_ERROR) {
- int iRet;
-
- iRet = WSAGetLastError();
- if (iRet == WSAENOTSOCK || iRet == WSANOTINITIALISED)
- return (_fdopen(fd, mode));
- }
-
- //
- // If we get here, then fd is actually a socket.
- //
- fp = xcalloc(sizeof(FILE), 1);
-#if _MSC_VER < 800
- fileno(fp) = fd;
-#else
- fp->_file = fd;
-#endif
- if (*mode == 'r')
- fp->_flag = _IOREAD;
- else
- fp->_flag = _IOWRT;
- return fp;
-}
-
-
-//
-// Since the errors returned by the socket error function
-// WSAGetLastError() are not known by the library routine strerror
-// we have to roll our own.
-//
-
-#undef strerror
-
-char *
-mystrerror(int e)
-{
- static char buffer[512];
- extern int sys_nerr;
- DWORD source = 0;
-
- if (e < 0 || e > sys_nerr) {
- if (e < 0)
- e = GetLastError();
- if (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, &source, e, 0,
- buffer, 512, NULL) == 0) {
- strcpy (buffer, "Unknown Error");
- }
- return buffer;
- }
- return strerror(e);
-
-}
-
-//
-// various stubs
-//
-
-
-// Ownership
-//
-// Just pretend that everyone is a superuser. NT will let us know if
-// we don\'t really have permission to do something.
-//
-
-#define ROOT_UID 0
-#define ROOT_GID 0
-
-UIDTYPE
-getuid(void)
-{
- return ROOT_UID;
-}
-
-UIDTYPE
-geteuid(void)
-{
- return ROOT_UID;
-}
-
-GIDTYPE
-getgid(void)
-{
- return ROOT_GID;
-}
-
-GIDTYPE
-getegid(void)
-{
- return ROOT_GID;
-}
-
-int
-setuid(int uid)
-{
- return (uid == ROOT_UID ? 0 : -1);
-}
-
-int
-setgid(int gid)
-{
- return (gid == ROOT_GID ? 0 : -1);
-}
-
-//
-// File system stuff
-//
-
-int
-/* ioctl(int i, unsigned int u, char *data) */
-ioctl(int i, unsigned int u, long data)
-{
- return -1;
-}
-
-
-//
-// Networking trampolines
-// These are used to avoid socket startup/shutdown overhead in case
-// the socket routines aren\'t used.
-//
-
-#undef select
-
-static int NtSocketsInitialized = 0;
-
-long
-myselect (int nfds, fd_set *rd, fd_set *wr, fd_set *ex,
- struct timeval *timeout)
-{
- long r;
- if (!NtSocketsInitialized++) {
- StartSockets();
- }
- if ((r = select (nfds, rd, wr, ex, timeout)) == SOCKET_ERROR)
- errno = WSAGetLastError();
- return r;
-}
-
-static void
-StartSockets () {
- WORD version;
- WSADATA retdata;
- int ret;
-
- //
- // initalize the winsock interface and insure that it\'s
- // cleaned up at exit.
- //
- version = MAKEWORD(1, 1);
- if (ret = WSAStartup(version, &retdata))
- Fatal ("Unable to locate winsock library!\n");
- if (LOBYTE(retdata.wVersion) != 1)
- Fatal("could not find version 1 of winsock dll\n");
-
- if (HIBYTE(retdata.wVersion) != 1)
- Fatal("could not find version 1 of winsock dll\n");
-
- atexit((void (*)(void)) WSACleanup);
-}
-
-#undef accept
-
-SOCKET
-myaccept (SOCKET s, struct sockaddr *addr, int *addrlen)
-{
- SOCKET r;
-
- if (!NtSocketsInitialized++) {
- StartSockets();
- }
- if ((r = accept (s, addr, addrlen)) == INVALID_SOCKET)
- errno = WSAGetLastError();
- return r;
-}
-
-#undef bind
-
-int
-mybind (SOCKET s, struct sockaddr *addr, int addrlen)
-{
- int r;
-
- if (!NtSocketsInitialized++) {
- StartSockets();
- }
- if ((r = bind (s, addr, addrlen)) == SOCKET_ERROR)
- errno = WSAGetLastError();
- return r;
-}
-
-#undef connect
-
-int
-myconnect (SOCKET s, struct sockaddr *addr, int addrlen)
-{
- int r;
- if (!NtSocketsInitialized++) {
- StartSockets();
- }
- if ((r = connect (s, addr, addrlen)) == SOCKET_ERROR)
- errno = WSAGetLastError();
- return r;
-}
-
-
-#undef getpeername
-
-int
-mygetpeername (SOCKET s, struct sockaddr *addr, int *addrlen)
-{
- int r;
- if (!NtSocketsInitialized++) {
- StartSockets();
- }
- if ((r = getpeername (s, addr, addrlen)) == SOCKET_ERROR)
- errno = WSAGetLastError();
- return r;
-}
-
-#undef getsockname
-
-int
-mygetsockname (SOCKET s, struct sockaddr *addr, int *addrlen)
-{
- int r;
- if (!NtSocketsInitialized++) {
- StartSockets();
- }
- if ((r = getsockname (s, addr, addrlen)) == SOCKET_ERROR)
- errno = WSAGetLastError();
- return r;
-}
-
-#undef getsockopt
-
-int
-mygetsockopt (SOCKET s, int level, int optname, char *optval, int *optlen)
-{
- int r;
- if (!NtSocketsInitialized++) {
- StartSockets();
- }
- if ((r = getsockopt (s, level, optname, optval, optlen)) == SOCKET_ERROR)
- errno = WSAGetLastError();
- return r;
-}
-
-#undef ioctlsocket
-
-int
-myioctlsocket (SOCKET s, long cmd, u_long *argp)
-{
- int r;
- if (!NtSocketsInitialized++) {
- StartSockets();
- }
- if ((r = ioctlsocket (s, cmd, argp)) == SOCKET_ERROR)
- errno = WSAGetLastError();
- return r;
-}
-
-#undef listen
-
-int
-mylisten (SOCKET s, int backlog)
-{
- int r;
- if (!NtSocketsInitialized++) {
- StartSockets();
- }
- if ((r = listen (s, backlog)) == SOCKET_ERROR)
- errno = WSAGetLastError();
- return r;
-}
-
-#undef recv
-
-int
-myrecv (SOCKET s, char *buf, int len, int flags)
-{
- int r;
- if (!NtSocketsInitialized++) {
- StartSockets();
- }
- if ((r = recv (s, buf, len, flags)) == SOCKET_ERROR)
- errno = WSAGetLastError();
- return r;
-}
-
-#undef recvfrom
-
-int
-myrecvfrom (SOCKET s, char *buf, int len, int flags,
- struct sockaddr *from, int *fromlen)
-{
- int r;
- if (!NtSocketsInitialized++) {
- StartSockets();
- }
- if ((r = recvfrom (s, buf, len, flags, from, fromlen)) == SOCKET_ERROR)
- errno = WSAGetLastError();
- return r;
-}
-
-#undef send
-
-int
-mysend (SOCKET s, char *buf, int len, int flags)
-{
- int r;
- if (!NtSocketsInitialized++) {
- StartSockets();
- }
- if ((r = send (s, buf, len, flags)) == SOCKET_ERROR)
- errno = WSAGetLastError();
- return r;
-}
-
-#undef sendto
-
-int
-mysendto (SOCKET s, char *buf, int len, int flags,
- struct sockaddr *to, int tolen)
-{
- int r;
- if (!NtSocketsInitialized++) {
- StartSockets();
- }
- if ((r = sendto (s, buf, len, flags, to, tolen)) == SOCKET_ERROR)
- errno = WSAGetLastError();
- return r;
-}
-
-#undef setsockopt
-
-int
-mysetsockopt (SOCKET s, int level, int optname, char *optval, int optlen)
-{
- int r;
- if (!NtSocketsInitialized++) {
- StartSockets();
- }
- if ((r = setsockopt (s, level, optname, optval, optlen)) == SOCKET_ERROR)
- errno = WSAGetLastError();
- return r;
-}
-
-#undef shutdown
-
-int
-myshutdown (SOCKET s, int how)
-{
- int r;
- if (!NtSocketsInitialized++) {
- StartSockets();
- }
- if ((r = shutdown (s, how)) == SOCKET_ERROR)
- errno = WSAGetLastError();
- return r;
-}
-
-#undef socket
-
-SOCKET
-mysocket (int af, int type, int protocol)
-{
- SOCKET s;
- if (!NtSocketsInitialized++) {
- StartSockets();
- }
- if ((s = socket (af, type, protocol)) == INVALID_SOCKET)
- errno = WSAGetLastError();
- return s;
-}
-
-#undef gethostbyaddr
-
-struct hostent *
-mygethostbyaddr (char *addr, int len, int type)
-{
- struct hostent *r;
- if (!NtSocketsInitialized++) {
- StartSockets();
- }
- if ((r = gethostbyaddr (addr, len, type)) == NULL)
- errno = WSAGetLastError();
- return r;
-}
-
-#undef gethostbyname
-
-struct hostent *
-mygethostbyname (char *name)
-{
- struct hostent *r;
- if (!NtSocketsInitialized++) {
- StartSockets();
- }
- if ((r = gethostbyname (name)) == NULL)
- errno = WSAGetLastError();
- return r;
-}
-
-#undef gethostname
-
-int
-mygethostname (char *name, int len)
-{
- int r;
- if (!NtSocketsInitialized++) {
- StartSockets();
- }
- if ((r = gethostname (name, len)) == SOCKET_ERROR)
- errno = WSAGetLastError();
- return r;
-}
-
-#undef getprotobyname
-
-struct protoent *
-mygetprotobyname (char *name)
-{
- struct protoent *r;
- if (!NtSocketsInitialized++) {
- StartSockets();
- }
- if ((r = getprotobyname (name)) == NULL)
- errno = WSAGetLastError();
- return r;
-}
-
-#undef getprotobynumber
-
-struct protoent *
-mygetprotobynumber (int num)
-{
- struct protoent *r;
- if (!NtSocketsInitialized++) {
- StartSockets();
- }
- if ((r = getprotobynumber (num)) == NULL)
- errno = WSAGetLastError();
- return r;
-}
-
-#undef getservbyname
-
-struct servent *
-mygetservbyname (char *name, char *proto)
-{
- struct servent *r;
- if (!NtSocketsInitialized++) {
- StartSockets();
- }
- if ((r = getservbyname (name, proto)) == NULL)
- errno = WSAGetLastError();
- return r;
-}
-
-#undef getservbyport
-
-struct servent *
-mygetservbyport (int port, char *proto)
-{
- struct servent *r;
- if (!NtSocketsInitialized++) {
- StartSockets();
- }
- if ((r = getservbyport (port, proto)) == NULL)
- errno = WSAGetLastError();
- return r;
-}
-
-//
-// Networking stubs
-//
-
-void endhostent() {}
-void endnetent() {}
-void endprotoent() {}
-void endservent() {}
-
-struct netent *getnetent (void) {return (struct netent *) NULL;}
-
-struct netent *getnetbyaddr(char *name) {return (struct netent *)NULL;}
-
-struct netent *getnetbyname(long net, int type) {return (struct netent *)NULL;}
-
-struct protoent *getprotoent (void) {return (struct protoent *) NULL;}
-
-struct servent *getservent (void) {return (struct servent *) NULL;}
-
-void sethostent (int stayopen) {}
-
-void setnetent (int stayopen) {}
-
-void setprotoent (int stayopen) {}
-
-void setservent (int stayopen) {}
-
-
-#ifndef WNOHANG
-#define WNOHANG -1
-#endif
-
-pid_t
-waitpid (pid_t pid, int *stat_loc, int options)
-{
- DWORD timeout;
-
- if (options == WNOHANG) {
- timeout = 0;
- } else {
- timeout = INFINITE;
- }
- if (WaitForSingleObject((HANDLE) pid, timeout) == WAIT_OBJECT_0) {
- pid = _cwait(stat_loc, pid, 0);
- return pid;
- }
- return 0;
-}
-
-#include <sys/timeb.h>
-
-void _cdecl
-gettimeofday(struct timeval *tv, struct timezone *tz)
-{
- struct timeb tb;
-
- ftime(&tb);
- tv->tv_sec = tb.time;
- tv->tv_usec = tb.millitm * 1000;
-}
-
-char *
-getcwd(buffer, size)
- char *buffer;
- int size;
-{
- int length;
- char *bp;
-
- if (_getcwd(buffer, size) == NULL) {
- return NULL;
- }
- length = strlen(buffer);
- if (length >= size) {
- return NULL;
- }
-
- for (bp = buffer; *bp != '\0'; bp++) {
- if (*bp == '\\') {
- *bp = '/';
- }
- }
- return buffer;
-}
-
-static char *
-str_grow(struct RString *str, size_t new_size)
-{
- char *p;
-
- p = realloc(str->ptr, new_size);
- if (p == NULL)
- Fatal("cannot grow string\n");
-
- str->len = new_size;
- str->ptr = p;
-
- return p;
-}
-
-int
-chown(char *path, int owner, int group)
-{
- return 0;
-}
-
-int
-kill(int pid, int sig)
-{
-#if 1
- if (pid == GetCurrentProcessId())
- return raise(sig);
-
- if (sig == 2 && pid > 0)
- if (GenerateConsoleCtrlEvent(CTRL_C_EVENT, (DWORD)pid))
- return 0;
-
- return -1;
-#else
- return 0;
-#endif
-}
-
-int
-link(char *from, char *to)
-{
- return -1;
-}
-
-int
-wait()
-{
- return 0;
-}
-
+/* + * Copyright (c) 1993, Intergraph Corporation + * + * You may distribute under the terms of either the GNU General Public + * License or the Artistic License, as specified in the perl README file. + * + * Various Unix compatibility functions and NT specific functions. + * + * Some of this code was derived from the MSDOS port(s) and the OS/2 port. + * + */ + +#include "ruby.h" +#include <fcntl.h> +#include <process.h> +#include <sys/stat.h> +/* #include <sys/wait.h> */ +#include <stdio.h> +#include <stdlib.h> +#include <errno.h> +#include <assert.h> + +#include <windows.h> +#include <winbase.h> +#include <wincon.h> +#include "nt.h" +#include "dir.h" +#ifndef index +#define index(x, y) strchr((x), (y)) +#endif + +#ifndef bool +#define bool int +#endif + +bool NtSyncProcess = TRUE; +#if 0 // declared in header file +extern char **environ; +#define environ _environ +#endif + +static bool NtHasRedirection (char *); +static int valid_filename(char *s); +static void StartSockets (); +static char *str_grow(struct RString *str, size_t new_size); + +char *NTLoginName; + +DWORD Win32System = (DWORD)-1; + +static DWORD +IdOS(void) +{ + static OSVERSIONINFO osver; + + if (osver.dwPlatformId != Win32System) { + memset(&osver, 0, sizeof(OSVERSIONINFO)); + osver.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + GetVersionEx(&osver); + Win32System = osver.dwPlatformId; + } + return (Win32System); +} + +static int +IsWin95(void) { + return (IdOS() == VER_PLATFORM_WIN32_WINDOWS); +} + +static int +IsWinNT(void) { + return (IdOS() == VER_PLATFORM_WIN32_NT); +} + + +/* simulate flock by locking a range on the file */ + + +#define LK_ERR(f,i) ((f) ? (i = 0) : (errno = GetLastError())) +#define LK_LEN 0xffff0000 + +int +flock(int fd, int oper) +{ + OVERLAPPED o; + int i = -1; + HANDLE fh; + + fh = (HANDLE)_get_osfhandle(fd); + memset(&o, 0, sizeof(o)); + + if(IsWinNT()) { + switch(oper) { + case LOCK_SH: /* shared lock */ + LK_ERR(LockFileEx(fh, 0, 0, LK_LEN, 0, &o),i); + break; + case LOCK_EX: /* exclusive lock */ + LK_ERR(LockFileEx(fh, LOCKFILE_EXCLUSIVE_LOCK, 0, LK_LEN, 0, &o),i); + break; + case LOCK_SH|LOCK_NB: /* non-blocking shared lock */ + LK_ERR(LockFileEx(fh, LOCKFILE_FAIL_IMMEDIATELY, 0, LK_LEN, 0, &o),i); + break; + case LOCK_EX|LOCK_NB: /* non-blocking exclusive lock */ + LK_ERR(LockFileEx(fh, + LOCKFILE_EXCLUSIVE_LOCK|LOCKFILE_FAIL_IMMEDIATELY, + 0, LK_LEN, 0, &o),i); + if(errno == EDOM) errno = EWOULDBLOCK; + break; + case LOCK_UN: /* unlock lock */ + if (UnlockFileEx(fh, 0, LK_LEN, 0, &o)) { + i = 0; + } + else { + /* GetLastError() must returns `ERROR_NOT_LOCKED' */ + errno = EWOULDBLOCK; + } + if(errno == EDOM) errno = EWOULDBLOCK; + break; + default: /* unknown */ + errno = EINVAL; + break; + } + } + else if(IsWin95()) { + switch(oper) { + case LOCK_EX: + while(i == -1) { + LK_ERR(LockFile(fh, 0, 0, LK_LEN, 0), i); + if(errno != EDOM && i == -1) break; + } + break; + case LOCK_EX | LOCK_NB: + LK_ERR(LockFile(fh, 0, 0, LK_LEN, 0), i); + if(errno == EDOM) errno = EWOULDBLOCK; + break; + case LOCK_UN: + LK_ERR(UnlockFile(fh, 0, 0, LK_LEN, 0), i); + if(errno == EDOM) errno = EWOULDBLOCK; + break; + default: + errno = EINVAL; + break; + } + } + return i; +} + +#undef LK_ERR +#undef LK_LEN + + +#undef const +FILE *fdopen(int, const char *); + +#if 0 +void +sleep(unsigned int len) +{ + time_t end; + + end = time((time_t *)0) + len; + while (time((time_t *)0) < end) + ; +} +#endif + +// +// Initialization stuff +// +void +NtInitialize(int *argc, char ***argv) { + + WORD version; + int ret; + + // + // subvert cmd.exe\'s feeble attempt at command line parsing + // + *argc = NtMakeCmdVector((char *)GetCommandLine(), argv, TRUE); + + // + // Now set up the correct time stuff + // + + tzset(); + + // Initialize Winsock + // StartSockets(); +} + + +char *getlogin() +{ + char buffer[200]; + int len = 200; + extern char *NTLoginName; + + if (NTLoginName == NULL) { + if (GetUserName(buffer, &len)) { + NTLoginName = ALLOC_N(char, len+1); + strncpy(NTLoginName, buffer, len); + NTLoginName[len] = '\0'; + } + else { + NTLoginName = "<Unknown>"; + } + } + return NTLoginName; +} + + + +#if 1 +// popen stuff + +// +// use these so I can remember which index is which +// + +#define NtPipeRead 0 // index of pipe read descriptor +#define NtPipeWrite 1 // index of pipe write descriptor + +#define NtPipeSize 1024 // size of pipe buffer + +#define MYPOPENSIZE 256 // size of book keeping structure + +struct { + int inuse; + int pid; + HANDLE oshandle; + FILE *pipe; +} MyPopenRecord[MYPOPENSIZE]; + +int SafeFree(char **vec, int vecc) +{ + // vec + // | + // V ^---------------------V + // +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ + // | | | .... | NULL | | ..... |\0 | | ..... |\0 |... + // +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ + // |- elements+1 -| ^ 1st element ^ 2nd element + + char *p; + + p = (char *)(vec - (vecc * sizeof (char *) + 1)); + free(p); + + return 0; +} + + +static char *szInternalCmds[] = { + "cd", + "chdir", + "cls", + "copy", + "date", + "del", + "dir", + "echo", + "erase", + "label", + "md", + "mkdir", + "path", + "rd", + "rem", + "ren", + "rename", + "rmdir", + "set", + "start", + "time", + "type", + "ver", + "vol", +}; + +int +isInternalCmd(char *cmd) +{ + int fRet; + char **vec; + int vecc = NtMakeCmdVector(cmd, &vec, FALSE); + + SafeFree (vec, vecc); + + return 0; +} + + +FILE * +mypopen (char *cmd, char *mode) +{ + FILE *fp; + int saved, reading; + int pipemode; + int pipes[2]; + int pid; + int slot; + static initialized = 0; + + // + // if first time through, intialize our book keeping structure + // + + if (!initialized++) { + for (slot = 0; slot < MYPOPENSIZE; slot++) + MyPopenRecord[slot].inuse = FALSE; + } + + //printf("mypopen %s\n", cmd); + + // + // find a free popen slot + // + + for (slot = 0; slot < MYPOPENSIZE && MyPopenRecord[slot].inuse; slot++) + ; + + if (slot > MYPOPENSIZE) { + return NULL; + } + + // + // Figure out what we\'re doing... + // + + reading = (*mode == 'r') ? TRUE : FALSE; + pipemode = (*(mode+1) == 'b') ? O_BINARY : O_TEXT; + + // + // Now get a pipe + // + +#if 0 + if (_pipe(pipes, NtPipeSize, pipemode) == -1) { + return NULL; + } + + if (reading) { + + // + // we\'re reading from the pipe, so we must hook up the + // write end of the pipe to the new processes stdout. + // To do this we must save our file handle from stdout + // by _dup\'ing it, then setting our stdout to be the pipe\'s + // write descriptor. We must also make the write handle + // inheritable so the new process can use it. + + if ((saved = _dup(fileno(stdout))) == -1) { + _close(pipes[NtPipeRead]); + _close(pipes[NtPipeWrite]); + return NULL; + } + if (_dup2 (pipes[NtPipeWrite], fileno(stdout)) == -1) { + _close(pipes[NtPipeRead]); + _close(pipes[NtPipeWrite]); + return NULL; + } + } + else { + // + // must be writing to the new process. Do the opposite of + // the above, i.e. hook up the processes stdin to the read + // end of the pipe. + // + + if ((saved = _dup(fileno(stdin))) == -1) { + _close(pipes[NtPipeRead]); + _close(pipes[NtPipeWrite]); + return NULL; + } + if (_dup2(pipes[NtPipeRead], fileno(stdin)) == -1) { + _close(pipes[NtPipeRead]); + _close(pipes[NtPipeWrite]); + return NULL; + } + } + + // + // Start the new process. Must set _fileinfo to non-zero value + // for file descriptors to be inherited. Reset after the process + // is started. + // + + if (NtHasRedirection(cmd)) { + docmd: + pid = spawnlpe(_P_NOWAIT, "cmd.exe", "/c", cmd, 0, environ); + if (pid == -1) { + _close(pipes[NtPipeRead]); + _close(pipes[NtPipeWrite]); + return NULL; + } + } + else { + char **vec; + int vecc = NtMakeCmdVector(cmd, &vec, FALSE); + + //pid = spawnvpe (_P_NOWAIT, vec[0], vec, environ); + pid = spawnvpe (_P_WAIT, vec[0], vec, environ); + if (pid == -1) { + goto docmd; + } + Safefree (vec, vecc); + } + + if (reading) { + + // + // We need to close our instance of the inherited pipe write + // handle now that it's been inherited so that it will actually close + // when the child process ends. + // + + if (_close(pipes[NtPipeWrite]) == -1) { + _close(pipes[NtPipeRead]); + return NULL; + } + if (_dup2 (saved, fileno(stdout)) == -1) { + _close(pipes[NtPipeRead]); + return NULL; + } + _close(saved); + + // + // Now get a stream pointer to return to the calling program. + // + + if ((fp = (FILE *) fdopen(pipes[NtPipeRead], mode)) == NULL) { + return NULL; + } + } + else { + + // + // need to close our read end of the pipe so that it will go + // away when the write end is closed. + // + + if (_close(pipes[NtPipeRead]) == -1) { + _close(pipes[NtPipeWrite]); + return NULL; + } + if (_dup2 (saved, fileno(stdin)) == -1) { + _close(pipes[NtPipeWrite]); + return NULL; + } + _close(saved); + + // + // Now get a stream pointer to return to the calling program. + // + + if ((fp = (FILE *) fdopen(pipes[NtPipeWrite], mode)) == NULL) { + _close(pipes[NtPipeWrite]); + return NULL; + } + } + + // + // do the book keeping + // + + MyPopenRecord[slot].inuse = TRUE; + MyPopenRecord[slot].pipe = fp; + MyPopenRecord[slot].pid = pid; + + return fp; +#else + { + int p[2]; + + BOOL fRet; + HANDLE hInFile, hOutFile, hStdin, hStdout; + LPCSTR lpApplicationName = NULL; + LPTSTR lpCommandLine; + LPTSTR lpCmd2 = NULL; + DWORD dwCreationFlags; + STARTUPINFO aStartupInfo; + PROCESS_INFORMATION aProcessInformation; + SECURITY_ATTRIBUTES sa; + int fd; + + sa.nLength = sizeof (SECURITY_ATTRIBUTES); + sa.lpSecurityDescriptor = NULL; + sa.bInheritHandle = TRUE; + + if (!reading) { + FILE *fp; + + fp = (_popen)(cmd, mode); + + MyPopenRecord[slot].inuse = TRUE; + MyPopenRecord[slot].pipe = fp; + MyPopenRecord[slot].pid = -1; + + if (!fp) + Fatal("cannot open pipe \"%s\" (%s)", cmd, strerror(errno)); + return fp; + } + + + fRet = CreatePipe(&hInFile, &hOutFile, &sa, 2048L); + if (!fRet) + Fatal("cannot open pipe \"%s\" (%s)", cmd, strerror(errno)); + + memset(&aStartupInfo, 0, sizeof (STARTUPINFO)); + memset(&aProcessInformation, 0, sizeof (PROCESS_INFORMATION)); + aStartupInfo.cb = sizeof (STARTUPINFO); + aStartupInfo.dwFlags = STARTF_USESTDHANDLES; + + if (reading) { + aStartupInfo.hStdInput = GetStdHandle(STD_OUTPUT_HANDLE);//hStdin; + aStartupInfo.hStdError = INVALID_HANDLE_VALUE; + //for save + DuplicateHandle(GetCurrentProcess(), GetStdHandle(STD_OUTPUT_HANDLE), + GetCurrentProcess(), &hStdout, + 0, FALSE, DUPLICATE_SAME_ACCESS + ); + //for redirect + DuplicateHandle(GetCurrentProcess(), GetStdHandle(STD_INPUT_HANDLE), + GetCurrentProcess(), &hStdin, + 0, TRUE, DUPLICATE_SAME_ACCESS + ); + aStartupInfo.hStdOutput = hOutFile; + } + else { + aStartupInfo.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE); //hStdout; + aStartupInfo.hStdError = INVALID_HANDLE_VALUE; + // for save + DuplicateHandle(GetCurrentProcess(), GetStdHandle(STD_INPUT_HANDLE), + GetCurrentProcess(), &hStdin, + 0, FALSE, DUPLICATE_SAME_ACCESS + ); + //for redirect + DuplicateHandle(GetCurrentProcess(), GetStdHandle(STD_OUTPUT_HANDLE), + GetCurrentProcess(), &hStdout, + 0, TRUE, DUPLICATE_SAME_ACCESS + ); + aStartupInfo.hStdInput = hInFile; + } + + dwCreationFlags = (NORMAL_PRIORITY_CLASS); + + lpCommandLine = cmd; + if (NtHasRedirection(cmd) || isInternalCmd(cmd)) { + lpApplicationName = getenv("COMSPEC"); + lpCmd2 = malloc(strlen(lpApplicationName) + 1 + strlen(cmd) + sizeof (" /c ")); + if (lpCmd2 == NULL) + Fatal("Mypopen: malloc failed"); + sprintf(lpCmd2, "%s %s%s", lpApplicationName, " /c ", cmd); + lpCommandLine = lpCmd2; + } + + fRet = CreateProcess(lpApplicationName, lpCommandLine, &sa, &sa, + sa.bInheritHandle, dwCreationFlags, NULL, NULL, &aStartupInfo, &aProcessInformation); + + if (!fRet) { + CloseHandle(hInFile); + CloseHandle(hOutFile); + Fatal("cannot fork for \"%s\" (%s)", cmd, strerror(errno)); + } + + CloseHandle(aProcessInformation.hThread); + + if (reading) { + HANDLE hDummy; + + fd = _open_osfhandle((long)hInFile, (_O_RDONLY | pipemode)); + CloseHandle(hOutFile); + DuplicateHandle(GetCurrentProcess(), hStdout, + GetCurrentProcess(), &hDummy, + 0, TRUE, (DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE) + ); + } + else { + HANDLE hDummy; + + fd = _open_osfhandle((long)hOutFile, (_O_WRONLY | pipemode)); + CloseHandle(hInFile); + DuplicateHandle(GetCurrentProcess(), hStdin, + GetCurrentProcess(), &hDummy, + 0, TRUE, (DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE) + ); + } + + if (fd == -1) + Fatal("cannot open pipe \"%s\" (%s)", cmd, strerror(errno)); + + + if ((fp = (FILE *) fdopen(fd, mode)) == NULL) + return NULL; + + if (lpCmd2) + free(lpCmd2); + + MyPopenRecord[slot].inuse = TRUE; + MyPopenRecord[slot].pipe = fp; + MyPopenRecord[slot].oshandle = (reading ? hInFile : hOutFile); + MyPopenRecord[slot].pid = (int)aProcessInformation.hProcess; + return fp; + } +#endif +} + +int +mypclose(FILE *fp) +{ + int i; + int exitcode; + + Sleep(100); + for (i = 0; i < MYPOPENSIZE; i++) { + if (MyPopenRecord[i].inuse && MyPopenRecord[i].pipe == fp) + break; + } + if (i >= MYPOPENSIZE) { + Fatal("Invalid file pointer passed to mypclose!\n"); + } + + // + // get the return status of the process + // + +#if 0 + if (_cwait(&exitcode, MyPopenRecord[i].pid, WAIT_CHILD) == -1) { + if (errno == ECHILD) { + fprintf(stderr, "mypclose: nosuch child as pid %x\n", + MyPopenRecord[i].pid); + } + } +#else + for (;;) { + if (GetExitCodeProcess((HANDLE)MyPopenRecord[i].pid, &exitcode)) { + if (exitcode == STILL_ACTIVE) { + //printf("Process is Active.\n"); + Sleep(100); + TerminateProcess((HANDLE)MyPopenRecord[i].pid, 0); // ugly... + continue; + } + else if (exitcode == 0) { + //printf("done.\n"); + break; + } + else { + //printf("never.\n"); + break; + } + } + } +#endif + + + // + // close the pipe + // + CloseHandle(MyPopenRecord[i].oshandle); + fflush(fp); + fclose(fp); + + // + // free this slot + // + + MyPopenRecord[i].inuse = FALSE; + MyPopenRecord[i].pipe = NULL; + MyPopenRecord[i].pid = 0; + + return exitcode; +} +#endif + +#if 1 + + +typedef char* CHARP; +/* + * The following code is based on the do_exec and do_aexec functions + * in file doio.c + */ + +int +do_spawn(cmd) +char *cmd; +{ + register char **a; + register char *s; + char **argv; + int status; + char *shell, *cmd2; + int mode = NtSyncProcess ? P_WAIT : P_NOWAIT; + + /* save an extra exec if possible */ + if ((shell = getenv("RUBYSHELL")) != 0) { + if (NtHasRedirection(cmd)) { + int i; + char *p; + char *argv[4]; + char *cmdline = ALLOC_N(char, (strlen(cmd) * 2 + 1)); + + p=cmdline; + *p++ = '"'; + for (s=cmd; *s;) { + if (*s == '"') + *p++ = '\\'; /* Escape d-quote */ + *p++ = *s++; + } + *p++ = '"'; + *p = '\0'; + + /* fprintf(stderr, "do_spawn: %s %s\n", shell, cmdline); */ + argv[0] = shell; + argv[1] = "-c"; + argv[2] = cmdline; + argv[4] = NULL; + status = spawnvpe(mode, argv[0], argv, environ); + /* return spawnle(mode, shell, shell, "-c", cmd, (char*)0, environ); */ + free(cmdline); + return status; + } + } + else if ((shell = getenv("COMSPEC")) != 0) { + if (NtHasRedirection(cmd) /* || isInternalCmd(cmd) */) { + do_comspec_shell: + return spawnle(mode, shell, shell, "/c", cmd, (char*)0, environ); + } + } + + argv = ALLOC_N(CHARP, (strlen(cmd) / 2 + 2)); + cmd2 = ALLOC_N(char, (strlen(cmd) + 1)); + strcpy(cmd2, cmd); + a = argv; + for (s = cmd2; *s;) { + while (*s && isspace(*s)) s++; + if (*s) + *(a++) = s; + while (*s && !isspace(*s)) s++; + if (*s) + *s++ = '\0'; + } + *a = NULL; + if (argv[0]) { + if ((status = spawnvpe(mode, argv[0], argv, environ)) == -1) { + free(argv); + free(cmd2); + return -1; + } + } + free(cmd2); + free(argv); + return status; +} + +#endif + +typedef struct _NtCmdLineElement { + struct _NtCmdLineElement *next, *prev; + char *str; + int len; + int flags; +} NtCmdLineElement; + +// +// Possible values for flags +// + +#define NTGLOB 0x1 // element contains a wildcard +#define NTMALLOC 0x2 // string in element was malloc'ed +#define NTSTRING 0x4 // element contains a quoted string + +NtCmdLineElement *NtCmdHead = NULL, *NtCmdTail = NULL; + +void +NtFreeCmdLine(void) +{ + NtCmdLineElement *ptr; + + while(NtCmdHead) { + ptr = NtCmdHead; + NtCmdHead = NtCmdHead->next; + free(ptr); + } + NtCmdHead = NtCmdTail = NULL; +} + +// +// This function expands wild card characters that were spotted +// during the parse phase. The idea here is to call FindFirstFile and +// FindNextFile with the wildcard pattern specified, and splice in the +// resulting list of new names. If the wildcard pattern doesn\'t match +// any existing files, just leave it in the list. +// + +void +NtCmdGlob (NtCmdLineElement *patt) +{ + WIN32_FIND_DATA fd; + HANDLE fh; + char buffer[512]; + NtCmdLineElement *tmphead, *tmptail, *tmpcurr; + + strncpy(buffer, patt->str, patt->len); + buffer[patt->len] = '\0'; + if ((fh = FindFirstFile (buffer, &fd)) == INVALID_HANDLE_VALUE) { + return; + } + tmphead = tmptail = NULL; + do { + tmpcurr = ALLOC(NtCmdLineElement); + if (tmpcurr == NULL) { + fprintf(stderr, "Out of Memory in globbing!\n"); + while (tmphead) { + tmpcurr = tmphead; + tmphead = tmphead->next; + free(tmpcurr->str); + free(tmpcurr); + } + return; + } + memset (tmpcurr, 0, sizeof(*tmpcurr)); + tmpcurr->len = strlen(fd.cFileName); + tmpcurr->str = ALLOC_N(char, tmpcurr->len+1); + if (tmpcurr->str == NULL) { + fprintf(stderr, "Out of Memory in globbing!\n"); + while (tmphead) { + tmpcurr = tmphead; + tmphead = tmphead->next; + free(tmpcurr->str); + free(tmpcurr); + } + return; + } + strcpy(tmpcurr->str, fd.cFileName); + tmpcurr->flags |= NTMALLOC; + if (tmptail) { + tmptail->next = tmpcurr; + tmpcurr->prev = tmptail; + tmptail = tmpcurr; + } + else { + tmptail = tmphead = tmpcurr; + } + } while(FindNextFile(fh, &fd)); + + // + // ok, now we\'ve got a list of files that matched the wildcard + // specification. Put it in place of the pattern structure. + // + + tmphead->prev = patt->prev; + tmptail->next = patt->next; + + if (tmphead->prev) + tmphead->prev->next = tmphead; + + if (tmptail->next) + tmptail->next->prev = tmptail; + + // + // Now get rid of the pattern structure + // + + if (patt->flags & NTMALLOC) + free(patt->str); + // free(patt); //TODO: memory leak occures here. we have to fix it. +} + +// +// Check a command string to determine if it has I/O redirection +// characters that require it to be executed by a command interpreter +// + +static bool +NtHasRedirection (char *cmd) +{ + int inquote = 0; + char quote = '\0'; + char *ptr ; + + // + // Scan the string, looking for redirection (< or >) or pipe + // characters (|) that are not in a quoted string + // + + for (ptr = cmd; *ptr; ptr++) { + + switch (*ptr) { + + case '\'': + case '\"': + if (inquote) { + if (quote == *ptr) { + inquote = 0; + quote = '\0'; + } + } + else { + quote = *ptr; + inquote++; + } + break; + + case '>': + case '<': + + if (!inquote) + return TRUE; + } + } + return FALSE; +} + + +int +NtMakeCmdVector (char *cmdline, char ***vec, int InputCmd) +{ + int cmdlen = strlen(cmdline); + int done, instring, globbing, quoted, len; + int newline, need_free = 0, i; + int elements, strsz; + int slashes = 0; + char *ptr, *base, *buffer; + char **vptr; + char quote; + NtCmdLineElement *curr; + + // + // just return if we don\'t have a command line + // + + if (cmdlen == 0) { + *vec = NULL; + return 0; + } + + // + // strip trailing white space + // + + ptr = cmdline+(cmdlen - 1); + while(ptr >= cmdline && isspace(*ptr)) + --ptr; + *++ptr = '\0'; + + // + // check for newlines and formfeeds. If we find any, make a new + // command string that replaces them with escaped sequences (\n or \f) + // + + for (ptr = cmdline, newline = 0; *ptr; ptr++) { + if (*ptr == '\n' || *ptr == '\f') + newline++; + } + + if (newline) { + base = ALLOC_N(char, strlen(cmdline) + 1 + newline + slashes); + if (base == NULL) { + fprintf(stderr, "malloc failed!\n"); + return 0; + } + for (i = 0, ptr = base; (unsigned) i < strlen(cmdline); i++) { + switch (cmdline[i]) { + case '\n': + *ptr++ = '\\'; + *ptr++ = 'n'; + break; + default: + *ptr++ = cmdline[i]; + } + } + *ptr = '\0'; + cmdline = base; + need_free++; + } + + // + // Ok, parse the command line, building a list of CmdLineElements. + // When we\'ve finished, and it\'s an input command (meaning that it\'s + // the processes argv), we\'ll do globing and then build the argument + // vector. + // The outer loop does one interation for each element seen. + // The inner loop does one interation for each character in the element. + // + + for (done = 0, ptr = cmdline; *ptr;) { + + // + // zap any leading whitespace + // + + while(isspace(*ptr)) + ptr++; + base = ptr; + + for (done = newline = globbing = instring = quoted = 0; + *ptr && !done; ptr++) { + + // + // Switch on the current character. We only care about the + // white-space characters, the wild-card characters, and the + // quote characters. + // + + switch (*ptr) { + case ' ': + case '\t': +#if 0 + case '/': // have to do this for NT/DOS option strings + + // + // check to see if we\'re parsing an option switch + // + + if (*ptr == '/' && base == ptr) + continue; +#endif + // + // if we\'re not in a string, then we\'re finished with this + // element + // + + if (!instring) + done++; + break; + + case '*': + case '?': + + // + // record the fact that this element has a wildcard character + // N.B. Don\'t glob if inside a single quoted string + // + + if (!(instring && quote == '\'')) + globbing++; + break; + + case '\n': + + // + // If this string contains a newline, mark it as such so + // we can replace it with the two character sequence "\n" + // (cmd.exe doesn\'t like raw newlines in strings...sigh). + // + + newline++; + break; + + case '\'': + case '\"': + + // + // if we\'re already in a string, see if this is the + // terminating close-quote. If it is, we\'re finished with + // the string, but not neccessarily with the element. + // If we\'re not already in a string, start one. + // + + if (instring) { + if (quote == *ptr) { + instring = 0; + quote = '\0'; + } + } + else { + instring++; + quote = *ptr; + quoted++; + } + break; + } + } + + // + // need to back up ptr by one due to last increment of for loop + // (if we got out by seeing white space) + // + + if (*ptr) + ptr--; + + // + // when we get here, we\'ve got a pair of pointers to the element, + // base and ptr. Base points to the start of the element while ptr + // points to the character following the element. + // + + curr = ALLOC(NtCmdLineElement); + if (curr == NULL) { + NtFreeCmdLine(); + fprintf(stderr, "Out of memory!!\n"); + *vec = NULL; + return 0; + } + memset (curr, 0, sizeof(*curr)); + + len = ptr - base; + + // + // if it\'s an input vector element and it\'s enclosed by quotes, + // we can remove them. + // + + if (InputCmd && + ((base[0] == '\"' && base[len-1] == '\"') || + (base[0] == '\'' && base[len-1] == '\''))) { + base++; + len -= 2; + } + + curr->str = base; + curr->len = len; + curr->flags |= (globbing ? NTGLOB : 0); + + // + // Now put it in the list of elements + // + if (NtCmdTail) { + NtCmdTail->next = curr; + curr->prev = NtCmdTail; + NtCmdTail = curr; + } + else { + NtCmdHead = NtCmdTail = curr; + } + } + + if (InputCmd) { + + // + // When we get here we\'ve finished parsing the command line. Now + // we need to run the list, expanding any globbing patterns. + // + + for(curr = NtCmdHead; curr; curr = curr->next) { + if (curr->flags & NTGLOB) { + NtCmdGlob(curr); + } + } + } + + // + // Almost done! + // Count up the elements, then allocate space for a vector of pointers + // (argv) and a string table for the elements. + // + + for (elements = 0, strsz = 0, curr = NtCmdHead; curr; curr = curr->next) { + elements++; + strsz += (curr->len + 1); + } + + len = (elements+1)*sizeof(char *) + strsz; + buffer = ALLOC_N(char, len); + if (buffer == NULL) { + fprintf(stderr, "Out of memory!!\n"); + NtFreeCmdLine(); + *vec = NULL; + return 0; + } + + memset (buffer, 0, len); + + // + // make vptr point to the start of the buffer + // and ptr point to the area we\'ll consider the string table. + // + // buffer (*vec) + // | + // V ^---------------------V + // +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ + // | | | .... | NULL | | ..... |\0 | | ..... |\0 |... + // +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ + // |- elements+1 -| ^ 1st element ^ 2nd element + + vptr = (char **) buffer; + + ptr = buffer + (elements+1) * sizeof(char *); + + for (curr = NtCmdHead; curr; curr = curr->next) { + strncpy (ptr, curr->str, curr->len); + ptr[curr->len] = '\0'; + *vptr++ = ptr; + ptr += curr->len + 1; + } + NtFreeCmdLine(); + *vec = (char **) buffer; + return elements; +} + + +#if 1 +// +// UNIX compatible directory access functions for NT +// + +// +// File names are converted to lowercase if the +// CONVERT_TO_LOWER_CASE variable is defined. +// + +#define CONVERT_TO_LOWER_CASE +#define PATHLEN 1024 + +// +// The idea here is to read all the directory names into a string table +// (separated by nulls) and when one of the other dir functions is called +// return the pointer to the current file name. +// + +DIR * +opendir(char *filename) +{ + DIR *p; + long len; + long idx; + char scannamespc[PATHLEN]; + char *scanname = scannamespc; + struct stat sbuf; + WIN32_FIND_DATA FindData; + HANDLE fh; + char root[PATHLEN]; + char volname[PATHLEN]; + DWORD serial, maxname, flags; + BOOL downcase; + char *dummy; + + // + // check to see if we\'ve got a directory + // + + if (stat (filename, &sbuf) < 0 || + sbuf.st_mode & _S_IFDIR == 0) { + return NULL; + } + + // + // check out the file system characteristics + // + if (GetFullPathName(filename, PATHLEN, root, &dummy)) { + if (dummy = strchr(root, '\\')) + *++dummy = '\0'; + if (GetVolumeInformation(root, volname, PATHLEN, + &serial, &maxname, &flags, 0, 0)) { + downcase = !(flags & FS_CASE_SENSITIVE); + } + } + else { + downcase = TRUE; + } + + // + // Get us a DIR structure + // + + p = xcalloc(sizeof(DIR), 1); + if (p == NULL) + return NULL; + + // + // Create the search pattern + // + + strcpy(scanname, filename); + + if (index("/\\", *(scanname + strlen(scanname) - 1)) == NULL) + strcat(scanname, "/*"); + else + strcat(scanname, "*"); + + // + // do the FindFirstFile call + // + + fh = FindFirstFile (scanname, &FindData); + if (fh == INVALID_HANDLE_VALUE) { + return NULL; + } + + // + // now allocate the first part of the string table for the + // filenames that we find. + // + + idx = strlen(FindData.cFileName)+1; + p->start = ALLOC_N(char, idx); + strcpy (p->start, FindData.cFileName); + if (downcase) + strlwr(p->start); + p->nfiles++; + + // + // loop finding all the files that match the wildcard + // (which should be all of them in this directory!). + // the variable idx should point one past the null terminator + // of the previous string found. + // + while (FindNextFile(fh, &FindData)) { + len = strlen (FindData.cFileName); + + // + // bump the string table size by enough for the + // new name and it's null terminator + // + + #define Renew(x, y, z) (x = (z *)realloc(x, y)) + + Renew (p->start, idx+len+1, char); + if (p->start == NULL) { + Fatal ("opendir: malloc failed!\n"); + } + strcpy(&p->start[idx], FindData.cFileName); + if (downcase) + strlwr(&p->start[idx]); + p->nfiles++; + idx += len+1; + } + FindClose(fh); + p->size = idx; + p->curr = p->start; + return p; +} + + +// +// Readdir just returns the current string pointer and bumps the +// string pointer to the next entry. +// + +struct direct * +readdir(DIR *dirp) +{ + int len; + static int dummy = 0; + + if (dirp->curr) { + + // + // first set up the structure to return + // + + len = strlen(dirp->curr); + strcpy(dirp->dirstr.d_name, dirp->curr); + dirp->dirstr.d_namlen = len; + + // + // Fake inode + // + dirp->dirstr.d_ino = dummy++; + + // + // Now set up for the next call to readdir + // + + dirp->curr += len + 1; + if (dirp->curr >= (dirp->start + dirp->size)) { + dirp->curr = NULL; + } + + return &(dirp->dirstr); + + } else + return NULL; +} + +// +// Telldir returns the current string pointer position +// + +long +telldir(DIR *dirp) +{ + return (long) dirp->curr; /* ouch! pointer to long cast */ +} + +// +// Seekdir moves the string pointer to a previously saved position +// (Saved by telldir). + +void +seekdir(DIR *dirp, long loc) +{ + dirp->curr = (char *) loc; /* ouch! long to pointer cast */ +} + +// +// Rewinddir resets the string pointer to the start +// + +void +rewinddir(DIR *dirp) +{ + dirp->curr = dirp->start; +} + +// +// This just free\'s the memory allocated by opendir +// + +void +closedir(DIR *dirp) +{ + free(dirp->start); + free(dirp); +} +#endif + + +// +// 98.2% of this code was lifted from the OS2 port. (JCW) +// + +#if 0 +// add_suffix is in util.c too. +/* + * Suffix appending for in-place editing under MS-DOS and OS/2 (and now NT!). + * + * Here are the rules: + * + * Style 0: Append the suffix exactly as standard perl would do it. + * If the filesystem groks it, use it. (HPFS will always + * grok it. So will NTFS. FAT will rarely accept it.) + * + * Style 1: The suffix begins with a '.'. The extension is replaced. + * If the name matches the original name, use the fallback method. + * + * Style 2: The suffix is a single character, not a '.'. Try to add the + * suffix to the following places, using the first one that works. + * [1] Append to extension. + * [2] Append to filename, + * [3] Replace end of extension, + * [4] Replace end of filename. + * If the name matches the original name, use the fallback method. + * + * Style 3: Any other case: Ignore the suffix completely and use the + * fallback method. + * + * Fallback method: Change the extension to ".$$$". If that matches the + * original name, then change the extension to ".~~~". + * + * If filename is more than 1000 characters long, we die a horrible + * death. Sorry. + * + * The filename restriction is a cheat so that we can use buf[] to store + * assorted temporary goo. + * + * Examples, assuming style 0 failed. + * + * suffix = ".bak" (style 1) + * foo.bar => foo.bak + * foo.bak => foo.$$$ (fallback) + * foo.$$$ => foo.~~~ (fallback) + * makefile => makefile.bak + * + * suffix = "~" (style 2) + * foo.c => foo.c~ + * foo.c~ => foo.c~~ + * foo.c~~ => foo~.c~~ + * foo~.c~~ => foo~~.c~~ + * foo~~~~~.c~~ => foo~~~~~.$$$ (fallback) + * + * foo.pas => foo~.pas + * makefile => makefile.~ + * longname.fil => longname.fi~ + * longname.fi~ => longnam~.fi~ + * longnam~.fi~ => longnam~.$$$ + * + */ + + +static char suffix1[] = ".$$$"; +static char suffix2[] = ".~~~"; + +#define ext (&buf[1000]) + +#define strEQ(s1,s2) (strcmp(s1,s2) == 0) + +void +add_suffix(struct RString *str, char *suffix) +{ + int baselen; + int extlen = strlen(suffix); + char *s, *t, *p; + int slen; + char buf[1024]; + + if (str->len > 1000) + Fatal("Cannot do inplace edit on long filename (%d characters)", str->len); + + /* Style 0 */ + slen = str->len; + str_cat(str, suffix, extlen); + if (valid_filename(str->ptr)) return; + + /* Fooey, style 0 failed. Fix str before continuing. */ + str->ptr[str->len = slen] = '\0'; + + slen = extlen; + t = buf; baselen = 0; s = str->ptr; + while ( (*t = *s) && *s != '.') { + baselen++; + if (*s == '\\' || *s == '/') baselen = 0; + s++; t++; + } + p = t; + + t = ext; extlen = 0; + while (*t++ = *s++) extlen++; + if (extlen == 0) { ext[0] = '.'; ext[1] = 0; extlen++; } + + if (*suffix == '.') { /* Style 1 */ + if (strEQ(ext, suffix)) goto fallback; + strcpy(p, suffix); + } else if (suffix[1] == '\0') { /* Style 2 */ + if (extlen < 4) { + ext[extlen] = *suffix; + ext[++extlen] = '\0'; + } else if (baselen < 8) { + *p++ = *suffix; + } else if (ext[3] != *suffix) { + ext[3] = *suffix; + } else if (buf[7] != *suffix) { + buf[7] = *suffix; + } else goto fallback; + strcpy(p, ext); + } else { /* Style 3: Panic */ +fallback: + (void)memcpy(p, strEQ(ext, suffix1) ? suffix2 : suffix1, 5); + } + str_grow(str, strlen(buf)); + memcpy(str->ptr, buf, str->len); +} +#endif + +static int +valid_filename(char *s) +{ + int fd; + + // + // if the file exists, then it\'s a valid filename! + // + + if (_access(s, 0) == 0) { + return 1; + } + + // + // It doesn\'t exist, so see if we can open it. + // + + if ((fd = _open(s, _O_CREAT, 0666)) >= 0) { + close(fd); + _unlink (s); // don\'t leave it laying around + return 1; + } + return 0; +} + + +// +// This is a clone of fdopen so that we can handle the +// brain damaged version of sockets that NT gets to use. +// +// The problem is that sockets are not real file handles and +// cannot be fdopen\'ed. This causes problems in the do_socket +// routine in doio.c, since it tries to create two file pointers +// for the socket just created. We\'ll fake out an fdopen and see +// if we can prevent perl from trying to do stdio on sockets. +// + +FILE * +fdopen (int fd, const char *mode) +{ + FILE *fp; + char sockbuf[80]; + int optlen; + int retval; + extern int errno; + + retval = getsockopt((SOCKET)fd, SOL_SOCKET, SO_TYPE, sockbuf, &optlen); + if (retval == SOCKET_ERROR) { + int iRet; + + iRet = WSAGetLastError(); + if (iRet == WSAENOTSOCK || iRet == WSANOTINITIALISED) + return (_fdopen(fd, mode)); + } + + // + // If we get here, then fd is actually a socket. + // + fp = xcalloc(sizeof(FILE), 1); +#if _MSC_VER < 800 + fileno(fp) = fd; +#else + fp->_file = fd; +#endif + if (*mode == 'r') + fp->_flag = _IOREAD; + else + fp->_flag = _IOWRT; + return fp; +} + + +// +// Since the errors returned by the socket error function +// WSAGetLastError() are not known by the library routine strerror +// we have to roll our own. +// + +#undef strerror + +char * +mystrerror(int e) +{ + static char buffer[512]; + extern int sys_nerr; + DWORD source = 0; + + if (e < 0 || e > sys_nerr) { + if (e < 0) + e = GetLastError(); + if (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, &source, e, 0, + buffer, 512, NULL) == 0) { + strcpy (buffer, "Unknown Error"); + } + return buffer; + } + return strerror(e); + +} + +// +// various stubs +// + + +// Ownership +// +// Just pretend that everyone is a superuser. NT will let us know if +// we don\'t really have permission to do something. +// + +#define ROOT_UID 0 +#define ROOT_GID 0 + +UIDTYPE +getuid(void) +{ + return ROOT_UID; +} + +UIDTYPE +geteuid(void) +{ + return ROOT_UID; +} + +GIDTYPE +getgid(void) +{ + return ROOT_GID; +} + +GIDTYPE +getegid(void) +{ + return ROOT_GID; +} + +int +setuid(int uid) +{ + return (uid == ROOT_UID ? 0 : -1); +} + +int +setgid(int gid) +{ + return (gid == ROOT_GID ? 0 : -1); +} + +// +// File system stuff +// + +int +/* ioctl(int i, unsigned int u, char *data) */ +ioctl(int i, unsigned int u, long data) +{ + return -1; +} + + +// +// Networking trampolines +// These are used to avoid socket startup/shutdown overhead in case +// the socket routines aren\'t used. +// + +#undef select + +static int NtSocketsInitialized = 0; + +long +myselect (int nfds, fd_set *rd, fd_set *wr, fd_set *ex, + struct timeval *timeout) +{ + long r; + if (!NtSocketsInitialized++) { + StartSockets(); + } + if ((r = select (nfds, rd, wr, ex, timeout)) == SOCKET_ERROR) + errno = WSAGetLastError(); + return r; +} + +static void +StartSockets () { + WORD version; + WSADATA retdata; + int ret; + + // + // initalize the winsock interface and insure that it\'s + // cleaned up at exit. + // + version = MAKEWORD(1, 1); + if (ret = WSAStartup(version, &retdata)) + Fatal ("Unable to locate winsock library!\n"); + if (LOBYTE(retdata.wVersion) != 1) + Fatal("could not find version 1 of winsock dll\n"); + + if (HIBYTE(retdata.wVersion) != 1) + Fatal("could not find version 1 of winsock dll\n"); + + atexit((void (*)(void)) WSACleanup); +} + +#undef accept + +SOCKET +myaccept (SOCKET s, struct sockaddr *addr, int *addrlen) +{ + SOCKET r; + + if (!NtSocketsInitialized++) { + StartSockets(); + } + if ((r = accept (s, addr, addrlen)) == INVALID_SOCKET) + errno = WSAGetLastError(); + return r; +} + +#undef bind + +int +mybind (SOCKET s, struct sockaddr *addr, int addrlen) +{ + int r; + + if (!NtSocketsInitialized++) { + StartSockets(); + } + if ((r = bind (s, addr, addrlen)) == SOCKET_ERROR) + errno = WSAGetLastError(); + return r; +} + +#undef connect + +int +myconnect (SOCKET s, struct sockaddr *addr, int addrlen) +{ + int r; + if (!NtSocketsInitialized++) { + StartSockets(); + } + if ((r = connect (s, addr, addrlen)) == SOCKET_ERROR) + errno = WSAGetLastError(); + return r; +} + + +#undef getpeername + +int +mygetpeername (SOCKET s, struct sockaddr *addr, int *addrlen) +{ + int r; + if (!NtSocketsInitialized++) { + StartSockets(); + } + if ((r = getpeername (s, addr, addrlen)) == SOCKET_ERROR) + errno = WSAGetLastError(); + return r; +} + +#undef getsockname + +int +mygetsockname (SOCKET s, struct sockaddr *addr, int *addrlen) +{ + int r; + if (!NtSocketsInitialized++) { + StartSockets(); + } + if ((r = getsockname (s, addr, addrlen)) == SOCKET_ERROR) + errno = WSAGetLastError(); + return r; +} + +#undef getsockopt + +int +mygetsockopt (SOCKET s, int level, int optname, char *optval, int *optlen) +{ + int r; + if (!NtSocketsInitialized++) { + StartSockets(); + } + if ((r = getsockopt (s, level, optname, optval, optlen)) == SOCKET_ERROR) + errno = WSAGetLastError(); + return r; +} + +#undef ioctlsocket + +int +myioctlsocket (SOCKET s, long cmd, u_long *argp) +{ + int r; + if (!NtSocketsInitialized++) { + StartSockets(); + } + if ((r = ioctlsocket (s, cmd, argp)) == SOCKET_ERROR) + errno = WSAGetLastError(); + return r; +} + +#undef listen + +int +mylisten (SOCKET s, int backlog) +{ + int r; + if (!NtSocketsInitialized++) { + StartSockets(); + } + if ((r = listen (s, backlog)) == SOCKET_ERROR) + errno = WSAGetLastError(); + return r; +} + +#undef recv + +int +myrecv (SOCKET s, char *buf, int len, int flags) +{ + int r; + if (!NtSocketsInitialized++) { + StartSockets(); + } + if ((r = recv (s, buf, len, flags)) == SOCKET_ERROR) + errno = WSAGetLastError(); + return r; +} + +#undef recvfrom + +int +myrecvfrom (SOCKET s, char *buf, int len, int flags, + struct sockaddr *from, int *fromlen) +{ + int r; + if (!NtSocketsInitialized++) { + StartSockets(); + } + if ((r = recvfrom (s, buf, len, flags, from, fromlen)) == SOCKET_ERROR) + errno = WSAGetLastError(); + return r; +} + +#undef send + +int +mysend (SOCKET s, char *buf, int len, int flags) +{ + int r; + if (!NtSocketsInitialized++) { + StartSockets(); + } + if ((r = send (s, buf, len, flags)) == SOCKET_ERROR) + errno = WSAGetLastError(); + return r; +} + +#undef sendto + +int +mysendto (SOCKET s, char *buf, int len, int flags, + struct sockaddr *to, int tolen) +{ + int r; + if (!NtSocketsInitialized++) { + StartSockets(); + } + if ((r = sendto (s, buf, len, flags, to, tolen)) == SOCKET_ERROR) + errno = WSAGetLastError(); + return r; +} + +#undef setsockopt + +int +mysetsockopt (SOCKET s, int level, int optname, char *optval, int optlen) +{ + int r; + if (!NtSocketsInitialized++) { + StartSockets(); + } + if ((r = setsockopt (s, level, optname, optval, optlen)) == SOCKET_ERROR) + errno = WSAGetLastError(); + return r; +} + +#undef shutdown + +int +myshutdown (SOCKET s, int how) +{ + int r; + if (!NtSocketsInitialized++) { + StartSockets(); + } + if ((r = shutdown (s, how)) == SOCKET_ERROR) + errno = WSAGetLastError(); + return r; +} + +#undef socket + +SOCKET +mysocket (int af, int type, int protocol) +{ + SOCKET s; + if (!NtSocketsInitialized++) { + StartSockets(); + } + if ((s = socket (af, type, protocol)) == INVALID_SOCKET) + errno = WSAGetLastError(); + return s; +} + +#undef gethostbyaddr + +struct hostent * +mygethostbyaddr (char *addr, int len, int type) +{ + struct hostent *r; + if (!NtSocketsInitialized++) { + StartSockets(); + } + if ((r = gethostbyaddr (addr, len, type)) == NULL) + errno = WSAGetLastError(); + return r; +} + +#undef gethostbyname + +struct hostent * +mygethostbyname (char *name) +{ + struct hostent *r; + if (!NtSocketsInitialized++) { + StartSockets(); + } + if ((r = gethostbyname (name)) == NULL) + errno = WSAGetLastError(); + return r; +} + +#undef gethostname + +int +mygethostname (char *name, int len) +{ + int r; + if (!NtSocketsInitialized++) { + StartSockets(); + } + if ((r = gethostname (name, len)) == SOCKET_ERROR) + errno = WSAGetLastError(); + return r; +} + +#undef getprotobyname + +struct protoent * +mygetprotobyname (char *name) +{ + struct protoent *r; + if (!NtSocketsInitialized++) { + StartSockets(); + } + if ((r = getprotobyname (name)) == NULL) + errno = WSAGetLastError(); + return r; +} + +#undef getprotobynumber + +struct protoent * +mygetprotobynumber (int num) +{ + struct protoent *r; + if (!NtSocketsInitialized++) { + StartSockets(); + } + if ((r = getprotobynumber (num)) == NULL) + errno = WSAGetLastError(); + return r; +} + +#undef getservbyname + +struct servent * +mygetservbyname (char *name, char *proto) +{ + struct servent *r; + if (!NtSocketsInitialized++) { + StartSockets(); + } + if ((r = getservbyname (name, proto)) == NULL) + errno = WSAGetLastError(); + return r; +} + +#undef getservbyport + +struct servent * +mygetservbyport (int port, char *proto) +{ + struct servent *r; + if (!NtSocketsInitialized++) { + StartSockets(); + } + if ((r = getservbyport (port, proto)) == NULL) + errno = WSAGetLastError(); + return r; +} + +// +// Networking stubs +// + +void endhostent() {} +void endnetent() {} +void endprotoent() {} +void endservent() {} + +struct netent *getnetent (void) {return (struct netent *) NULL;} + +struct netent *getnetbyaddr(char *name) {return (struct netent *)NULL;} + +struct netent *getnetbyname(long net, int type) {return (struct netent *)NULL;} + +struct protoent *getprotoent (void) {return (struct protoent *) NULL;} + +struct servent *getservent (void) {return (struct servent *) NULL;} + +void sethostent (int stayopen) {} + +void setnetent (int stayopen) {} + +void setprotoent (int stayopen) {} + +void setservent (int stayopen) {} + + +#ifndef WNOHANG +#define WNOHANG -1 +#endif + +pid_t +waitpid (pid_t pid, int *stat_loc, int options) +{ + DWORD timeout; + + if (options == WNOHANG) { + timeout = 0; + } else { + timeout = INFINITE; + } + if (WaitForSingleObject((HANDLE) pid, timeout) == WAIT_OBJECT_0) { + pid = _cwait(stat_loc, pid, 0); + return pid; + } + return 0; +} + +#include <sys/timeb.h> + +void _cdecl +gettimeofday(struct timeval *tv, struct timezone *tz) +{ + struct timeb tb; + + ftime(&tb); + tv->tv_sec = tb.time; + tv->tv_usec = tb.millitm * 1000; +} + +char * +getcwd(buffer, size) + char *buffer; + int size; +{ + int length; + char *bp; + + if (_getcwd(buffer, size) == NULL) { + return NULL; + } + length = strlen(buffer); + if (length >= size) { + return NULL; + } + + for (bp = buffer; *bp != '\0'; bp++) { + if (*bp == '\\') { + *bp = '/'; + } + } + return buffer; +} + +static char * +str_grow(struct RString *str, size_t new_size) +{ + char *p; + + p = realloc(str->ptr, new_size); + if (p == NULL) + Fatal("cannot grow string\n"); + + str->len = new_size; + str->ptr = p; + + return p; +} + +int +chown(char *path, int owner, int group) +{ + return 0; +} + +int +kill(int pid, int sig) +{ +#if 1 + if (pid == GetCurrentProcessId()) + return raise(sig); + + if (sig == 2 && pid > 0) + if (GenerateConsoleCtrlEvent(CTRL_C_EVENT, (DWORD)pid)) + return 0; + + return -1; +#else + return 0; +#endif +} + +int +link(char *from, char *to) +{ + return -1; +} + +int +wait() +{ + return 0; +} + diff --git a/missing/nt.h b/missing/nt.h index b52cc4346c..5977a59a1d 100644 --- a/missing/nt.h +++ b/missing/nt.h @@ -18,7 +18,7 @@ // Define the following so we don't get tons of extra stuff // when we include windows.h // -#if 0
+#if 0 #define NOGDICAPMASKS #define NOVIRTUALKEYCODES #define NOWINMESSAGES @@ -57,16 +57,16 @@ #define NOHELP #define NOPROFILER #define NODEFERWINDOWPOS -#endif
+#endif // // Ok now we can include the normal include files. // -// #include <stdarg.h> conflict with varargs.h?
-// There is function-name conflitct, so we rename it
+// #include <stdarg.h> conflict with varargs.h? +// There is function-name conflitct, so we rename it #if !defined(IN) && !defined(FLOAT) -#define OpenFile WINAPI_OpenFile
+#define OpenFile WINAPI_OpenFile #include <windows.h> #include <winsock.h> #undef OpenFile diff --git a/missing/setenv.c b/missing/setenv.c index 8a53a6e4eb..b7b43a674b 100644 --- a/missing/setenv.c +++ b/missing/setenv.c @@ -7,14 +7,14 @@ #include "ruby.h" -#ifndef NT
+#ifndef NT extern char **environ; -#endif
+#endif extern char **origenviron; -#ifndef NT
+#ifndef NT char *strdup(); -#endif
+#endif static int envix(nam) diff --git a/missing/strdup.c b/missing/strdup.c index 875290c03f..2e1fe90bbd 100644 --- a/missing/strdup.c +++ b/missing/strdup.c @@ -2,8 +2,8 @@ strdup.c - - $Author: matz $ - $Date: 1994/12/09 09:47:57 $ + $Author$ + $Date$ created at: Wed Dec 7 15:34:01 JST 1994 ************************************************/ diff --git a/missing/strstr.c b/missing/strstr.c index 68f40f8260..c54349983e 100644 --- a/missing/strstr.c +++ b/missing/strstr.c @@ -14,7 +14,7 @@ */ #ifndef lint -static char rcsid[] = "$Header: /usr/ext/cvsroot/ruby/missing/strstr.c,v 1.2 1994/08/12 04:48:34 matz Exp $ SPRITE (Berkeley)"; +static char rcsid[] = "$Header$ SPRITE (Berkeley)"; #endif /* not lint */ /* @@ -2,8 +2,8 @@ node.h - - $Author: matz $ - $Date: 1996/12/25 10:42:41 $ + $Author$ + $Date$ created at: Fri May 28 15:14:02 JST 1993 Copyright (C) 1993-1996 Yukihiro Matsumoto @@ -2,8 +2,8 @@ numeric.c - - $Author: matz $ - $Date: 1996/12/25 10:42:42 $ + $Author$ + $Date$ created at: Fri Aug 13 18:33:09 JST 1993 Copyright (C) 1993-1996 Yukihiro Matsumoto @@ -2,8 +2,8 @@ object.c - - $Author: matz $ - $Date: 1996/12/25 08:54:49 $ + $Author$ + $Date$ created at: Thu Jul 15 12:01:24 JST 1993 Copyright (C) 1993-1996 Yukihiro Matsumoto @@ -2,8 +2,8 @@ pack.c - - $Author: matz $ - $Date: 1996/12/25 09:40:22 $ + $Author$ + $Date$ created at: Thu Feb 10 15:17:05 JST 1994 Copyright (C) 1993-1996 Yukihiro Matsumoto @@ -2,8 +2,8 @@ parse.y - - $Author: matz $ - $Date: 1996/12/25 08:54:50 $ + $Author$ + $Date$ created at: Fri May 28 18:02:42 JST 1993 Copyright (C) 1993-1996 Yukihiro Matsumoto @@ -2,8 +2,8 @@ process.c - - $Author: matz $ - $Date: 1996/12/25 10:42:47 $ + $Author$ + $Date$ created at: Tue Aug 10 14:30:50 JST 1993 Copyright (C) 1993-1996 Yukihiro Matsumoto @@ -2,8 +2,8 @@ random.c - - $Author: matz $ - $Date: 1996/12/25 10:42:48 $ + $Author$ + $Date$ created at: Fri Dec 24 16:39:21 JST 1993 Copyright (C) 1993-1996 Yukihiro Matsumoto @@ -2,8 +2,8 @@ range.c - - $Author: matz $ - $Date: 1996/12/25 09:30:12 $ + $Author$ + $Date$ created at: Thu Aug 19 17:46:47 JST 1993 Copyright (C) 1993-1996 Yukihiro Matsumoto @@ -2,8 +2,8 @@ re.c - - $Author: matz $ - $Date: 1996/12/25 10:42:49 $ + $Author$ + $Date$ created at: Mon Aug 9 18:24:49 JST 1993 Copyright (C) 1993-1996 Yukihiro Matsumoto @@ -2,9 +2,9 @@ re.h - - $Author: matz $ - $Revision: 1.2 $ - $Date: 1996/12/25 09:47:52 $ + $Author$ + $Revision$ + $Date$ created at: Thu Sep 30 14:18:32 JST 1993 Copyright (C) 1993-1996 Yukihiro Matsumoto @@ -2,8 +2,8 @@ ruby.c - - $Author: matz $ - $Date: 1996/12/25 10:42:51 $ + $Author$ + $Date$ created at: Tue Aug 10 12:47:31 JST 1993 Copyright (C) 1993-1996 Yukihiro Matsumoto @@ -2,8 +2,8 @@ ruby.h - - $Author: matz $ - $Date: 1996/12/25 08:54:52 $ + $Author$ + $Date$ created at: Thu Jun 10 14:26:32 JST 1993 Copyright (C) 1993-1996 Yukihiro Matsumoto diff --git a/sample/biorhythm.rb b/sample/biorhythm.rb index b97ee85e16..50ad1f2ef7 100644 --- a/sample/biorhythm.rb +++ b/sample/biorhythm.rb @@ -2,8 +2,8 @@ # # biorhythm.rb - # $Release Version: $ -# $Revision: 1.3 $ -# $Date: 1997/02/14 11:07:08 $ +# $Revision$ +# $Date$ # by Yasuo OHBA(STAFS Development Room) # # -- diff --git a/sample/from.rb b/sample/from.rb index d39bb70084..d39bb70084 100755..100644 --- a/sample/from.rb +++ b/sample/from.rb diff --git a/sample/getopts.test b/sample/getopts.test index 2866bccea8..2866bccea8 100755..100644 --- a/sample/getopts.test +++ b/sample/getopts.test diff --git a/sample/less.rb b/sample/less.rb index 8be359108f..8be359108f 100755..100644 --- a/sample/less.rb +++ b/sample/less.rb diff --git a/sample/mpart.rb b/sample/mpart.rb index 6c40d50e18..6c40d50e18 100755..100644 --- a/sample/mpart.rb +++ b/sample/mpart.rb diff --git a/sample/ruby-mode.el b/sample/ruby-mode.el index 78909b32a5..d8165bd23a 100644 --- a/sample/ruby-mode.el +++ b/sample/ruby-mode.el @@ -1,7 +1,7 @@ ;;; ;;; ruby-mode.el - ;;; -;;; $Author: matz$ +;;; $Author$ ;;; Time-stamp: <97/03/21 01:16:05 matz> ;;; created at: Fri Feb 4 14:49:13 JST 1994 ;;; diff --git a/sample/time.rb b/sample/time.rb index f4f4ec4883..f4f4ec4883 100755..100644 --- a/sample/time.rb +++ b/sample/time.rb diff --git a/sample/uumerge.rb b/sample/uumerge.rb index 297b08f26a..297b08f26a 100755..100644 --- a/sample/uumerge.rb +++ b/sample/uumerge.rb @@ -2,7 +2,7 @@ sig.h - - $Author: matz $ + $Author$ $Date$ created at: Wed Aug 16 01:15:38 JST 1995 @@ -2,8 +2,8 @@ signal.c - - $Author: matz $ - $Date: 1996/12/25 10:42:53 $ + $Author$ + $Date$ created at: Tue Dec 20 10:13:44 JST 1994 ************************************************/ @@ -2,8 +2,8 @@ sprintf.c - - $Author: matz $ - $Date: 1996/12/25 10:42:59 $ + $Author$ + $Date$ created at: Fri Oct 15 10:39:26 JST 1993 Copyright (C) 1993-1996 Yukihiro Matsumoto @@ -2,8 +2,8 @@ string.c - - $Author: matz $ - $Date: 1996/12/25 10:43:01 $ + $Author$ + $Date$ created at: Mon Aug 9 17:12:58 JST 1993 Copyright (C) 1993-1996 Yukihiro Matsumoto @@ -2,8 +2,8 @@ struct.c - - $Author: matz $ - $Date: 1996/12/25 10:43:02 $ + $Author$ + $Date$ created at: Tue Mar 22 18:44:30 JST 1995 ************************************************/ @@ -2,8 +2,8 @@ time.c - - $Author: matz $ - $Date: 1996/12/25 09:30:28 $ + $Author$ + $Date$ created at: Tue Dec 28 14:31:59 JST 1993 Copyright (C) 1993-1996 Yukihiro Matsumoto diff --git a/variable.c b/variable.c index b0d67362c1..fc514f902a 100644 --- a/variable.c +++ b/variable.c @@ -2,8 +2,8 @@ variable.c - - $Author: matz $ - $Date: 1996/12/25 08:54:53 $ + $Author$ + $Date$ created at: Tue Apr 19 23:55:15 JST 1994 ************************************************/ @@ -2,9 +2,9 @@ version.c - - $Author: matz $ - $Revision: 1.5 $ - $Date: 1996/12/25 08:54:54 $ + $Author$ + $Revision$ + $Date$ created at: Thu Sep 30 20:08:01 JST 1993 Copyright (C) 1993-1996 Yukihiro Matsumoto diff --git a/win32/Makefile b/win32/Makefile index b5a9d140cf..29d2101479 100644 --- a/win32/Makefile +++ b/win32/Makefile @@ -1,233 +1,233 @@ -SHELL = $(COMPSEC)
-
-#### Start of system configuration section. ####
-
-srcdir = .
-VPATH = .:./missing
-
-CC = cl
-YACC = byacc
-RANLIB =
-AR =
-INSTALL = ginstall -c
-INSTALL_PROGRAM = $(INSTALL)
-INSTALL_DATA = $(INSTALL) -m 644
-PURIFY =
-
-
-#CFLAGS = -nologo -DNT=1 -Ox
-#LDFLAGS = $(CFLAGS) -Fm
-CFLAGS = -nologo -DNT=1 -Zi -MD
-LDFLAGS = $(CFLAGS) -Fm -MD
-LIBS = $(EXTLIBS) advapi32.lib wsock32.lib
-MISSING = crypt.obj setenv.obj alloca.obj nt.obj
-
-prefix =
-binprefix =
-exec_prefix =
-bindir =
-libdir =
-
-STACK = 0x200000
-
-#### End of system configuration section. ####
-
-
-LIBRUBY = libruby.lib
-
-EXTOBJS = dmyext.obj
-
-MAINOBJ = main.obj
-
-OBJS = array.obj \
- bignum.obj \
- class.obj \
- compar.obj \
- dir.obj \
- dln.obj \
- enum.obj \
- error.obj \
- eval.obj \
- file.obj \
- fnmatch.obj \
- gc.obj \
- glob.obj \
- hash.obj \
- inits.obj \
- io.obj \
- math.obj \
- numeric.obj \
- object.obj \
- pack.obj \
- parse.obj \
- process.obj \
- random.obj \
- range.obj \
- re.obj \
- regex.obj \
- ruby.obj \
- signal.obj \
- sprintf.obj \
- st.obj \
- string.obj \
- struct.obj \
- time.obj \
- util.obj \
- variable.obj \
- version.obj \
- $(MISSING)
-
-all: miniruby.exe ext/Setup
- cd ext
- ..\miniruby .\extmk.rb static
- cd ..
-
-miniruby.exe: $(OBJS) $(MAINOBJ) $(EXTOBJS)
- @echo $(EXTOBJS)
- @echo $(LIBS)
- @rm -f miniruby.exe
-# $(PURIFY) $(CC) $(LDFLAGS) $(MAINOBJ) $(OBJS) $(EXTOBJS) $(LIBS) -o miniruby.exe
- $(PURIFY) $(CC) $(LDFLAGS) $(MAINOBJ) $(OBJS) $(EXTOBJS) $(LIBS) -o miniruby.exe -link /NOD:LIBC
-
-ruby.exe: $(LIBRUBY) $(MAINOBJ) $(EXTOBJS) ruby.dll
- @echo $(EXTOBJS)
- @echo $(LIBS)
- @rm -f ruby.exe
-# $(PURIFY) $(CC) $(LDFLAGS) $(MAINOBJ) $(EXTOBJS) $(LIBRUBY) $(LIBS) -o ruby.exe
-# $(PURIFY) $(CC) $(LDFLAGS) $(MAINOBJ) $(EXTOBJS) $(LIBRUBY) $(LIBS) -o ruby.exe -link /DEF:rubyexe.def /NOD:LIBC
- $(CC) $(LDFLAGS) $(MAINOBJ) -o ruby.exe ruby.lib -link /NOD:LIBC /STACK:$(STACK)
-
-ruby.dll: $(LIBRUBY) $(EXTOBJS)
- @echo $(EXTOBJS)
- @echo $(LIBS)
- @rm -f ruby.dll
- $(PURIFY) $(CC) $(LDFLAGS) $(MAINOBJ) $(EXTOBJS) $(LIBRUBY) $(LIBS) -o ruby.dll -link /DLL /DEF:ruby.def /NOD:LIBC
-
-$(LIBRUBY): $(OBJS)
- lib /OUT:$(LIBRUBY) $(OBJS)
-
-install:; $(INSTALL_PROGRAM) ruby.exe $(bindir)/ruby.exe
- @-strip $(bindir)/ruby
- @test -d $(libdir) || mkdir $(libdir)
- cd ext; ../miniruby ./extmk.rb install
- @for rb in `grep '^lib/' MANIFEST`; do \
- $(INSTALL_DATA) $$rb $(libdir); \
- done
-
-clean:; @rm -f $(OBJS) $(LIBRUBY) main.obj dmyext.obj *.pdb *.map *.exp
- @rm -f ext/extinit.c ext/extinit.obj
- cd ext
- ..\miniruby .\extmk.rb clean
- cd ..
-
-realclean: clean
- @rm -f Makefile ext/extmk.rb
- @rm -f config.cache config.h config.log config.status
- @rm -f core ruby miniruby *~
-
-test:; @-./ruby sample/test.rb > ./ruby_test 2>&1; \
- if grep '^end of test' ./ruby_test > /dev/null; then \
- echo "test succeeded"; \
- else \
- grep '^sample/test.rb' ./ruby_test; \
- grep '^not' ./ruby_test; \
- echo "test failed";\
- fi;\
- rm -f ./ruby_test
-
-.c.obj:
- $(CC) $(CFLAGS) $(CPPFLAGS) -c $<
-
-alloca.obj: missing/alloca.c
- $(CC) -I. $(CFLAGS) $(CPPFLAGS) -c missing/alloca.c
-
-crypt.obj: missing/crypt.c
- $(CC) -I. $(CFLAGS) $(CPPFLAGS) -c missing/crypt.c
-
-dup2.obj: missing/dup2.c
- $(CC) -I. $(CFLAGS) $(CPPFLAGS) -c missing/dup2.c
-
-flock.obj: missing/flock.c
- $(CC) -I. $(CFLAGS) $(CPPFLAGS) -c missing/flock.c
-
-memmove.obj: missing/memmove.c
- $(CC) $(CFLAGS) $(CPPFLAGS) -c missing/memmove.c
-
-mkdir.obj: missing/mkdir.c
- $(CC) $(CFLAGS) $(CPPFLAGS) -c missing/mkdir.c
-
-setenv.obj: missing/setenv.c
- $(CC) -I. $(CFLAGS) $(CPPFLAGS) -c missing/setenv.c
-
-strerror.obj: missing/strerror.c
- $(CC) $(CFLAGS) $(CPPFLAGS) -c missing/strerror.c
-
-strdup.obj: missing/strdup.c
- $(CC) $(CFLAGS) $(CPPFLAGS) -c missing/strdup.c
-
-strftime.obj: missing/strftime.c
- $(CC) -I. $(CFLAGS) $(CPPFLAGS) -c missing/strftime.c
-
-strstr.obj: missing/strstr.c
- $(CC) $(CFLAGS) $(CPPFLAGS) -c missing/strstr.c
-
-strtol.obj: missing/strtol.c
- $(CC) $(CFLAGS) $(CPPFLAGS) -c missing/strtol.c
-
-strtoul.obj: missing/strtoul.c
- $(CC) $(CFLAGS) $(CPPFLAGS) -c missing/strtoul.c
-
-# when I use -I., there is confliction at "OpenFile"
-# so, set . into environment varible "include"
-nt.obj: missing/nt.c
- @set include=$(INCLUDE);.
- $(CC) $(CFLAGS) $(CPPFLAGS) -c missing/nt.c
-
-parse.c: parse.y
- $(YACC) $(YFLAGS) parse.y
- sed -e "s!^extern char \*getenv();!/* & */!" y.tab.c > parse.c
- @rm y.tab.c
-
-# Prevent GNU make v3 from overflowing arg limit on SysV.
-.NOEXPORT:
-###
-parse.obj : parse.y ruby.h defines.h config.h env.h node.h st.h regex.h
-###
-array.obj: array.c ruby.h config.h defines.h
-bignum.obj: bignum.c ruby.h config.h defines.h
-class.obj: class.c ruby.h config.h defines.h node.h st.h
-compar.obj: compar.c ruby.h config.h defines.h
-dir.obj: dir.c ruby.h config.h defines.h
-dln.obj: dln.c config.h defines.h dln.h st.h
-dmyext.obj: dmyext.c
-enum.obj: enum.c ruby.h config.h defines.h
-error.obj: error.c ruby.h config.h defines.h env.h
-eval.obj: eval.c ruby.h config.h defines.h env.h node.h sig.h st.h dln.h
-file.obj: file.c ruby.h config.h defines.h io.h sig.h
-fnmatch.obj: fnmatch.c config.h fnmatch.h
-gc.obj: gc.c ruby.h config.h defines.h env.h sig.h st.h node.h re.h regex.h
-glob.obj: glob.c config.h fnmatch.h
-hash.obj: hash.c ruby.h config.h defines.h st.h
-inits.obj: inits.c ruby.h config.h defines.h
-io.obj: io.c ruby.h config.h defines.h io.h sig.h
-main.obj: main.c
-math.obj: math.c ruby.h config.h defines.h
-numeric.obj: numeric.c ruby.h config.h defines.h
-object.obj: object.c ruby.h config.h defines.h st.h
-pack.obj: pack.c ruby.h config.h defines.h
-process.obj: process.c ruby.h config.h defines.h sig.h st.h
-random.obj: random.c ruby.h config.h defines.h
-range.obj: range.c ruby.h config.h defines.h
-re.obj: re.c ruby.h config.h defines.h re.h regex.h
-regex.obj: regex.c config.h defines.h regex.h util.h
-ruby.obj: ruby.c ruby.h config.h defines.h re.h regex.h dln.h
-signal.obj: signal.c ruby.h config.h defines.h sig.h
-sprintf.obj: sprintf.c ruby.h config.h defines.h
-st.obj: st.c config.h st.h
-string.obj: string.c ruby.h config.h defines.h re.h regex.h
-struct.obj: struct.c ruby.h config.h defines.h
-time.obj: time.c ruby.h config.h defines.h
-util.obj: util.c defines.h config.h util.h
-variable.obj: variable.c ruby.h config.h defines.h env.h st.h
-version.obj: version.c ruby.h config.h defines.h version.h
-director.obj : director.c dir.h
+SHELL = $(COMPSEC) + +#### Start of system configuration section. #### + +srcdir = . +VPATH = .:./missing + +CC = cl +YACC = byacc +RANLIB = +AR = +INSTALL = ginstall -c +INSTALL_PROGRAM = $(INSTALL) +INSTALL_DATA = $(INSTALL) -m 644 +PURIFY = + + +#CFLAGS = -nologo -DNT=1 -Ox +#LDFLAGS = $(CFLAGS) -Fm +CFLAGS = -nologo -DNT=1 -Zi -MD +LDFLAGS = $(CFLAGS) -Fm -MD +LIBS = $(EXTLIBS) advapi32.lib wsock32.lib +MISSING = crypt.obj setenv.obj alloca.obj nt.obj + +prefix = +binprefix = +exec_prefix = +bindir = +libdir = + +STACK = 0x200000 + +#### End of system configuration section. #### + + +LIBRUBY = libruby.lib + +EXTOBJS = dmyext.obj + +MAINOBJ = main.obj + +OBJS = array.obj \ + bignum.obj \ + class.obj \ + compar.obj \ + dir.obj \ + dln.obj \ + enum.obj \ + error.obj \ + eval.obj \ + file.obj \ + fnmatch.obj \ + gc.obj \ + glob.obj \ + hash.obj \ + inits.obj \ + io.obj \ + math.obj \ + numeric.obj \ + object.obj \ + pack.obj \ + parse.obj \ + process.obj \ + random.obj \ + range.obj \ + re.obj \ + regex.obj \ + ruby.obj \ + signal.obj \ + sprintf.obj \ + st.obj \ + string.obj \ + struct.obj \ + time.obj \ + util.obj \ + variable.obj \ + version.obj \ + $(MISSING) + +all: miniruby.exe ext/Setup + cd ext + ..\miniruby .\extmk.rb static + cd .. + +miniruby.exe: $(OBJS) $(MAINOBJ) $(EXTOBJS) + @echo $(EXTOBJS) + @echo $(LIBS) + @rm -f miniruby.exe +# $(PURIFY) $(CC) $(LDFLAGS) $(MAINOBJ) $(OBJS) $(EXTOBJS) $(LIBS) -o miniruby.exe + $(PURIFY) $(CC) $(LDFLAGS) $(MAINOBJ) $(OBJS) $(EXTOBJS) $(LIBS) -o miniruby.exe -link /NOD:LIBC + +ruby.exe: $(LIBRUBY) $(MAINOBJ) $(EXTOBJS) ruby.dll + @echo $(EXTOBJS) + @echo $(LIBS) + @rm -f ruby.exe +# $(PURIFY) $(CC) $(LDFLAGS) $(MAINOBJ) $(EXTOBJS) $(LIBRUBY) $(LIBS) -o ruby.exe +# $(PURIFY) $(CC) $(LDFLAGS) $(MAINOBJ) $(EXTOBJS) $(LIBRUBY) $(LIBS) -o ruby.exe -link /DEF:rubyexe.def /NOD:LIBC + $(CC) $(LDFLAGS) $(MAINOBJ) -o ruby.exe ruby.lib -link /NOD:LIBC /STACK:$(STACK) + +ruby.dll: $(LIBRUBY) $(EXTOBJS) + @echo $(EXTOBJS) + @echo $(LIBS) + @rm -f ruby.dll + $(PURIFY) $(CC) $(LDFLAGS) $(MAINOBJ) $(EXTOBJS) $(LIBRUBY) $(LIBS) -o ruby.dll -link /DLL /DEF:ruby.def /NOD:LIBC + +$(LIBRUBY): $(OBJS) + lib /OUT:$(LIBRUBY) $(OBJS) + +install:; $(INSTALL_PROGRAM) ruby.exe $(bindir)/ruby.exe + @-strip $(bindir)/ruby + @test -d $(libdir) || mkdir $(libdir) + cd ext; ../miniruby ./extmk.rb install + @for rb in `grep '^lib/' MANIFEST`; do \ + $(INSTALL_DATA) $$rb $(libdir); \ + done + +clean:; @rm -f $(OBJS) $(LIBRUBY) main.obj dmyext.obj *.pdb *.map *.exp + @rm -f ext/extinit.c ext/extinit.obj + cd ext + ..\miniruby .\extmk.rb clean + cd .. + +realclean: clean + @rm -f Makefile ext/extmk.rb + @rm -f config.cache config.h config.log config.status + @rm -f core ruby miniruby *~ + +test:; @-./ruby sample/test.rb > ./ruby_test 2>&1; \ + if grep '^end of test' ./ruby_test > /dev/null; then \ + echo "test succeeded"; \ + else \ + grep '^sample/test.rb' ./ruby_test; \ + grep '^not' ./ruby_test; \ + echo "test failed";\ + fi;\ + rm -f ./ruby_test + +.c.obj: + $(CC) $(CFLAGS) $(CPPFLAGS) -c $< + +alloca.obj: missing/alloca.c + $(CC) -I. $(CFLAGS) $(CPPFLAGS) -c missing/alloca.c + +crypt.obj: missing/crypt.c + $(CC) -I. $(CFLAGS) $(CPPFLAGS) -c missing/crypt.c + +dup2.obj: missing/dup2.c + $(CC) -I. $(CFLAGS) $(CPPFLAGS) -c missing/dup2.c + +flock.obj: missing/flock.c + $(CC) -I. $(CFLAGS) $(CPPFLAGS) -c missing/flock.c + +memmove.obj: missing/memmove.c + $(CC) $(CFLAGS) $(CPPFLAGS) -c missing/memmove.c + +mkdir.obj: missing/mkdir.c + $(CC) $(CFLAGS) $(CPPFLAGS) -c missing/mkdir.c + +setenv.obj: missing/setenv.c + $(CC) -I. $(CFLAGS) $(CPPFLAGS) -c missing/setenv.c + +strerror.obj: missing/strerror.c + $(CC) $(CFLAGS) $(CPPFLAGS) -c missing/strerror.c + +strdup.obj: missing/strdup.c + $(CC) $(CFLAGS) $(CPPFLAGS) -c missing/strdup.c + +strftime.obj: missing/strftime.c + $(CC) -I. $(CFLAGS) $(CPPFLAGS) -c missing/strftime.c + +strstr.obj: missing/strstr.c + $(CC) $(CFLAGS) $(CPPFLAGS) -c missing/strstr.c + +strtol.obj: missing/strtol.c + $(CC) $(CFLAGS) $(CPPFLAGS) -c missing/strtol.c + +strtoul.obj: missing/strtoul.c + $(CC) $(CFLAGS) $(CPPFLAGS) -c missing/strtoul.c + +# when I use -I., there is confliction at "OpenFile" +# so, set . into environment varible "include" +nt.obj: missing/nt.c + @set include=$(INCLUDE);. + $(CC) $(CFLAGS) $(CPPFLAGS) -c missing/nt.c + +parse.c: parse.y + $(YACC) $(YFLAGS) parse.y + sed -e "s!^extern char \*getenv();!/* & */!" y.tab.c > parse.c + @rm y.tab.c + +# Prevent GNU make v3 from overflowing arg limit on SysV. +.NOEXPORT: +### +parse.obj : parse.y ruby.h defines.h config.h env.h node.h st.h regex.h +### +array.obj: array.c ruby.h config.h defines.h +bignum.obj: bignum.c ruby.h config.h defines.h +class.obj: class.c ruby.h config.h defines.h node.h st.h +compar.obj: compar.c ruby.h config.h defines.h +dir.obj: dir.c ruby.h config.h defines.h +dln.obj: dln.c config.h defines.h dln.h st.h +dmyext.obj: dmyext.c +enum.obj: enum.c ruby.h config.h defines.h +error.obj: error.c ruby.h config.h defines.h env.h +eval.obj: eval.c ruby.h config.h defines.h env.h node.h sig.h st.h dln.h +file.obj: file.c ruby.h config.h defines.h io.h sig.h +fnmatch.obj: fnmatch.c config.h fnmatch.h +gc.obj: gc.c ruby.h config.h defines.h env.h sig.h st.h node.h re.h regex.h +glob.obj: glob.c config.h fnmatch.h +hash.obj: hash.c ruby.h config.h defines.h st.h +inits.obj: inits.c ruby.h config.h defines.h +io.obj: io.c ruby.h config.h defines.h io.h sig.h +main.obj: main.c +math.obj: math.c ruby.h config.h defines.h +numeric.obj: numeric.c ruby.h config.h defines.h +object.obj: object.c ruby.h config.h defines.h st.h +pack.obj: pack.c ruby.h config.h defines.h +process.obj: process.c ruby.h config.h defines.h sig.h st.h +random.obj: random.c ruby.h config.h defines.h +range.obj: range.c ruby.h config.h defines.h +re.obj: re.c ruby.h config.h defines.h re.h regex.h +regex.obj: regex.c config.h defines.h regex.h util.h +ruby.obj: ruby.c ruby.h config.h defines.h re.h regex.h dln.h +signal.obj: signal.c ruby.h config.h defines.h sig.h +sprintf.obj: sprintf.c ruby.h config.h defines.h +st.obj: st.c config.h st.h +string.obj: string.c ruby.h config.h defines.h re.h regex.h +struct.obj: struct.c ruby.h config.h defines.h +time.obj: time.c ruby.h config.h defines.h +util.obj: util.c defines.h config.h util.h +variable.obj: variable.c ruby.h config.h defines.h env.h st.h +version.obj: version.c ruby.h config.h defines.h version.h +director.obj : director.c dir.h diff --git a/win32/ntsetup.bat b/win32/ntsetup.bat index 1848d035ec..ee6294fada 100644..100755 --- a/win32/ntsetup.bat +++ b/win32/ntsetup.bat @@ -1,10 +1,10 @@ -@echo off
-copy config.h ..
-copy Makefile ..
-copy ruby.def ..
-cd ..\ext
-copy Setup.nt Setup
-copy extmk.rb.nt extmk.rb
-
-cd ..
-echo type `nmake' to make ruby for mswin32.
+@echo off +copy config.h .. +copy Makefile .. +copy ruby.def .. +cd ..\ext +copy Setup.nt Setup +copy extmk.rb.nt extmk.rb + +cd .. +echo type `nmake' to make ruby for mswin32. diff --git a/win32/ruby.def b/win32/ruby.def index 1c9e589849..44372d2e76 100644 --- a/win32/ruby.def +++ b/win32/ruby.def @@ -1,55 +1,55 @@ -LIBRARY ruby.dll
-CODE LOADONCALL
-DATA LOADONCALL
-DESCRIPTION 'win32 ruby.dll'
-EXPORTS
-
-;missing/nt.c
- NtInitialize
-;eval.c
- ruby_init
- ruby_options
- ruby_run
-;class.c
- ;;rb_define_module_function
- ;;rb_define_const
- ;;rb_define_singleton_method
- ;;rb_define_alias
- rb_define_alias
- rb_define_attr
- rb_define_class
- rb_define_class_id
- rb_define_class_under
- rb_define_global_function
- rb_define_method
- rb_define_method_id
- rb_define_module
- rb_define_module_function
- rb_define_module_id
- rb_define_module_under
- rb_define_private_method
- rb_define_singleton_method
- rb_scan_args
-;variable.c
- rb_define_const
- rb_define_hooked_variable
- rb_define_global_const
- rb_define_readonly_variable
- rb_define_variable
- rb_define_virtual_variable
-;string.c
- str_new
- str_new2
- str_new3
- str_new4
-;numeric.c
- num2int
-
-;error.c
- rb_check_type
- Fatal
-
-;gc.c
- xmalloc
- xcalloc
-
+LIBRARY ruby.dll +CODE LOADONCALL +DATA LOADONCALL +DESCRIPTION 'win32 ruby.dll' +EXPORTS + +;missing/nt.c + NtInitialize +;eval.c + ruby_init + ruby_options + ruby_run +;class.c + ;;rb_define_module_function + ;;rb_define_const + ;;rb_define_singleton_method + ;;rb_define_alias + rb_define_alias + rb_define_attr + rb_define_class + rb_define_class_id + rb_define_class_under + rb_define_global_function + rb_define_method + rb_define_method_id + rb_define_module + rb_define_module_function + rb_define_module_id + rb_define_module_under + rb_define_private_method + rb_define_singleton_method + rb_scan_args +;variable.c + rb_define_const + rb_define_hooked_variable + rb_define_global_const + rb_define_readonly_variable + rb_define_variable + rb_define_virtual_variable +;string.c + str_new + str_new2 + str_new3 + str_new4 +;numeric.c + num2int + +;error.c + rb_check_type + Fatal + +;gc.c + xmalloc + xcalloc + diff --git a/x68/_dtos18.c b/x68/_dtos18.c index 67656486ec..4712a66bf7 100644 --- a/x68/_dtos18.c +++ b/x68/_dtos18.c @@ -5,7 +5,7 @@ * in public domain. You can freely use, copy, modify, and redistribute * the whole contents, without this notice. * -------------------------------------------------------------------- - * $Id: _dtos18.c,v 1.2 1994/11/27 13:05:20 mura Exp $ + * $Id$ */ /* System headers */ diff --git a/x68/_round.c b/x68/_round.c index 73e44ca966..761930fb8c 100644 --- a/x68/_round.c +++ b/x68/_round.c @@ -5,7 +5,7 @@ * in public domain. You can freely use, copy, modify, and redistribute * the whole contents, without this notice. * -------------------------------------------------------------------- - * $Id: _round.c,v 1.1 1994/11/27 13:05:36 mura Exp $ + * $Id$ */ /* changed 1997.2.2 by K.Okabe */ diff --git a/x68/fconvert.c b/x68/fconvert.c index 05ff1fbd1a..9a0bc0e088 100644 --- a/x68/fconvert.c +++ b/x68/fconvert.c @@ -5,7 +5,7 @@ * in public domain. You can freely use, copy, modify, and redistribute * the whole contents, without this notice. * -------------------------------------------------------------------- - * $Id: fconvert.c,v 1.2 1994/11/27 13:06:19 mura Exp $ + * $Id$ */ /* changed 1997.2.3 by K.Okabe */ |