]> git.draconx.ca Git - dxcommon.git/blobdiff - m4/gnulib-shared.m4
Add object prefixing option for DX_GNULIB_SYMFILES.
[dxcommon.git] / m4 / gnulib-shared.m4
index 6747bb936a7f5fbcb504bfdd63f9964798904874..661da7384f4cf4af194d6ca992628b8f5b1a3dad 100644 (file)
@@ -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)