[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 3 of 4 v2] build: detect is libiconv is present



On 21 December 2011 12:00, William Pitcock <nenolod@xxxxxxxxxxxxxxxx> wrote:
> Hi,
>
> On Mon, Dec 19, 2011 at 8:19 PM, Roger Pau Monne
> <roger.pau@xxxxxxxxxxxxx> wrote:
>> # HG changeset patch
>> # User Roger Pau Monne <roger.pau@xxxxxxxxxxxxx>
>> # Date 1324344612 -3600
>> # Node ID 14e911353a91702b439bc06e2a77d67e8bd5f661
>> # Parent  23e1abbd203ca2619103f3e95c6b1ff36be60e38
>> build: detect is libiconv is present
>>
>> Detect if libiconv is present in the system, since we will have to
>> link against it when using iconv.
>>
>> Signed-off-by: Roger Pau Monne <roger.pau@xxxxxxxxxxxxx>
>>
>> diff -r 23e1abbd203c -r 14e911353a91 Config.mk
>> --- a/Config.mk Tue Dec 20 02:28:34 2011 +0100
>> +++ b/Config.mk Tue Dec 20 02:30:12 2011 +0100
>> @@ -18,6 +18,8 @@ XEN_TARGET_ARCH     ?= $(XEN_COMPILE_ARC
>>  XEN_OS              ?= $(shell uname -s)
>>
>>  CONFIG_$(XEN_OS) := y
>> +CONFIG_LIBICONV  := $(shell grep -q LIBICONV_PLUG /usr/include/iconv.h \
>> +                      && echo 'y' || echo 'n')
>>
>
> Please don't check this way, it is not guaranteed to work.  Check
> instead for presence of libiconv.so somehow, perhaps using a dummy
> program with -liconv or something, or using a construct like:
>
>  test -f /usr/lib/libiconv.so -o -f /lib/libiconv.so -o -f
> /usr/local/lib/libiconv.so && echo 'y' || echo 'n'
>
> If upstream removes LIBICONV_PLUG, this check will break.
>
> Otherwise, everything else looks OK to me.
>

That doesn't work if you do cross compilation, your libraries could
located in a completely different path.

The best way to check for the presence of a library (and this is how
the autotools do it) is to generate a very simple C program that uses
some iconv functions and try to compile it with the currently
configured compiler. If the compilation succeeded that means the
library is present.

Jean

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.