|
From: Yves A. <yv...@re...> - 2001-09-19 00:07:30
|
> What we decided to do is to allow for using different
> versions of ICU on compilation module basis. A generated
> renaming header file was introduced
> (common/unicode/urename.h), which ensures that different
> versions of ICU have different entry names.
Another disadvantage of urename.h is that it makes it much harder to
autodetect ICU. For instance, one cannot use things like
AC_SEARCH_LIBS(ucnv_open, icuuc
icu-uc,[LIB_ICUUC="$ac_cv_search_ucnv_open"])
since that will fail (because no ICU header is included, and thus ucnv_open
isn't renamed ucnv_open_1_9 which is what's in the lib).
That's a bummer. It is something that can be worked around, and it was
painful... For the record here is a workaround (my check for icu-uc may be
incorrect, but I think the headers didn't move to <unicode/hhhh.h> before
the lib moved to icuuc; if not, please tell me, and note that it just makes
the workaround more complex).
AC_CACHE_CHECK([for library containing ucnv_open], [ac_cv_search_ucnv_open],
[
ac_cv_search_ucnv_open=no
AC_LANG_SAVE
AC_LANG_C
save_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$CPPFLAGS -I$prefix/include"
ac_func_search_save_libs="$LIBS"
LIBS="-licuuc $LIBS"
AC_TRY_COMPILE([#include <unicode/ucnv.h>],
[UErrorCode err = U_ZERO_ERROR; ucnv_open("utf-8",
&err);],[ac_cv_search_ucnv_open=-licuuc])
LIBS="$ac_func_search_save_LIBS"
if test "$ac_cv_search_ucnv_open" = no; then
ac_func_search_save_libs="$LIBS"
LIBS="-licu-uc $LIBS"
AC_TRY_COMPILE([#include <ucnv.h>],
[UErrorCode err = U_ZERO_ERROR; ucnv_open("utf-8",
&err);],[ac_cv_search_ucnv_open=-licu-uc])
LIBS="$ac_func_search_save_LIBS"
fi
if test "$ac_cv_search_ucnv_open" != no; then
LIBS="$ac_cv_search_ucnv_open $LIBS"
LIB_ICUUC="$ac_cv_search_ucnv_open"
fi
CPPFLAGS="$save_CPPFLAGS"
AC_LANG_RESTORE
AC_SUBST(LIB_ICUUC)
])
icu_libraries="$LIB_ICUUC"
AC_SUBST(icu_libraries)
You have to admit the one-liner looked better :-) (And please feel free to
critic my Autoconf writing, it is not my forte.)
I understand why urename.h is here but could it be only be used only by
people who want to tie themselves explicitely to a given version of ICU?
Also, does anybody know if one can load two libraries with the same symbols
but different sonames in the same process (I am afraid not, unfortunately;
right?).
YA
|