# $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
#
-# Generated on Tue Apr 15 20:24:36 EET DST 2003 [metaconfig 3.0 PL70]
+# Generated on Tue Apr 15 21:03:52 EET DST 2003 [metaconfig 3.0 PL70]
# (with additional metaconfig patches by perlbug@perl.org)
cat >c1$$ <<EOF
esac
$rm -f try.* try
+: determine the architecture name
echo " "
-echo "Checking for GNU C Library..." >&4
-cat >try.c <<'EOCP'
-/* Find out version of GNU C library. __GLIBC__ and __GLIBC_MINOR__
- alone are insufficient to distinguish different versions, such as
- 2.0.6 and 2.0.7. The function gnu_get_libc_version() appeared in
- libc version 2.1.0. A. Dougherty, June 3, 2002.
-*/
-#include <stdio.h>
-int main(void)
-{
-#ifdef __GLIBC__
-# ifdef __GLIBC_MINOR__
-# if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
-# include <gnu/libc-version.h>
- printf("%s\n", gnu_get_libc_version());
-# else
- printf("%d.%d\n", __GLIBC__, __GLIBC_MINOR__);
-# endif
-# else
- printf("%d\n", __GLIBC__);
-# endif
- return 0;
-#else
- return 1;
-#endif
-}
-EOCP
-set try
-if eval $compile_ok && $run ./try > glibc.ver; then
- val="$define"
- gnulibc_version=`$cat glibc.ver`
- echo "You are using the GNU C Library version $gnulibc_version"
+if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
+ tarch=`arch`"-$osname"
+elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
+ if uname -m > tmparch 2>&1 ; then
+ tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
+ -e 's/$/'"-$osname/" tmparch`
+ else
+ tarch="$osname"
+ fi
+ $rm -f tmparch
else
- val="$undef"
- gnulibc_version=''
- echo "You are not using the GNU C Library"
+ tarch="$osname"
fi
-$rm -f try try.* glibc.ver
-set d_gnulibc
-eval $setvar
-
-: see if nm is to be used to determine whether a symbol is defined or not
-case "$usenm" in
-'')
- dflt=''
- case "$d_gnulibc" in
- "$define")
- echo " "
- echo "nm probably won't work on the GNU C Library." >&4
- dflt=n
+case "$myarchname" in
+''|"$tarch") ;;
+*)
+ echo "(Your architecture name used to be $myarchname.)"
+ archname=''
+ ;;
+esac
+case "$targetarch" in
+'') ;;
+*) archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
+esac
+myarchname="$tarch"
+case "$archname" in
+'') dflt="$tarch";;
+*) dflt="$archname";;
+esac
+rp='What is your architecture name'
+. ./myread
+archname="$ans"
+case "$usethreads" in
+$define)
+ echo "Threads selected." >&4
+ case "$archname" in
+ *-thread*) echo "...and architecture name already has -thread." >&4
+ ;;
+ *) archname="$archname-thread"
+ echo "...setting architecture name to $archname." >&4
+ ;;
+ esac
+ ;;
+esac
+case "$usemultiplicity" in
+$define)
+ echo "Multiplicity selected." >&4
+ case "$archname" in
+ *-multi*) echo "...and architecture name already has -multi." >&4
+ ;;
+ *) archname="$archname-multi"
+ echo "...setting architecture name to $archname." >&4
+ ;;
+ esac
+ ;;
+esac
+case "$use64bitint$use64bitall" in
+*"$define"*)
+ case "$archname64" in
+ '')
+ echo "This architecture is naturally 64-bit, not changing architecture name." >&4
;;
- esac
- case "$dflt" in
- '')
- if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
- echo " "
- echo "Whoops! This is an AIX system without /lib/syscalls.exp!" >&4
- echo "'nm' won't be sufficient on this sytem." >&4
- dflt=n
- fi
+ *)
+ case "$use64bitint" in
+ "$define") echo "64 bit integers selected." >&4 ;;
+ esac
+ case "$use64bitall" in
+ "$define") echo "Maximal 64 bitness selected." >&4 ;;
+ esac
+ case "$archname" in
+ *-$archname64*) echo "...and architecture name already has $archname64." >&4
+ ;;
+ *) archname="$archname-$archname64"
+ echo "...setting architecture name to $archname." >&4
+ ;;
+ esac
;;
esac
- case "$dflt" in
- '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
- if $test $dflt -gt 20; then
- dflt=y
- else
- dflt=n
- fi
+esac
+case "$uselongdouble" in
+$define)
+ echo "Long doubles selected." >&4
+ case "$longdblsize" in
+ $doublesize)
+ echo "...but long doubles are equal to doubles, not changing architecture name." >&4
+ ;;
+ *)
+ case "$archname" in
+ *-ld*) echo "...and architecture name already has -ld." >&4
+ ;;
+ *) archname="$archname-ld"
+ echo "...setting architecture name to $archname." >&4
+ ;;
+ esac
;;
esac
;;
+esac
+case "$useperlio" in
+$define)
+ echo "Perlio selected." >&4
+ ;;
*)
- case "$usenm" in
- true|$define) dflt=y;;
- *) dflt=n;;
- esac
+ echo "Perlio not selected, using stdio." >&4
+ case "$archname" in
+ *-stdio*) echo "...and architecture name already has -stdio." >&4
+ ;;
+ *) archname="$archname-stdio"
+ echo "...setting architecture name to $archname." >&4
+ ;;
+ esac
;;
esac
-$cat <<EOM
-I can use $nm to extract the symbols from your C libraries. This
-is a time consuming task which may generate huge output on the disk (up
-to 3 megabytes) but that should make the symbols extraction faster. The
-alternative is to skip the 'nm' extraction part and to compile a small
-test program instead to determine whether each symbol is present. If
-you have a fast C compiler and/or if your 'nm' output cannot be parsed,
-this may be the best solution.
+: determine root of directory hierarchy where package will be installed.
+case "$prefix" in
+'')
+ dflt=`./loc . /usr/local /usr/local /local /opt /usr`
+ ;;
+*?/)
+ dflt=`echo "$prefix" | sed 's/.$//'`
+ ;;
+*)
+ dflt="$prefix"
+ ;;
+esac
+$cat <<EOM
-You probably shouldn't let me use 'nm' if you are using the GNU C Library.
+By default, $package will be installed in $dflt/bin, manual pages
+under $dflt/man, etc..., i.e. with $dflt as prefix for all
+installation directories. Typically this is something like /usr/local.
+If you wish to have binaries under /usr/bin but other parts of the
+installation under /usr/local, that's ok: you will be prompted
+separately for each of the installation directories, the prefix being
+only used to set the defaults.
EOM
-rp="Shall I use $nm to extract C symbols from the libraries?"
-. ./myread
-case "$ans" in
-[Nn]*) usenm=false;;
-*) usenm=true;;
+fn=d~
+rp='Installation prefix to use?'
+. ./getfile
+oldprefix=''
+case "$prefix" in
+'') ;;
+*)
+ case "$ans" in
+ "$prefix") ;;
+ *) oldprefix="$prefix";;
+ esac
+ ;;
esac
+prefix="$ans"
+prefixexp="$ansexp"
-runnm=$usenm
-case "$reuseval" in
-true) runnm=false;;
+case "$afsroot" in
+'') afsroot=/afs ;;
+*) afsroot=$afsroot ;;
esac
-: nm options which may be necessary
-case "$nm_opt" in
-'') if $test -f /mach_boot; then
- nm_opt='' # Mach
- elif $test -d /usr/ccs/lib; then
- nm_opt='-p' # Solaris (and SunOS?)
- elif $test -f /dgux; then
- nm_opt='-p' # DG-UX
- elif $test -f /lib64/rld; then
- nm_opt='-p' # 64-bit Irix
+: is AFS running?
+echo " "
+case "$afs" in
+$define|true) afs=true ;;
+$undef|false) afs=false ;;
+*) if test -d $afsroot; then
+ afs=true
else
- nm_opt=''
- fi;;
+ afs=false
+ fi
+ ;;
esac
-
-: nm options which may be necessary for shared libraries but illegal
-: for archive libraries. Thank you, Linux.
-case "$nm_so_opt" in
-'') case "$myuname" in
- *linux*)
- if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
- nm_so_opt='--dynamic'
- fi
- ;;
- esac
- ;;
-esac
-
-case "$runnm" in
-true)
-: get list of predefined functions in a handy place
-echo " "
-case "$libc" in
-'') libc=unknown
- case "$libs" in
- *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
- esac
- ;;
-esac
-case "$libs" in
-'') ;;
-*) for thislib in $libs; do
- case "$thislib" in
- -lc|-lc_s)
- : Handle C library specially below.
- ;;
- -l*)
- thislib=`echo $thislib | $sed -e 's/^-l//'`
- if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
- :
- elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
- :
- elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
- :
- elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
- :
- elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
- :
- elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
- :
- elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
- :
- else
- try=''
- fi
- libnames="$libnames $try"
- ;;
- *) libnames="$libnames $thislib" ;;
- esac
- done
- ;;
-esac
-xxx=normal
-case "$libc" in
-unknown)
- set /lib/libc.$so
- for xxx in $libpth; do
- $test -r $1 || set $xxx/libc.$so
- : The messy sed command sorts on library version numbers.
- $test -r $1 || \
- set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
- tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
- h
- s/[0-9][0-9]*/0000&/g
- s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
- G
- s/\n/ /' | \
- $sort | $sed -e 's/^.* //'`
- eval set \$$#
- done
- $test -r $1 || set /usr/ccs/lib/libc.$so
- $test -r $1 || set /lib/libsys_s$_a
- ;;
-*)
- set blurfl
- ;;
-esac
-if $test -r "$1"; then
- echo "Your (shared) C library seems to be in $1."
- libc="$1"
-elif $test -r /lib/libc && $test -r /lib/clib; then
- echo "Your C library seems to be in both /lib/clib and /lib/libc."
- xxx=apollo
- libc='/lib/clib /lib/libc'
- if $test -r /lib/syslib; then
- echo "(Your math library is in /lib/syslib.)"
- libc="$libc /lib/syslib"
- fi
-elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
- echo "Your C library seems to be in $libc, as you said before."
-elif $test -r $incpath/usr/lib/libc$_a; then
- libc=$incpath/usr/lib/libc$_a;
- echo "Your C library seems to be in $libc. That's fine."
-elif $test -r /lib/libc$_a; then
- libc=/lib/libc$_a;
- echo "Your C library seems to be in $libc. You're normal."
-else
- if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
- :
- elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
- libnames="$libnames "`./loc clib blurfl/dyick $libpth`
- elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
- :
- elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
- :
- elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
- :
- else
- tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
- fi
- if $test -r "$tans"; then
- echo "Your C library seems to be in $tans, of all places."
- libc=$tans
- else
- libc='blurfl'
- fi
-fi
-if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
- dflt="$libc"
- cat <<EOM
-
-If the guess above is wrong (which it might be if you're using a strange
-compiler, or your machine supports multiple models), you can override it here.
-
-EOM
-else
- dflt=''
- echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
- cat >&4 <<EOM
-I can't seem to find your C library. I've looked in the following places:
-
-EOM
- $sed 's/^/ /' libpath
- cat <<EOM
-
-None of these seems to contain your C library. I need to get its name...
-
-EOM
-fi
-fn=f
-rp='Where is your C library?'
-. ./getfile
-libc="$ans"
-
-echo " "
-echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
-set X `cat libnames`
-shift
-xxx=files
-case $# in 1) xxx=file; esac
-echo "Extracting names from the following $xxx for later perusal:" >&4
-echo " "
-$sed 's/^/ /' libnames >&4
-echo " "
-$echo $n "This may take a while...$c" >&4
-
-for file in $*; do
- case $file in
- *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
- *) $nm $nm_opt $file 2>/dev/null;;
- esac
-done >libc.tmp
-
-$echo $n ".$c"
-$grep fprintf libc.tmp > libc.ptf
-xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
-xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
-xxx='[ADTSIW]'
-if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *_[_.]*//p' -e 's/^.* $xxx *//p'";\
- eval $xscan;\
- $contains '^fprintf$' libc.list >/dev/null 2>&1; then
- eval $xrun
-elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
- eval $xscan;\
- $contains '^fprintf$' libc.list >/dev/null 2>&1; then
- eval $xrun
-elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
- eval $xscan;\
- $contains '^fprintf$' libc.list >/dev/null 2>&1; then
- eval $xrun
-elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
- eval $xscan;\
- $contains '^fprintf$' libc.list >/dev/null 2>&1; then
- eval $xrun
-elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
- eval $xscan;\
- $contains '^fprintf$' libc.list >/dev/null 2>&1; then
- eval $xrun
-elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
- eval $xscan;\
- $contains '^fprintf$' libc.list >/dev/null 2>&1; then
- eval $xrun
-elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
- -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
- eval $xscan;\
- $contains '^fprintf$' libc.list >/dev/null 2>&1; then
- eval $xrun
-elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
- eval $xscan;\
- $contains '^fprintf$' libc.list >/dev/null 2>&1; then
- eval $xrun
-elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
- eval $xscan;\
- $contains '^fprintf$' libc.list >/dev/null 2>&1; then
- eval $xrun
-elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
- eval $xscan;\
- $contains '^fprintf$' libc.list >/dev/null 2>&1; then
- eval $xrun
-elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
- eval $xscan;\
- $contains '^fprintf$' libc.list >/dev/null 2>&1; then
- eval $xrun
-elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
- eval $xscan;\
- $contains '^fprintf$' libc.list >/dev/null 2>&1; then
- eval $xrun
-elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
- eval $xscan;\
- $contains '^fprintf$' libc.list >/dev/null 2>&1; then
- eval $xrun
-elif com="sed -n -e 's/^__.*//' -e 's/[ ]*D[ ]*[0-9]*.*//p'";\
- eval $xscan;\
- $contains '^fprintf$' libc.list >/dev/null 2>&1; then
- eval $xrun
-else
- $nm -p $* 2>/dev/null >libc.tmp
- $grep fprintf libc.tmp > libc.ptf
- if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
- eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
- then
- nm_opt='-p'
- eval $xrun
- else
- echo " "
- echo "$nm didn't seem to work right. Trying $ar instead..." >&4
- com=''
- if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
- for thisname in $libnames $libc; do
- $ar t $thisname >>libc.tmp
- done
- $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
- echo "Ok." >&4
- elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
- # Repeat libc to extract forwarders to DLL entries too
- for thisname in $libnames $libc; do
- $ar tv $thisname >>libc.tmp
- # Revision 50 of EMX has bug in $ar.
- # it will not extract forwarders to DLL entries
- # Use emximp which will extract exactly them.
- emximp -o tmp.imp $thisname \
- 2>/dev/null && \
- $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
- < tmp.imp >>libc.tmp
- $rm tmp.imp
- done
- $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
- echo "Ok." >&4
- else
- echo "$ar didn't seem to work right." >&4
- echo "Maybe this is a Cray...trying bld instead..." >&4
- if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
- then
- for thisname in $libnames; do
- bld t $libnames | \
- $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
- $ar t $thisname >>libc.tmp
- done
- echo "Ok." >&4
- else
- echo "That didn't work either. Giving up." >&4
- exit 1
- fi
- fi
- fi
-fi
-nm_extract="$com"
-case "$PASE" in
-define)
- echo " "
- echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
- dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
- ;;
-*) if $test -f /lib/syscalls.exp; then
- echo " "
- echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
- $sed -n 's/^\([^ ]*\)[ ]*syscall[0-9]*[ ]*$/\1/p' /lib/syscalls.exp >>libc.list
- fi
- ;;
-esac
-;;
-esac
-$rm -f libnames libpath
-
-: is a C symbol defined?
-csym='tlook=$1;
-case "$3" in
--v) tf=libc.tmp; tc=""; tdc="";;
--a) tf=libc.tmp; tc="[0]"; tdc="[]";;
-*) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
-esac;
-tx=yes;
-case "$reuseval-$4" in
-true-) ;;
-true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
-esac;
-case "$tx" in
-yes)
- case "$runnm" in
- true)
- if $contains $tlook $tf >/dev/null 2>&1;
- then tval=true;
- else tval=false;
- fi;;
- *)
- echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
- if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
- then tval=true;
- else tval=false;
- fi;
- $rm -f t t.c;;
- esac;;
-*)
- case "$tval" in
- $define) tval=true;;
- *) tval=false;;
- esac;;
-esac;
-eval "$2=$tval"'
-
-: define an is-in-libc? function
-inlibc='echo " "; td=$define; tu=$undef;
-sym=$1; var=$2; eval "was=\$$2";
-tx=yes;
-case "$reuseval$was" in
-true) ;;
-true*) tx=no;;
-esac;
-case "$tx" in
-yes)
- set $sym tres -f;
- eval $csym;
- case "$tres" in
- true)
- echo "$sym() found." >&4;
- case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
- *)
- echo "$sym() NOT found." >&4;
- case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
- esac;;
-*)
- case "$was" in
- $define) echo "$sym() found." >&4;;
- *) echo "$sym() NOT found." >&4;;
- esac;;
-esac'
-
-: see if sqrtl exists
-set sqrtl d_sqrtl
-eval $inlibc
-
-hasproto='varname=$1; func=$2; shift; shift;
-while $test $# -ge 2; do
- case "$1" in
- $define) echo "#include <$2>";;
- esac ;
- shift 2;
-done > try.c;
-$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
-if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
- echo "$func() prototype found.";
- val="$define";
-else
- echo "$func() prototype NOT found.";
- val="$undef";
-fi;
-set $varname;
-eval $setvar;
-$rm -f try.c tryout.c'
-
-echo " "
-
-if $test X"$d_longdbl" = X"$define"; then
-
-echo "Checking how to print long doubles..." >&4
-
-if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
- $cat >try.c <<'EOCP'
-#include <sys/types.h>
-#include <stdio.h>
-int main() {
- double d = 123.456;
- printf("%.3f\n", d);
-}
-EOCP
- set try
- if eval $compile; then
- yyy=`$run ./try`
- case "$yyy" in
- 123.456)
- sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
- sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
- echo "We will use %f."
- ;;
- esac
- fi
-fi
-
-if $test X"$sPRIfldbl" = X; then
- $cat >try.c <<'EOCP'
-#include <sys/types.h>
-#include <stdio.h>
-int main() {
- long double d = 123.456;
- printf("%.3Lf\n", d);
-}
-EOCP
- set try
- if eval $compile; then
- yyy=`$run ./try`
- case "$yyy" in
- 123.456)
- sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
- sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
- echo "We will use %Lf."
- ;;
- esac
- fi
-fi
-
-if $test X"$sPRIfldbl" = X; then
- $cat >try.c <<'EOCP'
-#include <sys/types.h>
-#include <stdio.h>
-int main() {
- long double d = 123.456;
- printf("%.3llf\n", d);
-}
-EOCP
- set try
- if eval $compile; then
- yyy=`$run ./try`
- case "$yyy" in
- 123.456)
- sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
- sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
- echo "We will use %llf."
- ;;
- esac
- fi
-fi
-
-if $test X"$sPRIfldbl" = X; then
- $cat >try.c <<'EOCP'
-#include <sys/types.h>
-#include <stdio.h>
-int main() {
- long double d = 123.456;
- printf("%.3lf\n", d);
-}
-EOCP
- set try
- if eval $compile; then
- yyy=`$run ./try`
- case "$yyy" in
- 123.456)
- sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
- sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
- echo "We will use %lf."
- ;;
- esac
- fi
-fi
-
-if $test X"$sPRIfldbl" = X; then
- echo "Cannot figure out how to print long doubles." >&4
-else
- sSCNfldbl=$sPRIfldbl # expect consistency
-fi
-
-$rm -f try try.*
-
-fi # d_longdbl
-
-case "$sPRIfldbl" in
-'') d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
- d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
- d_SCNfldbl="$undef";
- ;;
-*) d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
- d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
- d_SCNfldbl="$define";
- ;;
-esac
-
-: see if modfl exists
-set modfl d_modfl
-eval $inlibc
-
-: see if prototype for modfl is available
-echo " "
-set d_modflproto modfl math.h
-eval $hasproto
-
-d_modfl_pow32_bug="$undef"
-
-case "$d_longdbl$d_modfl" in
-$define$define)
- $cat <<EOM
-Checking to see whether your modfl() is okay for large values...
-EOM
-$cat >try.c <<EOCP
-#include <math.h>
-#include <stdio.h>
-EOCP
-if $test "X$d_modflproto" != "X$define"; then
- $cat >>try.c <<EOCP
-/* Sigh. many current glibcs provide the function, but do not prototype it. */
-long double modfl (long double, long double *);
-EOCP
-fi
-$cat >>try.c <<EOCP
-int main() {
- long double nv = 4294967303.15;
- long double v, w;
- v = modfl(nv, &w);
-#ifdef __GLIBC__
- printf("glibc");
-#endif
- printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
- return 0;
-}
-EOCP
- case "$osname:$gccversion" in
- aix:) saveccflags="$ccflags"
- ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
- esac
- set try
- if eval $compile; then
- foo=`$run ./try`
- case "$foo" in
- *" 4294967303.150000 1.150000 4294967302.000000")
- echo >&4 "Your modfl() is broken for large values."
- d_modfl_pow32_bug="$define"
- case "$foo" in
- glibc) echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
- ;;
- esac
- ;;
- *" 4294967303.150000 0.150000 4294967303.000000")
- echo >&4 "Your modfl() seems okay for large values."
- ;;
- *) echo >&4 "I don't understand your modfl() at all."
- d_modfl="$undef"
- ;;
- esac
- $rm -f try.* try core core.try.*
- else
- echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
- d_modfl="$undef"
- fi
- case "$osname:$gccversion" in
- aix:) ccflags="$saveccflags" ;; # restore
- esac
- ;;
-esac
-
-: see if aintl exists
-set aintl d_aintl
-eval $inlibc
-
-: see if copysignl exists
-set copysignl d_copysignl
-eval $inlibc
-
-: determine the architecture name
-echo " "
-if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
- tarch=`arch`"-$osname"
-elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
- if uname -m > tmparch 2>&1 ; then
- tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
- -e 's/$/'"-$osname/" tmparch`
- else
- tarch="$osname"
- fi
- $rm -f tmparch
-else
- tarch="$osname"
-fi
-case "$myarchname" in
-''|"$tarch") ;;
-*)
- echo "(Your architecture name used to be $myarchname.)"
- archname=''
- ;;
-esac
-case "$targetarch" in
-'') ;;
-*) archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
-esac
-myarchname="$tarch"
-case "$archname" in
-'') dflt="$tarch";;
-*) dflt="$archname";;
-esac
-rp='What is your architecture name'
-. ./myread
-archname="$ans"
-case "$usethreads" in
-$define)
- echo "Threads selected." >&4
- case "$archname" in
- *-thread*) echo "...and architecture name already has -thread." >&4
- ;;
- *) archname="$archname-thread"
- echo "...setting architecture name to $archname." >&4
- ;;
- esac
- ;;
-esac
-case "$usemultiplicity" in
-$define)
- echo "Multiplicity selected." >&4
- case "$archname" in
- *-multi*) echo "...and architecture name already has -multi." >&4
- ;;
- *) archname="$archname-multi"
- echo "...setting architecture name to $archname." >&4
- ;;
- esac
- ;;
-esac
-case "$use64bitint$use64bitall" in
-*"$define"*)
- case "$archname64" in
- '')
- echo "This architecture is naturally 64-bit, not changing architecture name." >&4
- ;;
- *)
- case "$use64bitint" in
- "$define") echo "64 bit integers selected." >&4 ;;
- esac
- case "$use64bitall" in
- "$define") echo "Maximal 64 bitness selected." >&4 ;;
- esac
- case "$archname" in
- *-$archname64*) echo "...and architecture name already has $archname64." >&4
- ;;
- *) archname="$archname-$archname64"
- echo "...setting architecture name to $archname." >&4
- ;;
- esac
- ;;
- esac
-esac
-case "$uselongdouble" in
-$define)
- echo "Long doubles selected." >&4
- case "$longdblsize" in
- $doublesize)
- echo "...but long doubles are equal to doubles, not changing architecture name." >&4
- ;;
- *)
- case "$archname" in
- *-ld*) echo "...and architecture name already has -ld." >&4
- ;;
- *) archname="$archname-ld"
- echo "...setting architecture name to $archname." >&4
- ;;
- esac
- ;;
- esac
- ;;
-esac
-case "$useperlio" in
-$define)
- echo "Perlio selected." >&4
- ;;
-*)
- echo "Perlio not selected, using stdio." >&4
- case "$archname" in
- *-stdio*) echo "...and architecture name already has -stdio." >&4
- ;;
- *) archname="$archname-stdio"
- echo "...setting architecture name to $archname." >&4
- ;;
- esac
- ;;
-esac
-
-: determine root of directory hierarchy where package will be installed.
-case "$prefix" in
-'')
- dflt=`./loc . /usr/local /usr/local /local /opt /usr`
- ;;
-*?/)
- dflt=`echo "$prefix" | sed 's/.$//'`
- ;;
-*)
- dflt="$prefix"
- ;;
-esac
-$cat <<EOM
-
-By default, $package will be installed in $dflt/bin, manual pages
-under $dflt/man, etc..., i.e. with $dflt as prefix for all
-installation directories. Typically this is something like /usr/local.
-If you wish to have binaries under /usr/bin but other parts of the
-installation under /usr/local, that's ok: you will be prompted
-separately for each of the installation directories, the prefix being
-only used to set the defaults.
-
-EOM
-fn=d~
-rp='Installation prefix to use?'
-. ./getfile
-oldprefix=''
-case "$prefix" in
-'') ;;
-*)
- case "$ans" in
- "$prefix") ;;
- *) oldprefix="$prefix";;
- esac
- ;;
-esac
-prefix="$ans"
-prefixexp="$ansexp"
-
-case "$afsroot" in
-'') afsroot=/afs ;;
-*) afsroot=$afsroot ;;
-esac
-
-: is AFS running?
-echo " "
-case "$afs" in
-$define|true) afs=true ;;
-$undef|false) afs=false ;;
-*) if test -d $afsroot; then
- afs=true
- else
- afs=false
- fi
- ;;
-esac
-if $afs; then
- echo "AFS may be running... I'll be extra cautious then..." >&4
-else
- echo "AFS does not seem to be running..." >&4
-fi
+if $afs; then
+ echo "AFS may be running... I'll be extra cautious then..." >&4
+else
+ echo "AFS does not seem to be running..." >&4
+fi
: determine installation prefix for where package is to be installed.
if $afs; then
perl5=$tdir/perl5
break;
fi
- done
+ done
+ ;;
+*) perl5="$perl5"
+ ;;
+esac
+case "$perl5" in
+'') echo "None found. That's ok.";;
+*) echo "Using $perl5." ;;
+esac
+
+: Determine list of previous versions to include in @INC
+$cat > getverlist <<EOPL
+#!$perl5 -w
+use File::Basename;
+\$api_versionstring = "$api_versionstring";
+\$version = "$version";
+\$stem = "$sitelib_stem";
+\$archname = "$archname";
+EOPL
+ $cat >> getverlist <<'EOPL'
+# Can't have leading @ because metaconfig interprets it as a command!
+;@inc_version_list=();
+# XXX Redo to do opendir/readdir?
+if (-d $stem) {
+ chdir($stem);
+ ;@candidates = glob("5.*");
+}
+else {
+ ;@candidates = ();
+}
+
+# XXX ToDo: These comparisons must be reworked when two-digit
+# subversions come along, so that 5.7.10 compares as greater than
+# 5.7.3! By that time, hope that 5.6.x is sufficiently
+# widespread that we can use the built-in version vectors rather
+# than reinventing them here. For 5.6.0, however, we must
+# assume this script will likely be run by 5.005_0x. --AD 1/2000.
+foreach $d (@candidates) {
+ if ($d lt $version) {
+ if ($d ge $api_versionstring) {
+ unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
+ }
+ elsif ($d ge "5.005") {
+ unshift(@inc_version_list, grep { -d } $d);
+ }
+ }
+ else {
+ # Skip newer version. I.e. don't look in
+ # 5.7.0 if we're installing 5.6.1.
+ }
+}
+
+if (@inc_version_list) {
+ print join(' ', @inc_version_list);
+}
+else {
+ # Blank space to preserve value for next Configure run.
+ print " ";
+}
+EOPL
+chmod +x getverlist
+case "$inc_version_list" in
+'') if test -x "$perl5$exe_ext"; then
+ dflt=`$perl5 getverlist`
+ else
+ dflt='none'
+ fi
+ ;;
+$undef) dflt='none' ;;
+*) eval dflt=\"$inc_version_list\" ;;
+esac
+case "$dflt" in
+''|' ') dflt=none ;;
+esac
+case "$dflt" in
+5.005) dflt=none ;;
+esac
+$cat <<EOM
+
+In order to ease the process of upgrading, this version of perl
+can be configured to use modules built and installed with earlier
+versions of perl that were installed under $prefix. Specify here
+the list of earlier versions that this version of perl should check.
+If Configure detected no earlier versions of perl installed under
+$prefix, then the list will be empty. Answer 'none' to tell perl
+to not search earlier versions.
+
+The default should almost always be sensible, so if you're not sure,
+just accept the default.
+EOM
+
+rp='List of earlier versions to include in @INC?'
+. ./myread
+case "$ans" in
+[Nn]one|''|' ') inc_version_list=' ' ;;
+*) inc_version_list="$ans" ;;
+esac
+case "$inc_version_list" in
+''|' ')
+ inc_version_list_init='0';;
+*) inc_version_list_init=`echo $inc_version_list |
+ $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
+ ;;
+esac
+$rm -f getverlist
+
+: determine whether to install perl also as /usr/bin/perl
+
+echo " "
+if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
+ $cat <<EOM
+Many scripts expect perl to be installed as /usr/bin/perl.
+
+If you want to, I can install the perl you are about to compile
+as /usr/bin/perl (in addition to $bin/perl).
+EOM
+ if test -f /usr/bin/perl; then
+ $cat <<EOM
+
+However, please note that because you already have a /usr/bin/perl,
+overwriting that with a new Perl would very probably cause problems.
+Therefore I'm assuming you don't want to do that (unless you insist).
+
+EOM
+ case "$installusrbinperl" in
+ "$define"|[yY]*) dflt='y';;
+ *) dflt='n';;
+ esac
+ else
+ $cat <<EOM
+
+Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
+
+EOM
+ case "$installusrbinperl" in
+ "$undef"|[nN]*) dflt='n';;
+ *) dflt='y';;
+ esac
+ fi
+ rp="Do you want to install perl as /usr/bin/perl?"
+ . ./myread
+ case "$ans" in
+ [yY]*) val="$define";;
+ *) val="$undef" ;;
+ esac
+else
+ val="$undef"
+fi
+set installusrbinperl
+eval $setvar
+
+echo " "
+echo "Checking for GNU C Library..." >&4
+cat >try.c <<'EOCP'
+/* Find out version of GNU C library. __GLIBC__ and __GLIBC_MINOR__
+ alone are insufficient to distinguish different versions, such as
+ 2.0.6 and 2.0.7. The function gnu_get_libc_version() appeared in
+ libc version 2.1.0. A. Dougherty, June 3, 2002.
+*/
+#include <stdio.h>
+int main(void)
+{
+#ifdef __GLIBC__
+# ifdef __GLIBC_MINOR__
+# if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
+# include <gnu/libc-version.h>
+ printf("%s\n", gnu_get_libc_version());
+# else
+ printf("%d.%d\n", __GLIBC__, __GLIBC_MINOR__);
+# endif
+# else
+ printf("%d\n", __GLIBC__);
+# endif
+ return 0;
+#else
+ return 1;
+#endif
+}
+EOCP
+set try
+if eval $compile_ok && $run ./try > glibc.ver; then
+ val="$define"
+ gnulibc_version=`$cat glibc.ver`
+ echo "You are using the GNU C Library version $gnulibc_version"
+else
+ val="$undef"
+ gnulibc_version=''
+ echo "You are not using the GNU C Library"
+fi
+$rm -f try try.* glibc.ver
+set d_gnulibc
+eval $setvar
+
+: see if nm is to be used to determine whether a symbol is defined or not
+case "$usenm" in
+'')
+ dflt=''
+ case "$d_gnulibc" in
+ "$define")
+ echo " "
+ echo "nm probably won't work on the GNU C Library." >&4
+ dflt=n
+ ;;
+ esac
+ case "$dflt" in
+ '')
+ if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
+ echo " "
+ echo "Whoops! This is an AIX system without /lib/syscalls.exp!" >&4
+ echo "'nm' won't be sufficient on this sytem." >&4
+ dflt=n
+ fi
+ ;;
+ esac
+ case "$dflt" in
+ '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
+ if $test $dflt -gt 20; then
+ dflt=y
+ else
+ dflt=n
+ fi
+ ;;
+ esac
;;
-*) perl5="$perl5"
+*)
+ case "$usenm" in
+ true|$define) dflt=y;;
+ *) dflt=n;;
+ esac
;;
esac
-case "$perl5" in
-'') echo "None found. That's ok.";;
-*) echo "Using $perl5." ;;
-esac
+$cat <<EOM
-: Determine list of previous versions to include in @INC
-$cat > getverlist <<EOPL
-#!$perl5 -w
-use File::Basename;
-\$api_versionstring = "$api_versionstring";
-\$version = "$version";
-\$stem = "$sitelib_stem";
-\$archname = "$archname";
-EOPL
- $cat >> getverlist <<'EOPL'
-# Can't have leading @ because metaconfig interprets it as a command!
-;@inc_version_list=();
-# XXX Redo to do opendir/readdir?
-if (-d $stem) {
- chdir($stem);
- ;@candidates = glob("5.*");
-}
-else {
- ;@candidates = ();
-}
+I can use $nm to extract the symbols from your C libraries. This
+is a time consuming task which may generate huge output on the disk (up
+to 3 megabytes) but that should make the symbols extraction faster. The
+alternative is to skip the 'nm' extraction part and to compile a small
+test program instead to determine whether each symbol is present. If
+you have a fast C compiler and/or if your 'nm' output cannot be parsed,
+this may be the best solution.
-# XXX ToDo: These comparisons must be reworked when two-digit
-# subversions come along, so that 5.7.10 compares as greater than
-# 5.7.3! By that time, hope that 5.6.x is sufficiently
-# widespread that we can use the built-in version vectors rather
-# than reinventing them here. For 5.6.0, however, we must
-# assume this script will likely be run by 5.005_0x. --AD 1/2000.
-foreach $d (@candidates) {
- if ($d lt $version) {
- if ($d ge $api_versionstring) {
- unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
- }
- elsif ($d ge "5.005") {
- unshift(@inc_version_list, grep { -d } $d);
- }
- }
- else {
- # Skip newer version. I.e. don't look in
- # 5.7.0 if we're installing 5.6.1.
- }
-}
+You probably shouldn't let me use 'nm' if you are using the GNU C Library.
-if (@inc_version_list) {
- print join(' ', @inc_version_list);
-}
-else {
- # Blank space to preserve value for next Configure run.
- print " ";
-}
-EOPL
-chmod +x getverlist
-case "$inc_version_list" in
-'') if test -x "$perl5$exe_ext"; then
- dflt=`$perl5 getverlist`
- else
- dflt='none'
- fi
- ;;
-$undef) dflt='none' ;;
-*) eval dflt=\"$inc_version_list\" ;;
-esac
-case "$dflt" in
-''|' ') dflt=none ;;
+EOM
+rp="Shall I use $nm to extract C symbols from the libraries?"
+. ./myread
+case "$ans" in
+[Nn]*) usenm=false;;
+*) usenm=true;;
esac
-case "$dflt" in
-5.005) dflt=none ;;
+
+runnm=$usenm
+case "$reuseval" in
+true) runnm=false;;
esac
-$cat <<EOM
-In order to ease the process of upgrading, this version of perl
-can be configured to use modules built and installed with earlier
-versions of perl that were installed under $prefix. Specify here
-the list of earlier versions that this version of perl should check.
-If Configure detected no earlier versions of perl installed under
-$prefix, then the list will be empty. Answer 'none' to tell perl
-to not search earlier versions.
+: nm options which may be necessary
+case "$nm_opt" in
+'') if $test -f /mach_boot; then
+ nm_opt='' # Mach
+ elif $test -d /usr/ccs/lib; then
+ nm_opt='-p' # Solaris (and SunOS?)
+ elif $test -f /dgux; then
+ nm_opt='-p' # DG-UX
+ elif $test -f /lib64/rld; then
+ nm_opt='-p' # 64-bit Irix
+ else
+ nm_opt=''
+ fi;;
+esac
-The default should almost always be sensible, so if you're not sure,
-just accept the default.
-EOM
+: nm options which may be necessary for shared libraries but illegal
+: for archive libraries. Thank you, Linux.
+case "$nm_so_opt" in
+'') case "$myuname" in
+ *linux*)
+ if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
+ nm_so_opt='--dynamic'
+ fi
+ ;;
+ esac
+ ;;
+esac
-rp='List of earlier versions to include in @INC?'
-. ./myread
-case "$ans" in
-[Nn]one|''|' ') inc_version_list=' ' ;;
-*) inc_version_list="$ans" ;;
+case "$runnm" in
+true)
+: get list of predefined functions in a handy place
+echo " "
+case "$libc" in
+'') libc=unknown
+ case "$libs" in
+ *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
+ esac
+ ;;
esac
-case "$inc_version_list" in
-''|' ')
- inc_version_list_init='0';;
-*) inc_version_list_init=`echo $inc_version_list |
- $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
+case "$libs" in
+'') ;;
+*) for thislib in $libs; do
+ case "$thislib" in
+ -lc|-lc_s)
+ : Handle C library specially below.
+ ;;
+ -l*)
+ thislib=`echo $thislib | $sed -e 's/^-l//'`
+ if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
+ :
+ elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
+ :
+ elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
+ :
+ elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
+ :
+ elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
+ :
+ elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
+ :
+ elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
+ :
+ else
+ try=''
+ fi
+ libnames="$libnames $try"
+ ;;
+ *) libnames="$libnames $thislib" ;;
+ esac
+ done
;;
esac
-$rm -f getverlist
+xxx=normal
+case "$libc" in
+unknown)
+ set /lib/libc.$so
+ for xxx in $libpth; do
+ $test -r $1 || set $xxx/libc.$so
+ : The messy sed command sorts on library version numbers.
+ $test -r $1 || \
+ set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
+ tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
+ h
+ s/[0-9][0-9]*/0000&/g
+ s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
+ G
+ s/\n/ /' | \
+ $sort | $sed -e 's/^.* //'`
+ eval set \$$#
+ done
+ $test -r $1 || set /usr/ccs/lib/libc.$so
+ $test -r $1 || set /lib/libsys_s$_a
+ ;;
+*)
+ set blurfl
+ ;;
+esac
+if $test -r "$1"; then
+ echo "Your (shared) C library seems to be in $1."
+ libc="$1"
+elif $test -r /lib/libc && $test -r /lib/clib; then
+ echo "Your C library seems to be in both /lib/clib and /lib/libc."
+ xxx=apollo
+ libc='/lib/clib /lib/libc'
+ if $test -r /lib/syslib; then
+ echo "(Your math library is in /lib/syslib.)"
+ libc="$libc /lib/syslib"
+ fi
+elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
+ echo "Your C library seems to be in $libc, as you said before."
+elif $test -r $incpath/usr/lib/libc$_a; then
+ libc=$incpath/usr/lib/libc$_a;
+ echo "Your C library seems to be in $libc. That's fine."
+elif $test -r /lib/libc$_a; then
+ libc=/lib/libc$_a;
+ echo "Your C library seems to be in $libc. You're normal."
+else
+ if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
+ :
+ elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
+ libnames="$libnames "`./loc clib blurfl/dyick $libpth`
+ elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
+ :
+ elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
+ :
+ elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
+ :
+ else
+ tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
+ fi
+ if $test -r "$tans"; then
+ echo "Your C library seems to be in $tans, of all places."
+ libc=$tans
+ else
+ libc='blurfl'
+ fi
+fi
+if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
+ dflt="$libc"
+ cat <<EOM
-: determine whether to install perl also as /usr/bin/perl
+If the guess above is wrong (which it might be if you're using a strange
+compiler, or your machine supports multiple models), you can override it here.
-echo " "
-if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
- $cat <<EOM
-Many scripts expect perl to be installed as /usr/bin/perl.
+EOM
+else
+ dflt=''
+ echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
+ cat >&4 <<EOM
+I can't seem to find your C library. I've looked in the following places:
-If you want to, I can install the perl you are about to compile
-as /usr/bin/perl (in addition to $bin/perl).
EOM
- if test -f /usr/bin/perl; then
- $cat <<EOM
+ $sed 's/^/ /' libpath
+ cat <<EOM
-However, please note that because you already have a /usr/bin/perl,
-overwriting that with a new Perl would very probably cause problems.
-Therefore I'm assuming you don't want to do that (unless you insist).
+None of these seems to contain your C library. I need to get its name...
EOM
- case "$installusrbinperl" in
- "$define"|[yY]*) dflt='y';;
- *) dflt='n';;
- esac
- else
- $cat <<EOM
+fi
+fn=f
+rp='Where is your C library?'
+. ./getfile
+libc="$ans"
-Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
+echo " "
+echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
+set X `cat libnames`
+shift
+xxx=files
+case $# in 1) xxx=file; esac
+echo "Extracting names from the following $xxx for later perusal:" >&4
+echo " "
+$sed 's/^/ /' libnames >&4
+echo " "
+$echo $n "This may take a while...$c" >&4
-EOM
- case "$installusrbinperl" in
- "$undef"|[nN]*) dflt='n';;
- *) dflt='y';;
- esac
- fi
- rp="Do you want to install perl as /usr/bin/perl?"
- . ./myread
- case "$ans" in
- [yY]*) val="$define";;
- *) val="$undef" ;;
+for file in $*; do
+ case $file in
+ *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
+ *) $nm $nm_opt $file 2>/dev/null;;
esac
+done >libc.tmp
+
+$echo $n ".$c"
+$grep fprintf libc.tmp > libc.ptf
+xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
+xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
+xxx='[ADTSIW]'
+if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *_[_.]*//p' -e 's/^.* $xxx *//p'";\
+ eval $xscan;\
+ $contains '^fprintf$' libc.list >/dev/null 2>&1; then
+ eval $xrun
+elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
+ eval $xscan;\
+ $contains '^fprintf$' libc.list >/dev/null 2>&1; then
+ eval $xrun
+elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
+ eval $xscan;\
+ $contains '^fprintf$' libc.list >/dev/null 2>&1; then
+ eval $xrun
+elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
+ eval $xscan;\
+ $contains '^fprintf$' libc.list >/dev/null 2>&1; then
+ eval $xrun
+elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
+ eval $xscan;\
+ $contains '^fprintf$' libc.list >/dev/null 2>&1; then
+ eval $xrun
+elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
+ eval $xscan;\
+ $contains '^fprintf$' libc.list >/dev/null 2>&1; then
+ eval $xrun
+elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
+ -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
+ eval $xscan;\
+ $contains '^fprintf$' libc.list >/dev/null 2>&1; then
+ eval $xrun
+elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
+ eval $xscan;\
+ $contains '^fprintf$' libc.list >/dev/null 2>&1; then
+ eval $xrun
+elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
+ eval $xscan;\
+ $contains '^fprintf$' libc.list >/dev/null 2>&1; then
+ eval $xrun
+elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
+ eval $xscan;\
+ $contains '^fprintf$' libc.list >/dev/null 2>&1; then
+ eval $xrun
+elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
+ eval $xscan;\
+ $contains '^fprintf$' libc.list >/dev/null 2>&1; then
+ eval $xrun
+elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
+ eval $xscan;\
+ $contains '^fprintf$' libc.list >/dev/null 2>&1; then
+ eval $xrun
+elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
+ eval $xscan;\
+ $contains '^fprintf$' libc.list >/dev/null 2>&1; then
+ eval $xrun
+elif com="sed -n -e 's/^__.*//' -e 's/[ ]*D[ ]*[0-9]*.*//p'";\
+ eval $xscan;\
+ $contains '^fprintf$' libc.list >/dev/null 2>&1; then
+ eval $xrun
else
- val="$undef"
+ $nm -p $* 2>/dev/null >libc.tmp
+ $grep fprintf libc.tmp > libc.ptf
+ if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
+ eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
+ then
+ nm_opt='-p'
+ eval $xrun
+ else
+ echo " "
+ echo "$nm didn't seem to work right. Trying $ar instead..." >&4
+ com=''
+ if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
+ for thisname in $libnames $libc; do
+ $ar t $thisname >>libc.tmp
+ done
+ $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
+ echo "Ok." >&4
+ elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
+ # Repeat libc to extract forwarders to DLL entries too
+ for thisname in $libnames $libc; do
+ $ar tv $thisname >>libc.tmp
+ # Revision 50 of EMX has bug in $ar.
+ # it will not extract forwarders to DLL entries
+ # Use emximp which will extract exactly them.
+ emximp -o tmp.imp $thisname \
+ 2>/dev/null && \
+ $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
+ < tmp.imp >>libc.tmp
+ $rm tmp.imp
+ done
+ $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
+ echo "Ok." >&4
+ else
+ echo "$ar didn't seem to work right." >&4
+ echo "Maybe this is a Cray...trying bld instead..." >&4
+ if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
+ then
+ for thisname in $libnames; do
+ bld t $libnames | \
+ $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
+ $ar t $thisname >>libc.tmp
+ done
+ echo "Ok." >&4
+ else
+ echo "That didn't work either. Giving up." >&4
+ exit 1
+ fi
+ fi
+ fi
fi
-set installusrbinperl
-eval $setvar
+nm_extract="$com"
+case "$PASE" in
+define)
+ echo " "
+ echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
+ dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
+ ;;
+*) if $test -f /lib/syscalls.exp; then
+ echo " "
+ echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
+ $sed -n 's/^\([^ ]*\)[ ]*syscall[0-9]*[ ]*$/\1/p' /lib/syscalls.exp >>libc.list
+ fi
+ ;;
+esac
+;;
+esac
+$rm -f libnames libpath
: see if dld is available
set dld.h i_dld
eval $inhdr
+: is a C symbol defined?
+csym='tlook=$1;
+case "$3" in
+-v) tf=libc.tmp; tc=""; tdc="";;
+-a) tf=libc.tmp; tc="[0]"; tdc="[]";;
+*) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
+esac;
+tx=yes;
+case "$reuseval-$4" in
+true-) ;;
+true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
+esac;
+case "$tx" in
+yes)
+ case "$runnm" in
+ true)
+ if $contains $tlook $tf >/dev/null 2>&1;
+ then tval=true;
+ else tval=false;
+ fi;;
+ *)
+ echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
+ if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
+ then tval=true;
+ else tval=false;
+ fi;
+ $rm -f t t.c;;
+ esac;;
+*)
+ case "$tval" in
+ $define) tval=true;;
+ *) tval=false;;
+ esac;;
+esac;
+eval "$2=$tval"'
+
+: define an is-in-libc? function
+inlibc='echo " "; td=$define; tu=$undef;
+sym=$1; var=$2; eval "was=\$$2";
+tx=yes;
+case "$reuseval$was" in
+true) ;;
+true*) tx=no;;
+esac;
+case "$tx" in
+yes)
+ set $sym tres -f;
+ eval $csym;
+ case "$tres" in
+ true)
+ echo "$sym() found." >&4;
+ case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
+ *)
+ echo "$sym() NOT found." >&4;
+ case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
+ esac;;
+*)
+ case "$was" in
+ $define) echo "$sym() found." >&4;;
+ *) echo "$sym() NOT found." >&4;;
+ esac;;
+esac'
+
: see if dlopen exists
xxx_runnm="$runnm"
runnm=false
set qgcvt d_qgcvt
eval $inlibc
+echo " "
+
+if $test X"$d_longdbl" = X"$define"; then
+
+echo "Checking how to print long doubles..." >&4
+
+if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
+ $cat >try.c <<'EOCP'
+#include <sys/types.h>
+#include <stdio.h>
+int main() {
+ double d = 123.456;
+ printf("%.3f\n", d);
+}
+EOCP
+ set try
+ if eval $compile; then
+ yyy=`$run ./try`
+ case "$yyy" in
+ 123.456)
+ sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
+ sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
+ echo "We will use %f."
+ ;;
+ esac
+ fi
+fi
+
+if $test X"$sPRIfldbl" = X; then
+ $cat >try.c <<'EOCP'
+#include <sys/types.h>
+#include <stdio.h>
+int main() {
+ long double d = 123.456;
+ printf("%.3Lf\n", d);
+}
+EOCP
+ set try
+ if eval $compile; then
+ yyy=`$run ./try`
+ case "$yyy" in
+ 123.456)
+ sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
+ sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
+ echo "We will use %Lf."
+ ;;
+ esac
+ fi
+fi
+
+if $test X"$sPRIfldbl" = X; then
+ $cat >try.c <<'EOCP'
+#include <sys/types.h>
+#include <stdio.h>
+int main() {
+ long double d = 123.456;
+ printf("%.3llf\n", d);
+}
+EOCP
+ set try
+ if eval $compile; then
+ yyy=`$run ./try`
+ case "$yyy" in
+ 123.456)
+ sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
+ sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
+ echo "We will use %llf."
+ ;;
+ esac
+ fi
+fi
+
+if $test X"$sPRIfldbl" = X; then
+ $cat >try.c <<'EOCP'
+#include <sys/types.h>
+#include <stdio.h>
+int main() {
+ long double d = 123.456;
+ printf("%.3lf\n", d);
+}
+EOCP
+ set try
+ if eval $compile; then
+ yyy=`$run ./try`
+ case "$yyy" in
+ 123.456)
+ sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
+ sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
+ echo "We will use %lf."
+ ;;
+ esac
+ fi
+fi
+
+if $test X"$sPRIfldbl" = X; then
+ echo "Cannot figure out how to print long doubles." >&4
+else
+ sSCNfldbl=$sPRIfldbl # expect consistency
+fi
+
+$rm -f try try.*
+
+fi # d_longdbl
+
+case "$sPRIfldbl" in
+'') d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
+ d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
+ d_SCNfldbl="$undef";
+ ;;
+*) d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
+ d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
+ d_SCNfldbl="$define";
+ ;;
+esac
+
: Check how to convert floats to strings.
if test "X$d_Gconvert" = X; then
set accessx d_accessx
eval $inlibc
+: see if aintl exists
+set aintl d_aintl
+eval $inlibc
+
: see if alarm exists
set alarm d_alarm
eval $inlibc
chmod +x protochk
$eunicefix protochk
+hasproto='varname=$1; func=$2; shift; shift;
+while $test $# -ge 2; do
+ case "$1" in
+ $define) echo "#include <$2>";;
+ esac ;
+ shift 2;
+done > try.c;
+$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
+if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
+ echo "$func() prototype found.";
+ val="$define";
+else
+ echo "$func() prototype NOT found.";
+ val="$undef";
+fi;
+set $varname;
+eval $setvar;
+$rm -f try.c tryout.c'
+
: see if sys/types.h has to be included
set sys/types.h i_systypes
eval $inhdr
set d_const
eval $setvar
+: see if copysignl exists
+set copysignl d_copysignl
+eval $inlibc
+
: see if crypt exists
echo " "
set crypt d_crypt
+: see if sqrtl exists
+set sqrtl d_sqrtl
+eval $inlibc
+
+: see if modfl exists
+set modfl d_modfl
+eval $inlibc
+
+: see if prototype for modfl is available
+echo " "
+set d_modflproto modfl math.h
+eval $hasproto
+
+d_modfl_pow32_bug="$undef"
+
+case "$d_longdbl$d_modfl" in
+$define$define)
+ $cat <<EOM
+Checking to see whether your modfl() is okay for large values...
+EOM
+$cat >try.c <<EOCP
+#include <math.h>
+#include <stdio.h>
+EOCP
+if $test "X$d_modflproto" != "X$define"; then
+ $cat >>try.c <<EOCP
+/* Sigh. many current glibcs provide the function, but do not prototype it. */
+long double modfl (long double, long double *);
+EOCP
+fi
+$cat >>try.c <<EOCP
+int main() {
+ long double nv = 4294967303.15;
+ long double v, w;
+ v = modfl(nv, &w);
+#ifdef __GLIBC__
+ printf("glibc");
+#endif
+ printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
+ return 0;
+}
+EOCP
+ case "$osname:$gccversion" in
+ aix:) saveccflags="$ccflags"
+ ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
+ esac
+ set try
+ if eval $compile; then
+ foo=`$run ./try`
+ case "$foo" in
+ *" 4294967303.150000 1.150000 4294967302.000000")
+ echo >&4 "Your modfl() is broken for large values."
+ d_modfl_pow32_bug="$define"
+ case "$foo" in
+ glibc) echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
+ ;;
+ esac
+ ;;
+ *" 4294967303.150000 0.150000 4294967303.000000")
+ echo >&4 "Your modfl() seems okay for large values."
+ ;;
+ *) echo >&4 "I don't understand your modfl() at all."
+ d_modfl="$undef"
+ ;;
+ esac
+ $rm -f try.* try core core.try.*
+ else
+ echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
+ d_modfl="$undef"
+ fi
+ case "$osname:$gccversion" in
+ aix:) ccflags="$saveccflags" ;; # restore
+ esac
+ ;;
+esac
+
+if $test "$uselongdouble" = "$define"; then
+ message="No more information."
+ case "$d_sqrtl:$d_modfl" in
+ $define:$define)
+ : You have both
+ ;;
+ $define:$undef)
+ if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
+ echo "You have both aintl and copysignl, so I can emulate modfl."
+ else
+ message="I could not find modfl."
+ fi
+ ;;
+ $undef:$define)
+ message="I could not find sqrtl."
+ ;;
+ $undef:$undef)
+ message="I found neither sqrtl nor modfl."
+ ;;
+ esac
+
+ if $test "$message" != X; then
+ $cat <<EOM >&4
+
+*** You requested the use of long doubles but you do not seem to have
+*** the mathematic functions for long doubles.
+*** ($message)
+*** I'm disabling the use of long doubles.
+
+EOM
+
+ uselongdouble=$undef
+ fi
+fi
+
: see if mprotect exists
set mprotect d_mprotect
eval $inlibc