From 89d40264cfdac1c2fee6c7e02c830832305e3167 Mon Sep 17 00:00:00 2001 From: Kaian Date: Mon, 24 May 2021 14:31:34 +0200 Subject: [PATCH] build: fix compatibility with ncurses-config scripts #360 --- configure.ac | 4 ++-- m4/sngrep.m4 | 13 ++++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/configure.ac b/configure.ac index aec2c35..f9db626 100644 --- a/configure.ac +++ b/configure.ac @@ -55,10 +55,10 @@ AS_IF([test "x$enable_unicode" == "xyes"], [ # Ncurses with wide-character support AC_DEFINE([WITH_UNICODE], [], [Compile With Unicode compatibility]) - SNGREP_CHECK_SCRIPT([ncursesw6], [addnwstr], [WITH_UNICODE], "ncursesw6-config", + SNGREP_CHECK_SCRIPT([ncursesw], [addnwstr], [WITH_UNICODE], "ncursesw6-config", SNGREP_CHECK_SCRIPT([ncursesw], [addnwstr], [WITH_UNICODE], "ncursesw5-config", SNGREP_CHECK_SCRIPT([ncurses], [addnwstr], [WITH_UNICODE], "ncurses5-config", - SNGREP_CHECK_LIB([ncursesw6], [addnwstr], [WITH_UNICODE], + SNGREP_CHECK_LIB([ncursesw], [addnwstr], [WITH_UNICODE], SNGREP_CHECK_LIB([ncursesw], [addnwstr], [WITH_UNICODE], SNGREP_CHECK_LIB([ncurses], [addnwstr], [WITH_UNICODE], )))))) diff --git a/m4/sngrep.m4 b/m4/sngrep.m4 index 4b90e3e..07eeab0 100644 --- a/m4/sngrep.m4 +++ b/m4/sngrep.m4 @@ -31,17 +31,20 @@ AC_DEFUN([SNGREP_CHECK_SCRIPT], [ if test ! -z "m4_toupper($SNGREP_[$1]_CONFIG_SCRIPT)"; then # to be used to set the path to *-config when cross-compiling - sngrep_config_script=$(m4_toupper($SNGREP_[$1]_CONFIG_SCRIPT) --libs 2> /dev/null) + sngrep_config_script_libs=$(m4_toupper($SNGREP_[$1]_CONFIG_SCRIPT) --libs 2> /dev/null) + sngrep_config_script_cflags=$(m4_toupper($SNGREP_[$1]_CONFIG_SCRIPT) --cflags 2> /dev/null) else - sngrep_config_script=$([$4] --libs 2> /dev/null) + sngrep_config_script_libs=$([$4] --libs 2> /dev/null) + sngrep_config_script_cflags=$([$4] --cflags 2> /dev/null) fi sngrep_script_success=no sngrep_save_LDFLAGS="$LDFLAGS" - if test ! "x$sngrep_config_script" = x; then - LDFLAGS="$sngrep_config_script $LDFLAGS" + if test ! "x$sngrep_config_script_libs" = x; then + LDFLAGS="$sngrep_config_script_libs $LDFLAGS" AC_CHECK_LIB([$1], [$2], [ AC_DEFINE([$3], 1, [The library is present.]) - LIBS="$sngrep_config_script $LIBS " + LIBS="$sngrep_config_script_libs $LIBS " + CFLAGS="$sngrep_config_script_cflags $CFLAGS " sngrep_script_success=yes ], []) LDFLAGS="$sngrep_save_LDFLAGS"