diff --git a/libstdc++-v3/python/Makefile.am b/libstdc++-v3/python/Makefile.am index 01517a2a522..0c2b207b86e 100644 --- a/libstdc++-v3/python/Makefile.am +++ b/libstdc++-v3/python/Makefile.am @@ -44,21 +44,9 @@ gdb.py: hook.in Makefile install-data-local: gdb.py @$(mkdir_p) $(DESTDIR)$(toolexeclibdir) ## We want to install gdb.py as SOMETHING-gdb.py. SOMETHING is the -## full name of the final library. We want to ignore symlinks, the -## .la file, and any previous -gdb.py file. This is inherently -## fragile, but there does not seem to be a better option, because -## libtool hides the real names from us. - @here=`pwd`; cd $(DESTDIR)$(toolexeclibdir); \ - for file in libstdc++.*; do \ - case $$file in \ - *-gdb.py) ;; \ - *.la) ;; \ - *) if test -h $$file; then \ - continue; \ - fi; \ - libname=$$file;; \ - esac; \ - done; \ - cd $$here; \ +## full name of the final library. We use the libtool .la file to get +## the correct name. + @libname=`sed -ne "/^library_names=/{s/.*='//;s/'$$//;s/ .*//;p;}" \ + $(DESTDIR)$(toolexeclibdir)/libstdc++.la`; \ echo " $(INSTALL_DATA) gdb.py $(DESTDIR)$(toolexeclibdir)/$$libname-gdb.py"; \ $(INSTALL_DATA) gdb.py $(DESTDIR)$(toolexeclibdir)/$$libname-gdb.py diff --git a/libstdc++-v3/python/Makefile.in b/libstdc++-v3/python/Makefile.in index c35dbe55961..2efe0b96a19 100644 --- a/libstdc++-v3/python/Makefile.in +++ b/libstdc++-v3/python/Makefile.in @@ -607,18 +607,8 @@ gdb.py: hook.in Makefile install-data-local: gdb.py @$(mkdir_p) $(DESTDIR)$(toolexeclibdir) - @here=`pwd`; cd $(DESTDIR)$(toolexeclibdir); \ - for file in libstdc++.*; do \ - case $$file in \ - *-gdb.py) ;; \ - *.la) ;; \ - *) if test -h $$file; then \ - continue; \ - fi; \ - libname=$$file;; \ - esac; \ - done; \ - cd $$here; \ + @libname=`sed -ne "/^library_names=/{s/.*='//;s/'$$//;s/ .*//;p;}" \ + $(DESTDIR)$(toolexeclibdir)/libstdc++.la`; \ echo " $(INSTALL_DATA) gdb.py $(DESTDIR)$(toolexeclibdir)/$$libname-gdb.py"; \ $(INSTALL_DATA) gdb.py $(DESTDIR)$(toolexeclibdir)/$$libname-gdb.py