Skip to content

Consolidate libtool patching

Sergey Kosukhin requested to merge libtool_patches into master

It would be nice to have all libtool patches and scripts that we use in our projects in one place.

  1. af89398c and 637d0c86 are taken from libcdi where they are needed for the C++-based Python and Ruby bindings.
  2. 427fe4d7 is needed to avoid the annoying unary operator expected shell warnings when building with the C++ compiler (with_nagfor is not set for CXX).
  3. 7c29a65a adds patches based on jahns/cdi-pio@d7ed6049 and jahns/cdi-pio@7fade4eb. I don't know if it's still relevant.
  4. NAG pthread patches are not applicable to libtool 2.4.2. I don't know if it makes sense to support that version of libtool. If yes, 536f9af1 adds libtool-2.4.2-specific versions of the patches.
  5. 793f43aa brings attention to the fact that either nagfor-libtool.patch or nagfor-libtool-2.4.2.patch could probably be removed.
  6. 089e4fce prevents the overlinking. For example, executables that are linked to libcdipio.so do not have to be directly linked to libscalesppmcore.so and we have a test for that (see here). This would be the only patch that modifies libtool.m4: it makes it easier to disable it for some projects (I personally would not mind having it for all projects) and writing a robust regular expression for the monkey-patching is hard. Something like the following could work though:
    --- a/m4/acx_use_libtool_configuration.m4
    +++ b/m4/acx_use_libtool_configuration.m4
    @@ -99,6 +99,7 @@ dnl newer PGI or NAG configurations particularly well
               [$CC\1 -shared $libobjs $deplibs ])),
               [pgcpp\*],[pgcpp* | pgc++* ]))dnl
           m4_pushdef([_LT_LINKER_SHLIBS],m4_bpatsubst(m4_dquote(
    +        m4_bpatsubst(m4_dquote(m4_bpatsubst(m4_dquote(
             m4_bpatsubst(m4_dquote(m4_bpatsubst(m4_dquote(
             m4_bpatsubst(m4_dquote(m4_bpatsubst(m4_dquote(m4_defn(
               [_LT_LINKER_SHLIBS])),[tmp_sharedflag='-shared'],
    @@ -114,7 +115,15 @@ dnl newer PGI or NAG configurations particularly well
     ],[\&	*NAG\\ Fortran\\ Compiler*\1
     	  tmp_sharedflag='-Wl,-shared'
     	  tmp_compiler_flags='`echo " \$compiler_flags " | sed -E -e '"'"': start'"'"' -e '"'"'s/ -W@<:@cl@:>@,-no-pie@<:@@<:@:blank:@:>@@:>@/ /g;t start'"'"' -e '"'"'s/^ //;s/ $//'"'"'`' ;;
    -])),acx_lt_sed[ 5q`],acx_lt_sed[ -n 1,5p`]))dnl
    +])),acx_lt_sed[ 5q`],acx_lt_sed[ -n 1,5p`])),
    +        [^  case \$host_os in],
    +        [\&
    +  linux* | k*bsd*-gnu | gnu*)
    +    _LT_TAGVAR(link_all_deplibs, $1)=no
    +    ;;])),
    +        [^	if test yes = "$lt_cv_irix_exported_symbol"; then],
    +        [	_LT_TAGVAR(link_all_deplibs, $][1)=no
    +\&]))dnl
           m4_pushdef([_LT_SYS_HIDDEN_LIBDEPS],[AS_UNSET([output_verbose_link_cmd])]
             m4_bpatsubst(m4_dquote(m4_bpatsubst(m4_dquote(
               m4_defn([_LT_SYS_HIDDEN_LIBDEPS])),[test x-\([LR]\) = "\$p"],
  7. I have stumbled upon a problem on macOS: MacPorts-provided autoconf is looking for libtoolize instead of glibtoolize. Commit ea842f02 ensures that all Autotools drivers use the same instance of libtoolize as the reconfigure script, which also fixes the issue on macOS.
  8. Commit 8bac849e looks like a logical development of the previous modification.
  9. Hopefully, the rest of the commits have messages that give enough information on why they are needed.

Merge request reports