summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2022-12-25 11:51:46 +0800
committerruki <[email protected]>2022-12-25 11:51:46 +0800
commit64ce55db038d085477d1df29213667f0dd4557ec (patch)
treee887db274d5af76a0fbd0171e721e69088bff649
parent38e99b6fc6967f2154d521d0e638c86fa7379a0f (diff)
improve to find curses
-rwxr-xr-xcore/xmake.sh17
1 files changed, 16 insertions, 1 deletions
diff --git a/core/xmake.sh b/core/xmake.sh
index c86790279..9e4919595 100755
--- a/core/xmake.sh
+++ b/core/xmake.sh
@@ -45,12 +45,27 @@ option_end
# the curses option
option "curses"
- add_links "curses"
add_cfuncs "initscr"
add_cincludes "curses.h"
add_defines "XM_CONFIG_API_HAVE_CURSES"
+ before_check "option_find_curses"
option_end
+option_find_curses() {
+ local ncurses_cflags=""
+ local ncurses_ldflags=""
+ ncurses_cflags=$(pkg-config --cflags ncurses 2>/dev/null)
+ ncurses_ldflags=$(pkg-config --libs ncurses 2>/dev/null)
+ option "curses"
+ if test_nz "${ncurses_ldflags}"; then
+ add_cflags "${ncurses_cflags}"
+ add_ldflags "${ncurses_ldflags}"
+ else
+ add_links "curses"
+ fi
+ option_end
+}
+
# the atomic option
# @note some systems need link atomic, e.g. raspberrypi
option "atomic"