1 # Copyright © 2024 Nick Bowler
3 # Monkey patches for libtool.
5 # License WTFPL2: Do What The Fuck You Want To Public License, version 2.
6 # This is free software: you are free to do what the fuck you want to.
7 # There is NO WARRANTY, to the extent permitted by law.
11 # Apply all the patches described below. Should be expanded before LT_INIT.
12 AC_DEFUN([DX_PATCH_LIBTOOL],
13 [AC_BEFORE([$0], [LT_INIT])dnl
14 m4_foreach_w([patch], m4_defn([_DX_LT_PATCHES]),
15 [m4_indir([_DX_LT_PATCH(]m4_defn([patch])[)])])])
17 m4_define([_DX_LT_PATCHES])
18 m4_define([_DX_LT_PATCH],
19 [m4_define([_DX_LT_PATCH($1)], [$2])m4_define([_DX_LT_PATCHES],
20 m4_defn([_DX_LT_PATCHES])[ $1])])
22 # Avoid "const" on VAX C for libtool's dynamic symbol bits, like with OSF and
23 # Windows platforms, as there seem to be some problems with relocations of
24 # function pointer values in readonly memory.
26 # We patch it in ltmain.sh (via config.status) and in configure directly.
27 # This code is also duplicated in libltdl so further fixes might be needed
28 # for packages using bindled libltdl (not done here... yet?).
29 _DX_LT_PATCH([ltmain-sh-vax-c],
30 [DX_PATCH_MACRO([_LT_CONFIG], [^\( *\)[$]SED '[$]q' "[$]ltmain"],
31 [\1# Use this opportunity also to work around a VAX C bug in upstream libtool
32 \1$SED 's/^# *elif.*__osf__$/& || (defined vaxc \\&\\& defined VAXC)/' "$ltmain"])])
34 _DX_LT_PATCH([libtool-m4-vax-c],
35 [DX_PATCH_MACRO([_LT_CMD_GLOBAL_SYMBOLS], [^# *elif.*__osf__$],
36 [\& || (defined vaxc && defined VAXC)])])