diff --git a/configure.in b/configure.in index a23c52d46c1..6045ee26aaa 100644 --- a/configure.in +++ b/configure.in @@ -1519,13 +1519,15 @@ if test "$ac_cv_have_usable_wchar" = "yes"; then HAVE_CPP_2BYTE_WCHAR_T=1 else dnl This is really gcc-only -dnl Do this test using CXX instead of CC since some versions of gcc -dnl 2.96-2.97 have a signed wchar_t in c++ only. +dnl Do this test using CXX only since some versions of gcc +dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions +dnl only have short-wchar support for c++. +dnl Note that we assume that mac & win32 have short wchar (see nscore.h) - _SAVE_CFLAGS=$CFLAGS - _SAVE_CC=$CC - CC=$CXX - CFLAGS="$CFLAGS -fshort-wchar" + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + _SAVE_CXXFLAGS=$CXXFLAGS + CXXFLAGS="$CXXFLAGS -fshort-wchar" AC_CACHE_CHECK(for compiler -fshort-wchar option, ac_cv_have_usable_wchar_option, @@ -1540,12 +1542,10 @@ dnl 2.96-2.97 have a signed wchar_t in c++ only. if test "$ac_cv_have_usable_wchar_option" = "yes"; then AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T) HAVE_CPP_2BYTE_WCHAR_T=1 -dnl Since this is gcc-only, CC and CXX should take the same arguments. - CXXFLAGS="$CXXFLAGS -fshort-wchar" else - CFLAGS=$_SAVE_CFLAGS + CXXFLAGS=$_SAVE_CXXFLAGS fi - CC=$_SAVE_CC + AC_LANG_RESTORE fi dnl Checks for header files.