home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / stlpt453.zip / STLport-4.5.3 / stlport / config / new_compiler / configure.in < prev    next >
Text File  |  2001-05-26  |  39KB  |  1,425 lines

  1. dnl Disable any caching here 
  2. define([AC_CACHE_LOAD], )dnl
  3. define([AC_CACHE_SAVE], )dnl
  4. dnl Process this file with autoconf to produce a configure script.
  5. AC_INIT(stlconf.h.in)
  6. AC_CONFIG_HEADER(stlconf.h)
  7.  
  8. AC_MSG_RESULT(*** $0: STLport configuration utility ***)
  9. if test "${CXXFLAGS}" = ""; then 
  10. AC_MSG_RESULT(* Note: for best reliability - try \"CXXFLAGS=-treat_warnings_as_errors\" $0 )
  11. AC_MSG_RESULT(* Please don't forget specifying typical CXXFLAGS you'll be using - ) 
  12. AC_MSG_RESULT(* such as that enabling exceptions handling, etc. )
  13. dnl AC_MSG_RESULT(* Add option forcing instantiation of all templates to CXXFLAGS if possible. )
  14. fi
  15. AC_MSG_RESULT(Please stand by while exploring compiler capabilities...)
  16. AC_MSG_RESULT(Be patient - that may take a while...)
  17. AC_MSG_RESULT(***)
  18.  
  19. # utility function
  20. check_warning () {
  21.     warn_str=`tail -1 config.log | egrep -i "arning|\(W\)"`
  22.     if test "$warn_str" = ""; then
  23.       return 0
  24.     else
  25.      return 1
  26.     fi
  27. }
  28.  
  29. dnl Checks for systems
  30. dnl AC_AIX
  31. dnl Checks for programs.
  32. dnl sets CXX
  33.  
  34. AC_ARG_ENABLE(extension,[--enable-extension=<ext>],
  35. [
  36. case "$enableval" in
  37.     no) AC_MSG_RESULT(Info :.cpp used as extension for tests) 
  38.         ac_ext=cpp 
  39.           ;;
  40.      *) AC_MSG_RESULT(Argument : .$enableval used as extension) 
  41.     ac_ext=$enableval
  42. esac
  43. ],
  44. [AC_MSG_RESULT(Info : .cpp used as extension for tests) 
  45.     ac_ext=cpp
  46. ]
  47. )
  48.  
  49. # Save that, as it is being redefined several times 
  50. use_ac_ext=$ac_ext
  51.  
  52. AC_PROG_CXX
  53. ac_ext=$use_ac_ext
  54.  
  55. AC_LANG_CPLUSPLUS
  56. ac_ext=$use_ac_ext
  57.  
  58. AC_CHECK_SIZEOF(int,4)
  59. ac_ext=$use_ac_ext
  60.  
  61. if test "$ac_cv_sizeof_int" = "4"; then
  62.   AC_DEFINE_UNQUOTED(_STLP_UINT32_T,unsigned int)
  63. else
  64.   AC_CHECK_SIZEOF(long,4)
  65.   ac_ext=$use_ac_ext
  66.   if test "$ac_cv_sizeof_long" = "4"; then
  67.     AC_DEFINE_UNQUOTED(_STLP_UINT32_T,unsigned long)
  68.   else
  69.   dnl ELBRUS ??? ;)
  70.     AC_CHECK_SIZEOF(short,4)
  71.     if test "$ac_cv_sizeof_short" = "4"; then
  72.       AC_DEFINE_UNQUOTED(_STLP_UINT32_T,unsigned short)
  73.     else
  74.       AC_MSG_ERROR(Cannot find any 32-bit integer type for your compiler)
  75.     fi
  76.   ac_ext=$use_ac_ext
  77.   fi
  78. fi
  79. ac_ext=$use_ac_ext
  80.  
  81.  
  82. dnl Exclude link stage for cross-compilation
  83. if test "$ac_cv_c_cross" = "yes"; then
  84.   CXXFLAGS="${CXXFLAGS} -c"
  85. fi
  86.  
  87. ac_ext=$use_ac_ext
  88.  
  89. dnl checking for compiler capabilities
  90. AC_MSG_CHECKING(for basic STL compatibility)
  91. AC_TRY_LINK( [
  92. template <class Arg1, class Arg2, class Result>
  93. struct binary_function {
  94.     typedef Arg1 first_argument_type;
  95.     typedef Arg2 second_argument_type;
  96.     typedef Result result_type;
  97. };      
  98. template <class T>
  99. struct plus : public binary_function<T, T, T> {
  100.     T operator()(const T& x, const T& y) const;
  101. };
  102.  
  103. template <class T>
  104. T plus<T>::operator()(const T& x, const T& y) const { return x + y; }
  105. plus<int> p;
  106. ],
  107. [], 
  108. [ac_cv_compat="yes"],
  109. [AC_MSG_ERROR(Your compiler won't be able to compile this implementation. Sorry.) 
  110.  ac_cv_compat="no"]
  111. )
  112. AC_MSG_RESULT($ac_cv_compat)
  113.  
  114. AC_MSG_CHECKING(for partial specialization syntax)
  115. AC_TRY_LINK(
  116.     [
  117.      template <class T> class fs_foo {};
  118.      template <> class fs_foo<int> {};],
  119.     [ fs_foo<int> i;],
  120.     [  _FULL_SPEC="template <>" ac_cv_spec_syntax="yes"],
  121.     [  AC_DEFINE(_STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX) ac_cv_spec_syntax="no" _FULL_SPEC=""])
  122. AC_MSG_RESULT($ac_cv_spec_syntax)
  123.  
  124. AC_MSG_CHECKING(for bool keyword)
  125. AC_TRY_COMPILE(
  126.     [bool b_foo() { return true; }],
  127.     [(void)b_foo();],
  128.     [ac_cv_bool="yes"],
  129.     [AC_DEFINE(_STLP_NO_BOOL) ac_cv_bool="no"])
  130. AC_MSG_RESULT($ac_cv_bool)
  131. if test "$ac_cv_bool" = "no"; then
  132.   AC_MSG_CHECKING(for yvals.h header)
  133.   AC_TRY_COMPILE([#include <yvals.h> 
  134.     extern bool aaa=true;
  135.    ], [], 
  136.   [AC_DEFINE(_STLP_YVALS_H) AC_MSG_RESULT(yes) ], 
  137.   [
  138.   AC_MSG_RESULT(no)
  139.   AC_MSG_CHECKING(whether bool is reserved word)
  140.   AC_TRY_COMPILE(
  141.     [typedef int bool;],
  142.     [],
  143.     [ac_cv_bool_reserved="no"],
  144.     [AC_DEFINE(_STLP_DONT_USE_BOOL_TYPEDEF) ac_cv_bool_reserved="yes"])
  145.   AC_MSG_RESULT($ac_cv_bool_reserved)
  146.   ])
  147. fi
  148.  
  149. AC_MSG_CHECKING(for wchar_t type)
  150. AC_TRY_COMPILE(
  151.     [ #include <wchar.h>
  152.       wchar_t wc_foo() { return 'a'; }],
  153.     [(void)wc_foo();],
  154.     [ac_cv_wchar="yes"],
  155.     [AC_DEFINE(_STLP_NO_WCHAR_T) ac_cv_wchar="no"])
  156. AC_MSG_RESULT($ac_cv_wchar)
  157.  
  158. AC_MSG_CHECKING(if wchar_t is unsigned short)
  159. AC_TRY_COMPILE(
  160.     [
  161.      # include <wchar.h>
  162.      template <class T> struct foo {};
  163.      $_FULL_SPEC struct foo <wchar_t> {};
  164.      typedef unsigned short u__short;
  165.      $_FULL_SPEC struct foo <u__short> {};
  166.      foo<wchar_t> f1;
  167.      foo<u__short> f2;
  168.     ],
  169.     [],
  170.     [ac_cv_wchar_short="no"],
  171.     [AC_DEFINE(_STLP_WCHAR_T_IS_USHORT) ac_cv_wchar_short="yes"])
  172. AC_MSG_RESULT($ac_cv_wchar_short)
  173.  
  174. AC_MSG_CHECKING(for long long type)
  175. AC_TRY_COMPILE(
  176.     [long long ll_foo() { return 0; }],
  177.     [(void)ll_foo();],
  178.     [AC_DEFINE(_STLP_LONG_LONG) ac_cv_long_long="yes"],
  179.     [ac_cv_long_long="no"])
  180. AC_MSG_RESULT($ac_cv_long_long)
  181.  
  182. AC_MSG_CHECKING(for long double type)
  183. AC_TRY_COMPILE(
  184.     [long double ld_foo() { return 0; }],
  185.     [(void)ld_foo();],
  186.     [ac_cv_long_double="yes"],
  187.     [AC_DEFINE(_STLP_NO_LONG_DOUBLE) ac_cv_long_double="no"])
  188. AC_MSG_RESULT($ac_cv_long_double)
  189.  
  190. AC_MSG_CHECKING(for typename keyword)
  191. AC_TRY_LINK(
  192.     [
  193. template <class T1, class T2>
  194. struct pair {
  195.     typedef T1 first_type;
  196.     typedef T2 second_type;
  197. };
  198.  
  199. template <class Arg, class Result>
  200. struct unary_function {
  201.     typedef Arg argument_type;
  202.     typedef Result result_type;
  203. };
  204.  
  205. template <class Pair>
  206. struct select2nd : public unary_function<Pair, typename Pair::second_type> {
  207.   typedef typename Pair::first_type ignored_type;
  208.   const typename Pair::second_type& operator()(const typename Pair::second_type& x,
  209.                         const ignored_type& ) const
  210.   {
  211.     return x;
  212.   }
  213.   
  214. };
  215.     ],
  216.     [ 
  217.     typedef pair<int,int> tn_p;
  218.     select2nd< tn_p > tn_s;
  219.     (void)tn_s(1,5);
  220.     ],
  221.     [__TYPENAME="typename" 
  222.      ac_cv_typename="yes"],
  223.     [__TYPENAME="" 
  224.      AC_DEFINE(_STLP_NEED_TYPENAME)
  225.      ac_cv_typename="no"])
  226. AC_MSG_RESULT($ac_cv_typename)
  227.  
  228. AC_MSG_CHECKING(for explicit keyword)
  229. AC_TRY_COMPILE(    
  230.     [struct expl_Class { int a; explicit expl_Class(int t): a(t) {} };
  231.     expl_Class c(1);
  232.     ],
  233.     [],
  234.     [ac_cv_explicit="yes"],
  235.     [AC_DEFINE(_STLP_NO_EXPLICIT) ac_cv_explicit="no"])
  236. AC_MSG_RESULT($ac_cv_explicit)
  237.  
  238. AC_MSG_CHECKING(for mutable keyword)
  239. AC_TRY_COMPILE(    
  240.     [struct mut_Class { mutable int a; void update() const { a=0; }  };
  241.     mut_Class c;
  242.     ],
  243.     [c.update()],
  244.     [ac_cv_mutable="yes"],
  245.     [AC_DEFINE(_STLP_NEED_MUTABLE) ac_cv_mutable="no"])
  246. AC_MSG_RESULT($ac_cv_mutable)
  247.  
  248. AC_MSG_CHECKING(for new style casts)
  249. AC_TRY_COMPILE(    
  250.     [struct ncast_Class { 
  251.     int a; void update(int* i) { *i=a; }  };
  252.     ncast_Class c;
  253.     ],
  254.     [
  255.   const int a(5);
  256.   c.update(const_cast<int*>(&a))
  257.     ],
  258.     [ac_cv_new_cast="yes"],
  259.     [AC_DEFINE(_STLP_NO_NEW_STYLE_CASTS) ac_cv_new_cast="no"])
  260. AC_MSG_RESULT($ac_cv_new_cast)
  261.  
  262. AC_MSG_CHECKING(for new-style C library headers)
  263. AC_TRY_COMPILE(
  264.     [
  265.      #include <cctype>
  266.      #include <cstddef>
  267.      #include <cstdio>
  268.      #include <cstdlib>
  269.      #include <cstring>
  270.      #include <cassert>
  271.      #include <climits>
  272.      #ifndef _STLP_NO_WCHAR_T
  273.      #include <cwchar>
  274.      #endif
  275.        ],
  276.     [],
  277.     [ac_cv_newheaders="yes"],
  278.     [AC_DEFINE(_STLP_HAS_NO_NEW_C_HEADERS) ac_cv_newheaders="no"])
  279. AC_MSG_RESULT($ac_cv_newheaders)
  280.  
  281. AC_MSG_CHECKING(for new-style <new> header)
  282. AC_TRY_COMPILE(
  283.     [
  284.      #include <new>
  285.        ],
  286.     [],
  287.     [ac_cv_new_new="yes"],
  288.     [AC_DEFINE(_STLP_NO_NEW_NEW_HEADER) ac_cv_new_new="no"])
  289. AC_MSG_RESULT($ac_cv_new_new)
  290.  
  291.  
  292. AC_MSG_CHECKING(for member template methods)
  293. AC_TRY_LINK( [
  294. template <class Result>
  295. struct mt_foo {
  296.     typedef Result result_type;
  297.     template <class Arg> result_type operate(const Arg&) { return Result(); }
  298. };      
  299. mt_foo<int> p;
  300. ],
  301. [
  302. (void)p.operate((char*)"aaa");
  303. ], 
  304. [ac_cv_member_templates="yes"],
  305. [AC_DEFINE(_STLP_NO_MEMBER_TEMPLATES) ac_cv_member_templates="no"]
  306. )
  307. AC_MSG_RESULT($ac_cv_member_templates)
  308.  
  309. AC_MSG_CHECKING(for friend templates)
  310. AC_TRY_LINK( [
  311.  
  312. template <class Result2> class foo;
  313.  
  314. template <class Result>
  315. struct ft_foo {
  316.     typedef Result result_type;
  317.     template <class Result2> friend class foo;
  318. };      
  319. ft_foo<int> p;
  320. ],
  321. [], 
  322. [ac_cv_friend_templates="yes"],
  323. [AC_DEFINE(_STLP_NO_FRIEND_TEMPLATES) ac_cv_friend_templates="no"]
  324. )
  325. AC_MSG_RESULT($ac_cv_friend_templates)
  326.  
  327. AC_MSG_CHECKING(for qualified friend templates)
  328. AC_TRY_LINK( [
  329.  
  330. ${_TEST_STD_BEGIN}
  331.  
  332. template <class Result2> class foo;
  333.  
  334. template <class Result>
  335. struct ft_foo {
  336.     typedef Result result_type;
  337.     template <class Result2> friend class $_TEST_STD::foo;
  338. };      
  339. ft_foo<int> p;
  340. ${_TEST_STD_END}
  341.  
  342. ],
  343. [], 
  344. [ac_cv_qual_friend_templates="yes"],
  345. [AC_DEFINE(_STLP_NO_QUALIFIED_FRIENDS) ac_cv_qual_friend_templates="no"]
  346. )
  347. AC_MSG_RESULT($ac_cv_qual_friend_templates)
  348.  
  349. AC_MSG_CHECKING(for member template keyword)
  350. AC_TRY_LINK( [
  351. template <class Result>
  352. struct nt_foo {
  353.     typedef Result result_type;
  354.     template <class Arg> struct rebind {  typedef nt_foo<Arg> other; };
  355. };
  356.  
  357. template <class _Tp, class _Allocator>
  358. struct _Traits
  359. {
  360.   typedef typename _Allocator:: template rebind<_Tp> my_rebind; 
  361.   typedef typename my_rebind::other allocator_type;
  362. };
  363.  
  364. nt_foo<char> p;
  365. _Traits< int, nt_foo<short> > pp;
  366. ],
  367. [], 
  368. [ac_cv_member_template_keyword="yes"],
  369. [AC_DEFINE(_STLP_NO_MEMBER_TEMPLATE_KEYWORD) ac_cv_member_template_keyword="no"]
  370. )
  371. AC_MSG_RESULT($ac_cv_member_template_keyword)
  372.  
  373. if test "$ac_cv_member_template_keyword" = "no"; then
  374. AC_MSG_CHECKING(for member template classes)
  375. AC_TRY_LINK( [
  376. template <class Result>
  377. struct nt_foo {
  378.     typedef Result result_type;
  379.     template <class Arg> struct rebind {  typedef nt_foo<Arg> other; };
  380. };
  381.  
  382. template <class _Tp, class _Allocator>
  383. struct _Traits
  384. {
  385.   typedef typename _Allocator::rebind<_Tp> my_rebind; 
  386.   typedef typename my_rebind::other allocator_type;
  387. };
  388.  
  389. nt_foo<char> p;
  390. _Traits< int, nt_foo<short> > pp;
  391. ],
  392. [], 
  393. [ac_cv_member_template_classes="yes"],
  394. [AC_DEFINE(_STLP_NO_MEMBER_TEMPLATE_CLASSES) ac_cv_member_template_classes="no"]
  395. )
  396. AC_MSG_RESULT($ac_cv_member_template_classes)
  397. fi
  398.  
  399. AC_MSG_CHECKING(for partial class specialization)
  400. AC_TRY_LINK( [
  401. template <class Arg,class Result>
  402. struct ps_foo {
  403.     typedef Arg argument_type;
  404.     typedef Result result_type;
  405. };   
  406.  
  407. template<class Result>
  408. struct ps_foo<Result*,Result*> {
  409.     void bar() {}
  410. };
  411.  
  412. template<class Result>
  413. struct ps_foo<int*,Result> {
  414.     void foo() {}
  415. };
  416.  
  417. ps_foo<char*, char*> p;
  418. ps_foo<int*, int> p1;
  419. ],
  420. [p.bar();
  421.  p1.foo();], 
  422. [ac_cv_partial_spec="yes"],
  423. [AC_DEFINE(_STLP_NO_CLASS_PARTIAL_SPECIALIZATION) ac_cv_partial_spec="no"]
  424. )
  425. AC_MSG_RESULT($ac_cv_partial_spec)
  426.  
  427. if test "$ac_cv_partial_spec" = yes; then
  428.  
  429. AC_MSG_CHECKING(if explicit args accepted on constructors of partial specialized classes)
  430. AC_TRY_LINK( [
  431. template <class Arg,class Result>
  432. struct ps_foo {
  433.     typedef Arg argument_type;
  434.     typedef Result result_type;
  435. };   
  436.  
  437. template<class Result>
  438. struct ps_foo<Result*,Result*> {
  439.     ps_foo<Result*,Result*>() {}
  440.     void bar() {}
  441. };
  442.  
  443. template<class Result>
  444. struct ps_foo<int*,Result> {
  445.     ps_foo<int*,Result*>() {}
  446.     void bar() {}
  447.  
  448. };
  449.  
  450. ps_foo<char*, char*> p;
  451. ps_foo<int*, int> p1;
  452. ],
  453. [p.bar();
  454.  p1.foo();], 
  455. [AC_DEFINE(_STLP_PARTIAL_SPEC_NEEDS_TEMPLATE_ARGS) ac_cv_partial_spec_needs_args="yes"],
  456. [ac_cv_partial_spec_needs_args="no"]
  457. )
  458. AC_MSG_RESULT($ac_cv_partial_spec_needs_args)
  459.  
  460. fi
  461.  
  462. if test ac_cv_partial_spec_needs_args=="no"; then
  463.  
  464. AC_MSG_CHECKING(if explicit args accepted on constructors of explicitly specialized classes)
  465. AC_TRY_LINK( [
  466. template <class Arg,class Result>
  467. struct ps_foo {
  468.     typedef Arg argument_type;
  469.     typedef Result result_type;
  470.     void bar() {}    
  471. };   
  472.  
  473. template<class Result>
  474. struct ps_foo<int*,int> {
  475.     ps_foo<Result*,Result*>() {}
  476.     void foo() {}
  477. };
  478.  
  479. ps_foo<char*, char*> p;
  480. ps_foo<int*, int> p1;
  481. ],
  482. [p.bar();
  483.  p1.foo();], 
  484. [AC_DEFINE(_STLP_PARTIAL_SPEC_NEEDS_TEMPLATE_ARGS) ac_cv_partial_spec_needs_args="yes"],
  485. [ac_cv_partial_spec_needs_args="no"]
  486. )
  487. AC_MSG_RESULT($ac_cv_partial_spec_needs_args)
  488.  
  489. fi
  490.  
  491. AC_MSG_CHECKING(for partial template function ordering)
  492. AC_TRY_LINK( [
  493.  
  494. template <class Arg,class Result>
  495. Result po_foo (const Arg& a,const Result&){ return (Result)a.nothing; }  
  496.  
  497. template <class T>
  498. struct A {
  499.     T a;
  500.     A(int _a) : a(_a) {}
  501. };
  502.  
  503. template<class T>
  504. T po_foo (const A<T>& a, const A<T>& b){ return a.a; }   
  505. ],
  506. [
  507.   A<int> po_a(0); A<int> po_b(1); (void)po_foo(po_b, po_a)
  508. ],
  509. [ac_cv_partial_ord="yes"],
  510. [AC_DEFINE(_STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER) ac_cv_partial_ord="no"]
  511. )
  512. AC_MSG_RESULT($ac_cv_partial_ord)
  513.  
  514. AC_MSG_CHECKING(for method specialization)
  515. AC_TRY_LINK( [
  516. template <class Arg,class Result>
  517. struct ms_foo {
  518.     typedef Arg argument_type;
  519.     typedef Result result_type;
  520.     inline void bar();
  521. };   
  522.  
  523. template <class Arg,class Result>
  524. inline void ms_foo<Arg,Result>::bar() {}
  525.  
  526. inline void ms_foo<int*,int>::bar() {}
  527.  
  528. ms_foo<char*, char*> p;
  529. ms_foo<int*, int> p1;
  530. ],
  531. [p.bar();
  532.  p1.bar();], 
  533. [ac_cv_method_spec="yes"],
  534. [AC_DEFINE(_STLP_NO_METHOD_SPECIALIZATION) ac_cv_method_spec="no"]
  535. )
  536. AC_MSG_RESULT($ac_cv_method_spec)
  537.  
  538. AC_MSG_CHECKING(for lrand48 function)
  539. AC_TRY_LINK(
  540.     [#include <stdlib.h>],
  541.     [long i = lrand48();],
  542.     [AC_DEFINE(_STLP_RAND48) ac_cv_func_lrand48="yes"],
  543.     [ac_cv_func_lrand48="no"])
  544. AC_MSG_RESULT($ac_cv_func_lrand48)
  545.  
  546.  
  547. AC_MSG_CHECKING(for default template parameters)
  548. AC_TRY_LINK(
  549.     [template <class T> struct less {}; 
  550.      template <class T, class T1=less<T> > struct Class { T1 t1; };
  551.      Class<int> cl;
  552.      Class<int,less<short> > cl2;
  553.     ],
  554.     [],
  555.     [ac_cv_default_template_param="yes"],
  556.     [AC_DEFINE(_STLP_LIMITED_DEFAULT_TEMPLATES) ac_cv_default_template_param="no"])
  557. AC_MSG_RESULT($ac_cv_default_template_param)
  558. if test "$ac_cv_default_template_param" = "no"; then
  559.   AC_MSG_CHECKING(for default type parameters)
  560.   AC_TRY_LINK(
  561.     [
  562. template <class T> struct less {
  563.     typedef int int_t;
  564.   }; 
  565.  
  566. template <class T, class T1=less<int> > 
  567. struct Class { 
  568. private:
  569.        int a;
  570. public:
  571.        typedef Class<T,T1> self; 
  572.        typedef $__TYPENAME T1::int_t int_t;
  573.        self foo (const Class<T,T1>& t) { 
  574.          if ( t.a==a ) return *this;
  575.          else return t;
  576.          } 
  577. };
  578.  
  579. Class<int> cl;
  580. Class<int,less<short> > cl2;
  581.     ],
  582.     [],
  583.     [AC_DEFINE(_STLP_DEFAULT_TYPE_PARAM) ac_cv_default_type_param="yes"],
  584.     [ac_cv_default_type_param="no"])
  585.   AC_MSG_RESULT($ac_cv_default_type_param)
  586.  
  587. fi
  588.  
  589. dnl let's check if non-type cannot be default
  590.  
  591. AC_MSG_CHECKING(for default non-type parameters)
  592. AC_TRY_LINK(
  593.     [
  594. template <class T, int N=0 > 
  595. struct Class { 
  596. private:
  597.        T* t;
  598.        enum { t1=N };
  599. public:
  600.        int get_n() { return N; }
  601. };
  602.  
  603. Class<int> cl;
  604. Class<int, 2> cl2;
  605.     ],
  606.     [],
  607.     [ac_cv_default_nontype_param="yes"],
  608.     [AC_DEFINE(_STLP_NO_DEFAULT_NON_TYPE_PARAM) ac_cv_default_nontype_param="no"]
  609.     )
  610. AC_MSG_RESULT($ac_cv_default_nontype_param)
  611.  
  612. AC_MSG_CHECKING(for non-type parameter bug)
  613. AC_TRY_LINK(
  614.     [
  615. template <class T, int N> 
  616. struct Class { 
  617. private:
  618.        T* t;
  619.        enum { t1=N };
  620. public:
  621.        int get_n() { return N; }
  622. };
  623.  
  624. template <class T, int N>
  625. int operator==(const Class<T,N>& , const Class<T,N>& ) { return 0; }
  626.  
  627. Class<int, 1> cl;
  628. Class<int, 1> cl2;
  629. int i(cl==cl2);
  630.     ],
  631.     [],
  632.     [ac_cv_nontype_param_bug="no"],
  633.     [AC_DEFINE(_STLP_NON_TYPE_TMPL_PARAM_BUG) ac_cv_nontype_param_bug="yes"]
  634.     )
  635. AC_MSG_RESULT($ac_cv_nontype_param_bug)
  636.  
  637. AC_MSG_CHECKING(for static data member templates)
  638. AC_TRY_LINK(
  639.     [template <class T> struct Class { static int a; };
  640.      template <class T> int Class<T>::a;],
  641.     [],
  642.     [ac_cv_static_templates="yes"],
  643.     [AC_DEFINE(_STLP_NO_STATIC_TEMPLATE_DATA) ac_cv_static_templates="no"])
  644. AC_MSG_RESULT($ac_cv_static_templates)
  645.  
  646. if test "$ac_cv_static_templates" = no; then
  647.  AC_MSG_CHECKING(for weak attribute)
  648.  AC_TRY_COMPILE(
  649.     [int a_w __attribute__((weak));],
  650.     [],
  651.     [AC_DEFINE(_STLP_WEAK_ATTRIBUTE) ac_cv_weak_attribute="yes"],
  652.     [ac_cv_weak_attribute="no"])
  653.  AC_MSG_RESULT($ac_cv_weak_attribute)
  654. fi
  655.  
  656. if test "$ac_cv_static_templates" = yes; then
  657. AC_MSG_CHECKING(for static array member size bug)
  658. AC_TRY_LINK(
  659.     [template <class T> struct Class { enum { sz=5 }; static int a[sz]; };
  660.      template <class T> int Class<T>::a[Class<T>::sz];],
  661.     [],
  662.     [ac_cv_static_array_bug="no"],
  663.     [AC_DEFINE(_STLP_STATIC_ARRAY_BUG) ac_cv_static_array_bug="yes"])
  664. AC_MSG_RESULT($ac_cv_static_array_bug)
  665. fi
  666.  
  667. AC_MSG_CHECKING(for static data member const initializer bug)
  668. AC_TRY_LINK(
  669.     [template <class T> struct Class { static const int a = 1; };
  670.      template <class T> const int Class<T>::a;],
  671.     [],
  672.     [ac_cv_static_init_bug="no"],
  673.     [AC_DEFINE(_STLP_STATIC_CONST_INIT_BUG) ac_cv_static_init_bug="yes"])
  674. AC_MSG_RESULT($ac_cv_static_init_bug)
  675.  
  676. AC_MSG_CHECKING(for namespaces support)
  677. AC_TRY_COMPILE(
  678.     [class test_class {};
  679.      namespace std { 
  680.       using ::test_class;
  681.       template <class T> struct Class { typedef T my_type; };
  682.       typedef Class<int>::my_type int_type;
  683.     }; 
  684.     inline int ns_foo (std::int_type t) { 
  685.       using namespace std; 
  686.       int_type i =2;
  687.       return i+t; 
  688.     } 
  689.      ],
  690.     [(void)ns_foo(1);],
  691.     [_TEST_STD="std"  _TEST_STD_BEGIN="namespace $_TEST_STD" _TEST_STD_END="namespace $_TEST_STD" ac_cv_namespaces="yes"],
  692.     [AC_DEFINE(_STLP_HAS_NO_NAMESPACES) _TEST_STD="" _TEST_STD_BEGIN="" _TEST_STD_END="" ac_cv_namespaces="no"])
  693. AC_MSG_RESULT($ac_cv_namespaces)
  694.  
  695. AC_MSG_CHECKING(for broken "using" directive)
  696. AC_TRY_COMPILE(
  697.     [namespace std { 
  698.       template <class T> struct Class { typedef T my_type; };
  699.       typedef Class<int>::my_type int_type;
  700.       template <class T> void foo(T,int) {}
  701.       template <class T> void foo(T,int,int) {}
  702.     }; 
  703.      using std::Class;
  704.      using std::foo;
  705.      ],
  706.     [(void)foo(1,1);],
  707.     [ac_cv_broken_using="no"],
  708.     [ac_cv_broken_using="yes"])
  709. if test "$ac_cv_broken_using" = no; then
  710. # check if no warnings have been issued
  711.   if `check_warning` ; then
  712.     ac_cv_broken_using=no
  713.   else
  714.    AC_DEFINE(_STLP_BROKEN_USING_DIRECTIVE)
  715.   fi
  716. else
  717.    AC_DEFINE(_STLP_BROKEN_USING_DIRECTIVE)
  718. fi
  719. AC_MSG_RESULT($ac_cv_broken_using)
  720.  
  721.  
  722. if test "$ac_cv_namespaces" = yes; then
  723. AC_ARG_ENABLE(namespaces,[--enable-namespaces Use namespaces (default if posssible)
  724. --disable-namespaces Don't use namespaces support],
  725. [
  726. case "$enableval" in
  727.     no) AC_DEFINE(_STLP_NO_NAMESPACES) 
  728.             _TEST_STD="" 
  729.             _TEST_STD_BEGIN=""
  730.             _TEST_STD_END=""
  731.             AC_MSG_RESULT(Config arg --disable-namespaces : code not put into namespace by user request);;
  732.      *) AC_MSG_RESULT(Config default: code put into namespace)
  733. esac
  734. ],
  735. [AC_MSG_RESULT(Config default: code put into namespace)]
  736. )
  737. else
  738.  AC_MSG_RESULT(Compiler restriction : no namespaces support used)
  739. fi
  740.  
  741.  
  742. AC_MSG_CHECKING(for exceptions support)
  743. AC_TRY_COMPILE(
  744.     [int ex_foo() { 
  745.        try { 
  746.          try { throw(1); } 
  747.          catch (int a) { throw; } 
  748.        } catch (...) {;} 
  749.       return 0;
  750.     }],
  751.     [(void)ex_foo();],
  752.     [ac_cv_exceptions="yes"],
  753.     [AC_DEFINE(_STLP_HAS_NO_EXCEPTIONS) ac_cv_exceptions="no"])
  754. AC_MSG_RESULT($ac_cv_exceptions)
  755.  
  756. if test "$ac_cv_exceptions" = yes; then
  757.  
  758. AC_MSG_CHECKING(if exceptions specification works)
  759. AC_TRY_COMPILE(
  760.     [template <class T> inline int ex_spec_foo(const T&) throw () { return 0;} ], 
  761.     [(void)ex_spec_foo(5);],
  762.     [ac_cv_exception_spec="yes"],
  763.     [AC_DEFINE(_STLP_NO_EXCEPTION_SPEC) ac_cv_exception_spec="no"])
  764. dnl    if test "$ac_cv_exception_spec" = yes; then
  765. dnl    # check if no warnings have been issued
  766. dnl     if `check_warning` ; then
  767. dnl       AC_DEFINE(_STLP_EXCEPTION_SPEC)
  768. dnl     else
  769. dnl      ac_cv_exception_spec=no
  770. dnl      fi
  771. dnl    fi
  772. AC_MSG_RESULT($ac_cv_exception_spec)
  773.  
  774. AC_MSG_CHECKING(if return is required after throw)
  775. AC_TRY_COMPILE(
  776.     [int ex_foo() { 
  777.        try { 
  778.          try { throw(1); } 
  779.          catch (int a) { throw; } 
  780.        } catch (...) {;} 
  781.       return 0;
  782.     }],
  783.     [(void)ex_foo();],
  784.     [ac_cv_throw_return_bug="no"],
  785.     [AC_DEFINE(_STLP_THROW_RETURN_BUG) ac_cv_throw_return_bug="yes"])
  786.  
  787.     if test "$ac_cv_throw_return_bug" = no; then
  788.     # check if no warnings have been issued
  789.      if `check_warning` ; then
  790.        ac_cv_throw_return_bug="no"
  791.      else
  792.        AC_DEFINE(_STLP_THROW_RETURN_BUG)
  793.        ac_cv_throw_return_bug="yes"
  794.      fi
  795.     fi
  796. AC_MSG_RESULT($ac_cv_throw_return_bug)
  797.  
  798. fi
  799.  
  800. AC_MSG_CHECKING(for native <string> header with basic_string defined )
  801. AC_TRY_COMPILE(
  802.     [
  803.      #include <string>
  804.      # if !defined (_STLP_HAS_NO_NAMESPACES)
  805.        using namespace $_TEST_STD;
  806.      # endif
  807.      basic_string<char, char_traits<char>, allocator<char> > bs;
  808.      string bd = bs;
  809.     ],
  810.     [],
  811.     [ ac_cv_string_header="yes"],
  812.     [ AC_DEFINE(_STLP_NO_STRING_HEADER) ac_cv_string_header="no"]
  813. )
  814. AC_MSG_RESULT($ac_cv_string_header)
  815.  
  816. dnl there could be no correct stdexcept/iostream  without string
  817. if test "$ac_cv_string_header" = yes; then
  818. AC_MSG_CHECKING(for native <stdexcept> header)
  819. AC_TRY_COMPILE(
  820.     [
  821.      #include <stdexcept>
  822.      # if !defined (_STLP_HAS_NO_NAMESPACES)
  823.        using namespace $_TEST_STD;
  824.      # endif
  825.      string s;
  826.      logic_error le(s);
  827.      runtime_error re(s);
  828.      domain_error de(s);
  829.      invalid_argument ia(s);
  830.      length_error lne(s);
  831.      out_of_range or(s);
  832.      range_error rne(s);
  833.      overflow_error ove(s);
  834.      underflow_error ue(s);
  835.     ],
  836.     [],
  837.     [ac_cv_stdexcept_header="yes"],
  838.     [AC_DEFINE(_STLP_NO_STDEXCEPT_HEADER) ac_cv_stdexcept_header="no"]
  839. )
  840. AC_MSG_RESULT($ac_cv_stdexcept_header)
  841.  
  842. AC_MSG_CHECKING(for new iostreams)
  843. AC_TRY_COMPILE(
  844.     [
  845.      #include <iosfwd>
  846.      #include <iostream>
  847.      # if !defined (_STLP_HAS_NO_NAMESPACES)
  848.        using namespace $_TEST_STD;
  849.      # endif
  850.  
  851.      template <class _Tp, class _Traits>
  852.      void outp(basic_ostream<_Tp,_Traits>& o, char* str) {
  853.          o<<str; 
  854.         }
  855.        ],
  856.     [
  857.     outp(cout, "Hello World\n")
  858.     ],
  859.     [ac_cv_newstreams="yes"],
  860.     [AC_DEFINE(_STLP_HAS_NO_NEW_IOSTREAMS) ac_cv_newstreams="no"])
  861. AC_MSG_RESULT($ac_cv_newstreams)
  862.  
  863. dnl end namespace-related tests
  864.  
  865. fi
  866.  
  867. AC_MSG_CHECKING(for <exception> header with class "exception" defined)
  868. AC_TRY_COMPILE(
  869.     [
  870.      #include <exception>
  871.      # if !defined (_STLP_HAS_NO_NAMESPACES)
  872.        using namespace $_TEST_STD;
  873.      # endif
  874.      class my_exception: public $_TEST_STD::exception {};
  875.      my_exception mm;
  876.     ],
  877.     [],
  878.     [ac_cv_exception_header="yes"],
  879.     [AC_DEFINE(_STLP_NO_EXCEPTION_HEADER) ac_cv_exception_header="no"]
  880. )
  881. AC_MSG_RESULT($ac_cv_exception_header)
  882.  
  883. AC_MSG_CHECKING(builtin constructor bug)
  884. AC_TRY_RUN( [
  885. # ifdef _STLP_USE_NEW_STYLE_HEADERS
  886. #  include <cassert>
  887. #  include <cstdio>
  888. #  include <cstring>
  889. #  include <new>
  890. # else
  891. #  include <assert.h>
  892. #  include <stdio.h>
  893. #  include <string.h>
  894. #  include <new.h>
  895. # endif
  896. int main(int, char**) {
  897.     int i;
  898.     double buf[1000];
  899.     char* pc = (char*)buf;
  900.     short* ps = (short*)buf;
  901.     int* pi = (int*)buf;
  902.     long* pl = (long*)buf;
  903.     double* pd = (double*)buf;
  904.     float* pf = (float*)buf;
  905.     for (i=0; i<100; i++) {
  906.            new(pc) char();
  907.             assert(char()==0 && *pc==0);
  908.         sprintf(pc,"lalala\n");
  909.             new (ps) short();    
  910.         assert(short()==0 && *ps ==0);
  911.         sprintf(pc,"lalala\n");
  912.             new (pi) int();
  913.         assert(int()==0 && *pi == 0);
  914.         sprintf(pc,"lalala\n");
  915.             new (pl) long();    
  916.         assert(long()==0 && *pl == 0);
  917.         sprintf(pc,"lalala\n");
  918.             new (pf) float();    
  919.         assert(float()==0.0 && *pf == 0.0);
  920.         sprintf(pc,"lalala\n");
  921.             new (pd) double();    
  922.         assert(double()==0.0 && *pd == 0.0);
  923.         sprintf(pc,"lalala\n");
  924.     }
  925.   return 0;
  926. }
  927. ], 
  928. [ ac_cv_builtin_c_bug="no"],
  929. [ AC_DEFINE(_STLP_DEFAULT_CONSTRUCTOR_BUG) ac_cv_builtin_c_bug="yes"],
  930. [ AC_DEFINE(_STLP_DEFAULT_CONSTRUCTOR_BUG) ac_cv_builtin_c_bug="yes"]
  931. )
  932. AC_MSG_RESULT($ac_cv_builtin_c_bug)
  933.  
  934. AC_MSG_CHECKING(for trivial constructor bug)
  935. AC_TRY_LINK(
  936.     [struct output_iterator_tag {};
  937.      void tc_bug_foo(output_iterator_tag) {}
  938.      inline void tc_test_foo()  { tc_bug_foo(output_iterator_tag()); }],
  939.     [tc_test_foo();],
  940.     [ac_cv_tc_bug="no"],
  941.     [AC_DEFINE(_STLP_TRIVIAL_CONSTRUCTOR_BUG) ac_cv_tc_bug="yes"])
  942. AC_MSG_RESULT($ac_cv_tc_bug)
  943.  
  944. AC_MSG_CHECKING(for trivial destructor bug)
  945. AC_TRY_LINK(
  946.     [struct output_iterator_tag {output_iterator_tag() {} };
  947.     output_iterator_tag* td_bug_bar ;
  948.     ],
  949.     [ td_bug_bar->~output_iterator_tag();
  950.      ],
  951.     [ac_cv_td_bug="no"],
  952.     [AC_DEFINE(_STLP_TRIVIAL_DESTRUCTOR_BUG) ac_cv_td_bug="yes"])
  953. AC_MSG_RESULT($ac_cv_td_bug)
  954.  
  955. AC_MSG_CHECKING(for explicit function template arguments)
  956. AC_TRY_LINK(
  957.     [  template <class T> class foo;
  958.        template<class T> bool operator==(const foo<T>& lhs,const foo<T>& rhs);
  959.       template <class T> class foo {
  960.     private:
  961.       T bar;
  962.     friend bool operator== <> (const foo<T>&,const foo<T>&);
  963.      };
  964.      template<class T> bool operator==(const foo<T>& lhs,const foo<T>& rhs) {
  965.     return  lhs.bar==rhs.bar;
  966.      }],
  967.     [ foo<int> f1, f2;
  968.       int ret= (f1==f2) ],
  969.     [ _NULLARGS="<>" ac_cv_expl_fun_args="yes"],
  970.     [ AC_DEFINE(_STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS) ac_cv_expl_fun_args="no" _NULLARGS=""])
  971. AC_MSG_RESULT($ac_cv_expl_fun_args)
  972.  
  973. AC_MSG_CHECKING(for template parameter baseclass matching)
  974. AC_TRY_LINK(
  975.     [struct output_iterator_tag {};
  976.      struct derived1_tag : public output_iterator_tag {};
  977.      struct derived2_tag : public derived1_tag {};
  978.      template<class T> struct output_iterator { 
  979.     public:
  980.     output_iterator() {} 
  981.     ~output_iterator() {} 
  982.     friend inline int operator== $_NULLARGS (const output_iterator<T>&, 
  983.                                       const output_iterator<T>&);
  984.     };
  985.      template<class T> inline int operator==(const output_iterator<T>&, 
  986.                                           const output_iterator<T>&) {
  987.        return 0;
  988.      }
  989.      template<class T> inline output_iterator_tag
  990.      iterator_category(const output_iterator<T>&) {return output_iterator_tag();}
  991.      template <class T>
  992.      struct derived_iterator : public output_iterator<T> {
  993.     public:
  994.     derived_iterator() {} 
  995.     ~derived_iterator() {}
  996.     };
  997.      template<class T> inline T select_foo(T t, output_iterator_tag) { return t;}     
  998.      template<class T> inline int select_foo_2(T, T,
  999.                                              output_iterator_tag) { return 0;}     
  1000.      template<class T> inline T tbase_foo(T pm )  { 
  1001.     derived_iterator<T> di1, di2; int i( di1==di2 && pm);
  1002.     return select_foo((int)1,iterator_category(derived_iterator<T>())); 
  1003.     }
  1004.     ],
  1005.     [ (void)tbase_foo((int)1); ],
  1006.     [ac_cv_base_match="yes"],
  1007.     [AC_DEFINE(_STLP_BASE_MATCH_BUG) ac_cv_base_match="no"])
  1008. AC_MSG_RESULT($ac_cv_base_match)
  1009.  
  1010. AC_MSG_CHECKING(for non-template parameter baseclass matching )
  1011. AC_TRY_LINK(
  1012.     [struct output_iterator_tag {};
  1013.      struct derived1_tag : public output_iterator_tag {};
  1014.      struct derived2_tag : public derived1_tag {};
  1015.      struct derived3_tag : public derived2_tag {};
  1016.      template<class T> struct output_iterator { 
  1017.     public:
  1018.     output_iterator() {} 
  1019.     ~output_iterator() {} 
  1020.     };
  1021.      template<class T> inline output_iterator_tag
  1022.      iterator_category(const output_iterator<T>&) {return output_iterator_tag();}
  1023.      template <class T>
  1024.      struct derived_iterator : public output_iterator<T> {
  1025.     public:
  1026.     derived_iterator() {} 
  1027.     ~derived_iterator() {}
  1028.     };
  1029.      template<class T> inline int select_foo_2(T, T,
  1030.                                              output_iterator_tag) { return 0;}     
  1031.      template<class T> inline int select_foo_2(T, T,
  1032.                                              derived1_tag) { return 0;}     
  1033.      template<class T> inline void nont_base_foo(T pm )  { 
  1034.     derived_iterator<T> di1, di2; 
  1035.     (void)select_foo_2(di1, (const derived_iterator<T>&)di2, derived3_tag());
  1036.     }
  1037.     ],
  1038.     [ nont_base_foo((int)1); ],
  1039.     [ac_cv_nont_base_match="yes"],
  1040.     [AC_DEFINE(_STLP_NONTEMPL_BASE_MATCH_BUG) ac_cv_nont_base_match="no"])
  1041. AC_MSG_RESULT($ac_cv_nont_base_match)
  1042.  
  1043. AC_MSG_CHECKING(for nested type parameters bug)
  1044. AC_TRY_LINK(
  1045.     [template<class T> struct nt_o { typedef int ii; inline ii foo(ii);};
  1046.      template <class T> inline nt_o<T>::ii nt_o<T>::foo(ii) { return 0; }],
  1047.     [],
  1048.     [ac_cv_nested_type_param_bug="no"],
  1049.     [AC_DEFINE(_STLP_NESTED_TYPE_PARAM_BUG) ac_cv_nested_type_param_bug="yes"])
  1050. AC_MSG_RESULT($ac_cv_nested_type_param_bug)
  1051.  
  1052.  
  1053. AC_MSG_CHECKING(if inherited template typedefs broken completely)
  1054. AC_TRY_LINK(
  1055.     [
  1056. template <class Arg1, class Arg2, class Result>
  1057. struct binary_function {
  1058.     typedef Arg1 first_argument_type;
  1059.     typedef Arg2 second_argument_type;
  1060.     typedef Result result_type;
  1061. };     
  1062.  
  1063. template <class T>
  1064. struct equal_to : public binary_function<T, T, int> {
  1065.     int operator()(const T& x, const T& y) const { return x == y; }
  1066. };
  1067.  
  1068. template <class Predicate> 
  1069. class binary_negate 
  1070.     : public binary_function<$__TYPENAME Predicate::first_argument_type,
  1071.                  $__TYPENAME Predicate::second_argument_type, 
  1072.                              int> {
  1073. protected:
  1074.     Predicate pred;
  1075. public:
  1076.     binary_negate(const Predicate& x = Predicate()) : pred(x) {}
  1077.     int operator() (const $__TYPENAME Predicate::first_argument_type& x, 
  1078.             const $__TYPENAME Predicate::second_argument_type& y) const {
  1079.     return !pred(x, y); 
  1080.     }
  1081. };
  1082.       typedef equal_to<int> eq_int;
  1083.       typedef binary_negate<equal_to<int> > int_negate;
  1084.       int_negate n;
  1085.  ],
  1086.     [
  1087.       (void)n(1,2);
  1088.     ],
  1089.     [ac_cv_typebug="no"],
  1090.     [AC_DEFINE(_STLP_BASE_TYPEDEF_BUG) 
  1091.      AC_DEFINE(_STLP_BASE_TYPEDEF_OUTSIDE_BUG) ac_cv_typebug="yes"])
  1092. AC_MSG_RESULT($ac_cv_typebug)
  1093.  
  1094. AC_MSG_CHECKING(if inherited typedefs visible from outside)
  1095. AC_TRY_COMPILE(
  1096.     [
  1097. template <class Arg1, class Arg2, class Result>
  1098. struct binary_function {
  1099.     typedef Arg1 first_argument_type;
  1100.     typedef Arg1 second_argument_type;
  1101.     typedef Result result_type;
  1102. };     
  1103.  
  1104.  
  1105. template <class T>
  1106. class plus : public binary_function<T, T, T> {
  1107. public:
  1108.     plus() {}
  1109.     plus(const T&) {}
  1110.     T operator()(const T& x, const T& y) const { return x + y; };
  1111. };
  1112.  
  1113. plus<int> p;
  1114. plus<int>::first_argument_type a;
  1115. ],
  1116.     [],
  1117.     [ac_cv_outside_typedef="yes"],
  1118.     [AC_DEFINE(_STLP_BASE_TYPEDEF_OUTSIDE_BUG) ac_cv_outside_typedef="no"])
  1119. AC_MSG_RESULT($ac_cv_outside_typedef)
  1120.  
  1121. # fi
  1122.  
  1123. AC_MSG_CHECKING(if private type static members initializable)
  1124. AC_TRY_COMPILE(
  1125.     [struct p_Class { private: struct str_ { 
  1126.     int a; str_(int i) : a(i) {}}; static str_ my_int; 
  1127.      };
  1128.      p_Class::str_ p_Class::my_int(0); 
  1129.      ],
  1130.     [],
  1131.     [ac_cv_private="yes"],
  1132.     [AC_DEFINE(_STLP_UNINITIALIZABLE_PRIVATE) ac_cv_private="no"])
  1133. AC_MSG_RESULT($ac_cv_private)
  1134.  
  1135.  
  1136. AC_MSG_CHECKING(for const member constructor bug)
  1137. AC_TRY_LINK([
  1138. template <class T1, class T2>
  1139. struct pair {
  1140.     T1 first;
  1141.     T2 second;
  1142.     pair(): first(T1()), second(T2()) {}
  1143.     pair(const pair<T1,T2>& o) : first(o.first), second(o.second) {}
  1144. };
  1145. pair< const int, const int > p;  
  1146.      ],
  1147.     [],
  1148.     [ac_cv_const_constructor_bug="no"],
  1149.     [AC_DEFINE(_STLP_CONST_CONSTRUCTOR_BUG) ac_cv_const_constructor_bug="yes"])
  1150. AC_MSG_RESULT($ac_cv_const_constructor_bug)
  1151.  
  1152. AC_MSG_CHECKING(for loop inline problems)
  1153. AC_TRY_COMPILE(
  1154.     [inline int il_foo (int a) { 
  1155.       int i; for (i=0; i<a; i++) a+=a;  while (i>0) a-=3; return a; }],
  1156.     [(void)il_foo(2);],
  1157.     [ac_cv_inline_problems="no"],
  1158.     [AC_DEFINE(_STLP_LOOP_INLINE_PROBLEMS) ac_cv_inline_problems="yes"])
  1159. if test "$ac_cv_inline_problems" = no; then
  1160. # check if no warnings have been issued
  1161.   if `check_warning` ; then
  1162.      ac_cv_inline_problems="no"
  1163.   else
  1164.    AC_DEFINE(_STLP_LOOP_INLINE_PROBLEMS)
  1165.    ac_cv_inline_problems="yes"
  1166.   fi
  1167. fi
  1168. AC_MSG_RESULT($ac_cv_inline_problems)
  1169.  
  1170.  
  1171. AC_MSG_CHECKING(if arrow operator always get instantiated)
  1172. AC_TRY_LINK(
  1173.     [
  1174.      template <class T> struct um_foo { T* ptr; 
  1175.     T* operator ->() { return &(operator*());}
  1176.     T  operator *()  { return *ptr; }
  1177.      };
  1178.      template <class T>
  1179.     int operator == ( const um_foo<T>& x, const um_foo<T>& y)
  1180.     {
  1181.             return *x == *y;
  1182.     }
  1183.      struct um_tag { int a ; };
  1184.      um_foo<um_tag> f;
  1185.      um_foo<int> a;
  1186.      ],
  1187.     [ 
  1188.      int b(5); a.ptr=&b;],
  1189.     [ac_cv_unused_required="no"],
  1190.     [AC_DEFINE(_STPL_NO_ARROW_OPERATOR) ac_cv_unused_required="yes"]
  1191.     )
  1192. AC_MSG_RESULT($ac_cv_unused_required)
  1193.  
  1194. AC_MSG_CHECKING(for pointer-to-member parameter bug)
  1195. AC_TRY_COMPILE(
  1196.     [
  1197. struct pmf_foo {
  1198.     int bar() { return 0; };
  1199. };
  1200.  
  1201. template <class Class, class Result> 
  1202. class mem_fun_t {
  1203. protected:
  1204.     typedef Result (Class::*fun_type)(void);
  1205.     fun_type ptr;
  1206. public:
  1207.     mem_fun_t() {}
  1208.     mem_fun_t(fun_type p) : ptr(p) {}
  1209.     Result operator()(Class* x) const { return (x->*ptr)();}
  1210. };
  1211.  
  1212. template <class Class, class Result>
  1213. inline mem_fun_t <Class, Result> 
  1214. mem_fun(Result (Class::*ptr)(void)) {
  1215.     return mem_fun_t<Class, Result>(ptr);
  1216. }
  1217. ],
  1218.     [pmf_foo pmf; (void)mem_fun(&pmf_foo::bar)(&pmf)],
  1219.     [ac_cv_pmf_bug="no"],
  1220.     [AC_DEFINE( _STLP_MEMBER_POINTER_PARAM_BUG) ac_cv_pmf_bug="yes"])
  1221. AC_MSG_RESULT($ac_cv_pmf_bug)
  1222.  
  1223. AC_MSG_CHECKING(if bad_alloc defined in <new>)
  1224. AC_TRY_COMPILE(
  1225.     [
  1226.      #if !defined (_STLP_NO_NEW_STYLE_HEADERS)
  1227.      #include <new>
  1228.      #else
  1229.      #include <new.h>
  1230.      #endif
  1231.  
  1232.      # if !defined (_STLP_HAS_NO_NAMESPACES)
  1233.        using namespace $_TEST_STD;
  1234.      # endif
  1235.  
  1236.      bad_alloc badalloc_foo() { bad_alloc err; return err;}],
  1237.     [(void)badalloc_foo()],
  1238.     [ac_cv_bad_alloc="yes"],
  1239.     [AC_DEFINE(_STLP_NO_BAD_ALLOC) ac_cv_bad_alloc="no"])
  1240. AC_MSG_RESULT($ac_cv_bad_alloc)
  1241.  
  1242. AC_MSG_CHECKING(for __type_traits automatic specialization)
  1243. AC_TRY_LINK(
  1244.     [template <class T> int tt_foo(const T&) {
  1245.     typedef __type_traits<T> traits;
  1246.     return 0;
  1247.      }],
  1248.     [(void)tt_foo(5)],
  1249.     [AC_DEFINE(_STLP_AUTOMATIC_TYPE_TRAITS) ac_cv_type_traits="yes"],
  1250.     [ac_cv_type_traits="no"])
  1251. AC_MSG_RESULT($ac_cv_type_traits)
  1252.  
  1253.  
  1254. # package options - exceptions
  1255. AC_MSG_RESULT(***)
  1256. AC_MSG_RESULT($0: Setting implementation options...)
  1257. AC_MSG_RESULT(***)
  1258.  
  1259. if test "$ac_cv_exceptions" = yes; then
  1260. AC_ARG_ENABLE(exceptions,[--enable-exceptions Use exceptions support (default if posssible)
  1261.  --disable-exceptions Don't use exceptions support],
  1262. [
  1263. case "$enableval" in
  1264.            no) AC_DEFINE(_STLP_NO_EXCEPTIONS)
  1265.                AC_MSG_RESULT(Config arg --disable-exceptions : disabling exceptions by user request);;
  1266.            *)  AC_MSG_RESULT(Config default: exceptions enabled)
  1267. esac
  1268. ],
  1269. [AC_MSG_RESULT(Config default: exceptions enabled) ]
  1270. )
  1271. else
  1272.  AC_MSG_RESULT(Compiler restriction : no exceptions support used)
  1273. fi
  1274.  
  1275. if test "$ac_cv_namespaces" = yes; then
  1276. AC_ARG_ENABLE(relops,[--enable-relops Separate rel_ops namespace for relational operators (default if posssible)
  1277. --disable-relops No separate rel_ops namespace for relational operators],
  1278. [
  1279. case "$enableval" in
  1280.     no) AC_DEFINE(_STLP_NO_RELOPS_NAMESPACE) 
  1281.             AC_MSG_RESULT(Config arg --disable-relops : no std::rel_ops namespace by user request);;
  1282.      *) AC_MSG_RESULT(Config default: Separate std::rel_ops namespace for relational operators)
  1283. esac
  1284. ],
  1285. [AC_MSG_RESULT(Config default: Separate std::rel_ops namespace for relational operators)]
  1286. )
  1287. else
  1288.  AC_DEFINE(_STLP_NO_RELOPS_NAMESPACE) 
  1289. fi
  1290.  
  1291. if test "$ac_cv_newheaders" = yes; then
  1292. AC_ARG_ENABLE(new-style-headers,[--enable-new-style-headers Use new-style headers (default)
  1293. --disable-new-style-headers Don't use new-style headers],
  1294. [
  1295. case "$enableval" in
  1296.     no) AC_DEFINE(_STLP_NO_NEW_STYLE_HEADERS) 
  1297.             AC_MSG_RESULT(Config arg --disable-new-style-headers : not using new-style headers);;
  1298.      *) AC_MSG_RESULT(Config default: using new-style headers)
  1299. esac
  1300. ],
  1301. [AC_MSG_RESULT(Config default: using new-style headers)]
  1302. )
  1303. else
  1304.  AC_DEFINE(_STLP_NO_NEW_STYLE_HEADERS)
  1305. fi
  1306.  
  1307. if test "$ac_cv_newstreams" = yes; then
  1308. AC_ARG_ENABLE(new-iostreams,[--enable-new-iostreams Use new iostreams (default)
  1309. --disable-new-iostreams Don't use new iostreams],
  1310. [
  1311. case "$enableval" in
  1312.     no) AC_DEFINE(_STLP_NO_NEW_IOSTREAMS) 
  1313.             AC_MSG_RESULT(Config arg --disable-new-iostreams : not using new iostreams);;
  1314.      *) AC_MSG_RESULT(Config default: using new iostreams)
  1315. esac
  1316. ],
  1317. [AC_MSG_RESULT(Config default: using new iostreams)]
  1318. )
  1319. else
  1320.   AC_DEFINE(_STLP_NO_NEW_IOSTREAMS)
  1321. fi
  1322.  
  1323. AC_ARG_ENABLE(sgi-allocators,[--enable-sgi-allocators : set default parameter to SGI-style default alloc, not allocator<T>
  1324.  --disable-sgi-allocators : use allocator<T> if possible],
  1325. [
  1326. case "$enableval" in
  1327.       yes ) AC_MSG_RESULT(Config arg  --enable-sgi-allocators : SGI-style alloc as default allocator) 
  1328.                 AC_DEFINE(_STLP_USE_RAW_SGI_ALLOCATORS);;
  1329.         * ) AC_MSG_RESULT(Config default: using allocator<T> as default allocator if possible )
  1330. esac
  1331. ],
  1332. [
  1333.  AC_MSG_RESULT(Config default: using allocator<T> as default allocator if possible)
  1334. ]
  1335. )
  1336.  
  1337. AC_ARG_ENABLE(malloc,[--enable-malloc : set default alloc to malloc-based allocator ( malloc_alloc_template<instance_no>, alloc.h )
  1338. --disable-malloc : choose (default) sgi node allocator (__alloc<threads,no>  alloc.h )],
  1339. [
  1340. case "$enableval" in
  1341.       yes ) AC_MSG_RESULT(Config arg  --enable-malloc : setting malloc_alloc as default alloc) 
  1342.                 AC_DEFINE(_STLP_USE_MALLOC);;
  1343.         * ) AC_MSG_RESULT(Config default: not using malloc_alloc as default alloc)
  1344. esac
  1345. ],
  1346. [
  1347.  AC_MSG_RESULT(Config default: not using malloc_alloc as default alloc)
  1348. ]
  1349. )
  1350.  
  1351. AC_ARG_ENABLE(newalloc,[--enable-newalloc : set default alloc to new-based allocator ( new_alloc, alloc.h )
  1352. --disable-newalloc : choose (default) sgi allocator (__alloc<threads,no>  alloc.h )],
  1353. [
  1354. case "$enableval" in
  1355.       yes ) AC_MSG_RESULT(Config arg  --enable-newalloc : setting new_alloc as default alloc) 
  1356.                 AC_DEFINE(_STLP_USE_NEWALLOC);;
  1357.         * )
  1358.                 AC_MSG_RESULT(Config default: not using new_alloc as default alloc)
  1359. esac
  1360. ],
  1361. [
  1362.  AC_MSG_RESULT(Config default: not using new_alloc as default alloc)
  1363. ]
  1364. )
  1365.  
  1366. AC_ARG_ENABLE(defalloc,[--enable-defalloc : make HP-style defalloc.h included in alloc.h )
  1367. --disable-defalloc : leave defalloc.h alone],
  1368. [
  1369. case "$enableval" in
  1370.       no ) AC_MSG_RESULT(Config arg --disable-defalloc : not including HP-style defalloc.h into alloc.h);;
  1371.  
  1372.       * ) AC_MSG_RESULT(Config default : including HP-style defalloc.h into alloc.h) 
  1373.                 AC_DEFINE(_STLP_USE_DEFALLOC)
  1374. esac
  1375. ],
  1376. [
  1377.           AC_MSG_RESULT(Config default : not including HP-style defalloc.h into alloc.h)
  1378. ]
  1379. )
  1380.  
  1381.  
  1382. AC_ARG_ENABLE(debugalloc,[--enable-debugalloc : use debug versions of allocators
  1383. --disable-debugalloc : not using debug allocators],
  1384. [
  1385. case "$enableval" in
  1386.       yes ) AC_MSG_RESULT(Config arg --enable-debugalloc : use debug versions of allocators ) 
  1387.                 AC_DEFINE(_STLP_DEBUG_ALLOC);;
  1388.       * )
  1389.           AC_MSG_RESULT(Config default : not using debug allocators)
  1390. esac
  1391. ],
  1392. [
  1393.           AC_MSG_RESULT(Config default : not using debug allocators)
  1394. ]
  1395. )
  1396.  
  1397.  
  1398. AC_ARG_ENABLE(abbrevs,[--enable-abbrevs : use abbreviated class names internally for linker benefit (don't affect interface)
  1399. --disable-abbrevs : don't use abbreviated names],
  1400. [
  1401. case "$enableval" in
  1402.       yes ) AC_MSG_RESULT(Config arg --enable-abbrevs : using abbreviated class names internally) 
  1403.                 AC_DEFINE(_STLP_USE_ABBREVS);;
  1404.       * )
  1405.           AC_MSG_RESULT(Config default : not using abbreviated class names internally)
  1406. esac
  1407. ],
  1408. [
  1409.           AC_MSG_RESULT(Config default : not using abbreviated class names internally)
  1410. ]
  1411. )
  1412.  
  1413.  
  1414. AC_DEFINE(__AUTO_CONFIGURED)
  1415.  
  1416. AC_MSG_RESULT(***)
  1417. AC_MSG_RESULT($0: setting up headers...)
  1418. AC_MSG_RESULT(***)
  1419. AC_OUTPUT(stlconf.h)
  1420. AC_MSG_RESULT(***)
  1421. AC_MSG_RESULT($0: STLport configured for use with \"${CXX}\" compiler, CXXFLAGS used: \"${CXXFLAGS}\".)
  1422. AC_MSG_RESULT($0: To restore original settings - run \"./unconfigure\" or copy stlconf.h.in to stlconf.h.)
  1423. AC_MSG_RESULT(***)
  1424.  
  1425.