~ubuntu-branches/ubuntu/intrepid/gcc-4.3/intrepid-updates

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
# -*- makefile -*-
# definitions used in more than one Makefile / rules file

SHELL		= /bin/bash -e	# brace expansion used in rules file
PWD		:= $(shell pwd)
srcdir		= $(PWD)/src
builddir	= $(PWD)/build
builddir_hppa64	= $(PWD)/build-hppa64
builddir_ia6432	= $(PWD)/build-ia6432
builddir_spu	= $(PWD)/build-spu
stampdir	= stamps
distribution	:= $(shell lsb_release -is)

# architecture dependent variables
vafilt = $(subst $(2)=,,$(filter $(2)=%,$(1)))

DPKG_VARS		:= $(shell dpkg-architecture)
DEB_BUILD_GNU_TYPE	?= $(call vafilt,$(DPKG_VARS),DEB_BUILD_GNU_TYPE)
DEB_HOST_ARCH		?= $(call vafilt,$(DPKG_VARS),DEB_HOST_ARCH)
DEB_HOST_GNU_CPU	?= $(call vafilt,$(DPKG_VARS),DEB_HOST_GNU_CPU)
DEB_HOST_GNU_SYSTEM	?= $(call vafilt,$(DPKG_VARS),DEB_HOST_GNU_SYSTEM)
DEB_HOST_GNU_TYPE	?= $(call vafilt,$(DPKG_VARS),DEB_HOST_GNU_TYPE)

ifdef DEB_TARGET_GNU_TYPE
  TARGET_VARS := $(shell dpkg-architecture -f \
			-t$(DEB_TARGET_GNU_TYPE) 2>/dev/null)
  DEB_TARGET_ARCH	?= $(call vafilt,$(TARGET_VARS),DEB_HOST_ARCH)
  DEB_TARGET_ARCH_OS	?= $(call vafilt,$(TARGET_VARS),DEB_HOST_ARCH_OS)
  DEB_TARGET_ARCH_CPU	?= $(call vafilt,$(TARGET_VARS),DEB_HOST_ARCH_CPU)
  DEB_TARGET_GNU_CPU	?= $(call vafilt,$(TARGET_VARS),DEB_HOST_GNU_CPU)
  DEB_TARGET_GNU_TYPE	?= $(call vafilt,$(TARGET_VARS),DEB_HOST_GNU_TYPE)
  DEB_TARGET_GNU_SYSTEM	?= $(call vafilt,$(TARGET_VARS),DEB_HOST_GNU_SYSTEM)
else

  # allow debian/target to be used instead of GCC_TARGET - this was requested
  # by toolchain-source maintainer
  DEBIAN_TARGET_FILE := $(strip $(if $(wildcard debian/target), \
				  $(shell cat debian/target 2>/dev/null)))

  ifdef DEB_TARGET_ARCH
    # empty
  else ifdef GCC_TARGET
    DEB_TARGET_ARCH = $(GCC_TARGET)
  else ifneq ($(DEBIAN_TARGET_FILE),)
    DEB_TARGET_ARCH := $(DEBIAN_TARGET_FILE)
  else
    DEB_TARGET_ARCH = $(DEB_HOST_ARCH)
  endif

  TARGET_VARS := $(shell dpkg-architecture -f \
			-a$(DEB_TARGET_ARCH) 2>/dev/null)
  DEB_TARGET_ARCH	?= $(call vafilt,$(TARGET_VARS),DEB_HOST_ARCH)
  DEB_TARGET_ARCH_OS	?= $(call vafilt,$(TARGET_VARS),DEB_HOST_ARCH_OS)
  DEB_TARGET_ARCH_CPU	?= $(call vafilt,$(TARGET_VARS),DEB_HOST_ARCH_CPU)
  DEB_TARGET_GNU_CPU	?= $(call vafilt,$(TARGET_VARS),DEB_HOST_GNU_CPU)
  DEB_TARGET_GNU_TYPE	?= $(call vafilt,$(TARGET_VARS),DEB_HOST_GNU_TYPE)
  DEB_TARGET_GNU_SYSTEM	?= $(call vafilt,$(TARGET_VARS),DEB_HOST_GNU_SYSTEM)
endif

# ---------------------------------------------------------------------------
# full canadian
# typical cross-compiler
# reverse cross (built to run on the target)
# native
#
# build != host && host == target : reverse cross (REVERSE_CROSS == yes)
# build == host && host != target : typical cross (DEB_CROSS == yes)
# build != host && host != target : canadian (DEB_CROSS == yes)
# build == host && host == target : native
ifneq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
 ifneq ($(DEB_HOST_GNU_TYPE), $(DEB_TARGET_GNU_TYPE))
	DEB_CROSS = yes
 else
	REVERSE_CROSS = yes
 endif
 else
 ifneq ($(DEB_HOST_GNU_TYPE), $(DEB_TARGET_GNU_TYPE))
	DEB_CROSS = yes
 endif  
endif

# ---------------------------------------------------------------------------
# which binary packages are built?

# cross compiler support. If GCC_TARGET is set, then it's the architecture
# we build for.

ifeq ($(DEB_TARGET_ARCH),)
$(error GCC_TARGET value "$(GCC_TARGET)" is not a valid Debian architecture)
endif

ifeq ($(DEB_CROSS),yes)
  # TP: Target Prefix. Used primarily as a prefix for cross tool
  #     names (e.g. powerpc-linux-gcc).
  # TS: Target Suffix. Used primarily at the end of cross compiler
  #     package names (e.g. gcc-powerpc).
  # LS: Library Suffix. Used primarily at the end of cross compiler
  #     library package names (e.g. libgcc-powerpc-cross).
  DEB_TARGET_ALIAS ?= $(DEB_TARGET_GNU_TYPE)
  TP =  $(subst _,-,$(DEB_TARGET_GNU_TYPE))-
  TS = -$(subst _,-,$(DEB_TARGET_ALIAS))
  LS = -$(subst _,-,$(DEB_TARGET_ARCH))-cross
endif

ifeq ($(DEB_CROSS),yes)
  TARGET_ALIAS := $(DEB_TARGET_ALIAS)
