[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gtypist] gtypist fails to build with ncurses[tinfo]
From: |
Felix Natter |
Subject: |
Re: [bug-gtypist] gtypist fails to build with ncurses[tinfo] |
Date: |
Sat, 11 Jan 2014 15:23:38 +0100 |
User-agent: |
Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.3 (gnu/linux) |
hi Tim,
>> On Wed, Oct 30, 2013 at 09:55:17PM +0100, Felix Natter wrote:
>>> I coded a very simple solution (PKG_CHECK_MODULES, if that fails use
>>> AC_CHECK_HEADER/LIB), which works both with "ncursesw.pc" and without:
>>
>> But does it work without pkg-config? I suspect that it will throw an
>> error message complaining that pkg-config is not available.
>
> I _think_ I tried it and PKG_CHECK_MODULES catches that.
>
>> There is another problem as well... If I install my own, local copy of
>> libncursesw in to, say, ~/mylibs/myncursesw and then try to go like
>> this:
>>
>> $ ./configure "LDFLAGS=-l$HOME/mylibs/myncursesw"
>>
>> it will not work. pkg-config will use the library that the system
>> knows about instead. There is an interesting post about it here[1].
>
> Ok, good point.
--> maybe one can use this instead (from ./configure --help, exported by
PKG_CHECK_MODULES):
Some influential environment variables:
[...]
PKG_CONFIG path to pkg-config utility
PKG_CONFIG_PATH
directories to add to pkg-config's search path
PKG_CONFIG_LIBDIR
path overriding pkg-config's built-in search path
NCURSESW_CFLAGS
C compiler flags for NCURSESW, overriding pkg-config
NCURSESW_LIBS
linker flags for NCURSESW, overriding pkg-config
EMACS the Emacs editor command
EMACSLOADPATH
the Emacs library search path
---> so ./configure "NCURSESW_LIBS=-l$HOME/mylibs/myncursesw" should
work (in conjuction with [1])?
>> The same post also suggests a way to use PKG_CHECK_MODULES, which we
>> discussed before, that is "correct":
>>
>> 1. invoke AC_CHECK_LIBS *first*, so that the "usual" mechanisms are
>> given a chance to work.
>>
>> 2. if that fails, invoke PKG_CHECK_MODULES
>>
>> 3. if that succeeds, invoke AC_CHECK_LIBS again, in case pkg-config
>> returned something invalid.
>>
>> I agree with you, though -- step 3 probably isn't too important. But
>> would you mind changing your fix to run AC_CHECK_LIBS first, and then
>> PKG_CHECK_MODULES on failure? I think that would be a better
>> solution.
The problem is that for gentoo
(https://bugs.gentoo.org/show_bug.cgi?id=483778,
https://bugs.gentoo.org/show_bug.cgi?id=457530) we need to (optionally)
add -ltinfo, so we probably could do something like (untested)
(and the build will fail again if another -lfoo is added to ncursesw.pc):
AC_CHECK_HEADER(ncursesw/ncurses.h, HAVE_NCURSESW_H=1)
AC_CHECK_LIB(ncursesw, add_wch, HAVE_LIBNCURSESW=1)
AC_CHECK_LIB(tinfo, cbreak, [LIBS="-ltinfo $LIBS"]) # for gentoo
if test -n "$HAVE_NCURSESW_H" -a -n "$HAVE_LIBNCURSESW"; then
LIBS="-lncursesw $LIBS"
else
PKG_CHECK_MODULES(NCURSESW, ncursesw, [
LIBS="$NCURSESW_LIBS $LIBS"
CFLAGS="$NCURSESW_CFLAGS $CFLAGS"], [
echo -e "Error: both library and header files for the ncursesw library\n"\
"are required to build this package. See INSTALL file for"\
"further information. On Debian/Ubuntu you need to install
libncursesw5-dev."
exit 1])
fi
--> but I consider [1] to be cleaner. Am I missing something, what do
you think?
[1] (old solution):
PKG_CHECK_MODULES(NCURSESW, ncursesw, [
LIBS="$NCURSESW_LIBS $LIBS"
CFLAGS="$NCURSESW_CFLAGS $CFLAGS"], [
AC_CHECK_HEADER(ncursesw/ncurses.h, HAVE_NCURSESW_H=1)
AC_CHECK_LIB(ncursesw, add_wch, HAVE_LIBNCURSESW=1)
if test -n "$HAVE_NCURSESW_H" -a -n "$HAVE_LIBNCURSESW"; then
LIBS="-lncursesw $LIBS"
else
echo -e "Error: both library and header files for the ncursesw
library\n"\
"are required to build this package. See INSTALL file for"\
"further information. On Debian/Ubuntu you need to install
libncursesw5-dev."
exit 1;
fi
])
Best Wishes,
--
Felix Natter