This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
allow extensions to be specified as paths
[perl5.git] / Configure
CommitLineData
2304df62
AD
1#! /bin/sh
2#
3# If these # comments don't work, trim them. Don't worry about any other
4# shell scripts, Configure will trim # comments from them for you.
5#
6# (If you are trying to port this package to a machine without sh,
7# I would suggest you have a look at the prototypical config_h.SH file
8# and edit it to reflect your system. Some packages may include samples
9# of config.h for certain machines, so you might look for one of those.)
10#
11# Yes, you may rip this off to use in other distribution packages. This
12# script belongs to the public domain and cannot be copyrighted.
13#
14# (Note: this Configure script was generated automatically. Rather than
15# working with this copy of Configure, you may wish to get metaconfig.
16# The dist-3.0 package (which contains metaconfig) was posted in
dfe9444c
AD
17# comp.sources.misc and is available on CPAN under authors/id/RAM so
18# you may fetch it yourself from your nearest archive site.)
2304df62
AD
19#
20
dfe9444c 21# $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
2304df62 22#
24548b42 23# Generated on Tue Jul 7 10:10:21 EDT 1998 [metaconfig 3.0 PL70]
bfb7748a 24# (with additional metaconfig patches by doughera@lafayette.edu)
2304df62
AD
25
26cat >/tmp/c1$$ <<EOF
27ARGGGHHHH!!!!!
28
29SCO csh still thinks true is false. Write to SCO today and tell them that next
30year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32(Actually, Configure ought to just patch csh in place. Hmm. Hmmmmm. All
33we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35[End of diatribe. We now return you to your regularly scheduled programming...]
36EOF
37cat >/tmp/c2$$ <<EOF
38
39OOPS! You naughty creature! You didn't run Configure with sh!
40I will attempt to remedy the situation by running sh for you...
41EOF
42
43true || cat /tmp/c1$$ /tmp/c2$$
44true || exec sh $0 $argv:q
45
46(exit $?0) || cat /tmp/c2$$
47(exit $?0) || exec sh $0 $argv:q
48rm -f /tmp/c1$$ /tmp/c2$$
49
a0d0e21e
LW
50: compute my invocation name
51me=$0
52case "$0" in
53*/*)
54 me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
55 test "$me" || me=$0
56 ;;
57esac
58
28e8609d
JH
59: the newline for tr
60if test X"$trnl" = X; then
61 case "`echo foo|tr '\n' x 2>/dev/null`" in
62 foox)
63 trnl='\n'
64 ;;
65 esac
66fi
67if test X"$trnl" = X; then
68 case "`echo foo|tr '\012' x 2>/dev/null`" in
69 foox)
70 trnl='\012'
71 ;;
72 esac
73fi
38b9e83a
LM
74if test -n "$DJGPP"; then
75 trnl='\012'
76fi
28e8609d
JH
77if test X"$trnl" = X; then
78 cat <<EOM >&2
79
80$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
81
82EOM
83 exit 1
84fi
85
dfe9444c 86: Proper separator for the PATH environment variable
8e07c86e
AD
87p_=:
88: On OS/2 this directory should exist if this is not floppy only system :-]
dfe9444c
AD
89if test -d c:/. ; then
90 if test -n "$OS2_SHELL"; then
91 p_=\;
92 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
93 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
c4f23d77 94 elif test -n "$DJGPP"; then
dfe9444c
AD
95 p_=\;
96 fi
39e571d4 97fi
a0d0e21e
LW
98
99: Proper PATH setting
100paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
16d20bd9 101paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
232e078e 102paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
16d20bd9 103paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
232e078e
AD
104paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
105paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
106paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
107paths="$paths /sbin /usr/sbin /usr/libexec"
a0d0e21e
LW
108
109for p in $paths
110do
8e07c86e
AD
111 case "$p_$PATH$p_" in
112 *$p_$p$p_*) ;;
113 *) test -d $p && PATH=$PATH$p_$p ;;
a0d0e21e
LW
114 esac
115done
116
8e07c86e 117PATH=.$p_$PATH
2304df62
AD
118export PATH
119
dfe9444c
AD
120: shall we be using ksh?
121inksh=''
122needksh=''
123avoidksh=''
124newsh=/bin/ksh
125changesh=''
ff0cee69 126if (PATH=.; alias -x) >/dev/null 2>&1; then
dfe9444c
AD
127 inksh=true
128fi
129if test -f /hp-ux -a -f /bin/ksh; then
130 needksh='to avoid sh bug in "here document" expansion'
131fi
132if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
133 if test X`/usr/bin/uname -v` = X4; then
134 avoidksh="to avoid AIX 4's /bin/sh"
135 newsh=/usr/bin/bsh
2304df62 136 fi
dfe9444c
AD
137fi
138case "$inksh/$needksh" in
139/[a-z]*)
c4f23d77 140 ENV=''
dfe9444c
AD
141 changesh=true
142 reason="$needksh"
143 ;;
144esac
145case "$inksh/$avoidksh" in
146true/[a-z]*)
147 changesh=true
148 reason="$avoidksh"
149 ;;
150esac
151case "$inksh/$needksh-$avoidksh-" in
152true/--)
a0d0e21e
LW
153 cat <<EOM
154(I see you are using the Korn shell. Some ksh's blow up on $me,
dfe9444c 155mainly on older exotic systems. If yours does, try the Bourne shell instead.)
ff0cee69 156EOM
dfe9444c
AD
157 ;;
158esac
159case "$changesh" in
160true)
161 echo "(Feeding myself to $newsh $reason.)"
162 case "$0" in
163 Configure|*/Configure) exec $newsh $0 "$@";;
164 *) exec $newsh Configure "$@";;
165 esac
166 ;;
167esac
2304df62 168
bfb7748a
AD
169: if needed set CDPATH to a harmless value that is not chatty
170: avoid bash 2.02 problems with empty CDPATH.
171case "$CDPATH" in
172'') ;;
173*) case "$SHELL" in
174 *bash*) CDPATH='.' ;;
175 *) CDPATH='' ;;
176 esac
177 ;;
178esac
2304df62
AD
179: Configure runs within the UU subdirectory
180test -d UU || mkdir UU
8e07c86e 181cd UU && rm -f ./*
2304df62 182
a0d0e21e 183dynamic_ext=''
2304df62 184extensions=''
a0d0e21e 185known_extensions=''
4318d5a0 186nonxs_ext=''
bfb7748a 187static_ext=''
8ff267be 188useopcode=''
a0d0e21e 189useposix=''
ecfc5424 190d_bsd=''
40a7a20a 191d_eunice=''
2304df62
AD
192d_xenix=''
193eunicefix=''
194Mcc=''
dfe9444c 195ar=''
2304df62
AD
196awk=''
197bash=''
198bison=''
199byacc=''
200cat=''
201chgrp=''
202chmod=''
203chown=''
ecfc5424 204comm=''
2304df62
AD
205compress=''
206cp=''
207cpio=''
208cpp=''
209csh=''
210date=''
211echo=''
212egrep=''
213emacs=''
214expr=''
215find=''
216flex=''
2304df62 217grep=''
8ff267be 218gzip=''
2304df62
AD
219inews=''
220ksh=''
221less=''
222line=''
223lint=''
224ln=''
225lp=''
226lpr=''
227ls=''
228mail=''
229mailx=''
dfe9444c 230make=''
2304df62
AD
231mkdir=''
232more=''
233mv=''
693762b4 234nm=''
2304df62
AD
235nroff=''
236perl=''
237pg=''
238pmake=''
239pr=''
240rm=''
241rmail=''
242sed=''
243sendmail=''
2304df62
AD
244shar=''
245sleep=''
246smail=''
247sort=''
248submit=''
249tail=''
250tar=''
251tbl=''
693762b4 252tee=''
2304df62
AD
253test=''
254touch=''
255tr=''
256troff=''
257uname=''
258uniq=''
259uuname=''
260vi=''
261zcat=''
8ff267be 262zip=''
1aef975c 263full_sed=''
a0d0e21e 264libswanted=''
2304df62
AD
265hint=''
266myuname=''
85e6fe83
LW
267osname=''
268osvers=''
2304df62
AD
269Author=''
270Date=''
271Header=''
272Id=''
273Locker=''
274Log=''
275RCSfile=''
276Revision=''
277Source=''
278State=''
dfe9444c
AD
279_a=''
280_exe=''
281_o=''
4633a7c4
LW
282archobjs=''
283exe_ext=''
284firstmakefile=''
285lib_ext=''
286obj_ext=''
287path_sep=''
2304df62 288afs=''
a0d0e21e 289alignbytes=''
c4f23d77 290ansi2knr=''
a0d0e21e
LW
291archlib=''
292archlibexp=''
a0d0e21e
LW
293d_archlib=''
294installarchlib=''
40000a8c
AD
295archname=''
296myarchname=''
ecfc5424 297baserev=''
2304df62
AD
298bin=''
299binexp=''
300installbin=''
301byteorder=''
302cc=''
303gccversion=''
304ccflags=''
305cppflags=''
306ldflags=''
307lkflags=''
8e07c86e 308locincpth=''
2304df62 309optimize=''
8e07c86e 310cf_email=''
2304df62
AD
311cf_by=''
312cf_time=''
313contains=''
a0d0e21e 314cpp_stuff=''
2304df62
AD
315cpplast=''
316cppminus=''
317cpprun=''
318cppstdin=''
319d_access=''
a0d0e21e 320d_alarm=''
ecfc5424 321d_attribut=''
2304df62
AD
322d_bcmp=''
323d_bcopy=''
324d_bzero=''
325d_casti32=''
326castflags=''
327d_castneg=''
a0d0e21e
LW
328d_chown=''
329d_chroot=''
2304df62 330d_chsize=''
a0d0e21e
LW
331d_closedir=''
332d_void_closedir=''
2304df62
AD
333d_const=''
334cryptlib=''
335d_crypt=''
336d_csh=''
1aef975c 337full_csh=''
a0d0e21e
LW
338d_cuserid=''
339d_dbl_dig=''
340d_difftime=''
341d_dlerror=''
342d_dlopen=''
343d_dlsymun=''
2304df62 344d_dosuid=''
a0d0e21e 345d_suidsafe=''
2304df62 346d_dup2=''
e5c9fcd0
AD
347d_endhent=''
348d_endnent=''
349d_endpent=''
350d_endsent=''
2304df62
AD
351d_fchmod=''
352d_fchown=''
353d_fcntl=''
a0d0e21e
LW
354d_fd_macros=''
355d_fd_set=''
356d_fds_bits=''
357d_fgetpos=''
2304df62
AD
358d_flexfnam=''
359d_flock=''
a0d0e21e
LW
360d_fork=''
361d_fsetpos=''
5f05dabc 362d_ftime=''
363d_gettimeod=''
a0d0e21e 364d_Gconvert=''
2304df62 365d_getgrps=''
4599a1de 366d_gethbyaddr=''
4599a1de 367d_gethbyname=''
dfe9444c 368d_gethent=''
2304df62
AD
369aphostname=''
370d_gethname=''
371d_phostname=''
372d_uname=''
dc45a647 373d_gethostprotos=''
a0d0e21e 374d_getlogin=''
dfe9444c 375d_getnbyaddr=''
693762b4 376d_getnbyname=''
e5c9fcd0 377d_getnent=''
dc45a647 378d_getnetprotos=''
e5c9fcd0 379d_getpent=''
2afac517 380d_getpgid=''
2304df62 381d_getpgrp2=''
2afac517 382d_bsdgetpgrp=''
2304df62 383d_getpgrp=''
a0d0e21e 384d_getppid=''
2304df62 385d_getprior=''
693762b4
AD
386d_getpbyname=''
387d_getpbynumber=''
dc45a647 388d_getprotoprotos=''
e5c9fcd0 389d_getsent=''
dc45a647 390d_getservprotos=''
693762b4
AD
391d_getsbyname=''
392d_getsbyport=''
a4f3eea9 393d_gnulibc=''
93341792 394i_arpainet=''
2304df62 395d_htonl=''
7e1af8bc 396d_inetaton=''
2304df62
AD
397d_isascii=''
398d_killpg=''
dd64f1c3 399d_lchown=''
2304df62 400d_link=''
a0d0e21e
LW
401d_locconv=''
402d_lockf=''
e5c9fcd0
AD
403d_longdbl=''
404longdblsize=''
dc45a647
MB
405d_longlong=''
406longlongsize=''
2304df62 407d_lstat=''
a0d0e21e
LW
408d_mblen=''
409d_mbstowcs=''
410d_mbtowc=''
2304df62
AD
411d_memcmp=''
412d_memcpy=''
413d_memmove=''
414d_memset=''
415d_mkdir=''
a0d0e21e
LW
416d_mkfifo=''
417d_mktime=''
2304df62
AD
418d_msg=''
419d_msgctl=''
420d_msgget=''
421d_msgrcv=''
422d_msgsnd=''
a0d0e21e 423d_nice=''
2304df62 424d_open3=''
a0d0e21e
LW
425d_fpathconf=''
426d_pathconf=''
427d_pause=''
428d_pipe=''
8e07c86e 429d_poll=''
2304df62 430d_portable=''
dfe9444c
AD
431d_pthread_yield=''
432d_sched_yield=''
433d_pthreads_created_joinable=''
2304df62 434d_readdir=''
85e6fe83
LW
435d_rewinddir=''
436d_seekdir=''
437d_telldir=''
a0d0e21e 438d_readlink=''
2304df62
AD
439d_rename=''
440d_rmdir=''
441d_safebcpy=''
442d_safemcpy=''
36477c24 443d_sanemcmp=''
2304df62
AD
444d_select=''
445d_sem=''
446d_semctl=''
447d_semget=''
448d_semop=''
449d_setegid=''
450d_seteuid=''
dfe9444c 451d_setgrps=''
693762b4 452d_sethent=''
a0d0e21e 453d_setlinebuf=''
2304df62 454d_setlocale=''
e5c9fcd0
AD
455d_setnent=''
456d_setpent=''
2304df62
AD
457d_setpgid=''
458d_setpgrp2=''
2afac517 459d_bsdsetpgrp=''
2304df62
AD
460d_setpgrp=''
461d_setprior=''
462d_setregid=''
463d_setresgid=''
464d_setresuid=''
465d_setreuid=''
466d_setrgid=''
467d_setruid=''
e5c9fcd0 468d_setsent=''
2304df62 469d_setsid=''
e5c9fcd0 470d_setvbuf=''
760ac839 471d_sfio=''
8ff267be 472usesfio=''
2304df62
AD
473d_shm=''
474d_shmat=''
a0d0e21e
LW
475d_shmatprototype=''
476shmattype=''
2304df62
AD
477d_shmctl=''
478d_shmdt=''
479d_shmget=''
2c7991dc 480d_sigaction=''
8ff267be 481d_sigsetjmp=''
2304df62
AD
482d_oldsock=''
483d_socket=''
484d_sockpair=''
485sockethdr=''
486socketlib=''
487d_statblks=''
c2960299
AD
488d_stdio_cnt_lval=''
489d_stdio_ptr_lval=''
16d20bd9 490d_stdiobase=''
2304df62 491d_stdstdio=''
16d20bd9
AD
492stdio_base=''
493stdio_bufsiz=''
494stdio_cnt=''
dfe9444c 495stdio_filbuf=''
16d20bd9 496stdio_ptr=''
2304df62
AD
497d_index=''
498d_strchr=''
a0d0e21e 499d_strcoll=''
2304df62
AD
500d_strctcpy=''
501d_strerrm=''
502d_strerror=''
503d_sysernlst=''
504d_syserrlst=''
a89d8a78
DH
505d_strtod=''
506d_strtol=''
507d_strtoul=''
a0d0e21e 508d_strxfrm=''
2304df62
AD
509d_symlink=''
510d_syscall=''
a0d0e21e 511d_sysconf=''
2304df62 512d_system=''
a0d0e21e
LW
513d_tcgetpgrp=''
514d_tcsetpgrp=''
85e6fe83
LW
515d_time=''
516timetype=''
2304df62
AD
517clocktype=''
518d_times=''
519d_truncate=''
a0d0e21e
LW
520d_tzname=''
521d_umask=''
bd89102f
AD
522d_semctl_semid_ds=''
523d_semctl_semun=''
524d_union_semun=''
2304df62 525d_vfork=''
a0d0e21e 526usevfork=''
2304df62
AD
527d_voidsig=''
528signal_t=''
529d_volatile=''
530d_charvspr=''
531d_vprintf=''
532d_wait4=''
533d_waitpid=''
a0d0e21e
LW
534d_wcstombs=''
535d_wctomb=''
536dlext=''
85e6fe83
LW
537cccdlflags=''
538ccdlflags=''
2304df62 539dlsrc=''
232e078e 540ld=''
85e6fe83 541lddlflags=''
2304df62 542usedl=''
693762b4 543doublesize=''
a0d0e21e 544fpostype=''
2304df62
AD
545gidtype=''
546groupstype=''
547h_fcntl=''
548h_sysfile=''
ecfc5424
AD
549db_hashtype=''
550db_prefixtype=''
a0d0e21e 551i_db=''
2304df62 552i_dbm=''
8e07c86e 553i_rpcsvcdbm=''
2304df62 554d_dirnamlen=''
a0d0e21e 555direntrytype=''
2304df62 556i_dirent=''
a0d0e21e 557i_dld=''
2304df62
AD
558i_dlfcn=''
559i_fcntl=''
a0d0e21e 560i_float=''
2304df62 561i_gdbm=''
28e8609d
JH
562d_grpasswd=''
563d_setgrent=''
564d_getgrent=''
565d_endgrent=''
2304df62 566i_grp=''
a0d0e21e 567i_limits=''
4633a7c4 568i_locale=''
a0d0e21e
LW
569i_malloc=''
570i_math=''
85e6fe83 571i_memory=''
2304df62 572i_ndbm=''
3fd537d4 573i_netdb=''
85e6fe83 574i_neterrno=''
2304df62
AD
575i_niin=''
576i_sysin=''
577d_pwage=''
578d_pwchange=''
579d_pwclass=''
580d_pwcomment=''
581d_pwexpire=''
c4f23d77 582d_pwgecos=''
28e8609d 583d_pwpasswd=''
2304df62 584d_pwquota=''
28e8609d
JH
585d_setpwent=''
586d_getpwent=''
587d_endpwent=''
2304df62 588i_pwd=''
760ac839 589i_sfio=''
2304df62 590i_stddef=''
a0d0e21e 591i_stdlib=''
2304df62
AD
592i_string=''
593strings=''
594i_sysdir=''
595i_sysfile=''
596d_voidtty=''
597i_bsdioctl=''
a0d0e21e 598i_sysfilio=''
2304df62
AD
599i_sysioctl=''
600i_syssockio=''
601i_sysndir=''
a0d0e21e 602i_sysparam=''
8ff267be 603i_sysresrc=''
2304df62 604i_sysselct=''
1aef975c 605i_sysstat=''
a0d0e21e 606i_systimes=''
fed7345c 607i_systypes=''
25f94b33 608i_sysun=''
8ff267be 609i_syswait=''
2304df62
AD
610i_sgtty=''
611i_termio=''
612i_termios=''
613i_systime=''
614i_systimek=''
615i_time=''
616timeincl=''
85e6fe83 617i_unistd=''
2304df62 618i_utime=''
760ac839 619i_values=''
a0d0e21e 620i_stdarg=''
2304df62
AD
621i_varargs=''
622i_varhdr=''
623i_vfork=''
624intsize=''
24fef2a7
AD
625longsize=''
626shortsize=''
2304df62 627libc=''
8ff267be 628libperl=''
2afac517 629shrpenv=''
8ff267be 630useshrplib=''
a0d0e21e 631glibpth=''
2304df62 632libpth=''
8e07c86e 633loclibpth=''
2304df62
AD
634plibpth=''
635xlibpth=''
636libs=''
85e6fe83
LW
637lns=''
638lseektype=''
8ff267be 639make_set_make=''
85e6fe83 640d_mymalloc=''
94b6baf5 641freetype=''
2304df62
AD
642mallocobj=''
643mallocsrc=''
644malloctype=''
645usemymalloc=''
16d20bd9
AD
646installman1dir=''
647man1dir=''
648man1direxp=''
649man1ext=''
650installman3dir=''
651man3dir=''
652man3direxp=''
653man3ext=''
2304df62
AD
654huge=''
655large=''
656medium=''
657models=''
658small=''
659split=''
a0d0e21e 660modetype=''
2304df62
AD
661mydomain=''
662myhostname=''
663phostname=''
664c=''
665n=''
8e07c86e
AD
666d_eofnblk=''
667eagain=''
668o_nonblock=''
669rd_nodata=''
dfe9444c
AD
670netdb_hlen_type=''
671netdb_host_type=''
672netdb_name_type=''
673netdb_net_type=''
2304df62
AD
674groupcat=''
675hostcat=''
676passcat=''
85e6fe83
LW
677orderlib=''
678ranlib=''
2304df62
AD
679package=''
680spackage=''
2c7991dc 681pager=''
bfb7748a 682apiversion=''
ecfc5424 683patchlevel=''
760ac839 684subversion=''
bfb7748a 685version=''
8e07c86e 686perladmin=''
4633a7c4 687perlpath=''
dfe9444c 688pidtype=''
a0d0e21e 689prefix=''
1aef975c 690prefixexp=''
2304df62
AD
691installprivlib=''
692privlib=''
693privlibexp=''
694prototype=''
693762b4 695ptrsize=''
2304df62
AD
696randbits=''
697installscript=''
698scriptdir=''
699scriptdirexp=''
a0d0e21e 700selecttype=''
8ff267be 701sh=''
2304df62 702sig_name=''
dfe9444c 703sig_name_init=''
8e07c86e 704sig_num=''
4633a7c4
LW
705installsitearch=''
706sitearch=''
707sitearchexp=''
25f94b33
AD
708installsitelib=''
709sitelib=''
710sitelibexp=''
a0d0e21e
LW
711sizetype=''
712so=''
2304df62
AD
713sharpbang=''
714shsharp=''
715spitshell=''
dfe9444c 716src=''
a0d0e21e 717ssizetype=''
4633a7c4 718startperl=''
2304df62
AD
719startsh=''
720stdchar=''
721sysman=''
722uidtype=''
723nm_opt=''
40a7a20a 724nm_so_opt=''
2304df62
AD
725runnm=''
726usenm=''
8ff267be 727useperlio=''
693762b4 728d_oldpthreads=''
dfe9444c 729usethreads=''
2304df62
AD
730incpath=''
731mips=''
732mips_type=''
733usrinc=''
734defvoidused=''
735voidflags=''
28e8609d 736ebcdic=''
2304df62
AD
737CONFIG=''
738
ecfc5424
AD
739define='define'
740undef='undef'
741smallmach='pdp11 i8086 z8000 i80286 iAPX286'
742rmlist=''
743
744: We must find out about Eunice early
745eunicefix=':'
746if test -f /etc/unixtovms; then
747 eunicefix=/etc/unixtovms
748fi
749if test -f /etc/unixtovms.exe; then
750 eunicefix=/etc/unixtovms.exe
751fi
752
753: list of known cpp symbols, sorted alphabetically
754al="AMIX BIT_MSF BSD BSD4_3 BSD_NET2 CMU CRAY DGUX DOLPHIN DPX2"
755al="$al GO32 GOULD_PN HP700 I386 I80960 I960 Lynx M68000 M68K MACH"
756al="$al MIPSEB MIPSEL MSDOS MTXINU MULTIMAX MVS"
757al="$al M_COFF M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM"
758al="$al M_SYS3 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX"
759al="$al NeXT OCS88 OSF1 PARISC PC532 PORTAR POSIX"
760al="$al PWB R3000 RES RISC6000 RT Sun386i SVR3 SVR4"
761al="$al SYSTYPE_BSD SYSTYPE_SVR4 SYSTYPE_SYSV Tek4132 Tek4300"
762al="$al UMAXV USGr4 USGr4_2 UTEK UTS UTek UnicomPBB UnicomPBD Utek"
763al="$al VMS Xenix286"
2fb0af1a 764al="$al _AIX _AIX32 _AIX370 _AIX41 _AM29000 _COFF _CRAY _CX_UX _EPI _POWER"
ecfc5424
AD
765al="$al _IBMESA _IBMR2 _M88K _M88KBCS_TARGET"
766al="$al _MIPSEB _MIPSEL _M_COFF _M_I86 _M_I86SM _M_SYS3"
767al="$al _M_SYS5 _M_SYSIII _M_SYSV _M_UNIX _M_XENIX _NLS _PGC_ _R3000"
768al="$al _SYSTYPE_BSD _SYSTYPE_BSD43 _SYSTYPE_SVR4"
769al="$al _SYSTYPE_SYSV _SYSV3 _U370 _UNICOS"
770al="$al __386BSD__ __BIG_ENDIAN __BIG_ENDIAN__ __BSD_4_4__"
771al="$al __DGUX__ __DPX2__ __H3050R __H3050RX"
772al="$al __LITTLE_ENDIAN __LITTLE_ENDIAN__ __MACH__"
773al="$al __MIPSEB __MIPSEB__ __MIPSEL __MIPSEL__"
774al="$al __Next__ __OSF1__ __PARAGON__ __PGC__ __PWB __STDC__"
775al="$al __SVR4_2__ __UMAXV__"
776al="$al ____386BSD____ __alpha __alpha__ __amiga"
777al="$al __bsd4_2 __bsd4_2__ __bsdi__ __convex__"
778al="$al __host_mips__"
779al="$al __hp9000s200 __hp9000s300 __hp9000s400 __hp9000s500"
780al="$al __hp9000s500 __hp9000s700 __hp9000s800"
781al="$al __hppa __hpux __hp_osf __i286 __i286__ __i386 __i386__"
782al="$al __i486 __i486__ __i860 __i860__ __ibmesa __ksr1__ __linux__"
783al="$al __m68k __m68k__ __m88100__ __m88k __m88k__"
784al="$al __mc68000 __mc68000__ __mc68020 __mc68020__"
785al="$al __mc68030 __mc68030__ __mc68040 __mc68040__"
786al="$al __mc88100 __mc88100__ __mips __mips__"
787al="$al __motorola__ __osf__ __pa_risc __sparc__ __stdc__"
788al="$al __sun __sun__ __svr3__ __svr4__ __ultrix __ultrix__"
789al="$al __unix __unix__ __uxpm__ __uxps__ __vax __vax__"
790al="$al _host_mips _mips _unix"
791al="$al a29k aegis aix aixpc alliant alpha am29000 amiga ansi ardent"
792al="$al apollo ardent att386 att3b"
793al="$al bsd bsd43 bsd4_2 bsd4_3 bsd4_4 bsdi bull"
794al="$al cadmus clipper concurrent convex cray ctix"
795al="$al dmert encore gcos gcx gimpel gould"
796al="$al hbullx20 hcx host_mips hp200 hp300 hp700 hp800"
797al="$al hp9000 hp9000s300 hp9000s400 hp9000s500"
798al="$al hp9000s700 hp9000s800 hp9k8 hppa hpux"
799al="$al i186 i286 i386 i486 i8086"
800al="$al i80960 i860 iAPX286 ibm ibm032 ibmrt interdata is68k"
801al="$al ksr1 linux luna luna88k m68k m88100 m88k"
802al="$al mc300 mc500 mc68000 mc68010 mc68020 mc68030"
803al="$al mc68040 mc68060 mc68k mc68k32 mc700"
804al="$al mc88000 mc88100 merlin mert mips mvs n16"
805al="$al ncl_el ncl_mr"
806al="$al news1500 news1700 news1800 news1900 news3700"
807al="$al news700 news800 news900 ns16000 ns32000"
808al="$al ns32016 ns32332 ns32k nsc32000 os osf"
809al="$al parisc pc532 pdp11 plexus posix pyr"
810al="$al riscix riscos scs sequent sgi sinix sony sony_news"
811al="$al sonyrisc sparc sparclite spectrum stardent stratos"
812al="$al sun sun3 sun386 svr4 sysV68 sysV88"
813al="$al titan tower tower32 tower32_200 tower32_600 tower32_700"
814al="$al tower32_800 tower32_850 tss u370 u3b u3b2 u3b20 u3b200"
815al="$al u3b20d u3b5 ultrix unix unixpc unos vax venix vms"
816al="$al xenix z8000"
817
ecfc5424
AD
818i_whoami=''
819: change the next line if compiling for Xenix/286 on Xenix/386
820xlibpth='/usr/lib/386 /lib/386'
821
8e07c86e
AD
822: Possible local library directories to search.
823loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
824loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
825
ecfc5424 826: general looking path for locating libraries
dfe9444c 827glibpth="/shlib /usr/shlib /lib/pa1.1 /usr/lib/large"
4b40f7a3
SV
828glibpth="$glibpth /lib /usr/lib $xlibpth"
829glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
830glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
ecfc5424
AD
831
832: Private path used by Configure to find libraries. Its value
833: is prepended to libpth. This variable takes care of special
834: machines, like the mips. Usually, it should be empty.
835plibpth=''
836
dfe9444c
AD
837: default library list
838libswanted=''
dfe9444c
AD
839: Possible local include directories to search.
840: Set locincpth to "" in a hint file to defeat local include searches.
841locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
842locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
843:
844: no include file wanted by default
845inclwanted=''
846
847: Trailing extension. Override this in a hint file, if needed.
4e2a5f63 848_exe=''
dfe9444c
AD
849: Extra object files, if any, needed on this platform.
850archobjs=''
851groupstype=''
bfb7748a
AD
852: full support for void wanted by default
853defvoidused=15
854
dfe9444c
AD
855: set useposix=false in your hint file to disable the POSIX extension.
856useposix=true
857: set useopcode=false in your hint file to disable the Opcode extension.
858useopcode=true
859: set usethreads on the Configure command line to enable threads.
ecfc5424 860: List of libraries we want.
693762b4
AD
861: If anyone needs -lnet, put it in a hint file.
862libswanted='sfio socket inet nsl nm ndbm gdbm dbm db malloc dl'
ecfc5424
AD
863libswanted="$libswanted dld ld sun m c cposix posix ndir dir crypt"
864libswanted="$libswanted ucb bsd BSD PW x"
1aef975c 865: We probably want to search /usr/shlib before most other libraries.
94b6baf5 866: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
ecfc5424
AD
867glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
868glibpth="/usr/shlib $glibpth"
869: Do not use vfork unless overridden by a hint file.
870usevfork=false
871
8ff267be 872: Find the basic shell for Bourne shell scripts
873case "$sh" in
874'')
8ff267be 875 case "$SYSTYPE" in
876 *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
877 *) xxx='/bin/sh';;
878 esac
879 if test -f "$xxx"; then
880 sh="$xxx"
881 else
882 : Build up a list and do a single loop so we can 'break' out.
883 pth=`echo $PATH | sed -e "s/$p_/ /g"`
884 for xxx in sh bash ksh pdksh ash; do
885 for p in $pth; do
886 try="$try ${p}/${xxx}"
887 done
888 done
889 for xxx in $try; do
890 if test -f "$xxx"; then
891 sh="$xxx";
8ff267be 892 break
893 elif test -f "$xxx.exe"; then
894 sh="$xxx";
8ff267be 895 break
896 fi
897 done
898 fi
899 ;;
900esac
901
902case "$sh" in
903'') cat <<EOM >&2
904$me: Fatal Error: I can't find a Bourne Shell anywhere.
dfe9444c 905
8ff267be 906Usually it's in /bin/sh. How did you even get this far?
bfb7748a 907Please contact me (Andy Dougherty) at doughera@lafayette.edu and
dfe9444c 908we'll try to straighten this all out.
8ff267be 909EOM
910 exit 1
911 ;;
912esac
913
760ac839 914: see if sh knows # comments
8ff267be 915if `$sh -c '#' >/dev/null 2>&1`; then
760ac839
LW
916 shsharp=true
917 spitshell=cat
760ac839
LW
918 xcat=/bin/cat
919 test -f $xcat || xcat=/usr/bin/cat
920 echo "#!$xcat" >try
921 $eunicefix try
922 chmod +x try
923 ./try > today
924 if test -s today; then
760ac839
LW
925 sharpbang='#!'
926 else
927 echo "#! $xcat" > try
928 $eunicefix try
929 chmod +x try
930 ./try > today
931 if test -s today; then
760ac839
LW
932 sharpbang='#! '
933 else
760ac839
LW
934 sharpbang=': use '
935 fi
936 fi
937else
dfe9444c 938 echo " "
8ff267be 939 echo "Your $sh doesn't grok # comments--I will strip them later on."
760ac839
LW
940 shsharp=false
941 cd ..
942 echo "exec grep -v '^[ ]*#'" >spitshell
943 chmod +x spitshell
944 $eunicefix spitshell
945 spitshell=`pwd`/spitshell
946 cd UU
947 echo "I presume that if # doesn't work, #! won't work either!"
948 sharpbang=': use '
949fi
950rm -f try today
951
952: figure out how to guarantee sh startup
8ff267be 953case "$startsh" in
954'') startsh=${sharpbang}${sh} ;;
955*)
760ac839 956esac
760ac839
LW
957cat >try <<EOSS
958$startsh
959set abc
960test "$?abc" != 1
961EOSS
962
963chmod +x try
964$eunicefix try
965if ./try; then
8ff267be 966 : echo "Yup, it does."
760ac839 967else
dfe9444c
AD
968 echo "Hmm... '$startsh' does not guarantee sh startup..."
969 echo "You may have to fix up the shell scripts to make sure $sh runs them."
760ac839
LW
970fi
971rm -f try
972
aebf16e7
AD
973
974: Save command line options in file UU/cmdline.opt for later use in
975: generating config.sh.
976cat > cmdline.opt <<EOSH
977# Configure command line arguments.
978config_arg0='$0'
979config_args='$*'
980config_argc=$#
981EOSH
982argn=1
983for arg in "$@"; do
984 cat >>cmdline.opt <<EOSH
985config_arg$argn='$arg'
986EOSH
987 argn=`expr $argn + 1`
988done
989
2304df62
AD
990: produce awk script to parse command line options
991cat >options.awk <<'EOF'
992BEGIN {
16d20bd9 993 optstr = "dD:eEf:hKOrsSU:V"; # getopt-style specification
2304df62
AD
994
995 len = length(optstr);
996 for (i = 1; i <= len; i++) {
997 c = substr(optstr, i, 1);
998 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
999 if (a == ":") {
1000 arg[c] = 1;
1001 i++;
1002 }
1003 opt[c] = 1;
1004 }
1005}
1006{
1007 expect = 0;
1008 str = $0;
1009 if (substr(str, 1, 1) != "-") {
1010 printf("'%s'\n", str);
1011 next;
1012 }
1013 len = length($0);
1014 for (i = 2; i <= len; i++) {
1015 c = substr(str, i, 1);
1016 if (!opt[c]) {
1017 printf("-%s\n", substr(str, i));
1018 next;
1019 }
1020 printf("-%s\n", c);
1021 if (arg[c]) {
1022 if (i < len)
1023 printf("'%s'\n", substr(str, i + 1));
1024 else
1025 expect = 1;
1026 next;
1027 }
1028 }
1029}
1030END {
1031 if (expect)
1032 print "?";
1033}
1034EOF
1035
1036: process the command line options
4633a7c4
LW
1037set X `for arg in "$@"; do echo "X$arg"; done |
1038 sed -e s/X// | awk -f options.awk`
2304df62
AD
1039eval "set $*"
1040shift
1041rm -f options.awk
1042
1043: set up default values
1044fastread=''
1045reuseval=false
1046config_sh=''
1047alldone=''
1048error=''
1049silent=''
1050extractsh=''
ecfc5424 1051override=''
16d20bd9 1052knowitall=''
1aef975c 1053rm -f optdef.sh
28757baa 1054cat >optdef.sh <<EOS
1055$startsh
1056EOS
2304df62 1057
dfe9444c 1058
2304df62
AD
1059: option parsing
1060while test $# -gt 0; do
1061 case "$1" in
1062 -d) shift; fastread=yes;;
1063 -e) shift; alldone=cont;;
1064 -f)
1065 shift
1066 cd ..
1067 if test -r "$1"; then
1068 config_sh="$1"
1069 else
a0d0e21e 1070 echo "$me: cannot read config file $1." >&2
2304df62
AD
1071 error=true
1072 fi
1073 cd UU
1074 shift;;
1075 -h) shift; error=true;;
1076 -r) shift; reuseval=true;;
dfe9444c 1077 -s) shift; silent=true; realsilent=true;;
2304df62 1078 -E) shift; alldone=exit;;
16d20bd9 1079 -K) shift; knowitall=true;;
ecfc5424 1080 -O) shift; override=true;;
dfe9444c 1081 -S) shift; silent=true; extractsh=true;;
a0d0e21e
LW
1082 -D)
1083 shift
1084 case "$1" in
1085 *=)
1086 echo "$me: use '-U symbol=', not '-D symbol='." >&2
1087 echo "$me: ignoring -D $1" >&2
1088 ;;
ecfc5424 1089 *=*) echo "$1" | \
1aef975c
AD
1090 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1091 *) echo "$1='define'" >> optdef.sh;;
a0d0e21e
LW
1092 esac
1093 shift
1094 ;;
1095 -U)
1096 shift
1097 case "$1" in
1aef975c 1098 *=) echo "$1" >> optdef.sh;;
a0d0e21e
LW
1099 *=*)
1100 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1101 echo "$me: ignoring -U $1" >&2
1102 ;;
1aef975c 1103 *) echo "$1='undef'" >> optdef.sh;;
a0d0e21e
LW
1104 esac
1105 shift
1106 ;;
dfe9444c 1107 -V) echo "$me generated by metaconfig 3.0 PL70." >&2
2304df62
AD
1108 exit 0;;
1109 --) break;;
a0d0e21e 1110 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
2304df62
AD
1111 *) break;;
1112 esac
1113done
1114
1115case "$error" in
1116true)
1117 cat >&2 <<EOM
2afac517 1118Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
a0d0e21e 1119 [-U symbol] [-U symbol=]
2304df62
AD
1120 -d : use defaults for all answers.
1121 -e : go on without questioning past the production of config.sh.
1122 -f : specify an alternate default configuration file.
1123 -h : print this help message and exit (with an error status).
1124 -r : reuse C symbols value if possible (skips costly nm extraction).
1125 -s : silent mode, only echoes questions and essential information.
a0d0e21e
LW
1126 -D : define symbol to have some value:
1127 -D symbol symbol gets the value 'define'
1128 -D symbol=value symbol gets the value 'value'
2304df62 1129 -E : stop at the end of questions, after having produced config.sh.
16d20bd9 1130 -K : do not use unless you know what you are doing.
ecfc5424 1131 -O : let -D and -U override definitions from loaded configuration file.
2304df62 1132 -S : perform variable substitutions on all .SH files (can mix with -f)
a0d0e21e
LW
1133 -U : undefine symbol:
1134 -U symbol symbol gets the value 'undef'
1135 -U symbol= symbol gets completely empty
2304df62
AD
1136 -V : print version number and exit (with a zero status).
1137EOM
1138 exit 1
1139 ;;
1140esac
1141
dfe9444c
AD
1142: Sanity checks
1143case "$fastread$alldone" in
1144yescont|yesexit) ;;
1145*)
1146 if test ! -t 0; then
1147 echo "Say 'sh Configure', not 'sh <Configure'"
1148 exit 1
1149 fi
1150 ;;
1151esac
1152
2304df62
AD
1153exec 4>&1
1154case "$silent" in
1155true) exec 1>/dev/null;;
1156esac
1157
ecfc5424 1158: run the defines and the undefines, if any, but leave the file out there...
1aef975c
AD
1159touch optdef.sh
1160. ./optdef.sh
a0d0e21e 1161
2304df62 1162: set package name
85e6fe83 1163package=perl5
1aef975c
AD
1164first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1165last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1166case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1167ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1168*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1169esac
2304df62 1170
2304df62
AD
1171: Some greps do not return status, grrr.
1172echo "grimblepritz" >grimble
1173if grep blurfldyick grimble >/dev/null 2>&1 ; then
1174 contains=contains
1175elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1176 contains=grep
1177else
1178 contains=contains
1179fi
1180rm -f grimble
1181: the following should work in any shell
1182case "$contains" in
1183contains*)
1184 echo " "
1185 echo "AGH! Grep doesn't return a status. Attempting remedial action."
1186 cat >contains <<'EOSS'
1187grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1188EOSS
1189chmod +x contains
1190esac
1191
dfe9444c
AD
1192: Find the path to the source tree
1193case "$src" in
1194'') case "$0" in
1195 */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`;;
1196 *) src='.';;
1197 esac;;
1198esac
1199case "$src" in
1200'') src=/
1201 rsrc=/
1202 ;;
1203/*) rsrc="$src";;
1204*) rsrc="../$src";;
1205esac
1206if test -f $rsrc/Configure && \
1207 $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1208then
1209 : found it, so we are ok.
1210else
1211 rsrc=''
1212 for src in . .. ../.. ../../.. ../../../..; do
1213 if test -f ../$src/Configure && \
1214 $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1215 then
1216 rsrc=../$src
1217 break
1218 fi
1219 done
1220fi
1221case "$rsrc" in
1222'')
1223 cat <<EOM >&4
1224
1225Sorry, I can't seem to locate the source dir for $package. Please start
1226Configure with an explicit path -- i.e. /some/path/Configure.
1227
1228EOM
1229 exit 1
1230 ;;
1231../.) rsrc='..';;
1232*)
1233 echo " "
1234 echo "Sources for $package found in \"$src\"." >&4
1235 ;;
1236esac
1237
1238: script used to extract .SH files with variable substitutions
1239cat >extract <<'EOS'
1240CONFIG=true
1241echo "Doing variable substitutions on .SH files..."
1242if test -f $src/MANIFEST; then
1243 set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH'`
1244else
1245 echo "(Looking for .SH files under the source directory.)"
1246 set x `(cd $src; find . -name "*.SH" -print)`
1247fi
1248shift
1249case $# in
12500) set x `(cd $src; echo *.SH)`; shift;;
1251esac
1252if test ! -f $src/$1; then
1253 shift
1254fi
1255mkdir_p='
1256name=$1;
1257create="";
1258while test $name; do
1259 if test ! -d "$name"; then
1260 create="$name $create";
1261 name=`echo $name | sed -e "s|^[^/]*$||"`;
1262 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1263 else
1264 name="";
1265 fi;
1266done;
1267for file in $create; do
1268 mkdir $file;
1269done
1270'
1271for file in $*; do
1272 case "$src" in
1273 ".")
1274 case "$file" in
1275 */*)
1276 dir=`expr X$file : 'X\(.*\)/'`
1277 file=`expr X$file : 'X.*/\(.*\)'`
1278 (cd $dir && . ./$file)
1279 ;;
1280 *)
1281 . ./$file
1282 ;;
1283 esac
1284 ;;
1285 *)
1286 case "$file" in
1287 */*)
1288 dir=`expr X$file : 'X\(.*\)/'`
1289 file=`expr X$file : 'X.*/\(.*\)'`
1290 (set x $dir; shift; eval $mkdir_p)
1291 sh <$src/$dir/$file
1292 ;;
1293 *)
1294 sh <$src/$file
1295 ;;
1296 esac
1297 ;;
1298 esac
1299done
1300if test -f $src/config_h.SH; then
1301 if test ! -f config.h; then
1302 : oops, they left it out of MANIFEST, probably, so do it anyway.
1303 . $src/config_h.SH
1304 fi
1305fi
1306EOS
1307
1308: extract files and exit if asked to do so
1309case "$extractsh" in
1310true)
1311 case "$realsilent" in
1312 true) ;;
1313 *) exec 1>&4;;
1314 esac
1315 case "$config_sh" in
1316 '') config_sh='config.sh';;
1317 esac
1318 echo " "
1319 echo "Fetching answers from $config_sh..."
1320 cd ..
1321 . $config_sh
1322 test "$override" && . ./optdef.sh
1323 echo " "
1324 . UU/extract
1325 rm -rf UU
1326 echo "Done."
1327 exit 0
1328 ;;
1329esac
1330
1331: Eunice requires " " instead of "", can you believe it
1332echo " "
1333: Here we go...
1334echo "Beginning of configuration questions for $package."
1335
1336trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1337
2304df62
AD
1338: first determine how to suppress newline on echo command
1339echo " "
1340echo "Checking echo to see how to suppress newlines..."
1341(echo "hi there\c" ; echo " ") >.echotmp
1342if $contains c .echotmp >/dev/null 2>&1 ; then
1343 echo "...using -n."
1344 n='-n'
1345 c=''
1346else
1347 cat <<'EOM'
1348...using \c
1349EOM
1350 n=''
1351 c='\c'
1352fi
1353echo $n "The star should be here-->$c"
1354echo '*'
1355rm -f .echotmp
1356
1357: Now test for existence of everything in MANIFEST
1358echo " "
dfe9444c 1359if test -f $rsrc/MANIFEST; then
2304df62 1360 echo "First let's make sure your kit is complete. Checking..." >&4
dfe9444c 1361 awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
2304df62 1362 rm -f missing
dfe9444c 1363 tmppwd=`pwd`
2304df62 1364 for filelist in x??; do
dfe9444c 1365 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
2304df62
AD
1366 done
1367 if test -s missing; then
1368 cat missing >&4
1369 cat >&4 <<'EOM'
1370
1371THIS PACKAGE SEEMS TO BE INCOMPLETE.
1372
1373You have the option of continuing the configuration process, despite the
1374distinct possibility that your kit is damaged, by typing 'y'es. If you
1375do, don't blame me if something goes wrong. I advise you to type 'n'o
bfb7748a 1376and contact the author (doughera@lafayette.edu).
2304df62
AD
1377
1378EOM
1379 echo $n "Continue? [n] $c" >&4
1380 read ans
1381 case "$ans" in
1382 y*)
1383 echo "Continuing..." >&4
1384 rm -f missing
1385 ;;
1386 *)
1387 echo "ABORTING..." >&4
1388 kill $$
1389 ;;
1390 esac
1391 else
dfe9444c 1392 echo "Looks good..."
2304df62
AD
1393 fi
1394else
1395 echo "There is no MANIFEST file. I hope your kit is complete !"
1396fi
1397rm -f missing x??
1398
1399: compute the number of columns on the terminal for proper question formatting
1400case "$COLUMNS" in
1401'') COLUMNS='80';;
1402esac
1403
1404: set up the echo used in my read
1405myecho="case \"\$xxxm\" in
1406'') echo $n \"\$rp $c\" >&4;;
1407*) case \"\$rp\" in
1408 '') echo $n \"[\$xxxm] $c\";;
1409 *)
1410 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
1411 echo \"\$rp\" >&4
1412 echo $n \"[\$xxxm] $c\" >&4
1413 else
1414 echo $n \"\$rp [\$xxxm] $c\" >&4
1415 fi
1416 ;;
1417 esac;;
1418esac"
1419
1420: now set up to do reads with possible shell escape and default assignment
1421cat <<EOSC >myread
28757baa 1422$startsh
2304df62
AD
1423xxxm=\$dflt
1424$myecho
1425ans='!'
1426case "\$fastread" in
1427yes) case "\$dflt" in
1428 '') ;;
1429 *) ans='';
1430 case "\$silent-\$rp" in
1431 true-) ;;
1432 *) echo " " >&4;;
1433 esac;;
1434 esac;;
1435*) case "\$silent" in
1436 true) case "\$rp" in
1437 '') ans='';;
1438 esac;;
1439 esac;;
1440esac
1441while expr "X\$ans" : "X!" >/dev/null; do
1442 read answ
1443 set x \$xxxm
1444 shift
dfe9444c 1445 aok=''; eval "ans=\\"\$answ\\"" && aok=y
2304df62 1446 case "\$answ" in
dfe9444c
AD
1447 "!")
1448 sh 1>&4
1449 echo " "
1450 $myecho
1451 ;;
1452 !*)
1453 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1454 shift
1455 sh 1>&4 -c "\$*"
1456 echo " "
1457 $myecho
1458 ;;
2304df62
AD
1459 "\$ans")
1460 case "\$ans" in
ecfc5424
AD
1461 \\&*)
1462 set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1463 shift
1464 case "\$1" in
1465 -d)
1466 fastread=yes
40a7a20a 1467 echo "(OK, I'll run with -d after this question.)" >&4
ecfc5424
AD
1468 ;;
1469 -*)
40a7a20a 1470 echo "*** Sorry, \$1 not supported yet." >&4
ecfc5424
AD
1471 ;;
1472 esac
1473 $myecho
1474 ans=!
1475 ;;
2304df62
AD
1476 esac;;
1477 *)
1478 case "\$aok" in
1479 y)
1480 echo "*** Substitution done -- please confirm."
1481 xxxm="\$ans"
c9795ab7 1482 ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2304df62
AD
1483 xxxm="\$ans"
1484 ans=!
1485 ;;
1486 *)
1487 echo "*** Error -- try again."
1488 ans=!
1489 ;;
1490 esac
1491 $myecho
1492 ;;
1493 esac
1494 case "\$ans\$xxxm\$nostick" in
1495 '')
1496 ans=!
1497 $myecho
1498 ;;
1499 esac
1500done
1501case "\$ans" in
1502'') ans="\$xxxm";;
1503esac
1504EOSC
1505
1506: create .config dir to save info across Configure sessions
1507test -d ../.config || mkdir ../.config
1508cat >../.config/README <<EOF
1509This directory created by Configure to save information that should
dfe9444c 1510persist across sessions for $package.
2304df62
AD
1511
1512You may safely delete it if you wish.
1513EOF
1514
1515: general instructions
1516needman=true
1517firsttime=true
760ac839 1518user=`(logname) 2>/dev/null`
dfe9444c
AD
1519case "$user" in
1520'') user=`whoami 2>&1`;;
760ac839 1521esac
2304df62
AD
1522if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1523 firsttime=false
1524 echo " "
1525 rp='Would you like to see the instructions?'
1526 dflt=n
1527 . ./myread
1528 case "$ans" in
1529 [yY]*) ;;
1530 *) needman=false;;
1531 esac
1532fi
1533if $needman; then
1534 cat <<EOH
4e2a5f63 1535
2304df62 1536This installation shell script will examine your system and ask you questions
a0d0e21e 1537to determine how the perl5 package should be installed. If you get
2304df62
AD
1538stuck on a question, you may use a ! shell escape to start a subshell or
1539execute a command. Many of the questions will have default answers in square
1540brackets; typing carriage return will give you the default.
1541
1542On some of the questions which ask for file or directory names you are allowed
1543to use the ~name construct to specify the login directory belonging to "name",
1544even if you don't have a shell which knows about that. Questions where this is
1545allowed will be marked "(~name ok)".
1546
1547EOH
1548 rp=''
1549 dflt='Type carriage return to continue'
1550 . ./myread
1551 cat <<'EOH'
1552
1553The prompter used in this script allows you to use shell variables and
1554backticks in your answers. You may use $1, $2, etc... to refer to the words
1555in the default answer, as if the default line was a set of arguments given to a
1556script shell. This means you may also use $* to repeat the whole default line,
1557so you do not have to re-type everything to add something to the default.
1558
1559Everytime there is a substitution, you will have to confirm. If there is an
1560error (e.g. an unmatched backtick), the default answer will remain unchanged
1561and you will be prompted again.
1562
1563If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
1564the questions and use the computed defaults (or the previous answers if there
1565was already a config.sh file). Type 'Configure -h' for a list of options.
ecfc5424 1566You may also start interactively and then answer '& -d' at any prompt to turn
dfe9444c 1567on the non-interactive behaviour for the remainder of the execution.
2304df62
AD
1568
1569EOH
1570 . ./myread
1571 cat <<EOH
1572
1573Much effort has been expended to ensure that this shell script will run on any
1574Unix system. If despite that it blows up on yours, your best bet is to edit
40000a8c
AD
1575Configure and run it again. If you can't run Configure for some reason,
1576you'll have to generate a config.sh file by hand. Whatever problems you
bfb7748a 1577have, let me (doughera@lafayette.edu) know how I blew it.
2304df62
AD
1578
1579This installation script affects things in two ways:
1580
15811) it may do direct variable substitutions on some of the files included
1582 in this kit.
15832) it builds a config.h file for inclusion in C programs. You may edit
1584 any of these files as the need arises after running this script.
1585
1586If you make a mistake on a question, there is no easy way to back up to it
1587currently. The easiest thing to do is to edit config.sh and rerun all the SH
1588files. Configure will offer to let you do this before it runs the SH files.
1589
1590EOH
1591 dflt='Type carriage return to continue'
1592 . ./myread
1593 case "$firsttime" in
1594 true) echo $user >>../.config/instruct;;
1595 esac
1596fi
1597
2304df62
AD
1598: find out where common programs are
1599echo " "
1600echo "Locating common programs..." >&4
1601cat <<EOSC >loc
1602$startsh
1603case \$# in
16040) exit 1;;
1605esac
1606thing=\$1
1607shift
1608dflt=\$1
1609shift
1610for dir in \$*; do
1611 case "\$thing" in
1612 .)
1613 if test -d \$dir/\$thing; then
1614 echo \$dir
1615 exit 0
1616 fi
1617 ;;
1618 *)
a0d0e21e 1619 for thisthing in \$dir/\$thing; do
ecfc5424 1620 : just loop through to pick last item
a0d0e21e 1621 done
25f94b33 1622 if test -f \$thisthing; then
a0d0e21e 1623 echo \$thisthing
2304df62
AD
1624 exit 0
1625 elif test -f \$dir/\$thing.exe; then
c4f23d77
AD
1626 if test -n "$DJGPP"; then
1627 echo \$dir/\$thing.exe
1628 else
1629 : on Eunice apparently
1630 echo \$dir/\$thing
1631 fi
2304df62
AD
1632 exit 0
1633 fi
1634 ;;
1635 esac
1636done
1637echo \$dflt
1638exit 1
1639EOSC
1640chmod +x loc
1641$eunicefix loc
1642loclist="
1643awk
1644cat
ecfc5424 1645comm
2304df62
AD
1646cp
1647echo
1648expr
a0d0e21e 1649find
2304df62 1650grep
a0d0e21e 1651ls
dfe9444c 1652make
2304df62 1653mkdir
2304df62
AD
1654rm
1655sed
1656sort
85e6fe83 1657touch
2304df62
AD
1658tr
1659uniq
1660"
1661trylist="
1662Mcc
dfe9444c 1663ar
2304df62
AD
1664byacc
1665cpp
1666csh
1667date
1668egrep
8ff267be 1669gzip
2c7991dc 1670less
2304df62 1671line
8ff267be 1672ln
2c7991dc 1673more
693762b4 1674nm
2304df62
AD
1675nroff
1676perl
2c7991dc 1677pg
40a7a20a 1678sendmail
693762b4 1679tee
2304df62
AD
1680test
1681uname
8ff267be 1682zip
2304df62 1683"
8e07c86e 1684pth=`echo $PATH | sed -e "s/$p_/ /g"`
2304df62
AD
1685pth="$pth /lib /usr/lib"
1686for file in $loclist; do
dfe9444c
AD
1687 eval xxx=\$$file
1688 case "$xxx" in
1689 /*|?:[\\/]*)
1690 if test -f "$xxx"; then
1691 : ok
1692 else
1693 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1694 xxx=`./loc $file $file $pth`
1695 fi
1696 ;;
1697 '') xxx=`./loc $file $file $pth`;;
1698 *) xxx=`./loc $xxx $xxx $pth`;;
1699 esac
2304df62
AD
1700 eval $file=$xxx
1701 eval _$file=$xxx
1702 case "$xxx" in
1703 /*)
1704 echo $file is in $xxx.
1705 ;;
8e07c86e
AD
1706 ?:[\\/]*)
1707 echo $file is in $xxx.
1708 ;;
2304df62 1709 *)
25f94b33
AD
1710 echo "I don't know where '$file' is, and my life depends on it." >&4
1711 echo "Go find a public domain implementation or fix your PATH setting!" >&4
4633a7c4 1712 exit 1
2304df62
AD
1713 ;;
1714 esac
1715done
1716echo " "
1717echo "Don't worry if any of the following aren't found..."
1718say=offhand
1719for file in $trylist; do
dfe9444c
AD
1720 eval xxx=\$$file
1721 case "$xxx" in
1722 /*|?:[\\/]*)
1723 if test -f "$xxx"; then
1724 : ok
1725 else
1726 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1727 xxx=`./loc $file $file $pth`
1728 fi
1729 ;;
1730 '') xxx=`./loc $file $file $pth`;;
1731 *) xxx=`./loc $xxx $xxx $pth`;;
1732 esac
2304df62
AD
1733 eval $file=$xxx
1734 eval _$file=$xxx
1735 case "$xxx" in
1736 /*)
1737 echo $file is in $xxx.
1738 ;;
8e07c86e
AD
1739 ?:[\\/]*)
1740 echo $file is in $xxx.
1741 ;;
2304df62
AD
1742 *)
1743 echo "I don't see $file out there, $say."
1744 say=either
1745 ;;
1746 esac
1747done
1748case "$egrep" in
1749egrep)
1750 echo "Substituting grep for egrep."
1751 egrep=$grep
1752 ;;
1753esac
8ff267be 1754case "$ln" in
1755ln)
1756 echo "Substituting cp for ln."
1757 ln=$cp
1758 ;;
1759esac
2304df62
AD
1760case "$test" in
1761test)
1762 echo "Hopefully test is built into your sh."
1763 ;;
1764*)
ecfc5424 1765 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2304df62
AD
1766 echo "Using the test built into your sh."
1767 test=test
1768 _test=test
1769 fi
1770 ;;
1771esac
1772case "$echo" in
1773echo)
1774 echo "Hopefully echo is built into your sh."
1775 ;;
1776'') ;;
1777*)
1778 echo " "
1779echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
1780 $echo $n "hi there$c" >foo1
1781 echo $n "hi there$c" >foo2
1782 if cmp foo1 foo2 >/dev/null 2>&1; then
1783 echo "They are compatible. In fact, they may be identical."
1784 else
1785 case "$n" in
1786 '-n') n='' c='\c';;
1787 *) n='-n' c='';;
1788 esac
1789 cat <<FOO
1790They are not compatible! You are probably running ksh on a non-USG system.
1791I'll have to use $echo instead of the builtin, since Bourne shell doesn't
1792have echo built in and we may have to run some Bourne shell scripts. That
1793means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
1794
1795FOO
1796 $echo $n "The star should be here-->$c"
1797 $echo "*"
1798 fi
1799 $rm -f foo1 foo2
1800 ;;
1801esac
1802
a0d0e21e
LW
1803: determine whether symbolic links are supported
1804echo " "
1805$touch blurfl
1806if $ln -s blurfl sym > /dev/null 2>&1 ; then
1807 echo "Symbolic links are supported." >&4
1808 lns="$ln -s"
1809else
1810 echo "Symbolic links are NOT supported." >&4
1811 lns="$ln"
1812fi
1813$rm -f blurfl sym
1814
ecfc5424
AD
1815: see whether [:lower:] and [:upper:] are supported character classes
1816echo " "
ecfc5424
AD
1817case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1818ABYZ)
1819 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
1820 up='[:upper:]'
1821 low='[:lower:]'
1822 ;;
28e8609d
JH
1823*) # There is a discontinuity in EBCDIC between 'I' and 'J'
1824 # (0xc9 and 0xd1), therefore that is a nice testing point.
1825 if test "X$up" = X -o "X$low" = X; then
1826 case "`echo IJ | tr '[I-J]' '[i-j]' 2>/dev/null`" in
1827 ij) up='[A-Z]'
1828 low='[a-z]'
1829 ;;
1830 esac
1831 fi
1832 if test "X$up" = X -o "X$low" = X; then
1833 case "`echo IJ | tr I-J i-j 2>/dev/null`" in
1834 ij) up='A-Z'
1835 low='a-z'
1836 ;;
1837 esac
1838 fi
1839 if test "X$up" = X -o "X$low" = X; then
1840 case "`echo IJ | od -x 2>/dev/null`" in
1841 *C9D1*|*c9d1*)
1842 echo "Hey, this might be EBCDIC." >&4
1843 if test "X$up" = X -o "X$low" = X; then
1844 case "`echo IJ | tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
1845 ij) up='[A-IJ-RS-Z]'
1846 low='[a-ij-rs-z]'
1847 ;;
1848 esac
1849 fi
1850 if test "X$up" = X -o "X$low" = X; then
1851 case "`echo IJ | tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
1852 ij) up='A-IJ-RS-Z'
1853 low='a-ij-rs-z'
1854 ;;
1855 esac
1856 fi
1857 ;;
1858 esac
1859 fi
1860esac
1861case "`echo IJ | tr \"$up\" \"$low\" 2>/dev/null`" in
1862ij)
1863 echo "Using $up and $low to convert case." >&4
1864 ;;
ecfc5424 1865*)
28e8609d
JH
1866 echo "I don't know how to translate letters from upper to lower case." >&4
1867 echo "Your tr is not acting any way I know of." >&4
1868 exit 1
1869 ;;
ecfc5424
AD
1870esac
1871: set up the translation script tr, must be called with ./tr of course
1872cat >tr <<EOSC
1873$startsh
1874case "\$1\$2" in
1875'[A-Z][a-z]') exec $tr '$up' '$low';;
1876'[a-z][A-Z]') exec $tr '$low' '$up';;
1877esac
1878exec $tr "\$@"
1879EOSC
1880chmod +x tr
1881$eunicefix tr
1882
2304df62
AD
1883: Try to determine whether config.sh was made on this system
1884case "$config_sh" in
1885'')
1886myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
28e8609d
JH
1887# tr '[A-Z]' '[a-z]' would not work in EBCDIC
1888# because the A-Z/a-z are not consecutive.
a0d0e21e 1889myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
28e8609d 1890 ./tr '[A-Z]' '[a-z]' | tr $trnl ' '`
1aef975c 1891newmyuname="$myuname"
2304df62 1892dflt=n
16d20bd9
AD
1893case "$knowitall" in
1894'')
1895 if test -f ../config.sh; then
1896 if $contains myuname= ../config.sh >/dev/null 2>&1; then
1897 eval "`grep myuname= ../config.sh`"
1898 fi
1899 if test "X$myuname" = "X$newmyuname"; then
1900 dflt=y
1901 fi
2304df62 1902 fi
16d20bd9
AD
1903 ;;
1904*) dflt=y;;
1905esac
2304df62
AD
1906
1907: Get old answers from old config file if Configure was run on the
1908: same system, otherwise use the hints.
1909hint=default
1910cd ..
1911if test -f config.sh; then
16d20bd9
AD
1912 echo " "
1913 rp="I see a config.sh file. Shall I use it to set the defaults?"
2304df62
AD
1914 . UU/myread
1915 case "$ans" in
1916 n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
1917 *) echo "Fetching default answers from your old config.sh file..." >&4
ecfc5424
AD
1918 tmp_n="$n"
1919 tmp_c="$c"
85cad39c 1920 tmp_sh="$sh"
2304df62
AD
1921 . ./config.sh
1922 cp config.sh UU
ecfc5424
AD
1923 n="$tmp_n"
1924 c="$tmp_c"
85cad39c 1925 : Older versions did not always set $sh. Catch re-use of such
1926 : an old config.sh.
1927 case "$sh" in
1928 '') sh="$tmp_sh" ;;
1929 esac
2304df62
AD
1930 hint=previous
1931 ;;
1932 esac
1933fi
1934if test ! -f config.sh; then
1935 $cat <<EOM
1936
4e2a5f63
AD
1937First time through, eh? I have some defaults handy for some systems
1938that need some extra help getting the Configure answers right:
2304df62
AD
1939
1940EOM
dfe9444c 1941 (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
2304df62
AD
1942 dflt=''
1943 : Half the following guesses are probably wrong... If you have better
bfb7748a 1944 : tests or hints, please send them to doughera@lafayette.edu
2304df62 1945 : The metaconfig authors would also appreciate a copy...
a0d0e21e 1946 $test -f /irix && osname=irix
85e6fe83
LW
1947 $test -f /xenix && osname=sco_xenix
1948 $test -f /dynix && osname=dynix
1949 $test -f /dnix && osname=dnix
5f05dabc 1950 $test -f /lynx.os && osname=lynxos
1951 $test -f /unicos && osname=unicos && osvers=`$uname -r`
7a4c00b4 1952 $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
85e6fe83 1953 $test -f /bin/mips && /bin/mips && osname=mips
ecfc5424
AD
1954 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
1955 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
a0d0e21e
LW
1956 $test -d /usr/apollo/bin && osname=apollo
1957 $test -f /etc/saf/_sactab && osname=svr4
85e6fe83 1958 $test -d /usr/include/minix && osname=minix
4633a7c4 1959 if $test -d /MachTen; then
dfe9444c 1960 osname=machten
4633a7c4 1961 if $test -x /sbin/version; then
dfe9444c 1962 osvers=`/sbin/version | $awk '{print $2}' |
4633a7c4
LW
1963 $sed -e 's/[A-Za-z]$//'`
1964 elif $test -x /usr/etc/version; then
dfe9444c 1965 osvers=`/usr/etc/version | $awk '{print $2}' |
4633a7c4
LW
1966 $sed -e 's/[A-Za-z]$//'`
1967 else
1968 osvers="$2.$3"
1969 fi
1970 fi
2304df62
AD
1971 if $test -f $uname; then
1972 set X $myuname
1973 shift
1974
2304df62 1975 case "$5" in
85e6fe83 1976 fps*) osname=fps ;;
2304df62
AD
1977 mips*)
1978 case "$4" in
85e6fe83
LW
1979 umips) osname=umips ;;
1980 *) osname=mips ;;
2304df62 1981 esac;;
85e6fe83
LW
1982 [23]100) osname=mips ;;
1983 next*) osname=next ;;
ecfc5424
AD
1984 i386*)
1985 if $test -f /etc/kconfig; then
1986 osname=isc
a0d0e21e
LW
1987 if test "$lns" = "ln -s"; then
1988 osvers=4
1989 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
1990 osvers=3
2304df62 1991 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
a0d0e21e 1992 osvers=2
ecfc5424
AD
1993 fi
1994 fi
1995 ;;
c4f23d77
AD
1996 pc*)
1997 if test -n "$DJGPP"; then
1998 osname=dos
1999 osvers=djgpp
2000 fi
2001 ;;
2304df62
AD
2002 esac
2003
2004 case "$1" in
a0d0e21e
LW
2005 aix) osname=aix
2006 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2007 case "$tmp" in
1aef975c 2008 'not found') osvers="$4"."$3" ;;
a0d0e21e
LW
2009 '<3240'|'<>3240') osvers=3.2.0 ;;
2010 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2011 '=3250'|'>3250') osvers=3.2.5 ;;
1aef975c 2012 *) osvers=$tmp;;
a0d0e21e
LW
2013 esac
2014 ;;
23f87696
SZ
2015 *dc.osx) osname=dcosx
2016 osvers="$3"
2017 ;;
a0d0e21e
LW
2018 dnix) osname=dnix
2019 osvers="$3"
2020 ;;
2021 domainos) osname=apollo
2022 osvers="$3"
2023 ;;
2024 dgux) osname=dgux
2025 osvers="$3"
2026 ;;
760ac839
LW
2027 dynixptx*) osname=dynixptx
2028 osvers="$3"
2029 ;;
a0d0e21e
LW
2030 freebsd) osname=freebsd
2031 osvers="$3" ;;
2032 genix) osname=genix ;;
2033 hp*) osname=hpux
bfb7748a 2034 osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
a0d0e21e 2035 ;;
a78b0d02 2036 irix*) osname=irix
a0d0e21e
LW
2037 case "$3" in
2038 4*) osvers=4 ;;
2039 5*) osvers=5 ;;
ecfc5424 2040 *) osvers="$3" ;;
a0d0e21e
LW
2041 esac
2042 ;;
2043 linux) osname=linux
2044 case "$3" in
a0d0e21e
LW
2045 *) osvers="$3" ;;
2046 esac
2047 ;;
28e8609d
JH
2048 MiNT) osname=mint
2049 ;;
2050 netbsd*) osname=netbsd
ecfc5424
AD
2051 osvers="$3"
2052 ;;
4e81affe
MM
2053 news-os) osvers="$3"
2054 case "$3" in
2055 4*) osname=newsos4 ;;
2056 *) osname=newsos ;;
2057 esac
2058 ;;
a0d0e21e
LW
2059 bsd386) osname=bsd386
2060 osvers=`$uname -r`
2061 ;;
ae3afa4e
TH
2062 powerux | power_ux | powermax_os | powermaxos | \
2063 powerunix | power_unix) osname=powerux
2064 osvers="$3"
2065 ;;
a0d0e21e
LW
2066 next*) osname=next ;;
2067 solaris) osname=solaris
2068 case "$3" in
2069 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
ecfc5424 2070 *) osvers="$3" ;;
a0d0e21e
LW
2071 esac
2072 ;;
85e6fe83
LW
2073 sunos) osname=sunos
2074 case "$3" in
85e6fe83
LW
2075 5*) osname=solaris
2076 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
a0d0e21e 2077 *) osvers="$3" ;;
2304df62
AD
2078 esac
2079 ;;
a0d0e21e 2080 titanos) osname=titanos
85e6fe83 2081 case "$3" in
a0d0e21e
LW
2082 1*) osvers=1 ;;
2083 2*) osvers=2 ;;
2084 3*) osvers=3 ;;
2085 4*) osvers=4 ;;
ecfc5424 2086 *) osvers="$3" ;;
2304df62
AD
2087 esac
2088 ;;
85e6fe83 2089 ultrix) osname=ultrix
ecfc5424 2090 osvers="$3"
2304df62 2091 ;;
28757baa 2092 osf1|mls+) case "$5" in
fed7345c
AD
2093 alpha)
2094 osname=dec_osf
313489a2 2095 osvers=`echo "$3" | sed 's/^[xvt]//'`
ecfc5424
AD
2096 ;;
2097 hp*) osname=hp_osf1 ;;
2098 mips) osname=mips_osf1 ;;
85e6fe83
LW
2099 esac
2100 ;;
a0d0e21e
LW
2101 uts) osname=uts
2102 osvers="$3"
2103 ;;
ff68c719 2104 qnx) osname=qnx
2105 osvers="$4"
2106 ;;
85e6fe83 2107 $2) case "$osname" in
2304df62 2108 *isc*) ;;
a0d0e21e 2109 *freebsd*) ;;
5f05dabc 2110 svr*)
a0d0e21e
LW
2111 : svr4.x or possibly later
2112 case "svr$3" in
2113 ${osname}*)
2114 osname=svr$3
2115 osvers=$4
2116 ;;
2117 esac
2118 case "$osname" in
2119 svr4.0)
2120 : Check for ESIX
2121 if test -f /stand/boot ; then
2122 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
ecfc5424
AD
2123 if test -n "$INITPROG" -a -f "$INITPROG"; then
2124 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2125 if test -n "$isesix"; then
a0d0e21e
LW
2126 osname=esix4
2127 fi
2128 fi
2129 fi
2130 ;;
2131 esac
2132 ;;
2304df62 2133 *) if test -f /etc/systemid; then
a0d0e21e
LW
2134 osname=sco
2135 set `echo $3 | $sed 's/\./ /g'` $4
c4f23d77 2136 if $test -f $src/hints/sco_$1_$2_$3.sh; then
85e6fe83 2137 osvers=$1.$2.$3
c4f23d77 2138 elif $test -f $src/hints/sco_$1_$2.sh; then
85e6fe83 2139 osvers=$1.$2
c4f23d77 2140 elif $test -f $src/hints/sco_$1.sh; then
85e6fe83 2141 osvers=$1
2304df62 2142 fi
a0d0e21e
LW
2143 else
2144 case "$osname" in
2145 '') : Still unknown. Probably a generic Sys V.
2146 osname="sysv"
2147 osvers="$3"
2148 ;;
2149 esac
2304df62
AD
2150 fi
2151 ;;
2152 esac
2153 ;;
a0d0e21e
LW
2154 *) case "$osname" in
2155 '') : Still unknown. Probably a generic BSD.
2156 osname="$1"
2157 osvers="$3"
2158 ;;
2159 esac
2160 ;;
2304df62
AD
2161 esac
2162 else
dfe9444c
AD
2163 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2164 (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2165 if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2166 osname=news_os
2304df62 2167 fi
dfe9444c 2168 $rm -f UU/kernel.what
8e07c86e
AD
2169 elif test -d c:/.; then
2170 set X $myuname
2171 osname=os2
2172 osvers="$5"
2304df62
AD
2173 fi
2174 fi
85e6fe83 2175
a0d0e21e
LW
2176 : Now look for a hint file osname_osvers, unless one has been
2177 : specified already.
2178 case "$hintfile" in
2179 ''|' ')
ecfc5424 2180 file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'`
a0d0e21e 2181 : Also try without trailing minor version numbers.
ecfc5424
AD
2182 xfile=`echo $file | $sed -e 's@_[^_]*$@@'`
2183 xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'`
2184 xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'`
2185 xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'`
a0d0e21e
LW
2186 case "$file" in
2187 '') dflt=none ;;
2188 *) case "$osvers" in
2189 '') dflt=$file
2190 ;;
dfe9444c 2191 *) if $test -f $src/hints/$file.sh ; then
a0d0e21e 2192 dflt=$file
dfe9444c 2193 elif $test -f $src/hints/$xfile.sh ; then
a0d0e21e 2194 dflt=$xfile
dfe9444c 2195 elif $test -f $src/hints/$xxfile.sh ; then
a0d0e21e 2196 dflt=$xxfile
dfe9444c 2197 elif $test -f $src/hints/$xxxfile.sh ; then
a0d0e21e 2198 dflt=$xxxfile
dfe9444c 2199 elif $test -f $src/hints/$xxxxfile.sh ; then
a0d0e21e 2200 dflt=$xxxxfile
dfe9444c 2201 elif $test -f "$src/hints/${osname}.sh" ; then
a0d0e21e
LW
2202 dflt="${osname}"
2203 else
2204 dflt=none
2205 fi
2206 ;;
2207 esac
85e6fe83
LW
2208 ;;
2209 esac
4e2a5f63
AD
2210 if $test -f Policy.sh ; then
2211 case "$dflt" in
2212 *Policy*) ;;
2213 none) dflt="Policy" ;;
2214 *) dflt="Policy $dflt" ;;
2215 esac
2216 fi
85e6fe83 2217 ;;
a0d0e21e 2218 *)
ecfc5424 2219 dflt=`echo $hintfile | $sed 's/\.sh$//'`
a0d0e21e 2220 ;;
2304df62 2221 esac
1aef975c 2222
4e2a5f63
AD
2223 if $test -f Policy.sh ; then
2224 $cat <<EOM
2225
2226There's also a Policy hint file available, which should make the
2227site-specific (policy) questions easier to answer.
2228EOM
2229
2230 fi
2231
2304df62
AD
2232 $cat <<EOM
2233
2234You may give one or more space-separated answers, or "none" if appropriate.
4e2a5f63
AD
2235A well-behaved OS will have no hints, so answering "none" or just "Policy"
2236is a good thing. DO NOT give a wrong version.
2304df62
AD
2237
2238EOM
4e2a5f63 2239
2304df62 2240 rp="Which of these apply, if any?"
dfe9444c 2241 . UU/myread
85e6fe83
LW
2242 tans=$ans
2243 for file in $tans; do
4e2a5f63
AD
2244 if $test X$file = XPolicy -a -f Policy.sh; then
2245 . Policy.sh
2246 $cat Policy.sh >> UU/config.sh
2247 elif $test -f $src/hints/$file.sh; then
dfe9444c
AD
2248 . $src/hints/$file.sh
2249 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83 2250 elif $test X$tans = X -o X$tans = Xnone ; then
2304df62
AD
2251 : nothing
2252 else
85e6fe83
LW
2253 : Give one chance to correct a possible typo.
2254 echo "$file.sh does not exist"
2255 dflt=$file
2256 rp="hint to use instead?"
dfe9444c 2257 . UU/myread
85e6fe83 2258 for file in $ans; do
dfe9444c
AD
2259 if $test -f "$src/hints/$file.sh"; then
2260 . $src/hints/$file.sh
2261 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83
LW
2262 elif $test X$ans = X -o X$ans = Xnone ; then
2263 : nothing
2264 else
2265 echo "$file.sh does not exist -- ignored."
2266 fi
2267 done
2304df62
AD
2268 fi
2269 done
85e6fe83 2270
2304df62 2271 hint=recommended
85e6fe83 2272 : Remember our hint file for later.
dfe9444c 2273 if $test -f "$src/hints/$file.sh" ; then
a0d0e21e 2274 hintfile="$file"
85e6fe83 2275 else
a0d0e21e 2276 hintfile=''
85e6fe83 2277 fi
2304df62
AD
2278fi
2279cd UU
2280;;
2281*)
2282 echo " "
2283 echo "Fetching default answers from $config_sh..." >&4
ecfc5424
AD
2284 tmp_n="$n"
2285 tmp_c="$c"
2304df62
AD
2286 cd ..
2287 cp $config_sh config.sh 2>/dev/null
a78b0d02 2288 chmod +w config.sh
2304df62
AD
2289 . ./config.sh
2290 cd UU
2291 cp ../config.sh .
ecfc5424
AD
2292 n="$tmp_n"
2293 c="$tmp_c"
2304df62
AD
2294 hint=previous
2295 ;;
2296esac
1aef975c
AD
2297test "$override" && . ./optdef.sh
2298myuname="$newmyuname"
2304df62
AD
2299
2300: Restore computed paths
2301for file in $loclist $trylist; do
2302 eval $file="\$_$file"
2303done
2304
85e6fe83 2305cat << EOM
a0d0e21e 2306
85e6fe83 2307Configure uses the operating system name and version to set some defaults.
ecfc5424
AD
2308The default value is probably right if the name rings a bell. Otherwise,
2309since spelling matters for me, either accept the default or answer "none"
2310to leave it blank.
a0d0e21e 2311
85e6fe83 2312EOM
85e6fe83 2313case "$osname" in
a0d0e21e 2314 ''|' ')
85e6fe83 2315 case "$hintfile" in
a0d0e21e 2316 ''|' '|none) dflt=none ;;
ecfc5424 2317 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
85e6fe83
LW
2318 esac
2319 ;;
2320 *) dflt="$osname" ;;
2321esac
2322rp="Operating system name?"
2323. ./myread
2324case "$ans" in
ecfc5424
AD
2325none) osname='' ;;
2326*) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
85e6fe83 2327esac
8ff267be 2328echo " "
2329case "$osvers" in
2330 ''|' ')
2331 case "$hintfile" in
2332 ''|' '|none) dflt=none ;;
2333 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2334 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2335 case "$dflt" in
2336 ''|' ') dflt=none ;;
2337 esac
2338 ;;
2339 esac
2340 ;;
2341 *) dflt="$osvers" ;;
2342esac
2343rp="Operating system version?"
2344. ./myread
2345case "$ans" in
2346none) osvers='' ;;
2347*) osvers="$ans" ;;
2348esac
2349
2304df62 2350: who configured the system
7792a3d7 2351cf_time=`LC_ALL=C; export LC_ALL; $date 2>&1`
8ff267be 2352cf_by=`(logname) 2>/dev/null`
dfe9444c
AD
2353case "$cf_by" in
2354"")
8ff267be 2355 cf_by=`(whoami) 2>/dev/null`
dfe9444c
AD
2356 case "$cf_by" in
2357 "") cf_by=unknown ;;
8ff267be 2358 esac ;;
2359esac
2304df62 2360
dfe9444c
AD
2361: set up the script used to warn in case of inconsistency
2362cat <<EOS >whoa
2363$startsh
2364EOS
2365cat <<'EOSC' >>whoa
2366dflt=y
2367echo " "
2368echo "*** WHOA THERE!!! ***" >&4
2369echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
2370rp=" Keep the $hint value?"
2371. ./myread
2372case "$ans" in
2373y) td=$was; tu=$was;;
2374esac
2375EOSC
2376
2377: function used to set $1 to $val
2378setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2379case "$val$was" in
2380$define$undef) . ./whoa; eval "$var=\$td";;
2381$undef$define) . ./whoa; eval "$var=\$tu";;
2382*) eval "$var=$val";;
2383esac'
2384
2385cat <<EOM
2386
2387Perl can be built to take advantage of threads, on some systems.
2388To do so, Configure must be run with -Dusethreads.
2389(See README.threads for details.)
2390EOM
2391case "$usethreads" in
2392$define|true|[yY]*) dflt='y';;
2393*) dflt='n';;
2394esac
2395rp='Build a threading Perl?'
2396. ./myread
2397case "$ans" in
2398y|Y) val="$define" ;;
2399*) val="$undef" ;;
2400esac
2401set usethreads
2402eval $setvar
693762b4 2403: Look for a hint-file generated 'call-back-unit'. Now that the
dc45a647
MB
2404: user has specified if a threading perl is to be built, we may need
2405: to set or change some other defaults.
693762b4
AD
2406if $test -f usethreads.cbu; then
2407 . ./usethreads.cbu
2408fi
2409case "$d_oldpthreads" in
2410'') : Configure tests would be welcome here. For now, assume undef.
2411 val="$undef" ;;
2412*) val="$d_oldpthreads" ;;
2413esac
2414set d_oldpthreads
2415eval $setvar
dfe9444c 2416
4633a7c4 2417: determine the architecture name
2304df62 2418echo " "
4633a7c4
LW
2419if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
2420 tarch=`arch`"-$osname"
2421elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
2422 if uname -m > tmparch 2>&1 ; then
7e1af8bc 2423 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5f05dabc 2424 -e 's/$/'"-$osname/" tmparch`
4633a7c4
LW
2425 else
2426 tarch="$osname"
2427 fi
2428 $rm -f tmparch
2429else
2430 tarch="$osname"
2431fi
2432case "$myarchname" in
2433''|"$tarch") ;;
2434*)
2435 echo "(Your architecture name used to be $myarchname.)"
2436 archname=''
2304df62
AD
2437 ;;
2438esac
4633a7c4
LW
2439case "$archname" in
2440'') dflt="$tarch";;
2441*) dflt="$archname";;
2442esac
2443rp='What is your architecture name'
2444. ./myread
dc66995c 2445case "$usethreads" in
c6ee37c5
MB
2446$define) echo "Threads selected." >&4
2447 case "$ans" in
2448 *-thread) echo "...and architecture name already ends in -thread." >&4
2449 archname="$ans"
2450 ;;
2451 *) archname="$ans-thread"
2452 echo "...setting architecture name to $archname." >&4
2453 ;;
2454 esac
dc66995c
MB
2455 ;;
2456*) archname="$ans" ;;
2457esac
4633a7c4 2458myarchname="$tarch"
4633a7c4
LW
2459: is AFS running?
2460echo " "
2afac517 2461case "$afs" in
2462$define|true) afs=true ;;
2463$undef|false) afs=false ;;
2464*) if test -d /afs; then
2465 afs=true
2466 else
2467 afs=false
2468 fi
2469 ;;
2470esac
2471if $afs; then
4633a7c4 2472 echo "AFS may be running... I'll be extra cautious then..." >&4
2304df62 2473else
4633a7c4 2474 echo "AFS does not seem to be running..." >&4
2304df62
AD
2475fi
2476
4633a7c4
LW
2477: decide how portable to be. Allow command line overrides.
2478case "$d_portable" in
2479"$undef") ;;
2480*) d_portable="$define" ;;
2304df62 2481esac
2304df62 2482
4633a7c4
LW
2483: set up shell script to do ~ expansion
2484cat >filexp <<EOSS
2485$startsh
2486: expand filename
2487case "\$1" in
2488 ~/*|~)
2489 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
2304df62 2490 ;;
4633a7c4
LW
2491 ~*)
2492 if $test -f /bin/csh; then
2493 /bin/csh -f -c "glob \$1"
2494 failed=\$?
2495 echo ""
2496 exit \$failed
2497 else
2498 name=\`$expr x\$1 : '..\([^/]*\)'\`
2499 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
2500 if $test ! -d "\$dir"; then
2501 me=\`basename \$0\`
2502 echo "\$me: can't locate home directory for: \$name" >&2
2503 exit 1
2504 fi
2505 case "\$1" in
2506 */*)
2507 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
2508 ;;
2509 *)
2510 echo \$dir
2511 ;;
2304df62 2512 esac
4633a7c4 2513 fi
2304df62
AD
2514 ;;
2515*)
4633a7c4 2516 echo \$1
2304df62
AD
2517 ;;
2518esac
4633a7c4
LW
2519EOSS
2520chmod +x filexp
2521$eunicefix filexp
2304df62
AD
2522
2523: now set up to get a file name
28757baa 2524cat <<EOS >getfile
2525$startsh
2526EOS
2527cat <<'EOSC' >>getfile
2304df62
AD
2528tilde=''
2529fullpath=''
2530already=''
2531skip=''
2532none_ok=''
2533exp_file=''
a0d0e21e 2534nopath_ok=''
2304df62
AD
2535orig_rp="$rp"
2536orig_dflt="$dflt"
2537
2538case "$fn" in
ecfc5424 2539*\(*)
28e8609d 2540 expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
ecfc5424
AD
2541 fn=`echo $fn | sed 's/(.*)//'`
2542 ;;
2543esac
2544
2545case "$fn" in
a0d0e21e
LW
2546*:*)
2547 loc_file=`expr $fn : '.*:\(.*\)'`
2548 fn=`expr $fn : '\(.*\):.*'`
2549 ;;
2550esac
2551
2552case "$fn" in
2304df62
AD
2553*~*) tilde=true;;
2554esac
2555case "$fn" in
2556*/*) fullpath=true;;
2557esac
2558case "$fn" in
2559*+*) skip=true;;
2560esac
2561case "$fn" in
2562*n*) none_ok=true;;
2563esac
2564case "$fn" in
2565*e*) exp_file=true;;
2566esac
a0d0e21e
LW
2567case "$fn" in
2568*p*) nopath_ok=true;;
2569esac
2304df62
AD
2570
2571case "$fn" in
2572*f*) type='File';;
2573*d*) type='Directory';;
a0d0e21e 2574*l*) type='Locate';;
2304df62
AD
2575esac
2576
2577what="$type"
2578case "$what" in
2579Locate) what='File';;
2580esac
2581
2582case "$exp_file" in
2583'')
2584 case "$d_portable" in
2585 "$define") ;;
2586 *) exp_file=true;;
2587 esac
2588 ;;
2589esac
2590
2591cd ..
2592while test "$type"; do
2593 redo=''
2594 rp="$orig_rp"
2595 dflt="$orig_dflt"
2596 case "$tilde" in
2597 true) rp="$rp (~name ok)";;
2598 esac
2599 . UU/myread
ecfc5424
AD
2600 if test -f UU/getfile.ok && \
2601 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
2602 then
2603 value="$ans"
2604 ansexp="$ans"
2605 break
2606 fi
2304df62
AD
2607 case "$ans" in
2608 none)
2609 value=''
2610 ansexp=''
2611 case "$none_ok" in
2612 true) type='';;
2613 esac
2614 ;;
2615 *)
2616 case "$tilde" in
2617 '') value="$ans"
2618 ansexp="$ans";;
2619 *)
2620 value=`UU/filexp $ans`
2621 case $? in
2622 0)
2623 if test "$ans" != "$value"; then
ecfc5424 2624 echo "(That expands to $value on this system.)"
2304df62
AD
2625 fi
2626 ;;
2627 *) value="$ans";;
2628 esac
2629 ansexp="$value"
2630 case "$exp_file" in
2631 '') value="$ans";;
2632 esac
2633 ;;
2634 esac
2635 case "$fullpath" in
2636 true)
2637 case "$ansexp" in
2638 /*) value="$ansexp" ;;
2639 *)
2640 redo=true
2641 case "$already" in
2642 true)
2643 echo "I shall only accept a full path name, as in /bin/ls." >&4
2644 echo "Use a ! shell escape if you wish to check pathnames." >&4
2645 ;;
2646 *)
2647 echo "Please give a full path name, starting with slash." >&4
2648 case "$tilde" in
2649 true)
2650 echo "Note that using ~name is ok provided it expands well." >&4
2651 already=true
2652 ;;
2653 esac
2654 esac
2655 ;;
2656 esac
2657 ;;
2658 esac
2659 case "$redo" in
2660 '')
2661 case "$type" in
2662 File)
2663 if test -f "$ansexp"; then
2664 type=''
2665 elif test -r "$ansexp" || (test -h "$ansexp") >/dev/null 2>&1
2666 then
2667 echo "($value is not a plain file, but that's ok.)"
2668 type=''
2669 fi
2670 ;;
2671 Directory)
2672 if test -d "$ansexp"; then
2673 type=''
2674 fi
2675 ;;
2676 Locate)
40000a8c 2677 if test -d "$ansexp"; then
a0d0e21e
LW
2678 echo "(Looking for $loc_file in directory $value.)"
2679 value="$value/$loc_file"
40000a8c 2680 ansexp="$ansexp/$loc_file"
2304df62 2681 fi
40000a8c 2682 if test -f "$ansexp"; then
2304df62
AD
2683 type=''
2684 fi
a0d0e21e
LW
2685 case "$nopath_ok" in
2686 true) case "$value" in
2687 */*) ;;
2688 *) echo "Assuming $value will be in people's path."
2689 type=''
2690 ;;
2691 esac
2692 ;;
2693 esac
2304df62
AD
2694 ;;
2695 esac
2696
2697 case "$skip" in
2698 true) type='';
2699 esac
2700
2701 case "$type" in
2702 '') ;;
2703 *)
2704 if test "$fastread" = yes; then
2705 dflt=y
2706 else
2707 dflt=n
2708 fi
2709 rp="$what $value doesn't exist. Use that name anyway?"
2710 . UU/myread
2711 dflt=''
2712 case "$ans" in
2713 y*) type='';;
2714 *) echo " ";;
2715 esac
2716 ;;
2717 esac
2718 ;;
2719 esac
2720 ;;
2721 esac
2722done
2723cd UU
2724ans="$value"
2725rp="$orig_rp"
2726dflt="$orig_dflt"
ecfc5424 2727rm -f getfile.ok
2304df62
AD
2728EOSC
2729
4633a7c4
LW
2730: determine root of directory hierarchy where package will be installed.
2731case "$prefix" in
2732'')
2733 dflt=`./loc . /usr/local /usr/local /local /opt /usr`
8e07c86e 2734 ;;
4633a7c4
LW
2735*)
2736 dflt="$prefix"
8e07c86e
AD
2737 ;;
2738esac
4633a7c4 2739$cat <<EOM
2304df62 2740
4633a7c4
LW
2741By default, $package will be installed in $dflt/bin, manual
2742pages under $dflt/man, etc..., i.e. with $dflt as prefix for
2743all installation directories. Typically set to /usr/local, but you
2744may choose /usr if you wish to install $package among your system
2745binaries. If you wish to have binaries under /bin but manual pages
2746under /usr/local/man, that's ok: you will be prompted separately
2747for each of the installation directories, the prefix being only used
2748to set the defaults.
8e07c86e
AD
2749
2750EOM
2751fn=d~
2752rp='Installation prefix to use?'
2753. ./getfile
2754oldprefix=''
2755case "$prefix" in
a0d0e21e 2756'') ;;
8e07c86e
AD
2757*)
2758 case "$ans" in
2759 "$prefix") ;;
2760 *) oldprefix="$prefix";;
2761 esac
2762 ;;
a0d0e21e 2763esac
8e07c86e
AD
2764prefix="$ans"
2765prefixexp="$ansexp"
a0d0e21e 2766
8e07c86e
AD
2767: set the prefixit variable, to compute a suitable default value
2768prefixit='case "$3" in
2769""|none)
2770 case "$oldprefix" in
2771 "") eval "$1=\"\$$2\"";;
2772 *)
2773 case "$3" in
2774 "") eval "$1=";;
2775 none)
2776 eval "tp=\"\$$2\"";
2777 case "$tp" in
2778 ""|" ") eval "$1=\"\$$2\"";;
2779 *) eval "$1=";;
2780 esac;;
2781 esac;;
2782 esac;;
2783*)
2784 eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
2785 case "$tp" in
2786 --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
2787 /*-$oldprefix/*|\~*-$oldprefix/*)
2788 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
2789 *) eval "$1=\"\$$2\"";;
2790 esac;;
2791esac'
a0d0e21e 2792
bfb7748a
AD
2793: set the base revision
2794baserev=5.0
2795
2796: get the patchlevel
2797echo " "
2798echo "Getting the current patchlevel..." >&4
2799if $test -r $rsrc/patchlevel.h;then
2800 patchlevel=`awk '/define[ ]+PATCHLEVEL/ {print $3}' $rsrc/patchlevel.h`
2801 subversion=`awk '/define[ ]+SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
2802else
2803 patchlevel=0
2804 subversion=0
2805fi
2806$echo $n "(You have $package" $c
2807case "$package" in
2808"*$baserev") ;;
2809*) $echo $n " $baserev" $c ;;
2810esac
2811$echo $n " patchlevel $patchlevel" $c
2812test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
2813echo ".)"
2814
2815if test 0 -eq "$subversion"; then
2816 version=`LC_ALL=C; export LC_ALL; \
2817 echo $baserev $patchlevel | \
2818 $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
2819else
2820 version=`LC_ALL=C; export LC_ALL; \
2821 echo $baserev $patchlevel $subversion | \
2822 $awk '{ printf "%.5f\n", $1 + $2/1000.0 + $3/100000.0 }'`
2823fi
2824: Figure out perl API version. Perhaps this should be in patchlevel.h
2825if test "$subversion" -lt 50; then
2826 apiversion=`LC_ALL=C; export LC_ALL; \
2827 echo $baserev $patchlevel | \
2828 $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
2829else
2830 apiversion="$version"
2831fi
2832
4633a7c4 2833: determine where private library files go
3a6175e1
AD
2834: Usual default is /usr/local/lib/perl5/$version.
2835: Also allow things like /opt/perl/lib/$version, since
bfb7748a 2836: /opt/perl/lib/perl5... would be redundant.
4633a7c4 2837case "$prefix" in
3a6175e1
AD
2838*perl*) set dflt privlib lib/$version ;;
2839*) set dflt privlib lib/$package/$version ;;
4633a7c4 2840esac
8e07c86e 2841eval $prefixit
4633a7c4
LW
2842$cat <<EOM
2843
2844There are some auxiliary files for $package that need to be put into a
2845private library directory that is accessible by everyone.
2846
2847EOM
2848fn=d~+
2849rp='Pathname where the private library files will reside?'
8e07c86e 2850. ./getfile
4633a7c4
LW
2851if $test "X$privlibexp" != "X$ansexp"; then
2852 installprivlib=''
8e07c86e 2853fi
4633a7c4
LW
2854privlib="$ans"
2855privlibexp="$ansexp"
8e07c86e
AD
2856if $afs; then
2857 $cat <<EOM
2304df62 2858
8e07c86e 2859Since you are running AFS, I need to distinguish the directory in which
4633a7c4 2860private files reside from the directory in which they are installed (and from
8e07c86e 2861which they are presumably copied to the former directory by occult means).
a0d0e21e 2862
8e07c86e 2863EOM
4633a7c4
LW
2864 case "$installprivlib" in
2865 '') dflt=`echo $privlibexp | sed 's#^/afs/#/afs/.#'`;;
2866 *) dflt="$installprivlib";;
8e07c86e
AD
2867 esac
2868 fn=de~
4633a7c4 2869 rp='Where will private files be installed?'
8e07c86e 2870 . ./getfile
4633a7c4 2871 installprivlib="$ans"
8e07c86e 2872else
4633a7c4
LW
2873 installprivlib="$privlibexp"
2874fi
2875
8e07c86e
AD
2876: set the prefixup variable, to restore leading tilda escape
2877prefixup='case "$prefixexp" in
2878"$prefix") ;;
2879*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
2880esac'
2881
4633a7c4
LW
2882: determine where public architecture dependent libraries go
2883set archlib archlib
8e07c86e 2884eval $prefixit
3a6175e1 2885: privlib default is /usr/local/lib/$package/$version
bfb7748a 2886: archlib default is /usr/local/lib/$package/$version/$archname
3a6175e1 2887: privlib may have an optional trailing /share.
bfb7748a
AD
2888tdflt=`echo $privlib | $sed 's,/share$,,'`
2889tdflt=$tdflt/$archname
4633a7c4 2890case "$archlib" in
bfb7748a 2891'') dflt=$tdflt
8e07c86e 2892 ;;
bfb7748a 2893*) dflt="$archlib"
774d564b 2894 ;;
8e07c86e 2895esac
4633a7c4
LW
2896cat <<EOM
2897
2898$spackage contains architecture-dependent library files. If you are
2899sharing libraries in a heterogeneous environment, you might store
2900these files in a separate location. Otherwise, you can just include
2901them with the rest of the public library files.
2902
8e07c86e 2903EOM
4633a7c4
LW
2904fn=d+~
2905rp='Where do you want to put the public architecture-dependent libraries?'
8e07c86e 2906. ./getfile
4633a7c4
LW
2907archlib="$ans"
2908archlibexp="$ansexp"
2909
8e07c86e
AD
2910if $afs; then
2911 $cat <<EOM
2912
7bac28a0 2913Since you are running AFS, I need to distinguish the directory in
2914which architecture-dependent library files reside from the directory
2915in which they are installed (and from which they are presumably copied
2916to the former directory by occult means).
8e07c86e
AD
2917
2918EOM
4633a7c4
LW
2919 case "$installarchlib" in
2920 '') dflt=`echo $archlibexp | sed 's#^/afs/#/afs/.#'`;;
2921 *) dflt="$installarchlib";;
8e07c86e
AD
2922 esac
2923 fn=de~
4633a7c4 2924 rp='Where will architecture-dependent library files be installed?'
8e07c86e 2925 . ./getfile
4633a7c4 2926 installarchlib="$ans"
8e07c86e 2927else
4633a7c4
LW
2928 installarchlib="$archlibexp"
2929fi
2930if $test X"$archlib" = X"$privlib"; then
2931 d_archlib="$undef"
2932else
2933 d_archlib="$define"
8e07c86e
AD
2934fi
2935
40a7a20a 2936: make some quick guesses about what we are up against
2937echo " "
2938$echo $n "Hmm... $c"
2939echo exit 1 >bsd
2940echo exit 1 >usg
2941echo exit 1 >v7
2942echo exit 1 >osf1
2943echo exit 1 >eunice
2944echo exit 1 >xenix
2945echo exit 1 >venix
8ff267be 2946echo exit 1 >os2
40a7a20a 2947d_bsd="$undef"
2948$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2949if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2950then
2951 echo "Looks kind of like an OSF/1 system, but we'll see..."
2952 echo exit 0 >osf1
2953elif test `echo abc | tr a-z A-Z` = Abc ; then
2954 xxx=`./loc addbib blurfl $pth`
2955 if $test -f $xxx; then
2956 echo "Looks kind of like a USG system with BSD features, but we'll see..."
2957 echo exit 0 >bsd
2958 echo exit 0 >usg
2959 else
2960 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2961 echo "Looks kind of like an extended USG system, but we'll see..."
2962 else
2963 echo "Looks kind of like a USG system, but we'll see..."
2964 fi
2965 echo exit 0 >usg
2966 fi
2967elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2968 echo "Looks kind of like a BSD system, but we'll see..."
2969 d_bsd="$define"
2970 echo exit 0 >bsd
2971else
2972 echo "Looks kind of like a Version 7 system, but we'll see..."
2973 echo exit 0 >v7
2974fi
2975case "$eunicefix" in
2976*unixtovms*)
2977 $cat <<'EOI'
2978There is, however, a strange, musty smell in the air that reminds me of
2979something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2980EOI
2981 echo exit 0 >eunice
2982 d_eunice="$define"
2983: it so happens the Eunice I know will not run shell scripts in Unix format
2984 ;;
2985*)
2986 echo " "
2987 echo "Congratulations. You aren't running Eunice."
2988 d_eunice="$undef"
2989 ;;
2990esac
8ff267be 2991: Detect OS2. The p_ variable is set above in the Head.U unit.
2992case "$p_" in
2993:) ;;
2994*)
2995 $cat <<'EOI'
2996I have the feeling something is not exactly right, however...don't tell me...
2997lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
2998EOI
2999 echo exit 0 >os2
3000 ;;
3001esac
40a7a20a 3002if test -f /xenix; then
3003 echo "Actually, this looks more like a XENIX system..."
3004 echo exit 0 >xenix
3005 d_xenix="$define"
3006else
3007 echo " "
3008 echo "It's not Xenix..."
3009 d_xenix="$undef"
3010fi
3011chmod +x xenix
3012$eunicefix xenix
3013if test -f /venix; then
3014 echo "Actually, this looks more like a VENIX system..."
3015 echo exit 0 >venix
3016else
3017 echo " "
3018 if ./xenix; then
3019 : null
3020 else
3021 echo "Nor is it Venix..."
3022 fi
3023fi
8ff267be 3024chmod +x bsd usg v7 osf1 eunice xenix venix os2
3025$eunicefix bsd usg v7 osf1 eunice xenix venix os2
40a7a20a 3026$rm -f foo
3027
3028: see if setuid scripts can be secure
3029$cat <<EOM
3030
3031Some kernels have a bug that prevents setuid #! scripts from being
3032secure. Some sites have disabled setuid #! scripts because of this.
3033
3034First let's decide if your kernel supports secure setuid #! scripts.
3035(If setuid #! scripts would be secure but have been disabled anyway,
3036don't say that they are secure if asked.)
3037
3038EOM
3039
3040val="$undef"
3041if $test -d /dev/fd; then
3042 echo "#!$ls" >reflect
3043 chmod +x,u+s reflect
3044 ./reflect >flect 2>&1
3045 if $contains "/dev/fd" flect >/dev/null; then
3046 echo "Congratulations, your kernel has secure setuid scripts!" >&4
3047 val="$define"
3048 else
3049 $cat <<EOM
3050If you are not sure if they are secure, I can check but I'll need a
3051username and password different from the one you are using right now.
3052If you don't have such a username or don't want me to test, simply
3053enter 'none'.
3054
3055EOM
3056 rp='Other username to test security of setuid scripts with?'
3057 dflt='none'
3058 . ./myread
3059 case "$ans" in
3060 n|none)
3061 case "$d_suidsafe" in
3062 '') echo "I'll assume setuid scripts are *not* secure." >&4
3063 dflt=n;;
3064 "$undef")
3065 echo "Well, the $hint value is *not* secure." >&4
3066 dflt=n;;
3067 *) echo "Well, the $hint value *is* secure." >&4
3068 dflt=y;;
3069 esac
3070 ;;
3071 *)
3072 $rm -f reflect flect
3073 echo "#!$ls" >reflect
3074 chmod +x,u+s reflect
3075 echo >flect
3076 chmod a+w flect
3077 echo '"su" will (probably) prompt you for '"$ans's password."
3078 su $ans -c './reflect >flect'
3079 if $contains "/dev/fd" flect >/dev/null; then
3080 echo "Okay, it looks like setuid scripts are secure." >&4
3081 dflt=y
3082 else
3083 echo "I don't think setuid scripts are secure." >&4
3084 dflt=n
3085 fi
3086 ;;
3087 esac
3088 rp='Does your kernel have *secure* setuid scripts?'
3089 . ./myread
3090 case "$ans" in
3091 [yY]*) val="$define";;
3092 *) val="$undef";;
3093 esac
3094 fi
3095else
3096 echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
760ac839 3097 echo "(That's for file descriptors, not floppy disks.)"
40a7a20a 3098 val="$undef"
3099fi
3100set d_suidsafe
3101eval $setvar
3102
3103$rm -f reflect flect
3104
3105: now see if they want to do setuid emulation
3106echo " "
3107val="$undef"
3108case "$d_suidsafe" in
3109"$define")
3110 val="$undef"
3111 echo "No need to emulate SUID scripts since they are secure here." >& 4
3112 ;;
3113*)
3114 $cat <<EOM
3115Some systems have disabled setuid scripts, especially systems where
3116setuid scripts cannot be secure. On systems where setuid scripts have
dfe9444c
AD
3117been disabled, the setuid/setgid bits on scripts are currently
3118useless. It is possible for $package to detect those bits and emulate
3119setuid/setgid in a secure fashion. This emulation will only work if
3120setuid scripts have been disabled in your kernel.
8e07c86e
AD
3121
3122EOM
dfe9444c
AD
3123 case "$d_dosuid" in
3124 "$define") dflt=y ;;
3125 *) dflt=n ;;
3126 esac
3127 rp="Do you want to do setuid/setgid emulation?"
3128 . ./myread
3129 case "$ans" in
3130 [yY]*) val="$define";;
3131 *) val="$undef";;
3132 esac
3133 ;;
4633a7c4 3134esac
dfe9444c 3135set d_dosuid
4633a7c4 3136eval $setvar
8e07c86e 3137
2c7991dc 3138: determine where manual pages are on this system
3139echo " "
3140case "$sysman" in
3141'')
3142 syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
3143 syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
3144 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
3145 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
3146 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
3147 sysman=`./loc . /usr/man/man1 $syspath`
3148 ;;
3149esac
3150if $test -d "$sysman"; then
3151 echo "System manual is in $sysman." >&4
3152else
3153 echo "Could not find manual pages in source form." >&4
3154fi
3155
dc45a647
MB
3156: see what memory models we can support
3157case "$models" in
3158'')
3159 $cat >pdp11.c <<'EOP'
3160main() {
3161#ifdef pdp11
3162 exit(0);
3163#else
3164 exit(1);
3165#endif
3166}
3167EOP
3168 ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
3169 if $test -f pdp11 && ./pdp11 2>/dev/null; then
3170 dflt='unsplit split'
3171 else
3172 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
3173 case "$tans" in
3174 X) dflt='none';;
3175 *) if $test -d /lib/small || $test -d /usr/lib/small; then
3176 dflt='small'
3177 else
3178 dflt=''
3179 fi
3180 if $test -d /lib/medium || $test -d /usr/lib/medium; then
3181 dflt="$dflt medium"
3182 fi
3183 if $test -d /lib/large || $test -d /usr/lib/large; then
3184 dflt="$dflt large"
3185 fi
3186 if $test -d /lib/huge || $test -d /usr/lib/huge; then
3187 dflt="$dflt huge"
3188 fi
3189 esac
3190 fi;;
3191*) dflt="$models";;
3192esac
8e07c86e 3193$cat <<EOM
dc45a647
MB
3194
3195Some systems have different model sizes. On most systems they are called
3196small, medium, large, and huge. On the PDP11 they are called unsplit and
3197split. If your system doesn't support different memory models, say "none".
3198If you wish to force everything to one memory model, say "none" here and
3199put the appropriate flags later when it asks you for other cc and ld flags.
3200Venix systems may wish to put "none" and let the compiler figure things out.
3201(In the following question multiple model names should be space separated.)
3202
3203The default for most systems is "none".
8e07c86e 3204
8e07c86e 3205EOM
dc45a647
MB
3206rp="Which memory models are supported?"
3207. ./myread
3208models="$ans"
3209
3210case "$models" in
3211none)
3212 small=''
3213 medium=''
3214 large=''
3215 huge=''
3216 unsplit=''
3217 split=''
2c7991dc 3218 ;;
dc45a647
MB
3219*split)
3220 case "$split" in
3221 '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
3222 $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
3223 dflt='-i'
3224 else
3225 dflt='none'
3226 fi;;
3227 *) dflt="$split";;
3228 esac
3229 rp="What flag indicates separate I and D space?"
3230 . ./myread
3231 tans="$ans"
3232 case "$tans" in
3233 none) tans='';;
3234 esac
3235 split="$tans"
3236 unsplit='';;
3237*large*|*small*|*medium*|*huge*)
3238 case "$models" in
3239 *large*)
3240 case "$large" in
3241 '') dflt='-Ml';;
3242 *) dflt="$large";;
3243 esac
3244 rp="What flag indicates large model?"
3245 . ./myread
3246 tans="$ans"
3247 case "$tans" in
3248 none) tans='';
3249 esac
3250 large="$tans";;
3251 *) large='';;
3252 esac
3253 case "$models" in
3254 *huge*) case "$huge" in
3255 '') dflt='-Mh';;
3256 *) dflt="$huge";;
3257 esac
3258 rp="What flag indicates huge model?"
3259 . ./myread
3260 tans="$ans"
3261 case "$tans" in
3262 none) tans='';
3263 esac
3264 huge="$tans";;
3265 *) huge="$large";;
3266 esac
3267 case "$models" in
3268 *medium*) case "$medium" in
3269 '') dflt='-Mm';;
3270 *) dflt="$medium";;
3271 esac
3272 rp="What flag indicates medium model?"
3273 . ./myread
3274 tans="$ans"
3275 case "$tans" in
3276 none) tans='';
3277 esac
3278 medium="$tans";;
3279 *) medium="$large";;
3280 esac
3281 case "$models" in
3282 *small*) case "$small" in
3283 '') dflt='none';;
3284 *) dflt="$small";;
3285 esac
3286 rp="What flag indicates small model?"
3287 . ./myread
3288 tans="$ans"
3289 case "$tans" in
3290 none) tans='';
3291 esac
3292 small="$tans";;
3293 *) small='';;
25f94b33 3294 esac
8e07c86e 3295 ;;
dc45a647
MB
3296*)
3297 echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
8e07c86e
AD
3298 ;;
3299esac
dc45a647 3300$rm -f pdp11.* pdp11
4e2a5f63 3301
dc45a647
MB
3302: see if we need a special compiler
3303echo " "
3304if ./usg; then
3305 case "$cc" in
3306 '') case "$Mcc" in
3307 /*) dflt='Mcc';;
3308 *) case "$large" in
3309 -M*) dflt='cc';;
3310 *) if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
3311 if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
3312 dflt='cc'
3313 else
3314 dflt='cc -M'
3315 fi
3316 else
3317 dflt='cc'
3318 fi;;
3319 esac;;
3320 esac;;
3321 *) dflt="$cc";;
3322 esac
3323 case "$dflt" in
3324 *M*) $cat <<'EOM'
3325On some older systems the default C compiler will not resolve multiple global
3326references that happen to have the same name. On some such systems the "Mcc"
3327command may be used to force these to be resolved. On other systems a "cc -M"
3328command is required. (Note that the -M flag on other systems indicates a
3329memory model to use!) If you have the Gnu C compiler, you might wish to use
3330that instead.
8e07c86e
AD
3331
3332EOM
dc45a647 3333 ;;
2afac517 3334 esac
dc45a647
MB
3335 rp="Use which C compiler?"
3336 . ./myread
3337 cc="$ans"
4e2a5f63 3338else
dc45a647
MB
3339 case "$cc" in
3340 '') dflt=cc;;
3341 *) dflt="$cc";;
4e2a5f63 3342 esac
dc45a647 3343 rp="Use which C compiler?"
4e2a5f63
AD
3344 . ./myread
3345 cc="$ans"
3346fi
693762b4
AD
3347: Look for a hint-file generated 'call-back-unit'. Now that the
3348: user has specified the compiler, we may need to set or change some
3349: other defaults.
3350if $test -f cc.cbu; then
3351 . ./cc.cbu
3352fi
4e2a5f63
AD
3353echo " "
3354echo "Checking for GNU cc in disguise and/or its version number..." >&4
3355$cat >gccvers.c <<EOM
3356#include <stdio.h>
3357int main() {
3358#ifdef __GNUC__
3359#ifdef __VERSION__
3360 printf("%s\n", __VERSION__);
3361#else
3362 printf("%s\n", "1");
3363#endif
3364#endif
3365 exit(0);
3366}
3367EOM
3368if $cc -o gccvers gccvers.c >/dev/null 2>&1; then
3369 gccversion=`./gccvers`
3370 case "$gccversion" in
2afac517 3371 '') echo "You are not using GNU cc." ;;
3372 *) echo "You are using GNU cc $gccversion." ;;
3373 esac
3374else
3375 echo " "
3376 echo "*** WHOA THERE!!! ***" >&4
3377 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
3378 case "$knowitall" in
3379 '')
3380 echo " You'd better start hunting for one and let me know about it." >&4
3381 exit 1
2c7991dc 3382 ;;
8e07c86e 3383 esac
2afac517 3384fi
3385$rm -f gccvers*
3386case "$gccversion" in
33871*) cpp=`./loc gcc-cpp $cpp $pth` ;;
8e07c86e
AD
3388esac
3389
2afac517 3390: What should the include directory be ?
8e07c86e 3391echo " "
2afac517 3392$echo $n "Hmm... $c"
3393dflt='/usr/include'
3394incpath=''
3395mips_type=''
3396if $test -f /bin/mips && /bin/mips; then
3397 echo "Looks like a MIPS system..."
3398 $cat >usr.c <<'EOCP'
3399#ifdef SYSTYPE_BSD43
3400/bsd43
3401#endif
3402EOCP
3403 if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3404 dflt='/bsd43/usr/include'
3405 incpath='/bsd43'
3406 mips_type='BSD 4.3'
8e07c86e 3407 else
2afac517 3408 mips_type='System V'
8e07c86e 3409 fi
2afac517 3410 $rm -f usr.c usr.out
3411 echo "and you're compiling with the $mips_type compiler and libraries."
3412 xxx_prompt=y
3413 echo "exit 0" >mips
8e07c86e 3414else
2afac517 3415 echo "Doesn't look like a MIPS system."
3416 xxx_prompt=n
3417 echo "exit 1" >mips
3418fi
3419chmod +x mips
3420$eunicefix mips
2afac517 3421case "$usrinc" in
3422'') ;;
3423*) dflt="$usrinc";;
3424esac
3425case "$xxx_prompt" in
3426y) fn=d/
dfe9444c 3427 echo " "
2afac517 3428 rp='Where are the include files you want to use?'
3429 . ./getfile
3430 usrinc="$ans"
3431 ;;
3432*) usrinc="$dflt"
3433 ;;
3434esac
8e07c86e 3435
c4f23d77
AD
3436: see how we invoke the C preprocessor
3437echo " "
3438echo "Now, how can we feed standard input to your C preprocessor..." >&4
3439cat <<'EOT' >testcpp.c
3440#define ABC abc
3441#define XYZ xyz
3442ABC.XYZ
3443EOT
3444cd ..
3445echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3446chmod 755 cppstdin
3447wrapper=`pwd`/cppstdin
3448ok='false'
3449cd UU
3450
3451if $test "X$cppstdin" != "X" && \
3452 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3453 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3454then
3455 echo "You used to use $cppstdin $cppminus so we'll use that again."
3456 case "$cpprun" in
3457 '') echo "But let's see if we can live without a wrapper..." ;;
3458 *)
3459 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3460 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3461 then
3462 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3463 ok='true'
3464 else
3465 echo "(However, $cpprun $cpplast does not work, let's see...)"
3466 fi
3467 ;;
3468 esac
3469else
3470 case "$cppstdin" in
3471 '') ;;
3472 *)
3473 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3474 ;;
3475 esac
3476fi
3477
3478if $ok; then
3479 : nothing
3480elif echo 'Maybe "'"$cc"' -E" will work...'; \
3481 $cc -E <testcpp.c >testcpp.out 2>&1; \
3482 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3483 echo "Yup, it does."
3484 x_cpp="$cc -E"
3485 x_minus='';
3486elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3487 $cc -E - <testcpp.c >testcpp.out 2>&1; \
3488 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3489 echo "Yup, it does."
3490 x_cpp="$cc -E"
3491 x_minus='-';
3492elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3493 $cc -P <testcpp.c >testcpp.out 2>&1; \
3494 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3495 echo "Yipee, that works!"
3496 x_cpp="$cc -P"
3497 x_minus='';
3498elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3499 $cc -P - <testcpp.c >testcpp.out 2>&1; \
3500 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3501 echo "At long last!"
3502 x_cpp="$cc -P"
3503 x_minus='-';
3504elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3505 $cpp <testcpp.c >testcpp.out 2>&1; \
3506 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3507 echo "It works!"
3508 x_cpp="$cpp"
3509 x_minus='';
3510elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3511 $cpp - <testcpp.c >testcpp.out 2>&1; \
3512 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3513 echo "Hooray, it works! I was beginning to wonder."
3514 x_cpp="$cpp"
3515 x_minus='-';
3516elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
3517 $wrapper <testcpp.c >testcpp.out 2>&1; \
3518 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3519 x_cpp="$wrapper"
3520 x_minus=''
3521 echo "Eureka!"
3522else
3523 dflt=''
3524 rp="No dice. I can't find a C preprocessor. Name one:"
3525 . ./myread
3526 x_cpp="$ans"
3527 x_minus=''
3528 $x_cpp <testcpp.c >testcpp.out 2>&1
3529 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3530 echo "OK, that will do." >&4
3531 else
3532echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
3533 exit 1
3534 fi
3535fi
3536
3537case "$ok" in
3538false)
3539 cppstdin="$x_cpp"
3540 cppminus="$x_minus"
3541 cpprun="$x_cpp"
3542 cpplast="$x_minus"
3543 set X $x_cpp
3544 shift
3545 case "$1" in
3546 "$cpp")
3547 echo "Perhaps can we force $cc -E using a wrapper..."
3548 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3549 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3550 then
3551 echo "Yup, we can."
3552 cppstdin="$wrapper"
3553 cppminus='';
3554 else
3555 echo "Nope, we'll have to live without it..."
3556 fi
3557 ;;
3558 esac
3559 case "$cpprun" in
3560 "$wrapper")
3561 cpprun=''
3562 cpplast=''
3563 ;;
3564 esac
3565 ;;
3566esac
3567
3568case "$cppstdin" in
3569"$wrapper") ;;
3570*) $rm -f $wrapper;;
3571esac
3572$rm -f testcpp.c testcpp.out
3573
2afac517 3574: Set private lib path
3575case "$plibpth" in
3576'') if ./mips; then
3577 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3578 fi;;
3579esac
3580case "$libpth" in
3581' ') dlist='';;
3582'') dlist="$loclibpth $plibpth $glibpth";;
3583*) dlist="$libpth";;
3584esac
8e07c86e 3585
2afac517 3586: Now check and see which directories actually exist, avoiding duplicates
3587libpth=''
3588for xxx in $dlist
3589do
3590 if $test -d $xxx; then
3591 case " $libpth " in
3592 *" $xxx "*) ;;
3593 *) libpth="$libpth $xxx";;
3594 esac
3595 fi
3596done
3597$cat <<'EOM'
8e07c86e 3598
2afac517 3599Some systems have incompatible or broken versions of libraries. Among
3600the directories listed in the question below, please remove any you
3601know not to be holding relevant libraries, and add any that are needed.
3602Say "none" for none.
8e07c86e 3603
8e07c86e 3604EOM
2afac517 3605case "$libpth" in
3606'') dflt='none';;
3607*)
3608 set X $libpth
3609 shift
3610 dflt=${1+"$@"}
4633a7c4 3611 ;;
8e07c86e 3612esac
2afac517 3613rp="Directories to use for library searches?"
3614. ./myread
3615case "$ans" in
3616none) libpth=' ';;
3617*) libpth="$ans";;
3618esac
8e07c86e 3619
2afac517 3620: compute shared library extension
3621case "$so" in
3622'')
3623 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3624 dflt='sl'
3625 else
3626 dflt='so'
3627 fi
3628 ;;
3629*) dflt="$so";;
8e07c86e 3630esac
2afac517 3631$cat <<EOM
8e07c86e 3632
2afac517 3633On some systems, shared libraries may be available. Answer 'none' if
3634you want to suppress searching of shared libraries for the remaining
3635of this configuration.
8e07c86e
AD
3636
3637EOM
2afac517 3638rp='What is the file extension used for shared libraries?'
3639. ./myread
3640so="$ans"
8e07c86e 3641
dfe9444c
AD
3642: Define several unixisms.
3643: Hints files or command line option can be used to override them.
3644: The convoluted testing is in case hints files set either the old
3645: or the new name.
3646case "$_exe" in
3647'') case "$exe_ext" in
3648 '') ;;
3649 *) _exe="$exe_ext" ;;
3650 esac
3651 ;;
3652esac
3653case "$_a" in
3654'') case "$lib_ext" in
3655 '') _a='.a';;
3656 *) _a="$lib_ext" ;;
3657 esac
3658 ;;
3659esac
3660case "$_o" in
3661'') case "$obj_ext" in
3662 '') _o='.o';;
3663 *) _o="$obj_ext";;
3664 esac
3665 ;;
3666esac
3667case "$p_" in
3668'') case "$path_sep" in
3669 '') p_=':';;
3670 *) p_="$path_sep";;
3671 esac
3672 ;;
3673esac
3674exe_ext=$_exe
3675lib_ext=$_a
3676obj_ext=$_o
3677path_sep=$p_
3678
3679: Which makefile gets called first. This is used by make depend.
3680case "$firstmakefile" in
3681'') firstmakefile='makefile';;
3682esac
3683
2afac517 3684: Looking for optional libraries
3685echo " "
3686echo "Checking for optional libraries..." >&4
3687case "$libs" in
3688' '|'') dflt='';;
3689*) dflt="$libs";;
8e07c86e 3690esac
2afac517 3691case "$libswanted" in
3692'') libswanted='c_s';;
3693esac
3694for thislib in $libswanted; do
3695
3696 if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`; $test -f "$xxx"; then
3697 echo "Found -l$thislib (shared)."
3698 case " $dflt " in
3699 *"-l$thislib "*);;
3700 *) dflt="$dflt -l$thislib";;
4633a7c4 3701 esac
2afac517 3702 elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
3703 echo "Found -l$thislib (shared)."
3704 case " $dflt " in
3705 *"-l$thislib "*);;
3706 *) dflt="$dflt -l$thislib";;
3707 esac
dfe9444c 3708 elif xxx=`./loc lib$thislib$_a X $libpth`; $test -f "$xxx"; then
2afac517 3709 echo "Found -l$thislib."
3710 case " $dflt " in
3711 *"-l$thislib "*);;
3712 *) dflt="$dflt -l$thislib";;
3713 esac
dfe9444c 3714 elif xxx=`./loc $thislib$_a X $libpth`; $test -f "$xxx"; then
2afac517 3715 echo "Found -l$thislib."
3716 case " $dflt " in
3717 *"-l$thislib "*);;
3718 *) dflt="$dflt -l$thislib";;
3719 esac
dfe9444c 3720 elif xxx=`./loc lib${thislib}_s$_a X $libpth`; $test -f "$xxx"; then
2afac517 3721 echo "Found -l${thislib}_s."
3722 case " $dflt " in
3723 *"-l$thislib "*);;
3724 *) dflt="$dflt -l${thislib}_s";;
3725 esac
dfe9444c 3726 elif xxx=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$xxx"; then
2afac517 3727 echo "Found -l$thislib."
3728 case " $dflt " in
3729 *"-l$thislib "*);;
3730 *) dflt="$dflt -l$thislib";;
3731 esac
3732 else
3733 echo "No -l$thislib."
3734 fi
3735done
3736set X $dflt
3737shift
3738dflt="$*"
3739case "$libs" in
3740'') dflt="$dflt";;
3741*) dflt="$libs";;
3742esac
3743case "$dflt" in
3744' '|'') dflt='none';;
8e07c86e 3745esac
2afac517 3746
4633a7c4
LW
3747$cat <<EOM
3748
2afac517 3749Some versions of Unix support shared libraries, which make executables smaller
3750but make load time slightly longer.
8e07c86e 3751
2afac517 3752On some systems, mostly System V Release 3's, the shared library is included
3753by putting the option "-lc_s" as the last thing on the cc command line when
3754linking. Other systems use shared libraries by default. There may be other
3755libraries needed to compile $package on your machine as well. If your system
3756needs the "-lc_s" option, include it here. Include any other special libraries
3757here as well. Say "none" for none.
4633a7c4 3758EOM
2afac517 3759
3760echo " "
3761rp="Any additional libraries?"
8e07c86e 3762. ./myread
2afac517 3763case "$ans" in
3764none) libs=' ';;
3765*) libs="$ans";;
3766esac
8e07c86e 3767
2afac517 3768: determine optimize, if desired, or use for debug flag also
3769case "$optimize" in
2ae324a7 3770' '|$undef) dflt='none';;
2afac517 3771'') dflt='-O';;
3772*) dflt="$optimize";;
4633a7c4 3773esac
2afac517 3774$cat <<EOH
4633a7c4 3775
760ac839 3776Some C compilers have problems with their optimizers. By default, $package
4633a7c4
LW
3777compiles with the -O flag to use the optimizer. Alternately, you might want
3778to use the symbolic debugger, which uses the -g flag (on traditional Unix
3779systems). Either flag can be specified here. To use neither flag, specify
3780the word "none".
3781
3782EOH
3783rp="What optimizer/debugger flag should be used?"
3784. ./myread
3785optimize="$ans"
3786case "$optimize" in
3787'none') optimize=" ";;
3788esac
3789
3790dflt=''
25f94b33
AD
3791: We will not override a previous value, but we might want to
3792: augment a hint file
3793case "$hint" in
3794none|recommended)
4633a7c4
LW
3795 case "$gccversion" in
3796 1*) dflt='-fpcc-struct-return' ;;
3797 esac
3798 case "$optimize" in
3799 *-g*) dflt="$dflt -DDEBUGGING";;
3800 esac
3801 case "$gccversion" in
3802 2*) if test -d /etc/conf/kconfig.d &&
3803 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3804 then
3805 dflt="$dflt -posix"
3806 fi
3807 ;;
3808 esac
3809 ;;
3810esac
3811
a4f3eea9 3812case "$mips_type" in
3813*BSD*|'') inclwanted="$locincpth $usrinc";;
3814*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3815esac
3816for thisincl in $inclwanted; do
3817 if $test -d $thisincl; then
3818 if $test x$thisincl != x$usrinc; then
3819 case "$dflt" in
3820 *$thisincl*);;
3821 *) dflt="$dflt -I$thisincl";;
3822 esac
3823 fi
3824 fi
3825done
3826
3827inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3828 xxx=true;
3829elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3830 xxx=true;
3831else
3832 xxx=false;
3833fi;
3834if $xxx; then
3835 case "$dflt" in
3836 *$2*);;
3837 *) dflt="$dflt -D$2";;
3838 esac;
3839fi'
3840
3841if ./osf1; then
3842 set signal.h __LANGUAGE_C__; eval $inctest
3843else
3844 set signal.h LANGUAGE_C; eval $inctest
3845fi
a4f3eea9 3846
3847case "$hint" in
3848none|recommended) dflt="$ccflags $dflt" ;;
3849*) dflt="$ccflags";;
3850esac
3851
3852case "$dflt" in
3853''|' ') dflt=none;;
3854esac
3855$cat <<EOH
3856
3857Your C compiler may want other flags. For this question you should include
3858-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
3859but you should NOT include libraries or ld flags like -lwhatever. If you
3860want $package to honor its debug switch, you should include -DDEBUGGING here.
dfe9444c 3861Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
a4f3eea9 3862
3863To use no flags, specify the word "none".
3864
3865EOH
3866set X $dflt
3867shift
3868dflt=${1+"$@"}
3869rp="Any additional cc flags?"
3870. ./myread
3871case "$ans" in
3872none) ccflags='';;
3873*) ccflags="$ans";;
3874esac
3875
3876: the following weeds options from ccflags that are of no interest to cpp
3877cppflags="$ccflags"
3878case "$gccversion" in
38791*) cppflags="$cppflags -D__GNUC__"
3880esac
3881case "$mips_type" in
3882'');;
3883*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
3884esac
3885case "$cppflags" in
3886'');;
3887*)
3888 echo " "
3889 echo "Let me guess what the preprocessor flags are..." >&4
3890 set X $cppflags
3891 shift
3892 cppflags=''
3893 $cat >cpp.c <<'EOM'
3894#define BLURFL foo
3895
3896BLURFL xx LFRULB
3897EOM
3898 previous=''
3899 for flag in $*
3900 do
3901 case "$flag" in
3902 -*) ftry="$flag";;
3903 *) ftry="$previous $flag";;
3904 esac
7bac28a0 3905 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
a4f3eea9 3906 >cpp1.out 2>/dev/null && \
dfe9444c 3907 $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
a4f3eea9 3908 >cpp2.out 2>/dev/null && \
3909 $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
3910 $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
3911 then
3912 cppflags="$cppflags $ftry"
3913 previous=''
3914 else
3915 previous="$flag"
3916 fi
3917 done
3918 set X $cppflags
3919 shift
3920 cppflags=${1+"$@"}
3921 case "$cppflags" in
3922 *-*) echo "They appear to be: $cppflags";;
3923 esac
3924 $rm -f cpp.c cpp?.out
3925 ;;
3926esac
3927
3928: flags used in final linking phase
a4f3eea9 3929case "$ldflags" in
3930'') if ./venix; then
3931 dflt='-i -z'
3932 else
3933 dflt=''
3934 fi
3935 case "$ccflags" in
3936 *-posix*) dflt="$dflt -posix" ;;
3937 esac
3938 ;;
3939*) dflt="$ldflags";;
3940esac
3941
3942: Try to guess additional flags to pick up local libraries.
3943for thislibdir in $libpth; do
3944 case " $loclibpth " in
3945 *" $thislibdir "*)
3946 case "$dflt " in
3947 *"-L$thislibdir "*) ;;
3948 *) dflt="$dflt -L$thislibdir" ;;
3949 esac
3950 ;;
3951 esac
3952done
3953
3954case "$dflt" in
3955'') dflt='none' ;;
3956esac
3957
3958$cat <<EOH
3959
3960Your C linker may need flags. For this question you should
3961include -L/whatever and any other flags used by the C linker, but you
3962should NOT include libraries like -lwhatever.
3963
3964Make sure you include the appropriate -L/path flags if your C linker
3965does not normally search all of the directories you specified above,
3966namely
3967 $libpth
3968To use no flags, specify the word "none".
3969
3970EOH
3971
3972rp="Any additional ld flags (NOT including libraries)?"
3973. ./myread
3974case "$ans" in
3975none) ldflags='';;
3976*) ldflags="$ans";;
3977esac
3978rmlist="$rmlist pdp11"
3979
3980: coherency check
3981echo " "
dfe9444c 3982echo "Checking your choice of C compiler and flags for coherency..." >&4
87563a30 3983set X $cc $optimize $ccflags -o try $ldflags try.c $libs
a4f3eea9 3984shift
3985$cat >try.msg <<EOM
3986I've tried to compile and run a simple program with:
3987
3988 $*
3989 ./try
3990
3991and I got the following output:
3992
3993EOM
3994$cat > try.c <<'EOF'
3995#include <stdio.h>
dfe9444c 3996main() { printf("Ok\n"); exit(0); }
a4f3eea9 3997EOF
3998dflt=y
28e8609d 3999if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
a4f3eea9 4000 if sh -c './try' >>try.msg 2>&1; then
dfe9444c
AD
4001 xxx=`./try`
4002 case "$xxx" in
4003 "Ok") dflt=n ;;
4004 *) echo 'The program compiled OK, but produced no output.' >> try.msg
4005 case " $libs " in
4006 *" -lsfio "*)
4007 cat >> try.msg <<'EOQS'
4008If $libs contains -lsfio, and sfio is mis-configured, then it
4009sometimes (apparently) runs and exits with a 0 status, but with no
4010output! It may have to do with sfio's use of _exit vs. exit.
4011
4012EOQS
4013 rp="You have a big problem. Shall I abort Configure"
4014 dflt=y
4015 ;;
4016 esac
4017 ;;
4018 esac
a4f3eea9 4019 else
4020 echo "The program compiled OK, but exited with status $?." >>try.msg
dfe9444c 4021 rp="You have a problem. Shall I abort Configure"
a4f3eea9 4022 dflt=y
4023 fi
4024else
4025 echo "I can't compile the test program." >>try.msg
dfe9444c 4026 rp="You have a BIG problem. Shall I abort Configure"
a4f3eea9 4027 dflt=y
4028fi
4029case "$dflt" in
4030y)
97286747 4031 $cat try.msg >&4
a4f3eea9 4032 case "$knowitall" in
4033 '')
4034 echo "(The supplied flags might be incorrect with this C compiler.)"
4035 ;;
4036 *) dflt=n;;
4037 esac
4038 echo " "
4039 . ./myread
4040 case "$ans" in
4041 n*|N*) ;;
4042 *) echo "Ok. Stopping Configure." >&4
4043 exit 1
4044 ;;
4045 esac
4046 ;;
4047n) echo "OK, that should do.";;
4048esac
4049$rm -f try try.* core
4050
bfb7748a
AD
4051: determine filename position in cpp output
4052echo " "
4053echo "Computing filename position in cpp output for #include directives..." >&4
4054echo '#include <stdio.h>' > foo.c
4055$cat >fieldn <<EOF
4056$startsh
4057$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4058$grep '^[ ]*#.*stdio\.h' | \
4059while read cline; do
4060 pos=1
4061 set \$cline
4062 while $test \$# -gt 0; do
4063 if $test -r \`echo \$1 | $tr -d '"'\`; then
4064 echo "\$pos"
4065 exit 0
4066 fi
4067 shift
4068 pos=\`expr \$pos + 1\`
4069 done
4070done
4071EOF
4072chmod +x fieldn
4073fieldn=`./fieldn`
4074$rm -f foo.c fieldn
4075case $fieldn in
4076'') pos='???';;
40771) pos=first;;
40782) pos=second;;
40793) pos=third;;
4080*) pos="${fieldn}th";;
4081esac
4082echo "Your cpp writes the filename in the $pos field of the line."
4083
4084: locate header file
4085$cat >findhdr <<EOF
4086$startsh
4087wanted=\$1
4088name=''
4089if test -f $usrinc/\$wanted; then
4090 echo "$usrinc/\$wanted"
4091 exit 0
4092fi
4093awkprg='{ print \$$fieldn }'
4094echo "#include <\$wanted>" > foo\$\$.c
4095$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4096$grep "^[ ]*#.*\$wanted" | \
4097while read cline; do
4098 name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4099 case "\$name" in
4100 */\$wanted) echo "\$name"; exit 0;;
4101 *) name='';;
4102 esac;
4103done;
4104$rm -f foo\$\$.c;
4105case "\$name" in
4106'') exit 1;;
4107esac
4108EOF
4109chmod +x findhdr
4110
4111: define an alternate in-header-list? function
4112inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4113cont=true; xxf="echo \"<\$1> found.\" >&4";
4114case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4115*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4116esac;
4117case $# in 4) instead=instead;; *) instead="at last";; esac;
4118while $test "$cont"; do
4119 xxx=`./findhdr $1`
4120 var=$2; eval "was=\$$2";
4121 if $test "$xxx" && $test -r "$xxx";
4122 then eval $xxf;
4123 eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4124 cont="";
4125 else eval $xxnf;
4126 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4127 set $yyy; shift; shift; yyy=$@;
4128 case $# in 0) cont="";;
4129 2) xxf="echo \"but I found <\$1> $instead.\" >&4";
4130 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
4131 *) xxf="echo \"but I found <\$1\> instead.\" >&4";
4132 xxnf="echo \"there is no <\$1>, ...\" >&4";;
4133 esac;
4134done;
4135while $test "$yyy";
4136do set $yyy; var=$2; eval "was=\$$2";
4137 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
4138 set $yyy; shift; shift; yyy=$@;
4139done'
4140
4141: see if this is a malloc.h system
4142set malloc.h i_malloc
4143eval $inhdr
4144
4145: see if stdlib is available
4146set stdlib.h i_stdlib
4147eval $inhdr
4148
4149: determine which malloc to compile in
4150echo " "
4151case "$usemymalloc" in
4152''|y*|true) dflt='y' ;;
4153n*|false) dflt='n' ;;
4154*) dflt="$usemymalloc" ;;
4155esac
4156rp="Do you wish to attempt to use the malloc that comes with $package?"
4157. ./myread
4158usemymalloc="$ans"
4159case "$ans" in
4160y*|true)
4161 usemymalloc='y'
4162 mallocsrc='malloc.c'
4163 mallocobj="malloc$_o"
4164 d_mymalloc="$define"
4165 case "$libs" in
4166 *-lmalloc*)
4167 : Remove malloc from list of libraries to use
4168 echo "Removing unneeded -lmalloc from library list" >&4
4169 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
4170 shift
4171 libs="$*"
4172 echo "libs = $libs" >&4
4173 ;;
4174 esac
4175 ;;
4176*)
4177 usemymalloc='n'
4178 mallocsrc=''
4179 mallocobj=''
4180 d_mymalloc="$undef"
4181 ;;
4182esac
4183
4184: compute the return types of malloc and free
4185echo " "
4186$cat >malloc.c <<END
4187#$i_malloc I_MALLOC
4188#$i_stdlib I_STDLIB
4189#include <stdio.h>
4190#include <sys/types.h>
4191#ifdef I_MALLOC
4192#include <malloc.h>
4193#endif
4194#ifdef I_STDLIB
4195#include <stdlib.h>
4196#endif
4197#ifdef TRY_MALLOC
4198void *malloc();
4199#endif
4200#ifdef TRY_FREE
4201void free();
4202#endif
4203END
4204case "$malloctype" in
4205'')
4206 if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
4207 malloctype='void *'
4208 else
4209 malloctype='char *'
4210 fi
4211 ;;
4212esac
4213echo "Your system wants malloc to return '$malloctype', it would seem." >&4
4214
4215case "$freetype" in
4216'')
4217 if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
4218 freetype='void'
4219 else
4220 freetype='int'
4221 fi
4222 ;;
4223esac
4224echo "Your system uses $freetype free(), it would seem." >&4
4225$rm -f malloc.[co]
c4f23d77
AD
4226: Cruising for prototypes
4227echo " "
4228echo "Checking out function prototypes..." >&4
4229$cat >prototype.c <<'EOCP'
4230main(int argc, char *argv[]) {
4231 exit(0);}
4232EOCP
4233if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
4234 echo "Your C compiler appears to support function prototypes."
4235 val="$define"
4236else
4237 echo "Your C compiler doesn't seem to understand function prototypes."
4238 val="$undef"
4239fi
4240set prototype
4241eval $setvar
4242$rm -f prototype*
4243
4244case "$prototype" in
4245"$define") ;;
4246*) ansi2knr='ansi2knr'
4247 echo " "
4248 cat <<EOM >&4
4249
4250$me: FATAL ERROR:
4251This version of $package can only be compiled by a compiler that
4252understands function prototypes. Unfortunately, your C compiler
4253 $cc $ccflags
4254doesn't seem to understand them. Sorry about that.
4255
4256If GNU cc is avaiable for your system, perhaps you could try that instead.
4257
4258Eventually, we hope to support building Perl with pre-ANSI compilers.
4259If you would like to help in that effort, please contact <perlbug@perl.org>.
4260
4261Aborting Configure now.
4262EOM
4263 exit 2
4264 ;;
4265esac
4266
4267: determine where public executables go
4268echo " "
4269set dflt bin bin
4270eval $prefixit
4271fn=d~
4272rp='Pathname where the public executables will reside?'
4273. ./getfile
4274if $test "X$ansexp" != "X$binexp"; then
4275 installbin=''
4276fi
4277bin="$ans"
4278binexp="$ansexp"
4279if $afs; then
4280 $cat <<EOM
4281
4282Since you are running AFS, I need to distinguish the directory in which
4283executables reside from the directory in which they are installed (and from
4284which they are presumably copied to the former directory by occult means).
4285
4286EOM
4287 case "$installbin" in
4288 '') dflt=`echo $binexp | sed 's#^/afs/#/afs/.#'`;;
4289 *) dflt="$installbin";;
4290 esac
4291 fn=de~
4292 rp='Where will public executables be installed?'
4293 . ./getfile
4294 installbin="$ans"
4295else
4296 installbin="$binexp"
4297fi
4298
dfe9444c
AD
4299: define a shorthand compile call
4300compile='
4301mc_file=$1;
4302shift;
c4f23d77 4303$cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
dc45a647
MB
4304: define a shorthand compile call for compilations that should be ok.
4305compile_ok='
4306mc_file=$1;
4307shift;
c4f23d77 4308$cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
dfe9444c 4309
a4f3eea9 4310echo " "
28e8609d
JH
4311echo "Determining whether or not we are on an EBCDIC system..." >&4
4312cat >tebcdic.c <<EOM
4313int main()
4314{
4315 if ('M'==0xd4) return 0;
4316 return 1;
4317}
4318EOM
93341792
AD
4319val=$undef
4320set tebcdic
4321if eval $compile_ok; then
4322 if ./tebcdic; then
4323 echo "You have EBCDIC." >&4
4324 val="$define"
4325 else
4326 echo "Nope, no EBCDIC. Assuming ASCII or some ISO Latin." >&4
4327 fi
28e8609d 4328else
93341792
AD
4329 echo "I'm unable to compile the test program." >&4
4330 echo "I'll asuume ASCII or some ISO Latin." >&4
28e8609d 4331fi
93341792 4332$rm -f tebcdic.c tebcdic
28e8609d
JH
4333set ebcdic
4334eval $setvar
4335
4336echo " "
a4f3eea9 4337echo "Checking for GNU C Library..." >&4
4338cat >gnulibc.c <<EOM
aebf16e7 4339#include <stdio.h>
a4f3eea9 4340int
4341main()
4342{
aebf16e7
AD
4343#ifdef __GLIBC__
4344 exit(0);
4345#else
4346 exit(1);
4347#endif
a4f3eea9 4348}
4349EOM
dfe9444c 4350set gnulibc
aebf16e7 4351if eval $compile_ok && ./gnulibc; then
a4f3eea9 4352 val="$define"
4353 echo "You are using the GNU C Library"
4633a7c4 4354else
a4f3eea9 4355 val="$undef"
4356 echo "You are not using the GNU C Library"
4633a7c4 4357fi
a4f3eea9 4358$rm -f gnulibc*
4359set d_gnulibc
4360eval $setvar
25f94b33 4361
a4f3eea9 4362: see if nm is to be used to determine whether a symbol is defined or not
4363case "$usenm" in
4364'')
dc45a647 4365 dflt=''
a4f3eea9 4366 case "$d_gnulibc" in
dc45a647
MB
4367 "$define")
4368 echo " "
4369 echo "nm probably won't work on the GNU C Library." >&4
a4f3eea9 4370 dflt=n
4371 ;;
dc45a647
MB
4372 esac
4373 case "$dflt" in
4374 '')
4375 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
4376 echo " "
4377 echo "Whoops! This is an AIX system without /lib/syscalls.exp!" >&4
4378 echo "'nm' won't be sufficient on this sytem." >&4
4379 dflt=n
4380 fi
4381 ;;
4382 esac
4383 case "$dflt" in
c4f23d77 4384 '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
a4f3eea9 4385 if $test $dflt -gt 20; then
4386 dflt=y
4387 else
4388 dflt=n
4389 fi
4390 ;;
4391 esac
4392 ;;
4393*)
4394 case "$usenm" in
dc45a647 4395 true|$define) dflt=y;;
a4f3eea9 4396 *) dflt=n;;
4397 esac
4398 ;;
25f94b33 4399esac
a4f3eea9 4400$cat <<EOM
4633a7c4 4401
dc45a647
MB
4402I can use $nm to extract the symbols from your C libraries. This
4403is a time consuming task which may generate huge output on the disk (up
4404to 3 megabytes) but that should make the symbols extraction faster. The
4405alternative is to skip the 'nm' extraction part and to compile a small
4406test program instead to determine whether each symbol is present. If
4407you have a fast C compiler and/or if your 'nm' output cannot be parsed,
4408this may be the best solution.
4409
4410You probably shouldn't let me use 'nm' if you are using the GNU C Library.
4633a7c4 4411
a4f3eea9 4412EOM
693762b4 4413rp="Shall I use $nm to extract C symbols from the libraries?"
4633a7c4
LW
4414. ./myread
4415case "$ans" in
dc45a647 4416[Nn]*) usenm=false;;
a4f3eea9 4417*) usenm=true;;
4633a7c4
LW
4418esac
4419
a4f3eea9 4420runnm=$usenm
4421case "$reuseval" in
4422true) runnm=false;;
4633a7c4 4423esac
a4f3eea9 4424
4425: nm options which may be necessary
4426case "$nm_opt" in
4427'') if $test -f /mach_boot; then
1e422769 4428 nm_opt='' # Mach
a4f3eea9 4429 elif $test -d /usr/ccs/lib; then
1e422769 4430 nm_opt='-p' # Solaris (and SunOS?)
a4f3eea9 4431 elif $test -f /dgux; then
1e422769 4432 nm_opt='-p' # DG-UX
2ae324a7 4433 elif $test -f /lib64/rld; then
1e422769 4434 nm_opt='-p' # 64-bit Irix
a4f3eea9 4435 else
4436 nm_opt=''
4437 fi;;
4633a7c4 4438esac
4633a7c4 4439
a4f3eea9 4440: nm options which may be necessary for shared libraries but illegal
4441: for archive libraries. Thank you, Linux.
4442case "$nm_so_opt" in
4443'') case "$myuname" in
4444 *linux*)
693762b4 4445 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
a4f3eea9 4446 nm_so_opt='--dynamic'
4633a7c4 4447 fi
a4f3eea9 4448 ;;
4633a7c4 4449 esac
4633a7c4
LW
4450 ;;
4451esac
4452
a4f3eea9 4453case "$runnm" in
4454true)
4455: get list of predefined functions in a handy place
4456echo " "
4457case "$libc" in
4458'') libc=unknown
4459 case "$libs" in
dfe9444c 4460 *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
a4f3eea9 4461 esac
4462 ;;
4463esac
4464libnames='';
4465case "$libs" in
4466'') ;;
4467*) for thislib in $libs; do
4468 case "$thislib" in
4469 -lc|-lc_s)
4470 : Handle C library specially below.
4471 ;;
4472 -l*)
4473 thislib=`echo $thislib | $sed -e 's/^-l//'`
4474 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
4475 :
4476 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
4477 :
dfe9444c 4478 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
a4f3eea9 4479 :
dfe9444c 4480 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
d97d40b5 4481 :
a4f3eea9 4482 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
4483 :
4484 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
4485 :
dfe9444c 4486 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
a4f3eea9 4487 :
4488 else
4489 try=''
4490 fi
4491 libnames="$libnames $try"
4492 ;;
4493 *) libnames="$libnames $thislib" ;;
4494 esac
4495 done
4496 ;;
4497esac
4498xxx=normal
4499case "$libc" in
4500unknown)
4501 set /lib/libc.$so
4502 for xxx in $libpth; do
4503 $test -r $1 || set $xxx/libc.$so
4504 : The messy sed command sorts on library version numbers.
4505 $test -r $1 || \
4506 set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
28e8609d 4507 tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
a4f3eea9 4508 h
4509 s/[0-9][0-9]*/0000&/g
4510 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
4511 G
4512 s/\n/ /' | \
dfe9444c 4513 sort | $sed -e 's/^.* //'`
a4f3eea9 4514 eval set \$$#
4515 done
4516 $test -r $1 || set /usr/ccs/lib/libc.$so
dfe9444c
AD
4517 $test -r $1 || set /lib/libsys_s$_a
4518 ;;
a4f3eea9 4519*)
4520 set blurfl
4521 ;;
4522esac
4523if $test -r "$1"; then
4524 echo "Your (shared) C library seems to be in $1."
4525 libc="$1"
4526elif $test -r /lib/libc && $test -r /lib/clib; then
4527 echo "Your C library seems to be in both /lib/clib and /lib/libc."
4528 xxx=apollo
4529 libc='/lib/clib /lib/libc'
4530 if $test -r /lib/syslib; then
4531 echo "(Your math library is in /lib/syslib.)"
4532 libc="$libc /lib/syslib"
4533 fi
4534elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4535 echo "Your C library seems to be in $libc, as you said before."
dfe9444c
AD
4536elif $test -r $incpath/usr/lib/libc$_a; then
4537 libc=$incpath/usr/lib/libc$_a;
a4f3eea9 4538 echo "Your C library seems to be in $libc. That's fine."
dfe9444c
AD
4539elif $test -r /lib/libc$_a; then
4540 libc=/lib/libc$_a;
a4f3eea9 4541 echo "Your C library seems to be in $libc. You're normal."
4542else
dfe9444c 4543 if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
a4f3eea9 4544 :
4545 elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
4546 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
4547 elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
4548 :
dfe9444c 4549 elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
a4f3eea9 4550 :
dfe9444c 4551 elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
a4f3eea9 4552 :
4633a7c4 4553 else
dfe9444c 4554 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
4633a7c4 4555 fi
a4f3eea9 4556 if $test -r "$tans"; then
4557 echo "Your C library seems to be in $tans, of all places."
4558 libc=$tans
4559 else
4560 libc='blurfl'
4561 fi
4562fi
4563if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4564 dflt="$libc"
4565 cat <<EOM
4633a7c4 4566
a4f3eea9 4567If the guess above is wrong (which it might be if you're using a strange
4568compiler, or your machine supports multiple models), you can override it here.
4633a7c4 4569
a4f3eea9 4570EOM
4571else
4572 dflt=''
28e8609d 4573 echo $libpth | tr ' ' $trnl | sort | uniq > libpath
a4f3eea9 4574 cat >&4 <<EOM
4575I can't seem to find your C library. I've looked in the following places:
4633a7c4 4576
a4f3eea9 4577EOM
4578 $sed 's/^/ /' libpath
4579 cat <<EOM
4633a7c4 4580
a4f3eea9 4581None of these seems to contain your C library. I need to get its name...
4633a7c4 4582
a4f3eea9 4583EOM
4584fi
4585fn=f
4586rp='Where is your C library?'
4587. ./getfile
4588libc="$ans"
4633a7c4 4589
4633a7c4 4590echo " "
28e8609d 4591echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
a4f3eea9 4592set X `cat libnames`
4633a7c4 4593shift
a4f3eea9 4594xxx=files
4595case $# in 1) xxx=file; esac
4596echo "Extracting names from the following $xxx for later perusal:" >&4
4597echo " "
4598$sed 's/^/ /' libnames >&4
4599echo " "
4600$echo $n "This may take a while...$c" >&4
4633a7c4 4601
dfe9444c
AD
4602for file in $*; do
4603 case $file in
693762b4
AD
4604 *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
4605 *) $nm $nm_opt $file 2>/dev/null;;
a4f3eea9 4606 esac
dfe9444c 4607done >libc.tmp
4633a7c4 4608
a4f3eea9 4609$echo $n ".$c"
4610$grep fprintf libc.tmp > libc.ptf
4611xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
4612xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
4613xxx='[ADTSIW]'
4614if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *_[_.]*//p' -e 's/^.* $xxx *//p'";\
4615 eval $xscan;\
4616 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4617 eval $xrun
4618elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
4619 eval $xscan;\
4620 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4621 eval $xrun
4622elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
4623 eval $xscan;\
4624 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4625 eval $xrun
4626elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
4627 eval $xscan;\
4628 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4629 eval $xrun
4630elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
4631 eval $xscan;\
4632 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4633 eval $xrun
4634elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
4635 eval $xscan;\
4636 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4637 eval $xrun
4638elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
4639 -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
4640 eval $xscan;\
4641 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4642 eval $xrun
4643elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
4644 eval $xscan;\
4645 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4646 eval $xrun
4647elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
4648 eval $xscan;\
4649 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4650 eval $xrun
1e422769 4651elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
4652 eval $xscan;\
4653 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4654 eval $xrun
a4f3eea9 4655elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
4656 eval $xscan;\
4657 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4658 eval $xrun
4659elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
4660 eval $xscan;\
4661 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4662 eval $xrun
44a8e56a 4663elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
4664 eval $xscan;\
4665 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4666 eval $xrun
a4f3eea9 4667else
693762b4 4668 $nm -p $* 2>/dev/null >libc.tmp
a4f3eea9 4669 $grep fprintf libc.tmp > libc.ptf
4670 if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
4671 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
4672 then
4673 nm_opt='-p'
4674 eval $xrun
4633a7c4 4675 else
a4f3eea9 4676 echo " "
e5c9fcd0 4677 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
a4f3eea9 4678 com=''
dc45a647
MB
4679 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
4680 for thisname in $libnames $libc; do
e5c9fcd0 4681 $ar t $thisname >>libc.tmp
a4f3eea9 4682 done
dfe9444c 4683 $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
a4f3eea9 4684 echo "Ok." >&4
dc45a647
MB
4685 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
4686 # Repeat libc to extract forwarders to DLL entries too
4687 for thisname in $libnames $libc; do
4688 $ar tv $thisname >>libc.tmp
4689 # Revision 50 of EMX has bug in $ar.
4690 # it will not extract forwarders to DLL entries
4691 # Use emximp which will extract exactly them.
4692 emximp -o tmp.imp $thisname \
4693 2>/dev/null && \
4694 $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
4695 < tmp.imp >>libc.tmp
4696 $rm tmp.imp
4697 done
4698 $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
4699 echo "Ok." >&4
a4f3eea9 4700 else
e5c9fcd0 4701 echo "$ar didn't seem to work right." >&4
a4f3eea9 4702 echo "Maybe this is a Cray...trying bld instead..." >&4
dfe9444c 4703 if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
a4f3eea9 4704 then
4705 for thisname in $libnames; do
4706 bld t $libnames | \
dfe9444c 4707 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
e5c9fcd0 4708 $ar t $thisname >>libc.tmp
a4f3eea9 4709 done
4710 echo "Ok." >&4
4711 else
4712 echo "That didn't work either. Giving up." >&4
4713 exit 1
4714 fi
4715 fi
4633a7c4 4716 fi
4633a7c4 4717fi
a4f3eea9 4718nm_extract="$com"
4719if $test -f /lib/syscalls.exp; then
4633a7c4 4720 echo " "
a4f3eea9 4721 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
4722 $sed -n 's/^\([^ ]*\)[ ]*syscall$/\1/p' /lib/syscalls.exp >>libc.list
4723fi
4724;;
4725esac
4726$rm -f libnames libpath
4727
2afac517 4728: see if dld is available
4729set dld.h i_dld
4730eval $inhdr
4633a7c4 4731
2afac517 4732: is a C symbol defined?
4733csym='tlook=$1;
4734case "$3" in
4735-v) tf=libc.tmp; tc=""; tdc="";;
4736-a) tf=libc.tmp; tc="[0]"; tdc="[]";;
4737*) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
4738esac;
4739tx=yes;
4740case "$reuseval-$4" in
4741true-) ;;
4742true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
4743esac;
4744case "$tx" in
4745yes)
4746 case "$runnm" in
4747 true)
4748 if $contains $tlook $tf >/dev/null 2>&1;
4749 then tval=true;
4750 else tval=false;
4751 fi;;
4752 *)
4753 echo "main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
dfe9444c 4754 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
2afac517 4755 then tval=true;
4756 else tval=false;
4757 fi;
4758 $rm -f t t.c;;
4759 esac;;
4760*)
4761 case "$tval" in
4762 $define) tval=true;;
4763 *) tval=false;;
4764 esac;;
4765esac;
4766eval "$2=$tval"'
4633a7c4 4767
2afac517 4768: define an is-in-libc? function
4769inlibc='echo " "; td=$define; tu=$undef;
4770sym=$1; var=$2; eval "was=\$$2";
4771tx=yes;
4772case "$reuseval$was" in
4773true) ;;
4774true*) tx=no;;
4775esac;
4776case "$tx" in
4777yes)
4778 set $sym tres -f;
4779 eval $csym;
4780 case "$tres" in
4781 true)
4782 echo "$sym() found." >&4;
4783 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
4784 *)
4785 echo "$sym() NOT found." >&4;
4786 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
4787 esac;;
4788*)
4789 case "$was" in
4790 $define) echo "$sym() found." >&4;;
4791 *) echo "$sym() NOT found." >&4;;
4792 esac;;
4793esac'
4633a7c4 4794
2afac517 4795: see if dlopen exists
4796xxx_runnm="$runnm"
4797runnm=false
4798set dlopen d_dlopen
4799eval $inlibc
4800runnm="$xxx_runnm"
40a7a20a 4801
2afac517 4802: determine which dynamic loading, if any, to compile in
4633a7c4 4803echo " "
2afac517 4804dldir="ext/DynaLoader"
4805case "$usedl" in
4806$define|y|true)
4807 dflt='y'
4808 usedl="$define"
4809 ;;
4810$undef|n|false)
4811 dflt='n'
4812 usedl="$undef"
4813 ;;
4814*)
4815 dflt='n'
4816 case "$d_dlopen" in
4817 $define) dflt='y' ;;
4818 esac
4819 case "$i_dld" in
4820 $define) dflt='y' ;;
4633a7c4 4821 esac
2afac517 4822 : Does a dl_xxx.xs file exist for this operating system
dc45a647 4823 $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
4633a7c4
LW
4824 ;;
4825esac
2afac517 4826rp="Do you wish to use dynamic loading?"
4827. ./myread
4828usedl="$ans"
4829case "$ans" in
4830y*) usedl="$define"
4831 case "$dlsrc" in
4832 '')
dc45a647 4833 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
2afac517 4834 dflt="$dldir/dl_${osname}.xs"
4835 elif $test "$d_dlopen" = "$define" ; then
4836 dflt="$dldir/dl_dlopen.xs"
4837 elif $test "$i_dld" = "$define" ; then
4838 dflt="$dldir/dl_dld.xs"
4633a7c4 4839 else
2afac517 4840 dflt=''
4633a7c4 4841 fi
4633a7c4 4842 ;;
2afac517 4843 *) dflt="$dldir/$dlsrc"
4844 ;;
4633a7c4 4845 esac
2afac517 4846 echo "The following dynamic loading files are available:"
4847 : Can not go over to $dldir because getfile has path hard-coded in.
dc45a647
MB
4848 tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
4849 rp="Source file to use for dynamic loading"
4850 fn="fne"
4851 # XXX This getfile call will fail the existence check if you try
4852 # building away from $src (this is not supported yet).
4853 . ./getfile
2afac517 4854 usedl="$define"
4855 : emulate basename
4856 dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'`
2304df62 4857
dc45a647 4858 $cat << EOM
2304df62 4859
2afac517 4860Some systems may require passing special flags to $cc -c to
4861compile modules that will be used to create a shared library.
4862To use no flags, say "none".
2304df62
AD
4863
4864EOM
2afac517 4865 case "$cccdlflags" in
4866 '') case "$gccversion" in
4867 '') case "$osname" in
4868 hpux) dflt='+z' ;;
4869 next) dflt='none' ;;
8cc95fdb 4870 irix*) dflt='-KPIC' ;;
3a6175e1 4871 svr4*|esix*|solaris) dflt='-KPIC' ;;
2afac517 4872 sunos) dflt='-pic' ;;
4873 *) dflt='none' ;;
dfe9444c
AD
4874 esac
4875 ;;
4876 *) case "$osname" in
3a6175e1 4877 svr4*|esix*|solaris) dflt='-fPIC' ;;
dfe9444c 4878 *) dflt='-fpic' ;;
81d89818 4879 esac ;;
2afac517 4880 esac ;;
bfb7748a 4881 ' ') dflt='none' ;;
2afac517 4882 *) dflt="$cccdlflags" ;;
4883 esac
4884 rp="Any special flags to pass to $cc -c to compile shared library modules?"
4885 . ./myread
4886 case "$ans" in
4887 none) cccdlflags=' ' ;;
4888 *) cccdlflags="$ans" ;;
4889 esac
2304df62 4890
2afac517 4891 cat << EOM
ecfc5424 4892
2afac517 4893Some systems use ld to create libraries that can be dynamically loaded,
4894while other systems (such as those using ELF) use $cc.
a0f45b59 4895
2afac517 4896EOM
4897 case "$ld" in
4898 '') $cat >try.c <<'EOM'
4899/* Test for whether ELF binaries are produced */
4900#include <fcntl.h>
4901#include <stdlib.h>
4902main() {
4903 char b[4];
4904 int i = open("a.out",O_RDONLY);
4905 if(i == -1)
4906 exit(1); /* fail */
4907 if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
4908 exit(0); /* succeed (yes, it's ELF) */
2304df62 4909 else
2afac517 4910 exit(1); /* fail */
4911}
4912EOM
4913 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
4914 cat <<EOM
4915You appear to have ELF support. I'll use $cc to build dynamic libraries.
4916EOM
4917 dflt="$cc"
2304df62 4918 else
2afac517 4919 echo "I'll use ld to build dynamic libraries."
4920 dflt='ld'
2304df62 4921 fi
2afac517 4922 rm -f try.c a.out
4923 ;;
4924 *) dflt="$ld"
4925 ;;
4926 esac
4927
4928 rp="What command should be used to create dynamic libraries?"
4929 . ./myread
4930 ld="$ans"
4931
4932 cat << EOM
4933
4934Some systems may require passing special flags to $ld to create a
4935library that can be dynamically loaded. If your ld flags include
4936-L/other/path options to locate libraries outside your loader's normal
4937search path, you may need to specify those -L options here as well. To
4938use no flags, say "none".
4939
4940EOM
4941 case "$lddlflags" in
4942 '') case "$osname" in
4943 hpux) dflt='-b' ;;
4944 linux|irix*) dflt='-shared' ;;
4945 next) dflt='none' ;;
4946 solaris) dflt='-G' ;;
4947 sunos) dflt='-assert nodefinitions' ;;
4948 svr4*|esix*) dflt="-G $ldflags" ;;
4949 *) dflt='none' ;;
4950 esac
4951 ;;
4952 *) dflt="$lddlflags" ;;
4953 esac
4954
bfb7748a
AD
4955 : Try to guess additional flags to pick up local libraries.
4956 for thisflag in $ldflags; do
4957 case "$thisflag" in
4958 -L*)
4959 case " $dflt " in
4960 *" $thisflag "*) ;;
4961 *) dflt="$dflt $thisflag" ;;
4962 esac
4963 ;;
2afac517 4964 esac
bfb7748a 4965 done
2afac517 4966
bfb7748a
AD
4967 case "$dflt" in
4968 ''|' ') dflt='none' ;;
4969 esac
2afac517 4970
4971 rp="Any special flags to pass to $ld to create a dynamically loaded library?"
4972 . ./myread
4973 case "$ans" in
4974 none) lddlflags=' ' ;;
4975 *) lddlflags="$ans" ;;
4976 esac
4977
4978 cat <<EOM
4979
4980Some systems may require passing special flags to $cc to indicate that
4981the resulting executable will use dynamic linking. To use no flags,
4982say "none".
4983
4984EOM
4985 case "$ccdlflags" in
4986 '') case "$osname" in
4987 hpux) dflt='-Wl,-E' ;;
4988 linux) dflt='-rdynamic' ;;
4989 next) dflt='none' ;;
4990 sunos) dflt='none' ;;
4991 *) dflt='none' ;;
4992 esac ;;
bfb7748a 4993 ' ') dflt='none' ;;
2afac517 4994 *) dflt="$ccdlflags" ;;
4995 esac
4996 rp="Any special flags to pass to $cc to use dynamic loading?"
4997 . ./myread
4998 case "$ans" in
4999 none) ccdlflags=' ' ;;
5000 *) ccdlflags="$ans" ;;
5001 esac
5002 ;;
5003*) usedl="$undef"
5004 ld='ld'
5005 dlsrc='dl_none.xs'
5006 lddlflags=''
5007 ccdlflags=''
5008 ;;
5009esac
5010
5011also=''
5012case "$usedl" in
5013$undef)
5014 # No dynamic loading being used, so don't bother even to prompt.
5015 useshrplib='false'
5016 ;;
5017*) case "$useshrplib" in
5018 '') case "$osname" in
2ae324a7 5019 svr4*|dgux|dynixptx|esix|powerux)
3e3baf6d 5020 dflt=y
2afac517 5021 also='Building a shared libperl is required for dynamic loading to work on your system.'
5022 ;;
5023 next*)
5024 case "$osvers" in
3e3baf6d 5025 4*) dflt=y
2afac517 5026 also='Building a shared libperl is needed for MAB support.'
5027 ;;
3e3baf6d 5028 *) dflt=n
2afac517 5029 ;;
5030 esac
5031 ;;
3e3baf6d 5032 *) dflt=n
2afac517 5033 ;;
5034 esac
5035 ;;
5036 $define|true|[Yy]*)
3e3baf6d 5037 dflt=y
2afac517 5038 ;;
3e3baf6d 5039 *) dflt=n
2afac517 5040 ;;
5041 esac
5042 $cat << EOM
5043
5044The perl executable is normally obtained by linking perlmain.c with
dfe9444c 5045libperl${_a}, any static extensions (usually just DynaLoader), and
2afac517 5046any other libraries needed on this system (such as -lm, etc.). Since
5047your system supports dynamic loading, it is probably possible to build
5048a shared libperl.$so. If you will have more than one executable linked
5049to libperl.$so, this will significantly reduce the size of each
5050executable, but it may have a noticeable affect on performance. The
5051default is probably sensible for your system.
5052$also
5053
5054EOM
5055 rp="Build a shared libperl.$so (y/n)"
5056 . ./myread
5057 case "$ans" in
5058 true|$define|[Yy]*)
5059 useshrplib='true'
5060 # Why does next4 have to be so different?
5061 case "${osname}${osvers}" in
5062 next4*) xxx='DYLD_LIBRARY_PATH' ;;
dc45a647 5063 os2*) xxx='' ;; # Nothing special needed.
2afac517 5064 *) xxx='LD_LIBRARY_PATH' ;;
5065 esac
dc45a647
MB
5066 if test X"$xxx" != "X"; then
5067 $cat <<EOM | $tee -a ../config.msg >&4
2afac517 5068
5069To build perl, you must add the current working directory to your
693762b4 5070$xxx environment variable before running make. You can do
2afac517 5071this with
5072 $xxx=\`pwd\`; export $xxx
5073for Bourne-style shells, or
5074 setenv $xxx \`pwd\`
5075for Csh-style shells. You *MUST* do this before running make.
5076
5077EOM
dc45a647 5078 fi
2afac517 5079 ;;
5080 *) useshrplib='false' ;;
5081 esac
5082 ;;
5083esac
5084
5085case "$useshrplib" in
5086true)
5087 case "$libperl" in
5088 '')
5089 # Figure out a good name for libperl.so. Since it gets stored in
5090 # a version-specific architecture-dependent library, the version
5091 # number isn't really that important, except for making cc/ld happy.
5092 #
5093 # A name such as libperl.so.3.1
5094 majmin="libperl.$so.$patchlevel.$subversion"
5095 # A name such as libperl.so.301
5096 majonly=`echo $patchlevel $subversion |
5097 $awk '{printf "%d%02d", $1, $2}'`
5098 majonly=libperl.$so.$majonly
5099 # I'd prefer to keep the os-specific stuff here to a minimum, and
5100 # rely on figuring it out from the naming of libc.
5101 case "${osname}${osvers}" in
5102 next4*)
5103 dflt=libperl.5.$so
5104 # XXX How handle the --version stuff for MAB?
5105 ;;
5106 linux*) # ld won't link with a bare -lperl otherwise.
5107 dflt=libperl.$so
5108 ;;
5109 *) # Try to guess based on whether libc has major.minor.
5110 case "$libc" in
5111 *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
5112 *libc.$so.[0-9]*) dflt=$majonly ;;
5113 *) dflt=libperl.$so ;;
5114 esac
5115 ;;
5116 esac
5117 ;;
5118 *) dflt=$libperl
5119 ;;
5120 esac
5121 cat << EOM
5122
5123I need to select a good name for the shared libperl. If your system uses
5124library names with major and minor numbers, then you might want something
5125like $majmin. Alternatively, if your system uses a single version
5126number for shared libraries, then you might want to use $majonly.
5127Or, your system might be quite happy with a simple libperl.$so.
5128
5129Since the shared libperl will get installed into a version-specific
5130architecture-dependent directory, the version number of the shared perl
5131library probably isn't important, so the default should be o.k.
5132
5133EOM
5134 rp='What name do you want to give to the shared libperl?'
5135 . ./myread
5136 libperl=$ans
5137 echo "Ok, I'll use $libperl"
5138 ;;
5139*)
dfe9444c 5140 libperl="libperl${_a}"
2afac517 5141 ;;
5142esac
5143
5144# Detect old use of shrpdir via undocumented Configure -Dshrpdir
5145case "$shrpdir" in
5146'') ;;
5147*) $cat >&4 <<EOM
5148WARNING: Use of the shrpdir variable for the installation location of
5149the shared $libperl is not supported. It was never documented and
bfb7748a 5150will not work in this version. Let me (doughera@lafayette.edu)
dfe9444c 5151know of any problems this may cause.
2afac517 5152
5153EOM
5154 case "$shrpdir" in
5155 "$archlibexp/CORE")
5156 $cat >&4 <<EOM
5157But your current setting of $shrpdir is
5158the default anyway, so it's harmless.
5159EOM
5160 ;;
5161 *)
4e2a5f63
AD
5162 $cat >&4 <<EOM
5163Further, your current attempted setting of $shrpdir
5164conflicts with the value of $archlibexp/CORE
5165that installperl will use.
5166EOM
dc45a647
MB
5167 ;;
5168 esac
5169 ;;
5170esac
5171
5172# How will the perl executable find the installed shared $libperl?
5173# Add $xxx to ccdlflags.
5174# If we can't figure out a command-line option, use $shrpenv to
5175# set env LD_RUN_PATH. The main perl makefile uses this.
5176shrpdir=$archlibexp/CORE
5177xxx=''
5178tmp_shrpenv=''
5179if "$useshrplib"; then
5180 case "$osname" in
5181 aix)
5182 # We'll set it in Makefile.SH...
5183 ;;
5184 solaris|netbsd)
5185 xxx="-R $shrpdir"
5186 ;;
5187 freebsd)
5188 xxx="-Wl,-R$shrpdir"
5189 ;;
5190 linux|irix*|dec_osf)
5191 xxx="-Wl,-rpath,$shrpdir"
5192 ;;
5193 next)
5194 # next doesn't like the default...
5195 ;;
5196 *)
5197 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
5198 ;;
5199 esac
5200 case "$xxx" in
5201 '') ;;
5202 *)
5203 # Only add $xxx if it isn't already in ccdlflags.
5204 case " $ccdlflags " in
5205 *" $xxx "*) ;;
5206 *) ccdlflags="$ccdlflags $xxx"
5207 cat <<EOM >&4
5208
5209Adding $xxx to the flags
5210passed to $ld so that the perl executable will find the
5211installed shared $libperl.
5212
5213EOM
5214 ;;
5215 esac
5216 ;;
5217 esac
5218fi
5219# Respect a hint or command-line value.
5220case "$shrpenv" in
5221'') shrpenv="$tmp_shrpenv" ;;
5222esac
5223
5224: determine where manual pages go
5225set man1dir man1dir none
5226eval $prefixit
5227$cat <<EOM
5228
5229$spackage has manual pages available in source form.
5230EOM
5231case "$nroff" in
5232nroff)
5233 echo "However, you don't have nroff, so they're probably useless to you."
5234 case "$man1dir" in
5235 '') man1dir="none";;
5236 esac;;
5237esac
5238echo "If you don't want the manual sources installed, answer 'none'."
5239case "$man1dir" in
5240' ') dflt=none
5241 ;;
5242'')
5243 lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
5244 lookpath="$lookpath $prefixexp/man/p_man/man1"
5245 lookpath="$lookpath $prefixexp/man/u_man/man1"
5246 lookpath="$lookpath $prefixexp/man/man.1"
5247 case "$sysman" in
5248 */?_man*) dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
5249 *) dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
5250 esac
5251 set dflt
5252 eval $prefixup
5253 ;;
5254*) dflt="$man1dir"
5255 ;;
5256esac
5257echo " "
5258fn=dn+~
5259rp="Where do the main $spackage manual pages (source) go?"
5260. ./getfile
5261if $test "X$man1direxp" != "X$ansexp"; then
5262 installman1dir=''
5263fi
5264man1dir="$ans"
5265man1direxp="$ansexp"
5266case "$man1dir" in
5267'') man1dir=' '
5268 installman1dir='';;
5269esac
5270if $afs; then
5271 $cat <<EOM
5272
5273Since you are running AFS, I need to distinguish the directory in which
5274manual pages reside from the directory in which they are installed (and from
5275which they are presumably copied to the former directory by occult means).
5276
5277EOM
5278 case "$installman1dir" in
5279 '') dflt=`echo $man1direxp | sed 's#^/afs/#/afs/.#'`;;
5280 *) dflt="$installman1dir";;
5281 esac
5282 fn=de~
5283 rp='Where will man pages be installed?'
5284 . ./getfile
5285 installman1dir="$ans"
5286else
5287 installman1dir="$man1direxp"
5288fi
5289
5290: What suffix to use on installed man pages
5291
5292case "$man1dir" in
5293' ')
5294 man1ext='0'
5295 ;;
5296*)
5297 rp="What suffix should be used for the main $spackage man pages?"
5298 case "$man1ext" in
5299 '') case "$man1dir" in
5300 *1) dflt=1 ;;
5301 *1p) dflt=1p ;;
5302 *1pm) dflt=1pm ;;
5303 *l) dflt=l;;
5304 *n) dflt=n;;
5305 *o) dflt=o;;
5306 *p) dflt=p;;
5307 *C) dflt=C;;
5308 *L) dflt=L;;
5309 *L1) dflt=L1;;
5310 *) dflt=1;;
5311 esac
5312 ;;
5313 *) dflt="$man1ext";;
5314 esac
5315 . ./myread
5316 man1ext="$ans"
5317 ;;
5318esac
5319
5320: see if we can have long filenames
5321echo " "
5322rmlist="$rmlist /tmp/cf$$"
5323$test -d /tmp/cf$$ || mkdir /tmp/cf$$
5324first=123456789abcdef
5325second=/tmp/cf$$/$first
5326$rm -f $first $second
5327if (echo hi >$first) 2>/dev/null; then
5328 if $test -f 123456789abcde; then
5329 echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4
5330 val="$undef"
5331 else
5332 if (echo hi >$second) 2>/dev/null; then
5333 if $test -f /tmp/cf$$/123456789abcde; then
5334 $cat <<'EOM'
5335That's peculiar... You can have filenames longer than 14 characters, but only
5336on some of the filesystems. Maybe you are using NFS. Anyway, to avoid problems
5337I shall consider your system cannot support long filenames at all.
5338EOM
5339 val="$undef"
5340 else
5341 echo 'You can have filenames longer than 14 characters.' >&4
5342 val="$define"
5343 fi
5344 else
5345 $cat <<'EOM'
5346How confusing! Some of your filesystems are sane enough to allow filenames
5347longer than 14 characters but some others like /tmp can't even think about them.
5348So, for now on, I shall assume your kernel does not allow them at all.
5349EOM
5350 val="$undef"
5351 fi
5352 fi
5353else
5354 $cat <<'EOM'
5355You can't have filenames longer than 14 chars. You can't even think about them!
5356EOM
5357 val="$undef"
5358fi
5359set d_flexfnam
5360eval $setvar
5361$rm -rf /tmp/cf$$ 123456789abcde*
5362
5363: determine where library module manual pages go
5364set man3dir man3dir none
5365eval $prefixit
5366$cat <<EOM
5367
5368$spackage has manual pages for many of the library modules.
5369EOM
5370
5371case "$nroff" in
5372nroff)
5373 $cat <<'EOM'
5374However, you don't have nroff, so they're probably useless to you.
5375EOM
5376 case "$man3dir" in
5377 '') man3dir="none";;
5378 esac;;
5379esac
5380
5381case "$d_flexfnam" in
5382undef)
5383 $cat <<'EOM'
5384However, your system can't handle the long file names like File::Basename.3.
5385EOM
5386 case "$man3dir" in
5387 '') man3dir="none";;
5388 esac;;
5389esac
5390
5391echo "If you don't want the manual sources installed, answer 'none'."
5392prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5393case "$man3dir" in
5394'') case "$prefix" in
5395 *$prog*) dflt=`echo $man1dir |
5396 $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'` ;;
5397 *) dflt="$privlib/man/man3" ;;
2afac517 5398 esac
5399 ;;
dc45a647
MB
5400' ') dflt=none;;
5401*) dflt="$man3dir" ;;
2afac517 5402esac
dc45a647 5403echo " "
2afac517 5404
dc45a647
MB
5405fn=dn+~
5406rp="Where do the $package library man pages (source) go?"
5407. ./getfile
5408if test "X$man3direxp" != "X$ansexp"; then
5409 installman3dir=''
5410fi
2afac517 5411
dc45a647
MB
5412man3dir="$ans"
5413man3direxp="$ansexp"
5414case "$man3dir" in
5415'') man3dir=' '
5416 installman3dir='';;
5417esac
5418if $afs; then
5419 $cat <<EOM
5420
5421Since you are running AFS, I need to distinguish the directory in which
5422manual pages reside from the directory in which they are installed (and from
5423which they are presumably copied to the former directory by occult means).
2afac517 5424
4e2a5f63 5425EOM
dc45a647
MB
5426 case "$installman3dir" in
5427 '') dflt=`echo $man3direxp | sed 's#^/afs/#/afs/.#'`;;
5428 *) dflt="$installman3dir";;
5429 esac
5430 fn=de~
5431 rp='Where will man pages be installed?'
5432 . ./getfile
5433 installman3dir="$ans"
5434else
5435 installman3dir="$man3direxp"
5436fi
5437
5438: What suffix to use on installed man pages
5439
5440case "$man3dir" in
5441' ')
5442 man3ext='0'
5443 ;;
5444*)
5445 rp="What suffix should be used for the $package library man pages?"
5446 case "$man3ext" in
5447 '') case "$man3dir" in
5448 *3) dflt=3 ;;
5449 *3p) dflt=3p ;;
5450 *3pm) dflt=3pm ;;
5451 *l) dflt=l;;
5452 *n) dflt=n;;
5453 *o) dflt=o;;
5454 *p) dflt=p;;
5455 *C) dflt=C;;
5456 *L) dflt=L;;
5457 *L3) dflt=L3;;
5458 *) dflt=3;;
2afac517 5459 esac
5460 ;;
dc45a647 5461 *) dflt="$man3ext";;
2afac517 5462 esac
dc45a647
MB
5463 . ./myread
5464 man3ext="$ans"
5465 ;;
2afac517 5466esac
5467
5468: see if we have to deal with yellow pages, now NIS.
5469if $test -d /usr/etc/yp || $test -d /etc/yp; then
5470 if $test -f /usr/etc/nibindd; then
5471 echo " "
5472 echo "I'm fairly confident you're on a NeXT."
5473 echo " "
5474 rp='Do you get the hosts file via NetInfo?'
5475 dflt=y
5476 case "$hostcat" in
5477 nidump*) ;;
5478 '') ;;
5479 *) dflt=n;;
5480 esac
5481 . ./myread
5482 case "$ans" in
5483 y*) hostcat='nidump hosts .';;
5484 *) case "$hostcat" in
5485 nidump*) hostcat='';;
5486 esac
5487 ;;
5488 esac
5489 fi
5490 case "$hostcat" in
5491 nidump*) ;;
5492 *)
5493 case "$hostcat" in
5494 *ypcat*) dflt=y;;
5495 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
5496 dflt=y
5497 else
5498 dflt=n
5499 fi;;
5500 *) dflt=n;;
5501 esac
5502 echo " "
5503 rp='Are you getting the hosts file via yellow pages?'
5504 . ./myread
5505 case "$ans" in
5506 y*) hostcat='ypcat hosts';;
5507 *) hostcat='cat /etc/hosts';;
5508 esac
5509 ;;
5510 esac
5511fi
dfe9444c
AD
5512case "$hostcat" in
5513'') hostcat='cat /etc/hosts';;
5514esac
5515case "$groupcat" in
5516'') groupcat='cat /etc/group';;
5517esac
5518case "$passcat" in
5519'') passcat='cat /etc/passwd';;
5520esac
2afac517 5521
5522: now get the host name
5523echo " "
5524echo "Figuring out host name..." >&4
5525case "$myhostname" in
5526'') cont=true
5527 echo 'Maybe "hostname" will work...'
5528 if tans=`sh -c hostname 2>&1` ; then
5529 myhostname=$tans
5530 phostname=hostname
5531 cont=''
5532 fi
5533 ;;
5534*) cont='';;
5535esac
5536if $test "$cont"; then
5537 if ./xenix; then
5538 echo 'Oh, dear. Maybe "/etc/systemid" is the key...'
5539 if tans=`cat /etc/systemid 2>&1` ; then
5540 myhostname=$tans
5541 phostname='cat /etc/systemid'
5542 echo "Whadyaknow. Xenix always was a bit strange..."
5543 cont=''
5544 fi
5545 elif $test -r /etc/systemid; then
5546 echo "(What is a non-Xenix system doing with /etc/systemid?)"
5547 fi
5548fi
5549if $test "$cont"; then
5550 echo 'No, maybe "uuname -l" will work...'
5551 if tans=`sh -c 'uuname -l' 2>&1` ; then
5552 myhostname=$tans
5553 phostname='uuname -l'
5554 else
5555 echo 'Strange. Maybe "uname -n" will work...'
5556 if tans=`sh -c 'uname -n' 2>&1` ; then
5557 myhostname=$tans
5558 phostname='uname -n'
5559 else
5560 echo 'Oh well, maybe I can mine it out of whoami.h...'
5561 if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
5562 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
5563 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
5564 else
5565 case "$myhostname" in
5566 '') echo "Does this machine have an identity crisis or something?"
5567 phostname='';;
5568 *)
5569 echo "Well, you said $myhostname before..."
5570 phostname='echo $myhostname';;
5571 esac
5572 fi
5573 fi
5574 fi
5575fi
5576: you do not want to know about this
5577set $myhostname
5578myhostname=$1
5579
5580: verify guess
5581if $test "$myhostname" ; then
5582 dflt=y
5583 rp='Your host name appears to be "'$myhostname'".'" Right?"
5584 . ./myread
5585 case "$ans" in
5586 y*) ;;
5587 *) myhostname='';;
5588 esac
5589fi
5590
5591: bad guess or no guess
5592while $test "X$myhostname" = X ; do
5593 dflt=''
5594 rp="Please type the (one word) name of your host:"
5595 . ./myread
5596 myhostname="$ans"
5597done
5598
5599: translate upper to lower if necessary
5600case "$myhostname" in
5601*[A-Z]*)
5602 echo "(Normalizing case in your host name)"
5603 myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
5604 ;;
5605esac
5606
5607case "$myhostname" in
5608*.*)
5609 dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
5610 myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
5611 echo "(Trimming domain name from host name--host name is now $myhostname)"
5612 ;;
5613*) case "$mydomain" in
5614 '')
5615 {
2afac517 5616 test "X$hostcat" = "Xypcat hosts" &&
5617 ypmatch "$myhostname" hosts 2>/dev/null |\
5618 $sed -e 's/[ ]*#.*//; s/$/ /' > hosts && \
5619 $test -s hosts
5620 } || {
2afac517 5621 $hostcat | $sed -n -e "s/[ ]*#.*//; s/\$/ /
5622 /[ ]$myhostname[ . ]/p" > hosts
5623 }
5624 tmp_re="[ . ]"
5625 $test x`$awk "/[0-9].*[ ]$myhostname$tmp_re/ { sum++ }
5626 END { print sum }" hosts` = x1 || tmp_re="[ ]"
5627 dflt=.`$awk "/[0-9].*[ ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
5628 hosts | $sort | $uniq | \
5629 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
5630 case `$echo X$dflt` in
5631 X*\ *) echo "(Several hosts in /etc/hosts matched hostname)"
5632 dflt=.
5633 ;;
5634 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
5635 ;;
5636 esac
5637 case "$dflt" in
5638 .)
5639 tans=`./loc resolv.conf X /etc /usr/etc`
5640 if $test -f "$tans"; then
5641 echo "(Attempting domain name extraction from $tans)"
a6006777 5642 dflt=.`$sed -n -e 's/ / /g' \
28757baa 5643 -e 's/^search *\([^ ]*\).*/\1/p' $tans \
a6006777 5644 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
2afac517 5645 case "$dflt" in
a6006777 5646 .) dflt=.`$sed -n -e 's/ / /g' \
28757baa 5647 -e 's/^domain *\([^ ]*\).*/\1/p' $tans \
a6006777 5648 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
774d564b 5649 ;;
2afac517 5650 esac
5651 fi
5652 ;;
5653 esac
5654 case "$dflt" in
5655 .) echo "(No help from resolv.conf either -- attempting clever guess)"
5656 dflt=.`sh -c domainname 2>/dev/null`
5657 case "$dflt" in
5658 '') dflt='.';;
5659 .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
5660 esac
5661 ;;
5662 esac
5663 case "$dflt" in
5664 .) echo "(Lost all hope -- silly guess then)"
5665 dflt='.uucp'
5666 ;;
5667 esac
5668 $rm -f hosts
5669 ;;
5670 *) dflt="$mydomain";;
5671 esac;;
5672esac
5673echo " "
5674rp="What is your domain name?"
5675. ./myread
5676tans="$ans"
5677case "$ans" in
5678'') ;;
5679.*) ;;
5680*) tans=".$tans";;
5681esac
5682mydomain="$tans"
5683
5684: translate upper to lower if necessary
5685case "$mydomain" in
5686*[A-Z]*)
5687 echo "(Normalizing case in your domain name)"
5688 mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
5689 ;;
5690esac
5691
5692: a little sanity check here
5693case "$phostname" in
5694'') ;;
5695*)
5696 case `$phostname | ./tr '[A-Z]' '[a-z]'` in
5697 $myhostname$mydomain|$myhostname) ;;
5698 *)
5699 case "$phostname" in
5700 sed*)
5701 echo "(That doesn't agree with your whoami.h file, by the way.)"
5702 ;;
5703 *)
5704 echo "(That doesn't agree with your $phostname command, by the way.)"
5705 ;;
5706 esac
5707 ;;
5708 esac
5709 ;;
5710esac
5711
5712$cat <<EOM
5713
5714I need to get your e-mail address in Internet format if possible, i.e.
5715something like user@host.domain. Please answer accurately since I have
5716no easy means to double check it. The default value provided below
5717is most probably close to the reality but may not be valid from outside
5718your organization...
5719
5720EOM
5721cont=x
5722while test "$cont"; do
5723 case "$cf_email" in
5724 '') dflt="$cf_by@$myhostname$mydomain";;
5725 *) dflt="$cf_email";;
5726 esac
5727 rp='What is your e-mail address?'
5728 . ./myread
5729 cf_email="$ans"
5730 case "$cf_email" in
5731 *@*.*) cont='' ;;
5732 *)
5733 rp='Address does not look like an Internet one. Use it anyway?'
5734 case "$fastread" in
5735 yes) dflt=y ;;
5736 *) dflt=n ;;
5737 esac
5738 . ./myread
5739 case "$ans" in
5740 y*) cont='' ;;
5741 *) echo " " ;;
5742 esac
5743 ;;
5744 esac
5745done
5746
5747$cat <<EOM
5748
5749If you or somebody else will be maintaining perl at your site, please
5750fill in the correct e-mail address here so that they may be contacted
5751if necessary. Currently, the "perlbug" program included with perl
5752will send mail to this address in addition to perlbug@perl.com. You may
5753enter "none" for no administrator.
5754
5755EOM
5756case "$perladmin" in
5757'') dflt="$cf_email";;
5758*) dflt="$perladmin";;
5759esac
5760rp='Perl administrator e-mail address'
5761. ./myread
5762perladmin="$ans"
5763
5f05dabc 5764: figure out how to guarantee perl startup
5765case "$startperl" in
5766'')
5767 case "$sharpbang" in
5768 *!)
5769 $cat <<EOH
5770
5771I can use the #! construct to start perl on your system. This will
5772make startup of perl scripts faster, but may cause problems if you
5773want to share those scripts and perl is not in a standard place
5774($binexp/perl) on all your platforms. The alternative is to force
5775a shell by starting the script with a single ':' character.
5776
5777EOH
5778 dflt="$binexp/perl"
5779 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
5780 . ./myread
5781 case "$ans" in
68dc0745 5782 none) startperl=": # use perl";;
5783 *) startperl="#!$ans"
3e3baf6d 5784 if $test 30 -lt `echo "$ans" | wc -c`; then
68dc0745 5785 $cat >&4 <<EOM
5786
5787WARNING: Some systems limit the #! command to 32 characters.
5788If you experience difficulty running Perl scripts with #!, try
5789installing Perl in a directory with a shorter pathname.
5790
5791EOM
5792 fi ;;
5f05dabc 5793 esac
5794 ;;
5795 *) startperl=": # use perl"
5796 ;;
5797 esac
5798 ;;
5799esac
5800echo "I'll use $startperl to start perl scripts."
5801
5802: figure best path for perl in scripts
5803case "$perlpath" in
5804'')
5805 perlpath="$binexp/perl"
5806 case "$startperl" in
5807 *!*) ;;
5808 *)
5809 $cat <<EOH
5810
5811I will use the "eval 'exec'" idiom to start Perl on your system.
5812I can use the full path of your Perl binary for this purpose, but
5813doing so may cause problems if you want to share those scripts and
5814Perl is not always in a standard place ($binexp/perl).
5815
5816EOH
5817 dflt="$binexp/perl"
5818 rp="What path shall I use in \"eval 'exec'\"?"
5819 . ./myread
5820 perlpath="$ans"
5821 ;;
5822 esac
5823 ;;
5824esac
5825case "$startperl" in
5826*!*) ;;
5827*) echo "I'll use $perlpath in \"eval 'exec'\"" ;;
5828esac
5829
dc45a647
MB
5830: determine where public executable scripts go
5831set scriptdir scriptdir
5832eval $prefixit
5833case "$scriptdir" in
5834'')
5835 dflt="$bin"
5836 : guess some guesses
5837 $test -d /usr/share/scripts && dflt=/usr/share/scripts
5838 $test -d /usr/share/bin && dflt=/usr/share/bin
5839 $test -d /usr/local/script && dflt=/usr/local/script
5840 $test -d $prefixexp/script && dflt=$prefixexp/script
5841 set dflt
5842 eval $prefixup
5843 ;;
5844*) dflt="$scriptdir"
5845 ;;
5846esac
5847$cat <<EOM
5848
5849Some installations have a separate directory just for executable scripts so
5850that they can mount it across multiple architectures but keep the scripts in
5851one spot. You might, for example, have a subdirectory of /usr/share for this.
5852Or you might just lump your scripts in with all your other executables.
5853
5854EOM
5855fn=d~
5856rp='Where do you keep publicly executable scripts?'
5857. ./getfile
5858if $test "X$ansexp" != "X$scriptdirexp"; then
5859 installscript=''
5860fi
5861scriptdir="$ans"
5862scriptdirexp="$ansexp"
5863if $afs; then
5864 $cat <<EOM
5865
5866Since you are running AFS, I need to distinguish the directory in which
5867scripts reside from the directory in which they are installed (and from
5868which they are presumably copied to the former directory by occult means).
5869
5870EOM
5871 case "$installscript" in
5872 '') dflt=`echo $scriptdirexp | sed 's#^/afs/#/afs/.#'`;;
5873 *) dflt="$installscript";;
5874 esac
5875 fn=de~
5876 rp='Where will public scripts be installed?'
5877 . ./getfile
5878 installscript="$ans"
5879else
5880 installscript="$scriptdirexp"
5881fi
5882
5883: determine where site specific libraries go.
3a6175e1 5884: Usual default is /usr/local/lib/perl5/site_perl/$apiversion
bfb7748a
AD
5885prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5886case "$prefix" in
3a6175e1
AD
5887*perl*) set dflt sitelib lib/site_$prog/$apiversion ;;
5888*) set dflt sitelib lib/$package/site_$prog/$apiversion ;;
dc45a647 5889esac
bfb7748a 5890eval $prefixit
dc45a647
MB
5891$cat <<EOM
5892
5893The installation process will also create a directory for
5894site-specific extensions and modules. Some users find it convenient
5895to place all local files in this directory rather than in the main
5896distribution directory.
5897
5898EOM
5899fn=d~+
5900rp='Pathname for the site-specific library files?'
5901. ./getfile
5902if $test "X$sitelibexp" != "X$ansexp"; then
5903 installsitelib=''
5904fi
5905sitelib="$ans"
5906sitelibexp="$ansexp"
5907if $afs; then
5908 $cat <<EOM
5909
5910Since you are running AFS, I need to distinguish the directory in
5911which site-specific files reside from the directory in which they are
5912installed (and from which they are presumably copied to the former
5913directory by occult means).
5914
5915EOM
5916 case "$installsitelib" in
5917 '') dflt=`echo $sitelibexp | sed 's#^/afs/#/afs/.#'`;;
5918 *) dflt="$installsitelib";;
5919 esac
5920 fn=de~
5921 rp='Where will site-specific files be installed?'
5922 . ./getfile
5923 installsitelib="$ans"
5924else
5925 installsitelib="$sitelibexp"
5926fi
5927
5928: determine where site specific architecture-dependent libraries go.
3a6175e1 5929: sitelib default is /usr/local/lib/perl5/site_perl/$apiversion
bfb7748a 5930: sitearch default is /usr/local/lib/perl5/site_perl/$apiversion/$archname
3a6175e1 5931: sitelib may have an optional trailing /share.
bfb7748a
AD
5932tdflt=`echo $sitelib | $sed 's,/share$,,'`
5933tdflt="$tdflt/$archname"
dc45a647
MB
5934set sitearch sitearch none
5935eval $prefixit
5936case "$sitearch" in
bfb7748a 5937'') dflt="$tdflt" ;;
dc45a647
MB
5938*) dflt="$sitearch" ;;
5939esac
5940$cat <<EOM
5941
5942The installation process will also create a directory for
5943architecture-dependent site-specific extensions and modules.
5944
5945EOM
5946fn=nd~+
5947rp='Pathname for the site-specific architecture-dependent library files?'
5948. ./getfile
5949if $test "X$sitearchexp" != "X$ansexp"; then
5950 installsitearch=''
5951fi
5952sitearch="$ans"
5953sitearchexp="$ansexp"
5954if $afs; then
5955 $cat <<EOM
5956
5957Since you are running AFS, I need to distinguish the directory in
5958which site-specific architecture-dependent library files reside from
5959the directory in which they are installed (and from which they are
5960presumably copied to the former directory by occult means).
5961
5962EOM
5963 case "$installsitearch" in
5964 '') dflt=`echo $sitearchexp | sed 's#^/afs/#/afs/.#'`;;
5965 *) dflt="$installsitearch";;
5966 esac
5967 fn=de~
5968 rp='Where will site-specific architecture-dependent files be installed?'
5969 . ./getfile
5970 installsitearch="$ans"
5971else
5972 installsitearch="$sitearchexp"
5973fi
5974
2afac517 5975cat <<EOM
5976
85aff577
CS
5977Previous version of $package used the standard IO mechanisms as defined
5978in <stdio.h>. Versions 5.003_02 and later of perl allow alternate IO
2afac517 5979mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
85aff577
CS
5980the default. This abstraction layer can use AT&T's sfio (if you already
5981have sfio installed) or regular stdio. Using PerlIO with sfio may cause
5982problems with some extension modules. Using PerlIO with stdio is safe,
5983but it is slower than plain stdio and therefore is not the default.
2afac517 5984
5985If this doesn't make any sense to you, just accept the default 'n'.
5986EOM
5987case "$useperlio" in
5988$define|true|[yY]*) dflt='y';;
5989*) dflt='n';;
5990esac
5991rp='Use the experimental PerlIO abstraction layer?'
5992. ./myread
5993case "$ans" in
5994y|Y)
5995 val="$define"
5996 ;;
5997*)
5998 echo "Ok, doing things the stdio way"
5999 val="$undef"
6000 ;;
6001esac
6002set useperlio
6003eval $setvar
2304df62 6004
8e07c86e 6005: Check how to convert floats to strings.
28e8609d
JH
6006if test "X$d_Gconvert" = X; then
6007 echo " "
6008 echo "Checking for an efficient way to convert floats to strings."
6009 $cat >try.c <<'EOP'
8e07c86e
AD
6010#ifdef TRY_gconvert
6011#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
8ff267be 6012char *myname = "gconvert";
8e07c86e
AD
6013#endif
6014#ifdef TRY_gcvt
6015#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
8ff267be 6016char *myname = "gcvt";
8e07c86e
AD
6017#endif
6018#ifdef TRY_sprintf
6019#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
8ff267be 6020char *myname = "sprintf";
8e07c86e 6021#endif
8ff267be 6022
6023#include <stdio.h>
6024
6025int
6026checkit(expect, got)
6027char *expect;
6028char *got;
6029{
6030 if (strcmp(expect, got)) {
6031 printf("%s oddity: Expected %s, got %s\n",
6032 myname, expect, got);
6033 exit(1);
6034 }
6035}
6036
6037int
6038main()
6039{
ecfc5424 6040 char buf[64];
8ff267be 6041 buf[63] = '\0';
6042
6043 /* This must be 1st test on (which?) platform */
6044 /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
6045 Gconvert(0.1, 8, 0, buf);
6046 checkit("0.1", buf);
6047
8e07c86e 6048 Gconvert(1.0, 8, 0, buf);
8ff267be 6049 checkit("1", buf);
6050
8e07c86e 6051 Gconvert(0.0, 8, 0, buf);
8ff267be 6052 checkit("0", buf);
6053
8e07c86e 6054 Gconvert(-1.0, 8, 0, buf);
8ff267be 6055 checkit("-1", buf);
6056
6057 /* Some Linux gcvt's give 1.e+5 here. */
6058 Gconvert(100000.0, 8, 0, buf);
6059 checkit("100000", buf);
6060
6061 /* Some Linux gcvt's give -1.e+5 here. */
6062 Gconvert(-100000.0, 8, 0, buf);
6063 checkit("-100000", buf);
6064
ecfc5424 6065 exit(0);
a0d0e21e
LW
6066}
6067EOP
28e8609d
JH
6068 case "$d_Gconvert" in
6069 gconvert*) xxx_list='gconvert gcvt sprintf' ;;
6070 gcvt*) xxx_list='gcvt gconvert sprintf' ;;
6071 sprintf*) xxx_list='sprintf gconvert gcvt' ;;
6072 *) xxx_list='gconvert gcvt sprintf' ;;
6073 esac
8e07c86e 6074
28e8609d 6075 for xxx_convert in $xxx_list; do
8e07c86e 6076 echo "Trying $xxx_convert"
dfe9444c
AD
6077 $rm -f try try$_o
6078 set try -DTRY_$xxx_convert
6079 if eval $compile; then
8e07c86e
AD
6080 echo "$xxx_convert" found. >&4
6081 if ./try; then
8e07c86e
AD
6082 echo "I'll use $xxx_convert to convert floats into a string." >&4
6083 break;
2304df62 6084 else
8ff267be 6085 echo "...But $xxx_convert didn't work as I expected."
2304df62 6086 fi
8e07c86e
AD
6087 else
6088 echo "$xxx_convert NOT found." >&4
6089 fi
28e8609d 6090 done
8e07c86e 6091
28e8609d
JH
6092 case "$xxx_convert" in
6093 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
6094 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
6095 *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
6096 esac
6097fi
2304df62 6098
a0d0e21e
LW
6099: Initialize h_fcntl
6100h_fcntl=false
6101
6102: Initialize h_sysfile
6103h_sysfile=false
2304df62 6104
2304df62
AD
6105: access call always available on UNIX
6106set access d_access
6107eval $inlibc
6108
6109: locate the flags for 'access()'
6110case "$d_access" in
6111"$define")
6112 echo " "
6113 $cat >access.c <<'EOCP'
6114#include <sys/types.h>
6115#ifdef I_FCNTL
6116#include <fcntl.h>
6117#endif
6118#ifdef I_SYS_FILE
6119#include <sys/file.h>
6120#endif
6121#ifdef I_UNISTD
6122#include <unistd.h>
6123#endif
6124main() {
6125 exit(R_OK);
6126}
8e07c86e
AD
6127EOCP
6128 : check sys/file.h first, no particular reason here
6129 if $test `./findhdr sys/file.h` && \
dfe9444c 6130 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
8e07c86e
AD
6131 h_sysfile=true;
6132 echo "<sys/file.h> defines the *_OK access constants." >&4
6133 elif $test `./findhdr fcntl.h` && \
dfe9444c 6134 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
8e07c86e
AD
6135 h_fcntl=true;
6136 echo "<fcntl.h> defines the *_OK access constants." >&4
6137 elif $test `./findhdr unistd.h` && \
dfe9444c 6138 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
8e07c86e
AD
6139 echo "<unistd.h> defines the *_OK access constants." >&4
6140 else
6141 echo "I can't find the four *_OK access constants--I'll use mine." >&4
6142 fi
6143 ;;
6144esac
6145$rm -f access*
a0d0e21e 6146
8e07c86e
AD
6147: see if alarm exists
6148set alarm d_alarm
6149eval $inlibc
2304df62 6150
ecfc5424 6151: Look for GNU-cc style attribute checking
2304df62 6152echo " "
a0d0e21e
LW
6153echo "Checking whether your compiler can handle __attribute__ ..." >&4
6154$cat >attrib.c <<'EOCP'
1aef975c 6155#include <stdio.h>
ecfc5424 6156void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
a0d0e21e
LW
6157EOCP
6158if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
6159 if $contains 'warning' attrib.out >/dev/null 2>&1; then
ecfc5424 6160 echo "Your C compiler doesn't fully support __attribute__."
a0d0e21e
LW
6161 val="$undef"
6162 else
ecfc5424 6163 echo "Your C compiler supports __attribute__."
a0d0e21e
LW
6164 val="$define"
6165 fi
6166else
ecfc5424 6167 echo "Your C compiler doesn't seem to understand __attribute__ at all."
a0d0e21e
LW
6168 val="$undef"
6169fi
ecfc5424 6170set d_attribut
a0d0e21e
LW
6171eval $setvar
6172$rm -f attrib*
6173
6174: see if bcmp exists
6175set bcmp d_bcmp
6176eval $inlibc
6177
6178: see if bcopy exists
6179set bcopy d_bcopy
6180eval $inlibc
6181
2afac517 6182: see if this is a unistd.h system
6183set unistd.h i_unistd
6184eval $inhdr
6185
6186: see if getpgrp exists
6187set getpgrp d_getpgrp
6188eval $inlibc
6189
2afac517 6190case "$d_getpgrp" in
6191"$define")
6192 echo " "
dfe9444c 6193 echo "Checking to see which flavor of getpgrp is in use..."
2afac517 6194 $cat >set.c <<EOP
6195#$i_unistd I_UNISTD
6196#include <sys/types.h>
6197#ifdef I_UNISTD
6198# include <unistd.h>
6199#endif
6200main()
6201{
6202 if (getuid() == 0) {
6203 printf("(I see you are running Configure as super-user...)\n");
6204 setuid(1);
6205 }
6206#ifdef TRY_BSD_PGRP
6207 if (getpgrp(1) == 0)
6208 exit(0);
6209#else
6210 if (getpgrp() > 0)
6211 exit(0);
6212#endif
6213 exit(1);
6214}
6215EOP
6216 if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
6217 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
6218 val="$define"
6219 elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
6220 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
6221 val="$undef"
6222 else
6223 echo "I can't seem to compile and run the test program."
6224 if ./usg; then
6225 xxx="a USG one, i.e. you use getpgrp()."
6226 else
6227 # SVR4 systems can appear rather BSD-ish.
6228 case "$i_unistd" in
6229 $undef)
6230 xxx="a BSD one, i.e. you use getpgrp(pid)."
6231 val="$define"
6232 ;;
6233 $define)
6234 xxx="probably a USG one, i.e. you use getpgrp()."
6235 val="$undef"
6236 ;;
6237 esac
6238 fi
6239 echo "Assuming your getpgrp is $xxx" >&4
6240 fi
6241 ;;
6242*) val="$undef";;
6243esac
6244set d_bsdgetpgrp
6245eval $setvar
6246$rm -f set set.c
6247
a0d0e21e
LW
6248: see if setpgrp exists
6249set setpgrp d_setpgrp
6250eval $inlibc
6251
a0d0e21e
LW
6252case "$d_setpgrp" in
6253"$define")
6254 echo " "
dfe9444c 6255 echo "Checking to see which flavor of setpgrp is in use..."
a0d0e21e 6256 $cat >set.c <<EOP
2afac517 6257#$i_unistd I_UNISTD
6258#include <sys/types.h>
6259#ifdef I_UNISTD
6260# include <unistd.h>
6261#endif
a0d0e21e
LW
6262main()
6263{
6264 if (getuid() == 0) {
6265 printf("(I see you are running Configure as super-user...)\n");
6266 setuid(1);
6267 }
2afac517 6268#ifdef TRY_BSD_PGRP
a0d0e21e 6269 if (-1 == setpgrp(1, 1))
2afac517 6270 exit(0);
6271#else
6272 if (setpgrp() != -1)
6273 exit(0);
6274#endif
6275 exit(1);
a0d0e21e
LW
6276}
6277EOP
2afac517 6278 if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
6279 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
6280 val="$define"
6281 elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
6282 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
6283 val="$undef"
a0d0e21e 6284 else
dfe9444c 6285 echo "(I can't seem to compile and run the test program.)"
ecfc5424 6286 if ./usg; then
2afac517 6287 xxx="a USG one, i.e. you use setpgrp()."
a0d0e21e 6288 else
2afac517 6289 # SVR4 systems can appear rather BSD-ish.
6290 case "$i_unistd" in
6291 $undef)
6292 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
6293 val="$define"
6294 ;;
6295 $define)
6296 xxx="probably a USG one, i.e. you use setpgrp()."
6297 val="$undef"
6298 ;;
6299 esac
a0d0e21e 6300 fi
2afac517 6301 echo "Assuming your setpgrp is $xxx" >&4
a0d0e21e
LW
6302 fi
6303 ;;
6304*) val="$undef";;
6305esac
2afac517 6306set d_bsdsetpgrp
a0d0e21e
LW
6307eval $setvar
6308$rm -f set set.c
a0d0e21e
LW
6309: see if bzero exists
6310set bzero d_bzero
6311eval $inlibc
6312
24fef2a7 6313: check for lengths of integral types
a0d0e21e
LW
6314echo " "
6315case "$intsize" in
6316'')
6317 echo "Checking to see how big your integers are..." >&4
24fef2a7 6318 $cat >intsize.c <<'EOCP'
a0d0e21e
LW
6319#include <stdio.h>
6320main()
6321{
24fef2a7
AD
6322 printf("intsize=%d;\n", sizeof(int));
6323 printf("longsize=%d;\n", sizeof(long));
6324 printf("shortsize=%d;\n", sizeof(short));
8e07c86e 6325 exit(0);
a0d0e21e
LW
6326}
6327EOCP
dfe9444c 6328 set intsize
dc45a647 6329 if eval $compile_ok && ./intsize > /dev/null; then
dfe9444c 6330 eval `./intsize`
8e07c86e 6331 echo "Your integers are $intsize bytes long."
24fef2a7
AD
6332 echo "Your long integers are $longsize bytes long."
6333 echo "Your short integers are $shortsize bytes long."
a0d0e21e 6334 else
24fef2a7 6335 $cat >&4 <<EOM
dfe9444c 6336!
24fef2a7
AD
6337Help! I can't compile and run the intsize test program: please enlighten me!
6338(This is probably a misconfiguration in your system or libraries, and
6339you really ought to fix it. Still, I'll try anyway.)
dfe9444c 6340!
24fef2a7
AD
6341EOM
6342 dflt=4
8e07c86e
AD
6343 rp="What is the size of an integer (in bytes)?"
6344 . ./myread
6345 intsize="$ans"
24fef2a7
AD
6346 dflt=$intsize
6347 rp="What is the size of a long integer (in bytes)?"
6348 . ./myread
6349 longsize="$ans"
6350 dflt=2
6351 rp="What is the size of a short integer (in bytes)?"
6352 . ./myread
6353 shortsize="$ans"
a0d0e21e
LW
6354 fi
6355 ;;
a0d0e21e 6356esac
dfe9444c 6357$rm -f intsize intsize.*
a0d0e21e 6358
ecfc5424 6359: see if signal is declared as pointer to function returning int or void
a0d0e21e 6360echo " "
ecfc5424
AD
6361xxx=`./findhdr signal.h`
6362$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
6363if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
6364 echo "You have int (*signal())() instead of void." >&4
6365 val="$undef"
6366elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
dfe9444c 6367 echo "You have void (*signal())()." >&4
ecfc5424
AD
6368 val="$define"
6369elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
6370 echo "You have int (*signal())() instead of void." >&4
6371 val="$undef"
dfe9444c
AD
6372elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
6373 echo "You have void (*signal())()." >&4
6374 val="$define"
a0d0e21e 6375else
ecfc5424
AD
6376 case "$d_voidsig" in
6377 '')
6378 echo "I can't determine whether signal handler returns void or int..." >&4
6379 dflt=void
6380 rp="What type does your signal handler return?"
6381 . ./myread
6382 case "$ans" in
6383 v*) val="$define";;
6384 *) val="$undef";;
6385 esac;;
6386 "$define")
dfe9444c
AD
6387 echo "As you already told me, signal handler returns void." >&4
6388 val="$define"
6389 ;;
6390 *) echo "As you already told me, signal handler returns int." >&4
6391 val="$undef"
6392 ;;
ecfc5424
AD
6393 esac
6394fi
6395set d_voidsig
6396eval $setvar
6397case "$d_voidsig" in
6398"$define") signal_t="void";;
6399*) signal_t="int";;
6400esac
6401$rm -f $$.tmp
6402
6403: check for ability to cast large floats to 32-bit ints.
6404echo " "
6405echo 'Checking whether your C compiler can cast large floats to int32.' >&4
e5c9fcd0 6406if $test "$intsize" -ge 4; then
ecfc5424
AD
6407 xxx=int
6408else
6409 xxx=long
6410fi
6411$cat >try.c <<EOCP
e5c9fcd0 6412#include <stdio.h>
ecfc5424
AD
6413#include <sys/types.h>
6414#include <signal.h>
a1896f58 6415$signal_t blech(s) int s; { exit(3); }
ecfc5424 6416main()
2304df62 6417{
a0d0e21e 6418 $xxx i32;
e5c9fcd0 6419 double f, g;
2304df62 6420 int result = 0;
89434db5 6421 char str[16];
2304df62
AD
6422 signal(SIGFPE, blech);
6423
89434db5
AD
6424 /* Don't let compiler optimize the test away. Store the number
6425 in a writable string for gcc to pass to sscanf under HP/UX.
6426 */
6427 sprintf(str, "2147483647");
6428 sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
e5c9fcd0
AD
6429 g = 10 * f;
6430 i32 = ($xxx) g;
2304df62 6431
e5c9fcd0
AD
6432 /* x86 processors will probably give 0x8000 0000, which is a
6433 sign change. We don't want that. We want to mimic SPARC
6434 behavior here, which is to preserve the sign and give
6435 back 0x7fff ffff.
6436 */
a0d0e21e 6437 if (i32 != ($xxx) f)
2304df62
AD
6438 result |= 1;
6439 exit(result);
6440}
6441EOCP
dfe9444c 6442set try
dc45a647 6443if eval $compile_ok; then
2304df62
AD
6444 ./try
6445 yyy=$?
6446else
a0d0e21e 6447 echo "(I can't seem to compile the test program--assuming it can't)"
2304df62
AD
6448 yyy=1
6449fi
6450case "$yyy" in
64510) val="$define"
6452 echo "Yup, it can."
6453 ;;
6454*) val="$undef"
6455 echo "Nope, it can't."
6456 ;;
6457esac
6458set d_casti32
6459eval $setvar
85e6fe83 6460$rm -f try try.*
a0d0e21e 6461
2304df62
AD
6462: check for ability to cast negative floats to unsigned
6463echo " "
6464echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
ecfc5424 6465$cat >try.c <<EOCP
e5c9fcd0 6466#include <stdio.h>
ecfc5424 6467#include <sys/types.h>
2304df62 6468#include <signal.h>
a1896f58
AD
6469$signal_t blech(s) int s; { exit(7); }
6470$signal_t blech_in_list(s) int s; { exit(4); }
232e078e
AD
6471unsigned long dummy_long(p) unsigned long p; { return p; }
6472unsigned int dummy_int(p) unsigned int p; { return p; }
6473unsigned short dummy_short(p) unsigned short p; { return p; }
2304df62
AD
6474main()
6475{
e5c9fcd0 6476 double f;
2304df62
AD
6477 unsigned long along;
6478 unsigned int aint;
6479 unsigned short ashort;
6480 int result = 0;
89434db5
AD
6481 char str[16];
6482
e5c9fcd0
AD
6483 /* Frustrate gcc-2.7.2's optimizer which failed this test with
6484 a direct f = -123. assignment. gcc-2.8.0 reportedly
6485 optimized the whole file away
6486 */
89434db5
AD
6487 /* Store the number in a writable string for gcc to pass to
6488 sscanf under HP/UX.
6489 */
6490 sprintf(str, "-123");
6491 sscanf(str, "%lf", &f); /* f = -123.; */
2304df62
AD
6492
6493 signal(SIGFPE, blech);
6494 along = (unsigned long)f;
6495 aint = (unsigned int)f;
6496 ashort = (unsigned short)f;
6497 if (along != (unsigned long)-123)
6498 result |= 1;
6499 if (aint != (unsigned int)-123)
6500 result |= 1;
6501 if (ashort != (unsigned short)-123)
6502 result |= 1;
89434db5
AD
6503 sprintf(str, "1073741824.");
6504 sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
2304df62
AD
6505 f = f + f;
6506 along = 0;
6507 along = (unsigned long)f;
6508 if (along != 0x80000000)
6509 result |= 2;
6510 f -= 1.;
6511 along = 0;
6512 along = (unsigned long)f;
6513 if (along != 0x7fffffff)
6514 result |= 1;
6515 f += 2.;
6516 along = 0;
6517 along = (unsigned long)f;
6518 if (along != 0x80000001)
6519 result |= 2;
232e078e
AD
6520 if (result)
6521 exit(result);
6522 signal(SIGFPE, blech_in_list);
89434db5
AD
6523 sprintf(str, "123.");
6524 sscanf(str, "%lf", &f); /* f = 123.; */
232e078e
AD
6525 along = dummy_long((unsigned long)f);
6526 aint = dummy_int((unsigned int)f);
6527 ashort = dummy_short((unsigned short)f);
6528 if (along != (unsigned long)123)
6529 result |= 4;
6530 if (aint != (unsigned int)123)
6531 result |= 4;
6532 if (ashort != (unsigned short)123)
6533 result |= 4;
2304df62
AD
6534 exit(result);
6535
6536}
6537EOCP
dfe9444c 6538set try
dc45a647 6539if eval $compile_ok; then
2304df62
AD
6540 ./try
6541 castflags=$?
6542else
ecfc5424 6543 echo "(I can't seem to compile the test program--assuming it can't)"
232e078e 6544 castflags=7
2304df62
AD
6545fi
6546case "$castflags" in
65470) val="$define"
6548 echo "Yup, it can."
6549 ;;
6550*) val="$undef"
6551 echo "Nope, it can't."
6552 ;;
6553esac
6554set d_castneg
6555eval $setvar
6556$rm -f try.*
6557
2304df62
AD
6558: see if vprintf exists
6559echo " "
6560if set vprintf val -f d_vprintf; eval $csym; $val; then
6561 echo 'vprintf() found.' >&4
6562 val="$define"
6563 $cat >vprintf.c <<'EOF'
6564#include <varargs.h>
6565
6566main() { xxx("foo"); }
6567
6568xxx(va_alist)
6569va_dcl
6570{
6571 va_list args;
6572 char buf[10];
6573
6574 va_start(args);
6575 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
6576}
6577EOF
dfe9444c
AD
6578 set vprintf
6579 if eval $compile && ./vprintf; then
2304df62
AD
6580 echo "Your vsprintf() returns (int)." >&4
6581 val2="$undef"
6582 else
6583 echo "Your vsprintf() returns (char*)." >&4
6584 val2="$define"
6585 fi
6586else
6587 echo 'vprintf() NOT found.' >&4
6588 val="$undef"
6589 val2="$undef"
6590fi
6591set d_vprintf
6592eval $setvar
6593val=$val2
6594set d_charvspr
6595eval $setvar
6596
a0d0e21e
LW
6597: see if chown exists
6598set chown d_chown
6599eval $inlibc
6600
6601: see if chroot exists
6602set chroot d_chroot
6603eval $inlibc
6604
2304df62
AD
6605: see if chsize exists
6606set chsize d_chsize
6607eval $inlibc
6608
6609: check for const keyword
6610echo " "
6611echo 'Checking to see if your C compiler knows about "const"...' >&4
6612$cat >const.c <<'EOCP'
6613typedef struct spug { int drokk; } spug;
6614main()
6615{
6616 const char *foo;
6617 const spug y;
6618}
6619EOCP
6620if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
6621 val="$define"
6622 echo "Yup, it does."
6623else
6624 val="$undef"
6625 echo "Nope, it doesn't."
6626fi
6627set d_const
6628eval $setvar
6629
6630: see if crypt exists
6631echo " "
6632if set crypt val -f d_crypt; eval $csym; $val; then
6633 echo 'crypt() found.' >&4
6634 val="$define"
6635 cryptlib=''
6636else
dfe9444c 6637 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
2304df62 6638 if $test -z "$cryptlib"; then
dfe9444c 6639 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
2304df62
AD
6640 else
6641 cryptlib=-lcrypt
6642 fi
6643 if $test -z "$cryptlib"; then
dfe9444c 6644 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
2304df62
AD
6645 else
6646 cryptlib=-lcrypt
6647 fi
6648 if $test -z "$cryptlib"; then
dfe9444c 6649 cryptlib=`./loc libcrypt$_a "" $libpth`
2304df62
AD
6650 else
6651 cryptlib=-lcrypt
6652 fi
6653 if $test -z "$cryptlib"; then
6654 echo 'crypt() NOT found.' >&4
6655 val="$undef"
6656 else
6657 val="$define"
6658 fi
6659fi
6660set d_crypt
6661eval $setvar
6662
a0d0e21e
LW
6663: see if cuserid exists
6664set cuserid d_cuserid
2304df62
AD
6665eval $inlibc
6666
a0d0e21e
LW
6667: see if this is a limits.h system
6668set limits.h i_limits
85e6fe83
LW
6669eval $inhdr
6670
a0d0e21e
LW
6671: see if this is a float.h system
6672set float.h i_float
6673eval $inhdr
6674
6675: See if number of significant digits in a double precision number is known
6676echo " "
6677$cat >dbl_dig.c <<EOM
6678#$i_limits I_LIMITS
6679#$i_float I_FLOAT
6680#ifdef I_LIMITS
6681#include <limits.h>
85e6fe83 6682#endif
a0d0e21e
LW
6683#ifdef I_FLOAT
6684#include <float.h>
6685#endif
6686#ifdef DBL_DIG
6687printf("Contains DBL_DIG");
85e6fe83 6688#endif
85e6fe83 6689EOM
a0d0e21e
LW
6690$cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
6691if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
6692 echo "DBL_DIG found." >&4
6693 val="$define"
2304df62 6694else
a0d0e21e
LW
6695 echo "DBL_DIG NOT found." >&4
6696 val="$undef"
2304df62 6697fi
a0d0e21e
LW
6698$rm -f dbl_dig.?
6699set d_dbl_dig
2304df62 6700eval $setvar
2304df62 6701
a0d0e21e
LW
6702: see if difftime exists
6703set difftime d_difftime
2304df62
AD
6704eval $inlibc
6705
a0d0e21e
LW
6706: see if this is a dirent system
6707echo " "
6708if xinc=`./findhdr dirent.h`; $test "$xinc"; then
6709 val="$define"
6710 echo "<dirent.h> found." >&4
6711else
6712 val="$undef"
6713 if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
6714 echo "<sys/dir.h> found." >&4
6715 echo " "
6716 else
6717 xinc=`./findhdr sys/ndir.h`
6718 fi
6719 echo "<dirent.h> NOT found." >&4
6720fi
6721set i_dirent
6722eval $setvar
6723
6724: Look for type of directory structure.
6725echo " "
6726$cppstdin $cppflags $cppminus < "$xinc" > try.c
6727
6728case "$direntrytype" in
6729''|' ')
6730 case "$i_dirent" in
6731 $define) guess1='struct dirent' ;;
6732 *) guess1='struct direct' ;;
2afac517 6733 esac
6734 ;;
6735*) guess1="$direntrytype"
6736 ;;
8e07c86e
AD
6737esac
6738
2afac517 6739case "$guess1" in
6740'struct dirent') guess2='struct direct' ;;
6741*) guess2='struct dirent' ;;
6742esac
6743
6744if $contains "$guess1" try.c >/dev/null 2>&1; then
6745 direntrytype="$guess1"
6746 echo "Your directory entries are $direntrytype." >&4
6747elif $contains "$guess2" try.c >/dev/null 2>&1; then
6748 direntrytype="$guess2"
6749 echo "Your directory entries seem to be $direntrytype." >&4
6750else
6751 echo "I don't recognize your system's directory entries." >&4
6752 rp="What type is used for directory entries on this system?"
6753 dflt="$guess1"
6754 . ./myread
6755 direntrytype="$ans"
6756fi
6757$rm -f try.c
a0d0e21e 6758
a0d0e21e 6759
2afac517 6760: see if the directory entry stores field length
6761echo " "
6762$cppstdin $cppflags $cppminus < "$xinc" > try.c
6763if $contains 'd_namlen' try.c >/dev/null 2>&1; then
6764 echo "Good, your directory entry keeps length information in d_namlen." >&4
6765 val="$define"
6766else
6767 echo "Your directory entry does not know about the d_namlen field." >&4
6768 val="$undef"
6769fi
6770set d_dirnamlen
6771eval $setvar
6772$rm -f try.c
a0d0e21e 6773
2afac517 6774: see if dlerror exists
6775xxx_runnm="$runnm"
6776runnm=false
6777set dlerror d_dlerror
6778eval $inlibc
6779runnm="$xxx_runnm"
a0d0e21e
LW
6780
6781: see if dlfcn is available
6782set dlfcn.h i_dlfcn
6783eval $inhdr
6784
6785case "$usedl" in
6786$define|y|true)
6787 $cat << EOM
6788
6789On a few systems, the dynamically loaded modules that perl generates and uses
c4f23d77 6790will need a different extension than shared libs. The default will probably
a0d0e21e
LW
6791be appropriate.
6792
6793EOM
6794 case "$dlext" in
6795 '') dflt="$so" ;;
6796 *) dflt="$dlext" ;;
6797 esac
6798 rp='What is the extension of dynamically loaded modules'
6799 . ./myread
6800 dlext="$ans"
6801 ;;
6802*)
6803 dlext="none"
6804 ;;
6805esac
6806
6807: Check if dlsym need a leading underscore
6808echo " "
6809val="$undef"
6810
6811case "$dlsrc" in
6812dl_dlopen.xs)
6813 echo "Checking whether your dlsym() needs a leading underscore ..." >&4
6814 $cat >dyna.c <<'EOM'
6815fred () { }
6816EOM
6817
6818$cat >fred.c<<EOM
6819
6820#include <stdio.h>
6821#$i_dlfcn I_DLFCN
6822#ifdef I_DLFCN
6823#include <dlfcn.h> /* the dynamic linker include file for Sunos/Solaris */
6824#else
6825#include <sys/types.h>
6826#include <nlist.h>
6827#include <link.h>
6828#endif
6829
6830extern int fred() ;
6831
6832main()
6833{
6834 void * handle ;
6835 void * symbol ;
6836#ifndef RTLD_LAZY
6837 int mode = 1 ;
6838#else
6839 int mode = RTLD_LAZY ;
6840#endif
6841 handle = dlopen("./dyna.$dlext", mode) ;
6842 if (handle == NULL) {
5f05dabc 6843 printf ("1\n") ;
6844 fflush (stdout) ;
6845 exit(0);
a0d0e21e
LW
6846 }
6847 symbol = dlsym(handle, "fred") ;
6848 if (symbol == NULL) {
5f05dabc 6849 /* try putting a leading underscore */
6850 symbol = dlsym(handle, "_fred") ;
6851 if (symbol == NULL) {
6852 printf ("2\n") ;
6853 fflush (stdout) ;
6854 exit(0);
6855 }
6856 printf ("3\n") ;
a0d0e21e
LW
6857 }
6858 else
5f05dabc 6859 printf ("4\n") ;
36477c24 6860 fflush (stdout) ;
6861 exit(0);
a0d0e21e
LW
6862}
6863EOM
760ac839 6864 : Call the object file tmp-dyna.o in case dlext=o.
a0d0e21e 6865 if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
dfe9444c
AD
6866 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
6867 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 &&
87563a30 6868 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
a0d0e21e
LW
6869 xxx=`./fred`
6870 case $xxx in
6871 1) echo "Test program failed using dlopen." >&4
6872 echo "Perhaps you should not use dynamic loading." >&4;;
6873 2) echo "Test program failed using dlsym." >&4
6874 echo "Perhaps you should not use dynamic loading." >&4;;
6875 3) echo "dlsym needs a leading underscore" >&4
6876 val="$define" ;;
6877 4) echo "dlsym doesn't need a leading underscore." >&4;;
6878 esac
6879 else
6880 echo "I can't compile and run the test program." >&4
6881 fi
6882 ;;
6883esac
6884
a78b0d02 6885$rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
a0d0e21e
LW
6886
6887set d_dlsymun
6888eval $setvar
6889
a0d0e21e
LW
6890: see if dup2 exists
6891set dup2 d_dup2
6892eval $inlibc
6893
e5c9fcd0
AD
6894: see if endhostent exists
6895set endhostent d_endhent
6896eval $inlibc
6897
6898: see if endnetent exists
6899set endnetent d_endnent
6900eval $inlibc
6901
6902: see if endprotoent exists
6903set endprotoent d_endpent
6904eval $inlibc
6905
6906: see if endservent exists
6907set endservent d_endsent
6908eval $inlibc
6909
8e07c86e
AD
6910: Locate the flags for 'open()'
6911echo " "
6912$cat >open3.c <<'EOCP'
6913#include <sys/types.h>
6914#ifdef I_FCNTL
6915#include <fcntl.h>
6916#endif
6917#ifdef I_SYS_FILE
6918#include <sys/file.h>
6919#endif
6920main() {
6921 if(O_RDONLY);
6922#ifdef O_TRUNC
6923 exit(0);
6924#else
6925 exit(1);
6926#endif
6927}
6928EOCP
6929: check sys/file.h first to get FREAD on Sun
6930if $test `./findhdr sys/file.h` && \
dfe9444c 6931 set open3 -DI_SYS_FILE && eval $compile; then
8e07c86e
AD
6932 h_sysfile=true;
6933 echo "<sys/file.h> defines the O_* constants..." >&4
6934 if ./open3; then
6935 echo "and you have the 3 argument form of open()." >&4
6936 val="$define"
6937 else
6938 echo "but not the 3 argument form of open(). Oh, well." >&4
6939 val="$undef"
6940 fi
6941elif $test `./findhdr fcntl.h` && \
dfe9444c 6942 set open3 -DI_FCNTL && eval $compile; then
8e07c86e
AD
6943 h_fcntl=true;
6944 echo "<fcntl.h> defines the O_* constants..." >&4
6945 if ./open3; then
6946 echo "and you have the 3 argument form of open()." >&4
6947 val="$define"
6948 else
6949 echo "but not the 3 argument form of open(). Oh, well." >&4
6950 val="$undef"
6951 fi
6952else
6953 val="$undef"
6954 echo "I can't find the O_* constant definitions! You got problems." >&4
6955fi
6956set d_open3
6957eval $setvar
6958$rm -f open3*
6959
6960: check for non-blocking I/O stuff
6961case "$h_sysfile" in
6962true) echo "#include <sys/file.h>" > head.c;;
6963*)
6964 case "$h_fcntl" in
6965 true) echo "#include <fcntl.h>" > head.c;;
6966 *) echo "#include <sys/fcntl.h>" > head.c;;
6967 esac
6968 ;;
6969esac
6970echo " "
6971echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
6972case "$o_nonblock" in
6973'')
6974 $cat head.c > try.c
6975 $cat >>try.c <<'EOCP'
6976main() {
6977#ifdef O_NONBLOCK
6978 printf("O_NONBLOCK\n");
6979 exit(0);
6980#endif
6981#ifdef O_NDELAY
6982 printf("O_NDELAY\n");
6983 exit(0);
6984#endif
6985#ifdef FNDELAY
6986 printf("FNDELAY\n");
6987 exit(0);
6988#endif
6989 exit(0);
6990}
6991EOCP
dfe9444c 6992 set try
dc45a647 6993 if eval $compile_ok; then
8e07c86e
AD
6994 o_nonblock=`./try`
6995 case "$o_nonblock" in
6996 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
6997 *) echo "Seems like we can use $o_nonblock.";;
6998 esac
6999 else
7000 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
7001 fi
7002 ;;
7003*) echo "Using $hint value $o_nonblock.";;
7004esac
7005$rm -f try try.* .out core
7006
7007echo " "
7008echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
7009case "$eagain" in
7010'')
7011 $cat head.c > try.c
7012 $cat >>try.c <<EOCP
7013#include <errno.h>
7014#include <sys/types.h>
7015#include <signal.h>
4633a7c4 7016#define MY_O_NONBLOCK $o_nonblock
dc45a647 7017#ifndef errno /* XXX need better Configure test */
8e07c86e 7018extern int errno;
dc45a647 7019#endif
8e07c86e 7020$signal_t blech(x) int x; { exit(3); }
4633a7c4
LW
7021EOCP
7022 $cat >> try.c <<'EOCP'
8e07c86e
AD
7023main()
7024{
7025 int pd[2];
7026 int pu[2];
7027 char buf[1];
7028 char string[100];
7029
7030 pipe(pd); /* Down: child -> parent */
7031 pipe(pu); /* Up: parent -> child */
7032 if (0 != fork()) {
7033 int ret;
7034 close(pd[1]); /* Parent reads from pd[0] */
7035 close(pu[0]); /* Parent writes (blocking) to pu[1] */
4633a7c4 7036 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8e07c86e
AD
7037 exit(1);
7038 signal(SIGALRM, blech);
7039 alarm(5);
7040 if ((ret = read(pd[0], buf, 1)) > 0) /* Nothing to read! */
7041 exit(2);
7042 sprintf(string, "%d\n", ret);
7043 write(2, string, strlen(string));
7044 alarm(0);
7045#ifdef EAGAIN
7046 if (errno == EAGAIN) {
7047 printf("EAGAIN\n");
7048 goto ok;
7049 }
7050#endif
7051#ifdef EWOULDBLOCK
7052 if (errno == EWOULDBLOCK)
7053 printf("EWOULDBLOCK\n");
7054#endif
7055 ok:
7056 write(pu[1], buf, 1); /* Unblocks child, tell it to close our pipe */
7057 sleep(2); /* Give it time to close our pipe */
7058 alarm(5);
7059 ret = read(pd[0], buf, 1); /* Should read EOF */
7060 alarm(0);
7061 sprintf(string, "%d\n", ret);
7062 write(3, string, strlen(string));
7063 exit(0);
7064 }
7065
7066 close(pd[0]); /* We write to pd[1] */
7067 close(pu[1]); /* We read from pu[0] */
7068 read(pu[0], buf, 1); /* Wait for parent to signal us we may continue */
7069 close(pd[1]); /* Pipe pd is now fully closed! */
7070 exit(0); /* Bye bye, thank you for playing! */
7071}
7072EOCP
dfe9444c 7073 set try
dc45a647 7074 if eval $compile_ok; then
774d564b 7075 echo "$startsh" >mtry
40a7a20a 7076 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8e07c86e
AD
7077 chmod +x mtry
7078 ./mtry >/dev/null 2>&1
7079 case $? in
7080 0) eagain=`$cat try.out`;;
7081 1) echo "Could not perform non-blocking setting!";;
7082 2) echo "I did a successful read() for something that was not there!";;
7083 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
7084 *) echo "Something terribly wrong happened during testing.";;
7085 esac
7086 rd_nodata=`$cat try.ret`
7087 echo "A read() system call with no data present returns $rd_nodata."
7088 case "$rd_nodata" in
7089 0|-1) ;;
7090 *)
7091 echo "(That's peculiar, fixing that to be -1.)"
7092 rd_nodata=-1
7093 ;;
7094 esac
7095 case "$eagain" in
7096 '')
7097 echo "Forcing errno EAGAIN on read() with no data available."
7098 eagain=EAGAIN
7099 ;;
7100 *)
7101 echo "Your read() sets errno to $eagain when no data is available."
7102 ;;
7103 esac
7104 status=`$cat try.err`
7105 case "$status" in
7106 0) echo "And it correctly returns 0 to signal EOF.";;
7107 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
7108 *) echo "However, your read() returns '$status' on EOF??";;
7109 esac
7110 val="$define"
28757baa 7111 if test "$status" = "$rd_nodata"; then
8e07c86e
AD
7112 echo "WARNING: you can't distinguish between EOF and no data!"
7113 val="$undef"
7114 fi
7115 else
7116 echo "I can't compile the test program--assuming errno EAGAIN will do."
7117 eagain=EAGAIN
7118 fi
7119 set d_eofnblk
7120 eval $setvar
7121 ;;
7122*)
7123 echo "Using $hint value $eagain."
7124 echo "Your read() returns $rd_nodata when no data is present."
7125 case "$d_eofnblk" in
7126 "$define") echo "And you can see EOF because read() returns 0.";;
7127 "$undef") echo "But you can't see EOF status from read() returned value.";;
7128 *)
7129 echo "(Assuming you can't see EOF status from read anyway.)"
7130 d_eofnblk=$undef
7131 ;;
7132 esac
7133 ;;
7134esac
7135$rm -f try try.* .out core head.c mtry
7136
a0d0e21e
LW
7137: see if fchmod exists
7138set fchmod d_fchmod
7139eval $inlibc
7140
7141: see if fchown exists
7142set fchown d_fchown
7143eval $inlibc
7144
7145: see if this is an fcntl system
7146set fcntl d_fcntl
7147eval $inlibc
7148
7149: see if fgetpos exists
7150set fgetpos d_fgetpos
7151eval $inlibc
7152
a0d0e21e
LW
7153: see if flock exists
7154set flock d_flock
7155eval $inlibc
7156
a0d0e21e
LW
7157: see if fork exists
7158set fork d_fork
7159eval $inlibc
7160
7161: see if pathconf exists
7162set pathconf d_pathconf
7163eval $inlibc
7164
7165: see if fpathconf exists
7166set fpathconf d_fpathconf
7167eval $inlibc
7168
7169: see if fsetpos exists
7170set fsetpos d_fsetpos
7171eval $inlibc
7172
693762b4
AD
7173: see if gethostbyaddr exists
7174set gethostbyaddr d_gethbyaddr
7175eval $inlibc
7176
7177: see if gethostbyname exists
7178set gethostbyname d_gethbyname
7179eval $inlibc
7180
a0d0e21e
LW
7181: see if gethostent exists
7182set gethostent d_gethent
7183eval $inlibc
7184
dc45a647
MB
7185hasproto='varname=$1; func=$2; shift; shift;
7186while $test $# -ge 2; do
7187 case "$1" in
7188 $define) echo "#include <$2>";;
7189 esac ;
7190 shift 2;
7191done > try.c;
7192$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
7193if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
7194 echo "$func() prototype found.";
7195 val="$define";
7196else
7197 echo "$func() prototype NOT found.";
7198 val="$undef";
7199fi;
7200set $varname;
7201eval $setvar;
7202$rm -f try.c tryout.c'
7203
7204: see if this is a netdb.h system
7205set netdb.h i_netdb
7206eval $inhdr
7207
7208: see if prototypes for various gethostxxx netdb.h functions are available
7209echo " "
7210set d_gethostprotos gethostent $i_netdb netdb.h
7211eval $hasproto
7212
a0d0e21e
LW
7213: see if getlogin exists
7214set getlogin d_getlogin
7215eval $inlibc
7216
693762b4
AD
7217: see if getnetbyaddr exists
7218set getnetbyaddr d_getnbyaddr
7219eval $inlibc
7220
7221: see if getnetbyname exists
7222set getnetbyname d_getnbyname
7223eval $inlibc
7224
e5c9fcd0
AD
7225: see if getnetent exists
7226set getnetent d_getnent
7227eval $inlibc
7228
dc45a647
MB
7229: see if prototypes for various getnetxxx netdb.h functions are available
7230echo " "
7231set d_getnetprotos getnetent $i_netdb netdb.h
7232eval $hasproto
7233
693762b4
AD
7234
7235: see if getprotobyname exists
7236set getprotobyname d_getpbyname
7237eval $inlibc
7238
7239: see if getprotobynumber exists
7240set getprotobynumber d_getpbynumber
7241eval $inlibc
e5c9fcd0
AD
7242
7243: see if getprotoent exists
7244set getprotoent d_getpent
7245eval $inlibc
7246
2afac517 7247: see if getpgid exists
7248set getpgid d_getpgid
a0d0e21e
LW
7249eval $inlibc
7250
7251: see if getpgrp2 exists
7252set getpgrp2 d_getpgrp2
7253eval $inlibc
7254
7255: see if getppid exists
7256set getppid d_getppid
7257eval $inlibc
7258
7259: see if getpriority exists
7260set getpriority d_getprior
7261eval $inlibc
7262
dc45a647
MB
7263: see if prototypes for various getprotoxxx netdb.h functions are available
7264echo " "
7265set d_getprotoprotos getprotoent $i_netdb netdb.h
7266eval $hasproto
7267
693762b4
AD
7268: see if getservbyname exists
7269set getservbyname d_getsbyname
7270eval $inlibc
7271
7272: see if getservbyport exists
7273set getservbyport d_getsbyport
7274eval $inlibc
e5c9fcd0
AD
7275
7276: see if getservent exists
7277set getservent d_getsent
7278eval $inlibc
7279
dc45a647
MB
7280: see if prototypes for various getservxxx netdb.h functions are available
7281echo " "
7282set d_getservprotos getservent $i_netdb netdb.h
7283eval $hasproto
7284
5f05dabc 7285: see if gettimeofday or ftime exists
7286set gettimeofday d_gettimeod
7287eval $inlibc
7288case "$d_gettimeod" in
7289"$undef")
7290 set ftime d_ftime
7291 eval $inlibc
7292 ;;
7293*)
7294 val="$undef"; set d_ftime; eval $setvar
7295 ;;
7296esac
7297case "$d_gettimeod$d_ftime" in
7298"$undef$undef")
7299 echo " "
7300 echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
7301 ;;
7302esac
7303
a0d0e21e
LW
7304: see if this is a netinet/in.h or sys/in.h system
7305set netinet/in.h i_niin sys/in.h i_sysin
7306eval $inhdr
7307
28e8609d 7308: see if this is an arpa/inet.h
93341792 7309set arpa/inet.h i_arpainet
28e8609d
JH
7310eval $inhdr
7311
a0d0e21e
LW
7312: see if htonl --and friends-- exists
7313val=''
7314set htonl val
7315eval $inlibc
7316
7317: Maybe they are macros.
7318case "$val" in
7319$undef)
7320 $cat >htonl.c <<EOM
7321#include <stdio.h>
7322#include <sys/types.h>
7323#$i_niin I_NETINET_IN
7324#$i_sysin I_SYS_IN
93341792 7325#$i_arpainet I_ARPA_INET
a0d0e21e
LW
7326#ifdef I_NETINET_IN
7327#include <netinet/in.h>
7328#endif
7329#ifdef I_SYS_IN
7330#include <sys/in.h>
7331#endif
28e8609d
JH
7332#ifdef I_ARPA_INET
7333#include <arpa/inet.h>
7334#endif
a0d0e21e
LW
7335#ifdef htonl
7336printf("Defined as a macro.");
7337#endif
7338EOM
7339 $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
7340 if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
7341 val="$define"
7342 echo "But it seems to be defined as a macro." >&4
7343 fi
7344 $rm -f htonl.?
7345 ;;
7346esac
7347set d_htonl
7348eval $setvar
7349
7350: see which of string.h or strings.h is needed
7351echo " "
7352strings=`./findhdr string.h`
7353if $test "$strings" && $test -r "$strings"; then
7354 echo "Using <string.h> instead of <strings.h>." >&4
7355 val="$define"
7356else
7357 val="$undef"
7358 strings=`./findhdr strings.h`
7359 if $test "$strings" && $test -r "$strings"; then
7360 echo "Using <strings.h> instead of <string.h>." >&4
7361 else
7362 echo "No string header found -- You'll surely have problems." >&4
7363 fi
7364fi
7365set i_string
7366eval $setvar
7367case "$i_string" in
7368"$undef") strings=`./findhdr strings.h`;;
7369*) strings=`./findhdr string.h`;;
7370esac
7371
7372: index or strchr
7373echo " "
7374if set index val -f; eval $csym; $val; then
7375 if set strchr val -f d_strchr; eval $csym; $val; then
7376 if $contains strchr "$strings" >/dev/null 2>&1 ; then
7377 val="$define"
7378 vali="$undef"
7379 echo "strchr() found." >&4
7380 else
7381 val="$undef"
7382 vali="$define"
7383 echo "index() found." >&4
7384 fi
7385 else
7386 val="$undef"
7387 vali="$define"
7388 echo "index() found." >&4
7389 fi
7390else
7391 if set strchr val -f d_strchr; eval $csym; $val; then
7392 val="$define"
7393 vali="$undef"
7394 echo "strchr() found." >&4
7395 else
7396 echo "No index() or strchr() found!" >&4
7397 val="$undef"
7398 vali="$undef"
7399 fi
7400fi
7401set d_strchr; eval $setvar
7402val="$vali"
7403set d_index; eval $setvar
7404
7e1af8bc 7405: check whether inet_aton exists
7406set inet_aton d_inetaton
7407eval $inlibc
7408
a0d0e21e
LW
7409: Look for isascii
7410echo " "
7411$cat >isascii.c <<'EOCP'
7412#include <stdio.h>
7413#include <ctype.h>
7414main() {
7415 int c = 'A';
7416 if (isascii(c))
7417 exit(0);
7418 else
7419 exit(1);
7420}
7421EOCP
dfe9444c
AD
7422set isascii
7423if eval $compile; then
a0d0e21e
LW
7424 echo "isascii() found." >&4
7425 val="$define"
7426else
7427 echo "isascii() NOT found." >&4
7428 val="$undef"
7429fi
7430set d_isascii
7431eval $setvar
7432$rm -f isascii*
7433
7434: see if killpg exists
7435set killpg d_killpg
7436eval $inlibc
7437
dd64f1c3
AD
7438: see if lchown exists
7439echo " "
7440$cat > try.c <<'EOCP'
7441/* System header to define __stub macros and hopefully few prototypes,
7442 which can conflict with char lchown(); below. */
7443#include <assert.h>
7444/* Override any gcc2 internal prototype to avoid an error. */
7445/* We use char because int might match the return type of a gcc2
7446 builtin and then its argument prototype would still apply. */
7447char lchown();
7448int main() {
7449 /* The GNU C library defines this for functions which it implements
7450 to always fail with ENOSYS. Some functions are actually named
7451 something starting with __ and the normal name is an alias. */
7452#if defined (__stub_lchown) || defined (__stub___lchown)
7453choke me
7454#else
7455lchown();
7456#endif
7457; return 0; }
7458EOCP
7459set try
7460if eval $compile; then
7461 $echo "lchown() found." >&4
7462 val="$define"
7463else
7464 $echo "lchown() NOT found." >&4
7465 val="$undef"
7466fi
7467set d_lchown
7468eval $setvar
7469
a0d0e21e
LW
7470: see if link exists
7471set link d_link
7472eval $inlibc
7473
a0d0e21e
LW
7474: see if localeconv exists
7475set localeconv d_locconv
7476eval $inlibc
7477
7478: see if lockf exists
7479set lockf d_lockf
7480eval $inlibc
7481
e5c9fcd0
AD
7482: check for long doubles
7483echo " "
7484echo $n "Checking to see if your system supports long doubles...$c" >&4
7485echo 'long double foo() { long double x; x = 7.0; return x; }' > try.c
dc45a647 7486if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
e5c9fcd0
AD
7487 val="$define"
7488 echo " Yup, it does." >&4
7489else
7490 val="$undef"
7491 echo " Nope, it doesn't." >&4
7492fi
7493$rm try.*
7494set d_longdbl
7495eval $setvar
7496
7497: check for length of long double
e5c9fcd0
AD
7498case "${d_longdbl}${longdblsize}" in
7499$define)
dc45a647 7500 echo " "
e5c9fcd0
AD
7501 $echo $n "Checking to see how big your long doubles are...$c" >&4
7502 $cat >try.c <<'EOCP'
7503#include <stdio.h>
7504main()
7505{
7506 printf("%d\n", sizeof(long double));
7507}
7508EOCP
7509 set try
c4f23d77 7510 if eval $compile; then
e5c9fcd0 7511 longdblsize=`./try`
dc45a647 7512 $echo " $longdblsize bytes." >&4
e5c9fcd0
AD
7513 else
7514 dflt='8'
dc45a647 7515 echo " "
c4f23d77 7516 echo "(I can't seem to compile the test program. Guessing...)" >&4
e5c9fcd0
AD
7517 rp="What is the size of a long double (in bytes)?"
7518 . ./myread
7519 longdblsize="$ans"
7520 fi
dc45a647
MB
7521 ;;
7522esac
7523$rm -f try.c try
7524
7525: check for long long
7526echo " "
7527echo $n "Checking to see if your system supports long long...$c" >&4
7528echo 'long long foo() { long long x; x = 7; return x; }' > try.c
7529if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
7530 val="$define"
7531 echo " Yup, it does." >&4
7532else
7533 val="$undef"
7534 echo " Nope, it doesn't." >&4
7535fi
7536$rm try.*
7537set d_longlong
7538eval $setvar
7539
7540: check for length of long long
7541case "${d_longlong}${longlongsize}" in
7542$define)
7543 echo " "
7544 $echo $n "Checking to see how big your long longs are...$c" >&4
7545 $cat >try.c <<'EOCP'
7546#include <stdio.h>
7547main()
7548{
7549 printf("%d\n", sizeof(long long));
7550}
7551EOCP
7552 set try
7553 if eval $compile_ok; then
7554 longlongsize=`./try`
7555 $echo " $longlongsize bytes." >&4
7556 else
7557 dflt='8'
7558 echo " "
7559 echo "(I can't seem to compile the test program. Guessing...)"
7560 rp="What is the size of a long long (in bytes)?"
7561 . ./myread
7562 longlongsize="$ans"
7563 fi
e5c9fcd0
AD
7564 ;;
7565esac
7566$rm -f try.c try
7567
a0d0e21e
LW
7568: see if lstat exists
7569set lstat d_lstat
7570eval $inlibc
7571
7572: see if mblen exists
7573set mblen d_mblen
7574eval $inlibc
7575
7576: see if mbstowcs exists
7577set mbstowcs d_mbstowcs
7578eval $inlibc
7579
7580: see if mbtowc exists
7581set mbtowc d_mbtowc
7582eval $inlibc
7583
7584: see if memcmp exists
7585set memcmp d_memcmp
7586eval $inlibc
7587
7588: see if memcpy exists
7589set memcpy d_memcpy
7590eval $inlibc
7591
7592: see if memmove exists
7593set memmove d_memmove
2304df62
AD
7594eval $inlibc
7595
7596: see if memset exists
7597set memset d_memset
7598eval $inlibc
7599
7600: see if mkdir exists
7601set mkdir d_mkdir
7602eval $inlibc
7603
a0d0e21e
LW
7604: see if mkfifo exists
7605set mkfifo d_mkfifo
7606eval $inlibc
7607
7608: see if mktime exists
7609set mktime d_mktime
7610eval $inlibc
7611
2304df62
AD
7612: see if msgctl exists
7613set msgctl d_msgctl
7614eval $inlibc
7615
7616: see if msgget exists
7617set msgget d_msgget
7618eval $inlibc
7619
7620: see if msgsnd exists
7621set msgsnd d_msgsnd
7622eval $inlibc
7623
7624: see if msgrcv exists
7625set msgrcv d_msgrcv
7626eval $inlibc
7627
7628: see how much of the 'msg*(2)' library is present.
7629h_msg=true
7630echo " "
7631case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
7632*"$undef"*) h_msg=false;;
7633esac
7634: we could also check for sys/ipc.h ...
7635if $h_msg && $test `./findhdr sys/msg.h`; then
7636 echo "You have the full msg*(2) library." >&4
7637 val="$define"
7638else
7639 echo "You don't have the full msg*(2) library." >&4
7640 val="$undef"
7641fi
7642set d_msg
7643eval $setvar
7644
dfe9444c
AD
7645: see if nice exists
7646set nice d_nice
7647eval $inlibc
7648
7649: see if pause exists
7650set pause d_pause
7651eval $inlibc
7652
7653: see if pipe exists
7654set pipe d_pipe
7655eval $inlibc
7656
7657: see if poll exists
7658set poll d_poll
7659eval $inlibc
7660
7661
7662: see whether the various POSIXish _yields exist within given cccmd
7663$cat >try.c <<EOP
7664#include <pthread.h>
7665main() {
7666 YIELD();
7667 exit(0);
7668}
7669EOP
7670: see if pthread_yield exists within given cccmd,
7671: if we do not usethreads this may well end up undef.
7672set try -DYIELD=pthread_yield
7673if eval $compile; then
7674 val="$define"
7675 echo 'pthread_yield() found.' >&4
7676else
7677 val="$undef"
7678 echo 'pthread_yield() NOT found.' >&4
7679fi
7680set d_pthread_yield
7681eval $setvar
7682
7683: see if sched_yield exists within given cccmd,
7684: if we do not usethreads this may well end up undef.
7685set try -DYIELD=sched_yield
7686if eval $compile; then
7687 val="$define"
7688 echo 'sched_yield() found.' >&4
7689else
7690 val="$undef"
7691 echo 'sched_yield() NOT found.' >&4
7692fi
7693set d_sched_yield
7694eval $setvar
7695$rm -f try try.*
7696
7697: test whether pthreads are created in joinable -- aka undetached -- state
e5c9fcd0
AD
7698if test "X$usethreads" = "X$define"; then
7699 echo $n "Checking whether pthreads are created joinable. $c" >&4
dfe9444c
AD
7700 $cat >try.c <<'EOCP'
7701#include <pthread.h>
7702#include <stdio.h>
7703int main() {
7704 pthread_attr_t attr;
7705 int detachstate;
7706 printf("%s\n",
7707 pthread_attr_init(&attr) == 0 &&
7708 pthread_attr_getdetachstate(&attr, &detachstate) == 0 &&
7709 detachstate == PTHREAD_CREATE_DETACHED ?
7710 "detached" : "joinable");
7711 exit(0);
7712}
7713EOCP
7714 set try
7715 if eval $compile; then
7716 yyy=`./try`
7717 case "$yyy" in
e5c9fcd0
AD
7718 detached) echo "Nope, they aren't." >&4 ;;
7719 *) echo "Yup, they are." >&4 ;;
dfe9444c
AD
7720 esac
7721 else
e5c9fcd0
AD
7722 echo " "
7723 echo "(I can't execute the test program--assuming they are.)" >&4
dfe9444c 7724 yyy=joinable
94b6baf5 7725 fi
dfe9444c
AD
7726 $rm -f try try.*
7727 case "$yyy" in
7728 detached) val="$undef" ;;
7729 *) val="$define" ;;
7730 esac
7731 set d_pthreads_created_joinable
7732 eval $setvar
7733else
7734 d_pthreads_created_joinable="$undef"
7735fi
8e07c86e 7736
4aa0a1f7
AD
7737: see if this is a pwd.h system
7738set pwd.h i_pwd
7739eval $inhdr
7740
7741case "$i_pwd" in
7742$define)
28e8609d
JH
7743 : see if setpwent exists
7744 set setpwent d_setpwent
7745 eval $inlibc
7746
7747 : see if getpwent exists
7748 set getpwent d_getpwent
7749 eval $inlibc
7750
7751 : see if endpwent exists
7752 set endpwent d_endpwent
7753 eval $inlibc
7754
4aa0a1f7 7755 xxx=`./findhdr pwd.h`
85e6fe83 7756 $cppstdin $cppflags $cppminus < $xxx >$$.h
4aa0a1f7 7757
2304df62 7758 if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
4aa0a1f7 7759 val="$define"
2304df62 7760 else
4aa0a1f7 7761 val="$undef"
2304df62 7762 fi
4aa0a1f7
AD
7763 set d_pwquota
7764 eval $setvar
7765
2304df62 7766 if $contains 'pw_age' $$.h >/dev/null 2>&1; then
4aa0a1f7 7767 val="$define"
2304df62 7768 else
4aa0a1f7 7769 val="$undef"
2304df62 7770 fi
4aa0a1f7
AD
7771 set d_pwage
7772 eval $setvar
7773
2304df62 7774 if $contains 'pw_change' $$.h >/dev/null 2>&1; then
4aa0a1f7 7775 val="$define"
2304df62 7776 else
4aa0a1f7 7777 val="$undef"
2304df62 7778 fi
4aa0a1f7
AD
7779 set d_pwchange
7780 eval $setvar
7781
2304df62 7782 if $contains 'pw_class' $$.h >/dev/null 2>&1; then
4aa0a1f7 7783 val="$define"
2304df62 7784 else
4aa0a1f7 7785 val="$undef"
2304df62 7786 fi
4aa0a1f7
AD
7787 set d_pwclass
7788 eval $setvar
7789
2304df62 7790 if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
4aa0a1f7 7791 val="$define"
2304df62 7792 else
4aa0a1f7 7793 val="$undef"
2304df62 7794 fi
4aa0a1f7
AD
7795 set d_pwexpire
7796 eval $setvar
7797
2304df62 7798 if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
4aa0a1f7 7799 val="$define"
2304df62 7800 else
4aa0a1f7 7801 val="$undef"
2304df62 7802 fi
4aa0a1f7
AD
7803 set d_pwcomment
7804 eval $setvar
7805
c4f23d77
AD
7806 if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
7807 val="$define"
7808 else
7809 val="$undef"
7810 fi
7811 set d_pwgecos
7812 eval $setvar
7813
28e8609d
JH
7814 if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
7815 val="$define"
7816 else
7817 val="$undef"
7818 fi
7819 set d_pwpasswd
7820 eval $setvar
7821
2304df62 7822 $rm -f $$.h
4aa0a1f7 7823 ;;
28e8609d 7824*) # Assume all is lost as far as the d_*pw* go.
4aa0a1f7 7825 val="$undef";
28e8609d
JH
7826 set d_setpwent; eval $setvar
7827 set d_getpwent; eval $setvar
7828 set d_endpwent; eval $setvar
4aa0a1f7
AD
7829 set d_pwquota; eval $setvar
7830 set d_pwage; eval $setvar
7831 set d_pwchange; eval $setvar
7832 set d_pwclass; eval $setvar
7833 set d_pwexpire; eval $setvar
7834 set d_pwcomment; eval $setvar
c4f23d77 7835 set d_pwgecos; eval $setvar
28e8609d 7836 set d_pwpasswd; eval $setvar
4aa0a1f7
AD
7837 ;;
7838esac
2304df62 7839
85e6fe83 7840: see if readdir and friends exist
2304df62
AD
7841set readdir d_readdir
7842eval $inlibc
85e6fe83
LW
7843set seekdir d_seekdir
7844eval $inlibc
7845set telldir d_telldir
7846eval $inlibc
7847set rewinddir d_rewinddir
7848eval $inlibc
2304df62 7849
a0d0e21e
LW
7850: see if readlink exists
7851set readlink d_readlink
7852eval $inlibc
7853
2304df62
AD
7854: see if rename exists
7855set rename d_rename
7856eval $inlibc
7857
7858: see if rmdir exists
7859set rmdir d_rmdir
7860eval $inlibc
7861
8ff267be 7862: see if memory.h is available.
7863val=''
7864set memory.h val
7865eval $inhdr
7866
7867: See if it conflicts with string.h
7868case "$val" in
7869$define)
7870 case "$strings" in
7871 '') ;;
7872 *)
7873 $cppstdin $cppflags $cppminus < $strings > mem.h
7874 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
7875 echo " "
7876 echo "We won't be including <memory.h>."
7877 val="$undef"
7878 fi
7879 $rm -f mem.h
7880 ;;
7881 esac
7882esac
7883set i_memory
7884eval $setvar
7885
2304df62
AD
7886: can bcopy handle overlapping blocks?
7887val="$undef"
7888case "$d_bcopy" in
7889"$define")
7890 echo " "
7891 echo "Checking to see if your bcopy() can do overlapping copies..." >&4
dfe9444c 7892 $cat >try.c <<EOCP
8ff267be 7893#$i_memory I_MEMORY
7894#$i_stdlib I_STDLIB
7895#$i_string I_STRING
7896#$i_unistd I_UNISTD
7897EOCP
dfe9444c 7898 $cat >>try.c <<'EOCP'
8ff267be 7899#include <stdio.h>
8ff267be 7900#ifdef I_MEMORY
7901# include <memory.h>
7902#endif
7903#ifdef I_STDLIB
7904# include <stdlib.h>
7905#endif
7906#ifdef I_STRING
7907# include <string.h>
7908#else
7909# include <strings.h>
7910#endif
7911#ifdef I_UNISTD
7912# include <unistd.h> /* Needed for NetBSD */
7913#endif
2304df62
AD
7914main()
7915{
85e6fe83
LW
7916char buf[128], abc[128];
7917char *b;
7918int len;
7919int off;
7920int align;
a0d0e21e 7921
85e6fe83 7922bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
2304df62
AD
7923
7924for (align = 7; align >= 0; align--) {
7925 for (len = 36; len; len--) {
7926 b = buf+align;
85e6fe83 7927 bcopy(abc, b, len);
2304df62
AD
7928 for (off = 1; off <= len; off++) {
7929 bcopy(b, b+off, len);
7930 bcopy(b+off, b, len);
85e6fe83 7931 if (bcmp(b, abc, len))
2304df62
AD
7932 exit(1);
7933 }
7934 }
7935}
7936exit(0);
7937}
7938EOCP
dfe9444c 7939 set try
dc45a647 7940 if eval $compile_ok; then
dfe9444c 7941 if ./try 2>/dev/null; then
2304df62
AD
7942 echo "Yes, it can."
7943 val="$define"
7944 else
7945 echo "It can't, sorry."
8ff267be 7946 case "$d_memmove" in
7947 "$define") echo "But that's Ok since you have memmove()." ;;
7948 esac
2304df62
AD
7949 fi
7950 else
7951 echo "(I can't compile the test program, so we'll assume not...)"
8ff267be 7952 case "$d_memmove" in
7953 "$define") echo "But that's Ok since you have memmove()." ;;
7954 esac
2304df62
AD
7955 fi
7956 ;;
7957esac
dfe9444c 7958$rm -f try.* try core
2304df62
AD
7959set d_safebcpy
7960eval $setvar
7961
7962: can memcpy handle overlapping blocks?
7963val="$undef"
7964case "$d_memcpy" in
7965"$define")
7966 echo " "
7967 echo "Checking to see if your memcpy() can do overlapping copies..." >&4
dfe9444c 7968 $cat >try.c <<EOCP
8ff267be 7969#$i_memory I_MEMORY
7970#$i_stdlib I_STDLIB
7971#$i_string I_STRING
7972#$i_unistd I_UNISTD
7973EOCP
dfe9444c 7974 $cat >>try.c <<'EOCP'
8ff267be 7975#include <stdio.h>
8ff267be 7976#ifdef I_MEMORY
7977# include <memory.h>
7978#endif
7979#ifdef I_STDLIB
7980# include <stdlib.h>
7981#endif
7982#ifdef I_STRING
7983# include <string.h>
7984#else
7985# include <strings.h>
7986#endif
7987#ifdef I_UNISTD
7988# include <unistd.h> /* Needed for NetBSD */
7989#endif
2304df62
AD
7990main()
7991{
85e6fe83
LW
7992char buf[128], abc[128];
7993char *b;
7994int len;
7995int off;
7996int align;
7997
8ff267be 7998/* Copy "abcde..." string to char abc[] so that gcc doesn't
7999 try to store the string in read-only memory. */
85e6fe83 8000memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
2304df62
AD
8001
8002for (align = 7; align >= 0; align--) {
8003 for (len = 36; len; len--) {
8004 b = buf+align;
232e078e 8005 memcpy(b, abc, len);
2304df62 8006 for (off = 1; off <= len; off++) {
2304df62 8007 memcpy(b+off, b, len);
232e078e 8008 memcpy(b, b+off, len);
85e6fe83 8009 if (memcmp(b, abc, len))
2304df62
AD
8010 exit(1);
8011 }
8012 }
8013}
8014exit(0);
8015}
8016EOCP
dfe9444c 8017 set try
dc45a647 8018 if eval $compile_ok; then
dfe9444c 8019 if ./try 2>/dev/null; then
2304df62
AD
8020 echo "Yes, it can."
8021 val="$define"
8022 else
8023 echo "It can't, sorry."
8ff267be 8024 case "$d_memmove" in
8025 "$define") echo "But that's Ok since you have memmove()." ;;
8026 esac
2304df62
AD
8027 fi
8028 else
8029 echo "(I can't compile the test program, so we'll assume not...)"
8ff267be 8030 case "$d_memmove" in
8031 "$define") echo "But that's Ok since you have memmove()." ;;
8032 esac
2304df62
AD
8033 fi
8034 ;;
8035esac
dfe9444c 8036$rm -f try.* try core
2304df62
AD
8037set d_safemcpy
8038eval $setvar
8039
36477c24 8040: can memcmp be trusted to compare relative magnitude?
8041val="$undef"
8042case "$d_memcmp" in
8043"$define")
8044 echo " "
dfe9444c
AD
8045 echo "Checking if your memcmp() can compare relative magnitude..." >&4
8046 $cat >try.c <<EOCP
36477c24 8047#$i_memory I_MEMORY
8048#$i_stdlib I_STDLIB
8049#$i_string I_STRING
8050#$i_unistd I_UNISTD
8051EOCP
dfe9444c 8052 $cat >>try.c <<'EOCP'
36477c24 8053#include <stdio.h>
36477c24 8054#ifdef I_MEMORY
8055# include <memory.h>
8056#endif
8057#ifdef I_STDLIB
8058# include <stdlib.h>
8059#endif
8060#ifdef I_STRING
8061# include <string.h>
8062#else
8063# include <strings.h>
8064#endif
8065#ifdef I_UNISTD
8066# include <unistd.h> /* Needed for NetBSD */
8067#endif
8068main()
8069{
8070char a = -1;
8071char b = 0;
8072if ((a < b) && memcmp(&a, &b, 1) < 0)
8073 exit(1);
8074exit(0);
8075}
8076EOCP
dfe9444c 8077 set try
dc45a647 8078 if eval $compile_ok; then
dfe9444c 8079 if ./try 2>/dev/null; then
36477c24 8080 echo "Yes, it can."
8081 val="$define"
8082 else
8083 echo "No, it can't (it uses signed chars)."
8084 fi
8085 else
8086 echo "(I can't compile the test program, so we'll assume not...)"
8087 fi
8088 ;;
8089esac
dfe9444c 8090$rm -f try.* try core
36477c24 8091set d_sanemcmp
8092eval $setvar
8093
2304df62
AD
8094: see if select exists
8095set select d_select
8096eval $inlibc
8097
8098: see if semctl exists
8099set semctl d_semctl
8100eval $inlibc
8101
8102: see if semget exists
8103set semget d_semget
8104eval $inlibc
8105
8106: see if semop exists
8107set semop d_semop
8108eval $inlibc
8109
8110: see how much of the 'sem*(2)' library is present.
8111h_sem=true
8112echo " "
8113case "$d_semctl$d_semget$d_semop" in
8114*"$undef"*) h_sem=false;;
8115esac
8116: we could also check for sys/ipc.h ...
8117if $h_sem && $test `./findhdr sys/sem.h`; then
8118 echo "You have the full sem*(2) library." >&4
8119 val="$define"
8120else
8121 echo "You don't have the full sem*(2) library." >&4
8122 val="$undef"
8123fi
8124set d_sem
8125eval $setvar
8126
bd89102f
AD
8127: see whether sys/sem.h defines union semun
8128echo " "
8129$cat > try.c <<'END'
8130#include <sys/types.h>
8131#include <sys/ipc.h>
8132#include <sys/sem.h>
8133int main () { union semun semun; semun.buf = 0; }
8134END
8135set try
8136if eval $compile; then
8137 echo "You have union semun in <sys/sem.h>." >&4
8138 val="$define"
8139else
8140 echo "You do not have union semun in <sys/sem.h>." >&4
8141 val="$undef"
8142fi
8143$rm -f try try.c
8144set d_union_semun
8145eval $setvar
8146
8147: see how to do semctl IPC_STAT
8148case "$d_sem" in
8149$define)
8150 : see whether semctl IPC_STAT can use union semun
8151 echo " "
8152 $cat > try.c <<END
8153#include <sys/types.h>
8154#include <sys/ipc.h>
8155#include <sys/sem.h>
8156#include <sys/stat.h>
8157#include <stdio.h>
8158#include <errno.h>
8159#ifndef errno
8160extern int errno;
8161#endif
8162#$d_union_semun HAS_UNION_SEMUN
8163int main() {
8164 union semun
8165#ifndef HAS_UNION_SEMUN
8166 {
8167 int val;
8168 struct semid_ds *buf;
8169 unsigned short *array;
8170 }
8171#endif
8172 arg;
8173 int sem, st;
8174
8175#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
8176 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
8177 if (sem > -1) {
8178 struct semid_ds argbuf;
8179 arg.buf = &argbuf;
8180# ifdef IPC_STAT
8181 st = semctl(sem, 0, IPC_STAT, arg);
8182 if (st == 0)
8183 printf("semun\n");
8184 else
8185# endif /* IPC_STAT */
8186 printf("semctl IPC_STAT failed: errno = %d\n", errno);
8187# ifdef IPC_RMID
8188 if (semctl(sem, 0, IPC_RMID, arg) != 0)
8189# endif /* IPC_RMID */
8190 printf("semctl IPC_RMID failed: errno = %d\n", errno);
8191 } else
8192#endif /* IPC_PRIVATE && ... */
8193 printf("semget failed: errno = %d\n", errno);
8194 return 0;
8195}
8196END
8197 val="$undef"
8198 set try
8199 if eval $compile; then
8200 xxx=`./try`
8201 case "$xxx" in
8202 semun) val="$define" ;;
8203 esac
8204 fi
8205 $rm -f try try.c
8206 set d_semctl_semun
8207 eval $setvar
8208 case "$d_semctl_semun" in
8209 $define)
8210 echo "You can use union semun for semctl IPC_STAT." >&4
8211 also='also'
8212 ;;
8213 *) echo "You cannot use union semun for semctl IPC_STAT." >&4
8214 also=''
8215 ;;
8216 esac
8217
8218 : see whether semctl IPC_STAT can use struct semid_ds pointer
8219 $cat > try.c <<'END'
8220#include <sys/types.h>
8221#include <sys/ipc.h>
8222#include <sys/sem.h>
8223#include <sys/stat.h>
8224#include <stdio.h>
8225#include <errno.h>
8226#ifndef errno
8227extern int errno;
8228#endif
8229int main() {
8230 struct semid_ds arg;
8231 int sem, st;
8232
8233#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
8234 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
8235 if (sem > -1) {
8236# ifdef IPC_STAT
8237 st = semctl(sem, 0, IPC_STAT, &arg);
8238 if (st == 0)
8239 printf("semid_ds\n");
8240 else
8241# endif /* IPC_STAT */
8242 printf("semctl IPC_STAT failed: errno = %d\n", errno);
8243# ifdef IPC_RMID
8244 if (semctl(sem, 0, IPC_RMID, &arg) != 0)
8245# endif /* IPC_RMID */
8246 printf("semctl IPC_RMID failed: errno = %d\n", errno);
8247 } else
8248#endif /* IPC_PRIVATE && ... */
8249 printf("semget failed: errno = %d\n", errno);
8250
8251 return 0;
8252}
8253END
8254 val="$undef"
8255 set try
8256 if eval $compile; then
8257 xxx=`./try`
8258 case "$xxx" in
8259 semid_ds) val="$define" ;;
8260 esac
8261 fi
8262 $rm -f try try.c
8263 set d_semctl_semid_ds
8264 eval $setvar
8265 case "$d_semctl_semid_ds" in
8266 $define)
8267 echo "You can $also use struct semid_ds * for semctl IPC_STAT." >&4
8268 ;;
8269 *) echo "You cannot use struct semid_ds * for semctl IPC_STAT." >&4
8270 ;;
8271 esac
8272 ;;
8273*) val="$undef"
8274
8275 # We do not have the full sem*(2) library, so assume we can not
8276 # use either.
8277
8278 set d_semctl_semun
8279 eval $setvar
8280
8281 set d_semctl_semid_ds
8282 eval $setvar
8283 ;;
8284esac
8285
2304df62
AD
8286: see if setegid exists
8287set setegid d_setegid
8288eval $inlibc
8289
8290: see if seteuid exists
8291set seteuid d_seteuid
8292eval $inlibc
8293
693762b4
AD
8294: see if sethostent exists
8295set sethostent d_sethent
8296eval $inlibc
8297
a0d0e21e
LW
8298: see if setlinebuf exists
8299set setlinebuf d_setlinebuf
8300eval $inlibc
8301
2304df62
AD
8302: see if setlocale exists
8303set setlocale d_setlocale
8304eval $inlibc
a0d0e21e 8305
e5c9fcd0
AD
8306: see if setnetent exists
8307set setnetent d_setnent
8308eval $inlibc
8309
8310: see if setprotoent exists
8311set setprotoent d_setpent
8312eval $inlibc
8313
2304df62
AD
8314: see if setpgid exists
8315set setpgid d_setpgid
8316eval $inlibc
8317
2304df62
AD
8318: see if setpgrp2 exists
8319set setpgrp2 d_setpgrp2
8320eval $inlibc
8321
8322: see if setpriority exists
8323set setpriority d_setprior
8324eval $inlibc
8325
8326: see if setregid exists
8327set setregid d_setregid
8328eval $inlibc
8329set setresgid d_setresgid
8330eval $inlibc
8331
8332: see if setreuid exists
8333set setreuid d_setreuid
8334eval $inlibc
8335set setresuid d_setresuid
8336eval $inlibc
8337
8338: see if setrgid exists
8339set setrgid d_setrgid
8340eval $inlibc
8341
8342: see if setruid exists
8343set setruid d_setruid
8344eval $inlibc
8345
e5c9fcd0
AD
8346: see if setservent exists
8347set setservent d_setsent
8348eval $inlibc
8349
2304df62
AD
8350: see if setsid exists
8351set setsid d_setsid
8352eval $inlibc
8353
e5c9fcd0
AD
8354: see if setvbuf exists
8355set setvbuf d_setvbuf
8356eval $inlibc
8357
760ac839
LW
8358: see if sfio.h is available
8359set sfio.h i_sfio
8360eval $inhdr
8361
8362
8ff267be 8363: see if sfio library is available
760ac839
LW
8364case "$i_sfio" in
8365$define)
8366 val=''
8367 set sfreserve val
8368 eval $inlibc
8369 ;;
8370*)
8371 val="$undef"
8372 ;;
8373esac
8ff267be 8374: Ok, but do we want to use it.
760ac839
LW
8375case "$val" in
8376$define)
8377 case "$usesfio" in
8ff267be 8378 true|$define|[yY]*) dflt='y';;
760ac839
LW
8379 *) dflt='n';;
8380 esac
8ff267be 8381 echo "$package can use the sfio library, but it is experimental."
760ac839
LW
8382 rp="You seem to have sfio available, do you want to try using it?"
8383 . ./myread
8384 case "$ans" in
8ff267be 8385 y|Y) ;;
8386 *) echo "Ok, avoiding sfio this time. I'll use stdio instead."
760ac839 8387 val="$undef"
ff0cee69 8388 : Remove sfio from list of libraries to use
8389 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
8390 shift
8391 libs="$*"
8392 echo "libs = $libs" >&4
760ac839
LW
8393 ;;
8394 esac
8395 ;;
8ff267be 8396*) case "$usesfio" in
8397 true|$define|[yY]*)
8398 echo "Sorry, cannot find sfio on this machine" >&4
8399 echo "Ignoring your setting of usesfio=$usesfio" >&4
760ac839
LW
8400 ;;
8401 esac
8402 ;;
8403esac
8ff267be 8404set d_sfio
8405eval $setvar
760ac839
LW
8406case "$d_sfio" in
8407$define) usesfio='true';;
8408*) usesfio='false';;
8409esac
8410
2304df62
AD
8411: see if shmctl exists
8412set shmctl d_shmctl
8413eval $inlibc
8414
8415: see if shmget exists
8416set shmget d_shmget
8417eval $inlibc
8418
a0d0e21e
LW
8419: see if shmat exists
8420set shmat d_shmat
8421eval $inlibc
8422: see what shmat returns
8423case "$d_shmat" in
8424"$define")
8425 $cat >shmat.c <<'END'
8426#include <sys/shm.h>
8427void *shmat();
8428END
8429 if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
8430 shmattype='void *'
8431 else
8432 shmattype='char *'
8433 fi
8434 echo "and it returns ($shmattype)." >&4
8435 : see if a prototype for shmat is available
e50aee73
AD
8436 xxx=`./findhdr sys/shm.h`
8437 $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
a0d0e21e
LW
8438 if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
8439 val="$define"
8440 else
8441 val="$undef"
8442 fi
8443 $rm -f shmat.[co]
8444 ;;
8445*)
8446 val="$undef"
8447 ;;
8448esac
8449set d_shmatprototype
8450eval $setvar
8451
8452: see if shmdt exists
8453set shmdt d_shmdt
8454eval $inlibc
8455
8456: see how much of the 'shm*(2)' library is present.
8457h_shm=true
8458echo " "
8459case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
8460*"$undef"*) h_shm=false;;
8461esac
8462: we could also check for sys/ipc.h ...
8463if $h_shm && $test `./findhdr sys/shm.h`; then
8464 echo "You have the full shm*(2) library." >&4
8465 val="$define"
8466else
8467 echo "You don't have the full shm*(2) library." >&4
8468 val="$undef"
8469fi
8470set d_shm
8471eval $setvar
8472
2c7991dc 8473echo " "
8ff267be 8474: see if we have sigaction
8475if set sigaction val -f d_sigaction; eval $csym; $val; then
8476 echo 'sigaction() found.' >&4
dc45a647 8477 $cat > try.c <<'EOP'
8ff267be 8478#include <stdio.h>
8479#include <sys/types.h>
8480#include <signal.h>
8481main()
8482{
8483 struct sigaction act, oact;
8484}
8485EOP
dc45a647
MB
8486 set try
8487 if eval $compile_ok; then
8488 val="$define"
8489 else
8490 echo "But you don't seem to have a useable struct sigaction." >&4
8491 val="$undef"
8492 fi
8ff267be 8493else
dc45a647 8494 echo 'sigaction NOT found.' >&4
8ff267be 8495 val="$undef"
8496fi
8497set d_sigaction; eval $setvar
dfe9444c 8498$rm -f try try$_o try.c
2c7991dc 8499
a5f75d66
AD
8500: see if sigsetjmp exists
8501echo " "
8502case "$d_sigsetjmp" in
8503'')
dfe9444c 8504 $cat >try.c <<'EOP'
a5f75d66
AD
8505#include <setjmp.h>
8506sigjmp_buf env;
8507int set = 1;
8508main()
8509{
8510 if (sigsetjmp(env,1))
8511 exit(set);
8512 set = 0;
8513 siglongjmp(env, 1);
8514 exit(1);
8515}
8516EOP
dfe9444c
AD
8517 set try
8518 if eval $compile; then
8519 if ./try >/dev/null 2>&1; then
a5f75d66
AD
8520 echo "POSIX sigsetjmp found." >&4
8521 val="$define"
8522 else
760ac839 8523 $cat >&4 <<EOM
a5f75d66 8524Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
760ac839 8525I'll ignore them.
a5f75d66
AD
8526EOM
8527 val="$undef"
8528 fi
8529 else
760ac839 8530 echo "sigsetjmp not found." >&4
a5f75d66
AD
8531 val="$undef"
8532 fi
8533 ;;
8534*) val="$d_sigsetjmp"
8535 case "$d_sigsetjmp" in
8536 $define) echo "POSIX sigsetjmp found." >&4;;
760ac839 8537 $undef) echo "sigsetjmp not found." >&4;;
a5f75d66
AD
8538 esac
8539 ;;
8540esac
8541set d_sigsetjmp
8542eval $setvar
dfe9444c 8543$rm -f try.c try
a5f75d66 8544
a0d0e21e
LW
8545socketlib=''
8546sockethdr=''
8547: see whether socket exists
8548echo " "
8549$echo $n "Hmm... $c" >&4
8550if set socket val -f d_socket; eval $csym; $val; then
8551 echo "Looks like you have Berkeley networking support." >&4
8552 d_socket="$define"
8553 if set setsockopt val -f; eval $csym; $val; then
8554 d_oldsock="$undef"
8555 else
8556 echo "...but it uses the old 4.1c interface, rather than 4.2" >&4
8557 d_oldsock="$define"
8558 fi
8559else
8560 if $contains socklib libc.list >/dev/null 2>&1; then
8561 echo "Looks like you have Berkeley networking support." >&4
8562 d_socket="$define"
8563 : we will have to assume that it supports the 4.2 BSD interface
8564 d_oldsock="$undef"
8565 else
dfe9444c
AD
8566 echo "You don't have Berkeley networking in libc$_a..." >&4
8567 if test -f /usr/lib/libnet$_a; then
dc45a647 8568 ( ($nm $nm_opt /usr/lib/libnet$_a | eval $nm_extract) || \
9b8c873d 8569 $ar t /usr/lib/libnet$_a) 2>/dev/null >> libc.list
a0d0e21e
LW
8570 if $contains socket libc.list >/dev/null 2>&1; then
8571 echo "...but the Wollongong group seems to have hacked it in." >&4
8572 socketlib="-lnet"
8573 sockethdr="-I/usr/netinclude"
8574 d_socket="$define"
8575 if $contains setsockopt libc.list >/dev/null 2>&1; then
8576 d_oldsock="$undef"
8577 else
8578 echo "...using the old 4.1c interface, rather than 4.2" >&4
8579 d_oldsock="$define"
8580 fi
8581 else
dfe9444c 8582 echo "or even in libnet$_a, which is peculiar." >&4
a0d0e21e
LW
8583 d_socket="$undef"
8584 d_oldsock="$undef"
8585 fi
8586 else
8587 echo "or anywhere else I see." >&4
8588 d_socket="$undef"
8589 d_oldsock="$undef"
8590 fi
8591 fi
8592fi
8593
8594: see if socketpair exists
8595set socketpair d_sockpair
2304df62
AD
8596eval $inlibc
8597
2304df62
AD
8598: see if stat knows about block sizes
8599echo " "
8600xxx=`./findhdr sys/stat.h`
8601if $contains 'st_blocks;' "$xxx" >/dev/null 2>&1 ; then
8602 if $contains 'st_blksize;' "$xxx" >/dev/null 2>&1 ; then
8603 echo "Your stat() knows about block sizes." >&4
8604 val="$define"
8605 else
8606 echo "Your stat() doesn't know about block sizes." >&4
8607 val="$undef"
8608 fi
8609else
8610 echo "Your stat() doesn't know about block sizes." >&4
8611 val="$undef"
8612fi
8613set d_statblks
8614eval $setvar
8615
16d20bd9
AD
8616: see if _ptr and _cnt from stdio act std
8617echo " "
8618if $contains '_IO_fpos_t' `./findhdr stdio.h` >/dev/null 2>&1 ; then
8619 echo "(Looks like you have stdio.h from Linux.)"
8620 case "$stdio_ptr" in
c2960299
AD
8621 '') stdio_ptr='((fp)->_IO_read_ptr)'
8622 ptr_lval=$define
8623 ;;
8e07c86e 8624 *) ptr_lval=$d_stdio_ptr_lval;;
16d20bd9
AD
8625 esac
8626 case "$stdio_cnt" in
c2960299
AD
8627 '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
8628 cnt_lval=$undef
8629 ;;
8e07c86e 8630 *) cnt_lval=$d_stdio_cnt_lval;;
16d20bd9
AD
8631 esac
8632 case "$stdio_base" in
8633 '') stdio_base='((fp)->_IO_read_base)';;
8634 esac
8635 case "$stdio_bufsiz" in
c2960299 8636 '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
16d20bd9
AD
8637 esac
8638else
8639 case "$stdio_ptr" in
c2960299
AD
8640 '') stdio_ptr='((fp)->_ptr)'
8641 ptr_lval=$define
8642 ;;
8e07c86e 8643 *) ptr_lval=$d_stdio_ptr_lval;;
16d20bd9
AD
8644 esac
8645 case "$stdio_cnt" in
c2960299
AD
8646 '') stdio_cnt='((fp)->_cnt)'
8647 cnt_lval=$define
8648 ;;
8e07c86e 8649 *) cnt_lval=$d_stdio_cnt_lval;;
16d20bd9
AD
8650 esac
8651 case "$stdio_base" in
8652 '') stdio_base='((fp)->_base)';;
8653 esac
8654 case "$stdio_bufsiz" in
8655 '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
8656 esac
8657fi
8658: test whether _ptr and _cnt really work
8659echo "Checking how std your stdio is..." >&4
8660$cat >try.c <<EOP
8661#include <stdio.h>
8662#define FILE_ptr(fp) $stdio_ptr
8663#define FILE_cnt(fp) $stdio_cnt
8ff267be 8664main() {
16d20bd9
AD
8665 FILE *fp = fopen("try.c", "r");
8666 char c = getc(fp);
8667 if (
8668 18 <= FILE_cnt(fp) &&
8669 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
8670 )
8671 exit(0);
8672 exit(1);
8673}
8674EOP
8675val="$undef"
dfe9444c
AD
8676set try
8677if eval $compile; then
16d20bd9
AD
8678 if ./try; then
8679 echo "Your stdio acts pretty std."
8680 val="$define"
8681 else
8682 echo "Your stdio isn't very std."
8683 fi
8684else
8685 echo "Your stdio doesn't appear very std."
8686fi
8687$rm -f try.c try
8688set d_stdstdio
8689eval $setvar
8690
8e07c86e 8691: Can _ptr be used as an lvalue?
e50aee73
AD
8692case "$d_stdstdio$ptr_lval" in
8693$define$define) val=$define ;;
c2960299
AD
8694*) val=$undef ;;
8695esac
8696set d_stdio_ptr_lval
8697eval $setvar
8698
8e07c86e 8699: Can _cnt be used as an lvalue?
e50aee73
AD
8700case "$d_stdstdio$cnt_lval" in
8701$define$define) val=$define ;;
c2960299
AD
8702*) val=$undef ;;
8703esac
8704set d_stdio_cnt_lval
8705eval $setvar
8706
16d20bd9
AD
8707: see if _base is also standard
8708val="$undef"
8709case "$d_stdstdio" in
8710$define)
8711 $cat >try.c <<EOP
8712#include <stdio.h>
8713#define FILE_base(fp) $stdio_base
8714#define FILE_bufsiz(fp) $stdio_bufsiz
8ff267be 8715main() {
16d20bd9
AD
8716 FILE *fp = fopen("try.c", "r");
8717 char c = getc(fp);
8718 if (
8719 19 <= FILE_bufsiz(fp) &&
8720 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
8721 )
8722 exit(0);
8723 exit(1);
8724}
8725EOP
dfe9444c
AD
8726 set try
8727 if eval $compile; then
16d20bd9 8728 if ./try; then
8ff267be 8729 echo "And its _base field acts std."
16d20bd9
AD
8730 val="$define"
8731 else
8732 echo "But its _base field isn't std."
8733 fi
8734 else
8735 echo "However, it seems to be lacking the _base field."
8736 fi
8737 $rm -f try.c try
8738 ;;
8739esac
8740set d_stdiobase
8741eval $setvar
8742
a0d0e21e
LW
8743: see if strcoll exists
8744set strcoll d_strcoll
8745eval $inlibc
2304df62
AD
8746
8747: check for structure copying
8748echo " "
8749echo "Checking to see if your C compiler can copy structs..." >&4
8750$cat >try.c <<'EOCP'
8751main()
8752{
8753 struct blurfl {
8754 int dyick;
8755 } foo, bar;
8756
8757 foo = bar;
8758}
8759EOCP
8760if $cc -c try.c >/dev/null 2>&1 ; then
8761 val="$define"
8762 echo "Yup, it can."
8763else
8764 val="$undef"
8765 echo "Nope, it can't."
8766fi
8767set d_strctcpy
8768eval $setvar
8769$rm -f try.*
8770
8771: see if strerror and/or sys_errlist[] exist
8772echo " "
28e8609d
JH
8773if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
8774 if set strerror val -f d_strerror; eval $csym; $val; then
2304df62
AD
8775 echo 'strerror() found.' >&4
8776 d_strerror="$define"
a0d0e21e 8777 d_strerrm='strerror(e)'
2304df62 8778 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
28e8609d
JH
8779 echo "(You also have sys_errlist[], so we could roll our own strerror.)"
8780 d_syserrlst="$define"
2304df62 8781 else
28e8609d
JH
8782 echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
8783 d_syserrlst="$undef"
2304df62 8784 fi
28e8609d 8785 elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
2304df62
AD
8786 $contains '#[ ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
8787 echo 'strerror() found in string header.' >&4
8788 d_strerror="$define"
a0d0e21e 8789 d_strerrm='strerror(e)'
2304df62 8790 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
28e8609d
JH
8791 echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
8792 d_syserrlst="$define"
2304df62 8793 else
28e8609d
JH
8794 echo "(You don't appear to have any sys_errlist[], how can this be?)"
8795 d_syserrlst="$undef"
2304df62 8796 fi
28e8609d 8797 elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
2304df62
AD
8798echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
8799 d_strerror="$undef"
8800 d_syserrlst="$define"
a0d0e21e 8801 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
28e8609d 8802 else
2304df62
AD
8803 echo 'strerror() and sys_errlist[] NOT found.' >&4
8804 d_strerror="$undef"
8805 d_syserrlst="$undef"
a0d0e21e 8806 d_strerrm='"unknown"'
28e8609d 8807 fi
2304df62
AD
8808fi
8809
a89d8a78
DH
8810: see if strtod exists
8811set strtod d_strtod
8812eval $inlibc
8813
8814: see if strtol exists
8815set strtol d_strtol
8816eval $inlibc
8817
8818: see if strtoul exists
8819set strtoul d_strtoul
8820eval $inlibc
8821
a0d0e21e
LW
8822: see if strxfrm exists
8823set strxfrm d_strxfrm
8824eval $inlibc
8825
2304df62
AD
8826: see if symlink exists
8827set symlink d_symlink
8828eval $inlibc
8829
8830: see if syscall exists
8831set syscall d_syscall
8832eval $inlibc
8833
a0d0e21e
LW
8834: see if sysconf exists
8835set sysconf d_sysconf
8836eval $inlibc
8837
2304df62
AD
8838: see if system exists
8839set system d_system
8840eval $inlibc
8841
a0d0e21e
LW
8842: see if tcgetpgrp exists
8843set tcgetpgrp d_tcgetpgrp
8844eval $inlibc
8845
2c7991dc 8846: see if tcsetpgrp exists
8847set tcsetpgrp d_tcsetpgrp
8848eval $inlibc
4633a7c4 8849
2c7991dc 8850: define an is-a-typedef? function
8851typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8852case "$inclist" in
8853"") inclist="sys/types.h";;
8854esac;
8855eval "varval=\$$var";
8856case "$varval" in
8857"")
8858 $rm -f temp.c;
8859 for inc in $inclist; do
8860 echo "#include <$inc>" >>temp.c;
8861 done;
c4f23d77
AD
8862 echo "#ifdef $type" >> temp.c;
8863 echo "printf(\"We have $type\");" >> temp.c;
8864 echo "#endif" >> temp.c;
2c7991dc 8865 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8866 if $contains $type temp.E >/dev/null 2>&1; then
8867 eval "$var=\$type";
8868 else
8869 eval "$var=\$def";
8870 fi;
8871 $rm -f temp.?;;
8872*) eval "$var=\$varval";;
8873esac'
4633a7c4 8874
dc45a647
MB
8875: define an is-a-typedef? function that prompts if the type is not available.
8876typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8877case "$inclist" in
8878"") inclist="sys/types.h";;
8879esac;
8880eval "varval=\$$var";
8881case "$varval" in
8882"")
8883 $rm -f temp.c;
8884 for inc in $inclist; do
8885 echo "#include <$inc>" >>temp.c;
8886 done;
c4f23d77
AD
8887 echo "#ifdef $type" >> temp.c;
8888 echo "printf(\"We have $type\");" >> temp.c;
8889 echo "#endif" >> temp.c;
dc45a647
MB
8890 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8891 echo " " ;
8892 echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8893 if $contains $type temp.E >/dev/null 2>&1; then
8894 echo "$type found." >&4;
8895 eval "$var=\$type";
8896 else
8897 echo "$type NOT found." >&4;
8898 dflt="$def";
8899 . ./myread ;
8900 eval "$var=\$ans";
8901 fi;
8902 $rm -f temp.?;;
8903*) eval "$var=\$varval";;
8904esac'
8905
2c7991dc 8906: see if this is a sys/times.h system
8907set sys/times.h i_systimes
8908eval $inhdr
4633a7c4 8909
2c7991dc 8910: see if times exists
4633a7c4 8911echo " "
2c7991dc 8912if set times val -f d_times; eval $csym; $val; then
8913 echo 'times() found.' >&4
8914 d_times="$define"
8915 inc=''
8916 case "$i_systimes" in
8917 "$define") inc='sys/times.h';;
8918 esac
dc45a647 8919 rp="What is the type returned by times() on this system?"
2c7991dc 8920 set clock_t clocktype long stdio.h sys/types.h $inc
dc45a647 8921 eval $typedef_ask
2c7991dc 8922else
8923 echo 'times() NOT found, hope that will do.' >&4
8924 d_times="$undef"
8925 clocktype='int'
8926fi
2304df62 8927
2c7991dc 8928: see if truncate exists
8929set truncate d_truncate
8930eval $inlibc
2304df62 8931
2c7991dc 8932: see if tzname[] exists
8933echo " "
8934if set tzname val -a d_tzname; eval $csym; $val; then
8935 val="$define"
8936 echo 'tzname[] found.' >&4
8937else
8938 val="$undef"
8939 echo 'tzname[] NOT found.' >&4
8940fi
8941set d_tzname
8942eval $setvar
8943
8944: see if umask exists
8945set umask d_umask
8946eval $inlibc
85e6fe83 8947
4633a7c4 8948: see how we will look up host name
a0d0e21e 8949echo " "
4633a7c4
LW
8950if false; then
8951 : dummy stub to allow use of elif
8952elif set uname val -f d_uname; eval $csym; $val; then
8953 if ./xenix; then
8954 $cat <<'EOM'
8955uname() was found, but you're running xenix, and older versions of xenix
8956have a broken uname(). If you don't really know whether your xenix is old
8957enough to have a broken system call, use the default answer.
8958
85e6fe83 8959EOM
4633a7c4
LW
8960 dflt=y
8961 case "$d_uname" in
8962 "$define") dflt=n;;
8963 esac
8964 rp='Is your uname() broken?'
8965 . ./myread
8966 case "$ans" in
8967 n*) d_uname="$define"; call=uname;;
8968 esac
8969 else
8970 echo 'uname() found.' >&4
8971 d_uname="$define"
8972 call=uname
8973 fi
a0d0e21e 8974fi
4633a7c4
LW
8975case "$d_gethname" in
8976'') d_gethname="$undef";;
8977esac
8978case "$d_uname" in
8979'') d_uname="$undef";;
8980esac
8981case "$d_phostname" in
8982'') d_phostname="$undef";;
8983esac
ecfc5424 8984
4633a7c4
LW
8985: backward compatibility for d_hvfork
8986if test X$d_hvfork != X; then
8987 d_vfork="$d_hvfork"
8988 d_hvfork=''
8989fi
8990: see if there is a vfork
8991val=''
8992set vfork val
8993eval $inlibc
ecfc5424 8994
4633a7c4
LW
8995: Ok, but do we want to use it. vfork is reportedly unreliable in
8996: perl on Solaris 2.x, and probably elsewhere.
8997case "$val" in
8998$define)
16d20bd9 8999 echo " "
4633a7c4
LW
9000 case "$usevfork" in
9001 false) dflt='n';;
9002 *) dflt='y';;
9003 esac
9004 rp="Some systems have problems with vfork(). Do you want to use it?"
9005 . ./myread
9006 case "$ans" in
9007 y|Y) ;;
9008 *)
9009 echo "Ok, we won't use vfork()."
9010 val="$undef"
9011 ;;
9012 esac
ecfc5424
AD
9013 ;;
9014esac
4633a7c4
LW
9015set d_vfork
9016eval $setvar
9017case "$d_vfork" in
9018$define) usevfork='true';;
9019*) usevfork='false';;
9020esac
ecfc5424 9021
4633a7c4
LW
9022: see if this is an sysdir system
9023set sys/dir.h i_sysdir
9024eval $inhdr
9025
9026: see if this is an sysndir system
9027set sys/ndir.h i_sysndir
9028eval $inhdr
9029
bfb7748a
AD
9030: see if sys/types.h has to be included
9031set sys/types.h i_systypes
9032eval $inhdr
9033
4633a7c4
LW
9034: see if closedir exists
9035set closedir d_closedir
9036eval $inlibc
9037
9038case "$d_closedir" in
9039"$define")
16d20bd9 9040 echo " "
4633a7c4
LW
9041 echo "Checking whether closedir() returns a status..." >&4
9042 cat > closedir.c <<EOM
9043#$i_dirent I_DIRENT /**/
9044#$i_sysdir I_SYS_DIR /**/
9045#$i_sysndir I_SYS_NDIR /**/
bfb7748a 9046#$i_systypes I_SYS_TYPES /**/
4633a7c4 9047
bfb7748a
AD
9048#if defined(I_SYS_TYPES)
9049#include <sys/types.h>
9050#endif
4633a7c4
LW
9051#if defined(I_DIRENT)
9052#include <dirent.h>
9053#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
9054#include <sys/dir.h>
4aa0a1f7 9055#endif
4633a7c4
LW
9056#else
9057#ifdef I_SYS_NDIR
9058#include <sys/ndir.h>
9059#else
9060#ifdef I_SYS_DIR
9061#ifdef hp9000s500
9062#include <ndir.h> /* may be wrong in the future */
9063#else
9064#include <sys/dir.h>
9065#endif
9066#endif
9067#endif
9068#endif
9069int main() { return closedir(opendir(".")); }
9070EOM
dfe9444c 9071 set closedir
dc45a647 9072 if eval $compile_ok; then
4633a7c4
LW
9073 if ./closedir > /dev/null 2>&1 ; then
9074 echo "Yes, it does."
9075 val="$undef"
ecfc5424 9076 else
4633a7c4
LW
9077 echo "No, it doesn't."
9078 val="$define"
ecfc5424
AD
9079 fi
9080 else
4633a7c4
LW
9081 echo "(I can't seem to compile the test program--assuming it doesn't)"
9082 val="$define"
ecfc5424 9083 fi
ecfc5424 9084 ;;
4633a7c4
LW
9085*)
9086 val="$undef";
ecfc5424
AD
9087 ;;
9088esac
4633a7c4
LW
9089set d_void_closedir
9090eval $setvar
9091$rm -f closedir*
9092: check for volatile keyword
ecfc5424 9093echo " "
4633a7c4
LW
9094echo 'Checking to see if your C compiler knows about "volatile"...' >&4
9095$cat >try.c <<'EOCP'
9096main()
9097{
9098 typedef struct _goo_struct goo_struct;
9099 goo_struct * volatile goo = ((goo_struct *)0);
9100 struct _goo_struct {
9101 long long_int;
9102 int reg_int;
9103 char char_var;
9104 };
9105 typedef unsigned short foo_t;
9106 char *volatile foo;
9107 volatile int bar;
9108 volatile foo_t blech;
9109 foo = foo;
a0d0e21e
LW
9110}
9111EOCP
4633a7c4
LW
9112if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
9113 val="$define"
9114 echo "Yup, it does."
9115else
9116 val="$undef"
9117 echo "Nope, it doesn't."
9118fi
9119set d_volatile
9120eval $setvar
9121$rm -f try.*
a0d0e21e 9122
4633a7c4
LW
9123: see if there is a wait4
9124set wait4 d_wait4
8e07c86e
AD
9125eval $inlibc
9126
4633a7c4
LW
9127: see if waitpid exists
9128set waitpid d_waitpid
9129eval $inlibc
9130
9131: see if wcstombs exists
9132set wcstombs d_wcstombs
9133eval $inlibc
9134
9135: see if wctomb exists
9136set wctomb d_wctomb
9137eval $inlibc
9138
9139: preserve RCS keywords in files with variable substitution, grrr
9140Date='$Date'
9141Id='$Id'
9142Log='$Log'
9143RCSfile='$RCSfile'
9144Revision='$Revision'
9145
9146: check for alignment requirements
9147echo " "
9148case "$alignbytes" in
9149'') echo "Checking alignment constraints..." >&4
9150 $cat >try.c <<'EOCP'
9151struct foobar {
9152 char foo;
9153 double bar;
9154} try;
9155main()
9156{
9157 printf("%d\n", (char *)&try.bar - (char *)&try.foo);
9158}
9159EOCP
dfe9444c 9160 set try
dc45a647 9161 if eval $compile_ok; then
4633a7c4
LW
9162 dflt=`./try`
9163 else
9164 dflt='8'
41992daf 9165 echo "(I can't seem to compile the test program...)"
4633a7c4 9166 fi
ecfc5424 9167 ;;
4633a7c4 9168*) dflt="$alignbytes"
8e07c86e 9169 ;;
ecfc5424 9170esac
4633a7c4
LW
9171rp="Doubles must be aligned on a how-many-byte boundary?"
9172. ./myread
9173alignbytes="$ans"
9174$rm -f try.c try
85e6fe83 9175
4633a7c4
LW
9176: check for ordering of bytes in a long
9177case "$byteorder" in
9178'')
9179 $cat <<'EOM'
9180
9181In the following, larger digits indicate more significance. A big-endian
9182machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
9183little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
9184machines may have weird orders like 3412. A Cray will report 87654321. If
9185the test program works the default is probably right.
9186I'm now running the test program...
9187EOM
9188 $cat >try.c <<'EOCP'
9189#include <stdio.h>
9190main()
9191{
9192 int i;
9193 union {
9194 unsigned long l;
9195 char c[sizeof(long)];
9196 } u;
9197
9198 if (sizeof(long) > 4)
9199 u.l = (0x08070605L << 32) | 0x04030201L;
9200 else
9201 u.l = 0x04030201L;
9202 for (i = 0; i < sizeof(long); i++)
9203 printf("%c", u.c[i]+'0');
9204 printf("\n");
9205 exit(0);
9206}
9207EOCP
9208 xxx_prompt=y
dfe9444c
AD
9209 set try
9210 if eval $compile && ./try > /dev/null; then
4633a7c4
LW
9211 dflt=`./try`
9212 case "$dflt" in
9213 [1-4][1-4][1-4][1-4]|12345678|87654321)
9214 echo "(The test program ran ok.)"
9215 echo "byteorder=$dflt"
9216 xxx_prompt=n
9217 ;;
9218 ????|????????) echo "(The test program ran ok.)" ;;
9219 *) echo "(The test program didn't run right for some reason.)" ;;
9220 esac
9221 else
9222 dflt='4321'
9223 cat <<'EOM'
9224(I can't seem to compile the test program. Guessing big-endian...)
9225EOM
9226 fi
9227 case "$xxx_prompt" in
9228 y)
9229 rp="What is the order of bytes in a long?"
9230 . ./myread
9231 byteorder="$ans"
9232 ;;
9233 *) byteorder=$dflt
ecfc5424
AD
9234 ;;
9235 esac
9236 ;;
9237esac
4633a7c4 9238$rm -f try.c try
85e6fe83 9239
4633a7c4 9240: how do we catenate cpp tokens here?
2304df62 9241echo " "
4633a7c4
LW
9242echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
9243$cat >cpp_stuff.c <<'EOCP'
9244#define RCAT(a,b)a/**/b
9245#define ACAT(a,b)a ## b
9246RCAT(Rei,ser)
9247ACAT(Cir,cus)
9248EOCP
9249$cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
9250if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
dfe9444c 9251 echo "Oh! Smells like ANSI's been here." >&4
4633a7c4
LW
9252 echo "We can catify or stringify, separately or together!"
9253 cpp_stuff=42
9254elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
dfe9444c 9255 echo "Ah, yes! The good old days!" >&4
4633a7c4
LW
9256 echo "However, in the good old days we don't know how to stringify and"
9257 echo "catify at the same time."
9258 cpp_stuff=1
9259else
9260 $cat >&4 <<EOM
9261Hmm, I don't seem to be able to catenate tokens with your cpp. You're going
9262to have to edit the values of CAT[2-5] in config.h...
a0d0e21e 9263EOM
4633a7c4
LW
9264 cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
9265fi
9266$rm -f cpp_stuff.*
a0d0e21e 9267
4633a7c4
LW
9268: see if this is a db.h system
9269set db.h i_db
9270eval $inhdr
9271
9272case "$i_db" in
68dc0745 9273$define)
1f70e1ea 9274 : Check db version.
68dc0745 9275 echo " "
9276 echo "Checking Berkeley DB version ..." >&4
9277 $cat >try.c <<EOCP
9278#$d_const HASCONST
9279#ifndef HASCONST
9280#define const
9281#endif
9282#include <sys/types.h>
9283#include <stdio.h>
9284#include <db.h>
9285main()
9286{
1f70e1ea
PM
9287#ifdef DB_VERSION_MAJOR /* DB version >= 2 */
9288 int Major, Minor, Patch ;
ee02776e 9289 unsigned long Version ;
1f70e1ea
PM
9290 (void)db_version(&Major, &Minor, &Patch) ;
9291 printf("You have Berkeley DB Version 2 or greater\n");
9292
9293 printf("db.h is from Berkeley DB Version %d.%d.%d\n",
9294 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
9295 printf("libdb is from Berkeley DB Version %d.%d.%d\n",
9296 Major, Minor, Patch) ;
9297
9298 /* check that db.h & libdb are compatible */
9299 if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
9300 printf("db.h and libdb are incompatible\n") ;
9301 exit(3);
9302 }
9303
9304 printf("db.h and libdb are compatible\n") ;
ee02776e
PM
9305
9306 Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
693762b4 9307 + DB_VERSION_PATCH ;
ee02776e
PM
9308
9309 /* needs to be >= 2.3.4 */
9310 if (Version < 2003004) {
693762b4 9311 /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
ee02776e 9312 printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
1f70e1ea
PM
9313 exit(2);
9314 }
9315
9316 exit(0);
68dc0745 9317#else
6a1b87e5 9318#if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
1f70e1ea 9319 printf("You have Berkeley DB Version 1\n");
6a1b87e5
JH
9320 exit(0); /* DB version < 2: the coast is clear. */
9321#else
9322 exit(1); /* <db.h> not Berkeley DB? */
9323#endif
68dc0745 9324#endif
9325}
9326EOCP
dfe9444c
AD
9327 set try
9328 if eval $compile && ./try; then
1f70e1ea 9329 echo 'Looks OK.' >&4
68dc0745 9330 else
c90c0ff4 9331 echo "I can't use Berkeley DB with your <db.h>. I'll disable Berkeley DB." >&4
68dc0745 9332 i_db=$undef
9333 case " $libs " in
9334 *"-ldb "*)
9335 : Remove db from list of libraries to use
9336 echo "Removing unusable -ldb from library list" >&4
9337 set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
9338 shift
9339 libs="$*"
9340 echo "libs = $libs" >&4
9341 ;;
9342 esac
9343 fi
9344 $rm -f try.*
9345 ;;
9346esac
9347
9348case "$i_db" in
4633a7c4 9349define)
dc45a647
MB
9350 : Check the return type needed for hash
9351 echo " "
9352 echo "Checking return type needed for hash for Berkeley DB ..." >&4
9353 $cat >try.c <<EOCP
9354#$d_const HASCONST
9355#ifndef HASCONST
9356#define const
9357#endif
9358#include <sys/types.h>
9359#include <db.h>
9360
9361#ifndef DB_VERSION_MAJOR
9362u_int32_t hash_cb (ptr, size)
9363const void *ptr;
9364size_t size;
9365{
9366}
9367HASHINFO info;
9368main()
9369{
9370 info.hash = hash_cb;
9371}
9372#endif
9373EOCP
9374 if $cc $ccflags -c try.c >try.out 2>&1 ; then
9375 if $contains warning try.out >>/dev/null 2>&1 ; then
9376 db_hashtype='int'
9377 else
9378 db_hashtype='u_int32_t'
9379 fi
9380 else
9381 : XXX Maybe we should just give up here.
9382 db_hashtype=u_int32_t
9383 $cat try.out >&4
9384 echo "Help: I can't seem to compile the db test program." >&4
9385 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
9386 fi
9387 $rm -f try.*
9388 echo "Your version of Berkeley DB uses $db_hashtype for hash."
9389 ;;
9390*) db_hashtype=u_int32_t
9391 ;;
9392esac
9393case "$i_db" in
9394define)
4633a7c4
LW
9395 : Check the return type needed for prefix
9396 echo " "
9397 echo "Checking return type needed for prefix for Berkeley DB ..." >&4
9398 cat >try.c <<EOCP
9399#$d_const HASCONST
9400#ifndef HASCONST
9401#define const
9402#endif
9403#include <sys/types.h>
9404#include <db.h>
1f70e1ea
PM
9405
9406#ifndef DB_VERSION_MAJOR
4633a7c4
LW
9407size_t prefix_cb (key1, key2)
9408const DBT *key1;
9409const DBT *key2;
9410{
9411}
9412BTREEINFO info;
9413main()
9414{
9415 info.prefix = prefix_cb;
9416}
1f70e1ea 9417#endif
4633a7c4
LW
9418EOCP
9419 if $cc $ccflags -c try.c >try.out 2>&1 ; then
9420 if $contains warning try.out >>/dev/null 2>&1 ; then
9421 db_prefixtype='int'
9422 else
9423 db_prefixtype='size_t'
9424 fi
9425 else
68dc0745 9426 db_prefixtype='size_t'
9427 : XXX Maybe we should just give up here.
dc45a647 9428 $cat try.out >&4
68dc0745 9429 echo "Help: I can't seem to compile the db test program." >&4
9430 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
4633a7c4
LW
9431 fi
9432 $rm -f try.*
9433 echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
a0d0e21e 9434 ;;
68dc0745 9435*) db_prefixtype='size_t'
4633a7c4
LW
9436 ;;
9437esac
a0d0e21e 9438
4633a7c4
LW
9439: check for void type
9440echo " "
9441echo "Checking to see how well your C compiler groks the void type..." >&4
4633a7c4
LW
9442case "$voidflags" in
9443'')
9444 $cat >try.c <<'EOCP'
9445#if TRY & 1
760ac839 9446void sub() {
4633a7c4 9447#else
760ac839 9448sub() {
4633a7c4
LW
9449#endif
9450 extern void moo(); /* function returning void */
9451 void (*goo)(); /* ptr to func returning void */
9452#if TRY & 8
9453 void *hue; /* generic ptr */
9454#endif
9455#if TRY & 2
9456 void (*foo[10])();
9457#endif
a0d0e21e 9458
4633a7c4
LW
9459#if TRY & 4
9460 if(goo == moo) {
9461 exit(0);
9462 }
9463#endif
9464 exit(0);
9465}
760ac839 9466main() { sub(); }
4633a7c4 9467EOCP
760ac839 9468 if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
4633a7c4 9469 voidflags=$defvoidused
bfb7748a 9470 echo "Good. It appears to support void to the level $package wants.">&4
4633a7c4
LW
9471 if $contains warning .out >/dev/null 2>&1; then
9472 echo "However, you might get some warnings that look like this:"
9473 $cat .out
9474 fi
9475 else
9476echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
760ac839 9477 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
4633a7c4 9478 echo "It supports 1..."
760ac839 9479 if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
4633a7c4 9480 echo "It also supports 2..."
760ac839 9481 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
4633a7c4
LW
9482 voidflags=7
9483 echo "And it supports 4 but not 8 definitely."
9484 else
9485 echo "It doesn't support 4..."
760ac839 9486 if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
4633a7c4
LW
9487 voidflags=11
9488 echo "But it supports 8."
9489 else
9490 voidflags=3
9491 echo "Neither does it support 8."
9492 fi
9493 fi
9494 else
9495 echo "It does not support 2..."
760ac839 9496 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
4633a7c4
LW
9497 voidflags=13
9498 echo "But it supports 4 and 8."
9499 else
760ac839 9500 if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
4633a7c4
LW
9501 voidflags=5
9502 echo "And it supports 4 but has not heard about 8."
9503 else
9504 echo "However it supports 8 but not 4."
9505 fi
9506 fi
9507 fi
9508 else
9509 echo "There is no support at all for void."
9510 voidflags=0
9511 fi
9512 fi
9513esac
4633a7c4 9514case "$voidflags" in
2c7991dc 9515"$defvoidused") ;;
bfb7748a
AD
9516*) $cat >&4 <<'EOM'
9517 Support flag bits are:
9518 1: basic void declarations.
9519 2: arrays of pointers to functions returning void.
9520 4: operations between pointers to and addresses of void functions.
9521 8: generic void pointers.
9522EOM
2c7991dc 9523 dflt="$voidflags";
4633a7c4 9524 rp="Your void support flags add up to what?"
a0d0e21e 9525 . ./myread
4633a7c4 9526 voidflags="$ans"
a0d0e21e
LW
9527 ;;
9528esac
4633a7c4 9529$rm -f try.* .out
a0d0e21e 9530
693762b4
AD
9531: check for length of double
9532echo " "
9533case "$doublesize" in
9534'')
e5c9fcd0 9535 $echo $n "Checking to see how big your double precision numbers are...$c" >&4
693762b4
AD
9536 $cat >try.c <<'EOCP'
9537#include <stdio.h>
9538main()
9539{
9540 printf("%d\n", sizeof(double));
9541}
9542EOCP
9543 set try
dc45a647 9544 if eval $compile_ok; then
693762b4 9545 doublesize=`./try`
c4f23d77 9546 $echo " $doublesize bytes." >&4
693762b4
AD
9547 else
9548 dflt='8'
9549 echo "(I can't seem to compile the test program. Guessing...)"
9550 rp="What is the size of a double precision number (in bytes)?"
9551 . ./myread
9552 doublesize="$ans"
9553 fi
9554 ;;
9555esac
9556$rm -f try.c try
9557
a0d0e21e 9558: see what type file positions are declared as in the library
a0d0e21e 9559rp="What is the type for file position used by fsetpos()?"
dc45a647
MB
9560set fpos_t fpostype long stdio.h sys/types.h
9561eval $typedef_ask
2304df62 9562
e5c9fcd0
AD
9563: get csh whereabouts
9564case "$csh" in
9565'csh') val="$undef" ;;
9566*) val="$define" ;;
9567esac
9568set d_csh
9569eval $setvar
9570: Respect a hint or command line value for full_csh.
9571case "$full_csh" in
9572'') full_csh=$csh ;;
9573esac
9574
1aef975c
AD
9575: Store the full pathname to the sed program for use in the C program
9576full_sed=$sed
9577
2304df62 9578: see what type gids are declared as in the kernel
dc45a647
MB
9579echo " "
9580echo "Looking for the type for group ids returned by getgid()."
a0d0e21e
LW
9581set gid_t gidtype xxx stdio.h sys/types.h
9582eval $typedef
2304df62 9583case "$gidtype" in
a0d0e21e
LW
9584xxx)
9585 xxx=`./findhdr sys/user.h`
9586 set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
9587 case $1 in
9588 unsigned) dflt="$1 $2" ;;
9589 *) dflt="$1" ;;
9590 esac
2304df62 9591 ;;
a0d0e21e 9592*) dflt="$gidtype";;
2304df62 9593esac
dc45a647
MB
9594case "$gidtype" in
9595gid_t) echo "gid_t found." ;;
9596*) rp="What is the type for group ids returned by getgid()?"
9597 . ./myread
9598 gidtype="$ans"
9599 ;;
9600esac
a0d0e21e 9601
2304df62
AD
9602: see if getgroups exists
9603set getgroups d_getgrps
9604eval $inlibc
9605
5cd24f17 9606: see if setgroups exists
9607set setgroups d_setgrps
9608eval $inlibc
9609
dfe9444c 9610
8cc95fdb 9611: Find type of 2nd arg to 'getgroups()' and 'setgroups()'
a0d0e21e 9612echo " "
5cd24f17 9613case "$d_getgrps$d_setgrps" in
9614*define*)
a0d0e21e 9615 case "$groupstype" in
2304df62
AD
9616 '') dflt="$gidtype" ;;
9617 *) dflt="$groupstype" ;;
a0d0e21e
LW
9618 esac
9619 $cat <<EOM
dc45a647 9620What type of pointer is the second argument to getgroups() and setgroups()?
5cd24f17 9621Usually this is the same as group ids, $gidtype, but not always.
2304df62
AD
9622
9623EOM
dc45a647 9624 rp='What type pointer is the second argument to getgroups() and setgroups()?'
a0d0e21e
LW
9625 . ./myread
9626 groupstype="$ans"
9627 ;;
9628*) groupstype="$gidtype";;
2304df62 9629esac
2304df62 9630
85e6fe83 9631: see what type lseek is declared as in the kernel
dc45a647 9632rp="What is the type used for lseek's offset on this system?"
a0d0e21e 9633set off_t lseektype long stdio.h sys/types.h
dc45a647 9634eval $typedef_ask
2304df62 9635
8ff267be 9636echo " "
dfe9444c 9637echo "Checking if your $make program sets \$(MAKE)..." >&4
8ff267be 9638case "$make_set_make" in
9639'')
9640 $sed 's/^X //' > testmake.mak << 'EOF'
9641Xall:
dfe9444c 9642X @echo 'maketemp="$(MAKE)"'
8ff267be 9643EOF
8ff267be 9644 case "`$make -f testmake.mak 2>/dev/null`" in
dfe9444c 9645 *maketemp=*) make_set_make='#' ;;
8ff267be 9646 *) make_set_make="MAKE=$make" ;;
9647 esac
dfe9444c
AD
9648 $rm -f testmake.mak
9649 ;;
9650esac
9651case "$make_set_make" in
9652'#') echo "Yup, it does.";;
9653*) echo "Nope, it doesn't.";;
9654esac
9655
9656: see what type is used for mode_t
dc45a647 9657rp="What is the type used for file modes for system calls (e.g. fchmod())?"
dfe9444c 9658set mode_t modetype int stdio.h sys/types.h
dc45a647 9659eval $typedef_ask
dfe9444c 9660
dfe9444c
AD
9661: define a fucntion to check prototypes
9662$cat > protochk <<EOSH
9663$startsh
9664cc="$cc"
9665optimize="$optimize"
9666ccflags="$ccflags"
9667prototype="$prototype"
9668define="$define"
9669rm=$rm
9670EOSH
9671
9672$cat >> protochk <<'EOSH'
9673
9674$rm -f try.c
9675foo="$1"
9676shift
9677while test $# -ge 2; do
9678 case "$1" in
9679 $define) echo "#include <$2>" >> try.c ;;
9680 literal) echo "$2" >> try.c ;;
9681 esac
9682 shift 2
9683done
9684test "$prototype" = "$define" && echo '#define CAN_PROTOTYPE' >> try.c
9685cat >> try.c <<'EOCP'
9686#ifdef CAN_PROTOTYPE
9687#define _(args) args
9688#else
9689#define _(args) ()
9690#endif
9691EOCP
9692echo "$foo" >> try.c
9693echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9694$cc $optimize $ccflags -c try.c > /dev/null 2>&1
9695status=$?
9696$rm -f try.[co]
9697exit $status
9698EOSH
9699chmod +x protochk
9700$eunicefix protochk
9701
dfe9444c 9702: see what type is used for size_t
dc45a647 9703rp="What is the type used for the length parameter for string functions?"
dfe9444c 9704set size_t sizetype 'unsigned int' stdio.h sys/types.h
dc45a647 9705eval $typedef_ask
dfe9444c
AD
9706
9707: check for type of arguments to gethostbyaddr.
9708if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
9709 case "$d_gethbyaddr" in
9710 $define)
9711 $cat <<EOM
9712
9713Checking to see what type of arguments are accepted by gethostbyaddr().
9714EOM
9715 hdrs="$define sys/types.h
9716 $d_socket sys/socket.h
9717 $i_niin netinet/in.h
9718 $i_netdb netdb.h
9719 $i_unistd unistd.h"
9720 : The first arg can 'char *' or 'void *'
9721 : The second arg is some of integral type
9722 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
9723 for yyy in size_t long int; do
9724 case "$netdb_host_type" in
9725 '') try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
9726 if ./protochk "$try" $hdrs; then
9727 echo "Your system accepts $xxx for the first arg."
9728 echo "...and $yyy for the second arg."
9729 netdb_host_type="$xxx"
9730 netdb_hlen_type="$yyy"
9731 fi
9732 ;;
9733 esac
9734 done
9735 done
9736 : In case none of those worked, prompt the user.
9737 case "$netdb_host_type" in
9738 '') rp='What is the type for the 1st argument to gethostbyaddr?'
9739 dflt='char *'
9740 . ./myread
9741 netdb_host_type=$ans
9742 rp='What is the type for the 2nd argument to gethostbyaddr?'
9743 dflt="$sizetype"
9744 . ./myread
9745 netdb_hlen_type=$ans
9746 ;;
9747 esac
9748 ;;
9749 *) : no gethostbyaddr, so pick harmless defaults
9750 netdb_host_type='char *'
9751 netdb_hlen_type="$sizetype"
9752 ;;
9753 esac
9754 # Remove the "const" if needed. -- but then we'll have a
9755 # prototype clash!
9756 # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
9757fi
9758
9759: check for type of argument to gethostbyname.
9760if test "X$netdb_name_type" = X ; then
9761 case "$d_gethbyname" in
9762 $define)
9763 $cat <<EOM
9764
9765Checking to see what type of argument is accepted by gethostbyname().
9766EOM
9767 hdrs="$define sys/types.h
9768 $d_socket sys/socket.h
9769 $i_niin netinet/in.h
9770 $i_netdb netdb.h
9771 $i_unistd unistd.h"
9772 for xxx in "const char *" "char *"; do
9773 case "$netdb_name_type" in
9774 '') try="extern struct hostent *gethostbyname($xxx);"
9775 if ./protochk "$try" $hdrs; then
9776 echo "Your system accepts $xxx."
9777 netdb_name_type="$xxx"
9778 fi
9779 ;;
9780 esac
9781 done
9782 : In case none of those worked, prompt the user.
9783 case "$netdb_name_type" in
9784 '') rp='What is the type for the 1st argument to gethostbyname?'
9785 dflt='char *'
9786 . ./myread
9787 netdb_name_type=$ans
9788 ;;
9789 esac
9790 ;;
9791 *) : no gethostbyname, so pick harmless default
9792 netdb_name_type='char *'
9793 ;;
9794 esac
9795fi
8ff267be 9796
dfe9444c
AD
9797: check for type of 1st argument to getnetbyaddr.
9798if test "X$netdb_net_type" = X ; then
9799 case "$d_getnbyaddr" in
9800 $define)
9801 $cat <<EOM
85e6fe83 9802
dfe9444c
AD
9803Checking to see what type of 1st argument is accepted by getnetbyaddr().
9804EOM
9805 hdrs="$define sys/types.h
9806 $d_socket sys/socket.h
9807 $i_niin netinet/in.h
9808 $i_netdb netdb.h
9809 $i_unistd unistd.h"
9810 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
9811 case "$netdb_net_type" in
9812 '') try="extern struct netent *getnetbyaddr($xxx, int);"
9813 if ./protochk "$try" $hdrs; then
9814 echo "Your system accepts $xxx."
9815 netdb_net_type="$xxx"
9816 fi
9817 ;;
9818 esac
9819 done
9820 : In case none of those worked, prompt the user.
9821 case "$netdb_net_type" in
9822 '') rp='What is the type for the 1st argument to getnetbyaddr?'
9823 dflt='long'
9824 . ./myread
9825 netdb_net_type=$ans
9826 ;;
9827 esac
9828 ;;
9829 *) : no getnetbyaddr, so pick harmless default
e5c9fcd0 9830 netdb_net_type='long'
dfe9444c
AD
9831 ;;
9832 esac
9833fi
2c7991dc 9834: locate the preferred pager for this system
9835case "$pager" in
9836'')
9837 dflt=''
9838 case "$pg" in
9839 /*) dflt=$pg;;
9840 esac
9841 case "$more" in
9842 /*) dflt=$more;;
9843 esac
9844 case "$less" in
9845 /*) dflt=$less;;
9846 esac
9847 case "$dflt" in
9848 '') dflt=/usr/ucb/more;;
9849 esac
9850 ;;
9851*) dflt="$pager";;
9852esac
9853echo " "
9854fn=f/
9855rp='What pager is used on your system?'
9856. ./getfile
9857pager="$ans"
9858
dfe9444c 9859: see what type pids are declared as in the kernel
dc45a647 9860rp="What is the type of process ids on this system?"
dfe9444c 9861set pid_t pidtype int stdio.h sys/types.h
dc45a647 9862eval $typedef_ask
2304df62 9863
693762b4
AD
9864: check for length of pointer
9865echo " "
9866case "$ptrsize" in
9867'')
dc45a647 9868 $echo $n "Checking to see how big your pointers are...$c" >&4
693762b4
AD
9869 if test "$voidflags" -gt 7; then
9870 echo '#define VOID_PTR char *' > try.c
9871 else
9872 echo '#define VOID_PTR void *' > try.c
9873 fi
9874 $cat >>try.c <<'EOCP'
9875#include <stdio.h>
9876main()
9877{
9878 printf("%d\n", sizeof(VOID_PTR));
9879 exit(0);
9880}
9881EOCP
9882 set try
dc45a647 9883 if eval $compile_ok; then
693762b4 9884 ptrsize=`./try`
dc45a647 9885 $echo " $ptrsize bytes." >&4
693762b4
AD
9886 else
9887 dflt='4'
9888 echo "(I can't seem to compile the test program. Guessing...)" >&4
9889 rp="What is the size of a pointer (in bytes)?"
9890 . ./myread
9891 ptrsize="$ans"
9892 fi
9893 ;;
9894esac
9895$rm -f try.c try
9896
2304df62
AD
9897: check for size of random number generator
9898echo " "
9899case "$randbits" in
9900'')
9901 echo "Checking to see how many bits your rand function produces..." >&4
8ff267be 9902 $cat >try.c <<EOCP
9903#$i_unistd I_UNISTD
9904#$i_stdlib I_STDLIB
2304df62 9905#include <stdio.h>
8ff267be 9906#ifdef I_UNISTD
9907# include <unistd.h>
9908#endif
9909#ifdef I_STDLIB
9910# include <stdlib.h>
9911#endif
9912EOCP
9913 $cat >>try.c <<'EOCP'
2304df62
AD
9914main()
9915{
9916 register int i;
9917 register unsigned long tmp;
9918 register unsigned long max = 0L;
9919
9920 for (i = 1000; i; i--) {
9921 tmp = (unsigned long)rand();
9922 if (tmp > max) max = tmp;
9923 }
9924 for (i = 0; max; i++)
9925 max /= 2;
9926 printf("%d\n",i);
9927}
9928EOCP
dfe9444c 9929 set try
dc45a647 9930 if eval $compile_ok; then
dfe9444c 9931 dflt=`./try$_exe`
2304df62
AD
9932 else
9933 dflt='?'
9934 echo "(I can't seem to compile the test program...)"
9935 fi
9936 ;;
9937*)
9938 dflt="$randbits"
9939 ;;
9940esac
a0d0e21e
LW
9941rp='How many bits does your rand() function produce?'
9942. ./myread
9943randbits="$ans"
dfe9444c 9944$rm -f try.* try
a0d0e21e
LW
9945
9946: see if ar generates random libraries by itself
9947echo " "
9948echo "Checking how to generate random libraries on your machine..." >&4
9949echo 'int bar1() { return bar2(); }' > bar1.c
9950echo 'int bar2() { return 2; }' > bar2.c
9951$cat > foo.c <<'EOP'
9952main() { printf("%d\n", bar1()); exit(0); }
9953EOP
9954$cc $ccflags -c bar1.c >/dev/null 2>&1
9955$cc $ccflags -c bar2.c >/dev/null 2>&1
9956$cc $ccflags -c foo.c >/dev/null 2>&1
dfe9444c
AD
9957$ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
9958if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
a0d0e21e 9959 ./foobar >/dev/null 2>&1; then
4e2a5f63 9960 echo "$ar appears to generate random libraries itself."
a0d0e21e
LW
9961 orderlib=false
9962 ranlib=":"
dfe9444c
AD
9963elif $ar ts bar$_a >/dev/null 2>&1 &&
9964 $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
a0d0e21e 9965 ./foobar >/dev/null 2>&1; then
4e2a5f63 9966 echo "a table of contents needs to be added with '$ar ts'."
a0d0e21e 9967 orderlib=false
dfe9444c 9968 ranlib="$ar ts"
a0d0e21e 9969else
ecfc5424
AD
9970 case "$ranlib" in
9971 :) ranlib='';;
9972 '')
9973 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
9974 $test -f $ranlib || ranlib=''
9975 ;;
9976 esac
a0d0e21e 9977 if $test -n "$ranlib"; then
ecfc5424 9978 echo "your system has '$ranlib'; we'll use that."
a0d0e21e
LW
9979 orderlib=false
9980 else
9981 echo "your system doesn't seem to support random libraries"
9982 echo "so we'll use lorder and tsort to order the libraries."
9983 orderlib=true
9984 ranlib=":"
9985 fi
9986fi
9987$rm -f foo* bar*
9988
a0d0e21e
LW
9989: see if sys/select.h has to be included
9990set sys/select.h i_sysselct
9991eval $inhdr
9992
9993: see if we should include time.h, sys/time.h, or both
9994echo " "
28e8609d
JH
9995if test "X$timeincl" = X; then
9996 echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9997 $echo $n "I'm now running the test program...$c"
9998 $cat >try.c <<'EOCP'
a0d0e21e
LW
9999#include <sys/types.h>
10000#ifdef I_TIME
10001#include <time.h>
10002#endif
10003#ifdef I_SYSTIME
10004#ifdef SYSTIMEKERNEL
10005#define KERNEL
10006#endif
10007#include <sys/time.h>
10008#endif
10009#ifdef I_SYSSELECT
10010#include <sys/select.h>
10011#endif
10012main()
10013{
10014 struct tm foo;
10015#ifdef S_TIMEVAL
10016 struct timeval bar;
10017#endif
10018#ifdef S_TIMEZONE
10019 struct timezone tzp;
10020#endif
10021 if (foo.tm_sec == foo.tm_sec)
10022 exit(0);
10023#ifdef S_TIMEVAL
10024 if (bar.tv_sec == bar.tv_sec)
10025 exit(0);
10026#endif
10027 exit(1);
10028}
10029EOCP
28e8609d
JH
10030 flags=''
10031 for s_timezone in '-DS_TIMEZONE' ''; do
10032 sysselect=''
10033 for s_timeval in '-DS_TIMEVAL' ''; do
10034 for i_systimek in '' '-DSYSTIMEKERNEL'; do
10035 for i_time in '' '-DI_TIME'; do
10036 for i_systime in '-DI_SYSTIME' ''; do
a0d0e21e
LW
10037 case "$flags" in
10038 '') $echo $n ".$c"
dfe9444c
AD
10039 set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10040 if eval $compile; then
10041 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
a0d0e21e
LW
10042 shift
10043 flags="$*"
10044 echo " "
10045 $echo $n "Succeeded with $flags$c"
10046 fi
10047 ;;
10048 esac
28e8609d
JH
10049 done
10050 done
10051 done
10052 done
10053 done
10054 timeincl=''
10055 echo " "
10056 case "$flags" in
10057 *SYSTIMEKERNEL*) i_systimek="$define"
a0d0e21e
LW
10058 timeincl=`./findhdr sys/time.h`
10059 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
28e8609d
JH
10060 *) i_systimek="$undef";;
10061 esac
10062 case "$flags" in
10063 *I_TIME*) i_time="$define"
a0d0e21e
LW
10064 timeincl=`./findhdr time.h`" $timeincl"
10065 echo "We'll include <time.h>." >&4;;
28e8609d
JH
10066 *) i_time="$undef";;
10067 esac
10068 case "$flags" in
10069 *I_SYSTIME*) i_systime="$define"
a0d0e21e
LW
10070 timeincl=`./findhdr sys/time.h`" $timeincl"
10071 echo "We'll include <sys/time.h>." >&4;;
28e8609d
JH
10072 *) i_systime="$undef";;
10073 esac
10074 $rm -f try.c try
10075fi
2304df62 10076
a0d0e21e
LW
10077: check for fd_set items
10078$cat <<EOM
10079
10080Checking to see how well your C compiler handles fd_set and friends ...
10081EOM
10082$cat >fd_set.c <<EOCP
10083#$i_systime I_SYS_TIME
10084#$i_sysselct I_SYS_SELECT
10085#$d_socket HAS_SOCKET
10086#include <sys/types.h>
10087#ifdef HAS_SOCKET
10088#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
10089#endif
10090#ifdef I_SYS_TIME
10091#include <sys/time.h>
a4f3eea9 10092#endif
a0d0e21e
LW
10093#ifdef I_SYS_SELECT
10094#include <sys/select.h>
10095#endif
a0d0e21e
LW
10096main() {
10097 fd_set fds;
10098
10099#ifdef TRYBITS
10100 if(fds.fds_bits);
10101#endif
10102
10103#if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
10104 exit(0);
10105#else
10106 exit(1);
10107#endif
10108}
10109EOCP
dfe9444c
AD
10110set fd_set -DTRYBITS
10111if eval $compile; then
a0d0e21e
LW
10112 d_fds_bits="$define"
10113 d_fd_set="$define"
10114 echo "Well, your system knows about the normal fd_set typedef..." >&4
10115 if ./fd_set; then
10116 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
10117 d_fd_macros="$define"
85e6fe83 10118 else
a0d0e21e
LW
10119 $cat >&4 <<'EOM'
10120but not the normal fd_set macros! Gaaack! I'll have to cover for you.
10121EOM
10122 d_fd_macros="$undef"
85e6fe83
LW
10123 fi
10124else
a0d0e21e
LW
10125 $cat <<'EOM'
10126Hmm, your compiler has some difficulty with fd_set. Checking further...
10127EOM
dfe9444c
AD
10128 set fd_set
10129 if eval $compile; then
a0d0e21e
LW
10130 d_fds_bits="$undef"
10131 d_fd_set="$define"
10132 echo "Well, your system has some sort of fd_set available..." >&4
10133 if ./fd_set; then
10134 echo "and you have the normal fd_set macros." >&4
10135 d_fd_macros="$define"
10136 else
10137 $cat <<'EOM'
10138but not the normal fd_set macros! Gross! More work for me...
10139EOM
10140 d_fd_macros="$undef"
10141 fi
85e6fe83 10142 else
a0d0e21e
LW
10143 echo "Well, you got zip. That's OK, I can roll my own fd_set stuff." >&4
10144 d_fd_set="$undef"
10145 d_fds_bits="$undef"
10146 d_fd_macros="$undef"
85e6fe83
LW
10147 fi
10148fi
a0d0e21e
LW
10149$rm -f fd_set*
10150
dfe9444c
AD
10151: check for type of arguments to select.
10152case "$selecttype" in
10153'') case "$d_select" in
10154 $define)
10155 $cat <<EOM
10156Checking to see what type of arguments are accepted by select().
10157EOM
10158 hdrs="$define sys/types.h
10159 $i_systime sys/time.h
10160 $i_sysselct sys/select.h
10161 $d_socket sys/socket.h"
10162 : The first arg can be int, unsigned, or size_t
10163 : The last arg may or may not be 'const'
10164 val=''
10165 for xxx in 'fd_set *' 'int *'; do
10166 for nfd in 'int' 'size_t' 'unsigned' ; do
10167 for tmo in 'struct timeval *' 'const struct timeval *'; do
10168 case "$val" in
10169 '') try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
10170 if ./protochk "$try" $hdrs; then
10171 echo "Your system accepts $xxx."
10172 val="$xxx"
10173 fi
10174 ;;
10175 esac
10176 done
10177 done
10178 done
10179 case "$val" in
10180 '') rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
10181 case "$d_fd_set" in
10182 $define) dflt="fd_set *" ;;
10183 *) dflt="int *" ;;
10184 esac
10185 . ./myread
10186 val=$ans
10187 ;;
a0d0e21e 10188 esac
dfe9444c 10189 selecttype="$val"
a0d0e21e 10190 ;;
dfe9444c
AD
10191 *) : no select, so pick a harmless default
10192 selecttype='int *'
a0d0e21e
LW
10193 ;;
10194 esac
a0d0e21e
LW
10195 ;;
10196esac
2304df62 10197
8e07c86e
AD
10198: Trace out the files included by signal.h, then look for SIGxxx names.
10199: Remove SIGARRAYSIZE used by HPUX.
4633a7c4 10200: Remove SIGTYP void lines used by OS2.
8e07c86e
AD
10201xxx=`echo '#include <signal.h>' |
10202 $cppstdin $cppminus $cppflags 2>/dev/null |
10203 $grep '^[ ]*#.*include' |
10204 $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
10205: Check this list of files to be sure we have parsed the cpp output ok.
10206: This will also avoid potentially non-existent files, such
10207: as ../foo/bar.h
10208xxxfiles=''
10209for xx in $xxx /dev/null ; do
10210 $test -f "$xx" && xxxfiles="$xxxfiles $xx"
10211done
10212: If we have found no files, at least try signal.h
10213case "$xxxfiles" in
10214'') xxxfiles=`./findhdr signal.h` ;;
10215esac
10216xxx=`awk '
4633a7c4 10217$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $3 !~ /void/ {
8e07c86e
AD
10218 print substr($2, 4, 20)
10219}
4633a7c4 10220$1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
8e07c86e
AD
10221 print substr($3, 4, 20)
10222}' $xxxfiles`
10223: Append some common names just in case the awk scan failed.
10224xxx="$xxx ABRT ALRM BUS CHLD CLD CONT DIL EMT FPE HUP ILL INT IO IOT KILL"
10225xxx="$xxx LOST PHONE PIPE POLL PROF PWR QUIT SEGV STKFLT STOP SYS TERM TRAP"
10226xxx="$xxx TSTP TTIN TTOU URG USR1 USR2 USR3 USR4 VTALRM"
10227xxx="$xxx WINCH WIND WINDOW XCPU XFSZ"
10228: generate a few handy files for later
dc45a647 10229$cat > signal.c <<'EOCP'
4633a7c4
LW
10230#include <sys/types.h>
10231#include <signal.h>
dc45a647 10232#include <stdio.h>
4633a7c4 10233int main() {
760ac839
LW
10234
10235/* Strange style to avoid deeply-nested #if/#else/#endif */
10236#ifndef NSIG
10237# ifdef _NSIG
10238# define NSIG (_NSIG)
10239# endif
10240#endif
10241
10242#ifndef NSIG
10243# ifdef SIGMAX
10244# define NSIG (SIGMAX+1)
10245# endif
10246#endif
10247
10248#ifndef NSIG
10249# ifdef SIG_MAX
10250# define NSIG (SIG_MAX+1)
10251# endif
10252#endif
10253
10254#ifndef NSIG
10255# ifdef MAXSIG
10256# define NSIG (MAXSIG+1)
10257# endif
4633a7c4 10258#endif
760ac839
LW
10259
10260#ifndef NSIG
10261# ifdef MAX_SIG
10262# define NSIG (MAX_SIG+1)
10263# endif
10264#endif
10265
10266#ifndef NSIG
10267# ifdef SIGARRAYSIZE
10268# define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
10269# endif
10270#endif
10271
10272#ifndef NSIG
10273# ifdef _sys_nsig
10274# define NSIG (_sys_nsig) /* Solaris 2.5 */
10275# endif
10276#endif
10277
10278/* Default to some arbitrary number that's big enough to get most
10279 of the common signals.
10280*/
10281#ifndef NSIG
10282# define NSIG 50
4633a7c4 10283#endif
760ac839
LW
10284
10285printf("NSIG %d\n", NSIG);
10286
dc45a647
MB
10287#ifndef JUST_NSIG
10288
10289EOCP
10290
28e8609d 10291echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
8e07c86e
AD
10292{
10293 printf "#ifdef SIG"; printf $1; printf "\n"
10294 printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
10295 printf $1; printf ");\n"
10296 printf "#endif\n"
2304df62 10297}
2304df62 10298END {
dc45a647 10299 printf "#endif /* JUST_NSIG */\n";
8e07c86e 10300 printf "}\n";
2304df62 10301}
4633a7c4
LW
10302' >>signal.c
10303$cat >signal.awk <<'EOP'
10304BEGIN { ndups = 0 }
10305$1 ~ /^NSIG$/ { nsig = $2 }
10306($1 !~ /^NSIG$/) && (NF == 2) {
10307 if ($2 > maxsig) { maxsig = $2 }
10308 if (sig_name[$2]) {
10309 dup_name[ndups] = $1
10310 dup_num[ndups] = $2
10311 ndups++
10312 }
10313 else {
10314 sig_name[$2] = $1
10315 sig_num[$2] = $2
10316 }
10317
10318}
10319END {
10320 if (nsig == 0) { nsig = maxsig + 1 }
10321 for (n = 1; n < nsig; n++) {
10322 if (sig_name[n]) {
10323 printf("%s %d\n", sig_name[n], sig_num[n])
10324 }
10325 else {
10326 printf("NUM%d %d\n", n, n)
10327 }
10328 }
10329 for (n = 0; n < ndups; n++) {
10330 printf("%s %d\n", dup_name[n], dup_num[n])
10331 }
10332}
10333EOP
10334$cat >signal_cmd <<EOS
8e07c86e 10335$startsh
dc45a647
MB
10336if $test -s signal.lst; then
10337 echo "Using your existing signal.lst file"
10338 exit 0
10339fi
10340xxx="$xxx"
10341EOS
10342$cat >>signal_cmd <<'EOS'
10343
10344set signal
10345if eval $compile_ok; then
dfe9444c 10346 ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
8e07c86e 10347else
dc45a647
MB
10348 echo "(I can't seem be able to compile the whole test program)" >&4
10349 echo "(I'll try it in little pieces.)" >&4
10350 set signal -DJUST_NSIG
10351 if eval $compile_ok; then
10352 ./signal$_exe > signal.nsg
10353 $cat signal.nsg
10354 else
10355 echo "I can't seem to figure out how many signals you have." >&4
10356 echo "Guessing 50." >&4
10357 echo 'NSIG 50' > signal.nsg
10358 fi
10359 : Now look at all the signal names, one at a time.
28e8609d 10360 for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
dc45a647
MB
10361 $cat > signal.c <<EOCP
10362#include <sys/types.h>
10363#include <signal.h>
10364#include <stdio.h>
10365int main() {
10366printf("$xx %d\n", SIG${xx});
10367return 0;
10368}
10369EOCP
10370 set signal
10371 if eval $compile; then
10372 echo "SIG${xx} found."
10373 ./signal$_exe >> signal.ls1
10374 else
10375 echo "SIG${xx} NOT found."
10376 fi
10377 done
10378 if $test -s signal.ls1; then
10379 $cat signal.nsg signal.ls1 |
10380 $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
10381 fi
10382
10383fi
10384if $test -s signal.lst; then
10385 :
10386else
10387 echo "(AAK! I can't compile the test programs -- Guessing)" >&4
8e07c86e 10388 echo 'kill -l' >signal
dc45a647 10389 set X `csh -f <signal`
8e07c86e 10390 $rm -f signal
2304df62 10391 shift
dc45a647 10392 case $# in
8e07c86e 10393 0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
2304df62 10394 esac
28e8609d 10395 echo $@ | $tr ' ' $trnl | \
dc45a647 10396 $awk '{ printf $1; printf " %d\n", ++s; }' >signal.lst
8e07c86e 10397fi
dc45a647 10398$rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
8e07c86e 10399EOS
4633a7c4
LW
10400chmod a+x signal_cmd
10401$eunicefix signal_cmd
8e07c86e
AD
10402
10403: generate list of signal names
10404echo " "
dfe9444c 10405case "$sig_name_init" in
8e07c86e 10406'')
4633a7c4 10407 echo "Generating a list of signal names and numbers..." >&4
dc45a647 10408 . ./signal_cmd
8e07c86e
AD
10409 sig_name=`$awk '{printf "%s ", $1}' signal.lst`
10410 sig_name="ZERO $sig_name"
dfe9444c
AD
10411 sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
10412 { printf "\"%s\", ", $1 }
10413 END { printf "0\n" }' signal.lst`
10414 sig_num=`$awk 'BEGIN { printf "0, " }
10415 { printf "%d, ", $2}
10416 END { printf "0\n"}' signal.lst`
a0d0e21e 10417 ;;
2304df62 10418esac
a0d0e21e
LW
10419echo "The following signals are available:"
10420echo " "
10421echo $sig_name | $awk \
10422'BEGIN { linelen = 0 }
10423{
8e07c86e 10424 for (i = 1; i <= NF; i++) {
a0d0e21e
LW
10425 name = "SIG" $i " "
10426 linelen = linelen + length(name)
10427 if (linelen > 70) {
10428 printf "\n"
10429 linelen = length(name)
10430 }
10431 printf "%s", name
10432 }
8e07c86e 10433 printf "\n"
a0d0e21e 10434}'
4633a7c4 10435$rm -f signal signal.c signal.awk signal.lst signal_cmd
a0d0e21e 10436
a0d0e21e
LW
10437: see what type is used for signed size_t
10438set ssize_t ssizetype int stdio.h sys/types.h
10439eval $typedef
10440dflt="$ssizetype"
10441$cat > ssize.c <<EOM
10442#include <stdio.h>
10443#include <sys/types.h>
10444#define Size_t $sizetype
10445#define SSize_t $dflt
10446main()
10447{
10448 if (sizeof(Size_t) == sizeof(SSize_t))
10449 printf("$dflt\n");
10450 else if (sizeof(Size_t) == sizeof(int))
10451 printf("int\n");
10452 else
10453 printf("long\n");
760ac839 10454 exit(0);
a0d0e21e
LW
10455}
10456EOM
10457echo " "
dfe9444c 10458set ssize
dc45a647 10459if eval $compile_ok && ./ssize > /dev/null; then
dfe9444c 10460 ssizetype=`./ssize`
a0d0e21e
LW
10461 echo "I'll be using $ssizetype for functions returning a byte count." >&4
10462else
24fef2a7 10463 $cat >&4 <<EOM
24fef2a7
AD
10464Help! I can't compile and run the ssize_t test program: please enlighten me!
10465(This is probably a misconfiguration in your system or libraries, and
10466you really ought to fix it. Still, I'll try anyway.)
a0d0e21e
LW
10467
10468I need a type that is the same size as $sizetype, but is guaranteed to
24fef2a7 10469be signed. Common values are ssize_t, int and long.
a0d0e21e
LW
10470
10471EOM
10472 rp="What signed type is the same size as $sizetype?"
10473 . ./myread
10474 ssizetype="$ans"
10475fi
dfe9444c 10476$rm -f ssize ssize.*
3fd537d4 10477
a0d0e21e
LW
10478: see what type of char stdio uses.
10479echo " "
10480if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
10481 echo "Your stdio uses unsigned chars." >&4
10482 stdchar="unsigned char"
10483else
10484 echo "Your stdio uses signed chars." >&4
10485 stdchar="char"
10486fi
10487
10488: see if time exists
10489echo " "
28e8609d
JH
10490if test "X$d_time" = X -o X"$timetype" = X; then
10491 if set time val -f d_time; eval $csym; $val; then
a0d0e21e 10492 echo 'time() found.' >&4
ecfc5424 10493 val="$define"
dc45a647 10494 rp="What is the type returned by time() on this system?"
a0d0e21e 10495 set time_t timetype long stdio.h sys/types.h
dc45a647 10496 eval $typedef_ask
28e8609d 10497 else
a0d0e21e 10498 echo 'time() not found, hope that will do.' >&4
ecfc5424 10499 val="$undef"
a0d0e21e 10500 timetype='int';
28e8609d
JH
10501 fi
10502 set d_time
10503 eval $setvar
a0d0e21e 10504fi
a0d0e21e
LW
10505
10506: see what type uids are declared as in the kernel
dc45a647
MB
10507echo " "
10508echo "Looking for the type for user ids returned by getuid()."
a0d0e21e
LW
10509set uid_t uidtype xxx stdio.h sys/types.h
10510eval $typedef
10511case "$uidtype" in
10512xxx)
10513 xxx=`./findhdr sys/user.h`
10514 set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
10515 case $1 in
10516 unsigned) dflt="$1 $2" ;;
10517 *) dflt="$1" ;;
10518 esac
10519 ;;
4633a7c4
LW
10520*) dflt="$uidtype";;
10521esac
dc45a647
MB
10522case "$uidtype" in
10523uid_t) echo "uid_t found." ;;
10524*) rp="What is the type for user ids returned by getuid()?"
10525 . ./myread
10526 uidtype="$ans"
10527 ;;
10528esac
4633a7c4
LW
10529
10530: see if dbm.h is available
10531: see if dbmclose exists
10532set dbmclose d_dbmclose
10533eval $inlibc
10534
10535case "$d_dbmclose" in
10536$define)
10537 set dbm.h i_dbm
10538 eval $inhdr
10539 case "$i_dbm" in
10540 $define)
10541 val="$undef"
10542 set i_rpcsvcdbm
10543 eval $setvar
10544 ;;
10545 *) set rpcsvc/dbm.h i_rpcsvcdbm
10546 eval $inhdr
10547 ;;
10548 esac
10549 ;;
10550*) echo "We won't be including <dbm.h>"
10551 val="$undef"
10552 set i_dbm
10553 eval $setvar
10554 val="$undef"
10555 set i_rpcsvcdbm
10556 eval $setvar
10557 ;;
a0d0e21e 10558esac
2304df62 10559
2304df62
AD
10560: see if this is a sys/file.h system
10561val=''
10562set sys/file.h val
10563eval $inhdr
10564
8e07c86e 10565: do we need to include sys/file.h ?
2304df62
AD
10566case "$val" in
10567"$define")
10568 echo " "
10569 if $h_sysfile; then
10570 val="$define"
10571 echo "We'll be including <sys/file.h>." >&4
10572 else
10573 val="$undef"
10574 echo "We won't be including <sys/file.h>." >&4
10575 fi
10576 ;;
10577*)
10578 h_sysfile=false
10579 ;;
10580esac
10581set i_sysfile
10582eval $setvar
10583
10584: see if fcntl.h is there
10585val=''
10586set fcntl.h val
10587eval $inhdr
10588
10589: see if we can include fcntl.h
10590case "$val" in
10591"$define")
10592 echo " "
10593 if $h_fcntl; then
10594 val="$define"
10595 echo "We'll be including <fcntl.h>." >&4
10596 else
10597 val="$undef"
10598 if $h_sysfile; then
10599 echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
10600 else
10601 echo "We won't be including <fcntl.h>." >&4
10602 fi
10603 fi
10604 ;;
10605*)
10606 h_fcntl=false
10607 val="$undef"
10608 ;;
10609esac
10610set i_fcntl
10611eval $setvar
10612
2304df62
AD
10613: see if this is an grp system
10614set grp.h i_grp
10615eval $inhdr
10616
28e8609d
JH
10617case "$i_grp" in
10618$define)
10619 : see if setgrent exists
10620 set setgrent d_setgrent
10621 eval $inlibc
10622
10623 : see if getgrent exists
10624 set getgrent d_getgrent
10625 eval $inlibc
10626
10627 : see if endgrent exists
10628 set endgrent d_endgrent
10629 eval $inlibc
10630
10631 xxx=`./findhdr grp.h`
10632 $cppstdin $cppflags $cppminus < $xxx >$$.h
10633
10634 if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
10635 val="$define"
10636 else
10637 val="$undef"
10638 fi
10639 set d_grpasswd
10640 eval $setvar
10641
10642 $rm -f $$.h
10643 ;;
10644*) # Assume all is lost as far as the d_*gr* go.
10645 val="$undef";
10646 set d_setgrent; eval $setvar
10647 set d_getgrent; eval $setvar
10648 set d_endgrent; eval $setvar
10649 set d_grpasswd; eval $setvar
10650 ;;
10651esac
10652
4633a7c4
LW
10653: see if locale.h is available
10654set locale.h i_locale
10655eval $inhdr
10656
a0d0e21e
LW
10657: see if this is a math.h system
10658set math.h i_math
10659eval $inhdr
10660
4633a7c4
LW
10661: see if ndbm.h is available
10662set ndbm.h t_ndbm
10663eval $inhdr
10664case "$t_ndbm" in
10665$define)
10666 : see if dbm_open exists
10667 set dbm_open d_dbm_open
10668 eval $inlibc
10669 case "$d_dbm_open" in
10670 $undef)
10671 t_ndbm="$undef"
10672 echo "We won't be including <ndbm.h>"
10673 ;;
10674 esac
10675 ;;
10676esac
10677val="$t_ndbm"
10678set i_ndbm
10679eval $setvar
10680
85e6fe83 10681: see if net/errno.h is available
a0d0e21e
LW
10682val=''
10683set net/errno.h val
2304df62 10684eval $inhdr
a0d0e21e 10685
85e6fe83 10686: Unfortunately, it causes problems on some systems. Arrgh.
a0d0e21e
LW
10687case "$val" in
10688$define)
10689 cat > try.c <<'EOM'
85e6fe83
LW
10690#include <stdio.h>
10691#include <errno.h>
10692#include <net/errno.h>
10693int func()
10694{
a0d0e21e 10695 return ENOTSOCK;
85e6fe83
LW
10696}
10697EOM
a0d0e21e
LW
10698 if $cc $ccflags -c try.c >/dev/null 2>&1; then
10699 echo "We'll be including <net/errno.h>." >&4
10700 else
10701 echo "We won't be including <net/errno.h>." >&4
10702 val="$undef"
10703 fi
10704 $rm -f try.* try
10705 ;;
85e6fe83 10706esac
a0d0e21e
LW
10707set i_neterrno
10708eval $setvar
2304df62
AD
10709
10710: get C preprocessor symbols handy
10711echo " "
ecfc5424 10712$echo $n "Hmm... $c"
28e8609d 10713echo $al | $tr ' ' $trnl >Cppsym.know
2304df62
AD
10714$cat <<EOSS >Cppsym
10715$startsh
10716case "\$1" in
10717-l) list=true
10718 shift
10719 ;;
10720esac
10721unknown=''
10722case "\$list\$#" in
107231|2)
10724 for sym do
10725 if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
10726 exit 0
10727 elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
10728 :
10729 else
10730 unknown="\$unknown \$sym"
10731 fi
10732 done
10733 set X \$unknown
10734 shift
10735 ;;
10736esac
10737case \$# in
107380) exit 1;;
10739esac
a29d2910 10740echo \$* | $tr ' ' '$trnl' | $sed -e 's/\(.*\)/\\
2304df62
AD
10741#ifdef \1\\
10742exit 0; _ _ _ _\1\\ \1\\
10743#endif\\
10744/' >Cppsym\$\$
10745echo "exit 1; _ _ _" >>Cppsym\$\$
10746$cppstdin $cppminus <Cppsym\$\$ | $grep '^exit [01]; _ _' >Cppsym2\$\$
10747case "\$list" in
10748true) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;;
10749*)
10750 sh Cppsym2\$\$
10751 status=\$?
10752 ;;
10753esac
10754$rm -f Cppsym\$\$ Cppsym2\$\$
10755exit \$status
10756EOSS
10757chmod +x Cppsym
10758$eunicefix Cppsym
ecfc5424
AD
10759./Cppsym -l $al | $sort | $grep -v '^$' >Cppsym.true
10760
10761: now check the C compiler for additional symbols
10762$cat >ccsym <<EOS
10763$startsh
10764$cat >tmp.c <<EOF
10765extern int foo;
10766EOF
10767for i in \`$cc -v -c tmp.c 2>&1\`
10768do
10769 case "\$i" in
10770 -D*) echo "\$i" | $sed 's/^-D//';;
10771 -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
10772 esac
10773done
10774$rm -f try.c
10775EOS
10776chmod +x ccsym
10777$eunicefix ccsym
10778./ccsym | $sort | $uniq >ccsym.raw
f0b7e567
AD
10779$awk '/\=/ { print $0; next }
10780 { print $0"=1" }' ccsym.raw >ccsym.list
ecfc5424
AD
10781$awk '{ print $0"=1" }' Cppsym.true >ccsym.true
10782$comm -13 ccsym.true ccsym.list >ccsym.own
10783$comm -12 ccsym.true ccsym.list >ccsym.com
10784$comm -23 ccsym.true ccsym.list >ccsym.cpp
10785also=''
10786symbols='symbols'
10787if $test -z ccsym.raw; then
10788 echo "Your C compiler doesn't seem to define any symbol!" >&4
10789 echo " "
10790 echo "However, your C preprocessor defines the following ones:"
10791 $cat Cppsym.true
10792else
10793 if $test -s ccsym.com; then
10794 echo "Your C compiler and pre-processor define these symbols:"
10795 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
10796 also='also '
10797 symbols='ones'
10798 $test "$silent" || sleep 1
10799 fi
10800 if $test -s ccsym.cpp; then
10801 $test "$also" && echo " "
10802 echo "Your C pre-processor ${also}defines the following $symbols:"
10803 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
10804 also='further '
10805 $test "$silent" || sleep 1
10806 fi
10807 if $test -s ccsym.own; then
10808 $test "$also" && echo " "
10809 echo "Your C compiler ${also}defines the following cpp variables:"
10810 $sed -e 's/\(.*\)=1/\1/' ccsym.own
10811 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
10812 $test "$silent" || sleep 1
10813 fi
10814fi
10815$rm -f ccsym*
2304df62
AD
10816
10817: see if this is a termio system
10818val="$undef"
10819val2="$undef"
10820val3="$undef"
10821if $test `./findhdr termios.h`; then
10822 set tcsetattr i_termios
10823 eval $inlibc
10824 val3="$i_termios"
10825fi
10826echo " "
10827case "$val3" in
10828"$define") echo "You have POSIX termios.h... good!" >&4;;
ecfc5424 10829*) if ./Cppsym pyr; then
2304df62
AD
10830 case "`/bin/universe`" in
10831 ucb) if $test `./findhdr sgtty.h`; then
10832 val2="$define"
10833 echo "<sgtty.h> found." >&4
10834 else
10835 echo "System is pyramid with BSD universe."
10836 echo "<sgtty.h> not found--you could have problems." >&4
10837 fi;;
10838 *) if $test `./findhdr termio.h`; then
10839 val="$define"
10840 echo "<termio.h> found." >&4
10841 else
10842 echo "System is pyramid with USG universe."
10843 echo "<termio.h> not found--you could have problems." >&4
10844 fi;;
10845 esac
ecfc5424 10846 elif ./usg; then
2304df62
AD
10847 if $test `./findhdr termio.h`; then
10848 echo "<termio.h> found." >&4
10849 val="$define"
10850 elif $test `./findhdr sgtty.h`; then
10851 echo "<sgtty.h> found." >&4
10852 val2="$define"
10853 else
10854echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
10855 fi
10856 else
10857 if $test `./findhdr sgtty.h`; then
10858 echo "<sgtty.h> found." >&4
10859 val2="$define"
10860 elif $test `./findhdr termio.h`; then
10861 echo "<termio.h> found." >&4
10862 val="$define"
10863 else
10864echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
10865 fi
10866 fi;;
10867esac
10868set i_termio; eval $setvar
10869val=$val2; set i_sgtty; eval $setvar
10870val=$val3; set i_termios; eval $setvar
10871
a0d0e21e 10872: see if stdarg is available
2304df62 10873echo " "
a0d0e21e
LW
10874if $test `./findhdr stdarg.h`; then
10875 echo "<stdarg.h> found." >&4
10876 valstd="$define"
2304df62 10877else
a0d0e21e
LW
10878 echo "<stdarg.h> NOT found." >&4
10879 valstd="$undef"
2304df62 10880fi
85e6fe83 10881
a0d0e21e 10882: see if varags is available
2304df62
AD
10883echo " "
10884if $test `./findhdr varargs.h`; then
2304df62
AD
10885 echo "<varargs.h> found." >&4
10886else
2304df62
AD
10887 echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10888fi
2304df62
AD
10889
10890: set up the varargs testing programs
10891$cat > varargs.c <<EOP
10892#ifdef I_STDARG
10893#include <stdarg.h>
10894#endif
10895#ifdef I_VARARGS
10896#include <varargs.h>
10897#endif
10898
10899#ifdef I_STDARG
10900int f(char *p, ...)
10901#else
10902int f(va_alist)
10903va_dcl
10904#endif
10905{
10906 va_list ap;
10907#ifndef I_STDARG
10908 char *p;
10909#endif
10910#ifdef I_STDARG
10911 va_start(ap,p);
10912#else
10913 va_start(ap);
10914 p = va_arg(ap, char *);
10915#endif
10916 va_end(ap);
10917}
10918EOP
10919$cat > varargs <<EOP
40a7a20a 10920$startsh
2304df62
AD
10921if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10922 echo "true"
10923else
10924 echo "false"
10925fi
dfe9444c 10926$rm -f varargs$_o
2304df62
AD
10927EOP
10928chmod +x varargs
10929
10930: now check which varargs header should be included
10931echo " "
10932i_varhdr=''
a0d0e21e 10933case "$valstd" in
2304df62
AD
10934"$define")
10935 if `./varargs I_STDARG`; then
a0d0e21e 10936 val='stdarg.h'
2304df62 10937 elif `./varargs I_VARARGS`; then
a0d0e21e 10938 val='varargs.h'
2304df62
AD
10939 fi
10940 ;;
10941*)
10942 if `./varargs I_VARARGS`; then
a0d0e21e 10943 val='varargs.h'
2304df62
AD
10944 fi
10945 ;;
10946esac
a0d0e21e 10947case "$val" in
2304df62
AD
10948'')
10949echo "I could not find the definition for va_dcl... You have problems..." >&4
a0d0e21e
LW
10950 val="$undef"; set i_stdarg; eval $setvar
10951 val="$undef"; set i_varargs; eval $setvar
2304df62 10952 ;;
a0d0e21e
LW
10953*)
10954 set i_varhdr
10955 eval $setvar
10956 case "$i_varhdr" in
10957 stdarg.h)
10958 val="$define"; set i_stdarg; eval $setvar
10959 val="$undef"; set i_varargs; eval $setvar
10960 ;;
10961 varargs.h)
10962 val="$undef"; set i_stdarg; eval $setvar
10963 val="$define"; set i_varargs; eval $setvar
10964 ;;
10965 esac
10966 echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
2304df62
AD
10967esac
10968$rm -f varargs*
10969
a0d0e21e
LW
10970: see if stddef is available
10971set stddef.h i_stddef
10972eval $inhdr
10973
a0d0e21e
LW
10974: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
10975set sys/filio.h i_sysfilio
10976eval $inhdr
10977echo " "
10978if $test `./findhdr sys/ioctl.h`; then
10979 val="$define"
10980 echo '<sys/ioctl.h> found.' >&4
10981else
10982 val="$undef"
10983 if $test $i_sysfilio = "$define"; then
10984 echo '<sys/ioctl.h> NOT found.' >&4
10985 else
10986 $test $i_sgtty = "$define" && xxx="sgtty.h"
10987 $test $i_termio = "$define" && xxx="termio.h"
10988 $test $i_termios = "$define" && xxx="termios.h"
10989echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
10990 fi
10991fi
10992set i_sysioctl
10993eval $setvar
10994
10995: see if this is a sys/param system
10996set sys/param.h i_sysparam
10997eval $inhdr
10998
8ff267be 10999: see if sys/resource.h has to be included
11000set sys/resource.h i_sysresrc
11001eval $inhdr
11002
1aef975c
AD
11003: see if sys/stat.h is available
11004set sys/stat.h i_sysstat
11005eval $inhdr
11006
25f94b33
AD
11007: see if this is a sys/un.h system
11008set sys/un.h i_sysun
11009eval $inhdr
11010
8ff267be 11011: see if this is a syswait system
11012set sys/wait.h i_syswait
a0d0e21e
LW
11013eval $inhdr
11014
11015: see if this is an utime system
11016set utime.h i_utime
11017eval $inhdr
11018
760ac839
LW
11019: see if this is a values.h system
11020set values.h i_values
11021eval $inhdr
11022
2304df62 11023: see if this is a vfork system
85e6fe83 11024case "$d_vfork" in
a0d0e21e
LW
11025"$define")
11026 set vfork.h i_vfork
85e6fe83
LW
11027 eval $inhdr
11028 ;;
a0d0e21e
LW
11029*)
11030 i_vfork="$undef"
11031 ;;
85e6fe83 11032esac
a0d0e21e 11033
4633a7c4
LW
11034: see if gdbm.h is available
11035set gdbm.h t_gdbm
11036eval $inhdr
11037case "$t_gdbm" in
11038$define)
11039 : see if gdbm_open exists
11040 set gdbm_open d_gdbm_open
11041 eval $inlibc
11042 case "$d_gdbm_open" in
11043 $undef)
11044 t_gdbm="$undef"
11045 echo "We won't be including <gdbm.h>"
11046 ;;
11047 esac
11048 ;;
11049esac
11050val="$t_gdbm"
11051set i_gdbm
11052eval $setvar
11053
11054echo " "
11055echo "Looking for extensions..." >&4
dc45a647
MB
11056tdir=`pwd`
11057cd $rsrc/ext
4633a7c4
LW
11058: If we are using the old config.sh, known_extensions may contain
11059: old or inaccurate or duplicate values.
11060known_extensions=''
4318d5a0 11061nonxs_extensions=''
4633a7c4
LW
11062: We do not use find because it might not be available.
11063: We do not just use MANIFEST because the user may have dropped
11064: some additional extensions into the source tree and expect them
11065: to be built.
11066for xxx in * ; do
693762b4 11067 case "$xxx" in
24548b42 11068 DynaLoader|dynaload) ;;
693762b4
AD
11069 *) if $test -f $xxx/$xxx.xs; then
11070 known_extensions="$known_extensions $xxx"
bfb7748a
AD
11071 elif $test -f $xxx/Makefile.PL; then
11072 nonxs_extensions="$nonxs_extensions $xxx"
693762b4
AD
11073 else
11074 if $test -d $xxx; then
bfb7748a 11075 # Look for nested extensions, eg. Devel/Dprof.
693762b4
AD
11076 cd $xxx
11077 for yyy in * ; do
11078 if $test -f $yyy/$yyy.xs; then
11079 known_extensions="$known_extensions $xxx/$yyy"
bfb7748a
AD
11080 elif $test -f $yyy/Makefile.PL; then
11081 nonxs_extensions="$nonxs_extensions $xxx/$yyy"
693762b4
AD
11082 fi
11083 done
dc45a647 11084 cd ..
693762b4
AD
11085 fi
11086 fi
11087 ;;
11088 esac
4633a7c4 11089done
4318d5a0
GB
11090set X $nonxs_extensions
11091shift
11092nonxs_extensions="$*"
4633a7c4
LW
11093set X $known_extensions
11094shift
11095known_extensions="$*"
dc45a647 11096cd $tdir
4633a7c4
LW
11097
11098: Now see which are supported on this system.
11099avail_ext=''
11100for xxx in $known_extensions ; do
693762b4
AD
11101 case "$xxx" in
11102 DB_File|db_file)
11103 case "$i_db" in
11104 $define) avail_ext="$avail_ext $xxx" ;;
11105 esac
11106 ;;
11107 GDBM_File|gdbm_fil)
11108 case "$i_gdbm" in
11109 $define) avail_ext="$avail_ext $xxx" ;;
11110 esac
11111 ;;
11112 NDBM_File|ndbm_fil)
11113 case "$i_ndbm" in
11114 $define) avail_ext="$avail_ext $xxx" ;;
11115 esac
11116 ;;
11117 ODBM_File|odbm_fil)
11118 case "${i_dbm}${i_rpcsvcdbm}" in
11119 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
11120 esac
11121 ;;
11122 POSIX|posix)
11123 case "$useposix" in
11124 true|define|y) avail_ext="$avail_ext $xxx" ;;
11125 esac
11126 ;;
11127 Opcode|opcode)
11128 case "$useopcode" in
11129 true|define|y) avail_ext="$avail_ext $xxx" ;;
11130 esac
11131 ;;
11132 Socket|socket)
11133 case "$d_socket" in
11134 true|$define|y) avail_ext="$avail_ext $xxx" ;;
11135 esac
11136 ;;
11137 Thread|thread)
11138 case "$usethreads" in
11139 true|$define|y) avail_ext="$avail_ext $xxx" ;;
11140 esac
11141 ;;
17f71141 11142 IPC/SysV|ipc/sysv)
a3f9223b
GS
11143 case "${d_msg}${d_sem}${d_shm}" in
11144 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
24548b42
AD
11145 esac
11146 ;;
bfb7748a 11147 *) avail_ext="$avail_ext $xxx"
693762b4
AD
11148 ;;
11149 esac
4633a7c4
LW
11150done
11151
11152set X $avail_ext
11153shift
11154avail_ext="$*"
11155
4318d5a0 11156: Now see which nonxs extensions are supported on this system.
bfb7748a 11157: For now assume all are.
4318d5a0
GB
11158nonxs_ext=''
11159for xxx in $nonxs_extensions ; do
11160 case "$xxx" in
11161 *) nonxs_ext="$nonxs_ext $xxx"
11162 ;;
11163 esac
11164done
11165
11166set X $nonxs_ext
11167shift
11168nonxs_ext="$*"
11169
4633a7c4
LW
11170case $usedl in
11171$define)
11172 $cat <<EOM
11173A number of extensions are supplied with $package. You may choose to
11174compile these extensions for dynamic loading (the default), compile
11175them into the $package executable (static loading), or not include
11176them at all. Answer "none" to include no extensions.
693762b4 11177Note that DynaLoader is always built and need not be mentioned here.
4633a7c4
LW
11178
11179EOM
11180 case "$dynamic_ext" in
11181 '') dflt="$avail_ext" ;;
693762b4
AD
11182 *) dflt="$dynamic_ext"
11183 # Perhaps we are reusing an old out-of-date config.sh.
11184 case "$hint" in
11185 previous)
c4f23d77 11186 if test X"$dynamic_ext" != X"$avail_ext"; then
693762b4
AD
11187 $cat <<EOM
11188NOTICE: Your previous config.sh list may be incorrect.
11189The extensions now available to you are
11190 ${avail_ext}
11191but the default list from your previous config.sh is
11192 ${dynamic_ext}
11193
11194EOM
11195 fi
11196 ;;
11197 esac
11198 ;;
4633a7c4
LW
11199 esac
11200 case "$dflt" in
11201 '') dflt=none;;
11202 esac
11203 rp="What extensions do you wish to load dynamically?"
11204 . ./myread
11205 case "$ans" in
11206 none) dynamic_ext=' ' ;;
11207 *) dynamic_ext="$ans" ;;
11208 esac
11209
11210 case "$static_ext" in
11211 '')
11212 : Exclude those already listed in dynamic linking
11213 dflt=''
11214 for xxx in $avail_ext; do
bfb7748a 11215 case " $dynamic_ext " in
4633a7c4
LW
11216 *" $xxx "*) ;;
11217 *) dflt="$dflt $xxx" ;;
11218 esac
11219 done
11220 set X $dflt
11221 shift
11222 dflt="$*"
11223 ;;
11224 *) dflt="$static_ext"
11225 ;;
11226 esac
11227
11228 case "$dflt" in
11229 '') dflt=none;;
11230 esac
11231 rp="What extensions do you wish to load statically?"
11232 . ./myread
11233 case "$ans" in
11234 none) static_ext=' ' ;;
11235 *) static_ext="$ans" ;;
11236 esac
11237 ;;
11238*)
11239 $cat <<EOM
11240A number of extensions are supplied with $package. Answer "none"
11241to include no extensions.
693762b4 11242Note that DynaLoader is always built and need not be mentioned here.
4633a7c4
LW
11243
11244EOM
11245 case "$static_ext" in
11246 '') dflt="$avail_ext" ;;
693762b4
AD
11247 *) dflt="$static_ext"
11248 # Perhaps we are reusing an old out-of-date config.sh.
11249 case "$hint" in
11250 previous)
c4f23d77 11251 if test X"$static_ext" != X"$avail_ext"; then
693762b4
AD
11252 $cat <<EOM
11253NOTICE: Your previous config.sh list may be incorrect.
11254The extensions now available to you are
11255 ${avail_ext}
11256but the default list from your previous config.sh is
11257 ${static_ext}
4633a7c4 11258
693762b4
AD
11259EOM
11260 fi
11261 ;;
11262 esac
11263 ;;
11264 esac
bfb7748a 11265 : Exclude those that are not xs extensions
4633a7c4
LW
11266 case "$dflt" in
11267 '') dflt=none;;
11268 esac
11269 rp="What extensions do you wish to include?"
11270 . ./myread
11271 case "$ans" in
11272 none) static_ext=' ' ;;
11273 *) static_ext="$ans" ;;
11274 esac
11275 ;;
11276esac
11277
bfb7748a 11278set X $dynamic_ext $static_ext $nonxs_ext
4633a7c4
LW
11279shift
11280extensions="$*"
11281
16d20bd9
AD
11282: Remove build directory name from cppstdin so it can be used from
11283: either the present location or the final installed location.
11284echo " "
11285: Get out of the UU directory to get correct path name.
11286cd ..
11287case "$cppstdin" in
11288`pwd`/cppstdin)
11289 echo "Stripping down cppstdin path name"
11290 cppstdin=cppstdin
11291 ;;
11292esac
11293cd UU
11294
2304df62
AD
11295: end of configuration questions
11296echo " "
11297echo "End of configuration questions."
11298echo " "
11299
11300: back to where it started
11301if test -d ../UU; then
11302 cd ..
11303fi
11304
11305: configuration may be patched via a 'config.over' file
11306if $test -f config.over; then
11307 echo " "
11308 dflt=y
11309 rp='I see a config.over file. Do you wish to load it?'
11310 . UU/myread
11311 case "$ans" in
11312 n*) echo "OK, I'll ignore it.";;
11313 *) . ./config.over
11314 echo "Configuration override changes have been loaded."
11315 ;;
11316 esac
11317fi
11318
ecfc5424
AD
11319: in case they want portability, strip down executable paths
11320case "$d_portable" in
11321"$define")
11322 echo " "
11323 echo "Stripping down executable paths..." >&4
11324 for file in $loclist $trylist; do
c4f23d77
AD
11325 if test X$file != Xln -a X$file != Xar -o X$osname != Xos2; then
11326 eval $file="\$file"
11327 fi
ecfc5424
AD
11328 done
11329 ;;
11330esac
11331
2304df62
AD
11332: create config.sh file
11333echo " "
11334echo "Creating config.sh..." >&4
11335$spitshell <<EOT >config.sh
11336$startsh
11337#
dfe9444c
AD
11338# This file was produced by running the Configure script. It holds all the
11339# definitions figured out by Configure. Should you modify one of these values,
11340# do not forget to propagate your changes by running "Configure -der". You may
11341# instead choose to run each of the .SH files by yourself, or "Configure -S".
2304df62
AD
11342#
11343
dfe9444c
AD
11344# Package name : $package
11345# Source directory : $src
2304df62 11346# Configuration time: $cf_time
dfe9444c
AD
11347# Configured by : $cf_by
11348# Target system : $myuname
2304df62 11349
2304df62
AD
11350Author='$Author'
11351Date='$Date'
11352Header='$Header'
11353Id='$Id'
11354Locker='$Locker'
11355Log='$Log'
ecfc5424 11356Mcc='$Mcc'
2304df62
AD
11357RCSfile='$RCSfile'
11358Revision='$Revision'
11359Source='$Source'
11360State='$State'
dfe9444c
AD
11361_a='$_a'
11362_exe='$_exe'
11363_o='$_o'
2304df62 11364afs='$afs'
a0d0e21e 11365alignbytes='$alignbytes'
c4f23d77 11366ansi2knr='$ansi2knr'
ecfc5424 11367aphostname='$aphostname'
bfb7748a 11368apiversion='$apiversion'
4633a7c4 11369ar='$ar'
a0d0e21e
LW
11370archlib='$archlib'
11371archlibexp='$archlibexp'
11372archname='$archname'
4633a7c4 11373archobjs='$archobjs'
ecfc5424
AD
11374awk='$awk'
11375baserev='$baserev'
11376bash='$bash'
2304df62
AD
11377bin='$bin'
11378binexp='$binexp'
ecfc5424
AD
11379bison='$bison'
11380byacc='$byacc'
2304df62 11381byteorder='$byteorder'
ecfc5424
AD
11382c='$c'
11383castflags='$castflags'
11384cat='$cat'
2304df62 11385cc='$cc'
ecfc5424
AD
11386cccdlflags='$cccdlflags'
11387ccdlflags='$ccdlflags'
2304df62 11388ccflags='$ccflags'
2304df62 11389cf_by='$cf_by'
8e07c86e 11390cf_email='$cf_email'
2304df62 11391cf_time='$cf_time'
ecfc5424
AD
11392chgrp='$chgrp'
11393chmod='$chmod'
11394chown='$chown'
11395clocktype='$clocktype'
11396comm='$comm'
11397compress='$compress'
2304df62 11398contains='$contains'
ecfc5424
AD
11399cp='$cp'
11400cpio='$cpio'
11401cpp='$cpp'
a0d0e21e 11402cpp_stuff='$cpp_stuff'
ecfc5424 11403cppflags='$cppflags'
2304df62
AD
11404cpplast='$cpplast'
11405cppminus='$cppminus'
11406cpprun='$cpprun'
11407cppstdin='$cppstdin'
ecfc5424
AD
11408cryptlib='$cryptlib'
11409csh='$csh'
11410d_Gconvert='$d_Gconvert'
2304df62 11411d_access='$d_access'
a0d0e21e 11412d_alarm='$d_alarm'
ecfc5424
AD
11413d_archlib='$d_archlib'
11414d_attribut='$d_attribut'
2304df62
AD
11415d_bcmp='$d_bcmp'
11416d_bcopy='$d_bcopy'
ecfc5424 11417d_bsd='$d_bsd'
2afac517 11418d_bsdgetpgrp='$d_bsdgetpgrp'
2afac517 11419d_bsdsetpgrp='$d_bsdsetpgrp'
2304df62
AD
11420d_bzero='$d_bzero'
11421d_casti32='$d_casti32'
2304df62 11422d_castneg='$d_castneg'
ecfc5424 11423d_charvspr='$d_charvspr'
a0d0e21e
LW
11424d_chown='$d_chown'
11425d_chroot='$d_chroot'
2304df62 11426d_chsize='$d_chsize'
a0d0e21e 11427d_closedir='$d_closedir'
2304df62 11428d_const='$d_const'
2304df62
AD
11429d_crypt='$d_crypt'
11430d_csh='$d_csh'
a0d0e21e
LW
11431d_cuserid='$d_cuserid'
11432d_dbl_dig='$d_dbl_dig'
11433d_difftime='$d_difftime'
ecfc5424 11434d_dirnamlen='$d_dirnamlen'
a0d0e21e
LW
11435d_dlerror='$d_dlerror'
11436d_dlopen='$d_dlopen'
11437d_dlsymun='$d_dlsymun'
2304df62
AD
11438d_dosuid='$d_dosuid'
11439d_dup2='$d_dup2'
28e8609d 11440d_endgrent='$d_endgrent'
e5c9fcd0
AD
11441d_endhent='$d_endhent'
11442d_endnent='$d_endnent'
11443d_endpent='$d_endpent'
28e8609d 11444d_endpwent='$d_endpwent'
e5c9fcd0 11445d_endsent='$d_endsent'
8e07c86e 11446d_eofnblk='$d_eofnblk'
40a7a20a 11447d_eunice='$d_eunice'
2304df62
AD
11448d_fchmod='$d_fchmod'
11449d_fchown='$d_fchown'
11450d_fcntl='$d_fcntl'
a0d0e21e
LW
11451d_fd_macros='$d_fd_macros'
11452d_fd_set='$d_fd_set'
11453d_fds_bits='$d_fds_bits'
11454d_fgetpos='$d_fgetpos'
2304df62
AD
11455d_flexfnam='$d_flexfnam'
11456d_flock='$d_flock'
a0d0e21e 11457d_fork='$d_fork'
ecfc5424 11458d_fpathconf='$d_fpathconf'
a0d0e21e 11459d_fsetpos='$d_fsetpos'
5f05dabc 11460d_ftime='$d_ftime'
28e8609d 11461d_getgrent='$d_getgrent'
2304df62 11462d_getgrps='$d_getgrps'
4599a1de 11463d_gethbyaddr='$d_gethbyaddr'
3cbc818d 11464d_gethbyname='$d_gethbyname'
2304df62 11465d_gethent='$d_gethent'
2304df62 11466d_gethname='$d_gethname'
dc45a647 11467d_gethostprotos='$d_gethostprotos'
a0d0e21e 11468d_getlogin='$d_getlogin'
4599a1de 11469d_getnbyaddr='$d_getnbyaddr'
693762b4 11470d_getnbyname='$d_getnbyname'
e5c9fcd0 11471d_getnent='$d_getnent'
dc45a647 11472d_getnetprotos='$d_getnetprotos'
693762b4
AD
11473d_getpbyname='$d_getpbyname'
11474d_getpbynumber='$d_getpbynumber'
e5c9fcd0 11475d_getpent='$d_getpent'
2afac517 11476d_getpgid='$d_getpgid'
2304df62
AD
11477d_getpgrp2='$d_getpgrp2'
11478d_getpgrp='$d_getpgrp'
a0d0e21e 11479d_getppid='$d_getppid'
2304df62 11480d_getprior='$d_getprior'
dc45a647 11481d_getprotoprotos='$d_getprotoprotos'
28e8609d 11482d_getpwent='$d_getpwent'
693762b4
AD
11483d_getsbyname='$d_getsbyname'
11484d_getsbyport='$d_getsbyport'
e5c9fcd0 11485d_getsent='$d_getsent'
dc45a647 11486d_getservprotos='$d_getservprotos'
5f05dabc 11487d_gettimeod='$d_gettimeod'
a4f3eea9 11488d_gnulibc='$d_gnulibc'
28e8609d 11489d_grpasswd='$d_grpasswd'
2304df62 11490d_htonl='$d_htonl'
ecfc5424 11491d_index='$d_index'
7e1af8bc 11492d_inetaton='$d_inetaton'
2304df62
AD
11493d_isascii='$d_isascii'
11494d_killpg='$d_killpg'
dd64f1c3 11495d_lchown='$d_lchown'
2304df62 11496d_link='$d_link'
a0d0e21e
LW
11497d_locconv='$d_locconv'
11498d_lockf='$d_lockf'
e5c9fcd0 11499d_longdbl='$d_longdbl'
dc45a647 11500d_longlong='$d_longlong'
2304df62 11501d_lstat='$d_lstat'
a0d0e21e
LW
11502d_mblen='$d_mblen'
11503d_mbstowcs='$d_mbstowcs'
11504d_mbtowc='$d_mbtowc'
2304df62
AD
11505d_memcmp='$d_memcmp'
11506d_memcpy='$d_memcpy'
11507d_memmove='$d_memmove'
11508d_memset='$d_memset'
11509d_mkdir='$d_mkdir'
a0d0e21e
LW
11510d_mkfifo='$d_mkfifo'
11511d_mktime='$d_mktime'
2304df62
AD
11512d_msg='$d_msg'
11513d_msgctl='$d_msgctl'
11514d_msgget='$d_msgget'
11515d_msgrcv='$d_msgrcv'
11516d_msgsnd='$d_msgsnd'
ecfc5424 11517d_mymalloc='$d_mymalloc'
a0d0e21e 11518d_nice='$d_nice'
693762b4 11519d_oldpthreads='$d_oldpthreads'
ecfc5424 11520d_oldsock='$d_oldsock'
2304df62 11521d_open3='$d_open3'
a0d0e21e
LW
11522d_pathconf='$d_pathconf'
11523d_pause='$d_pause'
ecfc5424 11524d_phostname='$d_phostname'
a0d0e21e 11525d_pipe='$d_pipe'
8e07c86e 11526d_poll='$d_poll'
2304df62 11527d_portable='$d_portable'
52e1cb5e 11528d_pthread_yield='$d_pthread_yield'
ce637636 11529d_pthreads_created_joinable='$d_pthreads_created_joinable'
ecfc5424
AD
11530d_pwage='$d_pwage'
11531d_pwchange='$d_pwchange'
11532d_pwclass='$d_pwclass'
11533d_pwcomment='$d_pwcomment'
11534d_pwexpire='$d_pwexpire'
c4f23d77 11535d_pwgecos='$d_pwgecos'
ecfc5424 11536d_pwquota='$d_pwquota'
28e8609d 11537d_pwpasswd='$d_pwpasswd'
2304df62 11538d_readdir='$d_readdir'
a0d0e21e 11539d_readlink='$d_readlink'
2304df62 11540d_rename='$d_rename'
ecfc5424 11541d_rewinddir='$d_rewinddir'
2304df62
AD
11542d_rmdir='$d_rmdir'
11543d_safebcpy='$d_safebcpy'
11544d_safemcpy='$d_safemcpy'
36477c24 11545d_sanemcmp='$d_sanemcmp'
52e1cb5e 11546d_sched_yield='$d_sched_yield'
ecfc5424 11547d_seekdir='$d_seekdir'
2304df62
AD
11548d_select='$d_select'
11549d_sem='$d_sem'
11550d_semctl='$d_semctl'
bd89102f
AD
11551d_semctl_semid_ds='$d_semctl_semid_ds'
11552d_semctl_semun='$d_semctl_semun'
2304df62
AD
11553d_semget='$d_semget'
11554d_semop='$d_semop'
11555d_setegid='$d_setegid'
11556d_seteuid='$d_seteuid'
28e8609d 11557d_setgrent='$d_setgrent'
dfe9444c 11558d_setgrps='$d_setgrps'
693762b4 11559d_sethent='$d_sethent'
a0d0e21e 11560d_setlinebuf='$d_setlinebuf'
2304df62 11561d_setlocale='$d_setlocale'
e5c9fcd0
AD
11562d_setnent='$d_setnent'
11563d_setpent='$d_setpent'
2304df62
AD
11564d_setpgid='$d_setpgid'
11565d_setpgrp2='$d_setpgrp2'
2304df62
AD
11566d_setpgrp='$d_setpgrp'
11567d_setprior='$d_setprior'
28e8609d 11568d_setpwent='$d_setpwent'
2304df62
AD
11569d_setregid='$d_setregid'
11570d_setresgid='$d_setresgid'
11571d_setresuid='$d_setresuid'
11572d_setreuid='$d_setreuid'
11573d_setrgid='$d_setrgid'
11574d_setruid='$d_setruid'
e5c9fcd0 11575d_setsent='$d_setsent'
2304df62 11576d_setsid='$d_setsid'
e5c9fcd0 11577d_setvbuf='$d_setvbuf'
760ac839 11578d_sfio='$d_sfio'
2304df62
AD
11579d_shm='$d_shm'
11580d_shmat='$d_shmat'
a0d0e21e 11581d_shmatprototype='$d_shmatprototype'
2304df62
AD
11582d_shmctl='$d_shmctl'
11583d_shmdt='$d_shmdt'
11584d_shmget='$d_shmget'
2c7991dc 11585d_sigaction='$d_sigaction'
a5f75d66 11586d_sigsetjmp='$d_sigsetjmp'
2304df62
AD
11587d_socket='$d_socket'
11588d_sockpair='$d_sockpair'
2304df62 11589d_statblks='$d_statblks'
c2960299
AD
11590d_stdio_cnt_lval='$d_stdio_cnt_lval'
11591d_stdio_ptr_lval='$d_stdio_ptr_lval'
16d20bd9 11592d_stdiobase='$d_stdiobase'
2304df62 11593d_stdstdio='$d_stdstdio'
2304df62 11594d_strchr='$d_strchr'
a0d0e21e 11595d_strcoll='$d_strcoll'
2304df62
AD
11596d_strctcpy='$d_strctcpy'
11597d_strerrm='$d_strerrm'
11598d_strerror='$d_strerror'
a89d8a78
DH
11599d_strtod='$d_strtod'
11600d_strtol='$d_strtol'
11601d_strtoul='$d_strtoul'
a0d0e21e 11602d_strxfrm='$d_strxfrm'
ecfc5424 11603d_suidsafe='$d_suidsafe'
2304df62
AD
11604d_symlink='$d_symlink'
11605d_syscall='$d_syscall'
a0d0e21e 11606d_sysconf='$d_sysconf'
ecfc5424
AD
11607d_sysernlst='$d_sysernlst'
11608d_syserrlst='$d_syserrlst'
2304df62 11609d_system='$d_system'
a0d0e21e
LW
11610d_tcgetpgrp='$d_tcgetpgrp'
11611d_tcsetpgrp='$d_tcsetpgrp'
ecfc5424 11612d_telldir='$d_telldir'
85e6fe83 11613d_time='$d_time'
2304df62
AD
11614d_times='$d_times'
11615d_truncate='$d_truncate'
a0d0e21e
LW
11616d_tzname='$d_tzname'
11617d_umask='$d_umask'
ecfc5424 11618d_uname='$d_uname'
bd89102f 11619d_union_semun='$d_union_semun'
2304df62 11620d_vfork='$d_vfork'
ecfc5424 11621d_void_closedir='$d_void_closedir'
2304df62 11622d_voidsig='$d_voidsig'
ecfc5424 11623d_voidtty='$d_voidtty'
2304df62 11624d_volatile='$d_volatile'
2304df62
AD
11625d_vprintf='$d_vprintf'
11626d_wait4='$d_wait4'
11627d_waitpid='$d_waitpid'
a0d0e21e
LW
11628d_wcstombs='$d_wcstombs'
11629d_wctomb='$d_wctomb'
ecfc5424
AD
11630d_xenix='$d_xenix'
11631date='$date'
11632db_hashtype='$db_hashtype'
11633db_prefixtype='$db_prefixtype'
11634defvoidused='$defvoidused'
11635direntrytype='$direntrytype'
a0d0e21e 11636dlext='$dlext'
2304df62 11637dlsrc='$dlsrc'
693762b4 11638doublesize='$doublesize'
ecfc5424 11639dynamic_ext='$dynamic_ext'
8e07c86e 11640eagain='$eagain'
28e8609d 11641ebcdic='$ebcdic'
ecfc5424
AD
11642echo='$echo'
11643egrep='$egrep'
11644emacs='$emacs'
11645eunicefix='$eunicefix'
4633a7c4 11646exe_ext='$exe_ext'
ecfc5424
AD
11647expr='$expr'
11648extensions='$extensions'
11649find='$find'
4633a7c4 11650firstmakefile='$firstmakefile'
ecfc5424 11651flex='$flex'
a0d0e21e 11652fpostype='$fpostype'
94b6baf5 11653freetype='$freetype'
1aef975c
AD
11654full_csh='$full_csh'
11655full_sed='$full_sed'
ecfc5424 11656gccversion='$gccversion'
2304df62 11657gidtype='$gidtype'
ecfc5424
AD
11658glibpth='$glibpth'
11659grep='$grep'
11660groupcat='$groupcat'
2304df62 11661groupstype='$groupstype'
8ff267be 11662gzip='$gzip'
2304df62
AD
11663h_fcntl='$h_fcntl'
11664h_sysfile='$h_sysfile'
ecfc5424
AD
11665hint='$hint'
11666hostcat='$hostcat'
11667huge='$huge'
93341792 11668i_arpainet='$i_arpainet'
ecfc5424 11669i_bsdioctl='$i_bsdioctl'
a0d0e21e 11670i_db='$i_db'
2304df62 11671i_dbm='$i_dbm'
2304df62 11672i_dirent='$i_dirent'
a0d0e21e 11673i_dld='$i_dld'
2304df62
AD
11674i_dlfcn='$i_dlfcn'
11675i_fcntl='$i_fcntl'
a0d0e21e 11676i_float='$i_float'
2304df62
AD
11677i_gdbm='$i_gdbm'
11678i_grp='$i_grp'
a0d0e21e 11679i_limits='$i_limits'
4633a7c4 11680i_locale='$i_locale'
a0d0e21e
LW
11681i_malloc='$i_malloc'
11682i_math='$i_math'
85e6fe83 11683i_memory='$i_memory'
2304df62 11684i_ndbm='$i_ndbm'
3fd537d4 11685i_netdb='$i_netdb'
85e6fe83 11686i_neterrno='$i_neterrno'
2304df62 11687i_niin='$i_niin'
2304df62 11688i_pwd='$i_pwd'
8e07c86e 11689i_rpcsvcdbm='$i_rpcsvcdbm'
760ac839 11690i_sfio='$i_sfio'
ecfc5424
AD
11691i_sgtty='$i_sgtty'
11692i_stdarg='$i_stdarg'
2304df62 11693i_stddef='$i_stddef'
a0d0e21e 11694i_stdlib='$i_stdlib'
2304df62 11695i_string='$i_string'
2304df62
AD
11696i_sysdir='$i_sysdir'
11697i_sysfile='$i_sysfile'
a0d0e21e 11698i_sysfilio='$i_sysfilio'
ecfc5424 11699i_sysin='$i_sysin'
2304df62 11700i_sysioctl='$i_sysioctl'
2304df62 11701i_sysndir='$i_sysndir'
a0d0e21e 11702i_sysparam='$i_sysparam'
8ff267be 11703i_sysresrc='$i_sysresrc'
2304df62 11704i_sysselct='$i_sysselct'
ecfc5424 11705i_syssockio='$i_syssockio'
1aef975c 11706i_sysstat='$i_sysstat'
ecfc5424
AD
11707i_systime='$i_systime'
11708i_systimek='$i_systimek'
a0d0e21e 11709i_systimes='$i_systimes'
fed7345c 11710i_systypes='$i_systypes'
25f94b33 11711i_sysun='$i_sysun'
8ff267be 11712i_syswait='$i_syswait'
2304df62
AD
11713i_termio='$i_termio'
11714i_termios='$i_termios'
2304df62 11715i_time='$i_time'
85e6fe83 11716i_unistd='$i_unistd'
2304df62 11717i_utime='$i_utime'
760ac839 11718i_values='$i_values'
2304df62
AD
11719i_varargs='$i_varargs'
11720i_varhdr='$i_varhdr'
11721i_vfork='$i_vfork'
ecfc5424
AD
11722incpath='$incpath'
11723inews='$inews'
11724installarchlib='$installarchlib'
11725installbin='$installbin'
16d20bd9
AD
11726installman1dir='$installman1dir'
11727installman3dir='$installman3dir'
ecfc5424
AD
11728installprivlib='$installprivlib'
11729installscript='$installscript'
4633a7c4 11730installsitearch='$installsitearch'
25f94b33 11731installsitelib='$installsitelib'
2304df62 11732intsize='$intsize'
ecfc5424
AD
11733known_extensions='$known_extensions'
11734ksh='$ksh'
11735large='$large'
232e078e 11736ld='$ld'
ecfc5424
AD
11737lddlflags='$lddlflags'
11738ldflags='$ldflags'
11739less='$less'
4633a7c4 11740lib_ext='$lib_ext'
2304df62 11741libc='$libc'
8ff267be 11742libperl='$libperl'
2304df62 11743libpth='$libpth'
2304df62 11744libs='$libs'
ecfc5424
AD
11745libswanted='$libswanted'
11746line='$line'
11747lint='$lint'
11748lkflags='$lkflags'
11749ln='$ln'
85e6fe83 11750lns='$lns'
8e07c86e
AD
11751locincpth='$locincpth'
11752loclibpth='$loclibpth'
e5c9fcd0 11753longdblsize='$longdblsize'
dc45a647 11754longlongsize='$longlongsize'
24fef2a7 11755longsize='$longsize'
ecfc5424
AD
11756lp='$lp'
11757lpr='$lpr'
11758ls='$ls'
85e6fe83 11759lseektype='$lseektype'
ecfc5424
AD
11760mail='$mail'
11761mailx='$mailx'
11762make='$make'
8ff267be 11763make_set_make='$make_set_make'
2304df62
AD
11764mallocobj='$mallocobj'
11765mallocsrc='$mallocsrc'
11766malloctype='$malloctype'
16d20bd9
AD
11767man1dir='$man1dir'
11768man1direxp='$man1direxp'
11769man1ext='$man1ext'
11770man3dir='$man3dir'
11771man3direxp='$man3direxp'
11772man3ext='$man3ext'
2304df62 11773medium='$medium'
ecfc5424
AD
11774mips='$mips'
11775mips_type='$mips_type'
11776mkdir='$mkdir'
2304df62 11777models='$models'
a0d0e21e 11778modetype='$modetype'
ecfc5424
AD
11779more='$more'
11780mv='$mv'
40000a8c 11781myarchname='$myarchname'
2304df62
AD
11782mydomain='$mydomain'
11783myhostname='$myhostname'
ecfc5424 11784myuname='$myuname'
2304df62 11785n='$n'
dfe9444c
AD
11786netdb_hlen_type='$netdb_hlen_type'
11787netdb_host_type='$netdb_host_type'
11788netdb_name_type='$netdb_name_type'
11789netdb_net_type='$netdb_net_type'
693762b4 11790nm='$nm'
ecfc5424 11791nm_opt='$nm_opt'
40a7a20a 11792nm_so_opt='$nm_so_opt'
bfb7748a 11793nonxs_ext='$nonxs_ext'
ecfc5424 11794nroff='$nroff'
8e07c86e 11795o_nonblock='$o_nonblock'
4633a7c4 11796obj_ext='$obj_ext'
ecfc5424 11797optimize='$optimize'
85e6fe83 11798orderlib='$orderlib'
ecfc5424
AD
11799osname='$osname'
11800osvers='$osvers'
2304df62 11801package='$package'
2c7991dc 11802pager='$pager'
ecfc5424
AD
11803passcat='$passcat'
11804patchlevel='$patchlevel'
4633a7c4 11805path_sep='$path_sep'
ecfc5424 11806perl='$perl'
8e07c86e 11807perladmin='$perladmin'
4633a7c4 11808perlpath='$perlpath'
ecfc5424
AD
11809pg='$pg'
11810phostname='$phostname'
dfe9444c 11811pidtype='$pidtype'
ecfc5424
AD
11812plibpth='$plibpth'
11813pmake='$pmake'
11814pr='$pr'
a0d0e21e 11815prefix='$prefix'
1aef975c 11816prefixexp='$prefixexp'
2304df62
AD
11817privlib='$privlib'
11818privlibexp='$privlibexp'
11819prototype='$prototype'
693762b4 11820ptrsize='$ptrsize'
2304df62 11821randbits='$randbits'
ecfc5424 11822ranlib='$ranlib'
8e07c86e 11823rd_nodata='$rd_nodata'
ecfc5424
AD
11824rm='$rm'
11825rmail='$rmail'
11826runnm='$runnm'
2304df62
AD
11827scriptdir='$scriptdir'
11828scriptdirexp='$scriptdirexp'
ecfc5424 11829sed='$sed'
a0d0e21e 11830selecttype='$selecttype'
ecfc5424
AD
11831sendmail='$sendmail'
11832sh='$sh'
11833shar='$shar'
11834sharpbang='$sharpbang'
11835shmattype='$shmattype'
24fef2a7 11836shortsize='$shortsize'
2afac517 11837shrpenv='$shrpenv'
ecfc5424 11838shsharp='$shsharp'
2304df62 11839sig_name='$sig_name'
dfe9444c 11840sig_name_init='$sig_name_init'
8e07c86e 11841sig_num='$sig_num'
ecfc5424 11842signal_t='$signal_t'
4633a7c4
LW
11843sitearch='$sitearch'
11844sitearchexp='$sitearchexp'
25f94b33
AD
11845sitelib='$sitelib'
11846sitelibexp='$sitelibexp'
a0d0e21e 11847sizetype='$sizetype'
ecfc5424
AD
11848sleep='$sleep'
11849smail='$smail'
11850small='$small'
a0d0e21e 11851so='$so'
ecfc5424
AD
11852sockethdr='$sockethdr'
11853socketlib='$socketlib'
11854sort='$sort'
11855spackage='$spackage'
2304df62 11856spitshell='$spitshell'
ecfc5424 11857split='$split'
dfe9444c 11858src='$src'
a0d0e21e 11859ssizetype='$ssizetype'
4633a7c4 11860startperl='$startperl'
2304df62 11861startsh='$startsh'
ecfc5424 11862static_ext='$static_ext'
2304df62 11863stdchar='$stdchar'
16d20bd9
AD
11864stdio_base='$stdio_base'
11865stdio_bufsiz='$stdio_bufsiz'
11866stdio_cnt='$stdio_cnt'
dfe9444c 11867stdio_filbuf='$stdio_filbuf'
16d20bd9 11868stdio_ptr='$stdio_ptr'
ecfc5424
AD
11869strings='$strings'
11870submit='$submit'
f55a7265 11871subversion='$subversion'
2304df62 11872sysman='$sysman'
ecfc5424
AD
11873tail='$tail'
11874tar='$tar'
11875tbl='$tbl'
693762b4 11876tee='$tee'
ecfc5424
AD
11877test='$test'
11878timeincl='$timeincl'
11879timetype='$timetype'
11880touch='$touch'
11881tr='$tr'
28e8609d 11882trnl='$trnl'
ecfc5424 11883troff='$troff'
2304df62 11884uidtype='$uidtype'
ecfc5424
AD
11885uname='$uname'
11886uniq='$uniq'
11887usedl='$usedl'
11888usemymalloc='$usemymalloc'
2304df62 11889usenm='$usenm'
8ff267be 11890useopcode='$useopcode'
11891useperlio='$useperlio'
ecfc5424 11892useposix='$useposix'
8ff267be 11893usesfio='$usesfio'
11894useshrplib='$useshrplib'
dfe9444c 11895usethreads='$usethreads'
ecfc5424 11896usevfork='$usevfork'
2304df62 11897usrinc='$usrinc'
ecfc5424 11898uuname='$uuname'
bfb7748a 11899version='$version'
ecfc5424 11900vi='$vi'
2304df62 11901voidflags='$voidflags'
ecfc5424
AD
11902xlibpth='$xlibpth'
11903zcat='$zcat'
8ff267be 11904zip='$zip'
2304df62
AD
11905EOT
11906
aebf16e7
AD
11907: Add in command line options if available
11908$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
11909
2304df62 11910: add special variables
dfe9444c
AD
11911$test -f $src/patchlevel.h && \
11912awk '/^#define/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
2304df62
AD
11913echo "CONFIG=true" >>config.sh
11914
11915: propagate old symbols
11916if $test -f UU/config.sh; then
11917 <UU/config.sh sort | uniq >UU/oldconfig.sh
11918 sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
11919 sort | uniq -u >UU/oldsyms
11920 set X `cat UU/oldsyms`
11921 shift
11922 case $# in
11923 0) ;;
11924 *)
11925 cat <<EOM
11926Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
11927EOM
11928 echo "# Variables propagated from previous config.sh file." >>config.sh
11929 for sym in `cat UU/oldsyms`; do
11930 echo " Propagating $hint variable "'$'"$sym..."
11931 eval 'tmp="$'"${sym}"'"'
11932 echo "$tmp" | \
11933 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
11934 done
11935 ;;
11936 esac
11937fi
11938
11939: Finish up by extracting the .SH files
11940case "$alldone" in
11941exit)
11942 $rm -rf UU
11943 echo "Done."
11944 exit 0
11945 ;;
11946cont)
11947 ;;
11948'')
2304df62
AD
11949 dflt=''
11950 nostick=true
40000a8c
AD
11951 $cat <<EOM
11952
11953If you'd like to make any changes to the config.sh file before I begin
11954to configure things, do it as a shell escape now (e.g. !vi config.sh).
11955
11956EOM
11957 rp="Press return or use a shell escape to edit config.sh:"
2304df62
AD
11958 . UU/myread
11959 nostick=''
11960 case "$ans" in
11961 '') ;;
11962 *) : in case they cannot read
11963 sh 1>&4 -c "$ans";;
11964 esac
11965 ;;
11966esac
11967
11968: if this fails, just run all the .SH files by hand
11969. ./config.sh
11970
28e8609d
JH
11971case "$ebcdic" in
11972$define)
87563a30
JH
11973 xxx=''
11974 echo "This is an EBCDIC system, checking if any parser files may need regenerating." >&4
11975 rm -f y.tab.c y.tab.h
11976 yacc -d perly.y >/dev/null 2>&1
11977 if cmp -s y.tab.c perly.c; then
11978 rm -f y.tab.c
11979 else
11980 echo "perly.y -> perly.c" >&4
11981 mv -f y.tab.c perly.c
11982 chmod u+w perly.c
11983 sed -e 's/fprintf *( *stderr *,/PerlIO_printf(Perl_debug_log,/g' \
11984 -e 's/y\.tab/perly/g' perly.c >perly.tmp && mv perly.tmp perly.c
11985 xxx="$xxx perly.c"
11986 fi
11987 if cmp -s y.tab.h perly.h; then
11988 rm -f y.tab.h
28e8609d 11989 else
87563a30
JH
11990 echo "perly.y -> perly.h" >&4
11991 mv -f y.tab.h perly.h
11992 xxx="$xxx perly.h"
28e8609d 11993 fi
87563a30
JH
11994 echo "x2p/a2p.y" >&4
11995 cd x2p
11996 rm -f y.tab.c y.tab.h
11997 yacc -d a2p.y >/dev/null 2>&1
11998 if cmp -s y.tab.c a2p.c
11999 then
12000 rm -f y.tab.c
12001 else
12002 echo "a2p.y -> a2p.c" >&4
12003 mv -f y.tab.c a2p.c
12004 chmod u+w a2p.c
12005 sed -e 's/fprintf *( *stderr *,/PerlIO_printf(Perl_debug_log,/g' \
12006 -e 's/y\.tab/a2p/g' a2p.c >a2p.tmp && mv a2p.tmp a2p.c
12007 xxx="$xxx a2p.c"
12008 fi
12009 if cmp -s y.tab.h a2p.h
12010 then
12011 rm -f y.tab.h
12012 else
12013 echo "a2p.h -> a2p.h" >&4
12014 mv -f y.tab.h a2p.h
12015 xxx="$xxx a2p.h"
12016 fi
12017 cd ..
12018 case "$xxx" in
12019 '') echo "No parser files were regenerated. That's okay." >&4 ;;
12020 esac
28e8609d
JH
12021 ;;
12022esac
12023
2304df62
AD
12024echo " "
12025exec 1>&4
12026. ./UU/extract
12027
12028if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
12029 dflt=y
12030 case "$silent" in
12031 true) ;;
12032 *)
12033 $cat <<EOM
12034
12035Now you need to generate make dependencies by running "make depend".
12036You might prefer to run it in background: "make depend > makedepend.out &"
12037It can take a while, so you might not want to run it right now.
12038
12039EOM
12040 ;;
12041 esac
12042 rp="Run make depend now?"
12043 . UU/myread
12044 case "$ans" in
12045 y*)
12046 make depend && echo "Now you must run a make."
12047 ;;
12048 *)
12049 echo "You must run 'make depend' then 'make'."
12050 ;;
12051 esac
12052elif test -f [Mm]akefile; then
12053 echo " "
12054 echo "Now you must run a make."
12055else
12056 echo "Done."
12057fi
12058
4e2a5f63
AD
12059if $test -f Policy.sh; then
12060 $cat <<EOM
12061
12062If you compile $package on a different machine or from a different object
12063directory, copy the Policy.sh file from this object directory to the
12064new one before you run Configure -- this will help you with most of
12065the policy defaults.
12066
12067EOM
12068fi
693762b4
AD
12069if $test -f config.msg; then
12070 echo "Hmm. I also noted the following information while running:"
12071 echo " "
12072 $cat config.msg >&4
12073 $rm -f config.msg
12074fi
2304df62
AD
12075$rm -f kit*isdone ark*isdone
12076$rm -rf UU
a0d0e21e 12077
2304df62 12078: End of Configure
a0d0e21e 12079