- Do not pre-fill memory allocated with AllocAbs when mungwall is active:
[AROS.git] / configure.in
blobb1af9a5af15891664ae1b7695489605d0e927e22
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     cross_compile=no
37 else
38     if test "$target" = "" ; then
39         target=$host_os-$host_cpu
40         cross_compile=no
41     else
42         cross_compile=yes
43     fi
45 AC_MSG_RESULT($target)
47 if test "$host_os" = "mingw32" ; then
48     PWDCMD="pwd -W"
51 #don't know where else to put this...
52 AC_MSG_CHECKING([Building AROS in .. ])
53 AROS_BUILDDIR=`${PWDCMD-pwd}`
54 AROS_BUILDDIR_UNIX=${PWD}
55 AC_MSG_RESULT($AROS_BUILDDIR)
57 AC_MSG_CHECKING([AROS Source in .. ])
58 srcpwd=`cd ${srcdir} ; ${PWDCMD-pwd}`
59 SRCDIR=${srcpwd}
60 AC_MSG_RESULT($SRCDIR)
62 # Parse the target field into something useful.
63 changequote(<<,>>)
64 target_os=`echo $target | sed 's/^\([^-]*\)-\(.*\)$/\1/'`
65 target_cpu=`echo $target | sed 's/^\([^-]*\)-\(.*\)$/\2/'`
66 changequote([,])
68 dnl --------------------------------------------------------------------
69 dnl Set the default Workbench resolution
70 dnl --------------------------------------------------------------------
71 aros_default_wbwidth=800
72 aros_default_wbheight=600
73 aros_default_wbdepth=4
75 dnl --------------------------------------------------------------------
76 dnl Host Configuration Section
77 dnl --------------------------------------------------------------------
78 dnl
79 dnl The idea here is to find out all the information we need about the
80 dnl host. This means things like tools for building directory structures,
81 dnl copying files around and the like.
83 # The first step is to find the host binaries.
84 # Check for a compiler.
85 AC_PROG_CC
86 AC_PROG_CC_STDC
87 AC_PROG_CPP
89 # Check for a compatible awk
90 AC_CHECK_PROGS(AWK,[gawk nawk])
91 AROS_REQUIRED(gawk,$AWK)
92 AROS_PROG(MMAKE,mmake)
94 # Perform some default variable assignments. Note all of these will be
95 # Regenerated from the script, so there is no need to cache them.
97 aros_host_cc="$CC"
98 AROS_TOOL_CCPATH(aros_host_ld,ld)
99 AROS_REQUIRED(ld,$aros_host_ld)
100 aros_host_make="make"
101 aros_host_cflags=$CFLAGS
102 aros_host_ldflags=$LDFLAGS
103 aros_host_debug="-g -O0"
104 aros_host_mkdep="\$(SRCDIR)/scripts/mkdep"
105 aros_host_mkargs="--no-print-directory"
106 aros_host_incl="/usr/include"
107 aros_host_exe_suffix="$EXEEXT"
108 aros_host_lib_suffix=""
110 AC_CHECK_PROGS(aros_host_aclocal,[aclocal aclocal19 aclocal-1.9])
111 AC_CHECK_PROGS(aros_host_autoconf,[autoconf autoconf259 autoconf253])
112 AC_CHECK_PROGS(aros_host_autoheader,[autoheader autoheader259 autoheader253])
113 AC_CHECK_PROGS(aros_host_automake,[automake automake19 automake-1.9])
115 AROS_REQUIRED(aclocal/aclocal19/aclocal-1.9, $aros_host_aclocal)
116 AROS_REQUIRED(automake/automake19/automake-1.9, $aros_host_automake)
118 case "$aros_host_cc" in
119     *gcc*)
120         aros_host_cc_pipe="-pipe"
121         ;;
122     icc)
123         aros_host_cc_pipe=""
124         ;;
125     *)
126         aros_host_cc_pipe=""
127         ;;
128 esac
130 aros_kernel_cc_includes=""
131 aros_target_cc_includes=""
133 # This is the main host configuration section. It is where the host
134 # can change the values of any variables it needs to change. We do
135 # not look at anything that compiles to the target yet, we'll get
136 # to that later.
138 case "$host_os" in
139     aros*)
140         aros_host_arch="aros"
141         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
142         case "$host_cpu" in
143             *i?86*)
144                 aros_host_cpu="i386"
145                 ;;
146             *x86_64*)
147                 aros_host_cpu="x86_64"
148                 ;;
149             *powerpc*)
150                 aros_host_cpu="ppc"
151                 ;;
152             *)
153                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
154                 aros_host_cpu="$host_cpu"
155                 ;;
156         esac
157         ;;
159     linux*)
160         aros_host_arch="linux"
161         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
162         case "$host_cpu" in
163             *i?86*)
164                 aros_host_cpu="i386"
165                 ;;
166             *x86_64*)
167                 aros_host_cpu="x86_64"
168                 ;;
169             *m68k*)
170                 aros_host_cpu="m68k"
171                 ;;
172             *powerpc*)
173                 aros_host_cpu="ppc"
174                 ;;
175             *arm*)
176                 aros_host_cpu="arm"
177                 ;;
178             *)
179                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
180                 aros_host_cpu="$host_cpu"
181                 ;;
182         esac
183         ;;
185     freebsd*)
186         aros_host_cc="$aros_host_cc $aros_host_cc_pipe -I/usr/local/include"
187         aros_host_make="gmake"
188         aros_host_arch="freebsd"
189         aros_host_cpu="i386"
191         aros_host_ldflags="$aros_host_ldflags -L/usr/local/lib -liconv"
193         dnl FreeBSD 5.x (and later) has changed the default object format.
194         dnl The double [[]] is necessary to get around m4's quoting rules.
195         case $host_os in
196             freebsd[[234]]*)
197                 aros_object_format="elf_i386"
198                 ;;
200             *)
201                 aros_object_format="elf_i386_fbsd"
202                 ;;
203         esac
205         ;;
207     darwin*)
208         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
209         aros_host_arch="darwin"
210         android_build_os="darwin-x86"
211         android_tool="android"
212         default_android_sdk="/android-sdk-mac_x86"
213         default_android_ndk="/android-ndk-r5b"
214         case "$host_cpu" in
215             *i?86*)
216                 aros_host_cpu="i386"
217                 ;;
218             *x86_64*)
219                 aros_host_cpu="x86_64"
220                 ;;
221             *powerpc*)
222                 aros_host_cpu="ppc"
223                 ;;
224             *)
225                 AC_MSG_WARN("Unknown CPU for Darwin host -- $host_cpu")
226                 aros_host_cpu="$host_cpu"
227                 ;;
228         esac
230         aros_host_ldflags="$aros_host_ldflags -liconv"
232         ;;
234     dragonfly*)
235         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
236         aros_host_make="gmake"
237         aros_host_arch="dragonfly"
238         case $host_cpu in
239             *i?86*)
240                 aros_host_cpu="i386"
241                 ;;
242             *amd64*)
243                 aros_host_cpu="x86_64"
244                 ;;
245             *)
246                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
247                 aros_host_cpu="$host_cpu"
248                 ;;
249         esac
250         ;;
252     netbsd*)
253         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
254         aros_host_make="gmake"
255         aros_host_arch="netbsd"
256         case "$host_cpu" in
257             *i?86*)
258                 aros_host_cpu="i386"
259                 ;;
260             *m68k*)
261                 aros_host_cpu="m68k"
262                 ;;
263             *)
264                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
265                 aros_host_cpu="$host_cpu"
266                 ;;
267         esac    
268         aros_host_lib_suffix=".0.0"
269         ;;
271     openbsd*)
272         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
273         aros_host_make="gmake"
274         aros_host_arch="openbsd"
275         case "$host_cpu" in
276             *i?86*)
277                 aros_host_cpu="i386"
278                 ;;
279             *)
280                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
281                 aros_host_cpu="$host_cpu"
282                 ;;
283         esac
284         ;;
285         
286     solaris*)
287         aros_host_arch="solaris"
288         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
289         case "$host_cpu" in
290             *i?86*)
291                 aros_host_cpu="i386"
292                 ;;
293             *sparc*)
294                 aros_host_cpu="sparc"
295                 ;;
296             *)
297                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
298                 aros_host_cpu="$host_cpu"
299                 ;;
300         esac
301         ;;
303     morphos*)
304         aros_host_arch="morphos"
305         aros_host_cpu="ppc"
306         ;;
308     amiga*)
309         aros_host_arch="amiga"
310         SORT="/gg/bin/sort"
311         TEST="/gg/bin/test"
312         UNIQ="/gg/bin/uniq"
313         FOR="for"
314         TOUCH="/gg/bin/touch"
315         case "$host_cpu" in
316             *m68k*)
317                 aros_host_cpu="m68k"
318                 ;;
319             *powerpc*)
320                 aros_host_cpu="ppc"
321                 ;;
322             *)
323                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
324                 aros_host_cpu="$host_cpu"
325                 ;;
326         esac
327         ;;
329     cygwin*)
330         aros_host_arch="cygwin"
331         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
332         android_build_os="windows"
333         android_tool="android.bat"
334         default_android_sdk="/cygdrive/c/android-sdk-windows-1.6_r1"
336         case "$host_cpu" in
337             *i?86*)
338                 aros_host_cpu="i386"
339                 ;;
340             *)
341                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
342                 aros_host_cpu="$host_cpu"
343                 ;;
344         esac
345         ;;
347     mingw32*)
348         aros_host_arch="mingw32"
349         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
350         android_build_os="windows"
351         android_tool="android.bat"
352         default_android_sdk="/c/android-sdk-windows-1.6_r1"
354         case "$host_cpu" in
355             *i?86*)
356                 aros_host_cpu="i386"
357                 ;;
358             *)
359                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
360                 aros_host_cpu="$host_cpu"
361                 ;;
362         esac
363         ;;
364     *)
365         AC_MSG_ERROR([Unsupported host architecture $host])
366         ;;
367 esac
369 AROS_PROG(aros_host_ar,[ar],[cr])
370 AROS_REQUIRED(ar,$aros_host_ar)
371 AROS_PROG(aros_host_ranlib,ranlib)
372 AROS_REQUIRED(ranlib,$aros_host_ranlib)
373 AROS_PROG(aros_host_strip,strip)
374 AROS_REQUIRED(strip,$aros_host_strip)
376 AROS_PROG(RM,[rm],[-rf])
377 AROS_REQUIRED(rm,$RM)
378 AROS_PROG(CP,[cp])
379 AROS_REQUIRED(cp,$CP)
380 AROS_PROG(MV,[mv])
381 AROS_REQUIRED(mv,$MV)
382 AROS_PROG(ECHO,[echo])
383 AROS_REQUIRED(echo,$ECHO)
384 AROS_PROG(MKDIR,[mkdir],[-p])
385 AROS_REQUIRED(mkdir,$MKDIR)
386 AROS_PROG(TOUCH,[touch])
387 AROS_REQUIRED(touch,$TOUCH)
388 AROS_PROG(SORT,[sort])
389 AROS_REQUIRED(sort,$SORT)
390 AROS_PROG(UNIQ,[uniq])
391 AROS_REQUIRED(uniq,$UNIQ)
392 AROS_PROG(NOP,[true])
393 AROS_REQUIRED(true,$NOP)
394 AROS_PROG(CAT,[cat])
395 AROS_REQUIRED(cat,$CAT)
396 AROS_PROG(BISON,[bison])
397 AROS_REQUIRED(bison,$BISON)
398 AROS_PROG(FLEX,[flex])
399 AROS_REQUIRED(flex,$FLEX)
400 AROS_PROG(PNGTOPNM,[pngtopnm])
401 AROS_REQUIRED(pngtopnm,$PNGTOPNM)
402 AROS_PROG(PPMTOILBM,[ppmtoilbm])
403 AROS_REQUIRED(ppmtoilbm,$PPMTOILBM)
404 AROS_PROG(SED,[sed])
405 AROS_REQUIRED(sed,$SED)
406 AROS_PROG(CHMOD,[chmod])
407 AROS_REQUIRED(chmod,$CHMOD)
408 AROS_PROG(PATCH,[patch])
409 AROS_REQUIRED(patch,$PATCH)
411 AM_PATH_PYTHON(2.5)
413 AC_SUBST(FOR, for)
414 AC_SUBST(IF, if)
415 AC_SUBST(TEST, test)
416 AC_SUBST(CMP, cmp)
418 dnl ---------------------------------------------------------------------------
419 dnl Look for things about the host system, good for hosted targets.
420 dnl ---------------------------------------------------------------------------
422 # Check for some includes for the X11 HIDD and the kernel
423 AC_CHECK_HEADERS([sys/ipc.h sys/shm.h \
424     sys/mmap.h sys/mman.h sysexits.h \
425     sys/statfs.h sys/statvfs.h sys/vfs.h sys/param.h \
428 AC_CHECK_HEADERS([sys/mount.h],,,[#include <sys/param.h>])
430 AC_HEADER_DIRENT
431 AC_HEADER_STAT
432 AC_HEADER_STDC
433 AC_HEADER_SYS_WAIT
434 AC_HEADER_TIME
435 AC_STRUCT_ST_BLKSIZE
436 AC_STRUCT_ST_BLOCKS
437 AC_STRUCT_ST_RDEV
438 AC_STRUCT_TM
439 AC_STRUCT_TIMEZONE
440 AC_TYPE_OFF_T
441 AC_TYPE_PID_T
442 AC_TYPE_SIZE_T
443 AC_TYPE_UID_T
445 AC_CHECK_MEMBERS(struct tm.tm_gmtoff)
447 # Look for some functions
448 AC_CHECK_FUNCS([getpagesize kqueue statfs statvfs \
449     clone kse_create rfork_thread thr_create sa_register \
450     getcontext makecontext setcontext sigaltstack swapcontext])
452 AC_FUNC_MMAP
455 dnl --------------------------------------------------------------------
456 dnl Target Configuration Section
457 dnl --------------------------------------------------------------------
459 dnl The target configuration section is responsible for setting up all
460 dnl the paths for includes, and tools required to build AROS to some
461 dnl particular target.
463 aros_config_cflags="-Wall -Werror-implicit-function-declaration"
464 aros_config_aflags="-Wall -x assembler-with-cpp -c"
465 aros_config_ldflags=""
467 aros_shared_default=yes
469 aros_shared_cflags="-fPIC"
470 aros_shared_aflags=""
471 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
472 aros_kernel_ldflags="-Wl,-rpath,./lib"
474 aros_target_ar_flags="cr"
475 aros_target_nm_flags="-C -ul"
476 aros_target_strip_flags="--strip-unneeded -R.comment"
478 aros_compiler_libs=
479 aros_arch_libs=
481 aros_target_genmap="-Wl,-Map -Xlinker"
483 # Native flavour stuff
484 aros_serial_debug="0"
486 # Palm native flavour stuff
487 aros_palm_debug_hack="0"
489 # Unix flavour stuff
490 aros_nesting_supervisor="0"
492 # Collect-aros stuff: "-ius" to ignore undefined symbols
493 ignore_undefined_symbols=""
495 # Check for X11 by default
496 need_x11="auto"
498 #-----------------------------------------------------------------------------
501 # GCC 4.1+ has a stack protection feature that requires OS support. Ubuntu has
502 # it switched on by default, and we use the host compiler, so it compiles AROS
503 # code with this enabled resulting in link failures as we don't have support
504 # for it.
506 # We use two methods to disable it. For the host compiler (used to compile
507 # some hosted modules), we test to see if the compiler supports stack
508 # protection, and if it does we disable it in AROS_CONFIG_CFLAGS. This should
509 # work on all platforms.
511 # For the "cross" compiler we clear the "ssp_default" spec in config/specs.in
512 # (this is done unconditionally, as it should have no effect on compilers
513 # without the stack protection feature). This may be specific to the way that
514 # Ubuntu enables the feature, so may not work everywhere. My specs-fu isn't
515 # strong enough to disable it in a generic way though, so we'll live with it
516 # until another vendor ships GCC with it enabled in a different way, and deal
517 # with it then.
520 AC_MSG_CHECKING([whether ${CC} accepts -fno-stack-protector])
521 save_cflags="$CFLAGS"
522 CFLAGS="$CFLAGS -fno-stack-protector"
523 AC_TRY_COMPILE(,, use_no_stack_protector="yes", use_no_stack_protector="no")
524 AC_MSG_RESULT($use_no_stack_protector)
525 if test "x-$use_no_stack_protector" = "x-yes" ; then
526     aros_host_cflags="$aros_host_cflags -fno-stack-protector"
528 CFLAGS="$save_cflags"
530 #-----------------------------------------------------------------------------
532 # Disable pointer-signedness warnings if the compiler recognises the option
533 # (this only works for the host compiler at the moment)
535 AC_MSG_CHECKING([whether ${CC} accepts -Wno-pointer-sign])
536 save_cflags="$CFLAGS"
537 CFLAGS="$CFLAGS -Wno-pointer-sign"
538 AC_TRY_COMPILE(,, use_no_sign_warning="yes", use_no_sign_warning="no")
539 AC_MSG_RESULT($use_no_sign_warning)
540 if test "x-$use_no_sign_warning" = "x-yes" ; then
541     aros_host_cflags="$aros_host_cflags -Wno-pointer-sign"
543 CFLAGS="$save_cflags"
545 #-----------------------------------------------------------------------------
547 # Check if host compiler supports -fgnu89-inline, can be needed for crosstools.
549 AC_MSG_CHECKING([whether ${CC} accepts -fgnu89-inline])
550 save_cflags="$CFLAGS"
551 CFLAGS="$CFLAGS -fgnu89-inline"
552 AC_TRY_COMPILE(,, use_gnu89_inline="yes", use_gnu89_inline="no")
553 AC_MSG_RESULT($use_gnu89_inline)
554 if test "x-$use_gnu89_inline" = "x-yes" ; then
555     gnu89_inline="-fgnu89-inline"
557 CFLAGS="$save_cflags"
559 #-----------------------------------------------------------------------------
561 AC_MSG_CHECKING([for type of build])
562 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")
564 if test "$build_type" = "nightly"; then
565     build_type_string="NIGHTLY"
566 elif test "$build_type" = "snapshot"; then
567     build_type_string="SNAPSHOT"
568 elif test "$build_type" = "milestone"; then
569     build_type_string="MILESTONE"
570 elif test "$build_type" = "release"; then
571     build_type_string="RELEASE"
572 else
573     build_type_string="PERSONAL"
574     build_type="personal"
577 aros_config_cflags="$aros_config_cflags -DAROS_BUILD_TYPE=AROS_BUILD_TYPE_$build_type_string"
579 AC_MSG_RESULT($build_type)
581 #-----------------------------------------------------------------------------
582 all_debug_types="messages stack modules mungwall symbols"
584 AC_MSG_CHECKING([which debug types to enable])
585 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)]),
586  debug="$enableval",debug="")
588 if test "$debug" = "" -o "$debug" = "no"; then
589     debug="none"
590 elif test "$debug" = "yes"; then
591     debug="all"
594 if test "$debug" = "all" ; then
595     debug="messages stack modules symbols"
596     for d in $all_debug_types; do
597         export aros_${d}_debug="1"
598     done
599 else
600     for d in $all_debug_types; do
601         export aros_${d}_debug="0"
602     done
605 if test "$debug" != "none"; then
606     debug=`echo $debug | sed s/,/\ /g`
607     for d in $debug; do
608         found="0"
609         for d2 in $all_debug_types; do
610             if test "$d2" = "$d"; then
611                 found="1"
612                 break
613             fi
614         done
615         if test "$found" = "0"; then
616             AC_MSG_ERROR([unrecognized debug type "$d". Available types are: all none $all_debug_types])
617         fi
618         export aros_${d}_debug="1"
619     done
620     aros_debug="yes"
622 AC_MSG_RESULT($debug)
624 if test "$aros_messages_debug" = "1"; then
625     aros_messages_debug="-DADEBUG=1 -DMDEBUG=1"
626 else
627     aros_messages_debug=""
629 if test "$aros_symbols_debug" = "1"; then
630     aros_symbols_debug="-g"
631 else
632     aros_symbols_debug=""
635 # These are the flags to pass when compiling debugged programs
636 aros_debug_cflags="$aros_symbols_debug $aros_messages_debug"
637 aros_debug_aflags=""
638 aros_debug_ldflags="$aros_symbols_debug"
640 aros_crosstools="no"
642 #-----------------------------------------------------------------------------
643 #   Checking if we should build crosstools..
644 AC_MSG_CHECKING([whether to build crosstools])
645 AC_ARG_ENABLE(crosstools,AC_HELP_STRING([--enable-crosstools],[Build cross-compiler toolchains if necessary (default=no).]),crosstools="$enableval",crosstools="no")
646 if test "$crosstools" != "" -a "$crosstools" != "no"; then
647     AC_MSG_RESULT(yes)
648         aros_crosstools="yes"
649 else
650     AC_MSG_RESULT(no)
653 #-----------------------------------------------------------------------------
654 #   Checking for distcc and ccache.
656 #   Always apply the transforms in this particular order. Basically you should
657 #   always run 'ccache distcc compiler' in that order for the best performance.
659 AC_MSG_CHECKING([whether to enable distcc])
660 AC_ARG_ENABLE(distcc,AC_HELP_STRING([--enable-distcc],[Use distcc as a front end to the compiler (default=no).]),distcc="$enableval",distcc="no")
661 if test "$distcc" != "" -a "$distcc" != "no"; then
662     # AC_CHECK_PROG will print out the result in this case
663     AC_PATH_PROG(DISTCC,[distcc],distcc,)
664 else
665     AC_MSG_RESULT(no)
668 AC_MSG_CHECKING([whether to enable ccache])
669 AC_ARG_ENABLE(ccache,AC_HELP_STRING([--enable-ccache],[Use ccache as a front end to the compiler (default=no).]),ccache="$enableval",ccache="no")
670 if test "$ccache" != "" -a "$ccache" != "no"; then
671     # AC_CHECK_PROG will print out the result in this case
672     AC_CHECK_PROG(CCACHE,[ccache],ccache,)
673 else
674     AC_MSG_RESULT(no)
677 #-----------------------------------------------------------------------------
678 AC_MSG_CHECKING([what specific gcc version to use])
679 AC_ARG_WITH(gcc-version,AC_HELP_STRING([--with-gcc-version=VERSION],[Use gcc-VERSION for building AROS]),target_tool_version="$withval",target_tool_version="default")
680 AC_MSG_RESULT($target_tool_version)
682 #-----------------------------------------------------------------------------
683 AC_MSG_CHECKING([what optimization flags to use])
684 AC_ARG_WITH(optimization,AC_HELP_STRING([--with-optimization=FLAGS],[Use optimization flags FLAGS (default=-O2).]),optimization="$withval",optimization="unknown")
685 if test "$optimization" = "unknown"; then
686     dnl default is -O2 for normal builds, -O0 for debug builds
687     if test "$debug" != "none"; then
688         optimization="-O0"
689     else
690         optimization="-O2"
691     fi
693 aros_config_cflags="$aros_config_cflags $optimization"
694 AC_MSG_RESULT($optimization)
696 #-----------------------------------------------------------------------------
697 AC_MSG_CHECKING([what paranoia flags to use])
698 AC_ARG_WITH(paranoia,AC_HELP_STRING([--with-paranoia=FLAGS],[CC flags to enable paranoia]),[paranoia_flags="$withval"],[paranoia_flags="default"])
699 if test "$paranoia_flags" = "default"; then
700         paranoia_flags=""
701 else if test "$paranoia_flags" = "yes"; then
702         paranoia_flags="-Wall -Werror"
703 fi fi
704 AC_MSG_RESULT($paranoia_flags)
705 aros_paranoia_cflags="$paranoia_flags"
707 #-----------------------------------------------------------------------------
708 AC_MSG_CHECKING([what target variant to enable])
709 AC_ARG_ENABLE(target_variant,AC_HELP_STRING([--enable-target-variant=NAME],[Enable a specific target variant(default=none)]),target_variant=$enableval,target_variant="")
710 if test "$target_variant" = ""; then
711     aros_target_variant=""
712     aros_target_suffix=""
713     enableval="none"
714 else
715     aros_target_variant="$target_variant"
716     aros_target_suffix="-$target_variant"
718 AC_MSG_RESULT($enableval)
720 target_bootloader="none"
722 #-----------------------------------------------------------------------------
723 case "$aros_target_variant" in
724 ios)
725     AC_MSG_CHECKING([XCode path])
726     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")
727     AC_MSG_RESULT($aros_xcode_path)
729     AC_MSG_CHECKING([for minimum supported iOS version])
730     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")
731     AC_MSG_RESULT($aros_ios_version)
733     AC_MSG_CHECKING([what iOS SDK version to use])
734     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")
735     AC_MSG_RESULT($aros_ios_sdk)
737     ;;
739 "android")
740     AC_MSG_CHECKING([Android SDK path])
741     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)
742     AC_MSG_RESULT($aros_android_sdk)
744     AC_MSG_CHECKING([Android NDK path])
745     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")
746     AC_MSG_RESULT($aros_android_ndk)
748     AC_MSG_CHECKING([what Android version to use])
749     AC_ARG_WITH(android-version,AC_HELP_STRING([--with-android-version=VERSION],[Use Android platform VERSION (default=2.2).]),aros_android_version="$withval",aros_android_version="2.2")
750     AC_MSG_RESULT($aros_android_version)
752     export PATH="$aros_android_sdk/tools:$PATH"
753     AC_PATH_PROG(android_tool, $android_tool)
754     AROS_REQUIRED(android,$android_tool)
756     dnl MSYS bash can't run .bat files directly, then need to be started via cmd.exe
757     if test $host_os = "mingw32"; then
758         android_tool="cmd //c $android_tool"
759     fi
761     ;;
762 esac
764 #-----------------------------------------------------------------------------
765 # This is the target configuration switch.
766 case "$target_os" in
767     linux*)
768         aros_target_arch="linux"
769         aros_target_family="unix"
770         case "$target_cpu" in
771             *m68k*)
772                 aros_target_cpu="m68k"
773                 aros_object_format="m68kelf"
774                 aros_flavour="emulcompat"
775                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D__mc68000 -D__linux__"
776                 aros_shared_ldflags="-Wl,-T,\$(TOP)/config/linux/m68k/script.so"
777                 aros_kernel_ldflags="-Wl,-rpath,./lib,-T,\$(TOP)/config/linux/m68k/script.normal"
778                 gcc_target_cpu="mc68000"
779                 ;;
780             *i?86*)
781                 aros_target_cpu="i386"
782                 aros_object_format="elf_i386"
783                 aros_flavour="emulation"
784                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__linux__"
785                 aros_config_cflags="$aros_config_cflags -m32 -march=i486"
786                 aros_kernel_cflags="$aros_kernel_cflags -m32 -march=i486"
787                 aros_config_aflags="$aros_config_aflags -m32 -march=i486"
788                 aros_config_ldflags="-m32 -march=i486"
789                 aros_kernel_ldflags="-melf_i386"
790                 aros_default_wbdepth=8
791                 gcc_target_cpu="i386"
792                 pci_hidd_target="hidd-pci-linux"
793                 ;;
794             *x86_64*)
795                 aros_target_cpu="x86_64"
796                 aros_object_format="elf_x86_64"
797                 aros_flavour="emulation"
798                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64 -D__linux__"
799                 aros_config_cflags="$aros_config_cflags -mno-red-zone -fno-omit-frame-pointer"
800                 aros_default_wbdepth=8
801                 gcc_target_cpu="x86_64"
802                 pci_hidd_target="hidd-pci-linux"
803                 ;;
804             *powerpc*)
805                 aros_target_cpu="ppc"
806                 aros_object_format="elf32ppc"
807                 aros_flavour="emulation"
808                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc -D__linux__"
809                 aros_default_wbdepth=8
810                 gcc_target_cpu="ppc"
811                 ;;
812 # TODO
813 # Same as powerpc, but I need this for the nightly build to work again.
814 # Actually, the nightly should be made working with powerpc target.
815 # That just was too much work for the moment, another week or two.
816             *ppc*)
817                 aros_target_cpu="ppc"
818                 aros_object_format="elf32ppc"
819                 aros_flavour="emulation"
820                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc -D__linux__"
821                 aros_default_wbdepth=8
822                 gcc_target_cpu="ppc"
823                 ;;
824             *arm*)
825                 aros_target_cpu="arm"
826                 aros_object_format="armelf_linux_eabi"
827                 aros_flavour="emulation"
828                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm -D__linux__"
829                 gcc_target_cpu="arm"
830                 aros_config_cflags="$aros_config_cflags -marm -march=armv6 -mfpu=vfp -mfloat-abi=softfp -fno-asynchronous-unwind-tables -fno-exceptions -fno-strict-aliasing"
831                 aros_config_aflags="$aros_config_aflags -marm -march=armv6 -mfpu=vfp -mfloat-abi=softfp -fno-asynchronous-unwind-tables -fno-exceptions -fno-strict-aliasing"
832                 aros_arch_libs="-laeabi"
833                 ;;
834             *)
835                 AC_MSG_ERROR("Unknown CPU for Linux -- $target_cpu")
836                 ;;
837         esac
838         case "$aros_target_variant" in
839             android)
840                 case "$aros_android_version" in
841                 2.2)
842                     aros_android_level=android-8
843                     ;;
844                 *)
845                     aros_android_level=android-9
846                     ;;
847                 esac
848                 aros_default_wbwidth=320
849                 aros_default_wbheight=480
850                 dnl Android gcc and AROS gcc use different enums size, so we use AROS gcc
851                 aros_target_cc="arm-aros-gcc"
852                 aros_target_cxx="arm-aros-g++"
853                 aros_target_ld="arm-aros-ld"
854                 aros_target_as="arm-aros-as"
855                 aros_target_ar="arm-aros-ar"
856                 aros_target_ranlib="arm-aros-ranlib"
857                 aros_target_nm="arm-aros-nm"
858                 aros_target_strip="arm-aros-strip"
859                 aros_target_objcopy="arm-aros-objcopy"
860                 aros_target_objdump="arm-aros-objdump"
861                 if test "$aros_android_ndk" = ""; then
862                     aros_kernel_cflags="-mandroid"
863                     aros_kernel_ldflags="-mandroid"
864                     CFLAGS="-mandroid"
865                 else
866                     export PATH="$aros_android_ndk/toolchains/arm-linux-androideabi-$target_tool_version/prebuilt/$android_build_os/bin:$PATH"
867                     aros_android_ndk="$aros_android_ndk/platforms/$aros_android_level/arch-arm"
868                     aros_kernel_cflags="--sysroot $aros_android_ndk -mandroid"
869                     aros_kernel_ldflags="--sysroot $aros_android_ndk -mandroid"
870                     CFLAGS="$CFLAGS --sysroot $aros_android_ndk -mandroid"
871                     aros_kernel_includes="-isystem $aros_android_ndk/usr/include"
872                 fi
873                 need_x11=no
874                 target_tool_prefix="arm-linux-androideabi-"
875             ;;
876         esac
877     ;;
879     pc)
880         aros_target_arch="pc"
881         aros_shared_default="no"
882         target_bootloader="grub2"
883         case "$target_cpu" in
884             *i?86*)
885                 aros_target_cpu="i386"
887                 dnl If somebody hasn't already set the target object
888                 dnl format, then use this value. Mostly to support
889                 dnl FreeBSD cross-compilation.
890                 dnl TODO: Remove when we always use our compiler.
892                 if test "$aros_object_format" = "" ; then
893                     aros_object_format="elf_i386"
894                 fi
895                 aros_flavour="standalone"
896                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
897                 aros_config_cflags="$aros_config_cflags -m32 -march=i486"
898                 aros_kernel_cflags="$aros_kernel_cflags -m32 -march=i486"
899                 aros_config_aflags="$aros_config_aflags -m32 -march=i486"
900                 aros_config_ldflags="-m32 -march=i486"
901                 aros_kernel_ldflags="-melf_i386"
902                 aros_default_wbwidth=640
903                 aros_default_wbheight=480
904                 gcc_target_cpu="i386"
905                 ;;
906             *x86_64*)
907                 aros_target_cpu="x86_64"
908                 aros_serial_debug=1
909                 if test "$aros_object_format" = "" ; then
910                     aros_object_format="elf_x86_64"
911                 fi
912                 aros_flavour="standalone"
913                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
914                 aros_config_cflags="$aros_config_cflags -fno-asynchronous-unwind-tables -mno-red-zone -fno-omit-frame-pointer"
915                 aros_kernel_ldflags=""
916                 aros_default_wbwidth=640
917                 aros_default_wbheight=480
918                 gcc_target_cpu="x86_64"
919                 ;;
920             *)
921                 AC_MSG_ERROR("Unknown native CPU -- $target_cpu")
922                 ;;
923         esac
924         ;;
926     prep)
927         aros_target_arch="prep"
928         aros_shared_default="no"
929         aros_target_cpu="ppc"
930         aros_object_format="elf32ppc"
931         aros_flavour="ppcnative"
932         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
933         aros_kernel_ldflags=""
934         aros_default_wbwidth=640
935         aros_default_wbheight=480
936         gcc_target_cpu="ppc"
937         ;;
939     freebsd*)
940         aros_target_arch="freebsd"
941         aros_target_family="unix"
942         aros_target_cpu="i386"
943         aros_flavour="emulation"
944         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
945         gcc_target_cpu="i386"
947         aros_target_strip_flags="-x"
948         ;;
950     darwin*)
951         aros_target_arch="darwin"
952         aros_target_family="unix"
953         aros_flavour="emulation"
954         case "$target_cpu" in
955             *i?86*)
956                 aros_ios_platform="iPhoneSimulator"
957                 aros_target_cpu="i386"
958                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
959                 aros_kernel_ldflags=""
960                 aros_macosx_version="10.4"
961                 aros_default_wbdepth=8
962                 gcc_target_cpu="i386"
963                 aros_object_format="elf_i386"
964                 aros_target_strip_flags="-x"
965                 aros_target_cc="i386-aros-gcc"
966                 aros_target_cxx="i386-aros-g++"
967                 aros_target_ld="i386-aros-ld"
968                 aros_target_as="i386-aros-as"
969                 aros_target_ar="i386-aros-ar"
970                 aros_target_ranlib="i386-aros-ranlib"
971                 aros_target_nm="i386-aros-nm"
972                 aros_target_strip="i386-aros-strip"
973                 aros_target_objcopy="i386-aros-objcopy"
974                 aros_target_objdump="i386-aros-objdump"
975                 target_tool_prefix="i686-apple-darwin10-"
976                 target_tool_flags="-m32"
977                 ;;
978             *x86_64*)
979                 aros_target_cpu="x86_64"
980                 aros_object_format="elf_x86_64"
981                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
982                 aros_macosx_version="10.6"
983                 aros_config_cflags="$aros_config_cflags -fno-omit-frame-pointer"
984                 aros_kernel_cflags="-m64"
985                 aros_kernel_ldflags="-m64"
986                 aros_target_cflags="-mcmodel=large"
987                 aros_default_wbdepth=8
988                 gcc_target_cpu="x86_64"
989                 aros_kernel_ld="ld"
990                 aros_target_cc="x86_64-aros-gcc"
991                 aros_target_cxx="x86_64-aros-g++"
992                 aros_target_ld="x86_64-aros-ld"
993                 aros_target_as="x86_64-aros-as"
994                 aros_target_ar="x86_64-aros-ar"
995                 aros_target_ranlib="x86_64-aros-ranlib"
996                 aros_target_nm="x86_64-aros-nm"
997                 aros_target_strip="x86_64-aros-strip"
998                 aros_target_objcopy="x86_64-aros-objcopy"
999                 aros_target_objdump="x86_64-aros-objdump"
1000                 target_tool_prefix="i686-apple-darwin10-"
1001                 ;;
1002             *ppc*)
1003                 aros_target_cpu="ppc"
1004                 aros_object_format="elf32ppc"
1005                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1006                 aros_kernel_ldflags=""
1007                 aros_macosx_version="10.0"
1008                 aros_default_wbdepth=8
1009                 gcc_target_cpu="ppc"
1010                 aros_kernel_ld="ld -arch ppc"
1011                 aros_target_cc="ppc-aros-gcc"
1012                 aros_target_cxx="ppc-aros-g++"
1013                 aros_target_ld="ppc-aros-ld"
1014                 aros_target_as="ppc-aros-as"
1015                 aros_target_ar="ppc-aros-ar"
1016                 aros_target_ranlib="ppc-aros-ranlib"
1017                 aros_target_nm="ppc-aros-nm"
1018                 aros_target_strip="ppc-aros-strip"
1019                 aros_target_objcopy="ppc-aros-objcopy"
1020                 aros_target_objdump="ppc-aros-objdump"
1021                 target_tool_prefix="powerpc-apple-darwin10-"
1022                 ;;
1023             *arm*)
1024                 aros_ios_platform="iPhoneOS"
1025                 aros_target_cpu="arm"
1026                 aros_object_format="armelf_linux_eabi"
1027                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
1028                 aros_config_cflags="$aros_config_cflags -marm -march=armv6 -mfpu=vfp -mfloat-abi=softfp -fno-asynchronous-unwind-tables -fno-exceptions"
1029                 aros_config_aflags="$aros_config_aflags -marm -march=armv6 -mfpu=vfp -mfloat-abi=softfp -fno-asynchronous-unwind-tables -fno-exceptions"
1030                 aros_arch_libs="-laeabi"
1031                 aros_default_wbdepth=8
1032                 gcc_target_cpu="arm"
1033                 aros_kernel_ld="ld -arch armv6"
1034                 aros_target_cc="arm-aros-gcc"
1035                 aros_target_cxx="arm-aros-g++"
1036                 aros_target_ld="arm-aros-ld"
1037                 aros_target_as="arm-aros-as"
1038                 aros_target_ar="arm-aros-ar"
1039                 aros_target_ranlib="arm-aros-ranlib"
1040                 aros_target_nm="arm-aros-nm"
1041                 aros_target_strip="arm-aros-strip"
1042                 aros_target_objcopy="arm-aros-objcopy"
1043                 aros_target_objdump="arm-aros-objdump"
1044                 target_tool_prefix="arm-apple-darwin10-" 
1045                 export PATH="$aros_xcode_path/Platforms/$aros_ios_platform.platform/Developer/usr/bin:$PATH"
1046                 ;;
1047             *)
1048                 AC_MSG_ERROR("Unsupported target CPU for darwin hosted flavour -- $target_cpu")
1049                 ;;
1050         esac
1051         case "$aros_target_variant" in
1052             ios)
1053                 aros_default_wbwidth=320
1054                 aros_default_wbheight=480
1055                 aros_ios_sdk="$aros_xcode_path/Platforms/$aros_ios_platform.platform/Developer/SDKs/$aros_ios_platform$aros_ios_sdk.sdk"
1056                 target_tool_flags="$target_tool_flags --sysroot $aros_ios_sdk"
1057                 aros_kernel_includes="-isystem $aros_ios_sdk/usr/include"
1058                 need_x11=no
1059                 # This is here because it may depend on iOS or SDK version
1060                 aros_kernel_cflags="$aros_kernel_cflags -miphoneos-version-min=$aros_ios_version"
1061                 aros_kernel_ldflags="$aros_kernel_ldflags -miphoneos-version-min=$aros_ios_version"
1062                 aros_kernel_objcflags="-fobjc-abi-version=2 -fobjc-legacy-dispatch"
1063             ;;
1064             *)
1065                 aros_kernel_cflags="$aros_kernel_cflags -mmacosx-version-min=$aros_macosx_version"
1066                 aros_kernel_ldflags="$aros_kernel_ldflags -mmacosx-version-min=$aros_macosx_version"
1067             ;;
1068         esac
1069         ;;
1071     dragonfly*)
1072         aros_target_arch="dragonfly"
1073         aros_target_family="unix"
1074         aros_flavour="emulation"
1075         case "$target_cpu" in
1076             *i?86*)
1077                 aros_target_cpu="i386"
1078                 aros_object_format="elf_i386"
1079                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__DragonFly__"
1080                 ;;
1081             *x86_64*)
1082                 aros_config_cflags="$aros_config_cflags -fno-omit-frame-pointer"
1083                 aros_target_cpu="x86_64"
1084                 aros_object_format="elf_x86_64"
1085                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64 -D__DragonFly__"
1086                 ;;
1087             *)
1088                 AC_MSG_ERROR("Unknown CPU for DragonFly -- $target_cpu")
1089                 ;;
1090         esac
1091         ;;
1093     netbsd*)
1094         aros_target_arch="netbsd"
1095         aros_target_family="unix"
1096         case "$target_cpu" in
1097             *m68k*)
1098                 aros_target_cpu="m68k"
1099                 aros_object_format="m68kelf"
1100                 aros_flavour="emulcompat"
1101                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D__mc68000 -D__NetBSD__"
1102                 gcc_target_cpu="mc68000"
1103                 ;;
1104             *i?86*)
1105                 aros_target_cpu="i386"
1106                 aros_object_format="elf_i386"
1107                 aros_flavour="emulation"
1108                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__NetBSD__"
1109                 aros_default_wbdepth=8
1110                 gcc_target_cpu="i386"
1111                 ;;
1112             *)
1113                 AC_MSG_ERROR("Unknown CPU for NetBSD -- $target_cpu")
1114                 ;;
1115         esac
1116         aros_target_genmap="-Wl,-M -Xlinker >"
1117         aros_flavour="emulation"
1118         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1119         ;;   
1121     openbsd*)
1122         aros_target_arch="openbsd"
1123         aros_target_family="unix"
1124         case "$target_cpu" in
1125             *i?86*)
1126                 aros_target_cpu="i386"
1127                 aros_object_format="elf_i386"
1128                 aros_flavour="emulation"
1129                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__OpenBSD__"
1130                 gcc_target_cpu="i386"
1131                 ;;
1132             *)
1133                 AC_MSG_ERROR("Unknown CPU for OpenBSD -- $target_cpu")
1134                 ;;
1135         esac
1136         aros_target_genmap="-Wl,-M -Xlinker >"
1137         aros_target_nm_flags="-u"
1138         aros_flavour="emulation"
1139         ;;
1141     solaris*)
1142         aros_target_arch="solaris"
1143         aros_target_family="unix"
1144         case "$target_cpu" in
1145            *i?86*)
1146                aros_target_cpu="i386"
1147                aros_object_format="elf_i386"
1148                aros_flavour="emulation"
1149                aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__Solaris__"
1150                aros_default_wbdepth=8
1151                gcc_target_cpu="i386"
1152                ;;
1153             *sparc*)
1154                 aros_target_cpu="sparc"
1155                 aros_object_format="elf_sparc"
1156                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dsparc -D__Solaris__"
1157                 gcc_target_cpu="sparc"
1158                 ;;
1159             *)
1160                 AC_MSG_ERROR("Unknown CPU for Solaris -- $target_cpu")
1161                 ;;
1162         esac
1163         aros_config_cflags="$aros_config_cflags -D$aros_target_cpu"
1164         aros_flavour="emulation"
1165         ;;
1167     morphos*)
1168         aros_target_arch="morphos"
1169         aros_shared_default="no"
1170         aros_target_cpu="ppc"
1171         aros_object_format="elf_ppc"
1172         aros_flavour="nativecompat"
1173         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1174         gcc_target_cpu="ppc"
1175         ;;
1177     sam440)
1178         aros_target_arch="sam440"
1179         aros_shared_default="no"
1180         aros_target_cpu="ppc"
1181         aros_object_format="elf32ppc"
1182         aros_flavour="ppcnative"
1183         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1184         aros_kernel_ldflags=""
1185         aros_default_wbwidth=1024
1186         aros_default_wbheight=768
1187         aros_default_wbdepth=24
1188         aros_config_cflags="$aros_config_cflags -mcpu=440fp -mno-toc -fno-asynchronous-unwind-tables"
1189         gcc_target_cpu="powerpc"
1190         ;;
1192     efika)
1193         aros_target_arch="efika"
1194         aros_shared_default="no"
1195         aros_target_cpu="arm"
1196         aros_object_format="armelf_linux_eabi"
1197         aros_flavour="standalone"
1198         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
1199         aros_kernel_ldflags=""
1200         aros_default_wbwidth=1024
1201         aros_default_wbheight=600
1202         aros_arch_libs="-laeabi"
1203         aros_config_cflags="$aros_config_cflags -marm -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -fno-asynchronous-unwind-tables -fno-exceptions -fno-strict-aliasing"
1204         aros_config_aflags="$aros_config_aflags -marm -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -fno-asynchronous-unwind-tables -fno-exceptions -fno-strict-aliasing"
1205         ;;
1206         
1207     chrp)
1208     aros_target_arch="chrp"
1209     aros_shared_default="no"
1210     aros_target_cpu="ppc"
1211     aros_object_format="elf32ppc"
1212     aros_flavour="ppcnative"
1213     aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1214     aros_kernel_ldflags=""
1215     aros_default_wbwidth=640
1216     aros_default_wbheight=480
1217     aros_config_cflags="$aros_config_cflags -mno-toc -fno-asynchronous-unwind-tables"    
1218     gcc_target_cpu="powerpc"
1219         case "$aros_target_variant" in
1220             efika)
1221             aros_config_cflags="$aros_config_cflags -DBIG_ENDIAN_OHCI=1 -mcpu=603e"
1222             ;;
1223         esac
1224     ;;
1226     amiga*)
1227         aros_target_arch="amiga"
1228         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D_AMIGA -DAMIGA"
1229         aros_shared_default="no"
1231         case "$target_cpu" in
1232             *m68k*)
1233                 aros_enable_mmu=no
1234                 aros_target_cpu="m68k"
1235                 aros_object_format="m68kelf"
1236                 aros_flavour="standcompat"
1237                 gcc_target_cpu="m68000"
1238                 aros_config_cflags="$aros_config_cflags -fno-strict-aliasing -ffreestanding -fomit-frame-pointer -${gcc_target_cpu} -fbuiltin -Wno-volatile-register-var -DAROS_DOS_PACKETS"
1239                 aros_config_aflags="$aros_config_aflags -${gcc_target_cpu}"
1240                 aros_paranoia_cflags="$aros_paranoia_cflags -Wno-volatile-register-var"
1241                 aros_debug_cflags="$aros_debug_cflags -Wall -Wno-volatile-register-var"
1242                 target_tool_prefix="m68k-elf-"
1243                 # Needed to get the correct multilib
1244                 aros_config_ldflags="-${gcc_target_cpu}"
1245                 aros_shared_ldflags="-${gcc_target_cpu}"
1246                 aros_kernel_ldflags="-${gcc_target_cpu}"
1247                 aros_target_nostdlib_ldflags="-${gcc_target_cpu}"
1248                 aros_target_strip_flags="-R.comment --strip-debug"
1249                 aros_default_wbwidth=640
1250                 aros_default_wbheight=256
1251                 aros_default_wbdepth=2
1252                 ;;
1253             *ppc*)
1254                 aros_cpu="ppc"
1255                 aros_flavour="native"
1256                 gcc_target_cpu="ppc"
1257                 ;;
1258             *)
1259                 AC_MSG_ERROR("Unknown CPU for Amiga $target_cpu")
1260                 ;;
1261         esac
1262         ;;
1264     mingw*)
1265         aros_target_arch="mingw32"
1266         aros_shared_default="no"
1267         aros_flavour="emulation"
1268         aros_shared_cflags=""
1269         need_dlopen="no"
1270         rescomp="windres"
1271         case "$target_cpu" in
1272             *i?86*)
1273                 aros_target_cpu="i386"
1274                 aros_object_format="elf_i386"
1275                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1276                 aros_default_wbdepth=8
1277                 gcc_target_cpu="i386"
1278                 aros_target_cc="i386-aros-gcc"
1279                 aros_target_cxx="i386-aros-g++"
1280                 aros_target_ld="i386-aros-ld"
1281                 aros_target_as="i386-aros-as"
1282                 aros_target_ar="i386-aros-ar"
1283                 aros_target_ranlib="i386-aros-ranlib"
1284                 aros_target_nm="i386-aros-nm"
1285                 aros_target_strip="i386-aros-strip"
1286                 aros_target_objcopy="i386-aros-objcopy"
1287                 aros_target_objdump="i386-aros-objdump"
1288                 target_tool_prefix="i386-mingw32-"
1289                 ;;
1290             *x86_64*)
1291                 aros_target_cpu="x86_64"
1292                 aros_object_format="elf_x86_64"
1293                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
1294                 aros_config_cflags="$aros_config_cflags -fno-omit-frame-pointer"
1295                 aros_default_wbdepth=8
1296                 gcc_target_cpu="x86_64"
1297                 aros_target_cc="x86_64-aros-gcc"
1298                 aros_target_cxx="x86_64-aros-g++"
1299                 aros_target_ld="x86_64-aros-ld"
1300                 aros_target_as="x86_64-aros-as"
1301                 aros_target_ar="x86_64-aros-ar"
1302                 aros_target_ranlib="x86_64-aros-ranlib"
1303                 aros_target_nm="x86_64-aros-nm"
1304                 aros_target_strip="x86_64-aros-strip"
1305                 aros_target_objcopy="x86_64-aros-objcopy"
1306                 aros_target_objdump="x86_64-aros-objdump"
1307                 target_tool_prefix="x86_64-w64-mingw32-"
1308                 ;;
1309             *arm*)
1310                 aros_target_cpu="arm"
1311                 aros_object_format="armelf_linux_eabi"
1312                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
1313                 aros_arch_libs="-laeabi"
1314                 aros_default_wbdepth=8
1315                 gcc_target_cpu="arm"
1316                 aros_target_cc="arm-aros-gcc"
1317                 aros_target_cxx="arm-aros-g++"
1318                 aros_target_ld="arm-aros-ld"
1319                 aros_target_as="arm-aros-as"
1320                 aros_target_ar="arm-aros-ar"
1321                 aros_target_ranlib="arm-aros-ranlib"
1322                 aros_target_nm="arm-aros-nm"
1323                 aros_target_strip="arm-aros-strip"
1324                 aros_target_objcopy="arm-aros-objcopy"
1325                 aros_target_objdump="arm-aros-objdump"
1326                 target_tool_prefix="arm-mingw32ce-"
1327                 aros_default_wbwidth=160
1328                 aros_default_wbheight=160
1329                 ;;
1330             *)
1331                 AC_MSG_ERROR("Unknown CPU for Mingw32 -- $target_cpu")
1332                 ;;
1333         esac
1334         if test $host_os = "cygwin"; then
1335                 aros_kernel_cflags="-mno-cygwin"
1336         fi
1337     ;;
1338     pp*)
1339         aros_target_arch="pp"
1340         aros_shared_default="no"
1341         case "$target_cpu" in
1342             *m68k*)
1343                 aros_target_cpu="m68k"
1344                 aros_object_format="m68kelf"
1345                 aros_flavour="palmnative"
1346                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
1347                 aros_default_wbwidth=160
1348                 aros_default_wbheight=160
1349                 aros_default_wbdepth=1
1350                 aros_target_ar_flags="cru"
1351                 aros_compiler_libs="-lgcc1"
1352                 aros_shared_default=no
1353                 aros_shared_cflags="-fpic"
1354                 aros_shared_aflags=""
1355                 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
1356                 aros_kernel_ldflags="-Wl,-rpath,./lib"
1357                 aros_debug_cflags="-Wall -Werror-implicit-function-declaration $aros_symbols_debug  $aros_messages_debug -mc68000 -Wa,-mc68000"
1358                 aros_debug_aflags=""
1359                 aros_debug_ldflags="$aros_symbols_debug"
1360                 aros_mungwall_debug="0"
1361                 aros_modules_debug="0"
1362                 gcc_target_cpu="mc68000"
1363                 ignore_undefined_symbols="-ius"
1364                 ;;
1365            *)
1366                 AC_MSG_ERROR("Unknown CPU for PalmPilot -- $target_cpu")
1367                 ;;
1368         esac
1369         ;;
1371     mac*)
1372         aros_target_arch="mac"
1373         aros_shared_default="no"
1374         case "$target_cpu" in
1375             *m68k*)
1376                 aros_target_cpu="m68k"
1377                 aros_object_format="m68kelf"
1378                 aros_flavour="mac68knative"
1379                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
1380                 aros_default_wbwidth=512
1381                 aros_default_wbheight=384
1382                 aros_default_wbdepth=8
1383                 aros_target_ar_flags="cru"
1384                 aros_compiler_libs="-lgcc1"
1385                 aros_shared_default=no
1386                 aros_shared_cflags="-fpic"
1387                 aros_shared_aflags=""
1388                 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
1389                 aros_kernel_ldflags="-Wl,-rpath,./lib"
1390                 aros_debug_cflags="-Wall -Werror-implicit-function-declaration $aros_symbols_debug  $aros_messages_debug -mc68000"
1391                 aros_debug_aflags=""
1392                 aros_debug_ldflags="$aros_symbols_debug"
1393                 aros_mungwall_debug="0"
1394                 aros_modules_debug="0"
1395                 gcc_target_cpu="mc68000"
1396                 ignore_undefined_symbols="-ius"
1397                 ;;
1398            *)
1399                 AC_MSG_ERROR("Unknown CPU for Mac68k -- $target_cpu")
1400                 ;;
1401         esac
1402         ;;
1404     *)
1405         AC_MSG_ERROR([Unsupported target architecture $target])
1406         ;;
1407 esac
1409 AC_MSG_CHECKING([Where to download sourcecode for external ports])
1410 AC_ARG_WITH(portssources,AC_HELP_STRING([--with-portssources=DIR],[Where to download sourcecode for external ports]),with_portssrcdir=$withval,with_portssrcdir="default")
1411 if test "$with_portssrcdir" = "default"; then
1412     AROS_PORTSSRCDIR="$AROS_BUILDDIR_UNIX/bin/Sources"
1413 else
1414     AROS_PORTSSRCDIR="$with_portssrcdir"
1416 AC_MSG_RESULT($AROS_PORTSSRCDIR)
1418 AC_MSG_CHECKING([which bootloader to use])
1419 AC_ARG_WITH(bootloader,AC_HELP_STRING([--with-bootloader=NAME],[Use a specific bootloader]),target_bootloader=$withval,target_bootloader=$target_bootloader)
1420 if test "$target_bootloader" = "none"; then
1421     aros_target_bootloader=""
1422 else
1423     aros_target_bootloader="$target_bootloader"
1425 AC_MSG_RESULT($target_bootloader)
1427 AC_MSG_CHECKING([which icon-set to use])
1428 AC_ARG_WITH(iconset,AC_HELP_STRING([--with-iconset=NAME],[Use a specific Icon-set (default=Gorilla).]),target_iconset=$withval,target_iconset="default")
1429 if test "$target_iconset" = "default"; then
1430     aros_target_iconset="Gorilla"
1431     target_iconset="default (Gorilla)"
1432 else
1433     aros_target_iconset="$target_iconset"
1435 AC_MSG_RESULT($target_iconset)
1437 AC_MSG_CHECKING([which GUI Theme to use])
1438 AC_ARG_WITH(theme,AC_HELP_STRING([--with-theme=NAME],[Use a specific GUI Theme]),target_guitheme=$withval,target_guitheme="default")
1439 if test "$target_guitheme" = "default"; then
1440     aros_target_guitheme="Ice"
1441 else
1442     aros_target_guitheme="$target_guitheme"
1444 AC_MSG_RESULT($aros_target_guitheme)
1446 # Find out if we are cross-compiling (i.e. if we can't use the host compiler
1447 # for target code)
1448 cross_compiling=no
1449 if test "$aros_host_cpu" != "$aros_target_cpu" ; then
1450     cross_compiling=yes
1452 if test "$aros_host_cpu" == "x86_64" ; then
1453     if test "$aros_target_cpu" == "i386" ; then
1454         if test "$aros_target_arch" != "mingw32"; then
1455             cross_compiling=no
1456         fi
1457     fi
1459 if test "$aros_host_arch" == "darwin" ; then
1460     if test "$aros_target_arch" != "darwin" ; then
1461         cross_compiling=yes
1462     fi
1465 # Set prefix for target compiler etc. if we're cross-compiling
1466 # (should possibly be earlier but needs to be after AC_PROG_CC)
1467 if test "$cross_compiling" = "yes" ; then
1468     if test "$target_tool_prefix" = ""; then
1469         target_tool_prefix=${target_cpu}-elf-
1470     fi
1471     CC=${target_tool_prefix}gcc
1472     dnl CPP is needed for AC_CHECK_HEADER to work correctly
1473     CPP=${target_tool_prefix}cpp
1474     if test "$target_tool_version" != "default"; then
1475         CC="$CC-$target_tool_version"
1476         CPP="$CC-$target_tool_version"
1477     fi
1478     AC_PATH_PROG(CC,$CC)
1479     AROS_REQUIRED(gcc,$CC)
1481 CC="$CC $target_tool_flags"
1483 #-----------------------------------------------------------------------------
1485 # Disable pointer-signedness warnings if the compiler recognises the option
1487 AC_MSG_CHECKING([whether ${CC} accepts -Wno-pointer-sign])
1488 save_cflags="$CFLAGS"
1489 CFLAGS="$CFLAGS -Wno-pointer-sign"
1490 AC_TRY_COMPILE(,, use_no_sign_warning="yes", use_no_sign_warning="no")
1491 AC_MSG_RESULT($use_no_sign_warning)
1492 if test "x-$use_no_sign_warning" = "x-yes" ; then
1493     aros_config_cflags="$aros_config_cflags -Wno-pointer-sign"
1495 CFLAGS="$save_cflags"
1497 #-----------------------------------------------------------------------------
1499 # Find all the tools we need to compile. This could be cross-compiling
1500 # though! If that is the case we use the GNU form of the target and
1501 # simply add this to the front of the binary name. This is rather simple,
1502 # but it should work under most circumstances.
1504 # The default tools are to use the same as the host, but only if the
1505 # host and target CPU are the same. With GCC this is normally enough.
1508 aros_cc_pre=""
1509 aros_shared_ld="$aros_host_ld"
1511 aros_target_mkdep="$aros_host_mkdep"
1512 aros_target_incl_def="$aros_host_incl"
1514 aros_kernel_cc="$CC"
1516 # The default tools executables to be linked to.
1517 if test "$aros_target_cc" != ""; then
1518     AC_PATH_PROG(aros_target_cc,$aros_target_cc)
1519     AROS_REQUIRED(gcc,$aros_target_cc)
1521 if test "$aros_target_ld" != ""; then
1522     AC_PATH_PROG(aros_target_ld,$aros_target_ld)
1523     AROS_REQUIRED(ld,$aros_target_ld)
1526 if test "$crosstools" != "yes"; then
1527     AROS_TOOL_TARGET(aros_target_as_ln,as,$aros_target_as)
1528     AROS_REQUIRED(as,$aros_target_as_ln)
1529     AROS_TOOL_TARGET(aros_kernel_ld,ld,$aros_kernel_ld)
1530     AROS_REQUIRED(ld,$aros_kernel_ld)
1531     AROS_TOOL_TARGET(aros_target_ar_ln,ar,$aros_target_ar)
1532     AROS_REQUIRED(ar,$aros_target_ar_ln)
1533     AROS_TOOL_TARGET(aros_target_nm_ln,nm,$aros_target_nm)
1534     AROS_REQUIRED(nm,$aros_target_nm_ln)
1535     AROS_TOOL_TARGET(aros_target_objcopy_ln,objcopy,$aros_target_objcopy)
1536     AROS_REQUIRED(objcopy,$aros_target_objcopy_ln)
1537     AROS_TOOL_TARGET(aros_target_objdump_ln,objdump,$aros_target_objdump)
1538     AROS_REQUIRED(objdump,$aros_target_objdump_ln)
1539     AROS_TOOL_TARGET(aros_target_ranlib_ln,ranlib,$aros_target_ranlib)
1540     AROS_REQUIRED(ranlib,$aros_target_ranlib_ln)
1541     AROS_TOOL_TARGET(aros_target_strip_ln,strip,$aros_target_strip)
1542     AROS_REQUIRED(strip,$aros_target_strip_ln)
1543     if test "$aros_target_cxx" != ""; then
1544         AC_PATH_PROG(aros_target_cxx,$aros_target_cxx)
1545 # Temporarily disabled in order to let Mingw32-hosted nightly build to work
1546 #       AROS_REQUIRED(c++,$aros_target_cxx)
1547     fi
1548 else
1549 # Cancel preinstalled C++ compiler because it will be built as part of crosstools
1550     aros_target_cxx=""
1553 # Build crosstools if we have no C++ - temporary thing 
1554 if test "$aros_target_cxx" = ""; then
1555     crosstools_target=tools-crosstools
1558 if test "$rescomp" != ""; then
1559     if test "$cross_compiling" = "yes" ; then
1560         rescomp=${target_tool_prefix}${rescomp}
1561     fi
1562     AC_PATH_PROG(aros_kernel_rescomp,$rescomp)
1563     AROS_REQUIRED($rescomp,$aros_kernel_rescomp)
1566 aros_hostcfg_dir="bin/${aros_host_arch}-${aros_host_cpu}/gen/config"
1567 aros_targetcfg_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/config"
1568 aros_inc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/AROS/Development/include/aros"
1569 aros_gendir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen"
1570 aros_geninc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/include/aros"
1571 aros_tools_dir="bin/${aros_host_arch}-${aros_host_cpu}/tools"
1572 aros_scripts_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/scripts"
1574 # aros_cc_pre is a variable that is added to the front of the compiler name
1575 # in the generated aros-gcc shell script. We need this to enable the cache
1576 # to work across cleaned builds. Also, support DISTCC using the correct
1577 # environment variable.
1580 if test "x${DISTCC}" != "x" ; then
1581     if test "x${CCACHE}" != "x" ; then
1582         aros_cc_pre="env CCACHE_PREFIX=${DISTCC} ${CCACHE} "
1583     else
1584         aros_cc_pre="${DISTCC} "
1585     fi
1586 else
1587     if test "x${CCACHE}" != "x" ; then
1588         aros_cc_pre="${CCACHE} "
1589     fi
1592 prefix="${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros"
1594 AC_SUBST(aros_target_nostdinc_cflags,-nostdinc)
1595 AC_SUBST(aros_target_nostartup_ldflags,-nostartfiles)
1596 AC_SUBST(aros_target_nix_ldflags,-nix)
1597 AC_SUBST(aros_target_detach_ldflags,-detach)
1598 AC_SUBST(aros_target_nostdlib_ldflags,-nostdlib)
1600 # Target tools
1601 if test "$aros_target_cc" = ""; then
1602     orig_target_cc=$aros_kernel_cc
1603 else
1604     orig_target_cc=$aros_target_cc
1606 if test "$aros_target_ld" = ""; then
1607     orig_target_ld=$aros_kernel_ld
1608 else
1609     orig_target_ld=$aros_target_ld
1611 if test "$GCC" = "yes"; then
1612     aros_target_cc_path=`$orig_target_cc -print-search-dirs | grep "programs: =" | cut -c 12-`
1614 aros_target_cc="${prefix}-gcc"
1615 aros_target_as="${prefix}-as"
1616 aros_target_ld="${prefix}-ld"
1617 aros_target_ar="${prefix}-ar $aros_target_ar_flags"
1618 aros_target_objcopy=${prefix}-objcopy
1619 aros_target_objdump=${prefix}-objdump
1620 aros_target_ranlib="${prefix}-ranlib $aros_target_ranlib_flags"
1621 aros_target_nm="${prefix}-nm $aros_target_nm_flags"
1622 aros_kernel_nm="${prefix}-nm"
1623 aros_target_strip=${prefix}-strip
1625 # Find the system include path. We can suggest that an alternative is
1626 # used if we don't get it correct. The default is to use /usr/include.
1627 # Which is set in the aros_target_incl_def variable.
1629 AC_ARG_ENABLE(includes,
1630 AC_HELP_STRING([--enable-includes=dir],[Alternative system include directory]),
1631 [aros_target_incl=$enable_includes], [aros_target_incl=$aros_target_incl_def])
1633 if test "$aros_kernel_includes" = ""; then
1634     if test "x-$aros_flavour" = "x-emulation" -o "x-$aros_flavour" = "x-emulcompat" ; then
1635         # FIXME: for cross-compiling this should point to another location
1636         aros_kernel_includes="-isystem $aros_target_incl"
1637     fi
1640 if test "$aros_kernel_includes" != "" ; then
1641     dnl find out about the kernel cc's include path
1642     AC_MSG_CHECKING([for the kernel compiler's include path])
1643     if test "$aros_kernel_cc_includes" = "" ; then
1644         # Try to guess where the directory is.
1645         aros_kernel_cc_includes=`dirname \`${aros_kernel_cc} ${aros_kernel_cflags} -print-libgcc-file-name\``/include
1646         if test -d $aros_kernel_cc_includes; then
1647             # Check if there is also an include-fixed directory and add it
1648             # to kernel compiler's include path as it may contain some of
1649             # the headers we need.
1650             if test -d "$aros_kernel_cc_includes"-fixed; then
1651                 aros_kernel_cc_includes+=" -isystem $aros_kernel_cc_includes"-fixed
1652             fi
1653         else
1654             # The directory doesn't exist, we need to do some more work.
1655             aros_kernel_cc_includes=${PWD}/${aros_gendir}/cc_include
1657             # These are the headers we're looking for.
1658             headers="limits.h mmintrin.h stdbool.h syslimits.h float.h \
1659                      stddef.h xmmintrin.h iso646.h stdarg.h unwind.h   \
1660                      zutil.h"
1662             dirs=
1663             for h in $headers; do
1664                 # Which other headers are needed by each of the above?
1665                 deps=$(echo "#include <$h>" | \
1666                        $aros_kernel_cc -E -M - 2>/dev/null | \
1667                        sed 's/^.*://; s/\\$/ /g; s/[[ \t]]\+/ /g')
1669                 # Copy all the needed headers to a directory beneath gendir.
1670                 for d in $deps; do
1671                     h=$(basename $d)
1672                     dir=${aros_kernel_cc_includes}$(echo $(dirname $d) | \
1673                                                 sed -n "s,^.*/include\(/.*\),\1,p")
1674                     ! test -d $dir && mkdir -p $dir
1675                     ! test -f $dir/$h && { cp $d $dir; chmod u+w $dir/$h; }
1676                 done
1677             done            
1678         fi
1679     fi
1680     AC_MSG_RESULT($aros_kernel_cc_includes)
1681     # Adding -nostdinc to kernel includes as they are always used together.
1682     aros_kernel_includes="$aros_kernel_includes $aros_target_nostdinc_cflags -isystem $aros_kernel_cc_includes"
1685 dnl find out about the target cc's include path
1686 AC_MSG_CHECKING([for the target compiler's include path])
1687 if test "$aros_target_cc_includes" = "" ; then
1688     #try to guess where the directory is
1689     aros_target_cc_includes=`dirname \`${orig_target_cc} -print-libgcc-file-name\``/include
1690     if ! test -d $aros_target_cc_includes; then
1691         #the directory doesn't exist, we need to do some more work
1692         aros_target_cc_includes=${PWD}/${aros_gendir}/cc_include
1693         
1694         #these are the headers we're looling for
1695         headers="limits.h mmintrin.h stdbool.h syslimits.h float.h \
1696                  stddef.h xmmintrin.h iso646.h stdarg.h unwind.h   \
1697                  zutil.h"
1699         dirs=
1700         for h in $headers; do
1701             #which other headers each of the above headers needs?
1702             deps=$(echo "#include <$h>" | \
1703                    $orig_target_cc -E -M - 2>/dev/null | \
1704                    sed 's/^.*://; s/\\$/ /g; s/[[ \t]]\+/ /g')
1705             
1706             #copy all the needed headers to a directory beneath gendir
1707             for d in $deps; do
1708                 h=$(basename $d)
1709                 dir=${aros_target_cc_includes}$(echo $(dirname $d) | \
1710                                                 sed -n "s,^.*/include\(/.*\),\1,p")
1711                 ! test -d $dir && mkdir -p $dir
1712                 ! test -f $dir/$h && { cp $d $dir; chmod u+w $dir/$h; }
1713             done
1714         done        
1715     fi
1717 AC_MSG_RESULT($aros_target_cc_includes)
1720 # For GCC < 4.0 -I- is used for giving the search path for '#include "..."'
1721 # On GCC >= 4.0 -iquote should be used
1724 save_cc="$CC"
1725 save_cflags="$CFLAGS"
1726 CFLAGS="-iquote."
1727 AC_MSG_CHECKING([whether ${CC} accepts -iquote])
1728 AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
1729 AC_MSG_RESULT($has_iquote)
1730 if test "x-$has_iquote" = "x-yes" ; then
1731     host_cflags_iquote=-iquote
1732     host_cflags_iquote_end=
1733 else
1734     host_cflags_iquote=-I
1735     host_cflags_iquote_end=-I-
1737 kernel_cflags_iquote=$host_cflags_iquote
1738 kernel_cflags_iquote_end=$host_cflags_iquote_end
1739 if test "x-$cross_compiling" = "x-yes"; then
1740     CC="$aros_kernel_cc"
1741     AC_MSG_CHECKING([whether ${CC} accepts -fno-stack-protector])
1742     AC_TRY_COMPILE(,, use_no_stack_protector="yes", use_no_stack_protector="no")
1743     AC_MSG_RESULT($use_no_stack_protector)
1744     AC_MSG_CHECKING([whether ${CC} accepts -iquote])
1745     AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
1746     AC_MSG_RESULT($has_iquote)
1747     if test "x-$has_iquote" = "x-yes" ; then
1748         kernel_cflags_iquote=-iquote
1749         kernel_cflags_iquote_end=
1750     else
1751         kernel_cflags_iquote=-I
1752         kernel_cflags_iquote_end=-I-
1753     fi
1755 aros_cflags_iquote=$kernel_cflags_iquote
1756 aros_cflags_iquote_end=$kernel_cflags_iquote_end
1757 if test "$orig_target_cc" != "$aros_kernel_cc"; then
1758     CC="$orig_target_cc"
1759     AC_MSG_CHECKING([whether ${CC} accepts -iquote])
1760     AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
1761     AC_MSG_RESULT($has_iquote)
1762     if test "x-$has_iquote" = "x-yes" ; then
1763         aros_cflags_iquote=-iquote
1764         aros_cflags_iquote_end=
1765     else
1766         aros_cflags_iquote=-I
1767         aros_cflags_iquote_end=-I-
1768     fi
1770 if test "x-$use_no_stack_protector" = "x-yes" ; then
1771     aros_kernel_cflags="$aros_kernel_cflags -fno-stack-protector"
1774 #-----------------------------------------------------------------------------
1776 # Check if we can explicitly choose older version of symbol hashing
1778 CFLAGS="save_cflags -Wl,--hash-style=sysv"
1779 CC="$aros_kernel_cc"
1780 AC_MSG_CHECKING([whether ${CC} accepts -Wl,--hash-style=sysv])
1781 AC_TRY_LINK(,, use_hash_style="yes", use_hash_style="no")
1782 AC_MSG_RESULT($use_hash_style)
1783 if test "x-$use_hash_style" = "x-yes" ; then
1784     aros_kernel_cflags="$aros_kernel_cflags -Wl,--hash-style=sysv"
1786 CC="$save_cc"
1787 CFLAGS="$save_cflags"
1789 AC_SUBST(host_cflags_iquote)
1790 AC_SUBST(host_cflags_iquote_end)
1791 AC_SUBST(kernel_cflags_iquote)
1792 AC_SUBST(kernel_cflags_iquote_end)
1793 AC_SUBST(aros_cflags_iquote)
1794 AC_SUBST(aros_cflags_iquote_end)
1797 dnl Check if user specified --with-resolution=XRESxYRESxDEPTH
1798 AC_MSG_CHECKING([for default resolution of WBScreen])
1799 AC_ARG_WITH(resolution,AC_HELP_STRING([--with-resolution=XRESxYRESxDEPTH],[Default resolution of the initial WorkbenchScreen]),resolution=$withval,resolution=none)
1800 # We require an argument, so map --with/--without ("yes"/"no") to "none" specified
1801 if test "$resolution" = "yes" ; then
1802     resolution="none"
1804 if test "$resolution" = "no" ; then
1805     resolution="none"
1807 if test "$resolution" != "none" ; then
1808     aros_default_wbwidth=`echo $resolution | cut -d'x' -f1`
1809     aros_default_wbheight=`echo $resolution | cut -d'x' -f2`
1810     aros_default_wbdepth=`echo $resolution | cut -d'x' -f3`
1812 AC_MSG_RESULT($aros_default_wbwidth x $aros_default_wbheight x $aros_default_wbdepth)
1813 aros_cv_default_wbwidth=$aros_default_wbwidth
1814 aros_cv_default_wbheight=$aros_default_wbheight
1815 aros_cv_default_wbdepth=$aros_default_wbdepth
1817 dnl See if the user wants the serial debug output for native flavour
1818 AC_MSG_CHECKING([if serial debug is enabled])
1819 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)
1820 if test "$aros_serial_debug" = 0 ; then
1821     serial_debug_forced=""
1822     if test "$serial_debug" = "yes" ; then
1823         serial_debug="2"
1824     fi
1825     if test "$serial_debug" = "no" ; then
1826         serial_debug="none"
1827     fi
1828 else
1829     serial_debug_forced="(forced)"
1830     serial_debug=$aros_serial_debug
1832 if test "$serial_debug" != "none" ; then
1833     aros_serial_debug=$serial_debug
1834     AC_MSG_RESULT($serial_debug_forced on port $serial_debug)
1835 else
1836     AC_MSG_RESULT(no)
1839 dnl See if the user wants the palm debug output hack for palm native flavour
1840 AC_MSG_CHECKING([if palm debug hack is enabled])
1841 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")
1842 if test "$palm_debug_hack" = "yes" ; then
1843     aros_palm_debug_hack="1"
1845 AC_MSG_RESULT($palm_debug_hack)
1848 dnl See if the user wants nesting supervisor activated for unix flavour
1849 AC_MSG_CHECKING([if nesting supervisor support is enabled])
1850 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")
1851 if test "$nesting_supervisor" = "yes" ; then
1852     aros_nesting_supervisor="1"
1854 AC_MSG_RESULT($nesting_supervisor)
1856 dnl See if the user wants to disable MMU support
1857 dnl This can be overriden on per-target basis,
1858 dnl set $aros_enable_mmu to "yes" or "no" to do this
1859 if test "$aros_enable_mmu" = "" ; then
1860     AC_MSG_CHECKING([if MMU support is enabled])
1861     dnl Enabled by default
1862     AC_ARG_ENABLE(mmu,AC_HELP_STRING([--disable-mmu],[Disable MMU support (default=enabled)]),aros_enable_mmu=$enableval,aros_enable_mmu="yes")
1863     if test "$aros_enable_mmu" = "" ; then
1864         aros_enable_mmu="yes"
1865     fi
1866     AC_MSG_RESULT($aros_enable_mmu)
1868 if test "$aros_enable_mmu" = "no" ; then
1869     aros_enable_mmu="0"
1870 else
1871     aros_enable_mmu="1"
1873     
1875 dnl things specifically required for hosted flavours
1876 if test "x-$aros_flavour" = "x-emulation" -o "x-$aros_flavour" = "x-emulcompat" ; then
1878     if test "x-$need_dlopen" != "x-no" ; then
1879       dnl some kind of dynamic library access system is required for hostlib.resource
1880       AC_CHECK_FUNC(dlopen, have_dl="yes", have_dl="no")
1881       if test "x-$have_dl" = "x-no" ; then
1882           AC_CHECK_LIB(dl, dlopen, [have_dl="yes"
1883                                     aros_host_ldflags="$aros_host_ldflags -ldl"],
1884                                     have_dl="no")
1885       fi
1886       if test "x-$have_dl" = "x-no" ; then
1887           AC_MSG_ERROR([dlopen() dynamic linker functions not available])
1888       fi
1889     fi
1892     dnl x11 hidd
1893     AC_ARG_ENABLE(x11_hidd, AC_HELP_STRING([--enable-x11-hidd],
1894                                            [build X11 hidd for hosted (default=auto)]),
1895                                            x11_hidd="$enableval",
1896                                            x11_hidd="$need_x11")
1897     case "x-$x11_hidd" in
1898         x-yes|x-no|x-auto)                 ;;
1899         *)                 x11_hidd="$need_x11" ;;
1900     esac
1902     ENABLE_X11=0
1904     dnl they want it
1905     if test "x-$x11_hidd" != "x-no" ; then
1907         dnl find x11 stuff
1908         AC_PATH_X
1910         x_cflags=
1911         for path in $x_libraries
1912         do
1913             x_cflags="$x_cflags -L$path"
1914         done
1916         for path in $x_includes
1917         do
1918             x_cflags="$x_cflags -I$path"
1919         done
1920         
1921         if test "x-$no_x" = "x-yes" ; then
1923             dnl didn't find it
1924             if test "x-$x11_hidd" != "x-auto" ; then
1925                 dnl and they explicitly asked for it, bail out
1926                 AC_MSG_ERROR([X11 libs/headers not found, cannot build X11 hidd as requested])
1927             fi
1928         
1929         else
1930             dnl found it, setup the metatarget
1931             x11_hidd_target=kernel-x11gfx-kobj
1932             ENABLE_X11=1
1934             dnl setup shared memory extensions
1935             AC_ARG_ENABLE(x11_shm, AC_HELP_STRING([--enable-x11-shm],
1936                                                   [use X11 shared memory (default=auto)]),
1937                                                   x11_hidd_shm="$enableval",
1938                                                   x11_hidd_shm="auto")
1939             case "x-$x11_hidd_shm" in
1940                 x-yes|x-no|x-auto)                     ;;
1941                 *)                 x11_hidd_shm="auto" ;;
1942             esac
1944             have_xshm=no
1946             dnl they want it
1947             if test "x-$x11_hidd_shm" != "x-no" ; then
1949                 dnl system shm headers
1950                 AC_CHECK_HEADERS(sys/ipc.h)
1951                 AC_CHECK_HEADERS(sys/shm.h)
1953                 dnl got them
1954                 if test "x-$ac_cv_header_sys_ipc_h" = "x-yes" -a "x-$ac_cv_header_sys_shm_h" = "x-yes" ; then
1956                     dnl make sure X libs have shm functions
1957                     save_cflags="$CFLAGS"
1958                     CFLAGS="$CFLAGS $x_cflags"
1959                     AC_CHECK_LIB(Xext, XShmQueryExtension, have_xshm=yes)
1960                     CFLAGS="$save_cflags"
1961                 fi
1962             fi
1964             dnl detection done, prepare output
1965             if test "x-$have_xshm" = "x-yes" ; then
1966                 dnl we can do shm
1967                 DO_XSHM_SUPPORT="1"
1968             elif test "x-$x11_hidd_shm" = "x-yes" ; then
1969                 dnl they explicitly asked for it, but we can't do it
1970                 AC_MSG_ERROR([X11 has no support for shared memory, cannot enable it as requested])
1971             else
1972                 dnl otherwise just disable it
1973                 DO_XSHM_SUPPORT="0"
1974             fi
1976             
1977             dnl setup vidmode (fullscreen) extensions
1978             AC_ARG_ENABLE(x11_vidmode, AC_HELP_STRING([--enable-x11-vidmode],
1979                                                       [use X11 vidmode extension (default=auto)]),
1980                                                       x11_hidd_vidmode="$enableval",
1981                                                       x11_hidd_vidmode="auto")
1982             case "x-$x11_hidd_vidmode" in
1983                 x-yes|x-no|x-auto)                         ;;
1984                 *)                 x11_hidd_vidmode="auto" ;;
1985             esac
1987             have_vidmode=no
1989             dnl they want it
1990             if test "x-$x11_hidd_vidmode" != "x-no" ; then
1992                 dnl make sure X libs have vidmode functions
1993                 save_cflags="$CFLAGS"
1994                 CFLAGS="$CFLAGS $x_cflags"
1995                 AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryExtension, have_vidmode=yes)
1996                 CFLAGS="$save_cflags"
1997             fi
1999             dnl detection done, prepare output
2000             if test "x-$have_vidmode" = "x-yes" ; then
2001                 dnl we can do vidmode
2002                 DO_VIDMODE_SUPPORT="1"
2003             elif test "x-$x11_hidd_vidmode" = "x-yes" ; then
2004                 dnl they explicitly asked for it, but we can't do it
2005                 AC_MSG_ERROR([X11 vidmode extension not available, cannot enable it as requested])
2006             else
2007                 dnl otherwise just disable it
2008                 DO_VIDMODE_SUPPORT="0"
2009             fi
2010         fi
2012         aros_host_x11_includes=$x_includes 
2013         aros_host_x11_libdirs=$x_libraries
2014     fi
2017     dnl sdl hidd
2018     AC_ARG_ENABLE(sdl_hidd, AC_HELP_STRING([--enable-sdl-hidd],
2019                                            [build SDL hidd for hosted (default=auto)]),
2020                                            sdl_hidd="$enableval",
2021                                            sdl_hidd="auto")
2022     case "x-$sdl_hidd" in
2023         x-yes|x-no|x-auto)                 ;;
2024         *)                 sdl_hidd="auto" ;;
2025     esac
2027     dnl they want it
2028     if test "x-$sdl_hidd" != "x-no" ; then
2030         dnl find sdl
2031         AM_PATH_SDL([1.2.10], have_sdl="yes", have_sdl="no")
2033         if test "x-$have_sdl" != "x-yes" ; then
2035             dnl didn't find it
2036             if test "x-$sdl_hidd" != "x-auto" ; then
2037                 dnl and they explicitly asked for it, bail out
2038                 AC_MSG_ERROR([SDL libs/headers not found, cannot build SDL hidd as requested])
2039             fi
2041         else
2042             dnl found it, set up the metatarget
2043             sdl_hidd_target=kernel-hidd-sdl
2044             aros_host_sdl_cflags=SDL_CFLAGS
2045             aros_host_sdl_libs=SDL_LIBS
2046         fi
2047     fi
2049     dnl oss.library
2050     AC_CHECK_HEADER(sys/soundcard.h)
2051     if test "x-$ac_cv_header_sys_soundcard_h" = "x-yes" ; then
2052         oss_library_target=workbench-libs-oss-unix
2053     fi
2057 dnl See if the user wants dbus.library
2058 AC_MSG_CHECKING([if building of dbus.library is enabled])
2059 AC_ARG_ENABLE(dbus,AC_HELP_STRING([--enable-dbus],[Enable DBUS support via dbus.library (default=no)]),dbus="yes",dbus="no")
2060 if test "$dbus" = "yes" ; then
2061     ENABLE_DBUS=1
2062     DBUS_CFLAGS=`pkg-config --cflags dbus-1`
2063     DBUS_LIBFLAGS=`pkg-config --libs dbus-1`
2064     KERNEL_DBUS_KOBJ=kernel-dbus-kobj
2065     KERNEL_DBUS_INCLUDES=kernel-dbus-includes
2066 else
2067     ENABLE_DBUS=0
2069 AC_MSG_RESULT($dbus)
2072 dnl --------------------------------------------------------------------
2073 dnl Configuration Output Section
2074 dnl --------------------------------------------------------------------
2076 # Generic
2077 AC_SUBST(aros_arch)
2078 AC_SUBST(aros_cpu)
2079 AC_SUBST(aros_flavour)
2080 AC_SUBST(aros_flavour_uc)
2081 AC_SUBST(AROS_BUILDDIR)
2082 AC_SUBST(AROS_BUILDDIR_UNIX)
2083 AC_SUBST(SRCDIR)
2084 AC_SUBST(AROS_PORTSSRCDIR)
2086 # Host related
2087 AC_SUBST(aros_cc_pre)
2088 AC_SUBST(aros_host_strip)
2089 AC_SUBST(aros_host_arch)
2090 AC_SUBST(aros_host_cpu)
2091 AC_SUBST(aros_host_cc)
2092 AC_SUBST(aros_host_ar)
2093 AC_SUBST(aros_host_ranlib)
2094 AC_SUBST(aros_host_ld)
2095 AC_SUBST(aros_host_make)
2096 AC_SUBST(aros_host_cflags)
2097 AC_SUBST(gnu89_inline)
2098 AC_SUBST(aros_host_ldflags)
2099 AC_SUBST(aros_host_debug)
2100 AC_SUBST(aros_host_mkdep)
2101 AC_SUBST(aros_host_mkargs)
2102 AC_SUBST(aros_host_exe_suffix)
2103 AC_SUBST(aros_host_lib_suffix)
2104 AC_SUBST(aros_tools_dir)
2105 AC_SUBST(aros_host_aclocal)
2106 AC_SUBST(aros_host_autoconf)
2107 AC_SUBST(aros_host_autoheader)
2108 AC_SUBST(aros_host_automake)
2110 # Target Related
2111 AC_SUBST(aros_target_guitheme)
2112 AC_SUBST(aros_target_iconset)
2113 AC_SUBST(aros_target_bootloader)
2114 AC_SUBST(aros_target_arch)
2115 AC_SUBST(aros_target_family)
2116 AC_SUBST(aros_target_cpu)
2117 AC_SUBST(aros_target_variant)
2118 AC_SUBST(aros_target_suffix)
2119 AC_SUBST(aros_target_incl)
2120 AC_SUBST(aros_target_ar)
2121 AC_SUBST(aros_target_ranlib)
2122 AC_SUBST(aros_kernel_nm)
2123 AC_SUBST(orig_target_cc)
2124 AC_SUBST(aros_target_cc)
2125 AC_SUBST(aros_target_cxx)
2126 AC_SUBST(aros_kernel_cc)
2127 AC_SUBST(aros_target_as)
2128 AC_SUBST(orig_target_ld)
2129 AC_SUBST(aros_target_ld)
2130 AC_SUBST(aros_kernel_ld)
2131 AC_SUBST(aros_target_cc_includes)
2132 AC_SUBST(aros_target_cc_path)
2133 AC_SUBST(aros_target_objdump)
2134 AC_SUBST(aros_target_objcopy)
2135 AC_SUBST(aros_target_strip)
2136 AC_SUBST(aros_target_nm)
2137 AC_SUBST(aros_kernel_rescomp)
2138 AC_SUBST(aros_shared_default)
2139 AC_SUBST(aros_shared_ld)
2140 AC_SUBST(aros_object_format)
2141 AC_SUBST(aros_compiler_libs)
2142 AC_SUBST(aros_arch_libs)
2144 AC_SUBST(aros_config_cflags)
2145 AC_SUBST(aros_config_aflags)
2146 AC_SUBST(aros_config_ldflags)
2148 AC_SUBST(aros_shared_cflags)
2149 AC_SUBST(aros_shared_aflags)
2150 AC_SUBST(aros_shared_ldflags)
2151 AC_SUBST(aros_kernel_cflags)
2152 AC_SUBST(aros_kernel_includes)
2153 AC_SUBST(aros_kernel_objcflags)
2154 AC_SUBST(aros_kernel_ldflags)
2155 AC_SUBST(aros_target_cflags)
2156 AC_SUBST(aros_debug_cflags)
2157 AC_SUBST(aros_debug_aflags)
2158 AC_SUBST(aros_debug_ldflags)
2159 AC_SUBST(aros_paranoia_cflags)
2160 AC_SUBST(aros_target_genmap)
2161 AC_SUBST(aros_target_strip_flags)
2163 AC_SUBST(crosstools_target)
2165 # Graphics Related
2166 AC_SUBST(x11_hidd_target)
2167 AC_SUBST(sdl_hidd_target)
2168 AC_SUBST(pci_hidd_target)
2169 AC_SUBST(oss_library_target)
2171 AC_SUBST(aros_default_wbwidth)
2172 AC_SUBST(aros_default_wbheight)
2173 AC_SUBST(aros_default_wbdepth)
2174 AC_SUBST(DO_XSHM_SUPPORT)
2175 AC_SUBST(DO_VIDMODE_SUPPORT)
2177 AC_SUBST(aros_host_x11_includes)
2178 AC_SUBST(aros_host_x11_libdirs)
2179 AC_SUBST(aros_host_sdl_cflags)
2180 AC_SUBST(aros_host_sdl_libs)
2182 # Native version related
2183 AC_SUBST(aros_serial_debug)
2185 # Palm native version related
2186 AC_SUBST(aros_palm_debug_hack)
2188 # Unix/Hosted version related
2189 AC_SUBST(aros_nesting_supervisor)
2191 # MMU related
2192 AC_SUBST(aros_enable_mmu)
2194 # Apple iOS related
2195 AC_SUBST(aros_ios_platform)
2196 AC_SUBST(aros_ios_version)
2197 AC_SUBST(aros_ios_sdk)
2199 # Android related
2200 AC_SUBST(android_tool)
2201 AC_SUBST(aros_android_level)
2203 # DBUS related
2204 AC_SUBST(ENABLE_DBUS)
2205 AC_SUBST(DBUS_CFLAGS)
2206 AC_SUBST(DBUS_LIBFLAGS)
2207 AC_SUBST(KERNEL_DBUS_KOBJ)
2208 AC_SUBST(KERNEL_DBUS_INCLUDES)
2210 #X11 related
2211 AC_SUBST(ENABLE_X11)
2213 # Debug related
2214 AC_SUBST(aros_debug)
2215 AC_SUBST(aros_mungwall_debug)
2216 AC_SUBST(aros_stack_debug)
2217 AC_SUBST(aros_modules_debug)
2219 # Collect-aros stuff: "-ius" to ignore undefined symbols
2220 AC_SUBST(ignore_undefined_symbols)
2222 # C compiler related
2223 AC_SUBST(gcc_target_cpu)
2225 dnl Prepare for output, make up all the generated patches
2226 case "$aros_flavour" in
2227 emulation)      aros_flavour_uc="AROS_FLAVOUR_EMULATION"
2228                 aros_flavour="emulation" ;;
2229 emulcompat)     aros_flavour_uc="(AROS_FLAVOUR_EMULATION|AROS_FLAVOUR_BINCOMPAT)"
2230                 aros_flavour="emulation" ;;
2231 standalone)     aros_flavour_uc="AROS_FLAVOUR_STANDALONE"
2232                 aros_flavour="standalone";;
2233 standcompat)    aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_BINCOMPAT)"
2234                 aros_flavour="standalone";;
2235 native)         aros_flavour_uc="AROS_FLAVOUR_NATIVE"
2236                 aros_flavour="native" ;;
2237 nativecompat)   aros_flavour_uc="(AROS_FLAVOUR_NATIVE|AROS_FLAVOUR_BINCOMPAT)"
2238                 aros_flavour="native" ;;
2239 linklib)        aros_flavour_uc="AROS_FLAVOUR_LINKLIB"
2240                 aros_flavour="linklib" ;;
2241 palmnative)     aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
2242                 aros_flavour="palmnative" ;;
2243 mac68knative)   aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
2244                 aros_flavour="mac68knative" ;;
2245 ppcnative)      aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_BINCOMPAT)"
2246                 aros_flavour="ppcnative" ;;
2247 esac
2249 if test ! -d ${aros_inc_dir} ; then
2250     ${MKDIR} ${aros_inc_dir}
2252 if test ! -d ${aros_geninc_dir} ; then
2253     ${MKDIR} ${aros_geninc_dir}
2255 if test ! -d ${aros_hostcfg_dir} ; then
2256     ${MKDIR} ${aros_hostcfg_dir}
2258 if test ! -d ${aros_targetcfg_dir} ; then
2259     ${MKDIR} ${aros_targetcfg_dir}
2261 if test ! -d ${aros_tools_dir} ; then
2262     ${MKDIR} ${aros_tools_dir}
2264 if test ! -d ${aros_scripts_dir} ; then
2265     ${MKDIR} ${aros_scripts_dir}
2268 AC_CONFIG_HEADERS(${aros_geninc_dir}/host-conf.h:config/host-conf.h.in)
2270 AC_CONFIG_COMMANDS([compiler_executable],
2271     [
2272         prefix=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}
2273         mkdir -p $prefix
2274         prefix="${prefix}/${aros_target_cpu}-aros"
2275         prefix2=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros
2277         echo ${prefix}
2278         echo ${prefix2}
2279         chmod a+x ${prefix2}-gcc ${prefix2}-ld
2281         ln -sf ${prefix2}-gcc          ${prefix}-gcc
2282         ln -sf ${prefix2}-ld           ${prefix}-ld
2284         ln -sf $aros_target_as_ln$aros_host_exe_suffix      ${prefix}-as
2285         ln -sf $aros_target_nm_ln$aros_host_exe_suffix      ${prefix}-nm
2286         ln -sf $aros_target_ar_ln$aros_host_exe_suffix      ${prefix}-ar
2287         ln -sf $aros_target_ranlib_ln$aros_host_exe_suffix  ${prefix}-ranlib
2288         ln -sf $aros_target_objcopy_ln$aros_host_exe_suffix ${prefix}-objcopy
2289         ln -sf $aros_target_objdump_ln$aros_host_exe_suffix ${prefix}-objdump
2290         ln -sf $aros_target_strip_ln$aros_host_exe_suffix   ${prefix}-strip
2292         ln -sf $aros_target_as_ln$aros_host_exe_suffix      ${prefix2}-as
2293         ln -sf $aros_target_nm_ln$aros_host_exe_suffix      ${prefix2}-nm
2294         ln -sf $aros_target_ar_ln$aros_host_exe_suffix      ${prefix2}-ar
2295         ln -sf $aros_target_ranlib_ln$aros_host_exe_suffix  ${prefix2}-ranlib
2296         ln -sf $aros_target_objcopy_ln$aros_host_exe_suffix ${prefix2}-objcopy
2297         ln -sf $aros_target_objdump_ln$aros_host_exe_suffix ${prefix2}-objdump
2298         ln -sf $aros_target_strip_ln$aros_host_exe_suffix   ${prefix2}-strip
2299     ],
2300     [
2301         aros_host_exe_suffix=${aros_host_exe_suffix}
2302         aros_tools_dir=${aros_tools_dir}
2303         aros_target_cpu=${aros_target_cpu}
2304         aros_target_arch=${aros_target_arch}
2305         aros_target_suffix=${aros_target_suffix}
2306         aros_target_nm_ln=${aros_target_nm_ln}
2307         aros_target_as_ln=${aros_target_as_ln}
2308         aros_target_ar_ln=${aros_target_ar_ln}
2309         aros_target_ranlib_ln=${aros_target_ranlib_ln}
2310         aros_target_objdump_ln=${aros_target_objdump_ln}
2311         aros_target_objcopy_ln=${aros_target_objcopy_ln}
2312         aros_target_strip_ln=${aros_target_strip_ln}
2313     ]
2315 AC_CONFIG_COMMANDS([genshared_executable],
2316     [chmod a+x ${aros_scripts_dir}/genshared],
2317     [aros_scripts_dir=${aros_scripts_dir}]
2319 AC_CONFIG_COMMANDS([genmf_executable],
2320     [chmod a+x ${aros_tools_dir}/genmf.py],
2321     [aros_tools_dir=${aros_tools_dir}]
2324 AC_CONFIG_FILES(
2325     Makefile
2326     config/make.cfg
2327     ${aros_inc_dir}/config.h:config/config.h.in
2328     ${aros_geninc_dir}/config.h:config/config.h.in
2329     ${aros_hostcfg_dir}/host.cfg:config/host.cfg.in
2330     ${aros_targetcfg_dir}/target.cfg:config/target.cfg.in
2331     mmake.config
2332     ${aros_targetcfg_dir}/make.defaults:config/make.defaults.in
2333     ${aros_targetcfg_dir}/specs:config/specs.in
2334     ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-gcc:scripts/aros-gcc.in
2335     ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-ld:scripts/aros-ld.in
2336     ${aros_scripts_dir}/genshared:compiler/library_template_c/source/lib_source/genshared.in
2337     ${aros_tools_dir}/genmf.py:tools/genmf/genmf.py
2338     tools/collect-aros/env.h
2339     ${aros_gendir}/arch/all-android/bootstrap/app/default.properties:arch/all-android/bootstrap/app/default.properties.in
2342 AC_OUTPUT
2344 dnl This is in order to not define SHARED_CFLAGS sometimes
2345 dnl We don't always do aros_shared_ar, aros_shared_cflags
2347 #XXX compatability...
2348 aros_shared_ar="$aros_shared_ld $aros_shared_ldflags -o"
2350 if test -n "$aros_shared_cflags" ; then
2351     echo "SHARED_CFLAGS := $aros_shared_cflags" >> ${aros_hostcfg_dir}/host.cfg
2352     echo "SHARED_AR := $aros_shared_ar" >> ${aros_hostcfg_dir}/host.cfg