This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
A better, shinier, and possibly even correctly working
[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#
c2fddd50 23# Generated on Wed May 12 13:22:22 EET DST 1999 [metaconfig 3.0 PL70]
46193409 24# (with additional metaconfig patches by perlbug@perl.com)
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
dfe9444c 59: Proper separator for the PATH environment variable
8e07c86e
AD
60p_=:
61: On OS/2 this directory should exist if this is not floppy only system :-]
dfe9444c
AD
62if test -d c:/. ; then
63 if test -n "$OS2_SHELL"; then
64 p_=\;
65 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
66 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
c4f23d77 67 elif test -n "$DJGPP"; then
dfe9444c
AD
68 p_=\;
69 fi
39e571d4 70fi
a0d0e21e
LW
71
72: Proper PATH setting
73paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
16d20bd9 74paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
232e078e 75paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
16d20bd9 76paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
232e078e
AD
77paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
78paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
79paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
80paths="$paths /sbin /usr/sbin /usr/libexec"
a0d0e21e
LW
81
82for p in $paths
83do
8e07c86e
AD
84 case "$p_$PATH$p_" in
85 *$p_$p$p_*) ;;
86 *) test -d $p && PATH=$PATH$p_$p ;;
a0d0e21e
LW
87 esac
88done
89
8e07c86e 90PATH=.$p_$PATH
2304df62
AD
91export PATH
92
dfe9444c
AD
93: shall we be using ksh?
94inksh=''
95needksh=''
96avoidksh=''
97newsh=/bin/ksh
98changesh=''
ff0cee69 99if (PATH=.; alias -x) >/dev/null 2>&1; then
dfe9444c
AD
100 inksh=true
101fi
102if test -f /hp-ux -a -f /bin/ksh; then
103 needksh='to avoid sh bug in "here document" expansion'
104fi
105if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
106 if test X`/usr/bin/uname -v` = X4; then
107 avoidksh="to avoid AIX 4's /bin/sh"
108 newsh=/usr/bin/bsh
2304df62 109 fi
dfe9444c 110fi
cf04f91f
JH
111if test -f /osf_boot -a -f /usr/sbin/setld; then
112 if test X`/usr/bin/uname -s` = XOSF1; then
113 avoidksh="to avoid Digital UNIX' ksh"
114 newsh=/bin/sh
115 unset BIN_SH # if this is 'xpg4' sh will start up ksh
116 fi
117fi
dfe9444c
AD
118case "$inksh/$needksh" in
119/[a-z]*)
c4f23d77 120 ENV=''
dfe9444c
AD
121 changesh=true
122 reason="$needksh"
123 ;;
124esac
125case "$inksh/$avoidksh" in
126true/[a-z]*)
127 changesh=true
128 reason="$avoidksh"
129 ;;
130esac
131case "$inksh/$needksh-$avoidksh-" in
132true/--)
a0d0e21e
LW
133 cat <<EOM
134(I see you are using the Korn shell. Some ksh's blow up on $me,
dfe9444c 135mainly on older exotic systems. If yours does, try the Bourne shell instead.)
ff0cee69 136EOM
dfe9444c
AD
137 ;;
138esac
139case "$changesh" in
140true)
141 echo "(Feeding myself to $newsh $reason.)"
142 case "$0" in
143 Configure|*/Configure) exec $newsh $0 "$@";;
144 *) exec $newsh Configure "$@";;
145 esac
146 ;;
147esac
2304df62 148
bfb7748a
AD
149: if needed set CDPATH to a harmless value that is not chatty
150: avoid bash 2.02 problems with empty CDPATH.
151case "$CDPATH" in
152'') ;;
153*) case "$SHELL" in
154 *bash*) CDPATH='.' ;;
155 *) CDPATH='' ;;
156 esac
157 ;;
158esac
2304df62
AD
159: Configure runs within the UU subdirectory
160test -d UU || mkdir UU
8e07c86e 161cd UU && rm -f ./*
2304df62 162
ff49bff8
JH
163ccsymbols=''
164cppccsymbols=''
165cppsymbols=''
a0d0e21e 166dynamic_ext=''
2304df62 167extensions=''
a0d0e21e 168known_extensions=''
4318d5a0 169nonxs_ext=''
bfb7748a 170static_ext=''
8ff267be 171useopcode=''
a0d0e21e 172useposix=''
ecfc5424 173d_bsd=''
40a7a20a 174d_eunice=''
2304df62
AD
175d_xenix=''
176eunicefix=''
177Mcc=''
dfe9444c 178ar=''
2304df62
AD
179awk=''
180bash=''
181bison=''
182byacc=''
183cat=''
184chgrp=''
185chmod=''
186chown=''
ecfc5424 187comm=''
2304df62
AD
188compress=''
189cp=''
190cpio=''
191cpp=''
192csh=''
193date=''
194echo=''
195egrep=''
196emacs=''
197expr=''
198find=''
199flex=''
2304df62 200grep=''
8ff267be 201gzip=''
2304df62
AD
202inews=''
203ksh=''
204less=''
205line=''
206lint=''
207ln=''
208lp=''
209lpr=''
210ls=''
211mail=''
212mailx=''
dfe9444c 213make=''
2304df62
AD
214mkdir=''
215more=''
216mv=''
693762b4 217nm=''
2304df62
AD
218nroff=''
219perl=''
220pg=''
221pmake=''
222pr=''
223rm=''
224rmail=''
225sed=''
226sendmail=''
2304df62
AD
227shar=''
228sleep=''
229smail=''
230sort=''
231submit=''
232tail=''
233tar=''
234tbl=''
693762b4 235tee=''
2304df62
AD
236test=''
237touch=''
238tr=''
239troff=''
240uname=''
241uniq=''
242uuname=''
243vi=''
244zcat=''
8ff267be 245zip=''
ccc7f9b3 246full_ar=''
1aef975c 247full_sed=''
a0d0e21e 248libswanted=''
2304df62
AD
249hint=''
250myuname=''
85e6fe83
LW
251osname=''
252osvers=''
2304df62
AD
253Author=''
254Date=''
255Header=''
256Id=''
257Locker=''
258Log=''
259RCSfile=''
260Revision=''
261Source=''
262State=''
dfe9444c
AD
263_a=''
264_exe=''
265_o=''
4633a7c4
LW
266archobjs=''
267exe_ext=''
268firstmakefile=''
269lib_ext=''
270obj_ext=''
271path_sep=''
2304df62 272afs=''
a0d0e21e 273alignbytes=''
c4f23d77 274ansi2knr=''
a0d0e21e
LW
275archlib=''
276archlibexp=''
a0d0e21e
LW
277d_archlib=''
278installarchlib=''
40000a8c
AD
279archname=''
280myarchname=''
ecfc5424 281baserev=''
2304df62
AD
282bin=''
283binexp=''
284installbin=''
285byteorder=''
286cc=''
287gccversion=''
288ccflags=''
289cppflags=''
290ldflags=''
291lkflags=''
8e07c86e 292locincpth=''
2304df62 293optimize=''
8e07c86e 294cf_email=''
2304df62
AD
295cf_by=''
296cf_time=''
297contains=''
a0d0e21e 298cpp_stuff=''
2304df62
AD
299cpplast=''
300cppminus=''
301cpprun=''
302cppstdin=''
68c15b6f 303crosscompile=''
2304df62 304d_access=''
5ff3f7a4 305d_accessx=''
a0d0e21e 306d_alarm=''
ecfc5424 307d_attribut=''
2304df62
AD
308d_bcmp=''
309d_bcopy=''
310d_bzero=''
311d_casti32=''
312castflags=''
313d_castneg=''
a0d0e21e
LW
314d_chown=''
315d_chroot=''
2304df62 316d_chsize=''
a0d0e21e
LW
317d_closedir=''
318d_void_closedir=''
2304df62
AD
319d_const=''
320cryptlib=''
321d_crypt=''
322d_csh=''
1aef975c 323full_csh=''
a0d0e21e
LW
324d_cuserid=''
325d_dbl_dig=''
326d_difftime=''
327d_dlerror=''
328d_dlopen=''
329d_dlsymun=''
2304df62 330d_dosuid=''
a0d0e21e 331d_suidsafe=''
85ab1d1d 332d_drand48proto=''
2304df62 333d_dup2=''
5ff3f7a4
GS
334d_eaccess=''
335d_endgrent=''
e5c9fcd0
AD
336d_endhent=''
337d_endnent=''
338d_endpent=''
5ff3f7a4 339d_endpwent=''
e5c9fcd0 340d_endsent=''
2304df62
AD
341d_fchmod=''
342d_fchown=''
343d_fcntl=''
a0d0e21e
LW
344d_fd_macros=''
345d_fd_set=''
346d_fds_bits=''
347d_fgetpos=''
2304df62
AD
348d_flexfnam=''
349d_flock=''
a0d0e21e 350d_fork=''
5ff3f7a4 351d_fseeko=''
a0d0e21e 352d_fsetpos=''
5ff3f7a4 353d_ftello=''
5f05dabc 354d_ftime=''
355d_gettimeod=''
a0d0e21e 356d_Gconvert=''
5ff3f7a4 357d_getgrent=''
2304df62 358d_getgrps=''
4599a1de 359d_gethbyaddr=''
4599a1de 360d_gethbyname=''
dfe9444c 361d_gethent=''
2304df62
AD
362aphostname=''
363d_gethname=''
364d_phostname=''
365d_uname=''
dc45a647 366d_gethostprotos=''
a0d0e21e 367d_getlogin=''
ccc7f9b3 368d_getmntent=''
dfe9444c 369d_getnbyaddr=''
693762b4 370d_getnbyname=''
e5c9fcd0 371d_getnent=''
dc45a647 372d_getnetprotos=''
e5c9fcd0 373d_getpent=''
2afac517 374d_getpgid=''
2304df62 375d_getpgrp2=''
2afac517 376d_bsdgetpgrp=''
2304df62 377d_getpgrp=''
a0d0e21e 378d_getppid=''
2304df62 379d_getprior=''
693762b4
AD
380d_getpbyname=''
381d_getpbynumber=''
dc45a647 382d_getprotoprotos=''
5ff3f7a4 383d_getpwent=''
e5c9fcd0 384d_getsent=''
dc45a647 385d_getservprotos=''
693762b4
AD
386d_getsbyname=''
387d_getsbyport=''
a4f3eea9 388d_gnulibc=''
ccc7f9b3 389d_hasmntopt=''
2304df62 390d_htonl=''
7e1af8bc 391d_inetaton=''
2304df62
AD
392d_isascii=''
393d_killpg=''
dd64f1c3 394d_lchown=''
2304df62 395d_link=''
a0d0e21e
LW
396d_locconv=''
397d_lockf=''
e5c9fcd0
AD
398d_longdbl=''
399longdblsize=''
dc45a647
MB
400d_longlong=''
401longlongsize=''
2304df62 402d_lstat=''
ff49bff8 403d_madvise=''
a0d0e21e
LW
404d_mblen=''
405d_mbstowcs=''
406d_mbtowc=''
2304df62
AD
407d_memcmp=''
408d_memcpy=''
409d_memmove=''
410d_memset=''
411d_mkdir=''
a0d0e21e
LW
412d_mkfifo=''
413d_mktime=''
ff49bff8
JH
414d_mmap=''
415mmaptype=''
416d_mprotect=''
2304df62
AD
417d_msg=''
418d_msgctl=''
419d_msgget=''
420d_msgrcv=''
421d_msgsnd=''
ff49bff8
JH
422d_msync=''
423d_munmap=''
a0d0e21e 424d_nice=''
2304df62 425d_open3=''
a0d0e21e
LW
426d_fpathconf=''
427d_pathconf=''
428d_pause=''
429d_pipe=''
8e07c86e 430d_poll=''
2304df62 431d_portable=''
ef4af2be
JH
432d_old_pthread_create_joinable=''
433old_pthread_create_joinable=''
dfe9444c
AD
434d_pthread_yield=''
435d_sched_yield=''
1cfa4ec7 436sched_yield=''
2304df62 437d_readdir=''
85e6fe83
LW
438d_rewinddir=''
439d_seekdir=''
440d_telldir=''
a0d0e21e 441d_readlink=''
de4597cb 442d_readv=''
2304df62
AD
443d_rename=''
444d_rmdir=''
445d_safebcpy=''
446d_safemcpy=''
36477c24 447d_sanemcmp=''
2304df62
AD
448d_select=''
449d_sem=''
450d_semctl=''
451d_semget=''
452d_semop=''
453d_setegid=''
454d_seteuid=''
5ff3f7a4 455d_setgrent=''
dfe9444c 456d_setgrps=''
693762b4 457d_sethent=''
a0d0e21e 458d_setlinebuf=''
2304df62 459d_setlocale=''
e5c9fcd0
AD
460d_setnent=''
461d_setpent=''
2304df62
AD
462d_setpgid=''
463d_setpgrp2=''
2afac517 464d_bsdsetpgrp=''
2304df62
AD
465d_setpgrp=''
466d_setprior=''
5ff3f7a4 467d_setpwent=''
2304df62
AD
468d_setregid=''
469d_setresgid=''
470d_setresuid=''
471d_setreuid=''
472d_setrgid=''
473d_setruid=''
e5c9fcd0 474d_setsent=''
2304df62 475d_setsid=''
e5c9fcd0 476d_setvbuf=''
760ac839 477d_sfio=''
8ff267be 478usesfio=''
2304df62
AD
479d_shm=''
480d_shmat=''
a0d0e21e
LW
481d_shmatprototype=''
482shmattype=''
2304df62
AD
483d_shmctl=''
484d_shmdt=''
485d_shmget=''
2c7991dc 486d_sigaction=''
8ff267be 487d_sigsetjmp=''
de4597cb
JH
488d_cmsghdr_s=''
489d_msg_ctrunc=''
490d_msg_dontroute=''
491d_msg_oob=''
492d_msg_peek=''
493d_msg_proxy=''
494d_msghdr_s=''
2304df62 495d_oldsock=''
de4597cb
JH
496d_recvmsg=''
497d_scm_rights=''
498d_sendmsg=''
2304df62
AD
499d_socket=''
500d_sockpair=''
501sockethdr=''
502socketlib=''
503d_statblks=''
104d25b7
JH
504d_fstatfs=''
505d_statfs=''
506d_statfsflags=''
507d_fstatvfs=''
508d_statvfs=''
c2960299
AD
509d_stdio_cnt_lval=''
510d_stdio_ptr_lval=''
16d20bd9 511d_stdiobase=''
2304df62 512d_stdstdio=''
16d20bd9
AD
513stdio_base=''
514stdio_bufsiz=''
515stdio_cnt=''
dfe9444c 516stdio_filbuf=''
16d20bd9 517stdio_ptr=''
2304df62
AD
518d_index=''
519d_strchr=''
a0d0e21e 520d_strcoll=''
2304df62
AD
521d_strctcpy=''
522d_strerrm=''
523d_strerror=''
524d_sysernlst=''
525d_syserrlst=''
a89d8a78
DH
526d_strtod=''
527d_strtol=''
528d_strtoul=''
a0d0e21e 529d_strxfrm=''
2304df62
AD
530d_symlink=''
531d_syscall=''
a0d0e21e 532d_sysconf=''
2304df62 533d_system=''
a0d0e21e
LW
534d_tcgetpgrp=''
535d_tcsetpgrp=''
cb86ce0e 536d_telldirproto=''
85e6fe83
LW
537d_time=''
538timetype=''
2304df62
AD
539clocktype=''
540d_times=''
541d_truncate=''
a0d0e21e
LW
542d_tzname=''
543d_umask=''
bd89102f
AD
544d_semctl_semid_ds=''
545d_semctl_semun=''
546d_union_semun=''
2304df62 547d_vfork=''
a0d0e21e 548usevfork=''
2304df62
AD
549d_voidsig=''
550signal_t=''
551d_volatile=''
552d_charvspr=''
553d_vprintf=''
554d_wait4=''
555d_waitpid=''
a0d0e21e
LW
556d_wcstombs=''
557d_wctomb=''
de4597cb 558d_writev=''
5ff3f7a4
GS
559d_dbmclose64=''
560d_dbminit64=''
561d_delete64=''
562d_fetch64=''
563d_firstkey64=''
564d_nextkey64=''
565d_store64=''
a0d0e21e 566dlext=''
85e6fe83
LW
567cccdlflags=''
568ccdlflags=''
2304df62 569dlsrc=''
232e078e 570ld=''
85e6fe83 571lddlflags=''
2304df62 572usedl=''
693762b4 573doublesize=''
5ff3f7a4 574ebcdic=''
66fe083f 575fflushNULL=''
a0d0e21e 576fpostype=''
2304df62
AD
577gidtype=''
578groupstype=''
579h_fcntl=''
580h_sysfile=''
5ff3f7a4 581i_arpainet=''
ecfc5424
AD
582db_hashtype=''
583db_prefixtype=''
a0d0e21e 584i_db=''
2304df62 585i_dbm=''
8e07c86e 586i_rpcsvcdbm=''
2304df62 587d_dirnamlen=''
a0d0e21e 588direntrytype=''
2304df62 589i_dirent=''
a0d0e21e 590i_dld=''
2304df62
AD
591i_dlfcn=''
592i_fcntl=''
a0d0e21e 593i_float=''
2304df62 594i_gdbm=''
28e8609d 595d_grpasswd=''
2304df62 596i_grp=''
5ff3f7a4
GS
597d_int64t=''
598i_inttypes=''
a0d0e21e 599i_limits=''
4633a7c4 600i_locale=''
7f3d1cf1 601i_machcthr=''
a0d0e21e
LW
602i_malloc=''
603i_math=''
85e6fe83 604i_memory=''
e7fb4fcc 605i_mntent=''
2304df62 606i_ndbm=''
3fd537d4 607i_netdb=''
85e6fe83 608i_neterrno=''
9cc6feab 609i_netinettcp=''
2304df62
AD
610i_niin=''
611i_sysin=''
5b34fd99 612i_poll=''
c4747d3e 613i_pthread=''
2304df62
AD
614d_pwage=''
615d_pwchange=''
616d_pwclass=''
617d_pwcomment=''
618d_pwexpire=''
c4f23d77 619d_pwgecos=''
28e8609d 620d_pwpasswd=''
2304df62
AD
621d_pwquota=''
622i_pwd=''
760ac839 623i_sfio=''
2304df62 624i_stddef=''
a0d0e21e 625i_stdlib=''
2304df62
AD
626i_string=''
627strings=''
5ff3f7a4 628i_sysaccess=''
2304df62
AD
629i_sysdir=''
630i_sysfile=''
631d_voidtty=''
632i_bsdioctl=''
a0d0e21e 633i_sysfilio=''
2304df62
AD
634i_sysioctl=''
635i_syssockio=''
ff49bff8 636i_sysmman=''
104d25b7 637i_sysmount=''
2304df62 638i_sysndir=''
a0d0e21e 639i_sysparam=''
8ff267be 640i_sysresrc=''
5ff3f7a4 641i_syssecrt=''
2304df62 642i_sysselct=''
1aef975c 643i_sysstat=''
104d25b7 644i_sysstatvfs=''
a0d0e21e 645i_systimes=''
fed7345c 646i_systypes=''
de4597cb
JH
647d_iovec_s=''
648i_sysuio=''
25f94b33 649i_sysun=''
8ff267be 650i_syswait=''
2304df62
AD
651i_sgtty=''
652i_termio=''
653i_termios=''
654i_systime=''
655i_systimek=''
656i_time=''
657timeincl=''
85e6fe83 658i_unistd=''
2304df62 659i_utime=''
760ac839 660i_values=''
a0d0e21e 661i_stdarg=''
2304df62
AD
662i_varargs=''
663i_varhdr=''
664i_vfork=''
104d25b7 665installusrbinperl=''
2304df62 666intsize=''
24fef2a7
AD
667longsize=''
668shortsize=''
de4597cb
JH
669d_dirent64_s=''
670d_flock64_s=''
5ff3f7a4
GS
671d_fstat64=''
672d_ftruncate64=''
2000072c
JH
673d_ino64_t=''
674d_llseek=''
5ff3f7a4
GS
675d_lockf64=''
676d_lseek64=''
677d_lstat64=''
2000072c
JH
678d_off64_t=''
679d_offset_t=''
5ff3f7a4
GS
680d_open64=''
681d_opendir64=''
682d_readdir64=''
683d_seekdir64=''
684d_stat64=''
685d_telldir64=''
686d_truncate64=''
2304df62 687libc=''
8ff267be 688libperl=''
2afac517 689shrpenv=''
8ff267be 690useshrplib=''
a0d0e21e 691glibpth=''
2304df62 692libpth=''
8e07c86e 693loclibpth=''
2304df62
AD
694plibpth=''
695xlibpth=''
1cfa4ec7 696ignore_versioned_solibs=''
2304df62 697libs=''
85e6fe83 698lns=''
5ff3f7a4 699lseeksize=''
85e6fe83 700lseektype=''
8ff267be 701make_set_make=''
85e6fe83 702d_mymalloc=''
94b6baf5 703freetype=''
2304df62
AD
704mallocobj=''
705mallocsrc=''
706malloctype=''
707usemymalloc=''
16d20bd9
AD
708installman1dir=''
709man1dir=''
710man1direxp=''
711man1ext=''
712installman3dir=''
713man3dir=''
714man3direxp=''
715man3ext=''
2304df62
AD
716huge=''
717large=''
718medium=''
719models=''
720small=''
721split=''
a0d0e21e 722modetype=''
68c15b6f 723multiarch=''
2304df62
AD
724mydomain=''
725myhostname=''
726phostname=''
727c=''
728n=''
8e07c86e
AD
729d_eofnblk=''
730eagain=''
731o_nonblock=''
732rd_nodata=''
dfe9444c
AD
733netdb_hlen_type=''
734netdb_host_type=''
735netdb_name_type=''
736netdb_net_type=''
2304df62
AD
737groupcat=''
738hostcat=''
739passcat=''
85e6fe83
LW
740orderlib=''
741ranlib=''
2304df62
AD
742package=''
743spackage=''
2c7991dc 744pager=''
bfb7748a 745apiversion=''
ecfc5424 746patchlevel=''
760ac839 747subversion=''
bfb7748a 748version=''
8e07c86e 749perladmin=''
4633a7c4 750perlpath=''
dfe9444c 751pidtype=''
a0d0e21e 752prefix=''
1aef975c 753prefixexp=''
2304df62
AD
754installprivlib=''
755privlib=''
756privlibexp=''
757prototype=''
693762b4 758ptrsize=''
85ab1d1d 759drand01=''
2304df62 760randbits=''
85ab1d1d
JH
761randfunc=''
762randseedtype=''
763seedfunc=''
2304df62
AD
764installscript=''
765scriptdir=''
766scriptdirexp=''
5ff3f7a4 767selectminbits=''
a0d0e21e 768selecttype=''
8ff267be 769sh=''
af4c28eb 770sig_count=''
2304df62 771sig_name=''
dfe9444c 772sig_name_init=''
8e07c86e 773sig_num=''
824a2ba3 774sig_num_init=''
4633a7c4
LW
775installsitearch=''
776sitearch=''
777sitearchexp=''
25f94b33
AD
778installsitelib=''
779sitelib=''
780sitelibexp=''
a0d0e21e
LW
781sizetype=''
782so=''
2304df62
AD
783sharpbang=''
784shsharp=''
785spitshell=''
dfe9444c 786src=''
a0d0e21e 787ssizetype=''
4633a7c4 788startperl=''
2304df62
AD
789startsh=''
790stdchar=''
5ff3f7a4
GS
791d_fgetpos64=''
792d_fopen64=''
793d_freopen64=''
794d_fseek64=''
795d_fseeko64=''
796d_fsetpos64=''
797d_ftell64=''
798d_ftello64=''
799d_tmpfile64=''
2304df62 800sysman=''
5ff3f7a4 801trnl=''
2304df62 802uidtype=''
85ab1d1d 803archname64=''
5ff3f7a4 804use64bits=''
85ab1d1d 805usemultiplicity=''
2304df62 806nm_opt=''
40a7a20a 807nm_so_opt=''
2304df62
AD
808runnm=''
809usenm=''
8ff267be 810useperlio=''
693762b4 811d_oldpthreads=''
dfe9444c 812usethreads=''
2304df62
AD
813incpath=''
814mips=''
815mips_type=''
816usrinc=''
817defvoidused=''
818voidflags=''
2304df62
AD
819CONFIG=''
820
ecfc5424
AD
821define='define'
822undef='undef'
823smallmach='pdp11 i8086 z8000 i80286 iAPX286'
824rmlist=''
825
826: We must find out about Eunice early
827eunicefix=':'
828if test -f /etc/unixtovms; then
829 eunicefix=/etc/unixtovms
830fi
831if test -f /etc/unixtovms.exe; then
832 eunicefix=/etc/unixtovms.exe
833fi
834
5ff3f7a4 835i_whoami=''
5ff3f7a4
GS
836: Possible local include directories to search.
837: Set locincpth to "" in a hint file to defeat local include searches.
838locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
839locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
840:
841: no include file wanted by default
842inclwanted=''
843
ecfc5424
AD
844: list of known cpp symbols, sorted alphabetically
845al="AMIX BIT_MSF BSD BSD4_3 BSD_NET2 CMU CRAY DGUX DOLPHIN DPX2"
846al="$al GO32 GOULD_PN HP700 I386 I80960 I960 Lynx M68000 M68K MACH"
847al="$al MIPSEB MIPSEL MSDOS MTXINU MULTIMAX MVS"
848al="$al M_COFF M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM"
849al="$al M_SYS3 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX"
850al="$al NeXT OCS88 OSF1 PARISC PC532 PORTAR POSIX"
851al="$al PWB R3000 RES RISC6000 RT Sun386i SVR3 SVR4"
852al="$al SYSTYPE_BSD SYSTYPE_SVR4 SYSTYPE_SYSV Tek4132 Tek4300"
853al="$al UMAXV USGr4 USGr4_2 UTEK UTS UTek UnicomPBB UnicomPBD Utek"
854al="$al VMS Xenix286"
5ff3f7a4
GS
855al="$al _AIX _AIX32 _AIX370 _AIX41 _AM29000 _COFF _CRAY _CX_UX _EPI"
856al="$al _IBMESA _IBMR2 _M88K _M88KBCS_TARGET _POWER"
ecfc5424
AD
857al="$al _MIPSEB _MIPSEL _M_COFF _M_I86 _M_I86SM _M_SYS3"
858al="$al _M_SYS5 _M_SYSIII _M_SYSV _M_UNIX _M_XENIX _NLS _PGC_ _R3000"
859al="$al _SYSTYPE_BSD _SYSTYPE_BSD43 _SYSTYPE_SVR4"
860al="$al _SYSTYPE_SYSV _SYSV3 _U370 _UNICOS"
861al="$al __386BSD__ __BIG_ENDIAN __BIG_ENDIAN__ __BSD_4_4__"
862al="$al __DGUX__ __DPX2__ __H3050R __H3050RX"
863al="$al __LITTLE_ENDIAN __LITTLE_ENDIAN__ __MACH__"
864al="$al __MIPSEB __MIPSEB__ __MIPSEL __MIPSEL__"
865al="$al __Next__ __OSF1__ __PARAGON__ __PGC__ __PWB __STDC__"
866al="$al __SVR4_2__ __UMAXV__"
867al="$al ____386BSD____ __alpha __alpha__ __amiga"
868al="$al __bsd4_2 __bsd4_2__ __bsdi__ __convex__"
869al="$al __host_mips__"
870al="$al __hp9000s200 __hp9000s300 __hp9000s400 __hp9000s500"
871al="$al __hp9000s500 __hp9000s700 __hp9000s800"
872al="$al __hppa __hpux __hp_osf __i286 __i286__ __i386 __i386__"
873al="$al __i486 __i486__ __i860 __i860__ __ibmesa __ksr1__ __linux__"
874al="$al __m68k __m68k__ __m88100__ __m88k __m88k__"
875al="$al __mc68000 __mc68000__ __mc68020 __mc68020__"
876al="$al __mc68030 __mc68030__ __mc68040 __mc68040__"
877al="$al __mc88100 __mc88100__ __mips __mips__"
878al="$al __motorola__ __osf__ __pa_risc __sparc__ __stdc__"
879al="$al __sun __sun__ __svr3__ __svr4__ __ultrix __ultrix__"
880al="$al __unix __unix__ __uxpm__ __uxps__ __vax __vax__"
881al="$al _host_mips _mips _unix"
882al="$al a29k aegis aix aixpc alliant alpha am29000 amiga ansi ardent"
883al="$al apollo ardent att386 att3b"
884al="$al bsd bsd43 bsd4_2 bsd4_3 bsd4_4 bsdi bull"
885al="$al cadmus clipper concurrent convex cray ctix"
886al="$al dmert encore gcos gcx gimpel gould"
887al="$al hbullx20 hcx host_mips hp200 hp300 hp700 hp800"
888al="$al hp9000 hp9000s300 hp9000s400 hp9000s500"
889al="$al hp9000s700 hp9000s800 hp9k8 hppa hpux"
890al="$al i186 i286 i386 i486 i8086"
891al="$al i80960 i860 iAPX286 ibm ibm032 ibmrt interdata is68k"
892al="$al ksr1 linux luna luna88k m68k m88100 m88k"
893al="$al mc300 mc500 mc68000 mc68010 mc68020 mc68030"
894al="$al mc68040 mc68060 mc68k mc68k32 mc700"
895al="$al mc88000 mc88100 merlin mert mips mvs n16"
896al="$al ncl_el ncl_mr"
897al="$al news1500 news1700 news1800 news1900 news3700"
898al="$al news700 news800 news900 ns16000 ns32000"
899al="$al ns32016 ns32332 ns32k nsc32000 os osf"
900al="$al parisc pc532 pdp11 plexus posix pyr"
901al="$al riscix riscos scs sequent sgi sinix sony sony_news"
902al="$al sonyrisc sparc sparclite spectrum stardent stratos"
903al="$al sun sun3 sun386 svr4 sysV68 sysV88"
904al="$al titan tower tower32 tower32_200 tower32_600 tower32_700"
905al="$al tower32_800 tower32_850 tss u370 u3b u3b2 u3b20 u3b200"
906al="$al u3b20d u3b5 ultrix unix unixpc unos vax venix vms"
907al="$al xenix z8000"
908
dfe9444c 909: Trailing extension. Override this in a hint file, if needed.
4e2a5f63 910_exe=''
dfe9444c
AD
911: Extra object files, if any, needed on this platform.
912archobjs=''
913groupstype=''
732c9516
JH
914: change the next line if compiling for Xenix/286 on Xenix/386
915xlibpth='/usr/lib/386 /lib/386'
916
917: Possible local library directories to search.
918loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
919loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
920
921: general looking path for locating libraries
922glibpth="/shlib /usr/shlib /lib/pa1.1 /usr/lib/large"
923glibpth="$glibpth /lib /usr/lib $xlibpth"
924glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
925glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
926
927: Private path used by Configure to find libraries. Its value
928: is prepended to libpth. This variable takes care of special
929: machines, like the mips. Usually, it should be empty.
930plibpth=''
931
1cfa4ec7
GS
932: default library list
933libswanted=''
921b2963 934: some systems want to use only the non-versioned libso:s
1cfa4ec7 935ignore_versioned_solibs=''
bfb7748a
AD
936: full support for void wanted by default
937defvoidused=15
938
dfe9444c
AD
939: set useposix=false in your hint file to disable the POSIX extension.
940useposix=true
941: set useopcode=false in your hint file to disable the Opcode extension.
942useopcode=true
85ab1d1d 943: set usemultiplicity on the Configure command line to enable multiplicity.
dfe9444c 944: set usethreads on the Configure command line to enable threads.
ecfc5424 945: List of libraries we want.
693762b4
AD
946: If anyone needs -lnet, put it in a hint file.
947libswanted='sfio socket inet nsl nm ndbm gdbm dbm db malloc dl'
ca8cfa54
JH
948libswanted="$libswanted dld ld sun m rt c cposix posix"
949libswanted="$libswanted ndir dir crypt"
ecfc5424 950libswanted="$libswanted ucb bsd BSD PW x"
1aef975c 951: We probably want to search /usr/shlib before most other libraries.
94b6baf5 952: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
ecfc5424
AD
953glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
954glibpth="/usr/shlib $glibpth"
955: Do not use vfork unless overridden by a hint file.
956usevfork=false
957
8ff267be 958: Find the basic shell for Bourne shell scripts
959case "$sh" in
960'')
8ff267be 961 case "$SYSTYPE" in
962 *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
963 *) xxx='/bin/sh';;
964 esac
965 if test -f "$xxx"; then
966 sh="$xxx"
967 else
968 : Build up a list and do a single loop so we can 'break' out.
969 pth=`echo $PATH | sed -e "s/$p_/ /g"`
970 for xxx in sh bash ksh pdksh ash; do
971 for p in $pth; do
972 try="$try ${p}/${xxx}"
973 done
974 done
975 for xxx in $try; do
976 if test -f "$xxx"; then
977 sh="$xxx";
8ff267be 978 break
979 elif test -f "$xxx.exe"; then
980 sh="$xxx";
8ff267be 981 break
982 fi
983 done
984 fi
985 ;;
986esac
987
988case "$sh" in
989'') cat <<EOM >&2
990$me: Fatal Error: I can't find a Bourne Shell anywhere.
dfe9444c 991
8ff267be 992Usually it's in /bin/sh. How did you even get this far?
46193409 993Please contact me (Perl Maintainers) at perlbug@perl.com and
dfe9444c 994we'll try to straighten this all out.
8ff267be 995EOM
996 exit 1
997 ;;
998esac
999
760ac839 1000: see if sh knows # comments
8ff267be 1001if `$sh -c '#' >/dev/null 2>&1`; then
760ac839
LW
1002 shsharp=true
1003 spitshell=cat
760ac839
LW
1004 xcat=/bin/cat
1005 test -f $xcat || xcat=/usr/bin/cat
1006 echo "#!$xcat" >try
1007 $eunicefix try
1008 chmod +x try
1009 ./try > today
1010 if test -s today; then
760ac839
LW
1011 sharpbang='#!'
1012 else
1013 echo "#! $xcat" > try
1014 $eunicefix try
1015 chmod +x try
1016 ./try > today
1017 if test -s today; then
760ac839
LW
1018 sharpbang='#! '
1019 else
760ac839
LW
1020 sharpbang=': use '
1021 fi
1022 fi
1023else
dfe9444c 1024 echo " "
8ff267be 1025 echo "Your $sh doesn't grok # comments--I will strip them later on."
760ac839
LW
1026 shsharp=false
1027 cd ..
1028 echo "exec grep -v '^[ ]*#'" >spitshell
1029 chmod +x spitshell
1030 $eunicefix spitshell
1031 spitshell=`pwd`/spitshell
1032 cd UU
1033 echo "I presume that if # doesn't work, #! won't work either!"
1034 sharpbang=': use '
1035fi
1036rm -f try today
1037
1038: figure out how to guarantee sh startup
8ff267be 1039case "$startsh" in
1040'') startsh=${sharpbang}${sh} ;;
1041*)
760ac839 1042esac
760ac839
LW
1043cat >try <<EOSS
1044$startsh
1045set abc
1046test "$?abc" != 1
1047EOSS
1048
1049chmod +x try
1050$eunicefix try
1051if ./try; then
8ff267be 1052 : echo "Yup, it does."
760ac839 1053else
dfe9444c
AD
1054 echo "Hmm... '$startsh' does not guarantee sh startup..."
1055 echo "You may have to fix up the shell scripts to make sure $sh runs them."
760ac839
LW
1056fi
1057rm -f try
1058
aebf16e7
AD
1059
1060: Save command line options in file UU/cmdline.opt for later use in
1061: generating config.sh.
1062cat > cmdline.opt <<EOSH
1063# Configure command line arguments.
1064config_arg0='$0'
1065config_args='$*'
1066config_argc=$#
1067EOSH
1068argn=1
1069for arg in "$@"; do
1070 cat >>cmdline.opt <<EOSH
1071config_arg$argn='$arg'
1072EOSH
1073 argn=`expr $argn + 1`
1074done
1075
2304df62
AD
1076: produce awk script to parse command line options
1077cat >options.awk <<'EOF'
1078BEGIN {
16d20bd9 1079 optstr = "dD:eEf:hKOrsSU:V"; # getopt-style specification
2304df62
AD
1080
1081 len = length(optstr);
1082 for (i = 1; i <= len; i++) {
1083 c = substr(optstr, i, 1);
1084 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1085 if (a == ":") {
1086 arg[c] = 1;
1087 i++;
1088 }
1089 opt[c] = 1;
1090 }
1091}
1092{
1093 expect = 0;
1094 str = $0;
1095 if (substr(str, 1, 1) != "-") {
1096 printf("'%s'\n", str);
1097 next;
1098 }
1099 len = length($0);
1100 for (i = 2; i <= len; i++) {
1101 c = substr(str, i, 1);
1102 if (!opt[c]) {
1103 printf("-%s\n", substr(str, i));
1104 next;
1105 }
1106 printf("-%s\n", c);
1107 if (arg[c]) {
1108 if (i < len)
1109 printf("'%s'\n", substr(str, i + 1));
1110 else
1111 expect = 1;
1112 next;
1113 }
1114 }
1115}
1116END {
1117 if (expect)
1118 print "?";
1119}
1120EOF
1121
1122: process the command line options
4633a7c4
LW
1123set X `for arg in "$@"; do echo "X$arg"; done |
1124 sed -e s/X// | awk -f options.awk`
2304df62
AD
1125eval "set $*"
1126shift
1127rm -f options.awk
1128
1129: set up default values
1130fastread=''
1131reuseval=false
1132config_sh=''
1133alldone=''
1134error=''
1135silent=''
1136extractsh=''
ecfc5424 1137override=''
16d20bd9 1138knowitall=''
1aef975c 1139rm -f optdef.sh
28757baa 1140cat >optdef.sh <<EOS
1141$startsh
1142EOS
2304df62 1143
dfe9444c 1144
2304df62
AD
1145: option parsing
1146while test $# -gt 0; do
1147 case "$1" in
1148 -d) shift; fastread=yes;;
1149 -e) shift; alldone=cont;;
1150 -f)
1151 shift
1152 cd ..
1153 if test -r "$1"; then
1154 config_sh="$1"
1155 else
a0d0e21e 1156 echo "$me: cannot read config file $1." >&2
2304df62
AD
1157 error=true
1158 fi
1159 cd UU
1160 shift;;
1161 -h) shift; error=true;;
1162 -r) shift; reuseval=true;;
dfe9444c 1163 -s) shift; silent=true; realsilent=true;;
2304df62 1164 -E) shift; alldone=exit;;
16d20bd9 1165 -K) shift; knowitall=true;;
ecfc5424 1166 -O) shift; override=true;;
dfe9444c 1167 -S) shift; silent=true; extractsh=true;;
a0d0e21e
LW
1168 -D)
1169 shift
1170 case "$1" in
1171 *=)
1172 echo "$me: use '-U symbol=', not '-D symbol='." >&2
1173 echo "$me: ignoring -D $1" >&2
1174 ;;
ecfc5424 1175 *=*) echo "$1" | \
1aef975c
AD
1176 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1177 *) echo "$1='define'" >> optdef.sh;;
a0d0e21e
LW
1178 esac
1179 shift
1180 ;;
1181 -U)
1182 shift
1183 case "$1" in
1aef975c 1184 *=) echo "$1" >> optdef.sh;;
a0d0e21e
LW
1185 *=*)
1186 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1187 echo "$me: ignoring -U $1" >&2
1188 ;;
1aef975c 1189 *) echo "$1='undef'" >> optdef.sh;;
a0d0e21e
LW
1190 esac
1191 shift
1192 ;;
dfe9444c 1193 -V) echo "$me generated by metaconfig 3.0 PL70." >&2
2304df62
AD
1194 exit 0;;
1195 --) break;;
a0d0e21e 1196 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
2304df62
AD
1197 *) break;;
1198 esac
1199done
1200
1201case "$error" in
1202true)
1203 cat >&2 <<EOM
2afac517 1204Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
a0d0e21e 1205 [-U symbol] [-U symbol=]
2304df62
AD
1206 -d : use defaults for all answers.
1207 -e : go on without questioning past the production of config.sh.
1208 -f : specify an alternate default configuration file.
1209 -h : print this help message and exit (with an error status).
1210 -r : reuse C symbols value if possible (skips costly nm extraction).
1211 -s : silent mode, only echoes questions and essential information.
a0d0e21e
LW
1212 -D : define symbol to have some value:
1213 -D symbol symbol gets the value 'define'
1214 -D symbol=value symbol gets the value 'value'
2304df62 1215 -E : stop at the end of questions, after having produced config.sh.
16d20bd9 1216 -K : do not use unless you know what you are doing.
ecfc5424 1217 -O : let -D and -U override definitions from loaded configuration file.
2304df62 1218 -S : perform variable substitutions on all .SH files (can mix with -f)
a0d0e21e
LW
1219 -U : undefine symbol:
1220 -U symbol symbol gets the value 'undef'
1221 -U symbol= symbol gets completely empty
2304df62
AD
1222 -V : print version number and exit (with a zero status).
1223EOM
1224 exit 1
1225 ;;
1226esac
1227
dfe9444c
AD
1228: Sanity checks
1229case "$fastread$alldone" in
1230yescont|yesexit) ;;
1231*)
1232 if test ! -t 0; then
1233 echo "Say 'sh Configure', not 'sh <Configure'"
1234 exit 1
1235 fi
1236 ;;
1237esac
1238
2304df62
AD
1239exec 4>&1
1240case "$silent" in
1241true) exec 1>/dev/null;;
1242esac
1243
ecfc5424 1244: run the defines and the undefines, if any, but leave the file out there...
1aef975c
AD
1245touch optdef.sh
1246. ./optdef.sh
a0d0e21e 1247
2304df62 1248: set package name
85e6fe83 1249package=perl5
1aef975c
AD
1250first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1251last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1252case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1253ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1254*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1255esac
2304df62 1256
2304df62
AD
1257: Some greps do not return status, grrr.
1258echo "grimblepritz" >grimble
1259if grep blurfldyick grimble >/dev/null 2>&1 ; then
1260 contains=contains
1261elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1262 contains=grep
1263else
1264 contains=contains
1265fi
1266rm -f grimble
1267: the following should work in any shell
1268case "$contains" in
1269contains*)
1270 echo " "
1271 echo "AGH! Grep doesn't return a status. Attempting remedial action."
1272 cat >contains <<'EOSS'
1273grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1274EOSS
1275chmod +x contains
1276esac
1277
dfe9444c
AD
1278: Find the path to the source tree
1279case "$src" in
1280'') case "$0" in
1281 */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`;;
1282 *) src='.';;
1283 esac;;
1284esac
1285case "$src" in
1286'') src=/
1287 rsrc=/
1288 ;;
1289/*) rsrc="$src";;
1290*) rsrc="../$src";;
1291esac
1292if test -f $rsrc/Configure && \
1293 $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1294then
1295 : found it, so we are ok.
1296else
1297 rsrc=''
1298 for src in . .. ../.. ../../.. ../../../..; do
1299 if test -f ../$src/Configure && \
1300 $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1301 then
1302 rsrc=../$src
1303 break
1304 fi
1305 done
1306fi
1307case "$rsrc" in
1308'')
1309 cat <<EOM >&4
1310
1311Sorry, I can't seem to locate the source dir for $package. Please start
1312Configure with an explicit path -- i.e. /some/path/Configure.
1313
1314EOM
1315 exit 1
1316 ;;
1317../.) rsrc='..';;
1318*)
1319 echo " "
1320 echo "Sources for $package found in \"$src\"." >&4
1321 ;;
1322esac
1323
1324: script used to extract .SH files with variable substitutions
1325cat >extract <<'EOS'
2000072c 1326CONFIGDOTSH=true
dfe9444c
AD
1327echo "Doing variable substitutions on .SH files..."
1328if test -f $src/MANIFEST; then
f7ab18e9 1329 set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
dfe9444c
AD
1330else
1331 echo "(Looking for .SH files under the source directory.)"
1332 set x `(cd $src; find . -name "*.SH" -print)`
1333fi
1334shift
1335case $# in
13360) set x `(cd $src; echo *.SH)`; shift;;
1337esac
1338if test ! -f $src/$1; then
1339 shift
1340fi
1341mkdir_p='
1342name=$1;
1343create="";
1344while test $name; do
1345 if test ! -d "$name"; then
1346 create="$name $create";
1347 name=`echo $name | sed -e "s|^[^/]*$||"`;
1348 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1349 else
1350 name="";
1351 fi;
1352done;
1353for file in $create; do
1354 mkdir $file;
1355done
1356'
1357for file in $*; do
1358 case "$src" in
1359 ".")
1360 case "$file" in
1361 */*)
1362 dir=`expr X$file : 'X\(.*\)/'`
1363 file=`expr X$file : 'X.*/\(.*\)'`
1364 (cd $dir && . ./$file)
1365 ;;
1366 *)
1367 . ./$file
1368 ;;
1369 esac
1370 ;;
1371 *)
1372 case "$file" in
1373 */*)
1374 dir=`expr X$file : 'X\(.*\)/'`
1375 file=`expr X$file : 'X.*/\(.*\)'`
1376 (set x $dir; shift; eval $mkdir_p)
1377 sh <$src/$dir/$file
1378 ;;
1379 *)
1380 sh <$src/$file
1381 ;;
1382 esac
1383 ;;
1384 esac
1385done
1386if test -f $src/config_h.SH; then
1387 if test ! -f config.h; then
1388 : oops, they left it out of MANIFEST, probably, so do it anyway.
1389 . $src/config_h.SH
1390 fi
1391fi
1392EOS
1393
1394: extract files and exit if asked to do so
1395case "$extractsh" in
1396true)
1397 case "$realsilent" in
1398 true) ;;
1399 *) exec 1>&4;;
1400 esac
1401 case "$config_sh" in
1402 '') config_sh='config.sh';;
1403 esac
1404 echo " "
1405 echo "Fetching answers from $config_sh..."
1406 cd ..
1407 . $config_sh
1408 test "$override" && . ./optdef.sh
1409 echo " "
1410 . UU/extract
1411 rm -rf UU
1412 echo "Done."
1413 exit 0
1414 ;;
1415esac
1416
1417: Eunice requires " " instead of "", can you believe it
1418echo " "
1419: Here we go...
1420echo "Beginning of configuration questions for $package."
1421
1422trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1423
2304df62
AD
1424: first determine how to suppress newline on echo command
1425echo " "
1426echo "Checking echo to see how to suppress newlines..."
1427(echo "hi there\c" ; echo " ") >.echotmp
1428if $contains c .echotmp >/dev/null 2>&1 ; then
1429 echo "...using -n."
1430 n='-n'
1431 c=''
1432else
1433 cat <<'EOM'
1434...using \c
1435EOM
1436 n=''
1437 c='\c'
1438fi
1439echo $n "The star should be here-->$c"
1440echo '*'
1441rm -f .echotmp
1442
1443: Now test for existence of everything in MANIFEST
1444echo " "
dfe9444c 1445if test -f $rsrc/MANIFEST; then
2304df62 1446 echo "First let's make sure your kit is complete. Checking..." >&4
dfe9444c 1447 awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
2304df62 1448 rm -f missing
dfe9444c 1449 tmppwd=`pwd`
2304df62 1450 for filelist in x??; do
dfe9444c 1451 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
2304df62
AD
1452 done
1453 if test -s missing; then
1454 cat missing >&4
1455 cat >&4 <<'EOM'
1456
1457THIS PACKAGE SEEMS TO BE INCOMPLETE.
1458
1459You have the option of continuing the configuration process, despite the
1460distinct possibility that your kit is damaged, by typing 'y'es. If you
1461do, don't blame me if something goes wrong. I advise you to type 'n'o
46193409 1462and contact the author (perlbug@perl.com).
2304df62
AD
1463
1464EOM
1465 echo $n "Continue? [n] $c" >&4
1466 read ans
1467 case "$ans" in
1468 y*)
1469 echo "Continuing..." >&4
1470 rm -f missing
1471 ;;
1472 *)
1473 echo "ABORTING..." >&4
1474 kill $$
1475 ;;
1476 esac
1477 else
dfe9444c 1478 echo "Looks good..."
2304df62
AD
1479 fi
1480else
1481 echo "There is no MANIFEST file. I hope your kit is complete !"
1482fi
1483rm -f missing x??
1484
5ff3f7a4
GS
1485echo " "
1486: Find the appropriate value for a newline for tr
1487if test -n "$DJGPP"; then
1488 trnl='\012'
1489fi
1490if test X"$trnl" = X; then
1491 case "`echo foo|tr '\n' x 2>/dev/null`" in
1492 foox) trnl='\n' ;;
1493 esac
1494fi
1495if test X"$trnl" = X; then
1496 case "`echo foo|tr '\012' x 2>/dev/null`" in
1497 foox) trnl='\012' ;;
1498 esac
1499fi
1500if test X"$trnl" = X; then
1501 cat <<EOM >&2
1502
1503$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1504
1505EOM
1506 exit 1
1507fi
1508
2304df62
AD
1509: compute the number of columns on the terminal for proper question formatting
1510case "$COLUMNS" in
1511'') COLUMNS='80';;
1512esac
1513
1514: set up the echo used in my read
1515myecho="case \"\$xxxm\" in
1516'') echo $n \"\$rp $c\" >&4;;
1517*) case \"\$rp\" in
1518 '') echo $n \"[\$xxxm] $c\";;
1519 *)
1520 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
1521 echo \"\$rp\" >&4
1522 echo $n \"[\$xxxm] $c\" >&4
1523 else
1524 echo $n \"\$rp [\$xxxm] $c\" >&4
1525 fi
1526 ;;
1527 esac;;
1528esac"
1529
1530: now set up to do reads with possible shell escape and default assignment
1531cat <<EOSC >myread
28757baa 1532$startsh
2304df62
AD
1533xxxm=\$dflt
1534$myecho
1535ans='!'
1536case "\$fastread" in
1537yes) case "\$dflt" in
1538 '') ;;
1539 *) ans='';
1540 case "\$silent-\$rp" in
1541 true-) ;;
1542 *) echo " " >&4;;
1543 esac;;
1544 esac;;
1545*) case "\$silent" in
1546 true) case "\$rp" in
1547 '') ans='';;
1548 esac;;
1549 esac;;
1550esac
1551while expr "X\$ans" : "X!" >/dev/null; do
1552 read answ
1553 set x \$xxxm
1554 shift
dfe9444c 1555 aok=''; eval "ans=\\"\$answ\\"" && aok=y
2304df62 1556 case "\$answ" in
dfe9444c
AD
1557 "!")
1558 sh 1>&4
1559 echo " "
1560 $myecho
1561 ;;
1562 !*)
1563 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1564 shift
1565 sh 1>&4 -c "\$*"
1566 echo " "
1567 $myecho
1568 ;;
2304df62
AD
1569 "\$ans")
1570 case "\$ans" in
ecfc5424
AD
1571 \\&*)
1572 set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1573 shift
1574 case "\$1" in
1575 -d)
1576 fastread=yes
40a7a20a 1577 echo "(OK, I'll run with -d after this question.)" >&4
ecfc5424
AD
1578 ;;
1579 -*)
40a7a20a 1580 echo "*** Sorry, \$1 not supported yet." >&4
ecfc5424
AD
1581 ;;
1582 esac
1583 $myecho
1584 ans=!
1585 ;;
2304df62
AD
1586 esac;;
1587 *)
1588 case "\$aok" in
1589 y)
1590 echo "*** Substitution done -- please confirm."
1591 xxxm="\$ans"
c9795ab7 1592 ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2304df62
AD
1593 xxxm="\$ans"
1594 ans=!
1595 ;;
1596 *)
1597 echo "*** Error -- try again."
1598 ans=!
1599 ;;
1600 esac
1601 $myecho
1602 ;;
1603 esac
1604 case "\$ans\$xxxm\$nostick" in
1605 '')
1606 ans=!
1607 $myecho
1608 ;;
1609 esac
1610done
1611case "\$ans" in
1612'') ans="\$xxxm";;
1613esac
1614EOSC
1615
1616: create .config dir to save info across Configure sessions
1617test -d ../.config || mkdir ../.config
1618cat >../.config/README <<EOF
1619This directory created by Configure to save information that should
dfe9444c 1620persist across sessions for $package.
2304df62
AD
1621
1622You may safely delete it if you wish.
1623EOF
1624
1625: general instructions
1626needman=true
1627firsttime=true
760ac839 1628user=`(logname) 2>/dev/null`
dfe9444c
AD
1629case "$user" in
1630'') user=`whoami 2>&1`;;
760ac839 1631esac
2304df62
AD
1632if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1633 firsttime=false
1634 echo " "
1635 rp='Would you like to see the instructions?'
1636 dflt=n
1637 . ./myread
1638 case "$ans" in
1639 [yY]*) ;;
1640 *) needman=false;;
1641 esac
1642fi
1643if $needman; then
1644 cat <<EOH
4e2a5f63 1645
2304df62 1646This installation shell script will examine your system and ask you questions
a0d0e21e 1647to determine how the perl5 package should be installed. If you get
2304df62
AD
1648stuck on a question, you may use a ! shell escape to start a subshell or
1649execute a command. Many of the questions will have default answers in square
1650brackets; typing carriage return will give you the default.
1651
1652On some of the questions which ask for file or directory names you are allowed
1653to use the ~name construct to specify the login directory belonging to "name",
1654even if you don't have a shell which knows about that. Questions where this is
1655allowed will be marked "(~name ok)".
1656
1657EOH
1658 rp=''
1659 dflt='Type carriage return to continue'
1660 . ./myread
1661 cat <<'EOH'
1662
1663The prompter used in this script allows you to use shell variables and
1664backticks in your answers. You may use $1, $2, etc... to refer to the words
1665in the default answer, as if the default line was a set of arguments given to a
1666script shell. This means you may also use $* to repeat the whole default line,
1667so you do not have to re-type everything to add something to the default.
1668
1669Everytime there is a substitution, you will have to confirm. If there is an
1670error (e.g. an unmatched backtick), the default answer will remain unchanged
1671and you will be prompted again.
1672
1673If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
1674the questions and use the computed defaults (or the previous answers if there
1675was already a config.sh file). Type 'Configure -h' for a list of options.
ecfc5424 1676You may also start interactively and then answer '& -d' at any prompt to turn
dfe9444c 1677on the non-interactive behaviour for the remainder of the execution.
2304df62
AD
1678
1679EOH
1680 . ./myread
1681 cat <<EOH
1682
1683Much effort has been expended to ensure that this shell script will run on any
1684Unix system. If despite that it blows up on yours, your best bet is to edit
40000a8c
AD
1685Configure and run it again. If you can't run Configure for some reason,
1686you'll have to generate a config.sh file by hand. Whatever problems you
46193409 1687have, let me (perlbug@perl.com) know how I blew it.
2304df62
AD
1688
1689This installation script affects things in two ways:
1690
16911) it may do direct variable substitutions on some of the files included
1692 in this kit.
16932) it builds a config.h file for inclusion in C programs. You may edit
1694 any of these files as the need arises after running this script.
1695
1696If you make a mistake on a question, there is no easy way to back up to it
1697currently. The easiest thing to do is to edit config.sh and rerun all the SH
1698files. Configure will offer to let you do this before it runs the SH files.
1699
1700EOH
1701 dflt='Type carriage return to continue'
1702 . ./myread
1703 case "$firsttime" in
1704 true) echo $user >>../.config/instruct;;
1705 esac
1706fi
1707
2304df62
AD
1708: find out where common programs are
1709echo " "
1710echo "Locating common programs..." >&4
1711cat <<EOSC >loc
1712$startsh
1713case \$# in
17140) exit 1;;
1715esac
1716thing=\$1
1717shift
1718dflt=\$1
1719shift
1720for dir in \$*; do
1721 case "\$thing" in
1722 .)
1723 if test -d \$dir/\$thing; then
1724 echo \$dir
1725 exit 0
1726 fi
1727 ;;
1728 *)
a0d0e21e 1729 for thisthing in \$dir/\$thing; do
ecfc5424 1730 : just loop through to pick last item
a0d0e21e 1731 done
25f94b33 1732 if test -f \$thisthing; then
a0d0e21e 1733 echo \$thisthing
2304df62
AD
1734 exit 0
1735 elif test -f \$dir/\$thing.exe; then
c4f23d77
AD
1736 if test -n "$DJGPP"; then
1737 echo \$dir/\$thing.exe
1738 else
1739 : on Eunice apparently
1740 echo \$dir/\$thing
1741 fi
2304df62
AD
1742 exit 0
1743 fi
1744 ;;
1745 esac
1746done
1747echo \$dflt
1748exit 1
1749EOSC
1750chmod +x loc
1751$eunicefix loc
1752loclist="
1753awk
1754cat
ecfc5424 1755comm
2304df62
AD
1756cp
1757echo
1758expr
1759grep
a0d0e21e 1760ls
dfe9444c 1761make
2304df62 1762mkdir
2304df62
AD
1763rm
1764sed
1765sort
85e6fe83 1766touch
2304df62
AD
1767tr
1768uniq
1769"
1770trylist="
1771Mcc
dfe9444c 1772ar
2304df62
AD
1773byacc
1774cpp
1775csh
1776date
1777egrep
8ff267be 1778gzip
2c7991dc 1779less
8ff267be 1780ln
2c7991dc 1781more
693762b4 1782nm
2304df62 1783nroff
2c7991dc 1784pg
2304df62
AD
1785test
1786uname
8ff267be 1787zip
2304df62 1788"
8e07c86e 1789pth=`echo $PATH | sed -e "s/$p_/ /g"`
2304df62
AD
1790pth="$pth /lib /usr/lib"
1791for file in $loclist; do
dfe9444c
AD
1792 eval xxx=\$$file
1793 case "$xxx" in
1794 /*|?:[\\/]*)
1795 if test -f "$xxx"; then
1796 : ok
1797 else
1798 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1799 xxx=`./loc $file $file $pth`
1800 fi
1801 ;;
1802 '') xxx=`./loc $file $file $pth`;;
1803 *) xxx=`./loc $xxx $xxx $pth`;;
1804 esac
2304df62
AD
1805 eval $file=$xxx
1806 eval _$file=$xxx
1807 case "$xxx" in
1808 /*)
1809 echo $file is in $xxx.
1810 ;;
8e07c86e
AD
1811 ?:[\\/]*)
1812 echo $file is in $xxx.
1813 ;;
2304df62 1814 *)
25f94b33
AD
1815 echo "I don't know where '$file' is, and my life depends on it." >&4
1816 echo "Go find a public domain implementation or fix your PATH setting!" >&4
4633a7c4 1817 exit 1
2304df62
AD
1818 ;;
1819 esac
1820done
1821echo " "
1822echo "Don't worry if any of the following aren't found..."
1823say=offhand
1824for file in $trylist; do
dfe9444c
AD
1825 eval xxx=\$$file
1826 case "$xxx" in
1827 /*|?:[\\/]*)
1828 if test -f "$xxx"; then
1829 : ok
1830 else
1831 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1832 xxx=`./loc $file $file $pth`
1833 fi
1834 ;;
1835 '') xxx=`./loc $file $file $pth`;;
1836 *) xxx=`./loc $xxx $xxx $pth`;;
1837 esac
2304df62
AD
1838 eval $file=$xxx
1839 eval _$file=$xxx
1840 case "$xxx" in
1841 /*)
1842 echo $file is in $xxx.
1843 ;;
8e07c86e
AD
1844 ?:[\\/]*)
1845 echo $file is in $xxx.
1846 ;;
2304df62
AD
1847 *)
1848 echo "I don't see $file out there, $say."
1849 say=either
1850 ;;
1851 esac
1852done
1853case "$egrep" in
1854egrep)
1855 echo "Substituting grep for egrep."
1856 egrep=$grep
1857 ;;
1858esac
8ff267be 1859case "$ln" in
1860ln)
1861 echo "Substituting cp for ln."
1862 ln=$cp
1863 ;;
1864esac
2304df62
AD
1865case "$test" in
1866test)
1867 echo "Hopefully test is built into your sh."
1868 ;;
1869*)
ecfc5424 1870 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2304df62
AD
1871 echo "Using the test built into your sh."
1872 test=test
1873 _test=test
1874 fi
1875 ;;
1876esac
1877case "$echo" in
1878echo)
1879 echo "Hopefully echo is built into your sh."
1880 ;;
1881'') ;;
1882*)
1883 echo " "
1884echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
1885 $echo $n "hi there$c" >foo1
1886 echo $n "hi there$c" >foo2
1887 if cmp foo1 foo2 >/dev/null 2>&1; then
1888 echo "They are compatible. In fact, they may be identical."
1889 else
1890 case "$n" in
1891 '-n') n='' c='\c';;
1892 *) n='-n' c='';;
1893 esac
1894 cat <<FOO
1895They are not compatible! You are probably running ksh on a non-USG system.
1896I'll have to use $echo instead of the builtin, since Bourne shell doesn't
1897have echo built in and we may have to run some Bourne shell scripts. That
1898means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
1899
1900FOO
1901 $echo $n "The star should be here-->$c"
1902 $echo "*"
1903 fi
1904 $rm -f foo1 foo2
1905 ;;
1906esac
1907
a0d0e21e
LW
1908: determine whether symbolic links are supported
1909echo " "
1910$touch blurfl
1911if $ln -s blurfl sym > /dev/null 2>&1 ; then
1912 echo "Symbolic links are supported." >&4
1913 lns="$ln -s"
1914else
1915 echo "Symbolic links are NOT supported." >&4
1916 lns="$ln"
1917fi
1918$rm -f blurfl sym
1919
ecfc5424
AD
1920: see whether [:lower:] and [:upper:] are supported character classes
1921echo " "
ecfc5424
AD
1922case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1923ABYZ)
1924 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
1925 up='[:upper:]'
1926 low='[:lower:]'
1927 ;;
28e8609d
JH
1928*) # There is a discontinuity in EBCDIC between 'I' and 'J'
1929 # (0xc9 and 0xd1), therefore that is a nice testing point.
1930 if test "X$up" = X -o "X$low" = X; then
3eaeeeae 1931 case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
28e8609d
JH
1932 ij) up='[A-Z]'
1933 low='[a-z]'
1934 ;;
1935 esac
1936 fi
1937 if test "X$up" = X -o "X$low" = X; then
3eaeeeae 1938 case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
28e8609d
JH
1939 ij) up='A-Z'
1940 low='a-z'
1941 ;;
1942 esac
1943 fi
1944 if test "X$up" = X -o "X$low" = X; then
1945 case "`echo IJ | od -x 2>/dev/null`" in
1946 *C9D1*|*c9d1*)
1947 echo "Hey, this might be EBCDIC." >&4
1948 if test "X$up" = X -o "X$low" = X; then
5ff3f7a4 1949 case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
28e8609d
JH
1950 ij) up='[A-IJ-RS-Z]'
1951 low='[a-ij-rs-z]'
1952 ;;
1953 esac
1954 fi
1955 if test "X$up" = X -o "X$low" = X; then
5ff3f7a4 1956 case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
28e8609d
JH
1957 ij) up='A-IJ-RS-Z'
1958 low='a-ij-rs-z'
1959 ;;
1960 esac
1961 fi
1962 ;;
1963 esac
1964 fi
1965esac
3eaeeeae 1966case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
28e8609d
JH
1967ij)
1968 echo "Using $up and $low to convert case." >&4
1969 ;;
ecfc5424 1970*)
28e8609d
JH
1971 echo "I don't know how to translate letters from upper to lower case." >&4
1972 echo "Your tr is not acting any way I know of." >&4
1973 exit 1
1974 ;;
ecfc5424
AD
1975esac
1976: set up the translation script tr, must be called with ./tr of course
1977cat >tr <<EOSC
1978$startsh
1979case "\$1\$2" in
1980'[A-Z][a-z]') exec $tr '$up' '$low';;
1981'[a-z][A-Z]') exec $tr '$low' '$up';;
1982esac
1983exec $tr "\$@"
1984EOSC
1985chmod +x tr
1986$eunicefix tr
1987
2304df62
AD
1988: Try to determine whether config.sh was made on this system
1989case "$config_sh" in
1990'')
1991myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
28e8609d
JH
1992# tr '[A-Z]' '[a-z]' would not work in EBCDIC
1993# because the A-Z/a-z are not consecutive.
a0d0e21e 1994myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
3eaeeeae 1995 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
1aef975c 1996newmyuname="$myuname"
2304df62 1997dflt=n
16d20bd9
AD
1998case "$knowitall" in
1999'')
2000 if test -f ../config.sh; then
2001 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2002 eval "`grep myuname= ../config.sh`"
2003 fi
2004 if test "X$myuname" = "X$newmyuname"; then
2005 dflt=y
2006 fi
2304df62 2007 fi
16d20bd9
AD
2008 ;;
2009*) dflt=y;;
2010esac
2304df62
AD
2011
2012: Get old answers from old config file if Configure was run on the
2013: same system, otherwise use the hints.
2014hint=default
2015cd ..
2016if test -f config.sh; then
16d20bd9
AD
2017 echo " "
2018 rp="I see a config.sh file. Shall I use it to set the defaults?"
2304df62
AD
2019 . UU/myread
2020 case "$ans" in
2021 n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2022 *) echo "Fetching default answers from your old config.sh file..." >&4
ecfc5424
AD
2023 tmp_n="$n"
2024 tmp_c="$c"
85cad39c 2025 tmp_sh="$sh"
2304df62
AD
2026 . ./config.sh
2027 cp config.sh UU
ecfc5424
AD
2028 n="$tmp_n"
2029 c="$tmp_c"
85cad39c 2030 : Older versions did not always set $sh. Catch re-use of such
2031 : an old config.sh.
2032 case "$sh" in
2033 '') sh="$tmp_sh" ;;
2034 esac
2304df62
AD
2035 hint=previous
2036 ;;
2037 esac
2038fi
2039if test ! -f config.sh; then
2040 $cat <<EOM
2041
4e2a5f63
AD
2042First time through, eh? I have some defaults handy for some systems
2043that need some extra help getting the Configure answers right:
2304df62
AD
2044
2045EOM
dfe9444c 2046 (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
2304df62
AD
2047 dflt=''
2048 : Half the following guesses are probably wrong... If you have better
46193409 2049 : tests or hints, please send them to perlbug@perl.com
2304df62 2050 : The metaconfig authors would also appreciate a copy...
a0d0e21e 2051 $test -f /irix && osname=irix
85e6fe83
LW
2052 $test -f /xenix && osname=sco_xenix
2053 $test -f /dynix && osname=dynix
2054 $test -f /dnix && osname=dnix
5f05dabc 2055 $test -f /lynx.os && osname=lynxos
2056 $test -f /unicos && osname=unicos && osvers=`$uname -r`
7a4c00b4 2057 $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
85e6fe83 2058 $test -f /bin/mips && /bin/mips && osname=mips
ecfc5424
AD
2059 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2060 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
a0d0e21e
LW
2061 $test -d /usr/apollo/bin && osname=apollo
2062 $test -f /etc/saf/_sactab && osname=svr4
85e6fe83 2063 $test -d /usr/include/minix && osname=minix
e060872b 2064 if $test -d /MachTen -o -d /MachTen_Folder; then
dfe9444c 2065 osname=machten
4633a7c4 2066 if $test -x /sbin/version; then
dfe9444c 2067 osvers=`/sbin/version | $awk '{print $2}' |
4633a7c4
LW
2068 $sed -e 's/[A-Za-z]$//'`
2069 elif $test -x /usr/etc/version; then
dfe9444c 2070 osvers=`/usr/etc/version | $awk '{print $2}' |
4633a7c4
LW
2071 $sed -e 's/[A-Za-z]$//'`
2072 else
2073 osvers="$2.$3"
2074 fi
2075 fi
85ab1d1d
JH
2076 $test -f /sys/posix.dll &&
2077 $test -f /usr/bin/what &&
2078 set X `/usr/bin/what /sys/posix.dll` &&
2079 $test "$3" = UWIN &&
2080 osname=uwin &&
2081 osvers="$5"
2304df62
AD
2082 if $test -f $uname; then
2083 set X $myuname
2084 shift
2085
2304df62 2086 case "$5" in
85e6fe83 2087 fps*) osname=fps ;;
2304df62
AD
2088 mips*)
2089 case "$4" in
85e6fe83
LW
2090 umips) osname=umips ;;
2091 *) osname=mips ;;
2304df62 2092 esac;;
85e6fe83
LW
2093 [23]100) osname=mips ;;
2094 next*) osname=next ;;
ecfc5424 2095 i386*)
c6912327
JH
2096 tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2097 if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
619ffc2b
JH
2098 osname='sco'
2099 osvers=$tmp
2100 elif $test -f /etc/kconfig; then
ecfc5424 2101 osname=isc
a0d0e21e
LW
2102 if test "$lns" = "ln -s"; then
2103 osvers=4
2104 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2105 osvers=3
2304df62 2106 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
a0d0e21e 2107 osvers=2
ecfc5424
AD
2108 fi
2109 fi
2000072c 2110 tmp=''
ecfc5424 2111 ;;
c4f23d77
AD
2112 pc*)
2113 if test -n "$DJGPP"; then
2114 osname=dos
2115 osvers=djgpp
2116 fi
2117 ;;
2304df62
AD
2118 esac
2119
2120 case "$1" in
a0d0e21e
LW
2121 aix) osname=aix
2122 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2123 case "$tmp" in
1aef975c 2124 'not found') osvers="$4"."$3" ;;
a0d0e21e
LW
2125 '<3240'|'<>3240') osvers=3.2.0 ;;
2126 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2127 '=3250'|'>3250') osvers=3.2.5 ;;
1aef975c 2128 *) osvers=$tmp;;
a0d0e21e
LW
2129 esac
2130 ;;
23f87696
SZ
2131 *dc.osx) osname=dcosx
2132 osvers="$3"
2133 ;;
a0d0e21e
LW
2134 dnix) osname=dnix
2135 osvers="$3"
2136 ;;
2137 domainos) osname=apollo
2138 osvers="$3"
2139 ;;
2140 dgux) osname=dgux
2141 osvers="$3"
2142 ;;
760ac839 2143 dynixptx*) osname=dynixptx
e58e581d 2144 osvers=`echo "$4"|sed 's/^v//'`
760ac839 2145 ;;
a0d0e21e
LW
2146 freebsd) osname=freebsd
2147 osvers="$3" ;;
2148 genix) osname=genix ;;
2149 hp*) osname=hpux
bfb7748a 2150 osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
a0d0e21e 2151 ;;
a78b0d02 2152 irix*) osname=irix
a0d0e21e
LW
2153 case "$3" in
2154 4*) osvers=4 ;;
2155 5*) osvers=5 ;;
ecfc5424 2156 *) osvers="$3" ;;
a0d0e21e
LW
2157 esac
2158 ;;
2159 linux) osname=linux
2160 case "$3" in
a0d0e21e
LW
2161 *) osvers="$3" ;;
2162 esac
2163 ;;
28e8609d
JH
2164 MiNT) osname=mint
2165 ;;
2166 netbsd*) osname=netbsd
ecfc5424
AD
2167 osvers="$3"
2168 ;;
4e81affe
MM
2169 news-os) osvers="$3"
2170 case "$3" in
2171 4*) osname=newsos4 ;;
2172 *) osname=newsos ;;
2173 esac
2174 ;;
a0d0e21e
LW
2175 bsd386) osname=bsd386
2176 osvers=`$uname -r`
2177 ;;
a1a0e61e
TD
2178 POSIX-BC | posix-bc ) osname=posix-bc
2179 osvers="$3"
2180 ;;
ae3afa4e
TH
2181 powerux | power_ux | powermax_os | powermaxos | \
2182 powerunix | power_unix) osname=powerux
2183 osvers="$3"
2184 ;;
a0d0e21e
LW
2185 next*) osname=next ;;
2186 solaris) osname=solaris
2187 case "$3" in
2188 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
ecfc5424 2189 *) osvers="$3" ;;
a0d0e21e
LW
2190 esac
2191 ;;
85e6fe83
LW
2192 sunos) osname=sunos
2193 case "$3" in
85e6fe83
LW
2194 5*) osname=solaris
2195 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
a0d0e21e 2196 *) osvers="$3" ;;
2304df62
AD
2197 esac
2198 ;;
a0d0e21e 2199 titanos) osname=titanos
85e6fe83 2200 case "$3" in
a0d0e21e
LW
2201 1*) osvers=1 ;;
2202 2*) osvers=2 ;;
2203 3*) osvers=3 ;;
2204 4*) osvers=4 ;;
ecfc5424 2205 *) osvers="$3" ;;
2304df62
AD
2206 esac
2207 ;;
85e6fe83 2208 ultrix) osname=ultrix
ecfc5424 2209 osvers="$3"
2304df62 2210 ;;
28757baa 2211 osf1|mls+) case "$5" in
fed7345c
AD
2212 alpha)
2213 osname=dec_osf
313489a2 2214 osvers=`echo "$3" | sed 's/^[xvt]//'`
ecfc5424
AD
2215 ;;
2216 hp*) osname=hp_osf1 ;;
2217 mips) osname=mips_osf1 ;;
85e6fe83
LW
2218 esac
2219 ;;
a0d0e21e
LW
2220 uts) osname=uts
2221 osvers="$3"
2222 ;;
ff68c719 2223 qnx) osname=qnx
2224 osvers="$4"
2225 ;;
85e6fe83 2226 $2) case "$osname" in
2304df62 2227 *isc*) ;;
a0d0e21e 2228 *freebsd*) ;;
5f05dabc 2229 svr*)
a0d0e21e
LW
2230 : svr4.x or possibly later
2231 case "svr$3" in
2232 ${osname}*)
2233 osname=svr$3
2234 osvers=$4
2235 ;;
2236 esac
2237 case "$osname" in
2238 svr4.0)
2239 : Check for ESIX
2240 if test -f /stand/boot ; then
2241 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
ecfc5424
AD
2242 if test -n "$INITPROG" -a -f "$INITPROG"; then
2243 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2244 if test -n "$isesix"; then
a0d0e21e
LW
2245 osname=esix4
2246 fi
2247 fi
2248 fi
2249 ;;
2250 esac
2251 ;;
2304df62 2252 *) if test -f /etc/systemid; then
a0d0e21e
LW
2253 osname=sco
2254 set `echo $3 | $sed 's/\./ /g'` $4
c4f23d77 2255 if $test -f $src/hints/sco_$1_$2_$3.sh; then
85e6fe83 2256 osvers=$1.$2.$3
c4f23d77 2257 elif $test -f $src/hints/sco_$1_$2.sh; then
85e6fe83 2258 osvers=$1.$2
c4f23d77 2259 elif $test -f $src/hints/sco_$1.sh; then
85e6fe83 2260 osvers=$1
2304df62 2261 fi
a0d0e21e
LW
2262 else
2263 case "$osname" in
2264 '') : Still unknown. Probably a generic Sys V.
2265 osname="sysv"
2266 osvers="$3"
2267 ;;
2268 esac
2304df62
AD
2269 fi
2270 ;;
2271 esac
2272 ;;
a0d0e21e
LW
2273 *) case "$osname" in
2274 '') : Still unknown. Probably a generic BSD.
2275 osname="$1"
2276 osvers="$3"
2277 ;;
2278 esac
2279 ;;
2304df62
AD
2280 esac
2281 else
dfe9444c
AD
2282 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2283 (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2284 if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2285 osname=news_os
2304df62 2286 fi
dfe9444c 2287 $rm -f UU/kernel.what
8e07c86e
AD
2288 elif test -d c:/.; then
2289 set X $myuname
2290 osname=os2
2291 osvers="$5"
2304df62
AD
2292 fi
2293 fi
85e6fe83 2294
a0d0e21e
LW
2295 : Now look for a hint file osname_osvers, unless one has been
2296 : specified already.
2297 case "$hintfile" in
2298 ''|' ')
ecfc5424 2299 file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'`
a0d0e21e 2300 : Also try without trailing minor version numbers.
ecfc5424
AD
2301 xfile=`echo $file | $sed -e 's@_[^_]*$@@'`
2302 xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'`
2303 xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'`
2304 xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'`
a0d0e21e
LW
2305 case "$file" in
2306 '') dflt=none ;;
2307 *) case "$osvers" in
2308 '') dflt=$file
2309 ;;
dfe9444c 2310 *) if $test -f $src/hints/$file.sh ; then
a0d0e21e 2311 dflt=$file
dfe9444c 2312 elif $test -f $src/hints/$xfile.sh ; then
a0d0e21e 2313 dflt=$xfile
dfe9444c 2314 elif $test -f $src/hints/$xxfile.sh ; then
a0d0e21e 2315 dflt=$xxfile
dfe9444c 2316 elif $test -f $src/hints/$xxxfile.sh ; then
a0d0e21e 2317 dflt=$xxxfile
dfe9444c 2318 elif $test -f $src/hints/$xxxxfile.sh ; then
a0d0e21e 2319 dflt=$xxxxfile
dfe9444c 2320 elif $test -f "$src/hints/${osname}.sh" ; then
a0d0e21e
LW
2321 dflt="${osname}"
2322 else
2323 dflt=none
2324 fi
2325 ;;
2326 esac
85e6fe83
LW
2327 ;;
2328 esac
4e2a5f63
AD
2329 if $test -f Policy.sh ; then
2330 case "$dflt" in
2331 *Policy*) ;;
2332 none) dflt="Policy" ;;
2333 *) dflt="Policy $dflt" ;;
2334 esac
2335 fi
85e6fe83 2336 ;;
a0d0e21e 2337 *)
ecfc5424 2338 dflt=`echo $hintfile | $sed 's/\.sh$//'`
a0d0e21e 2339 ;;
2304df62 2340 esac
1aef975c 2341
4e2a5f63
AD
2342 if $test -f Policy.sh ; then
2343 $cat <<EOM
2344
2345There's also a Policy hint file available, which should make the
2346site-specific (policy) questions easier to answer.
2347EOM
2348
2349 fi
2350
2304df62
AD
2351 $cat <<EOM
2352
2353You may give one or more space-separated answers, or "none" if appropriate.
4e2a5f63
AD
2354A well-behaved OS will have no hints, so answering "none" or just "Policy"
2355is a good thing. DO NOT give a wrong version.
2304df62
AD
2356
2357EOM
4e2a5f63 2358
2304df62 2359 rp="Which of these apply, if any?"
dfe9444c 2360 . UU/myread
85e6fe83
LW
2361 tans=$ans
2362 for file in $tans; do
4e2a5f63
AD
2363 if $test X$file = XPolicy -a -f Policy.sh; then
2364 . Policy.sh
2365 $cat Policy.sh >> UU/config.sh
2366 elif $test -f $src/hints/$file.sh; then
dfe9444c
AD
2367 . $src/hints/$file.sh
2368 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83 2369 elif $test X$tans = X -o X$tans = Xnone ; then
2304df62
AD
2370 : nothing
2371 else
85e6fe83
LW
2372 : Give one chance to correct a possible typo.
2373 echo "$file.sh does not exist"
2374 dflt=$file
2375 rp="hint to use instead?"
dfe9444c 2376 . UU/myread
85e6fe83 2377 for file in $ans; do
dfe9444c
AD
2378 if $test -f "$src/hints/$file.sh"; then
2379 . $src/hints/$file.sh
2380 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83
LW
2381 elif $test X$ans = X -o X$ans = Xnone ; then
2382 : nothing
2383 else
2384 echo "$file.sh does not exist -- ignored."
2385 fi
2386 done
2304df62
AD
2387 fi
2388 done
85e6fe83 2389
2304df62 2390 hint=recommended
85e6fe83 2391 : Remember our hint file for later.
dfe9444c 2392 if $test -f "$src/hints/$file.sh" ; then
a0d0e21e 2393 hintfile="$file"
85e6fe83 2394 else
a0d0e21e 2395 hintfile=''
85e6fe83 2396 fi
2304df62
AD
2397fi
2398cd UU
2399;;
2400*)
2401 echo " "
2402 echo "Fetching default answers from $config_sh..." >&4
ecfc5424
AD
2403 tmp_n="$n"
2404 tmp_c="$c"
2304df62
AD
2405 cd ..
2406 cp $config_sh config.sh 2>/dev/null
a78b0d02 2407 chmod +w config.sh
2304df62
AD
2408 . ./config.sh
2409 cd UU
2410 cp ../config.sh .
ecfc5424
AD
2411 n="$tmp_n"
2412 c="$tmp_c"
2304df62
AD
2413 hint=previous
2414 ;;
2415esac
1aef975c
AD
2416test "$override" && . ./optdef.sh
2417myuname="$newmyuname"
2304df62
AD
2418
2419: Restore computed paths
2420for file in $loclist $trylist; do
2421 eval $file="\$_$file"
2422done
2423
85e6fe83 2424cat << EOM
a0d0e21e 2425
85e6fe83 2426Configure uses the operating system name and version to set some defaults.
ecfc5424
AD
2427The default value is probably right if the name rings a bell. Otherwise,
2428since spelling matters for me, either accept the default or answer "none"
2429to leave it blank.
a0d0e21e 2430
85e6fe83 2431EOM
85e6fe83 2432case "$osname" in
a0d0e21e 2433 ''|' ')
85e6fe83 2434 case "$hintfile" in
a0d0e21e 2435 ''|' '|none) dflt=none ;;
ecfc5424 2436 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
85e6fe83
LW
2437 esac
2438 ;;
2439 *) dflt="$osname" ;;
2440esac
2441rp="Operating system name?"
2442. ./myread
2443case "$ans" in
ecfc5424
AD
2444none) osname='' ;;
2445*) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
85e6fe83 2446esac
8ff267be 2447echo " "
2448case "$osvers" in
2449 ''|' ')
2450 case "$hintfile" in
2451 ''|' '|none) dflt=none ;;
2452 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2453 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2454 case "$dflt" in
2455 ''|' ') dflt=none ;;
2456 esac
2457 ;;
2458 esac
2459 ;;
2460 *) dflt="$osvers" ;;
2461esac
2462rp="Operating system version?"
2463. ./myread
2464case "$ans" in
2465none) osvers='' ;;
2466*) osvers="$ans" ;;
2467esac
2468
2304df62 2469: who configured the system
59b83a6f 2470cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
8ff267be 2471cf_by=`(logname) 2>/dev/null`
dfe9444c
AD
2472case "$cf_by" in
2473"")
8ff267be 2474 cf_by=`(whoami) 2>/dev/null`
dfe9444c
AD
2475 case "$cf_by" in
2476 "") cf_by=unknown ;;
8ff267be 2477 esac ;;
2478esac
2304df62 2479
dfe9444c
AD
2480: set up the script used to warn in case of inconsistency
2481cat <<EOS >whoa
2482$startsh
2483EOS
2484cat <<'EOSC' >>whoa
2485dflt=y
2486echo " "
2487echo "*** WHOA THERE!!! ***" >&4
2488echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
2489rp=" Keep the $hint value?"
2490. ./myread
2491case "$ans" in
2492y) td=$was; tu=$was;;
2493esac
2494EOSC
2495
2496: function used to set $1 to $val
2497setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2498case "$val$was" in
2499$define$undef) . ./whoa; eval "$var=\$td";;
2500$undef$define) . ./whoa; eval "$var=\$tu";;
2501*) eval "$var=$val";;
2502esac'
2503
64e689dc
JH
2504cat <<EOM
2505
2506Perl can be built to take advantage of threads, on some systems.
2507To do so, Configure must be run with -Dusethreads.
d00b958f
JH
2508
2509Note that threading is a highly experimental feature, and
2510some known race conditions still remain. If you choose to try
2511it, be very sure to not actually deploy it for production
2512purposes. README.threads has more details, and is required
2513reading if you enable threads.
64e689dc 2514EOM
dfe9444c 2515case "$usethreads" in
b691c02f 2516$define|true|[yY]*) dflt='y';;
64e689dc
JH
2517*) dflt='n';;
2518esac
2519rp='Build a threading Perl?'
2520. ./myread
2521case "$ans" in
b691c02f 2522y|Y) val="$define" ;;
64e689dc 2523*) val="$undef" ;;
dfe9444c 2524esac
64e689dc
JH
2525set usethreads
2526eval $setvar
104d25b7 2527
693762b4
AD
2528case "$d_oldpthreads" in
2529'') : Configure tests would be welcome here. For now, assume undef.
2530 val="$undef" ;;
2531*) val="$d_oldpthreads" ;;
2532esac
2533set d_oldpthreads
2534eval $setvar
dfe9444c 2535
b691c02f
JH
2536
2537case "$usethreads" in
104d25b7
JH
2538"$define"|true|[yY]*)
2539: Look for a hint-file generated 'call-back-unit'. If the
2540: user has specified that a threading perl is to be built,
2541: we may need to set or change some other defaults.
2542 if $test -f usethreads.cbu; then
2543 . ./usethreads.cbu
2544 fi
2545 case "$osname" in
68c15b6f 2546 aix|dec_osf|dos_djgpp|freebsd|hpux|irix|linux|next|openbsd|os2|solaris|vmesa)
104d25b7
JH
2547 # Known thread-capable platforms.
2548 ;;
2549 *)
b691c02f 2550 cat >&4 <<EOM
b691c02f 2551$osname is not known to support threads.
dec9635e 2552Please let perlbug@perl.com know how to do that.
b691c02f
JH
2553
2554Cannot continue, aborting.
2555EOM
104d25b7 2556 exit 1
b691c02f 2557 ;;
104d25b7 2558 esac # $osname
b691c02f
JH
2559 ;;
2560esac # $usethreads
104d25b7 2561
64e689dc
JH
2562cat <<EOM
2563
2564Perl can be built so that multiple Perl interpreters can coexist
2565within the same Perl executable. To do so, Configure must be run with
2566-Dusemultiplicity.
2567
2568Normally you do not need this and you should answer no.
2569
2570EOM
85ab1d1d 2571case "$usemultiplicity" in
64e689dc
JH
2572$define|true|[yY]*) dflt='y';;
2573*) dflt='n';;
85ab1d1d 2574esac
64e689dc
JH
2575rp='Build Perl for multiplicity?'
2576. ./myread
2577case "$ans" in
2578y|Y) val="$define" ;;
2579*) val="$undef" ;;
2580esac
2581set usemultiplicity
2582eval $setvar
2583
2584cat <<EOM
2585
2586Perl can be built to take advantage of explicit 64-bit interfaces,
2587on some systems. To do so, Configure must be run with -Duse64bits.
2588
2589If this doesn't make any sense to you, just accept the default 'n'.
2590EOM
85ab1d1d 2591case "$use64bits" in
64e689dc
JH
2592$define|true|[yY]*) dflt='y';;
2593*) dflt='n';;
2594esac
2595rp='Try to use explicit 64-bit interfaces, if available?'
2596. ./myread
2597case "$ans" in
2598y|Y)
2599 val="$define"
2600 ;;
2601*)
2602 val="$undef"
2603 ;;
85ab1d1d 2604esac
64e689dc
JH
2605set use64bits
2606eval $setvar
85ab1d1d 2607
104d25b7
JH
2608case "$archname64" in
2609'') archname64='' ;; # not a typo
2610esac
85ab1d1d 2611
b691c02f 2612case "$use64bits" in
104d25b7
JH
2613"$define"|true|[yY]*)
2614: Look for a hint-file generated 'call-back-unit'. If the
2615: user has specified that a threading perl is to be built,
2616: we may need to set or change some other defaults.
2617 if $test -f use64bits.cbu; then
2618 . ./use64bits.cbu
2619 fi
b691c02f 2620 case "$osname" in
104d25b7
JH
2621 dec_osf|hpux|irix|solaris|unicos)
2622 # Known 64-bit capable platforms.
b691c02f 2623 ;;
b691c02f 2624 *)
104d25b7 2625 cat >&4 <<EOM
b691c02f 2626$osname is not known to support 64-bit interfaces.
dec9635e 2627Please let perlbug@perl.com know how to do that.
b691c02f
JH
2628
2629Cannot continue, aborting.
2630EOM
104d25b7
JH
2631 exit 1
2632 ;;
b691c02f
JH
2633 esac
2634 ;;
2635esac
104d25b7 2636
4633a7c4 2637: determine the architecture name
2304df62 2638echo " "
4633a7c4
LW
2639if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
2640 tarch=`arch`"-$osname"
2641elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
2642 if uname -m > tmparch 2>&1 ; then
7e1af8bc 2643 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5f05dabc 2644 -e 's/$/'"-$osname/" tmparch`
4633a7c4
LW
2645 else
2646 tarch="$osname"
2647 fi
2648 $rm -f tmparch
2649else
2650 tarch="$osname"
2651fi
2652case "$myarchname" in
2653''|"$tarch") ;;
2654*)
2655 echo "(Your architecture name used to be $myarchname.)"
2656 archname=''
2304df62
AD
2657 ;;
2658esac
85ab1d1d 2659myarchname="$tarch"
4633a7c4
LW
2660case "$archname" in
2661'') dflt="$tarch";;
2662*) dflt="$archname";;
2663esac
2664rp='What is your architecture name'
2665. ./myread
85ab1d1d 2666archname="$ans"
dc66995c 2667case "$usethreads" in
85ab1d1d
JH
2668$define)
2669 echo "Threads selected." >&4
2670 case "$archname" in
2671 *-thread*) echo "...and architecture name already has -thread." >&4
2672 ;;
2673 *) archname="$archname-thread"
2674 echo "...setting architecture name to $archname." >&4
2675 ;;
2676 esac
2677 ;;
dc66995c 2678esac
85ab1d1d
JH
2679case "$usemultiplicity" in
2680$define)
2681 echo "Multiplicity selected." >&4
2682 case "$archname" in
2683 *-multi*) echo "...and architecture name already has -multi." >&4
2684 ;;
2685 *) archname="$archname-multi"
2686 echo "...setting architecture name to $archname." >&4
2687 ;;
2688 esac
2689 ;;
2690esac
2691case "$use64bits" in
2692$define)
2693 echo "Explicit 64-bitness selected." >&4
2694 case "$archname64" in
2695 '')
2696 ;;
2697 *)
2698 case "$archname" in
2699 *-$archname64*) echo "...and architecture name already has $archname64." >&4
2700 ;;
2701 *) archname="$archname-$archname64"
2702 echo "...setting architecture name to $archname." >&4
2703 ;;
2704 esac
2705 ;;
2706 esac
2707esac
2708
4633a7c4
LW
2709: is AFS running?
2710echo " "
2afac517 2711case "$afs" in
2712$define|true) afs=true ;;
2713$undef|false) afs=false ;;
2714*) if test -d /afs; then
2715 afs=true
2716 else
2717 afs=false
2718 fi
2719 ;;
2720esac
2721if $afs; then
4633a7c4 2722 echo "AFS may be running... I'll be extra cautious then..." >&4
2304df62 2723else
4633a7c4 2724 echo "AFS does not seem to be running..." >&4
2304df62
AD
2725fi
2726
4633a7c4
LW
2727: decide how portable to be. Allow command line overrides.
2728case "$d_portable" in
2729"$undef") ;;
2730*) d_portable="$define" ;;
2304df62 2731esac
2304df62 2732
4633a7c4
LW
2733: set up shell script to do ~ expansion
2734cat >filexp <<EOSS
2735$startsh
2736: expand filename
2737case "\$1" in
2738 ~/*|~)
2739 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
2304df62 2740 ;;
4633a7c4
LW
2741 ~*)
2742 if $test -f /bin/csh; then
2743 /bin/csh -f -c "glob \$1"
2744 failed=\$?
2745 echo ""
2746 exit \$failed
2747 else
2748 name=\`$expr x\$1 : '..\([^/]*\)'\`
2749 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
2750 if $test ! -d "\$dir"; then
2751 me=\`basename \$0\`
2752 echo "\$me: can't locate home directory for: \$name" >&2
2753 exit 1
2754 fi
2755 case "\$1" in
2756 */*)
2757 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
2758 ;;
2759 *)
2760 echo \$dir
2761 ;;
2304df62 2762 esac
4633a7c4 2763 fi
2304df62
AD
2764 ;;
2765*)
4633a7c4 2766 echo \$1
2304df62
AD
2767 ;;
2768esac
4633a7c4
LW
2769EOSS
2770chmod +x filexp
2771$eunicefix filexp
2304df62
AD
2772
2773: now set up to get a file name
28757baa 2774cat <<EOS >getfile
2775$startsh
2776EOS
2777cat <<'EOSC' >>getfile
2304df62
AD
2778tilde=''
2779fullpath=''
2780already=''
2781skip=''
2782none_ok=''
2783exp_file=''
a0d0e21e 2784nopath_ok=''
2304df62
AD
2785orig_rp="$rp"
2786orig_dflt="$dflt"
2787
2788case "$fn" in
ecfc5424 2789*\(*)
28e8609d 2790 expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
ecfc5424
AD
2791 fn=`echo $fn | sed 's/(.*)//'`
2792 ;;
2793esac
2794
2795case "$fn" in
a0d0e21e
LW
2796*:*)
2797 loc_file=`expr $fn : '.*:\(.*\)'`
2798 fn=`expr $fn : '\(.*\):.*'`
2799 ;;
2800esac
2801
2802case "$fn" in
2304df62
AD
2803*~*) tilde=true;;
2804esac
2805case "$fn" in
2806*/*) fullpath=true;;
2807esac
2808case "$fn" in
2809*+*) skip=true;;
2810esac
2811case "$fn" in
2812*n*) none_ok=true;;
2813esac
2814case "$fn" in
2815*e*) exp_file=true;;
2816esac
a0d0e21e
LW
2817case "$fn" in
2818*p*) nopath_ok=true;;
2819esac
2304df62
AD
2820
2821case "$fn" in
2822*f*) type='File';;
2823*d*) type='Directory';;
a0d0e21e 2824*l*) type='Locate';;
2304df62
AD
2825esac
2826
2827what="$type"
2828case "$what" in
2829Locate) what='File';;
2830esac
2831
2832case "$exp_file" in
2833'')
2834 case "$d_portable" in
2835 "$define") ;;
2836 *) exp_file=true;;
2837 esac
2838 ;;
2839esac
2840
2841cd ..
2842while test "$type"; do
2843 redo=''
2844 rp="$orig_rp"
2845 dflt="$orig_dflt"
2846 case "$tilde" in
2847 true) rp="$rp (~name ok)";;
2848 esac
2849 . UU/myread
ecfc5424
AD
2850 if test -f UU/getfile.ok && \
2851 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
2852 then
2853 value="$ans"
2854 ansexp="$ans"
2855 break
2856 fi
2304df62
AD
2857 case "$ans" in
2858 none)
2859 value=''
2860 ansexp=''
2861 case "$none_ok" in
2862 true) type='';;
2863 esac
2864 ;;
2865 *)
2866 case "$tilde" in
2867 '') value="$ans"
2868 ansexp="$ans";;
2869 *)
2870 value=`UU/filexp $ans`
2871 case $? in
2872 0)
2873 if test "$ans" != "$value"; then
ecfc5424 2874 echo "(That expands to $value on this system.)"
2304df62
AD
2875 fi
2876 ;;
2877 *) value="$ans";;
2878 esac
2879 ansexp="$value"
2880 case "$exp_file" in
2881 '') value="$ans";;
2882 esac
2883 ;;
2884 esac
2885 case "$fullpath" in
2886 true)
2887 case "$ansexp" in
2888 /*) value="$ansexp" ;;
2889 *)
2890 redo=true
2891 case "$already" in
2892 true)
2893 echo "I shall only accept a full path name, as in /bin/ls." >&4
2894 echo "Use a ! shell escape if you wish to check pathnames." >&4
2895 ;;
2896 *)
2897 echo "Please give a full path name, starting with slash." >&4
2898 case "$tilde" in
2899 true)
2900 echo "Note that using ~name is ok provided it expands well." >&4
2901 already=true
2902 ;;
2903 esac
2904 esac
2905 ;;
2906 esac
2907 ;;
2908 esac
2909 case "$redo" in
2910 '')
2911 case "$type" in
2912 File)
2913 if test -f "$ansexp"; then
2914 type=''
2915 elif test -r "$ansexp" || (test -h "$ansexp") >/dev/null 2>&1
2916 then
2917 echo "($value is not a plain file, but that's ok.)"
2918 type=''
2919 fi
2920 ;;
2921 Directory)
2922 if test -d "$ansexp"; then
2923 type=''
2924 fi
2925 ;;
2926 Locate)
40000a8c 2927 if test -d "$ansexp"; then
a0d0e21e
LW
2928 echo "(Looking for $loc_file in directory $value.)"
2929 value="$value/$loc_file"
40000a8c 2930 ansexp="$ansexp/$loc_file"
2304df62 2931 fi
40000a8c 2932 if test -f "$ansexp"; then
2304df62
AD
2933 type=''
2934 fi
a0d0e21e
LW
2935 case "$nopath_ok" in
2936 true) case "$value" in
2937 */*) ;;
2938 *) echo "Assuming $value will be in people's path."
2939 type=''
2940 ;;
2941 esac
2942 ;;
2943 esac
2304df62
AD
2944 ;;
2945 esac
2946
2947 case "$skip" in
2948 true) type='';
2949 esac
2950
2951 case "$type" in
2952 '') ;;
2953 *)
2954 if test "$fastread" = yes; then
2955 dflt=y
2956 else
2957 dflt=n
2958 fi
2959 rp="$what $value doesn't exist. Use that name anyway?"
2960 . UU/myread
2961 dflt=''
2962 case "$ans" in
2963 y*) type='';;
2964 *) echo " ";;
2965 esac
2966 ;;
2967 esac
2968 ;;
2969 esac
2970 ;;
2971 esac
2972done
2973cd UU
2974ans="$value"
2975rp="$orig_rp"
2976dflt="$orig_dflt"
ecfc5424 2977rm -f getfile.ok
2304df62
AD
2978EOSC
2979
4633a7c4
LW
2980: determine root of directory hierarchy where package will be installed.
2981case "$prefix" in
2982'')
2983 dflt=`./loc . /usr/local /usr/local /local /opt /usr`
8e07c86e 2984 ;;
4633a7c4
LW
2985*)
2986 dflt="$prefix"
8e07c86e
AD
2987 ;;
2988esac
4633a7c4 2989$cat <<EOM
2304df62 2990
4633a7c4
LW
2991By default, $package will be installed in $dflt/bin, manual
2992pages under $dflt/man, etc..., i.e. with $dflt as prefix for
2993all installation directories. Typically set to /usr/local, but you
2994may choose /usr if you wish to install $package among your system
2995binaries. If you wish to have binaries under /bin but manual pages
2996under /usr/local/man, that's ok: you will be prompted separately
2997for each of the installation directories, the prefix being only used
2998to set the defaults.
8e07c86e
AD
2999
3000EOM
3001fn=d~
3002rp='Installation prefix to use?'
3003. ./getfile
3004oldprefix=''
3005case "$prefix" in
a0d0e21e 3006'') ;;
8e07c86e
AD
3007*)
3008 case "$ans" in
3009 "$prefix") ;;
3010 *) oldprefix="$prefix";;
3011 esac
3012 ;;
a0d0e21e 3013esac
8e07c86e
AD
3014prefix="$ans"
3015prefixexp="$ansexp"
a0d0e21e 3016
8e07c86e
AD
3017: set the prefixit variable, to compute a suitable default value
3018prefixit='case "$3" in
3019""|none)
3020 case "$oldprefix" in
3021 "") eval "$1=\"\$$2\"";;
3022 *)
3023 case "$3" in
3024 "") eval "$1=";;
3025 none)
3026 eval "tp=\"\$$2\"";
3027 case "$tp" in
3028 ""|" ") eval "$1=\"\$$2\"";;
3029 *) eval "$1=";;
3030 esac;;
3031 esac;;
3032 esac;;
3033*)
3034 eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
3035 case "$tp" in
3036 --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
3037 /*-$oldprefix/*|\~*-$oldprefix/*)
3038 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
3039 *) eval "$1=\"\$$2\"";;
3040 esac;;
3041esac'
a0d0e21e 3042
bfb7748a
AD
3043: set the base revision
3044baserev=5.0
3045
3046: get the patchlevel
3047echo " "
3048echo "Getting the current patchlevel..." >&4
3049if $test -r $rsrc/patchlevel.h;then
d00b958f
JH
3050 patchlevel=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
3051 subversion=`awk '/define[ ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
bfb7748a
AD
3052else
3053 patchlevel=0
3054 subversion=0
3055fi
3056$echo $n "(You have $package" $c
3057case "$package" in
3058"*$baserev") ;;
3059*) $echo $n " $baserev" $c ;;
3060esac
3061$echo $n " patchlevel $patchlevel" $c
3062test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
3063echo ".)"
3064
3065if test 0 -eq "$subversion"; then
3066 version=`LC_ALL=C; export LC_ALL; \
3067 echo $baserev $patchlevel | \
3068 $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
3069else
3070 version=`LC_ALL=C; export LC_ALL; \
3071 echo $baserev $patchlevel $subversion | \
3072 $awk '{ printf "%.5f\n", $1 + $2/1000.0 + $3/100000.0 }'`
3073fi
3074: Figure out perl API version. Perhaps this should be in patchlevel.h
3075if test "$subversion" -lt 50; then
3076 apiversion=`LC_ALL=C; export LC_ALL; \
59b83a6f 3077 LANGUAGE=C; export LANGUAGE; \
bfb7748a
AD
3078 echo $baserev $patchlevel | \
3079 $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
3080else
3081 apiversion="$version"
3082fi
3083
4633a7c4 3084: determine where private library files go
3a6175e1
AD
3085: Usual default is /usr/local/lib/perl5/$version.
3086: Also allow things like /opt/perl/lib/$version, since
bfb7748a 3087: /opt/perl/lib/perl5... would be redundant.
4633a7c4 3088case "$prefix" in
3a6175e1
AD
3089*perl*) set dflt privlib lib/$version ;;
3090*) set dflt privlib lib/$package/$version ;;
4633a7c4 3091esac
8e07c86e 3092eval $prefixit
4633a7c4
LW
3093$cat <<EOM
3094
3095There are some auxiliary files for $package that need to be put into a
3096private library directory that is accessible by everyone.
3097
3098EOM
3099fn=d~+
3100rp='Pathname where the private library files will reside?'
8e07c86e 3101. ./getfile
4633a7c4
LW
3102if $test "X$privlibexp" != "X$ansexp"; then
3103 installprivlib=''
8e07c86e 3104fi
4633a7c4
LW
3105privlib="$ans"
3106privlibexp="$ansexp"
8e07c86e
AD
3107if $afs; then
3108 $cat <<EOM
2304df62 3109
8e07c86e 3110Since you are running AFS, I need to distinguish the directory in which
4633a7c4 3111private files reside from the directory in which they are installed (and from
8e07c86e 3112which they are presumably copied to the former directory by occult means).
a0d0e21e 3113
8e07c86e 3114EOM
4633a7c4
LW
3115 case "$installprivlib" in
3116 '') dflt=`echo $privlibexp | sed 's#^/afs/#/afs/.#'`;;
3117 *) dflt="$installprivlib";;
8e07c86e
AD
3118 esac
3119 fn=de~
4633a7c4 3120 rp='Where will private files be installed?'
8e07c86e 3121 . ./getfile
4633a7c4 3122 installprivlib="$ans"
8e07c86e 3123else
4633a7c4
LW
3124 installprivlib="$privlibexp"
3125fi
3126
8e07c86e
AD
3127: set the prefixup variable, to restore leading tilda escape
3128prefixup='case "$prefixexp" in
3129"$prefix") ;;
3130*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
3131esac'
3132
4633a7c4
LW
3133: determine where public architecture dependent libraries go
3134set archlib archlib
8e07c86e 3135eval $prefixit
3a6175e1 3136: privlib default is /usr/local/lib/$package/$version
bfb7748a 3137: archlib default is /usr/local/lib/$package/$version/$archname
3a6175e1 3138: privlib may have an optional trailing /share.
bfb7748a
AD
3139tdflt=`echo $privlib | $sed 's,/share$,,'`
3140tdflt=$tdflt/$archname
4633a7c4 3141case "$archlib" in
bfb7748a 3142'') dflt=$tdflt
8e07c86e 3143 ;;
bfb7748a 3144*) dflt="$archlib"
774d564b 3145 ;;
8e07c86e 3146esac
4633a7c4
LW
3147cat <<EOM
3148
3149$spackage contains architecture-dependent library files. If you are
3150sharing libraries in a heterogeneous environment, you might store
3151these files in a separate location. Otherwise, you can just include
3152them with the rest of the public library files.
3153
8e07c86e 3154EOM
4633a7c4
LW
3155fn=d+~
3156rp='Where do you want to put the public architecture-dependent libraries?'
8e07c86e 3157. ./getfile
4633a7c4
LW
3158archlib="$ans"
3159archlibexp="$ansexp"
3160
8e07c86e
AD
3161if $afs; then
3162 $cat <<EOM
3163
7bac28a0 3164Since you are running AFS, I need to distinguish the directory in
3165which architecture-dependent library files reside from the directory
3166in which they are installed (and from which they are presumably copied
3167to the former directory by occult means).
8e07c86e
AD
3168
3169EOM
4633a7c4
LW
3170 case "$installarchlib" in
3171 '') dflt=`echo $archlibexp | sed 's#^/afs/#/afs/.#'`;;
3172 *) dflt="$installarchlib";;
8e07c86e
AD
3173 esac
3174 fn=de~
4633a7c4 3175 rp='Where will architecture-dependent library files be installed?'
8e07c86e 3176 . ./getfile
4633a7c4 3177 installarchlib="$ans"
8e07c86e 3178else
4633a7c4
LW
3179 installarchlib="$archlibexp"
3180fi
3181if $test X"$archlib" = X"$privlib"; then
3182 d_archlib="$undef"
3183else
3184 d_archlib="$define"
8e07c86e
AD
3185fi
3186
40a7a20a 3187: make some quick guesses about what we are up against
3188echo " "
3189$echo $n "Hmm... $c"
3190echo exit 1 >bsd
3191echo exit 1 >usg
3192echo exit 1 >v7
3193echo exit 1 >osf1
3194echo exit 1 >eunice
3195echo exit 1 >xenix
3196echo exit 1 >venix
8ff267be 3197echo exit 1 >os2
40a7a20a 3198d_bsd="$undef"
3199$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3200if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3201then
3202 echo "Looks kind of like an OSF/1 system, but we'll see..."
3203 echo exit 0 >osf1
3204elif test `echo abc | tr a-z A-Z` = Abc ; then
3205 xxx=`./loc addbib blurfl $pth`
3206 if $test -f $xxx; then
3207 echo "Looks kind of like a USG system with BSD features, but we'll see..."
3208 echo exit 0 >bsd
3209 echo exit 0 >usg
3210 else
3211 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3212 echo "Looks kind of like an extended USG system, but we'll see..."
3213 else
3214 echo "Looks kind of like a USG system, but we'll see..."
3215 fi
3216 echo exit 0 >usg
3217 fi
3218elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3219 echo "Looks kind of like a BSD system, but we'll see..."
3220 d_bsd="$define"
3221 echo exit 0 >bsd
3222else
3223 echo "Looks kind of like a Version 7 system, but we'll see..."
3224 echo exit 0 >v7
3225fi
3226case "$eunicefix" in
3227*unixtovms*)
3228 $cat <<'EOI'
3229There is, however, a strange, musty smell in the air that reminds me of
3230something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3231EOI
3232 echo exit 0 >eunice
3233 d_eunice="$define"
3234: it so happens the Eunice I know will not run shell scripts in Unix format
3235 ;;
3236*)
3237 echo " "
3238 echo "Congratulations. You aren't running Eunice."
3239 d_eunice="$undef"
3240 ;;
3241esac
8ff267be 3242: Detect OS2. The p_ variable is set above in the Head.U unit.
3243case "$p_" in
3244:) ;;
3245*)
3246 $cat <<'EOI'
3247I have the feeling something is not exactly right, however...don't tell me...
3248lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3249EOI
3250 echo exit 0 >os2
3251 ;;
3252esac
40a7a20a 3253if test -f /xenix; then
3254 echo "Actually, this looks more like a XENIX system..."
3255 echo exit 0 >xenix
3256 d_xenix="$define"
3257else
3258 echo " "
3259 echo "It's not Xenix..."
3260 d_xenix="$undef"
3261fi
3262chmod +x xenix
3263$eunicefix xenix
3264if test -f /venix; then
3265 echo "Actually, this looks more like a VENIX system..."
3266 echo exit 0 >venix
3267else
3268 echo " "
3269 if ./xenix; then
3270 : null
3271 else
3272 echo "Nor is it Venix..."
3273 fi
3274fi
8ff267be 3275chmod +x bsd usg v7 osf1 eunice xenix venix os2
3276$eunicefix bsd usg v7 osf1 eunice xenix venix os2
40a7a20a 3277$rm -f foo
3278
3279: see if setuid scripts can be secure
3280$cat <<EOM
3281
3282Some kernels have a bug that prevents setuid #! scripts from being
3283secure. Some sites have disabled setuid #! scripts because of this.
3284
3285First let's decide if your kernel supports secure setuid #! scripts.
3286(If setuid #! scripts would be secure but have been disabled anyway,
3287don't say that they are secure if asked.)
3288
3289EOM
3290
3291val="$undef"
3292if $test -d /dev/fd; then
3293 echo "#!$ls" >reflect
3294 chmod +x,u+s reflect
3295 ./reflect >flect 2>&1
3296 if $contains "/dev/fd" flect >/dev/null; then
3297 echo "Congratulations, your kernel has secure setuid scripts!" >&4
3298 val="$define"
3299 else
3300 $cat <<EOM
3301If you are not sure if they are secure, I can check but I'll need a
3302username and password different from the one you are using right now.
3303If you don't have such a username or don't want me to test, simply
3304enter 'none'.
3305
3306EOM
3307 rp='Other username to test security of setuid scripts with?'
3308 dflt='none'
3309 . ./myread
3310 case "$ans" in
3311 n|none)
3312 case "$d_suidsafe" in
3313 '') echo "I'll assume setuid scripts are *not* secure." >&4
3314 dflt=n;;
3315 "$undef")
3316 echo "Well, the $hint value is *not* secure." >&4
3317 dflt=n;;
3318 *) echo "Well, the $hint value *is* secure." >&4
3319 dflt=y;;
3320 esac
3321 ;;
3322 *)
3323 $rm -f reflect flect
3324 echo "#!$ls" >reflect
3325 chmod +x,u+s reflect
3326 echo >flect
3327 chmod a+w flect
3328 echo '"su" will (probably) prompt you for '"$ans's password."
3329 su $ans -c './reflect >flect'
3330 if $contains "/dev/fd" flect >/dev/null; then
3331 echo "Okay, it looks like setuid scripts are secure." >&4
3332 dflt=y
3333 else
3334 echo "I don't think setuid scripts are secure." >&4
3335 dflt=n
3336 fi
3337 ;;
3338 esac
3339 rp='Does your kernel have *secure* setuid scripts?'
3340 . ./myread
3341 case "$ans" in
3342 [yY]*) val="$define";;
3343 *) val="$undef";;
3344 esac
3345 fi
3346else
3347 echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
760ac839 3348 echo "(That's for file descriptors, not floppy disks.)"
40a7a20a 3349 val="$undef"
3350fi
3351set d_suidsafe
3352eval $setvar
3353
3354$rm -f reflect flect
3355
3356: now see if they want to do setuid emulation
3357echo " "
3358val="$undef"
3359case "$d_suidsafe" in
3360"$define")
3361 val="$undef"
3362 echo "No need to emulate SUID scripts since they are secure here." >& 4
3363 ;;
3364*)
3365 $cat <<EOM
3366Some systems have disabled setuid scripts, especially systems where
3367setuid scripts cannot be secure. On systems where setuid scripts have
dfe9444c
AD
3368been disabled, the setuid/setgid bits on scripts are currently
3369useless. It is possible for $package to detect those bits and emulate
3370setuid/setgid in a secure fashion. This emulation will only work if
3371setuid scripts have been disabled in your kernel.
8e07c86e
AD
3372
3373EOM
dfe9444c
AD
3374 case "$d_dosuid" in
3375 "$define") dflt=y ;;
3376 *) dflt=n ;;
3377 esac
3378 rp="Do you want to do setuid/setgid emulation?"
3379 . ./myread
3380 case "$ans" in
3381 [yY]*) val="$define";;
3382 *) val="$undef";;
3383 esac
3384 ;;
4633a7c4 3385esac
dfe9444c 3386set d_dosuid
4633a7c4 3387eval $setvar
8e07c86e 3388
2c7991dc 3389: determine where manual pages are on this system
3390echo " "
3391case "$sysman" in
3392'')
3393 syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
3394 syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
3395 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
3396 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
3397 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
3398 sysman=`./loc . /usr/man/man1 $syspath`
3399 ;;
3400esac
3401if $test -d "$sysman"; then
3402 echo "System manual is in $sysman." >&4
3403else
3404 echo "Could not find manual pages in source form." >&4
3405fi
3406
dc45a647
MB
3407: see what memory models we can support
3408case "$models" in
3409'')
3410 $cat >pdp11.c <<'EOP'
d674cd6d 3411int main() {
dc45a647
MB
3412#ifdef pdp11
3413 exit(0);
3414#else
3415 exit(1);
3416#endif
3417}
3418EOP
3419 ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
3420 if $test -f pdp11 && ./pdp11 2>/dev/null; then
3421 dflt='unsplit split'
3422 else
3423 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
3424 case "$tans" in
3425 X) dflt='none';;
3426 *) if $test -d /lib/small || $test -d /usr/lib/small; then
3427 dflt='small'
3428 else
3429 dflt=''
3430 fi
3431 if $test -d /lib/medium || $test -d /usr/lib/medium; then
3432 dflt="$dflt medium"
3433 fi
3434 if $test -d /lib/large || $test -d /usr/lib/large; then
3435 dflt="$dflt large"
3436 fi
3437 if $test -d /lib/huge || $test -d /usr/lib/huge; then
3438 dflt="$dflt huge"
3439 fi
3440 esac
3441 fi;;
3442*) dflt="$models";;
3443esac
8e07c86e 3444$cat <<EOM
dc45a647
MB
3445
3446Some systems have different model sizes. On most systems they are called
3447small, medium, large, and huge. On the PDP11 they are called unsplit and
3448split. If your system doesn't support different memory models, say "none".
3449If you wish to force everything to one memory model, say "none" here and
3450put the appropriate flags later when it asks you for other cc and ld flags.
3451Venix systems may wish to put "none" and let the compiler figure things out.
3452(In the following question multiple model names should be space separated.)
3453
3454The default for most systems is "none".
8e07c86e 3455
8e07c86e 3456EOM
dc45a647
MB
3457rp="Which memory models are supported?"
3458. ./myread
3459models="$ans"
3460
3461case "$models" in
3462none)
3463 small=''
3464 medium=''
3465 large=''
3466 huge=''
3467 unsplit=''
3468 split=''
2c7991dc 3469 ;;
dc45a647
MB
3470*split)
3471 case "$split" in
3472 '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
3473 $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
3474 dflt='-i'
3475 else
3476 dflt='none'
3477 fi;;
3478 *) dflt="$split";;
3479 esac
3480 rp="What flag indicates separate I and D space?"
3481 . ./myread
3482 tans="$ans"
3483 case "$tans" in
3484 none) tans='';;
3485 esac
3486 split="$tans"
3487 unsplit='';;
3488*large*|*small*|*medium*|*huge*)
3489 case "$models" in
3490 *large*)
3491 case "$large" in
3492 '') dflt='-Ml';;
3493 *) dflt="$large";;
3494 esac
3495 rp="What flag indicates large model?"
3496 . ./myread
3497 tans="$ans"
3498 case "$tans" in
3499 none) tans='';
3500 esac
3501 large="$tans";;
3502 *) large='';;
3503 esac
3504 case "$models" in
3505 *huge*) case "$huge" in
3506 '') dflt='-Mh';;
3507 *) dflt="$huge";;
3508 esac
3509 rp="What flag indicates huge model?"
3510 . ./myread
3511 tans="$ans"
3512 case "$tans" in
3513 none) tans='';
3514 esac
3515 huge="$tans";;
3516 *) huge="$large";;
3517 esac
3518 case "$models" in
3519 *medium*) case "$medium" in
3520 '') dflt='-Mm';;
3521 *) dflt="$medium";;
3522 esac
3523 rp="What flag indicates medium model?"
3524 . ./myread
3525 tans="$ans"
3526 case "$tans" in
3527 none) tans='';
3528 esac
3529 medium="$tans";;
3530 *) medium="$large";;
3531 esac
3532 case "$models" in
3533 *small*) case "$small" in
3534 '') dflt='none';;
3535 *) dflt="$small";;
3536 esac
3537 rp="What flag indicates small model?"
3538 . ./myread
3539 tans="$ans"
3540 case "$tans" in
3541 none) tans='';
3542 esac
3543 small="$tans";;
3544 *) small='';;
25f94b33 3545 esac
8e07c86e 3546 ;;
dc45a647
MB
3547*)
3548 echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
8e07c86e
AD
3549 ;;
3550esac
dc45a647 3551$rm -f pdp11.* pdp11
4e2a5f63 3552
dc45a647
MB
3553: see if we need a special compiler
3554echo " "
3555if ./usg; then
3556 case "$cc" in
3557 '') case "$Mcc" in
3558 /*) dflt='Mcc';;
3559 *) case "$large" in
3560 -M*) dflt='cc';;
3561 *) if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
3562 if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
3563 dflt='cc'
3564 else
3565 dflt='cc -M'
3566 fi
3567 else
3568 dflt='cc'
3569 fi;;
3570 esac;;
3571 esac;;
3572 *) dflt="$cc";;
3573 esac
3574 case "$dflt" in
3575 *M*) $cat <<'EOM'
3576On some older systems the default C compiler will not resolve multiple global
3577references that happen to have the same name. On some such systems the "Mcc"
3578command may be used to force these to be resolved. On other systems a "cc -M"
3579command is required. (Note that the -M flag on other systems indicates a
3580memory model to use!) If you have the Gnu C compiler, you might wish to use
3581that instead.
8e07c86e
AD
3582
3583EOM
dc45a647 3584 ;;
2afac517 3585 esac
dc45a647
MB
3586 rp="Use which C compiler?"
3587 . ./myread
3588 cc="$ans"
4e2a5f63 3589else
dc45a647
MB
3590 case "$cc" in
3591 '') dflt=cc;;
3592 *) dflt="$cc";;
4e2a5f63 3593 esac
dc45a647 3594 rp="Use which C compiler?"
4e2a5f63
AD
3595 . ./myread
3596 cc="$ans"
3597fi
693762b4
AD
3598: Look for a hint-file generated 'call-back-unit'. Now that the
3599: user has specified the compiler, we may need to set or change some
3600: other defaults.
3601if $test -f cc.cbu; then
3602 . ./cc.cbu
3603fi
4e2a5f63
AD
3604echo " "
3605echo "Checking for GNU cc in disguise and/or its version number..." >&4
3606$cat >gccvers.c <<EOM
3607#include <stdio.h>
3608int main() {
3609#ifdef __GNUC__
3610#ifdef __VERSION__
3611 printf("%s\n", __VERSION__);
3612#else
3613 printf("%s\n", "1");
3614#endif
3615#endif
3616 exit(0);
3617}
3618EOM
3619if $cc -o gccvers gccvers.c >/dev/null 2>&1; then
3620 gccversion=`./gccvers`
3621 case "$gccversion" in
2afac517 3622 '') echo "You are not using GNU cc." ;;
3623 *) echo "You are using GNU cc $gccversion." ;;
3624 esac
3625else
3626 echo " "
3627 echo "*** WHOA THERE!!! ***" >&4
3628 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
3629 case "$knowitall" in
3630 '')
3631 echo " You'd better start hunting for one and let me know about it." >&4
3632 exit 1
2c7991dc 3633 ;;
8e07c86e 3634 esac
2afac517 3635fi
3636$rm -f gccvers*
3637case "$gccversion" in
36381*) cpp=`./loc gcc-cpp $cpp $pth` ;;
8e07c86e
AD
3639esac
3640
2afac517 3641: What should the include directory be ?
8e07c86e 3642echo " "
2afac517 3643$echo $n "Hmm... $c"
3644dflt='/usr/include'
3645incpath=''
3646mips_type=''
3647if $test -f /bin/mips && /bin/mips; then
3648 echo "Looks like a MIPS system..."
3649 $cat >usr.c <<'EOCP'
3650#ifdef SYSTYPE_BSD43
3651/bsd43
3652#endif
3653EOCP
3654 if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3655 dflt='/bsd43/usr/include'
3656 incpath='/bsd43'
3657 mips_type='BSD 4.3'
8e07c86e 3658 else
2afac517 3659 mips_type='System V'
8e07c86e 3660 fi
2afac517 3661 $rm -f usr.c usr.out
3662 echo "and you're compiling with the $mips_type compiler and libraries."
3663 xxx_prompt=y
3664 echo "exit 0" >mips
8e07c86e 3665else
2afac517 3666 echo "Doesn't look like a MIPS system."
3667 xxx_prompt=n
3668 echo "exit 1" >mips
3669fi
3670chmod +x mips
3671$eunicefix mips
2afac517 3672case "$usrinc" in
3673'') ;;
3674*) dflt="$usrinc";;
3675esac
3676case "$xxx_prompt" in
3677y) fn=d/
dfe9444c 3678 echo " "
2afac517 3679 rp='Where are the include files you want to use?'
3680 . ./getfile
3681 usrinc="$ans"
3682 ;;
3683*) usrinc="$dflt"
3684 ;;
3685esac
8e07c86e 3686
c4f23d77
AD
3687: see how we invoke the C preprocessor
3688echo " "
3689echo "Now, how can we feed standard input to your C preprocessor..." >&4
3690cat <<'EOT' >testcpp.c
3691#define ABC abc
3692#define XYZ xyz
3693ABC.XYZ
3694EOT
3695cd ..
1cfa4ec7
GS
3696if test ! -f cppstdin; then
3697 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3698else
3699 echo "Keeping your $hint cppstdin wrapper."
3700fi
c4f23d77
AD
3701chmod 755 cppstdin
3702wrapper=`pwd`/cppstdin
3703ok='false'
3704cd UU
3705
3706if $test "X$cppstdin" != "X" && \
3707 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3708 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3709then
3710 echo "You used to use $cppstdin $cppminus so we'll use that again."
3711 case "$cpprun" in
3712 '') echo "But let's see if we can live without a wrapper..." ;;
3713 *)
3714 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3715 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3716 then
3717 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3718 ok='true'
3719 else
3720 echo "(However, $cpprun $cpplast does not work, let's see...)"
3721 fi
3722 ;;
3723 esac
3724else
3725 case "$cppstdin" in
3726 '') ;;
3727 *)
3728 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3729 ;;
3730 esac
3731fi
3732
3733if $ok; then
3734 : nothing
3735elif echo 'Maybe "'"$cc"' -E" will work...'; \
3736 $cc -E <testcpp.c >testcpp.out 2>&1; \
3737 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3738 echo "Yup, it does."
3739 x_cpp="$cc -E"
3740 x_minus='';
3741elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3742 $cc -E - <testcpp.c >testcpp.out 2>&1; \
3743 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3744 echo "Yup, it does."
3745 x_cpp="$cc -E"
3746 x_minus='-';
3747elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3748 $cc -P <testcpp.c >testcpp.out 2>&1; \
3749 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3750 echo "Yipee, that works!"
3751 x_cpp="$cc -P"
3752 x_minus='';
3753elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3754 $cc -P - <testcpp.c >testcpp.out 2>&1; \
3755 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3756 echo "At long last!"
3757 x_cpp="$cc -P"
3758 x_minus='-';
3759elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3760 $cpp <testcpp.c >testcpp.out 2>&1; \
3761 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3762 echo "It works!"
3763 x_cpp="$cpp"
3764 x_minus='';
3765elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3766 $cpp - <testcpp.c >testcpp.out 2>&1; \
3767 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3768 echo "Hooray, it works! I was beginning to wonder."
3769 x_cpp="$cpp"
3770 x_minus='-';
3771elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
3772 $wrapper <testcpp.c >testcpp.out 2>&1; \
3773 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3774 x_cpp="$wrapper"
3775 x_minus=''
3776 echo "Eureka!"
3777else
3778 dflt=''
3779 rp="No dice. I can't find a C preprocessor. Name one:"
3780 . ./myread
3781 x_cpp="$ans"
3782 x_minus=''
3783 $x_cpp <testcpp.c >testcpp.out 2>&1
3784 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3785 echo "OK, that will do." >&4
3786 else
3787echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
3788 exit 1
3789 fi
3790fi
3791
3792case "$ok" in
3793false)
3794 cppstdin="$x_cpp"
3795 cppminus="$x_minus"
3796 cpprun="$x_cpp"
3797 cpplast="$x_minus"
3798 set X $x_cpp
3799 shift
3800 case "$1" in
3801 "$cpp")
3802 echo "Perhaps can we force $cc -E using a wrapper..."
3803 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3804 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3805 then
3806 echo "Yup, we can."
3807 cppstdin="$wrapper"
3808 cppminus='';
3809 else
3810 echo "Nope, we'll have to live without it..."
3811 fi
3812 ;;
3813 esac
3814 case "$cpprun" in
3815 "$wrapper")
3816 cpprun=''
3817 cpplast=''
3818 ;;
3819 esac
3820 ;;
3821esac
3822
3823case "$cppstdin" in
def887e8 3824"$wrapper"|'cppstdin') ;;
c4f23d77
AD
3825*) $rm -f $wrapper;;
3826esac
3827$rm -f testcpp.c testcpp.out
3828
2afac517 3829: Set private lib path
3830case "$plibpth" in
3831'') if ./mips; then
3832 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3833 fi;;
3834esac
3835case "$libpth" in
3836' ') dlist='';;
3837'') dlist="$loclibpth $plibpth $glibpth";;
3838*) dlist="$libpth";;
3839esac
8e07c86e 3840
2afac517 3841: Now check and see which directories actually exist, avoiding duplicates
3842libpth=''
3843for xxx in $dlist
3844do
3845 if $test -d $xxx; then
3846 case " $libpth " in
3847 *" $xxx "*) ;;
3848 *) libpth="$libpth $xxx";;
3849 esac
3850 fi
3851done
3852$cat <<'EOM'
8e07c86e 3853
2afac517 3854Some systems have incompatible or broken versions of libraries. Among
3855the directories listed in the question below, please remove any you
3856know not to be holding relevant libraries, and add any that are needed.
3857Say "none" for none.
8e07c86e 3858
8e07c86e 3859EOM
2afac517 3860case "$libpth" in
3861'') dflt='none';;
3862*)
3863 set X $libpth
3864 shift
3865 dflt=${1+"$@"}
4633a7c4 3866 ;;
8e07c86e 3867esac
2afac517 3868rp="Directories to use for library searches?"
3869. ./myread
3870case "$ans" in
3871none) libpth=' ';;
3872*) libpth="$ans";;
3873esac
8e07c86e 3874
2afac517 3875: compute shared library extension
3876case "$so" in
3877'')
3878 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3879 dflt='sl'
3880 else
3881 dflt='so'
3882 fi
3883 ;;
3884*) dflt="$so";;
8e07c86e 3885esac
2afac517 3886$cat <<EOM
8e07c86e 3887
2afac517 3888On some systems, shared libraries may be available. Answer 'none' if
3889you want to suppress searching of shared libraries for the remaining
3890of this configuration.
8e07c86e
AD
3891
3892EOM
2afac517 3893rp='What is the file extension used for shared libraries?'
3894. ./myread
3895so="$ans"
8e07c86e 3896
dfe9444c
AD
3897: Define several unixisms.
3898: Hints files or command line option can be used to override them.
3899: The convoluted testing is in case hints files set either the old
3900: or the new name.
3901case "$_exe" in
3902'') case "$exe_ext" in
3903 '') ;;
3904 *) _exe="$exe_ext" ;;
3905 esac
3906 ;;
3907esac
3908case "$_a" in
3909'') case "$lib_ext" in
3910 '') _a='.a';;
3911 *) _a="$lib_ext" ;;
3912 esac
3913 ;;
3914esac
3915case "$_o" in
3916'') case "$obj_ext" in
3917 '') _o='.o';;
3918 *) _o="$obj_ext";;
3919 esac
3920 ;;
3921esac
3922case "$p_" in
3923'') case "$path_sep" in
3924 '') p_=':';;
3925 *) p_="$path_sep";;
3926 esac
3927 ;;
3928esac
3929exe_ext=$_exe
3930lib_ext=$_a
3931obj_ext=$_o
3932path_sep=$p_
3933
3934: Which makefile gets called first. This is used by make depend.
3935case "$firstmakefile" in
3936'') firstmakefile='makefile';;
3937esac
3938
2afac517 3939: Looking for optional libraries
3940echo " "
3941echo "Checking for optional libraries..." >&4
3942case "$libs" in
3943' '|'') dflt='';;
3944*) dflt="$libs";;
8e07c86e 3945esac
2afac517 3946case "$libswanted" in
3947'') libswanted='c_s';;
3948esac
3949for thislib in $libswanted; do
3950
1cfa4ec7
GS
3951 if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`;
3952 $test -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
2afac517 3953 echo "Found -l$thislib (shared)."
3954 case " $dflt " in
3955 *"-l$thislib "*);;
3956 *) dflt="$dflt -l$thislib";;
4633a7c4 3957 esac
2afac517 3958 elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
3959 echo "Found -l$thislib (shared)."
3960 case " $dflt " in
3961 *"-l$thislib "*);;
3962 *) dflt="$dflt -l$thislib";;
3963 esac
dfe9444c 3964 elif xxx=`./loc lib$thislib$_a X $libpth`; $test -f "$xxx"; then
2afac517 3965 echo "Found -l$thislib."
3966 case " $dflt " in
3967 *"-l$thislib "*);;
3968 *) dflt="$dflt -l$thislib";;
3969 esac
dfe9444c 3970 elif xxx=`./loc $thislib$_a X $libpth`; $test -f "$xxx"; then
2afac517 3971 echo "Found -l$thislib."
3972 case " $dflt " in
3973 *"-l$thislib "*);;
3974 *) dflt="$dflt -l$thislib";;
3975 esac
dfe9444c 3976 elif xxx=`./loc lib${thislib}_s$_a X $libpth`; $test -f "$xxx"; then
2afac517 3977 echo "Found -l${thislib}_s."
3978 case " $dflt " in
3979 *"-l$thislib "*);;
3980 *) dflt="$dflt -l${thislib}_s";;
3981 esac
dfe9444c 3982 elif xxx=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$xxx"; then
2afac517 3983 echo "Found -l$thislib."
3984 case " $dflt " in
3985 *"-l$thislib "*);;
3986 *) dflt="$dflt -l$thislib";;
3987 esac
3988 else
3989 echo "No -l$thislib."
3990 fi
3991done
3992set X $dflt
3993shift
3994dflt="$*"
3995case "$libs" in
3996'') dflt="$dflt";;
3997*) dflt="$libs";;
3998esac
3999case "$dflt" in
4000' '|'') dflt='none';;
8e07c86e 4001esac
2afac517 4002
4633a7c4
LW
4003$cat <<EOM
4004
2afac517 4005Some versions of Unix support shared libraries, which make executables smaller
4006but make load time slightly longer.
8e07c86e 4007
2afac517 4008On some systems, mostly System V Release 3's, the shared library is included
4009by putting the option "-lc_s" as the last thing on the cc command line when
4010linking. Other systems use shared libraries by default. There may be other
4011libraries needed to compile $package on your machine as well. If your system
4012needs the "-lc_s" option, include it here. Include any other special libraries
4013here as well. Say "none" for none.
4633a7c4 4014EOM
2afac517 4015
4016echo " "
4017rp="Any additional libraries?"
8e07c86e 4018. ./myread
2afac517 4019case "$ans" in
4020none) libs=' ';;
4021*) libs="$ans";;
4022esac
8e07c86e 4023
2afac517 4024: determine optimize, if desired, or use for debug flag also
4025case "$optimize" in
2ae324a7 4026' '|$undef) dflt='none';;
2afac517 4027'') dflt='-O';;
4028*) dflt="$optimize";;
4633a7c4 4029esac
2afac517 4030$cat <<EOH
4633a7c4 4031
760ac839 4032Some C compilers have problems with their optimizers. By default, $package
4633a7c4
LW
4033compiles with the -O flag to use the optimizer. Alternately, you might want
4034to use the symbolic debugger, which uses the -g flag (on traditional Unix
4035systems). Either flag can be specified here. To use neither flag, specify
4036the word "none".
4037
4038EOH
4039rp="What optimizer/debugger flag should be used?"
4040. ./myread
4041optimize="$ans"
4042case "$optimize" in
4043'none') optimize=" ";;
4044esac
4045
4046dflt=''
25f94b33
AD
4047: We will not override a previous value, but we might want to
4048: augment a hint file
4049case "$hint" in
4050none|recommended)
4633a7c4
LW
4051 case "$gccversion" in
4052 1*) dflt='-fpcc-struct-return' ;;
4053 esac
4054 case "$optimize" in
4055 *-g*) dflt="$dflt -DDEBUGGING";;
4056 esac
4057 case "$gccversion" in
4058 2*) if test -d /etc/conf/kconfig.d &&
4059 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4060 then
4061 dflt="$dflt -posix"
4062 fi
4063 ;;
4064 esac
4065 ;;
4066esac
4067
a4f3eea9 4068case "$mips_type" in
4069*BSD*|'') inclwanted="$locincpth $usrinc";;
4070*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4071esac
4072for thisincl in $inclwanted; do
4073 if $test -d $thisincl; then
4074 if $test x$thisincl != x$usrinc; then
4075 case "$dflt" in
4076 *$thisincl*);;
4077 *) dflt="$dflt -I$thisincl";;
4078 esac
4079 fi
4080 fi
4081done
4082
4083inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4084 xxx=true;
4085elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4086 xxx=true;
4087else
4088 xxx=false;
4089fi;
4090if $xxx; then
4091 case "$dflt" in
4092 *$2*);;
4093 *) dflt="$dflt -D$2";;
4094 esac;
4095fi'
4096
ccc7f9b3 4097set signal.h LANGUAGE_C; eval $inctest
a4f3eea9 4098
4099case "$hint" in
4100none|recommended) dflt="$ccflags $dflt" ;;
4101*) dflt="$ccflags";;
4102esac
4103
4104case "$dflt" in
4105''|' ') dflt=none;;
4106esac
4107$cat <<EOH
4108
4109Your C compiler may want other flags. For this question you should include
4110-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4111but you should NOT include libraries or ld flags like -lwhatever. If you
4112want $package to honor its debug switch, you should include -DDEBUGGING here.
dfe9444c 4113Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
a4f3eea9 4114
4115To use no flags, specify the word "none".
4116
4117EOH
4118set X $dflt
4119shift
4120dflt=${1+"$@"}
4121rp="Any additional cc flags?"
4122. ./myread
4123case "$ans" in
4124none) ccflags='';;
4125*) ccflags="$ans";;
4126esac
4127
4128: the following weeds options from ccflags that are of no interest to cpp
4129cppflags="$ccflags"
4130case "$gccversion" in
41311*) cppflags="$cppflags -D__GNUC__"
4132esac
4133case "$mips_type" in
4134'');;
4135*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4136esac
4137case "$cppflags" in
4138'');;
4139*)
4140 echo " "
4141 echo "Let me guess what the preprocessor flags are..." >&4
4142 set X $cppflags
4143 shift
4144 cppflags=''
4145 $cat >cpp.c <<'EOM'
4146#define BLURFL foo
4147
4148BLURFL xx LFRULB
4149EOM
4150 previous=''
4151 for flag in $*
4152 do
4153 case "$flag" in
4154 -*) ftry="$flag";;
4155 *) ftry="$previous $flag";;
4156 esac
7bac28a0 4157 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
a4f3eea9 4158 >cpp1.out 2>/dev/null && \
dfe9444c 4159 $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
a4f3eea9 4160 >cpp2.out 2>/dev/null && \
4161 $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4162 $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4163 then
4164 cppflags="$cppflags $ftry"
4165 previous=''
4166 else
4167 previous="$flag"
4168 fi
4169 done
4170 set X $cppflags
4171 shift
4172 cppflags=${1+"$@"}
4173 case "$cppflags" in
4174 *-*) echo "They appear to be: $cppflags";;
4175 esac
4176 $rm -f cpp.c cpp?.out
4177 ;;
4178esac
4179
4180: flags used in final linking phase
a4f3eea9 4181case "$ldflags" in
4182'') if ./venix; then
4183 dflt='-i -z'
4184 else
4185 dflt=''
4186 fi
4187 case "$ccflags" in
4188 *-posix*) dflt="$dflt -posix" ;;
4189 esac
4190 ;;
4191*) dflt="$ldflags";;
4192esac
4193
4194: Try to guess additional flags to pick up local libraries.
4195for thislibdir in $libpth; do
4196 case " $loclibpth " in
4197 *" $thislibdir "*)
4198 case "$dflt " in
4199 *"-L$thislibdir "*) ;;
4200 *) dflt="$dflt -L$thislibdir" ;;
4201 esac
4202 ;;
4203 esac
4204done
4205
4206case "$dflt" in
4207'') dflt='none' ;;
4208esac
4209
4210$cat <<EOH
4211
4212Your C linker may need flags. For this question you should
4213include -L/whatever and any other flags used by the C linker, but you
4214should NOT include libraries like -lwhatever.
4215
4216Make sure you include the appropriate -L/path flags if your C linker
4217does not normally search all of the directories you specified above,
4218namely
4219 $libpth
4220To use no flags, specify the word "none".
4221
4222EOH
4223
4224rp="Any additional ld flags (NOT including libraries)?"
4225. ./myread
4226case "$ans" in
4227none) ldflags='';;
4228*) ldflags="$ans";;
4229esac
4230rmlist="$rmlist pdp11"
4231
4232: coherency check
4233echo " "
dfe9444c 4234echo "Checking your choice of C compiler and flags for coherency..." >&4
5ff3f7a4
GS
4235$cat > try.c <<'EOF'
4236#include <stdio.h>
732c9516 4237int main() { printf("Ok\n"); exit(0); }
5ff3f7a4 4238EOF
87563a30 4239set X $cc $optimize $ccflags -o try $ldflags try.c $libs
a4f3eea9 4240shift
5ff3f7a4
GS
4241$cat >try.msg <<'EOM'
4242I've tried to compile and run the following simple program:
4243
4244EOM
a83b1ac8 4245$cat try.c >> try.msg
5ff3f7a4
GS
4246
4247$cat >> try.msg <<EOM
4248
4249I used the command:
a4f3eea9 4250
4251 $*
4252 ./try
4253
4254and I got the following output:
4255
4256EOM
a4f3eea9 4257dflt=y
28e8609d 4258if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
a4f3eea9 4259 if sh -c './try' >>try.msg 2>&1; then
dfe9444c
AD
4260 xxx=`./try`
4261 case "$xxx" in
4262 "Ok") dflt=n ;;
4263 *) echo 'The program compiled OK, but produced no output.' >> try.msg
4264 case " $libs " in
4265 *" -lsfio "*)
4266 cat >> try.msg <<'EOQS'
4267If $libs contains -lsfio, and sfio is mis-configured, then it
4268sometimes (apparently) runs and exits with a 0 status, but with no
4269output! It may have to do with sfio's use of _exit vs. exit.
4270
4271EOQS
4272 rp="You have a big problem. Shall I abort Configure"
4273 dflt=y
4274 ;;
4275 esac
4276 ;;
4277 esac
a4f3eea9 4278 else
4279 echo "The program compiled OK, but exited with status $?." >>try.msg
dfe9444c 4280 rp="You have a problem. Shall I abort Configure"
a4f3eea9 4281 dflt=y
4282 fi
4283else
4284 echo "I can't compile the test program." >>try.msg
dfe9444c 4285 rp="You have a BIG problem. Shall I abort Configure"
a4f3eea9 4286 dflt=y
4287fi
4288case "$dflt" in
4289y)
97286747 4290 $cat try.msg >&4
a4f3eea9 4291 case "$knowitall" in
4292 '')
5ff3f7a4 4293 echo "(The supplied flags or libraries might be incorrect.)"
a4f3eea9 4294 ;;
4295 *) dflt=n;;
4296 esac
4297 echo " "
4298 . ./myread
4299 case "$ans" in
4300 n*|N*) ;;
4301 *) echo "Ok. Stopping Configure." >&4
4302 exit 1
4303 ;;
4304 esac
4305 ;;
4306n) echo "OK, that should do.";;
4307esac
4308$rm -f try try.* core
4309
bfb7748a
AD
4310: determine filename position in cpp output
4311echo " "
4312echo "Computing filename position in cpp output for #include directives..." >&4
4313echo '#include <stdio.h>' > foo.c
4314$cat >fieldn <<EOF
4315$startsh
4316$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4317$grep '^[ ]*#.*stdio\.h' | \
4318while read cline; do
4319 pos=1
4320 set \$cline
4321 while $test \$# -gt 0; do
4322 if $test -r \`echo \$1 | $tr -d '"'\`; then
4323 echo "\$pos"
4324 exit 0
4325 fi
4326 shift
4327 pos=\`expr \$pos + 1\`
4328 done
4329done
4330EOF
4331chmod +x fieldn
4332fieldn=`./fieldn`
4333$rm -f foo.c fieldn
4334case $fieldn in
4335'') pos='???';;
43361) pos=first;;
43372) pos=second;;
43383) pos=third;;
4339*) pos="${fieldn}th";;
4340esac
4341echo "Your cpp writes the filename in the $pos field of the line."
4342
4343: locate header file
4344$cat >findhdr <<EOF
4345$startsh
4346wanted=\$1
9cc6feab 4347name=''
3656fc86
JH
4348for usrincdir in $usrinc
4349do
4350 if test -f \$usrincdir/\$wanted; then
4351 echo "\$usrincdir/\$wanted"
4352 exit 0
4353 fi
4354done
bfb7748a
AD
4355awkprg='{ print \$$fieldn }'
4356echo "#include <\$wanted>" > foo\$\$.c
4357$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4358$grep "^[ ]*#.*\$wanted" | \
4359while read cline; do
4360 name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4361 case "\$name" in
3656fc86 4362 *[/\\\\]\$wanted) echo "\$name"; exit 0;;
bfb7748a
AD
4363 *) name='';;
4364 esac;
4365done;
4366$rm -f foo\$\$.c;
4367case "\$name" in
4368'') exit 1;;
4369esac
4370EOF
4371chmod +x findhdr
4372
4373: define an alternate in-header-list? function
4374inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4375cont=true; xxf="echo \"<\$1> found.\" >&4";
4376case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4377*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4378esac;
4379case $# in 4) instead=instead;; *) instead="at last";; esac;
4380while $test "$cont"; do
4381 xxx=`./findhdr $1`
4382 var=$2; eval "was=\$$2";
4383 if $test "$xxx" && $test -r "$xxx";
4384 then eval $xxf;
4385 eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4386 cont="";
4387 else eval $xxnf;
4388 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4389 set $yyy; shift; shift; yyy=$@;
4390 case $# in 0) cont="";;
4391 2) xxf="echo \"but I found <\$1> $instead.\" >&4";
4392 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
4393 *) xxf="echo \"but I found <\$1\> instead.\" >&4";
4394 xxnf="echo \"there is no <\$1>, ...\" >&4";;
4395 esac;
4396done;
4397while $test "$yyy";
4398do set $yyy; var=$2; eval "was=\$$2";
4399 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
4400 set $yyy; shift; shift; yyy=$@;
4401done'
4402
4403: see if this is a malloc.h system
4404set malloc.h i_malloc
4405eval $inhdr
4406
4407: see if stdlib is available
4408set stdlib.h i_stdlib
4409eval $inhdr
4410
4411: determine which malloc to compile in
4412echo " "
4413case "$usemymalloc" in
5ff3f7a4
GS
4414''|[yY]*|true|$define) dflt='y' ;;
4415*) dflt='n' ;;
bfb7748a
AD
4416esac
4417rp="Do you wish to attempt to use the malloc that comes with $package?"
4418. ./myread
4419usemymalloc="$ans"
4420case "$ans" in
4421y*|true)
4422 usemymalloc='y'
4423 mallocsrc='malloc.c'
4424 mallocobj="malloc$_o"
4425 d_mymalloc="$define"
4426 case "$libs" in
4427 *-lmalloc*)
4428 : Remove malloc from list of libraries to use
4429 echo "Removing unneeded -lmalloc from library list" >&4
4430 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
4431 shift
4432 libs="$*"
4433 echo "libs = $libs" >&4
4434 ;;
4435 esac
4436 ;;
4437*)
4438 usemymalloc='n'
4439 mallocsrc=''
4440 mallocobj=''
4441 d_mymalloc="$undef"
4442 ;;
4443esac
4444
4445: compute the return types of malloc and free
4446echo " "
4447$cat >malloc.c <<END
4448#$i_malloc I_MALLOC
4449#$i_stdlib I_STDLIB
4450#include <stdio.h>
4451#include <sys/types.h>
4452#ifdef I_MALLOC
4453#include <malloc.h>
4454#endif
4455#ifdef I_STDLIB
4456#include <stdlib.h>
4457#endif
4458#ifdef TRY_MALLOC
4459void *malloc();
4460#endif
4461#ifdef TRY_FREE
4462void free();
4463#endif
4464END
4465case "$malloctype" in
4466'')
4467 if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
4468 malloctype='void *'
4469 else
4470 malloctype='char *'
4471 fi
4472 ;;
4473esac
4474echo "Your system wants malloc to return '$malloctype', it would seem." >&4
4475
4476case "$freetype" in
4477'')
4478 if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
4479 freetype='void'
4480 else
4481 freetype='int'
4482 fi
4483 ;;
4484esac
4485echo "Your system uses $freetype free(), it would seem." >&4
4486$rm -f malloc.[co]
c4f23d77
AD
4487: Cruising for prototypes
4488echo " "
4489echo "Checking out function prototypes..." >&4
4490$cat >prototype.c <<'EOCP'
5a411a32 4491int main(int argc, char *argv[]) {
c4f23d77
AD
4492 exit(0);}
4493EOCP
4494if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
4495 echo "Your C compiler appears to support function prototypes."
4496 val="$define"
4497else
4498 echo "Your C compiler doesn't seem to understand function prototypes."
4499 val="$undef"
4500fi
4501set prototype
4502eval $setvar
4503$rm -f prototype*
4504
4505case "$prototype" in
4506"$define") ;;
4507*) ansi2knr='ansi2knr'
4508 echo " "
4509 cat <<EOM >&4
4510
4511$me: FATAL ERROR:
4512This version of $package can only be compiled by a compiler that
4513understands function prototypes. Unfortunately, your C compiler
4514 $cc $ccflags
4515doesn't seem to understand them. Sorry about that.
4516
5ff3f7a4 4517If GNU cc is available for your system, perhaps you could try that instead.
c4f23d77
AD
4518
4519Eventually, we hope to support building Perl with pre-ANSI compilers.
4520If you would like to help in that effort, please contact <perlbug@perl.org>.
4521
4522Aborting Configure now.
4523EOM
4524 exit 2
4525 ;;
4526esac
4527
4528: determine where public executables go
4529echo " "
4530set dflt bin bin
4531eval $prefixit
4532fn=d~
4533rp='Pathname where the public executables will reside?'
4534. ./getfile
4535if $test "X$ansexp" != "X$binexp"; then
4536 installbin=''
4537fi
4538bin="$ans"
4539binexp="$ansexp"
4540if $afs; then
4541 $cat <<EOM
4542
4543Since you are running AFS, I need to distinguish the directory in which
4544executables reside from the directory in which they are installed (and from
4545which they are presumably copied to the former directory by occult means).
4546
4547EOM
4548 case "$installbin" in
4549 '') dflt=`echo $binexp | sed 's#^/afs/#/afs/.#'`;;
4550 *) dflt="$installbin";;
4551 esac
4552 fn=de~
4553 rp='Where will public executables be installed?'
4554 . ./getfile
4555 installbin="$ans"
4556else
4557 installbin="$binexp"
4558fi
4559
104d25b7
JH
4560: determine whether to install perl also as /usr/bin/perl
4561
4562echo " "
472a4973 4563if test -d /usr/bin -a "X$installbin" != X/usr/bin; then
104d25b7
JH
4564 $cat <<EOM
4565Many scripts expect to perl to be installed as /usr/bin/perl.
4566I can install the perl you are about to compile also as /usr/bin/perl
4567(in addition to $installbin/perl).
4568EOM
472a4973
JH
4569 case "$installusrbinperl" in
4570 "$undef"|[nN]*) dflt='n';;
4571 *) dflt='y';;
4572 esac
104d25b7
JH
4573 rp="Do you want to install perl as /usr/bin/perl?"
4574 . ./myread
4575 case "$ans" in
4576 [yY]*) val="$define";;
472a4973 4577 *) val="$undef" ;;
104d25b7 4578 esac
472a4973
JH
4579else
4580 val="$undef"
4581fi
104d25b7
JH
4582set installusrbinperl
4583eval $setvar
4584
dfe9444c
AD
4585: define a shorthand compile call
4586compile='
4587mc_file=$1;
4588shift;
c4f23d77 4589$cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
dc45a647
MB
4590: define a shorthand compile call for compilations that should be ok.
4591compile_ok='
4592mc_file=$1;
4593shift;
c4f23d77 4594$cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
dfe9444c 4595
a4f3eea9 4596echo " "
4597echo "Checking for GNU C Library..." >&4
4598cat >gnulibc.c <<EOM
aebf16e7 4599#include <stdio.h>
5a411a32 4600int main()
a4f3eea9 4601{
aebf16e7
AD
4602#ifdef __GLIBC__
4603 exit(0);
4604#else
4605 exit(1);
4606#endif
a4f3eea9 4607}
4608EOM
dfe9444c 4609set gnulibc
aebf16e7 4610if eval $compile_ok && ./gnulibc; then
a4f3eea9 4611 val="$define"
4612 echo "You are using the GNU C Library"
4633a7c4 4613else
a4f3eea9 4614 val="$undef"
4615 echo "You are not using the GNU C Library"
4633a7c4 4616fi
a4f3eea9 4617$rm -f gnulibc*
4618set d_gnulibc
4619eval $setvar
25f94b33 4620
a4f3eea9 4621: see if nm is to be used to determine whether a symbol is defined or not
4622case "$usenm" in
4623'')
dc45a647 4624 dflt=''
a4f3eea9 4625 case "$d_gnulibc" in
dc45a647
MB
4626 "$define")
4627 echo " "
4628 echo "nm probably won't work on the GNU C Library." >&4
a4f3eea9 4629 dflt=n
4630 ;;
dc45a647
MB
4631 esac
4632 case "$dflt" in
4633 '')
4634 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
4635 echo " "
4636 echo "Whoops! This is an AIX system without /lib/syscalls.exp!" >&4
4637 echo "'nm' won't be sufficient on this sytem." >&4
4638 dflt=n
4639 fi
4640 ;;
4641 esac
4642 case "$dflt" in
c4f23d77 4643 '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
a4f3eea9 4644 if $test $dflt -gt 20; then
4645 dflt=y
4646 else
4647 dflt=n
4648 fi
4649 ;;
4650 esac
4651 ;;
4652*)
4653 case "$usenm" in
dc45a647 4654 true|$define) dflt=y;;
a4f3eea9 4655 *) dflt=n;;
4656 esac
4657 ;;
25f94b33 4658esac
a4f3eea9 4659$cat <<EOM
4633a7c4 4660
dc45a647
MB
4661I can use $nm to extract the symbols from your C libraries. This
4662is a time consuming task which may generate huge output on the disk (up
4663to 3 megabytes) but that should make the symbols extraction faster. The
4664alternative is to skip the 'nm' extraction part and to compile a small
4665test program instead to determine whether each symbol is present. If
4666you have a fast C compiler and/or if your 'nm' output cannot be parsed,
4667this may be the best solution.
4668
4669You probably shouldn't let me use 'nm' if you are using the GNU C Library.
4633a7c4 4670
a4f3eea9 4671EOM
693762b4 4672rp="Shall I use $nm to extract C symbols from the libraries?"
4633a7c4
LW
4673. ./myread
4674case "$ans" in
dc45a647 4675[Nn]*) usenm=false;;
a4f3eea9 4676*) usenm=true;;
4633a7c4
LW
4677esac
4678
a4f3eea9 4679runnm=$usenm
4680case "$reuseval" in
4681true) runnm=false;;
4633a7c4 4682esac
a4f3eea9 4683
4684: nm options which may be necessary
4685case "$nm_opt" in
4686'') if $test -f /mach_boot; then
1e422769 4687 nm_opt='' # Mach
a4f3eea9 4688 elif $test -d /usr/ccs/lib; then
1e422769 4689 nm_opt='-p' # Solaris (and SunOS?)
a4f3eea9 4690 elif $test -f /dgux; then
1e422769 4691 nm_opt='-p' # DG-UX
2ae324a7 4692 elif $test -f /lib64/rld; then
1e422769 4693 nm_opt='-p' # 64-bit Irix
a4f3eea9 4694 else
4695 nm_opt=''
4696 fi;;
4633a7c4 4697esac
4633a7c4 4698
a4f3eea9 4699: nm options which may be necessary for shared libraries but illegal
4700: for archive libraries. Thank you, Linux.
4701case "$nm_so_opt" in
4702'') case "$myuname" in
4703 *linux*)
693762b4 4704 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
a4f3eea9 4705 nm_so_opt='--dynamic'
4633a7c4 4706 fi
a4f3eea9 4707 ;;
4633a7c4 4708 esac
4633a7c4
LW
4709 ;;
4710esac
4711
a4f3eea9 4712case "$runnm" in
4713true)
4714: get list of predefined functions in a handy place
4715echo " "
4716case "$libc" in
4717'') libc=unknown
4718 case "$libs" in
dfe9444c 4719 *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
a4f3eea9 4720 esac
4721 ;;
4722esac
4723libnames='';
4724case "$libs" in
4725'') ;;
4726*) for thislib in $libs; do
4727 case "$thislib" in
4728 -lc|-lc_s)
4729 : Handle C library specially below.
4730 ;;
4731 -l*)
4732 thislib=`echo $thislib | $sed -e 's/^-l//'`
4733 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
4734 :
4735 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
4736 :
dfe9444c 4737 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
a4f3eea9 4738 :
dfe9444c 4739 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
d97d40b5 4740 :
a4f3eea9 4741 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
4742 :
4743 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
4744 :
dfe9444c 4745 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
a4f3eea9 4746 :
4747 else
4748 try=''
4749 fi
4750 libnames="$libnames $try"
4751 ;;
4752 *) libnames="$libnames $thislib" ;;
4753 esac
4754 done
4755 ;;
4756esac
4757xxx=normal
4758case "$libc" in
4759unknown)
4760 set /lib/libc.$so
4761 for xxx in $libpth; do
4762 $test -r $1 || set $xxx/libc.$so
4763 : The messy sed command sorts on library version numbers.
4764 $test -r $1 || \
4765 set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
28e8609d 4766 tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
a4f3eea9 4767 h
4768 s/[0-9][0-9]*/0000&/g
4769 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
4770 G
4771 s/\n/ /' | \
dfe9444c 4772 sort | $sed -e 's/^.* //'`
a4f3eea9 4773 eval set \$$#
4774 done
4775 $test -r $1 || set /usr/ccs/lib/libc.$so
dfe9444c
AD
4776 $test -r $1 || set /lib/libsys_s$_a
4777 ;;
a4f3eea9 4778*)
4779 set blurfl
4780 ;;
4781esac
4782if $test -r "$1"; then
4783 echo "Your (shared) C library seems to be in $1."
4784 libc="$1"
4785elif $test -r /lib/libc && $test -r /lib/clib; then
4786 echo "Your C library seems to be in both /lib/clib and /lib/libc."
4787 xxx=apollo
4788 libc='/lib/clib /lib/libc'
4789 if $test -r /lib/syslib; then
4790 echo "(Your math library is in /lib/syslib.)"
4791 libc="$libc /lib/syslib"
4792 fi
4793elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4794 echo "Your C library seems to be in $libc, as you said before."
dfe9444c
AD
4795elif $test -r $incpath/usr/lib/libc$_a; then
4796 libc=$incpath/usr/lib/libc$_a;
a4f3eea9 4797 echo "Your C library seems to be in $libc. That's fine."
dfe9444c
AD
4798elif $test -r /lib/libc$_a; then
4799 libc=/lib/libc$_a;
a4f3eea9 4800 echo "Your C library seems to be in $libc. You're normal."
4801else
dfe9444c 4802 if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
a4f3eea9 4803 :
4804 elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
4805 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
4806 elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
4807 :
dfe9444c 4808 elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
a4f3eea9 4809 :
dfe9444c 4810 elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
a4f3eea9 4811 :
4633a7c4 4812 else
dfe9444c 4813 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
4633a7c4 4814 fi
a4f3eea9 4815 if $test -r "$tans"; then
4816 echo "Your C library seems to be in $tans, of all places."
4817 libc=$tans
4818 else
4819 libc='blurfl'
4820 fi
4821fi
4822if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4823 dflt="$libc"
4824 cat <<EOM
4633a7c4 4825
a4f3eea9 4826If the guess above is wrong (which it might be if you're using a strange
4827compiler, or your machine supports multiple models), you can override it here.
4633a7c4 4828
a4f3eea9 4829EOM
4830else
4831 dflt=''
28e8609d 4832 echo $libpth | tr ' ' $trnl | sort | uniq > libpath
a4f3eea9 4833 cat >&4 <<EOM
4834I can't seem to find your C library. I've looked in the following places:
4633a7c4 4835
a4f3eea9 4836EOM
4837 $sed 's/^/ /' libpath
4838 cat <<EOM
4633a7c4 4839
a4f3eea9 4840None of these seems to contain your C library. I need to get its name...
4633a7c4 4841
a4f3eea9 4842EOM
4843fi
4844fn=f
4845rp='Where is your C library?'
4846. ./getfile
4847libc="$ans"
4633a7c4 4848
4633a7c4 4849echo " "
28e8609d 4850echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
a4f3eea9 4851set X `cat libnames`
4633a7c4 4852shift
a4f3eea9 4853xxx=files
4854case $# in 1) xxx=file; esac
4855echo "Extracting names from the following $xxx for later perusal:" >&4
4856echo " "
4857$sed 's/^/ /' libnames >&4
4858echo " "
4859$echo $n "This may take a while...$c" >&4
4633a7c4 4860
dfe9444c
AD
4861for file in $*; do
4862 case $file in
693762b4
AD
4863 *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
4864 *) $nm $nm_opt $file 2>/dev/null;;
a4f3eea9 4865 esac
dfe9444c 4866done >libc.tmp
4633a7c4 4867
a4f3eea9 4868$echo $n ".$c"
4869$grep fprintf libc.tmp > libc.ptf
4870xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
4871xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
4872xxx='[ADTSIW]'
4873if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *_[_.]*//p' -e 's/^.* $xxx *//p'";\
4874 eval $xscan;\
4875 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4876 eval $xrun
4877elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
4878 eval $xscan;\
4879 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4880 eval $xrun
4881elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
4882 eval $xscan;\
4883 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4884 eval $xrun
4885elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
4886 eval $xscan;\
4887 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4888 eval $xrun
4889elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
4890 eval $xscan;\
4891 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4892 eval $xrun
4893elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
4894 eval $xscan;\
4895 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4896 eval $xrun
4897elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
4898 -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
4899 eval $xscan;\
4900 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4901 eval $xrun
4902elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
4903 eval $xscan;\
4904 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4905 eval $xrun
4906elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
4907 eval $xscan;\
4908 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4909 eval $xrun
1e422769 4910elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
4911 eval $xscan;\
4912 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4913 eval $xrun
a4f3eea9 4914elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
4915 eval $xscan;\
4916 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4917 eval $xrun
4918elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
4919 eval $xscan;\
4920 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4921 eval $xrun
44a8e56a 4922elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
4923 eval $xscan;\
4924 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4925 eval $xrun
0f502cca
BL
4926elif com="sed -n -e 's/^__.*//' -e 's/[ ]*D[ ]*[0-9]*.*//p'";\
4927 eval $xscan;\
4928 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4929 eval $xrun
a4f3eea9 4930else
693762b4 4931 $nm -p $* 2>/dev/null >libc.tmp
a4f3eea9 4932 $grep fprintf libc.tmp > libc.ptf
4933 if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
4934 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
4935 then
4936 nm_opt='-p'
4937 eval $xrun
4633a7c4 4938 else
a4f3eea9 4939 echo " "
e5c9fcd0 4940 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
a4f3eea9 4941 com=''
dc45a647
MB
4942 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
4943 for thisname in $libnames $libc; do
e5c9fcd0 4944 $ar t $thisname >>libc.tmp
a4f3eea9 4945 done
dfe9444c 4946 $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
a4f3eea9 4947 echo "Ok." >&4
dc45a647
MB
4948 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
4949 # Repeat libc to extract forwarders to DLL entries too
4950 for thisname in $libnames $libc; do
4951 $ar tv $thisname >>libc.tmp
4952 # Revision 50 of EMX has bug in $ar.
4953 # it will not extract forwarders to DLL entries
4954 # Use emximp which will extract exactly them.
4955 emximp -o tmp.imp $thisname \
4956 2>/dev/null && \
4957 $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
4958 < tmp.imp >>libc.tmp
4959 $rm tmp.imp
4960 done
4961 $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
4962 echo "Ok." >&4
a4f3eea9 4963 else
e5c9fcd0 4964 echo "$ar didn't seem to work right." >&4
a4f3eea9 4965 echo "Maybe this is a Cray...trying bld instead..." >&4
dfe9444c 4966 if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
a4f3eea9 4967 then
4968 for thisname in $libnames; do
4969 bld t $libnames | \
dfe9444c 4970 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
e5c9fcd0 4971 $ar t $thisname >>libc.tmp
a4f3eea9 4972 done
4973 echo "Ok." >&4
4974 else
4975 echo "That didn't work either. Giving up." >&4
4976 exit 1
4977 fi
4978 fi
4633a7c4 4979 fi
4633a7c4 4980fi
a4f3eea9 4981nm_extract="$com"
4982if $test -f /lib/syscalls.exp; then
4633a7c4 4983 echo " "
a4f3eea9 4984 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
c6912327 4985 $sed -n 's/^\([^ ]*\)[ ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
a4f3eea9 4986fi
4987;;
4988esac
4989$rm -f libnames libpath
4990
2afac517 4991: see if dld is available
4992set dld.h i_dld
4993eval $inhdr
4633a7c4 4994
2afac517 4995: is a C symbol defined?
4996csym='tlook=$1;
4997case "$3" in
4998-v) tf=libc.tmp; tc=""; tdc="";;
4999-a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5000*) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5001esac;
5002tx=yes;
5003case "$reuseval-$4" in
5004true-) ;;
5005true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5006esac;
5007case "$tx" in
5008yes)
5009 case "$runnm" in
5010 true)
5011 if $contains $tlook $tf >/dev/null 2>&1;
5012 then tval=true;
5013 else tval=false;
5014 fi;;
5015 *)
d674cd6d 5016 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
dfe9444c 5017 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
2afac517 5018 then tval=true;
5019 else tval=false;
5020 fi;
5021 $rm -f t t.c;;
5022 esac;;
5023*)
5024 case "$tval" in
5025 $define) tval=true;;
5026 *) tval=false;;
5027 esac;;
5028esac;
5029eval "$2=$tval"'
4633a7c4 5030
2afac517 5031: define an is-in-libc? function
5032inlibc='echo " "; td=$define; tu=$undef;
5033sym=$1; var=$2; eval "was=\$$2";
5034tx=yes;
5035case "$reuseval$was" in
5036true) ;;
5037true*) tx=no;;
5038esac;
5039case "$tx" in
5040yes)
5041 set $sym tres -f;
5042 eval $csym;
5043 case "$tres" in
5044 true)
5045 echo "$sym() found." >&4;
5046 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5047 *)
5048 echo "$sym() NOT found." >&4;
5049 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5050 esac;;
5051*)
5052 case "$was" in
5053 $define) echo "$sym() found." >&4;;
5054 *) echo "$sym() NOT found." >&4;;
5055 esac;;
5056esac'
4633a7c4 5057
2afac517 5058: see if dlopen exists
5059xxx_runnm="$runnm"
5060runnm=false
5061set dlopen d_dlopen
5062eval $inlibc
5063runnm="$xxx_runnm"
40a7a20a 5064
2afac517 5065: determine which dynamic loading, if any, to compile in
4633a7c4 5066echo " "
2afac517 5067dldir="ext/DynaLoader"
5068case "$usedl" in
5069$define|y|true)
5070 dflt='y'
5071 usedl="$define"
5072 ;;
5073$undef|n|false)
5074 dflt='n'
5075 usedl="$undef"
5076 ;;
5077*)
5078 dflt='n'
5079 case "$d_dlopen" in
5080 $define) dflt='y' ;;
5081 esac
5082 case "$i_dld" in
5083 $define) dflt='y' ;;
4633a7c4 5084 esac
2afac517 5085 : Does a dl_xxx.xs file exist for this operating system
dc45a647 5086 $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
4633a7c4
LW
5087 ;;
5088esac
2afac517 5089rp="Do you wish to use dynamic loading?"
5090. ./myread
5091usedl="$ans"
5092case "$ans" in
5093y*) usedl="$define"
5094 case "$dlsrc" in
5095 '')
dc45a647 5096 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
2afac517 5097 dflt="$dldir/dl_${osname}.xs"
5098 elif $test "$d_dlopen" = "$define" ; then
5099 dflt="$dldir/dl_dlopen.xs"
5100 elif $test "$i_dld" = "$define" ; then
5101 dflt="$dldir/dl_dld.xs"
4633a7c4 5102 else
2afac517 5103 dflt=''
4633a7c4 5104 fi
4633a7c4 5105 ;;
2afac517 5106 *) dflt="$dldir/$dlsrc"
5107 ;;
4633a7c4 5108 esac
2afac517 5109 echo "The following dynamic loading files are available:"
5110 : Can not go over to $dldir because getfile has path hard-coded in.
dc45a647
MB
5111 tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
5112 rp="Source file to use for dynamic loading"
5113 fn="fne"
5114 # XXX This getfile call will fail the existence check if you try
5115 # building away from $src (this is not supported yet).
5116 . ./getfile
2afac517 5117 usedl="$define"
5118 : emulate basename
5119 dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'`
2304df62 5120
dc45a647 5121 $cat << EOM
2304df62 5122
2afac517 5123Some systems may require passing special flags to $cc -c to
5124compile modules that will be used to create a shared library.
5125To use no flags, say "none".
2304df62
AD
5126
5127EOM
2afac517 5128 case "$cccdlflags" in
5129 '') case "$gccversion" in
5130 '') case "$osname" in
5131 hpux) dflt='+z' ;;
5132 next) dflt='none' ;;
8cc95fdb 5133 irix*) dflt='-KPIC' ;;
3a6175e1 5134 svr4*|esix*|solaris) dflt='-KPIC' ;;
2afac517 5135 sunos) dflt='-pic' ;;
5136 *) dflt='none' ;;
dfe9444c
AD
5137 esac
5138 ;;
5139 *) case "$osname" in
3a6175e1 5140 svr4*|esix*|solaris) dflt='-fPIC' ;;
dfe9444c 5141 *) dflt='-fpic' ;;
81d89818 5142 esac ;;
2afac517 5143 esac ;;
bfb7748a 5144 ' ') dflt='none' ;;
2afac517 5145 *) dflt="$cccdlflags" ;;
5146 esac
5147 rp="Any special flags to pass to $cc -c to compile shared library modules?"
5148 . ./myread
5149 case "$ans" in
5150 none) cccdlflags=' ' ;;
5151 *) cccdlflags="$ans" ;;
5152 esac
2304df62 5153
2afac517 5154 cat << EOM
ecfc5424 5155
2afac517 5156Some systems use ld to create libraries that can be dynamically loaded,
5157while other systems (such as those using ELF) use $cc.
a0f45b59 5158
2afac517 5159EOM
5160 case "$ld" in
5161 '') $cat >try.c <<'EOM'
5162/* Test for whether ELF binaries are produced */
5163#include <fcntl.h>
5164#include <stdlib.h>
5a411a32 5165int main() {
2afac517 5166 char b[4];
5167 int i = open("a.out",O_RDONLY);
5168 if(i == -1)
5169 exit(1); /* fail */
5170 if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
5171 exit(0); /* succeed (yes, it's ELF) */
2304df62 5172 else
2afac517 5173 exit(1); /* fail */
5174}
5175EOM
5176 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
5177 cat <<EOM
5178You appear to have ELF support. I'll use $cc to build dynamic libraries.
5179EOM
5180 dflt="$cc"
2304df62 5181 else
2afac517 5182 echo "I'll use ld to build dynamic libraries."
5183 dflt='ld'
2304df62 5184 fi
2afac517 5185 rm -f try.c a.out
5186 ;;
5187 *) dflt="$ld"
5188 ;;
5189 esac
5190
5191 rp="What command should be used to create dynamic libraries?"
5192 . ./myread
5193 ld="$ans"
5194
5195 cat << EOM
5196
5197Some systems may require passing special flags to $ld to create a
5198library that can be dynamically loaded. If your ld flags include
5199-L/other/path options to locate libraries outside your loader's normal
5200search path, you may need to specify those -L options here as well. To
5201use no flags, say "none".
5202
5203EOM
5204 case "$lddlflags" in
5205 '') case "$osname" in
46193409 5206 beos) dflt='-nostart' ;;
2afac517 5207 hpux) dflt='-b' ;;
5208 linux|irix*) dflt='-shared' ;;
5209 next) dflt='none' ;;
5210 solaris) dflt='-G' ;;
5211 sunos) dflt='-assert nodefinitions' ;;
5212 svr4*|esix*) dflt="-G $ldflags" ;;
5213 *) dflt='none' ;;
5214 esac
5215 ;;
5216 *) dflt="$lddlflags" ;;
5217 esac
5218
bfb7748a 5219 : Try to guess additional flags to pick up local libraries.
a0915cb7
AD
5220 : Be careful not to append to a plain 'none'
5221 case "$dflt" in
5222 none) dflt='' ;;
5223 esac
bfb7748a
AD
5224 for thisflag in $ldflags; do
5225 case "$thisflag" in
5226 -L*)
5227 case " $dflt " in
5228 *" $thisflag "*) ;;
5229 *) dflt="$dflt $thisflag" ;;
5230 esac
5231 ;;
2afac517 5232 esac
bfb7748a 5233 done
2afac517 5234
bfb7748a
AD
5235 case "$dflt" in
5236 ''|' ') dflt='none' ;;
5237 esac
2afac517 5238
5239 rp="Any special flags to pass to $ld to create a dynamically loaded library?"
5240 . ./myread
5241 case "$ans" in
5242 none) lddlflags=' ' ;;
5243 *) lddlflags="$ans" ;;
5244 esac
5245
5246 cat <<EOM
5247
5248Some systems may require passing special flags to $cc to indicate that
5249the resulting executable will use dynamic linking. To use no flags,
5250say "none".
5251
5252EOM
5253 case "$ccdlflags" in
5254 '') case "$osname" in
5255 hpux) dflt='-Wl,-E' ;;
5256 linux) dflt='-rdynamic' ;;
5257 next) dflt='none' ;;
5258 sunos) dflt='none' ;;
5259 *) dflt='none' ;;
5260 esac ;;
bfb7748a 5261 ' ') dflt='none' ;;
2afac517 5262 *) dflt="$ccdlflags" ;;
5263 esac
5264 rp="Any special flags to pass to $cc to use dynamic loading?"
5265 . ./myread
5266 case "$ans" in
5267 none) ccdlflags=' ' ;;
5268 *) ccdlflags="$ans" ;;
5269 esac
5270 ;;
5271*) usedl="$undef"
5272 ld='ld'
5273 dlsrc='dl_none.xs'
5274 lddlflags=''
5275 ccdlflags=''
5276 ;;
5277esac
5278
5279also=''
5280case "$usedl" in
5281$undef)
5282 # No dynamic loading being used, so don't bother even to prompt.
5283 useshrplib='false'
5284 ;;
5285*) case "$useshrplib" in
5286 '') case "$osname" in
46193409 5287 svr4*|dgux|dynixptx|esix|powerux|beos)
3e3baf6d 5288 dflt=y
2afac517 5289 also='Building a shared libperl is required for dynamic loading to work on your system.'
5290 ;;
5291 next*)
5292 case "$osvers" in
3e3baf6d 5293 4*) dflt=y
2afac517 5294 also='Building a shared libperl is needed for MAB support.'
5295 ;;
3e3baf6d 5296 *) dflt=n
2afac517 5297 ;;
5298 esac
5299 ;;
3e3baf6d 5300 *) dflt=n
2afac517 5301 ;;
5302 esac
5303 ;;
5304 $define|true|[Yy]*)
3e3baf6d 5305 dflt=y
2afac517 5306 ;;
3e3baf6d 5307 *) dflt=n
2afac517 5308 ;;
5309 esac
5310 $cat << EOM
5311
5312The perl executable is normally obtained by linking perlmain.c with
dfe9444c 5313libperl${_a}, any static extensions (usually just DynaLoader), and
2afac517 5314any other libraries needed on this system (such as -lm, etc.). Since
5315your system supports dynamic loading, it is probably possible to build
5316a shared libperl.$so. If you will have more than one executable linked
5317to libperl.$so, this will significantly reduce the size of each
5318executable, but it may have a noticeable affect on performance. The
5319default is probably sensible for your system.
5320$also
5321
5322EOM
5323 rp="Build a shared libperl.$so (y/n)"
5324 . ./myread
5325 case "$ans" in
5326 true|$define|[Yy]*)
5327 useshrplib='true'
5328 # Why does next4 have to be so different?
5329 case "${osname}${osvers}" in
8f1f23e8
W
5330 next4*|rhapsody*)
5331 xxx='DYLD_LIBRARY_PATH' ;;
dc45a647 5332 os2*) xxx='' ;; # Nothing special needed.
46193409 5333 beos*) xxx='' ;;
2afac517 5334 *) xxx='LD_LIBRARY_PATH' ;;
5335 esac
2afac517 5336 ;;
5337 *) useshrplib='false' ;;
5338 esac
5339 ;;
5340esac
5341
5342case "$useshrplib" in
5343true)
5344 case "$libperl" in
5345 '')
5346 # Figure out a good name for libperl.so. Since it gets stored in
5347 # a version-specific architecture-dependent library, the version
5348 # number isn't really that important, except for making cc/ld happy.
5349 #
5350 # A name such as libperl.so.3.1
5351 majmin="libperl.$so.$patchlevel.$subversion"
5352 # A name such as libperl.so.301
5353 majonly=`echo $patchlevel $subversion |
5354 $awk '{printf "%d%02d", $1, $2}'`
5355 majonly=libperl.$so.$majonly
5356 # I'd prefer to keep the os-specific stuff here to a minimum, and
5357 # rely on figuring it out from the naming of libc.
5358 case "${osname}${osvers}" in
5359 next4*)
5360 dflt=libperl.5.$so
5361 # XXX How handle the --version stuff for MAB?
5362 ;;
5363 linux*) # ld won't link with a bare -lperl otherwise.
5364 dflt=libperl.$so
5365 ;;
5366 *) # Try to guess based on whether libc has major.minor.
5367 case "$libc" in
5368 *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
5369 *libc.$so.[0-9]*) dflt=$majonly ;;
5370 *) dflt=libperl.$so ;;
5371 esac
5372 ;;
5373 esac
5374 ;;
5375 *) dflt=$libperl
5376 ;;
5377 esac
5378 cat << EOM
5379
5380I need to select a good name for the shared libperl. If your system uses
5381library names with major and minor numbers, then you might want something
5382like $majmin. Alternatively, if your system uses a single version
5383number for shared libraries, then you might want to use $majonly.
5384Or, your system might be quite happy with a simple libperl.$so.
5385
5386Since the shared libperl will get installed into a version-specific
5387architecture-dependent directory, the version number of the shared perl
5388library probably isn't important, so the default should be o.k.
5389
5390EOM
5391 rp='What name do you want to give to the shared libperl?'
5392 . ./myread
5393 libperl=$ans
5394 echo "Ok, I'll use $libperl"
5395 ;;
5396*)
dfe9444c 5397 libperl="libperl${_a}"
2afac517 5398 ;;
5399esac
5400
5401# Detect old use of shrpdir via undocumented Configure -Dshrpdir
5402case "$shrpdir" in
5403'') ;;
5404*) $cat >&4 <<EOM
5405WARNING: Use of the shrpdir variable for the installation location of
5406the shared $libperl is not supported. It was never documented and
46193409 5407will not work in this version. Let me (perlbug@perl.com)
dfe9444c 5408know of any problems this may cause.
2afac517 5409
5410EOM
5411 case "$shrpdir" in
5412 "$archlibexp/CORE")
5413 $cat >&4 <<EOM
5414But your current setting of $shrpdir is
5415the default anyway, so it's harmless.
5416EOM
5417 ;;
5418 *)
4e2a5f63
AD
5419 $cat >&4 <<EOM
5420Further, your current attempted setting of $shrpdir
5421conflicts with the value of $archlibexp/CORE
5422that installperl will use.
5423EOM
dc45a647
MB
5424 ;;
5425 esac
5426 ;;
5427esac
5428
5429# How will the perl executable find the installed shared $libperl?
5430# Add $xxx to ccdlflags.
5431# If we can't figure out a command-line option, use $shrpenv to
5432# set env LD_RUN_PATH. The main perl makefile uses this.
5433shrpdir=$archlibexp/CORE
5434xxx=''
5435tmp_shrpenv=''
5436if "$useshrplib"; then
5437 case "$osname" in
5438 aix)
5439 # We'll set it in Makefile.SH...
5440 ;;
5441 solaris|netbsd)
5442 xxx="-R $shrpdir"
5443 ;;
5444 freebsd)
5445 xxx="-Wl,-R$shrpdir"
5446 ;;
5447 linux|irix*|dec_osf)
5448 xxx="-Wl,-rpath,$shrpdir"
5449 ;;
5450 next)
5451 # next doesn't like the default...
5452 ;;
46193409
JH
5453 beos)
5454 # beos doesn't like the default, either.
5455 ;;
3656fc86
JH
5456 hpux*)
5457 # hpux doesn't like the default, either.
5458 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
5459 ;;
dc45a647
MB
5460 *)
5461 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
5462 ;;
5463 esac
5464 case "$xxx" in
5465 '') ;;
5466 *)
5467 # Only add $xxx if it isn't already in ccdlflags.
5468 case " $ccdlflags " in
5469 *" $xxx "*) ;;
5470 *) ccdlflags="$ccdlflags $xxx"
5471 cat <<EOM >&4
5472
5473Adding $xxx to the flags
5474passed to $ld so that the perl executable will find the
5475installed shared $libperl.
5476
5477EOM
5478 ;;
5479 esac
5480 ;;
5481 esac
5482fi
5483# Respect a hint or command-line value.
5484case "$shrpenv" in
5485'') shrpenv="$tmp_shrpenv" ;;
5486esac
5487
5488: determine where manual pages go
5489set man1dir man1dir none
5490eval $prefixit
5491$cat <<EOM
5492
5493$spackage has manual pages available in source form.
5494EOM
5495case "$nroff" in
5496nroff)
5497 echo "However, you don't have nroff, so they're probably useless to you."
5498 case "$man1dir" in
5499 '') man1dir="none";;
5500 esac;;
5501esac
5502echo "If you don't want the manual sources installed, answer 'none'."
5503case "$man1dir" in
5504' ') dflt=none
5505 ;;
5506'')
5507 lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
5508 lookpath="$lookpath $prefixexp/man/p_man/man1"
5509 lookpath="$lookpath $prefixexp/man/u_man/man1"
5510 lookpath="$lookpath $prefixexp/man/man.1"
5511 case "$sysman" in
5512 */?_man*) dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
5513 *) dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
5514 esac
5515 set dflt
5516 eval $prefixup
5517 ;;
5518*) dflt="$man1dir"
5519 ;;
5520esac
5521echo " "
5522fn=dn+~
5523rp="Where do the main $spackage manual pages (source) go?"
5524. ./getfile
5525if $test "X$man1direxp" != "X$ansexp"; then
5526 installman1dir=''
5527fi
5528man1dir="$ans"
5529man1direxp="$ansexp"
5530case "$man1dir" in
5531'') man1dir=' '
5532 installman1dir='';;
5533esac
5534if $afs; then
5535 $cat <<EOM
5536
5537Since you are running AFS, I need to distinguish the directory in which
5538manual pages reside from the directory in which they are installed (and from
5539which they are presumably copied to the former directory by occult means).
5540
5541EOM
5542 case "$installman1dir" in
5543 '') dflt=`echo $man1direxp | sed 's#^/afs/#/afs/.#'`;;
5544 *) dflt="$installman1dir";;
5545 esac
5546 fn=de~
5547 rp='Where will man pages be installed?'
5548 . ./getfile
5549 installman1dir="$ans"
5550else
5551 installman1dir="$man1direxp"
5552fi
5553
5554: What suffix to use on installed man pages
5555
5556case "$man1dir" in
5557' ')
5558 man1ext='0'
5559 ;;
5560*)
5561 rp="What suffix should be used for the main $spackage man pages?"
5562 case "$man1ext" in
5563 '') case "$man1dir" in
5564 *1) dflt=1 ;;
5565 *1p) dflt=1p ;;
5566 *1pm) dflt=1pm ;;
5567 *l) dflt=l;;
5568 *n) dflt=n;;
5569 *o) dflt=o;;
5570 *p) dflt=p;;
5571 *C) dflt=C;;
5572 *L) dflt=L;;
5573 *L1) dflt=L1;;
5574 *) dflt=1;;
5575 esac
5576 ;;
5577 *) dflt="$man1ext";;
5578 esac
5579 . ./myread
5580 man1ext="$ans"
5581 ;;
5582esac
5583
5584: see if we can have long filenames
5585echo " "
5586rmlist="$rmlist /tmp/cf$$"
5587$test -d /tmp/cf$$ || mkdir /tmp/cf$$
5588first=123456789abcdef
5589second=/tmp/cf$$/$first
5590$rm -f $first $second
5591if (echo hi >$first) 2>/dev/null; then
5592 if $test -f 123456789abcde; then
5593 echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4
5594 val="$undef"
5595 else
5596 if (echo hi >$second) 2>/dev/null; then
5597 if $test -f /tmp/cf$$/123456789abcde; then
5598 $cat <<'EOM'
5599That's peculiar... You can have filenames longer than 14 characters, but only
5600on some of the filesystems. Maybe you are using NFS. Anyway, to avoid problems
5601I shall consider your system cannot support long filenames at all.
5602EOM
5603 val="$undef"
5604 else
5605 echo 'You can have filenames longer than 14 characters.' >&4
5606 val="$define"
5607 fi
5608 else
5609 $cat <<'EOM'
5610How confusing! Some of your filesystems are sane enough to allow filenames
5611longer than 14 characters but some others like /tmp can't even think about them.
5612So, for now on, I shall assume your kernel does not allow them at all.
5613EOM
5614 val="$undef"
5615 fi
5616 fi
5617else
5618 $cat <<'EOM'
5619You can't have filenames longer than 14 chars. You can't even think about them!
5620EOM
5621 val="$undef"
5622fi
5623set d_flexfnam
5624eval $setvar
5625$rm -rf /tmp/cf$$ 123456789abcde*
5626
5627: determine where library module manual pages go
5628set man3dir man3dir none
5629eval $prefixit
5630$cat <<EOM
5631
5632$spackage has manual pages for many of the library modules.
5633EOM
5634
5635case "$nroff" in
5636nroff)
5637 $cat <<'EOM'
5638However, you don't have nroff, so they're probably useless to you.
5639EOM
5640 case "$man3dir" in
5641 '') man3dir="none";;
5642 esac;;
5643esac
5644
5645case "$d_flexfnam" in
5646undef)
5647 $cat <<'EOM'
5648However, your system can't handle the long file names like File::Basename.3.
5649EOM
5650 case "$man3dir" in
5651 '') man3dir="none";;
5652 esac;;
5653esac
5654
5655echo "If you don't want the manual sources installed, answer 'none'."
5656prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5657case "$man3dir" in
5658'') case "$prefix" in
5659 *$prog*) dflt=`echo $man1dir |
5660 $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'` ;;
5661 *) dflt="$privlib/man/man3" ;;
2afac517 5662 esac
5663 ;;
dc45a647
MB
5664' ') dflt=none;;
5665*) dflt="$man3dir" ;;
2afac517 5666esac
dc45a647 5667echo " "
2afac517 5668
dc45a647
MB
5669fn=dn+~
5670rp="Where do the $package library man pages (source) go?"
5671. ./getfile
5672if test "X$man3direxp" != "X$ansexp"; then
5673 installman3dir=''
5674fi
2afac517 5675
dc45a647
MB
5676man3dir="$ans"
5677man3direxp="$ansexp"
5678case "$man3dir" in
5679'') man3dir=' '
5680 installman3dir='';;
5681esac
5682if $afs; then
5683 $cat <<EOM
5684
5685Since you are running AFS, I need to distinguish the directory in which
5686manual pages reside from the directory in which they are installed (and from
5687which they are presumably copied to the former directory by occult means).
2afac517 5688
4e2a5f63 5689EOM
dc45a647
MB
5690 case "$installman3dir" in
5691 '') dflt=`echo $man3direxp | sed 's#^/afs/#/afs/.#'`;;
5692 *) dflt="$installman3dir";;
5693 esac
5694 fn=de~
5695 rp='Where will man pages be installed?'
5696 . ./getfile
5697 installman3dir="$ans"
5698else
5699 installman3dir="$man3direxp"
5700fi
5701
5702: What suffix to use on installed man pages
5703
5704case "$man3dir" in
5705' ')
5706 man3ext='0'
5707 ;;
5708*)
5709 rp="What suffix should be used for the $package library man pages?"
5710 case "$man3ext" in
5711 '') case "$man3dir" in
5712 *3) dflt=3 ;;
5713 *3p) dflt=3p ;;
5714 *3pm) dflt=3pm ;;
5715 *l) dflt=l;;
5716 *n) dflt=n;;
5717 *o) dflt=o;;
5718 *p) dflt=p;;
5719 *C) dflt=C;;
5720 *L) dflt=L;;
5721 *L3) dflt=L3;;
5722 *) dflt=3;;
2afac517 5723 esac
5724 ;;
dc45a647 5725 *) dflt="$man3ext";;
2afac517 5726 esac
dc45a647
MB
5727 . ./myread
5728 man3ext="$ans"
5729 ;;
2afac517 5730esac
5731
5732: see if we have to deal with yellow pages, now NIS.
5733if $test -d /usr/etc/yp || $test -d /etc/yp; then
5734 if $test -f /usr/etc/nibindd; then
5735 echo " "
5736 echo "I'm fairly confident you're on a NeXT."
5737 echo " "
5738 rp='Do you get the hosts file via NetInfo?'
5739 dflt=y
5740 case "$hostcat" in
5741 nidump*) ;;
5742 '') ;;
5743 *) dflt=n;;
5744 esac
5745 . ./myread
5746 case "$ans" in
5747 y*) hostcat='nidump hosts .';;
5748 *) case "$hostcat" in
5749 nidump*) hostcat='';;
5750 esac
5751 ;;
5752 esac
5753 fi
5754 case "$hostcat" in
5755 nidump*) ;;
5756 *)
5757 case "$hostcat" in
5758 *ypcat*) dflt=y;;
5759 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
5760 dflt=y
5761 else
5762 dflt=n
5763 fi;;
5764 *) dflt=n;;
5765 esac
5766 echo " "
5767 rp='Are you getting the hosts file via yellow pages?'
5768 . ./myread
5769 case "$ans" in
5770 y*) hostcat='ypcat hosts';;
5771 *) hostcat='cat /etc/hosts';;
5772 esac
5773 ;;
5774 esac
5775fi
dfe9444c
AD
5776case "$hostcat" in
5777'') hostcat='cat /etc/hosts';;
5778esac
5779case "$groupcat" in
5780'') groupcat='cat /etc/group';;
5781esac
5782case "$passcat" in
5783'') passcat='cat /etc/passwd';;
5784esac
2afac517 5785
5786: now get the host name
5787echo " "
5788echo "Figuring out host name..." >&4
5789case "$myhostname" in
5790'') cont=true
5791 echo 'Maybe "hostname" will work...'
5792 if tans=`sh -c hostname 2>&1` ; then
5793 myhostname=$tans
5794 phostname=hostname
5795 cont=''
5796 fi
5797 ;;
5798*) cont='';;
5799esac
5800if $test "$cont"; then
5801 if ./xenix; then
5802 echo 'Oh, dear. Maybe "/etc/systemid" is the key...'
5803 if tans=`cat /etc/systemid 2>&1` ; then
5804 myhostname=$tans
5805 phostname='cat /etc/systemid'
5806 echo "Whadyaknow. Xenix always was a bit strange..."
5807 cont=''
5808 fi
5809 elif $test -r /etc/systemid; then
5810 echo "(What is a non-Xenix system doing with /etc/systemid?)"
5811 fi
5812fi
5813if $test "$cont"; then
5814 echo 'No, maybe "uuname -l" will work...'
5815 if tans=`sh -c 'uuname -l' 2>&1` ; then
5816 myhostname=$tans
5817 phostname='uuname -l'
5818 else
5819 echo 'Strange. Maybe "uname -n" will work...'
5820 if tans=`sh -c 'uname -n' 2>&1` ; then
5821 myhostname=$tans
5822 phostname='uname -n'
5823 else
5824 echo 'Oh well, maybe I can mine it out of whoami.h...'
5825 if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
5826 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
5827 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
5828 else
5829 case "$myhostname" in
5830 '') echo "Does this machine have an identity crisis or something?"
5831 phostname='';;
5832 *)
5833 echo "Well, you said $myhostname before..."
5834 phostname='echo $myhostname';;
5835 esac
5836 fi
5837 fi
5838 fi
5839fi
5840: you do not want to know about this
5841set $myhostname
5842myhostname=$1
5843
5844: verify guess
5845if $test "$myhostname" ; then
5846 dflt=y
5847 rp='Your host name appears to be "'$myhostname'".'" Right?"
5848 . ./myread
5849 case "$ans" in
5850 y*) ;;
5851 *) myhostname='';;
5852 esac
5853fi
5854
5855: bad guess or no guess
5856while $test "X$myhostname" = X ; do
5857 dflt=''
5858 rp="Please type the (one word) name of your host:"
5859 . ./myread
5860 myhostname="$ans"
5861done
5862
5863: translate upper to lower if necessary
5864case "$myhostname" in
5865*[A-Z]*)
5866 echo "(Normalizing case in your host name)"
5867 myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
5868 ;;
5869esac
5870
5871case "$myhostname" in
5872*.*)
5873 dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
5874 myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
5875 echo "(Trimming domain name from host name--host name is now $myhostname)"
5876 ;;
5877*) case "$mydomain" in
5878 '')
5879 {
2afac517 5880 test "X$hostcat" = "Xypcat hosts" &&
5881 ypmatch "$myhostname" hosts 2>/dev/null |\
5882 $sed -e 's/[ ]*#.*//; s/$/ /' > hosts && \
5883 $test -s hosts
5884 } || {
2afac517 5885 $hostcat | $sed -n -e "s/[ ]*#.*//; s/\$/ /
5886 /[ ]$myhostname[ . ]/p" > hosts
5887 }
5888 tmp_re="[ . ]"
5889 $test x`$awk "/[0-9].*[ ]$myhostname$tmp_re/ { sum++ }
5890 END { print sum }" hosts` = x1 || tmp_re="[ ]"
5891 dflt=.`$awk "/[0-9].*[ ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
5892 hosts | $sort | $uniq | \
5893 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
5894 case `$echo X$dflt` in
5895 X*\ *) echo "(Several hosts in /etc/hosts matched hostname)"
5896 dflt=.
5897 ;;
5898 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
5899 ;;
5900 esac
5901 case "$dflt" in
5902 .)
5903 tans=`./loc resolv.conf X /etc /usr/etc`
5904 if $test -f "$tans"; then
5905 echo "(Attempting domain name extraction from $tans)"
a6006777 5906 dflt=.`$sed -n -e 's/ / /g' \
28757baa 5907 -e 's/^search *\([^ ]*\).*/\1/p' $tans \
a6006777 5908 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
2afac517 5909 case "$dflt" in
a6006777 5910 .) dflt=.`$sed -n -e 's/ / /g' \
28757baa 5911 -e 's/^domain *\([^ ]*\).*/\1/p' $tans \
a6006777 5912 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
774d564b 5913 ;;
2afac517 5914 esac
5915 fi
5916 ;;
5917 esac
5918 case "$dflt" in
5919 .) echo "(No help from resolv.conf either -- attempting clever guess)"
5920 dflt=.`sh -c domainname 2>/dev/null`
5921 case "$dflt" in
5922 '') dflt='.';;
5923 .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
5924 esac
5925 ;;
5926 esac
5927 case "$dflt" in
5928 .) echo "(Lost all hope -- silly guess then)"
5929 dflt='.uucp'
5930 ;;
5931 esac
5932 $rm -f hosts
5933 ;;
5934 *) dflt="$mydomain";;
5935 esac;;
5936esac
5937echo " "
5938rp="What is your domain name?"
5939. ./myread
5940tans="$ans"
5941case "$ans" in
5942'') ;;
5943.*) ;;
5944*) tans=".$tans";;
5945esac
5946mydomain="$tans"
5947
5948: translate upper to lower if necessary
5949case "$mydomain" in
5950*[A-Z]*)
5951 echo "(Normalizing case in your domain name)"
5952 mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
5953 ;;
5954esac
5955
5956: a little sanity check here
5957case "$phostname" in
5958'') ;;
5959*)
5960 case `$phostname | ./tr '[A-Z]' '[a-z]'` in
5961 $myhostname$mydomain|$myhostname) ;;
5962 *)
5963 case "$phostname" in
5964 sed*)
5965 echo "(That doesn't agree with your whoami.h file, by the way.)"
5966 ;;
5967 *)
5968 echo "(That doesn't agree with your $phostname command, by the way.)"
5969 ;;
5970 esac
5971 ;;
5972 esac
5973 ;;
5974esac
5975
5976$cat <<EOM
5977
5978I need to get your e-mail address in Internet format if possible, i.e.
5979something like user@host.domain. Please answer accurately since I have
5980no easy means to double check it. The default value provided below
5981is most probably close to the reality but may not be valid from outside
5982your organization...
5983
5984EOM
5985cont=x
5986while test "$cont"; do
5987 case "$cf_email" in
5988 '') dflt="$cf_by@$myhostname$mydomain";;
5989 *) dflt="$cf_email";;
5990 esac
5991 rp='What is your e-mail address?'
5992 . ./myread
5993 cf_email="$ans"
5994 case "$cf_email" in
5995 *@*.*) cont='' ;;
5996 *)
5997 rp='Address does not look like an Internet one. Use it anyway?'
5998 case "$fastread" in
5999 yes) dflt=y ;;
6000 *) dflt=n ;;
6001 esac
6002 . ./myread
6003 case "$ans" in
6004 y*) cont='' ;;
6005 *) echo " " ;;
6006 esac
6007 ;;
6008 esac
6009done
6010
6011$cat <<EOM
6012
6013If you or somebody else will be maintaining perl at your site, please
6014fill in the correct e-mail address here so that they may be contacted
6015if necessary. Currently, the "perlbug" program included with perl
6016will send mail to this address in addition to perlbug@perl.com. You may
6017enter "none" for no administrator.
6018
6019EOM
6020case "$perladmin" in
6021'') dflt="$cf_email";;
6022*) dflt="$perladmin";;
6023esac
6024rp='Perl administrator e-mail address'
6025. ./myread
6026perladmin="$ans"
6027
5f05dabc 6028: figure out how to guarantee perl startup
6029case "$startperl" in
6030'')
6031 case "$sharpbang" in
6032 *!)
6033 $cat <<EOH
6034
6035I can use the #! construct to start perl on your system. This will
6036make startup of perl scripts faster, but may cause problems if you
6037want to share those scripts and perl is not in a standard place
6038($binexp/perl) on all your platforms. The alternative is to force
6039a shell by starting the script with a single ':' character.
6040
6041EOH
6042 dflt="$binexp/perl"
6043 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
6044 . ./myread
6045 case "$ans" in
68dc0745 6046 none) startperl=": # use perl";;
6047 *) startperl="#!$ans"
3e3baf6d 6048 if $test 30 -lt `echo "$ans" | wc -c`; then
68dc0745 6049 $cat >&4 <<EOM
6050
6051WARNING: Some systems limit the #! command to 32 characters.
6052If you experience difficulty running Perl scripts with #!, try
6053installing Perl in a directory with a shorter pathname.
6054
6055EOM
6056 fi ;;
5f05dabc 6057 esac
6058 ;;
6059 *) startperl=": # use perl"
6060 ;;
6061 esac
6062 ;;
6063esac
6064echo "I'll use $startperl to start perl scripts."
6065
6066: figure best path for perl in scripts
6067case "$perlpath" in
6068'')
6069 perlpath="$binexp/perl"
6070 case "$startperl" in
6071 *!*) ;;
6072 *)
6073 $cat <<EOH
6074
6075I will use the "eval 'exec'" idiom to start Perl on your system.
6076I can use the full path of your Perl binary for this purpose, but
6077doing so may cause problems if you want to share those scripts and
6078Perl is not always in a standard place ($binexp/perl).
6079
6080EOH
6081 dflt="$binexp/perl"
6082 rp="What path shall I use in \"eval 'exec'\"?"
6083 . ./myread
6084 perlpath="$ans"
6085 ;;
6086 esac
6087 ;;
6088esac
6089case "$startperl" in
6090*!*) ;;
6091*) echo "I'll use $perlpath in \"eval 'exec'\"" ;;
6092esac
6093
dc45a647
MB
6094: determine where public executable scripts go
6095set scriptdir scriptdir
6096eval $prefixit
6097case "$scriptdir" in
6098'')
6099 dflt="$bin"
6100 : guess some guesses
6101 $test -d /usr/share/scripts && dflt=/usr/share/scripts
6102 $test -d /usr/share/bin && dflt=/usr/share/bin
6103 $test -d /usr/local/script && dflt=/usr/local/script
6104 $test -d $prefixexp/script && dflt=$prefixexp/script
6105 set dflt
6106 eval $prefixup
6107 ;;
6108*) dflt="$scriptdir"
6109 ;;
6110esac
6111$cat <<EOM
6112
6113Some installations have a separate directory just for executable scripts so
6114that they can mount it across multiple architectures but keep the scripts in
6115one spot. You might, for example, have a subdirectory of /usr/share for this.
6116Or you might just lump your scripts in with all your other executables.
6117
6118EOM
6119fn=d~
6120rp='Where do you keep publicly executable scripts?'
6121. ./getfile
6122if $test "X$ansexp" != "X$scriptdirexp"; then
6123 installscript=''
6124fi
6125scriptdir="$ans"
6126scriptdirexp="$ansexp"
6127if $afs; then
6128 $cat <<EOM
6129
6130Since you are running AFS, I need to distinguish the directory in which
6131scripts reside from the directory in which they are installed (and from
6132which they are presumably copied to the former directory by occult means).
6133
6134EOM
6135 case "$installscript" in
6136 '') dflt=`echo $scriptdirexp | sed 's#^/afs/#/afs/.#'`;;
6137 *) dflt="$installscript";;
6138 esac
6139 fn=de~
6140 rp='Where will public scripts be installed?'
6141 . ./getfile
6142 installscript="$ans"
6143else
6144 installscript="$scriptdirexp"
6145fi
6146
6147: determine where site specific libraries go.
3a6175e1 6148: Usual default is /usr/local/lib/perl5/site_perl/$apiversion
bfb7748a
AD
6149prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6150case "$prefix" in
3a6175e1
AD
6151*perl*) set dflt sitelib lib/site_$prog/$apiversion ;;
6152*) set dflt sitelib lib/$package/site_$prog/$apiversion ;;
dc45a647 6153esac
bfb7748a 6154eval $prefixit
dc45a647
MB
6155$cat <<EOM
6156
6157The installation process will also create a directory for
6158site-specific extensions and modules. Some users find it convenient
68c15b6f
HM
6159to place all site-specific files in this directory rather than in the
6160main distribution directory.
dc45a647
MB
6161
6162EOM
6163fn=d~+
6164rp='Pathname for the site-specific library files?'
6165. ./getfile
6166if $test "X$sitelibexp" != "X$ansexp"; then
6167 installsitelib=''
6168fi
6169sitelib="$ans"
6170sitelibexp="$ansexp"
6171if $afs; then
6172 $cat <<EOM
6173
6174Since you are running AFS, I need to distinguish the directory in
6175which site-specific files reside from the directory in which they are
6176installed (and from which they are presumably copied to the former
6177directory by occult means).
6178
6179EOM
6180 case "$installsitelib" in
6181 '') dflt=`echo $sitelibexp | sed 's#^/afs/#/afs/.#'`;;
6182 *) dflt="$installsitelib";;
6183 esac
6184 fn=de~
6185 rp='Where will site-specific files be installed?'
6186 . ./getfile
6187 installsitelib="$ans"
6188else
6189 installsitelib="$sitelibexp"
6190fi
6191
6192: determine where site specific architecture-dependent libraries go.
3a6175e1 6193: sitelib default is /usr/local/lib/perl5/site_perl/$apiversion
bfb7748a 6194: sitearch default is /usr/local/lib/perl5/site_perl/$apiversion/$archname
3a6175e1 6195: sitelib may have an optional trailing /share.
bfb7748a
AD
6196tdflt=`echo $sitelib | $sed 's,/share$,,'`
6197tdflt="$tdflt/$archname"
dc45a647
MB
6198set sitearch sitearch none
6199eval $prefixit
6200case "$sitearch" in
bfb7748a 6201'') dflt="$tdflt" ;;
dc45a647
MB
6202*) dflt="$sitearch" ;;
6203esac
6204$cat <<EOM
6205
6206The installation process will also create a directory for
6207architecture-dependent site-specific extensions and modules.
6208
6209EOM
6210fn=nd~+
6211rp='Pathname for the site-specific architecture-dependent library files?'
6212. ./getfile
6213if $test "X$sitearchexp" != "X$ansexp"; then
6214 installsitearch=''
6215fi
6216sitearch="$ans"
6217sitearchexp="$ansexp"
6218if $afs; then
6219 $cat <<EOM
6220
6221Since you are running AFS, I need to distinguish the directory in
6222which site-specific architecture-dependent library files reside from
6223the directory in which they are installed (and from which they are
6224presumably copied to the former directory by occult means).
6225
6226EOM
6227 case "$installsitearch" in
6228 '') dflt=`echo $sitearchexp | sed 's#^/afs/#/afs/.#'`;;
6229 *) dflt="$installsitearch";;
6230 esac
6231 fn=de~
6232 rp='Where will site-specific architecture-dependent files be installed?'
6233 . ./getfile
6234 installsitearch="$ans"
6235else
6236 installsitearch="$sitearchexp"
6237fi
6238
2afac517 6239cat <<EOM
6240
85aff577
CS
6241Previous version of $package used the standard IO mechanisms as defined
6242in <stdio.h>. Versions 5.003_02 and later of perl allow alternate IO
2afac517 6243mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
85aff577
CS
6244the default. This abstraction layer can use AT&T's sfio (if you already
6245have sfio installed) or regular stdio. Using PerlIO with sfio may cause
6246problems with some extension modules. Using PerlIO with stdio is safe,
6247but it is slower than plain stdio and therefore is not the default.
2afac517 6248
6249If this doesn't make any sense to you, just accept the default 'n'.
6250EOM
6251case "$useperlio" in
6252$define|true|[yY]*) dflt='y';;
6253*) dflt='n';;
6254esac
6255rp='Use the experimental PerlIO abstraction layer?'
6256. ./myread
6257case "$ans" in
6258y|Y)
6259 val="$define"
6260 ;;
6261*)
6262 echo "Ok, doing things the stdio way"
6263 val="$undef"
6264 ;;
6265esac
6266set useperlio
6267eval $setvar
2304df62 6268
8e07c86e 6269: Check how to convert floats to strings.
28e8609d 6270if test "X$d_Gconvert" = X; then
5ff3f7a4
GS
6271 echo " "
6272 echo "Checking for an efficient way to convert floats to strings."
6273 $cat >try.c <<'EOP'
8e07c86e
AD
6274#ifdef TRY_gconvert
6275#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
8ff267be 6276char *myname = "gconvert";
8e07c86e
AD
6277#endif
6278#ifdef TRY_gcvt
6279#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
8ff267be 6280char *myname = "gcvt";
8e07c86e
AD
6281#endif
6282#ifdef TRY_sprintf
6283#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
8ff267be 6284char *myname = "sprintf";
8e07c86e 6285#endif
8ff267be 6286
6287#include <stdio.h>
6288
6289int
6290checkit(expect, got)
6291char *expect;
6292char *got;
6293{
6294 if (strcmp(expect, got)) {
6295 printf("%s oddity: Expected %s, got %s\n",
6296 myname, expect, got);
6297 exit(1);
6298 }
6299}
6300
5a411a32 6301int main()
8ff267be 6302{
ecfc5424 6303 char buf[64];
8ff267be 6304 buf[63] = '\0';
6305
6306 /* This must be 1st test on (which?) platform */
6307 /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
6308 Gconvert(0.1, 8, 0, buf);
6309 checkit("0.1", buf);
6310
8e07c86e 6311 Gconvert(1.0, 8, 0, buf);
8ff267be 6312 checkit("1", buf);
6313
8e07c86e 6314 Gconvert(0.0, 8, 0, buf);
8ff267be 6315 checkit("0", buf);
6316
8e07c86e 6317 Gconvert(-1.0, 8, 0, buf);
8ff267be 6318 checkit("-1", buf);
6319
6320 /* Some Linux gcvt's give 1.e+5 here. */
6321 Gconvert(100000.0, 8, 0, buf);
6322 checkit("100000", buf);
6323
6324 /* Some Linux gcvt's give -1.e+5 here. */
6325 Gconvert(-100000.0, 8, 0, buf);
6326 checkit("-100000", buf);
6327
ecfc5424 6328 exit(0);
a0d0e21e
LW
6329}
6330EOP
5ff3f7a4
GS
6331 case "$d_Gconvert" in
6332 gconvert*) xxx_list='gconvert gcvt sprintf' ;;
6333 gcvt*) xxx_list='gcvt gconvert sprintf' ;;
6334 sprintf*) xxx_list='sprintf gconvert gcvt' ;;
6335 *) xxx_list='gconvert gcvt sprintf' ;;
6336 esac
8e07c86e 6337
5ff3f7a4
GS
6338 for xxx_convert in $xxx_list; do
6339 echo "Trying $xxx_convert"
6340 $rm -f try try$_o
6341 set try -DTRY_$xxx_convert
6342 if eval $compile; then
6343 echo "$xxx_convert" found. >&4
6344 if ./try; then
6345 echo "I'll use $xxx_convert to convert floats into a string." >&4
6346 break;
6347 else
6348 echo "...But $xxx_convert didn't work as I expected."
6349 fi
2304df62 6350 else
5ff3f7a4 6351 echo "$xxx_convert NOT found." >&4
2304df62 6352 fi
5ff3f7a4 6353 done
8e07c86e 6354
5ff3f7a4
GS
6355 case "$xxx_convert" in
6356 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
6357 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
6358 *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
6359 esac
28e8609d 6360fi
2304df62 6361
a0d0e21e
LW
6362: Initialize h_fcntl
6363h_fcntl=false
6364
6365: Initialize h_sysfile
6366h_sysfile=false
2304df62 6367
2304df62
AD
6368: access call always available on UNIX
6369set access d_access
6370eval $inlibc
6371
6372: locate the flags for 'access()'
6373case "$d_access" in
6374"$define")
6375 echo " "
6376 $cat >access.c <<'EOCP'
6377#include <sys/types.h>
6378#ifdef I_FCNTL
6379#include <fcntl.h>
6380#endif
6381#ifdef I_SYS_FILE
6382#include <sys/file.h>
6383#endif
6384#ifdef I_UNISTD
6385#include <unistd.h>
6386#endif
d674cd6d 6387int main() {
2304df62
AD
6388 exit(R_OK);
6389}
8e07c86e
AD
6390EOCP
6391 : check sys/file.h first, no particular reason here
6392 if $test `./findhdr sys/file.h` && \
dfe9444c 6393 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
8e07c86e
AD
6394 h_sysfile=true;
6395 echo "<sys/file.h> defines the *_OK access constants." >&4
6396 elif $test `./findhdr fcntl.h` && \
dfe9444c 6397 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
8e07c86e
AD
6398 h_fcntl=true;
6399 echo "<fcntl.h> defines the *_OK access constants." >&4
6400 elif $test `./findhdr unistd.h` && \
dfe9444c 6401 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
8e07c86e
AD
6402 echo "<unistd.h> defines the *_OK access constants." >&4
6403 else
6404 echo "I can't find the four *_OK access constants--I'll use mine." >&4
6405 fi
6406 ;;
6407esac
6408$rm -f access*
a0d0e21e 6409
5ff3f7a4
GS
6410: see if accessx exists
6411set accessx d_accessx
6412eval $inlibc
6413
8e07c86e
AD
6414: see if alarm exists
6415set alarm d_alarm
6416eval $inlibc
2304df62 6417
ecfc5424 6418: Look for GNU-cc style attribute checking
2304df62 6419echo " "
a0d0e21e
LW
6420echo "Checking whether your compiler can handle __attribute__ ..." >&4
6421$cat >attrib.c <<'EOCP'
1aef975c 6422#include <stdio.h>
ecfc5424 6423void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
a0d0e21e
LW
6424EOCP
6425if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
6426 if $contains 'warning' attrib.out >/dev/null 2>&1; then
ecfc5424 6427 echo "Your C compiler doesn't fully support __attribute__."
a0d0e21e
LW
6428 val="$undef"
6429 else
ecfc5424 6430 echo "Your C compiler supports __attribute__."
a0d0e21e
LW
6431 val="$define"
6432 fi
6433else
ecfc5424 6434 echo "Your C compiler doesn't seem to understand __attribute__ at all."
a0d0e21e
LW
6435 val="$undef"
6436fi
ecfc5424 6437set d_attribut
a0d0e21e
LW
6438eval $setvar
6439$rm -f attrib*
6440
6441: see if bcmp exists
6442set bcmp d_bcmp
6443eval $inlibc
6444
6445: see if bcopy exists
6446set bcopy d_bcopy
6447eval $inlibc
6448
2afac517 6449: see if this is a unistd.h system
6450set unistd.h i_unistd
6451eval $inhdr
6452
6453: see if getpgrp exists
6454set getpgrp d_getpgrp
6455eval $inlibc
6456
2afac517 6457case "$d_getpgrp" in
6458"$define")
6459 echo " "
dfe9444c 6460 echo "Checking to see which flavor of getpgrp is in use..."
2afac517 6461 $cat >set.c <<EOP
6462#$i_unistd I_UNISTD
6463#include <sys/types.h>
6464#ifdef I_UNISTD
6465# include <unistd.h>
6466#endif
5a411a32 6467int main()
2afac517 6468{
6469 if (getuid() == 0) {
6470 printf("(I see you are running Configure as super-user...)\n");
6471 setuid(1);
6472 }
6473#ifdef TRY_BSD_PGRP
6474 if (getpgrp(1) == 0)
6475 exit(0);
6476#else
6477 if (getpgrp() > 0)
6478 exit(0);
6479#endif
6480 exit(1);
6481}
6482EOP
6483 if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
6484 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
6485 val="$define"
6486 elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
6487 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
6488 val="$undef"
6489 else
6490 echo "I can't seem to compile and run the test program."
6491 if ./usg; then
6492 xxx="a USG one, i.e. you use getpgrp()."
6493 else
6494 # SVR4 systems can appear rather BSD-ish.
6495 case "$i_unistd" in
6496 $undef)
6497 xxx="a BSD one, i.e. you use getpgrp(pid)."
6498 val="$define"
6499 ;;
6500 $define)
6501 xxx="probably a USG one, i.e. you use getpgrp()."
6502 val="$undef"
6503 ;;
6504 esac
6505 fi
6506 echo "Assuming your getpgrp is $xxx" >&4
6507 fi
6508 ;;
6509*) val="$undef";;
6510esac
6511set d_bsdgetpgrp
6512eval $setvar
6513$rm -f set set.c
6514
a0d0e21e
LW
6515: see if setpgrp exists
6516set setpgrp d_setpgrp
6517eval $inlibc
6518
a0d0e21e
LW
6519case "$d_setpgrp" in
6520"$define")
6521 echo " "
dfe9444c 6522 echo "Checking to see which flavor of setpgrp is in use..."
a0d0e21e 6523 $cat >set.c <<EOP
2afac517 6524#$i_unistd I_UNISTD
6525#include <sys/types.h>
6526#ifdef I_UNISTD
6527# include <unistd.h>
6528#endif
5a411a32 6529int main()
a0d0e21e
LW
6530{
6531 if (getuid() == 0) {
6532 printf("(I see you are running Configure as super-user...)\n");
6533 setuid(1);
6534 }
2afac517 6535#ifdef TRY_BSD_PGRP
a0d0e21e 6536 if (-1 == setpgrp(1, 1))
2afac517 6537 exit(0);
6538#else
6539 if (setpgrp() != -1)
6540 exit(0);
6541#endif
6542 exit(1);
a0d0e21e
LW
6543}
6544EOP
2afac517 6545 if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
6546 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
6547 val="$define"
6548 elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
6549 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
6550 val="$undef"
a0d0e21e 6551 else
dfe9444c 6552 echo "(I can't seem to compile and run the test program.)"
ecfc5424 6553 if ./usg; then
2afac517 6554 xxx="a USG one, i.e. you use setpgrp()."
a0d0e21e 6555 else
2afac517 6556 # SVR4 systems can appear rather BSD-ish.
6557 case "$i_unistd" in
6558 $undef)
6559 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
6560 val="$define"
6561 ;;
6562 $define)
6563 xxx="probably a USG one, i.e. you use setpgrp()."
6564 val="$undef"
6565 ;;
6566 esac
a0d0e21e 6567 fi
2afac517 6568 echo "Assuming your setpgrp is $xxx" >&4
a0d0e21e
LW
6569 fi
6570 ;;
6571*) val="$undef";;
6572esac
2afac517 6573set d_bsdsetpgrp
a0d0e21e
LW
6574eval $setvar
6575$rm -f set set.c
a0d0e21e
LW
6576: see if bzero exists
6577set bzero d_bzero
6578eval $inlibc
6579
24fef2a7 6580: check for lengths of integral types
a0d0e21e
LW
6581echo " "
6582case "$intsize" in
6583'')
6584 echo "Checking to see how big your integers are..." >&4
24fef2a7 6585 $cat >intsize.c <<'EOCP'
a0d0e21e 6586#include <stdio.h>
d674cd6d 6587int main()
a0d0e21e 6588{
24fef2a7
AD
6589 printf("intsize=%d;\n", sizeof(int));
6590 printf("longsize=%d;\n", sizeof(long));
6591 printf("shortsize=%d;\n", sizeof(short));
8e07c86e 6592 exit(0);
a0d0e21e
LW
6593}
6594EOCP
dfe9444c 6595 set intsize
dc45a647 6596 if eval $compile_ok && ./intsize > /dev/null; then
dfe9444c 6597 eval `./intsize`
8e07c86e 6598 echo "Your integers are $intsize bytes long."
24fef2a7
AD
6599 echo "Your long integers are $longsize bytes long."
6600 echo "Your short integers are $shortsize bytes long."
a0d0e21e 6601 else
24fef2a7 6602 $cat >&4 <<EOM
dfe9444c 6603!
24fef2a7
AD
6604Help! I can't compile and run the intsize test program: please enlighten me!
6605(This is probably a misconfiguration in your system or libraries, and
6606you really ought to fix it. Still, I'll try anyway.)
dfe9444c 6607!
24fef2a7
AD
6608EOM
6609 dflt=4
8e07c86e
AD
6610 rp="What is the size of an integer (in bytes)?"
6611 . ./myread
6612 intsize="$ans"
24fef2a7
AD
6613 dflt=$intsize
6614 rp="What is the size of a long integer (in bytes)?"
6615 . ./myread
6616 longsize="$ans"
6617 dflt=2
6618 rp="What is the size of a short integer (in bytes)?"
6619 . ./myread
6620 shortsize="$ans"
a0d0e21e
LW
6621 fi
6622 ;;
a0d0e21e 6623esac
dfe9444c 6624$rm -f intsize intsize.*
a0d0e21e 6625
ecfc5424 6626: see if signal is declared as pointer to function returning int or void
a0d0e21e 6627echo " "
ecfc5424
AD
6628xxx=`./findhdr signal.h`
6629$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
6630if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
6631 echo "You have int (*signal())() instead of void." >&4
6632 val="$undef"
6633elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
dfe9444c 6634 echo "You have void (*signal())()." >&4
ecfc5424
AD
6635 val="$define"
6636elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
6637 echo "You have int (*signal())() instead of void." >&4
6638 val="$undef"
dfe9444c
AD
6639elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
6640 echo "You have void (*signal())()." >&4
6641 val="$define"
a0d0e21e 6642else
ecfc5424
AD
6643 case "$d_voidsig" in
6644 '')
6645 echo "I can't determine whether signal handler returns void or int..." >&4
6646 dflt=void
6647 rp="What type does your signal handler return?"
6648 . ./myread
6649 case "$ans" in
6650 v*) val="$define";;
6651 *) val="$undef";;
6652 esac;;
6653 "$define")
dfe9444c
AD
6654 echo "As you already told me, signal handler returns void." >&4
6655 val="$define"
6656 ;;
6657 *) echo "As you already told me, signal handler returns int." >&4
6658 val="$undef"
6659 ;;
ecfc5424
AD
6660 esac
6661fi
6662set d_voidsig
6663eval $setvar
6664case "$d_voidsig" in
6665"$define") signal_t="void";;
6666*) signal_t="int";;
6667esac
6668$rm -f $$.tmp
6669
6670: check for ability to cast large floats to 32-bit ints.
6671echo " "
6672echo 'Checking whether your C compiler can cast large floats to int32.' >&4
e5c9fcd0 6673if $test "$intsize" -ge 4; then
ecfc5424
AD
6674 xxx=int
6675else
6676 xxx=long
6677fi
6678$cat >try.c <<EOCP
e5c9fcd0 6679#include <stdio.h>
ecfc5424
AD
6680#include <sys/types.h>
6681#include <signal.h>
a1896f58 6682$signal_t blech(s) int s; { exit(3); }
d674cd6d 6683int main()
2304df62 6684{
a0d0e21e 6685 $xxx i32;
e5c9fcd0 6686 double f, g;
2304df62 6687 int result = 0;
89434db5 6688 char str[16];
2304df62
AD
6689 signal(SIGFPE, blech);
6690
89434db5
AD
6691 /* Don't let compiler optimize the test away. Store the number
6692 in a writable string for gcc to pass to sscanf under HP/UX.
6693 */
6694 sprintf(str, "2147483647");
6695 sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
e5c9fcd0
AD
6696 g = 10 * f;
6697 i32 = ($xxx) g;
2304df62 6698
e5c9fcd0
AD
6699 /* x86 processors will probably give 0x8000 0000, which is a
6700 sign change. We don't want that. We want to mimic SPARC
6701 behavior here, which is to preserve the sign and give
6702 back 0x7fff ffff.
6703 */
a0d0e21e 6704 if (i32 != ($xxx) f)
2304df62
AD
6705 result |= 1;
6706 exit(result);
6707}
6708EOCP
dfe9444c 6709set try
dc45a647 6710if eval $compile_ok; then
2304df62
AD
6711 ./try
6712 yyy=$?
6713else
a0d0e21e 6714 echo "(I can't seem to compile the test program--assuming it can't)"
2304df62
AD
6715 yyy=1
6716fi
6717case "$yyy" in
67180) val="$define"
6719 echo "Yup, it can."
6720 ;;
6721*) val="$undef"
6722 echo "Nope, it can't."
6723 ;;
6724esac
6725set d_casti32
6726eval $setvar
85e6fe83 6727$rm -f try try.*
a0d0e21e 6728
2304df62
AD
6729: check for ability to cast negative floats to unsigned
6730echo " "
6731echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
ecfc5424 6732$cat >try.c <<EOCP
e5c9fcd0 6733#include <stdio.h>
ecfc5424 6734#include <sys/types.h>
2304df62 6735#include <signal.h>
a1896f58
AD
6736$signal_t blech(s) int s; { exit(7); }
6737$signal_t blech_in_list(s) int s; { exit(4); }
232e078e
AD
6738unsigned long dummy_long(p) unsigned long p; { return p; }
6739unsigned int dummy_int(p) unsigned int p; { return p; }
6740unsigned short dummy_short(p) unsigned short p; { return p; }
d674cd6d 6741int main()
2304df62 6742{
e5c9fcd0 6743 double f;
2304df62
AD
6744 unsigned long along;
6745 unsigned int aint;
6746 unsigned short ashort;
6747 int result = 0;
89434db5
AD
6748 char str[16];
6749
e5c9fcd0
AD
6750 /* Frustrate gcc-2.7.2's optimizer which failed this test with
6751 a direct f = -123. assignment. gcc-2.8.0 reportedly
6752 optimized the whole file away
6753 */
89434db5
AD
6754 /* Store the number in a writable string for gcc to pass to
6755 sscanf under HP/UX.
6756 */
6757 sprintf(str, "-123");
6758 sscanf(str, "%lf", &f); /* f = -123.; */
2304df62
AD
6759
6760 signal(SIGFPE, blech);
6761 along = (unsigned long)f;
6762 aint = (unsigned int)f;
6763 ashort = (unsigned short)f;
6764 if (along != (unsigned long)-123)
6765 result |= 1;
6766 if (aint != (unsigned int)-123)
6767 result |= 1;
6768 if (ashort != (unsigned short)-123)
6769 result |= 1;
89434db5
AD
6770 sprintf(str, "1073741824.");
6771 sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
2304df62
AD
6772 f = f + f;
6773 along = 0;
6774 along = (unsigned long)f;
6775 if (along != 0x80000000)
6776 result |= 2;
6777 f -= 1.;
6778 along = 0;
6779 along = (unsigned long)f;
6780 if (along != 0x7fffffff)
6781 result |= 1;
6782 f += 2.;
6783 along = 0;
6784 along = (unsigned long)f;
6785 if (along != 0x80000001)
6786 result |= 2;
232e078e
AD
6787 if (result)
6788 exit(result);
6789 signal(SIGFPE, blech_in_list);
89434db5
AD
6790 sprintf(str, "123.");
6791 sscanf(str, "%lf", &f); /* f = 123.; */
232e078e
AD
6792 along = dummy_long((unsigned long)f);
6793 aint = dummy_int((unsigned int)f);
6794 ashort = dummy_short((unsigned short)f);
6795 if (along != (unsigned long)123)
6796 result |= 4;
6797 if (aint != (unsigned int)123)
6798 result |= 4;
6799 if (ashort != (unsigned short)123)
6800 result |= 4;
2304df62
AD
6801 exit(result);
6802
6803}
6804EOCP
dfe9444c 6805set try
dc45a647 6806if eval $compile_ok; then
2304df62
AD
6807 ./try
6808 castflags=$?
6809else
ecfc5424 6810 echo "(I can't seem to compile the test program--assuming it can't)"
232e078e 6811 castflags=7
2304df62
AD
6812fi
6813case "$castflags" in
68140) val="$define"
6815 echo "Yup, it can."
6816 ;;
6817*) val="$undef"
6818 echo "Nope, it can't."
6819 ;;
6820esac
6821set d_castneg
6822eval $setvar
6823$rm -f try.*
6824
2304df62
AD
6825: see if vprintf exists
6826echo " "
6827if set vprintf val -f d_vprintf; eval $csym; $val; then
6828 echo 'vprintf() found.' >&4
6829 val="$define"
6830 $cat >vprintf.c <<'EOF'
6831#include <varargs.h>
6832
d674cd6d 6833int main() { xxx("foo"); }
2304df62
AD
6834
6835xxx(va_alist)
6836va_dcl
6837{
6838 va_list args;
6839 char buf[10];
6840
6841 va_start(args);
6842 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
6843}
6844EOF
dfe9444c
AD
6845 set vprintf
6846 if eval $compile && ./vprintf; then
2304df62
AD
6847 echo "Your vsprintf() returns (int)." >&4
6848 val2="$undef"
6849 else
6850 echo "Your vsprintf() returns (char*)." >&4
6851 val2="$define"
6852 fi
6853else
6854 echo 'vprintf() NOT found.' >&4
6855 val="$undef"
6856 val2="$undef"
6857fi
6858set d_vprintf
6859eval $setvar
6860val=$val2
6861set d_charvspr
6862eval $setvar
6863
a0d0e21e
LW
6864: see if chown exists
6865set chown d_chown
6866eval $inlibc
6867
6868: see if chroot exists
6869set chroot d_chroot
6870eval $inlibc
6871
2304df62
AD
6872: see if chsize exists
6873set chsize d_chsize
6874eval $inlibc
6875
de4597cb
JH
6876hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
6877while $test $# -ge 2; do
6878 case "$1" in
6879 $define) echo "#include <$2>";;
6880 esac ;
6881 shift 2;
6882done > try.c;
6883echo "int main () { struct $struct foo; foo.$field = 0; }" >> try.c;
2000072c 6884if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
de4597cb
JH
6885 val="$define";
6886else
6887 val="$undef";
6888fi;
6889set $varname;
6890eval $setvar;
6891$rm -f try.c try.o'
6892
6893: see if this is a sys/uio.h system
6894set sys/uio.h i_sysuio
6895eval $inhdr
6896
6897echo "Checking to see if your system supports struct iovec..." >&4
6898set d_iovec_s iovec iov_base $i_sysuio sys/uio.h
6899eval $hasfield
6900case "$d_iovec_s" in
6901"$define") echo "Yup, it does." >&4
6902 ;;
6903*) echo "Nope, it doesn't." >&4
6904 ;;
6905esac
6906
6907socketlib=''
6908sockethdr=''
6909: see whether socket exists
6910echo " "
6911$echo $n "Hmm... $c" >&4
6912if set socket val -f d_socket; eval $csym; $val; then
6913 echo "Looks like you have Berkeley networking support." >&4
6914 d_socket="$define"
6915 if set setsockopt val -f; eval $csym; $val; then
6916 d_oldsock="$undef"
6917 else
6918 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
6919 d_oldsock="$define"
6920 fi
6921else
6922 if $contains socklib libc.list >/dev/null 2>&1; then
6923 echo "Looks like you have Berkeley networking support." >&4
6924 d_socket="$define"
6925 : we will have to assume that it supports the 4.2 BSD interface
6926 d_oldsock="$undef"
6927 else
6928 echo "You don't have Berkeley networking in libc$_a..." >&4
6929 if test "X$d_socket" = "X$define"; then
6930 echo "...but you seem to believe that you have sockets." >&4
6931 else
6932 for net in net socket
6933 do
6934 if test -f /usr/lib/lib$net$_a; then
6935 ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) || \
6936 $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
6937 if $contains socket libc.list >/dev/null 2>&1; then
6938 d_socket="$define"
6939 socketlib="-l$net"
6940 case "$net" in
6941 net)
6942 echo "...but the Wollongong group seems to have hacked it in." >&4
6943 sockethdr="-I/usr/netinclude"
6944 ;;
6945 esac
6946 echo "Found Berkeley sockets interface in lib$net." >& 4
6947 if $contains setsockopt libc.list >/dev/null 2>&1; then
6948 d_oldsock="$undef"
6949 else
6950 echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
6951 d_oldsock="$define"
6952 fi
6953 break
6954 fi
6955 fi
6956 done
6957 if test "X$d_socket" != "X$define"; then
6958 echo "or anywhere else I see." >&4
6959 d_socket="$undef"
6960 d_oldsock="$undef"
6961 fi
6962 fi
6963 fi
6964fi
6965
6966: see if socketpair exists
6967set socketpair d_sockpair
6968eval $inlibc
6969
6970
5b34fd99 6971echo " "
de4597cb
JH
6972echo "Checking the availability of certain socket constants..." >& 4
6973for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
6974 enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
6975 $cat >try.c <<EOF
ac60b016 6976#include <sys/types.h>
de4597cb
JH
6977#include <sys/socket.h>
6978int main() {
6979 int i = $ENUM;
6980}
6981EOF
6982 val="$undef"
6983 set try; if eval $compile; then
6984 val="$define"
6985 fi
6986 set d_${enum}; eval $setvar
6987 $rm -f try.c try
6988done
6989
6990set sendmsg d_sendmsg
6991eval $inlibc
6992
6993set recvmsg d_recvmsg
6994eval $inlibc
6995
6996echo " "
6997$echo $n "Checking to see if your system supports struct msghdr...$c" >&4
6998set d_msghdr_s msghdr msg_name define sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
6999eval $hasfield
7000case "$d_msghdr_s" in
7001"$define") echo "Yup, it does." >&4
7002 ;;
7003*) echo "Nope, it doesn't." >&4
7004 ;;
7005esac
7006
7007$echo $n "Checking to see if your system supports struct cmsghdr...$c" >&4
7008set d_cmsghdr_s cmsghdr cmsg_len define sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
7009eval $hasfield
7010case "$d_cmsghdr_s" in
7011"$define") echo "Yup, it does." >&4
7012 ;;
7013*) echo "Nope, it doesn't." >&4
7014 ;;
7015esac
7016
2304df62
AD
7017: check for const keyword
7018echo " "
7019echo 'Checking to see if your C compiler knows about "const"...' >&4
7020$cat >const.c <<'EOCP'
7021typedef struct spug { int drokk; } spug;
5a411a32 7022int main()
2304df62
AD
7023{
7024 const char *foo;
7025 const spug y;
7026}
7027EOCP
7028if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
7029 val="$define"
7030 echo "Yup, it does."
7031else
7032 val="$undef"
7033 echo "Nope, it doesn't."
7034fi
7035set d_const
7036eval $setvar
7037
7038: see if crypt exists
7039echo " "
7040if set crypt val -f d_crypt; eval $csym; $val; then
7041 echo 'crypt() found.' >&4
7042 val="$define"
7043 cryptlib=''
7044else
dfe9444c 7045 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
2304df62 7046 if $test -z "$cryptlib"; then
dfe9444c 7047 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
2304df62
AD
7048 else
7049 cryptlib=-lcrypt
7050 fi
7051 if $test -z "$cryptlib"; then
dfe9444c 7052 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
2304df62
AD
7053 else
7054 cryptlib=-lcrypt
7055 fi
7056 if $test -z "$cryptlib"; then
dfe9444c 7057 cryptlib=`./loc libcrypt$_a "" $libpth`
2304df62
AD
7058 else
7059 cryptlib=-lcrypt
7060 fi
7061 if $test -z "$cryptlib"; then
7062 echo 'crypt() NOT found.' >&4
7063 val="$undef"
7064 else
7065 val="$define"
7066 fi
7067fi
7068set d_crypt
7069eval $setvar
7070
921b2963
JH
7071: get csh whereabouts
7072case "$csh" in
7073'csh') val="$undef" ;;
7074*) val="$define" ;;
7075esac
7076set d_csh
7077eval $setvar
7078: Respect a hint or command line value for full_csh.
7079case "$full_csh" in
7080'') full_csh=$csh ;;
7081esac
7082
a0d0e21e
LW
7083: see if cuserid exists
7084set cuserid d_cuserid
2304df62
AD
7085eval $inlibc
7086
a0d0e21e
LW
7087: see if this is a limits.h system
7088set limits.h i_limits
85e6fe83
LW
7089eval $inhdr
7090
a0d0e21e
LW
7091: see if this is a float.h system
7092set float.h i_float
7093eval $inhdr
7094
7095: See if number of significant digits in a double precision number is known
7096echo " "
7097$cat >dbl_dig.c <<EOM
7098#$i_limits I_LIMITS
7099#$i_float I_FLOAT
7100#ifdef I_LIMITS
7101#include <limits.h>
85e6fe83 7102#endif
a0d0e21e
LW
7103#ifdef I_FLOAT
7104#include <float.h>
7105#endif
7106#ifdef DBL_DIG
7107printf("Contains DBL_DIG");
85e6fe83 7108#endif
85e6fe83 7109EOM
a0d0e21e
LW
7110$cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
7111if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
7112 echo "DBL_DIG found." >&4
7113 val="$define"
2304df62 7114else
a0d0e21e
LW
7115 echo "DBL_DIG NOT found." >&4
7116 val="$undef"
2304df62 7117fi
a0d0e21e
LW
7118$rm -f dbl_dig.?
7119set d_dbl_dig
2304df62 7120eval $setvar
2304df62 7121
5ff3f7a4
GS
7122
7123if $test X"$use64bits" = X"$define"; then
7124 : see if dbminit64 exists
7125 set dbminit64 d_dbminit64
7126 eval $inlibc
7127
7128 : see if dbmclose64 exists
7129 set dbmclose64 d_dbmclose64
7130 eval $inlibc
7131
7132 : see if fetch64 exists
7133 set fetch64 d_fetch64
7134 eval $inlibc
7135
7136 : see if store64 exists
7137 set store64 d_store64
7138 eval $inlibc
7139
7140 : see if delete64 exists
7141 set delete64 d_delete64
7142 eval $inlibc
7143
7144 : see if firstkey64 exists
7145 set firstkey64 d_firstkey64
7146 eval $inlibc
7147
7148 : see if nextkey64 exists
7149 set nextkey64 d_nextkey64
7150 eval $inlibc
7151else
7152 val="$undef"
7153 for xxx in d_dbminit64 d_dbmclose64 d_fetch64 d_store64 d_delete64 d_firstkey64 d_nextkey64
7154 do
7155 set $xxx
7156 eval $setvar
7157 done
7158fi
7159
a0d0e21e
LW
7160: see if difftime exists
7161set difftime d_difftime
2304df62
AD
7162eval $inlibc
7163
5ff3f7a4
GS
7164: see if sys/stat.h is available
7165set sys/stat.h i_sysstat
7166eval $inhdr
7167
a0d0e21e
LW
7168: see if this is a dirent system
7169echo " "
7170if xinc=`./findhdr dirent.h`; $test "$xinc"; then
7171 val="$define"
7172 echo "<dirent.h> found." >&4
7173else
7174 val="$undef"
7175 if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
7176 echo "<sys/dir.h> found." >&4
7177 echo " "
7178 else
7179 xinc=`./findhdr sys/ndir.h`
7180 fi
7181 echo "<dirent.h> NOT found." >&4
7182fi
7183set i_dirent
7184eval $setvar
7185
7186: Look for type of directory structure.
7187echo " "
7188$cppstdin $cppflags $cppminus < "$xinc" > try.c
7189
7190case "$direntrytype" in
7191''|' ')
7192 case "$i_dirent" in
7193 $define) guess1='struct dirent' ;;
7194 *) guess1='struct direct' ;;
2afac517 7195 esac
7196 ;;
7197*) guess1="$direntrytype"
7198 ;;
8e07c86e
AD
7199esac
7200
2afac517 7201case "$guess1" in
7202'struct dirent') guess2='struct direct' ;;
7203*) guess2='struct dirent' ;;
7204esac
7205
7206if $contains "$guess1" try.c >/dev/null 2>&1; then
7207 direntrytype="$guess1"
7208 echo "Your directory entries are $direntrytype." >&4
7209elif $contains "$guess2" try.c >/dev/null 2>&1; then
7210 direntrytype="$guess2"
7211 echo "Your directory entries seem to be $direntrytype." >&4
7212else
7213 echo "I don't recognize your system's directory entries." >&4
7214 rp="What type is used for directory entries on this system?"
7215 dflt="$guess1"
7216 . ./myread
7217 direntrytype="$ans"
7218fi
7219$rm -f try.c
a0d0e21e 7220
a0d0e21e 7221
2afac517 7222: see if the directory entry stores field length
7223echo " "
7224$cppstdin $cppflags $cppminus < "$xinc" > try.c
7225if $contains 'd_namlen' try.c >/dev/null 2>&1; then
7226 echo "Good, your directory entry keeps length information in d_namlen." >&4
7227 val="$define"
7228else
7229 echo "Your directory entry does not know about the d_namlen field." >&4
7230 val="$undef"
7231fi
7232set d_dirnamlen
7233eval $setvar
7234$rm -f try.c
a0d0e21e 7235
a0d0e21e 7236
5ff3f7a4
GS
7237if $test X"$use64bits" = X"$define"; then
7238 : see if fstat64 exists
7239 set fstat64 d_fstat64
7240 eval $inlibc
a0d0e21e 7241
5ff3f7a4
GS
7242 : see if ftruncate64 exists
7243 set ftruncate64 d_ftruncate64
7244 eval $inlibc
a0d0e21e 7245
5ff3f7a4
GS
7246 : see if lockf64 exists
7247 set lockf64 d_lockf64
7248 eval $inlibc
a0d0e21e 7249
2000072c
JH
7250 : see if llseek exists
7251 set llseek d_llseek
7252 eval $inlibc
7253
5ff3f7a4
GS
7254 : see if lseek64 exists
7255 set lseek64 d_lseek64
7256 eval $inlibc
7257
7258 : see if lstat64 exists
7259 set lstat64 d_lstat64
7260 eval $inlibc
7261
7262 : see if open64 exists
7263 set open64 d_open64
7264 eval $inlibc
7265
7266 : see if opendir64 exists
7267 set opendir64 d_opendir64
7268 eval $inlibc
7269
7270 : see if readdir64 exists
7271 set readdir64 d_readdir64
7272 eval $inlibc
7273
7274 : see if seekdir64 exists
7275 set seekdir64 d_seekdir64
7276 eval $inlibc
7277
7278 : see if stat64 exists
7279 set stat64 d_stat64
7280 eval $inlibc
7281
7282 : see if telldir64 exists
7283 set telldir64 d_telldir64
7284 eval $inlibc
7285
7286 : see if truncate64 exists
7287 set truncate64 d_truncate64
7288 eval $inlibc
7289
7290 : check for off64_t
7291 echo " "
7292 echo $n "Checking to see if your system supports off64_t...$c" >&4
7293 $cat >try.c <<EOCP
7294#include <sys/types.h>
ca11f38f 7295#include <unistd.h>
5ff3f7a4
GS
7296off64_t foo() { off64_t x; x = 7; return x; }'
7297EOCP
7298 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
7299 val="$define"
7300 echo " Yup, it does." >&4
7301 else
7302 val="$undef"
7303 echo " Nope, it doesn't." >&4
7304 fi
7305 $rm -f try.*
2000072c
JH
7306 set d_off64_t
7307 eval $setvar
7308
7309 : check for offset_t
7310 echo " "
7311 echo $n "Checking to see if your system supports offset_t...$c" >&4
7312 $cat >try.c <<EOCP
7313#include <sys/types.h>
ca11f38f 7314#include <unistd.h>
2000072c
JH
7315offset_t foo() { offset_t x; x = 7; return x; }'
7316EOCP
7317 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
7318 val="$define"
7319 echo " Yup, it does." >&4
7320 else
7321 val="$undef"
7322 echo " Nope, it doesn't." >&4
7323 fi
7324 $rm -f try.*
7325 set d_offset_t
5ff3f7a4
GS
7326 eval $setvar
7327
7328 : check for ino64_t
7329 echo " "
7330 echo $n "Checking to see if your system supports ino64_t...$c" >&4
7331 val="$undef"
7332 case "$i_sysstat" in
7333 "$define" )
7334 $cat >try.c <<EOCP
7335#include <sys/types.h>
7336#include <sys/stat.h>
7337ino64_t foo() { ino64_t x; x = 7; return x; }'
7338EOCP
7339 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
7340 val="$define"
7341 fi
7342 $rm -f try.*
7343 ;;
7344 esac
7345 if $test "X$val" = X"$define"; then
7346 echo " Yup, it does." >&4
7347 else
7348 echo " Nope, it doesn't." >&4
7349 fi
2000072c 7350 set d_ino64_t
5ff3f7a4
GS
7351 eval $setvar
7352
7353 : check for struct flock64
7354 echo " "
85ab1d1d 7355 echo "Checking to see if your system supports struct flock64..." >&4
5ff3f7a4 7356 if $h_fcntl; then
de4597cb 7357 set d_flock64_s flock64 l_len define fcntl.h
5ff3f7a4 7358 eval $hasfield
85ab1d1d
JH
7359 else
7360 val="$undef"
de4597cb 7361 set d_flock64_s
85ab1d1d 7362 eval $setvar
5ff3f7a4 7363 fi
de4597cb 7364 case "$d_flock64_s" in
85ab1d1d
JH
7365 "$define") echo "Yup, it does." >&4
7366 ;;
7367 *) echo "Nope, it doesn't." >&4
7368 ;;
7369 esac
5ff3f7a4
GS
7370
7371 : check for struct dirent64
7372 echo " "
85ab1d1d 7373 echo "Checking to see if your system supports struct dirent64..." >&4
de4597cb 7374 set d_dirent64_s dirent64 d_off $i_dirent dirent.h
5ff3f7a4 7375 eval $hasfield
de4597cb 7376 case "$d_dirent64_s" in
85ab1d1d
JH
7377 "$define") echo "Yup, it does." >&4
7378 ;;
7379 *) echo "Nope, it doesn't." >&4
7380 ;;
7381 esac
7382
5ff3f7a4
GS
7383else
7384 val="$undef"
2000072c 7385 for xxx in d_fstat64 d_ftruncate64 d_lockf64 d_lseek64 d_lstat64 d_open64 d_opendir64 d_readdir64 d_seekdir64 d_stat64 d_telldir64 d_truncate64 d_off64_t d_offset_t d_ino64_t d_flock64_s d_dirent64_s
5ff3f7a4
GS
7386 do
7387 set $xxx
7388 eval $setvar
7389 done
7390fi
7391
7392: see if dlerror exists
7393xxx_runnm="$runnm"
7394runnm=false
7395set dlerror d_dlerror
7396eval $inlibc
7397runnm="$xxx_runnm"
7398
7399: see if dlfcn is available
7400set dlfcn.h i_dlfcn
7401eval $inhdr
7402
7403case "$usedl" in
7404$define|y|true)
7405 $cat << EOM
7406
7407On a few systems, the dynamically loaded modules that perl generates and uses
7408will need a different extension than shared libs. The default will probably
7409be appropriate.
7410
7411EOM
7412 case "$dlext" in
7413 '') dflt="$so" ;;
7414 *) dflt="$dlext" ;;
7415 esac
7416 rp='What is the extension of dynamically loaded modules'
7417 . ./myread
7418 dlext="$ans"
7419 ;;
7420*)
7421 dlext="none"
7422 ;;
7423esac
7424
7425: Check if dlsym need a leading underscore
a0d0e21e
LW
7426echo " "
7427val="$undef"
7428
7429case "$dlsrc" in
7430dl_dlopen.xs)
7431 echo "Checking whether your dlsym() needs a leading underscore ..." >&4
7432 $cat >dyna.c <<'EOM'
7433fred () { }
7434EOM
7435
7436$cat >fred.c<<EOM
7437
7438#include <stdio.h>
7439#$i_dlfcn I_DLFCN
7440#ifdef I_DLFCN
7441#include <dlfcn.h> /* the dynamic linker include file for Sunos/Solaris */
7442#else
7443#include <sys/types.h>
7444#include <nlist.h>
7445#include <link.h>
7446#endif
7447
7448extern int fred() ;
7449
5a411a32 7450int main()
a0d0e21e
LW
7451{
7452 void * handle ;
7453 void * symbol ;
7454#ifndef RTLD_LAZY
7455 int mode = 1 ;
7456#else
7457 int mode = RTLD_LAZY ;
7458#endif
7459 handle = dlopen("./dyna.$dlext", mode) ;
7460 if (handle == NULL) {
5f05dabc 7461 printf ("1\n") ;
7462 fflush (stdout) ;
7463 exit(0);
a0d0e21e
LW
7464 }
7465 symbol = dlsym(handle, "fred") ;
7466 if (symbol == NULL) {
5f05dabc 7467 /* try putting a leading underscore */
7468 symbol = dlsym(handle, "_fred") ;
7469 if (symbol == NULL) {
7470 printf ("2\n") ;
7471 fflush (stdout) ;
7472 exit(0);
7473 }
7474 printf ("3\n") ;
a0d0e21e
LW
7475 }
7476 else
5f05dabc 7477 printf ("4\n") ;
36477c24 7478 fflush (stdout) ;
7479 exit(0);
a0d0e21e
LW
7480}
7481EOM
760ac839 7482 : Call the object file tmp-dyna.o in case dlext=o.
a0d0e21e 7483 if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
dfe9444c
AD
7484 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
7485 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 &&
87563a30 7486 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
a0d0e21e
LW
7487 xxx=`./fred`
7488 case $xxx in
7489 1) echo "Test program failed using dlopen." >&4
7490 echo "Perhaps you should not use dynamic loading." >&4;;
7491 2) echo "Test program failed using dlsym." >&4
7492 echo "Perhaps you should not use dynamic loading." >&4;;
7493 3) echo "dlsym needs a leading underscore" >&4
7494 val="$define" ;;
7495 4) echo "dlsym doesn't need a leading underscore." >&4;;
7496 esac
7497 else
7498 echo "I can't compile and run the test program." >&4
7499 fi
7500 ;;
7501esac
7502
a78b0d02 7503$rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
a0d0e21e
LW
7504
7505set d_dlsymun
7506eval $setvar
7507
85ab1d1d
JH
7508hasproto='varname=$1; func=$2; shift; shift;
7509while $test $# -ge 2; do
7510 case "$1" in
7511 $define) echo "#include <$2>";;
7512 esac ;
7513 shift 2;
7514done > try.c;
7515$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
7516if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
7517 echo "$func() prototype found.";
7518 val="$define";
7519else
7520 echo "$func() prototype NOT found.";
7521 val="$undef";
7522fi;
7523set $varname;
7524eval $setvar;
7525$rm -f try.c tryout.c'
7526
7527: see if prototype for drand48 is available
7528echo " "
7529set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
7530eval $hasproto
7531
a0d0e21e
LW
7532: see if dup2 exists
7533set dup2 d_dup2
7534eval $inlibc
7535
5ff3f7a4
GS
7536: see if eaccess exists
7537set eaccess d_eaccess
7538eval $inlibc
7539
7540: see if endgrent exists
7541set endgrent d_endgrent
7542eval $inlibc
7543
e5c9fcd0
AD
7544: see if endhostent exists
7545set endhostent d_endhent
7546eval $inlibc
7547
7548: see if endnetent exists
7549set endnetent d_endnent
7550eval $inlibc
7551
7552: see if endprotoent exists
7553set endprotoent d_endpent
7554eval $inlibc
7555
5ff3f7a4
GS
7556: see if endpwent exists
7557set endpwent d_endpwent
7558eval $inlibc
7559
e5c9fcd0
AD
7560: see if endservent exists
7561set endservent d_endsent
7562eval $inlibc
7563
8e07c86e
AD
7564: Locate the flags for 'open()'
7565echo " "
7566$cat >open3.c <<'EOCP'
7567#include <sys/types.h>
7568#ifdef I_FCNTL
7569#include <fcntl.h>
7570#endif
7571#ifdef I_SYS_FILE
7572#include <sys/file.h>
7573#endif
d674cd6d 7574int main() {
8e07c86e
AD
7575 if(O_RDONLY);
7576#ifdef O_TRUNC
7577 exit(0);
7578#else
7579 exit(1);
7580#endif
7581}
7582EOCP
7583: check sys/file.h first to get FREAD on Sun
7584if $test `./findhdr sys/file.h` && \
dfe9444c 7585 set open3 -DI_SYS_FILE && eval $compile; then
8e07c86e
AD
7586 h_sysfile=true;
7587 echo "<sys/file.h> defines the O_* constants..." >&4
7588 if ./open3; then
7589 echo "and you have the 3 argument form of open()." >&4
7590 val="$define"
7591 else
7592 echo "but not the 3 argument form of open(). Oh, well." >&4
7593 val="$undef"
7594 fi
7595elif $test `./findhdr fcntl.h` && \
dfe9444c 7596 set open3 -DI_FCNTL && eval $compile; then
8e07c86e
AD
7597 h_fcntl=true;
7598 echo "<fcntl.h> defines the O_* constants..." >&4
7599 if ./open3; then
7600 echo "and you have the 3 argument form of open()." >&4
7601 val="$define"
7602 else
7603 echo "but not the 3 argument form of open(). Oh, well." >&4
7604 val="$undef"
7605 fi
7606else
7607 val="$undef"
7608 echo "I can't find the O_* constant definitions! You got problems." >&4
7609fi
7610set d_open3
7611eval $setvar
7612$rm -f open3*
7613
7614: check for non-blocking I/O stuff
7615case "$h_sysfile" in
7616true) echo "#include <sys/file.h>" > head.c;;
7617*)
7618 case "$h_fcntl" in
7619 true) echo "#include <fcntl.h>" > head.c;;
7620 *) echo "#include <sys/fcntl.h>" > head.c;;
7621 esac
7622 ;;
7623esac
7624echo " "
7625echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
7626case "$o_nonblock" in
7627'')
7628 $cat head.c > try.c
7629 $cat >>try.c <<'EOCP'
d674cd6d 7630int main() {
8e07c86e
AD
7631#ifdef O_NONBLOCK
7632 printf("O_NONBLOCK\n");
7633 exit(0);
7634#endif
7635#ifdef O_NDELAY
7636 printf("O_NDELAY\n");
7637 exit(0);
7638#endif
7639#ifdef FNDELAY
7640 printf("FNDELAY\n");
7641 exit(0);
7642#endif
7643 exit(0);
7644}
7645EOCP
dfe9444c 7646 set try
dc45a647 7647 if eval $compile_ok; then
8e07c86e
AD
7648 o_nonblock=`./try`
7649 case "$o_nonblock" in
7650 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
7651 *) echo "Seems like we can use $o_nonblock.";;
7652 esac
7653 else
7654 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
7655 fi
7656 ;;
7657*) echo "Using $hint value $o_nonblock.";;
7658esac
7659$rm -f try try.* .out core
7660
7661echo " "
7662echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
7663case "$eagain" in
7664'')
7665 $cat head.c > try.c
7666 $cat >>try.c <<EOCP
7667#include <errno.h>
7668#include <sys/types.h>
7669#include <signal.h>
4633a7c4 7670#define MY_O_NONBLOCK $o_nonblock
dc45a647 7671#ifndef errno /* XXX need better Configure test */
8e07c86e 7672extern int errno;
dc45a647 7673#endif
8e07c86e 7674$signal_t blech(x) int x; { exit(3); }
4633a7c4
LW
7675EOCP
7676 $cat >> try.c <<'EOCP'
d674cd6d 7677int main()
8e07c86e
AD
7678{
7679 int pd[2];
7680 int pu[2];
7681 char buf[1];
7682 char string[100];
7683
7684 pipe(pd); /* Down: child -> parent */
7685 pipe(pu); /* Up: parent -> child */
7686 if (0 != fork()) {
7687 int ret;
7688 close(pd[1]); /* Parent reads from pd[0] */
7689 close(pu[0]); /* Parent writes (blocking) to pu[1] */
4633a7c4 7690 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8e07c86e
AD
7691 exit(1);
7692 signal(SIGALRM, blech);
7693 alarm(5);
7694 if ((ret = read(pd[0], buf, 1)) > 0) /* Nothing to read! */
7695 exit(2);
7696 sprintf(string, "%d\n", ret);
7697 write(2, string, strlen(string));
7698 alarm(0);
7699#ifdef EAGAIN
7700 if (errno == EAGAIN) {
7701 printf("EAGAIN\n");
7702 goto ok;
7703 }
7704#endif
7705#ifdef EWOULDBLOCK
7706 if (errno == EWOULDBLOCK)
7707 printf("EWOULDBLOCK\n");
7708#endif
7709 ok:
7710 write(pu[1], buf, 1); /* Unblocks child, tell it to close our pipe */
7711 sleep(2); /* Give it time to close our pipe */
7712 alarm(5);
7713 ret = read(pd[0], buf, 1); /* Should read EOF */
7714 alarm(0);
7715 sprintf(string, "%d\n", ret);
7716 write(3, string, strlen(string));
7717 exit(0);
7718 }
7719
7720 close(pd[0]); /* We write to pd[1] */
7721 close(pu[1]); /* We read from pu[0] */
7722 read(pu[0], buf, 1); /* Wait for parent to signal us we may continue */
7723 close(pd[1]); /* Pipe pd is now fully closed! */
7724 exit(0); /* Bye bye, thank you for playing! */
7725}
7726EOCP
dfe9444c 7727 set try
dc45a647 7728 if eval $compile_ok; then
774d564b 7729 echo "$startsh" >mtry
40a7a20a 7730 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8e07c86e
AD
7731 chmod +x mtry
7732 ./mtry >/dev/null 2>&1
7733 case $? in
7734 0) eagain=`$cat try.out`;;
7735 1) echo "Could not perform non-blocking setting!";;
7736 2) echo "I did a successful read() for something that was not there!";;
7737 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
7738 *) echo "Something terribly wrong happened during testing.";;
7739 esac
7740 rd_nodata=`$cat try.ret`
7741 echo "A read() system call with no data present returns $rd_nodata."
7742 case "$rd_nodata" in
7743 0|-1) ;;
7744 *)
7745 echo "(That's peculiar, fixing that to be -1.)"
7746 rd_nodata=-1
7747 ;;
7748 esac
7749 case "$eagain" in
7750 '')
7751 echo "Forcing errno EAGAIN on read() with no data available."
7752 eagain=EAGAIN
7753 ;;
7754 *)
7755 echo "Your read() sets errno to $eagain when no data is available."
7756 ;;
7757 esac
7758 status=`$cat try.err`
7759 case "$status" in
7760 0) echo "And it correctly returns 0 to signal EOF.";;
7761 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
7762 *) echo "However, your read() returns '$status' on EOF??";;
7763 esac
7764 val="$define"
28757baa 7765 if test "$status" = "$rd_nodata"; then
8e07c86e
AD
7766 echo "WARNING: you can't distinguish between EOF and no data!"
7767 val="$undef"
7768 fi
7769 else
7770 echo "I can't compile the test program--assuming errno EAGAIN will do."
7771 eagain=EAGAIN
7772 fi
7773 set d_eofnblk
7774 eval $setvar
7775 ;;
7776*)
7777 echo "Using $hint value $eagain."
7778 echo "Your read() returns $rd_nodata when no data is present."
7779 case "$d_eofnblk" in
7780 "$define") echo "And you can see EOF because read() returns 0.";;
7781 "$undef") echo "But you can't see EOF status from read() returned value.";;
7782 *)
7783 echo "(Assuming you can't see EOF status from read anyway.)"
7784 d_eofnblk=$undef
7785 ;;
7786 esac
7787 ;;
7788esac
7789$rm -f try try.* .out core head.c mtry
7790
a0d0e21e
LW
7791: see if fchmod exists
7792set fchmod d_fchmod
7793eval $inlibc
7794
7795: see if fchown exists
7796set fchown d_fchown
7797eval $inlibc
7798
7799: see if this is an fcntl system
7800set fcntl d_fcntl
7801eval $inlibc
7802
921b2963
JH
7803: see if sys/select.h has to be included
7804set sys/select.h i_sysselct
7805eval $inhdr
7806
7807: see if we should include time.h, sys/time.h, or both
7808echo " "
7809if test "X$timeincl" = X; then
7810 echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
7811 $echo $n "I'm now running the test program...$c"
7812 $cat >try.c <<'EOCP'
7813#include <sys/types.h>
7814#ifdef I_TIME
7815#include <time.h>
7816#endif
7817#ifdef I_SYSTIME
7818#ifdef SYSTIMEKERNEL
7819#define KERNEL
7820#endif
7821#include <sys/time.h>
7822#endif
7823#ifdef I_SYSSELECT
7824#include <sys/select.h>
7825#endif
d674cd6d 7826int main()
921b2963
JH
7827{
7828 struct tm foo;
7829#ifdef S_TIMEVAL
7830 struct timeval bar;
7831#endif
7832#ifdef S_TIMEZONE
7833 struct timezone tzp;
7834#endif
7835 if (foo.tm_sec == foo.tm_sec)
7836 exit(0);
7837#ifdef S_TIMEVAL
7838 if (bar.tv_sec == bar.tv_sec)
7839 exit(0);
7840#endif
7841 exit(1);
7842}
7843EOCP
7844 flags=''
7845 for s_timezone in '-DS_TIMEZONE' ''; do
7846 sysselect=''
7847 for s_timeval in '-DS_TIMEVAL' ''; do
7848 for i_systimek in '' '-DSYSTIMEKERNEL'; do
7849 for i_time in '' '-DI_TIME'; do
7850 for i_systime in '-DI_SYSTIME' ''; do
7851 case "$flags" in
7852 '') $echo $n ".$c"
7853 set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
7854 if eval $compile; then
7855 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
7856 shift
7857 flags="$*"
7858 echo " "
7859 $echo $n "Succeeded with $flags$c"
7860 fi
7861 ;;
7862 esac
7863 done
7864 done
7865 done
7866 done
7867 done
7868 timeincl=''
7869 echo " "
7870 case "$flags" in
7871 *SYSTIMEKERNEL*) i_systimek="$define"
7872 timeincl=`./findhdr sys/time.h`
7873 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
7874 *) i_systimek="$undef";;
7875 esac
7876 case "$flags" in
7877 *I_TIME*) i_time="$define"
7878 timeincl=`./findhdr time.h`" $timeincl"
7879 echo "We'll include <time.h>." >&4;;
7880 *) i_time="$undef";;
7881 esac
7882 case "$flags" in
7883 *I_SYSTIME*) i_systime="$define"
7884 timeincl=`./findhdr sys/time.h`" $timeincl"
7885 echo "We'll include <sys/time.h>." >&4;;
7886 *) i_systime="$undef";;
7887 esac
7888 $rm -f try.c try
7889fi
7890
7891: check for fd_set items
7892$cat <<EOM
7893
7894Checking to see how well your C compiler handles fd_set and friends ...
7895EOM
7896$cat >fd_set.c <<EOCP
7897#$i_systime I_SYS_TIME
7898#$i_sysselct I_SYS_SELECT
7899#$d_socket HAS_SOCKET
7900#include <sys/types.h>
7901#ifdef HAS_SOCKET
7902#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
7903#endif
7904#ifdef I_SYS_TIME
7905#include <sys/time.h>
7906#endif
7907#ifdef I_SYS_SELECT
7908#include <sys/select.h>
7909#endif
d674cd6d 7910int main() {
921b2963
JH
7911 fd_set fds;
7912
7913#ifdef TRYBITS
7914 if(fds.fds_bits);
7915#endif
7916
7917#if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
7918 exit(0);
7919#else
7920 exit(1);
7921#endif
7922}
7923EOCP
7924set fd_set -DTRYBITS
7925if eval $compile; then
7926 d_fds_bits="$define"
7927 d_fd_set="$define"
7928 echo "Well, your system knows about the normal fd_set typedef..." >&4
7929 if ./fd_set; then
7930 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
7931 d_fd_macros="$define"
7932 else
7933 $cat >&4 <<'EOM'
7934but not the normal fd_set macros! Gaaack! I'll have to cover for you.
7935EOM
7936 d_fd_macros="$undef"
7937 fi
7938else
7939 $cat <<'EOM'
7940Hmm, your compiler has some difficulty with fd_set. Checking further...
7941EOM
7942 set fd_set
7943 if eval $compile; then
7944 d_fds_bits="$undef"
7945 d_fd_set="$define"
7946 echo "Well, your system has some sort of fd_set available..." >&4
7947 if ./fd_set; then
7948 echo "and you have the normal fd_set macros." >&4
7949 d_fd_macros="$define"
7950 else
7951 $cat <<'EOM'
7952but not the normal fd_set macros! Gross! More work for me...
7953EOM
7954 d_fd_macros="$undef"
7955 fi
7956 else
7957 echo "Well, you got zip. That's OK, I can roll my own fd_set stuff." >&4
7958 d_fd_set="$undef"
7959 d_fds_bits="$undef"
7960 d_fd_macros="$undef"
7961 fi
7962fi
7963$rm -f fd_set*
7964
a0d0e21e
LW
7965: see if fgetpos exists
7966set fgetpos d_fgetpos
7967eval $inlibc
7968
5ff3f7a4
GS
7969
7970if $test X"$use64bits" = X"$define"; then
7971 : see if fgetpos64 exists
7972 set fgetpos64 d_fgetpos64
7973 eval $inlibc
7974
7975 : see if fopen64 exists
7976 set freopen64 d_fopen64
7977 eval $inlibc
7978
7979 : see if freopen64 exists
7980 set freopen64 d_freopen64
7981 eval $inlibc
7982
7983 : see if fseek64 exists
7984 set fseek64 d_fseek64
7985 eval $inlibc
7986
7987 : see if fseeko64 exists
7988 set fseeko64 d_fseeko64
7989 eval $inlibc
7990
7991 : see if fsetpos64 exists
7992 set fsetpos64 d_fsetpos64
7993 eval $inlibc
7994
7995 : see if ftell64 exists
7996 set ftell64 d_ftell64
7997 eval $inlibc
7998
7999 : see if ftello64 exists
8000 set ftello64 d_ftello64
8001 eval $inlibc
8002
8003 : see if tmpfile64 exists
8004 set tmpfile64 d_tmpfile64
8005 eval $inlibc
8006else
8007 val="$undef"
8008 for xxx in d_fgetpos64 d_fopen64 d_freopen64 d_fseek64 d_fseeko64 d_fsetpos64 d_ftell64 d_ftello64 d_tmpfile64
8009 do
8010 set $xxx
8011 eval $setvar
8012 done
8013fi
9cc6feab 8014
a0d0e21e
LW
8015: see if flock exists
8016set flock d_flock
8017eval $inlibc
8018
a0d0e21e
LW
8019: see if fork exists
8020set fork d_fork
8021eval $inlibc
8022
8023: see if pathconf exists
8024set pathconf d_pathconf
8025eval $inlibc
8026
8027: see if fpathconf exists
8028set fpathconf d_fpathconf
8029eval $inlibc
8030
5ff3f7a4
GS
8031: see if fseeko exists
8032set fseeko d_fseeko
8033eval $inlibc
8034
a0d0e21e
LW
8035: see if fsetpos exists
8036set fsetpos d_fsetpos
8037eval $inlibc
8038
9b9c89a3
JH
8039: see if this is a sys/param system
8040set sys/param.h i_sysparam
8041eval $inhdr
8042
104d25b7
JH
8043: see if this is a sys/mount.h system
8044set sys/mount.h i_sysmount
8045eval $inhdr
8046
8047
8048: see if statfs exists
8049set statfs d_statfs
8050eval $inlibc
8051
8052: see if fstatfs exists
8053set fstatfs d_fstatfs
8054eval $inlibc
8055
8056: see if statfs knows about mount flags
9b9c89a3 8057set d_statfsflags statfs f_flags $i_sysparam sys/param.h $i_sysmount sys/mount.h
104d25b7
JH
8058eval $hasfield
8059
8060
8061: see if statvfs exists
8062set statvfs d_statvfs
8063eval $inlibc
8064
8065: see if fstatvfs exists
8066set fstatvfs d_fstatvfs
8067eval $inlibc
8068
8069
5ff3f7a4
GS
8070: see if ftello exists
8071set ftello d_ftello
8072eval $inlibc
8073
8074: see if getgrent exists
8075set getgrent d_getgrent
8076eval $inlibc
8077
693762b4
AD
8078: see if gethostbyaddr exists
8079set gethostbyaddr d_gethbyaddr
8080eval $inlibc
8081
8082: see if gethostbyname exists
8083set gethostbyname d_gethbyname
8084eval $inlibc
8085
a0d0e21e
LW
8086: see if gethostent exists
8087set gethostent d_gethent
8088eval $inlibc
8089
921b2963
JH
8090: see how we will look up host name
8091echo " "
a63faeb8
JH
8092call=''
8093if set gethostname val -f d_gethname; eval $csym; $val; then
921b2963
JH
8094 echo 'gethostname() found.' >&4
8095 d_gethname="$define"
8096 call=gethostname
a63faeb8
JH
8097fi
8098if set uname val -f d_uname; eval $csym; $val; then
921b2963
JH
8099 if ./xenix; then
8100 $cat <<'EOM'
8101uname() was found, but you're running xenix, and older versions of xenix
8102have a broken uname(). If you don't really know whether your xenix is old
8103enough to have a broken system call, use the default answer.
8104
8105EOM
8106 dflt=y
8107 case "$d_uname" in
8108 "$define") dflt=n;;
8109 esac
8110 rp='Is your uname() broken?'
8111 . ./myread
8112 case "$ans" in
8113 n*) d_uname="$define"; call=uname;;
8114 esac
8115 else
8116 echo 'uname() found.' >&4
8117 d_uname="$define"
a63faeb8
JH
8118 case "$call" in
8119 '') call=uname ;;
8120 esac
921b2963
JH
8121 fi
8122fi
8123case "$d_gethname" in
8124'') d_gethname="$undef";;
8125esac
8126case "$d_uname" in
8127'') d_uname="$undef";;
8128esac
8129case "$d_uname$d_gethname" in
8130*define*)
8131 dflt=n
8132 cat <<EOM
8133
8134Every now and then someone has a $call() that lies about the hostname
8135but can't be fixed for political or economic reasons. If you wish, I can
8136pretend $call() isn't there and maybe compute hostname at run-time
8137thanks to the '$phostname' command.
8138
8139EOM
8140 rp="Shall I ignore $call() from now on?"
8141 . ./myread
8142 case "$ans" in
8143 y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
8144 esac;;
8145esac
8146case "$phostname" in
8147'') aphostname='';;
8148*) case "$aphostname" in
8149 /*) ;;
8150 *) set X $phostname
8151 shift
8152 file=$1
8153 shift
8154 file=`./loc $file $file $pth`
8155 aphostname=`echo $file $*`
8156 ;;
8157 esac
8158 ;;
8159esac
8160case "$d_uname$d_gethname" in
8161*define*) ;;
8162*)
8163 case "$phostname" in
8164 '')
8165 echo "There will be no way for $package to get your hostname." >&4;;
8166 *)
8167 echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
8168 ;;
8169 esac;;
8170esac
8171case "$d_phostname" in
8172'') d_phostname="$undef";;
8173esac
8174
dc45a647
MB
8175: see if this is a netdb.h system
8176set netdb.h i_netdb
8177eval $inhdr
8178
8179: see if prototypes for various gethostxxx netdb.h functions are available
8180echo " "
8181set d_gethostprotos gethostent $i_netdb netdb.h
8182eval $hasproto
8183
a0d0e21e
LW
8184: see if getlogin exists
8185set getlogin d_getlogin
8186eval $inlibc
8187
ccc7f9b3
KS
8188: see if getmntent exists
8189set getmntent d_getmntent
8190eval $inlibc
8191
693762b4
AD
8192: see if getnetbyaddr exists
8193set getnetbyaddr d_getnbyaddr
8194eval $inlibc
8195
8196: see if getnetbyname exists
8197set getnetbyname d_getnbyname
8198eval $inlibc
8199
e5c9fcd0
AD
8200: see if getnetent exists
8201set getnetent d_getnent
8202eval $inlibc
8203
dc45a647
MB
8204: see if prototypes for various getnetxxx netdb.h functions are available
8205echo " "
8206set d_getnetprotos getnetent $i_netdb netdb.h
8207eval $hasproto
8208
693762b4
AD
8209
8210: see if getprotobyname exists
8211set getprotobyname d_getpbyname
8212eval $inlibc
8213
8214: see if getprotobynumber exists
8215set getprotobynumber d_getpbynumber
8216eval $inlibc
e5c9fcd0
AD
8217
8218: see if getprotoent exists
8219set getprotoent d_getpent
8220eval $inlibc
8221
2afac517 8222: see if getpgid exists
8223set getpgid d_getpgid
a0d0e21e
LW
8224eval $inlibc
8225
8226: see if getpgrp2 exists
8227set getpgrp2 d_getpgrp2
8228eval $inlibc
8229
8230: see if getppid exists
8231set getppid d_getppid
8232eval $inlibc
8233
8234: see if getpriority exists
8235set getpriority d_getprior
8236eval $inlibc
8237
dc45a647
MB
8238: see if prototypes for various getprotoxxx netdb.h functions are available
8239echo " "
8240set d_getprotoprotos getprotoent $i_netdb netdb.h
8241eval $hasproto
8242
5ff3f7a4
GS
8243: see if getpwent exists
8244set getpwent d_getpwent
8245eval $inlibc
8246
8247
693762b4
AD
8248: see if getservbyname exists
8249set getservbyname d_getsbyname
8250eval $inlibc
8251
8252: see if getservbyport exists
8253set getservbyport d_getsbyport
8254eval $inlibc
e5c9fcd0
AD
8255
8256: see if getservent exists
8257set getservent d_getsent
8258eval $inlibc
8259
dc45a647
MB
8260: see if prototypes for various getservxxx netdb.h functions are available
8261echo " "
8262set d_getservprotos getservent $i_netdb netdb.h
8263eval $hasproto
8264
5f05dabc 8265: see if gettimeofday or ftime exists
8266set gettimeofday d_gettimeod
8267eval $inlibc
8268case "$d_gettimeod" in
8269"$undef")
8270 set ftime d_ftime
8271 eval $inlibc
8272 ;;
8273*)
8274 val="$undef"; set d_ftime; eval $setvar
8275 ;;
8276esac
8277case "$d_gettimeod$d_ftime" in
8278"$undef$undef")
8279 echo " "
8280 echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
8281 ;;
8282esac
8283
5ff3f7a4
GS
8284: see if this is an grp system
8285set grp.h i_grp
8286eval $inhdr
8287
8288case "$i_grp" in
8289$define)
8290 xxx=`./findhdr grp.h`
8291 $cppstdin $cppflags $cppminus < $xxx >$$.h
8292
8293 if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
8294 val="$define"
8295 else
8296 val="$undef"
8297 fi
8298 set d_grpasswd
8299 eval $setvar
8300
8301 $rm -f $$.h
8302 ;;
8303*)
8304 val="$undef";
8305 set d_grpasswd; eval $setvar
8306 ;;
8307esac
8308
ccc7f9b3
KS
8309: see if hasmntopt exists
8310set hasmntopt d_hasmntopt
8311eval $inlibc
8312
a0d0e21e
LW
8313: see if this is a netinet/in.h or sys/in.h system
8314set netinet/in.h i_niin sys/in.h i_sysin
8315eval $inhdr
8316
5ff3f7a4 8317: see if arpa/inet.h has to be included
93341792 8318set arpa/inet.h i_arpainet
28e8609d
JH
8319eval $inhdr
8320
a0d0e21e
LW
8321: see if htonl --and friends-- exists
8322val=''
8323set htonl val
8324eval $inlibc
8325
8326: Maybe they are macros.
8327case "$val" in
8328$undef)
8329 $cat >htonl.c <<EOM
8330#include <stdio.h>
8331#include <sys/types.h>
8332#$i_niin I_NETINET_IN
8333#$i_sysin I_SYS_IN
93341792 8334#$i_arpainet I_ARPA_INET
a0d0e21e
LW
8335#ifdef I_NETINET_IN
8336#include <netinet/in.h>
8337#endif
8338#ifdef I_SYS_IN
8339#include <sys/in.h>
8340#endif
28e8609d
JH
8341#ifdef I_ARPA_INET
8342#include <arpa/inet.h>
8343#endif
a0d0e21e
LW
8344#ifdef htonl
8345printf("Defined as a macro.");
8346#endif
8347EOM
8348 $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
8349 if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
8350 val="$define"
8351 echo "But it seems to be defined as a macro." >&4
8352 fi
8353 $rm -f htonl.?
8354 ;;
8355esac
8356set d_htonl
8357eval $setvar
8358
8359: see which of string.h or strings.h is needed
8360echo " "
8361strings=`./findhdr string.h`
8362if $test "$strings" && $test -r "$strings"; then
8363 echo "Using <string.h> instead of <strings.h>." >&4
8364 val="$define"
8365else
8366 val="$undef"
8367 strings=`./findhdr strings.h`
8368 if $test "$strings" && $test -r "$strings"; then
8369 echo "Using <strings.h> instead of <string.h>." >&4
8370 else
8371 echo "No string header found -- You'll surely have problems." >&4
8372 fi
8373fi
8374set i_string
8375eval $setvar
8376case "$i_string" in
8377"$undef") strings=`./findhdr strings.h`;;
8378*) strings=`./findhdr string.h`;;
8379esac
8380
8381: index or strchr
8382echo " "
8383if set index val -f; eval $csym; $val; then
8384 if set strchr val -f d_strchr; eval $csym; $val; then
8385 if $contains strchr "$strings" >/dev/null 2>&1 ; then
8386 val="$define"
8387 vali="$undef"
8388 echo "strchr() found." >&4
8389 else
8390 val="$undef"
8391 vali="$define"
8392 echo "index() found." >&4
8393 fi
8394 else
8395 val="$undef"
8396 vali="$define"
8397 echo "index() found." >&4
8398 fi
8399else
8400 if set strchr val -f d_strchr; eval $csym; $val; then
8401 val="$define"
8402 vali="$undef"
8403 echo "strchr() found." >&4
8404 else
8405 echo "No index() or strchr() found!" >&4
8406 val="$undef"
8407 vali="$undef"
8408 fi
8409fi
8410set d_strchr; eval $setvar
8411val="$vali"
8412set d_index; eval $setvar
8413
7e1af8bc 8414: check whether inet_aton exists
8415set inet_aton d_inetaton
8416eval $inlibc
8417
5ff3f7a4 8418: see if inttypes.h is available
7f3d1cf1
BH
8419: we want a real compile instead of Inhdr because some systems
8420: have an inttypes.h which includes non-existent headers
921b2963 8421echo " "
7f3d1cf1
BH
8422$cat >try.c <<EOCP
8423#include <inttypes.h>
5a411a32 8424int main() {
921b2963
JH
8425 static int32_t foo32 = 0x12345678;
8426}
7f3d1cf1
BH
8427EOCP
8428set try
921b2963
JH
8429if eval $compile; then
8430 echo "<inttypes.h> found." >&4
7f3d1cf1
BH
8431 val="$define"
8432else
921b2963 8433 echo "<inttypes.h> NOT found." >&4
7f3d1cf1
BH
8434 val="$undef"
8435fi
921b2963 8436$rm -f try.c try
7f3d1cf1
BH
8437set i_inttypes
8438eval $setvar
8439
5ff3f7a4 8440: check for int64_t
85ab1d1d
JH
8441case "$use64bits" in
8442"$define" )
8443 echo " "
8444 echo $n "Checking to see if your system supports int64_t...$c" >&4
8445 $cat >try.c <<EOCP
5ff3f7a4
GS
8446#include <sys/types.h>
8447#$i_inttypes I_INTTYPES
8448#ifdef I_INTTYPES
8449#include <inttypes.h>
8450#endif
94be4d36 8451int64_t foo() { int64_t x; x = 7; return x; }
5ff3f7a4 8452EOCP
85ab1d1d
JH
8453 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
8454 val="$define"
8455 echo " Yup, it does." >&4
8456 else
8457 val="$undef"
8458 echo " Nope, it doesn't." >&4
8459 fi
8460 $rm -f try.*
8461 ;;
8462*) val="$undef"
8463 ;;
8464esac
5ff3f7a4
GS
8465set d_int64t
8466eval $setvar
8467
8468
a0d0e21e
LW
8469: Look for isascii
8470echo " "
8471$cat >isascii.c <<'EOCP'
8472#include <stdio.h>
8473#include <ctype.h>
d674cd6d 8474int main() {
a0d0e21e
LW
8475 int c = 'A';
8476 if (isascii(c))
8477 exit(0);
8478 else
8479 exit(1);
8480}
8481EOCP
dfe9444c
AD
8482set isascii
8483if eval $compile; then
a0d0e21e
LW
8484 echo "isascii() found." >&4
8485 val="$define"
8486else
8487 echo "isascii() NOT found." >&4
8488 val="$undef"
8489fi
8490set d_isascii
8491eval $setvar
8492$rm -f isascii*
8493
8494: see if killpg exists
8495set killpg d_killpg
8496eval $inlibc
8497
dd64f1c3
AD
8498: see if lchown exists
8499echo " "
8500$cat > try.c <<'EOCP'
8501/* System header to define __stub macros and hopefully few prototypes,
8502 which can conflict with char lchown(); below. */
8503#include <assert.h>
8504/* Override any gcc2 internal prototype to avoid an error. */
8505/* We use char because int might match the return type of a gcc2
8506 builtin and then its argument prototype would still apply. */
8507char lchown();
8508int main() {
8509 /* The GNU C library defines this for functions which it implements
8510 to always fail with ENOSYS. Some functions are actually named
8511 something starting with __ and the normal name is an alias. */
8512#if defined (__stub_lchown) || defined (__stub___lchown)
8513choke me
8514#else
8515lchown();
8516#endif
8517; return 0; }
8518EOCP
8519set try
8520if eval $compile; then
8521 $echo "lchown() found." >&4
8522 val="$define"
8523else
8524 $echo "lchown() NOT found." >&4
8525 val="$undef"
8526fi
8527set d_lchown
8528eval $setvar
8529
a0d0e21e
LW
8530: see if link exists
8531set link d_link
8532eval $inlibc
8533
a0d0e21e
LW
8534: see if localeconv exists
8535set localeconv d_locconv
8536eval $inlibc
8537
8538: see if lockf exists
8539set lockf d_lockf
8540eval $inlibc
8541
85ab1d1d
JH
8542: check for length of double
8543echo " "
8544case "$doublesize" in
8545'')
8546 $echo $n "Checking to see how big your double precision numbers are...$c" >&4
8547 $cat >try.c <<'EOCP'
8548#include <stdio.h>
d674cd6d 8549int main()
85ab1d1d
JH
8550{
8551 printf("%d\n", sizeof(double));
8552}
8553EOCP
8554 set try
8555 if eval $compile_ok; then
8556 doublesize=`./try`
8557 $echo " $doublesize bytes." >&4
8558 else
8559 dflt='8'
8560 echo "(I can't seem to compile the test program. Guessing...)"
8561 rp="What is the size of a double precision number (in bytes)?"
8562 . ./myread
8563 doublesize="$ans"
8564 fi
8565 ;;
8566esac
8567$rm -f try.c try
8568
e5c9fcd0
AD
8569: check for long doubles
8570echo " "
8571echo $n "Checking to see if your system supports long doubles...$c" >&4
8572echo 'long double foo() { long double x; x = 7.0; return x; }' > try.c
dc45a647 8573if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
e5c9fcd0
AD
8574 val="$define"
8575 echo " Yup, it does." >&4
8576else
8577 val="$undef"
8578 echo " Nope, it doesn't." >&4
8579fi
8580$rm try.*
8581set d_longdbl
8582eval $setvar
8583
8584: check for length of long double
e5c9fcd0
AD
8585case "${d_longdbl}${longdblsize}" in
8586$define)
dc45a647 8587 echo " "
e5c9fcd0
AD
8588 $echo $n "Checking to see how big your long doubles are...$c" >&4
8589 $cat >try.c <<'EOCP'
8590#include <stdio.h>
5a411a32 8591int main()
e5c9fcd0
AD
8592{
8593 printf("%d\n", sizeof(long double));
8594}
8595EOCP
8596 set try
c4f23d77 8597 if eval $compile; then
e5c9fcd0 8598 longdblsize=`./try`
dc45a647 8599 $echo " $longdblsize bytes." >&4
e5c9fcd0
AD
8600 else
8601 dflt='8'
dc45a647 8602 echo " "
c4f23d77 8603 echo "(I can't seem to compile the test program. Guessing...)" >&4
e5c9fcd0
AD
8604 rp="What is the size of a long double (in bytes)?"
8605 . ./myread
8606 longdblsize="$ans"
8607 fi
85ab1d1d
JH
8608 if $test "X$doublesize" = "X$longdblsize"; then
8609 echo "(That isn't any different from an ordinary double.)"
8610 fi
dc45a647
MB
8611 ;;
8612esac
8613$rm -f try.c try
8614
8615: check for long long
8616echo " "
8617echo $n "Checking to see if your system supports long long...$c" >&4
8618echo 'long long foo() { long long x; x = 7; return x; }' > try.c
8619if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
8620 val="$define"
8621 echo " Yup, it does." >&4
8622else
8623 val="$undef"
8624 echo " Nope, it doesn't." >&4
8625fi
8626$rm try.*
8627set d_longlong
8628eval $setvar
8629
8630: check for length of long long
8631case "${d_longlong}${longlongsize}" in
8632$define)
8633 echo " "
8634 $echo $n "Checking to see how big your long longs are...$c" >&4
8635 $cat >try.c <<'EOCP'
8636#include <stdio.h>
5a411a32 8637int main()
dc45a647
MB
8638{
8639 printf("%d\n", sizeof(long long));
8640}
8641EOCP
8642 set try
8643 if eval $compile_ok; then
8644 longlongsize=`./try`
8645 $echo " $longlongsize bytes." >&4
8646 else
8647 dflt='8'
8648 echo " "
8649 echo "(I can't seem to compile the test program. Guessing...)"
8650 rp="What is the size of a long long (in bytes)?"
8651 . ./myread
8652 longlongsize="$ans"
8653 fi
85ab1d1d
JH
8654 if $test "X$longsize" = "X$longlongsize"; then
8655 echo "(That isn't any different from an ordinary long.)"
8656 fi
e5c9fcd0
AD
8657 ;;
8658esac
8659$rm -f try.c try
8660
a0d0e21e
LW
8661: see if lstat exists
8662set lstat d_lstat
8663eval $inlibc
8664
ff49bff8
JH
8665: see if madvise exists
8666set madvise d_madvise
8667eval $inlibc
8668
a0d0e21e
LW
8669: see if mblen exists
8670set mblen d_mblen
8671eval $inlibc
8672
8673: see if mbstowcs exists
8674set mbstowcs d_mbstowcs
8675eval $inlibc
8676
8677: see if mbtowc exists
8678set mbtowc d_mbtowc
8679eval $inlibc
8680
8681: see if memcmp exists
8682set memcmp d_memcmp
8683eval $inlibc
8684
8685: see if memcpy exists
8686set memcpy d_memcpy
8687eval $inlibc
8688
8689: see if memmove exists
8690set memmove d_memmove
2304df62
AD
8691eval $inlibc
8692
8693: see if memset exists
8694set memset d_memset
8695eval $inlibc
8696
8697: see if mkdir exists
8698set mkdir d_mkdir
8699eval $inlibc
8700
a0d0e21e
LW
8701: see if mkfifo exists
8702set mkfifo d_mkfifo
8703eval $inlibc
8704
8705: see if mktime exists
8706set mktime d_mktime
8707eval $inlibc
8708
ff49bff8
JH
8709: see if this is a sys/mman.h system
8710set sys/mman.h i_sysmman
8711eval $inhdr
8712
8713: see if mmap exists
8714set mmap d_mmap
8715eval $inlibc
8716: see what shmat returns
8717: default to something harmless
8718mmaptype='void *'
8719case "$i_sysmman$d_mmap" in
8720"$define$define")
8721 $cat >mmap.c <<'END'
8722#include <sys/mman.h>
8723void *mmap();
8724END
8725 if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
8726 mmaptype='void *'
8727 else
8728 mmaptype='caddr_t'
8729 fi
8730 echo "and it returns ($mmaptype)." >&4
8731 ;;
8732esac
8733
8734
8735
8736: see if mprotect exists
8737set mprotect d_mprotect
8738eval $inlibc
8739
2304df62
AD
8740: see if msgctl exists
8741set msgctl d_msgctl
8742eval $inlibc
8743
8744: see if msgget exists
8745set msgget d_msgget
8746eval $inlibc
8747
8748: see if msgsnd exists
8749set msgsnd d_msgsnd
8750eval $inlibc
8751
8752: see if msgrcv exists
8753set msgrcv d_msgrcv
8754eval $inlibc
8755
8756: see how much of the 'msg*(2)' library is present.
8757h_msg=true
8758echo " "
8759case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
8760*"$undef"*) h_msg=false;;
8761esac
6087ac44
JH
8762case "$osname" in
8763freebsd)
8764 case "`ipcs 2>&1`" in
8765 "SVID messages"*"not configured"*)
5ff3f7a4 8766 echo "Your $osname does not have the msg*(2) configured." >&4
6087ac44
JH
8767 h_msg=false
8768 val="$undef"
8769 set msgctl d_msgctl
8770 eval $setvar
8771 set msgget d_msgget
8772 eval $setvar
8773 set msgsnd d_msgsnd
8774 eval $setvar
8775 set msgrcv d_msgrcv
8776 eval $setvar
8777 ;;
8778 esac
8779 ;;
8780esac
2304df62
AD
8781: we could also check for sys/ipc.h ...
8782if $h_msg && $test `./findhdr sys/msg.h`; then
8783 echo "You have the full msg*(2) library." >&4
8784 val="$define"
8785else
8786 echo "You don't have the full msg*(2) library." >&4
8787 val="$undef"
8788fi
8789set d_msg
8790eval $setvar
8791
ff49bff8
JH
8792: see if msync exists
8793set msync d_msync
8794eval $inlibc
8795
8796: see if munmap exists
8797set munmap d_munmap
8798eval $inlibc
8799
dfe9444c
AD
8800: see if nice exists
8801set nice d_nice
8802eval $inlibc
8803
c4747d3e 8804: see if POSIX threads are available
13666627 8805if test "X$usethreads" = "X$define"; then
c4747d3e
JH
8806 set pthread.h i_pthread
8807 eval $inhdr
8808else
8809 i_pthread="$undef"
8810fi
8811
8812
8813
8814: how to create joinable pthreads
8815if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
13666627
JH
8816 echo " "
8817 echo "Checking what constant to use for creating joinable pthreads..." >&4
8818 $cat >try.c <<'EOCP'
8819#include <pthread.h>
8820int main() {
8821 int detachstate = JOINABLE;
8822}
8823EOCP
8824 set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
8825 if eval $compile; then
c6912327 8826 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
ef4af2be
JH
8827 val="$undef" # Yes, undef.
8828 set d_old_pthread_create_joinable
13666627 8829 eval $setvar
ef4af2be
JH
8830 val=""
8831 set old_pthread_create_joinable
13666627
JH
8832 eval $setvar
8833 else
8834 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
8835 if eval $compile; then
c6912327 8836 echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
13666627 8837 val="$define"
ef4af2be 8838 set d_old_pthread_create_joinable
13666627
JH
8839 eval $setvar
8840 val=PTHREAD_CREATE_UNDETACHED
ef4af2be 8841 set old_pthread_create_joinable
13666627
JH
8842 eval $setvar
8843 else
8844 set try -DJOINABLE=__UNDETACHED
8845 if eval $compile; then
c6912327 8846 echo "You seem to use __UNDETACHED." >&4
13666627 8847 val="$define"
ef4af2be 8848 set d_old_pthread_create_joinable
13666627
JH
8849 eval $setvar
8850 val=__UNDETACHED
ef4af2be 8851 set old_pthread_create_joinable
13666627
JH
8852 eval $setvar
8853 else
c6912327 8854 echo "Egads, nothing obvious found. Guessing that you use 0." >&4
13666627 8855 val="$define"
ef4af2be 8856 set d_old_pthread_create_joinable
13666627
JH
8857 eval $setvar
8858 val=0
ef4af2be 8859 set old_pthread_create_joinable
13666627
JH
8860 eval $setvar
8861 fi
8862 fi
8863 fi
8864 $rm -f try try.*
8865else
ef4af2be
JH
8866 d_old_pthread_create_joinable="$undef"
8867 old_pthread_create_joinable=""
13666627
JH
8868fi
8869
ef4af2be
JH
8870: see if pause exists
8871set pause d_pause
8872eval $inlibc
8873
8874: see if pipe exists
8875set pipe d_pipe
8876eval $inlibc
8877
8878: see if poll exists
8879set poll d_poll
8880eval $inlibc
8881
31dfa2f6
JH
8882
8883: see whether the various POSIXish _yields exist
8884$cat >try.c <<EOP
8885#include <pthread.h>
8886#include <stdio.h>
5a411a32 8887int main() {
31dfa2f6
JH
8888#ifdef SCHED_YIELD
8889 sched_yield();
8890#else
8891#ifdef PTHREAD_YIELD
8892 pthread_yield();
8893#else
8894#ifdef PTHREAD_YIELD_NULL
8895 pthread_yield(NULL);
8896#endif
8897#endif
8898#endif
8899}
8900EOP
8901: see if sched_yield exists
8902set try -DSCHED_YIELD
8903if eval $compile; then
8904 val="$define"
8905 sched_yield='sched_yield()'
8906else
8907 val="$undef"
8908fi
8909case "$usethreads" in
8910$define)
8911 case "$val" in
8912 $define) echo 'sched_yield() found.' >&4 ;;
8913 *) echo 'sched_yield() NOT found.' >&4 ;;
8914 esac
8915esac
8916set d_sched_yield
8917eval $setvar
8918
8919: see if pthread_yield exists
8920set try -DPTHREAD_YIELD
8921if eval $compile; then
8922 val="$define"
8923 case "$sched_yield" in
8924 '') sched_yield='pthread_yield()' ;;
8925 esac
8926else
8927 set try -DPTHREAD_YIELD_NULL
8928 if eval $compile; then
8929 val="$define"
8930 case "$sched_yield" in
8931 '') sched_yield='pthread_yield(NULL)' ;;
8932 esac
8933 else
8934 val="$undef"
8935 fi
8936fi
8937case "$usethreads" in
8938$define)
8939 case "$val" in
8940 $define) echo 'pthread_yield() found.' >&4 ;;
8941 *) echo 'pthread_yield() NOT found.' >&4 ;;
8942 esac
8943 ;;
8944esac
8945set d_pthread_yield
8946eval $setvar
8947
8948case "$sched_yield" in
8949'') sched_yield=undef ;;
8950esac
8951
8952$rm -f try try.*
8953
4aa0a1f7
AD
8954: see if this is a pwd.h system
8955set pwd.h i_pwd
8956eval $inhdr
8957
8958case "$i_pwd" in
8959$define)
8960 xxx=`./findhdr pwd.h`
85e6fe83 8961 $cppstdin $cppflags $cppminus < $xxx >$$.h
4aa0a1f7 8962
2304df62 8963 if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
4aa0a1f7 8964 val="$define"
2304df62 8965 else
4aa0a1f7 8966 val="$undef"
2304df62 8967 fi
4aa0a1f7
AD
8968 set d_pwquota
8969 eval $setvar
8970
2304df62 8971 if $contains 'pw_age' $$.h >/dev/null 2>&1; then
4aa0a1f7 8972 val="$define"
2304df62 8973 else
4aa0a1f7 8974 val="$undef"
2304df62 8975 fi
4aa0a1f7
AD
8976 set d_pwage
8977 eval $setvar
8978
2304df62 8979 if $contains 'pw_change' $$.h >/dev/null 2>&1; then
4aa0a1f7 8980 val="$define"
2304df62 8981 else
4aa0a1f7 8982 val="$undef"
2304df62 8983 fi
4aa0a1f7
AD
8984 set d_pwchange
8985 eval $setvar
8986
2304df62 8987 if $contains 'pw_class' $$.h >/dev/null 2>&1; then
4aa0a1f7 8988 val="$define"
2304df62 8989 else
4aa0a1f7 8990 val="$undef"
2304df62 8991 fi
4aa0a1f7
AD
8992 set d_pwclass
8993 eval $setvar
8994
2304df62 8995 if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
4aa0a1f7 8996 val="$define"
2304df62 8997 else
4aa0a1f7 8998 val="$undef"
2304df62 8999 fi
4aa0a1f7
AD
9000 set d_pwexpire
9001 eval $setvar
9002
2304df62 9003 if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
4aa0a1f7 9004 val="$define"
2304df62 9005 else
4aa0a1f7 9006 val="$undef"
2304df62 9007 fi
4aa0a1f7
AD
9008 set d_pwcomment
9009 eval $setvar
9010
c4f23d77
AD
9011 if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
9012 val="$define"
9013 else
9014 val="$undef"
9015 fi
9016 set d_pwgecos
9017 eval $setvar
9018
28e8609d
JH
9019 if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
9020 val="$define"
9021 else
9022 val="$undef"
9023 fi
9024 set d_pwpasswd
9025 eval $setvar
9026
2304df62 9027 $rm -f $$.h
4aa0a1f7 9028 ;;
5ff3f7a4 9029*)
4aa0a1f7
AD
9030 val="$undef";
9031 set d_pwquota; eval $setvar
9032 set d_pwage; eval $setvar
9033 set d_pwchange; eval $setvar
9034 set d_pwclass; eval $setvar
9035 set d_pwexpire; eval $setvar
9036 set d_pwcomment; eval $setvar
c4f23d77 9037 set d_pwgecos; eval $setvar
28e8609d 9038 set d_pwpasswd; eval $setvar
4aa0a1f7
AD
9039 ;;
9040esac
2304df62 9041
85e6fe83 9042: see if readdir and friends exist
2304df62
AD
9043set readdir d_readdir
9044eval $inlibc
85e6fe83
LW
9045set seekdir d_seekdir
9046eval $inlibc
9047set telldir d_telldir
9048eval $inlibc
9049set rewinddir d_rewinddir
9050eval $inlibc
2304df62 9051
a0d0e21e
LW
9052: see if readlink exists
9053set readlink d_readlink
9054eval $inlibc
9055
de4597cb
JH
9056: see if readv exists
9057set readv d_readv
9058eval $inlibc
9059
2304df62
AD
9060: see if rename exists
9061set rename d_rename
9062eval $inlibc
9063
9064: see if rmdir exists
9065set rmdir d_rmdir
9066eval $inlibc
9067
8ff267be 9068: see if memory.h is available.
9069val=''
9070set memory.h val
9071eval $inhdr
9072
9073: See if it conflicts with string.h
9074case "$val" in
9075$define)
9076 case "$strings" in
9077 '') ;;
9078 *)
9079 $cppstdin $cppflags $cppminus < $strings > mem.h
9080 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
9081 echo " "
9082 echo "We won't be including <memory.h>."
9083 val="$undef"
9084 fi
9085 $rm -f mem.h
9086 ;;
9087 esac
9088esac
9089set i_memory
9090eval $setvar
9091
2304df62
AD
9092: can bcopy handle overlapping blocks?
9093val="$undef"
9094case "$d_bcopy" in
9095"$define")
9096 echo " "
9097 echo "Checking to see if your bcopy() can do overlapping copies..." >&4
dfe9444c 9098 $cat >try.c <<EOCP
8ff267be 9099#$i_memory I_MEMORY
9100#$i_stdlib I_STDLIB
9101#$i_string I_STRING
9102#$i_unistd I_UNISTD
9103EOCP
dfe9444c 9104 $cat >>try.c <<'EOCP'
8ff267be 9105#include <stdio.h>
8ff267be 9106#ifdef I_MEMORY
9107# include <memory.h>
9108#endif
9109#ifdef I_STDLIB
9110# include <stdlib.h>
9111#endif
9112#ifdef I_STRING
9113# include <string.h>
9114#else
9115# include <strings.h>
9116#endif
9117#ifdef I_UNISTD
9118# include <unistd.h> /* Needed for NetBSD */
9119#endif
d674cd6d 9120int main()
2304df62 9121{
85e6fe83
LW
9122char buf[128], abc[128];
9123char *b;
9124int len;
9125int off;
9126int align;
a0d0e21e 9127
85e6fe83 9128bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
2304df62
AD
9129
9130for (align = 7; align >= 0; align--) {
9131 for (len = 36; len; len--) {
9132 b = buf+align;
85e6fe83 9133 bcopy(abc, b, len);
2304df62
AD
9134 for (off = 1; off <= len; off++) {
9135 bcopy(b, b+off, len);
9136 bcopy(b+off, b, len);
85e6fe83 9137 if (bcmp(b, abc, len))
2304df62
AD
9138 exit(1);
9139 }
9140 }
9141}
9142exit(0);
9143}
9144EOCP
dfe9444c 9145 set try
dc45a647 9146 if eval $compile_ok; then
dfe9444c 9147 if ./try 2>/dev/null; then
2304df62
AD
9148 echo "Yes, it can."
9149 val="$define"
9150 else
9151 echo "It can't, sorry."
8ff267be 9152 case "$d_memmove" in
9153 "$define") echo "But that's Ok since you have memmove()." ;;
9154 esac
2304df62
AD
9155 fi
9156 else
9157 echo "(I can't compile the test program, so we'll assume not...)"
8ff267be 9158 case "$d_memmove" in
9159 "$define") echo "But that's Ok since you have memmove()." ;;
9160 esac
2304df62
AD
9161 fi
9162 ;;
9163esac
dfe9444c 9164$rm -f try.* try core
2304df62
AD
9165set d_safebcpy
9166eval $setvar
9167
9168: can memcpy handle overlapping blocks?
9169val="$undef"
9170case "$d_memcpy" in
9171"$define")
9172 echo " "
9173 echo "Checking to see if your memcpy() can do overlapping copies..." >&4
dfe9444c 9174 $cat >try.c <<EOCP
8ff267be 9175#$i_memory I_MEMORY
9176#$i_stdlib I_STDLIB
9177#$i_string I_STRING
9178#$i_unistd I_UNISTD
9179EOCP
dfe9444c 9180 $cat >>try.c <<'EOCP'
8ff267be 9181#include <stdio.h>
8ff267be 9182#ifdef I_MEMORY
9183# include <memory.h>
9184#endif
9185#ifdef I_STDLIB
9186# include <stdlib.h>
9187#endif
9188#ifdef I_STRING
9189# include <string.h>
9190#else
9191# include <strings.h>
9192#endif
9193#ifdef I_UNISTD
9194# include <unistd.h> /* Needed for NetBSD */
9195#endif
d674cd6d 9196int main()
2304df62 9197{
85e6fe83
LW
9198char buf[128], abc[128];
9199char *b;
9200int len;
9201int off;
9202int align;
9203
8ff267be 9204/* Copy "abcde..." string to char abc[] so that gcc doesn't
9205 try to store the string in read-only memory. */
85e6fe83 9206memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
2304df62
AD
9207
9208for (align = 7; align >= 0; align--) {
9209 for (len = 36; len; len--) {
9210 b = buf+align;
232e078e 9211 memcpy(b, abc, len);
2304df62 9212 for (off = 1; off <= len; off++) {
2304df62 9213 memcpy(b+off, b, len);
232e078e 9214 memcpy(b, b+off, len);
85e6fe83 9215 if (memcmp(b, abc, len))
2304df62
AD
9216 exit(1);
9217 }
9218 }
9219}
9220exit(0);
9221}
9222EOCP
dfe9444c 9223 set try
dc45a647 9224 if eval $compile_ok; then
dfe9444c 9225 if ./try 2>/dev/null; then
2304df62
AD
9226 echo "Yes, it can."
9227 val="$define"
9228 else
9229 echo "It can't, sorry."
8ff267be 9230 case "$d_memmove" in
9231 "$define") echo "But that's Ok since you have memmove()." ;;
9232 esac
2304df62
AD
9233 fi
9234 else
9235 echo "(I can't compile the test program, so we'll assume not...)"
8ff267be 9236 case "$d_memmove" in
9237 "$define") echo "But that's Ok since you have memmove()." ;;
9238 esac
2304df62
AD
9239 fi
9240 ;;
9241esac
dfe9444c 9242$rm -f try.* try core
2304df62
AD
9243set d_safemcpy
9244eval $setvar
9245
36477c24 9246: can memcmp be trusted to compare relative magnitude?
9247val="$undef"
9248case "$d_memcmp" in
9249"$define")
9250 echo " "
dfe9444c
AD
9251 echo "Checking if your memcmp() can compare relative magnitude..." >&4
9252 $cat >try.c <<EOCP
36477c24 9253#$i_memory I_MEMORY
9254#$i_stdlib I_STDLIB
9255#$i_string I_STRING
9256#$i_unistd I_UNISTD
9257EOCP
dfe9444c 9258 $cat >>try.c <<'EOCP'
36477c24 9259#include <stdio.h>
36477c24 9260#ifdef I_MEMORY
9261# include <memory.h>
9262#endif
9263#ifdef I_STDLIB
9264# include <stdlib.h>
9265#endif
9266#ifdef I_STRING
9267# include <string.h>
9268#else
9269# include <strings.h>
9270#endif
9271#ifdef I_UNISTD
9272# include <unistd.h> /* Needed for NetBSD */
9273#endif
d674cd6d 9274int main()
36477c24 9275{
9276char a = -1;
9277char b = 0;
9278if ((a < b) && memcmp(&a, &b, 1) < 0)
9279 exit(1);
9280exit(0);
9281}
9282EOCP
dfe9444c 9283 set try
dc45a647 9284 if eval $compile_ok; then
dfe9444c 9285 if ./try 2>/dev/null; then
36477c24 9286 echo "Yes, it can."
9287 val="$define"
9288 else
9289 echo "No, it can't (it uses signed chars)."
9290 fi
9291 else
9292 echo "(I can't compile the test program, so we'll assume not...)"
9293 fi
9294 ;;
9295esac
dfe9444c 9296$rm -f try.* try core
36477c24 9297set d_sanemcmp
9298eval $setvar
9299
2304df62
AD
9300: see if select exists
9301set select d_select
9302eval $inlibc
9303
9304: see if semctl exists
9305set semctl d_semctl
9306eval $inlibc
9307
9308: see if semget exists
9309set semget d_semget
9310eval $inlibc
9311
9312: see if semop exists
9313set semop d_semop
9314eval $inlibc
9315
9316: see how much of the 'sem*(2)' library is present.
9317h_sem=true
9318echo " "
9319case "$d_semctl$d_semget$d_semop" in
9320*"$undef"*) h_sem=false;;
9321esac
6087ac44
JH
9322case "$osname" in
9323freebsd)
9324 case "`ipcs 2>&1`" in
9325 "SVID messages"*"not configured"*)
5ff3f7a4 9326 echo "Your $osname does not have the sem*(2) configured." >&4
6087ac44
JH
9327 h_sem=false
9328 val="$undef"
9329 set semctl d_semctl
9330 eval $setvar
9331 set semget d_semget
9332 eval $setvar
9333 set semop d_semop
9334 eval $setvar
9335 ;;
9336 esac
9337 ;;
9338esac
2304df62
AD
9339: we could also check for sys/ipc.h ...
9340if $h_sem && $test `./findhdr sys/sem.h`; then
9341 echo "You have the full sem*(2) library." >&4
9342 val="$define"
9343else
9344 echo "You don't have the full sem*(2) library." >&4
9345 val="$undef"
9346fi
9347set d_sem
9348eval $setvar
9349
bd89102f
AD
9350: see whether sys/sem.h defines union semun
9351echo " "
9352$cat > try.c <<'END'
9353#include <sys/types.h>
9354#include <sys/ipc.h>
9355#include <sys/sem.h>
9356int main () { union semun semun; semun.buf = 0; }
9357END
9358set try
9359if eval $compile; then
9360 echo "You have union semun in <sys/sem.h>." >&4
9361 val="$define"
9362else
9363 echo "You do not have union semun in <sys/sem.h>." >&4
9364 val="$undef"
9365fi
85ab1d1d 9366$rm -f try try.c try.h
bd89102f
AD
9367set d_union_semun
9368eval $setvar
9369
9370: see how to do semctl IPC_STAT
9371case "$d_sem" in
9372$define)
9373 : see whether semctl IPC_STAT can use union semun
9374 echo " "
85ab1d1d
JH
9375 $cat > try.h <<END
9376#ifndef S_IRUSR
9377# ifdef S_IREAD
9378# define S_IRUSR S_IREAD
9379# define S_IWUSR S_IWRITE
9380# define S_IXUSR S_IEXEC
9381# else
9382# define S_IRUSR 0400
9383# define S_IWUSR 0200
9384# define S_IXUSR 0100
9385# endif
9386# define S_IRGRP (S_IRUSR>>3)
9387# define S_IWGRP (S_IWUSR>>3)
9388# define S_IXGRP (S_IXUSR>>3)
9389# define S_IROTH (S_IRUSR>>6)
9390# define S_IWOTH (S_IWUSR>>6)
9391# define S_IXOTH (S_IXUSR>>6)
9392#endif
9393#ifndef S_IRWXU
9394# define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
9395# define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
9396# define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
9397#endif
9398END
9399
bd89102f
AD
9400 $cat > try.c <<END
9401#include <sys/types.h>
9402#include <sys/ipc.h>
9403#include <sys/sem.h>
9404#include <sys/stat.h>
9405#include <stdio.h>
9406#include <errno.h>
85ab1d1d 9407#include "try.h"
bd89102f
AD
9408#ifndef errno
9409extern int errno;
9410#endif
9411#$d_union_semun HAS_UNION_SEMUN
9412int main() {
9413 union semun
9414#ifndef HAS_UNION_SEMUN
9415 {
9416 int val;
9417 struct semid_ds *buf;
9418 unsigned short *array;
9419 }
9420#endif
9421 arg;
9422 int sem, st;
9423
9424#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
9425 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
9426 if (sem > -1) {
9427 struct semid_ds argbuf;
9428 arg.buf = &argbuf;
9429# ifdef IPC_STAT
9430 st = semctl(sem, 0, IPC_STAT, arg);
9431 if (st == 0)
9432 printf("semun\n");
9433 else
9434# endif /* IPC_STAT */
9435 printf("semctl IPC_STAT failed: errno = %d\n", errno);
9436# ifdef IPC_RMID
9437 if (semctl(sem, 0, IPC_RMID, arg) != 0)
9438# endif /* IPC_RMID */
9439 printf("semctl IPC_RMID failed: errno = %d\n", errno);
9440 } else
9441#endif /* IPC_PRIVATE && ... */
9442 printf("semget failed: errno = %d\n", errno);
9443 return 0;
9444}
9445END
9446 val="$undef"
9447 set try
9448 if eval $compile; then
9449 xxx=`./try`
9450 case "$xxx" in
9451 semun) val="$define" ;;
9452 esac
9453 fi
9454 $rm -f try try.c
9455 set d_semctl_semun
9456 eval $setvar
9457 case "$d_semctl_semun" in
9458 $define)
9459 echo "You can use union semun for semctl IPC_STAT." >&4
9460 also='also'
9461 ;;
9462 *) echo "You cannot use union semun for semctl IPC_STAT." >&4
9463 also=''
9464 ;;
9465 esac
9466
9467 : see whether semctl IPC_STAT can use struct semid_ds pointer
9468 $cat > try.c <<'END'
9469#include <sys/types.h>
9470#include <sys/ipc.h>
9471#include <sys/sem.h>
9472#include <sys/stat.h>
85ab1d1d 9473#include "try.h"
bd89102f
AD
9474#include <stdio.h>
9475#include <errno.h>
9476#ifndef errno
9477extern int errno;
9478#endif
9479int main() {
9480 struct semid_ds arg;
9481 int sem, st;
9482
9483#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
9484 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
9485 if (sem > -1) {
9486# ifdef IPC_STAT
9487 st = semctl(sem, 0, IPC_STAT, &arg);
9488 if (st == 0)
9489 printf("semid_ds\n");
9490 else
9491# endif /* IPC_STAT */
9492 printf("semctl IPC_STAT failed: errno = %d\n", errno);
9493# ifdef IPC_RMID
9494 if (semctl(sem, 0, IPC_RMID, &arg) != 0)
9495# endif /* IPC_RMID */
9496 printf("semctl IPC_RMID failed: errno = %d\n", errno);
9497 } else
9498#endif /* IPC_PRIVATE && ... */
9499 printf("semget failed: errno = %d\n", errno);
9500
9501 return 0;
9502}
9503END
9504 val="$undef"
9505 set try
9506 if eval $compile; then
9507 xxx=`./try`
9508 case "$xxx" in
9509 semid_ds) val="$define" ;;
9510 esac
9511 fi
9512 $rm -f try try.c
9513 set d_semctl_semid_ds
9514 eval $setvar
9515 case "$d_semctl_semid_ds" in
9516 $define)
7f3d1cf1 9517 echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
bd89102f 9518 ;;
7f3d1cf1 9519 *) echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
bd89102f
AD
9520 ;;
9521 esac
85ab1d1d 9522 $rm -f try.h
bd89102f
AD
9523 ;;
9524*) val="$undef"
9525
9526 # We do not have the full sem*(2) library, so assume we can not
9527 # use either.
9528
9529 set d_semctl_semun
9530 eval $setvar
9531
9532 set d_semctl_semid_ds
9533 eval $setvar
9534 ;;
9535esac
9536
2304df62
AD
9537: see if setegid exists
9538set setegid d_setegid
9539eval $inlibc
9540
9541: see if seteuid exists
9542set seteuid d_seteuid
9543eval $inlibc
9544
5ff3f7a4
GS
9545: see if setgrent exists
9546set setgrent d_setgrent
9547eval $inlibc
9548
693762b4
AD
9549: see if sethostent exists
9550set sethostent d_sethent
9551eval $inlibc
9552
a0d0e21e
LW
9553: see if setlinebuf exists
9554set setlinebuf d_setlinebuf
9555eval $inlibc
9556
2304df62
AD
9557: see if setlocale exists
9558set setlocale d_setlocale
9559eval $inlibc
a0d0e21e 9560
e5c9fcd0
AD
9561: see if setnetent exists
9562set setnetent d_setnent
9563eval $inlibc
9564
9565: see if setprotoent exists
9566set setprotoent d_setpent
9567eval $inlibc
9568
2304df62
AD
9569: see if setpgid exists
9570set setpgid d_setpgid
9571eval $inlibc
9572
2304df62
AD
9573: see if setpgrp2 exists
9574set setpgrp2 d_setpgrp2
9575eval $inlibc
9576
9577: see if setpriority exists
9578set setpriority d_setprior
9579eval $inlibc
9580
5ff3f7a4
GS
9581: see if setpwent exists
9582set setpwent d_setpwent
9583eval $inlibc
9584
2304df62
AD
9585: see if setregid exists
9586set setregid d_setregid
9587eval $inlibc
9588set setresgid d_setresgid
9589eval $inlibc
9590
9591: see if setreuid exists
9592set setreuid d_setreuid
9593eval $inlibc
9594set setresuid d_setresuid
9595eval $inlibc
9596
9597: see if setrgid exists
9598set setrgid d_setrgid
9599eval $inlibc
9600
9601: see if setruid exists
9602set setruid d_setruid
9603eval $inlibc
9604
e5c9fcd0
AD
9605: see if setservent exists
9606set setservent d_setsent
9607eval $inlibc
9608
2304df62
AD
9609: see if setsid exists
9610set setsid d_setsid
9611eval $inlibc
9612
e5c9fcd0
AD
9613: see if setvbuf exists
9614set setvbuf d_setvbuf
9615eval $inlibc
9616
760ac839
LW
9617: see if sfio.h is available
9618set sfio.h i_sfio
9619eval $inhdr
9620
9621
8ff267be 9622: see if sfio library is available
760ac839
LW
9623case "$i_sfio" in
9624$define)
9625 val=''
9626 set sfreserve val
9627 eval $inlibc
9628 ;;
9629*)
9630 val="$undef"
9631 ;;
9632esac
8ff267be 9633: Ok, but do we want to use it.
760ac839
LW
9634case "$val" in
9635$define)
9636 case "$usesfio" in
8ff267be 9637 true|$define|[yY]*) dflt='y';;
760ac839
LW
9638 *) dflt='n';;
9639 esac
8ff267be 9640 echo "$package can use the sfio library, but it is experimental."
760ac839
LW
9641 rp="You seem to have sfio available, do you want to try using it?"
9642 . ./myread
9643 case "$ans" in
8ff267be 9644 y|Y) ;;
9645 *) echo "Ok, avoiding sfio this time. I'll use stdio instead."
760ac839 9646 val="$undef"
ff0cee69 9647 : Remove sfio from list of libraries to use
9648 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
9649 shift
9650 libs="$*"
9651 echo "libs = $libs" >&4
760ac839
LW
9652 ;;
9653 esac
9654 ;;
8ff267be 9655*) case "$usesfio" in
9656 true|$define|[yY]*)
9657 echo "Sorry, cannot find sfio on this machine" >&4
9658 echo "Ignoring your setting of usesfio=$usesfio" >&4
760ac839
LW
9659 ;;
9660 esac
9661 ;;
9662esac
8ff267be 9663set d_sfio
9664eval $setvar
760ac839
LW
9665case "$d_sfio" in
9666$define) usesfio='true';;
9667*) usesfio='false';;
9668esac
9669
2304df62
AD
9670: see if shmctl exists
9671set shmctl d_shmctl
9672eval $inlibc
9673
9674: see if shmget exists
9675set shmget d_shmget
9676eval $inlibc
9677
a0d0e21e
LW
9678: see if shmat exists
9679set shmat d_shmat
9680eval $inlibc
9681: see what shmat returns
9682case "$d_shmat" in
9683"$define")
9684 $cat >shmat.c <<'END'
9685#include <sys/shm.h>
9686void *shmat();
9687END
9688 if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
9689 shmattype='void *'
9690 else
9691 shmattype='char *'
9692 fi
9693 echo "and it returns ($shmattype)." >&4
9694 : see if a prototype for shmat is available
e50aee73
AD
9695 xxx=`./findhdr sys/shm.h`
9696 $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
a0d0e21e
LW
9697 if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
9698 val="$define"
9699 else
9700 val="$undef"
9701 fi
9702 $rm -f shmat.[co]
9703 ;;
9704*)
9705 val="$undef"
9706 ;;
9707esac
9708set d_shmatprototype
9709eval $setvar
9710
9711: see if shmdt exists
9712set shmdt d_shmdt
9713eval $inlibc
9714
9715: see how much of the 'shm*(2)' library is present.
9716h_shm=true
9717echo " "
9718case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
9719*"$undef"*) h_shm=false;;
9720esac
6087ac44
JH
9721case "$osname" in
9722freebsd)
9723 case "`ipcs 2>&1`" in
9724 "SVID shared memory"*"not configured"*)
5ff3f7a4 9725 echo "Your $osname does not have the shm*(2) configured." >&4
6087ac44
JH
9726 h_shm=false
9727 val="$undef"
9728 set shmctl d_shmctl
9729 evat $setvar
9730 set shmget d_shmget
9731 evat $setvar
9732 set shmat d_shmat
9733 evat $setvar
9734 set shmdt d_shmdt
9735 evat $setvar
9736 ;;
9737 esac
9738 ;;
9739esac
a0d0e21e
LW
9740: we could also check for sys/ipc.h ...
9741if $h_shm && $test `./findhdr sys/shm.h`; then
9742 echo "You have the full shm*(2) library." >&4
9743 val="$define"
9744else
9745 echo "You don't have the full shm*(2) library." >&4
9746 val="$undef"
9747fi
9748set d_shm
9749eval $setvar
9750
2c7991dc 9751echo " "
8ff267be 9752: see if we have sigaction
9753if set sigaction val -f d_sigaction; eval $csym; $val; then
9754 echo 'sigaction() found.' >&4
dc45a647 9755 $cat > try.c <<'EOP'
8ff267be 9756#include <stdio.h>
9757#include <sys/types.h>
9758#include <signal.h>
d674cd6d 9759int main()
8ff267be 9760{
9761 struct sigaction act, oact;
9762}
9763EOP
dc45a647
MB
9764 set try
9765 if eval $compile_ok; then
9766 val="$define"
9767 else
9768 echo "But you don't seem to have a useable struct sigaction." >&4
9769 val="$undef"
9770 fi
8ff267be 9771else
dc45a647 9772 echo 'sigaction NOT found.' >&4
8ff267be 9773 val="$undef"
9774fi
9775set d_sigaction; eval $setvar
dfe9444c 9776$rm -f try try$_o try.c
2c7991dc 9777
a5f75d66
AD
9778: see if sigsetjmp exists
9779echo " "
921b2963
JH
9780case "$d_sigsetjmp" in
9781'')
9782 $cat >try.c <<'EOP'
9783#include <setjmp.h>
9784sigjmp_buf env;
9785int set = 1;
d674cd6d 9786int main()
921b2963
JH
9787{
9788 if (sigsetjmp(env,1))
9789 exit(set);
9790 set = 0;
9791 siglongjmp(env, 1);
9792 exit(1);
9793}
9794EOP
9795 set try
9796 if eval $compile; then
9797 if ./try >/dev/null 2>&1; then
9798 echo "POSIX sigsetjmp found." >&4
9799 val="$define"
9800 else
9801 $cat >&4 <<EOM
9802Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
9803I'll ignore them.
9804EOM
9805 val="$undef"
a0d0e21e 9806 fi
921b2963
JH
9807 else
9808 echo "sigsetjmp not found." >&4
9809 val="$undef"
a0d0e21e 9810 fi
921b2963
JH
9811 ;;
9812*) val="$d_sigsetjmp"
9813 case "$d_sigsetjmp" in
9814 $define) echo "POSIX sigsetjmp found." >&4;;
9815 $undef) echo "sigsetjmp not found." >&4;;
9816 esac
9817 ;;
9818esac
9819set d_sigsetjmp
9820eval $setvar
9821$rm -f try.c try
2304df62 9822
2304df62
AD
9823: see if stat knows about block sizes
9824echo " "
5ff3f7a4
GS
9825set d_statblks stat st_blocks $i_sysstat sys/stat.h
9826eval $hasfield
2304df62 9827
16d20bd9
AD
9828: see if _ptr and _cnt from stdio act std
9829echo " "
9830if $contains '_IO_fpos_t' `./findhdr stdio.h` >/dev/null 2>&1 ; then
9831 echo "(Looks like you have stdio.h from Linux.)"
9832 case "$stdio_ptr" in
c2960299
AD
9833 '') stdio_ptr='((fp)->_IO_read_ptr)'
9834 ptr_lval=$define
9835 ;;
8e07c86e 9836 *) ptr_lval=$d_stdio_ptr_lval;;
16d20bd9
AD
9837 esac
9838 case "$stdio_cnt" in
c2960299
AD
9839 '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
9840 cnt_lval=$undef
9841 ;;
8e07c86e 9842 *) cnt_lval=$d_stdio_cnt_lval;;
16d20bd9
AD
9843 esac
9844 case "$stdio_base" in
9845 '') stdio_base='((fp)->_IO_read_base)';;
9846 esac
9847 case "$stdio_bufsiz" in
c2960299 9848 '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
16d20bd9
AD
9849 esac
9850else
9851 case "$stdio_ptr" in
c2960299
AD
9852 '') stdio_ptr='((fp)->_ptr)'
9853 ptr_lval=$define
9854 ;;
8e07c86e 9855 *) ptr_lval=$d_stdio_ptr_lval;;
16d20bd9
AD
9856 esac
9857 case "$stdio_cnt" in
c2960299
AD
9858 '') stdio_cnt='((fp)->_cnt)'
9859 cnt_lval=$define
9860 ;;
8e07c86e 9861 *) cnt_lval=$d_stdio_cnt_lval;;
16d20bd9
AD
9862 esac
9863 case "$stdio_base" in
9864 '') stdio_base='((fp)->_base)';;
9865 esac
9866 case "$stdio_bufsiz" in
9867 '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
9868 esac
9869fi
9870: test whether _ptr and _cnt really work
9871echo "Checking how std your stdio is..." >&4
9872$cat >try.c <<EOP
9873#include <stdio.h>
9874#define FILE_ptr(fp) $stdio_ptr
9875#define FILE_cnt(fp) $stdio_cnt
d674cd6d 9876int main() {
16d20bd9
AD
9877 FILE *fp = fopen("try.c", "r");
9878 char c = getc(fp);
9879 if (
9880 18 <= FILE_cnt(fp) &&
9881 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
9882 )
9883 exit(0);
9884 exit(1);
9885}
9886EOP
9887val="$undef"
dfe9444c
AD
9888set try
9889if eval $compile; then
16d20bd9
AD
9890 if ./try; then
9891 echo "Your stdio acts pretty std."
9892 val="$define"
9893 else
9894 echo "Your stdio isn't very std."
9895 fi
9896else
9897 echo "Your stdio doesn't appear very std."
9898fi
9899$rm -f try.c try
9900set d_stdstdio
9901eval $setvar
9902
8e07c86e 9903: Can _ptr be used as an lvalue?
e50aee73
AD
9904case "$d_stdstdio$ptr_lval" in
9905$define$define) val=$define ;;
c2960299
AD
9906*) val=$undef ;;
9907esac
9908set d_stdio_ptr_lval
9909eval $setvar
9910
8e07c86e 9911: Can _cnt be used as an lvalue?
e50aee73
AD
9912case "$d_stdstdio$cnt_lval" in
9913$define$define) val=$define ;;
c2960299
AD
9914*) val=$undef ;;
9915esac
9916set d_stdio_cnt_lval
9917eval $setvar
9918
16d20bd9
AD
9919: see if _base is also standard
9920val="$undef"
9921case "$d_stdstdio" in
9922$define)
9923 $cat >try.c <<EOP
9924#include <stdio.h>
9925#define FILE_base(fp) $stdio_base
9926#define FILE_bufsiz(fp) $stdio_bufsiz
d674cd6d 9927int main() {
16d20bd9
AD
9928 FILE *fp = fopen("try.c", "r");
9929 char c = getc(fp);
9930 if (
9931 19 <= FILE_bufsiz(fp) &&
9932 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
9933 )
9934 exit(0);
9935 exit(1);
9936}
9937EOP
dfe9444c
AD
9938 set try
9939 if eval $compile; then
16d20bd9 9940 if ./try; then
8ff267be 9941 echo "And its _base field acts std."
16d20bd9
AD
9942 val="$define"
9943 else
9944 echo "But its _base field isn't std."
9945 fi
9946 else
9947 echo "However, it seems to be lacking the _base field."
9948 fi
9949 $rm -f try.c try
9950 ;;
9951esac
9952set d_stdiobase
9953eval $setvar
9954
a0d0e21e
LW
9955: see if strcoll exists
9956set strcoll d_strcoll
9957eval $inlibc
2304df62
AD
9958
9959: check for structure copying
9960echo " "
9961echo "Checking to see if your C compiler can copy structs..." >&4
9962$cat >try.c <<'EOCP'
5a411a32 9963int main()
2304df62
AD
9964{
9965 struct blurfl {
9966 int dyick;
9967 } foo, bar;
9968
9969 foo = bar;
9970}
9971EOCP
9972if $cc -c try.c >/dev/null 2>&1 ; then
9973 val="$define"
9974 echo "Yup, it can."
9975else
9976 val="$undef"
9977 echo "Nope, it can't."
9978fi
9979set d_strctcpy
9980eval $setvar
9981$rm -f try.*
9982
9983: see if strerror and/or sys_errlist[] exist
9984echo " "
28e8609d
JH
9985if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
9986 if set strerror val -f d_strerror; eval $csym; $val; then
5ff3f7a4
GS
9987 echo 'strerror() found.' >&4
9988 d_strerror="$define"
9989 d_strerrm='strerror(e)'
9990 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
9991 echo "(You also have sys_errlist[], so we could roll our own strerror.)"
9992 d_syserrlst="$define"
9993 else
9994 echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
9995 d_syserrlst="$undef"
9996 fi
28e8609d 9997 elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
5ff3f7a4
GS
9998 $contains '#[ ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
9999 echo 'strerror() found in string header.' >&4
10000 d_strerror="$define"
10001 d_strerrm='strerror(e)'
10002 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
10003 echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
10004 d_syserrlst="$define"
10005 else
10006 echo "(You don't appear to have any sys_errlist[], how can this be?)"
10007 d_syserrlst="$undef"
10008 fi
28e8609d 10009 elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
5ff3f7a4
GS
10010 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
10011 d_strerror="$undef"
10012 d_syserrlst="$define"
10013 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
28e8609d 10014 else
5ff3f7a4
GS
10015 echo 'strerror() and sys_errlist[] NOT found.' >&4
10016 d_strerror="$undef"
10017 d_syserrlst="$undef"
10018 d_strerrm='"unknown"'
28e8609d 10019 fi
2304df62
AD
10020fi
10021
a89d8a78
DH
10022: see if strtod exists
10023set strtod d_strtod
10024eval $inlibc
10025
10026: see if strtol exists
10027set strtol d_strtol
10028eval $inlibc
10029
10030: see if strtoul exists
10031set strtoul d_strtoul
10032eval $inlibc
10033
a0d0e21e
LW
10034: see if strxfrm exists
10035set strxfrm d_strxfrm
10036eval $inlibc
10037
2304df62
AD
10038: see if symlink exists
10039set symlink d_symlink
10040eval $inlibc
10041
10042: see if syscall exists
10043set syscall d_syscall
10044eval $inlibc
10045
a0d0e21e
LW
10046: see if sysconf exists
10047set sysconf d_sysconf
10048eval $inlibc
10049
2304df62
AD
10050: see if system exists
10051set system d_system
10052eval $inlibc
10053
a0d0e21e
LW
10054: see if tcgetpgrp exists
10055set tcgetpgrp d_tcgetpgrp
10056eval $inlibc
10057
2c7991dc 10058: see if tcsetpgrp exists
10059set tcsetpgrp d_tcsetpgrp
10060eval $inlibc
4633a7c4 10061
cb86ce0e
JH
10062: see if sys/types.h has to be included
10063set sys/types.h i_systypes
10064eval $inhdr
10065
10066: see if prototype for telldir is available
10067echo " "
10068set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
10069eval $hasproto
10070
2c7991dc 10071: define an is-a-typedef? function
10072typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
10073case "$inclist" in
10074"") inclist="sys/types.h";;
10075esac;
10076eval "varval=\$$var";
10077case "$varval" in
10078"")
10079 $rm -f temp.c;
10080 for inc in $inclist; do
10081 echo "#include <$inc>" >>temp.c;
10082 done;
c4f23d77
AD
10083 echo "#ifdef $type" >> temp.c;
10084 echo "printf(\"We have $type\");" >> temp.c;
10085 echo "#endif" >> temp.c;
2c7991dc 10086 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
10087 if $contains $type temp.E >/dev/null 2>&1; then
10088 eval "$var=\$type";
10089 else
10090 eval "$var=\$def";
10091 fi;
10092 $rm -f temp.?;;
10093*) eval "$var=\$varval";;
10094esac'
4633a7c4 10095
dc45a647
MB
10096: define an is-a-typedef? function that prompts if the type is not available.
10097typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
10098case "$inclist" in
10099"") inclist="sys/types.h";;
10100esac;
10101eval "varval=\$$var";
10102case "$varval" in
10103"")
10104 $rm -f temp.c;
10105 for inc in $inclist; do
10106 echo "#include <$inc>" >>temp.c;
10107 done;
c4f23d77
AD
10108 echo "#ifdef $type" >> temp.c;
10109 echo "printf(\"We have $type\");" >> temp.c;
10110 echo "#endif" >> temp.c;
dc45a647
MB
10111 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
10112 echo " " ;
10113 echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
10114 if $contains $type temp.E >/dev/null 2>&1; then
10115 echo "$type found." >&4;
10116 eval "$var=\$type";
10117 else
10118 echo "$type NOT found." >&4;
10119 dflt="$def";
10120 . ./myread ;
10121 eval "$var=\$ans";
10122 fi;
10123 $rm -f temp.?;;
10124*) eval "$var=\$varval";;
10125esac'
10126
2c7991dc 10127: see if this is a sys/times.h system
10128set sys/times.h i_systimes
10129eval $inhdr
4633a7c4 10130
2c7991dc 10131: see if times exists
4633a7c4 10132echo " "
2c7991dc 10133if set times val -f d_times; eval $csym; $val; then
10134 echo 'times() found.' >&4
10135 d_times="$define"
10136 inc=''
10137 case "$i_systimes" in
10138 "$define") inc='sys/times.h';;
10139 esac
dc45a647 10140 rp="What is the type returned by times() on this system?"
2c7991dc 10141 set clock_t clocktype long stdio.h sys/types.h $inc
dc45a647 10142 eval $typedef_ask
2c7991dc 10143else
10144 echo 'times() NOT found, hope that will do.' >&4
10145 d_times="$undef"
10146 clocktype='int'
10147fi
2304df62 10148
2c7991dc 10149: see if truncate exists
10150set truncate d_truncate
10151eval $inlibc
2304df62 10152
2c7991dc 10153: see if tzname[] exists
10154echo " "
10155if set tzname val -a d_tzname; eval $csym; $val; then
10156 val="$define"
10157 echo 'tzname[] found.' >&4
10158else
10159 val="$undef"
10160 echo 'tzname[] NOT found.' >&4
10161fi
10162set d_tzname
10163eval $setvar
10164
10165: see if umask exists
10166set umask d_umask
10167eval $inlibc
85e6fe83 10168
4633a7c4
LW
10169: backward compatibility for d_hvfork
10170if test X$d_hvfork != X; then
10171 d_vfork="$d_hvfork"
10172 d_hvfork=''
10173fi
10174: see if there is a vfork
10175val=''
10176set vfork val
10177eval $inlibc
ecfc5424 10178
4633a7c4
LW
10179: Ok, but do we want to use it. vfork is reportedly unreliable in
10180: perl on Solaris 2.x, and probably elsewhere.
10181case "$val" in
10182$define)
16d20bd9 10183 echo " "
4633a7c4
LW
10184 case "$usevfork" in
10185 false) dflt='n';;
10186 *) dflt='y';;
10187 esac
f10488a3
JH
10188 cat <<'EOM'
10189
10190Perl can only use a vfork() that doesn't suffer from strict
10191restrictions on calling functions or modifying global data in
10192the child. For example, glibc-2.1 contains such a vfork()
10193that is unsuitable. If your system provides a proper fork()
10194call, chances are that you do NOT want perl to use vfork().
10195
10196EOM
10197 rp="Do you still want to use vfork()?"
4633a7c4
LW
10198 . ./myread
10199 case "$ans" in
10200 y|Y) ;;
10201 *)
10202 echo "Ok, we won't use vfork()."
10203 val="$undef"
10204 ;;
10205 esac
ecfc5424
AD
10206 ;;
10207esac
4633a7c4
LW
10208set d_vfork
10209eval $setvar
10210case "$d_vfork" in
10211$define) usevfork='true';;
10212*) usevfork='false';;
10213esac
ecfc5424 10214
4633a7c4
LW
10215: see if this is an sysdir system
10216set sys/dir.h i_sysdir
10217eval $inhdr
10218
10219: see if this is an sysndir system
10220set sys/ndir.h i_sysndir
10221eval $inhdr
10222
10223: see if closedir exists
10224set closedir d_closedir
10225eval $inlibc
10226
10227case "$d_closedir" in
10228"$define")
16d20bd9 10229 echo " "
4633a7c4
LW
10230 echo "Checking whether closedir() returns a status..." >&4
10231 cat > closedir.c <<EOM
10232#$i_dirent I_DIRENT /**/
10233#$i_sysdir I_SYS_DIR /**/
10234#$i_sysndir I_SYS_NDIR /**/
bfb7748a 10235#$i_systypes I_SYS_TYPES /**/
4633a7c4 10236
bfb7748a
AD
10237#if defined(I_SYS_TYPES)
10238#include <sys/types.h>
10239#endif
4633a7c4
LW
10240#if defined(I_DIRENT)
10241#include <dirent.h>
10242#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10243#include <sys/dir.h>
4aa0a1f7 10244#endif
4633a7c4
LW
10245#else
10246#ifdef I_SYS_NDIR
10247#include <sys/ndir.h>
10248#else
10249#ifdef I_SYS_DIR
10250#ifdef hp9000s500
10251#include <ndir.h> /* may be wrong in the future */
10252#else
10253#include <sys/dir.h>
10254#endif
10255#endif
10256#endif
10257#endif
10258int main() { return closedir(opendir(".")); }
10259EOM
dfe9444c 10260 set closedir
dc45a647 10261 if eval $compile_ok; then
4633a7c4
LW
10262 if ./closedir > /dev/null 2>&1 ; then
10263 echo "Yes, it does."
10264 val="$undef"
ecfc5424 10265 else
4633a7c4
LW
10266 echo "No, it doesn't."
10267 val="$define"
ecfc5424
AD
10268 fi
10269 else
4633a7c4
LW
10270 echo "(I can't seem to compile the test program--assuming it doesn't)"
10271 val="$define"
ecfc5424 10272 fi
ecfc5424 10273 ;;
4633a7c4
LW
10274*)
10275 val="$undef";
ecfc5424
AD
10276 ;;
10277esac
4633a7c4
LW
10278set d_void_closedir
10279eval $setvar
10280$rm -f closedir*
10281: check for volatile keyword
ecfc5424 10282echo " "
4633a7c4
LW
10283echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10284$cat >try.c <<'EOCP'
5a411a32 10285int main()
4633a7c4
LW
10286{
10287 typedef struct _goo_struct goo_struct;
10288 goo_struct * volatile goo = ((goo_struct *)0);
10289 struct _goo_struct {
10290 long long_int;
10291 int reg_int;
10292 char char_var;
10293 };
10294 typedef unsigned short foo_t;
10295 char *volatile foo;
10296 volatile int bar;
10297 volatile foo_t blech;
10298 foo = foo;
a0d0e21e
LW
10299}
10300EOCP
4633a7c4
LW
10301if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
10302 val="$define"
10303 echo "Yup, it does."
10304else
10305 val="$undef"
10306 echo "Nope, it doesn't."
10307fi
10308set d_volatile
10309eval $setvar
10310$rm -f try.*
a0d0e21e 10311
4633a7c4
LW
10312: see if there is a wait4
10313set wait4 d_wait4
8e07c86e
AD
10314eval $inlibc
10315
4633a7c4
LW
10316: see if waitpid exists
10317set waitpid d_waitpid
10318eval $inlibc
10319
10320: see if wcstombs exists
10321set wcstombs d_wcstombs
10322eval $inlibc
10323
10324: see if wctomb exists
10325set wctomb d_wctomb
10326eval $inlibc
10327
de4597cb
JH
10328: see if writev exists
10329set writev d_writev
10330eval $inlibc
10331
4633a7c4
LW
10332: preserve RCS keywords in files with variable substitution, grrr
10333Date='$Date'
10334Id='$Id'
10335Log='$Log'
10336RCSfile='$RCSfile'
10337Revision='$Revision'
10338
ca8cfa54
JH
10339case "$crosscompile" in
10340''|[nN]*) crosscompile="$undef" ;;
10341esac
10342
10343case "$osname" in
8f1f23e8 10344next|rhapsody) multiarch="$define" ;;
ca8cfa54
JH
10345esac
10346case "$multiarch" in
10347''|[nN]*) multiarch="$undef" ;;
10348esac
10349
4633a7c4
LW
10350: check for alignment requirements
10351echo " "
68c15b6f
HM
10352case "$crosscompile$multiarch" in
10353*$define*)
ca8cfa54
JH
10354 $cat <<EOM
10355You seem to be either cross-compiling or doing a multiarchitecture build,
10356skipping the memory alignment check.
68c15b6f
HM
10357
10358EOM
10359 case "$alignbytes" in
10360 '') alignbytes=8 ;;
10361 esac
10362 ;;
10363*)
10364 case "$alignbytes" in
10365 '') echo "Checking alignment constraints..." >&4
10366 $cat >try.c <<'EOCP'
4633a7c4
LW
10367struct foobar {
10368 char foo;
10369 double bar;
732c9516 10370} try_algn;
d674cd6d 10371int main()
4633a7c4 10372{
732c9516 10373 printf("%d\n", (char *)&try_algn.bar - (char *)&try_algn.foo);
4633a7c4
LW
10374}
10375EOCP
68c15b6f
HM
10376 set try
10377 if eval $compile_ok; then
10378 dflt=`./try`
10379 else
10380 dflt='8'
10381 echo "(I can't seem to compile the test program...)"
10382 fi
10383 ;;
10384 *) dflt="$alignbytes"
10385 ;;
10386 esac
10387 rp="Doubles must be aligned on a how-many-byte boundary?"
10388 . ./myread
10389 alignbytes="$ans"
10390 $rm -f try.c try
8e07c86e 10391 ;;
ecfc5424 10392esac
68c15b6f 10393
85e6fe83 10394
4633a7c4 10395: check for ordering of bytes in a long
68c15b6f
HM
10396echo " "
10397case "$crosscompile$multiarch" in
10398*$define*)
10399 $cat <<EOM
ca8cfa54
JH
10400You seem to be either cross-compiling or doing a multiarchitecture build,
10401skipping the byteorder check.
68c15b6f
HM
10402
10403EOM
ca8cfa54 10404 byteorder=''
68c15b6f
HM
10405 ;;
10406*)
10407 case "$byteorder" in
10408 '')
10409 $cat <<'EOM'
4633a7c4
LW
10410In the following, larger digits indicate more significance. A big-endian
10411machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
10412little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
10413machines may have weird orders like 3412. A Cray will report 87654321. If
10414the test program works the default is probably right.
10415I'm now running the test program...
10416EOM
68c15b6f 10417 $cat >try.c <<'EOCP'
4633a7c4 10418#include <stdio.h>
d674cd6d 10419int main()
4633a7c4
LW
10420{
10421 int i;
10422 union {
10423 unsigned long l;
10424 char c[sizeof(long)];
10425 } u;
10426
10427 if (sizeof(long) > 4)
10428 u.l = (0x08070605L << 32) | 0x04030201L;
10429 else
10430 u.l = 0x04030201L;
10431 for (i = 0; i < sizeof(long); i++)
10432 printf("%c", u.c[i]+'0');
10433 printf("\n");
10434 exit(0);
10435}
10436EOCP
68c15b6f
HM
10437 xxx_prompt=y
10438 set try
10439 if eval $compile && ./try > /dev/null; then
10440 dflt=`./try`
10441 case "$dflt" in
10442 [1-4][1-4][1-4][1-4]|12345678|87654321)
10443 echo "(The test program ran ok.)"
10444 echo "byteorder=$dflt"
10445 xxx_prompt=n
4633a7c4 10446 ;;
68c15b6f
HM
10447 ????|????????) echo "(The test program ran ok.)" ;;
10448 *) echo "(The test program didn't run right for some reason.)" ;;
10449 esac
10450 else
10451 dflt='4321'
10452 cat <<'EOM'
4633a7c4
LW
10453(I can't seem to compile the test program. Guessing big-endian...)
10454EOM
68c15b6f
HM
10455 fi
10456 case "$xxx_prompt" in
10457 y)
10458 rp="What is the order of bytes in a long?"
10459 . ./myread
10460 byteorder="$ans"
10461 ;;
10462 *) byteorder=$dflt
10463 ;;
10464 esac
ecfc5424
AD
10465 ;;
10466 esac
68c15b6f 10467 $rm -f try.c try
ecfc5424
AD
10468 ;;
10469esac
68c15b6f 10470
85e6fe83 10471
4633a7c4 10472: how do we catenate cpp tokens here?
2304df62 10473echo " "
4633a7c4
LW
10474echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
10475$cat >cpp_stuff.c <<'EOCP'
10476#define RCAT(a,b)a/**/b
10477#define ACAT(a,b)a ## b
10478RCAT(Rei,ser)
10479ACAT(Cir,cus)
10480EOCP
10481$cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
10482if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
dfe9444c 10483 echo "Oh! Smells like ANSI's been here." >&4
4633a7c4
LW
10484 echo "We can catify or stringify, separately or together!"
10485 cpp_stuff=42
10486elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
dfe9444c 10487 echo "Ah, yes! The good old days!" >&4
4633a7c4
LW
10488 echo "However, in the good old days we don't know how to stringify and"
10489 echo "catify at the same time."
10490 cpp_stuff=1
10491else
10492 $cat >&4 <<EOM
10493Hmm, I don't seem to be able to catenate tokens with your cpp. You're going
10494to have to edit the values of CAT[2-5] in config.h...
a0d0e21e 10495EOM
4633a7c4
LW
10496 cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
10497fi
10498$rm -f cpp_stuff.*
a0d0e21e 10499
4633a7c4
LW
10500: see if this is a db.h system
10501set db.h i_db
10502eval $inhdr
10503
10504case "$i_db" in
68dc0745 10505$define)
1f70e1ea 10506 : Check db version.
68dc0745 10507 echo " "
10508 echo "Checking Berkeley DB version ..." >&4
10509 $cat >try.c <<EOCP
10510#$d_const HASCONST
10511#ifndef HASCONST
10512#define const
10513#endif
10514#include <sys/types.h>
10515#include <stdio.h>
10516#include <db.h>
d674cd6d 10517int main()
68dc0745 10518{
1f70e1ea
PM
10519#ifdef DB_VERSION_MAJOR /* DB version >= 2 */
10520 int Major, Minor, Patch ;
ee02776e 10521 unsigned long Version ;
1f70e1ea
PM
10522 (void)db_version(&Major, &Minor, &Patch) ;
10523 printf("You have Berkeley DB Version 2 or greater\n");
10524
10525 printf("db.h is from Berkeley DB Version %d.%d.%d\n",
10526 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
10527 printf("libdb is from Berkeley DB Version %d.%d.%d\n",
10528 Major, Minor, Patch) ;
10529
10530 /* check that db.h & libdb are compatible */
10531 if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
10532 printf("db.h and libdb are incompatible\n") ;
10533 exit(3);
10534 }
10535
10536 printf("db.h and libdb are compatible\n") ;
ee02776e
PM
10537
10538 Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
693762b4 10539 + DB_VERSION_PATCH ;
ee02776e
PM
10540
10541 /* needs to be >= 2.3.4 */
10542 if (Version < 2003004) {
693762b4 10543 /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
ee02776e 10544 printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
1f70e1ea
PM
10545 exit(2);
10546 }
10547
10548 exit(0);
68dc0745 10549#else
6a1b87e5 10550#if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
1f70e1ea 10551 printf("You have Berkeley DB Version 1\n");
6a1b87e5
JH
10552 exit(0); /* DB version < 2: the coast is clear. */
10553#else
10554 exit(1); /* <db.h> not Berkeley DB? */
10555#endif
68dc0745 10556#endif
10557}
10558EOCP
dfe9444c
AD
10559 set try
10560 if eval $compile && ./try; then
1f70e1ea 10561 echo 'Looks OK.' >&4
68dc0745 10562 else
c90c0ff4 10563 echo "I can't use Berkeley DB with your <db.h>. I'll disable Berkeley DB." >&4
68dc0745 10564 i_db=$undef
10565 case " $libs " in
10566 *"-ldb "*)
10567 : Remove db from list of libraries to use
10568 echo "Removing unusable -ldb from library list" >&4
10569 set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
10570 shift
10571 libs="$*"
10572 echo "libs = $libs" >&4
10573 ;;
10574 esac
10575 fi
10576 $rm -f try.*
10577 ;;
10578esac
10579
10580case "$i_db" in
4633a7c4 10581define)
dc45a647
MB
10582 : Check the return type needed for hash
10583 echo " "
10584 echo "Checking return type needed for hash for Berkeley DB ..." >&4
10585 $cat >try.c <<EOCP
10586#$d_const HASCONST
10587#ifndef HASCONST
10588#define const
10589#endif
10590#include <sys/types.h>
10591#include <db.h>
10592
10593#ifndef DB_VERSION_MAJOR
10594u_int32_t hash_cb (ptr, size)
10595const void *ptr;
10596size_t size;
10597{
10598}
10599HASHINFO info;
d674cd6d 10600int main()
dc45a647
MB
10601{
10602 info.hash = hash_cb;
10603}
10604#endif
10605EOCP
10606 if $cc $ccflags -c try.c >try.out 2>&1 ; then
10607 if $contains warning try.out >>/dev/null 2>&1 ; then
10608 db_hashtype='int'
10609 else
10610 db_hashtype='u_int32_t'
10611 fi
10612 else
10613 : XXX Maybe we should just give up here.
10614 db_hashtype=u_int32_t
10615 $cat try.out >&4
10616 echo "Help: I can't seem to compile the db test program." >&4
10617 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
10618 fi
10619 $rm -f try.*
10620 echo "Your version of Berkeley DB uses $db_hashtype for hash."
10621 ;;
10622*) db_hashtype=u_int32_t
10623 ;;
10624esac
10625case "$i_db" in
10626define)
4633a7c4
LW
10627 : Check the return type needed for prefix
10628 echo " "
10629 echo "Checking return type needed for prefix for Berkeley DB ..." >&4
10630 cat >try.c <<EOCP
10631#$d_const HASCONST
10632#ifndef HASCONST
10633#define const
10634#endif
10635#include <sys/types.h>
10636#include <db.h>
1f70e1ea
PM
10637
10638#ifndef DB_VERSION_MAJOR
4633a7c4
LW
10639size_t prefix_cb (key1, key2)
10640const DBT *key1;
10641const DBT *key2;
10642{
10643}
10644BTREEINFO info;
d674cd6d 10645int main()
4633a7c4
LW
10646{
10647 info.prefix = prefix_cb;
10648}
1f70e1ea 10649#endif
4633a7c4
LW
10650EOCP
10651 if $cc $ccflags -c try.c >try.out 2>&1 ; then
10652 if $contains warning try.out >>/dev/null 2>&1 ; then
10653 db_prefixtype='int'
10654 else
10655 db_prefixtype='size_t'
10656 fi
10657 else
68dc0745 10658 db_prefixtype='size_t'
10659 : XXX Maybe we should just give up here.
dc45a647 10660 $cat try.out >&4
68dc0745 10661 echo "Help: I can't seem to compile the db test program." >&4
10662 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
4633a7c4
LW
10663 fi
10664 $rm -f try.*
10665 echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
a0d0e21e 10666 ;;
68dc0745 10667*) db_prefixtype='size_t'
4633a7c4
LW
10668 ;;
10669esac
a0d0e21e 10670
4633a7c4
LW
10671: check for void type
10672echo " "
10673echo "Checking to see how well your C compiler groks the void type..." >&4
4633a7c4
LW
10674case "$voidflags" in
10675'')
10676 $cat >try.c <<'EOCP'
10677#if TRY & 1
760ac839 10678void sub() {
4633a7c4 10679#else
760ac839 10680sub() {
4633a7c4
LW
10681#endif
10682 extern void moo(); /* function returning void */
10683 void (*goo)(); /* ptr to func returning void */
10684#if TRY & 8
10685 void *hue; /* generic ptr */
10686#endif
10687#if TRY & 2
10688 void (*foo[10])();
10689#endif
a0d0e21e 10690
4633a7c4
LW
10691#if TRY & 4
10692 if(goo == moo) {
10693 exit(0);
10694 }
10695#endif
10696 exit(0);
10697}
d674cd6d 10698int main() { sub(); }
4633a7c4 10699EOCP
760ac839 10700 if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
4633a7c4 10701 voidflags=$defvoidused
bfb7748a 10702 echo "Good. It appears to support void to the level $package wants.">&4
4633a7c4
LW
10703 if $contains warning .out >/dev/null 2>&1; then
10704 echo "However, you might get some warnings that look like this:"
10705 $cat .out
10706 fi
10707 else
10708echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
760ac839 10709 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
4633a7c4 10710 echo "It supports 1..."
760ac839 10711 if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
4633a7c4 10712 echo "It also supports 2..."
760ac839 10713 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
4633a7c4
LW
10714 voidflags=7
10715 echo "And it supports 4 but not 8 definitely."
10716 else
10717 echo "It doesn't support 4..."
760ac839 10718 if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
4633a7c4
LW
10719 voidflags=11
10720 echo "But it supports 8."
10721 else
10722 voidflags=3
10723 echo "Neither does it support 8."
10724 fi
10725 fi
10726 else
10727 echo "It does not support 2..."
760ac839 10728 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
4633a7c4
LW
10729 voidflags=13
10730 echo "But it supports 4 and 8."
10731 else
760ac839 10732 if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
4633a7c4
LW
10733 voidflags=5
10734 echo "And it supports 4 but has not heard about 8."
10735 else
10736 echo "However it supports 8 but not 4."
10737 fi
10738 fi
10739 fi
10740 else
10741 echo "There is no support at all for void."
10742 voidflags=0
10743 fi
10744 fi
10745esac
4633a7c4 10746case "$voidflags" in
2c7991dc 10747"$defvoidused") ;;
bfb7748a
AD
10748*) $cat >&4 <<'EOM'
10749 Support flag bits are:
10750 1: basic void declarations.
10751 2: arrays of pointers to functions returning void.
10752 4: operations between pointers to and addresses of void functions.
10753 8: generic void pointers.
10754EOM
2c7991dc 10755 dflt="$voidflags";
4633a7c4 10756 rp="Your void support flags add up to what?"
a0d0e21e 10757 . ./myread
4633a7c4 10758 voidflags="$ans"
a0d0e21e
LW
10759 ;;
10760esac
4633a7c4 10761$rm -f try.* .out
a0d0e21e 10762
85ab1d1d
JH
10763
10764: How can we generate normalized random numbers ?
693762b4 10765echo " "
de4597cb 10766echo "Looking for a random number function..." >&4
85ab1d1d 10767case "$randfunc" in
693762b4 10768'')
85ab1d1d
JH
10769 if set drand48 val -f; eval $csym; $val; then
10770 dflt="drand48"
10771 echo "Good, found drand48()." >&4
10772 elif set random val -f; eval $csym; $val; then
10773 dflt="random"
10774 echo "OK, found random()." >&4
10775 else
10776 dflt="rand"
10777 echo "Yick, looks like I have to use rand()." >&4
10778 fi
10779 echo " "
10780 ;;
10781*)
10782 dflt="$randfunc"
10783 ;;
10784esac
10785cont=true
10786
10787case "$ccflags" in
10788*-Dmy_rand=*|*-Dmy_srand=*)
10789 echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
10790 ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
10791 ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
10792 ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
10793 ;;
10794esac
10795
10796while $test "$cont"; do
10797 rp="Use which function to generate random numbers?"
10798 . ./myread
10799 if $test "$ans" = "$dflt"; then
10800 : null
10801 else
10802 randbits=''
10803 fi
10804 randfunc="$ans"
10805 if set $ans val -f; eval $csym; $val; then
10806 cont=''
10807 else
ef4af2be
JH
10808 dflt=y
10809 rp="I cannot find function $ans. Use that name anyway?"
85ab1d1d
JH
10810 . ./myread
10811 dflt=rand
10812 case "$ans" in
10813 [yY]*) cont='';;
10814 esac
10815 fi
10816 case "$cont" in
10817 '')
10818 case "$randfunc" in
10819 drand48)
10820 drand01="drand48()"
10821 seedfunc="srand48"
10822 randbits=48
10823 randseedtype=long
10824 ;;
10825 rand|random)
10826 case "$randbits" in
10827 '')
10828echo "Checking to see how many bits your $randfunc() function produces..." >&4
10829 $cat >try.c <<EOCP
10830#$i_unistd I_UNISTD
10831#$i_stdlib I_STDLIB
693762b4 10832#include <stdio.h>
85ab1d1d
JH
10833#ifdef I_UNISTD
10834# include <unistd.h>
10835#endif
10836#ifdef I_STDLIB
10837# include <stdlib.h>
10838#endif
d674cd6d 10839int main()
693762b4 10840{
85ab1d1d
JH
10841 register int i;
10842 register unsigned long tmp;
10843 register unsigned long max = 0L;
10844
10845 for (i = 1000; i; i--) {
10846 tmp = (unsigned long) $randfunc();
10847 if (tmp > max) max = tmp;
10848 }
10849 for (i = 0; max; i++)
10850 max /= 2;
10851 printf("%d\n",i);
693762b4
AD
10852}
10853EOCP
85ab1d1d
JH
10854 set try
10855 if eval $compile_ok; then
10856 dflt=`try`
10857 else
10858 dflt='?'
10859 echo "(I can't seem to compile the test program...)"
10860 fi
10861 ;;
10862 *)
10863 dflt="$randbits"
10864 ;;
10865 esac
10866 rp="How many bits does your $randfunc() function produce?"
10867 . ./myread
10868 randbits="$ans"
10869 $rm -f try.c try
10870 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
10871 seedfunc="s$randfunc"
10872 randseedtype=unsigned
10873 ;;
10874 *)
10875 dflt="31"
10876 rp="How many bits does your $randfunc() function produce?"
10877 . ./myread
10878 randbits="$ans"
10879 seedfunc="s$randfunc"
10880 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
10881 if set $seedfunc val -f; eval $csym; $val; then
10882 echo "(Using $seedfunc() to seed random generator)"
10883 else
10884 echo "(Warning: no $seedfunc() to seed random generator)"
10885 seedfunc=rand
10886 fi
10887 randseedtype=unsigned
10888 ;;
10889 esac
10890 ;;
10891 esac
10892done
693762b4 10893
5ff3f7a4
GS
10894echo " "
10895echo "Determining whether or not we are on an EBCDIC system..." >&4
10896$cat >tebcdic.c <<'EOM'
10897int main()
10898{
10899 if ('M'==0xd4) return 0;
10900 return 1;
10901}
10902EOM
10903
10904val=$undef
10905set tebcdic
10906if eval $compile_ok; then
10907 if ./tebcdic; then
10908 echo "You have EBCDIC." >&4
10909 val="$define"
10910 else
10911 echo "Nope, no EBCDIC. Assuming ASCII or some ISO Latin." >&4
10912 fi
10913else
5cc3184f 10914 echo "I'm unable to compile the test program." >&4
5ff3f7a4
GS
10915 echo "I'll assume ASCII or some ISO Latin." >&4
10916fi
10917$rm -f tebcdic.c tebcdic
10918set ebcdic
10919eval $setvar
10920
66fe083f
JH
10921: check for fflush NULL behaviour
10922case "$fflushNULL" in
10923'') $cat <<EOM
10924
10925Checking to see whether fflush(NULL) flushes all pending stdio output...
10926EOM
10927 $cat >try.c <<EOCP
10928#include <stdio.h>
10929int main() {
10930 FILE* p = fopen("try.out", "w");
10931 fputc('x', p);
10932 fflush(NULL);
10933 _exit(0);
10934}
10935EOCP
10936 set try
10937 $rm -f try.out
10938 if eval $compile_ok; then
c2fddd50
JH
10939 ./try$exe_ext
10940 if $test -s try.out; then
10941 fflushNULL="`$cat try.out`"
10942 fi
10943 fi
10944 case "$fflushNULL" in
10945 x) cat >&4 <<EOM
66fe083f
JH
10946Your fflush(NULL) works okay.
10947EOM
c2fddd50
JH
10948 fflushNULL=define
10949 ;;
10950 '') cat >&4 <<EOM
66fe083f
JH
10951Your fflush(NULL) isn't working (contrary to ANSI C).
10952EOM
c2fddd50
JH
10953 fflushNULL=undef
10954 ;;
10955 *) cat >&4 <<EOM
66fe083f
JH
10956Cannot figure out whether your fflush(NULL) works or not.
10957I'm assuming it doesn't (contrary to ANSI C).
10958EOM
c2fddd50
JH
10959 fflushNULL=undef
10960 ;;
10961 esac
66fe083f
JH
10962 $rm -f try.* try
10963 ;;
10964$define|true|[yY]*)
10965 fflushNULL=define
10966 ;;
10967*)
10968 fflushNULL=undef
10969 ;;
10970esac
10971
a0d0e21e 10972: see what type file positions are declared as in the library
a0d0e21e 10973rp="What is the type for file position used by fsetpos()?"
dc45a647
MB
10974set fpos_t fpostype long stdio.h sys/types.h
10975eval $typedef_ask
2304df62 10976
ccc7f9b3
KS
10977: Store the full pathname to the ar program for use in the C program
10978: Respect a hint or command line value for full_ar.
10979case "$full_ar" in
10980'') full_ar=$ar ;;
10981esac
10982
1aef975c
AD
10983: Store the full pathname to the sed program for use in the C program
10984full_sed=$sed
10985
2304df62 10986: see what type gids are declared as in the kernel
dc45a647
MB
10987echo " "
10988echo "Looking for the type for group ids returned by getgid()."
a0d0e21e
LW
10989set gid_t gidtype xxx stdio.h sys/types.h
10990eval $typedef
2304df62 10991case "$gidtype" in
a0d0e21e
LW
10992xxx)
10993 xxx=`./findhdr sys/user.h`
10994 set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
10995 case $1 in
10996 unsigned) dflt="$1 $2" ;;
10997 *) dflt="$1" ;;
10998 esac
2304df62 10999 ;;
a0d0e21e 11000*) dflt="$gidtype";;
2304df62 11001esac
dc45a647
MB
11002case "$gidtype" in
11003gid_t) echo "gid_t found." ;;
11004*) rp="What is the type for group ids returned by getgid()?"
11005 . ./myread
11006 gidtype="$ans"
11007 ;;
11008esac
a0d0e21e 11009
2304df62
AD
11010: see if getgroups exists
11011set getgroups d_getgrps
11012eval $inlibc
11013
5cd24f17 11014: see if setgroups exists
11015set setgroups d_setgrps
11016eval $inlibc
11017
dfe9444c 11018
8cc95fdb 11019: Find type of 2nd arg to 'getgroups()' and 'setgroups()'
a0d0e21e 11020echo " "
5cd24f17 11021case "$d_getgrps$d_setgrps" in
11022*define*)
a0d0e21e 11023 case "$groupstype" in
2304df62
AD
11024 '') dflt="$gidtype" ;;
11025 *) dflt="$groupstype" ;;
a0d0e21e
LW
11026 esac
11027 $cat <<EOM
dc45a647 11028What type of pointer is the second argument to getgroups() and setgroups()?
5cd24f17 11029Usually this is the same as group ids, $gidtype, but not always.
2304df62
AD
11030
11031EOM
dc45a647 11032 rp='What type pointer is the second argument to getgroups() and setgroups()?'
a0d0e21e
LW
11033 . ./myread
11034 groupstype="$ans"
11035 ;;
11036*) groupstype="$gidtype";;
2304df62 11037esac
2304df62 11038
85e6fe83 11039: see what type lseek is declared as in the kernel
dc45a647 11040rp="What is the type used for lseek's offset on this system?"
a0d0e21e 11041set off_t lseektype long stdio.h sys/types.h
dc45a647 11042eval $typedef_ask
2304df62 11043
8ff267be 11044echo " "
5ff3f7a4
GS
11045$echo $n "Checking to see how big your file offsets are...$c" >&4
11046$cat >try.c <<EOCP
11047#include <sys/types.h>
11048#include <stdio.h>
5a411a32 11049int main()
5ff3f7a4
GS
11050{
11051 printf("%d\n", sizeof($lseektype));
11052}
11053EOCP
11054set try
11055if eval $compile_ok; then
11056 lseeksize=`./try`
11057 $echo " $lseeksize bytes." >&4
11058else
11059 dflt='4'
11060 echo " "
11061 echo "(I can't seem to compile the test program. Guessing...)"
11062 rp="What is the size of your file offsets (in bytes)?"
11063 . ./myread
11064 lseeksize="$ans"
11065fi
11066$rm -f try.c try
11067
11068echo " "
dfe9444c 11069echo "Checking if your $make program sets \$(MAKE)..." >&4
8ff267be 11070case "$make_set_make" in
11071'')
11072 $sed 's/^X //' > testmake.mak << 'EOF'
11073Xall:
dfe9444c 11074X @echo 'maketemp="$(MAKE)"'
8ff267be 11075EOF
8ff267be 11076 case "`$make -f testmake.mak 2>/dev/null`" in
dfe9444c 11077 *maketemp=*) make_set_make='#' ;;
8ff267be 11078 *) make_set_make="MAKE=$make" ;;
11079 esac
dfe9444c
AD
11080 $rm -f testmake.mak
11081 ;;
11082esac
11083case "$make_set_make" in
11084'#') echo "Yup, it does.";;
11085*) echo "Nope, it doesn't.";;
11086esac
11087
11088: see what type is used for mode_t
dc45a647 11089rp="What is the type used for file modes for system calls (e.g. fchmod())?"
dfe9444c 11090set mode_t modetype int stdio.h sys/types.h
dc45a647 11091eval $typedef_ask
dfe9444c 11092
dfe9444c
AD
11093: define a fucntion to check prototypes
11094$cat > protochk <<EOSH
11095$startsh
11096cc="$cc"
11097optimize="$optimize"
11098ccflags="$ccflags"
11099prototype="$prototype"
11100define="$define"
11101rm=$rm
11102EOSH
11103
11104$cat >> protochk <<'EOSH'
11105
11106$rm -f try.c
11107foo="$1"
11108shift
11109while test $# -ge 2; do
11110 case "$1" in
11111 $define) echo "#include <$2>" >> try.c ;;
11112 literal) echo "$2" >> try.c ;;
11113 esac
11114 shift 2
11115done
11116test "$prototype" = "$define" && echo '#define CAN_PROTOTYPE' >> try.c
11117cat >> try.c <<'EOCP'
11118#ifdef CAN_PROTOTYPE
11119#define _(args) args
11120#else
11121#define _(args) ()
11122#endif
11123EOCP
11124echo "$foo" >> try.c
11125echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
11126$cc $optimize $ccflags -c try.c > /dev/null 2>&1
11127status=$?
11128$rm -f try.[co]
11129exit $status
11130EOSH
11131chmod +x protochk
11132$eunicefix protochk
11133
dfe9444c 11134: see what type is used for size_t
dc45a647 11135rp="What is the type used for the length parameter for string functions?"
dfe9444c 11136set size_t sizetype 'unsigned int' stdio.h sys/types.h
dc45a647 11137eval $typedef_ask
dfe9444c
AD
11138
11139: check for type of arguments to gethostbyaddr.
11140if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
11141 case "$d_gethbyaddr" in
11142 $define)
11143 $cat <<EOM
11144
11145Checking to see what type of arguments are accepted by gethostbyaddr().
11146EOM
11147 hdrs="$define sys/types.h
11148 $d_socket sys/socket.h
11149 $i_niin netinet/in.h
11150 $i_netdb netdb.h
11151 $i_unistd unistd.h"
11152 : The first arg can 'char *' or 'void *'
11153 : The second arg is some of integral type
11154 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
11155 for yyy in size_t long int; do
11156 case "$netdb_host_type" in
11157 '') try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
11158 if ./protochk "$try" $hdrs; then
11159 echo "Your system accepts $xxx for the first arg."
11160 echo "...and $yyy for the second arg."
11161 netdb_host_type="$xxx"
11162 netdb_hlen_type="$yyy"
11163 fi
11164 ;;
11165 esac
11166 done
11167 done
11168 : In case none of those worked, prompt the user.
11169 case "$netdb_host_type" in
11170 '') rp='What is the type for the 1st argument to gethostbyaddr?'
11171 dflt='char *'
11172 . ./myread
11173 netdb_host_type=$ans
11174 rp='What is the type for the 2nd argument to gethostbyaddr?'
11175 dflt="$sizetype"
11176 . ./myread
11177 netdb_hlen_type=$ans
11178 ;;
11179 esac
11180 ;;
11181 *) : no gethostbyaddr, so pick harmless defaults
11182 netdb_host_type='char *'
11183 netdb_hlen_type="$sizetype"
11184 ;;
11185 esac
11186 # Remove the "const" if needed. -- but then we'll have a
11187 # prototype clash!
11188 # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
11189fi
11190
11191: check for type of argument to gethostbyname.
11192if test "X$netdb_name_type" = X ; then
11193 case "$d_gethbyname" in
11194 $define)
11195 $cat <<EOM
11196
11197Checking to see what type of argument is accepted by gethostbyname().
11198EOM
11199 hdrs="$define sys/types.h
11200 $d_socket sys/socket.h
11201 $i_niin netinet/in.h
11202 $i_netdb netdb.h
11203 $i_unistd unistd.h"
11204 for xxx in "const char *" "char *"; do
11205 case "$netdb_name_type" in
11206 '') try="extern struct hostent *gethostbyname($xxx);"
11207 if ./protochk "$try" $hdrs; then
11208 echo "Your system accepts $xxx."
11209 netdb_name_type="$xxx"
11210 fi
11211 ;;
11212 esac
11213 done
11214 : In case none of those worked, prompt the user.
11215 case "$netdb_name_type" in
11216 '') rp='What is the type for the 1st argument to gethostbyname?'
11217 dflt='char *'
11218 . ./myread
11219 netdb_name_type=$ans
11220 ;;
11221 esac
11222 ;;
11223 *) : no gethostbyname, so pick harmless default
11224 netdb_name_type='char *'
11225 ;;
11226 esac
11227fi
8ff267be 11228
dfe9444c
AD
11229: check for type of 1st argument to getnetbyaddr.
11230if test "X$netdb_net_type" = X ; then
11231 case "$d_getnbyaddr" in
11232 $define)
11233 $cat <<EOM
85e6fe83 11234
dfe9444c
AD
11235Checking to see what type of 1st argument is accepted by getnetbyaddr().
11236EOM
11237 hdrs="$define sys/types.h
11238 $d_socket sys/socket.h
11239 $i_niin netinet/in.h
11240 $i_netdb netdb.h
11241 $i_unistd unistd.h"
11242 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
11243 case "$netdb_net_type" in
11244 '') try="extern struct netent *getnetbyaddr($xxx, int);"
11245 if ./protochk "$try" $hdrs; then
11246 echo "Your system accepts $xxx."
11247 netdb_net_type="$xxx"
11248 fi
11249 ;;
11250 esac
11251 done
11252 : In case none of those worked, prompt the user.
11253 case "$netdb_net_type" in
11254 '') rp='What is the type for the 1st argument to getnetbyaddr?'
11255 dflt='long'
11256 . ./myread
11257 netdb_net_type=$ans
11258 ;;
11259 esac
11260 ;;
11261 *) : no getnetbyaddr, so pick harmless default
e5c9fcd0 11262 netdb_net_type='long'
dfe9444c
AD
11263 ;;
11264 esac
11265fi
2c7991dc 11266: locate the preferred pager for this system
11267case "$pager" in
11268'')
11269 dflt=''
11270 case "$pg" in
11271 /*) dflt=$pg;;
11272 esac
11273 case "$more" in
11274 /*) dflt=$more;;
11275 esac
11276 case "$less" in
11277 /*) dflt=$less;;
11278 esac
11279 case "$dflt" in
11280 '') dflt=/usr/ucb/more;;
11281 esac
11282 ;;
11283*) dflt="$pager";;
11284esac
11285echo " "
11286fn=f/
11287rp='What pager is used on your system?'
11288. ./getfile
11289pager="$ans"
11290
dfe9444c 11291: see what type pids are declared as in the kernel
dc45a647 11292rp="What is the type of process ids on this system?"
dfe9444c 11293set pid_t pidtype int stdio.h sys/types.h
dc45a647 11294eval $typedef_ask
2304df62 11295
693762b4
AD
11296: check for length of pointer
11297echo " "
11298case "$ptrsize" in
11299'')
dc45a647 11300 $echo $n "Checking to see how big your pointers are...$c" >&4
693762b4
AD
11301 if test "$voidflags" -gt 7; then
11302 echo '#define VOID_PTR char *' > try.c
11303 else
11304 echo '#define VOID_PTR void *' > try.c
11305 fi
11306 $cat >>try.c <<'EOCP'
11307#include <stdio.h>
d674cd6d 11308int main()
693762b4
AD
11309{
11310 printf("%d\n", sizeof(VOID_PTR));
11311 exit(0);
11312}
11313EOCP
11314 set try
dc45a647 11315 if eval $compile_ok; then
693762b4 11316 ptrsize=`./try`
dc45a647 11317 $echo " $ptrsize bytes." >&4
693762b4
AD
11318 else
11319 dflt='4'
11320 echo "(I can't seem to compile the test program. Guessing...)" >&4
11321 rp="What is the size of a pointer (in bytes)?"
11322 . ./myread
11323 ptrsize="$ans"
11324 fi
11325 ;;
11326esac
11327$rm -f try.c try
11328
a0d0e21e
LW
11329: see if ar generates random libraries by itself
11330echo " "
11331echo "Checking how to generate random libraries on your machine..." >&4
11332echo 'int bar1() { return bar2(); }' > bar1.c
11333echo 'int bar2() { return 2; }' > bar2.c
11334$cat > foo.c <<'EOP'
d674cd6d 11335int main() { printf("%d\n", bar1()); exit(0); }
a0d0e21e
LW
11336EOP
11337$cc $ccflags -c bar1.c >/dev/null 2>&1
11338$cc $ccflags -c bar2.c >/dev/null 2>&1
11339$cc $ccflags -c foo.c >/dev/null 2>&1
dfe9444c
AD
11340$ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
11341if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
a0d0e21e 11342 ./foobar >/dev/null 2>&1; then
4e2a5f63 11343 echo "$ar appears to generate random libraries itself."
a0d0e21e
LW
11344 orderlib=false
11345 ranlib=":"
dfe9444c
AD
11346elif $ar ts bar$_a >/dev/null 2>&1 &&
11347 $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
a0d0e21e 11348 ./foobar >/dev/null 2>&1; then
4e2a5f63 11349 echo "a table of contents needs to be added with '$ar ts'."
a0d0e21e 11350 orderlib=false
dfe9444c 11351 ranlib="$ar ts"
a0d0e21e 11352else
ecfc5424
AD
11353 case "$ranlib" in
11354 :) ranlib='';;
11355 '')
11356 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
11357 $test -f $ranlib || ranlib=''
11358 ;;
11359 esac
a0d0e21e 11360 if $test -n "$ranlib"; then
ecfc5424 11361 echo "your system has '$ranlib'; we'll use that."
a0d0e21e
LW
11362 orderlib=false
11363 else
11364 echo "your system doesn't seem to support random libraries"
11365 echo "so we'll use lorder and tsort to order the libraries."
11366 orderlib=true
11367 ranlib=":"
11368 fi
11369fi
11370$rm -f foo* bar*
11371
dfe9444c
AD
11372: check for type of arguments to select.
11373case "$selecttype" in
11374'') case "$d_select" in
11375 $define)
11376 $cat <<EOM
11377Checking to see what type of arguments are accepted by select().
11378EOM
11379 hdrs="$define sys/types.h
11380 $i_systime sys/time.h
11381 $i_sysselct sys/select.h
11382 $d_socket sys/socket.h"
11383 : The first arg can be int, unsigned, or size_t
11384 : The last arg may or may not be 'const'
11385 val=''
7f3d1cf1
BH
11386 : void pointer has been seen but using that
11387 : breaks the selectminbits test
11388 for xxx in 'fd_set *' 'int *'; do
1cfa4ec7 11389 for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
dfe9444c
AD
11390 for tmo in 'struct timeval *' 'const struct timeval *'; do
11391 case "$val" in
11392 '') try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
11393 if ./protochk "$try" $hdrs; then
11394 echo "Your system accepts $xxx."
11395 val="$xxx"
11396 fi
11397 ;;
11398 esac
11399 done
11400 done
11401 done
11402 case "$val" in
11403 '') rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
11404 case "$d_fd_set" in
11405 $define) dflt="fd_set *" ;;
11406 *) dflt="int *" ;;
11407 esac
11408 . ./myread
11409 val=$ans
11410 ;;
a0d0e21e 11411 esac
dfe9444c 11412 selecttype="$val"
a0d0e21e 11413 ;;
dfe9444c
AD
11414 *) : no select, so pick a harmless default
11415 selecttype='int *'
a0d0e21e
LW
11416 ;;
11417 esac
a0d0e21e
LW
11418 ;;
11419esac
2304df62 11420
5ff3f7a4
GS
11421: check for the select 'width'
11422case "$selectminbits" in
11423'') case "$d_select" in
11424 $define)
11425 $cat <<EOM
11426
85ab1d1d 11427Checking to see on how many bits at a time your select() operates...
5ff3f7a4
GS
11428EOM
11429 $cat >try.c <<EOCP
11430#include <sys/types.h>
11431#$i_time I_TIME
11432#$i_systime I_SYS_TIME
11433#$i_systimek I_SYS_TIME_KERNEL
11434#ifdef I_TIME
11435# include <time.h>
11436#endif
11437#ifdef I_SYS_TIME
11438# ifdef I_SYS_TIME_KERNEL
11439# define KERNEL
11440# endif
11441# include <sys/time.h>
11442# ifdef I_SYS_TIME_KERNEL
11443# undef KERNEL
11444# endif
11445#endif
11446#$i_sysselct I_SYS_SELECT
11447#ifdef I_SYS_SELECT
11448#include <sys/select.h>
11449#endif
11450#include <stdio.h>
fb164848
JH
11451$selecttype b;
11452#define S sizeof(*(b))
5ff3f7a4
GS
11453#define MINBITS 64
11454#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
11455#define NBITS (NBYTES * 8)
11456int main() {
11457 char s[NBYTES];
5ff3f7a4
GS
11458 struct timeval t;
11459 int i;
11460 FILE* fp;
11461 int fd;
11462
11463 fclose(stdin);
11464 fp = fopen("try.c", "r");
11465 if (fp == 0)
11466 exit(1);
11467 fd = fileno(fp);
11468 if (fd < 0)
11469 exit(2);
11470 b = ($selecttype)s;
11471 for (i = 0; i < NBITS; i++)
11472 FD_SET(i, b);
11473 t.tv_sec = 0;
11474 t.tv_usec = 0;
11475 select(fd + 1, b, 0, 0, &t);
11476 for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
11477 printf("%d\n", i + 1);
11478 return 0;
11479}
11480EOCP
11481 set try
11482 if eval $compile_ok; then
11483 selectminbits=`./try`
85ab1d1d 11484 case "$selectminbits" in
fb164848
JH
11485 '') cat >&4 <<EOM
11486Cannot figure out on how many bits at a time your select() operates.
11487I'll play safe and guess it is 32 bits.
11488EOM
11489 selectminbits=32
11490 bits="32 bits"
11491 ;;
85ab1d1d
JH
11492 1) bits="1 bit" ;;
11493 *) bits="$selectminbits bits" ;;
11494 esac
11495 echo "Your select() operates on $bits at a time." >&4
5ff3f7a4
GS
11496 else
11497 rp='What is the minimum number of bits your select() operates on?'
11498 case "$byteorder" in
11499 1234|12345678) dflt=32 ;;
11500 *) dflt=1 ;;
11501 esac
11502 . ./myread
11503 val=$ans
11504 selectminbits="$val"
11505 fi
11506 $rm -f try.* try
11507 ;;
11508 *) : no select, so pick a harmless default
11509 selectminbits='32'
11510 ;;
11511 esac
11512 ;;
11513esac
11514
8e07c86e
AD
11515: Trace out the files included by signal.h, then look for SIGxxx names.
11516: Remove SIGARRAYSIZE used by HPUX.
af4c28eb
CS
11517: Remove SIGSTKSIZE used by Linux.
11518: Remove SIGSTKSZ used by Posix.
4633a7c4 11519: Remove SIGTYP void lines used by OS2.
8e07c86e
AD
11520xxx=`echo '#include <signal.h>' |
11521 $cppstdin $cppminus $cppflags 2>/dev/null |
11522 $grep '^[ ]*#.*include' |
11523 $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
11524: Check this list of files to be sure we have parsed the cpp output ok.
11525: This will also avoid potentially non-existent files, such
11526: as ../foo/bar.h
11527xxxfiles=''
11528for xx in $xxx /dev/null ; do
11529 $test -f "$xx" && xxxfiles="$xxxfiles $xx"
11530done
11531: If we have found no files, at least try signal.h
11532case "$xxxfiles" in
11533'') xxxfiles=`./findhdr signal.h` ;;
11534esac
11535xxx=`awk '
af4c28eb 11536$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
8e07c86e
AD
11537 print substr($2, 4, 20)
11538}
4633a7c4 11539$1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
8e07c86e
AD
11540 print substr($3, 4, 20)
11541}' $xxxfiles`
11542: Append some common names just in case the awk scan failed.
11543xxx="$xxx ABRT ALRM BUS CHLD CLD CONT DIL EMT FPE HUP ILL INT IO IOT KILL"
11544xxx="$xxx LOST PHONE PIPE POLL PROF PWR QUIT SEGV STKFLT STOP SYS TERM TRAP"
11545xxx="$xxx TSTP TTIN TTOU URG USR1 USR2 USR3 USR4 VTALRM"
11546xxx="$xxx WINCH WIND WINDOW XCPU XFSZ"
11547: generate a few handy files for later
dc45a647 11548$cat > signal.c <<'EOCP'
4633a7c4
LW
11549#include <sys/types.h>
11550#include <signal.h>
dc45a647 11551#include <stdio.h>
4633a7c4 11552int main() {
760ac839
LW
11553
11554/* Strange style to avoid deeply-nested #if/#else/#endif */
11555#ifndef NSIG
11556# ifdef _NSIG
11557# define NSIG (_NSIG)
11558# endif
11559#endif
11560
11561#ifndef NSIG
11562# ifdef SIGMAX
11563# define NSIG (SIGMAX+1)
11564# endif
11565#endif
11566
11567#ifndef NSIG
11568# ifdef SIG_MAX
11569# define NSIG (SIG_MAX+1)
11570# endif
11571#endif
11572
11573#ifndef NSIG
11574# ifdef MAXSIG
11575# define NSIG (MAXSIG+1)
11576# endif
4633a7c4 11577#endif
760ac839
LW
11578
11579#ifndef NSIG
11580# ifdef MAX_SIG
11581# define NSIG (MAX_SIG+1)
11582# endif
11583#endif
11584
11585#ifndef NSIG
11586# ifdef SIGARRAYSIZE
11587# define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
11588# endif
11589#endif
11590
11591#ifndef NSIG
11592# ifdef _sys_nsig
11593# define NSIG (_sys_nsig) /* Solaris 2.5 */
11594# endif
11595#endif
11596
11597/* Default to some arbitrary number that's big enough to get most
11598 of the common signals.
11599*/
11600#ifndef NSIG
11601# define NSIG 50
4633a7c4 11602#endif
760ac839
LW
11603
11604printf("NSIG %d\n", NSIG);
11605
dc45a647
MB
11606#ifndef JUST_NSIG
11607
11608EOCP
11609
28e8609d 11610echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
8e07c86e
AD
11611{
11612 printf "#ifdef SIG"; printf $1; printf "\n"
11613 printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
11614 printf $1; printf ");\n"
11615 printf "#endif\n"
2304df62 11616}
2304df62 11617END {
dc45a647 11618 printf "#endif /* JUST_NSIG */\n";
8e07c86e 11619 printf "}\n";
2304df62 11620}
4633a7c4
LW
11621' >>signal.c
11622$cat >signal.awk <<'EOP'
11623BEGIN { ndups = 0 }
11624$1 ~ /^NSIG$/ { nsig = $2 }
11625($1 !~ /^NSIG$/) && (NF == 2) {
11626 if ($2 > maxsig) { maxsig = $2 }
11627 if (sig_name[$2]) {
11628 dup_name[ndups] = $1
11629 dup_num[ndups] = $2
11630 ndups++
11631 }
11632 else {
11633 sig_name[$2] = $1
11634 sig_num[$2] = $2
11635 }
4633a7c4
LW
11636}
11637END {
af4c28eb
CS
11638 if (nsig == 0) {
11639 nsig = maxsig + 1
11640 }
11641 printf("NSIG %d\n", nsig);
11642 for (n = 1; n < nsig; n++) {
11643 if (sig_name[n]) {
11644 printf("%s %d\n", sig_name[n], sig_num[n])
4633a7c4 11645 }
af4c28eb
CS
11646 else {
11647 printf("NUM%d %d\n", n, n)
11648 }
11649 }
4633a7c4 11650 for (n = 0; n < ndups; n++) {
af4c28eb 11651 printf("%s %d\n", dup_name[n], dup_num[n])
4633a7c4
LW
11652 }
11653}
11654EOP
11655$cat >signal_cmd <<EOS
8e07c86e 11656$startsh
dc45a647
MB
11657if $test -s signal.lst; then
11658 echo "Using your existing signal.lst file"
11659 exit 0
11660fi
11661xxx="$xxx"
11662EOS
11663$cat >>signal_cmd <<'EOS'
11664
11665set signal
11666if eval $compile_ok; then
dfe9444c 11667 ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
8e07c86e 11668else
dc45a647
MB
11669 echo "(I can't seem be able to compile the whole test program)" >&4
11670 echo "(I'll try it in little pieces.)" >&4
11671 set signal -DJUST_NSIG
11672 if eval $compile_ok; then
11673 ./signal$_exe > signal.nsg
11674 $cat signal.nsg
11675 else
11676 echo "I can't seem to figure out how many signals you have." >&4
11677 echo "Guessing 50." >&4
11678 echo 'NSIG 50' > signal.nsg
11679 fi
11680 : Now look at all the signal names, one at a time.
28e8609d 11681 for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
dc45a647
MB
11682 $cat > signal.c <<EOCP
11683#include <sys/types.h>
11684#include <signal.h>
11685#include <stdio.h>
11686int main() {
11687printf("$xx %d\n", SIG${xx});
11688return 0;
11689}
11690EOCP
11691 set signal
11692 if eval $compile; then
11693 echo "SIG${xx} found."
11694 ./signal$_exe >> signal.ls1
11695 else
11696 echo "SIG${xx} NOT found."
11697 fi
11698 done
11699 if $test -s signal.ls1; then
11700 $cat signal.nsg signal.ls1 |
11701 $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
11702 fi
11703
11704fi
11705if $test -s signal.lst; then
11706 :
11707else
11708 echo "(AAK! I can't compile the test programs -- Guessing)" >&4
8e07c86e 11709 echo 'kill -l' >signal
dc45a647 11710 set X `csh -f <signal`
8e07c86e 11711 $rm -f signal
2304df62 11712 shift
dc45a647 11713 case $# in
8e07c86e 11714 0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
2304df62 11715 esac
28e8609d 11716 echo $@ | $tr ' ' $trnl | \
af4c28eb
CS
11717 $awk '{ printf "%s %d\n", $1, ++s; }
11718 END { printf "NSIG %d\n", ++s }' >signal.lst
8e07c86e 11719fi
dc45a647 11720$rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
8e07c86e 11721EOS
4633a7c4
LW
11722chmod a+x signal_cmd
11723$eunicefix signal_cmd
8e07c86e
AD
11724
11725: generate list of signal names
11726echo " "
dfe9444c 11727case "$sig_name_init" in
6626bf4c
JH
11728'') doinit=yes ;;
11729*) case "$sig_num_init" in
11730 ''|*,*) doinit=yes ;;
11731 esac ;;
11732esac
11733case "$doinit" in
11734yes)
4633a7c4 11735 echo "Generating a list of signal names and numbers..." >&4
dc45a647 11736 . ./signal_cmd
af4c28eb
CS
11737 sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
11738 sig_name=`$awk 'BEGIN { printf "ZERO " }
11739 !/^NSIG/ { printf "%s ", $1 }' signal.lst`
11740 sig_num=`$awk 'BEGIN { printf "0 " }
11741 !/^NSIG/ { printf "%d ", $2 }' signal.lst`
11742 sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
11743 !/^NSIG/ { printf "\"%s\", ", $1 }
11744 END { printf "0\n" }' signal.lst`
11745 sig_num_init=`$awk 'BEGIN { printf "0, " }
11746 !/^NSIG/ { printf "%d, ", $2}
11747 END { printf "0\n"}' signal.lst`
11748 ;;
11749esac
11750echo "The following $sig_count signals are available:"
a0d0e21e
LW
11751echo " "
11752echo $sig_name | $awk \
11753'BEGIN { linelen = 0 }
11754{
8e07c86e 11755 for (i = 1; i <= NF; i++) {
a0d0e21e
LW
11756 name = "SIG" $i " "
11757 linelen = linelen + length(name)
11758 if (linelen > 70) {
11759 printf "\n"
11760 linelen = length(name)
11761 }
11762 printf "%s", name
11763 }
8e07c86e 11764 printf "\n"
a0d0e21e 11765}'
4633a7c4 11766$rm -f signal signal.c signal.awk signal.lst signal_cmd
a0d0e21e 11767
a0d0e21e
LW
11768: see what type is used for signed size_t
11769set ssize_t ssizetype int stdio.h sys/types.h
11770eval $typedef
11771dflt="$ssizetype"
11772$cat > ssize.c <<EOM
11773#include <stdio.h>
11774#include <sys/types.h>
11775#define Size_t $sizetype
11776#define SSize_t $dflt
d674cd6d 11777int main()
a0d0e21e
LW
11778{
11779 if (sizeof(Size_t) == sizeof(SSize_t))
11780 printf("$dflt\n");
11781 else if (sizeof(Size_t) == sizeof(int))
11782 printf("int\n");
11783 else
11784 printf("long\n");
760ac839 11785 exit(0);
a0d0e21e
LW
11786}
11787EOM
11788echo " "
dfe9444c 11789set ssize
dc45a647 11790if eval $compile_ok && ./ssize > /dev/null; then
dfe9444c 11791 ssizetype=`./ssize`
a0d0e21e
LW
11792 echo "I'll be using $ssizetype for functions returning a byte count." >&4
11793else
24fef2a7 11794 $cat >&4 <<EOM
24fef2a7
AD
11795Help! I can't compile and run the ssize_t test program: please enlighten me!
11796(This is probably a misconfiguration in your system or libraries, and
11797you really ought to fix it. Still, I'll try anyway.)
a0d0e21e
LW
11798
11799I need a type that is the same size as $sizetype, but is guaranteed to
24fef2a7 11800be signed. Common values are ssize_t, int and long.
a0d0e21e
LW
11801
11802EOM
11803 rp="What signed type is the same size as $sizetype?"
11804 . ./myread
11805 ssizetype="$ans"
11806fi
dfe9444c 11807$rm -f ssize ssize.*
3fd537d4 11808
a0d0e21e
LW
11809: see what type of char stdio uses.
11810echo " "
11811if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
11812 echo "Your stdio uses unsigned chars." >&4
11813 stdchar="unsigned char"
11814else
11815 echo "Your stdio uses signed chars." >&4
11816 stdchar="char"
11817fi
11818
11819: see if time exists
11820echo " "
28e8609d
JH
11821if test "X$d_time" = X -o X"$timetype" = X; then
11822 if set time val -f d_time; eval $csym; $val; then
5ff3f7a4
GS
11823 echo 'time() found.' >&4
11824 val="$define"
11825 rp="What is the type returned by time() on this system?"
11826 set time_t timetype long stdio.h sys/types.h
11827 eval $typedef_ask
28e8609d 11828 else
5ff3f7a4
GS
11829 echo 'time() not found, hope that will do.' >&4
11830 val="$undef"
11831 timetype='int';
28e8609d
JH
11832 fi
11833 set d_time
11834 eval $setvar
a0d0e21e 11835fi
a0d0e21e
LW
11836
11837: see what type uids are declared as in the kernel
dc45a647
MB
11838echo " "
11839echo "Looking for the type for user ids returned by getuid()."
a0d0e21e
LW
11840set uid_t uidtype xxx stdio.h sys/types.h
11841eval $typedef
11842case "$uidtype" in
11843xxx)
11844 xxx=`./findhdr sys/user.h`
11845 set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
11846 case $1 in
11847 unsigned) dflt="$1 $2" ;;
11848 *) dflt="$1" ;;
11849 esac
11850 ;;
4633a7c4
LW
11851*) dflt="$uidtype";;
11852esac
dc45a647
MB
11853case "$uidtype" in
11854uid_t) echo "uid_t found." ;;
11855*) rp="What is the type for user ids returned by getuid()?"
11856 . ./myread
11857 uidtype="$ans"
11858 ;;
11859esac
4633a7c4
LW
11860
11861: see if dbm.h is available
11862: see if dbmclose exists
11863set dbmclose d_dbmclose
11864eval $inlibc
11865
11866case "$d_dbmclose" in
11867$define)
11868 set dbm.h i_dbm
11869 eval $inhdr
5f80c64f
JH
11870 case "$i_dbm" in
11871 $define)
11872 val="$undef"
11873 set i_rpcsvcdbm
11874 eval $setvar
11875 ;;
11876 *) set rpcsvc/dbm.h i_rpcsvcdbm
11877 eval $inhdr
11878 ;;
11879 esac
11880 ;;
11881*) echo "We won't be including <dbm.h>"
11882 val="$undef"
11883 set i_dbm
11884 eval $setvar
11885 val="$undef"
11886 set i_rpcsvcdbm
11887 eval $setvar
11888 ;;
11889esac
11890
11891: see if this is a sys/file.h system
11892val=''
11893set sys/file.h val
11894eval $inhdr
11895
11896: do we need to include sys/file.h ?
11897case "$val" in
11898"$define")
11899 echo " "
11900 if $h_sysfile; then
11901 val="$define"
11902 echo "We'll be including <sys/file.h>." >&4
11903 else
11904 val="$undef"
11905 echo "We won't be including <sys/file.h>." >&4
11906 fi
11907 ;;
11908*)
11909 h_sysfile=false
11910 ;;
11911esac
11912set i_sysfile
11913eval $setvar
11914
11915: see if fcntl.h is there
11916val=''
11917set fcntl.h val
11918eval $inhdr
11919
11920: see if we can include fcntl.h
11921case "$val" in
11922"$define")
11923 echo " "
11924 if $h_fcntl; then
11925 val="$define"
11926 echo "We'll be including <fcntl.h>." >&4
11927 else
11928 val="$undef"
11929 if $h_sysfile; then
11930 echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
11931 else
11932 echo "We won't be including <fcntl.h>." >&4
11933 fi
11934 fi
11935 ;;
11936*)
11937 h_fcntl=false
11938 val="$undef"
11939 ;;
11940esac
11941set i_fcntl
11942eval $setvar
11943
11944: see if locale.h is available
11945set locale.h i_locale
11946eval $inhdr
11947
7f3d1cf1 11948: see if mach cthreads are available
13666627
JH
11949if test "X$usethreads" = "X$define"; then
11950 set mach/cthreads.h i_machcthr
11951 eval $inhdr
11952else
11953 i_machcthr="$undef"
11954fi
11955
11956
7f3d1cf1 11957
5f80c64f
JH
11958: see if this is a math.h system
11959set math.h i_math
11960eval $inhdr
11961
e7fb4fcc
JH
11962: see if this is a mntent.h system
11963set mntent.h i_mntent
11964eval $inhdr
11965
5f80c64f
JH
11966: see if ndbm.h is available
11967set ndbm.h t_ndbm
11968eval $inhdr
11969case "$t_ndbm" in
11970$define)
11971 : see if dbm_open exists
11972 set dbm_open d_dbm_open
11973 eval $inlibc
11974 case "$d_dbm_open" in
11975 $undef)
11976 t_ndbm="$undef"
11977 echo "We won't be including <ndbm.h>"
11978 ;;
11979 esac
11980 ;;
11981esac
11982val="$t_ndbm"
11983set i_ndbm
11984eval $setvar
11985
11986: see if net/errno.h is available
11987val=''
11988set net/errno.h val
11989eval $inhdr
11990
11991: Unfortunately, it causes problems on some systems. Arrgh.
11992case "$val" in
11993$define)
11994 cat > try.c <<'EOM'
11995#include <stdio.h>
11996#include <errno.h>
11997#include <net/errno.h>
11998int func()
11999{
12000 return ENOTSOCK;
12001}
12002EOM
12003 if $cc $ccflags -c try.c >/dev/null 2>&1; then
12004 echo "We'll be including <net/errno.h>." >&4
12005 else
12006 echo "We won't be including <net/errno.h>." >&4
12007 val="$undef"
12008 fi
12009 $rm -f try.* try
12010 ;;
12011esac
12012set i_neterrno
12013eval $setvar
12014
9cc6feab
JH
12015: see if netinet/tcp.h is available
12016set netinet/tcp.h i_netinettcp
12017eval $inhdr
12018
5b34fd99
JH
12019: see if this is a poll.h system
12020set poll.h i_poll
12021eval $inhdr
12022
5f80c64f
JH
12023: get C preprocessor symbols handy
12024echo " "
12025$echo $n "Hmm... $c"
12026echo $al | $tr ' ' $trnl >Cppsym.know
12027$cat <<EOSS >Cppsym
12028$startsh
12029case "\$1" in
12030-l) list=true
12031 shift
12032 ;;
12033esac
12034unknown=''
12035case "\$list\$#" in
120361|2)
12037 for sym do
12038 if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
12039 exit 0
12040 elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
12041 :
12042 else
12043 unknown="\$unknown \$sym"
12044 fi
12045 done
12046 set X \$unknown
12047 shift
12048 ;;
12049esac
12050case \$# in
120510) exit 1;;
12052esac
12053echo \$* | $tr ' ' '$trnl' | $sed -e 's/\(.*\)/\\
12054#ifdef \1\\
12055exit 0; _ _ _ _\1\\ \1\\
12056#endif\\
12057/' >Cppsym\$\$
12058echo "exit 1; _ _ _" >>Cppsym\$\$
12059$cppstdin $cppminus <Cppsym\$\$ | $grep '^exit [01]; _ _' >Cppsym2\$\$
12060case "\$list" in
12061true) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;;
12062*)
12063 sh Cppsym2\$\$
12064 status=\$?
12065 ;;
12066esac
12067$rm -f Cppsym\$\$ Cppsym2\$\$
12068exit \$status
12069EOSS
12070chmod +x Cppsym
12071$eunicefix Cppsym
12072./Cppsym -l $al | $sort | $grep -v '^$' >Cppsym.true
12073
12074: now check the C compiler for additional symbols
c4747d3e
JH
12075postprocess_cc_v=''
12076case "$osname" in
12077aix) postprocess_cc_v="|$tr , ' '" ;;
12078esac
5f80c64f
JH
12079$cat >ccsym <<EOS
12080$startsh
12081$cat >tmp.c <<EOF
12082extern int foo;
12083EOF
c4747d3e 12084for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
5f80c64f
JH
12085do
12086 case "\$i" in
12087 -D*) echo "\$i" | $sed 's/^-D//';;
12088 -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
12089 esac
12090done
12091$rm -f try.c
12092EOS
2000072c 12093postprocess_cc_v=''
5f80c64f
JH
12094chmod +x ccsym
12095$eunicefix ccsym
12096./ccsym > ccsym1.raw
12097if $test -s ccsym1.raw; then
12098 $sort ccsym1.raw | $uniq >ccsym.raw
12099else
12100 mv ccsym1.raw ccsym.raw
12101fi
12102
12103$awk '/\=/ { print $0; next }
12104 { print $0"=1" }' ccsym.raw >ccsym.list
12105$awk '{ print $0"=1" }' Cppsym.true >ccsym.true
12106$comm -13 ccsym.true ccsym.list >ccsym.own
12107$comm -12 ccsym.true ccsym.list >ccsym.com
12108$comm -23 ccsym.true ccsym.list >ccsym.cpp
12109also=''
5f80c64f 12110if $test -z ccsym.raw; then
ff49bff8 12111 echo "Your C compiler doesn't seem to define any symbols!" >&4
5f80c64f 12112 echo " "
ff49bff8 12113 echo "However, your C preprocessor defines the following symbols:"
5f80c64f 12114 $cat Cppsym.true
ff49bff8
JH
12115 ccsymbols=''
12116 cppsymbols=`$cat Cppsym.true`
918c3d21 12117 cppsymbols=`echo $cppsymbols`
ff49bff8 12118 cppccsymbols="$cppsymbols"
5f80c64f
JH
12119else
12120 if $test -s ccsym.com; then
12121 echo "Your C compiler and pre-processor define these symbols:"
12122 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
12123 also='also '
12124 symbols='ones'
ff49bff8 12125 cppccsymbols=`$cat ccsym.com`
918c3d21 12126 cppccsymbols=`echo $cppccsymbols`
5f80c64f
JH
12127 $test "$silent" || sleep 1
12128 fi
12129 if $test -s ccsym.cpp; then
12130 $test "$also" && echo " "
ff49bff8 12131 echo "Your C pre-processor ${also}defines the following symbols:"
5f80c64f
JH
12132 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
12133 also='further '
ff49bff8 12134 cppsymbols=`$cat ccsym.cpp`
918c3d21 12135 cppsymbols=`echo $cppsymbols`
5f80c64f
JH
12136 $test "$silent" || sleep 1
12137 fi
12138 if $test -s ccsym.own; then
12139 $test "$also" && echo " "
ff49bff8 12140 echo "Your C compiler ${also}defines the following cpp symbols:"
5f80c64f
JH
12141 $sed -e 's/\(.*\)=1/\1/' ccsym.own
12142 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
ff49bff8 12143 ccsymbols=`$cat ccsym.own`
918c3d21 12144 ccsymbols=`echo $ccsymbols`
5f80c64f
JH
12145 $test "$silent" || sleep 1
12146 fi
12147fi
12148$rm -f ccsym*
12149
12150: see if this is a termio system
12151val="$undef"
12152val2="$undef"
12153val3="$undef"
12154if $test `./findhdr termios.h`; then
12155 set tcsetattr i_termios
12156 eval $inlibc
12157 val3="$i_termios"
12158fi
12159echo " "
12160case "$val3" in
12161"$define") echo "You have POSIX termios.h... good!" >&4;;
12162*) if ./Cppsym pyr; then
12163 case "`/bin/universe`" in
12164 ucb) if $test `./findhdr sgtty.h`; then
12165 val2="$define"
12166 echo "<sgtty.h> found." >&4
12167 else
12168 echo "System is pyramid with BSD universe."
12169 echo "<sgtty.h> not found--you could have problems." >&4
12170 fi;;
12171 *) if $test `./findhdr termio.h`; then
12172 val="$define"
12173 echo "<termio.h> found." >&4
12174 else
12175 echo "System is pyramid with USG universe."
12176 echo "<termio.h> not found--you could have problems." >&4
12177 fi;;
12178 esac
12179 elif ./usg; then
12180 if $test `./findhdr termio.h`; then
12181 echo "<termio.h> found." >&4
12182 val="$define"
12183 elif $test `./findhdr sgtty.h`; then
12184 echo "<sgtty.h> found." >&4
12185 val2="$define"
12186 else
12187echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
12188 fi
12189 else
12190 if $test `./findhdr sgtty.h`; then
12191 echo "<sgtty.h> found." >&4
12192 val2="$define"
12193 elif $test `./findhdr termio.h`; then
12194 echo "<termio.h> found." >&4
12195 val="$define"
12196 else
12197echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
12198 fi
12199 fi;;
12200esac
12201set i_termio; eval $setvar
12202val=$val2; set i_sgtty; eval $setvar
12203val=$val3; set i_termios; eval $setvar
12204
12205: see if stdarg is available
12206echo " "
12207if $test `./findhdr stdarg.h`; then
12208 echo "<stdarg.h> found." >&4
12209 valstd="$define"
12210else
12211 echo "<stdarg.h> NOT found." >&4
12212 valstd="$undef"
12213fi
12214
12215: see if varags is available
12216echo " "
12217if $test `./findhdr varargs.h`; then
12218 echo "<varargs.h> found." >&4
12219else
12220 echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
12221fi
12222
12223: set up the varargs testing programs
12224$cat > varargs.c <<EOP
12225#ifdef I_STDARG
12226#include <stdarg.h>
12227#endif
12228#ifdef I_VARARGS
12229#include <varargs.h>
12230#endif
12231
12232#ifdef I_STDARG
12233int f(char *p, ...)
12234#else
12235int f(va_alist)
12236va_dcl
12237#endif
12238{
12239 va_list ap;
12240#ifndef I_STDARG
12241 char *p;
12242#endif
12243#ifdef I_STDARG
12244 va_start(ap,p);
12245#else
12246 va_start(ap);
12247 p = va_arg(ap, char *);
12248#endif
12249 va_end(ap);
12250}
12251EOP
12252$cat > varargs <<EOP
12253$startsh
12254if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
12255 echo "true"
12256else
12257 echo "false"
12258fi
12259$rm -f varargs$_o
12260EOP
12261chmod +x varargs
12262
12263: now check which varargs header should be included
12264echo " "
12265i_varhdr=''
12266case "$valstd" in
12267"$define")
12268 if `./varargs I_STDARG`; then
12269 val='stdarg.h'
12270 elif `./varargs I_VARARGS`; then
12271 val='varargs.h'
12272 fi
12273 ;;
12274*)
12275 if `./varargs I_VARARGS`; then
12276 val='varargs.h'
12277 fi
12278 ;;
12279esac
12280case "$val" in
12281'')
12282echo "I could not find the definition for va_dcl... You have problems..." >&4
12283 val="$undef"; set i_stdarg; eval $setvar
12284 val="$undef"; set i_varargs; eval $setvar
12285 ;;
12286*)
12287 set i_varhdr
12288 eval $setvar
12289 case "$i_varhdr" in
12290 stdarg.h)
12291 val="$define"; set i_stdarg; eval $setvar
12292 val="$undef"; set i_varargs; eval $setvar
12293 ;;
12294 varargs.h)
12295 val="$undef"; set i_stdarg; eval $setvar
12296 val="$define"; set i_varargs; eval $setvar
12297 ;;
12298 esac
12299 echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
12300esac
12301$rm -f varargs*
12302
12303: see if stddef is available
12304set stddef.h i_stddef
12305eval $inhdr
12306
12307: see if sys/access.h is available
12308set sys/access.h i_sysaccess
12309eval $inhdr
12310
12311: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
12312set sys/filio.h i_sysfilio
12313eval $inhdr
12314echo " "
12315if $test `./findhdr sys/ioctl.h`; then
12316 val="$define"
12317 echo '<sys/ioctl.h> found.' >&4
12318else
12319 val="$undef"
12320 if $test $i_sysfilio = "$define"; then
12321 echo '<sys/ioctl.h> NOT found.' >&4
12322 else
12323 $test $i_sgtty = "$define" && xxx="sgtty.h"
12324 $test $i_termio = "$define" && xxx="termio.h"
12325 $test $i_termios = "$define" && xxx="termios.h"
12326echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
12327 fi
12328fi
12329set i_sysioctl
12330eval $setvar
12331
5f80c64f
JH
12332: see if sys/resource.h has to be included
12333set sys/resource.h i_sysresrc
12334eval $inhdr
12335
12336: see if sys/security.h is available
12337set sys/security.h i_syssecrt
12338eval $inhdr
12339
104d25b7
JH
12340: see if this is a sys/statvfs.h system
12341set sys/statvfs.h i_sysstatvfs
12342eval $inhdr
12343
5f80c64f
JH
12344: see if this is a sys/un.h system
12345set sys/un.h i_sysun
12346eval $inhdr
12347
12348: see if this is a syswait system
12349set sys/wait.h i_syswait
12350eval $inhdr
12351
12352: see if this is an utime system
12353set utime.h i_utime
12354eval $inhdr
12355
12356: see if this is a values.h system
12357set values.h i_values
12358eval $inhdr
12359
12360: see if this is a vfork system
12361case "$d_vfork" in
12362"$define")
12363 set vfork.h i_vfork
12364 eval $inhdr
12365 ;;
12366*)
12367 i_vfork="$undef"
12368 ;;
12369esac
12370
12371: see if gdbm.h is available
12372set gdbm.h t_gdbm
12373eval $inhdr
12374case "$t_gdbm" in
12375$define)
12376 : see if gdbm_open exists
12377 set gdbm_open d_gdbm_open
12378 eval $inlibc
12379 case "$d_gdbm_open" in
12380 $undef)
12381 t_gdbm="$undef"
12382 echo "We won't be including <gdbm.h>"
12383 ;;
12384 esac
12385 ;;
12386esac
12387val="$t_gdbm"
12388set i_gdbm
12389eval $setvar
12390
12391echo " "
12392echo "Looking for extensions..." >&4
12393tdir=`pwd`
12394cd $rsrc/ext
12395: If we are using the old config.sh, known_extensions may contain
12396: old or inaccurate or duplicate values.
12397known_extensions=''
12398nonxs_extensions=''
12399: We do not use find because it might not be available.
12400: We do not just use MANIFEST because the user may have dropped
12401: some additional extensions into the source tree and expect them
12402: to be built.
12403for xxx in * ; do
12404 case "$xxx" in
12405 DynaLoader|dynaload) ;;
12406 *) if $test -f $xxx/$xxx.xs; then
12407 known_extensions="$known_extensions $xxx"
12408 elif $test -f $xxx/Makefile.PL; then
12409 nonxs_extensions="$nonxs_extensions $xxx"
12410 else
12411 if $test -d $xxx; then
12412 # Look for nested extensions, eg. Devel/Dprof.
12413 cd $xxx
12414 for yyy in * ; do
12415 if $test -f $yyy/$yyy.xs; then
12416 known_extensions="$known_extensions $xxx/$yyy"
12417 elif $test -f $yyy/Makefile.PL; then
12418 nonxs_extensions="$nonxs_extensions $xxx/$yyy"
12419 fi
12420 done
12421 cd ..
12422 fi
12423 fi
12424 ;;
12425 esac
12426done
12427set X $nonxs_extensions
12428shift
12429nonxs_extensions="$*"
12430set X $known_extensions
12431shift
12432known_extensions="$*"
12433cd $tdir
12434
12435: Now see which are supported on this system.
12436avail_ext=''
12437for xxx in $known_extensions ; do
12438 case "$xxx" in
12439 DB_File|db_file)
12440 case "$i_db" in
12441 $define) avail_ext="$avail_ext $xxx" ;;
12442 esac
12443 ;;
12444 GDBM_File|gdbm_fil)
12445 case "$i_gdbm" in
12446 $define) avail_ext="$avail_ext $xxx" ;;
12447 esac
12448 ;;
12449 NDBM_File|ndbm_fil)
12450 case "$i_ndbm" in
12451 $define) avail_ext="$avail_ext $xxx" ;;
12452 esac
12453 ;;
12454 ODBM_File|odbm_fil)
12455 case "${i_dbm}${i_rpcsvcdbm}" in
12456 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
12457 esac
12458 ;;
12459 POSIX|posix)
12460 case "$useposix" in
12461 true|define|y) avail_ext="$avail_ext $xxx" ;;
12462 esac
12463 ;;
12464 Opcode|opcode)
12465 case "$useopcode" in
12466 true|define|y) avail_ext="$avail_ext $xxx" ;;
12467 esac
12468 ;;
12469 Socket|socket)
12470 case "$d_socket" in
12471 true|$define|y) avail_ext="$avail_ext $xxx" ;;
12472 esac
12473 ;;
12474 Thread|thread)
12475 case "$usethreads" in
12476 true|$define|y) avail_ext="$avail_ext $xxx" ;;
12477 esac
12478 ;;
12479 IPC/SysV|ipc/sysv)
12480 : XXX Do we need a useipcsysv variable here
12481 case "${d_msg}${d_sem}${d_shm}" in
12482 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
12483 esac
12484 ;;
12485 *) avail_ext="$avail_ext $xxx"
12486 ;;
12487 esac
12488done
12489
12490set X $avail_ext
12491shift
12492avail_ext="$*"
12493
12494: Now see which nonxs extensions are supported on this system.
12495: For now assume all are.
12496nonxs_ext=''
12497for xxx in $nonxs_extensions ; do
12498 case "$xxx" in
12499 *) nonxs_ext="$nonxs_ext $xxx"
12500 ;;
12501 esac
12502done
12503
12504set X $nonxs_ext
12505shift
12506nonxs_ext="$*"
12507
12508case $usedl in
12509$define)
12510 $cat <<EOM
12511A number of extensions are supplied with $package. You may choose to
12512compile these extensions for dynamic loading (the default), compile
12513them into the $package executable (static loading), or not include
12514them at all. Answer "none" to include no extensions.
12515Note that DynaLoader is always built and need not be mentioned here.
12516
12517EOM
12518 case "$dynamic_ext" in
12519 '') dflt="$avail_ext" ;;
12520 *) dflt="$dynamic_ext"
12521 # Perhaps we are reusing an old out-of-date config.sh.
12522 case "$hint" in
12523 previous)
12524 if test X"$dynamic_ext" != X"$avail_ext"; then
12525 $cat <<EOM
12526NOTICE: Your previous config.sh list may be incorrect.
12527The extensions now available to you are
12528 ${avail_ext}
12529but the default list from your previous config.sh is
12530 ${dynamic_ext}
12531
12532EOM
12533 fi
12534 ;;
12535 esac
12536 ;;
12537 esac
12538 case "$dflt" in
12539 '') dflt=none;;
12540 esac
12541 rp="What extensions do you wish to load dynamically?"
12542 . ./myread
12543 case "$ans" in
12544 none) dynamic_ext=' ' ;;
12545 *) dynamic_ext="$ans" ;;
12546 esac
12547
12548 case "$static_ext" in
12549 '')
12550 : Exclude those already listed in dynamic linking
12551 dflt=''
12552 for xxx in $avail_ext; do
12553 case " $dynamic_ext " in
12554 *" $xxx "*) ;;
12555 *) dflt="$dflt $xxx" ;;
12556 esac
12557 done
12558 set X $dflt
12559 shift
12560 dflt="$*"
12561 ;;
12562 *) dflt="$static_ext"
12563 ;;
12564 esac
12565
12566 case "$dflt" in
12567 '') dflt=none;;
12568 esac
12569 rp="What extensions do you wish to load statically?"
12570 . ./myread
12571 case "$ans" in
12572 none) static_ext=' ' ;;
12573 *) static_ext="$ans" ;;
12574 esac
12575 ;;
12576*)
12577 $cat <<EOM
12578A number of extensions are supplied with $package. Answer "none"
12579to include no extensions.
12580Note that DynaLoader is always built and need not be mentioned here.
12581
12582EOM
12583 case "$static_ext" in
12584 '') dflt="$avail_ext" ;;
12585 *) dflt="$static_ext"
12586 # Perhaps we are reusing an old out-of-date config.sh.
12587 case "$hint" in
12588 previous)
12589 if test X"$static_ext" != X"$avail_ext"; then
12590 $cat <<EOM
12591NOTICE: Your previous config.sh list may be incorrect.
12592The extensions now available to you are
12593 ${avail_ext}
12594but the default list from your previous config.sh is
12595 ${static_ext}
12596
12597EOM
12598 fi
12599 ;;
12600 esac
12601 ;;
12602 esac
12603 : Exclude those that are not xs extensions
12604 case "$dflt" in
12605 '') dflt=none;;
12606 esac
12607 rp="What extensions do you wish to include?"
12608 . ./myread
12609 case "$ans" in
12610 none) static_ext=' ' ;;
12611 *) static_ext="$ans" ;;
12612 esac
12613 ;;
12614esac
12615
12616set X $dynamic_ext $static_ext $nonxs_ext
12617shift
12618extensions="$*"
12619
12620: Remove build directory name from cppstdin so it can be used from
12621: either the present location or the final installed location.
12622echo " "
12623: Get out of the UU directory to get correct path name.
12624cd ..
12625case "$cppstdin" in
12626`pwd`/cppstdin)
12627 echo "Stripping down cppstdin path name"
12628 cppstdin=cppstdin
12629 ;;
12630esac
12631cd UU
12632
12633: end of configuration questions
12634echo " "
12635echo "End of configuration questions."
12636echo " "
12637
12638: back to where it started
12639if test -d ../UU; then
12640 cd ..
12641fi
12642
12643: configuration may be patched via a 'config.over' file
12644if $test -f config.over; then
12645 echo " "
12646 dflt=y
12647 rp='I see a config.over file. Do you wish to load it?'
12648 . UU/myread
12649 case "$ans" in
12650 n*) echo "OK, I'll ignore it.";;
12651 *) . ./config.over
12652 echo "Configuration override changes have been loaded."
12653 ;;
12654 esac
12655fi
12656
12657: in case they want portability, strip down executable paths
12658case "$d_portable" in
12659"$define")
12660 echo " "
12661 echo "Stripping down executable paths..." >&4
12662 for file in $loclist $trylist; do
12663 if test X$file != Xln -a X$file != Xar -o X$osname != Xos2; then
12664 eval $file="\$file"
12665 fi
12666 done
12667 ;;
12668esac
12669
12670: create config.sh file
12671echo " "
12672echo "Creating config.sh..." >&4
12673$spitshell <<EOT >config.sh
12674$startsh
12675#
12676# This file was produced by running the Configure script. It holds all the
12677# definitions figured out by Configure. Should you modify one of these values,
12678# do not forget to propagate your changes by running "Configure -der". You may
12679# instead choose to run each of the .SH files by yourself, or "Configure -S".
12680#
12681
12682# Package name : $package
12683# Source directory : $src
12684# Configuration time: $cf_time
12685# Configured by : $cf_by
12686# Target system : $myuname
12687
12688Author='$Author'
12689Date='$Date'
12690Header='$Header'
12691Id='$Id'
12692Locker='$Locker'
12693Log='$Log'
12694Mcc='$Mcc'
12695RCSfile='$RCSfile'
12696Revision='$Revision'
12697Source='$Source'
12698State='$State'
12699_a='$_a'
12700_exe='$_exe'
12701_o='$_o'
12702afs='$afs'
12703alignbytes='$alignbytes'
12704ansi2knr='$ansi2knr'
12705aphostname='$aphostname'
12706apiversion='$apiversion'
12707ar='$ar'
12708archlib='$archlib'
12709archlibexp='$archlibexp'
12710archname64='$archname64'
12711archname='$archname'
12712archobjs='$archobjs'
12713awk='$awk'
12714baserev='$baserev'
12715bash='$bash'
12716bin='$bin'
12717binexp='$binexp'
12718bison='$bison'
12719byacc='$byacc'
12720byteorder='$byteorder'
12721c='$c'
12722castflags='$castflags'
12723cat='$cat'
12724cc='$cc'
12725cccdlflags='$cccdlflags'
12726ccdlflags='$ccdlflags'
12727ccflags='$ccflags'
ff49bff8 12728ccsymbols='$ccsymbols'
5f80c64f
JH
12729cf_by='$cf_by'
12730cf_email='$cf_email'
12731cf_time='$cf_time'
12732chgrp='$chgrp'
12733chmod='$chmod'
12734chown='$chown'
12735clocktype='$clocktype'
12736comm='$comm'
12737compress='$compress'
12738contains='$contains'
12739cp='$cp'
12740cpio='$cpio'
12741cpp='$cpp'
12742cpp_stuff='$cpp_stuff'
ff49bff8 12743cppccsymbols='$cppccsymbols'
5f80c64f
JH
12744cppflags='$cppflags'
12745cpplast='$cpplast'
12746cppminus='$cppminus'
12747cpprun='$cpprun'
12748cppstdin='$cppstdin'
ff49bff8 12749cppsymbols='$cppsymbols'
68c15b6f 12750crosscompile='$crosscompile'
5f80c64f
JH
12751cryptlib='$cryptlib'
12752csh='$csh'
12753d_Gconvert='$d_Gconvert'
12754d_access='$d_access'
12755d_accessx='$d_accessx'
12756d_alarm='$d_alarm'
12757d_archlib='$d_archlib'
12758d_attribut='$d_attribut'
12759d_bcmp='$d_bcmp'
12760d_bcopy='$d_bcopy'
12761d_bsd='$d_bsd'
12762d_bsdgetpgrp='$d_bsdgetpgrp'
12763d_bsdsetpgrp='$d_bsdsetpgrp'
12764d_bzero='$d_bzero'
12765d_casti32='$d_casti32'
12766d_castneg='$d_castneg'
12767d_charvspr='$d_charvspr'
12768d_chown='$d_chown'
12769d_chroot='$d_chroot'
12770d_chsize='$d_chsize'
12771d_closedir='$d_closedir'
de4597cb 12772d_cmsghdr_s='$d_cmsghdr_s'
5f80c64f
JH
12773d_const='$d_const'
12774d_crypt='$d_crypt'
12775d_csh='$d_csh'
12776d_cuserid='$d_cuserid'
12777d_dbl_dig='$d_dbl_dig'
12778d_dbmclose64='$d_dbmclose64'
12779d_dbminit64='$d_dbminit64'
12780d_delete64='$d_delete64'
12781d_difftime='$d_difftime'
de4597cb 12782d_dirent64_s='$d_dirent64_s'
5f80c64f
JH
12783d_dirnamlen='$d_dirnamlen'
12784d_dlerror='$d_dlerror'
12785d_dlopen='$d_dlopen'
12786d_dlsymun='$d_dlsymun'
12787d_dosuid='$d_dosuid'
12788d_drand48proto='$d_drand48proto'
12789d_dup2='$d_dup2'
12790d_eaccess='$d_eaccess'
12791d_endgrent='$d_endgrent'
12792d_endhent='$d_endhent'
12793d_endnent='$d_endnent'
12794d_endpent='$d_endpent'
12795d_endpwent='$d_endpwent'
12796d_endsent='$d_endsent'
12797d_eofnblk='$d_eofnblk'
12798d_eunice='$d_eunice'
12799d_fchmod='$d_fchmod'
12800d_fchown='$d_fchown'
12801d_fcntl='$d_fcntl'
12802d_fd_macros='$d_fd_macros'
12803d_fd_set='$d_fd_set'
12804d_fds_bits='$d_fds_bits'
12805d_fetch64='$d_fetch64'
12806d_fgetpos64='$d_fgetpos64'
12807d_fgetpos='$d_fgetpos'
12808d_firstkey64='$d_firstkey64'
12809d_flexfnam='$d_flexfnam'
de4597cb 12810d_flock64_s='$d_flock64_s'
5f80c64f
JH
12811d_flock='$d_flock'
12812d_fopen64='$d_fopen64'
12813d_fork='$d_fork'
12814d_fpathconf='$d_fpathconf'
12815d_freopen64='$d_freopen64'
12816d_fseek64='$d_fseek64'
12817d_fseeko64='$d_fseeko64'
12818d_fseeko='$d_fseeko'
12819d_fsetpos64='$d_fsetpos64'
12820d_fsetpos='$d_fsetpos'
12821d_fstat64='$d_fstat64'
104d25b7
JH
12822d_fstatfs='$d_fstatfs'
12823d_fstatvfs='$d_fstatvfs'
5f80c64f
JH
12824d_ftell64='$d_ftell64'
12825d_ftello64='$d_ftello64'
12826d_ftello='$d_ftello'
12827d_ftime='$d_ftime'
12828d_ftruncate64='$d_ftruncate64'
12829d_getgrent='$d_getgrent'
12830d_getgrps='$d_getgrps'
12831d_gethbyaddr='$d_gethbyaddr'
12832d_gethbyname='$d_gethbyname'
12833d_gethent='$d_gethent'
12834d_gethname='$d_gethname'
12835d_gethostprotos='$d_gethostprotos'
12836d_getlogin='$d_getlogin'
ccc7f9b3 12837d_getmntent='$d_getmntent'
5f80c64f
JH
12838d_getnbyaddr='$d_getnbyaddr'
12839d_getnbyname='$d_getnbyname'
12840d_getnent='$d_getnent'
12841d_getnetprotos='$d_getnetprotos'
12842d_getpbyname='$d_getpbyname'
12843d_getpbynumber='$d_getpbynumber'
12844d_getpent='$d_getpent'
12845d_getpgid='$d_getpgid'
12846d_getpgrp2='$d_getpgrp2'
12847d_getpgrp='$d_getpgrp'
12848d_getppid='$d_getppid'
12849d_getprior='$d_getprior'
12850d_getprotoprotos='$d_getprotoprotos'
12851d_getpwent='$d_getpwent'
12852d_getsbyname='$d_getsbyname'
12853d_getsbyport='$d_getsbyport'
12854d_getsent='$d_getsent'
12855d_getservprotos='$d_getservprotos'
12856d_gettimeod='$d_gettimeod'
12857d_gnulibc='$d_gnulibc'
12858d_grpasswd='$d_grpasswd'
ccc7f9b3 12859d_hasmntopt='$d_hasmntopt'
5f80c64f
JH
12860d_htonl='$d_htonl'
12861d_index='$d_index'
12862d_inetaton='$d_inetaton'
2000072c 12863d_ino64_t='$d_ino64_t'
5f80c64f 12864d_int64t='$d_int64t'
de4597cb 12865d_iovec_s='$d_iovec_s'
5f80c64f
JH
12866d_isascii='$d_isascii'
12867d_killpg='$d_killpg'
12868d_lchown='$d_lchown'
12869d_link='$d_link'
2000072c 12870d_llseek='$d_llseek'
5f80c64f
JH
12871d_locconv='$d_locconv'
12872d_lockf64='$d_lockf64'
12873d_lockf='$d_lockf'
12874d_longdbl='$d_longdbl'
12875d_longlong='$d_longlong'
12876d_lseek64='$d_lseek64'
12877d_lstat64='$d_lstat64'
12878d_lstat='$d_lstat'
ff49bff8 12879d_madvise='$d_madvise'
5f80c64f
JH
12880d_mblen='$d_mblen'
12881d_mbstowcs='$d_mbstowcs'
12882d_mbtowc='$d_mbtowc'
12883d_memcmp='$d_memcmp'
12884d_memcpy='$d_memcpy'
12885d_memmove='$d_memmove'
12886d_memset='$d_memset'
12887d_mkdir='$d_mkdir'
12888d_mkfifo='$d_mkfifo'
12889d_mktime='$d_mktime'
ff49bff8
JH
12890d_mmap='$d_mmap'
12891d_mprotect='$d_mprotect'
5f80c64f 12892d_msg='$d_msg'
de4597cb
JH
12893d_msg_ctrunc='$d_msg_ctrunc'
12894d_msg_dontroute='$d_msg_dontroute'
12895d_msg_oob='$d_msg_oob'
12896d_msg_peek='$d_msg_peek'
12897d_msg_proxy='$d_msg_proxy'
5f80c64f
JH
12898d_msgctl='$d_msgctl'
12899d_msgget='$d_msgget'
de4597cb 12900d_msghdr_s='$d_msghdr_s'
5f80c64f
JH
12901d_msgrcv='$d_msgrcv'
12902d_msgsnd='$d_msgsnd'
ff49bff8
JH
12903d_msync='$d_msync'
12904d_munmap='$d_munmap'
5f80c64f
JH
12905d_mymalloc='$d_mymalloc'
12906d_nextkey64='$d_nextkey64'
12907d_nice='$d_nice'
2000072c
JH
12908d_off64_t='$d_off64_t'
12909d_offset_t='$d_offset_t'
ef4af2be 12910d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
5f80c64f
JH
12911d_oldpthreads='$d_oldpthreads'
12912d_oldsock='$d_oldsock'
12913d_open3='$d_open3'
12914d_open64='$d_open64'
12915d_opendir64='$d_opendir64'
12916d_pathconf='$d_pathconf'
12917d_pause='$d_pause'
12918d_phostname='$d_phostname'
12919d_pipe='$d_pipe'
12920d_poll='$d_poll'
12921d_portable='$d_portable'
12922d_pthread_yield='$d_pthread_yield'
5f80c64f
JH
12923d_pwage='$d_pwage'
12924d_pwchange='$d_pwchange'
12925d_pwclass='$d_pwclass'
12926d_pwcomment='$d_pwcomment'
12927d_pwexpire='$d_pwexpire'
12928d_pwgecos='$d_pwgecos'
12929d_pwpasswd='$d_pwpasswd'
12930d_pwquota='$d_pwquota'
12931d_readdir64='$d_readdir64'
12932d_readdir='$d_readdir'
12933d_readlink='$d_readlink'
de4597cb
JH
12934d_readv='$d_readv'
12935d_recvmsg='$d_recvmsg'
5f80c64f
JH
12936d_rename='$d_rename'
12937d_rewinddir='$d_rewinddir'
12938d_rmdir='$d_rmdir'
12939d_safebcpy='$d_safebcpy'
12940d_safemcpy='$d_safemcpy'
12941d_sanemcmp='$d_sanemcmp'
12942d_sched_yield='$d_sched_yield'
de4597cb 12943d_scm_rights='$d_scm_rights'
5f80c64f
JH
12944d_seekdir64='$d_seekdir64'
12945d_seekdir='$d_seekdir'
12946d_select='$d_select'
12947d_sem='$d_sem'
12948d_semctl='$d_semctl'
12949d_semctl_semid_ds='$d_semctl_semid_ds'
12950d_semctl_semun='$d_semctl_semun'
12951d_semget='$d_semget'
12952d_semop='$d_semop'
de4597cb 12953d_sendmsg='$d_sendmsg'
5f80c64f
JH
12954d_setegid='$d_setegid'
12955d_seteuid='$d_seteuid'
12956d_setgrent='$d_setgrent'
12957d_setgrps='$d_setgrps'
12958d_sethent='$d_sethent'
12959d_setlinebuf='$d_setlinebuf'
12960d_setlocale='$d_setlocale'
12961d_setnent='$d_setnent'
12962d_setpent='$d_setpent'
12963d_setpgid='$d_setpgid'
12964d_setpgrp2='$d_setpgrp2'
12965d_setpgrp='$d_setpgrp'
12966d_setprior='$d_setprior'
12967d_setpwent='$d_setpwent'
12968d_setregid='$d_setregid'
12969d_setresgid='$d_setresgid'
12970d_setresuid='$d_setresuid'
12971d_setreuid='$d_setreuid'
12972d_setrgid='$d_setrgid'
12973d_setruid='$d_setruid'
12974d_setsent='$d_setsent'
12975d_setsid='$d_setsid'
12976d_setvbuf='$d_setvbuf'
12977d_sfio='$d_sfio'
12978d_shm='$d_shm'
12979d_shmat='$d_shmat'
12980d_shmatprototype='$d_shmatprototype'
12981d_shmctl='$d_shmctl'
12982d_shmdt='$d_shmdt'
12983d_shmget='$d_shmget'
12984d_sigaction='$d_sigaction'
12985d_sigsetjmp='$d_sigsetjmp'
12986d_socket='$d_socket'
12987d_sockpair='$d_sockpair'
12988d_stat64='$d_stat64'
12989d_statblks='$d_statblks'
104d25b7
JH
12990d_statfs='$d_statfs'
12991d_statfsflags='$d_statfsflags'
12992d_statvfs='$d_statvfs'
5f80c64f
JH
12993d_stdio_cnt_lval='$d_stdio_cnt_lval'
12994d_stdio_ptr_lval='$d_stdio_ptr_lval'
12995d_stdiobase='$d_stdiobase'
12996d_stdstdio='$d_stdstdio'
12997d_store64='$d_store64'
12998d_strchr='$d_strchr'
12999d_strcoll='$d_strcoll'
13000d_strctcpy='$d_strctcpy'
13001d_strerrm='$d_strerrm'
13002d_strerror='$d_strerror'
13003d_strtod='$d_strtod'
13004d_strtol='$d_strtol'
13005d_strtoul='$d_strtoul'
13006d_strxfrm='$d_strxfrm'
13007d_suidsafe='$d_suidsafe'
13008d_symlink='$d_symlink'
13009d_syscall='$d_syscall'
13010d_sysconf='$d_sysconf'
13011d_sysernlst='$d_sysernlst'
13012d_syserrlst='$d_syserrlst'
13013d_system='$d_system'
13014d_tcgetpgrp='$d_tcgetpgrp'
13015d_tcsetpgrp='$d_tcsetpgrp'
13016d_telldir64='$d_telldir64'
13017d_telldir='$d_telldir'
cb86ce0e 13018d_telldirproto='$d_telldirproto'
5f80c64f
JH
13019d_time='$d_time'
13020d_times='$d_times'
13021d_tmpfile64='$d_tmpfile64'
13022d_truncate64='$d_truncate64'
13023d_truncate='$d_truncate'
13024d_tzname='$d_tzname'
13025d_umask='$d_umask'
13026d_uname='$d_uname'
13027d_union_semun='$d_union_semun'
13028d_vfork='$d_vfork'
13029d_void_closedir='$d_void_closedir'
13030d_voidsig='$d_voidsig'
13031d_voidtty='$d_voidtty'
13032d_volatile='$d_volatile'
13033d_vprintf='$d_vprintf'
13034d_wait4='$d_wait4'
13035d_waitpid='$d_waitpid'
13036d_wcstombs='$d_wcstombs'
13037d_wctomb='$d_wctomb'
de4597cb 13038d_writev='$d_writev'
5f80c64f
JH
13039d_xenix='$d_xenix'
13040date='$date'
13041db_hashtype='$db_hashtype'
13042db_prefixtype='$db_prefixtype'
13043defvoidused='$defvoidused'
13044direntrytype='$direntrytype'
13045dlext='$dlext'
13046dlsrc='$dlsrc'
13047doublesize='$doublesize'
13048drand01='$drand01'
13049dynamic_ext='$dynamic_ext'
13050eagain='$eagain'
13051ebcdic='$ebcdic'
13052echo='$echo'
13053egrep='$egrep'
13054emacs='$emacs'
13055eunicefix='$eunicefix'
13056exe_ext='$exe_ext'
13057expr='$expr'
13058extensions='$extensions'
66fe083f 13059fflushNULL='$fflushNULL'
5f80c64f
JH
13060find='$find'
13061firstmakefile='$firstmakefile'
13062flex='$flex'
13063fpostype='$fpostype'
13064freetype='$freetype'
ccc7f9b3 13065full_ar='$full_ar'
5f80c64f
JH
13066full_csh='$full_csh'
13067full_sed='$full_sed'
13068gccversion='$gccversion'
13069gidtype='$gidtype'
13070glibpth='$glibpth'
13071grep='$grep'
13072groupcat='$groupcat'
13073groupstype='$groupstype'
13074gzip='$gzip'
13075h_fcntl='$h_fcntl'
13076h_sysfile='$h_sysfile'
13077hint='$hint'
13078hostcat='$hostcat'
13079huge='$huge'
13080i_arpainet='$i_arpainet'
13081i_bsdioctl='$i_bsdioctl'
13082i_db='$i_db'
13083i_dbm='$i_dbm'
13084i_dirent='$i_dirent'
13085i_dld='$i_dld'
13086i_dlfcn='$i_dlfcn'
13087i_fcntl='$i_fcntl'
13088i_float='$i_float'
13089i_gdbm='$i_gdbm'
13090i_grp='$i_grp'
13091i_inttypes='$i_inttypes'
13092i_limits='$i_limits'
13093i_locale='$i_locale'
7f3d1cf1 13094i_machcthr='$i_machcthr'
5f80c64f
JH
13095i_malloc='$i_malloc'
13096i_math='$i_math'
13097i_memory='$i_memory'
e7fb4fcc 13098i_mntent='$i_mntent'
5f80c64f
JH
13099i_ndbm='$i_ndbm'
13100i_netdb='$i_netdb'
13101i_neterrno='$i_neterrno'
9cc6feab 13102i_netinettcp='$i_netinettcp'
5f80c64f 13103i_niin='$i_niin'
5b34fd99 13104i_poll='$i_poll'
c4747d3e 13105i_pthread='$i_pthread'
5f80c64f
JH
13106i_pwd='$i_pwd'
13107i_rpcsvcdbm='$i_rpcsvcdbm'
13108i_sfio='$i_sfio'
13109i_sgtty='$i_sgtty'
13110i_stdarg='$i_stdarg'
13111i_stddef='$i_stddef'
13112i_stdlib='$i_stdlib'
13113i_string='$i_string'
13114i_sysaccess='$i_sysaccess'
13115i_sysdir='$i_sysdir'
13116i_sysfile='$i_sysfile'
13117i_sysfilio='$i_sysfilio'
13118i_sysin='$i_sysin'
13119i_sysioctl='$i_sysioctl'
ff49bff8 13120i_sysmman='$i_sysmman'
104d25b7 13121i_sysmount='$i_sysmount'
5f80c64f
JH
13122i_sysndir='$i_sysndir'
13123i_sysparam='$i_sysparam'
13124i_sysresrc='$i_sysresrc'
13125i_syssecrt='$i_syssecrt'
13126i_sysselct='$i_sysselct'
13127i_syssockio='$i_syssockio'
13128i_sysstat='$i_sysstat'
104d25b7 13129i_sysstatvfs='$i_sysstatvfs'
5f80c64f
JH
13130i_systime='$i_systime'
13131i_systimek='$i_systimek'
13132i_systimes='$i_systimes'
13133i_systypes='$i_systypes'
de4597cb 13134i_sysuio='$i_sysuio'
5f80c64f
JH
13135i_sysun='$i_sysun'
13136i_syswait='$i_syswait'
13137i_termio='$i_termio'
13138i_termios='$i_termios'
13139i_time='$i_time'
13140i_unistd='$i_unistd'
13141i_utime='$i_utime'
13142i_values='$i_values'
13143i_varargs='$i_varargs'
13144i_varhdr='$i_varhdr'
13145i_vfork='$i_vfork'
13146ignore_versioned_solibs='$ignore_versioned_solibs'
13147incpath='$incpath'
13148inews='$inews'
13149installarchlib='$installarchlib'
13150installbin='$installbin'
13151installman1dir='$installman1dir'
13152installman3dir='$installman3dir'
13153installprivlib='$installprivlib'
13154installscript='$installscript'
13155installsitearch='$installsitearch'
13156installsitelib='$installsitelib'
104d25b7 13157installusrbinperl='$installusrbinperl'
5f80c64f
JH
13158intsize='$intsize'
13159known_extensions='$known_extensions'
13160ksh='$ksh'
13161large='$large'
13162ld='$ld'
13163lddlflags='$lddlflags'
13164ldflags='$ldflags'
13165less='$less'
13166lib_ext='$lib_ext'
13167libc='$libc'
13168libperl='$libperl'
13169libpth='$libpth'
13170libs='$libs'
13171libswanted='$libswanted'
13172line='$line'
13173lint='$lint'
13174lkflags='$lkflags'
13175ln='$ln'
13176lns='$lns'
13177locincpth='$locincpth'
13178loclibpth='$loclibpth'
13179longdblsize='$longdblsize'
13180longlongsize='$longlongsize'
13181longsize='$longsize'
13182lp='$lp'
13183lpr='$lpr'
13184ls='$ls'
13185lseeksize='$lseeksize'
13186lseektype='$lseektype'
13187mail='$mail'
13188mailx='$mailx'
13189make='$make'
13190make_set_make='$make_set_make'
13191mallocobj='$mallocobj'
13192mallocsrc='$mallocsrc'
13193malloctype='$malloctype'
13194man1dir='$man1dir'
13195man1direxp='$man1direxp'
13196man1ext='$man1ext'
13197man3dir='$man3dir'
13198man3direxp='$man3direxp'
13199man3ext='$man3ext'
13200medium='$medium'
13201mips='$mips'
13202mips_type='$mips_type'
13203mkdir='$mkdir'
ff49bff8 13204mmaptype='$mmaptype'
5f80c64f
JH
13205models='$models'
13206modetype='$modetype'
13207more='$more'
68c15b6f 13208multiarch='$multiarch'
5f80c64f
JH
13209mv='$mv'
13210myarchname='$myarchname'
13211mydomain='$mydomain'
13212myhostname='$myhostname'
13213myuname='$myuname'
13214n='$n'
13215netdb_hlen_type='$netdb_hlen_type'
13216netdb_host_type='$netdb_host_type'
13217netdb_name_type='$netdb_name_type'
13218netdb_net_type='$netdb_net_type'
13219nm='$nm'
13220nm_opt='$nm_opt'
13221nm_so_opt='$nm_so_opt'
13222nonxs_ext='$nonxs_ext'
13223nroff='$nroff'
13224o_nonblock='$o_nonblock'
13225obj_ext='$obj_ext'
ef4af2be 13226old_pthread_create_joinable='$old_pthread_create_joinable'
5f80c64f
JH
13227optimize='$optimize'
13228orderlib='$orderlib'
13229osname='$osname'
13230osvers='$osvers'
13231package='$package'
13232pager='$pager'
13233passcat='$passcat'
13234patchlevel='$patchlevel'
13235path_sep='$path_sep'
13236perl='$perl'
13237perladmin='$perladmin'
13238perlpath='$perlpath'
13239pg='$pg'
13240phostname='$phostname'
13241pidtype='$pidtype'
13242plibpth='$plibpth'
13243pmake='$pmake'
13244pr='$pr'
13245prefix='$prefix'
13246prefixexp='$prefixexp'
13247privlib='$privlib'
13248privlibexp='$privlibexp'
13249prototype='$prototype'
13250ptrsize='$ptrsize'
13251randbits='$randbits'
13252randfunc='$randfunc'
13253randseedtype='$randseedtype'
13254ranlib='$ranlib'
13255rd_nodata='$rd_nodata'
13256rm='$rm'
13257rmail='$rmail'
13258runnm='$runnm'
13259sched_yield='$sched_yield'
13260scriptdir='$scriptdir'
13261scriptdirexp='$scriptdirexp'
13262sed='$sed'
13263seedfunc='$seedfunc'
13264selectminbits='$selectminbits'
13265selecttype='$selecttype'
13266sendmail='$sendmail'
13267sh='$sh'
13268shar='$shar'
13269sharpbang='$sharpbang'
13270shmattype='$shmattype'
13271shortsize='$shortsize'
13272shrpenv='$shrpenv'
13273shsharp='$shsharp'
af4c28eb 13274sig_count='$sig_count'
5f80c64f
JH
13275sig_name='$sig_name'
13276sig_name_init='$sig_name_init'
13277sig_num='$sig_num'
824a2ba3 13278sig_num_init='$sig_num_init'
5f80c64f
JH
13279signal_t='$signal_t'
13280sitearch='$sitearch'
13281sitearchexp='$sitearchexp'
13282sitelib='$sitelib'
13283sitelibexp='$sitelibexp'
13284sizetype='$sizetype'
13285sleep='$sleep'
13286smail='$smail'
13287small='$small'
13288so='$so'
13289sockethdr='$sockethdr'
13290socketlib='$socketlib'
13291sort='$sort'
13292spackage='$spackage'
13293spitshell='$spitshell'
13294split='$split'
13295src='$src'
13296ssizetype='$ssizetype'
13297startperl='$startperl'
13298startsh='$startsh'
13299static_ext='$static_ext'
13300stdchar='$stdchar'
13301stdio_base='$stdio_base'
13302stdio_bufsiz='$stdio_bufsiz'
13303stdio_cnt='$stdio_cnt'
13304stdio_filbuf='$stdio_filbuf'
13305stdio_ptr='$stdio_ptr'
13306strings='$strings'
13307submit='$submit'
13308subversion='$subversion'
13309sysman='$sysman'
13310tail='$tail'
13311tar='$tar'
13312tbl='$tbl'
13313tee='$tee'
13314test='$test'
13315timeincl='$timeincl'
13316timetype='$timetype'
13317touch='$touch'
13318tr='$tr'
13319trnl='$trnl'
13320troff='$troff'
13321uidtype='$uidtype'
13322uname='$uname'
13323uniq='$uniq'
13324use64bits='$use64bits'
13325usedl='$usedl'
13326usemultiplicity='$usemultiplicity'
13327usemymalloc='$usemymalloc'
13328usenm='$usenm'
13329useopcode='$useopcode'
13330useperlio='$useperlio'
13331useposix='$useposix'
13332usesfio='$usesfio'
13333useshrplib='$useshrplib'
13334usethreads='$usethreads'
13335usevfork='$usevfork'
13336usrinc='$usrinc'
13337uuname='$uuname'
13338version='$version'
13339vi='$vi'
13340voidflags='$voidflags'
13341xlibpth='$xlibpth'
13342zcat='$zcat'
13343zip='$zip'
13344EOT
13345
13346: Add in command line options if available
13347$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
13348
13349: add special variables
13350$test -f $src/patchlevel.h && \
d00b958f 13351awk '/^#define[ ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
2000072c 13352echo "CONFIGDOTSH=true" >>config.sh
5f80c64f
JH
13353
13354: propagate old symbols
13355if $test -f UU/config.sh; then
13356 <UU/config.sh sort | uniq >UU/oldconfig.sh
13357 sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
13358 sort | uniq -u >UU/oldsyms
13359 set X `cat UU/oldsyms`
13360 shift
13361 case $# in
13362 0) ;;
13363 *)
13364 cat <<EOM
13365Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
13366EOM
13367 echo "# Variables propagated from previous config.sh file." >>config.sh
13368 for sym in `cat UU/oldsyms`; do
13369 echo " Propagating $hint variable "'$'"$sym..."
13370 eval 'tmp="$'"${sym}"'"'
13371 echo "$tmp" | \
13372 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
13373 done
13374 ;;
13375 esac
13376fi
13377
13378: Finish up by extracting the .SH files
13379case "$alldone" in
13380exit)
13381 $rm -rf UU
13382 echo "Done."
13383 exit 0
13384 ;;
13385cont)
13386 ;;
13387'')
13388 dflt=''
13389 nostick=true
13390 $cat <<EOM
13391
13392If you'd like to make any changes to the config.sh file before I begin
13393to configure things, do it as a shell escape now (e.g. !vi config.sh).
13394
13395EOM
13396 rp="Press return or use a shell escape to edit config.sh:"
13397 . UU/myread
13398 nostick=''
13399 case "$ans" in
13400 '') ;;
13401 *) : in case they cannot read
13402 sh 1>&4 -c "$ans";;
13403 esac
13404 ;;
13405esac
13406
13407: if this fails, just run all the .SH files by hand
13408. ./config.sh
13409
13410echo " "
13411exec 1>&4
13412. ./UU/extract
13413
13414if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
13415 dflt=y
13416 case "$silent" in
13417 true) ;;
13418 *)
13419 $cat <<EOM
13420
13421Now you need to generate make dependencies by running "$make depend".
13422You might prefer to run it in background: "$make depend > makedepend.out &"
13423It can take a while, so you might not want to run it right now.
13424
13425EOM
13426 ;;
13427 esac
13428 rp="Run $make depend now?"
13429 . UU/myread
13430 case "$ans" in
13431 y*)
13432 $make depend && echo "Now you must run a $make."
13433 ;;
13434 *)
13435 echo "You must run '$make depend' then '$make'."
13436 ;;
13437 esac
13438elif test -f [Mm]akefile; then
13439 echo " "
13440 echo "Now you must run a $make."
13441else
13442 echo "Done."
13443fi
13444
13445if $test -f Policy.sh; then
13446 $cat <<EOM
13447
13448If you compile $package on a different machine or from a different object
13449directory, copy the Policy.sh file from this object directory to the
13450new one before you run Configure -- this will help you with most of
13451the policy defaults.
13452
13453EOM
13454fi
13455if $test -f config.msg; then
13456 echo "Hmm. I also noted the following information while running:"
13457 echo " "
13458 $cat config.msg >&4
13459 $rm -f config.msg
13460fi
13461$rm -f kit*isdone ark*isdone
13462$rm -rf UU
13463
13464: End of Configure
13465