]> git.draconx.ca Git - dxcommon.git/blob - m4/lt-patches.m4
DX_C_ALIGNAS: Work around bash-5 parsing bug.
[dxcommon.git] / m4 / lt-patches.m4
1 # Copyright © 2024 Nick Bowler
2 #
3 # Monkey patches for libtool.
4 #
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.
8
9 # DX_PATCH_LIBTOOL
10 #
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])[)])])])
16
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])])
21
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.
25 #
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"])])
33
34 _DX_LT_PATCH([libtool-m4-vax-c],
35   [DX_PATCH_MACRO([_LT_CMD_GLOBAL_SYMBOLS], [^# *elif.*__osf__$],
36     [\& || (defined vaxc && defined VAXC)])])