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