cpu.resource(pc-i386) Get this compile again, with acpica.library
[AROS.git] / configure.in
blobcb0c9d2f4b3f127080919bbfdfd1bd8684e9d2d5
1 dnl Copyright © 1997-2012, 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         android_build_os="darwin-x86"
235         android_tool="android"
236         default_android_sdk="/android-sdk-mac_x86"
237         case "$host_cpu" in
238             *i?86*)
239                 aros_host_cpu="i386"
240                 ;;
241             *x86_64*)
242                 aros_host_cpu="x86_64"
243                 ;;
244             *powerpc*)
245                 aros_host_cpu="ppc"
246                 ;;
247             *)
248                 AC_MSG_WARN("Unknown CPU for Darwin host -- $host_cpu")
249                 aros_host_cpu="$host_cpu"
250                 ;;
251         esac
253         aros_host_ldflags="$aros_host_ldflags -liconv"
255         ;;
257     dragonfly*)
258         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
259         aros_host_make="gmake"
260         aros_host_arch="dragonfly"
261         case $host_cpu in
262             *i?86*)
263                 aros_host_cpu="i386"
264                 ;;
265             *amd64*)
266                 aros_host_cpu="x86_64"
267                 ;;
268             *)
269                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
270                 aros_host_cpu="$host_cpu"
271                 ;;
272         esac
273         ;;
275     netbsd*)
276         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
277         aros_host_make="gmake"
278         aros_host_arch="netbsd"
279         case "$host_cpu" in
280             *i?86*)
281                 aros_host_cpu="i386"
282                 ;;
283             *m68k*)
284                 aros_host_cpu="m68k"
285                 ;;
286             *)
287                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
288                 aros_host_cpu="$host_cpu"
289                 ;;
290         esac    
291         aros_host_lib_suffix=".0.0"
292         ;;
294     openbsd*)
295         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
296         aros_host_make="gmake"
297         aros_host_arch="openbsd"
298         case "$host_cpu" in
299             *i?86*)
300                 aros_host_cpu="i386"
301                 ;;
302             *)
303                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
304                 aros_host_cpu="$host_cpu"
305                 ;;
306         esac
307         ;;
308         
309     solaris*)
310         aros_host_arch="solaris"
311         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
312         case "$host_cpu" in
313             *i?86*)
314                 aros_host_cpu="i386"
315                 ;;
316             *sparc*)
317                 aros_host_cpu="sparc"
318                 ;;
319             *)
320                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
321                 aros_host_cpu="$host_cpu"
322                 ;;
323         esac
324         ;;
326     morphos*)
327         aros_host_arch="morphos"
328         aros_host_cpu="ppc"
329         host_cc_elf=no
330         ;;
332     amiga*)
333         aros_host_arch="amiga"
334         host_cc_elf=no
335         SORT="/gg/bin/sort"
336         TEST="/gg/bin/test"
337         UNIQ="/gg/bin/uniq"
338         FOR="for"
339         TOUCH="/gg/bin/touch"
340         case "$host_cpu" in
341             *m68k*)
342                 aros_host_cpu="m68k"
343                 ;;
344             *powerpc*)
345                 aros_host_cpu="ppc"
346                 ;;
347             *)
348                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
349                 aros_host_cpu="$host_cpu"
350                 ;;
351         esac
352         ;;
354     cygwin*)
355         aros_host_arch="cygwin"
356         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
357         host_cc_elf=no
358         android_build_os="windows"
359         android_tool="android.bat"
360         default_android_sdk="/cygdrive/c/android-sdk-windows-1.6_r1"
362         case "$host_cpu" in
363             *i?86*)
364                 aros_host_cpu="i386"
365                 ;;
366             *)
367                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
368                 aros_host_cpu="$host_cpu"
369                 ;;
370         esac
371         ;;
373     mingw32*)
374         aros_host_arch="mingw32"
375         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
376         host_cc_elf=no
377         android_build_os="windows"
378         android_tool="android.bat"
379         default_android_sdk="/c/android-sdk-windows-1.6_r1"
381         case "$host_cpu" in
382         *i?86*)
383             dnl Currently there's neither 64-bit MinGW nor MSYS. Both environments are 32-bit
384             dnl and run under emulation. Consequently, uname reports i386 even on 64-bit systems.
385             dnl Here we attempt to detect Windows home platform by asking gcc about its target.
386             dnl 64-bit gcc will output "x86_64-w64-mingw32" here.
388             AC_MSG_CHECKING([for Windows native gcc target])
389             host_cpu=`gcc -dumpmachine`
390             AC_MSG_RESULT($host_cpu)
391             ;;
393         esac
395         case "$host_cpu" in
396         *i?86*)
397             aros_host_cpu="i386"
398             ;;
400         mingw32*)
401             dnl Native i386 gcc for MinGW32 reports 'mingw32' with -dumpmachine switch
402             aros_host_cpu="i386"
403             ;;
405         *x86_64*)
406             aros_host_cpu="x86_64"
407             dnl Dragon's x86_64-w64-mingw32-gcc is a bit broken. It ignores standard $prefix/include
408             dnl directory, so we have to add it explicitly here.
409             aros_host_cflags="$aros_host_cflags -isystem /mingw/include"
410             ;;
412         *)
413             AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
414             aros_host_cpu="$host_cpu"
415             ;;
416         esac
417         ;;
418     *)
419         AC_MSG_ERROR([Unsupported host architecture $host])
420         ;;
421 esac
423 AROS_PROG(aros_host_ar,[ar],[cr])
424 AROS_REQUIRED(ar,$aros_host_ar)
425 AROS_PROG(aros_host_ranlib,ranlib)
426 AROS_REQUIRED(ranlib,$aros_host_ranlib)
427 AROS_PROG(aros_host_strip,strip)
428 AROS_REQUIRED(strip,$aros_host_strip)
430 AROS_PROG(RM,[rm],[-rf])
431 AROS_REQUIRED(rm,$RM)
432 AROS_PROG(CP,[cp])
433 AROS_REQUIRED(cp,$CP)
434 AROS_PROG(MV,[mv])
435 AROS_REQUIRED(mv,$MV)
436 AROS_PROG(ECHO,[echo])
437 AROS_REQUIRED(echo,$ECHO)
438 AROS_PROG(MKDIR,[mkdir],[-p])
439 AROS_REQUIRED(mkdir,$MKDIR)
440 AROS_PROG(TOUCH,[touch])
441 AROS_REQUIRED(touch,$TOUCH)
442 AROS_PROG(SORT,[sort])
443 AROS_REQUIRED(sort,$SORT)
444 AROS_PROG(UNIQ,[uniq])
445 AROS_REQUIRED(uniq,$UNIQ)
446 AROS_PROG(NOP,[true])
447 AROS_REQUIRED(true,$NOP)
448 AROS_PROG(CAT,[cat])
449 AROS_REQUIRED(cat,$CAT)
450 AROS_PROG(BISON,[bison])
451 AROS_REQUIRED(bison,$BISON)
452 AROS_PROG(FLEX,[flex])
453 AROS_REQUIRED(flex,$FLEX)
454 AROS_PROG(PNGTOPNM,[pngtopnm])
455 AROS_REQUIRED(pngtopnm,$PNGTOPNM)
456 AROS_PROG(PPMTOILBM,[ppmtoilbm])
457 AROS_REQUIRED(ppmtoilbm,$PPMTOILBM)
458 AROS_PROG(SED,[sed])
459 AROS_REQUIRED(sed,$SED)
460 AROS_PROG(CHMOD,[chmod])
461 AROS_REQUIRED(chmod,$CHMOD)
462 AROS_PROG(PATCH,[patch])
463 AROS_REQUIRED(patch,$PATCH)
465 AM_PATH_PYTHON(2.5)
467 AC_CHECK_LIB(png, png_read_png)
468 AROS_REQUIRED(libpng, $ac_cv_lib_png_png_read_png)
470 AC_SUBST(FOR, for)
471 AC_SUBST(IF, if)
472 AC_SUBST(TEST, test)
473 AC_SUBST(CMP, cmp)
475 dnl ---------------------------------------------------------------------------
476 dnl Look for things about the host system, good for hosted targets.
477 dnl ---------------------------------------------------------------------------
479 # Check for some includes for the X11 HIDD and the kernel
480 AC_CHECK_HEADERS([sys/ipc.h sys/shm.h \
481     sys/mmap.h sys/mman.h sysexits.h \
482     sys/statfs.h sys/statvfs.h sys/vfs.h sys/param.h \
485 AC_CHECK_HEADERS([sys/mount.h],,,[#include <sys/param.h>])
487 AC_HEADER_DIRENT
488 AC_HEADER_STAT
489 AC_HEADER_STDC
490 AC_HEADER_SYS_WAIT
491 AC_HEADER_TIME
492 AC_STRUCT_ST_BLKSIZE
493 AC_STRUCT_ST_BLOCKS
494 AC_STRUCT_ST_RDEV
495 AC_STRUCT_TM
496 AC_STRUCT_TIMEZONE
497 AC_TYPE_OFF_T
498 AC_TYPE_PID_T
499 AC_TYPE_SIZE_T
500 AC_TYPE_UID_T
502 AC_CHECK_MEMBERS(struct tm.tm_gmtoff)
504 # Look for some functions
505 AC_CHECK_FUNCS([getpagesize kqueue statfs statvfs \
506     clone kse_create rfork_thread thr_create sa_register \
507     getcontext makecontext setcontext sigaltstack swapcontext])
509 AC_FUNC_MMAP
512 dnl --------------------------------------------------------------------
513 dnl Target Configuration Section
514 dnl --------------------------------------------------------------------
516 dnl The target configuration section is responsible for setting up all
517 dnl the paths for includes, and tools required to build AROS to some
518 dnl particular target.
520 aros_config_cflags="-Wall -Werror-implicit-function-declaration"
521 aros_config_aflags="-Wall -x assembler-with-cpp -c"
522 aros_config_ldflags=""
524 aros_shared_default=yes
526 aros_shared_cflags="-fPIC"
527 aros_shared_aflags=""
528 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
529 aros_kernel_ldflags="-Wl,-rpath,./lib"
531 aros_kernel_ar_flags="cr"
532 aros_target_ar_flags="cr"
533 aros_target_nm_flags="-C -ul"
534 aros_target_strip_flags="--strip-unneeded -R.comment"
536 aros_compiler_libs=
537 aros_arch_libs=
539 aros_target_genmap="-Wl,-Map -Xlinker"
541 # Native flavour stuff
542 aros_serial_debug="0"
544 # Palm native flavour stuff
545 aros_palm_debug_hack="0"
547 # Unix flavour stuff
548 aros_nesting_supervisor="0"
550 # Collect-aros stuff: "-ius" to ignore undefined symbols
551 ignore_undefined_symbols=""
553 # Check for X11 by default
554 need_x11="auto"
556 #-----------------------------------------------------------------------------
559 # GCC 4.1+ has a stack protection feature that requires OS support. Ubuntu has
560 # it switched on by default, and we use the host compiler, so it compiles AROS
561 # code with this enabled resulting in link failures as we don't have support
562 # for it.
564 # We use two methods to disable it. For the host compiler (used to compile
565 # some hosted modules), we test to see if the compiler supports stack
566 # protection, and if it does we disable it in AROS_CONFIG_CFLAGS. This should
567 # work on all platforms.
569 # For the "cross" compiler we clear the "ssp_default" spec in config/specs.in
570 # (this is done unconditionally, as it should have no effect on compilers
571 # without the stack protection feature). This may be specific to the way that
572 # Ubuntu enables the feature, so may not work everywhere. My specs-fu isn't
573 # strong enough to disable it in a generic way though, so we'll live with it
574 # until another vendor ships GCC with it enabled in a different way, and deal
575 # with it then.
578 AC_MSG_CHECKING([whether ${CC} accepts -fno-stack-protector])
579 save_cflags="$CFLAGS"
580 CFLAGS="$CFLAGS -fno-stack-protector"
581 AC_TRY_COMPILE(,, use_no_stack_protector="yes", use_no_stack_protector="no")
582 AC_MSG_RESULT($use_no_stack_protector)
583 if test "x-$use_no_stack_protector" = "x-yes" ; then
584     aros_host_cflags="$aros_host_cflags -fno-stack-protector"
586 CFLAGS="$save_cflags"
588 #-----------------------------------------------------------------------------
590 # Disable pointer-signedness warnings if the compiler recognises the option
591 # (this only works for the host compiler at the moment)
593 AC_MSG_CHECKING([whether ${CC} accepts -Wno-pointer-sign])
594 save_cflags="$CFLAGS"
595 CFLAGS="$CFLAGS -Wno-pointer-sign"
596 AC_TRY_COMPILE(,, use_no_sign_warning="yes", use_no_sign_warning="no")
597 AC_MSG_RESULT($use_no_sign_warning)
598 if test "x-$use_no_sign_warning" = "x-yes" ; then
599     aros_host_cflags="$aros_host_cflags -Wno-pointer-sign"
601 CFLAGS="$save_cflags"
603 #-----------------------------------------------------------------------------
605 # Check if host compiler supports -fgnu89-inline, can be needed for crosstools.
607 AC_MSG_CHECKING([whether ${CC} accepts -fgnu89-inline])
608 save_cflags="$CFLAGS"
609 CFLAGS="$CFLAGS -fgnu89-inline"
610 AC_TRY_COMPILE(,, use_gnu89_inline="yes", use_gnu89_inline="no")
611 AC_MSG_RESULT($use_gnu89_inline)
612 if test "x-$use_gnu89_inline" = "x-yes" ; then
613     gnu89_inline="-fgnu89-inline"
615 CFLAGS="$save_cflags"
617 #-----------------------------------------------------------------------------
619 AC_MSG_CHECKING([for type of build])
620 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")
622 if test "$build_type" = "nightly"; then
623     build_type_string="NIGHTLY"
624 elif test "$build_type" = "snapshot"; then
625     build_type_string="SNAPSHOT"
626 elif test "$build_type" = "milestone"; then
627     build_type_string="MILESTONE"
628 elif test "$build_type" = "release"; then
629     build_type_string="RELEASE"
630 else
631     build_type_string="PERSONAL"
632     build_type="personal"
635 aros_config_cflags="$aros_config_cflags -DAROS_BUILD_TYPE=AROS_BUILD_TYPE_$build_type_string"
637 AC_MSG_RESULT($build_type)
639 #-----------------------------------------------------------------------------
640 all_debug_types="messages stack modules mungwall symbols"
642 AC_MSG_CHECKING([which debug types to enable])
643 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)]),
644  debug="$enableval",debug="")
646 if test "$debug" = "" -o "$debug" = "no"; then
647     debug="none"
648 elif test "$debug" = "yes"; then
649     debug="all"
652 if test "$debug" = "all" ; then
653     debug="messages stack modules symbols"
654     for d in $all_debug_types; do
655         export aros_${d}_debug="1"
656     done
657 else
658     for d in $all_debug_types; do
659         export aros_${d}_debug="0"
660     done
663 if test "$debug" != "none"; then
664     debug=`echo $debug | sed s/,/\ /g`
665     for d in $debug; do
666         found="0"
667         for d2 in $all_debug_types; do
668             if test "$d2" = "$d"; then
669                 found="1"
670                 break
671             fi
672         done
673         if test "$found" = "0"; then
674             AC_MSG_ERROR([unrecognized debug type "$d". Available types are: all none $all_debug_types])
675         fi
676         export aros_${d}_debug="1"
677     done
678     aros_debug="yes"
680 AC_MSG_RESULT($debug)
682 if test "$aros_messages_debug" = "1"; then
683     aros_messages_debug="-DADEBUG=1 -DMDEBUG=1"
684 else
685     aros_messages_debug=""
687 if test "$aros_symbols_debug" = "1"; then
688     aros_symbols_debug="-g"
689 else
690     aros_symbols_debug=""
693 # These are the flags to pass when compiling debugged programs
694 aros_debug_cflags="$aros_symbols_debug $aros_messages_debug"
695 aros_debug_aflags=""
696 aros_debug_ldflags="$aros_symbols_debug"
698 #-----------------------------------------------------------------------------
699 #   Checking for distcc and ccache.
701 #   Always apply the transforms in this particular order. Basically you should
702 #   always run 'ccache distcc compiler' in that order for the best performance.
704 AC_MSG_CHECKING([whether to enable distcc])
705 AC_ARG_ENABLE(distcc,AC_HELP_STRING([--enable-distcc],[Use distcc as a front end to the compiler (default=no).]),distcc="$enableval",distcc="no")
706 if test "$distcc" != "" -a "$distcc" != "no"; then
707     # AC_CHECK_PROG will print out the result in this case
708     AC_PATH_PROG(DISTCC,[distcc],distcc,)
709 else
710     AC_MSG_RESULT(no)
713 AC_MSG_CHECKING([whether to enable ccache])
714 AC_ARG_ENABLE(ccache,AC_HELP_STRING([--enable-ccache],[Use ccache as a front end to the compiler (default=no).]),ccache="$enableval",ccache="no")
715 if test "$ccache" != "" -a "$ccache" != "no"; then
716     # AC_CHECK_PROG will print out the result in this case
717     AC_CHECK_PROG(CCACHE,[ccache],ccache,)
718 else
719     AC_MSG_RESULT(no)
722 #-----------------------------------------------------------------------------
723 AC_MSG_CHECKING([what specific host gcc version to use])
724 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="")
725 AC_MSG_RESULT($kernel_tool_version)
727 #-----------------------------------------------------------------------------
728 AC_MSG_CHECKING([what specific target gcc version to use])
729 AC_ARG_WITH(gcc-version,AC_HELP_STRING([--with-gcc-version=VERSION],[Use gcc-VERSION for building AROS]),target_tool_version="$withval",target_tool_version="")
730 AC_MSG_RESULT($target_tool_version)
732 #-----------------------------------------------------------------------------
733 AC_MSG_CHECKING([what optimization flags to use])
734 AC_ARG_WITH(optimization,AC_HELP_STRING([--with-optimization=FLAGS],[Use optimization flags FLAGS (default=-O2).]),optimization="$withval",optimization="unknown")
735 if test "$optimization" = "unknown"; then
736     dnl default is -O2 for normal builds, -O0 for debug builds
737     if test "$debug" != "none"; then
738         optimization="-O0"
739     else
740         optimization="-O2"
741     fi
743 aros_config_cflags="$aros_config_cflags $optimization"
744 AC_MSG_RESULT($optimization)
746 #-----------------------------------------------------------------------------
747 AC_MSG_CHECKING([what paranoia flags to use])
748 AC_ARG_WITH(paranoia,AC_HELP_STRING([--with-paranoia=FLAGS],[CC flags to enable paranoia]),[paranoia_flags="$withval"],[paranoia_flags="default"])
749 if test "$paranoia_flags" = "default"; then
750         paranoia_flags=""
751 else if test "$paranoia_flags" = "yes"; then
752         paranoia_flags="-Wall -Werror"
753 fi fi
754 AC_MSG_RESULT($paranoia_flags)
755 aros_config_cflags="$aros_config_cflags $paranoia_flags"
757 #-----------------------------------------------------------------------------
758 AC_MSG_CHECKING([what target variant to enable])
759 AC_ARG_ENABLE(target_variant,AC_HELP_STRING([--enable-target-variant=NAME],[Enable a specific target variant(default=none)]),target_variant=$enableval,target_variant="")
760 if test "$target_variant" = ""; then
761     aros_target_variant=""
762     aros_target_suffix=""
763     enableval="none"
764 else
765     aros_target_variant="$target_variant"
766     aros_target_suffix="-$target_variant"
768 AC_MSG_RESULT($enableval)
770 #-----------------------------------------------------------------------------
771 # Target-specific defaults. You can override then on a per-target basis.
773 # Bootloader name. Currently used by PC target.
774 target_bootloader="none"
776 #-----------------------------------------------------------------------------
777 # Additional options for some specific targets
779 case "$aros_target_variant" in
780 ios)
781     AC_MSG_CHECKING([XCode path])
782     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")
783     AC_MSG_RESULT($aros_xcode_path)
785     AC_MSG_CHECKING([what iOS SDK version to use])
786     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")
787     AC_MSG_RESULT($aros_sdk_version)
789     ;;
791 "android")
792     AC_MSG_CHECKING([Android SDK path])
793     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)
794     AC_MSG_RESULT($aros_android_sdk)
796     AC_MSG_CHECKING([Android NDK path])
797     AC_ARG_WITH(ndk,AC_HELP_STRING([--with-ndk=PATH],[Specify Android NDK path (default=none).]),aros_android_ndk="$withval",aros_android_ndk="none")
798     AC_MSG_RESULT($aros_android_ndk)
800     AC_MSG_CHECKING([what Android SDK version to use])
801     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")
802     AC_MSG_RESULT($aros_sdk_version)
804     if test "$aros_android_ndk" != "none"; then
805         AC_MSG_CHECKING([what Android NDK version to use])
806         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")
807         AC_MSG_RESULT($aros_ndk_version)
808     fi
810     export PATH="$aros_android_sdk/tools:$PATH"
811     AC_PATH_PROG(android_tool, $android_tool)
812     AROS_REQUIRED(android,$android_tool)
814     aros_android_level=android-$aros_sdk_version
815     if test ! -d $aros_android_sdk/platforms/$aros_android_level; then
816         echo "Platform $aros_android_level is not installed in your SDK"
817         echo "Use --with-sdk-version=<API level number> to select another platform version"
818         echo "You can check what plaform versions are installed in your SDK"
819         echo "by examining contents of $aros_android_sdk/platforms directory"
820         AC_MSG_ERROR([Android platform $aros_android_level is not installed])
821     fi
823     AC_PATH_PROG(ant, ant)
824     if test "$ant" = ""; then
825         AC_MSG_WARN([Apache Ant is missing, Java bootstrap can't be built automatically])
826     fi
828     AC_MSG_CHECKING([Build debug or release apk])
829     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)
830     if test $aros_android_antapk != release -a $aros_android_antapk != debug; then
831         AC_MSG_ERROR([apk-version has to be release or debug])
832     fi
833     AC_MSG_RESULT($aros_android_antapk)
835     dnl MSYS bash can't run .bat files directly, then need to be started via cmd.exe
836     if test "$host_os" = "mingw32"; then
837         android_tool="cmd //c $android_tool"
838     fi
840     ;;
841 esac
843 #-----------------------------------------------------------------------------
844 # External toolchains
845 kernel_tool_prefix="none"
846 aros_tool_prefix="none"
847 elf_tool_prefix="${target_cpu}-elf-"
849 # This is the target configuration switch.
850 case "$target_os" in
851     linux*)
852         aros_target_arch="linux"
853         aros_target_family="unix"
854         case "$target_cpu" in
855             *m68k*)
856                 aros_target_cpu="m68k"
857                 aros_object_format="m68kelf"
858                 aros_flavour="emulcompat"
859                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D__mc68000 -D__linux__"
860                 aros_shared_ldflags="-Wl,-T,\$(TOP)/config/linux/m68k/script.so"
861                 aros_kernel_ldflags="-Wl,-rpath,./lib,-T,\$(TOP)/config/linux/m68k/script.normal"
862                 gcc_target_cpu="mc68000"
863                 ;;
864             *i?86*)
865                 aros_target_cpu="i386"
866                 aros_object_format="elf_i386"
867                 aros_flavour="emulation"
868                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__linux__"
869                 aros_config_cflags="$aros_config_cflags -m32 -march=i486"
870                 aros_kernel_cflags="$aros_kernel_cflags -m32 -march=i486"
871                 aros_config_aflags="$aros_config_aflags -m32 -march=i486"
872                 aros_config_ldflags="-m32 -march=i486"
873                 aros_kernel_ldflags="-Wl,-melf_i386"
874                 aros_default_wbdepth=8
875                 gcc_target_cpu="i386"
876                 pci_hidd_target="hidd-pci-linux"
877                 android_tool_dir_prefix="x86"
878                 android_tool_prefix="i686-android-linux"
879                 android_ndk_arch="x86"
880                 ;;
881             *x86_64*)
882                 aros_target_cpu="x86_64"
883                 aros_object_format="elf_x86_64"
884                 aros_flavour="emulation"
885                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64 -D__linux__"
886                 aros_config_cflags="$aros_config_cflags -mno-red-zone -fno-omit-frame-pointer"
887                 aros_default_wbdepth=8
888                 pci_hidd_target="hidd-pci-linux"
889                 ;;
890             *powerpc*)
891                 aros_target_cpu="ppc"
892                 aros_object_format="elf32ppc"
893                 aros_flavour="emulation"
894                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc -D__linux__"
895                 aros_default_wbdepth=8
896                 gcc_target_cpu="ppc"
897                 ;;
898 # TODO
899 # Same as powerpc, but I need this for the nightly build to work again.
900 # Actually, the nightly should be made working with powerpc target.
901 # That just was too much work for the moment, another week or two.
902             *ppc*)
903                 aros_target_cpu="ppc"
904                 aros_object_format="elf32ppc"
905                 aros_flavour="emulation"
906                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc -D__linux__"
907                 aros_default_wbdepth=8
908                 gcc_target_cpu="ppc"
909                 ;;
910             *armhf*)
911                 aros_target_cpu="arm"
912                 target_cpu="arm"
913                 aros_object_format="armelf_aros"
914                 aros_flavour="emulation"
915                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm -D__linux__"
916                 gcc_target_cpu="arm"
917                 aros_config_cflags="$aros_config_cflags -fno-strict-aliasing -fno-omit-frame-pointer"
918                 aros_config_aflags="$aros_config_aflags -fno-strict-aliasing"
919                 aros_arch_libs="-laeabi"
920                 gcc_default_float_abi="hard"
921                 android_tool_dir_prefix="arm-linux-androideabi"
922                 android_tool_prefix="arm-linux-androideabi"
923                 android_ndk_arch="arm"
924                 kernel_tool_prefix="arm-linux-gnueabihf-"
925                 ;;
926             *arm*)
927                 aros_target_cpu="arm"
928                 aros_object_format="armelf_aros"
929                 aros_flavour="emulation"
930                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm -D__linux__"
931                 gcc_target_cpu="arm"
932                 aros_config_cflags="$aros_config_cflags -fno-strict-aliasing -fno-omit-frame-pointer"
933                 aros_config_aflags="$aros_config_aflags -fno-strict-aliasing"
934                 aros_arch_libs="-laeabi"
935                 android_tool_dir_prefix="arm-linux-androideabi"
936                 android_tool_prefix="arm-linux-androideabi"
937                 android_ndk_arch="arm"
938                 kernel_tool_prefix="arm-linux-gnueabi-"
939                 ;;
940             *)
941                 AC_MSG_ERROR("Unknown CPU for Linux -- $target_cpu")
942                 ;;
943         esac
944         case "$aros_target_variant" in
945             android)
947                 dnl Not all Linux CPUs are supported by Android
948                 if test "$android_ndk_arch" = ""; then
949                     AC_MSG_ERROR("Unsupported CPU for Android -- $target_cpu")
950                 fi
952                 aros_default_wbwidth=320
953                 aros_default_wbheight=480
954                 if test "$aros_android_ndk" = "none"; then
955                     dnl Use standalone toolchain, don't adjust paths
956                     aros_kernel_cflags="-mandroid"
957                     aros_kernel_ldflags="-mandroid"
958                     CFLAGS="-mandroid"
959                 else
960                     dnl In Android NDK toolchains are placed in own directories,
961                     dnl but tool names are not suffixed with version 
962                     export PATH="$aros_android_ndk/toolchains/$android_tool_dir_prefix-$kernel_tool_version/prebuilt/$android_build_os/bin:$PATH"
963                     kernel_tool_version=""
964                     aros_android_ndk="$aros_android_ndk/platforms/android-$aros_ndk_version/arch-$android_ndk_arch"
965                     aros_kernel_cflags="--sysroot $aros_android_ndk -mandroid"
966                     aros_kernel_ldflags="--sysroot $aros_android_ndk -mandroid"
967                     CFLAGS="$CFLAGS --sysroot $aros_android_ndk -mandroid"
968                     aros_kernel_includes="-isystem $aros_android_ndk/usr/include"
969                 fi
970                 need_x11=no
971                 unixgfx_hidd_target=kernel-hidd-androidgfx
972                 # Disable implicit PIC mode
973                 aros_target_cflags="$aros_target_cflags -fno-pic"
974                 kernel_tool_prefix="$android_tool_prefix-"
975             ;;
976         esac
977     ;;
979     pc)
980         aros_target_arch="pc"
981         aros_shared_default="no"
982         target_bootloader="grub2"
983         case "$target_cpu" in
984             *i?86*)
985                 aros_target_cpu="i386"
987                 dnl If somebody hasn't already set the target object
988                 dnl format, then use this value. Mostly to support
989                 dnl FreeBSD cross-compilation.
990                 dnl TODO: Remove when we always use our compiler.
992                 if test "$aros_object_format" = "" ; then
993                     aros_object_format="elf_i386"
994                 fi
995                 aros_flavour="standalone"
996                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
997                 aros_config_cflags="$aros_config_cflags -m32 -march=i486"
998                 aros_kernel_cflags="$aros_kernel_cflags -m32 -march=i486"
999                 aros_config_aflags="$aros_config_aflags -m32 -march=i486"
1000                 aros_config_ldflags="-m32 -march=i486"
1001                 aros_kernel_ldflags="-Wl,-melf_i386"
1002                 aros_default_wbwidth=640
1003                 aros_default_wbheight=480
1004                 gcc_target_cpu="i386"
1005                 ;;
1006             *x86_64*)
1007                 aros_target_cpu="x86_64"
1008                 aros_serial_debug=1
1009                 if test "$aros_object_format" = "" ; then
1010                     aros_object_format="elf_x86_64"
1011                 fi
1012                 aros_flavour="standalone"
1013                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
1014                 aros_config_cflags="$aros_config_cflags -fno-asynchronous-unwind-tables -mno-red-zone -fno-omit-frame-pointer"
1015                 aros_kernel_ldflags=""
1016                 aros_default_wbwidth=640
1017                 aros_default_wbheight=480
1018                 ;;
1019             *)
1020                 AC_MSG_ERROR("Unknown native CPU -- $target_cpu")
1021                 ;;
1022         esac
1023         ;;
1025     prep)
1026         aros_target_arch="prep"
1027         aros_shared_default="no"
1028         aros_target_cpu="ppc"
1029         aros_object_format="elf32ppc"
1030         aros_flavour="ppcnative"
1031         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1032         aros_kernel_ldflags=""
1033         aros_default_wbwidth=640
1034         aros_default_wbheight=480
1035         gcc_target_cpu="ppc"
1036         ;;
1038     freebsd*)
1039         aros_target_arch="freebsd"
1040         aros_target_family="unix"
1041         aros_target_cpu="i386"
1042         aros_flavour="emulation"
1043         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1044         gcc_target_cpu="i386"
1046         aros_target_strip_flags="-x"
1047         ;;
1049     darwin*)
1050         aros_target_arch="darwin"
1051         aros_target_family="unix"
1052         aros_flavour="emulation"
1053         case "$target_cpu" in
1054             *i?86*)
1055                 aros_ios_platform="iPhoneSimulator"
1056                 aros_target_cpu="i386"
1057                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1058                 aros_kernel_ldflags=""
1059                 aros_macosx_version="10.4"
1060                 aros_default_wbdepth=8
1061                 gcc_target_cpu="i386"
1062                 aros_object_format="elf_i386"
1063                 aros_kernel_ar_flags="-cr"
1064                 aros_target_strip_flags="-x"
1065                 kernel_tool_flags="-m32"
1066                 ;;
1067             *x86_64*)
1068                 aros_target_cpu="x86_64"
1069                 aros_object_format="elf_x86_64"
1070                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
1071                 aros_macosx_version="10.6"
1072                 aros_config_cflags="$aros_config_cflags -fno-omit-frame-pointer"
1073                 aros_kernel_cflags="-m64"
1074                 aros_kernel_ldflags="-m64"
1075                 aros_target_cflags="-mcmodel=large"
1076                 aros_default_wbdepth=8
1077                 aros_kernel_ar="ar"
1078                 aros_kernel_ar_flags="-cr"
1079                 aros_kernel_ld="ld"
1080                 aros_kernel_as="as"
1081                 aros_kernel_ranlib="ranlib"
1082                 aros_kernel_nm="nm"
1083                 aros_kernel_strip="strip"
1084                 kernel_tool_prefix="i686-apple-darwin10-"
1085                 ;;
1086             *ppc*)
1087                 aros_target_cpu="ppc"
1088                 aros_object_format="elf32ppc"
1089                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1090                 aros_kernel_ldflags=""
1091                 aros_macosx_version="10.0"
1092                 aros_default_wbdepth=8
1093                 gcc_target_cpu="ppc"
1094                 aros_kernel_ar="ar"
1095                 aros_kernel_ar_flags="-cr"
1096                 aros_kernel_ld="ld -arch ppc"
1097                 aros_kernel_as="as -arch ppc"
1098                 aros_kernel_ranlib="ranlib -arch ppc"
1099                 aros_kernel_nm="nm -arch ppc"
1100                 aros_kernel_strip="strip -arch ppc"
1101                 kernel_tool_prefix="powerpc-apple-darwin10-"
1102                 ;;
1103             *arm*)
1104                 aros_ios_platform="iPhoneOS"
1105                 aros_target_cpu="arm"
1106                 aros_object_format="armelf_aros"
1107                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
1108                 aros_arch_libs="-laeabi"
1109                 aros_default_wbdepth=8
1110                 gcc_target_cpu="arm"
1111                 aros_kernel_ar="ar"
1112                 aros_kernel_ar_flags="-cr"
1113                 aros_kernel_ld="ld -arch arm"
1114                 aros_kernel_ranlib="ranlib -arch arm"
1115                 kernel_tool_prefix="arm-apple-darwin10-" 
1116                 export PATH="$aros_xcode_path/Platforms/$aros_ios_platform.platform/Developer/usr/bin:$PATH"
1117                 ;;
1118             *)
1119                 AC_MSG_ERROR("Unsupported target CPU for darwin hosted flavour -- $target_cpu")
1120                 ;;
1121         esac
1122         case "$aros_target_variant" in
1123             ios)
1124                 aros_ios_version="3.0"
1125                 aros_default_wbwidth=320
1126                 aros_default_wbheight=480
1127                 aros_ios_sdk="$aros_xcode_path/Platforms/$aros_ios_platform.platform/Developer/SDKs/$aros_ios_platform$aros_sdk_version.sdk"
1128                 kernel_tool_flags="$target_tool_flags -isysroot $aros_ios_sdk"
1129                 aros_kernel_includes="-isystem $aros_ios_sdk/usr/include"
1130                 need_x11=no
1131                 # This is here because it may depend on iOS or SDK version
1132                 aros_kernel_cflags="$aros_kernel_cflags -miphoneos-version-min=$aros_ios_version"
1133                 aros_kernel_ldflags="$aros_kernel_ldflags -miphoneos-version-min=$aros_ios_version"
1134                 aros_kernel_objcflags="-fobjc-abi-version=2 -fobjc-legacy-dispatch"
1135             ;;
1136             *)
1137                 aros_kernel_cflags="$aros_kernel_cflags -mmacosx-version-min=$aros_macosx_version"
1138                 aros_kernel_ldflags="$aros_kernel_ldflags -mmacosx-version-min=$aros_macosx_version"
1139             ;;
1140         esac
1141         ;;
1143     dragonfly*)
1144         aros_target_arch="dragonfly"
1145         aros_target_family="unix"
1146         aros_flavour="emulation"
1147         case "$target_cpu" in
1148             *i?86*)
1149                 aros_target_cpu="i386"
1150                 aros_object_format="elf_i386"
1151                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__DragonFly__"
1152                 ;;
1153             *x86_64*)
1154                 aros_config_cflags="$aros_config_cflags -fno-omit-frame-pointer"
1155                 aros_target_cpu="x86_64"
1156                 aros_object_format="elf_x86_64"
1157                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64 -D__DragonFly__"
1158                 ;;
1159             *)
1160                 AC_MSG_ERROR("Unknown CPU for DragonFly -- $target_cpu")
1161                 ;;
1162         esac
1163         ;;
1165     netbsd*)
1166         aros_target_arch="netbsd"
1167         aros_target_family="unix"
1168         case "$target_cpu" in
1169             *m68k*)
1170                 aros_target_cpu="m68k"
1171                 aros_object_format="m68kelf"
1172                 aros_flavour="emulcompat"
1173                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D__mc68000 -D__NetBSD__"
1174                 gcc_target_cpu="mc68000"
1175                 ;;
1176             *i?86*)
1177                 aros_target_cpu="i386"
1178                 aros_object_format="elf_i386"
1179                 aros_flavour="emulation"
1180                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__NetBSD__"
1181                 aros_default_wbdepth=8
1182                 gcc_target_cpu="i386"
1183                 ;;
1184             *)
1185                 AC_MSG_ERROR("Unknown CPU for NetBSD -- $target_cpu")
1186                 ;;
1187         esac
1188         aros_target_genmap="-Wl,-M -Xlinker >"
1189         aros_flavour="emulation"
1190         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1191         ;;   
1193     openbsd*)
1194         aros_target_arch="openbsd"
1195         aros_target_family="unix"
1196         case "$target_cpu" in
1197             *i?86*)
1198                 aros_target_cpu="i386"
1199                 aros_object_format="elf_i386"
1200                 aros_flavour="emulation"
1201                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__OpenBSD__"
1202                 gcc_target_cpu="i386"
1203                 ;;
1204             *)
1205                 AC_MSG_ERROR("Unknown CPU for OpenBSD -- $target_cpu")
1206                 ;;
1207         esac
1208         aros_target_genmap="-Wl,-M -Xlinker >"
1209         aros_target_nm_flags="-u"
1210         aros_flavour="emulation"
1211         ;;
1213     solaris*)
1214         aros_target_arch="solaris"
1215         aros_target_family="unix"
1216         case "$target_cpu" in
1217            *i?86*)
1218                aros_target_cpu="i386"
1219                aros_object_format="elf_i386"
1220                aros_flavour="emulation"
1221                aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__Solaris__"
1222                aros_default_wbdepth=8
1223                gcc_target_cpu="i386"
1224                ;;
1225             *sparc*)
1226                 aros_target_cpu="sparc"
1227                 aros_object_format="elf_sparc"
1228                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dsparc -D__Solaris__"
1229                 gcc_target_cpu="sparc"
1230                 ;;
1231             *)
1232                 AC_MSG_ERROR("Unknown CPU for Solaris -- $target_cpu")
1233                 ;;
1234         esac
1235         aros_config_cflags="$aros_config_cflags -D$aros_target_cpu"
1236         aros_flavour="emulation"
1237         ;;
1239     morphos*)
1240         aros_target_arch="morphos"
1241         aros_shared_default="no"
1242         aros_target_cpu="ppc"
1243         aros_object_format="elf_ppc"
1244         aros_flavour="nativecompat"
1245         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1246         gcc_target_cpu="ppc"
1247         ;;
1249     sam440)
1250         aros_target_arch="sam440"
1251         aros_shared_default="no"
1252         aros_target_cpu="ppc"
1253         aros_object_format="elf32ppc"
1254         aros_flavour="ppcnative"
1255         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1256         aros_kernel_ldflags=""
1257         aros_default_wbwidth=1024
1258         aros_default_wbheight=768
1259         aros_default_wbdepth=24
1260         aros_config_cflags="$aros_config_cflags -mcpu=440fp -mno-toc -fno-asynchronous-unwind-tables"
1261         gcc_target_cpu="powerpc"
1262         ;;
1264     efika)
1265         aros_target_arch="efika"
1266         aros_shared_default="no"
1267         aros_target_cpu="arm"
1268         aros_object_format="armelf_aros"
1269         aros_flavour="standalone"
1270         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
1271         aros_kernel_ldflags=""
1272         aros_default_wbwidth=1024
1273         aros_default_wbheight=600
1274         aros_arch_libs="-laeabi"
1275         gcc_default_cpu="armv7-a"
1276         gcc_default_fpu="vfpv3"
1277         aros_config_cflags="$aros_config_cflags -mtune=cortex-a8 -fno-strict-aliasing -fno-asynchronous-unwind-tables -Os"
1278         aros_config_aflags="$aros_config_aflags -mtune=cortex-a8 -fno-strict-aliasing -fno-asynchronous-unwind-tables -Os"
1279         case "$target_cpu" in
1280             *armhf*)
1281                 gcc_default_float_abi="hard"
1282                 target_cpu=arm
1283                 aros_target_cpu=arm
1284                 ;;
1285             *arm*)
1286                 gcc_default_float_abi="softfp"
1287                 ;;
1288             *)
1289                 AC_MSG_ERROR("Unknown CPU for EfikaMX $target_cpu")
1290                 ;;
1291         esac
1292         ;;
1293         
1294     chrp)
1295     aros_target_arch="chrp"
1296     aros_shared_default="no"
1297     aros_target_cpu="ppc"
1298     aros_object_format="elf32ppc"
1299     aros_flavour="ppcnative"
1300     aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1301     aros_kernel_ldflags=""
1302     aros_default_wbwidth=640
1303     aros_default_wbheight=480
1304     aros_config_cflags="$aros_config_cflags -mno-toc -fno-asynchronous-unwind-tables"    
1305     gcc_target_cpu="powerpc"
1306         case "$aros_target_variant" in
1307             efika)
1308             aros_config_cflags="$aros_config_cflags -DBIG_ENDIAN_OHCI=1 -mcpu=603e"
1309             ;;
1310         esac
1311     ;;
1313     r*pi)
1314         aros_flavour="standalone"
1315         aros_target_arch="raspi"
1316         aros_target_cpu="arm"
1317         aros_object_format="armelf_aros"
1318         aros_shared_default="no"
1319         aros_arch_libs="-laeabi"
1321         gcc_default_cpu="armv6"
1322         gcc_default_cpu_tune="arm1176jzf-s"
1323         case "$target_cpu" in
1324             *armhf*)
1325                 gcc_default_float_abi="hard"
1326                 ;;
1327             *arm*)
1328                 gcc_default_float_abi="softfp"
1329                 ;;
1330             *)
1331                 AC_MSG_ERROR("Unknown CPU for RasPi $target_cpu")
1332                 ;;
1333         esac
1335         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
1336         aros_config_cflags="$aros_config_cflags -marm -Wno-error -fno-asynchronous-unwind-tables -fno-exceptions"
1337         aros_config_aflags="$aros_config_aflags -marm -Wno-error -fno-asynchronous-unwind-tables -fno-exceptions"
1338         aros_kernel_cflags="$aros_kernel_cflags -marm -Wno-error -fno-asynchronous-unwind-tables -fno-exceptions"
1339         aros_target_cflags="$aros_kernel_cflags -marm -Wno-error -fno-asynchronous-unwind-tables -fno-exceptions"
1340         ;;
1342     amiga*)
1343         aros_target_arch="amiga"
1344         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D_AMIGA -DAMIGA"
1345         aros_shared_default="no"
1347         case "$target_cpu" in
1348             *m68k*)
1349                 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")
1350                 aros_enable_mmu=no
1351                 aros_target_cpu="m68k"
1352                 aros_object_format="m68kelf"
1353                 aros_flavour="standcompat"
1354                 gcc_target_cpu="m68000"
1355                 aros_config_cflags="$aros_config_cflags -fno-strict-aliasing -ffreestanding -fomit-frame-pointer -fbuiltin -Wno-volatile-register-var -Os -DNOLIBINLINE"
1356                 aros_config_aflags="$aros_config_aflags"
1357                 aros_target_strip_flags="-R.comment --strip-debug"
1358                 aros_default_wbwidth=640
1359                 aros_default_wbheight=256
1360                 aros_default_wbdepth=2
1361                 ;;
1362             *ppc*)
1363                 aros_cpu="ppc"
1364                 aros_flavour="native"
1365                 gcc_target_cpu="ppc"
1366                 ;;
1367             *)
1368                 AC_MSG_ERROR("Unknown CPU for Amiga $target_cpu")
1369                 ;;
1370         esac
1371         ;;
1373     mingw*)
1374         aros_target_arch="mingw32"
1375         aros_shared_default="no"
1376         aros_flavour="emulation"
1377         aros_shared_cflags=""
1378         need_crosstools="yes"
1379         need_dlopen="no"
1380         rescomp="windres"
1381         case "$target_cpu" in
1382             *i?86*)
1383                 aros_target_cpu="i386"
1384                 aros_object_format="elf_i386"
1385                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1386                 aros_default_wbdepth=8
1387                 gcc_target_cpu="i386"
1389                 kernel_tool_prefix="i386-mingw32-"
1390                 ;;
1391             *x86_64*)
1392                 aros_target_cpu="x86_64"
1393                 aros_object_format="elf_x86_64"
1394                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
1395                 aros_config_cflags="$aros_config_cflags -fno-omit-frame-pointer"
1396                 aros_default_wbdepth=8
1397                 kernel_tool_prefix="x86_64-w64-mingw32-"
1398                 ;;
1399             *arm*)
1400                 aros_target_cpu="arm"
1401                 aros_object_format="armelf_aros"
1402                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
1403                 aros_arch_libs="-laeabi"
1404                 aros_default_wbdepth=8
1405                 gcc_target_cpu="arm"
1406                 gcc_default_float_abi="soft"
1407                 kernel_tool_prefix="arm-mingw32ce-"
1408                 aros_default_wbwidth=160
1409                 aros_default_wbheight=160
1410                 ;;
1411             *)
1412                 AC_MSG_ERROR("Unknown CPU for Mingw32 -- $target_cpu")
1413                 ;;
1414         esac
1415         if test $host_os = "cygwin"; then
1416                 aros_kernel_cflags="-mno-cygwin"
1417         fi
1418     ;;
1419     pp*)
1420         aros_target_arch="pp"
1421         aros_shared_default="no"
1422         case "$target_cpu" in
1423             *m68k*)
1424                 aros_target_cpu="m68k"
1425                 aros_object_format="m68kelf"
1426                 aros_flavour="palmnative"
1427                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
1428                 aros_default_wbwidth=160
1429                 aros_default_wbheight=160
1430                 aros_default_wbdepth=1
1431                 aros_target_ar_flags="cru"
1432                 aros_compiler_libs="-lgcc1"
1433                 aros_shared_default=no
1434                 aros_shared_cflags="-fpic"
1435                 aros_shared_aflags=""
1436                 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
1437                 aros_kernel_ldflags="-Wl,-rpath,./lib"
1438                 aros_debug_cflags="$aros_symbols_debug  $aros_messages_debug"
1439                 aros_debug_aflags=""
1440                 aros_debug_ldflags="$aros_symbols_debug"
1441                 aros_mungwall_debug="0"
1442                 aros_modules_debug="0"
1443                 gcc_target_cpu="mc68000"
1444                 ignore_undefined_symbols="-ius"
1445                 ;;
1446            *)
1447                 AC_MSG_ERROR("Unknown CPU for PalmPilot -- $target_cpu")
1448                 ;;
1449         esac
1450         ;;
1452     mac*)
1453         aros_target_arch="mac"
1454         aros_shared_default="no"
1455         case "$target_cpu" in
1456             *m68k*)
1457                 aros_target_cpu="m68k"
1458                 aros_object_format="m68kelf"
1459                 aros_flavour="mac68knative"
1460                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
1461                 aros_default_wbwidth=512
1462                 aros_default_wbheight=384
1463                 aros_default_wbdepth=8
1464                 aros_target_ar_flags="cru"
1465                 aros_compiler_libs="-lgcc1"
1466                 aros_shared_default=no
1467                 aros_shared_cflags="-fpic"
1468                 aros_shared_aflags=""
1469                 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
1470                 aros_kernel_ldflags="-Wl,-rpath,./lib"
1471                 aros_debug_cflags="$aros_symbols_debug $aros_messages_debug"
1472                 aros_debug_aflags=""
1473                 aros_debug_ldflags="$aros_symbols_debug"
1474                 aros_mungwall_debug="0"
1475                 aros_modules_debug="0"
1476                 gcc_target_cpu="mc68000"
1477                 ignore_undefined_symbols="-ius"
1478                 ;;
1479            *)
1480                 AC_MSG_ERROR("Unknown CPU for Mac68k -- $target_cpu")
1481                 ;;
1482         esac
1483         ;;
1485     *)
1486         AC_MSG_ERROR([Unsupported target architecture $target])
1487         ;;
1488 esac
1490 #-----------------------------------------------------------------------------
1491 crosstools_guess=yes
1493 AC_MSG_CHECKING([Kernel toolchain prefix])
1494 AC_ARG_WITH(kernel-toolchain-prefix,AC_HELP_STRING([--with-kernel-toolchain-prefix=...],[Specify crosscompile toolchain prefix for kernel objects]),[kernel_tool_prefix="$withval"])
1495 AC_MSG_RESULT($kernel_tool_prefix)
1497 AC_MSG_CHECKING([ELF toolchain prefix])
1498 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"
1499                                                  crosstools_guess=no])
1500 AC_MSG_RESULT($elf_tool_prefix)
1502 AC_MSG_CHECKING([AROS toolchain prefix])
1503 AC_ARG_WITH(aros-toolchain,AC_HELP_STRING([--with-aros-toolchain=PREFIX],[Specify prebuilt AROS toolchain]),[aros_tool_prefix="$withval"
1504                 crosstools_guess=no])
1505 if test "$aros_tool_prefix" = "yes" ; then
1506     aros_tool_prefix=$aros_target_cpu-aros-
1508 AC_MSG_RESULT($aros_tool_prefix)
1510 #-----------------------------------------------------------------------------
1511 #   Checking if we should build crosstools..
1512 AC_MSG_CHECKING([whether to build crosstools])
1513 AC_ARG_ENABLE(crosstools,AC_HELP_STRING([--disable-crosstools],[Do not build cross-compiler toolchain]),crosstools="$enableval",crosstools="$crosstools_guess")
1514 AC_MSG_RESULT($crosstools)
1516 if test "${crosstools}" = "yes"; then
1517     if test "${crosstools_guess}" = "no"; then
1518         AC_MSG_ERROR([Cannot build external toolchain if an external ELF or AROS toolchain is specified])
1519     fi
1522 AC_MSG_CHECKING([where to install the crosstools binaries])
1523 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])
1524 if test "x$aros_toolchain_install" = "x"; then
1525     AROS_CROSSTOOLSDIR="$AROS_BUILDDIR_UNIX/bin/$aros_host_arch-$aros_host_cpu/tools/crosstools"
1526 else
1527     AROS_CROSSTOOLSDIR="$aros_toolchain_install"
1528     PATH="$AROS_CROSSTOOLSDIR:$PATH"
1530 AC_MSG_RESULT($AROS_CROSSTOOLSDIR)
1532 AC_MSG_CHECKING([whether to include Objective-C suppport])
1533 AC_ARG_ENABLE(objc,AC_HELP_STRING([--disable-objc],[Build without Objectve-C support]),objc="$enableval",objc="yes")
1534 AC_MSG_RESULT($objc)
1535 if test "x$objc" = "xyes"; then
1536     objc_target="objc"
1537 else
1538     objc_target="no-objc"
1541 # Now process extra architecture-specific options.
1542 # Currently this is implemented only for ARM. We can specify which minimum CPU and FPU to use,\
1543 # as well as floating-point ABI.
1544 case "$aros_target_cpu" in
1545 arm)
1546     dnl ARM defaults are: armv6 + vfp (unless overriden in per-target section above)
1547     if test "$gcc_default_cpu" = ""; then
1548         gcc_default_cpu="armv6"
1549     fi
1550     if test "$gcc_default_fpu" = ""; then
1551         gcc_default_fpu="vfp"
1552     fi
1553     if test "$gcc_default_float_abi" = ""; then
1554         gcc_default_float_abi="softfp"
1555     fi
1557     AC_MSG_CHECKING([Which minimum CPU to use])
1558     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)
1559     AC_MSG_RESULT($aros_gcc_cpu)
1561     AC_MSG_CHECKING([Which minimum FPU to use])
1562     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)
1563     AC_MSG_RESULT($aros_gcc_fpu)
1565     AC_MSG_CHECKING([Which floating point ABI to use])
1566     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)
1567     AC_MSG_RESULT($aros_gcc_float_abi)
1569     aros_config_cflags="$aros_config_cflags -marm -mthumb-interwork -march=$aros_gcc_cpu -mfpu=$aros_gcc_fpu -mfloat-abi=$aros_gcc_float_abi -fno-asynchronous-unwind-tables -fno-exceptions"
1570     aros_config_aflags="$aros_config_aflags -marm -mthumb-interwork -march=$aros_gcc_cpu -mfpu=$aros_gcc_fpu -mfloat-abi=$aros_gcc_float_abi -fno-asynchronous-unwind-tables -fno-exceptions"
1571     ;;
1572 esac
1574 # Some formats need custom ELF specs.
1575 # For example for x86_64 it is needed in order for -m32 switch to work correctly.
1576 if test -f $SRCDIR/config/${aros_object_format}-specs.in; then
1577     elf_specs_in=config/${aros_object_format}-specs.in
1578 else
1579     elf_specs_in=config/elf-specs.in
1582 # Some compilers (ppc-elf-gcc is known to) have CPU defines in specs
1583 # Since we override specs, we may need to put these defines there
1584 if test "$gcc_target_cpu" != ""; then
1585     gcc_target_cpu="-D__${gcc_target_cpu}__"
1588 AC_MSG_CHECKING([where to download sourcecode for external ports])
1589 AC_ARG_WITH(portssources,AC_HELP_STRING([--with-portssources=DIR],[Where to download sourcecode for external ports]),with_portssrcdir=$withval,with_portssrcdir="default")
1590 if test "$with_portssrcdir" = "default"; then
1591     AROS_PORTSSRCDIR="$AROS_BUILDDIR_UNIX/bin/Sources"
1592 else
1593     AROS_PORTSSRCDIR="$with_portssrcdir"
1595 AC_MSG_RESULT($AROS_PORTSSRCDIR)
1597 AC_MSG_CHECKING([which bootloader to use])
1598 AC_ARG_WITH(bootloader,AC_HELP_STRING([--with-bootloader=NAME],[Use a specific bootloader]),target_bootloader=$withval,target_bootloader=$target_bootloader)
1599 if test "$target_bootloader" = "none"; then
1600     aros_target_bootloader=""
1601 else
1602     aros_target_bootloader="$target_bootloader"
1604 AC_MSG_RESULT($target_bootloader)
1606 AC_MSG_CHECKING([which icon-set to use])
1607 AC_ARG_WITH(iconset,AC_HELP_STRING([--with-iconset=NAME],[Use a specific Icon-set (default=Gorilla).]),target_iconset=$withval,target_iconset="default")
1608 if test "$target_iconset" = "default"; then
1609     aros_target_iconset="Gorilla"
1610     target_iconset="default (Gorilla)"
1611 else
1612     aros_target_iconset="$target_iconset"
1614 AC_MSG_RESULT($target_iconset)
1616 AC_MSG_CHECKING([which GUI Theme to use])
1617 AC_ARG_WITH(theme,AC_HELP_STRING([--with-theme=NAME],[Use a specific GUI Theme]),target_guitheme=$withval,target_guitheme="default")
1618 if test "$target_guitheme" = "default"; then
1619     aros_target_guitheme="Ice"
1620 else
1621     aros_target_guitheme="$target_guitheme"
1623 AC_MSG_RESULT($aros_target_guitheme)
1625 # Find out if we are cross-compiling (i.e. if we can't use the host compiler
1626 # for target code)
1627 cross_compiling=no
1629 dnl The first case is simple. If we are compiling for another CPU, we are cross-compiling for sure
1630 if test "$aros_host_cpu" != "$aros_target_cpu" ; then
1631     cross_compiling=yes
1634 dnl x86-64 toolchains can also produce i386 binaries, given -m32 flag.
1635 dnl The flag itself is given in per-target section, because some targets require to pass it
1636 dnl in a different manner, otherwise some tests fail.
1637 dnl TODO: Justify this.
1638 if test "$aros_host_cpu" == "x86_64" ; then
1639     if test "$aros_target_cpu" == "i386" ; then
1640         cross_compiling=no
1641     fi
1644 if test "x-$aros_flavour" = "x-emulation" -o "x-$aros_flavour" = "x-emulcompat" ; then
1645     dnl For a hosted build we are cross-compiling if host OS differs from build OS.
1646     dnl TODO: This might get a little bit more tricky if we ever cross-compile ARM-Android-hosted
1647     dnl AROS on ARM Linux, or even vice versa (Linux-hosted ARM AROS building on ARM Android).
1648     dnl ARM ABIs of Linux and Android are not compatible (despite very close), so host_cc can't be
1649     dnl used to build bootstrap for target arch in either case.
1650     dnl For us Android is not a separate OS, but a variant of Linux, so both systems will be
1651     dnl identified as 'linux'. If this ever involves, we'll have to implement some additional check,
1652     dnl perhaps introducing aros_host_variant
1653     if test "$aros_host_arch" != "$aros_target_arch" ; then
1654         cross_compiling=yes
1655     fi
1656 else
1657     dnl For a native build we only care if our host_cc can produce static ELF files. If so, we can use
1658     dnl it as kernel_cc. If not, (e. g. we are on Windows or Darwin), we need a crosscompiler.
1659     if test "$host_cc_elf" = "no" ; then
1660         cross_compiling=yes
1661     fi
1664 if test "$cross_compiling" = "no" ; then
1665     kernel_tool_prefix=""
1666     if test "$host_cc_elf" = "yes" ; then
1667         elf_tool_prefix=""
1668     fi
1671 if test "$kernel_tool_version" != ""; then
1672     kernel_tool_version="-$kernel_tool_version"
1674 if test "$target_tool_version" != ""; then
1675     target_tool_version="-$target_tool_version"
1678 #######################################################################
1679 ## Compute what toolchains to use, and their paths                   ##
1680 #######################################################################
1682 # This takes, as input:
1683 #   crosstools             {yes,no}
1684 #   kernel_tool_version    {"",[version]}
1685 #   target_tool_version    {"",[version]}
1686 #   kernel_tool_prefix     {none,[some-arch-os-]}
1687 #   target_tool_prefix     ${aros_target_cpu}-aros-
1688 #   aros_tool_prefix       ${aros_target_cpu}-aros-
1690 # The output is
1691 #   aros_kernel_{cpp,cc,ar,ld,as,ranlib,nm,strip}
1692 #        Where the 'kernel' binaries are located
1693 #   orig_target_{cpp,cc,ar,ld,as,ranlib,nm,strip}
1694 #        Where the 'target' binaries are located
1695 #        (not the symlink farm - that is aros_target_*!)
1697 # The rules are:
1698 #   if crosstools then
1699 #      if kernel_tools_prefix = "no-kernel-prefix-"
1700 #          aros_kernel_* = crosstools cc paths
1701 #          aros_kernel_cc = elf cc wrapper around crosstools cc
1702 #      else
1703 #          VALIDATE(${kernel_tools_prefix}*)
1704 #          aros_kernel_* = ${kernel_tools_prefix}*
1705 #          if ${kernel_tools_prefix}cc is an AROS gcc
1706 #              aros_kernel_cc = ${kernel_tools_prefix}cc
1707 #          else
1708 #              aros_kernel_cc = elf cc wrapper around ${kernel_tools_prefix}cc
1709 #          fi
1710 #      fi
1712 #      orig_target_* = aros built crosstools
1713 #      orig_target_cc = elf cc wrapper around crosstools cc
1714 #   else
1715 #      VALIDATE(${kernel_tools_prefix}*)
1717 #      orig_target_* = aros_kernel_*
1718 #      if aros_kernel_cc is an AROS gcc
1719 #          orig_target_cc = aros_kernel_cc
1720 #      else
1721 #          orig_target_cc = aros cc wrapper around aros_kernel_cc
1722 #      fi
1723 #   fi
1725 target_tool_prefix="${aros_target_cpu}-aros-"
1727 AC_MSG_CHECKING([which kernel tools])
1728 AC_MSG_RESULT([$kernel_tool_prefix]);
1730 if test "$kernel_tool_prefix" = "none" ; then
1731     dnl ELF wrapper can be used only for native bootstrap
1732     if test "x-$aros_flavour" = "x-emulation" -o "x-$aros_flavour" = "x-emulcompat" ; then
1733         AC_MSG_ERROR([--with-kernel-toolchain-prefix= is required for this arch])
1734     fi
1735 else
1736     # Kernel tools required - find them
1737     # Note that 'normally', aros_kernel_* overrides will be
1738     # empty, unless specified in the per-arch sections above.
1739     if test "x$aros_kernel_cpp" = "x"; then
1740         aros_kernel_cpp=${kernel_tool_prefix}cpp
1741     fi
1742     AROS_TOOL_KERNEL(aros_kernel_cpp,cpp,$aros_kernel_cpp${kernel_tool_version})
1743     AROS_REQUIRED(cpp,$aros_kernel_cpp)
1744     if test "x$aros_kernel_cc" = "x"; then
1745         aros_kernel_cc=${kernel_tool_prefix}gcc
1746     fi
1747     AROS_TOOL_KERNEL(aros_kernel_cc,cc,$aros_kernel_cc${kernel_tool_version})
1748     AROS_REQUIRED(cc,$aros_kernel_cc)
1749     if test "x$aros_kernel_cxx" = "x"; then
1750         aros_kernel_cxx=${kernel_tool_prefix}g++
1751     fi
1752     AROS_TOOL_KERNEL(aros_kernel_cxx,cxx,$aros_kernel_cxx${kernel_tool_version})
1753     # If it's set, make sure it's really there
1754     if test "x$aros_kernel_cxx" != "x" ; then
1755         AROS_REQUIRED(cxx,$aros_kernel_cxx)
1756     fi
1757     AROS_TOOL_KERNEL(aros_kernel_ld,ld,$aros_kernel_ld)
1758     AROS_REQUIRED(ld,$aros_kernel_ld)
1759     AROS_TOOL_KERNEL(aros_kernel_as,as,$aros_kernel_as)
1760     AROS_REQUIRED(as,$aros_kernel_as)
1761     AROS_TOOL_KERNEL(aros_kernel_ar,ar,$aros_kernel_ar)
1762     AROS_REQUIRED(ar,$aros_kernel_ar)
1763     AROS_TOOL_KERNEL(aros_kernel_ranlib,ranlib,$aros_kernel_ranlib)
1764     AROS_REQUIRED(ranlib,$aros_kernel_ranlib)
1765     AROS_TOOL_KERNEL(aros_kernel_nm,nm,$aros_kernel_nm)
1766     AROS_REQUIRED(nm,$aros_kernel_nm)
1767     AROS_TOOL_KERNEL(aros_kernel_strip,strip,$aros_kernel_strip)
1768     AROS_REQUIRED(strip,$aros_kernel_strip)
1770     # Objcopy and objdump are not required for the kernel
1771     # toolchain on many architectures.
1772     # So we'll look for them, but not make them strictly required.
1773     AROS_TOOL_KERNEL(aros_kernel_objcopy,objcopy,$aros_kernel_objcopy)
1774     AROS_TOOL_KERNEL(aros_kernel_objdump,objdump,$aros_kernel_objdump)
1775     if test "x${crosstools}" != "xyes" ; then
1776         AROS_REQUIRED(objcopy,$aros_kernel_objcopy)
1777         AROS_REQUIRED(objdump,$aros_kernel_objdump)
1778     fi
1781 AC_MSG_CHECKING([which target tools to use])
1782 if test "$crosstools" = "yes"; then
1783     AC_MSG_RESULT([$target_tool_prefix])
1784     # We are are building AROS crosstools
1785     tmp_tool_prefix="$AROS_CROSSTOOLSDIR/${target_tool_prefix}"
1786     orig_target_cc="${tmp_tool_prefix}gcc${target_tool_version}"
1787     orig_target_cxx="${tmp_tool_prefix}g++${target_tool_version}"
1788     orig_target_cpp="${tmp_tool_prefix}cpp"
1789     orig_target_ld="${tmp_tool_prefix}ld"
1790     orig_target_as="${tmp_tool_prefix}as"
1791     orig_target_ar="${tmp_tool_prefix}ar"
1792     orig_target_ranlib="${tmp_tool_prefix}ranlib"
1793     orig_target_nm="${tmp_tool_prefix}nm"
1794     orig_target_strip="${tmp_tool_prefix}strip"
1795     orig_target_objcopy="${tmp_tool_prefix}objcopy"
1796     orig_target_objdump="${tmp_tool_prefix}objdump"
1797 else
1798     # Determine whether AROS or ELF tools should be used
1799     if test "$aros_tool_prefix" = "none"; then
1800         aros_tool_prefix="${elf_tool_prefix}"
1801     fi
1803     AC_MSG_RESULT([$aros_tool_prefix])
1804     # We are *not* building AROS crosstools - use the AROS or ELF tools
1805     AROS_TOOL_TARGET(orig_target_cpp,cpp,${aros_tool_prefix}cpp${target_tool_version})
1806     AROS_REQUIRED(cpp,$orig_target_cpp)
1807     AROS_TOOL_TARGET(orig_target_cc,gcc,${aros_tool_prefix}gcc${target_tool_version})
1808     AROS_REQUIRED(cc,$orig_target_cc)
1809     AROS_TOOL_TARGET(orig_target_cxx,g++,${aros_tool_prefix}g++${target_tool_version})
1810     AROS_REQUIRED(cxx,$orig_target_cxx)
1811     AROS_TOOL_TARGET(orig_target_ld,gcc,${aros_tool_prefix}ld)
1812     AROS_REQUIRED(ld,$orig_target_ld)
1813     AROS_TOOL_TARGET(orig_target_as,as,${aros_tool_prefix}as)
1814     AROS_REQUIRED(as,$orig_target_as)
1815     AROS_TOOL_TARGET(orig_target_ar,ar,${aros_tool_prefix}ar)
1816     AROS_REQUIRED(ar,$orig_target_ar)
1817     AROS_TOOL_TARGET(orig_target_ranlib,ar,${aros_tool_prefix}ranlib)
1818     AROS_REQUIRED(ranlib,$orig_target_ranlib)
1819     AROS_TOOL_TARGET(orig_target_nm,nm,${aros_tool_prefix}nm)
1820     AROS_REQUIRED(nm,$orig_target_nm)
1821     AROS_TOOL_TARGET(orig_target_strip,strip,${aros_tool_prefix}strip)
1822     AROS_REQUIRED(strip,$orig_target_strip)
1823     AROS_TOOL_TARGET(orig_target_objcopy,objcopy,${aros_tool_prefix}objcopy)
1824     AROS_REQUIRED(objcopy,$orig_target_objcopy)
1825     AROS_TOOL_TARGET(orig_target_objdump,objdump,${aros_tool_prefix}objdump)
1826     AROS_REQUIRED(objdump,$orig_target_objdump)
1829 if test "$kernel_tool_prefix" = "none" ; then
1830     # No kernel tools specified
1831     # Assume target tools == kernel tools with ELF wrapper
1832     aros_kernel_cc=$orig_target_cc
1833     aros_kernel_cxx=$orig_target_cxx
1834     aros_kernel_cpp=$orig_target_cpp
1835     aros_kernel_ld=$orig_target_ld
1836     aros_kernel_as=$orig_target_as
1837     aros_kernel_ar=$orig_target_ar
1838     aros_kernel_ranlib=$orig_target_ranlib
1839     aros_kernel_nm=$orig_target_nm
1840     aros_kernel_strip=$orig_target_strip
1841     aros_kernel_objcopy=$orig_target_objcopy
1842     aros_kernel_objdump=$orig_target_objdump
1843     use_kernel_cc_wrapper=yes
1846 # At this point, all aros_kernel_* and aros_target_* 
1847 # tools should be set up correctly
1849 CC="$aros_kernel_cc $kernel_tool_flags"
1850 CPP="$aros_kernel_cpp"
1852 #-----------------------------------------------------------------------------
1854 # Disable pointer-signedness warnings if the compiler recognises the option
1856 AC_MSG_CHECKING([whether ${CC} accepts -Wno-pointer-sign])
1857 save_cflags="$CFLAGS"
1858 if test "$crosstools" != "yes" ; then
1859     CFLAGS="$CFLAGS -Wno-pointer-sign"
1860     AC_TRY_COMPILE(,, use_no_sign_warning="yes", use_no_sign_warning="no")
1861 else
1862     # we do know it is supported for the smallest version of gcc we are going to build
1863     # we assume it's also supported by later versions
1864     use_no_sign_warning=yes
1866 AC_MSG_RESULT($use_no_sign_warning)
1867 if test "x-$use_no_sign_warning" = "x-yes" ; then
1868     aros_config_cflags="$aros_config_cflags -Wno-pointer-sign"
1870 CFLAGS="$save_cflags"
1872 #-----------------------------------------------------------------------------
1874 # Find all the tools we need to compile. This could be cross-compiling
1875 # though! If that is the case we use the GNU form of the target and
1876 # simply add this to the front of the binary name. This is rather simple,
1877 # but it should work under most circumstances.
1879 # The default tools are to use the same as the host, but only if the
1880 # host and target CPU are the same. With GCC this is normally enough.
1883 aros_cc_pre=""
1884 aros_shared_ld="$aros_host_ld"
1886 aros_target_mkdep="$aros_host_mkdep"
1888 # The default tools executables to be linked to.
1889 if test "$rescomp" != ""; then
1890     AC_PATH_PROG(aros_kernel_rescomp,${kernel_tool_prefix}$rescomp)
1891     AROS_REQUIRED($rescomp,$aros_kernel_rescomp)
1894 # Set up the sources for the symlink farm
1895 if test "$crosstools" = "yes"; then
1896     crosstools_target=tools-crosstools
1899 aros_kernel_cc="$aros_kernel_cc $kernel_tool_flags"
1900 aros_kernel_ar="$aros_kernel_ar $aros_kernel_ar_flags"
1903 aros_hostcfg_dir="bin/${aros_host_arch}-${aros_host_cpu}/gen/config"
1904 aros_targetcfg_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/config"
1905 aros_inc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/AROS/Development/include/aros"
1906 aros_gendir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen"
1907 aros_geninc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/include/aros"
1908 aros_tools_dir="bin/${aros_host_arch}-${aros_host_cpu}/tools"
1909 aros_scripts_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/scripts"
1911 # aros_cc_pre is a variable that is added to the front of the compiler name
1912 # in the generated aros-gcc shell script. We need this to enable the cache
1913 # to work across cleaned builds. Also, support DISTCC using the correct
1914 # environment variable.
1917 if test "x${DISTCC}" != "x" ; then
1918     if test "x${CCACHE}" != "x" ; then
1919         aros_cc_pre="env CCACHE_PREFIX=${DISTCC} ${CCACHE} "
1920     else
1921         aros_cc_pre="${DISTCC} "
1922     fi
1923 else
1924     if test "x${CCACHE}" != "x" ; then
1925         aros_cc_pre="${CCACHE} "
1926     fi
1929 prefix="${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-"
1931 AC_SUBST(aros_target_nostdinc_cflags,-nostdinc)
1932 AC_SUBST(aros_target_nostartup_ldflags,-nostartfiles)
1933 AC_SUBST(aros_target_nix_ldflags,-nix)
1934 AC_SUBST(aros_target_detach_ldflags,-detach)
1935 AC_SUBST(aros_target_nostdlib_ldflags,-nostdlib)
1937 # Target tools
1938 if test "$crosstools" != "yes"; then
1939     if test "$GCC" = "yes"; then
1940         aros_target_cc_path=`$orig_target_cc -print-search-dirs | grep "programs: =" | cut -c 12-`
1941     fi
1942 else
1943     # We do not know which gcc version we are going to build and what we need to know
1944     # here is different for different versions so this will be set later during the
1945     # build of crosstools.
1946     aros_target_cc_path=@aros_target_cc_path@
1948 aros_target_cpp="${prefix}cpp"
1949 aros_target_cc="${prefix}gcc"
1950 aros_target_cxx="${prefix}g++"
1951 aros_target_as="${prefix}as"
1952 aros_target_ld="${prefix}ld"
1953 aros_target_ar="${prefix}ar $aros_target_ar_flags"
1954 aros_target_objcopy="${prefix}objcopy"
1955 aros_target_objdump="${prefix}objdump"
1956 aros_target_ranlib="${prefix}ranlib $aros_target_ranlib_flags"
1957 aros_target_nm="${prefix}nm $aros_target_nm_flags"
1958 aros_target_strip="${prefix}strip"
1959 aros_plain_nm="${prefix}nm"
1960 aros_plain_ar="${prefix}ar"
1962 AC_ARG_ENABLE(includes,
1963 AC_HELP_STRING([--enable-includes=dir],[Alternative system include directory]),
1964 [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`])
1966 if test "$aros_kernel_includes" = ""; then
1967     if test "x-$aros_flavour" = "x-emulation" -o "x-$aros_flavour" = "x-emulcompat" ; then
1968         aros_kernel_includes="-isystem $aros_target_incl"
1969     fi
1972 if test "$aros_kernel_includes" != "" ; then
1973     dnl find out about the kernel cc's include path
1974     AC_MSG_CHECKING([for the kernel compiler's include path])
1975     if test "$aros_kernel_cc_includes" = "" ; then
1976         # Try to guess where the directory is.
1977         aros_kernel_cc_includes=`dirname \`${aros_kernel_cc} ${aros_kernel_cflags} -print-libgcc-file-name\``/include
1978         if test -d $aros_kernel_cc_includes; then
1979             # Check if there is also an include-fixed directory and add it
1980             # to kernel compiler's include path as it may contain some of
1981             # the headers we need.
1982             if test -d "$aros_kernel_cc_includes"-fixed; then
1983                 aros_kernel_cc_includes+=" -isystem $aros_kernel_cc_includes"-fixed
1984             fi
1985             # Check for specific includes directory. Neede for Ubuntu 11.10
1986             if test -d "/usr/include/i386-linux-gnu"; then
1987                 aros_kernel_cc_includes+=" -isystem /usr/include/i386-linux-gnu"
1988             fi
1989         else
1990             # The directory doesn't exist, we need to do some more work.
1991             aros_kernel_cc_includes=${PWD}/${aros_gendir}/cc_include
1993             # These are the headers we're looking for.
1994             headers="limits.h mmintrin.h stdbool.h syslimits.h float.h \
1995                      stddef.h xmmintrin.h iso646.h stdarg.h unwind.h   \
1996                      zutil.h stdint.h"
1998             dirs=
1999             for h in $headers; do
2000                 # Which other headers are needed by each of the above?
2001                 deps=$(echo "#include <$h>" | \
2002                        $aros_kernel_cc -E -M - 2>/dev/null | \
2003                        sed 's/^.*://; s/\\$/ /g; s/[[ \t]]\+/ /g')
2005                 # Copy all the needed headers to a directory beneath gendir.
2006                 for d in $deps; do
2007                     h=$(basename $d)
2008                     dir=${aros_kernel_cc_includes}$(echo $(dirname $d) | \
2009                                                 sed -n "s,^.*/include\(/.*\),\1,p")
2010                     ! test -d $dir && mkdir -p $dir
2011                     ! test -f $dir/$h && { cp $d $dir; chmod u+w $dir/$h; }
2012                 done
2013             done            
2014         fi
2015     fi
2016     AC_MSG_RESULT($aros_kernel_cc_includes)
2017     # Adding -nostdinc to kernel includes as they are always used together.
2018     aros_kernel_includes="$aros_kernel_includes $aros_target_nostdinc_cflags -isystem $aros_kernel_cc_includes"
2021 if test "$crosstools" != "yes"; then
2022     dnl find out about the target cc's include path
2023     AC_MSG_CHECKING([for the target compiler's include path])
2024     if test "$aros_target_cc_includes" = "" ; then
2025         #try to guess where the directory is
2026         aros_target_cc_includes=`dirname \`${orig_target_cc} -print-libgcc-file-name\``/include
2027         if ! test -d $aros_target_cc_includes; then
2028             #the directory doesn't exist, we need to do some more work
2029             aros_target_cc_includes=${PWD}/${aros_gendir}/cc_include
2030         
2031             #these are the headers we're looking for
2032             headers="limits.h mmintrin.h stdbool.h syslimits.h float.h \
2033                     stddef.h xmmintrin.h iso646.h stdarg.h unwind.h   \
2034                     zutil.h"
2036             dirs=
2037             for h in $headers; do
2038                 #which other headers each of the above headers needs?
2039                 deps=$(echo "#include <$h>" | \
2040                     $orig_target_cc -E -M - 2>/dev/null | \
2041                     sed 's/^.*://; s/\\$/ /g; s/[[ \t]]\+/ /g')
2042             
2043                 #copy all the needed headers to a directory beneath gendir
2044                 for d in $deps; do
2045                     h=$(basename $d)
2046                     dir=${aros_target_cc_includes}$(echo $(dirname $d) | \
2047                                                 sed -n "s,^.*/include\(/.*\),\1,p")
2048                     ! test -d $dir && mkdir -p $dir
2049                     ! test -f $dir/$h && { cp $d $dir; chmod u+w $dir/$h; }
2050                 done
2051             done
2052         fi
2053     fi
2054     AC_MSG_RESULT($aros_target_cc_includes)
2055 else
2056     # We do not know which gcc version we are going to build and what we need to know
2057     # here is different for different versions so this will be set later during the
2058     # build of crosstools.
2059     aros_target_cc_includes=@aros_target_cc_includes@
2063 # For GCC < 4.0 -I- is used for giving the search path for '#include "..."'
2064 # On GCC >= 4.0 -iquote should be used
2067 save_cc="$CC"
2068 save_cflags="$CFLAGS"
2069 CFLAGS="-iquote."
2070 AC_MSG_CHECKING([whether ${CC} accepts -iquote])
2071 if test "x-$crosstools" != "x-yes"; then
2072     AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
2073 else
2074     # we do know it is supported for the smallest version of gcc we are going to build
2075     # we assume it's also supported by later versions
2076     has_iquote=yes
2078 AC_MSG_RESULT($has_iquote)
2079 if test "x-$has_iquote" = "x-yes" ; then
2080     host_cflags_iquote=-iquote
2081     host_cflags_iquote_end=
2082 else
2083     host_cflags_iquote=-I
2084     host_cflags_iquote_end=-I-
2086 kernel_cflags_iquote=$host_cflags_iquote
2087 kernel_cflags_iquote_end=$host_cflags_iquote_end
2088 if test "x-$cross_compiling" = "x-yes"; then
2089     CC="$aros_kernel_cc"
2090     AC_MSG_CHECKING([whether ${CC} accepts -fno-stack-protector])
2091     if test "x-$crosstools" != "x-yes"; then
2092         AC_TRY_COMPILE(,, use_no_stack_protector="yes", use_no_stack_protector="no")
2093     else
2094         # we do know it is supported for the smallest version of gcc we are going to build
2095         # we assume it's also supported by later versions
2096         use_no_stack_protector=yes
2097     fi
2098     AC_MSG_RESULT($use_no_stack_protector)
2099     AC_MSG_CHECKING([whether ${CC} accepts -iquote])
2100     if test "x-$crosstools" != "x-yes"; then
2101         AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
2102     else
2103         # we do know it is supported for the smallest version of gcc we are going to build
2104         # we assume it's also supported by later versions
2105         has_iquote=yes
2106     fi
2107     AC_MSG_RESULT($has_iquote)
2108     if test "x-$has_iquote" = "x-yes" ; then
2109         kernel_cflags_iquote=-iquote
2110         kernel_cflags_iquote_end=
2111     else
2112         kernel_cflags_iquote=-I
2113         kernel_cflags_iquote_end=-I-
2114     fi
2116 aros_cflags_iquote=$kernel_cflags_iquote
2117 aros_cflags_iquote_end=$kernel_cflags_iquote_end
2118 if test "$orig_target_cc" != "$aros_kernel_cc"; then
2119     CC="$orig_target_cc"
2120     AC_MSG_CHECKING([whether ${CC} accepts -iquote])
2121     if test "x-$crosstools" != "x-yes"; then
2122         AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
2123     else
2124         # we do know it is supported for the smallest version of gcc we are going to build
2125         # we assume it's also supported by later versions
2126         has_iquote=yes
2127     fi
2128     AC_MSG_RESULT($has_iquote)
2129     if test "x-$has_iquote" = "x-yes" ; then
2130         aros_cflags_iquote=-iquote
2131         aros_cflags_iquote_end=
2132     else
2133         aros_cflags_iquote=-I
2134         aros_cflags_iquote_end=-I-
2135     fi
2137 if test "x-$use_no_stack_protector" = "x-yes" ; then
2138     aros_kernel_cflags="$aros_kernel_cflags -fno-stack-protector"
2142 #-----------------------------------------------------------------------------
2144 # Check if the target compiler supports some options used for delinting:
2145 #  -Wunused-but-set-variable
2146 #  -Warray-bounds
2147 #  -Wenum-compare
2148 #  -Wstrict-overflow
2149 #  -Wformat-security
2151 if test "x-$crosstools" != "x-yes"; then
2152     if test "$orig_target_cc" != "$aros_kernel_cc"; then
2153         CC="$orig_target_cc"
2154     fi
2155     AC_MSG_CHECKING([whether ${CC} accepts -Wunused-but-set-variable])
2156     CFLAGS=-Wunused-but-set-variable
2157     AC_TRY_COMPILE(,, aros_unused_but_set_variable="yes", aros_unused_but_set_variable="no")
2158     AC_MSG_RESULT($aros_unused_but_set_variable)
2159     if test "x-$aros_unused_but_set_variable" = "x-yes" ; then
2160         aros_cflags_unused_but_set_variable=-Wno-unused-but-set-variable
2161     fi
2163     AC_MSG_CHECKING([whether ${CC} accepts -Warray-bounds])
2164     CFLAGS=-Warray-bounds
2165     AC_TRY_COMPILE(,, aros_array_bounds="yes", aros_array_bounds="no")
2166     AC_MSG_RESULT($aros_array_bounds)
2167     if test "x-$aros_array_bounds" = "x-yes" ; then
2168         aros_cflags_array_bounds=-Wno-array-bounds
2169     fi
2171     AC_MSG_CHECKING([whether ${CC} accepts -Wenum-compare])
2172     CFLAGS=-Wenum-compare
2173     AC_TRY_COMPILE(,, aros_enum_compare="yes", aros_enum_compare="no")
2174     AC_MSG_RESULT($aros_enum_compare)
2175     if test "x-$aros_enum_compare" = "x-yes" ; then
2176         aros_cflags_enum_compare=-Wno-enum-compare
2177     fi
2179     AC_MSG_CHECKING([whether ${CC} accepts -Wstrict-overflow])
2180     CFLAGS=-Wstrict-overflow
2181     AC_TRY_COMPILE(,, aros_strict_overflow="yes", aros_strict_overflow="no")
2182     AC_MSG_RESULT($aros_strict_overflow)
2183     if test "x-$aros_strict_overflow" = "x-yes" ; then
2184         aros_cflags_strict_overflow=-Wno-strict-overflow
2185     fi
2187     AC_MSG_CHECKING([whether ${CC} accepts -Wformat-security])
2188     CFLAGS=-Wformat-security
2189     AC_TRY_COMPILE(,, aros_format_security="yes", aros_format_security="no")
2190     AC_MSG_RESULT($aros_format_security)
2191     if test "x-$aros_format_security" = "x-yes" ; then
2192         aros_cflags_format_security=-Wno-format-security
2193     fi
2194 else
2195     # We do not know which gcc version we are going to build and what we need to know
2196     # here is different for different versions so this will be set later during the
2197     # build of crosstools.
2198     aros_cflags_unused_but_set_variable=@aros_cflags_unused_but_set_variable@
2199     aros_cflags_array_bounds=@aros_cflags_array_bounds@
2200     aros_cflags_enum_compare=@aros_cflags_enum_compare@
2201     aros_cflags_strict_overflow=@aros_cflags_strict_overflow@
2202     aros_cflags_format_security=@aros_cflags_format_security@
2205 #-----------------------------------------------------------------------------
2207 # Check if we can explicitly choose older version of symbol hashing
2209 CFLAGS="save_cflags -Wl,--hash-style=sysv"
2210 CC="$aros_kernel_cc"
2211 AC_MSG_CHECKING([whether ${CC} accepts -Wl,--hash-style=sysv])
2212 AC_TRY_LINK(,, use_hash_style="yes", use_hash_style="no")
2213 AC_MSG_RESULT($use_hash_style)
2214 if test "x-$use_hash_style" = "x-yes" ; then
2215     aros_kernel_cflags="$aros_kernel_cflags -Wl,--hash-style=sysv"
2217 CC="$save_cc"
2218 CFLAGS="$save_cflags"
2220 AC_SUBST(host_cflags_iquote)
2221 AC_SUBST(host_cflags_iquote_end)
2222 AC_SUBST(kernel_cflags_iquote)
2223 AC_SUBST(kernel_cflags_iquote_end)
2224 AC_SUBST(aros_cflags_iquote)
2225 AC_SUBST(aros_cflags_iquote_end)
2228 dnl Check if user specified --with-resolution=XRESxYRESxDEPTH
2229 AC_MSG_CHECKING([for default resolution of WBScreen])
2230 AC_ARG_WITH(resolution,AC_HELP_STRING([--with-resolution=XRESxYRESxDEPTH],[Default resolution of the initial WorkbenchScreen]),resolution=$withval,resolution=none)
2231 # We require an argument, so map --with/--without ("yes"/"no") to "none" specified
2232 if test "$resolution" = "yes" ; then
2233     resolution="none"
2235 if test "$resolution" = "no" ; then
2236     resolution="none"
2238 if test "$resolution" != "none" ; then
2239     aros_default_wbwidth=`echo $resolution | cut -d'x' -f1`
2240     aros_default_wbheight=`echo $resolution | cut -d'x' -f2`
2241     aros_default_wbdepth=`echo $resolution | cut -d'x' -f3`
2243 AC_MSG_RESULT($aros_default_wbwidth x $aros_default_wbheight x $aros_default_wbdepth)
2244 aros_cv_default_wbwidth=$aros_default_wbwidth
2245 aros_cv_default_wbheight=$aros_default_wbheight
2246 aros_cv_default_wbdepth=$aros_default_wbdepth
2248 dnl See if the user wants the serial debug output for native flavour
2249 AC_MSG_CHECKING([if serial debug is enabled])
2250 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)
2251 if test "$aros_serial_debug" = 0 ; then
2252     serial_debug_forced=""
2253     if test "$serial_debug" = "yes" ; then
2254         serial_debug="1"
2255     fi
2256     if test "$serial_debug" = "no" ; then
2257         serial_debug="none"
2258     fi
2259 else
2260     serial_debug_forced="(forced)"
2261     serial_debug=$aros_serial_debug
2263 if test "$serial_debug" != "none" ; then
2264     aros_serial_debug=$serial_debug
2265     AC_MSG_RESULT($serial_debug_forced on port $serial_debug)
2266 else
2267     AC_MSG_RESULT(no)
2270 dnl See if the user wants the palm debug output hack for palm native flavour
2271 AC_MSG_CHECKING([if palm debug hack is enabled])
2272 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")
2273 if test "$palm_debug_hack" = "yes" ; then
2274     aros_palm_debug_hack="1"
2276 AC_MSG_RESULT($palm_debug_hack)
2278 dnl See if dev wants the usb3.0 code
2279 AC_MSG_CHECKING([if usb3.0 code is enabled])
2280 AC_ARG_ENABLE(usb30_code,AC_HELP_STRING([--enable-usb30-code],[Enable usb3.0 code (default=no)]),usb30_code="yes",usb30_code="no")
2281 if test "$usb30_code" = "yes" ; then
2282     aros_config_cflags="$aros_config_cflags -DAROS_USB30_CODE"
2283     aros_kernel_cflags="$aros_kernel_cflags -DAROS_USB30_CODE"
2285 AC_MSG_RESULT($usb30_code)
2287 dnl See if the user wants nesting supervisor activated for unix flavour
2288 AC_MSG_CHECKING([if nesting supervisor support is enabled])
2289 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")
2290 if test "$nesting_supervisor" = "yes" ; then
2291     aros_nesting_supervisor="1"
2293 AC_MSG_RESULT($nesting_supervisor)
2295 dnl See if the user wants to disable MMU support
2296 dnl This can be overriden on per-target basis,
2297 dnl set $aros_enable_mmu to "yes" or "no" to do this
2298 if test "$aros_enable_mmu" = "" ; then
2299     AC_MSG_CHECKING([if MMU support is enabled])
2300     dnl Enabled by default
2301     AC_ARG_ENABLE(mmu,AC_HELP_STRING([--disable-mmu],[Disable MMU support (default=enabled)]),aros_enable_mmu=$enableval,aros_enable_mmu="yes")
2302     if test "$aros_enable_mmu" = "" ; then
2303         aros_enable_mmu="yes"
2304     fi
2305     AC_MSG_RESULT($aros_enable_mmu)
2307 if test "$aros_enable_mmu" = "no" ; then
2308     aros_enable_mmu="0"
2309 else
2310     aros_enable_mmu="1"
2312     
2314 dnl things specifically required for hosted flavours
2315 if test "x-$aros_flavour" = "x-emulation" -o "x-$aros_flavour" = "x-emulcompat" ; then
2317     if test "x-$need_dlopen" != "x-no" ; then
2318       save_libs="$LIBS"
2319       LIBS=""
2320       dnl some kind of dynamic library access system is required for hostlib.resource
2321       AC_CHECK_FUNC(dlopen, have_dl="yes", have_dl="no")
2322       if test "x-$have_dl" = "x-no" ; then
2323           AC_CHECK_LIB(dl, dlopen, [have_dl="yes"
2324                                     aros_host_ldflags="$aros_host_ldflags -ldl"],
2325                                     have_dl="no")
2326       fi
2327       if test "x-$have_dl" = "x-no" ; then
2328           AC_MSG_ERROR([dlopen() dynamic linker functions not available])
2329       fi
2330       LIBS="$save_libs"
2331     fi
2334     dnl x11 hidd
2335     AC_ARG_ENABLE(x11_hidd, AC_HELP_STRING([--enable-x11-hidd],
2336                                            [build X11 hidd for hosted (default=auto)]),
2337                                            x11_hidd="$enableval",
2338                                            x11_hidd="$need_x11")
2339     case "x-$x11_hidd" in
2340         x-yes|x-no|x-auto)                 ;;
2341         *)                 x11_hidd="$need_x11" ;;
2342     esac
2344     ENABLE_X11=0
2346     dnl they want it
2347     if test "x-$x11_hidd" != "x-no" ; then
2349         dnl find x11 stuff
2350         AC_PATH_X
2352         x_cflags=
2353         for path in $x_libraries
2354         do
2355             x_cflags="$x_cflags -L$path"
2356         done
2358         for path in $x_includes
2359         do
2360             x_cflags="$x_cflags -I$path"
2361         done
2362         
2363         if test "x-$no_x" = "x-yes" ; then
2365             dnl didn't find it
2366             if test "x-$x11_hidd" != "x-auto" ; then
2367                 dnl and they explicitly asked for it, bail out
2368                 AC_MSG_ERROR([X11 libs/headers not found, cannot build X11 hidd as requested])
2369             fi
2370         
2371         else
2372             dnl found it, setup the metatarget
2373             unixgfx_hidd_target=kernel-x11gfx
2374             ENABLE_X11=1
2376             dnl setup shared memory extensions
2377             AC_ARG_ENABLE(x11_shm, AC_HELP_STRING([--enable-x11-shm],
2378                                                   [use X11 shared memory (default=auto)]),
2379                                                   x11_hidd_shm="$enableval",
2380                                                   x11_hidd_shm="auto")
2381             case "x-$x11_hidd_shm" in
2382                 x-yes|x-no|x-auto)                     ;;
2383                 *)                 x11_hidd_shm="auto" ;;
2384             esac
2386             have_xshm=no
2388             dnl they want it
2389             if test "x-$x11_hidd_shm" != "x-no" ; then
2391                 dnl system shm headers
2392                 AC_CHECK_HEADERS(sys/ipc.h)
2393                 AC_CHECK_HEADERS(sys/shm.h)
2395                 dnl got them
2396                 if test "x-$ac_cv_header_sys_ipc_h" = "x-yes" -a "x-$ac_cv_header_sys_shm_h" = "x-yes" ; then
2398                     dnl make sure X libs have shm functions
2399                     save_cflags="$CFLAGS"
2400                     CFLAGS="$CFLAGS $x_cflags"
2401                     AC_CHECK_LIB(Xext, XShmQueryExtension, have_xshm=yes)
2402                     CFLAGS="$save_cflags"
2403                 fi
2404             fi
2406             dnl detection done, prepare output
2407             if test "x-$have_xshm" = "x-yes" ; then
2408                 dnl we can do shm
2409                 DO_XSHM_SUPPORT="1"
2410             elif test "x-$x11_hidd_shm" = "x-yes" ; then
2411                 dnl they explicitly asked for it, but we can't do it
2412                 AC_MSG_ERROR([X11 has no support for shared memory, cannot enable it as requested])
2413             else
2414                 dnl otherwise just disable it
2415                 DO_XSHM_SUPPORT="0"
2416             fi
2418             
2419             dnl setup vidmode (fullscreen) extensions
2420             AC_ARG_ENABLE(x11_vidmode, AC_HELP_STRING([--enable-x11-vidmode],
2421                                                       [use X11 vidmode extension (default=auto)]),
2422                                                       x11_hidd_vidmode="$enableval",
2423                                                       x11_hidd_vidmode="auto")
2424             case "x-$x11_hidd_vidmode" in
2425                 x-yes|x-no|x-auto)                         ;;
2426                 *)                 x11_hidd_vidmode="auto" ;;
2427             esac
2429             have_vidmode=no
2431             dnl they want it
2432             if test "x-$x11_hidd_vidmode" != "x-no" ; then
2434                 dnl make sure X libs have vidmode functions
2435                 save_cflags="$CFLAGS"
2436                 CFLAGS="$CFLAGS $x_cflags"
2437                 AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryExtension, have_vidmode=yes)
2438                 CFLAGS="$save_cflags"
2439             fi
2441             dnl detection done, prepare output
2442             if test "x-$have_vidmode" = "x-yes" ; then
2443                 dnl we can do vidmode
2444                 DO_VIDMODE_SUPPORT="1"
2445             elif test "x-$x11_hidd_vidmode" = "x-yes" ; then
2446                 dnl they explicitly asked for it, but we can't do it
2447                 AC_MSG_ERROR([X11 vidmode extension not available, cannot enable it as requested])
2448             else
2449                 dnl otherwise just disable it
2450                 DO_VIDMODE_SUPPORT="0"
2451             fi
2452         fi
2454         aros_host_x11_includes=$x_includes 
2455         aros_host_x11_libdirs=$x_libraries
2456     fi
2459     dnl sdl hidd
2460     AC_ARG_ENABLE(sdl_hidd, AC_HELP_STRING([--enable-sdl-hidd],
2461                                            [build SDL hidd for hosted (default=auto)]),
2462                                            sdl_hidd="$enableval",
2463                                            sdl_hidd="auto")
2464     case "x-$sdl_hidd" in
2465         x-yes|x-no|x-auto)                 ;;
2466         *)                 sdl_hidd="auto" ;;
2467     esac
2469     dnl they want it
2470     if test "x-$sdl_hidd" != "x-no" ; then
2472         dnl find sdl
2473         AM_PATH_SDL([1.2.10], have_sdl="yes", have_sdl="no")
2475         if test "x-$have_sdl" != "x-yes" ; then
2477             dnl didn't find it
2478             if test "x-$sdl_hidd" != "x-auto" ; then
2479                 dnl and they explicitly asked for it, bail out
2480                 AC_MSG_ERROR([SDL libs/headers not found, cannot build SDL hidd as requested])
2481             fi
2483         else
2484             dnl found it, set up the metatarget
2485             sdl_hidd_target=kernel-hidd-sdl
2486             aros_host_sdl_cflags=SDL_CFLAGS
2487             aros_host_sdl_libs=SDL_LIBS
2488         fi
2489     fi
2491     dnl oss.library
2492     AC_CHECK_HEADER(sys/soundcard.h)
2493     if test "x-$ac_cv_header_sys_soundcard_h" = "x-yes" ; then
2494         oss_library_target=workbench-libs-oss-unix
2495     fi
2499 dnl See if the user wants dbus.library
2500 AC_MSG_CHECKING([if building of dbus.library is enabled])
2501 AC_ARG_ENABLE(dbus,AC_HELP_STRING([--enable-dbus],[Enable DBUS support via dbus.library (default=no)]),dbus="yes",dbus="no")
2502 if test "$dbus" = "yes" ; then
2503     ENABLE_DBUS=1
2504     DBUS_CFLAGS=`pkg-config --cflags dbus-1`
2505     DBUS_LIBFLAGS=`pkg-config --libs dbus-1`
2506     KERNEL_DBUS_KOBJ=kernel-dbus-kobj
2507     KERNEL_DBUS_INCLUDES=kernel-dbus-includes
2508 else
2509     ENABLE_DBUS=0
2511 AC_MSG_RESULT($dbus)
2513 if test "$use_kernel_cc_wrapper" = "yes" ; then
2514     aros_kernel_cc="${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-elf-gcc"
2517 if test "${crosstools}" != "yes" ; then
2518     aros_target_toolchain=no
2519 else
2520     aros_target_toolchain=yes
2523 dnl --------------------------------------------------------------------
2524 dnl Configuration Output Section
2525 dnl --------------------------------------------------------------------
2527 # Generic
2528 AC_SUBST(aros_arch)
2529 AC_SUBST(aros_cpu)
2530 AC_SUBST(aros_flavour)
2531 AC_SUBST(aros_flavour_uc)
2532 AC_SUBST(aros_target_toolchain)
2533 AC_SUBST(AROS_BUILDDIR)
2534 AC_SUBST(AROS_BUILDDIR_UNIX)
2535 AC_SUBST(SRCDIR)
2536 AC_SUBST(AROS_CROSSTOOLSDIR)
2537 AC_SUBST(AROS_PORTSSRCDIR)
2539 # Compatability with other Amiga-like operation systems
2540 AC_SUBST(aros_amigaos_compliance)
2542 # Host related
2543 AC_SUBST(aros_cc_pre)
2544 AC_SUBST(aros_host_strip)
2545 AC_SUBST(aros_host_arch)
2546 AC_SUBST(aros_host_cpu)
2547 AC_SUBST(aros_host_cpp)
2548 AC_SUBST(aros_host_cc)
2549 AC_SUBST(aros_host_cxx)
2550 AC_SUBST(aros_host_ar)
2551 AC_SUBST(aros_host_ranlib)
2552 AC_SUBST(aros_host_ld)
2553 AC_SUBST(aros_host_make)
2554 AC_SUBST(aros_host_cflags)
2555 AC_SUBST(aros_host_cxxflags)
2556 AC_SUBST(gnu89_inline)
2557 AC_SUBST(aros_host_ldflags)
2558 AC_SUBST(aros_host_debug)
2559 AC_SUBST(aros_host_mkdep)
2560 AC_SUBST(aros_host_mkargs)
2561 AC_SUBST(aros_host_exe_suffix)
2562 AC_SUBST(aros_host_lib_suffix)
2563 AC_SUBST(aros_tools_dir)
2564 AC_SUBST(aros_host_aclocal)
2565 AC_SUBST(aros_host_autoconf)
2566 AC_SUBST(aros_host_autoheader)
2567 AC_SUBST(aros_host_automake)
2568 AC_SUBST(ant)
2570 # Target Related
2571 AC_SUBST(aros_target_guitheme)
2572 AC_SUBST(aros_target_iconset)
2573 AC_SUBST(aros_target_bootloader)
2574 AC_SUBST(aros_target_arch)
2575 AC_SUBST(aros_target_family)
2576 AC_SUBST(aros_target_cpu)
2577 AC_SUBST(aros_target_variant)
2578 AC_SUBST(aros_target_suffix)
2579 AC_SUBST(aros_target_ar)
2580 AC_SUBST(aros_target_ranlib)
2581 AC_SUBST(aros_plain_nm)
2582 AC_SUBST(aros_plain_ar)
2583 AC_SUBST(aros_kernel_ar)
2584 AC_SUBST(aros_kernel_ranlib)
2585 AC_SUBST(orig_target_cc)
2586 AC_SUBST(aros_target_cc)
2587 AC_SUBST(aros_kernel_cc)
2588 AC_SUBST(orig_target_cxx)
2589 AC_SUBST(aros_target_cxx)
2590 AC_SUBST(aros_kernel_cxx)
2591 AC_SUBST(orig_target_cpp)
2592 AC_SUBST(aros_target_cpp)
2593 AC_SUBST(aros_kernel_cpp)
2594 AC_SUBST(orig_target_as)
2595 AC_SUBST(aros_target_as)
2596 AC_SUBST(aros_kernel_as)
2597 AC_SUBST(orig_target_ld)
2598 AC_SUBST(aros_target_ld)
2599 AC_SUBST(aros_kernel_ld)
2600 AC_SUBST(aros_target_cc_includes)
2601 AC_SUBST(aros_target_cc_path)
2602 AC_SUBST(aros_target_objdump)
2603 AC_SUBST(aros_target_objcopy)
2604 AC_SUBST(aros_target_strip)
2605 AC_SUBST(aros_target_nm)
2606 AC_SUBST(aros_kernel_rescomp)
2607 AC_SUBST(aros_shared_default)
2608 AC_SUBST(aros_shared_ld)
2609 AC_SUBST(aros_object_format)
2610 AC_SUBST(aros_compiler_libs)
2611 AC_SUBST(aros_arch_libs)
2613 AC_SUBST(aros_config_cflags)
2614 AC_SUBST(aros_config_aflags)
2615 AC_SUBST(aros_config_ldflags)
2617 AC_SUBST(aros_shared_cflags)
2618 AC_SUBST(aros_shared_aflags)
2619 AC_SUBST(aros_shared_ldflags)
2620 AC_SUBST(aros_kernel_cflags)
2621 AC_SUBST(aros_kernel_includes)
2622 AC_SUBST(aros_kernel_objcflags)
2623 AC_SUBST(aros_kernel_ldflags)
2624 AC_SUBST(aros_target_cflags)
2625 AC_SUBST(aros_debug_cflags)
2626 AC_SUBST(aros_debug_aflags)
2627 AC_SUBST(aros_debug_ldflags)
2628 AC_SUBST(aros_target_genmap)
2629 AC_SUBST(aros_target_strip_flags)
2631 AC_SUBST(crosstools_target)
2632 AC_SUBST(crosstools_cxx_target)
2634 # Delinting target compiler flags
2635 AC_SUBST(aros_cflags_unused_but_set_variable)
2636 AC_SUBST(aros_cflags_array_bounds)
2637 AC_SUBST(aros_cflags_enum_compare)
2638 AC_SUBST(aros_cflags_strict_overflow)
2639 AC_SUBST(aros_cflags_format_security)
2641 # Graphics Related
2642 AC_SUBST(unixgfx_hidd_target)
2643 AC_SUBST(sdl_hidd_target)
2644 AC_SUBST(pci_hidd_target)
2645 AC_SUBST(oss_library_target)
2647 AC_SUBST(aros_default_wbwidth)
2648 AC_SUBST(aros_default_wbheight)
2649 AC_SUBST(aros_default_wbdepth)
2650 AC_SUBST(DO_XSHM_SUPPORT)
2651 AC_SUBST(DO_VIDMODE_SUPPORT)
2653 AC_SUBST(aros_host_x11_includes)
2654 AC_SUBST(aros_host_x11_libdirs)
2655 AC_SUBST(aros_host_sdl_cflags)
2656 AC_SUBST(aros_host_sdl_libs)
2658 # Native version related
2659 AC_SUBST(aros_serial_debug)
2661 # Palm native version related
2662 AC_SUBST(aros_palm_debug_hack)
2664 # Unix/Hosted version related
2665 AC_SUBST(aros_nesting_supervisor)
2667 # MMU related
2668 AC_SUBST(aros_enable_mmu)
2670 # Apple iOS related
2671 AC_SUBST(aros_ios_platform)
2672 AC_SUBST(aros_ios_version)
2673 AC_SUBST(aros_ios_sdk)
2675 # ARM default GCC target related
2676 AC_SUBST(gcc_default_cpu)
2677 AC_SUBST(gcc_default_cpu_tune)
2678 AC_SUBST(gcc_default_fpu)
2679 AC_SUBST(gcc_default_float_abi)
2681 # Android related
2682 AC_SUBST(android_tool)
2683 AC_SUBST(aros_android_level)
2684 AC_SUBST(aros_android_antapk)
2686 # DBUS related
2687 AC_SUBST(ENABLE_DBUS)
2688 AC_SUBST(DBUS_CFLAGS)
2689 AC_SUBST(DBUS_LIBFLAGS)
2690 AC_SUBST(KERNEL_DBUS_KOBJ)
2691 AC_SUBST(KERNEL_DBUS_INCLUDES)
2693 #X11 related
2694 AC_SUBST(ENABLE_X11)
2696 # Debug related
2697 AC_SUBST(aros_debug)
2698 AC_SUBST(aros_mungwall_debug)
2699 AC_SUBST(aros_stack_debug)
2700 AC_SUBST(aros_modules_debug)
2702 # Collect-aros stuff: "-ius" to ignore undefined symbols
2703 AC_SUBST(ignore_undefined_symbols)
2705 # C compiler related
2706 AC_SUBST(gcc_target_cpu)
2708 #ObjC compiler related
2709 AC_SUBST(objc_target)
2711 # USB3.0 code
2712 AC_SUBST(aros_usb30_code)
2714 dnl Prepare for output, make up all the generated patches
2715 case "$aros_flavour" in
2716 emulation)      aros_flavour_uc="AROS_FLAVOUR_EMULATION"
2717                 aros_flavour="emulation" ;;
2718 emulcompat)     aros_flavour_uc="(AROS_FLAVOUR_EMULATION|AROS_FLAVOUR_BINCOMPAT)"
2719                 aros_flavour="emulation" ;;
2720 standalone)     aros_flavour_uc="AROS_FLAVOUR_STANDALONE"
2721                 aros_flavour="standalone";;
2722 standcompat)    aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_BINCOMPAT)"
2723                 aros_flavour="standalone";;
2724 native)         aros_flavour_uc="AROS_FLAVOUR_NATIVE"
2725                 aros_flavour="native" ;;
2726 nativecompat)   aros_flavour_uc="(AROS_FLAVOUR_NATIVE|AROS_FLAVOUR_BINCOMPAT)"
2727                 aros_flavour="native" ;;
2728 linklib)        aros_flavour_uc="AROS_FLAVOUR_LINKLIB"
2729                 aros_flavour="linklib" ;;
2730 palmnative)     aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
2731                 aros_flavour="palmnative" ;;
2732 mac68knative)   aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
2733                 aros_flavour="mac68knative" ;;
2734 ppcnative)      aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_BINCOMPAT)"
2735                 aros_flavour="ppcnative" ;;
2736 esac
2738 if test ! -d ${aros_inc_dir} ; then
2739     ${MKDIR} ${aros_inc_dir}
2741 if test ! -d ${aros_geninc_dir} ; then
2742     ${MKDIR} ${aros_geninc_dir}
2744 if test ! -d ${aros_hostcfg_dir} ; then
2745     ${MKDIR} ${aros_hostcfg_dir}
2747 if test ! -d ${aros_targetcfg_dir} ; then
2748     ${MKDIR} ${aros_targetcfg_dir}
2750 if test ! -d ${aros_tools_dir} ; then
2751     ${MKDIR} ${aros_tools_dir}
2753 if test ! -d ${aros_scripts_dir} ; then
2754     ${MKDIR} ${aros_scripts_dir}
2757 AC_CONFIG_HEADERS(${aros_geninc_dir}/host-conf.h:config/host-conf.h.in)
2759 AC_CONFIG_COMMANDS([compiler_executable],
2760     [
2761         prefix=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}
2762         mkdir -p $prefix
2763         prefix2=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros
2764         prefix3=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-elf
2766         echo ${prefix2}
2767         echo ${prefix3}
2768         chmod a+x ${prefix2}-gcc ${prefix2}-g++ ${prefix2}-ld ${prefix2}-cpp ${prefix3}-gcc
2770         ln -sf $orig_target_as$aros_host_exe_suffix      ${prefix2}-as$aros_host_exe_suffix
2771         ln -sf $orig_target_nm$aros_host_exe_suffix      ${prefix2}-nm$aros_host_exe_suffix
2772         ln -sf $orig_target_ar$aros_host_exe_suffix      ${prefix2}-ar$aros_host_exe_suffix
2773         ln -sf $orig_target_ranlib$aros_host_exe_suffix  ${prefix2}-ranlib$aros_host_exe_suffix
2774         ln -sf $orig_target_objcopy$aros_host_exe_suffix ${prefix2}-objcopy$aros_host_exe_suffix
2775         ln -sf $orig_target_objdump$aros_host_exe_suffix ${prefix2}-objdump$aros_host_exe_suffix
2776         ln -sf $orig_target_strip$aros_host_exe_suffix   ${prefix2}-strip$aros_host_exe_suffix
2778         ln -sf $aros_kernel_ld$aros_host_exe_suffix         ${prefix3}-ld$aros_host_exe_suffix
2779     ],
2780     [
2781         aros_host_exe_suffix=${aros_host_exe_suffix}
2782         aros_tools_dir=${aros_tools_dir}
2783         aros_target_cpu=${aros_target_cpu}
2784         aros_target_arch=${aros_target_arch}
2785         aros_target_suffix=${aros_target_suffix}
2786         orig_target_nm=${orig_target_nm}
2787         orig_target_as=${orig_target_as}
2788         orig_target_ar=${orig_target_ar}
2789         orig_target_ranlib=${orig_target_ranlib}
2790         orig_target_objdump=${orig_target_objdump}
2791         orig_target_objcopy=${orig_target_objcopy}
2792         orig_target_strip=${orig_target_strip}
2793         aros_kernel_ld=${aros_kernel_ld}
2794     ]
2796 AC_CONFIG_COMMANDS([genmf_executable],
2797     [chmod a+x ${aros_tools_dir}/genmf.py],
2798     [aros_tools_dir=${aros_tools_dir}]
2801 AC_CONFIG_FILES(
2802     Makefile
2803     config/make.cfg
2804     ${aros_inc_dir}/config.h:config/config.h.in
2805     ${aros_geninc_dir}/config.h:config/config.h.in
2806     ${aros_hostcfg_dir}/host.cfg:config/host.cfg.in
2807     ${aros_targetcfg_dir}/target.cfg:config/target.cfg.in
2808     mmake.config
2809     ${aros_targetcfg_dir}/make.defaults:config/make.defaults.in
2810     ${aros_targetcfg_dir}/specs:config/specs.in
2811     ${aros_targetcfg_dir}/elf-specs:${elf_specs_in}
2812     ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-cpp:scripts/aros-cpp.in
2813     ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-gcc:scripts/aros-gcc.in
2814     ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-g++:scripts/aros-g++.in
2815     ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-elf-gcc:scripts/elf-gcc.in
2816     ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-ld:scripts/aros-ld.in
2817     ${aros_tools_dir}/genmf.py:tools/genmf/genmf.py
2818     tools/collect-aros/env.h
2819     ${aros_gendir}/arch/all-android/bootstrap/app/default.properties:arch/all-android/bootstrap/app/default.properties.in
2822 AC_OUTPUT
2824 dnl This is in order to not define SHARED_CFLAGS sometimes
2825 dnl We don't always do aros_shared_ar, aros_shared_cflags
2827 #XXX compatability...
2828 aros_shared_ar="$aros_shared_ld $aros_shared_ldflags -o"
2830 if test -n "$aros_shared_cflags" ; then
2831     echo "SHARED_CFLAGS := $aros_shared_cflags" >> ${aros_hostcfg_dir}/host.cfg
2832     echo "SHARED_AR := $aros_shared_ar" >> ${aros_hostcfg_dir}/host.cfg