build: fix compatibility with ncurses-config scripts #360

This commit is contained in:
Kaian 2021-05-24 14:31:34 +02:00
parent efe41b9c3e
commit 89d40264cf
2 changed files with 10 additions and 7 deletions

View File

@ -55,10 +55,10 @@ AS_IF([test "x$enable_unicode" == "xyes"], [
# Ncurses with wide-character support # Ncurses with wide-character support
AC_DEFINE([WITH_UNICODE], [], [Compile With Unicode compatibility]) 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([ncursesw], [addnwstr], [WITH_UNICODE], "ncursesw5-config",
SNGREP_CHECK_SCRIPT([ncurses], [addnwstr], [WITH_UNICODE], "ncurses5-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([ncursesw], [addnwstr], [WITH_UNICODE],
SNGREP_CHECK_LIB([ncurses], [addnwstr], [WITH_UNICODE], SNGREP_CHECK_LIB([ncurses], [addnwstr], [WITH_UNICODE],
)))))) ))))))

View File

@ -31,17 +31,20 @@ AC_DEFUN([SNGREP_CHECK_SCRIPT],
[ [
if test ! -z "m4_toupper($SNGREP_[$1]_CONFIG_SCRIPT)"; then if test ! -z "m4_toupper($SNGREP_[$1]_CONFIG_SCRIPT)"; then
# to be used to set the path to *-config when cross-compiling # 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 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 fi
sngrep_script_success=no sngrep_script_success=no
sngrep_save_LDFLAGS="$LDFLAGS" sngrep_save_LDFLAGS="$LDFLAGS"
if test ! "x$sngrep_config_script" = x; then if test ! "x$sngrep_config_script_libs" = x; then
LDFLAGS="$sngrep_config_script $LDFLAGS" LDFLAGS="$sngrep_config_script_libs $LDFLAGS"
AC_CHECK_LIB([$1], [$2], [ AC_CHECK_LIB([$1], [$2], [
AC_DEFINE([$3], 1, [The library is present.]) 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 sngrep_script_success=yes
], []) ], [])
LDFLAGS="$sngrep_save_LDFLAGS" LDFLAGS="$sngrep_save_LDFLAGS"