📄 configure.in
字号:
dnl Disable any caching here define([AC_CACHE_LOAD], )dnldefine([AC_CACHE_SAVE], )dnldnl Process this file with autoconf to produce a configure script.AC_INIT(stlconf.h.in)AC_CONFIG_HEADER(stlconf.h)AC_MSG_RESULT(*** $0: STLport configuration utility ***)if test "${CXXFLAGS}" = ""; then AC_MSG_RESULT(* Note: for best reliability - try \"CXXFLAGS=-treat_warnings_as_errors\" $0 )AC_MSG_RESULT(* Please don't forget specifying typical CXXFLAGS you'll be using - ) AC_MSG_RESULT(* such as that enabling exceptions handling, etc. )dnl AC_MSG_RESULT(* Add option forcing instantiation of all templates to CXXFLAGS if possible. )fiAC_MSG_RESULT(Please stand by while exploring compiler capabilities...)AC_MSG_RESULT(Be patient - that may take a while...)AC_MSG_RESULT(***)# utility functioncheck_warning () { warn_str=`tail -1 config.log | egrep -i "arning|\(W\)"` if test "$warn_str" = ""; then return 0 else return 1 fi}dnl Checks for systemsdnl AC_AIXdnl Checks for programs.dnl sets CXXAC_ARG_ENABLE(extension,[--enable-extension=<ext>],[case "$enableval" in no) AC_MSG_RESULT(Info :.cpp used as extension for tests) ac_ext=cpp ;; *) AC_MSG_RESULT(Argument : .$enableval used as extension) ac_ext=$enablevalesac],[AC_MSG_RESULT(Info : .cpp used as extension for tests) ac_ext=cpp])# Save that, as it is being redefined several times use_ac_ext=$ac_extAC_PROG_CXXac_ext=$use_ac_extAC_LANG_CPLUSPLUSac_ext=$use_ac_extAC_CHECK_SIZEOF(int,4)ac_ext=$use_ac_extif test "$ac_cv_sizeof_int" = "4"; then AC_DEFINE_UNQUOTED(_STLP_UINT32_T,unsigned int)else AC_CHECK_SIZEOF(long,4) ac_ext=$use_ac_ext if test "$ac_cv_sizeof_long" = "4"; then AC_DEFINE_UNQUOTED(_STLP_UINT32_T,unsigned long) else dnl ELBRUS ??? ;) AC_CHECK_SIZEOF(short,4) if test "$ac_cv_sizeof_short" = "4"; then AC_DEFINE_UNQUOTED(_STLP_UINT32_T,unsigned short) else AC_MSG_ERROR(Cannot find any 32-bit integer type for your compiler) fi ac_ext=$use_ac_ext fifiac_ext=$use_ac_extdnl Exclude link stage for cross-compilationif test "$ac_cv_c_cross" = "yes"; then CXXFLAGS="${CXXFLAGS} -c"fiac_ext=$use_ac_extdnl checking for compiler capabilitiesAC_MSG_CHECKING(for basic STL compatibility)AC_TRY_LINK( [template <class Arg1, class Arg2, class Result>struct binary_function { typedef Arg1 first_argument_type; typedef Arg2 second_argument_type; typedef Result result_type;}; template <class T>struct plus : public binary_function<T, T, T> { T operator()(const T& x, const T& y) const;};template <class T>T plus<T>::operator()(const T& x, const T& y) const { return x + y; }plus<int> p;],[], [ac_cv_compat="yes"],[AC_MSG_ERROR(Your compiler won't be able to compile this implementation. Sorry.) ac_cv_compat="no"])AC_MSG_RESULT($ac_cv_compat)AC_MSG_CHECKING(for partial specialization syntax)AC_TRY_LINK( [ template <class T> class fs_foo {}; template <> class fs_foo<int> {};], [ fs_foo<int> i;], [ _FULL_SPEC="template <>" ac_cv_spec_syntax="yes"], [ AC_DEFINE(_STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX) ac_cv_spec_syntax="no" _FULL_SPEC=""])AC_MSG_RESULT($ac_cv_spec_syntax)AC_MSG_CHECKING(for bool keyword)AC_TRY_COMPILE( [bool b_foo() { return true; }], [(void)b_foo();], [ac_cv_bool="yes"], [AC_DEFINE(_STLP_NO_BOOL) ac_cv_bool="no"])AC_MSG_RESULT($ac_cv_bool)if test "$ac_cv_bool" = "no"; then AC_MSG_CHECKING(for yvals.h header) AC_TRY_COMPILE([#include <yvals.h> extern bool aaa=true; ], [], [AC_DEFINE(_STLP_YVALS_H) AC_MSG_RESULT(yes) ], [ AC_MSG_RESULT(no) AC_MSG_CHECKING(whether bool is reserved word) AC_TRY_COMPILE( [typedef int bool;], [], [ac_cv_bool_reserved="no"], [AC_DEFINE(_STLP_DONT_USE_BOOL_TYPEDEF) ac_cv_bool_reserved="yes"]) AC_MSG_RESULT($ac_cv_bool_reserved) ])fiAC_MSG_CHECKING(for wchar_t type)AC_TRY_COMPILE( [ #include <wchar.h> wchar_t wc_foo() { return 'a'; }], [(void)wc_foo();], [ac_cv_wchar="yes"], [AC_DEFINE(_STLP_NO_WCHAR_T) ac_cv_wchar="no"])AC_MSG_RESULT($ac_cv_wchar)AC_MSG_CHECKING(if wchar_t is unsigned short)AC_TRY_COMPILE( [ # include <wchar.h> template <class T> struct foo {}; $_FULL_SPEC struct foo <wchar_t> {}; typedef unsigned short u__short; $_FULL_SPEC struct foo <u__short> {}; foo<wchar_t> f1; foo<u__short> f2; ], [], [ac_cv_wchar_short="no"], [AC_DEFINE(_STLP_WCHAR_T_IS_USHORT) ac_cv_wchar_short="yes"])AC_MSG_RESULT($ac_cv_wchar_short)AC_MSG_CHECKING(for long long type)AC_TRY_COMPILE( [long long ll_foo() { return 0; }], [(void)ll_foo();], [AC_DEFINE(_STLP_LONG_LONG) ac_cv_long_long="yes"], [ac_cv_long_long="no"])AC_MSG_RESULT($ac_cv_long_long)AC_MSG_CHECKING(for long double type)AC_TRY_COMPILE( [long double ld_foo() { return 0; }], [(void)ld_foo();], [ac_cv_long_double="yes"], [AC_DEFINE(_STLP_NO_LONG_DOUBLE) ac_cv_long_double="no"])AC_MSG_RESULT($ac_cv_long_double)AC_MSG_CHECKING(for typename keyword)AC_TRY_LINK( [template <class T1, class T2>struct pair { typedef T1 first_type; typedef T2 second_type;};template <class Arg, class Result>struct unary_function { typedef Arg argument_type; typedef Result result_type;};template <class Pair>struct select2nd : public unary_function<Pair, typename Pair::second_type> { typedef typename Pair::first_type ignored_type; const typename Pair::second_type& operator()(const typename Pair::second_type& x, const ignored_type& ) const { return x; } }; ], [ typedef pair<int,int> tn_p; select2nd< tn_p > tn_s; (void)tn_s(1,5); ], [__TYPENAME="typename" ac_cv_typename="yes"], [__TYPENAME="" AC_DEFINE(_STLP_NEED_TYPENAME) ac_cv_typename="no"])AC_MSG_RESULT($ac_cv_typename)AC_MSG_CHECKING(for explicit keyword)AC_TRY_COMPILE( [struct expl_Class { int a; explicit expl_Class(int t): a(t) {} }; expl_Class c(1); ], [], [ac_cv_explicit="yes"], [AC_DEFINE(_STLP_NO_EXPLICIT) ac_cv_explicit="no"])AC_MSG_RESULT($ac_cv_explicit)AC_MSG_CHECKING(for mutable keyword)AC_TRY_COMPILE( [struct mut_Class { mutable int a; void update() const { a=0; } }; mut_Class c; ], [c.update()], [ac_cv_mutable="yes"], [AC_DEFINE(_STLP_NEED_MUTABLE) ac_cv_mutable="no"])AC_MSG_RESULT($ac_cv_mutable)AC_MSG_CHECKING(for new style casts)AC_TRY_COMPILE( [struct ncast_Class { int a; void update(int* i) { *i=a; } }; ncast_Class c; ], [ const int a(5); c.update(const_cast<int*>(&a)) ], [ac_cv_new_cast="yes"], [AC_DEFINE(_STLP_NO_NEW_STYLE_CASTS) ac_cv_new_cast="no"])AC_MSG_RESULT($ac_cv_new_cast)AC_MSG_CHECKING(for new-style C library headers)AC_TRY_COMPILE( [ #include <cctype> #include <cstddef> #include <cstdio> #include <cstdlib> #include <cstring> #include <cassert> #include <climits> #ifndef _STLP_NO_WCHAR_T #include <cwchar> #endif ], [], [ac_cv_newheaders="yes"], [AC_DEFINE(_STLP_HAS_NO_NEW_C_HEADERS) ac_cv_newheaders="no"])AC_MSG_RESULT($ac_cv_newheaders)AC_MSG_CHECKING(for new-style <new> header)AC_TRY_COMPILE( [ #include <new> ], [], [ac_cv_new_new="yes"], [AC_DEFINE(_STLP_NO_NEW_NEW_HEADER) ac_cv_new_new="no"])AC_MSG_RESULT($ac_cv_new_new)AC_MSG_CHECKING(for member template methods)AC_TRY_LINK( [template <class Result>struct mt_foo { typedef Result result_type; template <class Arg> result_type operate(const Arg&) { return Result(); }}; mt_foo<int> p;],[(void)p.operate((char*)"aaa");], [ac_cv_member_templates="yes"],[AC_DEFINE(_STLP_NO_MEMBER_TEMPLATES) ac_cv_member_templates="no"])AC_MSG_RESULT($ac_cv_member_templates)AC_MSG_CHECKING(for friend templates)AC_TRY_LINK( [template <class Result2> class foo;template <class Result>struct ft_foo { typedef Result result_type; template <class Result2> friend class foo;}; ft_foo<int> p;],[], [ac_cv_friend_templates="yes"],[AC_DEFINE(_STLP_NO_FRIEND_TEMPLATES) ac_cv_friend_templates="no"])AC_MSG_RESULT($ac_cv_friend_templates)AC_MSG_CHECKING(for qualified friend templates)AC_TRY_LINK( [${_TEST_STD_BEGIN}template <class Result2> class foo;template <class Result>struct ft_foo { typedef Result result_type; template <class Result2> friend class $_TEST_STD::foo;}; ft_foo<int> p;${_TEST_STD_END}],[], [ac_cv_qual_friend_templates="yes"],[AC_DEFINE(_STLP_NO_QUALIFIED_FRIENDS) ac_cv_qual_friend_templates="no"])AC_MSG_RESULT($ac_cv_qual_friend_templates)AC_MSG_CHECKING(for member template keyword)AC_TRY_LINK( [template <class Result>struct nt_foo { typedef Result result_type; template <class Arg> struct rebind { typedef nt_foo<Arg> other; };};template <class _Tp, class _Allocator>struct _Traits{ typedef typename _Allocator:: template rebind<_Tp> my_rebind; typedef typename my_rebind::other allocator_type;};nt_foo<char> p;_Traits< int, nt_foo<short> > pp;],[], [ac_cv_member_template_keyword="yes"],[AC_DEFINE(_STLP_NO_MEMBER_TEMPLATE_KEYWORD) ac_cv_member_template_keyword="no"])AC_MSG_RESULT($ac_cv_member_template_keyword)if test "$ac_cv_member_template_keyword" = "no"; thenAC_MSG_CHECKING(for member template classes)AC_TRY_LINK( [template <class Result>struct nt_foo { typedef Result result_type; template <class Arg> struct rebind { typedef nt_foo<Arg> other; };};template <class _Tp, class _Allocator>struct _Traits{ typedef typename _Allocator::rebind<_Tp> my_rebind; typedef typename my_rebind::other allocator_type;};nt_foo<char> p;_Traits< int, nt_foo<short> > pp;],[], [ac_cv_member_template_classes="yes"],[AC_DEFINE(_STLP_NO_MEMBER_TEMPLATE_CLASSES) ac_cv_member_template_classes="no"])AC_MSG_RESULT($ac_cv_member_template_classes)fiAC_MSG_CHECKING(for partial class specialization)AC_TRY_LINK( [template <class Arg,class Result>struct ps_foo { typedef Arg argument_type; typedef Result result_type;}; template<class Result>struct ps_foo<Result*,Result*> { void bar() {}};template<class Result>struct ps_foo<int*,Result> { void foo() {}};ps_foo<char*, char*> p;ps_foo<int*, int> p1;],[p.bar(); p1.foo();], [ac_cv_partial_spec="yes"],[AC_DEFINE(_STLP_NO_CLASS_PARTIAL_SPECIALIZATION) ac_cv_partial_spec="no"])AC_MSG_RESULT($ac_cv_partial_spec)if test "$ac_cv_partial_spec" = yes; thenAC_MSG_CHECKING(if explicit args accepted on constructors of partial specialized classes)AC_TRY_LINK( [template <class Arg,class Result>struct ps_foo { typedef Arg argument_type; typedef Result result_type;}; template<class Result>struct ps_foo<Result*,Result*> { ps_foo<Result*,Result*>() {} void bar() {}};template<class Result>struct ps_foo<int*,Result> { ps_foo<int*,Result*>() {} void bar() {}};ps_foo<char*, char*> p;ps_foo<int*, int> p1;],[p.bar(); p1.foo();], [AC_DEFINE(_STLP_PARTIAL_SPEC_NEEDS_TEMPLATE_ARGS) ac_cv_partial_spec_needs_args="yes"],[ac_cv_partial_spec_needs_args="no"])AC_MSG_RESULT($ac_cv_partial_spec_needs_args)fiif test ac_cv_partial_spec_needs_args=="no"; thenAC_MSG_CHECKING(if explicit args accepted on constructors of explicitly specialized classes)AC_TRY_LINK( [template <class Arg,class Result>struct ps_foo { typedef Arg argument_type; typedef Result result_type; void bar() {} }; template<class Result>struct ps_foo<int*,int> { ps_foo<Result*,Result*>() {}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -