The details are exactly the same as
https://gcc.gnu.org/pipermail/gcc-patches/2025-July/689865.html, except
this is for libssp not libgcc.

It probably makes sense to just pick one of these to review first, and
then based on any feedback I can rework the other one. But for
posterity, and to illustrate the pattern, I am submitting this one too
before the other is submitted.

libssp/ChangeLog:

        * Makefile.am: Use regular libdir/includedir, no more libsubdir
        etc.
        * Makefile.in: Regenerate.
        * configure: Regenerate.
        * configure.ac: Stash away the passed libdir as orig_libdir, and
        define libdir and includedir to match what Makefile.in used to
        do.

Signed-off-by: John Ericson <g...@johnericson.me>
---
 libssp/Makefile.am  |   6 +--
 libssp/Makefile.in  | 113 +++++++++++++++++++++-----------------------
 libssp/configure    |  12 +++--
 libssp/configure.ac |  12 +++--
 4 files changed, 75 insertions(+), 68 deletions(-)

diff --git a/libssp/Makefile.am b/libssp/Makefile.am
index 90401c539a3..8a94bd4183c 100644
--- a/libssp/Makefile.am
+++ b/libssp/Makefile.am
@@ -34,11 +34,9 @@ endif
 AM_CFLAGS = -Wall
 AM_CFLAGS += $(XCFLAGS)
 
-toolexeclib_LTLIBRARIES = libssp.la libssp_nonshared.la
+lib_LTLIBRARIES = libssp.la libssp_nonshared.la
 
-target_noncanonical = @target_noncanonical@
-libsubincludedir = $(libdir)/gcc/$(target_noncanonical)/$(gcc_version)/include
-nobase_libsubinclude_HEADERS = ssp/ssp.h ssp/string.h ssp/stdio.h ssp/unistd.h
+nobase_include_HEADERS = ssp/ssp.h ssp/string.h ssp/stdio.h ssp/unistd.h
 
 libssp_la_SOURCES = \
        ssp.c gets-chk.c memcpy-chk.c memmove-chk.c mempcpy-chk.c \
diff --git a/libssp/Makefile.in b/libssp/Makefile.in
index febbc4e5e57..ff0bbb49429 100644
--- a/libssp/Makefile.in
+++ b/libssp/Makefile.in
@@ -108,7 +108,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
        $(ACLOCAL_M4)
 DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \
-       $(am__configure_deps) $(nobase_libsubinclude_HEADERS)
+       $(am__configure_deps) $(nobase_include_HEADERS)
 am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
  configure.lineno config.status.lineno
 mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
@@ -142,9 +142,8 @@ am__uninstall_files_from_dir = { \
     || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
          $(am__cd) "$$dir" && rm -f $$files; }; \
   }
-am__installdirs = "$(DESTDIR)$(toolexeclibdir)" \
-       "$(DESTDIR)$(libsubincludedir)"
-LTLIBRARIES = $(toolexeclib_LTLIBRARIES)
+am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"
+LTLIBRARIES = $(lib_LTLIBRARIES)
 am_libssp_la_OBJECTS = ssp.lo gets-chk.lo memcpy-chk.lo memmove-chk.lo \
        mempcpy-chk.lo memset-chk.lo snprintf-chk.lo sprintf-chk.lo \
        stpcpy-chk.lo strcat-chk.lo strcpy-chk.lo strncat-chk.lo \
@@ -203,7 +202,7 @@ am__can_run_installinfo = \
     n|no|NO) false;; \
     *) (install-info --version) >/dev/null 2>&1;; \
   esac
-HEADERS = $(nobase_libsubinclude_HEADERS)
+HEADERS = $(nobase_include_HEADERS)
 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \
        $(LISP)config.h.in
 # Read a list of newline-separated strings from the standard input,
