📄 configure.in
字号:
void foo() {}
};
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)
fi
AC_MSG_CHECKING(for partial template function ordering)
AC_TRY_LINK( [
template <class Arg,class Result>
Result po_foo (const Arg& a,const Result&){ return (Result)a.nothing; }
template <class T>
struct A {
T a;
A(int _a) : a(_a) {}
};
template<class T>
T po_foo (const A<T>& a, const A<T>& b){ return a.a; }
],
[
A<int> po_a(0); A<int> po_b(1); (void)po_foo(po_b, po_a)
],
[ac_cv_partial_ord="yes"],
[AC_DEFINE(_STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER) ac_cv_partial_ord="no"]
)
AC_MSG_RESULT($ac_cv_partial_ord)
AC_MSG_CHECKING(for method specialization)
AC_TRY_LINK( [
template <class Arg,class Result>
struct ms_foo {
typedef Arg argument_type;
typedef Result result_type;
inline void bar();
};
template <class Arg,class Result>
inline void ms_foo<Arg,Result>::bar() {}
inline void ms_foo<int*,int>::bar() {}
ms_foo<char*, char*> p;
ms_foo<int*, int> p1;
],
[p.bar();
p1.bar();],
[ac_cv_method_spec="yes"],
[AC_DEFINE(_STLP_NO_METHOD_SPECIALIZATION) ac_cv_method_spec="no"]
)
AC_MSG_RESULT($ac_cv_method_spec)
AC_MSG_CHECKING(for lrand48 function)
AC_TRY_LINK(
[#include <stdlib.h>],
[long i = lrand48();],
[AC_DEFINE(_STLP_RAND48) ac_cv_func_lrand48="yes"],
[ac_cv_func_lrand48="no"])
AC_MSG_RESULT($ac_cv_func_lrand48)
AC_MSG_CHECKING(for default template parameters)
AC_TRY_LINK(
[template <class T> struct less {};
template <class T, class T1=less<T> > struct Class { T1 t1; };
Class<int> cl;
Class<int,less<short> > cl2;
],
[],
[ac_cv_default_template_param="yes"],
[AC_DEFINE(_STLP_LIMITED_DEFAULT_TEMPLATES) ac_cv_default_template_param="no"])
AC_MSG_RESULT($ac_cv_default_template_param)
if test "$ac_cv_default_template_param" = "no"; then
AC_MSG_CHECKING(for default type parameters)
AC_TRY_LINK(
[
template <class T> struct less {
typedef int int_t;
};
template <class T, class T1=less<int> >
struct Class {
private:
int a;
public:
typedef Class<T,T1> self;
typedef $__TYPENAME T1::int_t int_t;
self foo (const Class<T,T1>& t) {
if ( t.a==a ) return *this;
else return t;
}
};
Class<int> cl;
Class<int,less<short> > cl2;
],
[],
[AC_DEFINE(_STLP_DEFAULT_TYPE_PARAM) ac_cv_default_type_param="yes"],
[ac_cv_default_type_param="no"])
AC_MSG_RESULT($ac_cv_default_type_param)
fi
dnl let's check if non-type cannot be default
AC_MSG_CHECKING(for default non-type parameters)
AC_TRY_LINK(
[
template <class T, int N=0 >
struct Class {
private:
T* t;
enum { t1=N };
public:
int get_n() { return N; }
};
Class<int> cl;
Class<int, 2> cl2;
],
[],
[ac_cv_default_nontype_param="yes"],
[AC_DEFINE(_STLP_NO_DEFAULT_NON_TYPE_PARAM) ac_cv_default_nontype_param="no"]
)
AC_MSG_RESULT($ac_cv_default_nontype_param)
AC_MSG_CHECKING(for non-type parameter bug)
AC_TRY_LINK(
[
template <class T, int N>
struct Class {
private:
T* t;
enum { t1=N };
public:
int get_n() { return N; }
};
template <class T, int N>
int operator==(const Class<T,N>& , const Class<T,N>& ) { return 0; }
Class<int, 1> cl;
Class<int, 1> cl2;
int i(cl==cl2);
],
[],
[ac_cv_nontype_param_bug="no"],
[AC_DEFINE(_STLP_NON_TYPE_TMPL_PARAM_BUG) ac_cv_nontype_param_bug="yes"]
)
AC_MSG_RESULT($ac_cv_nontype_param_bug)
AC_MSG_CHECKING(for static data member templates)
AC_TRY_LINK(
[template <class T> struct Class { static int a; };
template <class T> int Class<T>::a;],
[],
[ac_cv_static_templates="yes"],
[AC_DEFINE(_STLP_NO_STATIC_TEMPLATE_DATA) ac_cv_static_templates="no"])
AC_MSG_RESULT($ac_cv_static_templates)
if test "$ac_cv_static_templates" = no; then
AC_MSG_CHECKING(for weak attribute)
AC_TRY_COMPILE(
[int a_w __attribute__((weak));],
[],
[AC_DEFINE(_STLP_WEAK_ATTRIBUTE) ac_cv_weak_attribute="yes"],
[ac_cv_weak_attribute="no"])
AC_MSG_RESULT($ac_cv_weak_attribute)
fi
if test "$ac_cv_static_templates" = yes; then
AC_MSG_CHECKING(for static array member size bug)
AC_TRY_LINK(
[template <class T> struct Class { enum { sz=5 }; static int a[sz]; };
template <class T> int Class<T>::a[Class<T>::sz];],
[],
[ac_cv_static_array_bug="no"],
[AC_DEFINE(_STLP_STATIC_ARRAY_BUG) ac_cv_static_array_bug="yes"])
AC_MSG_RESULT($ac_cv_static_array_bug)
fi
AC_MSG_CHECKING(for static data member const initializer bug)
AC_TRY_LINK(
[template <class T> struct Class { static const int a = 1; };
template <class T> const int Class<T>::a;],
[],
[ac_cv_static_init_bug="no"],
[AC_DEFINE(_STLP_STATIC_CONST_INIT_BUG) ac_cv_static_init_bug="yes"])
AC_MSG_RESULT($ac_cv_static_init_bug)
AC_MSG_CHECKING(for namespaces support)
AC_TRY_COMPILE(
[class test_class {};
namespace std {
using ::test_class;
template <class T> struct Class { typedef T my_type; };
typedef Class<int>::my_type int_type;
};
inline int ns_foo (std::int_type t) {
using namespace std;
int_type i =2;
return i+t;
}
],
[(void)ns_foo(1);],
[_TEST_STD="std" _TEST_STD_BEGIN="namespace $_TEST_STD" _TEST_STD_END="namespace $_TEST_STD" ac_cv_namespaces="yes"],
[AC_DEFINE(_STLP_HAS_NO_NAMESPACES) _TEST_STD="" _TEST_STD_BEGIN="" _TEST_STD_END="" ac_cv_namespaces="no"])
AC_MSG_RESULT($ac_cv_namespaces)
AC_MSG_CHECKING(for broken "using" directive)
AC_TRY_COMPILE(
[namespace std {
template <class T> struct Class { typedef T my_type; };
typedef Class<int>::my_type int_type;
template <class T> void foo(T,int) {}
template <class T> void foo(T,int,int) {}
};
using std::Class;
using std::foo;
],
[(void)foo(1,1);],
[ac_cv_broken_using="no"],
[ac_cv_broken_using="yes"])
if test "$ac_cv_broken_using" = no; then
# check if no warnings have been issued
if `check_warning` ; then
ac_cv_broken_using=no
else
AC_DEFINE(_STLP_BROKEN_USING_DIRECTIVE)
fi
else
AC_DEFINE(_STLP_BROKEN_USING_DIRECTIVE)
fi
AC_MSG_RESULT($ac_cv_broken_using)
if test "$ac_cv_namespaces" = yes; then
AC_ARG_ENABLE(namespaces,[--enable-namespaces Use namespaces (default if posssible)
--disable-namespaces Don't use namespaces support],
[
case "$enableval" in
no) AC_DEFINE(_STLP_NO_NAMESPACES)
_TEST_STD=""
_TEST_STD_BEGIN=""
_TEST_STD_END=""
AC_MSG_RESULT(Config arg --disable-namespaces : code not put into namespace by user request);;
*) AC_MSG_RESULT(Config default: code put into namespace)
esac
],
[AC_MSG_RESULT(Config default: code put into namespace)]
)
else
AC_MSG_RESULT(Compiler restriction : no namespaces support used)
fi
AC_MSG_CHECKING(for exceptions support)
AC_TRY_COMPILE(
[int ex_foo() {
try {
try { throw(1); }
catch (int a) { throw; }
} catch (...) {;}
return 0;
}],
[(void)ex_foo();],
[ac_cv_exceptions="yes"],
[AC_DEFINE(_STLP_HAS_NO_EXCEPTIONS) ac_cv_exceptions="no"])
AC_MSG_RESULT($ac_cv_exceptions)
if test "$ac_cv_exceptions" = yes; then
AC_MSG_CHECKING(if exceptions specification works)
AC_TRY_COMPILE(
[template <class T> inline int ex_spec_foo(const T&) throw () { return 0;} ],
[(void)ex_spec_foo(5);],
[ac_cv_exception_spec="yes"],
[AC_DEFINE(_STLP_NO_EXCEPTION_SPEC) ac_cv_exception_spec="no"])
dnl if test "$ac_cv_exception_spec" = yes; then
dnl # check if no warnings have been issued
dnl if `check_warning` ; then
dnl AC_DEFINE(_STLP_EXCEPTION_SPEC)
dnl else
dnl ac_cv_exception_spec=no
dnl fi
dnl fi
AC_MSG_RESULT($ac_cv_exception_spec)
AC_MSG_CHECKING(if return is required after throw)
AC_TRY_COMPILE(
[int ex_foo() {
try {
try { throw(1); }
catch (int a) { throw; }
} catch (...) {;}
return 0;
}],
[(void)ex_foo();],
[ac_cv_throw_return_bug="no"],
[AC_DEFINE(_STLP_THROW_RETURN_BUG) ac_cv_throw_return_bug="yes"])
if test "$ac_cv_throw_return_bug" = no; then
# check if no warnings have been issued
if `check_warning` ; then
ac_cv_throw_return_bug="no"
else
AC_DEFINE(_STLP_THROW_RETURN_BUG)
ac_cv_throw_return_bug="yes"
fi
fi
AC_MSG_RESULT($ac_cv_throw_return_bug)
fi
AC_MSG_CHECKING(for native <string> header with basic_string defined )
AC_TRY_COMPILE(
[
#include <string>
# if !defined (_STLP_HAS_NO_NAMESPACES)
using namespace $_TEST_STD;
# endif
basic_string<char, char_traits<char>, allocator<char> > bs;
string bd = bs;
],
[],
[ ac_cv_string_header="yes"],
[ AC_DEFINE(_STLP_NO_STRING_HEADER) ac_cv_string_header="no"]
)
AC_MSG_RESULT($ac_cv_string_header)
dnl there could be no correct stdexcept/iostream without string
if test "$ac_cv_string_header" = yes; then
AC_MSG_CHECKING(for native <stdexcept> header)
AC_TRY_COMPILE(
[
#include <stdexcept>
# if !defined (_STLP_HAS_NO_NAMESPACES)
using namespace $_TEST_STD;
# endif
string s;
logic_error le(s);
runtime_error re(s);
domain_error de(s);
invalid_argument ia(s);
length_error lne(s);
out_of_range or(s);
range_error rne(s);
overflow_error ove(s);
underflow_error ue(s);
],
[],
[ac_cv_stdexcept_header="yes"],
[AC_DEFINE(_STLP_NO_STDEXCEPT_HEADER) ac_cv_stdexcept_header="no"]
)
AC_MSG_RESULT($ac_cv_stdexcept_header)
AC_MSG_CHECKING(for new iostreams)
AC_TRY_COMPILE(
[
#include <iosfwd>
#include <iostream>
# if !defined (_STLP_HAS_NO_NAMESPACES)
using namespace $_TEST_STD;
# endif
template <class _Tp, class _Traits>
void outp(basic_ostream<_Tp,_Traits>& o, char* str) {
o<<str;
}
],
[
outp(cout, "Hello World\n")
],
[ac_cv_newstreams="yes"],
[AC_DEFINE(_STLP_HAS_NO_NEW_IOSTREAMS) ac_cv_newstreams="no"])
AC_MSG_RESULT($ac_cv_newstreams)
dnl end namespace-related tests
fi
AC_MSG_CHECKING(for <exception> header with class "exception" defined)
AC_TRY_COMPILE(
[
#include <exception>
# if !defined (_STLP_HAS_NO_NAMESPACES)
using namespace $_TEST_STD;
# endif
class my_exception: public $_TEST_STD::exception {};
my_exception mm;
],
[],
[ac_cv_exception_header="yes"],
[AC_DEFINE(_STLP_NO_EXCEPTION_HEADER) ac_cv_exception_header="no"]
)
AC_MSG_RESULT($ac_cv_exception_header)
AC_MSG_CHECKING(builtin constructor bug)
AC_TRY_RUN( [
# ifdef _STLP_USE_NEW_STYLE_HEADERS
# include <cassert>
# include <cstdio>
# include <cstring>
# include <new>
# else
# include <assert.h>
# include <stdio.h>
# include <string.h>
# include <new.h>
# endif
int main(int, char**) {
int i;
double buf[1000];
char* pc = (char*)buf;
short* ps = (short*)buf;
int* pi = (int*)buf;
long* pl = (long*)buf;
double* pd = (double*)buf;
float* pf = (float*)buf;
for (i=0; i<100; i++) {
new(pc) char();
assert(char()==0 && *pc==0);
sprintf(pc,"lalala\n");
new (ps) short();
assert(short()==0 && *ps ==0);
sprintf(pc,"lalala\n");
new (pi) int();
assert(int()==0 && *pi == 0);
sprintf(pc,"lalala\n");
new (pl) long();
assert(long()==0 && *pl == 0);
sprintf(pc,"lalala\n");
new (pf) float();
assert(float()==0.0 && *pf == 0.0);
sprintf(pc,"lalala\n");
new (pd) double();
assert(double()==0.0 && *pd == 0.0);
sprintf(pc,"lalala\n");
}
return 0;
}
],
[ ac_cv_builtin_c_bug="no"],
[ AC_DEFINE(_STLP_DEFAULT_CONSTRUCTOR_BUG) ac_cv_builtin_c_bug="yes"],
[ AC_DEFINE(_STLP_DEFAULT_CONSTRUCTOR_BUG) ac_cv_builtin_c_bug="yes"]
)
AC_MSG_RESULT($ac_cv_builtin_c_bug)
AC_MSG_CHECKING(for trivial constructor bug)
AC_TRY_LINK(
[struct output_iterator_tag {};
void tc_bug_foo(output_iterator_tag) {}
inline void tc_test_foo() { tc_bug_foo(output_iterator_tag()); }],
[tc_test_foo();],
[ac_cv_tc_bug="no"],
[AC_DEFINE(_STLP_TRIVIAL_CONSTRUCTOR_BUG) ac_cv_tc_bug="yes"])
AC_MSG_RESULT($ac_cv_tc_bug)
AC_MSG_CHECKING(for trivial destructor bug)
AC_TRY_LINK(
[struct output_iterator_tag {output_iterator_tag() {} };
output_iterator_tag* td_bug_bar ;
],
[ td_bug_bar->~output_iterator_tag();
],
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -