diff options
Diffstat (limited to 'mcon/U/libc.U')
-rw-r--r-- | mcon/U/libc.U | 91 |
1 files changed, 64 insertions, 27 deletions
diff --git a/mcon/U/libc.U b/mcon/U/libc.U index 1e2bcc0..dafd669 100644 --- a/mcon/U/libc.U +++ b/mcon/U/libc.U @@ -1,12 +1,12 @@ -?RCS: $Id: libc.U,v 3.0.1.10 1997/02/28 15:56:48 ram Exp $ +?RCS: $Id$ ?RCS: -?RCS: Copyright (c) 1991-1993, Raphael Manfredi +?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi ?RCS: ?RCS: You may redistribute only under the terms of the Artistic Licence, ?RCS: as specified in the README file that comes with the distribution. ?RCS: You may reuse parts of this distribution only within the terms of ?RCS: that same Artistic Licence; a copy of which may be found at the root -?RCS: of the source tree for dist 3.0. +?RCS: of the source tree for dist 4.0. ?RCS: ?RCS: $Log: libc.U,v $ ?RCS: Revision 3.0.1.10 1997/02/28 15:56:48 ram @@ -48,20 +48,27 @@ ?RCS: Revision 3.0 1993/08/18 12:08:57 ram ?RCS: Baseline for dist 3.0 netwide release. ?RCS: -?MAKE:libc +nm_extract: echo n c rm test grep Getfile Myread Oldconfig Loc \ - sed libs incpath libpth runnm nm_opt nm_so_opt contains xlibpth so _a _o +?MAKE:libc libnames +nm_extract: echo n c rm test grep Getfile Myread \ + Oldconfig Loc sed libs incpath libpth ar runnm nm nm_opt nm_so_opt \ + contains xlibpth so osname trnl tr sort uniq _o _a ?MAKE: -pick add $@ %< ?S:libc: ?S: This variable contains the location of the C library. ?S:. +?S:libnames: +?S: The constructed list of library names. Normally empty, but hint files +?S: may set this for later perusal by Configure. +?S:. ?S:nm_extract: ?S: This variable holds the name of the extraction command used to process ?S: the output of nm and yield the list of defined symbols. It is used ?S: internally by Configure. ?S:. ?T:thislib try libnames xxx xscan xrun thisname com tans file -?F:!libnames -?LINT:change nm_opt +?F:!libnames !libc.tmp !tmp.imp +?LINT:change nm_opt runnm +?INIT:libnames='' +: Figure out where the libc is located case "$runnm" in true) ?X: indentation is wrong on purpose--RAM @@ -74,7 +81,6 @@ case "$libc" in esac ;; esac -libnames=''; case "$libs" in '') ;; *) for thislib in $libs; do @@ -133,15 +139,16 @@ 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 /usr/lib/libc.$so.[0-9]* | \ - tr ' ' '\012' | egrep -v '\.[A-Za-z]*$' | $sed -e ' + 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/^.* //'` + $sort | $sed -e 's/^.* //'` eval set \$$# done $test -r $1 || set /usr/ccs/lib/libc.$so @@ -208,7 +215,7 @@ compiler, or your machine supports multiple models), you can override it here. EOM else dflt='' - echo $libpth | tr ' ' '\012' | sort | uniq > libpath + 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: @@ -226,7 +233,7 @@ rp='Where is your C library?' libc="$ans" echo " " -echo $libc $libnames | tr ' ' '\012' | sort | uniq > libnames +echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames set X `cat libnames` shift xxx=files @@ -244,8 +251,8 @@ $echo $n "This may take a while...$c" >&4 ?X: 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;; + *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;; + *) $nm $nm_opt $file 2>/dev/null;; esac done >libc.tmp @@ -261,7 +268,7 @@ $grep fprintf libc.tmp > libc.ptf ?X: some variables that will be "eval"ed. ?X: xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4' -xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4' +xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4' ?X: BSD-like output, I and W types added for Linux ?X: Some versions of Linux include a leading __IO in the symbol name. ?X: HPUX10 reportedly has trailing spaces, though I'm suprised it has @@ -306,6 +313,10 @@ 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 @@ -319,8 +330,13 @@ elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\ eval $xscan;\ $contains '^fprintf$' libc.list >/dev/null 2>&1; then eval $xrun +?X: AIX nm output +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 + $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 @@ -329,28 +345,48 @@ else eval $xrun else echo " " - echo "nm didn't seem to work right. Trying ar instead..." >&4 + echo "$nm didn't seem to work right. Trying $ar instead..." >&4 com='' - if ar t $libc > libc.tmp; then - for thisname in $libnames; do - ar t $thisname >>libc.tmp + 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 +?X: Repeat libc to extract forwarders to DLL entries too + for thisname in $libnames $libc; do + $ar tv $thisname >>libc.tmp +?X: Revision 50 of EMX has bug in ar: it will not extract forwarders +?X: 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 -f 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 "$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 + if + bld t $libc | \ + $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list && + $test -s libc.list then for thisname in $libnames; do bld t $libnames | \ $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list - ar t $thisname >>libc.tmp + $ar t $thisname >>libc.tmp done echo "Ok." >&4 else - echo "That didn't work either. Giving up." >&4 - exit 1 + echo "That didn't work either." >&4 + echo "No problem, I'll be compiling test programs then..." >&4 + runnm=false fi fi fi @@ -359,7 +395,8 @@ nm_extract="$com" 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$/\1/p' /lib/syscalls.exp >>libc.list + $sed -n 's/^\([^ ]*\)[ ]*syscall[0-9]*[ ]*$/\1/p' \ + /lib/syscalls.exp >>libc.list fi ?X: remember, indentation is wrong on purpose--RAM ;; |