@@ -365,9 +364,8 @@ gcc_version := $(shell @get_gcc_base_ver@ 
$(top_srcdir)/../gcc/BASE-VER)
 @LIBSSP_USE_SYMVER_GNU_TRUE@@LIBSSP_USE_SYMVER_TRUE@version_dep = 
$(srcdir)/ssp.map
 @LIBSSP_USE_SYMVER_SUN_TRUE@@LIBSSP_USE_SYMVER_TRUE@version_dep = ssp.map-sun
 AM_CFLAGS = -Wall $(XCFLAGS)
-toolexeclib_LTLIBRARIES = libssp.la libssp_nonshared.la
-libsubincludedir = $(libdir)/gcc/$(target_noncanonical)/$(gcc_version)/include
-nobase_libsubinclude_HEADERS = ssp/ssp.h ssp/string.h ssp/stdio.h ssp/unistd.h
+lib_LTLIBRARIES = libssp.la libssp_nonshared.la
+nobase_include_HEADERS = ssp/ssp.h ssp/string.h ssp/stdio.h ssp/unistd.h
 libssp_la_SOURCES = \
        ssp.c gets-chk.c memcpy-chk.c memmove-chk.c mempcpy-chk.c \
        memset-chk.c snprintf-chk.c sprintf-chk.c stpcpy-chk.c \
@@ -498,33 +496,33 @@ distclean-hdr:
 ssp/ssp.h: $(top_builddir)/config.status $(top_srcdir)/ssp/ssp.h.in
        cd $(top_builddir) && $(SHELL) ./config.status $@
 
-install-toolexeclibLTLIBRARIES: $(toolexeclib_LTLIBRARIES)
+install-libLTLIBRARIES: $(lib_LTLIBRARIES)
        @$(NORMAL_INSTALL)
