summaryrefslogtreecommitdiff
path: root/configure.in
blob: cfc2d7585b354f64028a6875b5b709341cb5957e (plain)
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369

##------------------------------------------------------------##
# 
# The multiple-architecture stuff in this file is pretty
# cryptic.  Read docs/internals/multiple-architectures.txt
# for at least a partial explanation of what is going on.
#
##------------------------------------------------------------##

# Process this file with autoconf to produce a configure script.
AC_INIT(Valgrind, 3.4.0.SVN, valgrind-users@lists.sourceforge.net)
AC_CONFIG_SRCDIR(coregrind/m_main.c)
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE([foreign])

AM_MAINTAINER_MODE

# Where is VEX ?
# Nb: For the 2nd arg, the help string, AS_HELP_STRING is the proper way, but
#     older autoconfs don't support it... here's what it would say:
#
#    AS_HELP_STRING([--with-vex], [Vex directory]),
#
AC_ARG_WITH(vex, 
    [  --with-vex=/path/to/vex/dir    Vex directory],
[
    AC_CHECK_FILE($withval/pub/libvex.h,
        [VEX_DIR=$withval],
        [AC_MSG_ERROR([Directory '$withval' does not exist, or does not contain Vex])])
],
[
    VEX_DIR='$(top_srcdir)/VEX'
])
AC_SUBST(VEX_DIR)

# "make distcheck" first builds a tarball, then extracts it.
# Then it creates a build directory different from the extracted sources
# (called _build), and issues
#
#   ../configure $(DISTCHECK_CONFIGURE_FLAGS)
#
# and then builds, runs "make check", installs using DESTDIR, runs make
# installcheck, uninstalls, checks whether the installed base is empty
# again, then does yet another "make dist" and compares the resulting
# tarball with the one it started off with for identical content.  Then it
# tests "make distclean" for no leftover files.  
#
# So this line means:  when doing "make dist", use the same --with-vex value
# that you used when running configure to configure this tree in the first
# place.
AC_SUBST([DISTCHECK_CONFIGURE_FLAGS], [--with-vex=$VEX_DIR])

# Checks for programs.
CFLAGS="-Wno-long-long"

AC_PROG_LN_S
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_CPP
AC_PROG_CXX
AC_PROG_RANLIB

# Check for the compiler support
if test "${GCC}" != "yes" ; then
   AC_MSG_ERROR([Valgrind relies on GCC to be compiled])
fi

# figure out where perl lives
AC_PATH_PROG(PERL, perl)

# figure out where gdb lives
AC_PATH_PROG(GDB, gdb)
AC_DEFINE_UNQUOTED(GDB_PATH, "$GDB", [path to GDB])

# some older automake's don't have it so try something on our own
ifdef([AM_PROG_AS],[AM_PROG_AS],
[
AS="${CC}"
AC_SUBST(AS)

ASFLAGS=""
AC_SUBST(ASFLAGS)
])


# We don't want gcc < 3.0
AC_MSG_CHECKING([for a supported version of gcc])

[gcc_version=`${CC} --version | head -n 1 | sed 's/^[^0-9.]*\([0-9.]*\).*$/\1/'`]

case "${gcc_version}" in
     2.*)
	AC_MSG_RESULT([no (${gcc_version})])
	AC_MSG_ERROR([please use a recent (>= gcc-3.0) version of gcc])
	;;
     *)
	AC_MSG_RESULT([ok (${gcc_version})])
	;;
esac


# Checks for the platform, with the aim of setting VG_ARCH.  Note
# that VG_ARCH must be set to reflect the most that this CPU can
# do: for example if it is a 64-bit capable PowerPC, then it must
# be set to ppc64 and not ppc32.  Ditto for amd64.

AC_CANONICAL_HOST

AC_MSG_CHECKING([for a supported CPU])
AC_SUBST(VG_ARCH)

AC_SUBST(VG_ARCH_ALL)
VG_ARCH_ALL="amd64 ppc32 ppc64 x86"

AC_SUBST(VALT_LOAD_ADDRESS)

case "${host_cpu}" in
     i?86) 
	AC_MSG_RESULT([ok (${host_cpu})])
        VG_ARCH="x86"
        valt_load_address_normal="0x38000000"
        valt_load_address_inner="0x28000000"
        ;;

     x86_64) 
        AC_MSG_RESULT([ok (${host_cpu})])
        VG_ARCH="amd64"
        valt_load_address_normal="0x38000000"
        valt_load_address_inner="0x28000000"
        ;;

     powerpc64)
#       This value can only happen on Linux, not on AIX
        AC_MSG_RESULT([ok (${host_cpu})])
        VG_ARCH="ppc64"
        valt_load_address_normal="0x38000000"
        valt_load_address_inner="0x28000000"
        ;;

     powerpc)
#       Complexity.  'powerpc' on AIX implies a 64-bit capable CPU.
#       Whereas in Linux that means only a 32-bit capable CPU.
        AC_MSG_RESULT([ok (${host_cpu})])
	case "${host_os}" in
	   aix5.*)
	      VG_ARCH="ppc64"
              ;;
           *)
              VG_ARCH="ppc32"
              ;;
        esac
        valt_load_address_normal="0x38000000"
        valt_load_address_inner="0x28000000"
        ;;

     *) 
	AC_MSG_RESULT([no (${host_cpu})])
	AC_MSG_ERROR([Unsupported host architecture. Sorry])
	;;
