bug-gtypist
[Top][All Lists]
Advanced

[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, 18 Jan 2014 21:25:33 +0100
User-agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.3 (gnu/linux)

Tim Marston <address@hidden> writes:

> Hi Felix,

hello Tim,

> On Sat, Jan 11, 2014 at 03:23:38PM +0100, Felix Natter wrote:
>> >> 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):
>> 
>> [...]
>> 
>> ---> so ./configure "NCURSESW_LIBS=-l$HOME/mylibs/myncursesw" should
>> work (in conjuction with [1])?
>
> Yes, that would work (i.e., it is still *possible* to use your own
> ncurses library during the build).  But it's not a very satisfactory
> solution, IMO.  The user *should* be able to set their own library path
> with LDFLAGS.

Ok, it's a pity ;-)

>> >> 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 why not use AC_SEARCH_LIBS to find the library that the "cbreak"
> function is in?  For example (untested):
>
>       AC_CHECK_HEADER(ncursesw/ncurses.h, HAVE_NCURSESW_H=1)
>       AC_SEARCH_LIBS(ncursesw, add_wch, HAVE_LIBNCURSESW=1)
>       AC_SEARCH_LIBS([ncursesw tinfo], cbreak, HAVE_LIBTINFO_H=1, [
>               AC_MSG_ERROR([can't find cbreak() anywhere!])
>       ])
>
>
> Surely that will include libtinfo only as needed (e.g., on gentoo, but
> not on distributions that include cbreak in libncursesw, like debian).

Yes, that is a very good solution!

> To be honest, I don't understand why you want to run pkgconfig at all!
> I realise that Gentoo have suggested it as a solution, but I don't see
> the advantage in using it over checking for cbreak in libtinfo
> ourselves.  Can you explain what advantage using pkgconfig actually
> gives us?  (I'm not an autotools expert, so I also might be missing
> something!  :o)

Pkg-config encapulates the needed libraries for ncursesw, so by using
it, we get any updates of ncursesw libs for free (like putting another
function in an external lib or using a new lib).
But I don't care, the above solution is fine for me!

Shall I test+push it tomorrow or do you want to do it?

Thanks and Best Regards,
-- 
Felix Natter



reply via email to

[Prev in Thread] Current Thread [Next in Thread]