[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gcc automatically finds /usr/local/lib/libXXX

From: Kenichi Handa
Subject: gcc automatically finds /usr/local/lib/libXXX
Date: Tue, 21 Nov 2000 16:31:59 +0900 (JST)

I raised this problem a while ago, but, at that time, we
didn't reach any actual solutions to this problem.  And, as
I'm not an configuration expert, I didn't investigate this
problem further.

But, now pretest started, and I receive many complaints
about this problem.

The problem is that, when we are using gcc, AC_TRY_LINK
tries to link object via gcc, and if gcc isq installed with
prefix /xxx/yyy, it gives the argument -L/xxx/yyy/lib to
`ld'.  This results in libraries in /xxx/yyy/lib/ are all
automatically found.

The typical case is that gcc is installed with the default
prefix /usr/local, and libpng, etc are also installed with
the default prefix /usr/local.

In this situation, configure script thinks that Emacs can
use libpng.  But, there's a case that system's runtime
linker doesn't finds libraries in /usr/local/lib
automatically (e.g. Solaris).  And, if it doesn't, invoking
emacs results in this error:

ld.so.1: emacs21: fatal: libpng.so.2: open failed: No such file or directory

One solution is to add all library directories that gcc
automatically tries in LD_RUN_PATH.   We can find such
directories by this script.

set `gcc -print-search-dirs | grep -e '^libraries:'`
dirs=`echo $1 | sed -e "s/:/ /g"`
for d in ${dirs}; do
  if [ x"${d}" != x/usr/lib/ ] ; then
    ls ${d}/*.so > /dev/null 2>&1 && run_path="${run_path} -R${d}"
echo "LD_SWITCH_X_SITE_AUX should contain ${run_path}."

But, I don't know how to include this kind of code without
breaking other hacks done in configure.in.

Ken'ichi HANDA

reply via email to

[Prev in Thread] Current Thread [Next in Thread]