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