From 6a6059f779c9ebb39f6011c2285afa93365139ea Mon Sep 17 00:00:00 2001 From: Nick Bowler Date: Sat, 19 Feb 2022 17:56:28 -0500 Subject: [PATCH] Add object prefixing option for DX_GNULIB_SYMFILES. This is needed to avoid an Automake limitation when mixing libtool and non-libtool builds of the same source files. This prefix should match the object renaming done by Automake when the subdir-objects option is used. --- m4/gnulib-shared.m4 | 15 ++++++++++----- tests/macros.at | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 5 deletions(-) diff --git a/m4/gnulib-shared.m4 b/m4/gnulib-shared.m4 index 6747bb9..661da73 100644 --- a/m4/gnulib-shared.m4 +++ b/m4/gnulib-shared.m4 @@ -6,7 +6,7 @@ dnl License WTFPL2: Do What The Fuck You Want To Public License, version 2. dnl This is free software: you are free to do what the fuck you want to. dnl There is NO WARRANTY, to the extent permitted by law. -dnl DX_GNULIB_SYMFILES(filename) +dnl DX_GNULIB_SYMFILES(filename, [shortname]) dnl dnl When using the glconfig symbol-renaming functionality to include gnulib dnl components in a library, it may not be the case that every file is actually @@ -24,7 +24,10 @@ dnl config.status hook to patch the gnulib_symfiles assignment in the Makefile dnl based on the actually-enabled gnulib objects. dnl dnl The list of leftover objects which are not subject to symbol renaming is -dnl then placed in the gnulib_extra_objects make variable. +dnl then placed in the gnulib_extra_objects make variable. If shortname is +dnl nonempty, these object file names will be prefixed with the specified +dnl value followed by a hyphen (to match up with Automake's object file +dnl renaming system). AC_DEFUN_ONCE([DX_GNULIB_SYMFILES], [AC_REQUIRE([DX_PROG_JOIN])dnl CONFIGURE_DEPENDENCIES=${CONFIGURE_DEPENDENCIES:+" "}'${top_srcdir}/$1' @@ -54,10 +57,12 @@ EOF $[1] "/" $[2] "/" $[3] == "gnulib_symfiles/=/$(gnulib_all_symfiles)" { objlst = symlst = ""; while ((rc = getline < f) > 0) { - if ($[3] == "x") + if ($[3] == "x") { symlst = symlst " " $[1] ".glsym"; - else - objlst = objlst " " $[1] $[2]; + } else { + m4_ifnblank([$2], [sub(/[[^\/]]*$/, "$2-&", $[1]); + ])objlst = objlst " " $[1] $[2]; + } } if (rc < 0) diff --git a/tests/macros.at b/tests/macros.at index e5eb8ff..e0681c4 100644 --- a/tests/macros.at +++ b/tests/macros.at @@ -429,6 +429,39 @@ cd .. AT_CLEANUP +AT_SETUP([DX_GNULIB_SYMFILES shortname]) +AT_KEYWORDS([DX_GNULIB_SYMFILES macro]) + +TEST_SYMFILES_INIT + +sed '/GNULIB_SYMFILES/c\ +[DX_GNULIB_SYMFILES([symfiles.lst], [x])]' configure.ac >configure.tmp +sed '/gnulib_objects/s|$| a/b.o a/b/c.o|' Makefile.am >Makefile.tmp +mv -f configure.tmp configure.ac +mv -f Makefile.tmp Makefile.am + +AT_DATA([symfiles.lst], +[[b.c +c.c +d.c +e.c +]]) +TEST_AUTORECONF + +TEST_CONFIGURE +AT_CHECK([make -s do_test], [0], +[[b.glsym +c.glsym +d.glsym +e.glsym +/// +a/b/x-c.o +a/x-b.o +x-a.o +]]) + +AT_CLEANUP + AT_SETUP([DX_GNULIB_SYMFILES distribution]) AT_KEYWORDS([DX_GNULIB_SYMFILES macro]) -- 2.43.2