Add timer, code stolen from Michal Schulz (ohci driver)
[AROS.git] / configure.in
blobc7efc07277296db4a151cca7d010c230f99f3f33
1 dnl Copyright © 1997-2014, 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 # The AROS target is slightly different to the normal GNU style
26 # format. We don't have the middle part, and we reverse the order
27 # of the $(CPU) and $(OS) bits.
29 # Don't strip the version of the target yet, it might be
30 # useful on some systems.
32 AC_MSG_CHECKING([for AROS style target])
34 if test "$target" = "NONE" ; then
35     target=$host_os-$host_cpu
36 else
37     if test "$target" = "" ; then
38         target=$host_os-$host_cpu
39     fi
41 AC_MSG_RESULT($target)
43 if test "$host_os" = "mingw32" ; then
44     PWDCMD="pwd -W"
47 # Don't know where else to put this...
48 AC_MSG_CHECKING([building AROS in])
49 AROS_BUILDDIR=`${PWDCMD-pwd}`
50 AROS_BUILDDIR_UNIX=${PWD}
51 AC_MSG_RESULT($AROS_BUILDDIR)
53 AC_MSG_CHECKING([AROS source in])
54 srcpwd=`cd ${srcdir} ; ${PWDCMD-pwd}`
55 SRCDIR=${srcpwd}
56 AC_MSG_RESULT($SRCDIR)
58 # Parse the target field into something useful.
59 changequote(<<,>>)
60 target_os=`echo $target | sed 's/^\([^-].*\)-\(.*\)$/\1/'`
61 target_cpu=`echo $target | sed 's/^\([^-].*\)-\(.*\)$/\2/'`
62 changequote([,])
64 # Some debug output, to be removed again.
65 AC_MSG_CHECKING([for target system (debug output)])
66 AC_MSG_RESULT($target_os)
67 AC_MSG_CHECKING([for target cpu (debug output)])
68 AC_MSG_RESULT($target_cpu)
70 dnl --------------------------------------------------------------------
71 dnl Set the default Workbench resolution
72 dnl --------------------------------------------------------------------
73 aros_default_wbwidth=800
74 aros_default_wbheight=600
75 aros_default_wbdepth=4
77 dnl --------------------------------------------------------------------
78 dnl Host Configuration Section
79 dnl --------------------------------------------------------------------
80 dnl
81 dnl The idea here is to find out all the information we need about the
82 dnl host. This means things like tools for building directory structures,
83 dnl copying files around and the like.
85 # The first step is to find the host binaries.
86 # Check for a compiler.
87 # Due to a bug in autoconf check for c++ compiler first.
88 # For mor info see, http://osdir.com/ml/bug-autoconf-gnu/2010-05/msg00001.html.
89 AC_PROG_CXX
90 AC_PROG_CC
91 AC_PROG_CC_STDC
92 AC_PROG_CPP
94 # Check for a compatible awk
95 AC_CHECK_PROGS(AWK,[gawk nawk])
96 AROS_REQUIRED(gawk,$AWK)
97 AROS_PROG(MMAKE,mmake)
99 # Perform some default variable assignments. Note all of these will be
100 # Regenerated from the script, so there is no need to cache them.
102 aros_host_cpp="$CPP"
103 aros_host_cc="$CC"
104 aros_host_cxx="$CXX"
105 AROS_TOOL_CCPATH(aros_host_ld,ld)
106 AROS_REQUIRED(ld,$aros_host_ld)
107 aros_host_make="make"
108 aros_host_cflags="$CFLAGS"
109 aros_host_cxxflags="$CXXFLAGS"
110 aros_host_ldflags="$LDFLAGS"
111 aros_host_debug="-g -O0"
112 aros_host_mkdep="\$(SRCDIR)/scripts/mkdep"
113 aros_host_mkargs="--no-print-directory"
114 aros_host_exe_suffix="$EXEEXT"
115 aros_host_lib_suffix=""
117 # Ignore all compliance, AROS ROMs = 0
118 # KickStart v1.0 = 30
119 # KickStart v1.3 = 34
120 # KickStart v2.0 = 37
121 # KickStart v3.0 = 39
122 # KickStart v3.1 = 40
123 # AmigaOS   v3.5 = 44
124 aros_amigaos_compliance=0
126 AC_CHECK_PROGS(aros_host_aclocal,[aclocal aclocal19 aclocal-1.9])
127 AC_CHECK_PROGS(aros_host_autoconf,[autoconf autoconf259 autoconf253])
128 AC_CHECK_PROGS(aros_host_autoheader,[autoheader autoheader259 autoheader253])
129 AC_CHECK_PROGS(aros_host_automake,[automake automake19 automake-1.9])
131 AROS_REQUIRED(aclocal/aclocal19/aclocal-1.9, $aros_host_aclocal)
132 AROS_REQUIRED(automake/automake19/automake-1.9, $aros_host_automake)
134 case "$aros_host_cc" in
135     *gcc*)
136         aros_host_cc_pipe="-pipe"
137         ;;
138     icc)
139         aros_host_cc_pipe=""
140         ;;
141     *)
142         aros_host_cc_pipe=""
143         ;;
144 esac
146 aros_kernel_cc_includes=""
147 aros_target_cc_includes=""
148 host_cc_elf=yes
150 # ----------------------------------------------------------------------------------------
151 # Host-specific defaults
153 # This is the main host configuration section. It is where the host
154 # can change the values of any variables it needs to change. We do
155 # not look at anything that compiles to the target yet, we'll get
156 # to that later.
158 case "$host_os" in
159     aros*)
160         aros_host_arch="aros"
161         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
162         case "$host_cpu" in
163             *i?86*)
164                 aros_host_cpu="i386"
165                 ;;
166             *x86_64*)
167                 aros_host_cpu="x86_64"
168                 ;;
169             *powerpc*)
170                 aros_host_cpu="ppc"
171                 ;;
172             *)
173                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
174                 aros_host_cpu="$host_cpu"
175                 ;;
176         esac
177         ;;
179     linux*)
180         aros_host_arch="linux"
181         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
182         android_build_os="linux-x86"
183         android_tool="android"
184         default_android_sdk="/opt/android-sdk-linux_x86"
185         case "$host_cpu" in
186             *i?86*)
187                 aros_host_cpu="i386"
188                 ;;
189             *x86_64*)
190                 aros_host_cpu="x86_64"
191                 ;;
192             *m68k*)
193                 aros_host_cpu="m68k"
194                 ;;
195             *powerpc*)
196                 aros_host_cpu="ppc"
197                 ;;
198             *arm*)
199                 aros_host_cpu="arm"
200                 ;;
201             *)
202                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
203                 aros_host_cpu="$host_cpu"
204                 ;;
205         esac
206         ;;
208     freebsd*)
209         aros_host_cc="$aros_host_cc $aros_host_cc_pipe -I/usr/local/include"
210         aros_host_make="gmake"
211         aros_host_arch="freebsd"
212         aros_host_cpu="i386"
214         aros_host_ldflags="$aros_host_ldflags -L/usr/local/lib -liconv"
216         dnl FreeBSD 5.x (and later) has changed the default object format.
217         dnl The double [[]] is necessary to get around m4's quoting rules.
218         case $host_os in
219             freebsd[[234]]*)
220                 aros_object_format="elf_i386"
221                 ;;
223             *)
224                 aros_object_format="elf_i386_fbsd"
225                 ;;
226         esac
228         ;;
230     darwin*)
231         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
232         aros_host_arch="darwin"
233         host_cc_elf=no
234         SED="gsed"
235         android_build_os="darwin-x86"
236         android_tool="android"
237         default_android_sdk="/android-sdk-mac_x86"
238         case "$host_cpu" in
239             *i?86*)
240                 aros_host_cpu="i386"
241                 ;;
242             *x86_64*)
243                 aros_host_cpu="x86_64"
244                 ;;
245             *powerpc*)
246                 aros_host_cpu="ppc"
247                 ;;
248             *)
249                 AC_MSG_WARN("Unknown CPU for Darwin host -- $host_cpu")
250                 aros_host_cpu="$host_cpu"
251                 ;;
252         esac
254         aros_host_ldflags="$aros_host_ldflags -liconv"
256         ;;
258     dragonfly*)
259         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
260         aros_host_make="gmake"
261         aros_host_arch="dragonfly"
262         case $host_cpu in
263             *i?86*)
264                 aros_host_cpu="i386"
265                 ;;
266             *amd64*)
267                 aros_host_cpu="x86_64"
268                 ;;
269             *)
270                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
271                 aros_host_cpu="$host_cpu"
272                 ;;
273         esac
274         ;;
276     netbsd*)
277         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
278         aros_host_make="gmake"
279         aros_host_arch="netbsd"
280         case "$host_cpu" in
281             *i?86*)
282                 aros_host_cpu="i386"
283                 ;;
284             *m68k*)
285                 aros_host_cpu="m68k"
286                 ;;
287             *)
288                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
289                 aros_host_cpu="$host_cpu"
290                 ;;
291         esac    
292         aros_host_lib_suffix=".0.0"
293         ;;
295     openbsd*)
296         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
297         aros_host_make="gmake"
298         aros_host_arch="openbsd"
299         case "$host_cpu" in
300             *i?86*)
301                 aros_host_cpu="i386"
302                 ;;
303             *)
304                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
305                 aros_host_cpu="$host_cpu"
306                 ;;
307         esac
308         ;;
309         
310     solaris*)
311         aros_host_arch="solaris"
312         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
313         case "$host_cpu" in
314             *i?86*)
315                 aros_host_cpu="i386"
316                 ;;
317             *sparc*)
318                 aros_host_cpu="sparc"
319                 ;;
320             *)
321                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
322                 aros_host_cpu="$host_cpu"
323                 ;;
324         esac
325         ;;
327     morphos*)
328         aros_host_arch="morphos"
329         aros_host_cpu="ppc"
330         host_cc_elf=no
331         ;;
333     amiga*)
334         aros_host_arch="amiga"
335         host_cc_elf=no
336         SORT="/gg/bin/sort"
337         TEST="/gg/bin/test"
338         UNIQ="/gg/bin/uniq"
339         FOR="for"
340         TOUCH="/gg/bin/touch"
341         case "$host_cpu" in
342             *m68k*)
343                 aros_host_cpu="m68k"
344                 ;;
345             *powerpc*)
346                 aros_host_cpu="ppc"
347                 ;;
348             *)
349                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
350                 aros_host_cpu="$host_cpu"
351                 ;;
352         esac
353         ;;
355     cygwin*)
356         aros_host_arch="cygwin"
357         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
358         host_cc_elf=no
359         android_build_os="windows"
360         android_tool="android.bat"
361         default_android_sdk="/cygdrive/c/android-sdk-windows-1.6_r1"
363         case "$host_cpu" in
364             *i?86*)
365                 aros_host_cpu="i386"
366                 ;;
367             *)
368                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
369                 aros_host_cpu="$host_cpu"
370                 ;;
371         esac
372         ;;
374     mingw32*)
375         aros_host_arch="mingw32"
376         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
377         host_cc_elf=no
378         android_build_os="windows"
379         android_tool="android.bat"
380         default_android_sdk="/c/android-sdk-windows-1.6_r1"
382         case "$host_cpu" in
383         *i?86*)
384             dnl Currently there's neither 64-bit MinGW nor MSYS. Both environments are 32-bit
385             dnl and run under emulation. Consequently, uname reports i386 even on 64-bit systems.
386             dnl Here we attempt to detect Windows home platform by asking gcc about its target.
387             dnl 64-bit gcc will output "x86_64-w64-mingw32" here.
389             AC_MSG_CHECKING([for Windows native gcc target])
390             host_cpu=`gcc -dumpmachine`
391             AC_MSG_RESULT($host_cpu)
392             ;;
394         esac
396         case "$host_cpu" in
397         *i?86*)
398             aros_host_cpu="i386"
399             ;;
401         mingw32*)
402             dnl Native i386 gcc for MinGW32 reports 'mingw32' with -dumpmachine switch
403             aros_host_cpu="i386"
404             ;;
406         *x86_64*)
407             aros_host_cpu="x86_64"
408             dnl Dragon's x86_64-w64-mingw32-gcc is a bit broken. It ignores standard $prefix/include
409             dnl directory, so we have to add it explicitly here.
410             aros_host_cflags="$aros_host_cflags -isystem /mingw/include"
411             ;;
413         *)
414             AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
415             aros_host_cpu="$host_cpu"
416             ;;
417         esac
418         ;;
419     *)
420         AC_MSG_ERROR([Unsupported host architecture $host])
421         ;;
422 esac
424 AROS_PROG(aros_host_ar,[ar],[cr])
425 AROS_REQUIRED(ar,$aros_host_ar)
426 AROS_PROG(aros_host_ranlib,ranlib)
427 AROS_REQUIRED(ranlib,$aros_host_ranlib)
428 AROS_PROG(aros_host_strip,strip)
429 AROS_REQUIRED(strip,$aros_host_strip)
431 AROS_PROG(RM,[rm],[-rf])
432 AROS_REQUIRED(rm,$RM)
433 AROS_PROG(CP,[cp])
434 AROS_REQUIRED(cp,$CP)
435 AROS_PROG(MV,[mv])
436 AROS_REQUIRED(mv,$MV)
437 AROS_PROG(ECHO,[echo])
438 AROS_REQUIRED(echo,$ECHO)
439 AROS_PROG(MKDIR,[mkdir],[-p])
440 AROS_REQUIRED(mkdir,$MKDIR)
441 AROS_PROG(TOUCH,[touch])
442 AROS_REQUIRED(touch,$TOUCH)
443 AROS_PROG(SORT,[sort])
444 AROS_REQUIRED(sort,$SORT)
445 AROS_PROG(UNIQ,[uniq])
446 AROS_REQUIRED(uniq,$UNIQ)
447 AROS_PROG(NOP,[true])
448 AROS_REQUIRED(true,$NOP)
449 AROS_PROG(CAT,[cat])
450 AROS_REQUIRED(cat,$CAT)
451 AROS_PROG(BISON,[bison])
452 AROS_REQUIRED(bison,$BISON)
453 AROS_PROG(FLEX,[flex])
454 AROS_REQUIRED(flex,$FLEX)
455 AROS_PROG(PNGTOPNM,[pngtopnm])
456 AROS_REQUIRED(pngtopnm,$PNGTOPNM)
457 AROS_PROG(PPMTOILBM,[ppmtoilbm])
458 AROS_REQUIRED(ppmtoilbm,$PPMTOILBM)
459 AROS_PROG(SED,[sed])
460 AROS_REQUIRED(sed,$SED)
461 AROS_PROG(CHMOD,[chmod])
462 AROS_REQUIRED(chmod,$CHMOD)
463 AROS_PROG(PATCH,[patch])
464 AROS_REQUIRED(patch,$PATCH)
466 AM_PATH_PYTHON(2.5)
468 AC_CHECK_LIB(png, png_read_png)
469 AROS_REQUIRED(libpng, $ac_cv_lib_png_png_read_png)
471 AC_SUBST(FOR, for)
472 AC_SUBST(IF, if)
473 AC_SUBST(TEST, test)
474 AC_SUBST(CMP, cmp)
476 dnl ---------------------------------------------------------------------------
477 dnl Look for things about the host system, good for hosted targets.
478 dnl ---------------------------------------------------------------------------
480 # Check for some includes for the X11 HIDD and the kernel
481 AC_CHECK_HEADERS([sys/ipc.h sys/shm.h \
482     sys/mmap.h sys/mman.h sysexits.h \
483     sys/statfs.h sys/statvfs.h sys/vfs.h sys/param.h \
486 AC_CHECK_HEADERS([sys/mount.h],,,[#include <sys/param.h>])
488 AC_HEADER_DIRENT
489 AC_HEADER_STAT
490 AC_HEADER_STDC
491 AC_HEADER_SYS_WAIT
492 AC_HEADER_TIME
493 AC_STRUCT_ST_BLKSIZE
494 AC_STRUCT_ST_BLOCKS
495 AC_STRUCT_ST_RDEV
496 AC_STRUCT_TM
497 AC_STRUCT_TIMEZONE
498 AC_TYPE_OFF_T
499 AC_TYPE_PID_T
500 AC_TYPE_SIZE_T
501 AC_TYPE_UID_T
503 AC_CHECK_MEMBERS(struct tm.tm_gmtoff)
505 # Look for some functions
506 AC_CHECK_FUNCS([getpagesize kqueue statfs statvfs \
507     clone kse_create rfork_thread thr_create sa_register \
508     getcontext makecontext setcontext sigaltstack swapcontext])
510 AC_FUNC_MMAP
513 dnl --------------------------------------------------------------------
514 dnl Target Configuration Section
515 dnl --------------------------------------------------------------------
517 dnl The target configuration section is responsible for setting up all
518 dnl the paths for includes, and tools required to build AROS to some
519 dnl particular target.
521 aros_config_cflags="-Wall -Werror-implicit-function-declaration"
522 aros_config_aflags="-Wall -x assembler-with-cpp -c"
523 aros_config_ldflags=""
525 aros_shared_default=yes
527 aros_shared_cflags="-fPIC"
528 aros_shared_aflags=""
529 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
530 aros_kernel_ldflags="-Wl,-rpath,./lib"
532 aros_kernel_ar_flags="cr"
533 aros_target_ar_flags="cr"
534 aros_target_nm_flags="-C -ul"
535 aros_target_strip_flags="--strip-unneeded -R.comment"
537 aros_compiler_libs=
538 aros_arch_libs=
540 aros_target_genmap="-Wl,-Map -Xlinker"
542 # Native flavour stuff
543 aros_serial_debug="0"
545 # Palm native flavour stuff
546 aros_palm_debug_hack="0"
548 # Unix flavour stuff
549 aros_nesting_supervisor="0"
551 # Collect-aros stuff: "-ius" to ignore undefined symbols
552 ignore_undefined_symbols=""
554 # Check for X11 by default
555 need_x11="auto"
557 #-----------------------------------------------------------------------------
560 # GCC 4.1+ has a stack protection feature that requires OS support. Ubuntu has
561 # it switched on by default, and we use the host compiler, so it compiles AROS
562 # code with this enabled resulting in link failures as we don't have support
563 # for it.
565 # We use two methods to disable it. For the host compiler (used to compile
566 # some hosted modules), we test to see if the compiler supports stack
567 # protection, and if it does we disable it in AROS_CONFIG_CFLAGS. This should
568 # work on all platforms.
570 # For the "cross" compiler we clear the "ssp_default" spec in config/specs.in
571 # (this is done unconditionally, as it should have no effect on compilers
572 # without the stack protection feature). This may be specific to the way that
573 # Ubuntu enables the feature, so may not work everywhere. My specs-fu isn't
574 # strong enough to disable it in a generic way though, so we'll live with it
575 # until another vendor ships GCC with it enabled in a different way, and deal
576 # with it then.
579 AC_MSG_CHECKING([whether ${CC} accepts -fno-stack-protector])
580 save_cflags="$CFLAGS"
581 CFLAGS="$CFLAGS -fno-stack-protector"
582 AC_TRY_COMPILE(,, use_no_stack_protector="yes", use_no_stack_protector="no")
583 AC_MSG_RESULT($use_no_stack_protector)
584 if test "x-$use_no_stack_protector" = "x-yes" ; then
585     aros_host_cflags="$aros_host_cflags -fno-stack-protector"
587 CFLAGS="$save_cflags"
589 #-----------------------------------------------------------------------------
591 # Disable pointer-signedness warnings if the compiler recognises the option
592 # (this only works for the host compiler at the moment)
594 AC_MSG_CHECKING([whether ${CC} accepts -Wno-pointer-sign])
595 save_cflags="$CFLAGS"
596 CFLAGS="$CFLAGS -Wno-pointer-sign"
597 AC_TRY_COMPILE(,, use_no_sign_warning="yes", use_no_sign_warning="no")
598 AC_MSG_RESULT($use_no_sign_warning)
599 if test "x-$use_no_sign_warning" = "x-yes" ; then
600     aros_host_cflags="$aros_host_cflags -Wno-pointer-sign"
602 CFLAGS="$save_cflags"
604 #-----------------------------------------------------------------------------
606 # Check if host compiler supports -fgnu89-inline, can be needed for crosstools.
608 AC_MSG_CHECKING([whether ${CC} accepts -fgnu89-inline])
609 save_cflags="$CFLAGS"
610 CFLAGS="$CFLAGS -fgnu89-inline"
611 AC_TRY_COMPILE(,, use_gnu89_inline="yes", use_gnu89_inline="no")
612 AC_MSG_RESULT($use_gnu89_inline)
613 if test "x-$use_gnu89_inline" = "x-yes" ; then
614     gnu89_inline="-fgnu89-inline"
616 CFLAGS="$save_cflags"
618 #-----------------------------------------------------------------------------
620 AC_MSG_CHECKING([for type of build])
621 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")
623 if test "$build_type" = "nightly"; then
624     build_type_string="NIGHTLY"
625 elif test "$build_type" = "snapshot"; then
626     build_type_string="SNAPSHOT"
627 elif test "$build_type" = "milestone"; then
628     build_type_string="MILESTONE"
629 elif test "$build_type" = "release"; then
630     build_type_string="RELEASE"
631 else
632     build_type_string="PERSONAL"
633     build_type="personal"
636 aros_config_cflags="$aros_config_cflags -DAROS_BUILD_TYPE=AROS_BUILD_TYPE_$build_type_string"
638 AC_MSG_RESULT($build_type)
640 #-----------------------------------------------------------------------------
641 all_debug_types="messages stack modules mungwall symbols"
643 AC_MSG_CHECKING([which debug types to enable])
644 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)]),
645  debug="$enableval",debug="")
647 if test "$debug" = "" -o "$debug" = "no"; then
648     debug="none"
649 elif test "$debug" = "yes"; then
650     debug="all"
653 if test "$debug" = "all" ; then
654     debug="messages stack modules symbols"
655     for d in $all_debug_types; do
656         export aros_${d}_debug="1"
657     done
658 else
659     for d in $all_debug_types; do
660         export aros_${d}_debug="0"
661     done
664 if test "$debug" != "none"; then
665     debug=`echo $debug | sed s/,/\ /g`
666     for d in $debug; do
667         found="0"
668         for d2 in $all_debug_types; do
669             if test "$d2" = "$d"; then
670                 found="1"
671                 break
672             fi
673         done
674         if test "$found" = "0"; then
675             AC_MSG_ERROR([unrecognized debug type "$d". Available types are: all none $all_debug_types])
676         fi
677         export aros_${d}_debug="1"
678     done
679     aros_debug="yes"
681 AC_MSG_RESULT($debug)
683 if test "$aros_messages_debug" = "1"; then
684     aros_messages_debug="-DADEBUG=1 -DMDEBUG=1"
685 else
686     aros_messages_debug=""
688 if test "$aros_symbols_debug" = "1"; then
689     aros_symbols_debug="-g"
690 else
691     aros_symbols_debug=""
694 # These are the flags to pass when compiling debugged programs
695 aros_debug_cflags="$aros_symbols_debug $aros_messages_debug"
696 aros_debug_aflags=""
697 aros_debug_ldflags="$aros_symbols_debug"
699 #-----------------------------------------------------------------------------
700 #   Checking for distcc and ccache.
702 #   Always apply the transforms in this particular order. Basically you should
703 #   always run 'ccache distcc compiler' in that order for the best performance.
705 AC_MSG_CHECKING([whether to enable distcc])
706 AC_ARG_ENABLE(distcc,AC_HELP_STRING([--enable-distcc],[Use distcc as a front end to the compiler (default=no).]),distcc="$enableval",distcc="no")
707 if test "$distcc" != "" -a "$distcc" != "no"; then
708     # AC_CHECK_PROG will print out the result in this case
709     AC_PATH_PROG(DISTCC,[distcc],distcc,)
710 else
711     AC_MSG_RESULT(no)
714 AC_MSG_CHECKING([whether to enable ccache])
715 AC_ARG_ENABLE(ccache,AC_HELP_STRING([--enable-ccache],[Use ccache as a front end to the compiler (default=no).]),ccache="$enableval",ccache="no")
716 if test "$ccache" != "" -a "$ccache" != "no"; then
717     # AC_CHECK_PROG will print out the result in this case
718     AC_CHECK_PROG(CCACHE,[ccache],ccache,)
719 else
720     AC_MSG_RESULT(no)
723 #-----------------------------------------------------------------------------
724 AC_MSG_CHECKING([what specific host gcc version to use])
725 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="")
726 AC_MSG_RESULT($kernel_tool_version)
728 #-----------------------------------------------------------------------------
729 AC_MSG_CHECKING([what optimization flags to use])
730 AC_ARG_WITH(optimization,AC_HELP_STRING([--with-optimization=FLAGS],[Use optimization flags FLAGS (default=-O2).]),optimization="$withval",optimization="unknown")
731 if test "$optimization" = "unknown"; then
732     dnl default is -O2 for normal builds, -O0 for debug builds
733     if test "$debug" != "none"; then
734         optimization="-O0"
735     else
736         optimization="-O2"
737     fi
739 aros_optimization_cflags="$optimization"
740 AC_MSG_RESULT($optimization)
742 #-----------------------------------------------------------------------------
743 AC_MSG_CHECKING([what paranoia flags to use])
744 AC_ARG_WITH(paranoia,AC_HELP_STRING([--with-paranoia=FLAGS],[CC flags to enable paranoia]),[paranoia_flags="$withval"],[paranoia_flags="default"])
745 if test "$paranoia_flags" = "default"; then
746         paranoia_flags=""
747 else if test "$paranoia_flags" = "yes"; then
748         paranoia_flags="-Wall -Werror"
749 fi fi
750 AC_MSG_RESULT($paranoia_flags)
751 aros_config_cflags="$aros_config_cflags $paranoia_flags"
753 #-----------------------------------------------------------------------------
754 AC_MSG_CHECKING([what target variant to enable])
755 AC_ARG_ENABLE(target_variant,AC_HELP_STRING([--enable-target-variant=NAME],[Enable a specific target variant(default=none)]),target_variant=$enableval,target_variant="")
756 if test "$target_variant" = ""; then
757     aros_target_variant=""
758     aros_target_suffix=""
759     enableval="none"
760 else
761     aros_target_variant="$target_variant"
762     aros_target_suffix="-$target_variant"
764 AC_MSG_RESULT($enableval)
766 #-----------------------------------------------------------------------------
767 # Target-specific defaults. You can override then on a per-target basis.
769 # Bootloader name. Currently used by PC target.
770 target_bootloader="none"
772 #-----------------------------------------------------------------------------
773 # Additional options for some specific targets
775 case "$aros_target_variant" in
776 ios)
777     AC_MSG_CHECKING([XCode path])
778     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")
779     AC_MSG_RESULT($aros_xcode_path)
781     AC_MSG_CHECKING([what iOS SDK version to use])
782     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")
783     AC_MSG_RESULT($aros_sdk_version)
785     ;;
787 "android")
788     AC_MSG_CHECKING([Android SDK path])
789     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)
790     AC_MSG_RESULT($aros_android_sdk)
792     AC_MSG_CHECKING([Android NDK path])
793     AC_ARG_WITH(ndk,AC_HELP_STRING([--with-ndk=PATH],[Specify Android NDK path (default=none).]),aros_android_ndk="$withval",aros_android_ndk="none")
794     AC_MSG_RESULT($aros_android_ndk)
796     AC_MSG_CHECKING([what Android SDK version to use])
797     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")
798     AC_MSG_RESULT($aros_sdk_version)
800     if test "$aros_android_ndk" != "none"; then
801         AC_MSG_CHECKING([what Android NDK version to use])
802         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")
803         AC_MSG_RESULT($aros_ndk_version)
804     fi
806     export PATH="$aros_android_sdk/tools:$PATH"
807     AC_PATH_PROG(android_tool, $android_tool)
808     AROS_REQUIRED(android,$android_tool)
810     aros_android_level=android-$aros_sdk_version
811     if test ! -d $aros_android_sdk/platforms/$aros_android_level; then
812         echo "Platform $aros_android_level is not installed in your SDK"
813         echo "Use --with-sdk-version=<API level number> to select another platform version"
814         echo "You can check what plaform versions are installed in your SDK"
815         echo "by examining contents of $aros_android_sdk/platforms directory"
816         AC_MSG_ERROR([Android platform $aros_android_level is not installed])
817     fi
819     AC_PATH_PROG(ant, ant)
820     if test "$ant" = ""; then
821         AC_MSG_WARN([Apache Ant is missing, Java bootstrap can't be built automatically])
822     fi
824     AC_MSG_CHECKING([Build debug or release apk])
825     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)
826     if test $aros_android_antapk != release -a $aros_android_antapk != debug; then
827         AC_MSG_ERROR([apk-version has to be release or debug])
828     fi
829     AC_MSG_RESULT($aros_android_antapk)
831     dnl MSYS bash can't run .bat files directly, then need to be started via cmd.exe
832     if test "$host_os" = "mingw32"; then
833         android_tool="cmd //c $android_tool"
834     fi
836     ;;
837 esac
839 #-----------------------------------------------------------------------------
840 # External toolchains
841 kernel_tool_prefix="none"
842 aros_tool_prefix="none"
843 elf_tool_prefix="${target_cpu}-elf-"
845 # This is the target configuration switch.
846 case "$target_os" in
847     linux*)
848         aros_target_arch="linux"
849         aros_target_family="unix"
850         case "$target_cpu" in
851             *m68k*)
852                 aros_target_cpu="m68k"
853                 aros_object_format="m68kelf"
854                 aros_flavour="emulcompat"
855                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D__mc68000 -D__linux__"
856                 aros_shared_ldflags="-Wl,-T,\$(TOP)/config/linux/m68k/script.so"
857                 aros_kernel_ldflags="-Wl,-rpath,./lib,-T,\$(TOP)/config/linux/m68k/script.normal"
858                 gcc_target_cpu="mc68000"
859                 ;;
860             *i?86*)
861                 aros_target_cpu="i386"
862                 aros_object_format="elf_i386"
863                 aros_flavour="emulation"
864                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__linux__"
865                 aros_kernel_ldflags="-Wl,-melf_i386"
866                 aros_default_wbdepth=8
867                 gcc_target_cpu="i386"
868                 pci_hidd_target="hidd-pci-linux"
869                 android_tool_dir_prefix="x86"
870                 android_tool_prefix="i686-android-linux"
871                 android_ndk_arch="x86"
872                 ;;
873             *x86_64*)
874                 aros_target_cpu="x86_64"
875                 aros_object_format="elf_x86_64"
876                 aros_flavour="emulation"
877                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64 -D__linux__"
878                 aros_config_cflags="$aros_config_cflags -mno-red-zone -fno-omit-frame-pointer"
879                 aros_default_wbdepth=8
880                 pci_hidd_target="hidd-pci-linux"
881                 ;;
882             *powerpc*)
883                 aros_target_cpu="ppc"
884                 aros_object_format="elf32ppc"
885                 aros_flavour="emulation"
886                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc -D__linux__"
887                 aros_default_wbdepth=8
888                 gcc_target_cpu="ppc"
889                 ;;
890 # TODO
891 # Same as powerpc, but I need this for the nightly build to work again.
892 # Actually, the nightly should be made working with powerpc target.
893 # That just was too much work for the moment, another week or two.
894             *ppc*)
895                 aros_target_cpu="ppc"
896                 aros_object_format="elf32ppc"
897                 aros_flavour="emulation"
898                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc -D__linux__"
899                 aros_default_wbdepth=8
900                 gcc_target_cpu="ppc"
901                 ;;
902             *armhf*)
903                 aros_target_cpu="arm"
904                 target_cpu="arm"
905                 aros_object_format="armelf_aros"
906                 aros_flavour="emulation"
907                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm -D__linux__"
908                 gcc_target_cpu="arm"
909                 aros_config_cflags="$aros_config_cflags -fno-strict-aliasing -fno-omit-frame-pointer"
910                 aros_config_aflags="$aros_config_aflags -fno-strict-aliasing"
911                 aros_arch_libs="-laeabi"
912                 gcc_default_float_abi="hard"
913                 android_tool_dir_prefix="arm-linux-androideabi"
914                 android_tool_prefix="arm-linux-androideabi"
915                 android_ndk_arch="arm"
916                 kernel_tool_prefix="arm-linux-gnueabihf-"
917                 ;;
918             *arm*)
919                 aros_target_cpu="arm"
920                 aros_object_format="armelf_aros"
921                 aros_flavour="emulation"
922                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm -D__linux__"
923                 gcc_target_cpu="arm"
924                 aros_config_cflags="$aros_config_cflags -fno-strict-aliasing -fno-omit-frame-pointer"
925                 aros_config_aflags="$aros_config_aflags -fno-strict-aliasing"
926                 aros_arch_libs="-laeabi"
927                 android_tool_dir_prefix="arm-linux-androideabi"
928                 android_tool_prefix="arm-linux-androideabi"
929                 android_ndk_arch="arm"
930                 kernel_tool_prefix="arm-linux-gnueabi-"
931                 ;;
932             *)
933                 AC_MSG_ERROR("Unknown CPU for Linux -- $target_cpu")
934                 ;;
935         esac
936         case "$aros_target_variant" in
937             android)
939                 dnl Not all Linux CPUs are supported by Android
940                 if test "$android_ndk_arch" = ""; then
941                     AC_MSG_ERROR("Unsupported CPU for Android -- $target_cpu")
942                 fi
944                 aros_default_wbwidth=320
945                 aros_default_wbheight=480
946                 if test "$aros_android_ndk" = "none"; then
947                     dnl Use standalone toolchain, don't adjust paths
948                     aros_kernel_cflags="-mandroid"
949                     aros_kernel_ldflags="-mandroid"
950                     CFLAGS="-mandroid"
951                 else
952                     dnl In Android NDK toolchains are placed in own directories,
953                     dnl but tool names are not suffixed with version 
954                     export PATH="$aros_android_ndk/toolchains/$android_tool_dir_prefix-$kernel_tool_version/prebuilt/$android_build_os/bin:$PATH"
955                     kernel_tool_version=""
956                     aros_android_ndk="$aros_android_ndk/platforms/android-$aros_ndk_version/arch-$android_ndk_arch"
957                     aros_kernel_cflags="--sysroot $aros_android_ndk -mandroid"
958                     aros_kernel_ldflags="--sysroot $aros_android_ndk -mandroid"
959                     CFLAGS="$CFLAGS --sysroot $aros_android_ndk -mandroid"
960                     aros_kernel_includes="-isystem $aros_android_ndk/usr/include"
961                 fi
962                 need_x11=no
963                 unixgfx_hidd_target=kernel-hidd-androidgfx
964                 # Disable implicit PIC mode
965                 aros_target_cflags="$aros_target_cflags -fno-pic"
966                 kernel_tool_prefix="$android_tool_prefix-"
967             ;;
968         esac
969     ;;
971     pc)
972         aros_target_arch="pc"
973         aros_shared_default="no"
974         target_bootloader="grub2"
975         case "$target_cpu" in
976             *i?86*)
977                 aros_target_cpu="i386"
979                 dnl If somebody hasn't already set the target object
980                 dnl format, then use this value. Mostly to support
981                 dnl FreeBSD cross-compilation.
982                 dnl TODO: Remove when we always use our compiler.
984                 if test "$aros_object_format" = "" ; then
985                     aros_object_format="elf_i386"
986                 fi
987                 aros_flavour="standalone"
988                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
989                 aros_kernel_ldflags="-Wl,-melf_i386"
990                 aros_default_wbwidth=640
991                 aros_default_wbheight=480
992                 gcc_target_cpu="i386"
993                 ;;
994             *x86_64*)
995                 aros_target_cpu="x86_64"
996                 aros_serial_debug=1
997                 if test "$aros_object_format" = "" ; then
998                     aros_object_format="elf_x86_64"
999                 fi
1000                 aros_flavour="standalone"
1001                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
1002                 aros_config_cflags="$aros_config_cflags -fno-asynchronous-unwind-tables -mno-red-zone -fno-omit-frame-pointer"
1003                 aros_kernel_ldflags=""
1004                 aros_default_wbwidth=640
1005                 aros_default_wbheight=480
1006                 ;;
1007             *)
1008                 AC_MSG_ERROR("Unknown native CPU -- $target_cpu")
1009                 ;;
1010         esac
1011         ;;
1013     prep)
1014         aros_target_arch="prep"
1015         aros_shared_default="no"
1016         aros_target_cpu="ppc"
1017         aros_object_format="elf32ppc"
1018         aros_flavour="ppcnative"
1019         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1020         aros_kernel_ldflags=""
1021         aros_default_wbwidth=640
1022         aros_default_wbheight=480
1023         gcc_target_cpu="ppc"
1024         ;;
1026     freebsd*)
1027         aros_target_arch="freebsd"
1028         aros_target_family="unix"
1029         aros_target_cpu="i386"
1030         aros_flavour="emulation"
1031         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1032         gcc_target_cpu="i386"
1034         aros_target_strip_flags="-x"
1035         ;;
1037     darwin*)
1038         aros_target_arch="darwin"
1039         aros_target_family="unix"
1040         aros_flavour="emulation"
1041         case "$target_cpu" in
1042             *i?86*)
1043                 aros_ios_platform="iPhoneSimulator"
1044                 aros_target_cpu="i386"
1045                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1046                 aros_kernel_ldflags=""
1047                 aros_macosx_version="10.4"
1048                 aros_default_wbdepth=8
1049                 gcc_target_cpu="i386"
1050                 aros_object_format="elf_i386"
1051                 aros_kernel_ar_flags="-cr"
1052                 aros_target_strip_flags="-x"
1053                 kernel_tool_flags="-m32"
1054                 ;;
1055             *x86_64*)
1056                 aros_target_cpu="x86_64"
1057                 aros_object_format="elf_x86_64"
1058                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
1059                 aros_macosx_version="10.6"
1060                 aros_config_cflags="$aros_config_cflags -fno-omit-frame-pointer"
1061                 aros_kernel_cflags="-m64"
1062                 aros_kernel_ldflags="-m64"
1063                 aros_target_cflags="-mcmodel=large"
1064                 aros_default_wbdepth=8
1065                 aros_kernel_ar="ar"
1066                 aros_kernel_ar_flags="-cr"
1067                 aros_kernel_ld="ld"
1068                 aros_kernel_as="as"
1069                 aros_kernel_ranlib="ranlib"
1070                 aros_kernel_nm="nm"
1071                 aros_kernel_strip="strip"
1072                 kernel_tool_prefix="i686-apple-darwin10-"
1073                 ;;
1074             *ppc*)
1075                 aros_target_cpu="ppc"
1076                 aros_object_format="elf32ppc"
1077                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1078                 aros_kernel_ldflags=""
1079                 aros_macosx_version="10.0"
1080                 aros_default_wbdepth=8
1081                 gcc_target_cpu="ppc"
1082                 aros_kernel_ar="ar"
1083                 aros_kernel_ar_flags="-cr"
1084                 aros_kernel_ld="ld -arch ppc"
1085                 aros_kernel_as="as -arch ppc"
1086                 aros_kernel_ranlib="ranlib -arch ppc"
1087                 aros_kernel_nm="nm -arch ppc"
1088                 aros_kernel_strip="strip -arch ppc"
1089                 kernel_tool_prefix="powerpc-apple-darwin10-"
1090                 ;;
1091             *arm*)
1092                 aros_ios_platform="iPhoneOS"
1093                 aros_target_cpu="arm"
1094                 aros_object_format="armelf_aros"
1095                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
1096                 aros_arch_libs="-laeabi"
1097                 aros_default_wbdepth=8
1098                 gcc_target_cpu="arm"
1099                 aros_kernel_ar="ar"
1100                 aros_kernel_ar_flags="-cr"
1101                 aros_kernel_ld="ld -arch arm"
1102                 aros_kernel_ranlib="ranlib -arch arm"
1103                 kernel_tool_prefix="arm-apple-darwin10-" 
1104                 export PATH="$aros_xcode_path/Platforms/$aros_ios_platform.platform/Developer/usr/bin:$PATH"
1105                 ;;
1106             *)
1107                 AC_MSG_ERROR("Unsupported target CPU for darwin hosted flavour -- $target_cpu")
1108                 ;;
1109         esac
1110         case "$aros_target_variant" in
1111             ios)
1112                 aros_ios_version="3.0"
1113                 aros_default_wbwidth=320
1114                 aros_default_wbheight=480
1115                 aros_ios_sdk="$aros_xcode_path/Platforms/$aros_ios_platform.platform/Developer/SDKs/$aros_ios_platform$aros_sdk_version.sdk"
1116                 kernel_tool_flags="$target_tool_flags -isysroot $aros_ios_sdk"
1117                 aros_kernel_includes="-isystem $aros_ios_sdk/usr/include"
1118                 need_x11=no
1119                 # This is here because it may depend on iOS or SDK version
1120                 aros_kernel_cflags="$aros_kernel_cflags -miphoneos-version-min=$aros_ios_version"
1121                 aros_kernel_ldflags="$aros_kernel_ldflags -miphoneos-version-min=$aros_ios_version"
1122                 aros_kernel_objcflags="-fobjc-abi-version=2 -fobjc-legacy-dispatch"
1123             ;;
1124             *)
1125                 aros_kernel_cflags="$aros_kernel_cflags -mmacosx-version-min=$aros_macosx_version"
1126                 aros_kernel_ldflags="$aros_kernel_ldflags -mmacosx-version-min=$aros_macosx_version"
1127             ;;
1128         esac
1129         ;;
1131     dragonfly*)
1132         aros_target_arch="dragonfly"
1133         aros_target_family="unix"
1134         aros_flavour="emulation"
1135         case "$target_cpu" in
1136             *i?86*)
1137                 aros_target_cpu="i386"
1138                 aros_object_format="elf_i386"
1139                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__DragonFly__"
1140                 ;;
1141             *x86_64*)
1142                 aros_config_cflags="$aros_config_cflags -fno-omit-frame-pointer"
1143                 aros_target_cpu="x86_64"
1144                 aros_object_format="elf_x86_64"
1145                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64 -D__DragonFly__"
1146                 ;;
1147             *)
1148                 AC_MSG_ERROR("Unknown CPU for DragonFly -- $target_cpu")
1149                 ;;
1150         esac
1151         ;;
1153     netbsd*)
1154         aros_target_arch="netbsd"
1155         aros_target_family="unix"
1156         case "$target_cpu" in
1157             *m68k*)
1158                 aros_target_cpu="m68k"
1159                 aros_object_format="m68kelf"
1160                 aros_flavour="emulcompat"
1161                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D__mc68000 -D__NetBSD__"
1162                 gcc_target_cpu="mc68000"
1163                 ;;
1164             *i?86*)
1165                 aros_target_cpu="i386"
1166                 aros_object_format="elf_i386"
1167                 aros_flavour="emulation"
1168                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__NetBSD__"
1169                 aros_default_wbdepth=8
1170                 gcc_target_cpu="i386"
1171                 ;;
1172             *)
1173                 AC_MSG_ERROR("Unknown CPU for NetBSD -- $target_cpu")
1174                 ;;
1175         esac
1176         aros_target_genmap="-Wl,-M -Xlinker >"
1177         aros_flavour="emulation"
1178         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1179         ;;   
1181     openbsd*)
1182         aros_target_arch="openbsd"
1183         aros_target_family="unix"
1184         case "$target_cpu" in
1185             *i?86*)
1186                 aros_target_cpu="i386"
1187                 aros_object_format="elf_i386"
1188                 aros_flavour="emulation"
1189                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__OpenBSD__"
1190                 gcc_target_cpu="i386"
1191                 ;;
1192             *)
1193                 AC_MSG_ERROR("Unknown CPU for OpenBSD -- $target_cpu")
1194                 ;;
1195         esac
1196         aros_target_genmap="-Wl,-M -Xlinker >"
1197         aros_target_nm_flags="-u"
1198         aros_flavour="emulation"
1199         ;;
1201     solaris*)
1202         aros_target_arch="solaris"
1203         aros_target_family="unix"
1204         case "$target_cpu" in
1205            *i?86*)
1206                aros_target_cpu="i386"
1207                aros_object_format="elf_i386"
1208                aros_flavour="emulation"
1209                aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__Solaris__"
1210                aros_default_wbdepth=8
1211                gcc_target_cpu="i386"
1212                ;;
1213             *sparc*)
1214                 aros_target_cpu="sparc"
1215                 aros_object_format="elf_sparc"
1216                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dsparc -D__Solaris__"
1217                 gcc_target_cpu="sparc"
1218                 ;;
1219             *)
1220                 AC_MSG_ERROR("Unknown CPU for Solaris -- $target_cpu")
1221                 ;;
1222         esac
1223         aros_config_cflags="$aros_config_cflags -D$aros_target_cpu"
1224         aros_flavour="emulation"
1225         ;;
1227     morphos*)
1228         aros_target_arch="morphos"
1229         aros_shared_default="no"
1230         aros_target_cpu="ppc"
1231         aros_object_format="elf_ppc"
1232         aros_flavour="nativecompat"
1233         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1234         gcc_target_cpu="ppc"
1235         ;;
1237     sam440)
1238         aros_target_arch="sam440"
1239         aros_shared_default="no"
1240         aros_target_cpu="ppc"
1241         aros_object_format="elf32ppc"
1242         aros_flavour="ppcnative"
1243         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1244         aros_kernel_ldflags=""
1245         aros_default_wbwidth=1024
1246         aros_default_wbheight=768
1247         aros_default_wbdepth=24
1248         aros_config_cflags="$aros_config_cflags -mcpu=440fp -mno-toc -fno-asynchronous-unwind-tables"
1249         gcc_target_cpu="powerpc"
1250         ;;
1252     efika)
1253         aros_target_arch="efika"
1254         aros_shared_default="no"
1255         aros_target_cpu="arm"
1256         aros_object_format="armelf_aros"
1257         aros_flavour="standalone"
1258         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
1259         aros_kernel_ldflags=""
1260         aros_default_wbwidth=1024
1261         aros_default_wbheight=600
1262         aros_arch_libs="-laeabi"
1263         gcc_default_cpu="armv7-a"
1264         gcc_default_fpu="vfpv3"
1265         aros_config_cflags="$aros_config_cflags -mtune=cortex-a8 -fno-strict-aliasing -fno-asynchronous-unwind-tables -Os"
1266         aros_config_aflags="$aros_config_aflags -mtune=cortex-a8 -fno-strict-aliasing -fno-asynchronous-unwind-tables -Os"
1267         case "$target_cpu" in
1268             *armhf*)
1269                 gcc_default_float_abi="hard"
1270                 target_cpu=arm
1271                 aros_target_cpu=arm
1272                 ;;
1273             *arm*)
1274                 gcc_default_float_abi="softfp"
1275                 ;;
1276             *)
1277                 AC_MSG_ERROR("Unknown CPU for EfikaMX $target_cpu")
1278                 ;;
1279         esac
1280         ;;
1281         
1282     chrp)
1283     aros_target_arch="chrp"
1284     aros_shared_default="no"
1285     aros_target_cpu="ppc"
1286     aros_object_format="elf32ppc"
1287     aros_flavour="ppcnative"
1288     aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1289     aros_kernel_ldflags=""
1290     aros_default_wbwidth=640
1291     aros_default_wbheight=480
1292     aros_config_cflags="$aros_config_cflags -mno-toc -fno-asynchronous-unwind-tables"    
1293     gcc_target_cpu="powerpc"
1294         case "$aros_target_variant" in
1295             efika)
1296             aros_config_cflags="$aros_config_cflags -DBIG_ENDIAN_OHCI=1 -mcpu=603e"
1297             ;;
1298         esac
1299     ;;
1301     r*pi)
1302         aros_flavour="standalone"
1303         aros_target_arch="raspi"
1304         aros_target_cpu="arm"
1305         aros_object_format="armelf_aros"
1306         aros_shared_default="no"
1307         aros_arch_libs="-laeabi"
1309         gcc_default_cpu="armv6"
1310         gcc_default_cpu_tune="arm1176jzf-s"
1311         case "$target_cpu" in
1312             *armhf*)
1313                 gcc_default_float_abi="hard"
1314                 ;;
1315             *arm*)
1316                 gcc_default_float_abi="softfp"
1317                 ;;
1318             *)
1319                 AC_MSG_ERROR("Unknown CPU for RasPi $target_cpu")
1320                 ;;
1321         esac
1323         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
1324         aros_config_cflags="$aros_config_cflags -marm -Wno-error -fno-asynchronous-unwind-tables -fno-exceptions"
1325         aros_config_aflags="$aros_config_aflags -marm -Wno-error -fno-asynchronous-unwind-tables -fno-exceptions"
1326         aros_kernel_cflags="$aros_kernel_cflags -marm -Wno-error -fno-asynchronous-unwind-tables -fno-exceptions"
1327         aros_target_cflags="$aros_kernel_cflags -marm -Wno-error -fno-asynchronous-unwind-tables -fno-exceptions"
1328         ;;
1330     sun4i)
1331         aros_flavour="standalone"
1332         aros_target_arch="sun4i"
1333         aros_target_cpu="arm"
1334         aros_object_format="armelf_aros"
1335         aros_shared_default="no"
1336         aros_arch_libs="-laeabi"
1338                 gcc_default_cpu="armv7-a"
1339         gcc_default_fpu="neon"
1340         gcc_default_cpu_tune="cortex-a8"
1341                 gcc_default_float_abi="hard"
1343                 if test "$target_variant" = ""; then
1344                         AC_MSG_ERROR("Please provide the target platform for sun4i with--enable-target-variant={platform}")
1345                 fi
1347         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
1348         aros_config_cflags="$aros_config_cflags -marm -Wno-error -fno-asynchronous-unwind-tables -fno-exceptions"
1349         aros_config_aflags="$aros_config_aflags -marm -Wno-error -fno-asynchronous-unwind-tables -fno-exceptions"
1350         aros_kernel_cflags="$aros_kernel_cflags -marm -Wno-error -fno-asynchronous-unwind-tables -fno-exceptions"
1351         aros_target_cflags="$aros_kernel_cflags -marm -Wno-error -fno-asynchronous-unwind-tables -fno-exceptions"
1352         ;;
1354     amiga*)
1355         aros_target_arch="amiga"
1356         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D_AMIGA -DAMIGA"
1357         aros_shared_default="no"
1359         case "$target_cpu" in
1360             *m68k*)
1361                 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")
1362                 aros_enable_mmu=no
1363                 aros_target_cpu="m68k"
1364                 aros_object_format="m68kelf"
1365                 aros_flavour="standcompat"
1366                 gcc_target_cpu="m68000"
1367                 aros_config_cflags="$aros_config_cflags -fno-strict-aliasing -ffreestanding -fomit-frame-pointer -fbuiltin -Wno-volatile-register-var -Os -DNOLIBINLINE"
1368                 aros_config_aflags="$aros_config_aflags"
1369                 aros_target_strip_flags="-R.comment --strip-debug"
1370                 aros_default_wbwidth=640
1371                 aros_default_wbheight=256
1372                 aros_default_wbdepth=2
1373                 ;;
1374             *ppc*)
1375                 aros_cpu="ppc"
1376                 aros_flavour="native"
1377                 gcc_target_cpu="ppc"
1378                 ;;
1379             *)
1380                 AC_MSG_ERROR("Unknown CPU for Amiga $target_cpu")
1381                 ;;
1382         esac
1383         ;;
1385     mingw*)
1386         aros_target_arch="mingw32"
1387         aros_shared_default="no"
1388         aros_flavour="emulation"
1389         aros_shared_cflags=""
1390         need_crosstools="yes"
1391         need_dlopen="no"
1392         rescomp="windres"
1393         case "$target_cpu" in
1394             *i?86*)
1395                 aros_target_cpu="i386"
1396                 aros_object_format="elf_i386"
1397                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1398                 aros_default_wbdepth=8
1399                 gcc_target_cpu="i386"
1401                 kernel_tool_prefix="i386-mingw32-"
1402                 ;;
1403             *x86_64*)
1404                 aros_target_cpu="x86_64"
1405                 aros_object_format="elf_x86_64"
1406                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
1407                 aros_config_cflags="$aros_config_cflags -fno-omit-frame-pointer"
1408                 aros_default_wbdepth=8
1409                 kernel_tool_prefix="x86_64-w64-mingw32-"
1410                 ;;
1411             *arm*)
1412                 aros_target_cpu="arm"
1413                 aros_object_format="armelf_aros"
1414                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
1415                 aros_arch_libs="-laeabi"
1416                 aros_default_wbdepth=8
1417                 gcc_target_cpu="arm"
1418                 gcc_default_float_abi="soft"
1419                 kernel_tool_prefix="arm-mingw32ce-"
1420                 aros_default_wbwidth=160
1421                 aros_default_wbheight=160
1422                 ;;
1423             *)
1424                 AC_MSG_ERROR("Unknown CPU for Mingw32 -- $target_cpu")
1425                 ;;
1426         esac
1427         if test $host_os = "cygwin"; then
1428                 aros_kernel_cflags="-mno-cygwin"
1429         fi
1430     ;;
1431     pp*)
1432         aros_target_arch="pp"
1433         aros_shared_default="no"
1434         case "$target_cpu" in
1435             *m68k*)
1436                 aros_target_cpu="m68k"
1437                 aros_object_format="m68kelf"
1438                 aros_flavour="palmnative"
1439                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
1440                 aros_default_wbwidth=160
1441                 aros_default_wbheight=160
1442                 aros_default_wbdepth=1
1443                 aros_target_ar_flags="cru"
1444                 aros_compiler_libs="-lgcc1"
1445                 aros_shared_default=no
1446                 aros_shared_cflags="-fpic"
1447                 aros_shared_aflags=""
1448                 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
1449                 aros_kernel_ldflags="-Wl,-rpath,./lib"
1450                 aros_debug_cflags="$aros_symbols_debug  $aros_messages_debug"
1451                 aros_debug_aflags=""
1452                 aros_debug_ldflags="$aros_symbols_debug"
1453                 aros_mungwall_debug="0"
1454                 aros_modules_debug="0"
1455                 gcc_target_cpu="mc68000"
1456                 ignore_undefined_symbols="-ius"
1457                 ;;
1458            *)
1459                 AC_MSG_ERROR("Unknown CPU for PalmPilot -- $target_cpu")
1460                 ;;
1461         esac
1462         ;;
1464     mac*)
1465         aros_target_arch="mac"
1466         aros_shared_default="no"
1467         case "$target_cpu" in
1468             *m68k*)
1469                 aros_target_cpu="m68k"
1470                 aros_object_format="m68kelf"
1471                 aros_flavour="mac68knative"
1472                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
1473                 aros_default_wbwidth=512
1474                 aros_default_wbheight=384
1475                 aros_default_wbdepth=8
1476                 aros_target_ar_flags="cru"
1477                 aros_compiler_libs="-lgcc1"
1478                 aros_shared_default=no
1479                 aros_shared_cflags="-fpic"
1480                 aros_shared_aflags=""
1481                 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
1482                 aros_kernel_ldflags="-Wl,-rpath,./lib"
1483                 aros_debug_cflags="$aros_symbols_debug $aros_messages_debug"
1484                 aros_debug_aflags=""
1485                 aros_debug_ldflags="$aros_symbols_debug"
1486                 aros_mungwall_debug="0"
1487                 aros_modules_debug="0"
1488                 gcc_target_cpu="mc68000"
1489                 ignore_undefined_symbols="-ius"
1490                 ;;
1491            *)
1492                 AC_MSG_ERROR("Unknown CPU for Mac68k -- $target_cpu")
1493                 ;;
1494         esac
1495         ;;
1497     *)
1498         AC_MSG_ERROR([Unsupported target architecture $target])
1499         ;;
1500 esac
1502 #-----------------------------------------------------------------------------
1503 crosstools_guess=yes
1505 AC_MSG_CHECKING([Kernel toolchain prefix])
1506 AC_ARG_WITH(kernel-toolchain-prefix,AC_HELP_STRING([--with-kernel-toolchain-prefix=...],[Specify crosscompile toolchain prefix for kernel objects]),[kernel_tool_prefix="$withval"])
1507 AC_MSG_RESULT($kernel_tool_prefix)
1509 AC_MSG_CHECKING([ELF toolchain prefix])
1510 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"
1511                                                  crosstools_guess=no])
1512 AC_MSG_RESULT($elf_tool_prefix)
1514 AC_MSG_CHECKING([AROS toolchain prefix])
1515 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"
1516                 crosstools_guess=no])
1517 if test "$aros_tool_prefix" = "yes" ; then
1518     aros_tool_prefix=$aros_target_cpu-aros-
1520 AC_MSG_RESULT($aros_tool_prefix)
1522 #-----------------------------------------------------------------------------
1523 #   Checking if we should build crosstools..
1524 AC_MSG_CHECKING([whether to build crosstools])
1525 AC_ARG_ENABLE(crosstools,AC_HELP_STRING([--disable-crosstools],[Do not build cross-compiler toolchain]),crosstools="$enableval",crosstools="$crosstools_guess")
1526 AC_MSG_RESULT($crosstools)
1528 if test "${crosstools}" = "yes"; then
1529     if test "${crosstools_guess}" = "no"; then
1530         AC_MSG_ERROR([Cannot build external toolchain if an external ELF or AROS toolchain is specified])
1531     fi
1534 AC_MSG_CHECKING([where to install the crosstools binaries])
1535 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])
1536 if test "x$aros_toolchain_install" = "x"; then
1537     AROS_CROSSTOOLSDIR="$AROS_BUILDDIR_UNIX/bin/$aros_host_arch-$aros_host_cpu/tools/crosstools"
1538 else
1539     AROS_CROSSTOOLSDIR="$aros_toolchain_install"
1540     PATH="$AROS_CROSSTOOLSDIR:$PATH"
1542 AC_MSG_RESULT($AROS_CROSSTOOLSDIR)
1544 # Helper to identify gcc version
1545 AC_DEFUN([CROSS_GCC_VERSION], [
1546   target_gcc_version=""
1547   AC_CACHE_CHECK([gcc version],[ax_cv_gcc_version],[
1548     ax_cv_gcc_version="`$AROS_CROSSTOOLSDIR/${aros_tool_prefix}cpp -dumpversion`"
1549     AS_IF([test "x$ax_cv_gcc_version" = "x"],[
1550       ax_cv_gcc_version=""
1551     ])
1552   ])
1553   target_gcc_version=$ax_cv_gcc_version
1554   AC_SUBST([target_gcc_version])
1557 #-----------------------------------------------------------------------------
1558 AC_MSG_CHECKING([what specific target gcc version to use])
1559 AC_ARG_WITH(gcc-version,AC_HELP_STRING([--with-gcc-version=VERSION],[Use gcc-VERSION for building AROS]),use_gcc_version="$withval",use_gcc_version="")
1560 if test "$use_gcc_version" = ""; then
1561     if test "${crosstools}" = "no"; then
1562       if test "x$aros_toolchain_install" != "x"; then
1563           CROSS_GCC_VERSION
1564       fi
1565     fi
1566     if test "$use_gcc_version" = ""; then
1567         target_gcc_version="4.6.4"
1568     fi
1569 else
1570     target_gcc_version="$use_gcc_version"
1572 AC_MSG_RESULT($target_gcc_version)
1574 AC_MSG_CHECKING([whether to include Objective-C suppport])
1575 AC_ARG_ENABLE(objc,AC_HELP_STRING([--disable-objc],[Build without Objectve-C support]),objc="$enableval",objc="yes")
1576 AC_MSG_RESULT($objc)
1577 if test "x$objc" = "xyes"; then
1578     objc_target="objc"
1579 else
1580     objc_target="no-objc"
1583 spec_obj_format="-m $aros_object_format"
1584 # Now process extra architecture-specific options.
1585 # Currently this is implemented only for ARM. We can specify which minimum CPU and FPU to use,\
1586 # as well as floating-point ABI.
1587 case "$aros_target_cpu" in
1588 *x86_64*)
1589     dnl x86_64 can build 32 or 64bit code
1590     spec_obj_format="%{!m32:-m elf_x86_64} %{m32:-m elf_i386}"
1591     ;;
1592 arm)
1593     dnl ARM defaults are: armv6 + vfp (unless overriden in per-target section above)
1594     if test "$gcc_default_cpu" = ""; then
1595         gcc_default_cpu="armv6"
1596     fi
1597     if test "$gcc_default_fpu" = ""; then
1598         gcc_default_fpu="vfp"
1599     fi
1600     if test "$gcc_default_float_abi" = ""; then
1601         gcc_default_float_abi="softfp"
1602     fi
1604     AC_MSG_CHECKING([Which minimum CPU to use])
1605     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)
1606     AC_MSG_RESULT($aros_gcc_cpu)
1608     AC_MSG_CHECKING([Which minimum FPU to use])
1609     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)
1610     AC_MSG_RESULT($aros_gcc_fpu)
1612     AC_MSG_CHECKING([Which floating point ABI to use])
1613     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)
1614     AC_MSG_RESULT($aros_gcc_float_abi)
1616     aros_isa_flags="-marm -mthumb-interwork -march=$aros_gcc_cpu -mfpu=$aros_gcc_fpu -mfloat-abi=$aros_gcc_float_abi"
1617     aros_config_cflags="$aros_config_cflags -fno-asynchronous-unwind-tables -fno-exceptions"
1618     aros_config_aflags="$aros_config_aflags -fno-asynchronous-unwind-tables -fno-exceptions"
1619     ;;
1620 i386)
1621     aros_isa_flags="-m32 -march=i486"
1622     aros_kernel_cflags="$aros_kernel_cflags $aros_isa_flags"
1623     ;;
1624 esac
1626 # Some architectures may need custom ELF specs.
1627 if test -f $SRCDIR/config/${aros_object_format}-specs.in; then
1628     elf_specs_in=config/${aros_object_format}-specs.in
1629 else
1630     elf_specs_in=config/elf-specs.in
1633 # Some compilers (ppc-elf-gcc is known to) have CPU defines in specs
1634 # Since we override specs, we may need to put these defines there
1635 if test "$gcc_target_cpu" != ""; then
1636     gcc_target_cpu="-D__${gcc_target_cpu}__"
1639 AC_MSG_CHECKING([where to download sourcecode for external ports])
1640 AC_ARG_WITH(portssources,AC_HELP_STRING([--with-portssources=DIR],[Where to download sourcecode for external ports]),with_portssrcdir=$withval,with_portssrcdir="default")
1641 if test "$with_portssrcdir" = "default"; then
1642     AROS_PORTSSRCDIR="$AROS_BUILDDIR_UNIX/bin/Sources"
1643 else
1644     AROS_PORTSSRCDIR="$with_portssrcdir"
1646 AC_MSG_RESULT($AROS_PORTSSRCDIR)
1648 AC_MSG_CHECKING([which bootloader to use])
1649 AC_ARG_WITH(bootloader,AC_HELP_STRING([--with-bootloader=NAME],[Use a specific bootloader]),target_bootloader=$withval,target_bootloader=$target_bootloader)
1650 if test "$target_bootloader" = "none"; then
1651     aros_target_bootloader=""
1652 else
1653     aros_target_bootloader="$target_bootloader"
1655 AC_MSG_RESULT($target_bootloader)
1657 AC_MSG_CHECKING([which icon-set to use])
1658 AC_ARG_WITH(iconset,AC_HELP_STRING([--with-iconset=NAME],[Use a specific Icon-set (default=Gorilla).]),target_iconset=$withval,target_iconset="default")
1659 if test "$target_iconset" = "default"; then
1660     aros_target_iconset="Gorilla"
1661     target_iconset="default (Gorilla)"
1662 else
1663     aros_target_iconset="$target_iconset"
1665 AC_MSG_RESULT($target_iconset)
1667 AC_MSG_CHECKING([which GUI Theme to use])
1668 AC_ARG_WITH(theme,AC_HELP_STRING([--with-theme=NAME],[Use a specific GUI Theme]),target_guitheme=$withval,target_guitheme="default")
1669 if test "$target_guitheme" = "default"; then
1670     aros_target_guitheme="Ice"
1671 else
1672     aros_target_guitheme="$target_guitheme"
1674 AC_MSG_RESULT($aros_target_guitheme)
1676 # Find out if we are cross-compiling (i.e. if we can't use the host compiler
1677 # for target code)
1678 cross_compiling=no
1680 dnl The first case is simple. If we are compiling for another CPU, we are cross-compiling for sure
1681 if test "$aros_host_cpu" != "$aros_target_cpu" ; then
1682     cross_compiling=yes
1685 dnl x86-64 toolchains can also produce i386 binaries, given -m32 flag.
1686 dnl The flag itself is given in per-target section, because some targets require to pass it
1687 dnl in a different manner, otherwise some tests fail.
1688 dnl TODO: Justify this.
1689 if test "$aros_host_cpu" == "x86_64" ; then
1690     if test "$aros_target_cpu" == "i386" ; then
1691         cross_compiling=no
1692     fi
1695 if test "x-$aros_flavour" = "x-emulation" -o "x-$aros_flavour" = "x-emulcompat" ; then
1696     dnl For a hosted build we are cross-compiling if host OS differs from build OS.
1697     dnl TODO: This might get a little bit more tricky if we ever cross-compile ARM-Android-hosted
1698     dnl AROS on ARM Linux, or even vice versa (Linux-hosted ARM AROS building on ARM Android).
1699     dnl ARM ABIs of Linux and Android are not compatible (despite very close), so host_cc can't be
1700     dnl used to build bootstrap for target arch in either case.
1701     dnl For us Android is not a separate OS, but a variant of Linux, so both systems will be
1702     dnl identified as 'linux'. If this ever involves, we'll have to implement some additional check,
1703     dnl perhaps introducing aros_host_variant
1704     if test "$aros_host_arch" != "$aros_target_arch" ; then
1705         cross_compiling=yes
1706     fi
1707 else
1708     dnl For a native build we only care if our host_cc can produce static ELF files. If so, we can use
1709     dnl it as kernel_cc. If not, (e. g. we are on Windows or Darwin), we need a crosscompiler.
1710     if test "$host_cc_elf" = "no" ; then
1711         cross_compiling=yes
1712     fi
1715 if test "$cross_compiling" = "no" ; then
1716     kernel_tool_prefix=""
1717     if test "$host_cc_elf" = "yes" ; then
1718         elf_tool_prefix=""
1719     fi
1722 if test "$kernel_tool_version" != ""; then
1723     kernel_tool_version="-$kernel_tool_version"
1725 if test "$use_gcc_version" != ""; then
1726     target_tool_version="-$target_gcc_version"
1729 #######################################################################
1730 ## Compute what toolchains to use, and their paths                   ##
1731 #######################################################################
1733 # This takes, as input:
1734 #   crosstools             {yes,no}
1735 #   kernel_tool_version    {"",[version]}
1736 #   target_tool_version    {"",[version]}
1737 #   kernel_tool_prefix     {none,[some-arch-os-]}
1738 #   target_tool_prefix     ${aros_target_cpu}-aros-
1739 #   aros_tool_prefix       ${aros_target_cpu}-aros-
1741 # The output is
1742 #   aros_kernel_{cpp,cc,ar,ld,as,ranlib,nm,strip}
1743 #        Where the 'kernel' binaries are located
1744 #   orig_target_{cpp,cc,ar,ld,as,ranlib,nm,strip}
1745 #        Where the 'target' binaries are located
1746 #        (not the symlink farm - that is aros_target_*!)
1748 # The rules are:
1749 #   if crosstools then
1750 #      if kernel_tools_prefix = "no-kernel-prefix-"
1751 #          aros_kernel_* = crosstools cc paths
1752 #          aros_kernel_cc = elf cc wrapper around crosstools cc
1753 #      else
1754 #          VALIDATE(${kernel_tools_prefix}*)
1755 #          aros_kernel_* = ${kernel_tools_prefix}*
1756 #          if ${kernel_tools_prefix}cc is an AROS gcc
1757 #              aros_kernel_cc = ${kernel_tools_prefix}cc
1758 #          else
1759 #              aros_kernel_cc = elf cc wrapper around ${kernel_tools_prefix}cc
1760 #          fi
1761 #      fi
1763 #      orig_target_* = aros built crosstools
1764 #      orig_target_cc = elf cc wrapper around crosstools cc
1765 #   else
1766 #      VALIDATE(${kernel_tools_prefix}*)
1768 #      orig_target_* = aros_kernel_*
1769 #      if aros_kernel_cc is an AROS gcc
1770 #          orig_target_cc = aros_kernel_cc
1771 #      else
1772 #          orig_target_cc = aros cc wrapper around aros_kernel_cc
1773 #      fi
1774 #   fi
1776 target_tool_prefix="${aros_target_cpu}-aros-"
1778 AC_MSG_CHECKING([which kernel tools])
1779 AC_MSG_RESULT([$kernel_tool_prefix]);
1781 if test "$kernel_tool_prefix" = "none" ; then
1782     dnl ELF wrapper can be used only for native bootstrap
1783     if test "x-$aros_flavour" = "x-emulation" -o "x-$aros_flavour" = "x-emulcompat" ; then
1784         AC_MSG_ERROR([--with-kernel-toolchain-prefix= is required for this arch])
1785     fi
1786 else
1787     # Kernel tools required - find them
1788     # Note that 'normally', aros_kernel_* overrides will be
1789     # empty, unless specified in the per-arch sections above.
1790     if test "x$aros_kernel_cpp" = "x"; then
1791         aros_kernel_cpp=${kernel_tool_prefix}cpp
1792     fi
1793     AROS_TOOL_KERNEL(aros_kernel_cpp,cpp,$aros_kernel_cpp${kernel_tool_version})
1794     AROS_REQUIRED(cpp,$aros_kernel_cpp)
1795     if test "x$aros_kernel_cc" = "x"; then
1796         aros_kernel_cc=${kernel_tool_prefix}gcc
1797     fi
1798     AROS_TOOL_KERNEL(aros_kernel_cc,cc,$aros_kernel_cc${kernel_tool_version})
1799     AROS_REQUIRED(cc,$aros_kernel_cc)
1800     if test "x$aros_kernel_cxx" = "x"; then
1801         aros_kernel_cxx=${kernel_tool_prefix}g++
1802     fi
1803     AROS_TOOL_KERNEL(aros_kernel_cxx,cxx,$aros_kernel_cxx${kernel_tool_version})
1804     # If it's set, make sure it's really there
1805     if test "x$aros_kernel_cxx" != "x" ; then
1806         AROS_REQUIRED(cxx,$aros_kernel_cxx)
1807     fi
1808     AROS_TOOL_KERNEL(aros_kernel_ld,ld,$aros_kernel_ld)
1809     AROS_REQUIRED(ld,$aros_kernel_ld)
1810     AROS_TOOL_KERNEL(aros_kernel_as,as,$aros_kernel_as)
1811     AROS_REQUIRED(as,$aros_kernel_as)
1812     AROS_TOOL_KERNEL(aros_kernel_ar,ar,$aros_kernel_ar)
1813     AROS_REQUIRED(ar,$aros_kernel_ar)
1814     AROS_TOOL_KERNEL(aros_kernel_ranlib,ranlib,$aros_kernel_ranlib)
1815     AROS_REQUIRED(ranlib,$aros_kernel_ranlib)
1816     AROS_TOOL_KERNEL(aros_kernel_nm,nm,$aros_kernel_nm)
1817     AROS_REQUIRED(nm,$aros_kernel_nm)
1818     AROS_TOOL_KERNEL(aros_kernel_strip,strip,$aros_kernel_strip)
1819     AROS_REQUIRED(strip,$aros_kernel_strip)
1821     # Objcopy and objdump are not required for the kernel
1822     # toolchain on many architectures.
1823     # So we'll look for them, but not make them strictly required.
1824     AROS_TOOL_KERNEL(aros_kernel_objcopy,objcopy,$aros_kernel_objcopy)
1825     AROS_TOOL_KERNEL(aros_kernel_objdump,objdump,$aros_kernel_objdump)
1826     if test "x${crosstools}" != "xyes" ; then
1827         AROS_REQUIRED(objcopy,$aros_kernel_objcopy)
1828         AROS_REQUIRED(objdump,$aros_kernel_objdump)
1829     fi
1832 AC_MSG_CHECKING([which target tools to use])
1833 if test "$crosstools" = "yes"; then
1834     AC_MSG_RESULT([$target_tool_prefix])
1835     # We are building AROS crosstools
1836     tmp_tool_prefix="$AROS_CROSSTOOLSDIR/${target_tool_prefix}"
1837     orig_target_cc="${tmp_tool_prefix}gcc${target_tool_version}"
1838     orig_target_cxx="${tmp_tool_prefix}g++${target_tool_version}"
1839     orig_target_cpp="${tmp_tool_prefix}cpp"
1840     orig_target_ld="${tmp_tool_prefix}ld"
1841     orig_target_as="${tmp_tool_prefix}as"
1842     orig_target_ar="${tmp_tool_prefix}ar"
1843     orig_target_ranlib="${tmp_tool_prefix}ranlib"
1844     orig_target_nm="${tmp_tool_prefix}nm"
1845     orig_target_strip="${tmp_tool_prefix}strip"
1846     orig_target_objcopy="${tmp_tool_prefix}objcopy"
1847     orig_target_objdump="${tmp_tool_prefix}objdump"
1848 else
1849     # Determine whether AROS or ELF tools should be used
1850     if test "$aros_tool_prefix" = "none"; then
1851         aros_tool_prefix="${elf_tool_prefix}"
1852     fi
1854     AC_MSG_RESULT([$aros_tool_prefix])
1855     # We are *not* building AROS crosstools - use the AROS or ELF tools
1856     AROS_TOOL_TARGET(orig_target_cpp,cpp,${aros_tool_prefix}cpp${target_tool_version})
1857     AROS_REQUIRED(cpp,$orig_target_cpp)
1858     AROS_TOOL_TARGET(orig_target_cc,gcc,${aros_tool_prefix}gcc${target_tool_version})
1859     AROS_REQUIRED(cc,$orig_target_cc)
1860     AROS_TOOL_TARGET(orig_target_cxx,g++,${aros_tool_prefix}g++${target_tool_version})
1861     AROS_REQUIRED(cxx,$orig_target_cxx)
1862     AROS_TOOL_TARGET(orig_target_ld,gcc,${aros_tool_prefix}ld)
1863     AROS_REQUIRED(ld,$orig_target_ld)
1864     AROS_TOOL_TARGET(orig_target_as,as,${aros_tool_prefix}as)
1865     AROS_REQUIRED(as,$orig_target_as)
1866     AROS_TOOL_TARGET(orig_target_ar,ar,${aros_tool_prefix}ar)
1867     AROS_REQUIRED(ar,$orig_target_ar)
1868     AROS_TOOL_TARGET(orig_target_ranlib,ar,${aros_tool_prefix}ranlib)
1869     AROS_REQUIRED(ranlib,$orig_target_ranlib)
1870     AROS_TOOL_TARGET(orig_target_nm,nm,${aros_tool_prefix}nm)
1871     AROS_REQUIRED(nm,$orig_target_nm)
1872     AROS_TOOL_TARGET(orig_target_strip,strip,${aros_tool_prefix}strip)
1873     AROS_REQUIRED(strip,$orig_target_strip)
1874     AROS_TOOL_TARGET(orig_target_objcopy,objcopy,${aros_tool_prefix}objcopy)
1875     AROS_REQUIRED(objcopy,$orig_target_objcopy)
1876     AROS_TOOL_TARGET(orig_target_objdump,objdump,${aros_tool_prefix}objdump)
1877     AROS_REQUIRED(objdump,$orig_target_objdump)
1880 if test "$kernel_tool_prefix" = "none" ; then
1881     # No kernel tools specified
1882     # Assume target tools == kernel tools with ELF wrapper
1883     aros_kernel_cc=$orig_target_cc
1884     aros_kernel_cxx=$orig_target_cxx
1885     aros_kernel_cpp=$orig_target_cpp
1886     aros_kernel_ld=$orig_target_ld
1887     aros_kernel_as=$orig_target_as
1888     aros_kernel_ar=$orig_target_ar
1889     aros_kernel_ranlib=$orig_target_ranlib
1890     aros_kernel_nm=$orig_target_nm
1891     aros_kernel_strip=$orig_target_strip
1892     aros_kernel_objcopy=$orig_target_objcopy
1893     aros_kernel_objdump=$orig_target_objdump
1894     use_kernel_cc_wrapper=yes
1897 # At this point, all aros_kernel_* and aros_target_* 
1898 # tools should be set up correctly
1900 CC="$aros_kernel_cc $kernel_tool_flags"
1901 CPP="$aros_kernel_cpp"
1903 #-----------------------------------------------------------------------------
1905 # Disable pointer-signedness warnings if the compiler recognises the option
1907 AC_MSG_CHECKING([whether ${CC} accepts -Wno-pointer-sign])
1908 save_cflags="$CFLAGS"
1909 if test "$crosstools" != "yes" ; then
1910     CFLAGS="$CFLAGS -Wno-pointer-sign"
1911     AC_TRY_COMPILE(,, use_no_sign_warning="yes", use_no_sign_warning="no")
1912 else
1913     # we do know it is supported for the smallest version of gcc we are going to build
1914     # we assume it's also supported by later versions
1915     use_no_sign_warning=yes
1917 AC_MSG_RESULT($use_no_sign_warning)
1918 if test "x-$use_no_sign_warning" = "x-yes" ; then
1919     aros_config_cflags="$aros_config_cflags -Wno-pointer-sign"
1921 CFLAGS="$save_cflags"
1923 #-----------------------------------------------------------------------------
1925 # Find all the tools we need to compile. This could be cross-compiling
1926 # though! If that is the case we use the GNU form of the target and
1927 # simply add this to the front of the binary name. This is rather simple,
1928 # but it should work under most circumstances.
1930 # The default tools are to use the same as the host, but only if the
1931 # host and target CPU are the same. With GCC this is normally enough.
1934 aros_cc_pre=""
1935 aros_shared_ld="$aros_host_ld"
1937 aros_target_mkdep="$aros_host_mkdep"
1939 # The default tools executables to be linked to.
1940 if test "$rescomp" != ""; then
1941     AC_PATH_PROG(aros_kernel_rescomp,${kernel_tool_prefix}$rescomp)
1942     AROS_REQUIRED($rescomp,$aros_kernel_rescomp)
1945 # Set up the sources for the symlink farm
1946 if test "$crosstools" = "yes"; then
1947     crosstools_target=tools-crosstools
1950 aros_kernel_cc="$aros_kernel_cc $kernel_tool_flags"
1951 aros_kernel_ar="$aros_kernel_ar $aros_kernel_ar_flags"
1954 aros_hostcfg_dir="bin/${aros_host_arch}-${aros_host_cpu}/gen/config"
1955 aros_targetcfg_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/config"
1956 aros_inc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/AROS/Development/include/aros"
1957 aros_gendir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen"
1958 aros_geninc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/include/aros"
1959 aros_tools_dir="bin/${aros_host_arch}-${aros_host_cpu}/tools"
1960 aros_scripts_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/scripts"
1962 # aros_cc_pre is a variable that is added to the front of the compiler name
1963 # in the generated aros-gcc shell script. We need this to enable the cache
1964 # to work across cleaned builds. Also, support DISTCC using the correct
1965 # environment variable.
1968 if test "x${DISTCC}" != "x" ; then
1969     if test "x${CCACHE}" != "x" ; then
1970         aros_cc_pre="env CCACHE_PREFIX=${DISTCC} ${CCACHE} "
1971     else
1972         aros_cc_pre="${DISTCC} "
1973     fi
1974 else
1975     if test "x${CCACHE}" != "x" ; then
1976         aros_cc_pre="${CCACHE} "
1977     fi
1980 prefix="${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-"
1982 AC_SUBST(aros_target_nostdinc_cflags,-nostdinc)
1983 AC_SUBST(aros_target_nostartup_ldflags,-nostartfiles)
1984 AC_SUBST(aros_target_nix_ldflags,-nix)
1985 AC_SUBST(aros_target_detach_ldflags,-detach)
1986 AC_SUBST(aros_target_nostdlib_ldflags,-nostdlib)
1988 # Target tools
1989 if test "$crosstools" != "yes"; then
1990     if test "$GCC" = "yes"; then
1991         aros_target_cc_path=`$orig_target_cc -print-search-dirs | grep "programs: =" | cut -c 12-`
1992     fi
1993 else
1994     # We do not know which gcc version we are going to build and what we need to know
1995     # here is different for different versions so this will be set later during the
1996     # build of crosstools.
1997     aros_target_cc_path=@aros_target_cc_path@
1999 aros_target_cpp="${prefix}cpp"
2000 aros_target_cc="${prefix}gcc"
2001 aros_target_cxx="${prefix}g++"
2002 aros_target_as="${prefix}as"
2003 aros_target_ld="${prefix}ld"
2004 aros_target_ar="${prefix}ar $aros_target_ar_flags"
2005 aros_target_objcopy="${prefix}objcopy"
2006 aros_target_objdump="${prefix}objdump"
2007 aros_target_ranlib="${prefix}ranlib $aros_target_ranlib_flags"
2008 aros_target_nm="${prefix}nm $aros_target_nm_flags"
2009 aros_target_strip="${prefix}strip"
2010 aros_plain_nm="${prefix}nm"
2011 aros_plain_ar="${prefix}ar"
2013 AC_ARG_ENABLE(includes,
2014 AC_HELP_STRING([--enable-includes=dir],[Alternative system include directory]),
2015 [aros_target_incl=$enable_includes], [aros_target_incl=`$aros_kernel_cc -print-sysroot`/`$aros_kernel_cc --print-sysroot-headers-suffix 2>/dev/null || echo usr/include`])
2017 if test "$aros_kernel_includes" = ""; then
2018     if test "x-$aros_flavour" = "x-emulation" -o "x-$aros_flavour" = "x-emulcompat" ; then
2019         aros_kernel_includes="-isystem $aros_target_incl"
2020     fi
2023 if test "$aros_kernel_includes" != "" ; then
2024     dnl find out about the kernel cc's include path
2025     AC_MSG_CHECKING([for the kernel compiler's include path])
2026     if test "$aros_kernel_cc_includes" = "" ; then
2027         # Try to guess where the directory is.
2028         aros_kernel_cc_includes=`dirname \`${aros_kernel_cc} ${aros_kernel_cflags} -print-libgcc-file-name\``/include
2029         if test -d $aros_kernel_cc_includes; then
2030             # Check if there is also an include-fixed directory and add it
2031             # to kernel compiler's include path as it may contain some of
2032             # the headers we need.
2033             if test -d "$aros_kernel_cc_includes"-fixed; then
2034                 aros_kernel_cc_includes+=" -isystem $aros_kernel_cc_includes"-fixed
2035             fi
2036             # Check for specific includes directory. Neede for Ubuntu 11.10
2037             if test -d "/usr/include/i386-linux-gnu"; then
2038                 aros_kernel_cc_includes+=" -isystem /usr/include/i386-linux-gnu"
2039             fi
2040         else
2041             # The directory doesn't exist, we need to do some more work.
2042             aros_kernel_cc_includes=${PWD}/${aros_gendir}/cc_include
2044             # These are the headers we're looking for.
2045             headers="limits.h mmintrin.h stdbool.h syslimits.h float.h \
2046                      stddef.h xmmintrin.h iso646.h stdarg.h unwind.h   \
2047                      zutil.h stdint.h"
2049             dirs=
2050             for h in $headers; do
2051                 # Which other headers are needed by each of the above?
2052                 deps=$(echo "#include <$h>" | \
2053                        $aros_kernel_cc -E -M - 2>/dev/null | \
2054                        sed 's/^.*://; s/\\$/ /g; s/[[ \t]]\+/ /g')
2056                 # Copy all the needed headers to a directory beneath gendir.
2057                 for d in $deps; do
2058                     h=$(basename $d)
2059                     dir=${aros_kernel_cc_includes}$(echo $(dirname $d) | \
2060                                                 sed -n "s,^.*/include\(/.*\),\1,p")
2061                     ! test -d $dir && mkdir -p $dir
2062                     ! test -f $dir/$h && { cp $d $dir; chmod u+w $dir/$h; }
2063                 done
2064             done            
2065         fi
2066     fi
2067     AC_MSG_RESULT($aros_kernel_cc_includes)
2068     # Adding -nostdinc to kernel includes as they are always used together.
2069     aros_kernel_includes="$aros_kernel_includes $aros_target_nostdinc_cflags -isystem $aros_kernel_cc_includes"
2072 if test "$crosstools" != "yes"; then
2073     dnl find out about the target cc's include path
2074     AC_MSG_CHECKING([for the target compiler's include path])
2075     if test "$aros_target_cc_includes" = "" ; then
2076         #try to guess where the directory is
2077         aros_target_cc_includes=`dirname \`${orig_target_cc} -print-libgcc-file-name\``/include
2078         if ! test -d $aros_target_cc_includes; then
2079             #the directory doesn't exist, we need to do some more work
2080             aros_target_cc_includes=${PWD}/${aros_gendir}/cc_include
2081         
2082             #these are the headers we're looking for
2083             headers="limits.h mmintrin.h stdbool.h syslimits.h float.h \
2084                     stddef.h xmmintrin.h iso646.h stdarg.h unwind.h   \
2085                     zutil.h"
2087             dirs=
2088             for h in $headers; do
2089                 #which other headers each of the above headers needs?
2090                 deps=$(echo "#include <$h>" | \
2091                     $orig_target_cc -E -M - 2>/dev/null | \
2092                     sed 's/^.*://; s/\\$/ /g; s/[[ \t]]\+/ /g')
2093             
2094                 #copy all the needed headers to a directory beneath gendir
2095                 for d in $deps; do
2096                     h=$(basename $d)
2097                     dir=${aros_target_cc_includes}$(echo $(dirname $d) | \
2098                                                 sed -n "s,^.*/include\(/.*\),\1,p")
2099                     ! test -d $dir && mkdir -p $dir
2100                     ! test -f $dir/$h && { cp $d $dir; chmod u+w $dir/$h; }
2101                 done
2102             done
2103         fi
2104     fi
2105     AC_MSG_RESULT($aros_target_cc_includes)
2106 else
2107     # We do not know which gcc version we are going to build and what we need to know
2108     # here is different for different versions so this will be set later during the
2109     # build of crosstools.
2110     aros_target_cc_includes=@aros_target_cc_includes@
2114 # For GCC < 4.0 -I- is used for giving the search path for '#include "..."'
2115 # On GCC >= 4.0 -iquote should be used
2118 save_cc="$CC"
2119 save_cflags="$CFLAGS"
2120 CFLAGS="-iquote."
2121 AC_MSG_CHECKING([whether ${CC} accepts -iquote])
2122 if test "x-$crosstools" != "x-yes"; then
2123     AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
2124 else
2125     # we do know it is supported for the smallest version of gcc we are going to build
2126     # we assume it's also supported by later versions
2127     has_iquote=yes
2129 AC_MSG_RESULT($has_iquote)
2130 if test "x-$has_iquote" = "x-yes" ; then
2131     host_cflags_iquote=-iquote
2132     host_cflags_iquote_end=
2133 else
2134     host_cflags_iquote=-I
2135     host_cflags_iquote_end=-I-
2137 kernel_cflags_iquote=$host_cflags_iquote
2138 kernel_cflags_iquote_end=$host_cflags_iquote_end
2139 if test "x-$cross_compiling" = "x-yes"; then
2140     CC="$aros_kernel_cc"
2141     AC_MSG_CHECKING([whether ${CC} accepts -fno-stack-protector])
2142     if test "x-$crosstools" != "x-yes"; then
2143         AC_TRY_COMPILE(,, use_no_stack_protector="yes", use_no_stack_protector="no")
2144     else
2145         # we do know it is supported for the smallest version of gcc we are going to build
2146         # we assume it's also supported by later versions
2147         use_no_stack_protector=yes
2148     fi
2149     AC_MSG_RESULT($use_no_stack_protector)
2150     AC_MSG_CHECKING([whether ${CC} accepts -iquote])
2151     if test "x-$crosstools" != "x-yes"; then
2152         AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
2153     else
2154         # we do know it is supported for the smallest version of gcc we are going to build
2155         # we assume it's also supported by later versions
2156         has_iquote=yes
2157     fi
2158     AC_MSG_RESULT($has_iquote)
2159     if test "x-$has_iquote" = "x-yes" ; then
2160         kernel_cflags_iquote=-iquote
2161         kernel_cflags_iquote_end=
2162     else
2163         kernel_cflags_iquote=-I
2164         kernel_cflags_iquote_end=-I-
2165     fi
2167 aros_cflags_iquote=$kernel_cflags_iquote
2168 aros_cflags_iquote_end=$kernel_cflags_iquote_end
2169 if test "$orig_target_cc" != "$aros_kernel_cc"; then
2170     CC="$orig_target_cc"
2171     AC_MSG_CHECKING([whether ${CC} accepts -iquote])
2172     if test "x-$crosstools" != "x-yes"; then
2173         AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
2174     else
2175         # we do know it is supported for the smallest version of gcc we are going to build
2176         # we assume it's also supported by later versions
2177         has_iquote=yes
2178     fi
2179     AC_MSG_RESULT($has_iquote)
2180     if test "x-$has_iquote" = "x-yes" ; then
2181         aros_cflags_iquote=-iquote
2182         aros_cflags_iquote_end=
2183     else
2184         aros_cflags_iquote=-I
2185         aros_cflags_iquote_end=-I-
2186     fi
2188 if test "x-$use_no_stack_protector" = "x-yes" ; then
2189     aros_kernel_cflags="$aros_kernel_cflags -fno-stack-protector"
2193 #-----------------------------------------------------------------------------
2195 # Check if the target compiler supports some options used for delinting:
2196 #  -Wunused-but-set-variable
2197 #  -Warray-bounds
2198 #  -Wenum-compare
2199 #  -Wstrict-overflow
2200 #  -Wformat-security
2202 if test "x-$crosstools" != "x-yes"; then
2203     if test "$orig_target_cc" != "$aros_kernel_cc"; then
2204         CC="$orig_target_cc"
2205     fi
2206     AC_MSG_CHECKING([whether ${CC} accepts -Wunused-but-set-variable])
2207     CFLAGS=-Wunused-but-set-variable
2208     AC_TRY_COMPILE(,, aros_unused_but_set_variable="yes", aros_unused_but_set_variable="no")
2209     AC_MSG_RESULT($aros_unused_but_set_variable)
2210     if test "x-$aros_unused_but_set_variable" = "x-yes" ; then
2211         aros_cflags_unused_but_set_variable=-Wno-unused-but-set-variable
2212     fi
2214     AC_MSG_CHECKING([whether ${CC} accepts -Warray-bounds])
2215     CFLAGS=-Warray-bounds
2216     AC_TRY_COMPILE(,, aros_array_bounds="yes", aros_array_bounds="no")
2217     AC_MSG_RESULT($aros_array_bounds)
2218     if test "x-$aros_array_bounds" = "x-yes" ; then
2219         aros_cflags_array_bounds=-Wno-array-bounds
2220     fi
2222     AC_MSG_CHECKING([whether ${CC} accepts -Wenum-compare])
2223     CFLAGS=-Wenum-compare
2224     AC_TRY_COMPILE(,, aros_enum_compare="yes", aros_enum_compare="no")
2225     AC_MSG_RESULT($aros_enum_compare)
2226     if test "x-$aros_enum_compare" = "x-yes" ; then
2227         aros_cflags_enum_compare=-Wno-enum-compare
2228     fi
2230     AC_MSG_CHECKING([whether ${CC} accepts -Wstrict-overflow])
2231     CFLAGS=-Wstrict-overflow
2232     AC_TRY_COMPILE(,, aros_strict_overflow="yes", aros_strict_overflow="no")
2233     AC_MSG_RESULT($aros_strict_overflow)
2234     if test "x-$aros_strict_overflow" = "x-yes" ; then
2235         aros_cflags_strict_overflow=-Wno-strict-overflow
2236     fi
2238     AC_MSG_CHECKING([whether ${CC} accepts -Wformat-security])
2239     CFLAGS=-Wformat-security
2240     AC_TRY_COMPILE(,, aros_format_security="yes", aros_format_security="no")
2241     AC_MSG_RESULT($aros_format_security)
2242     if test "x-$aros_format_security" = "x-yes" ; then
2243         aros_cflags_format_security=-Wno-format-security
2244     fi
2245 else
2246     # We do not know which gcc version we are going to build and what we need to know
2247     # here is different for different versions so this will be set later during the
2248     # build of crosstools.
2249     aros_cflags_unused_but_set_variable=@aros_cflags_unused_but_set_variable@
2250     aros_cflags_array_bounds=@aros_cflags_array_bounds@
2251     aros_cflags_enum_compare=@aros_cflags_enum_compare@
2252     aros_cflags_strict_overflow=@aros_cflags_strict_overflow@
2253     aros_cflags_format_security=@aros_cflags_format_security@
2256 #-----------------------------------------------------------------------------
2258 # Check if we can explicitly choose older version of symbol hashing
2260 CFLAGS="save_cflags -Wl,--hash-style=sysv"
2261 CC="$aros_kernel_cc"
2262 AC_MSG_CHECKING([whether ${CC} accepts -Wl,--hash-style=sysv])
2263 AC_TRY_LINK(,, use_hash_style="yes", use_hash_style="no")
2264 AC_MSG_RESULT($use_hash_style)
2265 if test "x-$use_hash_style" = "x-yes" ; then
2266     aros_kernel_cflags="$aros_kernel_cflags -Wl,--hash-style=sysv"
2268 CC="$save_cc"
2269 CFLAGS="$save_cflags"
2271 AC_SUBST(host_cflags_iquote)
2272 AC_SUBST(host_cflags_iquote_end)
2273 AC_SUBST(kernel_cflags_iquote)
2274 AC_SUBST(kernel_cflags_iquote_end)
2275 AC_SUBST(aros_cflags_iquote)
2276 AC_SUBST(aros_cflags_iquote_end)
2279 dnl Check if user specified --with-resolution=XRESxYRESxDEPTH
2280 AC_MSG_CHECKING([for default resolution of WBScreen])
2281 AC_ARG_WITH(resolution,AC_HELP_STRING([--with-resolution=XRESxYRESxDEPTH],[Default resolution of the initial WorkbenchScreen]),resolution=$withval,resolution=none)
2282 # We require an argument, so map --with/--without ("yes"/"no") to "none" specified
2283 if test "$resolution" = "yes" ; then
2284     resolution="none"
2286 if test "$resolution" = "no" ; then
2287     resolution="none"
2289 if test "$resolution" != "none" ; then
2290     aros_default_wbwidth=`echo $resolution | cut -d'x' -f1`
2291     aros_default_wbheight=`echo $resolution | cut -d'x' -f2`
2292     aros_default_wbdepth=`echo $resolution | cut -d'x' -f3`
2294 AC_MSG_RESULT($aros_default_wbwidth x $aros_default_wbheight x $aros_default_wbdepth)
2295 aros_cv_default_wbwidth=$aros_default_wbwidth
2296 aros_cv_default_wbheight=$aros_default_wbheight
2297 aros_cv_default_wbdepth=$aros_default_wbdepth
2299 dnl See if the user wants the serial debug output for native flavour
2300 AC_MSG_CHECKING([if serial debug is enabled])
2301 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)
2302 if test "$aros_serial_debug" = 0 ; then
2303     serial_debug_forced=""
2304     if test "$serial_debug" = "yes" ; then
2305         serial_debug="1"
2306     fi
2307     if test "$serial_debug" = "no" ; then
2308         serial_debug="none"
2309     fi
2310 else
2311     serial_debug_forced="(forced)"
2312     serial_debug=$aros_serial_debug
2314 if test "$serial_debug" != "none" ; then
2315     aros_serial_debug=$serial_debug
2316     AC_MSG_RESULT($serial_debug_forced on port $serial_debug)
2317 else
2318     AC_MSG_RESULT(no)
2321 dnl See if the user wants the palm debug output hack for palm native flavour
2322 AC_MSG_CHECKING([if palm debug hack is enabled])
2323 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")
2324 if test "$palm_debug_hack" = "yes" ; then
2325     aros_palm_debug_hack="1"
2327 AC_MSG_RESULT($palm_debug_hack)
2329 dnl See if dev wants the usb3.0 code
2330 AC_MSG_CHECKING([if usb3.0 code is enabled])
2331 AC_ARG_ENABLE(usb30_code,AC_HELP_STRING([--enable-usb30-code],[Enable usb3.0 code (default=no)]),usb30_code="yes",usb30_code="no")
2332 if test "$usb30_code" = "yes" ; then
2333     aros_config_cflags="$aros_config_cflags -DAROS_USB30_CODE"
2334     aros_kernel_cflags="$aros_kernel_cflags -DAROS_USB30_CODE"
2336 AC_MSG_RESULT($usb30_code)
2338 dnl See if the user wants nesting supervisor activated for unix flavour
2339 AC_MSG_CHECKING([if nesting supervisor support is enabled])
2340 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")
2341 if test "$nesting_supervisor" = "yes" ; then
2342     aros_nesting_supervisor="1"
2344 AC_MSG_RESULT($nesting_supervisor)
2346 dnl See if the user wants to disable MMU support
2347 dnl This can be overriden on per-target basis,
2348 dnl set $aros_enable_mmu to "yes" or "no" to do this
2349 if test "$aros_enable_mmu" = "" ; then
2350     AC_MSG_CHECKING([if MMU support is enabled])
2351     dnl Enabled by default
2352     AC_ARG_ENABLE(mmu,AC_HELP_STRING([--disable-mmu],[Disable MMU support (default=enabled)]),aros_enable_mmu=$enableval,aros_enable_mmu="yes")
2353     if test "$aros_enable_mmu" = "" ; then
2354         aros_enable_mmu="yes"
2355     fi
2356     AC_MSG_RESULT($aros_enable_mmu)
2358 if test "$aros_enable_mmu" = "no" ; then
2359     aros_enable_mmu="0"
2360 else
2361     aros_enable_mmu="1"
2363     
2365 dnl things specifically required for hosted flavours
2366 if test "x-$aros_flavour" = "x-emulation" -o "x-$aros_flavour" = "x-emulcompat" ; then
2368     if test "x-$need_dlopen" != "x-no" ; then
2369       save_libs="$LIBS"
2370       LIBS=""
2371       dnl some kind of dynamic library access system is required for hostlib.resource
2372       AC_CHECK_FUNC(dlopen, have_dl="yes", have_dl="no")
2373       if test "x-$have_dl" = "x-no" ; then
2374           AC_CHECK_LIB(dl, dlopen, [have_dl="yes"
2375                                     aros_host_ldflags="$aros_host_ldflags -ldl"],
2376                                     have_dl="no")
2377       fi
2378       if test "x-$have_dl" = "x-no" ; then
2379           AC_MSG_ERROR([dlopen() dynamic linker functions not available])
2380       fi
2381       LIBS="$save_libs"
2382     fi
2385     dnl x11 hidd
2386     AC_ARG_ENABLE(x11_hidd, AC_HELP_STRING([--enable-x11-hidd],
2387                                            [build X11 hidd for hosted (default=auto)]),
2388                                            x11_hidd="$enableval",
2389                                            x11_hidd="$need_x11")
2390     case "x-$x11_hidd" in
2391         x-yes|x-no|x-auto)                 ;;
2392         *)                 x11_hidd="$need_x11" ;;
2393     esac
2395     ENABLE_X11=0
2397     dnl they want it
2398     if test "x-$x11_hidd" != "x-no" ; then
2400         dnl find x11 stuff
2401         AC_PATH_X
2403         x_cflags=
2404         for path in $x_libraries
2405         do
2406             x_cflags="$x_cflags -L$path"
2407         done
2409         for path in $x_includes
2410         do
2411             x_cflags="$x_cflags -I$path"
2412         done
2413         
2414         if test "x-$no_x" = "x-yes" ; then
2416             dnl didn't find it
2417             if test "x-$x11_hidd" != "x-auto" ; then
2418                 dnl and they explicitly asked for it, bail out
2419                 AC_MSG_ERROR([X11 libs/headers not found, cannot build X11 hidd as requested])
2420             fi
2421         
2422         else
2423             dnl found it, setup the metatarget
2424             unixgfx_hidd_target=kernel-x11gfx
2425             ENABLE_X11=1
2427             dnl setup shared memory extensions
2428             AC_ARG_ENABLE(x11_shm, AC_HELP_STRING([--enable-x11-shm],
2429                                                   [use X11 shared memory (default=auto)]),
2430                                                   x11_hidd_shm="$enableval",
2431                                                   x11_hidd_shm="auto")
2432             case "x-$x11_hidd_shm" in
2433                 x-yes|x-no|x-auto)                     ;;
2434                 *)                 x11_hidd_shm="auto" ;;
2435             esac
2437             have_xshm=no
2439             dnl they want it
2440             if test "x-$x11_hidd_shm" != "x-no" ; then
2442                 dnl system shm headers
2443                 AC_CHECK_HEADERS(sys/ipc.h)
2444                 AC_CHECK_HEADERS(sys/shm.h)
2446                 dnl got them
2447                 if test "x-$ac_cv_header_sys_ipc_h" = "x-yes" -a "x-$ac_cv_header_sys_shm_h" = "x-yes" ; then
2449                     dnl make sure X libs have shm functions
2450                     save_cflags="$CFLAGS"
2451                     CFLAGS="$CFLAGS $x_cflags"
2452                     AC_CHECK_LIB(Xext, XShmQueryExtension, have_xshm=yes)
2453                     CFLAGS="$save_cflags"
2454                 fi
2455             fi
2457             dnl detection done, prepare output
2458             if test "x-$have_xshm" = "x-yes" ; then
2459                 dnl we can do shm
2460                 DO_XSHM_SUPPORT="1"
2461             elif test "x-$x11_hidd_shm" = "x-yes" ; then
2462                 dnl they explicitly asked for it, but we can't do it
2463                 AC_MSG_ERROR([X11 has no support for shared memory, cannot enable it as requested])
2464             else
2465                 dnl otherwise just disable it
2466                 DO_XSHM_SUPPORT="0"
2467             fi
2469             
2470             dnl setup vidmode (fullscreen) extensions
2471             AC_ARG_ENABLE(x11_vidmode, AC_HELP_STRING([--enable-x11-vidmode],
2472                                                       [use X11 vidmode extension (default=auto)]),
2473                                                       x11_hidd_vidmode="$enableval",
2474                                                       x11_hidd_vidmode="auto")
2475             case "x-$x11_hidd_vidmode" in
2476                 x-yes|x-no|x-auto)                         ;;
2477                 *)                 x11_hidd_vidmode="auto" ;;
2478             esac
2480             have_vidmode=no
2482             dnl they want it
2483             if test "x-$x11_hidd_vidmode" != "x-no" ; then
2485                 dnl make sure X libs have vidmode functions
2486                 save_cflags="$CFLAGS"
2487                 CFLAGS="$CFLAGS $x_cflags"
2488                 AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryExtension, have_vidmode=yes)
2489                 CFLAGS="$save_cflags"
2490             fi
2492             dnl detection done, prepare output
2493             if test "x-$have_vidmode" = "x-yes" ; then
2494                 dnl we can do vidmode
2495                 DO_VIDMODE_SUPPORT="1"
2496             elif test "x-$x11_hidd_vidmode" = "x-yes" ; then
2497                 dnl they explicitly asked for it, but we can't do it
2498                 AC_MSG_ERROR([X11 vidmode extension not available, cannot enable it as requested])
2499             else
2500                 dnl otherwise just disable it
2501                 DO_VIDMODE_SUPPORT="0"
2502             fi
2503         fi
2505         aros_host_x11_includes=$x_includes 
2506         aros_host_x11_libdirs=$x_libraries
2507     fi
2510     dnl sdl hidd
2511     AC_ARG_ENABLE(sdl_hidd, AC_HELP_STRING([--enable-sdl-hidd],
2512                                            [build SDL hidd for hosted (default=auto)]),
2513                                            sdl_hidd="$enableval",
2514                                            sdl_hidd="auto")
2515     case "x-$sdl_hidd" in
2516         x-yes|x-no|x-auto)                 ;;
2517         *)                 sdl_hidd="auto" ;;
2518     esac
2520     dnl they want it
2521     if test "x-$sdl_hidd" != "x-no" ; then
2523         dnl find sdl
2524         AM_PATH_SDL([1.2.10], have_sdl="yes", have_sdl="no")
2526         if test "x-$have_sdl" != "x-yes" ; then
2528             dnl didn't find it
2529             if test "x-$sdl_hidd" != "x-auto" ; then
2530                 dnl and they explicitly asked for it, bail out
2531                 AC_MSG_ERROR([SDL libs/headers not found, cannot build SDL hidd as requested])
2532             fi
2534         else
2535             dnl found it, set up the metatarget
2536             sdl_hidd_target=kernel-hidd-sdl
2537             aros_host_sdl_cflags=SDL_CFLAGS
2538             aros_host_sdl_libs=SDL_LIBS
2539         fi
2540     fi
2542     dnl oss.library
2543     AC_CHECK_HEADER(sys/soundcard.h)
2544     if test "x-$ac_cv_header_sys_soundcard_h" = "x-yes" ; then
2545         oss_library_target=workbench-libs-oss-unix
2546     fi
2550 dnl See if the user wants dbus.library
2551 AC_MSG_CHECKING([if building of dbus.library is enabled])
2552 AC_ARG_ENABLE(dbus,AC_HELP_STRING([--enable-dbus],[Enable DBUS support via dbus.library (default=no)]),dbus="yes",dbus="no")
2553 if test "$dbus" = "yes" ; then
2554     ENABLE_DBUS=1
2555     DBUS_CFLAGS=`pkg-config --cflags dbus-1`
2556     DBUS_LIBFLAGS=`pkg-config --libs dbus-1`
2557     KERNEL_DBUS_KOBJ=kernel-dbus-kobj
2558     KERNEL_DBUS_INCLUDES=kernel-dbus-includes
2559 else
2560     ENABLE_DBUS=0
2562 AC_MSG_RESULT($dbus)
2564 if test "$use_kernel_cc_wrapper" = "yes" ; then
2565     aros_kernel_cc="${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-elf-gcc"
2568 if test "${crosstools}" = "yes" || test "${crosstools_guess}" = "no"; then
2569     aros_target_toolchain=yes
2570 else
2571     aros_target_toolchain=no
2574 dnl --------------------------------------------------------------------
2575 dnl Configuration Output Section
2576 dnl --------------------------------------------------------------------
2578 # Generic
2579 AC_SUBST(aros_arch)
2580 AC_SUBST(aros_cpu)
2581 AC_SUBST(aros_flavour)
2582 AC_SUBST(aros_flavour_uc)
2583 AC_SUBST(aros_target_toolchain)
2584 AC_SUBST(AROS_BUILDDIR)
2585 AC_SUBST(AROS_BUILDDIR_UNIX)
2586 AC_SUBST(SRCDIR)
2587 AC_SUBST(AROS_CROSSTOOLSDIR)
2588 AC_SUBST(AROS_PORTSSRCDIR)
2590 # Compatability with other Amiga-like operation systems
2591 AC_SUBST(aros_amigaos_compliance)
2593 # Host related
2594 AC_SUBST(aros_cc_pre)
2595 AC_SUBST(aros_host_strip)
2596 AC_SUBST(aros_host_arch)
2597 AC_SUBST(aros_host_cpu)
2598 AC_SUBST(aros_host_cpp)
2599 AC_SUBST(aros_host_cc)
2600 AC_SUBST(aros_host_cxx)
2601 AC_SUBST(aros_host_ar)
2602 AC_SUBST(aros_host_ranlib)
2603 AC_SUBST(aros_host_ld)
2604 AC_SUBST(aros_host_make)
2605 AC_SUBST(aros_host_cflags)
2606 AC_SUBST(aros_host_cxxflags)
2607 AC_SUBST(gnu89_inline)
2608 AC_SUBST(aros_host_ldflags)
2609 AC_SUBST(aros_host_debug)
2610 AC_SUBST(aros_host_mkdep)
2611 AC_SUBST(aros_host_mkargs)
2612 AC_SUBST(aros_host_exe_suffix)
2613 AC_SUBST(aros_host_lib_suffix)
2614 AC_SUBST(aros_tools_dir)
2615 AC_SUBST(aros_host_aclocal)
2616 AC_SUBST(aros_host_autoconf)
2617 AC_SUBST(aros_host_autoheader)
2618 AC_SUBST(aros_host_automake)
2619 AC_SUBST(ant)
2621 # Target Related
2622 AC_SUBST(aros_target_guitheme)
2623 AC_SUBST(aros_target_iconset)
2624 AC_SUBST(aros_target_bootloader)
2625 AC_SUBST(aros_target_arch)
2626 AC_SUBST(aros_target_family)
2627 AC_SUBST(aros_target_cpu)
2628 AC_SUBST(aros_target_variant)
2629 AC_SUBST(aros_target_suffix)
2630 AC_SUBST(aros_target_ar)
2631 AC_SUBST(aros_target_ranlib)
2632 AC_SUBST(aros_plain_nm)
2633 AC_SUBST(aros_plain_ar)
2634 AC_SUBST(aros_kernel_ar)
2635 AC_SUBST(aros_kernel_ranlib)
2636 AC_SUBST(orig_target_cc)
2637 AC_SUBST(aros_target_cc)
2638 AC_SUBST(aros_kernel_cc)
2639 AC_SUBST(orig_target_cxx)
2640 AC_SUBST(aros_target_cxx)
2641 AC_SUBST(aros_kernel_cxx)
2642 AC_SUBST(orig_target_cpp)
2643 AC_SUBST(aros_target_cpp)
2644 AC_SUBST(aros_kernel_cpp)
2645 AC_SUBST(orig_target_as)
2646 AC_SUBST(aros_target_as)
2647 AC_SUBST(aros_kernel_as)
2648 AC_SUBST(orig_target_ld)
2649 AC_SUBST(aros_target_ld)
2650 AC_SUBST(aros_kernel_ld)
2651 AC_SUBST(aros_target_cc_includes)
2652 AC_SUBST(aros_target_cc_path)
2653 AC_SUBST(aros_target_objdump)
2654 AC_SUBST(aros_target_objcopy)
2655 AC_SUBST(aros_target_strip)
2656 AC_SUBST(aros_target_nm)
2657 AC_SUBST(aros_kernel_rescomp)
2658 AC_SUBST(aros_shared_default)
2659 AC_SUBST(aros_shared_ld)
2660 AC_SUBST(aros_object_format)
2661 AC_SUBST(spec_obj_format)
2662 AC_SUBST(aros_compiler_libs)
2663 AC_SUBST(aros_arch_libs)
2665 AC_SUBST(aros_config_cflags)
2666 AC_SUBST(aros_config_aflags)
2667 AC_SUBST(aros_config_ldflags)
2669 AC_SUBST(aros_shared_cflags)
2670 AC_SUBST(aros_shared_aflags)
2671 AC_SUBST(aros_shared_ldflags)
2672 AC_SUBST(aros_kernel_cflags)
2673 AC_SUBST(aros_kernel_includes)
2674 AC_SUBST(aros_kernel_objcflags)
2675 AC_SUBST(aros_kernel_ldflags)
2676 AC_SUBST(aros_target_cflags)
2677 AC_SUBST(aros_debug_cflags)
2678 AC_SUBST(aros_debug_aflags)
2679 AC_SUBST(aros_debug_ldflags)
2680 AC_SUBST(aros_target_genmap)
2681 AC_SUBST(aros_target_strip_flags)
2682 AC_SUBST(aros_optimization_cflags)
2683 AC_SUBST(aros_isa_flags)
2685 AC_SUBST(crosstools_target)
2686 AC_SUBST(crosstools_cxx_target)
2688 # Delinting target compiler flags
2689 AC_SUBST(aros_cflags_unused_but_set_variable)
2690 AC_SUBST(aros_cflags_array_bounds)
2691 AC_SUBST(aros_cflags_enum_compare)
2692 AC_SUBST(aros_cflags_strict_overflow)
2693 AC_SUBST(aros_cflags_format_security)
2695 # Graphics Related
2696 AC_SUBST(unixgfx_hidd_target)
2697 AC_SUBST(sdl_hidd_target)
2698 AC_SUBST(pci_hidd_target)
2699 AC_SUBST(oss_library_target)
2701 AC_SUBST(aros_default_wbwidth)
2702 AC_SUBST(aros_default_wbheight)
2703 AC_SUBST(aros_default_wbdepth)
2704 AC_SUBST(DO_XSHM_SUPPORT)
2705 AC_SUBST(DO_VIDMODE_SUPPORT)
2707 AC_SUBST(aros_host_x11_includes)
2708 AC_SUBST(aros_host_x11_libdirs)
2709 AC_SUBST(aros_host_sdl_cflags)
2710 AC_SUBST(aros_host_sdl_libs)
2712 # Native version related
2713 AC_SUBST(aros_serial_debug)
2715 # Palm native version related
2716 AC_SUBST(aros_palm_debug_hack)
2718 # Unix/Hosted version related
2719 AC_SUBST(aros_nesting_supervisor)
2721 # MMU related
2722 AC_SUBST(aros_enable_mmu)
2724 # Apple iOS related
2725 AC_SUBST(aros_ios_platform)
2726 AC_SUBST(aros_ios_version)
2727 AC_SUBST(aros_ios_sdk)
2729 # ARM default GCC target related
2730 AC_SUBST(gcc_default_cpu)
2731 AC_SUBST(gcc_default_cpu_tune)
2732 AC_SUBST(gcc_default_fpu)
2733 AC_SUBST(gcc_default_float_abi)
2735 # Android related
2736 AC_SUBST(android_tool)
2737 AC_SUBST(aros_android_level)
2738 AC_SUBST(aros_android_antapk)
2740 # DBUS related
2741 AC_SUBST(ENABLE_DBUS)
2742 AC_SUBST(DBUS_CFLAGS)
2743 AC_SUBST(DBUS_LIBFLAGS)
2744 AC_SUBST(KERNEL_DBUS_KOBJ)
2745 AC_SUBST(KERNEL_DBUS_INCLUDES)
2747 #X11 related
2748 AC_SUBST(ENABLE_X11)
2750 # Debug related
2751 AC_SUBST(aros_debug)
2752 AC_SUBST(aros_mungwall_debug)
2753 AC_SUBST(aros_stack_debug)
2754 AC_SUBST(aros_modules_debug)
2756 # Collect-aros stuff: "-ius" to ignore undefined symbols
2757 AC_SUBST(ignore_undefined_symbols)
2759 # C compiler related
2760 AC_SUBST(gcc_target_cpu)
2761 AC_SUBST(target_gcc_version)
2763 #ObjC compiler related
2764 AC_SUBST(objc_target)
2766 # USB3.0 code
2767 AC_SUBST(aros_usb30_code)
2769 dnl Prepare for output, make up all the generated patches
2770 case "$aros_flavour" in
2771 emulation)      aros_flavour_uc="AROS_FLAVOUR_EMULATION"
2772                 aros_flavour="emulation" ;;
2773 emulcompat)     aros_flavour_uc="(AROS_FLAVOUR_EMULATION|AROS_FLAVOUR_BINCOMPAT)"
2774                 aros_flavour="emulation" ;;
2775 standalone)     aros_flavour_uc="AROS_FLAVOUR_STANDALONE"
2776                 aros_flavour="standalone";;
2777 standcompat)    aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_BINCOMPAT)"
2778                 aros_flavour="standalone";;
2779 native)         aros_flavour_uc="AROS_FLAVOUR_NATIVE"
2780                 aros_flavour="native" ;;
2781 nativecompat)   aros_flavour_uc="(AROS_FLAVOUR_NATIVE|AROS_FLAVOUR_BINCOMPAT)"
2782                 aros_flavour="native" ;;
2783 linklib)        aros_flavour_uc="AROS_FLAVOUR_LINKLIB"
2784                 aros_flavour="linklib" ;;
2785 palmnative)     aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
2786                 aros_flavour="palmnative" ;;
2787 mac68knative)   aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
2788                 aros_flavour="mac68knative" ;;
2789 ppcnative)      aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_BINCOMPAT)"
2790                 aros_flavour="ppcnative" ;;
2791 esac
2793 if test ! -d ${aros_inc_dir} ; then
2794     ${MKDIR} ${aros_inc_dir}
2796 if test ! -d ${aros_geninc_dir} ; then
2797     ${MKDIR} ${aros_geninc_dir}
2799 if test ! -d ${aros_hostcfg_dir} ; then
2800     ${MKDIR} ${aros_hostcfg_dir}
2802 if test ! -d ${aros_targetcfg_dir} ; then
2803     ${MKDIR} ${aros_targetcfg_dir}
2805 if test ! -d ${aros_tools_dir} ; then
2806     ${MKDIR} ${aros_tools_dir}
2808 if test ! -d ${aros_scripts_dir} ; then
2809     ${MKDIR} ${aros_scripts_dir}
2812 AC_CONFIG_HEADERS(${aros_geninc_dir}/host-conf.h:config/host-conf.h.in)
2814 AC_CONFIG_COMMANDS([compiler_executable],
2815     [
2816         prefix=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}
2817         mkdir -p $prefix
2818         prefix2=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros
2819         prefix3=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-elf
2821         echo ${prefix2}
2822         echo ${prefix3}
2823         chmod a+x ${prefix2}-gcc ${prefix2}-g++ ${prefix2}-ld ${prefix2}-cpp ${prefix3}-gcc
2825         ln -sf $orig_target_as$aros_host_exe_suffix      ${prefix2}-as$aros_host_exe_suffix
2826         ln -sf $orig_target_nm$aros_host_exe_suffix      ${prefix2}-nm$aros_host_exe_suffix
2827         ln -sf $orig_target_ar$aros_host_exe_suffix      ${prefix2}-ar$aros_host_exe_suffix
2828         ln -sf $orig_target_ranlib$aros_host_exe_suffix  ${prefix2}-ranlib$aros_host_exe_suffix
2829         ln -sf $orig_target_objcopy$aros_host_exe_suffix ${prefix2}-objcopy$aros_host_exe_suffix
2830         ln -sf $orig_target_objdump$aros_host_exe_suffix ${prefix2}-objdump$aros_host_exe_suffix
2831         ln -sf $orig_target_strip$aros_host_exe_suffix   ${prefix2}-strip$aros_host_exe_suffix
2833         ln -sf $aros_kernel_ld$aros_host_exe_suffix         ${prefix3}-ld$aros_host_exe_suffix
2834     ],
2835     [
2836         aros_host_exe_suffix=${aros_host_exe_suffix}
2837         aros_tools_dir=${aros_tools_dir}
2838         aros_target_cpu=${aros_target_cpu}
2839         aros_target_arch=${aros_target_arch}
2840         aros_target_suffix=${aros_target_suffix}
2841         orig_target_nm=${orig_target_nm}
2842         orig_target_as=${orig_target_as}
2843         orig_target_ar=${orig_target_ar}
2844         orig_target_ranlib=${orig_target_ranlib}
2845         orig_target_objdump=${orig_target_objdump}
2846         orig_target_objcopy=${orig_target_objcopy}
2847         orig_target_strip=${orig_target_strip}
2848         aros_kernel_ld=${aros_kernel_ld}
2849     ]
2851 AC_CONFIG_COMMANDS([genmf_executable],
2852     [chmod a+x ${aros_tools_dir}/genmf.py],
2853     [aros_tools_dir=${aros_tools_dir}]
2856 AC_CONFIG_FILES(
2857     Makefile
2858     config/make.cfg
2859     ${aros_inc_dir}/config.h:config/config.h.in
2860     ${aros_geninc_dir}/config.h:config/config.h.in
2861     ${aros_hostcfg_dir}/host.cfg:config/host.cfg.in
2862     ${aros_targetcfg_dir}/target.cfg:config/target.cfg.in
2863     mmake.config
2864     ${aros_targetcfg_dir}/make.defaults:config/make.defaults.in
2865     ${aros_targetcfg_dir}/specs:config/specs.in
2866     ${aros_targetcfg_dir}/elf-specs:${elf_specs_in}
2867     ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-cpp:scripts/aros-cpp.in
2868     ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-gcc:scripts/aros-gcc.in
2869     ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-g++:scripts/aros-g++.in
2870     ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-elf-gcc:scripts/elf-gcc.in
2871     ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-ld:scripts/aros-ld.in
2872     ${aros_tools_dir}/genmf.py:tools/genmf/genmf.py
2873     tools/collect-aros/env.h
2874     ${aros_gendir}/arch/all-android/bootstrap/app/default.properties:arch/all-android/bootstrap/app/default.properties.in
2877 AC_OUTPUT
2879 dnl This is in order to not define SHARED_CFLAGS sometimes
2880 dnl We don't always do aros_shared_ar, aros_shared_cflags
2882 #XXX compatability...
2883 aros_shared_ar="$aros_shared_ld $aros_shared_ldflags -o"
2885 if test -n "$aros_shared_cflags" ; then
2886     echo "SHARED_CFLAGS := $aros_shared_cflags" >> ${aros_hostcfg_dir}/host.cfg
2887     echo "SHARED_AR := $aros_shared_ar" >> ${aros_hostcfg_dir}/host.cfg