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.
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.)
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.
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 and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
21 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
23 # Generated on Tue Oct 27 09:57:04 EET 1998 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by jhi@iki.fi)
29 SCO csh still thinks true is false. Write to SCO today and tell them that next
30 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
32 (Actually, Configure ought to just patch csh in place. Hmm. Hmmmmm. All
33 we'd have to do is go in and swap the && and || tokens, wherever they are.)
35 [End of diatribe. We now return you to your regularly scheduled programming...]
39 OOPS! You naughty creature! You didn't run Configure with sh!
40 I will attempt to remedy the situation by running sh for you...
43 true || cat /tmp/c1$$ /tmp/c2$$
44 true || exec sh $0 $argv:q
46 (exit $?0) || cat /tmp/c2$$
47 (exit $?0) || exec sh $0 $argv:q
48 rm -f /tmp/c1$$ /tmp/c2$$
50 : compute my invocation name
54 me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
59 : Proper separator for the PATH environment variable
61 : On OS/2 this directory should exist if this is not floppy only system :-]
62 if test -d c:/. ; then
63 if test -n "$OS2_SHELL"; then
65 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
66 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
67 elif test -n "$DJGPP"; then
73 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
74 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
75 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
76 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
77 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
78 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
79 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
80 paths="$paths /sbin /usr/sbin /usr/libexec"
86 *) test -d $p && PATH=$PATH$p_$p ;;
93 : shall we be using ksh?
99 if (PATH=.; alias -x) >/dev/null 2>&1; then
102 if test -f /hp-ux -a -f /bin/ksh; then
103 needksh='to avoid sh bug in "here document" expansion'
105 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
106 if test X`/usr/bin/uname -v` = X4; then
107 avoidksh="to avoid AIX 4's /bin/sh"
111 case "$inksh/$needksh" in
118 case "$inksh/$avoidksh" in
124 case "$inksh/$needksh-$avoidksh-" in
127 (I see you are using the Korn shell. Some ksh's blow up on $me,
128 mainly on older exotic systems. If yours does, try the Bourne shell instead.)
134 echo "(Feeding myself to $newsh $reason.)"
136 Configure|*/Configure) exec $newsh $0 "$@";;
137 *) exec $newsh Configure "$@";;
142 : if needed set CDPATH to a harmless value that is not chatty
143 : avoid bash 2.02 problems with empty CDPATH.
147 *bash*) CDPATH='.' ;;
152 : Configure runs within the UU subdirectory
153 test -d UU || mkdir UU
415 d_pthreads_created_joinable=''
644 ignore_versioned_solibs=''
768 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
771 : We must find out about Eunice early
773 if test -f /etc/unixtovms; then
774 eunicefix=/etc/unixtovms
776 if test -f /etc/unixtovms.exe; then
777 eunicefix=/etc/unixtovms.exe
781 : change the next line if compiling for Xenix/286 on Xenix/386
782 xlibpth='/usr/lib/386 /lib/386'
784 : Possible local library directories to search.
785 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
786 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
788 : general looking path for locating libraries
789 glibpth="/shlib /usr/shlib /lib/pa1.1 /usr/lib/large"
790 glibpth="$glibpth /lib /usr/lib $xlibpth"
791 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
792 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
794 : Private path used by Configure to find libraries. Its value
795 : is prepended to libpth. This variable takes care of special
796 : machines, like the mips. Usually, it should be empty.
799 : Possible local include directories to search.
800 : Set locincpth to "" in a hint file to defeat local include searches.
801 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
802 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
804 : no include file wanted by default
807 : list of known cpp symbols, sorted alphabetically
808 al="AMIX BIT_MSF BSD BSD4_3 BSD_NET2 CMU CRAY DGUX DOLPHIN DPX2"
809 al="$al GO32 GOULD_PN HP700 I386 I80960 I960 Lynx M68000 M68K MACH"
810 al="$al MIPSEB MIPSEL MSDOS MTXINU MULTIMAX MVS"
811 al="$al M_COFF M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM"
812 al="$al M_SYS3 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX"
813 al="$al NeXT OCS88 OSF1 PARISC PC532 PORTAR POSIX"
814 al="$al PWB R3000 RES RISC6000 RT Sun386i SVR3 SVR4"
815 al="$al SYSTYPE_BSD SYSTYPE_SVR4 SYSTYPE_SYSV Tek4132 Tek4300"
816 al="$al UMAXV USGr4 USGr4_2 UTEK UTS UTek UnicomPBB UnicomPBD Utek"
817 al="$al VMS Xenix286"
818 al="$al _AIX _AIX32 _AIX370 _AIX41 _AM29000 _COFF _CRAY _CX_UX _EPI"
819 al="$al _IBMESA _IBMR2 _M88K _M88KBCS_TARGET _POWER"
820 al="$al _MIPSEB _MIPSEL _M_COFF _M_I86 _M_I86SM _M_SYS3"
821 al="$al _M_SYS5 _M_SYSIII _M_SYSV _M_UNIX _M_XENIX _NLS _PGC_ _R3000"
822 al="$al _SYSTYPE_BSD _SYSTYPE_BSD43 _SYSTYPE_SVR4"
823 al="$al _SYSTYPE_SYSV _SYSV3 _U370 _UNICOS"
824 al="$al __386BSD__ __BIG_ENDIAN __BIG_ENDIAN__ __BSD_4_4__"
825 al="$al __DGUX__ __DPX2__ __H3050R __H3050RX"
826 al="$al __LITTLE_ENDIAN __LITTLE_ENDIAN__ __MACH__"
827 al="$al __MIPSEB __MIPSEB__ __MIPSEL __MIPSEL__"
828 al="$al __Next__ __OSF1__ __PARAGON__ __PGC__ __PWB __STDC__"
829 al="$al __SVR4_2__ __UMAXV__"
830 al="$al ____386BSD____ __alpha __alpha__ __amiga"
831 al="$al __bsd4_2 __bsd4_2__ __bsdi__ __convex__"
832 al="$al __host_mips__"
833 al="$al __hp9000s200 __hp9000s300 __hp9000s400 __hp9000s500"
834 al="$al __hp9000s500 __hp9000s700 __hp9000s800"
835 al="$al __hppa __hpux __hp_osf __i286 __i286__ __i386 __i386__"
836 al="$al __i486 __i486__ __i860 __i860__ __ibmesa __ksr1__ __linux__"
837 al="$al __m68k __m68k__ __m88100__ __m88k __m88k__"
838 al="$al __mc68000 __mc68000__ __mc68020 __mc68020__"
839 al="$al __mc68030 __mc68030__ __mc68040 __mc68040__"
840 al="$al __mc88100 __mc88100__ __mips __mips__"
841 al="$al __motorola__ __osf__ __pa_risc __sparc__ __stdc__"
842 al="$al __sun __sun__ __svr3__ __svr4__ __ultrix __ultrix__"
843 al="$al __unix __unix__ __uxpm__ __uxps__ __vax __vax__"
844 al="$al _host_mips _mips _unix"
845 al="$al a29k aegis aix aixpc alliant alpha am29000 amiga ansi ardent"
846 al="$al apollo ardent att386 att3b"
847 al="$al bsd bsd43 bsd4_2 bsd4_3 bsd4_4 bsdi bull"
848 al="$al cadmus clipper concurrent convex cray ctix"
849 al="$al dmert encore gcos gcx gimpel gould"
850 al="$al hbullx20 hcx host_mips hp200 hp300 hp700 hp800"
851 al="$al hp9000 hp9000s300 hp9000s400 hp9000s500"
852 al="$al hp9000s700 hp9000s800 hp9k8 hppa hpux"
853 al="$al i186 i286 i386 i486 i8086"
854 al="$al i80960 i860 iAPX286 ibm ibm032 ibmrt interdata is68k"
855 al="$al ksr1 linux luna luna88k m68k m88100 m88k"
856 al="$al mc300 mc500 mc68000 mc68010 mc68020 mc68030"
857 al="$al mc68040 mc68060 mc68k mc68k32 mc700"
858 al="$al mc88000 mc88100 merlin mert mips mvs n16"
859 al="$al ncl_el ncl_mr"
860 al="$al news1500 news1700 news1800 news1900 news3700"
861 al="$al news700 news800 news900 ns16000 ns32000"
862 al="$al ns32016 ns32332 ns32k nsc32000 os osf"
863 al="$al parisc pc532 pdp11 plexus posix pyr"
864 al="$al riscix riscos scs sequent sgi sinix sony sony_news"
865 al="$al sonyrisc sparc sparclite spectrum stardent stratos"
866 al="$al sun sun3 sun386 svr4 sysV68 sysV88"
867 al="$al titan tower tower32 tower32_200 tower32_600 tower32_700"
868 al="$al tower32_800 tower32_850 tss u370 u3b u3b2 u3b20 u3b200"
869 al="$al u3b20d u3b5 ultrix unix unixpc unos vax venix vms"
872 : Trailing extension. Override this in a hint file, if needed.
874 : Extra object files, if any, needed on this platform.
877 : default library list
879 ignore_versioned_solibs=''
880 : full support for void wanted by default
883 : set useposix=false in your hint file to disable the POSIX extension.
885 : set useopcode=false in your hint file to disable the Opcode extension.
887 : set usemultiplicity on the Configure command line to enable multiplicity.
888 : set usethreads on the Configure command line to enable threads.
889 : List of libraries we want.
890 : If anyone needs -lnet, put it in a hint file.
891 libswanted='sfio socket inet nsl nm ndbm gdbm dbm db malloc dl'
892 libswanted="$libswanted dld ld sun m c cposix posix ndir dir crypt"
893 libswanted="$libswanted ucb bsd BSD PW x"
894 : We probably want to search /usr/shlib before most other libraries.
895 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
896 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
897 glibpth="/usr/shlib $glibpth"
898 : Do not use vfork unless overridden by a hint file.
901 : Find the basic shell for Bourne shell scripts
905 *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
908 if test -f "$xxx"; then
911 : Build up a list and do a single loop so we can 'break' out.
912 pth=`echo $PATH | sed -e "s/$p_/ /g"`
913 for xxx in sh bash ksh pdksh ash; do
915 try="$try ${p}/${xxx}"
919 if test -f "$xxx"; then
922 elif test -f "$xxx.exe"; then
933 $me: Fatal Error: I can't find a Bourne Shell anywhere.
935 Usually it's in /bin/sh. How did you even get this far?
936 Please contact me (Jarkko Hietaniemi) at jhi@iki.fi and
937 we'll try to straighten this all out.
943 : see if sh knows # comments
944 if `$sh -c '#' >/dev/null 2>&1`; then
948 test -f $xcat || xcat=/usr/bin/cat
953 if test -s today; then
956 echo "#! $xcat" > try
960 if test -s today; then
968 echo "Your $sh doesn't grok # comments--I will strip them later on."
971 echo "exec grep -v '^[ ]*#'" >spitshell
974 spitshell=`pwd`/spitshell
976 echo "I presume that if # doesn't work, #! won't work either!"
981 : figure out how to guarantee sh startup
983 '') startsh=${sharpbang}${sh} ;;
995 : echo "Yup, it does."
997 echo "Hmm... '$startsh' does not guarantee sh startup..."
998 echo "You may have to fix up the shell scripts to make sure $sh runs them."
1003 : Save command line options in file UU/cmdline.opt for later use in
1004 : generating config.sh.
1005 cat > cmdline.opt <<EOSH
1006 # Configure command line arguments.
1013 cat >>cmdline.opt <<EOSH
1014 config_arg$argn='$arg'
1016 argn=`expr $argn + 1`
1019 : produce awk script to parse command line options
1020 cat >options.awk <<'EOF'
1022 optstr = "dD:eEf:hKOrsSU:V"; # getopt-style specification
1024 len = length(optstr);
1025 for (i = 1; i <= len; i++) {
1026 c = substr(optstr, i, 1);
1027 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1038 if (substr(str, 1, 1) != "-") {
1039 printf("'%s'\n", str);
1043 for (i = 2; i <= len; i++) {
1044 c = substr(str, i, 1);
1046 printf("-%s\n", substr(str, i));
1052 printf("'%s'\n", substr(str, i + 1));
1065 : process the command line options
1066 set X `for arg in "$@"; do echo "X$arg"; done |
1067 sed -e s/X// | awk -f options.awk`
1072 : set up default values
1083 cat >optdef.sh <<EOS
1089 while test $# -gt 0; do
1091 -d) shift; fastread=yes;;
1092 -e) shift; alldone=cont;;
1096 if test -r "$1"; then
1099 echo "$me: cannot read config file $1." >&2
1104 -h) shift; error=true;;
1105 -r) shift; reuseval=true;;
1106 -s) shift; silent=true; realsilent=true;;
1107 -E) shift; alldone=exit;;
1108 -K) shift; knowitall=true;;
1109 -O) shift; override=true;;
1110 -S) shift; silent=true; extractsh=true;;
1115 echo "$me: use '-U symbol=', not '-D symbol='." >&2
1116 echo "$me: ignoring -D $1" >&2
1119 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1120 *) echo "$1='define'" >> optdef.sh;;
1127 *=) echo "$1" >> optdef.sh;;
1129 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1130 echo "$me: ignoring -U $1" >&2
1132 *) echo "$1='undef'" >> optdef.sh;;
1136 -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1139 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1147 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1148 [-U symbol] [-U symbol=]
1149 -d : use defaults for all answers.
1150 -e : go on without questioning past the production of config.sh.
1151 -f : specify an alternate default configuration file.
1152 -h : print this help message and exit (with an error status).
1153 -r : reuse C symbols value if possible (skips costly nm extraction).
1154 -s : silent mode, only echoes questions and essential information.
1155 -D : define symbol to have some value:
1156 -D symbol symbol gets the value 'define'
1157 -D symbol=value symbol gets the value 'value'
1158 -E : stop at the end of questions, after having produced config.sh.
1159 -K : do not use unless you know what you are doing.
1160 -O : let -D and -U override definitions from loaded configuration file.
1161 -S : perform variable substitutions on all .SH files (can mix with -f)
1162 -U : undefine symbol:
1163 -U symbol symbol gets the value 'undef'
1164 -U symbol= symbol gets completely empty
1165 -V : print version number and exit (with a zero status).
1172 case "$fastread$alldone" in
1175 if test ! -t 0; then
1176 echo "Say 'sh Configure', not 'sh <Configure'"
1184 true) exec 1>/dev/null;;
1187 : run the defines and the undefines, if any, but leave the file out there...
1193 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1194 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1195 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1196 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1197 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1200 : Some greps do not return status, grrr.
1201 echo "grimblepritz" >grimble
1202 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1204 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1210 : the following should work in any shell
1214 echo "AGH! Grep doesn't return a status. Attempting remedial action."
1215 cat >contains <<'EOSS'
1216 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1221 : Find the path to the source tree
1224 */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`;;
1235 if test -f $rsrc/Configure && \
1236 $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1238 : found it, so we are ok.
1241 for src in . .. ../.. ../../.. ../../../..; do
1242 if test -f ../$src/Configure && \
1243 $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1254 Sorry, I can't seem to locate the source dir for $package. Please start
1255 Configure with an explicit path -- i.e. /some/path/Configure.
1263 echo "Sources for $package found in \"$src\"." >&4
1267 : script used to extract .SH files with variable substitutions
1268 cat >extract <<'EOS'
1270 echo "Doing variable substitutions on .SH files..."
1271 if test -f $src/MANIFEST; then
1272 set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1274 echo "(Looking for .SH files under the source directory.)"
1275 set x `(cd $src; find . -name "*.SH" -print)`
1279 0) set x `(cd $src; echo *.SH)`; shift;;
1281 if test ! -f $src/$1; then
1287 while test $name; do
1288 if test ! -d "$name"; then
1289 create="$name $create";
1290 name=`echo $name | sed -e "s|^[^/]*$||"`;
1291 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1296 for file in $create; do
1305 dir=`expr X$file : 'X\(.*\)/'`
1306 file=`expr X$file : 'X.*/\(.*\)'`
1307 (cd $dir && . ./$file)
1317 dir=`expr X$file : 'X\(.*\)/'`
1318 file=`expr X$file : 'X.*/\(.*\)'`
1319 (set x $dir; shift; eval $mkdir_p)
1329 if test -f $src/config_h.SH; then
1330 if test ! -f config.h; then
1331 : oops, they left it out of MANIFEST, probably, so do it anyway.
1337 : extract files and exit if asked to do so
1338 case "$extractsh" in
1340 case "$realsilent" in
1344 case "$config_sh" in
1345 '') config_sh='config.sh';;
1348 echo "Fetching answers from $config_sh..."
1351 test "$override" && . ./optdef.sh
1360 : Eunice requires " " instead of "", can you believe it
1363 echo "Beginning of configuration questions for $package."
1365 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1367 : first determine how to suppress newline on echo command
1369 echo "Checking echo to see how to suppress newlines..."
1370 (echo "hi there\c" ; echo " ") >.echotmp
1371 if $contains c .echotmp >/dev/null 2>&1 ; then
1382 echo $n "The star should be here-->$c"
1386 : Now test for existence of everything in MANIFEST
1388 if test -f $rsrc/MANIFEST; then
1389 echo "First let's make sure your kit is complete. Checking..." >&4
1390 awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1393 for filelist in x??; do
1394 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1396 if test -s missing; then
1400 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1402 You have the option of continuing the configuration process, despite the
1403 distinct possibility that your kit is damaged, by typing 'y'es. If you
1404 do, don't blame me if something goes wrong. I advise you to type 'n'o
1405 and contact the author (jhi@iki.fi).
1408 echo $n "Continue? [n] $c" >&4
1412 echo "Continuing..." >&4
1416 echo "ABORTING..." >&4
1421 echo "Looks good..."
1424 echo "There is no MANIFEST file. I hope your kit is complete !"
1429 : Find the appropriate value for a newline for tr
1430 if test -n "$DJGPP"; then
1433 if test X"$trnl" = X; then
1434 case "`echo foo|tr '\n' x 2>/dev/null`" in
1438 if test X"$trnl" = X; then
1439 case "`echo foo|tr '\012' x 2>/dev/null`" in
1440 foox) trnl='\012' ;;
1443 if test X"$trnl" = X; then
1446 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1452 : compute the number of columns on the terminal for proper question formatting
1457 : set up the echo used in my read
1458 myecho="case \"\$xxxm\" in
1459 '') echo $n \"\$rp $c\" >&4;;
1461 '') echo $n \"[\$xxxm] $c\";;
1463 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
1465 echo $n \"[\$xxxm] $c\" >&4
1467 echo $n \"\$rp [\$xxxm] $c\" >&4
1473 : now set up to do reads with possible shell escape and default assignment
1479 case "\$fastread" in
1480 yes) case "\$dflt" in
1483 case "\$silent-\$rp" in
1488 *) case "\$silent" in
1489 true) case "\$rp" in
1494 while expr "X\$ans" : "X!" >/dev/null; do
1498 aok=''; eval "ans=\\"\$answ\\"" && aok=y
1506 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1515 set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1520 echo "(OK, I'll run with -d after this question.)" >&4
1523 echo "*** Sorry, \$1 not supported yet." >&4
1533 echo "*** Substitution done -- please confirm."
1535 ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1540 echo "*** Error -- try again."
1547 case "\$ans\$xxxm\$nostick" in
1559 : create .config dir to save info across Configure sessions
1560 test -d ../.config || mkdir ../.config
1561 cat >../.config/README <<EOF
1562 This directory created by Configure to save information that should
1563 persist across sessions for $package.
1565 You may safely delete it if you wish.
1568 : general instructions
1571 user=`(logname) 2>/dev/null`
1573 '') user=`whoami 2>&1`;;
1575 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1578 rp='Would you like to see the instructions?'
1589 This installation shell script will examine your system and ask you questions
1590 to determine how the perl5 package should be installed. If you get
1591 stuck on a question, you may use a ! shell escape to start a subshell or
1592 execute a command. Many of the questions will have default answers in square
1593 brackets; typing carriage return will give you the default.
1595 On some of the questions which ask for file or directory names you are allowed
1596 to use the ~name construct to specify the login directory belonging to "name",
1597 even if you don't have a shell which knows about that. Questions where this is
1598 allowed will be marked "(~name ok)".
1602 dflt='Type carriage return to continue'
1606 The prompter used in this script allows you to use shell variables and
1607 backticks in your answers. You may use $1, $2, etc... to refer to the words
1608 in the default answer, as if the default line was a set of arguments given to a
1609 script shell. This means you may also use $* to repeat the whole default line,
1610 so you do not have to re-type everything to add something to the default.
1612 Everytime there is a substitution, you will have to confirm. If there is an
1613 error (e.g. an unmatched backtick), the default answer will remain unchanged
1614 and you will be prompted again.
1616 If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
1617 the questions and use the computed defaults (or the previous answers if there
1618 was already a config.sh file). Type 'Configure -h' for a list of options.
1619 You may also start interactively and then answer '& -d' at any prompt to turn
1620 on the non-interactive behaviour for the remainder of the execution.
1626 Much effort has been expended to ensure that this shell script will run on any
1627 Unix system. If despite that it blows up on yours, your best bet is to edit
1628 Configure and run it again. If you can't run Configure for some reason,
1629 you'll have to generate a config.sh file by hand. Whatever problems you
1630 have, let me (jhi@iki.fi) know how I blew it.
1632 This installation script affects things in two ways:
1634 1) it may do direct variable substitutions on some of the files included
1636 2) it builds a config.h file for inclusion in C programs. You may edit
1637 any of these files as the need arises after running this script.
1639 If you make a mistake on a question, there is no easy way to back up to it
1640 currently. The easiest thing to do is to edit config.sh and rerun all the SH
1641 files. Configure will offer to let you do this before it runs the SH files.
1644 dflt='Type carriage return to continue'
1646 case "$firsttime" in
1647 true) echo $user >>../.config/instruct;;
1651 : find out where common programs are
1653 echo "Locating common programs..." >&4
1666 if test -d \$dir/\$thing; then
1672 for thisthing in \$dir/\$thing; do
1673 : just loop through to pick last item
1675 if test -f \$thisthing; then
1678 elif test -f \$dir/\$thing.exe; then
1679 if test -n "$DJGPP"; then
1680 echo \$dir/\$thing.exe
1682 : on Eunice apparently
1733 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1734 pth="$pth /lib /usr/lib"
1735 for file in $loclist; do
1739 if test -f "$xxx"; then
1742 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1743 xxx=`./loc $file $file $pth`
1746 '') xxx=`./loc $file $file $pth`;;
1747 *) xxx=`./loc $xxx $xxx $pth`;;
1753 echo $file is in $xxx.
1756 echo $file is in $xxx.
1759 echo "I don't know where '$file' is, and my life depends on it." >&4
1760 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1766 echo "Don't worry if any of the following aren't found..."
1768 for file in $trylist; do
1772 if test -f "$xxx"; then
1775 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1776 xxx=`./loc $file $file $pth`
1779 '') xxx=`./loc $file $file $pth`;;
1780 *) xxx=`./loc $xxx $xxx $pth`;;
1786 echo $file is in $xxx.
1789 echo $file is in $xxx.
1792 echo "I don't see $file out there, $say."
1799 echo "Substituting grep for egrep."
1805 echo "Substituting cp for ln."
1811 echo "Hopefully test is built into your sh."
1814 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
1815 echo "Using the test built into your sh."
1823 echo "Hopefully echo is built into your sh."
1828 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
1829 $echo $n "hi there$c" >foo1
1830 echo $n "hi there$c" >foo2
1831 if cmp foo1 foo2 >/dev/null 2>&1; then
1832 echo "They are compatible. In fact, they may be identical."
1839 They are not compatible! You are probably running ksh on a non-USG system.
1840 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
1841 have echo built in and we may have to run some Bourne shell scripts. That
1842 means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
1845 $echo $n "The star should be here-->$c"
1852 : determine whether symbolic links are supported
1855 if $ln -s blurfl sym > /dev/null 2>&1 ; then
1856 echo "Symbolic links are supported." >&4
1859 echo "Symbolic links are NOT supported." >&4
1864 : see whether [:lower:] and [:upper:] are supported character classes
1866 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1868 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
1872 *) # There is a discontinuity in EBCDIC between 'I' and 'J'
1873 # (0xc9 and 0xd1), therefore that is a nice testing point.
1874 if test "X$up" = X -o "X$low" = X; then
1875 case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
1881 if test "X$up" = X -o "X$low" = X; then
1882 case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
1888 if test "X$up" = X -o "X$low" = X; then
1889 case "`echo IJ | od -x 2>/dev/null`" in
1891 echo "Hey, this might be EBCDIC." >&4
1892 if test "X$up" = X -o "X$low" = X; then
1893 case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
1894 ij) up='[A-IJ-RS-Z]'
1899 if test "X$up" = X -o "X$low" = X; then
1900 case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
1910 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
1912 echo "Using $up and $low to convert case." >&4
1915 echo "I don't know how to translate letters from upper to lower case." >&4
1916 echo "Your tr is not acting any way I know of." >&4
1920 : set up the translation script tr, must be called with ./tr of course
1924 '[A-Z][a-z]') exec $tr '$up' '$low';;
1925 '[a-z][A-Z]') exec $tr '$low' '$up';;
1932 : Try to determine whether config.sh was made on this system
1933 case "$config_sh" in
1935 myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
1936 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
1937 # because the A-Z/a-z are not consecutive.
1938 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
1939 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
1940 newmyuname="$myuname"
1942 case "$knowitall" in
1944 if test -f ../config.sh; then
1945 if $contains myuname= ../config.sh >/dev/null 2>&1; then
1946 eval "`grep myuname= ../config.sh`"
1948 if test "X$myuname" = "X$newmyuname"; then
1956 : Get old answers from old config file if Configure was run on the
1957 : same system, otherwise use the hints.
1960 if test -f config.sh; then
1962 rp="I see a config.sh file. Shall I use it to set the defaults?"
1965 n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
1966 *) echo "Fetching default answers from your old config.sh file..." >&4
1974 : Older versions did not always set $sh. Catch re-use of such
1983 if test ! -f config.sh; then
1986 First time through, eh? I have some defaults handy for some systems
1987 that need some extra help getting the Configure answers right:
1990 (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
1992 : Half the following guesses are probably wrong... If you have better
1993 : tests or hints, please send them to jhi@iki.fi
1994 : The metaconfig authors would also appreciate a copy...
1995 $test -f /irix && osname=irix
1996 $test -f /xenix && osname=sco_xenix
1997 $test -f /dynix && osname=dynix
1998 $test -f /dnix && osname=dnix
1999 $test -f /lynx.os && osname=lynxos
2000 $test -f /unicos && osname=unicos && osvers=`$uname -r`
2001 $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2002 $test -f /bin/mips && /bin/mips && osname=mips
2003 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2004 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2005 $test -d /usr/apollo/bin && osname=apollo
2006 $test -f /etc/saf/_sactab && osname=svr4
2007 $test -d /usr/include/minix && osname=minix
2008 if $test -d /MachTen -o -d /MachTen_Folder; then
2010 if $test -x /sbin/version; then
2011 osvers=`/sbin/version | $awk '{print $2}' |
2012 $sed -e 's/[A-Za-z]$//'`
2013 elif $test -x /usr/etc/version; then
2014 osvers=`/usr/etc/version | $awk '{print $2}' |
2015 $sed -e 's/[A-Za-z]$//'`
2020 $test -f /sys/posix.dll &&
2021 $test -f /usr/bin/what &&
2022 set X `/usr/bin/what /sys/posix.dll` &&
2023 $test "$3" = UWIN &&
2026 if $test -f $uname; then
2034 umips) osname=umips ;;
2037 [23]100) osname=mips ;;
2038 next*) osname=next ;;
2040 if $test -f /etc/kconfig; then
2042 if test "$lns" = "ln -s"; then
2044 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2046 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2052 if test -n "$DJGPP"; then
2061 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2063 'not found') osvers="$4"."$3" ;;
2064 '<3240'|'<>3240') osvers=3.2.0 ;;
2065 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2066 '=3250'|'>3250') osvers=3.2.5 ;;
2070 *dc.osx) osname=dcosx
2076 domainos) osname=apollo
2082 dynixptx*) osname=dynixptx
2085 freebsd) osname=freebsd
2087 genix) osname=genix ;;
2089 osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2105 netbsd*) osname=netbsd
2108 news-os) osvers="$3"
2110 4*) osname=newsos4 ;;
2114 bsd386) osname=bsd386
2117 POSIX-BC | posix-bc ) osname=posix-bc
2120 powerux | power_ux | powermax_os | powermaxos | \
2121 powerunix | power_unix) osname=powerux
2124 next*) osname=next ;;
2125 solaris) osname=solaris
2127 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2134 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2138 titanos) osname=titanos
2147 ultrix) osname=ultrix
2150 osf1|mls+) case "$5" in
2153 osvers=`echo "$3" | sed 's/^[xvt]//'`
2155 hp*) osname=hp_osf1 ;;
2156 mips) osname=mips_osf1 ;;
2165 $2) case "$osname" in
2169 : svr4.x or possibly later
2179 if test -f /stand/boot ; then
2180 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2181 if test -n "$INITPROG" -a -f "$INITPROG"; then
2182 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2183 if test -n "$isesix"; then
2191 *) if test -f /etc/systemid; then
2193 set `echo $3 | $sed 's/\./ /g'` $4
2194 if $test -f $src/hints/sco_$1_$2_$3.sh; then
2196 elif $test -f $src/hints/sco_$1_$2.sh; then
2198 elif $test -f $src/hints/sco_$1.sh; then
2203 '') : Still unknown. Probably a generic Sys V.
2212 *) case "$osname" in
2213 '') : Still unknown. Probably a generic BSD.
2221 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2222 (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2223 if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2226 $rm -f UU/kernel.what
2227 elif test -d c:/.; then
2234 : Now look for a hint file osname_osvers, unless one has been
2235 : specified already.
2238 file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'`
2239 : Also try without trailing minor version numbers.
2240 xfile=`echo $file | $sed -e 's@_[^_]*$@@'`
2241 xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'`
2242 xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'`
2243 xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'`
2246 *) case "$osvers" in
2249 *) if $test -f $src/hints/$file.sh ; then
2251 elif $test -f $src/hints/$xfile.sh ; then
2253 elif $test -f $src/hints/$xxfile.sh ; then
2255 elif $test -f $src/hints/$xxxfile.sh ; then
2257 elif $test -f $src/hints/$xxxxfile.sh ; then
2259 elif $test -f "$src/hints/${osname}.sh" ; then
2268 if $test -f Policy.sh ; then
2271 none) dflt="Policy" ;;
2272 *) dflt="Policy $dflt" ;;
2277 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2281 if $test -f Policy.sh ; then
2284 There's also a Policy hint file available, which should make the
2285 site-specific (policy) questions easier to answer.
2292 You may give one or more space-separated answers, or "none" if appropriate.
2293 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2294 is a good thing. DO NOT give a wrong version.
2298 rp="Which of these apply, if any?"
2301 for file in $tans; do
2302 if $test X$file = XPolicy -a -f Policy.sh; then
2304 $cat Policy.sh >> UU/config.sh
2305 elif $test -f $src/hints/$file.sh; then
2306 . $src/hints/$file.sh
2307 $cat $src/hints/$file.sh >> UU/config.sh
2308 elif $test X$tans = X -o X$tans = Xnone ; then
2311 : Give one chance to correct a possible typo.
2312 echo "$file.sh does not exist"
2314 rp="hint to use instead?"
2316 for file in $ans; do
2317 if $test -f "$src/hints/$file.sh"; then
2318 . $src/hints/$file.sh
2319 $cat $src/hints/$file.sh >> UU/config.sh
2320 elif $test X$ans = X -o X$ans = Xnone ; then
2323 echo "$file.sh does not exist -- ignored."
2330 : Remember our hint file for later.
2331 if $test -f "$src/hints/$file.sh" ; then
2341 echo "Fetching default answers from $config_sh..." >&4
2345 cp $config_sh config.sh 2>/dev/null
2355 test "$override" && . ./optdef.sh
2356 myuname="$newmyuname"
2358 : Restore computed paths
2359 for file in $loclist $trylist; do
2360 eval $file="\$_$file"
2365 Configure uses the operating system name and version to set some defaults.
2366 The default value is probably right if the name rings a bell. Otherwise,
2367 since spelling matters for me, either accept the default or answer "none"
2374 ''|' '|none) dflt=none ;;
2375 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2378 *) dflt="$osname" ;;
2380 rp="Operating system name?"
2384 *) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2390 ''|' '|none) dflt=none ;;
2391 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2392 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2394 ''|' ') dflt=none ;;
2399 *) dflt="$osvers" ;;
2401 rp="Operating system version?"
2408 : who configured the system
2409 cf_time=`LC_ALL=C; export LC_ALL; $date 2>&1`
2410 cf_by=`(logname) 2>/dev/null`
2413 cf_by=`(whoami) 2>/dev/null`
2415 "") cf_by=unknown ;;
2419 : set up the script used to warn in case of inconsistency
2426 echo "*** WHOA THERE!!! ***" >&4
2427 echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
2428 rp=" Keep the $hint value?"
2431 y) td=$was; tu=$was;;
2435 : function used to set $1 to $val
2436 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2438 $define$undef) . ./whoa; eval "$var=\$td";;
2439 $undef$define) . ./whoa; eval "$var=\$tu";;
2440 *) eval "$var=$val";;
2445 Perl can be built to take advantage of threads, on some systems.
2446 To do so, Configure must be run with -Dusethreads.
2447 (See README.threads for details.)
2449 case "$usethreads" in
2450 $define|true|[yY]*) dflt='y';;
2453 rp='Build a threading Perl?'
2456 y|Y) val="$define" ;;
2461 : Look for a hint-file generated 'call-back-unit'. Now that the
2462 : user has specified if a threading perl is to be built, we may need
2463 : to set or change some other defaults.
2464 if $test -f usethreads.cbu; then
2467 case "$d_oldpthreads" in
2468 '') : Configure tests would be welcome here. For now, assume undef.
2470 *) val="$d_oldpthreads" ;;
2477 Perl can be built so that multiple Perl interpreters can coexist
2478 within the same Perl executable. To do so, Configure must be run with
2481 Normally you do not need this and you should answer no.
2484 case "$usemultiplicity" in
2485 $define|true|[yY]*) dflt='y';;
2488 rp='Build Perl for multiplicity?'
2491 y|Y) val="$define" ;;
2499 Perl can be built to take advantage of explicit 64-bit interfaces,
2500 on some systems. To do so, Configure must be run with -Duse64bits.
2502 If this doesn't make any sense to you, just accept the default 'n'.
2504 case "$use64bits" in
2505 $define|true|[yY]*) dflt='y';;
2508 rp='Try to use explicit 64-bit interfaces, if available?'
2523 : determine the architecture name
2525 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
2526 tarch=`arch`"-$osname"
2527 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
2528 if uname -m > tmparch 2>&1 ; then
2529 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
2530 -e 's/$/'"-$osname/" tmparch`
2538 case "$myarchname" in
2541 echo "(Your architecture name used to be $myarchname.)"
2548 *) dflt="$archname";;
2550 rp='What is your architecture name'
2553 case "$usethreads" in
2555 echo "Threads selected." >&4
2557 *-thread*) echo "...and architecture name already has -thread." >&4
2559 *) archname="$archname-thread"
2560 echo "...setting architecture name to $archname." >&4
2565 case "$usemultiplicity" in
2567 echo "Multiplicity selected." >&4
2569 *-multi*) echo "...and architecture name already has -multi." >&4
2571 *) archname="$archname-multi"
2572 echo "...setting architecture name to $archname." >&4
2577 case "$use64bits" in
2579 echo "Explicit 64-bitness selected." >&4
2580 case "$archname64" in
2585 *-$archname64*) echo "...and architecture name already has $archname64." >&4
2587 *) archname="$archname-$archname64"
2588 echo "...setting architecture name to $archname." >&4
2598 $define|true) afs=true ;;
2599 $undef|false) afs=false ;;
2600 *) if test -d /afs; then
2608 echo "AFS may be running... I'll be extra cautious then..." >&4
2610 echo "AFS does not seem to be running..." >&4
2613 : decide how portable to be. Allow command line overrides.
2614 case "$d_portable" in
2616 *) d_portable="$define" ;;
2619 : set up shell script to do ~ expansion
2625 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
2628 if $test -f /bin/csh; then
2629 /bin/csh -f -c "glob \$1"
2634 name=\`$expr x\$1 : '..\([^/]*\)'\`
2635 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
2636 if $test ! -d "\$dir"; then
2638 echo "\$me: can't locate home directory for: \$name" >&2
2643 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
2659 : now set up to get a file name
2663 cat <<'EOSC' >>getfile
2676 expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
2677 fn=`echo $fn | sed 's/(.*)//'`
2683 loc_file=`expr $fn : '.*:\(.*\)'`
2684 fn=`expr $fn : '\(.*\):.*'`
2692 */*) fullpath=true;;
2701 *e*) exp_file=true;;
2704 *p*) nopath_ok=true;;
2709 *d*) type='Directory';;
2710 *l*) type='Locate';;
2715 Locate) what='File';;
2720 case "$d_portable" in
2728 while test "$type"; do
2733 true) rp="$rp (~name ok)";;
2736 if test -f UU/getfile.ok && \
2737 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
2756 value=`UU/filexp $ans`
2759 if test "$ans" != "$value"; then
2760 echo "(That expands to $value on this system.)"
2774 /*) value="$ansexp" ;;
2779 echo "I shall only accept a full path name, as in /bin/ls." >&4
2780 echo "Use a ! shell escape if you wish to check pathnames." >&4
2783 echo "Please give a full path name, starting with slash." >&4
2786 echo "Note that using ~name is ok provided it expands well." >&4
2799 if test -f "$ansexp"; then
2801 elif test -r "$ansexp" || (test -h "$ansexp") >/dev/null 2>&1
2803 echo "($value is not a plain file, but that's ok.)"
2808 if test -d "$ansexp"; then
2813 if test -d "$ansexp"; then
2814 echo "(Looking for $loc_file in directory $value.)"
2815 value="$value/$loc_file"
2816 ansexp="$ansexp/$loc_file"
2818 if test -f "$ansexp"; then
2821 case "$nopath_ok" in
2822 true) case "$value" in
2824 *) echo "Assuming $value will be in people's path."
2840 if test "$fastread" = yes; then
2845 rp="$what $value doesn't exist. Use that name anyway?"
2866 : determine root of directory hierarchy where package will be installed.
2869 dflt=`./loc . /usr/local /usr/local /local /opt /usr`
2877 By default, $package will be installed in $dflt/bin, manual
2878 pages under $dflt/man, etc..., i.e. with $dflt as prefix for
2879 all installation directories. Typically set to /usr/local, but you
2880 may choose /usr if you wish to install $package among your system
2881 binaries. If you wish to have binaries under /bin but manual pages
2882 under /usr/local/man, that's ok: you will be prompted separately
2883 for each of the installation directories, the prefix being only used
2884 to set the defaults.
2888 rp='Installation prefix to use?'
2896 *) oldprefix="$prefix";;
2903 : set the prefixit variable, to compute a suitable default value
2904 prefixit='case "$3" in
2906 case "$oldprefix" in
2907 "") eval "$1=\"\$$2\"";;
2914 ""|" ") eval "$1=\"\$$2\"";;
2920 eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
2922 --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
2923 /*-$oldprefix/*|\~*-$oldprefix/*)
2924 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
2925 *) eval "$1=\"\$$2\"";;
2929 : set the base revision
2932 : get the patchlevel
2934 echo "Getting the current patchlevel..." >&4
2935 if $test -r $rsrc/patchlevel.h;then
2936 patchlevel=`awk '/define[ ]+PATCHLEVEL/ {print $3}' $rsrc/patchlevel.h`
2937 subversion=`awk '/define[ ]+SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
2942 $echo $n "(You have $package" $c
2945 *) $echo $n " $baserev" $c ;;
2947 $echo $n " patchlevel $patchlevel" $c
2948 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
2951 if test 0 -eq "$subversion"; then
2952 version=`LC_ALL=C; export LC_ALL; \
2953 echo $baserev $patchlevel | \
2954 $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
2956 version=`LC_ALL=C; export LC_ALL; \
2957 echo $baserev $patchlevel $subversion | \
2958 $awk '{ printf "%.5f\n", $1 + $2/1000.0 + $3/100000.0 }'`
2960 : Figure out perl API version. Perhaps this should be in patchlevel.h
2961 if test "$subversion" -lt 50; then
2962 apiversion=`LC_ALL=C; export LC_ALL; \
2963 echo $baserev $patchlevel | \
2964 $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
2966 apiversion="$version"
2969 : determine where private library files go
2970 : Usual default is /usr/local/lib/perl5/$version.
2971 : Also allow things like /opt/perl/lib/$version, since
2972 : /opt/perl/lib/perl5... would be redundant.
2974 *perl*) set dflt privlib lib/$version ;;
2975 *) set dflt privlib lib/$package/$version ;;
2980 There are some auxiliary files for $package that need to be put into a
2981 private library directory that is accessible by everyone.
2985 rp='Pathname where the private library files will reside?'
2987 if $test "X$privlibexp" != "X$ansexp"; then
2991 privlibexp="$ansexp"
2995 Since you are running AFS, I need to distinguish the directory in which
2996 private files reside from the directory in which they are installed (and from
2997 which they are presumably copied to the former directory by occult means).
3000 case "$installprivlib" in
3001 '') dflt=`echo $privlibexp | sed 's#^/afs/#/afs/.#'`;;
3002 *) dflt="$installprivlib";;
3005 rp='Where will private files be installed?'
3007 installprivlib="$ans"
3009 installprivlib="$privlibexp"
3012 : set the prefixup variable, to restore leading tilda escape
3013 prefixup='case "$prefixexp" in
3015 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
3018 : determine where public architecture dependent libraries go
3021 : privlib default is /usr/local/lib/$package/$version
3022 : archlib default is /usr/local/lib/$package/$version/$archname
3023 : privlib may have an optional trailing /share.
3024 tdflt=`echo $privlib | $sed 's,/share$,,'`
3025 tdflt=$tdflt/$archname
3034 $spackage contains architecture-dependent library files. If you are
3035 sharing libraries in a heterogeneous environment, you might store
3036 these files in a separate location. Otherwise, you can just include
3037 them with the rest of the public library files.
3041 rp='Where do you want to put the public architecture-dependent libraries?'
3044 archlibexp="$ansexp"
3049 Since you are running AFS, I need to distinguish the directory in
3050 which architecture-dependent library files reside from the directory
3051 in which they are installed (and from which they are presumably copied
3052 to the former directory by occult means).
3055 case "$installarchlib" in
3056 '') dflt=`echo $archlibexp | sed 's#^/afs/#/afs/.#'`;;
3057 *) dflt="$installarchlib";;
3060 rp='Where will architecture-dependent library files be installed?'
3062 installarchlib="$ans"
3064 installarchlib="$archlibexp"
3066 if $test X"$archlib" = X"$privlib"; then
3072 : make some quick guesses about what we are up against
3074 $echo $n "Hmm... $c"
3084 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3085 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3087 echo "Looks kind of like an OSF/1 system, but we'll see..."
3089 elif test `echo abc | tr a-z A-Z` = Abc ; then
3090 xxx=`./loc addbib blurfl $pth`
3091 if $test -f $xxx; then
3092 echo "Looks kind of like a USG system with BSD features, but we'll see..."
3096 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3097 echo "Looks kind of like an extended USG system, but we'll see..."
3099 echo "Looks kind of like a USG system, but we'll see..."
3103 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3104 echo "Looks kind of like a BSD system, but we'll see..."
3108 echo "Looks kind of like a Version 7 system, but we'll see..."
3111 case "$eunicefix" in
3114 There is, however, a strange, musty smell in the air that reminds me of
3115 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3119 : it so happens the Eunice I know will not run shell scripts in Unix format
3123 echo "Congratulations. You aren't running Eunice."
3127 : Detect OS2. The p_ variable is set above in the Head.U unit.
3132 I have the feeling something is not exactly right, however...don't tell me...
3133 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3138 if test -f /xenix; then
3139 echo "Actually, this looks more like a XENIX system..."
3144 echo "It's not Xenix..."
3149 if test -f /venix; then
3150 echo "Actually, this looks more like a VENIX system..."
3157 echo "Nor is it Venix..."
3160 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3161 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3164 : see if setuid scripts can be secure
3167 Some kernels have a bug that prevents setuid #! scripts from being
3168 secure. Some sites have disabled setuid #! scripts because of this.
3170 First let's decide if your kernel supports secure setuid #! scripts.
3171 (If setuid #! scripts would be secure but have been disabled anyway,
3172 don't say that they are secure if asked.)
3177 if $test -d /dev/fd; then
3178 echo "#!$ls" >reflect
3179 chmod +x,u+s reflect
3180 ./reflect >flect 2>&1
3181 if $contains "/dev/fd" flect >/dev/null; then
3182 echo "Congratulations, your kernel has secure setuid scripts!" >&4
3186 If you are not sure if they are secure, I can check but I'll need a
3187 username and password different from the one you are using right now.
3188 If you don't have such a username or don't want me to test, simply
3192 rp='Other username to test security of setuid scripts with?'
3197 case "$d_suidsafe" in
3198 '') echo "I'll assume setuid scripts are *not* secure." >&4
3201 echo "Well, the $hint value is *not* secure." >&4
3203 *) echo "Well, the $hint value *is* secure." >&4
3208 $rm -f reflect flect
3209 echo "#!$ls" >reflect
3210 chmod +x,u+s reflect
3213 echo '"su" will (probably) prompt you for '"$ans's password."
3214 su $ans -c './reflect >flect'
3215 if $contains "/dev/fd" flect >/dev/null; then
3216 echo "Okay, it looks like setuid scripts are secure." >&4
3219 echo "I don't think setuid scripts are secure." >&4
3224 rp='Does your kernel have *secure* setuid scripts?'
3227 [yY]*) val="$define";;
3232 echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
3233 echo "(That's for file descriptors, not floppy disks.)"
3239 $rm -f reflect flect
3241 : now see if they want to do setuid emulation
3244 case "$d_suidsafe" in
3247 echo "No need to emulate SUID scripts since they are secure here." >& 4
3251 Some systems have disabled setuid scripts, especially systems where
3252 setuid scripts cannot be secure. On systems where setuid scripts have
3253 been disabled, the setuid/setgid bits on scripts are currently
3254 useless. It is possible for $package to detect those bits and emulate
3255 setuid/setgid in a secure fashion. This emulation will only work if
3256 setuid scripts have been disabled in your kernel.
3260 "$define") dflt=y ;;
3263 rp="Do you want to do setuid/setgid emulation?"
3266 [yY]*) val="$define";;
3274 : determine where manual pages are on this system
3278 syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
3279 syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
3280 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
3281 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
3282 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
3283 sysman=`./loc . /usr/man/man1 $syspath`
3286 if $test -d "$sysman"; then
3287 echo "System manual is in $sysman." >&4
3289 echo "Could not find manual pages in source form." >&4
3292 : see what memory models we can support
3295 $cat >pdp11.c <<'EOP'
3304 ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
3305 if $test -f pdp11 && ./pdp11 2>/dev/null; then
3306 dflt='unsplit split'
3308 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
3311 *) if $test -d /lib/small || $test -d /usr/lib/small; then
3316 if $test -d /lib/medium || $test -d /usr/lib/medium; then
3319 if $test -d /lib/large || $test -d /usr/lib/large; then
3322 if $test -d /lib/huge || $test -d /usr/lib/huge; then
3331 Some systems have different model sizes. On most systems they are called
3332 small, medium, large, and huge. On the PDP11 they are called unsplit and
3333 split. If your system doesn't support different memory models, say "none".
3334 If you wish to force everything to one memory model, say "none" here and
3335 put the appropriate flags later when it asks you for other cc and ld flags.
3336 Venix systems may wish to put "none" and let the compiler figure things out.
3337 (In the following question multiple model names should be space separated.)
3339 The default for most systems is "none".
3342 rp="Which memory models are supported?"
3357 '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
3358 $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
3365 rp="What flag indicates separate I and D space?"
3373 *large*|*small*|*medium*|*huge*)
3380 rp="What flag indicates large model?"
3390 *huge*) case "$huge" in
3394 rp="What flag indicates huge model?"
3404 *medium*) case "$medium" in
3408 rp="What flag indicates medium model?"
3415 *) medium="$large";;
3418 *small*) case "$small" in
3422 rp="What flag indicates small model?"
3433 echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
3436 $rm -f pdp11.* pdp11
3438 : see if we need a special compiler
3446 *) if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
3447 if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
3461 On some older systems the default C compiler will not resolve multiple global
3462 references that happen to have the same name. On some such systems the "Mcc"
3463 command may be used to force these to be resolved. On other systems a "cc -M"
3464 command is required. (Note that the -M flag on other systems indicates a
3465 memory model to use!) If you have the Gnu C compiler, you might wish to use
3471 rp="Use which C compiler?"
3479 rp="Use which C compiler?"
3483 : Look for a hint-file generated 'call-back-unit'. Now that the
3484 : user has specified the compiler, we may need to set or change some
3486 if $test -f cc.cbu; then
3490 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3491 $cat >gccvers.c <<EOM
3496 printf("%s\n", __VERSION__);
3498 printf("%s\n", "1");
3504 if $cc -o gccvers gccvers.c >/dev/null 2>&1; then
3505 gccversion=`./gccvers`
3506 case "$gccversion" in
3507 '') echo "You are not using GNU cc." ;;
3508 *) echo "You are using GNU cc $gccversion." ;;
3512 echo "*** WHOA THERE!!! ***" >&4
3513 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
3514 case "$knowitall" in
3516 echo " You'd better start hunting for one and let me know about it." >&4
3522 case "$gccversion" in
3523 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3526 : What should the include directory be ?
3528 $echo $n "Hmm... $c"
3532 if $test -f /bin/mips && /bin/mips; then
3533 echo "Looks like a MIPS system..."
3534 $cat >usr.c <<'EOCP'
3535 #ifdef SYSTYPE_BSD43
3539 if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3540 dflt='/bsd43/usr/include'
3544 mips_type='System V'
3546 $rm -f usr.c usr.out
3547 echo "and you're compiling with the $mips_type compiler and libraries."
3551 echo "Doesn't look like a MIPS system."
3561 case "$xxx_prompt" in
3564 rp='Where are the include files you want to use?'
3572 : see how we invoke the C preprocessor
3574 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3575 cat <<'EOT' >testcpp.c
3581 if test ! -f cppstdin; then
3582 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3584 echo "Keeping your $hint cppstdin wrapper."
3587 wrapper=`pwd`/cppstdin
3591 if $test "X$cppstdin" != "X" && \
3592 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3593 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3595 echo "You used to use $cppstdin $cppminus so we'll use that again."
3597 '') echo "But let's see if we can live without a wrapper..." ;;
3599 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3600 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3602 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3605 echo "(However, $cpprun $cpplast does not work, let's see...)"
3613 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3620 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3621 $cc -E <testcpp.c >testcpp.out 2>&1; \
3622 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3623 echo "Yup, it does."
3626 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3627 $cc -E - <testcpp.c >testcpp.out 2>&1; \
3628 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3629 echo "Yup, it does."
3632 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3633 $cc -P <testcpp.c >testcpp.out 2>&1; \
3634 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3635 echo "Yipee, that works!"
3638 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3639 $cc -P - <testcpp.c >testcpp.out 2>&1; \
3640 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3641 echo "At long last!"
3644 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3645 $cpp <testcpp.c >testcpp.out 2>&1; \
3646 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3650 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3651 $cpp - <testcpp.c >testcpp.out 2>&1; \
3652 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3653 echo "Hooray, it works! I was beginning to wonder."
3656 elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
3657 $wrapper <testcpp.c >testcpp.out 2>&1; \
3658 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3664 rp="No dice. I can't find a C preprocessor. Name one:"
3668 $x_cpp <testcpp.c >testcpp.out 2>&1
3669 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3670 echo "OK, that will do." >&4
3672 echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
3687 echo "Perhaps can we force $cc -E using a wrapper..."
3688 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3689 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3695 echo "Nope, we'll have to live without it..."
3710 *) $rm -f $wrapper;;
3712 $rm -f testcpp.c testcpp.out
3714 : Set private lib path
3717 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3722 '') dlist="$loclibpth $plibpth $glibpth";;
3723 *) dlist="$libpth";;
3726 : Now check and see which directories actually exist, avoiding duplicates
3730 if $test -d $xxx; then
3733 *) libpth="$libpth $xxx";;
3739 Some systems have incompatible or broken versions of libraries. Among
3740 the directories listed in the question below, please remove any you
3741 know not to be holding relevant libraries, and add any that are needed.
3742 Say "none" for none.
3753 rp="Directories to use for library searches?"
3760 : compute shared library extension
3763 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3773 On some systems, shared libraries may be available. Answer 'none' if
3774 you want to suppress searching of shared libraries for the remaining
3775 of this configuration.
3778 rp='What is the file extension used for shared libraries?'
3782 : Define several unixisms.
3783 : Hints files or command line option can be used to override them.
3784 : The convoluted testing is in case hints files set either the old
3787 '') case "$exe_ext" in
3789 *) _exe="$exe_ext" ;;
3794 '') case "$lib_ext" in
3801 '') case "$obj_ext" in
3808 '') case "$path_sep" in
3819 : Which makefile gets called first. This is used by make depend.
3820 case "$firstmakefile" in
3821 '') firstmakefile='makefile';;
3824 : Looking for optional libraries
3826 echo "Checking for optional libraries..." >&4
3831 case "$libswanted" in
3832 '') libswanted='c_s';;
3834 for thislib in $libswanted; do
3836 if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`;
3837 $test -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3838 echo "Found -l$thislib (shared)."
3841 *) dflt="$dflt -l$thislib";;
3843 elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
3844 echo "Found -l$thislib (shared)."
3847 *) dflt="$dflt -l$thislib";;
3849 elif xxx=`./loc lib$thislib$_a X $libpth`; $test -f "$xxx"; then
3850 echo "Found -l$thislib."
3853 *) dflt="$dflt -l$thislib";;
3855 elif xxx=`./loc $thislib$_a X $libpth`; $test -f "$xxx"; then
3856 echo "Found -l$thislib."
3859 *) dflt="$dflt -l$thislib";;
3861 elif xxx=`./loc lib${thislib}_s$_a X $libpth`; $test -f "$xxx"; then
3862 echo "Found -l${thislib}_s."
3865 *) dflt="$dflt -l${thislib}_s";;
3867 elif xxx=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$xxx"; then
3868 echo "Found -l$thislib."
3871 *) dflt="$dflt -l$thislib";;
3874 echo "No -l$thislib."
3885 ' '|'') dflt='none';;
3890 Some versions of Unix support shared libraries, which make executables smaller
3891 but make load time slightly longer.
3893 On some systems, mostly System V Release 3's, the shared library is included
3894 by putting the option "-lc_s" as the last thing on the cc command line when
3895 linking. Other systems use shared libraries by default. There may be other
3896 libraries needed to compile $package on your machine as well. If your system
3897 needs the "-lc_s" option, include it here. Include any other special libraries
3898 here as well. Say "none" for none.
3902 rp="Any additional libraries?"
3909 : determine optimize, if desired, or use for debug flag also
3911 ' '|$undef) dflt='none';;
3913 *) dflt="$optimize";;
3917 Some C compilers have problems with their optimizers. By default, $package
3918 compiles with the -O flag to use the optimizer. Alternately, you might want
3919 to use the symbolic debugger, which uses the -g flag (on traditional Unix
3920 systems). Either flag can be specified here. To use neither flag, specify
3924 rp="What optimizer/debugger flag should be used?"
3928 'none') optimize=" ";;
3932 : We will not override a previous value, but we might want to
3933 : augment a hint file
3936 case "$gccversion" in
3937 1*) dflt='-fpcc-struct-return' ;;
3940 *-g*) dflt="$dflt -DDEBUGGING";;
3942 case "$gccversion" in
3943 2*) if test -d /etc/conf/kconfig.d &&
3944 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3953 case "$mips_type" in
3954 *BSD*|'') inclwanted="$locincpth $usrinc";;
3955 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3957 for thisincl in $inclwanted; do
3958 if $test -d $thisincl; then
3959 if $test x$thisincl != x$usrinc; then
3962 *) dflt="$dflt -I$thisincl";;
3968 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3970 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3978 *) dflt="$dflt -D$2";;
3983 set signal.h __LANGUAGE_C__; eval $inctest
3985 set signal.h LANGUAGE_C; eval $inctest
3989 none|recommended) dflt="$ccflags $dflt" ;;
3990 *) dflt="$ccflags";;
3998 Your C compiler may want other flags. For this question you should include
3999 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4000 but you should NOT include libraries or ld flags like -lwhatever. If you
4001 want $package to honor its debug switch, you should include -DDEBUGGING here.
4002 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4004 To use no flags, specify the word "none".
4010 rp="Any additional cc flags?"
4017 : the following weeds options from ccflags that are of no interest to cpp
4019 case "$gccversion" in
4020 1*) cppflags="$cppflags -D__GNUC__"
4022 case "$mips_type" in
4024 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4030 echo "Let me guess what the preprocessor flags are..." >&4
4044 *) ftry="$previous $flag";;
4046 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4047 >cpp1.out 2>/dev/null && \
4048 $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4049 >cpp2.out 2>/dev/null && \
4050 $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4051 $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4053 cppflags="$cppflags $ftry"
4063 *-*) echo "They appear to be: $cppflags";;
4065 $rm -f cpp.c cpp?.out
4069 : flags used in final linking phase
4071 '') if ./venix; then
4077 *-posix*) dflt="$dflt -posix" ;;
4080 *) dflt="$ldflags";;
4083 : Try to guess additional flags to pick up local libraries.
4084 for thislibdir in $libpth; do
4085 case " $loclibpth " in
4088 *"-L$thislibdir "*) ;;
4089 *) dflt="$dflt -L$thislibdir" ;;
4101 Your C linker may need flags. For this question you should
4102 include -L/whatever and any other flags used by the C linker, but you
4103 should NOT include libraries like -lwhatever.
4105 Make sure you include the appropriate -L/path flags if your C linker
4106 does not normally search all of the directories you specified above,
4109 To use no flags, specify the word "none".
4113 rp="Any additional ld flags (NOT including libraries)?"
4119 rmlist="$rmlist pdp11"
4123 echo "Checking your choice of C compiler and flags for coherency..." >&4
4124 $cat > try.c <<'EOF'
4126 main() { printf("Ok\n"); exit(0); }
4128 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4130 $cat >try.msg <<'EOM'
4131 I've tried to compile and run the following simple program:
4136 $cat >> try.msg <<EOM
4143 and I got the following output:
4147 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4148 if sh -c './try' >>try.msg 2>&1; then
4152 *) echo 'The program compiled OK, but produced no output.' >> try.msg
4155 cat >> try.msg <<'EOQS'
4156 If $libs contains -lsfio, and sfio is mis-configured, then it
4157 sometimes (apparently) runs and exits with a 0 status, but with no
4158 output! It may have to do with sfio's use of _exit vs. exit.
4161 rp="You have a big problem. Shall I abort Configure"
4168 echo "The program compiled OK, but exited with status $?." >>try.msg
4169 rp="You have a problem. Shall I abort Configure"
4173 echo "I can't compile the test program." >>try.msg
4174 rp="You have a BIG problem. Shall I abort Configure"
4180 case "$knowitall" in
4182 echo "(The supplied flags or libraries might be incorrect.)"
4190 *) echo "Ok. Stopping Configure." >&4
4195 n) echo "OK, that should do.";;
4197 $rm -f try try.* core
4199 : determine filename position in cpp output
4201 echo "Computing filename position in cpp output for #include directives..." >&4
4202 echo '#include <stdio.h>' > foo.c
4205 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4206 $grep '^[ ]*#.*stdio\.h' | \
4207 while read cline; do
4210 while $test \$# -gt 0; do
4211 if $test -r \`echo \$1 | $tr -d '"'\`; then
4216 pos=\`expr \$pos + 1\`
4228 *) pos="${fieldn}th";;
4230 echo "Your cpp writes the filename in the $pos field of the line."
4232 : locate header file
4237 if test -f $usrinc/\$wanted; then
4238 echo "$usrinc/\$wanted"
4241 awkprg='{ print \$$fieldn }'
4242 echo "#include <\$wanted>" > foo\$\$.c
4243 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4244 $grep "^[ ]*#.*\$wanted" | \
4245 while read cline; do
4246 name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4248 */\$wanted) echo "\$name"; exit 0;;
4259 : define an alternate in-header-list? function
4260 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4261 cont=true; xxf="echo \"<\$1> found.\" >&4";
4262 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4263 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4265 case $# in 4) instead=instead;; *) instead="at last";; esac;
4266 while $test "$cont"; do
4268 var=$2; eval "was=\$$2";
4269 if $test "$xxx" && $test -r "$xxx";
4271 eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4274 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4275 set $yyy; shift; shift; yyy=$@;
4276 case $# in 0) cont="";;
4277 2) xxf="echo \"but I found <\$1> $instead.\" >&4";
4278 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
4279 *) xxf="echo \"but I found <\$1\> instead.\" >&4";
4280 xxnf="echo \"there is no <\$1>, ...\" >&4";;
4284 do set $yyy; var=$2; eval "was=\$$2";
4285 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
4286 set $yyy; shift; shift; yyy=$@;
4289 : see if this is a malloc.h system
4290 set malloc.h i_malloc
4293 : see if stdlib is available
4294 set stdlib.h i_stdlib
4297 : determine which malloc to compile in
4299 case "$usemymalloc" in
4300 ''|[yY]*|true|$define) dflt='y' ;;
4303 rp="Do you wish to attempt to use the malloc that comes with $package?"
4309 mallocsrc='malloc.c'
4310 mallocobj="malloc$_o"
4311 d_mymalloc="$define"
4314 : Remove malloc from list of libraries to use
4315 echo "Removing unneeded -lmalloc from library list" >&4
4316 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
4319 echo "libs = $libs" >&4
4331 : compute the return types of malloc and free
4333 $cat >malloc.c <<END
4337 #include <sys/types.h>
4351 case "$malloctype" in
4353 if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
4360 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
4364 if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
4371 echo "Your system uses $freetype free(), it would seem." >&4
4373 : Cruising for prototypes
4375 echo "Checking out function prototypes..." >&4
4376 $cat >prototype.c <<'EOCP'
4377 main(int argc, char *argv[]) {
4380 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
4381 echo "Your C compiler appears to support function prototypes."
4384 echo "Your C compiler doesn't seem to understand function prototypes."
4391 case "$prototype" in
4393 *) ansi2knr='ansi2knr'
4398 This version of $package can only be compiled by a compiler that
4399 understands function prototypes. Unfortunately, your C compiler
4401 doesn't seem to understand them. Sorry about that.
4403 If GNU cc is available for your system, perhaps you could try that instead.
4405 Eventually, we hope to support building Perl with pre-ANSI compilers.
4406 If you would like to help in that effort, please contact <perlbug@perl.org>.
4408 Aborting Configure now.
4414 : determine where public executables go
4419 rp='Pathname where the public executables will reside?'
4421 if $test "X$ansexp" != "X$binexp"; then
4429 Since you are running AFS, I need to distinguish the directory in which
4430 executables reside from the directory in which they are installed (and from
4431 which they are presumably copied to the former directory by occult means).
4434 case "$installbin" in
4435 '') dflt=`echo $binexp | sed 's#^/afs/#/afs/.#'`;;
4436 *) dflt="$installbin";;
4439 rp='Where will public executables be installed?'
4443 installbin="$binexp"
4446 : define a shorthand compile call
4450 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4451 : define a shorthand compile call for compilations that should be ok.
4455 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4458 echo "Checking for GNU C Library..." >&4
4459 cat >gnulibc.c <<EOM
4472 if eval $compile_ok && ./gnulibc; then
4474 echo "You are using the GNU C Library"
4477 echo "You are not using the GNU C Library"
4483 : see if nm is to be used to determine whether a symbol is defined or not
4487 case "$d_gnulibc" in
4490 echo "nm probably won't work on the GNU C Library." >&4
4496 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
4498 echo "Whoops! This is an AIX system without /lib/syscalls.exp!" >&4
4499 echo "'nm' won't be sufficient on this sytem." >&4
4505 '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
4506 if $test $dflt -gt 20; then
4516 true|$define) dflt=y;;
4523 I can use $nm to extract the symbols from your C libraries. This
4524 is a time consuming task which may generate huge output on the disk (up
4525 to 3 megabytes) but that should make the symbols extraction faster. The
4526 alternative is to skip the 'nm' extraction part and to compile a small
4527 test program instead to determine whether each symbol is present. If
4528 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
4529 this may be the best solution.
4531 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
4534 rp="Shall I use $nm to extract C symbols from the libraries?"
4537 [Nn]*) usenm=false;;
4546 : nm options which may be necessary
4548 '') if $test -f /mach_boot; then
4550 elif $test -d /usr/ccs/lib; then
4551 nm_opt='-p' # Solaris (and SunOS?)
4552 elif $test -f /dgux; then
4554 elif $test -f /lib64/rld; then
4555 nm_opt='-p' # 64-bit Irix
4561 : nm options which may be necessary for shared libraries but illegal
4562 : for archive libraries. Thank you, Linux.
4563 case "$nm_so_opt" in
4564 '') case "$myuname" in
4566 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
4567 nm_so_opt='--dynamic'
4576 : get list of predefined functions in a handy place
4581 *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
4588 *) for thislib in $libs; do
4591 : Handle C library specially below.
4594 thislib=`echo $thislib | $sed -e 's/^-l//'`
4595 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
4597 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
4599 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
4601 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
4603 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
4605 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
4607 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
4612 libnames="$libnames $try"
4614 *) libnames="$libnames $thislib" ;;
4623 for xxx in $libpth; do
4624 $test -r $1 || set $xxx/libc.$so
4625 : The messy sed command sorts on library version numbers.
4627 set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
4628 tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
4630 s/[0-9][0-9]*/0000&/g
4631 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
4634 sort | $sed -e 's/^.* //'`
4637 $test -r $1 || set /usr/ccs/lib/libc.$so
4638 $test -r $1 || set /lib/libsys_s$_a
4644 if $test -r "$1"; then
4645 echo "Your (shared) C library seems to be in $1."
4647 elif $test -r /lib/libc && $test -r /lib/clib; then
4648 echo "Your C library seems to be in both /lib/clib and /lib/libc."
4650 libc='/lib/clib /lib/libc'
4651 if $test -r /lib/syslib; then
4652 echo "(Your math library is in /lib/syslib.)"
4653 libc="$libc /lib/syslib"
4655 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4656 echo "Your C library seems to be in $libc, as you said before."
4657 elif $test -r $incpath/usr/lib/libc$_a; then
4658 libc=$incpath/usr/lib/libc$_a;
4659 echo "Your C library seems to be in $libc. That's fine."
4660 elif $test -r /lib/libc$_a; then
4662 echo "Your C library seems to be in $libc. You're normal."
4664 if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
4666 elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
4667 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
4668 elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
4670 elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4672 elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4675 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
4677 if $test -r "$tans"; then
4678 echo "Your C library seems to be in $tans, of all places."
4684 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4688 If the guess above is wrong (which it might be if you're using a strange
4689 compiler, or your machine supports multiple models), you can override it here.
4694 echo $libpth | tr ' ' $trnl | sort | uniq > libpath
4696 I can't seem to find your C library. I've looked in the following places:
4699 $sed 's/^/ /' libpath
4702 None of these seems to contain your C library. I need to get its name...
4707 rp='Where is your C library?'
4712 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
4713 set X `cat libnames`
4716 case $# in 1) xxx=file; esac
4717 echo "Extracting names from the following $xxx for later perusal:" >&4
4719 $sed 's/^/ /' libnames >&4
4721 $echo $n "This may take a while...$c" >&4
4725 *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
4726 *) $nm $nm_opt $file 2>/dev/null;;
4731 $grep fprintf libc.tmp > libc.ptf
4732 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
4733 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
4735 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *_[_.]*//p' -e 's/^.* $xxx *//p'";\
4737 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4739 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
4741 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4743 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
4745 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4747 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
4749 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4751 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
4753 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4755 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
4757 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4759 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
4760 -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
4762 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4764 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
4766 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4768 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
4770 $contains '^fprintf$' libc.list >/dev/null 2>&1; then