else
  TARGET_ALIAS := $(DEB_TARGET_GNU_TYPE)

  ifeq ($(TARGET_ALIAS),i386-gnu)
    TARGET_ALIAS := i586-gnu
  endif

  #ifeq ($(TARGET_ALIAS),i486-linux-gnu)
  #  TARGET_ALIAS := i686-linux-gnu
  #endif

  TARGET_ALIAS := $(subst i386,i486,$(TARGET_ALIAS))

  # configure as linux-gnu, not linux
  #ifeq ($(findstring linux,$(TARGET_ALIAS))/$(findstring linux-gnu,$(TARGET_ALIAS)),linux/)
  #  TARGET_ALIAS := $(TARGET_ALIAS)-gnu
  #endif

  # configure as linux, not linux-gnu
  #TARGET_ALIAS := $(subst linux-gnu,linux,$(TARGET_ALIAS))
endif

printarch:
	@echo DEB_TARGET_ARCH: $(DEB_TARGET_ARCH)
	@echo DEB_TARGET_ARCH_OS: $(DEB_TARGET_ARCH_OS)
	@echo DEB_TARGET_ARCH_CPU: $(DEB_TARGET_ARCH_CPU)
	@echo DEB_TARGET_ARCH_CPU: $(DEB_TARGET_ARCH_CPU)
	@echo DEB_TARGET_GNU_SYSTEM: $(DEB_TARGET_GNU_SYSTEM)
	@echo TARGET_ALIAS: $(TARGET_ALIAS)
	@echo TP: $(TP)
	@echo TS: $(TS)

# The name of the source package
CHANGELOG_VARS := $(shell dpkg-parsechangelog | sed -n 's/ /_/g;/^[^_]/s/^\([^:]*\):_\(.*\)/\1=\2/p')
PKGSOURCE := $(call vafilt,$(CHANGELOG_VARS),Source)

ifneq ($(PKGSOURCE),gcc-snapshot)
  versioned_packages := yes
endif

ifeq ($(DEB_CROSS),yes)
  cross_bin_arch := -$(subst _,-,$(TARGET_ALIAS))
  cross_lib_arch := -$(subst _,-,$(DEB_TARGET_ARCH))-cross
endif

ifneq ($(DEB_CROSS),yes)
  ifneq ($(PKGSOURCE),gcc-snapshot)
    with_common_gcclibdir := yes
  endif
endif

# Don't include docs with GFDL invariant sections --------------------
GFDL_INVARIANT_FREE := yes
ifeq ($(distribution),Ubuntu)
  GFDL_INVARIANT_FREE=no
endif

# --------------------
# Configuration of components

COMMA = ,
SPACE = $(EMPTY) $(EMPTY)

# lang= overwrites all of nolang=, overwrites all of WITHOUT_LANG

DEB_LANG_OPT	:= $(filter lang=%,$(DEB_BUILD_OPTIONS))
DEB_LANG	:= $(strip $(subst $(COMMA), ,$(patsubst lang=%,%,$(DEB_LANG_OPT))))
DEB_NOLANG_OPT	:= $(filter nolang=%,$(DEB_BUILD_OPTIONS))
DEB_NOLANG	:= $(strip $(subst $(COMMA), ,$(patsubst nolang=%,%,$(DEB_NOLANG_OPT))))
lfilt	= $(strip $(if $(DEB_LANG), \
		$(if $(filter $(1) $(2),$(DEB_LANG)),yes),$(3)))
nlfilt	= $(strip $(if $(DEB_NOLANG), \
		$(if $(filter $(1) $(2),$(DEB_NOLANG)),disabled by $(DEB_NOLANG_OPT),$(3))))
wlfilt	= $(strip $(if $(filter $(1) $(2), $(subst $(COMMA), ,$(WITHOUT_LANG))), \
		disabled by WITHOUT_LANG=$(WITHOUT_LANG),$(3)))
envfilt	= $(strip $(or $(call lfilt,$(1),$(2)),$(call nlfilt,$(1),$(3)),$(call wlfilt,$(1),$(3)),$(4)))

# common things --------------------
# build common packages, where package names don't differ in different
# gcc versions (fixincludes, libgcj-common) ...
with_common_pkgs := yes

# ... and some libraries, which do not change (libgcc1, libmudflap, libssp0).
with_common_libs := yes

#ifeq ($(distribution),Debian)
#  next_gcc_not_built := alpha m68k mips mipsel hurd-i386 kfreebsd-i386 kfreebsd-amd64
#  ifneq (,$(filter $(DEB_TARGET_ARCH),$(next_gcc_not_built)))
#    with_common_pkgs := yes
#    with_common_libs := yes
#  endif
#endif
#ifeq ($(distribution),Ubuntu)
#  with_common_pkgs := yes
#  with_common_libs := yes
#endif

with_gccbase := yes
with_dev := yes

with_source := no
ifneq (,$(findstring gcc-4,$(PKGSOURCE)))
  with_source := yes
endif
with_source := $(call envfilt, source, , , $(with_source))

ifeq ($(PKGSOURCE),gcc-snapshot)
  with_nls := no
else
  with_nls := yes
endif
with_nls := $(call envfilt, nls, , , $(with_nls))

ifneq ($(WITH_BOOTSTRAP),)
  # "yes" is the default and causes a 3-stage bootstrap.
  # "no" means to just build the first stage, and not create the stage1
  # directory.
  # "lean" means a lean 3-stage bootstrap, i.e. delete each stage when no
  # longer needed.
  with_bootstrap=$(WITH_BOOTSTRAP)
endif

# separate -base package for the cross compiler.
ifeq ($(DEB_CROSS),yes)
  with_gccxbase := yes
endif

#no_dummy_cpus := ia64 i386 hppa s390 sparc
#with_base_only := yes
#ifneq (, $(filter $(DEB_TARGET_ARCH_CPU),$(no_dummy_cpus)))
#  with_base_only := no
#  with_common_libs := yes
#  with_common_pkgs := yes
#else
#  with_common_libs := no
#  with_common_pkgs := no
#  with_dev := no
#endif

# C --------------------
enabled_languages := c
# Build all packages needed for C development
ifeq ($(with_base_only),yes)
  with_cdev := no
else
  ifeq ($(with_dev),yes)
    with_cdev := yes
  else
    with_cdev := no
  endif
endif

# C++ --------------------
ifeq ($(with_base_only),yes)
  with_cxx := no
else
  with_cxx := yes
