--- butt/ltmain.in +++ monkey/ltmain.in @@ -214,6 +214,74 @@ } +# Ripped from libtool.m4 to address hardcoding of toolchain paths. +# http://bugs.gentoo.org/88596 +get_shared_dep_info() { + ret=0 pre_test_object_deps_done="no" + compiler_lib_search_path="" predeps_objects="" postdeps_objects="" + + # Only support CXX atm, and only use this hack on a Gentoo system + tag=$1 shift + request=$1 shift + if test -f /etc/gentoo-release && test "X$tag" = "XCXX" ; then + + echo 'class Foo{public:Foo(void){a=0;}private:int a;};' > .my_conftest.cpp || ret=1 + ${CC} -c -o .my_conftest.${objext} .my_conftest.cpp &> /dev/null || ret=1 + + output=`${CC} -shared -v -o .my_conftest.so .my_conftest.${objext} 2>&1 | grep "\-L"` || ret=1 + for p in $output ; do + case $p in + -L* | -R* | -l*) + if test "$p" = "-L" || test "$p" = "-R" ; then + prev=$p + continue + else + prev= + fi + if test "$pre_test_object_deps_done" = no; then + case $p in + -L* | -R*) compiler_lib_search_path="${compiler_lib_search_path} ${prev}${p}";; + esac + else + postdeps="${postdeps} ${prev}${p}" + fi + ;; + *.${objext}) + if test "$p" = ".my_conftest.$objext"; then + pre_test_object_deps_done=yes + continue + fi + if test "$pre_test_object_deps_done" = no; then + predep_objects="$predep_objects $p" + else + postdep_objects="$postdep_objects $p" + fi + ;; + *) ;; + esac + done + + rm -f .my_conftest.* + + else + ret=1 + fi + + if test "X$ret" != "X0" ; then + request=boo + fi + + case $request in + pre) echo $predeps;; + post) echo $postdeps;; + comp) echo $compiler_lib_search_path;; + preobj) echo $predep_objects;; + postobj) echo $postdep_objects;; + *) echo $@ ;; + esac +} + + # func_infer_tag arg # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. --- butt/libtool.m4 +++ monkey/libtool.m4 @@ -4411,23 +4411,23 @@ # Dependencies to place before the objects being linked to create a # shared library. -predep_objects=$lt_[]_LT_AC_TAGVAR(predep_objects, $1) +predep_objects=\`test x"$1" != x"" && get_shared_dep_info $1 preobj $lt_[]_LT_AC_TAGVAR(predep_objects, $1)\` # Dependencies to place after the objects being linked to create a # shared library. -postdep_objects=$lt_[]_LT_AC_TAGVAR(postdep_objects, $1) +postdep_objects=\`test x"$1" != x"" && get_shared_dep_info $1 postobj $lt_[]_LT_AC_TAGVAR(postdep_objects, $1)\` # Dependencies to place before the objects being linked to create a # shared library. -predeps=$lt_[]_LT_AC_TAGVAR(predeps, $1) +predeps=\`test x"$1" != x"" && get_shared_dep_info $1 pre $lt_[]_LT_AC_TAGVAR(predeps, $1)\` # Dependencies to place after the objects being linked to create a # shared library. -postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1) +postdeps=\`test x"$1" != x"" && get_shared_dep_info $1 post $lt_[]_LT_AC_TAGVAR(postdeps, $1)\` # The library search path used internally by the compiler when linking # a shared library. -compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1) +compiler_lib_search_path=\`test x"$1" != x"" && get_shared_dep_info $1 comp $lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1)\` # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method