home *** CD-ROM | disk | FTP | other *** search
Wrap
#! /bin/sh # # If these # comments don't work, trim them. Don't worry about any other # shell scripts, Configure will trim # comments from them for you. # # Note: if you are running ksh, be sure to say "sh Configure". # # (If you are trying to port this package to a machine without sh, I would # suggest you cut out the prototypical config.h from the end of Configure # and edit it to reflect your system. Some packages may include samples # of config.h for certain machines, so you might look for one of those.) # # $Header: Configure,v 2.0 86/09/17 15:32:58 lwall Exp $ # # $Log: Configure,v $ # Revision 2.0 86/09/17 15:32:58 lwall # Baseline for netwide release. # # # Yes, you may rip this off to use in other distribution packages. # # (Note: this Configure script was generated automatically. Rather than # working with this copy of Configure, you may wish to get metaconfig.) define='define' undef='/*undef' d_eunice='' eunicefix='' loclist='' expr='' sed='' echo='' cat='' rm='' mv='' cp='' tail='' tr='' mkdir='' sort='' uniq='' grep='' trylist='' test='' inews='' egrep='' more='' pg='' Mcc='' vi='' mailx='' Log='' Header='' bin='' cc='' contains='' cpp='' d_index='' d_void='' iandd='' libc='' mansrc='' manext='' n='' c='' package='' registers='' reg1='' reg2='' reg3='' reg4='' reg5='' reg6='' reg7='' reg8='' reg9='' reg10='' reg11='' reg12='' reg13='' reg14='' reg15='' reg16='' spitshell='' shsharp='' sharpbang='' startsh='' CONFIG='' package=patch echo "Beginning of configuration questions for $package kit." : Eunice requires " " instead of "", can you believe it echo " " : sanity checks PATH='.:/bin:/usr/bin:/usr/local/bin:/usr/ucb:/usr/local:/usr/lbin:/etc' export PATH || (echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh $0; kill $$) if test ! -t 0; then echo "Say 'sh Configure', not 'sh <Configure'" exit 1 fi : some greps do not return status, grrr. echo "grimblepritz" >grimble if grep blurfldyick grimble >/dev/null 2>&1 ; then contains=contains else if grep grimblepritz grimble >/dev/null 2>&1 ; then contains=grep else contains=contains fi fi rm -f grimble : the following should work in any shell case "$contains" in contains*) echo " " echo "AGH! Grep doesn't return a status. Attempting remedial action." cat >contains <<'EOSS' grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp EOSS chmod 755 contains esac : first determine how to suppress newline on echo command echo "Checking echo to see how to suppress newlines..." (echo "hi there\c" ; echo " ") >.echotmp if $contains c .echotmp >/dev/null 2>&1 ; then echo "...using -n." n='-n' c='' else echo "...using \\\c" echo "c." n='' c='\c' fi echo $n "Type carriage return to continue. Your cursor should be here-->$c" read ans rm -f .echotmp : now set up to do reads with possible shell escape : if this does not work on your machine, 1,$ s/. myread/read ans/ cat <<EOSC >myread ans='!' while expr "X\$ans" : "X!" >/dev/null; do read ans case "\$ans" in !) sh echo " " echo $n "\$rp $c" ;; !*) set \`expr "X\$ans" : "X!\(.*\)\$"\` sh -c "\$*" echo " " echo $n "\$rp $c" ;; esac done rp='Your answer:' EOSC : general instructions cat <<EOH This installation shell script will examine your system and ask you questions to determine how $package and any auxiliary files should be installed. If you get stuck on a question, you may use a ! shell escape to start a subshell or execute a command. Many of the questions will have default answers in square brackets--typing carriage return will give you the default. On some of the questions which ask for file or directory names you are allowed to use the ~name construct to specify the login directory belonging to "name", even if you don't have a shell which knows about that. Questions where this is allowed will be marked "(~name ok)". EOH rp="[Type carriage return to continue]" echo $n "$rp $c" . myread cat <<EOH Much effort has been expended to ensure that this shell script will run on any Unix system. If despite that it blows up on you, your best bet is to edit Configure and run it again. (Trying to install this package without having run Configure may be well nigh impossible.) Also, let me (lwall@sdcrdcf.UUCP) know how I blew it. This installation script affects things in two ways: 1) it may do direct variable substitutions on some of the files included in this kit, and 2) it builds a config.h file for inclusion in C programs. You may edit any of these files as the need arises after running this script. EOH rp="[Type carriage return to continue]" echo $n "$rp $c" . myread : get old answers, if there is a config file out there if test -f config.sh; then echo " " rp="I see a config.sh file. Did Configure make it on THIS system? [y]" echo $n "$rp $c" . myread case "$ans" in n*) echo "OK, I'll igno≥e it.";; *) echo "FetcΦing default answers from your old config.sh file..." . config.sh ;; esac fi : get list of predefined functions in a handy place ec bang'/bin/sh' echo "Let's see if '$startsh' works..." cat >try <<EOSS $startsh set abc test "$?abc" != 1 EOSS chmod 755 try $eunicefix try if try; then echo "Yup, it does." else echo "Nope. You may have to fix up the shell scripts to make sure sh runs them." fi rm -f try today : find out where common programs are echo " " echo "Locating common programs..." pth="/usr/ucb /bin /usr/bin /usr/local /usr/local/bin /usr/lbin /etc /usr/lib" cat <<EOSC >loc $startsh thing=\$1 shift dflt=\$1 shift for dir in \$*; do case "\$thing" in .) if test -d \$dir/\$thing; then echo \$dir exit 0 fi ;; *) if test -f \$dir/\$thing; then echo \$dir/\$thing exit 0 fi ;; esac done echo \$dflt exit 1 EOSC chmod 755 loc $eunicefix loc loclist=" expr sed echo cat rm grep " trylist=" test Mcc " for file in $loclist; do xxx=`loc $file $file $pth` eval $file=$xxx case "$xxx" in /*) echo $file is in $xxx. ;; *) echo "I don't know where $file is. I hope it's in everyone's PATH." ;; esac done echo " " echo "Don't worry if any of the following aren't found..." ans=offhand for file in $trylist; do xxx=`loc $file $file $pth` eval $file=$xxx case "$xxx" in /*) echo $file is in $xxx. ;; *) echo "I don't see $file out there, $ans." ans=either ;; esac done case "$egrep" in egrep) echo "Substituting grep for egrep." egrep=$grep ;; esac case "$test" in test) echo "Hopefully test is built into your sh." ;; /bin/test) echo " " echo $n 'Is your "test" built into sh? [n] (OK to guess) '"$c" rp='test built into sh? [n]' . myread case "$ans" in y*) test=test ;; esac ;; *) test=test ;; esac case "$echo" in echo) echo "Hopefully echo is built into your sh." ;; /bin/echo) echo " " echo "Checking compatibility between /bin/echo and builtin echo (if any)..." $echo $n "hi there$c" >foo1 echo $n "hi there$c" >foo2 if cmp foo1 foo2 >/dev/null 2>&1; then echo "They are compatible. In fact, they may be identical." else echo "They are not compatible--the echo builtin will be used." echo=echo fi $rm -f foo1 foo2 ;; *) echo=echo ;; esac : index or strcpy $echo " " if $contains index libc.list >/dev/null 2>&1 ; then $echo "Your system appears to use index() and rindex() rather than strchr()" $echo $n "and strrchr(). Is this correct? [y] $c" rp='index() rather than strchr()? [y]' . myread case "$ans" in n*|f*) d_index="$define" ;; *) d_index="$undef" ;; esac else $echo "Your system appears to use strchr() and strrchr() rather than index()" $echo $n "and rindex(). Is this correct? [y] $c" rp='strchr() rather than index()? [y]' . myread case "$ans" in n*|f*) d_index="$undef" ;; *) d_index="$define" ;; esac fi : check for void type $echo " " $echo "Checking to see if your C compiler groks the void type..." $cat >try.c <<'EOCP' void main(); EOCP if cc -c try.c >/dev/null 2>&1 ; then d_void="$undef" $echo "Yup, it does." else d_void="$define" $echo "Nope, it doesn't (boo hiss). I will substitute int." fi $rm -f try.* : see how we invoke the C preprocessor echo " " echo "Checking to see how your C preprocessor is invoked..." cat <<'EOT' >testcpp.c #define ABC abc #define XYZ xyz ABC.XYZ EOT echo 'Maybe "cc -E" will work...' cc -E testcpp.c >testcpp.out 2>&1 if $contains 'abc.xyz' testcpp.out >/dev/null 2>&1 ; then echo "Yup, it does." cpp='cc -E' else echo 'Nope...maybe "cc -P" will work...' cc -P testcpp.c >testcpp.out 2>&1 if $contains 'abc.xyz' testcpp.out >/dev/null 2>&1 ; then echo "Yup, that does." cpp='cc -P' else echo 'Nixed again...maybe "/lib/cpp" will work...' /lib/cpp testcpp.c >testcpp.out 2>&1 if $contains 'abc.xyz' testcpp.out >/dev/null 2>&1 ; then echo "Hooray, it works! I was beginning to wonder." cpp='/lib/cpp' else echo 'Hmm...maybe you already told me...' case "$cpp" in '') ;; *) $cpp testcpp.c >testcpp.ou component. */ X if (chdir(p) < 0 && mkdir(p, 0777) < 0 && chdir(p) < 0) X Quit("Cannot chdir nor mkdir desired directory"); X } X else X cwd[0] = '\0'; X X /* No buffering. */ X (void)setbuf(stdout, (char *)NULL); X (void)setbuf(stderr, (char *)NULL); X X if (*av) X /* Process filenames from command line. */ X for (; *av; av++) { X if (cwd[0] && av[0][0] != '/') { X (void)sprintf(buff, "%s/%s", cwd, *av); X *av = buff; X } X if ((Stream = fopen(*av, "r")) == NULL) X Fprintf(stderr, "unshar: Can't open file '%s'.\n", *av); X else { X Unshar(*av, HdrFile, Stream, Saveit, Forced); X (void)fclose(Stream); X } X } X else X /* Do standard input. */ X Unshar((char *)NULL, HdrFile, stdin, Saveit, Forced); X X /* That's all she wrote. */ X exit(0); X} SHAR_EOF if test 8368 -ne "`wc -c < 'unshar.c'`" then echo shar: error transmitting "'unshar.c'" '(should have been 8368 characters)' fi fi # end of overwriting check echo shar: extracting "'unshar.man'" '(2326 characters)' if test -f 'unshar.man' then echo shar: will not over-write existing file "'unshar.man'" else sed 's/^X//' << \SHAR_EOF > 'unshar.man' X.TH UNSHAR 1l X.\" $Header: unshar.man,v 2.0 88/05/27 13:29:02 rsalz Exp $ X.SH NAME Xunshar \- unpack shell archives from news, mail, notes, etc. X.SH SYNOPSIS X.B unshar X[ X.BI \-c\| directory X] [ X.BI \-d\| directory X] [ X.BI \-h\| file X] [ X.B \-f X] [ X.B \-n X] [ X.B \-s X] [ file... ] X.SH DESCRIPTION X.I Unshar Xremoves mail and news header lines from its input, and feeds the remainder Xto X.IR /bin/sh (1) Xso that a shell archive can be properly unpacked. XIf no files are specified, X.I unshar Xreads from standard input. XThe program is designed to be useful when unpacking archives directly Xfrom the news or mail systems (e.g., s | unshar). X.PP X.I Unshar Xnormally unpacks its files in the current directory. XUse the ``\-c'' option to have the program change to a new directory Xbefore invoking the shell. XIf the directory does not exist, it will try to create it. XIf the directory name starts with a question mark, then X.I unshar Xwill ask for t⇨غך ÄQ⇧Ç0 ÉI≡①ij⇧ ±æ⇧⓪ æ ±0 @① ±ij⓪@0p@①✓ ≡0p@ë≡@ë≡ ÅB◆PC+3½`Rב†KúA⇨úC)⇨+søKô{sk+sí⇨ø♪ôK♪③c)⇩¬rÜB Æ*"JæpRאK1⇨úC)⇨#Kô+ú{ôח⇨s♪k)⇨¢ú♪ôúÖ⇨†KúA⇨ ⇨úKc#)a⇨úC+q⇨úC)⇨ø♪c½)⇨{1⇨úC)⇩Bzj(Rב+søKô{sk+sí⇨ø♪ôK♪③c)⇨KÖ⇨Ks¢+ôú+!⇨Kq⇨âc♪)⇨{1⇨úC♪í⇨C♪ô♪ú+æpRא3{æ⇨{sø+sK+s)a⇨úC)⇨⇨⇩βk!99⇨{âúK{q⇨KÖ⇨ ⇨¢יs{sיi⇨3{æ⇨úC)⇨⇨⇩βk⑨99⇨{âúK{qpRIJréÇRIJrI⇩½s¢C♪ÉRבs{ôk♪ccח⇨{kâc♪KsÖ⇨K1⇨úC)⇨Ksâ½í⇨c{{[Ö⇨cK[)⇨¢{k+úCKs9⇨{úC+æ⇨úC♪q⇨ ⇨¢C♪æ⇨3Kc)pRIJB♪k{s9⇨ther things, it checks for files that resemble C, and Pascal code). XIt can be fooled, however, by nonstandard versions of news, notes, etc. XThe ``\-f'' option forces X.I unshar Xto try unpacking files, even if they look like something else. X.PP XDepending on how the program is installed, X.I unshar Xmay or may not try to preserve the header part of file ``foo'' Xinto the name ``foo.hdr'' (if the file is standard input, the name XwilqנîêOÅÅÇ⓪ä③ß⇦ijôÖäזHB@≡âÇ⇦⇩ êOüâêOÅÅüij⇦HHOÇ◆üé נêÇ⇦î✓⇦OüâêOçäÇ✓⇦Ä OüÇOä