endif
no_cxx_cpus := avr
ifneq (, $(filter $(DEB_TARGET_ARCH_CPU),$(no_cxx_cpus)))
  with_cxx := disabled for architecture $(DEB_TARGET_ARCH_CPU)
endif
with_cxx := $(call envfilt, c++, obj-c++ java, , $(with_cxx))

# Build all packages needed for C++ development
ifeq ($(with_cxx)-$(with_dev),yes-yes)
  with_cxxdev := yes
  with_libcxxdbg := yes
else
  with_cxxdev := no
  with_libcxxdbg := no
endif

ifeq ($(with_cxx),yes)
  enabled_languages += c++
endif

ifeq ($(with_common_pkgs)-$(with_cxx),yes-yes)
  with_libcxx := yes
#  ifeq ($(DEB_TARGET_ARCH_CPU),arm)
#    with_libcxx := no
#  endif
else
  with_libcxx := no
endif

# debugging versions of libstdc++
ifeq ($(with_cxxdev),yes)
  with_debug := yes
else
  with_debug := no
endif
debug_no_cpus :=
ifneq (, $(filter $(DEB_TARGET_ARCH_CPU),$(debug_no_cpus)))
    with_debug := disabled for architecure $(DEB_TARGET_ARCH_CPU)
endif
with_debug := $(call envfilt, debug, , , $(with_debug))

# Java --------------------
# - To build a standalone gcj package (with no corresponding gcc
#   package): with_separate_libgcj=yes, with_standalone_gcj=yes
# - To build the java packages from the gcc source package:
#   with_separate_libgcj=no, with_standalone_gcj=no
# - To build gcc and java from separate sources:
#   with_separate_libgcj=yes, with_standalone_gcj=no

with_separate_libgcj := yes
with_standalone_gcj := no

# java converted for V3 C++ ABI for some archs
ifeq ($(with_base_only),yes)
  with_java := no
else
  with_java := yes
endif

ifneq (,$(findstring gcj-4, $(PKGSOURCE)))
  ifneq (,$(filter $(DEB_TARGET_ARCH), alpha arm hppa))
    with_gcj_base_only := yes
  endif
endif

java_no_cpus := #mips mipsel
java_no_arches :=
java_no_systems :=
gcj_native_archs = alpha amd64 i386 ia64 m68k mips mipsel powerpc s390 sparc

ifneq (, $(filter $(DEB_TARGET_ARCH_CPU),$(java_no_cpus)))
  with_java := disabled for architecture $(DEB_TARGET_ARCH_CPU)
endif
ifneq (, $(filter $(DEB_TARGET_GNU_SYSTEM),$(java_no_systems)))
  with_java := disabled for $(DEB_TARGET_GNU_SYSTEM)
endif
ifneq (, $(filter $(DEB_TARGET_ARCH),$(java_no_arches)))
  with_java := disabled for $(DEB_TARGET_ARCH)
endif
ifeq ($(DEB_CROSS),yes)
  with_java := disabled for cross compiler package
endif
with_java := $(call envfilt, java, , c++, $(with_java))

#ifneq (,$(filter $(DEB_TARGET_ARCH),hppa))
#  with_native_ecj := yes
#endif

with_java_maintainer_mode := yes
with_java_maintainer_mode := no

ifeq ($(distribution),Ubuntu)
  java_plugin_backend = xulrunner-1.9
else
  java_plugin_backend = xulrunner
endif

browser_plugin_dirs = xulrunner-addons firefox iceape iceweasel mozilla midbrowser xulrunner

# used as well in debian/rules.conf to determine the build deps
java_awt_peers = gtk # qt # xlib

with_libgcjbc := no
with_libgcj_doc := yes
ifneq ($(with_common_libs),yes)
  with_libgcj_doc := no
endif

# Build all packages needed for Java development (gcj, libgcj-dev)
ifeq ($(with_java)-$(with_dev),yes-yes)
  with_javadev := yes
  with_gcj := yes
else
  with_javadev := no
endif

ifeq ($(with_java),yes)
  java_plugin_no_cpus := none
  with_java_plugin := yes
  ifneq (, $(filter $(DEB_TARGET_ARCH),$(java_plugin_no_cpus)))
    with_java_plugin := disabled for $(DEB_TARGET_ARCH)
  endif
  ifeq ($(distribution),Ubuntu)
    with_pkg_plugin := yes
  endif
endif

ifeq ($(with_java),yes)
  with_java_alsa := yes
  ifneq (,$(filter $(DEB_TARGET_GNU_SYSTEM), kfreebsd-gnu gnu))
    with_java_alsa := no
  endif
endif

ifeq ($(with_java),yes)
  enabled_languages += java
  with_libgcj := yes
else
  with_libgcj := no
endif

# libmudflap -------------------
with_mudflap := yes
with_mudflap := $(call envfilt, mudflap, , , $(with_mudflap))
ifeq ($(with_mudflap),yes)
  with_libmudflap := yes
endif
ifneq ($(with_common_libs),yes)
  with_libmudflap := no
endif

# libssp -------------------
with_ssp := yes
ssp_no_archs = arm armel alpha hppa ia64 m68k mips mipsel
ifneq (, $(filter $(DEB_TARGET_ARCH),$(ssp_no_archs)))
  with_ssp := not available on $(DEB_TARGET_ARCH)
endif
with_ssp := $(call envfilt, ssp, , , $(with_ssp))

ifeq ($(with_ssp),yes)
  ifneq ($(distribution),Debian)
    ifneq (,$(findstring gcc-4, $(PKGSOURCE)))
      with_ssp_default := yes
    endif
  endif
endif

# do it here, the information is only available after gcc is configured
ifeq ($(with_common_libs),yes)
  ifeq ($(with_ssp),yes)
    with_libssp := $(if $(wildcard $(builddir)/gcc/auto-host.h), \
	             $(shell if grep -qs '^\#define TARGET_LIBC_PROVIDES_SSP 1' $(builddir)/gcc/auto-host.h; then echo 'libc provides ssp'; else echo 'yes'; fi))
  endif
endif

# Fortran 95 --------------------
ifeq ($(with_base_only),yes)
  with_fortran := no
else
  with_fortran := yes
endif

f95_no_cpus :=
ifneq (, $(filter $(DEB_TARGET_ARCH_CPU),$(f95_no_cpus)))
    with_fortran := disabled for architecure $(DEB_TARGET_ARCH_CPU)
