-
Notifications
You must be signed in to change notification settings - Fork 1
/
configure.in
3265 lines (2927 loc) · 118 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 � 1997-2016, 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(mmakefile)
AC_PREREQ(2.61)
AC_CONFIG_AUX_DIR(scripts/autoconf)
# 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_gcc_version="4.6.4"
default_binutils_version="2.23.2"
default_grub2_version="2.02"
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])
if test "$target" = "NONE" ; then
target=$host_os-$host_cpu
else
if test "$target" = "" ; then
target=$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)
# 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)
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.
default_c_compilers="gcc clang cc"
AC_ARG_WITH(c-compiler,AC_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"
fi
default_cxx_compilers="g++ clang++ c++"
AC_ARG_WITH(cxx-compiler,AC_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"
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}])
AC_PROG_CC([${host_c_compilers}])
aros_host_def_cc="$CC"
AC_PROG_CC_STDC
AC_PROG_CPP
# 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"
AROS_TOOL_CCPATH(aros_host_ld,ld)
AROS_REQUIRED(ld,$aros_host_ld)
aros_host_make="make"
aros_host_cflags="$CFLAGS"
aros_host_cxxflags="$CXXFLAGS"
aros_host_cppflags="$CPPFLAGS"
aros_host_ldflags="$LDFLAGS"
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_cflags="$aros_host_cflags $aros_host_cc_pipe"
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
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
AROS_PROG(aros_host_ar,[ar],[cr])
AROS_REQUIRED(ar,$aros_host_ar)
AROS_PROG(aros_host_ranlib,ranlib)
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)
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)
AM_PATH_PYTHON(2.5)
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_HEADER_DIRENT
AC_HEADER_STAT
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_HEADER_TIME
AC_STRUCT_ST_BLKSIZE
AC_STRUCT_ST_BLOCKS
AC_STRUCT_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
#-----------------------------------------------------------------------------
#
# 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} accepts -fno-stack-protector])
save_cflags="$CFLAGS"
CFLAGS="$CFLAGS -fno-stack-protector"
AC_TRY_COMPILE(,, 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} accepts -Wno-pointer-sign])
save_cflags="$CFLAGS"
CFLAGS="$CFLAGS -Wno-pointer-sign"
AC_TRY_COMPILE(,, 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} accepts -fgnu89-inline])
save_cflags="$CFLAGS"
CFLAGS="$CFLAGS -fgnu89-inline"
AC_TRY_COMPILE(,, 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} accepts -iquote])
CFLAGS="$CFLAGS -iquote."
AC_TRY_COMPILE(,, 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.
aros_nowarn_flags="NOWARN_UNUSED_COMMAND_LINE_ARGUMENT NOWARN_UNKNOWN_WARNING_OPTION NOWARN_POINTER_SIGN NOWARN_PARENTHESES"
toolchain_needs_sysroot=no
aros_warn_flags=
aros_isa_extra=
aros_isa_flags=
aros_config_cppflags=
aros_config_cflags=
aros_config_cxxflags=
aros_config_aflags="-Wall -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="-C -ul"
aros_target_strip_flags="--strip-unneeded -R.comment"
aros_compiler_libs=
aros_arch_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"
host_x_gfx=no
host_sdl_gfx=no
host_android_gfx=no
AC_MSG_CHECKING([Which toolchain family to use ...])
AC_ARG_WITH(toolchain,AC_HELP_STRING([--with-toolchain=family],[Which toolchain family to crosscompile with (defaults to gnu)]),aros_toolchain="$withval",aros_toolchain="gnu")
AC_MSG_RESULT($aros_toolchain)
AC_MSG_CHECKING([if we should enable link time optimizations (LTO)])
AC_ARG_ENABLE(lto,AC_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,AC_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_needs_sysroot=yes
toolchain_c_compiler="clang"
toolchain_cxx_compiler="clang++"
toolchain_cpp_preprocessor="clang -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="true"
toolchain_objcopy="llvm-objcopy"
toolchain_objdump="llvm-objdump"
;;
*gnu*)
toolchain_c_compiler="gcc"
toolchain_cxx_compiler="g++"
toolchain_cpp_preprocessor="gcc -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
toolchain_ld="ld.bfd"
toolchain_ar="gcc-ar"
toolchain_ranlib="gcc-ranlib"
toolchain_nm="gcc-nm"
fi
toolchain_strip="strip"
toolchain_objcopy="objcopy"
toolchain_objdump="objdump"
;;
*)
AC_MSG_WARN("Unknown toolchain family!")
toolchain_c_compiler="cc"
toolchain_cxx_compiler="c++"
toolchain_cpp_preprocessor="cpp"
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,AC_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,AC_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
AC_MSG_ERROR([unrecognized debug type "$d". Available types are: all none $all_debug_types])
fi
export aros_${d}_debug="1"
done
aros_debug="yes"
fi
AC_MSG_RESULT($debug)
if test "$aros_messages_debug" = "1"; then
aros_messages_debug="-DADEBUG=1 -DMDEBUG=1"
else
aros_messages_debug=""
fi
if test "$aros_symbols_debug" = "1"; then
aros_symbols_debug="-g"
else
aros_symbols_debug=""
fi
# These are the flags to pass when compiling debugged programs
aros_debug_cppflags="$aros_messages_debug"
aros_debug_cflags="$aros_symbols_debug"
aros_debug_cxxflags=
aros_debug_aflags=""
aros_debug_ldflags="$aros_symbols_debug"
#-----------------------------------------------------------------------------
# Checking for distcc and ccache.
#
# Always apply the transforms in this particular order. Basically you should
# always run 'ccache distcc compiler' in that order for the best performance.
#
AC_MSG_CHECKING([whether to enable distcc])
AC_ARG_ENABLE(distcc,AC_HELP_STRING([--enable-distcc],[Use distcc as a front end to the compiler (default=no).]),distcc="$enableval",distcc="no")
if test "$distcc" != "" -a "$distcc" != "no"; then
# AC_CHECK_PROG will print out the result in this case
AC_PATH_PROG(DISTCC,[distcc],distcc,)
else
AC_MSG_RESULT(no)
fi
AC_MSG_CHECKING([whether to enable ccache])
AC_ARG_ENABLE(ccache,AC_HELP_STRING([--enable-ccache],[Use ccache as a front end to the compiler (default=no).]),ccache="$enableval",ccache="no")
if test "$ccache" != "" -a "$ccache" != "no"; then
# AC_CHECK_PROG will print out the result in this case
AC_CHECK_PROG(CCACHE,[ccache],ccache,)
else
AC_MSG_RESULT(no)
fi
#-----------------------------------------------------------------------------
AC_MSG_CHECKING([what specific host gcc version to use])
AC_ARG_WITH(kernel-gcc-version,AC_HELP_STRING([--with-kernel-gcc-version=VERSION],[Use gcc-VERSION for building bootstrap]),kernel_tool_version="$withval",kernel_tool_version="")
if test "$kernel_tool_version" != "" ; then
msg_result=$kernel_tool_version
else
msg_result="default"
fi
AC_MSG_RESULT($msg_result)
#-----------------------------------------------------------------------------
AC_MSG_CHECKING([what optimization flags to use])
AC_ARG_WITH(optimization,AC_HELP_STRING([--with-optimization=FLAGS],[Use optimization flags FLAGS (e.g --with-optimization=-O2).]),optimization_level="$withval",optimization_level="unknown")
if test "$optimization_level" = "unknown"; then
dnl default is -O2 for normal builds, -O0 for debug builds
optimization="default"
if test "$debug" != "none"; then
optimization_level="-O0"
else
optimization_level="-O2"
fi
else
optimization="$optimization_level"
fi
AC_MSG_RESULT($optimization)
paranoia_default=yes
#-----------------------------------------------------------------------------
AC_MSG_CHECKING([which paranoia flags to use])
AC_ARG_WITH(paranoia,AC_HELP_STRING([--with-paranoia=(yes|no|FLAGS)],[Specific compiler warning FLAGS to enable for paranoia builds (default=-Wall -Werror)]),[paranoia_flags="$withval"],[paranoia_flags="$paranoia_default"])
if test "$paranoia_flags" = "no"; then
paranoia_flags="-Wall -Werror-implicit-function-declaration"
msg_result="none"
else
if test "$paranoia_flags" = "yes"; then
paranoia_flags="-Wall -Werror"
fi
msg_result="$paranoia_flags"
fi
AC_MSG_RESULT($msg_result)
aros_warn_flags="$aros_warn_flags $paranoia_flags"
#-----------------------------------------------------------------------------
AC_MSG_CHECKING([what target variant to enable])
AC_ARG_ENABLE(target_variant,AC_HELP_STRING([--enable-target-variant=NAME],[Enable a specific target variant (default=none)]),target_variant=$enableval,target_variant="")
if test "$target_variant" = ""; then
aros_target_variant=""
aros_target_suffix=""
enableval="none"
else
aros_target_variant="$target_variant"
aros_target_suffix="-$target_variant"
fi
AC_MSG_RESULT($enableval)
#-----------------------------------------------------------------------------
# Target-specific defaults. You can override then on a per-target basis.
#
# Bootloader name. Currently used by PC target.
target_bootloader="none"
PLATFORM_EXECSMP=
ENABLE_EXECSMP=
#-----------------------------------------------------------------------------
# Additional options for some specific targets
case "$aros_target_variant" in
ios)
AC_MSG_CHECKING([XCode path])
AC_ARG_WITH(xcode,AC_HELP_STRING([--with-xcode=PATH],[Specify XCode path for iOS targets (default=/Developer).]),aros_xcode_path="$withval",aros_xcode_path="/Developer")
AC_MSG_RESULT($aros_xcode_path)
AC_MSG_CHECKING([what iOS SDK version to use])
AC_ARG_WITH(sdk-version,AC_HELP_STRING([--with-sdk-version=VERSION],[Use iOS SDK version VERSION (default=4.1).]),aros_sdk_version="$withval",aros_sdk_version="4.1")
AC_MSG_RESULT($aros_sdk_version)
;;
"android")
AC_MSG_CHECKING([Android SDK path])
AC_ARG_WITH(sdk,AC_HELP_STRING([--with-sdk=PATH],[Specify Android SDK path (default=$default_android_sdk).]),aros_android_sdk="$withval",aros_android_sdk=$default_android_sdk)
AC_MSG_RESULT($aros_android_sdk)
AC_MSG_CHECKING([Android NDK path])
AC_ARG_WITH(ndk,AC_HELP_STRING([--with-ndk=PATH],[Specify Android NDK path (default=none).]),aros_android_ndk="$withval",aros_android_ndk="none")
AC_MSG_RESULT($aros_android_ndk)
AC_MSG_CHECKING([what Android SDK version to use])
AC_ARG_WITH(sdk-version,AC_HELP_STRING([--with-sdk-version=LEVEL],[Use Android SDK for API LEVEL (default=12).]),aros_sdk_version="$withval",aros_sdk_version="12")
AC_MSG_RESULT($aros_sdk_version)
aros_android_level=android-$aros_sdk_version
if test ! -d $aros_android_sdk/platforms/$aros_android_level; then
echo "Platform $aros_android_level is not installed in your SDK"
echo "Use --with-sdk-version=<API level number> to select another platform version"
echo "You can check what plaform versions are installed in your SDK"
echo "by examining contents of $aros_android_sdk/platforms directory"
AC_MSG_ERROR([Android platform $aros_android_level is not installed])
fi
export PATH="$aros_android_sdk/tools:$PATH"
AC_PATH_PROG(android_tool, $android_tool)
AROS_REQUIRED(android,$android_tool)
if test "$aros_android_ndk" != "none"; then
AC_MSG_CHECKING([what Android NDK version to use])
AC_ARG_WITH(ndk-version,AC_HELP_STRING([--with-ndk-version=LEVEL],[Use Android NDK for API LEVEL (default=9).]),aros_ndk_version="$withval",aros_ndk_version="9")
AC_MSG_RESULT($aros_ndk_version)
fi
AC_PATH_PROG(ant, ant)
if test "$ant" = ""; then
AC_MSG_WARN([Apache Ant is missing, Java bootstrap can't be built automatically])
fi
AC_MSG_CHECKING([Build debug or release apk])
AC_ARG_WITH(apk-version,AC_HELP_STRING([--with-apk-version=(release|debug)],[Which version of AROSBootstrap.apk to compile. Release version needs key for signing, debug version will only run in emulator. (default=release)]),aros_android_antapk=$withval,aros_android_antapk=release)
if test $aros_android_antapk != release -a $aros_android_antapk != debug; then
AC_MSG_ERROR([apk-version has to be release or debug])