-       @list='$(toolexeclib_LTLIBRARIES)'; test -n "$(toolexeclibdir)" || 
list=; \
+       @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
        list2=; for p in $$list; do \
          if test -f $$p; then \
            list2="$$list2 $$p"; \
          else :; fi; \
        done; \
        test -z "$$list2" || { \
-         echo " $(MKDIR_P) '$(DESTDIR)$(toolexeclibdir)'"; \
-         $(MKDIR_P) "$(DESTDIR)$(toolexeclibdir)" || exit 1; \
-         echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install 
$(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(toolexeclibdir)'"; \
-         $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install 
$(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(toolexeclibdir)"; \
+         echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \
+         $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \
+         echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install 
$(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
+         $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install 
$(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
        }
 
-uninstall-toolexeclibLTLIBRARIES:
+uninstall-libLTLIBRARIES:
        @$(NORMAL_UNINSTALL)
-       @list='$(toolexeclib_LTLIBRARIES)'; test -n "$(toolexeclibdir)" || 
list=; \
+       @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
        for p in $$list; do \
          $(am__strip_dir) \
-         echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall 
rm -f '$(DESTDIR)$(toolexeclibdir)/$$f'"; \
-         $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f 
"$(DESTDIR)$(toolexeclibdir)/$$f"; \
+         echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall 
rm -f '$(DESTDIR)$(libdir)/$$f'"; \
+         $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f 
"$(DESTDIR)$(libdir)/$$f"; \
        done
 
-clean-toolexeclibLTLIBRARIES:
-       -test -z "$(toolexeclib_LTLIBRARIES)" || rm -f 
$(toolexeclib_LTLIBRARIES)
-       @list='$(toolexeclib_LTLIBRARIES)'; \
+clean-libLTLIBRARIES:
+       -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
+       @list='$(lib_LTLIBRARIES)'; \
        locs=`for p in $$list; do echo $$p; done | \
              sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
              sort -u`; \
@@ -534,10 +532,10 @@ clean-toolexeclibLTLIBRARIES:
        }
 
 libssp.la: $(libssp_la_OBJECTS) $(libssp_la_DEPENDENCIES) 
$(EXTRA_libssp_la_DEPENDENCIES) 
-       $(AM_V_CCLD)$(libssp_la_LINK) -rpath $(toolexeclibdir) 
$(libssp_la_OBJECTS) $(libssp_la_LIBADD) $(LIBS)
+       $(AM_V_CCLD)$(libssp_la_LINK) -rpath $(libdir) $(libssp_la_OBJECTS) 
$(libssp_la_LIBADD) $(LIBS)
 
 libssp_nonshared.la: $(libssp_nonshared_la_OBJECTS) 
$(libssp_nonshared_la_DEPENDENCIES) $(EXTRA_libssp_nonshared_la_DEPENDENCIES) 
-       $(AM_V_CCLD)$(libssp_nonshared_la_LINK) -rpath $(toolexeclibdir) 
$(libssp_nonshared_la_OBJECTS) $(libssp_nonshared_la_LIBADD) $(LIBS)
+       $(AM_V_CCLD)$(libssp_nonshared_la_LINK) -rpath $(libdir) 
$(libssp_nonshared_la_OBJECTS) $(libssp_nonshared_la_LIBADD) $(LIBS)
 
 mostlyclean-compile:
        -rm -f *.$(OBJEXT)
@@ -598,12 +596,12 @@ clean-libtool:
 
 distclean-libtool:
        -rm -f libtool config.lt
-install-nobase_libsubincludeHEADERS: $(nobase_libsubinclude_HEADERS)
+install-nobase_includeHEADERS: $(nobase_include_HEADERS)
        @$(NORMAL_INSTALL)
-       @list='$(nobase_libsubinclude_HEADERS)'; test -n "$(libsubincludedir)" 
|| list=; \
+       @list='$(nobase_include_HEADERS)'; test -n "$(includedir)" || list=; \
        if test -n "$$list"; then \
-         echo " $(MKDIR_P) '$(DESTDIR)$(libsubincludedir)'"; \
-         $(MKDIR_P) "$(DESTDIR)$(libsubincludedir)" || exit 1; \
+         echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \
+         $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \
        fi; \
        $(am__nobase_list) | while read dir files; do \
          xfiles=; for file in $$files; do \
@@ -611,17 +609,17 @@ install-nobase_libsubincludeHEADERS: 
$(nobase_libsubinclude_HEADERS)
            else xfiles="$$xfiles $(srcdir)/$$file"; fi; done; \
          test -z "$$xfiles" || { \
            test "x$$dir" = x. || { \
-             echo " $(MKDIR_P) '$(DESTDIR)$(libsubincludedir)/$$dir'"; \
-             $(MKDIR_P) "$(DESTDIR)$(libsubincludedir)/$$dir"; }; \
-           echo " $(INSTALL_HEADER) $$xfiles 
'$(DESTDIR)$(libsubincludedir)/$$dir'"; \
-           $(INSTALL_HEADER) $$xfiles "$(DESTDIR)$(libsubincludedir)/$$dir" || 
exit $$?; }; \
+             echo " $(MKDIR_P) '$(DESTDIR)$(includedir)/$$dir'"; \
+             $(MKDIR_P) "$(DESTDIR)$(includedir)/$$dir"; }; \
+           echo " $(INSTALL_HEADER) $$xfiles '$(DESTDIR)$(includedir)/$$dir'"; 
\
+           $(INSTALL_HEADER) $$xfiles "$(DESTDIR)$(includedir)/$$dir" || exit 
$$?; }; \
        done
 
-uninstall-nobase_libsubincludeHEADERS:
+uninstall-nobase_includeHEADERS:
        @$(NORMAL_UNINSTALL)
-       @list='$(nobase_libsubinclude_HEADERS)'; test -n "$(libsubincludedir)" 
|| list=; \
+       @list='$(nobase_include_HEADERS)'; test -n "$(includedir)" || list=; \
        $(am__nobase_strip_setup); files=`$(am__nobase_strip)`; \
-       dir='$(DESTDIR)$(libsubincludedir)'; $(am__uninstall_files_from_dir)
+       dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir)
 
 ID: $(am__tagged_files)
        $(am__define_uniq_tagged_files); mkid -fID $$unique
