meson: mingw: Add -Wl,--disable-auto-import, enable when linking with readline
I hadn't ported -Wl,--disable-auto-import over from the win32 template as I had focused on msvc for windows. The flag is desirable as it makes it easier to find problems one would have with msvc, particularly useful during cross compilation. This turned out to be a somewhat happy accident, as it allowed me to realize that readline actually works on windows these days, as long as auto imports to enable. Therefore enable auto-import again as part of linking to readline. We perhaps can come up with a better solution for the readline issue, but this seems good enough for now. Discussion: http://postgr.es/m/20220928022724.erzuk5v4ai4b53do@awork3.anarazel.de
This commit is contained in:
parent
2dc2e4e31a
commit
24ef127b6d
|
@ -279,6 +279,8 @@ elif host_system == 'windows'
|
|||
ldflags += '-Wl,--stack,@0@'.format(cdata.get('WIN32_STACK_RLIMIT'))
|
||||
# Need to allow multiple definitions, we e.g. want to override getopt.
|
||||
ldflags += '-Wl,--allow-multiple-definition'
|
||||
# Ensure we get MSVC-like linking behavior.
|
||||
ldflags += '-Wl,--disable-auto-import'
|
||||
endif
|
||||
|
||||
os_deps += cc.find_library('ws2_32', required: true)
|
||||
|
@ -1080,6 +1082,13 @@ Use -Dreadline=false to disable readline support.'''.format(readline_dep))
|
|||
readline = declare_dependency(dependencies: readline,
|
||||
include_directories: postgres_inc)
|
||||
endif
|
||||
|
||||
# On windows with mingw readline requires auto-import to successfully
|
||||
# link, as the headers don't use declspec(dllimport)
|
||||
if host_system == 'windows' and cc.get_id() != 'msvc'
|
||||
readline = declare_dependency(dependencies: readline,
|
||||
link_args: '-Wl,--enable-auto-import')
|
||||
endif
|
||||
endif
|
||||
|
||||
# XXX: Figure out whether to implement mingw warning equivalent
|
||||
|
|
Loading…
Reference in New Issue