-
Notifications
You must be signed in to change notification settings - Fork 12
/
configure.in
1917 lines (1639 loc) · 50.9 KB
/
configure.in
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
##------------------------------------------------------------##
#
# 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.5.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 various 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_OBJC
AC_PROG_RANLIB
# If no AR variable was specified, look up the name of the archiver. Otherwise
# do not touch the AR variable.
if test "x$AR" = "x"; then
AC_PATH_PROGS([AR], [`echo $LD | sed 's/ld$/ar/'` "ar"], [ar])
fi
AC_ARG_VAR([AR],[Archiver command])
# 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, "/no/gdb/was/found/at/configure/time")
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)
])
# Check if 'diff' supports -u (universal diffs) and use it if possible.
AC_MSG_CHECKING([for diff -u])
AC_SUBST(DIFF)
# Comparing two identical files results in 0, unless -u isn't supported (as
# it's not on AIX).
tmpfile="tmp-xxx-yyy-zzz"
touch $tmpfile;
if diff -u $tmpfile $tmpfile ; then
AC_MSG_RESULT([yes])
DIFF="diff -u"
else
AC_MSG_RESULT([no])
DIFF="diff"
fi
rm $tmpfile
# 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
#----------------------------------------------------------------------------
# Arch/OS/platform tests.
#----------------------------------------------------------------------------
# We create a number of arch/OS/platform-related variables. We prefix them
# all with "VGCONF_" which indicates that they are defined at
# configure-time, and distinguishes them from the VGA_*/VGO_*/VGP_*
# variables used when compiling C files.
AC_CANONICAL_HOST
AC_MSG_CHECKING([for a supported CPU])
# ARCH_MAX reflects 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. It is used for more configuration below, but is not used
# outside this file.
case "${host_cpu}" in
i?86)
AC_MSG_RESULT([ok (${host_cpu})])
ARCH_MAX="x86"
;;
x86_64)
AC_MSG_RESULT([ok (${host_cpu})])
ARCH_MAX="amd64"
;;
powerpc64)
# This value can only happen on Linux, not on AIX
AC_MSG_RESULT([ok (${host_cpu})])
ARCH_MAX="ppc64"
;;
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.*)
ARCH_MAX="ppc64"
;;
*)
ARCH_MAX="ppc32"
;;
esac
;;
*)
AC_MSG_RESULT([no (${host_cpu})])
AC_MSG_ERROR([Unsupported host architecture. Sorry])
;;
esac
#----------------------------------------------------------------------------
# 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 :-)
# [Actually, if either of these options are used, I think both get built,
# but only one gets installed. So if you use an in-place build, both can be
# used. --njn]
# 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
#----------------------------------------------------------------------------
# VGCONF_OS is the primary build OS, eg. "linux". It is passed in to
# compilation of many C files via -VGO_$(VGCONF_OS) and
# -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
AC_MSG_CHECKING([for a supported OS])
AC_SUBST(VGCONF_OS)
DEFAULT_SUPP=""
case "${host_os}" in
*linux*)
AC_MSG_RESULT([ok (${host_os})])
VGCONF_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})])
VGCONF_OS="aix5"
;;
aix5.2.*)
AC_MSG_RESULT([ok (${host_os})])
VGCONF_OS="aix5"
;;
aix5.3.*)
AC_MSG_RESULT([ok (${host_os})])
VGCONF_OS="aix5"
;;
*freebsd*)
AC_MSG_RESULT([ok (${host_os})])
VGCONF_OS="freebsd"
;;
*darwin*)
AC_MSG_RESULT([ok (${host_os})])
VGCONF_OS="darwin"
AC_MSG_CHECKING([for the kernel version])
kernel=`uname -r`
# Nb: for Darwin we set DEFAULT_SUPP here. That's because Darwin
# has only one relevant version, the OS version. The `uname` check
# is a good way to get that version (i.e. "Darwin 9.6.0" is Mac OS
# X 10.5.6, and "Darwin 10.x" would presumably be Mac OS X 10.6.x
# Snow Leopard and darwin10.supp), and we don't know of an macros
# similar to __GLIBC__ to get that info.
#
# XXX: `uname -r` won't do the right thing for cross-compiles, but
# that's not a problem yet.
case "${kernel}" in
9.*)
AC_MSG_RESULT([Darwin 9.x (${kernel}) / Mac OS X 10.5 Leopard])
DEFAULT_SUPP="darwin9.supp ${DEFAULT_SUPP}"
;;
*)
AC_MSG_RESULT([unsupported (${kernel})])
AC_MSG_ERROR([Valgrind works on Darwin 9.x (Mac OS X 10.5)])
;;
esac
;;
*)
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 "$ARCH_MAX-$VGCONF_OS" in
amd64-linux|ppc64-linux)
AC_MSG_CHECKING([for 32 bit build support])
safe_CFLAGS=$CFLAGS
CFLAGS="-m32"
AC_TRY_LINK(, [
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
#----------------------------------------------------------------------------
# VGCONF_ARCH_PRI is the arch for the primary build target, eg. "amd64". By
# default it's the same as ARCH_MAX. But if, say, we do a build on an amd64
# machine, but --enable-only32bit has been requested, then ARCH_MAX (see
# above) will be "amd64" since that reflects the most that this cpu can do,
# but VGCONF_ARCH_PRI will be downgraded to "x86", since that reflects the
# arch corresponding to the primary build (VGCONF_PLATFORM_PRI_CAPS). It is
# passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_PRI) and
# -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
AC_SUBST(VGCONF_ARCH_PRI)
# VGCONF_ARCH_SEC is the arch for the secondary build target, eg. "x86".
# It is passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_SEC)
# and -VGP_$(VGCONF_ARCH_SEC)_$(VGCONF_OS), if there is a secondary target.
# It is empty if there is no secondary target.
AC_SUBST(VGCONF_ARCH_SEC)
# VGCONF_PLATFORM_PRI_CAPS is the primary build target, eg. "AMD64_LINUX".
# The entire system, including regression and performance tests, will be
# built for this target. The "_CAPS" indicates that the name is in capital
# letters, and it also uses '_' rather than '-' as a separator, because it's
# used to create various Makefile variables, which are all in caps by
# convention and cannot contain '-' characters. This is in contrast to
# VGCONF_ARCH_PRI and VGCONF_OS which are not in caps.
AC_SUBST(VGCONF_PLATFORM_PRI_CAPS)
# VGCONF_PLATFORM_SEC_CAPS is the secondary build target, if there is one.
# Valgrind and tools will also be built for this target, but not the
# regression or performance tests.
#
# By default, the primary arch is the same as the "max" arch, as commented
# above (at the definition of ARCH_MAX). We may choose to downgrade it in
# the big case statement just below here, in the case where we're building
# on a 64 bit machine but have been requested only to do a 32 bit build.
AC_SUBST(VGCONF_PLATFORM_SEC_CAPS)
AC_MSG_CHECKING([for a supported CPU/OS combination])
case "$ARCH_MAX-$VGCONF_OS" in
x86-linux)
VGCONF_ARCH_PRI="x86"
VGCONF_ARCH_SEC=""
VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
VGCONF_PLATFORM_SEC_CAPS=""
valt_load_address_normal="0x38000000"
valt_load_address_inner="0x28000000"
AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
;;
amd64-linux)
if test x$vg_cv_only64bit = xyes; then
VGCONF_ARCH_PRI="amd64"
VGCONF_ARCH_SEC=""
VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
VGCONF_PLATFORM_SEC_CAPS=""
elif test x$vg_cv_only32bit = xyes; then
VGCONF_ARCH_PRI="x86"
VGCONF_ARCH_SEC=""
VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
VGCONF_PLATFORM_SEC_CAPS=""
else
VGCONF_ARCH_PRI="amd64"
VGCONF_ARCH_SEC="x86"
VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
VGCONF_PLATFORM_SEC_CAPS="X86_LINUX"
fi
valt_load_address_normal="0x38000000"
valt_load_address_inner="0x28000000"
AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
;;
ppc32-linux)
VGCONF_ARCH_PRI="ppc32"
VGCONF_ARCH_SEC=""
VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
VGCONF_PLATFORM_SEC_CAPS=""
valt_load_address_normal="0x38000000"
valt_load_address_inner="0x28000000"
AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
;;
ppc64-aix5)
if test x$vg_cv_only64bit = xyes; then
VGCONF_ARCH_PRI="ppc64"
VGCONF_ARCH_SEC=""
VGCONF_PLATFORM_PRI_CAPS="PPC64_AIX5"
VGCONF_PLATFORM_SEC_CAPS=""
elif test x$vg_cv_only32bit = xyes; then
VGCONF_ARCH_PRI="ppc32"
VGCONF_ARCH_SEC=""
VGCONF_PLATFORM_PRI_CAPS="PPC32_AIX5"
VGCONF_PLATFORM_SEC_CAPS=""
else
VGCONF_ARCH_PRI="ppc64"
VGCONF_ARCH_SEC="ppc32"
VGCONF_PLATFORM_PRI_CAPS="PPC64_AIX5"
VGCONF_PLATFORM_SEC_CAPS="PPC32_AIX5"
fi
valt_load_address_normal="0x38000000"
valt_load_address_inner="0x28000000"
AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
;;
ppc64-linux)
if test x$vg_cv_only64bit = xyes; then
VGCONF_ARCH_PRI="ppc64"
VGCONF_ARCH_SEC=""
VGCONF_PLATFORM_PRI_CAPS="PPC64_LINUX"
VGCONF_PLATFORM_SEC_CAPS=""
elif test x$vg_cv_only32bit = xyes; then
VGCONF_ARCH_PRI="ppc32"
VGCONF_ARCH_SEC=""
VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
VGCONF_PLATFORM_SEC_CAPS=""
else
VGCONF_ARCH_PRI="ppc64"
VGCONF_ARCH_SEC="ppc32"
VGCONF_PLATFORM_PRI_CAPS="PPC64_LINUX"
VGCONF_PLATFORM_SEC_CAPS="PPC32_LINUX"
fi
valt_load_address_normal="0x38000000"
valt_load_address_inner="0x28000000"
AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
;;
x86-darwin)
VGCONF_ARCH_PRI="x86"
VGCONF_ARCH_SEC=""
VGCONF_PLATFORM_PRI_CAPS="X86_DARWIN"
VGCONF_PLATFORM_SEC_CAPS=""
valt_load_address_normal="0x0"
valt_load_address_inner="0x0"
AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
;;
amd64-darwin)
if test x$vg_cv_only64bit = xyes; then
VGCONF_ARCH_PRI="amd64"
VGCONF_ARCH_SEC=""
VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
VGCONF_PLATFORM_SEC_CAPS=""
elif test x$vg_cv_only32bit = xyes; then
VGCONF_ARCH_PRI="x86"
VGCONF_ARCH_SEC=""
VGCONF_PLATFORM_PRI_CAPS="X86_DARWIN"
VGCONF_PLATFORM_SEC_CAPS=""
VGCONF_ARCH_PRI_CAPS="x86"
else
VGCONF_ARCH_PRI="amd64"
VGCONF_ARCH_SEC="x86"
VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
VGCONF_PLATFORM_SEC_CAPS="X86_DARWIN"
fi
valt_load_address_normal="0x0"
valt_load_address_inner="0x0"
AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
;;
*)
VGCONF_ARCH_PRI="unknown"
VGCONF_ARCH_SEC="unknown"
VGCONF_PLATFORM_PRI_CAPS="UNKNOWN"
VGCONF_PLATFORM_SEC_CAPS="UNKNOWN"
AC_MSG_RESULT([no (${ARCH_MAX}-${VGCONF_OS})])
AC_MSG_ERROR([Valgrind is platform specific. Sorry. Please consider doing a port.])
;;
esac
#----------------------------------------------------------------------------
# Set up VGCONF_ARCHS_INCLUDE_<arch>. Either one or two of these become
# defined.
AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_X86,
test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
-o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
-o x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
-o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN )
AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_AMD64,
test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
-o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN )
AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC32,
test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
-o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX \
-o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
-o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_AIX5 )
AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC64,
test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \
-o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5 )
# Set up VGCONF_PLATFORMS_INCLUDE_<platform>. Either one or two of these
# become defined.
AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_LINUX,
test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
-o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX)
AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_LINUX,
test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX)
AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC32_LINUX,
test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
-o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX)
AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64_LINUX,
test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX)
AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC32_AIX5,
test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
-o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_AIX5)
AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64_AIX5,
test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5)
AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_DARWIN,
test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
-o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN)
AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_DARWIN,
test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
# Similarly, set up VGCONF_OF_IS_<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(VGCONF_OS_IS_LINUX,
test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
-o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
-o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
-o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX)
AM_CONDITIONAL(VGCONF_OS_IS_AIX5,
test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
-o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5)
AM_CONDITIONAL(VGCONF_OS_IS_DARWIN,
test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
-o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
# Sometimes, in the Makefile.am files, it's useful to know whether or not
# there is a secondary target.
AM_CONDITIONAL(VGCONF_HAVE_PLATFORM_SEC,
test x$VGCONF_PLATFORM_SEC_CAPS != x)
#----------------------------------------------------------------------------
# Inner Valgrind?
#----------------------------------------------------------------------------
# Check if this should be built as an inner Valgrind, to be run within
# another Valgrind. Choose the load address accordingly.
AC_SUBST(VALT_LOAD_ADDRESS)
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
#----------------------------------------------------------------------------
# Libc and suppressions
#----------------------------------------------------------------------------
# This variable will collect the suppression files to be used.
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([GLIBC_29], [
#include <features.h>
#ifdef __GNU_LIBRARY__
#if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 9)
GLIBC_29
#endif
#endif
],
GLIBC_VERSION="2.9")
AC_EGREP_CPP([GLIBC_210], [
#include <features.h>
#ifdef __GNU_LIBRARY__
#if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 10)
GLIBC_210
#endif
#endif
],
GLIBC_VERSION="2.10")
AC_EGREP_CPP([AIX5_LIBC], [
#include <standards.h>
#if defined(_AIXVERSION_510) || defined(_AIXVERSION_520) || defined(_AIXVERSION_530)
AIX5_LIBC
#endif
],
GLIBC_VERSION="aix5")
# not really a version check
AC_EGREP_CPP([DARWIN_LIBC], [
#include <sys/cdefs.h>
#if defined(__DARWIN_VERS_1050)
DARWIN_LIBC
#endif
],
GLIBC_VERSION="darwin")
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}"
;;
2.9)
AC_MSG_RESULT(2.9 family)
AC_DEFINE([GLIBC_2_9], 1, [Define to 1 if you're using glibc 2.9.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.10)
AC_MSG_RESULT(2.10 family)
AC_DEFINE([GLIBC_2_10], 1, [Define to 1 if you're using glibc 2.10.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}"
;;
darwin)
AC_MSG_RESULT(Darwin)
AC_DEFINE([DARWIN_LIBC], 1, [Define to 1 if you're using Darwin])
# DEFAULT_SUPP set by kernel version check above.
;;
*)
AC_MSG_RESULT(unsupported version)
AC_MSG_ERROR([Valgrind requires glibc version 2.2 - 2.10])
AC_MSG_ERROR([or AIX 5.1 or 5.2 or 5.3 GLIBC_VERSION])
AC_MSG_ERROR([or Darwin libc])
;;
esac
AC_SUBST(GLIBC_VERSION)
# Add default suppressions for the X client libraries. Make no
# attempt to detect whether such libraries are installed on the
# build machine (or even if any X facilities are present); just
# add the suppressions antidisirregardless.
DEFAULT_SUPP="xfree-4.supp ${DEFAULT_SUPP}"
DEFAULT_SUPP="xfree-3.supp ${DEFAULT_SUPP}"
# Add glibc and X11 suppressions for exp-ptrcheck
DEFAULT_SUPP="exp-ptrcheck.supp ${DEFAULT_SUPP}"
#----------------------------------------------------------------------------
# Checking for various library functions and other definitions
#----------------------------------------------------------------------------
# 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 -maltivec and does it have the include file
# <altivec.h> ?
AC_MSG_CHECKING([for Altivec])
safe_CFLAGS=$CFLAGS
CFLAGS="-maltivec"
AC_TRY_COMPILE(
[
#include <altivec.h>
], [
vector unsigned int v;
],
[
ac_have_altivec=yes
AC_MSG_RESULT([yes])
], [
ac_have_altivec=no
AC_MSG_RESULT([no])
])
CFLAGS=$safe_CFLAGS
AM_CONDITIONAL([HAS_ALTIVEC], [test x$ac_have_altivec = xyes])
AM_CONDITIONAL([HAVE_ALTIVEC_H], [test x$ac_have_altivec = xyes])
# Check for pthread_create@GLIBC2.0
AC_MSG_CHECKING([for pthread_create@GLIBC2.0()])
safe_CFLAGS=$CFLAGS
CFLAGS="-lpthread"
AC_TRY_LINK(
[
extern int pthread_create_glibc_2_0(void*, const void*,
void *(*)(void*), void*);
__asm__(".symver pthread_create_glibc_2_0, pthread_create@GLIBC_2.0");
], [
#ifdef __powerpc__
/*
* Apparently on PowerPC linking this program succeeds and generates an
* executable with the undefined symbol pthread_create@GLIBC_2.0.
*/
#error This test does not work properly on PowerPC.
#else
pthread_create_glibc_2_0(0, 0, 0, 0);
#endif
return 0;
],
[
ac_have_pthread_create_glibc_2_0=yes
AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_PTHREAD_CREATE_GLIBC_2_0], 1,
[Define to 1 if you have the `pthread_create@glibc2.0' function.])
], [