esac

# Check if this should be built as an inner Valgrind, to be run within
# another Valgrind.  Choose the load address accordingly.
AC_CACHE_CHECK([for use as an inner Valgrind], vg_cv_inner,
   [AC_ARG_ENABLE(inner, 
      [  --enable-inner          enables self-hosting],
      [vg_cv_inner=$enableval],
      [vg_cv_inner=no])])
if test "$vg_cv_inner" = yes; then
    AC_DEFINE([ENABLE_INNER], 1, [configured to run as an inner Valgrind])
    VALT_LOAD_ADDRESS=$valt_load_address_inner
else
    VALT_LOAD_ADDRESS=$valt_load_address_normal
fi

# Sometimes it's convenient to subvert the bi-arch build system and
# just have a single build even though the underlying platform is
# capable of both.  Hence handle --enable-only64bit and
# --enable-only32bit.  Complain if both are issued :-)

# Check if a 64-bit only build has been requested
AC_CACHE_CHECK([for a 64-bit only build], vg_cv_only64bit,
   [AC_ARG_ENABLE(only64bit, 
      [  --enable-only64bit      do a 64-bit only build],
      [vg_cv_only64bit=$enableval],
      [vg_cv_only64bit=no])])

# Check if a 32-bit only build has been requested
AC_CACHE_CHECK([for a 32-bit only build], vg_cv_only32bit,
   [AC_ARG_ENABLE(only32bit, 
      [  --enable-only32bit      do a 32-bit only build],
      [vg_cv_only32bit=$enableval],
      [vg_cv_only32bit=no])])

# Stay sane
if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
   AC_MSG_ERROR(
      [Nonsensical: both --enable-only64bit and --enable-only32bit.])
fi



AC_MSG_CHECKING([for a supported OS])
AC_SUBST(VG_OS)

case "${host_os}" in
     *linux*)
	AC_MSG_RESULT([ok (${host_os})])
        VG_OS="linux"

        # Ok, this is linux. Check the kernel version
        AC_MSG_CHECKING([for the kernel version])

        kernel=`uname -r`

        case "${kernel}" in
             2.6.*) 
        	    AC_MSG_RESULT([2.6 family (${kernel})])
        	    AC_DEFINE([KERNEL_2_6], 1, [Define to 1 if you're using Linux 2.6.x])
        	    ;;

             2.4.*) 
        	    AC_MSG_RESULT([2.4 family (${kernel})])
        	    AC_DEFINE([KERNEL_2_4], 1, [Define to 1 if you're using Linux 2.4.x])
        	    ;;

             *) 
        	    AC_MSG_RESULT([unsupported (${kernel})])
        	    AC_MSG_ERROR([Valgrind works on kernels 2.4, 2.6])
        	    ;;
        esac

        ;;

     aix5.1.*)
        AC_MSG_RESULT([ok (${host_os})])
        VG_OS="aix5"
        ;;
     aix5.2.*)
        AC_MSG_RESULT([ok (${host_os})])
        VG_OS="aix5"
        ;;       
     aix5.3.*)
        AC_MSG_RESULT([ok (${host_os})])
        VG_OS="aix5"
        ;;       

     *freebsd*)
        AC_MSG_RESULT([ok (${host_os})])
        VG_OS="freebsd"
        ;;

     *) 
	AC_MSG_RESULT([no (${host_os})])
	AC_MSG_ERROR([Valgrind is operating system specific. Sorry. Please consider doing a port.])
	;;
esac

# If we are building on a 64 bit platform test to see if the system
# supports building 32 bit programs and disable 32 bit support if it
# does not support building 32 bit programs

case "$VG_ARCH-$VG_OS" in
     amd64-linux|ppc64-linux)
        AC_MSG_CHECKING([for 32 bit build support])
        safe_CFLAGS=$CFLAGS
        CFLAGS="-m32"
        AC_TRY_LINK(, [
        int main () { return 0 ; }
        ],
        [
        AC_MSG_RESULT([yes])
        ], [
        vg_cv_only64bit="yes"
        AC_MSG_RESULT([no])
        ])
        CFLAGS=$safe_CFLAGS;;
esac

if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
   AC_MSG_ERROR(
      [--enable-only32bit was specified but system does not support 32 bit builds])
fi

# Establish VG_PLATFORM_PRI.  This is the primary build target.  The
# entire system, including regression and performance tests, will be
# built for this target.
#
# Also establish VG_PLATFORM_SEC, the secondary build target, if
# possible.  The system will also be built for this target, but not
# the regression or performance tests.
#
AC_MSG_CHECKING([for a supported CPU/OS combination])

AC_SUBST(VG_PLATFORM_PRI)
AC_SUBST(VG_PLATFORM_SEC)

