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 by the tool
15 # called "metaconfig". Rather than working with this copy of Configure,
16 # you should use metaconfig. Perl uses a modified version of this
17 # tool, and this, together with the metaconfig units, are available
18 # in the git repository:
19 # $ git clone https://github.com/perl5-metaconfig/metaconfig metaconfig
20 # The original dist package (including metaconfig) is available on github:
21 # $ git clone https://github.com/rmanfredi/dist.git dist-git
23 # Though this script was generated by metaconfig from metaunits, it is
24 # OK to send patches against Configure itself (but not to commit them
25 # to blead). It's up to
26 # the Configure maintainers to backport the patch to the metaunits if it
27 # is accepted. Exceptions to this rule, and more information, is in
28 # Porting/pumpkin.pod.
30 # Generated using [metaconfig 3.5 PL0]
31 # (with additional metaconfig patches by perlbug@perl.org)
36 SCO csh still thinks true is false. Write to SCO today and tell them that next
37 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
39 (Actually, Configure ought to just patch csh in place. Hmm. Hmmmmm. All
40 we'd have to do is go in and swap the && and || tokens, wherever they are.)
42 [End of diatribe. We now return you to your regularly scheduled programming...]
46 OOPS! You naughty creature! You didn't run Configure with sh!
47 I will attempt to remedy the situation by running sh for you...
51 true || exec sh $0 $argv:q
53 (exit $?0) || cat c2$$
54 (exit $?0) || exec sh $0 $argv:q
57 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
60 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
61 *** Configure that well. (Plan 9 is close to UNIX but not close enough.)
62 *** Please read the README.plan9 for further instructions.
63 *** Cannot continue, aborting.
69 if test -f /sys/utilities/MultiView ; then
70 # AmigaOS, test -c for /dev/null is not useful
72 elif test ! -c /dev/null ; then
75 *** I'm sorry, but /dev/null appears to be a file rather than a device.
76 *** Please consult your operating sytem's notes for making a device
78 *** Cannot continue, aborting.
84 : compute my invocation name
88 me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
93 : Proper separator for the PATH environment variable
95 : On OS/2 this directory should exist if this is not floppy only system ":-]"
96 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' 2>&1 ) 2>&1 >/dev/null ; then
97 if test -n "$OS2_SHELL"; then
99 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
100 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
102 elif test -n "$DJGPP"; then
103 case "X${MACHTYPE:-nonesuchmach}" in
110 : Proper PATH setting
111 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
112 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
113 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
114 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
115 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
116 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
117 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
118 paths="$paths /sbin /usr/sbin /usr/libexec"
119 paths="$paths /system/gnu_library/bin"
123 case "$p_$PATH$p_" in
125 *) test -d $p && PATH=$PATH$p_$p ;;
132 : shall we be using ksh?
138 if (PATH=.; alias -x) >/dev/null 2>&1; then
141 if test -f /hp-ux -a -f /bin/ksh; then
142 needksh='to avoid sh bug in "here document" expansion'
144 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
145 if test X`/usr/bin/uname -v` = X4; then
146 avoidksh="to avoid AIX 4's /bin/sh"
150 if test -f /osf_boot -a -f /usr/sbin/setld; then
151 if test X`/usr/bin/uname -s` = XOSF1; then
152 avoidksh="to avoid Digital UNIX' ksh"
157 case "$inksh/$needksh" in
164 case "$inksh/$avoidksh" in
170 case "$inksh/$needksh-$avoidksh-" in
173 (I see you are using the Korn shell. Some ksh's blow up on $me,
174 mainly on older exotic systems. If yours does, try the Bourne shell instead.)
181 echo "(Feeding myself to $newsh $reason.)"
183 Configure|*/Configure) exec $newsh $0 "$@";;
184 *) exec $newsh Configure "$@";;
188 test -x "${newsh}" || unset newsh
190 : if needed, set CDPATH to a harmless value that is not chatty
191 : avoid bash 2.02 problems with empty CDPATH.
195 *bash*) CDPATH='.' ;;
201 : Configure runs within the UU subdirectory
202 test -d UU || mkdir UU
345 useversionedarchname=''
351 initialinstalllocation=''
383 d_attribute_deprecated=''
384 d_attribute_format=''
385 d_attribute_malloc=''
386 d_attribute_nonnull=''
387 d_attribute_noreturn=''
389 d_attribute_unused=''
390 d_attribute_warn_unused_result=''
391 d_printf_format_null=''
393 d_builtin_choose_expr=''
395 d_builtin_add_overflow=''
396 d_builtin_mul_overflow=''
397 d_builtin_sub_overflow=''
398 d_c99_variadic_macros=''
447 endhostent_r_proto=''
453 endprotoent_r_proto=''
459 endservent_r_proto=''
531 gethostbyaddr_r_proto=''
533 gethostbyname_r_proto=''
535 gethostent_r_proto=''
548 getnetbyaddr_r_proto=''
550 getnetbyname_r_proto=''
564 d_getprotobyname_r=''
565 getprotobyname_r_proto=''
566 d_getprotobynumber_r=''
567 getprotobynumber_r_proto=''
569 getprotoent_r_proto=''
581 getservbyname_r_proto=''
583 getservbyport_r_proto=''
585 getservent_r_proto=''
618 d_lc_monetary_2008=''
623 d_libm_lib_version=''
631 d_localtime_r_needs_tzset=''
639 d_long_double_style_ieee=''
640 d_long_double_style_ieee_doubledouble=''
641 d_long_double_style_ieee_extended=''
642 d_long_double_style_ieee_std=''
643 d_long_double_style_vax=''
656 d_malloc_good_size=''
697 d_thread_safe_nl_langinfo_l=''
710 d_old_pthread_create_joinable=''
711 old_pthread_create_joinable=''
713 d_pthread_attr_setscope=''
758 sethostent_r_proto=''
775 setprotoent_r_proto=''
787 setservent_r_proto=''
800 d_siginfo_si_errno=''
803 d_siginfo_si_status=''
805 d_siginfo_si_value=''
815 d_ipv6_mreq_source=''
844 perl_static_inline=''
849 d_stdio_ptr_lval_nochange_cnt=''
850 d_stdio_ptr_lval_sets_cnt=''
931 default_inc_excludes_dot=''
1000 d_gdbm_ndbm_h_uses_prototypes=''
1001 d_gdbmndbm_h_uses_prototypes=''
1003 d_ndbm_h_uses_prototypes=''
1076 d_inc_version_list=''
1078 inc_version_list_init=''
1086 installusrbinperl=''
1102 ignore_versioned_solibs=''
1118 d_double_has_negative_zero=''
1119 d_double_has_subnormals=''
1120 d_double_style_cray=''
1121 d_double_style_ibm=''
1122 d_double_style_ieee=''
1123 d_double_style_vax=''
1174 d_perl_otherlibdirs=''
1182 api_versionstring=''
1188 version_patchlevel_string=''
1192 d_nv_preserves_uv=''
1193 d_nv_zero_is_allbits_zero=''
1204 nv_overflows_integers_at=''
1205 nv_preserves_uv_bits=''
1277 installsitehtml1dir=''
1280 installsitehtml3dir=''
1287 installsiteman1dir=''
1290 installsiteman3dir=''
1295 installsitescript=''
1313 d_stdio_stream_array=''
1314 stdio_stream_array=''
1332 usekernprocpathname=''
1333 ccflags_uselargefiles=''
1334 ldflags_uselargefiles=''
1335 libswanted_uselargefiles=''
1344 usensgetexecutablepath=''
1357 installvendorarch=''
1364 installvendorhtml1dir=''
1366 vendorhtml1direxp=''
1367 installvendorhtml3dir=''
1369 vendorhtml3direxp=''
1375 installvendorman1dir=''
1378 installvendorman3dir=''
1385 installvendorscript=''
1396 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1399 : We must find out about Eunice early
1401 if test -f /etc/unixtovms; then
1402 eunicefix=/etc/unixtovms
1404 if test -f /etc/unixtovms.exe; then
1405 eunicefix=/etc/unixtovms.exe
1408 : Set executable suffix now -- needed before hints available
1409 if test -f "/libs/version.library"; then
1412 elif test -f "/system/gnu_library/bin/ar.pm"; then
1415 elif test -n "$DJGPP"; then
1418 elif test -f /kern/cookiejar; then
1421 elif test -d c:/. -o -n "$is_os2" ; then
1428 : Possible local include directories to search.
1429 : Set locincpth to "" in a hint file to defeat local include searches.
1430 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1431 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1433 : no include file wanted by default
1436 : Enable -DEBUGGING and -DDEBUGGING from the command line
1440 : Trailing extension. Override this in a hint file, if needed.
1441 : Extra object files, if any, needed on this platform.
1444 : change the next line if compiling for Xenix/286 on Xenix/386
1445 xlibpth='/usr/lib/386 /lib/386'
1446 : Possible local library directories to search.
1447 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1448 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1450 : general looking path for locating libraries
1451 glibpth="/lib /usr/lib $xlibpth"
1452 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1453 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1454 test -f /shlib/libc.so && glibpth="/shlib $glibpth"
1455 test -d /usr/lib64 && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1457 : Private path used by Configure to find libraries. Its value
1458 : is prepended to libpth. This variable takes care of special
1459 : machines, like the mips. Usually, it should be empty.
1462 : default library list
1464 : some systems want to use only the non-versioned libso:s
1465 ignore_versioned_solibs=''
1469 : set useposix=false in your hint file to disable the POSIX extension.
1471 : set useopcode=false in your hint file to disable the Opcode extension.
1474 ccflags_uselargefiles=''
1475 ldflags_uselargefiles=''
1476 libswanted_uselargefiles=''
1477 : set usemultiplicity on the Configure command line to enable multiplicity.
1478 : set usesocks on the Configure command line to enable socks.
1480 : set usethreads on the Configure command line to enable threads.
1481 usereentrant='undef'
1482 : List of libraries we want.
1483 : If anyone needs extra -lxxx, put those in a hint file.
1484 libswanted="cl pthread socket bind inet nsl ndbm gdbm dbm db malloc dl ld"
1485 libswanted="$libswanted sun m crypt sec util c cposix posix ucb bsd BSD"
1486 : We probably want to search /usr/shlib before most other libraries.
1487 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1488 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1489 glibpth="/usr/shlib $glibpth"
1490 : Do not use vfork unless overridden by a hint file.
1493 : Find the basic shell for Bourne shell scripts
1497 *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1500 if test -f "$xxx"; then
1503 : Build up a list and do a single loop so we can 'break' out.
1504 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1505 for xxx in sh bash ksh pdksh ash; do
1507 try="$try ${p}/${xxx}"
1511 if test -f "$xxx"; then
1514 elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1517 elif test -f "$xxx.exe"; then
1528 $me: Fatal Error: I can't find a Bourne Shell anywhere.
1530 Usually it's in /bin/sh. How did you even get this far?
1531 Please contact me (Perl Maintainers) at perlbug@perl.org and
1532 we'll try to straighten this all out.
1538 : When cross-compiling we need to separate the sh-to-run-Configure-with from the sh-to-use-in-Perl
1539 : default both to the same thing, cross-compilers can then set targetsh differently if they like
1542 : see if sh knows # comments
1543 if `$sh -c '#' >/dev/null 2>&1`; then
1547 test -f $xcat$_exe || xcat=/usr/bin/cat
1548 if test ! -f $xcat$_exe; then
1549 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1550 if test -f $p/cat$_exe; then
1555 if test ! -f $xcat$_exe; then
1556 echo "Can't find cat anywhere!"
1560 echo "#!$xcat" >sharp
1563 ./sharp > today 2>/dev/null
1564 if test -s today; then
1567 echo "#! $xcat" > sharp
1570 ./sharp > today 2>/dev/null
1571 if test -s today; then
1579 echo "Your $sh doesn't grok # comments--I will strip them later on."
1582 echo "exec grep -v '^[ ]*#'" >spitshell
1584 $eunicefix spitshell
1585 spitshell=`pwd`/spitshell
1587 echo "I presume that if # doesn't work, #! won't work either!"
1592 : figure out how to guarantee sh startup
1594 '') startsh=${sharpbang}${sh} ;;
1606 : echo "Yup, it does."
1608 echo "Hmm... '$startsh' does not guarantee sh startup..."
1609 echo "You may have to fix up the shell scripts to make sure $sh runs them."
1613 : Save command line options in file UU/cmdline.opt for later use in
1614 : generating config.sh.
1615 cat > cmdline.opt <<EOSH
1616 : Configure command line arguments.
1625 cat >>cmdline.opt <<EOSH
1626 config_arg$argn='$arg'
1628 cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1631 arg_exp=`cat cmdl.opt`
1632 args_exp="$args_exp$args_sep'$arg_exp'"
1633 argn=`expr $argn + 1`
1638 : produce awk script to parse command line options
1639 cat >options.awk <<'EOF'
1641 optstr = "A:dD:eEf:hKOrsSU:V"; # getopt-style specification
1643 len = length(optstr);
1644 for (i = 1; i <= len; i++) {
1645 c = substr(optstr, i, 1);
1646 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1657 if (substr(str, 1, 1) != "-") {
1658 printf("'%s'\n", str);
1662 for (i = 2; i <= len; i++) {
1663 c = substr(str, i, 1);
1665 printf("-%s\n", substr(str, i));
1671 printf("'%s'\n", substr(str, i + 1));
1684 : process the command line options
1685 set X `for arg in "$@"; do echo "X$arg"; done |
1686 sed -e s/X// | awk -f options.awk`
1691 : set up default values
1700 rm -f optdef.sh posthint.sh
1701 cat >optdef.sh <<EOS
1707 while test $# -gt 0; do
1709 -d) shift; fastread=yes;;
1710 -e) shift; alldone=cont;;
1714 if test -r "$1"; then
1717 echo "$me: cannot read config file $1." >&2
1723 -h) shift; error=true;;
1724 -r) shift; reuseval=true;;
1725 -s) shift; silent=true; realsilent=true;;
1726 -E) shift; alldone=exit;;
1727 -K) shift; knowitall=true;;
1729 -S) shift; silent=true; extractsh=true;;
1734 echo "$me: use '-U symbol=', not '-D symbol='." >&2
1735 echo "$me: ignoring -D $1" >&2
1738 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1739 *) echo "$1='define'" >> optdef.sh;;
1746 *=) echo "$1" >> optdef.sh;;
1748 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1749 echo "$me: ignoring -U $1" >&2
1751 *) echo "$1='undef'" >> optdef.sh;;
1762 *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1766 zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1767 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1773 *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1774 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1775 zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1776 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1777 *) xxx=`echo "$yyy"|sed 's!:.*!!'`
1778 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1784 echo "$yyy=\"\${$yyy}$zzz\"" >> posthint.sh ;;
1786 echo "$yyy=''" >> posthint.sh ;;
1791 echo "$yyy='$zzz'" >> posthint.sh ;;
1793 echo "eval \"$yyy=$zzz\"" >> posthint.sh ;;
1795 echo "$yyy=\"$zzz\${$yyy}\"" >> posthint.sh ;;
1800 echo "$yyy=$zzz" >> posthint.sh ;;
1801 *) echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1805 -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1808 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1816 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1817 [-U symbol] [-U symbol=] [-A command:symbol...]
1818 -d : use defaults for all answers.
1819 -e : go on without questioning past the production of config.sh.
1820 -f : specify an alternate default configuration file.
1821 -h : print this help message and exit (with an error status).
1822 -r : reuse C symbols value if possible (skips costly nm extraction).
1823 -s : silent mode, only echoes questions and essential information.
1824 -D : define symbol to have some value:
1825 -D symbol symbol gets the value 'define'
1826 -D symbol=value symbol gets the value 'value'
1827 common used examples (see INSTALL for more info):
1828 -Duse64bitint use 64bit integers
1829 -Duse64bitall use 64bit integers and pointers
1830 -Dusethreads use thread support
1831 -Dinc_version_list=none do not include older perl trees in @INC
1832 -DEBUGGING=none DEBUGGING options
1833 -Dcc=gcc choose your compiler
1834 -Dprefix=/opt/perl5 choose your destination
1835 -E : stop at the end of questions, after having produced config.sh.
1836 -K : do not use unless you know what you are doing.
1837 -O : ignored for backward compatibility
1838 -S : perform variable substitutions on all .SH files (can mix with -f)
1839 -U : undefine symbol:
1840 -U symbol symbol gets the value 'undef'
1841 -U symbol= symbol gets completely empty
1843 -A : manipulate symbol after the platform specific hints have been applied:
1844 -A append:symbol=value append value to symbol
1845 -A symbol=value like append:, but with a separating space
1846 -A define:symbol=value define symbol to have value
1847 -A clear:symbol define symbol to be ''
1848 -A define:symbol define symbol to be 'define'
1849 -A eval:symbol=value define symbol to be eval of value
1850 -A prepend:symbol=value prepend value to symbol
1851 -A undef:symbol define symbol to be 'undef'
1852 -A undef:symbol= define symbol to be ''
1853 e.g.: -A prepend:libswanted='cl pthread '
1854 -A ccflags=-DSOME_MACRO
1855 -V : print version number and exit (with a zero status).
1862 case "$fastread$alldone" in
1865 case "$extractsh" in
1868 if test ! -t 0; then
1869 echo "Say 'sh Configure', not 'sh <Configure'"
1879 true) exec 1>/dev/null;;
1882 : run the defines and the undefines, if any, but leave the file out there...
1884 grep '\\' optdef.sh >/dev/null 2>&1
1885 if test $? = 0; then
1886 echo "Configure does not support \\ in -D arguments"
1890 : create the posthint manipulation script and leave the file out there...
1895 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1896 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1897 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
1898 ABYZ-abyz) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1899 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1902 : Some greps do not return status, grrr.
1903 echo "grimblepritz" >grimble
1904 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1906 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1912 : the following should work in any shell
1916 echo "AGH! Grep doesn't return a status. Attempting remedial action."
1917 cat >contains <<'EOSS'
1918 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1923 : Find the path to the source tree
1926 */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1930 *) src=`cd ../$src && pwd` ;;
1943 if test -f $rsrc/Configure && \
1944 $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1946 : found it, so we are ok.
1949 for src in . .. ../.. ../../.. ../../../..; do
1950 if test -f ../$src/Configure && \
1951 $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1962 Sorry, I can't seem to locate the source dir for $package. Please start
1963 Configure with an explicit path -- i.e. /some/path/Configure.
1971 echo "Sources for $package found in \"$src\"." >&4
1975 : script used to extract .SH files with variable substitutions
1976 cat >extract <<'EOS'
1978 echo "Doing variable substitutions on .SH files..."
1979 if test -f MANIFEST; then
1980 set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1982 echo "(Looking for .SH files under the source directory.)"
1983 set x `(cd "$src"; find . -name "*.SH" -print)`
1987 0) set x `(cd "$src"; echo *.SH)`; shift;;
1989 if test ! -f "$src/$1"; then
1995 while test $name; do
1996 if test ! -d "$name"; then
1997 create="$name $create";
1998 name=`echo $name | sed -e "s|^[^/]*$||"`;
1999 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
2004 for file in $create; do
2013 dir=`expr X$file : 'X\(.*\)/'`
2014 file=`expr X$file : 'X.*/\(.*\)'`
2015 (cd "$dir" && . ./$file)
2025 dir=`expr X$file : 'X\(.*\)/'`
2026 file=`expr X$file : 'X.*/\(.*\)'`
2027 (set x $dir; shift; eval $mkdir_p)
2028 sh <"$src/$dir/$file"
2037 if test -f "$src/config_h.SH"; then
2038 if test ! -f config.h; then
2039 : oops, they left it out of MANIFEST, probably, so do it anyway.
2040 . "$src/config_h.SH"
2045 : extract files and exit if asked to do so
2046 case "$extractsh" in
2048 case "$realsilent" in
2052 case "$config_sh" in
2053 '') config_sh='config.sh';;
2056 echo "Fetching answers from $config_sh..."
2063 echo "Extraction done."
2068 : Eunice requires " " instead of "", can you believe it
2071 echo "Beginning of configuration questions for $package."
2073 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
2075 : first determine how to suppress newline on echo command
2077 echo "Checking echo to see how to suppress newlines..."
2078 (echo "hi there\c" ; echo " ") >.echotmp
2079 if $contains c .echotmp >/dev/null 2>&1 ; then
2090 echo $n "The star should be here-->$c"
2094 : Now test for existence of everything in MANIFEST
2096 if test -f "$rsrc/MANIFEST"; then
2097 echo "First let's make sure your kit is complete. Checking..." >&4
2098 awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
2099 (split -l 50 2>/dev/null || split -50)
2102 for filelist in x??; do
2103 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
2104 >/dev/null 2>>"$tmppwd/missing")
2106 if test -s missing; then
2110 THIS PACKAGE SEEMS TO BE INCOMPLETE.
2112 You have the option of continuing the configuration process, despite the
2113 distinct possibility that your kit is damaged, by typing 'y'es. If you
2114 do, don't blame me if something goes wrong. I advise you to type 'n'o
2115 and contact the author (perlbug@perl.org).
2118 echo $n "Continue? [n] $c" >&4
2122 echo "Continuing..." >&4
2126 echo "ABORTING..." >&4
2131 echo "Looks good..."
2134 echo "There is no MANIFEST file. I hope your kit is complete !"
2138 : Find the appropriate value for a newline for tr
2139 if test -n "$DJGPP"; then
2142 if test X"$trnl" = X; then
2143 case "`echo foo | tr '\n' x 2>/dev/null`" in
2147 if test X"$trnl" = X; then
2148 case "`echo foo | tr '\012' x 2>/dev/null`" in
2149 foox) trnl='\012' ;;
2152 if test X"$trnl" = X; then
2153 case "`echo foo | tr '\r\n' xy 2>/dev/null`" in
2154 fooxy) trnl='\n\r' ;;
2157 if test X"$trnl" = X; then
2160 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2166 : compute the number of columns on the terminal for proper question formatting
2171 : set up the echo used in my read
2172 myecho="case \"\$xxxm\" in
2173 '') echo $n \"\$rp $c\" >&4;;
2175 '') echo $n \"[\$xxxm] $c\";;
2177 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
2179 echo $n \"[\$xxxm] $c\" >&4
2181 echo $n \"\$rp [\$xxxm] $c\" >&4
2187 : now set up to do reads with possible shell escape and default assignment
2193 case "\$fastread" in
2194 yes) case "\$dflt" in
2197 case "\$silent-\$rp" in
2202 *) case "\$silent" in
2203 true) case "\$rp" in
2208 while expr "X\$ans" : "X!" >/dev/null; do
2212 aok=''; eval "ans=\\"\$answ\\"" && aok=y
2220 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2229 set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2234 echo "(OK, I'll run with -d after this question.)" >&4
2237 echo "*** Sorry, \$1 not supported yet." >&4
2247 echo "*** Substitution done -- please confirm."
2249 ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2254 echo "*** Error -- try again."
2261 case "\$ans\$xxxm\$nostick" in
2273 : create .config dir to save info across Configure sessions
2274 test -d ../.config || mkdir ../.config
2275 cat >../.config/README <<EOF
2276 This directory created by Configure to save information that should
2277 persist across sessions for $package.
2279 You may safely delete it if you wish.
2282 : See if we are using a devel version and want that
2283 xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2286 usedevel="$define" ;;
2287 *) case "$xversion" in
2290 *** WHOA THERE!!! ***
2292 This is an UNSTABLE DEVELOPMENT release.
2293 The version of this $package distribution is $xversion, that is, odd,
2294 (as opposed to even) and that signifies a development release.
2295 If you want a maintenance release, you want an even-numbered version.
2297 Do ***NOT*** install this into production use.
2298 Data corruption and crashes are possible.
2300 It is most seriously suggested that you do not continue any further
2301 unless you want to help in developing and debugging Perl.
2303 If you *still* want to build perl, you can answer 'y' now,
2304 or pass -Dusedevel to Configure.
2307 rp='Do you really want to continue?'
2311 [yY]) echo >&4 "Okay, continuing."
2312 usedevel="$define" ;;
2313 *) echo >&4 "Okay, bye."
2324 case "$versiononly" in
2325 '') versiononly="$define" ;;
2327 case "$installusrbinperl" in
2328 '') installusrbinperl="$undef" ;;
2333 : general instructions
2336 user=`(logname) 2>/dev/null`
2338 '') user=`whoami 2>&1`;;
2340 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2343 rp='Would you like to see the instructions?'
2354 This installation shell script will examine your system and ask you questions
2355 to determine how the perl5 package should be installed. If you get
2356 stuck on a question, you may use a ! shell escape to start a subshell or
2357 execute a command. Many of the questions will have default answers in square
2358 brackets; typing carriage return will give you the default.
2360 On some of the questions which ask for file or directory names you are allowed
2361 to use the ~name construct to specify the login directory belonging to "name",
2362 even if you don't have a shell which knows about that. Questions where this is
2363 allowed will be marked "(~name ok)".
2367 dflt='Type carriage return to continue'
2371 The prompter used in this script allows you to use shell variables and
2372 backticks in your answers. You may use $1, $2, etc... to refer to the words
2373 in the default answer, as if the default line was a set of arguments given to a
2374 script shell. This means you may also use $* to repeat the whole default line,
2375 so you do not have to re-type everything to add something to the default.
2377 Every time there is a substitution, you will have to confirm. If there is an
2378 error (e.g. an unmatched backtick), the default answer will remain unchanged
2379 and you will be prompted again.
2381 If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
2382 the questions and use the computed defaults (or the previous answers if there
2383 was already a config.sh file). Type 'Configure -h' for a list of options.
2384 You may also start interactively and then answer '& -d' at any prompt to turn
2385 on the non-interactive behaviour for the remainder of the execution.
2391 Much effort has been expended to ensure that this shell script will run on any
2392 Unix system. If despite that it blows up on yours, your best bet is to edit
2393 Configure and run it again. If you can't run Configure for some reason,
2394 you'll have to generate a config.sh file by hand. Whatever problems you
2395 have, let me (perlbug@perl.org) know how I blew it.
2397 This installation script affects things in two ways:
2399 1) it may do direct variable substitutions on some of the files included
2401 2) it builds a config.h file for inclusion in C programs. You may edit
2402 any of these files as the need arises after running this script.
2404 If you make a mistake on a question, there is no easy way to back up to it
2405 currently. The easiest thing to do is to edit config.sh and rerun all the SH
2406 files. Configure will offer to let you do this before it runs the SH files.
2409 dflt='Type carriage return to continue'
2411 case "$firsttime" in
2412 true) echo $user >>../.config/instruct;;
2416 : Set 'sysroot' to change the logical root directory to your headers and libraries see man gcc
2417 : This is primarily meant for cross-compile environments, and may fail to be useful in other cases
2418 if test "X$sysroot" = X; then
2423 echo "Using $sysroot to find your headers and libraries, adding to ccflags"
2424 # _sysroot is used in places where we need --sysroot=foo
2425 # but using the rest of the flags could cause issues.
2426 _sysroot="--sysroot=$sysroot";
2430 ccflags="$ccflags $_sysroot"
2435 ldflags="$ldflags $_sysroot"
2440 cppflags="$cppflags $_sysroot"
2442 # lddlflags updated below in lddlflags section;
2443 # same with cccdlflags
2447 # Adjust some defaults to also use $sysroot
2448 for var in xlibpth loclibpth locincpth glibpth; do
2451 for path in $xxx; do
2452 eval $var=\"\$$var $sysroot$path\"
2458 : find out where common programs are
2460 echo "Locating common programs..." >&4
2473 if test -d \$dir/\$thing; then
2479 for thisthing in \$dir/\$thing; do
2480 : just loop through to pick last item
2482 if test -f \$thisthing; then
2485 elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2488 elif test -f \$dir/\$thing.exe; then
2489 if test -n "$DJGPP"; then
2490 echo \$dir/\$thing.exe
2491 elif test "$eunicefix" != ":"; then
2492 : on Eunice apparently
2545 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2546 pth="$pth $sysroot/lib $sysroot/usr/lib"
2547 for file in $loclist; do
2551 if test -f "$xxx"; then
2554 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2555 xxx=`./loc $file $file $pth`
2558 '') xxx=`./loc $file $file $pth`;;
2559 *) xxx=`./loc $xxx $xxx $pth`;;
2561 eval $file=$xxx$_exe
2565 echo $file is in $xxx.
2568 echo $file is in $xxx.
2571 echo "I don't know where '$file' is, and my life depends on it." >&4
2572 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2578 echo "Don't worry if any of the following aren't found..."
2580 for file in $trylist; do
2584 if test -f "$xxx"; then
2587 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2588 xxx=`./loc $file $file $pth`
2591 '') xxx=`./loc $file $file $pth`;;
2592 *) xxx=`./loc $xxx $xxx $pth`;;
2594 eval $file=$xxx$_exe
2598 echo $file is in $xxx.
2601 echo $file is in $xxx.
2604 echo "I don't see $file out there, $say."
2611 echo "Substituting grep for egrep."
2618 *) if $less -R </dev/null >/dev/null 2>&1; then
2619 echo "Substituting less -R for less."
2627 echo "Substituting cp for ln."
2636 echo "I can't find make or gmake, and my life depends on it." >&4
2637 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2645 *) # We can't have osname yet.
2646 if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2647 # Assume that gmake, if found, is definitely GNU make
2648 # and prefer it over the system make.
2649 echo "Substituting gmake for make."
2657 echo "Hopefully test is built into your sh."
2660 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2661 echo "Using the test built into your sh."
2669 echo "Hopefully echo is built into your sh."
2674 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2675 $echo $n "hi there$c" >foo1
2676 echo $n "hi there$c" >foo2
2677 if cmp foo1 foo2 >/dev/null 2>&1; then
2678 echo "They are compatible. In fact, they may be identical."
2685 They are not compatible! You are probably running ksh on a non-USG system.
2686 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2687 have echo built in and we may have to run some Bourne shell scripts. That
2688 means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
2691 $echo $n "The star should be here-->$c"
2698 # This question was auctioned at YAPC::Europe-2007 in Vienna
2699 # I never promised you could answer it. I only auctioned the question.
2701 The following message is sponsored by
2703 Dresden.pm<--The stars should be here.
2705 Dear Perl user, system administrator or package
2706 maintainer, the Perl community sends greetings to
2707 you. Do you (emblematical) greet back [Y/n]? n
2711 : Check what type of C compiler we use
2715 cat <<'EOSC' >>trygcc
2720 int main(int argc, char *argv[]) {
2724 if $cc -o try $ccflags $ldflags try.c; then
2727 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2733 # Skip this test because it gives a false match on output like:
2734 # ./trygcc: line 23: cc: command not found
2735 # case "`$cc -v -c try.c 2>&1`" in
2736 # *gcc*) trygcc=no ;;
2738 if $test X"$trygcc" = Xyes; then
2739 if gcc -o try -c try.c; then
2741 echo "You seem to have a working gcc, though." >&4
2742 # Switching compilers may undo the work of hints files.
2743 # The most common problem is -D_REENTRANT for threads.
2744 # This heuristic catches that case, but gets false positives
2745 # if -Dusethreads was not actually specified. Better to
2746 # bail out here with a useful message than fail
2747 # mysteriously later. Should we perhaps just try to
2748 # re-invoke Configure -Dcc=gcc config_args ?
2749 if $test -f usethreads.cbu; then
2752 *** However, any setting of the C compiler flags (e.g. for thread support)
2753 *** will be lost. It may be necessary for you to restart Configure and
2754 *** add -Dcc=gcc to your Configure command line.
2757 rp="Would you like to go ahead and try gcc anyway?"
2760 rp="Would you like to use it?"
2763 if $test -f myread; then
2766 if $test -f UU/myread; then
2769 echo "Cannot find myread, sorry. Aborting." >&2
2774 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2787 cat <<'EOSC' >>checkcc
2792 int main(int argc, char *argv[]) {
2796 if $cc -o try $ccflags $ldflags try.c; then
2799 if $test X"$despair" = Xyes; then
2800 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2803 You need to find a working C compiler.
2804 Either (purchase and) install the C compiler supplied by your OS vendor,
2805 or for a free C compiler try http://gcc.gnu.org/
2806 I cannot continue any further, aborting.
2815 : determine whether symbolic links are supported
2818 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2819 echo "Symbolic links are supported." >&4
2822 echo "Symbolic links are NOT supported." >&4
2827 : determine whether symbolic links are supported
2831 echo "Checking how to test for symbolic links..." >&4
2833 if $test "X$issymlink" = X; then
2835 '') sh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2836 *) $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2838 if test $? = 0; then
2841 echo "Your builtin 'test -h' may be broken." >&4
2844 *) pth=`echo $PATH | sed -e "s/$p_/ /g"`
2847 if test -f "$p/$test"; then
2856 echo "Trying external '$test -h'." >&4
2857 issymlink="$test -h"
2858 if $test ! -h sym >/dev/null 2>&1; then
2859 echo "External '$test -h' is broken, too." >&4
2867 if $test "X$issymlink" = X; then
2868 if $test -L sym 2>/dev/null; then
2869 issymlink="$test -L"
2870 echo "The builtin '$test -L' worked." >&4
2873 if $test "X$issymlink" != X; then
2874 echo "You can test for symbolic links with '$issymlink'." >&4
2876 echo "I do not know how you can test for symbolic links." >&4
2880 *) echo "No symbolic links, so not testing for their testing..." >&4
2884 : Make symlinks util
2885 case "$mksymlinks" in
2888 ''|'.') echo "Cannot create symlinks in the original directory." >&4
2891 *) case "$lns:$issymlink" in
2892 *"ln"*" -s:"*"test -"?)
2893 echo "Creating the symbolic links..." >&4
2895 awk '{print $1}' $src/MANIFEST | sed -e 's:/\([^/]*\)$: \1:' |
2905 print "# dir = ", dir, "file = ", file
2906 mf[dir] = mf[dir]" "source"/"dir"/"file;
2909 if (d != ".") { print("mkdir -p "d) }
2910 print("ln -sf "mf[d]" "d);
2912 }' source="$src" > UU/mksymlinks.$$
2916 if test ! -d t/base; then
2917 echo "Failed to create the subdirectories. Aborting." >&4
2921 if test ! -f t/base/lex.t; then
2922 echo "Failed to create the symlinks (t/base/lex.t missing). Aborting." >&4
2925 if test ! -f win32/win32.c; then
2926 echo "Failed to create the symlinks (win32/win32.c missing). Aborting." >&4
2931 *) echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2939 : Check for Cross-Compilation
2940 if $test "X$targethost" = "X"; then
2943 if $test "X$targetenv" = "X"; then
2946 case "$usecrosscompile" in
2948 $echo "Cross-compiling..."
2951 *-gcc*|*-g++*) # A cross-compiling gcc, probably.
2952 # arm-linux-androideabi-gcc -> arm-linux-androideabi
2953 # x86_64-w64-mingw32-gcc.exe -> x86_64-w64-mingw32
2954 targetarch=`$echo $cc|$sed 's/-g[c\+][c\+].*$//'`
2955 ar=`$echo $cc|$sed 's/-g[c\+][c\+]/-ar/'`
2956 # leave out ld, choosing it is more complex
2957 nm=`$echo $cc|$sed 's/-g[c\+][c\+]/-nm/'`
2958 ranlib=`$echo $cc|$sed 's/-g[c\+][c\+]/-ranlib/'`
2959 # We are in a weird spot. Just before us, some values
2960 # were 'saved', to be restored after the hints are
2961 # run. This means that the changes we made to ar,
2962 # nm and ranlib will get reverted.
2963 # To avoid that, we hijack the saving mechanism and
2964 # have it save our new values.
2965 for file in ar nm ranlib; do
2967 eval $file=$xxx$_exe
2972 case "$targetarch" in
2973 '') echo "Targetarch not defined." >&4; croak=y ;;
2974 *) echo "Using targetarch $targetarch." >&4 ;;
2976 case "$targethost" in
2977 '') echo "Targethost not defined." >&4; croak=n ;;
2978 *) echo "Using targethost $targethost." >&4
2983 y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2985 : compile a host miniperl and generate_uudmap, unless we got passed them
2986 if $test "X$hostperl" = X; then
2987 echo "Building host miniperl and generate_uudmap binaries" >&4
2995 $src/Configure -des -Dusedevel -Dmksymlinks
2997 case "$hostgenerate" in
2998 '') $make generate_uudmap
2999 hostgenerate=$src/host/generate_uudmap
3001 "$undef") hostgenerate=''
3004 hostperl=$src/host/miniperl
3007 hostosname=`$hostperl -le 'print $^O'`
3010 usecrosscompile="$undef"
3014 : Define -Dtargethost=somecomputer to run compiled tests on another machine
3015 case "$targethost" in
3016 '') echo "Checking for cross-compile" >&4
3017 case "$usecrosscompile$multiarch" in
3018 *$define*) echo "Skipping the try tests in the rest of Configure as no targethost was defined when cross-compiling" >&4
3019 if [ -f Makefile ]; then
3021 echo "Now you must ensure config.sh, config.h and the generated headers exist and run a $make."
3023 echo "Configure done."
3027 *) echo "No targethost for running compiler tests against defined, running locally" >&4
3034 *) echo "Using targethost $targethost." >&4
3036 /*) run=$src/Cross/run
3037 targetmkdir=$src/Cross/mkdir
3039 from=$src/Cross/from
3041 *) pwd=`$test -f ../Configure & cd ..; pwd`
3043 targetmkdir=$pwd/Cross/mkdir
3045 from=$pwd/Cross/from
3048 case "$targetrun" in
3049 '') targetrun=ssh ;;
3054 case "$targetfrom" in
3055 '') targetfrom=scp ;;
3059 from=$from-$targetfrom
3060 case "$targetdir" in
3062 echo "Guessing targetdir $targetdir." >&4
3065 case "$targetuser" in
3067 echo "Guessing targetuser $targetuser." >&4
3070 case "$targetport" in
3072 echo "Guessing targetport $targetport." >&4
3075 case "$targetfrom" in
3079 case "$targetrun" in
3099 '') cwd=$targetdir ;;
3104 $targetrun -p $targetport -l $targetuser $targethost "cd \$cwd && \$env \$exe \$@"
3110 *) echo "Unknown targetrun '$targetrun'" >&4
3114 case "$targetmkdir" in
3116 cat >$targetmkdir <<EOF
3118 $targetrun -p $targetport -l $targetuser $targethost "mkdir -p \$@"
3120 $chmod a+rx $targetmkdir
3122 *) echo "Unknown targetmkdir '$targetmkdir'" >&4
3134 $targetmkdir \`dirname \$f\`
3135 $targetto -P $targetport -r $q \$f $targetuser@$targethost:\$f 2>/dev/null || exit 1
3138 $targetmkdir $targetdir/\`dirname \$f\`
3139 $targetto -P $targetport -r $q \$f $targetuser@$targethost:$targetdir/\$f 2>/dev/null || exit 1
3152 $mkdir -p $targetdir/\`dirname \$f\`
3153 $cp \$f $targetdir/\$f || exit 1
3156 $targetmkdir $targetdir/\`dirname \$f\`
3157 $cp \$f $targetdir/\$f || exit 1
3164 *) echo "Unknown targetto '$targetto'" >&4
3168 case "$targetfrom" in
3175 $targetfrom -P $targetport $q $targetuser@$targethost:$targetdir/\$f . || exit 1
3180 cp) cat >$from <<EOF
3185 cp $targetdir/\$f . || exit 1
3190 *) echo "Unknown targetfrom '$targetfrom'" >&4
3194 if $test ! -f $run; then
3195 echo "Target 'run' script '$run' not found." >&4
3199 if $test ! -f $to; then
3200 echo "Target 'to' script '$to' not found." >&4
3204 if $test ! -f $from; then
3205 echo "Target 'from' script '$from' not found." >&4
3209 if $test ! -f $run -o ! -f $to -o ! -f $from; then
3213 Using '$run' for remote execution,
3214 and '$from' and '$to'
3215 for remote file transfer.
3221 usecrosscompile="$undef"
3226 : see whether [:lower:] and [:upper:] are supported character classes
3228 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | $tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
3230 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3234 *) # There is a discontinuity in EBCDIC between 'R' and 'S'
3235 # (0xd9 and 0xe2), therefore that is a nice testing point.
3236 if test "X$up" = X -o "X$low" = X; then
3237 case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3243 if test "X$up" = X -o "X$low" = X; then
3244 case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3250 if test "X$up" = X -o "X$low" = X; then
3251 case "`echo RS | od -x 2>/dev/null`" in
3253 echo "Hey, this might be EBCDIC." >&4
3254 if test "X$up" = X -o "X$low" = X; then
3255 case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3256 rs) up='[A-IJ-RS-Z]'
3261 if test "X$up" = X -o "X$low" = X; then
3262 case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3272 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3274 echo "Using $up and $low to convert case." >&4
3277 echo "I don't know how to translate letters from upper to lower case." >&4
3278 echo "Your tr is not acting any way I know of." >&4
3282 : set up the translation script tr, must be called with ./tr of course
3286 '[A-Z][a-z]') exec $tr '$up' '$low';;
3287 '[a-z][A-Z]') exec $tr '$low' '$up';;
3294 : Try to determine whether config.sh was made on this system
3295 case "$config_sh" in
3297 myuname=`$uname -a 2>/dev/null`
3298 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3299 # Downcase everything to avoid ambiguity.
3300 # Remove slashes and single quotes so we can use parts of this in
3301 # directory and file names.
3302 # Remove newlines so myuname is sane to use elsewhere.
3303 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3304 # because the A-Z/a-z are not consecutive.
3305 myuname=`echo $myuname | $sed -e "s,['/],,g" | \
3306 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3307 newmyuname="$myuname"
3309 case "$knowitall" in
3311 if test -f ../config.sh; then
3312 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3313 eval "`grep myuname= ../config.sh`"
3315 if test "X$myuname" = "X$newmyuname"; then
3323 : Get old answers from old config file if Configure was run on the
3324 : same system, otherwise use the hints.
3327 if test -f config.sh; then
3329 rp="I see a config.sh file. Shall I use it to set the defaults?"
3332 n*|N*) echo "OK, I'll ignore it."
3333 mv config.sh config.sh.old
3334 myuname="$newmyuname"
3336 *) echo "Fetching default answers from your old config.sh file..." >&4
3344 : Older versions did not always set $sh. Catch re-use of such
3354 if test ! -f config.sh; then
3357 First time through, eh? I have some defaults handy for some systems
3358 that need some extra help getting the Configure answers right:
3361 (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
3363 : Half the following guesses are probably wrong... If you have better
3364 : tests or hints, please send them to perlbug@perl.org
3365 : The metaconfig authors would also appreciate a copy...
3366 $test -f /irix && osname=irix
3367 $test -f /xenix && osname=sco_xenix
3368 $test -f /dynix && osname=dynix
3369 $test -f /dnix && osname=dnix
3370 $test -f /lynx.os && osname=lynxos
3371 $test -f /unicos && osname=unicos && osvers=`$uname -r`
3372 $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3373 $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3374 $test -f /bin/mips && /bin/mips && osname=mips
3375 $test -d /usr/apollo/bin && osname=apollo
3376 $test -f /etc/saf/_sactab && osname=svr4
3377 $test -d /usr/include/minix && osname=minix && osvers=`$uname -r`
3378 $test -f /system/gnu_library/bin/ar.pm && osname=vos
3379 $test -f /sys/utilities/MultiView && osname=amigaos
3380 if $test -d /MachTen -o -d /MachTen_Folder; then
3382 if $test -x /sbin/version; then
3383 osvers=`/sbin/version | $awk '{print $2}' |
3384 $sed -e 's/[A-Za-z]$//'`
3385 elif $test -x /usr/etc/version; then
3386 osvers=`/usr/etc/version | $awk '{print $2}' |
3387 $sed -e 's/[A-Za-z]$//'`
3393 $test -f /sys/posix.dll &&
3394 $test -f /usr/bin/what &&
3395 set X `/usr/bin/what /sys/posix.dll` &&
3396 $test "$3" = UWIN &&
3400 if $test -f $uname; then
3408 umips) osname=umips ;;
3411 [23]100) osname=mips ;;
3413 tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3414 if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3417 elif $test -f /etc/kconfig; then
3419 if test "$lns" = "$ln -s"; then
3421 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3423 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3430 if test -n "$DJGPP"; then
3439 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3441 # oslevel can fail with:
3442 # oslevel: Unable to acquire lock.
3443 *not\ found) osvers="$4"."$3" ;;
3444 '<3240'|'<>3240') osvers=3.2.0 ;;
3445 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3446 '=3250'|'>3250') osvers=3.2.5 ;;
3450 bitrig) osname=bitrig
3453 bsd386) osname=bsd386
3456 cygwin*) osname=cygwin
3459 *dc.osx) osname=dcosx
3465 domainos) osname=apollo
3471 dragonfly) osname=dragonfly
3474 dynixptx*) osname=dynixptx
3475 osvers=`echo "$4"|sed 's/^v//'`
3477 freebsd) osname=freebsd
3479 genix) osname=genix ;;
3483 osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3496 $test -f /system/lib/libandroid.so && osname=linux-android
3500 netbsd*) osname=netbsd
3503 news-os) osvers="$3"
3505 4*) osname=newsos4 ;;
3509 nonstop-ux) osname=nonstopux ;;
3510 openbsd) osname=openbsd
3516 POSIX-BC | posix-bc ) osname=posix-bc
3519 powerux | power_ux | powermax_os | powermaxos | \
3520 powerunix | power_unix) osname=powerux
3526 solaris) osname=solaris
3528 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3535 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3539 titanos) osname=titanos
3548 ultrix) osname=ultrix
3551 osf1|mls+) case "$5" in
3554 osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' | tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3557 *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3560 hp*) osname=hp_osf1 ;;
3561 mips) osname=mips_osf1 ;;
3564 # UnixWare 7.1.2 is known as Open UNIX 8
3565 openunix|unixware) osname=svr5
3573 $2) case "$osname" in
3577 : svr4.x or possibly later
3587 if test -f /stand/boot ; then
3588 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3589 if test -n "$INITPROG" -a -f "$INITPROG"; then
3590 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3591 if test -n "$isesix"; then
3599 *) if test -f /etc/systemid; then
3601 set `echo $3 | $sed 's/\./ /g'` $4
3602 if $test -f $src/hints/sco_$1_$2_$3.sh; then
3604 elif $test -f $src/hints/sco_$1_$2.sh; then
3606 elif $test -f $src/hints/sco_$1.sh; then
3611 '') : Still unknown. Probably a generic Sys V.
3620 *) case "$osname" in
3621 '') : Still unknown. Probably a generic BSD.
3629 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3630 (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3631 if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3634 $rm -f UU/kernel.what
3635 elif test -d c:/. -o -n "$is_os2" ; then
3642 case "$targetarch" in
3645 case "$targetarch" in
3647 # Will load qnx.sh, which should change osname to nto
3652 # Catch arm-linux-androideabi, mipsel-linux-android,
3653 # and i686-linux-android
3654 osname=linux-android
3658 # Something like arm-linux-gnueabihf is really just
3665 # XXX perhaps we should just assume
3666 # osvers to be 2, or maybe take the value
3667 # from targetarch. Using $run before the
3668 # hints are run is somewhat icky.
3669 set X `$run $uname -a 2>/dev/null`
3672 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3677 osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3684 : Now look for a hint file osname_osvers, unless one has been
3685 : specified already.
3688 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3689 : Also try without trailing minor version numbers.
3690 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3691 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3692 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3693 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3696 *) case "$osvers" in
3699 *) if $test -f $src/hints/$file.sh ; then
3701 elif $test -f $src/hints/$xfile.sh ; then
3703 elif $test -f $src/hints/$xxfile.sh ; then
3705 elif $test -f $src/hints/$xxxfile.sh ; then
3707 elif $test -f $src/hints/$xxxxfile.sh ; then
3709 elif $test -f "$src/hints/${osname}.sh" ; then
3718 if $test -f Policy.sh ; then
3721 none) dflt="Policy" ;;
3722 *) dflt="Policy $dflt" ;;
3727 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3731 if $test -f Policy.sh ; then
3734 There's also a Policy hint file available, which should make the
3735 site-specific (policy) questions easier to answer.
3742 You may give one or more space-separated answers, or "none" if appropriate.
3743 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3744 previous run of Configure, you may specify it as well as or instead of
3745 OS-specific hints. If hints are provided for your OS, you should use them:
3746 although Perl can probably be built without hints on many platforms, using
3747 hints often improve performance and may enable features that Configure can't
3748 set up on its own. If there are no hints that match your OS, specify "none";
3749 DO NOT give a wrong version or a wrong OS.
3753 rp="Which of these apply, if any?"
3756 for file in $tans; do
3757 if $test X$file = XPolicy -a -f Policy.sh; then
3759 $cat Policy.sh >> UU/config.sh
3760 elif $test -f $src/hints/$file.sh; then
3761 . $src/hints/$file.sh
3762 $cat $src/hints/$file.sh >> UU/config.sh
3763 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3766 : Give one chance to correct a possible typo.
3767 echo "$file.sh does not exist"
3769 rp="hint to use instead?"
3771 for file in $ans; do
3772 if $test -f "$src/hints/$file.sh"; then
3773 . $src/hints/$file.sh
3774 $cat $src/hints/$file.sh >> UU/config.sh
3775 elif $test X$ans = X -o X$ans = Xnone ; then
3778 echo "$file.sh does not exist -- ignored."
3785 : Remember our hint file for later.
3786 if $test -f "$src/hints/$file.sh" ; then
3796 echo "Fetching default answers from $config_sh..." >&4
3800 cp $config_sh config.sh 2>/dev/null
3812 : Restore computed paths
3813 for file in $loclist $trylist; do
3814 eval $file="\$_$file"
3819 Configure uses the operating system name and version to set some defaults.
3820 The default value is probably right if the name rings a bell. Otherwise,
3821 since spelling matters for me, either accept the default or answer "none"
3828 ''|' '|none) dflt=none ;;
3829 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3832 *) dflt="$osname" ;;
3834 rp="Operating system name?"
3838 *) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3844 ''|' '|none) dflt=none ;;
3845 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3846 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3848 ''|' ') dflt=none ;;
3853 *) dflt="$osvers" ;;
3855 rp="Operating system version?"
3865 : who configured the system
3866 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3869 cf_by=`(logname) 2>/dev/null`
3872 cf_by=`(whoami) 2>/dev/null`
3874 "") cf_by=unknown ;;
3879 : decide how portable to be. Allow command line overrides.
3880 case "$d_portable" in
3882 *) d_portable="$define" ;;
3885 : set up shell script to do ~ expansion
3891 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3894 if $test -f /bin/csh; then
3895 /bin/csh -f -c "glob \$1"
3900 name=\`$expr x\$1 : '..\([^/]*\)'\`
3901 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3902 if $test ! -d "\$dir"; then
3904 echo "\$me: can't locate home directory for: \$name" >&2
3909 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3925 : now set up to get a file name
3929 cat <<'EOSC' >>getfile
3945 : getfile will accept an answer from the comma-separated list
3946 : enclosed in parentheses even if it does not meet other criteria.
3947 expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3948 fn=`echo $fn | sed 's/(.*)//'`
3954 loc_file=`expr $fn : '.*:\(.*\)'`
3955 fn=`expr $fn : '\(.*\):.*'`
3963 */*) fullpath=true;;
3972 *e*) exp_file=true;;
3975 *p*) nopath_ok=true;;
3980 *d*) type='Directory';;
3981 *l*) type='Locate';;
3986 Locate) what='File';;
3991 case "$d_portable" in
3999 while test "$type"; do
4004 true) rp="$rp (~name ok)";;
4007 if test -f UU/getfile.ok && \
4008 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4027 value=`UU/filexp $ans`
4030 if test "$ans" != "$value"; then
4031 echo "(That expands to $value on this system.)"
4045 /*) value="$ansexp" ;;
4046 [a-zA-Z]:/*) value="$ansexp" ;;
4051 echo "I shall only accept a full path name, as in /bin/ls." >&4
4052 echo "Use a ! shell escape if you wish to check pathnames." >&4
4055 echo "Please give a full path name, starting with slash." >&4
4058 echo "Note that using ~name is ok provided it expands well." >&4
4071 for fp in $gfpth; do
4072 if test "X$fp" = X.; then
4077 if test -f "$pf"; then
4079 elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4081 echo "($value is not a plain file, but that's ok.)"
4084 if test X"$type" = X; then
4091 for fp in $gfpth; do
4092 if test "X$fp" = X.; then
4097 direxp="$fp/$ansexp"
4099 if test -d "$direxp"; then
4107 if test -d "$ansexp"; then
4108 echo "(Looking for $loc_file in directory $value.)"
4109 value="$value/$loc_file"
4110 ansexp="$ansexp/$loc_file"
4112 if test -f "$ansexp"; then
4115 case "$nopath_ok" in
4116 true) case "$value" in
4118 *) echo "Assuming $value will be in people's path."
4134 if test "$fastread" = yes; then
4139 rp="$what $value doesn't exist. Use that name anyway?"
4158 test "X$gfpthkeep" != Xy && gfpth=""
4161 : determine root of directory hierarchy where package will be installed.
4164 dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4167 dflt=`echo "$prefix" | sed 's/.$//'`
4175 By default, $package will be installed in $dflt/bin, manual pages
4176 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4177 installation directories. Typically this is something like /usr/local.
4178 If you wish to have binaries under /usr/bin but other parts of the
4179 installation under /usr/local, that's ok: you will be prompted
4180 separately for each of the installation directories, the prefix being
4181 only used to set the defaults.
4185 rp='Installation prefix to use?'
4193 *) oldprefix="$prefix";;
4200 : allow them to override the AFS root
4203 *) afsroot=$afsroot ;;
4209 $define|true) afs=true ;;
4210 $undef|false) afs=false ;;
4211 *) if $test -d $afsroot; then
4219 echo "AFS may be running... I'll be extra cautious then..." >&4
4221 echo "AFS does not seem to be running..." >&4
4224 : determine installation prefix for where package is to be installed.
4228 Since you are running AFS, I need to distinguish the directory in which
4229 files will reside from the directory in which they are installed (and from
4230 which they are presumably copied to the former directory by occult means).
4233 case "$installprefix" in
4234 '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4235 *) dflt="$installprefix";;
4240 In some special cases, particularly when building $package for distribution,
4241 it is convenient to distinguish the directory in which files should be
4242 installed from the directory ($prefix) in which they will
4243 eventually reside. For most users, these two directories are the same.
4246 case "$installprefix" in
4248 *) dflt=$installprefix;;
4252 rp='What installation prefix should I use for installing files?'
4254 installprefix="$ans"
4255 installprefixexp="$ansexp"
4257 : Perform the prefixexp/installprefixexp correction if necessary
4258 cat <<EOS >installprefix
4261 cat <<'EOSC' >>installprefix
4262 : Change installation prefix, if necessary.
4263 if $test X"$prefix" != X"$installprefix"; then
4264 eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4266 eval "install${prefixvar}=\"\$${prefixvar}exp\""
4269 chmod +x installprefix
4270 $eunicefix installprefix
4272 : Set variables such as privlib and privlibexp from the output of ./getfile
4273 : performing the prefixexp/installprefixexp correction if necessary.
4274 cat <<EOS >setprefixvar
4277 cat <<'EOSC' >>setprefixvar
4278 eval "${prefixvar}=\"\$ans\""
4279 eval "${prefixvar}exp=\"\$ansexp\""
4282 chmod +x setprefixvar
4283 $eunicefix setprefixvar
4285 : set up the script used to warn in case of inconsistency
4294 '') echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4296 *) echo "Hmm. Based on the hints in hints/$hintfile.sh, " >&4
4297 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4302 echo "*** WHOA THERE!!! ***" >&4
4303 echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
4306 rp=" Keep the $hint value?"
4309 y) td=$was; tu=$was;;
4313 : function used to set '$1' to '$val'
4314 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4316 $define$undef) . ./whoa; eval "$var=\$td";;
4317 $undef$define) . ./whoa; eval "$var=\$tu";;
4318 *) eval "$var=$val";;
4321 : get the patchlevel
4323 echo "Getting the current patchlevel..." >&4
4324 if $test -r $rsrc/patchlevel.h;then
4325 revision=`awk '/define[ ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4326 patchlevel=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4327 subversion=`awk '/define[ ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4328 api_revision=`awk '/define[ ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4329 api_version=`awk '/define[ ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4330 api_subversion=`awk '/define[ ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4331 perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4340 $echo "(You do not have patchlevel.h. Eek.)"
4342 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4343 version_patchlevel_string="version $patchlevel subversion $subversion"
4344 case "$perl_patchlevel" in
4346 *) perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4347 version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4351 $echo "(You have $package $version_patchlevel_string.)"
4355 : XXX Should be a Configure test for double-dots in filenames.
4356 version=`echo $revision $patchlevel $subversion | \
4357 $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
4358 api_versionstring=`echo $api_revision $api_version $api_subversion | \
4359 $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
4362 version=`echo $revision $patchlevel $subversion | \
4363 $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
4364 api_versionstring=`echo $api_revision $api_version $api_subversion | \
4365 $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
4368 : Special case the 5.005_xx maintenance series, which used 5.005
4369 : without any subversion label as a subdirectory in $sitelib
4370 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4371 api_versionstring='5.005'
4374 : Do we want threads support and if so, what type
4375 case "$usethreads" in
4376 $define|true|[yY]*) dflt='y';;
4377 *) # Catch case where user specified ithreads or 5005threads but
4378 # forgot -Dusethreads (A.D. 4/2002)
4379 case "$useithreads$use5005threads" in
4380 *$define*) dflt='y';;
4387 Perl can be built to offer a form of threading support on some systems
4388 To do so, Configure can be run with -Dusethreads.
4390 Note that Perl built with threading support runs slightly slower
4391 and uses slightly more memory than plain Perl.
4393 If this doesn't make any sense to you, just accept the default '$dflt'.
4395 rp='Build a threading Perl?'
4398 y|Y) val="$define" ;;
4404 if $test $patchlevel -lt 9; then
4405 case "$usethreads" in
4407 : Default to ithreads unless overridden on command line or with
4410 case "$use5005threads" in
4412 echo "5.005 threads are no longer supported"
4416 case "$useithreads" in
4417 $undef|false|[nN]*) dflt='n';;
4419 rp='Use the newer interpreter-based ithreads?'
4422 y|Y) val="$define" ;;
4427 : Now set use5005threads to the opposite value.
4428 case "$useithreads" in
4429 $define) val="$undef" ;;
4436 useithreads="$undef"
4437 use5005threads="$undef"
4441 case "$useithreads$use5005threads" in
4445 You cannot have both the ithreads and the 5.005 threads enabled
4446 at the same time. Disabling the 5.005 threads since they are
4447 much less stable than the ithreads.
4450 use5005threads="$undef"
4455 : perl-5.9.x and later
4457 if test X"$usethreads" = "X$define"; then
4458 case "$use5005threads" in
4462 5.005 threads has been removed for 5.10. Perl will be built using ithreads.
4469 use5005threads="$undef"
4470 useithreads="$usethreads"
4473 case "$d_oldpthreads" in
4474 '') : Configure tests would be welcome here. For now, assume undef.
4476 *) val="$d_oldpthreads" ;;
4482 : Look for a hint-file generated 'call-back-unit'. If the
4483 : user has specified that a threading perl is to be built,
4484 : we may need to set or change some other defaults.
4485 if $test -f usethreads.cbu; then
4486 echo "Your platform has some specific hints regarding threaded builds, using them..."
4489 case "$usethreads" in
4490 "$define"|true|[yY]*)
4492 (Your platform does not have any specific hints for threaded builds.
4493 Assuming POSIX threads, then.)
4499 : Check if multiplicity is required
4502 Perl can be built so that multiple Perl interpreters can coexist
4503 within the same Perl executable.
4506 case "$useithreads" in
4509 This multiple interpreter support is required for interpreter-based threads.
4513 *) case "$usemultiplicity" in
4514 $define|true|[yY]*) dflt='y';;
4518 echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4519 rp='Build Perl for multiplicity?'
4522 y|Y) val="$define" ;;
4530 : Check if morebits is requested
4531 case "$usemorebits" in
4532 "$define"|true|[yY]*)
4533 use64bitint="$define"
4534 uselongdouble="$define"
4535 usemorebits="$define"
4537 *) usemorebits="$undef"
4541 : Determine the C compiler to be used
4547 rp="Use which C compiler?"
4551 : See whether they have no cc but they do have gcc
4553 if $test -f cc.cbu; then
4558 : make some quick guesses about what we are up against
4560 $echo $n "Hmm... $c"
4570 $cat $sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h >foo 2>/dev/null
4571 if test -f /osf_boot || $contains 'OSF/1' $sysroot/usr/include/ctype.h >/dev/null 2>&1
4573 echo "Looks kind of like an OSF/1 system, but we'll see..."
4575 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4576 xxx=`./loc addbib blurfl $pth`
4577 if $test -f $xxx; then
4578 echo "Looks kind of like a USG system with BSD features, but we'll see..."
4582 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4583 echo "Looks kind of like an extended USG system, but we'll see..."
4585 echo "Looks kind of like a USG system, but we'll see..."
4589 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4590 echo "Looks kind of like a BSD system, but we'll see..."
4594 echo "Looks kind of like a Version 7 system, but we'll see..."
4597 case "$eunicefix" in
4600 There is, however, a strange, musty smell in the air that reminds me of
4601 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4605 : it so happens the Eunice I know will not run shell scripts in Unix format
4609 echo "Congratulations. You aren't running Eunice."
4613 : Detect OS2. The p_ variable is set above in the Head.U unit.
4614 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4615 : semicolon as a patch separator
4620 I have the feeling something is not exactly right, however...don't tell me...
4621 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4622 (Or you may be running DOS with DJGPP.)
4627 if test -f /xenix; then
4628 echo "Actually, this looks more like a XENIX system..."
4633 echo "It's not Xenix..."
4638 if test -f /venix; then
4639 echo "Actually, this looks more like a VENIX system..."
4646 echo "Nor is it Venix..."
4649 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4650 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4653 : Check if we are using GNU gcc and what its version is
4655 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4659 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4661 printf("%s\n", __VERSION__);
4663 printf("%s\n", "1");
4669 if $cc -o try $ccflags $ldflags try.c; then
4670 gccversion=`$run ./try`
4671 case "$gccversion" in
4672 '') echo "You are not using GNU cc." ;;
4673 *) echo "You are using GNU cc $gccversion."
4679 echo "*** WHOA THERE!!! ***" >&4
4680 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
4681 case "$knowitall" in
4683 echo " You'd better start hunting for one and let me know about it." >&4
4689 case "$gccversion" in
4690 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4692 case "$gccversion" in
4693 '') gccosandvers='' ;;
4694 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4695 gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4697 case "$gccosandvers" in
4698 $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4699 $osname$osvers) ;; # looking good
4700 $osname*) cat <<EOM >&4
4702 *** WHOA THERE!!! ***
4704 Your gcc has not been compiled for the exact release of
4705 your operating system ($gccosandvers versus $osname$osvers).
4707 In general it is a good idea to keep gcc synchronized with
4708 the operating system because otherwise serious problems
4709 may ensue when trying to compile software, like Perl.
4711 I'm trying to be optimistic here, though, and will continue.
4712 If later during the configuration and build icky compilation
4713 problems appear (headerfile conflicts being the most common
4714 manifestation), I suggest reinstalling the gcc to match
4715 your operating system release.
4719 *) gccosandvers='' ;; # failed to parse, better be silent
4727 # gcc 3.* complain about adding -Idirectories that they already know about,
4728 # so we will take those off from locincpth.
4729 case "$gccversion" in
4731 echo "main(){}">try.c
4732 for incdir in $locincpth; do
4733 warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4734 grep '^c[cp]p*[01]: warning: changing search order '`
4735 if test "X$warn" != X; then
4736 locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4742 # gcc 4.9 by default does some optimizations that break perl.
4743 # see ticket 121505.
4745 # The -fwrapv disables those optimizations (and probably others,) so
4746 # for gcc 4.9 (and later, since the optimizations probably won't go
4747 # away), add -fwrapv unless the user requests -fno-wrapv, which
4748 # disables -fwrapv, or if the user requests -fsanitize=undefined,
4749 # which turns the overflows -fwrapv ignores into runtime errors.
4750 case "$gccversion" in
4751 4.[3-9].*|4.[1-9][0-9]*|[5-9].*|[1-9][0-9]*)
4753 *-fno-wrapv*|*-fsanitize=undefined*|*-fwrapv*) ;;
4754 *) ccflags="$ccflags -fwrapv" ;;
4758 : What should the include directory be ?
4759 : Use sysroot if set, so findhdr looks in the right place.
4761 $echo $n "Hmm... $c"
4762 dflt="$sysroot/usr/include"
4765 if $test -f /bin/mips && /bin/mips; then
4766 echo "Looks like a MIPS system..."
4767 $cat >usr.c <<'EOCP'
4768 #ifdef SYSTYPE_BSD43
4772 if $cc $cppflags -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4773 dflt='/bsd43/usr/include'
4777 mips_type='System V'
4779 $rm -f usr.c usr.out
4780 echo "and you're compiling with the $mips_type compiler and libraries."
4784 echo "Doesn't look like a MIPS system."
4794 case "$xxx_prompt" in
4797 rp='Where are the include files you want to use?'
4805 : see how we invoke the C preprocessor
4807 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4808 cat <<'EOT' >testcpp.c
4814 if test ! -f cppstdin; then
4815 if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4816 # AIX cc -E doesn't show the absolute headerfile
4817 # locations but we'll cheat by using the -M flag.
4818 echo 'cat >.$$.c; rm -f .$$.u; '"$cc"' ${1+"$@"} -M -c .$$.c 2>/dev/null; test -s .$$.u && awk '"'"'$2 ~ /\.h$/ { print "# 0 \""$2"\"" }'"'"' .$$.u; rm -f .$$.o .$$.u; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' > cppstdin
4820 echo 'cat >.$$.c; '"$cc $cppflags"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4823 echo "Keeping your $hint cppstdin wrapper."
4826 wrapper=`pwd`/cppstdin
4830 if $test "X$cppstdin" != "X" && \
4831 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4832 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4834 echo "You used to use $cppstdin $cppminus so we'll use that again."
4836 '') echo "But let's see if we can live without a wrapper..." ;;
4838 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4839 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4841 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4844 echo "(However, $cpprun $cpplast does not work, let's see...)"