This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

config-ml.in: adjust LD_LIBRARY_PATH and SHLIB_PATH for multilibs


In an --enable-shared build including libstdc++ and libjava, libjava
fails to configure (with my modified libjava tree) because it can't
run a C++ program created by the C++ compiler, even though it is known
not to be a cross-compiler.  The problem is that libstdc++.so is found
at link time, but not a run-time.

Ok, so I set LD_LIBRARY_PATH and all will be fine.

Not so easy.  In multilibbed platforms, we'd need different library
paths for each target library.

That's what this patch does.  A future patch will arrange for
LD_LIBRARY_PATH to be set in the top-level Makefile to prevent this
failure.  This may also help when we start building libgcc as a shared
library, possibly in a separate target directory.

Ok to install?

Index: ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* config-ml.in (CC, CXX): Avoid trailing whitespace.
	(LD_LIBRARY_PATH, SHLIB_PATH): Adjust for multilibs and export to
	sub-configures.

Index: config-ml.in
===================================================================
RCS file: /cvs/gcc/egcs/config-ml.in,v
retrieving revision 1.14
diff -u -p -r1.14 config-ml.in
--- config-ml.in	2000/08/12 22:35:14	1.14
+++ config-ml.in	2000/08/17 21:31:11
@@ -753,11 +753,11 @@ if [ -n "${multidirs}" ] && [ -z "${ml_n
         break
       fi
     done
-    ml_config_env='CC="${CC_} $flags" CXX="${CXX_} $flags"'
+    ml_config_env='CC="${CC_}$flags" CXX="${CXX_}$flags"'
 
     if [ "${with_target_subdir}" = "." ]; then
-	CC_=$CC
-	CXX_=$CXX
+	CC_=$CC' '
+	CXX_=$CXX' '
     else
 	# Create a regular expression that matches any string as long
 	# as ML_POPDIR.
@@ -786,6 +786,39 @@ if [ -n "${multidirs}" ] && [ -z "${ml_n
 	  esac
 	done
 
+	if test "x${LD_LIBRARY_PATH+set}" = xset; then
+	  LD_LIBRARY_PATH_=
+	  for arg in `echo "$LD_LIBRARY_PATH" | tr ':' ' '`; do
+	    case "$arg" in
+	    "${ML_POPDIR}"/*)
+	      arg=`echo "X${arg}" | sed -n "s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X${popdir_rx}\\(.*\\)/\\1/p"`
+	      ;;
+	    esac
+	    if test "x$LD_LIBRARY_PATH_" != x; then
+	      LD_LIBRARY_PATH_=$LD_LIBRARY_PATH_:$arg
+	    else
+	      LD_LIBRARY_PATH_=$arg
+	    fi
+          done
+	  ml_config_env="$ml_config_env LD_LIBRARY_PATH=$LD_LIBRARY_PATH_"
+	fi
+
+	if test "x${SHLIB_PATH+set}" = xset; then
+	  SHLIB_PATH_=
+	  for arg in `echo "$SHLIB_PATH" | tr ':' ' '`; do
+	    case "$arg" in
+	    "${ML_POPDIR}"/*)
+	      arg=`echo "X${arg}" | sed -n "s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X${popdir_rx}\\(.*\\)/\\1/p"`
+	      ;;
+	    esac
+	    if test "x$SHLIB_PATH_" != x; then
+	      SHLIB_PATH_=$SHLIB_PATH_:$arg
+	    else
+	      SHLIB_PATH_=$arg
+	    fi
+          done
+	  ml_config_env="$ml_config_env SHLIB_PATH=$SHLIB_PATH_"
+	fi
     fi
 
     if eval ${ml_config_env} ${ml_config_shell} ${ml_recprog} \

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]