removed .. paths need fixed
[AROS.git] / configure.in
blobc909c3e3700e97e953ddc91eb1d0bd9d1d877dae
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_cc="$CC"
94 AROS_TOOL_CCPATH(aros_host_ld,ld)
95 AROS_REQUIRED(ld,$aros_host_ld)
96 aros_host_make="make"
97 aros_host_cflags=$CFLAGS
98 aros_host_ldflags=$LDFLAGS
99 aros_host_debug="-g -O0"
100 aros_host_mkdep="\$(SRCDIR)/scripts/mkdep"
101 aros_host_mkargs="--no-print-directory"
102 aros_host_incl="/usr/include"
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         case "$host_cpu" in
177             *i?86*)
178                 aros_host_cpu="i386"
179                 ;;
180             *x86_64*)
181                 aros_host_cpu="x86_64"
182                 ;;
183             *m68k*)
184                 aros_host_cpu="m68k"
185                 ;;
186             *powerpc*)
187                 aros_host_cpu="ppc"
188                 ;;
189             *arm*)
190                 aros_host_cpu="arm"
191                 ;;
192             *)
193                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
194                 aros_host_cpu="$host_cpu"
195                 ;;
196         esac
197         ;;
199     freebsd*)
200         aros_host_cc="$aros_host_cc $aros_host_cc_pipe -I/usr/local/include"
201         aros_host_make="gmake"
202         aros_host_arch="freebsd"
203         aros_host_cpu="i386"
205         aros_host_ldflags="$aros_host_ldflags -L/usr/local/lib -liconv"
207         dnl FreeBSD 5.x (and later) has changed the default object format.
208         dnl The double [[]] is necessary to get around m4's quoting rules.
209         case $host_os in
210             freebsd[[234]]*)
211                 aros_object_format="elf_i386"
212                 ;;
214             *)
215                 aros_object_format="elf_i386_fbsd"
216                 ;;
217         esac
219         ;;
221     darwin*)
222         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
223         aros_host_arch="darwin"
224         use_aros_gcc="yes"
225         android_build_os="darwin-x86"
226         android_tool="android"
227         default_android_sdk="/android-sdk-mac_x86"
228         default_android_ndk="/android-ndk-r5b"
229         case "$host_cpu" in
230             *i?86*)
231                 aros_host_cpu="i386"
232                 ;;
233             *x86_64*)
234                 aros_host_cpu="x86_64"
235                 ;;
236             *powerpc*)
237                 aros_host_cpu="ppc"
238                 ;;
239             *)
240                 AC_MSG_WARN("Unknown CPU for Darwin host -- $host_cpu")
241                 aros_host_cpu="$host_cpu"
242                 ;;
243         esac
245         aros_host_ldflags="$aros_host_ldflags -liconv"
247         ;;
249     dragonfly*)
250         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
251         aros_host_make="gmake"
252         aros_host_arch="dragonfly"
253         case $host_cpu in
254             *i?86*)
255                 aros_host_cpu="i386"
256                 ;;
257             *amd64*)
258                 aros_host_cpu="x86_64"
259                 ;;
260             *)
261                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
262                 aros_host_cpu="$host_cpu"
263                 ;;
264         esac
265         ;;
267     netbsd*)
268         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
269         aros_host_make="gmake"
270         aros_host_arch="netbsd"
271         case "$host_cpu" in
272             *i?86*)
273                 aros_host_cpu="i386"
274                 ;;
275             *m68k*)
276                 aros_host_cpu="m68k"
277                 ;;
278             *)
279                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
280                 aros_host_cpu="$host_cpu"
281                 ;;
282         esac    
283         aros_host_lib_suffix=".0.0"
284         ;;
286     openbsd*)
287         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
288         aros_host_make="gmake"
289         aros_host_arch="openbsd"
290         case "$host_cpu" in
291             *i?86*)
292                 aros_host_cpu="i386"
293                 ;;
294             *)
295                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
296                 aros_host_cpu="$host_cpu"
297                 ;;
298         esac
299         ;;
300         
301     solaris*)
302         aros_host_arch="solaris"
303         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
304         case "$host_cpu" in
305             *i?86*)
306                 aros_host_cpu="i386"
307                 ;;
308             *sparc*)
309                 aros_host_cpu="sparc"
310                 ;;
311             *)
312                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
313                 aros_host_cpu="$host_cpu"
314                 ;;
315         esac
316         ;;
318     morphos*)
319         aros_host_arch="morphos"
320         aros_host_cpu="ppc"
321         ;;
323     amiga*)
324         aros_host_arch="amiga"
325         SORT="/gg/bin/sort"
326         TEST="/gg/bin/test"
327         UNIQ="/gg/bin/uniq"
328         FOR="for"
329         TOUCH="/gg/bin/touch"
330         case "$host_cpu" in
331             *m68k*)
332                 aros_host_cpu="m68k"
333                 ;;
334             *powerpc*)
335                 aros_host_cpu="ppc"
336                 ;;
337             *)
338                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
339                 aros_host_cpu="$host_cpu"
340                 ;;
341         esac
342         ;;
344     cygwin*)
345         aros_host_arch="cygwin"
346         use_aros_gcc="yes"
347         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
348         android_build_os="windows"
349         android_tool="android.bat"
350         default_android_sdk="/cygdrive/c/android-sdk-windows-1.6_r1"
352         case "$host_cpu" in
353             *i?86*)
354                 aros_host_cpu="i386"
355                 ;;
356             *)
357                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
358                 aros_host_cpu="$host_cpu"
359                 ;;
360         esac
361         ;;
363     mingw32*)
364         aros_host_arch="mingw32"
365         use_aros_gcc="yes"
366         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
367         android_build_os="windows"
368         android_tool="android.bat"
369         default_android_sdk="/c/android-sdk-windows-1.6_r1"
371         case "$host_cpu" in
372             *i?86*)
373                 aros_host_cpu="i386"
374                 ;;
375             *)
376                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
377                 aros_host_cpu="$host_cpu"
378                 ;;
379         esac
380         ;;
381     *)
382         AC_MSG_ERROR([Unsupported host architecture $host])
383         ;;
384 esac
386 AROS_PROG(aros_host_ar,[ar],[cr])
387 AROS_REQUIRED(ar,$aros_host_ar)
388 AROS_PROG(aros_host_ranlib,ranlib)
389 AROS_REQUIRED(ranlib,$aros_host_ranlib)
390 AROS_PROG(aros_host_strip,strip)
391 AROS_REQUIRED(strip,$aros_host_strip)
393 AROS_PROG(RM,[rm],[-rf])
394 AROS_REQUIRED(rm,$RM)
395 AROS_PROG(CP,[cp])
396 AROS_REQUIRED(cp,$CP)
397 AROS_PROG(MV,[mv])
398 AROS_REQUIRED(mv,$MV)
399 AROS_PROG(ECHO,[echo])
400 AROS_REQUIRED(echo,$ECHO)
401 AROS_PROG(MKDIR,[mkdir],[-p])
402 AROS_REQUIRED(mkdir,$MKDIR)
403 AROS_PROG(TOUCH,[touch])
404 AROS_REQUIRED(touch,$TOUCH)
405 AROS_PROG(SORT,[sort])
406 AROS_REQUIRED(sort,$SORT)
407 AROS_PROG(UNIQ,[uniq])
408 AROS_REQUIRED(uniq,$UNIQ)
409 AROS_PROG(NOP,[true])
410 AROS_REQUIRED(true,$NOP)
411 AROS_PROG(CAT,[cat])
412 AROS_REQUIRED(cat,$CAT)
413 AROS_PROG(BISON,[bison])
414 AROS_REQUIRED(bison,$BISON)
415 AROS_PROG(FLEX,[flex])
416 AROS_REQUIRED(flex,$FLEX)
417 AROS_PROG(PNGTOPNM,[pngtopnm])
418 AROS_REQUIRED(pngtopnm,$PNGTOPNM)
419 AROS_PROG(PPMTOILBM,[ppmtoilbm])
420 AROS_REQUIRED(ppmtoilbm,$PPMTOILBM)
421 AROS_PROG(SED,[sed])
422 AROS_REQUIRED(sed,$SED)
423 AROS_PROG(CHMOD,[chmod])
424 AROS_REQUIRED(chmod,$CHMOD)
425 AROS_PROG(PATCH,[patch])
426 AROS_REQUIRED(patch,$PATCH)
428 AM_PATH_PYTHON(2.5)
430 AC_SUBST(FOR, for)
431 AC_SUBST(IF, if)
432 AC_SUBST(TEST, test)
433 AC_SUBST(CMP, cmp)
435 dnl ---------------------------------------------------------------------------
436 dnl Look for things about the host system, good for hosted targets.
437 dnl ---------------------------------------------------------------------------
439 # Check for some includes for the X11 HIDD and the kernel
440 AC_CHECK_HEADERS([sys/ipc.h sys/shm.h \
441     sys/mmap.h sys/mman.h sysexits.h \
442     sys/statfs.h sys/statvfs.h sys/vfs.h sys/param.h \
445 AC_CHECK_HEADERS([sys/mount.h],,,[#include <sys/param.h>])
447 AC_HEADER_DIRENT
448 AC_HEADER_STAT
449 AC_HEADER_STDC
450 AC_HEADER_SYS_WAIT
451 AC_HEADER_TIME
452 AC_STRUCT_ST_BLKSIZE
453 AC_STRUCT_ST_BLOCKS
454 AC_STRUCT_ST_RDEV
455 AC_STRUCT_TM
456 AC_STRUCT_TIMEZONE
457 AC_TYPE_OFF_T
458 AC_TYPE_PID_T
459 AC_TYPE_SIZE_T
460 AC_TYPE_UID_T
462 AC_CHECK_MEMBERS(struct tm.tm_gmtoff)
464 # Look for some functions
465 AC_CHECK_FUNCS([getpagesize kqueue statfs statvfs \
466     clone kse_create rfork_thread thr_create sa_register \
467     getcontext makecontext setcontext sigaltstack swapcontext])
469 AC_FUNC_MMAP
472 dnl --------------------------------------------------------------------
473 dnl Target Configuration Section
474 dnl --------------------------------------------------------------------
476 dnl The target configuration section is responsible for setting up all
477 dnl the paths for includes, and tools required to build AROS to some
478 dnl particular target.
480 aros_config_cflags="-Wall -Werror-implicit-function-declaration"
481 aros_config_aflags="-Wall -x assembler-with-cpp -c"
482 aros_config_ldflags=""
484 aros_shared_default=yes
486 aros_shared_cflags="-fPIC"
487 aros_shared_aflags=""
488 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
489 aros_kernel_ldflags="-Wl,-rpath,./lib"
491 aros_kernel_ar_flags="cr"
492 aros_target_ar_flags="cr"
493 aros_target_nm_flags="-C -ul"
494 aros_target_strip_flags="--strip-unneeded -R.comment"
496 aros_compiler_libs=
497 aros_arch_libs=
499 aros_target_genmap="-Wl,-Map -Xlinker"
501 # Native flavour stuff
502 aros_serial_debug="0"
504 # Palm native flavour stuff
505 aros_palm_debug_hack="0"
507 # Unix flavour stuff
508 aros_nesting_supervisor="0"
510 # Collect-aros stuff: "-ius" to ignore undefined symbols
511 ignore_undefined_symbols=""
513 # Check for X11 by default
514 need_x11="auto"
516 #-----------------------------------------------------------------------------
519 # GCC 4.1+ has a stack protection feature that requires OS support. Ubuntu has
520 # it switched on by default, and we use the host compiler, so it compiles AROS
521 # code with this enabled resulting in link failures as we don't have support
522 # for it.
524 # We use two methods to disable it. For the host compiler (used to compile
525 # some hosted modules), we test to see if the compiler supports stack
526 # protection, and if it does we disable it in AROS_CONFIG_CFLAGS. This should
527 # work on all platforms.
529 # For the "cross" compiler we clear the "ssp_default" spec in config/specs.in
530 # (this is done unconditionally, as it should have no effect on compilers
531 # without the stack protection feature). This may be specific to the way that
532 # Ubuntu enables the feature, so may not work everywhere. My specs-fu isn't
533 # strong enough to disable it in a generic way though, so we'll live with it
534 # until another vendor ships GCC with it enabled in a different way, and deal
535 # with it then.
538 AC_MSG_CHECKING([whether ${CC} accepts -fno-stack-protector])
539 save_cflags="$CFLAGS"
540 CFLAGS="$CFLAGS -fno-stack-protector"
541 AC_TRY_COMPILE(,, use_no_stack_protector="yes", use_no_stack_protector="no")
542 AC_MSG_RESULT($use_no_stack_protector)
543 if test "x-$use_no_stack_protector" = "x-yes" ; then
544     aros_host_cflags="$aros_host_cflags -fno-stack-protector"
546 CFLAGS="$save_cflags"
548 #-----------------------------------------------------------------------------
550 # Disable pointer-signedness warnings if the compiler recognises the option
551 # (this only works for the host compiler at the moment)
553 AC_MSG_CHECKING([whether ${CC} accepts -Wno-pointer-sign])
554 save_cflags="$CFLAGS"
555 CFLAGS="$CFLAGS -Wno-pointer-sign"
556 AC_TRY_COMPILE(,, use_no_sign_warning="yes", use_no_sign_warning="no")
557 AC_MSG_RESULT($use_no_sign_warning)
558 if test "x-$use_no_sign_warning" = "x-yes" ; then
559     aros_host_cflags="$aros_host_cflags -Wno-pointer-sign"
561 CFLAGS="$save_cflags"
563 #-----------------------------------------------------------------------------
565 # Check if host compiler supports -fgnu89-inline, can be needed for crosstools.
567 AC_MSG_CHECKING([whether ${CC} accepts -fgnu89-inline])
568 save_cflags="$CFLAGS"
569 CFLAGS="$CFLAGS -fgnu89-inline"
570 AC_TRY_COMPILE(,, use_gnu89_inline="yes", use_gnu89_inline="no")
571 AC_MSG_RESULT($use_gnu89_inline)
572 if test "x-$use_gnu89_inline" = "x-yes" ; then
573     gnu89_inline="-fgnu89-inline"
575 CFLAGS="$save_cflags"
577 #-----------------------------------------------------------------------------
579 AC_MSG_CHECKING([for type of build])
580 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")
582 if test "$build_type" = "nightly"; then
583     build_type_string="NIGHTLY"
584 elif test "$build_type" = "snapshot"; then
585     build_type_string="SNAPSHOT"
586 elif test "$build_type" = "milestone"; then
587     build_type_string="MILESTONE"
588 elif test "$build_type" = "release"; then
589     build_type_string="RELEASE"
590 else
591     build_type_string="PERSONAL"
592     build_type="personal"
595 aros_config_cflags="$aros_config_cflags -DAROS_BUILD_TYPE=AROS_BUILD_TYPE_$build_type_string"
597 AC_MSG_RESULT($build_type)
599 #-----------------------------------------------------------------------------
600 all_debug_types="messages stack modules mungwall symbols"
602 AC_MSG_CHECKING([which debug types to enable])
603 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)]),
604  debug="$enableval",debug="")
606 if test "$debug" = "" -o "$debug" = "no"; then
607     debug="none"
608 elif test "$debug" = "yes"; then
609     debug="all"
612 if test "$debug" = "all" ; then
613     debug="messages stack modules symbols"
614     for d in $all_debug_types; do
615         export aros_${d}_debug="1"
616     done
617 else
618     for d in $all_debug_types; do
619         export aros_${d}_debug="0"
620     done
623 if test "$debug" != "none"; then
624     debug=`echo $debug | sed s/,/\ /g`
625     for d in $debug; do
626         found="0"
627         for d2 in $all_debug_types; do
628             if test "$d2" = "$d"; then
629                 found="1"
630                 break
631             fi
632         done
633         if test "$found" = "0"; then
634             AC_MSG_ERROR([unrecognized debug type "$d". Available types are: all none $all_debug_types])
635         fi
636         export aros_${d}_debug="1"
637     done
638     aros_debug="yes"
640 AC_MSG_RESULT($debug)
642 if test "$aros_messages_debug" = "1"; then
643     aros_messages_debug="-DADEBUG=1 -DMDEBUG=1"
644 else
645     aros_messages_debug=""
647 if test "$aros_symbols_debug" = "1"; then
648     aros_symbols_debug="-g"
649 else
650     aros_symbols_debug=""
653 # These are the flags to pass when compiling debugged programs
654 aros_debug_cflags="$aros_symbols_debug $aros_messages_debug"
655 aros_debug_aflags=""
656 aros_debug_ldflags="$aros_symbols_debug"
658 #-----------------------------------------------------------------------------
659 #   Checking if we should build crosstools..
660 AC_MSG_CHECKING([whether to build crosstools])
661 AC_ARG_ENABLE(crosstools,AC_HELP_STRING([--enable-crosstools],[Build cross-compiler toolchains if necessary (default=no).]),crosstools="$enableval",crosstools="no")
662 AC_MSG_RESULT($crosstools)
664 #-----------------------------------------------------------------------------
665 #   Checking for distcc and ccache.
667 #   Always apply the transforms in this particular order. Basically you should
668 #   always run 'ccache distcc compiler' in that order for the best performance.
670 AC_MSG_CHECKING([whether to enable distcc])
671 AC_ARG_ENABLE(distcc,AC_HELP_STRING([--enable-distcc],[Use distcc as a front end to the compiler (default=no).]),distcc="$enableval",distcc="no")
672 if test "$distcc" != "" -a "$distcc" != "no"; then
673     # AC_CHECK_PROG will print out the result in this case
674     AC_PATH_PROG(DISTCC,[distcc],distcc,)
675 else
676     AC_MSG_RESULT(no)
679 AC_MSG_CHECKING([whether to enable ccache])
680 AC_ARG_ENABLE(ccache,AC_HELP_STRING([--enable-ccache],[Use ccache as a front end to the compiler (default=no).]),ccache="$enableval",ccache="no")
681 if test "$ccache" != "" -a "$ccache" != "no"; then
682     # AC_CHECK_PROG will print out the result in this case
683     AC_CHECK_PROG(CCACHE,[ccache],ccache,)
684 else
685     AC_MSG_RESULT(no)
688 #-----------------------------------------------------------------------------
689 AC_MSG_CHECKING([what specific host gcc version to use])
690 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")
691 AC_MSG_RESULT($target_tool_version)
693 #-----------------------------------------------------------------------------
694 AC_MSG_CHECKING([what optimization flags to use])
695 AC_ARG_WITH(optimization,AC_HELP_STRING([--with-optimization=FLAGS],[Use optimization flags FLAGS (default=-O2).]),optimization="$withval",optimization="unknown")
696 if test "$optimization" = "unknown"; then
697     dnl default is -O2 for normal builds, -O0 for debug builds
698     if test "$debug" != "none"; then
699         optimization="-O0"
700     else
701         optimization="-O2"
702     fi
704 aros_config_cflags="$aros_config_cflags $optimization"
705 AC_MSG_RESULT($optimization)
707 #-----------------------------------------------------------------------------
708 AC_MSG_CHECKING([what paranoia flags to use])
709 AC_ARG_WITH(paranoia,AC_HELP_STRING([--with-paranoia=FLAGS],[CC flags to enable paranoia]),[paranoia_flags="$withval"],[paranoia_flags="default"])
710 if test "$paranoia_flags" = "default"; then
711         paranoia_flags=""
712 else if test "$paranoia_flags" = "yes"; then
713         paranoia_flags="-Wall -Werror"
714 fi fi
715 AC_MSG_RESULT($paranoia_flags)
716 aros_config_cflags="$aros_config_cflags $paranoia_flags"
718 #-----------------------------------------------------------------------------
719 AC_MSG_CHECKING([what target variant to enable])
720 AC_ARG_ENABLE(target_variant,AC_HELP_STRING([--enable-target-variant=NAME],[Enable a specific target variant(default=none)]),target_variant=$enableval,target_variant="")
721 if test "$target_variant" = ""; then
722     aros_target_variant=""
723     aros_target_suffix=""
724     enableval="none"
725 else
726     aros_target_variant="$target_variant"
727     aros_target_suffix="-$target_variant"
729 AC_MSG_RESULT($enableval)
731 #-----------------------------------------------------------------------------
732 # Target-specific defaults. You can override then on a per-target basis.
734 # Bootloader name. Currently used by PC target.
735 target_bootloader="none"
737 # Prefix for toolchain used to build bootstrap. For hosted ports, this should be a toolchain for target host OS.
738 # (i. e. when building mingw32-i386 port this should be set to "i386-mingw32-").
739 # For native ports this toolchain is used to build a bootloader and second-level bootstrap (if present).
740 if test "$crosstools" != "yes"; then
741     target_tool_prefix=${target_cpu}-elf-
742 else
743     target_tool_prefix=${target_cpu}-aros-
746 #-----------------------------------------------------------------------------
747 # Additional options for some specific targets
749 case "$aros_target_variant" in
750 ios)
751     AC_MSG_CHECKING([XCode path])
752     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")
753     AC_MSG_RESULT($aros_xcode_path)
755     AC_MSG_CHECKING([for minimum supported iOS version])
756     AC_ARG_WITH(ios-version,AC_HELP_STRING([--with-ios-version=VERSION],[Specify minimum supported iOS version (default=3.0).]),aros_ios_version="$withval",aros_ios_version="3.0")
757     AC_MSG_RESULT($aros_ios_version)
759     AC_MSG_CHECKING([what iOS SDK version to use])
760     AC_ARG_WITH(ios-sdk,AC_HELP_STRING([--with-ios-sdk=VERSION],[Use iOS SDK version VERSION (default=4.1).]),aros_ios_sdk="$withval",aros_ios_sdk="4.1")
761     AC_MSG_RESULT($aros_ios_sdk)
763     ;;
765 "android")
766     AC_MSG_CHECKING([Android SDK path])
767     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)
768     AC_MSG_RESULT($aros_android_sdk)
770     AC_MSG_CHECKING([Android NDK path])
771     AC_ARG_WITH(ndk,AC_HELP_STRING([--with-ndk=PATH],[Specify Android NDK path (default=$default_android_ndk).]),aros_android_ndk="$withval",aros_android_ndk="$default_android_ndk")
772     AC_MSG_RESULT($aros_android_ndk)
774     AC_MSG_CHECKING([what Android SDK version to use])
775     AC_ARG_WITH(sdk-version,AC_HELP_STRING([--with-sdk-version=LEVEL],[Use Android SDK for API LEVEL (default=8).]),aros_sdk_version="$withval",aros_sdk_version="8")
776     AC_MSG_RESULT($aros_sdk_version)
778     AC_MSG_CHECKING([what Android NDK version to use])
779     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")
780     AC_MSG_RESULT($aros_ndk_version)
782     export PATH="$aros_android_sdk/tools:$PATH"
783     AC_PATH_PROG(android_tool, $android_tool)
784     AROS_REQUIRED(android,$android_tool)
786     dnl MSYS bash can't run .bat files directly, then need to be started via cmd.exe
787     if test $host_os = "mingw32"; then
788         android_tool="cmd //c $android_tool"
789     fi
791     ;;
792 esac
794 #-----------------------------------------------------------------------------
795 # This is the target configuration switch.
796 case "$target_os" in
797     linux*)
798         aros_target_arch="linux"
799         aros_target_family="unix"
800         case "$target_cpu" in
801             *m68k*)
802                 aros_target_cpu="m68k"
803                 aros_object_format="m68kelf"
804                 aros_flavour="emulcompat"
805                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D__mc68000 -D__linux__"
806                 aros_shared_ldflags="-Wl,-T,\$(TOP)/config/linux/m68k/script.so"
807                 aros_kernel_ldflags="-Wl,-rpath,./lib,-T,\$(TOP)/config/linux/m68k/script.normal"
808                 gcc_target_cpu="mc68000"
809                 ;;
810             *i?86*)
811                 aros_target_cpu="i386"
812                 aros_object_format="elf_i386"
813                 aros_flavour="emulation"
814                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__linux__"
815                 aros_config_cflags="$aros_config_cflags -m32 -march=i486"
816                 aros_kernel_cflags="$aros_kernel_cflags -m32 -march=i486"
817                 aros_config_aflags="$aros_config_aflags -m32 -march=i486"
818                 aros_config_ldflags="-m32 -march=i486"
819                 aros_kernel_ldflags="-melf_i386"
820                 aros_default_wbdepth=8
821                 gcc_target_cpu="i386"
822                 pci_hidd_target="hidd-pci-linux"
823                 ;;
824             *x86_64*)
825                 aros_target_cpu="x86_64"
826                 aros_object_format="elf_x86_64"
827                 aros_flavour="emulation"
828                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64 -D__linux__"
829                 aros_config_cflags="$aros_config_cflags -mno-red-zone -fno-omit-frame-pointer"
830                 aros_default_wbdepth=8
831                 pci_hidd_target="hidd-pci-linux"
832                 ;;
833             *powerpc*)
834                 aros_target_cpu="ppc"
835                 aros_object_format="elf32ppc"
836                 aros_flavour="emulation"
837                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc -D__linux__"
838                 aros_default_wbdepth=8
839                 gcc_target_cpu="ppc"
840                 ;;
841 # TODO
842 # Same as powerpc, but I need this for the nightly build to work again.
843 # Actually, the nightly should be made working with powerpc target.
844 # That just was too much work for the moment, another week or two.
845             *ppc*)
846                 aros_target_cpu="ppc"
847                 aros_object_format="elf32ppc"
848                 aros_flavour="emulation"
849                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc -D__linux__"
850                 aros_default_wbdepth=8
851                 gcc_target_cpu="ppc"
852                 ;;
853             *arm*)
854                 aros_target_cpu="arm"
855                 aros_object_format="armelf_linux_eabi"
856                 aros_flavour="emulation"
857                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm -D__linux__"
858                 gcc_target_cpu="arm"
859                 aros_config_cflags="$aros_config_cflags -marm -march=armv6 -mfpu=vfp -mfloat-abi=softfp -mthumb-interwork -fno-asynchronous-unwind-tables -fno-exceptions -fno-strict-aliasing -fno-omit-frame-pointer"
860                 aros_config_aflags="$aros_config_aflags -marm -march=armv6 -mfpu=vfp -mfloat-abi=softfp -mthumb-interwork -fno-asynchronous-unwind-tables -fno-exceptions -fno-strict-aliasing"
861                 aros_arch_libs="-laeabi"
862                 ;;
863             *)
864                 AC_MSG_ERROR("Unknown CPU for Linux -- $target_cpu")
865                 ;;
866         esac
867         case "$aros_target_variant" in
868             android)
869                 aros_android_level=android-$aros_sdk_version
870                 aros_default_wbwidth=320
871                 aros_default_wbheight=480
872                 dnl Android gcc and AROS gcc use different enums size, so we use AROS gcc
873                 use_aros_gcc="yes"
874                 if test "$aros_android_ndk" = ""; then
875                     aros_kernel_cflags="-mandroid"
876                     aros_kernel_ldflags="-mandroid"
877                     CFLAGS="-mandroid"
878                 else
879                     export PATH="$aros_android_ndk/toolchains/arm-linux-androideabi-$target_tool_version/prebuilt/$android_build_os/bin:$PATH"
880                     aros_android_ndk="$aros_android_ndk/platforms/android-$aros_ndk_version/arch-arm"
881                     aros_kernel_cflags="--sysroot $aros_android_ndk -mandroid"
882                     aros_kernel_ldflags="--sysroot $aros_android_ndk -mandroid"
883                     CFLAGS="$CFLAGS --sysroot $aros_android_ndk -mandroid"
884                     aros_kernel_includes="-isystem $aros_android_ndk/usr/include"
885                 fi
886                 need_x11=no
887                 dnl (Ab)use $(X11_HIDD_TARGET) as "Default display driver target"
888                 dnl in order not to fill mmakefiles with garbage
889                 x11_hidd_target=kernel-hidd-androidgfx-kobj
890                 target_tool_prefix="arm-linux-androideabi-"
891             ;;
892         esac
893     ;;
895     pc)
896         aros_target_arch="pc"
897         aros_shared_default="no"
898         target_bootloader="grub2"
899         case "$target_cpu" in
900             *i?86*)
901                 aros_target_cpu="i386"
903                 dnl If somebody hasn't already set the target object
904                 dnl format, then use this value. Mostly to support
905                 dnl FreeBSD cross-compilation.
906                 dnl TODO: Remove when we always use our compiler.
908                 if test "$aros_object_format" = "" ; then
909                     aros_object_format="elf_i386"
910                 fi
911                 aros_flavour="standalone"
912                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
913                 aros_config_cflags="$aros_config_cflags -m32 -march=i486"
914                 aros_kernel_cflags="$aros_kernel_cflags -m32 -march=i486"
915                 aros_config_aflags="$aros_config_aflags -m32 -march=i486"
916                 aros_config_ldflags="-m32 -march=i486"
917                 aros_kernel_ldflags="-melf_i386"
918                 aros_default_wbwidth=640
919                 aros_default_wbheight=480
920                 gcc_target_cpu="i386"
921                 ;;
922             *x86_64*)
923                 aros_target_cpu="x86_64"
924                 aros_serial_debug=1
925                 if test "$aros_object_format" = "" ; then
926                     aros_object_format="elf_x86_64"
927                 fi
928                 aros_flavour="standalone"
929                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
930                 aros_config_cflags="$aros_config_cflags -fno-asynchronous-unwind-tables -mno-red-zone -fno-omit-frame-pointer"
931                 aros_kernel_ldflags=""
932                 aros_default_wbwidth=640
933                 aros_default_wbheight=480
934                 ;;
935             *)
936                 AC_MSG_ERROR("Unknown native CPU -- $target_cpu")
937                 ;;
938         esac
939         ;;
941     prep)
942         aros_target_arch="prep"
943         aros_shared_default="no"
944         aros_target_cpu="ppc"
945         aros_object_format="elf32ppc"
946         aros_flavour="ppcnative"
947         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
948         aros_kernel_ldflags=""
949         aros_default_wbwidth=640
950         aros_default_wbheight=480
951         gcc_target_cpu="ppc"
952         ;;
954     freebsd*)
955         aros_target_arch="freebsd"
956         aros_target_family="unix"
957         aros_target_cpu="i386"
958         aros_flavour="emulation"
959         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
960         gcc_target_cpu="i386"
962         aros_target_strip_flags="-x"
963         ;;
965     darwin*)
966         aros_target_arch="darwin"
967         aros_target_family="unix"
968         aros_flavour="emulation"
969         case "$target_cpu" in
970             *i?86*)
971                 aros_ios_platform="iPhoneSimulator"
972                 aros_target_cpu="i386"
973                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
974                 aros_kernel_ldflags=""
975                 aros_macosx_version="10.4"
976                 aros_default_wbdepth=8
977                 gcc_target_cpu="i386"
978                 aros_object_format="elf_i386"
979                 aros_kernel_ar_flags="-cr"
980                 aros_target_strip_flags="-x"
981                 target_tool_prefix="i686-apple-darwin10-"
982                 target_tool_flags="-m32"
983                 ;;
984             *x86_64*)
985                 aros_target_cpu="x86_64"
986                 aros_object_format="elf_x86_64"
987                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
988                 aros_macosx_version="10.6"
989                 aros_config_cflags="$aros_config_cflags -fno-omit-frame-pointer"
990                 aros_kernel_cflags="-m64"
991                 aros_kernel_ldflags="-m64"
992                 aros_target_cflags="-mcmodel=large"
993                 aros_default_wbdepth=8
994                 aros_kernel_ar="ar"
995                 aros_kernel_ar_flags="-cr"
996                 aros_kernel_ld="ld"
997                 aros_kernel_ranlib="ranlib"
998                 target_tool_prefix="i686-apple-darwin10-"
999                 ;;
1000             *ppc*)
1001                 aros_target_cpu="ppc"
1002                 aros_object_format="elf32ppc"
1003                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1004                 aros_kernel_ldflags=""
1005                 aros_macosx_version="10.0"
1006                 aros_default_wbdepth=8
1007                 gcc_target_cpu="ppc"
1008                 aros_kernel_ar="ar"
1009                 aros_kernel_ar_flags="-cr"
1010                 aros_kernel_ld="ld -arch ppc"
1011                 aros_kernel_ranlib="ranlib -arch ppc"
1012                 target_tool_prefix="powerpc-apple-darwin10-"
1013                 ;;
1014             *arm*)
1015                 aros_ios_platform="iPhoneOS"
1016                 aros_target_cpu="arm"
1017                 aros_object_format="armelf_linux_eabi"
1018                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
1019                 aros_config_cflags="$aros_config_cflags -marm -march=armv6 -mfpu=vfp -mfloat-abi=softfp -fno-asynchronous-unwind-tables -fno-exceptions"
1020                 aros_config_aflags="$aros_config_aflags -marm -march=armv6 -mfpu=vfp -mfloat-abi=softfp -fno-asynchronous-unwind-tables -fno-exceptions"
1021                 aros_arch_libs="-laeabi"
1022                 aros_default_wbdepth=8
1023                 gcc_target_cpu="arm"
1024                 aros_kernel_ar="ar"
1025                 aros_kernel_ar_flags="-cr"
1026                 aros_kernel_ld="ld -arch arm"
1027                 aros_kernel_ranlib="ranlib -arch arm"
1028                 target_tool_prefix="arm-apple-darwin10-" 
1029                 export PATH="$aros_xcode_path/Platforms/$aros_ios_platform.platform/Developer/usr/bin:$PATH"
1030                 ;;
1031             *)
1032                 AC_MSG_ERROR("Unsupported target CPU for darwin hosted flavour -- $target_cpu")
1033                 ;;
1034         esac
1035         case "$aros_target_variant" in
1036             ios)
1037                 aros_default_wbwidth=320
1038                 aros_default_wbheight=480
1039                 aros_ios_sdk="$aros_xcode_path/Platforms/$aros_ios_platform.platform/Developer/SDKs/$aros_ios_platform$aros_ios_sdk.sdk"
1040                 target_tool_flags="$target_tool_flags -isysroot $aros_ios_sdk"
1041                 aros_kernel_includes="-isystem $aros_ios_sdk/usr/include"
1042                 need_x11=no
1043                 # This is here because it may depend on iOS or SDK version
1044                 aros_kernel_cflags="$aros_kernel_cflags -miphoneos-version-min=$aros_ios_version"
1045                 aros_kernel_ldflags="$aros_kernel_ldflags -miphoneos-version-min=$aros_ios_version"
1046                 aros_kernel_objcflags="-fobjc-abi-version=2 -fobjc-legacy-dispatch"
1047             ;;
1048             *)
1049                 aros_kernel_cflags="$aros_kernel_cflags -mmacosx-version-min=$aros_macosx_version"
1050                 aros_kernel_ldflags="$aros_kernel_ldflags -mmacosx-version-min=$aros_macosx_version"
1051             ;;
1052         esac
1053         ;;
1055     dragonfly*)
1056         aros_target_arch="dragonfly"
1057         aros_target_family="unix"
1058         aros_flavour="emulation"
1059         case "$target_cpu" in
1060             *i?86*)
1061                 aros_target_cpu="i386"
1062                 aros_object_format="elf_i386"
1063                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__DragonFly__"
1064                 ;;
1065             *x86_64*)
1066                 aros_config_cflags="$aros_config_cflags -fno-omit-frame-pointer"
1067                 aros_target_cpu="x86_64"
1068                 aros_object_format="elf_x86_64"
1069                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64 -D__DragonFly__"
1070                 ;;
1071             *)
1072                 AC_MSG_ERROR("Unknown CPU for DragonFly -- $target_cpu")
1073                 ;;
1074         esac
1075         ;;
1077     netbsd*)
1078         aros_target_arch="netbsd"
1079         aros_target_family="unix"
1080         case "$target_cpu" in
1081             *m68k*)
1082                 aros_target_cpu="m68k"
1083                 aros_object_format="m68kelf"
1084                 aros_flavour="emulcompat"
1085                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D__mc68000 -D__NetBSD__"
1086                 gcc_target_cpu="mc68000"
1087                 ;;
1088             *i?86*)
1089                 aros_target_cpu="i386"
1090                 aros_object_format="elf_i386"
1091                 aros_flavour="emulation"
1092                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__NetBSD__"
1093                 aros_default_wbdepth=8
1094                 gcc_target_cpu="i386"
1095                 ;;
1096             *)
1097                 AC_MSG_ERROR("Unknown CPU for NetBSD -- $target_cpu")
1098                 ;;
1099         esac
1100         aros_target_genmap="-Wl,-M -Xlinker >"
1101         aros_flavour="emulation"
1102         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1103         ;;   
1105     openbsd*)
1106         aros_target_arch="openbsd"
1107         aros_target_family="unix"
1108         case "$target_cpu" in
1109             *i?86*)
1110                 aros_target_cpu="i386"
1111                 aros_object_format="elf_i386"
1112                 aros_flavour="emulation"
1113                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__OpenBSD__"
1114                 gcc_target_cpu="i386"
1115                 ;;
1116             *)
1117                 AC_MSG_ERROR("Unknown CPU for OpenBSD -- $target_cpu")
1118                 ;;
1119         esac
1120         aros_target_genmap="-Wl,-M -Xlinker >"
1121         aros_target_nm_flags="-u"
1122         aros_flavour="emulation"
1123         ;;
1125     solaris*)
1126         aros_target_arch="solaris"
1127         aros_target_family="unix"
1128         case "$target_cpu" in
1129            *i?86*)
1130                aros_target_cpu="i386"
1131                aros_object_format="elf_i386"
1132                aros_flavour="emulation"
1133                aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__Solaris__"
1134                aros_default_wbdepth=8
1135                gcc_target_cpu="i386"
1136                ;;
1137             *sparc*)
1138                 aros_target_cpu="sparc"
1139                 aros_object_format="elf_sparc"
1140                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dsparc -D__Solaris__"
1141                 gcc_target_cpu="sparc"
1142                 ;;
1143             *)
1144                 AC_MSG_ERROR("Unknown CPU for Solaris -- $target_cpu")
1145                 ;;
1146         esac
1147         aros_config_cflags="$aros_config_cflags -D$aros_target_cpu"
1148         aros_flavour="emulation"
1149         ;;
1151     morphos*)
1152         aros_target_arch="morphos"
1153         aros_shared_default="no"
1154         aros_target_cpu="ppc"
1155         aros_object_format="elf_ppc"
1156         aros_flavour="nativecompat"
1157         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1158         gcc_target_cpu="ppc"
1159         ;;
1161     sam440)
1162         aros_target_arch="sam440"
1163         aros_shared_default="no"
1164         aros_target_cpu="ppc"
1165         aros_object_format="elf32ppc"
1166         aros_flavour="ppcnative"
1167         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1168         aros_kernel_ldflags=""
1169         aros_default_wbwidth=1024
1170         aros_default_wbheight=768
1171         aros_default_wbdepth=24
1172         aros_config_cflags="$aros_config_cflags -mcpu=440fp -mno-toc -fno-asynchronous-unwind-tables"
1173         gcc_target_cpu="powerpc"
1174         ;;
1176     efika)
1177         aros_target_arch="efika"
1178         aros_shared_default="no"
1179         aros_target_cpu="arm"
1180         aros_object_format="armelf_linux_eabi"
1181         aros_flavour="standalone"
1182         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
1183         aros_kernel_ldflags=""
1184         aros_default_wbwidth=1024
1185         aros_default_wbheight=600
1186         aros_arch_libs="-laeabi"
1187         aros_config_cflags="$aros_config_cflags -marm -march=armv7-a -mtune=cortex-a8 -mfpu=vfpv3 -mfloat-abi=hard -fno-asynchronous-unwind-tables -fno-exceptions -fno-strict-aliasing"
1188         aros_config_aflags="$aros_config_aflags -marm -march=armv7-a -mtune=cortex-a8 -mfpu=vfpv3 -mfloat-abi=hard -fno-asynchronous-unwind-tables -fno-exceptions -fno-strict-aliasing"
1189         ;;
1190         
1191     chrp)
1192     aros_target_arch="chrp"
1193     aros_shared_default="no"
1194     aros_target_cpu="ppc"
1195     aros_object_format="elf32ppc"
1196     aros_flavour="ppcnative"
1197     aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1198     aros_kernel_ldflags=""
1199     aros_default_wbwidth=640
1200     aros_default_wbheight=480
1201     aros_config_cflags="$aros_config_cflags -mno-toc -fno-asynchronous-unwind-tables"    
1202     gcc_target_cpu="powerpc"
1203         case "$aros_target_variant" in
1204             efika)
1205             aros_config_cflags="$aros_config_cflags -DBIG_ENDIAN_OHCI=1 -mcpu=603e"
1206             ;;
1207         esac
1208     ;;
1210     amiga*)
1211         aros_target_arch="amiga"
1212         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D_AMIGA -DAMIGA"
1213         aros_shared_default="no"
1215         case "$target_cpu" in
1216             *m68k*)
1217                 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")
1218                 aros_enable_mmu=no
1219                 aros_target_cpu="m68k"
1220                 aros_object_format="m68kelf"
1221                 aros_flavour="standcompat"
1222                 gcc_target_cpu="m68000"
1223                 aros_config_cflags="$aros_config_cflags -fno-strict-aliasing -ffreestanding -fomit-frame-pointer -${gcc_target_cpu} -fbuiltin -Wno-volatile-register-var -Os"
1224                 aros_config_aflags="$aros_config_aflags -${gcc_target_cpu}"
1225                 target_tool_prefix="m68k-elf-"
1226                 # Needed to get the correct multilib
1227                 aros_config_ldflags="-${gcc_target_cpu}"
1228                 aros_shared_ldflags="-${gcc_target_cpu}"
1229                 aros_kernel_ldflags="-${gcc_target_cpu}"
1230                 aros_target_nostdlib_ldflags="-${gcc_target_cpu}"
1231                 aros_target_strip_flags="-R.comment --strip-debug"
1232                 aros_default_wbwidth=640
1233                 aros_default_wbheight=256
1234                 aros_default_wbdepth=2
1235                 ;;
1236             *ppc*)
1237                 aros_cpu="ppc"
1238                 aros_flavour="native"
1239                 gcc_target_cpu="ppc"
1240                 ;;
1241             *)
1242                 AC_MSG_ERROR("Unknown CPU for Amiga $target_cpu")
1243                 ;;
1244         esac
1245         ;;
1247     mingw*)
1248         aros_target_arch="mingw32"
1249         aros_shared_default="no"
1250         aros_flavour="emulation"
1251         aros_shared_cflags=""
1252         need_dlopen="no"
1253         rescomp="windres"
1254         case "$target_cpu" in
1255             *i?86*)
1256                 aros_target_cpu="i386"
1257                 aros_object_format="elf_i386"
1258                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1259                 aros_default_wbdepth=8
1260                 gcc_target_cpu="i386"
1262                 dnl Temporary hack, needed to get nightly build working
1263                 aros_target_as="i386-aros-as"
1264                 aros_target_ar="i386-aros-ar"
1265                 aros_target_ranlib="i386-aros-ranlib"
1266                 aros_target_nm="i386-aros-nm"
1267                 aros_target_strip="i386-aros-strip"
1268                 aros_target_objcopy="i386-aros-objcopy"
1269                 aros_target_objdump="i386-aros-objdump"
1271                 target_tool_prefix="i386-mingw32-"
1272                 ;;
1273             *x86_64*)
1274                 aros_target_cpu="x86_64"
1275                 aros_object_format="elf_x86_64"
1276                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
1277                 aros_config_cflags="$aros_config_cflags -fno-omit-frame-pointer"
1278                 aros_default_wbdepth=8
1279                 target_tool_prefix="x86_64-w64-mingw32-"
1280                 ;;
1281             *arm*)
1282                 aros_target_cpu="arm"
1283                 aros_object_format="armelf_linux_eabi"
1284                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
1285                 aros_arch_libs="-laeabi"
1286                 aros_default_wbdepth=8
1287                 gcc_target_cpu="arm"
1288                 target_tool_prefix="arm-mingw32ce-"
1289                 aros_default_wbwidth=160
1290                 aros_default_wbheight=160
1291                 ;;
1292             *)
1293                 AC_MSG_ERROR("Unknown CPU for Mingw32 -- $target_cpu")
1294                 ;;
1295         esac
1296         if test $host_os = "cygwin"; then
1297                 aros_kernel_cflags="-mno-cygwin"
1298         fi
1299     ;;
1300     pp*)
1301         aros_target_arch="pp"
1302         aros_shared_default="no"
1303         case "$target_cpu" in
1304             *m68k*)
1305                 aros_target_cpu="m68k"
1306                 aros_object_format="m68kelf"
1307                 aros_flavour="palmnative"
1308                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
1309                 aros_default_wbwidth=160
1310                 aros_default_wbheight=160
1311                 aros_default_wbdepth=1
1312                 aros_target_ar_flags="cru"
1313                 aros_compiler_libs="-lgcc1"
1314                 aros_shared_default=no
1315                 aros_shared_cflags="-fpic"
1316                 aros_shared_aflags=""
1317                 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
1318                 aros_kernel_ldflags="-Wl,-rpath,./lib"
1319                 aros_debug_cflags="$aros_symbols_debug  $aros_messages_debug -mc68000 -Wa,-mc68000"
1320                 aros_debug_aflags=""
1321                 aros_debug_ldflags="$aros_symbols_debug"
1322                 aros_mungwall_debug="0"
1323                 aros_modules_debug="0"
1324                 gcc_target_cpu="mc68000"
1325                 ignore_undefined_symbols="-ius"
1326                 ;;
1327            *)
1328                 AC_MSG_ERROR("Unknown CPU for PalmPilot -- $target_cpu")
1329                 ;;
1330         esac
1331         ;;
1333     mac*)
1334         aros_target_arch="mac"
1335         aros_shared_default="no"
1336         case "$target_cpu" in
1337             *m68k*)
1338                 aros_target_cpu="m68k"
1339                 aros_object_format="m68kelf"
1340                 aros_flavour="mac68knative"
1341                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
1342                 aros_default_wbwidth=512
1343                 aros_default_wbheight=384
1344                 aros_default_wbdepth=8
1345                 aros_target_ar_flags="cru"
1346                 aros_compiler_libs="-lgcc1"
1347                 aros_shared_default=no
1348                 aros_shared_cflags="-fpic"
1349                 aros_shared_aflags=""
1350                 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
1351                 aros_kernel_ldflags="-Wl,-rpath,./lib"
1352                 aros_debug_cflags="$aros_symbols_debug $aros_messages_debug -mc68000"
1353                 aros_debug_aflags=""
1354                 aros_debug_ldflags="$aros_symbols_debug"
1355                 aros_mungwall_debug="0"
1356                 aros_modules_debug="0"
1357                 gcc_target_cpu="mc68000"
1358                 ignore_undefined_symbols="-ius"
1359                 ;;
1360            *)
1361                 AC_MSG_ERROR("Unknown CPU for Mac68k -- $target_cpu")
1362                 ;;
1363         esac
1364         ;;
1366     *)
1367         AC_MSG_ERROR([Unsupported target architecture $target])
1368         ;;
1369 esac
1371 # Some formats need custom ELF specs.
1372 # For example for x86_64 it is needed in order for -m32 switch to work correctly.
1373 if test -f $SRCDIR/config/${aros_object_format}-specs.in; then
1374     elf_specs_in=config/${aros_object_format}-specs.in
1375 else
1376     elf_specs_in=config/elf-specs.in
1379 #-----------------------------------------------------------------------------
1380 AC_MSG_CHECKING([where to install or search for cross tools binaries])
1381 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")
1382 if test "$with_crosstools" = "default"; then
1383     AROS_CROSSTOOLSDIR="$AROS_BUILDDIR_UNIX/bin/$aros_host_arch-$aros_host_cpu/tools/crosstools"
1384 else
1385     AROS_CROSSTOOLSDIR="$with_crosstools"
1387 AC_MSG_RESULT($AROS_CROSSTOOLSDIR)
1389 if test "$crosstools" != "no" -o "$with_crosstools" != "default"; then
1391     dnl --with-crosstools with no --enable-crosstools implies --with-aros-gcc with no version specified
1392     dnl The same is about --enable-crosstools
1394     use_aros_gcc=yes
1395     PATH=$AROS_CROSSTOOLSDIR:$PATH
1398 AC_MSG_CHECKING([what specific AROS gcc version to use])
1399 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")
1400 case "$aros_gcc_version" in
1401 yes)
1402     aros_gcc_version="default"
1403     ;;
1405     aros_gcc_version="none"
1406     ;;
1407 esac
1408 AC_MSG_RESULT($aros_gcc_version)
1410 if test "$aros_gcc_version" != "none"; then
1412     dnl Here we either build own crosstools, or use preinstalled ones
1413     dnl Check for specific version requested, and append suffix if needed
1415     if test "$aros_gcc_version" != "default"; then
1416         aros_target_cc="$aros_target_cpu-aros-gcc-$aros_gcc_version"
1417         aros_target_cxx="$aros_target_cpu-aros-g++-$aros_gcc_version"
1418     else
1419         aros_target_cc="$aros_target_cpu-aros-gcc"
1420         aros_target_cxx="$aros_target_cpu-aros-g++"
1421     fi
1423     aros_target_ld="$aros_target_cpu-aros-ld"
1424     aros_target_as="$aros_target_cpu-aros-as"
1425     aros_target_ar="$aros_target_cpu-aros-ar"
1426     aros_target_ranlib="$aros_target_cpu-aros-ranlib"
1427     aros_target_nm="$aros_target_cpu-aros-nm"
1428     aros_target_strip="$aros_target_cpu-aros-strip"
1429     aros_target_objcopy="$aros_target_cpu-aros-objcopy"
1430     aros_target_objdump="$aros_target_cpu-aros-objdump"
1433 # Some compilers (ppc-elf-gcc is known to) have CPU defines in specs
1434 # Since we override specs, we may need to put these defines there
1435 if test "$gcc_target_cpu" != ""; then
1436     gcc_target_cpu="-D__${gcc_target_cpu}__"
1439 AC_MSG_CHECKING([where to download sourcecode for external ports])
1440 AC_ARG_WITH(portssources,AC_HELP_STRING([--with-portssources=DIR],[Where to download sourcecode for external ports]),with_portssrcdir=$withval,with_portssrcdir="default")
1441 if test "$with_portssrcdir" = "default"; then
1442     AROS_PORTSSRCDIR="$AROS_BUILDDIR_UNIX/bin/Sources"
1443 else
1444     AROS_PORTSSRCDIR="$with_portssrcdir"
1446 AC_MSG_RESULT($AROS_PORTSSRCDIR)
1448 AC_MSG_CHECKING([which bootloader to use])
1449 AC_ARG_WITH(bootloader,AC_HELP_STRING([--with-bootloader=NAME],[Use a specific bootloader]),target_bootloader=$withval,target_bootloader=$target_bootloader)
1450 if test "$target_bootloader" = "none"; then
1451     aros_target_bootloader=""
1452 else
1453     aros_target_bootloader="$target_bootloader"
1455 AC_MSG_RESULT($target_bootloader)
1457 AC_MSG_CHECKING([which icon-set to use])
1458 AC_ARG_WITH(iconset,AC_HELP_STRING([--with-iconset=NAME],[Use a specific Icon-set (default=Gorilla).]),target_iconset=$withval,target_iconset="default")
1459 if test "$target_iconset" = "default"; then
1460     aros_target_iconset="Gorilla"
1461     target_iconset="default (Gorilla)"
1462 else
1463     aros_target_iconset="$target_iconset"
1465 AC_MSG_RESULT($target_iconset)
1467 AC_MSG_CHECKING([which GUI Theme to use])
1468 AC_ARG_WITH(theme,AC_HELP_STRING([--with-theme=NAME],[Use a specific GUI Theme]),target_guitheme=$withval,target_guitheme="default")
1469 if test "$target_guitheme" = "default"; then
1470     aros_target_guitheme="Ice"
1471 else
1472     aros_target_guitheme="$target_guitheme"
1474 AC_MSG_RESULT($aros_target_guitheme)
1476 # Find out if we are cross-compiling (i.e. if we can't use the host compiler
1477 # for target code)
1478 cross_compiling=no
1479 if test "$aros_host_cpu" != "$aros_target_cpu" ; then
1480     cross_compiling=yes
1483 dnl Native x86-64 Linux toolchain can also produce i386 binaries, given -m32 flag.
1484 if test "$aros_host_cpu" == "x86_64" ; then
1485     if test "$aros_target_cpu" == "i386" ; then
1486         if test "$aros_target_arch" != "mingw32"; then
1487             cross_compiling=no
1488         fi
1489     fi
1492 dnl Enforce cross-compile if we are on Darwin, but our target is not Darwin.
1493 if test "$aros_host_arch" == "darwin" ; then
1494     if test "$aros_target_arch" != "darwin" ; then
1495         cross_compiling=yes
1496     fi
1499 dnl The same for MinGW
1500 if test "$aros_host_arch" == "mingw32" ; then
1501     if test "$aros_target_arch" != "mingw32" ; then
1502         cross_compiling=yes
1503     fi
1506 # I want to have this information in configure output, although it might be
1507 # misleading, e.g. for darwin hosted you cannot compile target code without a
1508 # cross compiler, but here it says no.
1510 # Note: it says 'yes' only if bootstrap ("kernel") is cross-compiled.
1511 # Target code is a little bit different thing.
1512 #                                                sonic
1513 echo "checking wether we are (AROS style) cross compiling... $cross_compiling"
1515 # Set prefix for target compiler etc. if we're cross-compiling
1516 # (should possibly be earlier but needs to be after AC_PROG_CC)
1517 if test "$cross_compiling" = "yes" ; then
1519     if test "x-$aros_flavour" = "x-standalone" -o "x-$aros_flavour" = "x-standcompat" ; then
1520         if test "$aros_gcc_version" != "none"; then
1522             dnl If we are cross-compiling a native port with AROS compiler, we can reuse
1523             dnl AROS compiler for bootstrap ("kernel"). This eliminates a need for one more
1524             dnl ELF compiler.
1526             dnl Use target toolchain as bootstrap one.
1527             target_tool_prefix=${target_cpu}-aros-
1528             target_tool_version=$aros_gcc_version
1529             use_kernel_cc_wrapper=yes
1531             dnl Cancel explicit AROS tools assignment. This will cause configure
1532             dnl to select the same tools for bootstrap and AROS.
1533             aros_target_cc=
1534             aros_target_ld=
1535             aros_target_as=
1536             aros_target_ar=
1537             aros_target_ranlib=
1538             aros_target_nm=
1539             aros_target_strip=
1540             aros_target_objcopy=
1541             aros_target_objdump=
1542         fi
1543     fi
1545     CC=${target_tool_prefix}gcc
1546     dnl CPP is needed for AC_CHECK_HEADER to work correctly
1547     CPP=${target_tool_prefix}cpp
1548     if test "$target_tool_version" != "default"; then
1549         CC="$CC-$target_tool_version"
1550         CPP="$CC-$target_tool_version"
1551     fi
1552     if test "$crosstools" != "yes" ; then
1553         AC_PATH_PROG(CC,$CC)
1554         AROS_REQUIRED(gcc,$CC)
1555     else
1556         CC=$AROS_CROSSTOOLSDIR/$CC
1557     fi
1559 CC="$CC $target_tool_flags"
1561 #-----------------------------------------------------------------------------
1563 # Disable pointer-signedness warnings if the compiler recognises the option
1565 AC_MSG_CHECKING([whether ${CC} accepts -Wno-pointer-sign])
1566 save_cflags="$CFLAGS"
1567 if test "$crosstools" != "yes" ; then
1568     CFLAGS="$CFLAGS -Wno-pointer-sign"
1569     AC_TRY_COMPILE(,, use_no_sign_warning="yes", use_no_sign_warning="no")
1570 else
1571     # we do know it is supported for the smallest version of gcc we are going to build
1572     # we assume it's also supported by later versions
1573     use_no_sign_warning=yes
1575 AC_MSG_RESULT($use_no_sign_warning)
1576 if test "x-$use_no_sign_warning" = "x-yes" ; then
1577     aros_config_cflags="$aros_config_cflags -Wno-pointer-sign"
1579 CFLAGS="$save_cflags"
1581 #-----------------------------------------------------------------------------
1583 # Find all the tools we need to compile. This could be cross-compiling
1584 # though! If that is the case we use the GNU form of the target and
1585 # simply add this to the front of the binary name. This is rather simple,
1586 # but it should work under most circumstances.
1588 # The default tools are to use the same as the host, but only if the
1589 # host and target CPU are the same. With GCC this is normally enough.
1592 aros_cc_pre=""
1593 aros_shared_ld="$aros_host_ld"
1595 aros_target_mkdep="$aros_host_mkdep"
1596 aros_target_incl_def="$aros_host_incl"
1598 aros_kernel_cc="$CC"
1600 # The default tools executables to be linked to.
1601 if test "$rescomp" != ""; then
1602     if test "$cross_compiling" = "yes" ; then
1603         rescomp=${target_tool_prefix}${rescomp}
1604     fi
1605     AC_PATH_PROG(aros_kernel_rescomp,$rescomp)
1606     AROS_REQUIRED($rescomp,$aros_kernel_rescomp)
1609 if test "$crosstools" != "yes"; then
1610     AROS_TOOL_TARGET(aros_kernel_ld,ld,$aros_kernel_ld)
1611     AROS_REQUIRED(ld,$aros_kernel_ld)
1612     AROS_TOOL_TARGET(aros_kernel_ar,ar,$aros_kernel_ar)
1613     AROS_REQUIRED(ld,$aros_kernel_ar)
1614     AROS_TOOL_TARGET(aros_kernel_ranlib,ranlib,$aros_kernel_ranlib)
1615     AROS_REQUIRED(ld,$aros_kernel_ranlib)
1617     dnl For non-ELF hosts we additionally have to look up ELF toolchain for AROS binaries
1618     dnl It can be either AROS toolchain selected earlier or generic ELF toolchain we select here.
1619     if test "$target_tool_prefix" != "${target_cpu}-elf-" -a "$target_tool_prefix" != "${target_cpu}-aros-" ; then
1620         target_tool_prefix=${target_cpu}-elf-
1621         if test "$aros_target_cc" == ""; then
1622            aros_target_cc="${target_tool_prefix}gcc"
1623         fi
1624         if test "$aros_target_ld" == ""; then
1625            aros_target_ld="${target_tool_prefix}ld"
1626         fi
1627     fi
1628     AROS_TOOL_TARGET(aros_target_as_ln,as,$aros_target_as)
1629     AROS_REQUIRED(as,$aros_target_as_ln)
1630     AROS_TOOL_TARGET(aros_target_ar_ln,ar,$aros_target_ar)
1631     AROS_REQUIRED(ar,$aros_target_ar_ln)
1632     AROS_TOOL_TARGET(aros_target_nm_ln,nm,$aros_target_nm)
1633     AROS_REQUIRED(nm,$aros_target_nm_ln)
1634     AROS_TOOL_TARGET(aros_target_objcopy_ln,objcopy,$aros_target_objcopy)
1635     AROS_REQUIRED(objcopy,$aros_target_objcopy_ln)
1636     AROS_TOOL_TARGET(aros_target_objdump_ln,objdump,$aros_target_objdump)
1637     AROS_REQUIRED(objdump,$aros_target_objdump_ln)
1638     AROS_TOOL_TARGET(aros_target_ranlib_ln,ranlib,$aros_target_ranlib)
1639     AROS_REQUIRED(ranlib,$aros_target_ranlib_ln)
1640     AROS_TOOL_TARGET(aros_target_strip_ln,strip,$aros_target_strip)
1641     AROS_REQUIRED(strip,$aros_target_strip_ln)
1642     if test "$aros_target_cxx" != ""; then
1643         AC_PATH_PROG(aros_target_cxx,$aros_target_cxx)
1644         AROS_REQUIRED(c++,$aros_target_cxx)
1645     fi
1646 else
1647     aros_target_cc=$AROS_CROSSTOOLSDIR/$aros_target_cc
1648     aros_target_cxx=$AROS_CROSSTOOLSDIR/$aros_target_cxx
1649     aros_target_as_ln=$AROS_CROSSTOOLSDIR/$aros_target_as
1650     aros_target_ar_ln=$AROS_CROSSTOOLSDIR/$aros_target_ar
1651     aros_target_nm_ln=$AROS_CROSSTOOLSDIR/$aros_target_nm
1652     aros_target_objcopy_ln=$AROS_CROSSTOOLSDIR/$aros_target_objcopy
1653     aros_target_objdump_ln=$AROS_CROSSTOOLSDIR/$aros_target_objdump
1654     aros_target_ranlib_ln=$AROS_CROSSTOOLSDIR/$aros_target_ranlib
1655     aros_target_strip_ln=$AROS_CROSSTOOLSDIR/$aros_target_strip
1657     dnl FIXME: This works only for native ports. Hosted ports can't be compiled this way.
1658     aros_kernel_ar=$AROS_CROSSTOOLSDIR/$aros_target_ar
1659     aros_kernel_ld=$AROS_CROSSTOOLSDIR/$aros_target_ld
1660     aros_kernel_ranlib=$AROS_CROSSTOOLSDIR/$aros_target_ranlib
1662     crosstools_target=tools-crosstools
1665 aros_kernel_ar="$aros_kernel_ar $aros_kernel_ar_flags"
1667 orig_target_cc=$aros_kernel_cc
1668 orig_target_ld=$aros_kernel_ld
1670 if test "$crosstools" != "yes"; then
1671     if test "$aros_target_cc" != ""; then
1672         AC_PATH_PROG(aros_target_cc,$aros_target_cc)
1673         AROS_REQUIRED(gcc,$aros_target_cc)
1674         orig_target_cc=$aros_target_cc
1675     fi
1676     if test "$aros_target_ld" != ""; then
1677         AC_PATH_PROG(aros_target_ld,$aros_target_ld)
1678         AROS_REQUIRED(ld,$aros_target_ld)
1679         orig_target_ld=$aros_target_ld
1680     fi
1681 else
1682     orig_target_cc=$aros_target_cc
1683     orig_target_ld=$aros_target_ld
1686 # Build crosstools if we have no C++ - temporary thing 
1687 if test "$aros_target_cxx" = "" -a "$crosstools" != "yes"; then
1688     crosstools_cxx_target=tools-crosstools
1691 aros_hostcfg_dir="bin/${aros_host_arch}-${aros_host_cpu}/gen/config"
1692 aros_targetcfg_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/config"
1693 aros_inc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/AROS/Development/include/aros"
1694 aros_gendir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen"
1695 aros_geninc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/include/aros"
1696 aros_tools_dir="bin/${aros_host_arch}-${aros_host_cpu}/tools"
1697 aros_scripts_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/scripts"
1699 # aros_cc_pre is a variable that is added to the front of the compiler name
1700 # in the generated aros-gcc shell script. We need this to enable the cache
1701 # to work across cleaned builds. Also, support DISTCC using the correct
1702 # environment variable.
1705 if test "x${DISTCC}" != "x" ; then
1706     if test "x${CCACHE}" != "x" ; then
1707         aros_cc_pre="env CCACHE_PREFIX=${DISTCC} ${CCACHE} "
1708     else
1709         aros_cc_pre="${DISTCC} "
1710     fi
1711 else
1712     if test "x${CCACHE}" != "x" ; then
1713         aros_cc_pre="${CCACHE} "
1714     fi
1717 prefix="${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros"
1719 AC_SUBST(aros_target_nostdinc_cflags,-nostdinc)
1720 AC_SUBST(aros_target_nostartup_ldflags,-nostartfiles)
1721 AC_SUBST(aros_target_nix_ldflags,-nix)
1722 AC_SUBST(aros_target_detach_ldflags,-detach)
1723 AC_SUBST(aros_target_nostdlib_ldflags,-nostdlib)
1725 # Target tools
1726 if test "$crosstools" != "yes"; then
1727     if test "$GCC" = "yes"; then
1728         aros_target_cc_path=`$orig_target_cc -print-search-dirs | grep "programs: =" | cut -c 12-`
1729     fi
1730 else
1731     # We do not know which gcc version we are going to build and what we need to know
1732     # here is different for different versions so this will be set later during the
1733     # build of crosstools.
1734     aros_target_cc_path=@aros_target_cc_path@
1736 aros_target_cc="${prefix}-gcc"
1737 aros_target_as="${prefix}-as"
1738 aros_target_ld="${prefix}-ld"
1739 aros_target_ar="${prefix}-ar $aros_target_ar_flags"
1740 aros_target_objcopy=${prefix}-objcopy
1741 aros_target_objdump=${prefix}-objdump
1742 aros_target_ranlib="${prefix}-ranlib $aros_target_ranlib_flags"
1743 aros_target_nm="${prefix}-nm $aros_target_nm_flags"
1744 aros_target_strip=${prefix}-strip
1745 aros_plain_nm="${prefix}-nm"
1746 aros_plain_ar="${prefix}-ar"
1748 # Find the system include path. We can suggest that an alternative is
1749 # used if we don't get it correct. The default is to use /usr/include.
1750 # Which is set in the aros_target_incl_def variable.
1752 AC_ARG_ENABLE(includes,
1753 AC_HELP_STRING([--enable-includes=dir],[Alternative system include directory]),
1754 [aros_target_incl=$enable_includes], [aros_target_incl=$aros_target_incl_def])
1756 if test "$aros_kernel_includes" = ""; then
1757     if test "x-$aros_flavour" = "x-emulation" -o "x-$aros_flavour" = "x-emulcompat" ; then
1758         # FIXME: for cross-compiling this should point to another location
1759         aros_kernel_includes="-isystem $aros_target_incl"
1760     fi
1763 if test "$aros_kernel_includes" != "" ; then
1764     dnl find out about the kernel cc's include path
1765     AC_MSG_CHECKING([for the kernel compiler's include path])
1766     if test "$aros_kernel_cc_includes" = "" ; then
1767         # Try to guess where the directory is.
1768         aros_kernel_cc_includes=`dirname \`${aros_kernel_cc} ${aros_kernel_cflags} -print-libgcc-file-name\``/include
1769         if test -d $aros_kernel_cc_includes; then
1770             # Check if there is also an include-fixed directory and add it
1771             # to kernel compiler's include path as it may contain some of
1772             # the headers we need.
1773             if test -d "$aros_kernel_cc_includes"-fixed; then
1774                 aros_kernel_cc_includes+=" -isystem $aros_kernel_cc_includes"-fixed
1775             fi
1776         else
1777             # The directory doesn't exist, we need to do some more work.
1778             aros_kernel_cc_includes=${PWD}/${aros_gendir}/cc_include
1780             # These are the headers we're looking for.
1781             headers="limits.h mmintrin.h stdbool.h syslimits.h float.h \
1782                      stddef.h xmmintrin.h iso646.h stdarg.h unwind.h   \
1783                      zutil.h"
1785             dirs=
1786             for h in $headers; do
1787                 # Which other headers are needed by each of the above?
1788                 deps=$(echo "#include <$h>" | \
1789                        $aros_kernel_cc -E -M - 2>/dev/null | \
1790                        sed 's/^.*://; s/\\$/ /g; s/[[ \t]]\+/ /g')
1792                 # Copy all the needed headers to a directory beneath gendir.
1793                 for d in $deps; do
1794                     h=$(basename $d)
1795                     dir=${aros_kernel_cc_includes}$(echo $(dirname $d) | \
1796                                                 sed -n "s,^.*/include\(/.*\),\1,p")
1797                     ! test -d $dir && mkdir -p $dir
1798                     ! test -f $dir/$h && { cp $d $dir; chmod u+w $dir/$h; }
1799                 done
1800             done            
1801         fi
1802     fi
1803     AC_MSG_RESULT($aros_kernel_cc_includes)
1804     # Adding -nostdinc to kernel includes as they are always used together.
1805     aros_kernel_includes="$aros_kernel_includes $aros_target_nostdinc_cflags -isystem $aros_kernel_cc_includes"
1808 if test "$crosstools" != "yes"; then
1809     dnl find out about the target cc's include path
1810     AC_MSG_CHECKING([for the target compiler's include path])
1811     if test "$aros_target_cc_includes" = "" ; then
1812         #try to guess where the directory is
1813         aros_target_cc_includes=`dirname \`${orig_target_cc} -print-libgcc-file-name\``/include
1814         if ! test -d $aros_target_cc_includes; then
1815             #the directory doesn't exist, we need to do some more work
1816             aros_target_cc_includes=${PWD}/${aros_gendir}/cc_include
1817         
1818             #these are the headers we're looking for
1819             headers="limits.h mmintrin.h stdbool.h syslimits.h float.h \
1820                     stddef.h xmmintrin.h iso646.h stdarg.h unwind.h   \
1821                     zutil.h"
1823             dirs=
1824             for h in $headers; do
1825                 #which other headers each of the above headers needs?
1826                 deps=$(echo "#include <$h>" | \
1827                     $orig_target_cc -E -M - 2>/dev/null | \
1828                     sed 's/^.*://; s/\\$/ /g; s/[[ \t]]\+/ /g')
1829             
1830                 #copy all the needed headers to a directory beneath gendir
1831                 for d in $deps; do
1832                     h=$(basename $d)
1833                     dir=${aros_target_cc_includes}$(echo $(dirname $d) | \
1834                                                 sed -n "s,^.*/include\(/.*\),\1,p")
1835                     ! test -d $dir && mkdir -p $dir
1836                     ! test -f $dir/$h && { cp $d $dir; chmod u+w $dir/$h; }
1837                 done
1838             done
1839         fi
1840     fi
1841     AC_MSG_RESULT($aros_target_cc_includes)
1842 else
1843     # We do not know which gcc version we are going to build and what we need to know
1844     # here is different for different versions so this will be set later during the
1845     # build of crosstools.
1846     aros_target_cc_includes=@aros_target_cc_includes@
1850 # For GCC < 4.0 -I- is used for giving the search path for '#include "..."'
1851 # On GCC >= 4.0 -iquote should be used
1854 save_cc="$CC"
1855 save_cflags="$CFLAGS"
1856 CFLAGS="-iquote."
1857 AC_MSG_CHECKING([whether ${CC} accepts -iquote])
1858 if test "x-$crosstools" != "x-yes"; then
1859     AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
1860 else
1861     # we do know it is supported for the smallest version of gcc we are going to build
1862     # we assume it's also supported by later versions
1863     has_iquote=yes
1865 AC_MSG_RESULT($has_iquote)
1866 if test "x-$has_iquote" = "x-yes" ; then
1867     host_cflags_iquote=-iquote
1868     host_cflags_iquote_end=
1869 else
1870     host_cflags_iquote=-I
1871     host_cflags_iquote_end=-I-
1873 kernel_cflags_iquote=$host_cflags_iquote
1874 kernel_cflags_iquote_end=$host_cflags_iquote_end
1875 if test "x-$cross_compiling" = "x-yes"; then
1876     CC="$aros_kernel_cc"
1877     AC_MSG_CHECKING([whether ${CC} accepts -fno-stack-protector])
1878     if test "x-$crosstools" != "x-yes"; then
1879         AC_TRY_COMPILE(,, use_no_stack_protector="yes", use_no_stack_protector="no")
1880     else
1881         # we do know it is supported for the smallest version of gcc we are going to build
1882         # we assume it's also supported by later versions
1883         use_no_stack_protector=yes
1884     fi
1885     AC_MSG_RESULT($use_no_stack_protector)
1886     AC_MSG_CHECKING([whether ${CC} accepts -iquote])
1887     if test "x-$crosstools" != "x-yes"; then
1888         AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
1889     else
1890         # we do know it is supported for the smallest version of gcc we are going to build
1891         # we assume it's also supported by later versions
1892         has_iquote=yes
1893     fi
1894     AC_MSG_RESULT($has_iquote)
1895     if test "x-$has_iquote" = "x-yes" ; then
1896         kernel_cflags_iquote=-iquote
1897         kernel_cflags_iquote_end=
1898     else
1899         kernel_cflags_iquote=-I
1900         kernel_cflags_iquote_end=-I-
1901     fi
1903 aros_cflags_iquote=$kernel_cflags_iquote
1904 aros_cflags_iquote_end=$kernel_cflags_iquote_end
1905 if test "$orig_target_cc" != "$aros_kernel_cc"; then
1906     CC="$orig_target_cc"
1907     AC_MSG_CHECKING([whether ${CC} accepts -iquote])
1908     if test "x-$crosstools" != "x-yes"; then
1909         AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
1910     else
1911         # we do know it is supported for the smallest version of gcc we are going to build
1912         # we assume it's also supported by later versions
1913         has_iquote=yes
1914     fi
1915     AC_MSG_RESULT($has_iquote)
1916     if test "x-$has_iquote" = "x-yes" ; then
1917         aros_cflags_iquote=-iquote
1918         aros_cflags_iquote_end=
1919     else
1920         aros_cflags_iquote=-I
1921         aros_cflags_iquote_end=-I-
1922     fi
1924 if test "x-$use_no_stack_protector" = "x-yes" ; then
1925     aros_kernel_cflags="$aros_kernel_cflags -fno-stack-protector"
1928 #-----------------------------------------------------------------------------
1930 # Check if we can explicitly choose older version of symbol hashing
1932 CFLAGS="save_cflags -Wl,--hash-style=sysv"
1933 CC="$aros_kernel_cc"
1934 AC_MSG_CHECKING([whether ${CC} accepts -Wl,--hash-style=sysv])
1935 AC_TRY_LINK(,, use_hash_style="yes", use_hash_style="no")
1936 AC_MSG_RESULT($use_hash_style)
1937 if test "x-$use_hash_style" = "x-yes" ; then
1938     aros_kernel_cflags="$aros_kernel_cflags -Wl,--hash-style=sysv"
1940 CC="$save_cc"
1941 CFLAGS="$save_cflags"
1943 AC_SUBST(host_cflags_iquote)
1944 AC_SUBST(host_cflags_iquote_end)
1945 AC_SUBST(kernel_cflags_iquote)
1946 AC_SUBST(kernel_cflags_iquote_end)
1947 AC_SUBST(aros_cflags_iquote)
1948 AC_SUBST(aros_cflags_iquote_end)
1951 dnl Check if user specified --with-resolution=XRESxYRESxDEPTH
1952 AC_MSG_CHECKING([for default resolution of WBScreen])
1953 AC_ARG_WITH(resolution,AC_HELP_STRING([--with-resolution=XRESxYRESxDEPTH],[Default resolution of the initial WorkbenchScreen]),resolution=$withval,resolution=none)
1954 # We require an argument, so map --with/--without ("yes"/"no") to "none" specified
1955 if test "$resolution" = "yes" ; then
1956     resolution="none"
1958 if test "$resolution" = "no" ; then
1959     resolution="none"
1961 if test "$resolution" != "none" ; then
1962     aros_default_wbwidth=`echo $resolution | cut -d'x' -f1`
1963     aros_default_wbheight=`echo $resolution | cut -d'x' -f2`
1964     aros_default_wbdepth=`echo $resolution | cut -d'x' -f3`
1966 AC_MSG_RESULT($aros_default_wbwidth x $aros_default_wbheight x $aros_default_wbdepth)
1967 aros_cv_default_wbwidth=$aros_default_wbwidth
1968 aros_cv_default_wbheight=$aros_default_wbheight
1969 aros_cv_default_wbdepth=$aros_default_wbdepth
1971 dnl See if the user wants the serial debug output for native flavour
1972 AC_MSG_CHECKING([if serial debug is enabled])
1973 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)
1974 if test "$aros_serial_debug" = 0 ; then
1975     serial_debug_forced=""
1976     if test "$serial_debug" = "yes" ; then
1977         serial_debug="1"
1978     fi
1979     if test "$serial_debug" = "no" ; then
1980         serial_debug="none"
1981     fi
1982 else
1983     serial_debug_forced="(forced)"
1984     serial_debug=$aros_serial_debug
1986 if test "$serial_debug" != "none" ; then
1987     aros_serial_debug=$serial_debug
1988     AC_MSG_RESULT($serial_debug_forced on port $serial_debug)
1989 else
1990     AC_MSG_RESULT(no)
1993 dnl See if the user wants the palm debug output hack for palm native flavour
1994 AC_MSG_CHECKING([if palm debug hack is enabled])
1995 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")
1996 if test "$palm_debug_hack" = "yes" ; then
1997     aros_palm_debug_hack="1"
1999 AC_MSG_RESULT($palm_debug_hack)
2001 dnl See if the user wants the usb3.0 code
2002 AC_MSG_CHECKING([if usb3.0 code is enabled])
2003 AC_ARG_ENABLE(usb30_code,AC_HELP_STRING([--enable-usb30-code],[Enable usb3.0 code (default=no)]),usb30_code="yes",usb30_code="no")
2004 if test "$usb30_code" = "yes" ; then
2005     aros_usb30_code="1"
2006 else
2007     aros_usb30_code="0"
2009 AC_MSG_RESULT($usb30_code)
2011 dnl See if the user wants nesting supervisor activated for unix flavour
2012 AC_MSG_CHECKING([if nesting supervisor support is enabled])
2013 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")
2014 if test "$nesting_supervisor" = "yes" ; then
2015     aros_nesting_supervisor="1"
2017 AC_MSG_RESULT($nesting_supervisor)
2019 dnl See if the user wants to disable MMU support
2020 dnl This can be overriden on per-target basis,
2021 dnl set $aros_enable_mmu to "yes" or "no" to do this
2022 if test "$aros_enable_mmu" = "" ; then
2023     AC_MSG_CHECKING([if MMU support is enabled])
2024     dnl Enabled by default
2025     AC_ARG_ENABLE(mmu,AC_HELP_STRING([--disable-mmu],[Disable MMU support (default=enabled)]),aros_enable_mmu=$enableval,aros_enable_mmu="yes")
2026     if test "$aros_enable_mmu" = "" ; then
2027         aros_enable_mmu="yes"
2028     fi
2029     AC_MSG_RESULT($aros_enable_mmu)
2031 if test "$aros_enable_mmu" = "no" ; then
2032     aros_enable_mmu="0"
2033 else
2034     aros_enable_mmu="1"
2036     
2038 dnl things specifically required for hosted flavours
2039 if test "x-$aros_flavour" = "x-emulation" -o "x-$aros_flavour" = "x-emulcompat" ; then
2041     if test "x-$need_dlopen" != "x-no" ; then
2042       dnl some kind of dynamic library access system is required for hostlib.resource
2043       AC_CHECK_FUNC(dlopen, have_dl="yes", have_dl="no")
2044       if test "x-$have_dl" = "x-no" ; then
2045           AC_CHECK_LIB(dl, dlopen, [have_dl="yes"
2046                                     aros_host_ldflags="$aros_host_ldflags -ldl"],
2047                                     have_dl="no")
2048       fi
2049       if test "x-$have_dl" = "x-no" ; then
2050           AC_MSG_ERROR([dlopen() dynamic linker functions not available])
2051       fi
2052     fi
2055     dnl x11 hidd
2056     AC_ARG_ENABLE(x11_hidd, AC_HELP_STRING([--enable-x11-hidd],
2057                                            [build X11 hidd for hosted (default=auto)]),
2058                                            x11_hidd="$enableval",
2059                                            x11_hidd="$need_x11")
2060     case "x-$x11_hidd" in
2061         x-yes|x-no|x-auto)                 ;;
2062         *)                 x11_hidd="$need_x11" ;;
2063     esac
2065     ENABLE_X11=0
2067     dnl they want it
2068     if test "x-$x11_hidd" != "x-no" ; then
2070         dnl find x11 stuff
2071         AC_PATH_X
2073         x_cflags=
2074         for path in $x_libraries
2075         do
2076             x_cflags="$x_cflags -L$path"
2077         done
2079         for path in $x_includes
2080         do
2081             x_cflags="$x_cflags -I$path"
2082         done
2083         
2084         if test "x-$no_x" = "x-yes" ; then
2086             dnl didn't find it
2087             if test "x-$x11_hidd" != "x-auto" ; then
2088                 dnl and they explicitly asked for it, bail out
2089                 AC_MSG_ERROR([X11 libs/headers not found, cannot build X11 hidd as requested])
2090             fi
2091         
2092         else
2093             dnl found it, setup the metatarget
2094             x11_hidd_target=kernel-x11gfx-kobj
2095             ENABLE_X11=1
2097             dnl setup shared memory extensions
2098             AC_ARG_ENABLE(x11_shm, AC_HELP_STRING([--enable-x11-shm],
2099                                                   [use X11 shared memory (default=auto)]),
2100                                                   x11_hidd_shm="$enableval",
2101                                                   x11_hidd_shm="auto")
2102             case "x-$x11_hidd_shm" in
2103                 x-yes|x-no|x-auto)                     ;;
2104                 *)                 x11_hidd_shm="auto" ;;
2105             esac
2107             have_xshm=no
2109             dnl they want it
2110             if test "x-$x11_hidd_shm" != "x-no" ; then
2112                 dnl system shm headers
2113                 AC_CHECK_HEADERS(sys/ipc.h)
2114                 AC_CHECK_HEADERS(sys/shm.h)
2116                 dnl got them
2117                 if test "x-$ac_cv_header_sys_ipc_h" = "x-yes" -a "x-$ac_cv_header_sys_shm_h" = "x-yes" ; then
2119                     dnl make sure X libs have shm functions
2120                     save_cflags="$CFLAGS"
2121                     CFLAGS="$CFLAGS $x_cflags"
2122                     AC_CHECK_LIB(Xext, XShmQueryExtension, have_xshm=yes)
2123                     CFLAGS="$save_cflags"
2124                 fi
2125             fi
2127             dnl detection done, prepare output
2128             if test "x-$have_xshm" = "x-yes" ; then
2129                 dnl we can do shm
2130                 DO_XSHM_SUPPORT="1"
2131             elif test "x-$x11_hidd_shm" = "x-yes" ; then
2132                 dnl they explicitly asked for it, but we can't do it
2133                 AC_MSG_ERROR([X11 has no support for shared memory, cannot enable it as requested])
2134             else
2135                 dnl otherwise just disable it
2136                 DO_XSHM_SUPPORT="0"
2137             fi
2139             
2140             dnl setup vidmode (fullscreen) extensions
2141             AC_ARG_ENABLE(x11_vidmode, AC_HELP_STRING([--enable-x11-vidmode],
2142                                                       [use X11 vidmode extension (default=auto)]),
2143                                                       x11_hidd_vidmode="$enableval",
2144                                                       x11_hidd_vidmode="auto")
2145             case "x-$x11_hidd_vidmode" in
2146                 x-yes|x-no|x-auto)                         ;;
2147                 *)                 x11_hidd_vidmode="auto" ;;
2148             esac
2150             have_vidmode=no
2152             dnl they want it
2153             if test "x-$x11_hidd_vidmode" != "x-no" ; then
2155                 dnl make sure X libs have vidmode functions
2156                 save_cflags="$CFLAGS"
2157                 CFLAGS="$CFLAGS $x_cflags"
2158                 AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryExtension, have_vidmode=yes)
2159                 CFLAGS="$save_cflags"
2160             fi
2162             dnl detection done, prepare output
2163             if test "x-$have_vidmode" = "x-yes" ; then
2164                 dnl we can do vidmode
2165                 DO_VIDMODE_SUPPORT="1"
2166             elif test "x-$x11_hidd_vidmode" = "x-yes" ; then
2167                 dnl they explicitly asked for it, but we can't do it
2168                 AC_MSG_ERROR([X11 vidmode extension not available, cannot enable it as requested])
2169             else
2170                 dnl otherwise just disable it
2171                 DO_VIDMODE_SUPPORT="0"
2172             fi
2173         fi
2175         aros_host_x11_includes=$x_includes 
2176         aros_host_x11_libdirs=$x_libraries
2177     fi
2180     dnl sdl hidd
2181     AC_ARG_ENABLE(sdl_hidd, AC_HELP_STRING([--enable-sdl-hidd],
2182                                            [build SDL hidd for hosted (default=auto)]),
2183                                            sdl_hidd="$enableval",
2184                                            sdl_hidd="auto")
2185     case "x-$sdl_hidd" in
2186         x-yes|x-no|x-auto)                 ;;
2187         *)                 sdl_hidd="auto" ;;
2188     esac
2190     dnl they want it
2191     if test "x-$sdl_hidd" != "x-no" ; then
2193         dnl find sdl
2194         AM_PATH_SDL([1.2.10], have_sdl="yes", have_sdl="no")
2196         if test "x-$have_sdl" != "x-yes" ; then
2198             dnl didn't find it
2199             if test "x-$sdl_hidd" != "x-auto" ; then
2200                 dnl and they explicitly asked for it, bail out
2201                 AC_MSG_ERROR([SDL libs/headers not found, cannot build SDL hidd as requested])
2202             fi
2204         else
2205             dnl found it, set up the metatarget
2206             sdl_hidd_target=kernel-hidd-sdl
2207             aros_host_sdl_cflags=SDL_CFLAGS
2208             aros_host_sdl_libs=SDL_LIBS
2209         fi
2210     fi
2212     dnl oss.library
2213     AC_CHECK_HEADER(sys/soundcard.h)
2214     if test "x-$ac_cv_header_sys_soundcard_h" = "x-yes" ; then
2215         oss_library_target=workbench-libs-oss-unix
2216     fi
2220 dnl See if the user wants dbus.library
2221 AC_MSG_CHECKING([if building of dbus.library is enabled])
2222 AC_ARG_ENABLE(dbus,AC_HELP_STRING([--enable-dbus],[Enable DBUS support via dbus.library (default=no)]),dbus="yes",dbus="no")
2223 if test "$dbus" = "yes" ; then
2224     ENABLE_DBUS=1
2225     DBUS_CFLAGS=`pkg-config --cflags dbus-1`
2226     DBUS_LIBFLAGS=`pkg-config --libs dbus-1`
2227     KERNEL_DBUS_KOBJ=kernel-dbus-kobj
2228     KERNEL_DBUS_INCLUDES=kernel-dbus-includes
2229 else
2230     ENABLE_DBUS=0
2232 AC_MSG_RESULT($dbus)
2234 if test "$use_kernel_cc_wrapper" = "yes" ; then
2235     aros_kernel_cc="${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-elf-gcc"
2238 dnl --------------------------------------------------------------------
2239 dnl Configuration Output Section
2240 dnl --------------------------------------------------------------------
2242 # Generic
2243 AC_SUBST(aros_arch)
2244 AC_SUBST(aros_cpu)
2245 AC_SUBST(aros_flavour)
2246 AC_SUBST(aros_flavour_uc)
2247 AC_SUBST(AROS_BUILDDIR)
2248 AC_SUBST(AROS_BUILDDIR_UNIX)
2249 AC_SUBST(SRCDIR)
2250 AC_SUBST(AROS_CROSSTOOLSDIR)
2251 AC_SUBST(AROS_PORTSSRCDIR)
2253 # Compatability with other Amiga-like operation systems
2254 AC_SUBST(aros_amigaos_compliance)
2256 # Host related
2257 AC_SUBST(aros_cc_pre)
2258 AC_SUBST(aros_host_strip)
2259 AC_SUBST(aros_host_arch)
2260 AC_SUBST(aros_host_cpu)
2261 AC_SUBST(aros_host_cc)
2262 AC_SUBST(aros_host_ar)
2263 AC_SUBST(aros_host_ranlib)
2264 AC_SUBST(aros_host_ld)
2265 AC_SUBST(aros_host_make)
2266 AC_SUBST(aros_host_cflags)
2267 AC_SUBST(gnu89_inline)
2268 AC_SUBST(aros_host_ldflags)
2269 AC_SUBST(aros_host_debug)
2270 AC_SUBST(aros_host_mkdep)
2271 AC_SUBST(aros_host_mkargs)
2272 AC_SUBST(aros_host_exe_suffix)
2273 AC_SUBST(aros_host_lib_suffix)
2274 AC_SUBST(aros_tools_dir)
2275 AC_SUBST(aros_host_aclocal)
2276 AC_SUBST(aros_host_autoconf)
2277 AC_SUBST(aros_host_autoheader)
2278 AC_SUBST(aros_host_automake)
2280 # Target Related
2281 AC_SUBST(aros_target_guitheme)
2282 AC_SUBST(aros_target_iconset)
2283 AC_SUBST(aros_target_bootloader)
2284 AC_SUBST(aros_target_arch)
2285 AC_SUBST(aros_target_family)
2286 AC_SUBST(aros_target_cpu)
2287 AC_SUBST(aros_target_variant)
2288 AC_SUBST(aros_target_suffix)
2289 AC_SUBST(aros_target_incl)
2290 AC_SUBST(aros_target_ar)
2291 AC_SUBST(aros_target_ranlib)
2292 AC_SUBST(aros_plain_nm)
2293 AC_SUBST(aros_plain_ar)
2294 AC_SUBST(aros_kernel_ar)
2295 AC_SUBST(aros_kernel_ranlib)
2296 AC_SUBST(orig_target_cc)
2297 AC_SUBST(aros_target_cc)
2298 AC_SUBST(aros_target_cxx)
2299 AC_SUBST(aros_kernel_cc)
2300 AC_SUBST(aros_target_as)
2301 AC_SUBST(orig_target_ld)
2302 AC_SUBST(aros_target_ld)
2303 AC_SUBST(aros_kernel_ld)
2304 AC_SUBST(aros_target_cc_includes)
2305 AC_SUBST(aros_target_cc_path)
2306 AC_SUBST(aros_target_objdump)
2307 AC_SUBST(aros_target_objcopy)
2308 AC_SUBST(aros_target_strip)
2309 AC_SUBST(aros_target_nm)
2310 AC_SUBST(aros_kernel_rescomp)
2311 AC_SUBST(aros_shared_default)
2312 AC_SUBST(aros_shared_ld)
2313 AC_SUBST(aros_object_format)
2314 AC_SUBST(aros_compiler_libs)
2315 AC_SUBST(aros_arch_libs)
2317 AC_SUBST(aros_config_cflags)
2318 AC_SUBST(aros_config_aflags)
2319 AC_SUBST(aros_config_ldflags)
2321 AC_SUBST(aros_shared_cflags)
2322 AC_SUBST(aros_shared_aflags)
2323 AC_SUBST(aros_shared_ldflags)
2324 AC_SUBST(aros_kernel_cflags)
2325 AC_SUBST(aros_kernel_includes)
2326 AC_SUBST(aros_kernel_objcflags)
2327 AC_SUBST(aros_kernel_ldflags)
2328 AC_SUBST(aros_target_cflags)
2329 AC_SUBST(aros_debug_cflags)
2330 AC_SUBST(aros_debug_aflags)
2331 AC_SUBST(aros_debug_ldflags)
2332 AC_SUBST(aros_target_genmap)
2333 AC_SUBST(aros_target_strip_flags)
2335 AC_SUBST(crosstools_target)
2336 AC_SUBST(crosstools_cxx_target)
2338 # Graphics Related
2339 AC_SUBST(x11_hidd_target)
2340 AC_SUBST(sdl_hidd_target)
2341 AC_SUBST(pci_hidd_target)
2342 AC_SUBST(oss_library_target)
2344 AC_SUBST(aros_default_wbwidth)
2345 AC_SUBST(aros_default_wbheight)
2346 AC_SUBST(aros_default_wbdepth)
2347 AC_SUBST(DO_XSHM_SUPPORT)
2348 AC_SUBST(DO_VIDMODE_SUPPORT)
2350 AC_SUBST(aros_host_x11_includes)
2351 AC_SUBST(aros_host_x11_libdirs)
2352 AC_SUBST(aros_host_sdl_cflags)
2353 AC_SUBST(aros_host_sdl_libs)
2355 # Native version related
2356 AC_SUBST(aros_serial_debug)
2358 # Palm native version related
2359 AC_SUBST(aros_palm_debug_hack)
2361 # USB3.0 code
2362 AC_SUBST(aros_usb30_code)
2364 # Unix/Hosted version related
2365 AC_SUBST(aros_nesting_supervisor)
2367 # MMU related
2368 AC_SUBST(aros_enable_mmu)
2370 # Apple iOS related
2371 AC_SUBST(aros_ios_platform)
2372 AC_SUBST(aros_ios_version)
2373 AC_SUBST(aros_ios_sdk)
2375 # Android related
2376 AC_SUBST(android_tool)
2377 AC_SUBST(aros_android_level)
2379 # DBUS related
2380 AC_SUBST(ENABLE_DBUS)
2381 AC_SUBST(DBUS_CFLAGS)
2382 AC_SUBST(DBUS_LIBFLAGS)
2383 AC_SUBST(KERNEL_DBUS_KOBJ)
2384 AC_SUBST(KERNEL_DBUS_INCLUDES)
2386 #X11 related
2387 AC_SUBST(ENABLE_X11)
2389 # Debug related
2390 AC_SUBST(aros_debug)
2391 AC_SUBST(aros_mungwall_debug)
2392 AC_SUBST(aros_stack_debug)
2393 AC_SUBST(aros_modules_debug)
2395 # Collect-aros stuff: "-ius" to ignore undefined symbols
2396 AC_SUBST(ignore_undefined_symbols)
2398 # C compiler related
2399 AC_SUBST(gcc_target_cpu)
2401 dnl Prepare for output, make up all the generated patches
2402 case "$aros_flavour" in
2403 emulation)      aros_flavour_uc="AROS_FLAVOUR_EMULATION"
2404                 aros_flavour="emulation" ;;
2405 emulcompat)     aros_flavour_uc="(AROS_FLAVOUR_EMULATION|AROS_FLAVOUR_BINCOMPAT)"
2406                 aros_flavour="emulation" ;;
2407 standalone)     aros_flavour_uc="AROS_FLAVOUR_STANDALONE"
2408                 aros_flavour="standalone";;
2409 standcompat)    aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_BINCOMPAT)"
2410                 aros_flavour="standalone";;
2411 native)         aros_flavour_uc="AROS_FLAVOUR_NATIVE"
2412                 aros_flavour="native" ;;
2413 nativecompat)   aros_flavour_uc="(AROS_FLAVOUR_NATIVE|AROS_FLAVOUR_BINCOMPAT)"
2414                 aros_flavour="native" ;;
2415 linklib)        aros_flavour_uc="AROS_FLAVOUR_LINKLIB"
2416                 aros_flavour="linklib" ;;
2417 palmnative)     aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
2418                 aros_flavour="palmnative" ;;
2419 mac68knative)   aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
2420                 aros_flavour="mac68knative" ;;
2421 ppcnative)      aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_BINCOMPAT)"
2422                 aros_flavour="ppcnative" ;;
2423 esac
2425 if test ! -d ${aros_inc_dir} ; then
2426     ${MKDIR} ${aros_inc_dir}
2428 if test ! -d ${aros_geninc_dir} ; then
2429     ${MKDIR} ${aros_geninc_dir}
2431 if test ! -d ${aros_hostcfg_dir} ; then
2432     ${MKDIR} ${aros_hostcfg_dir}
2434 if test ! -d ${aros_targetcfg_dir} ; then
2435     ${MKDIR} ${aros_targetcfg_dir}
2437 if test ! -d ${aros_tools_dir} ; then
2438     ${MKDIR} ${aros_tools_dir}
2440 if test ! -d ${aros_scripts_dir} ; then
2441     ${MKDIR} ${aros_scripts_dir}
2444 AC_CONFIG_HEADERS(${aros_geninc_dir}/host-conf.h:config/host-conf.h.in)
2446 AC_CONFIG_COMMANDS([compiler_executable],
2447     [
2448         prefix=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}
2449         mkdir -p $prefix
2450         prefix="${prefix}/${aros_target_cpu}-aros"
2451         prefix2=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros
2452         prefix3=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-elf
2454         echo ${prefix}
2455         echo ${prefix2}
2456         echo ${prefix3}
2457         chmod a+x ${prefix2}-gcc ${prefix2}-ld ${prefix3}-gcc
2459         ln -sf ${prefix2}-gcc          ${prefix}-gcc
2460         ln -sf ${prefix2}-ld           ${prefix}-ld
2462         ln -sf $aros_target_as_ln$aros_host_exe_suffix      ${prefix}-as
2463         ln -sf $aros_target_nm_ln$aros_host_exe_suffix      ${prefix}-nm
2464         ln -sf $aros_target_ar_ln$aros_host_exe_suffix      ${prefix}-ar
2465         ln -sf $aros_target_ranlib_ln$aros_host_exe_suffix  ${prefix}-ranlib
2466         ln -sf $aros_target_objcopy_ln$aros_host_exe_suffix ${prefix}-objcopy
2467         ln -sf $aros_target_objdump_ln$aros_host_exe_suffix ${prefix}-objdump
2468         ln -sf $aros_target_strip_ln$aros_host_exe_suffix   ${prefix}-strip
2470         ln -sf $aros_target_as_ln$aros_host_exe_suffix      ${prefix2}-as
2471         ln -sf $aros_target_nm_ln$aros_host_exe_suffix      ${prefix2}-nm
2472         ln -sf $aros_target_ar_ln$aros_host_exe_suffix      ${prefix2}-ar
2473         ln -sf $aros_target_ranlib_ln$aros_host_exe_suffix  ${prefix2}-ranlib
2474         ln -sf $aros_target_objcopy_ln$aros_host_exe_suffix ${prefix2}-objcopy
2475         ln -sf $aros_target_objdump_ln$aros_host_exe_suffix ${prefix2}-objdump
2476         ln -sf $aros_target_strip_ln$aros_host_exe_suffix   ${prefix2}-strip
2478         ln -sf $aros_kernel_ld$aros_host_exe_suffix         ${prefix3}-ld
2479     ],
2480     [
2481         aros_host_exe_suffix=${aros_host_exe_suffix}
2482         aros_tools_dir=${aros_tools_dir}
2483         aros_target_cpu=${aros_target_cpu}
2484         aros_target_arch=${aros_target_arch}
2485         aros_target_suffix=${aros_target_suffix}
2486         aros_target_nm_ln=${aros_target_nm_ln}
2487         aros_target_as_ln=${aros_target_as_ln}
2488         aros_target_ar_ln=${aros_target_ar_ln}
2489         aros_target_ranlib_ln=${aros_target_ranlib_ln}
2490         aros_target_objdump_ln=${aros_target_objdump_ln}
2491         aros_target_objcopy_ln=${aros_target_objcopy_ln}
2492         aros_target_strip_ln=${aros_target_strip_ln}
2493         aros_kernel_ld=${aros_kernel_ld}
2494     ]
2496 AC_CONFIG_COMMANDS([genmf_executable],
2497     [chmod a+x ${aros_tools_dir}/genmf.py],
2498     [aros_tools_dir=${aros_tools_dir}]
2501 AC_CONFIG_FILES(
2502     Makefile
2503     config/make.cfg
2504     ${aros_inc_dir}/config.h:config/config.h.in
2505     ${aros_geninc_dir}/config.h:config/config.h.in
2506     ${aros_hostcfg_dir}/host.cfg:config/host.cfg.in
2507     ${aros_targetcfg_dir}/target.cfg:config/target.cfg.in
2508     mmake.config
2509     ${aros_targetcfg_dir}/make.defaults:config/make.defaults.in
2510     ${aros_targetcfg_dir}/specs:config/specs.in
2511     ${aros_targetcfg_dir}/elf-specs:${elf_specs_in}
2512     ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-gcc:scripts/aros-gcc.in
2513     ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-elf-gcc:scripts/elf-gcc.in
2514     ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-ld:scripts/aros-ld.in
2515     ${aros_tools_dir}/genmf.py:tools/genmf/genmf.py
2516     tools/collect-aros/env.h
2517     ${aros_gendir}/arch/all-android/bootstrap/app/default.properties:arch/all-android/bootstrap/app/default.properties.in
2520 AC_OUTPUT
2522 dnl This is in order to not define SHARED_CFLAGS sometimes
2523 dnl We don't always do aros_shared_ar, aros_shared_cflags
2525 #XXX compatability...
2526 aros_shared_ar="$aros_shared_ld $aros_shared_ldflags -o"
2528 if test -n "$aros_shared_cflags" ; then
2529     echo "SHARED_CFLAGS := $aros_shared_cflags" >> ${aros_hostcfg_dir}/host.cfg
2530     echo "SHARED_AR := $aros_shared_ar" >> ${aros_hostcfg_dir}/host.cfg