endif
ifeq ($(DEB_CROSS),yes)
  with_fortran := disabled for cross compiler package
endif
ifeq (f95, $(findstring f95,$(WITHOUT_LANG)))
  with_fortran := disabled by environment
endif
with_fortran := $(call envfilt, fortran, , , $(with_fortran))

# Build all packages needed for Fortran development
ifeq ($(with_fortran)-$(with_dev),yes-yes)
  with_fdev := yes
else
  with_fdev := no
endif

ifeq ($(with_common_libs)-$(with_fortran),yes-yes)
  with_libfortran := yes
else
  with_libfortran := no
endif

ifeq ($(with_fortran),yes)
  enabled_languages += fortran
endif

# protoize --------------------
ifeq ($(with_common_pkgs),yes)
  with_proto := yes
  ifeq ($(DEB_CROSS),yes)
    with_proto := disabled for cross compiler package
  endif
else
  with_proto := no
endif
#ifeq ($(with_proto),yes)
#  enabled_languages += proto
#endif

ifeq ($(with_common_pkgs),yes)
  with_fixincl := yes
  ifeq ($(DEB_CROSS),yes)
    with_fixincl := disabled for cross compiler package
  endif
else
  with_fixincl := no
endif

# Pascal --------------------

with_separate_gpc := yes

with_pascal := yes
ifneq ($(with_dev),yes)
  with_pascal := no
endif

pascal_no_systems :=
#ifneq (, $(filter $(DEB_TARGET_GNU_SYSTEM),$(pascal_no_systems)))
#  with_pascal := disabled for $(DEB_TARGET_GNU_SYSTEM)
#endif
ifneq ($(DEB_TARGET_ARCH),i386)
  with_pascal := disabled for $(DEB_TARGET_ARCH)
endif
ifeq (,$(findstring gpc, $(PKGSOURCE)))
  with_pascal := disabled, built by separate source
endif

with_gpidump := yes
ifneq (, $(filter $(DEB_TARGET_ARCH_CPU),mips mipsel))
  with_gpidump := disabled for architecture $(DEB_TARGET_ARCH_CPU)
endif
pascal_version := 20030830
ifeq (pascal, $(findstring pascal,$(WITHOUT_LANG)))
  with_pascal := disabled by environment
endif
with_pascal := disabled for 4.3
ifeq ($(DEB_CROSS),yes)
  with_pascal := disabled for cross compiler package
endif
ifeq ($(with_pascal),yes)
  enabled_languages += pascal
endif

# ObjC --------------------
ifeq ($(with_base_only),yes)
  with_objc := no
else
  with_objc := yes
endif
# the ObjC runtime with garbage collection enabled needs the Boehm GC
with_objc_gc := yes

# disable ObjC garbage collection library (needs libgc)
libgc_no_cpus := avr #alpha amd64 arm armel hppa i386 ia64 m68k mips mipsel powerpc s390 sparc
libgc_no_systems :=
ifneq (, $(filter $(DEB_TARGET_ARCH_CPU),$(libgc_no_cpus)))
  with_objc_gc := disabled for architecture $(DEB_TARGET_ARCH_CPU)
endif
ifneq (, $(filter $(DEB_TARGET_GNU_SYSTEM),$(libgc_no_systems)))
  with_objc_gc := disabled for $(DEB_TARGET_GNU_SYSTEM)
endif
ifeq ($(DEB_CROSS),yes)
  ifneq (objc, $(findstring objc,$(WITH_LANG)))
    with_objc := disabled for cross compiler package
  endif
endif
with_objc := $(call envfilt, objc, obj-c++, , $(with_objc))

ifneq ($(with_objc),yes)
  with_objc_gc := $(with_objc)
endif

# Build all packages needed for Objective-C development
ifeq ($(with_objc)-$(with_dev),yes-yes)
  with_objcdev := yes
else
  with_objcdev := no
endif
ifeq ($(with_common_libs)-$(with_objc),yes-yes)
  with_libobjc := yes
else
  with_libobjc := no
endif

ifeq ($(with_objc),yes)
  enabled_languages += objc
endif

# ObjC++ --------------------
with_objcxx := yes
with_objcxx := $(call envfilt, obj-c++, , c++ objc, $(with_objcxx))

ifeq ($(with_objcxx),yes)
  enabled_languages += obj-c++
endif

# Ada --------------------
with_separate_gnat := yes
with_ada := yes
ifneq ($(with_dev),yes)
  with_ada := no
endif

ada_no_cpus := alpha arm armel m32r m68k mips mipsel sh3 sh3eb sh4 sh4eb
ada_no_systems := hurd-i386
ifneq (, $(filter $(DEB_TARGET_ARCH_CPU),$(ada_no_cpus)))
  with_ada := disabled for architecure $(DEB_TARGET_ARCH_CPU)
endif
ifneq (, $(filter $(DEB_TARGET_GNU_SYSTEM),$(ada_no_systems)))
  with_ada := disabled for $(DEB_TARGET_GNU_SYSTEM)
endif
ifeq ($(DEB_TARGET_ARCH),hurd-i386)
  with_ada := disabled for architecure $(DEB_TARGET_ARCH)
endif
with_ada := $(call envfilt, ada, , , $(with_ada))
ifeq ($(DEB_CROSS),yes)
  with_ada := disabled for cross compiler package
endif
#ifeq ($(PKGSOURCE),gcc-snapshot)
#  with_ada := disabled for snapshot builds
#endif
ifneq (,$(findstring 4.3,$(PKGSOURCE)))
  with_ada := disabled for gcc-4.3
endif

with_libgnat := $(with_ada)
ifeq ($(with_ada),yes)
  enabled_languages += ada
  libada_shared_dual_cpus := hppa
  ifneq (, $(filter $(DEB_TARGET_ARCH_CPU),$(libada_shared_dual_cpus)))
    with_libgnat_shared_dual := yes
  endif
else
  with_libgnat_shared_dual := no
endif

# D -------------------------

with_separate_gdc := yes

ifeq ($(with_base_only),yes)
  with_d := no
else
  with_d := yes
endif
with_d := $(call envfilt, d, , c++, $(with_d))
with_d := disabled for gcc-4.3

