use AC_CACHE_CHECK instead of AC_MSG_CHECKING + check to avoid unnecessary checking for cached tests
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43252 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
203
configure.in
203
configure.in
@@ -2131,41 +2131,59 @@ if test "$wxUSE_STD_STRING" = "yes" -o "$wxUSE_STL" = "yes"; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
dnl check if <string> declares std::[w]string
|
dnl check if <string> declares std::[w]string
|
||||||
AC_MSG_CHECKING([for $std_string in <string>])
|
AC_CACHE_CHECK([for $std_string in <string>],
|
||||||
AC_TRY_COMPILE([#include <string>],
|
wx_cv_class_stdstring,
|
||||||
[$std_string foo;],
|
[
|
||||||
[AC_MSG_RESULT(yes)
|
AC_TRY_COMPILE([#include <string>],
|
||||||
AC_DEFINE(HAVE_STD_WSTRING)],
|
[$std_string foo;],
|
||||||
[AC_MSG_RESULT(no)
|
wx_cv_class_stdstring=yes,
|
||||||
AC_MSG_CHECKING([if std::basic_string<$char_type> works])
|
wx_cv_class_stdstring=no
|
||||||
AC_TRY_COMPILE([
|
)
|
||||||
#ifdef HAVE_WCHAR_H
|
]
|
||||||
# ifdef __CYGWIN__
|
)
|
||||||
# include <stddef.h>
|
|
||||||
# endif
|
if test "$wx_cv_class_stdstring" = yes; then
|
||||||
# include <wchar.h>
|
if test "$wxUSE_UNICODE" = "yes"; then
|
||||||
#endif
|
AC_DEFINE(HAVE_STD_WSTRING)
|
||||||
#ifdef HAVE_STDLIB_H
|
fi
|
||||||
# include <stdlib.h>
|
dnl we don't need HAVE_STD_STRING, we just suppose it's available if
|
||||||
#endif
|
dnl wxUSE_STD_STRING==yes
|
||||||
#include <stdio.h>
|
else
|
||||||
#include <string>
|
AC_CACHE_CHECK([if std::basic_string<$char_type> works],
|
||||||
],
|
wx_cv_class_stdbasicstring,
|
||||||
[std::basic_string<$char_type> foo;
|
[
|
||||||
const $char_type* dummy = foo.c_str();],
|
AC_TRY_COMPILE([
|
||||||
[AC_MSG_RESULT(yes)],
|
#ifdef HAVE_WCHAR_H
|
||||||
[AC_MSG_RESULT([no])
|
# ifdef __CYGWIN__
|
||||||
if test "$wxUSE_STL" = "yes"; then
|
# include <stddef.h>
|
||||||
AC_MSG_ERROR([Can't use --enable-stl without $std_string or std::basic_string<$char_type>])
|
# endif
|
||||||
elif grep wxUSE_STD_STRING $wx_arg_cache_file >/dev/null; then
|
# include <wchar.h>
|
||||||
AC_MSG_ERROR([Can't use --enable-std_string without $std_string or std::basic_string<$char_type>])
|
#endif
|
||||||
else
|
#ifdef HAVE_STDLIB_H
|
||||||
AC_MSG_WARN([No $std_string or std::basic_string<$char_type>, switching to --disable-std_string])
|
# include <stdlib.h>
|
||||||
wxUSE_STD_STRING=no
|
#endif
|
||||||
fi
|
#include <stdio.h>
|
||||||
]
|
#include <string>
|
||||||
)
|
],
|
||||||
])
|
[std::basic_string<$char_type> foo;
|
||||||
|
const $char_type* dummy = foo.c_str();],
|
||||||
|
wx_cv_class_stdbasicstring=yes,
|
||||||
|
wx_cv_class_stdbasicstring=no
|
||||||
|
)
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
if test "$wx_cv_class_stdbasicstring" != yes; then
|
||||||
|
if test "$wxUSE_STL" = "yes"; then
|
||||||
|
AC_MSG_ERROR([Can't use --enable-stl without $std_string or std::basic_string<$char_type>])
|
||||||
|
elif grep wxUSE_STD_STRING $wx_arg_cache_file >/dev/null; then
|
||||||
|
AC_MSG_ERROR([Can't use --enable-std_string without $std_string or std::basic_string<$char_type>])
|
||||||
|
else
|
||||||
|
AC_MSG_WARN([No $std_string or std::basic_string<$char_type>, switching to --disable-std_string])
|
||||||
|
wxUSE_STD_STRING=no
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "$wxUSE_STD_IOSTREAM" = "yes"; then
|
if test "$wxUSE_STD_IOSTREAM" = "yes"; then
|
||||||
@@ -2184,59 +2202,82 @@ fi
|
|||||||
|
|
||||||
if test "$wxUSE_STL" = "yes"; then
|
if test "$wxUSE_STL" = "yes"; then
|
||||||
dnl check for basic STL functionality
|
dnl check for basic STL functionality
|
||||||
AC_MSG_CHECKING([for basic STL functionality])
|
AC_CACHE_CHECK([for basic STL functionality],
|
||||||
AC_TRY_COMPILE([#include <string>
|
wx_cv_lib_stl,
|
||||||
#include <functional>
|
[AC_TRY_COMPILE([#include <string>
|
||||||
#include <algorithm>
|
#include <functional>
|
||||||
#include <vector>
|
#include <algorithm>
|
||||||
#include <list>],
|
#include <vector>
|
||||||
[std::vector<int> moo;
|
#include <list>],
|
||||||
std::list<int> foo;
|
[std::vector<int> moo;
|
||||||
std::vector<int>::iterator it =
|
std::list<int> foo;
|
||||||
std::find_if(moo.begin(), moo.end(),
|
std::vector<int>::iterator it =
|
||||||
std::bind2nd(std::less<int>(), 3));],
|
std::find_if(moo.begin(), moo.end(),
|
||||||
[AC_MSG_RESULT([yes])],
|
std::bind2nd(std::less<int>(), 3));],
|
||||||
[AC_MSG_RESULT([no])
|
wx_cv_lib_stl=yes,
|
||||||
AC_MSG_ERROR([Basic STL functionality missing])])
|
wx_cv_lib_stl=no,
|
||||||
|
)
|
||||||
|
|
||||||
|
if test "$wx_cv_lib_stl" != yes; then
|
||||||
|
AC_MSG_ERROR([Can't use --enable-stl as basic STL functionality is missing])
|
||||||
|
fi
|
||||||
|
|
||||||
dnl check for compliant std::string::compare
|
dnl check for compliant std::string::compare
|
||||||
AC_MSG_CHECKING([for compliant std::string::compare])
|
AC_CACHE_CHECK([for compliant std::string::compare],
|
||||||
AC_TRY_COMPILE([#include <string>],
|
wx_cv_func_stdstring_compare,
|
||||||
[std::string foo, bar;
|
[AC_TRY_COMPILE([#include <string>],
|
||||||
foo.compare(bar);
|
[std::string foo, bar;
|
||||||
foo.compare(1, 1, bar);
|
foo.compare(bar);
|
||||||
foo.compare(1, 1, bar, 1, 1);
|
foo.compare(1, 1, bar);
|
||||||
foo.compare("");
|
foo.compare(1, 1, bar, 1, 1);
|
||||||
foo.compare(1, 1, "");
|
foo.compare("");
|
||||||
foo.compare(1, 1, "", 2);],
|
foo.compare(1, 1, "");
|
||||||
[AC_MSG_RESULT(yes)
|
foo.compare(1, 1, "", 2);],
|
||||||
AC_DEFINE(HAVE_STD_STRING_COMPARE)],
|
wx_cv_func_stdstring_compare=yes,
|
||||||
[AC_MSG_RESULT(no)])
|
wx_cv_func_stdstring_compare=no
|
||||||
|
)]
|
||||||
|
)
|
||||||
|
|
||||||
|
if test "$wx_cv_func_stdstring_compare" = yes; then
|
||||||
|
AC_DEFINE(HAVE_STD_STRING_COMPARE)
|
||||||
|
fi
|
||||||
|
|
||||||
dnl check for hash_map and hash_set headers
|
dnl check for hash_map and hash_set headers
|
||||||
AC_CHECK_HEADER([hash_map],
|
AC_CHECK_HEADER([hash_map],
|
||||||
[AC_MSG_CHECKING([for hash_map and hash_set])
|
[AC_CACHE_CHECK([for standard hash_map and hash_set],
|
||||||
AC_TRY_COMPILE([#include <hash_map>
|
wx_cv_class_stdhashmapset,
|
||||||
#include <hash_set>],
|
[AC_TRY_COMPILE([#include <hash_map>
|
||||||
[std::hash_map<double*, char*, std::hash<double*>, std::equal_to<double*> > test1;
|
#include <hash_set>],
|
||||||
std::hash_set<char*, std::hash<char*>, std::equal_to<char*> > test2;],
|
[std::hash_map<double*, char*, std::hash<double*>, std::equal_to<double*> > test1;
|
||||||
[AC_MSG_RESULT(yes)
|
std::hash_set<char*, std::hash<char*>, std::equal_to<char*> > test2;],
|
||||||
AC_DEFINE(HAVE_HASH_MAP)
|
wx_cv_class_stdhashmapset=yes,
|
||||||
AC_DEFINE(HAVE_STD_HASH_MAP)],
|
wx_cv_class_stdhashmapset=no)
|
||||||
[AC_MSG_RESULT(no)])
|
]
|
||||||
])
|
)]
|
||||||
|
)
|
||||||
|
|
||||||
|
if test "$wx_cv_class_stdhashmapset" = yes; then
|
||||||
|
AC_DEFINE(HAVE_HASH_MAP)
|
||||||
|
AC_DEFINE(HAVE_STD_HASH_MAP)
|
||||||
|
fi
|
||||||
|
|
||||||
AC_CHECK_HEADER([ext/hash_map],
|
AC_CHECK_HEADER([ext/hash_map],
|
||||||
[AC_MSG_CHECKING([for hash_map and hash_set])
|
[AC_CACHE_CHECK([for GNU hash_map and hash_set],
|
||||||
AC_TRY_COMPILE([#include <ext/hash_map>
|
wx_cv_class_gnuhashmapset,
|
||||||
#include <ext/hash_set>],
|
[AC_TRY_COMPILE([#include <ext/hash_map>
|
||||||
[__gnu_cxx::hash_map<double*, char*, __gnu_cxx::hash<double*>, std::equal_to<double*> > test1;
|
#include <ext/hash_set>],
|
||||||
__gnu_cxx::hash_set<char*, __gnu_cxx::hash<char*>, std::equal_to<char*> > test2;],
|
[__gnu_cxx::hash_map<double*, char*, __gnu_cxx::hash<double*>, std::equal_to<double*> > test1;
|
||||||
[AC_MSG_RESULT(yes)
|
__gnu_cxx::hash_set<char*, __gnu_cxx::hash<char*>, std::equal_to<char*> > test2;],
|
||||||
AC_DEFINE(HAVE_EXT_HASH_MAP)
|
wx_cv_class_gnuhashmapset=yes,
|
||||||
AC_DEFINE(HAVE_GNU_CXX_HASH_MAP)],
|
wx_cv_class_gnuhashmapset=no)
|
||||||
[AC_MSG_RESULT(no)])
|
]
|
||||||
])
|
)]
|
||||||
|
)
|
||||||
|
|
||||||
|
if test "$wx_cv_class_gnuhashmapset" = yes; then
|
||||||
|
AC_DEFINE(HAVE_EXT_HASH_MAP)
|
||||||
|
AC_DEFINE(HAVE_GNU_CXX_HASH_MAP)
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dnl pop C++
|
dnl pop C++
|
||||||
|
Reference in New Issue
Block a user