On Tue, May 22, 2012 at 01:29:25PM +0200, Nikola Pajkovsky wrote:
Vitezslav Samel <vitezslav(a)samel.cz> writes:
> On Tue, May 22, 2012 at 12:20:34PM +0200, Nikola Pajkovsky wrote:
>> Vitezslav Samel <vitezslav(a)samel.cz> writes:
>>
>> > On Mon, May 21, 2012 at 04:38:24PM +0200, Nikola Pajkovsky wrote:
>> >> now iptraf-ng is able to build against any ncurses library.
>> >> By default, iptraf-ng is built with ncurses5 lib. If you want to
override
>> >> it, use of the commands:
>> >>
>> >> $ make NEEDS_NCURSESW5=YesPlease
>> >> $ make NEEDS_NCURSES6=YesPlease
>> >> $ make NEEDS_NCURSESW6=YesPlease
>> >
>> >
>> > With this you loose automatic detection of available ncurses lib.
>> > If you have only ncurses6, you need to edit Makefile or pass some
>> > variable to make. I don't like this.
>>
>> I don't see any better solution.
>
> written in abstract language (you need to rework it to make language):
>
> #if (!defined(NEEDS_NCURSES5)
> && !defined(NEEDS_NCURSESW5)
> && !defined(NEEDS_NCURSES6)
> && !defined(NEEDS_NCURSESW6))
>
> check_for_any_version
>
> #else if defined(NEEDS_NCURSES5)
>
> check_for_ncurses5
>
> #else if defined(NEEDS_NCURSESW5)
>
> check_for_ncursesw5
>
> #else if defined(NEEDS_NCURSES6)
>
> check_for_ncurses6
>
> #else if defined(NEEDS_NCURSESW6)
>
> check_for_ncursesw6
> #fi
That would be nice to have, but it's not that easy. Make only understand
if (statement) else ... endif and even worse, 'statement' can't contain
&& or || operators.
But exists $(if ...), $(or ...) and $(and ...).
I had one version of autodetection which works like:
NCURSES_LDFAGS are always set if ncurese[w][5,6]-config exist.
ifndef NCURSES_LDFAGS
ifdef NEEDS_NCURSES5
...
endif
endif
ifndef NCURSES_LDFAGS
ifdef NEEDS_NCURSESW5
...
endif
endif
ifndef NCURSES_LDFAGS
ifdef NEEDS_NCURSES6
...
endif
endif
ifndef NCURSES_LDFAGS
ifdef NEEDS_NCURSESW6
...
endif
endif
ifndef NCURSES_LDFAGS
try ncurses5-config as default
try ncursesw5-config if the above failed
try ncurses6-config if all the above failed
try ncursesw6-config if all the above failed
endif
^^^^ This is the way IMHO.
You have quite a lot of options here. You can create file
'config.mak' with your prefered ncuses, or put it on cmd line with make,
and the worst one, edit Makefile.
I think, it's pretty flexible.
--
Nikola