Skip to content

Commit

Permalink
build: Check for --undefined-version support
Browse files Browse the repository at this point in the history
Gate the use of `--undefined-version` in the linker because it breaks on
older GNU `ld`: https://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=58272.
  • Loading branch information
wismill committed Jul 12, 2024
1 parent b5d3fa9 commit 7d4649e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions changes/build/481.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Gate the use of `--undefined-version` in the linker because it breaks on older
GNU `ld`.
7 changes: 6 additions & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,14 @@ configh_data.set('_CRT_NONSTDC_NO_DEPRECATE', 1)
configh_data.set('WIN32_LEAN_AND_MEAN', 1)

# Supports -Wl,--version-script?
if cc.has_link_argument('-Wl,--undefined-version')
extra_linker_args = ',--undefined-version'
else
extra_linker_args = ''
endif
have_version_script = cc.links(
'int main(){}',
args: '-Wl,--undefined-version,--version-script=' + meson.current_source_dir()/'xkbcommon.map',
args: '-Wl,--version-script=' + meson.current_source_dir()/'xkbcommon.map' + extra_linker_args,
name: '-Wl,--version-script',
)

Expand Down

0 comments on commit 7d4649e

Please sign in to comment.