Expand 8bit grayscale image data to rgba. (NicJA)
[AROS.git] / configure.in
blob7e3b23317d391a968ae4627d4bcd985e05306e78
1 dnl Copyright � 1997-2016, The AROS Development Team. All rights reserved.
2 dnl $Id$
3 dnl
4 dnl Desc: Autoconf source for configuration file
5 dnl Lang: english 
7 # Note: After file changes, generate configure anew and commit _both_ files.
9 #TODO
10 # method of getting shared/non-shared ld/ar tool for target.
12 # ------------------------------------------------------------------------
13 # Here starts the first section of the configure.in file.
14 # ------------------------------------------------------------------------
16 AC_INIT(mmakefile)
17 AC_PREREQ(2.61)
18 AC_CONFIG_AUX_DIR(scripts/autoconf)
20 # Check what host we are running on.
21 # If a target is not suggested, we use this one.
22 # Note that what we call a target, Autoconf calls a host.
23 AC_CANONICAL_HOST
25 # Default versions for the gnu tools we build
26 default_gcc_version="6.5.0"
27 default_binutils_version="2.32"
28 default_grub2_version="2.02"
29 target_grub2_version=$default_grub2_version
31 # The AROS target is slightly different to the normal GNU style
32 # format. We don't have the middle part, and we reverse the order
33 # of the $(CPU) and $(OS) bits.
35 # Don't strip the version of the target yet, it might be
36 # useful on some systems.
38 AC_MSG_CHECKING([for AROS style target])
40 if test "$target" = "NONE" ; then
41     target=$host_os-$host_cpu
42 else
43     if test "$target" = "" ; then
44         target=$host_os-$host_cpu
45     fi
47 AC_MSG_RESULT($target)
49 if test "$host_os" = "mingw32" ; then
50     PWDCMD="pwd -W"
53 # Don't know where else to put this...
54 AC_MSG_CHECKING([building AROS in])
55 AROS_BUILDDIR=`${PWDCMD-pwd}`
56 AROS_BUILDDIR_UNIX=${PWD}
57 AC_MSG_RESULT($AROS_BUILDDIR)
59 AC_MSG_CHECKING([AROS source in])
60 srcpwd=`cd ${srcdir} ; ${PWDCMD-pwd}`
61 SRCDIR=${srcpwd}
62 AC_MSG_RESULT($SRCDIR)
64 # Parse the target field into something useful.
65 changequote(<<,>>)
66 target_os=`echo $target | sed 's/^\([^-].*\)-\(.*\)$/\1/'`
67 target_cpu=`echo $target | sed 's/^\([^-].*\)-\(.*\)$/\2/'`
68 changequote([,])
70 # Some debug output, to be removed again.
71 AC_MSG_CHECKING([for target system (debug output)])
72 AC_MSG_RESULT($target_os)
73 AC_MSG_CHECKING([for target cpu (debug output)])
74 AC_MSG_RESULT($target_cpu)
76 dnl --------------------------------------------------------------------
77 dnl Set the default Workbench resolution
78 dnl --------------------------------------------------------------------
79 aros_nominal_width=800
80 aros_nominal_height=600
81 aros_nominal_depth=4
83 dnl --------------------------------------------------------------------
84 dnl Host Configuration Section
85 dnl --------------------------------------------------------------------
86 dnl
87 dnl The idea here is to find out all the information we need about the
88 dnl host. This means things like tools for building directory structures,
89 dnl copying files around and the like.
91 default_c_compilers="gcc clang cc"
92 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="")
93 if test "$use_c_compiler" = ""; then
94     host_c_compilers="$default_c_compilers"
95 else
96     host_c_compilers="$use_c_compiler"
99 default_cxx_compilers="g++ clang++ c++"
100 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="")
101 if test "$use_cxx_compiler" = ""; then
102         host_cxx_compilers="$default_cxx_compilers"
103 else
104     host_cxx_compilers="$use_cxx_compiler"
108 # The first step is to find the host binaries.
109 # Check for a compiler.
110 # Due to a bug in autoconf check for c++ compiler first.
111 # For mor info see, http://osdir.com/ml/bug-autoconf-gnu/2010-05/msg00001.html.
112 AC_PROG_CXX([${host_cxx_compilers}])
113 AC_PROG_CC([${host_c_compilers}])
114 aros_host_def_cc="$CC"
115 AC_PROG_CC_STDC
116 AC_PROG_CPP
118 # Check for a compatible awk
119 AC_CHECK_PROGS(AWK,[gawk nawk])
120 AROS_REQUIRED(gawk,$AWK)
121 AROS_PROG(MMAKE,mmake)
123 # Perform some default variable assignments. Note all of these will be
124 # Regenerated from the script, so there is no need to cache them.
126 aros_build_host=$host
127 aros_host_cpp="$CPP"
128 aros_host_cc="$CC"
129 aros_host_cxx="$CXX"
130 AROS_TOOL_CCPATH(aros_host_ld,ld)
131 AROS_REQUIRED(ld,$aros_host_ld)
132 aros_host_make="make"
133 aros_host_cflags="$CFLAGS"
134 aros_host_cxxflags="$CXXFLAGS"
135 aros_host_cppflags="$CPPFLAGS"
136 aros_host_ldflags="$LDFLAGS"
137 aros_host_debug="-g -O0"
138 aros_host_mkdep="\$(SRCDIR)/scripts/mkdep"
139 aros_host_mkargs="--no-print-directory"
140 aros_host_exe_suffix="$EXEEXT"
141 aros_host_lib_suffix=""
143 # Ignore all compliance, AROS ROMs = 0
144 # KickStart v1.0 = 30
145 # KickStart v1.3 = 34
146 # KickStart v2.0 = 37
147 # KickStart v3.0 = 39
148 # KickStart v3.1 = 40
149 # AmigaOS   v3.5 = 44
150 aros_amigaos_compliance=0
152 AC_CHECK_PROGS(aros_host_aclocal,[aclocal aclocal19 aclocal-1.9])
153 AC_CHECK_PROGS(aros_host_autoconf,[autoconf autoconf259 autoconf253])
154 AC_CHECK_PROGS(aros_host_autoheader,[autoheader autoheader259 autoheader253])
155 AC_CHECK_PROGS(aros_host_automake,[automake automake19 automake-1.9])
157 AROS_REQUIRED(aclocal/aclocal19/aclocal-1.9, $aros_host_aclocal)
158 AROS_REQUIRED(automake/automake19/automake-1.9, $aros_host_automake)
160 case "$aros_host_cc" in
161     *clang*)
162         aros_host_cc_pipe=""
163         ;;
164     *gcc*)
165         aros_host_cc_pipe="-pipe"
166         ;;
167     icc)
168         aros_host_cc_pipe=""
169         ;;
170     *)
171         aros_host_cc_pipe=""
172         ;;
173 esac
175 aros_kernel_cc_includes=""
176 aros_target_cc_includes=""
177 host_cc_elf=yes
179 # ----------------------------------------------------------------------------------------
180 # Host-specific defaults
182 # This is the main host configuration section. It is where the host
183 # can change the values of any variables it needs to change. We do
184 # not look at anything that compiles to the target yet, we'll get
185 # to that later.
187 case "$host_os" in
188     aros*)
189         aros_host_arch="aros"
190         aros_host_cflags="$aros_host_cflags $aros_host_cc_pipe"
191         case "$host_cpu" in
192             *i?86*)
193                 aros_host_cpu="i386"
194                 ;;
195             *x86_64*)
196                 aros_host_cpu="x86_64"
197                 ;;
198             *powerpc*)
199                 aros_host_cpu="ppc"
200                 ;;
201             *)
202                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
203                 aros_host_cpu="$host_cpu"
204                 ;;
205         esac
206         ;;
208     linux*)
209         aros_host_arch="linux"
210         aros_host_cflags="$aros_host_cflags $aros_host_cc_pipe"
211         android_build_os="linux-x86"
212         android_tool="android"
213         default_android_sdk="/opt/android-sdk-linux_x86"
214         case "$host_cpu" in
215             *i?86*)
216                 aros_host_cpu="i386"
217                 ;;
218             *x86_64*)
219                 aros_host_cpu="x86_64"
220                 ;;
221             *m68k*)
222                 aros_host_cpu="m68k"
223                 ;;
224             *powerpc*)
225                 aros_host_cpu="ppc"
226                 ;;
227             *arm*)
228                 aros_host_cpu="arm"
229                 ;;
230             *)
231                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
232                 aros_host_cpu="$host_cpu"
233                 ;;
234         esac
235         ;;
237     freebsd*)
238         aros_host_cflags="$aros_host_cflags $aros_host_cc_pipe -I/usr/local/include"
239         aros_host_make="gmake"
240         aros_host_arch="freebsd"
241         aros_host_cpu="i386"
243         aros_host_ldflags="$aros_host_ldflags -L/usr/local/lib -liconv"
245         dnl FreeBSD 5.x (and later) has changed the default object format.
246         dnl The double [[]] is necessary to get around m4's quoting rules.
247         case $host_os in
248             freebsd[[234]]*)
249                 aros_object_format="elf_i386"
250                 ;;
252             *)
253                 aros_object_format="elf_i386_fbsd"
254                 ;;
255         esac
257         ;;
259     darwin*)
260         AC_MSG_CHECKING([for macOS SDK files])
261         LOC=$( xcode-select -p )
262         AS_IF([ test $? != 0],[AC_MSG_ERROR([XCode incorrectly configured!
263 please run 'xcode-select --install' before
264 re-running configure])])
265         AC_MSG_RESULT($LOC)
266         aros_host_cflags="$aros_host_cflags $aros_host_cc_pipe"
267         aros_host_arch="darwin"
268         host_cc_elf=no
269         if [[ -z ${SED+x} ]]; then SED="gsed"; fi
270         android_build_os="darwin-x86"
271         android_tool="android"
272         default_android_sdk="/android-sdk-mac_x86"
273         case "$host_cpu" in
274             *i?86*)
275                 aros_host_cpu="i386"
276                 ;;
277             *x86_64*)
278                 aros_host_cpu="x86_64"
279                 ;;
280             *powerpc*)
281                 aros_host_cpu="ppc"
282                 ;;
283             *)
284                 AC_MSG_WARN("Unknown CPU for Darwin host -- $host_cpu")
285                 aros_host_cpu="$host_cpu"
286                 ;;
287         esac
289         aros_host_ldflags="$aros_host_ldflags -liconv"
291         ;;
293     dragonfly*)
294         aros_host_cflags="$aros_host_cflags $aros_host_cc_pipe"
295         aros_host_make="gmake"
296         aros_host_arch="dragonfly"
297         case $host_cpu in
298             *i?86*)
299                 aros_host_cpu="i386"
300                 ;;
301             *amd64*)
302                 aros_host_cpu="x86_64"
303                 ;;
304             *)
305                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
306                 aros_host_cpu="$host_cpu"
307                 ;;
308         esac
309         ;;
311     netbsd*)
312         aros_host_cflags="$aros_host_cflags $aros_host_cc_pipe"
313         aros_host_make="gmake"
314         aros_host_arch="netbsd"
315         case "$host_cpu" in
316             *i?86*)
317                 aros_host_cpu="i386"
318                 ;;
319             *m68k*)
320                 aros_host_cpu="m68k"
321                 ;;
322             *)
323                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
324                 aros_host_cpu="$host_cpu"
325                 ;;
326         esac    
327         aros_host_lib_suffix=".0.0"
328         ;;
330     openbsd*)
331         aros_host_cflags="$aros_host_cflags $aros_host_cc_pipe"
332         aros_host_make="gmake"
333         aros_host_arch="openbsd"
334         case "$host_cpu" in
335             *i?86*)
336                 aros_host_cpu="i386"
337                 ;;
338             *)
339                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
340                 aros_host_cpu="$host_cpu"
341                 ;;
342         esac
343         ;;
344         
345     solaris*)
346         aros_host_arch="solaris"
347         aros_host_cflags="$aros_host_cflags $aros_host_cc_pipe"
348         case "$host_cpu" in
349             *i?86*)
350                 aros_host_cpu="i386"
351                 ;;
352             *sparc*)
353                 aros_host_cpu="sparc"
354                 ;;
355             *)
356                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
357                 aros_host_cpu="$host_cpu"
358                 ;;
359         esac
360         ;;
362     morphos*)
363         aros_host_arch="morphos"
364         aros_host_cpu="ppc"
365         host_cc_elf=no
366         ;;
368     amiga*)
369         aros_host_arch="amiga"
370         host_cc_elf=no
371         SORT="/gg/bin/sort"
372         TEST="/gg/bin/test"
373         UNIQ="/gg/bin/uniq"
374         FOR="for"
375         TOUCH="/gg/bin/touch"
376         case "$host_cpu" in
377             *m68k*)
378                 aros_host_cpu="m68k"
379                 ;;
380             *powerpc*)
381                 aros_host_cpu="ppc"
382                 ;;
383             *)
384                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
385                 aros_host_cpu="$host_cpu"
386                 ;;
387         esac
388         ;;
390     cygwin*)
391         aros_host_arch="cygwin"
392         aros_host_cflags="$aros_host_cflags $aros_host_cc_pipe"
393         host_cc_elf=no
394         android_build_os="windows"
395         android_tool="android.bat"
396         default_android_sdk="/cygdrive/c/android-sdk-windows-1.6_r1"
398         case "$host_cpu" in
399             *i?86*)
400                 aros_host_cpu="i386"
401                 ;;
402             *)
403                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
404                 aros_host_cpu="$host_cpu"
405                 ;;
406         esac
407         ;;
409     mingw32*)
410         aros_host_arch="mingw32"
411         aros_host_cflags="$aros_host_cflags $aros_host_cc_pipe"
412         host_cc_elf=no
413         android_build_os="windows"
414         android_tool="android.bat"
415         default_android_sdk="/c/android-sdk-windows-1.6_r1"
417         libpng_libextra="-lws2_32"
419         case "$host_cpu" in
420         *i?86*)
421             dnl Currently there's neither 64-bit MinGW nor MSYS. Both environments are 32-bit
422             dnl and run under emulation. Consequently, uname reports i386 even on 64-bit systems.
423             dnl Here we attempt to detect Windows home platform by asking gcc about its target.
424             dnl 64-bit gcc will output "x86_64-w64-mingw32" here.
426             AC_MSG_CHECKING([for Windows native gcc target])
427             host_cpu=`gcc -dumpmachine`
428             AC_MSG_RESULT($host_cpu)
429             ;;
431         esac
433         case "$host_cpu" in
434         *i?86*)
435             aros_host_cpu="i386"
436             ;;
438         mingw32*)
439             dnl Native i386 gcc for MinGW32 reports 'mingw32' with -dumpmachine switch
440             aros_host_cpu="i386"
441             ;;
443         *x86_64*)
444             aros_host_cpu="x86_64"
445             dnl Dragon's x86_64-w64-mingw32-gcc is a bit broken. It ignores standard $prefix/include
446             dnl directory, so we have to add it explicitly here.
447             aros_host_cflags="$aros_host_cflags -isystem /mingw/include"
448             ;;
450         *)
451             AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
452             aros_host_cpu="$host_cpu"
453             ;;
454         esac
455         ;;
456     *)
457         AC_MSG_ERROR([Unsupported host architecture $host])
458         ;;
459 esac
461 AROS_PROG(aros_host_ar,[ar],[cr])
462 AROS_REQUIRED(ar,$aros_host_ar)
463 AROS_PROG(aros_host_ranlib,ranlib)
464 AROS_REQUIRED(ranlib,$aros_host_ranlib)
465 AROS_PROG(aros_host_strip,strip)
466 AROS_REQUIRED(strip,$aros_host_strip)
468 AROS_PROG(RM,[rm],[-rf])
469 AROS_REQUIRED(rm,$RM)
470 AROS_PROG(CP,[cp])
471 AROS_REQUIRED(cp,$CP)
472 AROS_PROG(MV,[mv])
473 AROS_REQUIRED(mv,$MV)
474 AROS_PROG(ECHO,[echo])
475 AROS_REQUIRED(echo,$ECHO)
476 AROS_PROG(MKDIR,[mkdir],[-p])
477 AROS_REQUIRED(mkdir,$MKDIR)
478 AROS_PROG(TOUCH,[touch])
479 AROS_REQUIRED(touch,$TOUCH)
480 AROS_PROG(SORT,[sort])
481 AROS_REQUIRED(sort,$SORT)
482 AROS_PROG(UNIQ,[uniq])
483 AROS_REQUIRED(uniq,$UNIQ)
484 AROS_PROG(NOP,[true])
485 AROS_REQUIRED(true,$NOP)
486 AROS_PROG(CAT,[cat])
487 AROS_REQUIRED(cat,$CAT)
488 AROS_PROG(BISON,[bison])
489 AROS_REQUIRED(bison,$BISON)
490 AROS_PROG(FLEX,[flex])
491 AROS_REQUIRED(flex,$FLEX)
492 AROS_PROG(PNGTOPNM,[pngtopnm])
493 AROS_REQUIRED(pngtopnm,$PNGTOPNM)
494 AROS_PROG(PPMTOILBM,[ppmtoilbm])
495 AROS_REQUIRED(ppmtoilbm,$PPMTOILBM)
496 AROS_PROG(SED,[sed])
497 AROS_REQUIRED(sed,$SED)
498 AROS_PROG(CHMOD,[chmod])
499 AROS_REQUIRED(chmod,$CHMOD)
500 AROS_PROG(PATCH,[patch])
501 AROS_REQUIRED(patch,$PATCH)
503 AM_PATH_PYTHON(2.5)
505 AC_ARG_ENABLE([libpng-config], [--disable-libpng-config    disable libpng-config test and configuration])
506 if test "$enable_libpng_config" != "no"; then
507   AC_CHECK_PROG([arosconfig_use_libpngconfig],[libpng-config],[yes],[no])
509 if test "$arosconfig_use_libpngconfig" = "yes"; then
510     AC_MSG_CHECKING([libpng-config library])
511     libpng_incdir="`libpng-config --cflags`"
512     libpng_libextra="$libpng_libextra `libpng-config --ldflags`"
513     libpng="`libpng-config --libs`"
514     AC_MSG_RESULT($libpng)
515 else
516     AC_CHECK_LIB(png, png_read_png, [libpng="-lpng"], [libpng="no"])
517     if test "$libpng_libextra" != ""; then
518         if test "$libpng" != "no"; then
519             libpng_libextra="$libpng_libextra $libpng"
520         fi
521     fi
523 AROS_REQUIRED(libpng, $libpng)
524 AC_SUBST(libpng)
525 AC_SUBST(libpng_libextra)
526 AC_SUBST(libpng_incdir)
528 AC_SUBST(FOR, for)
529 AC_SUBST(IF, if)
530 AC_SUBST(TEST, test)
531 AC_SUBST(CMP, cmp)
533 dnl ---------------------------------------------------------------------------
534 dnl Look for things about the host system, good for hosted targets.
535 dnl ---------------------------------------------------------------------------
537 # Check for some includes for the X11 HIDD and the kernel
538 AC_CHECK_HEADERS([sys/ipc.h sys/shm.h \
539     sys/mmap.h sys/mman.h sysexits.h \
540     sys/statfs.h sys/statvfs.h sys/vfs.h sys/param.h \
543 AC_CHECK_HEADERS([sys/mount.h],,,[#include <sys/param.h>])
545 AC_HEADER_DIRENT
546 AC_HEADER_STAT
547 AC_HEADER_STDC
548 AC_HEADER_SYS_WAIT
549 AC_HEADER_TIME
550 AC_STRUCT_ST_BLKSIZE
551 AC_STRUCT_ST_BLOCKS
552 AC_STRUCT_ST_RDEV
553 AC_STRUCT_TM
554 AC_STRUCT_TIMEZONE
555 AC_TYPE_OFF_T
556 AC_TYPE_PID_T
557 AC_TYPE_SIZE_T
558 AC_TYPE_UID_T
560 AC_CHECK_MEMBERS(struct tm.tm_gmtoff)
562 # Look for some functions
563 AC_CHECK_FUNCS([getpagesize kqueue statfs statvfs \
564     clone kse_create rfork_thread thr_create sa_register \
565     getcontext makecontext setcontext sigaltstack swapcontext])
567 AC_FUNC_MMAP
569 #-----------------------------------------------------------------------------
572 # GCC 4.1+ has a stack protection feature that requires OS support. Ubuntu has
573 # it switched on by default, and we use the host compiler, so it compiles AROS
574 # code with this enabled resulting in link failures as we don't have support
575 # for it.
577 # We use two methods to disable it. For the host compiler (used to compile
578 # some hosted modules), we test to see if the compiler supports stack
579 # protection, and if it does we disable it in AROS_CONFIG_CFLAGS. This should
580 # work on all platforms.
583 AC_MSG_CHECKING([whether ${CC} accepts -fno-stack-protector])
584 save_cflags="$CFLAGS"
585 CFLAGS="$CFLAGS -fno-stack-protector"
586 AC_TRY_COMPILE(,, use_no_stack_protector="yes", use_no_stack_protector="no")
587 AC_MSG_RESULT($use_no_stack_protector)
588 if test "x-$use_no_stack_protector" = "x-yes" ; then
589     aros_host_cflags="$aros_host_cflags -fno-stack-protector"
591 CFLAGS="$save_cflags"
593 #-----------------------------------------------------------------------------
595 # Disable pointer-signedness warnings if the compiler recognises the option
596 # (this only works for the host compiler at the moment)
598 AC_MSG_CHECKING([whether ${CC} accepts -Wno-pointer-sign])
599 save_cflags="$CFLAGS"
600 CFLAGS="$CFLAGS -Wno-pointer-sign"
601 AC_TRY_COMPILE(,, use_no_sign_warning="yes", use_no_sign_warning="no")
602 AC_MSG_RESULT($use_no_sign_warning)
603 if test "x-$use_no_sign_warning" = "x-yes" ; then
604     aros_host_cflags="$aros_host_cflags -Wno-pointer-sign"
606 CFLAGS="$save_cflags"
608 #-----------------------------------------------------------------------------
610 # Check if host compiler supports -fgnu89-inline, can be needed for crosstools.
612 AC_MSG_CHECKING([whether ${CC} accepts -fgnu89-inline])
613 save_cflags="$CFLAGS"
614 CFLAGS="$CFLAGS -fgnu89-inline"
615 AC_TRY_COMPILE(,, use_gnu89_inline="yes", use_gnu89_inline="no")
616 AC_MSG_RESULT($use_gnu89_inline)
617 if test "x-$use_gnu89_inline" = "x-yes" ; then
618     gnu89_inline="-fgnu89-inline"
620 CFLAGS="$save_cflags"
623 # For GCC < 4.0 -I- is used for giving the search path for '#include "..."'
624 # On GCC >= 4.0 -iquote should be used
626 AC_MSG_CHECKING([whether ${CC} accepts -iquote])
627 CFLAGS="$CFLAGS -iquote."
628 AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
629 AC_MSG_RESULT($has_iquote)
630 if test "x-$has_iquote" = "x-yes" ; then
631     host_cflags_iquote=-iquote
632     host_cflags_iquote_end=
633 else
634     host_cflags_iquote=-I
635     host_cflags_iquote_end=-I-
638 AC_MSG_NOTICE([Performing target configuration...])
640 dnl --------------------------------------------------------------------
641 dnl Target Configuration Section
642 dnl --------------------------------------------------------------------
644 dnl The target configuration section is responsible for setting up all
645 dnl the paths for includes, and tools required to build AROS to some
646 dnl particular target.
648 aros_nowarn_flags="NOWARN_UNUSED_COMMAND_LINE_ARGUMENT NOWARN_UNKNOWN_WARNING_OPTION NOWARN_POINTER_SIGN NOWARN_PARENTHESES"
650 toolchain_needs_sysroot=no
652 aros_warn_flags=
653 aros_isa_extra=
654 aros_isa_flags=
655 aros_config_cppflags=
656 aros_config_cflags=
657 aros_config_cxxflags=
658 aros_config_aflags="-Wall -x assembler-with-cpp -c"
659 aros_config_ldflags=""
661 aros_shared_default=yes
663 aros_shared_cflags="-fPIC"
664 aros_shared_aflags=""
665 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
666 aros_kernel_ldflags="-Wl,-rpath,./lib"
668 aros_kernel_ar_flags="cr"
669 aros_target_ar_flags="cr"
670 aros_target_nm_flags="-C -ul"
671 aros_target_strip_flags="--strip-unneeded -R.comment"
673 aros_compiler_libs=
674 aros_arch_libs=
676 aros_target_genmap="-Wl,-Map -Xlinker"
678 # Native flavour stuff
679 aros_serial_debug="0"
681 # Palm native flavour stuff
682 aros_palm_debug_hack="0"
684 # Unix flavour stuff
685 aros_nesting_supervisor="0"
687 # Collect-aros stuff: "-ius" to ignore undefined symbols
688 ignore_undefined_symbols=""
690 # Check for X11 by default
691 need_x11="auto"
693 host_x_gfx=no
694 host_sdl_gfx=no
695 host_android_gfx=no
698 AC_MSG_CHECKING([Which toolchain family to use ...])
699 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")
700 AC_MSG_RESULT($aros_toolchain)
703 AC_MSG_CHECKING([if we should enable link time optimizations (LTO)])
704 AC_ARG_ENABLE(lto,AC_HELP_STRING([--enable-lto=[yes|no]],[Enable link time optimizations if the target compiler supports them (default=no)]),
705  aros_config_lto="$enableval",aros_config_lto="no")
706 if test "$aros_config_lto" != "no"; then
707     aros_config_lto="yes"
709 AC_MSG_RESULT($aros_config_lto)
711 AC_MSG_CHECKING([if we should enable coverage instrumentation])
712 AC_ARG_ENABLE(coverage,AC_HELP_STRING([--enable-coverage=[yes|no]],[Enable coverage instrumentation if the target compiler supports it (default=no)]),
713  aros_config_coverage="$enableval",aros_config_coverage="no")
714 if test "$aros_config_coverage" != "no"; then
715     aros_config_coverage="yes"
717 AC_MSG_RESULT($aros_config_coverage)
719 use_ld_wrapper=yes
721 case "$aros_toolchain" in
722     *llvm*)
723         # toolchain_needs_sysroot=yes
724         toolchain_c_compiler="clang"
725         toolchain_cxx_compiler="clang++"
726         toolchain_cpp_preprocessor="clang -E"
727         toolchain_ld="ld.lld"
728         aros_ld="ld"
729         toolchain_as="llvm-as"
730         toolchain_ar="llvm-ar"
731         toolchain_ranlib="llvm-ranlib"
732         toolchain_nm="llvm-nm"
733         toolchain_strip="true"
734         toolchain_objcopy="llvm-objcopy"
735         toolchain_objdump="llvm-objdump"
736         ;;
737     *gnu*)
738         toolchain_c_compiler="gcc"
739         toolchain_cxx_compiler="g++"
740         toolchain_cpp_preprocessor="gcc -E"
741         toolchain_as="as"
742         aros_ld="ld"
743         if test "$aros_config_lto" != "yes"; then
744             toolchain_ld="ld"
745             toolchain_ar="ar"
746             toolchain_ranlib="ranlib"
747             toolchain_nm="nm"
748         else
749             toolchain_ld="ld.bfd"
750             toolchain_ar="gcc-ar"
751             toolchain_ranlib="gcc-ranlib"
752             toolchain_nm="gcc-nm"
753         fi
754         toolchain_strip="strip"
755         toolchain_objcopy="objcopy"
756         toolchain_objdump="objdump"
757         ;;
758     *)
759         AC_MSG_WARN("Unknown toolchain family!")
760         toolchain_c_compiler="cc"
761         toolchain_cxx_compiler="c++"
762         toolchain_cpp_preprocessor="cpp"
763         toolchain_ld="ld"
764         aros_ld="ld"
765         toolchain_as="as"
766         toolchain_ar="ar"
767         toolchain_ranlib="ranlib"
768         toolchain_nm="nm"
769         toolchain_strip="strip"
770         toolchain_objcopy="objcopy"
771         toolchain_objdump="objdump"
772         ;;
773 esac
775 #-----------------------------------------------------------------------------
777 AC_MSG_CHECKING([which type of build to do])
778 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")
780 if test "$build_type" = "nightly"; then
781     build_type_string="NIGHTLY"
782 elif test "$build_type" = "snapshot"; then
783     build_type_string="SNAPSHOT"
784 elif test "$build_type" = "milestone"; then
785     build_type_string="MILESTONE"
786 elif test "$build_type" = "release"; then
787     build_type_string="RELEASE"
788 else
789     build_type_string="PERSONAL"
790     build_type="personal"
793 aros_config_cppflags="$aros_config_cppflags -DAROS_BUILD_TYPE=AROS_BUILD_TYPE_$build_type_string"
795 AC_MSG_RESULT($build_type)
797 #-----------------------------------------------------------------------------
798 all_debug_types="messages stack modules mungwall symbols"
800 AC_MSG_CHECKING([which debug types to enable])
801 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)]),
802  debug="$enableval",debug="")
804 if test "$debug" = "" -o "$debug" = "no"; then
805     debug="none"
806 elif test "$debug" = "yes"; then
807     debug="all"
810 if test "$debug" = "all" ; then
811     debug="messages stack modules symbols"
812     for d in $all_debug_types; do
813         export aros_${d}_debug="1"
814     done
815 else
816     for d in $all_debug_types; do
817         export aros_${d}_debug="0"
818     done
821 if test "$debug" != "none"; then
822     debug=`echo $debug | sed s/,/\ /g`
823     for d in $debug; do
824         found="0"
825         for d2 in $all_debug_types; do
826             if test "$d2" = "$d"; then
827                 found="1"
828                 break
829             fi
830         done
831         if test "$found" = "0"; then
832             AC_MSG_ERROR([unrecognized debug type "$d". Available types are: all none $all_debug_types])
833         fi
834         export aros_${d}_debug="1"
835     done
836     aros_debug="yes"
838 AC_MSG_RESULT($debug)
840 if test "$aros_messages_debug" = "1"; then
841     aros_messages_debug="-DADEBUG=1 -DMDEBUG=1"
842 else
843     aros_messages_debug=""
845 if test "$aros_symbols_debug" = "1"; then
846     aros_symbols_debug="-g"
847 else
848     aros_symbols_debug=""
851 # These are the flags to pass when compiling debugged programs
852 aros_debug_cppflags="$aros_messages_debug"
853 aros_debug_cflags="$aros_symbols_debug"
854 aros_debug_cxxflags=
855 aros_debug_aflags=""
856 aros_debug_ldflags="$aros_symbols_debug"
858 #-----------------------------------------------------------------------------
859 #   Checking for distcc and ccache.
861 #   Always apply the transforms in this particular order. Basically you should
862 #   always run 'ccache distcc compiler' in that order for the best performance.
864 AC_MSG_CHECKING([whether to enable distcc])
865 AC_ARG_ENABLE(distcc,AC_HELP_STRING([--enable-distcc],[Use distcc as a front end to the compiler (default=no).]),distcc="$enableval",distcc="no")
866 if test "$distcc" != "" -a "$distcc" != "no"; then
867     # AC_CHECK_PROG will print out the result in this case
868     AC_PATH_PROG(DISTCC,[distcc],distcc,)
869 else
870     AC_MSG_RESULT(no)
873 AC_MSG_CHECKING([whether to enable ccache])
874 AC_ARG_ENABLE(ccache,AC_HELP_STRING([--enable-ccache],[Use ccache as a front end to the compiler (default=no).]),ccache="$enableval",ccache="no")
875 if test "$ccache" != "" -a "$ccache" != "no"; then
876     # AC_CHECK_PROG will print out the result in this case
877     AC_CHECK_PROG(CCACHE,[ccache],ccache,)
878 else
879     AC_MSG_RESULT(no)
882 #-----------------------------------------------------------------------------
883 AC_MSG_CHECKING([what specific host gcc version to use])
884 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="")
885 if test "$kernel_tool_version" != "" ; then
886     msg_result=$kernel_tool_version
887 else
888     msg_result="default"
890 AC_MSG_RESULT($msg_result)
892 #-----------------------------------------------------------------------------
893 AC_MSG_CHECKING([what optimization flags to use])
894 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")
895 if test "$optimization_level" = "unknown"; then
896     dnl default is -O2 for normal builds, -O0 for debug builds
897     optimization="default"
898     if test "$debug" != "none"; then
899         optimization_level="-O0"
900     else
901         optimization_level="-O2"
902     fi
903 else
904     optimization="$optimization_level"
906 AC_MSG_RESULT($optimization)
908 paranoia_default=yes
909 #-----------------------------------------------------------------------------
910 AC_MSG_CHECKING([which paranoia flags to use])
911 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"])
912 if test "$paranoia_flags" = "no"; then
913         paranoia_flags="-Wall -Werror-implicit-function-declaration"
914         msg_result="none"
915 else
916     if test "$paranoia_flags" = "yes"; then
917         paranoia_flags="-Wall -Werror"
918     fi
919     msg_result="$paranoia_flags"
921 AC_MSG_RESULT($msg_result)
922 aros_warn_flags="$aros_warn_flags $paranoia_flags"
924 #-----------------------------------------------------------------------------
925 AC_MSG_CHECKING([what target variant to enable])
926 AC_ARG_ENABLE(target_variant,AC_HELP_STRING([--enable-target-variant=NAME],[Enable a specific target variant (default=none)]),target_variant=$enableval,target_variant="")
927 if test "$target_variant" = ""; then
928     aros_target_variant=""
929     aros_target_suffix=""
930     enableval="none"
931 else
932     aros_target_variant="$target_variant"
933     aros_target_suffix="-$target_variant"
935 AC_MSG_RESULT($enableval)
937 #-----------------------------------------------------------------------------
938 # Target-specific defaults. You can override then on a per-target basis.
940 # Bootloader name. Currently used by PC target.
941 target_bootloader="none"
942 PLATFORM_EXECSMP=
943 ENABLE_EXECSMP=
945 #-----------------------------------------------------------------------------
946 # Additional options for some specific targets
948 case "$aros_target_variant" in
949 ios)
950     AC_MSG_CHECKING([XCode path])
951     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")
952     AC_MSG_RESULT($aros_xcode_path)
954     AC_MSG_CHECKING([what iOS SDK version to use])
955     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")
956     AC_MSG_RESULT($aros_sdk_version)
958     ;;
960 "android")
961     AC_MSG_CHECKING([Android SDK path])
962     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)
963     AC_MSG_RESULT($aros_android_sdk)
965     AC_MSG_CHECKING([Android NDK path])
966     AC_ARG_WITH(ndk,AC_HELP_STRING([--with-ndk=PATH],[Specify Android NDK path (default=none).]),aros_android_ndk="$withval",aros_android_ndk="none")
967     AC_MSG_RESULT($aros_android_ndk)
969     AC_MSG_CHECKING([what Android SDK version to use])
970     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")
971     AC_MSG_RESULT($aros_sdk_version)
973     aros_android_level=android-$aros_sdk_version
974     if test ! -d $aros_android_sdk/platforms/$aros_android_level; then
975         echo "Platform $aros_android_level is not installed in your SDK"
976         echo "Use --with-sdk-version=<API level number> to select another platform version"
977         echo "You can check what plaform versions are installed in your SDK"
978         echo "by examining contents of $aros_android_sdk/platforms directory"
979         AC_MSG_ERROR([Android platform $aros_android_level is not installed])
980     fi
982     export PATH="$aros_android_sdk/tools:$PATH"
983     AC_PATH_PROG(android_tool, $android_tool)
984     AROS_REQUIRED(android,$android_tool)
986     if test "$aros_android_ndk" != "none"; then
987         AC_MSG_CHECKING([what Android NDK version to use])
988         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")
989         AC_MSG_RESULT($aros_ndk_version)
990     fi
992     AC_PATH_PROG(ant, ant)
993     if test "$ant" = ""; then
994         AC_MSG_WARN([Apache Ant is missing, Java bootstrap can't be built automatically])
995     fi
997     AC_MSG_CHECKING([Build debug or release apk])
998     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)
999     if test $aros_android_antapk != release -a $aros_android_antapk != debug; then
1000         AC_MSG_ERROR([apk-version has to be release or debug])
1001     fi
1002     AC_MSG_RESULT($aros_android_antapk)
1004     dnl MSYS bash can't run .bat files directly, then need to be started via cmd.exe
1005     if test "$host_os" = "mingw32"; then
1006         android_tool="cmd //c $android_tool"
1007     fi
1009     need_dlopen="no"
1011     ;;
1012 esac
1014 #-----------------------------------------------------------------------------
1015 # External toolchains
1016 kernel_tool_prefix="none"
1017 aros_tool_prefix="none"
1018 elf_tool_prefix="${target_cpu}-elf-"
1020 export_newline="
1023 # Base target cpu ISA configuration switch.
1024 case "$target_cpu" in
1025     *aarch64*)
1026         ;;
1027     *arm*)
1028         ;;
1029     *m68k*)
1030         m68k_isa_extra="ISA_MC68000_FLAGS           := -march=68000"
1031         m68k_020_isa_extra="ISA_MC68020_FLAGS         := -march=68020"
1032         m68k_030_isa_extra="ISA_MC68030_FLAGS         := -march=68030"
1033         m68k_040_isa_extra="ISA_MC68040_FLAGS         := -march=68040"
1034         m68k_060_isa_extra="ISA_MC68060_FLAGS         := -march=68060"
1035         m68k_ac080_isa_extra="ISA_AC68080_FLAGS         := -march=68040"
1036         m68k_020_ext="ISA_MC68020_EXT           :=020"
1037         m68k_030_ext="ISA_MC68030_EXT           :=030"
1038         m68k_040_ext="ISA_MC68040_EXT           :=040"
1039         m68k_060_ext="ISA_MC68060_EXT           :=060"
1040         m68k_020_cflags="ISA_MC68020_CFLAGS        :="
1041         m68k_030_cflags="ISA_MC68030_CFLAGS        :="
1042         m68k_040_cflags="ISA_MC68040_CFLAGS        :="
1043         m68k_060_cflags="ISA_MC68060_CFLAGS        :="
1044         m68k_020_cppflags="ISA_MC68020_CPPFLAGS      :="
1045         m68k_030_cppflags="ISA_MC68030_CPPFLAGS      :="
1046         m68k_040_cppflags="ISA_MC68040_CPPFLAGS      :="
1047         m68k_060_cppflags="ISA_MC68060_CPPFLAGS      :="
1048         m68k_020_ldflags="ISA_MC68020_LDFLAGS       :="
1049         m68k_030_ldflags="ISA_MC68030_LDFLAGS        :="
1050         m68k_040_ldflags="ISA_MC68040_LDFLAGS        :="
1051         m68k_060_ldflags="ISA_MC68060_LDFLAGS        :="
1052         ;;
1053     *x86_64* | *i?86*)
1054         x86_isa_extra="ISA_X86_FLAGS           := -m32 -march=i486"
1055         x86_64_isa_extra="ISA_X8664_FLAGS         := -mcmodel=large"
1056         ;;
1057     *powerpc*)
1058         ;;
1059 esac
1061 # This is the target configuration switch.
1062 case "$target_os" in
1063     linux*)
1064         aros_target_arch="linux"
1065         aros_target_family="unix"
1066         case "$target_cpu" in
1067             *m68k*)
1068                 aros_target_cpu="m68k"
1069                 aros_object_format="m68kelf"
1070                 aros_flavour="emulcompat"
1071                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D__mc68000 -D__linux__"
1072                 aros_isa_flags="$""(ISA_MC68000_FLAGS)"
1073                 aros_shared_ldflags="-Wl,-T,\$(TOP)/config/linux/m68k/script.so"
1074                 aros_kernel_ldflags="-Wl,-rpath,./lib,-T,\$(TOP)/config/linux/m68k/script.normal"
1075                 gcc_target_cpu="mc68000"
1076                 ;;
1077             *i?86*)
1078                 aros_target_cpu="i386"
1079                 aros_object_format="elf_i386"
1080                 aros_flavour="emulation"
1081                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__linux__"
1082                 aros_isa_flags="$""(ISA_X86_FLAGS)"
1083                 x86_64_isa_extra="$x86_64_isa_extra -mno-red-zone"
1084                 aros_kernel_ldflags="-Wl,-melf_i386"
1085                 aros_nominal_depth=8
1086                 gcc_target_cpu="i386"
1087                 pci_hidd_target="hidd-pci-linux"
1088                 android_tool_dir_prefix="x86"
1089                 android_tool_prefix="i686-android-linux"
1090                 android_ndk_arch="x86"
1091                 ;;
1092             *x86_64*)
1093                 aros_target_cpu="x86_64"
1094                 aros_object_format="elf_x86_64"
1095                 aros_flavour="emulation"
1096                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64 -D__linux__"
1097                 aros_isa_flags="$""(ISA_X8664_FLAGS)"
1098                 x86_64_isa_extra="$x86_64_isa_extra -mno-red-zone"
1099                 aros_config_cflags="$aros_config_cflags -fno-omit-frame-pointer"
1100                 aros_config_cxxflags="$aros_config_cxxflags -fno-omit-frame-pointer"
1101                 aros_nominal_depth=8
1102                 pci_hidd_target="hidd-pci-linux"
1103                 ;;
1104             *powerpc*)
1105                 aros_target_cpu="ppc"
1106                 aros_object_format="elf32ppc"
1107                 aros_flavour="emulation"
1108                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc -D__linux__"
1109                 aros_nominal_depth=8
1110                 gcc_target_cpu="ppc"
1111                 ;;
1112 # TODO
1113 # Same as powerpc, but I need this for the nightly build to work again.
1114 # Actually, the nightly should be made working with powerpc target.
1115 # That just was too much work for the moment, another week or two.
1116             *ppc*)
1117                 aros_target_cpu="ppc"
1118                 aros_object_format="elf32ppc"
1119                 aros_flavour="emulation"
1120                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc -D__linux__"
1121                 aros_nominal_depth=8
1122                 gcc_target_cpu="ppc"
1123                 ;;
1124             *aarch64*)
1125                 aros_target_cpu="aarch64"
1126                 target_cpu="aarch64"
1127                 aros_object_format="aarch64elf_aros"
1128                 aros_flavour="emulation"
1129                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm -D__linux__"
1130                 gcc_target_cpu="aarch64"
1131                 aros_config_cflags="$aros_config_cflags -fno-strict-aliasing -fno-omit-frame-pointer"
1132                 aros_config_cxxflags="$aros_config_cxxflags -fno-strict-aliasing -fno-omit-frame-pointer"
1133                 aros_config_aflags="$aros_config_aflags -fno-strict-aliasing"
1134                 aros_arch_libs="-laeabi"
1135                 gcc_default_float_abi="hard"
1136                 kernel_tool_prefix="aarch64-linux-gnueabihf-"
1137                 ;;
1138             *armhf*)
1139                 aros_target_cpu="arm"
1140                 target_cpu="arm"
1141                 aros_object_format="armelf_aros"
1142                 aros_flavour="emulation"
1143                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm -D__linux__"
1144                 gcc_target_cpu="arm"
1145                 aros_config_cflags="$aros_config_cflags -fno-strict-aliasing -fno-omit-frame-pointer"
1146                 aros_config_cxxflags="$aros_config_cxxflags -fno-strict-aliasing -fno-omit-frame-pointer"
1147                 aros_config_aflags="$aros_config_aflags -fno-strict-aliasing"
1148                 aros_arch_libs="-laeabi"
1149                 gcc_default_float_abi="hard"
1150                 android_tool_dir_prefix="arm-linux-androideabi"
1151                 android_tool_prefix="arm-linux-androideabi"
1152                 android_ndk_arch="arm"
1153                 kernel_tool_prefix="arm-linux-gnueabihf-"
1154                 ;;
1155             *arm*)
1156                 aros_target_cpu="arm"
1157                 aros_object_format="armelf_aros"
1158                 aros_flavour="emulation"
1159                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm -D__linux__"
1160                 gcc_target_cpu="arm"
1161                 aros_config_cflags="$aros_config_cflags -fno-strict-aliasing -fno-omit-frame-pointer"
1162                 aros_config_cxxflags="$aros_config_cxxflags -fno-strict-aliasing -fno-omit-frame-pointer"
1163                 aros_config_aflags="$aros_config_aflags -fno-strict-aliasing"
1164                 aros_arch_libs="-laeabi"
1165                 android_tool_dir_prefix="arm-linux-androideabi"
1166                 android_tool_prefix="arm-linux-androideabi"
1167                 android_ndk_arch="arm"
1168                 kernel_tool_prefix="arm-linux-gnueabi-"
1169                 ;;
1170             *)
1171                 AC_MSG_ERROR("Unknown CPU for Linux -- $target_cpu")
1172                 ;;
1173         esac
1174         case "$aros_target_variant" in
1175             android)
1177                 dnl Not all Linux CPUs are supported by Android
1178                 if test "$android_ndk_arch" = ""; then
1179                     AC_MSG_ERROR("Unsupported CPU for Android -- $target_cpu")
1180                 fi
1182                 aros_nominal_width=320
1183                 aros_nominal_height=480
1184                 if test "$aros_android_ndk" = "none"; then
1185                     dnl Use standalone toolchain, don't adjust paths
1186                     aros_kernel_cflags="-mandroid"
1187                     aros_kernel_ldflags="-mandroid"
1188                     CFLAGS="-mandroid"
1189                 else
1190                     dnl In Android NDK toolchains are placed in own directories,
1191                     dnl but tool names are not suffixed with version 
1192                     export PATH="$aros_android_ndk/toolchains/$android_tool_dir_prefix-$kernel_tool_version/prebuilt/$android_build_os/bin:$PATH"
1193                     kernel_tool_version=""
1194                     aros_android_ndk="$aros_android_ndk/platforms/android-$aros_ndk_version/arch-$android_ndk_arch"
1195                     aros_kernel_cflags="--sysroot $aros_android_ndk -mandroid"
1196                     aros_kernel_ldflags="--sysroot $aros_android_ndk -mandroid"
1197                     CFLAGS="$CFLAGS --sysroot $aros_android_ndk -mandroid"
1198                     aros_kernel_includes="-isystem $aros_android_ndk/usr/include"
1199                 fi
1200                 need_x11=no
1201                 host_android_gfx=yes
1202                 # Disable implicit PIC mode
1203                 aros_config_cflags="$aros_config_cflags -fno-pic"
1204                 kernel_tool_prefix="$android_tool_prefix-"
1205             ;;
1206         esac
1207     ;;
1209     pc)
1210         aros_target_arch="pc"
1211         aros_shared_default="no"
1212         target_bootloader="grub2"
1213         case "$target_cpu" in
1214             *i?86*)
1215                 aros_target_cpu="i386"
1217                 dnl If somebody hasn't already set the target object
1218                 dnl format, then use this value. Mostly to support
1219                 dnl FreeBSD cross-compilation.
1220                 dnl TODO: Remove when we always use our compiler.
1222                 if test "$aros_object_format" = "" ; then
1223                     aros_object_format="elf_i386"
1224                 fi
1225                 aros_flavour="standalone"
1226                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1227                 aros_isa_flags="$""(ISA_X86_FLAGS)"
1228                 x86_64_isa_extra="$x86_64_isa_extra -mno-red-zone"
1229                 aros_kernel_ldflags="-Wl,-melf_i386"
1230                 aros_nominal_width=640
1231                 aros_nominal_height=480
1232                 gcc_target_cpu="i386"
1233                 ;;
1234             *x86_64*)
1235                 PLATFORM_EXECSMP="#define __AROSPLATFORM_SMP__"
1236                 aros_target_cpu="x86_64"
1237                 aros_serial_debug=1
1238                 if test "$aros_object_format" = "" ; then
1239                     aros_object_format="elf_x86_64"
1240                 fi
1241                 aros_flavour="standalone"
1242                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
1243                 aros_isa_flags="$""(ISA_X8664_FLAGS)"
1244                 x86_64_isa_extra="$x86_64_isa_extra -mno-red-zone"
1245                 aros_config_cflags="$aros_config_cflags -fno-asynchronous-unwind-tables -fno-omit-frame-pointer"
1246                 aros_config_cxxflags="$aros_config_cxxflags -fno-asynchronous-unwind-tables -fno-omit-frame-pointer"
1247                 aros_kernel_ldflags=""
1248                 aros_nominal_width=640
1249                 aros_nominal_height=480
1250                 case "$aros_target_variant" in
1251                     smp)
1252                         ENABLE_EXECSMP="#define __AROSEXEC_SMP__"
1253                     ;;
1254                 esac
1255                 ;;
1256             *)
1257                 AC_MSG_ERROR("Unknown native CPU -- $target_cpu")
1258                 ;;
1259         esac
1260         ;;
1262     prep)
1263         aros_target_arch="prep"
1264         aros_shared_default="no"
1265         aros_target_cpu="ppc"
1266         aros_object_format="elf32ppc"
1267         aros_flavour="ppcnative"
1268         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1269         aros_kernel_ldflags=""
1270         aros_nominal_width=640
1271         aros_nominal_height=480
1272         gcc_target_cpu="ppc"
1273         ;;
1275     freebsd*)
1276         aros_target_arch="freebsd"
1277         aros_target_family="unix"
1278         aros_target_cpu="i386"
1279         aros_flavour="emulation"
1280         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1281         gcc_target_cpu="i386"
1283         aros_target_strip_flags="-x"
1284         ;;
1286     darwin*)
1287         aros_target_arch="darwin"
1288         aros_target_family="unix"
1289         aros_flavour="emulation"
1290         case "$target_cpu" in
1291             *i?86*)
1292                 aros_ios_platform="iPhoneSimulator"
1293                 aros_target_cpu="i386"
1294                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1295                 aros_isa_flags="$""(ISA_X86_FLAGS)"
1296                 aros_kernel_ldflags=""
1297                 aros_macosx_version="10.4"
1298                 aros_nominal_depth=8
1299                 gcc_target_cpu="i386"
1300                 aros_object_format="elf_i386"
1301                 aros_kernel_ar_flags="-cr"
1302                 aros_target_strip_flags="-x"
1303                 kernel_tool_flags="-m32"
1304                 ;;
1305             *x86_64*)
1306                 aros_target_cpu="x86_64"
1307                 aros_object_format="elf_x86_64"
1308                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
1309                 aros_isa_flags="$""(ISA_X8664_FLAGS)"
1310                 aros_macosx_version="10.6"
1311                 aros_config_cflags="$aros_config_cflags -fno-omit-frame-pointer"
1312                 aros_config_cxxflags="$aros_config_cxxflags -fno-omit-frame-pointer"
1313                 aros_kernel_cflags="-m64"
1314                 aros_kernel_ldflags="-m64"
1315                 aros_nominal_depth=8
1316                 aros_kernel_ar="ar"
1317                 aros_kernel_ar_flags="-cr"
1318                 aros_kernel_ld="ld"
1319                 aros_kernel_as="as"
1320                 aros_kernel_ranlib="ranlib"
1321                 aros_kernel_nm="nm"
1322                 aros_kernel_strip="strip"
1323                 kernel_tool_prefix="i686-apple-darwin10-"
1324                 ;;
1325             *ppc*)
1326                 aros_target_cpu="ppc"
1327                 aros_object_format="elf32ppc"
1328                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1329                 aros_kernel_ldflags=""
1330                 aros_macosx_version="10.0"
1331                 aros_nominal_depth=8
1332                 gcc_target_cpu="ppc"
1333                 aros_kernel_ar="ar"
1334                 aros_kernel_ar_flags="-cr"
1335                 aros_kernel_ld="ld -arch ppc"
1336                 aros_kernel_as="as -arch ppc"
1337                 aros_kernel_ranlib="ranlib -arch ppc"
1338                 aros_kernel_nm="nm -arch ppc"
1339                 aros_kernel_strip="strip -arch ppc"
1340                 kernel_tool_prefix="powerpc-apple-darwin10-"
1341                 ;;
1342             *arm*)
1343                 aros_ios_platform="iPhoneOS"
1344                 aros_target_cpu="arm"
1345                 aros_object_format="armelf_aros"
1346                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
1347                 aros_arch_libs="-laeabi"
1348                 aros_nominal_depth=8
1349                 gcc_target_cpu="arm"
1350                 aros_kernel_ar="ar"
1351                 aros_kernel_ar_flags="-cr"
1352                 aros_kernel_ld="ld -arch arm"
1353                 aros_kernel_ranlib="ranlib -arch arm"
1354                 kernel_tool_prefix="arm-apple-darwin10-" 
1355                 export PATH="$aros_xcode_path/Platforms/$aros_ios_platform.platform/Developer/usr/bin:$PATH"
1356                 ;;
1357             *)
1358                 AC_MSG_ERROR("Unsupported target CPU for darwin hosted flavour -- $target_cpu")
1359                 ;;
1360         esac
1361         case "$aros_target_variant" in
1362             ios)
1363                 aros_ios_version="3.0"
1364                 aros_nominal_width=320
1365                 aros_nominal_height=480
1366                 aros_ios_sdk="$aros_xcode_path/Platforms/$aros_ios_platform.platform/Developer/SDKs/$aros_ios_platform$aros_sdk_version.sdk"
1367                 kernel_tool_flags="$target_tool_flags -isysroot $aros_ios_sdk"
1368                 aros_kernel_includes="-isystem $aros_ios_sdk/usr/include"
1369                 need_x11=no
1370                 # This is here because it may depend on iOS or SDK version
1371                 aros_kernel_cflags="$aros_kernel_cflags -miphoneos-version-min=$aros_ios_version"
1372                 aros_kernel_ldflags="$aros_kernel_ldflags -miphoneos-version-min=$aros_ios_version"
1373                 aros_kernel_objcflags="-fobjc-abi-version=2 -fobjc-legacy-dispatch"
1374             ;;
1375             *)
1376                 aros_kernel_cflags="$aros_kernel_cflags -mmacosx-version-min=$aros_macosx_version"
1377                 aros_kernel_ldflags="$aros_kernel_ldflags -mmacosx-version-min=$aros_macosx_version"
1378             ;;
1379         esac
1380         ;;
1382     dragonfly*)
1383         aros_target_arch="dragonfly"
1384         aros_target_family="unix"
1385         aros_flavour="emulation"
1386         case "$target_cpu" in
1387             *i?86*)
1388                 aros_target_cpu="i386"
1389                 aros_object_format="elf_i386"
1390                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__DragonFly__"
1391                 aros_isa_flags="$""(ISA_X86_FLAGS)"
1392                 ;;
1393             *x86_64*)
1394                 aros_config_cflags="$aros_config_cflags -fno-omit-frame-pointer"
1395                 aros_config_cxxflags="$aros_config_cxxflags -fno-omit-frame-pointer"
1396                 aros_target_cpu="x86_64"
1397                 aros_object_format="elf_x86_64"
1398                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64 -D__DragonFly__"
1399                 aros_isa_flags="$""(ISA_X8664_FLAGS)"
1400                 ;;
1401             *)
1402                 AC_MSG_ERROR("Unknown CPU for DragonFly -- $target_cpu")
1403                 ;;
1404         esac
1405         ;;
1407     netbsd*)
1408         aros_target_arch="netbsd"
1409         aros_target_family="unix"
1410         case "$target_cpu" in
1411             *m68k*)
1412                 aros_target_cpu="m68k"
1413                 aros_object_format="m68kelf"
1414                 aros_flavour="emulcompat"
1415                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D__mc68000 -D__NetBSD__"
1416                 aros_isa_flags="$""(ISA_MC68000_FLAGS)"
1417                 gcc_target_cpu="mc68000"
1418                 ;;
1419             *i?86*)
1420                 aros_target_cpu="i386"
1421                 aros_object_format="elf_i386"
1422                 aros_flavour="emulation"
1423                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__NetBSD__"
1424                 aros_isa_flags="$""(ISA_X86_FLAGS)"
1425                 aros_nominal_depth=8
1426                 gcc_target_cpu="i386"
1427                 ;;
1428             *)
1429                 AC_MSG_ERROR("Unknown CPU for NetBSD -- $target_cpu")
1430                 ;;
1431         esac
1432         aros_target_genmap="-Wl,-M -Xlinker >"
1433         aros_flavour="emulation"
1434         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1435         ;;   
1437     openbsd*)
1438         aros_target_arch="openbsd"
1439         aros_target_family="unix"
1440         case "$target_cpu" in
1441             *i?86*)
1442                 aros_target_cpu="i386"
1443                 aros_object_format="elf_i386"
1444                 aros_flavour="emulation"
1445                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__OpenBSD__"
1446                 aros_isa_flags="$""(ISA_X86_FLAGS)"
1447                 gcc_target_cpu="i386"
1448                 ;;
1449             *)
1450                 AC_MSG_ERROR("Unknown CPU for OpenBSD -- $target_cpu")
1451                 ;;
1452         esac
1453         aros_target_genmap="-Wl,-M -Xlinker >"
1454         aros_target_nm_flags="-u"
1455         aros_flavour="emulation"
1456         ;;
1458     solaris*)
1459         aros_target_arch="solaris"
1460         aros_target_family="unix"
1461         case "$target_cpu" in
1462            *i?86*)
1463                aros_target_cpu="i386"
1464                aros_object_format="elf_i386"
1465                aros_flavour="emulation"
1466                aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__Solaris__"
1467                aros_isa_flags="$""(ISA_X86_FLAGS)"
1468                aros_nominal_depth=8
1469                gcc_target_cpu="i386"
1470                ;;
1471             *sparc*)
1472                 aros_target_cpu="sparc"
1473                 aros_object_format="elf_sparc"
1474                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dsparc -D__Solaris__"
1475                 gcc_target_cpu="sparc"
1476                 ;;
1477             *)
1478                 AC_MSG_ERROR("Unknown CPU for Solaris -- $target_cpu")
1479                 ;;
1480         esac
1481         aros_config_cppflags="$aros_config_cppflags -D$aros_target_cpu"
1482         aros_flavour="emulation"
1483         ;;
1485     morphos*)
1486         aros_target_arch="morphos"
1487         aros_shared_default="no"
1488         aros_target_cpu="ppc"
1489         aros_object_format="elf_ppc"
1490         aros_flavour="nativecompat"
1491         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1492         gcc_target_cpu="ppc"
1493         ;;
1495     sam440)
1496         aros_target_arch="sam440"
1497         aros_shared_default="no"
1498         aros_target_cpu="ppc"
1499         aros_object_format="elf32ppc"
1500         aros_flavour="ppcnative"
1501         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1502         aros_kernel_ldflags=""
1503         aros_nominal_width=1024
1504         aros_nominal_height=768
1505         aros_nominal_depth=24
1506         aros_isa_flags="$aros_isa_flags -mcpu=440fp -mno-toc"
1507         aros_config_cflags="$aros_config_cflags -fno-asynchronous-unwind-tables"
1508         aros_config_cxxflags="$aros_config_cxxflags -fno-asynchronous-unwind-tables"
1509         gcc_target_cpu="powerpc"
1510         ;;
1512     efika)
1513         aros_target_arch="efika"
1514         aros_shared_default="no"
1515         aros_target_cpu="arm"
1516         aros_object_format="armelf_aros"
1517         aros_flavour="standalone"
1518         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
1519         aros_kernel_ldflags=""
1520         aros_nominal_width=1024
1521         aros_nominal_height=600
1522         aros_arch_libs="-laeabi"
1523         gcc_default_cpu="armv7-a"
1524         gcc_default_fpu="vfpv3"
1525         aros_isa_flags="$aros_isa_flags -mtune=cortex-a8"
1526         aros_config_cflags="$aros_config_cflags -fno-strict-aliasing -fno-asynchronous-unwind-tables"
1527         aros_config_cxxflags="$aros_config_cxxflags -fno-strict-aliasing -fno-asynchronous-unwind-tables"
1528         aros_config_aflags="$aros_config_aflags -fno-strict-aliasing -fno-asynchronous-unwind-tables"
1529         if test "$optimization" = "default"; then
1530             optimization_level="-Os"
1531         fi
1532         case "$target_cpu" in
1533             *armhf*)
1534                 gcc_default_float_abi="hard"
1535                 target_cpu=arm
1536                 aros_target_cpu=arm
1537                 ;;
1538             *arm*)
1539                 gcc_default_float_abi="softfp"
1540                 ;;
1541             *)
1542                 AC_MSG_ERROR("Unknown CPU for EfikaMX $target_cpu")
1543                 ;;
1544         esac
1545         ;;
1546         
1547     chrp)
1548         aros_target_arch="chrp"
1549         aros_shared_default="no"
1550         aros_target_cpu="ppc"
1551         aros_object_format="elf32ppc"
1552         aros_flavour="ppcnative"
1553         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1554         aros_kernel_ldflags=""
1555         aros_nominal_width=640
1556         aros_nominal_height=480
1557         aros_isa_flags="$aros_isa_flags -mno-toc"
1558         aros_config_cflags="$aros_config_cflags -fno-asynchronous-unwind-tables"
1559         aros_config_cxxflags="$aros_config_cxxflags -fno-asynchronous-unwind-tables"
1560         gcc_target_cpu="powerpc"
1561         case "$aros_target_variant" in
1562             efika)
1563                 aros_isa_flags="$aros_isa_flags -mcpu=603e"
1564                 aros_config_cppflags="$aros_config_cppflags -DBIG_ENDIAN_OHCI=1"
1565             ;;
1566         esac
1567         ;;
1569     r*pi)
1570         PLATFORM_EXECSMP="#define __AROSPLATFORM_SMP__"
1571         aros_flavour="standalone"
1572         aros_target_arch="raspi"
1574         aros_shared_default="no"
1576         aros_target_mkdep="$aros_target_mkdep -D__GNUC__"
1577         
1578         case "$target_cpu" in
1579             *aarch64*)
1580                 aros_target_cpu="aarch64"
1581                 gcc_default_cpu="aarch64"
1582                 aros_object_format="aarch64elf_aros"
1583                 ;;
1584             *armhf*)
1585                 aros_target_cpu="arm"
1586                 gcc_default_cpu="armv6zk"
1587                 gcc_default_cpu_tune="arm1176jzf-s"
1588                 aros_object_format="armelf_aros"
1589                 aros_isa_flags="$aros_isa_flags -marm"
1590                 aros_config_cflags="$aros_config_cflags"
1591                 aros_config_cxxflags="$aros_config_cxxflags"
1592                 aros_config_aflags="$aros_config_aflags -marm"
1593                 aros_kernel_cflags="$aros_kernel_cflags -marm"
1594                 aros_target_mkdep="$aros_target_mkdep -Darm"
1595                 aros_arch_libs="-laeabi"
1596                 ;;
1597             *armeb*)
1598                 aros_flavour="standcompat"
1599                 aros_target_cpu="armeb"
1600                 gcc_default_float_abi="hard"
1601                 gcc_default_cpu="armv7ve"
1602                 gcc_default_cpu_tune="cortex-a7"
1603                 aros_object_format="armelfb_aros"
1604                 aros_isa_flags="$aros_isa_flags -marm"
1605                 aros_config_cflags="$aros_config_cflags"
1606                 aros_config_cxxflags="$aros_config_cxxflags"
1607                 aros_config_aflags="$aros_config_aflags -marm"
1608                 aros_kernel_cflags="$aros_kernel_cflags -marm"
1609                 aros_target_mkdep="$aros_target_mkdep -Darm"
1610                 aros_arch_libs="-laeabi"
1611                 ;;
1612             *arm*)
1613                 aros_target_cpu="arm"
1614                 gcc_default_cpu="armv6zk"
1615                 gcc_default_cpu_tune="arm1176jzf-s"
1616                 aros_object_format="armelf_aros"
1617                 aros_isa_flags="$aros_isa_flags -marm"
1618                 aros_config_cflags="$aros_config_cflags"
1619                 aros_config_cxxflags="$aros_config_cxxflags"
1620                 aros_config_aflags="$aros_config_aflags -marm"
1621                 aros_kernel_cflags="$aros_kernel_cflags -marm"
1622                 aros_target_mkdep="$aros_target_mkdep -Darm"
1623                 aros_arch_libs="-laeabi"
1624                 ;;
1625             *)
1626                 AC_MSG_ERROR("Unknown CPU for RasPi $target_cpu")
1627                 ;;
1628         esac
1630         aros_config_cflags="$aros_config_cflags -fno-asynchronous-unwind-tables -fno-exceptions"
1631         aros_config_cxxflags="$aros_config_cxxflags -fno-asynchronous-unwind-tables -fno-exceptions"
1632         aros_config_aflags="$aros_config_aflags -fno-asynchronous-unwind-tables -fno-exceptions"
1633         aros_kernel_cflags="$aros_kernel_cflags -fno-asynchronous-unwind-tables -fno-exceptions"
1635         case "$aros_target_variant" in
1636             smp)
1637                 ENABLE_EXECSMP="#define __AROSEXEC_SMP__"
1638             ;;
1639         esac
1640         ;;
1642     stm32f7_discovery)
1643         aros_flavour="standalone"
1644         aros_target_arch="stm32f7_discovery"
1645         aros_target_cpu="arm"
1646         aros_target_cpu_mode="thumb2"
1647         aros_object_format="armelf_aros"
1648         aros_shared_default="no"
1650         gcc_default_cpu="armv7e-m"
1651         gcc_default_cpu_tune="cortex-m7"
1652         gcc_default_fpu="fpv5-sp-d16"
1653         gcc_default_float_abi="hard"
1655         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dthumb"
1656         ;;
1658     amiga*)
1659         aros_target_arch="amiga"
1660         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D_AMIGA -DAMIGA"
1661         aros_shared_default="no"
1663         case "$target_cpu" in
1664             *m68k*)
1665                 AC_ARG_ENABLE(amigaos_compliance,AC_HELP_STRING([--enable-amigaos-compliance=VERSION],[Enforce userspace AmigaOS compliance to a specific KickStart version (default=none).]),aros_amigaos_compliance="$enableval")
1666                 aros_enable_mmu=no
1667                 aros_target_cpu="m68k"
1668                 aros_object_format="m68kelf"
1669                 aros_flavour="standcompat"
1670                 gcc_target_cpu="m68000"
1671                 aros_isa_flags="$""(ISA_MC68000_FLAGS)"
1672                 aros_nowarn_flags="$aros_nowarn_flags NOWARN_VOLATILE_REGISTER_VAR"
1673                 aros_config_cppflags="$aros_config_cppflags -DNOLIBINLINE"
1674                 aros_config_cflags="$aros_config_cflags -fno-strict-aliasing -ffreestanding -fomit-frame-pointer -fbuiltin"
1675                 aros_config_cxxflags="$aros_config_cxxflags -fno-strict-aliasing -ffreestanding -fomit-frame-pointer -fbuiltin"
1676                 if test "$optimization" = "default"; then
1677                     optimization_level="-Os"
1678                 fi
1679                 aros_config_aflags="$aros_config_aflags"
1680                 aros_target_strip_flags="-R.comment --strip-debug"
1681                 aros_nominal_width=640
1682                 aros_nominal_height=256
1683                 aros_nominal_depth=2
1684                 ;;
1685             *ppc*)
1686                 aros_cpu="ppc"
1687                 aros_flavour="native"
1688                 gcc_target_cpu="ppc"
1689                 ;;
1690             *)
1691                 AC_MSG_ERROR("Unknown CPU for Amiga $target_cpu")
1692                 ;;
1693         esac
1694         ;;
1696     mingw*)
1697         aros_target_arch="mingw32"
1698         aros_shared_default="no"
1699         aros_flavour="emulation"
1700         aros_shared_cflags=""
1701         need_crosstools="yes"
1702         need_dlopen="no"
1703         rescomp="windres"
1704         case "$target_cpu" in
1705             *i?86*)
1706                 aros_target_cpu="i386"
1707                 aros_object_format="elf_i386"
1708                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1709                 aros_isa_flags="$""(ISA_X86_FLAGS)"
1710                 aros_nominal_depth=8
1711                 gcc_target_cpu="i386"
1713                 kernel_tool_prefix="i386-mingw32-"
1714                 ;;
1715             *x86_64*)
1716                 aros_target_cpu="x86_64"
1717                 aros_object_format="elf_x86_64"
1718                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
1719                 aros_isa_flags="$""(ISA_X8664_FLAGS)"
1720                 aros_config_cflags="$aros_config_cflags -fno-omit-frame-pointer"
1721                 aros_config_cxxflags="$aros_config_cxxflags -fno-omit-frame-pointer"
1722                 aros_nominal_depth=8
1723                 kernel_tool_prefix="x86_64-w64-mingw32-"
1724                 ;;
1725             *arm*)
1726                 aros_target_cpu="arm"
1727                 aros_object_format="armelf_aros"
1728                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
1729                 aros_arch_libs="-laeabi"
1730                 aros_nominal_depth=8
1731                 gcc_target_cpu="arm"
1732                 gcc_default_float_abi="soft"
1733                 kernel_tool_prefix="arm-mingw32ce-"
1734                 aros_nominal_width=160
1735                 aros_nominal_height=160
1736                 ;;
1737             *)
1738                 AC_MSG_ERROR("Unknown CPU for Mingw32 -- $target_cpu")
1739                 ;;
1740         esac
1741         if test $host_os = "cygwin"; then
1742                 aros_kernel_cflags="-mno-cygwin"
1743         fi
1744     ;;
1745     pp*)
1746         aros_target_arch="pp"
1747         aros_shared_default="no"
1748         case "$target_cpu" in
1749             *m68k*)
1750                 aros_target_cpu="m68k"
1751                 aros_object_format="m68kelf"
1752                 aros_flavour="palmnative"
1753                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
1754                 aros_isa_flags="$""(ISA_MC68000_FLAGS)"
1755                 aros_nominal_width=160
1756                 aros_nominal_height=160
1757                 aros_nominal_depth=1
1758                 aros_target_ar_flags="cru"
1759                 aros_compiler_libs="-lgcc1"
1760                 aros_shared_default=no
1761                 aros_shared_cflags="-fpic"
1762                 aros_shared_aflags=""
1763                 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
1764                 aros_kernel_ldflags="-Wl,-rpath,./lib"
1765                 aros_debug_cppflags="$aros_messages_debug"
1766                 aros_debug_cflags="$aros_symbols_debug"
1767                 aros_debug_aflags=""
1768                 aros_debug_ldflags="$aros_symbols_debug"
1769                 aros_mungwall_debug="0"
1770                 aros_modules_debug="0"
1771                 gcc_target_cpu="mc68000"
1772                 ignore_undefined_symbols="-ius"
1773                 ;;
1774            *)
1775                 AC_MSG_ERROR("Unknown CPU for PalmPilot -- $target_cpu")
1776                 ;;
1777         esac
1778         ;;
1780     mac*)
1781         aros_target_arch="mac"
1782         aros_shared_default="no"
1783         case "$target_cpu" in
1784             *m68k*)
1785                 aros_target_cpu="m68k"
1786                 aros_object_format="m68kelf"
1787                 aros_flavour="mac68knative"
1788                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
1789                 aros_isa_flags="$""(ISA_MC68000_FLAGS)"
1790                 aros_nominal_width=512
1791                 aros_nominal_height=384
1792                 aros_nominal_depth=8
1793                 aros_target_ar_flags="cru"
1794                 aros_compiler_libs="-lgcc1"
1795                 aros_shared_default=no
1796                 aros_shared_cflags="-fpic"
1797                 aros_shared_aflags=""
1798                 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
1799                 aros_kernel_ldflags="-Wl,-rpath,./lib"
1800                 aros_debug_cppflags="$aros_messages_debug"
1801                 aros_debug_cflags="$aros_symbols_debug"
1802                 aros_debug_aflags=""
1803                 aros_debug_ldflags="$aros_symbols_debug"
1804                 aros_mungwall_debug="0"
1805                 aros_modules_debug="0"
1806                 gcc_target_cpu="mc68000"
1807                 ignore_undefined_symbols="-ius"
1808                 ;;
1809            *)
1810                 AC_MSG_ERROR("Unknown CPU for Mac68k -- $target_cpu")
1811                 ;;
1812         esac
1813         ;;
1815     *)
1816         AC_MSG_ERROR([Unsupported target architecture $target])
1817         ;;
1818 esac
1820 #-----------------------------------------------------------------------------
1821 crosstools_guess="yes"
1822 aros_target_toolchain="no"
1823 aros_config_sysroot=""
1824 aros_kernel_sysroot=""
1826 AC_MSG_CHECKING([Kernel toolchain prefix])
1827 AC_ARG_WITH(kernel-toolchain-prefix,AC_HELP_STRING([--with-kernel-toolchain-prefix=...],[Specify crosscompile toolchain prefix for kernel objects]),[kernel_tool_prefix="$withval"])
1828 AC_MSG_RESULT($kernel_tool_prefix)
1830 AC_MSG_CHECKING([ELF toolchain prefix])
1831 AC_ARG_WITH(elf-toolchain-prefix,AC_HELP_STRING([--with-elf-toolchain-prefix=...],[Specify crosscompile toolchain prefix to wrap for AROS objects]),[elf_tool_prefix="$withval"
1832                                                  crosstools_guess="no"])
1833 AC_MSG_RESULT($elf_tool_prefix)
1835 AC_MSG_CHECKING([AROS toolchain prefix])
1836 AC_ARG_WITH(aros-toolchain,AC_HELP_STRING([--with-aros-toolchain=PREFIX],[Specify prebuilt AROS toolchain. Use yes for default name]),[aros_tool_prefix="$withval"
1837                 crosstools_guess="no"])
1838 if test "$aros_tool_prefix" = "yes" ; then
1839     aros_tool_prefix=$aros_target_cpu-aros-
1841 AC_MSG_RESULT($aros_tool_prefix)
1843 #-----------------------------------------------------------------------------
1844 #   Checking if we should build crosstools..
1845 AC_MSG_CHECKING([whether to build crosstools])
1846 AC_ARG_ENABLE(crosstools,AC_HELP_STRING([--disable-crosstools],[Do not build cross-compiler toolchain]),crosstools="$enableval",crosstools="$crosstools_guess")
1847 AC_MSG_RESULT($crosstools)
1849 if test "${crosstools}" = "yes"; then
1850     if test "${crosstools_guess}" = "no"; then
1851         AC_MSG_ERROR([Cannot build external toolchain if an external ELF or AROS toolchain is specified])
1852     fi
1855 if test "${crosstools}" = "yes" || test "${crosstools_guess}" = "no"; then
1856     aros_target_toolchain="yes"
1859 AC_MSG_CHECKING([where to install the crosstools binaries])
1860 AC_ARG_WITH(aros-toolchain-install,AC_HELP_STRING([--with-aros-toolchain-install=DIR],[Where to install or search for cross tools binaries]),[aros_toolchain_install=$withval])
1861 if test "x$aros_toolchain_install" = "x"; then
1862     AROS_CROSSTOOLSDIR="$AROS_BUILDDIR_UNIX/bin/$aros_host_arch-$aros_host_cpu/tools/crosstools"
1863 else
1864     AROS_CROSSTOOLSDIR="$aros_toolchain_install"
1865     PATH="$AROS_CROSSTOOLSDIR:$PATH"
1866     if test "$crosstools_guess" = "no" ; then
1867         toolchain_needs_sysroot=yes
1869         if test "x-$aros_flavour" != "x-emulation" -a "x-$aros_flavour" != "x-emulcompat" ; then
1870             aros_kernel_sysroot = $aros_config_sysroot
1871         fi
1872     fi
1874 AC_MSG_RESULT($AROS_CROSSTOOLSDIR)
1876 AC_MSG_CHECKING([If we need to use --sysroot])
1877 if test "$toolchain_needs_sysroot" = "yes" ; then
1878     aros_config_sysroot="--sysroot $AROS_BUILDDIR_UNIX/bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/AROS/Developer"
1880 AC_MSG_RESULT($toolchain_needs_sysroot)
1882 #-----------------------------------------------------------------------------
1883 if test "$aros_toolchain" = "gnu" ; then
1884     AC_MSG_CHECKING([what specific target binutils version to use])
1886 AC_ARG_WITH(binutils-version,AC_HELP_STRING([--with-binutils-version=VERSION],[Use binutils-VERSION for building AROS]),use_binutils_version="$withval",use_binutils_version="")
1887 if test "$use_binutils_version" = ""; then
1888         target_binutils_version="$default_binutils_version"
1889 else
1890     target_binutils_version="$use_binutils_version"
1892 if test "$aros_toolchain" = "gnu" ; then
1893     AC_MSG_RESULT($target_binutils_version)
1897 # Helper to identify gcc version
1898 AC_DEFUN([CROSS_GCC_VERSION], [
1899   target_gcc_version=""
1900   AC_CACHE_CHECK([gcc version],[ax_cv_gcc_version],[
1901     ax_cv_gcc_version="`$AROS_CROSSTOOLSDIR/${aros_tool_prefix}${toolchain_cpp_preprocessor} -dumpversion`"
1902     AS_IF([test "x$ax_cv_gcc_version" = "x"],[
1903       ax_cv_gcc_version=""
1904     ])
1905   ])
1906   target_gcc_version=$ax_cv_gcc_version
1907   AC_SUBST([target_gcc_version])
1910 #-----------------------------------------------------------------------------
1911 if test "$aros_toolchain" = "gnu" ; then
1912     AC_MSG_CHECKING([what specific target gcc version to use])
1914 AC_ARG_WITH(gcc-version,AC_HELP_STRING([--with-gcc-version=VERSION],[Compile gcc-VERSION for AROS]),use_gcc_version="$withval",use_gcc_version="")
1915 if test "$use_gcc_version" = ""; then
1916     if test "${crosstools}" = "no"; then
1917       if test "x$aros_toolchain_install" != "x"; then
1918           CROSS_GCC_VERSION
1919       fi
1920     fi
1921     if test "$use_gcc_version" = ""; then
1922         target_gcc_version="$default_gcc_version"
1923     fi
1924 else
1925     target_gcc_version="$use_gcc_version"
1927 if test "$aros_toolchain" = "gnu" ; then
1928     AC_MSG_RESULT($target_gcc_version)
1930     GCC_VERSION_MAJOR=$(echo $target_gcc_version | cut -d'.' -f1)
1931     GCC_VERSION_MINOR=$(echo $target_gcc_version | cut -d'.' -f2)
1932     GCC_VERSION_PATCH=$(echo $target_gcc_version | cut -d'.' -f3)
1934     gcc_fix_bitfields="false"
1935     if test "$GCC_VERSION_MAJOR" -gt "4" ; then
1936         gcc_fix_bitfields="true"
1937     else
1938         if test "$GCC_VERSION_MAJOR" -gt "3" ; then
1939             if test "$GCC_VERSION_MINOR" -gt "6" ; then
1940                 gcc_fix_bitfields="true"
1941             fi
1942         fi
1943     fi
1945     if test "$gcc_fix_bitfields" = "true" ; then
1946         case "$aros_target_cpu" in
1947         *x86_64* | *i?86*)
1948             x86_isa_extra="$x86_isa_extra -mno-ms-bitfields"
1949             x86_64_isa_extra="$x86_64_isa_extra -mno-ms-bitfields"
1950             ;;
1951         esac
1952     fi
1955 AC_MSG_CHECKING([whether to enable Objective-C suppport])
1956 AC_ARG_ENABLE(objc,AC_HELP_STRING([--enable-objc],[Enable Objectve-C support (default=no)]),objc="$enableval",objc="no")
1957 AC_MSG_RESULT($objc)
1958 if test "x$objc" = "xyes"; then
1959     objc_target="$objc"
1960 else
1961     objc_target="no-objc"
1964 AC_MSG_CHECKING([whether to enable Java suppport])
1965 AC_ARG_ENABLE(java,AC_HELP_STRING([--enable-java],[Enable Java support (default=no)]),java="$enableval",java="no")
1966 AC_MSG_RESULT($java)
1967 if test "x$java" != "xno"; then
1968     java_target="$java"
1969 else
1970     java_target="no-java"
1973 spec_obj_format="-m $aros_object_format"
1974 # Now process extra architecture-specific options.
1975 # Currently this is implemented only for ARM. We can specify which minimum CPU and FPU to use,\
1976 # as well as floating-point ABI.
1977 case "$aros_target_cpu" in
1978     *m68k*)
1979         aros_isa_targets="M68K_ISA_TARGETS:=MC68020 MC68040"
1980         aros_isa_extra="$aros_isa_extra$export_newline$aros_isa_targets$export_newline"
1981         aros_isa_extra="$aros_isa_extra$m68k_isa_extra$export_newline$m68k_020_isa_extra$export_newline$m68k_030_isa_extra$export_newline$m68k_040_isa_extra$export_newline$m68k_060_isa_extra$export_newline$m68k_ac080_isa_extra$export_newline"
1982         aros_isa_extra="$aros_isa_extra$m68k_020_cppflags$export_newline$m68k_030_cppflags$export_newline$m68k_040_cppflags$export_newline$m68k_060_cppflags$export_newline"
1983         aros_isa_extra="$aros_isa_extra$m68k_020_cflags$export_newline$m68k_030_cflags$export_newline$m68k_040_cflags$export_newline$m68k_060_cflags$export_newline"
1984         aros_isa_extra="$aros_isa_extra$m68k_020_ldflags$export_newline$m68k_030_ldflags$export_newline$m68k_040_ldflags$export_newline$m68k_060_ldflags$export_newline"
1985         aros_isa_extra="$aros_isa_extra$m68k_020_ext$export_newline$m68k_030_ext$export_newline$m68k_040_ext$export_newline$m68k_060_ext$export_newline"
1986         ;;
1987     *x86_64*)
1988         aros_isa_extra="$x86_isa_extra$export_newline$x86_64_isa_extra$export_newline"
1989         dnl x86_64 can build 32 or 64bit code
1990         spec_obj_format="%{!m32:-m elf_x86_64} %{m32:-m elf_i386}"
1991         ;;
1992     arm*)
1993         dnl ARM defaults are: armv6 + vfp (unless overriden in per-target section above)
1994         if test "$gcc_default_cpu" = ""; then
1995             gcc_default_cpu="armv6"
1996         fi
1997         if test "$gcc_default_fpu" = ""; then
1998             gcc_default_fpu="vfp"
1999         fi
2000         if test "$gcc_default_endian" = ""; then
2001             if test "$target_cpu" = "armeb"; then
2002                 gcc_default_endian="big-endian"
2003             else
2004                 gcc_default_endian="little-endian"
2005             fi
2006         fi
2007         if test "$gcc_default_float_abi" = ""; then
2008             if test "$target_cpu" = "armhf"; then
2009                 gcc_default_float_abi="hard"
2010             else
2011                 gcc_default_float_abi="softfp"
2012             fi
2013         fi
2015         AC_MSG_CHECKING([Which minimum CPU to use])
2016         AC_ARG_WITH(cpu,AC_HELP_STRING([--with-cpu=<spec>],[Specify minumum CPU (default=$gcc_default_cpu).]),aros_gcc_cpu="$withval",aros_gcc_cpu=$gcc_default_cpu)
2017         AC_MSG_RESULT($aros_gcc_cpu)
2019         AC_MSG_CHECKING([Which minimum FPU to use])
2020         AC_ARG_WITH(fpu,AC_HELP_STRING([--with-fpu=<spec>],[Specify minumum FPU (default=$gcc_default_fpu).]),aros_gcc_fpu="$withval",aros_gcc_fpu=$gcc_default_fpu)
2021         AC_MSG_RESULT($aros_gcc_fpu)
2023         AC_MSG_CHECKING([Which floating point ABI to use])
2024         AC_ARG_WITH(float,AC_HELP_STRING([--with-float=<spec>],[Specify floating point ABI (default=$gcc_default_float_abi).]),aros_gcc_float_abi="$withval",aros_gcc_float_abi=$gcc_default_float_abi)
2025         AC_MSG_RESULT($aros_gcc_float_abi)
2027         AC_MSG_CHECKING([Which ARM mode to use])
2028         if test "$aros_target_cpu_mode" = ""; then
2029             aros_target_cpu_mode="arm32"
2030             AC_MSG_RESULT([Defaulting to $aros_target_cpu_mode])
2031         else
2032             AC_MSG_RESULT([$aros_target_cpu_mode])
2033         fi
2035         case "$aros_target_cpu_mode" in
2036         arm32)
2037             gcc_default_mode="arm"
2038             aros_isa_flags="$aros_isa_flags -m$gcc_default_mode -m$gcc_default_endian -mthumb-interwork -march=$aros_gcc_cpu -mfpu=$aros_gcc_fpu -mfloat-abi=$aros_gcc_float_abi"
2039         ;;
2040         arm64)
2041             AC_MSG_ERROR([ARM 64-bit mode is unsupported])
2042         ;;
2043         thumb)
2044             AC_MSG_ERROR([Thumb1 16-bit mode is unsupported])
2045         ;;
2046         thumb1)
2047             AC_MSG_ERROR([Thumb1 16-bit mode is unsupported])
2048         ;;
2049         thumb2)
2050             gcc_default_mode="thumb"
2051             # Do not specify -mthumb-interwork as it may add extra code to support arm/thumb interwork
2052             aros_isa_flags="$aros_isa_flags -m$gcc_default_mode -$gcc_default_endian -march=$aros_gcc_cpu -mfpu=$aros_gcc_fpu -mfloat-abi=$aros_gcc_float_abi"
2053         ;;
2054         *)
2055             AC_MSG_ERROR([Unsupported ARM mode specified $aros_target_cpu_mode])
2056         ;;
2057         esac
2059         aros_config_cflags="$aros_config_cflags -fno-asynchronous-unwind-tables -fno-exceptions"
2060         aros_config_cxxflags="$aros_config_cxxflags -fno-asynchronous-unwind-tables -fno-exceptions"
2061         aros_config_aflags="$aros_config_aflags -fno-asynchronous-unwind-tables -fno-exceptions"
2062         ;;
2063     i386)
2064         aros_isa_extra="$x86_isa_extra$export_newline$x86_64_isa_extra$export_newline"
2065         aros_kernel_ldflags="$aros_kernel_ldflags -m32" 
2066         ;;
2067 esac
2069 # Some architectures may need custom ELF specs.
2070 if test -f $SRCDIR/config/${aros_object_format}-specs.in; then
2071     elf_specs_in=config/${aros_object_format}-specs.in
2072 else
2073     elf_specs_in=config/elf-specs.in
2076 # Some compilers (ppc-elf-gcc is known to) have CPU defines in specs
2077 # Since we override specs, we may need to put these defines there
2078 if test "$gcc_target_cpu" != ""; then
2079     gcc_target_cpu="-D__${gcc_target_cpu}__"
2082 AC_MSG_CHECKING([where to download sourcecode for external ports])
2083 AC_ARG_WITH(portssources,AC_HELP_STRING([--with-portssources=DIR],[Where to download sourcecode for external ports]),with_portssrcdir=$withval,with_portssrcdir="default")
2084 if test "$with_portssrcdir" = "default"; then
2085     AROS_PORTSSRCDIR="$AROS_BUILDDIR_UNIX/bin/Sources"
2086 else
2087     AROS_PORTSSRCDIR="$with_portssrcdir"
2089 AC_MSG_RESULT($AROS_PORTSSRCDIR)
2091 AC_MSG_CHECKING([which bootloader to use])
2092 AC_ARG_WITH(bootloader,AC_HELP_STRING([--with-bootloader=NAME],[Use a specific bootloader]),target_bootloader=$withval,target_bootloader=$target_bootloader)
2093 if test "$target_bootloader" = "none"; then
2094     aros_target_bootloader=""
2095 else
2096     aros_target_bootloader="$target_bootloader"
2098 AC_MSG_RESULT($target_bootloader)
2100 AC_MSG_CHECKING([which icon-set to use])
2101 AC_ARG_WITH(iconset,AC_HELP_STRING([--with-iconset=NAME],[Use a specific Icon-set (default=Gorilla).]),target_iconset=$withval,target_iconset="default")
2102 if test "$target_iconset" = "default"; then
2103     aros_target_iconset="Gorilla"
2104     target_iconset="default (Gorilla)"
2105 else
2106     aros_target_iconset="$target_iconset"
2108 AC_MSG_RESULT($target_iconset)
2110 AC_MSG_CHECKING([which GUI Theme to use])
2111 AC_ARG_WITH(theme,AC_HELP_STRING([--with-theme=NAME],[Use a specific GUI Theme]),target_guitheme=$withval,target_guitheme="default")
2112 if test "$target_guitheme" = "default"; then
2113     aros_target_guitheme="Ice"
2114 else
2115     aros_target_guitheme="$target_guitheme"
2117 AC_MSG_RESULT($aros_target_guitheme)
2119 # Find out if we are cross-compiling (i.e. if we can't use the host compiler
2120 # for target code)
2121 cross_compiling=no
2123 dnl The first case is simple. If we are compiling for another CPU, we are cross-compiling for sure
2124 if test "$aros_host_cpu" != "$aros_target_cpu" ; then
2125     cross_compiling=yes
2128 dnl x86-64 toolchains can also produce i386 binaries, given -m32 flag.
2129 dnl The flag itself is given in per-target section, because some targets require to pass it
2130 dnl in a different manner, otherwise some tests fail.
2131 dnl TODO: Justify this.
2132 if test "$aros_host_cpu" == "x86_64" ; then
2133     if test "$aros_target_cpu" == "i386" ; then
2134         cross_compiling=no
2135     fi
2138 if test "x-$aros_flavour" = "x-emulation" -o "x-$aros_flavour" = "x-emulcompat" ; then
2139     dnl For a hosted build we are cross-compiling if host OS differs from build OS.
2140     dnl TODO: This might get a little bit more tricky if we ever cross-compile ARM-Android-hosted
2141     dnl AROS on ARM Linux, or even vice versa (Linux-hosted ARM AROS building on ARM Android).
2142     dnl ARM ABIs of Linux and Android are not compatible (despite very close), so host_cc can't be
2143     dnl used to build bootstrap for target arch in either case.
2144     dnl For us Android is not a separate OS, but a variant of Linux, so both systems will be
2145     dnl identified as 'linux'. If this ever involves, we'll have to implement some additional check,
2146     dnl perhaps introducing aros_host_variant
2147     if test "$aros_host_arch" != "$aros_target_arch" ; then
2148         cross_compiling=yes
2149     fi
2150 else
2151     dnl For a native build we only care if our host_cc can produce static ELF files. If so, we can use
2152     dnl it as kernel_cc. If not, (e.g. we are on Windows or Darwin), we need a crosscompiler.
2153     if test "$host_cc_elf" = "no" ; then
2154         cross_compiling=yes
2155     fi
2158 if test "$cross_compiling" = "no" ; then
2159     kernel_tool_prefix=""
2160     if test "$host_cc_elf" = "yes" ; then
2161         elf_tool_prefix=""
2162     fi
2165 if test "$kernel_tool_version" != ""; then
2166     kernel_tool_version="-$kernel_tool_version"
2169 #######################################################################
2170 ## Compute what toolchains to use, and their paths                   ##
2171 #######################################################################
2173 # This takes, as input:
2174 #   crosstools             {yes,no}
2175 #   kernel_tool_version    {"",[version]}
2176 #   target_tool_version    {"",[version]}
2177 #   kernel_tool_prefix     {none,[some-arch-os-]}
2178 #   gnu-toolchain -:
2179 #     target_tool_prefix     ${aros_target_cpu}-aros-
2180 #     aros_tool_prefix       ${aros_target_cpu}-aros-
2182 # The output is
2183 #   aros_kernel_{cpp,cc,ar,ld,as,ranlib,nm,strip}
2184 #        Where the 'kernel' binaries are located
2185 #   orig_target_{cpp,cc,ar,ld,as,ranlib,nm,strip}
2186 #        Where the 'target' binaries are located
2187 #        (not the symlink farm - that is aros_target_*!)
2189 # The rules are:
2190 #   if crosstools then
2191 #      if kernel_tools_prefix = "no-kernel-prefix-"
2192 #          aros_kernel_* = crosstools cc paths
2193 #          aros_kernel_cc = elf cc wrapper around crosstools cc
2194 #      else
2195 #          VALIDATE(${kernel_tools_prefix}*)
2196 #          aros_kernel_* = ${kernel_tools_prefix}*
2197 #          if ${kernel_tools_prefix}cc is an AROS gcc
2198 #              aros_kernel_cc = ${kernel_tools_prefix}cc
2199 #          else
2200 #              aros_kernel_cc = elf cc wrapper around ${kernel_tools_prefix}cc
2201 #          fi
2202 #      fi
2204 #      orig_target_* = aros built crosstools
2205 #      orig_target_cc = elf cc wrapper around crosstools cc
2206 #   else
2207 #      VALIDATE(${kernel_tools_prefix}*)
2209 #      orig_target_* = aros_kernel_*
2210 #      if aros_kernel_cc is an AROS gcc
2211 #          orig_target_cc = aros_kernel_cc
2212 #      else
2213 #          orig_target_cc = aros cc wrapper around aros_kernel_cc
2214 #      fi
2215 #   fi
2217 if test "$aros_toolchain" = "gnu" ; then
2218     target_tool_prefix="${aros_target_cpu}-aros-"
2219 elif test "$aros_toolchain" = "llvm" ; then
2220     target_tool_prefix="bin/"
2223 if test "$kernel_tool_prefix" != "" ; then
2224     AC_MSG_CHECKING([which kernel tools])
2225     AC_MSG_RESULT([$kernel_tool_prefix]);
2228 if test "$kernel_tool_prefix" = "none" ; then
2229     dnl ELF wrapper can be used only for native bootstrap
2230     if test "x-$aros_flavour" = "x-emulation" -o "x-$aros_flavour" = "x-emulcompat" ; then
2231         AC_MSG_ERROR([--with-kernel-toolchain-prefix= is required for this arch])
2232     fi
2233 else
2234     # Kernel tools required - find them
2235     # Note that 'normally', aros_kernel_* overrides will be
2236     # empty, unless specified in the per-arch sections above.
2237     if test "x$aros_kernel_cpp" = "x"; then
2238         aros_kernel_cpp=${kernel_tool_prefix}${CPP}
2239     fi
2240     AROS_BUILDCMD(aros_kernel_cpp,$aros_kernel_cpp,${kernel_tool_version})
2241     AROS_TOOL_KERNEL(aros_kernel_cpp,cpp,$aros_kernel_cpp)
2242     AROS_REQUIRED(cpp,$aros_kernel_cpp)
2244     if test "x$aros_kernel_cc" = "x"; then
2245         aros_kernel_cc=${kernel_tool_prefix}${CC}
2246     fi
2247     AROS_BUILDCMD(aros_kernel_cc,$aros_kernel_cc,${kernel_tool_version})
2248     AROS_TOOL_KERNEL(aros_kernel_cc,cc,$aros_kernel_cc)
2249     AROS_REQUIRED(cc,$aros_kernel_cc)
2251     if test "x$aros_kernel_cxx" = "x"; then
2252         aros_kernel_cxx=${kernel_tool_prefix}${CXX}
2253     fi
2254     AROS_BUILDCMD(aros_kernel_cxx,$aros_kernel_cxx,${kernel_tool_version})
2255     AROS_TOOL_KERNEL(aros_kernel_cxx,cxx,$aros_kernel_cxx)
2256     # If it's set, make sure it's really there
2257     if test "x$aros_kernel_cxx" != "x" ; then
2258         AROS_REQUIRED(cxx,$aros_kernel_cxx)
2259     fi
2260     AROS_TOOL_KERNEL(aros_kernel_ld,ld,$aros_kernel_ld)
2261     AROS_REQUIRED(ld,$aros_kernel_ld)
2262     AROS_TOOL_KERNEL(aros_kernel_as,as,$aros_kernel_as)
2263     AROS_REQUIRED(as,$aros_kernel_as)
2264     AROS_TOOL_KERNEL(aros_kernel_ar,ar,$aros_kernel_ar)
2265     AROS_REQUIRED(ar,$aros_kernel_ar)
2266     AROS_TOOL_KERNEL(aros_kernel_ranlib,ranlib,$aros_kernel_ranlib)
2267     AROS_REQUIRED(ranlib,$aros_kernel_ranlib)
2268     AROS_TOOL_KERNEL(aros_kernel_nm,nm,$aros_kernel_nm)
2269     AROS_REQUIRED(nm,$aros_kernel_nm)
2270     AROS_TOOL_KERNEL(aros_kernel_strip,strip,$aros_kernel_strip)
2271     AROS_REQUIRED(strip,$aros_kernel_strip)
2273     # Objcopy and objdump are not required for the kernel
2274     # toolchain on many architectures.
2275     # So we'll look for them, but not make them strictly required.
2276     AROS_TOOL_KERNEL(aros_kernel_objcopy,objcopy,$aros_kernel_objcopy)
2277     AROS_TOOL_KERNEL(aros_kernel_objdump,objdump,$aros_kernel_objdump)
2278     if test "x${crosstools}" != "xyes" ; then
2279         AROS_REQUIRED(objcopy,$aros_kernel_objcopy)
2280         AROS_REQUIRED(objdump,$aros_kernel_objdump)
2281     fi
2284 AC_MSG_CHECKING([which target tools to use])
2285 if test "$aros_target_toolchain" = "yes"; then
2286     if test "$aros_toolchain" = "llvm" ; then
2287         msg_result="llvm"
2288     else
2289         msg_result=$target_tool_prefix
2290     fi
2291     AC_MSG_RESULT([$msg_result])
2292     # We are building AROS crosstools
2293     tmp_tool_prefix="$AROS_CROSSTOOLSDIR/${target_tool_prefix}"
2294     orig_target_cc="${tmp_tool_prefix}${toolchain_c_compiler}${target_tool_version}"
2295     orig_target_cxx="${tmp_tool_prefix}${toolchain_cxx_compiler}${target_tool_version}"
2296     orig_target_cpp="${tmp_tool_prefix}${toolchain_cpp_preprocessor}"
2297     orig_target_ld="${tmp_tool_prefix}${toolchain_ld}"
2298     orig_target_as="${tmp_tool_prefix}${toolchain_as}"
2299     orig_target_ar="${tmp_tool_prefix}${toolchain_ar}"
2300     orig_target_ranlib="${tmp_tool_prefix}${toolchain_ranlib}"
2301     orig_target_nm="${tmp_tool_prefix}${toolchain_nm}"
2302     orig_target_strip="${tmp_tool_prefix}${toolchain_strip}"
2303     orig_target_objcopy="${tmp_tool_prefix}${toolchain_objcopy}"
2304     orig_target_objdump="${tmp_tool_prefix}${toolchain_objdump}"
2305 else
2306     # Determine whether AROS or ELF tools should be used
2307     if test "$aros_tool_prefix" = "none"; then
2308         aros_tool_prefix="${elf_tool_prefix}"
2309     fi
2311     AC_MSG_RESULT([$aros_tool_prefix])
2312     # We are *not* building AROS crosstools - use the AROS or ELF tools
2313     AROS_TOOL_TARGET(orig_target_cpp,cpp,${aros_tool_prefix}${toolchain_cpp_preprocessor}${target_tool_version})
2314     AROS_REQUIRED(cpp,$orig_target_cpp)
2315     AROS_TOOL_TARGET(orig_target_cc,gcc,${aros_tool_prefix}${toolchain_c_compiler}${target_tool_version})
2316     AROS_REQUIRED(cc,$orig_target_cc)
2317     AROS_TOOL_TARGET(orig_target_cxx,g++,${aros_tool_prefix}${toolchain_cxx_compiler}${target_tool_version})
2318     AROS_REQUIRED(cxx,$orig_target_cxx)
2319     AROS_TOOL_TARGET(orig_target_ld,gcc,${aros_tool_prefix}${toolchain_ld})
2320     AROS_REQUIRED(ld,$orig_target_ld)
2321     AROS_TOOL_TARGET(orig_target_as,as,aros_tool_prefix}${toolchain_as})
2322     AROS_REQUIRED(as,$orig_target_as)
2323     AROS_TOOL_TARGET(orig_target_ar,ar,${aros_tool_prefix}${toolchain_ar})
2324     AROS_REQUIRED(ar,$orig_target_ar)
2325     AROS_TOOL_TARGET(orig_target_ranlib,ar,${aros_tool_prefix}${toolchain_ranlib})
2326     AROS_REQUIRED(ranlib,$orig_target_ranlib)
2327     AROS_TOOL_TARGET(orig_target_nm,nm,${aros_tool_prefix}${toolchain_nm})
2328     AROS_REQUIRED(nm,$orig_target_nm)
2329     AROS_TOOL_TARGET(orig_target_strip,strip,${aros_tool_prefix}${toolchain_strip})
2330     AROS_REQUIRED(strip,$orig_target_strip)
2331     AROS_TOOL_TARGET(orig_target_objcopy,objcopy,${aros_tool_prefix}${toolchain_objcopy})
2332     AROS_REQUIRED(objcopy,$orig_target_objcopy)
2333     AROS_TOOL_TARGET(orig_target_objdump,objdump,${aros_tool_prefix}${toolchain_objdump})
2334     AROS_REQUIRED(objdump,$orig_target_objdump)
2337 if test "$kernel_tool_prefix" = "none" ; then
2338     # No kernel tools specified
2339     # Assume target tools == kernel tools with ELF wrapper
2340     aros_kernel_cc=$orig_target_cc
2341     aros_kernel_cxx=$orig_target_cxx
2342     aros_kernel_cpp=$orig_target_cpp
2343     aros_kernel_ld=$orig_target_ld
2344     aros_kernel_as=$orig_target_as
2345     aros_kernel_ar=$orig_target_ar
2346     aros_kernel_ranlib=$orig_target_ranlib
2347     aros_kernel_nm=$orig_target_nm
2348     aros_kernel_strip=$orig_target_strip
2349     aros_kernel_objcopy=$orig_target_objcopy
2350     aros_kernel_objdump=$orig_target_objdump
2351     use_kernel_cc_wrapper=yes
2354 # At this point, all aros_kernel_* and aros_target_* 
2355 # tools should be set up correctly
2357 CC="$aros_kernel_cc $kernel_tool_flags"
2358 CPP="$aros_kernel_cpp"
2360 #-----------------------------------------------------------------------------
2362 # Find all the tools we need to compile. This could be cross-compiling
2363 # though! If that is the case we use the GNU form of the target and
2364 # simply add this to the front of the binary name. This is rather simple,
2365 # but it should work under most circumstances.
2367 # The default tools are to use the same as the host, but only if the
2368 # host and target CPU are the same. With GCC this is normally enough.
2371 aros_cc_pre=""
2372 aros_shared_ld="$aros_host_ld"
2374 aros_target_mkdep="$aros_host_mkdep"
2376 # The default tools executables to be linked to.
2377 if test "$rescomp" != ""; then
2378     AC_PATH_PROG(aros_kernel_rescomp,${kernel_tool_prefix}$rescomp)
2379     AROS_REQUIRED($rescomp,$aros_kernel_rescomp)
2382 # Set up the sources for the symlink farm
2383 if test "$crosstools" = "yes"; then
2384     crosstools_target=tools-crosstools
2387 aros_kernel_cc="$aros_kernel_cc $kernel_tool_flags"
2388 aros_kernel_ar="$aros_kernel_ar $aros_kernel_ar_flags"
2390 aros_hostcfg_dir="bin/${aros_host_arch}-${aros_host_cpu}/gen/host/config"
2391 aros_targetcfg_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/config"
2392 aros_inc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/AROS/Developer/include/aros"
2393 aros_gendir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen"
2394 aros_geninc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/include/aros"
2395 aros_tools_dir="bin/${aros_host_arch}-${aros_host_cpu}/tools"
2396 aros_scripts_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/scripts"
2398 # aros_cc_pre is a variable that is added to the front of the compiler name
2399 # in the generated aros-gcc shell script. We need this to enable the cache
2400 # to work across cleaned builds. Also, support DISTCC using the correct
2401 # environment variable.
2404 if test "x${DISTCC}" != "x" ; then
2405     if test "x${CCACHE}" != "x" ; then
2406         aros_cc_pre="env CCACHE_PREFIX=${DISTCC} ${CCACHE} "
2407     else
2408         aros_cc_pre="${DISTCC} "
2409     fi
2410 else
2411     if test "x${CCACHE}" != "x" ; then
2412         aros_cc_pre="${CCACHE} "
2413     fi
2416 AC_SUBST(aros_target_nostdinc_cflags,-nostdinc)
2417 AC_SUBST(aros_target_nostartup_ldflags,-nostartfiles)
2418 AC_SUBST(aros_target_nix_ldflags,-nix)
2419 AC_SUBST(aros_target_detach_ldflags,-detach)
2420 AC_SUBST(aros_target_nostdlib_ldflags,-nostdlib)
2422 # Target tools
2423 AC_SUBST(aros_toolchain)
2424 if test "$aros_target_toolchain" != "yes"; then
2425     prefix="${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-"
2426     if test "$GCC" = "yes"; then
2427         aros_target_cc_path=`$orig_target_cc -print-search-dirs | grep "programs: =" | cut -c 12-`
2428     fi
2429 else
2430     # We do not know which c compiler version we are going to build and what we need to know
2431     # here is different for different versions so this will be set later during the
2432     # build of crosstools.
2433     if test "$aros_toolchain" = "gnu" ; then
2434         prefix="$AROS_CROSSTOOLSDIR/${aros_target_cpu}-aros-"
2435     elif test "$aros_toolchain" = "llvm" ; then
2436         prefix="$AROS_CROSSTOOLSDIR/bin/"
2437     fi
2438     aros_target_cc_path=@aros_target_cc_path@
2440 aros_target_cpp="${prefix}${toolchain_cpp_preprocessor}"
2441 aros_target_cc="${prefix}${toolchain_c_compiler}"
2442 aros_target_cxx="${prefix}${toolchain_cxx_compiler}"
2443 aros_target_as="${prefix}${toolchain_as}"
2444 if test "${use_ld_wrapper}" = "yes"; then
2445     aros_target_ld="${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-${aros_ld}"
2446 else
2447     aros_target_ld="${prefix}${toolchain_ld}"
2449 aros_toolchain_ld="${prefix}${toolchain_ld}"
2451 aros_target_ar="${prefix}${toolchain_ar} $aros_target_ar_flags"
2452 aros_target_objcopy="${prefix}${toolchain_objcopy}"
2453 aros_target_objdump="${prefix}${toolchain_objdump}"
2454 aros_target_ranlib="${prefix}${toolchain_ranlib} $aros_target_ranlib_flags"
2455 aros_target_nm="${prefix}${toolchain_nm} $aros_target_nm_flags"
2456 aros_target_strip="${prefix}${toolchain_strip}"
2457 aros_plain_nm="${prefix}${toolchain_nm}"
2458 aros_plain_ar="${prefix}${toolchain_ar}"
2460 AC_ARG_ENABLE(includes,
2461 AC_HELP_STRING([--enable-includes=dir],[Alternative system include directory]),
2462 [aros_target_incl=$enable_includes], [aros_target_incl=`$aros_kernel_cc -print-sysroot`/`$aros_kernel_cc --print-sysroot-headers-suffix 2>/dev/null || echo usr/include`])
2464 if test "$aros_kernel_includes" = ""; then
2465     if test "x-$aros_flavour" = "x-emulation" -o "x-$aros_flavour" = "x-emulcompat" ; then
2466         aros_kernel_includes="-isystem $aros_target_incl"
2467     fi
2470 if test "$aros_kernel_includes" != "" ; then
2471     dnl find out about the kernel cc's include path
2472     AC_MSG_CHECKING([for the kernel compiler's include path])
2473     if test "$aros_kernel_cc_includes" = "" ; then
2474         # Try to guess where the directory is.
2475         aros_kernel_cc_includes=`dirname \`${aros_kernel_cc} ${aros_kernel_cflags} -print-libgcc-file-name\``/include
2476         if test -d $aros_kernel_cc_includes; then
2477             # Check if there is also an include-fixed directory and add it
2478             # to kernel compiler's include path as it may contain some of
2479             # the headers we need.
2480             if test -d "$aros_kernel_cc_includes"-fixed; then
2481                 aros_kernel_cc_includes+=" -isystem $aros_kernel_cc_includes"-fixed
2482             fi
2483             # Check for specific includes directory. Needed for Ubuntu 11.10 and Debian
2484             if test -d "/usr/include/${aros_target_cpu}-linux-gnu"; then
2485                 aros_kernel_cc_includes+=" -isystem /usr/include/${aros_target_cpu}-linux-gnu"
2486             fi
2487         else
2488             # The directory doesn't exist, we need to do some more work.
2489             aros_kernel_cc_includes=${PWD}/${aros_gendir}/cc_include
2491             # These are the headers we're looking for.
2492             headers="limits.h mmintrin.h stdbool.h syslimits.h float.h \
2493                      stddef.h xmmintrin.h iso646.h stdarg.h unwind.h   \
2494                      zutil.h stdint.h"
2496             dirs=
2497             for h in $headers; do
2498                 # Which other headers are needed by each of the above?
2499                 deps=$(echo "#include <$h>" | \
2500                        $aros_kernel_cc -E -M - 2>/dev/null | \
2501                        sed 's/^.*://; s/\\$/ /g; s/[[ \t]]\+/ /g')
2503                 # Copy all the needed headers to a directory beneath gendir.
2504                 for d in $deps; do
2505                     h=$(basename $d)
2506                     dir=${aros_kernel_cc_includes}$(echo $(dirname $d) | \
2507                                                 sed -n "s,^.*/include\(/.*\),\1,p")
2508                     ! test -d $dir && mkdir -p $dir
2509                     ! test -f $dir/$h && { cp $d $dir; chmod u+w $dir/$h; }
2510                 done
2511             done            
2512         fi
2513     fi
2514     AC_MSG_RESULT($aros_kernel_cc_includes)
2515     # Adding -nostdinc to kernel includes as they are always used together.
2516     aros_kernel_includes="$aros_kernel_includes $aros_target_nostdinc_cflags -isystem $aros_kernel_cc_includes"
2519 if test "$crosstools" != "yes"; then
2520     dnl find out about the target cc's include path
2521     AC_MSG_CHECKING([for the target compiler's include path])
2522     if test "$aros_target_cc_includes" = "" ; then
2523         #try to guess where the directory is
2524         aros_target_cc_includes=`dirname \`${orig_target_cc} -print-libgcc-file-name\``/include
2525         if ! test -d $aros_target_cc_includes; then
2526             #the directory doesn't exist, we need to do some more work
2527             aros_target_cc_includes=${PWD}/${aros_gendir}/cc_include
2528         
2529             #these are the headers we're looking for
2530             headers="limits.h mmintrin.h stdbool.h syslimits.h float.h \
2531                     stddef.h xmmintrin.h iso646.h stdarg.h unwind.h   \
2532                     zutil.h"
2534             dirs=
2535             for h in $headers; do
2536                 #which other headers each of the above headers needs?
2537                 deps=$(echo "#include <$h>" | \
2538                     $orig_target_cc -E -M - 2>/dev/null | \
2539                     sed 's/^.*://; s/\\$/ /g; s/[[ \t]]\+/ /g')
2540             
2541                 #copy all the needed headers to a directory beneath gendir
2542                 for d in $deps; do
2543                     h=$(basename $d)
2544                     dir=${aros_target_cc_includes}$(echo $(dirname $d) | \
2545                                                 sed -n "s,^.*/include\(/.*\),\1,p")
2546                     ! test -d $dir && mkdir -p $dir
2547                     ! test -f $dir/$h && { cp $d $dir; chmod u+w $dir/$h; }
2548                 done
2549             done
2550         fi
2551     fi
2552     AC_MSG_RESULT($aros_target_cc_includes)
2553 else
2554     # We do not know which c compiler version we are going to build and what we need to know
2555     # here is different for different versions so this will be set later during the
2556     # build of crosstools.
2557     aros_target_cc_includes=@aros_target_cc_includes@
2561 # For GCC < 4.0 -I- is used for giving the search path for '#include "..."'
2562 # On GCC >= 4.0 -iquote should be used
2565 save_cc="$CC"
2566 save_cflags="$CFLAGS"
2567 CFLAGS="-iquote."
2568 kernel_cflags_iquote=$host_cflags_iquote
2569 kernel_cflags_iquote_end=$host_cflags_iquote_end
2570 if test "x-$cross_compiling" = "x-yes"; then
2571     CC="$aros_kernel_cc"
2572     AC_MSG_CHECKING([whether ${CC} accepts -fno-stack-protector])
2573     if test "x-$crosstools" != "x-yes"; then
2574         AC_TRY_COMPILE(,, use_no_stack_protector="yes", use_no_stack_protector="no")
2575     else
2576         # we do know it is supported for the smallest version of gcc we are going to build
2577         # we assume it's also supported by later versions
2578         use_no_stack_protector=yes
2579     fi
2580     AC_MSG_RESULT($use_no_stack_protector)
2581     AC_MSG_CHECKING([whether ${CC} accepts -iquote])
2582     if test "x-$crosstools" != "x-yes"; then
2583         AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
2584     else
2585         # we do know it is supported for the smallest version of gcc we are going to build
2586         # we assume it's also supported by later versions
2587         has_iquote=yes
2588     fi
2589     AC_MSG_RESULT($has_iquote)
2590     if test "x-$has_iquote" = "x-yes" ; then
2591         kernel_cflags_iquote=-iquote
2592         kernel_cflags_iquote_end=
2593     else
2594         kernel_cflags_iquote=-I
2595         kernel_cflags_iquote_end=-I-
2596     fi
2598 if test "x-$use_no_stack_protector" = "x-yes" ; then
2599     aros_kernel_cflags="$aros_kernel_cflags -fno-stack-protector"
2602 #-----------------------------------------------------------------------------
2604 # Check if we can explicitly choose older version of symbol hashing
2606 CFLAGS="save_cflags -Wl,--hash-style=sysv"
2607 CC="$aros_kernel_cc"
2608 AC_MSG_CHECKING([whether ${CC} accepts -Wl,--hash-style=sysv])
2609 AC_TRY_LINK(,, use_hash_style="yes", use_hash_style="no")
2610 AC_MSG_RESULT($use_hash_style)
2611 if test "x-$use_hash_style" = "x-yes" ; then
2612     aros_kernel_cflags="$aros_kernel_cflags -Wl,--hash-style=sysv"
2614 CC="$save_cc"
2615 CFLAGS="$save_cflags"
2617 AC_SUBST(host_cflags_iquote)
2618 AC_SUBST(host_cflags_iquote_end)
2619 AC_SUBST(kernel_cflags_iquote)
2620 AC_SUBST(kernel_cflags_iquote_end)
2623 dnl Check if user specified --with-resolution=XRESxYRESxDEPTH
2624 AC_MSG_CHECKING([for default resolution of WBScreen])
2625 AC_ARG_WITH(resolution,AC_HELP_STRING([--with-resolution=XRESxYRESxDEPTH],[Default resolution of the initial WorkbenchScreen]),resolution=$withval,resolution=none)
2626 # We require an argument, so map --with/--without ("yes"/"no") to "none" specified
2627 if test "$resolution" = "yes" ; then
2628     resolution="none"
2630 if test "$resolution" = "no" ; then
2631     resolution="none"
2633 if test "$resolution" != "none" ; then
2634     aros_nominal_width=`echo $resolution | cut -d'x' -f1`
2635     aros_nominal_height=`echo $resolution | cut -d'x' -f2`
2636     aros_nominal_depth=`echo $resolution | cut -d'x' -f3`
2638 AC_MSG_RESULT($aros_nominal_width x $aros_nominal_height x $aros_nominal_depth)
2639 aros_cv_nominal_width=$aros_nominal_width
2640 aros_cv_nominal_height=$aros_nominal_height
2641 aros_cv_nominal_depth=$aros_nominal_depth
2643 dnl See if the user wants the serial debug output for native flavour
2644 AC_MSG_CHECKING([whether serial debug is enabled])
2645 AC_ARG_WITH(serial-debug,AC_HELP_STRING([--with-serial-debug],[Enable serial debug output in native (default=no)]),serial_debug=$withval,serial_debug=none)
2646 if test "$aros_serial_debug" = 0 ; then
2647     serial_debug_forced=""
2648     if test "$serial_debug" = "yes" ; then
2649         serial_debug="1"
2650     fi
2651     if test "$serial_debug" = "no" ; then
2652         serial_debug="none"
2653     fi
2654 else
2655     serial_debug_forced="(forced)"
2656     serial_debug=$aros_serial_debug
2658 if test "$serial_debug" != "none" ; then
2659     aros_serial_debug=$serial_debug
2660     AC_MSG_RESULT($serial_debug_forced on port $serial_debug)
2661 else
2662     AC_MSG_RESULT(no)
2665 dnl See if the user wants the palm debug output hack for palm native flavour
2666 AC_MSG_CHECKING([whether palm debug hack is enabled])
2667 AC_ARG_ENABLE(palm_debug_hack,AC_HELP_STRING([--enable-palm-debug-hack],[Enable palm debug output hack in palm native (default=no)]),palm_debug_hack="yes",palm_debug_hack="no")
2668 if test "$palm_debug_hack" = "yes" ; then
2669     aros_palm_debug_hack="1"
2671 AC_MSG_RESULT($palm_debug_hack)
2673 dnl See if dev wants the usb3.0 code
2674 AC_MSG_CHECKING([whether usb3.0 code is enabled])
2675 AC_ARG_ENABLE(usb30_code,AC_HELP_STRING([--enable-usb30-code],[Enable usb3.0 code (default=no)]),usb30_code="yes",usb30_code="no")
2676 if test "$usb30_code" = "yes" ; then
2677     aros_config_cppflags="$aros_config_cppflags -DAROS_USB30_CODE"
2678     aros_kernel_cflags="$aros_kernel_cflags -DAROS_USB30_CODE"
2680 AC_MSG_RESULT($usb30_code)
2682 dnl See if the user wants nesting supervisor activated for unix flavour
2683 AC_MSG_CHECKING([whether nesting supervisor support is enabled])
2684 AC_ARG_ENABLE(nesting_supervisor,AC_HELP_STRING([--enable-nesting-supervisor],[Enable nesting supervisor support in unix (default=no)]),nesting_supervisor="yes",nesting_supervisor="no")
2685 if test "$nesting_supervisor" = "yes" ; then
2686     aros_nesting_supervisor="1"
2688 AC_MSG_RESULT($nesting_supervisor)
2690 dnl See if the user wants to disable MMU support
2691 dnl This can be overriden on per-target basis,
2692 dnl set $aros_enable_mmu to "yes" or "no" to do this
2693 if test "$aros_enable_mmu" = "" ; then
2694     AC_MSG_CHECKING([whether MMU support is enabled])
2695     dnl Enabled by default
2696     AC_ARG_ENABLE(mmu,AC_HELP_STRING([--disable-mmu],[Disable MMU support (default=enabled)]),aros_enable_mmu=$enableval,aros_enable_mmu="yes")
2697     if test "$aros_enable_mmu" = "" ; then
2698         aros_enable_mmu="yes"
2699     fi
2700     AC_MSG_RESULT($aros_enable_mmu)
2702 if test "$aros_enable_mmu" = "no" ; then
2703     aros_enable_mmu="0"
2704 else
2705     aros_enable_mmu="1"
2707     
2709 dnl things specifically required for hosted flavours
2710 if test "x-$aros_flavour" = "x-emulation" -o "x-$aros_flavour" = "x-emulcompat" ; then
2712     if test "x-$need_dlopen" != "x-no" ; then
2713       save_libs="$LIBS"
2714       LIBS=""
2715       dnl some kind of dynamic library access system is required for hostlib.resource
2716       AC_CHECK_FUNC(dlopen, have_dl="yes", have_dl="no")
2717       if test "x-$have_dl" = "x-no" ; then
2718           AC_CHECK_LIB(dl, dlopen, [have_dl="yes"
2719                                     aros_host_ldflags="$aros_host_ldflags -ldl"],
2720                                     have_dl="no")
2721       fi
2722       if test "x-$have_dl" = "x-no" ; then
2723           AC_MSG_ERROR([dlopen() dynamic linker functions not available])
2724       fi
2725       LIBS="$save_libs"
2726     fi
2729     dnl x11 hidd
2730     AC_ARG_ENABLE(x11_hidd, AC_HELP_STRING([--enable-x11-hidd],
2731                                            [build X11 hidd for hosted (default=auto)]),
2732                                            x11_hidd="$enableval",
2733                                            x11_hidd="$need_x11")
2734     case "x-$x11_hidd" in
2735         x-yes|x-no|x-auto)                 ;;
2736         *)                 x11_hidd="$need_x11" ;;
2737     esac
2739     ENABLE_X11=0
2741     dnl they want it
2742     if test "x-$x11_hidd" != "x-no" ; then
2744         dnl find x11 stuff
2745         AC_PATH_X
2747         if test -n "$x_includes"; then
2748             X_CFLAGS="$X_CFLAGS -I$x_includes"
2749         fi
2751         if test -n "$x_libraries"; then
2752             X_LIBS="$X_LIBS -L$x_libraries"
2753         fi
2755         if test "x-$no_x" = "x-yes" ; then
2757             dnl didn't find it
2758             if test "x-$x11_hidd" != "x-auto" ; then
2759                 dnl and they explicitly asked for it, bail out
2760                 AC_MSG_ERROR([X11 libs/headers not found, cannot build X11 hidd as requested])
2761             fi
2762         
2763         else
2764             dnl found it, setup the metatarget
2765             host_x_gfx=yes
2766             ENABLE_X11=1
2768             aros_host_x11_cflags="$X_CFLAGS"
2769             aros_host_x11_ldflags="$X_LIBS  -lX11"
2771             dnl setup shared memory extensions
2772             AC_ARG_ENABLE(x11_shm, AC_HELP_STRING([--enable-x11-shm],
2773                                                   [use X11 shared memory (default=auto)]),
2774                                                   x11_hidd_shm="$enableval",
2775                                                   x11_hidd_shm="auto")
2776             case "x-$x11_hidd_shm" in
2777                 x-yes|x-no|x-auto)                     ;;
2778                 *)                 x11_hidd_shm="auto" ;;
2779             esac
2781             have_xshm=no
2783             dnl they want it
2784             if test "x-$x11_hidd_shm" != "x-no" ; then
2786                 dnl system shm headers
2787                 AC_CHECK_HEADERS(sys/ipc.h)
2788                 AC_CHECK_HEADERS(sys/shm.h)
2790                 dnl got them
2791                 if test "x-$ac_cv_header_sys_ipc_h" = "x-yes" -a "x-$ac_cv_header_sys_shm_h" = "x-yes" ; then
2793                     dnl make sure X libs have shm functions
2794                     save_cflags="$CFLAGS"
2795                     save_ldflags="$LDFLAGS"
2796                     CFLAGS="$CFLAGS $X_CFLAGS"
2797                     LDFLAGS="$LDFLAGS $X_LIBS"
2798                     AC_CHECK_LIB(Xext, XShmQueryExtension, have_xshm=yes)
2799                     CFLAGS="$save_cflags"
2800                     LDFLAGS="$save_ldflags"
2801                 fi
2802             fi
2804             dnl detection done, prepare output
2805             if test "x-$have_xshm" = "x-yes" ; then
2806                 dnl we can do shm
2807                 DO_XSHM_SUPPORT="1"
2808             elif test "x-$x11_hidd_shm" = "x-yes" ; then
2809                 dnl they explicitly asked for it, but we can't do it
2810                 AC_MSG_ERROR([X11 has no support for shared memory, cannot enable it as requested])
2811             else
2812                 dnl otherwise just disable it
2813                 DO_XSHM_SUPPORT="0"
2814             fi
2816             
2817             dnl setup vidmode (fullscreen) extensions
2818             AC_ARG_ENABLE(x11_vidmode, AC_HELP_STRING([--enable-x11-vidmode],
2819                                                       [use X11 vidmode extension (default=auto)]),
2820                                                       x11_hidd_vidmode="$enableval",
2821                                                       x11_hidd_vidmode="auto")
2822             case "x-$x11_hidd_vidmode" in
2823                 x-yes|x-no|x-auto)                         ;;
2824                 *)                 x11_hidd_vidmode="auto" ;;
2825             esac
2827             have_vidmode=no
2829             dnl they want it
2830             if test "x-$x11_hidd_vidmode" != "x-no" ; then
2832                 dnl make sure X libs have vidmode functions
2833                 save_cflags="$CFLAGS"
2834                 save_ldflags="$LDFLAGS"
2835                 CFLAGS="$CFLAGS $X_CFLAGS"
2836                 LDFLAGS="$LDFLAGS $X_LIBS"
2837                 AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryExtension, have_vidmode=yes)
2838                 CFLAGS="$save_cflags"
2839                 LDFLAGS="$save_ldflags"
2840             fi
2842             dnl detection done, prepare output
2843             if test "x-$have_vidmode" = "x-yes" ; then
2844                 dnl we can do vidmode
2845                 DO_VIDMODE_SUPPORT="1"
2846             elif test "x-$x11_hidd_vidmode" = "x-yes" ; then
2847                 dnl they explicitly asked for it, but we can't do it
2848                 AC_MSG_ERROR([X11 vidmode extension not available, cannot enable it as requested])
2849             else
2850                 dnl otherwise just disable it
2851                 DO_VIDMODE_SUPPORT="0"
2852             fi
2853         fi
2854     fi
2856     dnl sdl hidd
2857     AC_ARG_ENABLE(sdl_hidd, AC_HELP_STRING([--enable-sdl-hidd],
2858                                            [build SDL hidd for hosted (default=auto)]),
2859                                            sdl_hidd="$enableval",
2860                                            sdl_hidd="auto")
2861     case "x-$sdl_hidd" in
2862         x-yes|x-no|x-auto)                 ;;
2863         *)                 sdl_hidd="auto" ;;
2864     esac
2866     dnl they want it
2867     if test "x-$sdl_hidd" != "x-no" ; then
2869         dnl find sdl
2870         SDL_VERSION=1.2.5
2871         AM_PATH_SDL($SDL_VERSION, [have_sdl="yes"],
2872             [have_sdl="no"])
2874         if test "x-$have_sdl" != "x-yes" ; then
2876             dnl didn't find it
2877             if test "x-$sdl_hidd" != "x-auto" ; then
2878                 dnl and they explicitly asked for it, bail out
2879                 AC_MSG_ERROR([SDL libs/headers not found, cannot build SDL hidd as requested])
2880             fi
2882         else
2883             dnl found it, enable the build
2884             host_sdl_gfx=yes
2885             aros_host_sdl_cflags=$SDL_CFLAGS
2886             aros_host_sdl_libs=$SDL_LIBS
2887         fi
2888     fi
2893 dnl See if the user wants dbus.library
2894 AC_MSG_CHECKING([whether building of dbus.library is enabled])
2895 AC_ARG_ENABLE(dbus,AC_HELP_STRING([--enable-dbus],[Enable DBUS support via dbus.library (default=no)]),dbus="yes",dbus="no")
2896 if test "$dbus" = "yes" ; then
2897     ENABLE_DBUS=1
2898     DBUS_CFLAGS=`pkg-config --cflags dbus-1`
2899     DBUS_LIBFLAGS=`pkg-config --libs dbus-1`
2900     KERNEL_DBUS_KOBJ=kernel-dbus-kobj
2901     KERNEL_DBUS_INCLUDES=kernel-dbus-includes
2902 else
2903     ENABLE_DBUS=0
2905 AC_MSG_RESULT($dbus)
2907 if test "$use_kernel_cc_wrapper" = "yes" ; then
2908     aros_kernel_cc="${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-elf-${toolchain_c_compiler}"
2911 aros_kernel_cppflags=$aros_config_cppflags
2912 aros_optimization_cflags="$optimization_level"
2913 if test "$optimization" = "default"; then
2914 AC_MSG_CHECKING([default optimization level to use])
2915 AC_MSG_RESULT($optimization_level)
2918 dnl --------------------------------------------------------------------
2919 dnl Configuration Output Section
2920 dnl --------------------------------------------------------------------
2922 # Generic
2923 AC_SUBST(aros_arch)
2924 AC_SUBST(aros_cpu)
2925 AC_SUBST(aros_flavour)
2926 AC_SUBST(aros_flavour_uc)
2927 AC_SUBST(aros_target_toolchain)
2928 AC_SUBST(aros_toolchain_ld)
2929 AC_SUBST(aros_build_host)
2930 AC_SUBST(AROS_BUILDDIR)
2931 AC_SUBST(AROS_BUILDDIR_UNIX)
2932 AC_SUBST(SRCDIR)
2933 AC_SUBST(AROS_CROSSTOOLSDIR)
2934 AC_SUBST(AROS_PORTSSRCDIR)
2936 # Compatability with other Amiga-like operation systems
2937 AC_SUBST(aros_amigaos_compliance)
2939 # Host related
2940 AC_SUBST(aros_cc_pre)
2941 AC_SUBST(aros_host_strip)
2942 AC_SUBST(aros_host_arch)
2943 AC_SUBST(aros_host_cpu)
2944 AC_SUBST(aros_host_cpp)
2945 AC_SUBST(aros_host_def_cc)
2946 AC_SUBST(aros_host_cc)
2947 AC_SUBST(aros_host_cxx)
2948 AC_SUBST(aros_host_ar)
2949 AC_SUBST(aros_host_ranlib)
2950 AC_SUBST(aros_host_ld)
2951 AC_SUBST(aros_host_make)
2952 AC_SUBST(aros_host_cppflags)
2953 AC_SUBST(aros_host_cflags)
2954 AC_SUBST(aros_host_cxxflags)
2955 AC_SUBST(gnu89_inline)
2956 AC_SUBST(aros_host_ldflags)
2957 AC_SUBST(aros_host_debug)
2958 AC_SUBST(aros_host_mkdep)
2959 AC_SUBST(aros_host_mkargs)
2960 AC_SUBST(aros_host_exe_suffix)
2961 AC_SUBST(aros_host_lib_suffix)
2962 AC_SUBST(aros_tools_dir)
2963 AC_SUBST(aros_host_aclocal)
2964 AC_SUBST(aros_host_autoconf)
2965 AC_SUBST(aros_host_autoheader)
2966 AC_SUBST(aros_host_automake)
2967 AC_SUBST(ant)
2969 # Target Related
2970 AC_SUBST(aros_target_guitheme)
2971 AC_SUBST(aros_target_iconset)
2972 AC_SUBST(aros_target_bootloader)
2973 AC_SUBST(aros_target_arch)
2974 AC_SUBST(aros_target_family)
2975 AC_SUBST(aros_target_cpu)
2976 AC_SUBST(aros_target_cpu_mode)
2977 AC_SUBST(aros_target_variant)
2978 AC_SUBST(aros_target_suffix)
2979 AC_SUBST(aros_target_ar)
2980 AC_SUBST(aros_target_ranlib)
2981 AC_SUBST(aros_plain_nm)
2982 AC_SUBST(aros_plain_ar)
2983 AC_SUBST(aros_kernel_ar)
2984 AC_SUBST(aros_kernel_ranlib)
2985 AC_SUBST(orig_target_cc)
2986 AC_SUBST(aros_target_cc)
2987 AC_SUBST(aros_kernel_cc)
2988 AC_SUBST(orig_target_cxx)
2989 AC_SUBST(aros_target_cxx)
2990 AC_SUBST(aros_kernel_cxx)
2991 AC_SUBST(orig_target_cpp)
2992 AC_SUBST(aros_target_cpp)
2993 AC_SUBST(aros_kernel_cpp)
2994 AC_SUBST(orig_target_as)
2995 AC_SUBST(aros_target_as)
2996 AC_SUBST(aros_kernel_as)
2997 AC_SUBST(orig_target_ld)
2998 AC_SUBST(aros_target_ld)
2999 AC_SUBST(aros_kernel_ld)
3000 AC_SUBST(aros_target_cc_includes)
3001 AC_SUBST(aros_target_cc_path)
3002 AC_SUBST(aros_target_objdump)
3003 AC_SUBST(aros_target_objcopy)
3004 AC_SUBST(aros_target_strip)
3005 AC_SUBST(aros_target_nm)
3006 AC_SUBST(aros_kernel_rescomp)
3007 AC_SUBST(aros_shared_default)
3008 AC_SUBST(aros_shared_ld)
3009 AC_SUBST(aros_object_format)
3010 AC_SUBST(spec_obj_format)
3011 AC_SUBST(aros_compiler_libs)
3012 AC_SUBST(aros_arch_libs)
3014 AC_SUBST(aros_shared_cflags)
3015 AC_SUBST(aros_shared_aflags)
3016 AC_SUBST(aros_shared_ldflags)
3018 AC_SUBST(aros_config_sysroot)
3019 AC_SUBST(aros_warn_flags)
3020 AC_SUBST(aros_nowarn_flags)
3021 AC_SUBST(aros_config_cppflags)
3022 AC_SUBST(aros_config_cflags)
3023 AC_SUBST(aros_config_cxxflags)
3024 AC_SUBST(aros_config_aflags)
3025 AC_SUBST(aros_config_ldflags)
3027 AC_SUBST(aros_kernel_sysroot)
3028 AC_SUBST(aros_kernel_cppflags)
3029 AC_SUBST(aros_kernel_cflags)
3030 AC_SUBST(aros_kernel_includes)
3031 AC_SUBST(aros_kernel_objcflags)
3032 AC_SUBST(aros_kernel_ldflags)
3033 AC_SUBST(aros_debug_cppflags)
3034 AC_SUBST(aros_debug_cflags)
3035 AC_SUBST(aros_debug_cxxflags)
3036 AC_SUBST(aros_debug_aflags)
3037 AC_SUBST(aros_debug_ldflags)
3038 AC_SUBST(aros_target_genmap)
3039 AC_SUBST(aros_target_strip_flags)
3040 AC_SUBST(aros_config_lto)
3041 AC_SUBST(aros_config_coverage)
3042 AC_SUBST(aros_optimization_cflags)
3043 AC_SUBST(aros_isa_extra)
3044 AC_SUBST(aros_isa_flags)
3046 AC_SUBST(crosstools_target)
3047 AC_SUBST(crosstools_cxx_target)
3049 # Hosted Graphics Related
3050 AC_SUBST(host_x_gfx)
3051 AC_SUBST(host_sdl_gfx)
3052 AC_SUBST(host_android_gfx)
3054 AC_SUBST(pci_hidd_target)
3056 AC_SUBST(aros_nominal_width)
3057 AC_SUBST(aros_nominal_height)
3058 AC_SUBST(aros_nominal_depth)
3059 AC_SUBST(DO_XSHM_SUPPORT)
3060 AC_SUBST(DO_VIDMODE_SUPPORT)
3062 AC_SUBST(aros_host_x11_cflags)
3063 AC_SUBST(aros_host_x11_ldflags)
3064 AC_SUBST(aros_host_sdl_cflags)
3065 AC_SUBST(aros_host_sdl_libs)
3067 # Bootloader related
3068 AC_SUBST(target_grub2_version)
3070 # Native version related
3071 AC_SUBST(aros_serial_debug)
3072 AC_SUBST(PLATFORM_EXECSMP)
3073 AC_SUBST(ENABLE_EXECSMP)
3075 # Palm native version related
3076 AC_SUBST(aros_palm_debug_hack)
3078 # Unix/Hosted version related
3079 AC_SUBST(aros_nesting_supervisor)
3081 # MMU related
3082 AC_SUBST(aros_enable_mmu)
3084 # Apple iOS related
3085 AC_SUBST(aros_ios_platform)
3086 AC_SUBST(aros_ios_version)
3087 AC_SUBST(aros_ios_sdk)
3089 # ARM default GCC target related
3090 AC_SUBST(gcc_default_cpu)
3091 AC_SUBST(gcc_default_cpu_tune)
3092 AC_SUBST(gcc_default_fpu)
3093 AC_SUBST(gcc_default_float_abi)
3094 AC_SUBST(gcc_default_mode)
3096 # Android related
3097 AC_SUBST(android_tool)
3098 AC_SUBST(aros_android_level)
3099 AC_SUBST(aros_android_antapk)
3101 # DBUS related
3102 AC_SUBST(ENABLE_DBUS)
3103 AC_SUBST(DBUS_CFLAGS)
3104 AC_SUBST(DBUS_LIBFLAGS)
3105 AC_SUBST(KERNEL_DBUS_KOBJ)
3106 AC_SUBST(KERNEL_DBUS_INCLUDES)
3108 #X11 related
3109 AC_SUBST(ENABLE_X11)
3111 # Debug related
3112 AC_SUBST(aros_debug)
3113 AC_SUBST(aros_mungwall_debug)
3114 AC_SUBST(aros_stack_debug)
3115 AC_SUBST(aros_modules_debug)
3117 # Collect-aros stuff: "-ius" to ignore undefined symbols
3118 AC_SUBST(ignore_undefined_symbols)
3120 # C compiler related
3121 AC_SUBST(gcc_target_cpu)
3122 AC_SUBST(target_binutils_version)
3123 AC_SUBST(target_gcc_version)
3125 #ObjC compiler related
3126 AC_SUBST(objc_target)
3128 #Java related
3129 AC_SUBST(java_target)
3131 # USB3.0 code
3132 AC_SUBST(aros_usb30_code)
3134 dnl Prepare for output, make up all the generated patches
3135 case "$aros_flavour" in
3136 emulation)      aros_flavour_uc="AROS_FLAVOUR_EMULATION"
3137                 aros_flavour="emulation" ;;
3138 emulcompat)     aros_flavour_uc="(AROS_FLAVOUR_EMULATION|AROS_FLAVOUR_BINCOMPAT)"
3139                 aros_flavour="emulation" ;;
3140 standalone)     aros_flavour_uc="AROS_FLAVOUR_STANDALONE"
3141                 aros_flavour="standalone";;
3142 standcompat)    aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_BINCOMPAT)"
3143                 aros_flavour="standalone";;
3144 native)         aros_flavour_uc="AROS_FLAVOUR_NATIVE"
3145                 aros_flavour="native" ;;
3146 nativecompat)   aros_flavour_uc="(AROS_FLAVOUR_NATIVE|AROS_FLAVOUR_BINCOMPAT)"
3147                 aros_flavour="native" ;;
3148 linklib)        aros_flavour_uc="AROS_FLAVOUR_LINKLIB"
3149                 aros_flavour="linklib" ;;
3150 palmnative)     aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
3151                 aros_flavour="palmnative" ;;
3152 mac68knative)   aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
3153                 aros_flavour="mac68knative" ;;
3154 ppcnative)      aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_BINCOMPAT)"
3155                 aros_flavour="ppcnative" ;;
3156 esac
3158 if test ! -d ${aros_inc_dir} ; then
3159     ${MKDIR} ${aros_inc_dir}
3161 if test ! -d ${aros_geninc_dir} ; then
3162     ${MKDIR} ${aros_geninc_dir}
3164 if test ! -d ${aros_hostcfg_dir} ; then
3165     ${MKDIR} ${aros_hostcfg_dir}
3167 if test ! -d ${aros_targetcfg_dir} ; then
3168     ${MKDIR} ${aros_targetcfg_dir}
3170 if test ! -d ${aros_tools_dir} ; then
3171     ${MKDIR} ${aros_tools_dir}
3173 if test ! -d ${aros_scripts_dir} ; then
3174     ${MKDIR} ${aros_scripts_dir}
3177 AC_CONFIG_HEADERS(${aros_geninc_dir}/host-conf.h:config/host-conf.h.in)
3179 # Generic build tools (metamake, etc)
3180 AC_CONFIG_COMMANDS([genmf-executable-support],
3181     [
3182         chmod a+x ${AROS_CROSSTOOLSDIR}/${aros_target_cpu}-aros-uname
3183         chmod a+x ${aros_tools_dir}/genmf.py
3184     ],
3185     [
3186         AROS_CROSSTOOLSDIR=${AROS_CROSSTOOLSDIR}
3187         aros_tools_dir=${aros_tools_dir}
3188     ]
3190 AC_CONFIG_FILES(
3191     Makefile
3192     config/make.cfg
3193     ${aros_inc_dir}/config.h:config/config.h.in
3194     ${aros_geninc_dir}/config.h:config/config.h.in
3195     ${aros_hostcfg_dir}/host.cfg:config/host.cfg.in
3196     ${aros_targetcfg_dir}/target.cfg:config/target.cfg.in
3197     ${aros_targetcfg_dir}/build.cfg:config/build.cfg.in
3198     mmake.config
3199     compiler/include/geninc.cfg:compiler/include/geninc.cfg.in
3200     ${aros_targetcfg_dir}/make.defaults:config/make.defaults.in
3201     ${aros_tools_dir}/genmf.py:tools/genmf/genmf.py
3202     ${AROS_CROSSTOOLSDIR}/${aros_target_cpu}-aros-uname:scripts/uname.in
3203     tools/collect-aros/env.h
3206 # Binutils
3207 AC_CONFIG_COMMANDS([binutils-support],
3208     [
3209         prefix=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}
3210         mkdir -p $prefix
3211         prefix2=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros
3213         chmod a+x ${prefix2}-ld
3215         ln -sf $orig_target_as$aros_host_exe_suffix      ${prefix2}-as$aros_host_exe_suffix
3216         ln -sf $orig_target_nm$aros_host_exe_suffix      ${prefix2}-nm$aros_host_exe_suffix
3217         ln -sf $orig_target_ar$aros_host_exe_suffix      ${prefix2}-ar$aros_host_exe_suffix
3218         ln -sf $orig_target_ranlib$aros_host_exe_suffix  ${prefix2}-ranlib$aros_host_exe_suffix
3219         ln -sf $orig_target_objcopy$aros_host_exe_suffix ${prefix2}-objcopy$aros_host_exe_suffix
3220         ln -sf $orig_target_objdump$aros_host_exe_suffix ${prefix2}-objdump$aros_host_exe_suffix
3221         ln -sf $orig_target_strip$aros_host_exe_suffix   ${prefix2}-strip$aros_host_exe_suffix
3222     ],
3223     [
3224         aros_host_exe_suffix=${aros_host_exe_suffix}
3225         aros_tools_dir=${aros_tools_dir}
3226         aros_target_cpu=${aros_target_cpu}
3227         aros_target_arch=${aros_target_arch}
3228         aros_target_suffix=${aros_target_suffix}
3229         orig_target_nm=${orig_target_nm}
3230         orig_target_as=${orig_target_as}
3231         orig_target_ar=${orig_target_ar}
3232         orig_target_ranlib=${orig_target_ranlib}
3233         orig_target_objdump=${orig_target_objdump}
3234         orig_target_objcopy=${orig_target_objcopy}
3235         orig_target_strip=${orig_target_strip}
3236         aros_kernel_ld=${aros_kernel_ld}
3237     ]
3239 if test "${use_ld_wrapper}" = "yes"; then
3240     AC_CONFIG_FILES(
3241         ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-${aros_ld}:scripts/aros-ld.in
3242     )
3244 # Bare Elf support script and spec
3245 if test "${use_kernel_cc_wrapper}" = "yes"; then
3246     AC_CONFIG_COMMANDS([elf-compiler-support],
3247         [
3248             prefix=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}
3249             mkdir -p $prefix
3250             prefix2=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-elf
3252             chmod a+x ${prefix2}-gcc
3254             ln -sf $aros_kernel_ld$aros_host_exe_suffix         ${prefix2}-ld$aros_host_exe_suffix
3255         ],
3256         [
3257             aros_host_exe_suffix=${aros_host_exe_suffix}
3258             aros_tools_dir=${aros_tools_dir}
3259             aros_target_cpu=${aros_target_cpu}
3260             aros_target_arch=${aros_target_arch}
3261             aros_target_suffix=${aros_target_suffix}
3262             aros_kernel_ld=${aros_kernel_ld}
3263         ]
3264     )
3265     AC_CONFIG_FILES(
3266         ${aros_targetcfg_dir}/elf-specs:${elf_specs_in}
3267         ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-elf-gcc:scripts/elf-gcc.in
3268     )
3271 # Host compiler support scripts and spec
3272 if test "${aros_target_toolchain}" = "no"; then
3273     AC_CONFIG_COMMANDS([host-compiler-wrapper-support],
3274         [
3275             prefix=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}
3276             mkdir -p $prefix
3277             prefix2=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros
3279             chmod a+x ${prefix2}-${toolchain_c_compiler} ${prefix2}-${toolchain_cxx_compiler} ${prefix2}-${toolchain_cpp_preprocessor}
3280         ],
3281         [
3282             aros_host_exe_suffix=${aros_host_exe_suffix}
3283             aros_tools_dir=${aros_tools_dir}
3284             aros_target_cpu=${aros_target_cpu}
3285             aros_target_arch=${aros_target_arch}
3286             aros_target_suffix=${aros_target_suffix}
3287         ]
3288     )
3289     AC_CONFIG_FILES(
3290         ${aros_targetcfg_dir}/specs:config/specs.in
3291         ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-${toolchain_cpp_preprocessor}:scripts/aros-${toolchain_cpp_preprocessor}.in
3292         ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-${toolchain_c_compiler}:scripts/aros-${toolchain_c_compiler}.in
3293         ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-${toolchain_cxx_compiler}:scripts/aros-${toolchain_cxx_compiler}.in
3294     )
3297 # Android support
3298 if test "$aros_target_variant" == "android"; then
3299     AC_CONFIG_FILES(${aros_gendir}/arch/all-android/bootstrap/app/default.properties:arch/all-android/bootstrap/app/default.properties.in)
3302 # cmake helper
3303 AC_CONFIG_FILES(${aros_targetcfg_dir}/conf.cmake:config/conf.cmake.in)
3305 AC_OUTPUT
3307 dnl This is in order to not define SHARED_CFLAGS sometimes
3308 dnl We don't always do aros_shared_ar, aros_shared_cflags
3310 #XXX compatability...
3311 aros_shared_ar="$aros_shared_ld $aros_shared_ldflags -o"
3313 if test -n "$aros_shared_cflags" ; then
3314     echo "SHARED_CFLAGS := $aros_shared_cflags" >> ${aros_hostcfg_dir}/host.cfg
3315     echo "SHARED_AR := $aros_shared_ar" >> ${aros_hostcfg_dir}/host.cfg