case "$VG_ARCH-$VG_OS" in
     x86-linux)
	VG_PLATFORM_PRI="X86_LINUX"
	VG_PLATFORM_SEC=""
        AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
	;;
     amd64-linux)
	if test x$vg_cv_only64bit = xyes; then
	   VG_PLATFORM_PRI="AMD64_LINUX"
	   VG_PLATFORM_SEC=""
	elif test x$vg_cv_only32bit = xyes; then
	   VG_PLATFORM_PRI="X86_LINUX"
	   VG_PLATFORM_SEC=""
	else
	   VG_PLATFORM_PRI="AMD64_LINUX"
	   VG_PLATFORM_SEC="X86_LINUX"
	fi
        AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
	;;
     ppc32-linux)
	VG_PLATFORM_PRI="PPC32_LINUX"
	VG_PLATFORM_SEC=""
        AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
	;;
     ppc64-aix5)
	if test x$vg_cv_only64bit = xyes; then
	   VG_PLATFORM_PRI="PPC64_AIX5"
	   VG_PLATFORM_SEC=""
	elif test x$vg_cv_only32bit = xyes; then
	   VG_PLATFORM_PRI="PPC32_AIX5"
	   VG_PLATFORM_SEC=""
	else
	   VG_PLATFORM_PRI="PPC64_AIX5"
	   VG_PLATFORM_SEC="PPC32_AIX5"
	fi
        AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
	;;
     ppc64-linux)
	if test x$vg_cv_only64bit = xyes; then
	   VG_PLATFORM_PRI="PPC64_LINUX"
	   VG_PLATFORM_SEC=""
	elif test x$vg_cv_only32bit = xyes; then
	   VG_PLATFORM_PRI="PPC32_LINUX"
	   VG_PLATFORM_SEC=""
	else
	   VG_PLATFORM_PRI="PPC64_LINUX"
	   VG_PLATFORM_SEC="PPC32_LINUX"
	fi
        AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
	;;
    *)
	VG_PLATFORM_PRI="unknown"
	VG_PLATFORM_SEC="unknown"
        AC_MSG_RESULT([no (${host_cpu}-${host_os})])
        AC_MSG_ERROR([Valgrind is platform specific. Sorry. Please consider doing a port.])
        ;;
esac

# Set up VGP_<platform>.  Either one or two of these become defined.
#
AM_CONDITIONAL(VGP_X86_LINUX,   
               test x$VG_PLATFORM_PRI = xX86_LINUX \
                 -o x$VG_PLATFORM_SEC = xX86_LINUX)
AM_CONDITIONAL(VGP_AMD64_LINUX, 
               test x$VG_PLATFORM_PRI = xAMD64_LINUX)
AM_CONDITIONAL(VGP_PPC32_LINUX, 
               test x$VG_PLATFORM_PRI = xPPC32_LINUX \ 
                 -o x$VG_PLATFORM_SEC = xPPC32_LINUX)
AM_CONDITIONAL(VGP_PPC64_LINUX, 
               test x$VG_PLATFORM_PRI = xPPC64_LINUX)
AM_CONDITIONAL(VGP_PPC32_AIX5, 
               test x$VG_PLATFORM_PRI = xPPC32_AIX5 \ 
                 -o x$VG_PLATFORM_SEC = xPPC32_AIX5)
AM_CONDITIONAL(VGP_PPC64_AIX5, 
               test x$VG_PLATFORM_PRI = xPPC64_AIX5)

# Similarly, set up VGO_<os>.  Exactly one of these becomes defined.
# Relies on the assumption that the primary and secondary targets are 
# for the same OS, so therefore only necessary to test the primary.
#
AM_CONDITIONAL(VGO_LINUX,
               test x$VG_PLATFORM_PRI = xX86_LINUX \
                 -o x$VG_PLATFORM_PRI = xAMD64_LINUX \
                 -o x$VG_PLATFORM_PRI = xPPC32_LINUX \
                 -o x$VG_PLATFORM_PRI = xPPC64_LINUX)
AM_CONDITIONAL(VGO_AIX5,
               test x$VG_PLATFORM_PRI = xPPC32_AIX5 \
                 -o x$VG_PLATFORM_PRI = xPPC64_AIX5)


# Sometimes, in the Makefile.am-s, it's useful to know
# whether or not there is a secondary target.
#
AM_CONDITIONAL(VGP_HAVE_SECONDARY,
               test x$VG_PLATFORM_SEC != x)


# This variable will collect the individual suppression files
# depending on the results of autoconf
DEFAULT_SUPP=""
AC_SUBST(DEFAULT_SUPP)


GLIBC_VERSION=""

AC_EGREP_CPP([GLIBC_22], [
#include <features.h>
#ifdef __GNU_LIBRARY__
 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2)
  GLIBC_22
 #endif
#endif
],
GLIBC_VERSION="2.2")

AC_EGREP_CPP([GLIBC_23], [
#include <features.h>
#ifdef __GNU_LIBRARY__
 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 3)
  GLIBC_23
 #endif
#endif
],
GLIBC_VERSION="2.3")

AC_EGREP_CPP([GLIBC_24], [
#include <features.h>
#ifdef __GNU_LIBRARY__
 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 4)
  GLIBC_24
 #endif
#endif
],
GLIBC_VERSION="2.4")

AC_EGREP_CPP([GLIBC_25], [
#include <features.h>
#ifdef __GNU_LIBRARY__
 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 5)
  GLIBC_25
 #endif
#endif
],
GLIBC_VERSION="2.5")

AC_EGREP_CPP([GLIBC_26], [
#include <features.h>
#ifdef __GNU_LIBRARY__
 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 6)
  GLIBC_26
 #endif
#endif
],
GLIBC_VERSION="2.6")

AC_EGREP_CPP([GLIBC_27], [
#include <features.h>
#ifdef __GNU_LIBRARY__
 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 7)
  GLIBC_27
 #endif
#endif
],
GLIBC_VERSION="2.7")

