Check that std::basic_string<wchar_t> actually works before

trying to use it.
  Fail at configure time when trying to compile wxMotif with Unicode.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33472 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Mattia Barbon 2005-04-10 14:54:34 +00:00
parent fa6416df7f
commit 0a08f02aef
2 changed files with 188 additions and 67 deletions

207
configure vendored
View File

@ -11295,7 +11295,7 @@ echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
GCC=`test $ac_compiler_gnu = yes && echo yes`
ac_test_CFLAGS=${CFLAGS+set}
ac_save_CFLAGS=$CFLAGS
CFLAGS="-g"
CFLAGS="$CFLAGS -g"
echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
if test "${ac_cv_prog_cc_g+set}" = set; then
@ -11685,7 +11685,7 @@ fi
unset ac_cv_prog_cc_g
ac_test_CFLAGS=${CFLAGS+set}
ac_save_CFLAGS=$CFLAGS
CFLAGS="-g"
CFLAGS="$CFLAGS -g"
echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
if test "${ac_cv_prog_cc_g+set}" = set; then
@ -12443,9 +12443,9 @@ if test "$ac_test_CXXFLAGS" = set; then
CXXFLAGS=$ac_save_CXXFLAGS
elif test $ac_cv_prog_cxx_g = yes; then
if test "$GXX" = yes; then
CXXFLAGS="-g -O2"
CXXFLAGS="$CXXFLAGS -g -O2"
else
CXXFLAGS="-g"
CXXFLAGS="$CXXFLAGS -g"
fi
else
if test "$GXX" = yes; then
@ -12683,9 +12683,9 @@ if test "$ac_test_CXXFLAGS" = set; then
CXXFLAGS=$ac_save_CXXFLAGS
elif test $ac_cv_prog_cxx_g = yes; then
if test "$GXX" = yes; then
CXXFLAGS="-g -O2"
CXXFLAGS="$CXXFLAGS -g -O2"
else
CXXFLAGS="-g"
CXXFLAGS="$CXXFLAGS -g"
fi
else
if test "$GXX" = yes; then
@ -21184,6 +21184,142 @@ _ACEOF
fi
if test "$wxUSE_UNICODE" = "yes" -a \
\( "$wxUSE_STD_STRING" = "yes" -o "$wxUSE_STL" = "yes" \); then
ac_ext=cc
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
echo "$as_me:$LINENO: checking for std::wstring in <string>" >&5
echo $ECHO_N "checking for std::wstring in <string>... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <string>
int
main ()
{
std::wstring foo;
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
cat >>confdefs.h <<\_ACEOF
#define HAVE_STD_WSTRING 1
_ACEOF
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
echo "$as_me:$LINENO: checking if std::basic_string<wchar_t> works" >&5
echo $ECHO_N "checking if std::basic_string<wchar_t> works... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#ifdef HAVE_WCHAR_H
# ifdef __CYGWIN__
# include <stddef.h>
# endif
# include <wchar.h>
#endif
#ifdef HAVE_STDLIB_H
# include <stdlib.h>
#endif
#include <stdio.h>
#include <string>
int
main ()
{
std::basic_string<wchar_t> foo;
const wchar_t* dummy = foo.c_str();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
{ { echo "$as_me:$LINENO: error: Can't compile without unicode string class" >&5
echo "$as_me: error: Can't compile without unicode string class" >&2;}
{ (exit 1); exit 1; }; }
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
fi
if test "$wxUSE_STL" = "yes"; then
ac_ext=cc
ac_cpp='$CXXCPP $CPPFLAGS'
@ -21250,59 +21386,6 @@ echo "${ECHO_T}no" >&6
echo "$as_me: error: Basic STL functionality missing" >&2;}
{ (exit 1); exit 1; }; }
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
echo "$as_me:$LINENO: checking for std::wstring in <string>" >&5
echo $ECHO_N "checking for std::wstring in <string>... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <string>
int
main ()
{
std::wstring foo;
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
cat >>confdefs.h <<\_ACEOF
#define HAVE_STD_WSTRING 1
_ACEOF
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
echo "$as_me:$LINENO: checking for compliant std::string::compare" >&5
@ -27541,6 +27624,12 @@ done
fi
if test "$wxUSE_MOTIF" = 1; then
if test "$wxUSE_UNICODE" = "yes"; then
{ { echo "$as_me:$LINENO: error: Unicode configuration not supported with Motif" >&5
echo "$as_me: error: Unicode configuration not supported with Motif" >&2;}
{ (exit 1); exit 1; }; }
fi
echo "$as_me:$LINENO: checking for Motif/Lesstif headers" >&5
echo $ECHO_N "checking for Motif/Lesstif headers... $ECHO_C" >&6

View File

@ -1882,6 +1882,42 @@ dnl we don't use HAVE_DYNAMIC_CAST anywhere right now...
dnl AC_CXX_DYNAMIC_CAST
dnl check various STL features
if test "$wxUSE_UNICODE" = "yes" -a \
\( "$wxUSE_STD_STRING" = "yes" -o "$wxUSE_STL" = "yes" \); then
AC_LANG_PUSH(C++)
dnl check if <string> declares std::wstring
AC_MSG_CHECKING([for std::wstring in <string>])
AC_TRY_COMPILE([#include <string>],
[std::wstring foo;],
[AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_STD_WSTRING)],
[AC_MSG_RESULT(no)
AC_MSG_CHECKING([if std::basic_string<wchar_t> works])
AC_TRY_COMPILE([
#ifdef HAVE_WCHAR_H
# ifdef __CYGWIN__
# include <stddef.h>
# endif
# include <wchar.h>
#endif
#ifdef HAVE_STDLIB_H
# include <stdlib.h>
#endif
#include <stdio.h>
#include <string>
],
[std::basic_string<wchar_t> foo;
const wchar_t* dummy = foo.c_str();],
[AC_MSG_RESULT(yes)],
[AC_MSG_RESULT([no])
AC_MSG_ERROR([Can't compile without unicode string class])]
)
])
AC_LANG_POP
fi
if test "$wxUSE_STL" = "yes"; then
AC_LANG_PUSH(C++)
@ -1901,14 +1937,6 @@ if test "$wxUSE_STL" = "yes"; then
[AC_MSG_RESULT([no])
AC_MSG_ERROR([Basic STL functionality missing])])
dnl check if <string> declares std::wstring
AC_MSG_CHECKING([for std::wstring in <string>])
AC_TRY_COMPILE([#include <string>],
[std::wstring foo;],
[AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_STD_WSTRING)],
[AC_MSG_RESULT(no)])
dnl check for compliant std::string::compare
AC_MSG_CHECKING([for compliant std::string::compare])
AC_TRY_COMPILE([#include <string>],
@ -2861,6 +2889,10 @@ equivalent variable and GTK+ is version 1.2.3 or above.
fi
if test "$wxUSE_MOTIF" = 1; then
if test "$wxUSE_UNICODE" = "yes"; then
AC_MSG_ERROR([Unicode configuration not supported with Motif])
fi
AC_MSG_CHECKING(for Motif/Lesstif headers)
WX_PATH_FIND_INCLUDES($SEARCH_INCLUDE, Xm/Xm.h)
if test "$ac_find_includes" != "" ; then