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