forked from Mirrors/sngrep
autotools: fix ncurses wchar detection
This commit is contained in:
parent
e50176a534
commit
9a6550055f
|
@ -1,2 +1,3 @@
|
|||
ACLOCAL_AMFLAGS = -I m4
|
||||
SUBDIRS=src config doc tests
|
||||
EXTRA_DIST=bootstrap.sh
|
||||
|
|
15
configure.ac
15
configure.ac
|
@ -3,6 +3,7 @@ AC_INIT([sngrep], [1.4.3], [kaian@irontec.com], [sngrep], [http://www.irontec.co
|
|||
AM_INIT_AUTOMAKE([1.9])
|
||||
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
|
||||
AC_CONFIG_HEADERS([src/config.h])
|
||||
AC_CONFIG_MACRO_DIRS([m4])
|
||||
|
||||
AC_COPYRIGHT("Irontec S.L.")
|
||||
|
||||
|
@ -53,13 +54,13 @@ AS_IF([test "x$enable_unicode" == "xyes"], [
|
|||
# Ncurses with wide-character support
|
||||
AC_DEFINE([WITH_UNICODE], [], [Compile With Unicode compatibility])
|
||||
|
||||
AC_CHECK_HEADER([ncursesw/ncurses.h], [], [
|
||||
AC_MSG_ERROR([ You need to have ncurses development files installed to compile sngrep.])
|
||||
])
|
||||
|
||||
AC_CHECK_LIB([ncursesw], [initscr], [], [
|
||||
AC_MSG_ERROR([ You need to have libncursesw installed to compile sngrep.])
|
||||
])
|
||||
SNGREP_CHECK_SCRIPT([ncursesw6], [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([ncurses], [addnwstr], [WITH_UNICODE],
|
||||
))))))
|
||||
|
||||
AC_CHECK_LIB([panelw], [new_panel], [], [
|
||||
AC_MSG_ERROR([ You need to have ncurses panelw library installed to compile sngrep.])
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
# serial 100
|
||||
# sngrep.m4: Custom autotools macros for sngrep
|
||||
#
|
||||
# @author Adam Duskett <aduskett@codeblue.com>
|
||||
# @version 2017-05-25
|
||||
# @license GNU General Public License 3.0
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
# 02110-1301, USA.
|
||||
#
|
||||
# As a special exception, the you may copy, distribute and modify the
|
||||
# configure scripts that are the output of Autoconf when processing
|
||||
# the Macro. You need not follow the terms of the GNU General Public
|
||||
# License when using or distributing such scripts.
|
||||
#
|
||||
|
||||
# SNGREP_CHECK_SCRIPT(LIBNAME, FUNCTION, DEFINE, CONFIG_SCRIPT, ELSE_PART)
|
||||
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)
|
||||
else
|
||||
sngrep_config_script=$([$4] --libs 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"
|
||||
AC_CHECK_LIB([$1], [$2], [
|
||||
AC_DEFINE([$3], 1, [The library is present.])
|
||||
LIBS="$sngrep_config_script $LIBS "
|
||||
sngrep_script_success=yes
|
||||
], [])
|
||||
LDFLAGS="$save_LDFLAGS"
|
||||
fi
|
||||
if test "x$sngrep_script_success" = xno; then
|
||||
[$5]
|
||||
fi
|
||||
])
|
||||
|
||||
# SNGREP_CHECK_LIB(LIBNAME, FUNCTION, DEFINE, ELSE_PART)
|
||||
AC_DEFUN([SNGREP_CHECK_LIB],
|
||||
[
|
||||
AC_CHECK_LIB([$1], [$2], [
|
||||
AC_DEFINE([$3], 1, [The library is present.])
|
||||
LIBS="-l[$1] $LIBS "
|
||||
], [$4])
|
||||
])
|
|
@ -32,10 +32,9 @@
|
|||
|
||||
#ifdef WITH_UNICODE
|
||||
#define _X_OPEN_SOURCE_EXTENDED
|
||||
#include <ncursesw/ncurses.h>
|
||||
#else
|
||||
#include <ncurses.h>
|
||||
#include <wctype.h>
|
||||
#endif
|
||||
#include <ncurses.h>
|
||||
|
||||
//! Shorter declaration of scrollbar
|
||||
typedef struct scrollbar scrollbar_t;
|
||||
|
|
|
@ -33,10 +33,9 @@
|
|||
|
||||
#ifdef WITH_UNICODE
|
||||
#define _X_OPEN_SOURCE_EXTENDED
|
||||
#include <ncursesw/ncurses.h>
|
||||
#else
|
||||
#include <ncurses.h>
|
||||
#include <wctype.h>
|
||||
#endif
|
||||
#include <ncurses.h>
|
||||
#include <panel.h>
|
||||
#include <form.h>
|
||||
#include <stdbool.h>
|
||||
|
|
Loading…
Reference in New Issue