ifeq ($(with_d),yes)
  enabled_languages += d
endif

# Shared libgcc --------------------
with_shared_libgcc := yes

ifeq ($(with_common_libs),yes)
  with_libgcc := yes
else
  with_libgcc := no
  with_shared_libgcc := no
endif

# libgcc-math --------------------
with_libgmath := no
with_lib32gmath := no
ifneq (,$(findstring i486,$(DEB_TARGET_ARCH)))
  #with_gccmath := yes
  #with_libgmath := yes
  #with_libgmathdev := yes
endif
ifeq ($(DEB_TARGET_ARCH),amd64)
  #with_gccmath := yes
  #with_lib32gmath := yes
  #with_libgmathdev := yes
endif

# libgomp --------------------
with_gomp := yes
with_gomp := $(call envfilt, gomp, , , $(with_gomp))
ifeq ($(with_common_libs),yes)
  with_libgomp := yes
else
  with_libgomp := no
endif

# hppa64 build --------------------
with_hppa64 := no
ifeq ($(DEB_TARGET_ARCH),hppa)
  ifneq ($(DEB_CROSS),yes)
    with_hppa64 := yes
  endif
  #ifeq ($(PKGSOURCE),gcc-snapshot)
  #  with_hppa64 := disabled for snapshot build
  #endif
endif
with_hppa64 := $(call envfilt, hppa64, , , $(with_hppa64))

# spu build -----------------------
with_spu := no
ifneq (,$(findstring $(DEB_TARGET_ARCH),powerpc ppc64))
  ifneq ($(DEB_CROSS),yes)
    with_spu := yes
  endif
  ifeq ($(PKGSOURCE),gcc-snapshot)
    with_spu := disabled for snapshot build
  endif
endif
with_spu := $(call envfilt, spu, , , $(with_spu))

# run testsuite --------------------
with_check := yes
# If you don't want to run the gcc testsuite, set `with_check' to `no'
#with_check := disabled by hand
ifeq ($(with_base_only),yes)
  with_check := no
endif
ifeq ($(DEB_CROSS),yes)
  with_check := disabled for cross compiler package
endif
ifeq ($(REVERSE_CROSS),yes)
  with_check := disabled for reverse cross build
endif
check_no_systems := hurd-i386
ifneq (, $(filter $(DEB_TARGET_GNU_SYSTEM),$(check_no_systems)))
  with_check := disabled for $(DEB_TARGET_GNU_SYSTEM)
endif
check_no_cpus := none
ifeq ($(DEB_TARGET_ARCH_CPU), $(findstring $(DEB_TARGET_ARCH_CPU),$(check_no_cpus)))
  with_check := disabled for architecure $(DEB_TARGET_ARCH_CPU)
endif
ifeq ($(DEB_TARGET_ARCH),hurd-i386)
  with_check := disabled for architecure $(DEB_TARGET_ARCH)
endif
ifeq ($(distribution)-$(DEB_HOST_ARCH),Ubuntu-hppa)
  ifneq ($(PKGSOURCE),gcc-snapshot)
    with_check := disabled, testsuite timeouts with expect
  endif
endif
with_check := $(call envfilt, check, , , $(with_check))
ifneq ($(WITHOUT_CHECK),)
  with_check := disabled by environment
endif
ifneq ($(findstring nocheck, $(DEB_BUILD_OPTIONS)),)
  with_check := disabled by DEB_BUILD_OPTIONS
endif

# not a dependency on all archs, but if available, use it for the testsuite
ifneq (,$(wildcard /usr/bin/localedef))
  locale_data = generate
endif

# powerpc nof libraries --------------------
with_libnof := no

# multiarch --------------------
#with_multiarch_inc := yes
#with_multiarch_lib := no

all_enabled_languages := $(enabled_languages)
languages_without_lang_opt := c++ objc obj-c++ proto

ifeq ($(with_separate_libgcj),yes)
  ifneq (,$(findstring gcc-4, $(PKGSOURCE)))
    enabled_languages := $(filter-out java, $(all_enabled_languages))
    debian_extra_langs = java
    with_java := built from separate source
    with_gcj := built from separate source
    with_libgcj := built from separate source
  endif
  ifneq (,$(findstring gcj, $(PKGSOURCE)))
    enabled_languages = c c++ java
    debian_extra_langs := $(filter-out $(enabled_languages) $(languages_without_lang_opt), $(all_enabled_languages))
    ifneq ($(with_standalone_gcj),yes)
      with_libgcc := no
    endif
    with_libgccmath := no
    with_cxx := no
    with_cdev := no
    with_cxxdev := no
    with_fortran := no
    with_proto := no
    with_fixincl := no
    with_pascal := no
    with_mudflap := no
    with_libmudflap := no
    with_libffi := no
    with_libssp := no
    with_libgomp := no
    with_objc := no
    with_libobjc := no
    with_objcxx := no
    with_ada := no
    with_d := no
    with_libgnat := no
    with_hppa64 := no
    with_spu := no
    with_libnof := no
    with_debug := no
    with_gccbase := no
    ifeq ($(with_standalone_gcj),yes)
      ifeq ($(DEB_TARGET_ARCH),hppa)
        with_libgcc := yes
      endif
    endif
  endif
endif

ifeq ($(with_separate_gnat),yes)
  ifneq (,$(findstring gcc-4, $(PKGSOURCE)))
    enabled_languages := $(filter-out ada, $(enabled_languages))
    debian_extra_langs += ada
    with_ada := built from separate source
    with_libgnat := built from separate source
  endif
  ifneq (,$(findstring gnat, $(PKGSOURCE)))
    enabled_languages = c ada
    debian_extra_langs := $(filter-out $(enabled_languages) $(languages_without_lang_opt), $(all_enabled_languages))
    with_ada := yes
    with_libgnat := yes
    with_libgcc := no
    with_cxx := no
    with_cdev := no
    with_cxxdev := no
    with_fortran := no
    with_libfortran := no
    with_proto := no
    with_fixincl := no
    with_pascal := no
    with_mudflap := no
    with_libmudflap := no
    with_libffi := no
    with_ssp := no
    with_libssp := no
    with_libgomp := no
    with_objc := no
    with_libobjc := no
    with_objcxx := no
    with_d := no
    with_java := no
    with_gcj := no
    with_libgcj := no
    with_hppa64 := no
    with_spu := no
    with_libnof := no
    with_debug := no
    with_gccbase := no
  endif
