configure: Fix test for ability to link with ICU libraries.

Scott Bambrough scottb at xandros.com
Thu Jun 15 10:46:36 CDT 2006


Alexandre Julliard wrote:
> Scott Bambrough <scottb at xandros.com> writes:
>
>   
>> Modified search for ICU libraries.  Now search user defined directory
>> (if defined in ICU_LIB_DIR),/usr/local/lib and /usr/lib (in that
>> order). Now search for:
>> 1) user defined libraries if defined in one or both of ICUUC_LIB and
>> ICUDATA_LIB
>> 2) libsicuuc.so, libsicudata.so
>> 3) libicuuc.so, libicudata.so
>>     
>
> The code is too complicated, you should be able to do that with a
> simple loop to try the various names. Also you can't use 'libdir' as a
> loop variable, that's one of the configure standard variables.
>   
I will change the name of the loop variable; not a problem.  I'm not 
sure I agree the code is too complicated.  It does the following:

1) Sets up a list of directories to search.  These will be $ICU_LIBDIR, 
/usr/local/lib, /usr/lib.  It ensures /usr/local/lib and /usr/lib do  
not appear in the list twice as this  would slow down configure.  I 
chose this order so that the user specified directory is searched first, 
then /usr/local/lib and finally /usr/lib as this seems to be the 
conventional order for searching for libraries in UNIX like systems.

2) It then enters a loop using the above directory list to handle the 
user specified names for the libraries; ICUUC_LIB and ICUDATA_LIB.   It 
is possible the user will supply none, one of or both these variables, 
and the code handles all four of these cases correctly.  The only thing 
I had to do was make a choice of how to handle the case when only one of 
ICUUC_LIB and ICUDATA_LIB is supplied.

I chose to assume the user knows best and the two libraries had been 
merged into one.  Alternatives would be to have configure stop with an 
error message, or to issue a warning, skip the test and move on to the 
next loop.

3) It then enters a simple loop over the directory list testing for the 
library pairs in each directory:
    libsicuuc.so, libsicudata.so
    libicuuc.so, libicudata.so

4) If a test was successful it sets up config.h and the ICULIBS variable.

The code also takes pains to break out of a loop if the library test is 
successful, and to not enter a loop if it is not necessary.  Hence the 
loop in 2 will not be entered if the user does not supply ICUUC_LIB and 
ICUDATA_LIB.  The loop in 3 will not be entered if a test in loop 2 was 
successful. 

In the worst case this code will run through 9 tests searching for the 
ICU library.  In the default case (no environment variables set) it will 
run through 4 tests at worst before giving up.

In your case, (assuming you have libicuuc.so and libicudata.so in 
/usr/lib) it will take two tests, as the code will test in 
/usr/local/lib first.  In the unpatched version it would have taken 1 
test.  In my case it takes 4 tests.

I tested the patch using the attached script, and it works correctly for 
me in all 10 test cases.  It preserves the existing behaviour, doesn't 
affect the speed of operation of configure too much, and will find the 
ICU libraries on a Debian system.

If you still think it is too complicated thats ok.  But could you let me 
know what you feel would be acceptable so we don't bounce back and forth 
with patches.  Then I'd be quite happy to make the changes you request.

Thanks,

Scott



-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_configure.sh
Type: application/x-shellscript
Size: 1447 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-patches/attachments/20060615/4b86ce98/test_configure-0001.bin


More information about the wine-patches mailing list