@@ -685,7 +683,7 @@ check-am: all-am
 check: check-am
 all-am: Makefile $(LTLIBRARIES) $(HEADERS) config.h all-local
 installdirs:
-       for dir in "$(DESTDIR)$(toolexeclibdir)" 
"$(DESTDIR)$(libsubincludedir)"; do \
+       for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"; do \
          test -z "$$dir" || $(MKDIR_P) "$$dir"; \
        done
 install: install-am
@@ -720,8 +718,8 @@ maintainer-clean-generic:
        @echo "it deletes files that may require special tools to rebuild."
 clean: clean-am
 
-clean-am: clean-generic clean-libtool clean-local \
-       clean-toolexeclibLTLIBRARIES mostlyclean-am
+clean-am: clean-generic clean-libLTLIBRARIES clean-libtool clean-local \
+       mostlyclean-am
 
 distclean: distclean-am
        -rm -f $(am__CONFIG_DISTCLEAN_FILES)
@@ -742,13 +740,13 @@ info: info-am
 
 info-am:
 
-install-data-am: install-nobase_libsubincludeHEADERS
+install-data-am: install-nobase_includeHEADERS
 
 install-dvi: install-dvi-am
 
 install-dvi-am:
 
-install-exec-am: install-exec-local install-toolexeclibLTLIBRARIES
+install-exec-am: install-exec-local install-libLTLIBRARIES
 
 install-html: install-html-am
 
@@ -791,29 +789,28 @@ ps: ps-am
 
 ps-am:
 
-uninstall-am: uninstall-nobase_libsubincludeHEADERS \
-       uninstall-toolexeclibLTLIBRARIES
+uninstall-am: uninstall-libLTLIBRARIES uninstall-nobase_includeHEADERS
 
 .MAKE: all install-am install-strip
 
 .PHONY: CTAGS GTAGS TAGS all all-am all-local am--refresh check \
-       check-am clean clean-cscope clean-generic clean-libtool \
-       clean-local clean-toolexeclibLTLIBRARIES cscope cscopelist-am \
-       ctags ctags-am distclean distclean-compile distclean-generic \
-       distclean-hdr distclean-libtool distclean-local distclean-tags \
-       dvi dvi-am html html-am info info-am install install-am \
-       install-data install-data-am install-dvi install-dvi-am \
-       install-exec install-exec-am install-exec-local install-html \
-       install-html-am install-info install-info-am install-man \
-       install-nobase_libsubincludeHEADERS install-pdf install-pdf-am \
-       install-ps install-ps-am install-strip \
-       install-toolexeclibLTLIBRARIES installcheck installcheck-am \
-       installdirs maintainer-clean maintainer-clean-generic \
-       maintainer-clean-local mostlyclean mostlyclean-compile \
-       mostlyclean-generic mostlyclean-libtool mostlyclean-local pdf \
-       pdf-am ps ps-am tags tags-am uninstall uninstall-am \
-       uninstall-nobase_libsubincludeHEADERS \
-       uninstall-toolexeclibLTLIBRARIES
+       check-am clean clean-cscope clean-generic clean-libLTLIBRARIES \
+       clean-libtool clean-local cscope cscopelist-am ctags ctags-am \
+       distclean distclean-compile distclean-generic distclean-hdr \
+       distclean-libtool distclean-local distclean-tags dvi dvi-am \
+       html html-am info info-am install install-am install-data \
+       install-data-am install-dvi install-dvi-am install-exec \
+       install-exec-am install-exec-local install-html \
+       install-html-am install-info install-info-am \
+       install-libLTLIBRARIES install-man \
+       install-nobase_includeHEADERS install-pdf install-pdf-am \
+       install-ps install-ps-am install-strip installcheck \
+       installcheck-am installdirs maintainer-clean \
+       maintainer-clean-generic maintainer-clean-local mostlyclean \
+       mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+       mostlyclean-local pdf pdf-am ps ps-am tags tags-am uninstall \
+       uninstall-am uninstall-libLTLIBRARIES \
+       uninstall-nobase_includeHEADERS
 
 .PRECIOUS: Makefile
 