endif

ifeq ($(with_separate_gdc),yes)
  ifneq (,$(findstring gcc-4, $(PKGSOURCE)))
    enabled_languages := $(filter-out d, $(enabled_languages))
    #debian_extra_langs += d
    with_d := built from separate source
  endif
  ifneq (,$(findstring gdc, $(PKGSOURCE)))
    enabled_languages = c c++ d
    debian_extra_langs := $(filter-out $(enabled_languages) $(languages_without_lang_opt), $(all_enabled_languages))
    with_libgcc := no
    with_cxx := no
    with_cdev := no
    with_cxxdev := no
    with_fortran := no
    with_proto := no
    with_fixincl := no
    with_pascal := no
    # gpc doesn't support mudflap
    with_mudflap := no
    with_libmudflap := no
    with_libffi := no
    with_libssp := no
    with_objc := no
    with_libobjc := no
    with_objcxx := no
    with_ada := no
    with_libgnat := no
    with_java := no
    with_gcj := no
    with_libgcj := no
    with_hppa64 := no
    with_spu := no
    with_libnof := no
    with_debug := no
    with_gccbase := no
    with_fastjar := no
  endif
endif

ifeq ($(with_separate_gpc),yes)
  ifneq (,$(findstring gcc-4, $(PKGSOURCE)))
    enabled_languages := $(filter-out pascal, $(enabled_languages))
    #debian_extra_langs += pascal
    with_pascal := built from separate source
  endif
  ifneq (,$(findstring gpc, $(PKGSOURCE)))
    enabled_languages = c pascal
    debian_extra_langs := $(filter-out $(enabled_languages) $(languages_without_lang_opt), $(all_enabled_languages))
    with_libgcc := no
    with_cxx := no
    with_cdev := no
    with_cxxdev := no
    with_fortran := no
    with_proto := no
    with_fixincl := no
    with_d := no
    # gpc doesn't support mudflap
    with_mudflap := no
    with_libmudflap := no
    with_libffi := no
    with_libssp := no
    with_objc := no
    with_libobjc := no
    with_objcxx := no
    with_ada := no
    with_libgnat := no
    with_java := no
    with_gcj := no
    with_libgcj := no
    with_hppa64 := no
    with_spu := no
    with_libnof := no
    with_debug := no
    with_gccbase := no
    with_fastjar := no
  endif
endif

debian_extra_langs := $(subst obj-c++,objcp,$(debian_extra_langs))
export debian_extra_langs

biarch64 := no
biarch34 := no
biarchn32 := no

with_lib64gcc		:= no
with_lib64cxx		:= no
with_lib64objc		:= no
with_lib64ffi		:= no
with_lib64gcj		:= no
with_lib64fortran	:= no
with_lib64mudflap	:= no
with_lib64ssp		:= no

biarch_map := i486=x86_64 powerpc=powerpc64 sparc=sparc64 s390=s390x \
		x86_64=i486 powerpc64=powerpc mips=mips64 mipsel=mips64el
biarch_cpu := $(patsubst $(DEB_TARGET_GNU_CPU)=%,%, \
			 $(filter $(DEB_TARGET_GNU_CPU)=%,$(biarch_map)))

biarch64_archs := /i386/powerpc/sparc/s390/mips/mipsel/

ifneq (yes,$(call envfilt, biarch, , ,yes))
  biarch64_archs :=
endif

ifneq (,$(findstring /$(DEB_TARGET_ARCH)/,$(biarch64_archs)))
  biarch64 := yes
  biarch64subdir = $(biarch_cpu)-$(DEB_TARGET_GNU_SYSTEM)
  biarch64subdir = 64
  ifeq ($(with_libgcc),yes)
    with_lib64gcc := yes
  endif
  ifeq ($(with_libcxx),yes)
    with_lib64cxx := yes
  endif
  ifeq ($(with_libcxxdbg),yes)
    with_lib64cxxdbg := yes
  endif
  ifeq ($(with_libobjc),yes)
    with_lib64objc := yes
  endif
  ifeq ($(with_libfortran),yes)
    with_lib64fortran := yes
  endif
  ifeq ($(with_libffi),yes)
    with_lib64ffi := yes
  endif
  ifeq ($(with_libmudflap),yes)
    with_lib64mudflap := yes
  endif
  ifeq ($(with_libssp),yes)
    with_lib64ssp := yes
  endif
  ifeq ($(with_libgomp),yes)
    with_lib64gomp:= yes
  endif

  biarch_multidir_names = libiberty libgcc
  ifneq (,$(findstring gcc-, $(PKGSOURCE)))
    biarch_multidir_names += libstdc++-v3 libgfortran libmudflap libssp \
				libffi libobjc libgomp zlib
    ifeq ($(with_objc_gc),yes)
      biarch_multidir_names += boehm-gc
    endif
  endif
  export biarch_multidir_names

  TARGET32_MACHINE := $(TARGET_ALIAS)
  TARGET64_MACHINE := $(strip $(subst $(DEB_TARGET_GNU_CPU),$(biarch_cpu), \
					$(TARGET_ALIAS)))
  export TARGET32_MACHINE
  export TARGET64_MACHINE
endif

biarch32_archs := /amd64/ppc64/kfreebsd-amd64/
ifneq (yes,$(call envfilt, biarch, , ,yes))
  biarch32_archs :=
