This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl5.000 patch.0l: MakeMaker 4.085 and upgrade Configure to dist3 PL 51.
[perl5.git] / Configure
CommitLineData
2304df62
AD
1#! /bin/sh
2#
3# If these # comments don't work, trim them. Don't worry about any other
4# shell scripts, Configure will trim # comments from them for you.
5#
6# (If you are trying to port this package to a machine without sh,
7# I would suggest you have a look at the prototypical config_h.SH file
8# and edit it to reflect your system. Some packages may include samples
9# of config.h for certain machines, so you might look for one of those.)
10#
11# Yes, you may rip this off to use in other distribution packages. This
12# script belongs to the public domain and cannot be copyrighted.
13#
14# (Note: this Configure script was generated automatically. Rather than
15# working with this copy of Configure, you may wish to get metaconfig.
16# The dist-3.0 package (which contains metaconfig) was posted in
17# comp.sources.misc so you may fetch it yourself from your nearest
18# archive site. Check with Archie if you don't know where that can be.)
19#
20
ecfc5424 21# $Id: Head.U,v 3.0.1.6 1994/10/29 15:54:19 ram Exp $
2304df62 22#
40000a8c 23# Generated on Tue Feb 21 11:46:04 EST 1995 [metaconfig 3.0 PL51]
2304df62
AD
24
25cat >/tmp/c1$$ <<EOF
26ARGGGHHHH!!!!!
27
28SCO csh still thinks true is false. Write to SCO today and tell them that next
29year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
30
31(Actually, Configure ought to just patch csh in place. Hmm. Hmmmmm. All
32we'd have to do is go in and swap the && and || tokens, wherever they are.)
33
34[End of diatribe. We now return you to your regularly scheduled programming...]
35EOF
36cat >/tmp/c2$$ <<EOF
37
38OOPS! You naughty creature! You didn't run Configure with sh!
39I will attempt to remedy the situation by running sh for you...
40EOF
41
42true || cat /tmp/c1$$ /tmp/c2$$
43true || exec sh $0 $argv:q
44
45(exit $?0) || cat /tmp/c2$$
46(exit $?0) || exec sh $0 $argv:q
47rm -f /tmp/c1$$ /tmp/c2$$
48
a0d0e21e
LW
49: compute my invocation name
50me=$0
51case "$0" in
52*/*)
53 me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
54 test "$me" || me=$0
55 ;;
56esac
57
58
59: Proper PATH setting
60paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
61paths=$paths:'/usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin'
62paths=$paths:'/sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb'
63paths=$paths:'/bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin'
64paths=$paths:'/etc /usr/lib /usr/ucblib /lib /usr/ccs/lib'
65paths=$paths:'/sbin /usr/sbin /usr/libexec'
66
67for p in $paths
68do
69 case ":$PATH:" in
70 *:$p:*) ;;
71 *) test -d $p && PATH=$PATH:$p ;;
72 esac
73done
74
75PATH=.:$PATH
2304df62
AD
76export PATH
77
a0d0e21e 78: Sanity checks
2304df62 79if test ! -t 0; then
a0d0e21e 80 echo "Say 'sh $me', not 'sh <$me'"
2304df62
AD
81 exit 1
82fi
83
84: On HP-UX, large Configure scripts may exercise a bug in /bin/sh
85if test -f /hp-ux -a -f /bin/ksh; then
86 if (PATH=.; alias -x) >/dev/null 2>&1; then
87 : already under /bin/ksh
88 else
89 cat <<'EOM'
90(Feeding myself to ksh to avoid nasty sh bug in "here document" expansion.)
91EOM
ecfc5424 92 unset ENV
2304df62
AD
93 exec /bin/ksh $0 "$@"
94 fi
95else
96 : Warn them if they use ksh on other systems
97 (PATH=.; alias -x) >/dev/null 2>&1 && \
a0d0e21e
LW
98 cat <<EOM
99(I see you are using the Korn shell. Some ksh's blow up on $me,
2304df62
AD
100especially on exotic machines. If yours does, try the Bourne shell instead.)
101EOM
102fi
103
104: Configure runs within the UU subdirectory
105test -d UU || mkdir UU
106cd UU && rm -f *
107
a0d0e21e 108dynamic_ext=''
2304df62 109extensions=''
a0d0e21e
LW
110known_extensions=''
111static_ext=''
112useposix=''
ecfc5424 113d_bsd=''
2304df62
AD
114d_eunice=''
115d_xenix=''
116eunicefix=''
117Mcc=''
118awk=''
119bash=''
120bison=''
121byacc=''
122cat=''
123chgrp=''
124chmod=''
125chown=''
ecfc5424 126comm=''
2304df62
AD
127compress=''
128cp=''
129cpio=''
130cpp=''
131csh=''
132date=''
133echo=''
134egrep=''
135emacs=''
136expr=''
137find=''
138flex=''
139gcc=''
140grep=''
141inews=''
142ksh=''
143less=''
144line=''
145lint=''
146ln=''
147lp=''
148lpr=''
149ls=''
150mail=''
151mailx=''
152make=''
153mkdir=''
154more=''
155mv=''
156nroff=''
157perl=''
158pg=''
159pmake=''
160pr=''
161rm=''
162rmail=''
163sed=''
164sendmail=''
165sh=''
166shar=''
167sleep=''
168smail=''
169sort=''
170submit=''
171tail=''
172tar=''
173tbl=''
174test=''
175touch=''
176tr=''
177troff=''
178uname=''
179uniq=''
180uuname=''
181vi=''
182zcat=''
1aef975c 183full_sed=''
a0d0e21e 184libswanted=''
2304df62
AD
185hint=''
186myuname=''
85e6fe83
LW
187osname=''
188osvers=''
2304df62
AD
189Author=''
190Date=''
191Header=''
192Id=''
193Locker=''
194Log=''
195RCSfile=''
196Revision=''
197Source=''
198State=''
199afs=''
a0d0e21e
LW
200alignbytes=''
201archlib=''
202archlibexp=''
a0d0e21e
LW
203d_archlib=''
204installarchlib=''
40000a8c
AD
205archname=''
206myarchname=''
ecfc5424 207baserev=''
2304df62
AD
208bin=''
209binexp=''
210installbin=''
211byteorder=''
212cc=''
213gccversion=''
214ccflags=''
215cppflags=''
216ldflags=''
217lkflags=''
218optimize=''
219cf_by=''
220cf_time=''
221contains=''
a0d0e21e 222cpp_stuff=''
2304df62
AD
223cpplast=''
224cppminus=''
225cpprun=''
226cppstdin=''
227d_access=''
a0d0e21e 228d_alarm=''
ecfc5424 229d_attribut=''
2304df62
AD
230d_bcmp=''
231d_bcopy=''
1aef975c 232d_byacc=''
2304df62
AD
233d_bzero=''
234d_casti32=''
235castflags=''
236d_castneg=''
a0d0e21e
LW
237d_chown=''
238d_chroot=''
2304df62 239d_chsize=''
a0d0e21e
LW
240d_closedir=''
241d_void_closedir=''
2304df62
AD
242d_const=''
243cryptlib=''
244d_crypt=''
245d_csh=''
1aef975c 246full_csh=''
a0d0e21e
LW
247d_cuserid=''
248d_dbl_dig=''
249d_difftime=''
250d_dlerror=''
251d_dlopen=''
252d_dlsymun=''
2304df62 253d_dosuid=''
a0d0e21e
LW
254d_suidsafe=''
255d_drem=''
2304df62
AD
256d_dup2=''
257d_fchmod=''
258d_fchown=''
259d_fcntl=''
a0d0e21e
LW
260d_fd_macros=''
261d_fd_set=''
262d_fds_bits=''
263d_fgetpos=''
2304df62
AD
264d_flexfnam=''
265d_flock=''
a0d0e21e
LW
266d_fmod=''
267d_fork=''
268d_fsetpos=''
269d_Gconvert=''
2304df62
AD
270d_getgrps=''
271d_gethent=''
272aphostname=''
273d_gethname=''
274d_phostname=''
275d_uname=''
a0d0e21e 276d_getlogin=''
2304df62
AD
277d_getpgrp2=''
278d_getpgrp=''
a0d0e21e 279d_getppid=''
2304df62
AD
280d_getprior=''
281d_htonl=''
282d_isascii=''
283d_killpg=''
284d_link=''
a0d0e21e
LW
285d_linuxstd=''
286d_locconv=''
287d_lockf=''
2304df62 288d_lstat=''
a0d0e21e
LW
289d_mblen=''
290d_mbstowcs=''
291d_mbtowc=''
2304df62
AD
292d_memcmp=''
293d_memcpy=''
294d_memmove=''
295d_memset=''
296d_mkdir=''
a0d0e21e
LW
297d_mkfifo=''
298d_mktime=''
2304df62
AD
299d_msg=''
300d_msgctl=''
301d_msgget=''
302d_msgrcv=''
303d_msgsnd=''
a0d0e21e 304d_nice=''
2304df62 305d_open3=''
a0d0e21e
LW
306d_fpathconf=''
307d_pathconf=''
308d_pause=''
309d_pipe=''
2304df62
AD
310d_portable=''
311d_readdir=''
85e6fe83
LW
312d_rewinddir=''
313d_seekdir=''
314d_telldir=''
a0d0e21e 315d_readlink=''
2304df62
AD
316d_rename=''
317d_rmdir=''
318d_safebcpy=''
319d_safemcpy=''
320d_select=''
321d_sem=''
322d_semctl=''
323d_semget=''
324d_semop=''
325d_setegid=''
326d_seteuid=''
a0d0e21e 327d_setlinebuf=''
2304df62
AD
328d_setlocale=''
329d_setpgid=''
330d_setpgrp2=''
331d_bsdpgrp=''
332d_setpgrp=''
333d_setprior=''
334d_setregid=''
335d_setresgid=''
336d_setresuid=''
337d_setreuid=''
338d_setrgid=''
339d_setruid=''
340d_setsid=''
341d_shm=''
342d_shmat=''
a0d0e21e
LW
343d_shmatprototype=''
344shmattype=''
2304df62
AD
345d_shmctl=''
346d_shmdt=''
347d_shmget=''
348d_oldsock=''
349d_socket=''
350d_sockpair=''
351sockethdr=''
352socketlib=''
353d_statblks=''
354d_stdstdio=''
355d_index=''
356d_strchr=''
a0d0e21e 357d_strcoll=''
2304df62
AD
358d_strctcpy=''
359d_strerrm=''
360d_strerror=''
361d_sysernlst=''
362d_syserrlst=''
a0d0e21e 363d_strxfrm=''
2304df62
AD
364d_symlink=''
365d_syscall=''
a0d0e21e 366d_sysconf=''
2304df62 367d_system=''
a0d0e21e
LW
368d_tcgetpgrp=''
369d_tcsetpgrp=''
85e6fe83
LW
370d_time=''
371timetype=''
2304df62
AD
372clocktype=''
373d_times=''
374d_truncate=''
a0d0e21e
LW
375d_tzname=''
376d_umask=''
2304df62 377d_vfork=''
a0d0e21e 378usevfork=''
2304df62
AD
379d_voidsig=''
380signal_t=''
381d_volatile=''
382d_charvspr=''
383d_vprintf=''
384d_wait4=''
385d_waitpid=''
a0d0e21e
LW
386d_wcstombs=''
387d_wctomb=''
388dlext=''
85e6fe83
LW
389cccdlflags=''
390ccdlflags=''
ecfc5424 391d_shrplib=''
2304df62 392dlsrc=''
85e6fe83 393lddlflags=''
ecfc5424 394shrpdir=''
2304df62 395usedl=''
a0d0e21e 396fpostype=''
2304df62
AD
397gidtype=''
398groupstype=''
399h_fcntl=''
400h_sysfile=''
ecfc5424
AD
401db_hashtype=''
402db_prefixtype=''
a0d0e21e 403i_db=''
2304df62
AD
404i_dbm=''
405d_dirnamlen=''
a0d0e21e 406direntrytype=''
2304df62 407i_dirent=''
a0d0e21e 408i_dld=''
2304df62
AD
409i_dlfcn=''
410i_fcntl=''
a0d0e21e 411i_float=''
2304df62
AD
412i_gdbm=''
413i_grp=''
a0d0e21e
LW
414i_limits=''
415i_malloc=''
416i_math=''
85e6fe83 417i_memory=''
2304df62 418i_ndbm=''
85e6fe83 419i_neterrno=''
2304df62
AD
420i_niin=''
421i_sysin=''
422d_pwage=''
423d_pwchange=''
424d_pwclass=''
425d_pwcomment=''
426d_pwexpire=''
427d_pwquota=''
428i_pwd=''
2304df62 429i_stddef=''
a0d0e21e 430i_stdlib=''
2304df62
AD
431i_string=''
432strings=''
433i_sysdir=''
434i_sysfile=''
435d_voidtty=''
436i_bsdioctl=''
a0d0e21e 437i_sysfilio=''
2304df62
AD
438i_sysioctl=''
439i_syssockio=''
440i_sysndir=''
a0d0e21e 441i_sysparam=''
2304df62 442i_sysselct=''
1aef975c 443i_sysstat=''
a0d0e21e 444i_systimes=''
fed7345c 445i_systypes=''
2304df62
AD
446i_sgtty=''
447i_termio=''
448i_termios=''
449i_systime=''
450i_systimek=''
451i_time=''
452timeincl=''
85e6fe83 453i_unistd=''
2304df62 454i_utime=''
a0d0e21e 455i_stdarg=''
2304df62
AD
456i_varargs=''
457i_varhdr=''
458i_vfork=''
459intsize=''
2304df62 460libc=''
a0d0e21e 461glibpth=''
2304df62
AD
462libpth=''
463plibpth=''
464xlibpth=''
465libs=''
85e6fe83
LW
466lns=''
467lseektype=''
468d_mymalloc=''
2304df62
AD
469mallocobj=''
470mallocsrc=''
471malloctype=''
472usemymalloc=''
473installmansrc=''
474manext=''
475mansrc=''
476mansrcexp=''
477huge=''
478large=''
479medium=''
480models=''
481small=''
482split=''
a0d0e21e 483modetype=''
2304df62
AD
484mydomain=''
485myhostname=''
486phostname=''
487c=''
488n=''
489groupcat=''
490hostcat=''
491passcat=''
85e6fe83
LW
492orderlib=''
493ranlib=''
2304df62
AD
494package=''
495spackage=''
ecfc5424 496patchlevel=''
a0d0e21e 497prefix=''
1aef975c 498prefixexp=''
2304df62
AD
499installprivlib=''
500privlib=''
501privlibexp=''
502prototype=''
503randbits=''
504installscript=''
505scriptdir=''
506scriptdirexp=''
a0d0e21e 507selecttype=''
2304df62 508sig_name=''
a0d0e21e
LW
509sizetype=''
510so=''
2304df62
AD
511sharpbang=''
512shsharp=''
513spitshell=''
a0d0e21e 514ssizetype=''
2304df62
AD
515startsh=''
516stdchar=''
517sysman=''
518uidtype=''
519nm_opt=''
520runnm=''
521usenm=''
522incpath=''
523mips=''
524mips_type=''
525usrinc=''
526defvoidused=''
527voidflags=''
2304df62
AD
528CONFIG=''
529
ecfc5424
AD
530define='define'
531undef='undef'
532smallmach='pdp11 i8086 z8000 i80286 iAPX286'
533rmlist=''
534
535: We must find out about Eunice early
536eunicefix=':'
537if test -f /etc/unixtovms; then
538 eunicefix=/etc/unixtovms
539fi
540if test -f /etc/unixtovms.exe; then
541 eunicefix=/etc/unixtovms.exe
542fi
543
544: list of known cpp symbols, sorted alphabetically
545al="AMIX BIT_MSF BSD BSD4_3 BSD_NET2 CMU CRAY DGUX DOLPHIN DPX2"
546al="$al GO32 GOULD_PN HP700 I386 I80960 I960 Lynx M68000 M68K MACH"
547al="$al MIPSEB MIPSEL MSDOS MTXINU MULTIMAX MVS"
548al="$al M_COFF M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM"
549al="$al M_SYS3 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX"
550al="$al NeXT OCS88 OSF1 PARISC PC532 PORTAR POSIX"
551al="$al PWB R3000 RES RISC6000 RT Sun386i SVR3 SVR4"
552al="$al SYSTYPE_BSD SYSTYPE_SVR4 SYSTYPE_SYSV Tek4132 Tek4300"
553al="$al UMAXV USGr4 USGr4_2 UTEK UTS UTek UnicomPBB UnicomPBD Utek"
554al="$al VMS Xenix286"
555al="$al _AIX _AIX32 _AIX370 _AM29000 _COFF _CRAY _CX_UX _EPI"
556al="$al _IBMESA _IBMR2 _M88K _M88KBCS_TARGET"
557al="$al _MIPSEB _MIPSEL _M_COFF _M_I86 _M_I86SM _M_SYS3"
558al="$al _M_SYS5 _M_SYSIII _M_SYSV _M_UNIX _M_XENIX _NLS _PGC_ _R3000"
559al="$al _SYSTYPE_BSD _SYSTYPE_BSD43 _SYSTYPE_SVR4"
560al="$al _SYSTYPE_SYSV _SYSV3 _U370 _UNICOS"
561al="$al __386BSD__ __BIG_ENDIAN __BIG_ENDIAN__ __BSD_4_4__"
562al="$al __DGUX__ __DPX2__ __H3050R __H3050RX"
563al="$al __LITTLE_ENDIAN __LITTLE_ENDIAN__ __MACH__"
564al="$al __MIPSEB __MIPSEB__ __MIPSEL __MIPSEL__"
565al="$al __Next__ __OSF1__ __PARAGON__ __PGC__ __PWB __STDC__"
566al="$al __SVR4_2__ __UMAXV__"
567al="$al ____386BSD____ __alpha __alpha__ __amiga"
568al="$al __bsd4_2 __bsd4_2__ __bsdi__ __convex__"
569al="$al __host_mips__"
570al="$al __hp9000s200 __hp9000s300 __hp9000s400 __hp9000s500"
571al="$al __hp9000s500 __hp9000s700 __hp9000s800"
572al="$al __hppa __hpux __hp_osf __i286 __i286__ __i386 __i386__"
573al="$al __i486 __i486__ __i860 __i860__ __ibmesa __ksr1__ __linux__"
574al="$al __m68k __m68k__ __m88100__ __m88k __m88k__"
575al="$al __mc68000 __mc68000__ __mc68020 __mc68020__"
576al="$al __mc68030 __mc68030__ __mc68040 __mc68040__"
577al="$al __mc88100 __mc88100__ __mips __mips__"
578al="$al __motorola__ __osf__ __pa_risc __sparc__ __stdc__"
579al="$al __sun __sun__ __svr3__ __svr4__ __ultrix __ultrix__"
580al="$al __unix __unix__ __uxpm__ __uxps__ __vax __vax__"
581al="$al _host_mips _mips _unix"
582al="$al a29k aegis aix aixpc alliant alpha am29000 amiga ansi ardent"
583al="$al apollo ardent att386 att3b"
584al="$al bsd bsd43 bsd4_2 bsd4_3 bsd4_4 bsdi bull"
585al="$al cadmus clipper concurrent convex cray ctix"
586al="$al dmert encore gcos gcx gimpel gould"
587al="$al hbullx20 hcx host_mips hp200 hp300 hp700 hp800"
588al="$al hp9000 hp9000s300 hp9000s400 hp9000s500"
589al="$al hp9000s700 hp9000s800 hp9k8 hppa hpux"
590al="$al i186 i286 i386 i486 i8086"
591al="$al i80960 i860 iAPX286 ibm ibm032 ibmrt interdata is68k"
592al="$al ksr1 linux luna luna88k m68k m88100 m88k"
593al="$al mc300 mc500 mc68000 mc68010 mc68020 mc68030"
594al="$al mc68040 mc68060 mc68k mc68k32 mc700"
595al="$al mc88000 mc88100 merlin mert mips mvs n16"
596al="$al ncl_el ncl_mr"
597al="$al news1500 news1700 news1800 news1900 news3700"
598al="$al news700 news800 news900 ns16000 ns32000"
599al="$al ns32016 ns32332 ns32k nsc32000 os osf"
600al="$al parisc pc532 pdp11 plexus posix pyr"
601al="$al riscix riscos scs sequent sgi sinix sony sony_news"
602al="$al sonyrisc sparc sparclite spectrum stardent stratos"
603al="$al sun sun3 sun386 svr4 sysV68 sysV88"
604al="$al titan tower tower32 tower32_200 tower32_600 tower32_700"
605al="$al tower32_800 tower32_850 tss u370 u3b u3b2 u3b20 u3b200"
606al="$al u3b20d u3b5 ultrix unix unixpc unos vax venix vms"
607al="$al xenix z8000"
608
609gccversion=''
610groupstype=''
611i_whoami=''
612: change the next line if compiling for Xenix/286 on Xenix/386
613xlibpth='/usr/lib/386 /lib/386'
614
615: general looking path for locating libraries
616glibpth="/lib/pa1.1 /usr/lib/large /lib /usr/lib $xlibpth"
617glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
618glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib /usr/shlib"
619
620: Private path used by Configure to find libraries. Its value
621: is prepended to libpth. This variable takes care of special
622: machines, like the mips. Usually, it should be empty.
623plibpth=''
624
625: default library list
626libswanted=''
627: full support for void wanted by default
628defvoidused=15
629
630: set useposix=false in your hint file to disable the POSIX extension.
631useposix=true
632: no include file wanted by default
633inclwanted=''
634
635: List of libraries we want.
636libswanted='net socket inet nsl nm ndbm gdbm dbm db malloc dl'
637libswanted="$libswanted dld ld sun m c cposix posix ndir dir crypt"
638libswanted="$libswanted ucb bsd BSD PW x"
1aef975c 639: We probably want to search /usr/shlib before most other libraries.
ecfc5424
AD
640: This is only used by ext/util/extliblist
641glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
642glibpth="/usr/shlib $glibpth"
643: Do not use vfork unless overridden by a hint file.
644usevfork=false
1aef975c
AD
645: We might as well always be portable. It makes no difference for
646: perl5, and makes people happy.
647d_portable=define
ecfc5424 648
2304df62
AD
649: script used to extract .SH files with variable substitutions
650cat >extract <<'EOS'
651CONFIG=true
652echo "Doing variable substitutions on .SH files..."
653if test -f MANIFEST; then
a0d0e21e
LW
654 shlist=`awk '{print $1}' <MANIFEST | grep '\.SH'`
655 : Pick up possible extension manifests.
656 for dir in ext/* ; do
657 if test -f $dir/MANIFEST; then
658 xxx=`awk '{print $1}' < $dir/MANIFEST |
659 sed -n "/\.SH$/ s@^@$dir/@p"`
660 shlist="$shlist $xxx"
661 fi
662 done
663 set x $shlist
2304df62
AD
664else
665 echo "(Looking for .SH files under the current directory.)"
666 set x `find . -name "*.SH" -print`
667fi
668shift
669case $# in
6700) set x *.SH; shift;;
671esac
672if test ! -f $1; then
673 shift
674fi
675for file in $*; do
676 case "$file" in
677 */*)
678 dir=`expr X$file : 'X\(.*\)/'`
679 file=`expr X$file : 'X.*/\(.*\)'`
680 (cd $dir && . ./$file)
681 ;;
682 *)
683 . ./$file
684 ;;
685 esac
686done
687if test -f config_h.SH; then
688 if test ! -f config.h; then
689 : oops, they left it out of MANIFEST, probably, so do it anyway.
690 . ./config_h.SH
691 fi
692fi
693EOS
694
695: produce awk script to parse command line options
696cat >options.awk <<'EOF'
697BEGIN {
ecfc5424 698 optstr = "dD:eEf:hOrsSU:V"; # getopt-style specification
2304df62
AD
699
700 len = length(optstr);
701 for (i = 1; i <= len; i++) {
702 c = substr(optstr, i, 1);
703 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
704 if (a == ":") {
705 arg[c] = 1;
706 i++;
707 }
708 opt[c] = 1;
709 }
710}
711{
712 expect = 0;
713 str = $0;
714 if (substr(str, 1, 1) != "-") {
715 printf("'%s'\n", str);
716 next;
717 }
718 len = length($0);
719 for (i = 2; i <= len; i++) {
720 c = substr(str, i, 1);
721 if (!opt[c]) {
722 printf("-%s\n", substr(str, i));
723 next;
724 }
725 printf("-%s\n", c);
726 if (arg[c]) {
727 if (i < len)
728 printf("'%s'\n", substr(str, i + 1));
729 else
730 expect = 1;
731 next;
732 }
733 }
734}
735END {
736 if (expect)
737 print "?";
738}
739EOF
740
741: process the command line options
742set X `for arg in "$@"; do echo $arg; done | awk -f options.awk`
743eval "set $*"
744shift
745rm -f options.awk
746
747: set up default values
748fastread=''
749reuseval=false
750config_sh=''
751alldone=''
752error=''
753silent=''
754extractsh=''
ecfc5424 755override=''
1aef975c 756rm -f optdef.sh
2304df62
AD
757
758: option parsing
759while test $# -gt 0; do
760 case "$1" in
761 -d) shift; fastread=yes;;
762 -e) shift; alldone=cont;;
763 -f)
764 shift
765 cd ..
766 if test -r "$1"; then
767 config_sh="$1"
768 else
a0d0e21e 769 echo "$me: cannot read config file $1." >&2
2304df62
AD
770 error=true
771 fi
772 cd UU
773 shift;;
774 -h) shift; error=true;;
775 -r) shift; reuseval=true;;
776 -s) shift; silent=true;;
777 -E) shift; alldone=exit;;
ecfc5424 778 -O) shift; override=true;;
2304df62 779 -S) shift; extractsh=true;;
a0d0e21e
LW
780 -D)
781 shift
782 case "$1" in
783 *=)
784 echo "$me: use '-U symbol=', not '-D symbol='." >&2
785 echo "$me: ignoring -D $1" >&2
786 ;;
ecfc5424 787 *=*) echo "$1" | \
1aef975c
AD
788 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
789 *) echo "$1='define'" >> optdef.sh;;
a0d0e21e
LW
790 esac
791 shift
792 ;;
793 -U)
794 shift
795 case "$1" in
1aef975c 796 *=) echo "$1" >> optdef.sh;;
a0d0e21e
LW
797 *=*)
798 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
799 echo "$me: ignoring -U $1" >&2
800 ;;
1aef975c 801 *) echo "$1='undef'" >> optdef.sh;;
a0d0e21e
LW
802 esac
803 shift
804 ;;
40000a8c 805 -V) echo "$me generated by metaconfig 3.0 PL51." >&2
2304df62
AD
806 exit 0;;
807 --) break;;
a0d0e21e 808 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
2304df62
AD
809 *) break;;
810 esac
811done
812
813case "$error" in
814true)
815 cat >&2 <<EOM
ecfc5424 816Usage: $me [-dehrEOSV] [-f config.sh] [-D symbol] [-D symbol=value]
a0d0e21e 817 [-U symbol] [-U symbol=]
2304df62
AD
818 -d : use defaults for all answers.
819 -e : go on without questioning past the production of config.sh.
820 -f : specify an alternate default configuration file.
821 -h : print this help message and exit (with an error status).
822 -r : reuse C symbols value if possible (skips costly nm extraction).
823 -s : silent mode, only echoes questions and essential information.
a0d0e21e
LW
824 -D : define symbol to have some value:
825 -D symbol symbol gets the value 'define'
826 -D symbol=value symbol gets the value 'value'
2304df62 827 -E : stop at the end of questions, after having produced config.sh.
ecfc5424 828 -O : let -D and -U override definitions from loaded configuration file.
2304df62 829 -S : perform variable substitutions on all .SH files (can mix with -f)
a0d0e21e
LW
830 -U : undefine symbol:
831 -U symbol symbol gets the value 'undef'
832 -U symbol= symbol gets completely empty
2304df62
AD
833 -V : print version number and exit (with a zero status).
834EOM
835 exit 1
836 ;;
837esac
838
839exec 4>&1
840case "$silent" in
841true) exec 1>/dev/null;;
842esac
843
ecfc5424 844: run the defines and the undefines, if any, but leave the file out there...
1aef975c
AD
845touch optdef.sh
846. ./optdef.sh
a0d0e21e 847
2304df62
AD
848case "$extractsh" in
849true)
850 case "$config_sh" in
851 '') config_sh='config.sh'; config='./config.sh';;
852 /*) config="$config_sh";;
853 *) config="./$config_sh";;
854 esac
855 echo " "
856 echo "Fetching answers from $config_sh..."
857 cd ..
858 . $config
1aef975c 859 test "$override" && . ./optdef.sh
2304df62
AD
860 echo " "
861 . ./UU/extract
862 rm -rf UU
863 echo "Done."
864 exit 0
865 ;;
866esac
867
868: set package name
85e6fe83 869package=perl5
1aef975c
AD
870first=`echo $package | sed -e 's/^\(.\).*/\1/'`
871last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
872case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
873ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
874*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
875esac
2304df62
AD
876
877: Eunice requires " " instead of "", can you believe it
878echo " "
879: Here we go...
880echo "Beginning of configuration questions for $package."
881
1aef975c 882trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
2304df62 883
2304df62
AD
884: Some greps do not return status, grrr.
885echo "grimblepritz" >grimble
886if grep blurfldyick grimble >/dev/null 2>&1 ; then
887 contains=contains
888elif grep grimblepritz grimble >/dev/null 2>&1 ; then
889 contains=grep
890else
891 contains=contains
892fi
893rm -f grimble
894: the following should work in any shell
895case "$contains" in
896contains*)
897 echo " "
898 echo "AGH! Grep doesn't return a status. Attempting remedial action."
899 cat >contains <<'EOSS'
900grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
901EOSS
902chmod +x contains
903esac
904
905: first determine how to suppress newline on echo command
906echo " "
907echo "Checking echo to see how to suppress newlines..."
908(echo "hi there\c" ; echo " ") >.echotmp
909if $contains c .echotmp >/dev/null 2>&1 ; then
910 echo "...using -n."
911 n='-n'
912 c=''
913else
914 cat <<'EOM'
915...using \c
916EOM
917 n=''
918 c='\c'
919fi
920echo $n "The star should be here-->$c"
921echo '*'
922rm -f .echotmp
923
924: Now test for existence of everything in MANIFEST
925echo " "
926if test -f ../MANIFEST; then
927 echo "First let's make sure your kit is complete. Checking..." >&4
928 awk '$1 !~ /PACK[A-Z]+/ {print $1}' ../MANIFEST | split -50
929 rm -f missing
930 for filelist in x??; do
931 (cd ..; ls `cat UU/$filelist` >/dev/null 2>>UU/missing)
932 done
933 if test -s missing; then
934 cat missing >&4
935 cat >&4 <<'EOM'
936
937THIS PACKAGE SEEMS TO BE INCOMPLETE.
938
939You have the option of continuing the configuration process, despite the
940distinct possibility that your kit is damaged, by typing 'y'es. If you
941do, don't blame me if something goes wrong. I advise you to type 'n'o
942and contact the author (lwall@netlabs.com).
943
944EOM
945 echo $n "Continue? [n] $c" >&4
946 read ans
947 case "$ans" in
948 y*)
949 echo "Continuing..." >&4
950 rm -f missing
951 ;;
952 *)
953 echo "ABORTING..." >&4
954 kill $$
955 ;;
956 esac
957 else
958 echo "Looks good..." >&4
959 fi
960else
961 echo "There is no MANIFEST file. I hope your kit is complete !"
962fi
963rm -f missing x??
964
965: compute the number of columns on the terminal for proper question formatting
966case "$COLUMNS" in
967'') COLUMNS='80';;
968esac
969
970: set up the echo used in my read
971myecho="case \"\$xxxm\" in
972'') echo $n \"\$rp $c\" >&4;;
973*) case \"\$rp\" in
974 '') echo $n \"[\$xxxm] $c\";;
975 *)
976 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
977 echo \"\$rp\" >&4
978 echo $n \"[\$xxxm] $c\" >&4
979 else
980 echo $n \"\$rp [\$xxxm] $c\" >&4
981 fi
982 ;;
983 esac;;
984esac"
985
986: now set up to do reads with possible shell escape and default assignment
987cat <<EOSC >myread
988xxxm=\$dflt
989$myecho
990ans='!'
991case "\$fastread" in
992yes) case "\$dflt" in
993 '') ;;
994 *) ans='';
995 case "\$silent-\$rp" in
996 true-) ;;
997 *) echo " " >&4;;
998 esac;;
999 esac;;
1000*) case "\$silent" in
1001 true) case "\$rp" in
1002 '') ans='';;
1003 esac;;
1004 esac;;
1005esac
1006while expr "X\$ans" : "X!" >/dev/null; do
1007 read answ
1008 set x \$xxxm
1009 shift
1010 aok=''; eval "ans=\"\$answ\"" && aok=y
1011 case "\$answ" in
1012 "\$ans")
1013 case "\$ans" in
ecfc5424
AD
1014 \\&*)
1015 set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1016 shift
1017 case "\$1" in
1018 -d)
1019 fastread=yes
1020 echo "(OK, I'll run with -d after this question.)"
1021 ;;
1022 -*)
1023 echo "*** Sorry, \$1 not supported yet."
1024 ;;
1025 esac
1026 $myecho
1027 ans=!
1028 ;;
2304df62
AD
1029 "!")
1030 sh 1>&4
1031 echo " "
1032 $myecho
1033 ;;
1034 !*)
1035 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1036 shift
1037 sh 1>&4 -c "\$*"
1038 echo " "
1039 $myecho
1040 ;;
1041 esac;;
1042 *)
1043 case "\$aok" in
1044 y)
1045 echo "*** Substitution done -- please confirm."
1046 xxxm="\$ans"
1047 ans=\`echo $n "\$ans$c" | tr '\012' ' '\`
1048 xxxm="\$ans"
1049 ans=!
1050 ;;
1051 *)
1052 echo "*** Error -- try again."
1053 ans=!
1054 ;;
1055 esac
1056 $myecho
1057 ;;
1058 esac
1059 case "\$ans\$xxxm\$nostick" in
1060 '')
1061 ans=!
1062 $myecho
1063 ;;
1064 esac
1065done
1066case "\$ans" in
1067'') ans="\$xxxm";;
1068esac
1069EOSC
1070
1071: create .config dir to save info across Configure sessions
1072test -d ../.config || mkdir ../.config
1073cat >../.config/README <<EOF
1074This directory created by Configure to save information that should
1075persist across sessions.
1076
1077You may safely delete it if you wish.
1078EOF
1079
1080: general instructions
1081needman=true
1082firsttime=true
1083user=`( (logname) 2>/dev/null || whoami) 2>&1`
1084if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1085 firsttime=false
1086 echo " "
1087 rp='Would you like to see the instructions?'
1088 dflt=n
1089 . ./myread
1090 case "$ans" in
1091 [yY]*) ;;
1092 *) needman=false;;
1093 esac
1094fi
1095if $needman; then
1096 cat <<EOH
1097
1098This installation shell script will examine your system and ask you questions
a0d0e21e 1099to determine how the perl5 package should be installed. If you get
2304df62
AD
1100stuck on a question, you may use a ! shell escape to start a subshell or
1101execute a command. Many of the questions will have default answers in square
1102brackets; typing carriage return will give you the default.
1103
1104On some of the questions which ask for file or directory names you are allowed
1105to use the ~name construct to specify the login directory belonging to "name",
1106even if you don't have a shell which knows about that. Questions where this is
1107allowed will be marked "(~name ok)".
1108
1109EOH
1110 rp=''
1111 dflt='Type carriage return to continue'
1112 . ./myread
1113 cat <<'EOH'
1114
1115The prompter used in this script allows you to use shell variables and
1116backticks in your answers. You may use $1, $2, etc... to refer to the words
1117in the default answer, as if the default line was a set of arguments given to a
1118script shell. This means you may also use $* to repeat the whole default line,
1119so you do not have to re-type everything to add something to the default.
1120
1121Everytime there is a substitution, you will have to confirm. If there is an
1122error (e.g. an unmatched backtick), the default answer will remain unchanged
1123and you will be prompted again.
1124
1125If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
1126the questions and use the computed defaults (or the previous answers if there
1127was already a config.sh file). Type 'Configure -h' for a list of options.
ecfc5424
AD
1128You may also start interactively and then answer '& -d' at any prompt to turn
1129on the non-interactive behaviour for the remaining of the execution.
2304df62
AD
1130
1131EOH
1132 . ./myread
1133 cat <<EOH
1134
1135Much effort has been expended to ensure that this shell script will run on any
1136Unix system. If despite that it blows up on yours, your best bet is to edit
40000a8c
AD
1137Configure and run it again. If you can't run Configure for some reason,
1138you'll have to generate a config.sh file by hand. Whatever problems you
1139have, let me (lwall@netlabs.com) know how I blew it.
2304df62
AD
1140
1141This installation script affects things in two ways:
1142
11431) it may do direct variable substitutions on some of the files included
1144 in this kit.
11452) it builds a config.h file for inclusion in C programs. You may edit
1146 any of these files as the need arises after running this script.
1147
1148If you make a mistake on a question, there is no easy way to back up to it
1149currently. The easiest thing to do is to edit config.sh and rerun all the SH
1150files. Configure will offer to let you do this before it runs the SH files.
1151
1152EOH
1153 dflt='Type carriage return to continue'
1154 . ./myread
1155 case "$firsttime" in
1156 true) echo $user >>../.config/instruct;;
1157 esac
1158fi
1159
1160: see if sh knows # comments
1161echo " "
1162echo "Checking your sh to see if it knows about # comments..." >&4
ecfc5424 1163if `sh -c '#' >/dev/null 2>&1`; then
2304df62
AD
1164 echo "Your sh handles # comments correctly."
1165 shsharp=true
1166 spitshell=cat
1167 echo " "
1168 echo "Okay, let's see if #! works on this system..."
a0d0e21e 1169 xcat=/bin/cat
ecfc5424 1170 test -f $xcat || xcat=/usr/bin/cat
a0d0e21e 1171 echo "#!$xcat" >try
2304df62
AD
1172 $eunicefix try
1173 chmod +x try
1174 ./try > today
1175 if test -s today; then
1176 echo "It does."
1177 sharpbang='#!'
1178 else
a0d0e21e 1179 echo "#! $xcat" > try
2304df62
AD
1180 $eunicefix try
1181 chmod +x try
1182 ./try > today
1183 if test -s today; then
1184 echo "It does."
1185 sharpbang='#! '
1186 else
1187 echo "It's just a comment."
1188 sharpbang=': use '
1189 fi
1190 fi
1191else
1192 echo "Your sh doesn't grok # comments--I will strip them later on."
1193 shsharp=false
a0d0e21e 1194 cd ..
2304df62
AD
1195 echo "exec grep -v '^[ ]*#'" >spitshell
1196 chmod +x spitshell
1197 $eunicefix spitshell
1198 spitshell=`pwd`/spitshell
a0d0e21e 1199 cd UU
2304df62
AD
1200 echo "I presume that if # doesn't work, #! won't work either!"
1201 sharpbang=': use '
1202fi
1203rm -f try today
1204
1205: figure out how to guarantee sh startup
1206echo " "
1207echo "Checking out how to guarantee sh startup..." >&4
1208case "$SYSTYPE" in
1209*bsd*|sys5*) startsh=$sharpbang"/$SYSTYPE/bin/sh";;
1210*) startsh=$sharpbang'/bin/sh';;
1211esac
1212echo "Let's see if '$startsh' works..."
1213cat >try <<EOSS
1214$startsh
1215set abc
1216test "$?abc" != 1
1217EOSS
1218
1219chmod +x try
1220$eunicefix try
1221if ./try; then
1222 echo "Yup, it does."
1223else
1224echo "Nope. You may have to fix up the shell scripts to make sure sh runs them."
1225fi
1226rm -f try
1227
1228: find out where common programs are
1229echo " "
1230echo "Locating common programs..." >&4
1231cat <<EOSC >loc
1232$startsh
1233case \$# in
12340) exit 1;;
1235esac
1236thing=\$1
1237shift
1238dflt=\$1
1239shift
1240for dir in \$*; do
1241 case "\$thing" in
1242 .)
1243 if test -d \$dir/\$thing; then
1244 echo \$dir
1245 exit 0
1246 fi
1247 ;;
1248 *)
a0d0e21e 1249 for thisthing in \$dir/\$thing; do
ecfc5424 1250 : just loop through to pick last item
a0d0e21e
LW
1251 done
1252 if test -f \$thisthing; then
1253 echo \$thisthing
2304df62
AD
1254 exit 0
1255 elif test -f \$dir/\$thing.exe; then
1256 : on Eunice apparently
1257 echo \$dir/\$thing
1258 exit 0
1259 fi
1260 ;;
1261 esac
1262done
1263echo \$dflt
1264exit 1
1265EOSC
1266chmod +x loc
1267$eunicefix loc
1268loclist="
1269awk
1270cat
ecfc5424 1271comm
2304df62
AD
1272cp
1273echo
1274expr
a0d0e21e 1275find
2304df62 1276grep
85e6fe83 1277ln
a0d0e21e 1278ls
2304df62 1279mkdir
2304df62
AD
1280rm
1281sed
1282sort
85e6fe83 1283touch
2304df62
AD
1284tr
1285uniq
1286"
1287trylist="
1288Mcc
2304df62
AD
1289byacc
1290cpp
1291csh
1292date
1293egrep
2304df62
AD
1294line
1295nroff
1296perl
1297test
1298uname
1299"
1300pth=`echo $PATH | sed -e 's/:/ /g'`
1301pth="$pth /lib /usr/lib"
1302for file in $loclist; do
1303 xxx=`./loc $file $file $pth`
1304 eval $file=$xxx
1305 eval _$file=$xxx
1306 case "$xxx" in
1307 /*)
1308 echo $file is in $xxx.
1309 ;;
1310 *)
1311 echo "I don't know where $file is. I hope it's in everyone's PATH."
1312 ;;
1313 esac
1314done
1315echo " "
1316echo "Don't worry if any of the following aren't found..."
1317say=offhand
1318for file in $trylist; do
1319 xxx=`./loc $file $file $pth`
1320 eval $file=$xxx
1321 eval _$file=$xxx
1322 case "$xxx" in
1323 /*)
1324 echo $file is in $xxx.
1325 ;;
1326 *)
1327 echo "I don't see $file out there, $say."
1328 say=either
1329 ;;
1330 esac
1331done
1332case "$egrep" in
1333egrep)
1334 echo "Substituting grep for egrep."
1335 egrep=$grep
1336 ;;
1337esac
1338case "$test" in
1339test)
1340 echo "Hopefully test is built into your sh."
1341 ;;
1342*)
ecfc5424 1343 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2304df62
AD
1344 echo "Using the test built into your sh."
1345 test=test
1346 _test=test
1347 fi
1348 ;;
1349esac
1350case "$echo" in
1351echo)
1352 echo "Hopefully echo is built into your sh."
1353 ;;
1354'') ;;
1355*)
1356 echo " "
1357echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
1358 $echo $n "hi there$c" >foo1
1359 echo $n "hi there$c" >foo2
1360 if cmp foo1 foo2 >/dev/null 2>&1; then
1361 echo "They are compatible. In fact, they may be identical."
1362 else
1363 case "$n" in
1364 '-n') n='' c='\c';;
1365 *) n='-n' c='';;
1366 esac
1367 cat <<FOO
1368They are not compatible! You are probably running ksh on a non-USG system.
1369I'll have to use $echo instead of the builtin, since Bourne shell doesn't
1370have echo built in and we may have to run some Bourne shell scripts. That
1371means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
1372
1373FOO
1374 $echo $n "The star should be here-->$c"
1375 $echo "*"
1376 fi
1377 $rm -f foo1 foo2
1378 ;;
1379esac
1380
a0d0e21e
LW
1381: determine whether symbolic links are supported
1382echo " "
1383$touch blurfl
1384if $ln -s blurfl sym > /dev/null 2>&1 ; then
1385 echo "Symbolic links are supported." >&4
1386 lns="$ln -s"
1387else
1388 echo "Symbolic links are NOT supported." >&4
1389 lns="$ln"
1390fi
1391$rm -f blurfl sym
1392
ecfc5424
AD
1393: see whether [:lower:] and [:upper:] are supported character classes
1394echo " "
1395up='[A-Z]'
1396low='[a-z]'
1397case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1398ABYZ)
1399 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
1400 up='[:upper:]'
1401 low='[:lower:]'
1402 ;;
1403*)
1404 echo "Your tr only supports [a-z] and [A-Z] to convert case." >&4
1405 ;;
1406esac
1407: set up the translation script tr, must be called with ./tr of course
1408cat >tr <<EOSC
1409$startsh
1410case "\$1\$2" in
1411'[A-Z][a-z]') exec $tr '$up' '$low';;
1412'[a-z][A-Z]') exec $tr '$low' '$up';;
1413esac
1414exec $tr "\$@"
1415EOSC
1416chmod +x tr
1417$eunicefix tr
1418
2304df62
AD
1419: Try to determine whether config.sh was made on this system
1420case "$config_sh" in
1421'')
1422myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
a0d0e21e 1423myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
ecfc5424 1424 ./tr '[A-Z]' '[a-z]' | tr '\012' ' '`
1aef975c 1425newmyuname="$myuname"
2304df62 1426dflt=n
ecfc5424
AD
1427if test "$fastread" = yes; then
1428 dflt=y
1429elif test -f ../config.sh; then
2304df62 1430 if $contains myuname= ../config.sh >/dev/null 2>&1; then
1aef975c 1431 eval "`grep myuname= ../config.sh`"
2304df62 1432 fi
1aef975c 1433 if test "X$myuname" = "X$newmyuname"; then
2304df62
AD
1434 dflt=y
1435 fi
1436fi
1437
1438: Get old answers from old config file if Configure was run on the
1439: same system, otherwise use the hints.
1440hint=default
1441cd ..
1442if test -f config.sh; then
1443 echo " "
1444 rp="I see a config.sh file. Shall I use it to set the defaults?"
1445 . UU/myread
1446 case "$ans" in
1447 n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
1448 *) echo "Fetching default answers from your old config.sh file..." >&4
ecfc5424
AD
1449 tmp_n="$n"
1450 tmp_c="$c"
2304df62
AD
1451 . ./config.sh
1452 cp config.sh UU
ecfc5424
AD
1453 n="$tmp_n"
1454 c="$tmp_c"
2304df62
AD
1455 hint=previous
1456 ;;
1457 esac
1458fi
1459if test ! -f config.sh; then
1460 $cat <<EOM
1461
1462First time through, eh? I have some defaults handy for the following systems:
1463
1464EOM
1465 cd hints; ls -C *.sh | $sed 's/\.sh/ /g' >&4
1466 dflt=''
1467 : Half the following guesses are probably wrong... If you have better
1468 : tests or hints, please send them to lwall@netlabs.com
1469 : The metaconfig authors would also appreciate a copy...
a0d0e21e 1470 $test -f /irix && osname=irix
85e6fe83
LW
1471 $test -f /xenix && osname=sco_xenix
1472 $test -f /dynix && osname=dynix
1473 $test -f /dnix && osname=dnix
a0d0e21e 1474 $test -f /unicos && osname=unicos && osvers=`$uname -r`
85e6fe83 1475 $test -f /bin/mips && /bin/mips && osname=mips
ecfc5424
AD
1476 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
1477 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
a0d0e21e
LW
1478 $test -d /usr/apollo/bin && osname=apollo
1479 $test -f /etc/saf/_sactab && osname=svr4
85e6fe83 1480 $test -d /usr/include/minix && osname=minix
2304df62
AD
1481 if $test -f $uname; then
1482 set X $myuname
1483 shift
1484
2304df62 1485 case "$5" in
85e6fe83 1486 fps*) osname=fps ;;
2304df62
AD
1487 mips*)
1488 case "$4" in
85e6fe83
LW
1489 umips) osname=umips ;;
1490 *) osname=mips ;;
2304df62 1491 esac;;
85e6fe83
LW
1492 [23]100) osname=mips ;;
1493 next*) osname=next ;;
1494 news*) osname=news ;;
ecfc5424
AD
1495 i386*)
1496 if $test -f /etc/kconfig; then
1497 osname=isc
a0d0e21e
LW
1498 if test "$lns" = "ln -s"; then
1499 osvers=4
1500 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
1501 osvers=3
2304df62 1502 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
a0d0e21e 1503 osvers=2
ecfc5424
AD
1504 fi
1505 fi
1506 ;;
2304df62
AD
1507 esac
1508
1509 case "$1" in
a0d0e21e
LW
1510 aix) osname=aix
1511 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
1512 case "$tmp" in
1aef975c 1513 'not found') osvers="$4"."$3" ;;
a0d0e21e
LW
1514 '<3240'|'<>3240') osvers=3.2.0 ;;
1515 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
1516 '=3250'|'>3250') osvers=3.2.5 ;;
1aef975c 1517 *) osvers=$tmp;;
a0d0e21e
LW
1518 esac
1519 ;;
1520 dnix) osname=dnix
1521 osvers="$3"
1522 ;;
1523 domainos) osname=apollo
1524 osvers="$3"
1525 ;;
1526 dgux) osname=dgux
1527 osvers="$3"
1528 ;;
1529 freebsd) osname=freebsd
1530 osvers="$3" ;;
1531 genix) osname=genix ;;
1532 hp*) osname=hpux
1533 case "$3" in
1534 *.08.*) osvers=9 ;;
1535 *.09.*) osvers=9 ;;
1536 *.10.*) osvers=10 ;;
ecfc5424 1537 *) osvers="$3" ;;
a0d0e21e
LW
1538 esac
1539 ;;
1540 irix) osname=irix
1541 case "$3" in
1542 4*) osvers=4 ;;
1543 5*) osvers=5 ;;
ecfc5424 1544 *) osvers="$3" ;;
a0d0e21e
LW
1545 esac
1546 ;;
1547 linux) osname=linux
1548 case "$3" in
1549 1*) osvers=1 ;;
1550 *) osvers="$3" ;;
1551 esac
1552 ;;
1553 netbsd*) osname=netbsd
ecfc5424
AD
1554 osvers="$3"
1555 ;;
a0d0e21e
LW
1556 bsd386) osname=bsd386
1557 osvers=`$uname -r`
1558 ;;
1559 next*) osname=next ;;
1560 solaris) osname=solaris
1561 case "$3" in
1562 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
ecfc5424 1563 *) osvers="$3" ;;
a0d0e21e
LW
1564 esac
1565 ;;
85e6fe83
LW
1566 sunos) osname=sunos
1567 case "$3" in
85e6fe83
LW
1568 5*) osname=solaris
1569 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
a0d0e21e 1570 *) osvers="$3" ;;
2304df62
AD
1571 esac
1572 ;;
a0d0e21e 1573 titanos) osname=titanos
85e6fe83 1574 case "$3" in
a0d0e21e
LW
1575 1*) osvers=1 ;;
1576 2*) osvers=2 ;;
1577 3*) osvers=3 ;;
1578 4*) osvers=4 ;;
ecfc5424 1579 *) osvers="$3" ;;
2304df62
AD
1580 esac
1581 ;;
85e6fe83 1582 ultrix) osname=ultrix
ecfc5424 1583 osvers="$3"
2304df62 1584 ;;
85e6fe83 1585 osf1) case "$5" in
fed7345c
AD
1586 alpha)
1587 osname=dec_osf
1588 osvers=`echo "$3" | sed 's/^[vt]//'`
ecfc5424
AD
1589 ;;
1590 hp*) osname=hp_osf1 ;;
1591 mips) osname=mips_osf1 ;;
85e6fe83
LW
1592 esac
1593 ;;
a0d0e21e
LW
1594 uts) osname=uts
1595 osvers="$3"
1596 ;;
85e6fe83 1597 $2) case "$osname" in
2304df62 1598 *isc*) ;;
a0d0e21e
LW
1599 *freebsd*) ;;
1600 svr*)
1601 : svr4.x or possibly later
1602 case "svr$3" in
1603 ${osname}*)
1604 osname=svr$3
1605 osvers=$4
1606 ;;
1607 esac
1608 case "$osname" in
1609 svr4.0)
1610 : Check for ESIX
1611 if test -f /stand/boot ; then
1612 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
ecfc5424
AD
1613 if test -n "$INITPROG" -a -f "$INITPROG"; then
1614 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
1615 if test -n "$isesix"; then
a0d0e21e
LW
1616 osname=esix4
1617 fi
1618 fi
1619 fi
1620 ;;
1621 esac
1622 ;;
2304df62 1623 *) if test -f /etc/systemid; then
a0d0e21e
LW
1624 osname=sco
1625 set `echo $3 | $sed 's/\./ /g'` $4
2304df62 1626 if $test -f sco_$1_$2_$3.sh; then
85e6fe83 1627 osvers=$1.$2.$3
2304df62 1628 elif $test -f sco_$1_$2.sh; then
85e6fe83 1629 osvers=$1.$2
2304df62 1630 elif $test -f sco_$1.sh; then
85e6fe83 1631 osvers=$1
2304df62 1632 fi
a0d0e21e
LW
1633 else
1634 case "$osname" in
1635 '') : Still unknown. Probably a generic Sys V.
1636 osname="sysv"
1637 osvers="$3"
1638 ;;
1639 esac
2304df62
AD
1640 fi
1641 ;;
1642 esac
1643 ;;
a0d0e21e
LW
1644 *) case "$osname" in
1645 '') : Still unknown. Probably a generic BSD.
1646 osname="$1"
1647 osvers="$3"
1648 ;;
1649 esac
1650 ;;
2304df62
AD
1651 esac
1652 else
1653 if test -f /vmunix -a -f news_os.sh; then
ecfc5424 1654 (what /vmunix | ../UU/tr '[A-Z]' '[a-z]') > ../UU/kernel.what 2>&1
2304df62 1655 if $contains news-os ../UU/kernel.what >/dev/null 2>&1; then
85e6fe83 1656 osname=news_os
2304df62
AD
1657 fi
1658 $rm -f ../UU/kernel.what
1659 fi
1660 fi
85e6fe83 1661
a0d0e21e
LW
1662 : Now look for a hint file osname_osvers, unless one has been
1663 : specified already.
1664 case "$hintfile" in
1665 ''|' ')
ecfc5424 1666 file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'`
a0d0e21e 1667 : Also try without trailing minor version numbers.
ecfc5424
AD
1668 xfile=`echo $file | $sed -e 's@_[^_]*$@@'`
1669 xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'`
1670 xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'`
1671 xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'`
a0d0e21e
LW
1672 case "$file" in
1673 '') dflt=none ;;
1674 *) case "$osvers" in
1675 '') dflt=$file
1676 ;;
1677 *) if $test -f $file.sh ; then
1678 dflt=$file
1679 elif $test -f $xfile.sh ; then
1680 dflt=$xfile
1681 elif $test -f $xxfile.sh ; then
1682 dflt=$xxfile
1683 elif $test -f $xxxfile.sh ; then
1684 dflt=$xxxfile
1685 elif $test -f $xxxxfile.sh ; then
1686 dflt=$xxxxfile
1687 elif $test -f "${osname}.sh" ; then
1688 dflt="${osname}"
1689 else
1690 dflt=none
1691 fi
1692 ;;
1693 esac
85e6fe83
LW
1694 ;;
1695 esac
1696 ;;
a0d0e21e 1697 *)
ecfc5424 1698 dflt=`echo $hintfile | $sed 's/\.sh$//'`
a0d0e21e 1699 ;;
2304df62 1700 esac
1aef975c 1701
2304df62
AD
1702 $cat <<EOM
1703
1704You may give one or more space-separated answers, or "none" if appropriate.
1705If your OS version has no hints, DO NOT give a wrong version -- say "none".
1706
1707EOM
1708 rp="Which of these apply, if any?"
1709 . ../UU/myread
85e6fe83
LW
1710 tans=$ans
1711 for file in $tans; do
2304df62
AD
1712 if $test -f $file.sh; then
1713 . ./$file.sh
1714 $cat $file.sh >> ../UU/config.sh
85e6fe83 1715 elif $test X$tans = X -o X$tans = Xnone ; then
2304df62
AD
1716 : nothing
1717 else
85e6fe83
LW
1718 : Give one chance to correct a possible typo.
1719 echo "$file.sh does not exist"
1720 dflt=$file
1721 rp="hint to use instead?"
1722 . ../UU/myread
1723 for file in $ans; do
1724 if $test -f "$file.sh"; then
1725 . ./$file.sh
1726 $cat $file.sh >> ../UU/config.sh
1727 elif $test X$ans = X -o X$ans = Xnone ; then
1728 : nothing
1729 else
1730 echo "$file.sh does not exist -- ignored."
1731 fi
1732 done
2304df62
AD
1733 fi
1734 done
85e6fe83 1735
2304df62 1736 hint=recommended
85e6fe83
LW
1737 : Remember our hint file for later.
1738 if $test -f "$file.sh" ; then
a0d0e21e 1739 hintfile="$file"
85e6fe83 1740 else
a0d0e21e 1741 hintfile=''
85e6fe83
LW
1742 fi
1743
2304df62
AD
1744 cd ..
1745fi
1746cd UU
1747;;
1748*)
1749 echo " "
1750 echo "Fetching default answers from $config_sh..." >&4
ecfc5424
AD
1751 tmp_n="$n"
1752 tmp_c="$c"
2304df62
AD
1753 cd ..
1754 cp $config_sh config.sh 2>/dev/null
1755 . ./config.sh
1756 cd UU
1757 cp ../config.sh .
ecfc5424
AD
1758 n="$tmp_n"
1759 c="$tmp_c"
2304df62
AD
1760 hint=previous
1761 ;;
1762esac
1aef975c
AD
1763test "$override" && . ./optdef.sh
1764myuname="$newmyuname"
2304df62
AD
1765
1766: Restore computed paths
1767for file in $loclist $trylist; do
1768 eval $file="\$_$file"
1769done
1770
85e6fe83 1771cat << EOM
a0d0e21e 1772
85e6fe83 1773Configure uses the operating system name and version to set some defaults.
ecfc5424
AD
1774The default value is probably right if the name rings a bell. Otherwise,
1775since spelling matters for me, either accept the default or answer "none"
1776to leave it blank.
a0d0e21e 1777
85e6fe83 1778EOM
85e6fe83 1779case "$osname" in
a0d0e21e 1780 ''|' ')
85e6fe83 1781 case "$hintfile" in
a0d0e21e 1782 ''|' '|none) dflt=none ;;
ecfc5424 1783 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
85e6fe83
LW
1784 esac
1785 ;;
1786 *) dflt="$osname" ;;
1787esac
1788rp="Operating system name?"
1789. ./myread
1790case "$ans" in
ecfc5424
AD
1791none) osname='' ;;
1792*) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
85e6fe83 1793esac
2304df62
AD
1794: who configured the system
1795cf_time=`$date 2>&1`
a0d0e21e
LW
1796(logname > .temp) >/dev/null 2>&1
1797$test -s .temp || (whoami > .temp) >/dev/null 2>&1
1798$test -s .temp || echo unknown > .temp
1799cf_by=`$cat .temp`
1800$rm -f .temp
2304df62
AD
1801
1802: determine where manual pages are on this system
1803echo " "
1804case "$sysman" in
1805'')
a0d0e21e 1806 syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2304df62
AD
1807 syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
1808 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
1809 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
a0d0e21e
LW
1810 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
1811 sysman=`./loc . /usr/man/man1 $syspath`
2304df62
AD
1812 ;;
1813esac
1814if $test -d "$sysman"; then
1815 echo "System manual is in $sysman." >&4
1816else
1817 echo "Could not find manual pages in source form." >&4
1818fi
1819
1820: see what memory models we can support
1821case "$models" in
1822'')
1823 $cat >pdp11.c <<'EOP'
1824main() {
1825#ifdef pdp11
1826 exit(0);
1827#else
1828 exit(1);
1829#endif
1830}
1831EOP
1832 cc -o pdp11 pdp11.c >/dev/null 2>&1
1833 if ./pdp11 2>/dev/null; then
1834 dflt='unsplit split'
1835 else
1836 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
1837 case "$tans" in
1838 X) dflt='none';;
1839 *) if $test -d /lib/small || $test -d /usr/lib/small; then
1840 dflt='small'
1841 else
1842 dflt=''
1843 fi
1844 if $test -d /lib/medium || $test -d /usr/lib/medium; then
1845 dflt="$dflt medium"
1846 fi
1847 if $test -d /lib/large || $test -d /usr/lib/large; then
1848 dflt="$dflt large"
1849 fi
1850 if $test -d /lib/huge || $test -d /usr/lib/huge; then
1851 dflt="$dflt huge"
1852 fi
1853 esac
1854 fi;;
1855*) dflt="$models";;
1856esac
1857$cat <<EOM
1858
1859Some systems have different model sizes. On most systems they are called
1860small, medium, large, and huge. On the PDP11 they are called unsplit and
1861split. If your system doesn't support different memory models, say "none".
1862If you wish to force everything to one memory model, say "none" here and
1863put the appropriate flags later when it asks you for other cc and ld flags.
1864Venix systems may wish to put "none" and let the compiler figure things out.
1865(In the following question multiple model names should be space separated.)
1866
1867EOM
1868rp="Which memory models are supported?"
1869. ./myread
1870models="$ans"
1871
1872case "$models" in
1873none)
1874 small=''
1875 medium=''
1876 large=''
1877 huge=''
1878 unsplit=''
1879 split=''
1880 ;;
1881*split)
1882 case "$split" in
1883 '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
1884 $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
1885 dflt='-i'
1886 else
1887 dflt='none'
1888 fi;;
1889 *) dflt="$split";;
1890 esac
1891 rp="What flag indicates separate I and D space?"
1892 . ./myread
1893 tans="$ans"
1894 case "$tans" in
1895 none) tans='';;
1896 esac
1897 split="$tans"
1898 unsplit='';;
1899*large*|*small*|*medium*|*huge*)
1900 case "$models" in
1901 *large*)
1902 case "$large" in
1903 '') dflt='-Ml';;
1904 *) dflt="$large";;
1905 esac
1906 rp="What flag indicates large model?"
1907 . ./myread
1908 tans="$ans"
1909 case "$tans" in
1910 none) tans='';
1911 esac
1912 large="$tans";;
1913 *) large='';;
1914 esac
1915 case "$models" in
1916 *huge*) case "$huge" in
1917 '') dflt='-Mh';;
1918 *) dflt="$huge";;
1919 esac
1920 rp="What flag indicates huge model?"
1921 . ./myread
1922 tans="$ans"
1923 case "$tans" in
1924 none) tans='';
1925 esac
1926 huge="$tans";;
1927 *) huge="$large";;
1928 esac
1929 case "$models" in
1930 *medium*) case "$medium" in
1931 '') dflt='-Mm';;
1932 *) dflt="$medium";;
1933 esac
1934 rp="What flag indicates medium model?"
1935 . ./myread
1936 tans="$ans"
1937 case "$tans" in
1938 none) tans='';
1939 esac
1940 medium="$tans";;
1941 *) medium="$large";;
1942 esac
1943 case "$models" in
1944 *small*) case "$small" in
1945 '') dflt='none';;
1946 *) dflt="$small";;
1947 esac
1948 rp="What flag indicates small model?"
1949 . ./myread
1950 tans="$ans"
1951 case "$tans" in
1952 none) tans='';
1953 esac
1954 small="$tans";;
1955 *) small='';;
1956 esac
1957 ;;
1958*)
1959 echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
1960 ;;
1961esac
1962
1963: make some quick guesses about what we are up against
1964echo " "
1965$echo $n "Hmm... $c"
1966echo exit 1 >bsd
1967echo exit 1 >usg
1968echo exit 1 >v7
1969echo exit 1 >osf1
1970echo exit 1 >eunice
1971echo exit 1 >xenix
1972echo exit 1 >venix
ecfc5424 1973d_bsd="$undef"
2304df62
AD
1974$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
1975if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
1976then
1977 echo "Looks kind of like an OSF/1 system, but we'll see..."
1978 echo exit 0 >osf1
1979elif test `echo abc | tr a-z A-Z` = Abc ; then
1980 xxx=`./loc addbib blurfl $pth`
1981 if $test -f $xxx; then
1982 echo "Looks kind of like a USG system with BSD features, but we'll see..."
1983 echo exit 0 >bsd
1984 echo exit 0 >usg
1985 else
1986 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
1987 echo "Looks kind of like an extended USG system, but we'll see..."
1988 else
1989 echo "Looks kind of like a USG system, but we'll see..."
1990 fi
1991 echo exit 0 >usg
1992 fi
1993elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
1994 echo "Looks kind of like a BSD system, but we'll see..."
ecfc5424 1995 d_bsd="$define"
2304df62
AD
1996 echo exit 0 >bsd
1997else
1998 echo "Looks kind of like a Version 7 system, but we'll see..."
1999 echo exit 0 >v7
2000fi
2001case "$eunicefix" in
2002*unixtovms*)
2003 $cat <<'EOI'
2004There is, however, a strange, musty smell in the air that reminds me of
2005something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2006EOI
2007 echo exit 0 >eunice
2008 d_eunice="$define"
2009: it so happens the Eunice I know will not run shell scripts in Unix format
2010 ;;
2011*)
2012 echo " "
2013 echo "Congratulations. You aren't running Eunice."
2014 d_eunice="$undef"
2015 ;;
2016esac
2017if test -f /xenix; then
2018 echo "Actually, this looks more like a XENIX system..."
2019 echo exit 0 >xenix
2020 d_xenix="$define"
2021else
2022 echo " "
2023 echo "It's not Xenix..."
2024 d_xenix="$undef"
2025fi
2026chmod +x xenix
2027$eunicefix xenix
2028if test -f /venix; then
2029 echo "Actually, this looks more like a VENIX system..."
2030 echo exit 0 >venix
2031else
2032 echo " "
ecfc5424 2033 if ./xenix; then
2304df62
AD
2034 : null
2035 else
2036 echo "Nor is it Venix..."
2037 fi
2038fi
2039chmod +x bsd usg v7 osf1 eunice xenix venix
2040$eunicefix bsd usg v7 osf1 eunice xenix venix
2041$rm -f foo
2042
2043: see if we need a special compiler
2044echo " "
ecfc5424 2045if ./usg; then
2304df62
AD
2046 case "$cc" in
2047 '') case "$Mcc" in
2048 /*) dflt='Mcc';;
2049 *) case "$large" in
2050 -M*) dflt='cc';;
2051 *) if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
2052 if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
2053 dflt='cc'
2054 else
2055 dflt='cc -M'
2056 fi
2057 else
2058 dflt='cc'
2059 fi;;
2060 esac;;
2061 esac;;
2062 *) dflt="$cc";;
2063 esac
2064 $cat <<'EOM'
2065On some systems the default C compiler will not resolve multiple global
2066references that happen to have the same name. On some such systems the "Mcc"
2067command may be used to force these to be resolved. On other systems a "cc -M"
2068command is required. (Note that the -M flag on other systems indicates a
2069memory model to use!) If you have the Gnu C compiler, you might wish to use
2070that instead.
2071
2072EOM
2073 rp="What command will force resolution on this system?"
2074 . ./myread
2075 cc="$ans"
2076else
2077 case "$cc" in
2078 '') dflt=cc;;
2079 *) dflt="$cc";;
2080 esac
2081 rp="Use which C compiler?"
2082 . ./myread
2083 cc="$ans"
2084fi
ecfc5424
AD
2085echo " "
2086echo "Checking for GNU cc in disguise and/or its version number..." >&4
2304df62
AD
2087$cat >gccvers.c <<EOM
2088#include <stdio.h>
a0d0e21e 2089int main() {
2304df62 2090#ifdef __GNUC__
a0d0e21e 2091#ifdef __VERSION__
ecfc5424 2092 printf("%s\n", __VERSION__);
2304df62 2093#else
ecfc5424 2094 printf("%s\n", "1");
2304df62 2095#endif
a0d0e21e 2096#endif
ecfc5424 2097 exit(0);
2304df62
AD
2098}
2099EOM
a0d0e21e
LW
2100if $cc -o gccvers gccvers.c >/dev/null 2>&1; then
2101 gccversion=`./gccvers`
2102 case "$gccversion" in
2103 '') echo "You are not using GNU cc." ;;
2104 *) echo "You are using GNU cc $gccversion." ;;
2105 esac
2106else
ecfc5424 2107 echo "I can't compile the test program -- Assuming it isn't GNU cc."
a0d0e21e
LW
2108fi
2109$rm -f gccvers*
2110case "$gccversion" in
21111*) cpp=`./loc gcc-cpp $cpp $pth` ;;
2304df62 2112esac
a0d0e21e 2113
2304df62
AD
2114: decide how portable to be
2115case "$d_portable" in
2116"$define") dflt=y;;
2117*) dflt=n;;
2118esac
2119$cat <<'EOH'
2120
2121I can set things up so that your shell scripts and binaries are more portable,
2122at what may be a noticable cost in performance. In particular, if you
2123ask to be portable, the following happens:
2124
2125 1) Shell scripts will rely on the PATH variable rather than using
2126 the paths derived above.
2127 2) ~username interpretations will be done at run time rather than
2128 by Configure.
2129
2130EOH
2131rp="Do you expect to run these scripts and binaries on multiple machines?"
2132. ./myread
2133case "$ans" in
2134 y*) d_portable="$define"
2304df62
AD
2135 ;;
2136 *) d_portable="$undef" ;;
2137esac
2138
2139: set up shell script to do ~ expansion
2140cat >filexp <<EOSS
2141$startsh
2142: expand filename
2143case "\$1" in
2144 ~/*|~)
2145 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
2146 ;;
2147 ~*)
2148 if $test -f /bin/csh; then
2149 /bin/csh -f -c "glob \$1"
a0d0e21e 2150 failed=\$?
2304df62
AD
2151 echo ""
2152 exit \$failed
2153 else
2154 name=\`$expr x\$1 : '..\([^/]*\)'\`
2155 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
2156 if $test ! -d "\$dir"; then
2157 me=\`basename \$0\`
2158 echo "\$me: can't locate home directory for: \$name" >&2
2159 exit 1
2160 fi
2161 case "\$1" in
2162 */*)
2163 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
2164 ;;
2165 *)
2166 echo \$dir
2167 ;;
2168 esac
2169 fi
2170 ;;
2171*)
2172 echo \$1
2173 ;;
2174esac
2175EOSS
2176chmod +x filexp
2177$eunicefix filexp
2178
2179: now set up to get a file name
2180cat <<'EOSC' >getfile
2181tilde=''
2182fullpath=''
2183already=''
2184skip=''
2185none_ok=''
2186exp_file=''
a0d0e21e 2187nopath_ok=''
2304df62
AD
2188orig_rp="$rp"
2189orig_dflt="$dflt"
2190
2191case "$fn" in
ecfc5424
AD
2192*\(*)
2193 expr $fn : '.*(\(.*\)).*' | tr ',' '\012' >getfile.ok
2194 fn=`echo $fn | sed 's/(.*)//'`
2195 ;;
2196esac
2197
2198case "$fn" in
a0d0e21e
LW
2199*:*)
2200 loc_file=`expr $fn : '.*:\(.*\)'`
2201 fn=`expr $fn : '\(.*\):.*'`
2202 ;;
2203esac
2204
2205case "$fn" in
2304df62
AD
2206*~*) tilde=true;;
2207esac
2208case "$fn" in
2209*/*) fullpath=true;;
2210esac
2211case "$fn" in
2212*+*) skip=true;;
2213esac
2214case "$fn" in
2215*n*) none_ok=true;;
2216esac
2217case "$fn" in
2218*e*) exp_file=true;;
2219esac
a0d0e21e
LW
2220case "$fn" in
2221*p*) nopath_ok=true;;
2222esac
2304df62
AD
2223
2224case "$fn" in
2225*f*) type='File';;
2226*d*) type='Directory';;
a0d0e21e 2227*l*) type='Locate';;
2304df62
AD
2228esac
2229
2230what="$type"
2231case "$what" in
2232Locate) what='File';;
2233esac
2234
2235case "$exp_file" in
2236'')
2237 case "$d_portable" in
2238 "$define") ;;
2239 *) exp_file=true;;
2240 esac
2241 ;;
2242esac
2243
2244cd ..
2245while test "$type"; do
2246 redo=''
2247 rp="$orig_rp"
2248 dflt="$orig_dflt"
2249 case "$tilde" in
2250 true) rp="$rp (~name ok)";;
2251 esac
2252 . UU/myread
ecfc5424
AD
2253 if test -f UU/getfile.ok && \
2254 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
2255 then
2256 value="$ans"
2257 ansexp="$ans"
2258 break
2259 fi
2304df62
AD
2260 case "$ans" in
2261 none)
2262 value=''
2263 ansexp=''
2264 case "$none_ok" in
2265 true) type='';;
2266 esac
2267 ;;
2268 *)
2269 case "$tilde" in
2270 '') value="$ans"
2271 ansexp="$ans";;
2272 *)
2273 value=`UU/filexp $ans`
2274 case $? in
2275 0)
2276 if test "$ans" != "$value"; then
ecfc5424 2277 echo "(That expands to $value on this system.)"
2304df62
AD
2278 fi
2279 ;;
2280 *) value="$ans";;
2281 esac
2282 ansexp="$value"
2283 case "$exp_file" in
2284 '') value="$ans";;
2285 esac
2286 ;;
2287 esac
2288 case "$fullpath" in
2289 true)
2290 case "$ansexp" in
2291 /*) value="$ansexp" ;;
2292 *)
2293 redo=true
2294 case "$already" in
2295 true)
2296 echo "I shall only accept a full path name, as in /bin/ls." >&4
2297 echo "Use a ! shell escape if you wish to check pathnames." >&4
2298 ;;
2299 *)
2300 echo "Please give a full path name, starting with slash." >&4
2301 case "$tilde" in
2302 true)
2303 echo "Note that using ~name is ok provided it expands well." >&4
2304 already=true
2305 ;;
2306 esac
2307 esac
2308 ;;
2309 esac
2310 ;;
2311 esac
2312 case "$redo" in
2313 '')
2314 case "$type" in
2315 File)
2316 if test -f "$ansexp"; then
2317 type=''
2318 elif test -r "$ansexp" || (test -h "$ansexp") >/dev/null 2>&1
2319 then
2320 echo "($value is not a plain file, but that's ok.)"
2321 type=''
2322 fi
2323 ;;
2324 Directory)
2325 if test -d "$ansexp"; then
2326 type=''
2327 fi
2328 ;;
2329 Locate)
40000a8c 2330 if test -d "$ansexp"; then
a0d0e21e
LW
2331 echo "(Looking for $loc_file in directory $value.)"
2332 value="$value/$loc_file"
40000a8c 2333 ansexp="$ansexp/$loc_file"
2304df62 2334 fi
40000a8c 2335 if test -f "$ansexp"; then
2304df62
AD
2336 type=''
2337 fi
a0d0e21e
LW
2338 case "$nopath_ok" in
2339 true) case "$value" in
2340 */*) ;;
2341 *) echo "Assuming $value will be in people's path."
2342 type=''
2343 ;;
2344 esac
2345 ;;
2346 esac
2304df62
AD
2347 ;;
2348 esac
2349
2350 case "$skip" in
2351 true) type='';
2352 esac
2353
2354 case "$type" in
2355 '') ;;
2356 *)
2357 if test "$fastread" = yes; then
2358 dflt=y
2359 else
2360 dflt=n
2361 fi
2362 rp="$what $value doesn't exist. Use that name anyway?"
2363 . UU/myread
2364 dflt=''
2365 case "$ans" in
2366 y*) type='';;
2367 *) echo " ";;
2368 esac
2369 ;;
2370 esac
2371 ;;
2372 esac
2373 ;;
2374 esac
2375done
2376cd UU
2377ans="$value"
2378rp="$orig_rp"
2379dflt="$orig_dflt"
ecfc5424 2380rm -f getfile.ok
2304df62
AD
2381EOSC
2382
2383: What should the include directory be ?
2384echo " "
2385$echo $n "Hmm... $c"
a0d0e21e 2386dflt='/usr/include'
2304df62
AD
2387incpath=''
2388mips_type=''
2389if $test -f /bin/mips && /bin/mips; then
2390 echo "Looks like a MIPS system..."
2391 $cat >usr.c <<'EOCP'
2392#ifdef SYSTYPE_BSD43
2393/bsd43
2394#endif
2395EOCP
2396 if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
2397 dflt='/bsd43/usr/include'
2398 incpath='/bsd43'
2399 mips_type='BSD 4.3'
2400 else
2401 mips_type='System V'
2402 fi
2403 $rm -f usr.c usr.out
2404 echo "and you're compiling with the $mips_type compiler and libraries."
40000a8c 2405 echo "exit 0" >mips
2304df62
AD
2406else
2407 echo "Doesn't look like a MIPS system."
2408 echo "exit 1" >mips
2304df62 2409fi
40000a8c
AD
2410chmod +x mips
2411$eunicefix mips
2304df62 2412echo " "
a0d0e21e
LW
2413case "$usrinc" in
2414'') ;;
2415*) dflt="$usrinc";;
2416esac
2304df62
AD
2417fn=d/
2418rp='Where are the include files you want to use?'
2419. ./getfile
2420usrinc="$ans"
2421
a0d0e21e
LW
2422: see how we invoke the C preprocessor
2423echo " "
2424echo "Now, how can we feed standard input to your C preprocessor..." >&4
2425cat <<'EOT' >testcpp.c
2426#define ABC abc
2427#define XYZ xyz
2428ABC.XYZ
2429EOT
2430cd ..
2431echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
2432chmod 755 cppstdin
2433wrapper=`pwd`/cppstdin
2434ok='false'
2435cd UU
2304df62 2436
a0d0e21e
LW
2437if $test "X$cppstdin" != "X" && \
2438 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
2439 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
2440then
2441 echo "You used to use $cppstdin $cppminus so we'll use that again."
2442 case "$cpprun" in
2443 '') echo "But let's see if we can live without a wrapper..." ;;
2444 *)
2445 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
2446 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
2304df62 2447 then
a0d0e21e
LW
2448 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
2449 ok='true'
2450 else
2451 echo "(However, $cpprun $cpplast does not work, let's see...)"
2304df62
AD
2452 fi
2453 ;;
2454 esac
2304df62 2455else
a0d0e21e
LW
2456 case "$cppstdin" in
2457 '') ;;
2458 *)
2459 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
2460 ;;
2461 esac
2304df62 2462fi
2304df62 2463
a0d0e21e
LW
2464if $ok; then
2465 : nothing
2466elif echo 'Maybe "'"$cc"' -E" will work...'; \
2467 $cc -E <testcpp.c >testcpp.out 2>&1; \
2468 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2469 echo "Yup, it does."
2470 x_cpp="$cc -E"
2471 x_minus='';
2472elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
2473 $cc -E - <testcpp.c >testcpp.out 2>&1; \
2474 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2475 echo "Yup, it does."
2476 x_cpp="$cc -E"
2477 x_minus='-';
2478elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
2479 $cc -P <testcpp.c >testcpp.out 2>&1; \
2480 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2481 echo "Yipee, that works!"
2482 x_cpp="$cc -P"
2483 x_minus='';
2484elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
2485 $cc -P - <testcpp.c >testcpp.out 2>&1; \
2486 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2487 echo "At long last!"
2488 x_cpp="$cc -P"
2489 x_minus='-';
2490elif echo 'No such luck, maybe "'$cpp'" will work...'; \
2491 $cpp <testcpp.c >testcpp.out 2>&1; \
2492 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2493 echo "It works!"
2494 x_cpp="$cpp"
2495 x_minus='';
2496elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
2497 $cpp - <testcpp.c >testcpp.out 2>&1; \
2498 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2499 echo "Hooray, it works! I was beginning to wonder."
2500 x_cpp="$cpp"
2501 x_minus='-';
2502elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
2503 $wrapper <testcpp.c >testcpp.out 2>&1; \
2504 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2505 x_cpp="$wrapper"
2506 x_minus=''
2507 echo "Eureka!"
2508else
2509 dflt=''
2510 rp="No dice. I can't find a C preprocessor. Name one:"
2511 . ./myread
2512 x_cpp="$ans"
2513 x_minus=''
2514 $x_cpp <testcpp.c >testcpp.out 2>&1
2515 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2516 echo "OK, that will do." >&4
2517 else
2518echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
2519 exit 1
2520 fi
2521fi
2522
2523case "$ok" in
2524false)
2525 cppstdin="$x_cpp"
2526 cppminus="$x_minus"
2527 cpprun="$x_cpp"
2528 cpplast="$x_minus"
2529 set X $x_cpp
2530 shift
2531 case "$1" in
2532 "$cpp")
2533 echo "Perhaps can we force $cc -E using a wrapper..."
2534 if $wrapper <testcpp.c >testcpp.out 2>&1; \
2535 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
2536 then
2537 echo "Yup, we can."
2538 cppstdin="$wrapper"
2539 cppminus='';
2540 else
2541 echo "Nope, we'll have to live without it..."
2542 fi
2543 ;;
2544 esac
2545 case "$cpprun" in
2546 "$wrapper")
2547 cpprun=''
2548 cpplast=''
2549 ;;
2550 esac
2551 ;;
2552esac
2553
2554case "$cppstdin" in
2555"$wrapper") ;;
2556*) $rm -f $wrapper;;
2557esac
2558$rm -f testcpp.c testcpp.out
2559
2560: determine optimize, if desired, or use for debug flag also
2561case "$optimize" in
2562' ') dflt='none';;
2563'') dflt='-O';;
2564*) dflt="$optimize";;
2565esac
2566$cat <<EOH
2567
2568Some C compilers have problems with their optimizers, by default, $package
2569compiles with the -O flag to use the optimizer. Alternately, you might want
2570to use the symbolic debugger, which uses the -g flag (on traditional Unix
2571systems). Either flag can be specified here. To use neither flag, specify
2572the word "none".
2573
2574EOH
2575rp="What optimizer/debugger flag should be used?"
2576. ./myread
2577optimize="$ans"
2578case "$optimize" in
2579'none') optimize=" ";;
2580esac
2581
2582dflt=''
2583case "$ccflags" in
2584'')
2585 case "$gccversion" in
2586 1*) dflt='-fpcc-struct-return' ;;
2587 esac
2588 case "$optimize" in
2589 *-g*) dflt="$dflt -DDEBUGGING";;
2590 esac
2591 case "$gccversion" in
2592 2*) if test -d /etc/conf/kconfig.d &&
2593 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
2594 then
2595 dflt="$dflt -posix"
2596 fi
2597 ;;
2598 esac
2599 ;;
2600esac
2601
2602case "$mips_type" in
2603*BSD*) ;;
2604'') ;;
2605*) inclwanted="$inclwanted $usrinc/bsd";;
2606esac
2607for thisincl in $inclwanted; do
2608 if $test -d $thisincl; then
2609 if $test x$thisincl != x$usrinc; then
2610 case "$dflt" in
2611 *$thisincl*);;
2612 *) dflt="$dflt -I$thisincl";;
2613 esac
2614 fi
2615 fi
2616done
2617
2618inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
2619 xxx=true;
2620elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
2621 xxx=true;
2622else
2623 xxx=false;
2624fi;
2625if $xxx; then
2626 case "$dflt" in
2627 *$2*);;
2628 *) dflt="$dflt -D$2";;
2629 esac;
2630fi'
2631
2632if ./osf1; then
2633 set signal.h __LANGUAGE_C__; eval $inctest
2634else
2635 set signal.h LANGUAGE_C; eval $inctest
2636fi
2637set signal.h NO_PROTOTYPE; eval $inctest
2638set signal.h _NO_PROTO; eval $inctest
2639
2640case "$dflt" in
2641'') dflt=none;;
2304df62 2642esac
85e6fe83
LW
2643case "$ccflags" in
2644'') ;;
2645*) dflt="$ccflags";;
2646esac
2304df62
AD
2647$cat <<EOH
2648
2649Your C compiler may want other flags. For this question you should include
2650-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
2651but you should NOT include libraries or ld flags like -lwhatever. If you
2652want $package to honor its debug switch, you should include -DDEBUGGING here.
a0d0e21e
LW
2653Your C compiler might also need additional flags, such as -D_POSIX_SOURCE,
2654-DHIDEMYMALLOC or -DCRIPPLED_CC.
2655
2304df62
AD
2656To use no flags, specify the word "none".
2657
2304df62
AD
2658EOH
2659set X $dflt
2660shift
2661dflt=${1+"$@"}
2662rp="Any additional cc flags?"
2663. ./myread
2664case "$ans" in
2665none) ccflags='';;
2666*) ccflags="$ans";;
2667esac
2668
2669: the following weeds options from ccflags that are of no interest to cpp
2670cppflags="$ccflags"
a0d0e21e
LW
2671case "$gccversion" in
26721*) cppflags="$cppflags -D__GNUC__"
2304df62
AD
2673esac
2674case "$mips_type" in
2675'');;
2676*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
2677esac
2678case "$cppflags" in
2679'');;
a0d0e21e
LW
2680*)
2681 echo " "
2682 echo "Let me guess what the preprocessor flags are..." >&4
2683 set X $cppflags
2684 shift
2304df62 2685 cppflags=''
a0d0e21e
LW
2686 $cat >cpp.c <<'EOM'
2687#define BLURFL foo
2688
2689BLURFL xx LFRULB
2690EOM
2691 previous=''
2692 for flag in $*
2304df62 2693 do
a0d0e21e
LW
2694 case "$flag" in
2695 -*) ftry="$flag";;
2696 *) ftry="$previous $flag";;
2304df62 2697 esac
a0d0e21e
LW
2698 if $cppstdin -DLFRULB=bar $ftry $cppminus <cpp.c \
2699 >cpp1.out 2>/dev/null && \
2700 $cpprun -DLFRULB=bar $ftry $cpplast <cpp.c \
2701 >cpp2.out 2>/dev/null && \
2702 $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
2703 $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
2704 then
2705 cppflags="$cppflags $ftry"
2706 previous=''
2707 else
2708 previous="$flag"
2709 fi
2304df62 2710 done
a0d0e21e
LW
2711 set X $cppflags
2712 shift
2713 cppflags=${1+"$@"}
2304df62 2714 case "$cppflags" in
a0d0e21e 2715 *-*) echo "They appear to be: $cppflags";;
2304df62 2716 esac
a0d0e21e 2717 $rm -f cpp.c cpp?.out
2304df62
AD
2718 ;;
2719esac
2720
2721: flags used in final linking phase
2722case "$ldflags" in
ecfc5424 2723'') if ./venix; then
2304df62
AD
2724 dflt='-i -z'
2725 else
a0d0e21e 2726 dflt=''
2304df62 2727 fi
a0d0e21e
LW
2728 case "$ccflags" in
2729 *-posix*) dflt="$dflt -posix" ;;
2730 esac
2731 case "$dflt" in
2732 '') dflt='none' ;;
2733 esac
2304df62
AD
2734 ;;
2735*) dflt="$ldflags";;
2736esac
2737echo " "
2738rp="Any additional ld flags (NOT including libraries)?"
2739. ./myread
2740case "$ans" in
2741none) ldflags='';;
2742*) ldflags="$ans";;
2743esac
2744rmlist="$rmlist pdp11"
2745
2304df62
AD
2746: Set private lib path
2747case "$plibpth" in
ecfc5424 2748'') if ./mips; then
2304df62
AD
2749 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
2750 fi;;
2751esac
a0d0e21e
LW
2752case "$libpth" in
2753' ') dlist='';;
2754'') dlist="$plibpth $glibpth";;
2755*) dlist="$libpth";;
2756esac
2757
2758: Now check and see which directories actually exist, avoiding duplicates
2759libpth=''
2760for xxx in $dlist
2304df62 2761do
a0d0e21e
LW
2762 if $test -d $xxx; then
2763 case " $libpth " in
2764 *" $xxx "*) ;;
2765 *) libpth="$libpth $xxx";;
2766 esac
2304df62
AD
2767 fi
2768done
a0d0e21e 2769$cat <<'EOM'
2304df62 2770
a0d0e21e
LW
2771Some systems have incompatible or broken versions of libraries. Among
2772the directories listed in the question below, please remove any you
2773know not to be holding relevant libraries, and add any that are needed.
2774Say "none" for none.
2775
2776EOM
2777case "$libpth" in
2778'') dflt='none';;
2779*)
2780 set X $libpth
2781 shift
2782 dflt=${1+"$@"}
2783 ;;
2784esac
2304df62
AD
2785rp="Directories to use for library searches?"
2786. ./myread
2787case "$ans" in
2788none) libpth=' ';;
2789*) libpth="$ans";;
2790esac
a0d0e21e
LW
2791
2792: compute shared library extension
2793case "$so" in
2794'')
2795 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
2796 dflt='sl'
2797 else
2798 dflt='so'
2799 fi
2800 ;;
2801*) dflt="$so";;
2802esac
ecfc5424 2803$cat <<EOM
a0d0e21e
LW
2804
2805On some systems, shared libraries may be available. Answer 'none' if
ecfc5424
AD
2806you want to suppress searching of shared libraries for the remaining
2807of this configuration.
2808
a0d0e21e
LW
2809EOM
2810rp='What is the file extension used for shared libraries?'
2811. ./myread
2812so="$ans"
2813
2304df62
AD
2814: Looking for optional libraries
2815echo " "
2816echo "Checking for optional libraries..." >&4
2817case "$libs" in
2818' '|'') dflt='';;
2819*) dflt="$libs";;
2820esac
2821case "$libswanted" in
2822'') libswanted='c_s';;
2823esac
2824for thislib in $libswanted; do
a0d0e21e
LW
2825
2826 if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`; $test -f "$xxx"; then
2827 echo "Found -l$thislib (shared)."
2828 case " $dflt " in
2829 *"-l$thislib "*);;
2830 *) dflt="$dflt -l$thislib";;
2831 esac
2832 elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
2833 echo "Found -l$thislib (shared)."
2834 case " $dflt " in
2835 *"-l$thislib "*);;
2836 *) dflt="$dflt -l$thislib";;
2837 esac
2838 elif xxx=`./loc lib$thislib.a X $libpth`; $test -f "$xxx"; then
2304df62 2839 echo "Found -l$thislib."
a0d0e21e
LW
2840 case " $dflt " in
2841 *"-l$thislib "*);;
2304df62
AD
2842 *) dflt="$dflt -l$thislib";;
2843 esac
a0d0e21e
LW
2844 elif xxx=`./loc lib${thislib}_s.a X $libpth`; $test -f "$xxx"; then
2845 echo "Found -l${thislib}_s."
2846 case " $dflt " in
2847 *"-l$thislib "*);;
2848 *) dflt="$dflt -l${thislib}_s";;
2304df62 2849 esac
a0d0e21e
LW
2850 elif xxx=`./loc Slib$thislib.a X $xlibpth`; $test -f "$xxx"; then
2851 echo "Found -l$thislib."
2852 case " $dflt " in
2853 *"-l$thislib "*);;
2304df62
AD
2854 *) dflt="$dflt -l$thislib";;
2855 esac
2856 else
a0d0e21e 2857 echo "No -l$thislib."
2304df62
AD
2858 fi
2859done
2860set X $dflt
2861shift
2862dflt="$*"
2863case "$libs" in
2864'') dflt="$dflt";;
2865*) dflt="$libs";;
2866esac
2867case "$dflt" in
2868' '|'') dflt='none';;
2869esac
2870
2871$cat <<EOM
2872
2873Some versions of Unix support shared libraries, which make executables smaller
2874but make load time slightly longer.
2875
2876On some systems, mostly newer Unix System V's, the shared library is included
2877by putting the option "-lc_s" as the last thing on the cc command line when
2878linking. Other systems use shared libraries by default. There may be other
2879libraries needed to compile $package on your machine as well. If your system
2880needs the "-lc_s" option, include it here. Include any other special libraries
2881here as well. Say "none" for none.
2882EOM
2883
2884echo " "
2885rp="Any additional libraries?"
2886. ./myread
2887case "$ans" in
2888none) libs=' ';;
2889*) libs="$ans";;
2890esac
2891
2892: see if nm is to be used to determine whether a symbol is defined or not
2893case "$usenm" in
2894'')
2895 dflt=`egrep 'inlibc|csym' ../Configure | wc -l 2>/dev/null`
2896 if $test $dflt -gt 20; then
2897 dflt=y
2898 else
2899 dflt=n
2900 fi
2901 ;;
2902*)
2903 case "$usenm" in
2904 true) dflt=y;;
2905 *) dflt=n;;
2906 esac
2907 ;;
2908esac
2909$cat <<EOM
2910
2911I can use 'nm' to extract the symbols from your C libraries. This is a time
2912consuming task which may generate huge output on the disk (up to 3 megabytes)
2913but that should make the symbols extraction faster. The alternative is to skip
2914the 'nm' extraction part and to compile a small test program instead to
2915determine whether each symbol is present. If you have a fast C compiler and/or
2916if your 'nm' output cannot be parsed, this may be the best solution.
2917
2918EOM
2919rp='Shall I use nm to extract C symbols from the libraries?'
2920. ./myread
2921case "$ans" in
2922n|N) usenm=false;;
2923*) usenm=true;;
2924esac
2925
2926runnm=$usenm
2927case "$reuseval" in
2928true) runnm=false;;
2929esac
2930
2931: nm options which may be necessary
2932case "$nm_opt" in
2933'') if $test -f /mach_boot; then
2934 nm_opt=''
2935 elif $test -d /usr/ccs/lib; then
2936 nm_opt='-p'
2937 elif $test -f /dgux; then
2938 nm_opt='-p'
2939 else
2940 nm_opt=''
2941 fi;;
2942esac
2943
2944case "$runnm" in
2945true)
2946: get list of predefined functions in a handy place
2947echo " "
2948case "$libc" in
2949'') libc=unknown
2950 case "$libs" in
2951 *-lc_s*) libc=`./loc libc_s.a $libc $libpth`
2952 esac
2953 ;;
2954esac
2304df62
AD
2955libnames='';
2956case "$libs" in
2957'') ;;
2958*) for thislib in $libs; do
2959 case "$thislib" in
a0d0e21e
LW
2960 -lc|-lc_s)
2961 : Handle C library specially below.
2962 ;;
2304df62 2963 -l*)
ecfc5424 2964 thislib=`echo $thislib | $sed -e 's/^-l//'`
a0d0e21e
LW
2965 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
2966 :
2967 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
2968 :
2969 elif try=`./loc lib$thislib.a X $libpth`; $test -f "$try"; then
2970 :
2971 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
2972 :
2973 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
2974 :
2975 elif try=`./loc Slib$thislib.a X $xlibpth`; $test -f "$try"; then
2976 :
2977 else
2978 try=''
2304df62
AD
2979 fi
2980 libnames="$libnames $try"
2981 ;;
2982 *) libnames="$libnames $thislib" ;;
2983 esac
2984 done
2985 ;;
2986esac
2987xxx=normal
2988case "$libc" in
2989unknown)
a0d0e21e
LW
2990 set /usr/ccs/lib/libc.$so
2991 $test -r $1 || set /usr/lib/libc.$so
2992 $test -r $1 || set /usr/shlib/libc.$so
2993 $test -r $1 || set /usr/lib/libc.$so.[0-9]*
2994 $test -r $1 || set /lib/libc.$so
2304df62
AD
2995 $test -r $1 || set /lib/libsys_s.a
2996 eval set \$$#
2997 ;;
2998*)
2999 set blurfl
3000 ;;
3001esac
3002if $test -r "$1"; then
3003 echo "Your (shared) C library seems to be in $1."
3004 libc="$1"
3005elif $test -r /lib/libc && $test -r /lib/clib; then
3006 echo "Your C library seems to be in both /lib/clib and /lib/libc."
3007 xxx=apollo
3008 libc='/lib/clib /lib/libc'
3009 if $test -r /lib/syslib; then
3010 echo "(Your math library is in /lib/syslib.)"
3011 libc="$libc /lib/syslib"
3012 fi
3013elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
3014 echo "Your C library seems to be in $libc, as you said before."
3015elif $test -r $incpath/usr/lib/libc.a; then
3016 libc=$incpath/usr/lib/libc.a;
3017 echo "Your C library seems to be in $libc. That's fine."
3018elif $test -r /lib/libc.a; then
3019 libc=/lib/libc.a;
3020 echo "Your C library seems to be in $libc. You're normal."
3021else
3022 if tans=`./loc libc.a blurfl/dyick $libpth`; $test -r "$tans"; then
3023 :
3024 elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
3025 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
3026 elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
3027 :
3028 elif tans=`./loc Slibc.a blurfl/dyick $xlibpth`; $test -r "$tans"; then
3029 :
3030 elif tans=`./loc Mlibc.a blurfl/dyick $xlibpth`; $test -r "$tans"; then
3031 :
3032 else
3033 tans=`./loc Llibc.a blurfl/dyick $xlibpth`
3034 fi
3035 if $test -r "$tans"; then
3036 echo "Your C library seems to be in $tans, of all places."
3037 libc=$tans
3038 else
3039 libc='blurfl'
3040 fi
3041fi
3042if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
3043 dflt="$libc"
3044 cat <<EOM
3045
3046If the guess above is wrong (which it might be if you're using a strange
3047compiler, or your machine supports multiple models), you can override it here.
3048
3049EOM
3050else
3051 dflt=''
3052 echo $libpth | tr ' ' '\012' | sort | uniq > libpath
3053 cat >&4 <<EOM
3054I can't seem to find your C library. I've looked in the following places:
3055
3056EOM
3057 $sed 's/^/ /' libpath
3058 cat <<EOM
3059
3060None of these seems to contain your C library. I need to get its name...
3061
3062EOM
3063fi
3064fn=f
3065rp='Where is your C library?'
3066. ./getfile
3067libc="$ans"
3068
3069echo " "
3070echo $libc $libnames | tr ' ' '\012' | sort | uniq > libnames
3071set X `cat libnames`
3072shift
3073xxx=files
3074case $# in 1) xxx=file; esac
3075echo "Extracting names from the following $xxx for later perusal:" >&4
3076echo " "
3077$sed 's/^/ /' libnames >&4
3078echo " "
3079$echo $n "This may take a while...$c" >&4
ecfc5424 3080
2304df62
AD
3081nm $nm_opt $* 2>/dev/null >libc.tmp
3082$echo $n ".$c"
3083$grep fprintf libc.tmp > libc.ptf
3084xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
3085xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
a0d0e21e 3086if com="$sed -n -e 's/^.* [ADTSI] *_[_.]*//p' -e 's/^.* [ADTSI] //p'";\
2304df62
AD
3087 eval $xscan;\
3088 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3089 eval $xrun
3090elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
3091 eval $xscan;\
3092 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3093 eval $xrun
3094elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
3095 eval $xscan;\
3096 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3097 eval $xrun
3098elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
3099 eval $xscan;\
3100 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3101 eval $xrun
3102elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
3103 eval $xscan;\
3104 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3105 eval $xrun
3106elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
3107 eval $xscan;\
3108 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3109 eval $xrun
3110elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
3111 -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
3112 eval $xscan;\
3113 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3114 eval $xrun
3115elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
3116 eval $xscan;\
3117 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3118 eval $xrun
3119elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
3120 eval $xscan;\
3121 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3122 eval $xrun
a0d0e21e
LW
3123elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
3124 eval $xscan;\
3125 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3126 eval $xrun
2304df62
AD
3127else
3128 nm -p $* 2>/dev/null >libc.tmp
3129 com="$sed -n -e 's/^.* [ADTS] *_[_.]*//p' -e 's/^.* [ADTS] //p'";\
3130 eval "<libc.tmp $com >libc.list"
3131 if $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3132 nm_opt='-p'
3133 echo "done" >&4
3134 else
3135 echo " "
3136 echo "nm didn't seem to work right. Trying ar instead..." >&4
3137 com=''
3138 if ar t $libc > libc.tmp; then
3139 for thisname in $libnames; do
3140 ar t $thisname >>libc.tmp
3141 done
3142 $sed -e 's/\.o$//' < libc.tmp > libc.list
3143 echo "Ok." >&4
3144 else
3145 echo "ar didn't seem to work right." >&4
3146 echo "Maybe this is a Cray...trying bld instead..." >&4
3147 if bld t $libc | $sed -e 's/.*\///' -e 's/\.o:.*$//' > libc.list; then
3148 for thisname in $libnames; do
3149 bld t $libnames | \
3150 $sed -e 's/.*\///' -e 's/\.o:.*$//' >>libc.list
3151 ar t $thisname >>libc.tmp
3152 done
3153 echo "Ok." >&4
3154 else
3155 echo "That didn't work either. Giving up." >&4
3156 exit 1
3157 fi
3158 fi
3159 fi
3160fi
3161nm_extract="$com"
3162if $test -f /lib/syscalls.exp; then
3163 echo " "
3164 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
3165 $sed -n 's/^\([^ ]*\)[ ]*syscall$/\1/p' /lib/syscalls.exp >>libc.list
3166fi
3167;;
3168esac
3169$rm -f libnames libpath
3170
3171: is a C symbol defined?
3172csym='tlook=$1;
3173case "$3" in
3174-v) tf=libc.tmp; tc=""; tdc="";;
3175-a) tf=libc.tmp; tc="[0]"; tdc=[];;
3176*) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
3177esac;
3178tx=yes;
3179case "$reuseval-$4" in
3180true-) ;;
3181true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
3182esac;
3183case "$tx" in
3184yes)
3185 case "$runnm" in
3186 true)
3187 if $contains $tlook $tf >/dev/null 2>&1;
3188 then tval=true;
3189 else tval=false;
3190 fi;;
3191 *)
3192 echo "main() { extern int $1$tdc; printf(\"%d\", $1$tc); }" > t.c;
3193 if $cc $ccflags -o t t.c $ldflags $libs >/dev/null 2>&1;
3194 then tval=true;
3195 else tval=false;
3196 fi;
3197 $rm -f t t.c;;
3198 esac;;
3199*)
3200 case "$tval" in
3201 $define) tval=true;;
3202 *) tval=false;;
3203 esac;;
3204esac;
3205eval "$2=$tval"'
3206
3207: set up the script used to warn in case of inconsistency
3208cat <<'EOSC' >whoa
3209dflt=y
3210echo " "
3211echo "*** WHOA THERE!!! ***" >&4
3212echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
3213rp=" Keep the $hint value?"
3214. ./myread
3215case "$ans" in
3216y) td=$was; tu=$was;;
3217esac
3218EOSC
3219
3220: define an is-in-libc? function
3221inlibc='echo " "; td=$define; tu=$undef;
3222sym=$1; var=$2; eval "was=\$$2";
3223tx=yes;
3224case "$reuseval$was" in
3225true) ;;
3226true*) tx=no;;
3227esac;
3228case "$tx" in
3229yes)
3230 set $sym tres -f;
3231 eval $csym;
3232 case "$tres" in
3233 true)
3234 echo "$sym() found." >&4;
ecfc5424 3235 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
2304df62
AD
3236 *)
3237 echo "$sym() NOT found." >&4;
ecfc5424 3238 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
2304df62
AD
3239 esac;;
3240*)
3241 case "$was" in
3242 $define) echo "$sym() found." >&4;;
3243 *) echo "$sym() NOT found." >&4;;
3244 esac;;
3245esac'
3246
a0d0e21e
LW
3247: see if gconvert exists
3248set gconvert d_gconvert
3249eval $inlibc
2304df62 3250
a0d0e21e
LW
3251case "$d_gconvert" in
3252$define)
ecfc5424 3253 echo "We'll use it to convert floats into a string then." >&4
a0d0e21e
LW
3254 d_Gconvert="gconvert((x),(n),(t),(b))"
3255 ;;
3256*)
3257 : Maybe we can emulate it with gcvt.
3258 set gcvt d_gcvt
3259 eval $inlibc
2304df62 3260
a0d0e21e
LW
3261 case "$d_gcvt" in
3262 $define)
3263 : Test whether gcvt drops a trailing decimal point
ecfc5424 3264 $cat >try.c <<'EOP'
a0d0e21e 3265main() {
ecfc5424
AD
3266 char buf[64];
3267 gcvt(1.0, 8, buf);
3268 if (buf[0] != '1' || buf[1] != '\0')
3269 exit(1);
3270 gcvt(0.0, 8, buf);
3271 if (buf[0] != '0' || buf[1] != '\0')
3272 exit(1);
3273 gcvt(-1.0, 8, buf);
3274 if (buf[0] != '-' || buf[1] != '1' || buf[2] != '\0')
3275 exit(1);
3276 exit(0);
a0d0e21e
LW
3277}
3278EOP
3279 if $cc $ccflags $ldflags -o try try.c $libs > /dev/null 2>&1; then
3280 if ./try; then
3281 echo "Good, your gcvt() drops a trailing decimal point."
ecfc5424 3282 echo "We'll use it to convert floats into a string." >&4
a0d0e21e
LW
3283 d_Gconvert="gcvt((x),(n),(b))"
3284 else
3285 echo "But your gcvt() keeps a trailing decimal point".
3286 d_Gconvert=''
3287 fi
2304df62 3288 else
a0d0e21e
LW
3289 echo "Hmm. I can't compile the gcvt test program."
3290 d_Gconvert=''
2304df62 3291 fi
a0d0e21e 3292 $rm -f try.c try
2304df62
AD
3293 ;;
3294 esac
a0d0e21e
LW
3295 case "$d_Gconvert" in
3296 '')
ecfc5424 3297 echo "I'll use sprintf instead to convert floats into a string." >&4
a0d0e21e 3298 d_Gconvert='sprintf((b),"%.*g",(n),(x))'
2304df62
AD
3299 ;;
3300 esac
2304df62
AD
3301esac
3302
a0d0e21e
LW
3303: Initialize h_fcntl
3304h_fcntl=false
3305
3306: Initialize h_sysfile
3307h_sysfile=false
2304df62
AD
3308
3309: determine filename position in cpp output
3310echo " "
3311echo "Computing filename position in cpp output for #include directives..." >&4
3312echo '#include <stdio.h>' > foo.c
3313$cat >fieldn <<EOF
3314$startsh
a0d0e21e 3315$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
2304df62
AD
3316$grep '^[ ]*#.*stdio\.h' | \
3317while read cline; do
3318 pos=1
3319 set \$cline
3320 while $test \$# -gt 0; do
3321 if $test -r \`echo \$1 | $tr -d '"'\`; then
3322 echo "\$pos"
3323 exit 0
3324 fi
3325 shift
3326 pos=\`expr \$pos + 1\`
3327 done
3328done
3329EOF
3330chmod +x fieldn
3331fieldn=`./fieldn`
3332$rm -f foo.c fieldn
3333case $fieldn in
3334'') pos='???';;
33351) pos=first;;
33362) pos=second;;
33373) pos=third;;
3338*) pos="${fieldn}th";;
3339esac
3340echo "Your cpp writes the filename in the $pos field of the line."
3341
3342: locate header file
3343$cat >findhdr <<EOF
3344$startsh
3345wanted=\$1
3346name=''
3347if test -f $usrinc/\$wanted; then
3348 echo "$usrinc/\$wanted"
3349 exit 0
3350fi
3351awkprg='{ print \$$fieldn }'
3352echo "#include <\$wanted>" > foo\$\$.c
3353$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
3354$grep "^[ ]*#.*\$wanted" | \
3355while read cline; do
3356 name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
3357 case "\$name" in
3358 */\$wanted) echo "\$name"; exit 0;;
3359 *) name='';;
3360 esac;
3361done;
3362$rm -f foo\$\$.c;
3363case "\$name" in
3364'') exit 1;;
3365esac
3366EOF
3367chmod +x findhdr
3368
3369: access call always available on UNIX
3370set access d_access
3371eval $inlibc
3372
3373: locate the flags for 'access()'
3374case "$d_access" in
3375"$define")
3376 echo " "
3377 $cat >access.c <<'EOCP'
3378#include <sys/types.h>
3379#ifdef I_FCNTL
3380#include <fcntl.h>
3381#endif
3382#ifdef I_SYS_FILE
3383#include <sys/file.h>
3384#endif
3385#ifdef I_UNISTD
3386#include <unistd.h>
3387#endif
3388main() {
3389 exit(R_OK);
3390}
3391EOCP
3392 : check sys/file.h first, no particular reason here
3393 if $test `./findhdr sys/file.h` && \
3394 $cc $cppflags -DI_SYS_FILE access.c -o access >/dev/null 2>&1 ; then
3395 h_sysfile=true;
3396 echo "<sys/file.h> defines the *_OK access constants." >&4
3397 elif $test `./findhdr fcntl.h` && \
3398 $cc $cppflags -DI_FCNTL access.c -o access >/dev/null 2>&1 ; then
3399 h_fcntl=true;
3400 echo "<fcntl.h> defines the *_OK access constants." >&4
85e6fe83
LW
3401 elif $test `./findhdr unistd.h` && \
3402 $cc $cppflags -DI_UNISTD access.c -o access >/dev/null 2>&1 ; then
3403 echo "<unistd.h> defines the *_OK access constants." >&4
2304df62
AD
3404 else
3405 echo "I can't find the four *_OK access constants--I'll use mine." >&4
3406 fi
3407 ;;
3408esac
3409$rm -f access*
3410
a0d0e21e
LW
3411: see if alarm exists
3412set alarm d_alarm
2304df62
AD
3413eval $inlibc
3414
40000a8c
AD
3415: determine the architecture name
3416echo " "
3417if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
3418 tarch=`arch`"-$osname"
3419elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
3420 if uname -m > tmparch 2>&1 ; then
3421 tarch=`$cat tmparch`"-$osname"
3422 else
3423 tarch="$osname"
3424 fi
3425 $rm -f tmparch
3426else
3427 tarch="$osname"
3428fi
3429case "$myarchname" in
3430''|"$tarch") ;;
3431*)
3432 echo "(Your architecture name used to be $myarchname.)"
3433 archname=''
3434 ;;
3435esac
3436case "$archname" in
3437'') dflt="$tarch";;
3438*) dflt="$archname";;
3439esac
3440rp='What is your architecture name'
3441. ./myread
3442archname="$ans"
3443myarchname="$tarch"
3444
a0d0e21e
LW
3445: is AFS running?
3446echo " "
3447if test -d /afs; then
3448 echo "AFS may be running... I'll be extra cautious then..." >&4
3449 afs=true
3450else
3451 echo "AFS does not seem to be running..." >&4
3452 afs=false
3453fi
2304df62 3454
a0d0e21e
LW
3455: determine root of directory hierarchy where package will be installed.
3456case "$prefix" in
3457'')
3458 dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3459 ;;
3460*)
3461 dflt="$prefix"
3462 ;;
3463esac
3464$cat <<EOM
2304df62 3465
a0d0e21e
LW
3466By default, $package will be installed in $dflt/bin, manual
3467pages under $dflt/man, etc..., i.e. with $dflt as prefix for
3468all installation directories. Typically set to /usr/local, but you
3469may choose /usr if you wish to install $package among your system
3470binaries. If you wish to have binaries under /bin but manual pages
3471under /usr/local/man, that's ok: you will be prompted separately
3472for each of the installation directories, the prefix being only used
1aef975c 3473to set the defaults.
a0d0e21e
LW
3474
3475EOM
3476fn=d~
3477rp='Installation prefix to use?'
3478. ./getfile
1aef975c
AD
3479oldprefix=''
3480case "$prefix" in
3481'') ;;
3482*)
3483 case "$ans" in
3484 "$prefix") ;;
3485 *) oldprefix="$prefix";;
3486 esac
3487 ;;
3488esac
a0d0e21e 3489prefix="$ans"
1aef975c
AD
3490prefixexp="$ansexp"
3491
3492: set the prefixit variable, to compute a suitable default value
3493prefixit='case "$3" in
3494""|none)
3495 case "$oldprefix" in
3496 "") eval "$1=\"\$$2\"";;
3497 *)
3498 case "$3" in
3499 "") eval "$1=";;
3500 none)
3501 eval "tp=\"\$$2\"";
3502 case "$tp" in
3503 ""|" ") eval "$1=\"\$$2\"";;
3504 *) eval "$1=";;
3505 esac;;
3506 esac;;
3507 esac;;
3508*)
3509 eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
3510 case "$tp" in
3511 --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
3512 /*-$oldprefix/*|\~*-$oldprefix/*)
3513 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
3514 *) eval "$1=\"\$$2\"";;
3515 esac;;
3516esac'
a0d0e21e
LW
3517
3518: determine where private executables go
1aef975c
AD
3519set dflt privlib lib/$package
3520eval $prefixit
a0d0e21e
LW
3521$cat <<EOM
3522
3523There are some auxiliary files for $package that need to be put into a
3524private library directory that is accessible by everyone.
3525
3526EOM
3527fn=d~+
1aef975c 3528rp='Pathname where the private library files will reside?'
a0d0e21e 3529. ./getfile
1aef975c
AD
3530if $test "X$privlibexp" != "X$ansexp"; then
3531 installprivlib=''
3532fi
a0d0e21e
LW
3533privlib="$ans"
3534privlibexp="$ansexp"
3535if $afs; then
3536 $cat <<EOM
3537
3538Since you are running AFS, I need to distinguish the directory in which
3539private files reside from the directory in which they are installed (and from
3540which they are presumably copied to the former directory by occult means).
3541
3542EOM
3543 case "$installprivlib" in
3544 '') dflt=`echo $privlibexp | sed 's#^/afs/#/afs/.#'`;;
3545 *) dflt="$installprivlib";;
3546 esac
3547 fn=de~
3548 rp='Where will private files be installed?'
3549 . ./getfile
3550 installprivlib="$ans"
3551else
3552 installprivlib="$privlibexp"
3553fi
3554
1aef975c
AD
3555: set the prefixup variable, to restore leading tilda escape
3556prefixup='case "$prefixexp" in
3557"$prefix") ;;
3558*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
3559esac'
3560
a0d0e21e 3561: determine where public architecture dependent libraries go
1aef975c
AD
3562set archlib archlib
3563eval $prefixit
ecfc5424
AD
3564case "$archlib" in
3565'')
3566 case "$privlib" in
1aef975c
AD
3567 '')
3568 dflt=`./loc . "." $prefixexp/lib /usr/local/lib /usr/lib /lib`
3569 set dflt
3570 eval $prefixup
3571 ;;
ecfc5424
AD
3572 *) dflt="$privlib/$archname";;
3573 esac
3574 ;;
3575*) dflt="$archlib";;
a0d0e21e 3576esac
a0d0e21e
LW
3577cat <<EOM
3578
1aef975c 3579$spackage contains architecture-dependent library files. If you are
a0d0e21e
LW
3580sharing libraries in a heterogeneous environment, you might store
3581these files in a separate location. Otherwise, you can just include
3582them with the rest of the public library files.
3583
3584EOM
ecfc5424 3585fn=d~
a0d0e21e
LW
3586rp='Where do you want to put the public architecture-dependent libraries?'
3587. ./getfile
3588archlib="$ans"
3589archlibexp="$ansexp"
3590
3591if $afs; then
3592 $cat <<EOM
3593
3594Since you are running AFS, I need to distinguish the directory in which
3595private files reside from the directory in which they are installed (and from
3596which they are presumably copied to the former directory by occult means).
3597
3598EOM
3599 case "$installarchlib" in
3600 '') dflt=`echo $archlibexp | sed 's#^/afs/#/afs/.#'`;;
3601 *) dflt="$installarchlib";;
3602 esac
3603 fn=de~
3604 rp='Where will architecture-dependent library files be installed?'
3605 . ./getfile
3606 installarchlib="$ans"
3607else
3608 installarchlib="$archlibexp"
3609fi
3610if $test X"$archlib" = X"$privlib"; then
3611 d_archlib="$undef"
3612else
3613 d_archlib="$define"
3614fi
3615
2304df62
AD
3616: function used to set $1 to $val
3617setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3618case "$val$was" in
ecfc5424
AD
3619$define$undef) . ./whoa; eval "$var=\$td";;
3620$undef$define) . ./whoa; eval "$var=\$tu";;
2304df62
AD
3621*) eval "$var=$val";;
3622esac'
3623
ecfc5424 3624: Look for GNU-cc style attribute checking
2304df62 3625echo " "
a0d0e21e
LW
3626echo "Checking whether your compiler can handle __attribute__ ..." >&4
3627$cat >attrib.c <<'EOCP'
1aef975c 3628#include <stdio.h>
ecfc5424 3629void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
a0d0e21e
LW
3630EOCP
3631if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
3632 if $contains 'warning' attrib.out >/dev/null 2>&1; then
ecfc5424 3633 echo "Your C compiler doesn't fully support __attribute__."
a0d0e21e
LW
3634 val="$undef"
3635 else
ecfc5424 3636 echo "Your C compiler supports __attribute__."
a0d0e21e
LW
3637 val="$define"
3638 fi
3639else
ecfc5424 3640 echo "Your C compiler doesn't seem to understand __attribute__ at all."
a0d0e21e
LW
3641 val="$undef"
3642fi
ecfc5424 3643set d_attribut
a0d0e21e
LW
3644eval $setvar
3645$rm -f attrib*
3646
3647: see if bcmp exists
3648set bcmp d_bcmp
3649eval $inlibc
3650
3651: see if bcopy exists
3652set bcopy d_bcopy
3653eval $inlibc
3654
3655: see if setpgrp exists
3656set setpgrp d_setpgrp
3657eval $inlibc
3658
3659: see which flavor of setpgrp is in use
3660case "$d_setpgrp" in
3661"$define")
3662 echo " "
3663 $cat >set.c <<EOP
3664main()
3665{
3666 if (getuid() == 0) {
3667 printf("(I see you are running Configure as super-user...)\n");
3668 setuid(1);
3669 }
3670 if (-1 == setpgrp(1, 1))
3671 exit(1);
3672 exit(0);
3673}
3674EOP
ecfc5424 3675 if $cc $ccflags -o set set.c $ldflags $libs >/dev/null 2>&1; then
a0d0e21e
LW
3676 ./set 2>/dev/null
3677 case $? in
3678 0) echo "You have to use setpgrp() instead of setpgrp(pid, pgrp)." >&4
3679 val="$undef";;
3680 *) echo "You have to use setpgrp(pid, pgrp) instead of setpgrp()." >&4
3681 val="$define";;
3682 esac
3683 else
ecfc5424 3684 if ./usg; then
a0d0e21e
LW
3685 xxx="USG one, i.e. you use setpgrp()."
3686 val="$undef"
3687 else
3688 xxx="BSD one, i.e. you use setpgrp(pid, pgrp)."
3689 val="$define"
3690 fi
3691 echo "Assuming your setpgrp is a $xxx" >&4
3692 fi
3693 ;;
3694*) val="$undef";;
3695esac
3696set d_bsdpgrp
3697eval $setvar
3698$rm -f set set.c
3699
1aef975c
AD
3700: Check if we really have byacc
3701case "$byacc" in
3702''|'byacc') val="$undef" ;;
3703*) val="$define" ;;
3704esac
3705set d_byacc
3706eval $setvar
3707
a0d0e21e
LW
3708: see if bzero exists
3709set bzero d_bzero
3710eval $inlibc
3711
3712: check for length of integer
3713echo " "
3714case "$intsize" in
3715'')
3716 echo "Checking to see how big your integers are..." >&4
3717 $cat >try.c <<'EOCP'
3718#include <stdio.h>
3719main()
3720{
3721 printf("%d\n", sizeof(int));
3722}
3723EOCP
3724 if $cc $ccflags try.c -o try >/dev/null 2>&1 ; then
3725 dflt=`./try`
3726 else
3727 dflt='4'
3728 echo "(I can't seem to compile the test program. Guessing...)"
3729 fi
3730 ;;
3731*)
3732 dflt="$intsize"
3733 ;;
3734esac
3735rp="What is the size of an integer (in bytes)?"
3736. ./myread
3737intsize="$ans"
3738$rm -f try.c try
3739
ecfc5424 3740: see if signal is declared as pointer to function returning int or void
a0d0e21e 3741echo " "
ecfc5424
AD
3742xxx=`./findhdr signal.h`
3743$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
3744if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
3745 echo "You have int (*signal())() instead of void." >&4
3746 val="$undef"
3747elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
3748 echo "You have void (*signal())() instead of int." >&4
3749 val="$define"
3750elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
3751 echo "You have int (*signal())() instead of void." >&4
3752 val="$undef"
a0d0e21e 3753else
ecfc5424
AD
3754 case "$d_voidsig" in
3755 '')
3756 echo "I can't determine whether signal handler returns void or int..." >&4
3757 dflt=void
3758 rp="What type does your signal handler return?"
3759 . ./myread
3760 case "$ans" in
3761 v*) val="$define";;
3762 *) val="$undef";;
3763 esac;;
3764 "$define")
3765 echo "As you already told me, signal handler returns void." >&4;;
3766 *)
3767 echo "As you already told me, signal handler returns int." >&4;;
3768 esac
3769fi
3770set d_voidsig
3771eval $setvar
3772case "$d_voidsig" in
3773"$define") signal_t="void";;
3774*) signal_t="int";;
3775esac
3776$rm -f $$.tmp
3777
3778: check for ability to cast large floats to 32-bit ints.
3779echo " "
3780echo 'Checking whether your C compiler can cast large floats to int32.' >&4
3781if $test "$intsize" -eq 4; then
3782 xxx=int
3783else
3784 xxx=long
3785fi
3786$cat >try.c <<EOCP
3787#include <sys/types.h>
3788#include <signal.h>
3789$signal_t blech() { exit(3); }
3790main()
2304df62 3791{
a0d0e21e 3792 $xxx i32;
2304df62
AD
3793 double f;
3794 int result = 0;
3795 signal(SIGFPE, blech);
3796
3797 f = (double) 0x7fffffff;
3798 f = 10 * f;
a0d0e21e 3799 i32 = ($xxx) f;
2304df62 3800
a0d0e21e 3801 if (i32 != ($xxx) f)
2304df62
AD
3802 result |= 1;
3803 exit(result);
3804}
3805EOCP
3806if $cc -o try $ccflags try.c >/dev/null 2>&1; then
3807 ./try
3808 yyy=$?
3809else
a0d0e21e 3810 echo "(I can't seem to compile the test program--assuming it can't)"
2304df62
AD
3811 yyy=1
3812fi
3813case "$yyy" in
38140) val="$define"
3815 echo "Yup, it can."
3816 ;;
3817*) val="$undef"
3818 echo "Nope, it can't."
3819 ;;
3820esac
3821set d_casti32
3822eval $setvar
85e6fe83 3823$rm -f try try.*
a0d0e21e 3824
2304df62
AD
3825: check for ability to cast negative floats to unsigned
3826echo " "
3827echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
ecfc5424
AD
3828$cat >try.c <<EOCP
3829#include <sys/types.h>
2304df62 3830#include <signal.h>
ecfc5424 3831$signal_t blech() { exit(3); }
2304df62
AD
3832main()
3833{
3834 double f = -123;
3835 unsigned long along;
3836 unsigned int aint;
3837 unsigned short ashort;
3838 int result = 0;
3839
3840 signal(SIGFPE, blech);
3841 along = (unsigned long)f;
3842 aint = (unsigned int)f;
3843 ashort = (unsigned short)f;
3844 if (along != (unsigned long)-123)
3845 result |= 1;
3846 if (aint != (unsigned int)-123)
3847 result |= 1;
3848 if (ashort != (unsigned short)-123)
3849 result |= 1;
3850 f = (double)0x40000000;
3851 f = f + f;
3852 along = 0;
3853 along = (unsigned long)f;
3854 if (along != 0x80000000)
3855 result |= 2;
3856 f -= 1.;
3857 along = 0;
3858 along = (unsigned long)f;
3859 if (along != 0x7fffffff)
3860 result |= 1;
3861 f += 2.;
3862 along = 0;
3863 along = (unsigned long)f;
3864 if (along != 0x80000001)
3865 result |= 2;
3866 exit(result);
3867
3868}
3869EOCP
3870if $cc -o try $ccflags try.c >/dev/null 2>&1; then
3871 ./try
3872 castflags=$?
3873else
ecfc5424 3874 echo "(I can't seem to compile the test program--assuming it can't)"
2304df62
AD
3875 castflags=3
3876fi
3877case "$castflags" in
38780) val="$define"
3879 echo "Yup, it can."
3880 ;;
3881*) val="$undef"
3882 echo "Nope, it can't."
3883 ;;
3884esac
3885set d_castneg
3886eval $setvar
3887$rm -f try.*
3888
2304df62
AD
3889: see if vprintf exists
3890echo " "
3891if set vprintf val -f d_vprintf; eval $csym; $val; then
3892 echo 'vprintf() found.' >&4
3893 val="$define"
3894 $cat >vprintf.c <<'EOF'
3895#include <varargs.h>
3896
3897main() { xxx("foo"); }
3898
3899xxx(va_alist)
3900va_dcl
3901{
3902 va_list args;
3903 char buf[10];
3904
3905 va_start(args);
3906 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
3907}
3908EOF
3909 if $cc $ccflags vprintf.c -o vprintf >/dev/null 2>&1 && ./vprintf; then
3910 echo "Your vsprintf() returns (int)." >&4
3911 val2="$undef"
3912 else
3913 echo "Your vsprintf() returns (char*)." >&4
3914 val2="$define"
3915 fi
3916else
3917 echo 'vprintf() NOT found.' >&4
3918 val="$undef"
3919 val2="$undef"
3920fi
3921set d_vprintf
3922eval $setvar
3923val=$val2
3924set d_charvspr
3925eval $setvar
3926
a0d0e21e
LW
3927: see if chown exists
3928set chown d_chown
3929eval $inlibc
3930
3931: see if chroot exists
3932set chroot d_chroot
3933eval $inlibc
3934
2304df62
AD
3935: see if chsize exists
3936set chsize d_chsize
3937eval $inlibc
3938
3939: check for const keyword
3940echo " "
3941echo 'Checking to see if your C compiler knows about "const"...' >&4
3942$cat >const.c <<'EOCP'
3943typedef struct spug { int drokk; } spug;
3944main()
3945{
3946 const char *foo;
3947 const spug y;
3948}
3949EOCP
3950if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
3951 val="$define"
3952 echo "Yup, it does."
3953else
3954 val="$undef"
3955 echo "Nope, it doesn't."
3956fi
3957set d_const
3958eval $setvar
3959
3960: see if crypt exists
3961echo " "
3962if set crypt val -f d_crypt; eval $csym; $val; then
3963 echo 'crypt() found.' >&4
3964 val="$define"
3965 cryptlib=''
3966else
3967 cryptlib=`./loc Slibcrypt.a "" $xlibpth`
3968 if $test -z "$cryptlib"; then
3969 cryptlib=`./loc Mlibcrypt.a "" $xlibpth`
3970 else
3971 cryptlib=-lcrypt
3972 fi
3973 if $test -z "$cryptlib"; then
3974 cryptlib=`./loc Llibcrypt.a "" $xlibpth`
3975 else
3976 cryptlib=-lcrypt
3977 fi
3978 if $test -z "$cryptlib"; then
3979 cryptlib=`./loc libcrypt.a "" $libpth`
3980 else
3981 cryptlib=-lcrypt
3982 fi
3983 if $test -z "$cryptlib"; then
3984 echo 'crypt() NOT found.' >&4
3985 val="$undef"
3986 else
3987 val="$define"
3988 fi
3989fi
3990set d_crypt
3991eval $setvar
3992
3993: get csh whereabouts
3994case "$csh" in
3995'csh') val="$undef" ;;
3996*) val="$define" ;;
3997esac
3998set d_csh
3999eval $setvar
1aef975c 4000full_csh=$csh
2304df62 4001
a0d0e21e
LW
4002: see if cuserid exists
4003set cuserid d_cuserid
2304df62
AD
4004eval $inlibc
4005
85e6fe83
LW
4006: define an alternate in-header-list? function
4007inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4008cont=true; xxf="echo \"<\$1> found.\" >&4";
4009case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4010*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4011esac;
4012case $# in 4) instead=instead;; *) instead="at last";; esac;
4013while $test "$cont"; do
4014 xxx=`./findhdr $1`
4015 var=$2; eval "was=\$$2";
4016 if $test "$xxx" && $test -r "$xxx";
4017 then eval $xxf;
ecfc5424 4018 eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
85e6fe83
LW
4019 cont="";
4020 else eval $xxnf;
ecfc5424 4021 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
85e6fe83
LW
4022 set $yyy; shift; shift; yyy=$@;
4023 case $# in 0) cont="";;
4024 2) xxf="echo \"but I found <\$1> $instead.\" >&4";
4025 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
4026 *) xxf="echo \"but I found <\$1\> instead.\" >&4";
4027 xxnf="echo \"there is no <\$1>, ...\" >&4";;
4028 esac;
4029done;
4030while $test "$yyy";
4031do set $yyy; var=$2; eval "was=\$$2";
ecfc5424 4032 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
85e6fe83
LW
4033 set $yyy; shift; shift; yyy=$@;
4034done'
4035
a0d0e21e
LW
4036: see if this is a limits.h system
4037set limits.h i_limits
85e6fe83
LW
4038eval $inhdr
4039
a0d0e21e
LW
4040: see if this is a float.h system
4041set float.h i_float
4042eval $inhdr
4043
4044: See if number of significant digits in a double precision number is known
4045echo " "
4046$cat >dbl_dig.c <<EOM
4047#$i_limits I_LIMITS
4048#$i_float I_FLOAT
4049#ifdef I_LIMITS
4050#include <limits.h>
85e6fe83 4051#endif
a0d0e21e
LW
4052#ifdef I_FLOAT
4053#include <float.h>
4054#endif
4055#ifdef DBL_DIG
4056printf("Contains DBL_DIG");
85e6fe83 4057#endif
85e6fe83 4058EOM
a0d0e21e
LW
4059$cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
4060if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
4061 echo "DBL_DIG found." >&4
4062 val="$define"
2304df62 4063else
a0d0e21e
LW
4064 echo "DBL_DIG NOT found." >&4
4065 val="$undef"
2304df62 4066fi
a0d0e21e
LW
4067$rm -f dbl_dig.?
4068set d_dbl_dig
2304df62 4069eval $setvar
2304df62 4070
a0d0e21e
LW
4071: see if difftime exists
4072set difftime d_difftime
2304df62
AD
4073eval $inlibc
4074
a0d0e21e
LW
4075: see if this is a dirent system
4076echo " "
4077if xinc=`./findhdr dirent.h`; $test "$xinc"; then
4078 val="$define"
4079 echo "<dirent.h> found." >&4
4080else
4081 val="$undef"
4082 if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
4083 echo "<sys/dir.h> found." >&4
4084 echo " "
4085 else
4086 xinc=`./findhdr sys/ndir.h`
4087 fi
4088 echo "<dirent.h> NOT found." >&4
4089fi
4090set i_dirent
4091eval $setvar
4092
4093: Look for type of directory structure.
4094echo " "
4095$cppstdin $cppflags $cppminus < "$xinc" > try.c
4096
4097case "$direntrytype" in
4098''|' ')
4099 case "$i_dirent" in
4100 $define) guess1='struct dirent' ;;
4101 *) guess1='struct direct' ;;
4102 esac
4103 ;;
4104*) guess1="$direntrytype"
4105 ;;
4106esac
4107
4108case "$guess1" in
4109'struct dirent') guess2='struct direct' ;;
4110*) guess2='struct dirent' ;;
4111esac
4112
4113if $contains "$guess1" try.c >/dev/null 2>&1; then
4114 direntrytype="$guess1"
4115 echo "Your directory entries are $direntrytype." >&4
4116elif $contains "$guess2" try.c >/dev/null 2>&1; then
4117 direntrytype="$guess2"
4118 echo "Your directory entries seem to be $direntrytype." >&4
4119else
4120 echo "I don't recognize your system's directory entries." >&4
4121 rp="What type is used for directory entries on this system?"
4122 dflt="$guess1"
4123 . ./myread
4124 direntrytype="$ans"
4125fi
4126$rm -f try.c
4127
4128
4129: see if the directory entry stores field length
4130echo " "
ecfc5424
AD
4131$cppstdin $cppflags $cppminus < "$xinc" > try.c
4132if $contains 'd_namlen' try.c >/dev/null 2>&1; then
a0d0e21e
LW
4133 echo "Good, your directory entry keeps length information in d_namlen." >&4
4134 val="$define"
4135else
4136 echo "Your directory entry does not know about the d_namlen field." >&4
4137 val="$undef"
4138fi
4139set d_dirnamlen
4140eval $setvar
ecfc5424 4141$rm -f try.c
a0d0e21e
LW
4142
4143: see if dlerror exists
4144set dlerror d_dlerror
4145eval $inlibc
4146
4147: see if dld is available
4148set dld.h i_dld
4149eval $inhdr
4150
4151: see if dlopen exists
4152set dlopen d_dlopen
4153eval $inlibc
4154
4155: determine which dynamic loading, if any, to compile in
4156echo " "
4157dldir="ext/DynaLoader"
4158case "$usedl" in
4159$define|y|true)
4160 dflt='y'
4161 usedl="$define"
4162 ;;
4163$undef|n|false)
4164 dflt='n'
4165 usedl="$undef"
4166 ;;
4167*)
4168 dflt='n'
4169 case "$d_dlopen" in
ecfc5424
AD
4170 $define) dflt='y' ;;
4171 esac
a0d0e21e 4172 case "$i_dld" in
ecfc5424
AD
4173 $define) dflt='y' ;;
4174 esac
4175 : Does a dl_xxx.xs file exist for this operating system
4176 $test -f ../$dldir/dl_${osname}.xs && dflt='y'
4177 ;;
a0d0e21e
LW
4178esac
4179rp="Do you wish to use dynamic loading?"
4180. ./myread
4181usedl="$ans"
4182case "$ans" in
4183y*) usedl="$define"
4184 case "$dlsrc" in
4185 '')
4186 if $test -f ../$dldir/dl_${osname}.xs ; then
4187 dflt="$dldir/dl_${osname}.xs"
4188 elif $test "$d_dlopen" = "$define" ; then
4189 dflt="$dldir/dl_dlopen.xs"
4190 elif $test "$i_dld" = "$define" ; then
4191 dflt="$dldir/dl_dld.xs"
4192 else
4193 dflt=''
4194 fi
4195 ;;
4196 *) dflt="$dldir/$dlsrc"
4197 ;;
4198 esac
4199 echo "The following dynamic loading files are available:"
4200 : Can not go over to $dldir because getfile has path hard-coded in.
4201 cd ..; ls -C $dldir/dl*.xs; cd UU
4202 rp="Source file to use for dynamic loading"
fed7345c 4203 fn="fne"
a0d0e21e
LW
4204 . ./getfile
4205 usedl="$define"
4206 : emulate basename
4207 dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'`
4208 $cat << EOM
4209
4210Some systems may require passing special flags to $cc -c to
4211compile modules that will be used to create a shared library.
4212To use no flags, say "none".
4213
4214EOM
4215 case "$cccdlflags" in
ecfc5424
AD
4216 ''|' ') case "$cc" in
4217 *gcc*) dflt='-fpic' ;;
4218 *) case "$osname" in