remove broken target compiler iquote detection. move host iquote detection to host...
[AROS.git] / configure.in
blob8e2fe7026aaed3d0fdc34b8d7bd08d0ab559ddc7
1 dnl Copyright © 1997-2016, The AROS Development Team. All rights reserved.
2 dnl $Id$
3 dnl
4 dnl Desc: Autoconf source for configuration file
5 dnl Lang: english 
7 # Note: After file changes, generate configure anew and commit _both_ files.
9 #TODO
10 # method of getting shared/non-shared ld/ar tool for target.
12 # ------------------------------------------------------------------------
13 # Here starts the first section of the configure.in file.
14 # ------------------------------------------------------------------------
16 AC_INIT(mmakefile)
17 AC_PREREQ(2.61)
18 AC_CONFIG_AUX_DIR(scripts/autoconf)
20 # Check what host we are running on.
21 # If a target is not suggested, we use this one.
22 # Note that what we call a target, Autoconf calls a host.
23 AC_CANONICAL_HOST
25 # Default versions for the gnu tools we build
26 default_gcc_version="4.6.4"
27 default_binutils_version="2.23.2"
29 # The AROS target is slightly different to the normal GNU style
30 # format. We don't have the middle part, and we reverse the order
31 # of the $(CPU) and $(OS) bits.
33 # Don't strip the version of the target yet, it might be
34 # useful on some systems.
36 AC_MSG_CHECKING([for AROS style target])
38 if test "$target" = "NONE" ; then
39     target=$host_os-$host_cpu
40 else
41     if test "$target" = "" ; then
42         target=$host_os-$host_cpu
43     fi
45 AC_MSG_RESULT($target)
47 if test "$host_os" = "mingw32" ; then
48     PWDCMD="pwd -W"
51 # Don't know where else to put this...
52 AC_MSG_CHECKING([building AROS in])
53 AROS_BUILDDIR=`${PWDCMD-pwd}`
54 AROS_BUILDDIR_UNIX=${PWD}
55 AC_MSG_RESULT($AROS_BUILDDIR)
57 AC_MSG_CHECKING([AROS source in])
58 srcpwd=`cd ${srcdir} ; ${PWDCMD-pwd}`
59 SRCDIR=${srcpwd}
60 AC_MSG_RESULT($SRCDIR)
62 # Parse the target field into something useful.
63 changequote(<<,>>)
64 target_os=`echo $target | sed 's/^\([^-].*\)-\(.*\)$/\1/'`
65 target_cpu=`echo $target | sed 's/^\([^-].*\)-\(.*\)$/\2/'`
66 changequote([,])
68 # Some debug output, to be removed again.
69 AC_MSG_CHECKING([for target system (debug output)])
70 AC_MSG_RESULT($target_os)
71 AC_MSG_CHECKING([for target cpu (debug output)])
72 AC_MSG_RESULT($target_cpu)
74 dnl --------------------------------------------------------------------
75 dnl Set the default Workbench resolution
76 dnl --------------------------------------------------------------------
77 aros_nominal_width=800
78 aros_nominal_height=600
79 aros_nominal_depth=4
81 dnl --------------------------------------------------------------------
82 dnl Host Configuration Section
83 dnl --------------------------------------------------------------------
84 dnl
85 dnl The idea here is to find out all the information we need about the
86 dnl host. This means things like tools for building directory structures,
87 dnl copying files around and the like.
89 default_c_compilers="gcc clang cc"
90 AC_ARG_WITH(c-compiler,AC_HELP_STRING([--with-c-compiler=VERSION],[Use specified c compiler for building AROS]),use_c_compiler="$withval",use_c_compiler="")
91 if test "$use_c_compiler" = ""; then
92     host_c_compilers="$default_c_compilers"
93 else
94     host_c_compilers="$use_c_compiler"
97 default_cxx_compilers="g++ clang++ c++"
98 AC_ARG_WITH(cxx-compiler,AC_HELP_STRING([--with-cxx-compiler=VERSION],[Use specified c++ compiler building AROS]),use_cxx_compiler="$withval",use_cxx_compiler="")
99 if test "$use_cxx_compiler" = ""; then
100         host_cxx_compilers="$default_cxx_compilers"
101 else
102     host_cxx_compilers="$use_cxx_compiler"
106 # The first step is to find the host binaries.
107 # Check for a compiler.
108 # Due to a bug in autoconf check for c++ compiler first.
109 # For mor info see, http://osdir.com/ml/bug-autoconf-gnu/2010-05/msg00001.html.
110 AC_PROG_CXX([${host_cxx_compilers}])
111 AC_PROG_CC([${host_c_compilers}])
112 aros_host_def_cc="$CC"
113 AC_PROG_CC_STDC
114 AC_PROG_CPP
116 # Check for a compatible awk
117 AC_CHECK_PROGS(AWK,[gawk nawk])
118 AROS_REQUIRED(gawk,$AWK)
119 AROS_PROG(MMAKE,mmake)
121 # Perform some default variable assignments. Note all of these will be
122 # Regenerated from the script, so there is no need to cache them.
124 aros_build_host=$host
125 aros_host_cpp="$CPP"
126 aros_host_cc="$CC"
127 aros_host_cxx="$CXX"
128 AROS_TOOL_CCPATH(aros_host_ld,ld)
129 AROS_REQUIRED(ld,$aros_host_ld)
130 aros_host_make="make"
131 aros_host_cflags="$CFLAGS"
132 aros_host_cxxflags="$CXXFLAGS"
133 aros_host_ldflags="$LDFLAGS"
134 aros_host_debug="-g -O0"
135 aros_host_mkdep="\$(SRCDIR)/scripts/mkdep"
136 aros_host_mkargs="--no-print-directory"
137 aros_host_exe_suffix="$EXEEXT"
138 aros_host_lib_suffix=""
140 # Ignore all compliance, AROS ROMs = 0
141 # KickStart v1.0 = 30
142 # KickStart v1.3 = 34
143 # KickStart v2.0 = 37
144 # KickStart v3.0 = 39
145 # KickStart v3.1 = 40
146 # AmigaOS   v3.5 = 44
147 aros_amigaos_compliance=0
149 AC_CHECK_PROGS(aros_host_aclocal,[aclocal aclocal19 aclocal-1.9])
150 AC_CHECK_PROGS(aros_host_autoconf,[autoconf autoconf259 autoconf253])
151 AC_CHECK_PROGS(aros_host_autoheader,[autoheader autoheader259 autoheader253])
152 AC_CHECK_PROGS(aros_host_automake,[automake automake19 automake-1.9])
154 AROS_REQUIRED(aclocal/aclocal19/aclocal-1.9, $aros_host_aclocal)
155 AROS_REQUIRED(automake/automake19/automake-1.9, $aros_host_automake)
157 case "$aros_host_cc" in
158     *clang*)
159         aros_host_cc_pipe=""
160         ;;
161     *gcc*)
162         aros_host_cc_pipe="-pipe"
163         ;;
164     icc)
165         aros_host_cc_pipe=""
166         ;;
167     *)
168         aros_host_cc_pipe=""
169         ;;
170 esac
172 aros_kernel_cc_includes=""
173 aros_target_cc_includes=""
174 host_cc_elf=yes
176 # ----------------------------------------------------------------------------------------
177 # Host-specific defaults
179 # This is the main host configuration section. It is where the host
180 # can change the values of any variables it needs to change. We do
181 # not look at anything that compiles to the target yet, we'll get
182 # to that later.
184 case "$host_os" in
185     aros*)
186         aros_host_arch="aros"
187         aros_host_cflags="$aros_host_cflags $aros_host_cc_pipe"
188         case "$host_cpu" in
189             *i?86*)
190                 aros_host_cpu="i386"
191                 ;;
192             *x86_64*)
193                 aros_host_cpu="x86_64"
194                 ;;
195             *powerpc*)
196                 aros_host_cpu="ppc"
197                 ;;
198             *)
199                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
200                 aros_host_cpu="$host_cpu"
201                 ;;
202         esac
203         ;;
205     linux*)
206         aros_host_arch="linux"
207         aros_host_cflags="$aros_host_cflags $aros_host_cc_pipe"
208         android_build_os="linux-x86"
209         android_tool="android"
210         default_android_sdk="/opt/android-sdk-linux_x86"
211         case "$host_cpu" in
212             *i?86*)
213                 aros_host_cpu="i386"
214                 ;;
215             *x86_64*)
216                 aros_host_cpu="x86_64"
217                 ;;
218             *m68k*)
219                 aros_host_cpu="m68k"
220                 ;;
221             *powerpc*)
222                 aros_host_cpu="ppc"
223                 ;;
224             *arm*)
225                 aros_host_cpu="arm"
226                 ;;
227             *)
228                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
229                 aros_host_cpu="$host_cpu"
230                 ;;
231         esac
232         ;;
234     freebsd*)
235         aros_host_cflags="$aros_host_cflags $aros_host_cc_pipe -I/usr/local/include"
236         aros_host_make="gmake"
237         aros_host_arch="freebsd"
238         aros_host_cpu="i386"
240         aros_host_ldflags="$aros_host_ldflags -L/usr/local/lib -liconv"
242         dnl FreeBSD 5.x (and later) has changed the default object format.
243         dnl The double [[]] is necessary to get around m4's quoting rules.
244         case $host_os in
245             freebsd[[234]]*)
246                 aros_object_format="elf_i386"
247                 ;;
249             *)
250                 aros_object_format="elf_i386_fbsd"
251                 ;;
252         esac
254         ;;
256     darwin*)
257         aros_host_cflags="$aros_host_cflags $aros_host_cc_pipe"
258         aros_host_arch="darwin"
259         host_cc_elf=no
260         if [[ -z ${SED+x} ]]; then SED="gsed"; fi
261         android_build_os="darwin-x86"
262         android_tool="android"
263         default_android_sdk="/android-sdk-mac_x86"
264         case "$host_cpu" in
265             *i?86*)
266                 aros_host_cpu="i386"
267                 ;;
268             *x86_64*)
269                 aros_host_cpu="x86_64"
270                 ;;
271             *powerpc*)
272                 aros_host_cpu="ppc"
273                 ;;
274             *)
275                 AC_MSG_WARN("Unknown CPU for Darwin host -- $host_cpu")
276                 aros_host_cpu="$host_cpu"
277                 ;;
278         esac
280         aros_host_ldflags="$aros_host_ldflags -liconv"
282         ;;
284     dragonfly*)
285         aros_host_cflags="$aros_host_cflags $aros_host_cc_pipe"
286         aros_host_make="gmake"
287         aros_host_arch="dragonfly"
288         case $host_cpu in
289             *i?86*)
290                 aros_host_cpu="i386"
291                 ;;
292             *amd64*)
293                 aros_host_cpu="x86_64"
294                 ;;
295             *)
296                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
297                 aros_host_cpu="$host_cpu"
298                 ;;
299         esac
300         ;;
302     netbsd*)
303         aros_host_cflags="$aros_host_cflags $aros_host_cc_pipe"
304         aros_host_make="gmake"
305         aros_host_arch="netbsd"
306         case "$host_cpu" in
307             *i?86*)
308                 aros_host_cpu="i386"
309                 ;;
310             *m68k*)
311                 aros_host_cpu="m68k"
312                 ;;
313             *)
314                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
315                 aros_host_cpu="$host_cpu"
316                 ;;
317         esac    
318         aros_host_lib_suffix=".0.0"
319         ;;
321     openbsd*)
322         aros_host_cflags="$aros_host_cflags $aros_host_cc_pipe"
323         aros_host_make="gmake"
324         aros_host_arch="openbsd"
325         case "$host_cpu" in
326             *i?86*)
327                 aros_host_cpu="i386"
328                 ;;
329             *)
330                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
331                 aros_host_cpu="$host_cpu"
332                 ;;
333         esac
334         ;;
335         
336     solaris*)
337         aros_host_arch="solaris"
338         aros_host_cflags="$aros_host_cflags $aros_host_cc_pipe"
339         case "$host_cpu" in
340             *i?86*)
341                 aros_host_cpu="i386"
342                 ;;
343             *sparc*)
344                 aros_host_cpu="sparc"
345                 ;;
346             *)
347                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
348                 aros_host_cpu="$host_cpu"
349                 ;;
350         esac
351         ;;
353     morphos*)
354         aros_host_arch="morphos"
355         aros_host_cpu="ppc"
356         host_cc_elf=no
357         ;;
359     amiga*)
360         aros_host_arch="amiga"
361         host_cc_elf=no
362         SORT="/gg/bin/sort"
363         TEST="/gg/bin/test"
364         UNIQ="/gg/bin/uniq"
365         FOR="for"
366         TOUCH="/gg/bin/touch"
367         case "$host_cpu" in
368             *m68k*)
369                 aros_host_cpu="m68k"
370                 ;;
371             *powerpc*)
372                 aros_host_cpu="ppc"
373                 ;;
374             *)
375                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
376                 aros_host_cpu="$host_cpu"
377                 ;;
378         esac
379         ;;
381     cygwin*)
382         aros_host_arch="cygwin"
383         aros_host_cflags="$aros_host_cflags $aros_host_cc_pipe"
384         host_cc_elf=no
385         android_build_os="windows"
386         android_tool="android.bat"
387         default_android_sdk="/cygdrive/c/android-sdk-windows-1.6_r1"
389         case "$host_cpu" in
390             *i?86*)
391                 aros_host_cpu="i386"
392                 ;;
393             *)
394                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
395                 aros_host_cpu="$host_cpu"
396                 ;;
397         esac
398         ;;
400     mingw32*)
401         aros_host_arch="mingw32"
402         aros_host_cflags="$aros_host_cflags $aros_host_cc_pipe"
403         host_cc_elf=no
404         android_build_os="windows"
405         android_tool="android.bat"
406         default_android_sdk="/c/android-sdk-windows-1.6_r1"
408         libpng_libextra="-lws2_32"
410         case "$host_cpu" in
411         *i?86*)
412             dnl Currently there's neither 64-bit MinGW nor MSYS. Both environments are 32-bit
413             dnl and run under emulation. Consequently, uname reports i386 even on 64-bit systems.
414             dnl Here we attempt to detect Windows home platform by asking gcc about its target.
415             dnl 64-bit gcc will output "x86_64-w64-mingw32" here.
417             AC_MSG_CHECKING([for Windows native gcc target])
418             host_cpu=`gcc -dumpmachine`
419             AC_MSG_RESULT($host_cpu)
420             ;;
422         esac
424         case "$host_cpu" in
425         *i?86*)
426             aros_host_cpu="i386"
427             ;;
429         mingw32*)
430             dnl Native i386 gcc for MinGW32 reports 'mingw32' with -dumpmachine switch
431             aros_host_cpu="i386"
432             ;;
434         *x86_64*)
435             aros_host_cpu="x86_64"
436             dnl Dragon's x86_64-w64-mingw32-gcc is a bit broken. It ignores standard $prefix/include
437             dnl directory, so we have to add it explicitly here.
438             aros_host_cflags="$aros_host_cflags -isystem /mingw/include"
439             ;;
441         *)
442             AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
443             aros_host_cpu="$host_cpu"
444             ;;
445         esac
446         ;;
447     *)
448         AC_MSG_ERROR([Unsupported host architecture $host])
449         ;;
450 esac
452 AROS_PROG(aros_host_ar,[ar],[cr])
453 AROS_REQUIRED(ar,$aros_host_ar)
454 AROS_PROG(aros_host_ranlib,ranlib)
455 AROS_REQUIRED(ranlib,$aros_host_ranlib)
456 AROS_PROG(aros_host_strip,strip)
457 AROS_REQUIRED(strip,$aros_host_strip)
459 AROS_PROG(RM,[rm],[-rf])
460 AROS_REQUIRED(rm,$RM)
461 AROS_PROG(CP,[cp])
462 AROS_REQUIRED(cp,$CP)
463 AROS_PROG(MV,[mv])
464 AROS_REQUIRED(mv,$MV)
465 AROS_PROG(ECHO,[echo])
466 AROS_REQUIRED(echo,$ECHO)
467 AROS_PROG(MKDIR,[mkdir],[-p])
468 AROS_REQUIRED(mkdir,$MKDIR)
469 AROS_PROG(TOUCH,[touch])
470 AROS_REQUIRED(touch,$TOUCH)
471 AROS_PROG(SORT,[sort])
472 AROS_REQUIRED(sort,$SORT)
473 AROS_PROG(UNIQ,[uniq])
474 AROS_REQUIRED(uniq,$UNIQ)
475 AROS_PROG(NOP,[true])
476 AROS_REQUIRED(true,$NOP)
477 AROS_PROG(CAT,[cat])
478 AROS_REQUIRED(cat,$CAT)
479 AROS_PROG(BISON,[bison])
480 AROS_REQUIRED(bison,$BISON)
481 AROS_PROG(FLEX,[flex])
482 AROS_REQUIRED(flex,$FLEX)
483 AROS_PROG(PNGTOPNM,[pngtopnm])
484 AROS_REQUIRED(pngtopnm,$PNGTOPNM)
485 AROS_PROG(PPMTOILBM,[ppmtoilbm])
486 AROS_REQUIRED(ppmtoilbm,$PPMTOILBM)
487 AROS_PROG(SED,[sed])
488 AROS_REQUIRED(sed,$SED)
489 AROS_PROG(CHMOD,[chmod])
490 AROS_REQUIRED(chmod,$CHMOD)
491 AROS_PROG(PATCH,[patch])
492 AROS_REQUIRED(patch,$PATCH)
494 AM_PATH_PYTHON(2.5)
496 AC_ARG_ENABLE([libpng-config], [--disable-libpng-config    disable libpng-config test and configuration])
497 if test "$enable_libpng_config" != "no"; then
498   AC_CHECK_PROG([arosconfig_use_libpngconfig],[libpng-config],[yes],[no])
500 if test "$arosconfig_use_libpngconfig" = "yes"; then
501     AC_MSG_CHECKING([libpng-config library])
502     libpng_incdir="`libpng-config --cflags`"
503     libpng_libextra="$libpng_libextra `libpng-config --ldflags`"
504     libpng="`libpng-config --libs`"
505     AC_MSG_RESULT($libpng)
506 else
507     AC_CHECK_LIB(png, png_read_png, [libpng="-lpng"], [libpng="no"])
508     if test "$libpng_libextra" != ""; then
509         if test "$libpng" != "no"; then
510             libpng_libextra="$libpng_libextra $libpng"
511         fi
512     fi
514 AROS_REQUIRED(libpng, $libpng)
515 AC_SUBST(libpng)
516 AC_SUBST(libpng_libextra)
517 AC_SUBST(libpng_incdir)
519 AC_SUBST(FOR, for)
520 AC_SUBST(IF, if)
521 AC_SUBST(TEST, test)
522 AC_SUBST(CMP, cmp)
524 dnl ---------------------------------------------------------------------------
525 dnl Look for things about the host system, good for hosted targets.
526 dnl ---------------------------------------------------------------------------
528 # Check for some includes for the X11 HIDD and the kernel
529 AC_CHECK_HEADERS([sys/ipc.h sys/shm.h \
530     sys/mmap.h sys/mman.h sysexits.h \
531     sys/statfs.h sys/statvfs.h sys/vfs.h sys/param.h \
534 AC_CHECK_HEADERS([sys/mount.h],,,[#include <sys/param.h>])
536 AC_HEADER_DIRENT
537 AC_HEADER_STAT
538 AC_HEADER_STDC
539 AC_HEADER_SYS_WAIT
540 AC_HEADER_TIME
541 AC_STRUCT_ST_BLKSIZE
542 AC_STRUCT_ST_BLOCKS
543 AC_STRUCT_ST_RDEV
544 AC_STRUCT_TM
545 AC_STRUCT_TIMEZONE
546 AC_TYPE_OFF_T
547 AC_TYPE_PID_T
548 AC_TYPE_SIZE_T
549 AC_TYPE_UID_T
551 AC_CHECK_MEMBERS(struct tm.tm_gmtoff)
553 # Look for some functions
554 AC_CHECK_FUNCS([getpagesize kqueue statfs statvfs \
555     clone kse_create rfork_thread thr_create sa_register \
556     getcontext makecontext setcontext sigaltstack swapcontext])
558 AC_FUNC_MMAP
560 #-----------------------------------------------------------------------------
563 # GCC 4.1+ has a stack protection feature that requires OS support. Ubuntu has
564 # it switched on by default, and we use the host compiler, so it compiles AROS
565 # code with this enabled resulting in link failures as we don't have support
566 # for it.
568 # We use two methods to disable it. For the host compiler (used to compile
569 # some hosted modules), we test to see if the compiler supports stack
570 # protection, and if it does we disable it in AROS_CONFIG_CFLAGS. This should
571 # work on all platforms.
574 AC_MSG_CHECKING([whether ${CC} accepts -fno-stack-protector])
575 save_cflags="$CFLAGS"
576 CFLAGS="$CFLAGS -fno-stack-protector"
577 AC_TRY_COMPILE(,, use_no_stack_protector="yes", use_no_stack_protector="no")
578 AC_MSG_RESULT($use_no_stack_protector)
579 if test "x-$use_no_stack_protector" = "x-yes" ; then
580     aros_host_cflags="$aros_host_cflags -fno-stack-protector"
582 CFLAGS="$save_cflags"
584 #-----------------------------------------------------------------------------
586 # Disable pointer-signedness warnings if the compiler recognises the option
587 # (this only works for the host compiler at the moment)
589 AC_MSG_CHECKING([whether ${CC} accepts -Wno-pointer-sign])
590 save_cflags="$CFLAGS"
591 CFLAGS="$CFLAGS -Wno-pointer-sign"
592 AC_TRY_COMPILE(,, use_no_sign_warning="yes", use_no_sign_warning="no")
593 AC_MSG_RESULT($use_no_sign_warning)
594 if test "x-$use_no_sign_warning" = "x-yes" ; then
595     aros_host_cflags="$aros_host_cflags -Wno-pointer-sign"
597 CFLAGS="$save_cflags"
599 #-----------------------------------------------------------------------------
601 # Check if host compiler supports -fgnu89-inline, can be needed for crosstools.
603 AC_MSG_CHECKING([whether ${CC} accepts -fgnu89-inline])
604 save_cflags="$CFLAGS"
605 CFLAGS="$CFLAGS -fgnu89-inline"
606 AC_TRY_COMPILE(,, use_gnu89_inline="yes", use_gnu89_inline="no")
607 AC_MSG_RESULT($use_gnu89_inline)
608 if test "x-$use_gnu89_inline" = "x-yes" ; then
609     gnu89_inline="-fgnu89-inline"
611 CFLAGS="$save_cflags"
614 # For GCC < 4.0 -I- is used for giving the search path for '#include "..."'
615 # On GCC >= 4.0 -iquote should be used
617 AC_MSG_CHECKING([whether ${CC} accepts -iquote])
618 CFLAGS="$CFLAGS -iquote."
619 AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
620 AC_MSG_RESULT($has_iquote)
621 if test "x-$has_iquote" = "x-yes" ; then
622     host_cflags_iquote=-iquote
623     host_cflags_iquote_end=
624 else
625     host_cflags_iquote=-I
626     host_cflags_iquote_end=-I-
629 AC_MSG_NOTICE([Performing target configuration...])
631 dnl --------------------------------------------------------------------
632 dnl Target Configuration Section
633 dnl --------------------------------------------------------------------
635 dnl The target configuration section is responsible for setting up all
636 dnl the paths for includes, and tools required to build AROS to some
637 dnl particular target.
639 aros_nowarn_flags="NOWARN_POINTER_SIGN NOWARN_PARENTHESES"
641 toolchain_needs_sysroot=no
643 aros_config_cflags="-Wall -Werror-implicit-function-declaration"
644 aros_config_aflags="-Wall -x assembler-with-cpp -c"
645 aros_config_ldflags=""
647 aros_shared_default=yes
649 aros_shared_cflags="-fPIC"
650 aros_shared_aflags=""
651 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
652 aros_kernel_ldflags="-Wl,-rpath,./lib"
654 aros_kernel_ar_flags="cr"
655 aros_target_ar_flags="cr"
656 aros_target_nm_flags="-C -ul"
657 aros_target_strip_flags="--strip-unneeded -R.comment"
659 aros_compiler_libs=
660 aros_arch_libs=
662 aros_target_genmap="-Wl,-Map -Xlinker"
664 # Native flavour stuff
665 aros_serial_debug="0"
667 # Palm native flavour stuff
668 aros_palm_debug_hack="0"
670 # Unix flavour stuff
671 aros_nesting_supervisor="0"
673 # Collect-aros stuff: "-ius" to ignore undefined symbols
674 ignore_undefined_symbols=""
676 # Check for X11 by default
677 need_x11="auto"
679 host_x_gfx=no
680 host_sdl_gfx=no
681 host_android_gfx=no
684 AC_MSG_CHECKING([Which toolchain family to use ...])
685 AC_ARG_WITH(toolchain,AC_HELP_STRING([--with-toolchain=family],[Which toolchain family to crosscompile with (defaults to gnu)]),aros_toolchain="$withval",aros_toolchain="gnu")
686 AC_MSG_RESULT($aros_toolchain)
688 case "$aros_toolchain" in
689     *llvm*)
690         # toolchain_needs_sysroot=yes
691         toolchain_c_compiler="clang"
692         toolchain_cxx_compiler="clang++"
693         toolchain_cpp_preprocessor="clang -E"
694         toolchain_ld="lld"
695         toolchain_as="llvm-as"
696         toolchain_ar="llvm-ar"
697         toolchain_ranlib="llvm-ranlib"
698         toolchain_nm="llvm-nm"
699         toolchain_strip="true"
700         toolchain_objcopy="llvm-objcopy"
701         toolchain_objdump="llvm-objdump"
702         ;;
703     *gnu*)
704         toolchain_c_compiler="gcc"
705         toolchain_cxx_compiler="g++"
706         toolchain_cpp_preprocessor="cpp"
707         toolchain_ld="ld"
708         toolchain_as="as"
709         toolchain_ar="ar"
710         toolchain_ranlib="ranlib"
711         toolchain_nm="nm"
712         toolchain_strip="strip"
713         toolchain_objcopy="objcopy"
714         toolchain_objdump="objdump"
715         ;;
716     *)
717         AC_MSG_WARN("Unknown toolchain family!")
718         toolchain_c_compiler="cc"
719         toolchain_cxx_compiler="c++"
720         toolchain_cpp_preprocessor="cpp"
721         toolchain_ld="ld"
722         toolchain_as="as"
723         toolchain_ar="ar"
724         toolchain_ranlib="ranlib"
725         toolchain_nm="nm"
726         toolchain_strip="strip"
727         toolchain_objcopy="objcopy"
728         toolchain_objdump="objdump"
729         ;;
730 esac
732 #-----------------------------------------------------------------------------
734 AC_MSG_CHECKING([which type of build to do])
735 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")
737 if test "$build_type" = "nightly"; then
738     build_type_string="NIGHTLY"
739 elif test "$build_type" = "snapshot"; then
740     build_type_string="SNAPSHOT"
741 elif test "$build_type" = "milestone"; then
742     build_type_string="MILESTONE"
743 elif test "$build_type" = "release"; then
744     build_type_string="RELEASE"
745 else
746     build_type_string="PERSONAL"
747     build_type="personal"
750 aros_config_cflags="$aros_config_cflags -DAROS_BUILD_TYPE=AROS_BUILD_TYPE_$build_type_string"
752 AC_MSG_RESULT($build_type)
754 #-----------------------------------------------------------------------------
755 all_debug_types="messages stack modules mungwall symbols"
757 AC_MSG_CHECKING([which debug types to enable])
758 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)]),
759  debug="$enableval",debug="")
761 if test "$debug" = "" -o "$debug" = "no"; then
762     debug="none"
763 elif test "$debug" = "yes"; then
764     debug="all"
767 if test "$debug" = "all" ; then
768     debug="messages stack modules symbols"
769     for d in $all_debug_types; do
770         export aros_${d}_debug="1"
771     done
772 else
773     for d in $all_debug_types; do
774         export aros_${d}_debug="0"
775     done
778 if test "$debug" != "none"; then
779     debug=`echo $debug | sed s/,/\ /g`
780     for d in $debug; do
781         found="0"
782         for d2 in $all_debug_types; do
783             if test "$d2" = "$d"; then
784                 found="1"
785                 break
786             fi
787         done
788         if test "$found" = "0"; then
789             AC_MSG_ERROR([unrecognized debug type "$d". Available types are: all none $all_debug_types])
790         fi
791         export aros_${d}_debug="1"
792     done
793     aros_debug="yes"
795 AC_MSG_RESULT($debug)
797 if test "$aros_messages_debug" = "1"; then
798     aros_messages_debug="-DADEBUG=1 -DMDEBUG=1"
799 else
800     aros_messages_debug=""
802 if test "$aros_symbols_debug" = "1"; then
803     aros_symbols_debug="-g"
804 else
805     aros_symbols_debug=""
808 # These are the flags to pass when compiling debugged programs
809 aros_debug_cflags="$aros_symbols_debug $aros_messages_debug"
810 aros_debug_aflags=""
811 aros_debug_ldflags="$aros_symbols_debug"
813 #-----------------------------------------------------------------------------
814 #   Checking for distcc and ccache.
816 #   Always apply the transforms in this particular order. Basically you should
817 #   always run 'ccache distcc compiler' in that order for the best performance.
819 AC_MSG_CHECKING([whether to enable distcc])
820 AC_ARG_ENABLE(distcc,AC_HELP_STRING([--enable-distcc],[Use distcc as a front end to the compiler (default=no).]),distcc="$enableval",distcc="no")
821 if test "$distcc" != "" -a "$distcc" != "no"; then
822     # AC_CHECK_PROG will print out the result in this case
823     AC_PATH_PROG(DISTCC,[distcc],distcc,)
824 else
825     AC_MSG_RESULT(no)
828 AC_MSG_CHECKING([whether to enable ccache])
829 AC_ARG_ENABLE(ccache,AC_HELP_STRING([--enable-ccache],[Use ccache as a front end to the compiler (default=no).]),ccache="$enableval",ccache="no")
830 if test "$ccache" != "" -a "$ccache" != "no"; then
831     # AC_CHECK_PROG will print out the result in this case
832     AC_CHECK_PROG(CCACHE,[ccache],ccache,)
833 else
834     AC_MSG_RESULT(no)
837 #-----------------------------------------------------------------------------
838 AC_MSG_CHECKING([what specific host gcc version to use])
839 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="")
840 AC_MSG_RESULT($kernel_tool_version)
842 #-----------------------------------------------------------------------------
843 AC_MSG_CHECKING([what optimization flags to use])
844 AC_ARG_WITH(optimization,AC_HELP_STRING([--with-optimization=FLAGS],[Use optimization flags FLAGS (default=-O2).]),optimization="$withval",optimization="unknown")
845 if test "$optimization" = "unknown"; then
846     dnl default is -O2 for normal builds, -O0 for debug builds
847     if test "$debug" != "none"; then
848         optimization="-O0"
849     else
850         optimization="-O2"
851     fi
853 aros_optimization_cflags="$optimization"
854 AC_MSG_RESULT($optimization)
856 #-----------------------------------------------------------------------------
857 AC_MSG_CHECKING([which paranoia flags to use])
858 AC_ARG_WITH(paranoia,AC_HELP_STRING([--with-paranoia=FLAGS],[compiler warning flags to enable for paranoia]),[paranoia_flags="$withval"],[paranoia_flags="default"])
859 if test "$paranoia_flags" = "default"; then
860         paranoia_flags=""
861         msg_result="none"
862 else if test "$paranoia_flags" = "yes"; then
863         paranoia_flags="-Wall -Werror"
864         msg_result="$paranoia_flags"
865 fi fi
866 AC_MSG_RESULT($msg_result)
867 aros_config_cflags="$aros_config_cflags $paranoia_flags"
869 #-----------------------------------------------------------------------------
870 AC_MSG_CHECKING([what target variant to enable])
871 AC_ARG_ENABLE(target_variant,AC_HELP_STRING([--enable-target-variant=NAME],[Enable a specific target variant(default=none)]),target_variant=$enableval,target_variant="")
872 if test "$target_variant" = ""; then
873     aros_target_variant=""
874     aros_target_suffix=""
875     enableval="none"
876 else
877     aros_target_variant="$target_variant"
878     aros_target_suffix="-$target_variant"
880 AC_MSG_RESULT($enableval)
882 #-----------------------------------------------------------------------------
883 # Target-specific defaults. You can override then on a per-target basis.
885 # Bootloader name. Currently used by PC target.
886 target_bootloader="none"
887 ENABLE_EXECSMP=
889 #-----------------------------------------------------------------------------
890 # Additional options for some specific targets
892 case "$aros_target_variant" in
893 ios)
894     AC_MSG_CHECKING([XCode path])
895     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")
896     AC_MSG_RESULT($aros_xcode_path)
898     AC_MSG_CHECKING([what iOS SDK version to use])
899     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")
900     AC_MSG_RESULT($aros_sdk_version)
902     ;;
904 "android")
905     AC_MSG_CHECKING([Android SDK path])
906     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)
907     AC_MSG_RESULT($aros_android_sdk)
909     AC_MSG_CHECKING([Android NDK path])
910     AC_ARG_WITH(ndk,AC_HELP_STRING([--with-ndk=PATH],[Specify Android NDK path (default=none).]),aros_android_ndk="$withval",aros_android_ndk="none")
911     AC_MSG_RESULT($aros_android_ndk)
913     AC_MSG_CHECKING([what Android SDK version to use])
914     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")
915     AC_MSG_RESULT($aros_sdk_version)
917     aros_android_level=android-$aros_sdk_version
918     if test ! -d $aros_android_sdk/platforms/$aros_android_level; then
919         echo "Platform $aros_android_level is not installed in your SDK"
920         echo "Use --with-sdk-version=<API level number> to select another platform version"
921         echo "You can check what plaform versions are installed in your SDK"
922         echo "by examining contents of $aros_android_sdk/platforms directory"
923         AC_MSG_ERROR([Android platform $aros_android_level is not installed])
924     fi
926     export PATH="$aros_android_sdk/tools:$PATH"
927     AC_PATH_PROG(android_tool, $android_tool)
928     AROS_REQUIRED(android,$android_tool)
930     if test "$aros_android_ndk" != "none"; then
931         AC_MSG_CHECKING([what Android NDK version to use])
932         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")
933         AC_MSG_RESULT($aros_ndk_version)
934     fi
936     AC_PATH_PROG(ant, ant)
937     if test "$ant" = ""; then
938         AC_MSG_WARN([Apache Ant is missing, Java bootstrap can't be built automatically])
939     fi
941     AC_MSG_CHECKING([Build debug or release apk])
942     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)
943     if test $aros_android_antapk != release -a $aros_android_antapk != debug; then
944         AC_MSG_ERROR([apk-version has to be release or debug])
945     fi
946     AC_MSG_RESULT($aros_android_antapk)
948     dnl MSYS bash can't run .bat files directly, then need to be started via cmd.exe
949     if test "$host_os" = "mingw32"; then
950         android_tool="cmd //c $android_tool"
951     fi
953     need_dlopen="no"
955     ;;
956 esac
958 #-----------------------------------------------------------------------------
959 # External toolchains
960 kernel_tool_prefix="none"
961 aros_tool_prefix="none"
962 elf_tool_prefix="${target_cpu}-elf-"
964 # This is the target configuration switch.
965 case "$target_os" in
966     linux*)
967         aros_target_arch="linux"
968         aros_target_family="unix"
969         case "$target_cpu" in
970             *m68k*)
971                 aros_target_cpu="m68k"
972                 aros_object_format="m68kelf"
973                 aros_flavour="emulcompat"
974                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D__mc68000 -D__linux__"
975                 aros_shared_ldflags="-Wl,-T,\$(TOP)/config/linux/m68k/script.so"
976                 aros_kernel_ldflags="-Wl,-rpath,./lib,-T,\$(TOP)/config/linux/m68k/script.normal"
977                 gcc_target_cpu="mc68000"
978                 ;;
979             *i?86*)
980                 aros_target_cpu="i386"
981                 aros_object_format="elf_i386"
982                 aros_flavour="emulation"
983                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__linux__"
984                 aros_kernel_ldflags="-Wl,-melf_i386"
985                 aros_nominal_depth=8
986                 gcc_target_cpu="i386"
987                 pci_hidd_target="hidd-pci-linux"
988                 android_tool_dir_prefix="x86"
989                 android_tool_prefix="i686-android-linux"
990                 android_ndk_arch="x86"
991                 ;;
992             *x86_64*)
993                 aros_target_cpu="x86_64"
994                 aros_object_format="elf_x86_64"
995                 aros_flavour="emulation"
996                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64 -D__linux__"
997                 aros_config_cflags="$aros_config_cflags -mcmodel=large -mno-red-zone -fno-omit-frame-pointer"
998                 aros_nominal_depth=8
999                 pci_hidd_target="hidd-pci-linux"
1000                 ;;
1001             *powerpc*)
1002                 aros_target_cpu="ppc"
1003                 aros_object_format="elf32ppc"
1004                 aros_flavour="emulation"
1005                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc -D__linux__"
1006                 aros_nominal_depth=8
1007                 gcc_target_cpu="ppc"
1008                 ;;
1009 # TODO
1010 # Same as powerpc, but I need this for the nightly build to work again.
1011 # Actually, the nightly should be made working with powerpc target.
1012 # That just was too much work for the moment, another week or two.
1013             *ppc*)
1014                 aros_target_cpu="ppc"
1015                 aros_object_format="elf32ppc"
1016                 aros_flavour="emulation"
1017                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc -D__linux__"
1018                 aros_nominal_depth=8
1019                 gcc_target_cpu="ppc"
1020                 ;;
1021             *aarch64*)
1022                 aros_target_cpu="aarch64"
1023                 target_cpu="aarch64"
1024                 aros_object_format="aarch64elf_aros"
1025                 aros_flavour="emulation"
1026                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm -D__linux__"
1027                 gcc_target_cpu="aarch64"
1028                 aros_config_cflags="$aros_config_cflags -fno-strict-aliasing -fno-omit-frame-pointer"
1029                 aros_config_aflags="$aros_config_aflags -fno-strict-aliasing"
1030                 aros_arch_libs="-laeabi"
1031                 gcc_default_float_abi="hard"
1032                 kernel_tool_prefix="aarch64-linux-gnueabihf-"
1033                 ;;
1034             *armhf*)
1035                 aros_target_cpu="arm"
1036                 target_cpu="arm"
1037                 aros_object_format="armelf_aros"
1038                 aros_flavour="emulation"
1039                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm -D__linux__"
1040                 gcc_target_cpu="arm"
1041                 aros_config_cflags="$aros_config_cflags -fno-strict-aliasing -fno-omit-frame-pointer"
1042                 aros_config_aflags="$aros_config_aflags -fno-strict-aliasing"
1043                 aros_arch_libs="-laeabi"
1044                 gcc_default_float_abi="hard"
1045                 android_tool_dir_prefix="arm-linux-androideabi"
1046                 android_tool_prefix="arm-linux-androideabi"
1047                 android_ndk_arch="arm"
1048                 kernel_tool_prefix="arm-linux-gnueabihf-"
1049                 ;;
1050             *arm*)
1051                 aros_target_cpu="arm"
1052                 aros_object_format="armelf_aros"
1053                 aros_flavour="emulation"
1054                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm -D__linux__"
1055                 gcc_target_cpu="arm"
1056                 aros_config_cflags="$aros_config_cflags -fno-strict-aliasing -fno-omit-frame-pointer"
1057                 aros_config_aflags="$aros_config_aflags -fno-strict-aliasing"
1058                 aros_arch_libs="-laeabi"
1059                 android_tool_dir_prefix="arm-linux-androideabi"
1060                 android_tool_prefix="arm-linux-androideabi"
1061                 android_ndk_arch="arm"
1062                 kernel_tool_prefix="arm-linux-gnueabi-"
1063                 ;;
1064             *)
1065                 AC_MSG_ERROR("Unknown CPU for Linux -- $target_cpu")
1066                 ;;
1067         esac
1068         case "$aros_target_variant" in
1069             android)
1071                 dnl Not all Linux CPUs are supported by Android
1072                 if test "$android_ndk_arch" = ""; then
1073                     AC_MSG_ERROR("Unsupported CPU for Android -- $target_cpu")
1074                 fi
1076                 aros_nominal_width=320
1077                 aros_nominal_height=480
1078                 if test "$aros_android_ndk" = "none"; then
1079                     dnl Use standalone toolchain, don't adjust paths
1080                     aros_kernel_cflags="-mandroid"
1081                     aros_kernel_ldflags="-mandroid"
1082                     CFLAGS="-mandroid"
1083                 else
1084                     dnl In Android NDK toolchains are placed in own directories,
1085                     dnl but tool names are not suffixed with version 
1086                     export PATH="$aros_android_ndk/toolchains/$android_tool_dir_prefix-$kernel_tool_version/prebuilt/$android_build_os/bin:$PATH"
1087                     kernel_tool_version=""
1088                     aros_android_ndk="$aros_android_ndk/platforms/android-$aros_ndk_version/arch-$android_ndk_arch"
1089                     aros_kernel_cflags="--sysroot $aros_android_ndk -mandroid"
1090                     aros_kernel_ldflags="--sysroot $aros_android_ndk -mandroid"
1091                     CFLAGS="$CFLAGS --sysroot $aros_android_ndk -mandroid"
1092                     aros_kernel_includes="-isystem $aros_android_ndk/usr/include"
1093                 fi
1094                 need_x11=no
1095                 host_android_gfx=yes
1096                 # Disable implicit PIC mode
1097                 aros_target_cflags="$aros_target_cflags -fno-pic"
1098                 kernel_tool_prefix="$android_tool_prefix-"
1099             ;;
1100         esac
1101     ;;
1103     pc)
1104         aros_target_arch="pc"
1105         aros_shared_default="no"
1106         target_bootloader="grub2"
1107         case "$target_cpu" in
1108             *i?86*)
1109                 aros_target_cpu="i386"
1111                 dnl If somebody hasn't already set the target object
1112                 dnl format, then use this value. Mostly to support
1113                 dnl FreeBSD cross-compilation.
1114                 dnl TODO: Remove when we always use our compiler.
1116                 if test "$aros_object_format" = "" ; then
1117                     aros_object_format="elf_i386"
1118                 fi
1119                 aros_flavour="standalone"
1120                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1121                 aros_kernel_ldflags="-Wl,-melf_i386"
1122                 aros_nominal_width=640
1123                 aros_nominal_height=480
1124                 gcc_target_cpu="i386"
1125                 ;;
1126             *x86_64*)
1127                 aros_target_cpu="x86_64"
1128                 aros_serial_debug=1
1129                 if test "$aros_object_format" = "" ; then
1130                     aros_object_format="elf_x86_64"
1131                 fi
1132                 aros_flavour="standalone"
1133                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
1134                 aros_config_cflags="$aros_config_cflags -mcmodel=large -fno-asynchronous-unwind-tables -mno-red-zone -fno-omit-frame-pointer"
1135                 aros_kernel_ldflags=""
1136                 aros_nominal_width=640
1137                 aros_nominal_height=480
1138                 case "$aros_target_variant" in
1139                     smp)
1140                         ENABLE_EXECSMP="#define __AROSEXEC_SMP__"
1141                     ;;
1142                 esac
1143                 ;;
1144             *)
1145                 AC_MSG_ERROR("Unknown native CPU -- $target_cpu")
1146                 ;;
1147         esac
1148         ;;
1150     prep)
1151         aros_target_arch="prep"
1152         aros_shared_default="no"
1153         aros_target_cpu="ppc"
1154         aros_object_format="elf32ppc"
1155         aros_flavour="ppcnative"
1156         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1157         aros_kernel_ldflags=""
1158         aros_nominal_width=640
1159         aros_nominal_height=480
1160         gcc_target_cpu="ppc"
1161         ;;
1163     freebsd*)
1164         aros_target_arch="freebsd"
1165         aros_target_family="unix"
1166         aros_target_cpu="i386"
1167         aros_flavour="emulation"
1168         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1169         gcc_target_cpu="i386"
1171         aros_target_strip_flags="-x"
1172         ;;
1174     darwin*)
1175         aros_target_arch="darwin"
1176         aros_target_family="unix"
1177         aros_flavour="emulation"
1178         case "$target_cpu" in
1179             *i?86*)
1180                 aros_ios_platform="iPhoneSimulator"
1181                 aros_target_cpu="i386"
1182                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1183                 aros_kernel_ldflags=""
1184                 aros_macosx_version="10.4"
1185                 aros_nominal_depth=8
1186                 gcc_target_cpu="i386"
1187                 aros_object_format="elf_i386"
1188                 aros_kernel_ar_flags="-cr"
1189                 aros_target_strip_flags="-x"
1190                 kernel_tool_flags="-m32"
1191                 ;;
1192             *x86_64*)
1193                 aros_target_cpu="x86_64"
1194                 aros_object_format="elf_x86_64"
1195                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
1196                 aros_macosx_version="10.6"
1197                 aros_config_cflags="$aros_config_cflags -fno-omit-frame-pointer"
1198                 aros_kernel_cflags="-m64"
1199                 aros_kernel_ldflags="-m64"
1200                 aros_target_cflags="-mcmodel=large"
1201                 aros_nominal_depth=8
1202                 aros_kernel_ar="ar"
1203                 aros_kernel_ar_flags="-cr"
1204                 aros_kernel_ld="ld"
1205                 aros_kernel_as="as"
1206                 aros_kernel_ranlib="ranlib"
1207                 aros_kernel_nm="nm"
1208                 aros_kernel_strip="strip"
1209                 kernel_tool_prefix="i686-apple-darwin10-"
1210                 ;;
1211             *ppc*)
1212                 aros_target_cpu="ppc"
1213                 aros_object_format="elf32ppc"
1214                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1215                 aros_kernel_ldflags=""
1216                 aros_macosx_version="10.0"
1217                 aros_nominal_depth=8
1218                 gcc_target_cpu="ppc"
1219                 aros_kernel_ar="ar"
1220                 aros_kernel_ar_flags="-cr"
1221                 aros_kernel_ld="ld -arch ppc"
1222                 aros_kernel_as="as -arch ppc"
1223                 aros_kernel_ranlib="ranlib -arch ppc"
1224                 aros_kernel_nm="nm -arch ppc"
1225                 aros_kernel_strip="strip -arch ppc"
1226                 kernel_tool_prefix="powerpc-apple-darwin10-"
1227                 ;;
1228             *arm*)
1229                 aros_ios_platform="iPhoneOS"
1230                 aros_target_cpu="arm"
1231                 aros_object_format="armelf_aros"
1232                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
1233                 aros_arch_libs="-laeabi"
1234                 aros_nominal_depth=8
1235                 gcc_target_cpu="arm"
1236                 aros_kernel_ar="ar"
1237                 aros_kernel_ar_flags="-cr"
1238                 aros_kernel_ld="ld -arch arm"
1239                 aros_kernel_ranlib="ranlib -arch arm"
1240                 kernel_tool_prefix="arm-apple-darwin10-" 
1241                 export PATH="$aros_xcode_path/Platforms/$aros_ios_platform.platform/Developer/usr/bin:$PATH"
1242                 ;;
1243             *)
1244                 AC_MSG_ERROR("Unsupported target CPU for darwin hosted flavour -- $target_cpu")
1245                 ;;
1246         esac
1247         case "$aros_target_variant" in
1248             ios)
1249                 aros_ios_version="3.0"
1250                 aros_nominal_width=320
1251                 aros_nominal_height=480
1252                 aros_ios_sdk="$aros_xcode_path/Platforms/$aros_ios_platform.platform/Developer/SDKs/$aros_ios_platform$aros_sdk_version.sdk"
1253                 kernel_tool_flags="$target_tool_flags -isysroot $aros_ios_sdk"
1254                 aros_kernel_includes="-isystem $aros_ios_sdk/usr/include"
1255                 need_x11=no
1256                 # This is here because it may depend on iOS or SDK version
1257                 aros_kernel_cflags="$aros_kernel_cflags -miphoneos-version-min=$aros_ios_version"
1258                 aros_kernel_ldflags="$aros_kernel_ldflags -miphoneos-version-min=$aros_ios_version"
1259                 aros_kernel_objcflags="-fobjc-abi-version=2 -fobjc-legacy-dispatch"
1260             ;;
1261             *)
1262                 aros_kernel_cflags="$aros_kernel_cflags -mmacosx-version-min=$aros_macosx_version"
1263                 aros_kernel_ldflags="$aros_kernel_ldflags -mmacosx-version-min=$aros_macosx_version"
1264             ;;
1265         esac
1266         ;;
1268     dragonfly*)
1269         aros_target_arch="dragonfly"
1270         aros_target_family="unix"
1271         aros_flavour="emulation"
1272         case "$target_cpu" in
1273             *i?86*)
1274                 aros_target_cpu="i386"
1275                 aros_object_format="elf_i386"
1276                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__DragonFly__"
1277                 ;;
1278             *x86_64*)
1279                 aros_config_cflags="$aros_config_cflags -fno-omit-frame-pointer"
1280                 aros_target_cpu="x86_64"
1281                 aros_object_format="elf_x86_64"
1282                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64 -D__DragonFly__"
1283                 ;;
1284             *)
1285                 AC_MSG_ERROR("Unknown CPU for DragonFly -- $target_cpu")
1286                 ;;
1287         esac
1288         ;;
1290     netbsd*)
1291         aros_target_arch="netbsd"
1292         aros_target_family="unix"
1293         case "$target_cpu" in
1294             *m68k*)
1295                 aros_target_cpu="m68k"
1296                 aros_object_format="m68kelf"
1297                 aros_flavour="emulcompat"
1298                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D__mc68000 -D__NetBSD__"
1299                 gcc_target_cpu="mc68000"
1300                 ;;
1301             *i?86*)
1302                 aros_target_cpu="i386"
1303                 aros_object_format="elf_i386"
1304                 aros_flavour="emulation"
1305                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__NetBSD__"
1306                 aros_nominal_depth=8
1307                 gcc_target_cpu="i386"
1308                 ;;
1309             *)
1310                 AC_MSG_ERROR("Unknown CPU for NetBSD -- $target_cpu")
1311                 ;;
1312         esac
1313         aros_target_genmap="-Wl,-M -Xlinker >"
1314         aros_flavour="emulation"
1315         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1316         ;;   
1318     openbsd*)
1319         aros_target_arch="openbsd"
1320         aros_target_family="unix"
1321         case "$target_cpu" in
1322             *i?86*)
1323                 aros_target_cpu="i386"
1324                 aros_object_format="elf_i386"
1325                 aros_flavour="emulation"
1326                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__OpenBSD__"
1327                 gcc_target_cpu="i386"
1328                 ;;
1329             *)
1330                 AC_MSG_ERROR("Unknown CPU for OpenBSD -- $target_cpu")
1331                 ;;
1332         esac
1333         aros_target_genmap="-Wl,-M -Xlinker >"
1334         aros_target_nm_flags="-u"
1335         aros_flavour="emulation"
1336         ;;
1338     solaris*)
1339         aros_target_arch="solaris"
1340         aros_target_family="unix"
1341         case "$target_cpu" in
1342            *i?86*)
1343                aros_target_cpu="i386"
1344                aros_object_format="elf_i386"
1345                aros_flavour="emulation"
1346                aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__Solaris__"
1347                aros_nominal_depth=8
1348                gcc_target_cpu="i386"
1349                ;;
1350             *sparc*)
1351                 aros_target_cpu="sparc"
1352                 aros_object_format="elf_sparc"
1353                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dsparc -D__Solaris__"
1354                 gcc_target_cpu="sparc"
1355                 ;;
1356             *)
1357                 AC_MSG_ERROR("Unknown CPU for Solaris -- $target_cpu")
1358                 ;;
1359         esac
1360         aros_config_cflags="$aros_config_cflags -D$aros_target_cpu"
1361         aros_flavour="emulation"
1362         ;;
1364     morphos*)
1365         aros_target_arch="morphos"
1366         aros_shared_default="no"
1367         aros_target_cpu="ppc"
1368         aros_object_format="elf_ppc"
1369         aros_flavour="nativecompat"
1370         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1371         gcc_target_cpu="ppc"
1372         ;;
1374     sam440)
1375         aros_target_arch="sam440"
1376         aros_shared_default="no"
1377         aros_target_cpu="ppc"
1378         aros_object_format="elf32ppc"
1379         aros_flavour="ppcnative"
1380         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1381         aros_kernel_ldflags=""
1382         aros_nominal_width=1024
1383         aros_nominal_height=768
1384         aros_nominal_depth=24
1385         aros_config_cflags="$aros_config_cflags -mcpu=440fp -mno-toc -fno-asynchronous-unwind-tables"
1386         gcc_target_cpu="powerpc"
1387         ;;
1389     efika)
1390         aros_target_arch="efika"
1391         aros_shared_default="no"
1392         aros_target_cpu="arm"
1393         aros_object_format="armelf_aros"
1394         aros_flavour="standalone"
1395         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
1396         aros_kernel_ldflags=""
1397         aros_nominal_width=1024
1398         aros_nominal_height=600
1399         aros_arch_libs="-laeabi"
1400         gcc_default_cpu="armv7-a"
1401         gcc_default_fpu="vfpv3"
1402         aros_config_cflags="$aros_config_cflags -mtune=cortex-a8 -fno-strict-aliasing -fno-asynchronous-unwind-tables"
1403         aros_config_aflags="$aros_config_aflags -mtune=cortex-a8 -fno-strict-aliasing -fno-asynchronous-unwind-tables"
1404         aros_optimization_cflags="$aros_optimization_cflags -Os"
1405         case "$target_cpu" in
1406             *armhf*)
1407                 gcc_default_float_abi="hard"
1408                 target_cpu=arm
1409                 aros_target_cpu=arm
1410                 ;;
1411             *arm*)
1412                 gcc_default_float_abi="softfp"
1413                 ;;
1414             *)
1415                 AC_MSG_ERROR("Unknown CPU for EfikaMX $target_cpu")
1416                 ;;
1417         esac
1418         ;;
1419         
1420     chrp)
1421         aros_target_arch="chrp"
1422         aros_shared_default="no"
1423         aros_target_cpu="ppc"
1424         aros_object_format="elf32ppc"
1425         aros_flavour="ppcnative"
1426         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1427         aros_kernel_ldflags=""
1428         aros_nominal_width=640
1429         aros_nominal_height=480
1430         aros_config_cflags="$aros_config_cflags -mno-toc -fno-asynchronous-unwind-tables"    
1431         gcc_target_cpu="powerpc"
1432         case "$aros_target_variant" in
1433             efika)
1434                 aros_config_cflags="$aros_config_cflags -DBIG_ENDIAN_OHCI=1 -mcpu=603e"
1435             ;;
1436         esac
1437         ;;
1439     r*pi)
1440         aros_flavour="standalone"
1441         aros_target_arch="raspi"
1443         aros_shared_default="no"
1445         aros_target_mkdep="$aros_target_mkdep -D__GNUC__"
1446         
1447         case "$target_cpu" in
1448             *aarch64*)
1449                 aros_target_cpu="aarch64"
1450                 gcc_default_cpu="aarch64"
1451                 aros_object_format="aarch64elf_aros"
1452                 ;;
1453             *armhf*)
1454                 aros_target_cpu="arm"
1455                 gcc_default_cpu="armv6zk"
1456                 gcc_default_cpu_tune="arm1176jzf-s"
1457                 aros_object_format="armelf_aros"
1458                 aros_config_cflags="$aros_config_cflags -marm"
1459                 aros_config_aflags="$aros_config_aflags -marm"
1460                 aros_kernel_cflags="$aros_kernel_cflags -marm"
1461                 aros_target_cflags="$aros_kernel_cflags -marm"
1462                 aros_target_mkdep="$aros_target_mkdep -Darm"
1463                 aros_arch_libs="-laeabi"
1464                 ;;
1465             *arm*)
1466                 aros_target_cpu="arm"
1467                 gcc_default_cpu="armv6zk"
1468                 gcc_default_cpu_tune="arm1176jzf-s"
1469                 aros_object_format="armelf_aros"
1470                 aros_config_cflags="$aros_config_cflags -marm"
1471                 aros_config_aflags="$aros_config_aflags -marm"
1472                 aros_kernel_cflags="$aros_kernel_cflags -marm"
1473                 aros_target_cflags="$aros_kernel_cflags -marm"
1474                 aros_target_mkdep="$aros_target_mkdep -Darm"
1475                 aros_arch_libs="-laeabi"
1476                 ;;
1477             *)
1478                 AC_MSG_ERROR("Unknown CPU for RasPi $target_cpu")
1479                 ;;
1480         esac
1482         aros_config_cflags="$aros_config_cflags -Wno-error -fno-asynchronous-unwind-tables -fno-exceptions"
1483         aros_config_aflags="$aros_config_aflags -Wno-error -fno-asynchronous-unwind-tables -fno-exceptions"
1484         aros_kernel_cflags="$aros_kernel_cflags -Wno-error -fno-asynchronous-unwind-tables -fno-exceptions"
1485         aros_target_cflags="$aros_kernel_cflags -Wno-error -fno-asynchronous-unwind-tables -fno-exceptions"
1487         case "$aros_target_variant" in
1488             smp)
1489                 ENABLE_EXECSMP="#define __AROSEXEC_SMP__"
1490             ;;
1491         esac
1492         ;;
1494     stm32f7_discovery)
1495         aros_flavour="standalone"
1496         aros_target_arch="stm32f7_discovery"
1497         aros_target_cpu="arm"
1498         aros_target_cpu_mode="thumb2"
1499         aros_object_format="armelf_aros"
1500         aros_shared_default="no"
1502         # stm32f7 has DSP opcode support
1503         gcc_default_cpu="armv7e-m"
1504         # gcc_default_cpu="armv7-m"
1505         gcc_default_cpu_tune="cortex-m7"
1506         gcc_default_fpu="fpv4-sp-d16"
1507         # GCC does not recognize fpv5-sp-d16 which should be the correct one to use, or not...
1508         # gcc_default_fpu="fpv5-sp-d16"
1509                 gcc_default_float_abi="hard"
1511         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dthumb"
1512         ;;
1514     amiga*)
1515         aros_target_arch="amiga"
1516         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D_AMIGA -DAMIGA"
1517         aros_shared_default="no"
1519         case "$target_cpu" in
1520             *m68k*)
1521                 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")
1522                 aros_enable_mmu=no
1523                 aros_target_cpu="m68k"
1524                 aros_object_format="m68kelf"
1525                 aros_flavour="standcompat"
1526                 gcc_target_cpu="m68000"
1527                 aros_nowarn_flags="$aros_nowarn_flags NOWARN_VOLATILE_REGISTER_VAR"
1528                 aros_config_cflags="$aros_config_cflags -fno-strict-aliasing -ffreestanding -fomit-frame-pointer -fbuiltin -DNOLIBINLINE"
1529                 aros_optimization_cflags="$aros_optimization_cflags -Os"
1530                 aros_config_aflags="$aros_config_aflags"
1531                 aros_target_strip_flags="-R.comment --strip-debug"
1532                 aros_nominal_width=640
1533                 aros_nominal_height=256
1534                 aros_nominal_depth=2
1535                 ;;
1536             *ppc*)
1537                 aros_cpu="ppc"
1538                 aros_flavour="native"
1539                 gcc_target_cpu="ppc"
1540                 ;;
1541             *)
1542                 AC_MSG_ERROR("Unknown CPU for Amiga $target_cpu")
1543                 ;;
1544         esac
1545         ;;
1547     mingw*)
1548         aros_target_arch="mingw32"
1549         aros_shared_default="no"
1550         aros_flavour="emulation"
1551         aros_shared_cflags=""
1552         need_crosstools="yes"
1553         need_dlopen="no"
1554         rescomp="windres"
1555         case "$target_cpu" in
1556             *i?86*)
1557                 aros_target_cpu="i386"
1558                 aros_object_format="elf_i386"
1559                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1560                 aros_nominal_depth=8
1561                 gcc_target_cpu="i386"
1563                 kernel_tool_prefix="i386-mingw32-"
1564                 ;;
1565             *x86_64*)
1566                 aros_target_cpu="x86_64"
1567                 aros_object_format="elf_x86_64"
1568                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
1569                 aros_config_cflags="$aros_config_cflags -fno-omit-frame-pointer"
1570                 aros_nominal_depth=8
1571                 kernel_tool_prefix="x86_64-w64-mingw32-"
1572                 ;;
1573             *arm*)
1574                 aros_target_cpu="arm"
1575                 aros_object_format="armelf_aros"
1576                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
1577                 aros_arch_libs="-laeabi"
1578                 aros_nominal_depth=8
1579                 gcc_target_cpu="arm"
1580                 gcc_default_float_abi="soft"
1581                 kernel_tool_prefix="arm-mingw32ce-"
1582                 aros_nominal_width=160
1583                 aros_nominal_height=160
1584                 ;;
1585             *)
1586                 AC_MSG_ERROR("Unknown CPU for Mingw32 -- $target_cpu")
1587                 ;;
1588         esac
1589         if test $host_os = "cygwin"; then
1590                 aros_kernel_cflags="-mno-cygwin"
1591         fi
1592     ;;
1593     pp*)
1594         aros_target_arch="pp"
1595         aros_shared_default="no"
1596         case "$target_cpu" in
1597             *m68k*)
1598                 aros_target_cpu="m68k"
1599                 aros_object_format="m68kelf"
1600                 aros_flavour="palmnative"
1601                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
1602                 aros_nominal_width=160
1603                 aros_nominal_height=160
1604                 aros_nominal_depth=1
1605                 aros_target_ar_flags="cru"
1606                 aros_compiler_libs="-lgcc1"
1607                 aros_shared_default=no
1608                 aros_shared_cflags="-fpic"
1609                 aros_shared_aflags=""
1610                 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
1611                 aros_kernel_ldflags="-Wl,-rpath,./lib"
1612                 aros_debug_cflags="$aros_symbols_debug  $aros_messages_debug"
1613                 aros_debug_aflags=""
1614                 aros_debug_ldflags="$aros_symbols_debug"
1615                 aros_mungwall_debug="0"
1616                 aros_modules_debug="0"
1617                 gcc_target_cpu="mc68000"
1618                 ignore_undefined_symbols="-ius"
1619                 ;;
1620            *)
1621                 AC_MSG_ERROR("Unknown CPU for PalmPilot -- $target_cpu")
1622                 ;;
1623         esac
1624         ;;
1626     mac*)
1627         aros_target_arch="mac"
1628         aros_shared_default="no"
1629         case "$target_cpu" in
1630             *m68k*)
1631                 aros_target_cpu="m68k"
1632                 aros_object_format="m68kelf"
1633                 aros_flavour="mac68knative"
1634                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
1635                 aros_nominal_width=512
1636                 aros_nominal_height=384
1637                 aros_nominal_depth=8
1638                 aros_target_ar_flags="cru"
1639                 aros_compiler_libs="-lgcc1"
1640                 aros_shared_default=no
1641                 aros_shared_cflags="-fpic"
1642                 aros_shared_aflags=""
1643                 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
1644                 aros_kernel_ldflags="-Wl,-rpath,./lib"
1645                 aros_debug_cflags="$aros_symbols_debug $aros_messages_debug"
1646                 aros_debug_aflags=""
1647                 aros_debug_ldflags="$aros_symbols_debug"
1648                 aros_mungwall_debug="0"
1649                 aros_modules_debug="0"
1650                 gcc_target_cpu="mc68000"
1651                 ignore_undefined_symbols="-ius"
1652                 ;;
1653            *)
1654                 AC_MSG_ERROR("Unknown CPU for Mac68k -- $target_cpu")
1655                 ;;
1656         esac
1657         ;;
1659     *)
1660         AC_MSG_ERROR([Unsupported target architecture $target])
1661         ;;
1662 esac
1664 #-----------------------------------------------------------------------------
1665 crosstools_guess="yes"
1666 aros_target_toolchain="no"
1667 aros_config_sysroot=""
1668 aros_kernel_sysroot=""
1670 AC_MSG_CHECKING([Kernel toolchain prefix])
1671 AC_ARG_WITH(kernel-toolchain-prefix,AC_HELP_STRING([--with-kernel-toolchain-prefix=...],[Specify crosscompile toolchain prefix for kernel objects]),[kernel_tool_prefix="$withval"])
1672 AC_MSG_RESULT($kernel_tool_prefix)
1674 AC_MSG_CHECKING([ELF toolchain prefix])
1675 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"
1676                                                  crosstools_guess="no"])
1677 AC_MSG_RESULT($elf_tool_prefix)
1679 AC_MSG_CHECKING([AROS toolchain prefix])
1680 AC_ARG_WITH(aros-toolchain,AC_HELP_STRING([--with-aros-toolchain=PREFIX],[Specify prebuilt AROS toolchain. Use yes for default name]),[aros_tool_prefix="$withval"
1681                 crosstools_guess="no"])
1682 if test "$aros_tool_prefix" = "yes" ; then
1683     aros_tool_prefix=$aros_target_cpu-aros-
1685 AC_MSG_RESULT($aros_tool_prefix)
1687 #-----------------------------------------------------------------------------
1688 #   Checking if we should build crosstools..
1689 AC_MSG_CHECKING([whether to build crosstools])
1690 AC_ARG_ENABLE(crosstools,AC_HELP_STRING([--disable-crosstools],[Do not build cross-compiler toolchain]),crosstools="$enableval",crosstools="$crosstools_guess")
1691 AC_MSG_RESULT($crosstools)
1693 if test "${crosstools}" = "yes"; then
1694     if test "${crosstools_guess}" = "no"; then
1695         AC_MSG_ERROR([Cannot build external toolchain if an external ELF or AROS toolchain is specified])
1696     fi
1699 if test "${crosstools}" = "yes" || test "${crosstools_guess}" = "no"; then
1700     aros_target_toolchain="yes"
1703 AC_MSG_CHECKING([where to install the crosstools binaries])
1704 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])
1705 if test "x$aros_toolchain_install" = "x"; then
1706     AROS_CROSSTOOLSDIR="$AROS_BUILDDIR_UNIX/bin/$aros_host_arch-$aros_host_cpu/tools/crosstools"
1707 else
1708     AROS_CROSSTOOLSDIR="$aros_toolchain_install"
1709     PATH="$AROS_CROSSTOOLSDIR:$PATH"
1710     if test "$crosstools_guess" = "no" ; then
1711         toolchain_needs_sysroot=yes
1713         if test "x-$aros_flavour" != "x-emulation" -a "x-$aros_flavour" != "x-emulcompat" ; then
1714             aros_kernel_sysroot = $aros_config_sysroot
1715         fi
1716     fi
1718 AC_MSG_RESULT($AROS_CROSSTOOLSDIR)
1720 AC_MSG_CHECKING([If we need to use --sysroot])
1721 if test "$toolchain_needs_sysroot" = "yes" ; then
1722     aros_config_sysroot="--sysroot $AROS_BUILDDIR_UNIX/bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/AROS/Development"
1724 AC_MSG_RESULT($toolchain_needs_sysroot)
1726 #-----------------------------------------------------------------------------
1727 if test "$aros_toolchain" = "gnu" ; then
1728     AC_MSG_CHECKING([what specific target binutils version to use])
1730 AC_ARG_WITH(binutils-version,AC_HELP_STRING([--with-binutils-version=VERSION],[Use binutils-VERSION for building AROS]),use_binutils_version="$withval",use_binutils_version="")
1731 if test "$use_binutils_version" = ""; then
1732         target_binutils_version="$default_binutils_version"
1733 else
1734     target_binutils_version="$use_binutils_version"
1736 if test "$aros_toolchain" = "gnu" ; then
1737     AC_MSG_RESULT($target_binutils_version)
1741 # Helper to identify gcc version
1742 AC_DEFUN([CROSS_GCC_VERSION], [
1743   target_gcc_version=""
1744   AC_CACHE_CHECK([gcc version],[ax_cv_gcc_version],[
1745     ax_cv_gcc_version="`$AROS_CROSSTOOLSDIR/${aros_tool_prefix}${toolchain_cpp_preprocessor} -dumpversion`"
1746     AS_IF([test "x$ax_cv_gcc_version" = "x"],[
1747       ax_cv_gcc_version=""
1748     ])
1749   ])
1750   target_gcc_version=$ax_cv_gcc_version
1751   AC_SUBST([target_gcc_version])
1754 #-----------------------------------------------------------------------------
1755 if test "$aros_toolchain" = "gnu" ; then
1756     AC_MSG_CHECKING([what specific target gcc version to use])
1758 AC_ARG_WITH(gcc-version,AC_HELP_STRING([--with-gcc-version=VERSION],[Compile gcc-VERSION for AROS]),use_gcc_version="$withval",use_gcc_version="")
1759 if test "$use_gcc_version" = ""; then
1760     if test "${crosstools}" = "no"; then
1761       if test "x$aros_toolchain_install" != "x"; then
1762           CROSS_GCC_VERSION
1763       fi
1764     fi
1765     if test "$use_gcc_version" = ""; then
1766         target_gcc_version="$default_gcc_version"
1767     fi
1768 else
1769     target_gcc_version="$use_gcc_version"
1771 if test "$aros_toolchain" = "gnu" ; then
1772     AC_MSG_RESULT($target_gcc_version)
1774     GCC_VERSION_MAJOR=$(echo $target_gcc_version | cut -d'.' -f1)
1775     GCC_VERSION_MINOR=$(echo $target_gcc_version | cut -d'.' -f2)
1776     GCC_VERSION_PATCH=$(echo $target_gcc_version | cut -d'.' -f3)
1778     gcc_fix_bitfields="false"
1779     if test "$GCC_VERSION_MAJOR" -gt "4" ; then
1780         gcc_fix_bitfields="true"
1781     else
1782         if test "$GCC_VERSION_MAJOR" -gt "3" ; then
1783             if test "$GCC_VERSION_MINOR" -gt "6" ; then
1784                 gcc_fix_bitfields="true"
1785             fi
1786         fi
1787     fi
1789     if test "$gcc_fix_bitfields" = "true" ; then
1790         case "$aros_target_cpu" in
1791         *x86_64*)
1792             aros_kernel_cflags="$aros_kernel_cflags -mno-ms-bitfields"
1793             aros_target_cflags="$aros_target_cflags -mno-ms-bitfields"
1794             ;;
1795         i386)
1796             aros_kernel_cflags="$aros_kernel_cflags -mno-ms-bitfields"
1797             aros_target_cflags="$aros_target_cflags -mno-ms-bitfields"
1798             ;;
1799         esac
1800     fi
1803 AC_MSG_CHECKING([whether to enable Objective-C suppport])
1804 AC_ARG_ENABLE(objc,AC_HELP_STRING([--enable-objc],[Enable Objectve-C support (default=no)]),objc="$enableval",objc="no")
1805 AC_MSG_RESULT($objc)
1806 if test "x$objc" = "xyes"; then
1807     objc_target="$objc"
1808 else
1809     objc_target="no-objc"
1812 AC_MSG_CHECKING([whether to enable Java suppport])
1813 AC_ARG_ENABLE(java,AC_HELP_STRING([--enable-java],[Enable Java support (default=no)]),java="$enableval",java="no")
1814 AC_MSG_RESULT($java)
1815 if test "x$java" != "xno"; then
1816     java_target="$java"
1817 else
1818     java_target="no-java"
1821 spec_obj_format="-m $aros_object_format"
1822 # Now process extra architecture-specific options.
1823 # Currently this is implemented only for ARM. We can specify which minimum CPU and FPU to use,\
1824 # as well as floating-point ABI.
1825 case "$aros_target_cpu" in
1826 *x86_64*)
1827     dnl x86_64 can build 32 or 64bit code
1828     spec_obj_format="%{!m32:-m elf_x86_64} %{m32:-m elf_i386}"
1829     ;;
1830 arm*)
1831     dnl ARM defaults are: armv6 + vfp (unless overriden in per-target section above)
1832     if test "$gcc_default_cpu" = ""; then
1833         gcc_default_cpu="armv6"
1834     fi
1835     if test "$gcc_default_fpu" = ""; then
1836         gcc_default_fpu="vfp"
1837     fi
1838     if test "$gcc_default_float_abi" = ""; then
1839         if test "$target_cpu" = "armhf"; then
1840             gcc_default_float_abi="hard"
1841         else
1842             gcc_default_float_abi="softfp"
1843         fi
1844     fi
1846     AC_MSG_CHECKING([Which minimum CPU to use])
1847     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)
1848     AC_MSG_RESULT($aros_gcc_cpu)
1850     AC_MSG_CHECKING([Which minimum FPU to use])
1851     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)
1852     AC_MSG_RESULT($aros_gcc_fpu)
1854     AC_MSG_CHECKING([Which floating point ABI to use])
1855     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)
1856     AC_MSG_RESULT($aros_gcc_float_abi)
1858     AC_MSG_CHECKING([Which ARM mode to use])
1859     if test "$aros_target_cpu_mode" = ""; then
1860         aros_target_cpu_mode="arm32"
1861         AC_MSG_RESULT([Defaulting to $aros_target_cpu_mode])
1862     else
1863         AC_MSG_RESULT([$aros_target_cpu_mode])
1864     fi
1866     case "$aros_target_cpu_mode" in
1867     arm32)
1868         gcc_default_mode="arm"
1869         aros_isa_flags="-m$gcc_default_mode -mthumb-interwork -march=$aros_gcc_cpu -mfpu=$aros_gcc_fpu -mfloat-abi=$aros_gcc_float_abi"
1870     ;;
1871     arm64)
1872         AC_MSG_ERROR([ARM 64-bit mode is unsupported])
1873     ;;
1874     thumb)
1875         AC_MSG_ERROR([Thumb1 16-bit mode is unsupported])
1876     ;;
1877     thumb1)
1878         AC_MSG_ERROR([Thumb1 16-bit mode is unsupported])
1879     ;;
1880     thumb2)
1881         gcc_default_mode="thumb"
1882         # Do not specify -mthumb-interwork as it may add extra code to support arm/thumb interwork
1883         aros_isa_flags="-m$gcc_default_mode -march=$aros_gcc_cpu -mfpu=$aros_gcc_fpu -mfloat-abi=$aros_gcc_float_abi"
1884     ;;
1885     *)
1886         AC_MSG_ERROR([Unsupported ARM mode specified $aros_target_cpu_mode])
1887     ;;
1888     esac
1890     aros_config_cflags="$aros_config_cflags -fno-asynchronous-unwind-tables -fno-exceptions"
1891     aros_config_aflags="$aros_config_aflags -fno-asynchronous-unwind-tables -fno-exceptions"
1892     ;;
1893 i386)
1894     aros_isa_flags="-m32 -march=i486"
1895     aros_kernel_cflags="$aros_kernel_cflags $aros_isa_flags"
1896     aros_kernel_ldflags="$aros_kernel_ldflags -m32" 
1897     ;;
1898 esac
1900 # Some architectures may need custom ELF specs.
1901 if test -f $SRCDIR/config/${aros_object_format}-specs.in; then
1902     elf_specs_in=config/${aros_object_format}-specs.in
1903 else
1904     elf_specs_in=config/elf-specs.in
1907 # Some compilers (ppc-elf-gcc is known to) have CPU defines in specs
1908 # Since we override specs, we may need to put these defines there
1909 if test "$gcc_target_cpu" != ""; then
1910     gcc_target_cpu="-D__${gcc_target_cpu}__"
1913 AC_MSG_CHECKING([where to download sourcecode for external ports])
1914 AC_ARG_WITH(portssources,AC_HELP_STRING([--with-portssources=DIR],[Where to download sourcecode for external ports]),with_portssrcdir=$withval,with_portssrcdir="default")
1915 if test "$with_portssrcdir" = "default"; then
1916     AROS_PORTSSRCDIR="$AROS_BUILDDIR_UNIX/bin/Sources"
1917 else
1918     AROS_PORTSSRCDIR="$with_portssrcdir"
1920 AC_MSG_RESULT($AROS_PORTSSRCDIR)
1922 AC_MSG_CHECKING([which bootloader to use])
1923 AC_ARG_WITH(bootloader,AC_HELP_STRING([--with-bootloader=NAME],[Use a specific bootloader]),target_bootloader=$withval,target_bootloader=$target_bootloader)
1924 if test "$target_bootloader" = "none"; then
1925     aros_target_bootloader=""
1926 else
1927     aros_target_bootloader="$target_bootloader"
1929 AC_MSG_RESULT($target_bootloader)
1931 AC_MSG_CHECKING([which icon-set to use])
1932 AC_ARG_WITH(iconset,AC_HELP_STRING([--with-iconset=NAME],[Use a specific Icon-set (default=Gorilla).]),target_iconset=$withval,target_iconset="default")
1933 if test "$target_iconset" = "default"; then
1934     aros_target_iconset="Gorilla"
1935     target_iconset="default (Gorilla)"
1936 else
1937     aros_target_iconset="$target_iconset"
1939 AC_MSG_RESULT($target_iconset)
1941 AC_MSG_CHECKING([which GUI Theme to use])
1942 AC_ARG_WITH(theme,AC_HELP_STRING([--with-theme=NAME],[Use a specific GUI Theme]),target_guitheme=$withval,target_guitheme="default")
1943 if test "$target_guitheme" = "default"; then
1944     aros_target_guitheme="Ice"
1945 else
1946     aros_target_guitheme="$target_guitheme"
1948 AC_MSG_RESULT($aros_target_guitheme)
1950 # Find out if we are cross-compiling (i.e. if we can't use the host compiler
1951 # for target code)
1952 cross_compiling=no
1954 dnl The first case is simple. If we are compiling for another CPU, we are cross-compiling for sure
1955 if test "$aros_host_cpu" != "$aros_target_cpu" ; then
1956     cross_compiling=yes
1959 dnl x86-64 toolchains can also produce i386 binaries, given -m32 flag.
1960 dnl The flag itself is given in per-target section, because some targets require to pass it
1961 dnl in a different manner, otherwise some tests fail.
1962 dnl TODO: Justify this.
1963 if test "$aros_host_cpu" == "x86_64" ; then
1964     if test "$aros_target_cpu" == "i386" ; then
1965         cross_compiling=no
1966     fi
1969 if test "x-$aros_flavour" = "x-emulation" -o "x-$aros_flavour" = "x-emulcompat" ; then
1970     dnl For a hosted build we are cross-compiling if host OS differs from build OS.
1971     dnl TODO: This might get a little bit more tricky if we ever cross-compile ARM-Android-hosted
1972     dnl AROS on ARM Linux, or even vice versa (Linux-hosted ARM AROS building on ARM Android).
1973     dnl ARM ABIs of Linux and Android are not compatible (despite very close), so host_cc can't be
1974     dnl used to build bootstrap for target arch in either case.
1975     dnl For us Android is not a separate OS, but a variant of Linux, so both systems will be
1976     dnl identified as 'linux'. If this ever involves, we'll have to implement some additional check,
1977     dnl perhaps introducing aros_host_variant
1978     if test "$aros_host_arch" != "$aros_target_arch" ; then
1979         cross_compiling=yes
1980     fi
1981 else
1982     dnl For a native build we only care if our host_cc can produce static ELF files. If so, we can use
1983     dnl it as kernel_cc. If not, (e. g. we are on Windows or Darwin), we need a crosscompiler.
1984     if test "$host_cc_elf" = "no" ; then
1985         cross_compiling=yes
1986     fi
1989 if test "$cross_compiling" = "no" ; then
1990     kernel_tool_prefix=""
1991     if test "$host_cc_elf" = "yes" ; then
1992         elf_tool_prefix=""
1993     fi
1996 if test "$kernel_tool_version" != ""; then
1997     kernel_tool_version="-$kernel_tool_version"
2000 #######################################################################
2001 ## Compute what toolchains to use, and their paths                   ##
2002 #######################################################################
2004 # This takes, as input:
2005 #   crosstools             {yes,no}
2006 #   kernel_tool_version    {"",[version]}
2007 #   target_tool_version    {"",[version]}
2008 #   kernel_tool_prefix     {none,[some-arch-os-]}
2009 #   gnu-toolchain -:
2010 #     target_tool_prefix     ${aros_target_cpu}-aros-
2011 #     aros_tool_prefix       ${aros_target_cpu}-aros-
2013 # The output is
2014 #   aros_kernel_{cpp,cc,ar,ld,as,ranlib,nm,strip}
2015 #        Where the 'kernel' binaries are located
2016 #   orig_target_{cpp,cc,ar,ld,as,ranlib,nm,strip}
2017 #        Where the 'target' binaries are located
2018 #        (not the symlink farm - that is aros_target_*!)
2020 # The rules are:
2021 #   if crosstools then
2022 #      if kernel_tools_prefix = "no-kernel-prefix-"
2023 #          aros_kernel_* = crosstools cc paths
2024 #          aros_kernel_cc = elf cc wrapper around crosstools cc
2025 #      else
2026 #          VALIDATE(${kernel_tools_prefix}*)
2027 #          aros_kernel_* = ${kernel_tools_prefix}*
2028 #          if ${kernel_tools_prefix}cc is an AROS gcc
2029 #              aros_kernel_cc = ${kernel_tools_prefix}cc
2030 #          else
2031 #              aros_kernel_cc = elf cc wrapper around ${kernel_tools_prefix}cc
2032 #          fi
2033 #      fi
2035 #      orig_target_* = aros built crosstools
2036 #      orig_target_cc = elf cc wrapper around crosstools cc
2037 #   else
2038 #      VALIDATE(${kernel_tools_prefix}*)
2040 #      orig_target_* = aros_kernel_*
2041 #      if aros_kernel_cc is an AROS gcc
2042 #          orig_target_cc = aros_kernel_cc
2043 #      else
2044 #          orig_target_cc = aros cc wrapper around aros_kernel_cc
2045 #      fi
2046 #   fi
2048 if test "$aros_toolchain" = "gnu" ; then
2049     target_tool_prefix="${aros_target_cpu}-aros-"
2050 elif test "$aros_toolchain" = "llvm" ; then
2051     target_tool_prefix="bin/"
2054 if test "$kernel_tool_prefix" != "" ; then
2055     AC_MSG_CHECKING([which kernel tools])
2056     AC_MSG_RESULT([$kernel_tool_prefix]);
2059 if test "$kernel_tool_prefix" = "none" ; then
2060     dnl ELF wrapper can be used only for native bootstrap
2061     if test "x-$aros_flavour" = "x-emulation" -o "x-$aros_flavour" = "x-emulcompat" ; then
2062         AC_MSG_ERROR([--with-kernel-toolchain-prefix= is required for this arch])
2063     fi
2064 else
2065     # Kernel tools required - find them
2066     # Note that 'normally', aros_kernel_* overrides will be
2067     # empty, unless specified in the per-arch sections above.
2068     if test "x$aros_kernel_cpp" = "x"; then
2069         aros_kernel_cpp=${kernel_tool_prefix}${CPP}
2070     fi
2071     AROS_TOOL_KERNEL(aros_kernel_cpp,cpp,$aros_kernel_cpp${kernel_tool_version})
2072     AROS_REQUIRED(cpp,$aros_kernel_cpp)
2073     if test "x$aros_kernel_cc" = "x"; then
2074         aros_kernel_cc=${kernel_tool_prefix}${CC}
2075     fi
2076     AROS_TOOL_KERNEL(aros_kernel_cc,cc,$aros_kernel_cc${kernel_tool_version})
2077     AROS_REQUIRED(cc,$aros_kernel_cc)
2078     if test "x$aros_kernel_cxx" = "x"; then
2079         aros_kernel_cxx=${kernel_tool_prefix}${CXX}
2080     fi
2081     AROS_TOOL_KERNEL(aros_kernel_cxx,cxx,$aros_kernel_cxx${kernel_tool_version})
2082     # If it's set, make sure it's really there
2083     if test "x$aros_kernel_cxx" != "x" ; then
2084         AROS_REQUIRED(cxx,$aros_kernel_cxx)
2085     fi
2086     AROS_TOOL_KERNEL(aros_kernel_ld,ld,$aros_kernel_ld)
2087     AROS_REQUIRED(ld,$aros_kernel_ld)
2088     AROS_TOOL_KERNEL(aros_kernel_as,as,$aros_kernel_as)
2089     AROS_REQUIRED(as,$aros_kernel_as)
2090     AROS_TOOL_KERNEL(aros_kernel_ar,ar,$aros_kernel_ar)
2091     AROS_REQUIRED(ar,$aros_kernel_ar)
2092     AROS_TOOL_KERNEL(aros_kernel_ranlib,ranlib,$aros_kernel_ranlib)
2093     AROS_REQUIRED(ranlib,$aros_kernel_ranlib)
2094     AROS_TOOL_KERNEL(aros_kernel_nm,nm,$aros_kernel_nm)
2095     AROS_REQUIRED(nm,$aros_kernel_nm)
2096     AROS_TOOL_KERNEL(aros_kernel_strip,strip,$aros_kernel_strip)
2097     AROS_REQUIRED(strip,$aros_kernel_strip)
2099     # Objcopy and objdump are not required for the kernel
2100     # toolchain on many architectures.
2101     # So we'll look for them, but not make them strictly required.
2102     AROS_TOOL_KERNEL(aros_kernel_objcopy,objcopy,$aros_kernel_objcopy)
2103     AROS_TOOL_KERNEL(aros_kernel_objdump,objdump,$aros_kernel_objdump)
2104     if test "x${crosstools}" != "xyes" ; then
2105         AROS_REQUIRED(objcopy,$aros_kernel_objcopy)
2106         AROS_REQUIRED(objdump,$aros_kernel_objdump)
2107     fi
2110 AC_MSG_CHECKING([which target tools to use])
2111 if test "$aros_target_toolchain" = "yes"; then
2112     if test "$aros_toolchain" = "llvm" ; then
2113         msg_result="llvm"
2114     else
2115         msg_result=$target_tool_prefix
2116     fi
2117     AC_MSG_RESULT([$msg_result])
2118     # We are building AROS crosstools
2119     tmp_tool_prefix="$AROS_CROSSTOOLSDIR/${target_tool_prefix}"
2120     orig_target_cc="${tmp_tool_prefix}${toolchain_c_compiler}${target_tool_version}"
2121     orig_target_cxx="${tmp_tool_prefix}${toolchain_cxx_compiler}${target_tool_version}"
2122     orig_target_cpp="${tmp_tool_prefix}${toolchain_cpp_preprocessor}"
2123     orig_target_ld="${tmp_tool_prefix}${toolchain_ld}"
2124     orig_target_as="${tmp_tool_prefix}${toolchain_as}"
2125     orig_target_ar="${tmp_tool_prefix}${toolchain_ar}"
2126     orig_target_ranlib="${tmp_tool_prefix}${toolchain_ranlib}"
2127     orig_target_nm="${tmp_tool_prefix}${toolchain_nm}"
2128     orig_target_strip="${tmp_tool_prefix}${toolchain_strip}"
2129     orig_target_objcopy="${tmp_tool_prefix}${toolchain_objcopy}"
2130     orig_target_objdump="${tmp_tool_prefix}${toolchain_objdump}"
2131 else
2132     # Determine whether AROS or ELF tools should be used
2133     if test "$aros_tool_prefix" = "none"; then
2134         aros_tool_prefix="${elf_tool_prefix}"
2135     fi
2137     AC_MSG_RESULT([$aros_tool_prefix])
2138     # We are *not* building AROS crosstools - use the AROS or ELF tools
2139     AROS_TOOL_TARGET(orig_target_cpp,cpp,${aros_tool_prefix}${toolchain_cpp_preprocessor}${target_tool_version})
2140     AROS_REQUIRED(cpp,$orig_target_cpp)
2141     AROS_TOOL_TARGET(orig_target_cc,gcc,${aros_tool_prefix}${toolchain_c_compiler}${target_tool_version})
2142     AROS_REQUIRED(cc,$orig_target_cc)
2143     AROS_TOOL_TARGET(orig_target_cxx,g++,${aros_tool_prefix}${toolchain_cxx_compiler}${target_tool_version})
2144     AROS_REQUIRED(cxx,$orig_target_cxx)
2145     AROS_TOOL_TARGET(orig_target_ld,gcc,${aros_tool_prefix}${toolchain_ld})
2146     AROS_REQUIRED(ld,$orig_target_ld)
2147     AROS_TOOL_TARGET(orig_target_as,as,aros_tool_prefix}${toolchain_as})
2148     AROS_REQUIRED(as,$orig_target_as)
2149     AROS_TOOL_TARGET(orig_target_ar,ar,${aros_tool_prefix}${toolchain_ar})
2150     AROS_REQUIRED(ar,$orig_target_ar)
2151     AROS_TOOL_TARGET(orig_target_ranlib,ar,${aros_tool_prefix}${toolchain_ranlib})
2152     AROS_REQUIRED(ranlib,$orig_target_ranlib)
2153     AROS_TOOL_TARGET(orig_target_nm,nm,${aros_tool_prefix}${toolchain_nm})
2154     AROS_REQUIRED(nm,$orig_target_nm)
2155     AROS_TOOL_TARGET(orig_target_strip,strip,${aros_tool_prefix}${toolchain_strip})
2156     AROS_REQUIRED(strip,$orig_target_strip)
2157     AROS_TOOL_TARGET(orig_target_objcopy,objcopy,${aros_tool_prefix}${toolchain_objcopy})
2158     AROS_REQUIRED(objcopy,$orig_target_objcopy)
2159     AROS_TOOL_TARGET(orig_target_objdump,objdump,${aros_tool_prefix}${toolchain_objdump})
2160     AROS_REQUIRED(objdump,$orig_target_objdump)
2163 if test "$kernel_tool_prefix" = "none" ; then
2164     # No kernel tools specified
2165     # Assume target tools == kernel tools with ELF wrapper
2166     aros_kernel_cc=$orig_target_cc
2167     aros_kernel_cxx=$orig_target_cxx
2168     aros_kernel_cpp=$orig_target_cpp
2169     aros_kernel_ld=$orig_target_ld
2170     aros_kernel_as=$orig_target_as
2171     aros_kernel_ar=$orig_target_ar
2172     aros_kernel_ranlib=$orig_target_ranlib
2173     aros_kernel_nm=$orig_target_nm
2174     aros_kernel_strip=$orig_target_strip
2175     aros_kernel_objcopy=$orig_target_objcopy
2176     aros_kernel_objdump=$orig_target_objdump
2177     use_kernel_cc_wrapper=yes
2180 # At this point, all aros_kernel_* and aros_target_* 
2181 # tools should be set up correctly
2183 CC="$aros_kernel_cc $kernel_tool_flags"
2184 CPP="$aros_kernel_cpp"
2186 #-----------------------------------------------------------------------------
2188 # Find all the tools we need to compile. This could be cross-compiling
2189 # though! If that is the case we use the GNU form of the target and
2190 # simply add this to the front of the binary name. This is rather simple,
2191 # but it should work under most circumstances.
2193 # The default tools are to use the same as the host, but only if the
2194 # host and target CPU are the same. With GCC this is normally enough.
2197 aros_cc_pre=""
2198 aros_shared_ld="$aros_host_ld"
2200 aros_target_mkdep="$aros_host_mkdep"
2202 # The default tools executables to be linked to.
2203 if test "$rescomp" != ""; then
2204     AC_PATH_PROG(aros_kernel_rescomp,${kernel_tool_prefix}$rescomp)
2205     AROS_REQUIRED($rescomp,$aros_kernel_rescomp)
2208 # Set up the sources for the symlink farm
2209 if test "$crosstools" = "yes"; then
2210     crosstools_target=tools-crosstools
2213 aros_kernel_cc="$aros_kernel_cc $kernel_tool_flags"
2214 aros_kernel_ar="$aros_kernel_ar $aros_kernel_ar_flags"
2216 aros_hostcfg_dir="bin/${aros_host_arch}-${aros_host_cpu}/gen/host/config"
2217 aros_targetcfg_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/config"
2218 aros_inc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/AROS/Development/include/aros"
2219 aros_gendir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen"
2220 aros_geninc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/include/aros"
2221 aros_tools_dir="bin/${aros_host_arch}-${aros_host_cpu}/tools"
2222 aros_scripts_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/scripts"
2224 # aros_cc_pre is a variable that is added to the front of the compiler name
2225 # in the generated aros-gcc shell script. We need this to enable the cache
2226 # to work across cleaned builds. Also, support DISTCC using the correct
2227 # environment variable.
2230 if test "x${DISTCC}" != "x" ; then
2231     if test "x${CCACHE}" != "x" ; then
2232         aros_cc_pre="env CCACHE_PREFIX=${DISTCC} ${CCACHE} "
2233     else
2234         aros_cc_pre="${DISTCC} "
2235     fi
2236 else
2237     if test "x${CCACHE}" != "x" ; then
2238         aros_cc_pre="${CCACHE} "
2239     fi
2242 AC_SUBST(aros_target_nostdinc_cflags,-nostdinc)
2243 AC_SUBST(aros_target_nostartup_ldflags,-nostartfiles)
2244 AC_SUBST(aros_target_nix_ldflags,-nix)
2245 AC_SUBST(aros_target_detach_ldflags,-detach)
2246 AC_SUBST(aros_target_nostdlib_ldflags,-nostdlib)
2248 # Target tools
2249 AC_SUBST(aros_toolchain)
2250 if test "$aros_target_toolchain" != "yes"; then
2251     prefix="${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-"
2252     if test "$GCC" = "yes"; then
2253         aros_target_cc_path=`$orig_target_cc -print-search-dirs | grep "programs: =" | cut -c 12-`
2254     fi
2255 else
2256     # We do not know which c compiler version we are going to build and what we need to know
2257     # here is different for different versions so this will be set later during the
2258     # build of crosstools.
2259     if test "$aros_toolchain" = "gnu" ; then
2260         prefix="$AROS_CROSSTOOLSDIR/${aros_target_cpu}-aros-"
2261     elif test "$aros_toolchain" = "llvm" ; then
2262         prefix="$AROS_CROSSTOOLSDIR/bin/"
2263     fi
2264     aros_target_cc_path=@aros_target_cc_path@
2266 aros_target_cpp="${prefix}${toolchain_cpp_preprocessor}"
2267 aros_target_cc="${prefix}${toolchain_c_compiler}"
2268 aros_target_cxx="${prefix}${toolchain_cxx_compiler}"
2269 aros_target_as="${prefix}${toolchain_as}"
2270 aros_target_ld="${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-${toolchain_ld}"
2271 aros_target_ar="${prefix}${toolchain_ar} $aros_target_ar_flags"
2272 aros_target_objcopy="${prefix}${toolchain_objcopy}"
2273 aros_target_objdump="${prefix}${toolchain_objdump}"
2274 aros_target_ranlib="${prefix}${toolchain_ranlib} $aros_target_ranlib_flags"
2275 aros_target_nm="${prefix}${toolchain_nm} $aros_target_nm_flags"
2276 aros_target_strip="${prefix}${toolchain_strip}"
2277 aros_plain_nm="${prefix}${toolchain_nm}"
2278 aros_plain_ar="${prefix}${toolchain_ar}"
2280 AC_ARG_ENABLE(includes,
2281 AC_HELP_STRING([--enable-includes=dir],[Alternative system include directory]),
2282 [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`])
2284 if test "$aros_kernel_includes" = ""; then
2285     if test "x-$aros_flavour" = "x-emulation" -o "x-$aros_flavour" = "x-emulcompat" ; then
2286         aros_kernel_includes="-isystem $aros_target_incl"
2287     fi
2290 if test "$aros_kernel_includes" != "" ; then
2291     dnl find out about the kernel cc's include path
2292     AC_MSG_CHECKING([for the kernel compiler's include path])
2293     if test "$aros_kernel_cc_includes" = "" ; then
2294         # Try to guess where the directory is.
2295         aros_kernel_cc_includes=`dirname \`${aros_kernel_cc} ${aros_kernel_cflags} -print-libgcc-file-name\``/include
2296         if test -d $aros_kernel_cc_includes; then
2297             # Check if there is also an include-fixed directory and add it
2298             # to kernel compiler's include path as it may contain some of
2299             # the headers we need.
2300             if test -d "$aros_kernel_cc_includes"-fixed; then
2301                 aros_kernel_cc_includes+=" -isystem $aros_kernel_cc_includes"-fixed
2302             fi
2303             # Check for specific includes directory. Needed for Ubuntu 11.10 and Debian
2304             case ${host_cpu} in
2305                 i[[3456]]86)
2306                     host_cpu_glibc=i386
2307                     ;;
2308                 *)
2309                     host_cpu_glibc=${host_cpu}
2310                     ;;
2311             esac
2312             if test -d "/usr/include/${host_cpu_glibc}-linux-gnu"; then
2313                 aros_kernel_cc_includes+=" -isystem /usr/include/${host_cpu_glibc}-linux-gnu"
2314             fi
2315         else
2316             # The directory doesn't exist, we need to do some more work.
2317             aros_kernel_cc_includes=${PWD}/${aros_gendir}/cc_include
2319             # These are the headers we're looking for.
2320             headers="limits.h mmintrin.h stdbool.h syslimits.h float.h \
2321                      stddef.h xmmintrin.h iso646.h stdarg.h unwind.h   \
2322                      zutil.h stdint.h"
2324             dirs=
2325             for h in $headers; do
2326                 # Which other headers are needed by each of the above?
2327                 deps=$(echo "#include <$h>" | \
2328                        $aros_kernel_cc -E -M - 2>/dev/null | \
2329                        sed 's/^.*://; s/\\$/ /g; s/[[ \t]]\+/ /g')
2331                 # Copy all the needed headers to a directory beneath gendir.
2332                 for d in $deps; do
2333                     h=$(basename $d)
2334                     dir=${aros_kernel_cc_includes}$(echo $(dirname $d) | \
2335                                                 sed -n "s,^.*/include\(/.*\),\1,p")
2336                     ! test -d $dir && mkdir -p $dir
2337                     ! test -f $dir/$h && { cp $d $dir; chmod u+w $dir/$h; }
2338                 done
2339             done            
2340         fi
2341     fi
2342     AC_MSG_RESULT($aros_kernel_cc_includes)
2343     # Adding -nostdinc to kernel includes as they are always used together.
2344     aros_kernel_includes="$aros_kernel_includes $aros_target_nostdinc_cflags -isystem $aros_kernel_cc_includes"
2347 if test "$crosstools" != "yes"; then
2348     dnl find out about the target cc's include path
2349     AC_MSG_CHECKING([for the target compiler's include path])
2350     if test "$aros_target_cc_includes" = "" ; then
2351         #try to guess where the directory is
2352         aros_target_cc_includes=`dirname \`${orig_target_cc} -print-libgcc-file-name\``/include
2353         if ! test -d $aros_target_cc_includes; then
2354             #the directory doesn't exist, we need to do some more work
2355             aros_target_cc_includes=${PWD}/${aros_gendir}/cc_include
2356         
2357             #these are the headers we're looking for
2358             headers="limits.h mmintrin.h stdbool.h syslimits.h float.h \
2359                     stddef.h xmmintrin.h iso646.h stdarg.h unwind.h   \
2360                     zutil.h"
2362             dirs=
2363             for h in $headers; do
2364                 #which other headers each of the above headers needs?
2365                 deps=$(echo "#include <$h>" | \
2366                     $orig_target_cc -E -M - 2>/dev/null | \
2367                     sed 's/^.*://; s/\\$/ /g; s/[[ \t]]\+/ /g')
2368             
2369                 #copy all the needed headers to a directory beneath gendir
2370                 for d in $deps; do
2371                     h=$(basename $d)
2372                     dir=${aros_target_cc_includes}$(echo $(dirname $d) | \
2373                                                 sed -n "s,^.*/include\(/.*\),\1,p")
2374                     ! test -d $dir && mkdir -p $dir
2375                     ! test -f $dir/$h && { cp $d $dir; chmod u+w $dir/$h; }
2376                 done
2377             done
2378         fi
2379     fi
2380     AC_MSG_RESULT($aros_target_cc_includes)
2381 else
2382     # We do not know which c compiler version we are going to build and what we need to know
2383     # here is different for different versions so this will be set later during the
2384     # build of crosstools.
2385     aros_target_cc_includes=@aros_target_cc_includes@
2389 # For GCC < 4.0 -I- is used for giving the search path for '#include "..."'
2390 # On GCC >= 4.0 -iquote should be used
2393 save_cc="$CC"
2394 save_cflags="$CFLAGS"
2395 CFLAGS="-iquote."
2396 kernel_cflags_iquote=$host_cflags_iquote
2397 kernel_cflags_iquote_end=$host_cflags_iquote_end
2398 if test "x-$cross_compiling" = "x-yes"; then
2399     CC="$aros_kernel_cc"
2400     AC_MSG_CHECKING([whether ${CC} accepts -fno-stack-protector])
2401     if test "x-$crosstools" != "x-yes"; then
2402         AC_TRY_COMPILE(,, use_no_stack_protector="yes", use_no_stack_protector="no")
2403     else
2404         # we do know it is supported for the smallest version of gcc we are going to build
2405         # we assume it's also supported by later versions
2406         use_no_stack_protector=yes
2407     fi
2408     AC_MSG_RESULT($use_no_stack_protector)
2409     AC_MSG_CHECKING([whether ${CC} accepts -iquote])
2410     if test "x-$crosstools" != "x-yes"; then
2411         AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
2412     else
2413         # we do know it is supported for the smallest version of gcc we are going to build
2414         # we assume it's also supported by later versions
2415         has_iquote=yes
2416     fi
2417     AC_MSG_RESULT($has_iquote)
2418     if test "x-$has_iquote" = "x-yes" ; then
2419         kernel_cflags_iquote=-iquote
2420         kernel_cflags_iquote_end=
2421     else
2422         kernel_cflags_iquote=-I
2423         kernel_cflags_iquote_end=-I-
2424     fi
2426 if test "x-$use_no_stack_protector" = "x-yes" ; then
2427     aros_kernel_cflags="$aros_kernel_cflags -fno-stack-protector"
2430 #-----------------------------------------------------------------------------
2432 # Check if we can explicitly choose older version of symbol hashing
2434 CFLAGS="save_cflags -Wl,--hash-style=sysv"
2435 CC="$aros_kernel_cc"
2436 AC_MSG_CHECKING([whether ${CC} accepts -Wl,--hash-style=sysv])
2437 AC_TRY_LINK(,, use_hash_style="yes", use_hash_style="no")
2438 AC_MSG_RESULT($use_hash_style)
2439 if test "x-$use_hash_style" = "x-yes" ; then
2440     aros_kernel_cflags="$aros_kernel_cflags -Wl,--hash-style=sysv"
2442 CC="$save_cc"
2443 CFLAGS="$save_cflags"
2445 AC_SUBST(host_cflags_iquote)
2446 AC_SUBST(host_cflags_iquote_end)
2447 AC_SUBST(kernel_cflags_iquote)
2448 AC_SUBST(kernel_cflags_iquote_end)
2449 AC_SUBST(aros_cflags_iquote)
2450 AC_SUBST(aros_cflags_iquote_end)
2453 dnl Check if user specified --with-resolution=XRESxYRESxDEPTH
2454 AC_MSG_CHECKING([for default resolution of WBScreen])
2455 AC_ARG_WITH(resolution,AC_HELP_STRING([--with-resolution=XRESxYRESxDEPTH],[Default resolution of the initial WorkbenchScreen]),resolution=$withval,resolution=none)
2456 # We require an argument, so map --with/--without ("yes"/"no") to "none" specified
2457 if test "$resolution" = "yes" ; then
2458     resolution="none"
2460 if test "$resolution" = "no" ; then
2461     resolution="none"
2463 if test "$resolution" != "none" ; then
2464     aros_nominal_width=`echo $resolution | cut -d'x' -f1`
2465     aros_nominal_height=`echo $resolution | cut -d'x' -f2`
2466     aros_nominal_depth=`echo $resolution | cut -d'x' -f3`
2468 AC_MSG_RESULT($aros_nominal_width x $aros_nominal_height x $aros_nominal_depth)
2469 aros_cv_nominal_width=$aros_nominal_width
2470 aros_cv_nominal_height=$aros_nominal_height
2471 aros_cv_nominal_depth=$aros_nominal_depth
2473 dnl See if the user wants the serial debug output for native flavour
2474 AC_MSG_CHECKING([whether serial debug is enabled])
2475 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)
2476 if test "$aros_serial_debug" = 0 ; then
2477     serial_debug_forced=""
2478     if test "$serial_debug" = "yes" ; then
2479         serial_debug="1"
2480     fi
2481     if test "$serial_debug" = "no" ; then
2482         serial_debug="none"
2483     fi
2484 else
2485     serial_debug_forced="(forced)"
2486     serial_debug=$aros_serial_debug
2488 if test "$serial_debug" != "none" ; then
2489     aros_serial_debug=$serial_debug
2490     AC_MSG_RESULT($serial_debug_forced on port $serial_debug)
2491 else
2492     AC_MSG_RESULT(no)
2495 dnl See if the user wants the palm debug output hack for palm native flavour
2496 AC_MSG_CHECKING([whether palm debug hack is enabled])
2497 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")
2498 if test "$palm_debug_hack" = "yes" ; then
2499     aros_palm_debug_hack="1"
2501 AC_MSG_RESULT($palm_debug_hack)
2503 dnl See if dev wants the usb3.0 code
2504 AC_MSG_CHECKING([whether usb3.0 code is enabled])
2505 AC_ARG_ENABLE(usb30_code,AC_HELP_STRING([--enable-usb30-code],[Enable usb3.0 code (default=no)]),usb30_code="yes",usb30_code="no")
2506 if test "$usb30_code" = "yes" ; then
2507     aros_config_cflags="$aros_config_cflags -DAROS_USB30_CODE"
2508     aros_kernel_cflags="$aros_kernel_cflags -DAROS_USB30_CODE"
2510 AC_MSG_RESULT($usb30_code)
2512 dnl See if the user wants nesting supervisor activated for unix flavour
2513 AC_MSG_CHECKING([whether nesting supervisor support is enabled])
2514 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")
2515 if test "$nesting_supervisor" = "yes" ; then
2516     aros_nesting_supervisor="1"
2518 AC_MSG_RESULT($nesting_supervisor)
2520 dnl See if the user wants to disable MMU support
2521 dnl This can be overriden on per-target basis,
2522 dnl set $aros_enable_mmu to "yes" or "no" to do this
2523 if test "$aros_enable_mmu" = "" ; then
2524     AC_MSG_CHECKING([whether MMU support is enabled])
2525     dnl Enabled by default
2526     AC_ARG_ENABLE(mmu,AC_HELP_STRING([--disable-mmu],[Disable MMU support (default=enabled)]),aros_enable_mmu=$enableval,aros_enable_mmu="yes")
2527     if test "$aros_enable_mmu" = "" ; then
2528         aros_enable_mmu="yes"
2529     fi
2530     AC_MSG_RESULT($aros_enable_mmu)
2532 if test "$aros_enable_mmu" = "no" ; then
2533     aros_enable_mmu="0"
2534 else
2535     aros_enable_mmu="1"
2537     
2539 dnl things specifically required for hosted flavours
2540 if test "x-$aros_flavour" = "x-emulation" -o "x-$aros_flavour" = "x-emulcompat" ; then
2542     if test "x-$need_dlopen" != "x-no" ; then
2543       save_libs="$LIBS"
2544       LIBS=""
2545       dnl some kind of dynamic library access system is required for hostlib.resource
2546       AC_CHECK_FUNC(dlopen, have_dl="yes", have_dl="no")
2547       if test "x-$have_dl" = "x-no" ; then
2548           AC_CHECK_LIB(dl, dlopen, [have_dl="yes"
2549                                     aros_host_ldflags="$aros_host_ldflags -ldl"],
2550                                     have_dl="no")
2551       fi
2552       if test "x-$have_dl" = "x-no" ; then
2553           AC_MSG_ERROR([dlopen() dynamic linker functions not available])
2554       fi
2555       LIBS="$save_libs"
2556     fi
2559     dnl x11 hidd
2560     AC_ARG_ENABLE(x11_hidd, AC_HELP_STRING([--enable-x11-hidd],
2561                                            [build X11 hidd for hosted (default=auto)]),
2562                                            x11_hidd="$enableval",
2563                                            x11_hidd="$need_x11")
2564     case "x-$x11_hidd" in
2565         x-yes|x-no|x-auto)                 ;;
2566         *)                 x11_hidd="$need_x11" ;;
2567     esac
2569     ENABLE_X11=0
2571     dnl they want it
2572     if test "x-$x11_hidd" != "x-no" ; then
2574         dnl find x11 stuff
2575         AC_PATH_X
2577         x_cflags=
2578         for path in $x_libraries
2579         do
2580             x_cflags="$x_cflags -L$path"
2581         done
2583         for path in $x_includes
2584         do
2585             x_cflags="$x_cflags -I$path"
2586         done
2587         
2588         if test "x-$no_x" = "x-yes" ; then
2590             dnl didn't find it
2591             if test "x-$x11_hidd" != "x-auto" ; then
2592                 dnl and they explicitly asked for it, bail out
2593                 AC_MSG_ERROR([X11 libs/headers not found, cannot build X11 hidd as requested])
2594             fi
2595         
2596         else
2597             dnl found it, setup the metatarget
2598             host_x_gfx=yes
2599             ENABLE_X11=1
2601             dnl setup shared memory extensions
2602             AC_ARG_ENABLE(x11_shm, AC_HELP_STRING([--enable-x11-shm],
2603                                                   [use X11 shared memory (default=auto)]),
2604                                                   x11_hidd_shm="$enableval",
2605                                                   x11_hidd_shm="auto")
2606             case "x-$x11_hidd_shm" in
2607                 x-yes|x-no|x-auto)                     ;;
2608                 *)                 x11_hidd_shm="auto" ;;
2609             esac
2611             have_xshm=no
2613             dnl they want it
2614             if test "x-$x11_hidd_shm" != "x-no" ; then
2616                 dnl system shm headers
2617                 AC_CHECK_HEADERS(sys/ipc.h)
2618                 AC_CHECK_HEADERS(sys/shm.h)
2620                 dnl got them
2621                 if test "x-$ac_cv_header_sys_ipc_h" = "x-yes" -a "x-$ac_cv_header_sys_shm_h" = "x-yes" ; then
2623                     dnl make sure X libs have shm functions
2624                     save_cflags="$CFLAGS"
2625                     CFLAGS="$CFLAGS $x_cflags"
2626                     AC_CHECK_LIB(Xext, XShmQueryExtension, have_xshm=yes)
2627                     CFLAGS="$save_cflags"
2628                 fi
2629             fi
2631             dnl detection done, prepare output
2632             if test "x-$have_xshm" = "x-yes" ; then
2633                 dnl we can do shm
2634                 DO_XSHM_SUPPORT="1"
2635             elif test "x-$x11_hidd_shm" = "x-yes" ; then
2636                 dnl they explicitly asked for it, but we can't do it
2637                 AC_MSG_ERROR([X11 has no support for shared memory, cannot enable it as requested])
2638             else
2639                 dnl otherwise just disable it
2640                 DO_XSHM_SUPPORT="0"
2641             fi
2643             
2644             dnl setup vidmode (fullscreen) extensions
2645             AC_ARG_ENABLE(x11_vidmode, AC_HELP_STRING([--enable-x11-vidmode],
2646                                                       [use X11 vidmode extension (default=auto)]),
2647                                                       x11_hidd_vidmode="$enableval",
2648                                                       x11_hidd_vidmode="auto")
2649             case "x-$x11_hidd_vidmode" in
2650                 x-yes|x-no|x-auto)                         ;;
2651                 *)                 x11_hidd_vidmode="auto" ;;
2652             esac
2654             have_vidmode=no
2656             dnl they want it
2657             if test "x-$x11_hidd_vidmode" != "x-no" ; then
2659                 dnl make sure X libs have vidmode functions
2660                 save_cflags="$CFLAGS"
2661                 CFLAGS="$CFLAGS $x_cflags"
2662                 AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryExtension, have_vidmode=yes)
2663                 CFLAGS="$save_cflags"
2664             fi
2666             dnl detection done, prepare output
2667             if test "x-$have_vidmode" = "x-yes" ; then
2668                 dnl we can do vidmode
2669                 DO_VIDMODE_SUPPORT="1"
2670             elif test "x-$x11_hidd_vidmode" = "x-yes" ; then
2671                 dnl they explicitly asked for it, but we can't do it
2672                 AC_MSG_ERROR([X11 vidmode extension not available, cannot enable it as requested])
2673             else
2674                 dnl otherwise just disable it
2675                 DO_VIDMODE_SUPPORT="0"
2676             fi
2677         fi
2679         aros_host_x11_includes=$x_includes 
2680         aros_host_x11_libdirs=$x_libraries
2681     fi
2684     dnl sdl hidd
2685     AC_ARG_ENABLE(sdl_hidd, AC_HELP_STRING([--enable-sdl-hidd],
2686                                            [build SDL hidd for hosted (default=auto)]),
2687                                            sdl_hidd="$enableval",
2688                                            sdl_hidd="auto")
2689     case "x-$sdl_hidd" in
2690         x-yes|x-no|x-auto)                 ;;
2691         *)                 sdl_hidd="auto" ;;
2692     esac
2694     dnl they want it
2695     if test "x-$sdl_hidd" != "x-no" ; then
2697         dnl find sdl
2698         SDL_VERSION=1.2.5
2699         AM_PATH_SDL($SDL_VERSION, [have_sdl="yes"],
2700             [have_sdl="no"])
2702         if test "x-$have_sdl" != "x-yes" ; then
2704             dnl didn't find it
2705             if test "x-$sdl_hidd" != "x-auto" ; then
2706                 dnl and they explicitly asked for it, bail out
2707                 AC_MSG_ERROR([SDL libs/headers not found, cannot build SDL hidd as requested])
2708             fi
2710         else
2711             dnl found it, enable the build
2712             host_sdl_gfx=yes
2713             aros_host_sdl_cflags=$SDL_CFLAGS
2714             aros_host_sdl_libs=$SDL_LIBS
2715         fi
2716     fi
2721 dnl See if the user wants dbus.library
2722 AC_MSG_CHECKING([whether building of dbus.library is enabled])
2723 AC_ARG_ENABLE(dbus,AC_HELP_STRING([--enable-dbus],[Enable DBUS support via dbus.library (default=no)]),dbus="yes",dbus="no")
2724 if test "$dbus" = "yes" ; then
2725     ENABLE_DBUS=1
2726     DBUS_CFLAGS=`pkg-config --cflags dbus-1`
2727     DBUS_LIBFLAGS=`pkg-config --libs dbus-1`
2728     KERNEL_DBUS_KOBJ=kernel-dbus-kobj
2729     KERNEL_DBUS_INCLUDES=kernel-dbus-includes
2730 else
2731     ENABLE_DBUS=0
2733 AC_MSG_RESULT($dbus)
2735 if test "$use_kernel_cc_wrapper" = "yes" ; then
2736     aros_kernel_cc="${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-elf-${toolchain_c_compiler}"
2739 dnl --------------------------------------------------------------------
2740 dnl Configuration Output Section
2741 dnl --------------------------------------------------------------------
2743 # Generic
2744 AC_SUBST(aros_arch)
2745 AC_SUBST(aros_cpu)
2746 AC_SUBST(aros_flavour)
2747 AC_SUBST(aros_flavour_uc)
2748 AC_SUBST(aros_target_toolchain)
2749 AC_SUBST(aros_build_host)
2750 AC_SUBST(AROS_BUILDDIR)
2751 AC_SUBST(AROS_BUILDDIR_UNIX)
2752 AC_SUBST(SRCDIR)
2753 AC_SUBST(AROS_CROSSTOOLSDIR)
2754 AC_SUBST(AROS_PORTSSRCDIR)
2756 # Compatability with other Amiga-like operation systems
2757 AC_SUBST(aros_amigaos_compliance)
2759 # Host related
2760 AC_SUBST(aros_cc_pre)
2761 AC_SUBST(aros_host_strip)
2762 AC_SUBST(aros_host_arch)
2763 AC_SUBST(aros_host_cpu)
2764 AC_SUBST(aros_host_cpp)
2765 AC_SUBST(aros_host_def_cc)
2766 AC_SUBST(aros_host_cc)
2767 AC_SUBST(aros_host_cxx)
2768 AC_SUBST(aros_host_ar)
2769 AC_SUBST(aros_host_ranlib)
2770 AC_SUBST(aros_host_ld)
2771 AC_SUBST(aros_host_make)
2772 AC_SUBST(aros_host_cflags)
2773 AC_SUBST(aros_host_cxxflags)
2774 AC_SUBST(gnu89_inline)
2775 AC_SUBST(aros_host_ldflags)
2776 AC_SUBST(aros_host_debug)
2777 AC_SUBST(aros_host_mkdep)
2778 AC_SUBST(aros_host_mkargs)
2779 AC_SUBST(aros_host_exe_suffix)
2780 AC_SUBST(aros_host_lib_suffix)
2781 AC_SUBST(aros_tools_dir)
2782 AC_SUBST(aros_host_aclocal)
2783 AC_SUBST(aros_host_autoconf)
2784 AC_SUBST(aros_host_autoheader)
2785 AC_SUBST(aros_host_automake)
2786 AC_SUBST(ant)
2788 # Target Related
2789 AC_SUBST(aros_target_guitheme)
2790 AC_SUBST(aros_target_iconset)
2791 AC_SUBST(aros_target_bootloader)
2792 AC_SUBST(aros_target_arch)
2793 AC_SUBST(aros_target_family)
2794 AC_SUBST(aros_target_cpu)
2795 AC_SUBST(aros_target_cpu_mode)
2796 AC_SUBST(aros_target_variant)
2797 AC_SUBST(aros_target_suffix)
2798 AC_SUBST(aros_target_ar)
2799 AC_SUBST(aros_target_ranlib)
2800 AC_SUBST(aros_plain_nm)
2801 AC_SUBST(aros_plain_ar)
2802 AC_SUBST(aros_kernel_ar)
2803 AC_SUBST(aros_kernel_ranlib)
2804 AC_SUBST(orig_target_cc)
2805 AC_SUBST(aros_target_cc)
2806 AC_SUBST(aros_kernel_cc)
2807 AC_SUBST(orig_target_cxx)
2808 AC_SUBST(aros_target_cxx)
2809 AC_SUBST(aros_kernel_cxx)
2810 AC_SUBST(orig_target_cpp)
2811 AC_SUBST(aros_target_cpp)
2812 AC_SUBST(aros_kernel_cpp)
2813 AC_SUBST(orig_target_as)
2814 AC_SUBST(aros_target_as)
2815 AC_SUBST(aros_kernel_as)
2816 AC_SUBST(orig_target_ld)
2817 AC_SUBST(aros_target_ld)
2818 AC_SUBST(aros_kernel_ld)
2819 AC_SUBST(aros_target_cc_includes)
2820 AC_SUBST(aros_target_cc_path)
2821 AC_SUBST(aros_target_objdump)
2822 AC_SUBST(aros_target_objcopy)
2823 AC_SUBST(aros_target_strip)
2824 AC_SUBST(aros_target_nm)
2825 AC_SUBST(aros_kernel_rescomp)
2826 AC_SUBST(aros_shared_default)
2827 AC_SUBST(aros_shared_ld)
2828 AC_SUBST(aros_object_format)
2829 AC_SUBST(spec_obj_format)
2830 AC_SUBST(aros_compiler_libs)
2831 AC_SUBST(aros_arch_libs)
2833 AC_SUBST(aros_shared_cflags)
2834 AC_SUBST(aros_shared_aflags)
2835 AC_SUBST(aros_shared_ldflags)
2837 AC_SUBST(aros_config_sysroot)
2838 AC_SUBST(aros_nowarn_flags)
2839 AC_SUBST(aros_config_cflags)
2840 AC_SUBST(aros_config_aflags)
2841 AC_SUBST(aros_config_ldflags)
2843 AC_SUBST(aros_kernel_sysroot)
2844 AC_SUBST(aros_kernel_cflags)
2845 AC_SUBST(aros_kernel_includes)
2846 AC_SUBST(aros_kernel_objcflags)
2847 AC_SUBST(aros_kernel_ldflags)
2848 AC_SUBST(aros_target_cflags)
2849 AC_SUBST(aros_debug_cflags)
2850 AC_SUBST(aros_debug_aflags)
2851 AC_SUBST(aros_debug_ldflags)
2852 AC_SUBST(aros_target_genmap)
2853 AC_SUBST(aros_target_strip_flags)
2854 AC_SUBST(aros_optimization_cflags)
2855 AC_SUBST(aros_isa_flags)
2857 AC_SUBST(crosstools_target)
2858 AC_SUBST(crosstools_cxx_target)
2860 # Hosted Graphics Related
2861 AC_SUBST(host_x_gfx)
2862 AC_SUBST(host_sdl_gfx)
2863 AC_SUBST(host_android_gfx)
2865 AC_SUBST(pci_hidd_target)
2867 AC_SUBST(aros_nominal_width)
2868 AC_SUBST(aros_nominal_height)
2869 AC_SUBST(aros_nominal_depth)
2870 AC_SUBST(DO_XSHM_SUPPORT)
2871 AC_SUBST(DO_VIDMODE_SUPPORT)
2873 AC_SUBST(aros_host_x11_includes)
2874 AC_SUBST(aros_host_x11_libdirs)
2875 AC_SUBST(aros_host_sdl_cflags)
2876 AC_SUBST(aros_host_sdl_libs)
2878 # Native version related
2879 AC_SUBST(aros_serial_debug)
2880 AC_SUBST(ENABLE_EXECSMP)
2882 # Palm native version related
2883 AC_SUBST(aros_palm_debug_hack)
2885 # Unix/Hosted version related
2886 AC_SUBST(aros_nesting_supervisor)
2888 # MMU related
2889 AC_SUBST(aros_enable_mmu)
2891 # Apple iOS related
2892 AC_SUBST(aros_ios_platform)
2893 AC_SUBST(aros_ios_version)
2894 AC_SUBST(aros_ios_sdk)
2896 # ARM default GCC target related
2897 AC_SUBST(gcc_default_cpu)
2898 AC_SUBST(gcc_default_cpu_tune)
2899 AC_SUBST(gcc_default_fpu)
2900 AC_SUBST(gcc_default_float_abi)
2901 AC_SUBST(gcc_default_mode)
2903 # Android related
2904 AC_SUBST(android_tool)
2905 AC_SUBST(aros_android_level)
2906 AC_SUBST(aros_android_antapk)
2908 # DBUS related
2909 AC_SUBST(ENABLE_DBUS)
2910 AC_SUBST(DBUS_CFLAGS)
2911 AC_SUBST(DBUS_LIBFLAGS)
2912 AC_SUBST(KERNEL_DBUS_KOBJ)
2913 AC_SUBST(KERNEL_DBUS_INCLUDES)
2915 #X11 related
2916 AC_SUBST(ENABLE_X11)
2918 # Debug related
2919 AC_SUBST(aros_debug)
2920 AC_SUBST(aros_mungwall_debug)
2921 AC_SUBST(aros_stack_debug)
2922 AC_SUBST(aros_modules_debug)
2924 # Collect-aros stuff: "-ius" to ignore undefined symbols
2925 AC_SUBST(ignore_undefined_symbols)
2927 # C compiler related
2928 AC_SUBST(gcc_target_cpu)
2929 AC_SUBST(target_binutils_version)
2930 AC_SUBST(target_gcc_version)
2932 #ObjC compiler related
2933 AC_SUBST(objc_target)
2935 #Java related
2936 AC_SUBST(java_target)
2938 # USB3.0 code
2939 AC_SUBST(aros_usb30_code)
2941 dnl Prepare for output, make up all the generated patches
2942 case "$aros_flavour" in
2943 emulation)      aros_flavour_uc="AROS_FLAVOUR_EMULATION"
2944                 aros_flavour="emulation" ;;
2945 emulcompat)     aros_flavour_uc="(AROS_FLAVOUR_EMULATION|AROS_FLAVOUR_BINCOMPAT)"
2946                 aros_flavour="emulation" ;;
2947 standalone)     aros_flavour_uc="AROS_FLAVOUR_STANDALONE"
2948                 aros_flavour="standalone";;
2949 standcompat)    aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_BINCOMPAT)"
2950                 aros_flavour="standalone";;
2951 native)         aros_flavour_uc="AROS_FLAVOUR_NATIVE"
2952                 aros_flavour="native" ;;
2953 nativecompat)   aros_flavour_uc="(AROS_FLAVOUR_NATIVE|AROS_FLAVOUR_BINCOMPAT)"
2954                 aros_flavour="native" ;;
2955 linklib)        aros_flavour_uc="AROS_FLAVOUR_LINKLIB"
2956                 aros_flavour="linklib" ;;
2957 palmnative)     aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
2958                 aros_flavour="palmnative" ;;
2959 mac68knative)   aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
2960                 aros_flavour="mac68knative" ;;
2961 ppcnative)      aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_BINCOMPAT)"
2962                 aros_flavour="ppcnative" ;;
2963 esac
2965 if test ! -d ${aros_inc_dir} ; then
2966     ${MKDIR} ${aros_inc_dir}
2968 if test ! -d ${aros_geninc_dir} ; then
2969     ${MKDIR} ${aros_geninc_dir}
2971 if test ! -d ${aros_hostcfg_dir} ; then
2972     ${MKDIR} ${aros_hostcfg_dir}
2974 if test ! -d ${aros_targetcfg_dir} ; then
2975     ${MKDIR} ${aros_targetcfg_dir}
2977 if test ! -d ${aros_tools_dir} ; then
2978     ${MKDIR} ${aros_tools_dir}
2980 if test ! -d ${aros_scripts_dir} ; then
2981     ${MKDIR} ${aros_scripts_dir}
2984 AC_CONFIG_HEADERS(${aros_geninc_dir}/host-conf.h:config/host-conf.h.in)
2986 # Generic build tools (metamake, etc)
2987 AC_CONFIG_COMMANDS([genmf-executable-support],
2988     [chmod a+x ${aros_tools_dir}/genmf.py],
2989     [aros_tools_dir=${aros_tools_dir}]
2991 AC_CONFIG_FILES(
2992     Makefile
2993     config/make.cfg
2994     ${aros_inc_dir}/config.h:config/config.h.in
2995     ${aros_geninc_dir}/config.h:config/config.h.in
2996     ${aros_hostcfg_dir}/host.cfg:config/host.cfg.in
2997     ${aros_targetcfg_dir}/target.cfg:config/target.cfg.in
2998     ${aros_targetcfg_dir}/build.cfg:config/build.cfg.in
2999     mmake.config
3000     ${aros_targetcfg_dir}/make.defaults:config/make.defaults.in
3001     ${aros_tools_dir}/genmf.py:tools/genmf/genmf.py
3002     tools/collect-aros/env.h
3005 # Binutils
3006 AC_CONFIG_COMMANDS([binutils-support],
3007     [
3008         prefix=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}
3009         mkdir -p $prefix
3010         prefix2=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros
3012         chmod a+x ${prefix2}-ld
3014         ln -sf $orig_target_as$aros_host_exe_suffix      ${prefix2}-as$aros_host_exe_suffix
3015         ln -sf $orig_target_nm$aros_host_exe_suffix      ${prefix2}-nm$aros_host_exe_suffix
3016         ln -sf $orig_target_ar$aros_host_exe_suffix      ${prefix2}-ar$aros_host_exe_suffix
3017         ln -sf $orig_target_ranlib$aros_host_exe_suffix  ${prefix2}-ranlib$aros_host_exe_suffix
3018         ln -sf $orig_target_objcopy$aros_host_exe_suffix ${prefix2}-objcopy$aros_host_exe_suffix
3019         ln -sf $orig_target_objdump$aros_host_exe_suffix ${prefix2}-objdump$aros_host_exe_suffix
3020         ln -sf $orig_target_strip$aros_host_exe_suffix   ${prefix2}-strip$aros_host_exe_suffix
3021     ],
3022     [
3023         aros_host_exe_suffix=${aros_host_exe_suffix}
3024         aros_tools_dir=${aros_tools_dir}
3025         aros_target_cpu=${aros_target_cpu}
3026         aros_target_arch=${aros_target_arch}
3027         aros_target_suffix=${aros_target_suffix}
3028         orig_target_nm=${orig_target_nm}
3029         orig_target_as=${orig_target_as}
3030         orig_target_ar=${orig_target_ar}
3031         orig_target_ranlib=${orig_target_ranlib}
3032         orig_target_objdump=${orig_target_objdump}
3033         orig_target_objcopy=${orig_target_objcopy}
3034         orig_target_strip=${orig_target_strip}
3035         aros_kernel_ld=${aros_kernel_ld}
3036     ]
3038 AC_CONFIG_FILES(
3039     ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-ld:scripts/aros-ld.in
3042 # Bare Elf support script and spec
3043 if test "${use_kernel_cc_wrapper}" = "yes"; then
3044     AC_CONFIG_COMMANDS([elf-compiler-support],
3045         [
3046             prefix=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}
3047             mkdir -p $prefix
3048             prefix2=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-elf
3050             chmod a+x ${prefix2}-gcc
3052             ln -sf $aros_kernel_ld$aros_host_exe_suffix         ${prefix2}-ld$aros_host_exe_suffix
3053         ],
3054         [
3055             aros_host_exe_suffix=${aros_host_exe_suffix}
3056             aros_tools_dir=${aros_tools_dir}
3057             aros_target_cpu=${aros_target_cpu}
3058             aros_target_arch=${aros_target_arch}
3059             aros_target_suffix=${aros_target_suffix}
3060             aros_kernel_ld=${aros_kernel_ld}
3061         ]
3062     )
3063     AC_CONFIG_FILES(
3064         ${aros_targetcfg_dir}/elf-specs:${elf_specs_in}
3065         ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-elf-gcc:scripts/elf-gcc.in
3066     )
3069 # Host compiler support scripts and spec
3070 if test "${aros_target_toolchain}" = "no"; then
3071     AC_CONFIG_COMMANDS([host-compiler-wrapper-support],
3072         [
3073             prefix=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}
3074             mkdir -p $prefix
3075             prefix2=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros
3077             chmod a+x ${prefix2}-${toolchain_c_compiler} ${prefix2}-${toolchain_cxx_compiler} ${prefix2}-${toolchain_cpp_preprocessor}
3078         ],
3079         [
3080             aros_host_exe_suffix=${aros_host_exe_suffix}
3081             aros_tools_dir=${aros_tools_dir}
3082             aros_target_cpu=${aros_target_cpu}
3083             aros_target_arch=${aros_target_arch}
3084             aros_target_suffix=${aros_target_suffix}
3085         ]
3086     )
3087     AC_CONFIG_FILES(
3088         ${aros_targetcfg_dir}/specs:config/specs.in
3089         ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-${toolchain_cpp_preprocessor}:scripts/aros-${toolchain_cpp_preprocessor}.in
3090         ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-${toolchain_c_compiler}:scripts/aros-${toolchain_c_compiler}.in
3091         ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-${toolchain_cxx_compiler}:scripts/aros-${toolchain_cxx_compiler}.in
3092     )
3095 # Android support
3096 if test "$aros_target_variant" == "android"; then
3097     AC_CONFIG_FILES(${aros_gendir}/arch/all-android/bootstrap/app/default.properties:arch/all-android/bootstrap/app/default.properties.in)
3100 # cmake helper
3101 AC_CONFIG_FILES(${aros_targetcfg_dir}/conf.cmake:config/conf.cmake.in)
3103 AC_OUTPUT
3105 dnl This is in order to not define SHARED_CFLAGS sometimes
3106 dnl We don't always do aros_shared_ar, aros_shared_cflags
3108 #XXX compatability...
3109 aros_shared_ar="$aros_shared_ld $aros_shared_ldflags -o"
3111 if test -n "$aros_shared_cflags" ; then
3112     echo "SHARED_CFLAGS := $aros_shared_cflags" >> ${aros_hostcfg_dir}/host.cfg
3113     echo "SHARED_AR := $aros_shared_ar" >> ${aros_hostcfg_dir}/host.cfg