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 Wed Oct 14 17:00:29 EET DST 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=''
643 ignore_versioned_solibs=''
704 pthread_setdetachstate_pointer=''
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 powerux | power_ux | powermax_os | powermaxos | \
2118 powerunix | power_unix) osname=powerux
2121 next*) osname=next ;;
2122 solaris) osname=solaris
2124 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2131 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2135 titanos) osname=titanos
2144 ultrix) osname=ultrix
2147 osf1|mls+) case "$5" in
2150 osvers=`echo "$3" | sed 's/^[xvt]//'`
2152 hp*) osname=hp_osf1 ;;
2153 mips) osname=mips_osf1 ;;
2162 $2) case "$osname" in
2166 : svr4.x or possibly later
2176 if test -f /stand/boot ; then
2177 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2178 if test -n "$INITPROG" -a -f "$INITPROG"; then
2179 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2180 if test -n "$isesix"; then
2188 *) if test -f /etc/systemid; then
2190 set `echo $3 | $sed 's/\./ /g'` $4
2191 if $test -f $src/hints/sco_$1_$2_$3.sh; then
2193 elif $test -f $src/hints/sco_$1_$2.sh; then
2195 elif $test -f $src/hints/sco_$1.sh; then
2200 '') : Still unknown. Probably a generic Sys V.
2209 *) case "$osname" in
2210 '') : Still unknown. Probably a generic BSD.
2218 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2219 (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2220 if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2223 $rm -f UU/kernel.what
2224 elif test -d c:/.; then
2231 : Now look for a hint file osname_osvers, unless one has been
2232 : specified already.
2235 file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'`
2236 : Also try without trailing minor version numbers.
2237 xfile=`echo $file | $sed -e 's@_[^_]*$@@'`
2238 xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'`
2239 xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'`
2240 xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'`
2243 *) case "$osvers" in
2246 *) if $test -f $src/hints/$file.sh ; then
2248 elif $test -f $src/hints/$xfile.sh ; then
2250 elif $test -f $src/hints/$xxfile.sh ; then
2252 elif $test -f $src/hints/$xxxfile.sh ; then
2254 elif $test -f $src/hints/$xxxxfile.sh ; then
2256 elif $test -f "$src/hints/${osname}.sh" ; then
2265 if $test -f Policy.sh ; then
2268 none) dflt="Policy" ;;
2269 *) dflt="Policy $dflt" ;;
2274 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2278 if $test -f Policy.sh ; then
2281 There's also a Policy hint file available, which should make the
2282 site-specific (policy) questions easier to answer.
2289 You may give one or more space-separated answers, or "none" if appropriate.
2290 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2291 is a good thing. DO NOT give a wrong version.
2295 rp="Which of these apply, if any?"
2298 for file in $tans; do
2299 if $test X$file = XPolicy -a -f Policy.sh; then
2301 $cat Policy.sh >> UU/config.sh
2302 elif $test -f $src/hints/$file.sh; then
2303 . $src/hints/$file.sh
2304 $cat $src/hints/$file.sh >> UU/config.sh
2305 elif $test X$tans = X -o X$tans = Xnone ; then
2308 : Give one chance to correct a possible typo.
2309 echo "$file.sh does not exist"
2311 rp="hint to use instead?"
2313 for file in $ans; do
2314 if $test -f "$src/hints/$file.sh"; then
2315 . $src/hints/$file.sh
2316 $cat $src/hints/$file.sh >> UU/config.sh
2317 elif $test X$ans = X -o X$ans = Xnone ; then
2320 echo "$file.sh does not exist -- ignored."
2327 : Remember our hint file for later.
2328 if $test -f "$src/hints/$file.sh" ; then
2338 echo "Fetching default answers from $config_sh..." >&4
2342 cp $config_sh config.sh 2>/dev/null
2352 test "$override" && . ./optdef.sh
2353 myuname="$newmyuname"
2355 : Restore computed paths
2356 for file in $loclist $trylist; do
2357 eval $file="\$_$file"
2362 Configure uses the operating system name and version to set some defaults.
2363 The default value is probably right if the name rings a bell. Otherwise,
2364 since spelling matters for me, either accept the default or answer "none"
2371 ''|' '|none) dflt=none ;;
2372 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2375 *) dflt="$osname" ;;
2377 rp="Operating system name?"
2381 *) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2387 ''|' '|none) dflt=none ;;
2388 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2389 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2391 ''|' ') dflt=none ;;
2396 *) dflt="$osvers" ;;
2398 rp="Operating system version?"
2405 : who configured the system
2406 cf_time=`LC_ALL=C; export LC_ALL; $date 2>&1`
2407 cf_by=`(logname) 2>/dev/null`
2410 cf_by=`(whoami) 2>/dev/null`
2412 "") cf_by=unknown ;;
2416 : set up the script used to warn in case of inconsistency
2423 echo "*** WHOA THERE!!! ***" >&4
2424 echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
2425 rp=" Keep the $hint value?"
2428 y) td=$was; tu=$was;;
2432 : function used to set $1 to $val
2433 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2435 $define$undef) . ./whoa; eval "$var=\$td";;
2436 $undef$define) . ./whoa; eval "$var=\$tu";;
2437 *) eval "$var=$val";;
2442 Perl can be built to take advantage of threads, on some systems.
2443 To do so, Configure must be run with -Dusethreads.
2444 (See README.threads for details.)
2446 case "$usethreads" in
2447 $define|true|[yY]*) dflt='y';;
2450 rp='Build a threading Perl?'
2453 y|Y) val="$define" ;;
2458 : Look for a hint-file generated 'call-back-unit'. Now that the
2459 : user has specified if a threading perl is to be built, we may need
2460 : to set or change some other defaults.
2461 if $test -f usethreads.cbu; then
2464 case "$d_oldpthreads" in
2465 '') : Configure tests would be welcome here. For now, assume undef.
2467 *) val="$d_oldpthreads" ;;
2474 Perl can be built so that multiple Perl interpreters can coexist
2475 within the same Perl executable. To do so, Configure must be run with
2478 Normally you do not need this and you should answer no.
2481 case "$usemultiplicity" in
2482 $define|true|[yY]*) dflt='y';;
2485 rp='Build Perl for multiplicity?'
2488 y|Y) val="$define" ;;
2496 Perl can be built to take advantage of explicit 64-bit interfaces,
2497 on some systems. To do so, Configure must be run with -Duse64bits.
2499 If this doesn't make any sense to you, just accept the default 'n'.
2501 case "$use64bits" in
2502 $define|true|[yY]*) dflt='y';;
2505 rp='Try to use explicit 64-bit interfaces, if available?'
2520 : determine the architecture name
2522 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
2523 tarch=`arch`"-$osname"
2524 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
2525 if uname -m > tmparch 2>&1 ; then
2526 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
2527 -e 's/$/'"-$osname/" tmparch`
2535 case "$myarchname" in
2538 echo "(Your architecture name used to be $myarchname.)"
2545 *) dflt="$archname";;
2547 rp='What is your architecture name'
2550 case "$usethreads" in
2552 echo "Threads selected." >&4
2554 *-thread*) echo "...and architecture name already has -thread." >&4
2556 *) archname="$archname-thread"
2557 echo "...setting architecture name to $archname." >&4
2562 case "$usemultiplicity" in
2564 echo "Multiplicity selected." >&4
2566 *-multi*) echo "...and architecture name already has -multi." >&4
2568 *) archname="$archname-multi"
2569 echo "...setting architecture name to $archname." >&4
2574 case "$use64bits" in
2576 echo "Explicit 64-bitness selected." >&4
2577 case "$archname64" in
2582 *-$archname64*) echo "...and architecture name already has $archname64." >&4
2584 *) archname="$archname-$archname64"
2585 echo "...setting architecture name to $archname." >&4
2595 $define|true) afs=true ;;
2596 $undef|false) afs=false ;;
2597 *) if test -d /afs; then
2605 echo "AFS may be running... I'll be extra cautious then..." >&4
2607 echo "AFS does not seem to be running..." >&4
2610 : decide how portable to be. Allow command line overrides.
2611 case "$d_portable" in
2613 *) d_portable="$define" ;;
2616 : set up shell script to do ~ expansion
2622 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
2625 if $test -f /bin/csh; then
2626 /bin/csh -f -c "glob \$1"
2631 name=\`$expr x\$1 : '..\([^/]*\)'\`
2632 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
2633 if $test ! -d "\$dir"; then
2635 echo "\$me: can't locate home directory for: \$name" >&2
2640 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
2656 : now set up to get a file name
2660 cat <<'EOSC' >>getfile
2673 expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
2674 fn=`echo $fn | sed 's/(.*)//'`
2680 loc_file=`expr $fn : '.*:\(.*\)'`
2681 fn=`expr $fn : '\(.*\):.*'`
2689 */*) fullpath=true;;
2698 *e*) exp_file=true;;
2701 *p*) nopath_ok=true;;
2706 *d*) type='Directory';;
2707 *l*) type='Locate';;
2712 Locate) what='File';;
2717 case "$d_portable" in
2725 while test "$type"; do
2730 true) rp="$rp (~name ok)";;
2733 if test -f UU/getfile.ok && \
2734 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
2753 value=`UU/filexp $ans`
2756 if test "$ans" != "$value"; then
2757 echo "(That expands to $value on this system.)"
2771 /*) value="$ansexp" ;;
2776 echo "I shall only accept a full path name, as in /bin/ls." >&4
2777 echo "Use a ! shell escape if you wish to check pathnames." >&4
2780 echo "Please give a full path name, starting with slash." >&4
2783 echo "Note that using ~name is ok provided it expands well." >&4
2796 if test -f "$ansexp"; then
2798 elif test -r "$ansexp" || (test -h "$ansexp") >/dev/null 2>&1
2800 echo "($value is not a plain file, but that's ok.)"
2805 if test -d "$ansexp"; then
2810 if test -d "$ansexp"; then
2811 echo "(Looking for $loc_file in directory $value.)"
2812 value="$value/$loc_file"
2813 ansexp="$ansexp/$loc_file"
2815 if test -f "$ansexp"; then
2818 case "$nopath_ok" in
2819 true) case "$value" in
2821 *) echo "Assuming $value will be in people's path."
2837 if test "$fastread" = yes; then
2842 rp="$what $value doesn't exist. Use that name anyway?"
2863 : determine root of directory hierarchy where package will be installed.
2866 dflt=`./loc . /usr/local /usr/local /local /opt /usr`
2874 By default, $package will be installed in $dflt/bin, manual
2875 pages under $dflt/man, etc..., i.e. with $dflt as prefix for
2876 all installation directories. Typically set to /usr/local, but you
2877 may choose /usr if you wish to install $package among your system
2878 binaries. If you wish to have binaries under /bin but manual pages
2879 under /usr/local/man, that's ok: you will be prompted separately
2880 for each of the installation directories, the prefix being only used
2881 to set the defaults.
2885 rp='Installation prefix to use?'
2893 *) oldprefix="$prefix";;
2900 : set the prefixit variable, to compute a suitable default value
2901 prefixit='case "$3" in
2903 case "$oldprefix" in
2904 "") eval "$1=\"\$$2\"";;
2911 ""|" ") eval "$1=\"\$$2\"";;
2917 eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
2919 --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
2920 /*-$oldprefix/*|\~*-$oldprefix/*)
2921 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
2922 *) eval "$1=\"\$$2\"";;
2926 : set the base revision
2929 : get the patchlevel
2931 echo "Getting the current patchlevel..." >&4
2932 if $test -r $rsrc/patchlevel.h;then
2933 patchlevel=`awk '/define[ ]+PATCHLEVEL/ {print $3}' $rsrc/patchlevel.h`
2934 subversion=`awk '/define[ ]+SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
2939 $echo $n "(You have $package" $c
2942 *) $echo $n " $baserev" $c ;;
2944 $echo $n " patchlevel $patchlevel" $c
2945 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
2948 if test 0 -eq "$subversion"; then
2949 version=`LC_ALL=C; export LC_ALL; \
2950 echo $baserev $patchlevel | \
2951 $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
2953 version=`LC_ALL=C; export LC_ALL; \
2954 echo $baserev $patchlevel $subversion | \
2955 $awk '{ printf "%.5f\n", $1 + $2/1000.0 + $3/100000.0 }'`
2957 : Figure out perl API version. Perhaps this should be in patchlevel.h
2958 if test "$subversion" -lt 50; then
2959 apiversion=`LC_ALL=C; export LC_ALL; \
2960 echo $baserev $patchlevel | \
2961 $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
2963 apiversion="$version"
2966 : determine where private library files go
2967 : Usual default is /usr/local/lib/perl5/$version.
2968 : Also allow things like /opt/perl/lib/$version, since
2969 : /opt/perl/lib/perl5... would be redundant.
2971 *perl*) set dflt privlib lib/$version ;;
2972 *) set dflt privlib lib/$package/$version ;;
2977 There are some auxiliary files for $package that need to be put into a
2978 private library directory that is accessible by everyone.
2982 rp='Pathname where the private library files will reside?'
2984 if $test "X$privlibexp" != "X$ansexp"; then
2988 privlibexp="$ansexp"
2992 Since you are running AFS, I need to distinguish the directory in which
2993 private files reside from the directory in which they are installed (and from
2994 which they are presumably copied to the former directory by occult means).
2997 case "$installprivlib" in
2998 '') dflt=`echo $privlibexp | sed 's#^/afs/#/afs/.#'`;;
2999 *) dflt="$installprivlib";;
3002 rp='Where will private files be installed?'
3004 installprivlib="$ans"
3006 installprivlib="$privlibexp"
3009 : set the prefixup variable, to restore leading tilda escape
3010 prefixup='case "$prefixexp" in
3012 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
3015 : determine where public architecture dependent libraries go
3018 : privlib default is /usr/local/lib/$package/$version
3019 : archlib default is /usr/local/lib/$package/$version/$archname
3020 : privlib may have an optional trailing /share.
3021 tdflt=`echo $privlib | $sed 's,/share$,,'`
3022 tdflt=$tdflt/$archname
3031 $spackage contains architecture-dependent library files. If you are
3032 sharing libraries in a heterogeneous environment, you might store
3033 these files in a separate location. Otherwise, you can just include
3034 them with the rest of the public library files.
3038 rp='Where do you want to put the public architecture-dependent libraries?'
3041 archlibexp="$ansexp"
3046 Since you are running AFS, I need to distinguish the directory in
3047 which architecture-dependent library files reside from the directory
3048 in which they are installed (and from which they are presumably copied
3049 to the former directory by occult means).
3052 case "$installarchlib" in
3053 '') dflt=`echo $archlibexp | sed 's#^/afs/#/afs/.#'`;;
3054 *) dflt="$installarchlib";;
3057 rp='Where will architecture-dependent library files be installed?'
3059 installarchlib="$ans"
3061 installarchlib="$archlibexp"
3063 if $test X"$archlib" = X"$privlib"; then
3069 : make some quick guesses about what we are up against
3071 $echo $n "Hmm... $c"
3081 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3082 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3084 echo "Looks kind of like an OSF/1 system, but we'll see..."
3086 elif test `echo abc | tr a-z A-Z` = Abc ; then
3087 xxx=`./loc addbib blurfl $pth`
3088 if $test -f $xxx; then
3089 echo "Looks kind of like a USG system with BSD features, but we'll see..."
3093 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3094 echo "Looks kind of like an extended USG system, but we'll see..."
3096 echo "Looks kind of like a USG system, but we'll see..."
3100 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3101 echo "Looks kind of like a BSD system, but we'll see..."
3105 echo "Looks kind of like a Version 7 system, but we'll see..."
3108 case "$eunicefix" in
3111 There is, however, a strange, musty smell in the air that reminds me of
3112 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3116 : it so happens the Eunice I know will not run shell scripts in Unix format
3120 echo "Congratulations. You aren't running Eunice."
3124 : Detect OS2. The p_ variable is set above in the Head.U unit.
3129 I have the feeling something is not exactly right, however...don't tell me...
3130 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3135 if test -f /xenix; then
3136 echo "Actually, this looks more like a XENIX system..."
3141 echo "It's not Xenix..."
3146 if test -f /venix; then
3147 echo "Actually, this looks more like a VENIX system..."
3154 echo "Nor is it Venix..."
3157 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3158 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3161 : see if setuid scripts can be secure
3164 Some kernels have a bug that prevents setuid #! scripts from being
3165 secure. Some sites have disabled setuid #! scripts because of this.
3167 First let's decide if your kernel supports secure setuid #! scripts.
3168 (If setuid #! scripts would be secure but have been disabled anyway,
3169 don't say that they are secure if asked.)
3174 if $test -d /dev/fd; then
3175 echo "#!$ls" >reflect
3176 chmod +x,u+s reflect
3177 ./reflect >flect 2>&1
3178 if $contains "/dev/fd" flect >/dev/null; then
3179 echo "Congratulations, your kernel has secure setuid scripts!" >&4
3183 If you are not sure if they are secure, I can check but I'll need a
3184 username and password different from the one you are using right now.
3185 If you don't have such a username or don't want me to test, simply
3189 rp='Other username to test security of setuid scripts with?'
3194 case "$d_suidsafe" in
3195 '') echo "I'll assume setuid scripts are *not* secure." >&4
3198 echo "Well, the $hint value is *not* secure." >&4
3200 *) echo "Well, the $hint value *is* secure." >&4
3205 $rm -f reflect flect
3206 echo "#!$ls" >reflect
3207 chmod +x,u+s reflect
3210 echo '"su" will (probably) prompt you for '"$ans's password."
3211 su $ans -c './reflect >flect'
3212 if $contains "/dev/fd" flect >/dev/null; then
3213 echo "Okay, it looks like setuid scripts are secure." >&4
3216 echo "I don't think setuid scripts are secure." >&4
3221 rp='Does your kernel have *secure* setuid scripts?'
3224 [yY]*) val="$define";;
3229 echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
3230 echo "(That's for file descriptors, not floppy disks.)"
3236 $rm -f reflect flect
3238 : now see if they want to do setuid emulation
3241 case "$d_suidsafe" in
3244 echo "No need to emulate SUID scripts since they are secure here." >& 4
3248 Some systems have disabled setuid scripts, especially systems where
3249 setuid scripts cannot be secure. On systems where setuid scripts have
3250 been disabled, the setuid/setgid bits on scripts are currently
3251 useless. It is possible for $package to detect those bits and emulate
3252 setuid/setgid in a secure fashion. This emulation will only work if
3253 setuid scripts have been disabled in your kernel.
3257 "$define") dflt=y ;;
3260 rp="Do you want to do setuid/setgid emulation?"
3263 [yY]*) val="$define";;
3271 : determine where manual pages are on this system
3275 syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
3276 syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
3277 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
3278 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
3279 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
3280 sysman=`./loc . /usr/man/man1 $syspath`
3283 if $test -d "$sysman"; then
3284 echo "System manual is in $sysman." >&4
3286 echo "Could not find manual pages in source form." >&4
3289 : see what memory models we can support
3292 $cat >pdp11.c <<'EOP'
3301 ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
3302 if $test -f pdp11 && ./pdp11 2>/dev/null; then
3303 dflt='unsplit split'
3305 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
3308 *) if $test -d /lib/small || $test -d /usr/lib/small; then
3313 if $test -d /lib/medium || $test -d /usr/lib/medium; then
3316 if $test -d /lib/large || $test -d /usr/lib/large; then
3319 if $test -d /lib/huge || $test -d /usr/lib/huge; then
3328 Some systems have different model sizes. On most systems they are called
3329 small, medium, large, and huge. On the PDP11 they are called unsplit and
3330 split. If your system doesn't support different memory models, say "none".
3331 If you wish to force everything to one memory model, say "none" here and
3332 put the appropriate flags later when it asks you for other cc and ld flags.
3333 Venix systems may wish to put "none" and let the compiler figure things out.
3334 (In the following question multiple model names should be space separated.)
3336 The default for most systems is "none".
3339 rp="Which memory models are supported?"
3354 '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
3355 $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
3362 rp="What flag indicates separate I and D space?"
3370 *large*|*small*|*medium*|*huge*)
3377 rp="What flag indicates large model?"
3387 *huge*) case "$huge" in
3391 rp="What flag indicates huge model?"
3401 *medium*) case "$medium" in
3405 rp="What flag indicates medium model?"
3412 *) medium="$large";;
3415 *small*) case "$small" in
3419 rp="What flag indicates small model?"
3430 echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
3433 $rm -f pdp11.* pdp11
3435 : see if we need a special compiler
3443 *) if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
3444 if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
3458 On some older systems the default C compiler will not resolve multiple global
3459 references that happen to have the same name. On some such systems the "Mcc"
3460 command may be used to force these to be resolved. On other systems a "cc -M"
3461 command is required. (Note that the -M flag on other systems indicates a
3462 memory model to use!) If you have the Gnu C compiler, you might wish to use
3468 rp="Use which C compiler?"
3476 rp="Use which C compiler?"
3480 : Look for a hint-file generated 'call-back-unit'. Now that the
3481 : user has specified the compiler, we may need to set or change some
3483 if $test -f cc.cbu; then
3487 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3488 $cat >gccvers.c <<EOM
3493 printf("%s\n", __VERSION__);
3495 printf("%s\n", "1");
3501 if $cc -o gccvers gccvers.c >/dev/null 2>&1; then
3502 gccversion=`./gccvers`
3503 case "$gccversion" in
3504 '') echo "You are not using GNU cc." ;;
3505 *) echo "You are using GNU cc $gccversion." ;;
3509 echo "*** WHOA THERE!!! ***" >&4
3510 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
3511 case "$knowitall" in
3513 echo " You'd better start hunting for one and let me know about it." >&4
3519 case "$gccversion" in
3520 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3523 : What should the include directory be ?
3525 $echo $n "Hmm... $c"
3529 if $test -f /bin/mips && /bin/mips; then
3530 echo "Looks like a MIPS system..."
3531 $cat >usr.c <<'EOCP'
3532 #ifdef SYSTYPE_BSD43
3536 if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3537 dflt='/bsd43/usr/include'
3541 mips_type='System V'
3543 $rm -f usr.c usr.out
3544 echo "and you're compiling with the $mips_type compiler and libraries."
3548 echo "Doesn't look like a MIPS system."
3558 case "$xxx_prompt" in
3561 rp='Where are the include files you want to use?'
3569 : see how we invoke the C preprocessor
3571 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3572 cat <<'EOT' >testcpp.c
3578 if test ! -f cppstdin; then
3579 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3581 echo "Keeping your $hint cppstdin wrapper."
3584 wrapper=`pwd`/cppstdin
3588 if $test "X$cppstdin" != "X" && \
3589 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3590 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3592 echo "You used to use $cppstdin $cppminus so we'll use that again."
3594 '') echo "But let's see if we can live without a wrapper..." ;;
3596 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3597 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3599 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3602 echo "(However, $cpprun $cpplast does not work, let's see...)"
3610 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3617 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3618 $cc -E <testcpp.c >testcpp.out 2>&1; \
3619 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3620 echo "Yup, it does."
3623 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3624 $cc -E - <testcpp.c >testcpp.out 2>&1; \
3625 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3626 echo "Yup, it does."
3629 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3630 $cc -P <testcpp.c >testcpp.out 2>&1; \
3631 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3632 echo "Yipee, that works!"
3635 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3636 $cc -P - <testcpp.c >testcpp.out 2>&1; \
3637 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3638 echo "At long last!"
3641 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3642 $cpp <testcpp.c >testcpp.out 2>&1; \
3643 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3647 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3648 $cpp - <testcpp.c >testcpp.out 2>&1; \
3649 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3650 echo "Hooray, it works! I was beginning to wonder."
3653 elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
3654 $wrapper <testcpp.c >testcpp.out 2>&1; \
3655 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3661 rp="No dice. I can't find a C preprocessor. Name one:"
3665 $x_cpp <testcpp.c >testcpp.out 2>&1
3666 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3667 echo "OK, that will do." >&4
3669 echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
3684 echo "Perhaps can we force $cc -E using a wrapper..."
3685 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3686 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3692 echo "Nope, we'll have to live without it..."
3707 *) $rm -f $wrapper;;
3709 $rm -f testcpp.c testcpp.out
3711 : Set private lib path
3714 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3719 '') dlist="$loclibpth $plibpth $glibpth";;
3720 *) dlist="$libpth";;
3723 : Now check and see which directories actually exist, avoiding duplicates
3727 if $test -d $xxx; then
3730 *) libpth="$libpth $xxx";;
3736 Some systems have incompatible or broken versions of libraries. Among
3737 the directories listed in the question below, please remove any you
3738 know not to be holding relevant libraries, and add any that are needed.
3739 Say "none" for none.
3750 rp="Directories to use for library searches?"
3757 : compute shared library extension
3760 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3770 On some systems, shared libraries may be available. Answer 'none' if
3771 you want to suppress searching of shared libraries for the remaining
3772 of this configuration.
3775 rp='What is the file extension used for shared libraries?'
3779 : Define several unixisms.
3780 : Hints files or command line option can be used to override them.
3781 : The convoluted testing is in case hints files set either the old
3784 '') case "$exe_ext" in
3786 *) _exe="$exe_ext" ;;
3791 '') case "$lib_ext" in
3798 '') case "$obj_ext" in
3805 '') case "$path_sep" in
3816 : Which makefile gets called first. This is used by make depend.
3817 case "$firstmakefile" in
3818 '') firstmakefile='makefile';;
3821 : Looking for optional libraries
3823 echo "Checking for optional libraries..." >&4
3828 case "$libswanted" in
3829 '') libswanted='c_s';;
3831 for thislib in $libswanted; do
3833 if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`;
3834 $test -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3835 echo "Found -l$thislib (shared)."
3838 *) dflt="$dflt -l$thislib";;
3840 elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
3841 echo "Found -l$thislib (shared)."
3844 *) dflt="$dflt -l$thislib";;
3846 elif xxx=`./loc lib$thislib$_a X $libpth`; $test -f "$xxx"; then
3847 echo "Found -l$thislib."
3850 *) dflt="$dflt -l$thislib";;
3852 elif xxx=`./loc $thislib$_a X $libpth`; $test -f "$xxx"; then
3853 echo "Found -l$thislib."
3856 *) dflt="$dflt -l$thislib";;
3858 elif xxx=`./loc lib${thislib}_s$_a X $libpth`; $test -f "$xxx"; then
3859 echo "Found -l${thislib}_s."
3862 *) dflt="$dflt -l${thislib}_s";;
3864 elif xxx=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$xxx"; then
3865 echo "Found -l$thislib."
3868 *) dflt="$dflt -l$thislib";;
3871 echo "No -l$thislib."
3882 ' '|'') dflt='none';;
3887 Some versions of Unix support shared libraries, which make executables smaller
3888 but make load time slightly longer.
3890 On some systems, mostly System V Release 3's, the shared library is included
3891 by putting the option "-lc_s" as the last thing on the cc command line when
3892 linking. Other systems use shared libraries by default. There may be other
3893 libraries needed to compile $package on your machine as well. If your system
3894 needs the "-lc_s" option, include it here. Include any other special libraries
3895 here as well. Say "none" for none.
3899 rp="Any additional libraries?"
3906 : determine optimize, if desired, or use for debug flag also
3908 ' '|$undef) dflt='none';;
3910 *) dflt="$optimize";;
3914 Some C compilers have problems with their optimizers. By default, $package
3915 compiles with the -O flag to use the optimizer. Alternately, you might want
3916 to use the symbolic debugger, which uses the -g flag (on traditional Unix
3917 systems). Either flag can be specified here. To use neither flag, specify
3921 rp="What optimizer/debugger flag should be used?"
3925 'none') optimize=" ";;
3929 : We will not override a previous value, but we might want to
3930 : augment a hint file
3933 case "$gccversion" in
3934 1*) dflt='-fpcc-struct-return' ;;
3937 *-g*) dflt="$dflt -DDEBUGGING";;
3939 case "$gccversion" in
3940 2*) if test -d /etc/conf/kconfig.d &&
3941 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3950 case "$mips_type" in
3951 *BSD*|'') inclwanted="$locincpth $usrinc";;
3952 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3954 for thisincl in $inclwanted; do
3955 if $test -d $thisincl; then
3956 if $test x$thisincl != x$usrinc; then
3959 *) dflt="$dflt -I$thisincl";;
3965 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3967 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3975 *) dflt="$dflt -D$2";;
3980 set signal.h __LANGUAGE_C__; eval $inctest
3982 set signal.h LANGUAGE_C; eval $inctest
3986 none|recommended) dflt="$ccflags $dflt" ;;
3987 *) dflt="$ccflags";;
3995 Your C compiler may want other flags. For this question you should include
3996 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
3997 but you should NOT include libraries or ld flags like -lwhatever. If you
3998 want $package to honor its debug switch, you should include -DDEBUGGING here.
3999 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4001 To use no flags, specify the word "none".
4007 rp="Any additional cc flags?"
4014 : the following weeds options from ccflags that are of no interest to cpp
4016 case "$gccversion" in
4017 1*) cppflags="$cppflags -D__GNUC__"
4019 case "$mips_type" in
4021 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4027 echo "Let me guess what the preprocessor flags are..." >&4
4041 *) ftry="$previous $flag";;
4043 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4044 >cpp1.out 2>/dev/null && \
4045 $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4046 >cpp2.out 2>/dev/null && \
4047 $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4048 $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4050 cppflags="$cppflags $ftry"
4060 *-*) echo "They appear to be: $cppflags";;
4062 $rm -f cpp.c cpp?.out
4066 : flags used in final linking phase
4068 '') if ./venix; then
4074 *-posix*) dflt="$dflt -posix" ;;
4077 *) dflt="$ldflags";;
4080 : Try to guess additional flags to pick up local libraries.
4081 for thislibdir in $libpth; do
4082 case " $loclibpth " in
4085 *"-L$thislibdir "*) ;;
4086 *) dflt="$dflt -L$thislibdir" ;;
4098 Your C linker may need flags. For this question you should
4099 include -L/whatever and any other flags used by the C linker, but you
4100 should NOT include libraries like -lwhatever.
4102 Make sure you include the appropriate -L/path flags if your C linker
4103 does not normally search all of the directories you specified above,
4106 To use no flags, specify the word "none".
4110 rp="Any additional ld flags (NOT including libraries)?"
4116 rmlist="$rmlist pdp11"
4120 echo "Checking your choice of C compiler and flags for coherency..." >&4
4121 $cat > try.c <<'EOF'
4123 main() { printf("Ok\n"); exit(0); }
4125 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4127 $cat >try.msg <<'EOM'
4128 I've tried to compile and run the following simple program:
4133 $cat >> try.msg <<EOM
4140 and I got the following output:
4144 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4145 if sh -c './try' >>try.msg 2>&1; then
4149 *) echo 'The program compiled OK, but produced no output.' >> try.msg
4152 cat >> try.msg <<'EOQS'
4153 If $libs contains -lsfio, and sfio is mis-configured, then it
4154 sometimes (apparently) runs and exits with a 0 status, but with no
4155 output! It may have to do with sfio's use of _exit vs. exit.
4158 rp="You have a big problem. Shall I abort Configure"
4165 echo "The program compiled OK, but exited with status $?." >>try.msg
4166 rp="You have a problem. Shall I abort Configure"
4170 echo "I can't compile the test program." >>try.msg
4171 rp="You have a BIG problem. Shall I abort Configure"
4177 case "$knowitall" in
4179 echo "(The supplied flags or libraries might be incorrect.)"
4187 *) echo "Ok. Stopping Configure." >&4
4192 n) echo "OK, that should do.";;
4194 $rm -f try try.* core
4196 : determine filename position in cpp output
4198 echo "Computing filename position in cpp output for #include directives..." >&4
4199 echo '#include <stdio.h>' > foo.c
4202 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4203 $grep '^[ ]*#.*stdio\.h' | \
4204 while read cline; do
4207 while $test \$# -gt 0; do
4208 if $test -r \`echo \$1 | $tr -d '"'\`; then
4213 pos=\`expr \$pos + 1\`
4225 *) pos="${fieldn}th";;
4227 echo "Your cpp writes the filename in the $pos field of the line."
4229 : locate header file
4234 if test -f $usrinc/\$wanted; then
4235 echo "$usrinc/\$wanted"
4238 awkprg='{ print \$$fieldn }'
4239 echo "#include <\$wanted>" > foo\$\$.c
4240 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4241 $grep "^[ ]*#.*\$wanted" | \
4242 while read cline; do
4243 name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4245 */\$wanted) echo "\$name"; exit 0;;
4256 : define an alternate in-header-list? function
4257 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4258 cont=true; xxf="echo \"<\$1> found.\" >&4";
4259 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4260 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4262 case $# in 4) instead=instead;; *) instead="at last";; esac;
4263 while $test "$cont"; do
4265 var=$2; eval "was=\$$2";
4266 if $test "$xxx" && $test -r "$xxx";
4268 eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4271 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4272 set $yyy; shift; shift; yyy=$@;
4273 case $# in 0) cont="";;
4274 2) xxf="echo \"but I found <\$1> $instead.\" >&4";
4275 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
4276 *) xxf="echo \"but I found <\$1\> instead.\" >&4";
4277 xxnf="echo \"there is no <\$1>, ...\" >&4";;
4281 do set $yyy; var=$2; eval "was=\$$2";
4282 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
4283 set $yyy; shift; shift; yyy=$@;
4286 : see if this is a malloc.h system
4287 set malloc.h i_malloc
4290 : see if stdlib is available
4291 set stdlib.h i_stdlib
4294 : determine which malloc to compile in
4296 case "$usemymalloc" in
4297 ''|[yY]*|true|$define) dflt='y' ;;
4300 rp="Do you wish to attempt to use the malloc that comes with $package?"
4306 mallocsrc='malloc.c'
4307 mallocobj="malloc$_o"
4308 d_mymalloc="$define"
4311 : Remove malloc from list of libraries to use
4312 echo "Removing unneeded -lmalloc from library list" >&4
4313 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
4316 echo "libs = $libs" >&4
4328 : compute the return types of malloc and free
4330 $cat >malloc.c <<END
4334 #include <sys/types.h>
4348 case "$malloctype" in
4350 if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
4357 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
4361 if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
4368 echo "Your system uses $freetype free(), it would seem." >&4
4370 : Cruising for prototypes
4372 echo "Checking out function prototypes..." >&4
4373 $cat >prototype.c <<'EOCP'
4374 main(int argc, char *argv[]) {
4377 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
4378 echo "Your C compiler appears to support function prototypes."
4381 echo "Your C compiler doesn't seem to understand function prototypes."
4388 case "$prototype" in
4390 *) ansi2knr='ansi2knr'
4395 This version of $package can only be compiled by a compiler that
4396 understands function prototypes. Unfortunately, your C compiler
4398 doesn't seem to understand them. Sorry about that.
4400 If GNU cc is available for your system, perhaps you could try that instead.
4402 Eventually, we hope to support building Perl with pre-ANSI compilers.
4403 If you would like to help in that effort, please contact <perlbug@perl.org>.
4405 Aborting Configure now.
4411 : determine where public executables go
4416 rp='Pathname where the public executables will reside?'
4418 if $test "X$ansexp" != "X$binexp"; then
4426 Since you are running AFS, I need to distinguish the directory in which
4427 executables reside from the directory in which they are installed (and from
4428 which they are presumably copied to the former directory by occult means).
4431 case "$installbin" in
4432 '') dflt=`echo $binexp | sed 's#^/afs/#/afs/.#'`;;
4433 *) dflt="$installbin";;
4436 rp='Where will public executables be installed?'
4440 installbin="$binexp"
4443 : define a shorthand compile call
4447 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4448 : define a shorthand compile call for compilations that should be ok.
4452 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4455 echo "Checking for GNU C Library..." >&4
4456 cat >gnulibc.c <<EOM
4469 if eval $compile_ok && ./gnulibc; then
4471 echo "You are using the GNU C Library"
4474 echo "You are not using the GNU C Library"
4480 : see if nm is to be used to determine whether a symbol is defined or not
4484 case "$d_gnulibc" in
4487 echo "nm probably won't work on the GNU C Library." >&4
4493 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
4495 echo "Whoops! This is an AIX system without /lib/syscalls.exp!" >&4
4496 echo "'nm' won't be sufficient on this sytem." >&4
4502 '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
4503 if $test $dflt -gt 20; then
4513 true|$define) dflt=y;;
4520 I can use $nm to extract the symbols from your C libraries. This
4521 is a time consuming task which may generate huge output on the disk (up
4522 to 3 megabytes) but that should make the symbols extraction faster. The
4523 alternative is to skip the 'nm' extraction part and to compile a small
4524 test program instead to determine whether each symbol is present. If
4525 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
4526 this may be the best solution.
4528 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
4531 rp="Shall I use $nm to extract C symbols from the libraries?"
4534 [Nn]*) usenm=false;;
4543 : nm options which may be necessary
4545 '') if $test -f /mach_boot; then
4547 elif $test -d /usr/ccs/lib; then
4548 nm_opt='-p' # Solaris (and SunOS?)
4549 elif $test -f /dgux; then
4551 elif $test -f /lib64/rld; then
4552 nm_opt='-p' # 64-bit Irix
4558 : nm options which may be necessary for shared libraries but illegal
4559 : for archive libraries. Thank you, Linux.
4560 case "$nm_so_opt" in
4561 '') case "$myuname" in
4563 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
4564 nm_so_opt='--dynamic'
4573 : get list of predefined functions in a handy place
4578 *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
4585 *) for thislib in $libs; do
4588 : Handle C library specially below.
4591 thislib=`echo $thislib | $sed -e 's/^-l//'`
4592 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
4594 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
4596 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
4598 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
4600 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
4602 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
4604 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
4609 libnames="$libnames $try"
4611 *) libnames="$libnames $thislib" ;;
4620 for xxx in $libpth; do
4621 $test -r $1 || set $xxx/libc.$so
4622 : The messy sed command sorts on library version numbers.
4624 set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
4625 tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
4627 s/[0-9][0-9]*/0000&/g
4628 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
4631 sort | $sed -e 's/^.* //'`
4634 $test -r $1 || set /usr/ccs/lib/libc.$so
4635 $test -r $1 || set /lib/libsys_s$_a
4641 if $test -r "$1"; then
4642 echo "Your (shared) C library seems to be in $1."
4644 elif $test -r /lib/libc && $test -r /lib/clib; then
4645 echo "Your C library seems to be in both /lib/clib and /lib/libc."
4647 libc='/lib/clib /lib/libc'
4648 if $test -r /lib/syslib; then
4649 echo "(Your math library is in /lib/syslib.)"
4650 libc="$libc /lib/syslib"
4652 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4653 echo "Your C library seems to be in $libc, as you said before."
4654 elif $test -r $incpath/usr/lib/libc$_a; then
4655 libc=$incpath/usr/lib/libc$_a;
4656 echo "Your C library seems to be in $libc. That's fine."
4657 elif $test -r /lib/libc$_a; then
4659 echo "Your C library seems to be in $libc. You're normal."
4661 if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
4663 elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
4664 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
4665 elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
4667 elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4669 elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4672 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
4674 if $test -r "$tans"; then
4675 echo "Your C library seems to be in $tans, of all places."
4681 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4685 If the guess above is wrong (which it might be if you're using a strange
4686 compiler, or your machine supports multiple models), you can override it here.
4691 echo $libpth | tr ' ' $trnl | sort | uniq > libpath
4693 I can't seem to find your C library. I've looked in the following places:
4696 $sed 's/^/ /' libpath
4699 None of these seems to contain your C library. I need to get its name...
4704 rp='Where is your C library?'
4709 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
4710 set X `cat libnames`
4713 case $# in 1) xxx=file; esac
4714 echo "Extracting names from the following $xxx for later perusal:" >&4
4716 $sed 's/^/ /' libnames >&4
4718 $echo $n "This may take a while...$c" >&4
4722 *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
4723 *) $nm $nm_opt $file 2>/dev/null;;
4728 $grep fprintf libc.tmp > libc.ptf
4729 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
4730 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
4732 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *_[_.]*//p' -e 's/^.* $xxx *//p'";\
4734 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4736 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
4738 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4740 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
4742 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4744 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
4746 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4748 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
4750 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4752 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
4754 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4756 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
4757 -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
4759 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4761 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
4763 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4765 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
4767 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4769 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
4771 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4773 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
4775 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4777 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
4779 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4781 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
4783 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4786 $nm -p $* 2>/dev/null >libc.tmp
4787 $grep fprintf libc.tmp > libc.ptf
4788 if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e