endif
ifneq (,$(findstring /$(DEB_TARGET_ARCH)/,$(biarch32_archs)))
  biarch32 := yes
  biarch32subdir = $(biarch_cpu)-$(DEB_TARGET_GNU_SYSTEM)
  biarch32subdir = 32
  ifeq ($(with_libgcc),yes)
    with_lib32gcc := yes
  endif
  ifeq ($(with_libcxx),yes)
    with_lib32cxx := yes
  endif
  ifeq ($(with_libcxxdbg),yes)
    with_lib32cxxdbg := yes
  endif
  ifeq ($(with_libobjc),yes)
    with_lib32objc := yes
  endif
  ifeq ($(with_libfortran),yes)
    with_lib32fortran := yes
  endif
  ifeq ($(with_libffi),yes)
    with_lib32ffi := yes
  endif
  ifeq ($(with_libmudflap),yes)
    with_lib32mudflap := yes
  endif
  ifeq ($(with_libssp),yes)
    with_lib32ssp := yes
  endif
  ifeq ($(with_libgomp),yes)
    with_lib32gomp:= yes
  endif

  biarch_multidir_names = libiberty libgcc
  ifneq (,$(findstring gcc-, $(PKGSOURCE)))
    biarch_multidir_names += libstdc++-v3 libgfortran libmudflap libssp \
				libffi libobjc libgomp zlib
    ifeq ($(with_objc_gc),yes)
      biarch_multidir_names += boehm-gc
    endif
  endif
  export biarch_multidir_names

  TARGET32_MACHINE := $(strip $(subst $(DEB_TARGET_GNU_CPU),$(biarch_cpu), \
					$(TARGET_ALIAS)))
  TARGET64_MACHINE := $(TARGET_ALIAS)
  export TARGET32_MACHINE
  export TARGET64_MACHINE
endif

biarchn32_archs := /mips/mipsel/
ifneq (yes,$(call envfilt, biarch, , ,yes))
  biarchn32_archs :=
endif
ifneq (,$(findstring /$(DEB_TARGET_ARCH)/,$(biarchn32_archs)))
  biarchn32 := yes
# biarchn32subdir = $(biarch_cpu)-$(DEB_TARGET_GNU_SYSTEM)
  biarchn32subdir = n32
  ifeq ($(with_libgcc),yes)
    with_libn32gcc := yes
  endif
  ifeq ($(with_libcxx),yes)
    with_libn32cxx := yes
  endif
  ifeq ($(with_libcxxdbg),yes)
    with_libn32cxxdbg := yes
  endif
  ifeq ($(with_libobjc),yes)
    with_libn32objc := yes
  endif
  ifeq ($(with_libfortran),yes)
    with_libn32fortran := yes
  endif
  ifeq ($(with_libffi),yes)
    with_libn32ffi := yes
  endif
  ifeq ($(with_libmudflap),yes)
    with_libn32mudflap := yes
  endif
  ifeq ($(with_libssp),yes)
    with_libn32ssp := yes
  endif
  ifeq ($(with_libgomp),yes)
    with_libn32gomp:= yes
  endif

  biarch_multidir_names = libiberty libgcc
  ifneq (,$(findstring gcc-, $(PKGSOURCE)))
    biarch_multidir_names += libstdc++-v3 libgfortran libmudflap libssp \
                                libffi libobjc libgomp zlib
    ifeq ($(with_objc_gc),yes)
      biarch_multidir_names += boehm-gc
    endif
  endif
  export biarch_multidir_names

  TARGET32_MACHINE := $(strip $(subst $(DEB_TARGET_GNU_CPU),$(biarch_cpu), \
                                        $(TARGET_ALIAS)))
  TARGET64_MACHINE := $(TARGET_ALIAS)
  export TARGET32_MACHINE
  export TARGET64_MACHINE
endif

multilib_archs = $(sort $(subst /, , $(biarch64_archs) $(biarch32_archs) $(biarchn32_archs)))

biarchsubdirs := \
  $(if $(filter yes,$(biarch64)),$(biarch64subdir),) \
  $(if $(filter yes,$(biarch32)),$(biarch32subdir),) \
  $(if $(filter yes,$(biarchn32)),$(biarchn32subdir),)
ifneq (,$(filter $(words $(biarchsubdirs)), 0 1))
  biarchsubdirs := $(strip $(biarchsubdirs))
else
  biarchsubdirs := {$(strip $(shell echo $(biarchsubdirs) | tr " " ","))}
endif

#ifeq ($(DEB_TARGET_ARCH),ia64)
#  biarch32 := yes
#endif

ifeq ($(PKGSOURCE),gcc-snapshot)
  #ifeq ($(DEB_TARGET_ARCH),$(findstring $(DEB_TARGET_ARCH),sparc))
    with_lib64gcc	:= no
    with_lib64cxx	:= no
    with_lib64objc	:= no
    with_lib64ffi	:= no
    with_lib64gcj	:= no
    with_lib64fortran	:= no
    with_lib64mudflap	:= no
    with_lib64ssp	:= no

    with_lib32gcc	:= no
    with_lib32cxx	:= no
    with_lib32objc	:= no
    with_lib32ffi	:= no
    with_lib32gcj	:= no
    with_lib32fortran	:= no
    with_lib32mudflap	:= no
    with_lib32ssp	:= no

    with_libn32gcc	:= no
    with_libn32cxx	:= no
    with_libn32objc	:= no
    with_libn32ffi	:= no
    with_libn32gcj	:= no
    with_libn32fortran	:= no
    with_libn32mudflap	:= no
    with_libn32ssp	:= no

    #biarch64   := disabled for snapshot build
    #biarch32 	:= disabled for snapshot build
    #biarchn32 	:= disabled for snapshot build
  #endif
  with_java_plugin := no
endif

ifdef DEB_CROSS_NO_BIARCH
  with_lib64gcc		:= no
  with_lib64cxx		:= no
  with_lib64objc	:= no
  with_lib64ffi		:= no
  with_lib64gcj		:= no
  with_lib64fortran	:= no
  with_lib64mudflap	:= no
  with_lib64ssp		:= no

  with_lib32gcc		:= no
  with_lib32cxx		:= no
  with_lib32objc	:= no
  with_lib32ffi		:= no
  with_lib32gcj		:= no
  with_lib32fortran	:= no
  with_lib32mudflap	:= no
  with_lib32ssp		:= no

  with_libn32gcc	:= no
  with_libn32cxx	:= no
  with_libn32objc	:= no
  with_libn32ffi	:= no
  with_libn32gcj	:= no
  with_libn32fortran	:= no
  with_libn32mudflap	:= no
  with_libn32ssp	:= no

  biarch64   	:= disabled for cross build
  biarch32 	:= disabled for cross build
  biarchn32 	:= disabled for cross build
endif

ifeq ($(biarch32),yes)
  with_32bit_check := $(strip $(if $(wildcard build/runcheck.out), \
				$(shell cat build/runcheck.out), \
				$(shell CC="gcc -m32" bash debian/runcheck.sh)))
endif

