home *** CD-ROM | disk | FTP | other *** search
- From: lwall@netlabs.com (Larry Wall)
- Newsgroups: comp.sources.misc
- Subject: v18i032: perl - The perl programming language, Part14/36
- Message-ID: <1991Apr16.000114.22955@sparky.IMD.Sterling.COM>
- Date: 16 Apr 91 00:01:14 GMT
- Approved: kent@sparky.imd.sterling.com
- X-Checksum-Snefru: b6f559f5 4099aac1 9fddf96c 864ebc3f
-
- Submitted-by: Larry Wall <lwall@netlabs.com>
- Posting-number: Volume 18, Issue 32
- Archive-name: perl/part14
-
- [There are 36 kits for perl version 4.0.]
-
- #! /bin/sh
-
- # Make a new directory for the perl sources, cd to it, and run kits 1
- # thru 36 through sh. When all 36 kits have been run, read README.
-
- echo "This is perl 4.0 kit 14 (of 36). If kit 14 is complete, the line"
- echo '"'"End of kit 14 (of 36)"'" will echo at the end.'
- echo ""
- export PATH || (echo "You didn't use sh, you clunch." ; kill $$)
- mkdir t t/op usub 2>/dev/null
- echo Extracting Configure:AB
- sed >Configure:AB <<'!STUFFY!FUNK!' -e 's/X//'
- Xval=$D_dirnamlen; set d_dirnamlen; eval $setvar
- Xval=$I_dirent; set i_dirent; eval $setvar
- Xval=$I_sys_dir; set i_sys_dir; eval $setvar
- Xval=$I_my_dir; set i_my_dir; eval $setvar
- Xval=$I_ndir; set i_ndir; eval $setvar
- Xval=$I_sys_ndir; set i_sys_ndir; eval $setvar
- X
- X: now see if they want to do setuid emulation
- Xcase "$d_dosuid" in
- X'') dflt=n;;
- X*undef*) dflt=n;;
- X*) dflt=y;;
- Xesac
- Xcat <<EOM
- X
- XSome sites have disabled setuid #! scripts because of a bug in the kernel
- Xthat prevents them from being secure. If you are on such a system, the
- Xsetuid/setgid bits on scripts are currently useless. It is possible for
- X$package to detect those bits and emulate setuid/setgid in a secure fashion
- Xuntil a better solution is devised for the kernel problem.
- X
- XEOM
- Xrp="Do you want to do setuid/setgid emulation? [$dflt]"
- X$echo $n "$rp $c"
- X. myread
- Xcase "$ans" in
- X'') $ans="$dflt";;
- Xesac
- Xcase "$ans" in
- Xy*) d_dosuid="$define";;
- X*) d_dosuid="$undef";;
- Xesac
- X
- X: see if dup2 exists
- Xset dup2 d_dup2
- Xeval $inlibc
- X
- X: see if fchmod exists
- Xset fchmod d_fchmod
- Xeval $inlibc
- X
- X: see if fchown exists
- Xset fchown d_fchown
- Xeval $inlibc
- X
- X: see if this is an fcntl system
- Xset fcntl d_fcntl
- Xeval $inlibc
- X
- X: see if we can have long filenames
- Xecho " "
- Xrm -f 123456789abcde
- Xif (echo hi >123456789abcdef) 2>/dev/null; then
- X : not version 8
- X if test -f 123456789abcde; then
- X echo 'You cannot have filenames longer than 14 characters. Sigh.'
- X val="$undef"
- X else
- X echo 'You can have filenames longer than 14 characters.'
- X val="$define"
- X fi
- Xelse
- X : version 8 probably
- X echo "You can't have filenames longer than 14 chars. You can't even think about them!"
- X val="$undef"
- Xfi
- Xset d_flexfnam
- Xeval $setvar
- X
- X: see if flock exists
- Xset flock d_flock
- Xeval $inlibc
- X
- X: see if getgroups exists
- Xset getgroups d_getgrps
- Xeval $inlibc
- X
- X: see if gethostent exists
- Xset gethostent d_gethent
- Xeval $inlibc
- X
- X: see if getpgrp exists
- Xset getpgrp d_getpgrp
- Xeval $inlibc
- X
- X: see if getpgrp2 exists
- Xset getpgrp2 d_getpgrp2
- Xeval $inlibc
- X
- X: see if getpriority exists
- Xset getpriority d_getprior
- Xeval $inlibc
- X
- X: see if htonl exists
- Xset htonl d_htonl
- Xeval $inlibc
- X
- X: index or strcpy
- Xecho " "
- Xcase "$d_index" in
- Xn) dflt=n;;
- X*) if $test -f /unix; then
- X dflt=n
- X else
- X dflt=y
- X fi
- X ;;
- Xesac
- Xif $contains '^index$' libc.list >/dev/null 2>&1 ; then
- X if $contains '^strchr$' libc.list >/dev/null 2>&1 ; then
- X echo "Your system has both index() and strchr(). Shall I use"
- X rp="index() rather than strchr()? [$dflt]"
- X $echo $n "$rp $c"
- X . myread
- X case "$ans" in
- X n*) d_index="$define" ;;
- X *) d_index="$undef" ;;
- X esac
- X else
- X d_index="$undef"
- X echo "index() found."
- X fi
- Xelse
- X if $contains '^strchr$' libc.list >/dev/null 2>&1 ; then
- X d_index="$define"
- X echo "strchr() found."
- X else
- X echo "No index() or strchr() found!"
- X d_index="$undef"
- X fi
- Xfi
- X
- X: see if killpg exists
- Xset killpg d_killpg
- Xeval $inlibc
- X
- X: see if lstat exists
- Xset lstat d_lstat
- Xeval $inlibc
- X
- X: see if memcmp exists
- Xset memcmp d_memcmp
- Xeval $inlibc
- X
- X: see if memcpy exists
- Xset memcpy d_memcpy
- Xeval $inlibc
- X
- X: see if mkdir exists
- Xset mkdir d_mkdir
- Xeval $inlibc
- X
- X: see if msgctl exists
- Xset msgctl d_msgctl
- Xeval $inlibc
- X
- X: see if msgget exists
- Xset msgget d_msgget
- Xeval $inlibc
- X
- X: see if msgsnd exists
- Xset msgsnd d_msgsnd
- Xeval $inlibc
- X
- X: see if msgrcv exists
- Xset msgrcv d_msgrcv
- Xeval $inlibc
- X
- X: see how much of the 'msg*(2)' library is present.
- Xh_msg=true
- Xecho " "
- Xcase "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
- X*undef*) h_msg=false;;
- Xesac
- X: we could also check for sys/ipc.h ...
- Xif $h_msg && $test -r $usrinclude/sys/msg.h; then
- X echo "You have the full msg*(2) library."
- X val="$define"
- Xelse
- X echo "You don't have the full msg*(2) library."
- X val="$undef"
- Xfi
- Xset d_msg
- Xeval $setvar
- X
- X: see if ndbm is available
- Xecho " "
- Xxxx=`./loc ndbm.h x $usrinclude /usr/local/include $inclwanted`
- Xif test -f $xxx; then
- X val="$define"
- X echo "ndbm.h found."
- Xelse
- X val="$undef"
- X echo "ndbm.h not found."
- Xfi
- Xset d_ndbm
- Xeval $setvar
- X
- X: see if we have the old dbm
- Xecho " "
- Xxxx=`./loc dbm.h x $usrinclude /usr/local/include $inclwanted`
- Xif test -f $xxx; then
- X val="$define"
- X echo "dbm.h found."
- Xelse
- X val="$undef"
- X echo "dbm.h not found."
- Xfi
- Xset d_odbm
- Xeval $setvar
- X
- X: see whether socket exists
- Xecho " "
- Xsocketlib=''
- Xif $contains socket libc.list >/dev/null 2>&1; then
- X echo "Looks like you have Berkeley networking support."
- X val="$define"
- X : now check for advanced features
- X if $contains setsockopt libc.list >/dev/null 2>&1; then
- X val2="$undef"
- X else
- X echo "...but it uses the old 4.1c interface, rather than 4.2"
- X val2="$define"
- X fi
- Xelse
- X : hpux, for one, puts all the socket stuff in socklib.o
- X if $contains socklib libc.list >/dev/null 2>&1; then
- X echo "Looks like you have Berkeley networking support."
- X val="$define"
- X : we will have to assume that it supports the 4.2 BSD interface
- X val2="$undef"
- X else
- X echo "Hmmm...you don't have Berkeley networking in libc.a..."
- X : look for an optional networking library
- X if test -f /usr/lib/libnet.a; then
- X (ar t /usr/lib/libnet.a ||
- X nm -g /usr/lib/libnet.a) 2>/dev/null >> libc.list
- X if $contains socket libc.list >/dev/null 2>&1; then
- X echo "but the Wollongong group seems to have hacked it in."
- X socketlib="-lnet -lnsl_s"
- X val="$define"
- X : now check for advanced features
- X if $contains setsockopt libc.list >/dev/null 2>&1; then
- X val2="$undef"
- X else
- X echo "...using the old 4.1c interface, rather than 4.2"
- X val2="$define"
- X fi
- X else
- X echo "or even in libnet.a, which is peculiar."
- X val="$undef"
- X val2="$undef"
- X fi
- X else
- X echo "or anywhere else I see."
- X val="$undef"
- X val2="$undef"
- X fi
- X fi
- Xfi
- Xset d_socket
- Xeval $setvar
- X
- Xif $contains socketpair libc.list >/dev/null 2>&1; then
- X val="$define"
- Xelse
- X val="$undef"
- Xfi
- Xset d_sockpair
- Xeval $setvar
- Xval=$val2
- Xset d_oldsock
- Xeval $setvar
- X
- X: Locate the flags for 'open()'
- Xecho " "
- X$cat >open3.c <<'EOCP'
- X#include <sys/types.h>
- X#ifdef I_FCNTL
- X#include <fcntl.h>
- X#endif
- X#ifdef I_SYS_FILE
- X#include <sys/file.h>
- X#endif
- Xmain() {
- X
- X if(O_RDONLY);
- X
- X#ifdef O_TRUNC
- X exit(0);
- X#else
- X exit(1);
- X#endif
- X}
- XEOCP
- X: check sys/file.h first to get FREAD on Sun
- Xif $test -r $usrinclude/sys/file.h && \
- X $cc $cppflags "-DI_SYS_FILE" open3.c -o open3 >/dev/null 2>&1 ; then
- X h_sys_file=true;
- X echo "sys/file.h defines the O_* constants..."
- X if ./open3; then
- X echo "and you have the 3 argument form of open()."
- X val="$define"
- X else
- X echo "but not the 3 argument form of open(). Oh, well."
- X val="$undef"
- X fi
- Xelif $test -r $usrinclude/fcntl.h && \
- X $cc "-DI_FCNTL" open3.c -o open3 >/dev/null 2>&1 ; then
- X h_fcntl=true;
- X echo "fcntl.h defines the O_* constants..."
- X if ./open3; then
- X echo "and you have the 3 argument form of open()."
- X val="$define"
- X else
- X echo "but not the 3 argument form of open(). Oh, well."
- X val="$undef"
- X fi
- Xelse
- X val="$undef"
- X echo "I can't find the O_* constant definitions! You got problems."
- Xfi
- Xset d_open3
- Xeval $setvar
- X
- X: see if how pwd stuff is defined
- Xecho " "
- Xif $test -r $usrinclude/pwd.h ; then
- X i_pwd="$define"
- X echo "pwd.h found."
- X $cppstdin $cppflags $cppminus <$usrinclude/pwd.h >pwd.txt
- X if $contains 'pw_quota' pwd.txt >/dev/null 2>&1; then
- X d_pwquota="$define"
- X else
- X d_pwquota="$undef"
- X fi
- X if $contains 'pw_age' pwd.txt >/dev/null 2>&1; then
- X d_pwage="$define"
- X else
- X d_pwage="$undef"
- X fi
- X if $contains 'pw_change' pwd.txt >/dev/null 2>&1; then
- X d_pwchange="$define"
- X else
- X d_pwchange="$undef"
- X fi
- X if $contains 'pw_class' pwd.txt >/dev/null 2>&1; then
- X d_pwclass="$define"
- X else
- X d_pwclass="$undef"
- X fi
- X if $contains 'pw_expire' pwd.txt >/dev/null 2>&1; then
- X d_pwexpire="$define"
- X else
- X d_pwexpire="$undef"
- X fi
- X if $contains 'pw_comment' pwd.txt >/dev/null 2>&1; then
- X d_pwcomment="$define"
- X else
- X d_pwcomment="$undef"
- X fi
- Xelse
- X i_pwd="$undef"
- X d_pwquota="$undef"
- X d_pwage="$undef"
- X d_pwchange="$undef"
- X d_pwclass="$undef"
- X d_pwexpire="$undef"
- X d_pwcomment="$undef"
- X echo "No pwd.h found."
- Xfi
- X
- X: see if rename exists
- Xset rename d_rename
- Xeval $inlibc
- X
- X: see if rmdir exists
- Xset rmdir d_rmdir
- Xeval $inlibc
- X
- X: see if select exists
- Xset select d_select
- Xeval $inlibc
- X
- X: see if semctl exists
- Xset semctl d_semctl
- Xeval $inlibc
- X
- X: see if semget exists
- Xset semget d_semget
- Xeval $inlibc
- X
- X: see if semop exists
- Xset semop d_semop
- Xeval $inlibc
- X
- X: see how much of the 'sem*(2)' library is present.
- Xh_sem=true
- Xecho " "
- Xcase "$d_semctl$d_semget$d_semop" in
- X*undef*) h_sem=false;;
- Xesac
- X: we could also check for sys/ipc.h ...
- Xif $h_sem && $test -r $usrinclude/sys/sem.h; then
- X echo "You have the full sem*(2) library."
- X val="$define"
- Xelse
- X echo "You don't have the full sem*(2) library."
- X val="$undef"
- Xfi
- Xset d_sem
- Xeval $setvar
- X
- X: see if setegid exists
- Xset setegid d_setegid
- Xeval $inlibc
- X
- X: see if seteuid exists
- Xset seteuid d_seteuid
- Xeval $inlibc
- X
- X: see if setpgrp exists
- Xset setpgrp d_setpgrp
- Xeval $inlibc
- X
- X: see if setpgrp2 exists
- Xset setpgrp2 d_setpgrp2
- Xeval $inlibc
- X
- X: see if setpriority exists
- Xset setpriority d_setprior
- Xeval $inlibc
- X
- X: see if setregid exists
- Xset setregid d_setregid
- Xeval $inlibc
- Xset setresgid d_setresgid
- Xeval $inlibc
- X
- X: see if setreuid exists
- Xset setreuid d_setreuid
- Xeval $inlibc
- Xset setresuid d_setresuid
- Xeval $inlibc
- X
- X: see if setrgid exists
- Xset setrgid d_setrgid
- Xeval $inlibc
- X
- X: see if setruid exists
- Xset setruid d_setruid
- Xeval $inlibc
- X
- X: see if shmctl exists
- Xset shmctl d_shmctl
- Xeval $inlibc
- X
- X: see if shmget exists
- Xset shmget d_shmget
- Xeval $inlibc
- X
- X: see if shmat exists
- Xset shmat d_shmat
- Xeval $inlibc
- X
- X: see if shmdt exists
- Xset shmdt d_shmdt
- Xeval $inlibc
- X
- X: see how much of the 'shm*(2)' library is present.
- Xh_shm=true
- Xecho " "
- Xcase "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
- X*undef*) h_shm=false;;
- Xesac
- X: we could also check for sys/ipc.h ...
- Xif $h_shm && $test -r $usrinclude/sys/shm.h; then
- X echo "You have the full shm*(2) library."
- X val="$define"
- Xelse
- X echo "You don't have the full shm*(2) library."
- X val="$undef"
- Xfi
- Xset d_shm
- Xeval $setvar
- X
- X: see if stat knows about block sizes
- Xecho " "
- Xif $contains 'st_blocks;' $usrinclude/sys/stat.h >/dev/null 2>&1 ; then
- X if $contains 'st_blksize;' $usrinclude/sys/stat.h >/dev/null 2>&1 ; then
- X echo "Your stat knows about block sizes."
- X val="$define"
- X else
- X echo "Your stat doesn't know about block sizes."
- X val="$undef"
- X fi
- Xelse
- X echo "Your stat doesn't know about block sizes."
- X val="$undef"
- Xfi
- Xset d_statblks
- Xeval $setvar
- X
- X: see if stdio is really std
- Xecho " "
- Xif $contains 'char.*_ptr.*;' $usrinclude/stdio.h >/dev/null 2>&1 ; then
- X if $contains '_cnt;' $usrinclude/stdio.h >/dev/null 2>&1 ; then
- X echo "Your stdio is pretty std."
- X val="$define"
- X else
- X echo "Your stdio isn't very std."
- X val="$undef"
- X fi
- Xelse
- X echo "Your stdio isn't very std."
- X val="$undef"
- Xfi
- Xset d_stdstdio
- Xeval $setvar
- X
- X: check for structure copying
- Xecho " "
- Xecho "Checking to see if your C compiler can copy structs..."
- X$cat >strctcpy.c <<'EOCP'
- Xmain()
- X{
- X struct blurfl {
- X int dyick;
- X } foo, bar;
- X
- X foo = bar;
- X}
- XEOCP
- Xif $cc -c strctcpy.c >/dev/null 2>&1 ; then
- X val="$define"
- X echo "Yup, it can."
- Xelse
- X val="$undef"
- X echo "Nope, it can't."
- Xfi
- Xset d_strctcpy
- Xeval $setvar
- X
- X: see if strerror exists
- Xset strerror d_strerror
- Xeval $inlibc
- X
- X: see if symlink exists
- Xset symlink d_symlink
- Xeval $inlibc
- X
- X: see if syscall exists
- Xset syscall d_syscall
- Xeval $inlibc
- X
- X: set if package uses struct tm
- Xw_s_tm=1
- X
- X: set if package uses struct timeval
- Xcase "$d_select" in
- Xdefine) w_s_timevl=1 ;;
- Xesac
- X
- X: set if package uses localtime function
- Xw_localtim=1
- X
- X: see which of time.h, sys/time.h, and sys/select should be included.
- Xidefs=''
- Xcat <<'EOM'
- X
- XTesting to see which of <time.h>, <sys/time.h>, and <sys/select.h>
- Xshould be included, because this application wants:
- X
- XEOM
- Xcase "$w_s_itimer" in
- X1)
- X echo " struct itimerval"
- X idefs="-DS_ITIMERVAL $idefs"
- X ;;
- Xesac
- Xcase "$w_s_timevl" in
- X1)
- X echo " struct timeval"
- X idefs="-DS_TIMEVAL $idefs"
- X ;;
- Xesac
- Xcase "$w_s_tm" in
- X1)
- X echo " struct tm"
- X idefs="-DS_TM $idefs"
- X ;;
- Xesac
- Xcase "$w_localtim" in
- X1)
- X echo " ctime(3) declarations"
- X idefs="-DD_CTIME $idefs"
- X ;;
- Xesac
- Xcase "$idefs" in
- X'')
- X echo " (something I don't know about)"
- X ;;
- Xesac
- Xecho " "
- Xecho "I'm now running the test program..."
- X$cat >i_time.c <<'EOCP'
- X#include <sys/types.h>
- X#ifdef I_TIME
- X#include <time.h>
- X#endif
- X#ifdef I_SYS_TIME
- X#ifdef SYSTIMEKERNEL
- X#define KERNEL
- X#endif
- X#include <sys/time.h>
- X#endif
- X#ifdef I_SYS_SELECT
- X#include <sys/select.h>
- X#endif
- Xmain()
- X{
- X struct tm foo;
- X struct tm *tmp;
- X#ifdef S_TIMEVAL
- X struct timeval bar;
- X#endif
- X#ifdef S_ITIMERVAL
- X struct itimerval baz;
- X#endif
- X
- X if (foo.tm_sec == foo.tm_sec)
- X exit(0);
- X#ifdef S_TIMEVAL
- X if (bar.tv_sec == bar.tv_sec)
- X exit(0);
- X#endif
- X#ifdef S_ITIMERVAL
- X if (baz.it_interval == baz.it_interval)
- X exit(0);
- X#endif
- X#ifdef S_TIMEVAL
- X if (bar.tv_sec == bar.tv_sec)
- X exit(0);
- X#endif
- X#ifdef D_CTIME
- X /* this might not do anything for us... */
- X tmp = localtime((time_t *)0);
- X#endif
- X exit(1);
- X}
- XEOCP
- Xflags=''
- Xfor i_sys_select in '' '-DI_SYS_SELECT'; do
- X for d_systimekernel in '' '-DSYSTIMEKERNEL'; do
- X for i_time in '' '-DI_TIME'; do
- X for i_systime in '-DI_SYS_TIME' ''; do
- X case "$flags" in
- X '') echo Trying $i_time $i_systime $d_systimekernel $i_sys_select
- X if $cc $ccflags $idefs \
- X $i_time $i_systime $d_systimekernel $i_sys_select \
- X i_time.c -o i_time >/dev/null 2>&1 ; then
- X set X $i_time $i_systime $d_systimekernel $i_sys_select
- X shift
- X flags="$*"
- X echo Succeeded with $flags
- X fi
- X ;;
- X esac
- X done
- X done
- X done
- Xdone
- Xcase "$flags" in
- X*SYSTIMEKERNEL*) val="$define";;
- X*) val="$undef";;
- Xesac
- Xset d_systimekernel
- Xeval $setvar
- Xcase "$flags" in
- X*I_TIME*) val="$define";;
- X*) val="$undef";;
- Xesac
- Xset i_time
- Xeval $setvar
- Xcase "$flags" in
- X*I_SYS_SELECT*) val="$define";;
- X*) val="$undef";;
- Xesac
- Xset i_sys_select
- Xeval $setvar
- Xcase "$flags" in
- X*I_SYS_TIME*) val="$define";;
- X*) val="$undef";;
- Xesac
- Xset i_sys_time
- Xeval $setvar
- Xcase "$flags$i_sys_time$i_time" in
- Xundefundef) i_sys_time="$define"; i_time="$define";
- X echo "ICK, NOTHING WORKED!!! You may have to diddle the includes.";;
- Xesac
- X
- X: see if signal is declared as pointer to function returning int or void
- Xecho " "
- X$cppstdin $cppflags $cppminus < $usrinclude/signal.h >d_voidsig.txt
- Xif $contains 'int.*signal' d_voidsig.txt >/dev/null 2>&1 ; then
- X echo "You have int (*signal())() instead of void."
- X val="$undef"
- X d_tosignal=int
- Xelse
- X echo "You have void (*signal())() instead of int."
- X val="$define"
- X d_tosignal=void
- Xfi
- Xset d_voidsig
- Xeval $setvar
- X
- X: see if truncate exists
- Xset truncate d_truncate
- Xeval $inlibc
- X
- X: see if there is a vfork
- Xset vfork d_vfork
- Xeval $inlibc
- X
- X: check for volatile keyword
- Xecho " "
- Xecho 'Checking to see if your C compiler knows about "volatile"...'
- X$cat >try.c <<'EOCP'
- Xmain()
- X{
- X typedef unsigned short foo_t;
- X char *volatile foo;
- X volatile int bar;
- X volatile foo_t blech;
- X foo = foo;
- X}
- XEOCP
- Xif $cc -c $ccflags try.c >/dev/null 2>&1 ; then
- X val="$define"
- X echo "Yup, it does."
- Xelse
- X val="$undef"
- X echo "Nope, it doesn't."
- Xfi
- Xset d_volatile
- Xeval $setvar
- X$rm -f try.*
- X
- X: see if there is a wait4
- Xset wait4 d_wait4
- Xeval $inlibc
- X
- X: see if there is a waitpid
- Xset waitpid d_waitpid
- Xeval $inlibc
- X
- X: see what type gids are declared as in the kernel
- Xcase "$gidtype" in
- X'')
- X if $contains 'gid_t;' $usrinclude/sys/types.h >/dev/null 2>&1 ; then
- X dflt='gid_t';
- X else
- X set `grep '_rgid;' $usrinclude/sys/user.h 2>/dev/null` unsigned short
- X case $1 in
- X unsigned) dflt="$1 $2" ;;
- X *) dflt="$1" ;;
- X esac
- X fi
- X ;;
- X*) dflt="$gidtype"
- X ;;
- Xesac
- Xcont=true
- Xecho " "
- Xrp="What type are groups ids returned by getgid(), etc.? [$dflt]"
- X$echo $n "$rp $c"
- X. myread
- Xgidtype="$ans"
- X
- X: check for length of integer
- Xecho " "
- Xcase "$intsize" in
- X'')
- X echo "Checking to see how big your integers are..."
- X $cat >intsize.c <<'EOCP'
- X#include <stdio.h>
- Xmain()
- X{
- X printf("%d\n", sizeof(int));
- X}
- XEOCP
- X if $cc intsize.c -o intsize >/dev/null 2>&1 ; then
- X dflt=`./intsize`
- X else
- X dflt='4'
- X echo "(I can't seem to compile the test program. Guessing...)"
- X fi
- X ;;
- X*)
- X dflt="$intsize"
- X ;;
- Xesac
- Xrp="What is the size of an integer (in bytes)? [$dflt]"
- X$echo $n "$rp $c"
- X. myread
- Xintsize="$ans"
- X
- X: determine which malloc to compile in
- Xecho " "
- Xcase "$usemymalloc" in
- X'')
- X if bsd || v7; then
- X dflt='y'
- X else
- X dflt='n'
- X fi
- X ;;
- X*) dflt="$usemymalloc"
- X ;;
- Xesac
- Xrp="Do you wish to attempt to use the malloc that comes with $package? [$dflt]"
- X$echo $n "$rp $c"
- X. myread
- Xcase "$ans" in
- X'') ans=$dflt;;
- Xesac
- Xusemymalloc="$ans"
- Xcase "$ans" in
- Xy*) mallocsrc='malloc.c'; mallocobj='malloc.o'
- X libs=`echo $libs | sed 's/-lmalloc//'`
- X case "$mallocptrtype" in
- X '')
- X cat >usemymalloc.c <<'END'
- X#include <malloc.h>
- Xvoid *malloc();
- XEND
- X if $cc $ccflags -c usemymalloc.c >/dev/null 2>&1; then
- X mallocptrtype=void
- X else
- X mallocptrtype=char
- X fi
- X ;;
- X esac
- X echo " "
- X echo "Your system wants malloc to return $mallocptrtype*, it would seem."
- X ;;
- X*) mallocsrc=''; mallocobj=''; mallocptrtype=void;;
- Xesac
- X
- X: determine where private executables go
- Xcase "$privlib" in
- X'')
- X dflt=/usr/lib/$package
- X test -d /usr/local/lib && dflt=/usr/local/lib/$package
- X ;;
- X*) dflt="$privlib"
- X ;;
- Xesac
- X$cat <<EOM
- X
- XThe $package package has some auxiliary files that should be reside in a library
- Xthat is accessible by everyone. Where should these "private" but accessible
- XEOM
- X$echo $n "files reside? (~name ok) [$dflt] $c"
- Xrp="Private files will reside where? [$dflt]"
- X. myread
- Xprivlib=`./filexp "$ans"`
- X
- Xcase "$installprivlib" in
- X'')
- X dflt=`echo $privlib | sed 's#^/afs/#/afs/.#'`
- X ;;
- X*) dflt="$installprivlib"
- X ;;
- Xesac
- X$cat <<EOM
- X
- XOn some systems (such as afs) you have to install the library files in a
- Xdifferent directory to get them to go to the right place. Where should the
- XEOM
- X$echo $n "library files be installed? (~name ok) [$dflt] $c"
- Xrp="Install private files where? [$dflt]"
- X. myread
- Xinstallprivlib=`./filexp "$ans"`
- X
- X: check for size of random number generator
- Xecho " "
- Xcase "$randbits" in
- X'')
- X echo "Checking to see how many bits your rand function produces..."
- X $cat >randbits.c <<'EOCP'
- X#include <stdio.h>
- Xmain()
- X{
- X register int i;
- X register unsigned long tmp;
- X register unsigned long max = 0L;
- X
- X for (i=1000; i; i--) {
- X tmp = (unsigned long)rand();
- X if (tmp > max) max = tmp;
- X }
- X for (i=0; max; i++)
- X max /= 2;
- X printf("%d\n",i);
- X}
- XEOCP
- X if $cc randbits.c -o randbits >/dev/null 2>&1 ; then
- X dflt=`./randbits`
- X else
- X dflt='?'
- X echo "(I can't seem to compile the test program...)"
- X fi
- X ;;
- X*)
- X dflt="$randbits"
- X ;;
- Xesac
- Xrp="How many bits does your rand() function produce? [$dflt]"
- X$echo $n "$rp $c"
- X. myread
- Xrandbits="$ans"
- X
- X: determine where public executables go
- Xcase "$scriptdir" in
- X'')
- X dflt="$bin"
- X : guess some guesses
- X test -d /usr/share/scripts && dflt=/usr/share/scripts
- X test -d /usr/share/bin && dflt=/usr/share/bin
- X ;;
- X*) dflt="$scriptdir"
- X ;;
- Xesac
- Xcont=true
- X$cat <<EOM
- X
- XSome installations have a separate directory just for executable scripts so
- Xthat they can mount it across multiple architectures but keep the scripts in
- Xone spot. You might, for example, have a subdirectory of /usr/share for this.
- XOr you might just lump your scripts in with all your other executables.
- X
- XEOM
- Xwhile $test "$cont" ; do
- X rp="Where do you keep publicly executable scripts (~name ok)? [$dflt]"
- X $echo $n "$rp $c"
- X . myread
- X scriptdir="$ans"
- X scriptdir=`./filexp "$scriptdir"`
- X if test -d $scriptdir; then
- X cont=''
- X else
- X case "$fastread" in
- X yes) dflt=y;;
- X *) dflt=n;;
- X esac
- X rp="Directory $scriptdir doesn't exist. Use that name anyway? [$dflt]"
- X $echo $n "$rp $c"
- X . myread
- X dflt=''
- X case "$ans" in
- X y*) cont='';;
- X esac
- X fi
- Xdone
- X
- X: generate list of signal names
- Xecho " "
- Xcase "$sig_name" in
- X'')
- X echo "Generating a list of signal names..."
- X set X `cat $usrinclude/signal.h $usrinclude/sys/signal.h 2>&1 | awk '
- X$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $3 ~ /^[1-9][0-9]*$/ {
- X sig[$3] = substr($2,4,20)
- X if (max < $3 && $3 < 60) {
- X max = $3
- X }
- X}
- X
- XEND {
- X for (i=1; i<=max; i++) {
- X if (sig[i] == "")
- X printf "%d", i
- X else
- X printf "%s", sig[i]
- X if (i < max)
- X printf " "
- X }
- X printf "\n"
- X}
- X'`
- X shift
- X case $# in
- X 0) echo 'kill -l' >/tmp/foo$$
- X set X `$csh -f </tmp/foo$$`
- X shift
- X case $# in
- X 0)set HUP INT QUIT ILL TRAP IOT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM
- X ;;
- X esac
- X ;;
- X esac
- X sig_name="ZERO $*"
- X ;;
- Xesac
- Xecho "Signals are: $sig_name"
- X
- X: see what type of char stdio uses.
- Xecho " "
- Xif $contains 'unsigned.*char.*_ptr;' $usrinclude/stdio.h >/dev/null 2>&1 ; then
- X echo "Your stdio uses unsigned chars."
- X stdchar="unsigned char"
- Xelse
- X echo "Your stdio uses signed chars."
- X stdchar="char"
- Xfi
- X
- X: see what type uids are declared as in the kernel
- Xcase "$uidtype" in
- X'')
- X if $contains 'uid_t;' $usrinclude/sys/types.h >/dev/null 2>&1 ; then
- X dflt='uid_t';
- X else
- X set `grep '_ruid;' $usrinclude/sys/user.h 2>/dev/null` unsigned short
- X case $1 in
- X unsigned) dflt="$1 $2" ;;
- X *) dflt="$1" ;;
- X esac
- X fi
- X ;;
- X*) dflt="$uidtype"
- X ;;
- Xesac
- Xcont=true
- Xecho " "
- Xrp="What type are user ids returned by getuid(), etc.? [$dflt]"
- X$echo $n "$rp $c"
- X. myread
- Xuidtype="$ans"
- X
- X: check for void type
- Xecho " "
- X$cat <<EOM
- XChecking to see how well your C compiler groks the void type...
- X
- X Support flag bits are:
- X 1: basic void declarations.
- X 2: arrays of pointers to functions returning void.
- X 4: operations between pointers to and addresses of void functions.
- X
- XEOM
- Xcase "$voidhave" in
- X'')
- X $cat >void.c <<'EOCP'
- X#if TRY & 1
- Xvoid main() {
- X#else
- Xmain() {
- X#endif
- X extern void moo(); /* function returning void */
- X void (*goo)(); /* ptr to func returning void */
- X#if TRY & 2
- X void (*foo[10])();
- X#endif
- X
- X#if TRY & 4
- X if(goo == moo) {
- X exit(0);
- X }
- X#endif
- X exit(0);
- X}
- XEOCP
- X if $cc -S -DTRY=$voidwant void.c >void.out 2>&1 ; then
- X voidhave=$voidwant
- X echo "It appears to support void to the level $package wants ($voidwant)."
- X if $contains warning void.out >/dev/null 2>&1; then
- X echo "However, you might get some warnings that look like this:"
- X $cat void.out
- X fi
- X else
- X echo "Hmm, your compiler has some difficulty with void. Checking further..."
- X if $cc -S -DTRY=1 void.c >/dev/null 2>&1 ; then
- X echo "It supports 1..."
- X if $cc -S -DTRY=3 void.c >/dev/null 2>&1 ; then
- X voidhave=3
- X echo "And it supports 2 but not 4."
- X else
- X echo "It doesn't support 2..."
- X if $cc -S -DTRY=5 void.c >/dev/null 2>&1 ; then
- X voidhave=5
- X echo "But it supports 4."
- X else
- X voidhave=1
- X echo "And it doesn't support 4."
- X fi
- X fi
- X else
- X echo "There is no support at all for void."
- X voidhave=0
- X fi
- X fi
- Xesac
- Xdflt="$voidhave";
- Xrp="Your void support flags add up to what? [$dflt]"
- X$echo $n "$rp $c"
- X. myread
- Xvoidhave="$ans"
- X
- X: preserve RCS keywords in files with variable substitution, grrr
- XLog='$Log'
- XHeader='$Header'
- XId='$Id'
- XAuthor='$Author'
- XDate='$Date'
- XLocker='$Locker'
- XRCSfile='$RCSfile'
- XRevision='$Revision'
- XSource='$Source'
- XState='$State'
- X
- X
- X: determine compiler compiler
- Xcase "$yacc" in
- X'') if xenix; then
- X dflt=yacc
- X else
- X dflt='yacc -Sm25000'
- X fi
- X ;;
- X*) dflt="$yacc";;
- Xesac
- Xcont=true
- X echo " "
- Xrp="Which compiler compiler (yacc or bison -y) will you use? [$dflt]"
- X$echo $n "$rp $c"
- X. myread
- Xcase "$ans" in
- X'') ans="$dflt";;
- Xesac
- Xyacc="$ans"
- X
- X: see what type gids are returned by getgroups
- Xecho " "
- Xcase "$groupstype" in
- X'')
- X if $contains 'getgroups.*short' /usr/lib/lint/llib-lc >/dev/null 2>&1; then
- X dflt='short'
- X elif $contains 'getgroups.*int' /usr/lib/lint/llib-lc >/dev/null 2>&1; then
- X dflt='int'
- X elif $contains 'getgroups.*short' /usr/lib/lint/llib-lbsd >/dev/null 2>&1; then
- X dflt='short'
- X elif $contains 'getgroups.*int' /usr/lib/lint/llib-lbsd >/dev/null 2>&1; then
- X dflt='int'
- X elif $contains 'int gidset' /usr/man/man2/getgroups.2 >/dev/null 2>&1 ; then
- X dflt='int'
- X elif $contains 'gid_t;' $usrinclude/sys/types.h >/dev/null 2>&1 ; then
- X dflt='gid_t'
- X else
- X set `grep 'groups\[NGROUPS\];' $usrinclude/sys/user.h 2>/dev/null` unsigned short
- X case $1 in
- X unsigned) dflt="$1 $2" ;;
- X *) dflt="$1" ;;
- X esac
- X fi
- X ;;
- X*) dflt="$groupstype"
- X ;;
- Xesac
- Xcont=true
- Xecho "(The following only matters if you have getgroups().)"
- Xrp="What type are the group ids returned by getgroups()? [$dflt]"
- X$echo $n "$rp $c"
- X. myread
- Xgroupstype="$ans"
- X
- X: see if we can include fcntl.h
- Xecho " "
- Xif $h_fcntl; then
- X val="$define"
- X echo "We'll be including <fcntl.h>."
- Xelse
- X val="$undef"
- X if $h_sys_file; then
- X echo "We don't need to <fcntl.h> if we include <sys/file.h>."
- X else
- X echo "We won't be including <fcntl.h>."
- X fi
- Xfi
- Xset i_fcntl
- Xeval $setvar
- X
- X: see if gdbm is available
- Xecho " "
- Xxxx=`./loc gdbm.h x $usrinclude /usr/local/include $inclwanted`
- Xif test -f $xxx; then
- X val="$define"
- X echo "gdbm.h found."
- Xelse
- X val="$undef"
- X echo "gdbm.h not found."
- Xfi
- Xset i_gdbm
- Xeval $setvar
- X
- X: see if this is an grp system
- Xecho " "
- Xif $test -r $usrinclude/grp.h ; then
- X val="$define"
- X echo "grp.h found."
- Xelse
- X val="$undef"
- X echo "No grp.h found."
- Xfi
- Xset i_grp
- Xeval $setvar
- X
- X: see if this is a netinet/in.h or sys/in.h system
- Xecho " "
- Xxxx=`./loc netinet/in.h x $usrinclude /usr/local/include $inclwanted`
- Xif test -f $xxx; then
- X val="$define"
- X val2="$undef"
- X echo "netinet/in.h found."
- Xelse
- X val="$undef"
- X echo "No netinet/in.h found, ..."
- X xxx=`./loc sys/in.h x $usrinclude /usr/local/include $inclwanted`
- X if test -f $xxx; then
- X val2="$define"
- X echo "but I found sys/in.h instead."
- X else
- X val2="$undef"
- X echo "and I didn't find sys/in.h either."
- X fi
- Xfi
- Xset i_niin
- Xeval $setvar
- Xval=$val2
- Xset i_sysin
- Xeval $setvar
- X
- X: Do we need to #include <sys/file.h> ?
- Xecho " "
- Xif $h_sys_file; then
- X val="$define"
- X echo "We'll be including <sys/file.h>."
- Xelse
- X val="$undef"
- X echo "We won't be including <sys/file.h>."
- Xfi
- Xset i_sys_file
- Xeval $setvar
- X
- X: see if ioctl defs are in sgtty/termio or sys/ioctl
- Xecho " "
- Xif $test -r $usrinclude/sys/ioctl.h ; then
- X val="$define"
- X echo "sys/ioctl.h found."
- Xelse
- X val="$undef"
- X echo "sys/ioctl.h not found, assuming ioctl args are defined in sgtty.h."
- Xfi
- Xset i_sysioctl
- Xeval $setvar
- X
- X: see if we should include utime.h
- Xecho " "
- Xif $test -r $usrinclude/utime.h ; then
- X val="$define"
- X echo "utime.h found."
- Xelse
- X val="$undef"
- X echo "No utime.h found, but that's ok."
- Xfi
- Xset i_utime
- Xeval $setvar
- X
- X: see if this is a varargs system
- Xecho " "
- Xif $test -r $usrinclude/varargs.h ; then
- X val="$define"
- X echo "varargs.h found."
- Xelse
- X val="$undef"
- X echo "No varargs.h found, but that's ok (I hope)."
- Xfi
- Xset i_varargs
- Xeval $setvar
- X
- X: see if this is a vfork system
- Xecho " "
- Xif $test -r $usrinclude/vfork.h ; then
- X val="$define"
- X echo "vfork.h found."
- Xelse
- X val="$undef"
- X echo "No vfork.h found."
- Xfi
- Xset i_vfork
- Xeval $setvar
- X
- X: end of configuration questions
- Xecho " "
- Xecho "End of configuration questions."
- Xecho " "
- X
- X: create config.sh file
- Xecho " "
- Xif test -d ../UU; then
- X cd ..
- Xfi
- Xecho "Creating config.sh..."
- X$spitshell <<EOT >config.sh
- X$startsh
- X# config.sh
- X# This file was produced by running the Configure script.
- X
- Xd_eunice='$d_eunice'
- Xdefine='$define'
- Xeunicefix='$eunicefix'
- Xloclist='$loclist'
- Xexpr='$expr'
- Xsed='$sed'
- Xecho='$echo'
- Xcat='$cat'
- Xrm='$rm'
- Xmv='$mv'
- Xcp='$cp'
- Xtail='$tail'
- Xtr='$tr'
- Xmkdir='$mkdir'
- Xsort='$sort'
- Xuniq='$uniq'
- Xgrep='$grep'
- Xtrylist='$trylist'
- Xtest='$test'
- Xinews='$inews'
- Xegrep='$egrep'
- Xmore='$more'
- Xpg='$pg'
- XMcc='$Mcc'
- Xvi='$vi'
- Xmailx='$mailx'
- Xmail='$mail'
- Xcpp='$cpp'
- Xperl='$perl'
- Xemacs='$emacs'
- Xls='$ls'
- Xrmail='$rmail'
- Xsendmail='$sendmail'
- Xshar='$shar'
- Xsmail='$smail'
- Xtbl='$tbl'
- Xtroff='$troff'
- Xnroff='$nroff'
- Xuname='$uname'
- Xuuname='$uuname'
- Xline='$line'
- Xchgrp='$chgrp'
- Xchmod='$chmod'
- Xlint='$lint'
- Xsleep='$sleep'
- Xpr='$pr'
- Xtar='$tar'
- Xln='$ln'
- Xlpr='$lpr'
- Xlp='$lp'
- Xtouch='$touch'
- Xmake='$make'
- Xdate='$date'
- Xcsh='$csh'
- Xbash='$bash'
- Xksh='$ksh'
- Xlex='$lex'
- Xflex='$flex'
- Xbison='$bison'
- XLog='$Log'
- XHeader='$Header'
- XId='$Id'
- Xlastuname='$lastuname'
- Xalignbytes='$alignbytes'
- Xbin='$bin'
- Xinstallbin='$installbin'
- Xbyteorder='$byteorder'
- Xcontains='$contains'
- Xcppstdin='$cppstdin'
- Xcppminus='$cppminus'
- Xd_bcmp='$d_bcmp'
- Xd_bcopy='$d_bcopy'
- Xd_bzero='$d_bzero'
- Xd_castneg='$d_castneg'
- Xcastflags='$castflags'
- Xd_charsprf='$d_charsprf'
- Xd_chsize='$d_chsize'
- Xd_crypt='$d_crypt'
- Xcryptlib='$cryptlib'
- Xd_csh='$d_csh'
- Xd_dosuid='$d_dosuid'
- Xd_dup2='$d_dup2'
- Xd_fchmod='$d_fchmod'
- Xd_fchown='$d_fchown'
- Xd_fcntl='$d_fcntl'
- Xd_flexfnam='$d_flexfnam'
- Xd_flock='$d_flock'
- Xd_getgrps='$d_getgrps'
- Xd_gethent='$d_gethent'
- Xd_getpgrp='$d_getpgrp'
- Xd_getpgrp2='$d_getpgrp2'
- Xd_getprior='$d_getprior'
- Xd_htonl='$d_htonl'
- Xd_index='$d_index'
- Xd_killpg='$d_killpg'
- Xd_lstat='$d_lstat'
- Xd_memcmp='$d_memcmp'
- Xd_memcpy='$d_memcpy'
- Xd_mkdir='$d_mkdir'
- Xd_msg='$d_msg'
- Xd_msgctl='$d_msgctl'
- Xd_msgget='$d_msgget'
- Xd_msgrcv='$d_msgrcv'
- Xd_msgsnd='$d_msgsnd'
- Xd_ndbm='$d_ndbm'
- Xd_odbm='$d_odbm'
- Xd_open3='$d_open3'
- Xd_readdir='$d_readdir'
- Xd_rename='$d_rename'
- Xd_rmdir='$d_rmdir'
- Xd_select='$d_select'
- Xd_sem='$d_sem'
- Xd_semctl='$d_semctl'
- Xd_semget='$d_semget'
- Xd_semop='$d_semop'
- Xd_setegid='$d_setegid'
- Xd_seteuid='$d_seteuid'
- Xd_setpgrp='$d_setpgrp'
- Xd_setpgrp2='$d_setpgrp2'
- Xd_setprior='$d_setprior'
- Xd_setregid='$d_setregid'
- Xd_setresgid='$d_setresgid'
- Xd_setreuid='$d_setreuid'
- Xd_setresuid='$d_setresuid'
- Xd_setrgid='$d_setrgid'
- Xd_setruid='$d_setruid'
- Xd_shm='$d_shm'
- Xd_shmat='$d_shmat'
- Xd_shmctl='$d_shmctl'
- Xd_shmdt='$d_shmdt'
- Xd_shmget='$d_shmget'
- Xd_socket='$d_socket'
- Xd_sockpair='$d_sockpair'
- Xd_oldsock='$d_oldsock'
- Xsocketlib='$socketlib'
- Xd_statblks='$d_statblks'
- Xd_stdstdio='$d_stdstdio'
- Xd_strctcpy='$d_strctcpy'
- Xd_strerror='$d_strerror'
- Xd_symlink='$d_symlink'
- Xd_syscall='$d_syscall'
- Xd_truncate='$d_truncate'
- Xd_vfork='$d_vfork'
- Xd_voidsig='$d_voidsig'
- Xd_tosignal='$d_tosignal'
- Xd_volatile='$d_volatile'
- Xd_vprintf='$d_vprintf'
- Xd_charvspr='$d_charvspr'
- Xd_wait4='$d_wait4'
- Xd_waitpid='$d_waitpid'
- Xgidtype='$gidtype'
- Xgroupstype='$groupstype'
- Xi_fcntl='$i_fcntl'
- Xi_gdbm='$i_gdbm'
- Xi_grp='$i_grp'
- Xi_niin='$i_niin'
- Xi_sysin='$i_sysin'
- Xi_pwd='$i_pwd'
- Xd_pwquota='$d_pwquota'
- Xd_pwage='$d_pwage'
- Xd_pwchange='$d_pwchange'
- Xd_pwclass='$d_pwclass'
- Xd_pwexpire='$d_pwexpire'
- Xd_pwcomment='$d_pwcomment'
- Xi_sys_file='$i_sys_file'
- Xi_sysioctl='$i_sysioctl'
- Xi_time='$i_time'
- Xi_sys_time='$i_sys_time'
- Xi_sys_select='$i_sys_select'
- Xd_systimekernel='$d_systimekernel'
- Xi_utime='$i_utime'
- Xi_varargs='$i_varargs'
- Xi_vfork='$i_vfork'
- Xintsize='$intsize'
- Xlibc='$libc'
- Xnm_opts='$nm_opts'
- Xlibndir='$libndir'
- Xi_my_dir='$i_my_dir'
- Xi_ndir='$i_ndir'
- Xi_sys_ndir='$i_sys_ndir'
- Xi_dirent='$i_dirent'
- Xi_sys_dir='$i_sys_dir'
- Xd_dirnamlen='$d_dirnamlen'
- Xndirc='$ndirc'
- Xndiro='$ndiro'
- Xmallocsrc='$mallocsrc'
- Xmallocobj='$mallocobj'
- Xusemymalloc='$usemymalloc'
- Xmallocptrtype='$mallocptrtype'
- Xmansrc='$mansrc'
- Xmanext='$manext'
- Xmodels='$models'
- Xsplit='$split'
- Xsmall='$small'
- Xmedium='$medium'
- Xlarge='$large'
- Xhuge='$huge'
- Xoptimize='$optimize'
- Xccflags='$ccflags'
- Xcppflags='$cppflags'
- Xldflags='$ldflags'
- Xcc='$cc'
- Xlibs='$libs'
- Xn='$n'
- Xc='$c'
- Xpackage='$package'
- Xrandbits='$randbits'
- Xscriptdir='$scriptdir'
- Xsig_name='$sig_name'
- Xspitshell='$spitshell'
- Xshsharp='$shsharp'
- Xsharpbang='$sharpbang'
- Xstartsh='$startsh'
- Xstdchar='$stdchar'
- Xuidtype='$uidtype'
- Xusrinclude='$usrinclude'
- XinclPath='$inclPath'
- Xvoid='$void'
- Xvoidhave='$voidhave'
- Xvoidwant='$voidwant'
- Xw_localtim='$w_localtim'
- Xw_s_timevl='$w_s_timevl'
- Xw_s_tm='$w_s_tm'
- Xyacc='$yacc'
- Xlib='$lib'
- Xprivlib='$privlib'
- Xinstallprivlib='$installprivlib'
- XCONFIG=true
- XEOT
- X
- X: Finish up
- XCONFIG=true
- X
- Xecho " "
- Xtest -f patchlevel.h && awk '{printf "%s=%s\n",$2,$3}' patchlevel.h >>config.sh
- Xdflt=''
- Xfastread=''
- Xecho "If you didn't make any mistakes, then just type a carriage return here."
- Xrp="If you need to edit config.sh, do it as a shell escape here:"
- X$echo $n "$rp $c"
- X. UU/myread
- Xcase "$ans" in
- X'') ;;
- X*) : in case they cannot read
- X eval $ans;;
- Xesac
- X: if this fails, just run all the .SH files by hand
- X. ./config.sh
- X
- Xecho " "
- Xecho "Doing variable substitutions on .SH files..."
- Xset x `awk '{print $1}' <MANIFEST | $grep '\.SH'`
- Xshift
- Xcase $# in
- X0) set x *.SH; shift;;
- Xesac
- Xif test ! -f $1; then
- X shift
- Xfi
- Xfor file in $*; do
- X set X
- X shift
- X chmod +x $file
- X case "$file" in
- X */*)
- X dir=`$expr X$file : 'X\(.*\)/'`
- X file=`$expr X$file : 'X.*/\(.*\)'`
- X (cd $dir && . $file)
- X ;;
- X *)
- X . $file
- X ;;
- X esac
- Xdone
- Xif test -f config.h.SH; then
- X if test ! -f config.h; then
- X : oops, they left it out of MANIFEST, probably, so do it anyway.
- X . config.h.SH
- X fi
- Xfi
- X
- Xif $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
- X dflt=n
- X $cat <<EOM
- X
- XNow you need to generate make dependencies by running "make depend".
- XYou might prefer to run it in background: "make depend > makedepend.out &"
- XIt can take a while, so you might not want to run it right now.
- X
- XEOM
- X rp="Run make depend now? [$dflt]"
- X $echo $n "$rp $c"
- X . UU/myread
- X case "$ans" in
- X y*) make depend && echo "Now you must run a make."
- X ;;
- X *) echo "You must run 'make depend' then 'make'."
- X ;;
- X esac
- Xelif test -f [Mm]akefile; then
- X echo " "
- X echo "Now you must run a make."
- Xelse
- X echo "Done."
- Xfi
- X
- X$rm -f kit*isdone
- Xcd .. && $rm -rf UU
- X: end of Configure
- !STUFFY!FUNK!
- echo Extracting usub/curses.mus
- sed >usub/curses.mus <<'!STUFFY!FUNK!' -e 's/X//'
- X/* $Header: curses.mus,v 4.0 91/03/20 01:56:13 lwall Locked $
- X *
- X * $Log: curses.mus,v $
- X * Revision 4.0 91/03/20 01:56:13 lwall
- X * 4.0 baseline.
- X *
- X * Revision 3.0.1.1 90/08/09 04:05:21 lwall
- X * patch19: Initial revision
- X *
- X */
- X
- X#include "EXTERN.h"
- X#include "perl.h"
- Xextern int wantarray;
- X
- Xchar *savestr();
- X
- X#include <curses.h>
- X
- Xstatic enum uservars {
- X UV_curscr,
- X UV_stdscr,
- X UV_Def_term,
- X UV_My_term,
- X UV_ttytype,
- X UV_LINES,
- X UV_COLS,
- X UV_ERR,
- X UV_OK,
- X};
- X
- Xstatic enum usersubs {
- X US_addch,
- X US_waddch,
- X US_addstr,
- X US_waddstr,
- X US_box,
- X US_clear,
- X US_wclear,
- X US_clearok,
- X US_clrtobot,
- X US_wclrtobot,
- X US_clrtoeol,
- X US_wclrtoeol,
- X US_delch,
- X US_wdelch,
- X US_deleteln,
- X US_wdeleteln,
- X US_erase,
- X US_werase,
- X US_flushok,
- X US_idlok,
- X US_insch,
- X US_winsch,
- X US_insertln,
- X US_winsertln,
- X US_move,
- X US_wmove,
- X US_overlay,
- X US_overwrite,
- X US_printw,
- X US_wprintw,
- X US_refresh,
- X US_wrefresh,
- X US_standout,
- X US_wstandout,
- X US_standend,
- X US_wstandend,
- X US_cbreak,
- X US_nocbreak,
- X US_echo,
- X US_noecho,
- X US_getch,
- X US_wgetch,
- X US_getstr,
- X US_wgetstr,
- X US_raw,
- X US_noraw,
- X US_scanw,
- X US_wscanw,
- X US_baudrate,
- X US_delwin,
- X US_endwin,
- X US_erasechar,
- X US_getcap,
- X US_getyx,
- X US_inch,
- X US_winch,
- X US_initscr,
- X US_killchar,
- X US_leaveok,
- X US_longname,
- X US_fullname,
- X US_mvwin,
- X US_newwin,
- X US_nl,
- X US_nonl,
- X US_scrollok,
- X US_subwin,
- X US_touchline,
- X US_touchoverlap,
- X US_touchwin,
- X US_unctrl,
- X US_gettmode,
- X US_mvcur,
- X US_scroll,
- X US_savetty,
- X US_resetty,
- X US_setterm,
- X US_tstp,
- X US__putchar,
- X};
- X
- Xstatic int usersub();
- Xstatic int userset();
- Xstatic int userval();
- X
- Xint
- Xinit_curses()
- X{
- X struct ufuncs uf;
- X char *filename = "curses.c";
- X
- X uf.uf_set = userset;
- X uf.uf_val = userval;
- X
- X#define MAGICVAR(name, ix) uf.uf_index = ix, magicname(name, &uf, sizeof uf)
- X
- X MAGICVAR("curscr", UV_curscr);
- X MAGICVAR("stdscr", UV_stdscr);
- X MAGICVAR("Def_term",UV_Def_term);
- X MAGICVAR("My_term", UV_My_term);
- X MAGICVAR("ttytype", UV_ttytype);
- X MAGICVAR("LINES", UV_LINES);
- X MAGICVAR("COLS", UV_COLS);
- X MAGICVAR("ERR", UV_ERR);
- X MAGICVAR("OK", UV_OK);
- X
- X make_usub("addch", US_addch, usersub, filename);
- X make_usub("waddch", US_waddch, usersub, filename);
- X make_usub("addstr", US_addstr, usersub, filename);
- X make_usub("waddstr", US_waddstr, usersub, filename);
- X make_usub("box", US_box, usersub, filename);
- X make_usub("clear", US_clear, usersub, filename);
- X make_usub("wclear", US_wclear, usersub, filename);
- X make_usub("clearok", US_clearok, usersub, filename);
- X make_usub("clrtobot", US_clrtobot, usersub, filename);
- X make_usub("wclrtobot", US_wclrtobot, usersub, filename);
- X make_usub("clrtoeol", US_clrtoeol, usersub, filename);
- X make_usub("wclrtoeol", US_wclrtoeol, usersub, filename);
- X make_usub("delch", US_delch, usersub, filename);
- X make_usub("wdelch", US_wdelch, usersub, filename);
- X make_usub("deleteln", US_deleteln, usersub, filename);
- X make_usub("wdeleteln", US_wdeleteln, usersub, filename);
- X make_usub("erase", US_erase, usersub, filename);
- X make_usub("werase", US_werase, usersub, filename);
- X make_usub("flushok", US_flushok, usersub, filename);
- X make_usub("idlok", US_idlok, usersub, filename);
- X make_usub("insch", US_insch, usersub, filename);
- X make_usub("winsch", US_winsch, usersub, filename);
- X make_usub("insertln", US_insertln, usersub, filename);
- X make_usub("winsertln", US_winsertln, usersub, filename);
- X make_usub("move", US_move, usersub, filename);
- X make_usub("wmove", US_wmove, usersub, filename);
- X make_usub("overlay", US_overlay, usersub, filename);
- X make_usub("overwrite", US_overwrite, usersub, filename);
- X make_usub("printw", US_printw, usersub, filename);
- X make_usub("wprintw", US_wprintw, usersub, filename);
- X make_usub("refresh", US_refresh, usersub, filename);
- X make_usub("wrefresh", US_wrefresh, usersub, filename);
- X make_usub("standout", US_standout, usersub, filename);
- X make_usub("wstandout", US_wstandout, usersub, filename);
- X make_usub("standend", US_standend, usersub, filename);
- X make_usub("wstandend", US_wstandend, usersub, filename);
- X make_usub("cbreak", US_cbreak, usersub, filename);
- X make_usub("nocbreak", US_nocbreak, usersub, filename);
- X make_usub("echo", US_echo, usersub, filename);
- X make_usub("noecho", US_noecho, usersub, filename);
- X make_usub("getch", US_getch, usersub, filename);
- X make_usub("wgetch", US_wgetch, usersub, filename);
- X make_usub("getstr", US_getstr, usersub, filename);
- X make_usub("wgetstr", US_wgetstr, usersub, filename);
- X make_usub("raw", US_raw, usersub, filename);
- X make_usub("noraw", US_noraw, usersub, filename);
- X make_usub("scanw", US_scanw, usersub, filename);
- X make_usub("wscanw", US_wscanw, usersub, filename);
- X make_usub("baudrate", US_baudrate, usersub, filename);
- X make_usub("delwin", US_delwin, usersub, filename);
- X make_usub("endwin", US_endwin, usersub, filename);
- X make_usub("erasechar", US_erasechar, usersub, filename);
- X make_usub("getcap", US_getcap, usersub, filename);
- X make_usub("getyx", US_getyx, usersub, filename);
- X make_usub("inch", US_inch, usersub, filename);
- X make_usub("winch", US_winch, usersub, filename);
- X make_usub("initscr", US_initscr, usersub, filename);
- X make_usub("killchar", US_killchar, usersub, filename);
- X make_usub("leaveok", US_leaveok, usersub, filename);
- X make_usub("longname", US_longname, usersub, filename);
- X make_usub("fullname", US_fullname, usersub, filename);
- X make_usub("mvwin", US_mvwin, usersub, filename);
- X make_usub("newwin", US_newwin, usersub, filename);
- X make_usub("nl", US_nl, usersub, filename);
- X make_usub("nonl", US_nonl, usersub, filename);
- X make_usub("scrollok", US_scrollok, usersub, filename);
- X make_usub("subwin", US_subwin, usersub, filename);
- X make_usub("touchline", US_touchline, usersub, filename);
- X make_usub("touchoverlap", US_touchoverlap,usersub, filename);
- X make_usub("touchwin", US_touchwin, usersub, filename);
- X make_usub("unctrl", US_unctrl, usersub, filename);
- X make_usub("gettmode", US_gettmode, usersub, filename);
- X make_usub("mvcur", US_mvcur, usersub, filename);
- X make_usub("scroll", US_scroll, usersub, filename);
- X make_usub("savetty", US_savetty, usersub, filename);
- X make_usub("resetty", US_resetty, usersub, filename);
- X make_usub("setterm", US_setterm, usersub, filename);
- X make_usub("tstp", US_tstp, usersub, filename);
- X make_usub("_putchar", US__putchar, usersub, filename);
- X};
- X
- Xstatic int
- Xusersub(ix, sp, items)
- Xint ix;
- Xregister int sp;
- Xregister int items;
- X{
- X STR **st = stack->ary_array + sp;
- X register int i;
- X register char *tmps;
- X register STR *Str; /* used in str_get and str_gnum macros */
- X
- X switch (ix) {
- XCASE int addch
- XI char ch
- XEND
- X
- XCASE int waddch
- XI WINDOW* win
- XI char ch
- XEND
- X
- XCASE int addstr
- XI char* str
- XEND
- X
- XCASE int waddstr
- XI WINDOW* win
- XI char* str
- XEND
- X
- XCASE int box
- XI WINDOW* win
- XI char vert
- XI char hor
- XEND
- X
- XCASE int clear
- XEND
- X
- XCASE int wclear
- XI WINDOW* win
- XEND
- X
- XCASE int clearok
- XI WINDOW* win
- XI bool boolf
- XEND
- X
- XCASE int clrtobot
- XEND
- X
- XCASE int wclrtobot
- XI WINDOW* win
- XEND
- X
- XCASE int clrtoeol
- XEND
- X
- XCASE int wclrtoeol
- XI WINDOW* win
- XEND
- X
- XCASE int delch
- XEND
- X
- XCASE int wdelch
- XI WINDOW* win
- XEND
- X
- XCASE int deleteln
- XEND
- X
- XCASE int wdeleteln
- XI WINDOW* win
- XEND
- X
- XCASE int erase
- XEND
- X
- XCASE int werase
- XI WINDOW* win
- XEND
- X
- XCASE int flushok
- XI WINDOW* win
- XI bool boolf
- XEND
- X
- XCASE int idlok
- XI WINDOW* win
- XI bool boolf
- XEND
- X
- XCASE int insch
- XI char c
- XEND
- X
- XCASE int winsch
- XI WINDOW* win
- XI char c
- XEND
- X
- XCASE int insertln
- XEND
- X
- XCASE int winsertln
- XI WINDOW* win
- XEND
- X
- XCASE int move
- XI int y
- XI int x
- XEND
- X
- XCASE int wmove
- XI WINDOW* win
- XI int y
- XI int x
- XEND
- X
- XCASE int overlay
- XI WINDOW* win1
- XI WINDOW* win2
- XEND
- X
- XCASE int overwrite
- XI WINDOW* win1
- XI WINDOW* win2
- XEND
- X
- X case US_printw:
- X if (items < 1)
- X fatal("Usage: &printw($fmt, $arg1, $arg2, ... )");
- X else {
- X int retval;
- X STR* str = str_new(0);
- X
- X do_sprintf(str, items - 1, st + 1);
- X retval = addstr(str->str_ptr);
- X str_numset(st[0], (double) retval);
- X str_free(str);
- X }
- X return sp;
- X
- X case US_wprintw:
- X if (items < 2)
- X fatal("Usage: &wprintw($win, $fmt, $arg1, $arg2, ... )");
- X else {
- X int retval;
- X STR* str = str_new(0);
- X WINDOW* win = *(WINDOW**) str_get(st[1]);
- X
- X do_sprintf(str, items - 1, st + 1);
- X retval = waddstr(win, str->str_ptr);
- X str_numset(st[0], (double) retval);
- X str_free(str);
- X }
- X return sp;
- X
- XCASE int refresh
- XEND
- X
- XCASE int wrefresh
- XI WINDOW* win
- XEND
- X
- XCASE int standout
- XEND
- X
- XCASE int wstandout
- XI WINDOW* win
- XEND
- X
- XCASE int standend
- XEND
- X
- XCASE int wstandend
- XI WINDOW* win
- XEND
- X
- XCASE int cbreak
- XEND
- X
- XCASE int nocbreak
- XEND
- X
- XCASE int echo
- XEND
- X
- XCASE int noecho
- XEND
- X
- X case US_getch:
- X if (items != 0)
- X fatal("Usage: &getch()");
- X else {
- X int retval;
- X char retch;
- X
- X retval = getch();
- X if (retval == EOF)
- X st[0] = &str_undef;
- X else {
- X retch = retval;
- X str_nset(st[0], &retch, 1);
- X }
- X }
- X return sp;
- X
- X case US_wgetch:
- X if (items != 1)
- X fatal("Usage: &wgetch($win)");
- X else {
- X int retval;
- X char retch;
- X WINDOW* win = *(WINDOW**) str_get(st[1]);
- X
- X retval = wgetch(win);
- X if (retval == EOF)
- X st[0] = &str_undef;
- X else {
- X retch = retval;
- X str_nset(st[0], &retch, 1);
- X }
- X }
- X return sp;
- X
- XCASE int getstr
- XIO char* str
- XEND
- X
- XCASE int wgetstr
- XI WINDOW* win
- XIO char* str
- XEND
- X
- XCASE int raw
- XEND
- X
- XCASE int noraw
- XEND
- X
- XCASE int baudrate
- XEND
- X
- XCASE int delwin
- XI WINDOW* win
- XEND
- X
- XCASE int endwin
- XEND
- X
- XCASE int erasechar
- XEND
- X
- XCASE char* getcap
- XI char* str
- XEND
- X
- X case US_getyx:
- X if (items != 3)
- X fatal("Usage: &getyx($win, $y, $x)");
- X else {
- X int retval;
- X STR* str = str_new(0);
- X WINDOW* win = *(WINDOW**) str_get(st[1]);
- X int y;
- X int x;
- X
- X do_sprintf(str, items - 1, st + 1);
- X retval = getyx(win, y, x);
- X str_numset(st[2], (double)y);
- X str_numset(st[3], (double)x);
- X str_numset(st[0], (double) retval);
- X str_free(str);
- X }
- X return sp;
- X
- X
- XCASE int inch
- XEND
- X
- XCASE int winch
- XI WINDOW* win
- XEND
- X
- XCASE WINDOW* initscr
- XEND
- X
- XCASE int killchar
- XEND
- X
- XCASE int leaveok
- XI WINDOW* win
- XI bool boolf
- XEND
- X
- XCASE char* longname
- XI char* termbuf
- XIO char* name
- XEND
- X
- XCASE int fullname
- XI char* termbuf
- XIO char* name
- XEND
- X
- XCASE int mvwin
- XI WINDOW* win
- XI int y
- XI int x
- XEND
- X
- XCASE WINDOW* newwin
- XI int lines
- XI int cols
- XI int begin_y
- XI int begin_x
- XEND
- X
- XCASE int nl
- XEND
- X
- XCASE int nonl
- XEND
- X
- XCASE int scrollok
- XI WINDOW* win
- XI bool boolf
- XEND
- X
- XCASE WINDOW* subwin
- XI WINDOW* win
- XI int lines
- XI int cols
- XI int begin_y
- XI int begin_x
- XEND
- X
- XCASE int touchline
- XI WINDOW* win
- XI int y
- XI int startx
- XI int endx
- XEND
- X
- XCASE int touchoverlap
- XI WINDOW* win1
- XI WINDOW* win2
- XEND
- X
- XCASE int touchwin
- XI WINDOW* win
- XEND
- X
- XCASE char* unctrl
- XI char ch
- XEND
- X
- XCASE int gettmode
- XEND
- X
- XCASE int mvcur
- XI int lasty
- XI int lastx
- XI int newy
- XI int newx
- XEND
- X
- XCASE int scroll
- XI WINDOW* win
- XEND
- X
- XCASE int savetty
- XEND
- X
- XCASE void resetty
- XEND
- X
- XCASE int setterm
- XI char* name
- XEND
- X
- XCASE int tstp
- XEND
- X
- XCASE int _putchar
- XI char ch
- XEND
- X
- X default:
- X fatal("Unimplemented user-defined subroutine");
- X }
- X return sp;
- X}
- X
- Xstatic int
- Xuserval(ix, str)
- Xint ix;
- XSTR *str;
- X{
- X switch (ix) {
- X case UV_COLS:
- X str_numset(str, (double)COLS);
- X break;
- X case UV_Def_term:
- X str_set(str, Def_term);
- X break;
- X case UV_ERR:
- X str_numset(str, (double)ERR);
- X break;
- X case UV_LINES:
- X str_numset(str, (double)LINES);
- X break;
- X case UV_My_term:
- X str_numset(str, (double)My_term);
- X break;
- X case UV_OK:
- X str_numset(str, (double)OK);
- X break;
- X case UV_curscr:
- X str_nset(str, &curscr, sizeof(WINDOW*));
- X break;
- X case UV_stdscr:
- X str_nset(str, &stdscr, sizeof(WINDOW*));
- X break;
- X case UV_ttytype:
- X str_set(str, ttytype);
- X break;
- X }
- X return 0;
- X}
- X
- Xstatic int
- Xuserset(ix, str)
- Xint ix;
- XSTR *str;
- X{
- X switch (ix) {
- X case UV_COLS:
- X COLS = (int)str_gnum(str);
- X break;
- X case UV_Def_term:
- X Def_term = savestr(str_get(str)); /* never freed */
- X break;
- X case UV_LINES:
- X LINES = (int)str_gnum(str);
- X break;
- X case UV_My_term:
- X My_term = (bool)str_gnum(str);
- X break;
- X case UV_ttytype:
- X strcpy(ttytype, str_get(str)); /* hope it fits */
- X break;
- X }
- X return 0;
- X}
- !STUFFY!FUNK!
- echo Extracting t/op/delete.t
- sed >t/op/delete.t <<'!STUFFY!FUNK!' -e 's/X//'
- X#!./perl
- X
- X# $Header: delete.t,v 4.0 91/03/20 01:51:56 lwall Locked $
- X
- Xprint "1..6\n";
- X
- X$foo{1} = 'a';
- X$foo{2} = 'b';
- X$foo{3} = 'c';
- X
- X$foo = delete $foo{2};
- X
- Xif ($foo eq 'b') {print "ok 1\n";} else {print "not ok 1 $foo\n";}
- Xif ($foo{2} eq '') {print "ok 2\n";} else {print "not ok 2 $foo{2}\n";}
- Xif ($foo{1} eq 'a') {print "ok 3\n";} else {print "not ok 3\n";}
- Xif ($foo{3} eq 'c') {print "ok 4\n";} else {print "not ok 4\n";}
- X
- X$foo = join('',values(foo));
- Xif ($foo eq 'ac' || $foo eq 'ca') {print "ok 5\n";} else {print "not ok 5\n";}
- X
- Xforeach $key (keys foo) {
- X delete $foo{$key};
- X}
- X
- X$foo{'foo'} = 'x';
- X$foo{'bar'} = 'y';
- X
- X$foo = join('',values(foo));
- Xif ($foo eq 'xy' || $foo eq 'yx') {print "ok 6\n";} else {print "not ok 6\n";}
- !STUFFY!FUNK!
- echo " "
- echo "End of kit 14 (of 36)"
- cat /dev/null >kit14isdone
- run=''
- config=''
- for iskit in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36; do
- if test -f kit${iskit}isdone; then
- run="$run $iskit"
- else
- todo="$todo $iskit"
- fi
- done
- case $todo in
- '')
- echo "You have run all your kits. Please read README and then type Configure."
- for combo in *:AA; do
- if test -f "$combo"; then
- realfile=`basename $combo :AA`
- cat $realfile:[A-Z][A-Z] >$realfile
- rm -rf $realfile:[A-Z][A-Z]
- fi
- done
- rm -rf kit*isdone
- chmod 755 Configure
- ;;
- *) echo "You have run$run."
- echo "You still need to run$todo."
- ;;
- esac
- : Someone might mail this, so...
- exit
-
- exit 0 # Just in case...
- --
- Kent Landfield INTERNET: kent@sparky.IMD.Sterling.COM
- Sterling Software, IMD UUCP: uunet!sparky!kent
- Phone: (402) 291-8300 FAX: (402) 291-4362
- Please send comp.sources.misc-related mail to kent@uunet.uu.net.
-