X-Git-Url: https://git.draconx.ca/gitweb/dxcommon.git/blobdiff_plain/8399cb7be4ef4ad57f6a4ef507e8c0fab4c9a78a..984752355c18f9cfac6425e6387a2d157c011846:/m4/gnulib-shared.m4 diff --git a/m4/gnulib-shared.m4 b/m4/gnulib-shared.m4 index 6747bb9..4d2e273 100644 --- a/m4/gnulib-shared.m4 +++ b/m4/gnulib-shared.m4 @@ -1,4 +1,4 @@ -dnl Copyright © 2022 Nick Bowler +dnl Copyright © 2022-2024 Nick Bowler dnl dnl Hack to reduce glsym transformations to a subset of gnulib sources. dnl @@ -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' @@ -50,32 +53,32 @@ m4_bpatsubst(m4_indir([m4_include], [$1]), [[.][^/.]*$], [ x]) EOF $JOIN -a1 "$ac_tmp/gl_syms.1" "$ac_tmp/gl_syms.2" >"$ac_tmp/gl_syms.3" # Now replace default gnulib_symfiles assignment with the computed list - $AWK -f - -v f="$ac_tmp/gl_syms.3" "$gl_of" >"$ac_tmp/gl_tmp.mk" <<'EOF' -$[1] "/" $[2] "/" $[3] == "gnulib_symfiles/=/$(gnulib_all_symfiles)" { - objlst = symlst = ""; - while ((rc = getline < f) > 0) { - if ($[3] == "x") - symlst = symlst " " $[1] ".glsym"; - else - objlst = objlst " " $[1] $[2]; - } + $AWK '$[1] "/" $[2] "/" $[3] == "gnulib_symfiles/=/$(gnulib_all_symfiles)" { + objlst = symlst = ""; + while ((rc = getline < f) > 0) { + if ($[3] == "x") { + symlst = symlst " " $[1] ".glsym"; + } else { + m4_ifnblank([$2], [sub(/[[^\/]]*$/, "$2-&", $[1]); + ])objlst = objlst " " $[1] $[2]; + } + } - if (rc < 0) - exit 1; + if (rc < 0) + exit 1; - print "gnulib_symfiles =" symlst; - print "gnulib_extra_objects =" objlst; - next; -} -# add ourself to Automake's generated rebuild rules -$[2] == "=" && $[1] ~ /^am__(depfiles_maybe|maybe_remake_depfiles)$/ { - for (i = 3; i <= NF; i++) - if ($i == "gnulib-symfiles") - break; - $i = "gnulib-symfiles"; -} -{ print } -EOF + print "gnulib_symfiles =" symlst; + print "gnulib_extra_objects =" objlst; + next; + } + # add ourself to Automake-generated rebuild rules + $[2] == "=" && $[1] ~ /^am__(depfiles_maybe|maybe_remake_depfiles)$/ { + for (i = 3; i <= NF; i++) + if ($i == "gnulib-symfiles") + break; + $i = "gnulib-symfiles"; + } + { print; }' f="$ac_tmp/gl_syms.3" "$gl_of" >"$ac_tmp/gl_tmp.mk" mv -f "$ac_tmp/gl_tmp.mk" "$gl_of" break # should be max one makefile needing patching done], [: "\${MAKE=${MAKE-make}}" "\${JOIN=$JOIN}"])])