ifeq ($(biarch64),yes)
  with_64bit_check := $(strip $(if $(wildcard build/runcheck.out), \
			$(shell cat build/runcheck.out), \
			$(shell CC="gcc -m64" bash debian/runcheck.sh)))
endif

ifeq ($(biarchn32),yes)
  with_n32bit_check := $(strip $(if $(wildcard build/runcheck.out), \
				$(shell cat build/runcheck.out), \
				$(shell CC="gcc -mabi=n32" bash debian/runcheck.sh)))
endif

# GNU locales
force_gnu_locales := yes
locale_no_systems :=
ifneq (, $(filter $(DEB_TARGET_GNU_SYSTEM),$(locale_no_systems)))
  force_gnu_locales := disabled for $(DEB_TARGET_GNU_SYSTEM)
endif

gcc_tarpath		:= $(firstword $(wildcard gcc-*.tar.* /usr/src/gcc-4.3/gcc-*.tar.*))
gcc_tarball		:= $(notdir $(gcc_tarpath))
#gcc_srcdir		:= $(shell echo $(gcc_tarball) | sed 's/\.tar.*//;s/-dfsg//')
gcc_srcdir		:= $(subst -dfsg,,$(patsubst %.tar.lzma,%,$(patsubst %.tar.gz,%,$(gcc_tarball:.tar.bz2=))))

ifeq ($(with_pascal),yes)
  gpc_tarpath		:= $(firstword $(wildcard gpc-*.tar.* /usr/src/gcc-4.3/gpc-*.tar.*))
  gpc_tarball		:= $(notdir $(gpc_tarpath)
  gpc_srcdir		:= $(patsubst %.tar.lzma,%,$(patsubst %.tar.gz,%,$(gpc_tarball:.tar.bz2=)))
endif

ifeq ($(with_d),yes)
  gdc_tarpath		:= $(firstword $(wildcard gdc-*.tar.* /usr/src/gcc-4.1/gdc-*.tar.*))
  gdc_tarball		:= $(notdir $(gdc_tarpath))
  gdc_srcdir		:= $(patsubst %.tar.lzma,%,$(patsubst %.tar.gz,%,$(gdc_tarball:.tar.bz2=)))
endif

unpack_stamp		:= $(stampdir)/01-unpack-stamp
pre_patch_stamp		:= $(stampdir)/02-pre-patch-stamp
patch_stamp		:= $(stampdir)/02-patch-stamp
src_spu_stamp		:= $(stampdir)/02-src-spu-stamp
control_stamp		:= $(stampdir)/03-control-stamp
configure_stamp		:= $(stampdir)/04-configure-stamp
build_stamp		:= $(stampdir)/05-build-stamp
build_html_stamp	:= $(stampdir)/05-build-html-stamp
build_locale_stamp	:= $(stampdir)/05-build-locale-stamp
build_doxygen_stamp	:= $(stampdir)/05-build-doxygen-stamp
build_javadoc_stamp	:= $(stampdir)/05-build-javadoc-stamp
check_stamp		:= $(stampdir)/06-check-stamp
check_inst_stamp	:= $(stampdir)/06-check-inst-stamp
install_stamp		:= $(stampdir)/07-install-stamp
install_snap_stamp	:= $(stampdir)/07-install-snap-stamp
binary_stamp		:= $(stampdir)/08-binary-stamp

configure_dummy_stamp	:= $(stampdir)/04-configure-dummy-stamp
build_dummy_stamp	:= $(stampdir)/05-build-dummy-stamp
install_dummy_stamp	:= $(stampdir)/07-install-dummy-stamp

configure_hppa64_stamp	:= $(stampdir)/04-configure-hppa64-stamp
build_hppa64_stamp	:= $(stampdir)/05-build-hppa64-stamp
install_hppa64_stamp	:= $(stampdir)/07-install-hppa64-stamp

configure_ia6432_stamp	:= $(stampdir)/04-configure-ia6432-stamp
build_ia6432_stamp	:= $(stampdir)/05-build-ia6432-stamp
install_ia6432_stamp	:= $(stampdir)/07-install-ia6432-stamp

configure_ia6432_stamp	:= $(stampdir)/04-configure-ia6432-stamp
build_ia6432_stamp	:= $(stampdir)/05-build-ia6432-stamp
install_ia6432_stamp	:= $(stampdir)/07-install-ia6432-stamp

configure_spu_stamp	:= $(stampdir)/04-configure-spu-stamp
build_spu_stamp		:= $(stampdir)/05-build-spu-stamp
install_spu_stamp	:= $(stampdir)/07-install-spu-stamp

ifeq ($(PKGSOURCE),gcc-snapshot)
    control_dependencies = $(patch_stamp)
    configure_dependencies = $(configure_stamp)
    build_dependencies = $(build_stamp)
    ifeq ($(with_check),yes)
      build_dependencies += check
    endif
    install_dependencies = $(install_snap_stamp)
else
  ifeq ($(with_base_only),yes)
    control_dependencies = $(patch_stamp)
    configure_dependencies = $(configure_dummy_stamp)
    build_dependencies = $(build_dummy_stamp)
    install_dependencies = $(install_dummy_stamp)
  else
    control_dependencies = $(patch_stamp)
    configure_dependencies = $(configure_stamp)
    build_dependencies = $(build_stamp)
    ifeq ($(with_check),yes)
      build_dependencies += check
    endif
    install_dependencies = $(install_stamp)
  endif
endif

ifneq (,$(findstring gcj-, $(PKGSOURCE)))
  ifeq ($(with_gcj_base_only),yes)
    configure_dependencies = $(configure_dummy_stamp)
    build_dependencies = $(build_dummy_stamp)
    install_dependencies = $(install_dummy_stamp)
  endif
endif

ifeq ($(with_hppa64),yes)
  build_dependencies += $(build_hppa64_stamp)
  ifneq ($(PKGSOURCE),gcc-snapshot)
    install_dependencies += $(install_hppa64_stamp)
  endif
endif

ifeq ($(with_ia6432),yes)
  build_dependencies += $(build_ia6432_stamp)
endif

ifeq ($(with_spu),yes)
  control_dependencies += $(src_spu_stamp)
  build_dependencies += $(build_spu_stamp)
  ifneq ($(PKGSOURCE),gcc-snapshot)
    install_dependencies += $(install_spu_stamp)
  endif
endif

stamp-dir:
	mkdir -p $(stampdir)