-
-
Notifications
You must be signed in to change notification settings - Fork 62
/
configure.in
3925 lines (3532 loc) · 147 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
dnl Copyright (C) 1997-2023, The AROS Development Team. All rights reserved.
dnl $Id$
dnl
dnl Desc: Autoconf source for configuration file
dnl Lang: english
# Note: After file changes, generate configure anew and commit _both_ files.
#TODO
# method of getting shared/non-shared ld/ar tool for target.
# ------------------------------------------------------------------------
# Here starts the first section of the configure.in file.
# ------------------------------------------------------------------------
AC_INIT
AC_CONFIG_SRCDIR([mmakefile])
AC_PREREQ([2.69])
AC_CONFIG_AUX_DIR(scripts/autoconf)
AC_CONFIG_MACRO_DIR(scripts/autoconf/m4)
export_newline="
"
CONFIG_DT=`date -u "+%d/%m/%Y %T"`
AC_MSG_NOTICE([date/time (UTC)... $CONFIG_DT])
# Check what host we are running on.
# If a target is not suggested, we use this one.
# Note that what we call a target, Autoconf calls a host.
AC_CANONICAL_HOST
# Default versions for the gnu tools we build
default_toolchain_family=`cat ${srcdir}/config/toolchain_def`
default_gcc_version=`cat ${srcdir}/config/gcc_def`
exp_gcc_version=`cat ${srcdir}/config/gcc_exp`
default_binutils_version=`cat ${srcdir}/config/binutils_def`
default_llvm_version=`cat ${srcdir}/config/llvm_def`
exp_binutils_version=`cat ${srcdir}/config/binutils_exp`
default_grub2_version="2.06"
target_grub2_version=$default_grub2_version
# The AROS target is slightly different to the normal GNU style
# format. We don't have the middle part, and we reverse the order
# of the $(CPU) and $(OS) bits.
#
# Don't strip the version of the target yet, it might be
# useful on some systems.
AC_MSG_CHECKING([for AROS style target])
stripped_host_os=$host_os
case "$host_os" in
darwin*)
stripped_host_os="darwin"
;;
esac
if test "$target" = "NONE" ; then
target=$stripped_host_os-$host_cpu
else
if test "$target" = "" ; then
target=$stripped_host_os-$host_cpu
fi
fi
AC_MSG_RESULT($target)
if test "$host_os" = "mingw32" ; then
PWDCMD="pwd -W"
fi
# Don't know where else to put this...
AC_MSG_CHECKING([building AROS in])
AROS_BUILDDIR=`${PWDCMD-pwd}`
AROS_BUILDDIR_UNIX=${PWD}
AC_MSG_RESULT($AROS_BUILDDIR)
AC_MSG_CHECKING([AROS source in])
srcpwd=`cd ${srcdir} ; ${PWDCMD-pwd}`
SRCDIR=${srcpwd}
AC_MSG_RESULT($SRCDIR)
IS_INSUBDIR=`echo $AROS_BUILDDIR | sed "s|$SRCDIR||"`
if test "x$IS_INSUBDIR" != "x$AROS_BUILDDIR" ; then
if test "x$IS_INSUBDIR" != "x" ; then
ignore_dir=`echo $AROS_BUILDDIR | sed "s|$SRCDIR/||"`
mmake_ignore_dirs="$export_newline""ignoredir $ignore_dir"
else
AC_MSG_WARN([Detected build inside the source tree - consider building in a separate dir])
fi
fi
# Parse the target field into something useful.
changequote(<<,>>)
target_os=`echo $target | sed 's/^\([^-].*\)-\(.*\)$/\1/'`
target_cpu=`echo $target | sed 's/^\([^-].*\)-\(.*\)$/\2/'`
changequote([,])
# Some debug output, to be removed again.
AC_MSG_CHECKING([for target system (debug output)])
AC_MSG_RESULT($target_os)
AC_MSG_CHECKING([for target cpu (debug output)])
AC_MSG_RESULT($target_cpu)
#-----------------------------------------------------------------------------
AC_MSG_CHECKING([which prefs set to use])
AC_ARG_WITH(aros-prefs,AS_HELP_STRING([--with-aros-prefs=PREFSSET],[Use the preferences from the set defined by PREFSSET (defaults to AROS normal config, 'classic' provides a config more like traditional workbench - and better suited to weaker systems)]),config_prefs_set="$withval",config_prefs_set="")
if test "$config_prefs_set" != "" ; then
msg_result=$config_prefs_set
else
msg_result="default"
fi
AC_MSG_RESULT($msg_result)
dnl --------------------------------------------------------------------
dnl Set the default Workbench resolution
dnl --------------------------------------------------------------------
aros_nominal_width=800
aros_nominal_height=600
aros_nominal_depth=4
dnl --------------------------------------------------------------------
dnl Host Configuration Section
dnl --------------------------------------------------------------------
dnl
dnl The idea here is to find out all the information we need about the
dnl host. This means things like tools for building directory structures,
dnl copying files around and the like.
HOST_WANTS_X11=
HOST_WANTS_GLX=
HOST_WANTS_SDL=
HOST_WANTS_DBUS=
HOST_WANTS_DLOPEN=
default_c_compilers="gcc clang cc"
AC_ARG_WITH(c-compiler,AS_HELP_STRING([--with-c-compiler=VERSION],[Use specified c compiler for building AROS]),use_c_compiler="$withval",use_c_compiler="")
if test "$use_c_compiler" = ""; then
host_c_compilers="$default_c_compilers"
else
host_c_compilers="$use_c_compiler"
CC=$use_c_compiler
fi
default_cxx_compilers="g++ clang++ c++"
AC_ARG_WITH(cxx-compiler,AS_HELP_STRING([--with-cxx-compiler=VERSION],[Use specified c++ compiler building AROS]),use_cxx_compiler="$withval",use_cxx_compiler="")
if test "$use_cxx_compiler" = ""; then
host_cxx_compilers="$default_cxx_compilers"
else
host_cxx_compilers="$use_cxx_compiler"
CXX=$use_cxx_compiler
fi
# The first step is to find the host binaries.
# Check for a compiler.
# Due to a bug in autoconf check for c++ compiler first.
# For mor info see, http://osdir.com/ml/bug-autoconf-gnu/2010-05/msg00001.html.
AC_PROG_CXX([${host_cxx_compilers}])
CXX_BASE=$CXX
AC_PATH_PROG(CXX,$CXX)
AC_PROG_CC([${host_c_compilers}])
CC_BASE=$CC
AC_PROG_CPP
CPP_BASE=$CPP
AC_PATH_PROG(CC,$CC)
aros_host_def_cc="$CC"
AC_PROG_CC_STDC
AC_PROG_CPP
# detect the compiler version
AC_MSG_CHECKING([which toolchain family ${CC_BASE} belongs to])
HOST_COMPILER_VERSION=`"$CC" --version 2>/dev/null`
if test x"$HOST_COMPILER_VERSION" = "x"; then
HOST_COMPILER_VERSION=`"$CC" --qversion 2>/dev/null`
fi
if test x"$HOST_COMPILER_VERSION" = "x"; then
HOST_COMPILER_VERSION=`"$CC" -V 2>/dev/null`
fi
IS_SUN_COMPILER=`echo $HOST_COMPILER_VERSION | grep -i -c -E 'Sun C\+\+'`
if test "$IS_SUN_COMPILER" -ne "0"; then
HOST_TOOLCHAIN_PREFIX=
HOST_TOOLCHAIN_SUFFIX=
HOST_TOOLCHAIN_FAMILY=sun
fi
IS_LLVM_COMPILER=`echo $HOST_COMPILER_VERSION | grep -i -c -E 'LLVM|clang'`
if test "$IS_LLVM_COMPILER" -ne "0"; then
if test "$CC_BASE" != "gcc"; then
HOST_TOOLCHAIN_PREFIX=llvm-
HOST_TOOLCHAIN_SUFFIX="`echo $CC_BASE | sed -e \"s|clang||g\"`"
HOST_TOOLCHAIN_FAMILY=llvm
else
IS_GNU_COMPILER=1
fi
fi
if test "x$IS_GNU_COMPILER" = "x"; then
IS_GNU_COMPILER=`echo $HOST_COMPILER_VERSION | grep -i -c -E 'gcc'`
fi
if test "$IS_GNU_COMPILER" -ne "0"; then
HOST_TOOLCHAIN_PREFIX=
HOST_TOOLCHAIN_SUFFIX=
HOST_TOOLCHAIN_FAMILY=gnu
fi
if test x"$HOST_TOOLCHAIN_FAMILY" = "x"; then
HOST_TOOLCHAIN_FAMILY=unknown
fi
AC_MSG_RESULT($HOST_TOOLCHAIN_FAMILY)
# Check for a compatible awk
AC_CHECK_PROGS(AWK,[gawk nawk])
AROS_REQUIRED(gawk,$AWK)
AROS_PROG(MMAKE,mmake)
# Perform some default variable assignments. Note all of these will be
# Regenerated from the script, so there is no need to cache them.
aros_build_host=$host
aros_host_cpp="$CPP"
aros_host_cc="$CC"
aros_host_cxx="$CXX"
base_ld_name=${HOST_TOOLCHAIN_PREFIX}ld${HOST_TOOLCHAIN_SUFFIX}
if test "$HOST_TOOLCHAIN_FAMILY" = "llvm"; then
AC_CHECK_PROGS(base_lld_name,[$base_ld_name ld.lld${HOST_TOOLCHAIN_SUFFIX} ld64.lld${HOST_TOOLCHAIN_SUFFIX} ld-link${HOST_TOOLCHAIN_SUFFIX}.exe ld${HOST_TOOLCHAIN_SUFFIX}])
LD_BASE=$base_lld_name
else
AC_CHECK_PROG(LD_BASE,$base_ld_name)
fi
AROS_TOOL_CCPATH(aros_host_ld,ld,$LD_BASE)
AROS_REQUIRED(ld,$aros_host_ld)
aros_host_make="make"
aros_host_cflags="$CFLAGS"
aros_host_cxxflags="$CXXFLAGS"
aros_host_cppflags="$CPPFLAGS"
aros_host_baseldflags="$LDFLAGS"
aros_host_ldflags="$aros_host_baseldflags"
aros_host_debug="-g -O0"
aros_host_mkdep="\$(SRCDIR)/scripts/mkdep"
aros_host_mkargs="--no-print-directory"
aros_host_exe_suffix="$EXEEXT"
aros_host_lib_suffix=""
# Ignore all compliance, AROS ROMs = 0
# KickStart v1.0 = 30
# KickStart v1.3 = 34
# KickStart v2.0 = 37
# KickStart v3.0 = 39
# KickStart v3.1 = 40
# AmigaOS v3.5 = 44
aros_amigaos_compliance=0
AC_CHECK_PROGS(aros_host_aclocal,[aclocal aclocal19 aclocal-1.9])
AC_CHECK_PROGS(aros_host_autoconf,[autoconf autoconf259 autoconf253])
AC_CHECK_PROGS(aros_host_autoheader,[autoheader autoheader259 autoheader253])
AC_CHECK_PROGS(aros_host_automake,[automake automake19 automake-1.9])
AROS_REQUIRED(aclocal/aclocal19/aclocal-1.9, $aros_host_aclocal)
AROS_REQUIRED(automake/automake19/automake-1.9, $aros_host_automake)
case "$aros_host_cc" in
*clang*)
aros_host_cc_pipe=""
;;
*gcc*)
aros_host_cc_pipe="-pipe"
;;
icc)
aros_host_cc_pipe=""
;;
*)
aros_host_cc_pipe=""
;;
esac
aros_kernel_cc_includes=""
aros_target_cc_includes=""
host_cc_elf=yes
# ----------------------------------------------------------------------------------------
# Host-specific defaults
#
# This is the main host configuration section. It is where the host
# can change the values of any variables it needs to change. We do
# not look at anything that compiles to the target yet, we'll get
# to that later.
case "$host_os" in
aros*)
aros_host_arch="aros"
aros_host_cflags="$aros_host_cflags $aros_host_cc_pipe"
case "$host_cpu" in
*i?86*)
aros_host_cpu="i386"
;;
*x86_64*)
aros_host_cpu="x86_64"
;;
*powerpc*)
aros_host_cpu="ppc"
;;
*)
AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
aros_host_cpu="$host_cpu"
;;
esac
;;
linux*)
aros_host_arch="linux"
aros_host_cflags="$aros_host_cflags $aros_host_cc_pipe"
android_build_os="linux-x86"
android_tool="android"
default_android_sdk="/opt/android-sdk-linux_x86"
case "$host_cpu" in
*i?86*)
aros_host_cpu="i386"
;;
*x86_64*)
aros_host_cpu="x86_64"
;;
*m68k*)
aros_host_cpu="m68k"
;;
*powerpc*)
aros_host_cpu="ppc"
;;
*arm*)
aros_host_cpu="arm"
;;
*)
AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
aros_host_cpu="$host_cpu"
;;
esac
;;
freebsd*)
aros_host_cflags="$aros_host_cflags $aros_host_cc_pipe -I/usr/local/include"
aros_host_make="gmake"
aros_host_arch="freebsd"
aros_host_cpu="i386"
aros_host_ldflags="$aros_host_ldflags -L/usr/local/lib -liconv"
dnl FreeBSD 5.x (and later) has changed the default object format.
dnl The double [[]] is necessary to get around m4's quoting rules.
case $host_os in
freebsd[[234]]*)
aros_object_format="elf_i386"
;;
*)
aros_object_format="elf_i386_fbsd"
;;
esac
;;
darwin*)
AC_MSG_CHECKING([for macOS SDK files])
LOC=$( xcode-select -p )
AS_IF([ test $? != 0],[AC_MSG_ERROR([XCode incorrectly configured!
please run 'xcode-select --install' before
re-running configure])])
AC_MSG_RESULT($LOC)
aros_host_arch="darwin"
host_cc_elf=no
if [[ -z ${SED+x} ]]; then SED="gsed"; fi
android_build_os="darwin-x86"
android_tool="android"
default_android_sdk="/android-sdk-mac_x86"
case "$host_cpu" in
*i?86*)
aros_host_cpu="i386"
;;
*x86_64*)
aros_host_cpu="x86_64"
;;
*powerpc*)
aros_host_cpu="ppc"
;;
*)
AC_MSG_WARN("Unknown CPU for Darwin host -- $host_cpu")
aros_host_cpu="$host_cpu"
;;
esac
dnl Strip out the unsupported include paths...
aros_host_cflags="`echo "$aros_host_cflags" | sed 's|-I/usr/local/include/||g'`"
aros_host_cflags="`echo "$aros_host_cflags" | sed 's|-I/usr/local/include||g'`"
aros_host_cflags="`echo "$aros_host_cflags" | sed 's|-I/opt/local/include/||g'`"
aros_host_cflags="`echo "$aros_host_cflags" | sed 's|-I/opt/local/include||g'`"
aros_host_cflags="`echo "$aros_host_cflags" | sed 's|-I/opt/pkg/include/||g'`"
aros_host_cflags="`echo "$aros_host_cflags" | sed 's|-I/opt/pkg/include||g'`"
aros_host_cflags="$aros_host_cflags $aros_host_cc_pipe"
dnl Strip out the unsupported library paths...
aros_host_ldflags="`echo "$aros_host_ldflags" | sed 's|-L/usr/local/lib/||g'`"
aros_host_ldflags="`echo "$aros_host_ldflags" | sed 's|-L/usr/local/lib||g'`"
aros_host_ldflags="`echo "$aros_host_ldflags" | sed 's|-L/opt/local/lib/||g'`"
aros_host_ldflags="`echo "$aros_host_ldflags" | sed 's|-L/opt/local/lib||g'`"
aros_host_ldflags="`echo "$aros_host_ldflags" | sed 's|-L/opt/pkg/lib/||g'`"
aros_host_ldflags="`echo "$aros_host_ldflags" | sed 's|-L/opt/pkg/lib||g'`"
aros_host_ldflags="$aros_host_ldflags -liconv"
;;
dragonfly*)
aros_host_cflags="$aros_host_cflags $aros_host_cc_pipe"
aros_host_make="gmake"
aros_host_arch="dragonfly"
case $host_cpu in
*i?86*)
aros_host_cpu="i386"
;;
*amd64*)
aros_host_cpu="x86_64"
;;
*)
AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
aros_host_cpu="$host_cpu"
;;
esac
;;
netbsd*)
aros_host_cflags="$aros_host_cflags $aros_host_cc_pipe"
aros_host_make="gmake"
aros_host_arch="netbsd"
case "$host_cpu" in
*i?86*)
aros_host_cpu="i386"
;;
*m68k*)
aros_host_cpu="m68k"
;;
*)
AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
aros_host_cpu="$host_cpu"
;;
esac
aros_host_lib_suffix=".0.0"
;;
openbsd*)
aros_host_cflags="$aros_host_cflags $aros_host_cc_pipe"
aros_host_make="gmake"
aros_host_arch="openbsd"
case "$host_cpu" in
*i?86*)
aros_host_cpu="i386"
;;
*)
AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
aros_host_cpu="$host_cpu"
;;
esac
;;
solaris*)
aros_host_arch="solaris"
aros_host_cflags="$aros_host_cflags $aros_host_cc_pipe"
case "$host_cpu" in
*i?86*)
aros_host_cpu="i386"
;;
*sparc*)
aros_host_cpu="sparc"
;;
*)
AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
aros_host_cpu="$host_cpu"
;;
esac
;;
morphos*)
aros_host_arch="morphos"
aros_host_cpu="ppc"
host_cc_elf=no
;;
amiga*)
aros_host_arch="amiga"
host_cc_elf=no
SORT="/gg/bin/sort"
TEST="/gg/bin/test"
UNIQ="/gg/bin/uniq"
FOR="for"
TOUCH="/gg/bin/touch"
case "$host_cpu" in
*m68k*)
aros_host_cpu="m68k"
;;
*powerpc*)
aros_host_cpu="ppc"
;;
*)
AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
aros_host_cpu="$host_cpu"
;;
esac
;;
cygwin*)
aros_host_arch="cygwin"
aros_host_cflags="$aros_host_cflags $aros_host_cc_pipe"
host_cc_elf=no
android_build_os="windows"
android_tool="android.bat"
default_android_sdk="/cygdrive/c/android-sdk-windows-1.6_r1"
case "$host_cpu" in
*i?86*)
aros_host_cpu="i386"
;;
*)
AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
aros_host_cpu="$host_cpu"
;;
esac
;;
mingw32*)
aros_host_arch="mingw32"
aros_host_cflags="$aros_host_cflags $aros_host_cc_pipe"
host_cc_elf=no
android_build_os="windows"
android_tool="android.bat"
default_android_sdk="/c/android-sdk-windows-1.6_r1"
libpng_libextra="-lws2_32"
case "$host_cpu" in
*i?86*)
dnl Currently there's neither 64-bit MinGW nor MSYS. Both environments are 32-bit
dnl and run under emulation. Consequently, uname reports i386 even on 64-bit systems.
dnl Here we attempt to detect Windows home platform by asking gcc about its target.
dnl 64-bit gcc will output "x86_64-w64-mingw32" here.
AC_MSG_CHECKING([for Windows native gcc target])
host_cpu=`gcc -dumpmachine`
AC_MSG_RESULT($host_cpu)
;;
esac
case "$host_cpu" in
*i?86*)
aros_host_cpu="i386"
;;
mingw32*)
dnl Native i386 gcc for MinGW32 reports 'mingw32' with -dumpmachine switch
aros_host_cpu="i386"
;;
*x86_64*)
aros_host_cpu="x86_64"
dnl Dragon's x86_64-w64-mingw32-gcc is a bit broken. It ignores standard $prefix/include
dnl directory, so we have to add it explicitly here.
aros_host_cflags="$aros_host_cflags -isystem /mingw/include"
;;
*)
AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
aros_host_cpu="$host_cpu"
;;
esac
;;
*)
AC_MSG_ERROR([Unsupported host architecture $host])
;;
esac
base_ar_name=${HOST_TOOLCHAIN_PREFIX}ar${HOST_TOOLCHAIN_SUFFIX}
AROS_PROG(AR_BASE,$base_ar_name)
aros_host_ar_flags="cr"
aros_host_cmd_ar="$AR_BASE $aros_host_ar_flags"
AROS_PATH_PROG(aros_host_plain_ar,$aros_host_cmd_ar)
aros_host_ar=`echo $aros_host_cmd_ar | sed -e "s|$base_ar_name|$aros_host_plain_ar|g"`
AROS_REQUIRED(ar,$aros_host_ar)
base_ranlib_name=${HOST_TOOLCHAIN_PREFIX}ranlib${HOST_TOOLCHAIN_SUFFIX}
AROS_PROG(RANLIB_BASE,$base_ranlib_name)
AROS_PATH_PROG(aros_host_ranlib,$RANLIB_BASE)
AROS_REQUIRED(ranlib,$aros_host_ranlib)
AROS_PROG(aros_host_strip,strip)
AROS_REQUIRED(strip,$aros_host_strip)
AROS_PROG(RM,[rm],[-rf])
AROS_REQUIRED(rm,$RM)
AROS_PROG(CP,[cp])
AROS_REQUIRED(cp,$CP)
AROS_PROG(MV,[mv])
AROS_REQUIRED(mv,$MV)
AROS_PROG(ECHO,[echo])
AROS_REQUIRED(echo,$ECHO)
AROS_PROG(MKDIR,[mkdir],[-p])
AROS_REQUIRED(mkdir,$MKDIR)
AROS_PROG(TOUCH,[touch])
AROS_REQUIRED(touch,$TOUCH)
AROS_PROG(SORT,[sort])
AROS_REQUIRED(sort,$SORT)
AROS_PROG(UNIQ,[uniq])
AROS_REQUIRED(uniq,$UNIQ)
AROS_PROG(NOP,[true])
AROS_REQUIRED(true,$NOP)
AROS_PROG(CAT,[cat])
AROS_REQUIRED(cat,$CAT)
AROS_PROG(BISON,[bison])
AROS_REQUIRED(bison,$BISON)
AROS_PROG(FLEX,[flex])
AROS_REQUIRED(flex,$FLEX)
AC_MSG_CHECKING([version of $FLEX])
ax_cv_flex_version="`$FLEX --version | cut -d\" \" -f2`"
AC_MSG_RESULT($ax_cv_flex_version)
AROS_PROG(PNGTOPNM,[pngtopnm])
AROS_REQUIRED(pngtopnm,$PNGTOPNM)
AROS_PROG(PPMTOILBM,[ppmtoilbm])
AROS_REQUIRED(ppmtoilbm,$PPMTOILBM)
AROS_PROG(SED,[sed])
AROS_REQUIRED(sed,$SED)
AROS_PROG(CHMOD,[chmod])
AROS_REQUIRED(chmod,$CHMOD)
AROS_PROG(PATCH,[patch])
AROS_REQUIRED(patch,$PATCH)
dnl TODO it might be necessary to use a higher version of Python 3
AM_PATH_PYTHON(3.0)
dnl Check if mako templates are installed..
AC_MSG_CHECKING(if Python's mako templates are installed)
PC_PYTHON_CHECK_MODULE(mako, [], [AC_MSG_FAILURE([failed to detect mako templates])])
AC_ARG_ENABLE([libpng-config], [--disable-libpng-config disable libpng-config test and configuration])
if test "$enable_libpng_config" != "no"; then
AC_CHECK_PROG([arosconfig_use_libpngconfig],[libpng-config],[yes],[no])
fi
if test "$arosconfig_use_libpngconfig" = "yes"; then
AC_MSG_CHECKING([libpng-config library])
libpng_incdir="`libpng-config --cflags`"
libpng_libextra="$libpng_libextra `libpng-config --ldflags`"
libpng="`libpng-config --libs`"
AC_MSG_RESULT($libpng)
else
AC_CHECK_LIB(png, png_read_png, [libpng="-lpng"], [libpng="no"])
if test "$libpng_libextra" != ""; then
if test "$libpng" != "no"; then
libpng_libextra="$libpng_libextra $libpng"
fi
fi
fi
AROS_REQUIRED(libpng, $libpng)
AC_SUBST(libpng)
AC_SUBST(libpng_libextra)
AC_SUBST(libpng_incdir)
AC_SUBST(FOR, for)
AC_SUBST(IF, if)
AC_SUBST(TEST, test)
AC_SUBST(CMP, cmp)
dnl ---------------------------------------------------------------------------
dnl Look for things about the host system, good for hosted targets.
dnl ---------------------------------------------------------------------------
# Check for some includes for the X11 HIDD and the kernel
AC_CHECK_HEADERS([sys/ipc.h sys/shm.h \
sys/mmap.h sys/mman.h sysexits.h \
sys/statfs.h sys/statvfs.h sys/vfs.h sys/param.h \
])
AC_CHECK_HEADERS([sys/mount.h],,,[#include <sys/param.h>])
AC_CHECK_HEADERS([GL/glx.h],[host_feature_glx=yes],[host_feature_glx=no],)
AC_MSG_CHECKING([if __unused conflicts with sys/stat.h])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[[
#define __unused __attribute__((unused))
#include <sys/stat.h>
]])],
[host_stat_h__unused_used=no],
[host_stat_h__unused_used=yes])
AC_MSG_RESULT($host_stat_h__unused_used)
AC_HEADER_DIRENT
AC_HEADER_STAT
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_HEADER_TIME
AC_CHECK_MEMBERS([struct stat.st_blksize])
AC_STRUCT_ST_BLOCKS
AC_CHECK_MEMBERS([struct stat.st_rdev])
AC_STRUCT_TM
AC_STRUCT_TIMEZONE
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_UID_T
AC_CHECK_MEMBERS(struct tm.tm_gmtoff)
# Look for some functions
AC_CHECK_FUNCS([getpagesize kqueue statfs statvfs \
clone kse_create rfork_thread thr_create sa_register \
getcontext makecontext setcontext sigaltstack swapcontext])
AC_FUNC_MMAP
#
# Disable common symbols
AC_MSG_CHECKING([whether ${CC_BASE} accepts -fno-common])
save_cflags="$CFLAGS"
CFLAGS="$CFLAGS -fno-common"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[use_no_common="yes"],[use_no_common="no"])
AC_MSG_RESULT($use_no_common)
if test "x-$use_no_common" = "x-yes" ; then
aros_host_cflags="$aros_host_cflags -fno-common"
fi
CFLAGS="$save_cflags"
#-----------------------------------------------------------------------------
#
# GCC 4.1+ has a stack protection feature that requires OS support. Ubuntu has
# it switched on by default, and we use the host compiler, so it compiles AROS
# code with this enabled resulting in link failures as we don't have support
# for it.
#
# We use two methods to disable it. For the host compiler (used to compile
# some hosted modules), we test to see if the compiler supports stack
# protection, and if it does we disable it in AROS_CONFIG_CFLAGS. This should
# work on all platforms.
#
AC_MSG_CHECKING([whether ${CC_BASE} accepts -fno-stack-protector])
save_cflags="$CFLAGS"
CFLAGS="$CFLAGS -fno-stack-protector"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[use_no_stack_protector="yes"],[use_no_stack_protector="no"])
AC_MSG_RESULT($use_no_stack_protector)
if test "x-$use_no_stack_protector" = "x-yes" ; then
aros_host_cflags="$aros_host_cflags -fno-stack-protector"
fi
CFLAGS="$save_cflags"
#-----------------------------------------------------------------------------
# Disable pointer-signedness warnings if the compiler recognises the option
# (this only works for the host compiler at the moment)
AC_MSG_CHECKING([whether ${CC_BASE} accepts -Wno-pointer-sign])
save_cflags="$CFLAGS"
CFLAGS="$CFLAGS -Wno-pointer-sign"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[use_no_sign_warning="yes"],[use_no_sign_warning="no"])
AC_MSG_RESULT($use_no_sign_warning)
if test "x-$use_no_sign_warning" = "x-yes" ; then
aros_host_cflags="$aros_host_cflags -Wno-pointer-sign"
fi
CFLAGS="$save_cflags"
#-----------------------------------------------------------------------------
# Check if host compiler supports -fgnu89-inline, can be needed for crosstools.
AC_MSG_CHECKING([whether ${CC_BASE} accepts -fgnu89-inline])
save_cflags="$CFLAGS"
CFLAGS="$CFLAGS -fgnu89-inline"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[use_gnu89_inline="yes"],[use_gnu89_inline="no"])
AC_MSG_RESULT($use_gnu89_inline)
if test "x-$use_gnu89_inline" = "x-yes" ; then
gnu89_inline="-fgnu89-inline"
fi
CFLAGS="$save_cflags"
#
# For GCC < 4.0 -I- is used for giving the search path for '#include "..."'
# On GCC >= 4.0 -iquote should be used
#
AC_MSG_CHECKING([whether ${CC_BASE} accepts -iquote])
CFLAGS="$CFLAGS -iquote."
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[has_iquote="yes"],[has_iquote="no"])
AC_MSG_RESULT($has_iquote)
if test "x-$has_iquote" = "x-yes" ; then
host_cflags_iquote=-iquote
host_cflags_iquote_end=
else
host_cflags_iquote=-I
host_cflags_iquote_end=-I-
fi
AC_MSG_NOTICE([Performing target configuration...])
dnl --------------------------------------------------------------------
dnl Target Configuration Section
dnl --------------------------------------------------------------------
dnl
dnl The target configuration section is responsible for setting up all
dnl the paths for includes, and tools required to build AROS to some
dnl particular target.
test_kernel_cc=no
aros_nowarn_flags="NOWARN_UNUSED_COMMAND_LINE_ARGUMENT NOWARN_UNKNOWN_WARNING_OPTION NOWARN_POINTER_SIGN NOWARN_PARENTHESES"
aros_elf_translate=
aros_warn_flags=
aros_isa_extra=
aros_isa_flags=
aros_kernel_isa_flags=
aros_kernel_isa_extra=
aros_config_cppflags=
aros_config_cflags=
aros_config_cxxflags=
aros_config_aflags="$""(WARN_ALL) -x assembler-with-cpp -c"
aros_config_ldflags=""
aros_shared_default=yes
aros_shared_cflags="-fPIC"
aros_shared_aflags=""
aros_shared_ldflags="-Wl,-rpath,./lib -shared"
aros_kernel_ldflags="-Wl,-rpath,./lib"
aros_kernel_ar_flags="cr"
aros_target_ar_flags="cr"
aros_target_nm_flags="--demangle --undefined-only"
aros_target_strip_flags="--strip-unneeded -R.comment"
aros_c_libs=
aros_cxx_libs=
aros_target_genmap="-Wl,-Map -Xlinker"
# Native flavour stuff
aros_serial_debug="0"
# Palm native flavour stuff
aros_palm_debug_hack="0"
# Unix flavour stuff
aros_nesting_supervisor="0"
# Collect-aros stuff: "-ius" to ignore undefined symbols
ignore_undefined_symbols=""
# Check for X11 by default
need_x11="auto"
AC_MSG_CHECKING([which toolchain family to use ...])
AC_ARG_WITH(toolchain,AS_HELP_STRING([--with-toolchain=family],[Which toolchain family to crosscompile with (defaults to gnu)]),aros_toolchain="$withval",aros_toolchain="$default_toolchain_family")
AC_MSG_RESULT($aros_toolchain)
AC_MSG_CHECKING([if we should enable link time optimizations (LTO)])
AC_ARG_ENABLE(lto,AS_HELP_STRING([--enable-lto=[yes|no]],[Enable link time optimizations if the target compiler supports them (default=no)]),
aros_config_lto="$enableval",aros_config_lto="no")
if test "$aros_config_lto" != "no"; then
aros_config_lto="yes"
fi
AC_MSG_RESULT($aros_config_lto)
AC_MSG_CHECKING([if we should enable coverage instrumentation])
AC_ARG_ENABLE(coverage,AS_HELP_STRING([--enable-coverage=[yes|no]],[Enable coverage instrumentation if the target compiler supports it (default=no)]),
aros_config_coverage="$enableval",aros_config_coverage="no")
if test "$aros_config_coverage" != "no"; then
aros_config_coverage="yes"
fi
AC_MSG_RESULT($aros_config_coverage)
use_ld_wrapper=yes
case "$aros_toolchain" in
*llvm*)
toolchain_c_compiler="clang"
toolchain_cxx_compiler="clang++"
toolchain_cpp_preprocessor="clang"
toolchain_cpp_opts=" -E"
toolchain_ld="ld.lld"
aros_ld="ld"
toolchain_as="llvm-as"
toolchain_ar="llvm-ar"
toolchain_ranlib="llvm-ranlib"
toolchain_nm="llvm-nm"
toolchain_strip="${NOP}"
toolchain_objcopy="llvm-objcopy"
toolchain_objdump="llvm-objdump"
use_libatomic=yes
toolchain_def_opt_lvl="-O2"
toolchain_debug_opt_lvl="-O0"
toolchain_size_opt_lvl="-Os"
aros_target_cflags="$""(CFLAGS_NO_INTEGRATED_AS)"
aros_cxx_ldflags="-L $""(CROSSTOOLSDIR)/lib -stdlib=libc++ -static-libstdc++"
aros_nowarn_flags="$aros_nowarn_flags NOWARN_IGNORED_OPTIMIZATION_ARGUMENT"
;;
*gnu*)
toolchain_c_compiler="gcc"
toolchain_cxx_compiler="g++"
toolchain_cpp_preprocessor="gcc"
toolchain_cpp_opts=" -E"
toolchain_as="as"
aros_ld="ld"
if test "$aros_config_lto" != "yes"; then
toolchain_ld="ld"
toolchain_ar="ar"
toolchain_ranlib="ranlib"
toolchain_nm="nm"
else
gcc_ltoplugin="$""(CROSSTOOLSDIR)/libexec/gcc/$""(AROS_TARGET_CPU)-aros/$""(TARGET_GCC_VER)/liblto_plugin.so"
toolchain_ld="ld.bfd"
toolchain_ar="gcc-ar"
aros_target_ar_flags="--plugin $gcc_ltoplugin $aros_target_ar_flags"
toolchain_ranlib="gcc-ranlib"
toolchain_nm="gcc-nm"
fi
aros_target_nm_flags="$aros_target_nm_flags --line-numbers"
toolchain_strip="strip"
toolchain_objcopy="objcopy"
toolchain_objdump="objdump"
use_libatomic=yes
toolchain_def_opt_lvl="-O2"
toolchain_debug_opt_lvl="-O0"
toolchain_size_opt_lvl="-Os"
aros_cxx_ldflags="-static-libstdc++"
;;
*)
AC_MSG_WARN("Unknown toolchain family!")
toolchain_c_compiler="cc"
toolchain_cxx_compiler="c++"
toolchain_cpp_preprocessor="cpp"
toolchain_cpp_opts=
toolchain_ld="ld"
aros_ld="ld"
toolchain_as="as"
toolchain_ar="ar"
toolchain_ranlib="ranlib"
toolchain_nm="nm"
toolchain_strip="strip"
toolchain_objcopy="objcopy"
toolchain_objdump="objdump"
;;
esac
#-----------------------------------------------------------------------------
AC_MSG_CHECKING([which type of build to do])
AC_ARG_ENABLE(build_type,AS_HELP_STRING([--enable-build-type=TYPE],[Select the build type. Available types are: personal, nightly, snapshot, milestone, release. Do NOT use this option unless you know what you are doing! (default=personal)]),build_type=$enableval,build_type="personal")
if test "$build_type" = "nightly"; then
build_type_string="NIGHTLY"
elif test "$build_type" = "snapshot"; then
build_type_string="SNAPSHOT"
elif test "$build_type" = "milestone"; then
build_type_string="MILESTONE"
elif test "$build_type" = "release"; then
build_type_string="RELEASE"
else
build_type_string="PERSONAL"
build_type="personal"
fi
aros_config_cppflags="$aros_config_cppflags -DAROS_BUILD_TYPE=AROS_BUILD_TYPE_$build_type_string"
AC_MSG_RESULT($build_type)
#-----------------------------------------------------------------------------
all_debug_types="messages stack modules mungwall symbols"
AC_MSG_CHECKING([which debug types to enable])
AC_ARG_ENABLE(debug,AS_HELP_STRING([--enable-debug=list],[Enable different types of debug. Commas or whitespaces can be used to separate the items in the list. Available types of debug are: all, none, messages, stack, mungwall, modules, symbols. If no list is provided then "all" is assumed. (default=none)]),
debug="$enableval",debug="")
if test "$debug" = "" -o "$debug" = "no"; then
debug="none"
elif test "$debug" = "yes"; then
debug="all"
fi
if test "$debug" = "all" ; then
debug="messages stack modules symbols"
for d in $all_debug_types; do
export aros_${d}_debug="1"
done
else
for d in $all_debug_types; do
export aros_${d}_debug="0"
done
fi
if test "$debug" != "none"; then
debug=`echo $debug | sed s/,/\ /g`
for d in $debug; do
found="0"
for d2 in $all_debug_types; do
if test "$d2" = "$d"; then
found="1"
break
fi
done
if test "$found" = "0"; then