AC_EGREP_CPP([GLIBC_28], [
#include <features.h>
#ifdef __GNU_LIBRARY__
 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 8)
  GLIBC_28
 #endif
#endif
],
GLIBC_VERSION="2.8")

AC_EGREP_CPP([AIX5_LIBC], [
#include <standards.h>
#if defined(_AIXVERSION_510) || defined(_AIXVERSION_520) || defined(_AIXVERSION_530)
  AIX5_LIBC
#endif
],
GLIBC_VERSION="aix5")

AC_MSG_CHECKING([the GLIBC_VERSION version])

case "${GLIBC_VERSION}" in
     2.2)
	AC_MSG_RESULT(2.2 family)
	AC_DEFINE([GLIBC_2_2], 1, [Define to 1 if you're using glibc 2.2.x])
	DEFAULT_SUPP="glibc-2.2.supp ${DEFAULT_SUPP}"
	DEFAULT_SUPP="glibc-2.2-LinuxThreads-helgrind.supp ${DEFAULT_SUPP}"
	DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
	;;

     2.3)
	AC_MSG_RESULT(2.3 family)
	AC_DEFINE([GLIBC_2_3], 1, [Define to 1 if you're using glibc 2.3.x])
	DEFAULT_SUPP="glibc-2.3.supp ${DEFAULT_SUPP}"
	DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
	DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
	;;

     2.4)
	AC_MSG_RESULT(2.4 family)
	AC_DEFINE([GLIBC_2_4], 1, [Define to 1 if you're using glibc 2.4.x])
	DEFAULT_SUPP="glibc-2.4.supp ${DEFAULT_SUPP}"
	DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
	DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
	;;

     2.5)
	AC_MSG_RESULT(2.5 family)
	AC_DEFINE([GLIBC_2_5], 1, [Define to 1 if you're using glibc 2.5.x])
	DEFAULT_SUPP="glibc-2.5.supp ${DEFAULT_SUPP}"
	DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
	DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
	;;
     2.6)
	AC_MSG_RESULT(2.6 family)
	AC_DEFINE([GLIBC_2_6], 1, [Define to 1 if you're using glibc 2.6.x])
	DEFAULT_SUPP="glibc-2.6.supp ${DEFAULT_SUPP}"
	DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
	DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
	;;
     2.7)
	AC_MSG_RESULT(2.7 family)
	AC_DEFINE([GLIBC_2_7], 1, [Define to 1 if you're using glibc 2.7.x])
	DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
	DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
	DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
	;;
     2.8)
	AC_MSG_RESULT(2.8 family)
	AC_DEFINE([GLIBC_2_8], 1, [Define to 1 if you're using glibc 2.8.x])
	DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
	DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
	DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
	;;

     aix5)
	AC_MSG_RESULT(AIX 5.1 or 5.2 or 5.3)
	AC_DEFINE([AIX5_LIBC], 1, [Define to 1 if you're using AIX 5.1 or 5.2 or 5.3])
	DEFAULT_SUPP="aix5libc.supp ${DEFAULT_SUPP}"
	;;

     *)
	AC_MSG_RESULT(unsupported version)
	AC_MSG_ERROR([Valgrind requires glibc version 2.2 - 2.8])
	AC_MSG_ERROR([or AIX 5.1 or 5.2 or 5.3 GLIBC_VERSION])
	;;
esac

AC_SUBST(GLIBC_VERSION)

# We don't know how to detect the X client library version
# (detecting the server version is easy, but no help).  So we
# just use a hack: always include the suppressions for both
# versions 3 and 4.
AC_PATH_X
if test "${no_x}" != 'yes' ; then
   DEFAULT_SUPP="xfree-4.supp ${DEFAULT_SUPP}"
   DEFAULT_SUPP="xfree-3.supp ${DEFAULT_SUPP}"
fi


# Check for CLOCK_MONOTONIC

AC_MSG_CHECKING([for CLOCK_MONOTONIC])

AC_TRY_COMPILE(
[
#include <time.h>
], [
  struct timespec t;
  clock_gettime(CLOCK_MONOTONIC, &t);
  return 0;
],
[
AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_CLOCK_MONOTONIC], 1,
          [Define to 1 if you have the `CLOCK_MONOTONIC' constant.])
], [
AC_MSG_RESULT([no])
])


# Check for PTHREAD_MUTEX_ADAPTIVE_NP

AC_MSG_CHECKING([for PTHREAD_MUTEX_ADAPTIVE_NP])

AC_TRY_COMPILE(
[
#define _GNU_SOURCE
#include <pthread.h>
], [
  return (PTHREAD_MUTEX_ADAPTIVE_NP);
],
[
AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], 1,
          [Define to 1 if you have the `PTHREAD_MUTEX_ADAPTIVE_NP' constant.])
], [
AC_MSG_RESULT([no])
])


# Check for PTHREAD_MUTEX_ERRORCHECK_NP

AC_MSG_CHECKING([for PTHREAD_MUTEX_ERRORCHECK_NP])

AC_TRY_COMPILE(
[
#define _GNU_SOURCE
#include <pthread.h>
], [
  return (PTHREAD_MUTEX_ERRORCHECK_NP);
],
[
AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_PTHREAD_MUTEX_ERRORCHECK_NP], 1,
          [Define to 1 if you have the `PTHREAD_MUTEX_ERRORCHECK_NP' constant.])
], [
AC_MSG_RESULT([no])
])


# Check for PTHREAD_MUTEX_RECURSIVE_NP

AC_MSG_CHECKING([for PTHREAD_MUTEX_RECURSIVE_NP])

AC_TRY_COMPILE(
[
#define _GNU_SOURCE
#include <pthread.h>
], [
  return (PTHREAD_MUTEX_RECURSIVE_NP);
],
[
AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE_NP], 1,
          [Define to 1 if you have the `PTHREAD_MUTEX_RECURSIVE_NP' constant.])
], [
AC_MSG_RESULT([no])
])


# Check for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP

AC_MSG_CHECKING([for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP])

AC_TRY_COMPILE(
[
#define _GNU_SOURCE
#include <pthread.h>
], [
  pthread_mutex_t m = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
  return 0;
],
[
AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP], 1,
          [Define to 1 if you have the `PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP' constant.])
], [
AC_MSG_RESULT([no])
])


# Check whether pthread_mutex_t has a member called __m_kind.

AC_MSG_CHECKING([for pthread_mutex_t::__m_kind])

AC_TRY_COMPILE(
[
  #include <pthread.h>
], [
  pthread_mutex_t m;
  return m.__m_kind;
], [
AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_PTHREAD_MUTEX_T__M_KIND], 1,
          [Define to 1 if pthread_mutex_t has a member called __m_kind.])
], [
AC_MSG_RESULT([no])
])


# Check whether pthread_mutex_t has a member called __data.__kind.

AC_MSG_CHECKING([for pthread_mutex_t::__data.__kind])

AC_TRY_COMPILE(
[
#include <pthread.h>
], [
  pthread_mutex_t m;
  return m.__data.__kind;
], [
AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_PTHREAD_MUTEX_T__DATA__KIND], 1,
          [Define to 1 if pthread_mutex_t has a member __data.__kind.])
], [
AC_MSG_RESULT([no])
])


# does this compiler support -fopenmp, does it have the include file
# <omp.h> and does it have libgomp ?

AC_MSG_CHECKING([for OpenMP])

safe_CFLAGS=$CFLAGS
CFLAGS="-fopenmp"

AC_LINK_IFELSE(
[
#include <omp.h> 
int main(int argc, char** argv)
{
  omp_set_dynamic(0);
  return 0;
}
],
[
ac_have_openmp=yes
AC_MSG_RESULT([yes])
], [
ac_have_openmp=no
AC_MSG_RESULT([no])
])
CFLAGS=$safe_CFLAGS

AM_CONDITIONAL([HAVE_OPENMP], [test x$ac_have_openmp = xyes])


# Check for eventfd_t, eventfd() and eventfd_read()
AC_MSG_CHECKING([for eventfd()])

AC_TRY_LINK(
[
#include <sys/eventfd.h>
], [
  eventfd_t ev;
  int fd;

  fd = eventfd(5, 0);
  eventfd_read(fd, &ev);
  return 0;
],
[
AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_EVENTFD], 1,
          [Define to 1 if you have the `eventfd' function.])
AC_DEFINE([HAVE_EVENTFD_READ], 1,
          [Define to 1 if you have the `eventfd_read' function.])
], [
AC_MSG_RESULT([no])
])


# does this compiler support -m32 ?
AC_MSG_CHECKING([if gcc accepts -m32])

safe_CFLAGS=$CFLAGS
CFLAGS="-m32"

AC_TRY_COMPILE(, [
int main () { return 0 ; }
],
[
FLAG_M32="-m32"
AC_MSG_RESULT([yes])
], [
FLAG_M32=""
AC_MSG_RESULT([no])
])
CFLAGS=$safe_CFLAGS

AC_SUBST(FLAG_M32)


# does this compiler support -maix32 ?
AC_MSG_CHECKING([if gcc accepts -maix32])

safe_CFLAGS=$CFLAGS
CFLAGS="-maix32"

AC_TRY_COMPILE(, [
int main () { return 0 ; }
],
[
FLAG_MAIX32="-maix32"
AC_MSG_RESULT([yes])
], [
FLAG_MAIX32=""
AC_MSG_RESULT([no])
])
CFLAGS=$safe_CFLAGS

AC_SUBST(FLAG_MAIX32)


# does this compiler support -m64 ?
AC_MSG_CHECKING([if gcc accepts -m64])

safe_CFLAGS=$CFLAGS
CFLAGS="-m64"

AC_TRY_COMPILE(, [
int main () { return 0 ; }
],
[
FLAG_M64="-m64"
AC_MSG_RESULT([yes])
], [
FLAG_M64=""
AC_MSG_RESULT([no])
])
CFLAGS=$safe_CFLAGS

AC_SUBST(FLAG_M64)


# does this compiler support -maix64 ?
AC_MSG_CHECKING([if gcc accepts -maix64])

safe_CFLAGS=$CFLAGS
CFLAGS="-maix64"

AC_TRY_COMPILE(, [
int main () { return 0 ; }
],
[
FLAG_MAIX64="-maix64"
AC_MSG_RESULT([yes])
], [
FLAG_MAIX64=""
AC_MSG_RESULT([no])
])
CFLAGS=$safe_CFLAGS

AC_SUBST(FLAG_MAIX64)


# does this compiler support -mmmx ?
AC_MSG_CHECKING([if gcc accepts -mmmx])

safe_CFLAGS=$CFLAGS
CFLAGS="-mmmx"

AC_TRY_COMPILE(, [
int main () { return 0 ; }
],
[
FLAG_MMMX="-mmmx"
AC_MSG_RESULT([yes])
], [
FLAG_MMMX=""
AC_MSG_RESULT([no])
])
CFLAGS=$safe_CFLAGS

AC_SUBST(FLAG_MMMX)


# does this compiler support -msse ?
AC_MSG_CHECKING([if gcc accepts -msse])

safe_CFLAGS=$CFLAGS
CFLAGS="-msse"

AC_TRY_COMPILE(, [
int main () { return 0 ; }
],
[
FLAG_MSSE="-msse"
AC_MSG_RESULT([yes])
], [
FLAG_MSSE=""
AC_MSG_RESULT([no])
])
CFLAGS=$safe_CFLAGS

AC_SUBST(FLAG_MSSE)


# does this compiler support -mpreferred-stack-boundary=2 ?
AC_MSG_CHECKING([if gcc accepts -mpreferred-stack-boundary])

safe_CFLAGS=$CFLAGS
CFLAGS="-mpreferred-stack-boundary=2"

AC_TRY_COMPILE(, [
int main () { return 0 ; }
],
[
PREFERRED_STACK_BOUNDARY="-mpreferred-stack-boundary=2"
AC_MSG_RESULT([yes])
], [
PREFERRED_STACK_BOUNDARY=""
AC_MSG_RESULT([no])
])
CFLAGS=$safe_CFLAGS

AC_SUBST(PREFERRED_STACK_BOUNDARY)


# does this compiler support -Wno-pointer-sign ?
AC_MSG_CHECKING([if gcc accepts -Wno-pointer-sign])

safe_CFLAGS=$CFLAGS
CFLAGS="-Wno-pointer-sign"

AC_TRY_COMPILE(, [
int main () { return 0 ; }
],
[
no_pointer_sign=yes
AC_MSG_RESULT([yes])
], [
no_pointer_sign=no
AC_MSG_RESULT([no])
])
CFLAGS=$safe_CFLAGS

if test x$no_pointer_sign = xyes; then
  CFLAGS="$CFLAGS -Wno-pointer-sign"
fi


# does this compiler support -Wdeclaration-after-statement ?
AC_MSG_CHECKING([if gcc accepts -Wdeclaration-after-statement])

safe_CFLAGS=$CFLAGS
CFLAGS="-Wdeclaration-after-statement"

AC_TRY_COMPILE(, [
int main () { return 0 ; }
],
[
declaration_after_statement=yes
FLAG_WDECL_AFTER_STMT="-Wdeclaration-after-statement"
AC_MSG_RESULT([yes])
], [
declaration_after_statement=no
FLAG_WDECL_AFTER_STMT=""
AC_MSG_RESULT([no])
])
CFLAGS=$safe_CFLAGS

AC_SUBST(FLAG_WDECL_AFTER_STMT)

if test x$declaration_after_statement = xyes; then
  CFLAGS="$CFLAGS -Wdeclaration-after-statement"
fi


# does this compiler support -Wextra or the older -W ?

AC_MSG_CHECKING([if gcc accepts -Wextra or -W])

safe_CFLAGS=$CFLAGS
CFLAGS="-Wextra"

AC_TRY_COMPILE(
[ ],
[
  return 0;
],
[
AC_SUBST([FLAG_W_EXTRA], [-Wextra])
AC_MSG_RESULT([-Wextra])
], [
  CFLAGS="-W"
  AC_TRY_COMPILE(
  [ ],
  [
    return 0;
  ],
  [
  AC_SUBST([FLAG_W_EXTRA], [-W])
  AC_MSG_RESULT([-W])
  ], [
  AC_SUBST([FLAG_W_EXTRA], [])
  AC_MSG_RESULT([not supported])
  ])
])
CFLAGS=$safe_CFLAGS


# does this compiler support -fno-stack-protector ?
AC_MSG_CHECKING([if gcc accepts -fno-stack-protector])

safe_CFLAGS=$CFLAGS
CFLAGS="-fno-stack-protector"

AC_TRY_COMPILE(, [
int main () { return 0 ; }
],
[
no_stack_protector=yes
FLAG_FNO_STACK_PROTECTOR="-fno-stack-protector"
AC_MSG_RESULT([yes])
], [
no_stack_protector=no
FLAG_FNO_STACK_PROTECTOR=""
AC_MSG_RESULT([no])
])
CFLAGS=$safe_CFLAGS

AC_SUBST(FLAG_FNO_STACK_PROTECTOR)

if test x$no_stack_protector = xyes; then
  CFLAGS="$CFLAGS -fno-stack-protector"
fi


# does this compiler support --param inline-unit-growth=... ?

AC_MSG_CHECKING([if gcc accepts --param inline-unit-growth])

safe_CFLAGS=$CFLAGS
CFLAGS="--param inline-unit-growth=900"

AC_TRY_COMPILE(
[ ],
[
  return 0;
],
[
AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH],
         ["--param inline-unit-growth=900"])
AC_MSG_RESULT([yes])
], [
AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH], [""])
AC_MSG_RESULT([no])
])
CFLAGS=$safe_CFLAGS


# does this compiler support __builtin_expect?
AC_MSG_CHECKING([if gcc supports __builtin_expect])

AC_TRY_LINK(, [
return __builtin_expect(1, 1) ? 1 : 0
],
[
ac_have_builtin_expect=yes
AC_MSG_RESULT([yes])
], [
ac_have_builtin_expect=no
AC_MSG_RESULT([no])
])
if test x$ac_have_builtin_expect = xyes ; then
  AC_DEFINE(HAVE_BUILTIN_EXPECT, 1, [Define to 1 if gcc supports __builtin_expect.])
fi


# does the ppc assembler support "mtocrf" et al?
AC_MSG_CHECKING([if ppc32/64 as supports mtocrf/mfocrf])

AC_TRY_COMPILE(, [
__asm__ __volatile__("mtocrf 4,0");
__asm__ __volatile__("mfocrf 0,4");
],
[
ac_have_as_ppc_mftocrf=yes
AC_MSG_RESULT([yes])
], [
ac_have_as_ppc_mftocrf=no
AC_MSG_RESULT([no])
])
if test x$ac_have_as_ppc_mftocrf = xyes ; then
  AC_DEFINE(HAVE_AS_PPC_MFTOCRF, 1, [Define to 1 if as supports mtocrf/mfocrf.])
fi


# does the x86/amd64 assembler understand SSE3 instructions?
# Note, this doesn't generate a C-level symbol.  It generates a
# automake-level symbol (BUILD_SSE3_TESTS), used in test Makefile.am's
AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE3])

AC_TRY_COMPILE(, [
  do { long long int x; 
     __asm__ __volatile__("fisttpq (%0)" : :"r"(&x) ); } 
  while (0)
],
[
ac_have_as_sse3=yes
AC_MSG_RESULT([yes])
], [
ac_have_as_sse3=no
AC_MSG_RESULT([no])
])

AM_CONDITIONAL(BUILD_SSE3_TESTS, test x$ac_have_as_sse3 = xyes)


# Ditto for SSSE3 instructions (note extra S)
# Note, this doesn't generate a C-level symbol.  It generates a
# automake-level symbol (BUILD_SSSE3_TESTS), used in test Makefile.am's
AC_MSG_CHECKING([if x86/amd64 assembler speaks SSSE3])

AC_TRY_COMPILE(, [
  do { long long int x; 
   __asm__ __volatile__(
      "pabsb (%0),%%xmm7" : : "r"(&x) : "xmm7" ); }
  while (0)
],
[
ac_have_as_ssse3=yes
AC_MSG_RESULT([yes])
], [
ac_have_as_ssse3=no
AC_MSG_RESULT([no])
])

AM_CONDITIONAL(BUILD_SSSE3_TESTS, test x$ac_have_as_ssse3 = xyes)


# Check for TLS support in the compiler and linker
AC_CACHE_CHECK([for TLS support], vg_cv_tls,
	       [AC_ARG_ENABLE(tls, [  --enable-tls            platform supports TLS],
		[vg_cv_tls=$enableval],
               	[AC_RUN_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
                                                [[return foo;]])],
                               [vg_cv_tls=yes],
                               [vg_cv_tls=no])])])

if test "$vg_cv_tls" = yes; then
AC_DEFINE([HAVE_TLS], 1, [can use __thread to define thread-local variables])
fi


# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([       \
        endian.h         \
        mqueue.h         \
        sys/endian.h     \
        sys/epoll.h      \
        sys/eventfd.h    \
        sys/klog.h       \
        sys/poll.h       \
        sys/signal.h     \
        sys/signalfd.h   \
        sys/syscall.h    \
        sys/time.h       \
        sys/types.h      \
        ])


# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_UID_T
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
AC_HEADER_TIME


# Checks for library functions.
AC_FUNC_MEMCMP
AC_FUNC_MMAP
AC_TYPE_SIGNAL

AC_CHECK_LIB([rt], [clock_gettime])

AC_CHECK_FUNCS([     \
        clock_gettime\
        epoll_create \
        epoll_pwait  \
        floor        \
        klogctl      \
        mallinfo     \
        memchr       \
        memset       \
        mkdir        \
        ppoll        \
        semtimedop   \
        signalfd     \
        syscall      \
        strchr       \
        strdup       \
        strpbrk      \
        strrchr      \
        strstr       \
        timerfd      \
        utimensat    \
        ])


# Do we have a useable MPI setup on the primary and/or secondary targets?
# On Linux, by default, assumes mpicc and -m32/-m64
# On AIX, by default, assumes mpxlc and -q32/-q64
# Note: this is a kludge in that it assumes the specified mpicc 
# understands -m32/-m64/-q32/-q64 regardless of what is specified using
# --with-mpicc=.
MPI_CC="mpicc"
if test x$VG_PLATFORM_PRI = xPPC32_AIX5 \
     -o x$VG_PLATFORM_PRI = xPPC64_AIX5 ; then
  MPI_CC="mpxlc"
fi

mflag_primary=
if test x$VG_PLATFORM_PRI = xX86_LINUX \
     -o x$VG_PLATFORM_PRI = xPPC32_LINUX ; then
  mflag_primary=$FLAG_M32
elif test x$VG_PLATFORM_PRI = xAMD64_LINUX \
       -o x$VG_PLATFORM_PRI = xPPC64_LINUX ; then
  mflag_primary=$FLAG_M64
elif test x$VG_PLATFORM_PRI = xPPC32_AIX5 ; then
  mflag_primary=-q32
elif test x$VG_PLATFORM_PRI = xPPC64_AIX5 ; then
  mflag_primary=-q64
fi

mflag_secondary=
if test x$VG_PLATFORM_SEC = xX86_LINUX \
     -o x$VG_PLATFORM_SEC = xPPC32_LINUX ; then
  mflag_secondary=$FLAG_M32
elif test x$VG_PLATFORM_SEC = xPPC32_AIX5 ; then
  mflag_secondary=-q32
fi


AC_ARG_WITH(mpicc,
   [  --with-mpicc=           Specify name of MPI2-ised C compiler],
   MPI_CC=$withval
)
AC_SUBST(MPI_CC)

## See if MPI_CC works for the primary target
##
AC_MSG_CHECKING([primary target for usable MPI2-compliant C compiler and mpi.h])
saved_CC=$CC
saved_CFLAGS=$CFLAGS
CC=$MPI_CC
CFLAGS=$mflag_primary
AC_TRY_LINK([
#include <mpi.h>
#include <stdio.h>
],[
  int r = MPI_Init(NULL,NULL);
  r |= MPI_Type_get_contents( MPI_INT, 0,0,0, NULL,NULL,NULL );
  return r; 
], [
ac_have_mpi2_pri=yes
AC_MSG_RESULT([yes, $MPI_CC])
], [
ac_have_mpi2_pri=no
AC_MSG_RESULT([no])
])
CC=$saved_CC
CFLAGS=$saved_CFLAGS
AM_CONDITIONAL(BUILD_MPIWRAP_PRI, test x$ac_have_mpi2_pri = xyes)

## See if MPI_CC works for the secondary target.  Complication: what if
## there is no secondary target?  We need this to then fail.
## Kludge this by making MPI_CC something which will surely fail in
## such a case.
##
AC_MSG_CHECKING([secondary target for usable MPI2-compliant C compiler and mpi.h])
saved_CC=$CC
saved_CFLAGS=$CFLAGS
if test x$VG_PLATFORM_SEC = x ; then
  CC="$MPI_CC this will surely fail"
else
  CC=$MPI_CC
fi
CFLAGS=$mflag_secondary
AC_TRY_LINK([
#include <mpi.h>
#include <stdio.h>
],[
  int r = MPI_Init(NULL,NULL);
  r |= MPI_Type_get_contents( MPI_INT, 0,0,0, NULL,NULL,NULL );
  return r; 
], [
ac_have_mpi2_sec=yes
AC_MSG_RESULT([yes, $MPI_CC])
], [
ac_have_mpi2_sec=no
AC_MSG_RESULT([no])
])
CC=$saved_CC
CFLAGS=$saved_CFLAGS
AM_CONDITIONAL(BUILD_MPIWRAP_SEC, test x$ac_have_mpi2_sec = xyes)


# -------------------- ok.  We're done. --------------------

AC_OUTPUT(
   Makefile 
   valgrind.spec
   valgrind.pc
   glibc-2.X.supp
   docs/Makefile 
   docs/lib/Makefile
   docs/images/Makefile
   docs/internals/Makefile
   docs/xml/Makefile
   tests/Makefile 
   tests/vg_regtest 
   perf/Makefile 
   perf/vg_perf
   include/Makefile 
   include/vki/Makefile 
   auxprogs/Makefile
   coregrind/Makefile 
   memcheck/Makefile
   memcheck/tests/Makefile
   memcheck/tests/amd64/Makefile
   memcheck/tests/ppc32/Makefile
   memcheck/tests/ppc64/Makefile
   memcheck/tests/x86/Makefile
   memcheck/docs/Makefile
   cachegrind/Makefile
   cachegrind/tests/Makefile
   cachegrind/tests/amd64/Makefile
   cachegrind/tests/ppc32/Makefile
   cachegrind/tests/ppc64/Makefile
   cachegrind/tests/x86/Makefile
   cachegrind/docs/Makefile
   cachegrind/cg_annotate
   callgrind/Makefile
   callgrind/callgrind_annotate
   callgrind/callgrind_control
   callgrind/tests/Makefile
   callgrind/docs/Makefile
   helgrind/Makefile
   helgrind/tests/Makefile
   helgrind/docs/Makefile
   massif/Makefile
   massif/tests/Makefile
   massif/perf/Makefile
   massif/docs/Makefile
   massif/ms_print
   lackey/Makefile
   lackey/tests/Makefile
   lackey/docs/Makefile
   none/Makefile
   none/tests/Makefile
   none/tests/amd64/Makefile
   none/tests/ppc32/Makefile
   none/tests/ppc64/Makefile
   none/tests/x86/Makefile
   none/docs/Makefile
   exp-omega/Makefile
   exp-omega/tests/Makefile
   exp-omega/docs/Makefile
   exp-drd/Makefile
   exp-drd/docs/Makefile
   exp-drd/tests/Makefile
) 

cat<<EOF

   Primary build target: ${VG_PLATFORM_PRI}
 Secondary build target: ${VG_PLATFORM_SEC}
     Default supp files: ${DEFAULT_SUPP}

EOF

cat<<EOF > default.supp
# This is a generated file, composed of the following suppression rules:
#
#      ${DEFAULT_SUPP}
#

EOF

for file in ${DEFAULT_SUPP} ; do
    cat ${srcdir}/$file >> default.supp
done