--- a/libltdl/config/ltmain.sh +++ b/libltdl/config/ltmain.sh @@ -1424,6 +1429,42 @@ func_infer_tag () ;; esac fi + + # Gentoo hacks! https://bugs.gentoo.org/88596 + # If the active gcc is not the same as the live gcc, then recompute. + + # If the tag isn't gcc based, skip it. + if [ "$with_gcc" != "yes" ]; then + return 0 + fi + + # Some tags don't have any path info, so nothing to do. + if [ -z "$compiler_lib_search_dirs$predep_objects$postdep_objects$predeps$postdeps$compiler_lib_search_path" ]; then + return 0 + fi + + # Make sure this new compiler is also gcc based. If it isn't, + # then we can't support switching to it. + if ! "$@" --version 2>/dev/null | ${GREP} -q '^gcc\>'; then + return 0 + fi + + # If they're the same version, assume nothing has changed. + gentoo_active_ver=$("$@" -dumpversion 2>/dev/null) || return 0 + if [ "$gentoo_CC_version" = "$gentoo_active_ver" ]; then + return 0 + fi + + for gentoo_var in \ + compiler_lib_search_dirs \ + predep_objects \ + postdep_objects \ + predeps \ + postdeps \ + compiler_lib_search_path + do + eval $gentoo_var="\"\$(echo \"\$$gentoo_var\" | ${SED} \"s:$gentoo_CC_version:$gentoo_active_ver:g\")\"" + done } --- a/libltdl/m4/libtool.m4 +++ b/libltdl/m4/libtool.m4 @@ -881,6 +935,14 @@ _LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl _LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl _LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl +# Hmm, should we do this for all tags or just the main one ? Probably safe +# to assume that they're all the same version ... +gentoo_CC_version= +if test "$GCC" = yes; then + gentoo_CC_version=$($CC -dumpversion 2>/dev/null) +fi +_LT_DECL([gentoo_CC_version], [gentoo_CC_version], [1], [The compiler version]) + # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"}