[Date Prev] [Date Next] [Thread Prev] [Thread Next] Date Index Thread Index Search archive:
Date:Mon Jan 14 16:22:47 2003 
Subject:Re: linking motif poplog - generic script wanted 
From:Stephen Isard 
Volume-ID:1030114.01 

Aaron Sloman wrote:

> The crucial line of that script, for linking motif is this:
> 
>     -lXm \
> 
> I have investigatd man files and info files for gcc 
 <snip>...
> I have found nothing about how to make it accept an
> extension with a version number, like> 
>     .so.2
>     .so.3
>     .so.3.0.1
>     etc.

You can load a library by specifying its complete path name at the point
where you would put a '-l' flag.  So  you could replace '-lXm' in
poplink_cmnd by '/usr/X11R6/lib/libXm.so.2' on my RedHat system and get
a poplog that would work on my machine.

The best thing might therefore be to generate poplink_cmnd with a line
other than '-lXm' in cases where '-lXm' isn't going to work.  Do you
know where the '-lXm' actually comes from?  I suspect it is from the
setting of XM_LIBS in $usepop/pop/com/popenv.sh, but I haven't traced it
through the source of poplink_main.p, etc.. 

> So: if anyone can tell me how (on linux) to modify
> poplink_cmnd to make the linker search for the most recent
> file matching libXm.so* that would be great.

If I'm correct, it should be relatively simple to put a search for the
library into the 'Linux)' case in popenv.sh.  I could do experiments to
see if a new setting in popenv.sh filtered through to poplink_cmnd, but
it would be better if you or someone else knowledgeable could say
whether that's the right place.  The result on systems without a
libXm.so would be a poplog that wasn't portable to other machines that
didn't have the same libXm.so.x.y, but I take it that use of this script
implicitly abandons hopes of complete binary portability anyway.

Alternatively, if you want to take the position that any system with a
libXm.so.x.y and no libXm.so is just misconfigured and ought to be
fixed, you could put lines to the effect of

if [ ! -f /usr/X11R6/lib/libXm.so ]
then
xmlib=`ls -t /usr/X11R6/lib/libXm.so* 2>/dev/null | head -1`
if [ -f "$xmlib ] && file $xmlib |grep "shared object" >/dev/null
then
ln -s $xmlib /usr/X11R6/lib/libXm.so
else
echo "no motif library found"
fi
fi

into your script (suitably translated from bash syntax into csh, if you
prefer).  I can't see what harm such a link could do, but I'm far from
expert in these matters. 

Steve