This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Allow hints file override for d_socket
[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#
5cc3184f 23# Generated on Thu Nov 12 19:00:08 EET 1998 [metaconfig 3.0 PL70]
5ff3f7a4 24# (with additional metaconfig patches by jhi@iki.fi)
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
AD
110fi
111case "$inksh/$needksh" in
112/[a-z]*)
c4f23d77 113 ENV=''
dfe9444c
AD
114 changesh=true
115 reason="$needksh"
116 ;;
117esac
118case "$inksh/$avoidksh" in
119true/[a-z]*)
120 changesh=true
121 reason="$avoidksh"
122 ;;
123esac
124case "$inksh/$needksh-$avoidksh-" in
125true/--)
a0d0e21e
LW
126 cat <<EOM
127(I see you are using the Korn shell. Some ksh's blow up on $me,
dfe9444c 128mainly on older exotic systems. If yours does, try the Bourne shell instead.)
ff0cee69 129EOM
dfe9444c
AD
130 ;;
131esac
132case "$changesh" in
133true)
134 echo "(Feeding myself to $newsh $reason.)"
135 case "$0" in
136 Configure|*/Configure) exec $newsh $0 "$@";;
137 *) exec $newsh Configure "$@";;
138 esac
139 ;;
140esac
2304df62 141
bfb7748a
AD
142: if needed set CDPATH to a harmless value that is not chatty
143: avoid bash 2.02 problems with empty CDPATH.
144case "$CDPATH" in
145'') ;;
146*) case "$SHELL" in
147 *bash*) CDPATH='.' ;;
148 *) CDPATH='' ;;
149 esac
150 ;;
151esac
2304df62
AD
152: Configure runs within the UU subdirectory
153test -d UU || mkdir UU
8e07c86e 154cd UU && rm -f ./*
2304df62 155
a0d0e21e 156dynamic_ext=''
2304df62 157extensions=''
a0d0e21e 158known_extensions=''
4318d5a0 159nonxs_ext=''
bfb7748a 160static_ext=''
8ff267be 161useopcode=''
a0d0e21e 162useposix=''
ecfc5424 163d_bsd=''
40a7a20a 164d_eunice=''
2304df62
AD
165d_xenix=''
166eunicefix=''
167Mcc=''
dfe9444c 168ar=''
2304df62
AD
169awk=''
170bash=''
171bison=''
172byacc=''
173cat=''
174chgrp=''
175chmod=''
176chown=''
ecfc5424 177comm=''
2304df62
AD
178compress=''
179cp=''
180cpio=''
181cpp=''
182csh=''
183date=''
184echo=''
185egrep=''
186emacs=''
187expr=''
188find=''
189flex=''
2304df62 190grep=''
8ff267be 191gzip=''
2304df62
AD
192inews=''
193ksh=''
194less=''
195line=''
196lint=''
197ln=''
198lp=''
199lpr=''
200ls=''
201mail=''
202mailx=''
dfe9444c 203make=''
2304df62
AD
204mkdir=''
205more=''
206mv=''
693762b4 207nm=''
2304df62
AD
208nroff=''
209perl=''
210pg=''
211pmake=''
212pr=''
213rm=''
214rmail=''
215sed=''
216sendmail=''
2304df62
AD
217shar=''
218sleep=''
219smail=''
220sort=''
221submit=''
222tail=''
223tar=''
224tbl=''
693762b4 225tee=''
2304df62
AD
226test=''
227touch=''
228tr=''
229troff=''
230uname=''
231uniq=''
232uuname=''
233vi=''
234zcat=''
8ff267be 235zip=''
1aef975c 236full_sed=''
a0d0e21e 237libswanted=''
2304df62
AD
238hint=''
239myuname=''
85e6fe83
LW
240osname=''
241osvers=''
2304df62
AD
242Author=''
243Date=''
244Header=''
245Id=''
246Locker=''
247Log=''
248RCSfile=''
249Revision=''
250Source=''
251State=''
dfe9444c
AD
252_a=''
253_exe=''
254_o=''
4633a7c4
LW
255archobjs=''
256exe_ext=''
257firstmakefile=''
258lib_ext=''
259obj_ext=''
260path_sep=''
2304df62 261afs=''
a0d0e21e 262alignbytes=''
c4f23d77 263ansi2knr=''
a0d0e21e
LW
264archlib=''
265archlibexp=''
a0d0e21e
LW
266d_archlib=''
267installarchlib=''
40000a8c
AD
268archname=''
269myarchname=''
ecfc5424 270baserev=''
2304df62
AD
271bin=''
272binexp=''
273installbin=''
274byteorder=''
275cc=''
276gccversion=''
277ccflags=''
278cppflags=''
279ldflags=''
280lkflags=''
8e07c86e 281locincpth=''
2304df62 282optimize=''
8e07c86e 283cf_email=''
2304df62
AD
284cf_by=''
285cf_time=''
286contains=''
a0d0e21e 287cpp_stuff=''
2304df62
AD
288cpplast=''
289cppminus=''
290cpprun=''
291cppstdin=''
292d_access=''
5ff3f7a4 293d_accessx=''
a0d0e21e 294d_alarm=''
ecfc5424 295d_attribut=''
2304df62
AD
296d_bcmp=''
297d_bcopy=''
298d_bzero=''
299d_casti32=''
300castflags=''
301d_castneg=''
a0d0e21e
LW
302d_chown=''
303d_chroot=''
2304df62 304d_chsize=''
a0d0e21e
LW
305d_closedir=''
306d_void_closedir=''
2304df62
AD
307d_const=''
308cryptlib=''
309d_crypt=''
310d_csh=''
1aef975c 311full_csh=''
a0d0e21e
LW
312d_cuserid=''
313d_dbl_dig=''
314d_difftime=''
315d_dlerror=''
316d_dlopen=''
317d_dlsymun=''
2304df62 318d_dosuid=''
a0d0e21e 319d_suidsafe=''
85ab1d1d 320d_drand48proto=''
2304df62 321d_dup2=''
5ff3f7a4
GS
322d_eaccess=''
323d_endgrent=''
e5c9fcd0
AD
324d_endhent=''
325d_endnent=''
326d_endpent=''
5ff3f7a4 327d_endpwent=''
e5c9fcd0 328d_endsent=''
2304df62
AD
329d_fchmod=''
330d_fchown=''
331d_fcntl=''
a0d0e21e
LW
332d_fd_macros=''
333d_fd_set=''
334d_fds_bits=''
335d_fgetpos=''
2304df62
AD
336d_flexfnam=''
337d_flock=''
a0d0e21e 338d_fork=''
5ff3f7a4 339d_fseeko=''
a0d0e21e 340d_fsetpos=''
5ff3f7a4 341d_ftello=''
5f05dabc 342d_ftime=''
343d_gettimeod=''
a0d0e21e 344d_Gconvert=''
5ff3f7a4 345d_getgrent=''
2304df62 346d_getgrps=''
4599a1de 347d_gethbyaddr=''
4599a1de 348d_gethbyname=''
dfe9444c 349d_gethent=''
2304df62
AD
350aphostname=''
351d_gethname=''
352d_phostname=''
353d_uname=''
dc45a647 354d_gethostprotos=''
a0d0e21e 355d_getlogin=''
dfe9444c 356d_getnbyaddr=''
693762b4 357d_getnbyname=''
e5c9fcd0 358d_getnent=''
dc45a647 359d_getnetprotos=''
e5c9fcd0 360d_getpent=''
2afac517 361d_getpgid=''
2304df62 362d_getpgrp2=''
2afac517 363d_bsdgetpgrp=''
2304df62 364d_getpgrp=''
a0d0e21e 365d_getppid=''
2304df62 366d_getprior=''
693762b4
AD
367d_getpbyname=''
368d_getpbynumber=''
dc45a647 369d_getprotoprotos=''
5ff3f7a4 370d_getpwent=''
e5c9fcd0 371d_getsent=''
dc45a647 372d_getservprotos=''
693762b4
AD
373d_getsbyname=''
374d_getsbyport=''
a4f3eea9 375d_gnulibc=''
2304df62 376d_htonl=''
7e1af8bc 377d_inetaton=''
2304df62
AD
378d_isascii=''
379d_killpg=''
dd64f1c3 380d_lchown=''
2304df62 381d_link=''
a0d0e21e
LW
382d_locconv=''
383d_lockf=''
e5c9fcd0
AD
384d_longdbl=''
385longdblsize=''
dc45a647
MB
386d_longlong=''
387longlongsize=''
2304df62 388d_lstat=''
a0d0e21e
LW
389d_mblen=''
390d_mbstowcs=''
391d_mbtowc=''
2304df62
AD
392d_memcmp=''
393d_memcpy=''
394d_memmove=''
395d_memset=''
396d_mkdir=''
a0d0e21e
LW
397d_mkfifo=''
398d_mktime=''
2304df62
AD
399d_msg=''
400d_msgctl=''
401d_msgget=''
402d_msgrcv=''
403d_msgsnd=''
a0d0e21e 404d_nice=''
2304df62 405d_open3=''
a0d0e21e
LW
406d_fpathconf=''
407d_pathconf=''
408d_pause=''
409d_pipe=''
8e07c86e 410d_poll=''
2304df62 411d_portable=''
13666627
JH
412d_pthread_create_joinable=''
413pthread_create_joinable=''
dfe9444c
AD
414d_pthread_yield=''
415d_sched_yield=''
1cfa4ec7 416sched_yield=''
2304df62 417d_readdir=''
85e6fe83
LW
418d_rewinddir=''
419d_seekdir=''
420d_telldir=''
a0d0e21e 421d_readlink=''
2304df62
AD
422d_rename=''
423d_rmdir=''
424d_safebcpy=''
425d_safemcpy=''
36477c24 426d_sanemcmp=''
2304df62
AD
427d_select=''
428d_sem=''
429d_semctl=''
430d_semget=''
431d_semop=''
432d_setegid=''
433d_seteuid=''
5ff3f7a4 434d_setgrent=''
dfe9444c 435d_setgrps=''
693762b4 436d_sethent=''
a0d0e21e 437d_setlinebuf=''
2304df62 438d_setlocale=''
e5c9fcd0
AD
439d_setnent=''
440d_setpent=''
2304df62
AD
441d_setpgid=''
442d_setpgrp2=''
2afac517 443d_bsdsetpgrp=''
2304df62
AD
444d_setpgrp=''
445d_setprior=''
5ff3f7a4 446d_setpwent=''
2304df62
AD
447d_setregid=''
448d_setresgid=''
449d_setresuid=''
450d_setreuid=''
451d_setrgid=''
452d_setruid=''
e5c9fcd0 453d_setsent=''
2304df62 454d_setsid=''
e5c9fcd0 455d_setvbuf=''
760ac839 456d_sfio=''
8ff267be 457usesfio=''
2304df62
AD
458d_shm=''
459d_shmat=''
a0d0e21e
LW
460d_shmatprototype=''
461shmattype=''
2304df62
AD
462d_shmctl=''
463d_shmdt=''
464d_shmget=''
2c7991dc 465d_sigaction=''
8ff267be 466d_sigsetjmp=''
2304df62
AD
467d_oldsock=''
468d_socket=''
469d_sockpair=''
470sockethdr=''
471socketlib=''
472d_statblks=''
c2960299
AD
473d_stdio_cnt_lval=''
474d_stdio_ptr_lval=''
16d20bd9 475d_stdiobase=''
2304df62 476d_stdstdio=''
16d20bd9
AD
477stdio_base=''
478stdio_bufsiz=''
479stdio_cnt=''
dfe9444c 480stdio_filbuf=''
16d20bd9 481stdio_ptr=''
2304df62
AD
482d_index=''
483d_strchr=''
a0d0e21e 484d_strcoll=''
2304df62
AD
485d_strctcpy=''
486d_strerrm=''
487d_strerror=''
488d_sysernlst=''
489d_syserrlst=''
a89d8a78
DH
490d_strtod=''
491d_strtol=''
492d_strtoul=''
a0d0e21e 493d_strxfrm=''
2304df62
AD
494d_symlink=''
495d_syscall=''
a0d0e21e 496d_sysconf=''
2304df62 497d_system=''
a0d0e21e
LW
498d_tcgetpgrp=''
499d_tcsetpgrp=''
85e6fe83
LW
500d_time=''
501timetype=''
2304df62
AD
502clocktype=''
503d_times=''
504d_truncate=''
a0d0e21e
LW
505d_tzname=''
506d_umask=''
bd89102f
AD
507d_semctl_semid_ds=''
508d_semctl_semun=''
509d_union_semun=''
2304df62 510d_vfork=''
a0d0e21e 511usevfork=''
2304df62
AD
512d_voidsig=''
513signal_t=''
514d_volatile=''
515d_charvspr=''
516d_vprintf=''
517d_wait4=''
518d_waitpid=''
a0d0e21e
LW
519d_wcstombs=''
520d_wctomb=''
5ff3f7a4
GS
521d_dbmclose64=''
522d_dbminit64=''
523d_delete64=''
524d_fetch64=''
525d_firstkey64=''
526d_nextkey64=''
527d_store64=''
a0d0e21e 528dlext=''
85e6fe83
LW
529cccdlflags=''
530ccdlflags=''
2304df62 531dlsrc=''
232e078e 532ld=''
85e6fe83 533lddlflags=''
2304df62 534usedl=''
693762b4 535doublesize=''
5ff3f7a4 536ebcdic=''
a0d0e21e 537fpostype=''
2304df62
AD
538gidtype=''
539groupstype=''
540h_fcntl=''
541h_sysfile=''
5ff3f7a4 542i_arpainet=''
ecfc5424
AD
543db_hashtype=''
544db_prefixtype=''
a0d0e21e 545i_db=''
2304df62 546i_dbm=''
8e07c86e 547i_rpcsvcdbm=''
2304df62 548d_dirnamlen=''
a0d0e21e 549direntrytype=''
2304df62 550i_dirent=''
a0d0e21e 551i_dld=''
2304df62
AD
552i_dlfcn=''
553i_fcntl=''
a0d0e21e 554i_float=''
2304df62 555i_gdbm=''
28e8609d 556d_grpasswd=''
2304df62 557i_grp=''
5ff3f7a4
GS
558d_int64t=''
559i_inttypes=''
a0d0e21e 560i_limits=''
4633a7c4 561i_locale=''
7f3d1cf1 562i_machcthr=''
a0d0e21e
LW
563i_malloc=''
564i_math=''
85e6fe83 565i_memory=''
2304df62 566i_ndbm=''
3fd537d4 567i_netdb=''
85e6fe83 568i_neterrno=''
2304df62
AD
569i_niin=''
570i_sysin=''
571d_pwage=''
572d_pwchange=''
573d_pwclass=''
574d_pwcomment=''
575d_pwexpire=''
c4f23d77 576d_pwgecos=''
28e8609d 577d_pwpasswd=''
2304df62
AD
578d_pwquota=''
579i_pwd=''
760ac839 580i_sfio=''
2304df62 581i_stddef=''
a0d0e21e 582i_stdlib=''
2304df62
AD
583i_string=''
584strings=''
5ff3f7a4 585i_sysaccess=''
2304df62
AD
586i_sysdir=''
587i_sysfile=''
588d_voidtty=''
589i_bsdioctl=''
a0d0e21e 590i_sysfilio=''
2304df62
AD
591i_sysioctl=''
592i_syssockio=''
593i_sysndir=''
a0d0e21e 594i_sysparam=''
8ff267be 595i_sysresrc=''
5ff3f7a4 596i_syssecrt=''
2304df62 597i_sysselct=''
1aef975c 598i_sysstat=''
a0d0e21e 599i_systimes=''
fed7345c 600i_systypes=''
25f94b33 601i_sysun=''
8ff267be 602i_syswait=''
2304df62
AD
603i_sgtty=''
604i_termio=''
605i_termios=''
606i_systime=''
607i_systimek=''
608i_time=''
609timeincl=''
85e6fe83 610i_unistd=''
2304df62 611i_utime=''
760ac839 612i_values=''
a0d0e21e 613i_stdarg=''
2304df62
AD
614i_varargs=''
615i_varhdr=''
616i_vfork=''
617intsize=''
24fef2a7
AD
618longsize=''
619shortsize=''
5ff3f7a4
GS
620d_dirent64s=''
621d_flock64s=''
622d_fstat64=''
623d_ftruncate64=''
624d_ino64t=''
625d_lockf64=''
626d_lseek64=''
627d_lstat64=''
628d_off64t=''
629d_open64=''
630d_opendir64=''
631d_readdir64=''
632d_seekdir64=''
633d_stat64=''
634d_telldir64=''
635d_truncate64=''
2304df62 636libc=''
8ff267be 637libperl=''
2afac517 638shrpenv=''
8ff267be 639useshrplib=''
a0d0e21e 640glibpth=''
2304df62 641libpth=''
8e07c86e 642loclibpth=''
2304df62
AD
643plibpth=''
644xlibpth=''
1cfa4ec7 645ignore_versioned_solibs=''
2304df62 646libs=''
85e6fe83 647lns=''
5ff3f7a4 648lseeksize=''
85e6fe83 649lseektype=''
8ff267be 650make_set_make=''
85e6fe83 651d_mymalloc=''
94b6baf5 652freetype=''
2304df62
AD
653mallocobj=''
654mallocsrc=''
655malloctype=''
656usemymalloc=''
16d20bd9
AD
657installman1dir=''
658man1dir=''
659man1direxp=''
660man1ext=''
661installman3dir=''
662man3dir=''
663man3direxp=''
664man3ext=''
2304df62
AD
665huge=''
666large=''
667medium=''
668models=''
669small=''
670split=''
a0d0e21e 671modetype=''
2304df62
AD
672mydomain=''
673myhostname=''
674phostname=''
675c=''
676n=''
8e07c86e
AD
677d_eofnblk=''
678eagain=''
679o_nonblock=''
680rd_nodata=''
dfe9444c
AD
681netdb_hlen_type=''
682netdb_host_type=''
683netdb_name_type=''
684netdb_net_type=''
2304df62
AD
685groupcat=''
686hostcat=''
687passcat=''
85e6fe83
LW
688orderlib=''
689ranlib=''
2304df62
AD
690package=''
691spackage=''
2c7991dc 692pager=''
bfb7748a 693apiversion=''
ecfc5424 694patchlevel=''
760ac839 695subversion=''
bfb7748a 696version=''
8e07c86e 697perladmin=''
4633a7c4 698perlpath=''
dfe9444c 699pidtype=''
a0d0e21e 700prefix=''
1aef975c 701prefixexp=''
2304df62
AD
702installprivlib=''
703privlib=''
704privlibexp=''
705prototype=''
693762b4 706ptrsize=''
85ab1d1d 707drand01=''
2304df62 708randbits=''
85ab1d1d
JH
709randfunc=''
710randseedtype=''
711seedfunc=''
2304df62
AD
712installscript=''
713scriptdir=''
714scriptdirexp=''
5ff3f7a4 715selectminbits=''
a0d0e21e 716selecttype=''
8ff267be 717sh=''
2304df62 718sig_name=''
dfe9444c 719sig_name_init=''
8e07c86e 720sig_num=''
824a2ba3 721sig_num_init=''
4633a7c4
LW
722installsitearch=''
723sitearch=''
724sitearchexp=''
25f94b33
AD
725installsitelib=''
726sitelib=''
727sitelibexp=''
a0d0e21e
LW
728sizetype=''
729so=''
2304df62
AD
730sharpbang=''
731shsharp=''
732spitshell=''
dfe9444c 733src=''
a0d0e21e 734ssizetype=''
4633a7c4 735startperl=''
2304df62
AD
736startsh=''
737stdchar=''
5ff3f7a4
GS
738d_fgetpos64=''
739d_fopen64=''
740d_freopen64=''
741d_fseek64=''
742d_fseeko64=''
743d_fsetpos64=''
744d_ftell64=''
745d_ftello64=''
746d_tmpfile64=''
2304df62 747sysman=''
5ff3f7a4 748trnl=''
2304df62 749uidtype=''
85ab1d1d 750archname64=''
5ff3f7a4 751use64bits=''
85ab1d1d 752usemultiplicity=''
2304df62 753nm_opt=''
40a7a20a 754nm_so_opt=''
2304df62
AD
755runnm=''
756usenm=''
8ff267be 757useperlio=''
693762b4 758d_oldpthreads=''
dfe9444c 759usethreads=''
2304df62
AD
760incpath=''
761mips=''
762mips_type=''
763usrinc=''
764defvoidused=''
765voidflags=''
2304df62
AD
766CONFIG=''
767
ecfc5424
AD
768define='define'
769undef='undef'
770smallmach='pdp11 i8086 z8000 i80286 iAPX286'
771rmlist=''
772
773: We must find out about Eunice early
774eunicefix=':'
775if test -f /etc/unixtovms; then
776 eunicefix=/etc/unixtovms
777fi
778if test -f /etc/unixtovms.exe; then
779 eunicefix=/etc/unixtovms.exe
780fi
781
5ff3f7a4
GS
782i_whoami=''
783: change the next line if compiling for Xenix/286 on Xenix/386
784xlibpth='/usr/lib/386 /lib/386'
785
786: Possible local library directories to search.
787loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
788loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
789
790: general looking path for locating libraries
791glibpth="/shlib /usr/shlib /lib/pa1.1 /usr/lib/large"
792glibpth="$glibpth /lib /usr/lib $xlibpth"
793glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
794glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
795
796: Private path used by Configure to find libraries. Its value
797: is prepended to libpth. This variable takes care of special
798: machines, like the mips. Usually, it should be empty.
799plibpth=''
800
5ff3f7a4
GS
801: Possible local include directories to search.
802: Set locincpth to "" in a hint file to defeat local include searches.
803locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
804locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
805:
806: no include file wanted by default
807inclwanted=''
808
ecfc5424
AD
809: list of known cpp symbols, sorted alphabetically
810al="AMIX BIT_MSF BSD BSD4_3 BSD_NET2 CMU CRAY DGUX DOLPHIN DPX2"
811al="$al GO32 GOULD_PN HP700 I386 I80960 I960 Lynx M68000 M68K MACH"
812al="$al MIPSEB MIPSEL MSDOS MTXINU MULTIMAX MVS"
813al="$al M_COFF M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM"
814al="$al M_SYS3 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX"
815al="$al NeXT OCS88 OSF1 PARISC PC532 PORTAR POSIX"
816al="$al PWB R3000 RES RISC6000 RT Sun386i SVR3 SVR4"
817al="$al SYSTYPE_BSD SYSTYPE_SVR4 SYSTYPE_SYSV Tek4132 Tek4300"
818al="$al UMAXV USGr4 USGr4_2 UTEK UTS UTek UnicomPBB UnicomPBD Utek"
819al="$al VMS Xenix286"
5ff3f7a4
GS
820al="$al _AIX _AIX32 _AIX370 _AIX41 _AM29000 _COFF _CRAY _CX_UX _EPI"
821al="$al _IBMESA _IBMR2 _M88K _M88KBCS_TARGET _POWER"
ecfc5424
AD
822al="$al _MIPSEB _MIPSEL _M_COFF _M_I86 _M_I86SM _M_SYS3"
823al="$al _M_SYS5 _M_SYSIII _M_SYSV _M_UNIX _M_XENIX _NLS _PGC_ _R3000"
824al="$al _SYSTYPE_BSD _SYSTYPE_BSD43 _SYSTYPE_SVR4"
825al="$al _SYSTYPE_SYSV _SYSV3 _U370 _UNICOS"
826al="$al __386BSD__ __BIG_ENDIAN __BIG_ENDIAN__ __BSD_4_4__"
827al="$al __DGUX__ __DPX2__ __H3050R __H3050RX"
828al="$al __LITTLE_ENDIAN __LITTLE_ENDIAN__ __MACH__"
829al="$al __MIPSEB __MIPSEB__ __MIPSEL __MIPSEL__"
830al="$al __Next__ __OSF1__ __PARAGON__ __PGC__ __PWB __STDC__"
831al="$al __SVR4_2__ __UMAXV__"
832al="$al ____386BSD____ __alpha __alpha__ __amiga"
833al="$al __bsd4_2 __bsd4_2__ __bsdi__ __convex__"
834al="$al __host_mips__"
835al="$al __hp9000s200 __hp9000s300 __hp9000s400 __hp9000s500"
836al="$al __hp9000s500 __hp9000s700 __hp9000s800"
837al="$al __hppa __hpux __hp_osf __i286 __i286__ __i386 __i386__"
838al="$al __i486 __i486__ __i860 __i860__ __ibmesa __ksr1__ __linux__"
839al="$al __m68k __m68k__ __m88100__ __m88k __m88k__"
840al="$al __mc68000 __mc68000__ __mc68020 __mc68020__"
841al="$al __mc68030 __mc68030__ __mc68040 __mc68040__"
842al="$al __mc88100 __mc88100__ __mips __mips__"
843al="$al __motorola__ __osf__ __pa_risc __sparc__ __stdc__"
844al="$al __sun __sun__ __svr3__ __svr4__ __ultrix __ultrix__"
845al="$al __unix __unix__ __uxpm__ __uxps__ __vax __vax__"
846al="$al _host_mips _mips _unix"
847al="$al a29k aegis aix aixpc alliant alpha am29000 amiga ansi ardent"
848al="$al apollo ardent att386 att3b"
849al="$al bsd bsd43 bsd4_2 bsd4_3 bsd4_4 bsdi bull"
850al="$al cadmus clipper concurrent convex cray ctix"
851al="$al dmert encore gcos gcx gimpel gould"
852al="$al hbullx20 hcx host_mips hp200 hp300 hp700 hp800"
853al="$al hp9000 hp9000s300 hp9000s400 hp9000s500"
854al="$al hp9000s700 hp9000s800 hp9k8 hppa hpux"
855al="$al i186 i286 i386 i486 i8086"
856al="$al i80960 i860 iAPX286 ibm ibm032 ibmrt interdata is68k"
857al="$al ksr1 linux luna luna88k m68k m88100 m88k"
858al="$al mc300 mc500 mc68000 mc68010 mc68020 mc68030"
859al="$al mc68040 mc68060 mc68k mc68k32 mc700"
860al="$al mc88000 mc88100 merlin mert mips mvs n16"
861al="$al ncl_el ncl_mr"
862al="$al news1500 news1700 news1800 news1900 news3700"
863al="$al news700 news800 news900 ns16000 ns32000"
864al="$al ns32016 ns32332 ns32k nsc32000 os osf"
865al="$al parisc pc532 pdp11 plexus posix pyr"
866al="$al riscix riscos scs sequent sgi sinix sony sony_news"
867al="$al sonyrisc sparc sparclite spectrum stardent stratos"
868al="$al sun sun3 sun386 svr4 sysV68 sysV88"
869al="$al titan tower tower32 tower32_200 tower32_600 tower32_700"
870al="$al tower32_800 tower32_850 tss u370 u3b u3b2 u3b20 u3b200"
871al="$al u3b20d u3b5 ultrix unix unixpc unos vax venix vms"
872al="$al xenix z8000"
873
dfe9444c 874: Trailing extension. Override this in a hint file, if needed.
4e2a5f63 875_exe=''
dfe9444c
AD
876: Extra object files, if any, needed on this platform.
877archobjs=''
878groupstype=''
1cfa4ec7
GS
879: default library list
880libswanted=''
921b2963 881: some systems want to use only the non-versioned libso:s
1cfa4ec7 882ignore_versioned_solibs=''
bfb7748a
AD
883: full support for void wanted by default
884defvoidused=15
885
dfe9444c
AD
886: set useposix=false in your hint file to disable the POSIX extension.
887useposix=true
888: set useopcode=false in your hint file to disable the Opcode extension.
889useopcode=true
85ab1d1d 890: set usemultiplicity on the Configure command line to enable multiplicity.
dfe9444c 891: set usethreads on the Configure command line to enable threads.
ecfc5424 892: List of libraries we want.
693762b4
AD
893: If anyone needs -lnet, put it in a hint file.
894libswanted='sfio socket inet nsl nm ndbm gdbm dbm db malloc dl'
ecfc5424
AD
895libswanted="$libswanted dld ld sun m c cposix posix ndir dir crypt"
896libswanted="$libswanted ucb bsd BSD PW x"
1aef975c 897: We probably want to search /usr/shlib before most other libraries.
94b6baf5 898: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
ecfc5424
AD
899glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
900glibpth="/usr/shlib $glibpth"
901: Do not use vfork unless overridden by a hint file.
902usevfork=false
903
8ff267be 904: Find the basic shell for Bourne shell scripts
905case "$sh" in
906'')
8ff267be 907 case "$SYSTYPE" in
908 *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
909 *) xxx='/bin/sh';;
910 esac
911 if test -f "$xxx"; then
912 sh="$xxx"
913 else
914 : Build up a list and do a single loop so we can 'break' out.
915 pth=`echo $PATH | sed -e "s/$p_/ /g"`
916 for xxx in sh bash ksh pdksh ash; do
917 for p in $pth; do
918 try="$try ${p}/${xxx}"
919 done
920 done
921 for xxx in $try; do
922 if test -f "$xxx"; then
923 sh="$xxx";
8ff267be 924 break
925 elif test -f "$xxx.exe"; then
926 sh="$xxx";
8ff267be 927 break
928 fi
929 done
930 fi
931 ;;
932esac
933
934case "$sh" in
935'') cat <<EOM >&2
936$me: Fatal Error: I can't find a Bourne Shell anywhere.
dfe9444c 937
8ff267be 938Usually it's in /bin/sh. How did you even get this far?
5ff3f7a4 939Please contact me (Jarkko Hietaniemi) at jhi@iki.fi and
dfe9444c 940we'll try to straighten this all out.
8ff267be 941EOM
942 exit 1
943 ;;
944esac
945
760ac839 946: see if sh knows # comments
8ff267be 947if `$sh -c '#' >/dev/null 2>&1`; then
760ac839
LW
948 shsharp=true
949 spitshell=cat
760ac839
LW
950 xcat=/bin/cat
951 test -f $xcat || xcat=/usr/bin/cat
952 echo "#!$xcat" >try
953 $eunicefix try
954 chmod +x try
955 ./try > today
956 if test -s today; then
760ac839
LW
957 sharpbang='#!'
958 else
959 echo "#! $xcat" > try
960 $eunicefix try
961 chmod +x try
962 ./try > today
963 if test -s today; then
760ac839
LW
964 sharpbang='#! '
965 else
760ac839
LW
966 sharpbang=': use '
967 fi
968 fi
969else
dfe9444c 970 echo " "
8ff267be 971 echo "Your $sh doesn't grok # comments--I will strip them later on."
760ac839
LW
972 shsharp=false
973 cd ..
974 echo "exec grep -v '^[ ]*#'" >spitshell
975 chmod +x spitshell
976 $eunicefix spitshell
977 spitshell=`pwd`/spitshell
978 cd UU
979 echo "I presume that if # doesn't work, #! won't work either!"
980 sharpbang=': use '
981fi
982rm -f try today
983
984: figure out how to guarantee sh startup
8ff267be 985case "$startsh" in
986'') startsh=${sharpbang}${sh} ;;
987*)
760ac839 988esac
760ac839
LW
989cat >try <<EOSS
990$startsh
991set abc
992test "$?abc" != 1
993EOSS
994
995chmod +x try
996$eunicefix try
997if ./try; then
8ff267be 998 : echo "Yup, it does."
760ac839 999else
dfe9444c
AD
1000 echo "Hmm... '$startsh' does not guarantee sh startup..."
1001 echo "You may have to fix up the shell scripts to make sure $sh runs them."
760ac839
LW
1002fi
1003rm -f try
1004
aebf16e7
AD
1005
1006: Save command line options in file UU/cmdline.opt for later use in
1007: generating config.sh.
1008cat > cmdline.opt <<EOSH
1009# Configure command line arguments.
1010config_arg0='$0'
1011config_args='$*'
1012config_argc=$#
1013EOSH
1014argn=1
1015for arg in "$@"; do
1016 cat >>cmdline.opt <<EOSH
1017config_arg$argn='$arg'
1018EOSH
1019 argn=`expr $argn + 1`
1020done
1021
2304df62
AD
1022: produce awk script to parse command line options
1023cat >options.awk <<'EOF'
1024BEGIN {
16d20bd9 1025 optstr = "dD:eEf:hKOrsSU:V"; # getopt-style specification
2304df62
AD
1026
1027 len = length(optstr);
1028 for (i = 1; i <= len; i++) {
1029 c = substr(optstr, i, 1);
1030 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1031 if (a == ":") {
1032 arg[c] = 1;
1033 i++;
1034 }
1035 opt[c] = 1;
1036 }
1037}
1038{
1039 expect = 0;
1040 str = $0;
1041 if (substr(str, 1, 1) != "-") {
1042 printf("'%s'\n", str);
1043 next;
1044 }
1045 len = length($0);
1046 for (i = 2; i <= len; i++) {
1047 c = substr(str, i, 1);
1048 if (!opt[c]) {
1049 printf("-%s\n", substr(str, i));
1050 next;
1051 }
1052 printf("-%s\n", c);
1053 if (arg[c]) {
1054 if (i < len)
1055 printf("'%s'\n", substr(str, i + 1));
1056 else
1057 expect = 1;
1058 next;
1059 }
1060 }
1061}
1062END {
1063 if (expect)
1064 print "?";
1065}
1066EOF
1067
1068: process the command line options
4633a7c4
LW
1069set X `for arg in "$@"; do echo "X$arg"; done |
1070 sed -e s/X// | awk -f options.awk`
2304df62
AD
1071eval "set $*"
1072shift
1073rm -f options.awk
1074
1075: set up default values
1076fastread=''
1077reuseval=false
1078config_sh=''
1079alldone=''
1080error=''
1081silent=''
1082extractsh=''
ecfc5424 1083override=''
16d20bd9 1084knowitall=''
1aef975c 1085rm -f optdef.sh
28757baa 1086cat >optdef.sh <<EOS
1087$startsh
1088EOS
2304df62 1089
dfe9444c 1090
2304df62
AD
1091: option parsing
1092while test $# -gt 0; do
1093 case "$1" in
1094 -d) shift; fastread=yes;;
1095 -e) shift; alldone=cont;;
1096 -f)
1097 shift
1098 cd ..
1099 if test -r "$1"; then
1100 config_sh="$1"
1101 else
a0d0e21e 1102 echo "$me: cannot read config file $1." >&2
2304df62
AD
1103 error=true
1104 fi
1105 cd UU
1106 shift;;
1107 -h) shift; error=true;;
1108 -r) shift; reuseval=true;;
dfe9444c 1109 -s) shift; silent=true; realsilent=true;;
2304df62 1110 -E) shift; alldone=exit;;
16d20bd9 1111 -K) shift; knowitall=true;;
ecfc5424 1112 -O) shift; override=true;;
dfe9444c 1113 -S) shift; silent=true; extractsh=true;;
a0d0e21e
LW
1114 -D)
1115 shift
1116 case "$1" in
1117 *=)
1118 echo "$me: use '-U symbol=', not '-D symbol='." >&2
1119 echo "$me: ignoring -D $1" >&2
1120 ;;
ecfc5424 1121 *=*) echo "$1" | \
1aef975c
AD
1122 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1123 *) echo "$1='define'" >> optdef.sh;;
a0d0e21e
LW
1124 esac
1125 shift
1126 ;;
1127 -U)
1128 shift
1129 case "$1" in
1aef975c 1130 *=) echo "$1" >> optdef.sh;;
a0d0e21e
LW
1131 *=*)
1132 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1133 echo "$me: ignoring -U $1" >&2
1134 ;;
1aef975c 1135 *) echo "$1='undef'" >> optdef.sh;;
a0d0e21e
LW
1136 esac
1137 shift
1138 ;;
dfe9444c 1139 -V) echo "$me generated by metaconfig 3.0 PL70." >&2
2304df62
AD
1140 exit 0;;
1141 --) break;;
a0d0e21e 1142 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
2304df62
AD
1143 *) break;;
1144 esac
1145done
1146
1147case "$error" in
1148true)
1149 cat >&2 <<EOM
2afac517 1150Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
a0d0e21e 1151 [-U symbol] [-U symbol=]
2304df62
AD
1152 -d : use defaults for all answers.
1153 -e : go on without questioning past the production of config.sh.
1154 -f : specify an alternate default configuration file.
1155 -h : print this help message and exit (with an error status).
1156 -r : reuse C symbols value if possible (skips costly nm extraction).
1157 -s : silent mode, only echoes questions and essential information.
a0d0e21e
LW
1158 -D : define symbol to have some value:
1159 -D symbol symbol gets the value 'define'
1160 -D symbol=value symbol gets the value 'value'
2304df62 1161 -E : stop at the end of questions, after having produced config.sh.
16d20bd9 1162 -K : do not use unless you know what you are doing.
ecfc5424 1163 -O : let -D and -U override definitions from loaded configuration file.
2304df62 1164 -S : perform variable substitutions on all .SH files (can mix with -f)
a0d0e21e
LW
1165 -U : undefine symbol:
1166 -U symbol symbol gets the value 'undef'
1167 -U symbol= symbol gets completely empty
2304df62
AD
1168 -V : print version number and exit (with a zero status).
1169EOM
1170 exit 1
1171 ;;
1172esac
1173
dfe9444c
AD
1174: Sanity checks
1175case "$fastread$alldone" in
1176yescont|yesexit) ;;
1177*)
1178 if test ! -t 0; then
1179 echo "Say 'sh Configure', not 'sh <Configure'"
1180 exit 1
1181 fi
1182 ;;
1183esac
1184
2304df62
AD
1185exec 4>&1
1186case "$silent" in
1187true) exec 1>/dev/null;;
1188esac
1189
ecfc5424 1190: run the defines and the undefines, if any, but leave the file out there...
1aef975c
AD
1191touch optdef.sh
1192. ./optdef.sh
a0d0e21e 1193
2304df62 1194: set package name
85e6fe83 1195package=perl5
1aef975c
AD
1196first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1197last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1198case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1199ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1200*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1201esac
2304df62 1202
2304df62
AD
1203: Some greps do not return status, grrr.
1204echo "grimblepritz" >grimble
1205if grep blurfldyick grimble >/dev/null 2>&1 ; then
1206 contains=contains
1207elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1208 contains=grep
1209else
1210 contains=contains
1211fi
1212rm -f grimble
1213: the following should work in any shell
1214case "$contains" in
1215contains*)
1216 echo " "
1217 echo "AGH! Grep doesn't return a status. Attempting remedial action."
1218 cat >contains <<'EOSS'
1219grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1220EOSS
1221chmod +x contains
1222esac
1223
dfe9444c
AD
1224: Find the path to the source tree
1225case "$src" in
1226'') case "$0" in
1227 */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`;;
1228 *) src='.';;
1229 esac;;
1230esac
1231case "$src" in
1232'') src=/
1233 rsrc=/
1234 ;;
1235/*) rsrc="$src";;
1236*) rsrc="../$src";;
1237esac
1238if test -f $rsrc/Configure && \
1239 $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1240then
1241 : found it, so we are ok.
1242else
1243 rsrc=''
1244 for src in . .. ../.. ../../.. ../../../..; do
1245 if test -f ../$src/Configure && \
1246 $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1247 then
1248 rsrc=../$src
1249 break
1250 fi
1251 done
1252fi
1253case "$rsrc" in
1254'')
1255 cat <<EOM >&4
1256
1257Sorry, I can't seem to locate the source dir for $package. Please start
1258Configure with an explicit path -- i.e. /some/path/Configure.
1259
1260EOM
1261 exit 1
1262 ;;
1263../.) rsrc='..';;
1264*)
1265 echo " "
1266 echo "Sources for $package found in \"$src\"." >&4
1267 ;;
1268esac
1269
1270: script used to extract .SH files with variable substitutions
1271cat >extract <<'EOS'
1272CONFIG=true
1273echo "Doing variable substitutions on .SH files..."
1274if test -f $src/MANIFEST; then
f7ab18e9 1275 set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
dfe9444c
AD
1276else
1277 echo "(Looking for .SH files under the source directory.)"
1278 set x `(cd $src; find . -name "*.SH" -print)`
1279fi
1280shift
1281case $# in
12820) set x `(cd $src; echo *.SH)`; shift;;
1283esac
1284if test ! -f $src/$1; then
1285 shift
1286fi
1287mkdir_p='
1288name=$1;
1289create="";
1290while test $name; do
1291 if test ! -d "$name"; then
1292 create="$name $create";
1293 name=`echo $name | sed -e "s|^[^/]*$||"`;
1294 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1295 else
1296 name="";
1297 fi;
1298done;
1299for file in $create; do
1300 mkdir $file;
1301done
1302'
1303for file in $*; do
1304 case "$src" in
1305 ".")
1306 case "$file" in
1307 */*)
1308 dir=`expr X$file : 'X\(.*\)/'`
1309 file=`expr X$file : 'X.*/\(.*\)'`
1310 (cd $dir && . ./$file)
1311 ;;
1312 *)
1313 . ./$file
1314 ;;
1315 esac
1316 ;;
1317 *)
1318 case "$file" in
1319 */*)
1320 dir=`expr X$file : 'X\(.*\)/'`
1321 file=`expr X$file : 'X.*/\(.*\)'`
1322 (set x $dir; shift; eval $mkdir_p)
1323 sh <$src/$dir/$file
1324 ;;
1325 *)
1326 sh <$src/$file
1327 ;;
1328 esac
1329 ;;
1330 esac
1331done
1332if test -f $src/config_h.SH; then
1333 if test ! -f config.h; then
1334 : oops, they left it out of MANIFEST, probably, so do it anyway.
1335 . $src/config_h.SH
1336 fi
1337fi
1338EOS
1339
1340: extract files and exit if asked to do so
1341case "$extractsh" in
1342true)
1343 case "$realsilent" in
1344 true) ;;
1345 *) exec 1>&4;;
1346 esac
1347 case "$config_sh" in
1348 '') config_sh='config.sh';;
1349 esac
1350 echo " "
1351 echo "Fetching answers from $config_sh..."
1352 cd ..
1353 . $config_sh
1354 test "$override" && . ./optdef.sh
1355 echo " "
1356 . UU/extract
1357 rm -rf UU
1358 echo "Done."
1359 exit 0
1360 ;;
1361esac
1362
1363: Eunice requires " " instead of "", can you believe it
1364echo " "
1365: Here we go...
1366echo "Beginning of configuration questions for $package."
1367
1368trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1369
2304df62
AD
1370: first determine how to suppress newline on echo command
1371echo " "
1372echo "Checking echo to see how to suppress newlines..."
1373(echo "hi there\c" ; echo " ") >.echotmp
1374if $contains c .echotmp >/dev/null 2>&1 ; then
1375 echo "...using -n."
1376 n='-n'
1377 c=''
1378else
1379 cat <<'EOM'
1380...using \c
1381EOM
1382 n=''
1383 c='\c'
1384fi
1385echo $n "The star should be here-->$c"
1386echo '*'
1387rm -f .echotmp
1388
1389: Now test for existence of everything in MANIFEST
1390echo " "
dfe9444c 1391if test -f $rsrc/MANIFEST; then
2304df62 1392 echo "First let's make sure your kit is complete. Checking..." >&4
dfe9444c 1393 awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
2304df62 1394 rm -f missing
dfe9444c 1395 tmppwd=`pwd`
2304df62 1396 for filelist in x??; do
dfe9444c 1397 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
2304df62
AD
1398 done
1399 if test -s missing; then
1400 cat missing >&4
1401 cat >&4 <<'EOM'
1402
1403THIS PACKAGE SEEMS TO BE INCOMPLETE.
1404
1405You have the option of continuing the configuration process, despite the
1406distinct possibility that your kit is damaged, by typing 'y'es. If you
1407do, don't blame me if something goes wrong. I advise you to type 'n'o
5ff3f7a4 1408and contact the author (jhi@iki.fi).
2304df62
AD
1409
1410EOM
1411 echo $n "Continue? [n] $c" >&4
1412 read ans
1413 case "$ans" in
1414 y*)
1415 echo "Continuing..." >&4
1416 rm -f missing
1417 ;;
1418 *)
1419 echo "ABORTING..." >&4
1420 kill $$
1421 ;;
1422 esac
1423 else
dfe9444c 1424 echo "Looks good..."
2304df62
AD
1425 fi
1426else
1427 echo "There is no MANIFEST file. I hope your kit is complete !"
1428fi
1429rm -f missing x??
1430
5ff3f7a4
GS
1431echo " "
1432: Find the appropriate value for a newline for tr
1433if test -n "$DJGPP"; then
1434 trnl='\012'
1435fi
1436if test X"$trnl" = X; then
1437 case "`echo foo|tr '\n' x 2>/dev/null`" in
1438 foox) trnl='\n' ;;
1439 esac
1440fi
1441if test X"$trnl" = X; then
1442 case "`echo foo|tr '\012' x 2>/dev/null`" in
1443 foox) trnl='\012' ;;
1444 esac
1445fi
1446if test X"$trnl" = X; then
1447 cat <<EOM >&2
1448
1449$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1450
1451EOM
1452 exit 1
1453fi
1454
2304df62
AD
1455: compute the number of columns on the terminal for proper question formatting
1456case "$COLUMNS" in
1457'') COLUMNS='80';;
1458esac
1459
1460: set up the echo used in my read
1461myecho="case \"\$xxxm\" in
1462'') echo $n \"\$rp $c\" >&4;;
1463*) case \"\$rp\" in
1464 '') echo $n \"[\$xxxm] $c\";;
1465 *)
1466 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
1467 echo \"\$rp\" >&4
1468 echo $n \"[\$xxxm] $c\" >&4
1469 else
1470 echo $n \"\$rp [\$xxxm] $c\" >&4
1471 fi
1472 ;;
1473 esac;;
1474esac"
1475
1476: now set up to do reads with possible shell escape and default assignment
1477cat <<EOSC >myread
28757baa 1478$startsh
2304df62
AD
1479xxxm=\$dflt
1480$myecho
1481ans='!'
1482case "\$fastread" in
1483yes) case "\$dflt" in
1484 '') ;;
1485 *) ans='';
1486 case "\$silent-\$rp" in
1487 true-) ;;
1488 *) echo " " >&4;;
1489 esac;;
1490 esac;;
1491*) case "\$silent" in
1492 true) case "\$rp" in
1493 '') ans='';;
1494 esac;;
1495 esac;;
1496esac
1497while expr "X\$ans" : "X!" >/dev/null; do
1498 read answ
1499 set x \$xxxm
1500 shift
dfe9444c 1501 aok=''; eval "ans=\\"\$answ\\"" && aok=y
2304df62 1502 case "\$answ" in
dfe9444c
AD
1503 "!")
1504 sh 1>&4
1505 echo " "
1506 $myecho
1507 ;;
1508 !*)
1509 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1510 shift
1511 sh 1>&4 -c "\$*"
1512 echo " "
1513 $myecho
1514 ;;
2304df62
AD
1515 "\$ans")
1516 case "\$ans" in
ecfc5424
AD
1517 \\&*)
1518 set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1519 shift
1520 case "\$1" in
1521 -d)
1522 fastread=yes
40a7a20a 1523 echo "(OK, I'll run with -d after this question.)" >&4
ecfc5424
AD
1524 ;;
1525 -*)
40a7a20a 1526 echo "*** Sorry, \$1 not supported yet." >&4
ecfc5424
AD
1527 ;;
1528 esac
1529 $myecho
1530 ans=!
1531 ;;
2304df62
AD
1532 esac;;
1533 *)
1534 case "\$aok" in
1535 y)
1536 echo "*** Substitution done -- please confirm."
1537 xxxm="\$ans"
c9795ab7 1538 ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2304df62
AD
1539 xxxm="\$ans"
1540 ans=!
1541 ;;
1542 *)
1543 echo "*** Error -- try again."
1544 ans=!
1545 ;;
1546 esac
1547 $myecho
1548 ;;
1549 esac
1550 case "\$ans\$xxxm\$nostick" in
1551 '')
1552 ans=!
1553 $myecho
1554 ;;
1555 esac
1556done
1557case "\$ans" in
1558'') ans="\$xxxm";;
1559esac
1560EOSC
1561
1562: create .config dir to save info across Configure sessions
1563test -d ../.config || mkdir ../.config
1564cat >../.config/README <<EOF
1565This directory created by Configure to save information that should
dfe9444c 1566persist across sessions for $package.
2304df62
AD
1567
1568You may safely delete it if you wish.
1569EOF
1570
1571: general instructions
1572needman=true
1573firsttime=true
760ac839 1574user=`(logname) 2>/dev/null`
dfe9444c
AD
1575case "$user" in
1576'') user=`whoami 2>&1`;;
760ac839 1577esac
2304df62
AD
1578if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1579 firsttime=false
1580 echo " "
1581 rp='Would you like to see the instructions?'
1582 dflt=n
1583 . ./myread
1584 case "$ans" in
1585 [yY]*) ;;
1586 *) needman=false;;
1587 esac
1588fi
1589if $needman; then
1590 cat <<EOH
4e2a5f63 1591
2304df62 1592This installation shell script will examine your system and ask you questions
a0d0e21e 1593to determine how the perl5 package should be installed. If you get
2304df62
AD
1594stuck on a question, you may use a ! shell escape to start a subshell or
1595execute a command. Many of the questions will have default answers in square
1596brackets; typing carriage return will give you the default.
1597
1598On some of the questions which ask for file or directory names you are allowed
1599to use the ~name construct to specify the login directory belonging to "name",
1600even if you don't have a shell which knows about that. Questions where this is
1601allowed will be marked "(~name ok)".
1602
1603EOH
1604 rp=''
1605 dflt='Type carriage return to continue'
1606 . ./myread
1607 cat <<'EOH'
1608
1609The prompter used in this script allows you to use shell variables and
1610backticks in your answers. You may use $1, $2, etc... to refer to the words
1611in the default answer, as if the default line was a set of arguments given to a
1612script shell. This means you may also use $* to repeat the whole default line,
1613so you do not have to re-type everything to add something to the default.
1614
1615Everytime there is a substitution, you will have to confirm. If there is an
1616error (e.g. an unmatched backtick), the default answer will remain unchanged
1617and you will be prompted again.
1618
1619If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
1620the questions and use the computed defaults (or the previous answers if there
1621was already a config.sh file). Type 'Configure -h' for a list of options.
ecfc5424 1622You may also start interactively and then answer '& -d' at any prompt to turn
dfe9444c 1623on the non-interactive behaviour for the remainder of the execution.
2304df62
AD
1624
1625EOH
1626 . ./myread
1627 cat <<EOH
1628
1629Much effort has been expended to ensure that this shell script will run on any
1630Unix system. If despite that it blows up on yours, your best bet is to edit
40000a8c
AD
1631Configure and run it again. If you can't run Configure for some reason,
1632you'll have to generate a config.sh file by hand. Whatever problems you
5ff3f7a4 1633have, let me (jhi@iki.fi) know how I blew it.
2304df62
AD
1634
1635This installation script affects things in two ways:
1636
16371) it may do direct variable substitutions on some of the files included
1638 in this kit.
16392) it builds a config.h file for inclusion in C programs. You may edit
1640 any of these files as the need arises after running this script.
1641
1642If you make a mistake on a question, there is no easy way to back up to it
1643currently. The easiest thing to do is to edit config.sh and rerun all the SH
1644files. Configure will offer to let you do this before it runs the SH files.
1645
1646EOH
1647 dflt='Type carriage return to continue'
1648 . ./myread
1649 case "$firsttime" in
1650 true) echo $user >>../.config/instruct;;
1651 esac
1652fi
1653
2304df62
AD
1654: find out where common programs are
1655echo " "
1656echo "Locating common programs..." >&4
1657cat <<EOSC >loc
1658$startsh
1659case \$# in
16600) exit 1;;
1661esac
1662thing=\$1
1663shift
1664dflt=\$1
1665shift
1666for dir in \$*; do
1667 case "\$thing" in
1668 .)
1669 if test -d \$dir/\$thing; then
1670 echo \$dir
1671 exit 0
1672 fi
1673 ;;
1674 *)
a0d0e21e 1675 for thisthing in \$dir/\$thing; do
ecfc5424 1676 : just loop through to pick last item
a0d0e21e 1677 done
25f94b33 1678 if test -f \$thisthing; then
a0d0e21e 1679 echo \$thisthing
2304df62
AD
1680 exit 0
1681 elif test -f \$dir/\$thing.exe; then
c4f23d77
AD
1682 if test -n "$DJGPP"; then
1683 echo \$dir/\$thing.exe
1684 else
1685 : on Eunice apparently
1686 echo \$dir/\$thing
1687 fi
2304df62
AD
1688 exit 0
1689 fi
1690 ;;
1691 esac
1692done
1693echo \$dflt
1694exit 1
1695EOSC
1696chmod +x loc
1697$eunicefix loc
1698loclist="
1699awk
1700cat
ecfc5424 1701comm
2304df62
AD
1702cp
1703echo
1704expr
1705grep
a0d0e21e 1706ls
dfe9444c 1707make
2304df62 1708mkdir
2304df62
AD
1709rm
1710sed
1711sort
85e6fe83 1712touch
2304df62
AD
1713tr
1714uniq
1715"
1716trylist="
1717Mcc
dfe9444c 1718ar
2304df62
AD
1719byacc
1720cpp
1721csh
1722date
1723egrep
8ff267be 1724gzip
2c7991dc 1725less
8ff267be 1726ln
2c7991dc 1727more
693762b4 1728nm
2304df62 1729nroff
2c7991dc 1730pg
693762b4 1731tee
2304df62
AD
1732test
1733uname
8ff267be 1734zip
2304df62 1735"
8e07c86e 1736pth=`echo $PATH | sed -e "s/$p_/ /g"`
2304df62
AD
1737pth="$pth /lib /usr/lib"
1738for file in $loclist; do
dfe9444c
AD
1739 eval xxx=\$$file
1740 case "$xxx" in
1741 /*|?:[\\/]*)
1742 if test -f "$xxx"; then
1743 : ok
1744 else
1745 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1746 xxx=`./loc $file $file $pth`
1747 fi
1748 ;;
1749 '') xxx=`./loc $file $file $pth`;;
1750 *) xxx=`./loc $xxx $xxx $pth`;;
1751 esac
2304df62
AD
1752 eval $file=$xxx
1753 eval _$file=$xxx
1754 case "$xxx" in
1755 /*)
1756 echo $file is in $xxx.
1757 ;;
8e07c86e
AD
1758 ?:[\\/]*)
1759 echo $file is in $xxx.
1760 ;;
2304df62 1761 *)
25f94b33
AD
1762 echo "I don't know where '$file' is, and my life depends on it." >&4
1763 echo "Go find a public domain implementation or fix your PATH setting!" >&4
4633a7c4 1764 exit 1
2304df62
AD
1765 ;;
1766 esac
1767done
1768echo " "
1769echo "Don't worry if any of the following aren't found..."
1770say=offhand
1771for file in $trylist; do
dfe9444c
AD
1772 eval xxx=\$$file
1773 case "$xxx" in
1774 /*|?:[\\/]*)
1775 if test -f "$xxx"; then
1776 : ok
1777 else
1778 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1779 xxx=`./loc $file $file $pth`
1780 fi
1781 ;;
1782 '') xxx=`./loc $file $file $pth`;;
1783 *) xxx=`./loc $xxx $xxx $pth`;;
1784 esac
2304df62
AD
1785 eval $file=$xxx
1786 eval _$file=$xxx
1787 case "$xxx" in
1788 /*)
1789 echo $file is in $xxx.
1790 ;;
8e07c86e
AD
1791 ?:[\\/]*)
1792 echo $file is in $xxx.
1793 ;;
2304df62
AD
1794 *)
1795 echo "I don't see $file out there, $say."
1796 say=either
1797 ;;
1798 esac
1799done
1800case "$egrep" in
1801egrep)
1802 echo "Substituting grep for egrep."
1803 egrep=$grep
1804 ;;
1805esac
8ff267be 1806case "$ln" in
1807ln)
1808 echo "Substituting cp for ln."
1809 ln=$cp
1810 ;;
1811esac
2304df62
AD
1812case "$test" in
1813test)
1814 echo "Hopefully test is built into your sh."
1815 ;;
1816*)
ecfc5424 1817 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2304df62
AD
1818 echo "Using the test built into your sh."
1819 test=test
1820 _test=test
1821 fi
1822 ;;
1823esac
1824case "$echo" in
1825echo)
1826 echo "Hopefully echo is built into your sh."
1827 ;;
1828'') ;;
1829*)
1830 echo " "
1831echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
1832 $echo $n "hi there$c" >foo1
1833 echo $n "hi there$c" >foo2
1834 if cmp foo1 foo2 >/dev/null 2>&1; then
1835 echo "They are compatible. In fact, they may be identical."
1836 else
1837 case "$n" in
1838 '-n') n='' c='\c';;
1839 *) n='-n' c='';;
1840 esac
1841 cat <<FOO
1842They are not compatible! You are probably running ksh on a non-USG system.
1843I'll have to use $echo instead of the builtin, since Bourne shell doesn't
1844have echo built in and we may have to run some Bourne shell scripts. That
1845means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
1846
1847FOO
1848 $echo $n "The star should be here-->$c"
1849 $echo "*"
1850 fi
1851 $rm -f foo1 foo2
1852 ;;
1853esac
1854
a0d0e21e
LW
1855: determine whether symbolic links are supported
1856echo " "
1857$touch blurfl
1858if $ln -s blurfl sym > /dev/null 2>&1 ; then
1859 echo "Symbolic links are supported." >&4
1860 lns="$ln -s"
1861else
1862 echo "Symbolic links are NOT supported." >&4
1863 lns="$ln"
1864fi
1865$rm -f blurfl sym
1866
ecfc5424
AD
1867: see whether [:lower:] and [:upper:] are supported character classes
1868echo " "
ecfc5424
AD
1869case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1870ABYZ)
1871 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
1872 up='[:upper:]'
1873 low='[:lower:]'
1874 ;;
28e8609d
JH
1875*) # There is a discontinuity in EBCDIC between 'I' and 'J'
1876 # (0xc9 and 0xd1), therefore that is a nice testing point.
1877 if test "X$up" = X -o "X$low" = X; then
3eaeeeae 1878 case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
28e8609d
JH
1879 ij) up='[A-Z]'
1880 low='[a-z]'
1881 ;;
1882 esac
1883 fi
1884 if test "X$up" = X -o "X$low" = X; then
3eaeeeae 1885 case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
28e8609d
JH
1886 ij) up='A-Z'
1887 low='a-z'
1888 ;;
1889 esac
1890 fi
1891 if test "X$up" = X -o "X$low" = X; then
1892 case "`echo IJ | od -x 2>/dev/null`" in
1893 *C9D1*|*c9d1*)
1894 echo "Hey, this might be EBCDIC." >&4
1895 if test "X$up" = X -o "X$low" = X; then
5ff3f7a4 1896 case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
28e8609d
JH
1897 ij) up='[A-IJ-RS-Z]'
1898 low='[a-ij-rs-z]'
1899 ;;
1900 esac
1901 fi
1902 if test "X$up" = X -o "X$low" = X; then
5ff3f7a4 1903 case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
28e8609d
JH
1904 ij) up='A-IJ-RS-Z'
1905 low='a-ij-rs-z'
1906 ;;
1907 esac
1908 fi
1909 ;;
1910 esac
1911 fi
1912esac
3eaeeeae 1913case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
28e8609d
JH
1914ij)
1915 echo "Using $up and $low to convert case." >&4
1916 ;;
ecfc5424 1917*)
28e8609d
JH
1918 echo "I don't know how to translate letters from upper to lower case." >&4
1919 echo "Your tr is not acting any way I know of." >&4
1920 exit 1
1921 ;;
ecfc5424
AD
1922esac
1923: set up the translation script tr, must be called with ./tr of course
1924cat >tr <<EOSC
1925$startsh
1926case "\$1\$2" in
1927'[A-Z][a-z]') exec $tr '$up' '$low';;
1928'[a-z][A-Z]') exec $tr '$low' '$up';;
1929esac
1930exec $tr "\$@"
1931EOSC
1932chmod +x tr
1933$eunicefix tr
1934
2304df62
AD
1935: Try to determine whether config.sh was made on this system
1936case "$config_sh" in
1937'')
1938myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
28e8609d
JH
1939# tr '[A-Z]' '[a-z]' would not work in EBCDIC
1940# because the A-Z/a-z are not consecutive.
a0d0e21e 1941myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
3eaeeeae 1942 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
1aef975c 1943newmyuname="$myuname"
2304df62 1944dflt=n
16d20bd9
AD
1945case "$knowitall" in
1946'')
1947 if test -f ../config.sh; then
1948 if $contains myuname= ../config.sh >/dev/null 2>&1; then
1949 eval "`grep myuname= ../config.sh`"
1950 fi
1951 if test "X$myuname" = "X$newmyuname"; then
1952 dflt=y
1953 fi
2304df62 1954 fi
16d20bd9
AD
1955 ;;
1956*) dflt=y;;
1957esac
2304df62
AD
1958
1959: Get old answers from old config file if Configure was run on the
1960: same system, otherwise use the hints.
1961hint=default
1962cd ..
1963if test -f config.sh; then
16d20bd9
AD
1964 echo " "
1965 rp="I see a config.sh file. Shall I use it to set the defaults?"
2304df62
AD
1966 . UU/myread
1967 case "$ans" in
1968 n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
1969 *) echo "Fetching default answers from your old config.sh file..." >&4
ecfc5424
AD
1970 tmp_n="$n"
1971 tmp_c="$c"
85cad39c 1972 tmp_sh="$sh"
2304df62
AD
1973 . ./config.sh
1974 cp config.sh UU
ecfc5424
AD
1975 n="$tmp_n"
1976 c="$tmp_c"
85cad39c 1977 : Older versions did not always set $sh. Catch re-use of such
1978 : an old config.sh.
1979 case "$sh" in
1980 '') sh="$tmp_sh" ;;
1981 esac
2304df62
AD
1982 hint=previous
1983 ;;
1984 esac
1985fi
1986if test ! -f config.sh; then
1987 $cat <<EOM
1988
4e2a5f63
AD
1989First time through, eh? I have some defaults handy for some systems
1990that need some extra help getting the Configure answers right:
2304df62
AD
1991
1992EOM
dfe9444c 1993 (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
2304df62
AD
1994 dflt=''
1995 : Half the following guesses are probably wrong... If you have better
5ff3f7a4 1996 : tests or hints, please send them to jhi@iki.fi
2304df62 1997 : The metaconfig authors would also appreciate a copy...
a0d0e21e 1998 $test -f /irix && osname=irix
85e6fe83
LW
1999 $test -f /xenix && osname=sco_xenix
2000 $test -f /dynix && osname=dynix
2001 $test -f /dnix && osname=dnix
5f05dabc 2002 $test -f /lynx.os && osname=lynxos
2003 $test -f /unicos && osname=unicos && osvers=`$uname -r`
7a4c00b4 2004 $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
85e6fe83 2005 $test -f /bin/mips && /bin/mips && osname=mips
ecfc5424
AD
2006 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2007 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
a0d0e21e
LW
2008 $test -d /usr/apollo/bin && osname=apollo
2009 $test -f /etc/saf/_sactab && osname=svr4
85e6fe83 2010 $test -d /usr/include/minix && osname=minix
e060872b 2011 if $test -d /MachTen -o -d /MachTen_Folder; then
dfe9444c 2012 osname=machten
4633a7c4 2013 if $test -x /sbin/version; then
dfe9444c 2014 osvers=`/sbin/version | $awk '{print $2}' |
4633a7c4
LW
2015 $sed -e 's/[A-Za-z]$//'`
2016 elif $test -x /usr/etc/version; then
dfe9444c 2017 osvers=`/usr/etc/version | $awk '{print $2}' |
4633a7c4
LW
2018 $sed -e 's/[A-Za-z]$//'`
2019 else
2020 osvers="$2.$3"
2021 fi
2022 fi
85ab1d1d
JH
2023 $test -f /sys/posix.dll &&
2024 $test -f /usr/bin/what &&
2025 set X `/usr/bin/what /sys/posix.dll` &&
2026 $test "$3" = UWIN &&
2027 osname=uwin &&
2028 osvers="$5"
2304df62
AD
2029 if $test -f $uname; then
2030 set X $myuname
2031 shift
2032
2304df62 2033 case "$5" in
85e6fe83 2034 fps*) osname=fps ;;
2304df62
AD
2035 mips*)
2036 case "$4" in
85e6fe83
LW
2037 umips) osname=umips ;;
2038 *) osname=mips ;;
2304df62 2039 esac;;
85e6fe83
LW
2040 [23]100) osname=mips ;;
2041 next*) osname=next ;;
ecfc5424
AD
2042 i386*)
2043 if $test -f /etc/kconfig; then
2044 osname=isc
a0d0e21e
LW
2045 if test "$lns" = "ln -s"; then
2046 osvers=4
2047 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2048 osvers=3
2304df62 2049 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
a0d0e21e 2050 osvers=2
ecfc5424
AD
2051 fi
2052 fi
2053 ;;
c4f23d77
AD
2054 pc*)
2055 if test -n "$DJGPP"; then
2056 osname=dos
2057 osvers=djgpp
2058 fi
2059 ;;
2304df62
AD
2060 esac
2061
2062 case "$1" in
a0d0e21e
LW
2063 aix) osname=aix
2064 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2065 case "$tmp" in
1aef975c 2066 'not found') osvers="$4"."$3" ;;
a0d0e21e
LW
2067 '<3240'|'<>3240') osvers=3.2.0 ;;
2068 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2069 '=3250'|'>3250') osvers=3.2.5 ;;
1aef975c 2070 *) osvers=$tmp;;
a0d0e21e
LW
2071 esac
2072 ;;
23f87696
SZ
2073 *dc.osx) osname=dcosx
2074 osvers="$3"
2075 ;;
a0d0e21e
LW
2076 dnix) osname=dnix
2077 osvers="$3"
2078 ;;
2079 domainos) osname=apollo
2080 osvers="$3"
2081 ;;
2082 dgux) osname=dgux
2083 osvers="$3"
2084 ;;
760ac839 2085 dynixptx*) osname=dynixptx
e58e581d 2086 osvers=`echo "$4"|sed 's/^v//'`
760ac839 2087 ;;
a0d0e21e
LW
2088 freebsd) osname=freebsd
2089 osvers="$3" ;;
2090 genix) osname=genix ;;
2091 hp*) osname=hpux
bfb7748a 2092 osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
a0d0e21e 2093 ;;
a78b0d02 2094 irix*) osname=irix
a0d0e21e
LW
2095 case "$3" in
2096 4*) osvers=4 ;;
2097 5*) osvers=5 ;;
ecfc5424 2098 *) osvers="$3" ;;
a0d0e21e
LW
2099 esac
2100 ;;
2101 linux) osname=linux
2102 case "$3" in
a0d0e21e
LW
2103 *) osvers="$3" ;;
2104 esac
2105 ;;
28e8609d
JH
2106 MiNT) osname=mint
2107 ;;
2108 netbsd*) osname=netbsd
ecfc5424
AD
2109 osvers="$3"
2110 ;;
4e81affe
MM
2111 news-os) osvers="$3"
2112 case "$3" in
2113 4*) osname=newsos4 ;;
2114 *) osname=newsos ;;
2115 esac
2116 ;;
a0d0e21e
LW
2117 bsd386) osname=bsd386
2118 osvers=`$uname -r`
2119 ;;
a1a0e61e
TD
2120 POSIX-BC | posix-bc ) osname=posix-bc
2121 osvers="$3"
2122 ;;
ae3afa4e
TH
2123 powerux | power_ux | powermax_os | powermaxos | \
2124 powerunix | power_unix) osname=powerux
2125 osvers="$3"
2126 ;;
a0d0e21e
LW
2127 next*) osname=next ;;
2128 solaris) osname=solaris
2129 case "$3" in
2130 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
ecfc5424 2131 *) osvers="$3" ;;
a0d0e21e
LW
2132 esac
2133 ;;
85e6fe83
LW
2134 sunos) osname=sunos
2135 case "$3" in
85e6fe83
LW
2136 5*) osname=solaris
2137 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
a0d0e21e 2138 *) osvers="$3" ;;
2304df62
AD
2139 esac
2140 ;;
a0d0e21e 2141 titanos) osname=titanos
85e6fe83 2142 case "$3" in
a0d0e21e
LW
2143 1*) osvers=1 ;;
2144 2*) osvers=2 ;;
2145 3*) osvers=3 ;;
2146 4*) osvers=4 ;;
ecfc5424 2147 *) osvers="$3" ;;
2304df62
AD
2148 esac
2149 ;;
85e6fe83 2150 ultrix) osname=ultrix
ecfc5424 2151 osvers="$3"
2304df62 2152 ;;
28757baa 2153 osf1|mls+) case "$5" in
fed7345c
AD
2154 alpha)
2155 osname=dec_osf
313489a2 2156 osvers=`echo "$3" | sed 's/^[xvt]//'`
ecfc5424
AD
2157 ;;
2158 hp*) osname=hp_osf1 ;;
2159 mips) osname=mips_osf1 ;;
85e6fe83
LW
2160 esac
2161 ;;
a0d0e21e
LW
2162 uts) osname=uts
2163 osvers="$3"
2164 ;;
ff68c719 2165 qnx) osname=qnx
2166 osvers="$4"
2167 ;;
85e6fe83 2168 $2) case "$osname" in
2304df62 2169 *isc*) ;;
a0d0e21e 2170 *freebsd*) ;;
5f05dabc 2171 svr*)
a0d0e21e
LW
2172 : svr4.x or possibly later
2173 case "svr$3" in
2174 ${osname}*)
2175 osname=svr$3
2176 osvers=$4
2177 ;;
2178 esac
2179 case "$osname" in
2180 svr4.0)
2181 : Check for ESIX
2182 if test -f /stand/boot ; then
2183 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
ecfc5424
AD
2184 if test -n "$INITPROG" -a -f "$INITPROG"; then
2185 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2186 if test -n "$isesix"; then
a0d0e21e
LW
2187 osname=esix4
2188 fi
2189 fi
2190 fi
2191 ;;
2192 esac
2193 ;;
2304df62 2194 *) if test -f /etc/systemid; then
a0d0e21e
LW
2195 osname=sco
2196 set `echo $3 | $sed 's/\./ /g'` $4
c4f23d77 2197 if $test -f $src/hints/sco_$1_$2_$3.sh; then
85e6fe83 2198 osvers=$1.$2.$3
c4f23d77 2199 elif $test -f $src/hints/sco_$1_$2.sh; then
85e6fe83 2200 osvers=$1.$2
c4f23d77 2201 elif $test -f $src/hints/sco_$1.sh; then
85e6fe83 2202 osvers=$1
2304df62 2203 fi
a0d0e21e
LW
2204 else
2205 case "$osname" in
2206 '') : Still unknown. Probably a generic Sys V.
2207 osname="sysv"
2208 osvers="$3"
2209 ;;
2210 esac
2304df62
AD
2211 fi
2212 ;;
2213 esac
2214 ;;
a0d0e21e
LW
2215 *) case "$osname" in
2216 '') : Still unknown. Probably a generic BSD.
2217 osname="$1"
2218 osvers="$3"
2219 ;;
2220 esac
2221 ;;
2304df62
AD
2222 esac
2223 else
dfe9444c
AD
2224 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2225 (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2226 if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2227 osname=news_os
2304df62 2228 fi
dfe9444c 2229 $rm -f UU/kernel.what
8e07c86e
AD
2230 elif test -d c:/.; then
2231 set X $myuname
2232 osname=os2
2233 osvers="$5"
2304df62
AD
2234 fi
2235 fi
85e6fe83 2236
a0d0e21e
LW
2237 : Now look for a hint file osname_osvers, unless one has been
2238 : specified already.
2239 case "$hintfile" in
2240 ''|' ')
ecfc5424 2241 file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'`
a0d0e21e 2242 : Also try without trailing minor version numbers.
ecfc5424
AD
2243 xfile=`echo $file | $sed -e 's@_[^_]*$@@'`
2244 xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'`
2245 xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'`
2246 xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'`
a0d0e21e
LW
2247 case "$file" in
2248 '') dflt=none ;;
2249 *) case "$osvers" in
2250 '') dflt=$file
2251 ;;
dfe9444c 2252 *) if $test -f $src/hints/$file.sh ; then
a0d0e21e 2253 dflt=$file
dfe9444c 2254 elif $test -f $src/hints/$xfile.sh ; then
a0d0e21e 2255 dflt=$xfile
dfe9444c 2256 elif $test -f $src/hints/$xxfile.sh ; then
a0d0e21e 2257 dflt=$xxfile
dfe9444c 2258 elif $test -f $src/hints/$xxxfile.sh ; then
a0d0e21e 2259 dflt=$xxxfile
dfe9444c 2260 elif $test -f $src/hints/$xxxxfile.sh ; then
a0d0e21e 2261 dflt=$xxxxfile
dfe9444c 2262 elif $test -f "$src/hints/${osname}.sh" ; then
a0d0e21e
LW
2263 dflt="${osname}"
2264 else
2265 dflt=none
2266 fi
2267 ;;
2268 esac
85e6fe83
LW
2269 ;;
2270 esac
4e2a5f63
AD
2271 if $test -f Policy.sh ; then
2272 case "$dflt" in
2273 *Policy*) ;;
2274 none) dflt="Policy" ;;
2275 *) dflt="Policy $dflt" ;;
2276 esac
2277 fi
85e6fe83 2278 ;;
a0d0e21e 2279 *)
ecfc5424 2280 dflt=`echo $hintfile | $sed 's/\.sh$//'`
a0d0e21e 2281 ;;
2304df62 2282 esac
1aef975c 2283
4e2a5f63
AD
2284 if $test -f Policy.sh ; then
2285 $cat <<EOM
2286
2287There's also a Policy hint file available, which should make the
2288site-specific (policy) questions easier to answer.
2289EOM
2290
2291 fi
2292
2304df62
AD
2293 $cat <<EOM
2294
2295You may give one or more space-separated answers, or "none" if appropriate.
4e2a5f63
AD
2296A well-behaved OS will have no hints, so answering "none" or just "Policy"
2297is a good thing. DO NOT give a wrong version.
2304df62
AD
2298
2299EOM
4e2a5f63 2300
2304df62 2301 rp="Which of these apply, if any?"
dfe9444c 2302 . UU/myread
85e6fe83
LW
2303 tans=$ans
2304 for file in $tans; do
4e2a5f63
AD
2305 if $test X$file = XPolicy -a -f Policy.sh; then
2306 . Policy.sh
2307 $cat Policy.sh >> UU/config.sh
2308 elif $test -f $src/hints/$file.sh; then
dfe9444c
AD
2309 . $src/hints/$file.sh
2310 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83 2311 elif $test X$tans = X -o X$tans = Xnone ; then
2304df62
AD
2312 : nothing
2313 else
85e6fe83
LW
2314 : Give one chance to correct a possible typo.
2315 echo "$file.sh does not exist"
2316 dflt=$file
2317 rp="hint to use instead?"
dfe9444c 2318 . UU/myread
85e6fe83 2319 for file in $ans; do
dfe9444c
AD
2320 if $test -f "$src/hints/$file.sh"; then
2321 . $src/hints/$file.sh
2322 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83
LW
2323 elif $test X$ans = X -o X$ans = Xnone ; then
2324 : nothing
2325 else
2326 echo "$file.sh does not exist -- ignored."
2327 fi
2328 done
2304df62
AD
2329 fi
2330 done
85e6fe83 2331
2304df62 2332 hint=recommended
85e6fe83 2333 : Remember our hint file for later.
dfe9444c 2334 if $test -f "$src/hints/$file.sh" ; then
a0d0e21e 2335 hintfile="$file"
85e6fe83 2336 else
a0d0e21e 2337 hintfile=''
85e6fe83 2338 fi
2304df62
AD
2339fi
2340cd UU
2341;;
2342*)
2343 echo " "
2344 echo "Fetching default answers from $config_sh..." >&4
ecfc5424
AD
2345 tmp_n="$n"
2346 tmp_c="$c"
2304df62
AD
2347 cd ..
2348 cp $config_sh config.sh 2>/dev/null
a78b0d02 2349 chmod +w config.sh
2304df62
AD
2350 . ./config.sh
2351 cd UU
2352 cp ../config.sh .
ecfc5424
AD
2353 n="$tmp_n"
2354 c="$tmp_c"
2304df62
AD
2355 hint=previous
2356 ;;
2357esac
1aef975c
AD
2358test "$override" && . ./optdef.sh
2359myuname="$newmyuname"
2304df62
AD
2360
2361: Restore computed paths
2362for file in $loclist $trylist; do
2363 eval $file="\$_$file"
2364done
2365
85e6fe83 2366cat << EOM
a0d0e21e 2367
85e6fe83 2368Configure uses the operating system name and version to set some defaults.
ecfc5424
AD
2369The default value is probably right if the name rings a bell. Otherwise,
2370since spelling matters for me, either accept the default or answer "none"
2371to leave it blank.
a0d0e21e 2372
85e6fe83 2373EOM
85e6fe83 2374case "$osname" in
a0d0e21e 2375 ''|' ')
85e6fe83 2376 case "$hintfile" in
a0d0e21e 2377 ''|' '|none) dflt=none ;;
ecfc5424 2378 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
85e6fe83
LW
2379 esac
2380 ;;
2381 *) dflt="$osname" ;;
2382esac
2383rp="Operating system name?"
2384. ./myread
2385case "$ans" in
ecfc5424
AD
2386none) osname='' ;;
2387*) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
85e6fe83 2388esac
8ff267be 2389echo " "
2390case "$osvers" in
2391 ''|' ')
2392 case "$hintfile" in
2393 ''|' '|none) dflt=none ;;
2394 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2395 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2396 case "$dflt" in
2397 ''|' ') dflt=none ;;
2398 esac
2399 ;;
2400 esac
2401 ;;
2402 *) dflt="$osvers" ;;
2403esac
2404rp="Operating system version?"
2405. ./myread
2406case "$ans" in
2407none) osvers='' ;;
2408*) osvers="$ans" ;;
2409esac
2410
2304df62 2411: who configured the system
7792a3d7 2412cf_time=`LC_ALL=C; export LC_ALL; $date 2>&1`
8ff267be 2413cf_by=`(logname) 2>/dev/null`
dfe9444c
AD
2414case "$cf_by" in
2415"")
8ff267be 2416 cf_by=`(whoami) 2>/dev/null`
dfe9444c
AD
2417 case "$cf_by" in
2418 "") cf_by=unknown ;;
8ff267be 2419 esac ;;
2420esac
2304df62 2421
dfe9444c
AD
2422: set up the script used to warn in case of inconsistency
2423cat <<EOS >whoa
2424$startsh
2425EOS
2426cat <<'EOSC' >>whoa
2427dflt=y
2428echo " "
2429echo "*** WHOA THERE!!! ***" >&4
2430echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
2431rp=" Keep the $hint value?"
2432. ./myread
2433case "$ans" in
2434y) td=$was; tu=$was;;
2435esac
2436EOSC
2437
2438: function used to set $1 to $val
2439setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2440case "$val$was" in
2441$define$undef) . ./whoa; eval "$var=\$td";;
2442$undef$define) . ./whoa; eval "$var=\$tu";;
2443*) eval "$var=$val";;
2444esac'
2445
2446cat <<EOM
2447
2448Perl can be built to take advantage of threads, on some systems.
2449To do so, Configure must be run with -Dusethreads.
2450(See README.threads for details.)
2451EOM
2452case "$usethreads" in
2453$define|true|[yY]*) dflt='y';;
2454*) dflt='n';;
2455esac
2456rp='Build a threading Perl?'
2457. ./myread
2458case "$ans" in
2459y|Y) val="$define" ;;
2460*) val="$undef" ;;
2461esac
2462set usethreads
2463eval $setvar
693762b4 2464: Look for a hint-file generated 'call-back-unit'. Now that the
dc45a647
MB
2465: user has specified if a threading perl is to be built, we may need
2466: to set or change some other defaults.
693762b4
AD
2467if $test -f usethreads.cbu; then
2468 . ./usethreads.cbu
2469fi
2470case "$d_oldpthreads" in
2471'') : Configure tests would be welcome here. For now, assume undef.
2472 val="$undef" ;;
2473*) val="$d_oldpthreads" ;;
2474esac
2475set d_oldpthreads
2476eval $setvar
dfe9444c 2477
85ab1d1d
JH
2478cat <<EOM
2479
2480Perl can be built so that multiple Perl interpreters can coexist
2481within the same Perl executable. To do so, Configure must be run with
2482-Dusemultiplicity.
2483
2484Normally you do not need this and you should answer no.
2485
2486EOM
2487case "$usemultiplicity" in
2488$define|true|[yY]*) dflt='y';;
2489*) dflt='n';;
2490esac
2491rp='Build Perl for multiplicity?'
2492. ./myread
2493case "$ans" in
2494y|Y) val="$define" ;;
2495*) val="$undef" ;;
2496esac
2497set usemultiplicity
2498eval $setvar
2499
2500cat <<EOM
2501
2502Perl can be built to take advantage of explicit 64-bit interfaces,
2503on some systems. To do so, Configure must be run with -Duse64bits.
2504
2505If this doesn't make any sense to you, just accept the default 'n'.
2506EOM
2507case "$use64bits" in
2508$define|true|[yY]*) dflt='y';;
2509*) dflt='n';;
2510esac
2511rp='Try to use explicit 64-bit interfaces, if available?'
2512. ./myread
2513case "$ans" in
2514y|Y)
2515 val="$define"
2516 ;;
2517*)
2518 val="$undef"
2519 ;;
2520esac
2521set use64bits
2522eval $setvar
2523
2524archname64=''
2525
4633a7c4 2526: determine the architecture name
2304df62 2527echo " "
4633a7c4
LW
2528if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
2529 tarch=`arch`"-$osname"
2530elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
2531 if uname -m > tmparch 2>&1 ; then
7e1af8bc 2532 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5f05dabc 2533 -e 's/$/'"-$osname/" tmparch`
4633a7c4
LW
2534 else
2535 tarch="$osname"
2536 fi
2537 $rm -f tmparch
2538else
2539 tarch="$osname"
2540fi
2541case "$myarchname" in
2542''|"$tarch") ;;
2543*)
2544 echo "(Your architecture name used to be $myarchname.)"
2545 archname=''
2304df62
AD
2546 ;;
2547esac
85ab1d1d 2548myarchname="$tarch"
4633a7c4
LW
2549case "$archname" in
2550'') dflt="$tarch";;
2551*) dflt="$archname";;
2552esac
2553rp='What is your architecture name'
2554. ./myread
85ab1d1d 2555archname="$ans"
dc66995c 2556case "$usethreads" in
85ab1d1d
JH
2557$define)
2558 echo "Threads selected." >&4
2559 case "$archname" in
2560 *-thread*) echo "...and architecture name already has -thread." >&4
2561 ;;
2562 *) archname="$archname-thread"
2563 echo "...setting architecture name to $archname." >&4
2564 ;;
2565 esac
2566 ;;
dc66995c 2567esac
85ab1d1d
JH
2568case "$usemultiplicity" in
2569$define)
2570 echo "Multiplicity selected." >&4
2571 case "$archname" in
2572 *-multi*) echo "...and architecture name already has -multi." >&4
2573 ;;
2574 *) archname="$archname-multi"
2575 echo "...setting architecture name to $archname." >&4
2576 ;;
2577 esac
2578 ;;
2579esac
2580case "$use64bits" in
2581$define)
2582 echo "Explicit 64-bitness selected." >&4
2583 case "$archname64" in
2584 '')
2585 ;;
2586 *)
2587 case "$archname" in
2588 *-$archname64*) echo "...and architecture name already has $archname64." >&4
2589 ;;
2590 *) archname="$archname-$archname64"
2591 echo "...setting architecture name to $archname." >&4
2592 ;;
2593 esac
2594 ;;
2595 esac
2596esac
2597
4633a7c4
LW
2598: is AFS running?
2599echo " "
2afac517 2600case "$afs" in
2601$define|true) afs=true ;;
2602$undef|false) afs=false ;;
2603*) if test -d /afs; then
2604 afs=true
2605 else
2606 afs=false
2607 fi
2608 ;;
2609esac
2610if $afs; then
4633a7c4 2611 echo "AFS may be running... I'll be extra cautious then..." >&4
2304df62 2612else
4633a7c4 2613 echo "AFS does not seem to be running..." >&4
2304df62
AD
2614fi
2615
4633a7c4
LW
2616: decide how portable to be. Allow command line overrides.
2617case "$d_portable" in
2618"$undef") ;;
2619*) d_portable="$define" ;;
2304df62 2620esac
2304df62 2621
4633a7c4
LW
2622: set up shell script to do ~ expansion
2623cat >filexp <<EOSS
2624$startsh
2625: expand filename
2626case "\$1" in
2627 ~/*|~)
2628 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
2304df62 2629 ;;
4633a7c4
LW
2630 ~*)
2631 if $test -f /bin/csh; then
2632 /bin/csh -f -c "glob \$1"
2633 failed=\$?
2634 echo ""
2635 exit \$failed
2636 else
2637 name=\`$expr x\$1 : '..\([^/]*\)'\`
2638 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
2639 if $test ! -d "\$dir"; then
2640 me=\`basename \$0\`
2641 echo "\$me: can't locate home directory for: \$name" >&2
2642 exit 1
2643 fi
2644 case "\$1" in
2645 */*)
2646 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
2647 ;;
2648 *)
2649 echo \$dir
2650 ;;
2304df62 2651 esac
4633a7c4 2652 fi
2304df62
AD
2653 ;;
2654*)
4633a7c4 2655 echo \$1
2304df62
AD
2656 ;;
2657esac
4633a7c4
LW
2658EOSS
2659chmod +x filexp
2660$eunicefix filexp
2304df62
AD
2661
2662: now set up to get a file name
28757baa 2663cat <<EOS >getfile
2664$startsh
2665EOS
2666cat <<'EOSC' >>getfile
2304df62
AD
2667tilde=''
2668fullpath=''
2669already=''
2670skip=''
2671none_ok=''
2672exp_file=''
a0d0e21e 2673nopath_ok=''
2304df62
AD
2674orig_rp="$rp"
2675orig_dflt="$dflt"
2676
2677case "$fn" in
ecfc5424 2678*\(*)
28e8609d 2679 expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
ecfc5424
AD
2680 fn=`echo $fn | sed 's/(.*)//'`
2681 ;;
2682esac
2683
2684case "$fn" in
a0d0e21e
LW
2685*:*)
2686 loc_file=`expr $fn : '.*:\(.*\)'`
2687 fn=`expr $fn : '\(.*\):.*'`
2688 ;;
2689esac
2690
2691case "$fn" in
2304df62
AD
2692*~*) tilde=true;;
2693esac
2694case "$fn" in
2695*/*) fullpath=true;;
2696esac
2697case "$fn" in
2698*+*) skip=true;;
2699esac
2700case "$fn" in
2701*n*) none_ok=true;;
2702esac
2703case "$fn" in
2704*e*) exp_file=true;;
2705esac
a0d0e21e
LW
2706case "$fn" in
2707*p*) nopath_ok=true;;
2708esac
2304df62
AD
2709
2710case "$fn" in
2711*f*) type='File';;
2712*d*) type='Directory';;
a0d0e21e 2713*l*) type='Locate';;
2304df62
AD
2714esac
2715
2716what="$type"
2717case "$what" in
2718Locate) what='File';;
2719esac
2720
2721case "$exp_file" in
2722'')
2723 case "$d_portable" in
2724 "$define") ;;
2725 *) exp_file=true;;
2726 esac
2727 ;;
2728esac
2729
2730cd ..
2731while test "$type"; do
2732 redo=''
2733 rp="$orig_rp"
2734 dflt="$orig_dflt"
2735 case "$tilde" in
2736 true) rp="$rp (~name ok)";;
2737 esac
2738 . UU/myread
ecfc5424
AD
2739 if test -f UU/getfile.ok && \
2740 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
2741 then
2742 value="$ans"
2743 ansexp="$ans"
2744 break
2745 fi
2304df62
AD
2746 case "$ans" in
2747 none)
2748 value=''
2749 ansexp=''
2750 case "$none_ok" in
2751 true) type='';;
2752 esac
2753 ;;
2754 *)
2755 case "$tilde" in
2756 '') value="$ans"
2757 ansexp="$ans";;
2758 *)
2759 value=`UU/filexp $ans`
2760 case $? in
2761 0)
2762 if test "$ans" != "$value"; then
ecfc5424 2763 echo "(That expands to $value on this system.)"
2304df62
AD
2764 fi
2765 ;;
2766 *) value="$ans";;
2767 esac
2768 ansexp="$value"
2769 case "$exp_file" in
2770 '') value="$ans";;
2771 esac
2772 ;;
2773 esac
2774 case "$fullpath" in
2775 true)
2776 case "$ansexp" in
2777 /*) value="$ansexp" ;;
2778 *)
2779 redo=true
2780 case "$already" in
2781 true)
2782 echo "I shall only accept a full path name, as in /bin/ls." >&4
2783 echo "Use a ! shell escape if you wish to check pathnames." >&4
2784 ;;
2785 *)
2786 echo "Please give a full path name, starting with slash." >&4
2787 case "$tilde" in
2788 true)
2789 echo "Note that using ~name is ok provided it expands well." >&4
2790 already=true
2791 ;;
2792 esac
2793 esac
2794 ;;
2795 esac
2796 ;;
2797 esac
2798 case "$redo" in
2799 '')
2800 case "$type" in
2801 File)
2802 if test -f "$ansexp"; then
2803 type=''
2804 elif test -r "$ansexp" || (test -h "$ansexp") >/dev/null 2>&1
2805 then
2806 echo "($value is not a plain file, but that's ok.)"
2807 type=''
2808 fi
2809 ;;
2810 Directory)
2811 if test -d "$ansexp"; then
2812 type=''
2813 fi
2814 ;;
2815 Locate)
40000a8c 2816 if test -d "$ansexp"; then
a0d0e21e
LW
2817 echo "(Looking for $loc_file in directory $value.)"
2818 value="$value/$loc_file"
40000a8c 2819 ansexp="$ansexp/$loc_file"
2304df62 2820 fi
40000a8c 2821 if test -f "$ansexp"; then
2304df62
AD
2822 type=''
2823 fi
a0d0e21e
LW
2824 case "$nopath_ok" in
2825 true) case "$value" in
2826 */*) ;;
2827 *) echo "Assuming $value will be in people's path."
2828 type=''
2829 ;;
2830 esac
2831 ;;
2832 esac
2304df62
AD
2833 ;;
2834 esac
2835
2836 case "$skip" in
2837 true) type='';
2838 esac
2839
2840 case "$type" in
2841 '') ;;
2842 *)
2843 if test "$fastread" = yes; then
2844 dflt=y
2845 else
2846 dflt=n
2847 fi
2848 rp="$what $value doesn't exist. Use that name anyway?"
2849 . UU/myread
2850 dflt=''
2851 case "$ans" in
2852 y*) type='';;
2853 *) echo " ";;
2854 esac
2855 ;;
2856 esac
2857 ;;
2858 esac
2859 ;;
2860 esac
2861done
2862cd UU
2863ans="$value"
2864rp="$orig_rp"
2865dflt="$orig_dflt"
ecfc5424 2866rm -f getfile.ok
2304df62
AD
2867EOSC
2868
4633a7c4
LW
2869: determine root of directory hierarchy where package will be installed.
2870case "$prefix" in
2871'')
2872 dflt=`./loc . /usr/local /usr/local /local /opt /usr`
8e07c86e 2873 ;;
4633a7c4
LW
2874*)
2875 dflt="$prefix"
8e07c86e
AD
2876 ;;
2877esac
4633a7c4 2878$cat <<EOM
2304df62 2879
4633a7c4
LW
2880By default, $package will be installed in $dflt/bin, manual
2881pages under $dflt/man, etc..., i.e. with $dflt as prefix for
2882all installation directories. Typically set to /usr/local, but you
2883may choose /usr if you wish to install $package among your system
2884binaries. If you wish to have binaries under /bin but manual pages
2885under /usr/local/man, that's ok: you will be prompted separately
2886for each of the installation directories, the prefix being only used
2887to set the defaults.
8e07c86e
AD
2888
2889EOM
2890fn=d~
2891rp='Installation prefix to use?'
2892. ./getfile
2893oldprefix=''
2894case "$prefix" in
a0d0e21e 2895'') ;;
8e07c86e
AD
2896*)
2897 case "$ans" in
2898 "$prefix") ;;
2899 *) oldprefix="$prefix";;
2900 esac
2901 ;;
a0d0e21e 2902esac
8e07c86e
AD
2903prefix="$ans"
2904prefixexp="$ansexp"
a0d0e21e 2905
8e07c86e
AD
2906: set the prefixit variable, to compute a suitable default value
2907prefixit='case "$3" in
2908""|none)
2909 case "$oldprefix" in
2910 "") eval "$1=\"\$$2\"";;
2911 *)
2912 case "$3" in
2913 "") eval "$1=";;
2914 none)
2915 eval "tp=\"\$$2\"";
2916 case "$tp" in
2917 ""|" ") eval "$1=\"\$$2\"";;
2918 *) eval "$1=";;
2919 esac;;
2920 esac;;
2921 esac;;
2922*)
2923 eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
2924 case "$tp" in
2925 --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
2926 /*-$oldprefix/*|\~*-$oldprefix/*)
2927 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
2928 *) eval "$1=\"\$$2\"";;
2929 esac;;
2930esac'
a0d0e21e 2931
bfb7748a
AD
2932: set the base revision
2933baserev=5.0
2934
2935: get the patchlevel
2936echo " "
2937echo "Getting the current patchlevel..." >&4
2938if $test -r $rsrc/patchlevel.h;then
2939 patchlevel=`awk '/define[ ]+PATCHLEVEL/ {print $3}' $rsrc/patchlevel.h`
2940 subversion=`awk '/define[ ]+SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
2941else
2942 patchlevel=0
2943 subversion=0
2944fi
2945$echo $n "(You have $package" $c
2946case "$package" in
2947"*$baserev") ;;
2948*) $echo $n " $baserev" $c ;;
2949esac
2950$echo $n " patchlevel $patchlevel" $c
2951test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
2952echo ".)"
2953
2954if test 0 -eq "$subversion"; then
2955 version=`LC_ALL=C; export LC_ALL; \
2956 echo $baserev $patchlevel | \
2957 $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
2958else
2959 version=`LC_ALL=C; export LC_ALL; \
2960 echo $baserev $patchlevel $subversion | \
2961 $awk '{ printf "%.5f\n", $1 + $2/1000.0 + $3/100000.0 }'`
2962fi
2963: Figure out perl API version. Perhaps this should be in patchlevel.h
2964if test "$subversion" -lt 50; then
2965 apiversion=`LC_ALL=C; export LC_ALL; \
2966 echo $baserev $patchlevel | \
2967 $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
2968else
2969 apiversion="$version"
2970fi
2971
4633a7c4 2972: determine where private library files go
3a6175e1
AD
2973: Usual default is /usr/local/lib/perl5/$version.
2974: Also allow things like /opt/perl/lib/$version, since
bfb7748a 2975: /opt/perl/lib/perl5... would be redundant.
4633a7c4 2976case "$prefix" in
3a6175e1
AD
2977*perl*) set dflt privlib lib/$version ;;
2978*) set dflt privlib lib/$package/$version ;;
4633a7c4 2979esac
8e07c86e 2980eval $prefixit
4633a7c4
LW
2981$cat <<EOM
2982
2983There are some auxiliary files for $package that need to be put into a
2984private library directory that is accessible by everyone.
2985
2986EOM
2987fn=d~+
2988rp='Pathname where the private library files will reside?'
8e07c86e 2989. ./getfile
4633a7c4
LW
2990if $test "X$privlibexp" != "X$ansexp"; then
2991 installprivlib=''
8e07c86e 2992fi
4633a7c4
LW
2993privlib="$ans"
2994privlibexp="$ansexp"
8e07c86e
AD
2995if $afs; then
2996 $cat <<EOM
2304df62 2997
8e07c86e 2998Since you are running AFS, I need to distinguish the directory in which
4633a7c4 2999private files reside from the directory in which they are installed (and from
8e07c86e 3000which they are presumably copied to the former directory by occult means).
a0d0e21e 3001
8e07c86e 3002EOM
4633a7c4
LW
3003 case "$installprivlib" in
3004 '') dflt=`echo $privlibexp | sed 's#^/afs/#/afs/.#'`;;
3005 *) dflt="$installprivlib";;
8e07c86e
AD
3006 esac
3007 fn=de~
4633a7c4 3008 rp='Where will private files be installed?'
8e07c86e 3009 . ./getfile
4633a7c4 3010 installprivlib="$ans"
8e07c86e 3011else
4633a7c4
LW
3012 installprivlib="$privlibexp"
3013fi
3014
8e07c86e
AD
3015: set the prefixup variable, to restore leading tilda escape
3016prefixup='case "$prefixexp" in
3017"$prefix") ;;
3018*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
3019esac'
3020
4633a7c4
LW
3021: determine where public architecture dependent libraries go
3022set archlib archlib
8e07c86e 3023eval $prefixit
3a6175e1 3024: privlib default is /usr/local/lib/$package/$version
bfb7748a 3025: archlib default is /usr/local/lib/$package/$version/$archname
3a6175e1 3026: privlib may have an optional trailing /share.
bfb7748a
AD
3027tdflt=`echo $privlib | $sed 's,/share$,,'`
3028tdflt=$tdflt/$archname
4633a7c4 3029case "$archlib" in
bfb7748a 3030'') dflt=$tdflt
8e07c86e 3031 ;;
bfb7748a 3032*) dflt="$archlib"
774d564b 3033 ;;
8e07c86e 3034esac
4633a7c4
LW
3035cat <<EOM
3036
3037$spackage contains architecture-dependent library files. If you are
3038sharing libraries in a heterogeneous environment, you might store
3039these files in a separate location. Otherwise, you can just include
3040them with the rest of the public library files.
3041
8e07c86e 3042EOM
4633a7c4
LW
3043fn=d+~
3044rp='Where do you want to put the public architecture-dependent libraries?'
8e07c86e 3045. ./getfile
4633a7c4
LW
3046archlib="$ans"
3047archlibexp="$ansexp"
3048
8e07c86e
AD
3049if $afs; then
3050 $cat <<EOM
3051
7bac28a0 3052Since you are running AFS, I need to distinguish the directory in
3053which architecture-dependent library files reside from the directory
3054in which they are installed (and from which they are presumably copied
3055to the former directory by occult means).
8e07c86e
AD
3056
3057EOM
4633a7c4
LW
3058 case "$installarchlib" in
3059 '') dflt=`echo $archlibexp | sed 's#^/afs/#/afs/.#'`;;
3060 *) dflt="$installarchlib";;
8e07c86e
AD
3061 esac
3062 fn=de~
4633a7c4 3063 rp='Where will architecture-dependent library files be installed?'
8e07c86e 3064 . ./getfile
4633a7c4 3065 installarchlib="$ans"
8e07c86e 3066else
4633a7c4
LW
3067 installarchlib="$archlibexp"
3068fi
3069if $test X"$archlib" = X"$privlib"; then
3070 d_archlib="$undef"
3071else
3072 d_archlib="$define"
8e07c86e
AD
3073fi
3074
40a7a20a 3075: make some quick guesses about what we are up against
3076echo " "
3077$echo $n "Hmm... $c"
3078echo exit 1 >bsd
3079echo exit 1 >usg
3080echo exit 1 >v7
3081echo exit 1 >osf1
3082echo exit 1 >eunice
3083echo exit 1 >xenix
3084echo exit 1 >venix
8ff267be 3085echo exit 1 >os2
40a7a20a 3086d_bsd="$undef"
3087$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3088if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3089then
3090 echo "Looks kind of like an OSF/1 system, but we'll see..."
3091 echo exit 0 >osf1
3092elif test `echo abc | tr a-z A-Z` = Abc ; then
3093 xxx=`./loc addbib blurfl $pth`
3094 if $test -f $xxx; then
3095 echo "Looks kind of like a USG system with BSD features, but we'll see..."
3096 echo exit 0 >bsd
3097 echo exit 0 >usg
3098 else
3099 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3100 echo "Looks kind of like an extended USG system, but we'll see..."
3101 else
3102 echo "Looks kind of like a USG system, but we'll see..."
3103 fi
3104 echo exit 0 >usg
3105 fi
3106elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3107 echo "Looks kind of like a BSD system, but we'll see..."
3108 d_bsd="$define"
3109 echo exit 0 >bsd
3110else
3111 echo "Looks kind of like a Version 7 system, but we'll see..."
3112 echo exit 0 >v7
3113fi
3114case "$eunicefix" in
3115*unixtovms*)
3116 $cat <<'EOI'
3117There is, however, a strange, musty smell in the air that reminds me of
3118something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3119EOI
3120 echo exit 0 >eunice
3121 d_eunice="$define"
3122: it so happens the Eunice I know will not run shell scripts in Unix format
3123 ;;
3124*)
3125 echo " "
3126 echo "Congratulations. You aren't running Eunice."
3127 d_eunice="$undef"
3128 ;;
3129esac
8ff267be 3130: Detect OS2. The p_ variable is set above in the Head.U unit.
3131case "$p_" in
3132:) ;;
3133*)
3134 $cat <<'EOI'
3135I have the feeling something is not exactly right, however...don't tell me...
3136lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3137EOI
3138 echo exit 0 >os2
3139 ;;
3140esac
40a7a20a 3141if test -f /xenix; then
3142 echo "Actually, this looks more like a XENIX system..."
3143 echo exit 0 >xenix
3144 d_xenix="$define"
3145else
3146 echo " "
3147 echo "It's not Xenix..."
3148 d_xenix="$undef"
3149fi
3150chmod +x xenix
3151$eunicefix xenix
3152if test -f /venix; then
3153 echo "Actually, this looks more like a VENIX system..."
3154 echo exit 0 >venix
3155else
3156 echo " "
3157 if ./xenix; then
3158 : null
3159 else
3160 echo "Nor is it Venix..."
3161 fi
3162fi
8ff267be 3163chmod +x bsd usg v7 osf1 eunice xenix venix os2
3164$eunicefix bsd usg v7 osf1 eunice xenix venix os2
40a7a20a 3165$rm -f foo
3166
3167: see if setuid scripts can be secure
3168$cat <<EOM
3169
3170Some kernels have a bug that prevents setuid #! scripts from being
3171secure. Some sites have disabled setuid #! scripts because of this.
3172
3173First let's decide if your kernel supports secure setuid #! scripts.
3174(If setuid #! scripts would be secure but have been disabled anyway,
3175don't say that they are secure if asked.)
3176
3177EOM
3178
3179val="$undef"
3180if $test -d /dev/fd; then
3181 echo "#!$ls" >reflect
3182 chmod +x,u+s reflect
3183 ./reflect >flect 2>&1
3184 if $contains "/dev/fd" flect >/dev/null; then
3185 echo "Congratulations, your kernel has secure setuid scripts!" >&4
3186 val="$define"
3187 else
3188 $cat <<EOM
3189If you are not sure if they are secure, I can check but I'll need a
3190username and password different from the one you are using right now.
3191If you don't have such a username or don't want me to test, simply
3192enter 'none'.
3193
3194EOM
3195 rp='Other username to test security of setuid scripts with?'
3196 dflt='none'
3197 . ./myread
3198 case "$ans" in
3199 n|none)
3200 case "$d_suidsafe" in
3201 '') echo "I'll assume setuid scripts are *not* secure." >&4
3202 dflt=n;;
3203 "$undef")
3204 echo "Well, the $hint value is *not* secure." >&4
3205 dflt=n;;
3206 *) echo "Well, the $hint value *is* secure." >&4
3207 dflt=y;;
3208 esac
3209 ;;
3210 *)
3211 $rm -f reflect flect
3212 echo "#!$ls" >reflect
3213 chmod +x,u+s reflect
3214 echo >flect
3215 chmod a+w flect
3216 echo '"su" will (probably) prompt you for '"$ans's password."
3217 su $ans -c './reflect >flect'
3218 if $contains "/dev/fd" flect >/dev/null; then
3219 echo "Okay, it looks like setuid scripts are secure." >&4
3220 dflt=y
3221 else
3222 echo "I don't think setuid scripts are secure." >&4
3223 dflt=n
3224 fi
3225 ;;
3226 esac
3227 rp='Does your kernel have *secure* setuid scripts?'
3228 . ./myread
3229 case "$ans" in
3230 [yY]*) val="$define";;
3231 *) val="$undef";;
3232 esac
3233 fi
3234else
3235 echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
760ac839 3236 echo "(That's for file descriptors, not floppy disks.)"
40a7a20a 3237 val="$undef"
3238fi
3239set d_suidsafe
3240eval $setvar
3241
3242$rm -f reflect flect
3243
3244: now see if they want to do setuid emulation
3245echo " "
3246val="$undef"
3247case "$d_suidsafe" in
3248"$define")
3249 val="$undef"
3250 echo "No need to emulate SUID scripts since they are secure here." >& 4
3251 ;;
3252*)
3253 $cat <<EOM
3254Some systems have disabled setuid scripts, especially systems where
3255setuid scripts cannot be secure. On systems where setuid scripts have
dfe9444c
AD
3256been disabled, the setuid/setgid bits on scripts are currently
3257useless. It is possible for $package to detect those bits and emulate
3258setuid/setgid in a secure fashion. This emulation will only work if
3259setuid scripts have been disabled in your kernel.
8e07c86e
AD
3260
3261EOM
dfe9444c
AD
3262 case "$d_dosuid" in
3263 "$define") dflt=y ;;
3264 *) dflt=n ;;
3265 esac
3266 rp="Do you want to do setuid/setgid emulation?"
3267 . ./myread
3268 case "$ans" in
3269 [yY]*) val="$define";;
3270 *) val="$undef";;
3271 esac
3272 ;;
4633a7c4 3273esac
dfe9444c 3274set d_dosuid
4633a7c4 3275eval $setvar
8e07c86e 3276
2c7991dc 3277: determine where manual pages are on this system
3278echo " "
3279case "$sysman" in
3280'')
3281 syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
3282 syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
3283 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
3284 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
3285 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
3286 sysman=`./loc . /usr/man/man1 $syspath`
3287 ;;
3288esac
3289if $test -d "$sysman"; then
3290 echo "System manual is in $sysman." >&4
3291else
3292 echo "Could not find manual pages in source form." >&4
3293fi
3294
dc45a647
MB
3295: see what memory models we can support
3296case "$models" in
3297'')
3298 $cat >pdp11.c <<'EOP'
3299main() {
3300#ifdef pdp11
3301 exit(0);
3302#else
3303 exit(1);
3304#endif
3305}
3306EOP
3307 ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
3308 if $test -f pdp11 && ./pdp11 2>/dev/null; then
3309 dflt='unsplit split'
3310 else
3311 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
3312 case "$tans" in
3313 X) dflt='none';;
3314 *) if $test -d /lib/small || $test -d /usr/lib/small; then
3315 dflt='small'
3316 else
3317 dflt=''
3318 fi
3319 if $test -d /lib/medium || $test -d /usr/lib/medium; then
3320 dflt="$dflt medium"
3321 fi
3322 if $test -d /lib/large || $test -d /usr/lib/large; then
3323 dflt="$dflt large"
3324 fi
3325 if $test -d /lib/huge || $test -d /usr/lib/huge; then
3326 dflt="$dflt huge"
3327 fi
3328 esac
3329 fi;;
3330*) dflt="$models";;
3331esac
8e07c86e 3332$cat <<EOM
dc45a647
MB
3333
3334Some systems have different model sizes. On most systems they are called
3335small, medium, large, and huge. On the PDP11 they are called unsplit and
3336split. If your system doesn't support different memory models, say "none".
3337If you wish to force everything to one memory model, say "none" here and
3338put the appropriate flags later when it asks you for other cc and ld flags.
3339Venix systems may wish to put "none" and let the compiler figure things out.
3340(In the following question multiple model names should be space separated.)
3341
3342The default for most systems is "none".
8e07c86e 3343
8e07c86e 3344EOM
dc45a647
MB
3345rp="Which memory models are supported?"
3346. ./myread
3347models="$ans"
3348
3349case "$models" in
3350none)
3351 small=''
3352 medium=''
3353 large=''
3354 huge=''
3355 unsplit=''
3356 split=''
2c7991dc 3357 ;;
dc45a647
MB
3358*split)
3359 case "$split" in
3360 '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
3361 $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
3362 dflt='-i'
3363 else
3364 dflt='none'
3365 fi;;
3366 *) dflt="$split";;
3367 esac
3368 rp="What flag indicates separate I and D space?"
3369 . ./myread
3370 tans="$ans"
3371 case "$tans" in
3372 none) tans='';;
3373 esac
3374 split="$tans"
3375 unsplit='';;
3376*large*|*small*|*medium*|*huge*)
3377 case "$models" in
3378 *large*)
3379 case "$large" in
3380 '') dflt='-Ml';;
3381 *) dflt="$large";;
3382 esac
3383 rp="What flag indicates large model?"
3384 . ./myread
3385 tans="$ans"
3386 case "$tans" in
3387 none) tans='';
3388 esac
3389 large="$tans";;
3390 *) large='';;
3391 esac
3392 case "$models" in
3393 *huge*) case "$huge" in
3394 '') dflt='-Mh';;
3395 *) dflt="$huge";;
3396 esac
3397 rp="What flag indicates huge model?"
3398 . ./myread
3399 tans="$ans"
3400 case "$tans" in
3401 none) tans='';
3402 esac
3403 huge="$tans";;
3404 *) huge="$large";;
3405 esac
3406 case "$models" in
3407 *medium*) case "$medium" in
3408 '') dflt='-Mm';;
3409 *) dflt="$medium";;
3410 esac
3411 rp="What flag indicates medium model?"
3412 . ./myread
3413 tans="$ans"
3414 case "$tans" in
3415 none) tans='';
3416 esac
3417 medium="$tans";;
3418 *) medium="$large";;
3419 esac
3420 case "$models" in
3421 *small*) case "$small" in
3422 '') dflt='none';;
3423 *) dflt="$small";;
3424 esac
3425 rp="What flag indicates small model?"
3426 . ./myread
3427 tans="$ans"
3428 case "$tans" in
3429 none) tans='';
3430 esac
3431 small="$tans";;
3432 *) small='';;
25f94b33 3433 esac
8e07c86e 3434 ;;
dc45a647
MB
3435*)
3436 echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
8e07c86e
AD
3437 ;;
3438esac
dc45a647 3439$rm -f pdp11.* pdp11
4e2a5f63 3440
dc45a647
MB
3441: see if we need a special compiler
3442echo " "
3443if ./usg; then
3444 case "$cc" in
3445 '') case "$Mcc" in
3446 /*) dflt='Mcc';;
3447 *) case "$large" in
3448 -M*) dflt='cc';;
3449 *) if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
3450 if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
3451 dflt='cc'
3452 else
3453 dflt='cc -M'
3454 fi
3455 else
3456 dflt='cc'
3457 fi;;
3458 esac;;
3459 esac;;
3460 *) dflt="$cc";;
3461 esac
3462 case "$dflt" in
3463 *M*) $cat <<'EOM'
3464On some older systems the default C compiler will not resolve multiple global
3465references that happen to have the same name. On some such systems the "Mcc"
3466command may be used to force these to be resolved. On other systems a "cc -M"
3467command is required. (Note that the -M flag on other systems indicates a
3468memory model to use!) If you have the Gnu C compiler, you might wish to use
3469that instead.
8e07c86e
AD
3470
3471EOM
dc45a647 3472 ;;
2afac517 3473 esac
dc45a647
MB
3474 rp="Use which C compiler?"
3475 . ./myread
3476 cc="$ans"
4e2a5f63 3477else
dc45a647
MB
3478 case "$cc" in
3479 '') dflt=cc;;
3480 *) dflt="$cc";;
4e2a5f63 3481 esac
dc45a647 3482 rp="Use which C compiler?"
4e2a5f63
AD
3483 . ./myread
3484 cc="$ans"
3485fi
693762b4
AD
3486: Look for a hint-file generated 'call-back-unit'. Now that the
3487: user has specified the compiler, we may need to set or change some
3488: other defaults.
3489if $test -f cc.cbu; then
3490 . ./cc.cbu
3491fi
4e2a5f63
AD
3492echo " "
3493echo "Checking for GNU cc in disguise and/or its version number..." >&4
3494$cat >gccvers.c <<EOM
3495#include <stdio.h>
3496int main() {
3497#ifdef __GNUC__
3498#ifdef __VERSION__
3499 printf("%s\n", __VERSION__);
3500#else
3501 printf("%s\n", "1");
3502#endif
3503#endif
3504 exit(0);
3505}
3506EOM
3507if $cc -o gccvers gccvers.c >/dev/null 2>&1; then
3508 gccversion=`./gccvers`
3509 case "$gccversion" in
2afac517 3510 '') echo "You are not using GNU cc." ;;
3511 *) echo "You are using GNU cc $gccversion." ;;
3512 esac
3513else
3514 echo " "
3515 echo "*** WHOA THERE!!! ***" >&4
3516 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
3517 case "$knowitall" in
3518 '')
3519 echo " You'd better start hunting for one and let me know about it." >&4
3520 exit 1
2c7991dc 3521 ;;
8e07c86e 3522 esac
2afac517 3523fi
3524$rm -f gccvers*
3525case "$gccversion" in
35261*) cpp=`./loc gcc-cpp $cpp $pth` ;;
8e07c86e
AD
3527esac
3528
2afac517 3529: What should the include directory be ?
8e07c86e 3530echo " "
2afac517 3531$echo $n "Hmm... $c"
3532dflt='/usr/include'
3533incpath=''
3534mips_type=''
3535if $test -f /bin/mips && /bin/mips; then
3536 echo "Looks like a MIPS system..."
3537 $cat >usr.c <<'EOCP'
3538#ifdef SYSTYPE_BSD43
3539/bsd43
3540#endif
3541EOCP
3542 if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3543 dflt='/bsd43/usr/include'
3544 incpath='/bsd43'
3545 mips_type='BSD 4.3'
8e07c86e 3546 else
2afac517 3547 mips_type='System V'
8e07c86e 3548 fi
2afac517 3549 $rm -f usr.c usr.out
3550 echo "and you're compiling with the $mips_type compiler and libraries."
3551 xxx_prompt=y
3552 echo "exit 0" >mips
8e07c86e 3553else
2afac517 3554 echo "Doesn't look like a MIPS system."
3555 xxx_prompt=n
3556 echo "exit 1" >mips
3557fi
3558chmod +x mips
3559$eunicefix mips
2afac517 3560case "$usrinc" in
3561'') ;;
3562*) dflt="$usrinc";;
3563esac
3564case "$xxx_prompt" in
3565y) fn=d/
dfe9444c 3566 echo " "
2afac517 3567 rp='Where are the include files you want to use?'
3568 . ./getfile
3569 usrinc="$ans"
3570 ;;
3571*) usrinc="$dflt"
3572 ;;
3573esac
8e07c86e 3574
c4f23d77
AD
3575: see how we invoke the C preprocessor
3576echo " "
3577echo "Now, how can we feed standard input to your C preprocessor..." >&4
3578cat <<'EOT' >testcpp.c
3579#define ABC abc
3580#define XYZ xyz
3581ABC.XYZ
3582EOT
3583cd ..
1cfa4ec7
GS
3584if test ! -f cppstdin; then
3585 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3586else
3587 echo "Keeping your $hint cppstdin wrapper."
3588fi
c4f23d77
AD
3589chmod 755 cppstdin
3590wrapper=`pwd`/cppstdin
3591ok='false'
3592cd UU
3593
3594if $test "X$cppstdin" != "X" && \
3595 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3596 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3597then
3598 echo "You used to use $cppstdin $cppminus so we'll use that again."
3599 case "$cpprun" in
3600 '') echo "But let's see if we can live without a wrapper..." ;;
3601 *)
3602 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3603 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3604 then
3605 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3606 ok='true'
3607 else
3608 echo "(However, $cpprun $cpplast does not work, let's see...)"
3609 fi
3610 ;;
3611 esac
3612else
3613 case "$cppstdin" in
3614 '') ;;
3615 *)
3616 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3617 ;;
3618 esac
3619fi
3620
3621if $ok; then
3622 : nothing
3623elif echo 'Maybe "'"$cc"' -E" will work...'; \
3624 $cc -E <testcpp.c >testcpp.out 2>&1; \
3625 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3626 echo "Yup, it does."
3627 x_cpp="$cc -E"
3628 x_minus='';
3629elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3630 $cc -E - <testcpp.c >testcpp.out 2>&1; \
3631 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3632 echo "Yup, it does."
3633 x_cpp="$cc -E"
3634 x_minus='-';
3635elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3636 $cc -P <testcpp.c >testcpp.out 2>&1; \
3637 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3638 echo "Yipee, that works!"
3639 x_cpp="$cc -P"
3640 x_minus='';
3641elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3642 $cc -P - <testcpp.c >testcpp.out 2>&1; \
3643 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3644 echo "At long last!"
3645 x_cpp="$cc -P"
3646 x_minus='-';
3647elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3648 $cpp <testcpp.c >testcpp.out 2>&1; \
3649 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3650 echo "It works!"
3651 x_cpp="$cpp"
3652 x_minus='';
3653elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3654 $cpp - <testcpp.c >testcpp.out 2>&1; \
3655 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3656 echo "Hooray, it works! I was beginning to wonder."
3657 x_cpp="$cpp"
3658 x_minus='-';
3659elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
3660 $wrapper <testcpp.c >testcpp.out 2>&1; \
3661 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3662 x_cpp="$wrapper"
3663 x_minus=''
3664 echo "Eureka!"
3665else
3666 dflt=''
3667 rp="No dice. I can't find a C preprocessor. Name one:"
3668 . ./myread
3669 x_cpp="$ans"
3670 x_minus=''
3671 $x_cpp <testcpp.c >testcpp.out 2>&1
3672 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3673 echo "OK, that will do." >&4
3674 else
3675echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
3676 exit 1
3677 fi
3678fi
3679
3680case "$ok" in
3681false)
3682 cppstdin="$x_cpp"
3683 cppminus="$x_minus"
3684 cpprun="$x_cpp"
3685 cpplast="$x_minus"
3686 set X $x_cpp
3687 shift
3688 case "$1" in
3689 "$cpp")
3690 echo "Perhaps can we force $cc -E using a wrapper..."
3691 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3692 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3693 then
3694 echo "Yup, we can."
3695 cppstdin="$wrapper"
3696 cppminus='';
3697 else
3698 echo "Nope, we'll have to live without it..."
3699 fi
3700 ;;
3701 esac
3702 case "$cpprun" in
3703 "$wrapper")
3704 cpprun=''
3705 cpplast=''
3706 ;;
3707 esac
3708 ;;
3709esac
3710
3711case "$cppstdin" in
3712"$wrapper") ;;
3713*) $rm -f $wrapper;;
3714esac
3715$rm -f testcpp.c testcpp.out
3716
2afac517 3717: Set private lib path
3718case "$plibpth" in
3719'') if ./mips; then
3720 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3721 fi;;
3722esac
3723case "$libpth" in
3724' ') dlist='';;
3725'') dlist="$loclibpth $plibpth $glibpth";;
3726*) dlist="$libpth";;
3727esac
8e07c86e 3728
2afac517 3729: Now check and see which directories actually exist, avoiding duplicates
3730libpth=''
3731for xxx in $dlist
3732do
3733 if $test -d $xxx; then
3734 case " $libpth " in
3735 *" $xxx "*) ;;
3736 *) libpth="$libpth $xxx";;
3737 esac
3738 fi
3739done
3740$cat <<'EOM'
8e07c86e 3741
2afac517 3742Some systems have incompatible or broken versions of libraries. Among
3743the directories listed in the question below, please remove any you
3744know not to be holding relevant libraries, and add any that are needed.
3745Say "none" for none.
8e07c86e 3746
8e07c86e 3747EOM
2afac517 3748case "$libpth" in
3749'') dflt='none';;
3750*)
3751 set X $libpth
3752 shift
3753 dflt=${1+"$@"}
4633a7c4 3754 ;;
8e07c86e 3755esac
2afac517 3756rp="Directories to use for library searches?"
3757. ./myread
3758case "$ans" in
3759none) libpth=' ';;
3760*) libpth="$ans";;
3761esac
8e07c86e 3762
2afac517 3763: compute shared library extension
3764case "$so" in
3765'')
3766 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3767 dflt='sl'
3768 else
3769 dflt='so'
3770 fi
3771 ;;
3772*) dflt="$so";;
8e07c86e 3773esac
2afac517 3774$cat <<EOM
8e07c86e 3775
2afac517 3776On some systems, shared libraries may be available. Answer 'none' if
3777you want to suppress searching of shared libraries for the remaining
3778of this configuration.
8e07c86e
AD
3779
3780EOM
2afac517 3781rp='What is the file extension used for shared libraries?'
3782. ./myread
3783so="$ans"
8e07c86e 3784
dfe9444c
AD
3785: Define several unixisms.
3786: Hints files or command line option can be used to override them.
3787: The convoluted testing is in case hints files set either the old
3788: or the new name.
3789case "$_exe" in
3790'') case "$exe_ext" in
3791 '') ;;
3792 *) _exe="$exe_ext" ;;
3793 esac
3794 ;;
3795esac
3796case "$_a" in
3797'') case "$lib_ext" in
3798 '') _a='.a';;
3799 *) _a="$lib_ext" ;;
3800 esac
3801 ;;
3802esac
3803case "$_o" in
3804'') case "$obj_ext" in
3805 '') _o='.o';;
3806 *) _o="$obj_ext";;
3807 esac
3808 ;;
3809esac
3810case "$p_" in
3811'') case "$path_sep" in
3812 '') p_=':';;
3813 *) p_="$path_sep";;
3814 esac
3815 ;;
3816esac
3817exe_ext=$_exe
3818lib_ext=$_a
3819obj_ext=$_o
3820path_sep=$p_
3821
3822: Which makefile gets called first. This is used by make depend.
3823case "$firstmakefile" in
3824'') firstmakefile='makefile';;
3825esac
3826
2afac517 3827: Looking for optional libraries
3828echo " "
3829echo "Checking for optional libraries..." >&4
3830case "$libs" in
3831' '|'') dflt='';;
3832*) dflt="$libs";;
8e07c86e 3833esac
2afac517 3834case "$libswanted" in
3835'') libswanted='c_s';;
3836esac
3837for thislib in $libswanted; do
3838
1cfa4ec7
GS
3839 if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`;
3840 $test -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
2afac517 3841 echo "Found -l$thislib (shared)."
3842 case " $dflt " in
3843 *"-l$thislib "*);;
3844 *) dflt="$dflt -l$thislib";;
4633a7c4 3845 esac
2afac517 3846 elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
3847 echo "Found -l$thislib (shared)."
3848 case " $dflt " in
3849 *"-l$thislib "*);;
3850 *) dflt="$dflt -l$thislib";;
3851 esac
dfe9444c 3852 elif xxx=`./loc lib$thislib$_a X $libpth`; $test -f "$xxx"; then
2afac517 3853 echo "Found -l$thislib."
3854 case " $dflt " in
3855 *"-l$thislib "*);;
3856 *) dflt="$dflt -l$thislib";;
3857 esac
dfe9444c 3858 elif xxx=`./loc $thislib$_a X $libpth`; $test -f "$xxx"; then
2afac517 3859 echo "Found -l$thislib."
3860 case " $dflt " in
3861 *"-l$thislib "*);;
3862 *) dflt="$dflt -l$thislib";;
3863 esac
dfe9444c 3864 elif xxx=`./loc lib${thislib}_s$_a X $libpth`; $test -f "$xxx"; then
2afac517 3865 echo "Found -l${thislib}_s."
3866 case " $dflt " in
3867 *"-l$thislib "*);;
3868 *) dflt="$dflt -l${thislib}_s";;
3869 esac
dfe9444c 3870 elif xxx=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$xxx"; then
2afac517 3871 echo "Found -l$thislib."
3872 case " $dflt " in
3873 *"-l$thislib "*);;
3874 *) dflt="$dflt -l$thislib";;
3875 esac
3876 else
3877 echo "No -l$thislib."
3878 fi
3879done
3880set X $dflt
3881shift
3882dflt="$*"
3883case "$libs" in
3884'') dflt="$dflt";;
3885*) dflt="$libs";;
3886esac
3887case "$dflt" in
3888' '|'') dflt='none';;
8e07c86e 3889esac
2afac517 3890
4633a7c4
LW
3891$cat <<EOM
3892
2afac517 3893Some versions of Unix support shared libraries, which make executables smaller
3894but make load time slightly longer.
8e07c86e 3895
2afac517 3896On some systems, mostly System V Release 3's, the shared library is included
3897by putting the option "-lc_s" as the last thing on the cc command line when
3898linking. Other systems use shared libraries by default. There may be other
3899libraries needed to compile $package on your machine as well. If your system
3900needs the "-lc_s" option, include it here. Include any other special libraries
3901here as well. Say "none" for none.
4633a7c4 3902EOM
2afac517 3903
3904echo " "
3905rp="Any additional libraries?"
8e07c86e 3906. ./myread
2afac517 3907case "$ans" in
3908none) libs=' ';;
3909*) libs="$ans";;
3910esac
8e07c86e 3911
2afac517 3912: determine optimize, if desired, or use for debug flag also
3913case "$optimize" in
2ae324a7 3914' '|$undef) dflt='none';;
2afac517 3915'') dflt='-O';;
3916*) dflt="$optimize";;
4633a7c4 3917esac
2afac517 3918$cat <<EOH
4633a7c4 3919
760ac839 3920Some C compilers have problems with their optimizers. By default, $package
4633a7c4
LW
3921compiles with the -O flag to use the optimizer. Alternately, you might want
3922to use the symbolic debugger, which uses the -g flag (on traditional Unix
3923systems). Either flag can be specified here. To use neither flag, specify
3924the word "none".
3925
3926EOH
3927rp="What optimizer/debugger flag should be used?"
3928. ./myread
3929optimize="$ans"
3930case "$optimize" in
3931'none') optimize=" ";;
3932esac
3933
3934dflt=''
25f94b33
AD
3935: We will not override a previous value, but we might want to
3936: augment a hint file
3937case "$hint" in
3938none|recommended)
4633a7c4
LW
3939 case "$gccversion" in
3940 1*) dflt='-fpcc-struct-return' ;;
3941 esac
3942 case "$optimize" in
3943 *-g*) dflt="$dflt -DDEBUGGING";;
3944 esac
3945 case "$gccversion" in
3946 2*) if test -d /etc/conf/kconfig.d &&
3947 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3948 then
3949 dflt="$dflt -posix"
3950 fi
3951 ;;
3952 esac
3953 ;;
3954esac
3955
a4f3eea9 3956case "$mips_type" in
3957*BSD*|'') inclwanted="$locincpth $usrinc";;
3958*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3959esac
3960for thisincl in $inclwanted; do
3961 if $test -d $thisincl; then
3962 if $test x$thisincl != x$usrinc; then
3963 case "$dflt" in
3964 *$thisincl*);;
3965 *) dflt="$dflt -I$thisincl";;
3966 esac
3967 fi
3968 fi
3969done
3970
3971inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3972 xxx=true;
3973elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3974 xxx=true;
3975else
3976 xxx=false;
3977fi;
3978if $xxx; then
3979 case "$dflt" in
3980 *$2*);;
3981 *) dflt="$dflt -D$2";;
3982 esac;
3983fi'
3984
3985if ./osf1; then
3986 set signal.h __LANGUAGE_C__; eval $inctest
3987else
3988 set signal.h LANGUAGE_C; eval $inctest
3989fi
a4f3eea9 3990
3991case "$hint" in
3992none|recommended) dflt="$ccflags $dflt" ;;
3993*) dflt="$ccflags";;
3994esac
3995
3996case "$dflt" in
3997''|' ') dflt=none;;
3998esac
3999$cat <<EOH
4000
4001Your C compiler may want other flags. For this question you should include
4002-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4003but you should NOT include libraries or ld flags like -lwhatever. If you
4004want $package to honor its debug switch, you should include -DDEBUGGING here.
dfe9444c 4005Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
a4f3eea9 4006
4007To use no flags, specify the word "none".
4008
4009EOH
4010set X $dflt
4011shift
4012dflt=${1+"$@"}
4013rp="Any additional cc flags?"
4014. ./myread
4015case "$ans" in
4016none) ccflags='';;
4017*) ccflags="$ans";;
4018esac
4019
4020: the following weeds options from ccflags that are of no interest to cpp
4021cppflags="$ccflags"
4022case "$gccversion" in
40231*) cppflags="$cppflags -D__GNUC__"
4024esac
4025case "$mips_type" in
4026'');;
4027*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4028esac
4029case "$cppflags" in
4030'');;
4031*)
4032 echo " "
4033 echo "Let me guess what the preprocessor flags are..." >&4
4034 set X $cppflags
4035 shift
4036 cppflags=''
4037 $cat >cpp.c <<'EOM'
4038#define BLURFL foo
4039
4040BLURFL xx LFRULB
4041EOM
4042 previous=''
4043 for flag in $*
4044 do
4045 case "$flag" in
4046 -*) ftry="$flag";;
4047 *) ftry="$previous $flag";;
4048 esac
7bac28a0 4049 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
a4f3eea9 4050 >cpp1.out 2>/dev/null && \
dfe9444c 4051 $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
a4f3eea9 4052 >cpp2.out 2>/dev/null && \
4053 $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4054 $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4055 then
4056 cppflags="$cppflags $ftry"
4057 previous=''
4058 else
4059 previous="$flag"
4060 fi
4061 done
4062 set X $cppflags
4063 shift
4064 cppflags=${1+"$@"}
4065 case "$cppflags" in
4066 *-*) echo "They appear to be: $cppflags";;
4067 esac
4068 $rm -f cpp.c cpp?.out
4069 ;;
4070esac
4071
4072: flags used in final linking phase
a4f3eea9 4073case "$ldflags" in
4074'') if ./venix; then
4075 dflt='-i -z'
4076 else
4077 dflt=''
4078 fi
4079 case "$ccflags" in
4080 *-posix*) dflt="$dflt -posix" ;;
4081 esac
4082 ;;
4083*) dflt="$ldflags";;
4084esac
4085
4086: Try to guess additional flags to pick up local libraries.
4087for thislibdir in $libpth; do
4088 case " $loclibpth " in
4089 *" $thislibdir "*)
4090 case "$dflt " in
4091 *"-L$thislibdir "*) ;;
4092 *) dflt="$dflt -L$thislibdir" ;;
4093 esac
4094 ;;
4095 esac
4096done
4097
4098case "$dflt" in
4099'') dflt='none' ;;
4100esac
4101
4102$cat <<EOH
4103
4104Your C linker may need flags. For this question you should
4105include -L/whatever and any other flags used by the C linker, but you
4106should NOT include libraries like -lwhatever.
4107
4108Make sure you include the appropriate -L/path flags if your C linker
4109does not normally search all of the directories you specified above,
4110namely
4111 $libpth
4112To use no flags, specify the word "none".
4113
4114EOH
4115
4116rp="Any additional ld flags (NOT including libraries)?"
4117. ./myread
4118case "$ans" in
4119none) ldflags='';;
4120*) ldflags="$ans";;
4121esac
4122rmlist="$rmlist pdp11"
4123
4124: coherency check
4125echo " "
dfe9444c 4126echo "Checking your choice of C compiler and flags for coherency..." >&4
5ff3f7a4
GS
4127$cat > try.c <<'EOF'
4128#include <stdio.h>
4129main() { printf("Ok\n"); exit(0); }
4130EOF
87563a30 4131set X $cc $optimize $ccflags -o try $ldflags try.c $libs
a4f3eea9 4132shift
5ff3f7a4
GS
4133$cat >try.msg <<'EOM'
4134I've tried to compile and run the following simple program:
4135
4136EOM
4137$cat try.c
4138
4139$cat >> try.msg <<EOM
4140
4141I used the command:
a4f3eea9 4142
4143 $*
4144 ./try
4145
4146and I got the following output:
4147
4148EOM
a4f3eea9 4149dflt=y
28e8609d 4150if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
a4f3eea9 4151 if sh -c './try' >>try.msg 2>&1; then
dfe9444c
AD
4152 xxx=`./try`
4153 case "$xxx" in
4154 "Ok") dflt=n ;;
4155 *) echo 'The program compiled OK, but produced no output.' >> try.msg
4156 case " $libs " in
4157 *" -lsfio "*)
4158 cat >> try.msg <<'EOQS'
4159If $libs contains -lsfio, and sfio is mis-configured, then it
4160sometimes (apparently) runs and exits with a 0 status, but with no
4161output! It may have to do with sfio's use of _exit vs. exit.
4162
4163EOQS
4164 rp="You have a big problem. Shall I abort Configure"
4165 dflt=y
4166 ;;
4167 esac
4168 ;;
4169 esac
a4f3eea9 4170 else
4171 echo "The program compiled OK, but exited with status $?." >>try.msg
dfe9444c 4172 rp="You have a problem. Shall I abort Configure"
a4f3eea9 4173 dflt=y
4174 fi
4175else
4176 echo "I can't compile the test program." >>try.msg
dfe9444c 4177 rp="You have a BIG problem. Shall I abort Configure"
a4f3eea9 4178 dflt=y
4179fi
4180case "$dflt" in
4181y)
97286747 4182 $cat try.msg >&4
a4f3eea9 4183 case "$knowitall" in
4184 '')
5ff3f7a4 4185 echo "(The supplied flags or libraries might be incorrect.)"
a4f3eea9 4186 ;;
4187 *) dflt=n;;
4188 esac
4189 echo " "
4190 . ./myread
4191 case "$ans" in
4192 n*|N*) ;;
4193 *) echo "Ok. Stopping Configure." >&4
4194 exit 1
4195 ;;
4196 esac
4197 ;;
4198n) echo "OK, that should do.";;
4199esac
4200$rm -f try try.* core
4201
bfb7748a
AD
4202: determine filename position in cpp output
4203echo " "
4204echo "Computing filename position in cpp output for #include directives..." >&4
4205echo '#include <stdio.h>' > foo.c
4206$cat >fieldn <<EOF
4207$startsh
4208$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4209$grep '^[ ]*#.*stdio\.h' | \
4210while read cline; do
4211 pos=1
4212 set \$cline
4213 while $test \$# -gt 0; do
4214 if $test -r \`echo \$1 | $tr -d '"'\`; then
4215 echo "\$pos"
4216 exit 0
4217 fi
4218 shift
4219 pos=\`expr \$pos + 1\`
4220 done
4221done
4222EOF
4223chmod +x fieldn
4224fieldn=`./fieldn`
4225$rm -f foo.c fieldn
4226case $fieldn in
4227'') pos='???';;
42281) pos=first;;
42292) pos=second;;
42303) pos=third;;
4231*) pos="${fieldn}th";;
4232esac
4233echo "Your cpp writes the filename in the $pos field of the line."
4234
4235: locate header file
4236$cat >findhdr <<EOF
4237$startsh
4238wanted=\$1
4239name=''
4240if test -f $usrinc/\$wanted; then
4241 echo "$usrinc/\$wanted"
4242 exit 0
4243fi
4244awkprg='{ print \$$fieldn }'
4245echo "#include <\$wanted>" > foo\$\$.c
4246$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4247$grep "^[ ]*#.*\$wanted" | \
4248while read cline; do
4249 name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4250 case "\$name" in
4251 */\$wanted) echo "\$name"; exit 0;;
4252 *) name='';;
4253 esac;
4254done;
4255$rm -f foo\$\$.c;
4256case "\$name" in
4257'') exit 1;;
4258esac
4259EOF
4260chmod +x findhdr
4261
4262: define an alternate in-header-list? function
4263inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4264cont=true; xxf="echo \"<\$1> found.\" >&4";
4265case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4266*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4267esac;
4268case $# in 4) instead=instead;; *) instead="at last";; esac;
4269while $test "$cont"; do
4270 xxx=`./findhdr $1`
4271 var=$2; eval "was=\$$2";
4272 if $test "$xxx" && $test -r "$xxx";
4273 then eval $xxf;
4274 eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4275 cont="";
4276 else eval $xxnf;
4277 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4278 set $yyy; shift; shift; yyy=$@;
4279 case $# in 0) cont="";;
4280 2) xxf="echo \"but I found <\$1> $instead.\" >&4";
4281 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
4282 *) xxf="echo \"but I found <\$1\> instead.\" >&4";
4283 xxnf="echo \"there is no <\$1>, ...\" >&4";;
4284 esac;
4285done;
4286while $test "$yyy";
4287do set $yyy; var=$2; eval "was=\$$2";
4288 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
4289 set $yyy; shift; shift; yyy=$@;
4290done'
4291
4292: see if this is a malloc.h system
4293set malloc.h i_malloc
4294eval $inhdr
4295
4296: see if stdlib is available
4297set stdlib.h i_stdlib
4298eval $inhdr
4299
4300: determine which malloc to compile in
4301echo " "
4302case "$usemymalloc" in
5ff3f7a4
GS
4303''|[yY]*|true|$define) dflt='y' ;;
4304*) dflt='n' ;;
bfb7748a
AD
4305esac
4306rp="Do you wish to attempt to use the malloc that comes with $package?"
4307. ./myread
4308usemymalloc="$ans"
4309case "$ans" in
4310y*|true)
4311 usemymalloc='y'
4312 mallocsrc='malloc.c'
4313 mallocobj="malloc$_o"
4314 d_mymalloc="$define"
4315 case "$libs" in
4316 *-lmalloc*)
4317 : Remove malloc from list of libraries to use
4318 echo "Removing unneeded -lmalloc from library list" >&4
4319 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
4320 shift
4321 libs="$*"
4322 echo "libs = $libs" >&4
4323 ;;
4324 esac
4325 ;;
4326*)
4327 usemymalloc='n'
4328 mallocsrc=''
4329 mallocobj=''
4330 d_mymalloc="$undef"
4331 ;;
4332esac
4333
4334: compute the return types of malloc and free
4335echo " "
4336$cat >malloc.c <<END
4337#$i_malloc I_MALLOC
4338#$i_stdlib I_STDLIB
4339#include <stdio.h>
4340#include <sys/types.h>
4341#ifdef I_MALLOC
4342#include <malloc.h>
4343#endif
4344#ifdef I_STDLIB
4345#include <stdlib.h>
4346#endif
4347#ifdef TRY_MALLOC
4348void *malloc();
4349#endif
4350#ifdef TRY_FREE
4351void free();
4352#endif
4353END
4354case "$malloctype" in
4355'')
4356 if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
4357 malloctype='void *'
4358 else
4359 malloctype='char *'
4360 fi
4361 ;;
4362esac
4363echo "Your system wants malloc to return '$malloctype', it would seem." >&4
4364
4365case "$freetype" in
4366'')
4367 if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
4368 freetype='void'
4369 else
4370 freetype='int'
4371 fi
4372 ;;
4373esac
4374echo "Your system uses $freetype free(), it would seem." >&4
4375$rm -f malloc.[co]
c4f23d77
AD
4376: Cruising for prototypes
4377echo " "
4378echo "Checking out function prototypes..." >&4
4379$cat >prototype.c <<'EOCP'
4380main(int argc, char *argv[]) {
4381 exit(0);}
4382EOCP
4383if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
4384 echo "Your C compiler appears to support function prototypes."
4385 val="$define"
4386else
4387 echo "Your C compiler doesn't seem to understand function prototypes."
4388 val="$undef"
4389fi
4390set prototype
4391eval $setvar
4392$rm -f prototype*
4393
4394case "$prototype" in
4395"$define") ;;
4396*) ansi2knr='ansi2knr'
4397 echo " "
4398 cat <<EOM >&4
4399
4400$me: FATAL ERROR:
4401This version of $package can only be compiled by a compiler that
4402understands function prototypes. Unfortunately, your C compiler
4403 $cc $ccflags
4404doesn't seem to understand them. Sorry about that.
4405
5ff3f7a4 4406If GNU cc is available for your system, perhaps you could try that instead.
c4f23d77
AD
4407
4408Eventually, we hope to support building Perl with pre-ANSI compilers.
4409If you would like to help in that effort, please contact <perlbug@perl.org>.
4410
4411Aborting Configure now.
4412EOM
4413 exit 2
4414 ;;
4415esac
4416
4417: determine where public executables go
4418echo " "
4419set dflt bin bin
4420eval $prefixit
4421fn=d~
4422rp='Pathname where the public executables will reside?'
4423. ./getfile
4424if $test "X$ansexp" != "X$binexp"; then
4425 installbin=''
4426fi
4427bin="$ans"
4428binexp="$ansexp"
4429if $afs; then
4430 $cat <<EOM
4431
4432Since you are running AFS, I need to distinguish the directory in which
4433executables reside from the directory in which they are installed (and from
4434which they are presumably copied to the former directory by occult means).
4435
4436EOM
4437 case "$installbin" in
4438 '') dflt=`echo $binexp | sed 's#^/afs/#/afs/.#'`;;
4439 *) dflt="$installbin";;
4440 esac
4441 fn=de~
4442 rp='Where will public executables be installed?'
4443 . ./getfile
4444 installbin="$ans"
4445else
4446 installbin="$binexp"
4447fi
4448
dfe9444c
AD
4449: define a shorthand compile call
4450compile='
4451mc_file=$1;
4452shift;
c4f23d77 4453$cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
dc45a647
MB
4454: define a shorthand compile call for compilations that should be ok.
4455compile_ok='
4456mc_file=$1;
4457shift;
c4f23d77 4458$cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
dfe9444c 4459
a4f3eea9 4460echo " "
4461echo "Checking for GNU C Library..." >&4
4462cat >gnulibc.c <<EOM
aebf16e7 4463#include <stdio.h>
a4f3eea9 4464int
4465main()
4466{
aebf16e7
AD
4467#ifdef __GLIBC__
4468 exit(0);
4469#else
4470 exit(1);
4471#endif
a4f3eea9 4472}
4473EOM
dfe9444c 4474set gnulibc
aebf16e7 4475if eval $compile_ok && ./gnulibc; then
a4f3eea9 4476 val="$define"
4477 echo "You are using the GNU C Library"
4633a7c4 4478else
a4f3eea9 4479 val="$undef"
4480 echo "You are not using the GNU C Library"
4633a7c4 4481fi
a4f3eea9 4482$rm -f gnulibc*
4483set d_gnulibc
4484eval $setvar
25f94b33 4485
a4f3eea9 4486: see if nm is to be used to determine whether a symbol is defined or not
4487case "$usenm" in
4488'')
dc45a647 4489 dflt=''
a4f3eea9 4490 case "$d_gnulibc" in
dc45a647
MB
4491 "$define")
4492 echo " "
4493 echo "nm probably won't work on the GNU C Library." >&4
a4f3eea9 4494 dflt=n
4495 ;;
dc45a647
MB
4496 esac
4497 case "$dflt" in
4498 '')
4499 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
4500 echo " "
4501 echo "Whoops! This is an AIX system without /lib/syscalls.exp!" >&4
4502 echo "'nm' won't be sufficient on this sytem." >&4
4503 dflt=n
4504 fi
4505 ;;
4506 esac
4507 case "$dflt" in
c4f23d77 4508 '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
a4f3eea9 4509 if $test $dflt -gt 20; then
4510 dflt=y
4511 else
4512 dflt=n
4513 fi
4514 ;;
4515 esac
4516 ;;
4517*)
4518 case "$usenm" in
dc45a647 4519 true|$define) dflt=y;;
a4f3eea9 4520 *) dflt=n;;
4521 esac
4522 ;;
25f94b33 4523esac
a4f3eea9 4524$cat <<EOM
4633a7c4 4525
dc45a647
MB
4526I can use $nm to extract the symbols from your C libraries. This
4527is a time consuming task which may generate huge output on the disk (up
4528to 3 megabytes) but that should make the symbols extraction faster. The
4529alternative is to skip the 'nm' extraction part and to compile a small
4530test program instead to determine whether each symbol is present. If
4531you have a fast C compiler and/or if your 'nm' output cannot be parsed,
4532this may be the best solution.
4533
4534You probably shouldn't let me use 'nm' if you are using the GNU C Library.
4633a7c4 4535
a4f3eea9 4536EOM
693762b4 4537rp="Shall I use $nm to extract C symbols from the libraries?"
4633a7c4
LW
4538. ./myread
4539case "$ans" in
dc45a647 4540[Nn]*) usenm=false;;
a4f3eea9 4541*) usenm=true;;
4633a7c4
LW
4542esac
4543
a4f3eea9 4544runnm=$usenm
4545case "$reuseval" in
4546true) runnm=false;;
4633a7c4 4547esac
a4f3eea9 4548
4549: nm options which may be necessary
4550case "$nm_opt" in
4551'') if $test -f /mach_boot; then
1e422769 4552 nm_opt='' # Mach
a4f3eea9 4553 elif $test -d /usr/ccs/lib; then
1e422769 4554 nm_opt='-p' # Solaris (and SunOS?)
a4f3eea9 4555 elif $test -f /dgux; then
1e422769 4556 nm_opt='-p' # DG-UX
2ae324a7 4557 elif $test -f /lib64/rld; then
1e422769 4558 nm_opt='-p' # 64-bit Irix
a4f3eea9 4559 else
4560 nm_opt=''
4561 fi;;
4633a7c4 4562esac
4633a7c4 4563
a4f3eea9 4564: nm options which may be necessary for shared libraries but illegal
4565: for archive libraries. Thank you, Linux.
4566case "$nm_so_opt" in
4567'') case "$myuname" in
4568 *linux*)
693762b4 4569 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
a4f3eea9 4570 nm_so_opt='--dynamic'
4633a7c4 4571 fi
a4f3eea9 4572 ;;
4633a7c4 4573 esac
4633a7c4
LW
4574 ;;
4575esac
4576
a4f3eea9 4577case "$runnm" in
4578true)
4579: get list of predefined functions in a handy place
4580echo " "
4581case "$libc" in
4582'') libc=unknown
4583 case "$libs" in
dfe9444c 4584 *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
a4f3eea9 4585 esac
4586 ;;
4587esac
4588libnames='';
4589case "$libs" in
4590'') ;;
4591*) for thislib in $libs; do
4592 case "$thislib" in
4593 -lc|-lc_s)
4594 : Handle C library specially below.
4595 ;;
4596 -l*)
4597 thislib=`echo $thislib | $sed -e 's/^-l//'`
4598 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
4599 :
4600 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
4601 :
dfe9444c 4602 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
a4f3eea9 4603 :
dfe9444c 4604 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
d97d40b5 4605 :
a4f3eea9 4606 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
4607 :
4608 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
4609 :
dfe9444c 4610 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
a4f3eea9 4611 :
4612 else
4613 try=''
4614 fi
4615 libnames="$libnames $try"
4616 ;;
4617 *) libnames="$libnames $thislib" ;;
4618 esac
4619 done
4620 ;;
4621esac
4622xxx=normal
4623case "$libc" in
4624unknown)
4625 set /lib/libc.$so
4626 for xxx in $libpth; do
4627 $test -r $1 || set $xxx/libc.$so
4628 : The messy sed command sorts on library version numbers.
4629 $test -r $1 || \
4630 set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
28e8609d 4631 tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
a4f3eea9 4632 h
4633 s/[0-9][0-9]*/0000&/g
4634 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
4635 G
4636 s/\n/ /' | \
dfe9444c 4637 sort | $sed -e 's/^.* //'`
a4f3eea9 4638 eval set \$$#
4639 done
4640 $test -r $1 || set /usr/ccs/lib/libc.$so
dfe9444c
AD
4641 $test -r $1 || set /lib/libsys_s$_a
4642 ;;
a4f3eea9 4643*)
4644 set blurfl
4645 ;;
4646esac
4647if $test -r "$1"; then
4648 echo "Your (shared) C library seems to be in $1."
4649 libc="$1"
4650elif $test -r /lib/libc && $test -r /lib/clib; then
4651 echo "Your C library seems to be in both /lib/clib and /lib/libc."
4652 xxx=apollo
4653 libc='/lib/clib /lib/libc'
4654 if $test -r /lib/syslib; then
4655 echo "(Your math library is in /lib/syslib.)"
4656 libc="$libc /lib/syslib"
4657 fi
4658elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4659 echo "Your C library seems to be in $libc, as you said before."
dfe9444c
AD
4660elif $test -r $incpath/usr/lib/libc$_a; then
4661 libc=$incpath/usr/lib/libc$_a;
a4f3eea9 4662 echo "Your C library seems to be in $libc. That's fine."
dfe9444c
AD
4663elif $test -r /lib/libc$_a; then
4664 libc=/lib/libc$_a;
a4f3eea9 4665 echo "Your C library seems to be in $libc. You're normal."
4666else
dfe9444c 4667 if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
a4f3eea9 4668 :
4669 elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
4670 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
4671 elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
4672 :
dfe9444c 4673 elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
a4f3eea9 4674 :
dfe9444c 4675 elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
a4f3eea9 4676 :
4633a7c4 4677 else
dfe9444c 4678 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
4633a7c4 4679 fi
a4f3eea9 4680 if $test -r "$tans"; then
4681 echo "Your C library seems to be in $tans, of all places."
4682 libc=$tans
4683 else
4684 libc='blurfl'
4685 fi
4686fi
4687if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4688 dflt="$libc"
4689 cat <<EOM
4633a7c4 4690
a4f3eea9 4691If the guess above is wrong (which it might be if you're using a strange
4692compiler, or your machine supports multiple models), you can override it here.
4633a7c4 4693
a4f3eea9 4694EOM
4695else
4696 dflt=''
28e8609d 4697 echo $libpth | tr ' ' $trnl | sort | uniq > libpath
a4f3eea9 4698 cat >&4 <<EOM
4699I can't seem to find your C library. I've looked in the following places:
4633a7c4 4700
a4f3eea9 4701EOM
4702 $sed 's/^/ /' libpath
4703 cat <<EOM
4633a7c4 4704
a4f3eea9 4705None of these seems to contain your C library. I need to get its name...
4633a7c4 4706
a4f3eea9 4707EOM
4708fi
4709fn=f
4710rp='Where is your C library?'
4711. ./getfile
4712libc="$ans"
4633a7c4 4713
4633a7c4 4714echo " "
28e8609d 4715echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
a4f3eea9 4716set X `cat libnames`
4633a7c4 4717shift
a4f3eea9 4718xxx=files
4719case $# in 1) xxx=file; esac
4720echo "Extracting names from the following $xxx for later perusal:" >&4
4721echo " "
4722$sed 's/^/ /' libnames >&4
4723echo " "
4724$echo $n "This may take a while...$c" >&4
4633a7c4 4725
dfe9444c
AD
4726for file in $*; do
4727 case $file in
693762b4
AD
4728 *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
4729 *) $nm $nm_opt $file 2>/dev/null;;
a4f3eea9 4730 esac
dfe9444c 4731done >libc.tmp
4633a7c4 4732
a4f3eea9 4733$echo $n ".$c"
4734$grep fprintf libc.tmp > libc.ptf
4735xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
4736xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
4737xxx='[ADTSIW]'
4738if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *_[_.]*//p' -e 's/^.* $xxx *//p'";\
4739 eval $xscan;\
4740 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4741 eval $xrun
4742elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
4743 eval $xscan;\
4744 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4745 eval $xrun
4746elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
4747 eval $xscan;\
4748 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4749 eval $xrun
4750elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
4751 eval $xscan;\
4752 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4753 eval $xrun
4754elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
4755 eval $xscan;\
4756 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4757 eval $xrun
4758elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
4759 eval $xscan;\
4760 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4761 eval $xrun
4762elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
4763 -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
4764 eval $xscan;\
4765 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4766 eval $xrun
4767elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
4768 eval $xscan;\
4769 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4770 eval $xrun
4771elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
4772 eval $xscan;\
4773 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4774 eval $xrun
1e422769 4775elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
4776 eval $xscan;\
4777 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4778 eval $xrun
a4f3eea9 4779elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
4780 eval $xscan;\
4781 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4782 eval $xrun
4783elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
4784 eval $xscan;\
4785 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4786 eval $xrun
44a8e56a 4787elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
4788 eval $xscan;\
4789 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4790 eval $xrun
a4f3eea9 4791else
693762b4 4792 $nm -p $* 2>/dev/null >libc.tmp
a4f3eea9 4793 $grep fprintf libc.tmp > libc.ptf
4794 if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
4795 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
4796 then
4797 nm_opt='-p'
4798 eval $xrun
4633a7c4 4799 else
a4f3eea9 4800 echo " "
e5c9fcd0 4801 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
a4f3eea9 4802 com=''
dc45a647
MB
4803 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
4804 for thisname in $libnames $libc; do
e5c9fcd0 4805 $ar t $thisname >>libc.tmp
a4f3eea9 4806 done
dfe9444c 4807 $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
a4f3eea9 4808 echo "Ok." >&4
dc45a647
MB
4809 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
4810 # Repeat libc to extract forwarders to DLL entries too
4811 for thisname in $libnames $libc; do
4812 $ar tv $thisname >>libc.tmp
4813 # Revision 50 of EMX has bug in $ar.
4814 # it will not extract forwarders to DLL entries
4815 # Use emximp which will extract exactly them.
4816 emximp -o tmp.imp $thisname \
4817 2>/dev/null && \
4818 $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
4819 < tmp.imp >>libc.tmp
4820 $rm tmp.imp
4821 done
4822 $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
4823 echo "Ok." >&4
a4f3eea9 4824 else
e5c9fcd0 4825 echo "$ar didn't seem to work right." >&4
a4f3eea9 4826 echo "Maybe this is a Cray...trying bld instead..." >&4
dfe9444c 4827 if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
a4f3eea9 4828 then
4829 for thisname in $libnames; do
4830 bld t $libnames | \
dfe9444c 4831 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
e5c9fcd0 4832 $ar t $thisname >>libc.tmp
a4f3eea9 4833 done
4834 echo "Ok." >&4
4835 else
4836 echo "That didn't work either. Giving up." >&4
4837 exit 1
4838 fi
4839 fi
4633a7c4 4840 fi
4633a7c4 4841fi
a4f3eea9 4842nm_extract="$com"
4843if $test -f /lib/syscalls.exp; then
4633a7c4 4844 echo " "
a4f3eea9 4845 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
4846 $sed -n 's/^\([^ ]*\)[ ]*syscall$/\1/p' /lib/syscalls.exp >>libc.list
4847fi
4848;;
4849esac
4850$rm -f libnames libpath
4851
2afac517 4852: see if dld is available
4853set dld.h i_dld
4854eval $inhdr
4633a7c4 4855
2afac517 4856: is a C symbol defined?
4857csym='tlook=$1;
4858case "$3" in
4859-v) tf=libc.tmp; tc=""; tdc="";;
4860-a) tf=libc.tmp; tc="[0]"; tdc="[]";;
4861*) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
4862esac;
4863tx=yes;
4864case "$reuseval-$4" in
4865true-) ;;
4866true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
4867esac;
4868case "$tx" in
4869yes)
4870 case "$runnm" in
4871 true)
4872 if $contains $tlook $tf >/dev/null 2>&1;
4873 then tval=true;
4874 else tval=false;
4875 fi;;
4876 *)
4877 echo "main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
dfe9444c 4878 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
2afac517 4879 then tval=true;
4880 else tval=false;
4881 fi;
4882 $rm -f t t.c;;
4883 esac;;
4884*)
4885 case "$tval" in
4886 $define) tval=true;;
4887 *) tval=false;;
4888 esac;;
4889esac;
4890eval "$2=$tval"'
4633a7c4 4891
2afac517 4892: define an is-in-libc? function
4893inlibc='echo " "; td=$define; tu=$undef;
4894sym=$1; var=$2; eval "was=\$$2";
4895tx=yes;
4896case "$reuseval$was" in
4897true) ;;
4898true*) tx=no;;
4899esac;
4900case "$tx" in
4901yes)
4902 set $sym tres -f;
4903 eval $csym;
4904 case "$tres" in
4905 true)
4906 echo "$sym() found." >&4;
4907 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
4908 *)
4909 echo "$sym() NOT found." >&4;
4910 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
4911 esac;;
4912*)
4913 case "$was" in
4914 $define) echo "$sym() found." >&4;;
4915 *) echo "$sym() NOT found." >&4;;
4916 esac;;
4917esac'
4633a7c4 4918
2afac517 4919: see if dlopen exists
4920xxx_runnm="$runnm"
4921runnm=false
4922set dlopen d_dlopen
4923eval $inlibc
4924runnm="$xxx_runnm"
40a7a20a 4925
2afac517 4926: determine which dynamic loading, if any, to compile in
4633a7c4 4927echo " "
2afac517 4928dldir="ext/DynaLoader"
4929case "$usedl" in
4930$define|y|true)
4931 dflt='y'
4932 usedl="$define"
4933 ;;
4934$undef|n|false)
4935 dflt='n'
4936 usedl="$undef"
4937 ;;
4938*)
4939 dflt='n'
4940 case "$d_dlopen" in
4941 $define) dflt='y' ;;
4942 esac
4943 case "$i_dld" in
4944 $define) dflt='y' ;;
4633a7c4 4945 esac
2afac517 4946 : Does a dl_xxx.xs file exist for this operating system
dc45a647 4947 $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
4633a7c4
LW
4948 ;;
4949esac
2afac517 4950rp="Do you wish to use dynamic loading?"
4951. ./myread
4952usedl="$ans"
4953case "$ans" in
4954y*) usedl="$define"
4955 case "$dlsrc" in
4956 '')
dc45a647 4957 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
2afac517 4958 dflt="$dldir/dl_${osname}.xs"
4959 elif $test "$d_dlopen" = "$define" ; then
4960 dflt="$dldir/dl_dlopen.xs"
4961 elif $test "$i_dld" = "$define" ; then
4962 dflt="$dldir/dl_dld.xs"
4633a7c4 4963 else
2afac517 4964 dflt=''
4633a7c4 4965 fi
4633a7c4 4966 ;;
2afac517 4967 *) dflt="$dldir/$dlsrc"
4968 ;;
4633a7c4 4969 esac
2afac517 4970 echo "The following dynamic loading files are available:"
4971 : Can not go over to $dldir because getfile has path hard-coded in.
dc45a647
MB
4972 tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
4973 rp="Source file to use for dynamic loading"
4974 fn="fne"
4975 # XXX This getfile call will fail the existence check if you try
4976 # building away from $src (this is not supported yet).
4977 . ./getfile
2afac517 4978 usedl="$define"
4979 : emulate basename
4980 dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'`
2304df62 4981
dc45a647 4982 $cat << EOM
2304df62 4983
2afac517 4984Some systems may require passing special flags to $cc -c to
4985compile modules that will be used to create a shared library.
4986To use no flags, say "none".
2304df62
AD
4987
4988EOM
2afac517 4989 case "$cccdlflags" in
4990 '') case "$gccversion" in
4991 '') case "$osname" in
4992 hpux) dflt='+z' ;;
4993 next) dflt='none' ;;
8cc95fdb 4994 irix*) dflt='-KPIC' ;;
3a6175e1 4995 svr4*|esix*|solaris) dflt='-KPIC' ;;
2afac517 4996 sunos) dflt='-pic' ;;
4997 *) dflt='none' ;;
dfe9444c
AD
4998 esac
4999 ;;
5000 *) case "$osname" in
3a6175e1 5001 svr4*|esix*|solaris) dflt='-fPIC' ;;
dfe9444c 5002 *) dflt='-fpic' ;;
81d89818 5003 esac ;;
2afac517 5004 esac ;;
bfb7748a 5005 ' ') dflt='none' ;;
2afac517 5006 *) dflt="$cccdlflags" ;;
5007 esac
5008 rp="Any special flags to pass to $cc -c to compile shared library modules?"
5009 . ./myread
5010 case "$ans" in
5011 none) cccdlflags=' ' ;;
5012 *) cccdlflags="$ans" ;;
5013 esac
2304df62 5014
2afac517 5015 cat << EOM
ecfc5424 5016
2afac517 5017Some systems use ld to create libraries that can be dynamically loaded,
5018while other systems (such as those using ELF) use $cc.
a0f45b59 5019
2afac517 5020EOM
5021 case "$ld" in
5022 '') $cat >try.c <<'EOM'
5023/* Test for whether ELF binaries are produced */
5024#include <fcntl.h>
5025#include <stdlib.h>
5026main() {
5027 char b[4];
5028 int i = open("a.out",O_RDONLY);
5029 if(i == -1)
5030 exit(1); /* fail */
5031 if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
5032 exit(0); /* succeed (yes, it's ELF) */
2304df62 5033 else
2afac517 5034 exit(1); /* fail */
5035}
5036EOM
5037 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
5038 cat <<EOM
5039You appear to have ELF support. I'll use $cc to build dynamic libraries.
5040EOM
5041 dflt="$cc"
2304df62 5042 else
2afac517 5043 echo "I'll use ld to build dynamic libraries."
5044 dflt='ld'
2304df62 5045 fi
2afac517 5046 rm -f try.c a.out
5047 ;;
5048 *) dflt="$ld"
5049 ;;
5050 esac
5051
5052 rp="What command should be used to create dynamic libraries?"
5053 . ./myread
5054 ld="$ans"
5055
5056 cat << EOM
5057
5058Some systems may require passing special flags to $ld to create a
5059library that can be dynamically loaded. If your ld flags include
5060-L/other/path options to locate libraries outside your loader's normal
5061search path, you may need to specify those -L options here as well. To
5062use no flags, say "none".
5063
5064EOM
5065 case "$lddlflags" in
5066 '') case "$osname" in
5067 hpux) dflt='-b' ;;
5068 linux|irix*) dflt='-shared' ;;
5069 next) dflt='none' ;;
5070 solaris) dflt='-G' ;;
5071 sunos) dflt='-assert nodefinitions' ;;
5072 svr4*|esix*) dflt="-G $ldflags" ;;
5073 *) dflt='none' ;;
5074 esac
5075 ;;
5076 *) dflt="$lddlflags" ;;
5077 esac
5078
bfb7748a
AD
5079 : Try to guess additional flags to pick up local libraries.
5080 for thisflag in $ldflags; do
5081 case "$thisflag" in
5082 -L*)
5083 case " $dflt " in
5084 *" $thisflag "*) ;;
5085 *) dflt="$dflt $thisflag" ;;
5086 esac
5087 ;;
2afac517 5088 esac
bfb7748a 5089 done
2afac517 5090
bfb7748a
AD
5091 case "$dflt" in
5092 ''|' ') dflt='none' ;;
5093 esac
2afac517 5094
5095 rp="Any special flags to pass to $ld to create a dynamically loaded library?"
5096 . ./myread
5097 case "$ans" in
5098 none) lddlflags=' ' ;;
5099 *) lddlflags="$ans" ;;
5100 esac
5101
5102 cat <<EOM
5103
5104Some systems may require passing special flags to $cc to indicate that
5105the resulting executable will use dynamic linking. To use no flags,
5106say "none".
5107
5108EOM
5109 case "$ccdlflags" in
5110 '') case "$osname" in
5111 hpux) dflt='-Wl,-E' ;;
5112 linux) dflt='-rdynamic' ;;
5113 next) dflt='none' ;;
5114 sunos) dflt='none' ;;
5115 *) dflt='none' ;;
5116 esac ;;
bfb7748a 5117 ' ') dflt='none' ;;
2afac517 5118 *) dflt="$ccdlflags" ;;
5119 esac
5120 rp="Any special flags to pass to $cc to use dynamic loading?"
5121 . ./myread
5122 case "$ans" in
5123 none) ccdlflags=' ' ;;
5124 *) ccdlflags="$ans" ;;
5125 esac
5126 ;;
5127*) usedl="$undef"
5128 ld='ld'
5129 dlsrc='dl_none.xs'
5130 lddlflags=''
5131 ccdlflags=''
5132 ;;
5133esac
5134
5135also=''
5136case "$usedl" in
5137$undef)
5138 # No dynamic loading being used, so don't bother even to prompt.
5139 useshrplib='false'
5140 ;;
5141*) case "$useshrplib" in
5142 '') case "$osname" in
2ae324a7 5143 svr4*|dgux|dynixptx|esix|powerux)
3e3baf6d 5144 dflt=y
2afac517 5145 also='Building a shared libperl is required for dynamic loading to work on your system.'
5146 ;;
5147 next*)
5148 case "$osvers" in
3e3baf6d 5149 4*) dflt=y
2afac517 5150 also='Building a shared libperl is needed for MAB support.'
5151 ;;
3e3baf6d 5152 *) dflt=n
2afac517 5153 ;;
5154 esac
5155 ;;
3e3baf6d 5156 *) dflt=n
2afac517 5157 ;;
5158 esac
5159 ;;
5160 $define|true|[Yy]*)
3e3baf6d 5161 dflt=y
2afac517 5162 ;;
3e3baf6d 5163 *) dflt=n
2afac517 5164 ;;
5165 esac
5166 $cat << EOM
5167
5168The perl executable is normally obtained by linking perlmain.c with
dfe9444c 5169libperl${_a}, any static extensions (usually just DynaLoader), and
2afac517 5170any other libraries needed on this system (such as -lm, etc.). Since
5171your system supports dynamic loading, it is probably possible to build
5172a shared libperl.$so. If you will have more than one executable linked
5173to libperl.$so, this will significantly reduce the size of each
5174executable, but it may have a noticeable affect on performance. The
5175default is probably sensible for your system.
5176$also
5177
5178EOM
5179 rp="Build a shared libperl.$so (y/n)"
5180 . ./myread
5181 case "$ans" in
5182 true|$define|[Yy]*)
5183 useshrplib='true'
5184 # Why does next4 have to be so different?
5185 case "${osname}${osvers}" in
5186 next4*) xxx='DYLD_LIBRARY_PATH' ;;
dc45a647 5187 os2*) xxx='' ;; # Nothing special needed.
2afac517 5188 *) xxx='LD_LIBRARY_PATH' ;;
5189 esac
dc45a647
MB
5190 if test X"$xxx" != "X"; then
5191 $cat <<EOM | $tee -a ../config.msg >&4
2afac517 5192
5193To build perl, you must add the current working directory to your
693762b4 5194$xxx environment variable before running make. You can do
2afac517 5195this with
5196 $xxx=\`pwd\`; export $xxx
5197for Bourne-style shells, or
5198 setenv $xxx \`pwd\`
5199for Csh-style shells. You *MUST* do this before running make.
5200
5201EOM
dc45a647 5202 fi
2afac517 5203 ;;
5204 *) useshrplib='false' ;;
5205 esac
5206 ;;
5207esac
5208
5209case "$useshrplib" in
5210true)
5211 case "$libperl" in
5212 '')
5213 # Figure out a good name for libperl.so. Since it gets stored in
5214 # a version-specific architecture-dependent library, the version
5215 # number isn't really that important, except for making cc/ld happy.
5216 #
5217 # A name such as libperl.so.3.1
5218 majmin="libperl.$so.$patchlevel.$subversion"
5219 # A name such as libperl.so.301
5220 majonly=`echo $patchlevel $subversion |
5221 $awk '{printf "%d%02d", $1, $2}'`
5222 majonly=libperl.$so.$majonly
5223 # I'd prefer to keep the os-specific stuff here to a minimum, and
5224 # rely on figuring it out from the naming of libc.
5225 case "${osname}${osvers}" in
5226 next4*)
5227 dflt=libperl.5.$so
5228 # XXX How handle the --version stuff for MAB?
5229 ;;
5230 linux*) # ld won't link with a bare -lperl otherwise.
5231 dflt=libperl.$so
5232 ;;
5233 *) # Try to guess based on whether libc has major.minor.
5234 case "$libc" in
5235 *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
5236 *libc.$so.[0-9]*) dflt=$majonly ;;
5237 *) dflt=libperl.$so ;;
5238 esac
5239 ;;
5240 esac
5241 ;;
5242 *) dflt=$libperl
5243 ;;
5244 esac
5245 cat << EOM
5246
5247I need to select a good name for the shared libperl. If your system uses
5248library names with major and minor numbers, then you might want something
5249like $majmin. Alternatively, if your system uses a single version
5250number for shared libraries, then you might want to use $majonly.
5251Or, your system might be quite happy with a simple libperl.$so.
5252
5253Since the shared libperl will get installed into a version-specific
5254architecture-dependent directory, the version number of the shared perl
5255library probably isn't important, so the default should be o.k.
5256
5257EOM
5258 rp='What name do you want to give to the shared libperl?'
5259 . ./myread
5260 libperl=$ans
5261 echo "Ok, I'll use $libperl"
5262 ;;
5263*)
dfe9444c 5264 libperl="libperl${_a}"
2afac517 5265 ;;
5266esac
5267
5268# Detect old use of shrpdir via undocumented Configure -Dshrpdir
5269case "$shrpdir" in
5270'') ;;
5271*) $cat >&4 <<EOM
5272WARNING: Use of the shrpdir variable for the installation location of
5273the shared $libperl is not supported. It was never documented and
5ff3f7a4 5274will not work in this version. Let me (jhi@iki.fi)
dfe9444c 5275know of any problems this may cause.
2afac517 5276
5277EOM
5278 case "$shrpdir" in
5279 "$archlibexp/CORE")
5280 $cat >&4 <<EOM
5281But your current setting of $shrpdir is
5282the default anyway, so it's harmless.
5283EOM
5284 ;;
5285 *)
4e2a5f63
AD
5286 $cat >&4 <<EOM
5287Further, your current attempted setting of $shrpdir
5288conflicts with the value of $archlibexp/CORE
5289that installperl will use.
5290EOM
dc45a647
MB
5291 ;;
5292 esac
5293 ;;
5294esac
5295
5296# How will the perl executable find the installed shared $libperl?
5297# Add $xxx to ccdlflags.
5298# If we can't figure out a command-line option, use $shrpenv to
5299# set env LD_RUN_PATH. The main perl makefile uses this.
5300shrpdir=$archlibexp/CORE
5301xxx=''
5302tmp_shrpenv=''
5303if "$useshrplib"; then
5304 case "$osname" in
5305 aix)
5306 # We'll set it in Makefile.SH...
5307 ;;
5308 solaris|netbsd)
5309 xxx="-R $shrpdir"
5310 ;;
5311 freebsd)
5312 xxx="-Wl,-R$shrpdir"
5313 ;;
5314 linux|irix*|dec_osf)
5315 xxx="-Wl,-rpath,$shrpdir"
5316 ;;
5317 next)
5318 # next doesn't like the default...
5319 ;;
5320 *)
5321 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
5322 ;;
5323 esac
5324 case "$xxx" in
5325 '') ;;
5326 *)
5327 # Only add $xxx if it isn't already in ccdlflags.
5328 case " $ccdlflags " in
5329 *" $xxx "*) ;;
5330 *) ccdlflags="$ccdlflags $xxx"
5331 cat <<EOM >&4
5332
5333Adding $xxx to the flags
5334passed to $ld so that the perl executable will find the
5335installed shared $libperl.
5336
5337EOM
5338 ;;
5339 esac
5340 ;;
5341 esac
5342fi
5343# Respect a hint or command-line value.
5344case "$shrpenv" in
5345'') shrpenv="$tmp_shrpenv" ;;
5346esac
5347
5348: determine where manual pages go
5349set man1dir man1dir none
5350eval $prefixit
5351$cat <<EOM
5352
5353$spackage has manual pages available in source form.
5354EOM
5355case "$nroff" in
5356nroff)
5357 echo "However, you don't have nroff, so they're probably useless to you."
5358 case "$man1dir" in
5359 '') man1dir="none";;
5360 esac;;
5361esac
5362echo "If you don't want the manual sources installed, answer 'none'."
5363case "$man1dir" in
5364' ') dflt=none
5365 ;;
5366'')
5367 lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
5368 lookpath="$lookpath $prefixexp/man/p_man/man1"
5369 lookpath="$lookpath $prefixexp/man/u_man/man1"
5370 lookpath="$lookpath $prefixexp/man/man.1"
5371 case "$sysman" in
5372 */?_man*) dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
5373 *) dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
5374 esac
5375 set dflt
5376 eval $prefixup
5377 ;;
5378*) dflt="$man1dir"
5379 ;;
5380esac
5381echo " "
5382fn=dn+~
5383rp="Where do the main $spackage manual pages (source) go?"
5384. ./getfile
5385if $test "X$man1direxp" != "X$ansexp"; then
5386 installman1dir=''
5387fi
5388man1dir="$ans"
5389man1direxp="$ansexp"
5390case "$man1dir" in
5391'') man1dir=' '
5392 installman1dir='';;
5393esac
5394if $afs; then
5395 $cat <<EOM
5396
5397Since you are running AFS, I need to distinguish the directory in which
5398manual pages reside from the directory in which they are installed (and from
5399which they are presumably copied to the former directory by occult means).
5400
5401EOM
5402 case "$installman1dir" in
5403 '') dflt=`echo $man1direxp | sed 's#^/afs/#/afs/.#'`;;
5404 *) dflt="$installman1dir";;
5405 esac
5406 fn=de~
5407 rp='Where will man pages be installed?'
5408 . ./getfile
5409 installman1dir="$ans"
5410else
5411 installman1dir="$man1direxp"
5412fi
5413
5414: What suffix to use on installed man pages
5415
5416case "$man1dir" in
5417' ')
5418 man1ext='0'
5419 ;;
5420*)
5421 rp="What suffix should be used for the main $spackage man pages?"
5422 case "$man1ext" in
5423 '') case "$man1dir" in
5424 *1) dflt=1 ;;
5425 *1p) dflt=1p ;;
5426 *1pm) dflt=1pm ;;
5427 *l) dflt=l;;
5428 *n) dflt=n;;
5429 *o) dflt=o;;
5430 *p) dflt=p;;
5431 *C) dflt=C;;
5432 *L) dflt=L;;
5433 *L1) dflt=L1;;
5434 *) dflt=1;;
5435 esac
5436 ;;
5437 *) dflt="$man1ext";;
5438 esac
5439 . ./myread
5440 man1ext="$ans"
5441 ;;
5442esac
5443
5444: see if we can have long filenames
5445echo " "
5446rmlist="$rmlist /tmp/cf$$"
5447$test -d /tmp/cf$$ || mkdir /tmp/cf$$
5448first=123456789abcdef
5449second=/tmp/cf$$/$first
5450$rm -f $first $second
5451if (echo hi >$first) 2>/dev/null; then
5452 if $test -f 123456789abcde; then
5453 echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4
5454 val="$undef"
5455 else
5456 if (echo hi >$second) 2>/dev/null; then
5457 if $test -f /tmp/cf$$/123456789abcde; then
5458 $cat <<'EOM'
5459That's peculiar... You can have filenames longer than 14 characters, but only
5460on some of the filesystems. Maybe you are using NFS. Anyway, to avoid problems
5461I shall consider your system cannot support long filenames at all.
5462EOM
5463 val="$undef"
5464 else
5465 echo 'You can have filenames longer than 14 characters.' >&4
5466 val="$define"
5467 fi
5468 else
5469 $cat <<'EOM'
5470How confusing! Some of your filesystems are sane enough to allow filenames
5471longer than 14 characters but some others like /tmp can't even think about them.
5472So, for now on, I shall assume your kernel does not allow them at all.
5473EOM
5474 val="$undef"
5475 fi
5476 fi
5477else
5478 $cat <<'EOM'
5479You can't have filenames longer than 14 chars. You can't even think about them!
5480EOM
5481 val="$undef"
5482fi
5483set d_flexfnam
5484eval $setvar
5485$rm -rf /tmp/cf$$ 123456789abcde*
5486
5487: determine where library module manual pages go
5488set man3dir man3dir none
5489eval $prefixit
5490$cat <<EOM
5491
5492$spackage has manual pages for many of the library modules.
5493EOM
5494
5495case "$nroff" in
5496nroff)
5497 $cat <<'EOM'
5498However, you don't have nroff, so they're probably useless to you.
5499EOM
5500 case "$man3dir" in
5501 '') man3dir="none";;
5502 esac;;
5503esac
5504
5505case "$d_flexfnam" in
5506undef)
5507 $cat <<'EOM'
5508However, your system can't handle the long file names like File::Basename.3.
5509EOM
5510 case "$man3dir" in
5511 '') man3dir="none";;
5512 esac;;
5513esac
5514
5515echo "If you don't want the manual sources installed, answer 'none'."
5516prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5517case "$man3dir" in
5518'') case "$prefix" in
5519 *$prog*) dflt=`echo $man1dir |
5520 $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'` ;;
5521 *) dflt="$privlib/man/man3" ;;
2afac517 5522 esac
5523 ;;
dc45a647
MB
5524' ') dflt=none;;
5525*) dflt="$man3dir" ;;
2afac517 5526esac
dc45a647 5527echo " "
2afac517 5528
dc45a647
MB
5529fn=dn+~
5530rp="Where do the $package library man pages (source) go?"
5531. ./getfile
5532if test "X$man3direxp" != "X$ansexp"; then
5533 installman3dir=''
5534fi
2afac517 5535
dc45a647
MB
5536man3dir="$ans"
5537man3direxp="$ansexp"
5538case "$man3dir" in
5539'') man3dir=' '
5540 installman3dir='';;
5541esac
5542if $afs; then
5543 $cat <<EOM
5544
5545Since you are running AFS, I need to distinguish the directory in which
5546manual pages reside from the directory in which they are installed (and from
5547which they are presumably copied to the former directory by occult means).
2afac517 5548
4e2a5f63 5549EOM
dc45a647
MB
5550 case "$installman3dir" in
5551 '') dflt=`echo $man3direxp | sed 's#^/afs/#/afs/.#'`;;
5552 *) dflt="$installman3dir";;
5553 esac
5554 fn=de~
5555 rp='Where will man pages be installed?'
5556 . ./getfile
5557 installman3dir="$ans"
5558else
5559 installman3dir="$man3direxp"
5560fi
5561
5562: What suffix to use on installed man pages
5563
5564case "$man3dir" in
5565' ')
5566 man3ext='0'
5567 ;;
5568*)
5569 rp="What suffix should be used for the $package library man pages?"
5570 case "$man3ext" in
5571 '') case "$man3dir" in
5572 *3) dflt=3 ;;
5573 *3p) dflt=3p ;;
5574 *3pm) dflt=3pm ;;
5575 *l) dflt=l;;
5576 *n) dflt=n;;
5577 *o) dflt=o;;
5578 *p) dflt=p;;
5579 *C) dflt=C;;
5580 *L) dflt=L;;
5581 *L3) dflt=L3;;
5582 *) dflt=3;;
2afac517 5583 esac
5584 ;;
dc45a647 5585 *) dflt="$man3ext";;
2afac517 5586 esac
dc45a647
MB
5587 . ./myread
5588 man3ext="$ans"
5589 ;;
2afac517 5590esac
5591
5592: see if we have to deal with yellow pages, now NIS.
5593if $test -d /usr/etc/yp || $test -d /etc/yp; then
5594 if $test -f /usr/etc/nibindd; then
5595 echo " "
5596 echo "I'm fairly confident you're on a NeXT."
5597 echo " "
5598 rp='Do you get the hosts file via NetInfo?'
5599 dflt=y
5600 case "$hostcat" in
5601 nidump*) ;;
5602 '') ;;
5603 *) dflt=n;;
5604 esac
5605 . ./myread
5606 case "$ans" in
5607 y*) hostcat='nidump hosts .';;
5608 *) case "$hostcat" in
5609 nidump*) hostcat='';;
5610 esac
5611 ;;
5612 esac
5613 fi
5614 case "$hostcat" in
5615 nidump*) ;;
5616 *)
5617 case "$hostcat" in
5618 *ypcat*) dflt=y;;
5619 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
5620 dflt=y
5621 else
5622 dflt=n
5623 fi;;
5624 *) dflt=n;;
5625 esac
5626 echo " "
5627 rp='Are you getting the hosts file via yellow pages?'
5628 . ./myread
5629 case "$ans" in
5630 y*) hostcat='ypcat hosts';;
5631 *) hostcat='cat /etc/hosts';;
5632 esac
5633 ;;
5634 esac
5635fi
dfe9444c
AD
5636case "$hostcat" in
5637'') hostcat='cat /etc/hosts';;
5638esac
5639case "$groupcat" in
5640'') groupcat='cat /etc/group';;
5641esac
5642case "$passcat" in
5643'') passcat='cat /etc/passwd';;
5644esac
2afac517 5645
5646: now get the host name
5647echo " "
5648echo "Figuring out host name..." >&4
5649case "$myhostname" in
5650'') cont=true
5651 echo 'Maybe "hostname" will work...'
5652 if tans=`sh -c hostname 2>&1` ; then
5653 myhostname=$tans
5654 phostname=hostname
5655 cont=''
5656 fi
5657 ;;
5658*) cont='';;
5659esac
5660if $test "$cont"; then
5661 if ./xenix; then
5662 echo 'Oh, dear. Maybe "/etc/systemid" is the key...'
5663 if tans=`cat /etc/systemid 2>&1` ; then
5664 myhostname=$tans
5665 phostname='cat /etc/systemid'
5666 echo "Whadyaknow. Xenix always was a bit strange..."
5667 cont=''
5668 fi
5669 elif $test -r /etc/systemid; then
5670 echo "(What is a non-Xenix system doing with /etc/systemid?)"
5671 fi
5672fi
5673if $test "$cont"; then
5674 echo 'No, maybe "uuname -l" will work...'
5675 if tans=`sh -c 'uuname -l' 2>&1` ; then
5676 myhostname=$tans
5677 phostname='uuname -l'
5678 else
5679 echo 'Strange. Maybe "uname -n" will work...'
5680 if tans=`sh -c 'uname -n' 2>&1` ; then
5681 myhostname=$tans
5682 phostname='uname -n'
5683 else
5684 echo 'Oh well, maybe I can mine it out of whoami.h...'
5685 if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
5686 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
5687 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
5688 else
5689 case "$myhostname" in
5690 '') echo "Does this machine have an identity crisis or something?"
5691 phostname='';;
5692 *)
5693 echo "Well, you said $myhostname before..."
5694 phostname='echo $myhostname';;
5695 esac
5696 fi
5697 fi
5698 fi
5699fi
5700: you do not want to know about this
5701set $myhostname
5702myhostname=$1
5703
5704: verify guess
5705if $test "$myhostname" ; then
5706 dflt=y
5707 rp='Your host name appears to be "'$myhostname'".'" Right?"
5708 . ./myread
5709 case "$ans" in
5710 y*) ;;
5711 *) myhostname='';;
5712 esac
5713fi
5714
5715: bad guess or no guess
5716while $test "X$myhostname" = X ; do
5717 dflt=''
5718 rp="Please type the (one word) name of your host:"
5719 . ./myread
5720 myhostname="$ans"
5721done
5722
5723: translate upper to lower if necessary
5724case "$myhostname" in
5725*[A-Z]*)
5726 echo "(Normalizing case in your host name)"
5727 myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
5728 ;;
5729esac
5730
5731case "$myhostname" in
5732*.*)
5733 dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
5734 myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
5735 echo "(Trimming domain name from host name--host name is now $myhostname)"
5736 ;;
5737*) case "$mydomain" in
5738 '')
5739 {
2afac517 5740 test "X$hostcat" = "Xypcat hosts" &&
5741 ypmatch "$myhostname" hosts 2>/dev/null |\
5742 $sed -e 's/[ ]*#.*//; s/$/ /' > hosts && \
5743 $test -s hosts
5744 } || {
2afac517 5745 $hostcat | $sed -n -e "s/[ ]*#.*//; s/\$/ /
5746 /[ ]$myhostname[ . ]/p" > hosts
5747 }
5748 tmp_re="[ . ]"
5749 $test x`$awk "/[0-9].*[ ]$myhostname$tmp_re/ { sum++ }
5750 END { print sum }" hosts` = x1 || tmp_re="[ ]"
5751 dflt=.`$awk "/[0-9].*[ ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
5752 hosts | $sort | $uniq | \
5753 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
5754 case `$echo X$dflt` in
5755 X*\ *) echo "(Several hosts in /etc/hosts matched hostname)"
5756 dflt=.
5757 ;;
5758 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
5759 ;;
5760 esac
5761 case "$dflt" in
5762 .)
5763 tans=`./loc resolv.conf X /etc /usr/etc`
5764 if $test -f "$tans"; then
5765 echo "(Attempting domain name extraction from $tans)"
a6006777 5766 dflt=.`$sed -n -e 's/ / /g' \
28757baa 5767 -e 's/^search *\([^ ]*\).*/\1/p' $tans \
a6006777 5768 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
2afac517 5769 case "$dflt" in
a6006777 5770 .) dflt=.`$sed -n -e 's/ / /g' \
28757baa 5771 -e 's/^domain *\([^ ]*\).*/\1/p' $tans \
a6006777 5772 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
774d564b 5773 ;;
2afac517 5774 esac
5775 fi
5776 ;;
5777 esac
5778 case "$dflt" in
5779 .) echo "(No help from resolv.conf either -- attempting clever guess)"
5780 dflt=.`sh -c domainname 2>/dev/null`
5781 case "$dflt" in
5782 '') dflt='.';;
5783 .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
5784 esac
5785 ;;
5786 esac
5787 case "$dflt" in
5788 .) echo "(Lost all hope -- silly guess then)"
5789 dflt='.uucp'
5790 ;;
5791 esac
5792 $rm -f hosts
5793 ;;
5794 *) dflt="$mydomain";;
5795 esac;;
5796esac
5797echo " "
5798rp="What is your domain name?"
5799. ./myread
5800tans="$ans"
5801case "$ans" in
5802'') ;;
5803.*) ;;
5804*) tans=".$tans";;
5805esac
5806mydomain="$tans"
5807
5808: translate upper to lower if necessary
5809case "$mydomain" in
5810*[A-Z]*)
5811 echo "(Normalizing case in your domain name)"
5812 mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
5813 ;;
5814esac
5815
5816: a little sanity check here
5817case "$phostname" in
5818'') ;;
5819*)
5820 case `$phostname | ./tr '[A-Z]' '[a-z]'` in
5821 $myhostname$mydomain|$myhostname) ;;
5822 *)
5823 case "$phostname" in
5824 sed*)
5825 echo "(That doesn't agree with your whoami.h file, by the way.)"
5826 ;;
5827 *)
5828 echo "(That doesn't agree with your $phostname command, by the way.)"
5829 ;;
5830 esac
5831 ;;
5832 esac
5833 ;;
5834esac
5835
5836$cat <<EOM
5837
5838I need to get your e-mail address in Internet format if possible, i.e.
5839something like user@host.domain. Please answer accurately since I have
5840no easy means to double check it. The default value provided below
5841is most probably close to the reality but may not be valid from outside
5842your organization...
5843
5844EOM
5845cont=x
5846while test "$cont"; do
5847 case "$cf_email" in
5848 '') dflt="$cf_by@$myhostname$mydomain";;
5849 *) dflt="$cf_email";;
5850 esac
5851 rp='What is your e-mail address?'
5852 . ./myread
5853 cf_email="$ans"
5854 case "$cf_email" in
5855 *@*.*) cont='' ;;
5856 *)
5857 rp='Address does not look like an Internet one. Use it anyway?'
5858 case "$fastread" in
5859 yes) dflt=y ;;
5860 *) dflt=n ;;
5861 esac
5862 . ./myread
5863 case "$ans" in
5864 y*) cont='' ;;
5865 *) echo " " ;;
5866 esac
5867 ;;
5868 esac
5869done
5870
5871$cat <<EOM
5872
5873If you or somebody else will be maintaining perl at your site, please
5874fill in the correct e-mail address here so that they may be contacted
5875if necessary. Currently, the "perlbug" program included with perl
5876will send mail to this address in addition to perlbug@perl.com. You may
5877enter "none" for no administrator.
5878
5879EOM
5880case "$perladmin" in
5881'') dflt="$cf_email";;
5882*) dflt="$perladmin";;
5883esac
5884rp='Perl administrator e-mail address'
5885. ./myread
5886perladmin="$ans"
5887
5f05dabc 5888: figure out how to guarantee perl startup
5889case "$startperl" in
5890'')
5891 case "$sharpbang" in
5892 *!)
5893 $cat <<EOH
5894
5895I can use the #! construct to start perl on your system. This will
5896make startup of perl scripts faster, but may cause problems if you
5897want to share those scripts and perl is not in a standard place
5898($binexp/perl) on all your platforms. The alternative is to force
5899a shell by starting the script with a single ':' character.
5900
5901EOH
5902 dflt="$binexp/perl"
5903 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
5904 . ./myread
5905 case "$ans" in
68dc0745 5906 none) startperl=": # use perl";;
5907 *) startperl="#!$ans"
3e3baf6d 5908 if $test 30 -lt `echo "$ans" | wc -c`; then
68dc0745 5909 $cat >&4 <<EOM
5910
5911WARNING: Some systems limit the #! command to 32 characters.
5912If you experience difficulty running Perl scripts with #!, try
5913installing Perl in a directory with a shorter pathname.
5914
5915EOM
5916 fi ;;
5f05dabc 5917 esac
5918 ;;
5919 *) startperl=": # use perl"
5920 ;;
5921 esac
5922 ;;
5923esac
5924echo "I'll use $startperl to start perl scripts."
5925
5926: figure best path for perl in scripts
5927case "$perlpath" in
5928'')
5929 perlpath="$binexp/perl"
5930 case "$startperl" in
5931 *!*) ;;
5932 *)
5933 $cat <<EOH
5934
5935I will use the "eval 'exec'" idiom to start Perl on your system.
5936I can use the full path of your Perl binary for this purpose, but
5937doing so may cause problems if you want to share those scripts and
5938Perl is not always in a standard place ($binexp/perl).
5939
5940EOH
5941 dflt="$binexp/perl"
5942 rp="What path shall I use in \"eval 'exec'\"?"
5943 . ./myread
5944 perlpath="$ans"
5945 ;;
5946 esac
5947 ;;
5948esac
5949case "$startperl" in
5950*!*) ;;
5951*) echo "I'll use $perlpath in \"eval 'exec'\"" ;;
5952esac
5953
dc45a647
MB
5954: determine where public executable scripts go
5955set scriptdir scriptdir
5956eval $prefixit
5957case "$scriptdir" in
5958'')
5959 dflt="$bin"
5960 : guess some guesses
5961 $test -d /usr/share/scripts && dflt=/usr/share/scripts
5962 $test -d /usr/share/bin && dflt=/usr/share/bin
5963 $test -d /usr/local/script && dflt=/usr/local/script
5964 $test -d $prefixexp/script && dflt=$prefixexp/script
5965 set dflt
5966 eval $prefixup
5967 ;;
5968*) dflt="$scriptdir"
5969 ;;
5970esac
5971$cat <<EOM
5972
5973Some installations have a separate directory just for executable scripts so
5974that they can mount it across multiple architectures but keep the scripts in
5975one spot. You might, for example, have a subdirectory of /usr/share for this.
5976Or you might just lump your scripts in with all your other executables.
5977
5978EOM
5979fn=d~
5980rp='Where do you keep publicly executable scripts?'
5981. ./getfile
5982if $test "X$ansexp" != "X$scriptdirexp"; then
5983 installscript=''
5984fi
5985scriptdir="$ans"
5986scriptdirexp="$ansexp"
5987if $afs; then
5988 $cat <<EOM
5989
5990Since you are running AFS, I need to distinguish the directory in which
5991scripts reside from the directory in which they are installed (and from
5992which they are presumably copied to the former directory by occult means).
5993
5994EOM
5995 case "$installscript" in
5996 '') dflt=`echo $scriptdirexp | sed 's#^/afs/#/afs/.#'`;;
5997 *) dflt="$installscript";;
5998 esac
5999 fn=de~
6000 rp='Where will public scripts be installed?'
6001 . ./getfile
6002 installscript="$ans"
6003else
6004 installscript="$scriptdirexp"
6005fi
6006
6007: determine where site specific libraries go.
3a6175e1 6008: Usual default is /usr/local/lib/perl5/site_perl/$apiversion
bfb7748a
AD
6009prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6010case "$prefix" in
3a6175e1
AD
6011*perl*) set dflt sitelib lib/site_$prog/$apiversion ;;
6012*) set dflt sitelib lib/$package/site_$prog/$apiversion ;;
dc45a647 6013esac
bfb7748a 6014eval $prefixit
dc45a647
MB
6015$cat <<EOM
6016
6017The installation process will also create a directory for
6018site-specific extensions and modules. Some users find it convenient
6019to place all local files in this directory rather than in the main
6020distribution directory.
6021
6022EOM
6023fn=d~+
6024rp='Pathname for the site-specific library files?'
6025. ./getfile
6026if $test "X$sitelibexp" != "X$ansexp"; then
6027 installsitelib=''
6028fi
6029sitelib="$ans"
6030sitelibexp="$ansexp"
6031if $afs; then
6032 $cat <<EOM
6033
6034Since you are running AFS, I need to distinguish the directory in
6035which site-specific files reside from the directory in which they are
6036installed (and from which they are presumably copied to the former
6037directory by occult means).
6038
6039EOM
6040 case "$installsitelib" in
6041 '') dflt=`echo $sitelibexp | sed 's#^/afs/#/afs/.#'`;;
6042 *) dflt="$installsitelib";;
6043 esac
6044 fn=de~
6045 rp='Where will site-specific files be installed?'
6046 . ./getfile
6047 installsitelib="$ans"
6048else
6049 installsitelib="$sitelibexp"
6050fi
6051
6052: determine where site specific architecture-dependent libraries go.
3a6175e1 6053: sitelib default is /usr/local/lib/perl5/site_perl/$apiversion
bfb7748a 6054: sitearch default is /usr/local/lib/perl5/site_perl/$apiversion/$archname
3a6175e1 6055: sitelib may have an optional trailing /share.
bfb7748a
AD
6056tdflt=`echo $sitelib | $sed 's,/share$,,'`
6057tdflt="$tdflt/$archname"
dc45a647
MB
6058set sitearch sitearch none
6059eval $prefixit
6060case "$sitearch" in
bfb7748a 6061'') dflt="$tdflt" ;;
dc45a647
MB
6062*) dflt="$sitearch" ;;
6063esac
6064$cat <<EOM
6065
6066The installation process will also create a directory for
6067architecture-dependent site-specific extensions and modules.
6068
6069EOM
6070fn=nd~+
6071rp='Pathname for the site-specific architecture-dependent library files?'
6072. ./getfile
6073if $test "X$sitearchexp" != "X$ansexp"; then
6074 installsitearch=''
6075fi
6076sitearch="$ans"
6077sitearchexp="$ansexp"
6078if $afs; then
6079 $cat <<EOM
6080
6081Since you are running AFS, I need to distinguish the directory in
6082which site-specific architecture-dependent library files reside from
6083the directory in which they are installed (and from which they are
6084presumably copied to the former directory by occult means).
6085
6086EOM
6087 case "$installsitearch" in
6088 '') dflt=`echo $sitearchexp | sed 's#^/afs/#/afs/.#'`;;
6089 *) dflt="$installsitearch";;
6090 esac
6091 fn=de~
6092 rp='Where will site-specific architecture-dependent files be installed?'
6093 . ./getfile
6094 installsitearch="$ans"
6095else
6096 installsitearch="$sitearchexp"
6097fi
6098
2afac517 6099cat <<EOM
6100
85aff577
CS
6101Previous version of $package used the standard IO mechanisms as defined
6102in <stdio.h>. Versions 5.003_02 and later of perl allow alternate IO
2afac517 6103mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
85aff577
CS
6104the default. This abstraction layer can use AT&T's sfio (if you already
6105have sfio installed) or regular stdio. Using PerlIO with sfio may cause
6106problems with some extension modules. Using PerlIO with stdio is safe,
6107but it is slower than plain stdio and therefore is not the default.
2afac517 6108
6109If this doesn't make any sense to you, just accept the default 'n'.
6110EOM
6111case "$useperlio" in
6112$define|true|[yY]*) dflt='y';;
6113*) dflt='n';;
6114esac
6115rp='Use the experimental PerlIO abstraction layer?'
6116. ./myread
6117case "$ans" in
6118y|Y)
6119 val="$define"
6120 ;;
6121*)
6122 echo "Ok, doing things the stdio way"
6123 val="$undef"
6124 ;;
6125esac
6126set useperlio
6127eval $setvar
2304df62 6128
8e07c86e 6129: Check how to convert floats to strings.
28e8609d 6130if test "X$d_Gconvert" = X; then
5ff3f7a4
GS
6131 echo " "
6132 echo "Checking for an efficient way to convert floats to strings."
6133 $cat >try.c <<'EOP'
8e07c86e
AD
6134#ifdef TRY_gconvert
6135#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
8ff267be 6136char *myname = "gconvert";
8e07c86e
AD
6137#endif
6138#ifdef TRY_gcvt
6139#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
8ff267be 6140char *myname = "gcvt";
8e07c86e
AD
6141#endif
6142#ifdef TRY_sprintf
6143#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
8ff267be 6144char *myname = "sprintf";
8e07c86e 6145#endif
8ff267be 6146
6147#include <stdio.h>
6148
6149int
6150checkit(expect, got)
6151char *expect;
6152char *got;
6153{
6154 if (strcmp(expect, got)) {
6155 printf("%s oddity: Expected %s, got %s\n",
6156 myname, expect, got);
6157 exit(1);
6158 }
6159}
6160
6161int
6162main()
6163{
ecfc5424 6164 char buf[64];
8ff267be 6165 buf[63] = '\0';
6166
6167 /* This must be 1st test on (which?) platform */
6168 /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
6169 Gconvert(0.1, 8, 0, buf);
6170 checkit("0.1", buf);
6171
8e07c86e 6172 Gconvert(1.0, 8, 0, buf);
8ff267be 6173 checkit("1", buf);
6174
8e07c86e 6175 Gconvert(0.0, 8, 0, buf);
8ff267be 6176 checkit("0", buf);
6177
8e07c86e 6178 Gconvert(-1.0, 8, 0, buf);
8ff267be 6179 checkit("-1", buf);
6180
6181 /* Some Linux gcvt's give 1.e+5 here. */
6182 Gconvert(100000.0, 8, 0, buf);
6183 checkit("100000", buf);
6184
6185 /* Some Linux gcvt's give -1.e+5 here. */
6186 Gconvert(-100000.0, 8, 0, buf);
6187 checkit("-100000", buf);
6188
ecfc5424 6189 exit(0);
a0d0e21e
LW
6190}
6191EOP
5ff3f7a4
GS
6192 case "$d_Gconvert" in
6193 gconvert*) xxx_list='gconvert gcvt sprintf' ;;
6194 gcvt*) xxx_list='gcvt gconvert sprintf' ;;
6195 sprintf*) xxx_list='sprintf gconvert gcvt' ;;
6196 *) xxx_list='gconvert gcvt sprintf' ;;
6197 esac
8e07c86e 6198
5ff3f7a4
GS
6199 for xxx_convert in $xxx_list; do
6200 echo "Trying $xxx_convert"
6201 $rm -f try try$_o
6202 set try -DTRY_$xxx_convert
6203 if eval $compile; then
6204 echo "$xxx_convert" found. >&4
6205 if ./try; then
6206 echo "I'll use $xxx_convert to convert floats into a string." >&4
6207 break;
6208 else
6209 echo "...But $xxx_convert didn't work as I expected."
6210 fi
2304df62 6211 else
5ff3f7a4 6212 echo "$xxx_convert NOT found." >&4
2304df62 6213 fi
5ff3f7a4 6214 done
8e07c86e 6215
5ff3f7a4
GS
6216 case "$xxx_convert" in
6217 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
6218 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
6219 *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
6220 esac
28e8609d 6221fi
2304df62 6222
a0d0e21e
LW
6223: Initialize h_fcntl
6224h_fcntl=false
6225
6226: Initialize h_sysfile
6227h_sysfile=false
2304df62 6228
2304df62
AD
6229: access call always available on UNIX
6230set access d_access
6231eval $inlibc
6232
6233: locate the flags for 'access()'
6234case "$d_access" in
6235"$define")
6236 echo " "
6237 $cat >access.c <<'EOCP'
6238#include <sys/types.h>
6239#ifdef I_FCNTL
6240#include <fcntl.h>
6241#endif
6242#ifdef I_SYS_FILE
6243#include <sys/file.h>
6244#endif
6245#ifdef I_UNISTD
6246#include <unistd.h>
6247#endif
6248main() {
6249 exit(R_OK);
6250}
8e07c86e
AD
6251EOCP
6252 : check sys/file.h first, no particular reason here
6253 if $test `./findhdr sys/file.h` && \
dfe9444c 6254 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
8e07c86e
AD
6255 h_sysfile=true;
6256 echo "<sys/file.h> defines the *_OK access constants." >&4
6257 elif $test `./findhdr fcntl.h` && \
dfe9444c 6258 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
8e07c86e
AD
6259 h_fcntl=true;
6260 echo "<fcntl.h> defines the *_OK access constants." >&4
6261 elif $test `./findhdr unistd.h` && \
dfe9444c 6262 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
8e07c86e
AD
6263 echo "<unistd.h> defines the *_OK access constants." >&4
6264 else
6265 echo "I can't find the four *_OK access constants--I'll use mine." >&4
6266 fi
6267 ;;
6268esac
6269$rm -f access*
a0d0e21e 6270
5ff3f7a4
GS
6271: see if accessx exists
6272set accessx d_accessx
6273eval $inlibc
6274
8e07c86e
AD
6275: see if alarm exists
6276set alarm d_alarm
6277eval $inlibc
2304df62 6278
ecfc5424 6279: Look for GNU-cc style attribute checking
2304df62 6280echo " "
a0d0e21e
LW
6281echo "Checking whether your compiler can handle __attribute__ ..." >&4
6282$cat >attrib.c <<'EOCP'
1aef975c 6283#include <stdio.h>
ecfc5424 6284void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
a0d0e21e
LW
6285EOCP
6286if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
6287 if $contains 'warning' attrib.out >/dev/null 2>&1; then
ecfc5424 6288 echo "Your C compiler doesn't fully support __attribute__."
a0d0e21e
LW
6289 val="$undef"
6290 else
ecfc5424 6291 echo "Your C compiler supports __attribute__."
a0d0e21e
LW
6292 val="$define"
6293 fi
6294else
ecfc5424 6295 echo "Your C compiler doesn't seem to understand __attribute__ at all."
a0d0e21e
LW
6296 val="$undef"
6297fi
ecfc5424 6298set d_attribut
a0d0e21e
LW
6299eval $setvar
6300$rm -f attrib*
6301
6302: see if bcmp exists
6303set bcmp d_bcmp
6304eval $inlibc
6305
6306: see if bcopy exists
6307set bcopy d_bcopy
6308eval $inlibc
6309
2afac517 6310: see if this is a unistd.h system
6311set unistd.h i_unistd
6312eval $inhdr
6313
6314: see if getpgrp exists
6315set getpgrp d_getpgrp
6316eval $inlibc
6317
2afac517 6318case "$d_getpgrp" in
6319"$define")
6320 echo " "
dfe9444c 6321 echo "Checking to see which flavor of getpgrp is in use..."
2afac517 6322 $cat >set.c <<EOP
6323#$i_unistd I_UNISTD
6324#include <sys/types.h>
6325#ifdef I_UNISTD
6326# include <unistd.h>
6327#endif
6328main()
6329{
6330 if (getuid() == 0) {
6331 printf("(I see you are running Configure as super-user...)\n");
6332 setuid(1);
6333 }
6334#ifdef TRY_BSD_PGRP
6335 if (getpgrp(1) == 0)
6336 exit(0);
6337#else
6338 if (getpgrp() > 0)
6339 exit(0);
6340#endif
6341 exit(1);
6342}
6343EOP
6344 if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
6345 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
6346 val="$define"
6347 elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
6348 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
6349 val="$undef"
6350 else
6351 echo "I can't seem to compile and run the test program."
6352 if ./usg; then
6353 xxx="a USG one, i.e. you use getpgrp()."
6354 else
6355 # SVR4 systems can appear rather BSD-ish.
6356 case "$i_unistd" in
6357 $undef)
6358 xxx="a BSD one, i.e. you use getpgrp(pid)."
6359 val="$define"
6360 ;;
6361 $define)
6362 xxx="probably a USG one, i.e. you use getpgrp()."
6363 val="$undef"
6364 ;;
6365 esac
6366 fi
6367 echo "Assuming your getpgrp is $xxx" >&4
6368 fi
6369 ;;
6370*) val="$undef";;
6371esac
6372set d_bsdgetpgrp
6373eval $setvar
6374$rm -f set set.c
6375
a0d0e21e
LW
6376: see if setpgrp exists
6377set setpgrp d_setpgrp
6378eval $inlibc
6379
a0d0e21e
LW
6380case "$d_setpgrp" in
6381"$define")
6382 echo " "
dfe9444c 6383 echo "Checking to see which flavor of setpgrp is in use..."
a0d0e21e 6384 $cat >set.c <<EOP
2afac517 6385#$i_unistd I_UNISTD
6386#include <sys/types.h>
6387#ifdef I_UNISTD
6388# include <unistd.h>
6389#endif
a0d0e21e
LW
6390main()
6391{
6392 if (getuid() == 0) {
6393 printf("(I see you are running Configure as super-user...)\n");
6394 setuid(1);
6395 }
2afac517 6396#ifdef TRY_BSD_PGRP
a0d0e21e 6397 if (-1 == setpgrp(1, 1))
2afac517 6398 exit(0);
6399#else
6400 if (setpgrp() != -1)
6401 exit(0);
6402#endif
6403 exit(1);
a0d0e21e
LW
6404}
6405EOP
2afac517 6406 if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
6407 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
6408 val="$define"
6409 elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
6410 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
6411 val="$undef"
a0d0e21e 6412 else
dfe9444c 6413 echo "(I can't seem to compile and run the test program.)"
ecfc5424 6414 if ./usg; then
2afac517 6415 xxx="a USG one, i.e. you use setpgrp()."
a0d0e21e 6416 else
2afac517 6417 # SVR4 systems can appear rather BSD-ish.
6418 case "$i_unistd" in
6419 $undef)
6420 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
6421 val="$define"
6422 ;;
6423 $define)
6424 xxx="probably a USG one, i.e. you use setpgrp()."
6425 val="$undef"
6426 ;;
6427 esac
a0d0e21e 6428 fi
2afac517 6429 echo "Assuming your setpgrp is $xxx" >&4
a0d0e21e
LW
6430 fi
6431 ;;
6432*) val="$undef";;
6433esac
2afac517 6434set d_bsdsetpgrp
a0d0e21e
LW
6435eval $setvar
6436$rm -f set set.c
a0d0e21e
LW
6437: see if bzero exists
6438set bzero d_bzero
6439eval $inlibc
6440
24fef2a7 6441: check for lengths of integral types
a0d0e21e
LW
6442echo " "
6443case "$intsize" in
6444'')
6445 echo "Checking to see how big your integers are..." >&4
24fef2a7 6446 $cat >intsize.c <<'EOCP'
a0d0e21e
LW
6447#include <stdio.h>
6448main()
6449{
24fef2a7
AD
6450 printf("intsize=%d;\n", sizeof(int));
6451 printf("longsize=%d;\n", sizeof(long));
6452 printf("shortsize=%d;\n", sizeof(short));
8e07c86e 6453 exit(0);
a0d0e21e
LW
6454}
6455EOCP
dfe9444c 6456 set intsize
dc45a647 6457 if eval $compile_ok && ./intsize > /dev/null; then
dfe9444c 6458 eval `./intsize`
8e07c86e 6459 echo "Your integers are $intsize bytes long."
24fef2a7
AD
6460 echo "Your long integers are $longsize bytes long."
6461 echo "Your short integers are $shortsize bytes long."
a0d0e21e 6462 else
24fef2a7 6463 $cat >&4 <<EOM
dfe9444c 6464!
24fef2a7
AD
6465Help! I can't compile and run the intsize test program: please enlighten me!
6466(This is probably a misconfiguration in your system or libraries, and
6467you really ought to fix it. Still, I'll try anyway.)
dfe9444c 6468!
24fef2a7
AD
6469EOM
6470 dflt=4
8e07c86e
AD
6471 rp="What is the size of an integer (in bytes)?"
6472 . ./myread
6473 intsize="$ans"
24fef2a7
AD
6474 dflt=$intsize
6475 rp="What is the size of a long integer (in bytes)?"
6476 . ./myread
6477 longsize="$ans"
6478 dflt=2
6479 rp="What is the size of a short integer (in bytes)?"
6480 . ./myread
6481 shortsize="$ans"
a0d0e21e
LW
6482 fi
6483 ;;
a0d0e21e 6484esac
dfe9444c 6485$rm -f intsize intsize.*
a0d0e21e 6486
ecfc5424 6487: see if signal is declared as pointer to function returning int or void
a0d0e21e 6488echo " "
ecfc5424
AD
6489xxx=`./findhdr signal.h`
6490$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
6491if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
6492 echo "You have int (*signal())() instead of void." >&4
6493 val="$undef"
6494elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
dfe9444c 6495 echo "You have void (*signal())()." >&4
ecfc5424
AD
6496 val="$define"
6497elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
6498 echo "You have int (*signal())() instead of void." >&4
6499 val="$undef"
dfe9444c
AD
6500elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
6501 echo "You have void (*signal())()." >&4
6502 val="$define"
a0d0e21e 6503else
ecfc5424
AD
6504 case "$d_voidsig" in
6505 '')
6506 echo "I can't determine whether signal handler returns void or int..." >&4
6507 dflt=void
6508 rp="What type does your signal handler return?"
6509 . ./myread
6510 case "$ans" in
6511 v*) val="$define";;
6512 *) val="$undef";;
6513 esac;;
6514 "$define")
dfe9444c
AD
6515 echo "As you already told me, signal handler returns void." >&4
6516 val="$define"
6517 ;;
6518 *) echo "As you already told me, signal handler returns int." >&4
6519 val="$undef"
6520 ;;
ecfc5424
AD
6521 esac
6522fi
6523set d_voidsig
6524eval $setvar
6525case "$d_voidsig" in
6526"$define") signal_t="void";;
6527*) signal_t="int";;
6528esac
6529$rm -f $$.tmp
6530
6531: check for ability to cast large floats to 32-bit ints.
6532echo " "
6533echo 'Checking whether your C compiler can cast large floats to int32.' >&4
e5c9fcd0 6534if $test "$intsize" -ge 4; then
ecfc5424
AD
6535 xxx=int
6536else
6537 xxx=long
6538fi
6539$cat >try.c <<EOCP
e5c9fcd0 6540#include <stdio.h>
ecfc5424
AD
6541#include <sys/types.h>
6542#include <signal.h>
a1896f58 6543$signal_t blech(s) int s; { exit(3); }
ecfc5424 6544main()
2304df62 6545{
a0d0e21e 6546 $xxx i32;
e5c9fcd0 6547 double f, g;
2304df62 6548 int result = 0;
89434db5 6549 char str[16];
2304df62
AD
6550 signal(SIGFPE, blech);
6551
89434db5
AD
6552 /* Don't let compiler optimize the test away. Store the number
6553 in a writable string for gcc to pass to sscanf under HP/UX.
6554 */
6555 sprintf(str, "2147483647");
6556 sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
e5c9fcd0
AD
6557 g = 10 * f;
6558 i32 = ($xxx) g;
2304df62 6559
e5c9fcd0
AD
6560 /* x86 processors will probably give 0x8000 0000, which is a
6561 sign change. We don't want that. We want to mimic SPARC
6562 behavior here, which is to preserve the sign and give
6563 back 0x7fff ffff.
6564 */
a0d0e21e 6565 if (i32 != ($xxx) f)
2304df62
AD
6566 result |= 1;
6567 exit(result);
6568}
6569EOCP
dfe9444c 6570set try
dc45a647 6571if eval $compile_ok; then
2304df62
AD
6572 ./try
6573 yyy=$?
6574else
a0d0e21e 6575 echo "(I can't seem to compile the test program--assuming it can't)"
2304df62
AD
6576 yyy=1
6577fi
6578case "$yyy" in
65790) val="$define"
6580 echo "Yup, it can."
6581 ;;
6582*) val="$undef"
6583 echo "Nope, it can't."
6584 ;;
6585esac
6586set d_casti32
6587eval $setvar
85e6fe83 6588$rm -f try try.*
a0d0e21e 6589
2304df62
AD
6590: check for ability to cast negative floats to unsigned
6591echo " "
6592echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
ecfc5424 6593$cat >try.c <<EOCP
e5c9fcd0 6594#include <stdio.h>
ecfc5424 6595#include <sys/types.h>
2304df62 6596#include <signal.h>
a1896f58
AD
6597$signal_t blech(s) int s; { exit(7); }
6598$signal_t blech_in_list(s) int s; { exit(4); }
232e078e
AD
6599unsigned long dummy_long(p) unsigned long p; { return p; }
6600unsigned int dummy_int(p) unsigned int p; { return p; }
6601unsigned short dummy_short(p) unsigned short p; { return p; }
2304df62
AD
6602main()
6603{
e5c9fcd0 6604 double f;
2304df62
AD
6605 unsigned long along;
6606 unsigned int aint;
6607 unsigned short ashort;
6608 int result = 0;
89434db5
AD
6609 char str[16];
6610
e5c9fcd0
AD
6611 /* Frustrate gcc-2.7.2's optimizer which failed this test with
6612 a direct f = -123. assignment. gcc-2.8.0 reportedly
6613 optimized the whole file away
6614 */
89434db5
AD
6615 /* Store the number in a writable string for gcc to pass to
6616 sscanf under HP/UX.
6617 */
6618 sprintf(str, "-123");
6619 sscanf(str, "%lf", &f); /* f = -123.; */
2304df62
AD
6620
6621 signal(SIGFPE, blech);
6622 along = (unsigned long)f;
6623 aint = (unsigned int)f;
6624 ashort = (unsigned short)f;
6625 if (along != (unsigned long)-123)
6626 result |= 1;
6627 if (aint != (unsigned int)-123)
6628 result |= 1;
6629 if (ashort != (unsigned short)-123)
6630 result |= 1;
89434db5
AD
6631 sprintf(str, "1073741824.");
6632 sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
2304df62
AD
6633 f = f + f;
6634 along = 0;
6635 along = (unsigned long)f;
6636 if (along != 0x80000000)
6637 result |= 2;
6638 f -= 1.;
6639 along = 0;
6640 along = (unsigned long)f;
6641 if (along != 0x7fffffff)
6642 result |= 1;
6643 f += 2.;
6644 along = 0;
6645 along = (unsigned long)f;
6646 if (along != 0x80000001)
6647 result |= 2;
232e078e
AD
6648 if (result)
6649 exit(result);
6650 signal(SIGFPE, blech_in_list);
89434db5
AD
6651 sprintf(str, "123.");
6652 sscanf(str, "%lf", &f); /* f = 123.; */
232e078e
AD
6653 along = dummy_long((unsigned long)f);
6654 aint = dummy_int((unsigned int)f);
6655 ashort = dummy_short((unsigned short)f);
6656 if (along != (unsigned long)123)
6657 result |= 4;
6658 if (aint != (unsigned int)123)
6659 result |= 4;
6660 if (ashort != (unsigned short)123)
6661 result |= 4;
2304df62
AD
6662 exit(result);
6663
6664}
6665EOCP
dfe9444c 6666set try
dc45a647 6667if eval $compile_ok; then
2304df62
AD
6668 ./try
6669 castflags=$?
6670else
ecfc5424 6671 echo "(I can't seem to compile the test program--assuming it can't)"
232e078e 6672 castflags=7
2304df62
AD
6673fi
6674case "$castflags" in
66750) val="$define"
6676 echo "Yup, it can."
6677 ;;
6678*) val="$undef"
6679 echo "Nope, it can't."
6680 ;;
6681esac
6682set d_castneg
6683eval $setvar
6684$rm -f try.*
6685
2304df62
AD
6686: see if vprintf exists
6687echo " "
6688if set vprintf val -f d_vprintf; eval $csym; $val; then
6689 echo 'vprintf() found.' >&4
6690 val="$define"
6691 $cat >vprintf.c <<'EOF'
6692#include <varargs.h>
6693
6694main() { xxx("foo"); }
6695
6696xxx(va_alist)
6697va_dcl
6698{
6699 va_list args;
6700 char buf[10];
6701
6702 va_start(args);
6703 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
6704}
6705EOF
dfe9444c
AD
6706 set vprintf
6707 if eval $compile && ./vprintf; then
2304df62
AD
6708 echo "Your vsprintf() returns (int)." >&4
6709 val2="$undef"
6710 else
6711 echo "Your vsprintf() returns (char*)." >&4
6712 val2="$define"
6713 fi
6714else
6715 echo 'vprintf() NOT found.' >&4
6716 val="$undef"
6717 val2="$undef"
6718fi
6719set d_vprintf
6720eval $setvar
6721val=$val2
6722set d_charvspr
6723eval $setvar
6724
a0d0e21e
LW
6725: see if chown exists
6726set chown d_chown
6727eval $inlibc
6728
6729: see if chroot exists
6730set chroot d_chroot
6731eval $inlibc
6732
2304df62
AD
6733: see if chsize exists
6734set chsize d_chsize
6735eval $inlibc
6736
6737: check for const keyword
6738echo " "
6739echo 'Checking to see if your C compiler knows about "const"...' >&4
6740$cat >const.c <<'EOCP'
6741typedef struct spug { int drokk; } spug;
6742main()
6743{
6744 const char *foo;
6745 const spug y;
6746}
6747EOCP
6748if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
6749 val="$define"
6750 echo "Yup, it does."
6751else
6752 val="$undef"
6753 echo "Nope, it doesn't."
6754fi
6755set d_const
6756eval $setvar
6757
6758: see if crypt exists
6759echo " "
6760if set crypt val -f d_crypt; eval $csym; $val; then
6761 echo 'crypt() found.' >&4
6762 val="$define"
6763 cryptlib=''
6764else
dfe9444c 6765 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
2304df62 6766 if $test -z "$cryptlib"; then
dfe9444c 6767 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
2304df62
AD
6768 else
6769 cryptlib=-lcrypt
6770 fi
6771 if $test -z "$cryptlib"; then
dfe9444c 6772 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
2304df62
AD
6773 else
6774 cryptlib=-lcrypt
6775 fi
6776 if $test -z "$cryptlib"; then
dfe9444c 6777 cryptlib=`./loc libcrypt$_a "" $libpth`
2304df62
AD
6778 else
6779 cryptlib=-lcrypt
6780 fi
6781 if $test -z "$cryptlib"; then
6782 echo 'crypt() NOT found.' >&4
6783 val="$undef"
6784 else
6785 val="$define"
6786 fi
6787fi
6788set d_crypt
6789eval $setvar
6790
921b2963
JH
6791: get csh whereabouts
6792case "$csh" in
6793'csh') val="$undef" ;;
6794*) val="$define" ;;
6795esac
6796set d_csh
6797eval $setvar
6798: Respect a hint or command line value for full_csh.
6799case "$full_csh" in
6800'') full_csh=$csh ;;
6801esac
6802
a0d0e21e
LW
6803: see if cuserid exists
6804set cuserid d_cuserid
2304df62
AD
6805eval $inlibc
6806
a0d0e21e
LW
6807: see if this is a limits.h system
6808set limits.h i_limits
85e6fe83
LW
6809eval $inhdr
6810
a0d0e21e
LW
6811: see if this is a float.h system
6812set float.h i_float
6813eval $inhdr
6814
6815: See if number of significant digits in a double precision number is known
6816echo " "
6817$cat >dbl_dig.c <<EOM
6818#$i_limits I_LIMITS
6819#$i_float I_FLOAT
6820#ifdef I_LIMITS
6821#include <limits.h>
85e6fe83 6822#endif
a0d0e21e
LW
6823#ifdef I_FLOAT
6824#include <float.h>
6825#endif
6826#ifdef DBL_DIG
6827printf("Contains DBL_DIG");
85e6fe83 6828#endif
85e6fe83 6829EOM
a0d0e21e
LW
6830$cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
6831if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
6832 echo "DBL_DIG found." >&4
6833 val="$define"
2304df62 6834else
a0d0e21e
LW
6835 echo "DBL_DIG NOT found." >&4
6836 val="$undef"
2304df62 6837fi
a0d0e21e
LW
6838$rm -f dbl_dig.?
6839set d_dbl_dig
2304df62 6840eval $setvar
2304df62 6841
5ff3f7a4
GS
6842
6843if $test X"$use64bits" = X"$define"; then
6844 : see if dbminit64 exists
6845 set dbminit64 d_dbminit64
6846 eval $inlibc
6847
6848 : see if dbmclose64 exists
6849 set dbmclose64 d_dbmclose64
6850 eval $inlibc
6851
6852 : see if fetch64 exists
6853 set fetch64 d_fetch64
6854 eval $inlibc
6855
6856 : see if store64 exists
6857 set store64 d_store64
6858 eval $inlibc
6859
6860 : see if delete64 exists
6861 set delete64 d_delete64
6862 eval $inlibc
6863
6864 : see if firstkey64 exists
6865 set firstkey64 d_firstkey64
6866 eval $inlibc
6867
6868 : see if nextkey64 exists
6869 set nextkey64 d_nextkey64
6870 eval $inlibc
6871else
6872 val="$undef"
6873 for xxx in d_dbminit64 d_dbmclose64 d_fetch64 d_store64 d_delete64 d_firstkey64 d_nextkey64
6874 do
6875 set $xxx
6876 eval $setvar
6877 done
6878fi
6879
a0d0e21e
LW
6880: see if difftime exists
6881set difftime d_difftime
2304df62
AD
6882eval $inlibc
6883
5ff3f7a4
GS
6884: see if sys/stat.h is available
6885set sys/stat.h i_sysstat
6886eval $inhdr
6887
a0d0e21e
LW
6888: see if this is a dirent system
6889echo " "
6890if xinc=`./findhdr dirent.h`; $test "$xinc"; then
6891 val="$define"
6892 echo "<dirent.h> found." >&4
6893else
6894 val="$undef"
6895 if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
6896 echo "<sys/dir.h> found." >&4
6897 echo " "
6898 else
6899 xinc=`./findhdr sys/ndir.h`
6900 fi
6901 echo "<dirent.h> NOT found." >&4
6902fi
6903set i_dirent
6904eval $setvar
6905
6906: Look for type of directory structure.
6907echo " "
6908$cppstdin $cppflags $cppminus < "$xinc" > try.c
6909
6910case "$direntrytype" in
6911''|' ')
6912 case "$i_dirent" in
6913 $define) guess1='struct dirent' ;;
6914 *) guess1='struct direct' ;;
2afac517 6915 esac
6916 ;;
6917*) guess1="$direntrytype"
6918 ;;
8e07c86e
AD
6919esac
6920
2afac517 6921case "$guess1" in
6922'struct dirent') guess2='struct direct' ;;
6923*) guess2='struct dirent' ;;
6924esac
6925
6926if $contains "$guess1" try.c >/dev/null 2>&1; then
6927 direntrytype="$guess1"
6928 echo "Your directory entries are $direntrytype." >&4
6929elif $contains "$guess2" try.c >/dev/null 2>&1; then
6930 direntrytype="$guess2"
6931 echo "Your directory entries seem to be $direntrytype." >&4
6932else
6933 echo "I don't recognize your system's directory entries." >&4
6934 rp="What type is used for directory entries on this system?"
6935 dflt="$guess1"
6936 . ./myread
6937 direntrytype="$ans"
6938fi
6939$rm -f try.c
a0d0e21e 6940
a0d0e21e 6941
2afac517 6942: see if the directory entry stores field length
6943echo " "
6944$cppstdin $cppflags $cppminus < "$xinc" > try.c
6945if $contains 'd_namlen' try.c >/dev/null 2>&1; then
6946 echo "Good, your directory entry keeps length information in d_namlen." >&4
6947 val="$define"
6948else
6949 echo "Your directory entry does not know about the d_namlen field." >&4
6950 val="$undef"
6951fi
6952set d_dirnamlen
6953eval $setvar
6954$rm -f try.c
a0d0e21e 6955
5ff3f7a4
GS
6956hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
6957while $test $# -ge 2; do
6958 case "$1" in
6959 $define) echo "#include <$2>";;
6960 esac ;
6961 shift 2;
6962done > try.c;
6963echo "int main () { struct $struct foo; foo.$field = 0; }" >> try.c;
85ab1d1d 6964if eval $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
5ff3f7a4
GS
6965 val="$define";
6966else
5ff3f7a4
GS
6967 val="$undef";
6968fi;
6969set $varname;
6970eval $setvar;
85ab1d1d 6971$rm -f try.c try.o'
a0d0e21e 6972
a0d0e21e 6973
5ff3f7a4
GS
6974if $test X"$use64bits" = X"$define"; then
6975 : see if fstat64 exists
6976 set fstat64 d_fstat64
6977 eval $inlibc
a0d0e21e 6978
5ff3f7a4
GS
6979 : see if ftruncate64 exists
6980 set ftruncate64 d_ftruncate64
6981 eval $inlibc
a0d0e21e 6982
5ff3f7a4
GS
6983 : see if lockf64 exists
6984 set lockf64 d_lockf64
6985 eval $inlibc
a0d0e21e 6986
5ff3f7a4
GS
6987 : see if lseek64 exists
6988 set lseek64 d_lseek64
6989 eval $inlibc
6990
6991 : see if lstat64 exists
6992 set lstat64 d_lstat64
6993 eval $inlibc
6994
6995 : see if open64 exists
6996 set open64 d_open64
6997 eval $inlibc
6998
6999 : see if opendir64 exists
7000 set opendir64 d_opendir64
7001 eval $inlibc
7002
7003 : see if readdir64 exists
7004 set readdir64 d_readdir64
7005 eval $inlibc
7006
7007 : see if seekdir64 exists
7008 set seekdir64 d_seekdir64
7009 eval $inlibc
7010
7011 : see if stat64 exists
7012 set stat64 d_stat64
7013 eval $inlibc
7014
7015 : see if telldir64 exists
7016 set telldir64 d_telldir64
7017 eval $inlibc
7018
7019 : see if truncate64 exists
7020 set truncate64 d_truncate64
7021 eval $inlibc
7022
7023 : check for off64_t
7024 echo " "
7025 echo $n "Checking to see if your system supports off64_t...$c" >&4
7026 $cat >try.c <<EOCP
7027#include <sys/types.h>
7028off64_t foo() { off64_t x; x = 7; return x; }'
7029EOCP
7030 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
7031 val="$define"
7032 echo " Yup, it does." >&4
7033 else
7034 val="$undef"
7035 echo " Nope, it doesn't." >&4
7036 fi
7037 $rm -f try.*
7038 set d_off64t
7039 eval $setvar
7040
7041 : check for ino64_t
7042 echo " "
7043 echo $n "Checking to see if your system supports ino64_t...$c" >&4
7044 val="$undef"
7045 case "$i_sysstat" in
7046 "$define" )
7047 $cat >try.c <<EOCP
7048#include <sys/types.h>
7049#include <sys/stat.h>
7050ino64_t foo() { ino64_t x; x = 7; return x; }'
7051EOCP
7052 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
7053 val="$define"
7054 fi
7055 $rm -f try.*
7056 ;;
7057 esac
7058 if $test "X$val" = X"$define"; then
7059 echo " Yup, it does." >&4
7060 else
7061 echo " Nope, it doesn't." >&4
7062 fi
7063 set d_ino64t
7064 eval $setvar
7065
7066 : check for struct flock64
7067 echo " "
85ab1d1d 7068 echo "Checking to see if your system supports struct flock64..." >&4
5ff3f7a4
GS
7069 if $h_fcntl; then
7070 set d_flock64s flock64 l_len define fcntl.h
7071 eval $hasfield
85ab1d1d
JH
7072 else
7073 val="$undef"
7074 set d_flock64s
7075 eval $setvar
5ff3f7a4 7076 fi
85ab1d1d
JH
7077 case "$d_flock64s" in
7078 "$define") echo "Yup, it does." >&4
7079 ;;
7080 *) echo "Nope, it doesn't." >&4
7081 ;;
7082 esac
5ff3f7a4
GS
7083
7084 : check for struct dirent64
7085 echo " "
85ab1d1d 7086 echo "Checking to see if your system supports struct dirent64..." >&4
5ff3f7a4
GS
7087 set d_dirent64s dirent64 d_off $i_dirent dirent.h
7088 eval $hasfield
85ab1d1d
JH
7089 case "$d_flock64s" in
7090 "$define") echo "Yup, it does." >&4
7091 ;;
7092 *) echo "Nope, it doesn't." >&4
7093 ;;
7094 esac
7095
5ff3f7a4
GS
7096else
7097 val="$undef"
7098 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_off64t d_ino64t d_flock64s d_dirent64s
7099 do
7100 set $xxx
7101 eval $setvar
7102 done
7103fi
7104
7105: see if dlerror exists
7106xxx_runnm="$runnm"
7107runnm=false
7108set dlerror d_dlerror
7109eval $inlibc
7110runnm="$xxx_runnm"
7111
7112: see if dlfcn is available
7113set dlfcn.h i_dlfcn
7114eval $inhdr
7115
7116case "$usedl" in
7117$define|y|true)
7118 $cat << EOM
7119
7120On a few systems, the dynamically loaded modules that perl generates and uses
7121will need a different extension than shared libs. The default will probably
7122be appropriate.
7123
7124EOM
7125 case "$dlext" in
7126 '') dflt="$so" ;;
7127 *) dflt="$dlext" ;;
7128 esac
7129 rp='What is the extension of dynamically loaded modules'
7130 . ./myread
7131 dlext="$ans"
7132 ;;
7133*)
7134 dlext="none"
7135 ;;
7136esac
7137
7138: Check if dlsym need a leading underscore
a0d0e21e
LW
7139echo " "
7140val="$undef"
7141
7142case "$dlsrc" in
7143dl_dlopen.xs)
7144 echo "Checking whether your dlsym() needs a leading underscore ..." >&4
7145 $cat >dyna.c <<'EOM'
7146fred () { }
7147EOM
7148
7149$cat >fred.c<<EOM
7150
7151#include <stdio.h>
7152#$i_dlfcn I_DLFCN
7153#ifdef I_DLFCN
7154#include <dlfcn.h> /* the dynamic linker include file for Sunos/Solaris */
7155#else
7156#include <sys/types.h>
7157#include <nlist.h>
7158#include <link.h>
7159#endif
7160
7161extern int fred() ;
7162
7163main()
7164{
7165 void * handle ;
7166 void * symbol ;
7167#ifndef RTLD_LAZY
7168 int mode = 1 ;
7169#else
7170 int mode = RTLD_LAZY ;
7171#endif
7172 handle = dlopen("./dyna.$dlext", mode) ;
7173 if (handle == NULL) {
5f05dabc 7174 printf ("1\n") ;
7175 fflush (stdout) ;
7176 exit(0);
a0d0e21e
LW
7177 }
7178 symbol = dlsym(handle, "fred") ;
7179 if (symbol == NULL) {
5f05dabc 7180 /* try putting a leading underscore */
7181 symbol = dlsym(handle, "_fred") ;
7182 if (symbol == NULL) {
7183 printf ("2\n") ;
7184 fflush (stdout) ;
7185 exit(0);
7186 }
7187 printf ("3\n") ;
a0d0e21e
LW
7188 }
7189 else
5f05dabc 7190 printf ("4\n") ;
36477c24 7191 fflush (stdout) ;
7192 exit(0);
a0d0e21e
LW
7193}
7194EOM
760ac839 7195 : Call the object file tmp-dyna.o in case dlext=o.
a0d0e21e 7196 if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
dfe9444c
AD
7197 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
7198 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 &&
87563a30 7199 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
a0d0e21e
LW
7200 xxx=`./fred`
7201 case $xxx in
7202 1) echo "Test program failed using dlopen." >&4
7203 echo "Perhaps you should not use dynamic loading." >&4;;
7204 2) echo "Test program failed using dlsym." >&4
7205 echo "Perhaps you should not use dynamic loading." >&4;;
7206 3) echo "dlsym needs a leading underscore" >&4
7207 val="$define" ;;
7208 4) echo "dlsym doesn't need a leading underscore." >&4;;
7209 esac
7210 else
7211 echo "I can't compile and run the test program." >&4
7212 fi
7213 ;;
7214esac
7215
a78b0d02 7216$rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
a0d0e21e
LW
7217
7218set d_dlsymun
7219eval $setvar
7220
85ab1d1d
JH
7221hasproto='varname=$1; func=$2; shift; shift;
7222while $test $# -ge 2; do
7223 case "$1" in
7224 $define) echo "#include <$2>";;
7225 esac ;
7226 shift 2;
7227done > try.c;
7228$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
7229if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
7230 echo "$func() prototype found.";
7231 val="$define";
7232else
7233 echo "$func() prototype NOT found.";
7234 val="$undef";
7235fi;
7236set $varname;
7237eval $setvar;
7238$rm -f try.c tryout.c'
7239
7240: see if prototype for drand48 is available
7241echo " "
7242set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
7243eval $hasproto
7244
a0d0e21e
LW
7245: see if dup2 exists
7246set dup2 d_dup2
7247eval $inlibc
7248
5ff3f7a4
GS
7249: see if eaccess exists
7250set eaccess d_eaccess
7251eval $inlibc
7252
7253: see if endgrent exists
7254set endgrent d_endgrent
7255eval $inlibc
7256
e5c9fcd0
AD
7257: see if endhostent exists
7258set endhostent d_endhent
7259eval $inlibc
7260
7261: see if endnetent exists
7262set endnetent d_endnent
7263eval $inlibc
7264
7265: see if endprotoent exists
7266set endprotoent d_endpent
7267eval $inlibc
7268
5ff3f7a4
GS
7269: see if endpwent exists
7270set endpwent d_endpwent
7271eval $inlibc
7272
e5c9fcd0
AD
7273: see if endservent exists
7274set endservent d_endsent
7275eval $inlibc
7276
8e07c86e
AD
7277: Locate the flags for 'open()'
7278echo " "
7279$cat >open3.c <<'EOCP'
7280#include <sys/types.h>
7281#ifdef I_FCNTL
7282#include <fcntl.h>
7283#endif
7284#ifdef I_SYS_FILE
7285#include <sys/file.h>
7286#endif
7287main() {
7288 if(O_RDONLY);
7289#ifdef O_TRUNC
7290 exit(0);
7291#else
7292 exit(1);
7293#endif
7294}
7295EOCP
7296: check sys/file.h first to get FREAD on Sun
7297if $test `./findhdr sys/file.h` && \
dfe9444c 7298 set open3 -DI_SYS_FILE && eval $compile; then
8e07c86e
AD
7299 h_sysfile=true;
7300 echo "<sys/file.h> defines the O_* constants..." >&4
7301 if ./open3; then
7302 echo "and you have the 3 argument form of open()." >&4
7303 val="$define"
7304 else
7305 echo "but not the 3 argument form of open(). Oh, well." >&4
7306 val="$undef"
7307 fi
7308elif $test `./findhdr fcntl.h` && \
dfe9444c 7309 set open3 -DI_FCNTL && eval $compile; then
8e07c86e
AD
7310 h_fcntl=true;
7311 echo "<fcntl.h> defines the O_* constants..." >&4
7312 if ./open3; then
7313 echo "and you have the 3 argument form of open()." >&4
7314 val="$define"
7315 else
7316 echo "but not the 3 argument form of open(). Oh, well." >&4
7317 val="$undef"
7318 fi
7319else
7320 val="$undef"
7321 echo "I can't find the O_* constant definitions! You got problems." >&4
7322fi
7323set d_open3
7324eval $setvar
7325$rm -f open3*
7326
7327: check for non-blocking I/O stuff
7328case "$h_sysfile" in
7329true) echo "#include <sys/file.h>" > head.c;;
7330*)
7331 case "$h_fcntl" in
7332 true) echo "#include <fcntl.h>" > head.c;;
7333 *) echo "#include <sys/fcntl.h>" > head.c;;
7334 esac
7335 ;;
7336esac
7337echo " "
7338echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
7339case "$o_nonblock" in
7340'')
7341 $cat head.c > try.c
7342 $cat >>try.c <<'EOCP'
7343main() {
7344#ifdef O_NONBLOCK
7345 printf("O_NONBLOCK\n");
7346 exit(0);
7347#endif
7348#ifdef O_NDELAY
7349 printf("O_NDELAY\n");
7350 exit(0);
7351#endif
7352#ifdef FNDELAY
7353 printf("FNDELAY\n");
7354 exit(0);
7355#endif
7356 exit(0);
7357}
7358EOCP
dfe9444c 7359 set try
dc45a647 7360 if eval $compile_ok; then
8e07c86e
AD
7361 o_nonblock=`./try`
7362 case "$o_nonblock" in
7363 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
7364 *) echo "Seems like we can use $o_nonblock.";;
7365 esac
7366 else
7367 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
7368 fi
7369 ;;
7370*) echo "Using $hint value $o_nonblock.";;
7371esac
7372$rm -f try try.* .out core
7373
7374echo " "
7375echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
7376case "$eagain" in
7377'')
7378 $cat head.c > try.c
7379 $cat >>try.c <<EOCP
7380#include <errno.h>
7381#include <sys/types.h>
7382#include <signal.h>
4633a7c4 7383#define MY_O_NONBLOCK $o_nonblock
dc45a647 7384#ifndef errno /* XXX need better Configure test */
8e07c86e 7385extern int errno;
dc45a647 7386#endif
8e07c86e 7387$signal_t blech(x) int x; { exit(3); }
4633a7c4
LW
7388EOCP
7389 $cat >> try.c <<'EOCP'
8e07c86e
AD
7390main()
7391{
7392 int pd[2];
7393 int pu[2];
7394 char buf[1];
7395 char string[100];
7396
7397 pipe(pd); /* Down: child -> parent */
7398 pipe(pu); /* Up: parent -> child */
7399 if (0 != fork()) {
7400 int ret;
7401 close(pd[1]); /* Parent reads from pd[0] */
7402 close(pu[0]); /* Parent writes (blocking) to pu[1] */
4633a7c4 7403 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8e07c86e
AD
7404 exit(1);
7405 signal(SIGALRM, blech);
7406 alarm(5);
7407 if ((ret = read(pd[0], buf, 1)) > 0) /* Nothing to read! */
7408 exit(2);
7409 sprintf(string, "%d\n", ret);
7410 write(2, string, strlen(string));
7411 alarm(0);
7412#ifdef EAGAIN
7413 if (errno == EAGAIN) {
7414 printf("EAGAIN\n");
7415 goto ok;
7416 }
7417#endif
7418#ifdef EWOULDBLOCK
7419 if (errno == EWOULDBLOCK)
7420 printf("EWOULDBLOCK\n");
7421#endif
7422 ok:
7423 write(pu[1], buf, 1); /* Unblocks child, tell it to close our pipe */
7424 sleep(2); /* Give it time to close our pipe */
7425 alarm(5);
7426 ret = read(pd[0], buf, 1); /* Should read EOF */
7427 alarm(0);
7428 sprintf(string, "%d\n", ret);
7429 write(3, string, strlen(string));
7430 exit(0);
7431 }
7432
7433 close(pd[0]); /* We write to pd[1] */
7434 close(pu[1]); /* We read from pu[0] */
7435 read(pu[0], buf, 1); /* Wait for parent to signal us we may continue */
7436 close(pd[1]); /* Pipe pd is now fully closed! */
7437 exit(0); /* Bye bye, thank you for playing! */
7438}
7439EOCP
dfe9444c 7440 set try
dc45a647 7441 if eval $compile_ok; then
774d564b 7442 echo "$startsh" >mtry
40a7a20a 7443 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8e07c86e
AD
7444 chmod +x mtry
7445 ./mtry >/dev/null 2>&1
7446 case $? in
7447 0) eagain=`$cat try.out`;;
7448 1) echo "Could not perform non-blocking setting!";;
7449 2) echo "I did a successful read() for something that was not there!";;
7450 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
7451 *) echo "Something terribly wrong happened during testing.";;
7452 esac
7453 rd_nodata=`$cat try.ret`
7454 echo "A read() system call with no data present returns $rd_nodata."
7455 case "$rd_nodata" in
7456 0|-1) ;;
7457 *)
7458 echo "(That's peculiar, fixing that to be -1.)"
7459 rd_nodata=-1
7460 ;;
7461 esac
7462 case "$eagain" in
7463 '')
7464 echo "Forcing errno EAGAIN on read() with no data available."
7465 eagain=EAGAIN
7466 ;;
7467 *)
7468 echo "Your read() sets errno to $eagain when no data is available."
7469 ;;
7470 esac
7471 status=`$cat try.err`
7472 case "$status" in
7473 0) echo "And it correctly returns 0 to signal EOF.";;
7474 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
7475 *) echo "However, your read() returns '$status' on EOF??";;
7476 esac
7477 val="$define"
28757baa 7478 if test "$status" = "$rd_nodata"; then
8e07c86e
AD
7479 echo "WARNING: you can't distinguish between EOF and no data!"
7480 val="$undef"
7481 fi
7482 else
7483 echo "I can't compile the test program--assuming errno EAGAIN will do."
7484 eagain=EAGAIN
7485 fi
7486 set d_eofnblk
7487 eval $setvar
7488 ;;
7489*)
7490 echo "Using $hint value $eagain."
7491 echo "Your read() returns $rd_nodata when no data is present."
7492 case "$d_eofnblk" in
7493 "$define") echo "And you can see EOF because read() returns 0.";;
7494 "$undef") echo "But you can't see EOF status from read() returned value.";;
7495 *)
7496 echo "(Assuming you can't see EOF status from read anyway.)"
7497 d_eofnblk=$undef
7498 ;;
7499 esac
7500 ;;
7501esac
7502$rm -f try try.* .out core head.c mtry
7503
a0d0e21e
LW
7504: see if fchmod exists
7505set fchmod d_fchmod
7506eval $inlibc
7507
7508: see if fchown exists
7509set fchown d_fchown
7510eval $inlibc
7511
7512: see if this is an fcntl system
7513set fcntl d_fcntl
7514eval $inlibc
7515
921b2963
JH
7516socketlib=''
7517sockethdr=''
7518: see whether socket exists
7519echo " "
7520$echo $n "Hmm... $c" >&4
7521if set socket val -f d_socket; eval $csym; $val; then
7522 echo "Looks like you have Berkeley networking support." >&4
7523 d_socket="$define"
7524 if set setsockopt val -f; eval $csym; $val; then
7525 d_oldsock="$undef"
7526 else
5cc3184f 7527 echo "...but it uses the old BSD 4.1c interface, rather than 4.2" >&4
921b2963
JH
7528 d_oldsock="$define"
7529 fi
7530else
7531 if $contains socklib libc.list >/dev/null 2>&1; then
7532 echo "Looks like you have Berkeley networking support." >&4
7533 d_socket="$define"
7534 : we will have to assume that it supports the 4.2 BSD interface
7535 d_oldsock="$undef"
7536 else
7537 echo "You don't have Berkeley networking in libc$_a..." >&4
5cc3184f
JH
7538 if test "X$d_socket" = "X$define"; then
7539 echo "...but you seem to believe that you have sockets." >&4
7540 else
7541 for net in net socket
7542 do
7543 if test -f /usr/lib/lib$net$_a; then
7544 ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) || \
7545 $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
7546 if $contains socket libc.list >/dev/null 2>&1; then
7547 d_socket="$define"
7548 socketlib="-l$net"
7549 case "$net" in
7550 net)
7551 echo "...but the Wollongong group seems to have hacked it in." >&4
7552 sockethdr="-I/usr/netinclude"
7553 ;;
7554 esac
7555 echo "Found Berkeley sockets interface in lib$net." >& 4
7556 if $contains setsockopt libc.list >/dev/null 2>&1; then
7557 d_oldsock="$undef"
7558 else
7559 echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
7560 d_oldsock="$define"
7561 fi
7562 break
921b2963 7563 fi
921b2963 7564 fi
5cc3184f
JH
7565 done
7566 if test "X$d_socket" != "X$define"; then
7567 echo "or anywhere else I see." >&4
7568 d_socket="$undef"
7569 d_oldsock="$undef"
921b2963 7570 fi
921b2963
JH
7571 fi
7572 fi
7573fi
7574
7575: see if socketpair exists
7576set socketpair d_sockpair
7577eval $inlibc
7578
7579: see if sys/select.h has to be included
7580set sys/select.h i_sysselct
7581eval $inhdr
7582
7583: see if we should include time.h, sys/time.h, or both
7584echo " "
7585if test "X$timeincl" = X; then
7586 echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
7587 $echo $n "I'm now running the test program...$c"
7588 $cat >try.c <<'EOCP'
7589#include <sys/types.h>
7590#ifdef I_TIME
7591#include <time.h>
7592#endif
7593#ifdef I_SYSTIME
7594#ifdef SYSTIMEKERNEL
7595#define KERNEL
7596#endif
7597#include <sys/time.h>
7598#endif
7599#ifdef I_SYSSELECT
7600#include <sys/select.h>
7601#endif
7602main()
7603{
7604 struct tm foo;
7605#ifdef S_TIMEVAL
7606 struct timeval bar;
7607#endif
7608#ifdef S_TIMEZONE
7609 struct timezone tzp;
7610#endif
7611 if (foo.tm_sec == foo.tm_sec)
7612 exit(0);
7613#ifdef S_TIMEVAL
7614 if (bar.tv_sec == bar.tv_sec)
7615 exit(0);
7616#endif
7617 exit(1);
7618}
7619EOCP
7620 flags=''
7621 for s_timezone in '-DS_TIMEZONE' ''; do
7622 sysselect=''
7623 for s_timeval in '-DS_TIMEVAL' ''; do
7624 for i_systimek in '' '-DSYSTIMEKERNEL'; do
7625 for i_time in '' '-DI_TIME'; do
7626 for i_systime in '-DI_SYSTIME' ''; do
7627 case "$flags" in
7628 '') $echo $n ".$c"
7629 set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
7630 if eval $compile; then
7631 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
7632 shift
7633 flags="$*"
7634 echo " "
7635 $echo $n "Succeeded with $flags$c"
7636 fi
7637 ;;
7638 esac
7639 done
7640 done
7641 done
7642 done
7643 done
7644 timeincl=''
7645 echo " "
7646 case "$flags" in
7647 *SYSTIMEKERNEL*) i_systimek="$define"
7648 timeincl=`./findhdr sys/time.h`
7649 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
7650 *) i_systimek="$undef";;
7651 esac
7652 case "$flags" in
7653 *I_TIME*) i_time="$define"
7654 timeincl=`./findhdr time.h`" $timeincl"
7655 echo "We'll include <time.h>." >&4;;
7656 *) i_time="$undef";;
7657 esac
7658 case "$flags" in
7659 *I_SYSTIME*) i_systime="$define"
7660 timeincl=`./findhdr sys/time.h`" $timeincl"
7661 echo "We'll include <sys/time.h>." >&4;;
7662 *) i_systime="$undef";;
7663 esac
7664 $rm -f try.c try
7665fi
7666
7667: check for fd_set items
7668$cat <<EOM
7669
7670Checking to see how well your C compiler handles fd_set and friends ...
7671EOM
7672$cat >fd_set.c <<EOCP
7673#$i_systime I_SYS_TIME
7674#$i_sysselct I_SYS_SELECT
7675#$d_socket HAS_SOCKET
7676#include <sys/types.h>
7677#ifdef HAS_SOCKET
7678#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
7679#endif
7680#ifdef I_SYS_TIME
7681#include <sys/time.h>
7682#endif
7683#ifdef I_SYS_SELECT
7684#include <sys/select.h>
7685#endif
7686main() {
7687 fd_set fds;
7688
7689#ifdef TRYBITS
7690 if(fds.fds_bits);
7691#endif
7692
7693#if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
7694 exit(0);
7695#else
7696 exit(1);
7697#endif
7698}
7699EOCP
7700set fd_set -DTRYBITS
7701if eval $compile; then
7702 d_fds_bits="$define"
7703 d_fd_set="$define"
7704 echo "Well, your system knows about the normal fd_set typedef..." >&4
7705 if ./fd_set; then
7706 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
7707 d_fd_macros="$define"
7708 else
7709 $cat >&4 <<'EOM'
7710but not the normal fd_set macros! Gaaack! I'll have to cover for you.
7711EOM
7712 d_fd_macros="$undef"
7713 fi
7714else
7715 $cat <<'EOM'
7716Hmm, your compiler has some difficulty with fd_set. Checking further...
7717EOM
7718 set fd_set
7719 if eval $compile; then
7720 d_fds_bits="$undef"
7721 d_fd_set="$define"
7722 echo "Well, your system has some sort of fd_set available..." >&4
7723 if ./fd_set; then
7724 echo "and you have the normal fd_set macros." >&4
7725 d_fd_macros="$define"
7726 else
7727 $cat <<'EOM'
7728but not the normal fd_set macros! Gross! More work for me...
7729EOM
7730 d_fd_macros="$undef"
7731 fi
7732 else
7733 echo "Well, you got zip. That's OK, I can roll my own fd_set stuff." >&4
7734 d_fd_set="$undef"
7735 d_fds_bits="$undef"
7736 d_fd_macros="$undef"
7737 fi
7738fi
7739$rm -f fd_set*
7740
a0d0e21e
LW
7741: see if fgetpos exists
7742set fgetpos d_fgetpos
7743eval $inlibc
7744
5ff3f7a4
GS
7745
7746if $test X"$use64bits" = X"$define"; then
7747 : see if fgetpos64 exists
7748 set fgetpos64 d_fgetpos64
7749 eval $inlibc
7750
7751 : see if fopen64 exists
7752 set freopen64 d_fopen64
7753 eval $inlibc
7754
7755 : see if freopen64 exists
7756 set freopen64 d_freopen64
7757 eval $inlibc
7758
7759 : see if fseek64 exists
7760 set fseek64 d_fseek64
7761 eval $inlibc
7762
7763 : see if fseeko64 exists
7764 set fseeko64 d_fseeko64
7765 eval $inlibc
7766
7767 : see if fsetpos64 exists
7768 set fsetpos64 d_fsetpos64
7769 eval $inlibc
7770
7771 : see if ftell64 exists
7772 set ftell64 d_ftell64
7773 eval $inlibc
7774
7775 : see if ftello64 exists
7776 set ftello64 d_ftello64
7777 eval $inlibc
7778
7779 : see if tmpfile64 exists
7780 set tmpfile64 d_tmpfile64
7781 eval $inlibc
7782else
7783 val="$undef"
7784 for xxx in d_fgetpos64 d_fopen64 d_freopen64 d_fseek64 d_fseeko64 d_fsetpos64 d_ftell64 d_ftello64 d_tmpfile64
7785 do
7786 set $xxx
7787 eval $setvar
7788 done
7789fi
7790
a0d0e21e
LW
7791: see if flock exists
7792set flock d_flock
7793eval $inlibc
7794
a0d0e21e
LW
7795: see if fork exists
7796set fork d_fork
7797eval $inlibc
7798
7799: see if pathconf exists
7800set pathconf d_pathconf
7801eval $inlibc
7802
7803: see if fpathconf exists
7804set fpathconf d_fpathconf
7805eval $inlibc
7806
5ff3f7a4
GS
7807: see if fseeko exists
7808set fseeko d_fseeko
7809eval $inlibc
7810
a0d0e21e
LW
7811: see if fsetpos exists
7812set fsetpos d_fsetpos
7813eval $inlibc
7814
5ff3f7a4
GS
7815: see if ftello exists
7816set ftello d_ftello
7817eval $inlibc
7818
7819: see if getgrent exists
7820set getgrent d_getgrent
7821eval $inlibc
7822
693762b4
AD
7823: see if gethostbyaddr exists
7824set gethostbyaddr d_gethbyaddr
7825eval $inlibc
7826
7827: see if gethostbyname exists
7828set gethostbyname d_gethbyname
7829eval $inlibc
7830
a0d0e21e
LW
7831: see if gethostent exists
7832set gethostent d_gethent
7833eval $inlibc
7834
921b2963
JH
7835: see how we will look up host name
7836echo " "
7837if false; then
7838 : dummy stub to allow use of elif
7839elif set gethostname val -f d_gethname; eval $csym; $val; then
7840 echo 'gethostname() found.' >&4
7841 d_gethname="$define"
7842 call=gethostname
7843elif set uname val -f d_uname; eval $csym; $val; then
7844 if ./xenix; then
7845 $cat <<'EOM'
7846uname() was found, but you're running xenix, and older versions of xenix
7847have a broken uname(). If you don't really know whether your xenix is old
7848enough to have a broken system call, use the default answer.
7849
7850EOM
7851 dflt=y
7852 case "$d_uname" in
7853 "$define") dflt=n;;
7854 esac
7855 rp='Is your uname() broken?'
7856 . ./myread
7857 case "$ans" in
7858 n*) d_uname="$define"; call=uname;;
7859 esac
7860 else
7861 echo 'uname() found.' >&4
7862 d_uname="$define"
7863 call=uname
7864 fi
7865fi
7866case "$d_gethname" in
7867'') d_gethname="$undef";;
7868esac
7869case "$d_uname" in
7870'') d_uname="$undef";;
7871esac
7872case "$d_uname$d_gethname" in
7873*define*)
7874 dflt=n
7875 cat <<EOM
7876
7877Every now and then someone has a $call() that lies about the hostname
7878but can't be fixed for political or economic reasons. If you wish, I can
7879pretend $call() isn't there and maybe compute hostname at run-time
7880thanks to the '$phostname' command.
7881
7882EOM
7883 rp="Shall I ignore $call() from now on?"
7884 . ./myread
7885 case "$ans" in
7886 y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
7887 esac;;
7888esac
7889case "$phostname" in
7890'') aphostname='';;
7891*) case "$aphostname" in
7892 /*) ;;
7893 *) set X $phostname
7894 shift
7895 file=$1
7896 shift
7897 file=`./loc $file $file $pth`
7898 aphostname=`echo $file $*`
7899 ;;
7900 esac
7901 ;;
7902esac
7903case "$d_uname$d_gethname" in
7904*define*) ;;
7905*)
7906 case "$phostname" in
7907 '')
7908 echo "There will be no way for $package to get your hostname." >&4;;
7909 *)
7910 echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
7911 ;;
7912 esac;;
7913esac
7914case "$d_phostname" in
7915'') d_phostname="$undef";;
7916esac
7917
dc45a647
MB
7918: see if this is a netdb.h system
7919set netdb.h i_netdb
7920eval $inhdr
7921
7922: see if prototypes for various gethostxxx netdb.h functions are available
7923echo " "
7924set d_gethostprotos gethostent $i_netdb netdb.h
7925eval $hasproto
7926
a0d0e21e
LW
7927: see if getlogin exists
7928set getlogin d_getlogin
7929eval $inlibc
7930
693762b4
AD
7931: see if getnetbyaddr exists
7932set getnetbyaddr d_getnbyaddr
7933eval $inlibc
7934
7935: see if getnetbyname exists
7936set getnetbyname d_getnbyname
7937eval $inlibc
7938
e5c9fcd0
AD
7939: see if getnetent exists
7940set getnetent d_getnent
7941eval $inlibc
7942
dc45a647
MB
7943: see if prototypes for various getnetxxx netdb.h functions are available
7944echo " "
7945set d_getnetprotos getnetent $i_netdb netdb.h
7946eval $hasproto
7947
693762b4
AD
7948
7949: see if getprotobyname exists
7950set getprotobyname d_getpbyname
7951eval $inlibc
7952
7953: see if getprotobynumber exists
7954set getprotobynumber d_getpbynumber
7955eval $inlibc
e5c9fcd0
AD
7956
7957: see if getprotoent exists
7958set getprotoent d_getpent
7959eval $inlibc
7960
2afac517 7961: see if getpgid exists
7962set getpgid d_getpgid
a0d0e21e
LW
7963eval $inlibc
7964
7965: see if getpgrp2 exists
7966set getpgrp2 d_getpgrp2
7967eval $inlibc
7968
7969: see if getppid exists
7970set getppid d_getppid
7971eval $inlibc
7972
7973: see if getpriority exists
7974set getpriority d_getprior
7975eval $inlibc
7976
dc45a647
MB
7977: see if prototypes for various getprotoxxx netdb.h functions are available
7978echo " "
7979set d_getprotoprotos getprotoent $i_netdb netdb.h
7980eval $hasproto
7981
5ff3f7a4
GS
7982: see if getpwent exists
7983set getpwent d_getpwent
7984eval $inlibc
7985
7986
693762b4
AD
7987: see if getservbyname exists
7988set getservbyname d_getsbyname
7989eval $inlibc
7990
7991: see if getservbyport exists
7992set getservbyport d_getsbyport
7993eval $inlibc
e5c9fcd0
AD
7994
7995: see if getservent exists
7996set getservent d_getsent
7997eval $inlibc
7998
dc45a647
MB
7999: see if prototypes for various getservxxx netdb.h functions are available
8000echo " "
8001set d_getservprotos getservent $i_netdb netdb.h
8002eval $hasproto
8003
5f05dabc 8004: see if gettimeofday or ftime exists
8005set gettimeofday d_gettimeod
8006eval $inlibc
8007case "$d_gettimeod" in
8008"$undef")
8009 set ftime d_ftime
8010 eval $inlibc
8011 ;;
8012*)
8013 val="$undef"; set d_ftime; eval $setvar
8014 ;;
8015esac
8016case "$d_gettimeod$d_ftime" in
8017"$undef$undef")
8018 echo " "
8019 echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
8020 ;;
8021esac
8022
5ff3f7a4
GS
8023: see if this is an grp system
8024set grp.h i_grp
8025eval $inhdr
8026
8027case "$i_grp" in
8028$define)
8029 xxx=`./findhdr grp.h`
8030 $cppstdin $cppflags $cppminus < $xxx >$$.h
8031
8032 if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
8033 val="$define"
8034 else
8035 val="$undef"
8036 fi
8037 set d_grpasswd
8038 eval $setvar
8039
8040 $rm -f $$.h
8041 ;;
8042*)
8043 val="$undef";
8044 set d_grpasswd; eval $setvar
8045 ;;
8046esac
8047
a0d0e21e
LW
8048: see if this is a netinet/in.h or sys/in.h system
8049set netinet/in.h i_niin sys/in.h i_sysin
8050eval $inhdr
8051
5ff3f7a4 8052: see if arpa/inet.h has to be included
93341792 8053set arpa/inet.h i_arpainet
28e8609d
JH
8054eval $inhdr
8055
a0d0e21e
LW
8056: see if htonl --and friends-- exists
8057val=''
8058set htonl val
8059eval $inlibc
8060
8061: Maybe they are macros.
8062case "$val" in
8063$undef)
8064 $cat >htonl.c <<EOM
8065#include <stdio.h>
8066#include <sys/types.h>
8067#$i_niin I_NETINET_IN
8068#$i_sysin I_SYS_IN
93341792 8069#$i_arpainet I_ARPA_INET
a0d0e21e
LW
8070#ifdef I_NETINET_IN
8071#include <netinet/in.h>
8072#endif
8073#ifdef I_SYS_IN
8074#include <sys/in.h>
8075#endif
28e8609d
JH
8076#ifdef I_ARPA_INET
8077#include <arpa/inet.h>
8078#endif
a0d0e21e
LW
8079#ifdef htonl
8080printf("Defined as a macro.");
8081#endif
8082EOM
8083 $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
8084 if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
8085 val="$define"
8086 echo "But it seems to be defined as a macro." >&4
8087 fi
8088 $rm -f htonl.?
8089 ;;
8090esac
8091set d_htonl
8092eval $setvar
8093
8094: see which of string.h or strings.h is needed
8095echo " "
8096strings=`./findhdr string.h`
8097if $test "$strings" && $test -r "$strings"; then
8098 echo "Using <string.h> instead of <strings.h>." >&4
8099 val="$define"
8100else
8101 val="$undef"
8102 strings=`./findhdr strings.h`
8103 if $test "$strings" && $test -r "$strings"; then
8104 echo "Using <strings.h> instead of <string.h>." >&4
8105 else
8106 echo "No string header found -- You'll surely have problems." >&4
8107 fi
8108fi
8109set i_string
8110eval $setvar
8111case "$i_string" in
8112"$undef") strings=`./findhdr strings.h`;;
8113*) strings=`./findhdr string.h`;;
8114esac
8115
8116: index or strchr
8117echo " "
8118if set index val -f; eval $csym; $val; then
8119 if set strchr val -f d_strchr; eval $csym; $val; then
8120 if $contains strchr "$strings" >/dev/null 2>&1 ; then
8121 val="$define"
8122 vali="$undef"
8123 echo "strchr() found." >&4
8124 else
8125 val="$undef"
8126 vali="$define"
8127 echo "index() found." >&4
8128 fi
8129 else
8130 val="$undef"
8131 vali="$define"
8132 echo "index() found." >&4
8133 fi
8134else
8135 if set strchr val -f d_strchr; eval $csym; $val; then
8136 val="$define"
8137 vali="$undef"
8138 echo "strchr() found." >&4
8139 else
8140 echo "No index() or strchr() found!" >&4
8141 val="$undef"
8142 vali="$undef"
8143 fi
8144fi
8145set d_strchr; eval $setvar
8146val="$vali"
8147set d_index; eval $setvar
8148
7e1af8bc 8149: check whether inet_aton exists
8150set inet_aton d_inetaton
8151eval $inlibc
8152
5ff3f7a4 8153: see if inttypes.h is available
7f3d1cf1
BH
8154: we want a real compile instead of Inhdr because some systems
8155: have an inttypes.h which includes non-existent headers
921b2963 8156echo " "
7f3d1cf1
BH
8157$cat >try.c <<EOCP
8158#include <inttypes.h>
921b2963
JH
8159main() {
8160 static int32_t foo32 = 0x12345678;
8161}
7f3d1cf1
BH
8162EOCP
8163set try
921b2963
JH
8164if eval $compile; then
8165 echo "<inttypes.h> found." >&4
7f3d1cf1
BH
8166 val="$define"
8167else
921b2963 8168 echo "<inttypes.h> NOT found." >&4
7f3d1cf1
BH
8169 val="$undef"
8170fi
921b2963 8171$rm -f try.c try
7f3d1cf1
BH
8172set i_inttypes
8173eval $setvar
8174
5ff3f7a4 8175: check for int64_t
85ab1d1d
JH
8176case "$use64bits" in
8177"$define" )
8178 echo " "
8179 echo $n "Checking to see if your system supports int64_t...$c" >&4
8180 $cat >try.c <<EOCP
5ff3f7a4
GS
8181#include <sys/types.h>
8182#$i_inttypes I_INTTYPES
8183#ifdef I_INTTYPES
8184#include <inttypes.h>
8185#endif
94be4d36 8186int64_t foo() { int64_t x; x = 7; return x; }
5ff3f7a4 8187EOCP
85ab1d1d
JH
8188 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
8189 val="$define"
8190 echo " Yup, it does." >&4
8191 else
8192 val="$undef"
8193 echo " Nope, it doesn't." >&4
8194 fi
8195 $rm -f try.*
8196 ;;
8197*) val="$undef"
8198 ;;
8199esac
5ff3f7a4
GS
8200set d_int64t
8201eval $setvar
8202
8203
a0d0e21e
LW
8204: Look for isascii
8205echo " "
8206$cat >isascii.c <<'EOCP'
8207#include <stdio.h>
8208#include <ctype.h>
8209main() {
8210 int c = 'A';
8211 if (isascii(c))
8212 exit(0);
8213 else
8214 exit(1);
8215}
8216EOCP
dfe9444c
AD
8217set isascii
8218if eval $compile; then
a0d0e21e
LW
8219 echo "isascii() found." >&4
8220 val="$define"
8221else
8222 echo "isascii() NOT found." >&4
8223 val="$undef"
8224fi
8225set d_isascii
8226eval $setvar
8227$rm -f isascii*
8228
8229: see if killpg exists
8230set killpg d_killpg
8231eval $inlibc
8232
dd64f1c3
AD
8233: see if lchown exists
8234echo " "
8235$cat > try.c <<'EOCP'
8236/* System header to define __stub macros and hopefully few prototypes,
8237 which can conflict with char lchown(); below. */
8238#include <assert.h>
8239/* Override any gcc2 internal prototype to avoid an error. */
8240/* We use char because int might match the return type of a gcc2
8241 builtin and then its argument prototype would still apply. */
8242char lchown();
8243int main() {
8244 /* The GNU C library defines this for functions which it implements
8245 to always fail with ENOSYS. Some functions are actually named
8246 something starting with __ and the normal name is an alias. */
8247#if defined (__stub_lchown) || defined (__stub___lchown)
8248choke me
8249#else
8250lchown();
8251#endif
8252; return 0; }
8253EOCP
8254set try
8255if eval $compile; then
8256 $echo "lchown() found." >&4
8257 val="$define"
8258else
8259 $echo "lchown() NOT found." >&4
8260 val="$undef"
8261fi
8262set d_lchown
8263eval $setvar
8264
a0d0e21e
LW
8265: see if link exists
8266set link d_link
8267eval $inlibc
8268
a0d0e21e
LW
8269: see if localeconv exists
8270set localeconv d_locconv
8271eval $inlibc
8272
8273: see if lockf exists
8274set lockf d_lockf
8275eval $inlibc
8276
85ab1d1d
JH
8277: check for length of double
8278echo " "
8279case "$doublesize" in
8280'')
8281 $echo $n "Checking to see how big your double precision numbers are...$c" >&4
8282 $cat >try.c <<'EOCP'
8283#include <stdio.h>
8284main()
8285{
8286 printf("%d\n", sizeof(double));
8287}
8288EOCP
8289 set try
8290 if eval $compile_ok; then
8291 doublesize=`./try`
8292 $echo " $doublesize bytes." >&4
8293 else
8294 dflt='8'
8295 echo "(I can't seem to compile the test program. Guessing...)"
8296 rp="What is the size of a double precision number (in bytes)?"
8297 . ./myread
8298 doublesize="$ans"
8299 fi
8300 ;;
8301esac
8302$rm -f try.c try
8303
e5c9fcd0
AD
8304: check for long doubles
8305echo " "
8306echo $n "Checking to see if your system supports long doubles...$c" >&4
8307echo 'long double foo() { long double x; x = 7.0; return x; }' > try.c
dc45a647 8308if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
e5c9fcd0
AD
8309 val="$define"
8310 echo " Yup, it does." >&4
8311else
8312 val="$undef"
8313 echo " Nope, it doesn't." >&4
8314fi
8315$rm try.*
8316set d_longdbl
8317eval $setvar
8318
8319: check for length of long double
e5c9fcd0
AD
8320case "${d_longdbl}${longdblsize}" in
8321$define)
dc45a647 8322 echo " "
e5c9fcd0
AD
8323 $echo $n "Checking to see how big your long doubles are...$c" >&4
8324 $cat >try.c <<'EOCP'
8325#include <stdio.h>
8326main()
8327{
8328 printf("%d\n", sizeof(long double));
8329}
8330EOCP
8331 set try
c4f23d77 8332 if eval $compile; then
e5c9fcd0 8333 longdblsize=`./try`
dc45a647 8334 $echo " $longdblsize bytes." >&4
e5c9fcd0
AD
8335 else
8336 dflt='8'
dc45a647 8337 echo " "
c4f23d77 8338 echo "(I can't seem to compile the test program. Guessing...)" >&4
e5c9fcd0
AD
8339 rp="What is the size of a long double (in bytes)?"
8340 . ./myread
8341 longdblsize="$ans"
8342 fi
85ab1d1d
JH
8343 if $test "X$doublesize" = "X$longdblsize"; then
8344 echo "(That isn't any different from an ordinary double.)"
8345 fi
dc45a647
MB
8346 ;;
8347esac
8348$rm -f try.c try
8349
8350: check for long long
8351echo " "
8352echo $n "Checking to see if your system supports long long...$c" >&4
8353echo 'long long foo() { long long x; x = 7; return x; }' > try.c
8354if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
8355 val="$define"
8356 echo " Yup, it does." >&4
8357else
8358 val="$undef"
8359 echo " Nope, it doesn't." >&4
8360fi
8361$rm try.*
8362set d_longlong
8363eval $setvar
8364
8365: check for length of long long
8366case "${d_longlong}${longlongsize}" in
8367$define)
8368 echo " "
8369 $echo $n "Checking to see how big your long longs are...$c" >&4
8370 $cat >try.c <<'EOCP'
8371#include <stdio.h>
8372main()
8373{
8374 printf("%d\n", sizeof(long long));
8375}
8376EOCP
8377 set try
8378 if eval $compile_ok; then
8379 longlongsize=`./try`
8380 $echo " $longlongsize bytes." >&4
8381 else
8382 dflt='8'
8383 echo " "
8384 echo "(I can't seem to compile the test program. Guessing...)"
8385 rp="What is the size of a long long (in bytes)?"
8386 . ./myread
8387 longlongsize="$ans"
8388 fi
85ab1d1d
JH
8389 if $test "X$longsize" = "X$longlongsize"; then
8390 echo "(That isn't any different from an ordinary long.)"
8391 fi
e5c9fcd0
AD
8392 ;;
8393esac
8394$rm -f try.c try
8395
a0d0e21e
LW
8396: see if lstat exists
8397set lstat d_lstat
8398eval $inlibc
8399
8400: see if mblen exists
8401set mblen d_mblen
8402eval $inlibc
8403
8404: see if mbstowcs exists
8405set mbstowcs d_mbstowcs
8406eval $inlibc
8407
8408: see if mbtowc exists
8409set mbtowc d_mbtowc
8410eval $inlibc
8411
8412: see if memcmp exists
8413set memcmp d_memcmp
8414eval $inlibc
8415
8416: see if memcpy exists
8417set memcpy d_memcpy
8418eval $inlibc
8419
8420: see if memmove exists
8421set memmove d_memmove
2304df62
AD
8422eval $inlibc
8423
8424: see if memset exists
8425set memset d_memset
8426eval $inlibc
8427
8428: see if mkdir exists
8429set mkdir d_mkdir
8430eval $inlibc
8431
a0d0e21e
LW
8432: see if mkfifo exists
8433set mkfifo d_mkfifo
8434eval $inlibc
8435
8436: see if mktime exists
8437set mktime d_mktime
8438eval $inlibc
8439
2304df62
AD
8440: see if msgctl exists
8441set msgctl d_msgctl
8442eval $inlibc
8443
8444: see if msgget exists
8445set msgget d_msgget
8446eval $inlibc
8447
8448: see if msgsnd exists
8449set msgsnd d_msgsnd
8450eval $inlibc
8451
8452: see if msgrcv exists
8453set msgrcv d_msgrcv
8454eval $inlibc
8455
8456: see how much of the 'msg*(2)' library is present.
8457h_msg=true
8458echo " "
8459case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
8460*"$undef"*) h_msg=false;;
8461esac
6087ac44
JH
8462case "$osname" in
8463freebsd)
8464 case "`ipcs 2>&1`" in
8465 "SVID messages"*"not configured"*)
5ff3f7a4 8466 echo "Your $osname does not have the msg*(2) configured." >&4
6087ac44
JH
8467 h_msg=false
8468 val="$undef"
8469 set msgctl d_msgctl
8470 eval $setvar
8471 set msgget d_msgget
8472 eval $setvar
8473 set msgsnd d_msgsnd
8474 eval $setvar
8475 set msgrcv d_msgrcv
8476 eval $setvar
8477 ;;
8478 esac
8479 ;;
8480esac
2304df62
AD
8481: we could also check for sys/ipc.h ...
8482if $h_msg && $test `./findhdr sys/msg.h`; then
8483 echo "You have the full msg*(2) library." >&4
8484 val="$define"
8485else
8486 echo "You don't have the full msg*(2) library." >&4
8487 val="$undef"
8488fi
8489set d_msg
8490eval $setvar
8491
dfe9444c
AD
8492: see if nice exists
8493set nice d_nice
8494eval $inlibc
8495
8496: see if pause exists
8497set pause d_pause
8498eval $inlibc
8499
8500: see if pipe exists
8501set pipe d_pipe
8502eval $inlibc
8503
8504: see if poll exists
8505set poll d_poll
8506eval $inlibc
8507
13666627
JH
8508: how to create joinable pthreads
8509if test "X$usethreads" = "X$define"; then
8510 echo " "
8511 echo "Checking what constant to use for creating joinable pthreads..." >&4
8512 $cat >try.c <<'EOCP'
8513#include <pthread.h>
8514int main() {
8515 int detachstate = JOINABLE;
8516}
8517EOCP
8518 set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
8519 if eval $compile; then
8520 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&2
8521 val="$undef"
8522 set d_pthread_create_joinable
8523 eval $setvar
8524 val=0
8525 set pthread_create_joinable
8526 eval $setvar
8527 else
8528 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
8529 if eval $compile; then
8530 echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&2
8531 val="$define"
8532 set d_pthread_create_joinable
8533 eval $setvar
8534 val=PTHREAD_CREATE_UNDETACHED
8535 set pthread_create_joinable
8536 eval $setvar
8537 else
8538 set try -DJOINABLE=__UNDETACHED
8539 if eval $compile; then
8540 echo "You seem to use __UNDETACHED." >&2
8541 val="$define"
8542 set d_pthread_create_joinable
8543 eval $setvar
8544 val=__UNDETACHED
8545 set pthread_create_joinable
8546 eval $setvar
8547 else
8548 echo "Egads, nothing obvious found. Guessing that you use 0." >&2
8549 val="$define"
8550 set d_pthread_create_joinable
8551 eval $setvar
8552 val=0
8553 set pthread_create_joinable
8554 eval $setvar
8555 fi
8556 fi
8557 fi
8558 $rm -f try try.*
8559else
8560 d_pthread_create_joinable="$undef"
8561 pthread_create_joinable=0
8562fi
8563
31dfa2f6
JH
8564
8565: see whether the various POSIXish _yields exist
8566$cat >try.c <<EOP
8567#include <pthread.h>
8568#include <stdio.h>
8569main() {
8570#ifdef SCHED_YIELD
8571 sched_yield();
8572#else
8573#ifdef PTHREAD_YIELD
8574 pthread_yield();
8575#else
8576#ifdef PTHREAD_YIELD_NULL
8577 pthread_yield(NULL);
8578#endif
8579#endif
8580#endif
8581}
8582EOP
8583: see if sched_yield exists
8584set try -DSCHED_YIELD
8585if eval $compile; then
8586 val="$define"
8587 sched_yield='sched_yield()'
8588else
8589 val="$undef"
8590fi
8591case "$usethreads" in
8592$define)
8593 case "$val" in
8594 $define) echo 'sched_yield() found.' >&4 ;;
8595 *) echo 'sched_yield() NOT found.' >&4 ;;
8596 esac
8597esac
8598set d_sched_yield
8599eval $setvar
8600
8601: see if pthread_yield exists
8602set try -DPTHREAD_YIELD
8603if eval $compile; then
8604 val="$define"
8605 case "$sched_yield" in
8606 '') sched_yield='pthread_yield()' ;;
8607 esac
8608else
8609 set try -DPTHREAD_YIELD_NULL
8610 if eval $compile; then
8611 val="$define"
8612 case "$sched_yield" in
8613 '') sched_yield='pthread_yield(NULL)' ;;
8614 esac
8615 else
8616 val="$undef"
8617 fi
8618fi
8619case "$usethreads" in
8620$define)
8621 case "$val" in
8622 $define) echo 'pthread_yield() found.' >&4 ;;
8623 *) echo 'pthread_yield() NOT found.' >&4 ;;
8624 esac
8625 ;;
8626esac
8627set d_pthread_yield
8628eval $setvar
8629
8630case "$sched_yield" in
8631'') sched_yield=undef ;;
8632esac
8633
8634$rm -f try try.*
8635
4aa0a1f7
AD
8636: see if this is a pwd.h system
8637set pwd.h i_pwd
8638eval $inhdr
8639
8640case "$i_pwd" in
8641$define)
8642 xxx=`./findhdr pwd.h`
85e6fe83 8643 $cppstdin $cppflags $cppminus < $xxx >$$.h
4aa0a1f7 8644
2304df62 8645 if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
4aa0a1f7 8646 val="$define"
2304df62 8647 else
4aa0a1f7 8648 val="$undef"
2304df62 8649 fi
4aa0a1f7
AD
8650 set d_pwquota
8651 eval $setvar
8652
2304df62 8653 if $contains 'pw_age' $$.h >/dev/null 2>&1; then
4aa0a1f7 8654 val="$define"
2304df62 8655 else
4aa0a1f7 8656 val="$undef"
2304df62 8657 fi
4aa0a1f7
AD
8658 set d_pwage
8659 eval $setvar
8660
2304df62 8661 if $contains 'pw_change' $$.h >/dev/null 2>&1; then
4aa0a1f7 8662 val="$define"
2304df62 8663 else
4aa0a1f7 8664 val="$undef"
2304df62 8665 fi
4aa0a1f7
AD
8666 set d_pwchange
8667 eval $setvar
8668
2304df62 8669 if $contains 'pw_class' $$.h >/dev/null 2>&1; then
4aa0a1f7 8670 val="$define"
2304df62 8671 else
4aa0a1f7 8672 val="$undef"
2304df62 8673 fi
4aa0a1f7
AD
8674 set d_pwclass
8675 eval $setvar
8676
2304df62 8677 if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
4aa0a1f7 8678 val="$define"
2304df62 8679 else
4aa0a1f7 8680 val="$undef"
2304df62 8681 fi
4aa0a1f7
AD
8682 set d_pwexpire
8683 eval $setvar
8684
2304df62 8685 if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
4aa0a1f7 8686 val="$define"
2304df62 8687 else
4aa0a1f7 8688 val="$undef"
2304df62 8689 fi
4aa0a1f7
AD
8690 set d_pwcomment
8691 eval $setvar
8692
c4f23d77
AD
8693 if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
8694 val="$define"
8695 else
8696 val="$undef"
8697 fi
8698 set d_pwgecos
8699 eval $setvar
8700
28e8609d
JH
8701 if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
8702 val="$define"
8703 else
8704 val="$undef"
8705 fi
8706 set d_pwpasswd
8707 eval $setvar
8708
2304df62 8709 $rm -f $$.h
4aa0a1f7 8710 ;;
5ff3f7a4 8711*)
4aa0a1f7
AD
8712 val="$undef";
8713 set d_pwquota; eval $setvar
8714 set d_pwage; eval $setvar
8715 set d_pwchange; eval $setvar
8716 set d_pwclass; eval $setvar
8717 set d_pwexpire; eval $setvar
8718 set d_pwcomment; eval $setvar
c4f23d77 8719 set d_pwgecos; eval $setvar
28e8609d 8720 set d_pwpasswd; eval $setvar
4aa0a1f7
AD
8721 ;;
8722esac
2304df62 8723
85e6fe83 8724: see if readdir and friends exist
2304df62
AD
8725set readdir d_readdir
8726eval $inlibc
85e6fe83
LW
8727set seekdir d_seekdir
8728eval $inlibc
8729set telldir d_telldir
8730eval $inlibc
8731set rewinddir d_rewinddir
8732eval $inlibc
2304df62 8733
a0d0e21e
LW
8734: see if readlink exists
8735set readlink d_readlink
8736eval $inlibc
8737
2304df62
AD
8738: see if rename exists
8739set rename d_rename
8740eval $inlibc
8741
8742: see if rmdir exists
8743set rmdir d_rmdir
8744eval $inlibc
8745
8ff267be 8746: see if memory.h is available.
8747val=''
8748set memory.h val
8749eval $inhdr
8750
8751: See if it conflicts with string.h
8752case "$val" in
8753$define)
8754 case "$strings" in
8755 '') ;;
8756 *)
8757 $cppstdin $cppflags $cppminus < $strings > mem.h
8758 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
8759 echo " "
8760 echo "We won't be including <memory.h>."
8761 val="$undef"
8762 fi
8763 $rm -f mem.h
8764 ;;
8765 esac
8766esac
8767set i_memory
8768eval $setvar
8769
2304df62
AD
8770: can bcopy handle overlapping blocks?
8771val="$undef"
8772case "$d_bcopy" in
8773"$define")
8774 echo " "
8775 echo "Checking to see if your bcopy() can do overlapping copies..." >&4
dfe9444c 8776 $cat >try.c <<EOCP
8ff267be 8777#$i_memory I_MEMORY
8778#$i_stdlib I_STDLIB
8779#$i_string I_STRING
8780#$i_unistd I_UNISTD
8781EOCP
dfe9444c 8782 $cat >>try.c <<'EOCP'
8ff267be 8783#include <stdio.h>
8ff267be 8784#ifdef I_MEMORY
8785# include <memory.h>
8786#endif
8787#ifdef I_STDLIB
8788# include <stdlib.h>
8789#endif
8790#ifdef I_STRING
8791# include <string.h>
8792#else
8793# include <strings.h>
8794#endif
8795#ifdef I_UNISTD
8796# include <unistd.h> /* Needed for NetBSD */
8797#endif
2304df62
AD
8798main()
8799{
85e6fe83
LW
8800char buf[128], abc[128];
8801char *b;
8802int len;
8803int off;
8804int align;
a0d0e21e 8805
85e6fe83 8806bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
2304df62
AD
8807
8808for (align = 7; align >= 0; align--) {
8809 for (len = 36; len; len--) {
8810 b = buf+align;
85e6fe83 8811 bcopy(abc, b, len);
2304df62
AD
8812 for (off = 1; off <= len; off++) {
8813 bcopy(b, b+off, len);
8814 bcopy(b+off, b, len);
85e6fe83 8815 if (bcmp(b, abc, len))
2304df62
AD
8816 exit(1);
8817 }
8818 }
8819}
8820exit(0);
8821}
8822EOCP
dfe9444c 8823 set try
dc45a647 8824 if eval $compile_ok; then
dfe9444c 8825 if ./try 2>/dev/null; then
2304df62
AD
8826 echo "Yes, it can."
8827 val="$define"
8828 else
8829 echo "It can't, sorry."
8ff267be 8830 case "$d_memmove" in
8831 "$define") echo "But that's Ok since you have memmove()." ;;
8832 esac
2304df62
AD
8833 fi
8834 else
8835 echo "(I can't compile the test program, so we'll assume not...)"
8ff267be 8836 case "$d_memmove" in
8837 "$define") echo "But that's Ok since you have memmove()." ;;
8838 esac
2304df62
AD
8839 fi
8840 ;;
8841esac
dfe9444c 8842$rm -f try.* try core
2304df62
AD
8843set d_safebcpy
8844eval $setvar
8845
8846: can memcpy handle overlapping blocks?
8847val="$undef"
8848case "$d_memcpy" in
8849"$define")
8850 echo " "
8851 echo "Checking to see if your memcpy() can do overlapping copies..." >&4
dfe9444c 8852 $cat >try.c <<EOCP
8ff267be 8853#$i_memory I_MEMORY
8854#$i_stdlib I_STDLIB
8855#$i_string I_STRING
8856#$i_unistd I_UNISTD
8857EOCP
dfe9444c 8858 $cat >>try.c <<'EOCP'
8ff267be 8859#include <stdio.h>
8ff267be 8860#ifdef I_MEMORY
8861# include <memory.h>
8862#endif
8863#ifdef I_STDLIB
8864# include <stdlib.h>
8865#endif
8866#ifdef I_STRING
8867# include <string.h>
8868#else
8869# include <strings.h>
8870#endif
8871#ifdef I_UNISTD
8872# include <unistd.h> /* Needed for NetBSD */
8873#endif
2304df62
AD
8874main()
8875{
85e6fe83
LW
8876char buf[128], abc[128];
8877char *b;
8878int len;
8879int off;
8880int align;
8881
8ff267be 8882/* Copy "abcde..." string to char abc[] so that gcc doesn't
8883 try to store the string in read-only memory. */
85e6fe83 8884memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
2304df62
AD
8885
8886for (align = 7; align >= 0; align--) {
8887 for (len = 36; len; len--) {
8888 b = buf+align;
232e078e 8889 memcpy(b, abc, len);
2304df62 8890 for (off = 1; off <= len; off++) {
2304df62 8891 memcpy(b+off, b, len);
232e078e 8892 memcpy(b, b+off, len);
85e6fe83 8893 if (memcmp(b, abc, len))
2304df62
AD
8894 exit(1);
8895 }
8896 }
8897}
8898exit(0);
8899}
8900EOCP
dfe9444c 8901 set try
dc45a647 8902 if eval $compile_ok; then
dfe9444c 8903 if ./try 2>/dev/null; then
2304df62
AD
8904 echo "Yes, it can."
8905 val="$define"
8906 else
8907 echo "It can't, sorry."
8ff267be 8908 case "$d_memmove" in
8909 "$define") echo "But that's Ok since you have memmove()." ;;
8910 esac
2304df62
AD
8911 fi
8912 else
8913 echo "(I can't compile the test program, so we'll assume not...)"
8ff267be 8914 case "$d_memmove" in
8915 "$define") echo "But that's Ok since you have memmove()." ;;
8916 esac
2304df62
AD
8917 fi
8918 ;;
8919esac
dfe9444c 8920$rm -f try.* try core
2304df62
AD
8921set d_safemcpy
8922eval $setvar
8923
36477c24 8924: can memcmp be trusted to compare relative magnitude?
8925val="$undef"
8926case "$d_memcmp" in
8927"$define")
8928 echo " "
dfe9444c
AD
8929 echo "Checking if your memcmp() can compare relative magnitude..." >&4
8930 $cat >try.c <<EOCP
36477c24 8931#$i_memory I_MEMORY
8932#$i_stdlib I_STDLIB
8933#$i_string I_STRING
8934#$i_unistd I_UNISTD
8935EOCP
dfe9444c 8936 $cat >>try.c <<'EOCP'
36477c24 8937#include <stdio.h>
36477c24 8938#ifdef I_MEMORY
8939# include <memory.h>
8940#endif
8941#ifdef I_STDLIB
8942# include <stdlib.h>
8943#endif
8944#ifdef I_STRING
8945# include <string.h>
8946#else
8947# include <strings.h>
8948#endif
8949#ifdef I_UNISTD
8950# include <unistd.h> /* Needed for NetBSD */
8951#endif
8952main()
8953{
8954char a = -1;
8955char b = 0;
8956if ((a < b) && memcmp(&a, &b, 1) < 0)
8957 exit(1);
8958exit(0);
8959}
8960EOCP
dfe9444c 8961 set try
dc45a647 8962 if eval $compile_ok; then
dfe9444c 8963 if ./try 2>/dev/null; then
36477c24 8964 echo "Yes, it can."
8965 val="$define"
8966 else
8967 echo "No, it can't (it uses signed chars)."
8968 fi
8969 else
8970 echo "(I can't compile the test program, so we'll assume not...)"
8971 fi
8972 ;;
8973esac
dfe9444c 8974$rm -f try.* try core
36477c24 8975set d_sanemcmp
8976eval $setvar
8977
2304df62
AD
8978: see if select exists
8979set select d_select
8980eval $inlibc
8981
8982: see if semctl exists
8983set semctl d_semctl
8984eval $inlibc
8985
8986: see if semget exists
8987set semget d_semget
8988eval $inlibc
8989
8990: see if semop exists
8991set semop d_semop
8992eval $inlibc
8993
8994: see how much of the 'sem*(2)' library is present.
8995h_sem=true
8996echo " "
8997case "$d_semctl$d_semget$d_semop" in
8998*"$undef"*) h_sem=false;;
8999esac
6087ac44
JH
9000case "$osname" in
9001freebsd)
9002 case "`ipcs 2>&1`" in
9003 "SVID messages"*"not configured"*)
5ff3f7a4 9004 echo "Your $osname does not have the sem*(2) configured." >&4
6087ac44
JH
9005 h_sem=false
9006 val="$undef"
9007 set semctl d_semctl
9008 eval $setvar
9009 set semget d_semget
9010 eval $setvar
9011 set semop d_semop
9012 eval $setvar
9013 ;;
9014 esac
9015 ;;
9016esac
2304df62
AD
9017: we could also check for sys/ipc.h ...
9018if $h_sem && $test `./findhdr sys/sem.h`; then
9019 echo "You have the full sem*(2) library." >&4
9020 val="$define"
9021else
9022 echo "You don't have the full sem*(2) library." >&4
9023 val="$undef"
9024fi
9025set d_sem
9026eval $setvar
9027
bd89102f
AD
9028: see whether sys/sem.h defines union semun
9029echo " "
9030$cat > try.c <<'END'
9031#include <sys/types.h>
9032#include <sys/ipc.h>
9033#include <sys/sem.h>
9034int main () { union semun semun; semun.buf = 0; }
9035END
9036set try
9037if eval $compile; then
9038 echo "You have union semun in <sys/sem.h>." >&4
9039 val="$define"
9040else
9041 echo "You do not have union semun in <sys/sem.h>." >&4
9042 val="$undef"
9043fi
85ab1d1d 9044$rm -f try try.c try.h
bd89102f
AD
9045set d_union_semun
9046eval $setvar
9047
9048: see how to do semctl IPC_STAT
9049case "$d_sem" in
9050$define)
9051 : see whether semctl IPC_STAT can use union semun
9052 echo " "
85ab1d1d
JH
9053 $cat > try.h <<END
9054#ifndef S_IRUSR
9055# ifdef S_IREAD
9056# define S_IRUSR S_IREAD
9057# define S_IWUSR S_IWRITE
9058# define S_IXUSR S_IEXEC
9059# else
9060# define S_IRUSR 0400
9061# define S_IWUSR 0200
9062# define S_IXUSR 0100
9063# endif
9064# define S_IRGRP (S_IRUSR>>3)
9065# define S_IWGRP (S_IWUSR>>3)
9066# define S_IXGRP (S_IXUSR>>3)
9067# define S_IROTH (S_IRUSR>>6)
9068# define S_IWOTH (S_IWUSR>>6)
9069# define S_IXOTH (S_IXUSR>>6)
9070#endif
9071#ifndef S_IRWXU
9072# define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
9073# define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
9074# define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
9075#endif
9076END
9077
bd89102f
AD
9078 $cat > try.c <<END
9079#include <sys/types.h>
9080#include <sys/ipc.h>
9081#include <sys/sem.h>
9082#include <sys/stat.h>
9083#include <stdio.h>
9084#include <errno.h>
85ab1d1d 9085#include "try.h"
bd89102f
AD
9086#ifndef errno
9087extern int errno;
9088#endif
9089#$d_union_semun HAS_UNION_SEMUN
9090int main() {
9091 union semun
9092#ifndef HAS_UNION_SEMUN
9093 {
9094 int val;
9095 struct semid_ds *buf;
9096 unsigned short *array;
9097 }
9098#endif
9099 arg;
9100 int sem, st;
9101
9102#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
9103 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
9104 if (sem > -1) {
9105 struct semid_ds argbuf;
9106 arg.buf = &argbuf;
9107# ifdef IPC_STAT
9108 st = semctl(sem, 0, IPC_STAT, arg);
9109 if (st == 0)
9110 printf("semun\n");
9111 else
9112# endif /* IPC_STAT */
9113 printf("semctl IPC_STAT failed: errno = %d\n", errno);
9114# ifdef IPC_RMID
9115 if (semctl(sem, 0, IPC_RMID, arg) != 0)
9116# endif /* IPC_RMID */
9117 printf("semctl IPC_RMID failed: errno = %d\n", errno);
9118 } else
9119#endif /* IPC_PRIVATE && ... */
9120 printf("semget failed: errno = %d\n", errno);
9121 return 0;
9122}
9123END
9124 val="$undef"
9125 set try
9126 if eval $compile; then
9127 xxx=`./try`
9128 case "$xxx" in
9129 semun) val="$define" ;;
9130 esac
9131 fi
9132 $rm -f try try.c
9133 set d_semctl_semun
9134 eval $setvar
9135 case "$d_semctl_semun" in
9136 $define)
9137 echo "You can use union semun for semctl IPC_STAT." >&4
9138 also='also'
9139 ;;
9140 *) echo "You cannot use union semun for semctl IPC_STAT." >&4
9141 also=''
9142 ;;
9143 esac
9144
9145 : see whether semctl IPC_STAT can use struct semid_ds pointer
9146 $cat > try.c <<'END'
9147#include <sys/types.h>
9148#include <sys/ipc.h>
9149#include <sys/sem.h>
9150#include <sys/stat.h>
85ab1d1d 9151#include "try.h"
bd89102f
AD
9152#include <stdio.h>
9153#include <errno.h>
9154#ifndef errno
9155extern int errno;
9156#endif
9157int main() {
9158 struct semid_ds arg;
9159 int sem, st;
9160
9161#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
9162 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
9163 if (sem > -1) {
9164# ifdef IPC_STAT
9165 st = semctl(sem, 0, IPC_STAT, &arg);
9166 if (st == 0)
9167 printf("semid_ds\n");
9168 else
9169# endif /* IPC_STAT */
9170 printf("semctl IPC_STAT failed: errno = %d\n", errno);
9171# ifdef IPC_RMID
9172 if (semctl(sem, 0, IPC_RMID, &arg) != 0)
9173# endif /* IPC_RMID */
9174 printf("semctl IPC_RMID failed: errno = %d\n", errno);
9175 } else
9176#endif /* IPC_PRIVATE && ... */
9177 printf("semget failed: errno = %d\n", errno);
9178
9179 return 0;
9180}
9181END
9182 val="$undef"
9183 set try
9184 if eval $compile; then
9185 xxx=`./try`
9186 case "$xxx" in
9187 semid_ds) val="$define" ;;
9188 esac
9189 fi
9190 $rm -f try try.c
9191 set d_semctl_semid_ds
9192 eval $setvar
9193 case "$d_semctl_semid_ds" in
9194 $define)
7f3d1cf1 9195 echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
bd89102f 9196 ;;
7f3d1cf1 9197 *) echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
bd89102f
AD
9198 ;;
9199 esac
85ab1d1d 9200 $rm -f try.h
bd89102f
AD
9201 ;;
9202*) val="$undef"
9203
9204 # We do not have the full sem*(2) library, so assume we can not
9205 # use either.
9206
9207 set d_semctl_semun
9208 eval $setvar
9209
9210 set d_semctl_semid_ds
9211 eval $setvar
9212 ;;
9213esac
9214
2304df62
AD
9215: see if setegid exists
9216set setegid d_setegid
9217eval $inlibc
9218
9219: see if seteuid exists
9220set seteuid d_seteuid
9221eval $inlibc
9222
5ff3f7a4
GS
9223: see if setgrent exists
9224set setgrent d_setgrent
9225eval $inlibc
9226
693762b4
AD
9227: see if sethostent exists
9228set sethostent d_sethent
9229eval $inlibc
9230
a0d0e21e
LW
9231: see if setlinebuf exists
9232set setlinebuf d_setlinebuf
9233eval $inlibc
9234
2304df62
AD
9235: see if setlocale exists
9236set setlocale d_setlocale
9237eval $inlibc
a0d0e21e 9238
e5c9fcd0
AD
9239: see if setnetent exists
9240set setnetent d_setnent
9241eval $inlibc
9242
9243: see if setprotoent exists
9244set setprotoent d_setpent
9245eval $inlibc
9246
2304df62
AD
9247: see if setpgid exists
9248set setpgid d_setpgid
9249eval $inlibc
9250
2304df62
AD
9251: see if setpgrp2 exists
9252set setpgrp2 d_setpgrp2
9253eval $inlibc
9254
9255: see if setpriority exists
9256set setpriority d_setprior
9257eval $inlibc
9258
5ff3f7a4
GS
9259: see if setpwent exists
9260set setpwent d_setpwent
9261eval $inlibc
9262
2304df62
AD
9263: see if setregid exists
9264set setregid d_setregid
9265eval $inlibc
9266set setresgid d_setresgid
9267eval $inlibc
9268
9269: see if setreuid exists
9270set setreuid d_setreuid
9271eval $inlibc
9272set setresuid d_setresuid
9273eval $inlibc
9274
9275: see if setrgid exists
9276set setrgid d_setrgid
9277eval $inlibc
9278
9279: see if setruid exists
9280set setruid d_setruid
9281eval $inlibc
9282
e5c9fcd0
AD
9283: see if setservent exists
9284set setservent d_setsent
9285eval $inlibc
9286
2304df62
AD
9287: see if setsid exists
9288set setsid d_setsid
9289eval $inlibc
9290
e5c9fcd0
AD
9291: see if setvbuf exists
9292set setvbuf d_setvbuf
9293eval $inlibc
9294
760ac839
LW
9295: see if sfio.h is available
9296set sfio.h i_sfio
9297eval $inhdr
9298
9299
8ff267be 9300: see if sfio library is available
760ac839
LW
9301case "$i_sfio" in
9302$define)
9303 val=''
9304 set sfreserve val
9305 eval $inlibc
9306 ;;
9307*)
9308 val="$undef"
9309 ;;
9310esac
8ff267be 9311: Ok, but do we want to use it.
760ac839
LW
9312case "$val" in
9313$define)
9314 case "$usesfio" in
8ff267be 9315 true|$define|[yY]*) dflt='y';;
760ac839
LW
9316 *) dflt='n';;
9317 esac
8ff267be 9318 echo "$package can use the sfio library, but it is experimental."
760ac839
LW
9319 rp="You seem to have sfio available, do you want to try using it?"
9320 . ./myread
9321 case "$ans" in
8ff267be 9322 y|Y) ;;
9323 *) echo "Ok, avoiding sfio this time. I'll use stdio instead."
760ac839 9324 val="$undef"
ff0cee69 9325 : Remove sfio from list of libraries to use
9326 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
9327 shift
9328 libs="$*"
9329 echo "libs = $libs" >&4
760ac839
LW
9330 ;;
9331 esac
9332 ;;
8ff267be 9333*) case "$usesfio" in
9334 true|$define|[yY]*)
9335 echo "Sorry, cannot find sfio on this machine" >&4
9336 echo "Ignoring your setting of usesfio=$usesfio" >&4
760ac839
LW
9337 ;;
9338 esac
9339 ;;
9340esac
8ff267be 9341set d_sfio
9342eval $setvar
760ac839
LW
9343case "$d_sfio" in
9344$define) usesfio='true';;
9345*) usesfio='false';;
9346esac
9347
2304df62
AD
9348: see if shmctl exists
9349set shmctl d_shmctl
9350eval $inlibc
9351
9352: see if shmget exists
9353set shmget d_shmget
9354eval $inlibc
9355
a0d0e21e
LW
9356: see if shmat exists
9357set shmat d_shmat
9358eval $inlibc
9359: see what shmat returns
9360case "$d_shmat" in
9361"$define")
9362 $cat >shmat.c <<'END'
9363#include <sys/shm.h>
9364void *shmat();
9365END
9366 if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
9367 shmattype='void *'
9368 else
9369 shmattype='char *'
9370 fi
9371 echo "and it returns ($shmattype)." >&4
9372 : see if a prototype for shmat is available
e50aee73
AD
9373 xxx=`./findhdr sys/shm.h`
9374 $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
a0d0e21e
LW
9375 if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
9376 val="$define"
9377 else
9378 val="$undef"
9379 fi
9380 $rm -f shmat.[co]
9381 ;;
9382*)
9383 val="$undef"
9384 ;;
9385esac
9386set d_shmatprototype
9387eval $setvar
9388
9389: see if shmdt exists
9390set shmdt d_shmdt
9391eval $inlibc
9392
9393: see how much of the 'shm*(2)' library is present.
9394h_shm=true
9395echo " "
9396case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
9397*"$undef"*) h_shm=false;;
9398esac
6087ac44
JH
9399case "$osname" in
9400freebsd)
9401 case "`ipcs 2>&1`" in
9402 "SVID shared memory"*"not configured"*)
5ff3f7a4 9403 echo "Your $osname does not have the shm*(2) configured." >&4
6087ac44
JH
9404 h_shm=false
9405 val="$undef"
9406 set shmctl d_shmctl
9407 evat $setvar
9408 set shmget d_shmget
9409 evat $setvar
9410 set shmat d_shmat
9411 evat $setvar
9412 set shmdt d_shmdt
9413 evat $setvar
9414 ;;
9415 esac
9416 ;;
9417esac
a0d0e21e
LW
9418: we could also check for sys/ipc.h ...
9419if $h_shm && $test `./findhdr sys/shm.h`; then
9420 echo "You have the full shm*(2) library." >&4
9421 val="$define"
9422else
9423 echo "You don't have the full shm*(2) library." >&4
9424 val="$undef"
9425fi
9426set d_shm
9427eval $setvar
9428
2c7991dc 9429echo " "
8ff267be 9430: see if we have sigaction
9431if set sigaction val -f d_sigaction; eval $csym; $val; then
9432 echo 'sigaction() found.' >&4
dc45a647 9433 $cat > try.c <<'EOP'
8ff267be 9434#include <stdio.h>
9435#include <sys/types.h>
9436#include <signal.h>
9437main()
9438{
9439 struct sigaction act, oact;
9440}
9441EOP
dc45a647
MB
9442 set try
9443 if eval $compile_ok; then
9444 val="$define"
9445 else
9446 echo "But you don't seem to have a useable struct sigaction." >&4
9447 val="$undef"
9448 fi
8ff267be 9449else
dc45a647 9450 echo 'sigaction NOT found.' >&4
8ff267be 9451 val="$undef"
9452fi
9453set d_sigaction; eval $setvar
dfe9444c 9454$rm -f try try$_o try.c
2c7991dc 9455
a5f75d66
AD
9456: see if sigsetjmp exists
9457echo " "
921b2963
JH
9458case "$d_sigsetjmp" in
9459'')
9460 $cat >try.c <<'EOP'
9461#include <setjmp.h>
9462sigjmp_buf env;
9463int set = 1;
9464main()
9465{
9466 if (sigsetjmp(env,1))
9467 exit(set);
9468 set = 0;
9469 siglongjmp(env, 1);
9470 exit(1);
9471}
9472EOP
9473 set try
9474 if eval $compile; then
9475 if ./try >/dev/null 2>&1; then
9476 echo "POSIX sigsetjmp found." >&4
9477 val="$define"
9478 else
9479 $cat >&4 <<EOM
9480Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
9481I'll ignore them.
9482EOM
9483 val="$undef"
a0d0e21e 9484 fi
921b2963
JH
9485 else
9486 echo "sigsetjmp not found." >&4
9487 val="$undef"
a0d0e21e 9488 fi
921b2963
JH
9489 ;;
9490*) val="$d_sigsetjmp"
9491 case "$d_sigsetjmp" in
9492 $define) echo "POSIX sigsetjmp found." >&4;;
9493 $undef) echo "sigsetjmp not found." >&4;;
9494 esac
9495 ;;
9496esac
9497set d_sigsetjmp
9498eval $setvar
9499$rm -f try.c try
2304df62 9500
2304df62
AD
9501: see if stat knows about block sizes
9502echo " "
5ff3f7a4
GS
9503set d_statblks stat st_blocks $i_sysstat sys/stat.h
9504eval $hasfield
2304df62 9505
16d20bd9
AD
9506: see if _ptr and _cnt from stdio act std
9507echo " "
9508if $contains '_IO_fpos_t' `./findhdr stdio.h` >/dev/null 2>&1 ; then
9509 echo "(Looks like you have stdio.h from Linux.)"
9510 case "$stdio_ptr" in
c2960299
AD
9511 '') stdio_ptr='((fp)->_IO_read_ptr)'
9512 ptr_lval=$define
9513 ;;
8e07c86e 9514 *) ptr_lval=$d_stdio_ptr_lval;;
16d20bd9
AD
9515 esac
9516 case "$stdio_cnt" in
c2960299
AD
9517 '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
9518 cnt_lval=$undef
9519 ;;
8e07c86e 9520 *) cnt_lval=$d_stdio_cnt_lval;;
16d20bd9
AD
9521 esac
9522 case "$stdio_base" in
9523 '') stdio_base='((fp)->_IO_read_base)';;
9524 esac
9525 case "$stdio_bufsiz" in
c2960299 9526 '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
16d20bd9
AD
9527 esac
9528else
9529 case "$stdio_ptr" in
c2960299
AD
9530 '') stdio_ptr='((fp)->_ptr)'
9531 ptr_lval=$define
9532 ;;
8e07c86e 9533 *) ptr_lval=$d_stdio_ptr_lval;;
16d20bd9
AD
9534 esac
9535 case "$stdio_cnt" in
c2960299
AD
9536 '') stdio_cnt='((fp)->_cnt)'
9537 cnt_lval=$define
9538 ;;
8e07c86e 9539 *) cnt_lval=$d_stdio_cnt_lval;;
16d20bd9
AD
9540 esac
9541 case "$stdio_base" in
9542 '') stdio_base='((fp)->_base)';;
9543 esac
9544 case "$stdio_bufsiz" in
9545 '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
9546 esac
9547fi
9548: test whether _ptr and _cnt really work
9549echo "Checking how std your stdio is..." >&4
9550$cat >try.c <<EOP
9551#include <stdio.h>
9552#define FILE_ptr(fp) $stdio_ptr
9553#define FILE_cnt(fp) $stdio_cnt
8ff267be 9554main() {
16d20bd9
AD
9555 FILE *fp = fopen("try.c", "r");
9556 char c = getc(fp);
9557 if (
9558 18 <= FILE_cnt(fp) &&
9559 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
9560 )
9561 exit(0);
9562 exit(1);
9563}
9564EOP
9565val="$undef"
dfe9444c
AD
9566set try
9567if eval $compile; then
16d20bd9
AD
9568 if ./try; then
9569 echo "Your stdio acts pretty std."
9570 val="$define"
9571 else
9572 echo "Your stdio isn't very std."
9573 fi
9574else
9575 echo "Your stdio doesn't appear very std."
9576fi
9577$rm -f try.c try
9578set d_stdstdio
9579eval $setvar
9580
8e07c86e 9581: Can _ptr be used as an lvalue?
e50aee73
AD
9582case "$d_stdstdio$ptr_lval" in
9583$define$define) val=$define ;;
c2960299
AD
9584*) val=$undef ;;
9585esac
9586set d_stdio_ptr_lval
9587eval $setvar
9588
8e07c86e 9589: Can _cnt be used as an lvalue?
e50aee73
AD
9590case "$d_stdstdio$cnt_lval" in
9591$define$define) val=$define ;;
c2960299
AD
9592*) val=$undef ;;
9593esac
9594set d_stdio_cnt_lval
9595eval $setvar
9596
16d20bd9
AD
9597: see if _base is also standard
9598val="$undef"
9599case "$d_stdstdio" in
9600$define)
9601 $cat >try.c <<EOP
9602#include <stdio.h>
9603#define FILE_base(fp) $stdio_base
9604#define FILE_bufsiz(fp) $stdio_bufsiz
8ff267be 9605main() {
16d20bd9
AD
9606 FILE *fp = fopen("try.c", "r");
9607 char c = getc(fp);
9608 if (
9609 19 <= FILE_bufsiz(fp) &&
9610 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
9611 )
9612 exit(0);
9613 exit(1);
9614}
9615EOP
dfe9444c
AD
9616 set try
9617 if eval $compile; then
16d20bd9 9618 if ./try; then
8ff267be 9619 echo "And its _base field acts std."
16d20bd9
AD
9620 val="$define"
9621 else
9622 echo "But its _base field isn't std."
9623 fi
9624 else
9625 echo "However, it seems to be lacking the _base field."
9626 fi
9627 $rm -f try.c try
9628 ;;
9629esac
9630set d_stdiobase
9631eval $setvar
9632
a0d0e21e
LW
9633: see if strcoll exists
9634set strcoll d_strcoll
9635eval $inlibc
2304df62
AD
9636
9637: check for structure copying
9638echo " "
9639echo "Checking to see if your C compiler can copy structs..." >&4
9640$cat >try.c <<'EOCP'
9641main()
9642{
9643 struct blurfl {
9644 int dyick;
9645 } foo, bar;
9646
9647 foo = bar;
9648}
9649EOCP
9650if $cc -c try.c >/dev/null 2>&1 ; then
9651 val="$define"
9652 echo "Yup, it can."
9653else
9654 val="$undef"
9655 echo "Nope, it can't."
9656fi
9657set d_strctcpy
9658eval $setvar
9659$rm -f try.*
9660
9661: see if strerror and/or sys_errlist[] exist
9662echo " "
28e8609d
JH
9663if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
9664 if set strerror val -f d_strerror; eval $csym; $val; then
5ff3f7a4
GS
9665 echo 'strerror() found.' >&4
9666 d_strerror="$define"
9667 d_strerrm='strerror(e)'
9668 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
9669 echo "(You also have sys_errlist[], so we could roll our own strerror.)"
9670 d_syserrlst="$define"
9671 else
9672 echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
9673 d_syserrlst="$undef"
9674 fi
28e8609d 9675 elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
5ff3f7a4
GS
9676 $contains '#[ ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
9677 echo 'strerror() found in string header.' >&4
9678 d_strerror="$define"
9679 d_strerrm='strerror(e)'
9680 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
9681 echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
9682 d_syserrlst="$define"
9683 else
9684 echo "(You don't appear to have any sys_errlist[], how can this be?)"
9685 d_syserrlst="$undef"
9686 fi
28e8609d 9687 elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
5ff3f7a4
GS
9688 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
9689 d_strerror="$undef"
9690 d_syserrlst="$define"
9691 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
28e8609d 9692 else
5ff3f7a4
GS
9693 echo 'strerror() and sys_errlist[] NOT found.' >&4
9694 d_strerror="$undef"
9695 d_syserrlst="$undef"
9696 d_strerrm='"unknown"'
28e8609d 9697 fi
2304df62
AD
9698fi
9699
a89d8a78
DH
9700: see if strtod exists
9701set strtod d_strtod
9702eval $inlibc
9703
9704: see if strtol exists
9705set strtol d_strtol
9706eval $inlibc
9707
9708: see if strtoul exists
9709set strtoul d_strtoul
9710eval $inlibc
9711
a0d0e21e
LW
9712: see if strxfrm exists
9713set strxfrm d_strxfrm
9714eval $inlibc
9715
2304df62
AD
9716: see if symlink exists
9717set symlink d_symlink
9718eval $inlibc
9719
9720: see if syscall exists
9721set syscall d_syscall
9722eval $inlibc
9723
a0d0e21e
LW
9724: see if sysconf exists
9725set sysconf d_sysconf
9726eval $inlibc
9727
2304df62
AD
9728: see if system exists
9729set system d_system
9730eval $inlibc
9731
a0d0e21e
LW
9732: see if tcgetpgrp exists
9733set tcgetpgrp d_tcgetpgrp
9734eval $inlibc
9735
2c7991dc 9736: see if tcsetpgrp exists
9737set tcsetpgrp d_tcsetpgrp
9738eval $inlibc
4633a7c4 9739
2c7991dc 9740: define an is-a-typedef? function
9741typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9742case "$inclist" in
9743"") inclist="sys/types.h";;
9744esac;
9745eval "varval=\$$var";
9746case "$varval" in
9747"")
9748 $rm -f temp.c;
9749 for inc in $inclist; do
9750 echo "#include <$inc>" >>temp.c;
9751 done;
c4f23d77
AD
9752 echo "#ifdef $type" >> temp.c;
9753 echo "printf(\"We have $type\");" >> temp.c;
9754 echo "#endif" >> temp.c;
2c7991dc 9755 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9756 if $contains $type temp.E >/dev/null 2>&1; then
9757 eval "$var=\$type";
9758 else
9759 eval "$var=\$def";
9760 fi;
9761 $rm -f temp.?;;
9762*) eval "$var=\$varval";;
9763esac'
4633a7c4 9764
dc45a647
MB
9765: define an is-a-typedef? function that prompts if the type is not available.
9766typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9767case "$inclist" in
9768"") inclist="sys/types.h";;
9769esac;
9770eval "varval=\$$var";
9771case "$varval" in
9772"")
9773 $rm -f temp.c;
9774 for inc in $inclist; do
9775 echo "#include <$inc>" >>temp.c;
9776 done;
c4f23d77
AD
9777 echo "#ifdef $type" >> temp.c;
9778 echo "printf(\"We have $type\");" >> temp.c;
9779 echo "#endif" >> temp.c;
dc45a647
MB
9780 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9781 echo " " ;
9782 echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9783 if $contains $type temp.E >/dev/null 2>&1; then
9784 echo "$type found." >&4;
9785 eval "$var=\$type";
9786 else
9787 echo "$type NOT found." >&4;
9788 dflt="$def";
9789 . ./myread ;
9790 eval "$var=\$ans";
9791 fi;
9792 $rm -f temp.?;;
9793*) eval "$var=\$varval";;
9794esac'
9795
2c7991dc 9796: see if this is a sys/times.h system
9797set sys/times.h i_systimes
9798eval $inhdr
4633a7c4 9799
2c7991dc 9800: see if times exists
4633a7c4 9801echo " "
2c7991dc 9802if set times val -f d_times; eval $csym; $val; then
9803 echo 'times() found.' >&4
9804 d_times="$define"
9805 inc=''
9806 case "$i_systimes" in
9807 "$define") inc='sys/times.h';;
9808 esac
dc45a647 9809 rp="What is the type returned by times() on this system?"
2c7991dc 9810 set clock_t clocktype long stdio.h sys/types.h $inc
dc45a647 9811 eval $typedef_ask
2c7991dc 9812else
9813 echo 'times() NOT found, hope that will do.' >&4
9814 d_times="$undef"
9815 clocktype='int'
9816fi
2304df62 9817
2c7991dc 9818: see if truncate exists
9819set truncate d_truncate
9820eval $inlibc
2304df62 9821
2c7991dc 9822: see if tzname[] exists
9823echo " "
9824if set tzname val -a d_tzname; eval $csym; $val; then
9825 val="$define"
9826 echo 'tzname[] found.' >&4
9827else
9828 val="$undef"
9829 echo 'tzname[] NOT found.' >&4
9830fi
9831set d_tzname
9832eval $setvar
9833
9834: see if umask exists
9835set umask d_umask
9836eval $inlibc
85e6fe83 9837
4633a7c4
LW
9838: backward compatibility for d_hvfork
9839if test X$d_hvfork != X; then
9840 d_vfork="$d_hvfork"
9841 d_hvfork=''
9842fi
9843: see if there is a vfork
9844val=''
9845set vfork val
9846eval $inlibc
ecfc5424 9847
4633a7c4
LW
9848: Ok, but do we want to use it. vfork is reportedly unreliable in
9849: perl on Solaris 2.x, and probably elsewhere.
9850case "$val" in
9851$define)
16d20bd9 9852 echo " "
4633a7c4
LW
9853 case "$usevfork" in
9854 false) dflt='n';;
9855 *) dflt='y';;
9856 esac
9857 rp="Some systems have problems with vfork(). Do you want to use it?"
9858 . ./myread
9859 case "$ans" in
9860 y|Y) ;;
9861 *)
9862 echo "Ok, we won't use vfork()."
9863 val="$undef"
9864 ;;
9865 esac
ecfc5424
AD
9866 ;;
9867esac
4633a7c4
LW
9868set d_vfork
9869eval $setvar
9870case "$d_vfork" in
9871$define) usevfork='true';;
9872*) usevfork='false';;
9873esac
ecfc5424 9874
4633a7c4
LW
9875: see if this is an sysdir system
9876set sys/dir.h i_sysdir
9877eval $inhdr
9878
9879: see if this is an sysndir system
9880set sys/ndir.h i_sysndir
9881eval $inhdr
9882
bfb7748a
AD
9883: see if sys/types.h has to be included
9884set sys/types.h i_systypes
9885eval $inhdr
9886
4633a7c4
LW
9887: see if closedir exists
9888set closedir d_closedir
9889eval $inlibc
9890
9891case "$d_closedir" in
9892"$define")
16d20bd9 9893 echo " "
4633a7c4
LW
9894 echo "Checking whether closedir() returns a status..." >&4
9895 cat > closedir.c <<EOM
9896#$i_dirent I_DIRENT /**/
9897#$i_sysdir I_SYS_DIR /**/
9898#$i_sysndir I_SYS_NDIR /**/
bfb7748a 9899#$i_systypes I_SYS_TYPES /**/
4633a7c4 9900
bfb7748a
AD
9901#if defined(I_SYS_TYPES)
9902#include <sys/types.h>
9903#endif
4633a7c4
LW
9904#if defined(I_DIRENT)
9905#include <dirent.h>
9906#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
9907#include <sys/dir.h>
4aa0a1f7 9908#endif
4633a7c4
LW
9909#else
9910#ifdef I_SYS_NDIR
9911#include <sys/ndir.h>
9912#else
9913#ifdef I_SYS_DIR
9914#ifdef hp9000s500
9915#include <ndir.h> /* may be wrong in the future */
9916#else
9917#include <sys/dir.h>
9918#endif
9919#endif
9920#endif
9921#endif
9922int main() { return closedir(opendir(".")); }
9923EOM
dfe9444c 9924 set closedir
dc45a647 9925 if eval $compile_ok; then
4633a7c4
LW
9926 if ./closedir > /dev/null 2>&1 ; then
9927 echo "Yes, it does."
9928 val="$undef"
ecfc5424 9929 else
4633a7c4
LW
9930 echo "No, it doesn't."
9931 val="$define"
ecfc5424
AD
9932 fi
9933 else
4633a7c4
LW
9934 echo "(I can't seem to compile the test program--assuming it doesn't)"
9935 val="$define"
ecfc5424 9936 fi
ecfc5424 9937 ;;
4633a7c4
LW
9938*)
9939 val="$undef";
ecfc5424
AD
9940 ;;
9941esac
4633a7c4
LW
9942set d_void_closedir
9943eval $setvar
9944$rm -f closedir*
9945: check for volatile keyword
ecfc5424 9946echo " "
4633a7c4
LW
9947echo 'Checking to see if your C compiler knows about "volatile"...' >&4
9948$cat >try.c <<'EOCP'
9949main()
9950{
9951 typedef struct _goo_struct goo_struct;
9952 goo_struct * volatile goo = ((goo_struct *)0);
9953 struct _goo_struct {
9954 long long_int;
9955 int reg_int;
9956 char char_var;
9957 };
9958 typedef unsigned short foo_t;
9959 char *volatile foo;
9960 volatile int bar;
9961 volatile foo_t blech;
9962 foo = foo;
a0d0e21e
LW
9963}
9964EOCP
4633a7c4
LW
9965if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
9966 val="$define"
9967 echo "Yup, it does."
9968else
9969 val="$undef"
9970 echo "Nope, it doesn't."
9971fi
9972set d_volatile
9973eval $setvar
9974$rm -f try.*
a0d0e21e 9975
4633a7c4
LW
9976: see if there is a wait4
9977set wait4 d_wait4
8e07c86e
AD
9978eval $inlibc
9979
4633a7c4
LW
9980: see if waitpid exists
9981set waitpid d_waitpid
9982eval $inlibc
9983
9984: see if wcstombs exists
9985set wcstombs d_wcstombs
9986eval $inlibc
9987
9988: see if wctomb exists
9989set wctomb d_wctomb
9990eval $inlibc
9991
9992: preserve RCS keywords in files with variable substitution, grrr
9993Date='$Date'
9994Id='$Id'
9995Log='$Log'
9996RCSfile='$RCSfile'
9997Revision='$Revision'
9998
9999: check for alignment requirements
10000echo " "
10001case "$alignbytes" in
10002'') echo "Checking alignment constraints..." >&4
10003 $cat >try.c <<'EOCP'
10004struct foobar {
10005 char foo;
10006 double bar;
10007} try;
10008main()
10009{
10010 printf("%d\n", (char *)&try.bar - (char *)&try.foo);
10011}
10012EOCP
dfe9444c 10013 set try
dc45a647 10014 if eval $compile_ok; then
4633a7c4
LW
10015 dflt=`./try`
10016 else
10017 dflt='8'
41992daf 10018 echo "(I can't seem to compile the test program...)"
4633a7c4 10019 fi
ecfc5424 10020 ;;
4633a7c4 10021*) dflt="$alignbytes"
8e07c86e 10022 ;;
ecfc5424 10023esac
4633a7c4
LW
10024rp="Doubles must be aligned on a how-many-byte boundary?"
10025. ./myread
10026alignbytes="$ans"
10027$rm -f try.c try
85e6fe83 10028
4633a7c4
LW
10029: check for ordering of bytes in a long
10030case "$byteorder" in
10031'')
10032 $cat <<'EOM'
10033
10034In the following, larger digits indicate more significance. A big-endian
10035machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
10036little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
10037machines may have weird orders like 3412. A Cray will report 87654321. If
10038the test program works the default is probably right.
10039I'm now running the test program...
10040EOM
10041 $cat >try.c <<'EOCP'
10042#include <stdio.h>
10043main()
10044{
10045 int i;
10046 union {
10047 unsigned long l;
10048 char c[sizeof(long)];
10049 } u;
10050
10051 if (sizeof(long) > 4)
10052 u.l = (0x08070605L << 32) | 0x04030201L;
10053 else
10054 u.l = 0x04030201L;
10055 for (i = 0; i < sizeof(long); i++)
10056 printf("%c", u.c[i]+'0');
10057 printf("\n");
10058 exit(0);
10059}
10060EOCP
10061 xxx_prompt=y
dfe9444c
AD
10062 set try
10063 if eval $compile && ./try > /dev/null; then
4633a7c4
LW
10064 dflt=`./try`
10065 case "$dflt" in
10066 [1-4][1-4][1-4][1-4]|12345678|87654321)
10067 echo "(The test program ran ok.)"
10068 echo "byteorder=$dflt"
10069 xxx_prompt=n
10070 ;;
10071 ????|????????) echo "(The test program ran ok.)" ;;
10072 *) echo "(The test program didn't run right for some reason.)" ;;
10073 esac
10074 else
10075 dflt='4321'
10076 cat <<'EOM'
10077(I can't seem to compile the test program. Guessing big-endian...)
10078EOM
10079 fi
10080 case "$xxx_prompt" in
10081 y)
10082 rp="What is the order of bytes in a long?"
10083 . ./myread
10084 byteorder="$ans"
10085 ;;
10086 *) byteorder=$dflt
ecfc5424
AD
10087 ;;
10088 esac
10089 ;;
10090esac
4633a7c4 10091$rm -f try.c try
85e6fe83 10092
4633a7c4 10093: how do we catenate cpp tokens here?
2304df62 10094echo " "
4633a7c4
LW
10095echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
10096$cat >cpp_stuff.c <<'EOCP'
10097#define RCAT(a,b)a/**/b
10098#define ACAT(a,b)a ## b
10099RCAT(Rei,ser)
10100ACAT(Cir,cus)
10101EOCP
10102$cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
10103if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
dfe9444c 10104 echo "Oh! Smells like ANSI's been here." >&4
4633a7c4
LW
10105 echo "We can catify or stringify, separately or together!"
10106 cpp_stuff=42
10107elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
dfe9444c 10108 echo "Ah, yes! The good old days!" >&4
4633a7c4
LW
10109 echo "However, in the good old days we don't know how to stringify and"
10110 echo "catify at the same time."
10111 cpp_stuff=1
10112else
10113 $cat >&4 <<EOM
10114Hmm, I don't seem to be able to catenate tokens with your cpp. You're going
10115to have to edit the values of CAT[2-5] in config.h...
a0d0e21e 10116EOM
4633a7c4
LW
10117 cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
10118fi
10119$rm -f cpp_stuff.*
a0d0e21e 10120
4633a7c4
LW
10121: see if this is a db.h system
10122set db.h i_db
10123eval $inhdr
10124
10125case "$i_db" in
68dc0745 10126$define)
1f70e1ea 10127 : Check db version.
68dc0745 10128 echo " "
10129 echo "Checking Berkeley DB version ..." >&4
10130 $cat >try.c <<EOCP
10131#$d_const HASCONST
10132#ifndef HASCONST
10133#define const
10134#endif
10135#include <sys/types.h>
10136#include <stdio.h>
10137#include <db.h>
10138main()
10139{
1f70e1ea
PM
10140#ifdef DB_VERSION_MAJOR /* DB version >= 2 */
10141 int Major, Minor, Patch ;
ee02776e 10142 unsigned long Version ;
1f70e1ea
PM
10143 (void)db_version(&Major, &Minor, &Patch) ;
10144 printf("You have Berkeley DB Version 2 or greater\n");
10145
10146 printf("db.h is from Berkeley DB Version %d.%d.%d\n",
10147 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
10148 printf("libdb is from Berkeley DB Version %d.%d.%d\n",
10149 Major, Minor, Patch) ;
10150
10151 /* check that db.h & libdb are compatible */
10152 if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
10153 printf("db.h and libdb are incompatible\n") ;
10154 exit(3);
10155 }
10156
10157 printf("db.h and libdb are compatible\n") ;
ee02776e
PM
10158
10159 Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
693762b4 10160 + DB_VERSION_PATCH ;
ee02776e
PM
10161
10162 /* needs to be >= 2.3.4 */
10163 if (Version < 2003004) {
693762b4 10164 /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
ee02776e 10165 printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
1f70e1ea
PM
10166 exit(2);
10167 }
10168
10169 exit(0);
68dc0745 10170#else
6a1b87e5 10171#if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
1f70e1ea 10172 printf("You have Berkeley DB Version 1\n");
6a1b87e5
JH
10173 exit(0); /* DB version < 2: the coast is clear. */
10174#else
10175 exit(1); /* <db.h> not Berkeley DB? */
10176#endif
68dc0745 10177#endif
10178}
10179EOCP
dfe9444c
AD
10180 set try
10181 if eval $compile && ./try; then
1f70e1ea 10182 echo 'Looks OK.' >&4
68dc0745 10183 else
c90c0ff4 10184 echo "I can't use Berkeley DB with your <db.h>. I'll disable Berkeley DB." >&4
68dc0745 10185 i_db=$undef
10186 case " $libs " in
10187 *"-ldb "*)
10188 : Remove db from list of libraries to use
10189 echo "Removing unusable -ldb from library list" >&4
10190 set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
10191 shift
10192 libs="$*"
10193 echo "libs = $libs" >&4
10194 ;;
10195 esac
10196 fi
10197 $rm -f try.*
10198 ;;
10199esac
10200
10201case "$i_db" in
4633a7c4 10202define)
dc45a647
MB
10203 : Check the return type needed for hash
10204 echo " "
10205 echo "Checking return type needed for hash for Berkeley DB ..." >&4
10206 $cat >try.c <<EOCP
10207#$d_const HASCONST
10208#ifndef HASCONST
10209#define const
10210#endif
10211#include <sys/types.h>
10212#include <db.h>
10213
10214#ifndef DB_VERSION_MAJOR
10215u_int32_t hash_cb (ptr, size)
10216const void *ptr;
10217size_t size;
10218{
10219}
10220HASHINFO info;
10221main()
10222{
10223 info.hash = hash_cb;
10224}
10225#endif
10226EOCP
10227 if $cc $ccflags -c try.c >try.out 2>&1 ; then
10228 if $contains warning try.out >>/dev/null 2>&1 ; then
10229 db_hashtype='int'
10230 else
10231 db_hashtype='u_int32_t'
10232 fi
10233 else
10234 : XXX Maybe we should just give up here.
10235 db_hashtype=u_int32_t
10236 $cat try.out >&4
10237 echo "Help: I can't seem to compile the db test program." >&4
10238 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
10239 fi
10240 $rm -f try.*
10241 echo "Your version of Berkeley DB uses $db_hashtype for hash."
10242 ;;
10243*) db_hashtype=u_int32_t
10244 ;;
10245esac
10246case "$i_db" in
10247define)
4633a7c4
LW
10248 : Check the return type needed for prefix
10249 echo " "
10250 echo "Checking return type needed for prefix for Berkeley DB ..." >&4
10251 cat >try.c <<EOCP
10252#$d_const HASCONST
10253#ifndef HASCONST
10254#define const
10255#endif
10256#include <sys/types.h>
10257#include <db.h>
1f70e1ea
PM
10258
10259#ifndef DB_VERSION_MAJOR
4633a7c4
LW
10260size_t prefix_cb (key1, key2)
10261const DBT *key1;
10262const DBT *key2;
10263{
10264}
10265BTREEINFO info;
10266main()
10267{
10268 info.prefix = prefix_cb;
10269}
1f70e1ea 10270#endif
4633a7c4
LW
10271EOCP
10272 if $cc $ccflags -c try.c >try.out 2>&1 ; then
10273 if $contains warning try.out >>/dev/null 2>&1 ; then
10274 db_prefixtype='int'
10275 else
10276 db_prefixtype='size_t'
10277 fi
10278 else
68dc0745 10279 db_prefixtype='size_t'
10280 : XXX Maybe we should just give up here.
dc45a647 10281 $cat try.out >&4
68dc0745 10282 echo "Help: I can't seem to compile the db test program." >&4
10283 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
4633a7c4
LW
10284 fi
10285 $rm -f try.*
10286 echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
a0d0e21e 10287 ;;
68dc0745 10288*) db_prefixtype='size_t'
4633a7c4
LW
10289 ;;
10290esac
a0d0e21e 10291
4633a7c4
LW
10292: check for void type
10293echo " "
10294echo "Checking to see how well your C compiler groks the void type..." >&4
4633a7c4
LW
10295case "$voidflags" in
10296'')
10297 $cat >try.c <<'EOCP'
10298#if TRY & 1
760ac839 10299void sub() {
4633a7c4 10300#else
760ac839 10301sub() {
4633a7c4
LW
10302#endif
10303 extern void moo(); /* function returning void */
10304 void (*goo)(); /* ptr to func returning void */
10305#if TRY & 8
10306 void *hue; /* generic ptr */
10307#endif
10308#if TRY & 2
10309 void (*foo[10])();
10310#endif
a0d0e21e 10311
4633a7c4
LW
10312#if TRY & 4
10313 if(goo == moo) {
10314 exit(0);
10315 }
10316#endif
10317 exit(0);
10318}
760ac839 10319main() { sub(); }
4633a7c4 10320EOCP
760ac839 10321 if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
4633a7c4 10322 voidflags=$defvoidused
bfb7748a 10323 echo "Good. It appears to support void to the level $package wants.">&4
4633a7c4
LW
10324 if $contains warning .out >/dev/null 2>&1; then
10325 echo "However, you might get some warnings that look like this:"
10326 $cat .out
10327 fi
10328 else
10329echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
760ac839 10330 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
4633a7c4 10331 echo "It supports 1..."
760ac839 10332 if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
4633a7c4 10333 echo "It also supports 2..."
760ac839 10334 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
4633a7c4
LW
10335 voidflags=7
10336 echo "And it supports 4 but not 8 definitely."
10337 else
10338 echo "It doesn't support 4..."
760ac839 10339 if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
4633a7c4
LW
10340 voidflags=11
10341 echo "But it supports 8."
10342 else
10343 voidflags=3
10344 echo "Neither does it support 8."
10345 fi
10346 fi
10347 else
10348 echo "It does not support 2..."
760ac839 10349 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
4633a7c4
LW
10350 voidflags=13
10351 echo "But it supports 4 and 8."
10352 else
760ac839 10353 if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
4633a7c4
LW
10354 voidflags=5
10355 echo "And it supports 4 but has not heard about 8."
10356 else
10357 echo "However it supports 8 but not 4."
10358 fi
10359 fi
10360 fi
10361 else
10362 echo "There is no support at all for void."
10363 voidflags=0
10364 fi
10365 fi
10366esac
4633a7c4 10367case "$voidflags" in
2c7991dc 10368"$defvoidused") ;;
bfb7748a
AD
10369*) $cat >&4 <<'EOM'
10370 Support flag bits are:
10371 1: basic void declarations.
10372 2: arrays of pointers to functions returning void.
10373 4: operations between pointers to and addresses of void functions.
10374 8: generic void pointers.
10375EOM
2c7991dc 10376 dflt="$voidflags";
4633a7c4 10377 rp="Your void support flags add up to what?"
a0d0e21e 10378 . ./myread
4633a7c4 10379 voidflags="$ans"
a0d0e21e
LW
10380 ;;
10381esac
4633a7c4 10382$rm -f try.* .out
a0d0e21e 10383
85ab1d1d
JH
10384
10385: How can we generate normalized random numbers ?
693762b4 10386echo " "
85ab1d1d 10387case "$randfunc" in
693762b4 10388'')
85ab1d1d
JH
10389 if set drand48 val -f; eval $csym; $val; then
10390 dflt="drand48"
10391 echo "Good, found drand48()." >&4
10392 elif set random val -f; eval $csym; $val; then
10393 dflt="random"
10394 echo "OK, found random()." >&4
10395 else
10396 dflt="rand"
10397 echo "Yick, looks like I have to use rand()." >&4
10398 fi
10399 echo " "
10400 ;;
10401*)
10402 dflt="$randfunc"
10403 ;;
10404esac
10405cont=true
10406
10407case "$ccflags" in
10408*-Dmy_rand=*|*-Dmy_srand=*)
10409 echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
10410 ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
10411 ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
10412 ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
10413 ;;
10414esac
10415
10416while $test "$cont"; do
10417 rp="Use which function to generate random numbers?"
10418 . ./myread
10419 if $test "$ans" = "$dflt"; then
10420 : null
10421 else
10422 randbits=''
10423 fi
10424 randfunc="$ans"
10425 if set $ans val -f; eval $csym; $val; then
10426 cont=''
10427 else
10428 dflt=n
10429 rp="Function $ans does not exists. Use that name anyway?"
10430 . ./myread
10431 dflt=rand
10432 case "$ans" in
10433 [yY]*) cont='';;
10434 esac
10435 fi
10436 case "$cont" in
10437 '')
10438 case "$randfunc" in
10439 drand48)
10440 drand01="drand48()"
10441 seedfunc="srand48"
10442 randbits=48
10443 randseedtype=long
10444 ;;
10445 rand|random)
10446 case "$randbits" in
10447 '')
10448echo "Checking to see how many bits your $randfunc() function produces..." >&4
10449 $cat >try.c <<EOCP
10450#$i_unistd I_UNISTD
10451#$i_stdlib I_STDLIB
693762b4 10452#include <stdio.h>
85ab1d1d
JH
10453#ifdef I_UNISTD
10454# include <unistd.h>
10455#endif
10456#ifdef I_STDLIB
10457# include <stdlib.h>
10458#endif
693762b4
AD
10459main()
10460{
85ab1d1d
JH
10461 register int i;
10462 register unsigned long tmp;
10463 register unsigned long max = 0L;
10464
10465 for (i = 1000; i; i--) {
10466 tmp = (unsigned long) $randfunc();
10467 if (tmp > max) max = tmp;
10468 }
10469 for (i = 0; max; i++)
10470 max /= 2;
10471 printf("%d\n",i);
693762b4
AD
10472}
10473EOCP
85ab1d1d
JH
10474 set try
10475 if eval $compile_ok; then
10476 dflt=`try`
10477 else
10478 dflt='?'
10479 echo "(I can't seem to compile the test program...)"
10480 fi
10481 ;;
10482 *)
10483 dflt="$randbits"
10484 ;;
10485 esac
10486 rp="How many bits does your $randfunc() function produce?"
10487 . ./myread
10488 randbits="$ans"
10489 $rm -f try.c try
10490 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
10491 seedfunc="s$randfunc"
10492 randseedtype=unsigned
10493 ;;
10494 *)
10495 dflt="31"
10496 rp="How many bits does your $randfunc() function produce?"
10497 . ./myread
10498 randbits="$ans"
10499 seedfunc="s$randfunc"
10500 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
10501 if set $seedfunc val -f; eval $csym; $val; then
10502 echo "(Using $seedfunc() to seed random generator)"
10503 else
10504 echo "(Warning: no $seedfunc() to seed random generator)"
10505 seedfunc=rand
10506 fi
10507 randseedtype=unsigned
10508 ;;
10509 esac
10510 ;;
10511 esac
10512done
693762b4 10513
5ff3f7a4
GS
10514echo " "
10515echo "Determining whether or not we are on an EBCDIC system..." >&4
10516$cat >tebcdic.c <<'EOM'
10517int main()
10518{
10519 if ('M'==0xd4) return 0;
10520 return 1;
10521}
10522EOM
10523
10524val=$undef
10525set tebcdic
10526if eval $compile_ok; then
10527 if ./tebcdic; then
10528 echo "You have EBCDIC." >&4
10529 val="$define"
10530 else
10531 echo "Nope, no EBCDIC. Assuming ASCII or some ISO Latin." >&4
10532 fi
10533else
5cc3184f 10534 echo "I'm unable to compile the test program." >&4
5ff3f7a4
GS
10535 echo "I'll assume ASCII or some ISO Latin." >&4
10536fi
10537$rm -f tebcdic.c tebcdic
10538set ebcdic
10539eval $setvar
10540
a0d0e21e 10541: see what type file positions are declared as in the library
a0d0e21e 10542rp="What is the type for file position used by fsetpos()?"
dc45a647
MB
10543set fpos_t fpostype long stdio.h sys/types.h
10544eval $typedef_ask
2304df62 10545
1aef975c
AD
10546: Store the full pathname to the sed program for use in the C program
10547full_sed=$sed
10548
2304df62 10549: see what type gids are declared as in the kernel
dc45a647
MB
10550echo " "
10551echo "Looking for the type for group ids returned by getgid()."
a0d0e21e
LW
10552set gid_t gidtype xxx stdio.h sys/types.h
10553eval $typedef
2304df62 10554case "$gidtype" in
a0d0e21e
LW
10555xxx)
10556 xxx=`./findhdr sys/user.h`
10557 set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
10558 case $1 in
10559 unsigned) dflt="$1 $2" ;;
10560 *) dflt="$1" ;;
10561 esac
2304df62 10562 ;;
a0d0e21e 10563*) dflt="$gidtype";;
2304df62 10564esac
dc45a647
MB
10565case "$gidtype" in
10566gid_t) echo "gid_t found." ;;
10567*) rp="What is the type for group ids returned by getgid()?"
10568 . ./myread
10569 gidtype="$ans"
10570 ;;
10571esac
a0d0e21e 10572
2304df62
AD
10573: see if getgroups exists
10574set getgroups d_getgrps
10575eval $inlibc
10576
5cd24f17 10577: see if setgroups exists
10578set setgroups d_setgrps
10579eval $inlibc
10580
dfe9444c 10581
8cc95fdb 10582: Find type of 2nd arg to 'getgroups()' and 'setgroups()'
a0d0e21e 10583echo " "
5cd24f17 10584case "$d_getgrps$d_setgrps" in
10585*define*)
a0d0e21e 10586 case "$groupstype" in
2304df62
AD
10587 '') dflt="$gidtype" ;;
10588 *) dflt="$groupstype" ;;
a0d0e21e
LW
10589 esac
10590 $cat <<EOM
dc45a647 10591What type of pointer is the second argument to getgroups() and setgroups()?
5cd24f17 10592Usually this is the same as group ids, $gidtype, but not always.
2304df62
AD
10593
10594EOM
dc45a647 10595 rp='What type pointer is the second argument to getgroups() and setgroups()?'
a0d0e21e
LW
10596 . ./myread
10597 groupstype="$ans"
10598 ;;
10599*) groupstype="$gidtype";;
2304df62 10600esac
2304df62 10601
85e6fe83 10602: see what type lseek is declared as in the kernel
dc45a647 10603rp="What is the type used for lseek's offset on this system?"
a0d0e21e 10604set off_t lseektype long stdio.h sys/types.h
dc45a647 10605eval $typedef_ask
2304df62 10606
8ff267be 10607echo " "
5ff3f7a4
GS
10608$echo $n "Checking to see how big your file offsets are...$c" >&4
10609$cat >try.c <<EOCP
10610#include <sys/types.h>
10611#include <stdio.h>
10612main()
10613{
10614 printf("%d\n", sizeof($lseektype));
10615}
10616EOCP
10617set try
10618if eval $compile_ok; then
10619 lseeksize=`./try`
10620 $echo " $lseeksize bytes." >&4
10621else
10622 dflt='4'
10623 echo " "
10624 echo "(I can't seem to compile the test program. Guessing...)"
10625 rp="What is the size of your file offsets (in bytes)?"
10626 . ./myread
10627 lseeksize="$ans"
10628fi
10629$rm -f try.c try
10630
10631echo " "
dfe9444c 10632echo "Checking if your $make program sets \$(MAKE)..." >&4
8ff267be 10633case "$make_set_make" in
10634'')
10635 $sed 's/^X //' > testmake.mak << 'EOF'
10636Xall:
dfe9444c 10637X @echo 'maketemp="$(MAKE)"'
8ff267be 10638EOF
8ff267be 10639 case "`$make -f testmake.mak 2>/dev/null`" in
dfe9444c 10640 *maketemp=*) make_set_make='#' ;;
8ff267be 10641 *) make_set_make="MAKE=$make" ;;
10642 esac
dfe9444c
AD
10643 $rm -f testmake.mak
10644 ;;
10645esac
10646case "$make_set_make" in
10647'#') echo "Yup, it does.";;
10648*) echo "Nope, it doesn't.";;
10649esac
10650
10651: see what type is used for mode_t
dc45a647 10652rp="What is the type used for file modes for system calls (e.g. fchmod())?"
dfe9444c 10653set mode_t modetype int stdio.h sys/types.h
dc45a647 10654eval $typedef_ask
dfe9444c 10655
dfe9444c
AD
10656: define a fucntion to check prototypes
10657$cat > protochk <<EOSH
10658$startsh
10659cc="$cc"
10660optimize="$optimize"
10661ccflags="$ccflags"
10662prototype="$prototype"
10663define="$define"
10664rm=$rm
10665EOSH
10666
10667$cat >> protochk <<'EOSH'
10668
10669$rm -f try.c
10670foo="$1"
10671shift
10672while test $# -ge 2; do
10673 case "$1" in
10674 $define) echo "#include <$2>" >> try.c ;;
10675 literal) echo "$2" >> try.c ;;
10676 esac
10677 shift 2
10678done
10679test "$prototype" = "$define" && echo '#define CAN_PROTOTYPE' >> try.c
10680cat >> try.c <<'EOCP'
10681#ifdef CAN_PROTOTYPE
10682#define _(args) args
10683#else
10684#define _(args) ()
10685#endif
10686EOCP
10687echo "$foo" >> try.c
10688echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10689$cc $optimize $ccflags -c try.c > /dev/null 2>&1
10690status=$?
10691$rm -f try.[co]
10692exit $status
10693EOSH
10694chmod +x protochk
10695$eunicefix protochk
10696
dfe9444c 10697: see what type is used for size_t
dc45a647 10698rp="What is the type used for the length parameter for string functions?"
dfe9444c 10699set size_t sizetype 'unsigned int' stdio.h sys/types.h
dc45a647 10700eval $typedef_ask
dfe9444c
AD
10701
10702: check for type of arguments to gethostbyaddr.
10703if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
10704 case "$d_gethbyaddr" in
10705 $define)
10706 $cat <<EOM
10707
10708Checking to see what type of arguments are accepted by gethostbyaddr().
10709EOM
10710 hdrs="$define sys/types.h
10711 $d_socket sys/socket.h
10712 $i_niin netinet/in.h
10713 $i_netdb netdb.h
10714 $i_unistd unistd.h"
10715 : The first arg can 'char *' or 'void *'
10716 : The second arg is some of integral type
10717 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
10718 for yyy in size_t long int; do
10719 case "$netdb_host_type" in
10720 '') try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
10721 if ./protochk "$try" $hdrs; then
10722 echo "Your system accepts $xxx for the first arg."
10723 echo "...and $yyy for the second arg."
10724 netdb_host_type="$xxx"
10725 netdb_hlen_type="$yyy"
10726 fi
10727 ;;
10728 esac
10729 done
10730 done
10731 : In case none of those worked, prompt the user.
10732 case "$netdb_host_type" in
10733 '') rp='What is the type for the 1st argument to gethostbyaddr?'
10734 dflt='char *'
10735 . ./myread
10736 netdb_host_type=$ans
10737 rp='What is the type for the 2nd argument to gethostbyaddr?'
10738 dflt="$sizetype"
10739 . ./myread
10740 netdb_hlen_type=$ans
10741 ;;
10742 esac
10743 ;;
10744 *) : no gethostbyaddr, so pick harmless defaults
10745 netdb_host_type='char *'
10746 netdb_hlen_type="$sizetype"
10747 ;;
10748 esac
10749 # Remove the "const" if needed. -- but then we'll have a
10750 # prototype clash!
10751 # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
10752fi
10753
10754: check for type of argument to gethostbyname.
10755if test "X$netdb_name_type" = X ; then
10756 case "$d_gethbyname" in
10757 $define)
10758 $cat <<EOM
10759
10760Checking to see what type of argument is accepted by gethostbyname().
10761EOM
10762 hdrs="$define sys/types.h
10763 $d_socket sys/socket.h
10764 $i_niin netinet/in.h
10765 $i_netdb netdb.h
10766 $i_unistd unistd.h"
10767 for xxx in "const char *" "char *"; do
10768 case "$netdb_name_type" in
10769 '') try="extern struct hostent *gethostbyname($xxx);"
10770 if ./protochk "$try" $hdrs; then
10771 echo "Your system accepts $xxx."
10772 netdb_name_type="$xxx"
10773 fi
10774 ;;
10775 esac
10776 done
10777 : In case none of those worked, prompt the user.
10778 case "$netdb_name_type" in
10779 '') rp='What is the type for the 1st argument to gethostbyname?'
10780 dflt='char *'
10781 . ./myread
10782 netdb_name_type=$ans
10783 ;;
10784 esac
10785 ;;
10786 *) : no gethostbyname, so pick harmless default
10787 netdb_name_type='char *'
10788 ;;
10789 esac
10790fi
8ff267be 10791
dfe9444c
AD
10792: check for type of 1st argument to getnetbyaddr.
10793if test "X$netdb_net_type" = X ; then
10794 case "$d_getnbyaddr" in
10795 $define)
10796 $cat <<EOM
85e6fe83 10797
dfe9444c
AD
10798Checking to see what type of 1st argument is accepted by getnetbyaddr().
10799EOM
10800 hdrs="$define sys/types.h
10801 $d_socket sys/socket.h
10802 $i_niin netinet/in.h
10803 $i_netdb netdb.h
10804 $i_unistd unistd.h"
10805 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
10806 case "$netdb_net_type" in
10807 '') try="extern struct netent *getnetbyaddr($xxx, int);"
10808 if ./protochk "$try" $hdrs; then
10809 echo "Your system accepts $xxx."
10810 netdb_net_type="$xxx"
10811 fi
10812 ;;
10813 esac
10814 done
10815 : In case none of those worked, prompt the user.
10816 case "$netdb_net_type" in
10817 '') rp='What is the type for the 1st argument to getnetbyaddr?'
10818 dflt='long'
10819 . ./myread
10820 netdb_net_type=$ans
10821 ;;
10822 esac
10823 ;;
10824 *) : no getnetbyaddr, so pick harmless default
e5c9fcd0 10825 netdb_net_type='long'
dfe9444c
AD
10826 ;;
10827 esac
10828fi
2c7991dc 10829: locate the preferred pager for this system
10830case "$pager" in
10831'')
10832 dflt=''
10833 case "$pg" in
10834 /*) dflt=$pg;;
10835 esac
10836 case "$more" in
10837 /*) dflt=$more;;
10838 esac
10839 case "$less" in
10840 /*) dflt=$less;;
10841 esac
10842 case "$dflt" in
10843 '') dflt=/usr/ucb/more;;
10844 esac
10845 ;;
10846*) dflt="$pager";;
10847esac
10848echo " "
10849fn=f/
10850rp='What pager is used on your system?'
10851. ./getfile
10852pager="$ans"
10853
dfe9444c 10854: see what type pids are declared as in the kernel
dc45a647 10855rp="What is the type of process ids on this system?"
dfe9444c 10856set pid_t pidtype int stdio.h sys/types.h
dc45a647 10857eval $typedef_ask
2304df62 10858
693762b4
AD
10859: check for length of pointer
10860echo " "
10861case "$ptrsize" in
10862'')
dc45a647 10863 $echo $n "Checking to see how big your pointers are...$c" >&4
693762b4
AD
10864 if test "$voidflags" -gt 7; then
10865 echo '#define VOID_PTR char *' > try.c
10866 else
10867 echo '#define VOID_PTR void *' > try.c
10868 fi
10869 $cat >>try.c <<'EOCP'
10870#include <stdio.h>
10871main()
10872{
10873 printf("%d\n", sizeof(VOID_PTR));
10874 exit(0);
10875}
10876EOCP
10877 set try
dc45a647 10878 if eval $compile_ok; then
693762b4 10879 ptrsize=`./try`
dc45a647 10880 $echo " $ptrsize bytes." >&4
693762b4
AD
10881 else
10882 dflt='4'
10883 echo "(I can't seem to compile the test program. Guessing...)" >&4
10884 rp="What is the size of a pointer (in bytes)?"
10885 . ./myread
10886 ptrsize="$ans"
10887 fi
10888 ;;
10889esac
10890$rm -f try.c try
10891
a0d0e21e
LW
10892: see if ar generates random libraries by itself
10893echo " "
10894echo "Checking how to generate random libraries on your machine..." >&4
10895echo 'int bar1() { return bar2(); }' > bar1.c
10896echo 'int bar2() { return 2; }' > bar2.c
10897$cat > foo.c <<'EOP'
10898main() { printf("%d\n", bar1()); exit(0); }
10899EOP
10900$cc $ccflags -c bar1.c >/dev/null 2>&1
10901$cc $ccflags -c bar2.c >/dev/null 2>&1
10902$cc $ccflags -c foo.c >/dev/null 2>&1
dfe9444c
AD
10903$ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
10904if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
a0d0e21e 10905 ./foobar >/dev/null 2>&1; then
4e2a5f63 10906 echo "$ar appears to generate random libraries itself."
a0d0e21e
LW
10907 orderlib=false
10908 ranlib=":"
dfe9444c
AD
10909elif $ar ts bar$_a >/dev/null 2>&1 &&
10910 $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
a0d0e21e 10911 ./foobar >/dev/null 2>&1; then
4e2a5f63 10912 echo "a table of contents needs to be added with '$ar ts'."
a0d0e21e 10913 orderlib=false
dfe9444c 10914 ranlib="$ar ts"
a0d0e21e 10915else
ecfc5424
AD
10916 case "$ranlib" in
10917 :) ranlib='';;
10918 '')
10919 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
10920 $test -f $ranlib || ranlib=''
10921 ;;
10922 esac
a0d0e21e 10923 if $test -n "$ranlib"; then
ecfc5424 10924 echo "your system has '$ranlib'; we'll use that."
a0d0e21e
LW
10925 orderlib=false
10926 else
10927 echo "your system doesn't seem to support random libraries"
10928 echo "so we'll use lorder and tsort to order the libraries."
10929 orderlib=true
10930 ranlib=":"
10931 fi
10932fi
10933$rm -f foo* bar*
10934
dfe9444c
AD
10935: check for type of arguments to select.
10936case "$selecttype" in
10937'') case "$d_select" in
10938 $define)
10939 $cat <<EOM
10940Checking to see what type of arguments are accepted by select().
10941EOM
10942 hdrs="$define sys/types.h
10943 $i_systime sys/time.h
10944 $i_sysselct sys/select.h
10945 $d_socket sys/socket.h"
10946 : The first arg can be int, unsigned, or size_t
10947 : The last arg may or may not be 'const'
10948 val=''
7f3d1cf1
BH
10949 : void pointer has been seen but using that
10950 : breaks the selectminbits test
10951 for xxx in 'fd_set *' 'int *'; do
1cfa4ec7 10952 for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
dfe9444c
AD
10953 for tmo in 'struct timeval *' 'const struct timeval *'; do
10954 case "$val" in
10955 '') try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
10956 if ./protochk "$try" $hdrs; then
10957 echo "Your system accepts $xxx."
10958 val="$xxx"
10959 fi
10960 ;;
10961 esac
10962 done
10963 done
10964 done
10965 case "$val" in
10966 '') rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
10967 case "$d_fd_set" in
10968 $define) dflt="fd_set *" ;;
10969 *) dflt="int *" ;;
10970 esac
10971 . ./myread
10972 val=$ans
10973 ;;
a0d0e21e 10974 esac
dfe9444c 10975 selecttype="$val"
a0d0e21e 10976 ;;
dfe9444c
AD
10977 *) : no select, so pick a harmless default
10978 selecttype='int *'
a0d0e21e
LW
10979 ;;
10980 esac
a0d0e21e
LW
10981 ;;
10982esac
2304df62 10983
5ff3f7a4
GS
10984: check for the select 'width'
10985case "$selectminbits" in
10986'') case "$d_select" in
10987 $define)
10988 $cat <<EOM
10989
85ab1d1d 10990Checking to see on how many bits at a time your select() operates...
5ff3f7a4
GS
10991EOM
10992 $cat >try.c <<EOCP
10993#include <sys/types.h>
10994#$i_time I_TIME
10995#$i_systime I_SYS_TIME
10996#$i_systimek I_SYS_TIME_KERNEL
10997#ifdef I_TIME
10998# include <time.h>
10999#endif
11000#ifdef I_SYS_TIME
11001# ifdef I_SYS_TIME_KERNEL
11002# define KERNEL
11003# endif
11004# include <sys/time.h>
11005# ifdef I_SYS_TIME_KERNEL
11006# undef KERNEL
11007# endif
11008#endif
11009#$i_sysselct I_SYS_SELECT
11010#ifdef I_SYS_SELECT
11011#include <sys/select.h>
11012#endif
11013#include <stdio.h>
fb164848
JH
11014$selecttype b;
11015#define S sizeof(*(b))
5ff3f7a4
GS
11016#define MINBITS 64
11017#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
11018#define NBITS (NBYTES * 8)
11019int main() {
11020 char s[NBYTES];
5ff3f7a4
GS
11021 struct timeval t;
11022 int i;
11023 FILE* fp;
11024 int fd;
11025
11026 fclose(stdin);
11027 fp = fopen("try.c", "r");
11028 if (fp == 0)
11029 exit(1);
11030 fd = fileno(fp);
11031 if (fd < 0)
11032 exit(2);
11033 b = ($selecttype)s;
11034 for (i = 0; i < NBITS; i++)
11035 FD_SET(i, b);
11036 t.tv_sec = 0;
11037 t.tv_usec = 0;
11038 select(fd + 1, b, 0, 0, &t);
11039 for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
11040 printf("%d\n", i + 1);
11041 return 0;
11042}
11043EOCP
11044 set try
11045 if eval $compile_ok; then
11046 selectminbits=`./try`
85ab1d1d 11047 case "$selectminbits" in
fb164848
JH
11048 '') cat >&4 <<EOM
11049Cannot figure out on how many bits at a time your select() operates.
11050I'll play safe and guess it is 32 bits.
11051EOM
11052 selectminbits=32
11053 bits="32 bits"
11054 ;;
85ab1d1d
JH
11055 1) bits="1 bit" ;;
11056 *) bits="$selectminbits bits" ;;
11057 esac
11058 echo "Your select() operates on $bits at a time." >&4
5ff3f7a4
GS
11059 else
11060 rp='What is the minimum number of bits your select() operates on?'
11061 case "$byteorder" in
11062 1234|12345678) dflt=32 ;;
11063 *) dflt=1 ;;
11064 esac
11065 . ./myread
11066 val=$ans
11067 selectminbits="$val"
11068 fi
11069 $rm -f try.* try
11070 ;;
11071 *) : no select, so pick a harmless default
11072 selectminbits='32'
11073 ;;
11074 esac
11075 ;;
11076esac
11077
8e07c86e
AD
11078: Trace out the files included by signal.h, then look for SIGxxx names.
11079: Remove SIGARRAYSIZE used by HPUX.
4633a7c4 11080: Remove SIGTYP void lines used by OS2.
8e07c86e
AD
11081xxx=`echo '#include <signal.h>' |
11082 $cppstdin $cppminus $cppflags 2>/dev/null |
11083 $grep '^[ ]*#.*include' |
11084 $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
11085: Check this list of files to be sure we have parsed the cpp output ok.
11086: This will also avoid potentially non-existent files, such
11087: as ../foo/bar.h
11088xxxfiles=''
11089for xx in $xxx /dev/null ; do
11090 $test -f "$xx" && xxxfiles="$xxxfiles $xx"
11091done
11092: If we have found no files, at least try signal.h
11093case "$xxxfiles" in
11094'') xxxfiles=`./findhdr signal.h` ;;
11095esac
11096xxx=`awk '
4633a7c4 11097$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $3 !~ /void/ {
8e07c86e
AD
11098 print substr($2, 4, 20)
11099}
4633a7c4 11100$1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
8e07c86e
AD
11101 print substr($3, 4, 20)
11102}' $xxxfiles`
11103: Append some common names just in case the awk scan failed.
11104xxx="$xxx ABRT ALRM BUS CHLD CLD CONT DIL EMT FPE HUP ILL INT IO IOT KILL"
11105xxx="$xxx LOST PHONE PIPE POLL PROF PWR QUIT SEGV STKFLT STOP SYS TERM TRAP"
11106xxx="$xxx TSTP TTIN TTOU URG USR1 USR2 USR3 USR4 VTALRM"
11107xxx="$xxx WINCH WIND WINDOW XCPU XFSZ"
11108: generate a few handy files for later
dc45a647 11109$cat > signal.c <<'EOCP'
4633a7c4
LW
11110#include <sys/types.h>
11111#include <signal.h>
dc45a647 11112#include <stdio.h>
4633a7c4 11113int main() {
760ac839
LW
11114
11115/* Strange style to avoid deeply-nested #if/#else/#endif */
11116#ifndef NSIG
11117# ifdef _NSIG
11118# define NSIG (_NSIG)
11119# endif
11120#endif
11121
11122#ifndef NSIG
11123# ifdef SIGMAX
11124# define NSIG (SIGMAX+1)
11125# endif
11126#endif
11127
11128#ifndef NSIG
11129# ifdef SIG_MAX
11130# define NSIG (SIG_MAX+1)
11131# endif
11132#endif
11133
11134#ifndef NSIG
11135# ifdef MAXSIG
11136# define NSIG (MAXSIG+1)
11137# endif
4633a7c4 11138#endif
760ac839
LW
11139
11140#ifndef NSIG
11141# ifdef MAX_SIG
11142# define NSIG (MAX_SIG+1)
11143# endif
11144#endif
11145
11146#ifndef NSIG
11147# ifdef SIGARRAYSIZE
11148# define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
11149# endif
11150#endif
11151
11152#ifndef NSIG
11153# ifdef _sys_nsig
11154# define NSIG (_sys_nsig) /* Solaris 2.5 */
11155# endif
11156#endif
11157
11158/* Default to some arbitrary number that's big enough to get most
11159 of the common signals.
11160*/
11161#ifndef NSIG
11162# define NSIG 50
4633a7c4 11163#endif
760ac839
LW
11164
11165printf("NSIG %d\n", NSIG);
11166
dc45a647
MB
11167#ifndef JUST_NSIG
11168
11169EOCP
11170
28e8609d 11171echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
8e07c86e
AD
11172{
11173 printf "#ifdef SIG"; printf $1; printf "\n"
11174 printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
11175 printf $1; printf ");\n"
11176 printf "#endif\n"
2304df62 11177}
2304df62 11178END {
dc45a647 11179 printf "#endif /* JUST_NSIG */\n";
8e07c86e 11180 printf "}\n";
2304df62 11181}
4633a7c4
LW
11182' >>signal.c
11183$cat >signal.awk <<'EOP'
11184BEGIN { ndups = 0 }
11185$1 ~ /^NSIG$/ { nsig = $2 }
11186($1 !~ /^NSIG$/) && (NF == 2) {
11187 if ($2 > maxsig) { maxsig = $2 }
11188 if (sig_name[$2]) {
11189 dup_name[ndups] = $1
11190 dup_num[ndups] = $2
11191 ndups++
11192 }
11193 else {
11194 sig_name[$2] = $1
11195 sig_num[$2] = $2
11196 }
11197
11198}
11199END {
11200 if (nsig == 0) { nsig = maxsig + 1 }
11201 for (n = 1; n < nsig; n++) {
11202 if (sig_name[n]) {
11203 printf("%s %d\n", sig_name[n], sig_num[n])
11204 }
11205 else {
11206 printf("NUM%d %d\n", n, n)
11207 }
11208 }
11209 for (n = 0; n < ndups; n++) {
11210 printf("%s %d\n", dup_name[n], dup_num[n])
11211 }
11212}
11213EOP
11214$cat >signal_cmd <<EOS
8e07c86e 11215$startsh
dc45a647
MB
11216if $test -s signal.lst; then
11217 echo "Using your existing signal.lst file"
11218 exit 0
11219fi
11220xxx="$xxx"
11221EOS
11222$cat >>signal_cmd <<'EOS'
11223
11224set signal
11225if eval $compile_ok; then
dfe9444c 11226 ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
8e07c86e 11227else
dc45a647
MB
11228 echo "(I can't seem be able to compile the whole test program)" >&4
11229 echo "(I'll try it in little pieces.)" >&4
11230 set signal -DJUST_NSIG
11231 if eval $compile_ok; then
11232 ./signal$_exe > signal.nsg
11233 $cat signal.nsg
11234 else
11235 echo "I can't seem to figure out how many signals you have." >&4
11236 echo "Guessing 50." >&4
11237 echo 'NSIG 50' > signal.nsg
11238 fi
11239 : Now look at all the signal names, one at a time.
28e8609d 11240 for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
dc45a647
MB
11241 $cat > signal.c <<EOCP
11242#include <sys/types.h>
11243#include <signal.h>
11244#include <stdio.h>
11245int main() {
11246printf("$xx %d\n", SIG${xx});
11247return 0;
11248}
11249EOCP
11250 set signal
11251 if eval $compile; then
11252 echo "SIG${xx} found."
11253 ./signal$_exe >> signal.ls1
11254 else
11255 echo "SIG${xx} NOT found."
11256 fi
11257 done
11258 if $test -s signal.ls1; then
11259 $cat signal.nsg signal.ls1 |
11260 $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
11261 fi
11262
11263fi
11264if $test -s signal.lst; then
11265 :
11266else
11267 echo "(AAK! I can't compile the test programs -- Guessing)" >&4
8e07c86e 11268 echo 'kill -l' >signal
dc45a647 11269 set X `csh -f <signal`
8e07c86e 11270 $rm -f signal
2304df62 11271 shift
dc45a647 11272 case $# in
8e07c86e 11273 0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
2304df62 11274 esac
28e8609d 11275 echo $@ | $tr ' ' $trnl | \
dc45a647 11276 $awk '{ printf $1; printf " %d\n", ++s; }' >signal.lst
8e07c86e 11277fi
dc45a647 11278$rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
8e07c86e 11279EOS
4633a7c4
LW
11280chmod a+x signal_cmd
11281$eunicefix signal_cmd
8e07c86e
AD
11282
11283: generate list of signal names
11284echo " "
dfe9444c 11285case "$sig_name_init" in
6626bf4c
JH
11286'') doinit=yes ;;
11287*) case "$sig_num_init" in
11288 ''|*,*) doinit=yes ;;
11289 esac ;;
11290esac
11291case "$doinit" in
11292yes)
4633a7c4 11293 echo "Generating a list of signal names and numbers..." >&4
dc45a647 11294 . ./signal_cmd
8e07c86e
AD
11295 sig_name=`$awk '{printf "%s ", $1}' signal.lst`
11296 sig_name="ZERO $sig_name"
dfe9444c
AD
11297 sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
11298 { printf "\"%s\", ", $1 }
11299 END { printf "0\n" }' signal.lst`
824a2ba3
JH
11300 sig_num=`$awk '{printf "%d ", $2}' signal.lst`
11301 sig_num="0 $sig_num"
11302 sig_num_init=`$awk 'BEGIN { printf "0, " }
dfe9444c
AD
11303 { printf "%d, ", $2}
11304 END { printf "0\n"}' signal.lst`
a0d0e21e 11305 ;;
2304df62 11306esac
a0d0e21e
LW
11307echo "The following signals are available:"
11308echo " "
11309echo $sig_name | $awk \
11310'BEGIN { linelen = 0 }
11311{
8e07c86e 11312 for (i = 1; i <= NF; i++) {
a0d0e21e
LW
11313 name = "SIG" $i " "
11314 linelen = linelen + length(name)
11315 if (linelen > 70) {
11316 printf "\n"
11317 linelen = length(name)
11318 }
11319 printf "%s", name
11320 }
8e07c86e 11321 printf "\n"
a0d0e21e 11322}'
4633a7c4 11323$rm -f signal signal.c signal.awk signal.lst signal_cmd
a0d0e21e 11324
a0d0e21e
LW
11325: see what type is used for signed size_t
11326set ssize_t ssizetype int stdio.h sys/types.h
11327eval $typedef
11328dflt="$ssizetype"
11329$cat > ssize.c <<EOM
11330#include <stdio.h>
11331#include <sys/types.h>
11332#define Size_t $sizetype
11333#define SSize_t $dflt
11334main()
11335{
11336 if (sizeof(Size_t) == sizeof(SSize_t))
11337 printf("$dflt\n");
11338 else if (sizeof(Size_t) == sizeof(int))
11339 printf("int\n");
11340 else
11341 printf("long\n");
760ac839 11342 exit(0);
a0d0e21e
LW
11343}
11344EOM
11345echo " "
dfe9444c 11346set ssize
dc45a647 11347if eval $compile_ok && ./ssize > /dev/null; then
dfe9444c 11348 ssizetype=`./ssize`
a0d0e21e
LW
11349 echo "I'll be using $ssizetype for functions returning a byte count." >&4
11350else
24fef2a7 11351 $cat >&4 <<EOM
24fef2a7
AD
11352Help! I can't compile and run the ssize_t test program: please enlighten me!
11353(This is probably a misconfiguration in your system or libraries, and
11354you really ought to fix it. Still, I'll try anyway.)
a0d0e21e
LW
11355
11356I need a type that is the same size as $sizetype, but is guaranteed to
24fef2a7 11357be signed. Common values are ssize_t, int and long.
a0d0e21e
LW
11358
11359EOM
11360 rp="What signed type is the same size as $sizetype?"
11361 . ./myread
11362 ssizetype="$ans"
11363fi
dfe9444c 11364$rm -f ssize ssize.*
3fd537d4 11365
a0d0e21e
LW
11366: see what type of char stdio uses.
11367echo " "
11368if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
11369 echo "Your stdio uses unsigned chars." >&4
11370 stdchar="unsigned char"
11371else
11372 echo "Your stdio uses signed chars." >&4
11373 stdchar="char"
11374fi
11375
11376: see if time exists
11377echo " "
28e8609d
JH
11378if test "X$d_time" = X -o X"$timetype" = X; then
11379 if set time val -f d_time; eval $csym; $val; then
5ff3f7a4
GS
11380 echo 'time() found.' >&4
11381 val="$define"
11382 rp="What is the type returned by time() on this system?"
11383 set time_t timetype long stdio.h sys/types.h
11384 eval $typedef_ask
28e8609d 11385 else
5ff3f7a4
GS
11386 echo 'time() not found, hope that will do.' >&4
11387 val="$undef"
11388 timetype='int';
28e8609d
JH
11389 fi
11390 set d_time
11391 eval $setvar
a0d0e21e 11392fi
a0d0e21e
LW
11393
11394: see what type uids are declared as in the kernel
dc45a647
MB
11395echo " "
11396echo "Looking for the type for user ids returned by getuid()."
a0d0e21e
LW
11397set uid_t uidtype xxx stdio.h sys/types.h
11398eval $typedef
11399case "$uidtype" in
11400xxx)
11401 xxx=`./findhdr sys/user.h`
11402 set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
11403 case $1 in
11404 unsigned) dflt="$1 $2" ;;
11405 *) dflt="$1" ;;
11406 esac
11407 ;;
4633a7c4
LW
11408*) dflt="$uidtype";;
11409esac
dc45a647
MB
11410case "$uidtype" in
11411uid_t) echo "uid_t found." ;;
11412*) rp="What is the type for user ids returned by getuid()?"
11413 . ./myread
11414 uidtype="$ans"
11415 ;;
11416esac
4633a7c4
LW
11417
11418: see if dbm.h is available
11419: see if dbmclose exists
11420set dbmclose d_dbmclose
11421eval $inlibc
11422
11423case "$d_dbmclose" in
11424$define)
11425 set dbm.h i_dbm
11426 eval $inhdr
5f80c64f
JH
11427 case "$i_dbm" in
11428 $define)
11429 val="$undef"
11430 set i_rpcsvcdbm
11431 eval $setvar
11432 ;;
11433 *) set rpcsvc/dbm.h i_rpcsvcdbm
11434 eval $inhdr
11435 ;;
11436 esac
11437 ;;
11438*) echo "We won't be including <dbm.h>"
11439 val="$undef"
11440 set i_dbm
11441 eval $setvar
11442 val="$undef"
11443 set i_rpcsvcdbm
11444 eval $setvar
11445 ;;
11446esac
11447
11448: see if this is a sys/file.h system
11449val=''
11450set sys/file.h val
11451eval $inhdr
11452
11453: do we need to include sys/file.h ?
11454case "$val" in
11455"$define")
11456 echo " "
11457 if $h_sysfile; then
11458 val="$define"
11459 echo "We'll be including <sys/file.h>." >&4
11460 else
11461 val="$undef"
11462 echo "We won't be including <sys/file.h>." >&4
11463 fi
11464 ;;
11465*)
11466 h_sysfile=false
11467 ;;
11468esac
11469set i_sysfile
11470eval $setvar
11471
11472: see if fcntl.h is there
11473val=''
11474set fcntl.h val
11475eval $inhdr
11476
11477: see if we can include fcntl.h
11478case "$val" in
11479"$define")
11480 echo " "
11481 if $h_fcntl; then
11482 val="$define"
11483 echo "We'll be including <fcntl.h>." >&4
11484 else
11485 val="$undef"
11486 if $h_sysfile; then
11487 echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
11488 else
11489 echo "We won't be including <fcntl.h>." >&4
11490 fi
11491 fi
11492 ;;
11493*)
11494 h_fcntl=false
11495 val="$undef"
11496 ;;
11497esac
11498set i_fcntl
11499eval $setvar
11500
11501: see if locale.h is available
11502set locale.h i_locale
11503eval $inhdr
11504
7f3d1cf1 11505: see if mach cthreads are available
13666627
JH
11506if test "X$usethreads" = "X$define"; then
11507 set mach/cthreads.h i_machcthr
11508 eval $inhdr
11509else
11510 i_machcthr="$undef"
11511fi
11512
11513
7f3d1cf1 11514
5f80c64f
JH
11515: see if this is a math.h system
11516set math.h i_math
11517eval $inhdr
11518
11519: see if ndbm.h is available
11520set ndbm.h t_ndbm
11521eval $inhdr
11522case "$t_ndbm" in
11523$define)
11524 : see if dbm_open exists
11525 set dbm_open d_dbm_open
11526 eval $inlibc
11527 case "$d_dbm_open" in
11528 $undef)
11529 t_ndbm="$undef"
11530 echo "We won't be including <ndbm.h>"
11531 ;;
11532 esac
11533 ;;
11534esac
11535val="$t_ndbm"
11536set i_ndbm
11537eval $setvar
11538
11539: see if net/errno.h is available
11540val=''
11541set net/errno.h val
11542eval $inhdr
11543
11544: Unfortunately, it causes problems on some systems. Arrgh.
11545case "$val" in
11546$define)
11547 cat > try.c <<'EOM'
11548#include <stdio.h>
11549#include <errno.h>
11550#include <net/errno.h>
11551int func()
11552{
11553 return ENOTSOCK;
11554}
11555EOM
11556 if $cc $ccflags -c try.c >/dev/null 2>&1; then
11557 echo "We'll be including <net/errno.h>." >&4
11558 else
11559 echo "We won't be including <net/errno.h>." >&4
11560 val="$undef"
11561 fi
11562 $rm -f try.* try
11563 ;;
11564esac
11565set i_neterrno
11566eval $setvar
11567
11568: get C preprocessor symbols handy
11569echo " "
11570$echo $n "Hmm... $c"
11571echo $al | $tr ' ' $trnl >Cppsym.know
11572$cat <<EOSS >Cppsym
11573$startsh
11574case "\$1" in
11575-l) list=true
11576 shift
11577 ;;
11578esac
11579unknown=''
11580case "\$list\$#" in
115811|2)
11582 for sym do
11583 if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
11584 exit 0
11585 elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
11586 :
11587 else
11588 unknown="\$unknown \$sym"
11589 fi
11590 done
11591 set X \$unknown
11592 shift
11593 ;;
11594esac
11595case \$# in
115960) exit 1;;
11597esac
11598echo \$* | $tr ' ' '$trnl' | $sed -e 's/\(.*\)/\\
11599#ifdef \1\\
11600exit 0; _ _ _ _\1\\ \1\\
11601#endif\\
11602/' >Cppsym\$\$
11603echo "exit 1; _ _ _" >>Cppsym\$\$
11604$cppstdin $cppminus <Cppsym\$\$ | $grep '^exit [01]; _ _' >Cppsym2\$\$
11605case "\$list" in
11606true) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;;
11607*)
11608 sh Cppsym2\$\$
11609 status=\$?
11610 ;;
11611esac
11612$rm -f Cppsym\$\$ Cppsym2\$\$
11613exit \$status
11614EOSS
11615chmod +x Cppsym
11616$eunicefix Cppsym
11617./Cppsym -l $al | $sort | $grep -v '^$' >Cppsym.true
11618
11619: now check the C compiler for additional symbols
11620$cat >ccsym <<EOS
11621$startsh
11622$cat >tmp.c <<EOF
11623extern int foo;
11624EOF
11625for i in \`$cc -v -c tmp.c 2>&1\`
11626do
11627 case "\$i" in
11628 -D*) echo "\$i" | $sed 's/^-D//';;
11629 -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
11630 esac
11631done
11632$rm -f try.c
11633EOS
11634chmod +x ccsym
11635$eunicefix ccsym
11636./ccsym > ccsym1.raw
11637if $test -s ccsym1.raw; then
11638 $sort ccsym1.raw | $uniq >ccsym.raw
11639else
11640 mv ccsym1.raw ccsym.raw
11641fi
11642
11643$awk '/\=/ { print $0; next }
11644 { print $0"=1" }' ccsym.raw >ccsym.list
11645$awk '{ print $0"=1" }' Cppsym.true >ccsym.true
11646$comm -13 ccsym.true ccsym.list >ccsym.own
11647$comm -12 ccsym.true ccsym.list >ccsym.com
11648$comm -23 ccsym.true ccsym.list >ccsym.cpp
11649also=''
11650symbols='symbols'
11651if $test -z ccsym.raw; then
11652 echo "Your C compiler doesn't seem to define any symbol!" >&4
11653 echo " "
11654 echo "However, your C preprocessor defines the following ones:"
11655 $cat Cppsym.true
11656else
11657 if $test -s ccsym.com; then
11658 echo "Your C compiler and pre-processor define these symbols:"
11659 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
11660 also='also '
11661 symbols='ones'
11662 $test "$silent" || sleep 1
11663 fi
11664 if $test -s ccsym.cpp; then
11665 $test "$also" && echo " "
11666 echo "Your C pre-processor ${also}defines the following $symbols:"
11667 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
11668 also='further '
11669 $test "$silent" || sleep 1
11670 fi
11671 if $test -s ccsym.own; then
11672 $test "$also" && echo " "
11673 echo "Your C compiler ${also}defines the following cpp variables:"
11674 $sed -e 's/\(.*\)=1/\1/' ccsym.own
11675 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
11676 $test "$silent" || sleep 1
11677 fi
11678fi
11679$rm -f ccsym*
11680
11681: see if this is a termio system
11682val="$undef"
11683val2="$undef"
11684val3="$undef"
11685if $test `./findhdr termios.h`; then
11686 set tcsetattr i_termios
11687 eval $inlibc
11688 val3="$i_termios"
11689fi
11690echo " "
11691case "$val3" in
11692"$define") echo "You have POSIX termios.h... good!" >&4;;
11693*) if ./Cppsym pyr; then
11694 case "`/bin/universe`" in
11695 ucb) if $test `./findhdr sgtty.h`; then
11696 val2="$define"
11697 echo "<sgtty.h> found." >&4
11698 else
11699 echo "System is pyramid with BSD universe."
11700 echo "<sgtty.h> not found--you could have problems." >&4
11701 fi;;
11702 *) if $test `./findhdr termio.h`; then
11703 val="$define"
11704 echo "<termio.h> found." >&4
11705 else
11706 echo "System is pyramid with USG universe."
11707 echo "<termio.h> not found--you could have problems." >&4
11708 fi;;
11709 esac
11710 elif ./usg; then
11711 if $test `./findhdr termio.h`; then
11712 echo "<termio.h> found." >&4
11713 val="$define"
11714 elif $test `./findhdr sgtty.h`; then
11715 echo "<sgtty.h> found." >&4
11716 val2="$define"
11717 else
11718echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
11719 fi
11720 else
11721 if $test `./findhdr sgtty.h`; then
11722 echo "<sgtty.h> found." >&4
11723 val2="$define"
11724 elif $test `./findhdr termio.h`; then
11725 echo "<termio.h> found." >&4
11726 val="$define"
11727 else
11728echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
11729 fi
11730 fi;;
11731esac
11732set i_termio; eval $setvar
11733val=$val2; set i_sgtty; eval $setvar
11734val=$val3; set i_termios; eval $setvar
11735
11736: see if stdarg is available
11737echo " "
11738if $test `./findhdr stdarg.h`; then
11739 echo "<stdarg.h> found." >&4
11740 valstd="$define"
11741else
11742 echo "<stdarg.h> NOT found." >&4
11743 valstd="$undef"
11744fi
11745
11746: see if varags is available
11747echo " "
11748if $test `./findhdr varargs.h`; then
11749 echo "<varargs.h> found." >&4
11750else
11751 echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
11752fi
11753
11754: set up the varargs testing programs
11755$cat > varargs.c <<EOP
11756#ifdef I_STDARG
11757#include <stdarg.h>
11758#endif
11759#ifdef I_VARARGS
11760#include <varargs.h>
11761#endif
11762
11763#ifdef I_STDARG
11764int f(char *p, ...)
11765#else
11766int f(va_alist)
11767va_dcl
11768#endif
11769{
11770 va_list ap;
11771#ifndef I_STDARG
11772 char *p;
11773#endif
11774#ifdef I_STDARG
11775 va_start(ap,p);
11776#else
11777 va_start(ap);
11778 p = va_arg(ap, char *);
11779#endif
11780 va_end(ap);
11781}
11782EOP
11783$cat > varargs <<EOP
11784$startsh
11785if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
11786 echo "true"
11787else
11788 echo "false"
11789fi
11790$rm -f varargs$_o
11791EOP
11792chmod +x varargs
11793
11794: now check which varargs header should be included
11795echo " "
11796i_varhdr=''
11797case "$valstd" in
11798"$define")
11799 if `./varargs I_STDARG`; then
11800 val='stdarg.h'
11801 elif `./varargs I_VARARGS`; then
11802 val='varargs.h'
11803 fi
11804 ;;
11805*)
11806 if `./varargs I_VARARGS`; then
11807 val='varargs.h'
11808 fi
11809 ;;
11810esac
11811case "$val" in
11812'')
11813echo "I could not find the definition for va_dcl... You have problems..." >&4
11814 val="$undef"; set i_stdarg; eval $setvar
11815 val="$undef"; set i_varargs; eval $setvar
11816 ;;
11817*)
11818 set i_varhdr
11819 eval $setvar
11820 case "$i_varhdr" in
11821 stdarg.h)
11822 val="$define"; set i_stdarg; eval $setvar
11823 val="$undef"; set i_varargs; eval $setvar
11824 ;;
11825 varargs.h)
11826 val="$undef"; set i_stdarg; eval $setvar
11827 val="$define"; set i_varargs; eval $setvar
11828 ;;
11829 esac
11830 echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
11831esac
11832$rm -f varargs*
11833
11834: see if stddef is available
11835set stddef.h i_stddef
11836eval $inhdr
11837
11838: see if sys/access.h is available
11839set sys/access.h i_sysaccess
11840eval $inhdr
11841
11842: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
11843set sys/filio.h i_sysfilio
11844eval $inhdr
11845echo " "
11846if $test `./findhdr sys/ioctl.h`; then
11847 val="$define"
11848 echo '<sys/ioctl.h> found.' >&4
11849else
11850 val="$undef"
11851 if $test $i_sysfilio = "$define"; then
11852 echo '<sys/ioctl.h> NOT found.' >&4
11853 else
11854 $test $i_sgtty = "$define" && xxx="sgtty.h"
11855 $test $i_termio = "$define" && xxx="termio.h"
11856 $test $i_termios = "$define" && xxx="termios.h"
11857echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
11858 fi
11859fi
11860set i_sysioctl
11861eval $setvar
11862
11863: see if this is a sys/param system
11864set sys/param.h i_sysparam
11865eval $inhdr
11866
11867: see if sys/resource.h has to be included
11868set sys/resource.h i_sysresrc
11869eval $inhdr
11870
11871: see if sys/security.h is available
11872set sys/security.h i_syssecrt
11873eval $inhdr
11874
11875: see if this is a sys/un.h system
11876set sys/un.h i_sysun
11877eval $inhdr
11878
11879: see if this is a syswait system
11880set sys/wait.h i_syswait
11881eval $inhdr
11882
11883: see if this is an utime system
11884set utime.h i_utime
11885eval $inhdr
11886
11887: see if this is a values.h system
11888set values.h i_values
11889eval $inhdr
11890
11891: see if this is a vfork system
11892case "$d_vfork" in
11893"$define")
11894 set vfork.h i_vfork
11895 eval $inhdr
11896 ;;
11897*)
11898 i_vfork="$undef"
11899 ;;
11900esac
11901
11902: see if gdbm.h is available
11903set gdbm.h t_gdbm
11904eval $inhdr
11905case "$t_gdbm" in
11906$define)
11907 : see if gdbm_open exists
11908 set gdbm_open d_gdbm_open
11909 eval $inlibc
11910 case "$d_gdbm_open" in
11911 $undef)
11912 t_gdbm="$undef"
11913 echo "We won't be including <gdbm.h>"
11914 ;;
11915 esac
11916 ;;
11917esac
11918val="$t_gdbm"
11919set i_gdbm
11920eval $setvar
11921
11922echo " "
11923echo "Looking for extensions..." >&4
11924tdir=`pwd`
11925cd $rsrc/ext
11926: If we are using the old config.sh, known_extensions may contain
11927: old or inaccurate or duplicate values.
11928known_extensions=''
11929nonxs_extensions=''
11930: We do not use find because it might not be available.
11931: We do not just use MANIFEST because the user may have dropped
11932: some additional extensions into the source tree and expect them
11933: to be built.
11934for xxx in * ; do
11935 case "$xxx" in
11936 DynaLoader|dynaload) ;;
11937 *) if $test -f $xxx/$xxx.xs; then
11938 known_extensions="$known_extensions $xxx"
11939 elif $test -f $xxx/Makefile.PL; then
11940 nonxs_extensions="$nonxs_extensions $xxx"
11941 else
11942 if $test -d $xxx; then
11943 # Look for nested extensions, eg. Devel/Dprof.
11944 cd $xxx
11945 for yyy in * ; do
11946 if $test -f $yyy/$yyy.xs; then
11947 known_extensions="$known_extensions $xxx/$yyy"
11948 elif $test -f $yyy/Makefile.PL; then
11949 nonxs_extensions="$nonxs_extensions $xxx/$yyy"
11950 fi
11951 done
11952 cd ..
11953 fi
11954 fi
11955 ;;
11956 esac
11957done
11958set X $nonxs_extensions
11959shift
11960nonxs_extensions="$*"
11961set X $known_extensions
11962shift
11963known_extensions="$*"
11964cd $tdir
11965
11966: Now see which are supported on this system.
11967avail_ext=''
11968for xxx in $known_extensions ; do
11969 case "$xxx" in
11970 DB_File|db_file)
11971 case "$i_db" in
11972 $define) avail_ext="$avail_ext $xxx" ;;
11973 esac
11974 ;;
11975 GDBM_File|gdbm_fil)
11976 case "$i_gdbm" in
11977 $define) avail_ext="$avail_ext $xxx" ;;
11978 esac
11979 ;;
11980 NDBM_File|ndbm_fil)
11981 case "$i_ndbm" in
11982 $define) avail_ext="$avail_ext $xxx" ;;
11983 esac
11984 ;;
11985 ODBM_File|odbm_fil)
11986 case "${i_dbm}${i_rpcsvcdbm}" in
11987 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
11988 esac
11989 ;;
11990 POSIX|posix)
11991 case "$useposix" in
11992 true|define|y) avail_ext="$avail_ext $xxx" ;;
11993 esac
11994 ;;
11995 Opcode|opcode)
11996 case "$useopcode" in
11997 true|define|y) avail_ext="$avail_ext $xxx" ;;
11998 esac
11999 ;;
12000 Socket|socket)
12001 case "$d_socket" in
12002 true|$define|y) avail_ext="$avail_ext $xxx" ;;
12003 esac
12004 ;;
12005 Thread|thread)
12006 case "$usethreads" in
12007 true|$define|y) avail_ext="$avail_ext $xxx" ;;
12008 esac
12009 ;;
12010 IPC/SysV|ipc/sysv)
12011 : XXX Do we need a useipcsysv variable here
12012 case "${d_msg}${d_sem}${d_shm}" in
12013 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
12014 esac
12015 ;;
12016 *) avail_ext="$avail_ext $xxx"
12017 ;;
12018 esac
12019done
12020
12021set X $avail_ext
12022shift
12023avail_ext="$*"
12024
12025: Now see which nonxs extensions are supported on this system.
12026: For now assume all are.
12027nonxs_ext=''
12028for xxx in $nonxs_extensions ; do
12029 case "$xxx" in
12030 *) nonxs_ext="$nonxs_ext $xxx"
12031 ;;
12032 esac
12033done
12034
12035set X $nonxs_ext
12036shift
12037nonxs_ext="$*"
12038
12039case $usedl in
12040$define)
12041 $cat <<EOM
12042A number of extensions are supplied with $package. You may choose to
12043compile these extensions for dynamic loading (the default), compile
12044them into the $package executable (static loading), or not include
12045them at all. Answer "none" to include no extensions.
12046Note that DynaLoader is always built and need not be mentioned here.
12047
12048EOM
12049 case "$dynamic_ext" in
12050 '') dflt="$avail_ext" ;;
12051 *) dflt="$dynamic_ext"
12052 # Perhaps we are reusing an old out-of-date config.sh.
12053 case "$hint" in
12054 previous)
12055 if test X"$dynamic_ext" != X"$avail_ext"; then
12056 $cat <<EOM
12057NOTICE: Your previous config.sh list may be incorrect.
12058The extensions now available to you are
12059 ${avail_ext}
12060but the default list from your previous config.sh is
12061 ${dynamic_ext}
12062
12063EOM
12064 fi
12065 ;;
12066 esac
12067 ;;
12068 esac
12069 case "$dflt" in
12070 '') dflt=none;;
12071 esac
12072 rp="What extensions do you wish to load dynamically?"
12073 . ./myread
12074 case "$ans" in
12075 none) dynamic_ext=' ' ;;
12076 *) dynamic_ext="$ans" ;;
12077 esac
12078
12079 case "$static_ext" in
12080 '')
12081 : Exclude those already listed in dynamic linking
12082 dflt=''
12083 for xxx in $avail_ext; do
12084 case " $dynamic_ext " in
12085 *" $xxx "*) ;;
12086 *) dflt="$dflt $xxx" ;;
12087 esac
12088 done
12089 set X $dflt
12090 shift
12091 dflt="$*"
12092 ;;
12093 *) dflt="$static_ext"
12094 ;;
12095 esac
12096
12097 case "$dflt" in
12098 '') dflt=none;;
12099 esac
12100 rp="What extensions do you wish to load statically?"
12101 . ./myread
12102 case "$ans" in
12103 none) static_ext=' ' ;;
12104 *) static_ext="$ans" ;;
12105 esac
12106 ;;
12107*)
12108 $cat <<EOM
12109A number of extensions are supplied with $package. Answer "none"
12110to include no extensions.
12111Note that DynaLoader is always built and need not be mentioned here.
12112
12113EOM
12114 case "$static_ext" in
12115 '') dflt="$avail_ext" ;;
12116 *) dflt="$static_ext"
12117 # Perhaps we are reusing an old out-of-date config.sh.
12118 case "$hint" in
12119 previous)
12120 if test X"$static_ext" != X"$avail_ext"; then
12121 $cat <<EOM
12122NOTICE: Your previous config.sh list may be incorrect.
12123The extensions now available to you are
12124 ${avail_ext}
12125but the default list from your previous config.sh is
12126 ${static_ext}
12127
12128EOM
12129 fi
12130 ;;
12131 esac
12132 ;;
12133 esac
12134 : Exclude those that are not xs extensions
12135 case "$dflt" in
12136 '') dflt=none;;
12137 esac
12138 rp="What extensions do you wish to include?"
12139 . ./myread
12140 case "$ans" in
12141 none) static_ext=' ' ;;
12142 *) static_ext="$ans" ;;
12143 esac
12144 ;;
12145esac
12146
12147set X $dynamic_ext $static_ext $nonxs_ext
12148shift
12149extensions="$*"
12150
12151: Remove build directory name from cppstdin so it can be used from
12152: either the present location or the final installed location.
12153echo " "
12154: Get out of the UU directory to get correct path name.
12155cd ..
12156case "$cppstdin" in
12157`pwd`/cppstdin)
12158 echo "Stripping down cppstdin path name"
12159 cppstdin=cppstdin
12160 ;;
12161esac
12162cd UU
12163
12164: end of configuration questions
12165echo " "
12166echo "End of configuration questions."
12167echo " "
12168
12169: back to where it started
12170if test -d ../UU; then
12171 cd ..
12172fi
12173
12174: configuration may be patched via a 'config.over' file
12175if $test -f config.over; then
12176 echo " "
12177 dflt=y
12178 rp='I see a config.over file. Do you wish to load it?'
12179 . UU/myread
12180 case "$ans" in
12181 n*) echo "OK, I'll ignore it.";;
12182 *) . ./config.over
12183 echo "Configuration override changes have been loaded."
12184 ;;
12185 esac
12186fi
12187
12188: in case they want portability, strip down executable paths
12189case "$d_portable" in
12190"$define")
12191 echo " "
12192 echo "Stripping down executable paths..." >&4
12193 for file in $loclist $trylist; do
12194 if test X$file != Xln -a X$file != Xar -o X$osname != Xos2; then
12195 eval $file="\$file"
12196 fi
12197 done
12198 ;;
12199esac
12200
12201: create config.sh file
12202echo " "
12203echo "Creating config.sh..." >&4
12204$spitshell <<EOT >config.sh
12205$startsh
12206#
12207# This file was produced by running the Configure script. It holds all the
12208# definitions figured out by Configure. Should you modify one of these values,
12209# do not forget to propagate your changes by running "Configure -der". You may
12210# instead choose to run each of the .SH files by yourself, or "Configure -S".
12211#
12212
12213# Package name : $package
12214# Source directory : $src
12215# Configuration time: $cf_time
12216# Configured by : $cf_by
12217# Target system : $myuname
12218
12219Author='$Author'
12220Date='$Date'
12221Header='$Header'
12222Id='$Id'
12223Locker='$Locker'
12224Log='$Log'
12225Mcc='$Mcc'
12226RCSfile='$RCSfile'
12227Revision='$Revision'
12228Source='$Source'
12229State='$State'
12230_a='$_a'
12231_exe='$_exe'
12232_o='$_o'
12233afs='$afs'
12234alignbytes='$alignbytes'
12235ansi2knr='$ansi2knr'
12236aphostname='$aphostname'
12237apiversion='$apiversion'
12238ar='$ar'
12239archlib='$archlib'
12240archlibexp='$archlibexp'
12241archname64='$archname64'
12242archname='$archname'
12243archobjs='$archobjs'
12244awk='$awk'
12245baserev='$baserev'
12246bash='$bash'
12247bin='$bin'
12248binexp='$binexp'
12249bison='$bison'
12250byacc='$byacc'
12251byteorder='$byteorder'
12252c='$c'
12253castflags='$castflags'
12254cat='$cat'
12255cc='$cc'
12256cccdlflags='$cccdlflags'
12257ccdlflags='$ccdlflags'
12258ccflags='$ccflags'
12259cf_by='$cf_by'
12260cf_email='$cf_email'
12261cf_time='$cf_time'
12262chgrp='$chgrp'
12263chmod='$chmod'
12264chown='$chown'
12265clocktype='$clocktype'
12266comm='$comm'
12267compress='$compress'
12268contains='$contains'
12269cp='$cp'
12270cpio='$cpio'
12271cpp='$cpp'
12272cpp_stuff='$cpp_stuff'
12273cppflags='$cppflags'
12274cpplast='$cpplast'
12275cppminus='$cppminus'
12276cpprun='$cpprun'
12277cppstdin='$cppstdin'
12278cryptlib='$cryptlib'
12279csh='$csh'
12280d_Gconvert='$d_Gconvert'
12281d_access='$d_access'
12282d_accessx='$d_accessx'
12283d_alarm='$d_alarm'
12284d_archlib='$d_archlib'
12285d_attribut='$d_attribut'
12286d_bcmp='$d_bcmp'
12287d_bcopy='$d_bcopy'
12288d_bsd='$d_bsd'
12289d_bsdgetpgrp='$d_bsdgetpgrp'
12290d_bsdsetpgrp='$d_bsdsetpgrp'
12291d_bzero='$d_bzero'
12292d_casti32='$d_casti32'
12293d_castneg='$d_castneg'
12294d_charvspr='$d_charvspr'
12295d_chown='$d_chown'
12296d_chroot='$d_chroot'
12297d_chsize='$d_chsize'
12298d_closedir='$d_closedir'
12299d_const='$d_const'
12300d_crypt='$d_crypt'
12301d_csh='$d_csh'
12302d_cuserid='$d_cuserid'
12303d_dbl_dig='$d_dbl_dig'
12304d_dbmclose64='$d_dbmclose64'
12305d_dbminit64='$d_dbminit64'
12306d_delete64='$d_delete64'
12307d_difftime='$d_difftime'
12308d_dirent64s='$d_dirent64s'
12309d_dirnamlen='$d_dirnamlen'
12310d_dlerror='$d_dlerror'
12311d_dlopen='$d_dlopen'
12312d_dlsymun='$d_dlsymun'
12313d_dosuid='$d_dosuid'
12314d_drand48proto='$d_drand48proto'
12315d_dup2='$d_dup2'
12316d_eaccess='$d_eaccess'
12317d_endgrent='$d_endgrent'
12318d_endhent='$d_endhent'
12319d_endnent='$d_endnent'
12320d_endpent='$d_endpent'
12321d_endpwent='$d_endpwent'
12322d_endsent='$d_endsent'
12323d_eofnblk='$d_eofnblk'
12324d_eunice='$d_eunice'
12325d_fchmod='$d_fchmod'
12326d_fchown='$d_fchown'
12327d_fcntl='$d_fcntl'
12328d_fd_macros='$d_fd_macros'
12329d_fd_set='$d_fd_set'
12330d_fds_bits='$d_fds_bits'
12331d_fetch64='$d_fetch64'
12332d_fgetpos64='$d_fgetpos64'
12333d_fgetpos='$d_fgetpos'
12334d_firstkey64='$d_firstkey64'
12335d_flexfnam='$d_flexfnam'
12336d_flock64s='$d_flock64s'
12337d_flock='$d_flock'
12338d_fopen64='$d_fopen64'
12339d_fork='$d_fork'
12340d_fpathconf='$d_fpathconf'
12341d_freopen64='$d_freopen64'
12342d_fseek64='$d_fseek64'
12343d_fseeko64='$d_fseeko64'
12344d_fseeko='$d_fseeko'
12345d_fsetpos64='$d_fsetpos64'
12346d_fsetpos='$d_fsetpos'
12347d_fstat64='$d_fstat64'
12348d_ftell64='$d_ftell64'
12349d_ftello64='$d_ftello64'
12350d_ftello='$d_ftello'
12351d_ftime='$d_ftime'
12352d_ftruncate64='$d_ftruncate64'
12353d_getgrent='$d_getgrent'
12354d_getgrps='$d_getgrps'
12355d_gethbyaddr='$d_gethbyaddr'
12356d_gethbyname='$d_gethbyname'
12357d_gethent='$d_gethent'
12358d_gethname='$d_gethname'
12359d_gethostprotos='$d_gethostprotos'
12360d_getlogin='$d_getlogin'
12361d_getnbyaddr='$d_getnbyaddr'
12362d_getnbyname='$d_getnbyname'
12363d_getnent='$d_getnent'
12364d_getnetprotos='$d_getnetprotos'
12365d_getpbyname='$d_getpbyname'
12366d_getpbynumber='$d_getpbynumber'
12367d_getpent='$d_getpent'
12368d_getpgid='$d_getpgid'
12369d_getpgrp2='$d_getpgrp2'
12370d_getpgrp='$d_getpgrp'
12371d_getppid='$d_getppid'
12372d_getprior='$d_getprior'
12373d_getprotoprotos='$d_getprotoprotos'
12374d_getpwent='$d_getpwent'
12375d_getsbyname='$d_getsbyname'
12376d_getsbyport='$d_getsbyport'
12377d_getsent='$d_getsent'
12378d_getservprotos='$d_getservprotos'
12379d_gettimeod='$d_gettimeod'
12380d_gnulibc='$d_gnulibc'
12381d_grpasswd='$d_grpasswd'
12382d_htonl='$d_htonl'
12383d_index='$d_index'
12384d_inetaton='$d_inetaton'
12385d_ino64t='$d_ino64t'
12386d_int64t='$d_int64t'
12387d_isascii='$d_isascii'
12388d_killpg='$d_killpg'
12389d_lchown='$d_lchown'
12390d_link='$d_link'
12391d_locconv='$d_locconv'
12392d_lockf64='$d_lockf64'
12393d_lockf='$d_lockf'
12394d_longdbl='$d_longdbl'
12395d_longlong='$d_longlong'
12396d_lseek64='$d_lseek64'
12397d_lstat64='$d_lstat64'
12398d_lstat='$d_lstat'
12399d_mblen='$d_mblen'
12400d_mbstowcs='$d_mbstowcs'
12401d_mbtowc='$d_mbtowc'
12402d_memcmp='$d_memcmp'
12403d_memcpy='$d_memcpy'
12404d_memmove='$d_memmove'
12405d_memset='$d_memset'
12406d_mkdir='$d_mkdir'
12407d_mkfifo='$d_mkfifo'
12408d_mktime='$d_mktime'
12409d_msg='$d_msg'
12410d_msgctl='$d_msgctl'
12411d_msgget='$d_msgget'
12412d_msgrcv='$d_msgrcv'
12413d_msgsnd='$d_msgsnd'
12414d_mymalloc='$d_mymalloc'
12415d_nextkey64='$d_nextkey64'
12416d_nice='$d_nice'
12417d_off64t='$d_off64t'
12418d_oldpthreads='$d_oldpthreads'
12419d_oldsock='$d_oldsock'
12420d_open3='$d_open3'
12421d_open64='$d_open64'
12422d_opendir64='$d_opendir64'
12423d_pathconf='$d_pathconf'
12424d_pause='$d_pause'
12425d_phostname='$d_phostname'
12426d_pipe='$d_pipe'
12427d_poll='$d_poll'
12428d_portable='$d_portable'
13666627 12429d_pthread_create_joinable='$d_pthread_create_joinable'
5f80c64f 12430d_pthread_yield='$d_pthread_yield'
5f80c64f
JH
12431d_pwage='$d_pwage'
12432d_pwchange='$d_pwchange'
12433d_pwclass='$d_pwclass'
12434d_pwcomment='$d_pwcomment'
12435d_pwexpire='$d_pwexpire'
12436d_pwgecos='$d_pwgecos'
12437d_pwpasswd='$d_pwpasswd'
12438d_pwquota='$d_pwquota'
12439d_readdir64='$d_readdir64'
12440d_readdir='$d_readdir'
12441d_readlink='$d_readlink'
12442d_rename='$d_rename'
12443d_rewinddir='$d_rewinddir'
12444d_rmdir='$d_rmdir'
12445d_safebcpy='$d_safebcpy'
12446d_safemcpy='$d_safemcpy'
12447d_sanemcmp='$d_sanemcmp'
12448d_sched_yield='$d_sched_yield'
12449d_seekdir64='$d_seekdir64'
12450d_seekdir='$d_seekdir'
12451d_select='$d_select'
12452d_sem='$d_sem'
12453d_semctl='$d_semctl'
12454d_semctl_semid_ds='$d_semctl_semid_ds'
12455d_semctl_semun='$d_semctl_semun'
12456d_semget='$d_semget'
12457d_semop='$d_semop'
12458d_setegid='$d_setegid'
12459d_seteuid='$d_seteuid'
12460d_setgrent='$d_setgrent'
12461d_setgrps='$d_setgrps'
12462d_sethent='$d_sethent'
12463d_setlinebuf='$d_setlinebuf'
12464d_setlocale='$d_setlocale'
12465d_setnent='$d_setnent'
12466d_setpent='$d_setpent'
12467d_setpgid='$d_setpgid'
12468d_setpgrp2='$d_setpgrp2'
12469d_setpgrp='$d_setpgrp'
12470d_setprior='$d_setprior'
12471d_setpwent='$d_setpwent'
12472d_setregid='$d_setregid'
12473d_setresgid='$d_setresgid'
12474d_setresuid='$d_setresuid'
12475d_setreuid='$d_setreuid'
12476d_setrgid='$d_setrgid'
12477d_setruid='$d_setruid'
12478d_setsent='$d_setsent'
12479d_setsid='$d_setsid'
12480d_setvbuf='$d_setvbuf'
12481d_sfio='$d_sfio'
12482d_shm='$d_shm'
12483d_shmat='$d_shmat'
12484d_shmatprototype='$d_shmatprototype'
12485d_shmctl='$d_shmctl'
12486d_shmdt='$d_shmdt'
12487d_shmget='$d_shmget'
12488d_sigaction='$d_sigaction'
12489d_sigsetjmp='$d_sigsetjmp'
12490d_socket='$d_socket'
12491d_sockpair='$d_sockpair'
12492d_stat64='$d_stat64'
12493d_statblks='$d_statblks'
12494d_stdio_cnt_lval='$d_stdio_cnt_lval'
12495d_stdio_ptr_lval='$d_stdio_ptr_lval'
12496d_stdiobase='$d_stdiobase'
12497d_stdstdio='$d_stdstdio'
12498d_store64='$d_store64'
12499d_strchr='$d_strchr'
12500d_strcoll='$d_strcoll'
12501d_strctcpy='$d_strctcpy'
12502d_strerrm='$d_strerrm'
12503d_strerror='$d_strerror'
12504d_strtod='$d_strtod'
12505d_strtol='$d_strtol'
12506d_strtoul='$d_strtoul'
12507d_strxfrm='$d_strxfrm'
12508d_suidsafe='$d_suidsafe'
12509d_symlink='$d_symlink'
12510d_syscall='$d_syscall'
12511d_sysconf='$d_sysconf'
12512d_sysernlst='$d_sysernlst'
12513d_syserrlst='$d_syserrlst'
12514d_system='$d_system'
12515d_tcgetpgrp='$d_tcgetpgrp'
12516d_tcsetpgrp='$d_tcsetpgrp'
12517d_telldir64='$d_telldir64'
12518d_telldir='$d_telldir'
12519d_time='$d_time'
12520d_times='$d_times'
12521d_tmpfile64='$d_tmpfile64'
12522d_truncate64='$d_truncate64'
12523d_truncate='$d_truncate'
12524d_tzname='$d_tzname'
12525d_umask='$d_umask'
12526d_uname='$d_uname'
12527d_union_semun='$d_union_semun'
12528d_vfork='$d_vfork'
12529d_void_closedir='$d_void_closedir'
12530d_voidsig='$d_voidsig'
12531d_voidtty='$d_voidtty'
12532d_volatile='$d_volatile'
12533d_vprintf='$d_vprintf'
12534d_wait4='$d_wait4'
12535d_waitpid='$d_waitpid'
12536d_wcstombs='$d_wcstombs'
12537d_wctomb='$d_wctomb'
12538d_xenix='$d_xenix'
12539date='$date'
12540db_hashtype='$db_hashtype'
12541db_prefixtype='$db_prefixtype'
12542defvoidused='$defvoidused'
12543direntrytype='$direntrytype'
12544dlext='$dlext'
12545dlsrc='$dlsrc'
12546doublesize='$doublesize'
12547drand01='$drand01'
12548dynamic_ext='$dynamic_ext'
12549eagain='$eagain'
12550ebcdic='$ebcdic'
12551echo='$echo'
12552egrep='$egrep'
12553emacs='$emacs'
12554eunicefix='$eunicefix'
12555exe_ext='$exe_ext'
12556expr='$expr'
12557extensions='$extensions'
12558find='$find'
12559firstmakefile='$firstmakefile'
12560flex='$flex'
12561fpostype='$fpostype'
12562freetype='$freetype'
12563full_csh='$full_csh'
12564full_sed='$full_sed'
12565gccversion='$gccversion'
12566gidtype='$gidtype'
12567glibpth='$glibpth'
12568grep='$grep'
12569groupcat='$groupcat'
12570groupstype='$groupstype'
12571gzip='$gzip'
12572h_fcntl='$h_fcntl'
12573h_sysfile='$h_sysfile'
12574hint='$hint'
12575hostcat='$hostcat'
12576huge='$huge'
12577i_arpainet='$i_arpainet'
12578i_bsdioctl='$i_bsdioctl'
12579i_db='$i_db'
12580i_dbm='$i_dbm'
12581i_dirent='$i_dirent'
12582i_dld='$i_dld'
12583i_dlfcn='$i_dlfcn'
12584i_fcntl='$i_fcntl'
12585i_float='$i_float'
12586i_gdbm='$i_gdbm'
12587i_grp='$i_grp'
12588i_inttypes='$i_inttypes'
12589i_limits='$i_limits'
12590i_locale='$i_locale'
7f3d1cf1 12591i_machcthr='$i_machcthr'
5f80c64f
JH
12592i_malloc='$i_malloc'
12593i_math='$i_math'
12594i_memory='$i_memory'
12595i_ndbm='$i_ndbm'
12596i_netdb='$i_netdb'
12597i_neterrno='$i_neterrno'
12598i_niin='$i_niin'
12599i_pwd='$i_pwd'
12600i_rpcsvcdbm='$i_rpcsvcdbm'
12601i_sfio='$i_sfio'
12602i_sgtty='$i_sgtty'
12603i_stdarg='$i_stdarg'
12604i_stddef='$i_stddef'
12605i_stdlib='$i_stdlib'
12606i_string='$i_string'
12607i_sysaccess='$i_sysaccess'
12608i_sysdir='$i_sysdir'
12609i_sysfile='$i_sysfile'
12610i_sysfilio='$i_sysfilio'
12611i_sysin='$i_sysin'
12612i_sysioctl='$i_sysioctl'
12613i_sysndir='$i_sysndir'
12614i_sysparam='$i_sysparam'
12615i_sysresrc='$i_sysresrc'
12616i_syssecrt='$i_syssecrt'
12617i_sysselct='$i_sysselct'
12618i_syssockio='$i_syssockio'
12619i_sysstat='$i_sysstat'
12620i_systime='$i_systime'
12621i_systimek='$i_systimek'
12622i_systimes='$i_systimes'
12623i_systypes='$i_systypes'
12624i_sysun='$i_sysun'
12625i_syswait='$i_syswait'
12626i_termio='$i_termio'
12627i_termios='$i_termios'
12628i_time='$i_time'
12629i_unistd='$i_unistd'
12630i_utime='$i_utime'
12631i_values='$i_values'
12632i_varargs='$i_varargs'
12633i_varhdr='$i_varhdr'
12634i_vfork='$i_vfork'
12635ignore_versioned_solibs='$ignore_versioned_solibs'
12636incpath='$incpath'
12637inews='$inews'
12638installarchlib='$installarchlib'
12639installbin='$installbin'
12640installman1dir='$installman1dir'
12641installman3dir='$installman3dir'
12642installprivlib='$installprivlib'
12643installscript='$installscript'
12644installsitearch='$installsitearch'
12645installsitelib='$installsitelib'
12646intsize='$intsize'
12647known_extensions='$known_extensions'
12648ksh='$ksh'
12649large='$large'
12650ld='$ld'
12651lddlflags='$lddlflags'
12652ldflags='$ldflags'
12653less='$less'
12654lib_ext='$lib_ext'
12655libc='$libc'
12656libperl='$libperl'
12657libpth='$libpth'
12658libs='$libs'
12659libswanted='$libswanted'
12660line='$line'
12661lint='$lint'
12662lkflags='$lkflags'
12663ln='$ln'
12664lns='$lns'
12665locincpth='$locincpth'
12666loclibpth='$loclibpth'
12667longdblsize='$longdblsize'
12668longlongsize='$longlongsize'
12669longsize='$longsize'
12670lp='$lp'
12671lpr='$lpr'
12672ls='$ls'
12673lseeksize='$lseeksize'
12674lseektype='$lseektype'
12675mail='$mail'
12676mailx='$mailx'
12677make='$make'
12678make_set_make='$make_set_make'
12679mallocobj='$mallocobj'
12680mallocsrc='$mallocsrc'
12681malloctype='$malloctype'
12682man1dir='$man1dir'
12683man1direxp='$man1direxp'
12684man1ext='$man1ext'
12685man3dir='$man3dir'
12686man3direxp='$man3direxp'
12687man3ext='$man3ext'
12688medium='$medium'
12689mips='$mips'
12690mips_type='$mips_type'
12691mkdir='$mkdir'
12692models='$models'
12693modetype='$modetype'
12694more='$more'
12695mv='$mv'
12696myarchname='$myarchname'
12697mydomain='$mydomain'
12698myhostname='$myhostname'
12699myuname='$myuname'
12700n='$n'
12701netdb_hlen_type='$netdb_hlen_type'
12702netdb_host_type='$netdb_host_type'
12703netdb_name_type='$netdb_name_type'
12704netdb_net_type='$netdb_net_type'
12705nm='$nm'
12706nm_opt='$nm_opt'
12707nm_so_opt='$nm_so_opt'
12708nonxs_ext='$nonxs_ext'
12709nroff='$nroff'
12710o_nonblock='$o_nonblock'
12711obj_ext='$obj_ext'
12712optimize='$optimize'
12713orderlib='$orderlib'
12714osname='$osname'
12715osvers='$osvers'
12716package='$package'
12717pager='$pager'
12718passcat='$passcat'
12719patchlevel='$patchlevel'
12720path_sep='$path_sep'
12721perl='$perl'
12722perladmin='$perladmin'
12723perlpath='$perlpath'
12724pg='$pg'
12725phostname='$phostname'
12726pidtype='$pidtype'
12727plibpth='$plibpth'
12728pmake='$pmake'
12729pr='$pr'
12730prefix='$prefix'
12731prefixexp='$prefixexp'
12732privlib='$privlib'
12733privlibexp='$privlibexp'
12734prototype='$prototype'
13666627 12735pthread_create_joinable='$pthread_create_joinable'
5f80c64f
JH
12736ptrsize='$ptrsize'
12737randbits='$randbits'
12738randfunc='$randfunc'
12739randseedtype='$randseedtype'
12740ranlib='$ranlib'
12741rd_nodata='$rd_nodata'
12742rm='$rm'
12743rmail='$rmail'
12744runnm='$runnm'
12745sched_yield='$sched_yield'
12746scriptdir='$scriptdir'
12747scriptdirexp='$scriptdirexp'
12748sed='$sed'
12749seedfunc='$seedfunc'
12750selectminbits='$selectminbits'
12751selecttype='$selecttype'
12752sendmail='$sendmail'
12753sh='$sh'
12754shar='$shar'
12755sharpbang='$sharpbang'
12756shmattype='$shmattype'
12757shortsize='$shortsize'
12758shrpenv='$shrpenv'
12759shsharp='$shsharp'
12760sig_name='$sig_name'
12761sig_name_init='$sig_name_init'
12762sig_num='$sig_num'
824a2ba3 12763sig_num_init='$sig_num_init'
5f80c64f
JH
12764signal_t='$signal_t'
12765sitearch='$sitearch'
12766sitearchexp='$sitearchexp'
12767sitelib='$sitelib'
12768sitelibexp='$sitelibexp'
12769sizetype='$sizetype'
12770sleep='$sleep'
12771smail='$smail'
12772small='$small'
12773so='$so'
12774sockethdr='$sockethdr'
12775socketlib='$socketlib'
12776sort='$sort'
12777spackage='$spackage'
12778spitshell='$spitshell'
12779split='$split'
12780src='$src'
12781ssizetype='$ssizetype'
12782startperl='$startperl'
12783startsh='$startsh'
12784static_ext='$static_ext'
12785stdchar='$stdchar'
12786stdio_base='$stdio_base'
12787stdio_bufsiz='$stdio_bufsiz'
12788stdio_cnt='$stdio_cnt'
12789stdio_filbuf='$stdio_filbuf'
12790stdio_ptr='$stdio_ptr'
12791strings='$strings'
12792submit='$submit'
12793subversion='$subversion'
12794sysman='$sysman'
12795tail='$tail'
12796tar='$tar'
12797tbl='$tbl'
12798tee='$tee'
12799test='$test'
12800timeincl='$timeincl'
12801timetype='$timetype'
12802touch='$touch'
12803tr='$tr'
12804trnl='$trnl'
12805troff='$troff'
12806uidtype='$uidtype'
12807uname='$uname'
12808uniq='$uniq'
12809use64bits='$use64bits'
12810usedl='$usedl'
12811usemultiplicity='$usemultiplicity'
12812usemymalloc='$usemymalloc'
12813usenm='$usenm'
12814useopcode='$useopcode'
12815useperlio='$useperlio'
12816useposix='$useposix'
12817usesfio='$usesfio'
12818useshrplib='$useshrplib'
12819usethreads='$usethreads'
12820usevfork='$usevfork'
12821usrinc='$usrinc'
12822uuname='$uuname'
12823version='$version'
12824vi='$vi'
12825voidflags='$voidflags'
12826xlibpth='$xlibpth'
12827zcat='$zcat'
12828zip='$zip'
12829EOT
12830
12831: Add in command line options if available
12832$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
12833
12834: add special variables
12835$test -f $src/patchlevel.h && \
12836awk '/^#define/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
12837echo "CONFIG=true" >>config.sh
12838
12839: propagate old symbols
12840if $test -f UU/config.sh; then
12841 <UU/config.sh sort | uniq >UU/oldconfig.sh
12842 sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
12843 sort | uniq -u >UU/oldsyms
12844 set X `cat UU/oldsyms`
12845 shift
12846 case $# in
12847 0) ;;
12848 *)
12849 cat <<EOM
12850Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
12851EOM
12852 echo "# Variables propagated from previous config.sh file." >>config.sh
12853 for sym in `cat UU/oldsyms`; do
12854 echo " Propagating $hint variable "'$'"$sym..."
12855 eval 'tmp="$'"${sym}"'"'
12856 echo "$tmp" | \
12857 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
12858 done
12859 ;;
12860 esac
12861fi
12862
12863: Finish up by extracting the .SH files
12864case "$alldone" in
12865exit)
12866 $rm -rf UU
12867 echo "Done."
12868 exit 0
12869 ;;
12870cont)
12871 ;;
12872'')
12873 dflt=''
12874 nostick=true
12875 $cat <<EOM
12876
12877If you'd like to make any changes to the config.sh file before I begin
12878to configure things, do it as a shell escape now (e.g. !vi config.sh).
12879
12880EOM
12881 rp="Press return or use a shell escape to edit config.sh:"
12882 . UU/myread
12883 nostick=''
12884 case "$ans" in
12885 '') ;;
12886 *) : in case they cannot read
12887 sh 1>&4 -c "$ans";;
12888 esac
12889 ;;
12890esac
12891
12892: if this fails, just run all the .SH files by hand
12893. ./config.sh
12894
12895echo " "
12896exec 1>&4
12897. ./UU/extract
12898
12899if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
12900 dflt=y
12901 case "$silent" in
12902 true) ;;
12903 *)
12904 $cat <<EOM
12905
12906Now you need to generate make dependencies by running "$make depend".
12907You might prefer to run it in background: "$make depend > makedepend.out &"
12908It can take a while, so you might not want to run it right now.
12909
12910EOM
12911 ;;
12912 esac
12913 rp="Run $make depend now?"
12914 . UU/myread
12915 case "$ans" in
12916 y*)
12917 $make depend && echo "Now you must run a $make."
12918 ;;
12919 *)
12920 echo "You must run '$make depend' then '$make'."
12921 ;;
12922 esac
12923elif test -f [Mm]akefile; then
12924 echo " "
12925 echo "Now you must run a $make."
12926else
12927 echo "Done."
12928fi
12929
12930if $test -f Policy.sh; then
12931 $cat <<EOM
12932
12933If you compile $package on a different machine or from a different object
12934directory, copy the Policy.sh file from this object directory to the
12935new one before you run Configure -- this will help you with most of
12936the policy defaults.
12937
12938EOM
12939fi
12940if $test -f config.msg; then
12941 echo "Hmm. I also noted the following information while running:"
12942 echo " "
12943 $cat config.msg >&4
12944 $rm -f config.msg
12945fi
12946$rm -f kit*isdone ark*isdone
12947$rm -rf UU
12948
12949: End of Configure
12950