Fix and enable the autoconf test to allow the faster version of NS_LITERAL_STRING on compilers where sizeof(wchar_t) == 2 or compilers (such as gcc 2.96+) that accept -fshort-wchar to force this. r=waterson@netscape.com sr=cls@seawood.org b=54564

This commit is contained in:
dbaron%fas.harvard.edu 2000-12-23 16:34:49 +00:00
Родитель 6af210070c
Коммит 2ff6dea99f
1 изменённых файлов: 19 добавлений и 20 удалений

Просмотреть файл

@ -1889,40 +1889,39 @@ fi
dnl Check for short-wchar dnl Check for short-wchar
dnl ======================================================== dnl ========================================================
if test "$MOZ_ENABLE_SHORTWCHAR" AC_CACHE_CHECK(for size of wchar_t == 2,
then ac_cv_have_short_wchar_t,
[AC_TRY_RUN([#include <wchar.h>
AC_MSG_CHECKING(for size of wchar_t == 2) int main () { return (sizeof(wchar_t) != 2); } ],
AC_TRY_RUN([ int main () { ac_cv_have_short_wchar_t="yes",
if (sizeof(wchar_t) == 2) { return 0; } return 1; } ], ac_cv_have_short_wchar_t="no",
result="yes", result="no", result="maybe" ) ac_cv_have_short_wchar_t="maybe")])
AC_MSG_RESULT("$result") if test "$ac_cv_have_short_wchar_t" = "yes"; then
if test "$result" = "yes"; then
AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T) AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
HAVE_CPP_2BYTE_WCHAR_T=1 HAVE_CPP_2BYTE_WCHAR_T=1
fi else
dnl This is really gcc-only
if test ! "$HAVE_CPP_2BYTE_WCHAR_T"
then
_SAVE_CFLAGS=$CFLAGS _SAVE_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS -fshort-wchar" CFLAGS="$CFLAGS -fshort-wchar"
AC_CACHE_CHECK(for compiler short-wchar option, AC_CACHE_CHECK(for compiler short-wchar option,
ac_cv_have_short_wchar, ac_cv_have_short_wchar_t_option,
[AC_TRY_COMPILE(char *x;, [AC_TRY_RUN([#include <wchar.h>
char y, int main () { return (sizeof(wchar_t) != 2); } ],
ac_cv_have_short_wchar=yes, ac_cv_have_short_wchar_t_option="yes",
ac_cv_have_short_wchar=no)]) ac_cv_have_short_wchar_t_option="no",
ac_cv_have_short_wchar_t_option="maybe")])
if test "$ac_cv_have_short_wchar" = "yes"; then if test "$ac_cv_have_short_wchar_t_option" = "yes"; then
AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T) AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
HAVE_CPP_2BYTE_WCHAR_T=1 HAVE_CPP_2BYTE_WCHAR_T=1
dnl Is it OK to assume CXX and CC take the same arguments?
CXXFLAGS="$CXXFLAGS -fshort-wchar"
else else
CFLAGS=$_SAVE_CFLAGS CFLAGS=$_SAVE_CFLAGS
fi fi
fi fi
fi
dnl Checks for header files. dnl Checks for header files.
dnl ======================================================== dnl ========================================================
AC_HEADER_DIRENT AC_HEADER_DIRENT