This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Android hints: Only use adb if $targetrun is set to adb
[perl5.git] / Configure
... / ...
CommitLineData
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 package (which contains metaconfig) is available via SVN:
17# svn co https://svn.code.sf.net/p/dist/code/trunk/dist
18#
19# Though this script was generated by metaconfig from metaunits, it is
20# OK to send patches against Configure itself. It's up to the Configure
21# pumpkin to backport the patch to the metaunits if it is accepted.
22# For more information on patching Configure, see pod/perlhack.pod
23#
24# The metaunits are also available from the public git repository:
25# http://perl5.git.perl.org/metaconfig.git/ or
26# $ git clone git://perl5.git.perl.org/metaconfig.git metaconfig
27#
28# See Porting/pumpkin.pod for more information on metaconfig.
29#
30
31# Generated on Wed Jan 22 12:03:46 CET 2014 [metaconfig 3.5 PL0]
32# (with additional metaconfig patches by perlbug@perl.org)
33
34cat >c1$$ <<EOF
35ARGGGHHHH!!!!!
36
37SCO csh still thinks true is false. Write to SCO today and tell them that next
38year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
39
40(Actually, Configure ought to just patch csh in place. Hmm. Hmmmmm. All
41we'd have to do is go in and swap the && and || tokens, wherever they are.)
42
43[End of diatribe. We now return you to your regularly scheduled programming...]
44EOF
45cat >c2$$ <<EOF
46
47OOPS! You naughty creature! You didn't run Configure with sh!
48I will attempt to remedy the situation by running sh for you...
49EOF
50
51true || cat c1$$ c2$$
52true || exec sh $0 $argv:q
53
54(exit $?0) || cat c2$$
55(exit $?0) || exec sh $0 $argv:q
56rm -f c1$$ c2$$
57
58if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
59 cat <<EOF
60***
61*** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
62*** Configure that well. (Plan 9 is close to UNIX but not close enough.)
63*** Please read the README.plan9 for further instructions.
64*** Cannot continue, aborting.
65***
66EOF
67 exit 1
68fi
69
70if test ! -c /dev/null ; then
71 cat <<EOF
72***
73*** I'm sorry, but /dev/null appears to be a file rather than a device.
74*** Please consult your operating sytem's notes for making a device
75*** in /dev.
76*** Cannot continue, aborting.
77***
78EOF
79 exit 1
80fi
81
82: compute my invocation name
83me=$0
84case "$0" in
85*/*)
86 me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
87 test "$me" || me=$0
88 ;;
89esac
90
91: Proper separator for the PATH environment variable
92p_=:
93: On OS/2 this directory should exist if this is not floppy only system ":-]"
94if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
95 if test -n "$OS2_SHELL"; then
96 p_=\;
97 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
98 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
99 is_os2=yes
100 elif test -n "$DJGPP"; then
101 case "X${MACHTYPE:-nonesuchmach}" in
102 *cygwin|*msys) ;;
103 *) p_=\; ;;
104 esac
105 fi
106fi
107
108: Proper PATH setting
109paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
110paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
111paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
112paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
113paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
114paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
115paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
116paths="$paths /sbin /usr/sbin /usr/libexec"
117paths="$paths /system/gnu_library/bin"
118
119for p in $paths
120do
121 case "$p_$PATH$p_" in
122 *$p_$p$p_*) ;;
123 *) test -d $p && PATH=$PATH$p_$p ;;
124 esac
125done
126
127PATH=.$p_$PATH
128export PATH
129
130: shall we be using ksh?
131inksh=''
132needksh=''
133avoidksh=''
134newsh=/bin/ksh
135changesh=''
136if (PATH=.; alias -x) >/dev/null 2>&1; then
137 inksh=true
138fi
139if test -f /hp-ux -a -f /bin/ksh; then
140 needksh='to avoid sh bug in "here document" expansion'
141fi
142if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
143 if test X`/usr/bin/uname -v` = X4; then
144 avoidksh="to avoid AIX 4's /bin/sh"
145 newsh=/usr/bin/bsh
146 fi
147fi
148if test -f /osf_boot -a -f /usr/sbin/setld; then
149 if test X`/usr/bin/uname -s` = XOSF1; then
150 avoidksh="to avoid Digital UNIX' ksh"
151 newsh=/bin/sh
152 unset BIN_SH
153 fi
154fi
155case "$inksh/$needksh" in
156/[a-z]*)
157 ENV=''
158 changesh=true
159 reason="$needksh"
160 ;;
161esac
162case "$inksh/$avoidksh" in
163true/[a-z]*)
164 changesh=true
165 reason="$avoidksh"
166 ;;
167esac
168case "$inksh/$needksh-$avoidksh-" in
169true/--)
170 cat <<EOM
171(I see you are using the Korn shell. Some ksh's blow up on $me,
172mainly on older exotic systems. If yours does, try the Bourne shell instead.)
173EOM
174 ;;
175esac
176case "$changesh" in
177true)
178 export newsh
179 echo "(Feeding myself to $newsh $reason.)"
180 case "$0" in
181 Configure|*/Configure) exec $newsh $0 "$@";;
182 *) exec $newsh Configure "$@";;
183 esac
184 ;;
185esac
186test -x "${newsh}" || unset newsh
187
188: if needed, set CDPATH to a harmless value that is not chatty
189: avoid bash 2.02 problems with empty CDPATH.
190case "$CDPATH" in
191'') ;;
192*) case "$SHELL" in
193 *bash*) CDPATH='.' ;;
194 *) CDPATH='' ;;
195 esac
196 ;;
197esac
198
199: Configure runs within the UU subdirectory
200test -d UU || mkdir UU
201cd UU && rm -f ./*
202
203ccname=''
204ccversion=''
205ccsymbols=''
206cppccsymbols=''
207cppsymbols=''
208from=''
209run=''
210targetarch=''
211targetdir=''
212targethost=''
213targetmkdir=''
214targetport=''
215to=''
216usecrosscompile=''
217hostperl=''
218hostgenerate=''
219hostosname=''
220targetsh=''
221extern_C=''
222mistrustnm=''
223usedevel=''
224perllibs=''
225dynamic_ext=''
226extensions=''
227known_extensions=''
228nonxs_ext=''
229static_ext=''
230useopcode=''
231useposix=''
232extras=''
233d_bsd=''
234d_eunice=''
235d_xenix=''
236eunicefix=''
237ar=''
238awk=''
239bash=''
240bison=''
241byacc=''
242cat=''
243chgrp=''
244chmod=''
245chown=''
246comm=''
247compress=''
248cp=''
249cpio=''
250cpp=''
251csh=''
252date=''
253echo=''
254egrep=''
255emacs=''
256expr=''
257find=''
258flex=''
259gmake=''
260grep=''
261gzip=''
262inews=''
263ksh=''
264less=''
265line=''
266lint=''
267ln=''
268lp=''
269lpr=''
270ls=''
271mail=''
272mailx=''
273make=''
274mkdir=''
275more=''
276mv=''
277nm=''
278nroff=''
279perl=''
280pg=''
281pmake=''
282pr=''
283rm=''
284rmail=''
285sed=''
286sendmail=''
287shar=''
288sleep=''
289smail=''
290sort=''
291submit=''
292tail=''
293tar=''
294tbl=''
295tee=''
296test=''
297touch=''
298tr=''
299troff=''
300uname=''
301uniq=''
302uuname=''
303vi=''
304zcat=''
305zip=''
306full_ar=''
307full_sed=''
308libswanted=''
309hint=''
310myuname=''
311osname=''
312osvers=''
313Author=''
314Date=''
315Header=''
316Id=''
317Locker=''
318Log=''
319RCSfile=''
320Revision=''
321Source=''
322State=''
323sysroot=''
324_a=''
325_exe=''
326_o=''
327archobjs=''
328exe_ext=''
329firstmakefile=''
330lib_ext=''
331obj_ext=''
332path_sep=''
333rm_try=''
334afs=''
335afsroot=''
336alignbytes=''
337ansi2knr=''
338archlib=''
339archlibexp=''
340d_archlib=''
341installarchlib=''
342archname=''
343myarchname=''
344useversionedarchname=''
345d_atolf=''
346d_atoll=''
347baserev=''
348bin=''
349binexp=''
350initialinstalllocation=''
351installbin=''
352userelocatableinc=''
353byteorder=''
354cc=''
355ccflags=''
356cppflags=''
357ldflags=''
358lkflags=''
359locincpth=''
360optimize=''
361cf_email=''
362cf_by=''
363cf_time=''
364charbits=''
365charsize=''
366contains=''
367cpp_stuff=''
368cpplast=''
369cppminus=''
370cpprun=''
371cppstdin=''
372d__fwalk=''
373d_access=''
374d_accessx=''
375d_aintl=''
376d_alarm=''
377asctime_r_proto=''
378d_asctime_r=''
379d_attribute_deprecated=''
380d_attribute_format=''
381d_attribute_malloc=''
382d_attribute_nonnull=''
383d_attribute_noreturn=''
384d_attribute_pure=''
385d_attribute_unused=''
386d_attribute_warn_unused_result=''
387d_printf_format_null=''
388d_bcmp=''
389d_bcopy=''
390d_builtin_choose_expr=''
391d_builtin_expect=''
392d_bzero=''
393d_c99_variadic_macros=''
394d_casti32=''
395castflags=''
396d_castneg=''
397d_chown=''
398d_chroot=''
399d_chsize=''
400d_class=''
401d_clearenv=''
402d_closedir=''
403d_void_closedir=''
404d_cmsghdr_s=''
405d_const=''
406d_copysignl=''
407d_cplusplus=''
408cryptlib=''
409d_crypt=''
410crypt_r_proto=''
411d_crypt_r=''
412d_csh=''
413full_csh=''
414d_ctermid=''
415ctermid_r_proto=''
416d_ctermid_r=''
417ctime_r_proto=''
418d_ctime_r=''
419d_cuserid=''
420d_dbl_dig=''
421d_dbminitproto=''
422d_difftime=''
423d_dir_dd_fd=''
424d_dirfd=''
425d_dlerror=''
426d_dlopen=''
427d_dlsymun=''
428d_dosuid=''
429d_suidsafe=''
430d_drand48_r=''
431drand48_r_proto=''
432d_drand48proto=''
433d_dup2=''
434d_eaccess=''
435d_endgrent=''
436d_endgrent_r=''
437endgrent_r_proto=''
438d_endhent=''
439d_endhostent_r=''
440endhostent_r_proto=''
441d_endnent=''
442d_endnetent_r=''
443endnetent_r_proto=''
444d_endpent=''
445d_endprotoent_r=''
446endprotoent_r_proto=''
447d_endpwent=''
448d_endpwent_r=''
449endpwent_r_proto=''
450d_endsent=''
451d_endservent_r=''
452endservent_r_proto=''
453d_faststdio=''
454d_fchdir=''
455d_fchmod=''
456d_fchown=''
457d_fcntl=''
458d_fcntl_can_lock=''
459d_fd_macros=''
460d_fd_set=''
461d_fds_bits=''
462d_fgetpos=''
463d_finite=''
464d_finitel=''
465d_flexfnam=''
466d_flock=''
467d_flockproto=''
468d_fork=''
469d_fp_class=''
470d_fpclass=''
471d_fpclassify=''
472d_fpclassl=''
473d_fpos64_t=''
474d_frexpl=''
475d_fs_data_s=''
476d_fseeko=''
477d_fsetpos=''
478d_fstatfs=''
479d_fsync=''
480d_ftello=''
481d_ftime=''
482d_gettimeod=''
483d_futimes=''
484d_Gconvert=''
485d_getaddrinfo=''
486d_getcwd=''
487d_getespwnam=''
488d_getfsstat=''
489d_getgrent=''
490d_getgrent_r=''
491getgrent_r_proto=''
492d_getgrgid_r=''
493getgrgid_r_proto=''
494d_getgrnam_r=''
495getgrnam_r_proto=''
496d_getgrps=''
497d_gethbyaddr=''
498d_gethbyname=''
499d_gethent=''
500aphostname=''
501d_gethname=''
502d_phostname=''
503d_uname=''
504d_gethostbyaddr_r=''
505gethostbyaddr_r_proto=''
506d_gethostbyname_r=''
507gethostbyname_r_proto=''
508d_gethostent_r=''
509gethostent_r_proto=''
510d_gethostprotos=''
511d_getitimer=''
512d_getlogin=''
513d_getlogin_r=''
514getlogin_r_proto=''
515d_getmnt=''
516d_getmntent=''
517d_getnameinfo=''
518d_getnbyaddr=''
519d_getnbyname=''
520d_getnent=''
521d_getnetbyaddr_r=''
522getnetbyaddr_r_proto=''
523d_getnetbyname_r=''
524getnetbyname_r_proto=''
525d_getnetent_r=''
526getnetent_r_proto=''
527d_getnetprotos=''
528d_getpagsz=''
529d_getpent=''
530d_getpgid=''
531d_getpgrp2=''
532d_bsdgetpgrp=''
533d_getpgrp=''
534d_getppid=''
535d_getprior=''
536d_getpbyname=''
537d_getpbynumber=''
538d_getprotobyname_r=''
539getprotobyname_r_proto=''
540d_getprotobynumber_r=''
541getprotobynumber_r_proto=''
542d_getprotoent_r=''
543getprotoent_r_proto=''
544d_getprotoprotos=''
545d_getprpwnam=''
546d_getpwent=''
547d_getpwent_r=''
548getpwent_r_proto=''
549d_getpwnam_r=''
550getpwnam_r_proto=''
551d_getpwuid_r=''
552getpwuid_r_proto=''
553d_getsent=''
554d_getservbyname_r=''
555getservbyname_r_proto=''
556d_getservbyport_r=''
557getservbyport_r_proto=''
558d_getservent_r=''
559getservent_r_proto=''
560d_getservprotos=''
561d_getspnam=''
562d_getspnam_r=''
563getspnam_r_proto=''
564d_getsbyname=''
565d_getsbyport=''
566d_gmtime_r=''
567gmtime_r_proto=''
568d_gnulibc=''
569gnulibc_version=''
570d_hasmntopt=''
571d_htonl=''
572d_ilogbl=''
573d_inetaton=''
574d_inetntop=''
575d_inetpton=''
576d_int64_t=''
577d_isascii=''
578d_isblank=''
579d_isfinite=''
580d_isinf=''
581d_isnan=''
582d_isnanl=''
583d_killpg=''
584d_lchown=''
585d_ldbl_dig=''
586d_libm_lib_version=''
587d_link=''
588d_localtime_r=''
589d_localtime_r_needs_tzset=''
590localtime_r_proto=''
591d_locconv=''
592d_lockf=''
593d_longdbl=''
594longdblsize=''
595d_longlong=''
596longlongsize=''
597d_lseekproto=''
598d_lstat=''
599d_madvise=''
600d_malloc_good_size=''
601d_malloc_size=''
602d_mblen=''
603d_mbstowcs=''
604d_mbtowc=''
605d_memchr=''
606d_memcmp=''
607d_memcpy=''
608d_memmove=''
609d_memset=''
610d_mkdir=''
611d_mkdtemp=''
612d_mkfifo=''
613d_mkstemp=''
614d_mkstemps=''
615d_mktime=''
616d_mmap=''
617mmaptype=''
618d_modfl=''
619d_modfl_pow32_bug=''
620d_modflproto=''
621d_mprotect=''
622d_msg=''
623d_msgctl=''
624d_msgget=''
625d_msghdr_s=''
626d_msgrcv=''
627d_msgsnd=''
628d_msync=''
629d_munmap=''
630d_nice=''
631d_nl_langinfo=''
632d_off64_t=''
633d_open3=''
634d_fpathconf=''
635d_pathconf=''
636d_pause=''
637d_pipe=''
638d_poll=''
639d_portable=''
640d_prctl=''
641d_prctl_set_name=''
642d_procselfexe=''
643procselfexe=''
644d_old_pthread_create_joinable=''
645old_pthread_create_joinable=''
646d_pthread_atfork=''
647d_pthread_attr_setscope=''
648d_pthread_yield=''
649d_sched_yield=''
650sched_yield=''
651d_qgcvt=''
652d_random_r=''
653random_r_proto=''
654d_readdir64_r=''
655readdir64_r_proto=''
656d_readdir=''
657d_rewinddir=''
658d_seekdir=''
659d_telldir=''
660d_readdir_r=''
661readdir_r_proto=''
662d_readlink=''
663d_readv=''
664d_recvmsg=''
665d_rename=''
666d_rmdir=''
667d_safebcpy=''
668d_safemcpy=''
669d_sanemcmp=''
670d_sbrkproto=''
671d_scalbnl=''
672d_select=''
673d_sem=''
674d_semctl=''
675d_semget=''
676d_semop=''
677d_sendmsg=''
678d_setegid=''
679d_seteuid=''
680d_setgrent=''
681d_setgrent_r=''
682setgrent_r_proto=''
683d_setgrps=''
684d_sethent=''
685d_sethostent_r=''
686sethostent_r_proto=''
687d_setitimer=''
688d_setlinebuf=''
689d_setlocale=''
690d_setlocale_r=''
691setlocale_r_proto=''
692d_setnent=''
693d_setnetent_r=''
694setnetent_r_proto=''
695d_setpent=''
696d_setpgid=''
697d_setpgrp2=''
698d_bsdsetpgrp=''
699d_setpgrp=''
700d_setprior=''
701d_setproctitle=''
702d_setprotoent_r=''
703setprotoent_r_proto=''
704d_setpwent=''
705d_setpwent_r=''
706setpwent_r_proto=''
707d_setregid=''
708d_setresgid=''
709d_setresuid=''
710d_setreuid=''
711d_setrgid=''
712d_setruid=''
713d_setsent=''
714d_setservent_r=''
715setservent_r_proto=''
716d_setsid=''
717d_setvbuf=''
718d_shm=''
719d_shmat=''
720d_shmatprototype=''
721shmattype=''
722d_shmctl=''
723d_shmdt=''
724d_shmget=''
725d_sigaction=''
726d_signbit=''
727d_sigprocmask=''
728d_sigsetjmp=''
729usesitecustomize=''
730d_snprintf=''
731d_vsnprintf=''
732d_sockatmark=''
733d_sockatmarkproto=''
734d_ip_mreq=''
735d_ip_mreq_source=''
736d_ipv6_mreq=''
737d_ipv6_mreq_source=''
738d_msg_ctrunc=''
739d_msg_dontroute=''
740d_msg_oob=''
741d_msg_peek=''
742d_msg_proxy=''
743d_oldsock=''
744d_scm_rights=''
745d_sin6_scope_id=''
746d_sockaddr_in6=''
747d_sockaddr_sa_len=''
748d_socket=''
749d_sockpair=''
750sockethdr=''
751socketlib=''
752d_socklen_t=''
753d_socks5_init=''
754d_sprintf_returns_strlen=''
755d_sqrtl=''
756d_srand48_r=''
757srand48_r_proto=''
758d_srandom_r=''
759srandom_r_proto=''
760d_sresgproto=''
761d_sresuproto=''
762d_statblks=''
763d_statfs_f_flags=''
764d_statfs_s=''
765d_static_inline=''
766perl_static_inline=''
767d_fstatvfs=''
768d_statvfs=''
769d_stdio_cnt_lval=''
770d_stdio_ptr_lval=''
771d_stdio_ptr_lval_nochange_cnt=''
772d_stdio_ptr_lval_sets_cnt=''
773d_stdiobase=''
774d_stdstdio=''
775stdio_base=''
776stdio_bufsiz=''
777stdio_cnt=''
778stdio_filbuf=''
779stdio_ptr=''
780d_index=''
781d_strchr=''
782d_strcoll=''
783d_strctcpy=''
784d_strerrm=''
785d_strerror=''
786d_sysernlst=''
787d_syserrlst=''
788d_strerror_r=''
789strerror_r_proto=''
790d_strftime=''
791d_strlcat=''
792d_strlcpy=''
793d_strtod=''
794d_strtol=''
795d_strtold=''
796d_strtoll=''
797d_strtoq=''
798d_strtoul=''
799d_strtoull=''
800d_strtouq=''
801d_strxfrm=''
802d_symlink=''
803d_syscall=''
804d_syscallproto=''
805d_sysconf=''
806d_system=''
807d_tcgetpgrp=''
808d_tcsetpgrp=''
809d_telldirproto=''
810d_time=''
811timetype=''
812d_asctime64=''
813d_ctime64=''
814d_difftime64=''
815d_gmtime64=''
816d_localtime64=''
817d_mktime64=''
818d_timegm=''
819clocktype=''
820d_times=''
821d_tmpnam_r=''
822tmpnam_r_proto=''
823d_truncate=''
824d_ttyname_r=''
825ttyname_r_proto=''
826d_tzname=''
827d_u32align=''
828d_ualarm=''
829d_umask=''
830d_semctl_semid_ds=''
831d_semctl_semun=''
832d_union_semun=''
833d_unordered=''
834d_unsetenv=''
835d_usleep=''
836d_usleepproto=''
837d_ustat=''
838d_pseudofork=''
839d_vfork=''
840usevfork=''
841d_voidsig=''
842signal_t=''
843d_volatile=''
844d_charvspr=''
845d_vprintf=''
846d_wait4=''
847d_waitpid=''
848d_wcstombs=''
849d_wctomb=''
850d_writev=''
851dlext=''
852bin_ELF=''
853cccdlflags=''
854ccdlflags=''
855dlsrc=''
856ld=''
857ld_can_script=''
858lddlflags=''
859usedl=''
860doublesize=''
861bootstrap_charset=''
862ebcdic=''
863fflushNULL=''
864fflushall=''
865fpossize=''
866fpostype=''
867gccansipedantic=''
868gccosandvers=''
869gccversion=''
870gidformat=''
871gidsign=''
872gidsize=''
873gidtype=''
874groupstype=''
875h_fcntl=''
876h_sysfile=''
877html1dir=''
878html1direxp=''
879installhtml1dir=''
880html3dir=''
881html3direxp=''
882installhtml3dir=''
883i_arpainet=''
884i_assert=''
885i_crypt=''
886db_hashtype=''
887db_prefixtype=''
888db_version_major=''
889db_version_minor=''
890db_version_patch=''
891i_db=''
892i_dbm=''
893i_rpcsvcdbm=''
894d_dirnamlen=''
895direntrytype=''
896i_dirent=''
897i_dlfcn=''
898i_fcntl=''
899i_float=''
900i_fp=''
901i_fp_class=''
902i_gdbm=''
903d_grpasswd=''
904i_grp=''
905i_ieeefp=''
906i_inttypes=''
907i_langinfo=''
908i_libutil=''
909i_limits=''
910i_locale=''
911i_machcthr=''
912i_malloc=''
913i_mallocmalloc=''
914i_math=''
915i_memory=''
916i_mntent=''
917d_gdbm_ndbm_h_uses_prototypes=''
918d_gdbmndbm_h_uses_prototypes=''
919d_ndbm=''
920d_ndbm_h_uses_prototypes=''
921i_gdbm_ndbm=''
922i_gdbmndbm=''
923i_ndbm=''
924i_netdb=''
925i_neterrno=''
926i_netinettcp=''
927i_niin=''
928i_sysin=''
929i_poll=''
930i_prot=''
931i_pthread=''
932d_pwage=''
933d_pwchange=''
934d_pwclass=''
935d_pwcomment=''
936d_pwexpire=''
937d_pwgecos=''
938d_pwpasswd=''
939d_pwquota=''
940i_pwd=''
941i_shadow=''
942i_socks=''
943i_stdbool=''
944i_stddef=''
945i_stdlib=''
946i_string=''
947strings=''
948i_sunmath=''
949i_sysaccess=''
950i_sysdir=''
951i_sysfile=''
952d_voidtty=''
953i_bsdioctl=''
954i_sysfilio=''
955i_sysioctl=''
956i_syssockio=''
957i_syslog=''
958i_sysmman=''
959i_sysmode=''
960i_sysmount=''
961i_sysndir=''
962i_sysparam=''
963i_syspoll=''
964i_sysresrc=''
965i_syssecrt=''
966i_sysselct=''
967i_sysstat=''
968i_sysstatfs=''
969i_sysstatvfs=''
970i_systimes=''
971i_systypes=''
972i_sysuio=''
973i_sysun=''
974i_sysutsname=''
975i_sysvfs=''
976i_syswait=''
977i_sgtty=''
978i_termio=''
979i_termios=''
980d_tm_tm_gmtoff=''
981d_tm_tm_zone=''
982i_systime=''
983i_systimek=''
984i_time=''
985timeincl=''
986i_unistd=''
987i_ustat=''
988i_utime=''
989i_values=''
990i_stdarg=''
991i_varargs=''
992i_varhdr=''
993i_vfork=''
994d_inc_version_list=''
995inc_version_list=''
996inc_version_list_init=''
997installprefix=''
998installprefixexp=''
999installstyle=''
1000installusrbinperl=''
1001intsize=''
1002longsize=''
1003shortsize=''
1004issymlink=''
1005libc=''
1006ldlibpthname=''
1007libperl=''
1008shrpenv=''
1009useshrplib=''
1010glibpth=''
1011incpth=''
1012libpth=''
1013loclibpth=''
1014plibpth=''
1015xlibpth=''
1016ignore_versioned_solibs=''
1017libs=''
1018libsdirs=''
1019libsfiles=''
1020libsfound=''
1021libspath=''
1022lns=''
1023d_PRIEUldbl=''
1024d_PRIFUldbl=''
1025d_PRIGUldbl=''
1026d_PRIeldbl=''
1027d_PRIfldbl=''
1028d_PRIgldbl=''
1029d_SCNfldbl=''
1030sPRIEUldbl=''
1031sPRIFUldbl=''
1032sPRIGUldbl=''
1033sPRIeldbl=''
1034sPRIfldbl=''
1035sPRIgldbl=''
1036sSCNfldbl=''
1037lseeksize=''
1038lseektype=''
1039mad=''
1040madlyh=''
1041madlyobj=''
1042madlysrc=''
1043make_set_make=''
1044d_mymalloc=''
1045freetype=''
1046mallocobj=''
1047mallocsrc=''
1048malloctype=''
1049usemallocwrap=''
1050usemymalloc=''
1051installman1dir=''
1052man1dir=''
1053man1direxp=''
1054man1ext=''
1055installman3dir=''
1056man3dir=''
1057man3direxp=''
1058man3ext=''
1059modetype=''
1060multiarch=''
1061mydomain=''
1062myhostname=''
1063phostname=''
1064c=''
1065n=''
1066d_eofnblk=''
1067eagain=''
1068o_nonblock=''
1069rd_nodata=''
1070need_va_copy=''
1071netdb_hlen_type=''
1072netdb_host_type=''
1073netdb_name_type=''
1074netdb_net_type=''
1075groupcat=''
1076hostcat=''
1077passcat=''
1078orderlib=''
1079ranlib=''
1080d_perl_otherlibdirs=''
1081otherlibdirs=''
1082package=''
1083spackage=''
1084pager=''
1085api_revision=''
1086api_subversion=''
1087api_version=''
1088api_versionstring=''
1089patchlevel=''
1090perl_patchlevel=''
1091revision=''
1092subversion=''
1093version=''
1094version_patchlevel_string=''
1095perl5=''
1096perladmin=''
1097perlpath=''
1098d_nv_preserves_uv=''
1099d_nv_zero_is_allbits_zero=''
1100i16size=''
1101i16type=''
1102i32size=''
1103i32type=''
1104i64size=''
1105i64type=''
1106i8size=''
1107i8type=''
1108ivsize=''
1109ivtype=''
1110nv_overflows_integers_at=''
1111nv_preserves_uv_bits=''
1112nvsize=''
1113nvtype=''
1114u16size=''
1115u16type=''
1116u32size=''
1117u32type=''
1118u64size=''
1119u64type=''
1120u8size=''
1121u8type=''
1122uvsize=''
1123uvtype=''
1124ivdformat=''
1125nvEUformat=''
1126nvFUformat=''
1127nvGUformat=''
1128nveformat=''
1129nvfformat=''
1130nvgformat=''
1131uvXUformat=''
1132uvoformat=''
1133uvuformat=''
1134uvxformat=''
1135pidtype=''
1136prefix=''
1137prefixexp=''
1138installprivlib=''
1139privlib=''
1140privlibexp=''
1141prototype=''
1142ptrsize=''
1143d_PRIXU64=''
1144d_PRId64=''
1145d_PRIi64=''
1146d_PRIo64=''
1147d_PRIu64=''
1148d_PRIx64=''
1149sPRIXU64=''
1150sPRId64=''
1151sPRIi64=''
1152sPRIo64=''
1153sPRIu64=''
1154sPRIx64=''
1155d_quad=''
1156quadkind=''
1157quadtype=''
1158uquadtype=''
1159drand01=''
1160randbits=''
1161randfunc=''
1162randseedtype=''
1163seedfunc=''
1164installscript=''
1165scriptdir=''
1166scriptdirexp=''
1167selectminbits=''
1168selecttype=''
1169sh=''
1170sig_count=''
1171sig_name=''
1172sig_name_init=''
1173sig_num=''
1174sig_num_init=''
1175sig_size=''
1176d_sitearch=''
1177installsitearch=''
1178sitearch=''
1179sitearchexp=''
1180installsitebin=''
1181sitebin=''
1182sitebinexp=''
1183installsitehtml1dir=''
1184sitehtml1dir=''
1185sitehtml1direxp=''
1186installsitehtml3dir=''
1187sitehtml3dir=''
1188sitehtml3direxp=''
1189installsitelib=''
1190sitelib=''
1191sitelib_stem=''
1192sitelibexp=''
1193installsiteman1dir=''
1194siteman1dir=''
1195siteman1direxp=''
1196installsiteman3dir=''
1197siteman3dir=''
1198siteman3direxp=''
1199siteprefix=''
1200siteprefixexp=''
1201installsitescript=''
1202sitescript=''
1203sitescriptexp=''
1204sizesize=''
1205sizetype=''
1206d_libname_unique=''
1207so=''
1208socksizetype=''
1209sharpbang=''
1210shsharp=''
1211spitshell=''
1212src=''
1213ssizetype=''
1214st_ino_sign=''
1215st_ino_size=''
1216startperl=''
1217startsh=''
1218stdchar=''
1219d_stdio_stream_array=''
1220stdio_stream_array=''
1221sysman=''
1222sGMTIME_max=''
1223sGMTIME_min=''
1224sLOCALTIME_max=''
1225sLOCALTIME_min=''
1226trnl=''
1227uidformat=''
1228uidsign=''
1229uidsize=''
1230uidtype=''
1231archname64=''
1232use64bitall=''
1233use64bitint=''
1234dtrace=''
1235usedtrace=''
1236usefaststdio=''
1237usekernprocpathname=''
1238ccflags_uselargefiles=''
1239ldflags_uselargefiles=''
1240libswanted_uselargefiles=''
1241uselargefiles=''
1242uselongdouble=''
1243usemorebits=''
1244usemultiplicity=''
1245nm_opt=''
1246nm_so_opt=''
1247runnm=''
1248usenm=''
1249usensgetexecutablepath=''
1250useperlio=''
1251usesocks=''
1252d_oldpthreads=''
1253use5005threads=''
1254useithreads=''
1255usereentrant=''
1256usethreads=''
1257incpath=''
1258mips_type=''
1259usrinc=''
1260vaproto=''
1261d_vendorarch=''
1262installvendorarch=''
1263vendorarch=''
1264vendorarchexp=''
1265d_vendorbin=''
1266installvendorbin=''
1267vendorbin=''
1268vendorbinexp=''
1269installvendorhtml1dir=''
1270vendorhtml1dir=''
1271vendorhtml1direxp=''
1272installvendorhtml3dir=''
1273vendorhtml3dir=''
1274vendorhtml3direxp=''
1275d_vendorlib=''
1276installvendorlib=''
1277vendorlib=''
1278vendorlib_stem=''
1279vendorlibexp=''
1280installvendorman1dir=''
1281vendorman1dir=''
1282vendorman1direxp=''
1283installvendorman3dir=''
1284vendorman3dir=''
1285vendorman3direxp=''
1286usevendorprefix=''
1287vendorprefix=''
1288vendorprefixexp=''
1289d_vendorscript=''
1290installvendorscript=''
1291vendorscript=''
1292vendorscriptexp=''
1293versiononly=''
1294yacc=''
1295yaccflags=''
1296CONFIG=''
1297
1298: Detect odd OSs
1299define='define'
1300undef='undef'
1301smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1302rmlist=''
1303
1304: We must find out about Eunice early
1305eunicefix=':'
1306if test -f /etc/unixtovms; then
1307 eunicefix=/etc/unixtovms
1308fi
1309if test -f /etc/unixtovms.exe; then
1310 eunicefix=/etc/unixtovms.exe
1311fi
1312
1313: Set executable suffix now -- needed before hints available
1314if test -f "/libs/version.library"; then
1315: Amiga OS
1316 _exe=""
1317elif test -f "/system/gnu_library/bin/ar.pm"; then
1318: Stratus VOS
1319 _exe=".pm"
1320elif test -n "$DJGPP"; then
1321: DOS DJGPP
1322 _exe=".exe"
1323elif test -f /kern/cookiejar; then
1324: MiNT
1325 _exe=""
1326elif test -d c:/. -o -n "$is_os2" ; then
1327: OS/2 or cygwin
1328 _exe=".exe"
1329fi
1330
1331groupstype=''
1332i_whoami=''
1333: Trailing extension. Override this in a hint file, if needed.
1334: Extra object files, if any, needed on this platform.
1335archobjs=''
1336archname=''
1337: Possible local include directories to search.
1338: Set locincpth to "" in a hint file to defeat local include searches.
1339locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1340locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1341:
1342: no include file wanted by default
1343inclwanted=''
1344
1345: Enable -DEBUGGING and -DDEBUGGING from the command line
1346EBUGGING=''
1347DEBUGGING=''
1348
1349libnames=''
1350: change the next line if compiling for Xenix/286 on Xenix/386
1351xlibpth='/usr/lib/386 /lib/386'
1352: Possible local library directories to search.
1353loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1354loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1355
1356: general looking path for locating libraries
1357glibpth="/lib /usr/lib $xlibpth"
1358glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1359test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1360test -f /shlib/libc.so && glibpth="/shlib $glibpth"
1361test -d /usr/lib64 && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1362
1363: Private path used by Configure to find libraries. Its value
1364: is prepended to libpth. This variable takes care of special
1365: machines, like the mips. Usually, it should be empty.
1366plibpth=''
1367
1368: default library list
1369libswanted=''
1370: some systems want to use only the non-versioned libso:s
1371ignore_versioned_solibs=''
1372: set usethreads on the Configure command line to enable threads.
1373usereentrant='undef'
1374ccname=''
1375ccversion=''
1376perllibs=''
1377: set useposix=false in your hint file to disable the POSIX extension.
1378useposix=true
1379: set useopcode=false in your hint file to disable the Opcode extension.
1380useopcode=true
1381archname64=''
1382ccflags_uselargefiles=''
1383ldflags_uselargefiles=''
1384libswanted_uselargefiles=''
1385: set usemultiplicity on the Configure command line to enable multiplicity.
1386: set usesocks on the Configure command line to enable socks.
1387: List of libraries we want.
1388: If anyone needs extra -lxxx, put those in a hint file.
1389libswanted="socket bind inet nsl nm ndbm gdbm dbm db malloc dl ld sun"
1390libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1391: We probably want to search /usr/shlib before most other libraries.
1392: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1393glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1394glibpth="/usr/shlib $glibpth"
1395: Do not use vfork unless overridden by a hint file.
1396usevfork=false
1397
1398: Find the basic shell for Bourne shell scripts
1399case "$sh" in
1400'')
1401 case "$SYSTYPE" in
1402 *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1403 *) xxx='/bin/sh';;
1404 esac
1405 if test -f "$xxx"; then
1406 sh="$xxx"
1407 else
1408 : Build up a list and do a single loop so we can 'break' out.
1409 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1410 for xxx in sh bash ksh pdksh ash; do
1411 for p in $pth; do
1412 try="$try ${p}/${xxx}"
1413 done
1414 done
1415 for xxx in $try; do
1416 if test -f "$xxx"; then
1417 sh="$xxx";
1418 break
1419 elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1420 sh="$xxx";
1421 break
1422 elif test -f "$xxx.exe"; then
1423 sh="$xxx";
1424 break
1425 fi
1426 done
1427 fi
1428 ;;
1429esac
1430
1431case "$sh" in
1432'') cat >&2 <<EOM
1433$me: Fatal Error: I can't find a Bourne Shell anywhere.
1434
1435Usually it's in /bin/sh. How did you even get this far?
1436Please contact me (Perl Maintainers) at perlbug@perl.org and
1437we'll try to straighten this all out.
1438EOM
1439 exit 1
1440 ;;
1441esac
1442
1443: When cross-compiling we need to separate the sh-to-run-Configure-with from the sh-to-use-in-Perl
1444: default both to the same thing, cross-compilers can then set targetsh differently if they like
1445targetsh=$sh
1446
1447: see if sh knows # comments
1448if `$sh -c '#' >/dev/null 2>&1`; then
1449 shsharp=true
1450 spitshell=cat
1451 xcat=/bin/cat
1452 test -f $xcat$_exe || xcat=/usr/bin/cat
1453 if test ! -f $xcat$_exe; then
1454 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1455 if test -f $p/cat$_exe; then
1456 xcat=$p/cat
1457 break
1458 fi
1459 done
1460 if test ! -f $xcat$_exe; then
1461 echo "Can't find cat anywhere!"
1462 exit 1
1463 fi
1464 fi
1465 echo "#!$xcat" >sharp
1466 $eunicefix sharp
1467 chmod +x sharp
1468 ./sharp > today 2>/dev/null
1469 if test -s today; then
1470 sharpbang='#!'
1471 else
1472 echo "#! $xcat" > sharp
1473 $eunicefix sharp
1474 chmod +x sharp
1475 ./sharp > today 2>/dev/null
1476 if test -s today; then
1477 sharpbang='#! '
1478 else
1479 sharpbang=': use '
1480 fi
1481 fi
1482else
1483 echo " "
1484 echo "Your $sh doesn't grok # comments--I will strip them later on."
1485 shsharp=false
1486 cd ..
1487 echo "exec grep -v '^[ ]*#'" >spitshell
1488 chmod +x spitshell
1489 $eunicefix spitshell
1490 spitshell=`pwd`/spitshell
1491 cd UU
1492 echo "I presume that if # doesn't work, #! won't work either!"
1493 sharpbang=': use '
1494fi
1495rm -f sharp today
1496
1497: figure out how to guarantee sh startup
1498case "$startsh" in
1499'') startsh=${sharpbang}${sh} ;;
1500*)
1501esac
1502cat >sharp <<EOSS
1503$startsh
1504set abc
1505test "$?abc" != 1
1506EOSS
1507
1508chmod +x sharp
1509$eunicefix sharp
1510if ./sharp; then
1511 : echo "Yup, it does."
1512else
1513 echo "Hmm... '$startsh' does not guarantee sh startup..."
1514 echo "You may have to fix up the shell scripts to make sure $sh runs them."
1515fi
1516rm -f sharp
1517
1518: Save command line options in file UU/cmdline.opt for later use in
1519: generating config.sh.
1520cat > cmdline.opt <<EOSH
1521: Configure command line arguments.
1522config_arg0='$0'
1523config_args='$*'
1524config_argc=$#
1525EOSH
1526argn=1
1527args_exp=''
1528args_sep=''
1529for arg in "$@"; do
1530 cat >>cmdline.opt <<EOSH
1531config_arg$argn='$arg'
1532EOSH
1533 cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1534$arg
1535EOC
1536 arg_exp=`cat cmdl.opt`
1537 args_exp="$args_exp$args_sep'$arg_exp'"
1538 argn=`expr $argn + 1`
1539 args_sep=' '
1540done
1541rm -f cmdl.opt
1542
1543: produce awk script to parse command line options
1544cat >options.awk <<'EOF'
1545BEGIN {
1546 optstr = "A:dD:eEf:hKOrsSU:V"; # getopt-style specification
1547
1548 len = length(optstr);
1549 for (i = 1; i <= len; i++) {
1550 c = substr(optstr, i, 1);
1551 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1552 if (a == ":") {
1553 arg[c] = 1;
1554 i++;
1555 }
1556 opt[c] = 1;
1557 }
1558}
1559{
1560 expect = 0;
1561 str = $0;
1562 if (substr(str, 1, 1) != "-") {
1563 printf("'%s'\n", str);
1564 next;
1565 }
1566 len = length($0);
1567 for (i = 2; i <= len; i++) {
1568 c = substr(str, i, 1);
1569 if (!opt[c]) {
1570 printf("-%s\n", substr(str, i));
1571 next;
1572 }
1573 printf("-%s\n", c);
1574 if (arg[c]) {
1575 if (i < len)
1576 printf("'%s'\n", substr(str, i + 1));
1577 else
1578 expect = 1;
1579 next;
1580 }
1581 }
1582}
1583END {
1584 if (expect)
1585 print "?";
1586}
1587EOF
1588
1589: process the command line options
1590set X `for arg in "$@"; do echo "X$arg"; done |
1591 sed -e s/X// | awk -f options.awk`
1592eval "set $*"
1593shift
1594rm -f options.awk
1595
1596: set up default values
1597fastread=''
1598reuseval=false
1599config_sh=''
1600alldone=''
1601error=''
1602silent=''
1603extractsh=''
1604override=''
1605knowitall=''
1606rm -f optdef.sh posthint.sh
1607cat >optdef.sh <<EOS
1608$startsh
1609EOS
1610
1611
1612: option parsing
1613while test $# -gt 0; do
1614 case "$1" in
1615 -d) shift; fastread=yes;;
1616 -e) shift; alldone=cont;;
1617 -f)
1618 shift
1619 cd ..
1620 if test -r "$1"; then
1621 config_sh="$1"
1622 else
1623 echo "$me: cannot read config file $1." >&2
1624 error=true
1625 fi
1626 cd UU
1627 shift;;
1628 --help|\
1629 -h) shift; error=true;;
1630 -r) shift; reuseval=true;;
1631 -s) shift; silent=true; realsilent=true;;
1632 -E) shift; alldone=exit;;
1633 -K) shift; knowitall=true;;
1634 -O) shift; override=true;;
1635 -S) shift; silent=true; extractsh=true;;
1636 -D)
1637 shift
1638 case "$1" in
1639 *=)
1640 echo "$me: use '-U symbol=', not '-D symbol='." >&2
1641 echo "$me: ignoring -D $1" >&2
1642 ;;
1643 *=*) echo "$1" | \
1644 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1645 *) echo "$1='define'" >> optdef.sh;;
1646 esac
1647 shift
1648 ;;
1649 -U)
1650 shift
1651 case "$1" in
1652 *=) echo "$1" >> optdef.sh;;
1653 *=*)
1654 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1655 echo "$me: ignoring -U $1" >&2
1656 ;;
1657 *) echo "$1='undef'" >> optdef.sh;;
1658 esac
1659 shift
1660 ;;
1661 -A)
1662 shift
1663 xxx=''
1664 yyy="$1"
1665 zzz=''
1666 uuu=undef
1667 case "$yyy" in
1668 *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1669 case "$zzz" in
1670 *:*) zzz='' ;;
1671 *) xxx=append
1672 zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1673 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1674 esac
1675 ;;
1676 esac
1677 case "$xxx" in
1678 '') case "$yyy" in
1679 *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1680 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1681 zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1682 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1683 *) xxx=`echo "$yyy"|sed 's!:.*!!'`
1684 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1685 esac
1686 ;;
1687 esac
1688 case "$xxx" in
1689 append)
1690 echo "$yyy=\"\${$yyy}$zzz\"" >> posthint.sh ;;
1691 clear)
1692 echo "$yyy=''" >> posthint.sh ;;
1693 define)
1694 case "$zzz" in
1695 '') zzz=define ;;
1696 esac
1697 echo "$yyy='$zzz'" >> posthint.sh ;;
1698 eval)
1699 echo "eval \"$yyy=$zzz\"" >> posthint.sh ;;
1700 prepend)
1701 echo "$yyy=\"$zzz\${$yyy}\"" >> posthint.sh ;;
1702 undef)
1703 case "$zzz" in
1704 '') zzz="$uuu" ;;
1705 esac
1706 echo "$yyy=$zzz" >> posthint.sh ;;
1707 *) echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1708 esac
1709 shift
1710 ;;
1711 -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1712 exit 0;;
1713 --) break;;
1714 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1715 *) break;;
1716 esac
1717done
1718
1719case "$error" in
1720true)
1721 cat >&2 <<EOM
1722Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1723 [-U symbol] [-U symbol=] [-A command:symbol...]
1724 -d : use defaults for all answers.
1725 -e : go on without questioning past the production of config.sh.
1726 -f : specify an alternate default configuration file.
1727 -h : print this help message and exit (with an error status).
1728 -r : reuse C symbols value if possible (skips costly nm extraction).
1729 -s : silent mode, only echoes questions and essential information.
1730 -D : define symbol to have some value:
1731 -D symbol symbol gets the value 'define'
1732 -D symbol=value symbol gets the value 'value'
1733 common used examples (see INSTALL for more info):
1734 -Duse64bitint use 64bit integers
1735 -Duse64bitall use 64bit integers and pointers
1736 -Dusethreads use thread support
1737 -Dinc_version_list=none do not include older perl trees in @INC
1738 -DEBUGGING=none DEBUGGING options
1739 -Dcc=gcc choose your compiler
1740 -Dprefix=/opt/perl5 choose your destination
1741 -E : stop at the end of questions, after having produced config.sh.
1742 -K : do not use unless you know what you are doing.
1743 -O : let -D and -U override definitions from loaded configuration file.
1744 -S : perform variable substitutions on all .SH files (can mix with -f)
1745 -U : undefine symbol:
1746 -U symbol symbol gets the value 'undef'
1747 -U symbol= symbol gets completely empty
1748 e.g.: -Uversiononly
1749 -A : manipulate symbol after the platform specific hints have been applied:
1750 -A append:symbol=value append value to symbol
1751 -A symbol=value like append:, but with a separating space
1752 -A define:symbol=value define symbol to have value
1753 -A clear:symbol define symbol to be ''
1754 -A define:symbol define symbol to be 'define'
1755 -A eval:symbol=value define symbol to be eval of value
1756 -A prepend:symbol=value prepend value to symbol
1757 -A undef:symbol define symbol to be 'undef'
1758 -A undef:symbol= define symbol to be ''
1759 e.g.: -A prepend:libswanted='cl pthread '
1760 -A ccflags=-DSOME_MACRO
1761 -V : print version number and exit (with a zero status).
1762EOM
1763 exit 1
1764 ;;
1765esac
1766
1767: Sanity checks
1768case "$fastread$alldone" in
1769yescont|yesexit) ;;
1770*)
1771 case "$extractsh" in
1772 true) ;;
1773 *)
1774 if test ! -t 0; then
1775 echo "Say 'sh Configure', not 'sh <Configure'"
1776 exit 1
1777 fi
1778 ;;
1779 esac
1780 ;;
1781esac
1782
1783exec 4>&1
1784case "$silent" in
1785true) exec 1>/dev/null;;
1786esac
1787
1788: run the defines and the undefines, if any, but leave the file out there...
1789touch optdef.sh
1790. ./optdef.sh
1791: create the posthint manipulation script and leave the file out there...
1792touch posthint.sh
1793
1794: set package name
1795package='perl5'
1796first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1797last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1798case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1799ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1800*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1801esac
1802
1803: Some greps do not return status, grrr.
1804echo "grimblepritz" >grimble
1805if grep blurfldyick grimble >/dev/null 2>&1 ; then
1806 contains=contains
1807elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1808 contains=grep
1809else
1810 contains=contains
1811fi
1812rm -f grimble
1813: the following should work in any shell
1814case "$contains" in
1815contains*)
1816 echo " "
1817 echo "AGH! Grep doesn't return a status. Attempting remedial action."
1818 cat >contains <<'EOSS'
1819grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1820EOSS
1821chmod +x contains
1822esac
1823
1824: Find the path to the source tree
1825case "$src" in
1826'') case "$0" in
1827 */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1828 case "$src" in
1829 /*) ;;
1830 .) ;;
1831 *) src=`cd ../$src && pwd` ;;
1832 esac
1833 ;;
1834 *) src='.';;
1835 esac;;
1836esac
1837case "$src" in
1838'') src=/
1839 rsrc=/
1840 ;;
1841/*) rsrc="$src";;
1842*) rsrc="../$src";;
1843esac
1844if test -f $rsrc/Configure && \
1845 $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1846then
1847 : found it, so we are ok.
1848else
1849 rsrc=''
1850 for src in . .. ../.. ../../.. ../../../..; do
1851 if test -f ../$src/Configure && \
1852 $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1853 then
1854 rsrc=../$src
1855 break
1856 fi
1857 done
1858fi
1859case "$rsrc" in
1860'')
1861 cat <<EOM >&4
1862
1863Sorry, I can't seem to locate the source dir for $package. Please start
1864Configure with an explicit path -- i.e. /some/path/Configure.
1865
1866EOM
1867 exit 1
1868 ;;
1869../.) rsrc='..';;
1870*)
1871 echo " "
1872 echo "Sources for $package found in \"$src\"." >&4
1873 ;;
1874esac
1875
1876: script used to extract .SH files with variable substitutions
1877cat >extract <<'EOS'
1878PERL_CONFIG_SH=true
1879echo "Doing variable substitutions on .SH files..."
1880if test -f MANIFEST; then
1881 set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1882else
1883 echo "(Looking for .SH files under the source directory.)"
1884 set x `(cd "$src"; find . -name "*.SH" -print)`
1885fi
1886shift
1887case $# in
18880) set x `(cd "$src"; echo *.SH)`; shift;;
1889esac
1890if test ! -f "$src/$1"; then
1891 shift
1892fi
1893mkdir_p='
1894name=$1;
1895create="";
1896while test $name; do
1897 if test ! -d "$name"; then
1898 create="$name $create";
1899 name=`echo $name | sed -e "s|^[^/]*$||"`;
1900 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1901 else
1902 name="";
1903 fi;
1904done;
1905for file in $create; do
1906 mkdir $file;
1907done
1908'
1909for file in $*; do
1910 case "$src" in
1911 ".")
1912 case "$file" in
1913 */*)
1914 dir=`expr X$file : 'X\(.*\)/'`
1915 file=`expr X$file : 'X.*/\(.*\)'`
1916 (cd "$dir" && . ./$file)
1917 ;;
1918 *)
1919 . ./$file
1920 ;;
1921 esac
1922 ;;
1923 *)
1924 case "$file" in
1925 */*)
1926 dir=`expr X$file : 'X\(.*\)/'`
1927 file=`expr X$file : 'X.*/\(.*\)'`
1928 (set x $dir; shift; eval $mkdir_p)
1929 sh <"$src/$dir/$file"
1930 ;;
1931 *)
1932 sh <"$src/$file"
1933 ;;
1934 esac
1935 ;;
1936 esac
1937done
1938if test -f "$src/config_h.SH"; then
1939 if test ! -f config.h; then
1940 : oops, they left it out of MANIFEST, probably, so do it anyway.
1941 . "$src/config_h.SH"
1942 fi
1943fi
1944EOS
1945
1946: extract files and exit if asked to do so
1947case "$extractsh" in
1948true)
1949 case "$realsilent" in
1950 true) ;;
1951 *) exec 1>&4;;
1952 esac
1953 case "$config_sh" in
1954 '') config_sh='config.sh';;
1955 esac
1956 echo " "
1957 echo "Fetching answers from $config_sh..."
1958 cd ..
1959 . $config_sh
1960 test "$override" && . ./optdef.sh
1961 echo " "
1962 . UU/extract
1963 rm -rf UU
1964 echo "Extraction done."
1965 exit 0
1966 ;;
1967esac
1968
1969: Eunice requires " " instead of "", can you believe it
1970echo " "
1971: Here we go...
1972echo "Beginning of configuration questions for $package."
1973
1974trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1975
1976: first determine how to suppress newline on echo command
1977echo " "
1978echo "Checking echo to see how to suppress newlines..."
1979(echo "hi there\c" ; echo " ") >.echotmp
1980if $contains c .echotmp >/dev/null 2>&1 ; then
1981 echo "...using -n."
1982 n='-n'
1983 c=''
1984else
1985 cat <<'EOM'
1986...using \c
1987EOM
1988 n=''
1989 c='\c'
1990fi
1991echo $n "The star should be here-->$c"
1992echo '*'
1993rm -f .echotmp
1994
1995: Now test for existence of everything in MANIFEST
1996echo " "
1997if test -f "$rsrc/MANIFEST"; then
1998 echo "First let's make sure your kit is complete. Checking..." >&4
1999 awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
2000 (split -l 50 2>/dev/null || split -50)
2001 rm -f missing
2002 tmppwd=`pwd`
2003 for filelist in x??; do
2004 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
2005 >/dev/null 2>>"$tmppwd/missing")
2006 done
2007 if test -s missing; then
2008 cat missing >&4
2009 cat >&4 <<'EOM'
2010
2011THIS PACKAGE SEEMS TO BE INCOMPLETE.
2012
2013You have the option of continuing the configuration process, despite the
2014distinct possibility that your kit is damaged, by typing 'y'es. If you
2015do, don't blame me if something goes wrong. I advise you to type 'n'o
2016and contact the author (perlbug@perl.org).
2017
2018EOM
2019 echo $n "Continue? [n] $c" >&4
2020 read ans
2021 case "$ans" in
2022 y*)
2023 echo "Continuing..." >&4
2024 rm -f missing
2025 ;;
2026 *)
2027 echo "ABORTING..." >&4
2028 kill $$
2029 ;;
2030 esac
2031 else
2032 echo "Looks good..."
2033 fi
2034else
2035 echo "There is no MANIFEST file. I hope your kit is complete !"
2036fi
2037rm -f missing x??
2038
2039: Find the appropriate value for a newline for tr
2040echo " "
2041if test -n "$DJGPP"; then
2042 trnl='\012'
2043fi
2044if test X"$trnl" = X; then
2045 case "`echo foo|tr '\n' x 2>/dev/null`" in
2046 foox) trnl='\n' ;;
2047 esac
2048fi
2049if test X"$trnl" = X; then
2050 case "`echo foo|tr '\012' x 2>/dev/null`" in
2051 foox) trnl='\012' ;;
2052 esac
2053fi
2054if test X"$trnl" = X; then
2055 case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2056 fooxy) trnl='\n\r' ;;
2057 esac
2058fi
2059if test X"$trnl" = X; then
2060 cat <<EOM >&2
2061
2062$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2063
2064EOM
2065 exit 1
2066fi
2067
2068: compute the number of columns on the terminal for proper question formatting
2069case "$COLUMNS" in
2070'') COLUMNS='80';;
2071esac
2072
2073: set up the echo used in my read
2074myecho="case \"\$xxxm\" in
2075'') echo $n \"\$rp $c\" >&4;;
2076*) case \"\$rp\" in
2077 '') echo $n \"[\$xxxm] $c\";;
2078 *)
2079 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
2080 echo \"\$rp\" >&4
2081 echo $n \"[\$xxxm] $c\" >&4
2082 else
2083 echo $n \"\$rp [\$xxxm] $c\" >&4
2084 fi
2085 ;;
2086 esac;;
2087esac"
2088
2089: now set up to do reads with possible shell escape and default assignment
2090cat <<EOSC >myread
2091$startsh
2092xxxm=\$dflt
2093$myecho
2094ans='!'
2095case "\$fastread" in
2096yes) case "\$dflt" in
2097 '') ;;
2098 *) ans='';
2099 case "\$silent-\$rp" in
2100 true-) ;;
2101 *) echo " " >&4;;
2102 esac;;
2103 esac;;
2104*) case "\$silent" in
2105 true) case "\$rp" in
2106 '') ans='';;
2107 esac;;
2108 esac;;
2109esac
2110while expr "X\$ans" : "X!" >/dev/null; do
2111 read answ
2112 set x \$xxxm
2113 shift
2114 aok=''; eval "ans=\\"\$answ\\"" && aok=y
2115 case "\$answ" in
2116 "!")
2117 sh 1>&4
2118 echo " "
2119 $myecho
2120 ;;
2121 !*)
2122 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2123 shift
2124 sh 1>&4 -c "\$*"
2125 echo " "
2126 $myecho
2127 ;;
2128 "\$ans")
2129 case "\$ans" in
2130 \\&*)
2131 set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2132 shift
2133 case "\$1" in
2134 -d)
2135 fastread=yes
2136 echo "(OK, I'll run with -d after this question.)" >&4
2137 ;;
2138 -*)
2139 echo "*** Sorry, \$1 not supported yet." >&4
2140 ;;
2141 esac
2142 $myecho
2143 ans=!
2144 ;;
2145 esac;;
2146 *)
2147 case "\$aok" in
2148 y)
2149 echo "*** Substitution done -- please confirm."
2150 xxxm="\$ans"
2151 ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2152 xxxm="\$ans"
2153 ans=!
2154 ;;
2155 *)
2156 echo "*** Error -- try again."
2157 ans=!
2158 ;;
2159 esac
2160 $myecho
2161 ;;
2162 esac
2163 case "\$ans\$xxxm\$nostick" in
2164 '')
2165 ans=!
2166 $myecho
2167 ;;
2168 esac
2169done
2170case "\$ans" in
2171'') ans="\$xxxm";;
2172esac
2173EOSC
2174
2175: create .config dir to save info across Configure sessions
2176test -d ../.config || mkdir ../.config
2177cat >../.config/README <<EOF
2178This directory created by Configure to save information that should
2179persist across sessions for $package.
2180
2181You may safely delete it if you wish.
2182EOF
2183
2184: See if we are using a devel version and want that
2185xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2186case "$usedevel" in
2187$define|true|[yY]*)
2188 usedevel="$define" ;;
2189*) case "$xversion" in
2190 *[13579])
2191 cat >&4 <<EOH
2192*** WHOA THERE!!! ***
2193
2194 This is an UNSTABLE DEVELOPMENT release.
2195 The version of this $package distribution is $xversion, that is, odd,
2196 (as opposed to even) and that signifies a development release.
2197 If you want a maintenance release, you want an even-numbered version.
2198
2199 Do ***NOT*** install this into production use.
2200 Data corruption and crashes are possible.
2201
2202 It is most seriously suggested that you do not continue any further
2203 unless you want to help in developing and debugging Perl.
2204
2205 If you *still* want to build perl, you can answer 'y' now,
2206 or pass -Dusedevel to Configure.
2207
2208EOH
2209 rp='Do you really want to continue?'
2210 dflt='n'
2211 . ./myread
2212 case "$ans" in
2213 [yY]) echo >&4 "Okay, continuing."
2214 usedevel="$define" ;;
2215 *) echo >&4 "Okay, bye."
2216 exit 1
2217 ;;
2218 esac
2219 ;;
2220 esac
2221 usedevel="$undef"
2222 ;;
2223esac
2224case "$usedevel" in
2225$define|true|[yY]*)
2226 case "$versiononly" in
2227 '') versiononly="$define" ;;
2228 esac
2229 case "$installusrbinperl" in
2230 '') installusrbinperl="$undef" ;;
2231 esac
2232 ;;
2233esac
2234
2235: general instructions
2236needman=true
2237firsttime=true
2238user=`(logname) 2>/dev/null`
2239case "$user" in
2240'') user=`whoami 2>&1`;;
2241esac
2242if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2243 firsttime=false
2244 echo " "
2245 rp='Would you like to see the instructions?'
2246 dflt=n
2247 . ./myread
2248 case "$ans" in
2249 [yY]*) ;;
2250 *) needman=false;;
2251 esac
2252fi
2253if $needman; then
2254 cat <<EOH
2255
2256This installation shell script will examine your system and ask you questions
2257to determine how the perl5 package should be installed. If you get
2258stuck on a question, you may use a ! shell escape to start a subshell or
2259execute a command. Many of the questions will have default answers in square
2260brackets; typing carriage return will give you the default.
2261
2262On some of the questions which ask for file or directory names you are allowed
2263to use the ~name construct to specify the login directory belonging to "name",
2264even if you don't have a shell which knows about that. Questions where this is
2265allowed will be marked "(~name ok)".
2266
2267EOH
2268 rp=''
2269 dflt='Type carriage return to continue'
2270 . ./myread
2271 cat <<'EOH'
2272
2273The prompter used in this script allows you to use shell variables and
2274backticks in your answers. You may use $1, $2, etc... to refer to the words
2275in the default answer, as if the default line was a set of arguments given to a
2276script shell. This means you may also use $* to repeat the whole default line,
2277so you do not have to re-type everything to add something to the default.
2278
2279Every time there is a substitution, you will have to confirm. If there is an
2280error (e.g. an unmatched backtick), the default answer will remain unchanged
2281and you will be prompted again.
2282
2283If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
2284the questions and use the computed defaults (or the previous answers if there
2285was already a config.sh file). Type 'Configure -h' for a list of options.
2286You may also start interactively and then answer '& -d' at any prompt to turn
2287on the non-interactive behaviour for the remainder of the execution.
2288
2289EOH
2290 . ./myread
2291 cat <<EOH
2292
2293Much effort has been expended to ensure that this shell script will run on any
2294Unix system. If despite that it blows up on yours, your best bet is to edit
2295Configure and run it again. If you can't run Configure for some reason,
2296you'll have to generate a config.sh file by hand. Whatever problems you
2297have, let me (perlbug@perl.org) know how I blew it.
2298
2299This installation script affects things in two ways:
2300
23011) it may do direct variable substitutions on some of the files included
2302 in this kit.
23032) it builds a config.h file for inclusion in C programs. You may edit
2304 any of these files as the need arises after running this script.
2305
2306If you make a mistake on a question, there is no easy way to back up to it
2307currently. The easiest thing to do is to edit config.sh and rerun all the SH
2308files. Configure will offer to let you do this before it runs the SH files.
2309
2310EOH
2311 dflt='Type carriage return to continue'
2312 . ./myread
2313 case "$firsttime" in
2314 true) echo $user >>../.config/instruct;;
2315 esac
2316fi
2317
2318: Set 'sysroot' to change the logical root directory to your headers and libraries see man gcc
2319: This is primarily meant for cross-compile environments, and may fail to be useful in other cases
2320if test "X$sysroot" = X; then
2321 sysroot=""
2322else
2323 case "$cc" in
2324 *gcc*|*g++*)
2325 echo "Using $sysroot to find your headers and libraries, adding to ccflags"
2326 # _sysroot is used in places where we need --sysroot=foo
2327 # but using the rest of the flags could cause issues.
2328 _sysroot="--sysroot=$sysroot";
2329 case "$ccflags" in
2330 *sysroot*) ;;
2331 'undef'|*)
2332 ccflags="$ccflags $_sysroot"
2333 esac
2334 case "$ldflags" in
2335 *sysroot*) ;;
2336 'undef'|*)
2337 ldflags="$ldflags $_sysroot"
2338 esac
2339 case "$cppflags" in
2340 *sysroot*) ;;
2341 'undef'|*)
2342 cppflags="$cppflags $_sysroot"
2343 esac
2344 # lddlflags updated below in lddlflags section;
2345 # same with cccdlflags
2346 ;;
2347 esac
2348
2349 # Adjust some defaults to also use $sysroot
2350 for var in xlibpth loclibpth locincpth glibpth; do
2351 eval xxx=\$$var
2352 eval $var=''
2353 for path in $xxx; do
2354 eval $var=\"\$$var $sysroot$path\"
2355 done
2356 done
2357
2358fi
2359
2360: find out where common programs are
2361echo " "
2362echo "Locating common programs..." >&4
2363cat <<EOSC >loc
2364$startsh
2365case \$# in
23660) exit 1;;
2367esac
2368thing=\$1
2369shift
2370dflt=\$1
2371shift
2372for dir in \$*; do
2373 case "\$thing" in
2374 .)
2375 if test -d \$dir/\$thing; then
2376 echo \$dir
2377 exit 0
2378 fi
2379 ;;
2380 *)
2381 for thisthing in \$dir/\$thing; do
2382 : just loop through to pick last item
2383 done
2384 if test -f \$thisthing; then
2385 echo \$thisthing
2386 exit 0
2387 elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2388 echo \$thisthing
2389 exit 0
2390 elif test -f \$dir/\$thing.exe; then
2391 if test -n "$DJGPP"; then
2392 echo \$dir/\$thing.exe
2393 elif test "$eunicefix" != ":"; then
2394 : on Eunice apparently
2395 echo \$dir/\$thing
2396 fi
2397 exit 0
2398 fi
2399 ;;
2400 esac
2401done
2402echo \$dflt
2403exit 1
2404EOSC
2405chmod +x loc
2406$eunicefix loc
2407loclist="
2408awk
2409cat
2410chmod
2411comm
2412cp
2413echo
2414expr
2415grep
2416ls
2417mkdir
2418rm
2419sed
2420sort
2421touch
2422tr
2423uniq
2424"
2425trylist="
2426ar
2427bison
2428byacc
2429cpp
2430csh
2431date
2432egrep
2433gmake
2434gzip
2435less
2436ln
2437make
2438more
2439nm
2440nroff
2441perl
2442pg
2443test
2444uname
2445zip
2446"
2447pth=`echo $PATH | sed -e "s/$p_/ /g"`
2448pth="$pth $sysroot/lib $sysroot/usr/lib"
2449for file in $loclist; do
2450 eval xxx=\$$file
2451 case "$xxx" in
2452 /*|?:[\\/]*)
2453 if test -f "$xxx"; then
2454 : ok
2455 else
2456 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2457 xxx=`./loc $file $file $pth`
2458 fi
2459 ;;
2460 '') xxx=`./loc $file $file $pth`;;
2461 *) xxx=`./loc $xxx $xxx $pth`;;
2462 esac
2463 eval $file=$xxx$_exe
2464 eval _$file=$xxx
2465 case "$xxx" in
2466 /*)
2467 echo $file is in $xxx.
2468 ;;
2469 ?:[\\/]*)
2470 echo $file is in $xxx.
2471 ;;
2472 *)
2473 echo "I don't know where '$file' is, and my life depends on it." >&4
2474 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2475 exit 1
2476 ;;
2477 esac
2478done
2479echo " "
2480echo "Don't worry if any of the following aren't found..."
2481say=offhand
2482for file in $trylist; do
2483 eval xxx=\$$file
2484 case "$xxx" in
2485 /*|?:[\\/]*)
2486 if test -f "$xxx"; then
2487 : ok
2488 else
2489 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2490 xxx=`./loc $file $file $pth`
2491 fi
2492 ;;
2493 '') xxx=`./loc $file $file $pth`;;
2494 *) xxx=`./loc $xxx $xxx $pth`;;
2495 esac
2496 eval $file=$xxx$_exe
2497 eval _$file=$xxx
2498 case "$xxx" in
2499 /*)
2500 echo $file is in $xxx.
2501 ;;
2502 ?:[\\/]*)
2503 echo $file is in $xxx.
2504 ;;
2505 *)
2506 echo "I don't see $file out there, $say."
2507 say=either
2508 ;;
2509 esac
2510done
2511case "$egrep" in
2512egrep)
2513 echo "Substituting grep for egrep."
2514 egrep=$grep
2515 _egrep=$grep
2516 ;;
2517esac
2518case "$less" in
2519'') ;;
2520*) if $less -R </dev/null >/dev/null; then
2521 echo "Substituting less -R for less."
2522 less="$less -R"
2523 _less=$less
2524 fi
2525 ;;
2526esac
2527case "$ln" in
2528ln)
2529 echo "Substituting cp for ln."
2530 ln=$cp
2531 _ln=$cp
2532 ;;
2533esac
2534case "$make" in
2535make)
2536 case "$gmake" in
2537 gmake)
2538 echo "I can't find make or gmake, and my life depends on it." >&4
2539 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2540 exit 1
2541 ;;
2542 esac
2543 ;;
2544esac
2545case "$gmake" in
2546gmake) ;;
2547*) # We can't have osname yet.
2548 if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2549 # Assume that gmake, if found, is definitely GNU make
2550 # and prefer it over the system make.
2551 echo "Substituting gmake for make."
2552 make=$gmake
2553 _make=$gmake
2554 fi
2555 ;;
2556esac
2557case "$test" in
2558test)
2559 echo "Hopefully test is built into your sh."
2560 ;;
2561*)
2562 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2563 echo "Using the test built into your sh."
2564 test=test
2565 _test=test
2566 fi
2567 ;;
2568esac
2569case "$echo" in
2570echo)
2571 echo "Hopefully echo is built into your sh."
2572 ;;
2573'') ;;
2574*)
2575 echo " "
2576echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2577 $echo $n "hi there$c" >foo1
2578 echo $n "hi there$c" >foo2
2579 if cmp foo1 foo2 >/dev/null 2>&1; then
2580 echo "They are compatible. In fact, they may be identical."
2581 else
2582 case "$n" in
2583 '-n') n='' c='\c';;
2584 *) n='-n' c='';;
2585 esac
2586 cat <<FOO
2587They are not compatible! You are probably running ksh on a non-USG system.
2588I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2589have echo built in and we may have to run some Bourne shell scripts. That
2590means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
2591
2592FOO
2593 $echo $n "The star should be here-->$c"
2594 $echo "*"
2595 fi
2596 $rm -f foo1 foo2
2597 ;;
2598esac
2599
2600# This question was auctioned at YAPC::Europe-2007 in Vienna
2601# I never promised you could answer it. I only auctioned the question.
2602cat <<FOO
2603The following message is sponsored by
2604
2605 Dresden.pm<--The stars should be here.
2606
2607Dear Perl user, system administrator or package
2608maintainer, the Perl community sends greetings to
2609you. Do you (emblematical) greet back [Y/n]? n
2610
2611FOO
2612
2613: Check what type of C compiler we use
2614cat <<EOS >trygcc
2615$startsh
2616EOS
2617cat <<'EOSC' >>trygcc
2618case "$cc" in
2619'') ;;
2620*) $rm -f try try.*
2621 $cat >try.c <<EOM
2622int main(int argc, char *argv[]) {
2623 return 0;
2624}
2625EOM
2626 if $cc -o try $ccflags $ldflags try.c; then
2627 :
2628 else
2629 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2630 despair=yes
2631 trygcc=yes
2632 case "$cc" in
2633 *gcc*) trygcc=no ;;
2634 esac
2635 # Skip this test because it gives a false match on output like:
2636 # ./trygcc: line 23: cc: command not found
2637 # case "`$cc -v -c try.c 2>&1`" in
2638 # *gcc*) trygcc=no ;;
2639 # esac
2640 if $test X"$trygcc" = Xyes; then
2641 if gcc -o try -c try.c; then
2642 echo " "
2643 echo "You seem to have a working gcc, though." >&4
2644 # Switching compilers may undo the work of hints files.
2645 # The most common problem is -D_REENTRANT for threads.
2646 # This heuristic catches that case, but gets false positives
2647 # if -Dusethreads was not actually specified. Better to
2648 # bail out here with a useful message than fail
2649 # mysteriously later. Should we perhaps just try to
2650 # re-invoke Configure -Dcc=gcc config_args ?
2651 if $test -f usethreads.cbu; then
2652 $cat >&4 <<EOM
2653
2654*** However, any setting of the C compiler flags (e.g. for thread support)
2655*** will be lost. It may be necessary for you to restart Configure and
2656*** add -Dcc=gcc to your Configure command line.
2657
2658EOM
2659 rp="Would you like to go ahead and try gcc anyway?"
2660 dflt=n
2661 else
2662 rp="Would you like to use it?"
2663 dflt=y
2664 fi
2665 if $test -f myread; then
2666 . ./myread
2667 else
2668 if $test -f UU/myread; then
2669 . ./UU/myread
2670 else
2671 echo "Cannot find myread, sorry. Aborting." >&2
2672 exit 1
2673 fi
2674 fi
2675 case "$ans" in
2676 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2677 esac
2678 fi
2679 fi
2680 fi
2681 $rm -f try try.*
2682 ;;
2683esac
2684EOSC
2685
2686cat <<EOS >checkcc
2687$startsh
2688EOS
2689cat <<'EOSC' >>checkcc
2690case "$cc" in
2691'') ;;
2692*) $rm -f try try.*
2693 $cat >try.c <<EOM
2694int main(int argc, char *argv[]) {
2695 return 0;
2696}
2697EOM
2698 if $cc -o try $ccflags $ldflags try.c; then
2699 :
2700 else
2701 if $test X"$despair" = Xyes; then
2702 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2703 fi
2704 $cat >&4 <<EOM
2705You need to find a working C compiler.
2706Either (purchase and) install the C compiler supplied by your OS vendor,
2707or for a free C compiler try http://gcc.gnu.org/
2708I cannot continue any further, aborting.
2709EOM
2710 exit 1
2711 fi
2712 $rm -f try try.*
2713 ;;
2714esac
2715EOSC
2716
2717: determine whether symbolic links are supported
2718echo " "
2719$touch blurfl
2720if $ln -s blurfl sym > /dev/null 2>&1 ; then
2721 echo "Symbolic links are supported." >&4
2722 lns="$ln -s"
2723else
2724 echo "Symbolic links are NOT supported." >&4
2725 lns="$ln"
2726fi
2727$rm -f blurfl sym
2728
2729: determine whether symbolic links are supported
2730echo " "
2731case "$lns" in
2732*"ln"*" -s")
2733 echo "Checking how to test for symbolic links..." >&4
2734 $lns blurfl sym
2735 if $test "X$issymlink" = X; then
2736 case "$newsh" in
2737 '') sh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2738 *) $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2739 esac
2740 if test $? = 0; then
2741 issymlink="test -h"
2742 else
2743 echo "Your builtin 'test -h' may be broken." >&4
2744 case "$test" in
2745 /*) ;;
2746 *) pth=`echo $PATH | sed -e "s/$p_/ /g"`
2747 for p in $pth
2748 do
2749 if test -f "$p/$test"; then
2750 test="$p/$test"
2751 break
2752 fi
2753 done
2754 ;;
2755 esac
2756 case "$test" in
2757 /*)
2758 echo "Trying external '$test -h'." >&4
2759 issymlink="$test -h"
2760 if $test ! -h sym >/dev/null 2>&1; then
2761 echo "External '$test -h' is broken, too." >&4
2762 issymlink=''
2763 fi
2764 ;;
2765 *) issymlink='' ;;
2766 esac
2767 fi
2768 fi
2769 if $test "X$issymlink" = X; then
2770 if $test -L sym 2>/dev/null; then
2771 issymlink="$test -L"
2772 echo "The builtin '$test -L' worked." >&4
2773 fi
2774 fi
2775 if $test "X$issymlink" != X; then
2776 echo "You can test for symbolic links with '$issymlink'." >&4
2777 else
2778 echo "I do not know how you can test for symbolic links." >&4
2779 fi
2780 $rm -f blurfl sym
2781 ;;
2782*) echo "No symbolic links, so not testing for their testing..." >&4
2783 ;;
2784esac
2785echo " "
2786
2787: Make symlinks util
2788case "$mksymlinks" in
2789$define|true|[yY]*)
2790 case "$src" in
2791 ''|'.') echo "Cannot create symlinks in the original directory." >&4
2792 exit 1
2793 ;;
2794 *) case "$lns:$issymlink" in
2795 *"ln"*" -s:"*"test -"?)
2796 echo "Creating the symbolic links..." >&4
2797 echo "(First creating the subdirectories...)" >&4
2798 cd ..
2799 awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2800 read directory
2801 test -z "$directory" && break
2802 mkdir -p $directory
2803 done
2804 # Sanity check 1.
2805 if test ! -d t/base; then
2806 echo "Failed to create the subdirectories. Aborting." >&4
2807 exit 1
2808 fi
2809 echo "(Then creating the symlinks...)" >&4
2810 awk '{print $1}' $src/MANIFEST | while true; do
2811 read filename
2812 test -z "$filename" && break
2813 if test -f $filename; then
2814 if $issymlink $filename; then
2815 rm -f $filename
2816 fi
2817 fi
2818 if test -f $filename; then
2819 echo "$filename already exists, not symlinking."
2820 else
2821 ln -s $src/$filename $filename
2822 fi
2823 done
2824 # Sanity check 2.
2825 if test ! -f t/base/lex.t; then
2826 echo "Failed to create the symlinks (t/base/lex.t missing). Aborting." >&4
2827 exit 1
2828 fi
2829 cd UU
2830 ;;
2831 *) echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2832 ;;
2833 esac
2834 ;;
2835 esac
2836 ;;
2837esac
2838
2839: Check for Cross-Compilation
2840if $test "X$targethost" = "X"; then
2841 targethost=""
2842fi
2843case "$usecrosscompile" in
2844$define|true|[yY]*)
2845 $echo "Cross-compiling..."
2846 croak=''
2847 case "$cc" in
2848 *-gcc*|*-g++*) # A cross-compiling gcc, probably.
2849 # arm-linux-androideabi-gcc -> arm-linux-androideabi
2850 # x86_64-w64-mingw32-gcc.exe -> x86_64-w64-mingw32
2851 targetarch=`$echo $cc|$sed 's/-g[c\+][c\+].*$//'`
2852 ar=`$echo $cc|$sed 's/-g[c\+][c\+]/-ar/'`
2853 # leave out ld, choosing it is more complex
2854 nm=`$echo $cc|$sed 's/-g[c\+][c\+]/-nm/'`
2855 ranlib=`$echo $cc|$sed 's/-g[c\+][c\+]/-ranlib/'`
2856 # We are in a weird spot. Just before us, some values
2857 # were 'saved', to be restored after the hints are
2858 # run. This means that the changes we made to ar,
2859 # nm and ranlib will get reverted.
2860 # To avoid that, we hijack the saving mechanism and
2861 # have it save our new values.
2862 for file in ar nm ranlib; do
2863 eval xxx=\$$file
2864 eval $file=$xxx$_exe
2865 eval _$file=$xxx
2866 done
2867 ;;
2868 esac
2869 case "$targetarch" in
2870 '') echo "Targetarch not defined." >&4; croak=y ;;
2871 *) echo "Using targetarch $targetarch." >&4 ;;
2872 esac
2873 case "$targethost" in
2874 '') echo "Targethost not defined." >&4; croak=y ;;
2875 *) echo "Using targethost $targethost." >&4
2876 esac
2877 locincpth=' '
2878 loclibpth=' '
2879 case "$croak" in
2880 y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2881 esac
2882 : compile a host miniperl and generate_uudmap, unless we got passed them
2883 if $test "X$hostperl" = X; then
2884 echo "Building host miniperl and generate_uudmap binaries" >&4
2885 before_host=`pwd`
2886 cd ..
2887 cd $src
2888 src=`pwd`
2889 test -d $src/host || mkdir $src/host
2890 cd $src/host && rm -rf ./*
2891 $src/Configure -des -Dusedevel -Dmksymlinks
2892 $make miniperl
2893 case "$hostgenerate" in
2894 '') $make generate_uudmap
2895 hostgenerate=$src/host/generate_uudmap
2896 ;;
2897 "$undef") hostgenerate=''
2898 ;;
2899 esac
2900 hostperl=$src/host/miniperl
2901 cd $before_host
2902 fi
2903 hostosname=`$hostperl -le 'print $^O'`
2904 ;;
2905*)
2906 usecrosscompile='undef'
2907 ;;
2908esac
2909
2910: Define -Dtargethost=somecomputer to run compiled tests on another machine
2911case "$targethost" in
2912 '') echo "Checking for cross-compile" >&4
2913 case "$usecrosscompile$multiarch" in
2914 *$define*) echo "Skipping the try tests in the rest of Configure as no targethost was defined when cross-compiling" >&4
2915 if [ -f Makefile ]; then
2916 echo " "
2917 echo "Now you must ensure config.sh, config.h and the generated headers exist and run a $make."
2918 else
2919 echo "Configure done."
2920 fi
2921 exit 0
2922 ;;
2923 *) echo "No targethost for running compiler tests against defined, running locally" >&4
2924 run=''
2925 to=:
2926 from=:
2927 ;;
2928 esac
2929 ;;
2930 *) echo "Using targethost $targethost." >&4
2931 case "$src" in
2932 /*) run=$src/Cross/run
2933 targetmkdir=$src/Cross/mkdir
2934 to=$src/Cross/to
2935 from=$src/Cross/from
2936 ;;
2937 *) pwd=`$test -f ../Configure & cd ..; pwd`
2938 run=$pwd/Cross/run
2939 targetmkdir=$pwd/Cross/mkdir
2940 to=$pwd/Cross/to
2941 from=$pwd/Cross/from
2942 ;;
2943 esac
2944 case "$targetrun" in
2945 '') targetrun=ssh ;;
2946 esac
2947 case "$targetto" in
2948 '') targetto=scp ;;
2949 esac
2950 case "$targetfrom" in
2951 '') targetfrom=scp ;;
2952 esac
2953 run=$run-$targetrun
2954 to=$to-$targetto
2955 from=$from-$targetfrom
2956 case "$targetdir" in
2957 '') targetdir=/tmp
2958 echo "Guessing targetdir $targetdir." >&4
2959 ;;
2960 esac
2961 case "$targetuser" in
2962 '') targetuser=root
2963 echo "Guessing targetuser $targetuser." >&4
2964 ;;
2965 esac
2966 case "$targetport" in
2967 '') targetport=22
2968 echo "Guessing targetport $targetport." >&4
2969 ;;
2970 esac
2971 case "$targetfrom" in
2972 scp) q=-q ;;
2973 *) q='' ;;
2974 esac
2975 case "$targetrun" in
2976 ssh|rsh)
2977 cat >$run <<EOF
2978#!/bin/sh
2979env=''
2980case "\$1" in
2981-cwd)
2982 shift
2983 cwd=\$1
2984 shift
2985 ;;
2986esac
2987case "\$1" in
2988-env)
2989 shift
2990 env=\$1
2991 shift
2992 ;;
2993esac
2994case "\$cwd" in
2995'') cwd=$targetdir ;;
2996esac
2997exe=\$1
2998shift
2999$to \$exe
3000$targetrun -p $targetport -l $targetuser $targethost "cd \$cwd && \$env \$exe \$@"
3001EOF
3002 ;;
3003 *) echo "Unknown targetrun '$targetrun'" >&4
3004 exit 1
3005 ;;
3006 esac
3007 case "$targetmkdir" in
3008 */Cross/mkdir)
3009 cat >$targetmkdir <<EOF
3010#!/bin/sh
3011$targetrun -p $targetport -l $targetuser $targethost "mkdir -p \$@"
3012EOF
3013 $chmod a+rx $targetmkdir
3014 ;;
3015 *) echo "Unknown targetmkdir '$targetmkdir'" >&4
3016 exit 1
3017 ;;
3018 esac
3019 case "$targetto" in
3020 scp|rcp)
3021 cat >$to <<EOF
3022#!/bin/sh
3023for f in \$@
3024do
3025 case "\$f" in
3026 /*)
3027 $targetmkdir \`dirname \$f\`
3028 $targetto -P $targetport -r $q \$f $targetuser@$targethost:\$f || exit 1
3029 ;;
3030 *)
3031 $targetmkdir $targetdir/\`dirname \$f\`
3032 $targetto -P $targetport -r $q \$f $targetuser@$targethost:$targetdir/\$f 2>/dev/null || exit 1
3033 ;;
3034 esac
3035done
3036exit 0
3037EOF
3038 ;;
3039 cp) cat >$to <<EOF
3040#!/bin/sh
3041for f in \$@
3042do
3043 case "\$f" in
3044 /*)
3045 $mkdir -p $targetdir/\`dirname \$f\`
3046 $cp \$f $targetdir/\$f || exit 1
3047 ;;
3048 *)
3049 $targetmkdir $targetdir/\`dirname \$f\`
3050 $cp \$f $targetdir/\$f || exit 1
3051 ;;
3052 esac
3053done
3054exit 0
3055EOF
3056 ;;
3057 *) echo "Unknown targetto '$targetto'" >&4
3058 exit 1
3059 ;;
3060 esac
3061 case "$targetfrom" in
3062 scp|rcp)
3063 cat >$from <<EOF
3064#!/bin/sh
3065for f in \$@
3066do
3067 $rm -f \$f
3068 $targetfrom -P $targetport $q $targetuser@$targethost:$targetdir/\$f . || exit 1
3069done
3070exit 0
3071EOF
3072 ;;
3073 cp) cat >$from <<EOF
3074#!/bin/sh
3075for f in \$@
3076do
3077 $rm -f \$f
3078 cp $targetdir/\$f . || exit 1
3079done
3080exit 0
3081EOF
3082 ;;
3083 *) echo "Unknown targetfrom '$targetfrom'" >&4
3084 exit 1
3085 ;;
3086 esac
3087 if $test ! -f $run; then
3088 echo "Target 'run' script '$run' not found." >&4
3089 else
3090 $chmod a+rx $run
3091 fi
3092 if $test ! -f $to; then
3093 echo "Target 'to' script '$to' not found." >&4
3094 else
3095 $chmod a+rx $to
3096 fi
3097 if $test ! -f $from; then
3098 echo "Target 'from' script '$from' not found." >&4
3099 else
3100 $chmod a+rx $from
3101 fi
3102 if $test ! -f $run -o ! -f $to -o ! -f $from; then
3103 exit 1
3104 fi
3105 cat >&4 <<EOF
3106Using '$run' for remote execution,
3107and '$from' and '$to'
3108for remote file transfer.
3109EOF
3110 ;;
3111*) run=''
3112 to=:
3113 from=:
3114 usecrosscompile='undef'
3115 targetarch=''
3116 ;;
3117esac
3118
3119: see whether [:lower:] and [:upper:] are supported character classes
3120echo " "
3121case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
3122ABYZ)
3123 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3124 up='[:upper:]'
3125 low='[:lower:]'
3126 ;;
3127*) # There is a discontinuity in EBCDIC between 'R' and 'S'
3128 # (0xd9 and 0xe2), therefore that is a nice testing point.
3129 if test "X$up" = X -o "X$low" = X; then
3130 case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3131 rs) up='[A-Z]'
3132 low='[a-z]'
3133 ;;
3134 esac
3135 fi
3136 if test "X$up" = X -o "X$low" = X; then
3137 case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3138 rs) up='A-Z'
3139 low='a-z'
3140 ;;
3141 esac
3142 fi
3143 if test "X$up" = X -o "X$low" = X; then
3144 case "`echo RS | od -x 2>/dev/null`" in
3145 *D9E2*|*d9e2*)
3146 echo "Hey, this might be EBCDIC." >&4
3147 if test "X$up" = X -o "X$low" = X; then
3148 case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3149 rs) up='[A-IJ-RS-Z]'
3150 low='[a-ij-rs-z]'
3151 ;;
3152 esac
3153 fi
3154 if test "X$up" = X -o "X$low" = X; then
3155 case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3156 rs) up='A-IJ-RS-Z'
3157 low='a-ij-rs-z'
3158 ;;
3159 esac
3160 fi
3161 ;;
3162 esac
3163 fi
3164esac
3165case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3166rs)
3167 echo "Using $up and $low to convert case." >&4
3168 ;;
3169*)
3170 echo "I don't know how to translate letters from upper to lower case." >&4
3171 echo "Your tr is not acting any way I know of." >&4
3172 exit 1
3173 ;;
3174esac
3175: set up the translation script tr, must be called with ./tr of course
3176cat >tr <<EOSC
3177$startsh
3178case "\$1\$2" in
3179'[A-Z][a-z]') exec $tr '$up' '$low';;
3180'[a-z][A-Z]') exec $tr '$low' '$up';;
3181esac
3182exec $tr "\$@"
3183EOSC
3184chmod +x tr
3185$eunicefix tr
3186
3187: Try to determine whether config.sh was made on this system
3188case "$config_sh" in
3189'')
3190myuname=`$uname -a 2>/dev/null`
3191$test -z "$myuname" && myuname=`hostname 2>/dev/null`
3192# Downcase everything to avoid ambiguity.
3193# Remove slashes and single quotes so we can use parts of this in
3194# directory and file names.
3195# Remove newlines so myuname is sane to use elsewhere.
3196# tr '[A-Z]' '[a-z]' would not work in EBCDIC
3197# because the A-Z/a-z are not consecutive.
3198myuname=`echo $myuname | $sed -e "s,['/],,g" | \
3199 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3200newmyuname="$myuname"
3201dflt=n
3202case "$knowitall" in
3203'')
3204 if test -f ../config.sh; then
3205 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3206 eval "`grep myuname= ../config.sh`"
3207 fi
3208 if test "X$myuname" = "X$newmyuname"; then
3209 dflt=y
3210 fi
3211 fi
3212 ;;
3213*) dflt=y;;
3214esac
3215
3216: Get old answers from old config file if Configure was run on the
3217: same system, otherwise use the hints.
3218hint=default
3219cd ..
3220if test -f config.sh; then
3221 echo " "
3222 rp="I see a config.sh file. Shall I use it to set the defaults?"
3223 . UU/myread
3224 case "$ans" in
3225 n*|N*) echo "OK, I'll ignore it."
3226 mv config.sh config.sh.old
3227 myuname="$newmyuname"
3228 ;;
3229 *) echo "Fetching default answers from your old config.sh file..." >&4
3230 tmp_n="$n"
3231 tmp_c="$c"
3232 tmp_sh="$sh"
3233 . ./config.sh
3234 cp config.sh UU
3235 n="$tmp_n"
3236 c="$tmp_c"
3237 : Older versions did not always set $sh. Catch re-use of such
3238 : an old config.sh.
3239 case "$sh" in
3240 '') sh="$tmp_sh" ;;
3241 esac
3242 hint=previous
3243 ;;
3244 esac
3245fi
3246. ./UU/checkcc
3247if test ! -f config.sh; then
3248 $cat <<EOM
3249
3250First time through, eh? I have some defaults handy for some systems
3251that need some extra help getting the Configure answers right:
3252
3253EOM
3254 (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
3255 dflt=''
3256 : Half the following guesses are probably wrong... If you have better
3257 : tests or hints, please send them to perlbug@perl.org
3258 : The metaconfig authors would also appreciate a copy...
3259 $test -f /irix && osname=irix
3260 $test -f /xenix && osname=sco_xenix
3261 $test -f /dynix && osname=dynix
3262 $test -f /dnix && osname=dnix
3263 $test -f /lynx.os && osname=lynxos
3264 $test -f /unicos && osname=unicos && osvers=`$uname -r`
3265 $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3266 $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3267 $test -f /bin/mips && /bin/mips && osname=mips
3268 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3269 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3270 $test -d /usr/apollo/bin && osname=apollo
3271 $test -f /etc/saf/_sactab && osname=svr4
3272 $test -d /usr/include/minix && osname=minix
3273 $test -f /system/gnu_library/bin/ar.pm && osname=vos
3274 if $test -d /MachTen -o -d /MachTen_Folder; then
3275 osname=machten
3276 if $test -x /sbin/version; then
3277 osvers=`/sbin/version | $awk '{print $2}' |
3278 $sed -e 's/[A-Za-z]$//'`
3279 elif $test -x /usr/etc/version; then
3280 osvers=`/usr/etc/version | $awk '{print $2}' |
3281 $sed -e 's/[A-Za-z]$//'`
3282 else
3283 osvers="$2.$3"
3284 fi
3285 fi
3286
3287 $test -f /sys/posix.dll &&
3288 $test -f /usr/bin/what &&
3289 set X `/usr/bin/what /sys/posix.dll` &&
3290 $test "$3" = UWIN &&
3291 osname=uwin &&
3292 osvers="$5"
3293
3294 if $test -f $uname; then
3295 set X $myuname
3296 shift
3297
3298 case "$5" in
3299 fps*) osname=fps ;;
3300 mips*)
3301 case "$4" in
3302 umips) osname=umips ;;
3303 *) osname=mips ;;
3304 esac;;
3305 [23]100) osname=mips ;;
3306 next*) osname=next ;;
3307 i386*)
3308 tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3309 if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3310 osname='sco'
3311 osvers=$tmp
3312 elif $test -f /etc/kconfig; then
3313 osname=isc
3314 if test "$lns" = "$ln -s"; then
3315 osvers=4
3316 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3317 osvers=3
3318 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3319 osvers=2
3320 fi
3321 fi
3322 tmp=''
3323 ;;
3324 pc*)
3325 if test -n "$DJGPP"; then
3326 osname=dos
3327 osvers=djgpp
3328 fi
3329 ;;
3330 esac
3331
3332 case "$1" in
3333 aix) osname=aix
3334 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3335 case "$tmp" in
3336 # oslevel can fail with:
3337 # oslevel: Unable to acquire lock.
3338 *not\ found) osvers="$4"."$3" ;;
3339 '<3240'|'<>3240') osvers=3.2.0 ;;
3340 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3341 '=3250'|'>3250') osvers=3.2.5 ;;
3342 *) osvers=$tmp;;
3343 esac
3344 ;;
3345 bitrig) osname=bitrig
3346 osvers="$3"
3347 ;;
3348 bsd386) osname=bsd386
3349 osvers=`$uname -r`
3350 ;;
3351 cygwin*) osname=cygwin
3352 osvers="$3"
3353 ;;
3354 *dc.osx) osname=dcosx
3355 osvers="$3"
3356 ;;
3357 dnix) osname=dnix
3358 osvers="$3"
3359 ;;
3360 domainos) osname=apollo
3361 osvers="$3"
3362 ;;
3363 dgux) osname=dgux
3364 osvers="$3"
3365 ;;
3366 dragonfly) osname=dragonfly
3367 osvers="$3"
3368 ;;
3369 dynixptx*) osname=dynixptx
3370 osvers=`echo "$4"|sed 's/^v//'`
3371 ;;
3372 freebsd) osname=freebsd
3373 osvers="$3" ;;
3374 genix) osname=genix ;;
3375 gnu) osname=gnu
3376 osvers="$3" ;;
3377 hp*) osname=hpux
3378 osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3379 ;;
3380 irix*) osname=irix
3381 case "$3" in
3382 4*) osvers=4 ;;
3383 5*) osvers=5 ;;
3384 *) osvers="$3" ;;
3385 esac
3386 ;;
3387 linux) osname=linux
3388 case "$3" in
3389 *) osvers="$3" ;;
3390 esac
3391 ;;
3392 MiNT) osname=mint
3393 ;;
3394 netbsd*) osname=netbsd
3395 osvers="$3"
3396 ;;
3397 news-os) osvers="$3"
3398 case "$3" in
3399 4*) osname=newsos4 ;;
3400 *) osname=newsos ;;
3401 esac
3402 ;;
3403 next*) osname=next ;;
3404 nonstop-ux) osname=nonstopux ;;
3405 openbsd) osname=openbsd
3406 osvers="$3"
3407 ;;
3408 os2) osname=os2
3409 osvers="$4"
3410 ;;
3411 POSIX-BC | posix-bc ) osname=posix-bc
3412 osvers="$3"
3413 ;;
3414 powerux | power_ux | powermax_os | powermaxos | \
3415 powerunix | power_unix) osname=powerux
3416 osvers="$3"
3417 ;;
3418 qnx) osname=qnx
3419 osvers="$4"
3420 ;;
3421 solaris) osname=solaris
3422 case "$3" in
3423 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3424 *) osvers="$3" ;;
3425 esac
3426 ;;
3427 sunos) osname=sunos
3428 case "$3" in
3429 5*) osname=solaris
3430 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3431 *) osvers="$3" ;;
3432 esac
3433 ;;
3434 titanos) osname=titanos
3435 case "$3" in
3436 1*) osvers=1 ;;
3437 2*) osvers=2 ;;
3438 3*) osvers=3 ;;
3439 4*) osvers=4 ;;
3440 *) osvers="$3" ;;
3441 esac
3442 ;;
3443 ultrix) osname=ultrix
3444 osvers="$3"
3445 ;;
3446 osf1|mls+) case "$5" in
3447 alpha)
3448 osname=dec_osf
3449 osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' | tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3450 case "$osvers" in
3451 [1-9].[0-9]*) ;;
3452 *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3453 esac
3454 ;;
3455 hp*) osname=hp_osf1 ;;
3456 mips) osname=mips_osf1 ;;
3457 esac
3458 ;;
3459 # UnixWare 7.1.2 is known as Open UNIX 8
3460 openunix|unixware) osname=svr5
3461 osvers="$4"
3462 ;;
3463 uts) osname=uts
3464 osvers="$3"
3465 ;;
3466 vos) osvers="$3"
3467 ;;
3468 $2) case "$osname" in
3469 *isc*) ;;
3470 *freebsd*) ;;
3471 svr*)
3472 : svr4.x or possibly later
3473 case "svr$3" in
3474 ${osname}*)
3475 osname=svr$3
3476 osvers=$4
3477 ;;
3478 esac
3479 case "$osname" in
3480 svr4.0)
3481 : Check for ESIX
3482 if test -f /stand/boot ; then
3483 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3484 if test -n "$INITPROG" -a -f "$INITPROG"; then
3485 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3486 if test -n "$isesix"; then
3487 osname=esix4
3488 fi
3489 fi
3490 fi
3491 ;;
3492 esac
3493 ;;
3494 *) if test -f /etc/systemid; then
3495 osname=sco
3496 set `echo $3 | $sed 's/\./ /g'` $4
3497 if $test -f $src/hints/sco_$1_$2_$3.sh; then
3498 osvers=$1.$2.$3
3499 elif $test -f $src/hints/sco_$1_$2.sh; then
3500 osvers=$1.$2
3501 elif $test -f $src/hints/sco_$1.sh; then
3502 osvers=$1
3503 fi
3504 else
3505 case "$osname" in
3506 '') : Still unknown. Probably a generic Sys V.
3507 osname="sysv"
3508 osvers="$3"
3509 ;;
3510 esac
3511 fi
3512 ;;
3513 esac
3514 ;;
3515 *) case "$osname" in
3516 '') : Still unknown. Probably a generic BSD.
3517 osname="$1"
3518 osvers="$3"
3519 ;;
3520 esac
3521 ;;
3522 esac
3523 else
3524 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3525 (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3526 if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3527 osname=news_os
3528 fi
3529 $rm -f UU/kernel.what
3530 elif test -d c:/. -o -n "$is_os2" ; then
3531 set X $myuname
3532 osname=os2
3533 osvers="$5"
3534 fi
3535 fi
3536
3537 case "$targetarch" in
3538 '') ;;
3539 *) hostarch=$osname
3540 osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3541 osvers=''
3542 ;;
3543 esac
3544
3545 : Now look for a hint file osname_osvers, unless one has been
3546 : specified already.
3547 case "$hintfile" in
3548 ''|' ')
3549 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3550 : Also try without trailing minor version numbers.
3551 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3552 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3553 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3554 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3555 case "$file" in
3556 '') dflt=none ;;
3557 *) case "$osvers" in
3558 '') dflt=$file
3559 ;;
3560 *) if $test -f $src/hints/$file.sh ; then
3561 dflt=$file
3562 elif $test -f $src/hints/$xfile.sh ; then
3563 dflt=$xfile
3564 elif $test -f $src/hints/$xxfile.sh ; then
3565 dflt=$xxfile
3566 elif $test -f $src/hints/$xxxfile.sh ; then
3567 dflt=$xxxfile
3568 elif $test -f $src/hints/$xxxxfile.sh ; then
3569 dflt=$xxxxfile
3570 elif $test -f "$src/hints/${osname}.sh" ; then
3571 dflt="${osname}"
3572 else
3573 dflt=none
3574 fi
3575 ;;
3576 esac
3577 ;;
3578 esac
3579 if $test -f Policy.sh ; then
3580 case "$dflt" in
3581 *Policy*) ;;
3582 none) dflt="Policy" ;;
3583 *) dflt="Policy $dflt" ;;
3584 esac
3585 fi
3586 ;;
3587 *)
3588 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3589 ;;
3590 esac
3591
3592 if $test -f Policy.sh ; then
3593 $cat <<EOM
3594
3595There's also a Policy hint file available, which should make the
3596site-specific (policy) questions easier to answer.
3597EOM
3598
3599 fi
3600
3601 $cat <<EOM
3602
3603You may give one or more space-separated answers, or "none" if appropriate.
3604If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3605previous run of Configure, you may specify it as well as or instead of
3606OS-specific hints. If hints are provided for your OS, you should use them:
3607although Perl can probably be built without hints on many platforms, using
3608hints often improve performance and may enable features that Configure can't
3609set up on its own. If there are no hints that match your OS, specify "none";
3610DO NOT give a wrong version or a wrong OS.
3611
3612EOM
3613
3614 rp="Which of these apply, if any?"
3615 . UU/myread
3616 tans=$ans
3617 for file in $tans; do
3618 if $test X$file = XPolicy -a -f Policy.sh; then
3619 . Policy.sh
3620 $cat Policy.sh >> UU/config.sh
3621 elif $test -f $src/hints/$file.sh; then
3622 . $src/hints/$file.sh
3623 $cat $src/hints/$file.sh >> UU/config.sh
3624 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3625 : nothing
3626 else
3627 : Give one chance to correct a possible typo.
3628 echo "$file.sh does not exist"
3629 dflt=$file
3630 rp="hint to use instead?"
3631 . UU/myread
3632 for file in $ans; do
3633 if $test -f "$src/hints/$file.sh"; then
3634 . $src/hints/$file.sh
3635 $cat $src/hints/$file.sh >> UU/config.sh
3636 elif $test X$ans = X -o X$ans = Xnone ; then
3637 : nothing
3638 else
3639 echo "$file.sh does not exist -- ignored."
3640 fi
3641 done
3642 fi
3643 done
3644
3645 hint=recommended
3646 : Remember our hint file for later.
3647 if $test -f "$src/hints/$file.sh" ; then
3648 hintfile="$file"
3649 else
3650 hintfile=''
3651 fi
3652fi
3653cd UU
3654;;
3655*)
3656 echo " "
3657 echo "Fetching default answers from $config_sh..." >&4
3658 tmp_n="$n"
3659 tmp_c="$c"
3660 cd ..
3661 cp $config_sh config.sh 2>/dev/null
3662 chmod +w config.sh
3663 . ./config.sh
3664 cd UU
3665 cp ../config.sh .
3666 n="$tmp_n"
3667 c="$tmp_c"
3668 hint=previous
3669 ;;
3670esac
3671test "$override" && . ./optdef.sh
3672
3673: Restore computed paths
3674for file in $loclist $trylist; do
3675 eval $file="\$_$file"
3676done
3677
3678cat << EOM
3679
3680Configure uses the operating system name and version to set some defaults.
3681The default value is probably right if the name rings a bell. Otherwise,
3682since spelling matters for me, either accept the default or answer "none"
3683to leave it blank.
3684
3685EOM
3686case "$osname" in
3687 ''|' ')
3688 case "$hintfile" in
3689 ''|' '|none) dflt=none ;;
3690 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3691 esac
3692 ;;
3693 *) dflt="$osname" ;;
3694esac
3695rp="Operating system name?"
3696. ./myread
3697case "$ans" in
3698none) osname='' ;;
3699*) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3700esac
3701echo " "
3702case "$osvers" in
3703 ''|' ')
3704 case "$hintfile" in
3705 ''|' '|none) dflt=none ;;
3706 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3707 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3708 case "$dflt" in
3709 ''|' ') dflt=none ;;
3710 esac
3711 ;;
3712 esac
3713 ;;
3714 *) dflt="$osvers" ;;
3715esac
3716rp="Operating system version?"
3717. ./myread
3718case "$ans" in
3719none) osvers='' ;;
3720*) osvers="$ans" ;;
3721esac
3722
3723
3724. ./posthint.sh
3725
3726: who configured the system
3727cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3728case "$cf_by" in
3729"")
3730 cf_by=`(logname) 2>/dev/null`
3731 case "$cf_by" in
3732 "")
3733 cf_by=`(whoami) 2>/dev/null`
3734 case "$cf_by" in
3735 "") cf_by=unknown ;;
3736 esac ;;
3737 esac ;;
3738esac
3739
3740: decide how portable to be. Allow command line overrides.
3741case "$d_portable" in
3742"$undef") ;;
3743*) d_portable="$define" ;;
3744esac
3745
3746: set up shell script to do ~ expansion
3747cat >filexp <<EOSS
3748$startsh
3749: expand filename
3750case "\$1" in
3751 \~/*|\~)
3752 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3753 ;;
3754 \~*)
3755 if $test -f /bin/csh; then
3756 /bin/csh -f -c "glob \$1"
3757 failed=\$?
3758 echo ""
3759 exit \$failed
3760 else
3761 name=\`$expr x\$1 : '..\([^/]*\)'\`
3762 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3763 if $test ! -d "\$dir"; then
3764 me=\`basename \$0\`
3765 echo "\$me: can't locate home directory for: \$name" >&2
3766 exit 1
3767 fi
3768 case "\$1" in
3769 */*)
3770 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3771 ;;
3772 *)
3773 echo \$dir
3774 ;;
3775 esac
3776 fi
3777 ;;
3778*)
3779 echo \$1
3780 ;;
3781esac
3782EOSS
3783chmod +x filexp
3784$eunicefix filexp
3785
3786: now set up to get a file name
3787cat <<EOS >getfile
3788$startsh
3789EOS
3790cat <<'EOSC' >>getfile
3791tilde=''
3792fullpath=''
3793already=''
3794skip=''
3795none_ok=''
3796exp_file=''
3797nopath_ok=''
3798orig_rp="$rp"
3799orig_dflt="$dflt"
3800case "$gfpth" in
3801'') gfpth='.' ;;
3802esac
3803
3804case "$fn" in
3805*\(*)
3806 : getfile will accept an answer from the comma-separated list
3807 : enclosed in parentheses even if it does not meet other criteria.
3808 expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3809 fn=`echo $fn | sed 's/(.*)//'`
3810 ;;
3811esac
3812
3813case "$fn" in
3814*:*)
3815 loc_file=`expr $fn : '.*:\(.*\)'`
3816 fn=`expr $fn : '\(.*\):.*'`
3817 ;;
3818esac
3819
3820case "$fn" in
3821*~*) tilde=true;;
3822esac
3823case "$fn" in
3824*/*) fullpath=true;;
3825esac
3826case "$fn" in
3827*+*) skip=true;;
3828esac
3829case "$fn" in
3830*n*) none_ok=true;;
3831esac
3832case "$fn" in
3833*e*) exp_file=true;;
3834esac
3835case "$fn" in
3836*p*) nopath_ok=true;;
3837esac
3838
3839case "$fn" in
3840*f*) type='File';;
3841*d*) type='Directory';;
3842*l*) type='Locate';;
3843esac
3844
3845what="$type"
3846case "$what" in
3847Locate) what='File';;
3848esac
3849
3850case "$exp_file" in
3851'')
3852 case "$d_portable" in
3853 "$define") ;;
3854 *) exp_file=true;;
3855 esac
3856 ;;
3857esac
3858
3859cd ..
3860while test "$type"; do
3861 redo=''
3862 rp="$orig_rp"
3863 dflt="$orig_dflt"
3864 case "$tilde" in
3865 true) rp="$rp (~name ok)";;
3866 esac
3867 . UU/myread
3868 if test -f UU/getfile.ok && \
3869 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3870 then
3871 value="$ans"
3872 ansexp="$ans"
3873 break
3874 fi
3875 case "$ans" in
3876 none)
3877 value=''
3878 ansexp=''
3879 case "$none_ok" in
3880 true) type='';;
3881 esac
3882 ;;
3883 *)
3884 case "$tilde" in
3885 '') value="$ans"
3886 ansexp="$ans";;
3887 *)
3888 value=`UU/filexp $ans`
3889 case $? in
3890 0)
3891 if test "$ans" != "$value"; then
3892 echo "(That expands to $value on this system.)"
3893 fi
3894 ;;
3895 *) value="$ans";;
3896 esac
3897 ansexp="$value"
3898 case "$exp_file" in
3899 '') value="$ans";;
3900 esac
3901 ;;
3902 esac
3903 case "$fullpath" in
3904 true)
3905 case "$ansexp" in
3906 /*) value="$ansexp" ;;
3907 [a-zA-Z]:/*) value="$ansexp" ;;
3908 *)
3909 redo=true
3910 case "$already" in
3911 true)
3912 echo "I shall only accept a full path name, as in /bin/ls." >&4
3913 echo "Use a ! shell escape if you wish to check pathnames." >&4
3914 ;;
3915 *)
3916 echo "Please give a full path name, starting with slash." >&4
3917 case "$tilde" in
3918 true)
3919 echo "Note that using ~name is ok provided it expands well." >&4
3920 already=true
3921 ;;
3922 esac
3923 esac
3924 ;;
3925 esac
3926 ;;
3927 esac
3928 case "$redo" in
3929 '')
3930 case "$type" in
3931 File)
3932 for fp in $gfpth; do
3933 if test "X$fp" = X.; then
3934 pf="$ansexp"
3935 else
3936 pf="$fp/$ansexp"
3937 fi
3938 if test -f "$pf"; then
3939 type=''
3940 elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3941 then
3942 echo "($value is not a plain file, but that's ok.)"
3943 type=''
3944 fi
3945 if test X"$type" = X; then
3946 value="$pf"
3947 break
3948 fi
3949 done
3950 ;;
3951 Directory)
3952 for fp in $gfpth; do
3953 if test "X$fp" = X.; then
3954 dir="$ans"
3955 direxp="$ansexp"
3956 else
3957 dir="$fp/$ansexp"
3958 direxp="$fp/$ansexp"
3959 fi
3960 if test -d "$direxp"; then
3961 type=''
3962 value="$dir"
3963 break
3964 fi
3965 done
3966 ;;
3967 Locate)
3968 if test -d "$ansexp"; then
3969 echo "(Looking for $loc_file in directory $value.)"
3970 value="$value/$loc_file"
3971 ansexp="$ansexp/$loc_file"
3972 fi
3973 if test -f "$ansexp"; then
3974 type=''
3975 fi
3976 case "$nopath_ok" in
3977 true) case "$value" in
3978 */*) ;;
3979 *) echo "Assuming $value will be in people's path."
3980 type=''
3981 ;;
3982 esac
3983 ;;
3984 esac
3985 ;;
3986 esac
3987
3988 case "$skip" in
3989 true) type='';
3990 esac
3991
3992 case "$type" in
3993 '') ;;
3994 *)
3995 if test "$fastread" = yes; then
3996 dflt=y
3997 else
3998 dflt=n
3999 fi
4000 rp="$what $value doesn't exist. Use that name anyway?"
4001 . UU/myread
4002 dflt=''
4003 case "$ans" in
4004 y*) type='';;
4005 *) echo " ";;
4006 esac
4007 ;;
4008 esac
4009 ;;
4010 esac
4011 ;;
4012 esac
4013done
4014cd UU
4015ans="$value"
4016rp="$orig_rp"
4017dflt="$orig_dflt"
4018rm -f getfile.ok
4019test "X$gfpthkeep" != Xy && gfpth=""
4020EOSC
4021
4022: determine root of directory hierarchy where package will be installed.
4023case "$prefix" in
4024'')
4025 dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4026 ;;
4027*?/)
4028 dflt=`echo "$prefix" | sed 's/.$//'`
4029 ;;
4030*)
4031 dflt="$prefix"
4032 ;;
4033esac
4034$cat <<EOM
4035
4036By default, $package will be installed in $dflt/bin, manual pages
4037under $dflt/man, etc..., i.e. with $dflt as prefix for all
4038installation directories. Typically this is something like /usr/local.
4039If you wish to have binaries under /usr/bin but other parts of the
4040installation under /usr/local, that's ok: you will be prompted
4041separately for each of the installation directories, the prefix being
4042only used to set the defaults.
4043
4044EOM
4045fn=d~
4046rp='Installation prefix to use?'
4047. ./getfile
4048oldprefix=''
4049case "$prefix" in
4050'') ;;
4051*)
4052 case "$ans" in
4053 "$prefix") ;;
4054 *) oldprefix="$prefix";;
4055 esac
4056 ;;
4057esac
4058prefix="$ans"
4059prefixexp="$ansexp"
4060
4061: allow them to override the AFS root
4062case "$afsroot" in
4063'') afsroot=/afs ;;
4064*) afsroot=$afsroot ;;
4065esac
4066
4067: is AFS running?
4068echo " "
4069case "$afs" in
4070$define|true) afs=true ;;
4071$undef|false) afs=false ;;
4072*) if $test -d $afsroot; then
4073 afs=true
4074 else
4075 afs=false
4076 fi
4077 ;;
4078esac
4079if $afs; then
4080 echo "AFS may be running... I'll be extra cautious then..." >&4
4081else
4082 echo "AFS does not seem to be running..." >&4
4083fi
4084
4085: determine installation prefix for where package is to be installed.
4086if $afs; then
4087$cat <<EOM
4088
4089Since you are running AFS, I need to distinguish the directory in which
4090files will reside from the directory in which they are installed (and from
4091which they are presumably copied to the former directory by occult means).
4092
4093EOM
4094 case "$installprefix" in
4095 '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4096 *) dflt="$installprefix";;
4097 esac
4098else
4099$cat <<EOM
4100
4101In some special cases, particularly when building $package for distribution,
4102it is convenient to distinguish the directory in which files should be
4103installed from the directory ($prefix) in which they will
4104eventually reside. For most users, these two directories are the same.
4105
4106EOM
4107 case "$installprefix" in
4108 '') dflt=$prefix ;;
4109 *) dflt=$installprefix;;
4110 esac
4111fi
4112fn=d~
4113rp='What installation prefix should I use for installing files?'
4114. ./getfile
4115installprefix="$ans"
4116installprefixexp="$ansexp"
4117
4118: Perform the prefixexp/installprefixexp correction if necessary
4119cat <<EOS >installprefix
4120$startsh
4121EOS
4122cat <<'EOSC' >>installprefix
4123: Change installation prefix, if necessary.
4124if $test X"$prefix" != X"$installprefix"; then
4125 eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4126else
4127 eval "install${prefixvar}=\"\$${prefixvar}exp\""
4128fi
4129EOSC
4130chmod +x installprefix
4131$eunicefix installprefix
4132
4133: Set variables such as privlib and privlibexp from the output of ./getfile
4134: performing the prefixexp/installprefixexp correction if necessary.
4135cat <<EOS >setprefixvar
4136$startsh
4137EOS
4138cat <<'EOSC' >>setprefixvar
4139eval "${prefixvar}=\"\$ans\""
4140eval "${prefixvar}exp=\"\$ansexp\""
4141. ./installprefix
4142EOSC
4143chmod +x setprefixvar
4144$eunicefix setprefixvar
4145
4146: set up the script used to warn in case of inconsistency
4147cat <<EOS >whoa
4148$startsh
4149EOS
4150cat <<'EOSC' >>whoa
4151dflt=y
4152case "$hint" in
4153 recommended)
4154 case "$hintfile" in
4155 '') echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4156 ;;
4157 *) echo "Hmm. Based on the hints in hints/$hintfile.sh, " >&4
4158 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4159 ;;
4160 esac
4161 ;;
4162 *) echo " "
4163 echo "*** WHOA THERE!!! ***" >&4
4164 echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
4165 ;;
4166esac
4167rp=" Keep the $hint value?"
4168. ./myread
4169case "$ans" in
4170y) td=$was; tu=$was;;
4171esac
4172EOSC
4173
4174: function used to set '$1' to '$val'
4175setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4176case "$val$was" in
4177$define$undef) . ./whoa; eval "$var=\$td";;
4178$undef$define) . ./whoa; eval "$var=\$tu";;
4179*) eval "$var=$val";;
4180esac'
4181
4182: get the patchlevel
4183echo " "
4184echo "Getting the current patchlevel..." >&4
4185if $test -r $rsrc/patchlevel.h;then
4186 revision=`awk '/define[ ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4187 patchlevel=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4188 subversion=`awk '/define[ ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4189 api_revision=`awk '/define[ ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4190 api_version=`awk '/define[ ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4191 api_subversion=`awk '/define[ ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4192 perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4193else
4194 revision=0
4195 patchlevel=0
4196 subversion=0
4197 api_revision=0
4198 api_version=0
4199 api_subversion=0
4200 perl_patchlevel=0
4201 $echo "(You do not have patchlevel.h. Eek.)"
4202fi
4203: Define a handy string here to avoid duplication in myconfig.SH and configpm.
4204version_patchlevel_string="version $patchlevel subversion $subversion"
4205case "$perl_patchlevel" in
42060|'') ;;
4207*) perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4208 version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4209 ;;
4210esac
4211
4212$echo "(You have $package $version_patchlevel_string.)"
4213
4214case "$osname" in
4215dos|vms)
4216 : XXX Should be a Configure test for double-dots in filenames.
4217 version=`echo $revision $patchlevel $subversion | \
4218 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4219 api_versionstring=`echo $api_revision $api_version $api_subversion | \
4220 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4221 ;;
4222*)
4223 version=`echo $revision $patchlevel $subversion | \
4224 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4225 api_versionstring=`echo $api_revision $api_version $api_subversion | \
4226 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4227 ;;
4228esac
4229: Special case the 5.005_xx maintenance series, which used 5.005
4230: without any subversion label as a subdirectory in $sitelib
4231if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4232 api_versionstring='5.005'
4233fi
4234
4235: Do we want threads support and if so, what type
4236case "$usethreads" in
4237$define|true|[yY]*) dflt='y';;
4238*) # Catch case where user specified ithreads or 5005threads but
4239 # forgot -Dusethreads (A.D. 4/2002)
4240 case "$useithreads$use5005threads" in
4241 *$define*) dflt='y';;
4242 *) dflt='n';;
4243 esac
4244 ;;
4245esac
4246cat <<EOM
4247
4248Perl can be built to offer a form of threading support on some systems
4249To do so, Configure can be run with -Dusethreads.
4250
4251Note that Perl built with threading support runs slightly slower
4252and uses slightly more memory than plain Perl.
4253
4254If this doesn't make any sense to you, just accept the default '$dflt'.
4255EOM
4256rp='Build a threading Perl?'
4257. ./myread
4258case "$ans" in
4259y|Y) val="$define" ;;
4260*) val="$undef" ;;
4261esac
4262set usethreads
4263eval $setvar
4264
4265if $test $patchlevel -lt 9; then
4266 case "$usethreads" in
4267 $define)
4268 : Default to ithreads unless overridden on command line or with
4269 : old config.sh
4270 dflt='y'
4271 case "$use5005threads" in
4272 $define|true|[yY]*)
4273 echo "5.005 threads are no longer supported"
4274 exit 1
4275 ;;
4276 esac
4277 case "$useithreads" in
4278 $undef|false|[nN]*) dflt='n';;
4279 esac
4280 rp='Use the newer interpreter-based ithreads?'
4281 . ./myread
4282 case "$ans" in
4283 y|Y) val="$define" ;;
4284 *) val="$undef" ;;
4285 esac
4286 set useithreads
4287 eval $setvar
4288 : Now set use5005threads to the opposite value.
4289 case "$useithreads" in
4290 $define) val="$undef" ;;
4291 *) val="$define" ;;
4292 esac
4293 set use5005threads
4294 eval $setvar
4295 ;;
4296 *)
4297 useithreads="$undef"
4298 use5005threads="$undef"
4299 ;;
4300 esac
4301
4302 case "$useithreads$use5005threads" in
4303 "$define$define")
4304 $cat >&4 <<EOM
4305
4306You cannot have both the ithreads and the 5.005 threads enabled
4307at the same time. Disabling the 5.005 threads since they are
4308much less stable than the ithreads.
4309
4310EOM
4311 use5005threads="$undef"
4312 ;;
4313 esac
4314
4315else
4316: perl-5.9.x and later
4317
4318 if test X"$usethreads" = "X$define"; then
4319 case "$use5005threads" in
4320 $define|true|[yY]*)
4321 $cat >&4 <<EOM
4322
43235.005 threads has been removed for 5.10. Perl will be built using ithreads.
4324
4325EOM
4326 ;;
4327 esac
4328 fi
4329
4330 use5005threads="$undef"
4331 useithreads="$usethreads"
4332fi
4333
4334case "$d_oldpthreads" in
4335'') : Configure tests would be welcome here. For now, assume undef.
4336 val="$undef" ;;
4337*) val="$d_oldpthreads" ;;
4338esac
4339set d_oldpthreads
4340eval $setvar
4341
4342
4343: Look for a hint-file generated 'call-back-unit'. If the
4344: user has specified that a threading perl is to be built,
4345: we may need to set or change some other defaults.
4346if $test -f usethreads.cbu; then
4347 echo "Your platform has some specific hints regarding threaded builds, using them..."
4348 . ./usethreads.cbu
4349else
4350 case "$usethreads" in
4351 "$define"|true|[yY]*)
4352 $cat <<EOM
4353(Your platform does not have any specific hints for threaded builds.
4354 Assuming POSIX threads, then.)
4355EOM
4356 ;;
4357 esac
4358fi
4359
4360: Check if multiplicity is required
4361cat <<EOM
4362
4363Perl can be built so that multiple Perl interpreters can coexist
4364within the same Perl executable.
4365EOM
4366
4367case "$useithreads" in
4368$define)
4369 cat <<EOM
4370This multiple interpreter support is required for interpreter-based threads.
4371EOM
4372 val="$define"
4373 ;;
4374*) case "$usemultiplicity" in
4375 $define|true|[yY]*) dflt='y';;
4376 *) dflt='n';;
4377 esac
4378 echo " "
4379 echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4380 rp='Build Perl for multiplicity?'
4381 . ./myread
4382 case "$ans" in
4383 y|Y) val="$define" ;;
4384 *) val="$undef" ;;
4385 esac
4386 ;;
4387esac
4388set usemultiplicity
4389eval $setvar
4390
4391: Check if morebits is requested
4392case "$usemorebits" in
4393"$define"|true|[yY]*)
4394 use64bitint="$define"
4395 uselongdouble="$define"
4396 usemorebits="$define"
4397 ;;
4398*) usemorebits="$undef"
4399 ;;
4400esac
4401
4402: Determine the C compiler to be used
4403echo " "
4404case "$cc" in
4405'') dflt=cc;;
4406*) dflt="$cc";;
4407esac
4408rp="Use which C compiler?"
4409. ./myread
4410cc="$ans"
4411
4412: See whether they have no cc but they do have gcc
4413. ./trygcc
4414if $test -f cc.cbu; then
4415 . ./cc.cbu
4416fi
4417. ./checkcc
4418
4419: make some quick guesses about what we are up against
4420echo " "
4421$echo $n "Hmm... $c"
4422echo exit 1 >bsd
4423echo exit 1 >usg
4424echo exit 1 >v7
4425echo exit 1 >osf1
4426echo exit 1 >eunice
4427echo exit 1 >xenix
4428echo exit 1 >venix
4429echo exit 1 >os2
4430d_bsd="$undef"
4431$cat $sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h >foo 2>/dev/null
4432if test -f /osf_boot || $contains 'OSF/1' $sysroot/usr/include/ctype.h >/dev/null 2>&1
4433then
4434 echo "Looks kind of like an OSF/1 system, but we'll see..."
4435 echo exit 0 >osf1
4436elif test `echo abc | $tr a-z A-Z` = Abc ; then
4437 xxx=`./loc addbib blurfl $pth`
4438 if $test -f $xxx; then
4439 echo "Looks kind of like a USG system with BSD features, but we'll see..."
4440 echo exit 0 >bsd
4441 echo exit 0 >usg
4442 else
4443 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4444 echo "Looks kind of like an extended USG system, but we'll see..."
4445 else
4446 echo "Looks kind of like a USG system, but we'll see..."
4447 fi
4448 echo exit 0 >usg
4449 fi
4450elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4451 echo "Looks kind of like a BSD system, but we'll see..."
4452 d_bsd="$define"
4453 echo exit 0 >bsd
4454else
4455 echo "Looks kind of like a Version 7 system, but we'll see..."
4456 echo exit 0 >v7
4457fi
4458case "$eunicefix" in
4459*unixtovms*)
4460 $cat <<'EOI'
4461There is, however, a strange, musty smell in the air that reminds me of
4462something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4463EOI
4464 echo exit 0 >eunice
4465 d_eunice="$define"
4466: it so happens the Eunice I know will not run shell scripts in Unix format
4467 ;;
4468*)
4469 echo " "
4470 echo "Congratulations. You aren't running Eunice."
4471 d_eunice="$undef"
4472 ;;
4473esac
4474: Detect OS2. The p_ variable is set above in the Head.U unit.
4475: Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4476: semicolon as a patch separator
4477case "$p_" in
4478:) ;;
4479*)
4480 $cat <<'EOI'
4481I have the feeling something is not exactly right, however...don't tell me...
4482lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4483(Or you may be running DOS with DJGPP.)
4484EOI
4485 echo exit 0 >os2
4486 ;;
4487esac
4488if test -f /xenix; then
4489 echo "Actually, this looks more like a XENIX system..."
4490 echo exit 0 >xenix
4491 d_xenix="$define"
4492else
4493 echo " "
4494 echo "It's not Xenix..."
4495 d_xenix="$undef"
4496fi
4497chmod +x xenix
4498$eunicefix xenix
4499if test -f /venix; then
4500 echo "Actually, this looks more like a VENIX system..."
4501 echo exit 0 >venix
4502else
4503 echo " "
4504 if ./xenix; then
4505 : null
4506 else
4507 echo "Nor is it Venix..."
4508 fi
4509fi
4510chmod +x bsd usg v7 osf1 eunice xenix venix os2
4511$eunicefix bsd usg v7 osf1 eunice xenix venix os2
4512$rm -f foo
4513
4514: Check if we are using GNU gcc and what its version is
4515echo " "
4516echo "Checking for GNU cc in disguise and/or its version number..." >&4
4517$cat >try.c <<EOM
4518#include <stdio.h>
4519int main() {
4520#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4521#ifdef __VERSION__
4522 printf("%s\n", __VERSION__);
4523#else
4524 printf("%s\n", "1");
4525#endif
4526#endif
4527 return(0);
4528}
4529EOM
4530if $cc -o try $ccflags $ldflags try.c; then
4531 gccversion=`$run ./try`
4532 case "$gccversion" in
4533 '') echo "You are not using GNU cc." ;;
4534 *) echo "You are using GNU cc $gccversion."
4535 ccname=gcc
4536 ;;
4537 esac
4538else
4539 echo " "
4540 echo "*** WHOA THERE!!! ***" >&4
4541 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
4542 case "$knowitall" in
4543 '')
4544 echo " You'd better start hunting for one and let me know about it." >&4
4545 exit 1
4546 ;;
4547 esac
4548fi
4549$rm -f try try.*
4550case "$gccversion" in
45511*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4552esac
4553case "$gccversion" in
4554'') gccosandvers='' ;;
4555*) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4556 gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4557 gccshortvers=''
4558 case "$gccosandvers" in
4559 $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4560 $osname$osvers) ;; # looking good
4561 $osname*) cat <<EOM >&4
4562
4563*** WHOA THERE!!! ***
4564
4565 Your gcc has not been compiled for the exact release of
4566 your operating system ($gccosandvers versus $osname$osvers).
4567
4568 In general it is a good idea to keep gcc synchronized with
4569 the operating system because otherwise serious problems
4570 may ensue when trying to compile software, like Perl.
4571
4572 I'm trying to be optimistic here, though, and will continue.
4573 If later during the configuration and build icky compilation
4574 problems appear (headerfile conflicts being the most common
4575 manifestation), I suggest reinstalling the gcc to match
4576 your operating system release.
4577
4578EOM
4579 ;;
4580 *) gccosandvers='' ;; # failed to parse, better be silent
4581 esac
4582 ;;
4583esac
4584case "$ccname" in
4585'') ccname="$cc" ;;
4586esac
4587
4588# gcc 3.* complain about adding -Idirectories that they already know about,
4589# so we will take those off from locincpth.
4590case "$gccversion" in
45913*)
4592 echo "main(){}">try.c
4593 for incdir in $locincpth; do
4594 warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4595 grep '^c[cp]p*[01]: warning: changing search order '`
4596 if test "X$warn" != X; then
4597 locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4598 fi
4599 done
4600 $rm -f try try.*
4601esac
4602
4603: What should the include directory be ?
4604: Use sysroot if set, so findhdr looks in the right place.
4605echo " "
4606$echo $n "Hmm... $c"
4607dflt="$sysroot/usr/include"
4608incpath=''
4609mips_type=''
4610if $test -f /bin/mips && /bin/mips; then
4611 echo "Looks like a MIPS system..."
4612 $cat >usr.c <<'EOCP'
4613#ifdef SYSTYPE_BSD43
4614/bsd43
4615#endif
4616EOCP
4617 if $cc $cppflags -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4618 dflt='/bsd43/usr/include'
4619 incpath='/bsd43'
4620 mips_type='BSD 4.3'
4621 else
4622 mips_type='System V'
4623 fi
4624 $rm -f usr.c usr.out
4625 echo "and you're compiling with the $mips_type compiler and libraries."
4626 xxx_prompt=y
4627 echo "exit 0" >mips
4628else
4629 echo "Doesn't look like a MIPS system."
4630 xxx_prompt=n
4631 echo "exit 1" >mips
4632fi
4633chmod +x mips
4634$eunicefix mips
4635case "$usrinc" in
4636'') ;;
4637*) dflt="$usrinc";;
4638esac
4639case "$xxx_prompt" in
4640y) fn=d/
4641 echo " "
4642 rp='Where are the include files you want to use?'
4643 . ./getfile
4644 usrinc="$ans"
4645 ;;
4646*) usrinc="$dflt"
4647 ;;
4648esac
4649
4650: see how we invoke the C preprocessor
4651echo " "
4652echo "Now, how can we feed standard input to your C preprocessor..." >&4
4653cat <<'EOT' >testcpp.c
4654#define ABC abc
4655#define XYZ xyz
4656ABC.XYZ
4657EOT
4658cd ..
4659if test ! -f cppstdin; then
4660 if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4661 # AIX cc -E doesn't show the absolute headerfile
4662 # locations but we'll cheat by using the -M flag.
4663 echo 'cat >.$$.c; rm -f .$$.u; '"$cc"' ${1+"$@"} -M -c .$$.c 2>/dev/null; test -s .$$.u && awk '"'"'$2 ~ /\.h$/ { print "# 0 \""$2"\"" }'"'"' .$$.u; rm -f .$$.o .$$.u; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' > cppstdin
4664 else
4665 echo 'cat >.$$.c; '"$cc $cppflags"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4666 fi
4667else
4668 echo "Keeping your $hint cppstdin wrapper."
4669fi
4670chmod 755 cppstdin
4671wrapper=`pwd`/cppstdin
4672ok='false'
4673cd UU
4674
4675if $test "X$cppstdin" != "X" && \
4676 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4677 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4678then
4679 echo "You used to use $cppstdin $cppminus so we'll use that again."
4680 case "$cpprun" in
4681 '') echo "But let's see if we can live without a wrapper..." ;;
4682 *)
4683 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4684 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4685 then
4686 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4687 ok='true'
4688 else
4689 echo "(However, $cpprun $cpplast does not work, let's see...)"
4690 fi
4691 ;;
4692 esac
4693else
4694 case "$cppstdin" in
4695 '') ;;
4696 *)
4697 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4698 ;;
4699 esac
4700fi
4701
4702if $ok; then
4703 : nothing
4704elif echo 'Maybe "'"$cc"' -E" will work...'; \
4705 $cc -E <testcpp.c >testcpp.out 2>&1; \
4706 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4707 echo "Yup, it does."
4708 x_cpp="$cc $cppflags -E"
4709 x_minus='';
4710elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4711 $cc -E - <testcpp.c >testcpp.out 2>&1; \
4712 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4713 echo "Yup, it does."
4714 x_cpp="$cc $cppflags -E"
4715 x_minus='-';
4716elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4717 $cc -P <testcpp.c >testcpp.out 2>&1; \
4718 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4719 echo "Yipee, that works!"
4720 x_cpp="$cc $cppflags -P"
4721 x_minus='';
4722elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4723 $cc -P - <testcpp.c >testcpp.out 2>&1; \
4724 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4725 echo "At long last!"
4726 x_cpp="$cc $cppflags -P"
4727 x_minus='-';
4728elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4729 $cpp <testcpp.c >testcpp.out 2>&1; \
4730 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4731 echo "It works!"
4732 x_cpp="$cpp $cppflags"
4733 x_minus='';
4734elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4735 $cpp - <testcpp.c >testcpp.out 2>&1; \
4736 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4737 echo "Hooray, it works! I was beginning to wonder."
4738 x_cpp="$cpp $cppflags"
4739 x_minus='-';
4740elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
4741 $wrapper <testcpp.c >testcpp.out 2>&1; \
4742 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4743 x_cpp="$wrapper"
4744 x_minus=''
4745 echo "Eureka!"
4746else
4747 dflt=''
4748 rp="No dice. I can't find a C preprocessor. Name one:"
4749 . ./myread
4750 x_cpp="$ans"
4751 x_minus=''
4752 $x_cpp <testcpp.c >testcpp.out 2>&1
4753 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4754 echo "OK, that will do." >&4
4755 else
4756echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
4757 exit 1
4758 fi
4759fi
4760
4761case "$ok" in
4762false)
4763 cppstdin="$x_cpp"
4764 cppminus="$x_minus"
4765 cpprun="$x_cpp"
4766 cpplast="$x_minus"
4767 set X $x_cpp
4768 shift
4769 case "$1" in
4770 "$cpp")
4771 echo "Perhaps can we force $cc -E using a wrapper..."
4772 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4773 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4774 then
4775 echo "Yup, we can."
4776 cppstdin="$wrapper"
4777 cppminus='';
4778 else
4779 echo "Nope, we'll have to live without it..."
4780 fi
4781 ;;
4782 esac
4783 case "$cpprun" in
4784 "$wrapper")
4785 cpprun=''
4786 cpplast=''
4787 ;;
4788 esac
4789 ;;
4790esac
4791
4792case "$cppstdin" in
4793"$wrapper"|'cppstdin') ;;
4794*) $rm -f $wrapper;;
4795esac
4796$rm -f testcpp.c testcpp.out
4797
4798: Adjust cppfilter for path component separator
4799case "$osname" in
4800vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
4801os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
4802*) cppfilter='' ;;
4803esac
4804
4805: Use gcc to determine libpth and incpth
4806# If using gcc or clang, we can get better values for libpth, incpth
4807# and usrinc directly from the compiler.
4808# Note that ccname for clang is also gcc.
4809case "$ccname" in
4810 gcc)
4811 $echo 'extern int foo;' > try.c
4812 set X `$cppstdin -v try.c 2>&1 | $awk '/^#include </,/^End of search /'|$cppfilter $grep '/include'`
4813 shift
4814 if $test $# -gt 0; then
4815 incpth="$incpth $*"
4816 incpth="`$echo $incpth|$sed 's/^ //'`"
4817 for i in $*; do
4818 j="`$echo $i|$sed 's,/include$,/lib,'`"
4819 if $test -d $j; then
4820 libpth="$libpth $j"
4821 fi
4822 done
4823 libpth="`$echo $libpth|$sed 's/^ //'`"
4824 for xxx in $libpth $loclibpth $plibpth $glibpth; do
4825 if $test -d $xxx; then
4826 case " $libpth " in
4827 *" $xxx "*) ;;
4828 *) libpth="$libpth $xxx";;
4829 esac
4830 fi
4831 done
4832 fi
4833 $rm -f try.c
4834 case "$usrinc" in
4835 '') for i in $incpth; do
4836 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
4837 usrinc="$i"
4838 break
4839 fi
4840 done
4841 ;;
4842 esac
4843
4844 case "$usecrosscompile" in
4845 $define|true|[yY]*)
4846 case "$incpth" in
4847 '') echo "Incpth not defined." >&4; croak=y ;;
4848 *) echo "Using incpth '$incpth'." >&4 ;;
4849 esac
4850 case "$libpth" in
4851 '') echo "Libpth not defined." >&4; croak=y ;;
4852 *) echo "Using libpth '$libpth'." >&4 ;;
4853 esac
4854 case "$usrinc" in
4855 '') echo "Usrinc not defined." >&4; croak=y ;;
4856 *) echo "Using usrinc $usrinc." >&4 ;;
4857 esac
4858 case "$croak" in
4859 y)
4860 if test "X$sysroot" = X; then
4861 echo "Cannot continue, aborting." >&4; exit 1
4862 else
4863 echo "Cross-compiling using sysroot $sysroot, failing to guess inc/lib paths is not fatal" >&4
4864 fi
4865 ;;
4866 esac
4867 ;;
4868 esac
4869 ;;
4870esac
4871
4872: Default value for incpth is just usrinc
4873case "$incpth" in
4874'') incpth="$usrinc";;
4875esac
4876
4877: Set private lib path
4878case "$plibpth" in
4879'') if ./mips; then
4880 plibpth="$incpath/usr/lib $sysroot/usr/local/lib $sysroot/usr/ccs/lib"
4881 fi;;
4882esac
4883case "$libpth" in
4884' ') dlist='';;
4885'') dlist="$loclibpth $plibpth $glibpth";;
4886*) dlist="$libpth";;
4887esac
4888
4889: Now check and see which directories actually exist, avoiding duplicates
4890for xxx in $dlist
4891do
4892 if $test -d $xxx; then
4893 case " $libpth " in
4894 *" $xxx "*) ;;
4895 *) libpth="$libpth $xxx";;
4896 esac
4897 fi
4898done
4899$cat <<'EOM'
4900
4901Some systems have incompatible or broken versions of libraries. Among
4902the directories listed in the question below, please remove any you
4903know not to be holding relevant libraries, and add any that are needed.
4904Say "none" for none.
4905
4906EOM
4907
4908if test "X$sysroot" != X; then
4909 $cat <<EOM
4910You have set sysroot to $sysroot, please supply the directories excluding sysroot
4911
4912EOM
4913fi
4914
4915case "$libpth" in
4916'') dflt='none';;
4917*)
4918 set X $libpth
4919 shift
4920 dflt=${1+"$@"}
4921 ;;
4922esac
4923rp="Directories to use for library searches?"
4924. ./myread
4925case "$ans" in
4926none) libpth=' ';;
4927*) libpth="$ans";;
4928esac
4929
4930: compute shared library extension
4931case "$so" in
4932'')
4933 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4934 dflt='sl'
4935 else
4936 dflt='so'
4937 fi
4938 ;;
4939*) dflt="$so";;
4940esac
4941$cat <<EOM
4942
4943On some systems, shared libraries may be available. Answer 'none' if
4944you want to suppress searching of shared libraries for the remainder
4945of this configuration.
4946
4947EOM
4948rp='What is the file extension used for shared libraries?'
4949. ./myread
4950so="$ans"
4951
4952: Does target system insist that shared library basenames are unique
4953$cat << EOM
4954
4955Some dynamic loaders assume that the *basename* of shared library filenames
4956are globally unique. We'll default this to undef as we assume your system
4957is not this weird. Set to defined if you're on one of them.
4958
4959EOM
4960
4961dflt='n'
4962rp='Make shared library basenames unique?'
4963. ./myread
4964case "$ans" in
4965y|Y) val="$define" ;;
4966*) val="$undef" ;;
4967esac
4968set d_libname_unique
4969eval $setvar
4970
4971: Define several unixisms.
4972: Hints files or command line option can be used to override them.
4973: The convoluted testing is in case hints files set either the old
4974: or the new name.
4975case "$_exe" in
4976'') case "$exe_ext" in
4977 '') ;;
4978 *) _exe="$exe_ext" ;;
4979 esac
4980 ;;
4981esac
4982case "$_a" in
4983'') case "$lib_ext" in
4984 '') _a='.a';;
4985 *) _a="$lib_ext" ;;
4986 esac
4987 ;;
4988esac
4989case "$_o" in
4990'') case "$obj_ext" in
4991 '') _o='.o';;
4992 *) _o="$obj_ext";;
4993 esac
4994 ;;
4995esac
4996case "$p_" in
4997'') case "$path_sep" in
4998 '') p_=':';;
4999 *) p_="$path_sep";;
5000 esac
5001 ;;
5002esac
5003exe_ext=$_exe
5004lib_ext=$_a
5005obj_ext=$_o
5006path_sep=$p_
5007
5008rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
5009
5010: Which makefile gets called first. This is used by make depend.
5011case "$firstmakefile" in
5012'') firstmakefile='makefile';;
5013esac
5014
5015: Check is we will use socks
5016case "$usesocks" in
5017$define|true|[yY]*) dflt='y';;
5018*) dflt='n';;
5019esac
5020cat <<EOM
5021
5022Perl can be built to use the SOCKS proxy protocol library. To do so,
5023Configure must be run with -Dusesocks. If you use SOCKS you also need
5024to use the PerlIO abstraction layer, this will be implicitly selected.
5025
5026If this doesn't make any sense to you, just accept the default '$dflt'.
5027EOM
5028rp='Build Perl for SOCKS?'
5029. ./myread
5030case "$ans" in
5031y|Y) val="$define" ;;
5032*) val="$undef" ;;
5033esac
5034set usesocks
5035eval $setvar
5036
5037: Check for uselongdouble support
5038case "$ccflags" in
5039*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5040esac
5041
5042case "$uselongdouble" in
5043$define|true|[yY]*) dflt='y';;
5044*) dflt='n';;
5045esac
5046cat <<EOM
5047
5048Perl can be built to take advantage of long doubles which
5049(if available) may give more accuracy and range for floating point numbers.
5050
5051If this doesn't make any sense to you, just accept the default '$dflt'.
5052EOM
5053rp='Try to use long doubles if available?'
5054. ./myread
5055case "$ans" in
5056y|Y) val="$define" ;;
5057*) val="$undef" ;;
5058esac
5059set uselongdouble
5060eval $setvar
5061
5062case "$uselongdouble" in
5063true|[yY]*) uselongdouble="$define" ;;
5064esac
5065
5066: Look for a hint-file generated 'call-back-unit'. If the
5067: user has specified that long doubles should be used,
5068: we may need to set or change some other defaults.
5069if $test -f uselongdouble.cbu; then
5070 echo "Your platform has some specific hints regarding long doubles, using them..."
5071 . ./uselongdouble.cbu
5072else
5073 case "$uselongdouble" in
5074 $define)
5075 $cat <<EOM
5076(Your platform does not have any specific hints for long doubles.)
5077EOM
5078 ;;
5079 esac
5080fi
5081
5082: Looking for optional libraries
5083echo " "
5084echo "Checking for optional libraries..." >&4
5085case "$libs" in
5086' '|'') dflt='';;
5087*) dflt="$libs";;
5088esac
5089case "$libswanted" in
5090'') libswanted='c_s';;
5091esac
5092case "$usesocks" in
5093"$define") libswanted="$libswanted socks5 socks5_sh" ;;
5094esac
5095libsfound=''
5096libsfiles=''
5097libsdirs=''
5098libspath=''
5099for thisdir in $libpth $xlibpth; do
5100 test -d $thisdir && libspath="$libspath $thisdir"
5101done
5102for thislib in $libswanted; do
5103 for thisdir in $libspath; do
5104 xxx=''
5105 if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
5106 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
5107 $test -f "$xxx" && eval $libscheck
5108 $test -f "$xxx" && libstyle=shared
5109 fi
5110 if test ! -f "$xxx"; then
5111 xxx=$thisdir/lib$thislib.$so
5112 $test -f "$xxx" && eval $libscheck
5113 $test -f "$xxx" && libstyle=shared
5114 fi
5115 if test ! -f "$xxx"; then
5116 xxx=$thisdir/lib$thislib$_a
5117 $test -f "$xxx" && eval $libscheck
5118 $test -f "$xxx" && libstyle=static
5119 fi
5120 if test ! -f "$xxx"; then
5121 xxx=$thisdir/$thislib$_a
5122 $test -f "$xxx" && eval $libscheck
5123 $test -f "$xxx" && libstyle=static
5124 fi
5125 if test ! -f "$xxx"; then
5126 xxx=$thisdir/lib${thislib}_s$_a
5127 $test -f "$xxx" && eval $libscheck
5128 $test -f "$xxx" && libstyle=static
5129 $test -f "$xxx" && thislib=${thislib}_s
5130 fi
5131 if test ! -f "$xxx"; then
5132 xxx=$thisdir/Slib$thislib$_a
5133 $test -f "$xxx" && eval $libscheck
5134 $test -f "$xxx" && libstyle=static
5135 fi
5136 if $test -f "$xxx"; then
5137 case "$libstyle" in
5138 shared) echo "Found -l$thislib (shared)." ;;
5139 static) echo "Found -l$thislib." ;;
5140 *) echo "Found -l$thislib ($libstyle)." ;;
5141 esac
5142 case " $dflt " in
5143 *"-l$thislib "*);;
5144 *) dflt="$dflt -l$thislib"
5145 libsfound="$libsfound $xxx"
5146 yyy=`basename $xxx`
5147 libsfiles="$libsfiles $yyy"
5148 yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
5149 case " $libsdirs " in
5150 *" $yyy "*) ;;
5151 *) libsdirs="$libsdirs $yyy" ;;
5152 esac
5153 ;;
5154 esac
5155 break
5156 fi
5157 done
5158 if $test ! -f "$xxx"; then
5159 echo "No -l$thislib."
5160 fi
5161done
5162set X $dflt
5163shift
5164dflt="$*"
5165case "$libs" in
5166'') dflt="$dflt";;
5167*) dflt="$libs";;
5168esac
5169case "$dflt" in
5170' '|'') dflt='none';;
5171esac
5172
5173$cat <<EOM
5174
5175In order to compile $package on your machine, a number of libraries
5176are usually needed. Include any other special libraries here as well.
5177Say "none" for none. The default list is almost always right.
5178EOM
5179
5180echo " "
5181rp="What libraries to use?"
5182. ./myread
5183case "$ans" in
5184none) libs=' ';;
5185*) libs="$ans";;
5186esac
5187
5188: determine optimization, if desired, or use for debug flag also
5189case "$optimize" in
5190' '|$undef) dflt='none';;
5191'') dflt='-O';;
5192*) dflt="$optimize";;
5193esac
5194$cat <<EOH
5195
5196By default, $package compiles with the -O flag to use the optimizer.
5197Alternately, you might want to use the symbolic debugger, which uses
5198the -g flag (on traditional Unix systems). Either flag can be
5199specified here. To use neither flag, specify the word "none".
5200
5201EOH
5202rp="What optimizer/debugger flag should be used?"
5203. ./myread
5204optimize="$ans"
5205case "$optimize" in
5206'none') optimize=" ";;
5207esac
5208
5209: Check what DEBUGGING is required from the command line
5210: -DEBUGGING or -DDEBUGGING or
5211: -DEBUGGING=both = -g + -DDEBUGGING
5212: -DEBUGGING=-g or -Doptimize=-g = -g
5213: -DEBUGGING=none or -UDEBUGGING =
5214: -DEBUGGING=old or -DEBUGGING=default = ? $optimize
5215case "$EBUGGING" in
5216'') ;;
5217*) DEBUGGING=$EBUGGING ;;
5218esac
5219
5220case "$DEBUGGING" in
5221-g|both|$define)
5222 case "$optimize" in
5223 *-g*) ;;
5224 *) optimize="$optimize -g" ;;
5225 esac ;;
5226none|$undef)
5227 case "$optimize" in
5228 *-g*) set `echo "X $optimize " | sed 's/ -g / /'`
5229 shift
5230 optimize="$*"
5231 ;;
5232 esac ;;
5233esac
5234
5235dflt=''
5236case "$DEBUGGING" in
5237both|$define) dflt='-DDEBUGGING'
5238esac
5239
5240: argument order is deliberate, as the flag will start with - which set could
5241: think is an option
5242checkccflag='check=$1; flag=$2; callback=$3;
5243echo " ";
5244echo "Checking if your compiler accepts $flag" 2>&1;
5245[ "X$sysroot" != "X" ] && echo "For sysroot = $sysroot";
5246echo "int main(void) { return 0; }" > gcctest.c;
5247if $cc $_sysroot -O2 $flag -o gcctest gcctest.c 2>gcctest.out && $run ./gcctest; then
5248 echo "Yes, it does." 2>&1;
5249 if $test -s gcctest.out ; then
5250 echo "But your platform does not like it:";
5251 cat gcctest.out;
5252 else
5253 case "$ccflags" in
5254 *$check*)
5255 echo "Leaving current flags $ccflags alone." 2>&1
5256 ;;
5257 *) dflt="$dflt $flag";
5258 eval $callback
5259 ;;
5260 esac
5261 fi
5262else
5263 echo "Nope, it does not, but that is ok." 2>&1;
5264fi
5265'
5266
5267: We will not override a previous value, but we might want to
5268: augment a hint file
5269case "$hint" in
5270default|recommended)
5271 case "$gccversion" in
5272 1*) dflt="$dflt -fpcc-struct-return" ;;
5273 esac
5274 case "$optimize:$DEBUGGING" in
5275 *-g*:old) dflt="$dflt -DDEBUGGING";;
5276 esac
5277 case "$gccversion" in
5278 2*) if $test -d /etc/conf/kconfig.d &&
5279 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5280 then
5281 # Interactive Systems (ISC) POSIX mode.
5282 dflt="$dflt -posix"
5283 fi
5284 ;;
5285 esac
5286 case "$gccversion" in
5287 1*) ;;
5288 2.[0-8]*) ;;
5289 ?*) set strict-aliasing -fno-strict-aliasing
5290 eval $checkccflag
5291 ;;
5292 esac
5293 # For gcc, adding -pipe speeds up compilations for some, but apparently
5294 # some assemblers can't read from stdin. (It also slows down compilations
5295 # in other cases, but those are apparently rarer these days.) AD 5/2004.
5296 case "$gccversion" in
5297 ?*) set pipe -pipe
5298 eval $checkccflag
5299 ;;
5300 esac
5301
5302 # on x86_64 (at least) we require an extra library (libssp) in the
5303 # link command line. This library is not named, so I infer that it is
5304 # an implementation detail that may change. Hence the safest approach
5305 # is to add the flag to the flags passed to the compiler at link time,
5306 # as that way the compiler can do the right implementation dependant
5307 # thing. (NWC)
5308 case "$gccversion" in
5309 ?*) set stack-protector -fstack-protector
5310 eval $checkccflag
5311 ;;
5312 esac
5313 ;;
5314esac
5315
5316case "$mips_type" in
5317*BSD*|'') inclwanted="$locincpth $usrinc";;
5318*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5319esac
5320for thisincl in $inclwanted; do
5321 if $test -d $thisincl; then
5322 if $test x$thisincl != x$usrinc; then
5323 case "$dflt" in
5324 *" -I$thisincl "*);;
5325 *) dflt="$dflt -I$thisincl ";;
5326 esac
5327 fi
5328 fi
5329done
5330
5331inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5332 xxx=true;
5333elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5334 xxx=true;
5335else
5336 xxx=false;
5337fi;
5338if $xxx; then
5339 case "$dflt" in
5340 *$2*);;
5341 *) dflt="$dflt -D$2";;
5342 esac;
5343fi'
5344
5345set signal.h LANGUAGE_C; eval $inctest
5346
5347case "$usesocks" in
5348$define)
5349 ccflags="$ccflags -DSOCKS"
5350 ;;
5351esac
5352
5353case "$hint" in
5354default|recommended) dflt="$ccflags $dflt" ;;
5355*) dflt="$ccflags";;
5356esac
5357
5358case "$dflt" in
5359''|' ') dflt=none;;
5360esac
5361
5362$cat <<EOH
5363
5364Your C compiler may want other flags. For this question you should include
5365-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5366but you should NOT include libraries or ld flags like -lwhatever. If you
5367want $package to honor its debug switch, you should include -DDEBUGGING here.
5368Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5369
5370To use no flags, specify the word "none".
5371
5372EOH
5373set X $dflt
5374shift
5375dflt=${1+"$@"}
5376rp="Any additional cc flags?"
5377. ./myread
5378case "$ans" in
5379none) ccflags='';;
5380*) ccflags="$ans";;
5381esac
5382
5383: the following weeds options from ccflags that are of no interest to cpp
5384case "$cppflags" in
5385'') cppflags="$ccflags" ;;
5386*) cppflags="$cppflags $ccflags" ;;
5387esac
5388case "$gccversion" in
53891*) cppflags="$cppflags -D__GNUC__"
5390esac
5391case "$mips_type" in
5392'');;
5393*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5394esac
5395case "$cppflags" in
5396'');;
5397*)
5398 echo " "
5399 echo "Let me guess what the preprocessor flags are..." >&4
5400 set X $cppflags
5401 shift
5402 cppflags=''
5403 $cat >cpp.c <<'EOM'
5404#define BLURFL foo
5405
5406BLURFL xx LFRULB
5407EOM
5408 previous=''
5409 for flag in $*
5410 do
5411 case "$flag" in
5412 -*) ftry="$flag";;
5413 *) ftry="$previous $flag";;
5414 esac
5415 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5416 >cpp1.out 2>/dev/null && \
5417 $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5418 >cpp2.out 2>/dev/null && \
5419 $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5420 $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5421 then
5422 cppflags="$cppflags $ftry"
5423 previous=''
5424 else
5425 previous="$flag"
5426 fi
5427 done
5428 set X $cppflags
5429 shift
5430 cppflags=${1+"$@"}
5431 case "$cppflags" in
5432 *-*) echo "They appear to be: $cppflags";;
5433 esac
5434 $rm -f cpp.c cpp?.out
5435 ;;
5436esac
5437
5438: flags used in final linking phase
5439case "$ldflags" in
5440'') if ./venix; then
5441 dflt='-i -z'
5442 else
5443 dflt=''
5444 fi
5445 case "$ccflags" in
5446 *-posix*) dflt="$dflt -posix" ;;
5447 esac
5448 ;;
5449*) dflt="$ldflags";;
5450esac
5451# See note above about -fstack-protector
5452case "$ccflags" in
5453*-fstack-protector*)
5454 case "$dflt" in
5455 *-fstack-protector*) ;; # Don't add it again
5456 *) dflt="$dflt -fstack-protector" ;;
5457 esac
5458 ;;
5459esac
5460
5461: Try to guess additional flags to pick up local libraries.
5462for thislibdir in $libpth; do
5463 case " $loclibpth " in
5464 *" $thislibdir "*)
5465 case "$dflt " in
5466 *"-L$thislibdir "*) ;;
5467 *) dflt="$dflt -L$thislibdir" ;;
5468 esac
5469 ;;
5470 esac
5471done
5472
5473case "$dflt" in
5474'') dflt='none' ;;
5475esac
5476
5477$cat <<EOH
5478
5479Your C linker may need flags. For this question you should
5480include -L/whatever and any other flags used by the C linker, but you
5481should NOT include libraries like -lwhatever.
5482
5483Make sure you include the appropriate -L/path flags if your C linker
5484does not normally search all of the directories you specified above,
5485namely
5486 $libpth
5487To use no flags, specify the word "none".
5488
5489EOH
5490
5491rp="Any additional ld flags (NOT including libraries)?"
5492. ./myread
5493case "$ans" in
5494none) ldflags='';;
5495*) ldflags="$ans";;
5496esac
5497rmlist="$rmlist pdp11"
5498
5499: coherency check
5500echo " "
5501echo "Checking your choice of C compiler and flags for coherency..." >&4
5502$cat > try.c <<'EOF'
5503#include <stdio.h>
5504int main() { printf("Ok\n"); return(0); }
5505EOF
5506set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5507shift
5508$cat >try.msg <<'EOM'
5509I've tried to compile and run the following simple program:
5510
5511EOM
5512$cat try.c >> try.msg
5513
5514$cat >> try.msg <<EOM
5515
5516I used the command:
5517
5518 $*
5519 $run ./try
5520
5521and I got the following output:
5522
5523EOM
5524dflt=y
5525if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5526 if $sh -c "$run ./try " >>try.msg 2>&1; then
5527 xxx=`$run ./try`
5528 case "$xxx" in
5529 "Ok") dflt=n ;;
5530 *) echo 'The program compiled OK, but produced no output.' >> try.msg ;;
5531 esac
5532 else
5533 echo "The program compiled OK, but exited with status $?." >>try.msg
5534 rp="You have a problem. Shall I abort Configure"
5535 dflt=y
5536 fi
5537else
5538 echo "I can't compile the test program." >>try.msg
5539 rp="You have a BIG problem. Shall I abort Configure"
5540 dflt=y
5541fi
5542case "$dflt" in
5543y)
5544 $cat try.msg >&4
5545 case "$knowitall" in
5546 '')
5547 echo "(The supplied flags or libraries might be incorrect.)"
5548 ;;
5549 *) dflt=n;;
5550 esac
5551 echo " "
5552 . ./myread
5553 case "$ans" in
5554 n*|N*) ;;
5555 *) echo "Ok. Stopping Configure." >&4
5556 exit 1
5557 ;;
5558 esac
5559 ;;
5560n) echo "OK, that should do.";;
5561esac
5562$rm_try gcctest gcctest.out
5563
5564: define a shorthand compile call
5565compile='
5566mc_file=$1;
5567shift;
5568case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5569echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5570exit 1;
5571fi;
5572esac;
5573$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5574: define a shorthand compile call for compilations that should be ok.
5575compile_ok='
5576mc_file=$1;
5577shift;
5578$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5579
5580: determine filename position in cpp output
5581echo " "
5582echo "Computing filename position in cpp output for #include directives..." >&4
5583case "$osname" in
5584vos) testaccess=-e ;;
5585*) testaccess=-r ;;
5586esac
5587echo '#include <stdio.h>' > foo.c
5588$cat >fieldn <<EOF
5589$startsh
5590$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5591$grep '^[ ]*#.*stdio\.h' | \
5592while read cline; do
5593 pos=1
5594 set \$cline
5595 while $test \$# -gt 0; do
5596 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5597 echo "\$pos"
5598 exit 0
5599 fi
5600 shift
5601 pos=\`expr \$pos + 1\`
5602 done
5603done
5604EOF
5605chmod +x fieldn
5606fieldn=`./fieldn`
5607$rm -f foo.c fieldn
5608case $fieldn in
5609'') pos='???';;
56101) pos=first;;
56112) pos=second;;
56123) pos=third;;
5613*) pos="${fieldn}th";;
5614esac
5615echo "Your cpp writes the filename in the $pos field of the line."
5616
5617: locate header file
5618$cat >findhdr <<EOF
5619$startsh
5620wanted=\$1
5621name=''
5622for usrincdir in $incpth
5623do
5624 if test -f \$usrincdir/\$wanted; then
5625 echo "\$usrincdir/\$wanted"
5626 exit 0
5627 fi
5628done
5629awkprg='{ print \$$fieldn }'
5630echo "#include <\$wanted>" > foo\$\$.c
5631$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5632$cppfilter $grep "^[ ]*#.*\$wanted" | \
5633while read cline; do
5634 name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5635 case "\$name" in
5636 *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5637 *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5638 *) exit 2;;
5639 esac;
5640done;
5641#
5642# status = 0: grep returned 0 lines, case statement not executed
5643# status = 1: headerfile found
5644# status = 2: while loop executed, no headerfile found
5645#
5646status=\$?
5647$rm -f foo\$\$.c;
5648if test \$status -eq 1; then
5649 exit 0;
5650fi
5651exit 1
5652EOF
5653chmod +x findhdr
5654
5655: define an alternate in-header-list? function
5656inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5657cont=true; xxf="echo \"<\$1> found.\" >&4";
5658case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5659*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5660esac;
5661case $# in 4) instead=instead;; *) instead="at last";; esac;
5662while $test "$cont"; do
5663 xxx=`./findhdr $1`
5664 var=$2; eval "was=\$$2";
5665 if $test "$xxx" && $test -r "$xxx";
5666 then eval $xxf;
5667 eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5668 cont="";
5669 else eval $xxnf;
5670 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5671 set $yyy; shift; shift; yyy=$@;
5672 case $# in 0) cont="";;
5673 2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5674 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5675 *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5676 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5677 esac;
5678done;
5679while $test "$yyy";
5680do set $yyy; var=$2; eval "was=\$$2";
5681 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5682 set $yyy; shift; shift; yyy=$@;
5683done'
5684
5685: see if stdlib is available
5686set stdlib.h i_stdlib
5687eval $inhdr
5688
5689: check for lengths of integral types
5690echo " "
5691case "$intsize" in
5692'')
5693 echo "Checking to see how big your integers are..." >&4
5694 $cat >try.c <<EOCP
5695#include <stdio.h>
5696#$i_stdlib I_STDLIB
5697#ifdef I_STDLIB
5698#include <stdlib.h>
5699#endif
5700int main()
5701{
5702 printf("intsize=%d;\n", (int)sizeof(int));
5703 printf("longsize=%d;\n", (int)sizeof(long));
5704 printf("shortsize=%d;\n", (int)sizeof(short));
5705 exit(0);
5706}
5707EOCP
5708 set try
5709 if eval $compile_ok && $run ./try > /dev/null; then
5710 eval `$run ./try`
5711 echo "Your integers are $intsize bytes long."
5712 echo "Your long integers are $longsize bytes long."
5713 echo "Your short integers are $shortsize bytes long."
5714 else
5715 $cat >&4 <<EOM
5716!
5717Help! I can't compile and run the intsize test program: please enlighten me!
5718(This is probably a misconfiguration in your system or libraries, and
5719you really ought to fix it. Still, I'll try anyway.)
5720!
5721EOM
5722 dflt=4
5723 rp="What is the size of an integer (in bytes)?"
5724 . ./myread
5725 intsize="$ans"
5726 dflt=$intsize
5727 rp="What is the size of a long integer (in bytes)?"
5728 . ./myread
5729 longsize="$ans"
5730 dflt=2
5731 rp="What is the size of a short integer (in bytes)?"
5732 . ./myread
5733 shortsize="$ans"
5734 fi
5735 ;;
5736esac
5737$rm_try
5738
5739: check for long long
5740echo " "
5741echo "Checking to see if you have long long..." >&4
5742echo 'int main() { long long x = 7; return 0; }' > try.c
5743set try
5744if eval $compile; then
5745 val="$define"
5746 echo "You have long long."
5747else
5748 val="$undef"
5749 echo "You do not have long long."
5750fi
5751$rm_try
5752set d_longlong
5753eval $setvar
5754
5755: check for length of long long
5756case "${d_longlong}${longlongsize}" in
5757$define)
5758 echo " "
5759 echo "Checking to see how big your long longs are..." >&4
5760 $cat >try.c <<'EOCP'
5761#include <stdio.h>
5762int main()
5763{
5764 printf("%d\n", (int)sizeof(long long));
5765 return(0);
5766}
5767EOCP
5768 set try
5769 if eval $compile_ok; then
5770 longlongsize=`$run ./try`
5771 echo "Your long longs are $longlongsize bytes long."
5772 else
5773 dflt='8'
5774 echo " "
5775 echo "(I can't seem to compile the test program. Guessing...)"
5776 rp="What is the size of a long long (in bytes)?"
5777 . ./myread
5778 longlongsize="$ans"
5779 fi
5780 if $test "X$longsize" = "X$longlongsize"; then
5781 echo "(That isn't any different from an ordinary long.)"
5782 fi
5783 ;;
5784esac
5785$rm_try
5786
5787: see if inttypes.h is available
5788: we want a real compile instead of Inhdr because some systems
5789: have an inttypes.h which includes non-existent headers
5790echo " "
5791$cat >try.c <<EOCP
5792#include <inttypes.h>
5793int main() {
5794 static int32_t foo32 = 0x12345678;
5795}
5796EOCP
5797set try
5798if eval $compile; then
5799 echo "<inttypes.h> found." >&4
5800 val="$define"
5801else
5802 echo "<inttypes.h> NOT found." >&4
5803 val="$undef"
5804fi
5805$rm_try
5806set i_inttypes
5807eval $setvar
5808
5809: check for int64_t
5810echo " "
5811echo "Checking to see if you have int64_t..." >&4
5812$cat >try.c <<EOCP
5813#include <sys/types.h>
5814#$i_inttypes I_INTTYPES
5815#ifdef I_INTTYPES
5816#include <inttypes.h>
5817#endif
5818int main() { int64_t x = 7; }
5819EOCP
5820set try
5821if eval $compile; then
5822 val="$define"
5823 echo "You have int64_t."
5824else
5825 val="$undef"
5826 echo "You do not have int64_t."
5827fi
5828$rm_try
5829set d_int64_t
5830eval $setvar
5831
5832: Check if 64bit ints have a quad type
5833echo " "
5834echo "Checking which 64-bit integer type we could use..." >&4
5835
5836case "$intsize" in
58378) val=int
5838 set quadtype
5839 eval $setvar
5840 val='"unsigned int"'
5841 set uquadtype
5842 eval $setvar
5843 quadkind=1
5844 ;;
5845*) case "$longsize" in
5846 8) val=long
5847 set quadtype
5848 eval $setvar
5849 val='"unsigned long"'
5850 set uquadtype
5851 eval $setvar
5852 quadkind=2
5853 ;;
5854 *) case "$d_longlong:$longlongsize" in
5855 define:8)
5856 val='"long long"'
5857 set quadtype
5858 eval $setvar
5859 val='"unsigned long long"'
5860 set uquadtype
5861 eval $setvar
5862 quadkind=3
5863 ;;
5864 *) case "$d_int64_t" in
5865 define)
5866 val=int64_t
5867 set quadtype
5868 eval $setvar
5869 val=uint64_t
5870 set uquadtype
5871 eval $setvar
5872 quadkind=4
5873 ;;
5874 esac
5875 ;;
5876 esac
5877 ;;
5878 esac
5879 ;;
5880esac
5881
5882case "$quadtype" in
5883'') echo "Alas, no 64-bit integer types in sight." >&4
5884 d_quad="$undef"
5885 ;;
5886*) echo "We could use '$quadtype' for 64-bit integers." >&4
5887 d_quad="$define"
5888 ;;
5889esac
5890
5891: Do we want 64bit support
5892case "$uselonglong" in
5893"$define"|true|[yY]*)
5894 cat <<EOM >&4
5895
5896*** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5897EOM
5898 use64bitint="$define"
5899 ;;
5900esac
5901case "$use64bits" in
5902"$define"|true|[yY]*)
5903 cat <<EOM >&4
5904
5905*** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5906EOM
5907 use64bitint="$define"
5908 ;;
5909esac
5910case "$use64bitints" in
5911"$define"|true|[yY]*)
5912 cat <<EOM >&4
5913
5914*** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5915EOM
5916 use64bitint="$define"
5917 ;;
5918esac
5919case "$use64bitsint" in
5920"$define"|true|[yY]*)
5921 cat <<EOM >&4
5922
5923*** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5924EOM
5925 use64bitint="$define"
5926 ;;
5927esac
5928case "$uselonglongs" in
5929"$define"|true|[yY]*)
5930 cat <<EOM >&4
5931
5932*** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5933EOM
5934 use64bitint="$define"
5935 ;;
5936esac
5937case "$use64bitsall" in
5938"$define"|true|[yY]*)
5939 cat <<EOM >&4
5940
5941*** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5942EOM
5943 use64bitall="$define"
5944 ;;
5945esac
5946
5947case "$ccflags" in
5948*-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5949esac
5950case "$use64bitall" in
5951"$define"|true|[yY]*) use64bitint="$define" ;;
5952esac
5953
5954case "$longsize" in
59558) cat <<EOM
5956
5957You have natively 64-bit long integers.
5958EOM
5959 val="$define"
5960 ;;
5961*) case "$use64bitint" in
5962 "$define"|true|[yY]*) dflt='y';;
5963 *) dflt='n';;
5964 esac
5965 case "$d_quad" in
5966 "$define") ;;
5967 *) dflt='n' ;;
5968 esac
5969 cat <<EOM
5970
5971Perl can be built to take advantage of 64-bit integer types
5972on some systems. To do so, Configure can be run with -Duse64bitint.
5973Choosing this option will most probably introduce binary incompatibilities.
5974
5975If this doesn't make any sense to you, just accept the default '$dflt'.
5976(The default has been chosen based on your configuration.)
5977EOM
5978 rp='Try to use 64-bit integers, if available?'
5979 . ./myread
5980 case "$ans" in
5981 [yY]*) val="$define" ;;
5982 *) val="$undef" ;;
5983 esac
5984 ;;
5985esac
5986set use64bitint
5987eval $setvar
5988
5989case "$use64bitall" in
5990"$define"|true|[yY]*) dflt='y' ;;
5991*) case "$longsize" in
5992 8) dflt='y' ;;
5993 *) dflt='n' ;;
5994 esac
5995 ;;
5996esac
5997cat <<EOM
5998
5999You may also choose to try maximal 64-bitness. It means using as much
600064-bitness as possible on the platform. This in turn means even more
6001binary incompatibilities. On the other hand, your platform may not
6002have any more 64-bitness available than what you already have chosen.
6003
6004If this doesn't make any sense to you, just accept the default '$dflt'.
6005(The default has been chosen based on your configuration.)
6006EOM
6007rp='Try to use maximal 64-bit support, if available?'
6008. ./myread
6009case "$ans" in
6010[yY]*) val="$define" ;;
6011*) val="$undef" ;;
6012esac
6013set use64bitall
6014eval $setvar
6015case "$use64bitall" in
6016"$define")
6017 case "$use64bitint" in
6018 "$undef")
6019 cat <<EOM
6020
6021Since you have chosen a maximally 64-bit build, I'm also turning on
6022the use of 64-bit integers.
6023EOM
6024 use64bitint="$define" ;;
6025 esac
6026 ;;
6027esac
6028
6029: Look for a hint-file generated 'call-back-unit'. If the
6030: user has specified that a 64-bit perl is to be built,
6031: we may need to set or change some other defaults.
6032if $test -f use64bitint.cbu; then
6033 echo "Your platform has some specific hints regarding 64-bit integers, using them..."
6034 . ./use64bitint.cbu
6035fi
6036case "$use64bitint" in
6037"$define"|true|[yY]*)
6038 : This test was common to all the OpenBSD forks, and seems harmless for
6039 : other platforms:
6040 echo " "
6041 echo "Checking if your C library has broken 64-bit functions..." >&4
6042 cat >try.c <<EOCP
6043#include <stdio.h>
6044typedef $uquadtype myULL;
6045int main (void)
6046{
6047 struct {
6048 double d;
6049 myULL u;
6050 } *p, test[] = {
6051 {4294967303.15, 4294967303ULL},
6052 {4294967294.2, 4294967294ULL},
6053 {4294967295.7, 4294967295ULL},
6054 {0.0, 0ULL}
6055 };
6056 for (p = test; p->u; p++) {
6057 myULL x = (myULL)p->d;
6058 if (x != p->u) {
6059 printf("buggy\n");
6060 return 0;
6061 }
6062 }
6063 printf("ok\n");
6064 return 0;
6065}
6066EOCP
6067 set try
6068 if eval $compile_ok; then
6069 libcquad=`$run ./try`
6070 echo "Your C library's 64-bit functions are $libcquad."
6071 else
6072 echo "(I can't seem to compile the test program.)"
6073 echo "Assuming that your C library's 64-bit functions are ok."
6074 libcquad="ok"
6075 fi
6076 $rm_try
6077
6078 case "$libcquad" in
6079 buggy*)
6080 cat >&4 <<EOM
6081
6082*** You have a C library with broken 64-bit functions.
6083*** 64-bit support does not work reliably in this configuration.
6084*** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6085*** Cannot continue, aborting.
6086
6087EOM
6088 exit 1
6089 ;;
6090 esac
6091 case "$longsize" in
6092 4) case "$archname64" in
6093 '') archname64=64int ;;
6094 esac
6095 ;;
6096 esac
6097 ;;
6098esac
6099
6100: Look for a hint-file generated 'call-back-unit'. If the
6101: user has specified that a maximally 64-bit perl is to be built,
6102: we may need to set or change some other defaults.
6103if $test -f use64bitall.cbu; then
6104 echo "Your platform has some specific hints regarding 64-bit builds, using them..."
6105 . ./use64bitall.cbu
6106fi
6107case "$use64bitall" in
6108"$define"|true|[yY]*)
6109 case "$longsize" in
6110 4) case "$archname64" in
6111 ''|64int) archname64=64all ;;
6112 esac
6113 ;;
6114 esac
6115 ;;
6116esac
6117
6118case "$d_quad:$use64bitint" in
6119$undef:$define)
6120 cat >&4 <<EOF
6121
6122*** You have chosen to use 64-bit integers,
6123*** but none can be found.
6124*** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6125*** Cannot continue, aborting.
6126
6127EOF
6128 exit 1
6129 ;;
6130esac
6131
6132: check for length of double
6133echo " "
6134case "$doublesize" in
6135'')
6136 echo "Checking to see how big your double precision numbers are..." >&4
6137 $cat >try.c <<EOCP
6138#include <stdio.h>
6139#$i_stdlib I_STDLIB
6140#ifdef I_STDLIB
6141#include <stdlib.h>
6142#endif
6143int main()
6144{
6145 printf("%d\n", (int)sizeof(double));
6146 exit(0);
6147}
6148EOCP
6149 set try
6150 if eval $compile_ok; then
6151 doublesize=`$run ./try`
6152 echo "Your double is $doublesize bytes long."
6153 else
6154 dflt='8'
6155 echo "(I can't seem to compile the test program. Guessing...)"
6156 rp="What is the size of a double precision number (in bytes)?"
6157 . ./myread
6158 doublesize="$ans"
6159 fi
6160 ;;
6161esac
6162$rm_try
6163
6164: check for long doubles
6165echo " "
6166echo "Checking to see if you have long double..." >&4
6167echo 'int main() { long double x = 7.0; }' > try.c
6168set try
6169if eval $compile; then
6170 val="$define"
6171 echo "You have long double."
6172else
6173 val="$undef"
6174 echo "You do not have long double."
6175fi
6176$rm_try
6177set d_longdbl
6178eval $setvar
6179
6180: check for length of long double
6181case "${d_longdbl}${longdblsize}" in
6182$define)
6183 echo " "
6184 echo "Checking to see how big your long doubles are..." >&4
6185 $cat >try.c <<'EOCP'
6186#include <stdio.h>
6187int main()
6188{
6189 printf("%d\n", sizeof(long double));
6190}
6191EOCP
6192 set try
6193 set try
6194 if eval $compile; then
6195 longdblsize=`$run ./try`
6196 echo "Your long doubles are $longdblsize bytes long."
6197 else
6198 dflt='8'
6199 echo " "
6200 echo "(I can't seem to compile the test program. Guessing...)" >&4
6201 rp="What is the size of a long double (in bytes)?"
6202 . ./myread
6203 longdblsize="$ans"
6204 fi
6205 if $test "X$doublesize" = "X$longdblsize"; then
6206 echo "That isn't any different from an ordinary double."
6207 echo "I'll keep your setting anyway, but you may see some"
6208 echo "harmless compilation warnings."
6209 fi
6210 ;;
6211esac
6212$rm_try
6213
6214: determine the architecture name
6215echo " "
6216if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6217 tarch=`arch`"-$osname"
6218elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6219 if uname -m > tmparch 2>&1 ; then
6220 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6221 -e 's/$/'"-$osname/" tmparch`
6222 else
6223 tarch="$osname"
6224 fi
6225 $rm -f tmparch
6226else
6227 tarch="$osname"
6228fi
6229case "$myarchname" in
6230''|"$tarch") ;;
6231*)
6232 echo "(Your architecture name used to be $myarchname.)"
6233 archname=''
6234 ;;
6235esac
6236case "$targetarch" in
6237'') ;;
6238*) archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6239esac
6240myarchname="$tarch"
6241case "$archname" in
6242'') dflt="$tarch";;
6243*) dflt="$archname";;
6244esac
6245rp='What is your architecture name'
6246. ./myread
6247archname="$ans"
6248
6249: optionally add API version to the architecture for versioned archlibs
6250case "$useversionedarchname" in
6251$define|true|[yY]*) dflt='y';;
6252*) dflt='n';;
6253esac
6254rp='Add the Perl API version to your archname?'
6255. ./myread
6256case "$ans" in
6257y|Y) useversionedarchname="$define" ;;
6258*) useversionedarchname="$undef" ;;
6259esac
6260case "$useversionedarchname" in
6261$define)
6262 case "$archname" in
6263 *-$api_versionstring)
6264 echo "...and architecture name already has -$api_versionstring" >&4
6265 ;;
6266 *)
6267 archname="$archname-$api_versionstring"
6268 echo "...setting architecture name to $archname." >&4
6269 ;;
6270 esac
6271 ;;
6272esac
6273
6274case "$usethreads" in
6275$define)
6276 echo "Threads selected." >&4
6277 case "$archname" in
6278 *-thread*) echo "...and architecture name already has -thread." >&4
6279 ;;
6280 *) archname="$archname-thread"
6281 echo "...setting architecture name to $archname." >&4
6282 ;;
6283 esac
6284 ;;
6285esac
6286case "$usemultiplicity" in
6287$define)
6288 echo "Multiplicity selected." >&4
6289 case "$archname" in
6290 *-multi*) echo "...and architecture name already has -multi." >&4
6291 ;;
6292 *) archname="$archname-multi"
6293 echo "...setting architecture name to $archname." >&4
6294 ;;
6295 esac
6296 ;;
6297esac
6298case "$use64bitint$use64bitall" in
6299*"$define"*)
6300 case "$archname64" in
6301 '')
6302 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6303 ;;
6304 *)
6305 case "$use64bitint" in
6306 "$define") echo "64 bit integers selected." >&4 ;;
6307 esac
6308 case "$use64bitall" in
6309 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6310 esac
6311 case "$archname" in
6312 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6313 ;;
6314 *) archname="$archname-$archname64"
6315 echo "...setting architecture name to $archname." >&4
6316 ;;
6317 esac
6318 ;;
6319 esac
6320esac
6321case "$uselongdouble" in
6322$define)
6323 echo "Long doubles selected." >&4
6324 case "$longdblsize" in
6325 $doublesize)
6326 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6327 ;;
6328 *)
6329 case "$archname" in
6330 *-ld*) echo "...and architecture name already has -ld." >&4
6331 ;;
6332 *) archname="$archname-ld"
6333 echo "...setting architecture name to $archname." >&4
6334 ;;
6335 esac
6336 ;;
6337 esac
6338 ;;
6339esac
6340if $test -f archname.cbu; then
6341 echo "Your platform has some specific hints for architecture name, using them..."
6342 . ./archname.cbu
6343fi
6344
6345: set the prefixit variable, to compute a suitable default value
6346prefixit='case "$3" in
6347""|none)
6348 case "$oldprefix" in
6349 "") eval "$1=\"\$$2\"";;
6350 *)
6351 case "$3" in
6352 "") eval "$1=";;
6353 none)
6354 eval "tp=\"\$$2\"";
6355 case "$tp" in
6356 ""|" ") eval "$1=\"\$$2\"";;
6357 *) eval "$1=";;
6358 esac;;
6359 esac;;
6360 esac;;
6361*)
6362 eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6363 case "$tp" in
6364 --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6365 /*-$oldprefix/*|\~*-$oldprefix/*)
6366 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6367 *) eval "$1=\"\$$2\"";;
6368 esac;;
6369esac'
6370
6371: determine installation style
6372: For now, try to deduce it from prefix unless it is already set.
6373: Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6374case "$installstyle" in
6375'') case "$prefix" in
6376 *perl*) dflt='lib';;
6377 *) dflt='lib/perl5' ;;
6378 esac
6379 ;;
6380*) dflt="$installstyle" ;;
6381esac
6382: Probably not worth prompting for this since we prompt for all
6383: the directories individually, and the prompt would be too long and
6384: confusing anyway.
6385installstyle=$dflt
6386
6387: determine where public executables go
6388echo " "
6389set dflt bin bin
6390eval $prefixit
6391fn=d~
6392rp='Pathname where the public executables will reside?'
6393. ./getfile
6394if $test "X$ansexp" != "X$binexp"; then
6395 installbin=''
6396fi
6397prefixvar=bin
6398: XXX Bug? -- ignores Configure -Dinstallprefix setting.
6399: XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6400: this via initialinstalllocation
6401. ./setprefixvar
6402
6403case "$userelocatableinc" in
6404$define|true|[yY]*) dflt='y' ;;
6405*) dflt='n' ;;
6406esac
6407cat <<EOM
6408
6409Would you like to build Perl so that the installation is relocatable, so that
6410library paths in @INC are determined relative to the path of the perl binary?
6411This is not advised for system Perl installs, or if you need to run setid
6412scripts or scripts under taint mode.
6413
6414If this doesn't make any sense to you, just accept the default '$dflt'.
6415EOM
6416rp='Use relocatable @INC?'
6417. ./myread
6418case "$ans" in
6419y|Y) val="$define" ;;
6420*) val="$undef" ;;
6421esac
6422set userelocatableinc
6423eval $setvar
6424
6425initialinstalllocation="$binexp"
6426: Default prefix is now "up one level from where the binaries are"
6427case "$userelocatableinc" in
6428$define|true|[yY]*)
6429 bin=".../"
6430 binexp=".../"
6431 prefix=".../.."
6432 prefixexp=".../.."
6433 installprefixexp=".../.."
6434 ;;
6435esac
6436
6437: determine where private library files go
6438: Usual default is /usr/local/lib/perl5/$version.
6439: Also allow things like /opt/perl/lib/$version, since
6440: /opt/perl/lib/perl5... would be redundant.
6441: The default "style" setting is made in installstyle.U
6442case "$installstyle" in
6443*lib/perl5*) set dflt privlib lib/$package/$version ;;
6444*) set dflt privlib lib/$version ;;
6445esac
6446eval $prefixit
6447$cat <<EOM
6448
6449There are some auxiliary files for $package that need to be put into a
6450private library directory that is accessible by everyone.
6451
6452EOM
6453fn=$binexp
6454fn=d~+
6455rp='Pathname where the private library files will reside?'
6456. ./getfile
6457prefixvar=privlib
6458. ./setprefixvar
6459
6460: set the prefixup variable, to restore leading tilda escape
6461prefixup='case "$prefixexp" in
6462"$prefix") ;;
6463*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6464esac'
6465
6466: determine where public architecture dependent libraries go
6467set archlib archlib
6468eval $prefixit
6469: privlib default is /usr/local/lib/$package/$version
6470: archlib default is /usr/local/lib/$package/$version/$archname
6471: privlib may have an optional trailing /share.
6472tdflt=`echo $privlib | $sed 's,/share$,,'`
6473tdflt=$tdflt/$archname
6474case "$archlib" in
6475'') dflt=$tdflt
6476 ;;
6477*) dflt="$archlib"
6478 ;;
6479esac
6480$cat <<EOM
6481
6482$spackage contains architecture-dependent library files. If you are
6483sharing libraries in a heterogeneous environment, you might store
6484these files in a separate location. Otherwise, you can just include
6485them with the rest of the public library files.
6486
6487EOM
6488fn=$binexp
6489fn=d+~
6490rp='Where do you want to put the public architecture-dependent libraries?'
6491. ./getfile
6492prefixvar=archlib
6493. ./setprefixvar
6494if $test X"$archlib" = X"$privlib"; then
6495 d_archlib="$undef"
6496else
6497 d_archlib="$define"
6498fi
6499
6500: see if setuid scripts can be secure
6501$cat <<EOM
6502
6503Some kernels have a bug that prevents setuid #! scripts from being
6504secure. Some sites have disabled setuid #! scripts because of this.
6505
6506First let's decide if your kernel supports secure setuid #! scripts.
6507(If setuid #! scripts would be secure but have been disabled anyway,
6508don't say that they are secure if asked.)
6509
6510EOM
6511
6512val="$undef"
6513if $test -d /dev/fd; then
6514 echo "#!$ls" >reflect
6515 chmod +x,u+s reflect
6516 ./reflect >flect 2>&1
6517 if $contains "/dev/fd" flect >/dev/null; then
6518 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6519 val="$define"
6520 else
6521 $cat <<EOM
6522If you are not sure if they are secure, I can check but I'll need a
6523username and password different from the one you are using right now.
6524If you don't have such a username or don't want me to test, simply
6525enter 'none'.
6526
6527EOM
6528 rp='Other username to test security of setuid scripts with?'
6529 dflt='none'
6530 . ./myread
6531 case "$ans" in
6532 n|none)
6533 case "$d_suidsafe" in
6534 '') echo "I'll assume setuid scripts are *not* secure." >&4
6535 dflt=n;;
6536 "$undef")
6537 echo "Well, the $hint value is *not* secure." >&4
6538 dflt=n;;
6539 *) echo "Well, the $hint value *is* secure." >&4
6540 dflt=y;;
6541 esac
6542 ;;
6543 *)
6544 $rm -f reflect flect
6545 echo "#!$ls" >reflect
6546 chmod +x,u+s reflect
6547 echo >flect
6548 chmod a+w flect
6549 echo '"su" will (probably) prompt you for '"$ans's password."
6550 su $ans -c './reflect >flect'
6551 if $contains "/dev/fd" flect >/dev/null; then
6552 echo "Okay, it looks like setuid scripts are secure." >&4
6553 dflt=y
6554 else
6555 echo "I don't think setuid scripts are secure." >&4
6556 dflt=n
6557 fi
6558 ;;
6559 esac
6560 rp='Does your kernel have *secure* setuid scripts?'
6561 . ./myread
6562 case "$ans" in
6563 [yY]*) val="$define";;
6564 *) val="$undef";;
6565 esac
6566 fi
6567else
6568 echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6569 echo "(That's for file descriptors, not floppy disks.)"
6570 val="$undef"
6571fi
6572set d_suidsafe
6573eval $setvar
6574
6575$rm -f reflect flect
6576
6577: now see if they want to do setuid emulation
6578if $test $patchlevel -lt 11; then
6579echo " "
6580val="$undef"
6581case "$d_suidsafe" in
6582"$define")
6583 val="$undef"
6584 echo "No need to emulate SUID scripts since they are secure here." >&4
6585 ;;
6586*)
6587 $cat <<EOM
6588Some systems have disabled setuid scripts, especially systems where
6589setuid scripts cannot be secure. On systems where setuid scripts have
6590been disabled, the setuid/setgid bits on scripts are currently
6591useless. It is possible for $package to detect those bits and emulate
6592setuid/setgid in a secure fashion. This emulation will only work if
6593setuid scripts have been disabled in your kernel.
6594
6595EOM
6596 case "$d_dosuid" in
6597 "$define") dflt=y ;;
6598 *) dflt=n ;;
6599 esac
6600 rp="Do you want to do setuid/setgid emulation?"
6601 . ./myread
6602 case "$ans" in
6603 [yY]*) val="$define";;
6604 *) val="$undef";;
6605 esac
6606 ;;
6607esac
6608set d_dosuid
6609eval $setvar
6610else
6611 case "$d_dosuid" in
6612 "$define")
6613 cat >&4 <<EOH
6614
6615SUID emulation has been removed for 5.12
6616Please re-run Configure without -Dd_dosuid
6617
6618EOH
6619 exit 1;
6620 ;;
6621 esac
6622 d_dosuid=undef
6623fi
6624
6625: Find perl5.005 or later.
6626echo "Looking for a previously installed perl5.005 or later... "
6627case "$perl5" in
6628'') for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6629 : Check if this perl is recent and can load a simple module
6630 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6631 perl5=$tdir/perl
6632 break;
6633 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6634 perl5=$tdir/perl5
6635 break;
6636 fi
6637 done
6638 ;;
6639*) perl5="$perl5"
6640 ;;
6641esac
6642case "$perl5" in
6643'') echo "None found. That's ok.";;
6644*) echo "Using $perl5." ;;
6645esac
6646
6647: Set the siteprefix variables
6648$cat <<EOM
6649
6650After $package is installed, you may wish to install various
6651add-on modules and utilities. Typically, these add-ons will
6652be installed under $prefix with the rest
6653of this package. However, you may wish to install such add-ons
6654elsewhere under a different prefix.
6655
6656If you do not wish to put everything under a single prefix, that's
6657ok. You will be prompted for the individual locations; this siteprefix
6658is only used to suggest the defaults.
6659
6660The default should be fine for most people.
6661
6662EOM
6663fn=d~+
6664rp='Installation prefix to use for add-on modules and utilities?'
6665: XXX Here might be another good place for an installstyle setting.
6666case "$siteprefix" in
6667'') dflt=$prefix ;;
6668*) dflt=$siteprefix ;;
6669esac
6670. ./getfile
6671: XXX Prefixit unit does not yet support siteprefix and vendorprefix
6672oldsiteprefix=''
6673case "$siteprefix" in
6674'') ;;
6675*) case "$ans" in
6676 "$prefix") ;;
6677 *) oldsiteprefix="$prefix";;
6678 esac
6679 ;;
6680esac
6681siteprefix="$ans"
6682siteprefixexp="$ansexp"
6683
6684: determine where site specific libraries go.
6685: Usual default is /usr/local/lib/perl5/site_perl/$version
6686: The default "style" setting is made in installstyle.U
6687: XXX No longer works with Prefixit stuff.
6688prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6689case "$sitelib" in
6690'') case "$installstyle" in
6691 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6692 *) dflt=$siteprefix/lib/site_$prog/$version ;;
6693 esac
6694 ;;
6695*) dflt="$sitelib"
6696 ;;
6697esac
6698$cat <<EOM
6699
6700The installation process will create a directory for
6701site-specific extensions and modules. Most users find it convenient
6702to place all site-specific files in this directory rather than in the
6703main distribution directory.
6704
6705EOM
6706fn=d~+
6707rp='Pathname for the site-specific library files?'
6708. ./getfile
6709prefixvar=sitelib
6710. ./setprefixvar
6711sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6712
6713: Determine list of previous versions to include in @INC
6714$cat > getverlist <<EOPL
6715#!$perl5 -w
6716use File::Basename;
6717\$api_versionstring = "$api_versionstring";
6718\$version = "$version";
6719\$stem = "$sitelib_stem";
6720\$archname = "$archname";
6721EOPL
6722 $cat >> getverlist <<'EOPL'
6723# The list found is store twice for each entry: the original name, and
6724# the binary broken down version as pack "sss", so sorting is easy and
6725# unambiguous. This will work for all versions that have a maximum of
6726# three digit groups, separate by '.'s or '_'s. Names are extended with
6727# ".0.0" to ensure at least three elements for the pack.
6728# -- H.Merijn Brand (m)'06 23-10-2006
6729
6730# Can't have leading @ because metaconfig interprets it as a command!
6731;@inc_version_list=();
6732# XXX Redo to do opendir/readdir?
6733if (-d $stem) {
6734 chdir($stem);
6735 ;@candidates = map {
6736 [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6737 ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
6738}
6739else {
6740 ;@candidates = ();
6741}
6742
6743($pversion, $aversion, $vsn5005) = map {
6744 pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6745foreach $d (@candidates) {
6746 if ($d->[1] lt $pversion) {
6747 if ($d->[1] ge $aversion) {
6748 unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6749 }
6750 elsif ($d->[1] ge $vsn5005) {
6751 unshift(@inc_version_list, grep { -d } $d->[0]);
6752 }
6753 }
6754 else {
6755 # Skip newer version. I.e. don't look in
6756 # 5.7.0 if we're installing 5.6.1.
6757 }
6758}
6759
6760if (@inc_version_list) {
6761 print join(' ', @inc_version_list);
6762}
6763else {
6764 # Blank space to preserve value for next Configure run.
6765 print " ";
6766}
6767EOPL
6768chmod +x getverlist
6769case "$inc_version_list" in
6770'') if test -x "$perl5$exe_ext"; then
6771 dflt=`$perl5 getverlist`
6772 else
6773 dflt='none'
6774 fi
6775 ;;
6776$undef) dflt='none' ;;
6777*) eval dflt=\"$inc_version_list\" ;;
6778esac
6779case "$dflt" in
6780''|' ') dflt=none ;;
6781esac
6782case "$dflt" in
67835.005) dflt=none ;;
6784esac
6785$cat <<EOM
6786
6787In order to ease the process of upgrading, this version of perl
6788can be configured to use modules built and installed with earlier
6789versions of perl that were installed under $prefix. Specify here
6790the list of earlier versions that this version of perl should check.
6791If Configure detected no earlier versions of perl installed under
6792$prefix, then the list will be empty. Answer 'none' to tell perl
6793to not search earlier versions.
6794
6795The default should almost always be sensible, so if you're not sure,
6796just accept the default.
6797EOM
6798
6799rp='List of earlier versions to include in @INC?'
6800. ./myread
6801case "$ans" in
6802[Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6803*) inc_version_list="$ans" ;;
6804esac
6805case "$inc_version_list" in
6806''|' ')
6807 inc_version_list_init='0'
6808 d_inc_version_list="$undef"
6809 ;;
6810*) inc_version_list_init=`echo $inc_version_list |
6811 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6812 d_inc_version_list="$define"
6813 ;;
6814esac
6815$rm -f getverlist
6816
6817: see if malloc/malloc.h has to be included
6818set malloc/malloc.h i_mallocmalloc
6819eval $inhdr
6820
6821: see if this is a malloc.h system
6822: we want a real compile instead of Inhdr because some systems have a
6823: malloc.h that just gives a compile error saying to use stdlib.h instead
6824echo " "
6825$cat >try.c <<EOCP
6826#include <stdlib.h>
6827#include <malloc.h>
6828#$i_mallocmalloc I_MALLOCMALLOC
6829#ifdef I_MALLOCMALLOC
6830# include <malloc/malloc.h>
6831#endif
6832
6833int main () { return 0; }
6834EOCP
6835set try
6836if eval $compile; then
6837 echo "<malloc.h> found." >&4
6838 val="$define"
6839else
6840 echo "<malloc.h> NOT found." >&4
6841 val="$undef"
6842fi
6843$rm_try
6844set i_malloc
6845eval $setvar
6846
6847: check for length of pointer
6848echo " "
6849case "$ptrsize" in
6850'')
6851 echo "Checking to see how big your pointers are..." >&4
6852 $cat >>try.c <<EOCP
6853#include <stdio.h>
6854#$i_stdlib I_STDLIB
6855#ifdef I_STDLIB
6856#include <stdlib.h>
6857#endif
6858int main()
6859{
6860 printf("%d\n", (int)sizeof(void *));
6861 exit(0);
6862}
6863EOCP
6864 set try
6865 if eval $compile_ok; then
6866 ptrsize=`$run ./try`
6867 echo "Your pointers are $ptrsize bytes long."
6868 else
6869 dflt='4'
6870 echo "(I can't seem to compile the test program. Guessing...)" >&4
6871 rp="What is the size of a pointer (in bytes)?"
6872 . ./myread
6873 ptrsize="$ans"
6874 fi
6875 ;;
6876esac
6877$rm_try
6878case "$use64bitall" in
6879"$define"|true|[yY]*)
6880 case "$ptrsize" in
6881 4) cat <<EOM >&4
6882
6883*** You have chosen a maximally 64-bit build,
6884*** but your pointers are only 4 bytes wide.
6885*** Please rerun Configure without -Duse64bitall.
6886EOM
6887 case "$d_quad" in
6888 define)
6889 cat <<EOM >&4
6890*** Since you have quads, you could possibly try with -Duse64bitint.
6891EOM
6892 ;;
6893 esac
6894 cat <<EOM >&4
6895*** Cannot continue, aborting.
6896
6897EOM
6898
6899 exit 1
6900 ;;
6901 esac
6902 ;;
6903esac
6904
6905
6906: determine whether to use malloc wrapping
6907echo " "
6908case "$usemallocwrap" in
6909[yY]*|true|$define) dflt='y' ;;
6910[nN]*|false|$undef) dflt='n' ;;
6911*) case "$usedevel" in
6912 [yY]*|true|$define) dflt='y' ;;
6913 *) dflt='n' ;;
6914 esac
6915 ;;
6916esac
6917rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6918. ./myread
6919usemallocwrap="$ans"
6920case "$ans" in
6921y*|true)
6922 usemallocwrap="$define" ;;
6923*)
6924 usemallocwrap="$undef" ;;
6925esac
6926
6927: determine which malloc to compile in
6928echo " "
6929case "$usemymalloc" in
6930[yY]*|true|$define) dflt='y' ;;
6931[nN]*|false|$undef) dflt='n' ;;
6932*) case "$ptrsize" in
6933 4) dflt='y' ;;
6934 *) dflt='n' ;;
6935 esac
6936 if test "$useithreads" = "$define"; then dflt='n'; fi
6937 ;;
6938esac
6939rp="Do you wish to attempt to use the malloc that comes with $package?"
6940. ./myread
6941usemymalloc="$ans"
6942case "$ans" in
6943y*|true)
6944 usemymalloc='y'
6945 mallocsrc='malloc.c'
6946 mallocobj="malloc$_o"
6947 d_mymalloc="$define"
6948 case "$libs" in
6949 *-lmalloc*)
6950 : Remove malloc from list of libraries to use
6951 echo "Removing unneeded -lmalloc from library list" >&4
6952 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6953 shift
6954 libs="$*"
6955 echo "libs = $libs" >&4
6956 ;;
6957 esac
6958 ;;
6959*)
6960 usemymalloc='n'
6961 mallocsrc=''
6962 mallocobj=''
6963 d_mymalloc="$undef"
6964 ;;
6965esac
6966
6967: compute the return types of malloc and free
6968echo " "
6969$cat >malloc.c <<END
6970#$i_malloc I_MALLOC
6971#$i_stdlib I_STDLIB
6972#include <stdio.h>
6973#include <sys/types.h>
6974#ifdef I_MALLOC
6975#include <malloc.h>
6976#endif
6977#ifdef I_STDLIB
6978#include <stdlib.h>
6979#endif
6980#ifdef TRY_MALLOC
6981void *malloc();
6982#endif
6983#ifdef TRY_FREE
6984void free();
6985#endif
6986END
6987case "$malloctype" in
6988'')
6989 if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6990 malloctype='void *'
6991 else
6992 malloctype='char *'
6993 fi
6994 ;;
6995esac
6996echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6997
6998case "$freetype" in
6999'')
7000 if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
7001 freetype='void'
7002 else
7003 freetype='int'
7004 fi
7005 ;;
7006esac
7007echo "Your system uses $freetype free(), it would seem." >&4
7008$rm -f malloc.[co]
7009: determine where site specific architecture-dependent libraries go.
7010: sitelib default is /usr/local/lib/perl5/site_perl/$version
7011: sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7012: sitelib may have an optional trailing /share.
7013case "$sitearch" in
7014'') dflt=`echo $sitelib | $sed 's,/share$,,'`
7015 dflt="$dflt/$archname"
7016 ;;
7017*) dflt="$sitearch"
7018 ;;
7019esac
7020set sitearch sitearch none
7021eval $prefixit
7022$cat <<EOM
7023
7024The installation process will also create a directory for
7025architecture-dependent site-specific extensions and modules.
7026
7027EOM
7028fn=d~+
7029rp='Pathname for the site-specific architecture-dependent library files?'
7030. ./getfile
7031prefixvar=sitearch
7032. ./setprefixvar
7033if $test X"$sitearch" = X"$sitelib"; then
7034 d_sitearch="$undef"
7035else
7036 d_sitearch="$define"
7037fi
7038
7039: Set the vendorprefix variables
7040$cat <<EOM
7041
7042The installation process will also create a directory for
7043vendor-supplied add-ons. Vendors who supply perl with their system
7044may find it convenient to place all vendor-supplied files in this
7045directory rather than in the main distribution directory. This will
7046ease upgrades between binary-compatible maintenance versions of perl.
7047
7048Of course you may also use these directories in whatever way you see
7049fit. For example, you might use them to access modules shared over a
7050company-wide network.
7051
7052The default answer should be fine for most people.
7053This causes further questions about vendor add-ons to be skipped
7054and no vendor-specific directories will be configured for perl.
7055
7056EOM
7057rp='Do you want to configure vendor-specific add-on directories?'
7058case "$usevendorprefix" in
7059define|true|[yY]*) dflt=y ;;
7060*) : User may have set vendorprefix directly on Configure command line.
7061 case "$vendorprefix" in
7062 ''|' ') dflt=n ;;
7063 *) dflt=y ;;
7064 esac
7065 ;;
7066esac
7067. ./myread
7068case "$ans" in
7069[yY]*) fn=d~+
7070 rp='Installation prefix to use for vendor-supplied add-ons?'
7071 case "$vendorprefix" in
7072 '') dflt="$prefix" ;;
7073 *) dflt=$vendorprefix ;;
7074 esac
7075 . ./getfile
7076 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7077 oldvendorprefix=''
7078 case "$vendorprefix" in
7079 '') ;;
7080 *) case "$ans" in
7081 "$prefix") ;;
7082 *) oldvendorprefix="$prefix";;
7083 esac
7084 ;;
7085 esac
7086 usevendorprefix="$define"
7087 vendorprefix="$ans"
7088 vendorprefixexp="$ansexp"
7089 ;;
7090*) usevendorprefix="$undef"
7091 vendorprefix=''
7092 vendorprefixexp=''
7093 ;;
7094esac
7095
7096: Set the vendorlib variables
7097case "$vendorprefix" in
7098'') d_vendorlib="$undef"
7099 vendorlib=''
7100 vendorlibexp=''
7101 ;;
7102*) d_vendorlib="$define"
7103 : determine where vendor-supplied modules go.
7104 : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7105 case "$vendorlib" in
7106 '')
7107 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7108 case "$installstyle" in
7109 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7110 *) dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7111 esac
7112 ;;
7113 *) dflt="$vendorlib"
7114 ;;
7115 esac
7116 fn=d~+
7117 rp='Pathname for the vendor-supplied library files?'
7118 . ./getfile
7119 vendorlib="$ans"
7120 vendorlibexp="$ansexp"
7121 ;;
7122esac
7123vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7124prefixvar=vendorlib
7125. ./installprefix
7126
7127: Set the vendorarch variables
7128case "$vendorprefix" in
7129'') d_vendorarch="$undef"
7130 vendorarch=''
7131 vendorarchexp=''
7132 ;;
7133*) d_vendorarch="$define"
7134 : determine where vendor-supplied architecture-dependent libraries go.
7135 : vendorlib default is /usr/local/lib/perl5/vendor_perl/$version
7136 : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7137 : vendorlib may have an optional trailing /share.
7138 case "$vendorarch" in
7139 '') dflt=`echo $vendorlib | $sed 's,/share$,,'`
7140 dflt="$dflt/$archname"
7141 ;;
7142 *) dflt="$vendorarch" ;;
7143 esac
7144 fn=d~+
7145 rp='Pathname for vendor-supplied architecture-dependent files?'
7146 . ./getfile
7147 vendorarch="$ans"
7148 vendorarchexp="$ansexp"
7149 ;;
7150esac
7151prefixvar=vendorarch
7152. ./installprefix
7153if $test X"$vendorarch" = X"$vendorlib"; then
7154 d_vendorarch="$undef"
7155else
7156 d_vendorarch="$define"
7157fi
7158
7159: Final catch-all directories to search
7160$cat <<EOM
7161
7162Lastly, you can have perl look in other directories for extensions and
7163modules in addition to those already specified.
7164These directories will be searched after
7165 $sitearch
7166 $sitelib
7167EOM
7168test X"$vendorlib" != "X" && echo ' ' $vendorlib
7169test X"$vendorarch" != "X" && echo ' ' $vendorarch
7170echo ' '
7171case "$otherlibdirs" in
7172''|' ') dflt='none' ;;
7173*) dflt="$otherlibdirs" ;;
7174esac
7175$cat <<EOM
7176Enter a colon-separated set of extra paths to include in perl's @INC
7177search path, or enter 'none' for no extra paths.
7178
7179EOM
7180
7181rp='Colon-separated list of additional directories for perl to search?'
7182. ./myread
7183case "$ans" in
7184' '|''|none) otherlibdirs=' ' ;;
7185*) otherlibdirs="$ans" ;;
7186esac
7187case "$otherlibdirs" in
7188' ') val=$undef ;;
7189*) val=$define ;;
7190esac
7191set d_perl_otherlibdirs
7192eval $setvar
7193
7194: Cruising for prototypes
7195echo " "
7196echo "Checking out function prototypes..." >&4
7197$cat >prototype.c <<EOCP
7198#$i_stdlib I_STDLIB
7199#ifdef I_STDLIB
7200#include <stdlib.h>
7201#endif
7202int main(int argc, char *argv[]) {
7203 exit(0);}
7204EOCP
7205if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7206 echo "Your C compiler appears to support function prototypes."
7207 val="$define"
7208else
7209 echo "Your C compiler doesn't seem to understand function prototypes."
7210 val="$undef"
7211fi
7212set prototype
7213eval $setvar
7214$rm -f prototype*
7215
7216: Check if ansi2knr is required
7217case "$prototype" in
7218"$define") ;;
7219*) ansi2knr='ansi2knr'
7220 echo " "
7221 cat <<EOM >&4
7222
7223$me: FATAL ERROR:
7224This version of $package can only be compiled by a compiler that
7225understands function prototypes. Unfortunately, your C compiler
7226 $cc $ccflags
7227doesn't seem to understand them. Sorry about that.
7228
7229If GNU cc is available for your system, perhaps you could try that instead.
7230
7231Eventually, we hope to support building Perl with pre-ANSI compilers.
7232If you would like to help in that effort, please contact <perlbug@perl.org>.
7233
7234Aborting Configure now.
7235EOM
7236 exit 2
7237 ;;
7238esac
7239
7240: DTrace support
7241dflt_dtrace='/usr/sbin/dtrace'
7242$test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
7243
7244cat <<EOM
7245
7246Perl can be built to support DTrace on platforms that support it.
7247DTrace is a diagnosis and performance analysis tool from Sun.
7248
7249If this doesn't make any sense to you, just accept the default '$dflt'.
7250EOM
7251
7252while $test 1 ; do
7253 case "$usedtrace" in
7254 $define|true|[yY]*)
7255 dflt='y'
7256 ;;
7257 ?*)
7258 dflt='y'
7259 dflt_dtrace=$usedtrace
7260 ;;
7261 *)
7262 dflt='n'
7263 ;;
7264 esac
7265
7266 rp='Support DTrace if available?'
7267 . ./myread
7268 case "$ans" in
7269 y|Y) val="$define" ;;
7270 *) val="$undef" ;;
7271 esac
7272 set usedtrace
7273 eval $setvar
7274
7275 test "X$usedtrace" != "X$define" && break
7276
7277 echo " "
7278 rp='Where is the dtrace executable?'
7279 dflt=$dflt_dtrace
7280 . ./getfile
7281 val="$ans"
7282 set dtrace
7283 eval $setvar
7284
7285 if $test -f $dtrace
7286 then
7287 if $dtrace -h -s ../perldtrace.d \
7288 -o perldtrace.tmp >/dev/null 2>&1 \
7289 && rm -f perldtrace.tmp
7290 then
7291 echo " "
7292 echo "Good: your $dtrace knows about the -h flag."
7293 else
7294 cat >&2 <<EOM
7295
7296*** $me: Fatal Error: $dtrace doesn't support -h flag
7297***
7298*** Your installed dtrace doesn't support the -h switch to compile a D
7299*** program into a C header. Can't continue.
7300
7301EOM
7302 exit 1
7303 fi
7304 break;
7305 fi
7306
7307 case "$fastread" in
7308 yes)
7309 cat >&2 <<EOM
7310
7311*** $me: Fatal Error: $dtrace not found.
7312*** Can't continue.
7313
7314EOM
7315 exit 1
7316 ;;
7317 *)
7318 echo "*** $dtrace was not found."
7319 echo " "
7320 ;;
7321 esac
7322done
7323
7324: See if we want extra modules installed
7325echo " "
7326case "$extras" in
7327'') dflt='n';;
7328*) dflt='y';;
7329esac
7330cat <<EOM
7331Perl can be built with extra modules or bundles of modules which
7332will be fetched from the CPAN and installed alongside Perl.
7333
7334Notice that you will need access to the CPAN; either via the Internet,
7335or a local copy, for example a CD-ROM or a local CPAN mirror. (You will
7336be asked later to configure the CPAN.pm module which will in turn do
7337the installation of the rest of the extra modules or bundles.)
7338
7339Notice also that if the modules require any external software such as
7340libraries and headers (the libz library and the zlib.h header for the
7341Compress::Zlib module, for example) you MUST have any such software
7342already installed, this configuration process will NOT install such
7343things for you.
7344
7345If this doesn't make any sense to you, just accept the default '$dflt'.
7346EOM
7347rp='Install any extra modules (y or n)?'
7348. ./myread
7349case "$ans" in
7350y|Y)
7351 cat <<EOM
7352
7353Please list any extra modules or bundles to be installed from CPAN,
7354with spaces between the names. The names can be in any format the
7355'install' command of CPAN.pm will understand. (Answer 'none',
7356without the quotes, to install no extra modules or bundles.)
7357EOM
7358 rp='Extras?'
7359 dflt="$extras"
7360 . ./myread
7361 extras="$ans"
7362esac
7363case "$extras" in
7364''|'none')
7365 val=''
7366 $rm -f ../extras.lst
7367 ;;
7368*) echo "(Saving the list of extras for later...)"
7369 echo "$extras" > ../extras.lst
7370 val="'$extras'"
7371 ;;
7372esac
7373set extras
7374eval $setvar
7375echo " "
7376
7377: determine where html pages for programs go
7378set html1dir html1dir none
7379eval $prefixit
7380$cat <<EOM
7381
7382If you wish to install html files for programs in $spackage, indicate
7383the appropriate directory here. To skip installing html files,
7384answer "none".
7385EOM
7386case "$html1dir" in
7387''|none|$undef|' ') dflt=none ;;
7388*) dflt=$html1dir ;;
7389esac
7390fn=dn+~
7391rp="Directory for the main $spackage html pages?"
7392. ./getfile
7393prefixvar=html1dir
7394. ./setprefixvar
7395: Use ' ' for none so value is preserved next time through Configure
7396$test X"$html1dir" = "X" && html1dir=' '
7397
7398: determine where html pages for libraries and modules go
7399set html3dir html3dir none
7400eval $prefixit
7401$cat <<EOM
7402
7403If you wish to install html files for modules associated with $spackage,
7404indicate the appropriate directory here. To skip installing html files,
7405answer "none".
7406EOM
7407: There is no obvious default. If they have specified html1dir, then
7408: try to key off that, possibly changing .../html1 into .../html3.
7409case "$html3dir" in
7410'') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7411*) dflt=$html3dir ;;
7412esac
7413fn=dn+~
7414rp="Directory for the $spackage module html pages?"
7415. ./getfile
7416prefixvar=html3dir
7417. ./setprefixvar
7418: Use ' ' for none so value is preserved next time through Configure
7419$test X"$html3dir" = "X" && html3dir=' '
7420
7421: determine whether to install perl also as /usr/bin/perl
7422
7423echo " "
7424if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7425 $cat <<EOM
7426Many scripts expect perl to be installed as /usr/bin/perl.
7427
7428If you want to, I can install the perl you are about to compile
7429as /usr/bin/perl (in addition to $bin/perl).
7430EOM
7431 if test -f /usr/bin/perl; then
7432 $cat <<EOM
7433
7434However, please note that because you already have a /usr/bin/perl,
7435overwriting that with a new Perl would very probably cause problems.
7436Therefore I'm assuming you don't want to do that (unless you insist).
7437
7438EOM
7439 case "$installusrbinperl" in
7440 "$define"|[yY]*) dflt='y';;
7441 *) dflt='n';;
7442 esac
7443 else
7444 $cat <<EOM
7445
7446Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7447
7448EOM
7449 case "$installusrbinperl" in
7450 "$undef"|[nN]*) dflt='n';;
7451 *) dflt='y';;
7452 esac
7453 fi
7454 rp="Do you want to install perl as /usr/bin/perl?"
7455 . ./myread
7456 case "$ans" in
7457 [yY]*) val="$define";;
7458 *) val="$undef" ;;
7459 esac
7460else
7461 val="$undef"
7462fi
7463set installusrbinperl
7464eval $setvar
7465
7466: Check if we are using the GNU C library
7467echo " "
7468echo "Checking for GNU C Library..." >&4
7469cat >try.c <<'EOCP'
7470/* Find out version of GNU C library. __GLIBC__ and __GLIBC_MINOR__
7471 alone are insufficient to distinguish different versions, such as
7472 2.0.6 and 2.0.7. The function gnu_get_libc_version() appeared in
7473 libc version 2.1.0. A. Dougherty, June 3, 2002.
7474*/
7475#include <stdio.h>
7476int main(void)
7477{
7478#ifdef __GLIBC__
7479# ifdef __GLIBC_MINOR__
7480# if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7481# include <gnu/libc-version.h>
7482 printf("%s\n", gnu_get_libc_version());
7483# else
7484 printf("%d.%d\n", __GLIBC__, __GLIBC_MINOR__);
7485# endif
7486# else
7487 printf("%d\n", __GLIBC__);
7488# endif
7489 return 0;
7490#else
7491 return 1;
7492#endif
7493}
7494EOCP
7495set try
7496if eval $compile_ok && $run ./try > glibc.ver; then
7497 val="$define"
7498 gnulibc_version=`$cat glibc.ver`
7499 echo "You are using the GNU C Library version $gnulibc_version"
7500else
7501 val="$undef"
7502 gnulibc_version=''
7503 echo "You are not using the GNU C Library"
7504fi
7505$rm_try glibc.ver
7506set d_gnulibc
7507eval $setvar
7508
7509: see if nm is to be used to determine whether a symbol is defined or not
7510case "$usenm" in
7511'')
7512 dflt=''
7513 case "$d_gnulibc" in
7514 "$define")
7515 echo " "
7516 echo "nm probably won't work on the GNU C Library." >&4
7517 dflt=n
7518 ;;
7519 esac
7520 case "$dflt" in
7521 '')
7522 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7523 echo " "
7524 echo "Whoops! This is an AIX system without /lib/syscalls.exp!" >&4
7525 echo "'nm' won't be sufficient on this system." >&4
7526 dflt=n
7527 fi
7528 ;;
7529 esac
7530 case "$dflt" in
7531 '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7532 if $test $dflt -gt 20; then
7533 dflt=y
7534 else
7535 dflt=n
7536 fi
7537 ;;
7538 esac
7539 ;;
7540*)
7541 case "$usenm" in
7542 true|$define) dflt=y;;
7543 *) dflt=n;;
7544 esac
7545 ;;
7546esac
7547$cat <<EOM
7548
7549I can use $nm to extract the symbols from your C libraries. This
7550is a time consuming task which may generate huge output on the disk (up
7551to 3 megabytes) but that should make the symbols extraction faster. The
7552alternative is to skip the 'nm' extraction part and to compile a small
7553test program instead to determine whether each symbol is present. If
7554you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7555this may be the best solution.
7556
7557You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7558
7559EOM
7560rp="Shall I use $nm to extract C symbols from the libraries?"
7561. ./myread
7562case "$ans" in
7563[Nn]*) usenm=false;;
7564*) usenm=true;;
7565esac
7566
7567runnm=$usenm
7568case "$reuseval" in
7569true) runnm=false;;
7570esac
7571
7572: nm options which may be necessary
7573case "$nm_opt" in
7574'') if $test -f /mach_boot; then
7575 nm_opt='' # Mach
7576 elif $test -d /usr/ccs/lib; then
7577 nm_opt='-p' # Solaris (and SunOS?)
7578 elif $test -f /dgux; then
7579 nm_opt='-p' # DG-UX
7580 elif $test -f /lib64/rld; then
7581 nm_opt='-p' # 64-bit Irix
7582 else
7583 nm_opt=''
7584 fi;;
7585esac
7586
7587: nm options which may be necessary for shared libraries but illegal
7588: for archive libraries. Thank you, Linux.
7589case "$nm_so_opt" in
7590'') case "$myuname" in
7591 *linux*|gnu*)
7592 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7593 nm_so_opt='--dynamic'
7594 fi
7595 ;;
7596 esac
7597 ;;
7598esac
7599
7600: Figure out where the libc is located
7601case "$runnm" in
7602true)
7603: get list of predefined functions in a handy place
7604echo " "
7605case "$libc" in
7606'') libc=unknown
7607 case "$libs" in
7608 *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7609 esac
7610 ;;
7611esac
7612case "$libs" in
7613'') ;;
7614*) for thislib in $libs; do
7615 case "$thislib" in
7616 -lc|-lc_s)
7617 : Handle C library specially below.
7618 ;;
7619 -l*)
7620 thislib=`echo $thislib | $sed -e 's/^-l//'`
7621 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7622 :
7623 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7624 :
7625 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7626 :
7627 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7628 :
7629 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7630 :
7631 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7632 :
7633 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7634 :
7635 else
7636 try=''
7637 fi
7638 libnames="$libnames $try"
7639 ;;
7640 *) libnames="$libnames $thislib" ;;
7641 esac
7642 done
7643 ;;
7644esac
7645xxx=normal
7646case "$libc" in
7647unknown)
7648 set /lib/libc.$so
7649 for xxx in $libpth; do
7650 $test -r $1 || set $xxx/libc.$so
7651 : The messy sed command sorts on library version numbers.
7652 $test -r $1 || \
7653 set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7654 tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7655 h
7656 s/[0-9][0-9]*/0000&/g
7657 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7658 G
7659 s/\n/ /' | \
7660 $sort | $sed -e 's/^.* //'`
7661 eval set \$$#
7662 done
7663 $test -r $1 || set $sysroot/usr/ccs/lib/libc.$so
7664 $test -r $1 || set $sysroot/lib/libsys_s$_a
7665 ;;
7666*)
7667 set blurfl
7668 ;;
7669esac
7670if $test -r "$1"; then
7671 echo "Your (shared) C library seems to be in $1."
7672 libc="$1"
7673elif $test -r /lib/libc && $test -r /lib/clib; then
7674 echo "Your C library seems to be in both /lib/clib and /lib/libc."
7675 xxx=apollo
7676 libc='/lib/clib /lib/libc'
7677 if $test -r /lib/syslib; then
7678 echo "(Your math library is in /lib/syslib.)"
7679 libc="$libc /lib/syslib"
7680 fi
7681elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7682 echo "Your C library seems to be in $libc, as you said before."
7683elif $test -r $incpath/usr/lib/libc$_a; then
7684 libc=$incpath/usr/lib/libc$_a;
7685 echo "Your C library seems to be in $libc. That's fine."
7686elif $test -r /lib/libc$_a; then
7687 libc=/lib/libc$_a;
7688 echo "Your C library seems to be in $libc. You're normal."
7689else
7690 if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7691 :
7692 elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7693 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7694 elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7695 :
7696 elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7697 :
7698 elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7699 :
7700 else
7701 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7702 fi
7703 if $test -r "$tans"; then
7704 echo "Your C library seems to be in $tans, of all places."
7705 libc=$tans
7706 else
7707 libc='blurfl'
7708 fi
7709fi
7710if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7711 dflt="$libc"
7712 cat <<EOM
7713
7714If the guess above is wrong (which it might be if you're using a strange
7715compiler, or your machine supports multiple models), you can override it here.
7716
7717EOM
7718else
7719 dflt=''
7720 echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7721 cat >&4 <<EOM
7722I can't seem to find your C library. I've looked in the following places:
7723
7724EOM
7725 $sed 's/^/ /' libpath
7726 cat <<EOM
7727
7728None of these seems to contain your C library. I need to get its name...
7729
7730EOM
7731fi
7732fn=f
7733rp='Where is your C library?'
7734. ./getfile
7735libc="$ans"
7736
7737echo " "
7738echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7739set X `cat libnames`
7740shift
7741xxx=files
7742case $# in 1) xxx=file; esac
7743echo "Extracting names from the following $xxx for later perusal:" >&4
7744echo " "
7745$sed 's/^/ /' libnames >&4
7746echo " "
7747$echo $n "This may take a while...$c" >&4
7748
7749for file in $*; do
7750 case $file in
7751 *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7752 *) $nm $nm_opt $file 2>/dev/null;;
7753 esac
7754done >libc.tmp
7755
7756$echo $n ".$c"
7757$grep fprintf libc.tmp > libc.ptf
7758xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7759xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7760xxx='[ADTSIWi]'
7761if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *//p'";\
7762 eval $xscan;\
7763 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7764 eval $xrun
7765elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7766 eval $xscan;\
7767 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7768 eval $xrun
7769elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7770 eval $xscan;\
7771 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7772 eval $xrun
7773elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7774 eval $xscan;\
7775 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7776 eval $xrun
7777elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7778 eval $xscan;\
7779 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7780 eval $xrun
7781elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7782 eval $xscan;\
7783 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7784 eval $xrun
7785elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7786 -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
7787 eval $xscan;\
7788 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7789 eval $xrun
7790elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7791 eval $xscan;\
7792 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7793 eval $xrun
7794elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7795 eval $xscan;\
7796 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7797 eval $xrun
7798elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7799 eval $xscan;\
7800 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7801 eval $xrun
7802elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7803 eval $xscan;\
7804 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7805 eval $xrun
7806elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7807 eval $xscan;\
7808 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7809 eval $xrun
7810elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7811 eval $xscan;\
7812 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7813 eval $xrun
7814elif com="sed -n -e 's/^__.*//' -e 's/[ ]*D[ ]*[0-9]*.*//p'";\
7815 eval $xscan;\
7816 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7817 eval $xrun
7818else
7819 $nm -p $* 2>/dev/null >libc.tmp
7820 $grep fprintf libc.tmp > libc.ptf
7821 if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7822 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7823 then
7824 nm_opt='-p'
7825 eval $xrun
7826 else
7827 echo " "
7828 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7829 com=''
7830 if $ar t $libc > libc.tmp && \
7831 $contains '^fprintf$' libc.tmp >/dev/null 2>&1
7832 then
7833 for thisname in $libnames $libc; do
7834 $ar t $thisname >>libc.tmp
7835 done
7836 $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7837 echo "Ok." >&4
7838 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7839 for thisname in $libnames $libc; do
7840 $ar tv $thisname >>libc.tmp
7841 emximp -o tmp.imp $thisname \
7842 2>/dev/null && \
7843 $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7844 < tmp.imp >>libc.tmp
7845 $rm -f tmp.imp
7846 done
7847 $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7848 echo "Ok." >&4
7849 else
7850 echo "$ar didn't seem to work right." >&4
7851 echo "Maybe this is a Cray...trying bld instead..." >&4
7852 if bld t $libc | \
7853 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
7854 $test -s libc.list
7855 then
7856 for thisname in $libnames; do
7857 bld t $libnames | \
7858 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7859 $ar t $thisname >>libc.tmp
7860 done
7861 echo "Ok." >&4
7862 else
7863 echo "That didn't work either. Giving up." >&4
7864 exit 1
7865 fi
7866 fi
7867 fi
7868fi
7869nm_extract="$com"
7870case "$PASE" in
7871define)
7872 echo " "
7873 echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7874 dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7875 ;;
7876*) if $test -f /lib/syscalls.exp; then
7877 echo " "
7878 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7879 $sed -n 's/^\([^ ]*\)[ ]*syscall[0-9]*[ ]*$/\1/p' \
7880 /lib/syscalls.exp >>libc.list
7881 fi
7882 ;;
7883esac
7884;;
7885esac
7886$rm -f libnames libpath
7887
7888: Check if we are using C++
7889echo " "
7890echo "Checking for C++..." >&4
7891$cat >try.c <<'EOCP'
7892#include <stdio.h>
7893int main(void)
7894{
7895#ifdef __cplusplus
7896 return 0;
7897#else
7898 return 1;
7899#endif
7900}
7901EOCP
7902set try
7903if eval $compile_ok && $run ./try; then
7904 val="$define"
7905 echo "You are using a C++ compiler."
7906else
7907 val="$undef"
7908 echo "You are not using a C++ compiler."
7909fi
7910$rm_try cplusplus$$
7911set d_cplusplus
7912eval $setvar
7913
7914: is a C symbol defined?
7915csym='tlook=$1;
7916case "$3" in
7917-v) tf=libc.tmp; tdc="";;
7918-a) tf=libc.tmp; tdc="[]";;
7919*) tlook="^$1\$"; tf=libc.list; tdc="()";;
7920esac;
7921case "$d_cplusplus" in
7922 $define) extern_C="extern \"C\"" ;;
7923 *) extern_C="extern" ;;
7924esac;
7925tx=yes;
7926case "$reuseval-$4" in
7927true-) ;;
7928true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7929esac;
7930case "$tx" in
7931yes)
7932 tval=false;
7933 if $test "$runnm" = true; then
7934 if $contains $tlook $tf >/dev/null 2>&1; then
7935 tval=true;
7936 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7937 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7938 $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7939 $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7940 $rm_try;
7941 fi;
7942 else
7943 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7944 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7945 $rm_try;
7946 fi;
7947 ;;
7948*)
7949 case "$tval" in
7950 $define) tval=true;;
7951 *) tval=false;;
7952 esac;
7953 ;;
7954esac;
7955eval "$2=$tval"'
7956
7957: define an is-in-libc? function
7958inlibc='echo " "; td=$define; tu=$undef;
7959sym=$1; var=$2; eval "was=\$$2";
7960tx=yes;
7961case "$reuseval$was" in
7962true) ;;
7963true*) tx=no;;
7964esac;
7965case "$tx" in
7966yes)
7967 set $sym tres -f;
7968 eval $csym;
7969 case "$tres" in
7970 true)
7971 echo "$sym() found." >&4;
7972 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7973 *)
7974 echo "$sym() NOT found." >&4;
7975 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7976 esac;;
7977*)
7978 case "$was" in
7979 $define) echo "$sym() found." >&4;;
7980 *) echo "$sym() NOT found." >&4;;
7981 esac;;
7982esac'
7983
7984: see if dlopen exists
7985xxx_runnm="$runnm"
7986xxx_ccflags="$ccflags"
7987runnm=false
7988: with g++ one needs -shared to get is-in-libc to work for dlopen
7989case "$gccversion" in
7990'') ;;
7991*) case "$d_cplusplus" in
7992 "$define") ccflags="$ccflags -shared" ;;
7993 esac
7994 ;;
7995esac
7996set dlopen d_dlopen
7997eval $inlibc
7998runnm="$xxx_runnm"
7999ccflags="$xxx_ccflags"
8000
8001: see if this is a unistd.h system
8002set unistd.h i_unistd
8003eval $inhdr
8004
8005: determine which dynamic loading, if any, to compile in
8006echo " "
8007dldir="ext/DynaLoader"
8008case "$usedl" in
8009 $define|y|true)
8010 dflt='y'
8011 usedl="$define"
8012 ;;
8013 $undef|n|false)
8014 dflt='n'
8015 usedl="$undef"
8016 ;;
8017 *)
8018 dflt='n'
8019 case "$d_dlopen" in
8020 $define) dflt='y' ;;
8021 esac
8022 : Does a dl_xxx.xs file exist for this operating system
8023 $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
8024 ;;
8025esac
8026rp="Do you wish to use dynamic loading?"
8027. ./myread
8028usedl="$ans"
8029bin_ELF="$undef"
8030case "$ans" in
8031 y*) usedl="$define"
8032 case "$dlsrc" in
8033 '') if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
8034 dflt="$dldir/dl_${osname}.xs"
8035 elif $test "$d_dlopen" = "$define" ; then
8036 dflt="$dldir/dl_dlopen.xs"
8037 else
8038 dflt=''
8039 fi
8040 ;;
8041 *) dflt="$dldir/$dlsrc"
8042 ;;
8043 esac
8044 echo "The following dynamic loading files are available:"
8045 : Can not go over to $dldir because getfile has path hard-coded in.
8046 tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
8047 rp="Source file to use for dynamic loading"
8048 fn="fne"
8049 gfpth="$src"
8050 . ./getfile
8051 usedl="$define"
8052 : emulate basename
8053 dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
8054
8055 $cat << EOM
8056
8057Some systems may require passing special flags to $cc -c to
8058compile modules that will be used to create a shared library.
8059To use no flags, say "none".
8060
8061EOM
8062 case "$cccdlflags" in
8063 '') case "$gccversion" in
8064 '') case "$osname" in
8065 hpux) dflt='+z' ;;
8066 next) dflt='none' ;;
8067 irix*) dflt='-KPIC' ;;
8068 svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
8069 sunos) dflt='-pic' ;;
8070 *) dflt='none' ;;
8071 esac
8072 ;;
8073 *) case "$osname" in
8074 darwin) dflt='none' ;;
8075 *linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
8076 *) dflt='-fpic' ;;
8077 esac ;;
8078 esac ;;
8079 ' ') dflt='none' ;;
8080 *) dflt="$cccdlflags" ;;
8081 esac
8082
8083 case "$dflt" in
8084 none) dflt='' ;;
8085 esac
8086
8087 # If -Dsysroot was specified, now's the time to add it
8088 # to cccdlflags
8089 if test "X$sysroot" != X; then
8090 case "$gccversion" in
8091 '') ;;
8092 *) case "$dflt" in
8093 *sysroot*) ;;
8094 'undef'|*)
8095 dflt="$dflt --sysroot=$sysroot" ;;
8096 esac
8097 ;;
8098 esac
8099 fi
8100
8101 case "$dflt" in
8102 '') dflt='none';;
8103 esac
8104
8105 rp="Any special flags to pass to $cc -c to compile shared library modules?"
8106 . ./myread
8107 case "$ans" in
8108 none) cccdlflags=' ' ;;
8109 *) cccdlflags="$ans" ;;
8110 esac
8111
8112 cat << EOM
8113
8114Some systems use ld to create libraries that can be dynamically loaded,
8115while other systems (such as those using ELF) use $cc.
8116
8117EOM
8118
8119: Determine if this is ELF
8120 $cat >try.c <<EOM
8121/* Test for whether ELF binaries are produced */
8122#include <fcntl.h>
8123#$i_stdlib I_STDLIB
8124#ifdef I_STDLIB
8125#include <stdlib.h>
8126#endif
8127#$i_unistd I_UNISTD
8128#ifdef I_UNISTD
8129#include <unistd.h>
8130#endif
8131int main() {
8132 char b[4];
8133 int i = open("a.out",O_RDONLY);
8134 if(i == -1)
8135 exit(1); /* fail */
8136 if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8137 exit(0); /* succeed (yes, it is ELF) */
8138 exit(1); /* fail */
8139}
8140EOM
8141 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
8142 bin_ELF="$define"
8143 fi
8144 $rm_try
8145
8146 case "$ld" in
8147 '') if $test $bin_ELF = "$define"; then
8148 cat <<EOM
8149You appear to have ELF support. I'll use $cc to build dynamic libraries.
8150EOM
8151 dflt="$cc"
8152 else
8153 echo "I'll use ld to build dynamic libraries."
8154 dflt='ld'
8155 fi
8156 ;;
8157 *) dflt="$ld"
8158 ;;
8159 esac
8160
8161 rp="What command should be used to create dynamic libraries?"
8162 . ./myread
8163 ld="$ans"
8164
8165 cat << EOM
8166
8167Some systems may require passing special flags to $ld to create a
8168library that can be dynamically loaded. If your ld flags include
8169-L/other/path options to locate libraries outside your loader's normal
8170search path, you may need to specify those -L options here as well. To
8171use no flags, say "none".
8172
8173EOM
8174 case "$lddlflags" in
8175 '') case "$osname" in
8176 haiku) dflt='-shared' ;;
8177 hpux) dflt='-b';
8178 case "$gccversion" in
8179 '') dflt="$dflt +vnocompatwarnings" ;;
8180 esac
8181 ;;
8182 *linux*|irix*|gnu*) dflt="-shared $optimize" ;;
8183 next) dflt='none' ;;
8184 solaris) # See [perl #66604].
8185 # On Solaris 11, gcc -m64 on amd64
8186 # appears not to understand -G. gcc versions at
8187 # least as old as 3.4.3 support -shared, so just
8188 # use that with Solaris 11 and later, but keep
8189 # the old behavior for older Solaris versions.
8190 case "$gccversion" in
8191 '') dflt='-G' ;;
8192 *) case "$osvers" in
8193 2.?|2.10) dflt='-G' ;;
8194 *) dflt='-shared' ;;
8195 esac
8196 ;;
8197 esac
8198 ;;
8199 sunos) dflt='-assert nodefinitions' ;;
8200 svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8201 *) dflt='none' ;;
8202 esac
8203 ;;
8204 *) dflt="$lddlflags" ;;
8205 esac
8206
8207 : Only do this for gcc, since, for example, qcc has no concept
8208 : of --sysroot.
8209 if $test "X$sysroot" != X; then
8210 case "$gccversion" in
8211 '') ;;
8212 *) dflt="$dflt --sysroot $sysroot" ;;
8213 esac
8214 fi
8215
8216 : Try to guess additional flags to pick up local libraries.
8217 : Be careful not to append to a plain 'none'
8218 case "$dflt" in
8219 none) dflt='' ;;
8220 esac
8221 for thisflag in $ldflags; do
8222 case "$thisflag" in
8223 -L*|-R*|-Wl,-R*)
8224 case " $dflt " in
8225 *" $thisflag "*) ;;
8226 *) dflt="$dflt $thisflag" ;;
8227 esac
8228 ;;
8229 esac
8230 done
8231
8232 case "$dflt" in
8233 ''|' ') dflt='none' ;;
8234 esac
8235
8236 case "$ldflags" in
8237 *-fstack-protector*)
8238 case "$dflt" in
8239 *-fstack-protector*) ;; # Don't add it again
8240 *) dflt="$dflt -fstack-protector" ;;
8241 esac
8242 ;;
8243 esac
8244
8245 rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8246 . ./myread
8247 case "$ans" in
8248 none) lddlflags=' ' ;;
8249 *) lddlflags="$ans" ;;
8250 esac
8251
8252 cat <<EOM
8253
8254Some systems may require passing special flags to $cc to indicate that
8255the resulting executable will use dynamic linking. To use no flags,
8256say "none".
8257
8258EOM
8259 case "$ccdlflags" in
8260 '') case "$osname" in
8261 *linux*|hpux|gnu*) dflt='-Wl,-E' ;;
8262 next|sunos) dflt='none' ;;
8263 *) dflt='none' ;;
8264 esac ;;
8265 ' ') dflt='none' ;;
8266 *) dflt="$ccdlflags" ;;
8267 esac
8268 rp="Any special flags to pass to $cc to use dynamic linking?"
8269 . ./myread
8270 case "$ans" in
8271 none) ccdlflags=' ' ;;
8272 *) ccdlflags="$ans" ;;
8273 esac
8274 ;;
8275
8276 *) usedl="$undef"
8277 ld='ld'
8278 dlsrc='dl_none.xs'
8279 lddlflags=''
8280 ccdlflags=''
8281 ;;
8282esac
8283
8284ld_can_script="$undef"
8285case "$bin_ELF$usedl" in
8286 $define$define)
8287 # Abuse try.h and a.out names for neat cleanup
8288 $cat >try.c <<EOM
8289void foo() {}
8290void bar() {}
8291EOM
8292 $cat >try.h <<EOM
8293LIBTEST_42 {
8294 global:
8295 foo;
8296 local: *;
8297 };
8298EOM
8299 if $cc $cccdlflags $ccdlflags $ccflags \
8300 $ldflags $lddlflags -o a.out try.c \
8301 -Wl,--version-script=try.h >/dev/null 2>&1 \
8302 && $test -s a.out ; then
8303 echo "ld supports scripting" >&4
8304 ld_can_script="$define"
8305 else
8306 echo "ld does not support scripting" >&4
8307 fi
8308 $rm_try
8309 ;;
8310esac
8311
8312: Do we want a shared libperl?
8313also=''
8314case "$usedl" in
8315$undef)
8316 # No dynamic loading being used, so don't bother even to prompt.
8317 useshrplib='false'
8318 ;;
8319*) case "$useshrplib" in
8320 '') case "$osname" in
8321 svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8322 dflt=y
8323 also='Building a shared libperl is required for dynamic loading to work on your system.'
8324 ;;
8325 next*)
8326 case "$osvers" in
8327 4*) dflt=y
8328 also='Building a shared libperl is needed for MAB support.'
8329 ;;
8330 *) dflt=n
8331 ;;
8332 esac
8333 ;;
8334 *) dflt=n
8335 ;;
8336 esac
8337 ;;
8338 $define|true|[Yy]*)
8339 dflt=y
8340 ;;
8341 *) dflt=n
8342 ;;
8343 esac
8344 $cat << EOM
8345
8346The perl executable is normally obtained by linking perlmain.c with
8347libperl${_a}, any static extensions (usually just DynaLoader), and
8348any other libraries needed on this system (such as -lm, etc.). Since
8349your system supports dynamic loading, it is probably possible to build
8350a shared libperl.$so. If you will have more than one executable linked
8351to libperl.$so, this will significantly reduce the size of each
8352executable, but it may have a noticeable effect on performance. The
8353default is probably sensible for your system.
8354$also
8355
8356EOM
8357 rp="Build a shared libperl.$so (y/n)"
8358 . ./myread
8359 case "$ans" in
8360 true|$define|[Yy]*)
8361 useshrplib='true' ;;
8362 *) useshrplib='false' ;;
8363 esac
8364 ;;
8365esac
8366
8367case "$useshrplib" in
8368true)
8369 case "$userelocatableinc" in
8370 true|define)
8371 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8372 echo "See INSTALL for an explanation why that won't work." >&4
8373 exit 4
8374 ;;
8375 esac
8376 case "$libperl" in
8377 '')
8378 # Figure out a good name for libperl.so. Since it gets stored in
8379 # a version-specific architecture-dependent library, the version
8380 # number isn't really that important, except for making cc/ld happy.
8381 #
8382 # A name such as libperl.so.10.1
8383 majmin="libperl.$so.$patchlevel.$subversion"
8384 # A name such as libperl.so.100
8385 majonly=`echo $patchlevel $subversion |
8386 $awk '{printf "%d%02d", $1, $2}'`
8387 majonly=libperl.$so.$majonly
8388 # I'd prefer to keep the os-specific stuff here to a minimum, and
8389 # rely on figuring it out from the naming of libc.
8390 case "${osname}${osvers}" in
8391 next4*)
8392 dflt=libperl.5.$so
8393 # XXX How handle the --version stuff for MAB?
8394 ;;
8395 *linux*|gnu*) # ld won't link with a bare -lperl otherwise.
8396 dflt=libperl.$so
8397 ;;
8398 cygwin*) # ld links now against the dll directly
8399 majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8400 majonly=`echo $patchlevel $subversion |
8401 $awk '{printf "%03d%03d", $1, $2}'`
8402 majonly=cygperl5.$majonly.$so
8403 dflt=$majmin
8404 ;;
8405 *) # Try to guess based on whether libc has major.minor.
8406 case "$libc" in
8407 *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8408 *libc.$so.[0-9]*) dflt=$majonly ;;
8409 *) dflt=libperl.$so ;;
8410 esac
8411 ;;
8412 esac
8413 ;;
8414 *) dflt=$libperl
8415 ;;
8416 esac
8417 cat << EOM
8418
8419I need to select a good name for the shared libperl. If your system uses
8420library names with major and minor numbers, then you might want something
8421like $majmin. Alternatively, if your system uses a single version
8422number for shared libraries, then you might want to use $majonly.
8423Or, your system might be quite happy with a simple libperl.$so.
8424
8425Since the shared libperl will get installed into a version-specific
8426architecture-dependent directory, the version number of the shared perl
8427library probably isn't important, so the default should be o.k.
8428
8429EOM
8430 rp='What name do you want to give to the shared libperl?'
8431 . ./myread
8432 libperl=$ans
8433 echo "Ok, I'll use $libperl"
8434 ;;
8435*)
8436 libperl="libperl${_a}"
8437 ;;
8438esac
8439
8440# Detect old use of shrpdir via undocumented Configure -Dshrpdir
8441case "$shrpdir" in
8442'') ;;
8443*) $cat >&4 <<EOM
8444WARNING: Use of the shrpdir variable for the installation location of
8445the shared $libperl is not supported. It was never documented and
8446will not work in this version. Let me (perlbug@perl.org)
8447know of any problems this may cause.
8448
8449EOM
8450 case "$shrpdir" in
8451 "$archlibexp/CORE")
8452 $cat >&4 <<EOM
8453But your current setting of $shrpdir is
8454the default anyway, so it's harmless.
8455EOM
8456 ;;
8457 *)
8458 $cat >&4 <<EOM
8459Further, your current attempted setting of $shrpdir
8460conflicts with the value of $archlibexp/CORE
8461that installperl will use.
8462EOM
8463 ;;
8464 esac
8465 ;;
8466esac
8467
8468# How will the perl executable find the installed shared $libperl?
8469# Add $xxx to ccdlflags.
8470# If we can't figure out a command-line option, use $shrpenv to
8471# set env LD_RUN_PATH. The main perl makefile uses this.
8472shrpdir=$archlibexp/CORE
8473xxx=''
8474tmp_shrpenv=''
8475if "$useshrplib"; then
8476 case "$osname" in
8477 aix)
8478 # We'll set it in Makefile.SH...
8479 ;;
8480 solaris)
8481 xxx="-R $shrpdir"
8482 ;;
8483 freebsd|mirbsd|netbsd|openbsd|interix|dragonfly|bitrig)
8484 xxx="-Wl,-R$shrpdir"
8485 ;;
8486 bsdos|linux|irix*|dec_osf|gnu*)
8487 xxx="-Wl,-rpath,$shrpdir"
8488 ;;
8489 next)
8490 # next doesn't like the default...
8491 ;;
8492 haiku)
8493 # Haiku doesn't like the default, either.
8494 ;;
8495 hpux*)
8496 # hpux doesn't like the default, either.
8497 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8498 ;;
8499 cygwin)
8500 # cygwin needs only ldlibpth
8501 ;;
8502 *)
8503 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8504 ;;
8505 esac
8506 case "$xxx" in
8507 '') ;;
8508 *)
8509 # Only add $xxx if it isn't already in ccdlflags.
8510 case " $ccdlflags " in
8511 *" $xxx "*) ;;
8512 *) ccdlflags="$ccdlflags $xxx"
8513 cat <<EOM >&4
8514
8515Adding $xxx to the flags
8516passed to $ld so that the perl executable will find the
8517installed shared $libperl.
8518
8519EOM
8520 ;;
8521 esac
8522 ;;
8523 esac
8524fi
8525# Fix ccdlflags in AIX for building external extensions.
8526# (For building Perl itself bare -bE:perl.exp is needed,
8527# Makefile.SH takes care of this.)
8528case "$osname" in
8529aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8530esac
8531# Respect a hint or command-line value.
8532case "$shrpenv" in
8533'') shrpenv="$tmp_shrpenv" ;;
8534esac
8535case "$ldlibpthname" in
8536'') ldlibpthname=LD_LIBRARY_PATH ;;
8537none) ldlibpthname='' ;;
8538esac
8539
8540: determine where manual pages are on this system
8541echo " "
8542case "$sysman" in
8543'')
8544 syspath='/usr/share/man/man1 /usr/man/man1'
8545 syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8546 syspath="$syspath /usr/man/u_man/man1"
8547 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8548 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8549 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8550 sysman=`./loc . /usr/man/man1 $syspath`
8551 ;;
8552esac
8553if $test -d "$sysman"; then
8554 echo "System manual is in $sysman." >&4
8555else
8556 echo "Could not find manual pages in source form." >&4
8557fi
8558
8559: determine where manual pages go
8560set man1dir man1dir none
8561eval $prefixit
8562$cat <<EOM
8563
8564$spackage has manual pages available in source form.
8565EOM
8566case "$nroff" in
8567nroff)
8568 echo "However, you don't have nroff, so they're probably useless to you."
8569 case "$man1dir" in
8570 '') man1dir="none";;
8571 esac;;
8572esac
8573echo "If you don't want the manual sources installed, answer 'none'."
8574case "$man1dir" in
8575' ') dflt=none
8576 ;;
8577'')
8578 lookpath="$prefixexp/share/man/man1"
8579 lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8580 lookpath="$lookpath $prefixexp/man/p_man/man1"
8581 lookpath="$lookpath $prefixexp/man/u_man/man1"
8582 lookpath="$lookpath $prefixexp/man/man.1"
8583 case "$sysman" in
8584 */?_man*) dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8585 *) dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8586 esac
8587 set dflt
8588 eval $prefixup
8589 ;;
8590*) dflt="$man1dir"
8591 ;;
8592esac
8593echo " "
8594fn=dn+~
8595rp="Where do the main $spackage manual pages (source) go?"
8596. ./getfile
8597if $test "X$man1direxp" != "X$ansexp"; then
8598 installman1dir=''
8599fi
8600prefixvar=man1dir
8601. ./setprefixvar
8602
8603case "$man1dir" in
8604'') man1dir=' '
8605 installman1dir='';;
8606esac
8607
8608: What suffix to use on installed man pages
8609
8610case "$man1dir" in
8611' ')
8612 man1ext='0'
8613 ;;
8614*)
8615 rp="What suffix should be used for the main $spackage man pages?"
8616 case "$man1ext" in
8617 '') case "$man1dir" in
8618 *1) dflt=1 ;;
8619 *1p) dflt=1p ;;
8620 *1pm) dflt=1pm ;;
8621 *l) dflt=l;;
8622 *n) dflt=n;;
8623 *o) dflt=o;;
8624 *p) dflt=p;;
8625 *C) dflt=C;;
8626 *L) dflt=L;;
8627 *L1) dflt=L1;;
8628 *) dflt=1;;
8629 esac
8630 ;;
8631 *) dflt="$man1ext";;
8632 esac
8633 . ./myread
8634 man1ext="$ans"
8635 ;;
8636esac
8637
8638: see if we can have long filenames
8639echo " "
8640first=123456789abcdef
8641$rm -f $first
8642if (echo hi >$first) 2>/dev/null; then
8643 if $test -f 123456789abcde; then
8644 echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4
8645 val="$undef"
8646 else
8647 echo 'You can have filenames longer than 14 characters.'>&4
8648 val="$define"
8649 fi
8650else
8651 $cat <<'EOM'
8652You can't have filenames longer than 14 chars.
8653You can't even think about them!
8654EOM
8655 val="$undef"
8656fi
8657set d_flexfnam
8658eval $setvar
8659$rm -rf 123456789abcde*
8660
8661: determine where library module manual pages go
8662set man3dir man3dir none
8663eval $prefixit
8664$cat <<EOM
8665
8666$spackage has manual pages for many of the library modules.
8667EOM
8668
8669case "$nroff" in
8670nroff)
8671 $cat <<'EOM'
8672However, you don't have nroff, so they're probably useless to you.
8673EOM
8674 case "$man3dir" in
8675 '') man3dir="none";;
8676 esac;;
8677esac
8678
8679case "$d_flexfnam" in
8680undef)
8681 $cat <<'EOM'
8682However, your system can't handle the long file names like File::Basename.3.
8683EOM
8684 case "$man3dir" in
8685 '') man3dir="none";;
8686 esac;;
8687esac
8688
8689echo "If you don't want the manual sources installed, answer 'none'."
8690prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8691case "$man3dir" in
8692'') dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8693 if $test -d "$privlib/man/man3"; then
8694 cat <<EOM >&4
8695
8696WARNING: Previous versions of perl installed man3 pages into
8697$privlib/man/man3. This version will suggest a
8698new default of $dflt.
8699EOM
8700 tdflt=$dflt
8701 dflt='n'
8702 rp='Do you wish to preserve the old behavior?(y/n)'
8703 . ./myread
8704 case "$ans" in
8705 y*) dflt="$privlib/man/man3" ;;
8706 *) dflt=$tdflt ;;
8707 esac
8708 fi
8709 ;;
8710*) dflt="$man3dir" ;;
8711esac
8712case "$dflt" in
8713' ') dflt=none ;;
8714esac
8715echo " "
8716fn=dn+~
8717rp="Where do the $package library man pages (source) go?"
8718. ./getfile
8719prefixvar=man3dir
8720. ./setprefixvar
8721
8722case "$man3dir" in
8723'') man3dir=' '
8724 installman3dir='';;
8725esac
8726
8727: What suffix to use on installed man pages
8728case "$man3dir" in
8729' ')
8730 man3ext='0'
8731 ;;
8732*)
8733 rp="What suffix should be used for the $package library man pages?"
8734 case "$man3ext" in
8735 '') case "$man3dir" in
8736 *3) dflt=3 ;;
8737 *3p) dflt=3p ;;
8738 *3pm) dflt=3pm ;;
8739 *l) dflt=l;;
8740 *n) dflt=n;;
8741 *o) dflt=o;;
8742 *p) dflt=p;;
8743 *C) dflt=C;;
8744 *L) dflt=L;;
8745 *L3) dflt=L3;;
8746 *) dflt=3;;
8747 esac
8748 ;;
8749 *) dflt="$man3ext";;
8750 esac
8751 . ./myread
8752 man3ext="$ans"
8753 ;;
8754esac
8755
8756: see if we have to deal with yellow pages, now NIS.
8757if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8758 if $test -f /usr/etc/nibindd; then
8759 echo " "
8760 echo "I'm fairly confident you're on a NeXT."
8761 echo " "
8762 rp='Do you get the hosts file via NetInfo?'
8763 dflt=y
8764 case "$hostcat" in
8765 nidump*) ;;
8766 '') ;;
8767 *) dflt=n;;
8768 esac
8769 . ./myread
8770 case "$ans" in
8771 y*) hostcat='nidump hosts .';;
8772 *) case "$hostcat" in
8773 nidump*) hostcat='';;
8774 esac
8775 ;;
8776 esac
8777 fi
8778 case "$hostcat" in
8779 nidump*) ;;
8780 *)
8781 case "$hostcat" in
8782 *ypcat*) dflt=y;;
8783 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8784 dflt=y
8785 else
8786 dflt=n
8787 fi;;
8788 *) dflt=n;;
8789 esac
8790 echo " "
8791 rp='Are you getting the hosts file via yellow pages?'
8792 . ./myread
8793 case "$ans" in
8794 y*) hostcat='ypcat hosts';;
8795 *) hostcat='cat /etc/hosts';;
8796 esac
8797 ;;
8798 esac
8799fi
8800case "$hostcat" in
8801'') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8802esac
8803case "$groupcat" in
8804'') test -f /etc/group && groupcat='cat /etc/group';;
8805esac
8806case "$passcat" in
8807'') test -f /etc/passwd && passcat='cat /etc/passwd';;
8808esac
8809
8810: now get the host name
8811echo " "
8812echo "Figuring out host name..." >&4
8813case "$myhostname" in
8814'') cont=true
8815 echo 'Maybe "hostname" will work...'
8816 if tans=`sh -c hostname 2>&1` ; then
8817 myhostname=$tans
8818 phostname=hostname
8819 cont=''
8820 fi
8821 ;;
8822*) cont='';;
8823esac
8824if $test "$cont"; then
8825 if ./xenix; then
8826 echo 'Oh, dear. Maybe "/etc/systemid" is the key...'
8827 if tans=`cat /etc/systemid 2>&1` ; then
8828 myhostname=$tans
8829 phostname='cat /etc/systemid'
8830 echo "Whadyaknow. Xenix always was a bit strange..."
8831 cont=''
8832 fi
8833 elif $test -r /etc/systemid; then
8834 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8835 fi
8836fi
8837if $test "$cont"; then
8838 echo 'No, maybe "uuname -l" will work...'
8839 if tans=`sh -c 'uuname -l' 2>&1` ; then
8840 myhostname=$tans
8841 phostname='uuname -l'
8842 else
8843 echo 'Strange. Maybe "uname -n" will work...'
8844 if tans=`sh -c 'uname -n' 2>&1` ; then
8845 myhostname=$tans
8846 phostname='uname -n'
8847 else
8848 echo 'Oh well, maybe I can mine it out of whoami.h...'
8849 if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8850 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8851 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8852 else
8853 case "$myhostname" in
8854 '') echo "Does this machine have an identity crisis or something?"
8855 phostname='';;
8856 *)
8857 echo "Well, you said $myhostname before..."
8858 phostname='echo $myhostname';;
8859 esac
8860 fi
8861 fi
8862 fi
8863fi
8864case "$myhostname" in
8865'') myhostname=noname ;;
8866esac
8867: you do not want to know about this
8868set $myhostname
8869myhostname=$1
8870
8871: verify guess
8872if $test "$myhostname" ; then
8873 dflt=y
8874 rp='Your host name appears to be "'$myhostname'".'" Right?"
8875 . ./myread
8876 case "$ans" in
8877 y*) ;;
8878 *) myhostname='';;
8879 esac
8880fi
8881
8882: bad guess or no guess
8883while $test "X$myhostname" = X ; do
8884 dflt=''
8885 rp="Please type the (one word) name of your host:"
8886 . ./myread
8887 myhostname="$ans"
8888done
8889
8890: translate upper to lower if necessary
8891case "$myhostname" in
8892*[A-Z]*)
8893 echo "(Normalizing case in your host name)"
8894 myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8895 ;;
8896esac
8897
8898case "$myhostname" in
8899*.*)
8900 dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8901 myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8902 echo "(Trimming domain name from host name--host name is now $myhostname)"
8903 ;;
8904*) case "$mydomain" in
8905 '')
8906 {
8907 test "X$hostcat" = "Xypcat hosts" &&
8908 ypmatch "$myhostname" hosts 2>/dev/null |\
8909 $sed -e 's/[ ]*#.*//; s/$/ /' > hosts && \
8910 $test -s hosts
8911 } || {
8912 test "X$hostcat" != "X" &&
8913 $hostcat | $sed -n -e "s/[ ]*#.*//; s/\$/ /
8914 /[ ]$myhostname[ . ]/p" > hosts
8915 }
8916 tmp_re="[ . ]"
8917 if $test -f hosts; then
8918 $test x`$awk "/[0-9].*[ ]$myhostname$tmp_re/ { sum++ }
8919 END { print sum }" hosts` = x1 || tmp_re="[ ]"
8920 dflt=.`$awk "/[0-9].*[ ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8921 hosts | $sort | $uniq | \
8922 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8923 case `$echo X$dflt` in
8924 X*\ *) echo "(Several hosts in the database matched hostname)"
8925 dflt=.
8926 ;;
8927 X.) echo "(You do not have fully-qualified names in the hosts database)"
8928 ;;
8929 esac
8930 else
8931 echo "(I cannot locate a hosts database anywhere)"
8932 dflt=.
8933 fi
8934 case "$dflt" in
8935 .)
8936 tans=`./loc resolv.conf X /etc /usr/etc`
8937 if $test -f "$tans"; then
8938 echo "(Attempting domain name extraction from $tans)"
8939 dflt=.`$sed -n -e 's/ / /g' \
8940 -e 's/^search *\([^ ]*\).*/\1/p' $tans \
8941 -e 1q 2>/dev/null`
8942 case "$dflt" in
8943 .) dflt=.`$sed -n -e 's/ / /g' \
8944 -e 's/^domain *\([^ ]*\).*/\1/p' $tans \
8945 -e 1q 2>/dev/null`
8946 ;;
8947 esac
8948 fi
8949 ;;
8950 esac
8951 case "$dflt" in
8952 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8953 dflt=.`sh -c domainname 2>/dev/null`
8954 case "$dflt" in
8955 '') dflt='.';;
8956 .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8957 esac
8958 ;;
8959 esac
8960 case "$dflt$osname" in
8961 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8962 dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8963 ;;
8964 esac
8965 case "$dflt" in
8966 .) echo "(Lost all hope -- silly guess then)"
8967 dflt='.nonet'
8968 ;;
8969 esac
8970 $rm -f hosts
8971 ;;
8972 *) dflt="$mydomain";;
8973 esac;;
8974esac
8975echo " "
8976rp="What is your domain name?"
8977. ./myread
8978tans="$ans"
8979case "$ans" in
8980'') ;;
8981.*) ;;
8982*) tans=".$tans";;
8983esac
8984mydomain="$tans"
8985
8986: translate upper to lower if necessary
8987case "$mydomain" in
8988*[A-Z]*)
8989 echo "(Normalizing case in your domain name)"
8990 mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8991 ;;
8992esac
8993
8994: a little sanity check here
8995case "$phostname" in
8996'') ;;
8997*)
8998 case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8999 $myhostname$mydomain|$myhostname) ;;
9000 *)
9001 case "$phostname" in
9002 sed*)
9003 echo "(That doesn't agree with your whoami.h file, by the way.)"
9004 ;;
9005 *)
9006 echo "(That doesn't agree with your $phostname command, by the way.)"
9007 ;;
9008 esac
9009 ;;
9010 esac
9011 ;;
9012esac
9013
9014: determine the e-mail address of the user who is running us
9015$cat <<EOM
9016
9017I need to get your e-mail address in Internet format if possible, i.e.
9018something like user@host.domain. Please answer accurately since I have
9019no easy means to double check it. The default value provided below
9020is most probably close to reality but may not be valid from outside
9021your organization...
9022
9023EOM
9024cont=x
9025while test "$cont"; do
9026 case "$MAILDOMAIN" in
9027 '')
9028 if $test -s /etc/mailname; then
9029 maildomain=`$cat /etc/mailname`
9030 else
9031 maildomain="$myhostname$mydomain"
9032 fi
9033 ;;
9034 *) maildomain="$MAILDOMAIN";;
9035 esac
9036 case "$cf_email" in
9037 '') dflt="$cf_by@$maildomain";;
9038 *) dflt="$cf_email";;
9039 esac
9040 rp='What is your e-mail address?'
9041 . ./myread
9042 cf_email="$ans"
9043 case "$cf_email" in
9044 *@*.*) cont='' ;;
9045 *)
9046 rp='Address does not look like an Internet one. Use it anyway?'
9047 case "$fastread" in
9048 yes) dflt=y ;;
9049 *) dflt=n ;;
9050 esac
9051 . ./myread
9052 case "$ans" in
9053 y*) cont='' ;;
9054 *) echo " " ;;
9055 esac
9056 ;;
9057 esac
9058done
9059
9060: Ask e-mail of administrator
9061$cat <<EOM
9062
9063If you or somebody else will be maintaining perl at your site, please
9064fill in the correct e-mail address here so that they may be contacted
9065if necessary. Currently, the "perlbug" program included with perl
9066will send mail to this address in addition to perlbug@perl.org. You may
9067enter "none" for no administrator.
9068
9069EOM
9070case "$perladmin" in
9071'') dflt="$cf_email";;
9072*) dflt="$perladmin";;
9073esac
9074rp='Perl administrator e-mail address'
9075. ./myread
9076perladmin="$ans"
9077
9078: determine whether to only install version-specific parts.
9079echo " "
9080$cat <<EOM
9081Do you want to install only the version-specific parts of the perl
9082distribution? Usually you do *not* want to do this.
9083EOM
9084case "$versiononly" in
9085"$define"|[Yy]*|true) dflt='y' ;;
9086*) dflt='n';
9087esac
9088rp="Do you want to install only the version-specific parts of perl?"
9089. ./myread
9090case "$ans" in
9091[yY]*) val="$define";;
9092*) val="$undef" ;;
9093esac
9094set versiononly
9095eval $setvar
9096
9097case "$versiononly" in
9098"$define") inc_version_list=''
9099 inc_version_list_init=0
9100 ;;
9101esac
9102
9103: figure out how to guarantee perl startup
9104: XXX Note that this currently takes advantage of the bug that binexp ignores
9105: the Configure -Dinstallprefix setting, which in turn means that under
9106: relocatable @INC, initialinstalllocation is what binexp started as.
9107case "$startperl" in
9108'')
9109 case "$sharpbang" in
9110 *!)
9111 $cat <<EOH
9112
9113I can use the #! construct to start perl on your system. This will
9114make startup of perl scripts faster, but may cause problems if you
9115want to share those scripts and perl is not in a standard place
9116($initialinstalllocation/perl) on all your platforms. The alternative
9117is to force a shell by starting the script with a single ':' character.
9118
9119EOH
9120 case "$versiononly" in
9121 "$define") dflt="$initialinstalllocation/perl$version";;
9122 *) dflt="$initialinstalllocation/perl";;
9123 esac
9124 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
9125 . ./myread
9126 case "$ans" in
9127 none) startperl=": # use perl";;
9128 *) startperl="#!$ans"
9129 if $test 30 -lt `echo "$ans" | wc -c`; then
9130 $cat >&4 <<EOM
9131
9132WARNING: Some systems limit the #! command to 32 characters.
9133If you experience difficulty running Perl scripts with #!, try
9134installing Perl in a directory with a shorter pathname.
9135
9136EOM
9137 fi ;;
9138 esac
9139 ;;
9140 *) startperl=": # use perl"
9141 ;;
9142 esac
9143 ;;
9144esac
9145echo "I'll use $startperl to start perl scripts."
9146
9147: figure best path for perl in scripts
9148case "$perlpath" in
9149'')
9150 case "$versiononly" in
9151 "$define") perlpath="$initialinstalllocation/perl$version";;
9152 *) perlpath="$initialinstalllocation/perl";;
9153 esac
9154 case "$startperl" in
9155 *!*) ;;
9156 *)
9157 $cat <<EOH
9158
9159I will use the "eval 'exec'" idiom to start Perl on your system.
9160I can use the full path of your Perl binary for this purpose, but
9161doing so may cause problems if you want to share those scripts and
9162Perl is not always in a standard place ($initialinstalllocation/perl).
9163
9164EOH
9165 dflt="$initialinstalllocation/perl"
9166 rp="What path shall I use in \"eval 'exec'\"?"
9167 . ./myread
9168 perlpath="$ans"
9169 ;;
9170 esac
9171 ;;
9172esac
9173case "$startperl" in
9174*!*) ;;
9175*) echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9176esac
9177
9178: determine where public executable scripts go
9179set scriptdir scriptdir
9180eval $prefixit
9181case "$scriptdir" in
9182'')
9183 dflt="$bin"
9184 : guess some guesses
9185 $test -d /usr/share/scripts && dflt=/usr/share/scripts
9186 $test -d /usr/share/bin && dflt=/usr/share/bin
9187 $test -d /usr/local/script && dflt=/usr/local/script
9188 $test -d /usr/local/scripts && dflt=/usr/local/scripts
9189 $test -d $prefixexp/script && dflt=$prefixexp/script
9190 set dflt
9191 eval $prefixup
9192 ;;
9193*) dflt="$scriptdir"
9194 ;;
9195esac
9196$cat <<EOM
9197
9198Some installations have a separate directory just for executable scripts so
9199that they can mount it across multiple architectures but keep the scripts in
9200one spot. You might, for example, have a subdirectory of /usr/share for this.
9201Or you might just lump your scripts in with all your other executables.
9202
9203EOM
9204fn=d~
9205rp='Where do you keep publicly executable scripts?'
9206. ./getfile
9207if $test "X$ansexp" != "X$scriptdirexp"; then
9208 installscript=''
9209fi
9210installscriptdir=''
9211prefixvar=scriptdir
9212. ./setprefixvar
9213: A little fix up for an irregularly named variable.
9214installscript="$installscriptdir"
9215
9216: determine where add-on public executables go
9217case "$sitebin" in
9218'') dflt=$siteprefix/bin ;;
9219*) dflt=$sitebin ;;
9220esac
9221fn=d~
9222rp='Pathname where the add-on public executables should be installed?'
9223. ./getfile
9224prefixvar=sitebin
9225. ./setprefixvar
9226
9227: determine where add-on html pages go
9228: There is no standard location, so try to copy the previously-selected
9229: directory structure for the core html pages.
9230case "$sitehtml1dir" in
9231'') dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9232*) dflt=$sitehtml1dir ;;
9233esac
9234case "$dflt" in
9235''|' ') dflt=none ;;
9236esac
9237fn=dn+~
9238rp='Pathname where the site-specific html pages should be installed?'
9239. ./getfile
9240prefixvar=sitehtml1dir
9241. ./setprefixvar
9242
9243: determine where add-on library html pages go
9244: There is no standard location, so try to copy the previously-selected
9245: directory structure for the core html pages.
9246case "$sitehtml3dir" in
9247'') dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9248*) dflt=$sitehtml3dir ;;
9249esac
9250case "$dflt" in
9251''|' ') dflt=none ;;
9252esac
9253fn=dn+~
9254rp='Pathname where the site-specific library html pages should be installed?'
9255. ./getfile
9256prefixvar=sitehtml3dir
9257. ./setprefixvar
9258
9259: determine where add-on manual pages go
9260case "$siteman1dir" in
9261'') dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9262*) dflt=$siteman1dir ;;
9263esac
9264case "$dflt" in
9265''|' ') dflt=none ;;
9266esac
9267fn=dn+~
9268rp='Pathname where the site-specific manual pages should be installed?'
9269. ./getfile
9270prefixvar=siteman1dir
9271. ./setprefixvar
9272
9273: determine where add-on library man pages go
9274case "$siteman3dir" in
9275'') dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9276*) dflt=$siteman3dir ;;
9277esac
9278case "$dflt" in
9279''|' ') dflt=none ;;
9280esac
9281fn=dn+~
9282rp='Pathname where the site-specific library manual pages should be installed?'
9283. ./getfile
9284prefixvar=siteman3dir
9285. ./setprefixvar
9286
9287: determine where add-on public executable scripts go
9288case "$sitescript" in
9289'') dflt=$siteprefix/script
9290 $test -d $dflt || dflt=$sitebin ;;
9291*) dflt="$sitescript" ;;
9292esac
9293fn=d~+
9294rp='Pathname where add-on public executable scripts should be installed?'
9295. ./getfile
9296prefixvar=sitescript
9297. ./setprefixvar
9298
9299: Check if faststdio is requested and available
9300case "$usefaststdio" in
9301$define|true|[yY]*|'')
9302 xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9303 case "$xversion" in
9304 [68]) dflt='y' ;;
9305 *) dflt='n' ;;
9306 esac
9307 ;;
9308*) dflt='n';;
9309esac
9310cat <<EOM
9311
9312Perl can be built to use 'fast stdio', which means using the stdio
9313library but also directly manipulating the stdio buffers to enable
9314faster I/O. Using stdio is better for backward compatibility (especially
9315for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9316interface has been preferred instead of stdio.
9317
9318If this doesn't make any sense to you, just accept the default '$dflt'.
9319EOM
9320rp='Use the "fast stdio" if available?'
9321. ./myread
9322case "$ans" in
9323y|Y) val="$define" ;;
9324*) val="$undef" ;;
9325esac
9326set usefaststdio
9327eval $setvar
9328
9329
9330: define an is-a-typedef? function
9331typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9332case "$inclist" in
9333"") inclist="sys/types.h";;
9334esac;
9335eval "varval=\$$var";
9336case "$varval" in
9337"")
9338 $rm -f temp.c;
9339 for inc in $inclist; do
9340 echo "#include <$inc>" >>temp.c;
9341 done;
9342 echo "#ifdef $type" >> temp.c;
9343 echo "printf(\"We have $type\");" >> temp.c;
9344 echo "#endif" >> temp.c;
9345 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9346 if $contains $type temp.E >/dev/null 2>&1; then
9347 eval "$var=\$type";
9348 else
9349 eval "$var=\$def";
9350 fi;
9351 $rm -f temp.?;;
9352*) eval "$var=\$varval";;
9353esac'
9354
9355: define an is-a-typedef? function that prompts if the type is not available.
9356typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9357case "$inclist" in
9358"") inclist="sys/types.h";;
9359esac;
9360eval "varval=\$$var";
9361case "$varval" in
9362"")
9363 $rm -f temp.c;
9364 for inc in $inclist; do
9365 echo "#include <$inc>" >>temp.c;
9366 done;
9367 echo "#ifdef $type" >> temp.c;
9368 echo "printf(\"We have $type\");" >> temp.c;
9369 echo "#endif" >> temp.c;
9370 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9371 echo " " ;
9372 echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9373 if $contains $type temp.E >/dev/null 2>&1; then
9374 echo "$type found." >&4;
9375 eval "$var=\$type";
9376 else
9377 echo "$type NOT found." >&4;
9378 dflt="$def";
9379 . ./myread ;
9380 eval "$var=\$ans";
9381 fi;
9382 $rm -f temp.?;;
9383*) eval "$var=\$varval";;
9384esac'
9385
9386: see what type lseek is declared as in the kernel
9387rp="What is the type used for lseek's offset on this system?"
9388set off_t lseektype long stdio.h sys/types.h
9389eval $typedef_ask
9390
9391echo " "
9392echo "Checking to see how big your file offsets are..." >&4
9393$cat >try.c <<EOCP
9394#include <sys/types.h>
9395#include <stdio.h>
9396int main()
9397{
9398 printf("%d\n", (int)sizeof($lseektype));
9399 return(0);
9400}
9401EOCP
9402set try
9403if eval $compile_ok; then
9404 lseeksize=`$run ./try`
9405 echo "Your file offsets are $lseeksize bytes long."
9406else
9407 dflt=$longsize
9408 echo " "
9409 echo "(I can't seem to compile the test program. Guessing...)"
9410 rp="What is the size of your file offsets (in bytes)?"
9411 . ./myread
9412 lseeksize="$ans"
9413fi
9414$rm_try
9415
9416: see what type file positions are declared as in the library
9417rp="What is the type for file position used by fsetpos()?"
9418set fpos_t fpostype long stdio.h sys/types.h
9419eval $typedef_ask
9420
9421: Check size for Fpos_t
9422echo " "
9423case "$fpostype" in
9424*_t) zzz="$fpostype" ;;
9425*) zzz="fpos_t" ;;
9426esac
9427echo "Checking the size of $zzz..." >&4
9428cat > try.c <<EOCP
9429#include <sys/types.h>
9430#include <stdio.h>
9431#$i_stdlib I_STDLIB
9432#ifdef I_STDLIB
9433#include <stdlib.h>
9434#endif
9435int main() {
9436 printf("%d\n", (int)sizeof($fpostype));
9437 exit(0);
9438}
9439EOCP
9440set try
9441if eval $compile_ok; then
9442 yyy=`$run ./try`
9443 case "$yyy" in
9444 '') fpossize=4
9445 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9446 ;;
9447 *) fpossize=$yyy
9448 echo "Your $zzz is $fpossize bytes long."
9449 ;;
9450 esac
9451else
9452 dflt="$longsize"
9453 echo " " >&4
9454 echo "(I can't compile the test program. Guessing...)" >&4
9455 rp="What is the size of your file positions (in bytes)?"
9456 . ./myread
9457 fpossize="$ans"
9458fi
9459
9460: Check for large file support
9461# Backward compatibility (uselfs is deprecated).
9462case "$uselfs" in
9463"$define"|true|[yY]*)
9464 cat <<EOM >&4
9465
9466*** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9467EOM
9468 uselargefiles="$define"
9469 ;;
9470esac
9471
9472case "$lseeksize:$fpossize" in
94738:8) cat <<EOM
9474
9475You can have files larger than 2 gigabytes.
9476EOM
9477 val="$define" ;;
9478*) case "$uselargefiles" in
9479 "$undef"|false|[nN]*) dflt='n' ;;
9480 *) dflt='y' ;;
9481 esac
9482 cat <<EOM
9483
9484Perl can be built to understand large files (files larger than 2 gigabytes)
9485on some systems. To do so, Configure can be run with -Duselargefiles.
9486
9487If this doesn't make any sense to you, just accept the default '$dflt'.
9488EOM
9489 rp='Try to understand large files, if available?'
9490 . ./myread
9491 case "$ans" in
9492 y|Y) val="$define" ;;
9493 *) val="$undef" ;;
9494 esac
9495 ;;
9496esac
9497set uselargefiles
9498eval $setvar
9499: Look for a hint-file generated 'call-back-unit'. If the
9500: user has specified that a large files perl is to be built,
9501: we may need to set or change some other defaults.
9502if $test -f uselargefiles.cbu; then
9503 echo "Your platform has some specific hints regarding large file builds, using them..."
9504 . ./uselargefiles.cbu
9505fi
9506case "$uselargefiles" in
9507"$define")
9508 if $test -f uselargefiles.cbu; then
9509 echo " "
9510 echo "Rechecking to see how big your file offsets are..." >&4
9511 $cat >try.c <<EOCP
9512#include <sys/types.h>
9513#include <stdio.h>
9514int main()
9515{
9516 printf("%d\n", (int)sizeof($lseektype));
9517 return(0);
9518}
9519EOCP
9520 set try
9521 if eval $compile_ok; then
9522 lseeksize=`$run ./try`
9523 $echo "Your file offsets are now $lseeksize bytes long."
9524 else
9525 dflt="$lseeksize"
9526 echo " "
9527 echo "(I can't seem to compile the test program. Guessing...)"
9528 rp="What is the size of your file offsets (in bytes)?"
9529 . ./myread
9530 lseeksize="$ans"
9531 fi
9532 case "$fpostype" in
9533 *_t) zzz="$fpostype" ;;
9534 *) zzz="fpos_t" ;;
9535 esac
9536 $echo $n "Rechecking the size of $zzz...$c" >&4
9537 $cat > try.c <<EOCP
9538#include <sys/types.h>
9539#include <stdio.h>
9540#$i_stdlib I_STDLIB
9541#ifdef I_STDLIB
9542#include <stdlib.h>
9543#endif
9544int main() {
9545 printf("%d\n", (int)sizeof($fpostype));
9546 return(0);
9547}
9548EOCP
9549 set try
9550 if eval $compile_ok; then
9551 yyy=`$run ./try`
9552 dflt="$lseeksize"
9553 case "$yyy" in
9554 '') echo " "
9555 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9556 ;;
9557 *) fpossize=$yyy
9558 echo " $fpossize bytes." >&4
9559 ;;
9560 esac
9561 else
9562 dflt="$fpossize"
9563 echo " "
9564 echo "(I can't compile the test program. Guessing...)" >&4
9565 rp="What is the size of your file positions (in bytes)?"
9566 . ./myread
9567 fpossize="$ans"
9568 fi
9569 $rm_try
9570 fi
9571 ;;
9572esac
9573
9574: Check if we want perlio
9575useperlio="$define"
9576
9577: Set the vendorbin variables
9578case "$vendorprefix" in
9579'') d_vendorbin="$undef"
9580 vendorbin=''
9581 vendorbinexp=''
9582 ;;
9583*) d_vendorbin="$define"
9584 : determine where vendor-supplied executables go.
9585 case "$vendorbin" in
9586 '') dflt=$vendorprefix/bin ;;
9587 *) dflt="$vendorbin" ;;
9588 esac
9589 fn=d~+
9590 rp='Pathname for the vendor-supplied executables directory?'
9591 . ./getfile
9592 vendorbin="$ans"
9593 vendorbinexp="$ansexp"
9594 ;;
9595esac
9596prefixvar=vendorbin
9597. ./installprefix
9598
9599: Set the vendorhtml1dir variables
9600case "$vendorprefix" in
9601'') vendorhtml1dir=''
9602 vendorhtml1direxp=''
9603 ;;
9604*) : determine where vendor-supplied html pages go.
9605 : There is no standard location, so try to copy the previously-selected
9606 : directory structure for the core html pages.
9607 : XXX Better default suggestions would be welcome.
9608 case "$vendorhtml1dir" in
9609 '') dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9610 *) dflt=$vendorhtml1dir ;;
9611 esac
9612 case "$dflt" in
9613 ''|' ') dflt=none ;;
9614 esac
9615 fn=dn+~
9616 rp='Pathname for the vendor-supplied html pages?'
9617 . ./getfile
9618 vendorhtml1dir="$ans"
9619 vendorhtml1direxp="$ansexp"
9620 ;;
9621esac
9622: Use ' ' for none so value is preserved next time through Configure
9623$test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9624prefixvar=vendorhtml1dir
9625. ./installprefix
9626
9627: Set the vendorhtml3dir variables
9628case "$vendorprefix" in
9629'') vendorhtml3dir=''
9630 vendorhtml3direxp=''
9631 ;;
9632*) : determine where vendor-supplied module html pages go.
9633 : There is no standard location, so try to copy the previously-selected
9634 : directory structure for the core html pages.
9635 : XXX Better default suggestions would be welcome.
9636 case "$vendorhtml3dir" in
9637 '') dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9638 *) dflt=$vendorhtml3dir ;;
9639 esac
9640 case "$dflt" in
9641 ''|' ') dflt=none ;;
9642 esac
9643 fn=dn+~
9644 rp='Pathname for the vendor-supplied html pages?'
9645 . ./getfile
9646 vendorhtml3dir="$ans"
9647 vendorhtml3direxp="$ansexp"
9648 ;;
9649esac
9650: Use ' ' for none so value is preserved next time through Configure
9651$test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9652prefixvar=vendorhtml3dir
9653. ./installprefix
9654
9655: Set the vendorman1dir variables
9656case "$vendorprefix" in
9657'') vendorman1dir=''
9658 vendorman1direxp=''
9659 ;;
9660*) : determine where vendor-supplied manual pages go.
9661 case "$vendorman1dir" in
9662 '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9663 *) dflt=$vendorman1dir ;;
9664 esac
9665 case "$dflt" in
9666 ''|' ') dflt=none ;;
9667 esac
9668 fn=nd~+
9669 rp='Pathname for the vendor-supplied manual section 1 pages?'
9670 . ./getfile
9671 vendorman1dir="$ans"
9672 vendorman1direxp="$ansexp"
9673 ;;
9674esac
9675: Use ' ' for none so value is preserved next time through Configure
9676$test X"$vendorman1dir" = "X" && vendorman1dir=' '
9677prefixvar=vendorman1dir
9678. ./installprefix
9679
9680: Set the vendorman3dir variables
9681case "$vendorprefix" in
9682'') vendorman3dir=''
9683 vendorman3direxp=''
9684 ;;
9685*) : determine where vendor-supplied module manual pages go.
9686 case "$vendorman3dir" in
9687 '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9688 *) dflt=$vendorman3dir ;;
9689 esac
9690 case "$dflt" in
9691 ''|' ') dflt=none ;;
9692 esac
9693 fn=nd~+
9694 rp='Pathname for the vendor-supplied manual section 3 pages?'
9695 . ./getfile
9696 vendorman3dir="$ans"
9697 vendorman3direxp="$ansexp"
9698 ;;
9699esac
9700: Use ' ' for none so value is preserved next time through Configure
9701$test X"$vendorman3dir" = "X" && vendorman3dir=' '
9702prefixvar=vendorman3dir
9703. ./installprefix
9704
9705: Set the vendorscript variables
9706case "$vendorprefix" in
9707'') d_vendorscript="$undef"
9708 vendorscript=''
9709 vendorscriptexp=''
9710 ;;
9711*) d_vendorscript="$define"
9712 : determine where vendor-supplied scripts go.
9713 case "$vendorscript" in
9714 '') dflt=$vendorprefix/script
9715 $test -d $dflt || dflt=$vendorbin ;;
9716 *) dflt="$vendorscript" ;;
9717 esac
9718 $cat <<EOM
9719
9720The installation process will create a directory for
9721vendor-supplied scripts.
9722
9723EOM
9724 fn=d~+
9725 rp='Pathname for the vendor-supplied scripts directory?'
9726 . ./getfile
9727 vendorscript="$ans"
9728 vendorscriptexp="$ansexp"
9729 ;;
9730esac
9731prefixvar=vendorscript
9732. ./installprefix
9733
9734: script used to emit important warnings
9735cat >warn <<EOS
9736$startsh
9737if test \$# -gt 0; then
9738 echo "\$@" >msg
9739else
9740 cat >msg
9741fi
9742echo "*** WARNING:" >&4
9743sed -e 's/^/*** /' <msg >&4
9744echo "*** " >&4
9745cat msg >>config.msg
9746echo " " >>config.msg
9747rm -f msg
9748EOS
9749chmod +x warn
9750$eunicefix warn
9751
9752: see which of string.h or strings.h is needed
9753echo " "
9754strings=`./findhdr string.h`
9755if $test "$strings" && $test -r "$strings"; then
9756 echo "Using <string.h> instead of <strings.h>." >&4
9757 val="$define"
9758else
9759 val="$undef"
9760 strings=`./findhdr strings.h`
9761 if $test "$strings" && $test -r "$strings"; then
9762 echo "Using <strings.h> instead of <string.h>." >&4
9763 else
9764 ./warn "No string header found -- You'll surely have problems."
9765 fi
9766fi
9767set i_string
9768eval $setvar
9769case "$i_string" in
9770"$undef") strings=`./findhdr strings.h`;;
9771*) strings=`./findhdr string.h`;;
9772esac
9773
9774: see if qgcvt exists
9775set qgcvt d_qgcvt
9776eval $inlibc
9777
9778: Check print/scan long double stuff
9779echo " "
9780
9781if $test X"$d_longdbl" = X"$define"; then
9782
9783echo "Checking how to print long doubles..." >&4
9784
9785if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9786 $cat >try.c <<'EOCP'
9787#include <sys/types.h>
9788#include <stdio.h>
9789int main() {
9790 double d = 123.456;
9791 printf("%.3f\n", d);
9792}
9793EOCP
9794 set try
9795 if eval $compile; then
9796 yyy=`$run ./try`
9797 case "$yyy" in
9798 123.456)
9799 sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9800 sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9801 echo "We will use %f."
9802 ;;
9803 esac
9804 fi
9805fi
9806
9807if $test X"$sPRIfldbl" = X; then
9808 $cat >try.c <<'EOCP'
9809#include <sys/types.h>
9810#include <stdio.h>
9811int main() {
9812 long double d = 123.456;
9813 printf("%.3Lf\n", d);
9814}
9815EOCP
9816 set try
9817 if eval $compile; then
9818 yyy=`$run ./try`
9819 case "$yyy" in
9820 123.456)
9821 sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9822 sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9823 echo "We will use %Lf."
9824 ;;
9825 esac
9826 fi
9827fi
9828
9829if $test X"$sPRIfldbl" = X; then
9830 $cat >try.c <<'EOCP'
9831#include <sys/types.h>
9832#include <stdio.h>
9833int main() {
9834 long double d = 123.456;
9835 printf("%.3llf\n", d);
9836}
9837EOCP
9838 set try
9839 if eval $compile; then
9840 yyy=`$run ./try`
9841 case "$yyy" in
9842 123.456)
9843 sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9844 sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9845 echo "We will use %llf."
9846 ;;
9847 esac
9848 fi
9849fi
9850
9851if $test X"$sPRIfldbl" = X; then
9852 $cat >try.c <<'EOCP'
9853#include <sys/types.h>
9854#include <stdio.h>
9855int main() {
9856 long double d = 123.456;
9857 printf("%.3lf\n", d);
9858}
9859EOCP
9860 set try
9861 if eval $compile; then
9862 yyy=`$run ./try`
9863 case "$yyy" in
9864 123.456)
9865 sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9866 sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9867 echo "We will use %lf."
9868 ;;
9869 esac
9870 fi
9871fi
9872
9873if $test X"$sPRIfldbl" = X; then
9874 echo "Cannot figure out how to print long doubles." >&4
9875else
9876 sSCNfldbl=$sPRIfldbl # expect consistency
9877fi
9878
9879$rm_try
9880
9881fi # d_longdbl
9882
9883case "$sPRIfldbl" in
9884'') d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9885 d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9886 d_SCNfldbl="$undef";
9887 ;;
9888*) d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9889 d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9890 d_SCNfldbl="$define";
9891 ;;
9892esac
9893
9894: Check how to convert floats to strings.
9895
9896if test "X$d_Gconvert" = X; then
9897
9898echo " "
9899echo "Checking for an efficient way to convert floats to strings."
9900echo " " > try.c
9901case "$uselongdouble" in
9902"$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9903esac
9904case "$d_longdbl" in
9905"$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9906esac
9907case "$d_PRIgldbl" in
9908"$define") echo "#define HAS_PRIgldbl" >>try.c ;;
9909esac
9910$cat >>try.c <<EOP
9911#ifdef TRY_gconvert
9912#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9913char *myname = "gconvert";
9914#endif
9915#ifdef TRY_gcvt
9916#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9917char *myname = "gcvt";
9918#endif
9919#ifdef TRY_qgcvt
9920#define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9921char *myname = "qgcvt";
9922#define DOUBLETYPE long double
9923#endif
9924#ifdef TRY_sprintf
9925#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9926#ifdef HAS_PRIgldbl
9927#define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9928#else
9929#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9930#endif
9931#else
9932#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9933#endif
9934char *myname = "sprintf";
9935#endif
9936
9937#ifndef DOUBLETYPE
9938#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9939#define DOUBLETYPE long double
9940#else
9941#define DOUBLETYPE double
9942#endif
9943#endif
9944
9945#include <stdio.h>
9946
9947#$i_stdlib I_STDLIB
9948#ifdef I_STDLIB
9949#include <stdlib.h>
9950#endif
9951#$i_string I_STRING
9952#ifdef I_STRING
9953# include <string.h>
9954#else
9955# include <strings.h>
9956#endif
9957
9958int checkit(char *expect, char *got)
9959{
9960 if (strcmp(expect, got)) {
9961 printf("%s oddity: Expected %s, got %s\n",
9962 myname, expect, got);
9963 exit(1);
9964 }
9965}
9966
9967int main()
9968{
9969 char buf[64];
9970 buf[63] = '\0';
9971
9972 /* This must be 1st test on (which?) platform */
9973 /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9974 Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9975 checkit("0.1", buf);
9976
9977 Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9978 checkit("0.01", buf);
9979
9980 Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9981 checkit("0.001", buf);
9982
9983 Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9984 checkit("0.0001", buf);
9985
9986 Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9987 if (strlen(buf) > 5)
9988 checkit("9e-005", buf); /* for Microsoft ?? */
9989 else
9990 checkit("9e-05", buf);
9991
9992 Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9993 checkit("1", buf);
9994
9995 Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9996 checkit("1.1", buf);
9997
9998 Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9999 checkit("1.01", buf);
10000
10001 Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
10002 checkit("1.001", buf);
10003
10004 Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
10005 checkit("1.0001", buf);
10006
10007 Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
10008 checkit("1.00001", buf);
10009
10010 Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
10011 checkit("1.000001", buf);
10012
10013 Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
10014 checkit("0", buf);
10015
10016 Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
10017 checkit("-1", buf);
10018
10019 /* Some Linux gcvt's give 1.e+5 here. */
10020 Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
10021 checkit("100000", buf);
10022
10023 /* Some Linux gcvt's give -1.e+5 here. */
10024 Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
10025 checkit("-100000", buf);
10026
10027 Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
10028 checkit("123.456", buf);
10029
10030 /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
10031 Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
10032 /* 34 should be enough to scare even long double
10033 * places into using the e notation. */
10034 if (strlen(buf) > 5)
10035 checkit("1e+034", buf); /* for Microsoft */
10036 else
10037 checkit("1e+34", buf);
10038
10039 /* For Perl, if you add additional tests here, also add them to
10040 * t/base/num.t for benefit of platforms not using Configure or
10041 * overriding d_Gconvert */
10042
10043 exit(0);
10044}
10045EOP
10046: first add preferred functions to our list
10047xxx_list=""
10048for xxx_convert in $gconvert_preference; do
10049 case $xxx_convert in
10050 gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
10051 *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
10052 esac
10053done
10054: then add any others
10055for xxx_convert in gconvert gcvt sprintf; do
10056 case "$xxx_list" in
10057 *$xxx_convert*) ;;
10058 *) xxx_list="$xxx_list $xxx_convert" ;;
10059 esac
10060done
10061
10062case "$d_longdbl$uselongdouble" in
10063"$define$define")
10064 : again, add preferred functions to our list first
10065 xxx_ld_list=""
10066 for xxx_convert in $gconvert_ld_preference; do
10067 case $xxx_convert in
10068 qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10069 *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
10070 esac
10071 done
10072 : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
10073 for xxx_convert in qgcvt sprintf $xxx_list; do
10074 case "$xxx_ld_list" in
10075 $xxx_convert*|*" $xxx_convert"*) ;;
10076 *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10077 esac
10078 done
10079 : if sprintf cannot do long doubles, move it to the end
10080 if test "$d_PRIgldbl" != "$define"; then
10081 xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
10082 fi
10083 : if no qgcvt, remove it
10084 if test "$d_qgcvt" != "$define"; then
10085 xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
10086 fi
10087 : use the ld_list
10088 xxx_list="$xxx_ld_list"
10089 ;;
10090esac
10091
10092for xxx_convert in $xxx_list; do
10093 echo "Trying $xxx_convert..."
10094 $rm -f try try$_o core
10095 set try -DTRY_$xxx_convert
10096 if eval $compile; then
10097 echo "$xxx_convert() found." >&4
10098 if $run ./try; then
10099 echo "I'll use $xxx_convert to convert floats into a string." >&4
10100 break;
10101 else
10102 echo "...But $xxx_convert didn't work as I expected."
10103 xxx_convert=''
10104 fi
10105 else
10106 echo "$xxx_convert NOT found." >&4
10107 fi
10108done
10109
10110if test X$xxx_convert = X; then
10111 echo "*** WHOA THERE!!! ***" >&4
10112 echo "None of ($xxx_list) seemed to work properly. I'll use sprintf." >&4
10113 xxx_convert=sprintf
10114fi
10115
10116case "$xxx_convert" in
10117gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
10118gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
10119qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
10120*) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
10121 "$define$define$define")
10122 d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
10123 "$define$define$undef")
10124 d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
10125 *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
10126 esac
10127 ;;
10128esac
10129
10130fi
10131$rm_try
10132
10133: see if _fwalk exists
10134set fwalk d__fwalk
10135eval $inlibc
10136
10137: Initialize h_fcntl
10138h_fcntl=false
10139
10140: Initialize h_sysfile
10141h_sysfile=false
10142
10143: access call always available on UNIX
10144set access d_access
10145eval $inlibc
10146
10147: locate the flags for 'access()'
10148case "$d_access" in
10149"$define")
10150 echo " "
10151 $cat >access.c <<EOCP
10152#include <sys/types.h>
10153#ifdef I_FCNTL
10154#include <fcntl.h>
10155#endif
10156#ifdef I_SYS_FILE
10157#include <sys/file.h>
10158#endif
10159#ifdef I_UNISTD
10160#include <unistd.h>
10161#endif
10162#$i_stdlib I_STDLIB
10163#ifdef I_STDLIB
10164#include <stdlib.h>
10165#endif
10166int main() {
10167 exit(R_OK);
10168}
10169EOCP
10170 : check sys/file.h first, no particular reason here
10171 if $test `./findhdr sys/file.h` && \
10172 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10173 h_sysfile=true;
10174 echo "<sys/file.h> defines the *_OK access constants." >&4
10175 elif $test `./findhdr fcntl.h` && \
10176 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10177 h_fcntl=true;
10178 echo "<fcntl.h> defines the *_OK access constants." >&4
10179 elif $test `./findhdr unistd.h` && \
10180 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10181 echo "<unistd.h> defines the *_OK access constants." >&4
10182 else
10183 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10184 fi
10185 ;;
10186esac
10187$rm -f access*
10188
10189: see if accessx exists
10190set accessx d_accessx
10191eval $inlibc
10192
10193: see if aintl exists
10194set aintl d_aintl
10195eval $inlibc
10196
10197: see if alarm exists
10198set alarm d_alarm
10199eval $inlibc
10200
10201: see if 64bit time functions exists
10202
10203set ctime64 d_ctime64
10204eval $inlibc
10205
10206set localtime64 d_localtime64
10207eval $inlibc
10208
10209set gmtime64 d_gmtime64
10210eval $inlibc
10211
10212set mktime64 d_mktime64
10213eval $inlibc
10214
10215set difftime64 d_difftime64
10216eval $inlibc
10217
10218set asctime64 d_asctime64
10219eval $inlibc
10220
10221: see if POSIX threads are available
10222set pthread.h i_pthread
10223eval $inhdr
10224
10225: define a function to check prototypes
10226$cat > protochk <<EOSH
10227$startsh
10228cc="$cc"
10229optimize="$optimize"
10230ccflags="$ccflags"
10231prototype="$prototype"
10232define="$define"
10233rm_try="$rm_try"
10234usethreads=$usethreads
10235i_pthread=$i_pthread
10236pthread_h_first=$pthread_h_first
10237EOSH
10238
10239$cat >> protochk <<'EOSH'
10240
10241$rm_try
10242foo="$1"
10243shift
10244while test $# -ge 2; do
10245 case "$1" in
10246 $define) echo "#include <$2>" >> try.c ;;
10247 literal) echo "$2" >> try.c ;;
10248 esac
10249 # Extra magic for the benefit of systems that need pthread.h
10250 # to be included early to correctly detect threadsafe functions.
10251 # Such functions must guarantee themselves, though, that the usethreads
10252 # and i_pthread have been defined, before calling protochk.
10253 if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10254 echo "#include <pthread.h>" >> try.c
10255 pthread_h_done=yes
10256 fi
10257 shift 2
10258done
10259test "$prototype" = "$define" && echo '#define CAN_PROTOTYPE' >> try.c
10260cat >> try.c <<'EOCP'
10261#ifdef CAN_PROTOTYPE
10262#define _(args) args
10263#else
10264#define _(args) ()
10265#endif
10266EOCP
10267echo "$foo" >> try.c
10268echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10269$cc $optimize $ccflags -c try.c > /dev/null 2>&1
10270status=$?
10271$rm_try
10272exit $status
10273EOSH
10274chmod +x protochk
10275$eunicefix protochk
10276
10277: Define hasproto macro for Configure internal use
10278hasproto='varname=$1; func=$2; shift; shift;
10279while $test $# -ge 2; do
10280 case "$1" in
10281 $define) echo "#include <$2>";;
10282 esac ;
10283 shift 2;
10284done > try.c;
10285$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10286if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10287 echo "$func() prototype found.";
10288 val="$define";
10289else
10290 echo "$func() prototype NOT found.";
10291 val="$undef";
10292fi;
10293set $varname;
10294eval $setvar;
10295$rm_try tryout.c'
10296
10297: see if sys/types.h has to be included
10298set sys/types.h i_systypes
10299eval $inhdr
10300
10301: see if sys/select.h has to be included
10302set sys/select.h i_sysselct
10303eval $inhdr
10304
10305: Define hasfield macro for Configure internal use
10306hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10307while $test $# -ge 2; do
10308 case "$1" in
10309 $define) echo "#include <$2>";;
10310 esac ;
10311 shift 2;
10312done > try.c;
10313echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10314set try;
10315if eval $compile; then
10316 val="$define";
10317else
10318 val="$undef";
10319fi;
10320set $varname;
10321eval $setvar;
10322$rm_try'
10323
10324: see if we should include time.h, sys/time.h, or both
10325echo " "
10326if test "X$timeincl" = X; then
10327 echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10328 $echo $n "I'm now running the test program...$c"
10329 $cat >try.c <<EOCP
10330#include <sys/types.h>
10331#ifdef I_TIME
10332#include <time.h>
10333#endif
10334#ifdef I_SYSTIME
10335#ifdef SYSTIMEKERNEL
10336#define KERNEL
10337#endif
10338#include <sys/time.h>
10339#endif
10340#ifdef I_SYSSELECT
10341#include <sys/select.h>
10342#endif
10343#$i_stdlib I_STDLIB
10344#ifdef I_STDLIB
10345#include <stdlib.h>
10346#endif
10347int main()
10348{
10349 struct tm foo;
10350#ifdef S_TIMEVAL
10351 struct timeval bar;
10352#endif
10353#ifdef S_TIMEZONE
10354 struct timezone tzp;
10355#endif
10356 if (foo.tm_sec == foo.tm_sec)
10357 exit(0);
10358#ifdef S_TIMEVAL
10359 if (bar.tv_sec == bar.tv_sec)
10360 exit(0);
10361#endif
10362 exit(1);
10363}
10364EOCP
10365 flags=''
10366 for s_timezone in '-DS_TIMEZONE' ''; do
10367 sysselect=''
10368 for s_timeval in '-DS_TIMEVAL' ''; do
10369 for i_systimek in '' '-DSYSTIMEKERNEL'; do
10370 for i_time in '' '-DI_TIME'; do
10371 for i_systime in '-DI_SYSTIME' ''; do
10372 case "$flags" in
10373 '') $echo $n ".$c"
10374 set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10375 if eval $compile; then
10376 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10377 shift
10378 flags="$*"
10379 echo " "
10380 $echo $n "Succeeded with $flags$c"
10381 fi
10382 ;;
10383 esac
10384 done
10385 done
10386 done
10387 done
10388 done
10389 timeincl=''
10390 echo " "
10391 case "$flags" in
10392 *SYSTIMEKERNEL*) i_systimek="$define"
10393 timeincl=`./findhdr sys/time.h`
10394 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10395 *) i_systimek="$undef";;
10396 esac
10397 case "$flags" in
10398 *I_TIME*) i_time="$define"
10399 timeincl=`./findhdr time.h`" $timeincl"
10400 echo "We'll include <time.h>." >&4;;
10401 *) i_time="$undef";;
10402 esac
10403 case "$flags" in
10404 *I_SYSTIME*) i_systime="$define"
10405 timeincl=`./findhdr sys/time.h`" $timeincl"
10406 echo "We'll include <sys/time.h>." >&4;;
10407 *) i_systime="$undef";;
10408 esac
10409 $rm_try
10410fi
10411: see if struct tm knows about tm_zone
10412case "$i_systime$i_time" in
10413*$define*)
10414 echo " "
10415 echo "Checking to see if your struct tm has tm_zone field..." >&4
10416 set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10417 eval $hasfield
10418 ;;
10419*) val="$undef"
10420 set d_tm_tm_zone
10421 eval $setvar
10422 ;;
10423esac
10424case "$d_tm_tm_zone" in
10425"$define") echo "Yes, it does." ;;
10426*) echo "No, it doesn't." ;;
10427esac
10428: see if struct tm knows about tm_gmtoff
10429case "$i_systime$i_time" in
10430*$define*)
10431 echo " "
10432 echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10433 set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10434 eval $hasfield
10435 ;;
10436*) val="$undef"
10437 set d_tm_tm_gmtoff
10438 eval $setvar
10439 ;;
10440esac
10441case "$d_tm_tm_gmtoff" in
10442"$define") echo "Yes, it does." ;;
10443*) echo "No, it doesn't." ;;
10444esac
10445
10446: see if asctime_r exists
10447set asctime_r d_asctime_r
10448eval $inlibc
10449case "$d_asctime_r" in
10450"$define")
10451 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10452 case "$d_asctime_r_proto:$usethreads" in
10453 ":define") d_asctime_r_proto=define
10454 set d_asctime_r_proto asctime_r $hdrs
10455 eval $hasproto ;;
10456 *) ;;
10457 esac
10458 case "$d_asctime_r_proto" in
10459 define)
10460 case "$asctime_r_proto" in
10461 ''|0) try='char* asctime_r(const struct tm*, char*);'
10462 ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10463 esac
10464 case "$asctime_r_proto" in
10465 ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10466 ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10467 esac
10468 case "$asctime_r_proto" in
10469 ''|0) try='int asctime_r(const struct tm*, char*);'
10470 ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10471 esac
10472 case "$asctime_r_proto" in
10473 ''|0) try='int asctime_r(const struct tm*, char*, int);'
10474 ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10475 esac
10476 case "$asctime_r_proto" in
10477 ''|0) d_asctime_r=undef
10478 asctime_r_proto=0
10479 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10480 * ) case "$asctime_r_proto" in
10481 REENTRANT_PROTO*) ;;
10482 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10483 esac
10484 echo "Prototype: $try" ;;
10485 esac
10486 ;;
10487 *) case "$usethreads" in
10488 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10489 esac
10490 d_asctime_r=undef
10491 asctime_r_proto=0
10492 ;;
10493 esac
10494 ;;
10495*) asctime_r_proto=0
10496 ;;
10497esac
10498
10499: see if atolf exists
10500set atolf d_atolf
10501eval $inlibc
10502
10503: see if atoll exists
10504set atoll d_atoll
10505eval $inlibc
10506
10507: Look for GCC-style attribute format
10508case "$d_attribute_format" in
10509'')
10510echo " "
10511echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10512$cat >attrib.c <<'EOCP'
10513#include <stdio.h>
10514void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10515EOCP
10516if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10517 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10518 echo "Your C compiler doesn't support __attribute__((format))."
10519 val="$undef"
10520 else
10521 echo "Your C compiler supports __attribute__((format))."
10522 val="$define"
10523 fi
10524else
10525 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10526 val="$undef"
10527fi
10528;;
10529*) val="$d_attribute_format" ;;
10530esac
10531set d_attribute_format
10532eval $setvar
10533$rm -f attrib*
10534
10535: Look for GCC-style attribute format with null format allowed
10536case "$d_printf_format_null" in
10537'') case "$d_attribute_format" in
10538 $define)
10539 echo " "
10540 echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10541$cat >attrib.c <<EOCP
10542#include <stdio.h>
10543#$i_stdlib I_STDLIB
10544#ifdef I_STDLIB
10545#include <stdlib.h>
10546#endif
10547int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10548int null_printf (char* pat,...) { return (int)pat; }
10549int main () { exit(null_printf(NULL)); }
10550EOCP
10551 if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10552 : run the executable in case it produces a run-time warning
10553 if $run ./attrib >>attrib.out 2>&1; then
10554 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10555 echo "Your C compiler doesn't allow __printf__ format to be null."
10556 val="$undef"
10557 else
10558 echo "Your C compiler allows __printf__ format to be null."
10559 val="$define"
10560 fi
10561 else
10562 echo "Your C compiler executable failed with __printf__ format null."
10563 val="$undef"
10564 fi
10565 else
10566 echo "Your C compiler fails with __printf__ format null."
10567 val="$undef"
10568 fi
10569 ;;
10570 *) val="$undef" ;;
10571 esac
10572;;
10573*) val="$d_printf_format_null" ;;
10574esac
10575set d_printf_format_null
10576eval $setvar
10577$rm -f attrib*
10578
10579: Look for GCC-style attribute malloc
10580case "$d_attribute_malloc" in
10581'')
10582echo " "
10583echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10584$cat >attrib.c <<'EOCP'
10585#include <stdio.h>
10586char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10587EOCP
10588if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10589 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10590 echo "Your C compiler doesn't support __attribute__((malloc))."
10591 val="$undef"
10592 else
10593 echo "Your C compiler supports __attribute__((malloc))."
10594 val="$define"
10595 fi
10596else
10597 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10598 val="$undef"
10599fi
10600;;
10601*) val="$d_attribute_malloc" ;;
10602esac
10603set d_attribute_malloc
10604eval $setvar
10605$rm -f attrib*
10606
10607: Look for GCC-style attribute nonnull
10608case "$d_attribute_nonnull" in
10609'')
10610echo " "
10611echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10612$cat >attrib.c <<'EOCP'
10613#include <stdio.h>
10614void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10615EOCP
10616if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10617 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10618 echo "Your C compiler doesn't support __attribute__((nonnull))."
10619 val="$undef"
10620 else
10621 echo "Your C compiler supports __attribute__((nonnull))."
10622 val="$define"
10623 fi
10624else
10625 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10626 val="$undef"
10627fi
10628;;
10629*) val="$d_attribute_nonnull" ;;
10630esac
10631set d_attribute_nonnull
10632eval $setvar
10633$rm -f attrib*
10634
10635: Look for GCC-style attribute noreturn
10636case "$d_attribute_noreturn" in
10637'')
10638echo " "
10639echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10640$cat >attrib.c <<'EOCP'
10641#include <stdio.h>
10642void fall_over_dead( void ) __attribute__((noreturn));
10643EOCP
10644if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10645 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10646 echo "Your C compiler doesn't support __attribute__((noreturn))."
10647 val="$undef"
10648 else
10649 echo "Your C compiler supports __attribute__((noreturn))."
10650 val="$define"
10651 fi
10652else
10653 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10654 val="$undef"
10655fi
10656;;
10657*) val="$d_attribute_noreturn" ;;
10658esac
10659set d_attribute_noreturn
10660eval $setvar
10661$rm -f attrib*
10662
10663: Look for GCC-style attribute pure
10664case "$d_attribute_pure" in
10665'')
10666echo " "
10667echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10668$cat >attrib.c <<'EOCP'
10669#include <stdio.h>
10670int square( int n ) __attribute__((pure));
10671EOCP
10672if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10673 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10674 echo "Your C compiler doesn't support __attribute__((pure))."
10675 val="$undef"
10676 else
10677 echo "Your C compiler supports __attribute__((pure))."
10678 val="$define"
10679 fi
10680else
10681 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10682 val="$undef"
10683fi
10684;;
10685*) val="$d_attribute_pure" ;;
10686esac
10687set d_attribute_pure
10688eval $setvar
10689$rm -f attrib*
10690
10691: Look for GCC-style attribute unused
10692case "$d_attribute_unused" in
10693'')
10694echo " "
10695echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10696$cat >attrib.c <<'EOCP'
10697#include <stdio.h>
10698int do_something( int dummy __attribute__((unused)), int n );
10699EOCP
10700if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10701 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10702 echo "Your C compiler doesn't support __attribute__((unused))."
10703 val="$undef"
10704 else
10705 echo "Your C compiler supports __attribute__((unused))."
10706 val="$define"
10707 fi
10708else
10709 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10710 val="$undef"
10711fi
10712;;
10713*) val="$d_attribute_unused" ;;
10714esac
10715set d_attribute_unused
10716eval $setvar
10717$rm -f attrib*
10718
10719: Look for GCC-style attribute deprecated
10720case "$d_attribute_deprecated" in
10721'')
10722echo " "
10723echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
10724$cat >attrib.c <<'EOCP'
10725#include <stdio.h>
10726int I_am_deprecated(void) __attribute__((deprecated));
10727EOCP
10728if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10729 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10730 echo "Your C compiler doesn't support __attribute__((deprecated))."
10731 val="$undef"
10732 else
10733 echo "Your C compiler supports __attribute__((deprecated))."
10734 val="$define"
10735 fi
10736else
10737 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10738 val="$undef"
10739fi
10740;;
10741*) val="$d_attribute_deprecated" ;;
10742esac
10743set d_attribute_deprecated
10744eval $setvar
10745$rm -f attrib*
10746
10747: Look for GCC-style attribute warn_unused_result
10748case "$d_attribute_warn_unused_result" in
10749'')
10750echo " "
10751echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10752$cat >attrib.c <<'EOCP'
10753#include <stdio.h>
10754int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10755EOCP
10756if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10757 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10758 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10759 val="$undef"
10760 else
10761 echo "Your C compiler supports __attribute__((warn_unused_result))."
10762 val="$define"
10763 fi
10764else
10765 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10766 val="$undef"
10767fi
10768;;
10769*) val="$d_attribute_warn_unused_result" ;;
10770esac
10771set d_attribute_warn_unused_result
10772eval $setvar
10773$rm -f attrib*
10774
10775: see if bcmp exists
10776set bcmp d_bcmp
10777eval $inlibc
10778
10779: see if bcopy exists
10780set bcopy d_bcopy
10781eval $inlibc
10782
10783: see if getpgrp exists
10784set getpgrp d_getpgrp
10785eval $inlibc
10786
10787case "$d_getpgrp" in
10788"$define")
10789 echo " "
10790 echo "Checking to see which flavor of getpgrp is in use..."
10791 $cat >try.c <<EOP
10792#$i_unistd I_UNISTD
10793#include <sys/types.h>
10794#ifdef I_UNISTD
10795# include <unistd.h>
10796#endif
10797#$i_stdlib I_STDLIB
10798#ifdef I_STDLIB
10799#include <stdlib.h>
10800#endif
10801int main()
10802{
10803 if (getuid() == 0) {
10804 printf("(I see you are running Configure as super-user...)\n");
10805 setuid(1);
10806 }
10807#ifdef TRY_BSD_PGRP
10808 if (getpgrp(1) == 0)
10809 exit(0);
10810#else
10811 if (getpgrp() > 0)
10812 exit(0);
10813#endif
10814 exit(1);
10815}
10816EOP
10817 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10818 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10819 val="$define"
10820 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10821 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10822 val="$undef"
10823 else
10824 echo "I can't seem to compile and run the test program."
10825 if ./usg; then
10826 xxx="a USG one, i.e. you use getpgrp()."
10827 else
10828 # SVR4 systems can appear rather BSD-ish.
10829 case "$i_unistd" in
10830 $undef)
10831 xxx="a BSD one, i.e. you use getpgrp(pid)."
10832 val="$define"
10833 ;;
10834 $define)
10835 xxx="probably a USG one, i.e. you use getpgrp()."
10836 val="$undef"
10837 ;;
10838 esac
10839 fi
10840 echo "Assuming your getpgrp is $xxx" >&4
10841 fi
10842 ;;
10843*) val="$undef";;
10844esac
10845set d_bsdgetpgrp
10846eval $setvar
10847$rm_try
10848
10849: see if setpgrp exists
10850set setpgrp d_setpgrp
10851eval $inlibc
10852
10853case "$d_setpgrp" in
10854"$define")
10855 echo " "
10856 echo "Checking to see which flavor of setpgrp is in use..."
10857 $cat >try.c <<EOP
10858#$i_unistd I_UNISTD
10859#include <sys/types.h>
10860#ifdef I_UNISTD
10861# include <unistd.h>
10862#endif
10863#$i_stdlib I_STDLIB
10864#ifdef I_STDLIB
10865#include <stdlib.h>
10866#endif
10867int main()
10868{
10869 if (getuid() == 0) {
10870 printf("(I see you are running Configure as super-user...)\n");
10871 setuid(1);
10872 }
10873#ifdef TRY_BSD_PGRP
10874 if (-1 == setpgrp(1, 1))
10875 exit(0);
10876#else
10877 if (setpgrp() != -1)
10878 exit(0);
10879#endif
10880 exit(1);
10881}
10882EOP
10883 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10884 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10885 val="$define"
10886 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10887 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10888 val="$undef"
10889 else
10890 echo "(I can't seem to compile and run the test program.)"
10891 if ./usg; then
10892 xxx="a USG one, i.e. you use setpgrp()."
10893 else
10894 # SVR4 systems can appear rather BSD-ish.
10895 case "$i_unistd" in
10896 $undef)
10897 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10898 val="$define"
10899 ;;
10900 $define)
10901 xxx="probably a USG one, i.e. you use setpgrp()."
10902 val="$undef"
10903 ;;
10904 esac
10905 fi
10906 echo "Assuming your setpgrp is $xxx" >&4
10907 fi
10908 ;;
10909*) val="$undef";;
10910esac
10911set d_bsdsetpgrp
10912eval $setvar
10913$rm_try
10914
10915: Look for GCC-style __builtin_choose_expr
10916case "$d_builtin_choose_expr" in
10917'')
10918 echo " "
10919 echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10920 $cat >try.c <<'EOCP'
10921#include <assert.h>
10922#include <stdlib.h>
10923#include <stdio.h>
10924
10925#define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10926
10927int main(void) {
10928 assert( SYRINX(1) == 2112 );
10929 assert( SYRINX(1) != 5150 );
10930 assert( SYRINX(0) == 5150 );
10931 assert( SYRINX(0) != 2112 );
10932 puts( "All good!" );
10933 exit(0);
10934}
10935
10936EOCP
10937 set try
10938 if eval $compile && $run ./try; then
10939 echo "Your C compiler supports __builtin_choose_expr."
10940 val="$define"
10941 else
10942 echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10943 val="$undef"
10944 fi
10945;;
10946*) val="$d_builtin_choose_expr" ;;
10947esac
10948
10949set d_builtin_choose_expr
10950eval $setvar
10951$rm_try
10952
10953: Look for GCC-style __builtin_expect
10954case "$d_builtin_expect" in
10955'')
10956 echo " "
10957 echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10958 $cat >try.c <<'EOCP'
10959int main(void) {
10960 int n = 50;
10961 if ( __builtin_expect(n, 0) ) n = 1;
10962 /* Remember shell exit code truth is 0, C truth is non-zero */
10963 return !(n == 1);
10964}
10965EOCP
10966 set try
10967 if eval $compile && $run ./try; then
10968 echo "Your C compiler supports __builtin_expect."
10969 val="$define"
10970 else
10971 echo "Your C compiler doesn't seem to understand __builtin_expect."
10972 val="$undef"
10973 fi
10974 ;;
10975*) val="$d_builtin_expect" ;;
10976esac
10977
10978set d_builtin_expect
10979eval $setvar
10980$rm_try
10981
10982: see if bzero exists
10983set bzero d_bzero
10984eval $inlibc
10985
10986: see if stdarg is available
10987echo " "
10988if $test `./findhdr stdarg.h`; then
10989 echo "<stdarg.h> found." >&4
10990 valstd="$define"
10991else
10992 echo "<stdarg.h> NOT found." >&4
10993 valstd="$undef"
10994fi
10995
10996: see if varargs is available
10997echo " "
10998if $test `./findhdr varargs.h`; then
10999 echo "<varargs.h> found." >&4
11000else
11001 echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
11002fi
11003
11004: set up the varargs testing programs
11005$cat > varargs.c <<EOP
11006#ifdef I_STDARG
11007#include <stdarg.h>
11008#endif
11009#ifdef I_VARARGS
11010#include <varargs.h>
11011#endif
11012
11013#ifdef I_STDARG
11014int f(char *p, ...)
11015#else
11016int f(va_alist)
11017va_dcl
11018#endif
11019{
11020 va_list ap;
11021#ifndef I_STDARG
11022 char *p;
11023#endif
11024#ifdef I_STDARG
11025 va_start(ap,p);
11026#else
11027 va_start(ap);
11028 p = va_arg(ap, char *);
11029#endif
11030 va_end(ap);
11031 return 0;
11032}
11033EOP
11034$cat > varargs <<EOP
11035$startsh
11036if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
11037 echo "true"
11038else
11039 echo "false"
11040fi
11041$rm -f varargs$_o
11042EOP
11043chmod +x varargs
11044
11045: now check which varargs header should be included
11046echo " "
11047i_varhdr=''
11048val=''
11049case "$valstd" in
11050"$define")
11051 if `./varargs I_STDARG`; then
11052 val='stdarg.h'
11053 elif `./varargs I_VARARGS`; then
11054 val='varargs.h'
11055 fi
11056 ;;
11057*)
11058 if `./varargs I_VARARGS`; then
11059 val='varargs.h'
11060 fi
11061 ;;
11062esac
11063case "$val" in
11064'')
11065 echo " "
11066 echo "*** WHOA THERE!!! ***" >&4
11067 echo " Your C compiler \"$cc\" doesn't seem to support stdarg or varargs!" >&4
11068 case "$knowitall" in
11069 '')
11070 echo " I'm giving up; maybe you can try again with a different compiler?" >&4
11071 exit 1
11072 ;;
11073 esac
11074echo "I could not find the definition for va_dcl... You have problems..." >&4
11075 val="$undef"; set i_stdarg; eval $setvar
11076 val="$undef"; set i_varargs; eval $setvar
11077 ;;
11078*)
11079 set i_varhdr
11080 eval $setvar
11081 case "$i_varhdr" in
11082 stdarg.h)
11083 val="$define"; set i_stdarg; eval $setvar
11084 val="$undef"; set i_varargs; eval $setvar
11085 ;;
11086 varargs.h)
11087 val="$undef"; set i_stdarg; eval $setvar
11088 val="$define"; set i_varargs; eval $setvar
11089 ;;
11090 esac
11091 echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
11092esac
11093$rm -f varargs*
11094
11095: see if the Compiler supports C99 variadic macros
11096case "$i_stdarg$i_stdlib" in
11097 "$define$define")
11098 echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
11099 $cat >try.c <<EOCP
11100#include <stdio.h>
11101#include <stdarg.h>
11102
11103#define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
11104
11105int main() {
11106 char buf[20];
11107 foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
11108 puts(buf);
11109 return 0;
11110}
11111EOCP
11112 set try
11113 if eval $compile && $run ./try 2>&1 >/dev/null; then
11114 case "`$run ./try`" in
11115 "123 456 789")
11116 echo "You have C99 variadic macros." >&4
11117 d_c99_variadic_macros="$define"
11118 ;;
11119 *)
11120 echo "You don't have functional C99 variadic macros." >&4
11121 d_c99_variadic_macros="$undef"
11122 ;;
11123 esac
11124 else
11125 echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
11126 d_c99_variadic_macros="$undef"
11127 fi
11128 $rm_try
11129 ;;
11130 *)
11131 echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
11132 d_c99_variadic_macros="$undef"
11133 ;;
11134esac
11135
11136: see if signal is declared as pointer to function returning int or void
11137echo " "
11138xxx=`./findhdr signal.h`
11139$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
11140if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
11141 echo "You have int (*signal())() instead of void." >&4
11142 val="$undef"
11143elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
11144 echo "You have void (*signal())()." >&4
11145 val="$define"
11146elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
11147 echo "You have int (*signal())() instead of void." >&4
11148 val="$undef"
11149elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
11150 echo "You have void (*signal())()." >&4
11151 val="$define"
11152else
11153 case "$d_voidsig" in
11154 '')
11155 echo "I can't determine whether signal handler returns void or int..." >&4
11156 dflt=void
11157 rp="What type does your signal handler return?"
11158 . ./myread
11159 case "$ans" in
11160 v*) val="$define";;
11161 *) val="$undef";;
11162 esac;;
11163 "$define")
11164 echo "As you already told me, signal handler returns void." >&4
11165 val="$define"
11166 ;;
11167 *) echo "As you already told me, signal handler returns int." >&4
11168 val="$undef"
11169 ;;
11170 esac
11171fi
11172set d_voidsig
11173eval $setvar
11174case "$d_voidsig" in
11175"$define") signal_t="void";;
11176*) signal_t="int";;
11177esac
11178$rm -f $$.tmp
11179
11180: check for ability to cast large floats to 32-bit ints.
11181echo " "
11182echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11183if $test "$intsize" -ge 4; then
11184 xxx=int
11185else
11186 xxx=long
11187fi
11188$cat >try.c <<EOCP
11189#include <stdio.h>
11190#$i_stdlib I_STDLIB
11191#ifdef I_STDLIB
11192#include <stdlib.h>
11193#endif
11194#include <sys/types.h>
11195#include <signal.h>
11196$signal_t blech(int s) { exit(3); }
11197int main()
11198{
11199 $xxx i32;
11200 double f, g;
11201 int result = 0;
11202 char str[16];
11203 signal(SIGFPE, blech);
11204
11205 /* Don't let compiler optimize the test away. Store the number
11206 in a writable string for gcc to pass to sscanf under HP-UX.
11207 */
11208 sprintf(str, "2147483647");
11209 sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11210 g = 10 * f;
11211 i32 = ($xxx) g;
11212
11213 /* x86 processors will probably give 0x8000 0000, which is a
11214 sign change. We don't want that. We want to mimic SPARC
11215 behavior here, which is to preserve the sign and give
11216 back 0x7fff ffff.
11217 */
11218 if (i32 != ($xxx) f)
11219 result |= 1;
11220 exit(result);
11221}
11222EOCP
11223set try
11224if eval $compile_ok; then
11225 $run ./try
11226 yyy=$?
11227else
11228 echo "(I can't seem to compile the test program--assuming it can't)"
11229 yyy=1
11230fi
11231case "$yyy" in
112320) val="$define"
11233 echo "Yup, it can."
11234 ;;
11235*) val="$undef"
11236 echo "Nope, it can't."
11237 ;;
11238esac
11239set d_casti32
11240eval $setvar
11241$rm_try
11242
11243: check for ability to cast negative floats to unsigned
11244echo " "
11245echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11246$cat >try.c <<EOCP
11247#include <stdio.h>
11248#$i_stdlib I_STDLIB
11249#ifdef I_STDLIB
11250#include <stdlib.h>
11251#endif
11252#include <sys/types.h>
11253#include <signal.h>
11254$signal_t blech(int s) { exit(7); }
11255$signal_t blech_in_list(int s) { exit(4); }
11256unsigned long dummy_long(unsigned long p) { return p; }
11257unsigned int dummy_int(unsigned int p) { return p; }
11258unsigned short dummy_short(unsigned short p) { return p; }
11259int main()
11260{
11261 double f;
11262 unsigned long along;
11263 unsigned int aint;
11264 unsigned short ashort;
11265 int result = 0;
11266 char str[16];
11267
11268 /* Frustrate gcc-2.7.2's optimizer which failed this test with
11269 a direct f = -123. assignment. gcc-2.8.0 reportedly
11270 optimized the whole file away
11271 */
11272 /* Store the number in a writable string for gcc to pass to
11273 sscanf under HP-UX.
11274 */
11275 sprintf(str, "-123");
11276 sscanf(str, "%lf", &f); /* f = -123.; */
11277
11278 signal(SIGFPE, blech);
11279 along = (unsigned long)f;
11280 aint = (unsigned int)f;
11281 ashort = (unsigned short)f;
11282 if (along != (unsigned long)-123)
11283 result |= 1;
11284 if (aint != (unsigned int)-123)
11285 result |= 1;
11286 if (ashort != (unsigned short)-123)
11287 result |= 1;
11288 sprintf(str, "1073741824.");
11289 sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11290 f = f + f;
11291 along = 0;
11292 along = (unsigned long)f;
11293 if (along != 0x80000000)
11294 result |= 2;
11295 f -= 1.;
11296 along = 0;
11297 along = (unsigned long)f;
11298 if (along != 0x7fffffff)
11299 result |= 1;
11300 f += 2.;
11301 along = 0;
11302 along = (unsigned long)f;
11303 if (along != 0x80000001)
11304 result |= 2;
11305 if (result)
11306 exit(result);
11307 signal(SIGFPE, blech_in_list);
11308 sprintf(str, "123.");
11309 sscanf(str, "%lf", &f); /* f = 123.; */
11310 along = dummy_long((unsigned long)f);
11311 aint = dummy_int((unsigned int)f);
11312 ashort = dummy_short((unsigned short)f);
11313 if (along != (unsigned long)123)
11314 result |= 4;
11315 if (aint != (unsigned int)123)
11316 result |= 4;
11317 if (ashort != (unsigned short)123)
11318 result |= 4;
11319 exit(result);
11320
11321}
11322EOCP
11323set try
11324if eval $compile_ok; then
11325 $run ./try
11326 castflags=$?
11327else
11328 echo "(I can't seem to compile the test program--assuming it can't)"
11329 castflags=7
11330fi
11331case "$castflags" in
113320) val="$define"
11333 echo "Yup, it can."
11334 ;;
11335*) val="$undef"
11336 echo "Nope, it can't."
11337 ;;
11338esac
11339set d_castneg
11340eval $setvar
11341$rm_try
11342
11343: see if vprintf exists
11344echo " "
11345if set vprintf val -f d_vprintf; eval $csym; $val; then
11346 echo 'vprintf() found.' >&4
11347 val="$define"
11348 $cat >try.c <<EOF
11349#$i_stdarg I_STDARG /* Only one of these can be defined by i_varhrd */
11350#$i_varargs I_VARARGS
11351
11352#$i_stdlib I_STDLIB
11353#$i_unistd I_UNISTD
11354
11355#ifdef I_STDARG
11356# include <stdarg.h>
11357#else /* I_VARARGS */
11358# include <varargs.h>
11359#endif
11360
11361#ifdef I_UNISTD
11362# include <unistd.h>
11363#endif
11364
11365#ifdef I_STDLIB
11366# include <stdlib.h>
11367#endif
11368
11369#include <stdio.h> /* vsprintf prototype */
11370
11371#ifdef I_STDARG
11372void xxx(int n, ...)
11373{
11374 va_list args;
11375 char buf[10];
11376 va_start(args, n);
11377 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11378}
11379int main() { xxx(1, "foo"); }
11380
11381#else /* I_VARARGS */
11382
11383xxx(va_alist)
11384va_dcl
11385{
11386 va_list args;
11387 char buf[10];
11388 va_start(args);
11389 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11390}
11391int main() { xxx("foo"); }
11392
11393#endif
11394
11395EOF
11396 set try
11397 if eval $compile_ok; then
11398 if $run ./try; then
11399 echo "Your vsprintf() returns (int)." >&4
11400 val2="$undef"
11401 else
11402 echo "Your vsprintf() returns (char*)." >&4
11403 val2="$define"
11404 fi
11405 else
11406 echo 'I am unable to compile the vsprintf() test program.' >&4
11407 # We shouldn't get here. If we do, assume the standard signature,
11408 # not the old BSD one.
11409 echo 'Guessing that vsprintf() returns (int).' >&4
11410 val2="$undef"
11411 fi
11412else
11413 echo 'vprintf() NOT found.' >&4
11414 val="$undef"
11415 val2="$undef"
11416fi
11417$rm_try
11418set d_vprintf
11419eval $setvar
11420val=$val2
11421set d_charvspr
11422eval $setvar
11423
11424: see if chown exists
11425set chown d_chown
11426eval $inlibc
11427
11428: see if chroot exists
11429set chroot d_chroot
11430eval $inlibc
11431
11432: see if chsize exists
11433set chsize d_chsize
11434eval $inlibc
11435
11436: see if class exists
11437set class d_class
11438eval $inlibc
11439
11440: see if clearenv exists
11441set clearenv d_clearenv
11442eval $inlibc
11443
11444: Define hasstruct macro for Configure internal use
11445hasstruct='varname=$1; struct=$2; shift; shift;
11446while $test $# -ge 2; do
11447 case "$1" in
11448 $define) echo "#include <$2>";;
11449 esac ;
11450 shift 2;
11451done > try.c;
11452echo "int main () { struct $struct foo; }" >> try.c;
11453set try;
11454if eval $compile; then
11455 val="$define";
11456else
11457 val="$undef";
11458fi;
11459set $varname;
11460eval $setvar;
11461$rm_try'
11462
11463: see whether socket exists
11464socketlib=''
11465sockethdr=''
11466echo " "
11467$echo $n "Hmm... $c" >&4
11468if set socket val -f d_socket; eval $csym; $val; then
11469 echo "Looks like you have Berkeley networking support." >&4
11470 d_socket="$define"
11471 if set setsockopt val -f; eval $csym; $val; then
11472 d_oldsock="$undef"
11473 else
11474 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11475 d_oldsock="$define"
11476 fi
11477else
11478 if $contains socklib libc.list >/dev/null 2>&1; then
11479 echo "Looks like you have Berkeley networking support." >&4
11480 d_socket="$define"
11481 : we will have to assume that it supports the 4.2 BSD interface
11482 d_oldsock="$undef"
11483 else
11484 echo "You don't have Berkeley networking in libc$_a..." >&4
11485 if test "X$d_socket" = "X$define"; then
11486 echo "...but you seem to believe that you have sockets." >&4
11487 else
11488 for net in net socket
11489 do
11490 if test -f $sysroot/usr/lib/lib$net$_a; then
11491 ( ($nm $nm_opt $sysroot/usr/lib/lib$net$_a | eval $nm_extract) || \
11492 $ar t $sysroot/usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11493 if $contains socket libc.list >/dev/null 2>&1; then
11494 d_socket="$define"
11495 socketlib="-l$net"
11496 case "$net" in
11497 net)
11498 echo "...but the Wollongong group seems to have hacked it in." >&4
11499 sockethdr="-I$sysroot/usr/netinclude"
11500 ;;
11501 esac
11502 echo "Found Berkeley sockets interface in lib$net." >&4
11503 if $contains setsockopt libc.list >/dev/null 2>&1; then
11504 d_oldsock="$undef"
11505 else
11506 echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11507 d_oldsock="$define"
11508 fi
11509 break
11510 fi
11511 fi
11512 done
11513 if test "X$d_socket" != "X$define"; then
11514 echo "or anywhere else I see." >&4
11515 d_socket="$undef"
11516 d_oldsock="$undef"
11517 fi
11518 fi
11519 fi
11520fi
11521
11522: see if socketpair exists
11523set socketpair d_sockpair
11524eval $inlibc
11525
11526
11527echo " "
11528echo "Checking the availability sa_len in the sock struct ..." >&4
11529$cat >try.c <<EOF
11530#include <sys/types.h>
11531#include <sys/socket.h>
11532int main() {
11533struct sockaddr sa;
11534return (sa.sa_len);
11535}
11536EOF
11537val="$undef"
11538set try; if eval $compile; then
11539 val="$define"
11540fi
11541set d_sockaddr_sa_len; eval $setvar
11542$rm_try
11543
11544echo " "
11545echo "Checking the availability struct sockaddr_in6 ..." >&4
11546$cat >try.c <<EOF
11547#include <sys/types.h>
11548#include <sys/socket.h>
11549#include <netinet/in.h>
11550int main() {
11551struct sockaddr_in6 sin6;
11552return (sin6.sin6_family);
11553}
11554EOF
11555val="$undef"
11556set try; if eval $compile; then
11557 val="$define"
11558fi
11559set d_sockaddr_in6; eval $setvar
11560$rm_try
11561
11562echo " "
11563echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
11564$cat >try.c <<EOF
11565#include <sys/types.h>
11566#include <sys/socket.h>
11567#include <netinet/in.h>
11568int main() {
11569struct sockaddr_in6 sin6;
11570return (sin6.sin6_scope_id);
11571}
11572EOF
11573val="$undef"
11574set try; if eval $compile; then
11575 val="$define"
11576fi
11577set d_sin6_scope_id; eval $setvar
11578$rm_try
11579
11580echo " "
11581echo "Checking the availability struct ip_mreq ..." >&4
11582$cat >try.c <<EOF
11583#include <sys/types.h>
11584#include <sys/socket.h>
11585#include <netinet/in.h>
11586int main() {
11587struct ip_mreq mreq;
11588return (mreq.imr_multiaddr.s_addr);
11589}
11590EOF
11591val="$undef"
11592set try; if eval $compile; then
11593 val="$define"
11594fi
11595set d_ip_mreq; eval $setvar
11596$rm_try
11597
11598echo " "
11599echo "Checking the availability struct ip_mreq_source ..." >&4
11600$cat >try.c <<EOF
11601#include <sys/types.h>
11602#include <sys/socket.h>
11603#include <netinet/in.h>
11604int main() {
11605struct ip_mreq_source mreq;
11606return (mreq.imr_multiaddr.s_addr);
11607}
11608EOF
11609val="$undef"
11610set try; if eval $compile; then
11611 val="$define"
11612fi
11613set d_ip_mreq_source; eval $setvar
11614$rm_try
11615
11616echo " "
11617echo "Checking the availability struct ipv6_mreq ..." >&4
11618$cat >try.c <<EOF
11619#include <sys/types.h>
11620#include <sys/socket.h>
11621#include <netinet/in.h>
11622int main() {
11623struct ipv6_mreq mreq;
11624return (mreq.ipv6mr_interface);
11625}
11626EOF
11627val="$undef"
11628set try; if eval $compile; then
11629 val="$define"
11630fi
11631set d_ipv6_mreq; eval $setvar
11632$rm_try
11633
11634echo " "
11635echo "Checking the availability struct ipv6_mreq_source ..." >&4
11636$cat >try.c <<EOF
11637#include <sys/types.h>
11638#include <sys/socket.h>
11639#include <netinet/in.h>
11640int main() {
11641struct ipv6_mreq_source mreq;
11642return (mreq.imr_multiaddr.s_addr);
11643}
11644EOF
11645val="$undef"
11646set try; if eval $compile; then
11647 val="$define"
11648fi
11649set d_ipv6_mreq_source; eval $setvar
11650$rm_try
11651
11652echo " "
11653echo "Checking the availability of certain socket constants..." >&4
11654for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11655 enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11656 $cat >try.c <<EOF
11657#include <sys/types.h>
11658#include <sys/socket.h>
11659int main() {
11660 int i = $ENUM;
11661}
11662EOF
11663 val="$undef"
11664 set try; if eval $compile; then
11665 val="$define"
11666 fi
11667 set d_${enum}; eval $setvar
11668 $rm_try
11669done
11670
11671: see if this is a sys/uio.h system
11672set sys/uio.h i_sysuio
11673eval $inhdr
11674
11675: Check for cmsghdr support
11676echo " "
11677echo "Checking to see if your system supports struct cmsghdr..." >&4
11678set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11679eval $hasstruct
11680case "$d_cmsghdr_s" in
11681"$define") echo "Yes, it does." ;;
11682*) echo "No, it doesn't." ;;
11683esac
11684
11685
11686: check for const keyword
11687echo " "
11688echo 'Checking to see if your C compiler knows about "const"...' >&4
11689$cat >const.c <<'EOCP'
11690typedef struct spug { int drokk; } spug;
11691int main()
11692{
11693 const char *foo;
11694 const spug y = { 0 };
11695}
11696EOCP
11697if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11698 val="$define"
11699 echo "Yup, it does."
11700else
11701 val="$undef"
11702 echo "Nope, it doesn't."
11703fi
11704set d_const
11705eval $setvar
11706
11707: see if copysignl exists
11708set copysignl d_copysignl
11709eval $inlibc
11710
11711: see if crypt exists
11712echo " "
11713set crypt d_crypt
11714eval $inlibc
11715case "$d_crypt" in
11716$define) cryptlib='' ;;
11717*) if set crypt val -f d_crypt; eval $csym; $val; then
11718 echo 'crypt() found.' >&4
11719 val="$define"
11720 cryptlib=''
11721 else
11722 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11723 if $test -z "$cryptlib"; then
11724 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11725 else
11726 cryptlib=-lcrypt
11727 fi
11728 if $test -z "$cryptlib"; then
11729 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11730 else
11731 cryptlib=-lcrypt
11732 fi
11733 if $test -z "$cryptlib"; then
11734 cryptlib=`./loc libcrypt$_a "" $libpth`
11735 else
11736 cryptlib=-lcrypt
11737 fi
11738 if $test -z "$cryptlib"; then
11739 echo 'crypt() NOT found.' >&4
11740 val="$undef"
11741 else
11742 val="$define"
11743 fi
11744 fi
11745 set d_crypt
11746 eval $setvar
11747 ;;
11748esac
11749
11750: see if this is a crypt.h system
11751set crypt.h i_crypt
11752eval $inhdr
11753
11754: see if crypt_r exists
11755set crypt_r d_crypt_r
11756eval $inlibc
11757case "$d_crypt_r" in
11758"$define")
11759 hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11760 case "$d_crypt_r_proto:$usethreads" in
11761 ":define") d_crypt_r_proto=define
11762 set d_crypt_r_proto crypt_r $hdrs
11763 eval $hasproto ;;
11764 *) ;;
11765 esac
11766 case "$d_crypt_r_proto" in
11767 define)
11768 case "$crypt_r_proto" in
11769 ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11770 ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
11771 esac
11772 case "$crypt_r_proto" in
11773 ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11774 ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
11775 esac
11776 case "$crypt_r_proto" in
11777 ''|0) d_crypt_r=undef
11778 crypt_r_proto=0
11779 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11780 * ) case "$crypt_r_proto" in
11781 REENTRANT_PROTO*) ;;
11782 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11783 esac
11784 echo "Prototype: $try" ;;
11785 esac
11786 ;;
11787 *) case "$usethreads" in
11788 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11789 esac
11790 d_crypt_r=undef
11791 crypt_r_proto=0
11792 ;;
11793 esac
11794 ;;
11795*) crypt_r_proto=0
11796 ;;
11797esac
11798
11799: get csh whereabouts
11800case "$csh" in
11801'csh') val="$undef" ;;
11802*) val="$define" ;;
11803esac
11804set d_csh
11805eval $setvar
11806: Respect a hint or command line value for full_csh.
11807case "$full_csh" in
11808'') full_csh=$csh ;;
11809esac
11810
11811: see if ctermid exists
11812set ctermid d_ctermid
11813eval $inlibc
11814
11815: see if ctermid_r exists
11816set ctermid_r d_ctermid_r
11817eval $inlibc
11818case "$d_ctermid_r" in
11819"$define")
11820 hdrs="$i_systypes sys/types.h define stdio.h "
11821 case "$d_ctermid_r_proto:$usethreads" in
11822 ":define") d_ctermid_r_proto=define
11823 set d_ctermid_r_proto ctermid_r $hdrs
11824 eval $hasproto ;;
11825 *) ;;
11826 esac
11827 case "$d_ctermid_r_proto" in
11828 define)
11829 case "$ctermid_r_proto" in
11830 ''|0) try='char* ctermid_r(char*);'
11831 ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
11832 esac
11833 case "$ctermid_r_proto" in
11834 ''|0) d_ctermid_r=undef
11835 ctermid_r_proto=0
11836 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11837 * ) case "$ctermid_r_proto" in
11838 REENTRANT_PROTO*) ;;
11839 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11840 esac
11841 echo "Prototype: $try" ;;
11842 esac
11843 ;;
11844 *) case "$usethreads" in
11845 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11846 esac
11847 d_ctermid_r=undef
11848 ctermid_r_proto=0
11849 ;;
11850 esac
11851 ;;
11852*) ctermid_r_proto=0
11853 ;;
11854esac
11855
11856: see if ctime_r exists
11857set ctime_r d_ctime_r
11858eval $inlibc
11859case "$d_ctime_r" in
11860"$define")
11861 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11862 case "$d_ctime_r_proto:$usethreads" in
11863 ":define") d_ctime_r_proto=define
11864 set d_ctime_r_proto ctime_r $hdrs
11865 eval $hasproto ;;
11866 *) ;;
11867 esac
11868 case "$d_ctime_r_proto" in
11869 define)
11870 case "$ctime_r_proto" in
11871 ''|0) try='char* ctime_r(const time_t*, char*);'
11872 ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
11873 esac
11874 case "$ctime_r_proto" in
11875 ''|0) try='char* ctime_r(const time_t*, char*, int);'
11876 ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
11877 esac
11878 case "$ctime_r_proto" in
11879 ''|0) try='int ctime_r(const time_t*, char*);'
11880 ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
11881 esac
11882 case "$ctime_r_proto" in
11883 ''|0) try='int ctime_r(const time_t*, char*, int);'
11884 ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
11885 esac
11886 case "$ctime_r_proto" in
11887 ''|0) d_ctime_r=undef
11888 ctime_r_proto=0
11889 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11890 * ) case "$ctime_r_proto" in
11891 REENTRANT_PROTO*) ;;
11892 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11893 esac
11894 echo "Prototype: $try" ;;
11895 esac
11896 ;;
11897 *) case "$usethreads" in
11898 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11899 esac
11900 d_ctime_r=undef
11901 ctime_r_proto=0
11902 ;;
11903 esac
11904 ;;
11905*) ctime_r_proto=0
11906 ;;
11907esac
11908
11909: see if cuserid exists
11910set cuserid d_cuserid
11911eval $inlibc
11912
11913: see if this is a limits.h system
11914set limits.h i_limits
11915eval $inhdr
11916
11917: see if this is a float.h system
11918set float.h i_float
11919eval $inhdr
11920
11921: See if number of significant digits in a double precision number is known
11922echo " "
11923$cat >dbl_dig.c <<EOM
11924#$i_limits I_LIMITS
11925#$i_float I_FLOAT
11926#ifdef I_LIMITS
11927#include <limits.h>
11928#endif
11929#ifdef I_FLOAT
11930#include <float.h>
11931#endif
11932#ifdef DBL_DIG
11933printf("Contains DBL_DIG");
11934#endif
11935EOM
11936$cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11937if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11938 echo "DBL_DIG found." >&4
11939 val="$define"
11940else
11941 echo "DBL_DIG NOT found." >&4
11942 val="$undef"
11943fi
11944$rm -f dbl_dig.?
11945set d_dbl_dig
11946eval $setvar
11947
11948: see if dbm.h is available
11949: see if dbmclose exists
11950set dbmclose d_dbmclose
11951eval $inlibc
11952
11953case "$d_dbmclose" in
11954$define)
11955 set dbm.h i_dbm
11956 eval $inhdr
11957 case "$i_dbm" in
11958 $define)
11959 val="$undef"
11960 set i_rpcsvcdbm
11961 eval $setvar
11962 ;;
11963 *) set rpcsvc/dbm.h i_rpcsvcdbm
11964 eval $inhdr
11965 ;;
11966 esac
11967 ;;
11968*) echo "We won't be including <dbm.h>"
11969 val="$undef"
11970 set i_dbm
11971 eval $setvar
11972 val="$undef"
11973 set i_rpcsvcdbm
11974 eval $setvar
11975 ;;
11976esac
11977
11978: see if prototype for dbminit is available
11979echo " "
11980set d_dbminitproto dbminit $i_dbm dbm.h
11981eval $hasproto
11982
11983: see if difftime exists
11984set difftime d_difftime
11985eval $inlibc
11986
11987: see if this is a dirent system
11988echo " "
11989if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11990 val="$define"
11991 echo "<dirent.h> found." >&4
11992else
11993 val="$undef"
11994 if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11995 echo "<sys/dir.h> found." >&4
11996 echo " "
11997 else
11998 xinc=`./findhdr sys/ndir.h`
11999 fi
12000 echo "<dirent.h> NOT found." >&4
12001fi
12002set i_dirent
12003eval $setvar
12004
12005: Look for type of directory structure.
12006echo " "
12007$cppstdin $cppflags $cppminus < "$xinc" > try.c
12008
12009case "$direntrytype" in
12010''|' ')
12011 case "$i_dirent" in
12012 $define) guess1='struct dirent' ;;
12013 *) guess1='struct direct' ;;
12014 esac
12015 ;;
12016*) guess1="$direntrytype"
12017 ;;
12018esac
12019
12020case "$guess1" in
12021'struct dirent') guess2='struct direct' ;;
12022*) guess2='struct dirent' ;;
12023esac
12024
12025if $contains "$guess1" try.c >/dev/null 2>&1; then
12026 direntrytype="$guess1"
12027 echo "Your directory entries are $direntrytype." >&4
12028elif $contains "$guess2" try.c >/dev/null 2>&1; then
12029 direntrytype="$guess2"
12030 echo "Your directory entries seem to be $direntrytype." >&4
12031else
12032 echo "I don't recognize your system's directory entries." >&4
12033 rp="What type is used for directory entries on this system?"
12034 dflt="$guess1"
12035 . ./myread
12036 direntrytype="$ans"
12037fi
12038$rm_try
12039
12040: see if the directory entry stores field length
12041echo " "
12042$cppstdin $cppflags $cppminus < "$xinc" > try.c
12043if $contains 'd_namlen' try.c >/dev/null 2>&1; then
12044 echo "Good, your directory entry keeps length information in d_namlen." >&4
12045 val="$define"
12046else
12047 echo "Your directory entry does not know about the d_namlen field." >&4
12048 val="$undef"
12049fi
12050set d_dirnamlen
12051eval $setvar
12052$rm_try
12053
12054: Look for DIR.dd_fd
12055case "$i_dirent" in
12056"$define")
12057 echo "Checking to see if DIR has a dd_fd member variable" >&4
12058 $cat >try.c <<EOCP
12059#$i_stdlib I_STDLIB
12060#ifdef I_STDLIB
12061#include <stdlib.h>
12062#endif
12063#include <dirent.h>
12064
12065int main() {
12066 DIR dir;
12067 dir.dd_fd = 1;
12068 return 0;
12069}
12070EOCP
12071 val=$undef
12072 set try
12073 if eval $compile; then
12074 echo "Yes, it does."
12075 val="$define"
12076 else
12077 echo "No, it does not."
12078 val="$undef"
12079 fi
12080 ;;
12081*)
12082 echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
12083 val="$undef"
12084 ;;
12085esac
12086set d_dir_dd_fd
12087eval $setvar
12088$rm_try
12089
12090: see if this is an sysdir system
12091set sys/dir.h i_sysdir
12092eval $inhdr
12093
12094: see if this is an sysndir system
12095set sys/ndir.h i_sysndir
12096eval $inhdr
12097
12098: Look for dirfd
12099echo " "
12100$cat >dirfd.c <<EOM
12101#include <stdio.h>
12102#$i_stdlib I_STDLIB
12103#ifdef I_STDLIB
12104#include <stdlib.h>
12105#endif
12106#$i_dirent I_DIRENT /**/
12107#$i_sysdir I_SYS_DIR /**/
12108#$i_sysndir I_SYS_NDIR /**/
12109#$i_systypes I_SYS_TYPES /**/
12110#if defined(I_SYS_TYPES)
12111#include <sys/types.h>
12112#endif
12113#if defined(I_DIRENT)
12114#include <dirent.h>
12115#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
12116#include <sys/dir.h>
12117#endif
12118#else
12119#ifdef I_SYS_NDIR
12120#include <sys/ndir.h>
12121#else
12122#ifdef I_SYS_DIR
12123#ifdef hp9000s500
12124#include <ndir.h> /* may be wrong in the future */
12125#else
12126#include <sys/dir.h>
12127#endif
12128#endif
12129#endif
12130#endif
12131int main() {
12132 DIR *dirp = opendir(".");
12133 if (dirfd(dirp) >= 0)
12134 exit(0);
12135 else
12136 exit(1);
12137}
12138EOM
12139val=$undef
12140set dirfd
12141if eval $compile; then
12142 val="$define"
12143fi
12144case "$val" in
12145$define) echo "dirfd() found." >&4 ;;
12146*) echo "dirfd() NOT found." >&4 ;;
12147esac
12148set d_dirfd
12149eval $setvar
12150$rm -f dirfd*
12151
12152: see if dlerror exists
12153xxx_runnm="$runnm"
12154runnm=false
12155set dlerror d_dlerror
12156eval $inlibc
12157runnm="$xxx_runnm"
12158
12159: see if dlfcn is available
12160set dlfcn.h i_dlfcn
12161eval $inhdr
12162
12163: Check what extension to use for shared libs
12164case "$usedl" in
12165$define|y|true)
12166 $cat << EOM
12167
12168On a few systems, the dynamically loaded modules that perl generates and uses
12169will need a different extension than shared libs. The default will probably
12170be appropriate.
12171
12172EOM
12173 case "$dlext" in
12174 '') dflt="$so" ;;
12175 *) dflt="$dlext" ;;
12176 esac
12177 rp='What is the extension of dynamically loaded modules'
12178 . ./myread
12179 dlext="$ans"
12180 ;;
12181*)
12182 dlext="none"
12183 ;;
12184esac
12185
12186: Check if dlsym need a leading underscore
12187echo " "
12188val="$undef"
12189
12190case "$dlsrc" in
12191dl_dlopen.xs)
12192 echo "Checking whether your dlsym() needs a leading underscore ..." >&4
12193 $cat >dyna.c <<'EOM'
12194fred () { }
12195EOM
12196
12197$cat >fred.c<<EOM
12198
12199#include <stdio.h>
12200#$i_stdlib I_STDLIB
12201#ifdef I_STDLIB
12202#include <stdlib.h>
12203#endif
12204#$i_dlfcn I_DLFCN
12205#ifdef I_DLFCN
12206#include <dlfcn.h> /* the dynamic linker include file for SunOS/Solaris */
12207#else
12208#include <sys/types.h>
12209#include <nlist.h>
12210#include <link.h>
12211#endif
12212
12213extern int fred() ;
12214
12215int main()
12216{
12217 void * handle ;
12218 void * symbol ;
12219#ifndef RTLD_LAZY
12220 int mode = 1 ;
12221#else
12222 int mode = RTLD_LAZY ;
12223#endif
12224 handle = dlopen("./dyna.$dlext", mode) ;
12225 if (handle == NULL) {
12226 printf ("1\n") ;
12227 fflush (stdout) ;
12228 exit(0);
12229 }
12230 symbol = dlsym(handle, "fred") ;
12231 if (symbol == NULL) {
12232 /* try putting a leading underscore */
12233 symbol = dlsym(handle, "_fred") ;
12234 if (symbol == NULL) {
12235 printf ("2\n") ;
12236 fflush (stdout) ;
12237 exit(0);
12238 }
12239 printf ("3\n") ;
12240 }
12241 else
12242 printf ("4\n") ;
12243 fflush (stdout) ;
12244 exit(0);
12245}
12246EOM
12247 : Call the object file tmp-dyna.o in case dlext=o.
12248 if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12249 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12250 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12251 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12252 xxx=`$run ./fred`
12253 case $xxx in
12254 1) echo "Test program failed using dlopen." >&4
12255 echo "Perhaps you should not use dynamic loading." >&4;;
12256 2) echo "Test program failed using dlsym." >&4
12257 echo "Perhaps you should not use dynamic loading." >&4;;
12258 3) echo "dlsym needs a leading underscore" >&4
12259 val="$define" ;;
12260 4) echo "dlsym doesn't need a leading underscore." >&4;;
12261 esac
12262 else
12263 echo "I can't compile and run the test program." >&4
12264 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12265 fi
12266 ;;
12267esac
12268
12269$rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12270
12271set d_dlsymun
12272eval $setvar
12273
12274: see if drand48_r exists
12275set drand48_r d_drand48_r
12276eval $inlibc
12277case "$d_drand48_r" in
12278"$define")
12279 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12280 case "$d_drand48_r_proto:$usethreads" in
12281 ":define") d_drand48_r_proto=define
12282 set d_drand48_r_proto drand48_r $hdrs
12283 eval $hasproto ;;
12284 *) ;;
12285 esac
12286 case "$d_drand48_r_proto" in
12287 define)
12288 case "$drand48_r_proto" in
12289 ''|0) try='int drand48_r(struct drand48_data*, double*);'
12290 ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12291 esac
12292 case "$drand48_r_proto" in
12293 ''|0) d_drand48_r=undef
12294 drand48_r_proto=0
12295 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12296 * ) case "$drand48_r_proto" in
12297 REENTRANT_PROTO*) ;;
12298 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12299 esac
12300 echo "Prototype: $try" ;;
12301 esac
12302 ;;
12303 *) case "$usethreads" in
12304 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12305 esac
12306 d_drand48_r=undef
12307 drand48_r_proto=0
12308 ;;
12309 esac
12310 ;;
12311*) drand48_r_proto=0
12312 ;;
12313esac
12314
12315: see if prototype for drand48 is available
12316echo " "
12317set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12318eval $hasproto
12319
12320: see if dup2 exists
12321set dup2 d_dup2
12322eval $inlibc
12323
12324: see if eaccess exists
12325set eaccess d_eaccess
12326eval $inlibc
12327
12328: see if endgrent exists
12329set endgrent d_endgrent
12330eval $inlibc
12331
12332: see if this is an grp system
12333set grp.h i_grp
12334eval $inhdr
12335
12336case "$i_grp" in
12337$define)
12338 xxx=`./findhdr grp.h`
12339 $cppstdin $cppflags $cppminus < $xxx >$$.h
12340
12341 if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12342 val="$define"
12343 else
12344 val="$undef"
12345 fi
12346 set d_grpasswd
12347 eval $setvar
12348
12349 $rm -f $$.h
12350 ;;
12351*)
12352 val="$undef";
12353 set d_grpasswd; eval $setvar
12354 ;;
12355esac
12356
12357: see if endgrent_r exists
12358set endgrent_r d_endgrent_r
12359eval $inlibc
12360case "$d_endgrent_r" in
12361"$define")
12362 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12363 case "$d_endgrent_r_proto:$usethreads" in
12364 ":define") d_endgrent_r_proto=define
12365 set d_endgrent_r_proto endgrent_r $hdrs
12366 eval $hasproto ;;
12367 *) ;;
12368 esac
12369 case "$d_endgrent_r_proto" in
12370 define)
12371 case "$endgrent_r_proto" in
12372 ''|0) try='int endgrent_r(FILE**);'
12373 ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12374 esac
12375 case "$endgrent_r_proto" in
12376 ''|0) try='void endgrent_r(FILE**);'
12377 ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12378 esac
12379 case "$endgrent_r_proto" in
12380 ''|0) d_endgrent_r=undef
12381 endgrent_r_proto=0
12382 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12383 * ) case "$endgrent_r_proto" in
12384 REENTRANT_PROTO*) ;;
12385 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12386 esac
12387 echo "Prototype: $try" ;;
12388 esac
12389 ;;
12390 *) case "$usethreads" in
12391 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12392 esac
12393 d_endgrent_r=undef
12394 endgrent_r_proto=0
12395 ;;
12396 esac
12397 ;;
12398*) endgrent_r_proto=0
12399 ;;
12400esac
12401
12402: see if endhostent exists
12403set endhostent d_endhent
12404eval $inlibc
12405
12406: see if this is a netdb.h system
12407set netdb.h i_netdb
12408eval $inhdr
12409
12410: see if endhostent_r exists
12411set endhostent_r d_endhostent_r
12412eval $inlibc
12413case "$d_endhostent_r" in
12414"$define")
12415 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12416 case "$d_endhostent_r_proto:$usethreads" in
12417 ":define") d_endhostent_r_proto=define
12418 set d_endhostent_r_proto endhostent_r $hdrs
12419 eval $hasproto ;;
12420 *) ;;
12421 esac
12422 case "$d_endhostent_r_proto" in
12423 define)
12424 case "$endhostent_r_proto" in
12425 ''|0) try='int endhostent_r(struct hostent_data*);'
12426 ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12427 esac
12428 case "$endhostent_r_proto" in
12429 ''|0) try='void endhostent_r(struct hostent_data*);'
12430 ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12431 esac
12432 case "$endhostent_r_proto" in
12433 ''|0) d_endhostent_r=undef
12434 endhostent_r_proto=0
12435 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12436 * ) case "$endhostent_r_proto" in
12437 REENTRANT_PROTO*) ;;
12438 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12439 esac
12440 echo "Prototype: $try" ;;
12441 esac
12442 ;;
12443 *) case "$usethreads" in
12444 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12445 esac
12446 d_endhostent_r=undef
12447 endhostent_r_proto=0
12448 ;;
12449 esac
12450 ;;
12451*) endhostent_r_proto=0
12452 ;;
12453esac
12454
12455: see if endnetent exists
12456set endnetent d_endnent
12457eval $inlibc
12458
12459: see if endnetent_r exists
12460set endnetent_r d_endnetent_r
12461eval $inlibc
12462case "$d_endnetent_r" in
12463"$define")
12464 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12465 case "$d_endnetent_r_proto:$usethreads" in
12466 ":define") d_endnetent_r_proto=define
12467 set d_endnetent_r_proto endnetent_r $hdrs
12468 eval $hasproto ;;
12469 *) ;;
12470 esac
12471 case "$d_endnetent_r_proto" in
12472 define)
12473 case "$endnetent_r_proto" in
12474 ''|0) try='int endnetent_r(struct netent_data*);'
12475 ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12476 esac
12477 case "$endnetent_r_proto" in
12478 ''|0) try='void endnetent_r(struct netent_data*);'
12479 ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12480 esac
12481 case "$endnetent_r_proto" in
12482 ''|0) d_endnetent_r=undef
12483 endnetent_r_proto=0
12484 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12485 * ) case "$endnetent_r_proto" in
12486 REENTRANT_PROTO*) ;;
12487 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12488 esac
12489 echo "Prototype: $try" ;;
12490 esac
12491 ;;
12492 *) case "$usethreads" in
12493 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12494 esac
12495 d_endnetent_r=undef
12496 endnetent_r_proto=0
12497 ;;
12498 esac
12499 ;;
12500*) endnetent_r_proto=0
12501 ;;
12502esac
12503
12504: see if endprotoent exists
12505set endprotoent d_endpent
12506eval $inlibc
12507
12508: see if endprotoent_r exists
12509set endprotoent_r d_endprotoent_r
12510eval $inlibc
12511case "$d_endprotoent_r" in
12512"$define")
12513 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12514 case "$d_endprotoent_r_proto:$usethreads" in
12515 ":define") d_endprotoent_r_proto=define
12516 set d_endprotoent_r_proto endprotoent_r $hdrs
12517 eval $hasproto ;;
12518 *) ;;
12519 esac
12520 case "$d_endprotoent_r_proto" in
12521 define)
12522 case "$endprotoent_r_proto" in
12523 ''|0) try='int endprotoent_r(struct protoent_data*);'
12524 ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12525 esac
12526 case "$endprotoent_r_proto" in
12527 ''|0) try='void endprotoent_r(struct protoent_data*);'
12528 ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12529 esac
12530 case "$endprotoent_r_proto" in
12531 ''|0) d_endprotoent_r=undef
12532 endprotoent_r_proto=0
12533 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12534 * ) case "$endprotoent_r_proto" in
12535 REENTRANT_PROTO*) ;;
12536 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12537 esac
12538 echo "Prototype: $try" ;;
12539 esac
12540 ;;
12541 *) case "$usethreads" in
12542 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12543 esac
12544 d_endprotoent_r=undef
12545 endprotoent_r_proto=0
12546 ;;
12547 esac
12548 ;;
12549*) endprotoent_r_proto=0
12550 ;;
12551esac
12552
12553: see if endpwent exists
12554set endpwent d_endpwent
12555eval $inlibc
12556
12557: see if this is a pwd.h system
12558set pwd.h i_pwd
12559eval $inhdr
12560
12561case "$i_pwd" in
12562$define)
12563 xxx=`./findhdr pwd.h`
12564 $cppstdin $cppflags $cppminus < $xxx >$$.h
12565
12566 if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12567 val="$define"
12568 else
12569 val="$undef"
12570 fi
12571 set d_pwquota
12572 eval $setvar
12573
12574 if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12575 val="$define"
12576 else
12577 val="$undef"
12578 fi
12579 set d_pwage
12580 eval $setvar
12581
12582 if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12583 val="$define"
12584 else
12585 val="$undef"
12586 fi
12587 set d_pwchange
12588 eval $setvar
12589
12590 if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12591 val="$define"
12592 else
12593 val="$undef"
12594 fi
12595 set d_pwclass
12596 eval $setvar
12597
12598 if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12599 val="$define"
12600 else
12601 val="$undef"
12602 fi
12603 set d_pwexpire
12604 eval $setvar
12605
12606 if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12607 val="$define"
12608 else
12609 val="$undef"
12610 fi
12611 set d_pwcomment
12612 eval $setvar
12613
12614 if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12615 val="$define"
12616 else
12617 val="$undef"
12618 fi
12619 set d_pwgecos
12620 eval $setvar
12621
12622 if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12623 val="$define"
12624 else
12625 val="$undef"
12626 fi
12627 set d_pwpasswd
12628 eval $setvar
12629
12630 $rm -f $$.h
12631 ;;
12632*)
12633 val="$undef";
12634 set d_pwquota; eval $setvar
12635 set d_pwage; eval $setvar
12636 set d_pwchange; eval $setvar
12637 set d_pwclass; eval $setvar
12638 set d_pwexpire; eval $setvar
12639 set d_pwcomment; eval $setvar
12640 set d_pwgecos; eval $setvar
12641 set d_pwpasswd; eval $setvar
12642 ;;
12643esac
12644
12645: see if endpwent_r exists
12646set endpwent_r d_endpwent_r
12647eval $inlibc
12648case "$d_endpwent_r" in
12649"$define")
12650 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12651 case "$d_endpwent_r_proto:$usethreads" in
12652 ":define") d_endpwent_r_proto=define
12653 set d_endpwent_r_proto endpwent_r $hdrs
12654 eval $hasproto ;;
12655 *) ;;
12656 esac
12657 case "$d_endpwent_r_proto" in
12658 define)
12659 case "$endpwent_r_proto" in
12660 ''|0) try='int endpwent_r(FILE**);'
12661 ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
12662 esac
12663 case "$endpwent_r_proto" in
12664 ''|0) try='void endpwent_r(FILE**);'
12665 ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
12666 esac
12667 case "$endpwent_r_proto" in
12668 ''|0) d_endpwent_r=undef
12669 endpwent_r_proto=0
12670 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12671 * ) case "$endpwent_r_proto" in
12672 REENTRANT_PROTO*) ;;
12673 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12674 esac
12675 echo "Prototype: $try" ;;
12676 esac
12677 ;;
12678 *) case "$usethreads" in
12679 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12680 esac
12681 d_endpwent_r=undef
12682 endpwent_r_proto=0
12683 ;;
12684 esac
12685 ;;
12686*) endpwent_r_proto=0
12687 ;;
12688esac
12689
12690: see if endservent exists
12691set endservent d_endsent
12692eval $inlibc
12693
12694: see if endservent_r exists
12695set endservent_r d_endservent_r
12696eval $inlibc
12697case "$d_endservent_r" in
12698"$define")
12699 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12700 case "$d_endservent_r_proto:$usethreads" in
12701 ":define") d_endservent_r_proto=define
12702 set d_endservent_r_proto endservent_r $hdrs
12703 eval $hasproto ;;
12704 *) ;;
12705 esac
12706 case "$d_endservent_r_proto" in
12707 define)
12708 case "$endservent_r_proto" in
12709 ''|0) try='int endservent_r(struct servent_data*);'
12710 ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
12711 esac
12712 case "$endservent_r_proto" in
12713 ''|0) try='void endservent_r(struct servent_data*);'
12714 ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
12715 esac
12716 case "$endservent_r_proto" in
12717 ''|0) d_endservent_r=undef
12718 endservent_r_proto=0
12719 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12720 * ) case "$endservent_r_proto" in
12721 REENTRANT_PROTO*) ;;
12722 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12723 esac
12724 echo "Prototype: $try" ;;
12725 esac
12726 ;;
12727 *) case "$usethreads" in
12728 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12729 esac
12730 d_endservent_r=undef
12731 endservent_r_proto=0
12732 ;;
12733 esac
12734 ;;
12735*) endservent_r_proto=0
12736 ;;
12737esac
12738
12739: Locate the flags for 'open()'
12740echo " "
12741$cat >try.c <<EOCP
12742#include <sys/types.h>
12743#ifdef I_FCNTL
12744#include <fcntl.h>
12745#endif
12746#ifdef I_SYS_FILE
12747#include <sys/file.h>
12748#endif
12749#$i_stdlib I_STDLIB
12750#ifdef I_STDLIB
12751#include <stdlib.h>
12752#endif
12753int main() {
12754 if(O_RDONLY);
12755#ifdef O_TRUNC
12756 exit(0);
12757#else
12758 exit(1);
12759#endif
12760}
12761EOCP
12762: check sys/file.h first to get FREAD on Sun
12763if $test `./findhdr sys/file.h` && \
12764 set try -DI_SYS_FILE && eval $compile; then
12765 h_sysfile=true;
12766 echo "<sys/file.h> defines the O_* constants..." >&4
12767 if $run ./try; then
12768 echo "and you have the 3 argument form of open()." >&4
12769 val="$define"
12770 else
12771 echo "but not the 3 argument form of open(). Oh, well." >&4
12772 val="$undef"
12773 fi
12774elif $test `./findhdr fcntl.h` && \
12775 set try -DI_FCNTL && eval $compile; then
12776 h_fcntl=true;
12777 echo "<fcntl.h> defines the O_* constants..." >&4
12778 if $run ./try; then
12779 echo "and you have the 3 argument form of open()." >&4
12780 val="$define"
12781 else
12782 echo "but not the 3 argument form of open(). Oh, well." >&4
12783 val="$undef"
12784 fi
12785else
12786 val="$undef"
12787 echo "I can't find the O_* constant definitions! You got problems." >&4
12788fi
12789set d_open3
12790eval $setvar
12791$rm_try
12792
12793: see if this is a sys/file.h system
12794val=''
12795set sys/file.h val
12796eval $inhdr
12797
12798: do we need to include sys/file.h ?
12799case "$val" in
12800"$define")
12801 echo " "
12802 if $h_sysfile; then
12803 val="$define"
12804 echo "We'll be including <sys/file.h>." >&4
12805 else
12806 val="$undef"
12807 echo "We won't be including <sys/file.h>." >&4
12808 fi
12809 ;;
12810*)
12811 h_sysfile=false
12812 ;;
12813esac
12814set i_sysfile
12815eval $setvar
12816
12817: see if fcntl.h is there
12818val=''
12819set fcntl.h val
12820eval $inhdr
12821
12822: see if we can include fcntl.h
12823case "$val" in
12824"$define")
12825 echo " "
12826 if $h_fcntl; then
12827 val="$define"
12828 echo "We'll be including <fcntl.h>." >&4
12829 else
12830 val="$undef"
12831 if $h_sysfile; then
12832 echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12833 else
12834 echo "We won't be including <fcntl.h>." >&4
12835 fi
12836 fi
12837 ;;
12838*)
12839 h_fcntl=false
12840 val="$undef"
12841 ;;
12842esac
12843set i_fcntl
12844eval $setvar
12845
12846: see if fork exists
12847set fork d_fork
12848eval $inlibc
12849
12850: see if pipe exists
12851set pipe d_pipe
12852eval $inlibc
12853
12854: check for non-blocking I/O stuff
12855case "$h_sysfile" in
12856true) echo "#include <sys/file.h>" > head.c;;
12857*)
12858 case "$h_fcntl" in
12859 true) echo "#include <fcntl.h>" > head.c;;
12860 *) echo "#include <sys/fcntl.h>" > head.c;;
12861 esac
12862 ;;
12863esac
12864echo " "
12865echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12866case "$o_nonblock" in
12867'')
12868 $cat head.c > try.c
12869 $cat >>try.c <<EOCP
12870#include <stdio.h>
12871#$i_stdlib I_STDLIB
12872#ifdef I_STDLIB
12873#include <stdlib.h>
12874#endif
12875#$i_fcntl I_FCNTL
12876#ifdef I_FCNTL
12877#include <fcntl.h>
12878#endif
12879int main() {
12880#ifdef O_NONBLOCK
12881 printf("O_NONBLOCK\n");
12882 exit(0);
12883#endif
12884#ifdef O_NDELAY
12885 printf("O_NDELAY\n");
12886 exit(0);
12887#endif
12888#ifdef FNDELAY
12889 printf("FNDELAY\n");
12890 exit(0);
12891#endif
12892 exit(0);
12893}
12894EOCP
12895 set try
12896 if eval $compile_ok; then
12897 o_nonblock=`$run ./try`
12898 case "$o_nonblock" in
12899 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12900 *) echo "Seems like we can use $o_nonblock.";;
12901 esac
12902 else
12903 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12904 fi
12905 ;;
12906*) echo "Using $hint value $o_nonblock.";;
12907esac
12908$rm_try
12909
12910echo " "
12911echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12912case "$eagain" in
12913'')
12914 case "$d_fork:$d_pipe" in
12915 define:define)
12916 $cat head.c > try.c
12917 $cat >>try.c <<EOCP
12918#include <errno.h>
12919#include <sys/types.h>
12920#include <signal.h>
12921#include <stdio.h>
12922#$i_stdlib I_STDLIB
12923#ifdef I_STDLIB
12924#include <stdlib.h>
12925#endif
12926#$i_fcntl I_FCNTL
12927#ifdef I_FCNTL
12928#include <fcntl.h>
12929#endif
12930#define MY_O_NONBLOCK $o_nonblock
12931#ifndef errno /* XXX need better Configure test */
12932extern int errno;
12933#endif
12934#$i_unistd I_UNISTD
12935#ifdef I_UNISTD
12936#include <unistd.h>
12937#endif
12938#$i_string I_STRING
12939#ifdef I_STRING
12940#include <string.h>
12941#else
12942#include <strings.h>
12943#endif
12944$signal_t blech(int x) { exit(3); }
12945EOCP
12946 $cat >> try.c <<'EOCP'
12947int main()
12948{
12949 int pd[2];
12950 int pu[2];
12951 char buf[1];
12952 char string[100];
12953
12954 pipe(pd); /* Down: child -> parent */
12955 pipe(pu); /* Up: parent -> child */
12956 if (0 != fork()) {
12957 int ret;
12958 close(pd[1]); /* Parent reads from pd[0] */
12959 close(pu[0]); /* Parent writes (blocking) to pu[1] */
12960#ifdef F_SETFL
12961 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12962 exit(1);
12963#else
12964 exit(4);
12965#endif
12966 signal(SIGALRM, blech);
12967 alarm(5);
12968 if ((ret = read(pd[0], buf, 1)) > 0) /* Nothing to read! */
12969 exit(2);
12970 sprintf(string, "%d\n", ret);
12971 write(2, string, strlen(string));
12972 alarm(0);
12973#ifdef EAGAIN
12974 if (errno == EAGAIN) {
12975 printf("EAGAIN\n");
12976 goto ok;
12977 }
12978#endif
12979#ifdef EWOULDBLOCK
12980 if (errno == EWOULDBLOCK)
12981 printf("EWOULDBLOCK\n");
12982#endif
12983 ok:
12984 write(pu[1], buf, 1); /* Unblocks child, tell it to close our pipe */
12985 sleep(2); /* Give it time to close our pipe */
12986 alarm(5);
12987 ret = read(pd[0], buf, 1); /* Should read EOF */
12988 alarm(0);
12989 sprintf(string, "%d\n", ret);
12990 write(4, string, strlen(string));
12991 exit(0);
12992 }
12993
12994 close(pd[0]); /* We write to pd[1] */
12995 close(pu[1]); /* We read from pu[0] */
12996 read(pu[0], buf, 1); /* Wait for parent to signal us we may continue */
12997 close(pd[1]); /* Pipe pd is now fully closed! */
12998 exit(0); /* Bye bye, thank you for playing! */
12999}
13000EOCP
13001 set try
13002 if eval $compile_ok; then
13003 echo "$startsh" >mtry
13004 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
13005 chmod +x mtry
13006 $run ./mtry >/dev/null 2>&1
13007 case $? in
13008 0) eagain=`$cat try.out`;;
13009 1) echo "Could not perform non-blocking setting!";;
13010 2) echo "I did a successful read() for something that was not there!";;
13011 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
13012 4) echo "Could not find F_SETFL!";;
13013 *) echo "Something terribly wrong happened during testing.";;
13014 esac
13015 rd_nodata=`$cat try.ret`
13016 echo "A read() system call with no data present returns $rd_nodata."
13017 case "$rd_nodata" in
13018 0|-1) ;;
13019 *)
13020 echo "(That's peculiar, fixing that to be -1.)"
13021 rd_nodata=-1
13022 ;;
13023 esac
13024 case "$eagain" in
13025 '')
13026 echo "Forcing errno EAGAIN on read() with no data available."
13027 eagain=EAGAIN
13028 ;;
13029 *)
13030 echo "Your read() sets errno to $eagain when no data is available."
13031 ;;
13032 esac
13033 status=`$cat try.err`
13034 case "$status" in
13035 0) echo "And it correctly returns 0 to signal EOF.";;
13036 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
13037 *) echo "However, your read() returns '$status' on EOF??";;
13038 esac
13039 val="$define"
13040 if test "$status" = "$rd_nodata"; then
13041 echo "WARNING: you can't distinguish between EOF and no data!"
13042 val="$undef"
13043 fi
13044 else
13045 echo "I can't compile the test program--assuming errno EAGAIN will do."
13046 eagain=EAGAIN
13047 fi
13048 ;;
13049 *) echo "Can't figure out how to test this--assuming errno EAGAIN will do."
13050 eagain=EAGAIN
13051 val="$define"
13052 ;;
13053 esac
13054 set d_eofnblk
13055 eval $setvar
13056 ;;
13057*)
13058 echo "Using $hint value $eagain."
13059 echo "Your read() returns $rd_nodata when no data is present."
13060 case "$d_eofnblk" in
13061 "$define") echo "And you can see EOF because read() returns 0.";;
13062 "$undef") echo "But you can't see EOF status from read() returned value.";;
13063 *)
13064 echo "(Assuming you can't see EOF status from read anyway.)"
13065 d_eofnblk=$undef
13066 ;;
13067 esac
13068 ;;
13069esac
13070$rm_try head.c mtry
13071
13072: see if _ptr and _cnt from stdio act std
13073echo " "
13074
13075if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13076 echo "(Looks like you have stdio.h from BSD.)"
13077 case "$stdio_ptr" in
13078 '') stdio_ptr='((fp)->_p)'
13079 ptr_lval=$define
13080 ;;
13081 *) ptr_lval=$d_stdio_ptr_lval;;
13082 esac
13083 case "$stdio_cnt" in
13084 '') stdio_cnt='((fp)->_r)'
13085 cnt_lval=$define
13086 ;;
13087 *) cnt_lval=$d_stdio_cnt_lval;;
13088 esac
13089 case "$stdio_base" in
13090 '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
13091 esac
13092 case "$stdio_bufsiz" in
13093 '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
13094 esac
13095elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
13096 echo "(Looks like you have stdio.h from Linux.)"
13097 case "$stdio_ptr" in
13098 '') stdio_ptr='((fp)->_IO_read_ptr)'
13099 ptr_lval=$define
13100 ;;
13101 *) ptr_lval=$d_stdio_ptr_lval;;
13102 esac
13103 case "$stdio_cnt" in
13104 '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
13105 cnt_lval=$undef
13106 ;;
13107 *) cnt_lval=$d_stdio_cnt_lval;;
13108 esac
13109 case "$stdio_base" in
13110 '') stdio_base='((fp)->_IO_read_base)';;
13111 esac
13112 case "$stdio_bufsiz" in
13113 '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
13114 esac
13115else
13116 case "$stdio_ptr" in
13117 '') stdio_ptr='((fp)->_ptr)'
13118 ptr_lval=$define
13119 ;;
13120 *) ptr_lval=$d_stdio_ptr_lval;;
13121 esac
13122 case "$stdio_cnt" in
13123 '') stdio_cnt='((fp)->_cnt)'
13124 cnt_lval=$define
13125 ;;
13126 *) cnt_lval=$d_stdio_cnt_lval;;
13127 esac
13128 case "$stdio_base" in
13129 '') stdio_base='((fp)->_base)';;
13130 esac
13131 case "$stdio_bufsiz" in
13132 '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
13133 esac
13134fi
13135
13136: test whether _ptr and _cnt really work
13137echo "Checking how std your stdio is..." >&4
13138$cat >try.c <<EOP
13139#include <stdio.h>
13140#$i_stdlib I_STDLIB
13141#ifdef I_STDLIB
13142#include <stdlib.h>
13143#endif
13144#define FILE_ptr(fp) $stdio_ptr
13145#define FILE_cnt(fp) $stdio_cnt
13146int main() {
13147 FILE *fp = fopen("try.c", "r");
13148 char c = getc(fp);
13149 if (
13150 18 <= FILE_cnt(fp) &&
13151 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13152 )
13153 exit(0);
13154 exit(1);
13155}
13156EOP
13157val="$undef"
13158set try
13159if eval $compile && $to try.c; then
13160 if $run ./try; then
13161 echo "Your stdio acts pretty std."
13162 val="$define"
13163 else
13164 echo "Your stdio isn't very std."
13165 fi
13166else
13167 echo "Your stdio doesn't appear very std."
13168fi
13169$rm_try
13170
13171# glibc 2.2.90 and above apparently change stdio streams so Perl's
13172# direct buffer manipulation no longer works. The Configure tests
13173# should be changed to correctly detect this, but until then,
13174# the following check should at least let perl compile and run.
13175# (This quick fix should be updated before 5.8.1.)
13176# To be defensive, reject all unknown versions, and all versions > 2.2.9.
13177# A. Dougherty, June 3, 2002.
13178case "$d_gnulibc" in
13179$define)
13180 case "$gnulibc_version" in
13181 2.[01]*) ;;
13182 2.2) ;;
13183 2.2.[0-9]) ;;
13184 *) echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
13185 val="$undef"
13186 ;;
13187 esac
13188 ;;
13189esac
13190set d_stdstdio
13191eval $setvar
13192
13193: Can _ptr be used as an lvalue?
13194case "$d_stdstdio$ptr_lval" in
13195$define$define) val=$define ;;
13196*) val=$undef ;;
13197esac
13198set d_stdio_ptr_lval
13199eval $setvar
13200
13201: Can _cnt be used as an lvalue?
13202case "$d_stdstdio$cnt_lval" in
13203$define$define) val=$define ;;
13204*) val=$undef ;;
13205esac
13206set d_stdio_cnt_lval
13207eval $setvar
13208
13209
13210: test whether setting _ptr sets _cnt as a side effect
13211d_stdio_ptr_lval_sets_cnt="$undef"
13212d_stdio_ptr_lval_nochange_cnt="$undef"
13213case "$d_stdio_ptr_lval$d_stdstdio" in
13214$define$define)
13215 echo "Checking to see what happens if we set the stdio ptr..." >&4
13216$cat >try.c <<EOP
13217#include <stdio.h>
13218/* Can we scream? */
13219/* Eat dust sed :-) */
13220/* In the buffer space, no one can hear you scream. */
13221#$i_stdlib I_STDLIB
13222#ifdef I_STDLIB
13223#include <stdlib.h>
13224#endif
13225#define FILE_ptr(fp) $stdio_ptr
13226#define FILE_cnt(fp) $stdio_cnt
13227#include <sys/types.h>
13228int main() {
13229 FILE *fp = fopen("try.c", "r");
13230 int c;
13231 char *ptr;
13232 size_t cnt;
13233 if (!fp) {
13234 puts("Fail even to read");
13235 exit(1);
13236 }
13237 c = getc(fp); /* Read away the first # */
13238 if (c == EOF) {
13239 puts("Fail even to read");
13240 exit(1);
13241 }
13242 if (!(
13243 18 <= FILE_cnt(fp) &&
13244 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13245 )) {
13246 puts("Fail even to read");
13247 exit (1);
13248 }
13249 ptr = (char*) FILE_ptr(fp);
13250 cnt = (size_t)FILE_cnt(fp);
13251
13252 FILE_ptr(fp) += 42;
13253
13254 if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13255 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13256 exit (1);
13257 }
13258 if (FILE_cnt(fp) <= 20) {
13259 printf ("Fail (<20 chars to test)");
13260 exit (1);
13261 }
13262 if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13263 puts("Fail compare");
13264 exit (1);
13265 }
13266 if (cnt == FILE_cnt(fp)) {
13267 puts("Pass_unchanged");
13268 exit (0);
13269 }
13270 if (FILE_cnt(fp) == (cnt - 42)) {
13271 puts("Pass_changed");
13272 exit (0);
13273 }
13274 printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13275 return 1;
13276
13277}
13278EOP
13279 set try
13280 if eval $compile && $to try.c; then
13281 case `$run ./try` in
13282 Pass_changed)
13283 echo "Increasing ptr in your stdio decreases cnt by the same amount. Good." >&4
13284 d_stdio_ptr_lval_sets_cnt="$define" ;;
13285 Pass_unchanged)
13286 echo "Increasing ptr in your stdio leaves cnt unchanged. Good." >&4
13287 d_stdio_ptr_lval_nochange_cnt="$define" ;;
13288 Fail*)
13289 echo "Increasing ptr in your stdio didn't do exactly what I expected. We'll not be doing that then." >&4 ;;
13290 *)
13291 echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13292 esac
13293 else
13294 echo "It seems we can't set ptr in your stdio. Nevermind." >&4
13295 fi
13296 $rm_try
13297 ;;
13298esac
13299
13300: see if _base is also standard
13301val="$undef"
13302case "$d_stdstdio" in
13303$define)
13304 $cat >try.c <<EOP
13305#include <stdio.h>
13306#$i_stdlib I_STDLIB
13307#ifdef I_STDLIB
13308#include <stdlib.h>
13309#endif
13310#define FILE_base(fp) $stdio_base
13311#define FILE_bufsiz(fp) $stdio_bufsiz
13312int main() {
13313 FILE *fp = fopen("try.c", "r");
13314 char c = getc(fp);
13315 if (
13316 19 <= FILE_bufsiz(fp) &&
13317 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13318 )
13319 exit(0);
13320 exit(1);
13321}
13322EOP
13323 set try
13324 if eval $compile && $to try.c; then
13325 if $run ./try; then
13326 echo "And its _base field acts std."
13327 val="$define"
13328 else
13329 echo "But its _base field isn't std."
13330 fi
13331 else
13332 echo "However, it seems to be lacking the _base field."
13333 fi
13334 $rm_try
13335 ;;
13336esac
13337set d_stdiobase
13338eval $setvar
13339
13340: see if fast_stdio exists
13341val="$undef"
13342case "$d_stdstdio:$d_stdio_ptr_lval" in
13343"$define:$define")
13344 case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13345 *$define*)
13346 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13347 val="$define"
13348 ;;
13349 esac
13350 ;;
13351esac
13352set d_faststdio
13353eval $setvar
13354
13355
13356
13357: see if fchdir exists
13358set fchdir d_fchdir
13359eval $inlibc
13360
13361: see if fchmod exists
13362set fchmod d_fchmod
13363eval $inlibc
13364
13365: see if fchown exists
13366set fchown d_fchown
13367eval $inlibc
13368
13369: see if this is an fcntl system
13370set fcntl d_fcntl
13371eval $inlibc
13372
13373: See if fcntl-based locking works.
13374echo " "
13375$cat >try.c <<EOCP
13376#$i_stdlib I_STDLIB
13377#ifdef I_STDLIB
13378#include <stdlib.h>
13379#endif
13380#include <unistd.h>
13381#include <fcntl.h>
13382#include <signal.h>
13383$signal_t blech(int x) { exit(3); }
13384int main() {
13385#if defined(F_SETLK) && defined(F_SETLKW)
13386 struct flock flock;
13387 int retval, fd;
13388 fd = open("try.c", O_RDONLY);
13389 flock.l_type = F_RDLCK;
13390 flock.l_whence = SEEK_SET;
13391 flock.l_start = flock.l_len = 0;
13392 signal(SIGALRM, blech);
13393 alarm(10);
13394 retval = fcntl(fd, F_SETLK, &flock);
13395 close(fd);
13396 (retval < 0 ? exit(2) : exit(0));
13397#else
13398 exit(2);
13399#endif
13400}
13401EOCP
13402echo "Checking if fcntl-based file locking works... "
13403case "$d_fcntl" in
13404"$define")
13405 set try
13406 if eval $compile_ok; then
13407 if $run ./try; then
13408 echo "Yes, it seems to work."
13409 val="$define"
13410 else
13411 echo "Nope, it didn't work."
13412 val="$undef"
13413 case "$?" in
13414 3) $cat >&4 <<EOM
13415***
13416*** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13417*** This is (almost) impossible.
13418*** If your NFS lock daemons are not feeling well, something like
13419*** this may happen, please investigate. Cannot continue, aborting.
13420***
13421EOM
13422 exit 1
13423 ;;
13424 esac
13425 fi
13426 else
13427 echo "I'm unable to compile the test program, so I'll assume not."
13428 val="$undef"
13429 fi
13430 ;;
13431*) val="$undef";
13432 echo "Nope, since you don't even have fcntl()."
13433 ;;
13434esac
13435set d_fcntl_can_lock
13436eval $setvar
13437$rm_try
13438
13439: check for fd_set items
13440$cat <<EOM
13441
13442Checking to see how well your C compiler handles fd_set and friends ...
13443EOM
13444$cat >try.c <<EOCP
13445#$i_stdlib I_STDLIB
13446#ifdef I_STDLIB
13447#include <stdlib.h>
13448#endif
13449#$i_systime I_SYS_TIME
13450#$i_sysselct I_SYS_SELECT
13451#$d_socket HAS_SOCKET
13452#include <sys/types.h>
13453#ifdef HAS_SOCKET
13454#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13455#endif
13456#ifdef I_SYS_TIME
13457#include <sys/time.h>
13458#endif
13459#ifdef I_SYS_SELECT
13460#include <sys/select.h>
13461#endif
13462int main() {
13463 fd_set fds;
13464
13465#ifdef TRYBITS
13466 if(fds.fds_bits);
13467#endif
13468
13469#if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13470 exit(0);
13471#else
13472 exit(1);
13473#endif
13474}
13475EOCP
13476set try -DTRYBITS
13477if eval $compile; then
13478 d_fds_bits="$define"
13479 d_fd_set="$define"
13480 echo "Well, your system knows about the normal fd_set typedef..." >&4
13481 if $run ./try; then
13482 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13483 d_fd_macros="$define"
13484 else
13485 $cat >&4 <<'EOM'
13486but not the normal fd_set macros! Gaaack! I'll have to cover for you.
13487EOM
13488 d_fd_macros="$undef"
13489 fi
13490else
13491 $cat <<'EOM'
13492Hmm, your compiler has some difficulty with fd_set. Checking further...
13493EOM
13494 set try
13495 if eval $compile; then
13496 d_fds_bits="$undef"
13497 d_fd_set="$define"
13498 echo "Well, your system has some sort of fd_set available..." >&4
13499 if $run ./try; then
13500 echo "and you have the normal fd_set macros." >&4
13501 d_fd_macros="$define"
13502 else
13503 $cat <<'EOM'
13504but not the normal fd_set macros! Gross! More work for me...
13505EOM
13506 d_fd_macros="$undef"
13507 fi
13508 else
13509 echo "Well, you got zip. That's OK, I can roll my own fd_set stuff." >&4
13510 d_fd_set="$undef"
13511 d_fds_bits="$undef"
13512 d_fd_macros="$undef"
13513 fi
13514fi
13515$rm_try
13516
13517: see if fgetpos exists
13518set fgetpos d_fgetpos
13519eval $inlibc
13520
13521: see if finite exists
13522set finite d_finite
13523eval $inlibc
13524
13525: see if finitel exists
13526set finitel d_finitel
13527eval $inlibc
13528
13529: see if flock exists
13530set flock d_flock
13531eval $inlibc
13532
13533: see if prototype for flock is available
13534echo " "
13535set d_flockproto flock $i_sysfile sys/file.h
13536eval $hasproto
13537
13538: see if fp_class exists
13539set fp_class d_fp_class
13540eval $inlibc
13541
13542: see if pathconf exists
13543set pathconf d_pathconf
13544eval $inlibc
13545
13546: see if fpathconf exists
13547set fpathconf d_fpathconf
13548eval $inlibc
13549
13550: see if fpclass exists
13551set fpclass d_fpclass
13552eval $inlibc
13553
13554: see if fpclassify exists
13555set fpclassify d_fpclassify
13556eval $inlibc
13557
13558: see if fpclassl exists
13559set fpclassl d_fpclassl
13560eval $inlibc
13561
13562: check for fpos64_t
13563echo " "
13564echo "Checking to see if you have fpos64_t..." >&4
13565$cat >try.c <<EOCP
13566#include <stdio.h>
13567int main() { fpos64_t x = 7; }
13568EOCP
13569set try
13570if eval $compile; then
13571 val="$define"
13572 echo "You have fpos64_t."
13573else
13574 val="$undef"
13575 echo "You do not have fpos64_t."
13576 case "$fpossize" in
13577 8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13578 esac
13579fi
13580$rm_try
13581set d_fpos64_t
13582eval $setvar
13583
13584: see if frexpl exists
13585set frexpl d_frexpl
13586eval $inlibc
13587
13588: see if this is a sys/param system
13589set sys/param.h i_sysparam
13590eval $inhdr
13591
13592: see if this is a sys/mount.h system
13593set sys/mount.h i_sysmount
13594eval $inhdr
13595
13596: Check for fs_data_s
13597echo " "
13598echo "Checking to see if your system supports struct fs_data..." >&4
13599set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13600eval $hasstruct
13601case "$d_fs_data_s" in
13602"$define") echo "Yes, it does." ;;
13603*) echo "No, it doesn't." ;;
13604esac
13605
13606: see if fseeko exists
13607set fseeko d_fseeko
13608eval $inlibc
13609case "$longsize" in
136108) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13611esac
13612
13613: see if fsetpos exists
13614set fsetpos d_fsetpos
13615eval $inlibc
13616
13617: see if fstatfs exists
13618set fstatfs d_fstatfs
13619eval $inlibc
13620
13621: see if statvfs exists
13622set statvfs d_statvfs
13623eval $inlibc
13624
13625: see if fstatvfs exists
13626set fstatvfs d_fstatvfs
13627eval $inlibc
13628
13629
13630: see if fsync exists
13631set fsync d_fsync
13632eval $inlibc
13633
13634: see if ftello exists
13635set ftello d_ftello
13636eval $inlibc
13637case "$longsize" in
136388) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13639esac
13640
13641: check for a working futimes
13642d_futimes="$undef"
13643echo " "
13644echo "Checking if you have a working futimes()" >&4
13645$cat >try.c <<EOCP
13646#include <stdio.h>
13647#include <sys/time.h>
13648#include <errno.h>
13649#include <fcntl.h>
13650
13651int main ()
13652{
13653 int fd, rv;
13654 fd = open ("try.c", O_RDWR);
13655 if (-1 == fd) exit (1);
13656 rv = futimes (fd, NULL);
13657 exit (rv == -1 ? errno : 0);
13658}
13659EOCP
13660set try
13661if eval $compile; then
13662 `$run ./try`
13663 rc=$?
13664 case "$rc" in
13665 0) echo "Yes, you have" >&4
13666 d_futimes="$define"
13667 ;;
13668 *) echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13669 ;;
13670 esac
13671else
13672 echo "No, it does not (probably harmless)" >&4
13673fi
13674$rm_try
13675
13676: see if ndbm.h is available
13677set ndbm.h i_ndbm
13678eval $inhdr
13679: Compatibility location for RedHat 7.1
13680set gdbm/ndbm.h i_gdbmndbm
13681eval $inhdr
13682: Compatibility location for Debian 4.0
13683set gdbm-ndbm.h i_gdbm_ndbm
13684eval $inhdr
13685
13686val="$undef"
13687if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
13688 : see if dbm_open exists
13689 set dbm_open d_dbm_open
13690 eval $inlibc
13691 case "$d_dbm_open" in
13692 $undef)
13693 i_ndbm="$undef"
13694 i_gdbmndbm="$undef"
13695 i_gdbm_ndbm="$undef"
13696 echo "We won't be including <ndbm.h>"
13697 val="$undef"
13698 ;;
13699 *) val="$define"
13700 ;;
13701 esac
13702fi
13703set d_ndbm
13704eval $setvar
13705
13706ndbm_hdr_protochk='name=$1; hdr=$2;
13707eval "ihdr=\$""i_$name";
13708val="$undef";
13709if $test "$ihdr" = "$define"; then
13710 $echo "Checking if your <$hdr> uses prototypes..." >&4;
13711 case "$d_cplusplus" in
13712 $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
13713 *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
13714 esac;
13715 case "$val" in
13716 $define) $echo "Your <$hdr> seems to have prototypes";;
13717 *) $echo "Your <$hdr> does not seem to have prototypes";;
13718 esac;
13719fi;
13720set "d_${name}_h_uses_prototypes";
13721eval $setvar'
13722
13723set ndbm ndbm.h
13724eval $ndbm_hdr_protochk
13725set gdbmndbm gdbm/ndbm.h
13726eval $ndbm_hdr_protochk
13727set gdbm_ndbm gdbm-ndbm.h
13728eval $ndbm_hdr_protochk
13729
13730: see if getaddrinfo exists
13731set getaddrinfo d_getaddrinfo
13732eval $inlibc
13733
13734: see if getcwd exists
13735set getcwd d_getcwd
13736eval $inlibc
13737
13738: see if getespwnam exists
13739set getespwnam d_getespwnam
13740eval $inlibc
13741
13742: see if getfsstat exists
13743set getfsstat d_getfsstat
13744eval $inlibc
13745
13746: see if getgrent exists
13747set getgrent d_getgrent
13748eval $inlibc
13749
13750: see if getgrent_r exists
13751set getgrent_r d_getgrent_r
13752eval $inlibc
13753case "$d_getgrent_r" in
13754"$define")
13755 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13756 case "$d_getgrent_r_proto:$usethreads" in
13757 ":define") d_getgrent_r_proto=define
13758 set d_getgrent_r_proto getgrent_r $hdrs
13759 eval $hasproto ;;
13760 *) ;;
13761 esac
13762 case "$d_getgrent_r_proto" in
13763 define)
13764 case "$getgrent_r_proto" in
13765 ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13766 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13767 esac
13768 case "$getgrent_r_proto" in
13769 ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13770 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13771 esac
13772 case "$getgrent_r_proto" in
13773 ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13774 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
13775 esac
13776 case "$getgrent_r_proto" in
13777 ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13778 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
13779 esac
13780 case "$getgrent_r_proto" in
13781 ''|0) try='int getgrent_r(struct group*, char*, int);'
13782 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
13783 esac
13784 case "$getgrent_r_proto" in
13785 ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13786 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13787 esac
13788 case "$getgrent_r_proto" in
13789 ''|0) d_getgrent_r=undef
13790 getgrent_r_proto=0
13791 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13792 * ) case "$getgrent_r_proto" in
13793 REENTRANT_PROTO*) ;;
13794 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13795 esac
13796 echo "Prototype: $try" ;;
13797 esac
13798 ;;
13799 *) case "$usethreads" in
13800 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13801 esac
13802 d_getgrent_r=undef
13803 getgrent_r_proto=0
13804 ;;
13805 esac
13806 ;;
13807*) getgrent_r_proto=0
13808 ;;
13809esac
13810
13811: see if getgrgid_r exists
13812set getgrgid_r d_getgrgid_r
13813eval $inlibc
13814case "$d_getgrgid_r" in
13815"$define")
13816 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13817 case "$d_getgrgid_r_proto:$usethreads" in
13818 ":define") d_getgrgid_r_proto=define
13819 set d_getgrgid_r_proto getgrgid_r $hdrs
13820 eval $hasproto ;;
13821 *) ;;
13822 esac
13823 case "$d_getgrgid_r_proto" in
13824 define)
13825 case "$getgrgid_r_proto" in
13826 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13827 ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13828 esac
13829 case "$getgrgid_r_proto" in
13830 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13831 ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13832 esac
13833 case "$getgrgid_r_proto" in
13834 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13835 ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13836 esac
13837 case "$getgrgid_r_proto" in
13838 ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13839 ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13840 esac
13841 case "$getgrgid_r_proto" in
13842 ''|0) d_getgrgid_r=undef
13843 getgrgid_r_proto=0
13844 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13845 * ) case "$getgrgid_r_proto" in
13846 REENTRANT_PROTO*) ;;
13847 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13848 esac
13849 echo "Prototype: $try" ;;
13850 esac
13851 ;;
13852 *) case "$usethreads" in
13853 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13854 esac
13855 d_getgrgid_r=undef
13856 getgrgid_r_proto=0
13857 ;;
13858 esac
13859 ;;
13860*) getgrgid_r_proto=0
13861 ;;
13862esac
13863
13864: see if getgrnam_r exists
13865set getgrnam_r d_getgrnam_r
13866eval $inlibc
13867case "$d_getgrnam_r" in
13868"$define")
13869 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13870 case "$d_getgrnam_r_proto:$usethreads" in
13871 ":define") d_getgrnam_r_proto=define
13872 set d_getgrnam_r_proto getgrnam_r $hdrs
13873 eval $hasproto ;;
13874 *) ;;
13875 esac
13876 case "$d_getgrnam_r_proto" in
13877 define)
13878 case "$getgrnam_r_proto" in
13879 ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13880 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13881 esac
13882 case "$getgrnam_r_proto" in
13883 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13884 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13885 esac
13886 case "$getgrnam_r_proto" in
13887 ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13888 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13889 esac
13890 case "$getgrnam_r_proto" in
13891 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13892 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13893 esac
13894 case "$getgrnam_r_proto" in
13895 ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13896 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13897 esac
13898 case "$getgrnam_r_proto" in
13899 ''|0) d_getgrnam_r=undef
13900 getgrnam_r_proto=0
13901 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13902 * ) case "$getgrnam_r_proto" in
13903 REENTRANT_PROTO*) ;;
13904 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13905 esac
13906 echo "Prototype: $try" ;;
13907 esac
13908 ;;
13909 *) case "$usethreads" in
13910 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13911 esac
13912 d_getgrnam_r=undef
13913 getgrnam_r_proto=0
13914 ;;
13915 esac
13916 ;;
13917*) getgrnam_r_proto=0
13918 ;;
13919esac
13920
13921: see if gethostbyaddr exists
13922set gethostbyaddr d_gethbyaddr
13923eval $inlibc
13924
13925: see if gethostbyname exists
13926set gethostbyname d_gethbyname
13927eval $inlibc
13928
13929: see if gethostent exists
13930set gethostent d_gethent
13931eval $inlibc
13932
13933: see how we will look up host name
13934echo " "
13935call=''
13936if set gethostname val -f d_gethname; eval $csym; $val; then
13937 echo 'gethostname() found.' >&4
13938 d_gethname="$define"
13939 call=gethostname
13940fi
13941if set uname val -f d_uname; eval $csym; $val; then
13942 if ./xenix; then
13943 $cat <<'EOM'
13944uname() was found, but you're running xenix, and older versions of xenix
13945have a broken uname(). If you don't really know whether your xenix is old
13946enough to have a broken system call, use the default answer.
13947
13948EOM
13949 dflt=y
13950 case "$d_uname" in
13951 "$define") dflt=n;;
13952 esac
13953 rp='Is your uname() broken?'
13954 . ./myread
13955 case "$ans" in
13956 n*) d_uname="$define"; call=uname;;
13957 esac
13958 else
13959 echo 'uname() found.' >&4
13960 d_uname="$define"
13961 case "$call" in
13962 '') call=uname ;;
13963 esac
13964 fi
13965fi
13966case "$d_gethname" in
13967'') d_gethname="$undef";;
13968esac
13969case "$d_uname" in
13970'') d_uname="$undef";;
13971esac
13972case "$d_uname$d_gethname" in
13973*define*)
13974 dflt=n
13975 cat <<EOM
13976
13977Every now and then someone has a $call() that lies about the hostname
13978but can't be fixed for political or economic reasons. If you wish, I can
13979pretend $call() isn't there and maybe compute hostname at run-time
13980thanks to the '$phostname' command.
13981
13982EOM
13983 rp="Shall I ignore $call() from now on?"
13984 . ./myread
13985 case "$ans" in
13986 y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13987 esac;;
13988esac
13989case "$phostname" in
13990'') aphostname='';;
13991*) case "$aphostname" in
13992 /*) ;;
13993 *) set X $phostname
13994 shift
13995 file=$1
13996 shift
13997 file=`./loc $file $file $pth`
13998 aphostname=`echo $file $*`
13999 ;;
14000 esac
14001 ;;
14002esac
14003case "$d_uname$d_gethname" in
14004*define*) ;;
14005*)
14006 case "$phostname" in
14007 '')
14008 echo "There will be no way for $package to get your hostname." >&4;;
14009 *)
14010 echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
14011 ;;
14012 esac;;
14013esac
14014case "$d_phostname" in
14015'') d_phostname="$undef";;
14016esac
14017
14018: see if gethostbyaddr_r exists
14019set gethostbyaddr_r d_gethostbyaddr_r
14020eval $inlibc
14021case "$d_gethostbyaddr_r" in
14022"$define")
14023 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14024 case "$d_gethostbyaddr_r_proto:$usethreads" in
14025 ":define") d_gethostbyaddr_r_proto=define
14026 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
14027 eval $hasproto ;;
14028 *) ;;
14029 esac
14030 case "$d_gethostbyaddr_r_proto" in
14031 define)
14032 case "$gethostbyaddr_r_proto" in
14033 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14034 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
14035 esac
14036 case "$gethostbyaddr_r_proto" in
14037 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
14038 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
14039 esac
14040 case "$gethostbyaddr_r_proto" in
14041 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
14042 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
14043 esac
14044 case "$gethostbyaddr_r_proto" in
14045 ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
14046 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
14047 esac
14048 case "$gethostbyaddr_r_proto" in
14049 ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
14050 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
14051 esac
14052 case "$gethostbyaddr_r_proto" in
14053 ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
14054 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
14055 esac
14056 case "$gethostbyaddr_r_proto" in
14057 ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
14058 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
14059 esac
14060 case "$gethostbyaddr_r_proto" in
14061 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
14062 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
14063 esac
14064 case "$gethostbyaddr_r_proto" in
14065 ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
14066 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
14067 esac
14068 case "$gethostbyaddr_r_proto" in
14069 ''|0) try='int gethostbyaddr_r(const char*, int, int);'
14070 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
14071 esac
14072 case "$gethostbyaddr_r_proto" in
14073 ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14074 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
14075 esac
14076 case "$gethostbyaddr_r_proto" in
14077 ''|0) d_gethostbyaddr_r=undef
14078 gethostbyaddr_r_proto=0
14079 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
14080 * ) case "$gethostbyaddr_r_proto" in
14081 REENTRANT_PROTO*) ;;
14082 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
14083 esac
14084 echo "Prototype: $try" ;;
14085 esac
14086 ;;
14087 *) case "$usethreads" in
14088 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
14089 esac
14090 d_gethostbyaddr_r=undef
14091 gethostbyaddr_r_proto=0
14092 ;;
14093 esac
14094 ;;
14095*) gethostbyaddr_r_proto=0
14096 ;;
14097esac
14098
14099: see if gethostbyname_r exists
14100set gethostbyname_r d_gethostbyname_r
14101eval $inlibc
14102case "$d_gethostbyname_r" in
14103"$define")
14104 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14105 case "$d_gethostbyname_r_proto:$usethreads" in
14106 ":define") d_gethostbyname_r_proto=define
14107 set d_gethostbyname_r_proto gethostbyname_r $hdrs
14108 eval $hasproto ;;
14109 *) ;;
14110 esac
14111 case "$d_gethostbyname_r_proto" in
14112 define)
14113 case "$gethostbyname_r_proto" in
14114 ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
14115 ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
14116 esac
14117 case "$gethostbyname_r_proto" in
14118 ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
14119 ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
14120 esac
14121 case "$gethostbyname_r_proto" in
14122 ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
14123 ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
14124 esac
14125 case "$gethostbyname_r_proto" in
14126 ''|0) d_gethostbyname_r=undef
14127 gethostbyname_r_proto=0
14128 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
14129 * ) case "$gethostbyname_r_proto" in
14130 REENTRANT_PROTO*) ;;
14131 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
14132 esac
14133 echo "Prototype: $try" ;;
14134 esac
14135 ;;
14136 *) case "$usethreads" in
14137 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
14138 esac
14139 d_gethostbyname_r=undef
14140 gethostbyname_r_proto=0
14141 ;;
14142 esac
14143 ;;
14144*) gethostbyname_r_proto=0
14145 ;;
14146esac
14147
14148: see if gethostent_r exists
14149set gethostent_r d_gethostent_r
14150eval $inlibc
14151case "$d_gethostent_r" in
14152"$define")
14153 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14154 case "$d_gethostent_r_proto:$usethreads" in
14155 ":define") d_gethostent_r_proto=define
14156 set d_gethostent_r_proto gethostent_r $hdrs
14157 eval $hasproto ;;
14158 *) ;;
14159 esac
14160 case "$d_gethostent_r_proto" in
14161 define)
14162 case "$gethostent_r_proto" in
14163 ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
14164 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
14165 esac
14166 case "$gethostent_r_proto" in
14167 ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
14168 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
14169 esac
14170 case "$gethostent_r_proto" in
14171 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
14172 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
14173 esac
14174 case "$gethostent_r_proto" in
14175 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
14176 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
14177 esac
14178 case "$gethostent_r_proto" in
14179 ''|0) try='int gethostent_r(struct hostent*, char*, int);'
14180 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
14181 esac
14182 case "$gethostent_r_proto" in
14183 ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
14184 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
14185 esac
14186 case "$gethostent_r_proto" in
14187 ''|0) d_gethostent_r=undef
14188 gethostent_r_proto=0
14189 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
14190 * ) case "$gethostent_r_proto" in
14191 REENTRANT_PROTO*) ;;
14192 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
14193 esac
14194 echo "Prototype: $try" ;;
14195 esac
14196 ;;
14197 *) case "$usethreads" in
14198 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
14199 esac
14200 d_gethostent_r=undef
14201 gethostent_r_proto=0
14202 ;;
14203 esac
14204 ;;
14205*) gethostent_r_proto=0
14206 ;;
14207esac
14208
14209: see if prototypes for various gethostxxx netdb.h functions are available
14210echo " "
14211set d_gethostprotos gethostent $i_netdb netdb.h
14212eval $hasproto
14213
14214: see if getitimer exists
14215set getitimer d_getitimer
14216eval $inlibc
14217
14218: see if getlogin exists
14219set getlogin d_getlogin
14220eval $inlibc
14221
14222: see if getlogin_r exists
14223set getlogin_r d_getlogin_r
14224eval $inlibc
14225case "$d_getlogin_r" in
14226"$define")
14227 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14228 case "$d_getlogin_r_proto:$usethreads" in
14229 ":define") d_getlogin_r_proto=define
14230 set d_getlogin_r_proto getlogin_r $hdrs
14231 eval $hasproto ;;
14232 *) ;;
14233 esac
14234 case "$d_getlogin_r_proto" in
14235 define)
14236 case "$getlogin_r_proto" in
14237 ''|0) try='int getlogin_r(char*, size_t);'
14238 ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14239 esac
14240 case "$getlogin_r_proto" in
14241 ''|0) try='int getlogin_r(char*, int);'
14242 ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14243 esac
14244 case "$getlogin_r_proto" in
14245 ''|0) try='char* getlogin_r(char*, size_t);'
14246 ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14247 esac
14248 case "$getlogin_r_proto" in
14249 ''|0) try='char* getlogin_r(char*, int);'
14250 ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14251 esac
14252 case "$getlogin_r_proto" in
14253 ''|0) d_getlogin_r=undef
14254 getlogin_r_proto=0
14255 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14256 * ) case "$getlogin_r_proto" in
14257 REENTRANT_PROTO*) ;;
14258 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14259 esac
14260 echo "Prototype: $try" ;;
14261 esac
14262 ;;
14263 *) case "$usethreads" in
14264 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14265 esac
14266 d_getlogin_r=undef
14267 getlogin_r_proto=0
14268 ;;
14269 esac
14270 ;;
14271*) getlogin_r_proto=0
14272 ;;
14273esac
14274
14275: see if getmnt exists
14276set getmnt d_getmnt
14277eval $inlibc
14278
14279: see if getmntent exists
14280set getmntent d_getmntent
14281eval $inlibc
14282
14283: see if getnameinfo exists
14284set getnameinfo d_getnameinfo
14285eval $inlibc
14286
14287: see if getnetbyaddr exists
14288set getnetbyaddr d_getnbyaddr
14289eval $inlibc
14290
14291: see if getnetbyname exists
14292set getnetbyname d_getnbyname
14293eval $inlibc
14294
14295: see if getnetent exists
14296set getnetent d_getnent
14297eval $inlibc
14298
14299: see if getnetbyaddr_r exists
14300set getnetbyaddr_r d_getnetbyaddr_r
14301eval $inlibc
14302case "$d_getnetbyaddr_r" in
14303"$define")
14304 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14305 case "$d_getnetbyaddr_r_proto:$usethreads" in
14306 ":define") d_getnetbyaddr_r_proto=define
14307 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14308 eval $hasproto ;;
14309 *) ;;
14310 esac
14311 case "$d_getnetbyaddr_r_proto" in
14312 define)
14313 case "$getnetbyaddr_r_proto" in
14314 ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14315 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14316 esac
14317 case "$getnetbyaddr_r_proto" in
14318 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14319 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14320 esac
14321 case "$getnetbyaddr_r_proto" in
14322 ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14323 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14324 esac
14325 case "$getnetbyaddr_r_proto" in
14326 ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14327 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14328 esac
14329 case "$getnetbyaddr_r_proto" in
14330 ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14331 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14332 esac
14333 case "$getnetbyaddr_r_proto" in
14334 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14335 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14336 esac
14337 case "$getnetbyaddr_r_proto" in
14338 ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14339 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14340 esac
14341 case "$getnetbyaddr_r_proto" in
14342 ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14343 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14344 esac
14345 case "$getnetbyaddr_r_proto" in
14346 ''|0) d_getnetbyaddr_r=undef
14347 getnetbyaddr_r_proto=0
14348 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14349 * ) case "$getnetbyaddr_r_proto" in
14350 REENTRANT_PROTO*) ;;
14351 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14352 esac
14353 echo "Prototype: $try" ;;
14354 esac
14355 ;;
14356 *) case "$usethreads" in
14357 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14358 esac
14359 d_getnetbyaddr_r=undef
14360 getnetbyaddr_r_proto=0
14361 ;;
14362 esac
14363 ;;
14364*) getnetbyaddr_r_proto=0
14365 ;;
14366esac
14367
14368: see if getnetbyname_r exists
14369set getnetbyname_r d_getnetbyname_r
14370eval $inlibc
14371case "$d_getnetbyname_r" in
14372"$define")
14373 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14374 case "$d_getnetbyname_r_proto:$usethreads" in
14375 ":define") d_getnetbyname_r_proto=define
14376 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14377 eval $hasproto ;;
14378 *) ;;
14379 esac
14380 case "$d_getnetbyname_r_proto" in
14381 define)
14382 case "$getnetbyname_r_proto" in
14383 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14384 ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14385 esac
14386 case "$getnetbyname_r_proto" in
14387 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14388 ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14389 esac
14390 case "$getnetbyname_r_proto" in
14391 ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14392 ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14393 esac
14394 case "$getnetbyname_r_proto" in
14395 ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14396 ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14397 esac
14398 case "$getnetbyname_r_proto" in
14399 ''|0) d_getnetbyname_r=undef
14400 getnetbyname_r_proto=0
14401 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14402 * ) case "$getnetbyname_r_proto" in
14403 REENTRANT_PROTO*) ;;
14404 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14405 esac
14406 echo "Prototype: $try" ;;
14407 esac
14408 ;;
14409 *) case "$usethreads" in
14410 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14411 esac
14412 d_getnetbyname_r=undef
14413 getnetbyname_r_proto=0
14414 ;;
14415 esac
14416 ;;
14417*) getnetbyname_r_proto=0
14418 ;;
14419esac
14420
14421: see if getnetent_r exists
14422set getnetent_r d_getnetent_r
14423eval $inlibc
14424case "$d_getnetent_r" in
14425"$define")
14426 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14427 case "$d_getnetent_r_proto:$usethreads" in
14428 ":define") d_getnetent_r_proto=define
14429 set d_getnetent_r_proto getnetent_r $hdrs
14430 eval $hasproto ;;
14431 *) ;;
14432 esac
14433 case "$d_getnetent_r_proto" in
14434 define)
14435 case "$getnetent_r_proto" in
14436 ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14437 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14438 esac
14439 case "$getnetent_r_proto" in
14440 ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14441 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14442 esac
14443 case "$getnetent_r_proto" in
14444 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14445 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14446 esac
14447 case "$getnetent_r_proto" in
14448 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14449 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14450 esac
14451 case "$getnetent_r_proto" in
14452 ''|0) try='int getnetent_r(struct netent*, char*, int);'
14453 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14454 esac
14455 case "$getnetent_r_proto" in
14456 ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14457 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14458 esac
14459 case "$getnetent_r_proto" in
14460 ''|0) d_getnetent_r=undef
14461 getnetent_r_proto=0
14462 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14463 * ) case "$getnetent_r_proto" in
14464 REENTRANT_PROTO*) ;;
14465 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14466 esac
14467 echo "Prototype: $try" ;;
14468 esac
14469 ;;
14470 *) case "$usethreads" in
14471 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14472 esac
14473 d_getnetent_r=undef
14474 getnetent_r_proto=0
14475 ;;
14476 esac
14477 ;;
14478*) getnetent_r_proto=0
14479 ;;
14480esac
14481
14482: see if prototypes for various getnetxxx netdb.h functions are available
14483echo " "
14484set d_getnetprotos getnetent $i_netdb netdb.h
14485eval $hasproto
14486
14487: see if getpagesize exists
14488set getpagesize d_getpagsz
14489eval $inlibc
14490
14491: Optional checks for getprotobyname and getprotobynumber
14492
14493: see if getprotobyname exists
14494set getprotobyname d_getpbyname
14495eval $inlibc
14496
14497: see if getprotobynumber exists
14498set getprotobynumber d_getpbynumber
14499eval $inlibc
14500
14501: see if getprotoent exists
14502set getprotoent d_getpent
14503eval $inlibc
14504
14505: see if getpgid exists
14506set getpgid d_getpgid
14507eval $inlibc
14508
14509: see if getpgrp2 exists
14510set getpgrp2 d_getpgrp2
14511eval $inlibc
14512
14513: see if getppid exists
14514set getppid d_getppid
14515eval $inlibc
14516
14517: see if getpriority exists
14518set getpriority d_getprior
14519eval $inlibc
14520
14521: see if getprotobyname_r exists
14522set getprotobyname_r d_getprotobyname_r
14523eval $inlibc
14524case "$d_getprotobyname_r" in
14525"$define")
14526 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14527 case "$d_getprotobyname_r_proto:$usethreads" in
14528 ":define") d_getprotobyname_r_proto=define
14529 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14530 eval $hasproto ;;
14531 *) ;;
14532 esac
14533 case "$d_getprotobyname_r_proto" in
14534 define)
14535 case "$getprotobyname_r_proto" in
14536 ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14537 ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14538 esac
14539 case "$getprotobyname_r_proto" in
14540 ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14541 ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
14542 esac
14543 case "$getprotobyname_r_proto" in
14544 ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
14545 ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
14546 esac
14547 case "$getprotobyname_r_proto" in
14548 ''|0) d_getprotobyname_r=undef
14549 getprotobyname_r_proto=0
14550 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
14551 * ) case "$getprotobyname_r_proto" in
14552 REENTRANT_PROTO*) ;;
14553 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14554 esac
14555 echo "Prototype: $try" ;;
14556 esac
14557 ;;
14558 *) case "$usethreads" in
14559 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14560 esac
14561 d_getprotobyname_r=undef
14562 getprotobyname_r_proto=0
14563 ;;
14564 esac
14565 ;;
14566*) getprotobyname_r_proto=0
14567 ;;
14568esac
14569
14570: see if getprotobynumber_r exists
14571set getprotobynumber_r d_getprotobynumber_r
14572eval $inlibc
14573case "$d_getprotobynumber_r" in
14574"$define")
14575 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14576 case "$d_getprotobynumber_r_proto:$usethreads" in
14577 ":define") d_getprotobynumber_r_proto=define
14578 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14579 eval $hasproto ;;
14580 *) ;;
14581 esac
14582 case "$d_getprotobynumber_r_proto" in
14583 define)
14584 case "$getprotobynumber_r_proto" in
14585 ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14586 ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14587 esac
14588 case "$getprotobynumber_r_proto" in
14589 ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14590 ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14591 esac
14592 case "$getprotobynumber_r_proto" in
14593 ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14594 ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14595 esac
14596 case "$getprotobynumber_r_proto" in
14597 ''|0) d_getprotobynumber_r=undef
14598 getprotobynumber_r_proto=0
14599 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14600 * ) case "$getprotobynumber_r_proto" in
14601 REENTRANT_PROTO*) ;;
14602 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14603 esac
14604 echo "Prototype: $try" ;;
14605 esac
14606 ;;
14607 *) case "$usethreads" in
14608 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14609 esac
14610 d_getprotobynumber_r=undef
14611 getprotobynumber_r_proto=0
14612 ;;
14613 esac
14614 ;;
14615*) getprotobynumber_r_proto=0
14616 ;;
14617esac
14618
14619: see if getprotoent_r exists
14620set getprotoent_r d_getprotoent_r
14621eval $inlibc
14622case "$d_getprotoent_r" in
14623"$define")
14624 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14625 case "$d_getprotoent_r_proto:$usethreads" in
14626 ":define") d_getprotoent_r_proto=define
14627 set d_getprotoent_r_proto getprotoent_r $hdrs
14628 eval $hasproto ;;
14629 *) ;;
14630 esac
14631 case "$d_getprotoent_r_proto" in
14632 define)
14633 case "$getprotoent_r_proto" in
14634 ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14635 ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14636 esac
14637 case "$getprotoent_r_proto" in
14638 ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14639 ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14640 esac
14641 case "$getprotoent_r_proto" in
14642 ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14643 ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14644 esac
14645 case "$getprotoent_r_proto" in
14646 ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14647 ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
14648 esac
14649 case "$getprotoent_r_proto" in
14650 ''|0) d_getprotoent_r=undef
14651 getprotoent_r_proto=0
14652 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
14653 * ) case "$getprotoent_r_proto" in
14654 REENTRANT_PROTO*) ;;
14655 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14656 esac
14657 echo "Prototype: $try" ;;
14658 esac
14659 ;;
14660 *) case "$usethreads" in
14661 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14662 esac
14663 d_getprotoent_r=undef
14664 getprotoent_r_proto=0
14665 ;;
14666 esac
14667 ;;
14668*) getprotoent_r_proto=0
14669 ;;
14670esac
14671
14672: see if prototypes for various getprotoxxx netdb.h functions are available
14673echo " "
14674set d_getprotoprotos getprotoent $i_netdb netdb.h
14675eval $hasproto
14676
14677: see if getprpwnam exists
14678set getprpwnam d_getprpwnam
14679eval $inlibc
14680
14681: see if getpwent exists
14682set getpwent d_getpwent
14683eval $inlibc
14684
14685: see if getpwent_r exists
14686set getpwent_r d_getpwent_r
14687eval $inlibc
14688case "$d_getpwent_r" in
14689"$define")
14690 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14691 case "$d_getpwent_r_proto:$usethreads" in
14692 ":define") d_getpwent_r_proto=define
14693 set d_getpwent_r_proto getpwent_r $hdrs
14694 eval $hasproto ;;
14695 *) ;;
14696 esac
14697 case "$d_getpwent_r_proto" in
14698 define)
14699 case "$getpwent_r_proto" in
14700 ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14701 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14702 esac
14703 case "$getpwent_r_proto" in
14704 ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14705 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14706 esac
14707 case "$getpwent_r_proto" in
14708 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14709 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
14710 esac
14711 case "$getpwent_r_proto" in
14712 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14713 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
14714 esac
14715 case "$getpwent_r_proto" in
14716 ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14717 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
14718 esac
14719 case "$getpwent_r_proto" in
14720 ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14721 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14722 esac
14723 case "$getpwent_r_proto" in
14724 ''|0) d_getpwent_r=undef
14725 getpwent_r_proto=0
14726 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14727 * ) case "$getpwent_r_proto" in
14728 REENTRANT_PROTO*) ;;
14729 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14730 esac
14731 echo "Prototype: $try" ;;
14732 esac
14733 ;;
14734 *) case "$usethreads" in
14735 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14736 esac
14737 d_getpwent_r=undef
14738 getpwent_r_proto=0
14739 ;;
14740 esac
14741 ;;
14742*) getpwent_r_proto=0
14743 ;;
14744esac
14745
14746: see if getpwnam_r exists
14747set getpwnam_r d_getpwnam_r
14748eval $inlibc
14749case "$d_getpwnam_r" in
14750"$define")
14751 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14752 case "$d_getpwnam_r_proto:$usethreads" in
14753 ":define") d_getpwnam_r_proto=define
14754 set d_getpwnam_r_proto getpwnam_r $hdrs
14755 eval $hasproto ;;
14756 *) ;;
14757 esac
14758 case "$d_getpwnam_r_proto" in
14759 define)
14760 case "$getpwnam_r_proto" in
14761 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14762 ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14763 esac
14764 case "$getpwnam_r_proto" in
14765 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14766 ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14767 esac
14768 case "$getpwnam_r_proto" in
14769 ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14770 ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14771 esac
14772 case "$getpwnam_r_proto" in
14773 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14774 ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14775 esac
14776 case "$getpwnam_r_proto" in
14777 ''|0) d_getpwnam_r=undef
14778 getpwnam_r_proto=0
14779 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14780 * ) case "$getpwnam_r_proto" in
14781 REENTRANT_PROTO*) ;;
14782 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14783 esac
14784 echo "Prototype: $try" ;;
14785 esac
14786 ;;
14787 *) case "$usethreads" in
14788 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14789 esac
14790 d_getpwnam_r=undef
14791 getpwnam_r_proto=0
14792 ;;
14793 esac
14794 ;;
14795*) getpwnam_r_proto=0
14796 ;;
14797esac
14798
14799: see if getpwuid_r exists
14800set getpwuid_r d_getpwuid_r
14801eval $inlibc
14802case "$d_getpwuid_r" in
14803"$define")
14804 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14805 case "$d_getpwuid_r_proto:$usethreads" in
14806 ":define") d_getpwuid_r_proto=define
14807 set d_getpwuid_r_proto getpwuid_r $hdrs
14808 eval $hasproto ;;
14809 *) ;;
14810 esac
14811 case "$d_getpwuid_r_proto" in
14812 define)
14813 case "$getpwuid_r_proto" in
14814 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14815 ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14816 esac
14817 case "$getpwuid_r_proto" in
14818 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14819 ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14820 esac
14821 case "$getpwuid_r_proto" in
14822 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14823 ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14824 esac
14825 case "$getpwuid_r_proto" in
14826 ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14827 ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14828 esac
14829 case "$getpwuid_r_proto" in
14830 ''|0) d_getpwuid_r=undef
14831 getpwuid_r_proto=0
14832 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14833 * ) case "$getpwuid_r_proto" in
14834 REENTRANT_PROTO*) ;;
14835 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14836 esac
14837 echo "Prototype: $try" ;;
14838 esac
14839 ;;
14840 *) case "$usethreads" in
14841 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14842 esac
14843 d_getpwuid_r=undef
14844 getpwuid_r_proto=0
14845 ;;
14846 esac
14847 ;;
14848*) getpwuid_r_proto=0
14849 ;;
14850esac
14851
14852: Optional checks for getsbyname and getsbyport
14853
14854: see if getservbyname exists
14855set getservbyname d_getsbyname
14856eval $inlibc
14857
14858: see if getservbyport exists
14859set getservbyport d_getsbyport
14860eval $inlibc
14861
14862: see if getservent exists
14863set getservent d_getsent
14864eval $inlibc
14865
14866: see if getservbyname_r exists
14867set getservbyname_r d_getservbyname_r
14868eval $inlibc
14869case "$d_getservbyname_r" in
14870"$define")
14871 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14872 case "$d_getservbyname_r_proto:$usethreads" in
14873 ":define") d_getservbyname_r_proto=define
14874 set d_getservbyname_r_proto getservbyname_r $hdrs
14875 eval $hasproto ;;
14876 *) ;;
14877 esac
14878 case "$d_getservbyname_r_proto" in
14879 define)
14880 case "$getservbyname_r_proto" in
14881 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14882 ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14883 esac
14884 case "$getservbyname_r_proto" in
14885 ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14886 ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14887 esac
14888 case "$getservbyname_r_proto" in
14889 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14890 ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14891 esac
14892 case "$getservbyname_r_proto" in
14893 ''|0) d_getservbyname_r=undef
14894 getservbyname_r_proto=0
14895 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14896 * ) case "$getservbyname_r_proto" in
14897 REENTRANT_PROTO*) ;;
14898 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14899 esac
14900 echo "Prototype: $try" ;;
14901 esac
14902 ;;
14903 *) case "$usethreads" in
14904 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14905 esac
14906 d_getservbyname_r=undef
14907 getservbyname_r_proto=0
14908 ;;
14909 esac
14910 ;;
14911*) getservbyname_r_proto=0
14912 ;;
14913esac
14914
14915: see if getservbyport_r exists
14916set getservbyport_r d_getservbyport_r
14917eval $inlibc
14918case "$d_getservbyport_r" in
14919"$define")
14920 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14921 case "$d_getservbyport_r_proto:$usethreads" in
14922 ":define") d_getservbyport_r_proto=define
14923 set d_getservbyport_r_proto getservbyport_r $hdrs
14924 eval $hasproto ;;
14925 *) ;;
14926 esac
14927 case "$d_getservbyport_r_proto" in
14928 define)
14929 case "$getservbyport_r_proto" in
14930 ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14931 ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14932 esac
14933 case "$getservbyport_r_proto" in
14934 ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14935 ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14936 esac
14937 case "$getservbyport_r_proto" in
14938 ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14939 ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14940 esac
14941 case "$getservbyport_r_proto" in
14942 ''|0) d_getservbyport_r=undef
14943 getservbyport_r_proto=0
14944 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14945 * ) case "$getservbyport_r_proto" in
14946 REENTRANT_PROTO*) ;;
14947 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14948 esac
14949 echo "Prototype: $try" ;;
14950 esac
14951 ;;
14952 *) case "$usethreads" in
14953 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14954 esac
14955 d_getservbyport_r=undef
14956 getservbyport_r_proto=0
14957 ;;
14958 esac
14959 ;;
14960*) getservbyport_r_proto=0
14961 ;;
14962esac
14963
14964: see if getservent_r exists
14965set getservent_r d_getservent_r
14966eval $inlibc
14967case "$d_getservent_r" in
14968"$define")
14969 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14970 case "$d_getservent_r_proto:$usethreads" in
14971 ":define") d_getservent_r_proto=define
14972 set d_getservent_r_proto getservent_r $hdrs
14973 eval $hasproto ;;
14974 *) ;;
14975 esac
14976 case "$d_getservent_r_proto" in
14977 define)
14978 case "$getservent_r_proto" in
14979 ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14980 ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
14981 esac
14982 case "$getservent_r_proto" in
14983 ''|0) try='int getservent_r(struct servent*, char*, int);'
14984 ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
14985 esac
14986 case "$getservent_r_proto" in
14987 ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14988 ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
14989 esac
14990 case "$getservent_r_proto" in
14991 ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14992 ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
14993 esac
14994 case "$getservent_r_proto" in
14995 ''|0) d_getservent_r=undef
14996 getservent_r_proto=0
14997 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14998 * ) case "$getservent_r_proto" in
14999 REENTRANT_PROTO*) ;;
15000 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
15001 esac
15002 echo "Prototype: $try" ;;
15003 esac
15004 ;;
15005 *) case "$usethreads" in
15006 define) echo "getservent_r has no prototype, not using it." >&4 ;;
15007 esac
15008 d_getservent_r=undef
15009 getservent_r_proto=0
15010 ;;
15011 esac
15012 ;;
15013*) getservent_r_proto=0
15014 ;;
15015esac
15016
15017: see if prototypes for various getservxxx netdb.h functions are available
15018echo " "
15019set d_getservprotos getservent $i_netdb netdb.h
15020eval $hasproto
15021
15022: see if getspnam exists
15023set getspnam d_getspnam
15024eval $inlibc
15025
15026: see if this is a shadow.h system
15027set shadow.h i_shadow
15028eval $inhdr
15029
15030: see if getspnam_r exists
15031set getspnam_r d_getspnam_r
15032eval $inlibc
15033case "$d_getspnam_r" in
15034"$define")
15035 hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
15036 case "$d_getspnam_r_proto:$usethreads" in
15037 ":define") d_getspnam_r_proto=define
15038 set d_getspnam_r_proto getspnam_r $hdrs
15039 eval $hasproto ;;
15040 *) ;;
15041 esac
15042 case "$d_getspnam_r_proto" in
15043 define)
15044 case "$getspnam_r_proto" in
15045 ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
15046 ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
15047 esac
15048 case "$getspnam_r_proto" in
15049 ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
15050 ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
15051 esac
15052 case "$getspnam_r_proto" in
15053 ''|0) d_getspnam_r=undef
15054 getspnam_r_proto=0
15055 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
15056 * ) case "$getspnam_r_proto" in
15057 REENTRANT_PROTO*) ;;
15058 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
15059 esac
15060 echo "Prototype: $try" ;;
15061 esac
15062 ;;
15063 *) case "$usethreads" in
15064 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
15065 esac
15066 d_getspnam_r=undef
15067 getspnam_r_proto=0
15068 ;;
15069 esac
15070 ;;
15071*) getspnam_r_proto=0
15072 ;;
15073esac
15074
15075: see if gettimeofday or ftime exists
15076set gettimeofday d_gettimeod
15077eval $inlibc
15078case "$d_gettimeod" in
15079"$undef")
15080 set ftime d_ftime
15081 eval $inlibc
15082 ;;
15083*)
15084 val="$undef"; set d_ftime; eval $setvar
15085 ;;
15086esac
15087case "$d_gettimeod$d_ftime" in
15088"$undef$undef")
15089 echo " "
15090 echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
15091 ;;
15092esac
15093
15094: see if gmtime_r exists
15095set gmtime_r d_gmtime_r
15096eval $inlibc
15097case "$d_gmtime_r" in
15098"$define")
15099 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15100 case "$d_gmtime_r_proto:$usethreads" in
15101 ":define") d_gmtime_r_proto=define
15102 set d_gmtime_r_proto gmtime_r $hdrs
15103 eval $hasproto ;;
15104 *) ;;
15105 esac
15106 case "$d_gmtime_r_proto" in
15107 define)
15108 case "$gmtime_r_proto" in
15109 ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
15110 ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
15111 esac
15112 case "$gmtime_r_proto" in
15113 ''|0) try='int gmtime_r(const time_t*, struct tm*);'
15114 ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
15115 esac
15116 case "$gmtime_r_proto" in
15117 ''|0) d_gmtime_r=undef
15118 gmtime_r_proto=0
15119 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
15120 * ) case "$gmtime_r_proto" in
15121 REENTRANT_PROTO*) ;;
15122 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
15123 esac
15124 echo "Prototype: $try" ;;
15125 esac
15126 ;;
15127 *) case "$usethreads" in
15128 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
15129 esac
15130 d_gmtime_r=undef
15131 gmtime_r_proto=0
15132 ;;
15133 esac
15134 ;;
15135*) gmtime_r_proto=0
15136 ;;
15137esac
15138
15139: see if hasmntopt exists
15140set hasmntopt d_hasmntopt
15141eval $inlibc
15142
15143: see if this is a netinet/in.h or sys/in.h system
15144set netinet/in.h i_niin sys/in.h i_sysin
15145eval $inhdr
15146
15147: see if arpa/inet.h has to be included
15148set arpa/inet.h i_arpainet
15149eval $inhdr
15150
15151: see if htonl --and friends-- exists
15152val=''
15153set htonl val
15154eval $inlibc
15155
15156: Maybe they are macros.
15157case "$val" in
15158$undef)
15159 $cat >htonl.c <<EOM
15160#include <stdio.h>
15161#include <sys/types.h>
15162#$i_niin I_NETINET_IN
15163#$i_sysin I_SYS_IN
15164#$i_arpainet I_ARPA_INET
15165#ifdef I_NETINET_IN
15166#include <netinet/in.h>
15167#endif
15168#ifdef I_SYS_IN
15169#include <sys/in.h>
15170#endif
15171#ifdef I_ARPA_INET
15172#include <arpa/inet.h>
15173#endif
15174#ifdef htonl
15175printf("Defined as a macro.");
15176#endif
15177EOM
15178 $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
15179 if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
15180 val="$define"
15181 echo "But it seems to be defined as a macro." >&4
15182 fi
15183 $rm -f htonl.?
15184 ;;
15185esac
15186set d_htonl
15187eval $setvar
15188
15189: see if ilogbl exists
15190set ilogbl d_ilogbl
15191eval $inlibc
15192
15193: index or strchr
15194echo " "
15195if set index val -f; eval $csym; $val; then
15196 if set strchr val -f d_strchr; eval $csym; $val; then
15197 if $contains strchr "$strings" >/dev/null 2>&1 ; then
15198 val="$define"
15199 vali="$undef"
15200 echo "strchr() found." >&4
15201 else
15202 val="$undef"
15203 vali="$define"
15204 echo "index() found." >&4
15205 fi
15206 else
15207 val="$undef"
15208 vali="$define"
15209 echo "index() found." >&4
15210 fi
15211else
15212 if set strchr val -f d_strchr; eval $csym; $val; then
15213 val="$define"
15214 vali="$undef"
15215 echo "strchr() found." >&4
15216 else
15217 echo "No index() or strchr() found!" >&4
15218 val="$undef"
15219 vali="$undef"
15220 fi
15221fi
15222set d_strchr; eval $setvar
15223val="$vali"
15224set d_index; eval $setvar
15225
15226: check whether inet_aton exists
15227set inet_aton d_inetaton
15228eval $inlibc
15229
15230: see if inet_ntop exists
15231set inet_ntop d_inetntop
15232eval $inlibc
15233
15234: see if inet_pton exists
15235set inet_pton d_inetpton
15236eval $inlibc
15237
15238: Look for isascii
15239echo " "
15240$cat >isascii.c <<EOCP
15241#include <stdio.h>
15242#include <ctype.h>
15243#$i_stdlib I_STDLIB
15244#ifdef I_STDLIB
15245#include <stdlib.h>
15246#endif
15247int main() {
15248 int c = 'A';
15249 if (isascii(c))
15250 exit(0);
15251 else
15252 exit(1);
15253}
15254EOCP
15255set isascii
15256if eval $compile; then
15257 echo "isascii() found." >&4
15258 val="$define"
15259else
15260 echo "isascii() NOT found." >&4
15261 val="$undef"
15262fi
15263set d_isascii
15264eval $setvar
15265$rm -f isascii*
15266
15267: Look for isblank
15268echo " "
15269$cat >isblank.c <<'EOCP'
15270#include <stdio.h>
15271#include <ctype.h>
15272int main() {
15273 int c = ' ';
15274 if (isblank(c))
15275 return 0 ;
15276 else
15277 return 1 ;
15278}
15279EOCP
15280if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15281 echo "isblank() found." >&4
15282 val="$define"
15283else
15284 echo "isblank() NOT found." >&4
15285 val="$undef"
15286fi
15287set d_isblank
15288eval $setvar
15289$rm -f isblank*
15290
15291: see if isfinite exists
15292set isfinite d_isfinite
15293eval $inlibc
15294
15295: see if isinf exists
15296set isinf d_isinf
15297eval $inlibc
15298
15299: see if isnan exists
15300set isnan d_isnan
15301eval $inlibc
15302
15303: see if isnanl exists
15304set isnanl d_isnanl
15305eval $inlibc
15306
15307: see if killpg exists
15308set killpg d_killpg
15309eval $inlibc
15310
15311: see if lchown exists
15312echo " "
15313$cat > try.c <<'EOCP'
15314/* System header to define __stub macros and hopefully few prototypes,
15315 which can conflict with char lchown(); below. */
15316#include <assert.h>
15317/* Override any gcc2 internal prototype to avoid an error. */
15318/* We use char because int might match the return type of a gcc2
15319 builtin and then its argument prototype would still apply. */
15320char lchown();
15321int main() {
15322 /* The GNU C library defines this for functions which it implements
15323 to always fail with ENOSYS. Some functions are actually named
15324 something starting with __ and the normal name is an alias. */
15325#if defined (__stub_lchown) || defined (__stub___lchown)
15326choke me
15327#else
15328lchown();
15329#endif
15330; return 0; }
15331EOCP
15332set try
15333if eval $compile; then
15334 $echo "lchown() found." >&4
15335 val="$define"
15336else
15337 $echo "lchown() NOT found." >&4
15338 val="$undef"
15339fi
15340set d_lchown
15341eval $setvar
15342
15343: See if number of significant digits in a double precision number is known
15344echo " "
15345$cat >ldbl_dig.c <<EOM
15346#$i_limits I_LIMITS
15347#$i_float I_FLOAT
15348#ifdef I_LIMITS
15349#include <limits.h>
15350#endif
15351#ifdef I_FLOAT
15352#include <float.h>
15353#endif
15354#ifdef LDBL_DIG
15355printf("Contains LDBL_DIG");
15356#endif
15357EOM
15358$cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15359if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15360 echo "LDBL_DIG found." >&4
15361 val="$define"
15362else
15363 echo "LDBL_DIG NOT found." >&4
15364 val="$undef"
15365fi
15366$rm -f ldbl_dig.?
15367set d_ldbl_dig
15368eval $setvar
15369
15370: see if this is a math.h system
15371set math.h i_math
15372eval $inhdr
15373
15374: check to see if math.h defines _LIB_VERSION
15375d_libm_lib_version="$undef"
15376case $i_math in
15377 $define)
15378 echo " "
15379 echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15380 $cat >try.c <<EOCP
15381#include <unistd.h>
15382#include <math.h>
15383int main (int argc, char *argv[])
15384{
15385 printf ("%d\n", _LIB_VERSION);
15386 return (0);
15387 } /* main */
15388EOCP
15389 set try
15390 if eval $compile; then
15391 foo=`$run ./try`
15392 echo "Yes, it does ($foo)" >&4
15393 d_libm_lib_version="$define"
15394 else
15395 echo "No, it does not (probably harmless)" >&4
15396 fi
15397 $rm_try
15398 ;;
15399
15400 esac
15401
15402: see if link exists
15403set link d_link
15404eval $inlibc
15405
15406: see if localtime_r exists
15407set localtime_r d_localtime_r
15408eval $inlibc
15409case "$d_localtime_r" in
15410"$define")
15411 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15412 case "$d_localtime_r_proto:$usethreads" in
15413 ":define") d_localtime_r_proto=define
15414 set d_localtime_r_proto localtime_r $hdrs
15415 eval $hasproto ;;
15416 *) ;;
15417 esac
15418 case "$d_localtime_r_proto" in
15419 define)
15420 case "$localtime_r_proto" in
15421 ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
15422 ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
15423 esac
15424 case "$localtime_r_proto" in
15425 ''|0) try='int localtime_r(const time_t*, struct tm*);'
15426 ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
15427 esac
15428 case "$localtime_r_proto" in
15429 ''|0) d_localtime_r=undef
15430 localtime_r_proto=0
15431 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
15432 * ) case "$localtime_r_proto" in
15433 REENTRANT_PROTO*) ;;
15434 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
15435 esac
15436 echo "Prototype: $try" ;;
15437 esac
15438 ;;
15439 *) case "$usethreads" in
15440 define) echo "localtime_r has no prototype, not using it." >&4 ;;
15441 esac
15442 d_localtime_r=undef
15443 localtime_r_proto=0
15444 ;;
15445 esac
15446 ;;
15447*) localtime_r_proto=0
15448 ;;
15449esac
15450
15451: see if localtime_r calls tzset
15452case "$localtime_r_proto" in
15453REENTRANT_PROTO*)
15454 $cat >try.c <<EOCP
15455/* Does our libc's localtime_r call tzset ?
15456 * return 0 if so, 1 otherwise.
15457 */
15458#$i_systypes I_SYS_TYPES
15459#$i_unistd I_UNISTD
15460#$i_time I_TIME
15461#$i_stdlib I_STDLIB
15462#$i_string I_STRING
15463#$i_malloc I_MALLOC
15464#ifdef I_SYS_TYPES
15465# include <sys/types.h>
15466#endif
15467#ifdef I_UNISTD
15468# include <unistd.h>
15469#endif
15470#ifdef I_TIME
15471# include <time.h>
15472#endif
15473#ifdef I_STDLIB
15474#include <stdlib.h>
15475#endif
15476#ifdef I_STRING
15477# include <string.h>
15478#else
15479# include <strings.h>
15480#endif
15481#ifdef I_MALLOC
15482# include <malloc.h>
15483#endif
15484int main()
15485{
15486 time_t t = time(0L);
15487 char w_tz[]="TZ" "=GMT+5",
15488 e_tz[]="TZ" "=GMT-5",
15489 *tz_e = (char*)malloc(16),
15490 *tz_w = (char*)malloc(16);
15491 struct tm tm_e, tm_w;
15492 memset(&tm_e,'\0',sizeof(struct tm));
15493 memset(&tm_w,'\0',sizeof(struct tm));
15494 strcpy(tz_e,e_tz);
15495 strcpy(tz_w,w_tz);
15496
15497 putenv(tz_e);
15498 localtime_r(&t, &tm_e);
15499
15500 putenv(tz_w);
15501 localtime_r(&t, &tm_w);
15502
15503 if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
15504 return 1;
15505 return 0;
15506}
15507EOCP
15508 set try
15509 if eval $compile; then
15510 if $run ./try; then
15511 d_localtime_r_needs_tzset=undef;
15512 else
15513 d_localtime_r_needs_tzset=define;
15514 fi;
15515 else
15516 d_localtime_r_needs_tzset=undef;
15517 fi;
15518 ;;
15519 *)
15520 d_localtime_r_needs_tzset=undef;
15521 ;;
15522esac
15523$rm_try
15524
15525: see if localeconv exists
15526set localeconv d_locconv
15527eval $inlibc
15528
15529: see if lockf exists
15530set lockf d_lockf
15531eval $inlibc
15532
15533: see if prototype for lseek is available
15534echo " "
15535set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
15536eval $hasproto
15537
15538: see if lstat exists
15539set lstat d_lstat
15540eval $inlibc
15541
15542: see if madvise exists
15543set madvise d_madvise
15544eval $inlibc
15545
15546: see if malloc_size exists
15547set malloc_size d_malloc_size
15548eval $inlibc
15549
15550: see if malloc_size_good exists
15551set malloc_good_size d_malloc_good_size
15552eval $inlibc
15553
15554: see if mblen exists
15555set mblen d_mblen
15556eval $inlibc
15557
15558: see if mbstowcs exists
15559set mbstowcs d_mbstowcs
15560eval $inlibc
15561
15562: see if mbtowc exists
15563set mbtowc d_mbtowc
15564eval $inlibc
15565
15566: see if memchr exists
15567set memchr d_memchr
15568eval $inlibc
15569
15570: see if memcmp exists
15571set memcmp d_memcmp
15572eval $inlibc
15573
15574: see if memcpy exists
15575set memcpy d_memcpy
15576eval $inlibc
15577
15578: see if memmove exists
15579set memmove d_memmove
15580eval $inlibc
15581
15582: see if memset exists
15583set memset d_memset
15584eval $inlibc
15585
15586: see if mkdir exists
15587set mkdir d_mkdir
15588eval $inlibc
15589
15590: see if mkdtemp exists
15591set mkdtemp d_mkdtemp
15592eval $inlibc
15593
15594: see if mkfifo exists
15595set mkfifo d_mkfifo
15596eval $inlibc
15597
15598: see if mkstemp exists
15599set mkstemp d_mkstemp
15600eval $inlibc
15601
15602: see if mkstemps exists
15603set mkstemps d_mkstemps
15604eval $inlibc
15605
15606: see if mktime exists
15607set mktime d_mktime
15608eval $inlibc
15609
15610: see if this is a sys/mman.h system
15611set sys/mman.h i_sysmman
15612eval $inhdr
15613
15614: see if mmap exists
15615set mmap d_mmap
15616eval $inlibc
15617: see what shmat returns
15618: default to something harmless
15619mmaptype='void *'
15620case "$i_sysmman$d_mmap" in
15621"$define$define")
15622 $cat >mmap.c <<'END'
15623#include <sys/mman.h>
15624void *mmap();
15625END
15626 if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15627 mmaptype='void *'
15628 else
15629 mmaptype='caddr_t'
15630 fi
15631 echo "and it returns ($mmaptype)." >&4
15632 ;;
15633esac
15634
15635
15636
15637: see if sqrtl exists
15638set sqrtl d_sqrtl
15639eval $inlibc
15640
15641: see if scalbnl exists
15642set scalbnl d_scalbnl
15643eval $inlibc
15644
15645: see if modfl exists
15646set modfl d_modfl
15647eval $inlibc
15648
15649: see if prototype for modfl is available
15650echo " "
15651set d_modflproto modfl $i_math math.h
15652eval $hasproto
15653
15654d_modfl_pow32_bug="$undef"
15655
15656case "$d_longdbl$d_modfl" in
15657$define$define)
15658 $cat <<EOM
15659Checking to see whether your modfl() is okay for large values...
15660EOM
15661$cat >try.c <<EOCP
15662#include <math.h>
15663#include <stdio.h>
15664EOCP
15665if $test "X$d_modflproto" != "X$define"; then
15666 $cat >>try.c <<EOCP
15667/* Sigh. many current glibcs provide the function, but do not prototype it. */
15668long double modfl (long double, long double *);
15669EOCP
15670fi
15671$cat >>try.c <<EOCP
15672int main() {
15673 long double nv = 4294967303.15;
15674 long double v, w;
15675 v = modfl(nv, &w);
15676#ifdef __GLIBC__
15677 printf("glibc");
15678#endif
15679 printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15680 return 0;
15681}
15682EOCP
15683 case "$osname:$gccversion" in
15684 aix:) saveccflags="$ccflags"
15685 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15686 esac
15687 set try
15688 if eval $compile; then
15689 foo=`$run ./try`
15690 case "$foo" in
15691 *" 4294967303.150000 1.150000 4294967302.000000")
15692 echo >&4 "Your modfl() is broken for large values."
15693 d_modfl_pow32_bug="$define"
15694 case "$foo" in
15695 glibc) echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15696 ;;
15697 esac
15698 ;;
15699 *" 4294967303.150000 0.150000 4294967303.000000")
15700 echo >&4 "Your modfl() seems okay for large values."
15701 ;;
15702 *) echo >&4 "I don't understand your modfl() at all."
15703 d_modfl="$undef"
15704 ;;
15705 esac
15706 $rm_try
15707 else
15708 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15709 d_modfl="$undef"
15710 fi
15711 case "$osname:$gccversion" in
15712 aix:) ccflags="$saveccflags" ;; # restore
15713 esac
15714 ;;
15715esac
15716
15717if $test "$uselongdouble" = "$define"; then
15718 message=""
15719 if $test "$d_sqrtl" != "$define"; then
15720 message="$message sqrtl"
15721 fi
15722 if $test "$d_modfl" != "$define"; then
15723 if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15724 echo "You have both aintl and copysignl, so I can emulate modfl."
15725 else
15726 message="$message modfl"
15727 fi
15728 fi
15729 if $test "$d_frexpl" != "$define"; then
15730 if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15731 echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15732 else
15733 message="$message frexpl"
15734 fi
15735 fi
15736
15737 if $test "$message" != ""; then
15738 $cat <<EOM >&4
15739
15740*** You requested the use of long doubles but you do not seem to have
15741*** the following mathematical functions needed for long double support:
15742*** $message
15743*** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15744*** Cannot continue, aborting.
15745
15746EOM
15747
15748 exit 1
15749 fi
15750fi
15751
15752: see if mprotect exists
15753set mprotect d_mprotect
15754eval $inlibc
15755
15756: see if msgctl exists
15757set msgctl d_msgctl
15758eval $inlibc
15759
15760: see if msgget exists
15761set msgget d_msgget
15762eval $inlibc
15763
15764: see if msgsnd exists
15765set msgsnd d_msgsnd
15766eval $inlibc
15767
15768: see if msgrcv exists
15769set msgrcv d_msgrcv
15770eval $inlibc
15771
15772: see how much of the 'msg*(2)' library is present.
15773h_msg=true
15774echo " "
15775case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15776*"$undef"*) h_msg=false;;
15777esac
15778case "$osname" in
15779freebsd)
15780 case "`ipcs 2>&1`" in
15781 "SVID messages"*"not configured"*)
15782 echo "Your $osname does not have the msg*(2) configured." >&4
15783 h_msg=false
15784 val="$undef"
15785 set msgctl d_msgctl
15786 eval $setvar
15787 set msgget d_msgget
15788 eval $setvar
15789 set msgsnd d_msgsnd
15790 eval $setvar
15791 set msgrcv d_msgrcv
15792 eval $setvar
15793 ;;
15794 esac
15795 ;;
15796esac
15797: we could also check for sys/ipc.h ...
15798if $h_msg && $test `./findhdr sys/msg.h`; then
15799 echo "You have the full msg*(2) library." >&4
15800 val="$define"
15801else
15802 echo "You don't have the full msg*(2) library." >&4
15803 val="$undef"
15804fi
15805set d_msg
15806eval $setvar
15807
15808: Check for msghdr_s
15809echo " "
15810echo "Checking to see if your system supports struct msghdr..." >&4
15811set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15812eval $hasstruct
15813case "$d_msghdr_s" in
15814"$define") echo "Yes, it does." ;;
15815*) echo "No, it doesn't." ;;
15816esac
15817
15818
15819: see if msync exists
15820set msync d_msync
15821eval $inlibc
15822
15823: see if munmap exists
15824set munmap d_munmap
15825eval $inlibc
15826
15827: see if nice exists
15828set nice d_nice
15829eval $inlibc
15830
15831: see if this is a langinfo.h system
15832set langinfo.h i_langinfo
15833eval $inhdr
15834
15835: see if nl_langinfo exists
15836set nl_langinfo d_nl_langinfo
15837eval $inlibc
15838
15839: check for volatile keyword
15840echo " "
15841echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15842$cat >try.c <<'EOCP'
15843int main()
15844{
15845 typedef struct _goo_struct goo_struct;
15846 goo_struct * volatile goo = ((goo_struct *)0);
15847 struct _goo_struct {
15848 long long_int;
15849 int reg_int;
15850 char char_var;
15851 };
15852 typedef unsigned short foo_t;
15853 char *volatile foo;
15854 volatile int bar;
15855 volatile foo_t blech;
15856 foo = foo;
15857}
15858EOCP
15859if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15860 val="$define"
15861 echo "Yup, it does."
15862else
15863 val="$undef"
15864 echo "Nope, it doesn't."
15865fi
15866set d_volatile
15867eval $setvar
15868$rm_try
15869
15870: Check basic sizes
15871echo " "
15872$echo "Choosing the C types to be used for Perl's internal types..." >&4
15873
15874case "$use64bitint:$d_quad:$quadtype" in
15875define:define:?*)
15876 ivtype="$quadtype"
15877 uvtype="$uquadtype"
15878 ivsize=8
15879 uvsize=8
15880 ;;
15881*) ivtype="long"
15882 uvtype="unsigned long"
15883 ivsize=$longsize
15884 uvsize=$longsize
15885 ;;
15886esac
15887
15888case "$uselongdouble:$d_longdbl" in
15889define:define)
15890 nvtype="long double"
15891 nvsize=$longdblsize
15892 ;;
15893*) nvtype=double
15894 nvsize=$doublesize
15895 ;;
15896esac
15897
15898$echo "(IV will be "$ivtype", $ivsize bytes)"
15899$echo "(UV will be "$uvtype", $uvsize bytes)"
15900$echo "(NV will be "$nvtype", $nvsize bytes)"
15901
15902$cat >try.c <<EOCP
15903#$i_inttypes I_INTTYPES
15904#ifdef I_INTTYPES
15905#include <inttypes.h>
15906#endif
15907#include <stdio.h>
15908int main() {
15909#ifdef INT8
15910 int8_t i = INT8_MAX;
15911 uint8_t u = UINT8_MAX;
15912 printf("int8_t\n");
15913#endif
15914#ifdef INT16
15915 int16_t i = INT16_MAX;
15916 uint16_t u = UINT16_MAX;
15917 printf("int16_t\n");
15918#endif
15919#ifdef INT32
15920 int32_t i = INT32_MAX;
15921 uint32_t u = UINT32_MAX;
15922 printf("int32_t\n");
15923#endif
15924}
15925EOCP
15926
15927i8type="signed char"
15928u8type="unsigned char"
15929i8size=1
15930u8size=1
15931
15932case "$i16type" in
15933'') case "$shortsize" in
15934 2) i16type=short
15935 u16type="unsigned short"
15936 i16size=$shortsize
15937 u16size=$shortsize
15938 ;;
15939 esac
15940 ;;
15941esac
15942case "$i16type" in
15943'') set try -DINT16
15944 if eval $compile; then
15945 case "`$run ./try`" in
15946 int16_t)
15947 i16type=int16_t
15948 u16type=uint16_t
15949 i16size=2
15950 u16size=2
15951 ;;
15952 esac
15953 fi
15954 ;;
15955esac
15956case "$i16type" in
15957'') if $test $shortsize -ge 2; then
15958 i16type=short
15959 u16type="unsigned short"
15960 i16size=$shortsize
15961 u16size=$shortsize
15962 fi
15963 ;;
15964esac
15965
15966case "$i32type" in
15967'') case "$longsize" in
15968 4) i32type=long
15969 u32type="unsigned long"
15970 i32size=$longsize
15971 u32size=$longsize
15972 ;;
15973 *) case "$intsize" in
15974 4) i32type=int
15975 u32type="unsigned int"
15976 i32size=$intsize
15977 u32size=$intsize
15978 ;;
15979 esac
15980 ;;
15981 esac
15982 ;;
15983esac
15984case "$i32type" in
15985'') set try -DINT32
15986 if eval $compile; then
15987 case "`$run ./try`" in
15988 int32_t)
15989 i32type=int32_t
15990 u32type=uint32_t
15991 i32size=4
15992 u32size=4
15993 ;;
15994 esac
15995 fi
15996 ;;
15997esac
15998case "$i32type" in
15999'') if $test $intsize -ge 4; then
16000 i32type=int
16001 u32type="unsigned int"
16002 i32size=$intsize
16003 u32size=$intsize
16004 fi
16005 ;;
16006esac
16007
16008case "$i64type" in
16009'') case "$d_quad:$quadtype" in
16010 define:?*)
16011 i64type="$quadtype"
16012 u64type="$uquadtype"
16013 i64size=8
16014 u64size=8
16015 ;;
16016 esac
16017 ;;
16018esac
16019
16020$echo "Checking how many bits of your UVs your NVs can preserve..." >&4
16021: volatile so that the compiler has to store it out to memory.
16022if test X"$d_volatile" = X"$define"; then
16023 volatile=volatile
16024fi
16025$cat <<EOP >try.c
16026#include <stdio.h>
16027#$i_stdlib I_STDLIB
16028#ifdef I_STDLIB
16029#include <stdlib.h>
16030#endif
16031#include <sys/types.h>
16032#include <signal.h>
16033#ifdef SIGFPE
16034$volatile int bletched = 0;
16035$signal_t blech(int s) { bletched = 1; }
16036#endif
16037int main() {
16038 $uvtype u = 0;
16039 $nvtype d;
16040 int n = 8 * $uvsize;
16041 int i;
16042#ifdef SIGFPE
16043 signal(SIGFPE, blech);
16044#endif
16045
16046 for (i = 0; i < n; i++) {
16047 u = u << 1 | ($uvtype)1;
16048 d = ($nvtype)u;
16049 if (($uvtype)d != u)
16050 break;
16051 if (d <= 0)
16052 break;
16053 d = ($nvtype)(u - 1);
16054 if (($uvtype)d != (u - 1))
16055 break;
16056#ifdef SIGFPE
16057 if (bletched)
16058 break;
16059#endif
16060 }
16061 printf("%d\n", ((i == n) ? -n : i));
16062 exit(0);
16063}
16064EOP
16065set try
16066
16067d_nv_preserves_uv="$undef"
16068if eval $compile; then
16069 nv_preserves_uv_bits="`$run ./try`"
16070fi
16071case "$nv_preserves_uv_bits" in
16072\-[1-9]*)
16073 nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
16074 $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs." 2>&1
16075 d_nv_preserves_uv="$define"
16076 ;;
16077[1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs." 2>&1
16078 d_nv_preserves_uv="$undef" ;;
16079*) $echo "Can't figure out how many bits your NVs preserve." 2>&1
16080 nv_preserves_uv_bits="0" ;;
16081esac
16082$rm_try
16083
16084$echo "Checking to find the largest integer value your NVs can hold..." >&4
16085: volatile so that the compiler has to store it out to memory.
16086if test X"$d_volatile" = X"$define"; then
16087 volatile=volatile
16088fi
16089$cat <<EOP >try.c
16090#include <stdio.h>
16091
16092typedef $nvtype NV;
16093
16094int
16095main() {
16096 NV value = 2;
16097 int count = 1;
16098
16099 while(count < 256) {
16100 $volatile NV up = value + 1.0;
16101 $volatile NV negated = -value;
16102 $volatile NV down = negated - 1.0;
16103 $volatile NV got_up = up - value;
16104 int up_good = got_up == 1.0;
16105 int got_down = down - negated;
16106 int down_good = got_down == -1.0;
16107
16108 if (down_good != up_good) {
16109 fprintf(stderr,
16110 "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
16111 up_good, (double) got_up, down_good, (double) got_down,
16112 count, (double) value);
16113 return 1;
16114 }
16115 if (!up_good) {
16116 while (1) {
16117 if (count > 8) {
16118 count -= 8;
16119 fputs("256.0", stdout);
16120 } else {
16121 count--;
16122 fputs("2.0", stdout);
16123 }
16124 if (!count) {
16125 puts("");
16126 return 0;
16127 }
16128 fputs("*", stdout);
16129 }
16130 }
16131 value *= 2;
16132 ++count;
16133 }
16134 fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
16135 count, (double) value);
16136 return 1;
16137}
16138EOP
16139set try
16140
16141nv_overflows_integers_at='0'
16142if eval $compile; then
16143 xxx="`$run ./try`"
16144 case "$?" in
16145 0)
16146 case "$xxx" in
16147 2*) cat >&4 <<EOM
16148The largest integer your NVs can preserve is equal to $xxx
16149EOM
16150 nv_overflows_integers_at="$xxx"
16151 ;;
16152 *) cat >&4 <<EOM
16153Cannot determine the largest integer value your NVs can hold, unexpected output
16154'$xxx'
16155EOM
16156 ;;
16157 esac
16158 ;;
16159 *) cat >&4 <<EOM
16160Cannot determine the largest integer value your NVs can hold
16161EOM
16162 ;;
16163 esac
16164fi
16165$rm_try
16166
16167$echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
16168: volatile so that the compiler has to store it out to memory.
16169if test X"$d_volatile" = X"$define"; then
16170 volatile=volatile
16171fi
16172$cat <<EOP >try.c
16173#include <stdio.h>
16174#$i_stdlib I_STDLIB
16175#ifdef I_STDLIB
16176#include <stdlib.h>
16177#endif
16178#$i_string I_STRING
16179#ifdef I_STRING
16180# include <string.h>
16181#else
16182# include <strings.h>
16183#endif
16184#include <sys/types.h>
16185#include <signal.h>
16186#ifdef SIGFPE
16187$volatile int bletched = 0;
16188$signal_t blech(int s) { bletched = 1; }
16189#endif
16190
16191int checkit($nvtype d, char *where) {
16192 unsigned char *p = (char *)&d;
16193 unsigned char *end = p + sizeof(d);
16194 int fail = 0;
16195
16196 while (p < end)
16197 fail += *p++;
16198
16199 if (!fail)
16200 return 0;
16201
16202 p = (char *)&d;
16203 printf("No - %s: 0x", where);
16204 while (p < end)
16205 printf ("%02X", *p++);
16206 printf("\n");
16207 return 1;
16208}
16209
16210int main(int argc, char **argv) {
16211 $nvtype d = 0.0;
16212 int fail = 0;
16213 fail += checkit(d, "0.0");
16214
16215 /* The compiler shouldn't be assuming that bletched is 0 */
16216 d = bletched;
16217
16218 fail += checkit(d, "bleched");
16219
16220#ifdef SIGFPE
16221 signal(SIGFPE, blech);
16222#endif
16223
16224 /* Paranoia - the compiler should have no way of knowing that ANSI says
16225 that argv[argc] will always be NULL. Actually, if it did assume this it
16226 would be buggy, as this is C and main() can be called from elsewhere in
16227 the program. */
16228 d = argv[argc] ? 1 : 0;
16229
16230 if (d) {
16231 printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
16232 }
16233
16234 fail += checkit(d, "ternary");
16235
16236 memset(&d, sizeof(d), argv[argc] ? 1 : 0);
16237
16238 if (d != 0.0) {
16239 printf("No - memset doesn't give 0.0\n");
16240 /* This might just blow up: */
16241 printf("(gives %g)\n", d);
16242 return 1;
16243 }
16244
16245#ifdef SIGFPE
16246 if (bletched) {
16247 printf("No - something bleched\n");
16248 return 1;
16249 }
16250#endif
16251 if (fail) {
16252 printf("No - %d fail(s)\n", fail);
16253 return 1;
16254 }
16255 printf("Yes\n");
16256 return 0;
16257}
16258EOP
16259set try
16260
16261d_nv_zero_is_allbits_zero="$undef"
16262if eval $compile; then
16263 xxx="`$run ./try`"
16264 case "$?" in
16265 0)
16266 case "$xxx" in
16267 Yes) cat >&4 <<EOM
162680.0 is represented as all bits zero in memory
16269EOM
16270 d_nv_zero_is_allbits_zero="$define"
16271 ;;
16272 *) cat >&4 <<EOM
162730.0 is not represented as all bits zero in memory
16274EOM
16275 d_nv_zero_is_allbits_zero="$undef"
16276 ;;
16277 esac
16278 ;;
16279 *) cat >&4 <<EOM
162800.0 is not represented as all bits zero in memory
16281EOM
16282 d_nv_zero_is_allbits_zero="$undef"
16283 ;;
16284 esac
16285fi
16286$rm_try
16287
16288: check for off64_t
16289echo " "
16290echo "Checking to see if you have off64_t..." >&4
16291$cat >try.c <<EOCP
16292#include <sys/types.h>
16293#include <unistd.h>
16294int main() { off64_t x = 7; }
16295EOCP
16296set try
16297if eval $compile; then
16298 val="$define"
16299 echo "You have off64_t."
16300else
16301 val="$undef"
16302 echo "You do not have off64_t."
16303 case "$lseeksize" in
16304 8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
16305 esac
16306fi
16307$rm_try
16308set d_off64_t
16309eval $setvar
16310
16311: how to create joinable pthreads
16312if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
16313 echo " "
16314 echo "Checking what constant to use for creating joinable pthreads..." >&4
16315 $cat >try.c <<'EOCP'
16316#include <pthread.h>
16317int main() {
16318 int detachstate = JOINABLE;
16319}
16320EOCP
16321 set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
16322 if eval $compile; then
16323 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
16324 val="$undef" # Yes, undef.
16325 set d_old_pthread_create_joinable
16326 eval $setvar
16327 val=""
16328 set old_pthread_create_joinable
16329 eval $setvar
16330 else
16331 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
16332 if eval $compile; then
16333 echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
16334 val="$define"
16335 set d_old_pthread_create_joinable
16336 eval $setvar
16337 val=PTHREAD_CREATE_UNDETACHED
16338 set old_pthread_create_joinable
16339 eval $setvar
16340 else
16341 set try -DJOINABLE=__UNDETACHED
16342 if eval $compile; then
16343 echo "You seem to use __UNDETACHED." >&4
16344 val="$define"
16345 set d_old_pthread_create_joinable
16346 eval $setvar
16347 val=__UNDETACHED
16348 set old_pthread_create_joinable
16349 eval $setvar
16350 else
16351 echo "Egads, nothing obvious found. Guessing that you use 0." >&4
16352 val="$define"
16353 set d_old_pthread_create_joinable
16354 eval $setvar
16355 val=0
16356 set old_pthread_create_joinable
16357 eval $setvar
16358 fi
16359 fi
16360 fi
16361 $rm_try
16362else
16363 d_old_pthread_create_joinable="$undef"
16364 old_pthread_create_joinable=""
16365fi
16366
16367: see if pause exists
16368set pause d_pause
16369eval $inlibc
16370
16371: see if poll exists
16372set poll d_poll
16373eval $inlibc
16374
16375: see if prctl exists
16376set prctl d_prctl
16377eval $inlibc
16378
16379: see if prctl supports PR_SET_NAME
16380d_prctl_set_name=$undef
16381case $d_prctl in
16382 $define)
16383 $cat >try.c <<EOM
16384#include <sys/prctl.h>
16385
16386int main (int argc, char *argv[])
16387{
16388 return (prctl (PR_SET_NAME, "Test"));
16389 } /* main */
16390EOM
16391 set try
16392 if eval $compile_ok && $run ./try; then
16393 echo "Your prctl (PR_SET_NAME, ...) works"
16394 d_prctl_set_name=$define
16395 fi
16396 $rm_try
16397 ;;
16398 esac
16399
16400: see if readlink exists
16401set readlink d_readlink
16402eval $inlibc
16403
16404: Check if exe is symlink to abs path of executing program
16405echo " "
16406procselfexe=''
16407val="$undef"
16408case "$d_readlink" in
16409 "$define")
16410 : NetBSD first as /proc/self is a symlink to /proc/curproc, and it feels
16411 : more tidy to avoid an extra level of symlink
16412 set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
16413 while test $# -gt 0; do
16414 type=$1; try=$2
16415 shift; shift
16416 if $issymlink $try; then
16417 $ls -l $try > reflect
16418 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16419 echo "You have $type-like $try."
16420 procselfexe='"'$try'"'
16421 val="$define"
16422 : This will break out of the loop
16423 set X; shift
16424 fi
16425 fi
16426 done
16427 ;;
16428esac
16429$rm -f reflect
16430set d_procselfexe
16431eval $setvar
16432
16433: backward compatibility for d_hvfork
16434if test X$d_hvfork != X; then
16435 d_vfork="$d_hvfork"
16436 d_hvfork=''
16437fi
16438: see if there is a vfork
16439val=''
16440set vfork val
16441eval $inlibc
16442
16443d_pseudofork=$undef
16444
16445: Ok, but do we want to use it. vfork is reportedly unreliable in
16446: perl on Solaris 2.x, and probably elsewhere.
16447case "$val" in
16448$define)
16449 echo " "
16450 case "$usevfork" in
16451 false) dflt='n';;
16452 *) dflt='y';;
16453 esac
16454 cat <<'EOM'
16455
16456Perl can only use a vfork() that doesn't suffer from strict
16457restrictions on calling functions or modifying global data in
16458the child. For example, glibc-2.1 contains such a vfork()
16459that is unsuitable. If your system provides a proper fork()
16460call, chances are that you do NOT want perl to use vfork().
16461
16462EOM
16463 rp="Do you still want to use vfork()?"
16464 . ./myread
16465 case "$ans" in
16466 y|Y) ;;
16467 *)
16468 echo "Ok, we won't use vfork()."
16469 val="$undef"
16470 ;;
16471 esac
16472 ;;
16473esac
16474set d_vfork
16475eval $setvar
16476case "$d_vfork" in
16477$define) usevfork='true';;
16478*) usevfork='false';;
16479esac
16480
16481: see whether the pthread_atfork exists
16482$cat >try.c <<EOP
16483#include <pthread.h>
16484#include <stdio.h>
16485int main() {
16486#ifdef PTHREAD_ATFORK
16487 pthread_atfork(NULL,NULL,NULL);
16488#endif
16489}
16490EOP
16491
16492: see if pthread_atfork exists
16493set try -DPTHREAD_ATFORK
16494if eval $compile; then
16495 val="$define"
16496else
16497 val="$undef"
16498fi
16499case "$usethreads" in
16500$define)
16501 case "$val" in
16502 $define) echo 'pthread_atfork found.' >&4 ;;
16503 *) echo 'pthread_atfork NOT found.' >&4 ;;
16504 esac
16505esac
16506set d_pthread_atfork
16507eval $setvar
16508
16509: see if pthread_attr_setscope exists
16510set pthread_attr_setscope d_pthread_attr_setscope
16511eval $inlibc
16512
16513: see whether the various POSIXish _yields exist
16514$cat >try.c <<EOP
16515#include <pthread.h>
16516#include <stdio.h>
16517int main() {
16518#ifdef SCHED_YIELD
16519 sched_yield();
16520#else
16521#ifdef PTHREAD_YIELD
16522 pthread_yield();
16523#else
16524#ifdef PTHREAD_YIELD_NULL
16525 pthread_yield(NULL);
16526#endif
16527#endif
16528#endif
16529}
16530EOP
16531: see if sched_yield exists
16532set try -DSCHED_YIELD
16533if eval $compile; then
16534 val="$define"
16535 sched_yield='sched_yield()'
16536else
16537 val="$undef"
16538fi
16539case "$usethreads" in
16540$define)
16541 case "$val" in
16542 $define) echo 'sched_yield() found.' >&4 ;;
16543 *) echo 'sched_yield() NOT found.' >&4 ;;
16544 esac
16545esac
16546set d_sched_yield
16547eval $setvar
16548
16549: see if pthread_yield exists
16550set try -DPTHREAD_YIELD
16551if eval $compile; then
16552 val="$define"
16553 case "$sched_yield" in
16554 '') sched_yield='pthread_yield()' ;;
16555 esac
16556else
16557 set try -DPTHREAD_YIELD_NULL
16558 if eval $compile; then
16559 val="$define"
16560 case "$sched_yield" in
16561 '') sched_yield='pthread_yield(NULL)' ;;
16562 esac
16563 else
16564 val="$undef"
16565 fi
16566fi
16567case "$usethreads" in
16568$define)
16569 case "$val" in
16570 $define) echo 'pthread_yield() found.' >&4 ;;
16571 *) echo 'pthread_yield() NOT found.' >&4 ;;
16572 esac
16573 ;;
16574esac
16575set d_pthread_yield
16576eval $setvar
16577case "$sched_yield" in
16578'') sched_yield=undef ;;
16579esac
16580$rm_try
16581
16582: see if random_r exists
16583set random_r d_random_r
16584eval $inlibc
16585case "$d_random_r" in
16586"$define")
16587 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16588 case "$d_random_r_proto:$usethreads" in
16589 ":define") d_random_r_proto=define
16590 set d_random_r_proto random_r $hdrs
16591 eval $hasproto ;;
16592 *) ;;
16593 esac
16594 case "$d_random_r_proto" in
16595 define)
16596 case "$random_r_proto" in
16597 ''|0) try='int random_r(int*, struct random_data*);'
16598 ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
16599 esac
16600 case "$random_r_proto" in
16601 ''|0) try='int random_r(long*, struct random_data*);'
16602 ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
16603 esac
16604 case "$random_r_proto" in
16605 ''|0) try='int random_r(struct random_data*, int32_t*);'
16606 ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
16607 esac
16608 case "$random_r_proto" in
16609 ''|0) d_random_r=undef
16610 random_r_proto=0
16611 echo "Disabling random_r, cannot determine prototype." >&4 ;;
16612 * ) case "$random_r_proto" in
16613 REENTRANT_PROTO*) ;;
16614 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16615 esac
16616 echo "Prototype: $try" ;;
16617 esac
16618 ;;
16619 *) case "$usethreads" in
16620 define) echo "random_r has no prototype, not using it." >&4 ;;
16621 esac
16622 d_random_r=undef
16623 random_r_proto=0
16624 ;;
16625 esac
16626 ;;
16627*) random_r_proto=0
16628 ;;
16629esac
16630
16631: see if readdir and friends exist
16632set readdir d_readdir
16633eval $inlibc
16634set seekdir d_seekdir
16635eval $inlibc
16636set telldir d_telldir
16637eval $inlibc
16638set rewinddir d_rewinddir
16639eval $inlibc
16640
16641: see if readdir64_r exists
16642set readdir64_r d_readdir64_r
16643eval $inlibc
16644case "$d_readdir64_r" in
16645"$define")
16646 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16647 case "$d_readdir64_r_proto:$usethreads" in
16648 ":define") d_readdir64_r_proto=define
16649 set d_readdir64_r_proto readdir64_r $hdrs
16650 eval $hasproto ;;
16651 *) ;;
16652 esac
16653 case "$d_readdir64_r_proto" in
16654 define)
16655 case "$readdir64_r_proto" in
16656 ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
16657 ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
16658 esac
16659 case "$readdir64_r_proto" in
16660 ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
16661 ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
16662 esac
16663 case "$readdir64_r_proto" in
16664 ''|0) d_readdir64_r=undef
16665 readdir64_r_proto=0
16666 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
16667 * ) case "$readdir64_r_proto" in
16668 REENTRANT_PROTO*) ;;
16669 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16670 esac
16671 echo "Prototype: $try" ;;
16672 esac
16673 ;;
16674 *) case "$usethreads" in
16675 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16676 esac
16677 d_readdir64_r=undef
16678 readdir64_r_proto=0
16679 ;;
16680 esac
16681 ;;
16682*) readdir64_r_proto=0
16683 ;;
16684esac
16685
16686: see if readdir_r exists
16687set readdir_r d_readdir_r
16688eval $inlibc
16689case "$d_readdir_r" in
16690"$define")
16691 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16692 case "$d_readdir_r_proto:$usethreads" in
16693 ":define") d_readdir_r_proto=define
16694 set d_readdir_r_proto readdir_r $hdrs
16695 eval $hasproto ;;
16696 *) ;;
16697 esac
16698 case "$d_readdir_r_proto" in
16699 define)
16700 case "$readdir_r_proto" in
16701 ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
16702 ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
16703 esac
16704 case "$readdir_r_proto" in
16705 ''|0) try='int readdir_r(DIR*, struct dirent*);'
16706 ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
16707 esac
16708 case "$readdir_r_proto" in
16709 ''|0) d_readdir_r=undef
16710 readdir_r_proto=0
16711 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
16712 * ) case "$readdir_r_proto" in
16713 REENTRANT_PROTO*) ;;
16714 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16715 esac
16716 echo "Prototype: $try" ;;
16717 esac
16718 ;;
16719 *) case "$usethreads" in
16720 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16721 esac
16722 d_readdir_r=undef
16723 readdir_r_proto=0
16724 ;;
16725 esac
16726 ;;
16727*) readdir_r_proto=0
16728 ;;
16729esac
16730
16731: see if readv exists
16732set readv d_readv
16733eval $inlibc
16734
16735: see if recvmsg exists
16736set recvmsg d_recvmsg
16737eval $inlibc
16738
16739: see if rename exists
16740set rename d_rename
16741eval $inlibc
16742
16743: see if rmdir exists
16744set rmdir d_rmdir
16745eval $inlibc
16746
16747: see if memory.h is available.
16748val=''
16749set memory.h val
16750eval $inhdr
16751
16752: See if it conflicts with string.h
16753case "$val" in
16754$define)
16755 case "$strings" in
16756 '') ;;
16757 *)
16758 $cppstdin $cppflags $cppminus < $strings > mem.h
16759 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16760 echo " "
16761 echo "We won't be including <memory.h>."
16762 val="$undef"
16763 fi
16764 $rm -f mem.h
16765 ;;
16766 esac
16767esac
16768set i_memory
16769eval $setvar
16770
16771: can bcopy handle overlapping blocks?
16772echo " "
16773val="$undef"
16774case "$d_memmove" in
16775"$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16776*) case "$d_bcopy" in
16777 "$define")
16778 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16779 $cat >try.c <<EOCP
16780#$i_memory I_MEMORY
16781#$i_stdlib I_STDLIB
16782#$i_string I_STRING
16783#$i_unistd I_UNISTD
16784EOCP
16785 $cat >>try.c <<'EOCP'
16786#include <stdio.h>
16787#ifdef I_MEMORY
16788# include <memory.h>
16789#endif
16790#ifdef I_STDLIB
16791# include <stdlib.h>
16792#endif
16793#ifdef I_STRING
16794# include <string.h>
16795#else
16796# include <strings.h>
16797#endif
16798#ifdef I_UNISTD
16799# include <unistd.h> /* Needed for NetBSD */
16800#endif
16801int main()
16802{
16803char buf[128], abc[128];
16804char *b;
16805int len;
16806int off;
16807int align;
16808
16809/* Copy "abcde..." string to char abc[] so that gcc doesn't
16810 try to store the string in read-only memory. */
16811bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16812
16813for (align = 7; align >= 0; align--) {
16814 for (len = 36; len; len--) {
16815 b = buf+align;
16816 bcopy(abc, b, len);
16817 for (off = 1; off <= len; off++) {
16818 bcopy(b, b+off, len);
16819 bcopy(b+off, b, len);
16820 if (bcmp(b, abc, len))
16821 exit(1);
16822 }
16823 }
16824}
16825exit(0);
16826}
16827EOCP
16828 set try
16829 if eval $compile_ok; then
16830 if $run ./try 2>/dev/null; then
16831 echo "Yes, it can."
16832 val="$define"
16833 else
16834 echo "It can't, sorry."
16835 fi
16836 else
16837 echo "(I can't compile the test program, so we'll assume not...)"
16838 fi
16839 ;;
16840 esac
16841 $rm_try
16842 ;;
16843esac
16844set d_safebcpy
16845eval $setvar
16846
16847: can memcpy handle overlapping blocks?
16848echo " "
16849val="$undef"
16850case "$d_memmove" in
16851"$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16852*) case "$d_memcpy" in
16853 "$define")
16854 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16855 $cat >try.c <<EOCP
16856#$i_memory I_MEMORY
16857#$i_stdlib I_STDLIB
16858#$i_string I_STRING
16859#$i_unistd I_UNISTD
16860EOCP
16861 $cat >>try.c <<'EOCP'
16862#include <stdio.h>
16863#ifdef I_MEMORY
16864# include <memory.h>
16865#endif
16866#ifdef I_STDLIB
16867# include <stdlib.h>
16868#endif
16869#ifdef I_STRING
16870# include <string.h>
16871#else
16872# include <strings.h>
16873#endif
16874#ifdef I_UNISTD
16875# include <unistd.h> /* Needed for NetBSD */
16876#endif
16877int main()
16878{
16879char buf[128], abc[128];
16880char *b;
16881int len;
16882int off;
16883int align;
16884
16885/* Copy "abcde..." string to char abc[] so that gcc doesn't
16886 try to store the string in read-only memory. */
16887memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16888
16889for (align = 7; align >= 0; align--) {
16890 for (len = 36; len; len--) {
16891 b = buf+align;
16892 memcpy(b, abc, len);
16893 for (off = 1; off <= len; off++) {
16894 memcpy(b+off, b, len);
16895 memcpy(b, b+off, len);
16896 if (memcmp(b, abc, len))
16897 exit(1);
16898 }
16899 }
16900}
16901exit(0);
16902}
16903EOCP
16904 set try
16905 if eval $compile_ok; then
16906 if $run ./try 2>/dev/null; then
16907 echo "Yes, it can."
16908 val="$define"
16909 else
16910 echo "It can't, sorry."
16911 fi
16912 else
16913 echo "(I can't compile the test program, so we'll assume not...)"
16914 fi
16915 ;;
16916 esac
16917 $rm_try
16918 ;;
16919esac
16920set d_safemcpy
16921eval $setvar
16922
16923: can memcmp be trusted to compare relative magnitude?
16924val="$undef"
16925case "$d_memcmp" in
16926"$define")
16927 echo " "
16928 echo "Checking if your memcmp() can compare relative magnitude..." >&4
16929 $cat >try.c <<EOCP
16930#$i_memory I_MEMORY
16931#$i_stdlib I_STDLIB
16932#$i_string I_STRING
16933#$i_unistd I_UNISTD
16934EOCP
16935 $cat >>try.c <<'EOCP'
16936#include <stdio.h>
16937#ifdef I_MEMORY
16938# include <memory.h>
16939#endif
16940#ifdef I_STDLIB
16941# include <stdlib.h>
16942#endif
16943#ifdef I_STRING
16944# include <string.h>
16945#else
16946# include <strings.h>
16947#endif
16948#ifdef I_UNISTD
16949# include <unistd.h> /* Needed for NetBSD */
16950#endif
16951int main()
16952{
16953char a = -1;
16954char b = 0;
16955if ((a < b) && memcmp(&a, &b, 1) < 0)
16956 exit(1);
16957exit(0);
16958}
16959EOCP
16960 set try
16961 if eval $compile_ok; then
16962 if $run ./try 2>/dev/null; then
16963 echo "Yes, it can."
16964 val="$define"
16965 else
16966 echo "No, it can't (it uses signed chars)."
16967 fi
16968 else
16969 echo "(I can't compile the test program, so we'll assume not...)"
16970 fi
16971 ;;
16972esac
16973$rm_try
16974set d_sanemcmp
16975eval $setvar
16976
16977: see if prototype for sbrk is available
16978echo " "
16979set d_sbrkproto sbrk $i_unistd unistd.h
16980eval $hasproto
16981
16982: see if select exists
16983set select d_select
16984eval $inlibc
16985
16986: see if semctl exists
16987set semctl d_semctl
16988eval $inlibc
16989
16990: see if semget exists
16991set semget d_semget
16992eval $inlibc
16993
16994: see if semop exists
16995set semop d_semop
16996eval $inlibc
16997
16998: see how much of the 'sem*(2)' library is present.
16999h_sem=true
17000echo " "
17001case "$d_semctl$d_semget$d_semop" in
17002*"$undef"*) h_sem=false;;
17003esac
17004case "$osname" in
17005freebsd)
17006 case "`ipcs 2>&1`" in
17007 "SVID messages"*"not configured"*)
17008 echo "Your $osname does not have the sem*(2) configured." >&4
17009 h_sem=false
17010 val="$undef"
17011 set semctl d_semctl
17012 eval $setvar
17013 set semget d_semget
17014 eval $setvar
17015 set semop d_semop
17016 eval $setvar
17017 ;;
17018 esac
17019 ;;
17020esac
17021: we could also check for sys/ipc.h ...
17022if $h_sem && $test `./findhdr sys/sem.h`; then
17023 echo "You have the full sem*(2) library." >&4
17024 val="$define"
17025else
17026 echo "You don't have the full sem*(2) library." >&4
17027 val="$undef"
17028fi
17029set d_sem
17030eval $setvar
17031
17032: see whether sys/sem.h defines union semun
17033echo " "
17034$cat > try.c <<'END'
17035#include <sys/types.h>
17036#include <sys/ipc.h>
17037#include <sys/sem.h>
17038int main () { union semun semun; semun.buf = 0; }
17039END
17040set try
17041if eval $compile; then
17042 echo "You have union semun in <sys/sem.h>." >&4
17043 val="$define"
17044else
17045 echo "You do not have union semun in <sys/sem.h>." >&4
17046 val="$undef"
17047fi
17048$rm_try
17049set d_union_semun
17050eval $setvar
17051
17052: see how to do semctl IPC_STAT
17053case "$d_sem" in
17054$define)
17055 echo " "
17056 $cat > tryh.h <<END
17057#ifndef S_IRUSR
17058# ifdef S_IREAD
17059# define S_IRUSR S_IREAD
17060# define S_IWUSR S_IWRITE
17061# define S_IXUSR S_IEXEC
17062# else
17063# define S_IRUSR 0400
17064# define S_IWUSR 0200
17065# define S_IXUSR 0100
17066# endif
17067# define S_IRGRP (S_IRUSR>>3)
17068# define S_IWGRP (S_IWUSR>>3)
17069# define S_IXGRP (S_IXUSR>>3)
17070# define S_IROTH (S_IRUSR>>6)
17071# define S_IWOTH (S_IWUSR>>6)
17072# define S_IXOTH (S_IXUSR>>6)
17073#endif
17074#ifndef S_IRWXU
17075# define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
17076# define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
17077# define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
17078#endif
17079END
17080 : see whether semctl IPC_STAT can use union semun
17081 case "$d_semctl_semun" in
17082 '')
17083 val="$undef"
17084 $cat > try.c <<END
17085#include <sys/types.h>
17086#include <sys/ipc.h>
17087#include <sys/sem.h>
17088#include <sys/stat.h>
17089#include <stdio.h>
17090#include <errno.h>
17091#include "tryh.h"
17092#ifndef errno
17093extern int errno;
17094#endif
17095#$d_union_semun HAS_UNION_SEMUN
17096int main() {
17097 union semun
17098#ifndef HAS_UNION_SEMUN
17099 {
17100 int val;
17101 struct semid_ds *buf;
17102 unsigned short *array;
17103 }
17104#endif
17105 arg;
17106 int sem, st;
17107
17108#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
17109 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17110 if (sem > -1) {
17111 struct semid_ds argbuf;
17112 arg.buf = &argbuf;
17113# ifdef IPC_STAT
17114 st = semctl(sem, 0, IPC_STAT, arg);
17115 if (st == 0)
17116 printf("semun\n");
17117 else
17118# endif /* IPC_STAT */
17119 printf("semctl IPC_STAT failed: errno = %d\n", errno);
17120# ifdef IPC_RMID
17121 if (semctl(sem, 0, IPC_RMID, arg) != 0)
17122# endif /* IPC_RMID */
17123 printf("semctl IPC_RMID failed: errno = %d\n", errno);
17124 } else
17125#endif /* IPC_PRIVATE && ... */
17126 printf("semget failed: errno = %d\n", errno);
17127 return 0;
17128}
17129END
17130 set try
17131 if eval $compile; then
17132 xxx=`$run ./try`
17133 case "$xxx" in
17134 semun) val="$define" ;;
17135 esac
17136 fi
17137 $rm_try
17138 set d_semctl_semun
17139 eval $setvar
17140 ;;
17141 esac
17142 case "$d_semctl_semun" in
17143 $define)
17144 echo "You can use union semun for semctl IPC_STAT." >&4
17145 also='also'
17146 ;;
17147 *) echo "You cannot use union semun for semctl IPC_STAT." >&4
17148 also=''
17149 ;;
17150 esac
17151
17152 : see whether semctl IPC_STAT can use struct semid_ds pointer
17153 case "$d_semctl_semid_ds" in
17154 '')
17155 val="$undef"
17156 $cat > try.c <<'END'
17157#include <sys/types.h>
17158#include <sys/ipc.h>
17159#include <sys/sem.h>
17160#include <sys/stat.h>
17161#include "tryh.h"
17162#include <stdio.h>
17163#include <errno.h>
17164#ifndef errno
17165extern int errno;
17166#endif
17167int main() {
17168 struct semid_ds arg;
17169 int sem, st;
17170
17171#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
17172 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17173 if (sem > -1) {
17174# ifdef IPC_STAT
17175 st = semctl(sem, 0, IPC_STAT, &arg);
17176 if (st == 0)
17177 printf("semid_ds\n");
17178 else
17179# endif /* IPC_STAT */
17180 printf("semctl IPC_STAT failed: errno = %d\n", errno);
17181# ifdef IPC_RMID
17182 if (semctl(sem, 0, IPC_RMID, &arg) != 0)
17183# endif /* IPC_RMID */
17184 printf("semctl IPC_RMID failed: errno = %d\n", errno);
17185 } else
17186#endif /* IPC_PRIVATE && ... */
17187 printf("semget failed: errno = %d\n", errno);
17188
17189 return 0;
17190}
17191END
17192 set try
17193 if eval $compile; then
17194 xxx=`$run ./try`
17195 case "$xxx" in
17196 semid_ds) val="$define" ;;
17197 esac
17198 fi
17199 $rm_try
17200 set d_semctl_semid_ds
17201 eval $setvar
17202 ;;
17203 esac
17204 case "$d_semctl_semid_ds" in
17205 $define)
17206 echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
17207 ;;
17208 *) echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
17209 ;;
17210 esac
17211 ;;
17212*) val="$undef"
17213
17214 # We do not have the full sem*(2) library, so assume we can not
17215 # use either.
17216
17217 set d_semctl_semun
17218 eval $setvar
17219
17220 set d_semctl_semid_ds
17221 eval $setvar
17222 ;;
17223esac
17224$rm_try tryh.h
17225
17226: see if sendmsg exists
17227set sendmsg d_sendmsg
17228eval $inlibc
17229
17230: see if setegid exists
17231set setegid d_setegid
17232eval $inlibc
17233
17234: see if seteuid exists
17235set seteuid d_seteuid
17236eval $inlibc
17237
17238: see if setgrent exists
17239set setgrent d_setgrent
17240eval $inlibc
17241
17242: see if setgrent_r exists
17243set setgrent_r d_setgrent_r
17244eval $inlibc
17245case "$d_setgrent_r" in
17246"$define")
17247 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
17248 case "$d_setgrent_r_proto:$usethreads" in
17249 ":define") d_setgrent_r_proto=define
17250 set d_setgrent_r_proto setgrent_r $hdrs
17251 eval $hasproto ;;
17252 *) ;;
17253 esac
17254 case "$d_setgrent_r_proto" in
17255 define)
17256 case "$setgrent_r_proto" in
17257 ''|0) try='int setgrent_r(FILE**);'
17258 ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
17259 esac
17260 case "$setgrent_r_proto" in
17261 ''|0) try='void setgrent_r(FILE**);'
17262 ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
17263 esac
17264 case "$setgrent_r_proto" in
17265 ''|0) d_setgrent_r=undef
17266 setgrent_r_proto=0
17267 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
17268 * ) case "$setgrent_r_proto" in
17269 REENTRANT_PROTO*) ;;
17270 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
17271 esac
17272 echo "Prototype: $try" ;;
17273 esac
17274 ;;
17275 *) case "$usethreads" in
17276 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
17277 esac
17278 d_setgrent_r=undef
17279 setgrent_r_proto=0
17280 ;;
17281 esac
17282 ;;
17283*) setgrent_r_proto=0
17284 ;;
17285esac
17286
17287: see if sethostent exists
17288set sethostent d_sethent
17289eval $inlibc
17290
17291: see if sethostent_r exists
17292set sethostent_r d_sethostent_r
17293eval $inlibc
17294case "$d_sethostent_r" in
17295"$define")
17296 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17297 case "$d_sethostent_r_proto:$usethreads" in
17298 ":define") d_sethostent_r_proto=define
17299 set d_sethostent_r_proto sethostent_r $hdrs
17300 eval $hasproto ;;
17301 *) ;;
17302 esac
17303 case "$d_sethostent_r_proto" in
17304 define)
17305 case "$sethostent_r_proto" in
17306 ''|0) try='int sethostent_r(int, struct hostent_data*);'
17307 ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
17308 esac
17309 case "$sethostent_r_proto" in
17310 ''|0) try='void sethostent_r(int, struct hostent_data*);'
17311 ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
17312 esac
17313 case "$sethostent_r_proto" in
17314 ''|0) d_sethostent_r=undef
17315 sethostent_r_proto=0
17316 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
17317 * ) case "$sethostent_r_proto" in
17318 REENTRANT_PROTO*) ;;
17319 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
17320 esac
17321 echo "Prototype: $try" ;;
17322 esac
17323 ;;
17324 *) case "$usethreads" in
17325 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
17326 esac
17327 d_sethostent_r=undef
17328 sethostent_r_proto=0
17329 ;;
17330 esac
17331 ;;
17332*) sethostent_r_proto=0
17333 ;;
17334esac
17335
17336: see if setitimer exists
17337set setitimer d_setitimer
17338eval $inlibc
17339
17340: see if setlinebuf exists
17341set setlinebuf d_setlinebuf
17342eval $inlibc
17343
17344: see if setlocale exists
17345set setlocale d_setlocale
17346eval $inlibc
17347
17348: see if locale.h is available
17349set locale.h i_locale
17350eval $inhdr
17351
17352: see if setlocale_r exists
17353set setlocale_r d_setlocale_r
17354eval $inlibc
17355case "$d_setlocale_r" in
17356"$define")
17357 hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
17358 case "$d_setlocale_r_proto:$usethreads" in
17359 ":define") d_setlocale_r_proto=define
17360 set d_setlocale_r_proto setlocale_r $hdrs
17361 eval $hasproto ;;
17362 *) ;;
17363 esac
17364 case "$d_setlocale_r_proto" in
17365 define)
17366 case "$setlocale_r_proto" in
17367 ''|0) try='int setlocale_r(int, const char*, char*, int);'
17368 ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
17369 esac
17370 case "$setlocale_r_proto" in
17371 ''|0) d_setlocale_r=undef
17372 setlocale_r_proto=0
17373 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
17374 * ) case "$setlocale_r_proto" in
17375 REENTRANT_PROTO*) ;;
17376 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
17377 esac
17378 echo "Prototype: $try" ;;
17379 esac
17380 ;;
17381 *) case "$usethreads" in
17382 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
17383 esac
17384 d_setlocale_r=undef
17385 setlocale_r_proto=0
17386 ;;
17387 esac
17388 ;;
17389*) setlocale_r_proto=0
17390 ;;
17391esac
17392
17393: see if setnetent exists
17394set setnetent d_setnent
17395eval $inlibc
17396
17397: see if setnetent_r exists
17398set setnetent_r d_setnetent_r
17399eval $inlibc
17400case "$d_setnetent_r" in
17401"$define")
17402 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17403 case "$d_setnetent_r_proto:$usethreads" in
17404 ":define") d_setnetent_r_proto=define
17405 set d_setnetent_r_proto setnetent_r $hdrs
17406 eval $hasproto ;;
17407 *) ;;
17408 esac
17409 case "$d_setnetent_r_proto" in
17410 define)
17411 case "$setnetent_r_proto" in
17412 ''|0) try='int setnetent_r(int, struct netent_data*);'
17413 ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
17414 esac
17415 case "$setnetent_r_proto" in
17416 ''|0) try='void setnetent_r(int, struct netent_data*);'
17417 ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
17418 esac
17419 case "$setnetent_r_proto" in
17420 ''|0) d_setnetent_r=undef
17421 setnetent_r_proto=0
17422 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
17423 * ) case "$setnetent_r_proto" in
17424 REENTRANT_PROTO*) ;;
17425 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
17426 esac
17427 echo "Prototype: $try" ;;
17428 esac
17429 ;;
17430 *) case "$usethreads" in
17431 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
17432 esac
17433 d_setnetent_r=undef
17434 setnetent_r_proto=0
17435 ;;
17436 esac
17437 ;;
17438*) setnetent_r_proto=0
17439 ;;
17440esac
17441
17442: see if setprotoent exists
17443set setprotoent d_setpent
17444eval $inlibc
17445
17446: see if setpgid exists
17447set setpgid d_setpgid
17448eval $inlibc
17449
17450: see if setpgrp2 exists
17451set setpgrp2 d_setpgrp2
17452eval $inlibc
17453
17454: see if setpriority exists
17455set setpriority d_setprior
17456eval $inlibc
17457
17458: see if setproctitle exists
17459set setproctitle d_setproctitle
17460eval $inlibc
17461
17462: see if setprotoent_r exists
17463set setprotoent_r d_setprotoent_r
17464eval $inlibc
17465case "$d_setprotoent_r" in
17466"$define")
17467 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17468 case "$d_setprotoent_r_proto:$usethreads" in
17469 ":define") d_setprotoent_r_proto=define
17470 set d_setprotoent_r_proto setprotoent_r $hdrs
17471 eval $hasproto ;;
17472 *) ;;
17473 esac
17474 case "$d_setprotoent_r_proto" in
17475 define)
17476 case "$setprotoent_r_proto" in
17477 ''|0) try='int setprotoent_r(int, struct protoent_data*);'
17478 ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
17479 esac
17480 case "$setprotoent_r_proto" in
17481 ''|0) try='void setprotoent_r(int, struct protoent_data*);'
17482 ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
17483 esac
17484 case "$setprotoent_r_proto" in
17485 ''|0) d_setprotoent_r=undef
17486 setprotoent_r_proto=0
17487 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
17488 * ) case "$setprotoent_r_proto" in
17489 REENTRANT_PROTO*) ;;
17490 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17491 esac
17492 echo "Prototype: $try" ;;
17493 esac
17494 ;;
17495 *) case "$usethreads" in
17496 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17497 esac
17498 d_setprotoent_r=undef
17499 setprotoent_r_proto=0
17500 ;;
17501 esac
17502 ;;
17503*) setprotoent_r_proto=0
17504 ;;
17505esac
17506
17507: see if setpwent exists
17508set setpwent d_setpwent
17509eval $inlibc
17510
17511: see if setpwent_r exists
17512set setpwent_r d_setpwent_r
17513eval $inlibc
17514case "$d_setpwent_r" in
17515"$define")
17516 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
17517 case "$d_setpwent_r_proto:$usethreads" in
17518 ":define") d_setpwent_r_proto=define
17519 set d_setpwent_r_proto setpwent_r $hdrs
17520 eval $hasproto ;;
17521 *) ;;
17522 esac
17523 case "$d_setpwent_r_proto" in
17524 define)
17525 case "$setpwent_r_proto" in
17526 ''|0) try='int setpwent_r(FILE**);'
17527 ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
17528 esac
17529 case "$setpwent_r_proto" in
17530 ''|0) try='void setpwent_r(FILE**);'
17531 ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
17532 esac
17533 case "$setpwent_r_proto" in
17534 ''|0) d_setpwent_r=undef
17535 setpwent_r_proto=0
17536 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
17537 * ) case "$setpwent_r_proto" in
17538 REENTRANT_PROTO*) ;;
17539 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17540 esac
17541 echo "Prototype: $try" ;;
17542 esac
17543 ;;
17544 *) case "$usethreads" in
17545 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17546 esac
17547 d_setpwent_r=undef
17548 setpwent_r_proto=0
17549 ;;
17550 esac
17551 ;;
17552*) setpwent_r_proto=0
17553 ;;
17554esac
17555
17556: see if setregid exists
17557set setregid d_setregid
17558eval $inlibc
17559set setresgid d_setresgid
17560eval $inlibc
17561
17562: see if setreuid exists
17563set setreuid d_setreuid
17564eval $inlibc
17565set setresuid d_setresuid
17566eval $inlibc
17567
17568: see if setrgid exists
17569set setrgid d_setrgid
17570eval $inlibc
17571
17572: see if setruid exists
17573set setruid d_setruid
17574eval $inlibc
17575
17576: see if setservent exists
17577set setservent d_setsent
17578eval $inlibc
17579
17580: see if setservent_r exists
17581set setservent_r d_setservent_r
17582eval $inlibc
17583case "$d_setservent_r" in
17584"$define")
17585 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17586 case "$d_setservent_r_proto:$usethreads" in
17587 ":define") d_setservent_r_proto=define
17588 set d_setservent_r_proto setservent_r $hdrs
17589 eval $hasproto ;;
17590 *) ;;
17591 esac
17592 case "$d_setservent_r_proto" in
17593 define)
17594 case "$setservent_r_proto" in
17595 ''|0) try='int setservent_r(int, struct servent_data*);'
17596 ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
17597 esac
17598 case "$setservent_r_proto" in
17599 ''|0) try='void setservent_r(int, struct servent_data*);'
17600 ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
17601 esac
17602 case "$setservent_r_proto" in
17603 ''|0) d_setservent_r=undef
17604 setservent_r_proto=0
17605 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
17606 * ) case "$setservent_r_proto" in
17607 REENTRANT_PROTO*) ;;
17608 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17609 esac
17610 echo "Prototype: $try" ;;
17611 esac
17612 ;;
17613 *) case "$usethreads" in
17614 define) echo "setservent_r has no prototype, not using it." >&4 ;;
17615 esac
17616 d_setservent_r=undef
17617 setservent_r_proto=0
17618 ;;
17619 esac
17620 ;;
17621*) setservent_r_proto=0
17622 ;;
17623esac
17624
17625: see if setsid exists
17626set setsid d_setsid
17627eval $inlibc
17628
17629: see if setvbuf exists
17630set setvbuf d_setvbuf
17631eval $inlibc
17632
17633: see if shmctl exists
17634set shmctl d_shmctl
17635eval $inlibc
17636
17637: see if shmget exists
17638set shmget d_shmget
17639eval $inlibc
17640
17641: see if shmat exists
17642set shmat d_shmat
17643eval $inlibc
17644: see what shmat returns
17645case "$d_shmat" in
17646"$define")
17647 $cat >shmat.c <<'END'
17648#include <sys/shm.h>
17649void *shmat();
17650END
17651 if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17652 shmattype='void *'
17653 else
17654 shmattype='char *'
17655 fi
17656 echo "and it returns ($shmattype)." >&4
17657 : see if a prototype for shmat is available
17658 xxx=`./findhdr sys/shm.h`
17659 $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17660 if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17661 val="$define"
17662 else
17663 val="$undef"
17664 fi
17665 $rm -f shmat.[co]
17666 ;;
17667*)
17668 val="$undef"
17669 ;;
17670esac
17671set d_shmatprototype
17672eval $setvar
17673
17674: see if shmdt exists
17675set shmdt d_shmdt
17676eval $inlibc
17677
17678: see how much of the 'shm*(2)' library is present.
17679h_shm=true
17680echo " "
17681case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17682*"$undef"*) h_shm=false;;
17683esac
17684case "$osname" in
17685freebsd)
17686 case "`ipcs 2>&1`" in
17687 "SVID shared memory"*"not configured"*)
17688 echo "Your $osname does not have the shm*(2) configured." >&4
17689 h_shm=false
17690 val="$undef"
17691 set shmctl d_shmctl
17692 evat $setvar
17693 set shmget d_shmget
17694 evat $setvar
17695 set shmat d_shmat
17696 evat $setvar
17697 set shmdt d_shmdt
17698 evat $setvar
17699 ;;
17700 esac
17701 ;;
17702esac
17703: we could also check for sys/ipc.h ...
17704if $h_shm && $test `./findhdr sys/shm.h`; then
17705 echo "You have the full shm*(2) library." >&4
17706 val="$define"
17707else
17708 echo "You don't have the full shm*(2) library." >&4
17709 val="$undef"
17710fi
17711set d_shm
17712eval $setvar
17713
17714: see if we have sigaction
17715echo " "
17716if set sigaction val -f d_sigaction; eval $csym; $val; then
17717 echo 'sigaction() found.' >&4
17718 $cat > try.c <<EOP
17719#include <stdio.h>
17720#include <sys/types.h>
17721#include <signal.h>
17722#$i_stdlib I_STDLIB
17723#ifdef I_STDLIB
17724#include <stdlib.h>
17725#endif
17726int main()
17727{
17728 struct sigaction act, oact;
17729 act.sa_flags = 0;
17730 oact.sa_handler = 0;
17731 /* so that act and oact are used */
17732 exit(act.sa_flags == 0 && oact.sa_handler == 0);
17733}
17734EOP
17735 set try
17736 if eval $compile_ok; then
17737 val="$define"
17738 else
17739 echo "But you don't seem to have a usable struct sigaction." >&4
17740 val="$undef"
17741 fi
17742else
17743 echo 'sigaction NOT found.' >&4
17744 val="$undef"
17745fi
17746set d_sigaction; eval $setvar
17747$rm_try
17748
17749: see if this is a sunmath.h system
17750set sunmath.h i_sunmath
17751eval $inhdr
17752
17753: see if signbit exists
17754$echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17755$cat >try.c <<EOCP
17756#$i_math I_MATH
17757#$i_sunmath I_SUNMATH
17758#ifdef I_MATH
17759# include <math.h>
17760#endif
17761#ifdef I_SUNMATH /* Solaris special math library */
17762# include <sunmath.h>
17763#endif
17764#define NV $nvtype
17765int main(int argc, char **argv)
17766{
17767 NV x = 0.0;
17768 NV y = -0.0;
17769 if ((signbit(x) == 0) && (signbit(y) != 0))
17770 return 0;
17771 else
17772 return 1;
17773}
17774EOCP
17775val="$undef"
17776set try
17777if eval $compile; then
17778 if $run ./try; then
17779 $echo "Yes." >&4
17780 val="$define"
17781 else
17782 $echo "Signbit seems to be available, but doesn't work as I expected."
17783 $echo "I won't use it." >&4
17784 val="$undef"
17785 fi
17786else
17787 $echo "Nope." >&4
17788 dflt="$undef"
17789fi
17790set d_signbit
17791eval $setvar
17792$rm_try
17793
17794: see if sigprocmask exists
17795set sigprocmask d_sigprocmask
17796eval $inlibc
17797
17798: see if sigsetjmp exists
17799echo " "
17800case "$d_sigsetjmp" in
17801'')
17802 $cat >try.c <<EOP
17803#include <setjmp.h>
17804#$i_stdlib I_STDLIB
17805#ifdef I_STDLIB
17806#include <stdlib.h>
17807#endif
17808sigjmp_buf env;
17809int set = 1;
17810int main()
17811{
17812 if (sigsetjmp(env,1))
17813 exit(set);
17814 set = 0;
17815 siglongjmp(env, 1);
17816 exit(1);
17817}
17818EOP
17819 set try
17820 if eval $compile; then
17821 if $run ./try >/dev/null 2>&1; then
17822 echo "POSIX sigsetjmp found." >&4
17823 val="$define"
17824 else
17825 $cat >&4 <<EOM
17826Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17827I'll ignore them.
17828EOM
17829 val="$undef"
17830 fi
17831 else
17832 echo "sigsetjmp not found." >&4
17833 val="$undef"
17834 fi
17835 ;;
17836*) val="$d_sigsetjmp"
17837 case "$d_sigsetjmp" in
17838 $define) echo "POSIX sigsetjmp found." >&4;;
17839 $undef) echo "sigsetjmp not found." >&4;;
17840 esac
17841 ;;
17842esac
17843set d_sigsetjmp
17844eval $setvar
17845$rm_try
17846
17847: see if snprintf exists
17848set snprintf d_snprintf
17849eval $inlibc
17850
17851: see if vsnprintf exists
17852set vsnprintf d_vsnprintf
17853eval $inlibc
17854
17855case "$d_snprintf-$d_vsnprintf" in
17856"$define-$define")
17857 $cat <<EOM
17858Checking whether your snprintf() and vsnprintf() work okay...
17859EOM
17860 $cat >try.c <<'EOCP'
17861/* v?snprintf testing logic courtesy of Russ Allbery.
17862 * According to C99:
17863 * - if the buffer is too short it still must be \0-terminated
17864 * - if the buffer is too short the potentially required length
17865 * must be returned and not -1
17866 * - if the buffer is NULL the potentially required length
17867 * must be returned and not -1 or core dump
17868 */
17869#include <stdio.h>
17870#include <stdarg.h>
17871
17872char buf[2];
17873
17874int test (char *format, ...)
17875{
17876 va_list args;
17877 int count;
17878
17879 va_start (args, format);
17880 count = vsnprintf (buf, sizeof buf, format, args);
17881 va_end (args);
17882 return count;
17883}
17884
17885int main ()
17886{
17887 return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17888 && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17889}
17890EOCP
17891 set try
17892 if eval $compile; then
17893 `$run ./try`
17894 case "$?" in
17895 0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17896 *) cat <<EOM >&4
17897Your snprintf() and snprintf() don't seem to be working okay.
17898EOM
17899 d_snprintf="$undef"
17900 d_vsnprintf="$undef"
17901 ;;
17902 esac
17903 else
17904 echo "(I can't seem to compile the test program--assuming they don't)"
17905 d_snprintf="$undef"
17906 d_vsnprintf="$undef"
17907 fi
17908 $rm_try
17909 ;;
17910esac
17911
17912: see if sockatmark exists
17913set sockatmark d_sockatmark
17914eval $inlibc
17915
17916: see if prototype for sockatmark is available
17917echo " "
17918set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17919eval $hasproto
17920
17921: see if socks5_init exists
17922set socks5_init d_socks5_init
17923eval $inlibc
17924
17925: see if sprintf returns the length of the string in the buffer as per ANSI
17926$echo "Checking whether sprintf returns the length of the string..." >&4
17927$cat <<EOP >try.c
17928#include <stdio.h>
17929#$i_stdlib I_STDLIB
17930#ifdef I_STDLIB
17931#include <stdlib.h>
17932#endif
17933#$i_string I_STRING
17934#ifdef I_STRING
17935# include <string.h>
17936#else
17937# include <strings.h>
17938#endif
17939#$i_math I_MATH
17940#ifdef I_MATH
17941#include <math.h>
17942#endif
17943
17944char buffer[256];
17945
17946int check (size_t expect, int test) {
17947 size_t got = strlen(buffer);
17948 if (expect == got)
17949 return 0;
17950
17951 printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17952 test, buffer);
17953 exit (test);
17954}
17955
17956int main(int argc, char **argv) {
17957 int test = 0;
17958
17959 check(sprintf(buffer, ""), ++test);
17960 check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17961 check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17962
17963 return 0;
17964}
17965EOP
17966set try
17967
17968if eval $compile; then
17969 xxx="`$run ./try`"
17970 case "$?" in
17971 0) cat >&4 <<EOM
17972sprintf returns the length of the string (as ANSI says it should)
17973EOM
17974 d_sprintf_returns_strlen="$define"
17975 ;;
17976 *) cat >&4 <<EOM
17977sprintf does not return the length of the string (how old is this system?)
17978EOM
17979 d_sprintf_returns_strlen="$undef"
17980 ;;
17981 esac
17982else
17983 echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
17984 d_sprintf_returns_strlen="$undef"
17985fi
17986$rm_try
17987
17988: see if srand48_r exists
17989set srand48_r d_srand48_r
17990eval $inlibc
17991case "$d_srand48_r" in
17992"$define")
17993 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17994 case "$d_srand48_r_proto:$usethreads" in
17995 ":define") d_srand48_r_proto=define
17996 set d_srand48_r_proto srand48_r $hdrs
17997 eval $hasproto ;;
17998 *) ;;
17999 esac
18000 case "$d_srand48_r_proto" in
18001 define)
18002 case "$srand48_r_proto" in
18003 ''|0) try='int srand48_r(long, struct drand48_data*);'
18004 ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
18005 esac
18006 case "$srand48_r_proto" in
18007 ''|0) d_srand48_r=undef
18008 srand48_r_proto=0
18009 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
18010 * ) case "$srand48_r_proto" in
18011 REENTRANT_PROTO*) ;;
18012 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
18013 esac
18014 echo "Prototype: $try" ;;
18015 esac
18016 ;;
18017 *) case "$usethreads" in
18018 define) echo "srand48_r has no prototype, not using it." >&4 ;;
18019 esac
18020 d_srand48_r=undef
18021 srand48_r_proto=0
18022 ;;
18023 esac
18024 ;;
18025*) srand48_r_proto=0
18026 ;;
18027esac
18028
18029: see if srandom_r exists
18030set srandom_r d_srandom_r
18031eval $inlibc
18032case "$d_srandom_r" in
18033"$define")
18034 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18035 case "$d_srandom_r_proto:$usethreads" in
18036 ":define") d_srandom_r_proto=define
18037 set d_srandom_r_proto srandom_r $hdrs
18038 eval $hasproto ;;
18039 *) ;;
18040 esac
18041 case "$d_srandom_r_proto" in
18042 define)
18043 case "$srandom_r_proto" in
18044 ''|0) try='int srandom_r(unsigned int, struct random_data*);'
18045 ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
18046 esac
18047 case "$srandom_r_proto" in
18048 ''|0) d_srandom_r=undef
18049 srandom_r_proto=0
18050 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
18051 * ) case "$srandom_r_proto" in
18052 REENTRANT_PROTO*) ;;
18053 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
18054 esac
18055 echo "Prototype: $try" ;;
18056 esac
18057 ;;
18058 *) case "$usethreads" in
18059 define) echo "srandom_r has no prototype, not using it." >&4 ;;
18060 esac
18061 d_srandom_r=undef
18062 srandom_r_proto=0
18063 ;;
18064 esac
18065 ;;
18066*) srandom_r_proto=0
18067 ;;
18068esac
18069
18070: see if prototype for setresgid is available
18071echo " "
18072set d_sresgproto setresgid $i_unistd unistd.h
18073eval $hasproto
18074
18075: see if prototype for setresuid is available
18076echo " "
18077set d_sresuproto setresuid $i_unistd unistd.h
18078eval $hasproto
18079
18080: see if sys/stat.h is available
18081set sys/stat.h i_sysstat
18082eval $inhdr
18083
18084: see if stat knows about block sizes
18085echo " "
18086echo "Checking to see if your struct stat has st_blocks field..." >&4
18087set d_statblks stat st_blocks $i_sysstat sys/stat.h
18088eval $hasfield
18089
18090: see if this is a sys/vfs.h system
18091set sys/vfs.h i_sysvfs
18092eval $inhdr
18093
18094: see if this is a sys/statfs.h system
18095set sys/statfs.h i_sysstatfs
18096eval $inhdr
18097
18098: Check for statfs_s
18099echo " "
18100echo "Checking to see if your system supports struct statfs..." >&4
18101set d_statfs_s statfs $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h $i_sysvfs sys/vfs.h $i_sysstatfs sys/statfs.h
18102eval $hasstruct
18103case "$d_statfs_s" in
18104"$define") echo "Yes, it does." ;;
18105*) echo "No, it doesn't." ;;
18106esac
18107
18108
18109: see if struct statfs knows about f_flags
18110case "$d_statfs_s" in
18111define)
18112 echo " "
18113 echo "Checking to see if your struct statfs has f_flags field..." >&4
18114 set d_statfs_f_flags statfs f_flags $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h $i_sysvfs sys/vfs.h $i_sysstatfs sys/statfs.h
18115 eval $hasfield
18116 ;;
18117*) val="$undef"
18118 set d_statfs_f_flags
18119 eval $setvar
18120 ;;
18121esac
18122case "$d_statfs_f_flags" in
18123"$define") echo "Yes, it does." ;;
18124*) echo "No, it doesn't." ;;
18125esac
18126
18127: see what flavor, if any, of static inline is supported
18128echo " "
18129echo "Checking to see if your system supports static inline..."
18130$cat > try.c <<'EOCP'
18131#include <stdlib.h>
18132extern int f_via_a(int x);
18133extern int f_via_b(int x);
18134int main(int argc, char **argv)
18135{
18136 int y;
18137
18138 y = f_via_a(0);
18139#ifdef USE_B
18140 y = f_via_b(0);
18141#endif
18142 if (y == 42) {
18143 return EXIT_SUCCESS;
18144 }
18145 else {
18146 return EXIT_FAILURE;
18147 }
18148}
18149EOCP
18150$cat > a.c <<'EOCP'
18151static INLINE int f(int x) {
18152 int y;
18153 y = x + 42;
18154 return y;
18155}
18156
18157int f_via_a(int x)
18158{
18159 return f(x);
18160}
18161EOCP
18162$cat > b.c <<'EOCP'
18163extern int f(int x);
18164
18165int f_via_b(int x)
18166{
18167 return f(x);
18168}
18169EOCP
18170
18171# Respect a hint (or previous) value for perl_static_inline, if there is one.
18172case "$perl_static_inline" in
18173'') # Check the various possibilities, and break out on success.
18174 # For gcc, prefer __inline__, which will still permit
18175 # cflags.SH to add in -ansi.
18176 case "$gccversion" in
18177 '') xxx="inline __inline__ __inline _inline";;
18178 *) xxx="__inline__ inline __inline _inline";;
18179 esac
18180 for inline in $xxx; do
18181 set try -DINLINE=$inline a.c
18182 if eval $compile && $run ./try; then
18183 # Now make sure there is no external linkage of static
18184 # functions
18185 set try -DINLINE=$inline -DUSE_B a.c b.c
18186 if eval $compile && $run ./try; then
18187 $echo "Your compiler supports static $inline, " >&4
18188 $echo "but it also creates an external definition," >&4
18189 $echo "so I won't use it." >&4
18190 val=$undef
18191 else
18192 $echo "Your compiler supports static $inline." >&4
18193 val=$define
18194 perl_static_inline="static $inline";
18195 break;
18196 fi
18197 else
18198 $echo "Your compiler does NOT support static $inline." >&4
18199 val="$undef"
18200 fi
18201 done
18202 ;;
18203*inline*) # Some variant of inline exists.
18204 echo "Keeping your $hint value of $perl_static_inline."
18205 val=$define
18206 ;;
18207static) # No inline capabilities
18208 echo "Keeping your $hint value of $perl_static_inline."
18209 val=$undef
18210 ;;
18211*) # Unrecognized previous value -- blindly trust the supplied
18212 # value and hope it makes sense. Use old value for
18213 # d_static_inline, if there is one.
18214 echo "Keeping your $hint value of $perl_static_inline."
18215 case "$d_static_inline" in
18216 '') val=$define ;;
18217 *) val=$d_static_inline ;;
18218 esac
18219 ;;
18220esac
18221# Fallback to plain 'static' if nothing worked.
18222case "$perl_static_inline" in
18223'')
18224 perl_static_inline="static"
18225 val=$undef
18226 ;;
18227esac
18228set d_static_inline
18229eval $setvar
18230$rm -f a.[co] b.[co]
18231$rm_try
18232
18233: Check stream access
18234$cat >&4 <<EOM
18235Checking how to access stdio streams by file descriptor number...
18236EOM
18237case "$stdio_stream_array" in
18238'') $cat >try.c <<EOCP
18239#include <stdio.h>
18240int main() {
18241 if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
18242 printf("yes\n");
18243}
18244EOCP
18245 for s in _iob __iob __sF
18246 do
18247 set try -DSTDIO_STREAM_ARRAY=$s
18248 if eval $compile; then
18249 case "`$run ./try`" in
18250 yes) stdio_stream_array=$s; break ;;
18251 esac
18252 fi
18253 done
18254 $rm_try
18255esac
18256case "$stdio_stream_array" in
18257'') $cat >&4 <<EOM
18258I can't figure out how to access stdio streams by file descriptor number.
18259EOM
18260 d_stdio_stream_array="$undef"
18261 ;;
18262*) $cat >&4 <<EOM
18263You can access stdio streams by file descriptor number by the $stdio_stream_array array.
18264EOM
18265 d_stdio_stream_array="$define"
18266 ;;
18267esac
18268
18269: see if strcoll exists
18270set strcoll d_strcoll
18271eval $inlibc
18272
18273: check for structure copying
18274echo " "
18275echo "Checking to see if your C compiler can copy structs..." >&4
18276$cat >try.c <<'EOCP'
18277int main()
18278{
18279 struct blurfl {
18280 int dyick;
18281 } foo, bar;
18282
18283 foo = bar;
18284}
18285EOCP
18286if $cc -c try.c >/dev/null 2>&1 ; then
18287 val="$define"
18288 echo "Yup, it can."
18289else
18290 val="$undef"
18291 echo "Nope, it can't."
18292fi
18293set d_strctcpy
18294eval $setvar
18295$rm_try
18296
18297: see if strerror and/or sys_errlist[] exist
18298echo " "
18299if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
18300 if set strerror val -f d_strerror; eval $csym; $val; then
18301 echo 'strerror() found.' >&4
18302 d_strerror="$define"
18303 d_strerrm='strerror(e)'
18304 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18305 echo "(You also have sys_errlist[], so we could roll our own strerror.)"
18306 d_syserrlst="$define"
18307 else
18308 echo "(Since you don't have sys_errlist[], strerror() is welcome.)"
18309 d_syserrlst="$undef"
18310 fi
18311 elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
18312 $contains '#[ ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
18313 echo 'strerror() found in string header.' >&4
18314 d_strerror="$define"
18315 d_strerrm='strerror(e)'
18316 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18317 echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
18318 d_syserrlst="$define"
18319 else
18320 echo "(You don't appear to have any sys_errlist[], how can this be?)"
18321 d_syserrlst="$undef"
18322 fi
18323 elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18324 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
18325 d_strerror="$undef"
18326 d_syserrlst="$define"
18327 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
18328 else
18329 echo 'strerror() and sys_errlist[] NOT found.' >&4
18330 d_strerror="$undef"
18331 d_syserrlst="$undef"
18332 d_strerrm='"unknown"'
18333 fi
18334fi
18335
18336: see if strerror_r exists
18337set strerror_r d_strerror_r
18338eval $inlibc
18339case "$d_strerror_r" in
18340"$define")
18341 hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
18342 case "$d_strerror_r_proto:$usethreads" in
18343 ":define") d_strerror_r_proto=define
18344 set d_strerror_r_proto strerror_r $hdrs
18345 eval $hasproto ;;
18346 *) ;;
18347 esac
18348 case "$d_strerror_r_proto" in
18349 define)
18350 case "$strerror_r_proto" in
18351 ''|0) try='int strerror_r(int, char*, size_t);'
18352 ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
18353 esac
18354 case "$strerror_r_proto" in
18355 ''|0) try='int strerror_r(int, char*, int);'
18356 ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
18357 esac
18358 case "$strerror_r_proto" in
18359 ''|0) try='char* strerror_r(int, char*, size_t);'
18360 ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
18361 esac
18362 case "$strerror_r_proto" in
18363 ''|0) d_strerror_r=undef
18364 strerror_r_proto=0
18365 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
18366 * ) case "$strerror_r_proto" in
18367 REENTRANT_PROTO*) ;;
18368 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
18369 esac
18370 echo "Prototype: $try" ;;
18371 esac
18372 ;;
18373 *) case "$usethreads" in
18374 define) echo "strerror_r has no prototype, not using it." >&4 ;;
18375 esac
18376 d_strerror_r=undef
18377 strerror_r_proto=0
18378 ;;
18379 esac
18380 ;;
18381*) strerror_r_proto=0
18382 ;;
18383esac
18384
18385: see if strftime exists
18386set strftime d_strftime
18387eval $inlibc
18388
18389: see if strlcat exists
18390set strlcat d_strlcat
18391eval $inlibc
18392
18393: see if strlcpy exists
18394set strlcpy d_strlcpy
18395eval $inlibc
18396
18397: see if strtod exists
18398set strtod d_strtod
18399eval $inlibc
18400
18401: see if strtol exists
18402set strtol d_strtol
18403eval $inlibc
18404
18405: see if strtold exists
18406set strtold d_strtold
18407eval $inlibc
18408
18409: see if strtoll exists
18410set strtoll d_strtoll
18411eval $inlibc
18412
18413case "$d_longlong-$d_strtoll" in
18414"$define-$define")
18415 $cat <<EOM
18416Checking whether your strtoll() works okay...
18417EOM
18418 $cat >try.c <<'EOCP'
18419#include <errno.h>
18420#ifdef __hpux
18421#define strtoll __strtoll
18422#endif
18423#ifdef __EMX__
18424#define strtoll _strtoll
18425#endif
18426#include <stdio.h>
18427extern long long int strtoll(char *s, char **, int);
18428static int bad = 0;
18429int check(char *s, long long ell, int een) {
18430 long long gll;
18431 errno = 0;
18432 gll = strtoll(s, 0, 10);
18433 if (!((gll == ell) && (errno == een)))
18434 bad++;
18435}
18436int main() {
18437 check(" 1", 1LL, 0);
18438 check(" 0", 0LL, 0);
18439 check("-1", -1LL, 0);
18440 check("-9223372036854775808", -9223372036854775808LL, 0);
18441 check("-9223372036854775808", -9223372036854775808LL, 0);
18442 check(" 9223372036854775807", 9223372036854775807LL, 0);
18443 check("-9223372036854775808", -9223372036854775808LL, 0);
18444 check(" 9223372036854775808", 9223372036854775807LL, ERANGE);
18445 check("-9223372036854775809", -9223372036854775808LL, ERANGE);
18446 if (!bad)
18447 printf("ok\n");
18448}
18449EOCP
18450 set try
18451 if eval $compile; then
18452 yyy=`$run ./try`
18453 case "$yyy" in
18454 ok) echo "Your strtoll() seems to be working okay." ;;
18455 *) cat <<EOM >&4
18456Your strtoll() doesn't seem to be working okay.
18457EOM
18458 d_strtoll="$undef"
18459 ;;
18460 esac
18461 else
18462 echo "(I can't seem to compile the test program--assuming it doesn't)"
18463 d_strtoll="$undef"
18464 fi
18465 ;;
18466esac
18467
18468: see if strtoq exists
18469set strtoq d_strtoq
18470eval $inlibc
18471
18472: see if strtoul exists
18473set strtoul d_strtoul
18474eval $inlibc
18475
18476case "$d_strtoul" in
18477"$define")
18478 $cat <<EOM
18479Checking whether your strtoul() works okay...
18480EOM
18481 $cat >try.c <<'EOCP'
18482#include <errno.h>
18483#include <stdio.h>
18484extern unsigned long int strtoul(char *s, char **, int);
18485static int bad = 0;
18486void check(char *s, unsigned long eul, int een) {
18487 unsigned long gul;
18488 errno = 0;
18489 gul = strtoul(s, 0, 10);
18490 if (!((gul == eul) && (errno == een)))
18491 bad++;
18492}
18493int main() {
18494 check(" 1", 1L, 0);
18495 check(" 0", 0L, 0);
18496EOCP
18497 case "$longsize" in
18498 8)
18499 $cat >>try.c <<'EOCP'
18500 check("18446744073709551615", 18446744073709551615UL, 0);
18501 check("18446744073709551616", 18446744073709551615UL, ERANGE);
18502#if 0 /* strtoul() for /^-/ strings is undefined. */
18503 check("-1", 18446744073709551615UL, 0);
18504 check("-18446744073709551614", 2, 0);
18505 check("-18446744073709551615", 1, 0);
18506 check("-18446744073709551616", 18446744073709551615UL, ERANGE);
18507 check("-18446744073709551617", 18446744073709551615UL, ERANGE);
18508#endif
18509EOCP
18510 ;;
18511 4)
18512 $cat >>try.c <<'EOCP'
18513 check("4294967295", 4294967295UL, 0);
18514 check("4294967296", 4294967295UL, ERANGE);
18515#if 0 /* strtoul() for /^-/ strings is undefined. */
18516 check("-1", 4294967295UL, 0);
18517 check("-4294967294", 2, 0);
18518 check("-4294967295", 1, 0);
18519 check("-4294967296", 4294967295UL, ERANGE);
18520 check("-4294967297", 4294967295UL, ERANGE);
18521#endif
18522EOCP
18523 ;;
18524 *)
18525: Should we write these tests to be more portable by sprintf-ing
18526: ~0 and then manipulating that char string as input for strtol?
18527 ;;
18528 esac
18529 $cat >>try.c <<'EOCP'
18530 if (!bad)
18531 printf("ok\n");
18532 return 0;
18533}
18534EOCP
18535 set try
18536 if eval $compile; then
18537 case "`$run ./try`" in
18538 ok) echo "Your strtoul() seems to be working okay." ;;
18539 *) cat <<EOM >&4
18540Your strtoul() doesn't seem to be working okay.
18541EOM
18542 d_strtoul="$undef"
18543 ;;
18544 esac
18545 else
18546 echo "(I can't seem to compile the test program--assuming it doesn't)"
18547 d_strtoul="$undef"
18548 fi
18549 ;;
18550esac
18551
18552: see if strtoull exists
18553set strtoull d_strtoull
18554eval $inlibc
18555
18556case "$d_longlong-$d_strtoull" in
18557"$define-$define")
18558 $cat <<EOM
18559Checking whether your strtoull() works okay...
18560EOM
18561 $cat >try.c <<'EOCP'
18562#include <errno.h>
18563#ifdef __hpux
18564#define strtoull __strtoull
18565#endif
18566#include <stdio.h>
18567extern unsigned long long int strtoull(char *s, char **, int);
18568static int bad = 0;
18569int check(char *s, long long eull, int een) {
18570 long long gull;
18571 errno = 0;
18572 gull = strtoull(s, 0, 10);
18573 if (!((gull == eull) && (errno == een)))
18574 bad++;
18575}
18576int main() {
18577 check(" 1", 1LL, 0);
18578 check(" 0", 0LL, 0);
18579 check("18446744073709551615", 18446744073709551615ULL, 0);
18580 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
18581#if 0 /* strtoull() for /^-/ strings is undefined. */
18582 check("-1", 18446744073709551615ULL, 0);
18583 check("-18446744073709551614", 2LL, 0);
18584 check("-18446744073709551615", 1LL, 0);
18585 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18586 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18587#endif
18588 if (!bad)
18589 printf("ok\n");
18590}
18591EOCP
18592 set try
18593 if eval $compile; then
18594 case "`$run ./try`" in
18595 ok) echo "Your strtoull() seems to be working okay." ;;
18596 *) cat <<EOM >&4
18597Your strtoull() doesn't seem to be working okay.
18598EOM
18599 d_strtoull="$undef"
18600 ;;
18601 esac
18602 else
18603 echo "(I can't seem to compile the test program--assuming it doesn't)"
18604 d_strtoull="$undef"
18605 fi
18606 ;;
18607esac
18608
18609: see if strtouq exists
18610set strtouq d_strtouq
18611eval $inlibc
18612
18613case "$d_strtouq" in
18614"$define")
18615 $cat <<EOM
18616Checking whether your strtouq() works okay...
18617EOM
18618 $cat >try.c <<'EOCP'
18619#include <errno.h>
18620#include <stdio.h>
18621extern unsigned long long int strtouq(char *s, char **, int);
18622static int bad = 0;
18623void check(char *s, unsigned long long eull, int een) {
18624 unsigned long long gull;
18625 errno = 0;
18626 gull = strtouq(s, 0, 10);
18627 if (!((gull == eull) && (errno == een)))
18628 bad++;
18629}
18630int main() {
18631 check(" 1", 1LL, 0);
18632 check(" 0", 0LL, 0);
18633 check("18446744073709551615", 18446744073709551615ULL, 0);
18634 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
18635#if 0 /* strtouq() for /^-/ strings is undefined. */
18636 check("-1", 18446744073709551615ULL, 0);
18637 check("-18446744073709551614", 2LL, 0);
18638 check("-18446744073709551615", 1LL, 0);
18639 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18640 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18641#endif
18642 if (!bad)
18643 printf("ok\n");
18644 return 0;
18645}
18646EOCP
18647 set try
18648 if eval $compile; then
18649 case "`$run ./try`" in
18650 ok) echo "Your strtouq() seems to be working okay." ;;
18651 *) cat <<EOM >&4
18652Your strtouq() doesn't seem to be working okay.
18653EOM
18654 d_strtouq="$undef"
18655 ;;
18656 esac
18657 else
18658 echo "(I can't seem to compile the test program--assuming it doesn't)"
18659 d_strtouq="$undef"
18660 fi
18661 ;;
18662esac
18663
18664: see if strxfrm exists
18665set strxfrm d_strxfrm
18666eval $inlibc
18667
18668: see if symlink exists
18669set symlink d_symlink
18670eval $inlibc
18671
18672: see if syscall exists
18673set syscall d_syscall
18674eval $inlibc
18675
18676: see if prototype for syscall is available
18677echo " "
18678set d_syscallproto syscall $i_unistd unistd.h
18679eval $hasproto
18680
18681: see if sysconf exists
18682set sysconf d_sysconf
18683eval $inlibc
18684
18685: see if system exists
18686set system d_system
18687eval $inlibc
18688
18689: see if tcgetpgrp exists
18690set tcgetpgrp d_tcgetpgrp
18691eval $inlibc
18692
18693: see if tcsetpgrp exists
18694set tcsetpgrp d_tcsetpgrp
18695eval $inlibc
18696
18697: see if prototype for telldir is available
18698echo " "
18699set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18700eval $hasproto
18701
18702: see if time exists
18703echo " "
18704if test "X$d_time" = X -o X"$timetype" = X; then
18705 if set time val -f d_time; eval $csym; $val; then
18706 echo 'time() found.' >&4
18707 val="$define"
18708 rp="What is the type returned by time() on this system?"
18709 set time_t timetype long stdio.h sys/types.h
18710 eval $typedef_ask
18711 else
18712 echo 'time() not found, hope that will do.' >&4
18713 val="$undef"
18714 timetype='int';
18715 fi
18716 set d_time
18717 eval $setvar
18718fi
18719
18720: see if timegm exists
18721set timegm d_timegm
18722eval $inlibc
18723
18724: see if this is a sys/times.h system
18725set sys/times.h i_systimes
18726eval $inhdr
18727
18728: see if times exists
18729echo " "
18730if set times val -f d_times; eval $csym; $val; then
18731 echo 'times() found.' >&4
18732 d_times="$define"
18733 inc=''
18734 case "$i_systimes" in
18735 "$define") inc='sys/times.h';;
18736 esac
18737 rp="What is the type returned by times() on this system?"
18738 set clock_t clocktype long stdio.h sys/types.h $inc
18739 eval $typedef_ask
18740else
18741 echo 'times() NOT found, hope that will do.' >&4
18742 d_times="$undef"
18743 clocktype='int'
18744fi
18745
18746: see if tmpnam_r exists
18747set tmpnam_r d_tmpnam_r
18748eval $inlibc
18749case "$d_tmpnam_r" in
18750"$define")
18751 hdrs="$i_systypes sys/types.h define stdio.h "
18752 case "$d_tmpnam_r_proto:$usethreads" in
18753 ":define") d_tmpnam_r_proto=define
18754 set d_tmpnam_r_proto tmpnam_r $hdrs
18755 eval $hasproto ;;
18756 *) ;;
18757 esac
18758 case "$d_tmpnam_r_proto" in
18759 define)
18760 case "$tmpnam_r_proto" in
18761 ''|0) try='char* tmpnam_r(char*);'
18762 ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
18763 esac
18764 case "$tmpnam_r_proto" in
18765 ''|0) d_tmpnam_r=undef
18766 tmpnam_r_proto=0
18767 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
18768 * ) case "$tmpnam_r_proto" in
18769 REENTRANT_PROTO*) ;;
18770 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18771 esac
18772 echo "Prototype: $try" ;;
18773 esac
18774 ;;
18775 *) case "$usethreads" in
18776 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18777 esac
18778 d_tmpnam_r=undef
18779 tmpnam_r_proto=0
18780 ;;
18781 esac
18782 ;;
18783*) tmpnam_r_proto=0
18784 ;;
18785esac
18786
18787: see if truncate exists
18788set truncate d_truncate
18789eval $inlibc
18790
18791: see if ttyname_r exists
18792set ttyname_r d_ttyname_r
18793eval $inlibc
18794case "$d_ttyname_r" in
18795"$define")
18796 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
18797 case "$d_ttyname_r_proto:$usethreads" in
18798 ":define") d_ttyname_r_proto=define
18799 set d_ttyname_r_proto ttyname_r $hdrs
18800 eval $hasproto ;;
18801 *) ;;
18802 esac
18803 case "$d_ttyname_r_proto" in
18804 define)
18805 case "$ttyname_r_proto" in
18806 ''|0) try='int ttyname_r(int, char*, size_t);'
18807 ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
18808 esac
18809 case "$ttyname_r_proto" in
18810 ''|0) try='int ttyname_r(int, char*, int);'
18811 ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
18812 esac
18813 case "$ttyname_r_proto" in
18814 ''|0) try='char* ttyname_r(int, char*, int);'
18815 ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
18816 esac
18817 case "$ttyname_r_proto" in
18818 ''|0) d_ttyname_r=undef
18819 ttyname_r_proto=0
18820 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
18821 * ) case "$ttyname_r_proto" in
18822 REENTRANT_PROTO*) ;;
18823 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18824 esac
18825 echo "Prototype: $try" ;;
18826 esac
18827 ;;
18828 *) case "$usethreads" in
18829 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18830 esac
18831 d_ttyname_r=undef
18832 ttyname_r_proto=0
18833 ;;
18834 esac
18835 ;;
18836*) ttyname_r_proto=0
18837 ;;
18838esac
18839
18840: see if tzname[] exists
18841echo " "
18842if set tzname val -a d_tzname; eval $csym; $val; then
18843 val="$define"
18844 echo 'tzname[] found.' >&4
18845else
18846 val="$undef"
18847 echo 'tzname[] NOT found.' >&4
18848fi
18849set d_tzname
18850eval $setvar
18851
18852: Check if is a multiplatform env
18853case "$osname" in
18854next|darwin) multiarch="$define" ;;
18855esac
18856case "$multiarch" in
18857''|[nN]*) multiarch="$undef" ;;
18858esac
18859
18860: check for ordering of bytes in a UV
18861echo " "
18862case "$multiarch" in
18863*$define*)
18864 $cat <<EOM
18865You seem to be doing a multiarchitecture build,
18866skipping the byteorder check.
18867
18868EOM
18869 byteorder='ffff'
18870 ;;
18871*)
18872 case "$byteorder" in
18873 '')
18874 $cat <<'EOM'
18875In the following, larger digits indicate more significance. A big-endian
18876machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18877little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18878machines may have weird orders like 3412. A Cray will report 87654321,
18879an Alpha will report 12345678. If the test program works the default is
18880probably right.
18881I'm now running the test program...
18882EOM
18883 $cat >try.c <<EOCP
18884#include <stdio.h>
18885#$i_stdlib I_STDLIB
18886#ifdef I_STDLIB
18887#include <stdlib.h>
18888#endif
18889#include <sys/types.h>
18890typedef $uvtype UV;
18891int main()
18892{
18893 int i;
18894 union {
18895 UV l;
18896 char c[$uvsize];
18897 } u;
18898
18899 if ($uvsize > 4)
18900 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18901 else
18902 u.l = (UV)0x04030201;
18903 for (i = 0; i < $uvsize; i++)
18904 printf("%c", u.c[i]+'0');
18905 printf("\n");
18906 exit(0);
18907}
18908EOCP
18909 xxx_prompt=y
18910 set try
18911 if eval $compile && $run ./try > /dev/null; then
18912 dflt=`$run ./try`
18913 case "$dflt" in
18914 [1-4][1-4][1-4][1-4]|12345678|87654321)
18915 echo "(The test program ran ok.)"
18916 echo "byteorder=$dflt"
18917 xxx_prompt=n
18918 ;;
18919 ????|????????) echo "(The test program ran ok.)" ;;
18920 *) echo "(The test program didn't run right for some reason.)" ;;
18921 esac
18922 else
18923 dflt='4321'
18924 cat <<'EOM'
18925(I can't seem to compile the test program. Guessing big-endian...)
18926EOM
18927 fi
18928 case "$xxx_prompt" in
18929 y)
18930 rp="What is the order of bytes in $uvtype?"
18931 . ./myread
18932 byteorder="$ans"
18933 ;;
18934 *) byteorder=$dflt
18935 ;;
18936 esac
18937 ;;
18938 esac
18939 $rm_try
18940 ;;
18941esac
18942
18943: Checking 32bit alignedness
18944$cat <<EOM
18945
18946Checking to see whether you can access character data unalignedly...
18947EOM
18948case "$d_u32align" in
18949'') $cat >try.c <<EOCP
18950#include <stdio.h>
18951#$i_stdlib I_STDLIB
18952#ifdef I_STDLIB
18953#include <stdlib.h>
18954#endif
18955#define U32 $u32type
18956#define BYTEORDER 0x$byteorder
18957#define U8 $u8type
18958#include <signal.h>
18959#ifdef SIGBUS
18960$signal_t bletch(int s) { exit(4); }
18961#endif
18962int main() {
18963#if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18964 volatile U8 buf[8];
18965 volatile U32 *up;
18966 int i;
18967
18968 if (sizeof(U32) != 4) {
18969 printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18970 exit(1);
18971 }
18972
18973 fflush(stdout);
18974
18975#ifdef SIGBUS
18976 signal(SIGBUS, bletch);
18977#endif
18978
18979 buf[0] = 0;
18980 buf[1] = 0;
18981 buf[2] = 0;
18982 buf[3] = 1;
18983 buf[4] = 0;
18984 buf[5] = 0;
18985 buf[6] = 0;
18986 buf[7] = 1;
18987
18988 for (i = 0; i < 4; i++) {
18989 up = (U32*)(buf + i);
18990 if (! ((*up == 1 << (8*i)) || /* big-endian */
18991 (*up == 1 << (8*(3-i))) /* little-endian */
18992 )
18993 )
18994 {
18995 printf("read failed (%x)\n", *up);
18996 exit(2);
18997 }
18998 }
18999
19000 /* write test */
19001 for (i = 0; i < 4; i++) {
19002 up = (U32*)(buf + i);
19003 *up = 0xBeef;
19004 if (*up != 0xBeef) {
19005 printf("write failed (%x)\n", *up);
19006 exit(3);
19007 }
19008 }
19009
19010 exit(0);
19011#else
19012 printf("1\n");
19013 exit(1);
19014#endif
19015 return 0;
19016}
19017EOCP
19018set try
19019if eval $compile_ok; then
19020 echo "(Testing for character data alignment may crash the test. That's okay.)" >&4
19021 $run ./try 2>&1 >/dev/null
19022 case "$?" in
19023 0) cat >&4 <<EOM
19024You can access character data pretty unalignedly.
19025EOM
19026 d_u32align="$undef"
19027 ;;
19028 *) cat >&4 <<EOM
19029It seems that you must access character data in an aligned manner.
19030EOM
19031 d_u32align="$define"
19032 ;;
19033 esac
19034else
19035 rp='Can you access character data at unaligned addresses?'
19036 dflt='n'
19037 . ./myread
19038 case "$ans" in
19039 [yY]*) d_u32align="$undef" ;;
19040 *) d_u32align="$define" ;;
19041 esac
19042fi
19043$rm_try
19044;;
19045esac
19046
19047: see if ualarm exists
19048set ualarm d_ualarm
19049eval $inlibc
19050
19051: see if umask exists
19052set umask d_umask
19053eval $inlibc
19054
19055: see if unordered exists
19056set unordered d_unordered
19057eval $inlibc
19058
19059: see if unsetenv exists
19060set unsetenv d_unsetenv
19061eval $inlibc
19062
19063: see if usleep exists
19064set usleep d_usleep
19065eval $inlibc
19066
19067: see if prototype for usleep is available
19068echo " "
19069set d_usleepproto usleep $i_unistd unistd.h
19070eval $hasproto
19071
19072: see if ustat exists
19073set ustat d_ustat
19074eval $inlibc
19075
19076: see if closedir exists
19077set closedir d_closedir
19078eval $inlibc
19079
19080case "$d_closedir" in
19081"$define")
19082 echo " "
19083 echo "Checking whether closedir() returns a status..." >&4
19084 cat > try.c <<EOM
19085#$i_dirent I_DIRENT /**/
19086#$i_sysdir I_SYS_DIR /**/
19087#$i_sysndir I_SYS_NDIR /**/
19088#$i_systypes I_SYS_TYPES /**/
19089
19090#if defined(I_SYS_TYPES)
19091#include <sys/types.h>
19092#endif
19093#if defined(I_DIRENT)
19094#include <dirent.h>
19095#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
19096#include <sys/dir.h>
19097#endif
19098#else
19099#ifdef I_SYS_NDIR
19100#include <sys/ndir.h>
19101#else
19102#ifdef I_SYS_DIR
19103#ifdef hp9000s500
19104#include <ndir.h> /* may be wrong in the future */
19105#else
19106#include <sys/dir.h>
19107#endif
19108#endif
19109#endif
19110#endif
19111int main() { return closedir(opendir(".")); }
19112EOM
19113 set try
19114 if eval $compile_ok; then
19115 if $run ./try > /dev/null 2>&1 ; then
19116 echo "Yes, it does."
19117 val="$undef"
19118 else
19119 echo "No, it doesn't."
19120 val="$define"
19121 fi
19122 else
19123 echo "(I can't seem to compile the test program--assuming it doesn't)"
19124 val="$define"
19125 fi
19126 ;;
19127*)
19128 val="$undef";
19129 ;;
19130esac
19131set d_void_closedir
19132eval $setvar
19133$rm_try
19134
19135: see if there is a wait4
19136set wait4 d_wait4
19137eval $inlibc
19138
19139: see if waitpid exists
19140set waitpid d_waitpid
19141eval $inlibc
19142
19143: see if wcstombs exists
19144set wcstombs d_wcstombs
19145eval $inlibc
19146
19147: see if wctomb exists
19148set wctomb d_wctomb
19149eval $inlibc
19150
19151: see if writev exists
19152set writev d_writev
19153eval $inlibc
19154
19155: preserve RCS keywords in files with variable substitution, grrr
19156Date='$Date'
19157Id='$Id'
19158Log='$Log'
19159RCSfile='$RCSfile'
19160Revision='$Revision'
19161
19162: check for alignment requirements
19163echo " "
19164case "$alignbytes" in
19165 '') echo "Checking alignment constraints..." >&4
19166 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
19167 $cat >try.c <<'EOCP'
19168typedef long double NV;
19169EOCP
19170 else
19171 $cat >try.c <<'EOCP'
19172typedef double NV;
19173EOCP
19174 fi
19175 $cat >>try.c <<'EOCP'
19176#include <stdio.h>
19177struct foobar {
19178 char foo;
19179 NV bar;
19180} try_algn;
19181int main()
19182{
19183 printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
19184 return(0);
19185}
19186EOCP
19187 set try
19188 if eval $compile_ok; then
19189 dflt=`$run ./try`
19190 else
19191 dflt='8'
19192 echo "(I can't seem to compile the test program...)"
19193 fi
19194 case "$multiarch" in
19195 *$define*)
19196 : The usual safe value is 8, but Darwin with -Duselongdouble
19197 : needs 16. Hence, we will take 8 as a minimum, but allow
19198 : Configure to pick a larger value if needed.
19199 if $test "$dflt" -lt 8; then
19200 dflt='8'
19201 echo "Setting alignment to 8 for multiarch support.">&4
19202 fi
19203 ;;
19204 esac
19205 ;;
19206 *) dflt="$alignbytes"
19207 ;;
19208esac
19209rp="Doubles must be aligned on a how-many-byte boundary?"
19210. ./myread
19211alignbytes="$ans"
19212$rm_try
19213
19214: set the base revision
19215baserev=5.0
19216
19217: Determine if this is an EBCDIC system
19218echo " "
19219echo "Determining whether or not we are on an EBCDIC system..." >&4
19220$cat >try.c <<'EOM'
19221int main()
19222{
19223 if ('M'==0xd4) return 0;
19224 return 1;
19225}
19226EOM
19227
19228case "$BOOTSTRAP_CHARSET" in
19229 Y|y|define) bootstrap_charset=$define ;;
19230 *) bootstrap_charset=$undef ;;
19231esac
19232
19233val=$undef
19234set try
19235if eval $compile_ok; then
19236 if $run ./try; then
19237 echo "You seem to speak EBCDIC." >&4
19238 val="$define"
19239 else
19240 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
19241 fi
19242else
19243 echo "I'm unable to compile the test program." >&4
19244 echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
19245fi
19246$rm_try
19247set ebcdic
19248eval $setvar
19249
19250: length of character in bytes. Is always 1, otherwise it is not C
19251: This used to be a test using sizeof
19252charsize=1
19253
19254: Check for the number of bits in a character
19255case "$charbits" in
19256'') echo "Checking how long a character is (in bits)..." >&4
19257 $cat >try.c <<EOCP
19258#include <stdio.h>
19259int main ()
19260{
19261 int n;
19262 unsigned char c;
19263 for (c = 1, n = 0; c; c <<= 1, n++) ;
19264 printf ("%d\n", n);
19265 return (0);
19266 }
19267EOCP
19268 set try
19269 if eval $compile_ok; then
19270 dflt=`$run ./try`
19271 else
19272 dflt='8'
19273 echo "(I can't seem to compile the test program. Guessing...)"
19274 fi
19275 ;;
19276*)
19277 dflt="$charbits"
19278 ;;
19279esac
19280rp="What is the length of a character (in bits)?"
19281. ./myread
19282charbits="$ans"
19283$rm_try
19284case "$charbits" in
192858) ;;
19286*) cat >&4 << EOM
19287Your system has an unsigned character size of $charbits bits, which
19288is rather unusual (normally it is 8 bits). Perl likely will not work
19289correctly on your system, with subtle bugs in various places.
19290EOM
19291 rp='Do you really want to continue?'
19292 dflt='n'
19293 . ./myread
19294 case "$ans" in
19295 [yY]) echo >&4 "Okay, continuing." ;;
19296 *) exit 1 ;;
19297 esac
19298esac
19299
19300: how do we concatenate cpp tokens here?
19301echo " "
19302echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
19303$cat >cpp_stuff.c <<'EOCP'
19304#define RCAT(a,b)a/**/b
19305#define ACAT(a,b)a ## b
19306RCAT(Rei,ser)
19307ACAT(Cir,cus)
19308EOCP
19309$cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
19310if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
19311 echo "Oh! Smells like ANSI's been here." >&4
19312 echo "We can catify or stringify, separately or together!"
19313 cpp_stuff=42
19314elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
19315 echo "Ah, yes! The good old days!" >&4
19316 echo "However, in the good old days we don't know how to stringify and"
19317 echo "catify at the same time."
19318 cpp_stuff=1
19319else
19320 $cat >&4 <<EOM
19321Hmm, I don't seem to be able to concatenate tokens with your cpp.
19322You're going to have to edit the values of CAT[2-5] in config.h...
19323EOM
19324 cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
19325fi
19326$rm -f cpp_stuff.*
19327
19328: see if this is a db.h system
19329set db.h i_db
19330eval $inhdr
19331
19332case "$i_db" in
19333$define)
19334 : Check db version.
19335 echo " "
19336 echo "Checking Berkeley DB version ..." >&4
19337 $cat >try.c <<EOCP
19338#$d_const HASCONST
19339#ifndef HASCONST
19340#define const
19341#endif
19342#include <sys/types.h>
19343#include <stdio.h>
19344#$i_stdlib I_STDLIB
19345#ifdef I_STDLIB
19346#include <stdlib.h>
19347#endif
19348#include <db.h>
19349int main(int argc, char *argv[])
19350{
19351#ifdef DB_VERSION_MAJOR /* DB version >= 2 */
19352 int Major, Minor, Patch ;
19353 unsigned long Version ;
19354 (void)db_version(&Major, &Minor, &Patch) ;
19355 if (argc == 2) {
19356 printf("%d %d %d %d %d %d\n",
19357 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
19358 Major, Minor, Patch);
19359 exit(0);
19360 }
19361 printf("You have Berkeley DB Version 2 or greater.\n");
19362
19363 printf("db.h is from Berkeley DB Version %d.%d.%d\n",
19364 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
19365 printf("libdb is from Berkeley DB Version %d.%d.%d\n",
19366 Major, Minor, Patch) ;
19367
19368 /* check that db.h & libdb are compatible */
19369 if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
19370 printf("db.h and libdb are incompatible.\n") ;
19371 exit(3);
19372 }
19373
19374 printf("db.h and libdb are compatible.\n") ;
19375
19376 Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
19377 + DB_VERSION_PATCH ;
19378
19379 /* needs to be >= 2.3.4 */
19380 if (Version < 2003004) {
19381 /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
19382 printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
19383 exit(2);
19384 }
19385
19386 exit(0);
19387#else
19388#if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
19389 if (argc == 2) {
19390 printf("1 0 0\n");
19391 exit(0);
19392 }
19393 printf("You have Berkeley DB Version 1.\n");
19394 exit(0); /* DB version < 2: the coast is clear. */
19395#else
19396 exit(1); /* <db.h> not Berkeley DB? */
19397#endif
19398#endif
19399}
19400EOCP
19401 set try
19402 if eval $compile_ok && $run ./try; then
19403 echo 'Looks OK.' >&4
19404 set `$run ./try 1`
19405 db_version_major=$1
19406 db_version_minor=$2
19407 db_version_patch=$3
19408 else
19409 echo "I can't use Berkeley DB with your <db.h>. I'll disable Berkeley DB." >&4
19410 i_db=$undef
19411 case " $libs " in
19412 *"-ldb "*)
19413 : Remove db from list of libraries to use
19414 echo "Removing unusable -ldb from library list" >&4
19415 set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
19416 shift
19417 libs="$*"
19418 echo "libs = $libs" >&4
19419 ;;
19420 esac
19421 fi
19422 $rm_try
19423 ;;
19424esac
19425
19426case "$i_db" in
19427define)
19428 : Check the return type needed for hash
19429 echo " "
19430 echo "Checking return type needed for hash for Berkeley DB ..." >&4
19431 $cat >try.c <<EOCP
19432#$d_const HASCONST
19433#ifndef HASCONST
19434#define const
19435#endif
19436#include <sys/types.h>
19437#include <db.h>
19438
19439#ifndef DB_VERSION_MAJOR
19440u_int32_t hash_cb (ptr, size)
19441const void *ptr;
19442size_t size;
19443{
19444}
19445HASHINFO info;
19446int main()
19447{
19448 info.hash = hash_cb;
19449}
19450#endif
19451EOCP
19452 if $cc $ccflags -c try.c >try.out 2>&1 ; then
19453 if $contains warning try.out >>/dev/null 2>&1 ; then
19454 db_hashtype='int'
19455 else
19456 db_hashtype='u_int32_t'
19457 fi
19458 else
19459 : XXX Maybe we should just give up here.
19460 db_hashtype=u_int32_t
19461 $cat try.out >&4
19462 echo "Help: I can't seem to compile the db test program." >&4
19463 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
19464 fi
19465 $rm_try
19466 echo "Your version of Berkeley DB uses $db_hashtype for hash."
19467 ;;
19468*) db_hashtype=u_int32_t
19469 ;;
19470esac
19471case "$i_db" in
19472define)
19473 : Check the return type needed for prefix
19474 echo " "
19475 echo "Checking return type needed for prefix for Berkeley DB ..." >&4
19476 cat >try.c <<EOCP
19477#$d_const HASCONST
19478#ifndef HASCONST
19479#define const
19480#endif
19481#include <sys/types.h>
19482#include <db.h>
19483
19484#ifndef DB_VERSION_MAJOR
19485size_t prefix_cb (key1, key2)
19486const DBT *key1;
19487const DBT *key2;
19488{
19489}
19490BTREEINFO info;
19491int main()
19492{
19493 info.prefix = prefix_cb;
19494}
19495#endif
19496EOCP
19497 if $cc $ccflags -c try.c >try.out 2>&1 ; then
19498 if $contains warning try.out >>/dev/null 2>&1 ; then
19499 db_prefixtype='int'
19500 else
19501 db_prefixtype='size_t'
19502 fi
19503 else
19504 db_prefixtype='size_t'
19505 : XXX Maybe we should just give up here.
19506 $cat try.out >&4
19507 echo "Help: I can't seem to compile the db test program." >&4
19508 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
19509 fi
19510 $rm_try
19511 echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
19512 ;;
19513*) db_prefixtype='size_t'
19514 ;;
19515esac
19516
19517: How can we generate normalized random numbers ?
19518echo " "
19519echo "Using our internal random number implementation..." >&4
19520
19521case "$ccflags" in
19522*-Dmy_rand=*|*-Dmy_srand=*)
19523 echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
19524 ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
19525 ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
19526 ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
19527 ;;
19528esac
19529
19530randfunc=Perl_drand48
19531drand01="Perl_drand48()"
19532seedfunc="Perl_drand48_init"
19533randbits=48
19534randseedtype=U32
19535
19536: Check how to flush
19537echo " "
19538$cat >&4 <<EOM
19539Checking how to flush all pending stdio output...
19540EOM
19541# I only know how to find the first 32 possibly open files on SunOS.
19542# See also hints/sunos_4_1.sh and util.c --AD
19543case "$osname" in
19544sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
19545esac
19546$cat >>try.c <<EOCP
19547#include <stdio.h>
19548#$i_stdlib I_STDLIB
19549#ifdef I_STDLIB
19550#include <stdlib.h>
19551#endif
19552#$i_unistd I_UNISTD
19553#ifdef I_UNISTD
19554# include <unistd.h>
19555#endif
19556#$d_sysconf HAS_SYSCONF
19557#$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19558#ifdef HAS_STDIO_STREAM_ARRAY
19559# define STDIO_STREAM_ARRAY $stdio_stream_array
19560#endif
19561int main() {
19562 FILE* p;
19563 unlink("try.out");
19564 p = fopen("try.out", "w");
19565#ifdef TRY_FPUTC
19566 fputc('x', p);
19567#else
19568# ifdef TRY_FPRINTF
19569 fprintf(p, "x");
19570# endif
19571#endif
19572#ifdef TRY_FFLUSH_NULL
19573 fflush(NULL);
19574#endif
19575#ifdef TRY_FFLUSH_ALL
19576 {
19577 long open_max = -1;
19578# ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19579 open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19580# else
19581# if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19582 open_max = sysconf(_SC_OPEN_MAX);
19583# else
19584# ifdef FOPEN_MAX
19585 open_max = FOPEN_MAX;
19586# else
19587# ifdef OPEN_MAX
19588 open_max = OPEN_MAX;
19589# else
19590# ifdef _NFILE
19591 open_max = _NFILE;
19592# endif
19593# endif
19594# endif
19595# endif
19596# endif
19597# ifdef HAS_STDIO_STREAM_ARRAY
19598 if (open_max > 0) {
19599 long i;
19600 for (i = 0; i < open_max; i++)
19601 if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19602 STDIO_STREAM_ARRAY[i]._file < open_max &&
19603 STDIO_STREAM_ARRAY[i]._flag)
19604 fflush(&STDIO_STREAM_ARRAY[i]);
19605 }
19606 }
19607# endif
19608#endif
19609 _exit(42);
19610}
19611EOCP
19612: first we have to find out how _not_ to flush
19613$to try.c
19614if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19615 output=''
19616 set try -DTRY_FPUTC
19617 if eval $compile; then
19618 $run ./try 2>/dev/null
19619 code="$?"
19620 $from try.out
19621 if $test ! -s try.out -a "X$code" = X42; then
19622 output=-DTRY_FPUTC
19623 fi
19624 fi
19625 case "$output" in
19626 '')
19627 set try -DTRY_FPRINTF
19628 if eval $compile; then
19629 $run ./try 2>/dev/null
19630 code="$?"
19631 $from try.out
19632 if $test ! -s try.out -a "X$code" = X42; then
19633 output=-DTRY_FPRINTF
19634 fi
19635 fi
19636 ;;
19637 esac
19638fi
19639: check for fflush NULL behavior
19640case "$fflushNULL" in
19641'') set try -DTRY_FFLUSH_NULL $output
19642 if eval $compile; then
19643 $run ./try 2>/dev/null
19644 code="$?"
19645 $from try.out
19646 if $test -s try.out -a "X$code" = X42; then
19647 fflushNULL="`$cat try.out`"
19648 else
19649 if $test "X$code" != X42; then
19650 $cat >&4 <<EOM
19651(If this test failed, don't worry, we'll try another method shortly.)
19652EOM
19653 fi
19654 fi
19655 fi
19656 $rm -f core try.core core.try.*
19657 case "$fflushNULL" in
19658 x) $cat >&4 <<EOM
19659Your fflush(NULL) works okay for output streams.
19660Let's see if it clobbers input pipes...
19661EOM
19662# As of mid-March 2000 all versions of Solaris appear to have a stdio
19663# bug that improperly flushes the input end of pipes. So we avoid the
19664# autoflush on fork/system/exec support for now. :-(
19665$cat >tryp.c <<EOCP
19666#include <stdio.h>
19667int
19668main(int argc, char **argv)
19669{
19670 char buf[1024];
19671 int i;
19672 char *bp = buf;
19673 while (1) {
19674 while ((i = getc(stdin)) != -1
19675 && (*bp++ = i) != '\n'
19676 && bp < &buf[1024])
19677 /* DO NOTHING */ ;
19678 *bp = '\0';
19679 fprintf(stdout, "%s", buf);
19680 fflush(NULL);
19681 if (i == -1)
19682 return 0;
19683 bp = buf;
19684 }
19685}
19686EOCP
19687 fflushNULL="$define"
19688 set tryp
19689 if eval $compile; then
19690 $rm -f tryp.out
19691 # Copy the .c file to the remote host ($to is an ssh-alike if targethost is set)
19692 if $test "X$targethost" != X; then
19693 $to tryp.c
19694 $run ./tryp \< tryp.c 2>/dev/null > tryp.out
19695 else
19696 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19697 fi
19698 if cmp tryp.c tryp.out >/dev/null 2>&1; then
19699 $cat >&4 <<EOM
19700fflush(NULL) seems to behave okay with input streams.
19701EOM
19702 fflushNULL="$define"
19703 else
19704 $cat >&4 <<EOM
19705Ouch, fflush(NULL) clobbers input pipes! We will not use it.
19706EOM
19707 fflushNULL="$undef"
19708 fi
19709 fi
19710 $rm -f core tryp.c tryp.core core.tryp.*
19711 ;;
19712 '') $cat >&4 <<EOM
19713Your fflush(NULL) isn't working (contrary to ANSI C).
19714EOM
19715 fflushNULL="$undef"
19716 ;;
19717 *) $cat >&4 <<EOM
19718Cannot figure out whether your fflush(NULL) works or not.
19719I'm assuming it doesn't (contrary to ANSI C).
19720EOM
19721 fflushNULL="$undef"
19722 ;;
19723 esac
19724 ;;
19725$define|true|[yY]*)
19726 fflushNULL="$define"
19727 ;;
19728*)
19729 fflushNULL="$undef"
19730 ;;
19731esac
19732: check explicit looping only if NULL did not work, and if the pipe
19733: bug does not show up on an explicit flush too
19734case "$fflushNULL" in
19735"$undef")
19736 $cat >tryp.c <<EOCP
19737#include <stdio.h>
19738int
19739main(int argc, char **argv)
19740{
19741 char buf[1024];
19742 int i;
19743 char *bp = buf;
19744 while (1) {
19745 while ((i = getc(stdin)) != -1
19746 && (*bp++ = i) != '\n'
19747 && bp < &buf[1024])
19748 /* DO NOTHING */ ;
19749 *bp = '\0';
19750 fprintf(stdout, "%s", buf);
19751 fflush(stdin);
19752 if (i == -1)
19753 return 0;
19754 bp = buf;
19755 }
19756}
19757EOCP
19758 set tryp
19759 if eval $compile; then
19760 $rm -f tryp.out
19761 if $test "X$targethost" != X; then
19762 $to tryp.c
19763 $run ./tryp \< tryp.c 2>/dev/null > tryp.out
19764 else
19765 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19766 fi
19767 if cmp tryp.c tryp.out >/dev/null 2>&1; then
19768 $cat >&4 <<EOM
19769Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19770EOM
19771 : now check for fflushall behaviour
19772 case "$fflushall" in
19773 '') set try -DTRY_FFLUSH_ALL $output
19774 if eval $compile; then
19775 $cat >&4 <<EOM
19776(Now testing the other method--but note that this also may fail.)
19777EOM
19778 $run ./try 2>/dev/null
19779 code=$?
19780 $from try.out
19781 if $test -s try.out -a "X$code" = X42; then
19782 fflushall="`$cat try.out`"
19783 fi
19784 fi
19785 $rm_try
19786 case "$fflushall" in
19787 x) $cat >&4 <<EOM
19788Whew. Flushing explicitly all the stdio streams works.
19789EOM
19790 fflushall="$define"
19791 ;;
19792 '') $cat >&4 <<EOM
19793Sigh. Flushing explicitly all the stdio streams doesn't work.
19794EOM
19795 fflushall="$undef"
19796 ;;
19797 *) $cat >&4 <<EOM
19798Cannot figure out whether flushing stdio streams explicitly works or not.
19799I'm assuming it doesn't.
19800EOM
19801 fflushall="$undef"
19802 ;;
19803 esac
19804 ;;
19805 "$define"|true|[yY]*)
19806 fflushall="$define"
19807 ;;
19808 *)
19809 fflushall="$undef"
19810 ;;
19811 esac
19812 else
19813 $cat >&4 <<EOM
19814All is futile. Even fflush(stdin) clobbers input pipes!
19815EOM
19816 fflushall="$undef"
19817 fi
19818 else
19819 fflushall="$undef"
19820 fi
19821 $rm -f core tryp.c tryp.core core.tryp.*
19822 ;;
19823*) fflushall="$undef"
19824 ;;
19825esac
19826
19827case "$fflushNULL$fflushall" in
19828undefundef)
19829 $cat <<EOM
19830OK, I give up. I cannot figure out how to flush pending stdio output.
19831We won't be flushing handles at all before fork/exec/popen.
19832EOM
19833 ;;
19834esac
19835$rm_try tryp
19836
19837: Store the full pathname to the ar program for use in the C program
19838: Respect a hint or command line value for full_ar.
19839case "$full_ar" in
19840'') full_ar=$ar ;;
19841esac
19842
19843: Store the full pathname to the sed program for use in the C program
19844full_sed=$sed
19845
19846: see what type gids are declared as in the kernel
19847echo " "
19848echo "Looking for the type for group ids returned by getgid()."
19849set gid_t gidtype xxx stdio.h sys/types.h
19850eval $typedef
19851case "$gidtype" in
19852xxx)
19853 xxx=`./findhdr sys/user.h`
19854 set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19855 case $1 in
19856 unsigned) dflt="$1 $2" ;;
19857 *) dflt="$1" ;;
19858 esac
19859 ;;
19860*) dflt="$gidtype";;
19861esac
19862case "$gidtype" in
19863gid_t) echo "gid_t found." ;;
19864*) rp="What is the type for group ids returned by getgid()?"
19865 . ./myread
19866 gidtype="$ans"
19867 ;;
19868esac
19869
19870: Check the size of GID
19871echo " "
19872case "$gidtype" in
19873*_t) zzz="$gidtype" ;;
19874*) zzz="gid" ;;
19875esac
19876echo "Checking the size of $zzz..." >&4
19877cat > try.c <<EOCP
19878#include <sys/types.h>
19879#include <stdio.h>
19880#$i_stdlib I_STDLIB
19881#ifdef I_STDLIB
19882#include <stdlib.h>
19883#endif
19884int main() {
19885 printf("%d\n", (int)sizeof($gidtype));
19886 exit(0);
19887}
19888EOCP
19889set try
19890if eval $compile_ok; then
19891 yyy=`$run ./try`
19892 case "$yyy" in
19893 '') gidsize=4
19894 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19895 ;;
19896 *) gidsize=$yyy
19897 echo "Your $zzz is $gidsize bytes long."
19898 ;;
19899 esac
19900else
19901 gidsize=4
19902 echo "(I can't compile the test program--guessing $gidsize.)" >&4
19903fi
19904
19905
19906: Check if GID is signed
19907echo " "
19908case "$gidtype" in
19909*_t) zzz="$gidtype" ;;
19910*) zzz="gid" ;;
19911esac
19912echo "Checking the sign of $zzz..." >&4
19913cat > try.c <<EOCP
19914#include <sys/types.h>
19915#include <stdio.h>
19916int main() {
19917 $gidtype foo = -1;
19918 if (foo < 0)
19919 printf("-1\n");
19920 else
19921 printf("1\n");
19922}
19923EOCP
19924set try
19925if eval $compile; then
19926 yyy=`$run ./try`
19927 case "$yyy" in
19928 '') gidsign=1
19929 echo "(I can't execute the test program--guessing unsigned.)" >&4
19930 ;;
19931 *) gidsign=$yyy
19932 case "$gidsign" in
19933 1) echo "Your $zzz is unsigned." ;;
19934 -1) echo "Your $zzz is signed." ;;
19935 esac
19936 ;;
19937 esac
19938else
19939 gidsign=1
19940 echo "(I can't compile the test program--guessing unsigned.)" >&4
19941fi
19942
19943
19944: Check 64bit sizes
19945echo " "
19946
19947if $test X"$quadtype" != X; then
19948
19949echo "Checking how to print 64-bit integers..." >&4
19950
19951if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19952 $cat >try.c <<'EOCP'
19953#include <sys/types.h>
19954#include <stdio.h>
19955int main() {
19956 int q = 12345678901;
19957 printf("%ld\n", q);
19958}
19959EOCP
19960 set try
19961 if eval $compile; then
19962 yyy=`$run ./try`
19963 case "$yyy" in
19964 12345678901)
19965 sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19966 sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19967 echo "We will use %d."
19968 ;;
19969 esac
19970 fi
19971fi
19972
19973if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19974 $cat >try.c <<'EOCP'
19975#include <sys/types.h>
19976#include <stdio.h>
19977int main() {
19978 long q = 12345678901;
19979 printf("%ld\n", q);
19980}
19981EOCP
19982 set try
19983 if eval $compile; then
19984 yyy=`$run ./try`
19985 case "$yyy" in
19986 12345678901)
19987 sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19988 sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19989 echo "We will use %ld."
19990 ;;
19991 esac
19992 fi
19993fi
19994
19995if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19996 $cat >try.c <<'EOCP'
19997#include <sys/types.h>
19998#include <inttypes.h>
19999#include <stdio.h>
20000int main() {
20001 int64_t q = 12345678901;
20002 printf("%" PRId64 "\n", q);
20003}
20004EOCP
20005 set try
20006 if eval $compile; then
20007 yyy=`$run ./try`
20008 case "$yyy" in
20009 12345678901)
20010 sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
20011 sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
20012 echo "We will use the C9X style."
20013 ;;
20014 esac
20015 fi
20016fi
20017
20018if $test X"$sPRId64" = X -a X"$quadtype" != X; then
20019 $cat >try.c <<EOCP
20020#include <sys/types.h>
20021#include <stdio.h>
20022int main() {
20023 $quadtype q = 12345678901;
20024 printf("%Ld\n", q);
20025}
20026EOCP
20027 set try
20028 if eval $compile; then
20029 yyy=`$run ./try`
20030 case "$yyy" in
20031 12345678901)
20032 sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
20033 sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
20034 echo "We will use %Ld."
20035 ;;
20036 esac
20037 fi
20038fi
20039
20040if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
20041 $cat >try.c <<'EOCP'
20042#include <sys/types.h>
20043#include <stdio.h>
20044int main() {
20045 long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
20046 printf("%lld\n", q);
20047}
20048EOCP
20049 set try
20050 if eval $compile; then
20051 yyy=`$run ./try`
20052 case "$yyy" in
20053 12345678901)
20054 sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
20055 sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
20056 echo "We will use the %lld style."
20057 ;;
20058 esac
20059 fi
20060fi
20061
20062if $test X"$sPRId64" = X -a X"$quadtype" != X; then
20063 $cat >try.c <<EOCP
20064#include <sys/types.h>
20065#include <stdio.h>
20066int main() {
20067 $quadtype q = 12345678901;
20068 printf("%qd\n", q);
20069}
20070EOCP
20071 set try
20072 if eval $compile; then
20073 yyy=`$run ./try`
20074 case "$yyy" in
20075 12345678901)
20076 sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
20077 sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
20078 echo "We will use %qd."
20079 ;;
20080 esac
20081 fi
20082fi
20083
20084if $test X"$sPRId64" = X; then
20085 echo "Cannot figure out how to print 64-bit integers." >&4
20086fi
20087$rm_try
20088
20089fi
20090
20091case "$sPRId64" in
20092'') d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
20093 d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
20094 ;;
20095*) d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
20096 d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
20097 ;;
20098esac
20099
20100: Check format strings for internal types
20101echo " "
20102$echo "Checking the format strings to be used for Perl's internal types..." >&4
20103
20104if $test X"$ivsize" = X8; then
20105 ivdformat="$sPRId64"
20106 uvuformat="$sPRIu64"
20107 uvoformat="$sPRIo64"
20108 uvxformat="$sPRIx64"
20109 uvXUformat="$sPRIXU64"
20110else
20111 if $test X"$ivsize" = X"$longsize"; then
20112 ivdformat='"ld"'
20113 uvuformat='"lu"'
20114 uvoformat='"lo"'
20115 uvxformat='"lx"'
20116 uvXUformat='"lX"'
20117 else
20118 if $test X"$ivsize" = X"$intsize"; then
20119 ivdformat='"d"'
20120 uvuformat='"u"'
20121 uvoformat='"o"'
20122 uvxformat='"x"'
20123 uvXUformat='"X"'
20124 else
20125 : far out
20126 if $test X"$ivsize" = X"$shortsize"; then
20127 ivdformat='"hd"'
20128 uvuformat='"hu"'
20129 uvoformat='"ho"'
20130 uvxformat='"hx"'
20131 uvXUformat='"hX"'
20132 fi
20133 fi
20134 fi
20135fi
20136
20137if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
20138 nveformat="$sPRIeldbl"
20139 nvfformat="$sPRIfldbl"
20140 nvgformat="$sPRIgldbl"
20141 nvEUformat="$sPRIEUldbl"
20142 nvFUformat="$sPRIFUldbl"
20143 nvGUformat="$sPRIGUldbl"
20144else
20145 nveformat='"e"'
20146 nvfformat='"f"'
20147 nvgformat='"g"'
20148 nvEUformat='"E"'
20149 nvFUformat='"F"'
20150 nvGUformat='"G"'
20151fi
20152
20153case "$ivdformat" in
20154'') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
20155 exit 1
20156 ;;
20157esac
20158
20159: Check format string for GID
20160
20161echo " "
20162$echo "Checking the format string to be used for gids..." >&4
20163
20164case "$gidsign" in
20165-1) if $test X"$gidsize" = X"$ivsize"; then
20166 gidformat="$ivdformat"
20167 else
20168 if $test X"$gidsize" = X"$longsize"; then
20169 gidformat='"ld"'
20170 else
20171 if $test X"$gidsize" = X"$intsize"; then
20172 gidformat='"d"'
20173 else
20174 if $test X"$gidsize" = X"$shortsize"; then
20175 gidformat='"hd"'
20176 fi
20177 fi
20178 fi
20179 fi
20180 ;;
20181*) if $test X"$gidsize" = X"$uvsize"; then
20182 gidformat="$uvuformat"
20183 else
20184 if $test X"$gidsize" = X"$longsize"; then
20185 gidformat='"lu"'
20186 else
20187 if $test X"$gidsize" = X"$intsize"; then
20188 gidformat='"u"'
20189 else
20190 if $test X"$gidsize" = X"$shortsize"; then
20191 gidformat='"hu"'
20192 fi
20193 fi
20194 fi
20195 fi
20196 ;;
20197esac
20198
20199: see if getgroups exists
20200set getgroups d_getgrps
20201eval $inlibc
20202
20203: see if setgroups exists
20204set setgroups d_setgrps
20205eval $inlibc
20206
20207: Find type of 2nd arg to 'getgroups()' and 'setgroups()'
20208echo " "
20209case "$d_getgrps$d_setgrps" in
20210*define*)
20211 case "$groupstype" in
20212 '') dflt="$gidtype" ;;
20213 *) dflt="$groupstype" ;;
20214 esac
20215 $cat <<EOM
20216What type of pointer is the second argument to getgroups() and setgroups()?
20217Usually this is the same as group ids, $gidtype, but not always.
20218
20219EOM
20220 rp='What type pointer is the second argument to getgroups() and setgroups()?'
20221 . ./myread
20222 groupstype="$ans"
20223 ;;
20224*) groupstype="$gidtype";;
20225esac
20226
20227: MAD = Misc Attribute Definition
20228
20229if $test $patchlevel -lt 9; then
20230: MAD is not available in 5.8.x or earlier.
20231 ans=n;
20232else
20233 case "$mad" in
20234 $define|true|[yY]*) dflt='y' ;;
20235 *) dflt='n' ;;
20236 esac
20237 cat <<EOM
20238
20239Would you like to build with Misc Attribute Decoration? This is development
20240work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
20241overhead on the interpreter.
20242
20243If this doesn't make any sense to you, just accept the default '$dflt'.
20244EOM
20245 rp='Build Perl with MAD?'
20246 . ./myread
20247fi
20248case "$ans" in
20249y|Y) val="$define"
20250 madlyh='madly.h madly.act madly.tab'
20251 madlysrc='madly.c'
20252 madlyobj="madly$_o" ;;
20253*) val="$undef"
20254 madlyh=''
20255 madlysrc=''
20256 madlyobj='' ;;
20257esac
20258set mad
20259eval $setvar
20260
20261: check whether make sets MAKE
20262echo " "
20263echo "Checking if your $make program sets \$(MAKE)..." >&4
20264case "$make_set_make" in
20265'')
20266 $sed 's/^X //' > testmake.mak << 'EOF'
20267Xall:
20268X @echo 'maketemp="$(MAKE)"'
20269EOF
20270 case "`$make -f testmake.mak 2>/dev/null`" in
20271 *maketemp=*) make_set_make='#' ;;
20272 *) make_set_make="MAKE=$make" ;;
20273 esac
20274 $rm -f testmake.mak
20275 ;;
20276esac
20277case "$make_set_make" in
20278'#') echo "Yup, it does.";;
20279*) echo "Nope, it doesn't.";;
20280esac
20281
20282: see what type is used for mode_t
20283rp="What is the type used for file modes for system calls (e.g. fchmod())?"
20284set mode_t modetype int stdio.h sys/types.h
20285eval $typedef_ask
20286
20287: see if we need va_copy
20288echo " "
20289case "$i_stdarg" in
20290"$define")
20291 $cat >try.c <<EOCP
20292#include <stdarg.h>
20293#include <stdio.h>
20294#$i_stdlib I_STDLIB
20295#ifdef I_STDLIB
20296#include <stdlib.h>
20297#endif
20298#include <signal.h>
20299
20300int
20301ivfprintf(FILE *f, const char *fmt, va_list *valp)
20302{
20303 return vfprintf(f, fmt, *valp);
20304}
20305
20306int
20307myvfprintf(FILE *f, const char *fmt, va_list val)
20308{
20309 return ivfprintf(f, fmt, &val);
20310}
20311
20312int
20313myprintf(char *fmt, ...)
20314{
20315 va_list val;
20316 va_start(val, fmt);
20317 return myvfprintf(stdout, fmt, val);
20318}
20319
20320int
20321main(int ac, char **av)
20322{
20323 signal(SIGSEGV, exit);
20324
20325 myprintf("%s%cs all right, then\n", "that", '\'');
20326 exit(0);
20327}
20328EOCP
20329 set try
20330 if eval $compile && $run ./try 2>&1 >/dev/null; then
20331 case "`$run ./try`" in
20332 "that's all right, then")
20333 okay=yes
20334 ;;
20335 esac
20336 fi
20337 case "$okay" in
20338 yes) echo "It seems that you don't need va_copy()." >&4
20339 need_va_copy="$undef"
20340 ;;
20341 *) echo "It seems that va_copy() or similar will be needed." >&4
20342 need_va_copy="$define"
20343 ;;
20344 esac
20345 $rm_try
20346 ;;
20347*) echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
20348 need_va_copy="$undef"
20349 ;;
20350esac
20351
20352: see what type is used for size_t
20353rp="What is the type used for the length parameter for string functions?"
20354set size_t sizetype 'unsigned int' stdio.h sys/types.h
20355eval $typedef_ask
20356
20357: check for type of arguments to gethostbyaddr.
20358if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
20359 case "$d_gethbyaddr" in
20360 $define)
20361 $cat <<EOM
20362
20363Checking to see what type of arguments are accepted by gethostbyaddr().
20364EOM
20365 hdrs="$define sys/types.h
20366 $d_socket sys/socket.h
20367 $i_niin netinet/in.h
20368 $i_netdb netdb.h
20369 $i_unistd unistd.h"
20370 : The first arg can 'char *' or 'void *'
20371 : The second arg is some of integral type
20372 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
20373 for yyy in size_t long int; do
20374 case "$netdb_host_type" in
20375 '') try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
20376 if ./protochk "$try" $hdrs; then
20377 echo "Your system accepts $xxx for the first arg."
20378 echo "...and $yyy for the second arg."
20379 netdb_host_type="$xxx"
20380 netdb_hlen_type="$yyy"
20381 fi
20382 ;;
20383 esac
20384 done
20385 done
20386 : In case none of those worked, prompt the user.
20387 case "$netdb_host_type" in
20388 '') rp='What is the type for the 1st argument to gethostbyaddr?'
20389 dflt='char *'
20390 . ./myread
20391 netdb_host_type=$ans
20392 rp='What is the type for the 2nd argument to gethostbyaddr?'
20393 dflt="$sizetype"
20394 . ./myread
20395 netdb_hlen_type=$ans
20396 ;;
20397 esac
20398 ;;
20399 *) : no gethostbyaddr, so pick harmless defaults
20400 netdb_host_type='char *'
20401 netdb_hlen_type="$sizetype"
20402 ;;
20403 esac
20404 # Remove the "const" if needed. -- but then we'll have a
20405 # prototype clash!
20406 # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
20407fi
20408
20409: check for type of argument to gethostbyname.
20410if test "X$netdb_name_type" = X ; then
20411 case "$d_gethbyname" in
20412 $define)
20413 $cat <<EOM
20414
20415Checking to see what type of argument is accepted by gethostbyname().
20416EOM
20417 hdrs="$define sys/types.h
20418 $d_socket sys/socket.h
20419 $i_niin netinet/in.h
20420 $i_netdb netdb.h
20421 $i_unistd unistd.h"
20422 for xxx in "const char *" "char *"; do
20423 case "$netdb_name_type" in
20424 '') try="$extern_C struct hostent *gethostbyname($xxx);"
20425 if ./protochk "$try" $hdrs; then
20426 echo "Your system accepts $xxx."
20427 netdb_name_type="$xxx"
20428 fi
20429 ;;
20430 esac
20431 done
20432 : In case none of those worked, prompt the user.
20433 case "$netdb_name_type" in
20434 '') rp='What is the type for the 1st argument to gethostbyname?'
20435 dflt='char *'
20436 . ./myread
20437 netdb_name_type=$ans
20438 ;;
20439 esac
20440 ;;
20441 *) : no gethostbyname, so pick harmless default
20442 netdb_name_type='char *'
20443 ;;
20444 esac
20445fi
20446
20447: check for type of 1st argument to getnetbyaddr.
20448if test "X$netdb_net_type" = X ; then
20449 case "$d_getnbyaddr" in
20450 $define)
20451 $cat <<EOM
20452
20453Checking to see what type of 1st argument is accepted by getnetbyaddr().
20454EOM
20455 hdrs="$define sys/types.h
20456 $d_socket sys/socket.h
20457 $i_niin netinet/in.h
20458 $i_netdb netdb.h
20459 $i_unistd unistd.h"
20460 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
20461 case "$netdb_net_type" in
20462 '') try="$extern_C struct netent *getnetbyaddr($xxx, int);"
20463 if ./protochk "$try" $hdrs; then
20464 echo "Your system accepts $xxx."
20465 netdb_net_type="$xxx"
20466 fi
20467 ;;
20468 esac
20469 done
20470 : In case none of those worked, prompt the user.
20471 case "$netdb_net_type" in
20472 '') rp='What is the type for the 1st argument to getnetbyaddr?'
20473 dflt='long'
20474 . ./myread
20475 netdb_net_type=$ans
20476 ;;
20477 esac
20478 ;;
20479 *) : no getnetbyaddr, so pick harmless default
20480 netdb_net_type='long'
20481 ;;
20482 esac
20483fi
20484: locate the preferred pager for this system
20485fn=f/
20486case "$pager" in
20487'')
20488 dflt=''
20489 case "$pg" in
20490 /*) dflt=$pg;;
20491 [a-zA-Z]:/*) dflt=$pg;;
20492 esac
20493 case "$more" in
20494 /*) dflt=$more;;
20495 [a-zA-Z]:/*) dflt=$more;;
20496 esac
20497 case "$less" in
20498 /*) dflt=$less;;
20499 [a-zA-Z]:/*) dflt=$less;;
20500 esac
20501 case "$dflt" in
20502 '') dflt=/usr/ucb/more;;
20503 esac
20504 ;;
20505*) dflt="$pager"
20506 ;;
20507esac
20508fn="f/($dflt)"
20509echo " "
20510rp='What pager is used on your system?'
20511. ./getfile
20512pager="$ans"
20513
20514: see what type pids are declared as in the kernel
20515rp="What is the type of process ids on this system?"
20516set pid_t pidtype int stdio.h sys/types.h
20517eval $typedef_ask
20518
20519: see if ar generates random libraries by itself
20520echo " "
20521echo "Checking how to generate random libraries on your machine..." >&4
20522echo 'int bar1() { return bar2(); }' > bar1.c
20523echo 'int bar2() { return 2; }' > bar2.c
20524$cat > foo.c <<EOP
20525#$i_stdlib I_STDLIB
20526#ifdef I_STDLIB
20527#include <stdlib.h>
20528#endif
20529int main() { printf("%d\n", bar1()); exit(0); }
20530EOP
20531$cc $ccflags -c bar1.c >/dev/null 2>&1
20532$cc $ccflags -c bar2.c >/dev/null 2>&1
20533$cc $ccflags -c foo.c >/dev/null 2>&1
20534$ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
20535if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20536 $run ./foobar >/dev/null 2>&1; then
20537 echo "$ar appears to generate random libraries itself."
20538 orderlib=false
20539 if [ "X$ranlib" = "X" ]; then
20540 ranlib=":"
20541 fi
20542elif $ar s bar$_a >/dev/null 2>&1 &&
20543 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20544 $run ./foobar >/dev/null 2>&1; then
20545 echo "a table of contents needs to be added with '$ar s'."
20546 orderlib=false
20547 ranlib="$ar s"
20548elif $ar ts bar$_a >/dev/null 2>&1 &&
20549 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20550 $run ./foobar >/dev/null 2>&1; then
20551 echo "a table of contents needs to be added with '$ar ts'."
20552 orderlib=false
20553 ranlib="$ar ts"
20554else
20555 case "$ranlib" in
20556 :) ranlib='';;
20557 '')
20558 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
20559 $test -f $ranlib || ranlib=''
20560 ;;
20561 esac
20562 if $test -n "$ranlib"; then
20563 echo "your system has '$ranlib'; we'll use that."
20564 orderlib=false
20565 else
20566 echo "your system doesn't seem to support random libraries"
20567 echo "so we'll use lorder and tsort to order the libraries."
20568 orderlib=true
20569 ranlib=":"
20570 fi
20571fi
20572$rm -f foo* bar*
20573
20574: see if this is a values.h system
20575set values.h i_values
20576eval $inhdr
20577
20578: Check the max offset that gmtime and localtime accept
20579echo "Checking max offsets that gmtime () accepts"
20580
20581case $i_values in
20582 define) yyy="#include <values.h>" ;;
20583 *) yyy="" ;;
20584 esac
20585
20586case "$sGMTIME_min/$sGMTIME_max" in
20587 0/0|/)
20588 $cat >try.c <<EOCP
20589#include <sys/types.h>
20590#include <stdio.h>
20591#include <time.h>
20592$yyy
20593
20594int i;
20595struct tm *tmp;
20596time_t pt;
20597
20598void gm_check (time_t t, int min_year, int max_year)
20599{
20600 tmp = gmtime (&t);
20601 if ( tmp == NULL ||
20602 /* Check tm_year overflow */
20603 tmp->tm_year < min_year || tmp->tm_year > max_year)
20604 tmp = NULL;
20605 else
20606 pt = t;
20607 } /* gm_check */
20608
20609int check_max ()
20610{
20611 tmp = NULL;
20612 pt = 0;
20613#ifdef MAXLONG
20614 gm_check (MAXLONG, 69, 0x7fffffff);
20615#endif
20616 if (tmp == NULL || tmp->tm_year < 0) {
20617 for (i = 63; i >= 0; i--) {
20618 time_t x = pt | ((time_t)1 << i);
20619 if (x < 0 || x < pt) continue;
20620 gm_check (x, 69, 0x7fffffff);
20621 }
20622 }
20623 printf ("sGMTIME_max=%ld\n", pt);
20624 return (0);
20625 } /* check_max */
20626
20627int check_min ()
20628{
20629 tmp = NULL;
20630 pt = 0;
20631#ifdef MINLONG
20632 gm_check (MINLONG, -1900, 70);
20633#endif
20634 if (tmp == NULL) {
20635 for (i = 36; i >= 0; i--) {
20636 time_t x = pt - ((time_t)1 << i);
20637 if (x > 0) continue;
20638 gm_check (x, -1900, 70);
20639 }
20640 }
20641 printf ("sGMTIME_min=%ld\n", pt);
20642 return (0);
20643 } /* check_min */
20644
20645int main (int argc, char *argv[])
20646{
20647 fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
20648 check_max ();
20649 check_min ();
20650 return (0);
20651 } /* main */
20652EOCP
20653 set try
20654 if eval $compile; then
20655 eval `$run ./try`
20656 else
20657 echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
20658 fi
20659 $rm_try
20660 ;;
20661 esac
20662
20663echo "Checking max offsets that localtime () accepts"
20664
20665case "$sLOCALTIME_min/$sLOCALTIME_max" in
20666 0/0|/)
20667 $cat >try.c <<EOCP
20668#include <sys/types.h>
20669#include <stdio.h>
20670#include <time.h>
20671$yyy
20672
20673int i;
20674struct tm *tmp;
20675time_t pt;
20676
20677void local_check (time_t t, int min_year, int max_year)
20678{
20679 if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
20680 tmp = NULL;
20681 else
20682 tmp = localtime (&t);
20683 if ( tmp == NULL ||
20684 /* Check tm_year overflow */
20685 tmp->tm_year < min_year || tmp->tm_year > max_year)
20686 tmp = NULL;
20687 else
20688 pt = t;
20689 } /* local_check */
20690
20691int check_max ()
20692{
20693 tmp = NULL;
20694 pt = 0;
20695#ifdef MAXLONG
20696 local_check (MAXLONG, 69, 0x7fffffff);
20697#endif
20698 if (tmp == NULL || tmp->tm_year < 0) {
20699 for (i = 63; i >= 0; i--) {
20700 time_t x = pt | ((time_t)1 << i);
20701 if (x < 0 || x < pt) continue;
20702 local_check (x, 69, 0x7fffffff);
20703 }
20704 }
20705 printf ("sLOCALTIME_max=%ld\n", pt);
20706 return (0);
20707 } /* check_max */
20708
20709int check_min ()
20710{
20711 tmp = NULL;
20712 pt = 0;
20713#ifdef MINLONG
20714 local_check (MINLONG, -1900, 70);
20715#endif
20716 if (tmp == NULL) {
20717 for (i = 36; i >= 0; i--) {
20718 time_t x = pt - ((time_t)1 << i);
20719 if (x > 0) continue;
20720 local_check (x, -1900, 70);
20721 }
20722 }
20723 printf ("sLOCALTIME_min=%ld\n", pt);
20724 return (0);
20725 } /* check_min */
20726
20727int main (int argc, char *argv[])
20728{
20729 check_max ();
20730 check_min ();
20731 return (0);
20732 } /* main */
20733EOCP
20734 set try
20735 if eval $compile; then
20736 eval `$run ./try`
20737 else
20738 echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
20739 fi
20740 $rm_try
20741 ;;
20742 esac
20743
20744: check for type of arguments to select.
20745case "$selecttype" in
20746'') case "$d_select" in
20747 $define)
20748 echo " "
20749 $cat <<EOM
20750Checking to see what type of arguments are accepted by select().
20751EOM
20752 hdrs="$define sys/types.h
20753 $i_systime sys/time.h
20754 $i_sysselct sys/select.h
20755 $d_socket sys/socket.h"
20756 : The first arg can be int, unsigned, or size_t
20757 : The last arg may or may not be 'const'
20758 val=''
20759 : void pointer has been seen but using that
20760 : breaks the selectminbits test
20761 for xxx in 'fd_set *' 'int *'; do
20762 for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20763 for tmo in 'struct timeval *' 'const struct timeval *'; do
20764 case "$val" in
20765 '') try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
20766 if ./protochk "$try" $hdrs; then
20767 echo "Your system accepts $xxx."
20768 val="$xxx"
20769 fi
20770 ;;
20771 esac
20772 done
20773 done
20774 done
20775 case "$val" in
20776 '') rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20777 case "$d_fd_set" in
20778 $define) dflt="fd_set *" ;;
20779 *) dflt="int *" ;;
20780 esac
20781 . ./myread
20782 val=$ans
20783 ;;
20784 esac
20785 selecttype="$val"
20786 ;;
20787 *) : no select, so pick a harmless default
20788 selecttype='int *'
20789 ;;
20790 esac
20791 ;;
20792esac
20793
20794: check for the select 'width'
20795case "$selectminbits" in
20796'') safebits=`expr $ptrsize \* 8`
20797 case "$d_select" in
20798 $define)
20799 $cat <<EOM
20800
20801Checking to see on how many bits at a time your select() operates...
20802EOM
20803 $cat >try.c <<EOCP
20804#include <sys/types.h>
20805#$i_time I_TIME
20806#$i_systime I_SYS_TIME
20807#$i_systimek I_SYS_TIME_KERNEL
20808#ifdef I_TIME
20809# include <time.h>
20810#endif
20811#ifdef I_SYS_TIME
20812# ifdef I_SYS_TIME_KERNEL
20813# define KERNEL
20814# endif
20815# include <sys/time.h>
20816# ifdef I_SYS_TIME_KERNEL
20817# undef KERNEL
20818# endif
20819#endif
20820#$i_sysselct I_SYS_SELECT
20821#ifdef I_SYS_SELECT
20822#include <sys/select.h>
20823#endif
20824#$d_socket HAS_SOCKET
20825#ifdef HAS_SOCKET
20826# include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20827#endif
20828#include <stdio.h>
20829#$i_stdlib I_STDLIB
20830#ifdef I_STDLIB
20831#include <stdlib.h>
20832#endif
20833$selecttype b;
20834#define S sizeof(*(b))
20835#define MINBITS 64
20836#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20837#define NBITS (NBYTES * 8)
20838int main() {
20839 char *s = (char *)malloc(NBYTES);
20840 struct timeval t;
20841 int i;
20842 FILE* fp;
20843 int fd;
20844
20845 if (!s)
20846 exit(1);
20847 fclose(stdin);
20848 fp = fopen("try.c", "r");
20849 if (fp == 0)
20850 exit(2);
20851 fd = fileno(fp);
20852 if (fd < 0)
20853 exit(3);
20854 b = ($selecttype)s;
20855 for (i = 0; i < NBITS; i++)
20856 FD_SET(i, b);
20857 t.tv_sec = 0;
20858 t.tv_usec = 0;
20859 select(fd + 1, b, 0, 0, &t);
20860 for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
20861 free(s);
20862 printf("%d\n", i + 1);
20863 return 0;
20864}
20865EOCP
20866 set try
20867 if eval $compile_ok; then
20868 selectminbits=`$run ./try`
20869 case "$selectminbits" in
20870 '') cat >&4 <<EOM
20871Cannot figure out on how many bits at a time your select() operates.
20872I'll play safe and guess it is $safebits bits.
20873EOM
20874 selectminbits=$safebits
20875 bits="$safebits bits"
20876 ;;
20877 1) bits="1 bit" ;;
20878 *) bits="$selectminbits bits" ;;
20879 esac
20880 echo "Your select() operates on $bits at a time." >&4
20881 else
20882 rp='What is the minimum number of bits your select() operates on?'
20883 case "$byteorder" in
20884 12345678) dflt=64 ;;
20885 1234) dflt=32 ;;
20886 *) dflt=1 ;;
20887 esac
20888 . ./myread
20889 val=$ans
20890 selectminbits="$val"
20891 fi
20892 $rm_try
20893 ;;
20894 *) : no select, so pick a harmless default
20895 selectminbits=$safebits
20896 ;;
20897 esac
20898 ;;
20899esac
20900
20901: Trace out the files included by signal.h, then look for SIGxxx names.
20902if [ "X$fieldn" = X ]; then
20903 : Just make some guesses. We check them later.
20904 xxx="$sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h"
20905else
20906 xxx=`echo '#include <signal.h>' |
20907 $cppstdin $cppminus $cppflags 2>/dev/null |
20908 $grep '^[ ]*#.*include' |
20909 $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20910 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
20911fi
20912xxxfiles=''
20913for xx in $xxx /dev/null ; do
20914 $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20915done
20916case "$xxxfiles" in
20917'') xxxfiles=`./findhdr signal.h` ;;
20918esac
20919xxx=`awk '
20920$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20921 print substr($2, 4, 20)
20922}
20923$1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20924 print substr($3, 4, 20)
20925}' $xxxfiles`
20926: Append some common names just in case the awk scan failed.
20927xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20928xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20929xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20930xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20931xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20932
20933: generate a few handy files for later
20934$cat > signal.c <<EOCP
20935#include <sys/types.h>
20936#include <signal.h>
20937#$i_stdlib I_STDLIB
20938#ifdef I_STDLIB
20939#include <stdlib.h>
20940#endif
20941#include <stdio.h>
20942int main() {
20943
20944/* Strange style to avoid deeply-nested #if/#else/#endif */
20945#ifndef NSIG
20946# ifdef _NSIG
20947# define NSIG (_NSIG)
20948# endif
20949#endif
20950
20951#ifndef NSIG
20952# ifdef SIGMAX
20953# define NSIG (SIGMAX+1)
20954# endif
20955#endif
20956
20957#ifndef NSIG
20958# ifdef SIG_MAX
20959# define NSIG (SIG_MAX+1)
20960# endif
20961#endif
20962
20963#ifndef NSIG
20964# ifdef _SIG_MAX
20965# define NSIG (_SIG_MAX+1)
20966# endif
20967#endif
20968
20969#ifndef NSIG
20970# ifdef MAXSIG
20971# define NSIG (MAXSIG+1)
20972# endif
20973#endif
20974
20975#ifndef NSIG
20976# ifdef MAX_SIG
20977# define NSIG (MAX_SIG+1)
20978# endif
20979#endif
20980
20981#ifndef NSIG
20982# ifdef SIGARRAYSIZE
20983# define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
20984# endif
20985#endif
20986
20987#ifndef NSIG
20988# ifdef _sys_nsig
20989# define NSIG (_sys_nsig) /* Solaris 2.5 */
20990# endif
20991#endif
20992
20993/* Default to some arbitrary number that's big enough to get most
20994 of the common signals.
20995*/
20996#ifndef NSIG
20997# define NSIG 50
20998#endif
20999
21000printf("NSIG %d\n", NSIG);
21001
21002#ifndef JUST_NSIG
21003
21004EOCP
21005
21006echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
21007{
21008 printf "#ifdef SIG"; printf $1; printf "\n"
21009 printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
21010 printf $1; printf ");\n"
21011 printf "#endif\n"
21012}
21013END {
21014 printf "#endif /* JUST_NSIG */\n";
21015 printf "exit(0);\n}\n";
21016}
21017' >>signal.c
21018$cat >signal.awk <<'EOP'
21019BEGIN { ndups = 0 }
21020$1 ~ /^NSIG$/ { nsig = $2 }
21021($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
21022 if ($2 > maxsig) { maxsig = $2 }
21023 if (sig_name[$2]) {
21024 dup_name[ndups] = $1
21025 dup_num[ndups] = $2
21026 ndups++
21027 }
21028 else {
21029 sig_name[$2] = $1
21030 sig_num[$2] = $2
21031 }
21032}
21033END {
21034 if (nsig == 0) {
21035 nsig = maxsig + 1
21036 }
21037 printf("NSIG %d\n", nsig);
21038 for (n = 1; n < nsig; n++) {
21039 if (sig_name[n]) {
21040 printf("%s %d\n", sig_name[n], sig_num[n])
21041 }
21042 else {
21043 printf("NUM%d %d\n", n, n)
21044 }
21045 }
21046 for (n = 0; n < ndups; n++) {
21047 printf("%s %d\n", dup_name[n], dup_num[n])
21048 }
21049}
21050EOP
21051$cat >signal_cmd <<EOS
21052$startsh
21053if $test -s signal.lst; then
21054 echo "Using your existing signal.lst file"
21055 exit 0
21056fi
21057xxx="$xxx"
21058EOS
21059$cat >>signal_cmd <<'EOS'
21060
21061set signal
21062if eval $compile_ok; then
21063 $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
21064 $uniq | $awk -f signal.awk >signal.lst
21065else
21066 echo "(I can't seem be able to compile the whole test program)" >&4
21067 echo "(I'll try it in little pieces.)" >&4
21068 set signal -DJUST_NSIG
21069 if eval $compile_ok; then
21070 $run ./signal$_exe > signal.nsg
21071 $cat signal.nsg
21072 else
21073 echo "I can't seem to figure out how many signals you have." >&4
21074 echo "Guessing 50." >&4
21075 echo 'NSIG 50' > signal.nsg
21076 fi
21077 : Now look at all the signal names, one at a time.
21078 for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
21079 $cat > signal.c <<EOCP
21080#include <sys/types.h>
21081#include <signal.h>
21082#include <stdio.h>
21083int main() {
21084printf("$xx %d\n", SIG${xx});
21085return 0;
21086}
21087EOCP
21088 set signal
21089 if eval $compile; then
21090 echo "SIG${xx} found."
21091 $run ./signal$_exe >> signal.ls1
21092 else
21093 echo "SIG${xx} NOT found."
21094 fi
21095 done
21096 if $test -s signal.ls1; then
21097 $cat signal.nsg signal.ls1 |
21098 $sort -n | $uniq | $awk -f signal.awk >signal.lst
21099 fi
21100
21101fi
21102if $test -s signal.lst; then
21103 :
21104else
21105 echo "(AAK! I can't compile the test programs -- Guessing)" >&4
21106 echo 'kill -l' >signal
21107 set X `csh -f <signal`
21108 $rm -f signal
21109 shift
21110 case $# in
21111 0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
21112 esac
21113 echo $@ | $tr ' ' $trnl | \
21114 $awk '{ printf "%s %d\n", $1, ++s; }
21115 END { printf "NSIG %d\n", ++s }' >signal.lst
21116fi
21117$rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
21118EOS
21119chmod a+x signal_cmd
21120$eunicefix signal_cmd
21121
21122: generate list of signal names
21123echo " "
21124case "$sig_name_init" in
21125'') doinit=yes ;;
21126*) case "$sig_num_init" in
21127 ''|*,*) doinit=yes ;;
21128 esac ;;
21129esac
21130case "$doinit" in
21131yes)
21132 echo "Generating a list of signal names and numbers..." >&4
21133 . ./signal_cmd
21134 sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
21135 sig_name=`$awk 'BEGIN { printf "ZERO " }
21136 !/^NSIG/ { printf "%s ", $1 }' signal.lst`
21137 sig_num=`$awk 'BEGIN { printf "0 " }
21138 !/^NSIG/ { printf "%d ", $2 }' signal.lst`
21139 sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
21140 !/^NSIG/ { printf "\"%s\", ", $1 }
21141 END { printf "0\n" }' signal.lst`
21142 sig_num_init=`$awk 'BEGIN { printf "0, " }
21143 !/^NSIG/ { printf "%d, ", $2}
21144 END { printf "0\n"}' signal.lst`
21145 ;;
21146esac
21147echo "The following $sig_count signals are available:"
21148echo " "
21149echo $sig_name | $awk \
21150'BEGIN { linelen = 0 }
21151{
21152 for (i = 1; i <= NF; i++) {
21153 name = "SIG" $i " "
21154 linelen = linelen + length(name)
21155 if (linelen > 70) {
21156 printf "\n"
21157 linelen = length(name)
21158 }
21159 printf "%s", name
21160 }
21161 printf "\n"
21162}'
21163sig_size=`echo $sig_name | awk '{print NF}'`
21164$rm -f signal signal.c signal.awk signal.lst signal_cmd
21165
21166: Check size of size
21167echo " "
21168case "$sizetype" in
21169*_t) zzz="$sizetype" ;;
21170*) zzz="filesize" ;;
21171esac
21172echo "Checking the size of $zzz..." >&4
21173cat > try.c <<EOCP
21174#include <sys/types.h>
21175#include <stdio.h>
21176#$i_stdlib I_STDLIB
21177#ifdef I_STDLIB
21178#include <stdlib.h>
21179#endif
21180int main() {
21181 printf("%d\n", (int)sizeof($sizetype));
21182 exit(0);
21183}
21184EOCP
21185set try
21186if eval $compile_ok; then
21187 yyy=`$run ./try`
21188 case "$yyy" in
21189 '') sizesize=4
21190 echo "(I can't execute the test program--guessing $sizesize.)" >&4
21191 ;;
21192 *) sizesize=$yyy
21193 echo "Your $zzz size is $sizesize bytes."
21194 ;;
21195 esac
21196else
21197 sizesize=4
21198 echo "(I can't compile the test program--guessing $sizesize.)" >&4
21199fi
21200
21201
21202: check for socklen_t
21203echo " "
21204echo "Checking to see if you have socklen_t..." >&4
21205$cat >try.c <<EOCP
21206#include <sys/types.h>
21207#$d_socket HAS_SOCKET
21208#ifdef HAS_SOCKET
21209#include <sys/socket.h>
21210#endif
21211int main() { socklen_t x = 16; }
21212EOCP
21213set try
21214if eval $compile; then
21215 val="$define"
21216 echo "You have socklen_t."
21217else
21218 val="$undef"
21219 echo "You do not have socklen_t."
21220 case "$sizetype" in
21221 size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
21222 esac
21223fi
21224$rm_try
21225set d_socklen_t
21226eval $setvar
21227
21228: see if this is a socks.h system
21229set socks.h i_socks
21230eval $inhdr
21231
21232: check for type of the size argument to socket calls
21233case "$d_socket" in
21234"$define")
21235 $cat <<EOM
21236
21237Checking to see what type is the last argument of accept().
21238EOM
21239 yyy=''
21240 case "$d_socklen_t" in
21241 "$define") yyy="$yyy socklen_t"
21242 esac
21243 yyy="$yyy $sizetype int long unsigned"
21244 for xxx in $yyy; do
21245 case "$socksizetype" in
21246 '') try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
21247 case "$usesocks" in
21248 "$define")
21249 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
21250 echo "Your system accepts '$xxx *' for the last argument of accept()."
21251 socksizetype="$xxx"
21252 fi
21253 ;;
21254 *) if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h; then
21255 echo "Your system accepts '$xxx *' for the last argument of accept()."
21256 socksizetype="$xxx"
21257 fi
21258 ;;
21259 esac
21260 ;;
21261 esac
21262 done
21263: In case none of those worked, prompt the user.
21264 case "$socksizetype" in
21265 '') rp='What is the type for socket address structure sizes?'
21266 dflt='int'
21267 . ./myread
21268 socksizetype=$ans
21269 ;;
21270 esac
21271 ;;
21272*) : no sockets, so pick relatively harmless default
21273 socksizetype='int'
21274 ;;
21275esac
21276
21277: see what type is used for signed size_t
21278set ssize_t ssizetype int stdio.h sys/types.h
21279eval $typedef
21280dflt="$ssizetype"
21281$cat > try.c <<EOM
21282#include <stdio.h>
21283#$i_stdlib I_STDLIB
21284#ifdef I_STDLIB
21285#include <stdlib.h>
21286#endif
21287#include <sys/types.h>
21288#define Size_t $sizetype
21289#define SSize_t $dflt
21290int main()
21291{
21292 if (sizeof(Size_t) == sizeof(SSize_t))
21293 printf("$dflt\n");
21294 else if (sizeof(Size_t) == sizeof(int))
21295 printf("int\n");
21296 else
21297 printf("long\n");
21298 exit(0);
21299}
21300EOM
21301echo " "
21302set try
21303if eval $compile_ok && $run ./try > /dev/null; then
21304 ssizetype=`$run ./try`
21305 echo "I'll be using $ssizetype for functions returning a byte count." >&4
21306else
21307 $cat >&4 <<EOM
21308Help! I can't compile and run the ssize_t test program: please enlighten me!
21309(This is probably a misconfiguration in your system or libraries, and
21310you really ought to fix it. Still, I'll try anyway.)
21311
21312I need a type that is the same size as $sizetype, but is guaranteed to
21313be signed. Common values are ssize_t, int and long.
21314
21315EOM
21316 rp="What signed type is the same size as $sizetype?"
21317 . ./myread
21318 ssizetype="$ans"
21319fi
21320$rm_try
21321
21322: Check the size of st_ino
21323$echo " "
21324$echo "Checking the size of st_ino..." >&4
21325$cat > try.c <<EOCP
21326#include <sys/stat.h>
21327#include <stdio.h>
21328#$i_stdlib I_STDLIB
21329#ifdef I_STDLIB
21330#include <stdlib.h>
21331#endif
21332int main() {
21333 struct stat st;
21334 printf("%d\n", (int)sizeof(st.st_ino));
21335 exit(0);
21336}
21337EOCP
21338set try
21339if eval $compile_ok; then
21340 val=`$run ./try`
21341 case "$val" in
21342 '') st_ino_size=4
21343 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
21344 ;;
21345 *) st_ino_size=$val
21346 $echo "Your st_ino is $st_ino_size bytes long."
21347 ;;
21348 esac
21349else
21350 st_ino_size=4
21351 $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
21352fi
21353$rm_try
21354
21355: Check if st_ino is signed
21356$echo " "
21357$echo "Checking the sign of st_ino..." >&4
21358$cat > try.c <<EOCP
21359#include <sys/stat.h>
21360#include <stdio.h>
21361int main() {
21362 struct stat foo;
21363 foo.st_ino = -1;
21364 if (foo.st_ino < 0)
21365 printf("-1\n");
21366 else
21367 printf("1\n");
21368}
21369EOCP
21370set try
21371if eval $compile; then
21372 val=`$run ./try`
21373 case "$val" in
21374 '') st_ino_sign=1
21375 $echo "(I can't execute the test program--guessing unsigned.)" >&4
21376 ;;
21377 *) st_ino_sign=$val
21378 case "$st_ino_sign" in
21379 1) $echo "Your st_ino is unsigned." ;;
21380 -1) $echo "Your st_ino is signed." ;;
21381 esac
21382 ;;
21383 esac
21384else
21385 st_ino_sign=1
21386 $echo "(I can't compile the test program--guessing unsigned.)" >&4
21387fi
21388$rm_try
21389
21390: see what type of char stdio uses.
21391echo " "
21392echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
21393if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
21394 echo "Your stdio uses unsigned chars." >&4
21395 stdchar="unsigned char"
21396else
21397 echo "Your stdio uses signed chars." >&4
21398 stdchar="char"
21399fi
21400$rm -f stdioh
21401
21402: see what type uids are declared as in the kernel
21403echo " "
21404echo "Looking for the type for user ids returned by getuid()."
21405set uid_t uidtype xxx stdio.h sys/types.h
21406eval $typedef
21407case "$uidtype" in
21408xxx)
21409 xxx=`./findhdr sys/user.h`
21410 set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
21411 case $1 in
21412 unsigned) dflt="$1 $2" ;;
21413 *) dflt="$1" ;;
21414 esac
21415 ;;
21416*) dflt="$uidtype";;
21417esac
21418case "$uidtype" in
21419uid_t) echo "uid_t found." ;;
21420*) rp="What is the type for user ids returned by getuid()?"
21421 . ./myread
21422 uidtype="$ans"
21423 ;;
21424esac
21425
21426: Check size of UID
21427echo " "
21428case "$uidtype" in
21429*_t) zzz="$uidtype" ;;
21430*) zzz="uid" ;;
21431esac
21432echo "Checking the size of $zzz..." >&4
21433cat > try.c <<EOCP
21434#include <sys/types.h>
21435#include <stdio.h>
21436#$i_stdlib I_STDLIB
21437#ifdef I_STDLIB
21438#include <stdlib.h>
21439#endif
21440int main() {
21441 printf("%d\n", (int)sizeof($uidtype));
21442 exit(0);
21443}
21444EOCP
21445set try
21446if eval $compile_ok; then
21447 yyy=`$run ./try`
21448 case "$yyy" in
21449 '') uidsize=4
21450 echo "(I can't execute the test program--guessing $uidsize.)" >&4
21451 ;;
21452 *) uidsize=$yyy
21453 echo "Your $zzz is $uidsize bytes long."
21454 ;;
21455 esac
21456else
21457 uidsize=4
21458 echo "(I can't compile the test program--guessing $uidsize.)" >&4
21459fi
21460
21461: Check if UID is signed
21462echo " "
21463case "$uidtype" in
21464*_t) zzz="$uidtype" ;;
21465*) zzz="uid" ;;
21466esac
21467echo "Checking the sign of $zzz..." >&4
21468cat > try.c <<EOCP
21469#include <sys/types.h>
21470#include <stdio.h>
21471int main() {
21472 $uidtype foo = -1;
21473 if (foo < 0)
21474 printf("-1\n");
21475 else
21476 printf("1\n");
21477}
21478EOCP
21479set try
21480if eval $compile; then
21481 yyy=`$run ./try`
21482 case "$yyy" in
21483 '') uidsign=1
21484 echo "(I can't execute the test program--guessing unsigned.)" >&4
21485 ;;
21486 *) uidsign=$yyy
21487 case "$uidsign" in
21488 1) echo "Your $zzz is unsigned." ;;
21489 -1) echo "Your $zzz is signed." ;;
21490 esac
21491 ;;
21492 esac
21493else
21494 uidsign=1
21495 echo "(I can't compile the test program--guessing unsigned.)" >&4
21496fi
21497
21498
21499: Check format string for UID
21500echo " "
21501$echo "Checking the format string to be used for uids..." >&4
21502
21503case "$uidsign" in
21504-1) if $test X"$uidsize" = X"$ivsize"; then
21505 uidformat="$ivdformat"
21506 else
21507 if $test X"$uidsize" = X"$longsize"; then
21508 uidformat='"ld"'
21509 else
21510 if $test X"$uidsize" = X"$intsize"; then
21511 uidformat='"d"'
21512 else
21513 if $test X"$uidsize" = X"$shortsize"; then
21514 uidformat='"hd"'
21515 fi
21516 fi
21517 fi
21518 fi
21519 ;;
21520*) if $test X"$uidsize" = X"$uvsize"; then
21521 uidformat="$uvuformat"
21522 else
21523 if $test X"$uidsize" = X"$longsize"; then
21524 uidformat='"lu"'
21525 else
21526 if $test X"$uidsize" = X"$intsize"; then
21527 uidformat='"u"'
21528 else
21529 if $test X"$uidsize" = X"$shortsize"; then
21530 uidformat='"hu"'
21531 fi
21532 fi
21533 fi
21534 fi
21535 ;;
21536esac
21537
21538: Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
21539echo " "
21540echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
21541$cat >try.c <<'EOM'
21542/* Intentionally a long probe as I'd like to sanity check that the exact
21543 approach is going to work, as thinking it will work, but only having it
21544 part working at runtime is worse than not having it. */
21545
21546#include <sys/types.h>
21547#include <sys/sysctl.h>
21548#include <sys/param.h>
21549#include <stdio.h>
21550#include <string.h>
21551#include <stdlib.h>
21552#include <unistd.h>
21553
21554int
21555main(int argc, char **argv) {
21556 char *buffer;
21557 char *argv_leaf = strrchr(argv[0], '/');
21558 char *buffer_leaf;
21559 size_t size = 0;
21560 int mib[4];
21561
21562 mib[0] = CTL_KERN;
21563 mib[1] = KERN_PROC;
21564 mib[2] = KERN_PROC_PATHNAME;
21565 mib[3] = -1;
21566
21567 if (!argv_leaf) {
21568 fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21569 return 1;
21570 }
21571
21572 if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
21573 perror("sysctl");
21574 return 2;
21575 }
21576
21577 if (size < strlen(argv_leaf) + 1) {
21578 fprintf(stderr, "size %lu is too short for a path\n",
21579 (unsigned long) size);
21580 return 3;
21581 }
21582
21583 if (size > MAXPATHLEN * MAXPATHLEN) {
21584 fprintf(stderr, "size %lu is too long for a path\n",
21585 (unsigned long) size);
21586 return 4;
21587 }
21588
21589 buffer = malloc(size);
21590 if (!buffer) {
21591 perror("malloc");
21592 return 5;
21593 }
21594
21595 if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
21596 perror("sysctl");
21597 return 6;
21598 }
21599
21600 if (strlen(buffer) + 1 != size) {
21601 fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
21602 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
21603 return 7;
21604 }
21605
21606
21607 if (*buffer != '/') {
21608 fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
21609 return 8;
21610 }
21611
21612 if (strstr(buffer, "/./")) {
21613 fprintf(stderr, "Contains /./: '%s'\n", buffer);
21614 return 9;
21615 }
21616
21617 if (strstr(buffer, "/../")) {
21618 fprintf(stderr, "Contains /../: '%s'\n", buffer);
21619 return 10;
21620 }
21621
21622 buffer_leaf = strrchr(buffer, '/');
21623 if (strcmp(buffer_leaf, argv_leaf) != 0) {
21624 fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
21625 return 11;
21626 }
21627
21628 free(buffer);
21629
21630 return 0;
21631}
21632EOM
21633
21634val=$undef
21635set try
21636if eval $compile; then
21637 if $run ./try; then
21638 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
21639 val="$define"
21640 else
21641 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
21642 val="$undef"
21643 fi
21644else
21645 echo "I'm unable to compile the test program." >&4
21646 echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
21647 val="$undef"
21648fi
21649$rm_try
21650set usekernprocpathname
21651eval $setvar
21652
21653: Determine if we can use _NSGetExecutablePath to find executing program
21654echo " "
21655echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
21656$cat >try.c <<'EOM'
21657/* Intentionally a long probe as I'd like to sanity check that the exact
21658 approach is going to work, as thinking it will work, but only having it
21659 part working at runtime is worse than not having it. */
21660#include <mach-o/dyld.h>
21661#include <stdio.h>
21662#include <stdlib.h>
21663#include <sys/param.h>
21664#include <string.h>
21665
21666int
21667main(int argc, char **argv) {
21668 char buf[1];
21669 uint32_t size = sizeof(buf);
21670 int result;
21671 char *buffer;
21672 char *tidied;
21673 char *argv_leaf = strrchr(argv[0], '/');
21674 char *tidied_leaf;
21675
21676 if (!argv_leaf) {
21677 fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21678 return 1;
21679 }
21680
21681 _NSGetExecutablePath(buf, &size);
21682 if (size > MAXPATHLEN * MAXPATHLEN) {
21683 fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
21684 (unsigned int) size);
21685 return 2;
21686 }
21687
21688 buffer = malloc(size);
21689 if (!buffer) {
21690 perror("malloc");
21691 return 3;
21692 }
21693
21694 result = _NSGetExecutablePath(buffer, &size);
21695 if (result != 0) {
21696 fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
21697 result, (unsigned int) size);
21698 return 4;
21699 }
21700
21701 tidied = realpath(buffer, NULL);
21702 if (!tidied) {
21703 perror("realpath");
21704 return 5;
21705 }
21706
21707 free(buffer);
21708
21709 if (*tidied != '/') {
21710 fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
21711 return 6;
21712 }
21713
21714 if (strstr(tidied, "/./")) {
21715 fprintf(stderr, "Contains /./: '%s'\n", tidied);
21716 return 7;
21717 }
21718
21719 if (strstr(tidied, "/../")) {
21720 fprintf(stderr, "Contains /../: '%s'\n", tidied);
21721 return 8;
21722 }
21723
21724 tidied_leaf = strrchr(tidied, '/');
21725 if (strcmp(tidied_leaf, argv_leaf) != 0) {
21726 fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
21727 return 9;
21728 }
21729
21730 free(tidied);
21731
21732 return 0;
21733}
21734EOM
21735
21736val=$undef
21737set try
21738if eval $compile; then
21739 if $run ./try; then
21740 echo "You can use _NSGetExecutablePath to find the executing program." >&4
21741 val="$define"
21742 else
21743 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
21744 fi
21745else
21746 echo "I'm unable to compile the test program." >&4
21747 echo "I'll assume no _NSGetExecutablePath here." >&4
21748fi
21749$rm_try
21750set usensgetexecutablepath
21751eval $setvar
21752
21753: Check if site customization support was requested
21754case "$usesitecustomize" in
21755 $define|true|[Yy]*)
21756 usesitecustomize="$define"
21757 ;;
21758 *)
21759 usesitecustomize="$undef"
21760 ;;
21761 esac
21762
21763: see if prototypes support variable argument declarations
21764echo " "
21765case "$prototype$i_stdarg" in
21766$define$define)
21767 echo "It appears we'll be able to prototype varargs functions." >&4
21768 val="$define"
21769 ;;
21770*)
21771 echo "Too bad... We won't be using prototyped varargs functions..." >&4
21772 val="$undef"
21773 ;;
21774esac
21775set vaproto
21776eval $setvar
21777
21778: determine compiler compiler
21779case "$yacc" in
21780'')
21781 dflt=yacc;;
21782*)
21783 dflt="$yacc";;
21784esac
21785echo " "
21786comp='yacc'
21787if $test -f "$byacc$_exe"; then
21788 dflt="$byacc"
21789 comp="byacc or $comp"
21790fi
21791if $test -f "$bison$_exe"; then
21792 comp="$comp or bison -y"
21793fi
21794rp="Which compiler compiler ($comp) shall I use?"
21795. ./myread
21796yacc="$ans"
21797case "$yacc" in
21798*bis*)
21799 case "$yacc" in
21800 *-y*) ;;
21801 *)
21802 yacc="$yacc -y"
21803 echo "(Adding -y option to bison to get yacc-compatible behavior.)"
21804 ;;
21805 esac
21806 ;;
21807esac
21808
21809: see if this is a assert.h system
21810set assert.h i_assert
21811eval $inhdr
21812
21813: see if this is a fp.h system
21814set fp.h i_fp
21815eval $inhdr
21816
21817: see if this is a fp_class.h system
21818set fp_class.h i_fp_class
21819eval $inhdr
21820
21821: see if gdbm.h is available
21822set gdbm.h t_gdbm
21823eval $inhdr
21824case "$t_gdbm" in
21825$define)
21826 : see if gdbm_open exists
21827 set gdbm_open d_gdbm_open
21828 eval $inlibc
21829 case "$d_gdbm_open" in
21830 $undef)
21831 t_gdbm="$undef"
21832 echo "We won't be including <gdbm.h>"
21833 ;;
21834 esac
21835 ;;
21836esac
21837val="$t_gdbm"
21838set i_gdbm
21839eval $setvar
21840
21841: see if this is a ieeefp.h system
21842case "$i_ieeefp" in
21843'' ) set ieeefp.h i_ieeefp
21844 eval $inhdr
21845 ;;
21846esac
21847
21848: see if this is a libutil.h system
21849set libutil.h i_libutil
21850eval $inhdr
21851
21852: see if mach cthreads are available
21853if test "X$usethreads" = "X$define"; then
21854 set mach/cthreads.h i_machcthr
21855 eval $inhdr
21856else
21857 i_machcthr="$undef"
21858fi
21859
21860: see if this is a mntent.h system
21861set mntent.h i_mntent
21862eval $inhdr
21863
21864: see if net/errno.h is available
21865val=''
21866set net/errno.h val
21867eval $inhdr
21868
21869: Unfortunately, it causes problems on some systems. Arrgh.
21870case "$val" in
21871$define)
21872 cat > try.c <<'EOM'
21873#include <stdio.h>
21874#include <errno.h>
21875#include <net/errno.h>
21876int func()
21877{
21878 return ENOTSOCK;
21879}
21880EOM
21881 if $cc $ccflags -c try.c >/dev/null 2>&1; then
21882 echo "We'll be including <net/errno.h>." >&4
21883 else
21884 echo "We won't be including <net/errno.h>." >&4
21885 val="$undef"
21886 fi
21887 $rm_try
21888 ;;
21889esac
21890set i_neterrno
21891eval $setvar
21892
21893: see if netinet/tcp.h is available
21894set netinet/tcp.h i_netinettcp
21895eval $inhdr
21896
21897: see if this is a poll.h system
21898set poll.h i_poll
21899eval $inhdr
21900
21901: see if this is a prot.h system
21902set prot.h i_prot
21903eval $inhdr
21904
21905: Preprocessor symbols
21906echo " "
21907$echo "Guessing which symbols your C compiler and preprocessor define..." >&4
21908$cat <<'EOSH' > Cppsym.know
21909a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
21910AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
21911alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
21912ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
21913BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
21914BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
21915bull c cadmus clipper CMU COFF COMPILER_VERSION
21916concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
21917CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
21918Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
21919FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
21920GLIBC GLIBC_MINOR
21921GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
21922H3050R H3050RX hbullx20 hcx host_mips
21923hp200 hp300 hp700 HP700 hp800 hp9000
21924hp9000s200 hp9000s300 hp9000s400 hp9000s500
21925hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
21926i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
21927IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
21928INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
21929LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
21930LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
21931LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
21932LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
21933M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
21934M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
21935M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
21936MATH_HAS_NO_SIDE_EFFECTS
21937mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
21938mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
21939mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
21940MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
21941mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
21942NetBSD news1500 news1700 news1800 news1900 news3700
21943news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
21944ns32016 ns32332 ns32k nsc32000
21945OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
21946pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
21947pc532 pdp11 PGC PIC plexus PORTAR posix
21948POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
21949POSIX_C_SOURCE POSIX_SOURCE POWER
21950PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
21951riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
21952SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
21953sony sony_news sonyrisc sparc sparclite spectrum
21954stardent stdc STDC_EXT stratos sun sun3 sun386
21955Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
21956SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
21957SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
21958sysV68 sysV88 Tek4132 Tek4300 titan
21959TM3200 TM5400 TM5600
21960tower tower32 tower32_200 tower32_600 tower32_700
21961tower32_800 tower32_850 tss
21962u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
21963ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
21964unix UNIX95 UNIX99 unixpc unos
21965USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
21966USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
21967USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
21968USGr4 USGr4_2
21969Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
21970XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
21971XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
21972z8000
21973EOSH
21974# Maybe put other stuff here too.
21975cat <<EOSH >>Cppsym.know
21976$osname
21977EOSH
21978./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
21979./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
21980$cat Cppsym.know > Cppsym.c
21981$cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
21982$rm -f Cppsym.a Cppsym.b Cppsym.c
21983cat <<EOSH > Cppsym
21984$startsh
21985if $test \$# -gt 0; then
21986 echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
21987 if $test -s Cppsym.got; then
21988 $rm -f Cppsym.got
21989 exit 0
21990 fi
21991 $rm -f Cppsym.got
21992 exit 1
21993else
21994 $tr " " "$trnl" | ./Cppsym.try
21995 exit 0
21996fi
21997EOSH
21998chmod +x Cppsym
21999$eunicefix Cppsym
22000cat <<EOSH > Cppsym.try
22001$startsh
22002cat <<'EOCP' > try.c
22003#include <stdio.h>
22004#if cpp_stuff == 1
22005#define STRINGIFY(a) "a"
22006#endif
22007#if cpp_stuff == 42
22008#define StGiFy(a) #a
22009#define STRINGIFY(a) StGiFy(a)
22010#endif
22011#if $cpp_stuff != 1 && $cpp_stuff != 42
22012# include "Bletch: How does this C preprocessor stringify macros?"
22013#endif
22014int main() {
22015EOCP
22016$awk \\
22017EOSH
22018cat <<'EOSH' >> Cppsym.try
22019'length($1) > 0 {
22020 printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
22021 printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
22022 printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
22023 printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
22024}' >> try.c
22025echo 'return 0;}' >> try.c
22026EOSH
22027cat <<EOSH >> Cppsym.try
22028ccflags="$ccflags"
22029case "$osname-$gccversion" in
22030irix-) ccflags="\$ccflags -woff 1178" ;;
22031os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
22032esac
22033$cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
22034EOSH
22035chmod +x Cppsym.try
22036$eunicefix Cppsym.try
22037./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
22038: Add in any Linux cpp "predefined macros":
22039case "$osname::$gccversion" in
22040 *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
22041 tHdrH=_tmpHdr
22042 rm -f $tHdrH'.h' $tHdrH
22043 touch $tHdrH'.h'
22044 # Filter out macro arguments, such as Linux's __INT8_C(c)
22045 if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
22046 sed -e 's/#define[\ \ ]*//;s/[\ \ ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
22047 if [ -s $tHdrH'_cppsym.real' ]; then
22048 cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
22049 fi
22050 fi
22051 rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
22052 ;;
22053esac
22054: now check the C compiler for additional symbols
22055postprocess_cc_v=''
22056case "$osname" in
22057aix) postprocess_cc_v="|$tr , ' '" ;;
22058esac
22059$cat >ccsym <<EOS
22060$startsh
22061$cat >tmp.c <<EOF
22062extern int foo;
22063EOF
22064for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
22065do
22066 case "\$i" in
22067 -D*) echo "\$i" | $sed 's/^-D//';;
22068 -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
22069 esac
22070done
22071$rm_try
22072EOS
22073postprocess_cc_v=''
22074chmod +x ccsym
22075$eunicefix ccsym
22076./ccsym > ccsym1.raw
22077if $test -s ccsym1.raw; then
22078 $sort ccsym1.raw | $uniq >ccsym.raw
22079else
22080 mv ccsym1.raw ccsym.raw
22081fi
22082
22083$awk '/\=/ { print $0; next }
22084 { print $0"=1" }' ccsym.raw >ccsym.list
22085$comm -13 Cppsym.true ccsym.list >ccsym.own
22086$comm -12 Cppsym.true ccsym.list >ccsym.com
22087$comm -23 Cppsym.true ccsym.list >ccsym.cpp
22088also=''
22089if $test -z ccsym.raw; then
22090 echo "Your C compiler doesn't seem to define any symbols!" >&4
22091 echo " "
22092 echo "However, your C preprocessor defines the following symbols:"
22093 $cat Cppsym.true
22094 ccsymbols=''
22095 cppsymbols=`$cat Cppsym.true`
22096 cppsymbols=`echo $cppsymbols`
22097 cppccsymbols="$cppsymbols"
22098else
22099 if $test -s ccsym.com; then
22100 echo "Your C compiler and pre-processor define these symbols:"
22101 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
22102 also='also '
22103 symbols='ones'
22104 cppccsymbols=`$cat ccsym.com`
22105 cppccsymbols=`echo $cppccsymbols`
22106 $test "$silent" || sleep 1
22107 fi
22108 if $test -s ccsym.cpp; then
22109 $test "$also" && echo " "
22110 echo "Your C pre-processor ${also}defines the following symbols:"
22111 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
22112 also='further '
22113 cppsymbols=`$cat ccsym.cpp`
22114 cppsymbols=`echo $cppsymbols`
22115 $test "$silent" || sleep 1
22116 fi
22117 if $test -s ccsym.own; then
22118 $test "$also" && echo " "
22119 echo "Your C compiler ${also}defines the following cpp symbols:"
22120 $sed -e 's/\(..*\)=1/\1/' ccsym.own
22121 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
22122 ccsymbols=`$cat ccsym.own`
22123 ccsymbols=`echo $ccsymbols`
22124 $test "$silent" || sleep 1
22125 fi
22126fi
22127
22128: see if this is a termio system
22129val="$undef"
22130val2="$undef"
22131val3="$undef"
22132if $test `./findhdr termios.h`; then
22133 set tcsetattr i_termios
22134 eval $inlibc
22135 val3="$i_termios"
22136fi
22137echo " "
22138case "$val3" in
22139 "$define") echo "You have POSIX termios.h... good!" >&4;;
22140 *) if ./Cppsym pyr; then
22141 case "`$run /bin/universe`" in
22142 ucb) if $test `./findhdr sgtty.h`; then
22143 val2="$define"
22144 echo "<sgtty.h> found." >&4
22145 else
22146 echo "System is pyramid with BSD universe."
22147 ./warn "<sgtty.h> not found--you could have problems."
22148 fi;;
22149 *) if $test `./findhdr termio.h`; then
22150 val="$define"
22151 echo "<termio.h> found." >&4
22152 else
22153 echo "System is pyramid with USG universe."
22154 ./warn "<termio.h> not found--you could have problems."
22155 fi;;
22156 esac
22157 elif ./usg; then
22158 if $test `./findhdr termio.h`; then
22159 echo "<termio.h> found." >&4
22160 val="$define"
22161 elif $test `./findhdr sgtty.h`; then
22162 echo "<sgtty.h> found." >&4
22163 val2="$define"
22164 else
22165 ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
22166 fi
22167 else
22168 if $test `./findhdr sgtty.h`; then
22169 echo "<sgtty.h> found." >&4
22170 val2="$define"
22171 elif $test `./findhdr termio.h`; then
22172 echo "<termio.h> found." >&4
22173 val="$define"
22174 else
22175 ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
22176 fi
22177 fi;;
22178esac
22179set i_termio; eval $setvar
22180val=$val2; set i_sgtty; eval $setvar
22181val=$val3; set i_termios; eval $setvar
22182
22183: see if stdbool is available
22184: we want a real compile instead of Inhdr because some Solaris systems
22185: have stdbool.h, but it can only be used if the compiler indicates it
22186: is sufficiently c99-compliant.
22187echo " "
22188$cat >try.c <<EOCP
22189#include <stdio.h>
22190#include <stdbool.h>
22191int func(bool x)
22192{
22193 return x ? 1 : 0;
22194}
22195int main(int argc, char **argv)
22196{
22197 return func(0);
22198}
22199EOCP
22200set try
22201if eval $compile; then
22202 echo "<stdbool.h> found." >&4
22203 val="$define"
22204else
22205 echo "<stdbool.h> NOT found." >&4
22206 val="$undef"
22207fi
22208$rm_try
22209set i_stdbool
22210eval $setvar
22211
22212: see if stddef is available
22213set stddef.h i_stddef
22214eval $inhdr
22215
22216: see if sys/access.h is available
22217set sys/access.h i_sysaccess
22218eval $inhdr
22219
22220: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
22221set sys/filio.h i_sysfilio
22222eval $inhdr
22223echo " "
22224if $test `./findhdr sys/ioctl.h`; then
22225 val="$define"
22226 echo '<sys/ioctl.h> found.' >&4
22227else
22228 val="$undef"
22229 if $test $i_sysfilio = "$define"; then
22230 echo '<sys/ioctl.h> NOT found.' >&4
22231 else
22232 $test $i_sgtty = "$define" && xxx="sgtty.h"
22233 $test $i_termio = "$define" && xxx="termio.h"
22234 $test $i_termios = "$define" && xxx="termios.h"
22235echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
22236 fi
22237fi
22238set i_sysioctl
22239eval $setvar
22240
22241: see if socket ioctl defs are in sys/sockio.h
22242echo " "
22243xxx=`./findhdr sys/sockio.h`
22244if $test "$xxx"; then
22245 if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
22246 val="$define"
22247 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
22248 else
22249 val="$undef"
22250 echo "No socket ioctls found in <sys/sockio.h>." >&4
22251 fi
22252else
22253 val="$undef"
22254 $cat <<EOM
22255<sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
22256EOM
22257fi
22258set i_syssockio
22259eval $setvar
22260
22261: see if this is a syslog.h system
22262set syslog.h i_syslog
22263eval $inhdr
22264
22265: see if this is a sys/mode.h system
22266set sys/mode.h i_sysmode
22267eval $inhdr
22268
22269: see if there is a sys/poll.h file
22270set sys/poll.h i_syspoll
22271eval $inhdr
22272
22273: see if sys/resource.h has to be included
22274set sys/resource.h i_sysresrc
22275eval $inhdr
22276
22277: see if sys/security.h is available
22278set sys/security.h i_syssecrt
22279eval $inhdr
22280
22281: see if this is a sys/statvfs.h system
22282set sys/statvfs.h i_sysstatvfs
22283eval $inhdr
22284
22285: see if this is a sys/un.h system
22286set sys/un.h i_sysun
22287eval $inhdr
22288
22289: see if this is a sys/utsname.h system
22290set sys/utsname.h i_sysutsname
22291eval $inhdr
22292
22293: see if this is a syswait system
22294set sys/wait.h i_syswait
22295eval $inhdr
22296
22297: see if this is a ustat.h system
22298set ustat.h i_ustat
22299eval $inhdr
22300
22301: see if this is an utime system
22302set utime.h i_utime
22303eval $inhdr
22304
22305: see if this is a vfork system
22306case "$d_vfork" in
22307"$define")
22308 set vfork.h i_vfork
22309 eval $inhdr
22310 ;;
22311*)
22312 i_vfork="$undef"
22313 ;;
22314esac
22315
22316: Check extensions
22317echo " "
22318echo "Looking for extensions..." >&4
22319: If we are using the old config.sh, nonxs_extensions and xs_extensions may
22320: contain old or inaccurate or duplicate values.
22321nonxs_extensions=''
22322xs_extensions=''
22323: We do not use find because it might not be available.
22324: We do not just use MANIFEST because the user may have dropped
22325: some additional extensions into the source tree and expect them
22326: to be built.
22327
22328: Function to recursively find available extensions, ignoring DynaLoader
22329: NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
22330: In 5.10.1 and later, extensions are stored in directories
22331: like File-Glob instead of the older File/Glob/.
22332find_extensions='
22333 for xxx in *; do
22334 case "$xxx" in
22335 DynaLoader|dynaload) ;;
22336 *)
22337 this_ext=`echo $xxx | $sed -e s/-/\\\//g`;
22338 case "$this_ext" in
22339 Scalar/List/Utils) this_ext="List/Util" ;;
22340 PathTools) this_ext="Cwd" ;;
22341 esac;
22342 echo " $xs_extensions $nonxs_extensions" > $$.tmp;
22343 if $contains " $this_ext " $$.tmp; then
22344 echo >&4;
22345 echo "Duplicate directories detected for extension $xxx" >&4;
22346 echo "Configure cannot correctly recover from this - shall I abort?" >&4;
22347 case "$knowitall" in
22348 "") dflt=y;;
22349 *) dflt=n;;
22350 esac;
22351 . ../UU/myread;
22352 case "$ans" in
22353 n*|N*) ;;
22354 *) echo >&4;
22355 echo "Ok. Stopping Configure." >&4;
22356 echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4;
22357 exit 1;;
22358 esac;
22359 echo "Ok. You will need to correct config.sh before running make." >&4;
22360 fi;
22361 $ls -1 $xxx > $$.tmp;
22362 if $contains "\.xs$" $$.tmp > /dev/null 2>&1; then
22363 xs_extensions="$xs_extensions $this_ext";
22364 elif $contains "\.c$" $$.tmp > /dev/null 2>&1; then
22365 xs_extensions="$xs_extensions $this_ext";
22366 elif $test -d $xxx; then
22367 nonxs_extensions="$nonxs_extensions $this_ext";
22368 fi;
22369 $rm -f $$.tmp;
22370 ;;
22371 esac;
22372 done'
22373tdir=`pwd`
22374cd "$rsrc/cpan"
22375set X
22376shift
22377eval $find_extensions
22378cd "$rsrc/dist"
22379set X
22380shift
22381eval $find_extensions
22382cd "$rsrc/ext"
22383set X
22384shift
22385eval $find_extensions
22386set X $xs_extensions
22387shift
22388xs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
22389set X $nonxs_extensions
22390shift
22391nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
22392cd "$tdir"
22393known_extensions=`echo $nonxs_extensions $xs_extensions | tr ' ' $trnl | $sort | tr $trnl ' '`
22394
22395: Now see which are supported on this system.
22396avail_ext=''
22397for xxx in $xs_extensions ; do
22398 case "$xxx" in
22399 DB_File|db_file)
22400 case "$i_db" in
22401 $define) avail_ext="$avail_ext $xxx" ;;
22402 esac
22403 ;;
22404 GDBM_File|gdbm_fil)
22405 case "$i_gdbm" in
22406 $define) avail_ext="$avail_ext $xxx" ;;
22407 esac
22408 ;;
22409 I18N/Langinfo|i18n_lan)
22410 case "$i_langinfo$d_nl_langinfo" in
22411 $define$define) avail_ext="$avail_ext $xxx" ;;
22412 esac
22413 ;;
22414 IPC/SysV|ipc/sysv)
22415 : XXX Do we need a useipcsysv variable here
22416 case "${d_msg}${d_sem}${d_shm}" in
22417 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
22418 esac
22419 ;;
22420 NDBM_File|ndbm_fil)
22421 case "$d_ndbm" in
22422 $define)
22423 case "$osname-$use64bitint" in
22424 hpux-define)
22425 case "$libs" in
22426 *-lndbm*) avail_ext="$avail_ext $xxx" ;;
22427 esac
22428 ;;
22429 *) avail_ext="$avail_ext $xxx" ;;
22430 esac
22431 ;;
22432 esac
22433 ;;
22434 ODBM_File|odbm_fil)
22435 case "${i_dbm}${i_rpcsvcdbm}" in
22436 *"${define}"*)
22437 case "$d_cplusplus" in
22438 define) ;; # delete as a function name will not work
22439 *) case "$osname-$use64bitint" in
22440 hpux-define)
22441 case "$libs" in
22442 *-ldbm*) avail_ext="$avail_ext $xxx" ;;
22443 esac
22444 ;;
22445 *) avail_ext="$avail_ext $xxx" ;;
22446 esac
22447 ;;
22448 esac
22449 ;;
22450 esac
22451 ;;
22452 Opcode|opcode)
22453 case "$useopcode" in
22454 true|define|y) avail_ext="$avail_ext $xxx" ;;
22455 esac
22456 ;;
22457 POSIX|posix)
22458 case "$useposix" in
22459 true|define|y) avail_ext="$avail_ext $xxx" ;;
22460 esac
22461 ;;
22462 Socket|socket)
22463 case "$d_socket" in
22464 true|$define|y) avail_ext="$avail_ext $xxx" ;;
22465 esac
22466 ;;
22467 Sys/Syslog|sys/syslog)
22468 : XXX syslog requires socket
22469 case "$d_socket" in
22470 true|$define|y) avail_ext="$avail_ext $xxx" ;;
22471 esac
22472 ;;
22473 Thread|thread)
22474 case "$usethreads" in
22475 true|$define|y)
22476 case "$use5005threads" in
22477 $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
22478 esac
22479 esac
22480 ;;
22481 threads|threads/shared)
22482 # threads and threads::shared are special cases.
22483 # To stop people from asking "Perl 5.8.0 was supposed
22484 # to have this new fancy threads implementation but my
22485 # perl doesn't have it" and from people trying to
22486 # (re)install the threads module using CPAN.pm and
22487 # CPAN.pm then offering to reinstall Perl 5.8.0,
22488 # the threads.pm and threads/shared.pm will always be
22489 # there, croaking informatively ("you need to rebuild
22490 # all of Perl with threads, sorry") when threads haven't
22491 # been compiled in.
22492 # --jhi
22493 avail_ext="$avail_ext $xxx"
22494 ;;
22495 VMS*)
22496 ;;
22497 Win32*)
22498 case "$osname" in
22499 cygwin) avail_ext="$avail_ext $xxx" ;;
22500 esac
22501 ;;
22502 XS/APItest|xs/apitest)
22503 # This is just for testing. Skip it unless we have dynamic loading.
22504
22505 case "$usedl" in
22506 $define) avail_ext="$avail_ext $xxx" ;;
22507 esac
22508 ;;
22509 XS/Typemap|xs/typemap)
22510 # This is just for testing. Skip it unless we have dynamic loading.
22511 case "$usedl" in
22512 $define) avail_ext="$avail_ext $xxx" ;;
22513 esac
22514 ;;
22515 *) avail_ext="$avail_ext $xxx"
22516 ;;
22517 esac
22518done
22519
22520set X $avail_ext
22521shift
22522avail_ext="$*"
22523
22524case "$onlyextensions" in
22525'') ;;
22526*) keepextensions=''
22527 echo "You have requested that only certain extensions be included..." >&4
22528 for i in $onlyextensions; do
22529 case " $avail_ext " in
22530 *" $i "*)
22531 echo "Keeping extension $i."
22532 keepextensions="$keepextensions $i"
22533 ;;
22534 *) echo "Ignoring extension $i." ;;
22535 esac
22536 done
22537 avail_ext="$keepextensions"
22538 ;;
22539esac
22540
22541case "$noextensions" in
22542'') ;;
22543*) keepextensions=''
22544 echo "You have requested that certain extensions be ignored..." >&4
22545 for i in $avail_ext; do
22546 case " $noextensions " in
22547 *" $i "*) echo "Ignoring extension $i." ;;
22548 *) echo "Keeping extension $i.";
22549 keepextensions="$keepextensions $i"
22550 ;;
22551 esac
22552 done
22553 avail_ext="$keepextensions"
22554 ;;
22555esac
22556
22557: Now see which nonxs extensions are supported on this system.
22558: For now assume all are.
22559nonxs_ext=''
22560for xxx in $nonxs_extensions ; do
22561 case "$xxx" in
22562 VMS*)
22563 ;;
22564 *) nonxs_ext="$nonxs_ext $xxx"
22565 ;;
22566 esac
22567done
22568
22569set X $nonxs_ext
22570shift
22571nonxs_ext="$*"
22572
22573case $usedl in
22574$define)
22575 $cat <<EOM
22576A number of extensions are supplied with $package. You may choose to
22577compile these extensions for dynamic loading (the default), compile
22578them into the $package executable (static loading), or not include
22579them at all. Answer "none" to include no extensions.
22580Note that DynaLoader is always built and need not be mentioned here.
22581
22582EOM
22583 case "$dynamic_ext" in
22584 '')
22585 : Exclude those listed in static_ext
22586 dflt=''
22587 for xxx in $avail_ext; do
22588 case " $static_ext " in
22589 *" $xxx "*) ;;
22590 *) dflt="$dflt $xxx" ;;
22591 esac
22592 done
22593 set X $dflt
22594 shift
22595 dflt="$*"
22596 ;;
22597 *) dflt="$dynamic_ext"
22598 # Perhaps we are reusing an old out-of-date config.sh.
22599 case "$hint" in
22600 previous)
22601 if test X"$dynamic_ext" != X"$avail_ext"; then
22602 $cat <<EOM
22603NOTICE: Your previous config.sh list may be incorrect.
22604The extensions now available to you are
22605 ${avail_ext}
22606but the default list from your previous config.sh is
22607 ${dynamic_ext}
22608
22609EOM
22610 fi
22611 ;;
22612 esac
22613 ;;
22614 esac
22615 case "$dflt" in
22616 '') dflt=none;;
22617 esac
22618 rp="What extensions do you wish to load dynamically?"
22619 . ./myread
22620 case "$ans" in
22621 none) dynamic_ext=' ' ;;
22622 *) dynamic_ext="$ans" ;;
22623 esac
22624
22625 case "$static_ext" in
22626 '')
22627 : Exclude those already listed in dynamic linking
22628 dflt=''
22629 for xxx in $avail_ext; do
22630 case " $dynamic_ext " in
22631 *" $xxx "*) ;;
22632 *) dflt="$dflt $xxx" ;;
22633 esac
22634 done
22635 set X $dflt
22636 shift
22637 dflt="$*"
22638 ;;
22639 *) dflt="$static_ext"
22640 ;;
22641 esac
22642
22643 case "$dflt" in
22644 '') dflt=none;;
22645 esac
22646 rp="What extensions do you wish to load statically?"
22647 . ./myread
22648 case "$ans" in
22649 none) static_ext=' ' ;;
22650 *) static_ext="$ans" ;;
22651 esac
22652 ;;
22653*)
22654 $cat <<EOM
22655A number of extensions are supplied with $package. Answer "none"
22656to include no extensions.
22657Note that DynaLoader is always built and need not be mentioned here.
22658
22659EOM
22660 case "$static_ext" in
22661 '') dflt="$avail_ext" ;;
22662 *) dflt="$static_ext"
22663 # Perhaps we are reusing an old out-of-date config.sh.
22664 case "$hint" in
22665 previous)
22666 if test X"$static_ext" != X"$avail_ext"; then
22667 $cat <<EOM
22668NOTICE: Your previous config.sh list may be incorrect.
22669The extensions now available to you are
22670 ${avail_ext}
22671but the default list from your previous config.sh is
22672 ${static_ext}
22673
22674EOM
22675 fi
22676 ;;
22677 esac
22678 ;;
22679 esac
22680 : Exclude those that are not xs extensions
22681 case "$dflt" in
22682 '') dflt=none;;
22683 esac
22684 rp="What extensions do you wish to include?"
22685 . ./myread
22686 case "$ans" in
22687 none) static_ext=' ' ;;
22688 *) static_ext="$ans" ;;
22689 esac
22690 ;;
22691esac
22692#
22693# Encode is a special case. If we are building Encode as a static
22694# extension, we need to explicitly list its subextensions as well.
22695# For other nested extensions, this is handled automatically by
22696# the appropriate Makefile.PL.
22697case " $static_ext " in
22698 *" Encode "*) # Add the subextensions of Encode
22699 cd "$rsrc/cpan"
22700 for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
22701 static_ext="$static_ext Encode/$xxx"
22702 known_extensions="$known_extensions Encode/$xxx"
22703 done
22704 cd "$tdir"
22705 ;;
22706esac
22707
22708set X $dynamic_ext $static_ext $nonxs_ext
22709shift
22710extensions="$*"
22711
22712# Sanity check: We require an extension suitable for use with
22713# AnyDBM_File, as well as Fcntl and IO. (Failure to have these
22714# should show up as failures in the test suite, but it's helpful to
22715# catch them now.) The 'extensions' list is normally sorted
22716# alphabetically, so we need to accept either
22717# DB_File ... Fcntl ... IO ....
22718# or something like
22719# Fcntl ... NDBM_File ... IO ....
22720case " $extensions" in
22721*"_File "*" Fcntl "*" IO "*) ;; # DB_File
22722*" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
22723*" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
22724*) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
22725 echo "WARNING: The Perl you are building will be quite crippled." >& 4
22726 ;;
22727esac
22728
22729: Remove libraries needed only for extensions
22730: The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
22731: The exception is SunOS 4.x, which needs them.
22732case "${osname}X${osvers}" in
22733sunos*X4*)
22734 perllibs="$libs"
22735 ;;
22736*) case "$usedl" in
22737 $define|true|[yY]*)
22738 set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
22739 shift
22740 perllibs="$*"
22741 ;;
22742 *) perllibs="$libs"
22743 ;;
22744 esac
22745 ;;
22746esac
22747
22748: Remove build directory name from cppstdin so it can be used from
22749: either the present location or the final installed location.
22750echo " "
22751: Get out of the UU directory to get correct path name.
22752cd ..
22753case "$cppstdin" in
22754`pwd`/cppstdin)
22755 echo "Stripping down cppstdin path name"
22756 cppstdin=cppstdin
22757 ;;
22758esac
22759cd UU
22760
22761: end of configuration questions
22762echo " "
22763echo "End of configuration questions."
22764echo " "
22765
22766: back to where it started
22767if test -d ../UU; then
22768 cd ..
22769fi
22770
22771: configuration may be unconditionally patched via a 'config.arch' file
22772if $test -f config.arch; then
22773 echo "I see a config.arch file, loading it." >&4
22774 . ./config.arch
22775fi
22776
22777: configuration may be patched via a 'config.over' file
22778if $test -f config.over; then
22779 echo " "
22780 dflt=y
22781 rp='I see a config.over file. Do you wish to load it?'
22782 . UU/myread
22783 case "$ans" in
22784 n*) echo "OK, I'll ignore it.";;
22785 *) . ./config.over
22786 echo "Configuration override changes have been loaded."
22787 ;;
22788 esac
22789fi
22790
22791: in case they want portability, strip down executable paths
22792case "$d_portable" in
22793"$define")
22794 echo " "
22795 echo "Stripping down executable paths..." >&4
22796 for file in $loclist $trylist; do
22797 eval temp=\$$file
22798 eval $file=`basename $temp`
22799 done
22800 ;;
22801esac
22802
22803: create config.sh file
22804echo " "
22805echo "Creating config.sh..." >&4
22806$spitshell <<EOT >config.sh
22807$startsh
22808#
22809# This file was produced by running the Configure script. It holds all the
22810# definitions figured out by Configure. Should you modify one of these values,
22811# do not forget to propagate your changes by running "Configure -der". You may
22812# instead choose to run each of the .SH files by yourself, or "Configure -S".
22813#
22814
22815# Package name : $package
22816# Source directory : $src
22817# Configuration time: $cf_time
22818# Configured by : $cf_by
22819# Target system : $myuname
22820
22821EOT
22822: Add in command line options if available
22823$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22824
22825$spitshell <<EOT >>config.sh
22826
22827Author='$Author'
22828Date='$Date'
22829Header='$Header'
22830Id='$Id'
22831Locker='$Locker'
22832Log='$Log'
22833RCSfile='$RCSfile'
22834Revision='$Revision'
22835Source='$Source'
22836State='$State'
22837_a='$_a'
22838_exe='$_exe'
22839_o='$_o'
22840afs='$afs'
22841afsroot='$afsroot'
22842alignbytes='$alignbytes'
22843ansi2knr='$ansi2knr'
22844aphostname='$aphostname'
22845api_revision='$api_revision'
22846api_subversion='$api_subversion'
22847api_version='$api_version'
22848api_versionstring='$api_versionstring'
22849ar='$ar'
22850archlib='$archlib'
22851archlibexp='$archlibexp'
22852archname64='$archname64'
22853archname='$archname'
22854archobjs='$archobjs'
22855asctime_r_proto='$asctime_r_proto'
22856awk='$awk'
22857baserev='$baserev'
22858bash='$bash'
22859bin='$bin'
22860bin_ELF='$bin_ELF'
22861binexp='$binexp'
22862bison='$bison'
22863bootstrap_charset='$bootstrap_charset'
22864byacc='$byacc'
22865byteorder='$byteorder'
22866c='$c'
22867castflags='$castflags'
22868cat='$cat'
22869cc='$cc'
22870cccdlflags='$cccdlflags'
22871ccdlflags='$ccdlflags'
22872ccflags='$ccflags'
22873ccflags_uselargefiles='$ccflags_uselargefiles'
22874ccname='$ccname'
22875ccsymbols='$ccsymbols'
22876ccversion='$ccversion'
22877cf_by='$cf_by'
22878cf_email='$cf_email'
22879cf_time='$cf_time'
22880charbits='$charbits'
22881charsize='$charsize'
22882chgrp='$chgrp'
22883chmod='$chmod'
22884chown='$chown'
22885clocktype='$clocktype'
22886comm='$comm'
22887compress='$compress'
22888contains='$contains'
22889cp='$cp'
22890cpio='$cpio'
22891cpp='$cpp'
22892cpp_stuff='$cpp_stuff'
22893cppccsymbols='$cppccsymbols'
22894cppflags='$cppflags'
22895cpplast='$cpplast'
22896cppminus='$cppminus'
22897cpprun='$cpprun'
22898cppstdin='$cppstdin'
22899cppsymbols='$cppsymbols'
22900crypt_r_proto='$crypt_r_proto'
22901cryptlib='$cryptlib'
22902csh='$csh'
22903ctermid_r_proto='$ctermid_r_proto'
22904ctime_r_proto='$ctime_r_proto'
22905d_Gconvert='$d_Gconvert'
22906d_PRIEUldbl='$d_PRIEUldbl'
22907d_PRIFUldbl='$d_PRIFUldbl'
22908d_PRIGUldbl='$d_PRIGUldbl'
22909d_PRIXU64='$d_PRIXU64'
22910d_PRId64='$d_PRId64'
22911d_PRIeldbl='$d_PRIeldbl'
22912d_PRIfldbl='$d_PRIfldbl'
22913d_PRIgldbl='$d_PRIgldbl'
22914d_PRIi64='$d_PRIi64'
22915d_PRIo64='$d_PRIo64'
22916d_PRIu64='$d_PRIu64'
22917d_PRIx64='$d_PRIx64'
22918d_SCNfldbl='$d_SCNfldbl'
22919d__fwalk='$d__fwalk'
22920d_access='$d_access'
22921d_accessx='$d_accessx'
22922d_aintl='$d_aintl'
22923d_alarm='$d_alarm'
22924d_archlib='$d_archlib'
22925d_asctime64='$d_asctime64'
22926d_asctime_r='$d_asctime_r'
22927d_atolf='$d_atolf'
22928d_atoll='$d_atoll'
22929d_attribute_deprecated='$d_attribute_deprecated'
22930d_attribute_format='$d_attribute_format'
22931d_attribute_malloc='$d_attribute_malloc'
22932d_attribute_nonnull='$d_attribute_nonnull'
22933d_attribute_noreturn='$d_attribute_noreturn'
22934d_attribute_pure='$d_attribute_pure'
22935d_attribute_unused='$d_attribute_unused'
22936d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
22937d_bcmp='$d_bcmp'
22938d_bcopy='$d_bcopy'
22939d_bsd='$d_bsd'
22940d_bsdgetpgrp='$d_bsdgetpgrp'
22941d_bsdsetpgrp='$d_bsdsetpgrp'
22942d_builtin_choose_expr='$d_builtin_choose_expr'
22943d_builtin_expect='$d_builtin_expect'
22944d_bzero='$d_bzero'
22945d_c99_variadic_macros='$d_c99_variadic_macros'
22946d_casti32='$d_casti32'
22947d_castneg='$d_castneg'
22948d_charvspr='$d_charvspr'
22949d_chown='$d_chown'
22950d_chroot='$d_chroot'
22951d_chsize='$d_chsize'
22952d_class='$d_class'
22953d_clearenv='$d_clearenv'
22954d_closedir='$d_closedir'
22955d_cmsghdr_s='$d_cmsghdr_s'
22956d_const='$d_const'
22957d_copysignl='$d_copysignl'
22958d_cplusplus='$d_cplusplus'
22959d_crypt='$d_crypt'
22960d_crypt_r='$d_crypt_r'
22961d_csh='$d_csh'
22962d_ctermid='$d_ctermid'
22963d_ctermid_r='$d_ctermid_r'
22964d_ctime64='$d_ctime64'
22965d_ctime_r='$d_ctime_r'
22966d_cuserid='$d_cuserid'
22967d_dbl_dig='$d_dbl_dig'
22968d_dbminitproto='$d_dbminitproto'
22969d_difftime64='$d_difftime64'
22970d_difftime='$d_difftime'
22971d_dir_dd_fd='$d_dir_dd_fd'
22972d_dirfd='$d_dirfd'
22973d_dirnamlen='$d_dirnamlen'
22974d_dlerror='$d_dlerror'
22975d_dlopen='$d_dlopen'
22976d_dlsymun='$d_dlsymun'
22977d_dosuid='$d_dosuid'
22978d_drand48_r='$d_drand48_r'
22979d_drand48proto='$d_drand48proto'
22980d_dup2='$d_dup2'
22981d_eaccess='$d_eaccess'
22982d_endgrent='$d_endgrent'
22983d_endgrent_r='$d_endgrent_r'
22984d_endhent='$d_endhent'
22985d_endhostent_r='$d_endhostent_r'
22986d_endnent='$d_endnent'
22987d_endnetent_r='$d_endnetent_r'
22988d_endpent='$d_endpent'
22989d_endprotoent_r='$d_endprotoent_r'
22990d_endpwent='$d_endpwent'
22991d_endpwent_r='$d_endpwent_r'
22992d_endsent='$d_endsent'
22993d_endservent_r='$d_endservent_r'
22994d_eofnblk='$d_eofnblk'
22995d_eunice='$d_eunice'
22996d_faststdio='$d_faststdio'
22997d_fchdir='$d_fchdir'
22998d_fchmod='$d_fchmod'
22999d_fchown='$d_fchown'
23000d_fcntl='$d_fcntl'
23001d_fcntl_can_lock='$d_fcntl_can_lock'
23002d_fd_macros='$d_fd_macros'
23003d_fd_set='$d_fd_set'
23004d_fds_bits='$d_fds_bits'
23005d_fgetpos='$d_fgetpos'
23006d_finite='$d_finite'
23007d_finitel='$d_finitel'
23008d_flexfnam='$d_flexfnam'
23009d_flock='$d_flock'
23010d_flockproto='$d_flockproto'
23011d_fork='$d_fork'
23012d_fp_class='$d_fp_class'
23013d_fpathconf='$d_fpathconf'
23014d_fpclass='$d_fpclass'
23015d_fpclassify='$d_fpclassify'
23016d_fpclassl='$d_fpclassl'
23017d_fpos64_t='$d_fpos64_t'
23018d_frexpl='$d_frexpl'
23019d_fs_data_s='$d_fs_data_s'
23020d_fseeko='$d_fseeko'
23021d_fsetpos='$d_fsetpos'
23022d_fstatfs='$d_fstatfs'
23023d_fstatvfs='$d_fstatvfs'
23024d_fsync='$d_fsync'
23025d_ftello='$d_ftello'
23026d_ftime='$d_ftime'
23027d_futimes='$d_futimes'
23028d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
23029d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
23030d_getaddrinfo='$d_getaddrinfo'
23031d_getcwd='$d_getcwd'
23032d_getespwnam='$d_getespwnam'
23033d_getfsstat='$d_getfsstat'
23034d_getgrent='$d_getgrent'
23035d_getgrent_r='$d_getgrent_r'
23036d_getgrgid_r='$d_getgrgid_r'
23037d_getgrnam_r='$d_getgrnam_r'
23038d_getgrps='$d_getgrps'
23039d_gethbyaddr='$d_gethbyaddr'
23040d_gethbyname='$d_gethbyname'
23041d_gethent='$d_gethent'
23042d_gethname='$d_gethname'
23043d_gethostbyaddr_r='$d_gethostbyaddr_r'
23044d_gethostbyname_r='$d_gethostbyname_r'
23045d_gethostent_r='$d_gethostent_r'
23046d_gethostprotos='$d_gethostprotos'
23047d_getitimer='$d_getitimer'
23048d_getlogin='$d_getlogin'
23049d_getlogin_r='$d_getlogin_r'
23050d_getmnt='$d_getmnt'
23051d_getmntent='$d_getmntent'
23052d_getnameinfo='$d_getnameinfo'
23053d_getnbyaddr='$d_getnbyaddr'
23054d_getnbyname='$d_getnbyname'
23055d_getnent='$d_getnent'
23056d_getnetbyaddr_r='$d_getnetbyaddr_r'
23057d_getnetbyname_r='$d_getnetbyname_r'
23058d_getnetent_r='$d_getnetent_r'
23059d_getnetprotos='$d_getnetprotos'
23060d_getpagsz='$d_getpagsz'
23061d_getpbyname='$d_getpbyname'
23062d_getpbynumber='$d_getpbynumber'
23063d_getpent='$d_getpent'
23064d_getpgid='$d_getpgid'
23065d_getpgrp2='$d_getpgrp2'
23066d_getpgrp='$d_getpgrp'
23067d_getppid='$d_getppid'
23068d_getprior='$d_getprior'
23069d_getprotobyname_r='$d_getprotobyname_r'
23070d_getprotobynumber_r='$d_getprotobynumber_r'
23071d_getprotoent_r='$d_getprotoent_r'
23072d_getprotoprotos='$d_getprotoprotos'
23073d_getprpwnam='$d_getprpwnam'
23074d_getpwent='$d_getpwent'
23075d_getpwent_r='$d_getpwent_r'
23076d_getpwnam_r='$d_getpwnam_r'
23077d_getpwuid_r='$d_getpwuid_r'
23078d_getsbyname='$d_getsbyname'
23079d_getsbyport='$d_getsbyport'
23080d_getsent='$d_getsent'
23081d_getservbyname_r='$d_getservbyname_r'
23082d_getservbyport_r='$d_getservbyport_r'
23083d_getservent_r='$d_getservent_r'
23084d_getservprotos='$d_getservprotos'
23085d_getspnam='$d_getspnam'
23086d_getspnam_r='$d_getspnam_r'
23087d_gettimeod='$d_gettimeod'
23088d_gmtime64='$d_gmtime64'
23089d_gmtime_r='$d_gmtime_r'
23090d_gnulibc='$d_gnulibc'
23091d_grpasswd='$d_grpasswd'
23092d_hasmntopt='$d_hasmntopt'
23093d_htonl='$d_htonl'
23094d_ilogbl='$d_ilogbl'
23095d_inc_version_list='$d_inc_version_list'
23096d_index='$d_index'
23097d_inetaton='$d_inetaton'
23098d_inetntop='$d_inetntop'
23099d_inetpton='$d_inetpton'
23100d_int64_t='$d_int64_t'
23101d_ip_mreq='$d_ip_mreq'
23102d_ip_mreq_source='$d_ip_mreq_source'
23103d_ipv6_mreq='$d_ipv6_mreq'
23104d_ipv6_mreq_source='$d_ipv6_mreq_source'
23105d_isascii='$d_isascii'
23106d_isblank='$d_isblank'
23107d_isfinite='$d_isfinite'
23108d_isinf='$d_isinf'
23109d_isnan='$d_isnan'
23110d_isnanl='$d_isnanl'
23111d_killpg='$d_killpg'
23112d_lchown='$d_lchown'
23113d_ldbl_dig='$d_ldbl_dig'
23114d_libm_lib_version='$d_libm_lib_version'
23115d_libname_unique='$d_libname_unique'
23116d_link='$d_link'
23117d_localtime64='$d_localtime64'
23118d_localtime_r='$d_localtime_r'
23119d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
23120d_locconv='$d_locconv'
23121d_lockf='$d_lockf'
23122d_longdbl='$d_longdbl'
23123d_longlong='$d_longlong'
23124d_lseekproto='$d_lseekproto'
23125d_lstat='$d_lstat'
23126d_madvise='$d_madvise'
23127d_malloc_good_size='$d_malloc_good_size'
23128d_malloc_size='$d_malloc_size'
23129d_mblen='$d_mblen'
23130d_mbstowcs='$d_mbstowcs'
23131d_mbtowc='$d_mbtowc'
23132d_memchr='$d_memchr'
23133d_memcmp='$d_memcmp'
23134d_memcpy='$d_memcpy'
23135d_memmove='$d_memmove'
23136d_memset='$d_memset'
23137d_mkdir='$d_mkdir'
23138d_mkdtemp='$d_mkdtemp'
23139d_mkfifo='$d_mkfifo'
23140d_mkstemp='$d_mkstemp'
23141d_mkstemps='$d_mkstemps'
23142d_mktime64='$d_mktime64'
23143d_mktime='$d_mktime'
23144d_mmap='$d_mmap'
23145d_modfl='$d_modfl'
23146d_modfl_pow32_bug='$d_modfl_pow32_bug'
23147d_modflproto='$d_modflproto'
23148d_mprotect='$d_mprotect'
23149d_msg='$d_msg'
23150d_msg_ctrunc='$d_msg_ctrunc'
23151d_msg_dontroute='$d_msg_dontroute'
23152d_msg_oob='$d_msg_oob'
23153d_msg_peek='$d_msg_peek'
23154d_msg_proxy='$d_msg_proxy'
23155d_msgctl='$d_msgctl'
23156d_msgget='$d_msgget'
23157d_msghdr_s='$d_msghdr_s'
23158d_msgrcv='$d_msgrcv'
23159d_msgsnd='$d_msgsnd'
23160d_msync='$d_msync'
23161d_munmap='$d_munmap'
23162d_mymalloc='$d_mymalloc'
23163d_ndbm='$d_ndbm'
23164d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
23165d_nice='$d_nice'
23166d_nl_langinfo='$d_nl_langinfo'
23167d_nv_preserves_uv='$d_nv_preserves_uv'
23168d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
23169d_off64_t='$d_off64_t'
23170d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
23171d_oldpthreads='$d_oldpthreads'
23172d_oldsock='$d_oldsock'
23173d_open3='$d_open3'
23174d_pathconf='$d_pathconf'
23175d_pause='$d_pause'
23176d_perl_otherlibdirs='$d_perl_otherlibdirs'
23177d_phostname='$d_phostname'
23178d_pipe='$d_pipe'
23179d_poll='$d_poll'
23180d_portable='$d_portable'
23181d_prctl='$d_prctl'
23182d_prctl_set_name='$d_prctl_set_name'
23183d_printf_format_null='$d_printf_format_null'
23184d_procselfexe='$d_procselfexe'
23185d_pseudofork='$d_pseudofork'
23186d_pthread_atfork='$d_pthread_atfork'
23187d_pthread_attr_setscope='$d_pthread_attr_setscope'
23188d_pthread_yield='$d_pthread_yield'
23189d_pwage='$d_pwage'
23190d_pwchange='$d_pwchange'
23191d_pwclass='$d_pwclass'
23192d_pwcomment='$d_pwcomment'
23193d_pwexpire='$d_pwexpire'
23194d_pwgecos='$d_pwgecos'
23195d_pwpasswd='$d_pwpasswd'
23196d_pwquota='$d_pwquota'
23197d_qgcvt='$d_qgcvt'
23198d_quad='$d_quad'
23199d_random_r='$d_random_r'
23200d_readdir64_r='$d_readdir64_r'
23201d_readdir='$d_readdir'
23202d_readdir_r='$d_readdir_r'
23203d_readlink='$d_readlink'
23204d_readv='$d_readv'
23205d_recvmsg='$d_recvmsg'
23206d_rename='$d_rename'
23207d_rewinddir='$d_rewinddir'
23208d_rmdir='$d_rmdir'
23209d_safebcpy='$d_safebcpy'
23210d_safemcpy='$d_safemcpy'
23211d_sanemcmp='$d_sanemcmp'
23212d_sbrkproto='$d_sbrkproto'
23213d_scalbnl='$d_scalbnl'
23214d_sched_yield='$d_sched_yield'
23215d_scm_rights='$d_scm_rights'
23216d_seekdir='$d_seekdir'
23217d_select='$d_select'
23218d_sem='$d_sem'
23219d_semctl='$d_semctl'
23220d_semctl_semid_ds='$d_semctl_semid_ds'
23221d_semctl_semun='$d_semctl_semun'
23222d_semget='$d_semget'
23223d_semop='$d_semop'
23224d_sendmsg='$d_sendmsg'
23225d_setegid='$d_setegid'
23226d_seteuid='$d_seteuid'
23227d_setgrent='$d_setgrent'
23228d_setgrent_r='$d_setgrent_r'
23229d_setgrps='$d_setgrps'
23230d_sethent='$d_sethent'
23231d_sethostent_r='$d_sethostent_r'
23232d_setitimer='$d_setitimer'
23233d_setlinebuf='$d_setlinebuf'
23234d_setlocale='$d_setlocale'
23235d_setlocale_r='$d_setlocale_r'
23236d_setnent='$d_setnent'
23237d_setnetent_r='$d_setnetent_r'
23238d_setpent='$d_setpent'
23239d_setpgid='$d_setpgid'
23240d_setpgrp2='$d_setpgrp2'
23241d_setpgrp='$d_setpgrp'
23242d_setprior='$d_setprior'
23243d_setproctitle='$d_setproctitle'
23244d_setprotoent_r='$d_setprotoent_r'
23245d_setpwent='$d_setpwent'
23246d_setpwent_r='$d_setpwent_r'
23247d_setregid='$d_setregid'
23248d_setresgid='$d_setresgid'
23249d_setresuid='$d_setresuid'
23250d_setreuid='$d_setreuid'
23251d_setrgid='$d_setrgid'
23252d_setruid='$d_setruid'
23253d_setsent='$d_setsent'
23254d_setservent_r='$d_setservent_r'
23255d_setsid='$d_setsid'
23256d_setvbuf='$d_setvbuf'
23257d_shm='$d_shm'
23258d_shmat='$d_shmat'
23259d_shmatprototype='$d_shmatprototype'
23260d_shmctl='$d_shmctl'
23261d_shmdt='$d_shmdt'
23262d_shmget='$d_shmget'
23263d_sigaction='$d_sigaction'
23264d_signbit='$d_signbit'
23265d_sigprocmask='$d_sigprocmask'
23266d_sigsetjmp='$d_sigsetjmp'
23267d_sin6_scope_id='$d_sin6_scope_id'
23268d_sitearch='$d_sitearch'
23269d_snprintf='$d_snprintf'
23270d_sockaddr_in6='$d_sockaddr_in6'
23271d_sockaddr_sa_len='$d_sockaddr_sa_len'
23272d_sockatmark='$d_sockatmark'
23273d_sockatmarkproto='$d_sockatmarkproto'
23274d_socket='$d_socket'
23275d_socklen_t='$d_socklen_t'
23276d_sockpair='$d_sockpair'
23277d_socks5_init='$d_socks5_init'
23278d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
23279d_sqrtl='$d_sqrtl'
23280d_srand48_r='$d_srand48_r'
23281d_srandom_r='$d_srandom_r'
23282d_sresgproto='$d_sresgproto'
23283d_sresuproto='$d_sresuproto'
23284d_statblks='$d_statblks'
23285d_statfs_f_flags='$d_statfs_f_flags'
23286d_statfs_s='$d_statfs_s'
23287d_static_inline='$d_static_inline'
23288d_statvfs='$d_statvfs'
23289d_stdio_cnt_lval='$d_stdio_cnt_lval'
23290d_stdio_ptr_lval='$d_stdio_ptr_lval'
23291d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
23292d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
23293d_stdio_stream_array='$d_stdio_stream_array'
23294d_stdiobase='$d_stdiobase'
23295d_stdstdio='$d_stdstdio'
23296d_strchr='$d_strchr'
23297d_strcoll='$d_strcoll'
23298d_strctcpy='$d_strctcpy'
23299d_strerrm='$d_strerrm'
23300d_strerror='$d_strerror'
23301d_strerror_r='$d_strerror_r'
23302d_strftime='$d_strftime'
23303d_strlcat='$d_strlcat'
23304d_strlcpy='$d_strlcpy'
23305d_strtod='$d_strtod'
23306d_strtol='$d_strtol'
23307d_strtold='$d_strtold'
23308d_strtoll='$d_strtoll'
23309d_strtoq='$d_strtoq'
23310d_strtoul='$d_strtoul'
23311d_strtoull='$d_strtoull'
23312d_strtouq='$d_strtouq'
23313d_strxfrm='$d_strxfrm'
23314d_suidsafe='$d_suidsafe'
23315d_symlink='$d_symlink'
23316d_syscall='$d_syscall'
23317d_syscallproto='$d_syscallproto'
23318d_sysconf='$d_sysconf'
23319d_sysernlst='$d_sysernlst'
23320d_syserrlst='$d_syserrlst'
23321d_system='$d_system'
23322d_tcgetpgrp='$d_tcgetpgrp'
23323d_tcsetpgrp='$d_tcsetpgrp'
23324d_telldir='$d_telldir'
23325d_telldirproto='$d_telldirproto'
23326d_time='$d_time'
23327d_timegm='$d_timegm'
23328d_times='$d_times'
23329d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
23330d_tm_tm_zone='$d_tm_tm_zone'
23331d_tmpnam_r='$d_tmpnam_r'
23332d_truncate='$d_truncate'
23333d_ttyname_r='$d_ttyname_r'
23334d_tzname='$d_tzname'
23335d_u32align='$d_u32align'
23336d_ualarm='$d_ualarm'
23337d_umask='$d_umask'
23338d_uname='$d_uname'
23339d_union_semun='$d_union_semun'
23340d_unordered='$d_unordered'
23341d_unsetenv='$d_unsetenv'
23342d_usleep='$d_usleep'
23343d_usleepproto='$d_usleepproto'
23344d_ustat='$d_ustat'
23345d_vendorarch='$d_vendorarch'
23346d_vendorbin='$d_vendorbin'
23347d_vendorlib='$d_vendorlib'
23348d_vendorscript='$d_vendorscript'
23349d_vfork='$d_vfork'
23350d_void_closedir='$d_void_closedir'
23351d_voidsig='$d_voidsig'
23352d_voidtty='$d_voidtty'
23353d_volatile='$d_volatile'
23354d_vprintf='$d_vprintf'
23355d_vsnprintf='$d_vsnprintf'
23356d_wait4='$d_wait4'
23357d_waitpid='$d_waitpid'
23358d_wcstombs='$d_wcstombs'
23359d_wctomb='$d_wctomb'
23360d_writev='$d_writev'
23361d_xenix='$d_xenix'
23362date='$date'
23363db_hashtype='$db_hashtype'
23364db_prefixtype='$db_prefixtype'
23365db_version_major='$db_version_major'
23366db_version_minor='$db_version_minor'
23367db_version_patch='$db_version_patch'
23368direntrytype='$direntrytype'
23369dlext='$dlext'
23370dlsrc='$dlsrc'
23371doublesize='$doublesize'
23372drand01='$drand01'
23373drand48_r_proto='$drand48_r_proto'
23374dtrace='$dtrace'
23375dynamic_ext='$dynamic_ext'
23376eagain='$eagain'
23377ebcdic='$ebcdic'
23378echo='$echo'
23379egrep='$egrep'
23380emacs='$emacs'
23381endgrent_r_proto='$endgrent_r_proto'
23382endhostent_r_proto='$endhostent_r_proto'
23383endnetent_r_proto='$endnetent_r_proto'
23384endprotoent_r_proto='$endprotoent_r_proto'
23385endpwent_r_proto='$endpwent_r_proto'
23386endservent_r_proto='$endservent_r_proto'
23387eunicefix='$eunicefix'
23388exe_ext='$exe_ext'
23389expr='$expr'
23390extensions='$extensions'
23391extern_C='$extern_C'
23392extras='$extras'
23393fflushNULL='$fflushNULL'
23394fflushall='$fflushall'
23395find='$find'
23396firstmakefile='$firstmakefile'
23397flex='$flex'
23398fpossize='$fpossize'
23399fpostype='$fpostype'
23400freetype='$freetype'
23401from='$from'
23402full_ar='$full_ar'
23403full_csh='$full_csh'
23404full_sed='$full_sed'
23405gccansipedantic='$gccansipedantic'
23406gccosandvers='$gccosandvers'
23407gccversion='$gccversion'
23408getgrent_r_proto='$getgrent_r_proto'
23409getgrgid_r_proto='$getgrgid_r_proto'
23410getgrnam_r_proto='$getgrnam_r_proto'
23411gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
23412gethostbyname_r_proto='$gethostbyname_r_proto'
23413gethostent_r_proto='$gethostent_r_proto'
23414getlogin_r_proto='$getlogin_r_proto'
23415getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
23416getnetbyname_r_proto='$getnetbyname_r_proto'
23417getnetent_r_proto='$getnetent_r_proto'
23418getprotobyname_r_proto='$getprotobyname_r_proto'
23419getprotobynumber_r_proto='$getprotobynumber_r_proto'
23420getprotoent_r_proto='$getprotoent_r_proto'
23421getpwent_r_proto='$getpwent_r_proto'
23422getpwnam_r_proto='$getpwnam_r_proto'
23423getpwuid_r_proto='$getpwuid_r_proto'
23424getservbyname_r_proto='$getservbyname_r_proto'
23425getservbyport_r_proto='$getservbyport_r_proto'
23426getservent_r_proto='$getservent_r_proto'
23427getspnam_r_proto='$getspnam_r_proto'
23428gidformat='$gidformat'
23429gidsign='$gidsign'
23430gidsize='$gidsize'
23431gidtype='$gidtype'
23432glibpth='$glibpth'
23433gmake='$gmake'
23434gmtime_r_proto='$gmtime_r_proto'
23435gnulibc_version='$gnulibc_version'
23436grep='$grep'
23437groupcat='$groupcat'
23438groupstype='$groupstype'
23439gzip='$gzip'
23440h_fcntl='$h_fcntl'
23441h_sysfile='$h_sysfile'
23442hint='$hint'
23443hostcat='$hostcat'
23444html1dir='$html1dir'
23445html1direxp='$html1direxp'
23446html3dir='$html3dir'
23447html3direxp='$html3direxp'
23448hostgenerate='$hostgenerate'
23449hostperl='$hostperl'
23450hostosname='$hostosname'
23451i16size='$i16size'
23452i16type='$i16type'
23453i32size='$i32size'
23454i32type='$i32type'
23455i64size='$i64size'
23456i64type='$i64type'
23457i8size='$i8size'
23458i8type='$i8type'
23459i_arpainet='$i_arpainet'
23460i_assert='$i_assert'
23461i_bsdioctl='$i_bsdioctl'
23462i_crypt='$i_crypt'
23463i_db='$i_db'
23464i_dbm='$i_dbm'
23465i_dirent='$i_dirent'
23466i_dlfcn='$i_dlfcn'
23467i_fcntl='$i_fcntl'
23468i_float='$i_float'
23469i_fp='$i_fp'
23470i_fp_class='$i_fp_class'
23471i_gdbm='$i_gdbm'
23472i_gdbm_ndbm='$i_gdbm_ndbm'
23473i_gdbmndbm='$i_gdbmndbm'
23474i_grp='$i_grp'
23475i_ieeefp='$i_ieeefp'
23476i_inttypes='$i_inttypes'
23477i_langinfo='$i_langinfo'
23478i_libutil='$i_libutil'
23479i_limits='$i_limits'
23480i_locale='$i_locale'
23481i_machcthr='$i_machcthr'
23482i_malloc='$i_malloc'
23483i_mallocmalloc='$i_mallocmalloc'
23484i_math='$i_math'
23485i_memory='$i_memory'
23486i_mntent='$i_mntent'
23487i_ndbm='$i_ndbm'
23488i_netdb='$i_netdb'
23489i_neterrno='$i_neterrno'
23490i_netinettcp='$i_netinettcp'
23491i_niin='$i_niin'
23492i_poll='$i_poll'
23493i_prot='$i_prot'
23494i_pthread='$i_pthread'
23495i_pwd='$i_pwd'
23496i_rpcsvcdbm='$i_rpcsvcdbm'
23497i_sgtty='$i_sgtty'
23498i_shadow='$i_shadow'
23499i_socks='$i_socks'
23500i_stdarg='$i_stdarg'
23501i_stdbool='$i_stdbool'
23502i_stddef='$i_stddef'
23503i_stdlib='$i_stdlib'
23504i_string='$i_string'
23505i_sunmath='$i_sunmath'
23506i_sysaccess='$i_sysaccess'
23507i_sysdir='$i_sysdir'
23508i_sysfile='$i_sysfile'
23509i_sysfilio='$i_sysfilio'
23510i_sysin='$i_sysin'
23511i_sysioctl='$i_sysioctl'
23512i_syslog='$i_syslog'
23513i_sysmman='$i_sysmman'
23514i_sysmode='$i_sysmode'
23515i_sysmount='$i_sysmount'
23516i_sysndir='$i_sysndir'
23517i_sysparam='$i_sysparam'
23518i_syspoll='$i_syspoll'
23519i_sysresrc='$i_sysresrc'
23520i_syssecrt='$i_syssecrt'
23521i_sysselct='$i_sysselct'
23522i_syssockio='$i_syssockio'
23523i_sysstat='$i_sysstat'
23524i_sysstatfs='$i_sysstatfs'
23525i_sysstatvfs='$i_sysstatvfs'
23526i_systime='$i_systime'
23527i_systimek='$i_systimek'
23528i_systimes='$i_systimes'
23529i_systypes='$i_systypes'
23530i_sysuio='$i_sysuio'
23531i_sysun='$i_sysun'
23532i_sysutsname='$i_sysutsname'
23533i_sysvfs='$i_sysvfs'
23534i_syswait='$i_syswait'
23535i_termio='$i_termio'
23536i_termios='$i_termios'
23537i_time='$i_time'
23538i_unistd='$i_unistd'
23539i_ustat='$i_ustat'
23540i_utime='$i_utime'
23541i_values='$i_values'
23542i_varargs='$i_varargs'
23543i_varhdr='$i_varhdr'
23544i_vfork='$i_vfork'
23545ignore_versioned_solibs='$ignore_versioned_solibs'
23546inc_version_list='$inc_version_list'
23547inc_version_list_init='$inc_version_list_init'
23548incpath='$incpath'
23549incpth='$incpth'
23550inews='$inews'
23551initialinstalllocation='$initialinstalllocation'
23552installarchlib='$installarchlib'
23553installbin='$installbin'
23554installhtml1dir='$installhtml1dir'
23555installhtml3dir='$installhtml3dir'
23556installman1dir='$installman1dir'
23557installman3dir='$installman3dir'
23558installprefix='$installprefix'
23559installprefixexp='$installprefixexp'
23560installprivlib='$installprivlib'
23561installscript='$installscript'
23562installsitearch='$installsitearch'
23563installsitebin='$installsitebin'
23564installsitehtml1dir='$installsitehtml1dir'
23565installsitehtml3dir='$installsitehtml3dir'
23566installsitelib='$installsitelib'
23567installsiteman1dir='$installsiteman1dir'
23568installsiteman3dir='$installsiteman3dir'
23569installsitescript='$installsitescript'
23570installstyle='$installstyle'
23571installusrbinperl='$installusrbinperl'
23572installvendorarch='$installvendorarch'
23573installvendorbin='$installvendorbin'
23574installvendorhtml1dir='$installvendorhtml1dir'
23575installvendorhtml3dir='$installvendorhtml3dir'
23576installvendorlib='$installvendorlib'
23577installvendorman1dir='$installvendorman1dir'
23578installvendorman3dir='$installvendorman3dir'
23579installvendorscript='$installvendorscript'
23580intsize='$intsize'
23581issymlink='$issymlink'
23582ivdformat='$ivdformat'
23583ivsize='$ivsize'
23584ivtype='$ivtype'
23585known_extensions='$known_extensions'
23586ksh='$ksh'
23587ld='$ld'
23588ld_can_script='$ld_can_script'
23589lddlflags='$lddlflags'
23590ldflags='$ldflags'
23591ldflags_uselargefiles='$ldflags_uselargefiles'
23592ldlibpthname='$ldlibpthname'
23593less='$less'
23594lib_ext='$lib_ext'
23595libc='$libc'
23596libperl='$libperl'
23597libpth='$libpth'
23598libs='$libs'
23599libsdirs='$libsdirs'
23600libsfiles='$libsfiles'
23601libsfound='$libsfound'
23602libspath='$libspath'
23603libswanted='$libswanted'
23604libswanted_uselargefiles='$libswanted_uselargefiles'
23605line='$line'
23606lint='$lint'
23607lkflags='$lkflags'
23608ln='$ln'
23609lns='$lns'
23610localtime_r_proto='$localtime_r_proto'
23611locincpth='$locincpth'
23612loclibpth='$loclibpth'
23613longdblsize='$longdblsize'
23614longlongsize='$longlongsize'
23615longsize='$longsize'
23616lp='$lp'
23617lpr='$lpr'
23618ls='$ls'
23619lseeksize='$lseeksize'
23620lseektype='$lseektype'
23621mad='$mad'
23622madlyh='$madlyh'
23623madlyobj='$madlyobj'
23624madlysrc='$madlysrc'
23625mail='$mail'
23626mailx='$mailx'
23627make='$make'
23628make_set_make='$make_set_make'
23629mallocobj='$mallocobj'
23630mallocsrc='$mallocsrc'
23631malloctype='$malloctype'
23632man1dir='$man1dir'
23633man1direxp='$man1direxp'
23634man1ext='$man1ext'
23635man3dir='$man3dir'
23636man3direxp='$man3direxp'
23637man3ext='$man3ext'
23638mips_type='$mips_type'
23639mistrustnm='$mistrustnm'
23640mkdir='$mkdir'
23641mmaptype='$mmaptype'
23642modetype='$modetype'
23643more='$more'
23644multiarch='$multiarch'
23645mv='$mv'
23646myarchname='$myarchname'
23647mydomain='$mydomain'
23648myhostname='$myhostname'
23649myuname='$myuname'
23650n='$n'
23651need_va_copy='$need_va_copy'
23652netdb_hlen_type='$netdb_hlen_type'
23653netdb_host_type='$netdb_host_type'
23654netdb_name_type='$netdb_name_type'
23655netdb_net_type='$netdb_net_type'
23656nm='$nm'
23657nm_opt='$nm_opt'
23658nm_so_opt='$nm_so_opt'
23659nonxs_ext='$nonxs_ext'
23660nroff='$nroff'
23661nvEUformat='$nvEUformat'
23662nvFUformat='$nvFUformat'
23663nvGUformat='$nvGUformat'
23664nv_overflows_integers_at='$nv_overflows_integers_at'
23665nv_preserves_uv_bits='$nv_preserves_uv_bits'
23666nveformat='$nveformat'
23667nvfformat='$nvfformat'
23668nvgformat='$nvgformat'
23669nvsize='$nvsize'
23670nvtype='$nvtype'
23671o_nonblock='$o_nonblock'
23672obj_ext='$obj_ext'
23673old_pthread_create_joinable='$old_pthread_create_joinable'
23674optimize='$optimize'
23675orderlib='$orderlib'
23676osname='$osname'
23677osvers='$osvers'
23678otherlibdirs='$otherlibdirs'
23679package='$package'
23680pager='$pager'
23681passcat='$passcat'
23682patchlevel='$patchlevel'
23683path_sep='$path_sep'
23684perl5='$perl5'
23685perl='$perl'
23686perl_patchlevel='$perl_patchlevel'
23687perl_static_inline='$perl_static_inline'
23688perladmin='$perladmin'
23689perllibs='$perllibs'
23690perlpath='$perlpath'
23691pg='$pg'
23692phostname='$phostname'
23693pidtype='$pidtype'
23694plibpth='$plibpth'
23695pmake='$pmake'
23696pr='$pr'
23697prefix='$prefix'
23698prefixexp='$prefixexp'
23699privlib='$privlib'
23700privlibexp='$privlibexp'
23701procselfexe='$procselfexe'
23702prototype='$prototype'
23703ptrsize='$ptrsize'
23704quadkind='$quadkind'
23705quadtype='$quadtype'
23706randbits='$randbits'
23707randfunc='$randfunc'
23708random_r_proto='$random_r_proto'
23709randseedtype='$randseedtype'
23710ranlib='$ranlib'
23711rd_nodata='$rd_nodata'
23712readdir64_r_proto='$readdir64_r_proto'
23713readdir_r_proto='$readdir_r_proto'
23714revision='$revision'
23715rm='$rm'
23716rm_try='$rm_try'
23717rmail='$rmail'
23718run='$run'
23719runnm='$runnm'
23720sGMTIME_max='$sGMTIME_max'
23721sGMTIME_min='$sGMTIME_min'
23722sLOCALTIME_max='$sLOCALTIME_max'
23723sLOCALTIME_min='$sLOCALTIME_min'
23724sPRIEUldbl='$sPRIEUldbl'
23725sPRIFUldbl='$sPRIFUldbl'
23726sPRIGUldbl='$sPRIGUldbl'
23727sPRIXU64='$sPRIXU64'
23728sPRId64='$sPRId64'
23729sPRIeldbl='$sPRIeldbl'
23730sPRIfldbl='$sPRIfldbl'
23731sPRIgldbl='$sPRIgldbl'
23732sPRIi64='$sPRIi64'
23733sPRIo64='$sPRIo64'
23734sPRIu64='$sPRIu64'
23735sPRIx64='$sPRIx64'
23736sSCNfldbl='$sSCNfldbl'
23737sched_yield='$sched_yield'
23738scriptdir='$scriptdir'
23739scriptdirexp='$scriptdirexp'
23740sed='$sed'
23741seedfunc='$seedfunc'
23742selectminbits='$selectminbits'
23743selecttype='$selecttype'
23744sendmail='$sendmail'
23745setgrent_r_proto='$setgrent_r_proto'
23746sethostent_r_proto='$sethostent_r_proto'
23747setlocale_r_proto='$setlocale_r_proto'
23748setnetent_r_proto='$setnetent_r_proto'
23749setprotoent_r_proto='$setprotoent_r_proto'
23750setpwent_r_proto='$setpwent_r_proto'
23751setservent_r_proto='$setservent_r_proto'
23752sh='$sh'
23753shar='$shar'
23754sharpbang='$sharpbang'
23755shmattype='$shmattype'
23756shortsize='$shortsize'
23757shrpenv='$shrpenv'
23758shsharp='$shsharp'
23759sig_count='$sig_count'
23760sig_name='$sig_name'
23761sig_name_init='$sig_name_init'
23762sig_num='$sig_num'
23763sig_num_init='$sig_num_init'
23764sig_size='$sig_size'
23765signal_t='$signal_t'
23766sitearch='$sitearch'
23767sitearchexp='$sitearchexp'
23768sitebin='$sitebin'
23769sitebinexp='$sitebinexp'
23770sitehtml1dir='$sitehtml1dir'
23771sitehtml1direxp='$sitehtml1direxp'
23772sitehtml3dir='$sitehtml3dir'
23773sitehtml3direxp='$sitehtml3direxp'
23774sitelib='$sitelib'
23775sitelib_stem='$sitelib_stem'
23776sitelibexp='$sitelibexp'
23777siteman1dir='$siteman1dir'
23778siteman1direxp='$siteman1direxp'
23779siteman3dir='$siteman3dir'
23780siteman3direxp='$siteman3direxp'
23781siteprefix='$siteprefix'
23782siteprefixexp='$siteprefixexp'
23783sitescript='$sitescript'
23784sitescriptexp='$sitescriptexp'
23785sizesize='$sizesize'
23786sizetype='$sizetype'
23787sleep='$sleep'
23788smail='$smail'
23789so='$so'
23790sockethdr='$sockethdr'
23791socketlib='$socketlib'
23792socksizetype='$socksizetype'
23793sort='$sort'
23794spackage='$spackage'
23795spitshell='$spitshell'
23796srand48_r_proto='$srand48_r_proto'
23797srandom_r_proto='$srandom_r_proto'
23798src='$src'
23799ssizetype='$ssizetype'
23800st_ino_sign='$st_ino_sign'
23801st_ino_size='$st_ino_size'
23802startperl='$startperl'
23803startsh='$startsh'
23804static_ext='$static_ext'
23805stdchar='$stdchar'
23806stdio_base='$stdio_base'
23807stdio_bufsiz='$stdio_bufsiz'
23808stdio_cnt='$stdio_cnt'
23809stdio_filbuf='$stdio_filbuf'
23810stdio_ptr='$stdio_ptr'
23811stdio_stream_array='$stdio_stream_array'
23812strerror_r_proto='$strerror_r_proto'
23813strings='$strings'
23814submit='$submit'
23815subversion='$subversion'
23816sysman='$sysman'
23817sysroot='$sysroot'
23818tail='$tail'
23819tar='$tar'
23820targetarch='$targetarch'
23821targetdir='$targetdir'
23822targethost='$targethost'
23823targetmkdir='$targetmkdir'
23824targetport='$targetport'
23825targetsh='$targetsh'
23826tbl='$tbl'
23827tee='$tee'
23828test='$test'
23829timeincl='$timeincl'
23830timetype='$timetype'
23831tmpnam_r_proto='$tmpnam_r_proto'
23832to='$to'
23833touch='$touch'
23834tr='$tr'
23835trnl='$trnl'
23836troff='$troff'
23837ttyname_r_proto='$ttyname_r_proto'
23838u16size='$u16size'
23839u16type='$u16type'
23840u32size='$u32size'
23841u32type='$u32type'
23842u64size='$u64size'
23843u64type='$u64type'
23844u8size='$u8size'
23845u8type='$u8type'
23846uidformat='$uidformat'
23847uidsign='$uidsign'
23848uidsize='$uidsize'
23849uidtype='$uidtype'
23850uname='$uname'
23851uniq='$uniq'
23852uquadtype='$uquadtype'
23853use5005threads='$use5005threads'
23854use64bitall='$use64bitall'
23855use64bitint='$use64bitint'
23856usecrosscompile='$usecrosscompile'
23857usedevel='$usedevel'
23858usedl='$usedl'
23859usedtrace='$usedtrace'
23860usefaststdio='$usefaststdio'
23861useithreads='$useithreads'
23862usekernprocpathname='$usekernprocpathname'
23863uselargefiles='$uselargefiles'
23864uselongdouble='$uselongdouble'
23865usemallocwrap='$usemallocwrap'
23866usemorebits='$usemorebits'
23867usemultiplicity='$usemultiplicity'
23868usemymalloc='$usemymalloc'
23869usenm='$usenm'
23870usensgetexecutablepath='$usensgetexecutablepath'
23871useopcode='$useopcode'
23872useperlio='$useperlio'
23873useposix='$useposix'
23874usereentrant='$usereentrant'
23875userelocatableinc='$userelocatableinc'
23876useshrplib='$useshrplib'
23877usesitecustomize='$usesitecustomize'
23878usesocks='$usesocks'
23879usethreads='$usethreads'
23880usevendorprefix='$usevendorprefix'
23881useversionedarchname='$useversionedarchname'
23882usevfork='$usevfork'
23883usrinc='$usrinc'
23884uuname='$uuname'
23885uvXUformat='$uvXUformat'
23886uvoformat='$uvoformat'
23887uvsize='$uvsize'
23888uvtype='$uvtype'
23889uvuformat='$uvuformat'
23890uvxformat='$uvxformat'
23891vaproto='$vaproto'
23892vendorarch='$vendorarch'
23893vendorarchexp='$vendorarchexp'
23894vendorbin='$vendorbin'
23895vendorbinexp='$vendorbinexp'
23896vendorhtml1dir='$vendorhtml1dir'
23897vendorhtml1direxp='$vendorhtml1direxp'
23898vendorhtml3dir='$vendorhtml3dir'
23899vendorhtml3direxp='$vendorhtml3direxp'
23900vendorlib='$vendorlib'
23901vendorlib_stem='$vendorlib_stem'
23902vendorlibexp='$vendorlibexp'
23903vendorman1dir='$vendorman1dir'
23904vendorman1direxp='$vendorman1direxp'
23905vendorman3dir='$vendorman3dir'
23906vendorman3direxp='$vendorman3direxp'
23907vendorprefix='$vendorprefix'
23908vendorprefixexp='$vendorprefixexp'
23909vendorscript='$vendorscript'
23910vendorscriptexp='$vendorscriptexp'
23911version='$version'
23912version_patchlevel_string='$version_patchlevel_string'
23913versiononly='$versiononly'
23914vi='$vi'
23915xlibpth='$xlibpth'
23916yacc='$yacc'
23917yaccflags='$yaccflags'
23918zcat='$zcat'
23919zip='$zip'
23920EOT
23921
23922: add special variables
23923$test -f $src/patchlevel.h && \
23924awk '/^#define[ ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
23925echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
23926echo "PERL_CONFIG_SH=true" >>config.sh
23927
23928: propagate old symbols
23929if $test -f UU/config.sh; then
23930 <UU/config.sh $sort | $uniq >UU/oldconfig.sh
23931 $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
23932 config.sh config.sh UU/oldconfig.sh |\
23933 $sort | $uniq -u >UU/oldsyms
23934 set X `$cat UU/oldsyms`
23935 shift
23936 case $# in
23937 0) ;;
23938 *)
23939 $cat <<EOM
23940Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
23941EOM
23942 echo ": Variables propagated from previous config.sh file." >>config.sh
23943 for sym in `$cat UU/oldsyms`; do
23944 echo " Propagating $hint variable "'$'"$sym..."
23945 eval 'tmp="$'"${sym}"'"'
23946 echo "$tmp" | \
23947 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
23948 done
23949 ;;
23950 esac
23951fi
23952
23953: Finish up by extracting the .SH files
23954case "$alldone" in
23955exit)
23956 $rm -rf UU
23957 echo "Extraction done."
23958 exit 0
23959 ;;
23960cont)
23961 ;;
23962'')
23963 dflt=''
23964 nostick=true
23965 $cat <<EOM
23966
23967If you'd like to make any changes to the config.sh file before I begin
23968to configure things, do it as a shell escape now (e.g. !vi config.sh).
23969
23970EOM
23971 rp="Press return or use a shell escape to edit config.sh:"
23972 . UU/myread
23973 nostick=''
23974 case "$ans" in
23975 '') ;;
23976 *) : in case they cannot read
23977 sh 1>&4 -c "$ans";;
23978 esac
23979 ;;
23980esac
23981
23982: if this fails, just run all the .SH files by hand
23983. ./config.sh
23984
23985echo " "
23986exec 1>&4
23987pwd=`pwd`
23988. ./UU/extract
23989cd "$pwd"
23990
23991if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
23992 dflt=y
23993 case "$silent" in
23994 true) ;;
23995 *)
23996 $cat <<EOM
23997
23998Now you need to generate make dependencies by running "$make depend".
23999You might prefer to run it in background: "$make depend > makedepend.out &"
24000It can take a while, so you might not want to run it right now.
24001
24002EOM
24003 ;;
24004 esac
24005 rp="Run $make depend now?"
24006 . UU/myread
24007 case "$ans" in
24008 y*)
24009 $make depend && echo "Now you must run '$make'."
24010 ;;
24011 *)
24012 echo "You must run '$make depend' then '$make'."
24013 ;;
24014 esac
24015elif test -f [Mm]akefile; then
24016 echo " "
24017 echo "Now you must run a $make."
24018else
24019 echo "Configure done."
24020fi
24021
24022if $test -f Policy.sh; then
24023 $cat <<EOM
24024
24025If you compile $package on a different machine or from a different object
24026directory, copy the Policy.sh file from this object directory to the
24027new one before you run Configure -- this will help you with most of
24028the policy defaults.
24029
24030EOM
24031fi
24032if $test -f config.msg; then
24033 echo "Hmm. I also noted the following information while running:"
24034 echo " "
24035 $cat config.msg >&4
24036 $rm -f config.msg
24037fi
24038$rm -f kit*isdone ark*isdone
24039$rm -rf UU
24040
24041: End of Configure
24042