This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl 4.0 patch 4: (combined patch)
[perl5.git] / Configure
CommitLineData
8d063cd8
LW
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, I would
7# suggest you cut out the prototypical config.h from the end of Configure
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#
132b68a5 11# $RCSfile: Configure,v $$Revision: 4.0.1.2 $$Date: 91/06/07 10:09:34 $
8d063cd8
LW
12#
13# Yes, you may rip this off to use in other distribution packages.
14# (Note: this Configure script was generated automatically. Rather than
15# working with this copy of Configure, you may wish to get metaconfig.)
16
16a2aea0
LW
17cat >/tmp/c1$$ <<EOF
18ARGGGHHHH!!!!!
19
20SCO csh still thinks true is false. Write to SCO today and tell them that next
21year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
22
23(Actually, Configure ought to just patch csh in place. Hmm. Hmmmmm. All
24we'd have to do is go in and swap the && and || tokens, wherever they are.)
25
26[End of diatribe. We now return you to your regularly scheduled programming...]
27
28EOF
29cat >/tmp/c2$$ <<EOF
30OOPS! You naughty creature! You didn't run Configure with sh!
31I will attempt to remedy the situation by running sh for you...
32
33EOF
34
35true || cat /tmp/c1$$ /tmp/c2$$
36true || exec sh $0
37
38export PATH || cat /tmp/c2$$
39export PATH || exec sh $0
40rm -f /tmp/c1$$ /tmp/c2$$
41
fe14fcc3 42PATH=".:$PATH:/bin:/usr/bin:/usr/local/bin:/usr/ucb:/usr/local:/usr/lbin:/etc:/usr/new:/usr/new/bin:/usr/nbin"
8d063cd8
LW
43
44if test ! -t 0; then
45 echo "Say 'sh Configure', not 'sh <Configure'"
46 exit 1
47fi
48
49(alias) >/dev/null 2>&1 && \
50 echo "(I see you are using the Korn shell. Some ksh's blow up on Configure," && \
51 echo "especially on exotic machines. If yours does, try the Bourne shell instead.)"
52
53if test ! -d ../UU; then
54 if test ! -d UU; then
55 mkdir UU
56 fi
57 cd UU
58fi
59
378cc40b
LW
60case "$1" in
61-d) shift; fastread='yes';;
62esac
63
8d063cd8 64d_eunice=''
8d063cd8 65define=''
91407755 66eunicefix=''
8d063cd8
LW
67loclist=''
68expr=''
69sed=''
70echo=''
71cat=''
72rm=''
73mv=''
74cp=''
75tail=''
76tr=''
77mkdir=''
78sort=''
79uniq=''
80grep=''
81trylist=''
82test=''
83inews=''
84egrep=''
85more=''
86pg=''
87Mcc=''
88vi=''
89mailx=''
90mail=''
378cc40b 91cpp=''
a687059c
LW
92perl=''
93emacs=''
94ls=''
95rmail=''
96sendmail=''
97shar=''
98smail=''
99tbl=''
100troff=''
101nroff=''
102uname=''
103uuname=''
104line=''
105chgrp=''
106chmod=''
107lint=''
108sleep=''
109pr=''
110tar=''
111ln=''
112lpr=''
113lp=''
114touch=''
115make=''
116date=''
91407755 117csh=''
fe14fcc3
LW
118bash=''
119ksh=''
120lex=''
121flex=''
122bison=''
8d063cd8
LW
123Log=''
124Header=''
fe14fcc3 125Id=''
16a2aea0 126lastuname=''
7e1cf235 127alignbytes=''
8d063cd8 128bin=''
fe14fcc3 129installbin=''
a687059c 130byteorder=''
8d063cd8 131contains=''
378cc40b 132cppstdin=''
36ce8bec 133cppminus=''
a687059c 134d_bcmp=''
135863df 135d_bcopy=''
0d3e774c 136d_bzero=''
21d892ea 137d_castneg=''
7e1cf235 138castflags=''
8d063cd8 139d_charsprf=''
79220ce3 140d_chsize=''
2e1b3b7e 141d_crypt=''
a687059c 142cryptlib=''
91407755 143d_csh=''
13281fa4 144d_dosuid=''
a687059c 145d_dup2=''
378cc40b
LW
146d_fchmod=''
147d_fchown=''
a687059c 148d_fcntl=''
7e1cf235 149d_flexfnam=''
a687059c 150d_flock=''
378cc40b 151d_getgrps=''
a687059c
LW
152d_gethent=''
153d_getpgrp=''
d8f2e4cc 154d_getpgrp2=''
a687059c
LW
155d_getprior=''
156d_htonl=''
8d063cd8 157d_index=''
378cc40b 158d_killpg=''
0d3e774c 159d_lstat=''
a687059c 160d_memcmp=''
378cc40b 161d_memcpy=''
a687059c 162d_mkdir=''
fe14fcc3
LW
163d_msg=''
164d_msgctl=''
165d_msgget=''
166d_msgrcv=''
167d_msgsnd=''
a687059c
LW
168d_ndbm=''
169d_odbm=''
fe14fcc3 170d_open3=''
a687059c 171d_readdir=''
378cc40b 172d_rename=''
a687059c 173d_rmdir=''
79220ce3 174d_select=''
fe14fcc3
LW
175d_sem=''
176d_semctl=''
177d_semget=''
178d_semop=''
378cc40b
LW
179d_setegid=''
180d_seteuid=''
a687059c 181d_setpgrp=''
d8f2e4cc 182d_setpgrp2=''
a687059c
LW
183d_setprior=''
184d_setregid=''
185d_setresgid=''
186d_setreuid=''
187d_setresuid=''
378cc40b
LW
188d_setrgid=''
189d_setruid=''
fe14fcc3
LW
190d_shm=''
191d_shmat=''
132b68a5 192d_voidshmat=''
fe14fcc3
LW
193d_shmctl=''
194d_shmdt=''
195d_shmget=''
a687059c
LW
196d_socket=''
197d_sockpair=''
198d_oldsock=''
199socketlib=''
135863df 200d_statblks=''
36ce8bec 201d_stdstdio=''
8d063cd8 202d_strctcpy=''
d8f2e4cc 203d_strerror=''
2e1b3b7e 204d_symlink=''
a687059c 205d_syscall=''
79220ce3 206d_truncate=''
8d063cd8 207d_vfork=''
36ce8bec 208d_voidsig=''
fe14fcc3 209d_tosignal=''
449aadca 210d_volatile=''
a687059c
LW
211d_vprintf=''
212d_charvspr=''
91407755 213d_wait4=''
b6ccd89c 214d_waitpid=''
378cc40b 215gidtype=''
16a2aea0 216groupstype=''
a687059c 217i_fcntl=''
fe14fcc3 218i_gdbm=''
a687059c 219i_grp=''
03a14243 220i_niin=''
fe14fcc3 221i_sysin=''
a687059c
LW
222i_pwd=''
223d_pwquota=''
224d_pwage=''
91407755
LW
225d_pwchange=''
226d_pwclass=''
227d_pwexpire=''
fe14fcc3
LW
228d_pwcomment=''
229i_sys_file=''
a687059c 230i_sysioctl=''
d8f2e4cc 231i_time=''
fe14fcc3
LW
232i_sys_time=''
233i_sys_select=''
d8f2e4cc
LW
234d_systimekernel=''
235i_utime=''
a687059c
LW
236i_varargs=''
237i_vfork=''
238intsize=''
8d063cd8 239libc=''
fe14fcc3
LW
240nm_opts=''
241libndir=''
242i_my_dir=''
243i_ndir=''
244i_sys_ndir=''
245i_dirent=''
246i_sys_dir=''
247d_dirnamlen=''
248ndirc=''
249ndiro=''
a1cc2bdc
AR
250mallocsrc=''
251mallocobj=''
252usemymalloc=''
16a2aea0 253mallocptrtype=''
8d063cd8
LW
254mansrc=''
255manext=''
256models=''
257split=''
258small=''
259medium=''
260large=''
261huge=''
a687059c 262optimize=''
8d063cd8 263ccflags=''
91407755 264cppflags=''
8d063cd8 265ldflags=''
a687059c 266cc=''
132b68a5 267nativegcc=''
a687059c 268libs=''
8d063cd8
LW
269n=''
270c=''
271package=''
a687059c 272randbits=''
79220ce3 273scriptdir=''
132b68a5 274installscr=''
a687059c 275sig_name=''
8d063cd8
LW
276spitshell=''
277shsharp=''
278sharpbang=''
279startsh=''
36ce8bec 280stdchar=''
378cc40b 281uidtype=''
fe14fcc3
LW
282usrinclude=''
283inclPath=''
284void=''
285voidhave=''
286voidwant=''
287w_localtim=''
288w_s_timevl=''
289w_s_tm=''
d8f2e4cc 290yacc=''
d8f2e4cc 291lib=''
fe14fcc3
LW
292privlib=''
293installprivlib=''
8d063cd8 294CONFIG=''
fe14fcc3 295: get the name of the package
8d063cd8 296package=perl
fe14fcc3 297: Here we go...
8d063cd8
LW
298echo " "
299echo "Beginning of configuration questions for $package kit."
300: Eunice requires " " instead of "", can you believe it
301echo " "
302
303define='define'
13281fa4 304undef='undef'
d8f2e4cc
LW
305: change the next line if compiling for Xenix/286 on Xenix/386
306xlibpth='/usr/lib/386 /lib/386'
fe14fcc3 307libpth='/usr/ccs/lib /usr/lib /usr/ucblib /usr/local/lib /usr/lib/large /lib '$xlibpth' /lib/large /usr/lib/small /lib/small'
8d063cd8 308smallmach='pdp11 i8086 z8000 i80286 iAPX286'
fe14fcc3 309trap 'echo " "; exit 1' 1 2 3
378cc40b
LW
310
311: We must find out about Eunice early
312eunicefix=':'
313if test -f /etc/unixtovms; then
314 eunicefix=/etc/unixtovms
315fi
316if test -f /etc/unixtovms.exe; then
317 eunicefix=/etc/unixtovms.exe
318fi
319
fe14fcc3
LW
320attrlist="DGUX M_I186 M_I286 M_I386 M_I8086 M_XENIX UTS __DGUX__"
321attrlist="$attrlist __STDC__ __m88k__ ansi bsd4_2 gcos gimpel"
322attrlist="$attrlist hp9000s300 hp9000s500 hp9000s800 hpux"
323attrlist="$attrlist i186 i386 i8086 iAPX286 ibm interdata"
324attrlist="$attrlist m68k m88k mc300 mc500 mc68000 mc68k mc700 mert"
325attrlist="$attrlist ns16000 ns32000 nsc32000 os pdp11 posix pyr sinix"
326attrlist="$attrlist sparc sun tower tower32 tower32_600 tower32_800 tss"
327attrlist="$attrlist u3b2 u3b20 u3b200 u3b5 ultrix unix vax venix xenix"
328attrlist="$attrlist z8000"
329boPATH=""
330eoPATH="/usr/ucb /bin /usr/bin /usr/local /usr/local/bin /usr/lbin /usr/plx /usr/5bin /vol/local/bin /etc /usr/lib /lib /usr/local/lib /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/bin /bsd4.3/usr/ucb /bsd43/usr/bin"
331d_newshome="/usr/NeWS"
332errnolist=errnolist
333h_fcntl=false
334h_sys_file=false
335serve_shm=""
336serve_msg="$undef"
337serve_inet_udp=""
338serve_inet_tcp=""
339serve_unix_udp=""
340serve_unix_tcp=""
341d_ndir=ndir
342voidwant=1
16a2aea0 343voidwant=7
132b68a5
LW
344libswanted="c_s net_s net nsl_s nsl socket nm ndir ndbm dbm malloc sun m bsd BSD x posix ucb"
345inclwanted='/usr/include /usr/netinclude /usr/include/sun /usr/include/bsd /usr/include/lan /usr/ucbinclude'
fe14fcc3 346
a687059c
LW
347: Now test for existence of everything in MANIFEST
348
349echo "First let's make sure your kit is complete. Checking..."
16a2aea0
LW
350awk '$1 !~ /PACKINGLIST/ {print $1}' ../MANIFEST | split -200
351rm -f missing
352for filelist in x??; do
353 (cd ..; ls `cat UU/$filelist` >/dev/null 2>>UU/missing)
354done
355if test -s missing; then
356 cat missing
fe14fcc3 357 kill $$
fe14fcc3 358fi
91407755 359echo "Looks good..."
a687059c 360
8d063cd8 361: some greps do not return status, grrr.
fe14fcc3
LW
362echo "grimblepritz" >contains.txt
363if grep blurfldyick contains.txt >/dev/null 2>&1 ; then
8d063cd8 364 contains=contains
fe14fcc3 365elif grep grimblepritz contains.txt >/dev/null 2>&1 ; then
8d063cd8
LW
366 contains=grep
367else
368 contains=contains
369fi
8d063cd8
LW
370: the following should work in any shell
371case "$contains" in
372contains*)
373 echo " "
374 echo "AGH! Grep doesn't return a status. Attempting remedial action."
375 cat >contains <<'EOSS'
376grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
377EOSS
378cc40b 378chmod +x contains
8d063cd8
LW
379esac
380
91407755
LW
381: see if sh knows # comments
382echo " "
383echo "Checking your sh to see if it knows about # comments..."
384if sh -c '#' >/dev/null 2>&1 ; then
385 echo "Your sh handles # comments correctly."
386 shsharp=true
387 spitshell=cat
388 echo " "
389 echo "Okay, let's see if #! works on this system..."
fe14fcc3
LW
390 if test -f /bsd43/bin/echo; then
391 echo "#!/bsd43/bin/echo hi" > spit.sh
392 else
393 echo "#!/bin/echo hi" > spit.sh
394 fi
395 $eunicefix spit.sh
396 chmod +x spit.sh
397 ./spit.sh > today
91407755
LW
398 if $contains hi today >/dev/null 2>&1; then
399 echo "It does."
400 sharpbang='#!'
401 else
fe14fcc3
LW
402 echo "#! /bin/echo hi" > spit.sh
403 $eunicefix spit.sh
404 chmod +x spit.sh
405 ./spit.sh > today
91407755
LW
406 if test -s today; then
407 echo "It does."
408 sharpbang='#! '
409 else
410 echo "It doesn't."
411 sharpbang=': use '
412 fi
413 fi
414else
415 echo "Your sh doesn't grok # comments--I will strip them later on."
416 shsharp=false
417 echo "exec grep -v '^#'" >spitshell
418 chmod +x spitshell
419 $eunicefix spitshell
420 spitshell=`pwd`/spitshell
421 echo "I presume that if # doesn't work, #! won't work either!"
422 sharpbang=': use '
423fi
424
425: figure out how to guarantee sh startup
426echo " "
427echo "Checking out how to guarantee sh startup..."
428startsh=$sharpbang'/bin/sh'
429echo "Let's see if '$startsh' works..."
fe14fcc3 430cat >start.sh <<EOSS
91407755
LW
431$startsh
432set abc
433test "$?abc" != 1
434EOSS
435
fe14fcc3
LW
436chmod +x start.sh
437$eunicefix start.sh
438if ./start.sh; then
91407755
LW
439 echo "Yup, it does."
440else
441 echo "Nope. You may have to fix up the shell scripts to make sure sh runs them."
442fi
91407755 443
8d063cd8
LW
444: first determine how to suppress newline on echo command
445echo "Checking echo to see how to suppress newlines..."
fe14fcc3
LW
446(echo "hi there\c" ; echo " ") >echotmp
447if $contains c echotmp >/dev/null 2>&1 ; then
8d063cd8
LW
448 echo "...using -n."
449 n='-n'
450 c=''
451else
452 cat <<'EOM'
453...using \c
454EOM
455 n=''
456 c='\c'
457fi
458echo $n "Type carriage return to continue. Your cursor should be here-->$c"
459read ans
8d063cd8
LW
460
461: now set up to do reads with possible shell escape and default assignment
462cat <<EOSC >myread
378cc40b
LW
463case "\$fastread" in
464yes) ans=''; echo " " ;;
465*) ans='!';;
466esac
8d063cd8
LW
467while expr "X\$ans" : "X!" >/dev/null; do
468 read ans
469 case "\$ans" in
470 !)
471 sh
472 echo " "
473 echo $n "\$rp $c"
474 ;;
475 !*)
476 set \`expr "X\$ans" : "X!\(.*\)\$"\`
477 sh -c "\$*"
478 echo " "
479 echo $n "\$rp $c"
480 ;;
481 esac
482done
483rp='Your answer:'
484case "\$ans" in
485'') ans="\$dflt";;
486esac
487EOSC
488
489: general instructions
490cat <<EOH
491
492This installation shell script will examine your system and ask you questions
493to determine how the $package package should be installed. If you get stuck
494on a question, you may use a ! shell escape to start a subshell or execute
495a command. Many of the questions will have default answers in square
496brackets--typing carriage return will give you the default.
497
498On some of the questions which ask for file or directory names you are
499allowed to use the ~name construct to specify the login directory belonging
500to "name", even if you don't have a shell which knows about that. Questions
501where this is allowed will be marked "(~name ok)".
502
503EOH
504rp="[Type carriage return to continue]"
505echo $n "$rp $c"
506. myread
507cat <<EOH
508
fe14fcc3
LW
509Much effort has been expended to ensure that this shell script will run on any
510Unix system. If despite that it blows up on you, your best bet is to edit
16a2aea0 511Configure and run it again. Also, let me (lwall@netlabs.com)
36ce8bec 512know how I blew it. If you can't run Configure for some reason, you'll have
8d063cd8
LW
513to generate a config.sh file by hand.
514
515This installation script affects things in two ways: 1) it may do direct
516variable substitutions on some of the files included in this kit, and
5172) it builds a config.h file for inclusion in C programs. You may edit
518any of these files as the need arises after running this script.
519
520If you make a mistake on a question, there is no easy way to back up to it
521currently. The easiest thing to do is to edit config.sh and rerun all the
522SH files. Configure will offer to let you do this before it runs the SH files.
523
524EOH
525rp="[Type carriage return to continue]"
526echo $n "$rp $c"
527. myread
528
8d063cd8
LW
529: find out where common programs are
530echo " "
531echo "Locating common programs..."
532cat <<EOSC >loc
533$startsh
534case \$# in
5350) exit 1;;
536esac
537thing=\$1
538shift
539dflt=\$1
540shift
541for dir in \$*; do
542 case "\$thing" in
543 .)
544 if test -d \$dir/\$thing; then
545 echo \$dir
546 exit 0
547 fi
548 ;;
549 *)
550 if test -f \$dir/\$thing; then
551 echo \$dir/\$thing
552 exit 0
378cc40b
LW
553 elif test -f \$dir/\$thing.exe; then
554 : on Eunice apparently
555 echo \$dir/\$thing
556 exit 0
8d063cd8
LW
557 fi
558 ;;
559 esac
560done
561echo \$dflt
562exit 1
563EOSC
378cc40b 564chmod +x loc
8d063cd8
LW
565$eunicefix loc
566loclist="
8d063cd8 567cat
8d063cd8 568cp
a687059c
LW
569echo
570expr
571grep
8d063cd8 572mkdir
a687059c
LW
573mv
574rm
575sed
8d063cd8 576sort
a687059c 577tr
8d063cd8 578uniq
8d063cd8
LW
579"
580trylist="
8d063cd8 581Mcc
fe14fcc3 582bison
378cc40b 583cpp
91407755 584csh
a687059c 585egrep
fe14fcc3 586nroff
a687059c 587test
fe14fcc3
LW
588uname
589yacc
8d063cd8 590"
fe14fcc3 591pth=`echo :$boPATH:$PATH:$eoPATH: | sed -e 's/:/ /g'`
8d063cd8 592for file in $loclist; do
e5d73d77 593 xxx=`./loc $file $file $pth`
8d063cd8
LW
594 eval $file=$xxx
595 eval _$file=$xxx
596 case "$xxx" in
597 /*)
598 echo $file is in $xxx.
599 ;;
600 *)
601 echo "I don't know where $file is. I hope it's in everyone's PATH."
602 ;;
603 esac
604done
605echo " "
606echo "Don't worry if any of the following aren't found..."
607ans=offhand
608for file in $trylist; do
e5d73d77 609 xxx=`./loc $file $file $pth`
8d063cd8
LW
610 eval $file=$xxx
611 eval _$file=$xxx
612 case "$xxx" in
613 /*)
614 echo $file is in $xxx.
615 ;;
616 *)
617 echo "I don't see $file out there, $ans."
618 ans=either
619 ;;
620 esac
621done
622case "$egrep" in
623egrep)
624 echo "Substituting grep for egrep."
625 egrep=$grep
626 ;;
627esac
628case "$test" in
629test)
630 echo "Hopefully test is built into your sh."
631 ;;
632/bin/test)
a687059c
LW
633 if sh -c "PATH= test true" >/dev/null 2>&1; then
634 echo "Using the test built into your sh."
635 test=test
636 fi
8d063cd8
LW
637 ;;
638*)
639 test=test
640 ;;
641esac
642case "$echo" in
643echo)
644 echo "Hopefully echo is built into your sh."
645 ;;
646/bin/echo)
647 echo " "
648 echo "Checking compatibility between /bin/echo and builtin echo (if any)..."
fe14fcc3
LW
649 $echo $n "hi there$c" >Loc1.txt
650 echo $n "hi there$c" >Loc2.txt
651 if cmp Loc1.txt Loc2.txt >/dev/null 2>&1; then
8d063cd8
LW
652 echo "They are compatible. In fact, they may be identical."
653 else
654 case "$n" in
655 '-n') n='' c='\c' ans='\c' ;;
656 *) n='-n' c='' ans='-n' ;;
657 esac
658 cat <<FOO
659They are not compatible! You are probably running ksh on a non-USG system.
660I'll have to use /bin/echo instead of the builtin, since Bourne shell doesn't
661have echo built in and we may have to run some Bourne shell scripts. That
662means I'll have to use $ans to suppress newlines now. Life is ridiculous.
663
664FOO
665 rp="Your cursor should be here-->"
666 $echo $n "$rp$c"
667 . myread
668 fi
8d063cd8
LW
669 ;;
670*)
671 : cross your fingers
672 echo=echo
673 ;;
674esac
8d063cd8 675
a687059c
LW
676: set up shell script to do ~ expansion
677cat >filexp <<EOSS
678$startsh
679: expand filename
680case "\$1" in
681 ~/*|~)
682 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
683 ;;
684 ~*)
685 if $test -f /bin/csh; then
686 /bin/csh -f -c "glob \$1"
687 echo ""
36ce8bec 688 else
a687059c
LW
689 name=\`$expr x\$1 : '..\([^/]*\)'\`
690 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
691 if $test ! -d "\$dir"; then
692 me=\`basename \$0\`
693 echo "\$me: can't locate home directory for: \$name" >&2
694 exit 1
36ce8bec 695 fi
a687059c
LW
696 case "\$1" in
697 */*)
698 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
699 ;;
700 *)
701 echo \$dir
702 ;;
703 esac
13281fa4
LW
704 fi
705 ;;
a687059c
LW
706*)
707 echo \$1
708 ;;
13281fa4 709esac
a687059c
LW
710EOSS
711chmod +x filexp
712$eunicefix filexp
13281fa4 713
16a2aea0
LW
714: get old answers, if there is a config file out there
715hint=default
716if test -f ../config.sh; then
717 echo " "
132b68a5
LW
718 eval "`grep lastuname ../config.sh`"
719 tmp=`(uname -a) 2>&1`
720 if test "X$tmp" = "X$lastuname"; then
16a2aea0
LW
721 dflt=y
722 else
723 dflt=n
724 fi
132b68a5 725 lastuname="$tmp"
16a2aea0
LW
726 rp="I see a config.sh file. Did Configure make it on THIS system? [$dflt]"
727 echo $n "$rp $c"
728 . myread
729 case "$ans" in
730 n*) echo "OK, I'll ignore it."; mv ../config.sh ../config.sh.old;;
731 *) echo "Fetching default answers from your old config.sh file..."
732 tmp="$n"
733 ans="$c"
734 . ../config.sh
735 n="$tmp"
736 c="$ans"
737 hint=previous
738 ;;
739 esac
740fi
741if test -d ../hints && test ! -f ../config.sh; then
742 echo ' '
743 echo "First time through, eh? I have some defaults handy for the following systems:"
744 (cd ../hints; ls -C *.sh | sed 's/\.sh/ /g')
745 dflt=''
746 : Half the following guesses are probably wrong...
747 test -f /irix && dflt="$dflt sgi"
748 test -f /xenix && dflt="$dflt sco_xenix"
749 test -f /dynix && dflt="$dflt dynix"
750 test -f /dnix && dflt="$dflt dnix"
751 test -f /bin/mips && /bin/mips && dflt="$dflt mips"
132b68a5 752 test -d /NextApps && test -f /usr/adm/software_version && dflt="$dflt next"
16a2aea0
LW
753 if test -f /bin/uname || test -f /usr/bin/uname; then
754 set `uname -a | tr '[A-Z]' '[a-z]'`
755
756 test -f "../hints/$5.sh" && dflt="$dflt $5"
757
758 case "$5" in
759 3b2) dflt="$dflt 3b2";;
760 fps*) dflt="$dflt fps";;
761 mips*) dflt="$dflt mips";;
762 [23]100) dflt="$dflt mips";;
763 next*) dflt="$dflt next" ;;
764 esac
765
766 case "$1" in
767 aix) dflt="$dflt aix_rs" ;;
768 sunos) case "$3" in
769 3.4) dflt="$dflt sunos_3_4" ;;
770 3.5) dflt="$dflt sunos_3_5" ;;
771 4.0.1) dflt="$dflt sunos_4_0_1" ;;
772 4.0.2) dflt="$dflt sunos_4_0_2" ;;
773 esac
774 ;;
775 dnix) dflt="$dflt dnix" ;;
776 genix) dflt="$dflt genix" ;;
777 hp*ux) dflt="$dflt hpux" ;;
778 next) dflt="$dflt next" ;;
779 irix) dflt="$dflt sgi" ;;
780 ultrix) case "$3" in
781 3*) dflt="$dflt ultrix_3" ;;
782 4*) dflt="$dflt ultrix_4" ;;
783 esac
784 ;;
785 uts) dflt="$dflt uts" ;;
786 $2) if test -f /etc/systemid; then
787 set `echo $3 | sed 's/\./ /` $4
788 if test -f ../hints/sco_$1_$2_$3.sh; then
789 dflt="$dflt sco_$1_$2_$3"
790 elif test -f ../hints/sco_$1_$2.sh; then
791 dflt="$dflt sco_$1_$2"
792 elif test -f ../hints/sco_$1.sh; then
793 dflt="$dflt sco_$1"
794 fi
795 fi
796 ;;
797 esac
798 fi
799 set X `echo $dflt | tr ' ' '\012' | sort | uniq`
800 shift
801 dflt=${1+"$@"}
802 case "$dflt" in
803 '') dflt=none;;
804 esac
132b68a5
LW
805 echo '(You may give one or more space-separated answers, or "none" if appropriate.'
806 echo 'If your OS version has no hints, do not give a wrong version--say "none".)'
16a2aea0
LW
807 rp="Which of these apply, if any? [$dflt]"
808 echo $n "$rp $c"
809 . myread
810 for file in $ans; do
811 if test -f ../hints/$file.sh; then
812 . ../hints/$file.sh
132b68a5 813 cat ../hints/$file.sh >>../config.sh
16a2aea0
LW
814 hint=recommended
815 fi
816 done
817fi
818
819cat >whoa <<'EOF'
820eval "was=\$$2"
821dflt=y
822echo ' '
823echo "*** WHOA THERE!!! ***"
824echo " The $hint value for \$$2 on this machine was \"$was\"!"
825rp=" Keep the $hint value? [y]"
826echo $n "$rp $c"
827. myread
828case "$ans" in
829y) td=$was; tu=$was;;
830esac
831EOF
832
833setvar='td=$define; tu=$undef; set X $1; eval "was=\$$2";
834case "$val$was" in
835defineundef) . whoa; eval "$2=\$td";;
836undefdefine) . whoa; eval "$2=\$tu";;
837*) eval "$2=$val";;
838esac'
839
a687059c
LW
840: determine where manual pages go
841$cat <<EOM
842
fe14fcc3 843$package has manual pages available in source form.
a687059c 844EOM
fe14fcc3
LW
845case "$nroff" in
846'')
847 echo "However, you don't have nroff, so they're probably useless to you."
848 case "$mansrc" in
849 '')
850 mansrc="none"
851 ;;
852 esac
853esac
854echo "If you don't want the manual sources installed, answer 'none'."
a687059c
LW
855case "$mansrc" in
856'')
fe14fcc3 857 dflt=`./loc . none /usr/man/local/man1 /usr/man/man.L /usr/man/manl /usr/man/mann /usr/man/u_man/man1 /usr/man/man1`
a687059c
LW
858 ;;
859*) dflt="$mansrc"
860 ;;
861esac
862cont=true
863while $test "$cont" ; do
864 echo " "
fe14fcc3 865 rp="Where do the manual pages (source) go (~name ok)? [$dflt]"
a687059c
LW
866 $echo $n "$rp $c"
867 . myread
fe14fcc3
LW
868 case "$ans" in
869 'none')
870 mansrc=''
a687059c 871 cont=''
fe14fcc3
LW
872 ;;
873 *)
874 mansrc=`./filexp "$ans"`
875 if $test -d "$mansrc"; then
876 cont=''
877 else
878 if $test "$fastread" = yes; then
879 dflt=y
880 else
881 dflt=n
882 fi
883 rp="Directory $mansrc doesn't exist. Use that name anyway? [$dflt]"
884 $echo $n "$rp $c"
885 . myread
886 dflt=''
887 case "$ans" in
888 y*) cont='';;
889 esac
890 fi
891 ;;
892 esac
a687059c
LW
893done
894case "$mansrc" in
fe14fcc3
LW
895'')
896 manext=''
897 ;;
a687059c
LW
898*l)
899 manext=l
900 ;;
901*n)
902 manext=n
903 ;;
904*o)
905 manext=l
906 ;;
907*p)
fe14fcc3 908 manext=n
a687059c
LW
909 ;;
910*C)
911 manext=C
912 ;;
913*L)
914 manext=L
915 ;;
916*)
917 manext=1
918 ;;
919esac
920
fe14fcc3 921: Sigh. Well, at least the box is fast...
91407755
LW
922echo " "
923$echo $n "Hmm... $c"
fe14fcc3
LW
924case "$usrinclude" in
925'') dflt='/usr/include';;
926*) dflt=$usrinclude;;
927esac
928inclPath=''
929if $test -f /bin/mips && /bin/mips; then
930 echo "Looks like a MIPS system..."
931 $cat >usrinclude.c <<'EOCP'
932#ifdef SYSTYPE_BSD43
933/bsd43
934#endif
935EOCP
936 if cc -E usrinclude.c > usrinclude.out && $contains / usrinclude.out >/dev/null 2>&1 ; then
937 echo "and you're compiling with the BSD43 compiler and libraries."
938 dflt='/bsd43/usr/include'
939 inclPath='/bsd43'
940 else
941 echo "and you're compiling with the SysV compiler and libraries."
942 fi
943else
944 echo "Doesn't look like a MIPS system."
945 echo "exit 1" >mips
946 chmod +x mips
947 $eunicefix mips
948fi
949
950cont=true
951while $test "$cont" ; do
952 echo " "
953 rp="Where are the include files you want to use? [$dflt]"
954 $echo $n "$rp $c"
955 . myread
956 usrinclude="$ans"
957 if $test -d $ans; then
958 cont=''
959 else
960 if $test "$fastread" = yes; then
961 dflt=y
962 else
963 dflt=n
964 fi
965 rp="Directory $ans doesn't exist. Use that name anyway? [$dflt]"
966 $echo $n "$rp $c"
967 . myread
968 dflt=''
969 case "$ans" in
970 y*) cont='';;
971 esac
972 fi
973done
974
975: make some quick guesses about what we are up against
976echo " "
977cat $usrinclude/signal.h $usrinclude/sys/signal.h >guess.txt 2>/dev/null
978if test "$usrinclude" = "/bsd43/usr/include" ; then
979 echo "Looks kind of like a SysV MIPS running BSD, but we'll see..."
980 echo exit 0 >bsd
981 echo exit 1 >usg
982 echo exit 1 >v7
983elif test `echo abc | tr a-z A-Z` = Abc ; then
91407755
LW
984 echo "Looks kind of like a USG system, but we'll see..."
985 echo exit 1 >bsd
986 echo exit 0 >usg
987 echo exit 1 >v7
fe14fcc3 988elif $contains SIGTSTP guess.txt >/dev/null 2>&1 ; then
91407755
LW
989 echo "Looks kind of like a BSD system, but we'll see..."
990 echo exit 0 >bsd
991 echo exit 1 >usg
992 echo exit 1 >v7
993else
994 echo "Looks kind of like a version 7 system, but we'll see..."
995 echo exit 1 >bsd
996 echo exit 1 >usg
997 echo exit 0 >v7
998fi
999case "$eunicefix" in
1000*unixtovms*)
1001 cat <<'EOI'
1002There is, however, a strange, musty smell in the air that reminds me of
1003something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
1004EOI
1005 echo "exit 0" >eunice
1006 d_eunice="$define"
1007 ;;
1008*)
1009 echo " "
1010 echo "Congratulations. You aren't running Eunice."
1011 d_eunice="$undef"
1012 echo "exit 1" >eunice
1013 ;;
1014esac
1015if test -f /xenix; then
1016 echo "Actually, this looks more like a XENIX system..."
1017 echo "exit 0" >xenix
1018else
1019 echo " "
1020 echo "It's not Xenix..."
1021 echo "exit 1" >xenix
1022fi
1023chmod +x xenix
1024$eunicefix xenix
1025if test -f /venix; then
1026 echo "Actually, this looks more like a VENIX system..."
1027 echo "exit 0" >venix
1028else
1029 echo " "
1030 if xenix; then
1031 : null
1032 else
1033 echo "Nor is it Venix..."
1034 fi
1035 echo "exit 1" >venix
1036fi
1037chmod +x bsd usg v7 eunice venix
1038$eunicefix bsd usg v7 eunice venix
91407755 1039
a687059c
LW
1040: see what memory models we can support
1041case "$models" in
1042'')
1043 : We may not use Cppsym or we get a circular dependency through cc.
1044 : But this should work regardless of which cc we eventually use.
1045 cat >pdp11.c <<'EOP'
1046main() {
1047#ifdef pdp11
1048 exit(0);
1049#else
1050 exit(1);
1051#endif
1052}
1053EOP
1054 cc -o pdp11 pdp11.c >/dev/null 2>&1
1055 if pdp11 2>/dev/null; then
1056 dflt='unsplit split'
1057 else
e5d73d77 1058 ans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
a687059c
LW
1059 case "$ans" in
1060 X) dflt='none';;
1061 *) if $test -d /lib/small || $test -d /usr/lib/small; then
1062 dflt='small'
1063 else
1064 dflt=''
1065 fi
1066 if $test -d /lib/medium || $test -d /usr/lib/medium; then
1067 dflt="$dflt medium"
1068 fi
1069 if $test -d /lib/large || $test -d /usr/lib/large; then
1070 dflt="$dflt large"
1071 fi
1072 if $test -d /lib/huge || $test -d /usr/lib/huge; then
1073 dflt="$dflt huge"
1074 fi
1075 esac
1076 fi
1077 ;;
1078*) dflt="$models" ;;
1079esac
1080$cat <<EOM
1081
1082Some systems have different model sizes. On most systems they are called
1083small, medium, large, and huge. On the PDP11 they are called unsplit and
1084split. If your system doesn't support different memory models, say "none".
1085If you wish to force everything to one memory model, say "none" here and
1086put the appropriate flags later when it asks you for other cc and ld flags.
1087Venix systems may wish to put "none" and let the compiler figure things out.
1088(In the following question multiple model names should be space separated.)
1089
1090EOM
1091rp="Which models are supported? [$dflt]"
1092$echo $n "$rp $c"
1093. myread
1094models="$ans"
1095
1096case "$models" in
1097none)
1098 small=''
1099 medium=''
1100 large=''
1101 huge=''
1102 unsplit=''
1103 split=''
1104 ;;
1105*split)
1106 case "$split" in
1107 '')
1108 if $contains '\-i' $mansrc/man1/ld.1 >/dev/null 2>&1 || \
1109 $contains '\-i' $mansrc/man1/cc.1 >/dev/null 2>&1; then
1110 dflt='-i'
1111 else
1112 dflt='none'
1113 fi
1114 ;;
1115 *) dflt="$split";;
1116 esac
1117 rp="What flag indicates separate I and D space? [$dflt]"
1118 $echo $n "$rp $c"
1119 . myread
1120 case "$ans" in
1121 none) ans='';;
1122 esac
1123 split="$ans"
1124 unsplit=''
1125 ;;
1126*large*|*small*|*medium*|*huge*)
1127 case "$models" in
1128 *large*)
1129 case "$large" in
1130 '') dflt='-Ml';;
1131 *) dflt="$large";;
1132 esac
1133 rp="What flag indicates large model? [$dflt]"
1134 $echo $n "$rp $c"
1135 . myread
1136 case "$ans" in
1137 none) ans='';
1138 esac
1139 large="$ans"
1140 ;;
1141 *) large='';;
1142 esac
1143 case "$models" in
1144 *huge*)
1145 case "$huge" in
1146 '') dflt='-Mh';;
1147 *) dflt="$huge";;
1148 esac
1149 rp="What flag indicates huge model? [$dflt]"
1150 $echo $n "$rp $c"
1151 . myread
1152 case "$ans" in
1153 none) ans='';
1154 esac
1155 huge="$ans"
1156 ;;
1157 *) huge="$large";;
1158 esac
1159 case "$models" in
1160 *medium*)
1161 case "$medium" in
1162 '') dflt='-Mm';;
1163 *) dflt="$medium";;
1164 esac
1165 rp="What flag indicates medium model? [$dflt]"
1166 $echo $n "$rp $c"
1167 . myread
1168 case "$ans" in
1169 none) ans='';
1170 esac
1171 medium="$ans"
1172 ;;
1173 *) medium="$large";;
1174 esac
1175 case "$models" in
1176 *small*)
1177 case "$small" in
1178 '') dflt='none';;
1179 *) dflt="$small";;
1180 esac
1181 rp="What flag indicates small model? [$dflt]"
1182 $echo $n "$rp $c"
1183 . myread
1184 case "$ans" in
1185 none) ans='';
1186 esac
1187 small="$ans"
1188 ;;
1189 *) small='';;
1190 esac
1191 ;;
1192*)
1193 echo "Unrecognized memory models--you may have to edit Makefile.SH"
1194 ;;
1195esac
1196
1197: see if we need a special compiler
1198echo " "
1199if usg; then
1200 case "$cc" in
1201 '')
1202 case "$Mcc" in
1203 /*) dflt='Mcc'
1204 ;;
1205 *)
1206 case "$large" in
1207 -M*)
1208 dflt='cc'
1209 ;;
1210 *)
1211 if $contains '\-M' $mansrc/cc.1 >/dev/null 2>&1 ; then
1212 dflt='cc -M'
1213 else
1214 dflt='cc'
1215 fi
1216 ;;
1217 esac
1218 ;;
1219 esac
1220 ;;
1221 *) dflt="$cc";;
1222 esac
1223 $cat <<'EOM'
1224
1225On some systems the default C compiler will not resolve multiple global
1226references that happen to have the same name. On some such systems the
1227"Mcc" command may be used to force these to be resolved. On other systems
1228a "cc -M" command is required. (Note that the -M flag on other systems
1229indicates a memory model to use!) If you have the Gnu C compiler, you
1230might wish to use that instead. What command will force resolution on
1231EOM
1232 $echo $n "this system? [$dflt] $c"
1233 rp="Command to resolve multiple refs? [$dflt]"
1234 . myread
1235 cc="$ans"
1236else
1237 case "$cc" in
1238 '') dflt=cc;;
1239 *) dflt="$cc";;
1240 esac
1241 rp="Use which C compiler? [$dflt]"
1242 $echo $n "$rp $c"
1243 . myread
1244 cc="$ans"
1245fi
1246case "$cc" in
132b68a5
LW
1247gcc*) cpp=`./loc gcc-cpp $cpp $pth`
1248 case "$nativegcc" in
1249 '') case "$ccflags" in
1250 *-fpcc-struct-return*) dflt=n;;
1251 *) dflt=y;;
1252 esac
1253 ;;
1254 undef) dflt=n;;
1255 *) dflt=y;;
1256 esac
1257 echo " "
1258 rp="Are your system (especially dbm) libraries compiled with gcc? [$dflt]"
1259 $echo $n "$rp $c"
1260 . myread
1261 case "$ans" in
1262 n*) nativegcc="$undef"; gccflags='-fpcc-struct-return';;
1263 *) nativegcc="$define"; gccflags='';;
1264 esac
1265 ;;
a687059c
LW
1266esac
1267
1268: determine optimize, if desired, or use for debug flag also
1269case "$optimize" in
1270' ') dflt="none"
1271 ;;
1272'') dflt="-O";
1273 ;;
1274*) dflt="$optimize"
1275 ;;
1276esac
1277cat <<EOH
91407755 1278
a687059c
LW
1279Some C compilers have problems with their optimizers, by default, $package
1280compiles with the -O flag to use the optimizer. Alternately, you might
1281want to use the symbolic debugger, which uses the -g flag (on traditional
1282Unix systems). Either flag can be specified here. To use neither flag,
1283specify the word "none".
1284
1285EOH
1286rp="What optimizer/debugger flag should be used? [$dflt]"
1287$echo $n "$rp $c"
1288. myread
1289optimize="$ans"
1290case "$optimize" in
1291'none') optimize=" "
1292 ;;
1293esac
1294
1295case "$ccflags" in
1296'') case "$cc" in
132b68a5 1297 *gcc*) dflt="$gccflags";;
0d3e774c 1298 *) dflt='';;
a687059c
LW
1299 esac
1300 ;;
132b68a5
LW
1301*-fpcc-struct-return*) dflt="$ccflags";;
1302*) case "$cc" in
1303 *gcc*) dflt="$ccflags $gccflags";;
1304 *) dflt="$ccflags";;
1305 esac
1306 ;;
a687059c 1307esac
0d3e774c
LW
1308for thisincl in $inclwanted; do
1309 if test -d $thisincl; then
fe14fcc3
LW
1310 if test "x$thisincl" != "x$usrinclude"; then
1311 case "$dflt" in
1312 *$thisincl*);;
1313 *) dflt="$dflt -I$thisincl";;
1314 esac
1315 fi
0d3e774c
LW
1316 fi
1317done
91407755
LW
1318case "$optimize" in
1319-g*)
1320 case "$dflt" in
1321 *DEBUGGING*);;
1322 *) dflt="$dflt -DDEBUGGING";;
1323 esac
1324 ;;
1325esac
fe14fcc3 1326if $contains 'LANGUAGE_C' $usrinclude/signal.h >/dev/null 2>&1; then
449aadca
LW
1327 case "$dflt" in
1328 *LANGUAGE_C*);;
1329 *) dflt="$dflt -DLANGUAGE_C";;
1330 esac
1331fi
16a2aea0
LW
1332if $contains '_NO_PROTO' $usrinclude/signal.h >/dev/null 2>&1; then
1333 case "$dflt" in
1334 *_NO_PROTO*);;
1335 *) dflt="$dflt -D_NO_PROTO";;
1336 esac
1337fi
0d3e774c
LW
1338case "$dflt" in
1339'') dflt=none;;
1340esac
91407755
LW
1341cat <<EOH
1342
1343Your C compiler may want other flags. For this question you should
1344include -I/whatever and -DWHATEVER flags and any other flags used by
1345the C compiler, but you should NOT include libraries or ld flags like
1346-lwhatever. To use no flags, specify the word "none".
1347
1348EOH
a687059c
LW
1349rp="Any additional cc flags? [$dflt]"
1350$echo $n "$rp $c"
1351. myread
1352case "$ans" in
1353none) ans='';
1354esac
1355ccflags="$ans"
1356
91407755
LW
1357: the following weeds options from ccflags that are of no interest to cpp
1358cppflags="$ccflags"
1359case "$cc" in
1360*gcc*) cppflags="$cppflags -D__GNUC__";;
1361esac
1362case "$cppflags" in
1363'');;
1364*) set X $cppflags
1365 cppflags=''
1366 for flag do
1367 case $flag in
132b68a5 1368 -D*|-U*|-I*|-traditional|-ansi|-nostdinc) cppflags="$cppflags $flag";;
91407755
LW
1369 esac
1370 done
1371 case "$cppflags" in
1372 *-*) echo "(C preprocessor flags: $cppflags)";;
1373 esac
1374 ;;
1375esac
1376
a687059c
LW
1377case "$ldflags" in
1378'') if venix; then
1379 dflt='-i -z'
1380 else
1381 dflt='none'
1382 fi
1383 ;;
1384*) dflt="$ldflags";;
1385esac
1386echo " "
1387rp="Any additional ld flags (NOT including libraries)? [$dflt]"
1388$echo $n "$rp $c"
1389. myread
1390case "$ans" in
1391none) ans='';
1392esac
1393ldflags="$ans"
a687059c 1394
91407755
LW
1395echo " "
1396echo "Checking for optional libraries..."
fe14fcc3 1397case "$libs" in
16a2aea0
LW
1398'') dflt=' ';;
1399*) dflt="$libs ";;
fe14fcc3 1400esac
91407755
LW
1401case "$libswanted" in
1402'') libswanted='c_s';;
1403esac
1404for thislib in $libswanted; do
d8f2e4cc
LW
1405 case "$thislib" in
1406 dbm) thatlib=ndbm;;
1407 *_s) thatlib=NONE;;
1408 *) thatlib="${thislib}_s";;
1409 *) thatlib=NONE;;
1410 esac
fe14fcc3 1411 xxx=`./loc lib$thislib.a X /usr/ccs/lib /usr/lib /usr/ucblib /usr/local/lib /lib`
0d3e774c 1412 if test -f $xxx; then
91407755
LW
1413 echo "Found -l$thislib."
1414 case "$dflt" in
16a2aea0
LW
1415 *"-l$thislib "*|*"-l$thatlib "*);;
1416 *) dflt="$dflt -l$thislib ";;
91407755 1417 esac
91407755 1418 else
e5d73d77 1419 xxx=`./loc lib$thislib.a X $libpth`
0d3e774c
LW
1420 if test -f $xxx; then
1421 echo "Found $xxx."
1422 case "$dflt" in
16a2aea0
LW
1423 *"$xxx "*);;
1424 *) dflt="$dflt $xxx ";;
0d3e774c
LW
1425 esac
1426 else
e5d73d77 1427 xxx=`./loc Slib$thislib.a X $xlibpth`
0d3e774c
LW
1428 if test -f $xxx; then
1429 echo "Found -l$thislib."
1430 case "$dflt" in
16a2aea0
LW
1431 *"-l$thislib "*|*"-l$thatlib "*);;
1432 *) dflt="$dflt -l$thislib ";;
0d3e774c
LW
1433 esac
1434 else
16a2aea0
LW
1435 xxx=`./loc lib$thislib.so X /usr/ccs/lib /usr/lib /usr/ucblib /usr/local/lib /lib`
1436 if test -f $xxx; then
1437 echo "Found -l$thislib as a shared object only."
1438 case "$dflt" in
1439 *"-l$thislib "*|*"-l$thatlib "*);;
1440 *) dflt="$dflt -l$thislib ";;
1441 esac
1442 else
1443 echo "No -l$thislib."
1444 fi
0d3e774c
LW
1445 fi
1446 fi
91407755
LW
1447 fi
1448done
1449set X $dflt
1450shift
1451dflt="$*"
1452case "$dflt" in
1453'') dflt='none';;
1454esac
a687059c
LW
1455
1456$cat <<EOM
1457
1458Some versions of Unix support shared libraries, which make
1459executables smaller but make load time slightly longer.
1460
1461On some systems, mostly newer Unix System V's, the shared library
1462is included by putting the option "-lc_s" as the last thing on the
1463cc command line when linking. Other systems use shared libraries
1464by default. There may be other libraries needed to compile $package
1465on your machine as well. If your system needs the "-lc_s" option,
1466include it here. Include any other special libraries here as well.
d8f2e4cc 1467Say "none" for none.
a687059c
LW
1468EOM
1469
1470echo " "
1471rp="Any additional libraries? [$dflt]"
1472$echo $n "$rp $c"
1473. myread
1474case "$ans" in
1475none) ans='';
1476esac
1477libs="$ans"
1478
7e1cf235
LW
1479: check for size of random number generator
1480echo " "
1481case "$alignbytes" in
1482'')
1483 echo "Checking alignment constraints..."
1484 $cat >try.c <<'EOCP'
1485struct foobar {
1486 char foo;
1487 double bar;
1488} try;
1489main()
1490{
1491 printf("%d\n", (char*)&try.bar - (char*)&try.foo);
1492}
1493EOCP
1494 if $cc $ccflags try.c -o try >/dev/null 2>&1 ; then
1495 dflt=`./try`
1496 else
1497 dflt='?'
1498 echo "(I can't seem to compile the test program...)"
1499 fi
1500 ;;
1501*)
1502 dflt="$alignbytes"
1503 ;;
1504esac
1505rp="Doubles must be aligned on a how-many-byte boundary? [$dflt]"
1506$echo $n "$rp $c"
1507. myread
1508alignbytes="$ans"
1509$rm -f try.c try
1510
1511: determine where public executables go
fe14fcc3
LW
1512cat <<EOF
1513
1514The following questions distinguish the directory in which executables
1515reside from the directory in which they are installed (and from which they
1516are presumably copied to the former directory by occult means). This
1517distinction is often necessary under afs. On most other systems, however,
1518the two directories are the same.
1519
1520EOF
7e1cf235
LW
1521case "$bin" in
1522'')
fe14fcc3 1523 dflt=`./loc . /usr/local/bin /usr/local/bin /usr/lbin /usr/local /usr/bin /bin`
7e1cf235
LW
1524 ;;
1525*) dflt="$bin"
1526 ;;
1527esac
1528cont=true
1529while $test "$cont" ; do
fe14fcc3 1530 rp="In which directory will public executables reside (~name ok)? [$dflt]"
16a2aea0
LW
1531 $echo "In which directory will public executables reside (~name ok)?"
1532 $echo $n "[$dflt] $c"
7e1cf235
LW
1533 . myread
1534 bin="$ans"
fe14fcc3 1535 bin=`./filexp $bin`
7e1cf235
LW
1536 if test -d $bin; then
1537 cont=''
1538 else
1539 case "$fastread" in
1540 yes) dflt=y;;
1541 *) dflt=n;;
1542 esac
1543 rp="Directory $bin doesn't exist. Use that name anyway? [$dflt]"
1544 $echo $n "$rp $c"
1545 . myread
1546 dflt=''
1547 case "$ans" in
1548 y*) cont='';;
1549 esac
1550 fi
1551done
1552
fe14fcc3
LW
1553case "$installbin" in
1554'')
1555 dflt=`echo $bin | sed 's#^/afs/#/afs/.#'`
132b68a5 1556 test -d $dflt || dflt="$bin"
fe14fcc3
LW
1557 ;;
1558*) dflt="$installbin"
1559 ;;
1560esac
1561cont=true
1562while $test "$cont" ; do
1563 rp="In which directory will public executables be installed (~name ok)? [$dflt]"
16a2aea0
LW
1564 $echo "In which directory will public executables be installed (~name ok)?"
1565 $echo $n "[$dflt] $c"
fe14fcc3
LW
1566 . myread
1567 installbin="$ans"
1568 installbin=`./filexp $installbin`
1569 if test -d $installbin; then
1570 cont=''
1571 else
1572 case "$fastread" in
1573 yes) dflt=y;;
1574 *) dflt=n;;
1575 esac
1576 rp="Directory $installbin doesn't exist. Use that name anyway? [$dflt]"
1577 $echo $n "$rp $c"
1578 . myread
1579 dflt=''
1580 case "$ans" in
1581 y*) cont='';;
1582 esac
1583 fi
1584done
1585
a687059c
LW
1586: check for ordering of bytes in a long
1587case "$byteorder" in
1588'')
1589cat <<'EOM'
1590
1591In the following, larger digits indicate more significance. A big-endian
1592machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
1593little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
91407755
LW
1594machines may have weird orders like 3412. A Cray will report 87654321. If
1595the test program works the default is probably right.
1596I'm now running the test program...
a687059c 1597EOM
fe14fcc3 1598 $cat >byteorder.c <<'EOCP'
a687059c
LW
1599#include <stdio.h>
1600main()
1601{
1602 int i;
1603 union {
1604 unsigned long l;
0d3e774c 1605 char c[sizeof(long)];
a687059c
LW
1606 } u;
1607
0d3e774c 1608 if (sizeof(long) > 4)
fe14fcc3 1609 u.l = (0x08070605 << 32) | 0x04030201;
0d3e774c
LW
1610 else
1611 u.l = 0x04030201;
91407755
LW
1612 for (i=0; i < sizeof(long); i++)
1613 printf("%c",u.c[i]+'0');
1614 printf("\n");
a687059c
LW
1615}
1616EOCP
fe14fcc3
LW
1617 if $cc byteorder.c -o byteorder >/dev/null 2>&1 ; then
1618 dflt=`./byteorder`
a687059c 1619 case "$dflt" in
91407755 1620 ????|????????) echo "(The test program ran ok.)";;
a687059c
LW
1621 *) echo "(The test program didn't run right for some reason.)";;
1622 esac
1623 else
1624 dflt='4321'
1625 echo "(I can't seem to compile the test program. Guessing big-endian...)"
1626 fi
1627 ;;
1628*)
1629 echo " "
1630 dflt="$byteorder"
1631 ;;
1632esac
1633rp="What is the order of bytes in a long? [$dflt]"
1634$echo $n "$rp $c"
1635. myread
1636byteorder="$ans"
a687059c 1637
7e1cf235
LW
1638: check for ability to cast negative floats to unsigned
1639echo " "
1640echo 'Checking to see if your C compiler can cast weird floats to unsigned'
1641$cat >try.c <<'EOCP'
fe14fcc3
LW
1642#include <signal.h>
1643
132b68a5
LW
1644blech() { exit(3); }
1645
7e1cf235
LW
1646main()
1647{
1648 double f = -123;
1649 unsigned long along;
1650 unsigned int aint;
1651 unsigned short ashort;
1652 int result = 0;
1653
132b68a5 1654 signal(SIGFPE, blech);
7e1cf235
LW
1655 along = (unsigned long)f;
1656 aint = (unsigned int)f;
1657 ashort = (unsigned short)f;
1658 if (along != (unsigned long)-123)
1659 result |= 1;
1660 if (aint != (unsigned int)-123)
1661 result |= 1;
1662 if (ashort != (unsigned short)-123)
1663 result |= 1;
1664 f = (double)0x40000000;
1665 f = f + f;
fe14fcc3 1666 along = 0;
7e1cf235
LW
1667 along = (unsigned long)f;
1668 if (along != 0x80000000)
1669 result |= 2;
1670 f -= 1;
fe14fcc3 1671 along = 0;
7e1cf235
LW
1672 along = (unsigned long)f;
1673 if (along != 0x7fffffff)
1674 result |= 1;
1675 f += 2;
fe14fcc3 1676 along = 0;
7e1cf235
LW
1677 along = (unsigned long)f;
1678 if (along != 0x80000001)
1679 result |= 2;
1680 exit(result);
1681}
1682EOCP
fe14fcc3
LW
1683if $cc -o try $ccflags try.c >/dev/null 2>&1; then
1684 ./try
1685 castflags=$?
1686else
1687 castflags=3
1688fi
27e2fb84 1689case "$castflags" in
16a2aea0 16900) val="$define"
7e1cf235 1691 echo "Yup, it does."
27e2fb84 1692 ;;
16a2aea0 1693*) val="$undef"
7e1cf235 1694 echo "Nope, it doesn't."
27e2fb84
LW
1695 ;;
1696esac
16a2aea0
LW
1697set d_castneg
1698eval $setvar
7e1cf235
LW
1699$rm -f try.*
1700
a687059c
LW
1701: see how we invoke the C preprocessor
1702echo " "
1703echo "Now, how can we feed standard input to your C preprocessor..."
1704cat <<'EOT' >testcpp.c
1705#define ABC abc
1706#define XYZ xyz
1707ABC.XYZ
1708EOT
132b68a5
LW
1709
1710cd ..
1711echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
1712chmod 755 cppstdin
1713wrapper=`pwd`/cppstdin
1714cd UU
1715
1716if test "X$cppstdin" != "X" && \
1717 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
1718 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1719 echo "You used to use $cppstdin $cppminus so we'll use that again."
1720elif test "$cc" = gcc && \
1721 (echo "Using gcc, eh? We'll try to force gcc -E using a wrapper..."; \
1722 $wrapper <testcpp.c >testcpp.out 2>&1; \
1723 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1) ; then
1724 echo "Yup, we can."
1725 cppstdin="$wrapper"
1726 cppminus='';
1727elif echo 'Maybe "'"$cc"' -E" will work...'; \
1728 $cc -E <testcpp.c >testcpp.out 2>&1; \
1729 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1730 echo "Yup, it does."
1731 cppstdin="$cc -E"
1732 cppminus='';
1733elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
1734 $cc -E - <testcpp.c >testcpp.out 2>&1; \
1735 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
a687059c
LW
1736 echo "Yup, it does."
1737 cppstdin="$cc -E"
132b68a5
LW
1738 cppminus='-';
1739elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
1740 $wrapper <testcpp.c >testcpp.out 2>&1; \
1741 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1742 cppstdin="$wrapper"
1743 cppminus=''
1744 echo "Eureka!."
1745elif echo 'No such luck, maybe "'$cpp'" will work...'; \
1746 $cpp <testcpp.c >testcpp.out 2>&1; \
1747 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1748 echo "It works!"
1749 cppstdin="$cpp"
1750 cppminus='';
1751elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
1752 $cpp - <testcpp.c >testcpp.out 2>&1; \
1753 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1754 echo "Hooray, it works! I was beginning to wonder."
1755 cppstdin="$cpp"
1756 cppminus='-';
1757elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
1758 $cc -P <testcpp.c >testcpp.out 2>&1; \
1759 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1760 echo "Yipee, that works!"
1761 cppstdin="$cc -P"
a687059c 1762 cppminus='';
132b68a5
LW
1763elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
1764 $cc -P - <testcpp.c >testcpp.out 2>&1; \
1765 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1766 echo "At long last!"
1767 cppstdin="$cc -P"
1768 cppminus='-';
a687059c 1769else
132b68a5
LW
1770 dflt=blurfl
1771 $echo $n "No dice. I can't find a C preprocessor. Name one: $c"
1772 rp='Name a C preprocessor:'
1773 . myread
1774 cppstdin="$ans"
1775 $cppstdin <testcpp.c >testcpp.out 2>&1
a687059c 1776 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
132b68a5 1777 echo "OK, that will do."
a687059c 1778 else
132b68a5
LW
1779 echo "Sorry, I can't get that to work. Go find one and rerun Configure."
1780 exit 1
a687059c
LW
1781 fi
1782fi
a687059c 1783
91407755
LW
1784: get list of predefined functions in a handy place
1785echo " "
1786case "$libc" in
1787'') libc=unknown;;
1788esac
fe14fcc3
LW
1789case "$nm_opts" in
1790'') if test -f /mach_boot; then
1791 nm_opts=''
1792 elif test -d /usr/ccs/lib; then
1793 nm_opts='-p'
1794 else
1795 nm_opts=''
1796 fi
1797 ;;
1798esac
1799: on mips, we DO NOT want /lib, and we want inclPath/usr/lib
91407755 1800case "$libpth" in
fe14fcc3
LW
1801'') if mips; then
1802 libpth='$inclPath/usr/lib /usr/local/lib'
1803 nm_opts="-B"
1804 else
1805 libpth='/usr/ccs/lib /lib /usr/lib /usr/ucblib /usr/local/lib'
1806 fi
1807 ;;
91407755
LW
1808esac
1809case "$libs" in
e5d73d77 1810*-lc_s*) libc=`./loc libc_s.a $libc $libpth`
91407755
LW
1811esac
1812libnames='';
1813case "$libs" in
1814'') ;;
1815*) for thislib in $libs; do
1816 case "$thislib" in
1817 -l*) thislib=`expr X$thislib : 'X-l\(.*\)'`
e5d73d77 1818 try=`./loc lib$thislib.a blurfl/dyick $libpth`
91407755 1819 if test ! -f $try; then
e5d73d77 1820 try=`./loc lib$thislib blurfl/dyick $libpth`
91407755 1821 if test ! -f $try; then
e5d73d77 1822 try=`./loc $thislib blurfl/dyick $libpth`
91407755 1823 if test ! -f $try; then
e5d73d77 1824 try=`./loc Slib$thislib.a blurfl/dyick $xlibpth`
d8f2e4cc
LW
1825 if test ! -f $try; then
1826 try=''
1827 fi
91407755
LW
1828 fi
1829 fi
1830 fi
1831 libnames="$libnames $try"
1832 ;;
0d3e774c 1833 *) libnames="$libnames $thislib" ;;
91407755
LW
1834 esac
1835 done
1836 ;;
1837esac
b6ccd89c
LW
1838set /usr/ccs/lib/libc.so
1839test -f $1 || set /usr/lib/libc.so
1840test -f $1 || set /usr/lib/libc.so.[0-9]*
fe14fcc3 1841test -f $1 || set /lib/libsys_s.a
91407755
LW
1842eval set \$$#
1843if test -f "$1"; then
132b68a5 1844 echo "Your (shared) C library seems to be in $1."
91407755 1845 libc="$1"
16a2aea0 1846elif test -f "$libc"; then
132b68a5 1847 echo "Your C library seems to be in $libc."
91407755 1848elif test -f /lib/libc.a; then
132b68a5 1849 echo "Your C library seems to be in /lib/libc.a. You're normal."
91407755
LW
1850 libc=/lib/libc.a
1851else
fe14fcc3
LW
1852 if ans=`./loc libc.a blurfl/dyick $libpth`; test -f "$ans"; then
1853 :
1854 elif ans=`./loc libc blurfl/dyick $libpth`; test -f "$ans"; then
1855 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
1856 elif ans=`./loc clib blurfl/dyick $libpth`; test -f "$ans"; then
1857 :
1858 elif ans=`./loc Slibc.a blurfl/dyick $xlibpth`; test -f "$ans"; then
1859 :
1860 elif ans=`./loc Mlibc.a blurfl/dyick $xlibpth`; test -f "$ans"; then
1861 :
1862 elif ans=`./loc Llibc.a blurfl/dyick $xlibpth`; test -f "$ans"; then
1863 :
91407755
LW
1864 fi
1865 if test -f "$ans"; then
132b68a5 1866 echo "Your C library seems to be in $ans, of all places."
91407755
LW
1867 libc=$ans
1868 else
1869 cat <<EOM
1870
1871I can't seem to find your C library. I've looked in the following places:
1872
1873 $libpth
1874
1875None of these seems to contain your C library. What is the full name
1876EOM
1877 dflt=None
1878 $echo $n "of your C library? $c"
1879 rp='C library full name?'
1880 . myread
1881 libc="$ans"
1882 fi
1883fi
1884echo " "
fe14fcc3
LW
1885if test $libc = "/lib/libc"; then
1886 libc="$libc /lib/clib"
1887fi
132b68a5
LW
1888cat <<END
1889
1890If the guess above is wrong (which it might be if you're using a strange
1891compiler, or your machine supports multiple models), you can override it here.
1892END
1893dflt="$libc";
1894rp="Your C library is where? [$dflt]"
1895$echo $n "$rp $c"
1896. myread
1897libc="$ans"
1898echo " "
1899echo $libc $libnames | tr ' ' '\012' | sort | uniq >libnames
1900$echo "Extracting names from the following files for later perusal:"
1901sed 's/^/ /' libnames
1902echo $n "This may take a while...$c"
1903set X `cat libnames`
1904shift
fe14fcc3
LW
1905nm $nm_opts $* 2>/dev/null >libc.tmp
1906$sed -n -e 's/^.* [ATDS] *[_.]*//p' -e 's/^.* [ATDS] //p' <libc.tmp >libc.list
91407755 1907if $contains '^printf$' libc.list >/dev/null 2>&1; then
fe14fcc3
LW
1908 echo done
1909elif $sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p' \
1910 <libc.tmp >libc.list; \
1911 $contains '^printf$' libc.list >/dev/null 2>&1; then
1912 echo done
1913elif $sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p' <libc.tmp >libc.list; \
1914 $contains '^printf$' libc.list >/dev/null 2>&1; then
1915 echo done
1916elif $sed -n -e 's/^.* D __*//p' -e 's/^.* D //p' <libc.tmp >libc.list; \
1917 $contains '^printf$' libc.list >/dev/null 2>&1; then
1918 echo done
1919elif $sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p' \
1920 <libc.tmp >libc.list; \
1921 $contains '^printf$' libc.list >/dev/null 2>&1; then
1922 echo done
132b68a5 1923elif $grep '|' <libc.tmp | $sed -n -e '/|COMMON/d' -e '/|DATA/d' -e '/ file/d' \
fe14fcc3
LW
1924 -e 's/^\([^ ]*\).*/\1/p' >libc.list
1925 $contains '^printf$' libc.list >/dev/null 2>&1; then
1926 echo done
1927elif $sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p' \
1928 <libc.tmp >libc.list; \
1929 $contains '^printf$' libc.list >/dev/null 2>&1; then
1930 echo done
91407755 1931else
fe14fcc3
LW
1932 nm -p $* 2>/dev/null >libc.tmp
1933 $sed -n -e 's/^.* [AT] *_[_.]*//p' -e 's/^.* [AT] //p' <libc.tmp >libc.list
91407755 1934 if $contains '^printf$' libc.list >/dev/null 2>&1; then
fe14fcc3 1935 nm_opts='-p'
91407755
LW
1936 echo "done"
1937 else
1938 echo " "
1939 echo "nm didn't seem to work right."
1940 echo "Trying ar instead..."
1941 if ar t $libc > libc.tmp; then
1942 for thisname in $libnames; do
1943 ar t $thisname >>libc.tmp
1944 done
1945 $sed -e 's/\.o$//' < libc.tmp > libc.list
1946 echo "Ok."
1947 else
1948 echo "ar didn't seem to work right."
1949 echo "Maybe this is a Cray...trying bld instead..."
1950 if bld t $libc | $sed -e 's/.*\///' -e 's/\.o:.*$//' > libc.list; then
1951 for thisname in $libnames; do
1952 bld t $libnames | \
1953 $sed -e 's/.*\///' -e 's/\.o:.*$//' >>libc.list
1954 ar t $thisname >>libc.tmp
1955 done
1956 echo "Ok."
1957 else
fe14fcc3
LW
1958 echo "That didn't work either. Giving up."
1959 exit 1
91407755
LW
1960 fi
1961 fi
1962 fi
1963fi
132b68a5
LW
1964if test -f /lib/syscalls.exp; then
1965 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..."
1966 sed -n 's/^\([^ ]*\)[ ]*syscall$/\1/p' /lib/syscalls.exp >>libc.list
1967fi
16a2aea0
LW
1968
1969inlibc='echo " "; td=$define; tu=$undef;
1970if $contains "^$1\$" libc.list >/dev/null 2>&1;
1971then echo "$1() found";
1972 eval "case \"\$$2\" in undef) . whoa; esac"; eval "$2=\$td";
1973else echo "$1() not found";
1974 eval "case \"\$$2\" in define) . whoa; esac"; eval "$2=\$tu"; fi'
1975
a687059c
LW
1976: see if bcmp exists
1977set bcmp d_bcmp
1978eval $inlibc
1979
1980: see if bcopy exists
1981set bcopy d_bcopy
1982eval $inlibc
1983
0d3e774c
LW
1984: see if bzero exists
1985set bzero d_bzero
1986eval $inlibc
1987
a687059c
LW
1988: see if sprintf is declared as int or pointer to char
1989echo " "
fe14fcc3 1990cat >ucbsprf.c <<'EOF'
16a2aea0
LW
1991#include <stdio.h>
1992main()
1993{
1994 int sprintf();
1995 char buf[10];
1996 exit((unsigned long)sprintf(buf,"%s","foo") > 10L);
1997}
a687059c 1998EOF
fe14fcc3 1999if $cc $ccflags ucbsprf.c -o ucbsprf >/dev/null 2>&1 && ./ucbsprf; then
a687059c 2000 echo "Your sprintf() returns (int)."
16a2aea0 2001 val="$undef"
a687059c
LW
2002else
2003 echo "Your sprintf() returns (char*)."
16a2aea0 2004 val="$define"
a687059c 2005fi
16a2aea0
LW
2006set d_charsprf
2007eval $setvar
a687059c
LW
2008
2009: see if vprintf exists
2010echo " "
2011if $contains '^vprintf$' libc.list >/dev/null 2>&1; then
2012 echo 'vprintf() found.'
16a2aea0 2013 val="$define"
fe14fcc3 2014 cat >vprintf.c <<'EOF'
a687059c
LW
2015#include <varargs.h>
2016
2017main() { xxx("foo"); }
2018
2019xxx(va_alist)
2020va_dcl
2021{
2022 va_list args;
2023 char buf[10];
2024
2025 va_start(args);
2026 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
2027}
2028EOF
fe14fcc3 2029 if $cc $ccflags vprintf.c -o vprintf >/dev/null 2>&1 && ./vprintf; then
a687059c 2030 echo "Your vsprintf() returns (int)."
16a2aea0 2031 val2="$undef"
a687059c
LW
2032 else
2033 echo "Your vsprintf() returns (char*)."
16a2aea0 2034 val2="$define"
a687059c 2035 fi
a687059c
LW
2036else
2037 echo 'vprintf() not found.'
16a2aea0
LW
2038 val="$undef"
2039 val2="$undef"
a687059c 2040fi
16a2aea0
LW
2041set d_vprintf
2042eval $setvar
2043val=$val2
2044set d_charvspr
2045eval $setvar
a687059c 2046
79220ce3
LW
2047: see if chsize exists
2048set chsize d_chsize
2049eval $inlibc
2050
a687059c
LW
2051: see if crypt exists
2052echo " "
2053if $contains '^crypt$' libc.list >/dev/null 2>&1; then
2054 echo 'crypt() found.'
16a2aea0 2055 val="$define"
a687059c
LW
2056 cryptlib=''
2057else
e5d73d77 2058 cryptlib=`./loc Slibcrypt.a "" $xlibpth`
a687059c 2059 if $test -z "$cryptlib"; then
e5d73d77 2060 cryptlib=`./loc Mlibcrypt.a "" $xlibpth`
a687059c
LW
2061 else
2062 cryptlib=-lcrypt
2063 fi
2064 if $test -z "$cryptlib"; then
e5d73d77 2065 cryptlib=`./loc Llibcrypt.a "" $xlibpth`
a687059c
LW
2066 else
2067 cryptlib=-lcrypt
2068 fi
2069 if $test -z "$cryptlib"; then
e5d73d77 2070 cryptlib=`./loc libcrypt.a "" $libpth`
a687059c
LW
2071 else
2072 cryptlib=-lcrypt
2073 fi
2074 if $test -z "$cryptlib"; then
2075 echo 'crypt() not found.'
16a2aea0 2076 val="$undef"
a687059c 2077 else
16a2aea0 2078 val="$define"
a687059c
LW
2079 fi
2080fi
16a2aea0
LW
2081set d_crypt
2082eval $setvar
a687059c 2083
91407755
LW
2084: get csh whereabouts
2085case "$csh" in
16a2aea0
LW
2086'csh') val="$undef" ;;
2087*) val="$define" ;;
91407755 2088esac
16a2aea0
LW
2089set d_csh
2090eval $setvar
91407755 2091
fe14fcc3
LW
2092: see if readdir exists
2093set readdir d_readdir
2094eval $inlibc
2095
2096: see if there are directory access routines out there
a687059c 2097echo " "
fe14fcc3
LW
2098xxx=`./loc ndir.h x $usrinclude /usr/local/include $inclwanted`
2099case "$xxx" in
2100x)
2101 xxx=`./loc sys/ndir.h x $usrinclude /usr/local/include $inclwanted`
2102 ;;
2103esac
16a2aea0
LW
2104D_dirnamlen="$undef"
2105I_dirent="$undef"
2106I_sys_dir="$undef"
2107I_my_dir="$undef"
2108I_ndir="$undef"
2109I_sys_ndir="$undef"
fe14fcc3
LW
2110libndir=''
2111ndirc=''
2112ndiro=''
2113if $test -r $usrinclude/dirent.h; then
a687059c 2114 echo "dirent.h found."
fe14fcc3 2115 if $contains 'd_namlen' $usrinclude/dirent.h >/dev/null 2>&1; then
16a2aea0 2116 D_dirnamlen="$define"
fe14fcc3 2117 fi
16a2aea0 2118 I_dirent="$define"
fe14fcc3
LW
2119elif $test -r $xxx; then
2120 echo "You seem to use <$xxx>,"
2121 if $test "$d_readdir" = "$define"; then
2122 echo "and I can get readdir() from your C library."
2123 elif $test -r /usr/lib/libndir.a || $test -r /usr/local/lib/libndir.a; then
2124 echo "and I'll get the routines using -lndir ."
2125 libndir='-lndir'
a687059c 2126 else
fe14fcc3
LW
2127 ans=`./loc libndir.a x $libpth`
2128 case "$ans" in
2129 x)
2130 echo "but I can't find the ndir library!"
2131 ;;
2132 *)
2133 echo "and I found the directory library in $ans."
2134 libndir="$ans"
2135 ;;
2136 esac
a687059c 2137 fi
fe14fcc3 2138 if $contains 'd_namlen' $xxx >/dev/null 2>&1; then
16a2aea0 2139 D_dirnamlen="$define"
fe14fcc3
LW
2140 fi
2141 case "$xxx" in
2142 sys/)
16a2aea0 2143 I_sys_ndir="$define"
fe14fcc3
LW
2144 ;;
2145 *)
16a2aea0 2146 I_ndir="$define"
fe14fcc3
LW
2147 ;;
2148 esac
2149else
16a2aea0 2150 : The next line used to require this to be a bsd system.
fe14fcc3
LW
2151 if $contains '^readdir$' libc.list >/dev/null 2>&1 ; then
2152 echo "No ndir library found, but you have readdir() so we'll use that."
2153 if $contains 'd_namlen' $usrinclude/sys/dir.h >/dev/null 2>&1; then
16a2aea0 2154 D_dirnamlen="$define"
fe14fcc3 2155 fi
16a2aea0 2156 I_sys_dir="$define"
0d3e774c 2157 else
fe14fcc3 2158 echo "No ndir library found--using ./$d_ndir.c."
16a2aea0
LW
2159: This will lose since $d_ndir.h is in another directory.
2160: I doubt we can rely on it being in ../$d_ndir.h .
2161: At least it will fail in a conservative manner.
fe14fcc3 2162 if $contains 'd_namlen' $d_ndir.h >/dev/null 2>&1; then
16a2aea0 2163 D_dirnamlen="$define"
fe14fcc3 2164 fi
16a2aea0 2165 I_my_dir="$define"
fe14fcc3
LW
2166 ndirc="$d_ndir.c"
2167 ndiro="$d_ndir.o"
0d3e774c 2168 fi
a687059c 2169fi
16a2aea0
LW
2170val=$D_dirnamlen; set d_dirnamlen; eval $setvar
2171val=$I_dirent; set i_dirent; eval $setvar
2172val=$I_sys_dir; set i_sys_dir; eval $setvar
2173val=$I_my_dir; set i_my_dir; eval $setvar
2174val=$I_ndir; set i_ndir; eval $setvar
2175val=$I_sys_ndir; set i_sys_ndir; eval $setvar
a687059c
LW
2176
2177: now see if they want to do setuid emulation
2178case "$d_dosuid" in
2179'') dflt=n;;
2180*undef*) dflt=n;;
2181*) dflt=y;;
2182esac
2183cat <<EOM
2184
2185Some sites have disabled setuid #! scripts because of a bug in the kernel
2186that prevents them from being secure. If you are on such a system, the
2187setuid/setgid bits on scripts are currently useless. It is possible for
2188$package to detect those bits and emulate setuid/setgid in a secure fashion
2189until a better solution is devised for the kernel problem.
2190
2191EOM
2192rp="Do you want to do setuid/setgid emulation? [$dflt]"
449aadca 2193$echo $n "$rp $c"
a687059c
LW
2194. myread
2195case "$ans" in
2196'') $ans="$dflt";;
2197esac
2198case "$ans" in
2199y*) d_dosuid="$define";;
2200*) d_dosuid="$undef";;
2201esac
2202
2203: see if dup2 exists
2204set dup2 d_dup2
2205eval $inlibc
2206
2207: see if fchmod exists
2208set fchmod d_fchmod
2209eval $inlibc
2210
2211: see if fchown exists
2212set fchown d_fchown
2213eval $inlibc
2214
2215: see if this is an fcntl system
fe14fcc3
LW
2216set fcntl d_fcntl
2217eval $inlibc
a687059c 2218
7e1cf235
LW
2219: see if we can have long filenames
2220echo " "
2221rm -f 123456789abcde
2222if (echo hi >123456789abcdef) 2>/dev/null; then
2223 : not version 8
2224 if test -f 123456789abcde; then
2225 echo 'You cannot have filenames longer than 14 characters. Sigh.'
16a2aea0 2226 val="$undef"
7e1cf235
LW
2227 else
2228 echo 'You can have filenames longer than 14 characters.'
16a2aea0 2229 val="$define"
7e1cf235
LW
2230 fi
2231else
2232 : version 8 probably
16a2aea0
LW
2233 echo "You can't have filenames longer than 14 chars. You can't even think about them!"
2234 val="$undef"
7e1cf235 2235fi
16a2aea0
LW
2236set d_flexfnam
2237eval $setvar
2238
a687059c
LW
2239: see if flock exists
2240set flock d_flock
2241eval $inlibc
2242
2243: see if getgroups exists
2244set getgroups d_getgrps
2245eval $inlibc
2246
2247: see if gethostent exists
2248set gethostent d_gethent
2249eval $inlibc
2250
2251: see if getpgrp exists
2252set getpgrp d_getpgrp
2253eval $inlibc
2254
d8f2e4cc
LW
2255: see if getpgrp2 exists
2256set getpgrp2 d_getpgrp2
2257eval $inlibc
2258
a687059c
LW
2259: see if getpriority exists
2260set getpriority d_getprior
2261eval $inlibc
2262
2263: see if htonl exists
2264set htonl d_htonl
2265eval $inlibc
2266
2267: index or strcpy
378cc40b 2268echo " "
a687059c
LW
2269case "$d_index" in
2270n) dflt=n;;
16a2aea0
LW
2271*) if $test -f /unix; then
2272 dflt=n
2273 else
2274 dflt=y
2275 fi
2276 ;;
a687059c
LW
2277esac
2278if $contains '^index$' libc.list >/dev/null 2>&1 ; then
2279 if $contains '^strchr$' libc.list >/dev/null 2>&1 ; then
2280 echo "Your system has both index() and strchr(). Shall I use"
2281 rp="index() rather than strchr()? [$dflt]"
2282 $echo $n "$rp $c"
2283 . myread
2284 case "$ans" in
2285 n*) d_index="$define" ;;
2286 *) d_index="$undef" ;;
2287 esac
2288 else
2289 d_index="$undef"
2290 echo "index() found."
2291 fi
378cc40b 2292else
a687059c
LW
2293 if $contains '^strchr$' libc.list >/dev/null 2>&1 ; then
2294 d_index="$define"
2295 echo "strchr() found."
2296 else
2297 echo "No index() or strchr() found!"
2298 d_index="$undef"
2299 fi
378cc40b
LW
2300fi
2301
a687059c
LW
2302: see if killpg exists
2303set killpg d_killpg
2304eval $inlibc
2305
0d3e774c
LW
2306: see if lstat exists
2307set lstat d_lstat
2308eval $inlibc
2309
a687059c
LW
2310: see if memcmp exists
2311set memcmp d_memcmp
2312eval $inlibc
2313
2314: see if memcpy exists
2315set memcpy d_memcpy
2316eval $inlibc
2317
2318: see if mkdir exists
2319set mkdir d_mkdir
2320eval $inlibc
2321
fe14fcc3
LW
2322: see if msgctl exists
2323set msgctl d_msgctl
2324eval $inlibc
2325
2326: see if msgget exists
2327set msgget d_msgget
2328eval $inlibc
2329
2330: see if msgsnd exists
2331set msgsnd d_msgsnd
2332eval $inlibc
2333
2334: see if msgrcv exists
2335set msgrcv d_msgrcv
2336eval $inlibc
2337
2338: see how much of the 'msg*(2)' library is present.
2339h_msg=true
2340echo " "
2341case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
2342*undef*) h_msg=false;;
2343esac
2344: we could also check for sys/ipc.h ...
2345if $h_msg && $test -r $usrinclude/sys/msg.h; then
2346 echo "You have the full msg*(2) library."
16a2aea0 2347 val="$define"
fe14fcc3
LW
2348else
2349 echo "You don't have the full msg*(2) library."
16a2aea0 2350 val="$undef"
fe14fcc3 2351fi
16a2aea0
LW
2352set d_msg
2353eval $setvar
fe14fcc3 2354
a687059c 2355: see if ndbm is available
378cc40b 2356echo " "
fe14fcc3 2357xxx=`./loc ndbm.h x $usrinclude /usr/local/include $inclwanted`
0d3e774c 2358if test -f $xxx; then
16a2aea0 2359 val="$define"
a687059c 2360 echo "ndbm.h found."
378cc40b 2361else
16a2aea0 2362 val="$undef"
a687059c 2363 echo "ndbm.h not found."
378cc40b 2364fi
16a2aea0
LW
2365set d_ndbm
2366eval $setvar
378cc40b 2367
a687059c 2368: see if we have the old dbm
378cc40b 2369echo " "
fe14fcc3 2370xxx=`./loc dbm.h x $usrinclude /usr/local/include $inclwanted`
0d3e774c 2371if test -f $xxx; then
16a2aea0 2372 val="$define"
a687059c 2373 echo "dbm.h found."
378cc40b 2374else
16a2aea0 2375 val="$undef"
a687059c 2376 echo "dbm.h not found."
378cc40b 2377fi
16a2aea0
LW
2378set d_odbm
2379eval $setvar
378cc40b 2380
21d892ea
LW
2381: see whether socket exists
2382echo " "
fe14fcc3 2383socketlib=''
21d892ea
LW
2384if $contains socket libc.list >/dev/null 2>&1; then
2385 echo "Looks like you have Berkeley networking support."
16a2aea0 2386 val="$define"
21d892ea
LW
2387 : now check for advanced features
2388 if $contains setsockopt libc.list >/dev/null 2>&1; then
16a2aea0 2389 val2="$undef"
21d892ea
LW
2390 else
2391 echo "...but it uses the old 4.1c interface, rather than 4.2"
16a2aea0 2392 val2="$define"
21d892ea
LW
2393 fi
2394else
2395 : hpux, for one, puts all the socket stuff in socklib.o
2396 if $contains socklib libc.list >/dev/null 2>&1; then
2397 echo "Looks like you have Berkeley networking support."
16a2aea0 2398 val="$define"
21d892ea 2399 : we will have to assume that it supports the 4.2 BSD interface
16a2aea0 2400 val2="$undef"
21d892ea
LW
2401 else
2402 echo "Hmmm...you don't have Berkeley networking in libc.a..."
2403 : look for an optional networking library
2404 if test -f /usr/lib/libnet.a; then
2405 (ar t /usr/lib/libnet.a ||
2406 nm -g /usr/lib/libnet.a) 2>/dev/null >> libc.list
2407 if $contains socket libc.list >/dev/null 2>&1; then
2408 echo "but the Wollongong group seems to have hacked it in."
fe14fcc3 2409 socketlib="-lnet -lnsl_s"
16a2aea0 2410 val="$define"
21d892ea
LW
2411 : now check for advanced features
2412 if $contains setsockopt libc.list >/dev/null 2>&1; then
16a2aea0 2413 val2="$undef"
21d892ea
LW
2414 else
2415 echo "...using the old 4.1c interface, rather than 4.2"
16a2aea0 2416 val2="$define"
21d892ea
LW
2417 fi
2418 else
2419 echo "or even in libnet.a, which is peculiar."
16a2aea0
LW
2420 val="$undef"
2421 val2="$undef"
21d892ea
LW
2422 fi
2423 else
2424 echo "or anywhere else I see."
16a2aea0
LW
2425 val="$undef"
2426 val2="$undef"
21d892ea
LW
2427 fi
2428 fi
2429fi
16a2aea0
LW
2430set d_socket
2431eval $setvar
2432
21d892ea 2433if $contains socketpair libc.list >/dev/null 2>&1; then
16a2aea0 2434 val="$define"
21d892ea 2435else
16a2aea0 2436 val="$undef"
21d892ea 2437fi
16a2aea0
LW
2438set d_sockpair
2439eval $setvar
2440val=$val2
2441set d_oldsock
2442eval $setvar
21d892ea 2443
fe14fcc3 2444: Locate the flags for 'open()'
378cc40b 2445echo " "
fe14fcc3
LW
2446$cat >open3.c <<'EOCP'
2447#include <sys/types.h>
2448#ifdef I_FCNTL
2449#include <fcntl.h>
2450#endif
2451#ifdef I_SYS_FILE
2452#include <sys/file.h>
2453#endif
2454main() {
2455
2456 if(O_RDONLY);
2457
2458#ifdef O_TRUNC
2459 exit(0);
2460#else
2461 exit(1);
2462#endif
2463}
2464EOCP
2465: check sys/file.h first to get FREAD on Sun
2466if $test -r $usrinclude/sys/file.h && \
2467 $cc $cppflags "-DI_SYS_FILE" open3.c -o open3 >/dev/null 2>&1 ; then
2468 h_sys_file=true;
2469 echo "sys/file.h defines the O_* constants..."
2470 if ./open3; then
2471 echo "and you have the 3 argument form of open()."
16a2aea0 2472 val="$define"
b6ccd89c 2473 else
fe14fcc3 2474 echo "but not the 3 argument form of open(). Oh, well."
16a2aea0 2475 val="$undef"
fe14fcc3
LW
2476 fi
2477elif $test -r $usrinclude/fcntl.h && \
2478 $cc "-DI_FCNTL" open3.c -o open3 >/dev/null 2>&1 ; then
2479 h_fcntl=true;
2480 echo "fcntl.h defines the O_* constants..."
2481 if ./open3; then
2482 echo "and you have the 3 argument form of open()."
16a2aea0 2483 val="$define"
fe14fcc3
LW
2484 else
2485 echo "but not the 3 argument form of open(). Oh, well."
16a2aea0 2486 val="$undef"
b6ccd89c 2487 fi
fe14fcc3 2488else
16a2aea0 2489 val="$undef"
fe14fcc3
LW
2490 echo "I can't find the O_* constant definitions! You got problems."
2491fi
16a2aea0
LW
2492set d_open3
2493eval $setvar
fe14fcc3
LW
2494
2495: see if how pwd stuff is defined
2496echo " "
2497if $test -r $usrinclude/pwd.h ; then
2498 i_pwd="$define"
2499 echo "pwd.h found."
16a2aea0 2500 $cppstdin $cppflags $cppminus <$usrinclude/pwd.h >pwd.txt
fe14fcc3 2501 if $contains 'pw_quota' pwd.txt >/dev/null 2>&1; then
a687059c
LW
2502 d_pwquota="$define"
2503 else
2504 d_pwquota="$undef"
2505 fi
fe14fcc3 2506 if $contains 'pw_age' pwd.txt >/dev/null 2>&1; then
a687059c
LW
2507 d_pwage="$define"
2508 else
2509 d_pwage="$undef"
2510 fi
fe14fcc3 2511 if $contains 'pw_change' pwd.txt >/dev/null 2>&1; then
03a14243
LW
2512 d_pwchange="$define"
2513 else
2514 d_pwchange="$undef"
2515 fi
fe14fcc3 2516 if $contains 'pw_class' pwd.txt >/dev/null 2>&1; then
03a14243
LW
2517 d_pwclass="$define"
2518 else
2519 d_pwclass="$undef"
2520 fi
fe14fcc3 2521 if $contains 'pw_expire' pwd.txt >/dev/null 2>&1; then
03a14243
LW
2522 d_pwexpire="$define"
2523 else
2524 d_pwexpire="$undef"
2525 fi
fe14fcc3
LW
2526 if $contains 'pw_comment' pwd.txt >/dev/null 2>&1; then
2527 d_pwcomment="$define"
2528 else
2529 d_pwcomment="$undef"
2530 fi
378cc40b 2531else
a687059c
LW
2532 i_pwd="$undef"
2533 d_pwquota="$undef"
2534 d_pwage="$undef"
03a14243
LW
2535 d_pwchange="$undef"
2536 d_pwclass="$undef"
2537 d_pwexpire="$undef"
fe14fcc3 2538 d_pwcomment="$undef"
a687059c 2539 echo "No pwd.h found."
378cc40b
LW
2540fi
2541
a687059c
LW
2542: see if rename exists
2543set rename d_rename
2544eval $inlibc
2545
2546: see if rmdir exists
2547set rmdir d_rmdir
2548eval $inlibc
2549
79220ce3
LW
2550: see if select exists
2551set select d_select
2552eval $inlibc
2553
fe14fcc3
LW
2554: see if semctl exists
2555set semctl d_semctl
2556eval $inlibc
2557
2558: see if semget exists
2559set semget d_semget
2560eval $inlibc
2561
2562: see if semop exists
2563set semop d_semop
2564eval $inlibc
2565
2566: see how much of the 'sem*(2)' library is present.
2567h_sem=true
2568echo " "
2569case "$d_semctl$d_semget$d_semop" in
2570*undef*) h_sem=false;;
2571esac
2572: we could also check for sys/ipc.h ...
2573if $h_sem && $test -r $usrinclude/sys/sem.h; then
2574 echo "You have the full sem*(2) library."
16a2aea0 2575 val="$define"
fe14fcc3
LW
2576else
2577 echo "You don't have the full sem*(2) library."
16a2aea0 2578 val="$undef"
fe14fcc3 2579fi
16a2aea0
LW
2580set d_sem
2581eval $setvar
fe14fcc3 2582
a687059c
LW
2583: see if setegid exists
2584set setegid d_setegid
2585eval $inlibc
2586
2587: see if seteuid exists
2588set seteuid d_seteuid
2589eval $inlibc
2590
2591: see if setpgrp exists
2592set setpgrp d_setpgrp
2593eval $inlibc
2594
d8f2e4cc
LW
2595: see if setpgrp2 exists
2596set setpgrp2 d_setpgrp2
2597eval $inlibc
2598
a687059c
LW
2599: see if setpriority exists
2600set setpriority d_setprior
2601eval $inlibc
2602
2603: see if setregid exists
2604set setregid d_setregid
2605eval $inlibc
2606set setresgid d_setresgid
2607eval $inlibc
2608
2609: see if setreuid exists
2610set setreuid d_setreuid
2611eval $inlibc
2612set setresuid d_setresuid
2613eval $inlibc
2614
2615: see if setrgid exists
2616set setrgid d_setrgid
2617eval $inlibc
2618
378cc40b 2619: see if setruid exists
a687059c
LW
2620set setruid d_setruid
2621eval $inlibc
2622
fe14fcc3
LW
2623: see if shmctl exists
2624set shmctl d_shmctl
2625eval $inlibc
2626
2627: see if shmget exists
2628set shmget d_shmget
2629eval $inlibc
2630
2631: see if shmat exists
2632set shmat d_shmat
2633eval $inlibc
2634
132b68a5
LW
2635d_voidshmat="$undef"
2636case "$d_shmat" in
2637define)
2638 $cppstdin $cppflags $cppminus < $usrinclude/sys/shm.h >voidshmat.txt 2>/dev/null
2639 if $contains "void.*shmat" voidshmat.txt >/dev/null 2>&1; then
2640 echo "and shmat returns (void*)"
2641 d_voidshmat="$define"
2642 else
2643 echo "and shmat returns (char*)"
2644 fi
2645 ;;
2646esac
2647
fe14fcc3
LW
2648: see if shmdt exists
2649set shmdt d_shmdt
2650eval $inlibc
2651
2652: see how much of the 'shm*(2)' library is present.
2653h_shm=true
135863df 2654echo " "
fe14fcc3
LW
2655case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
2656*undef*) h_shm=false;;
2657esac
2658: we could also check for sys/ipc.h ...
2659if $h_shm && $test -r $usrinclude/sys/shm.h; then
2660 echo "You have the full shm*(2) library."
16a2aea0 2661 val="$define"
fe14fcc3
LW
2662else
2663 echo "You don't have the full shm*(2) library."
16a2aea0 2664 val="$undef"
fe14fcc3 2665fi
16a2aea0
LW
2666set d_shm
2667eval $setvar
fe14fcc3
LW
2668
2669: see if stat knows about block sizes
2670echo " "
2671if $contains 'st_blocks;' $usrinclude/sys/stat.h >/dev/null 2>&1 ; then
2672 if $contains 'st_blksize;' $usrinclude/sys/stat.h >/dev/null 2>&1 ; then
135863df 2673 echo "Your stat knows about block sizes."
16a2aea0 2674 val="$define"
135863df
AB
2675 else
2676 echo "Your stat doesn't know about block sizes."
16a2aea0 2677 val="$undef"
135863df
AB
2678 fi
2679else
2680 echo "Your stat doesn't know about block sizes."
16a2aea0 2681 val="$undef"
135863df 2682fi
16a2aea0
LW
2683set d_statblks
2684eval $setvar
135863df 2685
36ce8bec
DFDL
2686: see if stdio is really std
2687echo " "
fe14fcc3
LW
2688if $contains 'char.*_ptr.*;' $usrinclude/stdio.h >/dev/null 2>&1 ; then
2689 if $contains '_cnt;' $usrinclude/stdio.h >/dev/null 2>&1 ; then
36ce8bec 2690 echo "Your stdio is pretty std."
16a2aea0 2691 val="$define"
36ce8bec
DFDL
2692 else
2693 echo "Your stdio isn't very std."
16a2aea0 2694 val="$undef"
36ce8bec
DFDL
2695 fi
2696else
2697 echo "Your stdio isn't very std."
16a2aea0 2698 val="$undef"
36ce8bec 2699fi
16a2aea0
LW
2700set d_stdstdio
2701eval $setvar
36ce8bec 2702
8d063cd8
LW
2703: check for structure copying
2704echo " "
2705echo "Checking to see if your C compiler can copy structs..."
fe14fcc3 2706$cat >strctcpy.c <<'EOCP'
8d063cd8
LW
2707main()
2708{
2709 struct blurfl {
2710 int dyick;
2711 } foo, bar;
2712
2713 foo = bar;
2714}
2715EOCP
fe14fcc3 2716if $cc -c strctcpy.c >/dev/null 2>&1 ; then
16a2aea0 2717 val="$define"
8d063cd8
LW
2718 echo "Yup, it can."
2719else
16a2aea0 2720 val="$undef"
8d063cd8
LW
2721 echo "Nope, it can't."
2722fi
16a2aea0
LW
2723set d_strctcpy
2724eval $setvar
8d063cd8 2725
d8f2e4cc
LW
2726: see if strerror exists
2727set strerror d_strerror
2728eval $inlibc
2729
378cc40b 2730: see if symlink exists
a687059c
LW
2731set symlink d_symlink
2732eval $inlibc
2733
2734: see if syscall exists
2735set syscall d_syscall
2736eval $inlibc
378cc40b 2737
fe14fcc3
LW
2738: set if package uses struct tm
2739w_s_tm=1
2740
2741: set if package uses struct timeval
16a2aea0
LW
2742case "$d_select" in
2743define) w_s_timevl=1 ;;
2744esac
fe14fcc3
LW
2745
2746: set if package uses localtime function
2747w_localtim=1
2748
2749: see which of time.h, sys/time.h, and sys/select should be included.
2750idefs=''
d8f2e4cc
LW
2751cat <<'EOM'
2752
fe14fcc3
LW
2753Testing to see which of <time.h>, <sys/time.h>, and <sys/select.h>
2754should be included, because this application wants:
2755
d8f2e4cc 2756EOM
fe14fcc3
LW
2757case "$w_s_itimer" in
27581)
2759 echo " struct itimerval"
2760 idefs="-DS_ITIMERVAL $idefs"
2761 ;;
2762esac
2763case "$w_s_timevl" in
27641)
2765 echo " struct timeval"
2766 idefs="-DS_TIMEVAL $idefs"
2767 ;;
2768esac
2769case "$w_s_tm" in
27701)
2771 echo " struct tm"
2772 idefs="-DS_TM $idefs"
2773 ;;
2774esac
2775case "$w_localtim" in
27761)
2777 echo " ctime(3) declarations"
2778 idefs="-DD_CTIME $idefs"
2779 ;;
2780esac
2781case "$idefs" in
2782'')
2783 echo " (something I don't know about)"
2784 ;;
2785esac
2786echo " "
2787echo "I'm now running the test program..."
2788$cat >i_time.c <<'EOCP'
2789#include <sys/types.h>
d8f2e4cc
LW
2790#ifdef I_TIME
2791#include <time.h>
2792#endif
fe14fcc3 2793#ifdef I_SYS_TIME
d8f2e4cc
LW
2794#ifdef SYSTIMEKERNEL
2795#define KERNEL
2796#endif
2797#include <sys/time.h>
2798#endif
fe14fcc3
LW
2799#ifdef I_SYS_SELECT
2800#include <sys/select.h>
2801#endif
d8f2e4cc
LW
2802main()
2803{
2804 struct tm foo;
fe14fcc3 2805 struct tm *tmp;
d8f2e4cc
LW
2806#ifdef S_TIMEVAL
2807 struct timeval bar;
2808#endif
fe14fcc3
LW
2809#ifdef S_ITIMERVAL
2810 struct itimerval baz;
2811#endif
2812
d8f2e4cc
LW
2813 if (foo.tm_sec == foo.tm_sec)
2814 exit(0);
2815#ifdef S_TIMEVAL
2816 if (bar.tv_sec == bar.tv_sec)
2817 exit(0);
2818#endif
fe14fcc3
LW
2819#ifdef S_ITIMERVAL
2820 if (baz.it_interval == baz.it_interval)
2821 exit(0);
2822#endif
2823#ifdef S_TIMEVAL
2824 if (bar.tv_sec == bar.tv_sec)
2825 exit(0);
2826#endif
2827#ifdef D_CTIME
2828 /* this might not do anything for us... */
2829 tmp = localtime((time_t *)0);
2830#endif
d8f2e4cc
LW
2831 exit(1);
2832}
2833EOCP
2834flags=''
fe14fcc3 2835for i_sys_select in '' '-DI_SYS_SELECT'; do
d8f2e4cc
LW
2836 for d_systimekernel in '' '-DSYSTIMEKERNEL'; do
2837 for i_time in '' '-DI_TIME'; do
fe14fcc3 2838 for i_systime in '-DI_SYS_TIME' ''; do
d8f2e4cc 2839 case "$flags" in
fe14fcc3 2840 '') echo Trying $i_time $i_systime $d_systimekernel $i_sys_select
16a2aea0 2841 if $cc $ccflags $idefs \
fe14fcc3 2842 $i_time $i_systime $d_systimekernel $i_sys_select \
16a2aea0 2843 i_time.c -o i_time >/dev/null 2>&1 ; then
fe14fcc3 2844 set X $i_time $i_systime $d_systimekernel $i_sys_select
d8f2e4cc
LW
2845 shift
2846 flags="$*"
2847 echo Succeeded with $flags
2848 fi
2849 ;;
2850 esac
2851 done
2852 done
2853 done
2854done
2855case "$flags" in
16a2aea0
LW
2856*SYSTIMEKERNEL*) val="$define";;
2857*) val="$undef";;
d8f2e4cc 2858esac
16a2aea0
LW
2859set d_systimekernel
2860eval $setvar
d8f2e4cc 2861case "$flags" in
16a2aea0
LW
2862*I_TIME*) val="$define";;
2863*) val="$undef";;
d8f2e4cc 2864esac
16a2aea0
LW
2865set i_time
2866eval $setvar
d8f2e4cc 2867case "$flags" in
16a2aea0
LW
2868*I_SYS_SELECT*) val="$define";;
2869*) val="$undef";;
fe14fcc3 2870esac
16a2aea0
LW
2871set i_sys_select
2872eval $setvar
fe14fcc3 2873case "$flags" in
16a2aea0
LW
2874*I_SYS_TIME*) val="$define";;
2875*) val="$undef";;
2876esac
2877set i_sys_time
2878eval $setvar
2879case "$flags$i_sys_time$i_time" in
2880undefundef) i_sys_time="$define"; i_time="$define";
2881 echo "ICK, NOTHING WORKED!!! You may have to diddle the includes.";;
d8f2e4cc 2882esac
a687059c 2883
36ce8bec
DFDL
2884: see if signal is declared as pointer to function returning int or void
2885echo " "
fe14fcc3 2886$cppstdin $cppflags $cppminus < $usrinclude/signal.h >d_voidsig.txt
132b68a5 2887if $contains 'int[^A-Za-z]*signal' d_voidsig.txt >/dev/null 2>&1 ; then
36ce8bec 2888 echo "You have int (*signal())() instead of void."
16a2aea0 2889 val="$undef"
16a2aea0
LW
2890else
2891 echo "You have void (*signal())() instead of int."
2892 val="$define"
36ce8bec 2893fi
16a2aea0
LW
2894set d_voidsig
2895eval $setvar
132b68a5
LW
2896case $voidsig in
2897define) d_tosignal=void;;
2898*) d_tosignal=int;;
2899esac
fe14fcc3
LW
2900
2901: see if truncate exists
2902set truncate d_truncate
2903eval $inlibc
2904
2905: see if there is a vfork
2906set vfork d_vfork
2907eval $inlibc
36ce8bec 2908
449aadca
LW
2909: check for volatile keyword
2910echo " "
2911echo 'Checking to see if your C compiler knows about "volatile"...'
2912$cat >try.c <<'EOCP'
2913main()
2914{
21d892ea 2915 typedef unsigned short foo_t;
ff2452de
LW
2916 char *volatile foo;
2917 volatile int bar;
21d892ea 2918 volatile foo_t blech;
449aadca
LW
2919 foo = foo;
2920}
2921EOCP
ff2452de 2922if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
16a2aea0 2923 val="$define"
449aadca
LW
2924 echo "Yup, it does."
2925else
16a2aea0 2926 val="$undef"
449aadca
LW
2927 echo "Nope, it doesn't."
2928fi
16a2aea0
LW
2929set d_volatile
2930eval $setvar
449aadca
LW
2931$rm -f try.*
2932
91407755
LW
2933: see if there is a wait4
2934set wait4 d_wait4
2935eval $inlibc
2936
b6ccd89c
LW
2937: see if there is a waitpid
2938set waitpid d_waitpid
2939eval $inlibc
2940
378cc40b
LW
2941: see what type gids are declared as in the kernel
2942case "$gidtype" in
2943'')
16a2aea0
LW
2944 if $contains 'gid_t;' $usrinclude/sys/types.h >/dev/null 2>&1 ; then
2945 dflt='gid_t';
378cc40b 2946 else
16a2aea0 2947 set `grep '_rgid;' $usrinclude/sys/user.h 2>/dev/null` unsigned short
378cc40b
LW
2948 case $1 in
2949 unsigned) dflt="$1 $2" ;;
2950 *) dflt="$1" ;;
2951 esac
2952 fi
2953 ;;
2954*) dflt="$gidtype"
2955 ;;
2956esac
2957cont=true
16a2aea0
LW
2958echo " "
2959rp="What type are groups ids returned by getgid(), etc.? [$dflt]"
378cc40b
LW
2960$echo $n "$rp $c"
2961. myread
2962gidtype="$ans"
8d063cd8 2963
132b68a5
LW
2964: see what type gids are returned by getgroups
2965echo " "
2966case "$groupstype" in
2967'')
2968 if $contains 'getgroups.*short' /usr/lib/lint/llib-lc >/dev/null 2>&1; then
2969 dflt='short'
2970 elif $contains 'getgroups.*int' /usr/lib/lint/llib-lc >/dev/null 2>&1; then
2971 dflt='int'
2972 elif $contains 'getgroups.*short' /usr/include/libc.h >/dev/null 2>&1; then
2973 dflt='short'
2974 elif $contains 'getgroups.*int' /usr/include/libc.h >/dev/null 2>&1; then
2975 dflt='int'
2976 elif $contains 'getgroups.*short' /usr/lib/lint/llib-lbsd >/dev/null 2>&1; then
2977 dflt='short'
2978 elif $contains 'getgroups.*int' /usr/lib/lint/llib-lbsd >/dev/null 2>&1; then
2979 dflt='int'
2980 elif $contains 'int.*gidset' /usr/man/man2/getgroups.2 >/dev/null 2>&1; then
2981 dflt='int'
2982 elif $contains 'gid_t;' $usrinclude/sys/types.h >/dev/null 2>&1 ; then
2983 dflt='gid_t'
2984 else
2985 set `grep 'groups\[NGROUPS\];' $usrinclude/sys/user.h 2>/dev/null` unsigned short
2986 case $1 in
2987 unsigned) dflt="$1 $2" ;;
2988 *) dflt="$1" ;;
2989 esac
2990 fi
2991 ;;
2992*) dflt="$groupstype"
2993 ;;
2994esac
2995cont=true
2996echo "(The following only matters if you have getgroups().)"
2997rp="What type are the group ids returned by getgroups()? [$dflt]"
2998$echo $n "$rp $c"
2999. myread
3000groupstype="$ans"
3001
a687059c
LW
3002: check for length of integer
3003echo " "
3004case "$intsize" in
8d063cd8 3005'')
a687059c 3006 echo "Checking to see how big your integers are..."
fe14fcc3 3007 $cat >intsize.c <<'EOCP'
a687059c
LW
3008#include <stdio.h>
3009main()
3010{
3011 printf("%d\n", sizeof(int));
3012}
3013EOCP
fe14fcc3
LW
3014 if $cc intsize.c -o intsize >/dev/null 2>&1 ; then
3015 dflt=`./intsize`
8d063cd8 3016 else
a687059c
LW
3017 dflt='4'
3018 echo "(I can't seem to compile the test program. Guessing...)"
3019 fi
8d063cd8 3020 ;;
8d063cd8 3021*)
a687059c 3022 dflt="$intsize"
8d063cd8
LW
3023 ;;
3024esac
a687059c
LW
3025rp="What is the size of an integer (in bytes)? [$dflt]"
3026$echo $n "$rp $c"
3027. myread
3028intsize="$ans"
8d063cd8 3029
16a2aea0
LW
3030: determine which malloc to compile in
3031echo " "
3032case "$usemymalloc" in
3033'')
3034 if bsd || v7; then
3035 dflt='y'
3036 else
3037 dflt='n'
3038 fi
3039 ;;
3040*) dflt="$usemymalloc"
3041 ;;
3042esac
3043rp="Do you wish to attempt to use the malloc that comes with $package? [$dflt]"
3044$echo $n "$rp $c"
3045. myread
3046case "$ans" in
3047'') ans=$dflt;;
3048esac
3049usemymalloc="$ans"
3050case "$ans" in
3051y*) mallocsrc='malloc.c'; mallocobj='malloc.o'
3052 libs=`echo $libs | sed 's/-lmalloc//'`
3053 case "$mallocptrtype" in
3054 '')
3055 cat >usemymalloc.c <<'END'
132b68a5
LW
3056#ifdef __STDC__
3057#include <stdlib.h>
3058#else
16a2aea0 3059#include <malloc.h>
132b68a5 3060#endif
16a2aea0
LW
3061void *malloc();
3062END
3063 if $cc $ccflags -c usemymalloc.c >/dev/null 2>&1; then
3064 mallocptrtype=void
3065 else
3066 mallocptrtype=char
3067 fi
3068 ;;
3069 esac
3070 echo " "
3071 echo "Your system wants malloc to return $mallocptrtype*, it would seem."
3072 ;;
3073*) mallocsrc=''; mallocobj=''; mallocptrtype=void;;
3074esac
3075
a687059c
LW
3076: determine where private executables go
3077case "$privlib" in
8d063cd8 3078'')
a687059c
LW
3079 dflt=/usr/lib/$package
3080 test -d /usr/local/lib && dflt=/usr/local/lib/$package
3081 ;;
3082*) dflt="$privlib"
8d063cd8 3083 ;;
8d063cd8
LW
3084esac
3085$cat <<EOM
8d063cd8 3086
fe14fcc3
LW
3087The $package package has some auxiliary files that should be reside in a library
3088that is accessible by everyone. Where should these "private" but accessible
8d063cd8 3089EOM
fe14fcc3
LW
3090$echo $n "files reside? (~name ok) [$dflt] $c"
3091rp="Private files will reside where? [$dflt]"
8d063cd8 3092. myread
ff2452de 3093privlib=`./filexp "$ans"`
8d063cd8 3094
fe14fcc3
LW
3095case "$installprivlib" in
3096'')
3097 dflt=`echo $privlib | sed 's#^/afs/#/afs/.#'`
132b68a5 3098 test -d $dflt || dflt="$privlib"
fe14fcc3
LW
3099 ;;
3100*) dflt="$installprivlib"
3101 ;;
3102esac
3103$cat <<EOM
3104
3105On some systems (such as afs) you have to install the library files in a
3106different directory to get them to go to the right place. Where should the
3107EOM
3108$echo $n "library files be installed? (~name ok) [$dflt] $c"
3109rp="Install private files where? [$dflt]"
3110. myread
3111installprivlib=`./filexp "$ans"`
3112
a687059c
LW
3113: check for size of random number generator
3114echo " "
3115case "$randbits" in
3116'')
3117 echo "Checking to see how many bits your rand function produces..."
fe14fcc3 3118 $cat >randbits.c <<'EOCP'
a687059c
LW
3119#include <stdio.h>
3120main()
3121{
3122 register int i;
3123 register unsigned long tmp;
3124 register unsigned long max = 0L;
3125
3126 for (i=1000; i; i--) {
3127 tmp = (unsigned long)rand();
3128 if (tmp > max) max = tmp;
3129 }
3130 for (i=0; max; i++)
3131 max /= 2;
3132 printf("%d\n",i);
3133}
3134EOCP
fe14fcc3
LW
3135 if $cc randbits.c -o randbits >/dev/null 2>&1 ; then
3136 dflt=`./randbits`
a687059c
LW
3137 else
3138 dflt='?'
3139 echo "(I can't seem to compile the test program...)"
3140 fi
8d063cd8 3141 ;;
a687059c
LW
3142*)
3143 dflt="$randbits"
8d063cd8 3144 ;;
a687059c
LW
3145esac
3146rp="How many bits does your rand() function produce? [$dflt]"
3147$echo $n "$rp $c"
3148. myread
3149randbits="$ans"
fe14fcc3 3150
132b68a5 3151: determine where publicly executable scripts go
fe14fcc3
LW
3152case "$scriptdir" in
3153'')
3154 dflt="$bin"
3155 : guess some guesses
3156 test -d /usr/share/scripts && dflt=/usr/share/scripts
3157 test -d /usr/share/bin && dflt=/usr/share/bin
3158 ;;
3159*) dflt="$scriptdir"
3160 ;;
3161esac
3162cont=true
3163$cat <<EOM
3164
3165Some installations have a separate directory just for executable scripts so
3166that they can mount it across multiple architectures but keep the scripts in
3167one spot. You might, for example, have a subdirectory of /usr/share for this.
3168Or you might just lump your scripts in with all your other executables.
3169
3170EOM
3171while $test "$cont" ; do
132b68a5 3172 rp="Where will publicly executable scripts reside (~name ok)? [$dflt]"
fe14fcc3
LW
3173 $echo $n "$rp $c"
3174 . myread
3175 scriptdir="$ans"
3176 scriptdir=`./filexp "$scriptdir"`
3177 if test -d $scriptdir; then
3178 cont=''
3179 else
3180 case "$fastread" in
3181 yes) dflt=y;;
3182 *) dflt=n;;
3183 esac
3184 rp="Directory $scriptdir doesn't exist. Use that name anyway? [$dflt]"
3185 $echo $n "$rp $c"
3186 . myread
3187 dflt=''
3188 case "$ans" in
3189 y*) cont='';;
3190 esac
3191 fi
3192done
a687059c 3193
132b68a5
LW
3194case "$installscr" in
3195'')
3196 dflt=`echo $scriptdir | sed 's#^/afs/#/afs/.#'`
3197 test -d $dflt || dflt="$scriptdir"
3198 ;;
3199*) dflt="$scriptdir"
3200 ;;
3201esac
3202cont=true
3203$cat <<EOM
3204
3205Some installations must install scripts in a different directory than where
3206they will eventually reside. On most systems they're the same directory.
3207EOM
3208while $test "$cont" ; do
3209 rp="Where do you install publicly executable scripts (~name ok)? [$dflt]"
3210 $echo $n "$rp $c"
3211 . myread
3212 installscr="$ans"
3213 installscr=`./filexp "$installscr"`
3214 if test -d $installscr; then
3215 cont=''
3216 else
3217 case "$fastread" in
3218 yes) dflt=y;;
3219 *) dflt=n;;
3220 esac
3221 rp="Directory $installscr doesn't exist. Use that name anyway? [$dflt]"
3222 $echo $n "$rp $c"
3223 . myread
3224 dflt=''
3225 case "$ans" in
3226 y*) cont='';;
3227 esac
3228 fi
3229done
3230
a687059c
LW
3231: generate list of signal names
3232echo " "
3233case "$sig_name" in
3234'')
3235 echo "Generating a list of signal names..."
fe14fcc3 3236 set X `cat $usrinclude/signal.h $usrinclude/sys/signal.h 2>&1 | awk '
91407755
LW
3237$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $3 ~ /^[1-9][0-9]*$/ {
3238 sig[$3] = substr($2,4,20)
3239 if (max < $3 && $3 < 60) {
3240 max = $3
3241 }
3242}
3243
3244END {
3245 for (i=1; i<=max; i++) {
3246 if (sig[i] == "")
3247 printf "%d", i
3248 else
3249 printf "%s", sig[i]
3250 if (i < max)
3251 printf " "
3252 }
3253 printf "\n"
3254}
3255'`
a687059c
LW
3256 shift
3257 case $# in
3258 0) echo 'kill -l' >/tmp/foo$$
91407755 3259 set X `$csh -f </tmp/foo$$`
a687059c
LW
3260 shift
3261 case $# in
3262 0)set HUP INT QUIT ILL TRAP IOT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM
3263 ;;
8d063cd8 3264 esac
8d063cd8 3265 ;;
8d063cd8 3266 esac
a687059c 3267 sig_name="ZERO $*"
8d063cd8
LW
3268 ;;
3269esac
a687059c 3270echo "Signals are: $sig_name"
8d063cd8 3271
a687059c 3272: see what type of char stdio uses.
8d063cd8 3273echo " "
132b68a5 3274if $contains 'unsigned.*char.*\*.*_ptr.*;' $usrinclude/stdio.h >/dev/null 2>&1 ; then
a687059c
LW
3275 echo "Your stdio uses unsigned chars."
3276 stdchar="unsigned char"
3277else
3278 echo "Your stdio uses signed chars."
3279 stdchar="char"
3280fi
8d063cd8 3281
a687059c
LW
3282: see what type uids are declared as in the kernel
3283case "$uidtype" in
3284'')
fe14fcc3 3285 if $contains 'uid_t;' $usrinclude/sys/types.h >/dev/null 2>&1 ; then
a687059c 3286 dflt='uid_t';
8d063cd8 3287 else
fe14fcc3 3288 set `grep '_ruid;' $usrinclude/sys/user.h 2>/dev/null` unsigned short
a687059c
LW
3289 case $1 in
3290 unsigned) dflt="$1 $2" ;;
3291 *) dflt="$1" ;;
3292 esac
8d063cd8
LW
3293 fi
3294 ;;
a687059c
LW
3295*) dflt="$uidtype"
3296 ;;
8d063cd8 3297esac
a687059c 3298cont=true
8d063cd8 3299echo " "
03a14243 3300rp="What type are user ids returned by getuid(), etc.? [$dflt]"
8d063cd8
LW
3301$echo $n "$rp $c"
3302. myread
a687059c 3303uidtype="$ans"
8d063cd8 3304
fe14fcc3
LW
3305: check for void type
3306echo " "
3307$cat <<EOM
3308Checking to see how well your C compiler groks the void type...
3309
3310 Support flag bits are:
3311 1: basic void declarations.
3312 2: arrays of pointers to functions returning void.
3313 4: operations between pointers to and addresses of void functions.
3314
3315EOM
3316case "$voidhave" in
3317'')
3318 $cat >void.c <<'EOCP'
3319#if TRY & 1
3320void main() {
3321#else
3322main() {
3323#endif
3324 extern void moo(); /* function returning void */
3325 void (*goo)(); /* ptr to func returning void */
3326#if TRY & 2
3327 void (*foo[10])();
3328#endif
3329
3330#if TRY & 4
3331 if(goo == moo) {
3332 exit(0);
3333 }
3334#endif
3335 exit(0);
3336}
3337EOCP
132b68a5 3338 if $cc -c -DTRY=$voidwant void.c >void.out 2>&1 ; then
fe14fcc3
LW
3339 voidhave=$voidwant
3340 echo "It appears to support void to the level $package wants ($voidwant)."
3341 if $contains warning void.out >/dev/null 2>&1; then
3342 echo "However, you might get some warnings that look like this:"
3343 $cat void.out
3344 fi
3345 else
3346 echo "Hmm, your compiler has some difficulty with void. Checking further..."
132b68a5 3347 if $cc -c -DTRY=1 void.c >/dev/null 2>&1 ; then
fe14fcc3 3348 echo "It supports 1..."
132b68a5 3349 if $cc -c -DTRY=3 void.c >/dev/null 2>&1 ; then
fe14fcc3
LW
3350 voidhave=3
3351 echo "And it supports 2 but not 4."
3352 else
3353 echo "It doesn't support 2..."
132b68a5 3354 if $cc -c -DTRY=5 void.c >/dev/null 2>&1 ; then
fe14fcc3
LW
3355 voidhave=5
3356 echo "But it supports 4."
3357 else
3358 voidhave=1
3359 echo "And it doesn't support 4."
3360 fi
3361 fi
3362 else
3363 echo "There is no support at all for void."
3364 voidhave=0
3365 fi
3366 fi
3367esac
3368dflt="$voidhave";
3369rp="Your void support flags add up to what? [$dflt]"
3370$echo $n "$rp $c"
3371. myread
3372voidhave="$ans"
3373
a687059c
LW
3374: preserve RCS keywords in files with variable substitution, grrr
3375Log='$Log'
3376Header='$Header'
fe14fcc3 3377Id='$Id'
16a2aea0
LW
3378Author='$Author'
3379Date='$Date'
3380Locker='$Locker'
3381RCSfile='$RCSfile'
3382Revision='$Revision'
3383Source='$Source'
3384State='$State'
a687059c 3385
e5d73d77 3386
d8f2e4cc
LW
3387: determine compiler compiler
3388case "$yacc" in
fe14fcc3
LW
3389'') if xenix; then
3390 dflt=yacc
3391 else
3392 dflt='yacc -Sm25000'
3393 fi
3394 ;;
d8f2e4cc
LW
3395*) dflt="$yacc";;
3396esac
3397cont=true
3398 echo " "
449aadca 3399rp="Which compiler compiler (yacc or bison -y) will you use? [$dflt]"
d8f2e4cc
LW
3400$echo $n "$rp $c"
3401. myread
3402case "$ans" in
3403'') ans="$dflt";;
3404esac
3405yacc="$ans"
3406
fe14fcc3
LW
3407: see if we can include fcntl.h
3408echo " "
3409if $h_fcntl; then
16a2aea0 3410 val="$define"
fe14fcc3
LW
3411 echo "We'll be including <fcntl.h>."
3412else
16a2aea0 3413 val="$undef"
fe14fcc3
LW
3414 if $h_sys_file; then
3415 echo "We don't need to <fcntl.h> if we include <sys/file.h>."
3416 else
3417 echo "We won't be including <fcntl.h>."
3418 fi
3419fi
16a2aea0
LW
3420set i_fcntl
3421eval $setvar
fe14fcc3
LW
3422
3423: see if gdbm is available
3424echo " "
3425xxx=`./loc gdbm.h x $usrinclude /usr/local/include $inclwanted`
3426if test -f $xxx; then
16a2aea0 3427 val="$define"
fe14fcc3
LW
3428 echo "gdbm.h found."
3429else
16a2aea0 3430 val="$undef"
fe14fcc3
LW
3431 echo "gdbm.h not found."
3432fi
16a2aea0
LW
3433set i_gdbm
3434eval $setvar
fe14fcc3
LW
3435
3436: see if this is an grp system
3437echo " "
3438if $test -r $usrinclude/grp.h ; then
16a2aea0 3439 val="$define"
fe14fcc3
LW
3440 echo "grp.h found."
3441else
16a2aea0 3442 val="$undef"
fe14fcc3
LW
3443 echo "No grp.h found."
3444fi
16a2aea0
LW
3445set i_grp
3446eval $setvar
fe14fcc3
LW
3447
3448: see if this is a netinet/in.h or sys/in.h system
3449echo " "
3450xxx=`./loc netinet/in.h x $usrinclude /usr/local/include $inclwanted`
3451if test -f $xxx; then
16a2aea0
LW
3452 val="$define"
3453 val2="$undef"
fe14fcc3
LW
3454 echo "netinet/in.h found."
3455else
16a2aea0 3456 val="$undef"
fe14fcc3
LW
3457 echo "No netinet/in.h found, ..."
3458 xxx=`./loc sys/in.h x $usrinclude /usr/local/include $inclwanted`
3459 if test -f $xxx; then
16a2aea0 3460 val2="$define"
fe14fcc3
LW
3461 echo "but I found sys/in.h instead."
3462 else
16a2aea0 3463 val2="$undef"
fe14fcc3
LW
3464 echo "and I didn't find sys/in.h either."
3465 fi
3466fi
16a2aea0
LW
3467set i_niin
3468eval $setvar
3469val=$val2
3470set i_sysin
3471eval $setvar
fe14fcc3
LW
3472
3473: Do we need to #include <sys/file.h> ?
3474echo " "
3475if $h_sys_file; then
16a2aea0 3476 val="$define"
fe14fcc3
LW
3477 echo "We'll be including <sys/file.h>."
3478else
16a2aea0 3479 val="$undef"
fe14fcc3
LW
3480 echo "We won't be including <sys/file.h>."
3481fi
16a2aea0
LW
3482set i_sys_file
3483eval $setvar
fe14fcc3
LW
3484
3485: see if ioctl defs are in sgtty/termio or sys/ioctl
3486echo " "
3487if $test -r $usrinclude/sys/ioctl.h ; then
16a2aea0 3488 val="$define"
fe14fcc3
LW
3489 echo "sys/ioctl.h found."
3490else
16a2aea0 3491 val="$undef"
fe14fcc3
LW
3492 echo "sys/ioctl.h not found, assuming ioctl args are defined in sgtty.h."
3493fi
16a2aea0
LW
3494set i_sysioctl
3495eval $setvar
fe14fcc3
LW
3496
3497: see if we should include utime.h
3498echo " "
3499if $test -r $usrinclude/utime.h ; then
16a2aea0 3500 val="$define"
fe14fcc3
LW
3501 echo "utime.h found."
3502else
16a2aea0 3503 val="$undef"
fe14fcc3
LW
3504 echo "No utime.h found, but that's ok."
3505fi
16a2aea0
LW
3506set i_utime
3507eval $setvar
fe14fcc3
LW
3508
3509: see if this is a varargs system
3510echo " "
3511if $test -r $usrinclude/varargs.h ; then
16a2aea0 3512 val="$define"
fe14fcc3
LW
3513 echo "varargs.h found."
3514else
16a2aea0 3515 val="$undef"
fe14fcc3
LW
3516 echo "No varargs.h found, but that's ok (I hope)."
3517fi
16a2aea0
LW
3518set i_varargs
3519eval $setvar
fe14fcc3
LW
3520
3521: see if this is a vfork system
3522echo " "
3523if $test -r $usrinclude/vfork.h ; then
16a2aea0 3524 val="$define"
fe14fcc3
LW
3525 echo "vfork.h found."
3526else
16a2aea0 3527 val="$undef"
fe14fcc3
LW
3528 echo "No vfork.h found."
3529fi
16a2aea0
LW
3530set i_vfork
3531eval $setvar
fe14fcc3
LW
3532
3533: end of configuration questions
8d063cd8
LW
3534echo " "
3535echo "End of configuration questions."
3536echo " "
3537
3538: create config.sh file
3539echo " "
3540if test -d ../UU; then
3541 cd ..
3542fi
3543echo "Creating config.sh..."
132b68a5 3544test -f config.sh && cp config.sh UU/oldconfig.sh
8d063cd8
LW
3545$spitshell <<EOT >config.sh
3546$startsh
3547# config.sh
3548# This file was produced by running the Configure script.
8d063cd8 3549d_eunice='$d_eunice'
8d063cd8 3550define='$define'
91407755 3551eunicefix='$eunicefix'
8d063cd8
LW
3552loclist='$loclist'
3553expr='$expr'
3554sed='$sed'
3555echo='$echo'
3556cat='$cat'
3557rm='$rm'
3558mv='$mv'
3559cp='$cp'
3560tail='$tail'
3561tr='$tr'
3562mkdir='$mkdir'
3563sort='$sort'
3564uniq='$uniq'
3565grep='$grep'
3566trylist='$trylist'
3567test='$test'
3568inews='$inews'
3569egrep='$egrep'
3570more='$more'
3571pg='$pg'
3572Mcc='$Mcc'
3573vi='$vi'
3574mailx='$mailx'
3575mail='$mail'
378cc40b 3576cpp='$cpp'
a687059c
LW
3577perl='$perl'
3578emacs='$emacs'
3579ls='$ls'
3580rmail='$rmail'
3581sendmail='$sendmail'
3582shar='$shar'
3583smail='$smail'
3584tbl='$tbl'
3585troff='$troff'
3586nroff='$nroff'
3587uname='$uname'
3588uuname='$uuname'
3589line='$line'
3590chgrp='$chgrp'
3591chmod='$chmod'
3592lint='$lint'
3593sleep='$sleep'
3594pr='$pr'
3595tar='$tar'
3596ln='$ln'
3597lpr='$lpr'
3598lp='$lp'
3599touch='$touch'
3600make='$make'
3601date='$date'
91407755 3602csh='$csh'
fe14fcc3
LW
3603bash='$bash'
3604ksh='$ksh'
3605lex='$lex'
3606flex='$flex'
3607bison='$bison'
8d063cd8
LW
3608Log='$Log'
3609Header='$Header'
fe14fcc3 3610Id='$Id'
16a2aea0 3611lastuname='$lastuname'
7e1cf235 3612alignbytes='$alignbytes'
8d063cd8 3613bin='$bin'
fe14fcc3 3614installbin='$installbin'
a687059c 3615byteorder='$byteorder'
8d063cd8 3616contains='$contains'
378cc40b 3617cppstdin='$cppstdin'
36ce8bec 3618cppminus='$cppminus'
a687059c 3619d_bcmp='$d_bcmp'
135863df 3620d_bcopy='$d_bcopy'
0d3e774c 3621d_bzero='$d_bzero'
21d892ea 3622d_castneg='$d_castneg'
7e1cf235 3623castflags='$castflags'
8d063cd8 3624d_charsprf='$d_charsprf'
79220ce3 3625d_chsize='$d_chsize'
2e1b3b7e 3626d_crypt='$d_crypt'
a687059c 3627cryptlib='$cryptlib'
91407755 3628d_csh='$d_csh'
13281fa4 3629d_dosuid='$d_dosuid'
a687059c 3630d_dup2='$d_dup2'
378cc40b
LW
3631d_fchmod='$d_fchmod'
3632d_fchown='$d_fchown'
a687059c 3633d_fcntl='$d_fcntl'
7e1cf235 3634d_flexfnam='$d_flexfnam'
a687059c 3635d_flock='$d_flock'
378cc40b 3636d_getgrps='$d_getgrps'
a687059c
LW
3637d_gethent='$d_gethent'
3638d_getpgrp='$d_getpgrp'
d8f2e4cc 3639d_getpgrp2='$d_getpgrp2'
a687059c
LW
3640d_getprior='$d_getprior'
3641d_htonl='$d_htonl'
8d063cd8 3642d_index='$d_index'
378cc40b 3643d_killpg='$d_killpg'
0d3e774c 3644d_lstat='$d_lstat'
a687059c 3645d_memcmp='$d_memcmp'
378cc40b 3646d_memcpy='$d_memcpy'
a687059c 3647d_mkdir='$d_mkdir'
fe14fcc3
LW
3648d_msg='$d_msg'
3649d_msgctl='$d_msgctl'
3650d_msgget='$d_msgget'
3651d_msgrcv='$d_msgrcv'
3652d_msgsnd='$d_msgsnd'
a687059c
LW
3653d_ndbm='$d_ndbm'
3654d_odbm='$d_odbm'
fe14fcc3 3655d_open3='$d_open3'
a687059c 3656d_readdir='$d_readdir'
378cc40b 3657d_rename='$d_rename'
a687059c 3658d_rmdir='$d_rmdir'
79220ce3 3659d_select='$d_select'
fe14fcc3
LW
3660d_sem='$d_sem'
3661d_semctl='$d_semctl'
3662d_semget='$d_semget'
3663d_semop='$d_semop'
378cc40b
LW
3664d_setegid='$d_setegid'
3665d_seteuid='$d_seteuid'
a687059c 3666d_setpgrp='$d_setpgrp'
d8f2e4cc 3667d_setpgrp2='$d_setpgrp2'
a687059c
LW
3668d_setprior='$d_setprior'
3669d_setregid='$d_setregid'
3670d_setresgid='$d_setresgid'
3671d_setreuid='$d_setreuid'
3672d_setresuid='$d_setresuid'
378cc40b
LW
3673d_setrgid='$d_setrgid'
3674d_setruid='$d_setruid'
fe14fcc3
LW
3675d_shm='$d_shm'
3676d_shmat='$d_shmat'
132b68a5 3677d_voidshmat='$d_voidshmat'
fe14fcc3
LW
3678d_shmctl='$d_shmctl'
3679d_shmdt='$d_shmdt'
3680d_shmget='$d_shmget'
a687059c
LW
3681d_socket='$d_socket'
3682d_sockpair='$d_sockpair'
3683d_oldsock='$d_oldsock'
3684socketlib='$socketlib'
135863df 3685d_statblks='$d_statblks'
36ce8bec 3686d_stdstdio='$d_stdstdio'
8d063cd8 3687d_strctcpy='$d_strctcpy'
d8f2e4cc 3688d_strerror='$d_strerror'
2e1b3b7e 3689d_symlink='$d_symlink'
a687059c 3690d_syscall='$d_syscall'
79220ce3 3691d_truncate='$d_truncate'
8d063cd8 3692d_vfork='$d_vfork'
36ce8bec 3693d_voidsig='$d_voidsig'
fe14fcc3 3694d_tosignal='$d_tosignal'
449aadca 3695d_volatile='$d_volatile'
a687059c
LW
3696d_vprintf='$d_vprintf'
3697d_charvspr='$d_charvspr'
91407755 3698d_wait4='$d_wait4'
b6ccd89c 3699d_waitpid='$d_waitpid'
378cc40b 3700gidtype='$gidtype'
16a2aea0 3701groupstype='$groupstype'
a687059c 3702i_fcntl='$i_fcntl'
fe14fcc3 3703i_gdbm='$i_gdbm'
a687059c 3704i_grp='$i_grp'
03a14243 3705i_niin='$i_niin'
fe14fcc3 3706i_sysin='$i_sysin'
a687059c
LW
3707i_pwd='$i_pwd'
3708d_pwquota='$d_pwquota'
3709d_pwage='$d_pwage'
91407755
LW
3710d_pwchange='$d_pwchange'
3711d_pwclass='$d_pwclass'
3712d_pwexpire='$d_pwexpire'
fe14fcc3
LW
3713d_pwcomment='$d_pwcomment'
3714i_sys_file='$i_sys_file'
a687059c 3715i_sysioctl='$i_sysioctl'
d8f2e4cc 3716i_time='$i_time'
fe14fcc3
LW
3717i_sys_time='$i_sys_time'
3718i_sys_select='$i_sys_select'
d8f2e4cc
LW
3719d_systimekernel='$d_systimekernel'
3720i_utime='$i_utime'
a687059c
LW
3721i_varargs='$i_varargs'
3722i_vfork='$i_vfork'
3723intsize='$intsize'
8d063cd8 3724libc='$libc'
fe14fcc3
LW
3725nm_opts='$nm_opts'
3726libndir='$libndir'
3727i_my_dir='$i_my_dir'
3728i_ndir='$i_ndir'
3729i_sys_ndir='$i_sys_ndir'
3730i_dirent='$i_dirent'
3731i_sys_dir='$i_sys_dir'
3732d_dirnamlen='$d_dirnamlen'
3733ndirc='$ndirc'
3734ndiro='$ndiro'
a1cc2bdc
AR
3735mallocsrc='$mallocsrc'
3736mallocobj='$mallocobj'
3737usemymalloc='$usemymalloc'
16a2aea0 3738mallocptrtype='$mallocptrtype'
8d063cd8
LW
3739mansrc='$mansrc'
3740manext='$manext'
3741models='$models'
3742split='$split'
3743small='$small'
3744medium='$medium'
3745large='$large'
3746huge='$huge'
a687059c 3747optimize='$optimize'
8d063cd8 3748ccflags='$ccflags'
91407755 3749cppflags='$cppflags'
8d063cd8 3750ldflags='$ldflags'
a687059c 3751cc='$cc'
132b68a5 3752nativegcc='$nativegcc'
a687059c 3753libs='$libs'
8d063cd8
LW
3754n='$n'
3755c='$c'
3756package='$package'
a687059c 3757randbits='$randbits'
79220ce3 3758scriptdir='$scriptdir'
132b68a5 3759installscr='$installscr'
a687059c 3760sig_name='$sig_name'
8d063cd8
LW
3761spitshell='$spitshell'
3762shsharp='$shsharp'
3763sharpbang='$sharpbang'
3764startsh='$startsh'
36ce8bec 3765stdchar='$stdchar'
378cc40b 3766uidtype='$uidtype'
fe14fcc3
LW
3767usrinclude='$usrinclude'
3768inclPath='$inclPath'
3769void='$void'
3770voidhave='$voidhave'
3771voidwant='$voidwant'
3772w_localtim='$w_localtim'
3773w_s_timevl='$w_s_timevl'
3774w_s_tm='$w_s_tm'
d8f2e4cc 3775yacc='$yacc'
d8f2e4cc 3776lib='$lib'
fe14fcc3
LW
3777privlib='$privlib'
3778installprivlib='$installprivlib'
8d063cd8 3779EOT
13281fa4 3780
132b68a5
LW
3781test -f patchlevel.h && awk '{printf "%s=%s\n",$2,$3}' patchlevel.h >>config.sh
3782echo "CONFIG=true" >>config.sh
3783
3784if test -f UU/oldconfig.sh; then
3785 sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
3786 sort | uniq -u >UU/oldsyms
3787 set X `cat UU/oldsyms`
3788 shift
3789 case $# in
3790 0) ;;
3791 *) echo "Hmm...You had some extra variables I don't know about...I'll try to keep 'em..."
3792 for sym in `cat UU/oldsyms`; do
3793 echo " Propagating $hint variable "'$'"$sym..."
3794 eval 'tmp="$'"${sym}"'"'
3795 echo "$tmp" | \
3796 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
3797 done
3798 ;;
3799 esac
3800fi
3801
fe14fcc3 3802: Finish up
8d063cd8
LW
3803CONFIG=true
3804
3805echo " "
3806dflt=''
378cc40b 3807fastread=''
8d063cd8
LW
3808echo "If you didn't make any mistakes, then just type a carriage return here."
3809rp="If you need to edit config.sh, do it as a shell escape here:"
3810$echo $n "$rp $c"
3811. UU/myread
3812case "$ans" in
3813'') ;;
3814*) : in case they cannot read
3815 eval $ans;;
3816esac
132b68a5
LW
3817chmod +x doSH
3818./doSH
8d063cd8 3819
fe14fcc3 3820if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
8d063cd8
LW
3821 dflt=n
3822 $cat <<EOM
3823
3824Now you need to generate make dependencies by running "make depend".
3825You might prefer to run it in background: "make depend > makedepend.out &"
3826It can take a while, so you might not want to run it right now.
3827
3828EOM
3829 rp="Run make depend now? [$dflt]"
3830 $echo $n "$rp $c"
3831 . UU/myread
3832 case "$ans" in
a687059c 3833 y*) make depend && echo "Now you must run a make."
8d063cd8
LW
3834 ;;
3835 *) echo "You must run 'make depend' then 'make'."
3836 ;;
3837 esac
fe14fcc3 3838elif test -f [Mm]akefile; then
8d063cd8
LW
3839 echo " "
3840 echo "Now you must run a make."
3841else
3842 echo "Done."
3843fi
3844
3845$rm -f kit*isdone
132b68a5 3846$rm -rf UU
8d063cd8 3847: end of Configure