ICU-8554 Don't use visibility attribute on Cygwin GCC and fix Cygwin tzset error.

X-SVN-Rev: 30200
This commit is contained in:
Michael Ow 2011-06-09 21:32:19 +00:00
parent 233f71bedf
commit 8d587bf3bb
3 changed files with 40 additions and 25 deletions

View File

@ -75,7 +75,6 @@ Cleanly installed Solaris can use this #define.
#include <math.h> #include <math.h>
#include <locale.h> #include <locale.h>
#include <float.h> #include <float.h>
#include <time.h>
/* include system headers */ /* include system headers */
#ifdef U_WINDOWS #ifdef U_WINDOWS
@ -117,6 +116,10 @@ Cleanly installed Solaris can use this #define.
# endif # endif
#endif #endif
/*
* Cygwin with GCC requires inclusion of time.h after the above disabling strict asci mode statement.
*/
#include <time.h>
#if defined(U_DARWIN) #if defined(U_DARWIN)
#include <TargetConditionals.h> #include <TargetConditionals.h>

View File

@ -5375,14 +5375,19 @@ U_USE_GCC_VISIBILITY_ATTRIBUTE=0
OLD_CFLAGS="${CFLAGS}" OLD_CFLAGS="${CFLAGS}"
OLD_CXXFLAGS="${CXXFLAGS}" OLD_CXXFLAGS="${CXXFLAGS}"
if test "$ac_cv_c_compiler_gnu" = yes; then if test "$ac_cv_c_compiler_gnu" = yes; then
LIBCFLAGS="-fvisibility=hidden" case "${host}" in
LIBCXXFLAGS="-fvisibility=hidden" *-pc-cygwin*|*-pc-mingw*)
CFLAGS="${CFLAGS} ${LIBCFLAGS}" # Cygwin GCC does not have the visibility attribute
CXXFLAGS="${CXXFLAGS} ${LIBCXXFLAGS}" ;;
cat confdefs.h - <<_ACEOF >conftest.$ac_ext *)
LIBCFLAGS="-fvisibility=hidden"
LIBCXXFLAGS="-fvisibility=hidden"
CFLAGS="${CFLAGS} ${LIBCFLAGS}"
CXXFLAGS="${CXXFLAGS} ${LIBCXXFLAGS}"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */ /* end confdefs.h. */
__attribute__ ((visibility ("default"))) void f(void); __attribute__ ((visibility ("default"))) void f(void);
#include <stdlib.h> #include <stdlib.h>
int int
main () main ()
{ {
@ -5398,12 +5403,13 @@ else
fi fi
rm -f core conftest.err conftest.$ac_objext \ rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext conftest$ac_exeext conftest.$ac_ext
if test "$SHAREDLIBEXPORT" = no; then if test "$SHAREDLIBEXPORT" = no; then
LIBCFLAGS= LIBCFLAGS=
LIBCXXFLAGS= LIBCXXFLAGS=
else else
U_USE_GCC_VISIBILITY_ATTRIBUTE=1 U_USE_GCC_VISIBILITY_ATTRIBUTE=1
fi fi
esac
else else
case "${host}" in case "${host}" in
*-*-solaris*) *-*-solaris*)

View File

@ -317,18 +317,24 @@ U_USE_GCC_VISIBILITY_ATTRIBUTE=0
OLD_CFLAGS="${CFLAGS}" OLD_CFLAGS="${CFLAGS}"
OLD_CXXFLAGS="${CXXFLAGS}" OLD_CXXFLAGS="${CXXFLAGS}"
if test "$ac_cv_c_compiler_gnu" = yes; then if test "$ac_cv_c_compiler_gnu" = yes; then
LIBCFLAGS="-fvisibility=hidden" case "${host}" in
LIBCXXFLAGS="-fvisibility=hidden" *-pc-cygwin*|*-pc-mingw*)
CFLAGS="${CFLAGS} ${LIBCFLAGS}" # Cygwin GCC does not have the visibility attribute
CXXFLAGS="${CXXFLAGS} ${LIBCXXFLAGS}" ;;
AC_LINK_IFELSE([AC_LANG_PROGRAM([[__attribute__ ((visibility ("default"))) void f(void); *)
#include <stdlib.h>]], [[exit(0);]])],[SHAREDLIBEXPORT=yes],[SHAREDLIBEXPORT=no]) LIBCFLAGS="-fvisibility=hidden"
if test "$SHAREDLIBEXPORT" = no; then LIBCXXFLAGS="-fvisibility=hidden"
LIBCFLAGS= CFLAGS="${CFLAGS} ${LIBCFLAGS}"
LIBCXXFLAGS= CXXFLAGS="${CXXFLAGS} ${LIBCXXFLAGS}"
else AC_LINK_IFELSE([AC_LANG_PROGRAM([[__attribute__ ((visibility ("default"))) void f(void);
U_USE_GCC_VISIBILITY_ATTRIBUTE=1 #include <stdlib.h>]], [[exit(0);]])],[SHAREDLIBEXPORT=yes],[SHAREDLIBEXPORT=no])
fi if test "$SHAREDLIBEXPORT" = no; then
LIBCFLAGS=
LIBCXXFLAGS=
else
U_USE_GCC_VISIBILITY_ATTRIBUTE=1
fi
esac
else else
case "${host}" in case "${host}" in
*-*-solaris*) *-*-solaris*)