| 1 | #! /bin/sh |
|---|
| 2 | # |
|---|
| 3 | # If these # comments don't work, trim them. Don't worry about any other |
|---|
| 4 | # shell scripts, Configure will trim # comments from them for you. |
|---|
| 5 | # |
|---|
| 6 | # (If you are trying to port this package to a machine without sh, |
|---|
| 7 | # I would suggest you have a look at the prototypical config_h.SH file |
|---|
| 8 | # and edit it to reflect your system. Some packages may include samples |
|---|
| 9 | # of config.h for certain machines, so you might look for one of those.) |
|---|
| 10 | # |
|---|
| 11 | # Yes, you may rip this off to use in other distribution packages. This |
|---|
| 12 | # script belongs to the public domain and cannot be copyrighted. |
|---|
| 13 | # |
|---|
| 14 | # (Note: this Configure script was generated automatically. Rather than |
|---|
| 15 | # working with this copy of Configure, you may wish to get metaconfig. |
|---|
| 16 | # The dist-3.0 package (which contains metaconfig) was posted in |
|---|
| 17 | # comp.sources.misc so you may fetch it yourself from your nearest |
|---|
| 18 | # archive site. Check with Archie if you don't know where that can be.) |
|---|
| 19 | # |
|---|
| 20 | |
|---|
| 21 | # $Id: Configure,v 1.32 1996/01/15 21:47:07 dunemush Exp dunemush $ |
|---|
| 22 | # |
|---|
| 23 | # Generated on Mon Jan 15 12:29:47 PST 1996 [metaconfig 3.0 PL58] |
|---|
| 24 | |
|---|
| 25 | cat >/tmp/c1$$ <<EOF |
|---|
| 26 | ARGGGHHHH!!!!! |
|---|
| 27 | |
|---|
| 28 | SCO csh still thinks true is false. Write to SCO today and tell them that next |
|---|
| 29 | year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-) |
|---|
| 30 | |
|---|
| 31 | (Actually, Configure ought to just patch csh in place. Hmm. Hmmmmm. All |
|---|
| 32 | we'd have to do is go in and swap the && and || tokens, wherever they are.) |
|---|
| 33 | |
|---|
| 34 | [End of diatribe. We now return you to your regularly scheduled programming...] |
|---|
| 35 | EOF |
|---|
| 36 | cat >/tmp/c2$$ <<EOF |
|---|
| 37 | |
|---|
| 38 | OOPS! You naughty creature! You didn't run Configure with sh! |
|---|
| 39 | I will attempt to remedy the situation by running sh for you... |
|---|
| 40 | EOF |
|---|
| 41 | |
|---|
| 42 | true || cat /tmp/c1$$ /tmp/c2$$ |
|---|
| 43 | true || exec sh $0 $argv:q |
|---|
| 44 | |
|---|
| 45 | (exit $?0) || cat /tmp/c2$$ |
|---|
| 46 | (exit $?0) || exec sh $0 $argv:q |
|---|
| 47 | rm -f /tmp/c1$$ /tmp/c2$$ |
|---|
| 48 | |
|---|
| 49 | : compute my invocation name |
|---|
| 50 | me=$0 |
|---|
| 51 | case "$0" in |
|---|
| 52 | */*) |
|---|
| 53 | me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null` |
|---|
| 54 | test "$me" || me=$0 |
|---|
| 55 | ;; |
|---|
| 56 | esac |
|---|
| 57 | |
|---|
| 58 | : Proper PATH separator |
|---|
| 59 | p_=: |
|---|
| 60 | : On OS/2 this directory should exist if this is not floppy only system :-] |
|---|
| 61 | if test -d c:/.; then |
|---|
| 62 | p_=\; |
|---|
| 63 | PATH=`cmd /c "echo %PATH%" | tr '\\\\' / ` |
|---|
| 64 | OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'` |
|---|
| 65 | fi |
|---|
| 66 | |
|---|
| 67 | : Proper PATH setting |
|---|
| 68 | paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin' |
|---|
| 69 | paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin" |
|---|
| 70 | paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin" |
|---|
| 71 | paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin" |
|---|
| 72 | paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb" |
|---|
| 73 | paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin" |
|---|
| 74 | paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib" |
|---|
| 75 | paths="$paths /sbin /usr/sbin /usr/libexec" |
|---|
| 76 | |
|---|
| 77 | for p in $paths |
|---|
| 78 | do |
|---|
| 79 | case "$p_$PATH$p_" in |
|---|
| 80 | *$p_$p$p_*) ;; |
|---|
| 81 | *) test -d $p && PATH=$PATH$p_$p ;; |
|---|
| 82 | esac |
|---|
| 83 | done |
|---|
| 84 | |
|---|
| 85 | PATH=.$p_$PATH |
|---|
| 86 | export PATH |
|---|
| 87 | |
|---|
| 88 | : Sanity checks |
|---|
| 89 | if test ! -t 0; then |
|---|
| 90 | echo "Say 'sh $me', not 'sh <$me'" |
|---|
| 91 | exit 1 |
|---|
| 92 | fi |
|---|
| 93 | |
|---|
| 94 | : On HP-UX, large Configure scripts may exercise a bug in /bin/sh |
|---|
| 95 | if test -f /hp-ux -a -f /bin/ksh; then |
|---|
| 96 | if (PATH=.; alias -x) >/dev/null 2>&1; then |
|---|
| 97 | : already under /bin/ksh |
|---|
| 98 | else |
|---|
| 99 | cat <<'EOM' |
|---|
| 100 | (Feeding myself to ksh to avoid nasty sh bug in "here document" expansion.) |
|---|
| 101 | EOM |
|---|
| 102 | unset ENV |
|---|
| 103 | exec /bin/ksh $0 "$@" |
|---|
| 104 | fi |
|---|
| 105 | else |
|---|
| 106 | : Warn them if they use ksh on other systems |
|---|
| 107 | (PATH=.; alias -x) >/dev/null 2>&1 && \ |
|---|
| 108 | cat <<EOM |
|---|
| 109 | (I see you are using the Korn shell. Some ksh's blow up on $me, |
|---|
| 110 | especially on exotic machines. If yours does, try the Bourne shell instead.) |
|---|
| 111 | EOM |
|---|
| 112 | fi |
|---|
| 113 | |
|---|
| 114 | : Configure runs within the UU subdirectory |
|---|
| 115 | test -d UU || mkdir UU |
|---|
| 116 | cd UU && rm -f ./* |
|---|
| 117 | |
|---|
| 118 | d_bsd='' |
|---|
| 119 | d_eunice='' |
|---|
| 120 | d_xenix='' |
|---|
| 121 | eunicefix='' |
|---|
| 122 | Mcc='' |
|---|
| 123 | awk='' |
|---|
| 124 | bash='' |
|---|
| 125 | bison='' |
|---|
| 126 | byacc='' |
|---|
| 127 | cat='' |
|---|
| 128 | chgrp='' |
|---|
| 129 | chmod='' |
|---|
| 130 | chown='' |
|---|
| 131 | comm='' |
|---|
| 132 | compress='' |
|---|
| 133 | cp='' |
|---|
| 134 | cpio='' |
|---|
| 135 | cpp='' |
|---|
| 136 | csh='' |
|---|
| 137 | date='' |
|---|
| 138 | echo='' |
|---|
| 139 | egrep='' |
|---|
| 140 | emacs='' |
|---|
| 141 | expr='' |
|---|
| 142 | find='' |
|---|
| 143 | flex='' |
|---|
| 144 | gcc='' |
|---|
| 145 | grep='' |
|---|
| 146 | inews='' |
|---|
| 147 | ksh='' |
|---|
| 148 | less='' |
|---|
| 149 | line='' |
|---|
| 150 | lint='' |
|---|
| 151 | ln='' |
|---|
| 152 | lp='' |
|---|
| 153 | lpr='' |
|---|
| 154 | ls='' |
|---|
| 155 | mail='' |
|---|
| 156 | mailx='' |
|---|
| 157 | make='' |
|---|
| 158 | mkdir='' |
|---|
| 159 | more='' |
|---|
| 160 | mv='' |
|---|
| 161 | nroff='' |
|---|
| 162 | perl='' |
|---|
| 163 | pg='' |
|---|
| 164 | pmake='' |
|---|
| 165 | pr='' |
|---|
| 166 | rm='' |
|---|
| 167 | rmail='' |
|---|
| 168 | sed='' |
|---|
| 169 | sendmail='' |
|---|
| 170 | sh='' |
|---|
| 171 | shar='' |
|---|
| 172 | sleep='' |
|---|
| 173 | smail='' |
|---|
| 174 | sort='' |
|---|
| 175 | submit='' |
|---|
| 176 | tail='' |
|---|
| 177 | tar='' |
|---|
| 178 | tbl='' |
|---|
| 179 | test='' |
|---|
| 180 | touch='' |
|---|
| 181 | tr='' |
|---|
| 182 | troff='' |
|---|
| 183 | uname='' |
|---|
| 184 | uniq='' |
|---|
| 185 | uptime='' |
|---|
| 186 | uuname='' |
|---|
| 187 | vi='' |
|---|
| 188 | zcat='' |
|---|
| 189 | hint='' |
|---|
| 190 | myuname='' |
|---|
| 191 | osname='' |
|---|
| 192 | osvers='' |
|---|
| 193 | Author='' |
|---|
| 194 | Date='' |
|---|
| 195 | Header='' |
|---|
| 196 | Id='' |
|---|
| 197 | Locker='' |
|---|
| 198 | Log='' |
|---|
| 199 | RCSfile='' |
|---|
| 200 | Revision='' |
|---|
| 201 | Source='' |
|---|
| 202 | State='' |
|---|
| 203 | cc='' |
|---|
| 204 | gccversion='' |
|---|
| 205 | ccflags='' |
|---|
| 206 | cppflags='' |
|---|
| 207 | ldflags='' |
|---|
| 208 | lkflags='' |
|---|
| 209 | optimize='' |
|---|
| 210 | cf_email='' |
|---|
| 211 | cf_by='' |
|---|
| 212 | cf_time='' |
|---|
| 213 | contains='' |
|---|
| 214 | cpplast='' |
|---|
| 215 | cppminus='' |
|---|
| 216 | cpprun='' |
|---|
| 217 | cppstdin='' |
|---|
| 218 | d_gettblsz='' |
|---|
| 219 | nofile='' |
|---|
| 220 | tablesize='' |
|---|
| 221 | d_bcopy='' |
|---|
| 222 | d_bzero='' |
|---|
| 223 | d_const='' |
|---|
| 224 | cryptlib='' |
|---|
| 225 | d_crypt='' |
|---|
| 226 | d_ieee='' |
|---|
| 227 | d_keepsig='' |
|---|
| 228 | d_memcpy='' |
|---|
| 229 | d_memset='' |
|---|
| 230 | d_newstyle='' |
|---|
| 231 | d_open3='' |
|---|
| 232 | d_portable='' |
|---|
| 233 | d_lrand48='' |
|---|
| 234 | d_rand='' |
|---|
| 235 | d_random='' |
|---|
| 236 | d_rlimit='' |
|---|
| 237 | d_rusage='' |
|---|
| 238 | d_sigaction='' |
|---|
| 239 | d_sigintrp='' |
|---|
| 240 | d_sigvec='' |
|---|
| 241 | d_sigvectr='' |
|---|
| 242 | d_strccmp='' |
|---|
| 243 | d_index='' |
|---|
| 244 | d_strchr='' |
|---|
| 245 | d_strdup='' |
|---|
| 246 | d_sysconf='' |
|---|
| 247 | d_timelocal='' |
|---|
| 248 | d_toupper='' |
|---|
| 249 | d_uptime='' |
|---|
| 250 | d_uwait3='' |
|---|
| 251 | d_uwait='' |
|---|
| 252 | d_voidsig='' |
|---|
| 253 | signal_t='' |
|---|
| 254 | d_volatile='' |
|---|
| 255 | d_waitpid='' |
|---|
| 256 | d_intfree='' |
|---|
| 257 | freetype='' |
|---|
| 258 | h_fcntl='' |
|---|
| 259 | h_sysfile='' |
|---|
| 260 | i_limits='' |
|---|
| 261 | i_memory='' |
|---|
| 262 | i_stdlib='' |
|---|
| 263 | i_string='' |
|---|
| 264 | strings='' |
|---|
| 265 | i_sysresrc='' |
|---|
| 266 | i_sysselct='' |
|---|
| 267 | i_systypes='' |
|---|
| 268 | i_sysvlimit='' |
|---|
| 269 | i_syswait='' |
|---|
| 270 | i_systime='' |
|---|
| 271 | i_systimek='' |
|---|
| 272 | i_time='' |
|---|
| 273 | timeincl='' |
|---|
| 274 | i_unistd='' |
|---|
| 275 | i_stdarg='' |
|---|
| 276 | i_varargs='' |
|---|
| 277 | i_varhdr='' |
|---|
| 278 | libc='' |
|---|
| 279 | glibpth='' |
|---|
| 280 | libpth='' |
|---|
| 281 | plibpth='' |
|---|
| 282 | xlibpth='' |
|---|
| 283 | libs='' |
|---|
| 284 | lns='' |
|---|
| 285 | mailer='' |
|---|
| 286 | d_mymalloc='' |
|---|
| 287 | mallocobj='' |
|---|
| 288 | mallocsrc='' |
|---|
| 289 | malloctype='' |
|---|
| 290 | usemymalloc='' |
|---|
| 291 | mydomain='' |
|---|
| 292 | myhostname='' |
|---|
| 293 | phostname='' |
|---|
| 294 | c='' |
|---|
| 295 | n='' |
|---|
| 296 | d_berknames='' |
|---|
| 297 | d_passnames='' |
|---|
| 298 | d_usgnames='' |
|---|
| 299 | nametype='' |
|---|
| 300 | groupcat='' |
|---|
| 301 | hostcat='' |
|---|
| 302 | passcat='' |
|---|
| 303 | package='' |
|---|
| 304 | spackage='' |
|---|
| 305 | prototype='' |
|---|
| 306 | sizetype='' |
|---|
| 307 | so='' |
|---|
| 308 | sharpbang='' |
|---|
| 309 | shsharp='' |
|---|
| 310 | spitshell='' |
|---|
| 311 | startsh='' |
|---|
| 312 | sysman='' |
|---|
| 313 | nm_opt='' |
|---|
| 314 | runnm='' |
|---|
| 315 | usenm='' |
|---|
| 316 | incpath='' |
|---|
| 317 | mips='' |
|---|
| 318 | mips_type='' |
|---|
| 319 | usrinc='' |
|---|
| 320 | defvoidused='' |
|---|
| 321 | voidflags='' |
|---|
| 322 | CONFIG='' |
|---|
| 323 | |
|---|
| 324 | define='define' |
|---|
| 325 | undef='undef' |
|---|
| 326 | smallmach='pdp11 i8086 z8000 i80286 iAPX286' |
|---|
| 327 | rmlist='' |
|---|
| 328 | |
|---|
| 329 | : We must find out about Eunice early |
|---|
| 330 | eunicefix=':' |
|---|
| 331 | if test -f /etc/unixtovms; then |
|---|
| 332 | eunicefix=/etc/unixtovms |
|---|
| 333 | fi |
|---|
| 334 | if test -f /etc/unixtovms.exe; then |
|---|
| 335 | eunicefix=/etc/unixtovms.exe |
|---|
| 336 | fi |
|---|
| 337 | |
|---|
| 338 | gccversion='' |
|---|
| 339 | : change the next line if compiling for Xenix/286 on Xenix/386 |
|---|
| 340 | xlibpth='/usr/lib/386 /lib/386' |
|---|
| 341 | |
|---|
| 342 | : general looking path for locating libraries |
|---|
| 343 | glibpth="/lib/pa1.1 /usr/lib/large /lib /usr/lib $xlibpth" |
|---|
| 344 | glibpth="$glibpth /lib/large /usr/lib/small /lib/small" |
|---|
| 345 | glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib /usr/shlib" |
|---|
| 346 | |
|---|
| 347 | : Private path used by Configure to find libraries. Its value |
|---|
| 348 | : is prepended to libpth. This variable takes care of special |
|---|
| 349 | : machines, like the mips. Usually, it should be empty. |
|---|
| 350 | plibpth='' |
|---|
| 351 | |
|---|
| 352 | : default library list |
|---|
| 353 | libswanted='' |
|---|
| 354 | large='' |
|---|
| 355 | : full support for void wanted by default |
|---|
| 356 | defvoidused=15 |
|---|
| 357 | |
|---|
| 358 | : no include file wanted by default |
|---|
| 359 | inclwanted='' |
|---|
| 360 | |
|---|
| 361 | defvoidused=15 |
|---|
| 362 | libswanted='m c' |
|---|
| 363 | : script used to extract .SH files with variable substitutions |
|---|
| 364 | cat >extract <<'EOS' |
|---|
| 365 | CONFIG=true |
|---|
| 366 | echo "Doing variable substitutions on .SH files..." |
|---|
| 367 | if test -f MANIFEST; then |
|---|
| 368 | set x `awk '{print $1}' <MANIFEST | grep '\.SH'` |
|---|
| 369 | else |
|---|
| 370 | echo "(Looking for .SH files under the current directory.)" |
|---|
| 371 | set x `find . -name "*.SH" -print` |
|---|
| 372 | fi |
|---|
| 373 | shift |
|---|
| 374 | case $# in |
|---|
| 375 | 0) set x *.SH; shift;; |
|---|
| 376 | esac |
|---|
| 377 | if test ! -f $1; then |
|---|
| 378 | shift |
|---|
| 379 | fi |
|---|
| 380 | for file in $*; do |
|---|
| 381 | case "$file" in |
|---|
| 382 | */*) |
|---|
| 383 | dir=`expr X$file : 'X\(.*\)/'` |
|---|
| 384 | file=`expr X$file : 'X.*/\(.*\)'` |
|---|
| 385 | (cd $dir && . ./$file) |
|---|
| 386 | ;; |
|---|
| 387 | *) |
|---|
| 388 | . ./$file |
|---|
| 389 | ;; |
|---|
| 390 | esac |
|---|
| 391 | done |
|---|
| 392 | if test -f config_h.SH; then |
|---|
| 393 | if test ! -f config.h; then |
|---|
| 394 | : oops, they left it out of MANIFEST, probably, so do it anyway. |
|---|
| 395 | . ./config_h.SH |
|---|
| 396 | fi |
|---|
| 397 | fi |
|---|
| 398 | EOS |
|---|
| 399 | |
|---|
| 400 | : produce awk script to parse command line options |
|---|
| 401 | cat >options.awk <<'EOF' |
|---|
| 402 | BEGIN { |
|---|
| 403 | optstr = "dD:eEf:hKOrsSU:V"; # getopt-style specification |
|---|
| 404 | |
|---|
| 405 | len = length(optstr); |
|---|
| 406 | for (i = 1; i <= len; i++) { |
|---|
| 407 | c = substr(optstr, i, 1); |
|---|
| 408 | if (i < len) a = substr(optstr, i + 1, 1); else a = ""; |
|---|
| 409 | if (a == ":") { |
|---|
| 410 | arg[c] = 1; |
|---|
| 411 | i++; |
|---|
| 412 | } |
|---|
| 413 | opt[c] = 1; |
|---|
| 414 | } |
|---|
| 415 | } |
|---|
| 416 | { |
|---|
| 417 | expect = 0; |
|---|
| 418 | str = $0; |
|---|
| 419 | if (substr(str, 1, 1) != "-") { |
|---|
| 420 | printf("'%s'\n", str); |
|---|
| 421 | next; |
|---|
| 422 | } |
|---|
| 423 | len = length($0); |
|---|
| 424 | for (i = 2; i <= len; i++) { |
|---|
| 425 | c = substr(str, i, 1); |
|---|
| 426 | if (!opt[c]) { |
|---|
| 427 | printf("-%s\n", substr(str, i)); |
|---|
| 428 | next; |
|---|
| 429 | } |
|---|
| 430 | printf("-%s\n", c); |
|---|
| 431 | if (arg[c]) { |
|---|
| 432 | if (i < len) |
|---|
| 433 | printf("'%s'\n", substr(str, i + 1)); |
|---|
| 434 | else |
|---|
| 435 | expect = 1; |
|---|
| 436 | next; |
|---|
| 437 | } |
|---|
| 438 | } |
|---|
| 439 | } |
|---|
| 440 | END { |
|---|
| 441 | if (expect) |
|---|
| 442 | print "?"; |
|---|
| 443 | } |
|---|
| 444 | EOF |
|---|
| 445 | |
|---|
| 446 | : process the command line options |
|---|
| 447 | set X `for arg in "$@"; do echo $arg; done | awk -f options.awk` |
|---|
| 448 | eval "set $*" |
|---|
| 449 | shift |
|---|
| 450 | rm -f options.awk |
|---|
| 451 | |
|---|
| 452 | : set up default values |
|---|
| 453 | fastread='' |
|---|
| 454 | reuseval=false |
|---|
| 455 | config_sh='' |
|---|
| 456 | alldone='' |
|---|
| 457 | error='' |
|---|
| 458 | silent='' |
|---|
| 459 | extractsh='' |
|---|
| 460 | override='' |
|---|
| 461 | knowitall='' |
|---|
| 462 | rm -f optdef.sh |
|---|
| 463 | |
|---|
| 464 | : option parsing |
|---|
| 465 | while test $# -gt 0; do |
|---|
| 466 | case "$1" in |
|---|
| 467 | -d) shift; fastread=yes;; |
|---|
| 468 | -e) shift; alldone=cont;; |
|---|
| 469 | -f) |
|---|
| 470 | shift |
|---|
| 471 | cd .. |
|---|
| 472 | if test -r "$1"; then |
|---|
| 473 | config_sh="$1" |
|---|
| 474 | else |
|---|
| 475 | echo "$me: cannot read config file $1." >&2 |
|---|
| 476 | error=true |
|---|
| 477 | fi |
|---|
| 478 | cd UU |
|---|
| 479 | shift;; |
|---|
| 480 | -h) shift; error=true;; |
|---|
| 481 | -r) shift; reuseval=true;; |
|---|
| 482 | -s) shift; silent=true;; |
|---|
| 483 | -E) shift; alldone=exit;; |
|---|
| 484 | -K) shift; knowitall=true;; |
|---|
| 485 | -O) shift; override=true;; |
|---|
| 486 | -S) shift; extractsh=true;; |
|---|
| 487 | -D) |
|---|
| 488 | shift |
|---|
| 489 | case "$1" in |
|---|
| 490 | *=) |
|---|
| 491 | echo "$me: use '-U symbol=', not '-D symbol='." >&2 |
|---|
| 492 | echo "$me: ignoring -D $1" >&2 |
|---|
| 493 | ;; |
|---|
| 494 | *=*) echo "$1" | \ |
|---|
| 495 | sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;; |
|---|
| 496 | *) echo "$1='define'" >> optdef.sh;; |
|---|
| 497 | esac |
|---|
| 498 | shift |
|---|
| 499 | ;; |
|---|
| 500 | -U) |
|---|
| 501 | shift |
|---|
| 502 | case "$1" in |
|---|
| 503 | *=) echo "$1" >> optdef.sh;; |
|---|
| 504 | *=*) |
|---|
| 505 | echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2 |
|---|
| 506 | echo "$me: ignoring -U $1" >&2 |
|---|
| 507 | ;; |
|---|
| 508 | *) echo "$1='undef'" >> optdef.sh;; |
|---|
| 509 | esac |
|---|
| 510 | shift |
|---|
| 511 | ;; |
|---|
| 512 | -V) echo "$me generated by metaconfig 3.0 PL58." >&2 |
|---|
| 513 | exit 0;; |
|---|
| 514 | --) break;; |
|---|
| 515 | -*) echo "$me: unknown option $1" >&2; shift; error=true;; |
|---|
| 516 | *) break;; |
|---|
| 517 | esac |
|---|
| 518 | done |
|---|
| 519 | |
|---|
| 520 | case "$error" in |
|---|
| 521 | true) |
|---|
| 522 | cat >&2 <<EOM |
|---|
| 523 | Usage: $me [-dehrEKOSV] [-f config.sh] [-D symbol] [-D symbol=value] |
|---|
| 524 | [-U symbol] [-U symbol=] |
|---|
| 525 | -d : use defaults for all answers. |
|---|
| 526 | -e : go on without questioning past the production of config.sh. |
|---|
| 527 | -f : specify an alternate default configuration file. |
|---|
| 528 | -h : print this help message and exit (with an error status). |
|---|
| 529 | -r : reuse C symbols value if possible (skips costly nm extraction). |
|---|
| 530 | -s : silent mode, only echoes questions and essential information. |
|---|
| 531 | -D : define symbol to have some value: |
|---|
| 532 | -D symbol symbol gets the value 'define' |
|---|
| 533 | -D symbol=value symbol gets the value 'value' |
|---|
| 534 | -E : stop at the end of questions, after having produced config.sh. |
|---|
| 535 | -K : do not use unless you know what you are doing. |
|---|
| 536 | -O : let -D and -U override definitions from loaded configuration file. |
|---|
| 537 | -S : perform variable substitutions on all .SH files (can mix with -f) |
|---|
| 538 | -U : undefine symbol: |
|---|
| 539 | -U symbol symbol gets the value 'undef' |
|---|
| 540 | -U symbol= symbol gets completely empty |
|---|
| 541 | -V : print version number and exit (with a zero status). |
|---|
| 542 | EOM |
|---|
| 543 | exit 1 |
|---|
| 544 | ;; |
|---|
| 545 | esac |
|---|
| 546 | |
|---|
| 547 | exec 4>&1 |
|---|
| 548 | case "$silent" in |
|---|
| 549 | true) exec 1>/dev/null;; |
|---|
| 550 | esac |
|---|
| 551 | |
|---|
| 552 | : run the defines and the undefines, if any, but leave the file out there... |
|---|
| 553 | touch optdef.sh |
|---|
| 554 | . ./optdef.sh |
|---|
| 555 | |
|---|
| 556 | case "$extractsh" in |
|---|
| 557 | true) |
|---|
| 558 | case "$config_sh" in |
|---|
| 559 | '') config_sh='config.sh'; config='./config.sh';; |
|---|
| 560 | /*) config="$config_sh";; |
|---|
| 561 | *) config="./$config_sh";; |
|---|
| 562 | esac |
|---|
| 563 | echo " " |
|---|
| 564 | echo "Fetching answers from $config_sh..." |
|---|
| 565 | cd .. |
|---|
| 566 | . $config |
|---|
| 567 | test "$override" && . ./optdef.sh |
|---|
| 568 | echo " " |
|---|
| 569 | . ./UU/extract |
|---|
| 570 | rm -rf UU |
|---|
| 571 | echo "Done." |
|---|
| 572 | exit 0 |
|---|
| 573 | ;; |
|---|
| 574 | esac |
|---|
| 575 | |
|---|
| 576 | : set package name |
|---|
| 577 | package=pennmush |
|---|
| 578 | |
|---|
| 579 | : Eunice requires " " instead of "", can you believe it |
|---|
| 580 | echo " " |
|---|
| 581 | : Here we go... |
|---|
| 582 | echo "Beginning of configuration questions for $package." |
|---|
| 583 | |
|---|
| 584 | trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15 |
|---|
| 585 | |
|---|
| 586 | : Some greps do not return status, grrr. |
|---|
| 587 | echo "grimblepritz" >grimble |
|---|
| 588 | if grep blurfldyick grimble >/dev/null 2>&1 ; then |
|---|
| 589 | contains=contains |
|---|
| 590 | elif grep grimblepritz grimble >/dev/null 2>&1 ; then |
|---|
| 591 | contains=grep |
|---|
| 592 | else |
|---|
| 593 | contains=contains |
|---|
| 594 | fi |
|---|
| 595 | rm -f grimble |
|---|
| 596 | : the following should work in any shell |
|---|
| 597 | case "$contains" in |
|---|
| 598 | contains*) |
|---|
| 599 | echo " " |
|---|
| 600 | echo "AGH! Grep doesn't return a status. Attempting remedial action." |
|---|
| 601 | cat >contains <<'EOSS' |
|---|
| 602 | grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp |
|---|
| 603 | EOSS |
|---|
| 604 | chmod +x contains |
|---|
| 605 | esac |
|---|
| 606 | |
|---|
| 607 | : first determine how to suppress newline on echo command |
|---|
| 608 | echo " " |
|---|
| 609 | echo "Checking echo to see how to suppress newlines..." |
|---|
| 610 | (echo "hi there\c" ; echo " ") >.echotmp |
|---|
| 611 | if $contains c .echotmp >/dev/null 2>&1 ; then |
|---|
| 612 | echo "...using -n." |
|---|
| 613 | n='-n' |
|---|
| 614 | c='' |
|---|
| 615 | else |
|---|
| 616 | cat <<'EOM' |
|---|
| 617 | ...using \c |
|---|
| 618 | EOM |
|---|
| 619 | n='' |
|---|
| 620 | c='\c' |
|---|
| 621 | fi |
|---|
| 622 | echo $n "The star should be here-->$c" |
|---|
| 623 | echo '*' |
|---|
| 624 | rm -f .echotmp |
|---|
| 625 | |
|---|
| 626 | : compute the number of columns on the terminal for proper question formatting |
|---|
| 627 | case "$COLUMNS" in |
|---|
| 628 | '') COLUMNS='80';; |
|---|
| 629 | esac |
|---|
| 630 | |
|---|
| 631 | : set up the echo used in my read |
|---|
| 632 | myecho="case \"\$xxxm\" in |
|---|
| 633 | '') echo $n \"\$rp $c\" >&4;; |
|---|
| 634 | *) case \"\$rp\" in |
|---|
| 635 | '') echo $n \"[\$xxxm] $c\";; |
|---|
| 636 | *) |
|---|
| 637 | if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then |
|---|
| 638 | echo \"\$rp\" >&4 |
|---|
| 639 | echo $n \"[\$xxxm] $c\" >&4 |
|---|
| 640 | else |
|---|
| 641 | echo $n \"\$rp [\$xxxm] $c\" >&4 |
|---|
| 642 | fi |
|---|
| 643 | ;; |
|---|
| 644 | esac;; |
|---|
| 645 | esac" |
|---|
| 646 | |
|---|
| 647 | : now set up to do reads with possible shell escape and default assignment |
|---|
| 648 | cat <<EOSC >myread |
|---|
| 649 | xxxm=\$dflt |
|---|
| 650 | $myecho |
|---|
| 651 | ans='!' |
|---|
| 652 | case "\$fastread" in |
|---|
| 653 | yes) case "\$dflt" in |
|---|
| 654 | '') ;; |
|---|
| 655 | *) ans=''; |
|---|
| 656 | case "\$silent-\$rp" in |
|---|
| 657 | true-) ;; |
|---|
| 658 | *) echo " " >&4;; |
|---|
| 659 | esac;; |
|---|
| 660 | esac;; |
|---|
| 661 | *) case "\$silent" in |
|---|
| 662 | true) case "\$rp" in |
|---|
| 663 | '') ans='';; |
|---|
| 664 | esac;; |
|---|
| 665 | esac;; |
|---|
| 666 | esac |
|---|
| 667 | while expr "X\$ans" : "X!" >/dev/null; do |
|---|
| 668 | read answ |
|---|
| 669 | set x \$xxxm |
|---|
| 670 | shift |
|---|
| 671 | aok=''; eval "ans=\"\$answ\"" && aok=y |
|---|
| 672 | case "\$answ" in |
|---|
| 673 | "\$ans") |
|---|
| 674 | case "\$ans" in |
|---|
| 675 | \\&*) |
|---|
| 676 | set x \`expr "X\$ans" : "X&\(.*\)\$"\` |
|---|
| 677 | shift |
|---|
| 678 | case "\$1" in |
|---|
| 679 | -d) |
|---|
| 680 | fastread=yes |
|---|
| 681 | echo "(OK, I'll run with -d after this question.)" |
|---|
| 682 | ;; |
|---|
| 683 | -*) |
|---|
| 684 | echo "*** Sorry, \$1 not supported yet." |
|---|
| 685 | ;; |
|---|
| 686 | esac |
|---|
| 687 | $myecho |
|---|
| 688 | ans=! |
|---|
| 689 | ;; |
|---|
| 690 | "!") |
|---|
| 691 | sh 1>&4 |
|---|
| 692 | echo " " |
|---|
| 693 | $myecho |
|---|
| 694 | ;; |
|---|
| 695 | !*) |
|---|
| 696 | set x \`expr "X\$ans" : "X!\(.*\)\$"\` |
|---|
| 697 | shift |
|---|
| 698 | sh 1>&4 -c "\$*" |
|---|
| 699 | echo " " |
|---|
| 700 | $myecho |
|---|
| 701 | ;; |
|---|
| 702 | esac;; |
|---|
| 703 | *) |
|---|
| 704 | case "\$aok" in |
|---|
| 705 | y) |
|---|
| 706 | echo "*** Substitution done -- please confirm." |
|---|
| 707 | xxxm="\$ans" |
|---|
| 708 | ans=\`echo $n "\$ans$c" | tr '\012' ' '\` |
|---|
| 709 | xxxm="\$ans" |
|---|
| 710 | ans=! |
|---|
| 711 | ;; |
|---|
| 712 | *) |
|---|
| 713 | echo "*** Error -- try again." |
|---|
| 714 | ans=! |
|---|
| 715 | ;; |
|---|
| 716 | esac |
|---|
| 717 | $myecho |
|---|
| 718 | ;; |
|---|
| 719 | esac |
|---|
| 720 | case "\$ans\$xxxm\$nostick" in |
|---|
| 721 | '') |
|---|
| 722 | ans=! |
|---|
| 723 | $myecho |
|---|
| 724 | ;; |
|---|
| 725 | esac |
|---|
| 726 | done |
|---|
| 727 | case "\$ans" in |
|---|
| 728 | '') ans="\$xxxm";; |
|---|
| 729 | esac |
|---|
| 730 | EOSC |
|---|
| 731 | |
|---|
| 732 | : create .config dir to save info across Configure sessions |
|---|
| 733 | test -d ../.config || mkdir ../.config |
|---|
| 734 | cat >../.config/README <<EOF |
|---|
| 735 | This directory created by Configure to save information that should |
|---|
| 736 | persist across sessions. |
|---|
| 737 | |
|---|
| 738 | You may safely delete it if you wish. |
|---|
| 739 | EOF |
|---|
| 740 | |
|---|
| 741 | : general instructions |
|---|
| 742 | needman=true |
|---|
| 743 | firsttime=true |
|---|
| 744 | user=`( (logname) 2>/dev/null || whoami) 2>&1` |
|---|
| 745 | if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then |
|---|
| 746 | firsttime=false |
|---|
| 747 | echo " " |
|---|
| 748 | rp='Would you like to see the instructions?' |
|---|
| 749 | dflt=n |
|---|
| 750 | . ./myread |
|---|
| 751 | case "$ans" in |
|---|
| 752 | [yY]*) ;; |
|---|
| 753 | *) needman=false;; |
|---|
| 754 | esac |
|---|
| 755 | fi |
|---|
| 756 | if $needman; then |
|---|
| 757 | cat <<EOH |
|---|
| 758 | |
|---|
| 759 | This installation shell script will examine your system and ask you questions |
|---|
| 760 | to determine how the pennmush package should be installed. If you get |
|---|
| 761 | stuck on a question, you may use a ! shell escape to start a subshell or |
|---|
| 762 | execute a command. Many of the questions will have default answers in square |
|---|
| 763 | brackets; typing carriage return will give you the default. |
|---|
| 764 | |
|---|
| 765 | On some of the questions which ask for file or directory names you are allowed |
|---|
| 766 | to use the ~name construct to specify the login directory belonging to "name", |
|---|
| 767 | even if you don't have a shell which knows about that. Questions where this is |
|---|
| 768 | allowed will be marked "(~name ok)". |
|---|
| 769 | |
|---|
| 770 | EOH |
|---|
| 771 | rp='' |
|---|
| 772 | dflt='Type carriage return to continue' |
|---|
| 773 | . ./myread |
|---|
| 774 | cat <<'EOH' |
|---|
| 775 | |
|---|
| 776 | The prompter used in this script allows you to use shell variables and |
|---|
| 777 | backticks in your answers. You may use $1, $2, etc... to refer to the words |
|---|
| 778 | in the default answer, as if the default line was a set of arguments given to a |
|---|
| 779 | script shell. This means you may also use $* to repeat the whole default line, |
|---|
| 780 | so you do not have to re-type everything to add something to the default. |
|---|
| 781 | |
|---|
| 782 | Everytime there is a substitution, you will have to confirm. If there is an |
|---|
| 783 | error (e.g. an unmatched backtick), the default answer will remain unchanged |
|---|
| 784 | and you will be prompted again. |
|---|
| 785 | |
|---|
| 786 | If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all |
|---|
| 787 | the questions and use the computed defaults (or the previous answers if there |
|---|
| 788 | was already a config.sh file). Type 'Configure -h' for a list of options. |
|---|
| 789 | You may also start interactively and then answer '& -d' at any prompt to turn |
|---|
| 790 | on the non-interactive behaviour for the remaining of the execution. |
|---|
| 791 | |
|---|
| 792 | EOH |
|---|
| 793 | . ./myread |
|---|
| 794 | cat <<EOH |
|---|
| 795 | |
|---|
| 796 | Much effort has been expended to ensure that this shell script will run on any |
|---|
| 797 | Unix system. If despite that it blows up on yours, your best bet is to edit |
|---|
| 798 | Configure and run it again. If you can't run Configure for some reason, |
|---|
| 799 | you'll have to generate a config.sh file by hand. Whatever problems you |
|---|
| 800 | have, let me (dunemush@mellers1.psych.berkeley.edu) know how I blew it. |
|---|
| 801 | |
|---|
| 802 | This installation script affects things in two ways: |
|---|
| 803 | |
|---|
| 804 | 1) it may do direct variable substitutions on some of the files included |
|---|
| 805 | in this kit. |
|---|
| 806 | 2) it builds a config.h file for inclusion in C programs. You may edit |
|---|
| 807 | any of these files as the need arises after running this script. |
|---|
| 808 | |
|---|
| 809 | If you make a mistake on a question, there is no easy way to back up to it |
|---|
| 810 | currently. The easiest thing to do is to edit config.sh and rerun all the SH |
|---|
| 811 | files. Configure will offer to let you do this before it runs the SH files. |
|---|
| 812 | |
|---|
| 813 | EOH |
|---|
| 814 | dflt='Type carriage return to continue' |
|---|
| 815 | . ./myread |
|---|
| 816 | case "$firsttime" in |
|---|
| 817 | true) echo $user >>../.config/instruct;; |
|---|
| 818 | esac |
|---|
| 819 | fi |
|---|
| 820 | |
|---|
| 821 | : see if sh knows # comments |
|---|
| 822 | echo " " |
|---|
| 823 | echo "Checking your sh to see if it knows about # comments..." >&4 |
|---|
| 824 | if `sh -c '#' >/dev/null 2>&1`; then |
|---|
| 825 | echo "Your sh handles # comments correctly." |
|---|
| 826 | shsharp=true |
|---|
| 827 | spitshell=cat |
|---|
| 828 | echo " " |
|---|
| 829 | echo "Okay, let's see if #! works on this system..." |
|---|
| 830 | xcat=/bin/cat |
|---|
| 831 | test -f $xcat || xcat=/usr/bin/cat |
|---|
| 832 | echo "#!$xcat" >try |
|---|
| 833 | $eunicefix try |
|---|
| 834 | chmod +x try |
|---|
| 835 | ./try > today |
|---|
| 836 | if test -s today; then |
|---|
| 837 | echo "It does." |
|---|
| 838 | sharpbang='#!' |
|---|
| 839 | else |
|---|
| 840 | echo "#! $xcat" > try |
|---|
| 841 | $eunicefix try |
|---|
| 842 | chmod +x try |
|---|
| 843 | ./try > today |
|---|
| 844 | if test -s today; then |
|---|
| 845 | echo "It does." |
|---|
| 846 | sharpbang='#! ' |
|---|
| 847 | else |
|---|
| 848 | echo "It's just a comment." |
|---|
| 849 | sharpbang=': use ' |
|---|
| 850 | fi |
|---|
| 851 | fi |
|---|
| 852 | else |
|---|
| 853 | echo "Your sh doesn't grok # comments--I will strip them later on." |
|---|
| 854 | shsharp=false |
|---|
| 855 | cd .. |
|---|
| 856 | echo "exec grep -v '^[ ]*#'" >spitshell |
|---|
| 857 | chmod +x spitshell |
|---|
| 858 | $eunicefix spitshell |
|---|
| 859 | spitshell=`pwd`/spitshell |
|---|
| 860 | cd UU |
|---|
| 861 | echo "I presume that if # doesn't work, #! won't work either!" |
|---|
| 862 | sharpbang=': use ' |
|---|
| 863 | fi |
|---|
| 864 | rm -f try today |
|---|
| 865 | |
|---|
| 866 | : figure out how to guarantee sh startup |
|---|
| 867 | echo " " |
|---|
| 868 | echo "Checking out how to guarantee sh startup..." >&4 |
|---|
| 869 | case "$SYSTYPE" in |
|---|
| 870 | *bsd*|sys5*) startsh=$sharpbang"/$SYSTYPE/bin/sh";; |
|---|
| 871 | *) startsh=$sharpbang'/bin/sh';; |
|---|
| 872 | esac |
|---|
| 873 | echo "Let's see if '$startsh' works..." |
|---|
| 874 | cat >try <<EOSS |
|---|
| 875 | $startsh |
|---|
| 876 | set abc |
|---|
| 877 | test "$?abc" != 1 |
|---|
| 878 | EOSS |
|---|
| 879 | |
|---|
| 880 | chmod +x try |
|---|
| 881 | $eunicefix try |
|---|
| 882 | if ./try; then |
|---|
| 883 | echo "Yup, it does." |
|---|
| 884 | else |
|---|
| 885 | echo "Nope. You may have to fix up the shell scripts to make sure sh runs them." |
|---|
| 886 | fi |
|---|
| 887 | rm -f try |
|---|
| 888 | |
|---|
| 889 | : find out where common programs are |
|---|
| 890 | echo " " |
|---|
| 891 | echo "Locating common programs..." >&4 |
|---|
| 892 | cat <<EOSC >loc |
|---|
| 893 | $startsh |
|---|
| 894 | case \$# in |
|---|
| 895 | 0) exit 1;; |
|---|
| 896 | esac |
|---|
| 897 | thing=\$1 |
|---|
| 898 | shift |
|---|
| 899 | dflt=\$1 |
|---|
| 900 | shift |
|---|
| 901 | for dir in \$*; do |
|---|
| 902 | case "\$thing" in |
|---|
| 903 | .) |
|---|
| 904 | if test -d \$dir/\$thing; then |
|---|
| 905 | echo \$dir |
|---|
| 906 | exit 0 |
|---|
| 907 | fi |
|---|
| 908 | ;; |
|---|
| 909 | *) |
|---|
| 910 | for thisthing in \$dir/\$thing; do |
|---|
| 911 | : just loop through to pick last item |
|---|
| 912 | done |
|---|
| 913 | if test -f \$thisthing; then |
|---|
| 914 | echo \$thisthing |
|---|
| 915 | exit 0 |
|---|
| 916 | elif test -f \$dir/\$thing.exe; then |
|---|
| 917 | : on Eunice apparently |
|---|
| 918 | echo \$dir/\$thing |
|---|
| 919 | exit 0 |
|---|
| 920 | fi |
|---|
| 921 | ;; |
|---|
| 922 | esac |
|---|
| 923 | done |
|---|
| 924 | echo \$dflt |
|---|
| 925 | exit 1 |
|---|
| 926 | EOSC |
|---|
| 927 | chmod +x loc |
|---|
| 928 | $eunicefix loc |
|---|
| 929 | loclist=" |
|---|
| 930 | awk |
|---|
| 931 | cat |
|---|
| 932 | echo |
|---|
| 933 | expr |
|---|
| 934 | grep |
|---|
| 935 | ln |
|---|
| 936 | rm |
|---|
| 937 | sed |
|---|
| 938 | sort |
|---|
| 939 | touch |
|---|
| 940 | tr |
|---|
| 941 | uniq |
|---|
| 942 | " |
|---|
| 943 | trylist=" |
|---|
| 944 | Mcc |
|---|
| 945 | cpp |
|---|
| 946 | date |
|---|
| 947 | mail |
|---|
| 948 | perl |
|---|
| 949 | rmail |
|---|
| 950 | sendmail |
|---|
| 951 | smail |
|---|
| 952 | test |
|---|
| 953 | uname |
|---|
| 954 | uptime |
|---|
| 955 | " |
|---|
| 956 | pth=`echo $PATH | sed -e "s/$p_/ /g"` |
|---|
| 957 | pth="$pth /lib /usr/lib" |
|---|
| 958 | for file in $loclist; do |
|---|
| 959 | xxx=`./loc $file $file $pth` |
|---|
| 960 | eval $file=$xxx |
|---|
| 961 | eval _$file=$xxx |
|---|
| 962 | case "$xxx" in |
|---|
| 963 | /*) |
|---|
| 964 | echo $file is in $xxx. |
|---|
| 965 | ;; |
|---|
| 966 | ?:[\\/]*) |
|---|
| 967 | echo $file is in $xxx. |
|---|
| 968 | ;; |
|---|
| 969 | *) |
|---|
| 970 | echo "I don't know where $file is. I hope it's in everyone's PATH." |
|---|
| 971 | ;; |
|---|
| 972 | esac |
|---|
| 973 | done |
|---|
| 974 | echo " " |
|---|
| 975 | echo "Don't worry if any of the following aren't found..." |
|---|
| 976 | say=offhand |
|---|
| 977 | for file in $trylist; do |
|---|
| 978 | xxx=`./loc $file $file $pth` |
|---|
| 979 | eval $file=$xxx |
|---|
| 980 | eval _$file=$xxx |
|---|
| 981 | case "$xxx" in |
|---|
| 982 | /*) |
|---|
| 983 | echo $file is in $xxx. |
|---|
| 984 | ;; |
|---|
| 985 | ?:[\\/]*) |
|---|
| 986 | echo $file is in $xxx. |
|---|
| 987 | ;; |
|---|
| 988 | *) |
|---|
| 989 | echo "I don't see $file out there, $say." |
|---|
| 990 | say=either |
|---|
| 991 | ;; |
|---|
| 992 | esac |
|---|
| 993 | done |
|---|
| 994 | case "$egrep" in |
|---|
| 995 | egrep) |
|---|
| 996 | echo "Substituting grep for egrep." |
|---|
| 997 | egrep=$grep |
|---|
| 998 | ;; |
|---|
| 999 | esac |
|---|
| 1000 | case "$test" in |
|---|
| 1001 | test) |
|---|
| 1002 | echo "Hopefully test is built into your sh." |
|---|
| 1003 | ;; |
|---|
| 1004 | *) |
|---|
| 1005 | if `sh -c "PATH= test true" >/dev/null 2>&1`; then |
|---|
| 1006 | echo "Using the test built into your sh." |
|---|
| 1007 | test=test |
|---|
| 1008 | _test=test |
|---|
| 1009 | fi |
|---|
| 1010 | ;; |
|---|
| 1011 | esac |
|---|
| 1012 | case "$echo" in |
|---|
| 1013 | echo) |
|---|
| 1014 | echo "Hopefully echo is built into your sh." |
|---|
| 1015 | ;; |
|---|
| 1016 | '') ;; |
|---|
| 1017 | *) |
|---|
| 1018 | echo " " |
|---|
| 1019 | echo "Checking compatibility between $echo and builtin echo (if any)..." >&4 |
|---|
| 1020 | $echo $n "hi there$c" >foo1 |
|---|
| 1021 | echo $n "hi there$c" >foo2 |
|---|
| 1022 | if cmp foo1 foo2 >/dev/null 2>&1; then |
|---|
| 1023 | echo "They are compatible. In fact, they may be identical." |
|---|
| 1024 | else |
|---|
| 1025 | case "$n" in |
|---|
| 1026 | '-n') n='' c='\c';; |
|---|
| 1027 | *) n='-n' c='';; |
|---|
| 1028 | esac |
|---|
| 1029 | cat <<FOO |
|---|
| 1030 | They are not compatible! You are probably running ksh on a non-USG system. |
|---|
| 1031 | I'll have to use $echo instead of the builtin, since Bourne shell doesn't |
|---|
| 1032 | have echo built in and we may have to run some Bourne shell scripts. That |
|---|
| 1033 | means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous. |
|---|
| 1034 | |
|---|
| 1035 | FOO |
|---|
| 1036 | $echo $n "The star should be here-->$c" |
|---|
| 1037 | $echo "*" |
|---|
| 1038 | fi |
|---|
| 1039 | $rm -f foo1 foo2 |
|---|
| 1040 | ;; |
|---|
| 1041 | esac |
|---|
| 1042 | |
|---|
| 1043 | : determine whether symbolic links are supported |
|---|
| 1044 | echo " " |
|---|
| 1045 | $touch blurfl |
|---|
| 1046 | if $ln -s blurfl sym > /dev/null 2>&1 ; then |
|---|
| 1047 | echo "Symbolic links are supported." >&4 |
|---|
| 1048 | lns="$ln -s" |
|---|
| 1049 | else |
|---|
| 1050 | echo "Symbolic links are NOT supported." >&4 |
|---|
| 1051 | lns="$ln" |
|---|
| 1052 | fi |
|---|
| 1053 | $rm -f blurfl sym |
|---|
| 1054 | |
|---|
| 1055 | : see whether [:lower:] and [:upper:] are supported character classes |
|---|
| 1056 | echo " " |
|---|
| 1057 | up='[A-Z]' |
|---|
| 1058 | low='[a-z]' |
|---|
| 1059 | case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in |
|---|
| 1060 | ABYZ) |
|---|
| 1061 | echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4 |
|---|
| 1062 | up='[:upper:]' |
|---|
| 1063 | low='[:lower:]' |
|---|
| 1064 | ;; |
|---|
| 1065 | *) |
|---|
| 1066 | echo "Your tr only supports [a-z] and [A-Z] to convert case." >&4 |
|---|
| 1067 | ;; |
|---|
| 1068 | esac |
|---|
| 1069 | : set up the translation script tr, must be called with ./tr of course |
|---|
| 1070 | cat >tr <<EOSC |
|---|
| 1071 | $startsh |
|---|
| 1072 | case "\$1\$2" in |
|---|
| 1073 | '[A-Z][a-z]') exec $tr '$up' '$low';; |
|---|
| 1074 | '[a-z][A-Z]') exec $tr '$low' '$up';; |
|---|
| 1075 | esac |
|---|
| 1076 | exec $tr "\$@" |
|---|
| 1077 | EOSC |
|---|
| 1078 | chmod +x tr |
|---|
| 1079 | $eunicefix tr |
|---|
| 1080 | |
|---|
| 1081 | : Try to determine whether config.sh was made on this system |
|---|
| 1082 | case "$config_sh" in |
|---|
| 1083 | '') |
|---|
| 1084 | myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1` |
|---|
| 1085 | myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \ |
|---|
| 1086 | ./tr '[A-Z]' '[a-z]' | tr '\012' ' '` |
|---|
| 1087 | newmyuname="$myuname" |
|---|
| 1088 | dflt=n |
|---|
| 1089 | case "$knowitall" in |
|---|
| 1090 | '') |
|---|
| 1091 | if test -f ../config.sh; then |
|---|
| 1092 | if $contains myuname= ../config.sh >/dev/null 2>&1; then |
|---|
| 1093 | eval "`grep myuname= ../config.sh`" |
|---|
| 1094 | fi |
|---|
| 1095 | if test "X$myuname" = "X$newmyuname"; then |
|---|
| 1096 | dflt=y |
|---|
| 1097 | fi |
|---|
| 1098 | fi |
|---|
| 1099 | ;; |
|---|
| 1100 | *) dflt=y;; |
|---|
| 1101 | esac |
|---|
| 1102 | |
|---|
| 1103 | : Get old answers from old config file if Configure was run on the |
|---|
| 1104 | : same system, otherwise use the hints. |
|---|
| 1105 | hint=default |
|---|
| 1106 | cd .. |
|---|
| 1107 | if test -f config.sh; then |
|---|
| 1108 | echo " " |
|---|
| 1109 | rp="I see a config.sh file. Shall I use it to set the defaults?" |
|---|
| 1110 | . UU/myread |
|---|
| 1111 | case "$ans" in |
|---|
| 1112 | n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;; |
|---|
| 1113 | *) echo "Fetching default answers from your old config.sh file..." >&4 |
|---|
| 1114 | tmp_n="$n" |
|---|
| 1115 | tmp_c="$c" |
|---|
| 1116 | . ./config.sh |
|---|
| 1117 | cp config.sh UU |
|---|
| 1118 | n="$tmp_n" |
|---|
| 1119 | c="$tmp_c" |
|---|
| 1120 | hint=previous |
|---|
| 1121 | ;; |
|---|
| 1122 | esac |
|---|
| 1123 | fi |
|---|
| 1124 | if test ! -f config.sh; then |
|---|
| 1125 | $cat <<EOM |
|---|
| 1126 | |
|---|
| 1127 | First time through, eh? I have some defaults handy for the following systems: |
|---|
| 1128 | |
|---|
| 1129 | EOM |
|---|
| 1130 | cd hints; ls -C *.sh | $sed 's/\.sh/ /g' >&4 |
|---|
| 1131 | dflt='' |
|---|
| 1132 | : Half the following guesses are probably wrong... If you have better |
|---|
| 1133 | : tests or hints, please send them to dunemush@mellers1.psych.berkeley.edu |
|---|
| 1134 | : The metaconfig authors would also appreciate a copy... |
|---|
| 1135 | $test -f /irix && osname=irix |
|---|
| 1136 | $test -f /xenix && osname=sco_xenix |
|---|
| 1137 | $test -f /dynix && osname=dynix |
|---|
| 1138 | $test -f /dnix && osname=dnix |
|---|
| 1139 | $test -f /unicos && osname=unicos && osvers=`$uname -r` |
|---|
| 1140 | $test -f /bin/mips && /bin/mips && osname=mips |
|---|
| 1141 | $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \ |
|---|
| 1142 | $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4 |
|---|
| 1143 | $test -d /usr/apollo/bin && osname=apollo |
|---|
| 1144 | $test -f /etc/saf/_sactab && osname=svr4 |
|---|
| 1145 | $test -d /usr/include/minix && osname=minix |
|---|
| 1146 | $test -d /MachTen && osname=machten && \ |
|---|
| 1147 | osvers=`/usr/etc/version | $awk '{print $2}' | \ |
|---|
| 1148 | $sed -e 's/[A-Za-z]$//'` |
|---|
| 1149 | if $test -f $uname; then |
|---|
| 1150 | set X $myuname |
|---|
| 1151 | shift |
|---|
| 1152 | |
|---|
| 1153 | case "$5" in |
|---|
| 1154 | fps*) osname=fps ;; |
|---|
| 1155 | mips*) |
|---|
| 1156 | case "$4" in |
|---|
| 1157 | umips) osname=umips ;; |
|---|
| 1158 | *) osname=mips ;; |
|---|
| 1159 | esac;; |
|---|
| 1160 | [23]100) osname=mips ;; |
|---|
| 1161 | next*) osname=next ;; |
|---|
| 1162 | news*) osname=news ;; |
|---|
| 1163 | i386*) |
|---|
| 1164 | if $test -f /etc/kconfig; then |
|---|
| 1165 | osname=isc |
|---|
| 1166 | if test "$lns" = "ln -s"; then |
|---|
| 1167 | osvers=4 |
|---|
| 1168 | elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then |
|---|
| 1169 | osvers=3 |
|---|
| 1170 | elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then |
|---|
| 1171 | osvers=2 |
|---|
| 1172 | fi |
|---|
| 1173 | fi |
|---|
| 1174 | ;; |
|---|
| 1175 | esac |
|---|
| 1176 | |
|---|
| 1177 | case "$1" in |
|---|
| 1178 | aix) osname=aix |
|---|
| 1179 | tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1` |
|---|
| 1180 | case "$tmp" in |
|---|
| 1181 | 'not found') osvers="$4"."$3" ;; |
|---|
| 1182 | '<3240'|'<>3240') osvers=3.2.0 ;; |
|---|
| 1183 | '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;; |
|---|
| 1184 | '=3250'|'>3250') osvers=3.2.5 ;; |
|---|
| 1185 | *) osvers=$tmp;; |
|---|
| 1186 | esac |
|---|
| 1187 | ;; |
|---|
| 1188 | dnix) osname=dnix |
|---|
| 1189 | osvers="$3" |
|---|
| 1190 | ;; |
|---|
| 1191 | domainos) osname=apollo |
|---|
| 1192 | osvers="$3" |
|---|
| 1193 | ;; |
|---|
| 1194 | dgux) osname=dgux |
|---|
| 1195 | osvers="$3" |
|---|
| 1196 | ;; |
|---|
| 1197 | freebsd) osname=freebsd |
|---|
| 1198 | osvers="$3" ;; |
|---|
| 1199 | genix) osname=genix ;; |
|---|
| 1200 | hp*) osname=hpux |
|---|
| 1201 | case "$3" in |
|---|
| 1202 | *.08.*) osvers=9 ;; |
|---|
| 1203 | *.09.*) osvers=9 ;; |
|---|
| 1204 | *.10.*) osvers=10 ;; |
|---|
| 1205 | *) osvers="$3" ;; |
|---|
| 1206 | esac |
|---|
| 1207 | ;; |
|---|
| 1208 | irix) osname=irix |
|---|
| 1209 | case "$3" in |
|---|
| 1210 | 4*) osvers=4 ;; |
|---|
| 1211 | 5*) osvers=5 ;; |
|---|
| 1212 | *) osvers="$3" ;; |
|---|
| 1213 | esac |
|---|
| 1214 | ;; |
|---|
| 1215 | linux) osname=linux |
|---|
| 1216 | case "$3" in |
|---|
| 1217 | 1*) osvers=1 ;; |
|---|
| 1218 | *) osvers="$3" ;; |
|---|
| 1219 | esac |
|---|
| 1220 | ;; |
|---|
| 1221 | netbsd*) osname=netbsd |
|---|
| 1222 | osvers="$3" |
|---|
| 1223 | ;; |
|---|
| 1224 | bsd386) osname=bsd386 |
|---|
| 1225 | osvers=`$uname -r` |
|---|
| 1226 | ;; |
|---|
| 1227 | next*) osname=next ;; |
|---|
| 1228 | solaris) osname=solaris |
|---|
| 1229 | case "$3" in |
|---|
| 1230 | 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;; |
|---|
| 1231 | *) osvers="$3" ;; |
|---|
| 1232 | esac |
|---|
| 1233 | ;; |
|---|
| 1234 | sunos) osname=sunos |
|---|
| 1235 | case "$3" in |
|---|
| 1236 | 5*) osname=solaris |
|---|
| 1237 | osvers=`echo $3 | $sed 's/^5/2/g'` ;; |
|---|
| 1238 | *) osvers="$3" ;; |
|---|
| 1239 | esac |
|---|
| 1240 | ;; |
|---|
| 1241 | titanos) osname=titanos |
|---|
| 1242 | case "$3" in |
|---|
| 1243 | 1*) osvers=1 ;; |
|---|
| 1244 | 2*) osvers=2 ;; |
|---|
| 1245 | 3*) osvers=3 ;; |
|---|
| 1246 | 4*) osvers=4 ;; |
|---|
| 1247 | *) osvers="$3" ;; |
|---|
| 1248 | esac |
|---|
| 1249 | ;; |
|---|
| 1250 | ultrix) osname=ultrix |
|---|
| 1251 | osvers="$3" |
|---|
| 1252 | ;; |
|---|
| 1253 | osf1) case "$5" in |
|---|
| 1254 | alpha) |
|---|
| 1255 | osname=dec_osf |
|---|
| 1256 | osvers=`echo "$3" | sed 's/^[vt]//'` |
|---|
| 1257 | ;; |
|---|
| 1258 | hp*) osname=hp_osf1 ;; |
|---|
| 1259 | mips) osname=mips_osf1 ;; |
|---|
| 1260 | esac |
|---|
| 1261 | ;; |
|---|
| 1262 | uts) osname=uts |
|---|
| 1263 | osvers="$3" |
|---|
| 1264 | ;; |
|---|
| 1265 | $2) case "$osname" in |
|---|
| 1266 | *isc*) ;; |
|---|
| 1267 | *freebsd*) ;; |
|---|
| 1268 | svr*) |
|---|
| 1269 | : svr4.x or possibly later |
|---|
| 1270 | case "svr$3" in |
|---|
| 1271 | ${osname}*) |
|---|
| 1272 | osname=svr$3 |
|---|
| 1273 | osvers=$4 |
|---|
| 1274 | ;; |
|---|
| 1275 | esac |
|---|
| 1276 | case "$osname" in |
|---|
| 1277 | svr4.0) |
|---|
| 1278 | : Check for ESIX |
|---|
| 1279 | if test -f /stand/boot ; then |
|---|
| 1280 | eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot` |
|---|
| 1281 | if test -n "$INITPROG" -a -f "$INITPROG"; then |
|---|
| 1282 | isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'` |
|---|
| 1283 | if test -n "$isesix"; then |
|---|
| 1284 | osname=esix4 |
|---|
| 1285 | fi |
|---|
| 1286 | fi |
|---|
| 1287 | fi |
|---|
| 1288 | ;; |
|---|
| 1289 | esac |
|---|
| 1290 | ;; |
|---|
| 1291 | *) if test -f /etc/systemid; then |
|---|
| 1292 | osname=sco |
|---|
| 1293 | set `echo $3 | $sed 's/\./ /g'` $4 |
|---|
| 1294 | if $test -f sco_$1_$2_$3.sh; then |
|---|
| 1295 | osvers=$1.$2.$3 |
|---|
| 1296 | elif $test -f sco_$1_$2.sh; then |
|---|
| 1297 | osvers=$1.$2 |
|---|
| 1298 | elif $test -f sco_$1.sh; then |
|---|
| 1299 | osvers=$1 |
|---|
| 1300 | fi |
|---|
| 1301 | else |
|---|
| 1302 | case "$osname" in |
|---|
| 1303 | '') : Still unknown. Probably a generic Sys V. |
|---|
| 1304 | osname="sysv" |
|---|
| 1305 | osvers="$3" |
|---|
| 1306 | ;; |
|---|
| 1307 | esac |
|---|
| 1308 | fi |
|---|
| 1309 | ;; |
|---|
| 1310 | esac |
|---|
| 1311 | ;; |
|---|
| 1312 | *) case "$osname" in |
|---|
| 1313 | '') : Still unknown. Probably a generic BSD. |
|---|
| 1314 | osname="$1" |
|---|
| 1315 | osvers="$3" |
|---|
| 1316 | ;; |
|---|
| 1317 | esac |
|---|
| 1318 | ;; |
|---|
| 1319 | esac |
|---|
| 1320 | else |
|---|
| 1321 | if test -f /vmunix -a -f news_os.sh; then |
|---|
| 1322 | (what /vmunix | ../UU/tr '[A-Z]' '[a-z]') > ../UU/kernel.what 2>&1 |
|---|
| 1323 | if $contains news-os ../UU/kernel.what >/dev/null 2>&1; then |
|---|
| 1324 | osname=news_os |
|---|
| 1325 | fi |
|---|
| 1326 | $rm -f ../UU/kernel.what |
|---|
| 1327 | elif test -d c:/.; then |
|---|
| 1328 | set X $myuname |
|---|
| 1329 | osname=os2 |
|---|
| 1330 | osvers="$5" |
|---|
| 1331 | fi |
|---|
| 1332 | fi |
|---|
| 1333 | |
|---|
| 1334 | : Now look for a hint file osname_osvers, unless one has been |
|---|
| 1335 | : specified already. |
|---|
| 1336 | case "$hintfile" in |
|---|
| 1337 | ''|' ') |
|---|
| 1338 | file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'` |
|---|
| 1339 | : Also try without trailing minor version numbers. |
|---|
| 1340 | xfile=`echo $file | $sed -e 's@_[^_]*$@@'` |
|---|
| 1341 | xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'` |
|---|
| 1342 | xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'` |
|---|
| 1343 | xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'` |
|---|
| 1344 | case "$file" in |
|---|
| 1345 | '') dflt=none ;; |
|---|
| 1346 | *) case "$osvers" in |
|---|
| 1347 | '') dflt=$file |
|---|
| 1348 | ;; |
|---|
| 1349 | *) if $test -f $file.sh ; then |
|---|
| 1350 | dflt=$file |
|---|
| 1351 | elif $test -f $xfile.sh ; then |
|---|
| 1352 | dflt=$xfile |
|---|
| 1353 | elif $test -f $xxfile.sh ; then |
|---|
| 1354 | dflt=$xxfile |
|---|
| 1355 | elif $test -f $xxxfile.sh ; then |
|---|
| 1356 | dflt=$xxxfile |
|---|
| 1357 | elif $test -f $xxxxfile.sh ; then |
|---|
| 1358 | dflt=$xxxxfile |
|---|
| 1359 | elif $test -f "${osname}.sh" ; then |
|---|
| 1360 | dflt="${osname}" |
|---|
| 1361 | else |
|---|
| 1362 | dflt=none |
|---|
| 1363 | fi |
|---|
| 1364 | ;; |
|---|
| 1365 | esac |
|---|
| 1366 | ;; |
|---|
| 1367 | esac |
|---|
| 1368 | ;; |
|---|
| 1369 | *) |
|---|
| 1370 | dflt=`echo $hintfile | $sed 's/\.sh$//'` |
|---|
| 1371 | ;; |
|---|
| 1372 | esac |
|---|
| 1373 | |
|---|
| 1374 | $cat <<EOM |
|---|
| 1375 | |
|---|
| 1376 | You may give one or more space-separated answers, or "none" if appropriate. |
|---|
| 1377 | If your OS version has no hints, DO NOT give a wrong version -- say "none". |
|---|
| 1378 | |
|---|
| 1379 | EOM |
|---|
| 1380 | rp="Which of these apply, if any?" |
|---|
| 1381 | . ../UU/myread |
|---|
| 1382 | tans=$ans |
|---|
| 1383 | for file in $tans; do |
|---|
| 1384 | if $test -f $file.sh; then |
|---|
| 1385 | . ./$file.sh |
|---|
| 1386 | $cat $file.sh >> ../UU/config.sh |
|---|
| 1387 | elif $test X$tans = X -o X$tans = Xnone ; then |
|---|
| 1388 | : nothing |
|---|
| 1389 | else |
|---|
| 1390 | : Give one chance to correct a possible typo. |
|---|
| 1391 | echo "$file.sh does not exist" |
|---|
| 1392 | dflt=$file |
|---|
| 1393 | rp="hint to use instead?" |
|---|
| 1394 | . ../UU/myread |
|---|
| 1395 | for file in $ans; do |
|---|
| 1396 | if $test -f "$file.sh"; then |
|---|
| 1397 | . ./$file.sh |
|---|
| 1398 | $cat $file.sh >> ../UU/config.sh |
|---|
| 1399 | elif $test X$ans = X -o X$ans = Xnone ; then |
|---|
| 1400 | : nothing |
|---|
| 1401 | else |
|---|
| 1402 | echo "$file.sh does not exist -- ignored." |
|---|
| 1403 | fi |
|---|
| 1404 | done |
|---|
| 1405 | fi |
|---|
| 1406 | done |
|---|
| 1407 | |
|---|
| 1408 | hint=recommended |
|---|
| 1409 | : Remember our hint file for later. |
|---|
| 1410 | if $test -f "$file.sh" ; then |
|---|
| 1411 | hintfile="$file" |
|---|
| 1412 | else |
|---|
| 1413 | hintfile='' |
|---|
| 1414 | fi |
|---|
| 1415 | |
|---|
| 1416 | cd .. |
|---|
| 1417 | fi |
|---|
| 1418 | cd UU |
|---|
| 1419 | ;; |
|---|
| 1420 | *) |
|---|
| 1421 | echo " " |
|---|
| 1422 | echo "Fetching default answers from $config_sh..." >&4 |
|---|
| 1423 | tmp_n="$n" |
|---|
| 1424 | tmp_c="$c" |
|---|
| 1425 | cd .. |
|---|
| 1426 | cp $config_sh config.sh 2>/dev/null |
|---|
| 1427 | . ./config.sh |
|---|
| 1428 | cd UU |
|---|
| 1429 | cp ../config.sh . |
|---|
| 1430 | n="$tmp_n" |
|---|
| 1431 | c="$tmp_c" |
|---|
| 1432 | hint=previous |
|---|
| 1433 | ;; |
|---|
| 1434 | esac |
|---|
| 1435 | test "$override" && . ./optdef.sh |
|---|
| 1436 | myuname="$newmyuname" |
|---|
| 1437 | |
|---|
| 1438 | : Restore computed paths |
|---|
| 1439 | for file in $loclist $trylist; do |
|---|
| 1440 | eval $file="\$_$file" |
|---|
| 1441 | done |
|---|
| 1442 | |
|---|
| 1443 | : who configured the system |
|---|
| 1444 | cf_time=`$date 2>&1` |
|---|
| 1445 | (logname > .temp) >/dev/null 2>&1 |
|---|
| 1446 | $test -s .temp || (whoami > .temp) >/dev/null 2>&1 |
|---|
| 1447 | $test |
|---|