diff --git a/libssp/configure b/libssp/configure
index 0052e03650d..7c51a2a8607 100755
--- a/libssp/configure
+++ b/libssp/configure
@@ -11557,6 +11557,8 @@ else
 fi
 
 
+orig_libdir=$libdir
+
 # Calculate toolexeclibdir
 # Also toolexecdir, though it's only used in toolexeclibdir
 case ${version_specific_libs} in
@@ -11564,7 +11566,7 @@ case ${version_specific_libs} in
     # Need the gcc compiler version to know where to install libraries
     # and header files if --enable-version-specific-runtime-libs option
     # is selected.
-    toolexecdir='$(libdir)/gcc/$(target_alias)'
+    toolexecdir=${orig_libdir}'/gcc/$(target_alias)'
     toolexeclibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)'
     ;;
   no)
@@ -11581,8 +11583,8 @@ case ${version_specific_libs} in
          ;;
       esac
     else
-      toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
-      toolexeclibdir='$(libdir)'
+      toolexecdir=${orig_libdir}'/gcc-lib/$(target_alias)'
+      toolexeclibdir=${orig_libdir}
     fi
     multi_os_directory=`$CC -print-multi-os-directory`
     case $multi_os_directory in
@@ -11594,6 +11596,10 @@ esac
 
 
 
+# Directory in which the compiler finds libraries etc.
+libdir='$(toolexeclibdir)'
+includedir=${orig_libdir}/gcc/${host_noncanonical}/'$(version)/include'
+
 if test ${multilib} = yes; then
   multilib_arg="--enable-multilib"
 else
diff --git a/libssp/configure.ac b/libssp/configure.ac
index 5c5698fa3a2..5b9fa4fbecc 100644
--- a/libssp/configure.ac
+++ b/libssp/configure.ac
@@ -168,6 +168,8 @@ GCC_WITH_TOOLEXECLIBDIR
 
 AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = 
xyes])
 
+orig_libdir=$libdir
+
 # Calculate toolexeclibdir
 # Also toolexecdir, though it's only used in toolexeclibdir
 case ${version_specific_libs} in
@@ -175,7 +177,7 @@ case ${version_specific_libs} in
     # Need the gcc compiler version to know where to install libraries
     # and header files if --enable-version-specific-runtime-libs option
     # is selected.
-    toolexecdir='$(libdir)/gcc/$(target_alias)'
+    toolexecdir=${orig_libdir}'/gcc/$(target_alias)'
     toolexeclibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)'
     ;;
   no)
@@ -192,8 +194,8 @@ case ${version_specific_libs} in
          ;;
       esac
     else
-      toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
-      toolexeclibdir='$(libdir)'
+      toolexecdir=${orig_libdir}'/gcc-lib/$(target_alias)'
+      toolexeclibdir=${orig_libdir}
     fi
     multi_os_directory=`$CC -print-multi-os-directory`
     case $multi_os_directory in
@@ -205,6 +207,10 @@ esac
 AC_SUBST(toolexecdir)
 AC_SUBST(toolexeclibdir)
 
+# Directory in which the compiler finds libraries etc.
+libdir='$(toolexeclibdir)'
+includedir=${orig_libdir}/gcc/${host_noncanonical}/'$(version)/include'
+
 if test ${multilib} = yes; then
   multilib_arg="--enable-multilib"
 else
-- 
2.47.2

Reply via email to