From 46584b6d3efed53bbedc697f26b4d0841dfda9fc Mon Sep 17 00:00:00 2001 From: Nick Bowler Date: Sat, 6 Jan 2024 22:55:22 -0500 Subject: [PATCH] curses-compat: Improve probe for request_mouse_pos. On AIX 7.2, the request_mouse_pos function is defined but it seems the related macros (e.g., MOUSE_X_POS) don't actually work, leading to undefined variable references at link time. The configure test should have caught this, but it turns out GCC optimizes out the check. So configure concludes request_mouse_pos is supported and then later compilation of programs which use this feature fail to link. Ensure the macro usage influences the program return value so GCC doesn't delete it. --- m4/curses-compat.m4 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/m4/curses-compat.m4 b/m4/curses-compat.m4 index c445a67..c24a5ad 100644 --- a/m4/curses-compat.m4 +++ b/m4/curses-compat.m4 @@ -1,4 +1,4 @@ -dnl Copyright © 2022 Nick Bowler +dnl Copyright © 2022, 2024 Nick Bowler dnl dnl Macros for probing specific curses library behaviour. dnl @@ -68,7 +68,7 @@ AS_CASE([$dx_cv_curses_have_mouse_set$dx_cv_curses_have_mousemask], DX_CHECK_CURSES_GETMOUSE_NCURSES AS_IF([test x"$dx_cv_curses_have_getmouse_ncurses" != x"yes"], [DX_CHECK_CURSES_FUNC([request_mouse_pos], [], - [switch (BUTTON_STATUS(1)) case BUTTON_PRESSED:;])]) + [switch (BUTTON_STATUS(1)) case BUTTON_PRESSED: return 42;])]) AS_CASE( [$dx_cv_curses_have_getmouse_ncurses$dx_cv_curses_have_request_mouse_pos], [*yes*], [AC_DEFINE([HAVE_CURSES_MOUSE_SUPPORT], [1], -- 2.43.2