-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathacinclude.m4
1364 lines (1360 loc) · 46.1 KB
/
acinclude.m4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
dnl @synopsis AC_CXX_BOOL
dnl
dnl If the compiler recognizes bool as a separate built-in type,
dnl define HAVE_BOOL. Note that a typedef is not a separate
dnl type since you cannot overload a function such that it accepts either
dnl the basic type or the typedef.
dnl
dnl @version $Id: ac_cxx_bool.m4,v 1.2 2000/07/19 13:03:28 simons Exp $
dnl @author Luc Maisonobe
dnl
AC_DEFUN([AC_CXX_BOOL],
[AC_CACHE_CHECK(whether the compiler recognizes bool as a built-in type,
ac_cv_cxx_bool,
[AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_COMPILE([
int f(int x){return 1;}
int f(char x){return 1;}
int f(bool x){return 1;}
],[bool b = true; return f(b);],
ac_cv_cxx_bool=yes, ac_cv_cxx_bool=no)
AC_LANG_RESTORE
])
if test "$ac_cv_cxx_bool" = yes; then
AC_DEFINE(HAVE_BOOL,,[define if bool is a built-in type])
fi
])
dnl @synopsis AC_CXX_COMPLEX_MATH_IN_NAMESPACE_STD
dnl
dnl If the C math functions are in the cmath header file and std:: namespace,
dnl define HAVE_MATH_FN_IN_NAMESPACE_STD.
dnl
dnl @version $Id: ac_cxx_complex_math_in_namespace_std.m4,v 1.2 2000/07/19 13:03:28 simons Exp $
dnl @author Luc Maisonobe
dnl
AC_DEFUN([AC_CXX_COMPLEX_MATH_IN_NAMESPACE_STD],
[AC_CACHE_CHECK(whether complex math functions are in std::,
ac_cv_cxx_complex_math_in_namespace_std,
[AC_REQUIRE([AC_CXX_NAMESPACES])
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_COMPILE([#include <complex>
namespace S { using namespace std;
complex<float> pow(complex<float> x, complex<float> y)
{ return std::pow(x,y); }
};
],[using namespace S; complex<float> x = 1.0, y = 1.0; S::pow(x,y); return 0;],
ac_cv_cxx_complex_math_in_namespace_std=yes, ac_cv_cxx_complex_math_in_namespace_std=no)
AC_LANG_RESTORE
])
if test "$ac_cv_cxx_complex_math_in_namespace_std" = yes; then
AC_DEFINE(HAVE_COMPLEX_MATH_IN_NAMESPACE_STD,,
[define if complex math functions are in std::])
fi
])
dnl @synopsis AC_CXX_CONST_CAST
dnl
dnl If the compiler supports const_cast<>, define HAVE_CONST_CAST.
dnl
dnl @version $Id: ac_cxx_const_cast.m4,v 1.2 2000/07/19 13:03:28 simons Exp $
dnl @author Luc Maisonobe
dnl
AC_DEFUN([AC_CXX_CONST_CAST],
[AC_CACHE_CHECK(whether the compiler supports const_cast<>,
ac_cv_cxx_const_cast,
[AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_COMPILE(,[int x = 0;const int& y = x;int& z = const_cast<int&>(y);return z;],
ac_cv_cxx_const_cast=yes, ac_cv_cxx_const_cast=no)
AC_LANG_RESTORE
])
if test "$ac_cv_cxx_const_cast" = yes; then
AC_DEFINE(HAVE_CONST_CAST,,[define if the compiler supports const_cast<>])
fi
])
dnl @synopsis AC_CXX_DEFAULT_TEMPLATE_PARAMETERS
dnl
dnl If the compiler supports default template parameters,
dnl define HAVE_DEFAULT_TEMPLATE_PARAMETERS.
dnl
dnl @version $Id: ac_cxx_default_template_parameters.m4,v 1.2 2000/07/19 13:03:28 simons Exp $
dnl @author Luc Maisonobe
dnl
AC_DEFUN([AC_CXX_DEFAULT_TEMPLATE_PARAMETERS],
[AC_CACHE_CHECK(whether the compiler supports default template parameters,
ac_cv_cxx_default_template_parameters,
[AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_COMPILE([
template<class T = double, int N = 10> class A {public: int f() {return 0;}};
],[A<float> a; return a.f();],
ac_cv_cxx_default_template_parameters=yes, ac_cv_cxx_default_template_parameters=no)
AC_LANG_RESTORE
])
if test "$ac_cv_cxx_default_template_parameters" = yes; then
AC_DEFINE(HAVE_DEFAULT_TEMPLATE_PARAMETERS,,
[define if the compiler supports default template parameters])
fi
])
dnl @synopsis AC_CXX_DTOR_AFTER_ATEXIT
dnl
dnl If the C++ compiler calls global destructors after atexit functions,
dnl define HAVE_DTOR_AFTER_ATEXIT.
dnl WARNING: If cross-compiling, the test cannot be performed, the
dnl default action is to define HAVE_DTOR_AFTER_ATEXIT.
dnl
dnl @version $Id: ac_cxx_dtor_after_atexit.m4,v 1.2 2000/07/19 13:03:28 simons Exp $
dnl @author Luc Maisonobe
dnl
AC_DEFUN([AC_CXX_DTOR_AFTER_ATEXIT],
[AC_CACHE_CHECK(whether the compiler calls global destructors after functions registered through atexit,
ac_cv_cxx_dtor_after_atexit,
[AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_RUN([
#include <unistd.h>
#include <stdlib.h>
static int dtor_called = 0;
class A { public : ~A () { dtor_called = 1; } };
static A a;
void f() { _exit(dtor_called); }
int main (int , char **)
{
atexit (f);
return 0;
}
],
ac_cv_cxx_dtor_after_atexit=yes, ac_cv_cxx_dtor_after_atexit=yes=no,
ac_cv_cxx_dtor_after_atexit=yes)
AC_LANG_RESTORE
])
if test "$ac_cv_cxx_dtor_after_atexit" = yes; then
AC_DEFINE(HAVE_DTOR_AFTER_ATEXIT,,
[define if the compiler calls global destructors after functions registered through atexit])
fi
])
dnl @synopsis AC_CXX_DYNAMIC_CAST
dnl
dnl If the compiler supports dynamic_cast<>, define HAVE_DYNAMIC_CAST.
dnl
dnl @version $Id: ac_cxx_dynamic_cast.m4,v 1.2 2000/07/19 13:03:28 simons Exp $
dnl @author Luc Maisonobe
dnl
AC_DEFUN([AC_CXX_DYNAMIC_CAST],
[AC_CACHE_CHECK(whether the compiler supports dynamic_cast<>,
ac_cv_cxx_dynamic_cast,
[AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_COMPILE([#include <typeinfo>
class Base { public : Base () {} virtual void f () = 0;};
class Derived : public Base { public : Derived () {} virtual void f () {} };],[
Derived d; Base& b=d; return dynamic_cast<Derived*>(&b) ? 0 : 1;],
ac_cv_cxx_dynamic_cast=yes, ac_cv_cxx_dynamic_cast=no)
AC_LANG_RESTORE
])
if test "$ac_cv_cxx_dynamic_cast" = yes; then
AC_DEFINE(HAVE_DYNAMIC_CAST,,[define if the compiler supports dynamic_cast<>])
fi
])
dnl @synopsis AC_CXX_ENUM_COMPUTATIONS
dnl
dnl If the compiler handle computations inside an enum, define
dnl HAVE_ENUM_COMPUTATIONS.
dnl
dnl @version $Id: ac_cxx_enum_computations.m4,v 1.2 2000/07/19 13:03:28 simons Exp $
dnl @author Luc Maisonobe
dnl
AC_DEFUN([AC_CXX_ENUM_COMPUTATIONS],
[AC_CACHE_CHECK(whether the compiler handle computations inside an enum,
ac_cv_cxx_enum_computations,
[AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_COMPILE([
struct A { enum { a = 5, b = 7, c = 2 }; };
struct B { enum { a = 1, b = 6, c = 9 }; };
template<class T1, class T2> struct Z
{ enum { a = (T1::a > T2::a) ? T1::a : T2::b,
b = T1::b + T2::b,
c = (T1::c * T2::c + T2::a + T1::a)
};
};],[
return (((int)Z<A,B>::a == 5)
&& ((int)Z<A,B>::b == 13)
&& ((int)Z<A,B>::c == 24)) ? 0 : 1;],
ac_cv_cxx_enum_computations=yes, ac_cv_cxx_enum_computations=no)
AC_LANG_RESTORE
])
if test "$ac_cv_cxx_enum_computations" = yes; then
AC_DEFINE(HAVE_ENUM_COMPUTATIONS,,
[define if the compiler handle computations inside an enum])
fi
])
dnl @synopsis AC_CXX_ENUM_COMPUTATIONS_WITH_CAST
dnl
dnl If the compiler handle (int) casts in enum computations, define
dnl HAVE_ENUM_COMPUTATIONS_WITH_CAST.
dnl
dnl @version $Id: ac_cxx_enum_computations_with_cast.m4,v 1.2 2000/07/19 13:03:28 simons Exp $
dnl @author Luc Maisonobe
dnl
AC_DEFUN([AC_CXX_ENUM_COMPUTATIONS_WITH_CAST],
[AC_CACHE_CHECK(whether the compiler handles (int) casts in enum computations,
ac_cv_cxx_enum_computations_with_cast,
[AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_COMPILE([
struct A { enum { a = 5, b = 7, c = 2 }; };
struct B { enum { a = 1, b = 6, c = 9 }; };
template<class T1, class T2> struct Z
{ enum { a = ((int)T1::a > (int)T2::a) ? (int)T1::a : (int)T2::b,
b = (int)T1::b + (int)T2::b,
c = ((int)T1::c * (int)T2::c + (int)T2::a + (int)T1::a)
};
};],[
return (((int)Z<A,B>::a == 5)
&& ((int)Z<A,B>::b == 13)
&& ((int)Z<A,B>::c == 24)) ? 0 : 1;],
ac_cv_cxx_enum_computations_with_cast=yes, ac_cv_cxx_enum_computations_with_cast=no)
AC_LANG_RESTORE
])
if test "$ac_cv_cxx_enum_computations_with_cast" = yes; then
AC_DEFINE(HAVE_ENUM_COMPUTATIONS_WITH_CAST,,
[define if the compiler handles (int) casts in enum computations])
fi
])
dnl @synopsis AC_CXX_EXCEPTIONS
dnl
dnl If the C++ compiler supports exceptions handling (try,
dnl throw and catch), define HAVE_EXCEPTIONS.
dnl
dnl @version $Id: ac_cxx_exceptions.m4,v 1.2 2000/07/19 13:03:28 simons Exp $
dnl @author Luc Maisonobe
dnl
AC_DEFUN([AC_CXX_EXCEPTIONS],
[AC_CACHE_CHECK(whether the compiler supports exceptions,
ac_cv_cxx_exceptions,
[AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_COMPILE(,[try { throw 1; } catch (int i) { return i; }],
ac_cv_cxx_exceptions=yes, ac_cv_cxx_exceptions=no)
AC_LANG_RESTORE
])
if test "$ac_cv_cxx_exceptions" = yes; then
AC_DEFINE(HAVE_EXCEPTIONS,,[define if the compiler supports exceptions])
fi
])
dnl @synopsis AC_CXX_EXPLICIT
dnl
dnl If the compiler can be asked to prevent using implicitly one argument
dnl constructors as converting constructors with the explicit
dnl keyword, define HAVE_EXPLICIT.
dnl
dnl @version $Id: ac_cxx_explicit.m4,v 1.2 2000/07/19 13:03:28 simons Exp $
dnl @author Luc Maisonobe
dnl
AC_DEFUN([AC_CXX_EXPLICIT],
[AC_CACHE_CHECK(whether the compiler supports the explicit keyword,
ac_cv_cxx_explicit,
[AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_COMPILE([class A{public:explicit A(double){}};],
[double c = 5.0;A x(c);return 0;],
ac_cv_cxx_explicit=yes, ac_cv_cxx_explicit=no)
AC_LANG_RESTORE
])
if test "$ac_cv_cxx_explicit" = yes; then
AC_DEFINE(HAVE_EXPLICIT,,[define if the compiler supports the explicit keyword])
fi
])
dnl @synopsis AC_CXX_EXPLICIT_INSTANTIATIONS
dnl
dnl If the C++ compiler supports explicit instanciations syntax,
dnl define HAVE_INSTANTIATIONS.
dnl
dnl @version $Id: ac_cxx_explicit_instantiations.m4,v 1.2 2000/07/19 13:03:28 simons Exp $
dnl @author Luc Maisonobe
dnl
AC_DEFUN([AC_CXX_EXPLICIT_INSTANTIATIONS],
[AC_CACHE_CHECK(whether the compiler supports explicit instantiations,
ac_cv_cxx_explinst,
[AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_COMPILE([template <class T> class A { T t; }; template class A<int>;],
[], ac_cv_cxx_explinst=yes, ac_cv_cxx_explinst=no)
AC_LANG_RESTORE
])
if test "$ac_cv_cxx_explinst" = yes; then
AC_DEFINE(HAVE_INSTANTIATIONS,,
[define if the compiler supports explicit instantiations])
fi
])
dnl @synopsis AC_CXX_EXPLICIT_TEMPLATE_FUNCTION_QUALIFICATION
dnl
dnl If the compiler supports explicit template function qualification,
dnl define HAVE_EXPLICIT_TEMPLATE_FUNCTION_QUALIFICATION.
dnl
dnl @version $Id: ac_cxx_explicit_template_function_qualification.m4,v 1.2 2000/07/19 13:03:28 simons Exp $
dnl @author Luc Maisonobe
dnl
AC_DEFUN([AC_CXX_EXPLICIT_TEMPLATE_FUNCTION_QUALIFICATION],
[AC_CACHE_CHECK(whether the compiler supports explicit template function qualification,
ac_cv_cxx_explicit_template_function_qualification,
[AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_COMPILE([
template<class Z> class A { public : A() {} };
template<class X, class Y> A<X> to (const A<Y>&) { return A<X>(); }
],[A<float> x; A<double> y = to<double>(x); return 0;],
ac_cv_cxx_explicit_template_function_qualification=yes, ac_cv_cxx_explicit_template_function_qualification=no)
AC_LANG_RESTORE
])
if test "$ac_cv_cxx_explicit_template_function_qualification" = yes; then
AC_DEFINE(HAVE_EXPLICIT_TEMPLATE_FUNCTION_QUALIFICATION,,
[define if the compiler supports explicit template function qualification])
fi
])
dnl @synopsis AC_CXX_FULL_SPECIALIZATION_SYNTAX
dnl
dnl If the compiler recognizes the full specialization syntax, define
dnl HAVE_FULL_SPECIALIZATION_SYNTAX.
dnl
dnl @version $Id: ac_cxx_full_specialization_syntax.m4,v 1.2 2000/07/19 13:03:28 simons Exp $
dnl @author Luc Maisonobe
dnl
AC_DEFUN([AC_CXX_FULL_SPECIALIZATION_SYNTAX],
[AC_CACHE_CHECK(whether the compiler recognizes the full specialization syntax,
ac_cv_cxx_full_specialization_syntax,
[AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_COMPILE([
template<class T> class A { public : int f () const { return 1; } };
template<> class A<float> { public: int f () const { return 0; } };],[
A<float> a; return a.f();],
ac_cv_cxx_full_specialization_syntax=yes, ac_cv_cxx_full_specialization_syntax=no)
AC_LANG_RESTORE
])
if test "$ac_cv_cxx_full_specialization_syntax" = yes; then
AC_DEFINE(HAVE_FULL_SPECIALIZATION_SYNTAX,,
[define if the compiler recognizes the full specialization syntax])
fi
])
dnl @synopsis AC_CXX_FUNCTION_NONTYPE_PARAMETERS
dnl
dnl If the compiler supports function templates with non-type parameters,
dnl define HAVE_FUNCTION_NONTYPE_PARAMETERS.
dnl
dnl @version $Id: ac_cxx_function_nontype_parameters.m4,v 1.2 2000/07/19 13:03:28 simons Exp $
dnl @author Luc Maisonobe
dnl
AC_DEFUN([AC_CXX_FUNCTION_NONTYPE_PARAMETERS],
[AC_CACHE_CHECK(whether the compiler supports function templates with non-type parameters,
ac_cv_cxx_function_nontype_parameters,
[AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_COMPILE([
template<class T, int N> class A {};
template<class T, int N> int f(const A<T,N>& x) { return 0; }
],[A<double, 17> z; return f(z);],
ac_cv_cxx_function_nontype_parameters=yes, ac_cv_cxx_function_nontype_parameters=no)
AC_LANG_RESTORE
])
if test "$ac_cv_cxx_function_nontype_parameters" = yes; then
AC_DEFINE(HAVE_FUNCTION_NONTYPE_PARAMETERS,,
[define if the compiler supports function templates with non-type parameters])
fi
])
dnl @synopsis AC_CXX_HAVE_COMPLEX
dnl
dnl If the compiler has complex<T>, define HAVE_COMPLEX.
dnl
dnl @version $Id: ac_cxx_have_complex.m4,v 1.2 2000/07/19 13:03:28 simons Exp $
dnl @author Luc Maisonobe
dnl
AC_DEFUN([AC_CXX_HAVE_COMPLEX],
[AC_CACHE_CHECK(whether the compiler has complex<T>,
ac_cv_cxx_have_complex,
[AC_REQUIRE([AC_CXX_NAMESPACES])
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_COMPILE([#include <complex>
#ifdef HAVE_NAMESPACES
using namespace std;
#endif],[complex<float> a; complex<double> b; return 0;],
ac_cv_cxx_have_complex=yes, ac_cv_cxx_have_complex=no)
AC_LANG_RESTORE
])
if test "$ac_cv_cxx_have_complex" = yes; then
AC_DEFINE(HAVE_COMPLEX,,[define if the compiler has complex<T>])
fi
])
dnl @synopsis AC_CXX_HAVE_COMPLEX_MATH1
dnl
dnl If the compiler has the complex math functions cos, cosh, exp, log,
dnl pow, sin, sinh, sqrt, tan and tanh, define HAVE_COMPLEX_MATH1.
dnl
dnl @version $Id: ac_cxx_have_complex_math1.m4,v 1.2 2000/07/19 13:03:28 simons Exp $
dnl @author Luc Maisonobe
dnl
AC_DEFUN([AC_CXX_HAVE_COMPLEX_MATH1],
[AC_CACHE_CHECK(whether the compiler has complex math functions,
ac_cv_cxx_have_complex_math1,
[AC_REQUIRE([AC_CXX_NAMESPACES])
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
ac_save_LIBS="$LIBS"
LIBS="$LIBS -lm"
AC_TRY_LINK([#include <complex>
#ifdef HAVE_NAMESPACES
using namespace std;
#endif],[complex<double> x(1.0, 1.0), y(1.0, 1.0);
cos(x); cosh(x); exp(x); log(x); pow(x,1); pow(x,double(2.0));
pow(x, y); pow(double(2.0), x); sin(x); sinh(x); sqrt(x); tan(x); tanh(x);
return 0;],
ac_cv_cxx_have_complex_math1=yes, ac_cv_cxx_have_complex_math1=no)
LIBS="$ac_save_LIBS"
AC_LANG_RESTORE
])
if test "$ac_cv_cxx_have_complex_math1" = yes; then
AC_DEFINE(HAVE_COMPLEX_MATH1,,[define if the compiler has complex math functions])
fi
])
dnl @synopsis AC_CXX_HAVE_COMPLEX_MATH2
dnl
dnl If the compiler has the complex math functions acos, asin,
dnl atan, atan2 and log10, define HAVE_COMPLEX_MATH2.
dnl
dnl @version $Id: ac_cxx_have_complex_math2.m4,v 1.2 2000/07/19 13:03:28 simons Exp $
dnl @author Luc Maisonobe
dnl
AC_DEFUN([AC_CXX_HAVE_COMPLEX_MATH2],
[AC_CACHE_CHECK(whether the compiler has more complex math functions,
ac_cv_cxx_have_complex_math2,
[AC_REQUIRE([AC_CXX_NAMESPACES])
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
ac_save_LIBS="$LIBS"
LIBS="$LIBS -lm"
AC_TRY_LINK([#include <complex>
#ifdef HAVE_NAMESPACES
using namespace std;
#endif],[complex<double> x(1.0, 1.0), y(1.0, 1.0);
acos(x); asin(x); atan(x); atan2(x,y); atan2(x, double(3.0));
atan2(double(3.0), x); log10(x); return 0;],
ac_cv_cxx_have_complex_math2=yes, ac_cv_cxx_have_complex_math2=no)
LIBS="$ac_save_LIBS"
AC_LANG_RESTORE
])
if test "$ac_cv_cxx_have_complex_math2" = yes; then
AC_DEFINE(HAVE_COMPLEX_MATH2,,[define if the compiler has more complex math functions])
fi
])
dnl @synopsis AC_CXX_HAVE_IEEE_MATH
dnl
dnl If the compiler has the double math functions acosh,
dnl asinh, atanh, expm1, erf, erfc, isnan, j0, j1, lgamma, logb,
dnl log1p, rint, y0 and y1, define HAVE_IEEE_MATH.
dnl
dnl @version $Id: ac_cxx_have_ieee_math.m4,v 1.2 2000/07/19 13:03:28 simons Exp $
dnl @author Luc Maisonobe
dnl
AC_DEFUN([AC_CXX_HAVE_IEEE_MATH],
[AC_CACHE_CHECK(whether the compiler supports IEEE math library,
ac_cv_cxx_have_ieee_math,
[AC_LANG_SAVE
AC_LANG_CPLUSPLUS
ac_save_LIBS="$LIBS"
LIBS="$LIBS -lm"
AC_TRY_LINK([
#ifndef _ALL_SOURCE
#define _ALL_SOURCE
#endif
#ifndef _XOPEN_SOURCE
#define _XOPEN_SOURCE
#endif
#ifndef _XOPEN_SOURCE_EXTENDED
#define _XOPEN_SOURCE_EXTENDED 1
#endif
#include <math.h>],[double x = 1.0; double y = 1.0;
acosh(x); asinh(x); atanh(x); expm1(x); erf(x); erfc(x); isnan(x);
j0(x); j1(x); lgamma(x); logb(x); log1p(x); rint(x); y0(x); y1(x);
return 0;],
ac_cv_cxx_have_ieee_math=yes, ac_cv_cxx_have_ieee_math=no)
LIBS="$ac_save_LIBS"
AC_LANG_RESTORE
])
if test "$ac_cv_cxx_have_ieee_math" = yes; then
AC_DEFINE(HAVE_IEEE_MATH,,[define if the compiler supports IEEE math library])
fi
])
dnl @synopsis AC_CXX_HAVE_NUMERIC_LIMITS
dnl
dnl If the compiler has numeric_limits<T>, define HAVE_NUMERIC_LIMITS.
dnl
dnl @version $Id: ac_cxx_have_numeric_limits.m4,v 1.2 2000/07/19 13:03:28 simons Exp $
dnl @author Luc Maisonobe
dnl
AC_DEFUN([AC_CXX_HAVE_NUMERIC_LIMITS],
[AC_CACHE_CHECK(whether the compiler has numeric_limits<T>,
ac_cv_cxx_have_numeric_limits,
[AC_REQUIRE([AC_CXX_NAMESPACES])
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_COMPILE([#include <limits>
#ifdef HAVE_NAMESPACES
using namespace std;
#endif],[double e = numeric_limits<double>::epsilon(); return 0;],
ac_cv_cxx_have_numeric_limits=yes, ac_cv_cxx_have_numeric_limits=no)
AC_LANG_RESTORE
])
if test "$ac_cv_cxx_have_numeric_limits" = yes; then
AC_DEFINE(HAVE_NUMERIC_LIMITS,,[define if the compiler has numeric_limits<T>])
fi
])
dnl @synopsis AC_CXX_HAVE_SSTREAM
dnl
dnl If the C++ library has a working stringstream, define HAVE_SSTREAM.
dnl
dnl @author Ben Stanley
dnl @version $Id: ac_cxx_have_sstream.m4,v 1.1 2001/03/16 13:47:06 simons Exp $
dnl
AC_DEFUN([AC_CXX_HAVE_SSTREAM],
[AC_CACHE_CHECK(whether the compiler has stringstream,
ac_cv_cxx_have_sstream,
[AC_REQUIRE([AC_CXX_NAMESPACES])
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_COMPILE([#include <sstream>
#ifdef HAVE_NAMESPACES
using namespace std;
#endif],[stringstream message; message << "Hello"; return 0;],
ac_cv_cxx_have_sstream=yes, ac_cv_cxx_have_sstream=no)
AC_LANG_RESTORE
])
if test "$ac_cv_cxx_have_sstream" = yes; then
AC_DEFINE(HAVE_SSTREAM,,[define if the compiler has stringstream])
fi
])
dnl @synopsis AC_CXX_HAVE_STD
dnl
dnl If the compiler supports ISO C++ standard library (i.e., can include the
dnl files iostream, map, iomanip and cmath}), define HAVE_STD.
dnl
dnl @version $Id: ac_cxx_have_std.m4,v 1.2 2000/07/19 13:03:28 simons Exp $
dnl @author Luc Maisonobe
dnl
AC_DEFUN([AC_CXX_HAVE_STD],
[AC_CACHE_CHECK(whether the compiler supports ISO C++ standard library,
ac_cv_cxx_have_std,
[AC_REQUIRE([AC_CXX_NAMESPACES])
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_COMPILE([#include <iostream>
#include <map>
#include <iomanip>
#include <cmath>
#ifdef HAVE_NAMESPACES
using namespace std;
#endif],[return 0;],
ac_cv_cxx_have_std=yes, ac_cv_cxx_have_std=no)
AC_LANG_RESTORE
])
if test "$ac_cv_cxx_have_std" = yes; then
AC_DEFINE(HAVE_STD,,[define if the compiler supports ISO C++ standard library])
fi
])
dnl @synopsis AC_CXX_HAVE_STL
dnl
dnl If the compiler supports the Standard Template Library, define HAVE_STL.
dnl
dnl @version $Id: ac_cxx_have_stl.m4,v 1.2 2000/07/19 13:03:28 simons Exp $
dnl @author Luc Maisonobe
dnl
AC_DEFUN([AC_CXX_HAVE_STL],
[AC_CACHE_CHECK(whether the compiler supports Standard Template Library,
ac_cv_cxx_have_stl,
[AC_REQUIRE([AC_CXX_NAMESPACES])
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_COMPILE([#include <list>
#include <deque>
#ifdef HAVE_NAMESPACES
using namespace std;
#endif],[list<int> x; x.push_back(5);
list<int>::iterator iter = x.begin(); if (iter != x.end()) ++iter; return 0;],
ac_cv_cxx_have_stl=yes, ac_cv_cxx_have_stl=no)
AC_LANG_RESTORE
])
if test "$ac_cv_cxx_have_stl" = yes; then
AC_DEFINE(HAVE_STL,,[define if the compiler supports Standard Template Library])
fi
])
dnl @synopsis AC_CXX_HAVE_STRING_PUSH_BACK
dnl
dnl If the implementation of the C++ library provides the method
dnl std::string::push_back (char), define HAVE_STRING_PUSH_BACK.
dnl
dnl @version $Id: ac_cxx_have_string_push_back.m4,v 1.2 2001/05/22 08:39:19 simons Exp $
dnl @author Jan Langer <jan@langernetz.de>
dnl
AC_DEFUN([AC_CXX_HAVE_STRING_PUSH_BACK],
[AC_CACHE_CHECK(whether the compiler has std::string::push_back (char),
ac_cv_cxx_have_string_push_back,
[AC_REQUIRE([AC_CXX_NAMESPACES])
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_COMPILE([#include <string>
#ifdef HAVE_NAMESPACES
using namespace std;
#endif],[string message; message.push_back ('a'); return 0;],
ac_cv_cxx_have_string_push_back=yes, ac_cv_cxx_have_string_push_back=no)
AC_LANG_RESTORE
])
if test "$ac_cv_cxx_have_string_push_back" = yes; then
AC_DEFINE(HAVE_STRING_PUSH_BACK,,[define if the compiler has the method
std::string::push_back (char)])
fi
])dnl
dnl @synopsis AC_CXX_HAVE_SYSTEM_V_MATH
dnl
dnl If the compiler has the double math functions _class,
dnl ilogb, itrunc, nearest, rsqrt, uitrunc, copysign, drem, fmod, hypot,
dnl nextafter, remainder, scalb and unordered, define HAVE_SYSTEM_V_MATH.
dnl
dnl @version $Id: ac_cxx_have_system_v_math.m4,v 1.2 2000/07/19 13:03:28 simons Exp $
dnl @author Luc Maisonobe
dnl
AC_DEFUN([AC_CXX_HAVE_SYSTEM_V_MATH],
[AC_CACHE_CHECK(whether the compiler supports System V math library,
ac_cv_cxx_have_system_v_math,
[AC_LANG_SAVE
AC_LANG_CPLUSPLUS
ac_save_LIBS="$LIBS"
LIBS="$LIBS -lm"
AC_TRY_LINK([
#ifndef _ALL_SOURCE
#define _ALL_SOURCE
#endif
#ifndef _XOPEN_SOURCE
#define _XOPEN_SOURCE
#endif
#ifndef _XOPEN_SOURCE_EXTENDED
#define _XOPEN_SOURCE_EXTENDED 1
#endif
#include <math.h>],[double x = 1.0; double y = 1.0;
_class(x); ilogb(x); itrunc(x); nearest(x); rsqrt(x); uitrunc(x);
copysign(x,y); drem(x,y); fmod(x,y); hypot(x,y); nextafter(x,y);
remainder(x,y); scalb(x,y); unordered(x,y);
return 0;],
ac_cv_cxx_have_system_v_math=yes, ac_cv_cxx_have_system_v_math=no)
LIBS="$ac_save_LIBS"
AC_LANG_RESTORE
])
if test "$ac_cv_cxx_have_system_v_math" = yes; then
AC_DEFINE(HAVE_SYSTEM_V_MATH,,[define if the compiler supports System V math library])
fi
])
dnl @synopsis AC_CXX_HAVE_VALARRAY
dnl
dnl If the compiler has valarray<T>, define HAVE_VALARRAY.
dnl
dnl @version $Id: ac_cxx_have_valarray.m4,v 1.2 2000/07/19 13:03:28 simons Exp $
dnl @author Luc Maisonobe
dnl
AC_DEFUN([AC_CXX_HAVE_VALARRAY],
[AC_CACHE_CHECK(whether the compiler has valarray<T>,
ac_cv_cxx_have_valarray,
[AC_REQUIRE([AC_CXX_NAMESPACES])
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_COMPILE([#include <valarray>
#ifdef HAVE_NAMESPACES
using namespace std;
#endif],[valarray<float> x(100); return 0;],
ac_cv_cxx_have_valarray=yes, ac_cv_cxx_have_valarray=no)
AC_LANG_RESTORE
])
if test "$ac_cv_cxx_have_valarray" = yes; then
AC_DEFINE(HAVE_VALARRAY,,[define if the compiler has valarray<T>])
fi
])
dnl @synopsis AC_CXX_HAVE_VECTOR_AT
dnl
dnl If the implementation of the C++ library provides the method
dnl std::vector::at(std::size_t), define HAVE_VECTOR_AT.
dnl
dnl @version $Id: ac_cxx_have_vector_at.m4,v 1.1 2001/06/07 08:34:13 simons Exp $
dnl @author Jan Langer <jan@langernetz.de>
dnl
AC_DEFUN([AC_CXX_HAVE_VECTOR_AT],
[AC_CACHE_CHECK(whether the compiler has std::vector::at (std::size_t),
ac_cv_cxx_have_vector_at,
[AC_REQUIRE([AC_CXX_NAMESPACES])
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_COMPILE([#include <vector>
#ifdef HAVE_NAMESPACES
using namespace std;
#endif],[vector v (1); message.at (0); return 0;],
ac_cv_cxx_have_vector_at=yes, ac_cv_cxx_have_vector_at=no)
AC_LANG_RESTORE
])
if test "$ac_cv_cxx_have_vector_at" = yes; then
AC_DEFINE(HAVE_VECTOR_AT,,[define if the compiler has the method
std::vector::at (std::size_t)])
fi
])dnl
dnl @synopsis AC_CXX_MEMBER_CONSTANTS
dnl
dnl If the compiler supports member constants, define HAVE_MEMBER_CONSTANTS.
dnl
dnl @version $Id: ac_cxx_member_constants.m4,v 1.2 2000/07/19 13:03:28 simons Exp $
dnl @author Luc Maisonobe
dnl
AC_DEFUN([AC_CXX_MEMBER_CONSTANTS],
[AC_CACHE_CHECK(whether the compiler supports member constants,
ac_cv_cxx_member_constants,
[AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_COMPILE([class C {public: static const int i = 0;}; const int C::i;],
[return C::i;],
ac_cv_cxx_member_constants=yes, ac_cv_cxx_member_constants=no)
AC_LANG_RESTORE
])
if test "$ac_cv_cxx_member_constants" = yes; then
AC_DEFINE(HAVE_MEMBER_CONSTANTS,,[define if the compiler supports member constants])
fi
])
dnl @synopsis AC_CXX_MEMBER_TEMPLATES
dnl
dnl If the compiler supports member templates, define HAVE_MEMBER_TEMPLATES.
dnl
dnl @version $Id: ac_cxx_member_templates.m4,v 1.2 2000/07/19 13:03:28 simons Exp $
dnl @author Luc Maisonobe
dnl
AC_DEFUN([AC_CXX_MEMBER_TEMPLATES],
[AC_CACHE_CHECK(whether the compiler supports member templates,
ac_cv_cxx_member_templates,
[AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_COMPILE([
template<class T, int N> class A
{ public:
template<int N2> A<T,N> operator=(const A<T,N2>& z) { return A<T,N>(); }
};],[A<double,4> x; A<double,7> y; x = y; return 0;],
ac_cv_cxx_member_templates=yes, ac_cv_cxx_member_templates=no)
AC_LANG_RESTORE
])
if test "$ac_cv_cxx_member_templates" = yes; then
AC_DEFINE(HAVE_MEMBER_TEMPLATES,,[define if the compiler supports member templates])
fi
])
dnl @synopsis AC_CXX_MEMBER_TEMPLATES_OUTSIDE_CLASS
dnl
dnl If the compiler supports member templates outside the class declaration,
dnl define HAVE_MEMBER_TEMPLATES_OUTSIDE_CLASS.
dnl
dnl @version $Id: ac_cxx_member_templates_outside_class.m4,v 1.2 2000/07/19 13:03:28 simons Exp $
dnl @author Luc Maisonobe
dnl
AC_DEFUN([AC_CXX_MEMBER_TEMPLATES_OUTSIDE_CLASS],
[AC_CACHE_CHECK(whether the compiler supports member templates outside the class declaration,
ac_cv_cxx_member_templates_outside_class,
[AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_COMPILE([
template<class T, int N> class A
{ public :
template<int N2> A<T,N> operator=(const A<T,N2>& z);
};
template<class T, int N> template<int N2>
A<T,N> A<T,N>::operator=(const A<T,N2>& z){ return A<T,N>(); }],[
A<double,4> x; A<double,7> y; x = y; return 0;],
ac_cv_cxx_member_templates_outside_class=yes, ac_cv_cxx_member_templates_outside_class=no)
AC_LANG_RESTORE
])
if test "$ac_cv_cxx_member_templates_outside_class" = yes; then
AC_DEFINE(HAVE_MEMBER_TEMPLATES_OUTSIDE_CLASS,,
[define if the compiler supports member templates outside the class declaration])
fi
])
dnl @synopsis AC_CXX_MUTABLE
dnl
dnl If the compiler allows modifying class data members flagged with
dnl the mutable keyword even in const objects (for example in the
dnl body of a const member function), define HAVE_MUTABLE.
dnl
dnl @version $Id: ac_cxx_mutable.m4,v 1.2 2000/07/19 13:03:28 simons Exp $
dnl @author Luc Maisonobe
dnl
AC_DEFUN([AC_CXX_MUTABLE],
[AC_CACHE_CHECK(whether the compiler supports the mutable keyword,
ac_cv_cxx_mutable,
[AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_COMPILE([
class A { mutable int i;
public:
int f (int n) const { i = n; return i; }
};
],[A a; return a.f (1);],
ac_cv_cxx_mutable=yes, ac_cv_cxx_mutable=no)
AC_LANG_RESTORE
])
if test "$ac_cv_cxx_mutable" = yes; then
AC_DEFINE(HAVE_MUTABLE,,[define if the compiler supports the mutable keyword])
fi
])
dnl @synopsis AC_CXX_NAMESPACES
dnl
dnl If the compiler can prevent names clashes using namespaces, define
dnl HAVE_NAMESPACES.
dnl
dnl @version $Id: ac_cxx_namespaces.m4,v 1.2 2000/07/19 13:03:28 simons Exp $
dnl @author Luc Maisonobe
dnl
AC_DEFUN([AC_CXX_NAMESPACES],
[AC_CACHE_CHECK(whether the compiler implements namespaces,
ac_cv_cxx_namespaces,
[AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_COMPILE([namespace Outer { namespace Inner { int i = 0; }}],
[using namespace Outer::Inner; return i;],
ac_cv_cxx_namespaces=yes, ac_cv_cxx_namespaces=no)
AC_LANG_RESTORE
])
if test "$ac_cv_cxx_namespaces" = yes; then
AC_DEFINE(HAVE_NAMESPACES,,[define if the compiler implements namespaces])
fi
])
dnl @synopsis AC_CXX_NCEG_RESTRICT
dnl
dnl If the compiler supports the Numerical C Extensions Group
dnl restrict keyword, define HAVE_NCEG_RESTRICT.
dnl
dnl @version $Id: ac_cxx_nceg_restrict.m4,v 1.2 2000/07/19 13:03:28 simons Exp $
dnl @author Luc Maisonobe
dnl
AC_DEFUN([AC_CXX_NCEG_RESTRICT],
[AC_CACHE_CHECK(whether the compiler supports the Numerical C Extensions Group restrict keyword,
ac_cv_cxx_nceg_restrict,
[AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_COMPILE([
void add(int length, double * restrict a,
const double * restrict b, const double * restrict c)
{ for (int i=0; i < length; ++i) a[i] = b[i] + c[i];}
],[double a[10], b[10], c[10];
for (int i=0; i < 10; ++i) { a[i] = 0.0; b[i] = 0.0; c[i] = 0.0;}
add(10,a,b,c);
return 0;],
ac_cv_cxx_nceg_restrict=yes, ac_cv_cxx_nceg_restrict=no)
AC_LANG_RESTORE
])
if test "$ac_cv_cxx_nceg_restrict" = yes; then
AC_DEFINE(HAVE_NCEG_RESTRICT,,
[define if the compiler supports the Numerical C Extensions Group restrict keyword])
fi
])
dnl @synopsis AC_CXX_NEW_FOR_SCOPING
dnl
dnl If the compiler accepts the new for scoping rules (the scope of a
dnl variable declared inside the parentheses is restricted to the
dnl for-body), define HAVE_NEW_FOR_SCOPING.
dnl
dnl @version $Id: ac_cxx_new_for_scoping.m4,v 1.2 2000/07/19 13:03:28 simons Exp $
dnl @author Luc Maisonobe
dnl
AC_DEFUN([AC_CXX_NEW_FOR_SCOPING],
[AC_CACHE_CHECK(whether the compiler accepts the new for scoping rules,
ac_cv_cxx_new_for_scoping,
[AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_COMPILE(,[
int z = 0;
for (int i = 0; i < 10; ++i)
z = z + i;
for (int i = 0; i < 10; ++i)
z = z - i;
return z;],
ac_cv_cxx_new_for_scoping=yes, ac_cv_cxx_new_for_scoping=no)
AC_LANG_RESTORE
])
if test "$ac_cv_cxx_new_for_scoping" = yes; then
AC_DEFINE(HAVE_NEW_FOR_SCOPING,,[define if the compiler accepts the new for scoping rules])
fi
])
dnl @synopsis AC_CXX_OLD_FOR_SCOPING
dnl
dnl If the compiler accepts the old for scoping rules (the scope of a
dnl variable declared inside the parentheses extends outside the
dnl for-body), define HAVE_OLD_FOR_SCOPING. Note that some
dnl compilers (notably g++ and egcs) support both new and old
dnl rules since they accept the old rules and only generate a warning.
dnl
dnl @version $Id: ac_cxx_old_for_scoping.m4,v 1.2 2000/07/19 13:03:28 simons Exp $
dnl @author Luc Maisonobe
dnl
AC_DEFUN([AC_CXX_OLD_FOR_SCOPING],
[AC_CACHE_CHECK(whether the compiler accepts the old for scoping rules,
ac_cv_cxx_old_for_scoping,
[AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_COMPILE(,[int z;for (int i=0; i < 10; ++i)z=z+i;z=i;return z;],
ac_cv_cxx_old_for_scoping=yes, ac_cv_cxx_old_for_scoping=no)
AC_LANG_RESTORE
])
if test "$ac_cv_cxx_old_for_scoping" = yes; then
AC_DEFINE(HAVE_OLD_FOR_SCOPING,,[define if the compiler accepts the old for scoping rules])
fi
])
dnl @synopsis AC_CXX_PARTIAL_ORDERING
dnl
dnl If the compiler supports partial ordering, define HAVE_PARTIAL_ORDERING.
dnl
dnl @version $Id: ac_cxx_partial_ordering.m4,v 1.2 2000/07/19 13:03:28 simons Exp $
dnl @author Luc Maisonobe
dnl
AC_DEFUN([AC_CXX_PARTIAL_ORDERING],
[AC_CACHE_CHECK(whether the compiler supports partial ordering,
ac_cv_cxx_partial_ordering,
[AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_COMPILE([
template<int N> struct I {};
template<class T> struct A
{ int r;
template<class T1, class T2> int operator() (T1, T2) { r = 0; return r; }
template<int N1, int N2> int operator() (I<N1>, I<N2>) { r = 1; return r; }
};],[A<float> x, y; I<0> a; I<1> b; return x (a,b) + y (float(), double());],
ac_cv_cxx_partial_ordering=yes, ac_cv_cxx_partial_ordering=no)
AC_LANG_RESTORE
])
if test "$ac_cv_cxx_partial_ordering" = yes; then
AC_DEFINE(HAVE_PARTIAL_ORDERING,,
[define if the compiler supports partial ordering])
fi
])
dnl @synopsis AC_CXX_PARTIAL_SPECIALIZATION
dnl
dnl If the compiler supports partial specialization,
dnl define HAVE_PARTIAL_SPECIALIZATION.
dnl
dnl @version $Id: ac_cxx_partial_specialization.m4,v 1.2 2000/07/19 13:03:28 simons Exp $
dnl @author Luc Maisonobe
dnl
AC_DEFUN([AC_CXX_PARTIAL_SPECIALIZATION],
[AC_CACHE_CHECK(whether the compiler supports partial specialization,
ac_cv_cxx_partial_specialization,
[AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_COMPILE([
template<class T, int N> class A { public : enum e { z = 0 }; };
template<int N> class A<double, N> { public : enum e { z = 1 }; };
template<class T> class A<T, 2> { public : enum e { z = 2 }; };
],[return (A<int,3>::z == 0) && (A<double,3>::z == 1) && (A<float,2>::z == 2);],
ac_cv_cxx_partial_specialization=yes, ac_cv_cxx_partial_specialization=no)
AC_LANG_RESTORE
])
if test "$ac_cv_cxx_partial_specialization" = yes; then
AC_DEFINE(HAVE_PARTIAL_SPECIALIZATION,,
[define if the compiler supports partial specialization])
fi
])
dnl @synopsis AC_CXX_REINTERPRET_CAST
dnl
dnl If the compiler supports reinterpret_cast<>, define HAVE_REINTERPRET_CAST.
dnl
dnl @version $Id: ac_cxx_reinterpret_cast.m4,v 1.2 2000/07/19 13:03:28 simons Exp $
dnl @author Luc Maisonobe
dnl
AC_DEFUN([AC_CXX_REINTERPRET_CAST],
[AC_CACHE_CHECK(whether the compiler supports reinterpret_cast<>,
ac_cv_cxx_reinterpret_cast,
[AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_COMPILE([#include <typeinfo>
class Base { public : Base () {} virtual void f () = 0;};
class Derived : public Base { public : Derived () {} virtual void f () {} };
class Unrelated { public : Unrelated () {} };
int g (Unrelated&) { return 0; }],[
Derived d;Base& b=d;Unrelated& e=reinterpret_cast<Unrelated&>(b);return g(e);],
ac_cv_cxx_reinterpret_cast=yes, ac_cv_cxx_reinterpret_cast=no)
AC_LANG_RESTORE
])
if test "$ac_cv_cxx_reinterpret_cast" = yes; then
AC_DEFINE(HAVE_REINTERPRET_CAST,,
[define if the compiler supports reinterpret_cast<>])
fi
])
dnl @synopsis AC_CXX_RTTI
dnl
dnl If the compiler supports Run-Time Type Identification (typeinfo
dnl header and typeid keyword), define HAVE_RTTI.
dnl
dnl @version $Id: ac_cxx_rtti.m4,v 1.2 2000/07/19 13:03:28 simons Exp $
dnl @author Luc Maisonobe