From xemacs-m  Thu May 29 21:55:41 1997
Received: from mercury.Sun.COM (mercury.Sun.COM [192.9.25.1])
	by xemacs.org (8.8.5/8.8.5) with SMTP id VAA09172
	for <xemacs-beta@xemacs.org>; Thu, 29 May 1997 21:55:40 -0500 (CDT)
Received: from Eng.Sun.COM ([129.146.1.25]) by mercury.Sun.COM (SMI-8.6/mail.byaddr) with SMTP id UAA10205 for <xemacs-beta@xemacs.org>; Thu, 29 May 1997 20:12:22 -0700
Received: from kindra.eng.sun.com by Eng.Sun.COM (SMI-8.6/SMI-5.3)
	id TAA16098; Thu, 29 May 1997 19:54:38 -0700
Received: from xemacs.eng.sun.com by kindra.eng.sun.com (SMI-8.6/SMI-SVR4)
	id TAA14285; Thu, 29 May 1997 19:54:34 -0700
Received: by xemacs.eng.sun.com (SMI-8.6/SMI-SVR4)
	id TAA19040; Thu, 29 May 1997 19:54:42 -0700
Date: Thu, 29 May 1997 19:54:42 -0700
Message-Id: <199705300254.TAA19040@xemacs.eng.sun.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
From: Martin Buchholz <mrb@Eng.Sun.COM>
To: Hrvoje Niksic <hniksic@srce.hr>
Cc: XEmacs Developers <xemacs-beta@xemacs.org>
Subject: `-R' on Solaris
In-Reply-To: <kigu3jom7k5.fsf@jagor.srce.hr>
References: <kigu3jom7k5.fsf@jagor.srce.hr>
X-Mailer: VM 6.31 under 20.3 XEmacs Lucid (beta2)
Reply-To: Martin Buchholz <mrb@Eng.Sun.COM>

>>>>> "Hrv" == Hrvoje Niksic <hniksic@srce.hr> writes:

Hrv> Martin, can you please add `-R/usr/local/lib' for default linker
Hrv> flags on Solaris, at least when compiling with gcc?  The problem
Hrv> is that gcc uses `-L/usr/local/lib' by default (even without
Hrv> specifying it explicitly).  And then temacs silently fails, as
Hrv> well as gnuserv and other stuff.

The code actually tries to autodetect which directories were used at
link time, select the subset containing shared libs, and compose the
runpath using those.  But how should it detect dirs used implicitly by
the compiler?

Here's the configure fragment:

    dnl Add all directories with .so files to runpath
    runpath=""
    for arg in $ld_switch_site $ld_switch_x_site; do
      case "$arg" in -L* )
	dir=`echo "$arg" | sed 's/^-L//'`
	if test -n "`ls ${dir}/*.s[[ol]] 2>/dev/null`"; then
	  test -n "$runpath" && runpath="${runpath}:"
	  runpath="${runpath}${dir}"
        fi
	;;
      esac
    done

This code can be improved.  We should use the list of lib dirs
actually passed to the linker, rather than the ones we pass to the
compiler driver.  Getting at that list portably will be tough.  

gcc -print-search-dirs
says nothing about /usr/local on my system.

Does the configure fragment work if -L/usr/local/lib is specified on
the command line?  As usual, I haven't thoroughly tested this.

Martin

