Add info about host and target linker.
[AROS.git] / configure.in
blob42e2846dece5c3a01887986b180de1467a3ed3a2
1 dnl Copyright © 1997-2011, The AROS Development Team. All rights reserved.
2 dnl $Id$
3 dnl
4 dnl Desc: Autoconf source for configuration file
5 dnl Lang: english
7 # Note: After file changes, generate configure anew and commit _both_ files.
9 #TODO
10 # method of getting shared/non-shared ld/ar tool for target.
12 # ------------------------------------------------------------------------
13 # Here starts the first section of the configure.in file.
14 # ------------------------------------------------------------------------
16 AC_INIT(mmakefile)
17 AC_PREREQ(2.61)
18 AC_CONFIG_AUX_DIR(scripts/autoconf)
20 # Check what host we are running on.
21 # If a target is not suggested, we use this one.
22 # Note that what we call a target, Autoconf calls a host.
23 AC_CANONICAL_HOST
25 # The AROS target is slightly different to the normal GNU style
26 # format. We don't have the middle part, and we reverse the order
27 # of the $(CPU) and $(OS) bits.
29 # Don't strip the version of the target yet, it might be
30 # useful on some systems.
32 AC_MSG_CHECKING([for AROS style target])
34 if test "$target" = "NONE" ; then
35     target=$host_os-$host_cpu
36 else
37     if test "$target" = "" ; then
38         target=$host_os-$host_cpu
39     fi
41 AC_MSG_RESULT($target)
43 if test "$host_os" = "mingw32" ; then
44     PWDCMD="pwd -W"
47 #don't know where else to put this...
48 AC_MSG_CHECKING([building AROS in])
49 AROS_BUILDDIR=`${PWDCMD-pwd}`
50 AROS_BUILDDIR_UNIX=${PWD}
51 AC_MSG_RESULT($AROS_BUILDDIR)
53 AC_MSG_CHECKING([AROS source in])
54 srcpwd=`cd ${srcdir} ; ${PWDCMD-pwd}`
55 SRCDIR=${srcpwd}
56 AC_MSG_RESULT($SRCDIR)
58 # Parse the target field into something useful.
59 changequote(<<,>>)
60 target_os=`echo $target | sed 's/^\([^-]*\)-\(.*\)$/\1/'`
61 target_cpu=`echo $target | sed 's/^\([^-]*\)-\(.*\)$/\2/'`
62 changequote([,])
64 dnl --------------------------------------------------------------------
65 dnl Set the default Workbench resolution
66 dnl --------------------------------------------------------------------
67 aros_default_wbwidth=800
68 aros_default_wbheight=600
69 aros_default_wbdepth=4
71 dnl --------------------------------------------------------------------
72 dnl Host Configuration Section
73 dnl --------------------------------------------------------------------
74 dnl
75 dnl The idea here is to find out all the information we need about the
76 dnl host. This means things like tools for building directory structures,
77 dnl copying files around and the like.
79 # The first step is to find the host binaries.
80 # Check for a compiler.
81 AC_PROG_CC
82 AC_PROG_CC_STDC
83 AC_PROG_CPP
85 # Check for a compatible awk
86 AC_CHECK_PROGS(AWK,[gawk nawk])
87 AROS_REQUIRED(gawk,$AWK)
88 AROS_PROG(MMAKE,mmake)
90 # Perform some default variable assignments. Note all of these will be
91 # Regenerated from the script, so there is no need to cache them.
93 aros_host_cpp="$CPP"
94 aros_host_cc="$CC"
95 AROS_TOOL_CCPATH(aros_host_ld,ld)
96 AROS_REQUIRED(ld,$aros_host_ld)
97 aros_host_make="make"
98 aros_host_cflags=$CFLAGS
99 aros_host_ldflags=$LDFLAGS
100 aros_host_debug="-g -O0"
101 aros_host_mkdep="\$(SRCDIR)/scripts/mkdep"
102 aros_host_mkargs="--no-print-directory"
103 aros_host_exe_suffix="$EXEEXT"
104 aros_host_lib_suffix=""
106 # Ignore all compliance, AROS ROMs = 0
107 # KickStart v1.0 = 30
108 # KickStart v1.3 = 34
109 # KickStart v2.0 = 37
110 # KickStart v3.0 = 39
111 # KickStart v3.1 = 40
112 # AmigaOS   v3.5 = 44
113 aros_amigaos_compliance=0
115 AC_CHECK_PROGS(aros_host_aclocal,[aclocal aclocal19 aclocal-1.9])
116 AC_CHECK_PROGS(aros_host_autoconf,[autoconf autoconf259 autoconf253])
117 AC_CHECK_PROGS(aros_host_autoheader,[autoheader autoheader259 autoheader253])
118 AC_CHECK_PROGS(aros_host_automake,[automake automake19 automake-1.9])
120 AROS_REQUIRED(aclocal/aclocal19/aclocal-1.9, $aros_host_aclocal)
121 AROS_REQUIRED(automake/automake19/automake-1.9, $aros_host_automake)
123 case "$aros_host_cc" in
124     *gcc*)
125         aros_host_cc_pipe="-pipe"
126         ;;
127     icc)
128         aros_host_cc_pipe=""
129         ;;
130     *)
131         aros_host_cc_pipe=""
132         ;;
133 esac
135 aros_kernel_cc_includes=""
136 aros_target_cc_includes=""
138 # ----------------------------------------------------------------------------------------
139 # Host-specific defaults
141 # Override this to "yes" in order to force a specific build to use real AROS crosscompiler
142 # instead of a wrapper script.
143 # Useful for non-ELF hosts (like Windows and Darwin).
144 # Can also be overriden in target section below
145 use_aros_gcc="no"
147 # This is the main host configuration section. It is where the host
148 # can change the values of any variables it needs to change. We do
149 # not look at anything that compiles to the target yet, we'll get
150 # to that later.
152 case "$host_os" in
153     aros*)
154         aros_host_arch="aros"
155         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
156         case "$host_cpu" in
157             *i?86*)
158                 aros_host_cpu="i386"
159                 ;;
160             *x86_64*)
161                 aros_host_cpu="x86_64"
162                 ;;
163             *powerpc*)
164                 aros_host_cpu="ppc"
165                 ;;
166             *)
167                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
168                 aros_host_cpu="$host_cpu"
169                 ;;
170         esac
171         ;;
173     linux*)
174         aros_host_arch="linux"
175         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
176         android_build_os="linux-x86"
177         android_tool="android"
178         default_android_sdk="/opt/android-sdk-linux_x86"
179         case "$host_cpu" in
180             *i?86*)
181                 aros_host_cpu="i386"
182                 ;;
183             *x86_64*)
184                 aros_host_cpu="x86_64"
185                 ;;
186             *m68k*)
187                 aros_host_cpu="m68k"
188                 ;;
189             *powerpc*)
190                 aros_host_cpu="ppc"
191                 ;;
192             *arm*)
193                 aros_host_cpu="arm"
194                 ;;
195             *)
196                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
197                 aros_host_cpu="$host_cpu"
198                 ;;
199         esac
200         ;;
202     freebsd*)
203         aros_host_cc="$aros_host_cc $aros_host_cc_pipe -I/usr/local/include"
204         aros_host_make="gmake"
205         aros_host_arch="freebsd"
206         aros_host_cpu="i386"
208         aros_host_ldflags="$aros_host_ldflags -L/usr/local/lib -liconv"
210         dnl FreeBSD 5.x (and later) has changed the default object format.
211         dnl The double [[]] is necessary to get around m4's quoting rules.
212         case $host_os in
213             freebsd[[234]]*)
214                 aros_object_format="elf_i386"
215                 ;;
217             *)
218                 aros_object_format="elf_i386_fbsd"
219                 ;;
220         esac
222         ;;
224     darwin*)
225         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
226         aros_host_arch="darwin"
227         use_aros_gcc="yes"
228         android_build_os="darwin-x86"
229         android_tool="android"
230         default_android_sdk="/android-sdk-mac_x86"
231         case "$host_cpu" in
232             *i?86*)
233                 aros_host_cpu="i386"
234                 ;;
235             *x86_64*)
236                 aros_host_cpu="x86_64"
237                 ;;
238             *powerpc*)
239                 aros_host_cpu="ppc"
240                 ;;
241             *)
242                 AC_MSG_WARN("Unknown CPU for Darwin host -- $host_cpu")
243                 aros_host_cpu="$host_cpu"
244                 ;;
245         esac
247         aros_host_ldflags="$aros_host_ldflags -liconv"
249         ;;
251     dragonfly*)
252         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
253         aros_host_make="gmake"
254         aros_host_arch="dragonfly"
255         case $host_cpu in
256             *i?86*)
257                 aros_host_cpu="i386"
258                 ;;
259             *amd64*)
260                 aros_host_cpu="x86_64"
261                 ;;
262             *)
263                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
264                 aros_host_cpu="$host_cpu"
265                 ;;
266         esac
267         ;;
269     netbsd*)
270         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
271         aros_host_make="gmake"
272         aros_host_arch="netbsd"
273         case "$host_cpu" in
274             *i?86*)
275                 aros_host_cpu="i386"
276                 ;;
277             *m68k*)
278                 aros_host_cpu="m68k"
279                 ;;
280             *)
281                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
282                 aros_host_cpu="$host_cpu"
283                 ;;
284         esac    
285         aros_host_lib_suffix=".0.0"
286         ;;
288     openbsd*)
289         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
290         aros_host_make="gmake"
291         aros_host_arch="openbsd"
292         case "$host_cpu" in
293             *i?86*)
294                 aros_host_cpu="i386"
295                 ;;
296             *)
297                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
298                 aros_host_cpu="$host_cpu"
299                 ;;
300         esac
301         ;;
302         
303     solaris*)
304         aros_host_arch="solaris"
305         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
306         case "$host_cpu" in
307             *i?86*)
308                 aros_host_cpu="i386"
309                 ;;
310             *sparc*)
311                 aros_host_cpu="sparc"
312                 ;;
313             *)
314                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
315                 aros_host_cpu="$host_cpu"
316                 ;;
317         esac
318         ;;
320     morphos*)
321         aros_host_arch="morphos"
322         aros_host_cpu="ppc"
323         ;;
325     amiga*)
326         aros_host_arch="amiga"
327         SORT="/gg/bin/sort"
328         TEST="/gg/bin/test"
329         UNIQ="/gg/bin/uniq"
330         FOR="for"
331         TOUCH="/gg/bin/touch"
332         case "$host_cpu" in
333             *m68k*)
334                 aros_host_cpu="m68k"
335                 ;;
336             *powerpc*)
337                 aros_host_cpu="ppc"
338                 ;;
339             *)
340                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
341                 aros_host_cpu="$host_cpu"
342                 ;;
343         esac
344         ;;
346     cygwin*)
347         aros_host_arch="cygwin"
348         use_aros_gcc="yes"
349         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
350         android_build_os="windows"
351         android_tool="android.bat"
352         default_android_sdk="/cygdrive/c/android-sdk-windows-1.6_r1"
354         case "$host_cpu" in
355             *i?86*)
356                 aros_host_cpu="i386"
357                 ;;
358             *)
359                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
360                 aros_host_cpu="$host_cpu"
361                 ;;
362         esac
363         ;;
365     mingw32*)
366         aros_host_arch="mingw32"
367         use_aros_gcc="yes"
368         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
369         android_build_os="windows"
370         android_tool="android.bat"
371         default_android_sdk="/c/android-sdk-windows-1.6_r1"
373         case "$host_cpu" in
374         *i?86*)
375             dnl Currently there's neither 64-bit MinGW nor MSYS. Both environments are 32-bit
376             dnl and run under emulation. Consequently, uname reports i386 even on 64-bit systems.
377             dnl Here we attempt to detect Windows home platform by asking gcc about its target.
378             dnl 64-bit gcc will output "x86_64-w64-mingw32" here.
380             AC_MSG_CHECKING([for Windows native gcc target])
381             host_cpu=`gcc -dumpmachine`
382             AC_MSG_RESULT($host_cpu)
383             ;;
385         esac
387         case "$host_cpu" in
388         *i?86*)
389             aros_host_cpu="i386"
390             ;;
392         *x86_64*)
393             aros_host_cpu="x86_64"
394             dnl Dragon's x86_64-w64-mingw32-gcc is a bit broken. It ignores standard $prefix/include
395             dnl directory, so we have to add it explicitly here.
396             aros_host_cflags="$aros_host_cflags -isystem /mingw/include"
397             ;;
399         *)
400             AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
401             aros_host_cpu="$host_cpu"
402             ;;
403         esac
404         ;;
405     *)
406         AC_MSG_ERROR([Unsupported host architecture $host])
407         ;;
408 esac
410 AROS_PROG(aros_host_ar,[ar],[cr])
411 AROS_REQUIRED(ar,$aros_host_ar)
412 AROS_PROG(aros_host_ranlib,ranlib)
413 AROS_REQUIRED(ranlib,$aros_host_ranlib)
414 AROS_PROG(aros_host_strip,strip)
415 AROS_REQUIRED(strip,$aros_host_strip)
417 AROS_PROG(RM,[rm],[-rf])
418 AROS_REQUIRED(rm,$RM)
419 AROS_PROG(CP,[cp])
420 AROS_REQUIRED(cp,$CP)
421 AROS_PROG(MV,[mv])
422 AROS_REQUIRED(mv,$MV)
423 AROS_PROG(ECHO,[echo])
424 AROS_REQUIRED(echo,$ECHO)
425 AROS_PROG(MKDIR,[mkdir],[-p])
426 AROS_REQUIRED(mkdir,$MKDIR)
427 AROS_PROG(TOUCH,[touch])
428 AROS_REQUIRED(touch,$TOUCH)
429 AROS_PROG(SORT,[sort])
430 AROS_REQUIRED(sort,$SORT)
431 AROS_PROG(UNIQ,[uniq])
432 AROS_REQUIRED(uniq,$UNIQ)
433 AROS_PROG(NOP,[true])
434 AROS_REQUIRED(true,$NOP)
435 AROS_PROG(CAT,[cat])
436 AROS_REQUIRED(cat,$CAT)
437 AROS_PROG(BISON,[bison])
438 AROS_REQUIRED(bison,$BISON)
439 AROS_PROG(FLEX,[flex])
440 AROS_REQUIRED(flex,$FLEX)
441 AROS_PROG(PNGTOPNM,[pngtopnm])
442 AROS_REQUIRED(pngtopnm,$PNGTOPNM)
443 AROS_PROG(PPMTOILBM,[ppmtoilbm])
444 AROS_REQUIRED(ppmtoilbm,$PPMTOILBM)
445 AROS_PROG(SED,[sed])
446 AROS_REQUIRED(sed,$SED)
447 AROS_PROG(CHMOD,[chmod])
448 AROS_REQUIRED(chmod,$CHMOD)
449 AROS_PROG(PATCH,[patch])
450 AROS_REQUIRED(patch,$PATCH)
452 AM_PATH_PYTHON(2.5)
454 AC_SUBST(FOR, for)
455 AC_SUBST(IF, if)
456 AC_SUBST(TEST, test)
457 AC_SUBST(CMP, cmp)
459 dnl ---------------------------------------------------------------------------
460 dnl Look for things about the host system, good for hosted targets.
461 dnl ---------------------------------------------------------------------------
463 # Check for some includes for the X11 HIDD and the kernel
464 AC_CHECK_HEADERS([sys/ipc.h sys/shm.h \
465     sys/mmap.h sys/mman.h sysexits.h \
466     sys/statfs.h sys/statvfs.h sys/vfs.h sys/param.h \
469 AC_CHECK_HEADERS([sys/mount.h],,,[#include <sys/param.h>])
471 AC_HEADER_DIRENT
472 AC_HEADER_STAT
473 AC_HEADER_STDC
474 AC_HEADER_SYS_WAIT
475 AC_HEADER_TIME
476 AC_STRUCT_ST_BLKSIZE
477 AC_STRUCT_ST_BLOCKS
478 AC_STRUCT_ST_RDEV
479 AC_STRUCT_TM
480 AC_STRUCT_TIMEZONE
481 AC_TYPE_OFF_T
482 AC_TYPE_PID_T
483 AC_TYPE_SIZE_T
484 AC_TYPE_UID_T
486 AC_CHECK_MEMBERS(struct tm.tm_gmtoff)
488 # Look for some functions
489 AC_CHECK_FUNCS([getpagesize kqueue statfs statvfs \
490     clone kse_create rfork_thread thr_create sa_register \
491     getcontext makecontext setcontext sigaltstack swapcontext])
493 AC_FUNC_MMAP
496 dnl --------------------------------------------------------------------
497 dnl Target Configuration Section
498 dnl --------------------------------------------------------------------
500 dnl The target configuration section is responsible for setting up all
501 dnl the paths for includes, and tools required to build AROS to some
502 dnl particular target.
504 aros_config_cflags="-Wall -Werror-implicit-function-declaration"
505 aros_config_aflags="-Wall -x assembler-with-cpp -c"
506 aros_config_ldflags=""
508 aros_shared_default=yes
510 aros_shared_cflags="-fPIC"
511 aros_shared_aflags=""
512 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
513 aros_kernel_ldflags="-Wl,-rpath,./lib"
515 aros_kernel_ar_flags="cr"
516 aros_target_ar_flags="cr"
517 aros_target_nm_flags="-C -ul"
518 aros_target_strip_flags="--strip-unneeded -R.comment"
520 aros_compiler_libs=
521 aros_arch_libs=
523 aros_target_genmap="-Wl,-Map -Xlinker"
525 # Native flavour stuff
526 aros_serial_debug="0"
528 # Palm native flavour stuff
529 aros_palm_debug_hack="0"
531 # Unix flavour stuff
532 aros_nesting_supervisor="0"
534 # Collect-aros stuff: "-ius" to ignore undefined symbols
535 ignore_undefined_symbols=""
537 # Check for X11 by default
538 need_x11="auto"
540 #-----------------------------------------------------------------------------
543 # GCC 4.1+ has a stack protection feature that requires OS support. Ubuntu has
544 # it switched on by default, and we use the host compiler, so it compiles AROS
545 # code with this enabled resulting in link failures as we don't have support
546 # for it.
548 # We use two methods to disable it. For the host compiler (used to compile
549 # some hosted modules), we test to see if the compiler supports stack
550 # protection, and if it does we disable it in AROS_CONFIG_CFLAGS. This should
551 # work on all platforms.
553 # For the "cross" compiler we clear the "ssp_default" spec in config/specs.in
554 # (this is done unconditionally, as it should have no effect on compilers
555 # without the stack protection feature). This may be specific to the way that
556 # Ubuntu enables the feature, so may not work everywhere. My specs-fu isn't
557 # strong enough to disable it in a generic way though, so we'll live with it
558 # until another vendor ships GCC with it enabled in a different way, and deal
559 # with it then.
562 AC_MSG_CHECKING([whether ${CC} accepts -fno-stack-protector])
563 save_cflags="$CFLAGS"
564 CFLAGS="$CFLAGS -fno-stack-protector"
565 AC_TRY_COMPILE(,, use_no_stack_protector="yes", use_no_stack_protector="no")
566 AC_MSG_RESULT($use_no_stack_protector)
567 if test "x-$use_no_stack_protector" = "x-yes" ; then
568     aros_host_cflags="$aros_host_cflags -fno-stack-protector"
570 CFLAGS="$save_cflags"
572 #-----------------------------------------------------------------------------
574 # Disable pointer-signedness warnings if the compiler recognises the option
575 # (this only works for the host compiler at the moment)
577 AC_MSG_CHECKING([whether ${CC} accepts -Wno-pointer-sign])
578 save_cflags="$CFLAGS"
579 CFLAGS="$CFLAGS -Wno-pointer-sign"
580 AC_TRY_COMPILE(,, use_no_sign_warning="yes", use_no_sign_warning="no")
581 AC_MSG_RESULT($use_no_sign_warning)
582 if test "x-$use_no_sign_warning" = "x-yes" ; then
583     aros_host_cflags="$aros_host_cflags -Wno-pointer-sign"
585 CFLAGS="$save_cflags"
587 #-----------------------------------------------------------------------------
589 # Check if host compiler supports -fgnu89-inline, can be needed for crosstools.
591 AC_MSG_CHECKING([whether ${CC} accepts -fgnu89-inline])
592 save_cflags="$CFLAGS"
593 CFLAGS="$CFLAGS -fgnu89-inline"
594 AC_TRY_COMPILE(,, use_gnu89_inline="yes", use_gnu89_inline="no")
595 AC_MSG_RESULT($use_gnu89_inline)
596 if test "x-$use_gnu89_inline" = "x-yes" ; then
597     gnu89_inline="-fgnu89-inline"
599 CFLAGS="$save_cflags"
601 #-----------------------------------------------------------------------------
603 AC_MSG_CHECKING([for type of build])
604 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")
606 if test "$build_type" = "nightly"; then
607     build_type_string="NIGHTLY"
608 elif test "$build_type" = "snapshot"; then
609     build_type_string="SNAPSHOT"
610 elif test "$build_type" = "milestone"; then
611     build_type_string="MILESTONE"
612 elif test "$build_type" = "release"; then
613     build_type_string="RELEASE"
614 else
615     build_type_string="PERSONAL"
616     build_type="personal"
619 aros_config_cflags="$aros_config_cflags -DAROS_BUILD_TYPE=AROS_BUILD_TYPE_$build_type_string"
621 AC_MSG_RESULT($build_type)
623 #-----------------------------------------------------------------------------
624 all_debug_types="messages stack modules mungwall symbols"
626 AC_MSG_CHECKING([which debug types to enable])
627 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)]),
628  debug="$enableval",debug="")
630 if test "$debug" = "" -o "$debug" = "no"; then
631     debug="none"
632 elif test "$debug" = "yes"; then
633     debug="all"
636 if test "$debug" = "all" ; then
637     debug="messages stack modules symbols"
638     for d in $all_debug_types; do
639         export aros_${d}_debug="1"
640     done
641 else
642     for d in $all_debug_types; do
643         export aros_${d}_debug="0"
644     done
647 if test "$debug" != "none"; then
648     debug=`echo $debug | sed s/,/\ /g`
649     for d in $debug; do
650         found="0"
651         for d2 in $all_debug_types; do
652             if test "$d2" = "$d"; then
653                 found="1"
654                 break
655             fi
656         done
657         if test "$found" = "0"; then
658             AC_MSG_ERROR([unrecognized debug type "$d". Available types are: all none $all_debug_types])
659         fi
660         export aros_${d}_debug="1"
661     done
662     aros_debug="yes"
664 AC_MSG_RESULT($debug)
666 if test "$aros_messages_debug" = "1"; then
667     aros_messages_debug="-DADEBUG=1 -DMDEBUG=1"
668 else
669     aros_messages_debug=""
671 if test "$aros_symbols_debug" = "1"; then
672     aros_symbols_debug="-g"
673 else
674     aros_symbols_debug=""
677 # These are the flags to pass when compiling debugged programs
678 aros_debug_cflags="$aros_symbols_debug $aros_messages_debug"
679 aros_debug_aflags=""
680 aros_debug_ldflags="$aros_symbols_debug"
682 #-----------------------------------------------------------------------------
683 #   Checking if we should build crosstools..
684 AC_MSG_CHECKING([whether to build crosstools])
685 AC_ARG_ENABLE(crosstools,AC_HELP_STRING([--disable-crosstools],[Do not build cross-compiler toolchain]),crosstools="$enableval",crosstools="yes")
686 AC_MSG_RESULT($crosstools)
688 #-----------------------------------------------------------------------------
689 #   Checking for distcc and ccache.
691 #   Always apply the transforms in this particular order. Basically you should
692 #   always run 'ccache distcc compiler' in that order for the best performance.
694 AC_MSG_CHECKING([whether to enable distcc])
695 AC_ARG_ENABLE(distcc,AC_HELP_STRING([--enable-distcc],[Use distcc as a front end to the compiler (default=no).]),distcc="$enableval",distcc="no")
696 if test "$distcc" != "" -a "$distcc" != "no"; then
697     # AC_CHECK_PROG will print out the result in this case
698     AC_PATH_PROG(DISTCC,[distcc],distcc,)
699 else
700     AC_MSG_RESULT(no)
703 AC_MSG_CHECKING([whether to enable ccache])
704 AC_ARG_ENABLE(ccache,AC_HELP_STRING([--enable-ccache],[Use ccache as a front end to the compiler (default=no).]),ccache="$enableval",ccache="no")
705 if test "$ccache" != "" -a "$ccache" != "no"; then
706     # AC_CHECK_PROG will print out the result in this case
707     AC_CHECK_PROG(CCACHE,[ccache],ccache,)
708 else
709     AC_MSG_RESULT(no)
712 #-----------------------------------------------------------------------------
713 AC_MSG_CHECKING([what specific host gcc version to use])
714 AC_ARG_WITH(gcc-version,AC_HELP_STRING([--with-kernel-gcc-version=VERSION],[Use host gcc-VERSION for building AROS]),kernel_tool_version="$withval",kernel_tool_version="default")
715 AC_MSG_RESULT($kernel_tool_version)
717 #-----------------------------------------------------------------------------
718 AC_MSG_CHECKING([what specific target gcc version to use])
719 AC_ARG_WITH(gcc-version,AC_HELP_STRING([--with-gcc-version=VERSION],[Use host gcc-VERSION for building AROS]),target_tool_version="$withval",target_tool_version="default")
720 AC_MSG_RESULT($target_tool_version)
722 #-----------------------------------------------------------------------------
723 AC_MSG_CHECKING([what optimization flags to use])
724 AC_ARG_WITH(optimization,AC_HELP_STRING([--with-optimization=FLAGS],[Use optimization flags FLAGS (default=-O2).]),optimization="$withval",optimization="unknown")
725 if test "$optimization" = "unknown"; then
726     dnl default is -O2 for normal builds, -O0 for debug builds
727     if test "$debug" != "none"; then
728         optimization="-O0"
729     else
730         optimization="-O2"
731     fi
733 aros_config_cflags="$aros_config_cflags $optimization"
734 AC_MSG_RESULT($optimization)
736 #-----------------------------------------------------------------------------
737 AC_MSG_CHECKING([what paranoia flags to use])
738 AC_ARG_WITH(paranoia,AC_HELP_STRING([--with-paranoia=FLAGS],[CC flags to enable paranoia]),[paranoia_flags="$withval"],[paranoia_flags="default"])
739 if test "$paranoia_flags" = "default"; then
740         paranoia_flags=""
741 else if test "$paranoia_flags" = "yes"; then
742         paranoia_flags="-Wall -Werror"
743 fi fi
744 AC_MSG_RESULT($paranoia_flags)
745 aros_config_cflags="$aros_config_cflags $paranoia_flags"
747 #-----------------------------------------------------------------------------
748 AC_MSG_CHECKING([what target variant to enable])
749 AC_ARG_ENABLE(target_variant,AC_HELP_STRING([--enable-target-variant=NAME],[Enable a specific target variant(default=none)]),target_variant=$enableval,target_variant="")
750 if test "$target_variant" = ""; then
751     aros_target_variant=""
752     aros_target_suffix=""
753     enableval="none"
754 else
755     aros_target_variant="$target_variant"
756     aros_target_suffix="-$target_variant"
758 AC_MSG_RESULT($enableval)
760 #-----------------------------------------------------------------------------
761 # Target-specific defaults. You can override then on a per-target basis.
763 # Bootloader name. Currently used by PC target.
764 target_bootloader="none"
766 # Prefix for toolchain used to build bootstrap. For hosted ports, this should be a toolchain for target host OS.
767 # (i. e. when building mingw32-i386 port this should be set to "i386-mingw32-").
768 # For native ports this toolchain is used to build a bootloader and second-level bootstrap (if present).
769 if test "$crosstools" != "yes"; then
770     target_tool_prefix=${target_cpu}-elf-
771 else
772     target_tool_prefix=${target_cpu}-aros-
774 AC_MSG_CHECKING([Target tool prefix])
775 AC_MSG_RESULT($target_tool_prefix)
777 #-----------------------------------------------------------------------------
778 # Additional options for some specific targets
780 case "$aros_target_variant" in
781 ios)
782     AC_MSG_CHECKING([XCode path])
783     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")
784     AC_MSG_RESULT($aros_xcode_path)
786     AC_MSG_CHECKING([what iOS SDK version to use])
787     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")
788     AC_MSG_RESULT($aros_sdk_version)
790     ;;
792 "android")
793     AC_MSG_CHECKING([Android SDK path])
794     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)
795     AC_MSG_RESULT($aros_android_sdk)
797     AC_MSG_CHECKING([Android NDK path])
798     AC_ARG_WITH(ndk,AC_HELP_STRING([--with-ndk=PATH],[Specify Android NDK path (default=none).]),aros_android_ndk="$withval",aros_android_ndk="none")
799     AC_MSG_RESULT($aros_android_ndk)
801     AC_MSG_CHECKING([what Android SDK version to use])
802     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")
803     AC_MSG_RESULT($aros_sdk_version)
805     if test "$aros_android_ndk" != "none"; then
806         AC_MSG_CHECKING([what Android NDK version to use])
807         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")
808         AC_MSG_RESULT($aros_ndk_version)
809     fi
811     export PATH="$aros_android_sdk/tools:$PATH"
812     AC_PATH_PROG(android_tool, $android_tool)
813     AROS_REQUIRED(android,$android_tool)
815     aros_android_level=android-$aros_sdk_version
816     if test ! -d $aros_android_sdk/platforms/$aros_android_level; then
817         echo "Platform $aros_android_level is not installed in your SDK"
818         echo "Use --with-sdk-version=<API level number> to select another platform version"
819         echo "You can check what plaform versions are installed in your SDK"
820         echo "by examining contents of $aros_android_sdk/platforms directory"
821         AC_MSG_ERROR([Android platform $aros_android_level is not installed])
822     fi
824     AC_PATH_PROG(ant, ant)
825     if test "$ant" = ""; then
826         AC_MSG_WARN([Apache Ant is missing, Java bootstrap can't be built automatically])
827     fi
829     dnl MSYS bash can't run .bat files directly, then need to be started via cmd.exe
830     if test "$host_os" = "mingw32"; then
831         android_tool="cmd //c $android_tool"
832     fi
834     ;;
835 esac
837 #-----------------------------------------------------------------------------
839 # This is the target configuration switch.
840 case "$target_os" in
841     linux*)
842         aros_target_arch="linux"
843         aros_target_family="unix"
844         case "$target_cpu" in
845             *m68k*)
846                 aros_target_cpu="m68k"
847                 aros_object_format="m68kelf"
848                 aros_flavour="emulcompat"
849                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D__mc68000 -D__linux__"
850                 aros_shared_ldflags="-Wl,-T,\$(TOP)/config/linux/m68k/script.so"
851                 aros_kernel_ldflags="-Wl,-rpath,./lib,-T,\$(TOP)/config/linux/m68k/script.normal"
852                 gcc_target_cpu="mc68000"
853                 ;;
854             *i?86*)
855                 aros_target_cpu="i386"
856                 aros_object_format="elf_i386"
857                 aros_flavour="emulation"
858                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__linux__"
859                 aros_config_cflags="$aros_config_cflags -m32 -march=i486"
860                 aros_kernel_cflags="$aros_kernel_cflags -m32 -march=i486"
861                 aros_config_aflags="$aros_config_aflags -m32 -march=i486"
862                 aros_config_ldflags="-m32 -march=i486"
863                 aros_kernel_ldflags="-melf_i386"
864                 aros_default_wbdepth=8
865                 gcc_target_cpu="i386"
866                 pci_hidd_target="hidd-pci-linux"
867                 android_tool_dir_prefix="x86"
868                 android_tool_prefix="i686-android-linux"
869                 android_ndk_arch="x86"
870                 ;;
871             *x86_64*)
872                 aros_target_cpu="x86_64"
873                 aros_object_format="elf_x86_64"
874                 aros_flavour="emulation"
875                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64 -D__linux__"
876                 aros_config_cflags="$aros_config_cflags -mno-red-zone -fno-omit-frame-pointer"
877                 aros_default_wbdepth=8
878                 pci_hidd_target="hidd-pci-linux"
879                 ;;
880             *powerpc*)
881                 aros_target_cpu="ppc"
882                 aros_object_format="elf32ppc"
883                 aros_flavour="emulation"
884                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc -D__linux__"
885                 aros_default_wbdepth=8
886                 gcc_target_cpu="ppc"
887                 ;;
888 # TODO
889 # Same as powerpc, but I need this for the nightly build to work again.
890 # Actually, the nightly should be made working with powerpc target.
891 # That just was too much work for the moment, another week or two.
892             *ppc*)
893                 aros_target_cpu="ppc"
894                 aros_object_format="elf32ppc"
895                 aros_flavour="emulation"
896                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc -D__linux__"
897                 aros_default_wbdepth=8
898                 gcc_target_cpu="ppc"
899                 ;;
900             *arm*)
901                 aros_target_cpu="arm"
902                 aros_object_format="armelf_linux_eabi"
903                 aros_flavour="emulation"
904                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm -D__linux__"
905                 gcc_target_cpu="arm"
906                 aros_config_cflags="$aros_config_cflags -fno-strict-aliasing -fno-omit-frame-pointer"
907                 aros_config_aflags="$aros_config_aflags -fno-strict-aliasing"
908                 aros_arch_libs="-laeabi"
909                 android_tool_dir_prefix="arm-linux-androideabi"
910                 android_tool_prefix="arm-linux-androideabi"
911                 android_ndk_arch="arm"
912                 ;;
913             *)
914                 AC_MSG_ERROR("Unknown CPU for Linux -- $target_cpu")
915                 ;;
916         esac
917         case "$aros_target_variant" in
918             android)
920                 dnl Not all Linux CPUs are supported by Android
921                 if test "$android_ndk_arch" = ""; then
922                     AC_MSG_ERROR("Unsupported CPU for Android -- $target_cpu")
923                 fi
925                 aros_default_wbwidth=320
926                 aros_default_wbheight=480
927                 if test "$aros_android_ndk" = "none"; then
928                     dnl Use standalone toolchain, don't adjust paths
929                     aros_kernel_cflags="-mandroid"
930                     aros_kernel_ldflags="-mandroid"
931                     CFLAGS="-mandroid"
932                 else
933                     export PATH="$aros_android_ndk/toolchains/$android_tool_dir_prefix-$target_tool_version/prebuilt/$android_build_os/bin:$PATH"
934                     aros_android_ndk="$aros_android_ndk/platforms/android-$aros_ndk_version/arch-$android_ndk_arch"
935                     aros_kernel_cflags="--sysroot $aros_android_ndk -mandroid"
936                     aros_kernel_ldflags="--sysroot $aros_android_ndk -mandroid"
937                     CFLAGS="$CFLAGS --sysroot $aros_android_ndk -mandroid"
938                     aros_kernel_includes="-isystem $aros_android_ndk/usr/include"
939                 fi
940                 need_x11=no
941                 dnl (Ab)use $(X11_HIDD_TARGET) as "Default display driver target"
942                 dnl in order not to fill mmakefiles with garbage
943                 x11_hidd_target=kernel-hidd-androidgfx-kobj
944                 kernel_tool_prefix="$android_tool_prefix-"
945             ;;
946         esac
947     ;;
949     pc)
950         aros_target_arch="pc"
951         aros_shared_default="no"
952         target_bootloader="grub2"
953         case "$target_cpu" in
954             *i?86*)
955                 aros_target_cpu="i386"
957                 dnl If somebody hasn't already set the target object
958                 dnl format, then use this value. Mostly to support
959                 dnl FreeBSD cross-compilation.
960                 dnl TODO: Remove when we always use our compiler.
962                 if test "$aros_object_format" = "" ; then
963                     aros_object_format="elf_i386"
964                 fi
965                 aros_flavour="standalone"
966                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
967                 aros_config_cflags="$aros_config_cflags -m32 -march=i486"
968                 aros_kernel_cflags="$aros_kernel_cflags -m32 -march=i486"
969                 aros_config_aflags="$aros_config_aflags -m32 -march=i486"
970                 aros_config_ldflags="-m32 -march=i486"
971                 aros_kernel_ldflags="-melf_i386"
972                 aros_default_wbwidth=640
973                 aros_default_wbheight=480
974                 gcc_target_cpu="i386"
975                 ;;
976             *x86_64*)
977                 aros_target_cpu="x86_64"
978                 aros_serial_debug=1
979                 if test "$aros_object_format" = "" ; then
980                     aros_object_format="elf_x86_64"
981                 fi
982                 aros_flavour="standalone"
983                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
984                 aros_config_cflags="$aros_config_cflags -fno-asynchronous-unwind-tables -mno-red-zone -fno-omit-frame-pointer"
985                 aros_kernel_ldflags=""
986                 aros_default_wbwidth=640
987                 aros_default_wbheight=480
988                 ;;
989             *)
990                 AC_MSG_ERROR("Unknown native CPU -- $target_cpu")
991                 ;;
992         esac
993         ;;
995     prep)
996         aros_target_arch="prep"
997         aros_shared_default="no"
998         aros_target_cpu="ppc"
999         aros_object_format="elf32ppc"
1000         aros_flavour="ppcnative"
1001         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1002         aros_kernel_ldflags=""
1003         aros_default_wbwidth=640
1004         aros_default_wbheight=480
1005         gcc_target_cpu="ppc"
1006         ;;
1008     freebsd*)
1009         aros_target_arch="freebsd"
1010         aros_target_family="unix"
1011         aros_target_cpu="i386"
1012         aros_flavour="emulation"
1013         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1014         gcc_target_cpu="i386"
1016         aros_target_strip_flags="-x"
1017         ;;
1019     darwin*)
1020         aros_target_arch="darwin"
1021         aros_target_family="unix"
1022         aros_flavour="emulation"
1023         case "$target_cpu" in
1024             *i?86*)
1025                 aros_ios_platform="iPhoneSimulator"
1026                 aros_target_cpu="i386"
1027                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1028                 aros_kernel_ldflags=""
1029                 aros_macosx_version="10.4"
1030                 aros_default_wbdepth=8
1031                 gcc_target_cpu="i386"
1032                 aros_object_format="elf_i386"
1033                 aros_kernel_ar_flags="-cr"
1034                 aros_target_strip_flags="-x"
1035                 kernel_tool_flags="-m32"
1036                 ;;
1037             *x86_64*)
1038                 aros_target_cpu="x86_64"
1039                 aros_object_format="elf_x86_64"
1040                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
1041                 aros_macosx_version="10.6"
1042                 aros_config_cflags="$aros_config_cflags -fno-omit-frame-pointer"
1043                 aros_kernel_cflags="-m64"
1044                 aros_kernel_ldflags="-m64"
1045                 aros_target_cflags="-mcmodel=large"
1046                 aros_default_wbdepth=8
1047                 aros_kernel_ar="ar"
1048                 aros_kernel_ar_flags="-cr"
1049                 aros_kernel_ld="ld"
1050                 aros_kernel_ranlib="ranlib"
1051                 ;;
1052             *ppc*)
1053                 aros_target_cpu="ppc"
1054                 aros_object_format="elf32ppc"
1055                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1056                 aros_kernel_ldflags=""
1057                 aros_macosx_version="10.0"
1058                 aros_default_wbdepth=8
1059                 gcc_target_cpu="ppc"
1060                 aros_kernel_ar="ar"
1061                 aros_kernel_ar_flags="-cr"
1062                 aros_kernel_ld="ld -arch ppc"
1063                 aros_kernel_ranlib="ranlib -arch ppc"
1064                 kernel_tool_prefix="powerpc-apple-darwin10-"
1065                 ;;
1066             *arm*)
1067                 aros_ios_platform="iPhoneOS"
1068                 aros_target_cpu="arm"
1069                 aros_object_format="armelf_linux_eabi"
1070                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
1071                 aros_arch_libs="-laeabi"
1072                 aros_default_wbdepth=8
1073                 gcc_target_cpu="arm"
1074                 aros_kernel_ar="ar"
1075                 aros_kernel_ar_flags="-cr"
1076                 aros_kernel_ld="ld -arch arm"
1077                 aros_kernel_ranlib="ranlib -arch arm"
1078                 kernel_tool_prefix="arm-apple-darwin10-" 
1079                 export PATH="$aros_xcode_path/Platforms/$aros_ios_platform.platform/Developer/usr/bin:$PATH"
1080                 ;;
1081             *)
1082                 AC_MSG_ERROR("Unsupported target CPU for darwin hosted flavour -- $target_cpu")
1083                 ;;
1084         esac
1085         case "$aros_target_variant" in
1086             ios)
1087                 aros_ios_version="3.0"
1088                 aros_default_wbwidth=320
1089                 aros_default_wbheight=480
1090                 aros_ios_sdk="$aros_xcode_path/Platforms/$aros_ios_platform.platform/Developer/SDKs/$aros_ios_platform$aros_sdk_version.sdk"
1091                 kernel_tool_flags="$target_tool_flags -isysroot $aros_ios_sdk"
1092                 aros_kernel_includes="-isystem $aros_ios_sdk/usr/include"
1093                 need_x11=no
1094                 # This is here because it may depend on iOS or SDK version
1095                 aros_kernel_cflags="$aros_kernel_cflags -miphoneos-version-min=$aros_ios_version"
1096                 aros_kernel_ldflags="$aros_kernel_ldflags -miphoneos-version-min=$aros_ios_version"
1097                 aros_kernel_objcflags="-fobjc-abi-version=2 -fobjc-legacy-dispatch"
1098             ;;
1099             *)
1100                 aros_kernel_cflags="$aros_kernel_cflags -mmacosx-version-min=$aros_macosx_version"
1101                 aros_kernel_ldflags="$aros_kernel_ldflags -mmacosx-version-min=$aros_macosx_version"
1102             ;;
1103         esac
1104         ;;
1106     dragonfly*)
1107         aros_target_arch="dragonfly"
1108         aros_target_family="unix"
1109         aros_flavour="emulation"
1110         case "$target_cpu" in
1111             *i?86*)
1112                 aros_target_cpu="i386"
1113                 aros_object_format="elf_i386"
1114                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__DragonFly__"
1115                 ;;
1116             *x86_64*)
1117                 aros_config_cflags="$aros_config_cflags -fno-omit-frame-pointer"
1118                 aros_target_cpu="x86_64"
1119                 aros_object_format="elf_x86_64"
1120                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64 -D__DragonFly__"
1121                 ;;
1122             *)
1123                 AC_MSG_ERROR("Unknown CPU for DragonFly -- $target_cpu")
1124                 ;;
1125         esac
1126         ;;
1128     netbsd*)
1129         aros_target_arch="netbsd"
1130         aros_target_family="unix"
1131         case "$target_cpu" in
1132             *m68k*)
1133                 aros_target_cpu="m68k"
1134                 aros_object_format="m68kelf"
1135                 aros_flavour="emulcompat"
1136                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D__mc68000 -D__NetBSD__"
1137                 gcc_target_cpu="mc68000"
1138                 ;;
1139             *i?86*)
1140                 aros_target_cpu="i386"
1141                 aros_object_format="elf_i386"
1142                 aros_flavour="emulation"
1143                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__NetBSD__"
1144                 aros_default_wbdepth=8
1145                 gcc_target_cpu="i386"
1146                 ;;
1147             *)
1148                 AC_MSG_ERROR("Unknown CPU for NetBSD -- $target_cpu")
1149                 ;;
1150         esac
1151         aros_target_genmap="-Wl,-M -Xlinker >"
1152         aros_flavour="emulation"
1153         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1154         ;;   
1156     openbsd*)
1157         aros_target_arch="openbsd"
1158         aros_target_family="unix"
1159         case "$target_cpu" in
1160             *i?86*)
1161                 aros_target_cpu="i386"
1162                 aros_object_format="elf_i386"
1163                 aros_flavour="emulation"
1164                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__OpenBSD__"
1165                 gcc_target_cpu="i386"
1166                 ;;
1167             *)
1168                 AC_MSG_ERROR("Unknown CPU for OpenBSD -- $target_cpu")
1169                 ;;
1170         esac
1171         aros_target_genmap="-Wl,-M -Xlinker >"
1172         aros_target_nm_flags="-u"
1173         aros_flavour="emulation"
1174         ;;
1176     solaris*)
1177         aros_target_arch="solaris"
1178         aros_target_family="unix"
1179         case "$target_cpu" in
1180            *i?86*)
1181                aros_target_cpu="i386"
1182                aros_object_format="elf_i386"
1183                aros_flavour="emulation"
1184                aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__Solaris__"
1185                aros_default_wbdepth=8
1186                gcc_target_cpu="i386"
1187                ;;
1188             *sparc*)
1189                 aros_target_cpu="sparc"
1190                 aros_object_format="elf_sparc"
1191                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dsparc -D__Solaris__"
1192                 gcc_target_cpu="sparc"
1193                 ;;
1194             *)
1195                 AC_MSG_ERROR("Unknown CPU for Solaris -- $target_cpu")
1196                 ;;
1197         esac
1198         aros_config_cflags="$aros_config_cflags -D$aros_target_cpu"
1199         aros_flavour="emulation"
1200         ;;
1202     morphos*)
1203         aros_target_arch="morphos"
1204         aros_shared_default="no"
1205         aros_target_cpu="ppc"
1206         aros_object_format="elf_ppc"
1207         aros_flavour="nativecompat"
1208         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1209         gcc_target_cpu="ppc"
1210         ;;
1212     sam440)
1213         aros_target_arch="sam440"
1214         aros_shared_default="no"
1215         aros_target_cpu="ppc"
1216         aros_object_format="elf32ppc"
1217         aros_flavour="ppcnative"
1218         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1219         aros_kernel_ldflags=""
1220         aros_default_wbwidth=1024
1221         aros_default_wbheight=768
1222         aros_default_wbdepth=24
1223         aros_config_cflags="$aros_config_cflags -mcpu=440fp -mno-toc -fno-asynchronous-unwind-tables"
1224         gcc_target_cpu="powerpc"
1225         ;;
1227     efika)
1228         aros_target_arch="efika"
1229         aros_shared_default="no"
1230         aros_target_cpu="arm"
1231         aros_object_format="armelf_linux_eabi"
1232         aros_flavour="standalone"
1233         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
1234         aros_kernel_ldflags=""
1235         aros_default_wbwidth=1024
1236         aros_default_wbheight=600
1237         aros_arch_libs="-laeabi"
1238         gcc_default_cpu="armv7-a"
1239         gcc_default_fpu="vfpv3"
1240         gcc_default_float_abi="softfp"
1241         aros_config_cflags="$aros_config_cflags -mtune=cortex-a8 -fno-strict-aliasing"
1242         aros_config_aflags="$aros_config_aflags -mtune=cortex-a8 -fno-strict-aliasing"
1243         ;;
1244         
1245     chrp)
1246     aros_target_arch="chrp"
1247     aros_shared_default="no"
1248     aros_target_cpu="ppc"
1249     aros_object_format="elf32ppc"
1250     aros_flavour="ppcnative"
1251     aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1252     aros_kernel_ldflags=""
1253     aros_default_wbwidth=640
1254     aros_default_wbheight=480
1255     aros_config_cflags="$aros_config_cflags -mno-toc -fno-asynchronous-unwind-tables"    
1256     gcc_target_cpu="powerpc"
1257         case "$aros_target_variant" in
1258             efika)
1259             aros_config_cflags="$aros_config_cflags -DBIG_ENDIAN_OHCI=1 -mcpu=603e"
1260             ;;
1261         esac
1262     ;;
1264     amiga*)
1265         aros_target_arch="amiga"
1266         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D_AMIGA -DAMIGA"
1267         aros_shared_default="no"
1269         case "$target_cpu" in
1270             *m68k*)
1271                 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")
1272                 aros_enable_mmu=no
1273                 aros_target_cpu="m68k"
1274                 aros_object_format="m68kelf"
1275                 aros_flavour="standcompat"
1276                 gcc_target_cpu="m68000"
1277                 aros_config_cflags="$aros_config_cflags -fno-strict-aliasing -ffreestanding -fomit-frame-pointer -${gcc_target_cpu} -fbuiltin -Wno-volatile-register-var -Os"
1278                 aros_config_aflags="$aros_config_aflags -${gcc_target_cpu}"
1279                 # Needed to get the correct multilib
1280                 aros_config_ldflags="-${gcc_target_cpu}"
1281                 aros_shared_ldflags="-${gcc_target_cpu}"
1282                 aros_kernel_ldflags="-${gcc_target_cpu}"
1283                 aros_target_nostdlib_ldflags="-${gcc_target_cpu}"
1284                 aros_target_strip_flags="-R.comment --strip-debug"
1285                 aros_default_wbwidth=640
1286                 aros_default_wbheight=256
1287                 aros_default_wbdepth=2
1288                 ;;
1289             *ppc*)
1290                 aros_cpu="ppc"
1291                 aros_flavour="native"
1292                 gcc_target_cpu="ppc"
1293                 ;;
1294             *)
1295                 AC_MSG_ERROR("Unknown CPU for Amiga $target_cpu")
1296                 ;;
1297         esac
1298         ;;
1300     mingw*)
1301         aros_target_arch="mingw32"
1302         aros_shared_default="no"
1303         aros_flavour="emulation"
1304         aros_shared_cflags=""
1305         need_dlopen="no"
1306         rescomp="windres"
1307         case "$target_cpu" in
1308             *i?86*)
1309                 aros_target_cpu="i386"
1310                 aros_object_format="elf_i386"
1311                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1312                 aros_default_wbdepth=8
1313                 gcc_target_cpu="i386"
1315                 dnl Temporary hack, needed to get nightly build working
1316                 aros_target_cpp="i386-aros-cpp"
1317                 aros_target_as="i386-aros-as"
1318                 aros_target_ar="i386-aros-ar"
1319                 aros_target_ranlib="i386-aros-ranlib"
1320                 aros_target_nm="i386-aros-nm"
1321                 aros_target_strip="i386-aros-strip"
1322                 aros_target_objcopy="i386-aros-objcopy"
1323                 aros_target_objdump="i386-aros-objdump"
1325                 kernel_tool_prefix="i386-mingw32-"
1326                 ;;
1327             *x86_64*)
1328                 aros_target_cpu="x86_64"
1329                 aros_object_format="elf_x86_64"
1330                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
1331                 aros_config_cflags="$aros_config_cflags -fno-omit-frame-pointer"
1332                 aros_default_wbdepth=8
1333                 kernel_tool_prefix="x86_64-w64-mingw32-"
1334                 ;;
1335             *arm*)
1336                 aros_target_cpu="arm"
1337                 aros_object_format="armelf_linux_eabi"
1338                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
1339                 aros_arch_libs="-laeabi"
1340                 aros_default_wbdepth=8
1341                 gcc_target_cpu="arm"
1342                 gcc_default_float_abi="soft"
1343                 kernel_tool_prefix="arm-mingw32ce-"
1344                 aros_default_wbwidth=160
1345                 aros_default_wbheight=160
1346                 ;;
1347             *)
1348                 AC_MSG_ERROR("Unknown CPU for Mingw32 -- $target_cpu")
1349                 ;;
1350         esac
1351         if test $host_os = "cygwin"; then
1352                 aros_kernel_cflags="-mno-cygwin"
1353         fi
1354     ;;
1355     pp*)
1356         aros_target_arch="pp"
1357         aros_shared_default="no"
1358         case "$target_cpu" in
1359             *m68k*)
1360                 aros_target_cpu="m68k"
1361                 aros_object_format="m68kelf"
1362                 aros_flavour="palmnative"
1363                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
1364                 aros_default_wbwidth=160
1365                 aros_default_wbheight=160
1366                 aros_default_wbdepth=1
1367                 aros_target_ar_flags="cru"
1368                 aros_compiler_libs="-lgcc1"
1369                 aros_shared_default=no
1370                 aros_shared_cflags="-fpic"
1371                 aros_shared_aflags=""
1372                 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
1373                 aros_kernel_ldflags="-Wl,-rpath,./lib"
1374                 aros_debug_cflags="$aros_symbols_debug  $aros_messages_debug -mc68000 -Wa,-mc68000"
1375                 aros_debug_aflags=""
1376                 aros_debug_ldflags="$aros_symbols_debug"
1377                 aros_mungwall_debug="0"
1378                 aros_modules_debug="0"
1379                 gcc_target_cpu="mc68000"
1380                 ignore_undefined_symbols="-ius"
1381                 ;;
1382            *)
1383                 AC_MSG_ERROR("Unknown CPU for PalmPilot -- $target_cpu")
1384                 ;;
1385         esac
1386         ;;
1388     mac*)
1389         aros_target_arch="mac"
1390         aros_shared_default="no"
1391         case "$target_cpu" in
1392             *m68k*)
1393                 aros_target_cpu="m68k"
1394                 aros_object_format="m68kelf"
1395                 aros_flavour="mac68knative"
1396                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
1397                 aros_default_wbwidth=512
1398                 aros_default_wbheight=384
1399                 aros_default_wbdepth=8
1400                 aros_target_ar_flags="cru"
1401                 aros_compiler_libs="-lgcc1"
1402                 aros_shared_default=no
1403                 aros_shared_cflags="-fpic"
1404                 aros_shared_aflags=""
1405                 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
1406                 aros_kernel_ldflags="-Wl,-rpath,./lib"
1407                 aros_debug_cflags="$aros_symbols_debug $aros_messages_debug -mc68000"
1408                 aros_debug_aflags=""
1409                 aros_debug_ldflags="$aros_symbols_debug"
1410                 aros_mungwall_debug="0"
1411                 aros_modules_debug="0"
1412                 gcc_target_cpu="mc68000"
1413                 ignore_undefined_symbols="-ius"
1414                 ;;
1415            *)
1416                 AC_MSG_ERROR("Unknown CPU for Mac68k -- $target_cpu")
1417                 ;;
1418         esac
1419         ;;
1421     *)
1422         AC_MSG_ERROR([Unsupported target architecture $target])
1423         ;;
1424 esac
1426 AC_MSG_CHECKING([Kernel tool prefix])
1427 AC_ARG_WITH(kernel-tool-prefix,AC_HELP_STRING([--with-kernel-tool-prefix=...],[Specify crosscompile toolchain prefix for kernel objects]),kernel_tool_prefix="$withval")
1428 AC_MSG_RESULT($kernel_tool_prefix)
1430 # Now process extra architecture-specific options.
1431 # Currently this is implemented only for ARM. We can specify which minimum CPU and FPU to use,\
1432 # as well as floating-point ABI.
1433 case "$aros_target_cpu" in
1434 arm)
1435     dnl ARM defaults are: armv6 + vfp (unless overriden in per-target section above)
1436     if test "$gcc_default_cpu" = ""; then
1437         gcc_default_cpu="armv6"
1438     fi
1439     if test "$gcc_default_fpu" = ""; then
1440         gcc_default_fpu="vfp"
1441     fi
1442     if test "$gcc_default_float_abi" = ""; then
1443         gcc_default_float_abi="softfp"
1444     fi
1446     AC_MSG_CHECKING([Which minimum CPU to use])
1447     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)
1448     AC_MSG_RESULT($aros_gcc_cpu)
1450     AC_MSG_CHECKING([Which minimum FPU to use])
1451     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)
1452     AC_MSG_RESULT($aros_gcc_fpu)
1454     AC_MSG_CHECKING([Which floating point ABI to use])
1455     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)
1456     AC_MSG_RESULT($aros_gcc_float_abi)
1458     aros_config_cflags="$aros_config_cflags -marm -mthumb-interwork -march=$aros_gcc_cpu -mfpu=$aros_gcc_fpu -mfloat-abi=$aros_gcc_float_abi -fno-asynchronous-unwind-tables -fno-exceptions"
1459     aros_config_aflags="$aros_config_aflags -marm -mthumb-interwork -march=$aros_gcc_cpu -mfpu=$aros_gcc_fpu -mfloat-abi=$aros_gcc_float_abi -fno-asynchronous-unwind-tables -fno-exceptions"
1460     ;;
1461 esac
1463 # Some formats need custom ELF specs.
1464 # For example for x86_64 it is needed in order for -m32 switch to work correctly.
1465 if test -f $SRCDIR/config/${aros_object_format}-specs.in; then
1466     elf_specs_in=config/${aros_object_format}-specs.in
1467 else
1468     elf_specs_in=config/elf-specs.in
1471 #-----------------------------------------------------------------------------
1472 AC_MSG_CHECKING([where to install or search for cross tools binaries])
1473 AC_ARG_WITH(crosstools,AC_HELP_STRING([--with-crosstools=DIR],[Where to install or search for cross tools binaries]),with_crosstools=$withval,with_crosstools="default")
1474 if test "$with_crosstools" = "default"; then
1475     AROS_CROSSTOOLSDIR="$AROS_BUILDDIR_UNIX/bin/$aros_host_arch-$aros_host_cpu/tools/crosstools"
1476 else
1477     AROS_CROSSTOOLSDIR="$with_crosstools"
1479 AC_MSG_RESULT($AROS_CROSSTOOLSDIR)
1481 if test "$crosstools" != "no" -o "$with_crosstools" != "default"; then
1483     dnl --with-crosstools with no --enable-crosstools implies --with-aros-gcc with no version specified
1484     dnl The same is about --enable-crosstools
1486     use_aros_gcc=yes
1487     PATH=$AROS_CROSSTOOLSDIR:$PATH
1490 AC_MSG_CHECKING([what specific AROS gcc version to use])
1491 AC_ARG_WITH(aros-gcc,AC_HELP_STRING([--with-aros-gcc=VERSION],[Use aros-gcc-VERSION for building AROS]),aros_gcc_version="$withval",aros_gcc_version="$use_aros_gcc")
1492 case "$aros_gcc_version" in
1493 yes)
1494     aros_gcc_version="default"
1495     ;;
1497     aros_gcc_version="none"
1498     ;;
1499 esac
1500 AC_MSG_RESULT($aros_gcc_version)
1502 if test "$aros_gcc_version" != "none"; then
1504     dnl Here we either build own crosstools, or use preinstalled ones
1505     dnl Check for specific version requested, and append suffix if needed
1507     if test "$aros_gcc_version" != "default"; then
1508         aros_target_cc="${target_tool_prefix}gcc-$aros_gcc_version"
1509         aros_target_cxx="${target_tool_prefix}g++-$aros_gcc_version"
1510     else
1511         aros_target_cc="${target_tool_prefix}gcc"
1512         aros_target_cxx="${target_tool_prefix}g++"
1513     fi
1515     aros_target_cpp="${target_tool_prefix}cpp"
1516     aros_target_ld="${target_tool_prefix}ld"
1517     aros_target_as="${target_tool_prefix}as"
1518     aros_target_ar="${target_tool_prefix}ar"
1519     aros_target_ranlib="${target_tool_prefix}ranlib"
1520     aros_target_nm="${target_tool_prefix}nm"
1521     aros_target_strip="${target_tool_prefix}strip"
1522     aros_target_objcopy="${target_tool_prefix}objcopy"
1523     aros_target_objdump="${target_tool_prefix}objdump"
1525     dnl Check for specific version requested, and append suffix if needed
1527     if test "$aros_gcc_version" != "default"; then
1528         aros_kernel_cc="${kernel_tool_prefix}gcc-$aros_gcc_version"
1529         aros_kernel_cxx="${kernel_tool_prefix}g++-$aros_gcc_version"
1530     else
1531         aros_kernel_cc="${kernel_tool_prefix}gcc"
1532         aros_kernel_cxx="${kernel_tool_prefix}g++"
1533     fi
1535     aros_kernel_cpp="${kernel_tool_prefix}cpp"
1536     aros_kernel_ld="${kernel_tool_prefix}ld"
1537     aros_kernel_as="${kernel_tool_prefix}as"
1538     aros_kernel_ar="${kernel_tool_prefix}ar"
1539     aros_kernel_ranlib="${kernel_tool_prefix}ranlib"
1540     aros_kernel_nm="${kernel_tool_prefix}nm"
1541     aros_kernel_strip="${kernel_tool_prefix}strip"
1542     aros_kernel_objcopy="${kernel_tool_prefix}objcopy"
1543     aros_kernel_objdump="${kernel_tool_prefix}objdump"
1546 # Some compilers (ppc-elf-gcc is known to) have CPU defines in specs
1547 # Since we override specs, we may need to put these defines there
1548 if test "$gcc_target_cpu" != ""; then
1549     gcc_target_cpu="-D__${gcc_target_cpu}__"
1552 AC_MSG_CHECKING([where to download sourcecode for external ports])
1553 AC_ARG_WITH(portssources,AC_HELP_STRING([--with-portssources=DIR],[Where to download sourcecode for external ports]),with_portssrcdir=$withval,with_portssrcdir="default")
1554 if test "$with_portssrcdir" = "default"; then
1555     AROS_PORTSSRCDIR="$AROS_BUILDDIR_UNIX/bin/Sources"
1556 else
1557     AROS_PORTSSRCDIR="$with_portssrcdir"
1559 AC_MSG_RESULT($AROS_PORTSSRCDIR)
1561 AC_MSG_CHECKING([which bootloader to use])
1562 AC_ARG_WITH(bootloader,AC_HELP_STRING([--with-bootloader=NAME],[Use a specific bootloader]),target_bootloader=$withval,target_bootloader=$target_bootloader)
1563 if test "$target_bootloader" = "none"; then
1564     aros_target_bootloader=""
1565 else
1566     aros_target_bootloader="$target_bootloader"
1568 AC_MSG_RESULT($target_bootloader)
1570 AC_MSG_CHECKING([which icon-set to use])
1571 AC_ARG_WITH(iconset,AC_HELP_STRING([--with-iconset=NAME],[Use a specific Icon-set (default=Gorilla).]),target_iconset=$withval,target_iconset="default")
1572 if test "$target_iconset" = "default"; then
1573     aros_target_iconset="Gorilla"
1574     target_iconset="default (Gorilla)"
1575 else
1576     aros_target_iconset="$target_iconset"
1578 AC_MSG_RESULT($target_iconset)
1580 AC_MSG_CHECKING([which GUI Theme to use])
1581 AC_ARG_WITH(theme,AC_HELP_STRING([--with-theme=NAME],[Use a specific GUI Theme]),target_guitheme=$withval,target_guitheme="default")
1582 if test "$target_guitheme" = "default"; then
1583     aros_target_guitheme="Ice"
1584 else
1585     aros_target_guitheme="$target_guitheme"
1587 AC_MSG_RESULT($aros_target_guitheme)
1589 # Find out if we are cross-compiling (i.e. if we can't use the host compiler
1590 # for target code)
1591 cross_compiling=no
1592 if test "$aros_host_cpu" != "$aros_target_cpu" ; then
1593     cross_compiling=yes
1596 dnl Native x86-64 Linux toolchain can also produce i386 binaries, given -m32 flag.
1597 if test "$aros_host_cpu" == "x86_64" ; then
1598     if test "$aros_target_cpu" == "i386" ; then
1599         if test "$aros_target_arch" != "mingw32"; then
1600             cross_compiling=no
1601         fi
1602     fi
1605 dnl Enforce cross-compile if we are on Darwin, but our target is not Darwin.
1606 dnl If target is Darwin disable cross-compiling otherwise kernel 
1607 dnl not setup correctly.
1608 if test "$aros_host_arch" == "darwin" ; then
1609     if test "$aros_target_arch" != "darwin" ; then
1610         cross_compiling=yes
1611     else
1612         cross_compiling=no
1613     fi
1616 dnl The same for MinGW
1617 if test "$aros_host_arch" == "mingw32" ; then
1618     if test "$aros_target_arch" != "mingw32" ; then
1619         cross_compiling=yes
1620     fi
1623 # I want to have this information in configure output, although it might be
1624 # misleading, e.g. for darwin hosted you cannot compile target code without a
1625 # cross compiler, but here it says no.
1627 # Note: it says 'yes' only if bootstrap ("kernel") is cross-compiled.
1628 # Target code is a little bit different thing.
1629 #                                                sonic
1630 echo "checking whether we are (AROS style) cross compiling... $cross_compiling"
1632 # Set prefix for target compiler etc. if we're cross-compiling
1633 # (should possibly be earlier but needs to be after AC_PROG_CC)
1634 if test "$cross_compiling" = "yes" ; then
1636     if test "x-$aros_flavour" = "x-standalone" -o "x-$aros_flavour" = "x-standcompat" ; then
1637         if test "$aros_gcc_version" != "none"; then
1639             dnl If we are cross-compiling a native port with AROS compiler, we can reuse
1640             dnl AROS compiler for bootstrap ("kernel"). This eliminates a need for one more
1641             dnl ELF compiler.
1643             dnl Use target toolchain as bootstrap one.
1644             target_tool_prefix=${target_cpu}-aros-
1645             target_tool_version=$aros_gcc_version
1646             use_kernel_cc_wrapper=yes
1648             dnl Cancel explicit AROS tools assignment. This will cause configure
1649             dnl to select the same tools for bootstrap and AROS.
1650             if test "$crosstools" != yes; then
1651                 aros_target_cc=
1652                 aros_target_ld=
1653                 aros_target_cpp=
1654                 aros_target_as=
1655                 aros_target_ar=
1656                 aros_target_ranlib=
1657                 aros_target_nm=
1658                 aros_target_strip=
1659                 aros_target_objcopy=
1660                 aros_target_objdump=
1661             fi
1662         fi
1663     fi
1665     aros_kernel_cc=${kernel_tool_prefix}gcc
1666     dnl CPP is needed for AC_CHECK_HEADER to work correctly
1667     aros_kernel_cpp=${kernel_tool_prefix}cpp
1668     if test "$kernel_tool_version" != "default"; then
1669         aros_kernel_cc="${aros_kernel_cc}-$kernel_tool_version"
1670         aros_kernel_cpp="${aros_kernel_cpp}-$kernel_tool_version"
1671     fi
1673 AROS_TOOL_KERNEL(aros_kernel_cpp,cpp,$aros_kernel_cpp)
1674 AROS_REQUIRED(cpp,$aros_kernel_cpp)
1675 AROS_TOOL_KERNEL(aros_kernel_cc,gcc,$aros_kernel_cc)
1676 AROS_REQUIRED(cc,$aros_kernel_cc)
1677 CC="$aros_kernel_cc $kernel_tool_flags"
1678 CPP="$aros_kernel_cpp"
1680 #-----------------------------------------------------------------------------
1682 # Disable pointer-signedness warnings if the compiler recognises the option
1684 AC_MSG_CHECKING([whether ${CC} accepts -Wno-pointer-sign])
1685 save_cflags="$CFLAGS"
1686 if test "$crosstools" != "yes" ; then
1687     CFLAGS="$CFLAGS -Wno-pointer-sign"
1688     AC_TRY_COMPILE(,, use_no_sign_warning="yes", use_no_sign_warning="no")
1689 else
1690     # we do know it is supported for the smallest version of gcc we are going to build
1691     # we assume it's also supported by later versions
1692     use_no_sign_warning=yes
1694 AC_MSG_RESULT($use_no_sign_warning)
1695 if test "x-$use_no_sign_warning" = "x-yes" ; then
1696     aros_config_cflags="$aros_config_cflags -Wno-pointer-sign"
1698 CFLAGS="$save_cflags"
1700 #-----------------------------------------------------------------------------
1702 # Find all the tools we need to compile. This could be cross-compiling
1703 # though! If that is the case we use the GNU form of the target and
1704 # simply add this to the front of the binary name. This is rather simple,
1705 # but it should work under most circumstances.
1707 # The default tools are to use the same as the host, but only if the
1708 # host and target CPU are the same. With GCC this is normally enough.
1711 aros_cc_pre=""
1712 aros_shared_ld="$aros_host_ld"
1714 aros_target_mkdep="$aros_host_mkdep"
1716 # The default tools executables to be linked to.
1717 if test "$rescomp" != ""; then
1718     AROS_TOOL_KERNEL(aros_kernel_rescomp,$rescomp)
1719     AROS_REQUIRED($rescomp,$aros_kernel_rescomp)
1722 if test "$crosstools" != "yes"; then
1724     dnl For non-ELF hosts we additionally have to look up ELF toolchain for AROS binaries
1725     dnl It can be either AROS toolchain selected earlier or generic ELF toolchain we select here.
1726     dnl This catches also Android-hosted case. Android gcc is a ELF compiler, but it can't be used
1727     dnl to build AROS binaries, at least on ARM. Android EABI is different from AROS EABI
1728     dnl (at least enum size is known to be different).
1729     if test "$target_tool_prefix" != "${target_cpu}-elf-" -a "$target_tool_prefix" != "${target_cpu}-aros-" ; then
1730         target_tool_prefix=${target_cpu}-elf-
1731         if test "$aros_target_cc" == ""; then
1732            aros_target_cc="${target_tool_prefix}gcc"
1733         fi
1734         if test "$aros_target_ld" == ""; then
1735            aros_target_ld="${target_tool_prefix}ld"
1736         fi
1737         if test "$aros_target_cpp" == ""; then
1738            aros_target_cpp="${target_tool_prefix}cpp"
1739         fi
1740     fi
1741     AROS_TOOL_TARGET(aros_target_as_ln,as,$aros_target_as)
1742     AROS_REQUIRED(as,$aros_target_as_ln)
1743     AROS_TOOL_TARGET(aros_target_ar_ln,ar,$aros_target_ar)
1744     AROS_REQUIRED(ar,$aros_target_ar_ln)
1745     AROS_TOOL_TARGET(aros_target_nm_ln,nm,$aros_target_nm)
1746     AROS_REQUIRED(nm,$aros_target_nm_ln)
1747     AROS_TOOL_TARGET(aros_target_objcopy_ln,objcopy,$aros_target_objcopy)
1748     AROS_REQUIRED(objcopy,$aros_target_objcopy_ln)
1749     AROS_TOOL_TARGET(aros_target_objdump_ln,objdump,$aros_target_objdump)
1750     AROS_REQUIRED(objdump,$aros_target_objdump_ln)
1751     AROS_TOOL_TARGET(aros_target_ranlib_ln,ranlib,$aros_target_ranlib)
1752     AROS_REQUIRED(ranlib,$aros_target_ranlib_ln)
1753     AROS_TOOL_TARGET(aros_target_strip_ln,strip,$aros_target_strip)
1754     AROS_REQUIRED(strip,$aros_target_strip_ln)
1755     if test "$aros_target_cxx" != ""; then
1756         AC_PATH_PROG(aros_target_cxx,$aros_target_cxx)
1757         AROS_REQUIRED(c++,$aros_target_cxx)
1758     fi
1759 else
1760     aros_target_cc=$AROS_CROSSTOOLSDIR/$aros_target_cc
1761     aros_target_cxx=$AROS_CROSSTOOLSDIR/$aros_target_cxx
1762     aros_target_cpp=$AROS_CROSSTOOLSDIR/$aros_target_cpp
1763     aros_target_as_ln=$AROS_CROSSTOOLSDIR/$aros_target_as
1764     aros_target_ar_ln=$AROS_CROSSTOOLSDIR/$aros_target_ar
1765     aros_target_nm_ln=$AROS_CROSSTOOLSDIR/$aros_target_nm
1766     aros_target_objcopy_ln=$AROS_CROSSTOOLSDIR/$aros_target_objcopy
1767     aros_target_objdump_ln=$AROS_CROSSTOOLSDIR/$aros_target_objdump
1768     aros_target_ranlib_ln=$AROS_CROSSTOOLSDIR/$aros_target_ranlib
1769     aros_target_strip_ln=$AROS_CROSSTOOLSDIR/$aros_target_strip
1771     crosstools_target=tools-crosstools
1774 AROS_TOOL_TARGET(aros_kernel_cpp,cpp,$aros_kernel_cpp)
1775 AROS_REQUIRED(cpp,$aros_kernel_cpp)
1776 AROS_TOOL_TARGET(aros_kernel_ld,ld,$aros_kernel_ld)
1777 AROS_REQUIRED(ld,$aros_kernel_ld)
1778 AROS_TOOL_TARGET(aros_kernel_ar,ar,$aros_kernel_ar)
1779 AROS_REQUIRED(ld,$aros_kernel_ar)
1780 AROS_TOOL_TARGET(aros_kernel_ranlib,ranlib,$aros_kernel_ranlib)
1781 AROS_REQUIRED(ld,$aros_kernel_ranlib)
1783 aros_kernel_cc="$aros_kernel_cc $kernel_tool_flags"
1784 aros_kernel_ar="$aros_kernel_ar $aros_kernel_ar_flags"
1786 orig_target_cpp=$aros_kernel_cpp
1787 orig_target_cc=$aros_kernel_cc
1788 orig_target_ld=$aros_kernel_ld
1790 if test "$crosstools" != "yes"; then
1791     if test "$aros_target_cc" != ""; then
1792         AC_PATH_PROG(aros_target_cc,$aros_target_cc)
1793         AROS_REQUIRED(gcc,$aros_target_cc)
1794         orig_target_cc=$aros_target_cc
1795     fi
1796     if test "$aros_target_ld" != ""; then
1797         AC_PATH_PROG(aros_target_ld,$aros_target_ld)
1798         AROS_REQUIRED(ld,$aros_target_ld)
1799         orig_target_ld=$aros_target_ld
1800     fi
1801     if test "$aros_target_cpp" != ""; then
1802         AC_PATH_PROG(aros_target_cpp,$aros_target_cpp)
1803         AROS_REQUIRED(cpp,$aros_target_cpp)
1804         orig_target_cpp=$aros_target_cpp
1805     fi
1806 else
1807     orig_target_cc=$aros_target_cc
1808     orig_target_ld=$aros_target_ld
1809     orig_target_cpp=$aros_target_cpp
1812 # Build crosstools if we have no C++ - temporary thing 
1813 if test "$aros_target_cxx" = "" -a "$crosstools" != "yes"; then
1814     crosstools_cxx_target=tools-crosstools
1817 aros_hostcfg_dir="bin/${aros_host_arch}-${aros_host_cpu}/gen/config"
1818 aros_targetcfg_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/config"
1819 aros_inc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/AROS/Development/include/aros"
1820 aros_gendir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen"
1821 aros_geninc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/include/aros"
1822 aros_tools_dir="bin/${aros_host_arch}-${aros_host_cpu}/tools"
1823 aros_scripts_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/scripts"
1825 # aros_cc_pre is a variable that is added to the front of the compiler name
1826 # in the generated aros-gcc shell script. We need this to enable the cache
1827 # to work across cleaned builds. Also, support DISTCC using the correct
1828 # environment variable.
1831 if test "x${DISTCC}" != "x" ; then
1832     if test "x${CCACHE}" != "x" ; then
1833         aros_cc_pre="env CCACHE_PREFIX=${DISTCC} ${CCACHE} "
1834     else
1835         aros_cc_pre="${DISTCC} "
1836     fi
1837 else
1838     if test "x${CCACHE}" != "x" ; then
1839         aros_cc_pre="${CCACHE} "
1840     fi
1843 prefix="${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros"
1845 AC_SUBST(aros_target_nostdinc_cflags,-nostdinc)
1846 AC_SUBST(aros_target_nostartup_ldflags,-nostartfiles)
1847 AC_SUBST(aros_target_nix_ldflags,-nix)
1848 AC_SUBST(aros_target_detach_ldflags,-detach)
1849 AC_SUBST(aros_target_nostdlib_ldflags,-nostdlib)
1851 # Target tools
1852 if test "$crosstools" != "yes"; then
1853     if test "$GCC" = "yes"; then
1854         aros_target_cc_path=`$orig_target_cc -print-search-dirs | grep "programs: =" | cut -c 12-`
1855     fi
1856 else
1857     # We do not know which gcc version we are going to build and what we need to know
1858     # here is different for different versions so this will be set later during the
1859     # build of crosstools.
1860     aros_target_cc_path=@aros_target_cc_path@
1862 aros_target_cpp="${prefix}-cpp"
1863 aros_target_cc="${prefix}-gcc"
1864 aros_target_as="${prefix}-as"
1865 aros_target_ld="${prefix}-ld"
1866 aros_target_ar="${prefix}-ar $aros_target_ar_flags"
1867 aros_target_objcopy=${prefix}-objcopy
1868 aros_target_objdump=${prefix}-objdump
1869 aros_target_ranlib="${prefix}-ranlib $aros_target_ranlib_flags"
1870 aros_target_nm="${prefix}-nm $aros_target_nm_flags"
1871 aros_target_strip=${prefix}-strip
1872 aros_plain_nm="${prefix}-nm"
1873 aros_plain_ar="${prefix}-ar"
1875 if test "$aros_kernel_includes" != "" ; then
1876     dnl find out about the kernel cc's include path
1877     AC_MSG_CHECKING([for the kernel compiler's include path])
1878     if test "$aros_kernel_cc_includes" = "" ; then
1879         # Try to guess where the directory is.
1880         aros_kernel_cc_includes=`dirname \`${aros_kernel_cc} ${aros_kernel_cflags} -print-libgcc-file-name\``/include
1881         if test -d $aros_kernel_cc_includes; then
1882             # Check if there is also an include-fixed directory and add it
1883             # to kernel compiler's include path as it may contain some of
1884             # the headers we need.
1885             if test -d "$aros_kernel_cc_includes"-fixed; then
1886                 aros_kernel_cc_includes+=" -isystem $aros_kernel_cc_includes"-fixed
1887             fi
1888             # Check for specific includes directory. Neede for Ubuntu 11.10
1889             if test -d "/usr/include/i386-linux-gnu"; then
1890                 aros_kernel_cc_includes+=" -isystem /usr/include/i386-linux-gnu"
1891             fi
1892         else
1893             # The directory doesn't exist, we need to do some more work.
1894             aros_kernel_cc_includes=${PWD}/${aros_gendir}/cc_include
1896             # These are the headers we're looking for.
1897             headers="limits.h mmintrin.h stdbool.h syslimits.h float.h \
1898                      stddef.h xmmintrin.h iso646.h stdarg.h unwind.h   \
1899                      zutil.h stdint.h"
1901             dirs=
1902             for h in $headers; do
1903                 # Which other headers are needed by each of the above?
1904                 deps=$(echo "#include <$h>" | \
1905                        $aros_kernel_cc -E -M - 2>/dev/null | \
1906                        sed 's/^.*://; s/\\$/ /g; s/[[ \t]]\+/ /g')
1908                 # Copy all the needed headers to a directory beneath gendir.
1909                 for d in $deps; do
1910                     h=$(basename $d)
1911                     dir=${aros_kernel_cc_includes}$(echo $(dirname $d) | \
1912                                                 sed -n "s,^.*/include\(/.*\),\1,p")
1913                     ! test -d $dir && mkdir -p $dir
1914                     ! test -f $dir/$h && { cp $d $dir; chmod u+w $dir/$h; }
1915                 done
1916             done            
1917         fi
1918     fi
1919     AC_MSG_RESULT($aros_kernel_cc_includes)
1920     # Adding -nostdinc to kernel includes as they are always used together.
1921     aros_kernel_includes="$aros_kernel_includes $aros_target_nostdinc_cflags -isystem $aros_kernel_cc_includes"
1924 if test "$crosstools" != "yes"; then
1925     dnl find out about the target cc's include path
1926     AC_MSG_CHECKING([for the target compiler's include path])
1927     if test "$aros_target_cc_includes" = "" ; then
1928         #try to guess where the directory is
1929         aros_target_cc_includes=`dirname \`${orig_target_cc} -print-libgcc-file-name\``/include
1930         if ! test -d $aros_target_cc_includes; then
1931             #the directory doesn't exist, we need to do some more work
1932             aros_target_cc_includes=${PWD}/${aros_gendir}/cc_include
1933         
1934             #these are the headers we're looking for
1935             headers="limits.h mmintrin.h stdbool.h syslimits.h float.h \
1936                     stddef.h xmmintrin.h iso646.h stdarg.h unwind.h   \
1937                     zutil.h"
1939             dirs=
1940             for h in $headers; do
1941                 #which other headers each of the above headers needs?
1942                 deps=$(echo "#include <$h>" | \
1943                     $orig_target_cc -E -M - 2>/dev/null | \
1944                     sed 's/^.*://; s/\\$/ /g; s/[[ \t]]\+/ /g')
1945             
1946                 #copy all the needed headers to a directory beneath gendir
1947                 for d in $deps; do
1948                     h=$(basename $d)
1949                     dir=${aros_target_cc_includes}$(echo $(dirname $d) | \
1950                                                 sed -n "s,^.*/include\(/.*\),\1,p")
1951                     ! test -d $dir && mkdir -p $dir
1952                     ! test -f $dir/$h && { cp $d $dir; chmod u+w $dir/$h; }
1953                 done
1954             done
1955         fi
1956     fi
1957     AC_MSG_RESULT($aros_target_cc_includes)
1958 else
1959     # We do not know which gcc version we are going to build and what we need to know
1960     # here is different for different versions so this will be set later during the
1961     # build of crosstools.
1962     aros_target_cc_includes=@aros_target_cc_includes@
1966 # For GCC < 4.0 -I- is used for giving the search path for '#include "..."'
1967 # On GCC >= 4.0 -iquote should be used
1970 save_cc="$CC"
1971 save_cflags="$CFLAGS"
1972 CFLAGS="-iquote."
1973 AC_MSG_CHECKING([whether ${CC} accepts -iquote])
1974 if test "x-$crosstools" != "x-yes"; then
1975     AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
1976 else
1977     # we do know it is supported for the smallest version of gcc we are going to build
1978     # we assume it's also supported by later versions
1979     has_iquote=yes
1981 AC_MSG_RESULT($has_iquote)
1982 if test "x-$has_iquote" = "x-yes" ; then
1983     host_cflags_iquote=-iquote
1984     host_cflags_iquote_end=
1985 else
1986     host_cflags_iquote=-I
1987     host_cflags_iquote_end=-I-
1989 kernel_cflags_iquote=$host_cflags_iquote
1990 kernel_cflags_iquote_end=$host_cflags_iquote_end
1991 if test "x-$cross_compiling" = "x-yes"; then
1992     CC="$aros_kernel_cc"
1993     AC_MSG_CHECKING([whether ${CC} accepts -fno-stack-protector])
1994     if test "x-$crosstools" != "x-yes"; then
1995         AC_TRY_COMPILE(,, use_no_stack_protector="yes", use_no_stack_protector="no")
1996     else
1997         # we do know it is supported for the smallest version of gcc we are going to build
1998         # we assume it's also supported by later versions
1999         use_no_stack_protector=yes
2000     fi
2001     AC_MSG_RESULT($use_no_stack_protector)
2002     AC_MSG_CHECKING([whether ${CC} accepts -iquote])
2003     if test "x-$crosstools" != "x-yes"; then
2004         AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
2005     else
2006         # we do know it is supported for the smallest version of gcc we are going to build
2007         # we assume it's also supported by later versions
2008         has_iquote=yes
2009     fi
2010     AC_MSG_RESULT($has_iquote)
2011     if test "x-$has_iquote" = "x-yes" ; then
2012         kernel_cflags_iquote=-iquote
2013         kernel_cflags_iquote_end=
2014     else
2015         kernel_cflags_iquote=-I
2016         kernel_cflags_iquote_end=-I-
2017     fi
2019 aros_cflags_iquote=$kernel_cflags_iquote
2020 aros_cflags_iquote_end=$kernel_cflags_iquote_end
2021 if test "$orig_target_cc" != "$aros_kernel_cc"; then
2022     CC="$orig_target_cc"
2023     AC_MSG_CHECKING([whether ${CC} accepts -iquote])
2024     if test "x-$crosstools" != "x-yes"; then
2025         AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
2026     else
2027         # we do know it is supported for the smallest version of gcc we are going to build
2028         # we assume it's also supported by later versions
2029         has_iquote=yes
2030     fi
2031     AC_MSG_RESULT($has_iquote)
2032     if test "x-$has_iquote" = "x-yes" ; then
2033         aros_cflags_iquote=-iquote
2034         aros_cflags_iquote_end=
2035     else
2036         aros_cflags_iquote=-I
2037         aros_cflags_iquote_end=-I-
2038     fi
2040 if test "x-$use_no_stack_protector" = "x-yes" ; then
2041     aros_kernel_cflags="$aros_kernel_cflags -fno-stack-protector"
2045 #-----------------------------------------------------------------------------
2047 # Check if the target compiler supports some options used for delinting:
2048 #  -Wunused-but-set-variable
2049 #  -Warray-bounds
2050 #  -Wenum-compare
2051 #  -Wstrict-overflow
2052 #  -Wformat-security
2054 if test "x-$crosstools" != "x-yes"; then
2055     if test "$orig_target_cc" != "$aros_kernel_cc"; then
2056         CC="$orig_target_cc"
2057     fi
2058     AC_MSG_CHECKING([whether ${CC} accepts -Wunused-but-set-variable])
2059     CFLAGS=-Wunused-but-set-variable
2060     AC_TRY_COMPILE(,, aros_unused_but_set_variable="yes", aros_unused_but_set_variable="no")
2061     AC_MSG_RESULT($aros_unused_but_set_variable)
2062     if test "x-$aros_unused_but_set_variable" = "x-yes" ; then
2063         aros_cflags_unused_but_set_variable=-Wno-unused-but-set-variable
2064     fi
2066     AC_MSG_CHECKING([whether ${CC} accepts -Warray-bounds])
2067     CFLAGS=-Warray-bounds
2068     AC_TRY_COMPILE(,, aros_array_bounds="yes", aros_array_bounds="no")
2069     AC_MSG_RESULT($aros_array_bounds)
2070     if test "x-$aros_array_bounds" = "x-yes" ; then
2071         aros_cflags_array_bounds=-Wno-array-bounds
2072     fi
2074     AC_MSG_CHECKING([whether ${CC} accepts -Wenum-compare])
2075     CFLAGS=-Wenum-compare
2076     AC_TRY_COMPILE(,, aros_enum_compare="yes", aros_enum_compare="no")
2077     AC_MSG_RESULT($aros_enum_compare)
2078     if test "x-$aros_enum_compare" = "x-yes" ; then
2079         aros_cflags_enum_compare=-Wno-enum-compare
2080     fi
2082     AC_MSG_CHECKING([whether ${CC} accepts -Wstrict-overflow])
2083     CFLAGS=-Wstrict-overflow
2084     AC_TRY_COMPILE(,, aros_strict_overflow="yes", aros_strict_overflow="no")
2085     AC_MSG_RESULT($aros_strict_overflow)
2086     if test "x-$aros_strict_overflow" = "x-yes" ; then
2087         aros_cflags_strict_overflow=-Wno-strict-overflow
2088     fi
2090     AC_MSG_CHECKING([whether ${CC} accepts -Wformat-security])
2091     CFLAGS=-Wformat-security
2092     AC_TRY_COMPILE(,, aros_format_security="yes", aros_format_security="no")
2093     AC_MSG_RESULT($aros_format_security)
2094     if test "x-$aros_format_security" = "x-yes" ; then
2095         aros_cflags_format_security=-Wno-format-security
2096     fi
2097 else
2098     # We do not know which gcc version we are going to build and what we need to know
2099     # here is different for different versions so this will be set later during the
2100     # build of crosstools.
2101     aros_cflags_unused_but_set_variable=@aros_cflags_unused_but_set_variable@
2102     aros_cflags_array_bounds=@aros_cflags_array_bounds@
2103     aros_cflags_enum_compare=@aros_cflags_enum_compare@
2104     aros_cflags_strict_overflow=@aros_cflags_strict_overflow@
2105     aros_cflags_format_security=@aros_cflags_format_security@
2108 #-----------------------------------------------------------------------------
2110 # Check if we can explicitly choose older version of symbol hashing
2112 CFLAGS="save_cflags -Wl,--hash-style=sysv"
2113 CC="$aros_kernel_cc"
2114 AC_MSG_CHECKING([whether ${CC} accepts -Wl,--hash-style=sysv])
2115 AC_TRY_LINK(,, use_hash_style="yes", use_hash_style="no")
2116 AC_MSG_RESULT($use_hash_style)
2117 if test "x-$use_hash_style" = "x-yes" ; then
2118     aros_kernel_cflags="$aros_kernel_cflags -Wl,--hash-style=sysv"
2120 CC="$save_cc"
2121 CFLAGS="$save_cflags"
2123 AC_SUBST(host_cflags_iquote)
2124 AC_SUBST(host_cflags_iquote_end)
2125 AC_SUBST(kernel_cflags_iquote)
2126 AC_SUBST(kernel_cflags_iquote_end)
2127 AC_SUBST(aros_cflags_iquote)
2128 AC_SUBST(aros_cflags_iquote_end)
2131 dnl Check if user specified --with-resolution=XRESxYRESxDEPTH
2132 AC_MSG_CHECKING([for default resolution of WBScreen])
2133 AC_ARG_WITH(resolution,AC_HELP_STRING([--with-resolution=XRESxYRESxDEPTH],[Default resolution of the initial WorkbenchScreen]),resolution=$withval,resolution=none)
2134 # We require an argument, so map --with/--without ("yes"/"no") to "none" specified
2135 if test "$resolution" = "yes" ; then
2136     resolution="none"
2138 if test "$resolution" = "no" ; then
2139     resolution="none"
2141 if test "$resolution" != "none" ; then
2142     aros_default_wbwidth=`echo $resolution | cut -d'x' -f1`
2143     aros_default_wbheight=`echo $resolution | cut -d'x' -f2`
2144     aros_default_wbdepth=`echo $resolution | cut -d'x' -f3`
2146 AC_MSG_RESULT($aros_default_wbwidth x $aros_default_wbheight x $aros_default_wbdepth)
2147 aros_cv_default_wbwidth=$aros_default_wbwidth
2148 aros_cv_default_wbheight=$aros_default_wbheight
2149 aros_cv_default_wbdepth=$aros_default_wbdepth
2151 dnl See if the user wants the serial debug output for native flavour
2152 AC_MSG_CHECKING([if serial debug is enabled])
2153 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)
2154 if test "$aros_serial_debug" = 0 ; then
2155     serial_debug_forced=""
2156     if test "$serial_debug" = "yes" ; then
2157         serial_debug="1"
2158     fi
2159     if test "$serial_debug" = "no" ; then
2160         serial_debug="none"
2161     fi
2162 else
2163     serial_debug_forced="(forced)"
2164     serial_debug=$aros_serial_debug
2166 if test "$serial_debug" != "none" ; then
2167     aros_serial_debug=$serial_debug
2168     AC_MSG_RESULT($serial_debug_forced on port $serial_debug)
2169 else
2170     AC_MSG_RESULT(no)
2173 dnl See if the user wants the palm debug output hack for palm native flavour
2174 AC_MSG_CHECKING([if palm debug hack is enabled])
2175 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")
2176 if test "$palm_debug_hack" = "yes" ; then
2177     aros_palm_debug_hack="1"
2179 AC_MSG_RESULT($palm_debug_hack)
2181 dnl See if the user wants the usb3.0 code
2182 AC_MSG_CHECKING([if usb3.0 code is enabled])
2183 AC_ARG_ENABLE(usb30_code,AC_HELP_STRING([--enable-usb30-code],[Enable usb3.0 code (default=no)]),usb30_code="yes",usb30_code="no")
2184 if test "$usb30_code" = "yes" ; then
2185     aros_config_cflags="$aros_config_cflags -DAROS_USB30_CODE"
2186     aros_kernel_cflags="$aros_kernel_cflags -DAROS_USB30_CODE"
2188 AC_MSG_RESULT($usb30_code)
2190 dnl See if the user wants nesting supervisor activated for unix flavour
2191 AC_MSG_CHECKING([if nesting supervisor support is enabled])
2192 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")
2193 if test "$nesting_supervisor" = "yes" ; then
2194     aros_nesting_supervisor="1"
2196 AC_MSG_RESULT($nesting_supervisor)
2198 dnl See if the user wants to disable MMU support
2199 dnl This can be overriden on per-target basis,
2200 dnl set $aros_enable_mmu to "yes" or "no" to do this
2201 if test "$aros_enable_mmu" = "" ; then
2202     AC_MSG_CHECKING([if MMU support is enabled])
2203     dnl Enabled by default
2204     AC_ARG_ENABLE(mmu,AC_HELP_STRING([--disable-mmu],[Disable MMU support (default=enabled)]),aros_enable_mmu=$enableval,aros_enable_mmu="yes")
2205     if test "$aros_enable_mmu" = "" ; then
2206         aros_enable_mmu="yes"
2207     fi
2208     AC_MSG_RESULT($aros_enable_mmu)
2210 if test "$aros_enable_mmu" = "no" ; then
2211     aros_enable_mmu="0"
2212 else
2213     aros_enable_mmu="1"
2215     
2217 dnl things specifically required for hosted flavours
2218 if test "x-$aros_flavour" = "x-emulation" -o "x-$aros_flavour" = "x-emulcompat" ; then
2220     if test "x-$need_dlopen" != "x-no" ; then
2221       dnl some kind of dynamic library access system is required for hostlib.resource
2222       AC_CHECK_FUNC(dlopen, have_dl="yes", have_dl="no")
2223       if test "x-$have_dl" = "x-no" ; then
2224           AC_CHECK_LIB(dl, dlopen, [have_dl="yes"
2225                                     aros_host_ldflags="$aros_host_ldflags -ldl"],
2226                                     have_dl="no")
2227       fi
2228       if test "x-$have_dl" = "x-no" ; then
2229           AC_MSG_ERROR([dlopen() dynamic linker functions not available])
2230       fi
2231     fi
2234     dnl x11 hidd
2235     AC_ARG_ENABLE(x11_hidd, AC_HELP_STRING([--enable-x11-hidd],
2236                                            [build X11 hidd for hosted (default=auto)]),
2237                                            x11_hidd="$enableval",
2238                                            x11_hidd="$need_x11")
2239     case "x-$x11_hidd" in
2240         x-yes|x-no|x-auto)                 ;;
2241         *)                 x11_hidd="$need_x11" ;;
2242     esac
2244     ENABLE_X11=0
2246     dnl they want it
2247     if test "x-$x11_hidd" != "x-no" ; then
2249         dnl find x11 stuff
2250         AC_PATH_X
2252         x_cflags=
2253         for path in $x_libraries
2254         do
2255             x_cflags="$x_cflags -L$path"
2256         done
2258         for path in $x_includes
2259         do
2260             x_cflags="$x_cflags -I$path"
2261         done
2262         
2263         if test "x-$no_x" = "x-yes" ; then
2265             dnl didn't find it
2266             if test "x-$x11_hidd" != "x-auto" ; then
2267                 dnl and they explicitly asked for it, bail out
2268                 AC_MSG_ERROR([X11 libs/headers not found, cannot build X11 hidd as requested])
2269             fi
2270         
2271         else
2272             dnl found it, setup the metatarget
2273             x11_hidd_target=kernel-x11gfx-kobj
2274             ENABLE_X11=1
2276             dnl setup shared memory extensions
2277             AC_ARG_ENABLE(x11_shm, AC_HELP_STRING([--enable-x11-shm],
2278                                                   [use X11 shared memory (default=auto)]),
2279                                                   x11_hidd_shm="$enableval",
2280                                                   x11_hidd_shm="auto")
2281             case "x-$x11_hidd_shm" in
2282                 x-yes|x-no|x-auto)                     ;;
2283                 *)                 x11_hidd_shm="auto" ;;
2284             esac
2286             have_xshm=no
2288             dnl they want it
2289             if test "x-$x11_hidd_shm" != "x-no" ; then
2291                 dnl system shm headers
2292                 AC_CHECK_HEADERS(sys/ipc.h)
2293                 AC_CHECK_HEADERS(sys/shm.h)
2295                 dnl got them
2296                 if test "x-$ac_cv_header_sys_ipc_h" = "x-yes" -a "x-$ac_cv_header_sys_shm_h" = "x-yes" ; then
2298                     dnl make sure X libs have shm functions
2299                     save_cflags="$CFLAGS"
2300                     CFLAGS="$CFLAGS $x_cflags"
2301                     AC_CHECK_LIB(Xext, XShmQueryExtension, have_xshm=yes)
2302                     CFLAGS="$save_cflags"
2303                 fi
2304             fi
2306             dnl detection done, prepare output
2307             if test "x-$have_xshm" = "x-yes" ; then
2308                 dnl we can do shm
2309                 DO_XSHM_SUPPORT="1"
2310             elif test "x-$x11_hidd_shm" = "x-yes" ; then
2311                 dnl they explicitly asked for it, but we can't do it
2312                 AC_MSG_ERROR([X11 has no support for shared memory, cannot enable it as requested])
2313             else
2314                 dnl otherwise just disable it
2315                 DO_XSHM_SUPPORT="0"
2316             fi
2318             
2319             dnl setup vidmode (fullscreen) extensions
2320             AC_ARG_ENABLE(x11_vidmode, AC_HELP_STRING([--enable-x11-vidmode],
2321                                                       [use X11 vidmode extension (default=auto)]),
2322                                                       x11_hidd_vidmode="$enableval",
2323                                                       x11_hidd_vidmode="auto")
2324             case "x-$x11_hidd_vidmode" in
2325                 x-yes|x-no|x-auto)                         ;;
2326                 *)                 x11_hidd_vidmode="auto" ;;
2327             esac
2329             have_vidmode=no
2331             dnl they want it
2332             if test "x-$x11_hidd_vidmode" != "x-no" ; then
2334                 dnl make sure X libs have vidmode functions
2335                 save_cflags="$CFLAGS"
2336                 CFLAGS="$CFLAGS $x_cflags"
2337                 AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryExtension, have_vidmode=yes)
2338                 CFLAGS="$save_cflags"
2339             fi
2341             dnl detection done, prepare output
2342             if test "x-$have_vidmode" = "x-yes" ; then
2343                 dnl we can do vidmode
2344                 DO_VIDMODE_SUPPORT="1"
2345             elif test "x-$x11_hidd_vidmode" = "x-yes" ; then
2346                 dnl they explicitly asked for it, but we can't do it
2347                 AC_MSG_ERROR([X11 vidmode extension not available, cannot enable it as requested])
2348             else
2349                 dnl otherwise just disable it
2350                 DO_VIDMODE_SUPPORT="0"
2351             fi
2352         fi
2354         aros_host_x11_includes=$x_includes 
2355         aros_host_x11_libdirs=$x_libraries
2356     fi
2359     dnl sdl hidd
2360     AC_ARG_ENABLE(sdl_hidd, AC_HELP_STRING([--enable-sdl-hidd],
2361                                            [build SDL hidd for hosted (default=auto)]),
2362                                            sdl_hidd="$enableval",
2363                                            sdl_hidd="auto")
2364     case "x-$sdl_hidd" in
2365         x-yes|x-no|x-auto)                 ;;
2366         *)                 sdl_hidd="auto" ;;
2367     esac
2369     dnl they want it
2370     if test "x-$sdl_hidd" != "x-no" ; then
2372         dnl find sdl
2373         AM_PATH_SDL([1.2.10], have_sdl="yes", have_sdl="no")
2375         if test "x-$have_sdl" != "x-yes" ; then
2377             dnl didn't find it
2378             if test "x-$sdl_hidd" != "x-auto" ; then
2379                 dnl and they explicitly asked for it, bail out
2380                 AC_MSG_ERROR([SDL libs/headers not found, cannot build SDL hidd as requested])
2381             fi
2383         else
2384             dnl found it, set up the metatarget
2385             sdl_hidd_target=kernel-hidd-sdl
2386             aros_host_sdl_cflags=SDL_CFLAGS
2387             aros_host_sdl_libs=SDL_LIBS
2388         fi
2389     fi
2391     dnl oss.library
2392     AC_CHECK_HEADER(sys/soundcard.h)
2393     if test "x-$ac_cv_header_sys_soundcard_h" = "x-yes" ; then
2394         oss_library_target=workbench-libs-oss-unix
2395     fi
2399 dnl See if the user wants dbus.library
2400 AC_MSG_CHECKING([if building of dbus.library is enabled])
2401 AC_ARG_ENABLE(dbus,AC_HELP_STRING([--enable-dbus],[Enable DBUS support via dbus.library (default=no)]),dbus="yes",dbus="no")
2402 if test "$dbus" = "yes" ; then
2403     ENABLE_DBUS=1
2404     DBUS_CFLAGS=`pkg-config --cflags dbus-1`
2405     DBUS_LIBFLAGS=`pkg-config --libs dbus-1`
2406     KERNEL_DBUS_KOBJ=kernel-dbus-kobj
2407     KERNEL_DBUS_INCLUDES=kernel-dbus-includes
2408 else
2409     ENABLE_DBUS=0
2411 AC_MSG_RESULT($dbus)
2413 if test "$use_kernel_cc_wrapper" = "yes" ; then
2414     aros_kernel_cc="${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-elf-gcc"
2417 dnl --------------------------------------------------------------------
2418 dnl Configuration Output Section
2419 dnl --------------------------------------------------------------------
2421 # Generic
2422 AC_SUBST(aros_arch)
2423 AC_SUBST(aros_cpu)
2424 AC_SUBST(aros_flavour)
2425 AC_SUBST(aros_flavour_uc)
2426 AC_SUBST(AROS_BUILDDIR)
2427 AC_SUBST(AROS_BUILDDIR_UNIX)
2428 AC_SUBST(SRCDIR)
2429 AC_SUBST(AROS_CROSSTOOLSDIR)
2430 AC_SUBST(AROS_PORTSSRCDIR)
2432 # Compatability with other Amiga-like operation systems
2433 AC_SUBST(aros_amigaos_compliance)
2435 # Host related
2436 AC_SUBST(aros_cc_pre)
2437 AC_SUBST(aros_host_strip)
2438 AC_SUBST(aros_host_arch)
2439 AC_SUBST(aros_host_cpu)
2440 AC_SUBST(aros_host_cpp)
2441 AC_SUBST(aros_host_cc)
2442 AC_SUBST(aros_host_ar)
2443 AC_SUBST(aros_host_ranlib)
2444 AC_SUBST(aros_host_ld)
2445 AC_SUBST(aros_host_make)
2446 AC_SUBST(aros_host_cflags)
2447 AC_SUBST(gnu89_inline)
2448 AC_SUBST(aros_host_ldflags)
2449 AC_SUBST(aros_host_debug)
2450 AC_SUBST(aros_host_mkdep)
2451 AC_SUBST(aros_host_mkargs)
2452 AC_SUBST(aros_host_exe_suffix)
2453 AC_SUBST(aros_host_lib_suffix)
2454 AC_SUBST(aros_tools_dir)
2455 AC_SUBST(aros_host_aclocal)
2456 AC_SUBST(aros_host_autoconf)
2457 AC_SUBST(aros_host_autoheader)
2458 AC_SUBST(aros_host_automake)
2459 AC_SUBST(ant)
2461 # Target Related
2462 AC_SUBST(aros_target_guitheme)
2463 AC_SUBST(aros_target_iconset)
2464 AC_SUBST(aros_target_bootloader)
2465 AC_SUBST(aros_target_arch)
2466 AC_SUBST(aros_target_family)
2467 AC_SUBST(aros_target_cpu)
2468 AC_SUBST(aros_target_variant)
2469 AC_SUBST(aros_target_suffix)
2470 AC_SUBST(aros_target_ar)
2471 AC_SUBST(aros_target_ranlib)
2472 AC_SUBST(aros_plain_nm)
2473 AC_SUBST(aros_plain_ar)
2474 AC_SUBST(aros_kernel_ar)
2475 AC_SUBST(aros_kernel_ranlib)
2476 AC_SUBST(orig_target_cc)
2477 AC_SUBST(aros_target_cc)
2478 AC_SUBST(aros_target_cxx)
2479 AC_SUBST(aros_kernel_cc)
2480 AC_SUBST(orig_target_cpp)
2481 AC_SUBST(aros_target_cpp)
2482 AC_SUBST(aros_kernel_cpp)
2483 AC_SUBST(aros_target_as)
2484 AC_SUBST(orig_target_ld)
2485 AC_SUBST(aros_target_ld)
2486 AC_SUBST(aros_kernel_ld)
2487 AC_SUBST(aros_target_cc_includes)
2488 AC_SUBST(aros_target_cc_path)
2489 AC_SUBST(aros_target_objdump)
2490 AC_SUBST(aros_target_objcopy)
2491 AC_SUBST(aros_target_strip)
2492 AC_SUBST(aros_target_nm)
2493 AC_SUBST(aros_kernel_rescomp)
2494 AC_SUBST(aros_shared_default)
2495 AC_SUBST(aros_shared_ld)
2496 AC_SUBST(aros_object_format)
2497 AC_SUBST(aros_compiler_libs)
2498 AC_SUBST(aros_arch_libs)
2500 AC_SUBST(aros_config_cflags)
2501 AC_SUBST(aros_config_aflags)
2502 AC_SUBST(aros_config_ldflags)
2504 AC_SUBST(aros_shared_cflags)
2505 AC_SUBST(aros_shared_aflags)
2506 AC_SUBST(aros_shared_ldflags)
2507 AC_SUBST(aros_kernel_cflags)
2508 AC_SUBST(aros_kernel_includes)
2509 AC_SUBST(aros_kernel_objcflags)
2510 AC_SUBST(aros_kernel_ldflags)
2511 AC_SUBST(aros_target_cflags)
2512 AC_SUBST(aros_debug_cflags)
2513 AC_SUBST(aros_debug_aflags)
2514 AC_SUBST(aros_debug_ldflags)
2515 AC_SUBST(aros_target_genmap)
2516 AC_SUBST(aros_target_strip_flags)
2518 AC_SUBST(crosstools_target)
2519 AC_SUBST(crosstools_cxx_target)
2521 # Delinting target compiler flags
2522 AC_SUBST(aros_cflags_unused_but_set_variable)
2523 AC_SUBST(aros_cflags_array_bounds)
2524 AC_SUBST(aros_cflags_enum_compare)
2525 AC_SUBST(aros_cflags_strict_overflow)
2526 AC_SUBST(aros_cflags_format_security)
2528 # Graphics Related
2529 AC_SUBST(x11_hidd_target)
2530 AC_SUBST(sdl_hidd_target)
2531 AC_SUBST(pci_hidd_target)
2532 AC_SUBST(oss_library_target)
2534 AC_SUBST(aros_default_wbwidth)
2535 AC_SUBST(aros_default_wbheight)
2536 AC_SUBST(aros_default_wbdepth)
2537 AC_SUBST(DO_XSHM_SUPPORT)
2538 AC_SUBST(DO_VIDMODE_SUPPORT)
2540 AC_SUBST(aros_host_x11_includes)
2541 AC_SUBST(aros_host_x11_libdirs)
2542 AC_SUBST(aros_host_sdl_cflags)
2543 AC_SUBST(aros_host_sdl_libs)
2545 # Native version related
2546 AC_SUBST(aros_serial_debug)
2548 # Palm native version related
2549 AC_SUBST(aros_palm_debug_hack)
2551 # USB3.0 code
2552 AC_SUBST(aros_usb30_code)
2554 # Unix/Hosted version related
2555 AC_SUBST(aros_nesting_supervisor)
2557 # MMU related
2558 AC_SUBST(aros_enable_mmu)
2560 # Apple iOS related
2561 AC_SUBST(aros_ios_platform)
2562 AC_SUBST(aros_ios_version)
2563 AC_SUBST(aros_ios_sdk)
2565 # Android related
2566 AC_SUBST(android_tool)
2567 AC_SUBST(aros_android_level)
2569 # DBUS related
2570 AC_SUBST(ENABLE_DBUS)
2571 AC_SUBST(DBUS_CFLAGS)
2572 AC_SUBST(DBUS_LIBFLAGS)
2573 AC_SUBST(KERNEL_DBUS_KOBJ)
2574 AC_SUBST(KERNEL_DBUS_INCLUDES)
2576 #X11 related
2577 AC_SUBST(ENABLE_X11)
2579 # Debug related
2580 AC_SUBST(aros_debug)
2581 AC_SUBST(aros_mungwall_debug)
2582 AC_SUBST(aros_stack_debug)
2583 AC_SUBST(aros_modules_debug)
2585 # Collect-aros stuff: "-ius" to ignore undefined symbols
2586 AC_SUBST(ignore_undefined_symbols)
2588 # C compiler related
2589 AC_SUBST(gcc_target_cpu)
2591 dnl Prepare for output, make up all the generated patches
2592 case "$aros_flavour" in
2593 emulation)      aros_flavour_uc="AROS_FLAVOUR_EMULATION"
2594                 aros_flavour="emulation" ;;
2595 emulcompat)     aros_flavour_uc="(AROS_FLAVOUR_EMULATION|AROS_FLAVOUR_BINCOMPAT)"
2596                 aros_flavour="emulation" ;;
2597 standalone)     aros_flavour_uc="AROS_FLAVOUR_STANDALONE"
2598                 aros_flavour="standalone";;
2599 standcompat)    aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_BINCOMPAT)"
2600                 aros_flavour="standalone";;
2601 native)         aros_flavour_uc="AROS_FLAVOUR_NATIVE"
2602                 aros_flavour="native" ;;
2603 nativecompat)   aros_flavour_uc="(AROS_FLAVOUR_NATIVE|AROS_FLAVOUR_BINCOMPAT)"
2604                 aros_flavour="native" ;;
2605 linklib)        aros_flavour_uc="AROS_FLAVOUR_LINKLIB"
2606                 aros_flavour="linklib" ;;
2607 palmnative)     aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
2608                 aros_flavour="palmnative" ;;
2609 mac68knative)   aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
2610                 aros_flavour="mac68knative" ;;
2611 ppcnative)      aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_BINCOMPAT)"
2612                 aros_flavour="ppcnative" ;;
2613 esac
2615 if test ! -d ${aros_inc_dir} ; then
2616     ${MKDIR} ${aros_inc_dir}
2618 if test ! -d ${aros_geninc_dir} ; then
2619     ${MKDIR} ${aros_geninc_dir}
2621 if test ! -d ${aros_hostcfg_dir} ; then
2622     ${MKDIR} ${aros_hostcfg_dir}
2624 if test ! -d ${aros_targetcfg_dir} ; then
2625     ${MKDIR} ${aros_targetcfg_dir}
2627 if test ! -d ${aros_tools_dir} ; then
2628     ${MKDIR} ${aros_tools_dir}
2630 if test ! -d ${aros_scripts_dir} ; then
2631     ${MKDIR} ${aros_scripts_dir}
2634 AC_CONFIG_HEADERS(${aros_geninc_dir}/host-conf.h:config/host-conf.h.in)
2636 AC_CONFIG_COMMANDS([compiler_executable],
2637     [
2638         prefix=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}
2639         mkdir -p $prefix
2640         prefix2=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros
2641         prefix3=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-elf
2643         echo ${prefix2}
2644         echo ${prefix3}
2645         chmod a+x ${prefix2}-gcc ${prefix2}-ld ${prefix2}-cpp ${prefix3}-gcc
2647         ln -sf $aros_target_as_ln$aros_host_exe_suffix      ${prefix2}-as$aros_host_exe_suffix
2648         ln -sf $aros_target_nm_ln$aros_host_exe_suffix      ${prefix2}-nm$aros_host_exe_suffix
2649         ln -sf $aros_target_ar_ln$aros_host_exe_suffix      ${prefix2}-ar$aros_host_exe_suffix
2650         ln -sf $aros_target_ranlib_ln$aros_host_exe_suffix  ${prefix2}-ranlib$aros_host_exe_suffix
2651         ln -sf $aros_target_objcopy_ln$aros_host_exe_suffix ${prefix2}-objcopy$aros_host_exe_suffix
2652         ln -sf $aros_target_objdump_ln$aros_host_exe_suffix ${prefix2}-objdump$aros_host_exe_suffix
2653         ln -sf $aros_target_strip_ln$aros_host_exe_suffix   ${prefix2}-strip$aros_host_exe_suffix
2655         ln -sf $aros_kernel_ld$aros_host_exe_suffix         ${prefix3}-ld$aros_host_exe_suffix
2656     ],
2657     [
2658         aros_host_exe_suffix=${aros_host_exe_suffix}
2659         aros_tools_dir=${aros_tools_dir}
2660         aros_target_cpu=${aros_target_cpu}
2661         aros_target_arch=${aros_target_arch}
2662         aros_target_suffix=${aros_target_suffix}
2663         aros_target_nm_ln=${aros_target_nm_ln}
2664         aros_target_as_ln=${aros_target_as_ln}
2665         aros_target_ar_ln=${aros_target_ar_ln}
2666         aros_target_ranlib_ln=${aros_target_ranlib_ln}
2667         aros_target_objdump_ln=${aros_target_objdump_ln}
2668         aros_target_objcopy_ln=${aros_target_objcopy_ln}
2669         aros_target_strip_ln=${aros_target_strip_ln}
2670         aros_kernel_ld=${aros_kernel_ld}
2671     ]
2673 AC_CONFIG_COMMANDS([genmf_executable],
2674     [chmod a+x ${aros_tools_dir}/genmf.py],
2675     [aros_tools_dir=${aros_tools_dir}]
2678 AC_CONFIG_FILES(
2679     Makefile
2680     config/make.cfg
2681     ${aros_inc_dir}/config.h:config/config.h.in
2682     ${aros_geninc_dir}/config.h:config/config.h.in
2683     ${aros_hostcfg_dir}/host.cfg:config/host.cfg.in
2684     ${aros_targetcfg_dir}/target.cfg:config/target.cfg.in
2685     mmake.config
2686     ${aros_targetcfg_dir}/make.defaults:config/make.defaults.in
2687     ${aros_targetcfg_dir}/specs:config/specs.in
2688     ${aros_targetcfg_dir}/elf-specs:${elf_specs_in}
2689     ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-cpp:scripts/aros-cpp.in
2690     ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-gcc:scripts/aros-gcc.in
2691     ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-elf-gcc:scripts/elf-gcc.in
2692     ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-ld:scripts/aros-ld.in
2693     ${aros_tools_dir}/genmf.py:tools/genmf/genmf.py
2694     tools/collect-aros/env.h
2695     ${aros_gendir}/arch/all-android/bootstrap/app/default.properties:arch/all-android/bootstrap/app/default.properties.in
2698 AC_OUTPUT
2700 dnl This is in order to not define SHARED_CFLAGS sometimes
2701 dnl We don't always do aros_shared_ar, aros_shared_cflags
2703 #XXX compatability...
2704 aros_shared_ar="$aros_shared_ld $aros_shared_ldflags -o"
2706 if test -n "$aros_shared_cflags" ; then
2707     echo "SHARED_CFLAGS := $aros_shared_cflags" >> ${aros_hostcfg_dir}/host.cfg
2708     echo "SHARED_AR := $aros_shared_ar" >> ${aros_hostcfg_dir}/host.cfg