need to be in priveladged mode to flush the caches
[AROS.git] / configure.in
blob9721255575d15aac31808d578305c0cc0cf7e409
1 dnl Copyright © 1997-2012, The AROS Development Team. All rights reserved.
2 dnl $Id$
3 dnl
4 dnl Desc: Autoconf source for configuration file
5 dnl Lang: english 
7 # Note: After file changes, generate configure anew and commit _both_ files.
9 #TODO
10 # method of getting shared/non-shared ld/ar tool for target.
12 # ------------------------------------------------------------------------
13 # Here starts the first section of the configure.in file.
14 # ------------------------------------------------------------------------
16 AC_INIT(mmakefile)
17 AC_PREREQ(2.61)
18 AC_CONFIG_AUX_DIR(scripts/autoconf)
20 # Check what host we are running on.
21 # If a target is not suggested, we use this one.
22 # Note that what we call a target, Autoconf calls a host.
23 AC_CANONICAL_HOST
25 # The AROS target is slightly different to the normal GNU style
26 # format. We don't have the middle part, and we reverse the order
27 # of the $(CPU) and $(OS) bits.
29 # Don't strip the version of the target yet, it might be
30 # useful on some systems.
32 AC_MSG_CHECKING([for AROS style target])
34 if test "$target" = "NONE" ; then
35     target=$host_os-$host_cpu
36 else
37     if test "$target" = "" ; then
38         target=$host_os-$host_cpu
39     fi
41 AC_MSG_RESULT($target)
43 if test "$host_os" = "mingw32" ; then
44     PWDCMD="pwd -W"
47 # Don't know where else to put this...
48 AC_MSG_CHECKING([building AROS in])
49 AROS_BUILDDIR=`${PWDCMD-pwd}`
50 AROS_BUILDDIR_UNIX=${PWD}
51 AC_MSG_RESULT($AROS_BUILDDIR)
53 AC_MSG_CHECKING([AROS source in])
54 srcpwd=`cd ${srcdir} ; ${PWDCMD-pwd}`
55 SRCDIR=${srcpwd}
56 AC_MSG_RESULT($SRCDIR)
58 # Parse the target field into something useful.
59 changequote(<<,>>)
60 target_os=`echo $target | sed 's/^\([^-].*\)-\(.*\)$/\1/'`
61 target_cpu=`echo $target | sed 's/^\([^-].*\)-\(.*\)$/\2/'`
62 changequote([,])
64 # Some debug output, to be removed again.
65 AC_MSG_CHECKING([for target system (debug output)])
66 AC_MSG_RESULT($target_os)
67 AC_MSG_CHECKING([for target cpu (debug output)])
68 AC_MSG_RESULT($target_cpu)
70 dnl --------------------------------------------------------------------
71 dnl Set the default Workbench resolution
72 dnl --------------------------------------------------------------------
73 aros_default_wbwidth=800
74 aros_default_wbheight=600
75 aros_default_wbdepth=4
77 dnl --------------------------------------------------------------------
78 dnl Host Configuration Section
79 dnl --------------------------------------------------------------------
80 dnl
81 dnl The idea here is to find out all the information we need about the
82 dnl host. This means things like tools for building directory structures,
83 dnl copying files around and the like.
85 # The first step is to find the host binaries.
86 # Check for a compiler.
87 # Due to a bug in autoconf check for c++ compiler first.
88 # For mor info see, http://osdir.com/ml/bug-autoconf-gnu/2010-05/msg00001.html.
89 AC_PROG_CXX
90 AC_PROG_CC
91 AC_PROG_CC_STDC
92 AC_PROG_CPP
94 # Check for a compatible awk
95 AC_CHECK_PROGS(AWK,[gawk nawk])
96 AROS_REQUIRED(gawk,$AWK)
97 AROS_PROG(MMAKE,mmake)
99 # Perform some default variable assignments. Note all of these will be
100 # Regenerated from the script, so there is no need to cache them.
102 aros_host_cpp="$CPP"
103 aros_host_cc="$CC"
104 aros_host_cxx="$CXX"
105 AROS_TOOL_CCPATH(aros_host_ld,ld)
106 AROS_REQUIRED(ld,$aros_host_ld)
107 aros_host_make="make"
108 aros_host_cflags=$CFLAGS
109 aros_host_cxxflags=$CXXFLAGS
110 aros_host_ldflags=$LDFLAGS
111 aros_host_debug="-g -O0"
112 aros_host_mkdep="\$(SRCDIR)/scripts/mkdep"
113 aros_host_mkargs="--no-print-directory"
114 aros_host_exe_suffix="$EXEEXT"
115 aros_host_lib_suffix=""
117 # Ignore all compliance, AROS ROMs = 0
118 # KickStart v1.0 = 30
119 # KickStart v1.3 = 34
120 # KickStart v2.0 = 37
121 # KickStart v3.0 = 39
122 # KickStart v3.1 = 40
123 # AmigaOS   v3.5 = 44
124 aros_amigaos_compliance=0
126 AC_CHECK_PROGS(aros_host_aclocal,[aclocal aclocal19 aclocal-1.9])
127 AC_CHECK_PROGS(aros_host_autoconf,[autoconf autoconf259 autoconf253])
128 AC_CHECK_PROGS(aros_host_autoheader,[autoheader autoheader259 autoheader253])
129 AC_CHECK_PROGS(aros_host_automake,[automake automake19 automake-1.9])
131 AROS_REQUIRED(aclocal/aclocal19/aclocal-1.9, $aros_host_aclocal)
132 AROS_REQUIRED(automake/automake19/automake-1.9, $aros_host_automake)
134 case "$aros_host_cc" in
135     *gcc*)
136         aros_host_cc_pipe="-pipe"
137         ;;
138     icc)
139         aros_host_cc_pipe=""
140         ;;
141     *)
142         aros_host_cc_pipe=""
143         ;;
144 esac
146 aros_kernel_cc_includes=""
147 aros_target_cc_includes=""
148 host_cc_elf=yes
150 # ----------------------------------------------------------------------------------------
151 # Host-specific defaults
153 # This is the main host configuration section. It is where the host
154 # can change the values of any variables it needs to change. We do
155 # not look at anything that compiles to the target yet, we'll get
156 # to that later.
158 case "$host_os" in
159     aros*)
160         aros_host_arch="aros"
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             *powerpc*)
170                 aros_host_cpu="ppc"
171                 ;;
172             *)
173                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
174                 aros_host_cpu="$host_cpu"
175                 ;;
176         esac
177         ;;
179     linux*)
180         aros_host_arch="linux"
181         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
182         android_build_os="linux-x86"
183         android_tool="android"
184         default_android_sdk="/opt/android-sdk-linux_x86"
185         case "$host_cpu" in
186             *i?86*)
187                 aros_host_cpu="i386"
188                 ;;
189             *x86_64*)
190                 aros_host_cpu="x86_64"
191                 ;;
192             *m68k*)
193                 aros_host_cpu="m68k"
194                 ;;
195             *powerpc*)
196                 aros_host_cpu="ppc"
197                 ;;
198             *arm*)
199                 aros_host_cpu="arm"
200                 ;;
201             *)
202                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
203                 aros_host_cpu="$host_cpu"
204                 ;;
205         esac
206         ;;
208     freebsd*)
209         aros_host_cc="$aros_host_cc $aros_host_cc_pipe -I/usr/local/include"
210         aros_host_make="gmake"
211         aros_host_arch="freebsd"
212         aros_host_cpu="i386"
214         aros_host_ldflags="$aros_host_ldflags -L/usr/local/lib -liconv"
216         dnl FreeBSD 5.x (and later) has changed the default object format.
217         dnl The double [[]] is necessary to get around m4's quoting rules.
218         case $host_os in
219             freebsd[[234]]*)
220                 aros_object_format="elf_i386"
221                 ;;
223             *)
224                 aros_object_format="elf_i386_fbsd"
225                 ;;
226         esac
228         ;;
230     darwin*)
231         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
232         aros_host_arch="darwin"
233         host_cc_elf=no
234         android_build_os="darwin-x86"
235         android_tool="android"
236         default_android_sdk="/android-sdk-mac_x86"
237         case "$host_cpu" in
238             *i?86*)
239                 aros_host_cpu="i386"
240                 ;;
241             *x86_64*)
242                 aros_host_cpu="x86_64"
243                 ;;
244             *powerpc*)
245                 aros_host_cpu="ppc"
246                 ;;
247             *)
248                 AC_MSG_WARN("Unknown CPU for Darwin host -- $host_cpu")
249                 aros_host_cpu="$host_cpu"
250                 ;;
251         esac
253         aros_host_ldflags="$aros_host_ldflags -liconv"
255         ;;
257     dragonfly*)
258         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
259         aros_host_make="gmake"
260         aros_host_arch="dragonfly"
261         case $host_cpu in
262             *i?86*)
263                 aros_host_cpu="i386"
264                 ;;
265             *amd64*)
266                 aros_host_cpu="x86_64"
267                 ;;
268             *)
269                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
270                 aros_host_cpu="$host_cpu"
271                 ;;
272         esac
273         ;;
275     netbsd*)
276         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
277         aros_host_make="gmake"
278         aros_host_arch="netbsd"
279         case "$host_cpu" in
280             *i?86*)
281                 aros_host_cpu="i386"
282                 ;;
283             *m68k*)
284                 aros_host_cpu="m68k"
285                 ;;
286             *)
287                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
288                 aros_host_cpu="$host_cpu"
289                 ;;
290         esac    
291         aros_host_lib_suffix=".0.0"
292         ;;
294     openbsd*)
295         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
296         aros_host_make="gmake"
297         aros_host_arch="openbsd"
298         case "$host_cpu" in
299             *i?86*)
300                 aros_host_cpu="i386"
301                 ;;
302             *)
303                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
304                 aros_host_cpu="$host_cpu"
305                 ;;
306         esac
307         ;;
308         
309     solaris*)
310         aros_host_arch="solaris"
311         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
312         case "$host_cpu" in
313             *i?86*)
314                 aros_host_cpu="i386"
315                 ;;
316             *sparc*)
317                 aros_host_cpu="sparc"
318                 ;;
319             *)
320                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
321                 aros_host_cpu="$host_cpu"
322                 ;;
323         esac
324         ;;
326     morphos*)
327         aros_host_arch="morphos"
328         aros_host_cpu="ppc"
329         host_cc_elf=no
330         ;;
332     amiga*)
333         aros_host_arch="amiga"
334         host_cc_elf=no
335         SORT="/gg/bin/sort"
336         TEST="/gg/bin/test"
337         UNIQ="/gg/bin/uniq"
338         FOR="for"
339         TOUCH="/gg/bin/touch"
340         case "$host_cpu" in
341             *m68k*)
342                 aros_host_cpu="m68k"
343                 ;;
344             *powerpc*)
345                 aros_host_cpu="ppc"
346                 ;;
347             *)
348                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
349                 aros_host_cpu="$host_cpu"
350                 ;;
351         esac
352         ;;
354     cygwin*)
355         aros_host_arch="cygwin"
356         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
357         host_cc_elf=no
358         android_build_os="windows"
359         android_tool="android.bat"
360         default_android_sdk="/cygdrive/c/android-sdk-windows-1.6_r1"
362         case "$host_cpu" in
363             *i?86*)
364                 aros_host_cpu="i386"
365                 ;;
366             *)
367                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
368                 aros_host_cpu="$host_cpu"
369                 ;;
370         esac
371         ;;
373     mingw32*)
374         aros_host_arch="mingw32"
375         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
376         host_cc_elf=no
377         android_build_os="windows"
378         android_tool="android.bat"
379         default_android_sdk="/c/android-sdk-windows-1.6_r1"
381         case "$host_cpu" in
382         *i?86*)
383             dnl Currently there's neither 64-bit MinGW nor MSYS. Both environments are 32-bit
384             dnl and run under emulation. Consequently, uname reports i386 even on 64-bit systems.
385             dnl Here we attempt to detect Windows home platform by asking gcc about its target.
386             dnl 64-bit gcc will output "x86_64-w64-mingw32" here.
388             AC_MSG_CHECKING([for Windows native gcc target])
389             host_cpu=`gcc -dumpmachine`
390             AC_MSG_RESULT($host_cpu)
391             ;;
393         esac
395         case "$host_cpu" in
396         *i?86*)
397             aros_host_cpu="i386"
398             ;;
400         mingw32*)
401             dnl Native i386 gcc for MinGW32 reports 'mingw32' with -dumpmachine switch
402             aros_host_cpu="i386"
403             ;;
405         *x86_64*)
406             aros_host_cpu="x86_64"
407             dnl Dragon's x86_64-w64-mingw32-gcc is a bit broken. It ignores standard $prefix/include
408             dnl directory, so we have to add it explicitly here.
409             aros_host_cflags="$aros_host_cflags -isystem /mingw/include"
410             ;;
412         *)
413             AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
414             aros_host_cpu="$host_cpu"
415             ;;
416         esac
417         ;;
418     *)
419         AC_MSG_ERROR([Unsupported host architecture $host])
420         ;;
421 esac
423 AROS_PROG(aros_host_ar,[ar],[cr])
424 AROS_REQUIRED(ar,$aros_host_ar)
425 AROS_PROG(aros_host_ranlib,ranlib)
426 AROS_REQUIRED(ranlib,$aros_host_ranlib)
427 AROS_PROG(aros_host_strip,strip)
428 AROS_REQUIRED(strip,$aros_host_strip)
430 AROS_PROG(RM,[rm],[-rf])
431 AROS_REQUIRED(rm,$RM)
432 AROS_PROG(CP,[cp])
433 AROS_REQUIRED(cp,$CP)
434 AROS_PROG(MV,[mv])
435 AROS_REQUIRED(mv,$MV)
436 AROS_PROG(ECHO,[echo])
437 AROS_REQUIRED(echo,$ECHO)
438 AROS_PROG(MKDIR,[mkdir],[-p])
439 AROS_REQUIRED(mkdir,$MKDIR)
440 AROS_PROG(TOUCH,[touch])
441 AROS_REQUIRED(touch,$TOUCH)
442 AROS_PROG(SORT,[sort])
443 AROS_REQUIRED(sort,$SORT)
444 AROS_PROG(UNIQ,[uniq])
445 AROS_REQUIRED(uniq,$UNIQ)
446 AROS_PROG(NOP,[true])
447 AROS_REQUIRED(true,$NOP)
448 AROS_PROG(CAT,[cat])
449 AROS_REQUIRED(cat,$CAT)
450 AROS_PROG(BISON,[bison])
451 AROS_REQUIRED(bison,$BISON)
452 AROS_PROG(FLEX,[flex])
453 AROS_REQUIRED(flex,$FLEX)
454 AROS_PROG(PNGTOPNM,[pngtopnm])
455 AROS_REQUIRED(pngtopnm,$PNGTOPNM)
456 AROS_PROG(PPMTOILBM,[ppmtoilbm])
457 AROS_REQUIRED(ppmtoilbm,$PPMTOILBM)
458 AROS_PROG(SED,[sed])
459 AROS_REQUIRED(sed,$SED)
460 AROS_PROG(CHMOD,[chmod])
461 AROS_REQUIRED(chmod,$CHMOD)
462 AROS_PROG(PATCH,[patch])
463 AROS_REQUIRED(patch,$PATCH)
465 AM_PATH_PYTHON(2.5)
467 AC_CHECK_LIB(png, png_read_png)
468 AROS_REQUIRED(libpng, $ac_cv_lib_png_png_read_png)
470 AC_SUBST(FOR, for)
471 AC_SUBST(IF, if)
472 AC_SUBST(TEST, test)
473 AC_SUBST(CMP, cmp)
475 dnl ---------------------------------------------------------------------------
476 dnl Look for things about the host system, good for hosted targets.
477 dnl ---------------------------------------------------------------------------
479 # Check for some includes for the X11 HIDD and the kernel
480 AC_CHECK_HEADERS([sys/ipc.h sys/shm.h \
481     sys/mmap.h sys/mman.h sysexits.h \
482     sys/statfs.h sys/statvfs.h sys/vfs.h sys/param.h \
485 AC_CHECK_HEADERS([sys/mount.h],,,[#include <sys/param.h>])
487 AC_HEADER_DIRENT
488 AC_HEADER_STAT
489 AC_HEADER_STDC
490 AC_HEADER_SYS_WAIT
491 AC_HEADER_TIME
492 AC_STRUCT_ST_BLKSIZE
493 AC_STRUCT_ST_BLOCKS
494 AC_STRUCT_ST_RDEV
495 AC_STRUCT_TM
496 AC_STRUCT_TIMEZONE
497 AC_TYPE_OFF_T
498 AC_TYPE_PID_T
499 AC_TYPE_SIZE_T
500 AC_TYPE_UID_T
502 AC_CHECK_MEMBERS(struct tm.tm_gmtoff)
504 # Look for some functions
505 AC_CHECK_FUNCS([getpagesize kqueue statfs statvfs \
506     clone kse_create rfork_thread thr_create sa_register \
507     getcontext makecontext setcontext sigaltstack swapcontext])
509 AC_FUNC_MMAP
512 dnl --------------------------------------------------------------------
513 dnl Target Configuration Section
514 dnl --------------------------------------------------------------------
516 dnl The target configuration section is responsible for setting up all
517 dnl the paths for includes, and tools required to build AROS to some
518 dnl particular target.
520 aros_config_cflags="-Wall -Werror-implicit-function-declaration"
521 aros_config_aflags="-Wall -x assembler-with-cpp -c"
522 aros_config_ldflags=""
524 aros_shared_default=yes
526 aros_shared_cflags="-fPIC"
527 aros_shared_aflags=""
528 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
529 aros_kernel_ldflags="-Wl,-rpath,./lib"
531 aros_kernel_ar_flags="cr"
532 aros_target_ar_flags="cr"
533 aros_target_nm_flags="-C -ul"
534 aros_target_strip_flags="--strip-unneeded -R.comment"
536 aros_compiler_libs=
537 aros_arch_libs=
539 aros_target_genmap="-Wl,-Map -Xlinker"
541 # Native flavour stuff
542 aros_serial_debug="0"
544 # Palm native flavour stuff
545 aros_palm_debug_hack="0"
547 # Unix flavour stuff
548 aros_nesting_supervisor="0"
550 # Collect-aros stuff: "-ius" to ignore undefined symbols
551 ignore_undefined_symbols=""
553 # Check for X11 by default
554 need_x11="auto"
556 #-----------------------------------------------------------------------------
559 # GCC 4.1+ has a stack protection feature that requires OS support. Ubuntu has
560 # it switched on by default, and we use the host compiler, so it compiles AROS
561 # code with this enabled resulting in link failures as we don't have support
562 # for it.
564 # We use two methods to disable it. For the host compiler (used to compile
565 # some hosted modules), we test to see if the compiler supports stack
566 # protection, and if it does we disable it in AROS_CONFIG_CFLAGS. This should
567 # work on all platforms.
569 # For the "cross" compiler we clear the "ssp_default" spec in config/specs.in
570 # (this is done unconditionally, as it should have no effect on compilers
571 # without the stack protection feature). This may be specific to the way that
572 # Ubuntu enables the feature, so may not work everywhere. My specs-fu isn't
573 # strong enough to disable it in a generic way though, so we'll live with it
574 # until another vendor ships GCC with it enabled in a different way, and deal
575 # with it then.
578 AC_MSG_CHECKING([whether ${CC} accepts -fno-stack-protector])
579 save_cflags="$CFLAGS"
580 CFLAGS="$CFLAGS -fno-stack-protector"
581 AC_TRY_COMPILE(,, use_no_stack_protector="yes", use_no_stack_protector="no")
582 AC_MSG_RESULT($use_no_stack_protector)
583 if test "x-$use_no_stack_protector" = "x-yes" ; then
584     aros_host_cflags="$aros_host_cflags -fno-stack-protector"
586 CFLAGS="$save_cflags"
588 #-----------------------------------------------------------------------------
590 # Disable pointer-signedness warnings if the compiler recognises the option
591 # (this only works for the host compiler at the moment)
593 AC_MSG_CHECKING([whether ${CC} accepts -Wno-pointer-sign])
594 save_cflags="$CFLAGS"
595 CFLAGS="$CFLAGS -Wno-pointer-sign"
596 AC_TRY_COMPILE(,, use_no_sign_warning="yes", use_no_sign_warning="no")
597 AC_MSG_RESULT($use_no_sign_warning)
598 if test "x-$use_no_sign_warning" = "x-yes" ; then
599     aros_host_cflags="$aros_host_cflags -Wno-pointer-sign"
601 CFLAGS="$save_cflags"
603 #-----------------------------------------------------------------------------
605 # Check if host compiler supports -fgnu89-inline, can be needed for crosstools.
607 AC_MSG_CHECKING([whether ${CC} accepts -fgnu89-inline])
608 save_cflags="$CFLAGS"
609 CFLAGS="$CFLAGS -fgnu89-inline"
610 AC_TRY_COMPILE(,, use_gnu89_inline="yes", use_gnu89_inline="no")
611 AC_MSG_RESULT($use_gnu89_inline)
612 if test "x-$use_gnu89_inline" = "x-yes" ; then
613     gnu89_inline="-fgnu89-inline"
615 CFLAGS="$save_cflags"
617 #-----------------------------------------------------------------------------
619 AC_MSG_CHECKING([for type of build])
620 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")
622 if test "$build_type" = "nightly"; then
623     build_type_string="NIGHTLY"
624 elif test "$build_type" = "snapshot"; then
625     build_type_string="SNAPSHOT"
626 elif test "$build_type" = "milestone"; then
627     build_type_string="MILESTONE"
628 elif test "$build_type" = "release"; then
629     build_type_string="RELEASE"
630 else
631     build_type_string="PERSONAL"
632     build_type="personal"
635 aros_config_cflags="$aros_config_cflags -DAROS_BUILD_TYPE=AROS_BUILD_TYPE_$build_type_string"
637 AC_MSG_RESULT($build_type)
639 #-----------------------------------------------------------------------------
640 all_debug_types="messages stack modules mungwall symbols"
642 AC_MSG_CHECKING([which debug types to enable])
643 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)]),
644  debug="$enableval",debug="")
646 if test "$debug" = "" -o "$debug" = "no"; then
647     debug="none"
648 elif test "$debug" = "yes"; then
649     debug="all"
652 if test "$debug" = "all" ; then
653     debug="messages stack modules symbols"
654     for d in $all_debug_types; do
655         export aros_${d}_debug="1"
656     done
657 else
658     for d in $all_debug_types; do
659         export aros_${d}_debug="0"
660     done
663 if test "$debug" != "none"; then
664     debug=`echo $debug | sed s/,/\ /g`
665     for d in $debug; do
666         found="0"
667         for d2 in $all_debug_types; do
668             if test "$d2" = "$d"; then
669                 found="1"
670                 break
671             fi
672         done
673         if test "$found" = "0"; then
674             AC_MSG_ERROR([unrecognized debug type "$d". Available types are: all none $all_debug_types])
675         fi
676         export aros_${d}_debug="1"
677     done
678     aros_debug="yes"
680 AC_MSG_RESULT($debug)
682 if test "$aros_messages_debug" = "1"; then
683     aros_messages_debug="-DADEBUG=1 -DMDEBUG=1"
684 else
685     aros_messages_debug=""
687 if test "$aros_symbols_debug" = "1"; then
688     aros_symbols_debug="-g"
689 else
690     aros_symbols_debug=""
693 # These are the flags to pass when compiling debugged programs
694 aros_debug_cflags="$aros_symbols_debug $aros_messages_debug"
695 aros_debug_aflags=""
696 aros_debug_ldflags="$aros_symbols_debug"
698 #-----------------------------------------------------------------------------
699 #   Checking for distcc and ccache.
701 #   Always apply the transforms in this particular order. Basically you should
702 #   always run 'ccache distcc compiler' in that order for the best performance.
704 AC_MSG_CHECKING([whether to enable distcc])
705 AC_ARG_ENABLE(distcc,AC_HELP_STRING([--enable-distcc],[Use distcc as a front end to the compiler (default=no).]),distcc="$enableval",distcc="no")
706 if test "$distcc" != "" -a "$distcc" != "no"; then
707     # AC_CHECK_PROG will print out the result in this case
708     AC_PATH_PROG(DISTCC,[distcc],distcc,)
709 else
710     AC_MSG_RESULT(no)
713 AC_MSG_CHECKING([whether to enable ccache])
714 AC_ARG_ENABLE(ccache,AC_HELP_STRING([--enable-ccache],[Use ccache as a front end to the compiler (default=no).]),ccache="$enableval",ccache="no")
715 if test "$ccache" != "" -a "$ccache" != "no"; then
716     # AC_CHECK_PROG will print out the result in this case
717     AC_CHECK_PROG(CCACHE,[ccache],ccache,)
718 else
719     AC_MSG_RESULT(no)
722 #-----------------------------------------------------------------------------
723 AC_MSG_CHECKING([what specific host gcc version to use])
724 AC_ARG_WITH(kernel-gcc-version,AC_HELP_STRING([--with-kernel-gcc-version=VERSION],[Use host gcc-VERSION for building AROS]),kernel_tool_version="-$withval",kernel_tool_version="")
725 AC_MSG_RESULT($kernel_tool_version)
727 #-----------------------------------------------------------------------------
728 AC_MSG_CHECKING([what specific target gcc version to use])
729 AC_ARG_WITH(gcc-version,AC_HELP_STRING([--with-gcc-version=VERSION],[Use host gcc-VERSION for building AROS]),target_tool_version="$withval",target_tool_version="default")
730 AC_MSG_RESULT($target_tool_version)
732 #-----------------------------------------------------------------------------
733 AC_MSG_CHECKING([what optimization flags to use])
734 AC_ARG_WITH(optimization,AC_HELP_STRING([--with-optimization=FLAGS],[Use optimization flags FLAGS (default=-O2).]),optimization="$withval",optimization="unknown")
735 if test "$optimization" = "unknown"; then
736     dnl default is -O2 for normal builds, -O0 for debug builds
737     if test "$debug" != "none"; then
738         optimization="-O0"
739     else
740         optimization="-O2"
741     fi
743 aros_config_cflags="$aros_config_cflags $optimization"
744 AC_MSG_RESULT($optimization)
746 #-----------------------------------------------------------------------------
747 AC_MSG_CHECKING([what paranoia flags to use])
748 AC_ARG_WITH(paranoia,AC_HELP_STRING([--with-paranoia=FLAGS],[CC flags to enable paranoia]),[paranoia_flags="$withval"],[paranoia_flags="default"])
749 if test "$paranoia_flags" = "default"; then
750         paranoia_flags=""
751 else if test "$paranoia_flags" = "yes"; then
752         paranoia_flags="-Wall -Werror"
753 fi fi
754 AC_MSG_RESULT($paranoia_flags)
755 aros_config_cflags="$aros_config_cflags $paranoia_flags"
757 #-----------------------------------------------------------------------------
758 AC_MSG_CHECKING([what target variant to enable])
759 AC_ARG_ENABLE(target_variant,AC_HELP_STRING([--enable-target-variant=NAME],[Enable a specific target variant(default=none)]),target_variant=$enableval,target_variant="")
760 if test "$target_variant" = ""; then
761     aros_target_variant=""
762     aros_target_suffix=""
763     enableval="none"
764 else
765     aros_target_variant="$target_variant"
766     aros_target_suffix="-$target_variant"
768 AC_MSG_RESULT($enableval)
770 #-----------------------------------------------------------------------------
771 # Target-specific defaults. You can override then on a per-target basis.
773 # Bootloader name. Currently used by PC target.
774 target_bootloader="none"
776 #-----------------------------------------------------------------------------
777 # Additional options for some specific targets
779 case "$aros_target_variant" in
780 ios)
781     AC_MSG_CHECKING([XCode path])
782     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")
783     AC_MSG_RESULT($aros_xcode_path)
785     AC_MSG_CHECKING([what iOS SDK version to use])
786     AC_ARG_WITH(sdk-version,AC_HELP_STRING([--with-sdk-version=VERSION],[Use iOS SDK version VERSION (default=4.1).]),aros_sdk_version="$withval",aros_sdk_version="4.1")
787     AC_MSG_RESULT($aros_sdk_version)
789     ;;
791 "android")
792     AC_MSG_CHECKING([Android SDK path])
793     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)
794     AC_MSG_RESULT($aros_android_sdk)
796     AC_MSG_CHECKING([Android NDK path])
797     AC_ARG_WITH(ndk,AC_HELP_STRING([--with-ndk=PATH],[Specify Android NDK path (default=none).]),aros_android_ndk="$withval",aros_android_ndk="none")
798     AC_MSG_RESULT($aros_android_ndk)
800     AC_MSG_CHECKING([what Android SDK version to use])
801     AC_ARG_WITH(sdk-version,AC_HELP_STRING([--with-sdk-version=LEVEL],[Use Android SDK for API LEVEL (default=12).]),aros_sdk_version="$withval",aros_sdk_version="12")
802     AC_MSG_RESULT($aros_sdk_version)
804     if test "$aros_android_ndk" != "none"; then
805         AC_MSG_CHECKING([what Android NDK version to use])
806         AC_ARG_WITH(ndk-version,AC_HELP_STRING([--with-ndk-version=LEVEL],[Use Android NDK for API LEVEL (default=9).]),aros_ndk_version="$withval",aros_ndk_version="9")
807         AC_MSG_RESULT($aros_ndk_version)
808     fi
810     export PATH="$aros_android_sdk/tools:$PATH"
811     AC_PATH_PROG(android_tool, $android_tool)
812     AROS_REQUIRED(android,$android_tool)
814     aros_android_level=android-$aros_sdk_version
815     if test ! -d $aros_android_sdk/platforms/$aros_android_level; then
816         echo "Platform $aros_android_level is not installed in your SDK"
817         echo "Use --with-sdk-version=<API level number> to select another platform version"
818         echo "You can check what plaform versions are installed in your SDK"
819         echo "by examining contents of $aros_android_sdk/platforms directory"
820         AC_MSG_ERROR([Android platform $aros_android_level is not installed])
821     fi
823     AC_PATH_PROG(ant, ant)
824     if test "$ant" = ""; then
825         AC_MSG_WARN([Apache Ant is missing, Java bootstrap can't be built automatically])
826     fi
828     dnl MSYS bash can't run .bat files directly, then need to be started via cmd.exe
829     if test "$host_os" = "mingw32"; then
830         android_tool="cmd //c $android_tool"
831     fi
833     ;;
834 esac
836 #-----------------------------------------------------------------------------
837 # External toolchains
838 kernel_tool_prefix="none"
839 aros_tool_prefix="none"
840 elf_tool_prefix="${target_cpu}-elf-"
842 # This is the target configuration switch.
843 case "$target_os" in
844     linux*)
845         aros_target_arch="linux"
846         aros_target_family="unix"
847         case "$target_cpu" in
848             *m68k*)
849                 aros_target_cpu="m68k"
850                 aros_object_format="m68kelf"
851                 aros_flavour="emulcompat"
852                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D__mc68000 -D__linux__"
853                 aros_shared_ldflags="-Wl,-T,\$(TOP)/config/linux/m68k/script.so"
854                 aros_kernel_ldflags="-Wl,-rpath,./lib,-T,\$(TOP)/config/linux/m68k/script.normal"
855                 gcc_target_cpu="mc68000"
856                 ;;
857             *i?86*)
858                 aros_target_cpu="i386"
859                 aros_object_format="elf_i386"
860                 aros_flavour="emulation"
861                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__linux__"
862                 aros_config_cflags="$aros_config_cflags -m32 -march=i486"
863                 aros_kernel_cflags="$aros_kernel_cflags -m32 -march=i486"
864                 aros_config_aflags="$aros_config_aflags -m32 -march=i486"
865                 aros_config_ldflags="-m32 -march=i486"
866                 aros_kernel_ldflags="-melf_i386"
867                 aros_default_wbdepth=8
868                 gcc_target_cpu="i386"
869                 pci_hidd_target="hidd-pci-linux"
870                 android_tool_dir_prefix="x86"
871                 android_tool_prefix="i686-android-linux"
872                 android_ndk_arch="x86"
873                 ;;
874             *x86_64*)
875                 aros_target_cpu="x86_64"
876                 aros_object_format="elf_x86_64"
877                 aros_flavour="emulation"
878                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64 -D__linux__"
879                 aros_config_cflags="$aros_config_cflags -mno-red-zone -fno-omit-frame-pointer"
880                 aros_default_wbdepth=8
881                 pci_hidd_target="hidd-pci-linux"
882                 ;;
883             *powerpc*)
884                 aros_target_cpu="ppc"
885                 aros_object_format="elf32ppc"
886                 aros_flavour="emulation"
887                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc -D__linux__"
888                 aros_default_wbdepth=8
889                 gcc_target_cpu="ppc"
890                 ;;
891 # TODO
892 # Same as powerpc, but I need this for the nightly build to work again.
893 # Actually, the nightly should be made working with powerpc target.
894 # That just was too much work for the moment, another week or two.
895             *ppc*)
896                 aros_target_cpu="ppc"
897                 aros_object_format="elf32ppc"
898                 aros_flavour="emulation"
899                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc -D__linux__"
900                 aros_default_wbdepth=8
901                 gcc_target_cpu="ppc"
902                 ;;
903             *armhf*)
904                 aros_target_cpu="arm"
905                 target_cpu="arm"
906                 aros_object_format="armelf_linux_eabi"
907                 aros_flavour="emulation"
908                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm -D__linux__"
909                 gcc_target_cpu="arm"
910                 aros_config_cflags="$aros_config_cflags -fno-strict-aliasing -fno-omit-frame-pointer"
911                 aros_config_aflags="$aros_config_aflags -fno-strict-aliasing"
912                 aros_arch_libs="-laeabi"
913                 gcc_default_fpu="vfpv3-d16"
914                 gcc_default_float_abi="hard"
915                 android_tool_dir_prefix="arm-linux-androideabi"
916                 android_tool_prefix="arm-linux-androideabi"
917                 android_ndk_arch="arm"
918                 kernel_tool_prefix="arm-linux-gnueabihf-"
919                 ;;
920             *arm*)
921                 aros_target_cpu="arm"
922                 aros_object_format="armelf_linux_eabi"
923                 aros_flavour="emulation"
924                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm -D__linux__"
925                 gcc_target_cpu="arm"
926                 aros_config_cflags="$aros_config_cflags -fno-strict-aliasing -fno-omit-frame-pointer"
927                 aros_config_aflags="$aros_config_aflags -fno-strict-aliasing"
928                 aros_arch_libs="-laeabi"
929                 android_tool_dir_prefix="arm-linux-androideabi"
930                 android_tool_prefix="arm-linux-androideabi"
931                 android_ndk_arch="arm"
932                 kernel_tool_prefix="arm-linux-gnueabi-"
933                 ;;
934             *)
935                 AC_MSG_ERROR("Unknown CPU for Linux -- $target_cpu")
936                 ;;
937         esac
938         case "$aros_target_variant" in
939             android)
941                 dnl Not all Linux CPUs are supported by Android
942                 if test "$android_ndk_arch" = ""; then
943                     AC_MSG_ERROR("Unsupported CPU for Android -- $target_cpu")
944                 fi
946                 aros_default_wbwidth=320
947                 aros_default_wbheight=480
948                 if test "$aros_android_ndk" = "none"; then
949                     dnl Use standalone toolchain, don't adjust paths
950                     aros_kernel_cflags="-mandroid"
951                     aros_kernel_ldflags="-mandroid"
952                     CFLAGS="-mandroid"
953                 else
954                     export PATH="$aros_android_ndk/toolchains/$android_tool_dir_prefix-$target_tool_version/prebuilt/$android_build_os/bin:$PATH"
955                     aros_android_ndk="$aros_android_ndk/platforms/android-$aros_ndk_version/arch-$android_ndk_arch"
956                     aros_kernel_cflags="--sysroot $aros_android_ndk -mandroid"
957                     aros_kernel_ldflags="--sysroot $aros_android_ndk -mandroid"
958                     CFLAGS="$CFLAGS --sysroot $aros_android_ndk -mandroid"
959                     aros_kernel_includes="-isystem $aros_android_ndk/usr/include"
960                 fi
961                 need_x11=no
962                 dnl (Ab)use $(X11_HIDD_TARGET) as "Default display driver target"
963                 dnl in order not to fill mmakefiles with garbage
964                 x11_hidd_target=kernel-hidd-androidgfx-kobj
965                 # Disable implicit PIC mode
966                 aros_target_cflags="$aros_target_cflags -fno-pic"
967                 kernel_tool_prefix="$android_tool_prefix-"
968             ;;
969         esac
970     ;;
972     pc)
973         aros_target_arch="pc"
974         aros_shared_default="no"
975         target_bootloader="grub2"
976         case "$target_cpu" in
977             *i?86*)
978                 aros_target_cpu="i386"
980                 dnl If somebody hasn't already set the target object
981                 dnl format, then use this value. Mostly to support
982                 dnl FreeBSD cross-compilation.
983                 dnl TODO: Remove when we always use our compiler.
985                 if test "$aros_object_format" = "" ; then
986                     aros_object_format="elf_i386"
987                 fi
988                 aros_flavour="standalone"
989                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
990                 aros_config_cflags="$aros_config_cflags -m32 -march=i486"
991                 aros_kernel_cflags="$aros_kernel_cflags -m32 -march=i486"
992                 aros_config_aflags="$aros_config_aflags -m32 -march=i486"
993                 aros_config_ldflags="-m32 -march=i486"
994                 aros_kernel_ldflags="-melf_i386"
995                 aros_default_wbwidth=640
996                 aros_default_wbheight=480
997                 gcc_target_cpu="i386"
998                 ;;
999             *x86_64*)
1000                 aros_target_cpu="x86_64"
1001                 aros_serial_debug=1
1002                 if test "$aros_object_format" = "" ; then
1003                     aros_object_format="elf_x86_64"
1004                 fi
1005                 aros_flavour="standalone"
1006                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
1007                 aros_config_cflags="$aros_config_cflags -fno-asynchronous-unwind-tables -mno-red-zone -fno-omit-frame-pointer"
1008                 aros_kernel_ldflags=""
1009                 aros_default_wbwidth=640
1010                 aros_default_wbheight=480
1011                 ;;
1012             *)
1013                 AC_MSG_ERROR("Unknown native CPU -- $target_cpu")
1014                 ;;
1015         esac
1016         ;;
1018     prep)
1019         aros_target_arch="prep"
1020         aros_shared_default="no"
1021         aros_target_cpu="ppc"
1022         aros_object_format="elf32ppc"
1023         aros_flavour="ppcnative"
1024         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1025         aros_kernel_ldflags=""
1026         aros_default_wbwidth=640
1027         aros_default_wbheight=480
1028         gcc_target_cpu="ppc"
1029         ;;
1031     freebsd*)
1032         aros_target_arch="freebsd"
1033         aros_target_family="unix"
1034         aros_target_cpu="i386"
1035         aros_flavour="emulation"
1036         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1037         gcc_target_cpu="i386"
1039         aros_target_strip_flags="-x"
1040         ;;
1042     darwin*)
1043         aros_target_arch="darwin"
1044         aros_target_family="unix"
1045         aros_flavour="emulation"
1046         case "$target_cpu" in
1047             *i?86*)
1048                 aros_ios_platform="iPhoneSimulator"
1049                 aros_target_cpu="i386"
1050                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1051                 aros_kernel_ldflags=""
1052                 aros_macosx_version="10.4"
1053                 aros_default_wbdepth=8
1054                 gcc_target_cpu="i386"
1055                 aros_object_format="elf_i386"
1056                 aros_kernel_ar_flags="-cr"
1057                 aros_target_strip_flags="-x"
1058                 kernel_tool_flags="-m32"
1059                 ;;
1060             *x86_64*)
1061                 aros_target_cpu="x86_64"
1062                 aros_object_format="elf_x86_64"
1063                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
1064                 aros_macosx_version="10.6"
1065                 aros_config_cflags="$aros_config_cflags -fno-omit-frame-pointer"
1066                 aros_kernel_cflags="-m64"
1067                 aros_kernel_ldflags="-m64"
1068                 aros_target_cflags="-mcmodel=large"
1069                 aros_default_wbdepth=8
1070                 aros_kernel_ar="ar"
1071                 aros_kernel_ar_flags="-cr"
1072                 aros_kernel_ld="ld"
1073                 aros_kernel_as="as"
1074                 aros_kernel_ranlib="ranlib"
1075                 aros_kernel_nm="nm"
1076                 aros_kernel_strip="strip"
1077                 kernel_tool_prefix="i686-apple-darwin10-"
1078                 ;;
1079             *ppc*)
1080                 aros_target_cpu="ppc"
1081                 aros_object_format="elf32ppc"
1082                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1083                 aros_kernel_ldflags=""
1084                 aros_macosx_version="10.0"
1085                 aros_default_wbdepth=8
1086                 gcc_target_cpu="ppc"
1087                 aros_kernel_ar="ar"
1088                 aros_kernel_ar_flags="-cr"
1089                 aros_kernel_ld="ld -arch ppc"
1090                 aros_kernel_as="as -arch ppc"
1091                 aros_kernel_ranlib="ranlib -arch ppc"
1092                 aros_kernel_nm="nm -arch ppc"
1093                 aros_kernel_strip="strip -arch ppc"
1094                 kernel_tool_prefix="powerpc-apple-darwin10-"
1095                 ;;
1096             *arm*)
1097                 aros_ios_platform="iPhoneOS"
1098                 aros_target_cpu="arm"
1099                 aros_object_format="armelf_linux_eabi"
1100                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
1101                 aros_arch_libs="-laeabi"
1102                 aros_default_wbdepth=8
1103                 gcc_target_cpu="arm"
1104                 aros_kernel_ar="ar"
1105                 aros_kernel_ar_flags="-cr"
1106                 aros_kernel_ld="ld -arch arm"
1107                 aros_kernel_ranlib="ranlib -arch arm"
1108                 kernel_tool_prefix="arm-apple-darwin10-" 
1109                 export PATH="$aros_xcode_path/Platforms/$aros_ios_platform.platform/Developer/usr/bin:$PATH"
1110                 ;;
1111             *)
1112                 AC_MSG_ERROR("Unsupported target CPU for darwin hosted flavour -- $target_cpu")
1113                 ;;
1114         esac
1115         case "$aros_target_variant" in
1116             ios)
1117                 aros_ios_version="3.0"
1118                 aros_default_wbwidth=320
1119                 aros_default_wbheight=480
1120                 aros_ios_sdk="$aros_xcode_path/Platforms/$aros_ios_platform.platform/Developer/SDKs/$aros_ios_platform$aros_sdk_version.sdk"
1121                 kernel_tool_flags="$target_tool_flags -isysroot $aros_ios_sdk"
1122                 aros_kernel_includes="-isystem $aros_ios_sdk/usr/include"
1123                 need_x11=no
1124                 # This is here because it may depend on iOS or SDK version
1125                 aros_kernel_cflags="$aros_kernel_cflags -miphoneos-version-min=$aros_ios_version"
1126                 aros_kernel_ldflags="$aros_kernel_ldflags -miphoneos-version-min=$aros_ios_version"
1127                 aros_kernel_objcflags="-fobjc-abi-version=2 -fobjc-legacy-dispatch"
1128             ;;
1129             *)
1130                 aros_kernel_cflags="$aros_kernel_cflags -mmacosx-version-min=$aros_macosx_version"
1131                 aros_kernel_ldflags="$aros_kernel_ldflags -mmacosx-version-min=$aros_macosx_version"
1132             ;;
1133         esac
1134         ;;
1136     dragonfly*)
1137         aros_target_arch="dragonfly"
1138         aros_target_family="unix"
1139         aros_flavour="emulation"
1140         case "$target_cpu" in
1141             *i?86*)
1142                 aros_target_cpu="i386"
1143                 aros_object_format="elf_i386"
1144                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__DragonFly__"
1145                 ;;
1146             *x86_64*)
1147                 aros_config_cflags="$aros_config_cflags -fno-omit-frame-pointer"
1148                 aros_target_cpu="x86_64"
1149                 aros_object_format="elf_x86_64"
1150                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64 -D__DragonFly__"
1151                 ;;
1152             *)
1153                 AC_MSG_ERROR("Unknown CPU for DragonFly -- $target_cpu")
1154                 ;;
1155         esac
1156         ;;
1158     netbsd*)
1159         aros_target_arch="netbsd"
1160         aros_target_family="unix"
1161         case "$target_cpu" in
1162             *m68k*)
1163                 aros_target_cpu="m68k"
1164                 aros_object_format="m68kelf"
1165                 aros_flavour="emulcompat"
1166                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D__mc68000 -D__NetBSD__"
1167                 gcc_target_cpu="mc68000"
1168                 ;;
1169             *i?86*)
1170                 aros_target_cpu="i386"
1171                 aros_object_format="elf_i386"
1172                 aros_flavour="emulation"
1173                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__NetBSD__"
1174                 aros_default_wbdepth=8
1175                 gcc_target_cpu="i386"
1176                 ;;
1177             *)
1178                 AC_MSG_ERROR("Unknown CPU for NetBSD -- $target_cpu")
1179                 ;;
1180         esac
1181         aros_target_genmap="-Wl,-M -Xlinker >"
1182         aros_flavour="emulation"
1183         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1184         ;;   
1186     openbsd*)
1187         aros_target_arch="openbsd"
1188         aros_target_family="unix"
1189         case "$target_cpu" in
1190             *i?86*)
1191                 aros_target_cpu="i386"
1192                 aros_object_format="elf_i386"
1193                 aros_flavour="emulation"
1194                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__OpenBSD__"
1195                 gcc_target_cpu="i386"
1196                 ;;
1197             *)
1198                 AC_MSG_ERROR("Unknown CPU for OpenBSD -- $target_cpu")
1199                 ;;
1200         esac
1201         aros_target_genmap="-Wl,-M -Xlinker >"
1202         aros_target_nm_flags="-u"
1203         aros_flavour="emulation"
1204         ;;
1206     solaris*)
1207         aros_target_arch="solaris"
1208         aros_target_family="unix"
1209         case "$target_cpu" in
1210            *i?86*)
1211                aros_target_cpu="i386"
1212                aros_object_format="elf_i386"
1213                aros_flavour="emulation"
1214                aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__Solaris__"
1215                aros_default_wbdepth=8
1216                gcc_target_cpu="i386"
1217                ;;
1218             *sparc*)
1219                 aros_target_cpu="sparc"
1220                 aros_object_format="elf_sparc"
1221                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dsparc -D__Solaris__"
1222                 gcc_target_cpu="sparc"
1223                 ;;
1224             *)
1225                 AC_MSG_ERROR("Unknown CPU for Solaris -- $target_cpu")
1226                 ;;
1227         esac
1228         aros_config_cflags="$aros_config_cflags -D$aros_target_cpu"
1229         aros_flavour="emulation"
1230         ;;
1232     morphos*)
1233         aros_target_arch="morphos"
1234         aros_shared_default="no"
1235         aros_target_cpu="ppc"
1236         aros_object_format="elf_ppc"
1237         aros_flavour="nativecompat"
1238         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1239         gcc_target_cpu="ppc"
1240         ;;
1242     sam440)
1243         aros_target_arch="sam440"
1244         aros_shared_default="no"
1245         aros_target_cpu="ppc"
1246         aros_object_format="elf32ppc"
1247         aros_flavour="ppcnative"
1248         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1249         aros_kernel_ldflags=""
1250         aros_default_wbwidth=1024
1251         aros_default_wbheight=768
1252         aros_default_wbdepth=24
1253         aros_config_cflags="$aros_config_cflags -mcpu=440fp -mno-toc -fno-asynchronous-unwind-tables"
1254         gcc_target_cpu="powerpc"
1255         ;;
1257     efika)
1258         aros_target_arch="efika"
1259         aros_shared_default="no"
1260         aros_target_cpu="arm"
1261         aros_object_format="armelf_linux_eabi"
1262         aros_flavour="standalone"
1263         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
1264         aros_kernel_ldflags=""
1265         aros_default_wbwidth=1024
1266         aros_default_wbheight=600
1267         aros_arch_libs="-laeabi"
1268         gcc_default_cpu="armv7-a"
1269         gcc_default_fpu="vfpv3"
1270         gcc_default_float_abi="softfp"
1271         aros_config_cflags="$aros_config_cflags -mtune=cortex-a8 -fno-strict-aliasing"
1272         aros_config_aflags="$aros_config_aflags -mtune=cortex-a8 -fno-strict-aliasing"
1273         ;;
1274         
1275     chrp)
1276     aros_target_arch="chrp"
1277     aros_shared_default="no"
1278     aros_target_cpu="ppc"
1279     aros_object_format="elf32ppc"
1280     aros_flavour="ppcnative"
1281     aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1282     aros_kernel_ldflags=""
1283     aros_default_wbwidth=640
1284     aros_default_wbheight=480
1285     aros_config_cflags="$aros_config_cflags -mno-toc -fno-asynchronous-unwind-tables"    
1286     gcc_target_cpu="powerpc"
1287         case "$aros_target_variant" in
1288             efika)
1289             aros_config_cflags="$aros_config_cflags -DBIG_ENDIAN_OHCI=1 -mcpu=603e"
1290             ;;
1291         esac
1292     ;;
1294     r*pi)
1295         aros_flavour="standalone"
1296         aros_target_arch="raspi"
1297         aros_target_cpu="arm"
1298         aros_object_format="armelf_linux_eabi"
1299         aros_shared_default="no"
1300         aros_arch_libs="-laeabi"
1302         gcc_default_cpu="armv6"
1303         gcc_default_cpu_tune="arm1176jzf-s"
1304         case "$target_cpu" in
1305             *armhf*)
1306                 gcc_default_fpu="vfp"
1307                 gcc_default_float_abi="hard"
1308                 ;;
1309             *arm*)
1310                 gcc_default_fpu="vfp"
1311                 gcc_default_float_abi="softfp"
1312                 ;;
1313             *)
1314                 AC_MSG_ERROR("Unknown CPU for RasPi $target_cpu")
1315                 ;;
1316         esac
1318         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
1319         aros_config_cflags="$aros_config_cflags -marm -Wno-error -fno-asynchronous-unwind-tables -fno-exceptions"
1320         aros_config_aflags="$aros_config_aflags -marm -Wno-error -fno-asynchronous-unwind-tables -fno-exceptions"
1321         aros_kernel_cflags="$aros_kernel_cflags -marm -Wno-error -fno-asynchronous-unwind-tables -fno-exceptions"
1322         aros_target_cflags="$aros_kernel_cflags -marm -Wno-error -fno-asynchronous-unwind-tables -fno-exceptions"
1323         ;;
1325     amiga*)
1326         aros_target_arch="amiga"
1327         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D_AMIGA -DAMIGA"
1328         aros_shared_default="no"
1330         case "$target_cpu" in
1331             *m68k*)
1332                 AC_ARG_ENABLE(amigaos_compliance,AC_HELP_STRING([--enable-amigaos-compliance=VERSION],[Enforce userspace AmigaOS compliance to a specific KickStart version (default=none).]),aros_amigaos_compliance="$enableval")
1333                 aros_enable_mmu=no
1334                 aros_target_cpu="m68k"
1335                 aros_object_format="m68kelf"
1336                 aros_flavour="standcompat"
1337                 gcc_target_cpu="m68000"
1338                 aros_config_cflags="$aros_config_cflags -fno-strict-aliasing -ffreestanding -fomit-frame-pointer -fbuiltin -Wno-volatile-register-var -Os -DNOLIBINLINE"
1339                 aros_config_aflags="$aros_config_aflags"
1340                 aros_target_strip_flags="-R.comment --strip-debug"
1341                 aros_default_wbwidth=640
1342                 aros_default_wbheight=256
1343                 aros_default_wbdepth=2
1344                 ;;
1345             *ppc*)
1346                 aros_cpu="ppc"
1347                 aros_flavour="native"
1348                 gcc_target_cpu="ppc"
1349                 ;;
1350             *)
1351                 AC_MSG_ERROR("Unknown CPU for Amiga $target_cpu")
1352                 ;;
1353         esac
1354         ;;
1356     mingw*)
1357         aros_target_arch="mingw32"
1358         aros_shared_default="no"
1359         aros_flavour="emulation"
1360         aros_shared_cflags=""
1361         need_crosstools="yes"
1362         need_dlopen="no"
1363         rescomp="windres"
1364         case "$target_cpu" in
1365             *i?86*)
1366                 aros_target_cpu="i386"
1367                 aros_object_format="elf_i386"
1368                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1369                 aros_default_wbdepth=8
1370                 gcc_target_cpu="i386"
1372                 kernel_tool_prefix="i386-mingw32-"
1373                 ;;
1374             *x86_64*)
1375                 aros_target_cpu="x86_64"
1376                 aros_object_format="elf_x86_64"
1377                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
1378                 aros_config_cflags="$aros_config_cflags -fno-omit-frame-pointer"
1379                 aros_default_wbdepth=8
1380                 kernel_tool_prefix="x86_64-w64-mingw32-"
1381                 ;;
1382             *arm*)
1383                 aros_target_cpu="arm"
1384                 aros_object_format="armelf_linux_eabi"
1385                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
1386                 aros_arch_libs="-laeabi"
1387                 aros_default_wbdepth=8
1388                 gcc_target_cpu="arm"
1389                 gcc_default_float_abi="soft"
1390                 kernel_tool_prefix="arm-mingw32ce-"
1391                 aros_default_wbwidth=160
1392                 aros_default_wbheight=160
1393                 ;;
1394             *)
1395                 AC_MSG_ERROR("Unknown CPU for Mingw32 -- $target_cpu")
1396                 ;;
1397         esac
1398         if test $host_os = "cygwin"; then
1399                 aros_kernel_cflags="-mno-cygwin"
1400         fi
1401     ;;
1402     pp*)
1403         aros_target_arch="pp"
1404         aros_shared_default="no"
1405         case "$target_cpu" in
1406             *m68k*)
1407                 aros_target_cpu="m68k"
1408                 aros_object_format="m68kelf"
1409                 aros_flavour="palmnative"
1410                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
1411                 aros_default_wbwidth=160
1412                 aros_default_wbheight=160
1413                 aros_default_wbdepth=1
1414                 aros_target_ar_flags="cru"
1415                 aros_compiler_libs="-lgcc1"
1416                 aros_shared_default=no
1417                 aros_shared_cflags="-fpic"
1418                 aros_shared_aflags=""
1419                 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
1420                 aros_kernel_ldflags="-Wl,-rpath,./lib"
1421                 aros_debug_cflags="$aros_symbols_debug  $aros_messages_debug"
1422                 aros_debug_aflags=""
1423                 aros_debug_ldflags="$aros_symbols_debug"
1424                 aros_mungwall_debug="0"
1425                 aros_modules_debug="0"
1426                 gcc_target_cpu="mc68000"
1427                 ignore_undefined_symbols="-ius"
1428                 ;;
1429            *)
1430                 AC_MSG_ERROR("Unknown CPU for PalmPilot -- $target_cpu")
1431                 ;;
1432         esac
1433         ;;
1435     mac*)
1436         aros_target_arch="mac"
1437         aros_shared_default="no"
1438         case "$target_cpu" in
1439             *m68k*)
1440                 aros_target_cpu="m68k"
1441                 aros_object_format="m68kelf"
1442                 aros_flavour="mac68knative"
1443                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
1444                 aros_default_wbwidth=512
1445                 aros_default_wbheight=384
1446                 aros_default_wbdepth=8
1447                 aros_target_ar_flags="cru"
1448                 aros_compiler_libs="-lgcc1"
1449                 aros_shared_default=no
1450                 aros_shared_cflags="-fpic"
1451                 aros_shared_aflags=""
1452                 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
1453                 aros_kernel_ldflags="-Wl,-rpath,./lib"
1454                 aros_debug_cflags="$aros_symbols_debug $aros_messages_debug"
1455                 aros_debug_aflags=""
1456                 aros_debug_ldflags="$aros_symbols_debug"
1457                 aros_mungwall_debug="0"
1458                 aros_modules_debug="0"
1459                 gcc_target_cpu="mc68000"
1460                 ignore_undefined_symbols="-ius"
1461                 ;;
1462            *)
1463                 AC_MSG_ERROR("Unknown CPU for Mac68k -- $target_cpu")
1464                 ;;
1465         esac
1466         ;;
1468     *)
1469         AC_MSG_ERROR([Unsupported target architecture $target])
1470         ;;
1471 esac
1473 #-----------------------------------------------------------------------------
1474 crosstools_guess=yes
1476 AC_MSG_CHECKING([Kernel toolchain prefix])
1477 AC_ARG_WITH(kernel-toolchain-prefix,AC_HELP_STRING([--with-kernel-toolchain-prefix=...],[Specify crosscompile toolchain prefix for kernel objects]),[kernel_tool_prefix="$withval"])
1478 AC_MSG_RESULT($kernel_tool_prefix)
1480 AC_MSG_CHECKING([ELF toolchain prefix])
1481 AC_ARG_WITH(elf-toolchain-prefix,AC_HELP_STRING([--with-elf-toolchain-prefix=...],[Specify crosscompile toolchain prefix to wrap for AROS objects]),[elf_tool_prefix="$withval"
1482                                                  crosstools_guess=no])
1483 AC_MSG_RESULT($elf_tool_prefix)
1485 AC_MSG_CHECKING([AROS toolchain prefix])
1486 AC_ARG_WITH(aros-toolchain,AC_HELP_STRING([--with-aros-toolchain=PREFIX],[Specify prebuilt AROS toolchain]),[aros_tool_prefix="$withval"
1487                 crosstools_guess=no])
1488 if test "$aros_tool_prefix" = "yes" ; then
1489     aros_tool_prefix=$aros_target_cpu-aros-
1491 AC_MSG_RESULT($aros_tool_prefix)
1493 #-----------------------------------------------------------------------------
1494 #   Checking if we should build crosstools..
1495 AC_MSG_CHECKING([whether to build crosstools])
1496 AC_ARG_ENABLE(crosstools,AC_HELP_STRING([--disable-crosstools],[Do not build cross-compiler toolchain]),crosstools="$enableval",crosstools="$crosstools_guess")
1497 AC_MSG_RESULT($crosstools)
1499 if test "${crosstools}" = "yes"; then
1500     if test "${crosstools_guess}" = "no"; then
1501         AC_MSG_ERROR([Cannot build external toolchain if an external ELF or AROS toolchain is specified])
1502     fi
1505 AC_MSG_CHECKING([where to install the crosstools binaries])
1506 AC_ARG_WITH(aros-toolchain-install,AC_HELP_STRING([--with-aros-toolchain-install=DIR],[Where to install or search for cross tools binaries]),[aros_toolchain_install=$withval])
1507 if test "x$aros_toolchain_install" = "x"; then
1508     AROS_CROSSTOOLSDIR="$AROS_BUILDDIR_UNIX/bin/$aros_host_arch-$aros_host_cpu/tools/crosstools"
1509 else
1510     AROS_CROSSTOOLSDIR="$aros_toolchain_install"
1511     PATH="$AROS_CROSSTOOLSDIR:$PATH"
1513 AC_MSG_RESULT($AROS_CROSSTOOLSDIR)
1516 # Now process extra architecture-specific options.
1517 # Currently this is implemented only for ARM. We can specify which minimum CPU and FPU to use,\
1518 # as well as floating-point ABI.
1519 case "$aros_target_cpu" in
1520 arm)
1521     dnl ARM defaults are: armv6 + vfp (unless overriden in per-target section above)
1522     if test "$gcc_default_cpu" = ""; then
1523         gcc_default_cpu="armv6"
1524     fi
1525     if test "$gcc_default_fpu" = ""; then
1526         gcc_default_fpu="vfp"
1527     fi
1528     if test "$gcc_default_float_abi" = ""; then
1529         gcc_default_float_abi="softfp"
1530     fi
1532     AC_MSG_CHECKING([Which minimum CPU to use])
1533     AC_ARG_WITH(cpu,AC_HELP_STRING([--with-cpu=<spec>],[Specify minumum CPU (default=$gcc_default_cpu).]),aros_gcc_cpu="$withval",aros_gcc_cpu=$gcc_default_cpu)
1534     AC_MSG_RESULT($aros_gcc_cpu)
1536     AC_MSG_CHECKING([Which minimum FPU to use])
1537     AC_ARG_WITH(fpu,AC_HELP_STRING([--with-fpu=<spec>],[Specify minumum FPU (default=$gcc_default_fpu).]),aros_gcc_fpu="$withval",aros_gcc_fpu=$gcc_default_fpu)
1538     AC_MSG_RESULT($aros_gcc_fpu)
1540     AC_MSG_CHECKING([Which floating point ABI to use])
1541     AC_ARG_WITH(float,AC_HELP_STRING([--with-float=<spec>],[Specify floating point ABI (default=$gcc_default_float_abi).]),aros_gcc_float_abi="$withval",aros_gcc_float_abi=$gcc_default_float_abi)
1542     AC_MSG_RESULT($aros_gcc_float_abi)
1544     aros_config_cflags="$aros_config_cflags -marm -mthumb-interwork -march=$aros_gcc_cpu -mfpu=$aros_gcc_fpu -mfloat-abi=$aros_gcc_float_abi -fno-asynchronous-unwind-tables -fno-exceptions"
1545     aros_config_aflags="$aros_config_aflags -marm -mthumb-interwork -march=$aros_gcc_cpu -mfpu=$aros_gcc_fpu -mfloat-abi=$aros_gcc_float_abi -fno-asynchronous-unwind-tables -fno-exceptions"
1546     ;;
1547 esac
1549 # Some formats need custom ELF specs.
1550 # For example for x86_64 it is needed in order for -m32 switch to work correctly.
1551 if test -f $SRCDIR/config/${aros_object_format}-specs.in; then
1552     elf_specs_in=config/${aros_object_format}-specs.in
1553 else
1554     elf_specs_in=config/elf-specs.in
1557 AC_MSG_CHECKING([what specific AROS gcc version to use])
1558 AC_ARG_WITH(aros-gcc,AC_HELP_STRING([--with-aros-gcc=VERSION],[Use aros-gcc-VERSION for building AROS]),aros_gcc_version="-$withval",aros_gcc_version="")
1559 AC_MSG_RESULT($aros_gcc_version)
1561 # Some compilers (ppc-elf-gcc is known to) have CPU defines in specs
1562 # Since we override specs, we may need to put these defines there
1563 if test "$gcc_target_cpu" != ""; then
1564     gcc_target_cpu="-D__${gcc_target_cpu}__"
1567 AC_MSG_CHECKING([where to download sourcecode for external ports])
1568 AC_ARG_WITH(portssources,AC_HELP_STRING([--with-portssources=DIR],[Where to download sourcecode for external ports]),with_portssrcdir=$withval,with_portssrcdir="default")
1569 if test "$with_portssrcdir" = "default"; then
1570     AROS_PORTSSRCDIR="$AROS_BUILDDIR_UNIX/bin/Sources"
1571 else
1572     AROS_PORTSSRCDIR="$with_portssrcdir"
1574 AC_MSG_RESULT($AROS_PORTSSRCDIR)
1576 AC_MSG_CHECKING([which bootloader to use])
1577 AC_ARG_WITH(bootloader,AC_HELP_STRING([--with-bootloader=NAME],[Use a specific bootloader]),target_bootloader=$withval,target_bootloader=$target_bootloader)
1578 if test "$target_bootloader" = "none"; then
1579     aros_target_bootloader=""
1580 else
1581     aros_target_bootloader="$target_bootloader"
1583 AC_MSG_RESULT($target_bootloader)
1585 AC_MSG_CHECKING([which icon-set to use])
1586 AC_ARG_WITH(iconset,AC_HELP_STRING([--with-iconset=NAME],[Use a specific Icon-set (default=Gorilla).]),target_iconset=$withval,target_iconset="default")
1587 if test "$target_iconset" = "default"; then
1588     aros_target_iconset="Gorilla"
1589     target_iconset="default (Gorilla)"
1590 else
1591     aros_target_iconset="$target_iconset"
1593 AC_MSG_RESULT($target_iconset)
1595 AC_MSG_CHECKING([which GUI Theme to use])
1596 AC_ARG_WITH(theme,AC_HELP_STRING([--with-theme=NAME],[Use a specific GUI Theme]),target_guitheme=$withval,target_guitheme="default")
1597 if test "$target_guitheme" = "default"; then
1598     aros_target_guitheme="Ice"
1599 else
1600     aros_target_guitheme="$target_guitheme"
1602 AC_MSG_RESULT($aros_target_guitheme)
1604 # Find out if we are cross-compiling (i.e. if we can't use the host compiler
1605 # for target code)
1606 cross_compiling=no
1608 dnl The first case is simple. If we are compiling for another CPU, we are cross-compiling for sure
1609 if test "$aros_host_cpu" != "$aros_target_cpu" ; then
1610     cross_compiling=yes
1613 dnl x86-64 toolchains can also produce i386 binaries, given -m32 flag.
1614 dnl The flag itself is given in per-target section, because some targets require to pass it
1615 dnl in a different manner, otherwise some tests fail.
1616 dnl TODO: Justify this.
1617 if test "$aros_host_cpu" == "x86_64" ; then
1618     if test "$aros_target_cpu" == "i386" ; then
1619         cross_compiling=no
1620     fi
1623 if test "x-$aros_flavour" = "x-emulation" -o "x-$aros_flavour" = "x-emulcompat" ; then
1624     dnl For a hosted build we are cross-compiling if host OS differs from build OS.
1625     dnl TODO: This might get a little bit more tricky if we ever cross-compile ARM-Android-hosted
1626     dnl AROS on ARM Linux, or even vice versa (Linux-hosted ARM AROS building on ARM Android).
1627     dnl ARM ABIs of Linux and Android are not compatible (despite very close), so host_cc can't be
1628     dnl used to build bootstrap for target arch in either case.
1629     dnl For us Android is not a separate OS, but a variant of Linux, so both systems will be
1630     dnl identified as 'linux'. If this ever involves, we'll have to implement some additional check,
1631     dnl perhaps introducing aros_host_variant
1632     if test "$aros_host_arch" != "$aros_target_arch" ; then
1633         cross_compiling=yes
1634     fi
1635 else
1636     dnl For a native build we only care if our host_cc can produce static ELF files. If so, we can use
1637     dnl it as kernel_cc. If not, (e. g. we are on Windows or Darwin), we need a crosscompiler.
1638     if test "$host_cc_elf" = "no" ; then
1639         cross_compiling=yes
1640     fi
1643 if test "$cross_compiling" = "no" ; then
1644     kernel_tool_prefix=""
1645     if test "$host_cc_elf" = "yes" ; then
1646         elf_tool_prefix=""
1647     fi
1650 #######################################################################
1651 ## Compute what toolchains to use, and their paths                   ##
1652 #######################################################################
1654 # This takes, as input:
1655 #   crosstools             {yes,no}
1656 #   kernel_tool_version    {"",[version]}
1657 #   aros_gcc_version       {"",[version]}
1658 #   kernel_tool_prefix     {none,[some-arch-os-]}
1659 #   target_tool_prefix     ${aros_target_cpu}-aros-
1660 #   aros_tool_prefix       ${aros_target_cpu}-aros-
1662 # The output is
1663 #   aros_kernel_{cpp,cc,ar,ld,as,ranlib,nm,strip}
1664 #        Where the 'kernel' binaries are located
1665 #   orig_target_{cpp,cc,ar,ld,as,ranlib,nm,strip}
1666 #        Where the 'target' binaries are located
1667 #        (not the symlink farm - that is aros_target_*!)
1669 # The rules are:
1670 #   if crosstools then
1671 #      if kernel_tools_prefix = "no-kernel-prefix-"
1672 #          aros_kernel_* = crosstools cc paths
1673 #          aros_kernel_cc = elf cc wrapper around crosstools cc
1674 #      else
1675 #          VALIDATE(${kernel_tools_prefix}*)
1676 #          aros_kernel_* = ${kernel_tools_prefix}*
1677 #          if ${kernel_tools_prefix}cc is an AROS gcc
1678 #              aros_kernel_cc = ${kernel_tools_prefix}cc
1679 #          else
1680 #              aros_kernel_cc = elf cc wrapper around ${kernel_tools_prefix}cc
1681 #          fi
1682 #      fi
1684 #      orig_target_* = aros built crosstools
1685 #      orig_target_cc = elf cc wrapper around crosstools cc
1686 #   else
1687 #      VALIDATE(${kernel_tools_prefix}*)
1689 #      orig_target_* = aros_kernel_*
1690 #      if aros_kernel_cc is an AROS gcc
1691 #          orig_target_cc = aros_kernel_cc
1692 #      else
1693 #          orig_target_cc = aros cc wrapper around aros_kernel_cc
1694 #      fi
1695 #   fi
1697 target_tool_prefix="${aros_target_cpu}-aros-"
1699 AC_MSG_CHECKING([which kernel tools])
1700 AC_MSG_RESULT([$kernel_tool_prefix]);
1702 if test "$kernel_tool_prefix" = "none" ; then
1703     dnl ELF wrapper can be used only for native bootstrap
1704     if test "x-$aros_flavour" = "x-emulation" -o "x-$aros_flavour" = "x-emulcompat" ; then
1705         AC_MSG_ERROR([--with-kernel-toolchain-prefix= is required for this arch])
1706     fi
1707 else
1708     # Kernel tools required - find them
1709     # Note that 'normally', aros_kernel_* overrides will be
1710     # empty, unless specified in the per-arch sections above.
1711     if test "x$aros_kernel_cpp" = "x"; then
1712         aros_kernel_cpp=${kernel_tool_prefix}cpp
1713     fi
1714     AROS_TOOL_KERNEL(aros_kernel_cpp,cpp,$aros_kernel_cpp${kernel_tool_version})
1715     AROS_REQUIRED(cpp,$aros_kernel_cpp)
1716     if test "x$aros_kernel_cc" = "x"; then
1717         aros_kernel_cc=${kernel_tool_prefix}gcc
1718     fi
1719     AROS_TOOL_KERNEL(aros_kernel_cc,cc,$aros_kernel_cc${kernel_tool_version})
1720     AROS_REQUIRED(cc,$aros_kernel_cc)
1721     if test "x$aros_kernel_cxx" = "x"; then
1722         aros_kernel_cxx=${kernel_tool_prefix}g++
1723     fi
1724     AROS_TOOL_KERNEL(aros_kernel_cxx,cxx,$aros_kernel_cxx${kernel_tool_version})
1725     # If it's set, make sure it's really there
1726     if test "x$aros_kernel_cxx" != "x" ; then
1727         AROS_REQUIRED(cxx,$aros_kernel_cxx)
1728     fi
1729     AROS_TOOL_KERNEL(aros_kernel_ld,ld,$aros_kernel_ld)
1730     AROS_REQUIRED(ld,$aros_kernel_ld)
1731     AROS_TOOL_KERNEL(aros_kernel_as,as,$aros_kernel_as)
1732     AROS_REQUIRED(as,$aros_kernel_as)
1733     AROS_TOOL_KERNEL(aros_kernel_ar,ar,$aros_kernel_ar)
1734     AROS_REQUIRED(ar,$aros_kernel_ar)
1735     AROS_TOOL_KERNEL(aros_kernel_ranlib,ranlib,$aros_kernel_ranlib)
1736     AROS_REQUIRED(ranlib,$aros_kernel_ranlib)
1737     AROS_TOOL_KERNEL(aros_kernel_nm,nm,$aros_kernel_nm)
1738     AROS_REQUIRED(nm,$aros_kernel_nm)
1739     AROS_TOOL_KERNEL(aros_kernel_strip,strip,$aros_kernel_strip)
1740     AROS_REQUIRED(strip,$aros_kernel_strip)
1742     # Objcopy and objdump are not required for the kernel
1743     # toolchain on many architectures.
1744     # So we'll look for them, but not make them strictly required.
1745     AROS_TOOL_KERNEL(aros_kernel_objcopy,objcopy,$aros_kernel_objcopy)
1746     AROS_TOOL_KERNEL(aros_kernel_objdump,objdump,$aros_kernel_objdump)
1747     if test "x${crosstools}" != "xyes" ; then
1748         AROS_REQUIRED(objcopy,$aros_kernel_objcopy)
1749         AROS_REQUIRED(objdump,$aros_kernel_objdump)
1750     fi
1753 AC_MSG_CHECKING([which target tools to use])
1754 if test "$crosstools" = "yes"; then
1755     AC_MSG_RESULT([$target_tool_prefix])
1756     # We are are building AROS crosstools
1757     tmp_tool_prefix="$AROS_CROSSTOOLSDIR/${target_tool_prefix}"
1758     orig_target_cc="${tmp_tool_prefix}gcc${aros_gcc_version}"
1759     orig_target_cxx="${tmp_tool_prefix}g++${aros_gcc_version}"
1760     orig_target_cpp="${tmp_tool_prefix}cpp"
1761     orig_target_ld="${tmp_tool_prefix}ld"
1762     orig_target_as="${tmp_tool_prefix}as"
1763     orig_target_ar="${tmp_tool_prefix}ar"
1764     orig_target_ranlib="${tmp_tool_prefix}ranlib"
1765     orig_target_nm="${tmp_tool_prefix}nm"
1766     orig_target_strip="${tmp_tool_prefix}strip"
1767     orig_target_objcopy="${tmp_tool_prefix}objcopy"
1768     orig_target_objdump="${tmp_tool_prefix}objdump"
1769 else
1770     # Determine whether AROS or ELF tools should be used
1771     if test "$aros_tool_prefix" = "none"; then
1772         aros_tool_prefix="${elf_tool_prefix}"
1773         crosstools_cxx_target=tools-crosstools
1774     fi
1776     AC_MSG_RESULT([$aros_tool_prefix])
1777     # We are *not* building AROS crosstools - use the AROS or ELF tools
1778     AROS_TOOL_TARGET(orig_target_cpp,cpp,${aros_tool_prefix}cpp)
1779     AROS_REQUIRED(cpp,$orig_target_cpp)
1780     AROS_TOOL_TARGET(orig_target_cc,gcc,${aros_tool_prefix}gcc)
1781     AROS_REQUIRED(cc,$orig_target_cc)
1782     if test "x${crosstools_cxx_target}" = "x" ; then
1783         AROS_TOOL_TARGET(orig_target_cxx,g++,${aros_tool_prefix}g++)
1784         AROS_REQUIRED(cxx,$orig_target_cxx)
1785     fi
1786     AROS_TOOL_TARGET(orig_target_ld,gcc,${aros_tool_prefix}ld)
1787     AROS_REQUIRED(ld,$orig_target_ld)
1788     AROS_TOOL_TARGET(orig_target_as,as,${aros_tool_prefix}as)
1789     AROS_REQUIRED(as,$orig_target_as)
1790     AROS_TOOL_TARGET(orig_target_ar,ar,${aros_tool_prefix}ar)
1791     AROS_REQUIRED(ar,$orig_target_ar)
1792     AROS_TOOL_TARGET(orig_target_ranlib,ar,${aros_tool_prefix}ranlib)
1793     AROS_REQUIRED(ranlib,$orig_target_ranlib)
1794     AROS_TOOL_TARGET(orig_target_nm,nm,${aros_tool_prefix}nm)
1795     AROS_REQUIRED(nm,$orig_target_nm)
1796     AROS_TOOL_TARGET(orig_target_strip,strip,${aros_tool_prefix}strip)
1797     AROS_REQUIRED(strip,$orig_target_strip)
1798     AROS_TOOL_TARGET(orig_target_objcopy,objcopy,${aros_tool_prefix}objcopy)
1799     AROS_REQUIRED(objcopy,$orig_target_objcopy)
1800     AROS_TOOL_TARGET(orig_target_objdump,objdump,${aros_tool_prefix}objdump)
1801     AROS_REQUIRED(objdump,$orig_target_objdump)
1804 if test "$kernel_tool_prefix" = "none" ; then
1805     # No kernel tools specified
1806     # Assume target tools == kernel tools with ELF wrapper
1807     aros_kernel_cc=$orig_target_cc
1808     aros_kernel_cxx=$orig_target_cxx
1809     aros_kernel_cpp=$orig_target_cpp
1810     aros_kernel_ld=$orig_target_ld
1811     aros_kernel_as=$orig_target_as
1812     aros_kernel_ar=$orig_target_ar
1813     aros_kernel_ranlib=$orig_target_ranlib
1814     aros_kernel_nm=$orig_target_nm
1815     aros_kernel_strip=$orig_target_strip
1816     aros_kernel_objcopy=$orig_target_objcopy
1817     aros_kernel_objdump=$orig_target_objdump
1818     use_kernel_cc_wrapper=yes
1821 # At this point, all aros_kernel_* and aros_target_* 
1822 # tools should be set up correctly
1824 CC="$aros_kernel_cc $kernel_tool_flags"
1825 CPP="$aros_kernel_cpp"
1827 #-----------------------------------------------------------------------------
1829 # Disable pointer-signedness warnings if the compiler recognises the option
1831 AC_MSG_CHECKING([whether ${CC} accepts -Wno-pointer-sign])
1832 save_cflags="$CFLAGS"
1833 if test "$crosstools" != "yes" ; then
1834     CFLAGS="$CFLAGS -Wno-pointer-sign"
1835     AC_TRY_COMPILE(,, use_no_sign_warning="yes", use_no_sign_warning="no")
1836 else
1837     # we do know it is supported for the smallest version of gcc we are going to build
1838     # we assume it's also supported by later versions
1839     use_no_sign_warning=yes
1841 AC_MSG_RESULT($use_no_sign_warning)
1842 if test "x-$use_no_sign_warning" = "x-yes" ; then
1843     aros_config_cflags="$aros_config_cflags -Wno-pointer-sign"
1845 CFLAGS="$save_cflags"
1847 #-----------------------------------------------------------------------------
1849 # Find all the tools we need to compile. This could be cross-compiling
1850 # though! If that is the case we use the GNU form of the target and
1851 # simply add this to the front of the binary name. This is rather simple,
1852 # but it should work under most circumstances.
1854 # The default tools are to use the same as the host, but only if the
1855 # host and target CPU are the same. With GCC this is normally enough.
1858 aros_cc_pre=""
1859 aros_shared_ld="$aros_host_ld"
1861 aros_target_mkdep="$aros_host_mkdep"
1863 # The default tools executables to be linked to.
1864 if test "$rescomp" != ""; then
1865     AC_PATH_PROG(aros_kernel_rescomp,${kernel_tool_prefix}$rescomp)
1866     AROS_REQUIRED($rescomp,$aros_kernel_rescomp)
1869 # Set up the sources for the symlink farm
1870 if test "$crosstools" = "yes"; then
1871     crosstools_target=tools-crosstools
1874 aros_kernel_cc="$aros_kernel_cc $kernel_tool_flags"
1875 aros_kernel_ar="$aros_kernel_ar $aros_kernel_ar_flags"
1878 aros_hostcfg_dir="bin/${aros_host_arch}-${aros_host_cpu}/gen/config"
1879 aros_targetcfg_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/config"
1880 aros_inc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/AROS/Development/include/aros"
1881 aros_gendir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen"
1882 aros_geninc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/include/aros"
1883 aros_tools_dir="bin/${aros_host_arch}-${aros_host_cpu}/tools"
1884 aros_scripts_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/scripts"
1886 # aros_cc_pre is a variable that is added to the front of the compiler name
1887 # in the generated aros-gcc shell script. We need this to enable the cache
1888 # to work across cleaned builds. Also, support DISTCC using the correct
1889 # environment variable.
1892 if test "x${DISTCC}" != "x" ; then
1893     if test "x${CCACHE}" != "x" ; then
1894         aros_cc_pre="env CCACHE_PREFIX=${DISTCC} ${CCACHE} "
1895     else
1896         aros_cc_pre="${DISTCC} "
1897     fi
1898 else
1899     if test "x${CCACHE}" != "x" ; then
1900         aros_cc_pre="${CCACHE} "
1901     fi
1904 prefix="${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-"
1906 AC_SUBST(aros_target_nostdinc_cflags,-nostdinc)
1907 AC_SUBST(aros_target_nostartup_ldflags,-nostartfiles)
1908 AC_SUBST(aros_target_nix_ldflags,-nix)
1909 AC_SUBST(aros_target_detach_ldflags,-detach)
1910 AC_SUBST(aros_target_nostdlib_ldflags,-nostdlib)
1912 # Target tools
1913 if test "$crosstools" != "yes"; then
1914     if test "$GCC" = "yes"; then
1915         aros_target_cc_path=`$orig_target_cc -print-search-dirs | grep "programs: =" | cut -c 12-`
1916     fi
1917 else
1918     # We do not know which gcc version we are going to build and what we need to know
1919     # here is different for different versions so this will be set later during the
1920     # build of crosstools.
1921     aros_target_cc_path=@aros_target_cc_path@
1923 aros_target_cpp="${prefix}cpp"
1924 aros_target_cc="${prefix}gcc"
1925 aros_target_cxx="${prefix}g++"
1926 aros_target_as="${prefix}as"
1927 aros_target_ld="${prefix}ld"
1928 aros_target_ar="${prefix}ar $aros_target_ar_flags"
1929 aros_target_objcopy="${prefix}objcopy"
1930 aros_target_objdump="${prefix}objdump"
1931 aros_target_ranlib="${prefix}ranlib $aros_target_ranlib_flags"
1932 aros_target_nm="${prefix}nm $aros_target_nm_flags"
1933 aros_target_strip="${prefix}strip"
1934 aros_plain_nm="${prefix}nm"
1935 aros_plain_ar="${prefix}ar"
1937 AC_ARG_ENABLE(includes,
1938 AC_HELP_STRING([--enable-includes=dir],[Alternative system include directory]),
1939 [aros_target_incl=$enable_includes], [aros_target_incl=`$aros_kernel_cc -print-sysroot`/`$aros_kernel_cc --print-sysroot-headers-suffix 2>/dev/null || echo usr/include`])
1941 if test "$aros_kernel_includes" = ""; then
1942     if test "x-$aros_flavour" = "x-emulation" -o "x-$aros_flavour" = "x-emulcompat" ; then
1943         aros_kernel_includes="-isystem $aros_target_incl"
1944     fi
1947 if test "$aros_kernel_includes" != "" ; then
1948     dnl find out about the kernel cc's include path
1949     AC_MSG_CHECKING([for the kernel compiler's include path])
1950     if test "$aros_kernel_cc_includes" = "" ; then
1951         # Try to guess where the directory is.
1952         aros_kernel_cc_includes=`dirname \`${aros_kernel_cc} ${aros_kernel_cflags} -print-libgcc-file-name\``/include
1953         if test -d $aros_kernel_cc_includes; then
1954             # Check if there is also an include-fixed directory and add it
1955             # to kernel compiler's include path as it may contain some of
1956             # the headers we need.
1957             if test -d "$aros_kernel_cc_includes"-fixed; then
1958                 aros_kernel_cc_includes+=" -isystem $aros_kernel_cc_includes"-fixed
1959             fi
1960             # Check for specific includes directory. Neede for Ubuntu 11.10
1961             if test -d "/usr/include/i386-linux-gnu"; then
1962                 aros_kernel_cc_includes+=" -isystem /usr/include/i386-linux-gnu"
1963             fi
1964         else
1965             # The directory doesn't exist, we need to do some more work.
1966             aros_kernel_cc_includes=${PWD}/${aros_gendir}/cc_include
1968             # These are the headers we're looking for.
1969             headers="limits.h mmintrin.h stdbool.h syslimits.h float.h \
1970                      stddef.h xmmintrin.h iso646.h stdarg.h unwind.h   \
1971                      zutil.h stdint.h"
1973             dirs=
1974             for h in $headers; do
1975                 # Which other headers are needed by each of the above?
1976                 deps=$(echo "#include <$h>" | \
1977                        $aros_kernel_cc -E -M - 2>/dev/null | \
1978                        sed 's/^.*://; s/\\$/ /g; s/[[ \t]]\+/ /g')
1980                 # Copy all the needed headers to a directory beneath gendir.
1981                 for d in $deps; do
1982                     h=$(basename $d)
1983                     dir=${aros_kernel_cc_includes}$(echo $(dirname $d) | \
1984                                                 sed -n "s,^.*/include\(/.*\),\1,p")
1985                     ! test -d $dir && mkdir -p $dir
1986                     ! test -f $dir/$h && { cp $d $dir; chmod u+w $dir/$h; }
1987                 done
1988             done            
1989         fi
1990     fi
1991     AC_MSG_RESULT($aros_kernel_cc_includes)
1992     # Adding -nostdinc to kernel includes as they are always used together.
1993     aros_kernel_includes="$aros_kernel_includes $aros_target_nostdinc_cflags -isystem $aros_kernel_cc_includes"
1996 if test "$crosstools" != "yes"; then
1997     dnl find out about the target cc's include path
1998     AC_MSG_CHECKING([for the target compiler's include path])
1999     if test "$aros_target_cc_includes" = "" ; then
2000         #try to guess where the directory is
2001         aros_target_cc_includes=`dirname \`${orig_target_cc} -print-libgcc-file-name\``/include
2002         if ! test -d $aros_target_cc_includes; then
2003             #the directory doesn't exist, we need to do some more work
2004             aros_target_cc_includes=${PWD}/${aros_gendir}/cc_include
2005         
2006             #these are the headers we're looking for
2007             headers="limits.h mmintrin.h stdbool.h syslimits.h float.h \
2008                     stddef.h xmmintrin.h iso646.h stdarg.h unwind.h   \
2009                     zutil.h"
2011             dirs=
2012             for h in $headers; do
2013                 #which other headers each of the above headers needs?
2014                 deps=$(echo "#include <$h>" | \
2015                     $orig_target_cc -E -M - 2>/dev/null | \
2016                     sed 's/^.*://; s/\\$/ /g; s/[[ \t]]\+/ /g')
2017             
2018                 #copy all the needed headers to a directory beneath gendir
2019                 for d in $deps; do
2020                     h=$(basename $d)
2021                     dir=${aros_target_cc_includes}$(echo $(dirname $d) | \
2022                                                 sed -n "s,^.*/include\(/.*\),\1,p")
2023                     ! test -d $dir && mkdir -p $dir
2024                     ! test -f $dir/$h && { cp $d $dir; chmod u+w $dir/$h; }
2025                 done
2026             done
2027         fi
2028     fi
2029     AC_MSG_RESULT($aros_target_cc_includes)
2030 else
2031     # We do not know which gcc version we are going to build and what we need to know
2032     # here is different for different versions so this will be set later during the
2033     # build of crosstools.
2034     aros_target_cc_includes=@aros_target_cc_includes@
2038 # For GCC < 4.0 -I- is used for giving the search path for '#include "..."'
2039 # On GCC >= 4.0 -iquote should be used
2042 save_cc="$CC"
2043 save_cflags="$CFLAGS"
2044 CFLAGS="-iquote."
2045 AC_MSG_CHECKING([whether ${CC} accepts -iquote])
2046 if test "x-$crosstools" != "x-yes"; then
2047     AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
2048 else
2049     # we do know it is supported for the smallest version of gcc we are going to build
2050     # we assume it's also supported by later versions
2051     has_iquote=yes
2053 AC_MSG_RESULT($has_iquote)
2054 if test "x-$has_iquote" = "x-yes" ; then
2055     host_cflags_iquote=-iquote
2056     host_cflags_iquote_end=
2057 else
2058     host_cflags_iquote=-I
2059     host_cflags_iquote_end=-I-
2061 kernel_cflags_iquote=$host_cflags_iquote
2062 kernel_cflags_iquote_end=$host_cflags_iquote_end
2063 if test "x-$cross_compiling" = "x-yes"; then
2064     CC="$aros_kernel_cc"
2065     AC_MSG_CHECKING([whether ${CC} accepts -fno-stack-protector])
2066     if test "x-$crosstools" != "x-yes"; then
2067         AC_TRY_COMPILE(,, use_no_stack_protector="yes", use_no_stack_protector="no")
2068     else
2069         # we do know it is supported for the smallest version of gcc we are going to build
2070         # we assume it's also supported by later versions
2071         use_no_stack_protector=yes
2072     fi
2073     AC_MSG_RESULT($use_no_stack_protector)
2074     AC_MSG_CHECKING([whether ${CC} accepts -iquote])
2075     if test "x-$crosstools" != "x-yes"; then
2076         AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
2077     else
2078         # we do know it is supported for the smallest version of gcc we are going to build
2079         # we assume it's also supported by later versions
2080         has_iquote=yes
2081     fi
2082     AC_MSG_RESULT($has_iquote)
2083     if test "x-$has_iquote" = "x-yes" ; then
2084         kernel_cflags_iquote=-iquote
2085         kernel_cflags_iquote_end=
2086     else
2087         kernel_cflags_iquote=-I
2088         kernel_cflags_iquote_end=-I-
2089     fi
2091 aros_cflags_iquote=$kernel_cflags_iquote
2092 aros_cflags_iquote_end=$kernel_cflags_iquote_end
2093 if test "$orig_target_cc" != "$aros_kernel_cc"; then
2094     CC="$orig_target_cc"
2095     AC_MSG_CHECKING([whether ${CC} accepts -iquote])
2096     if test "x-$crosstools" != "x-yes"; then
2097         AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
2098     else
2099         # we do know it is supported for the smallest version of gcc we are going to build
2100         # we assume it's also supported by later versions
2101         has_iquote=yes
2102     fi
2103     AC_MSG_RESULT($has_iquote)
2104     if test "x-$has_iquote" = "x-yes" ; then
2105         aros_cflags_iquote=-iquote
2106         aros_cflags_iquote_end=
2107     else
2108         aros_cflags_iquote=-I
2109         aros_cflags_iquote_end=-I-
2110     fi
2112 if test "x-$use_no_stack_protector" = "x-yes" ; then
2113     aros_kernel_cflags="$aros_kernel_cflags -fno-stack-protector"
2117 #-----------------------------------------------------------------------------
2119 # Check if the target compiler supports some options used for delinting:
2120 #  -Wunused-but-set-variable
2121 #  -Warray-bounds
2122 #  -Wenum-compare
2123 #  -Wstrict-overflow
2124 #  -Wformat-security
2126 if test "x-$crosstools" != "x-yes"; then
2127     if test "$orig_target_cc" != "$aros_kernel_cc"; then
2128         CC="$orig_target_cc"
2129     fi
2130     AC_MSG_CHECKING([whether ${CC} accepts -Wunused-but-set-variable])
2131     CFLAGS=-Wunused-but-set-variable
2132     AC_TRY_COMPILE(,, aros_unused_but_set_variable="yes", aros_unused_but_set_variable="no")
2133     AC_MSG_RESULT($aros_unused_but_set_variable)
2134     if test "x-$aros_unused_but_set_variable" = "x-yes" ; then
2135         aros_cflags_unused_but_set_variable=-Wno-unused-but-set-variable
2136     fi
2138     AC_MSG_CHECKING([whether ${CC} accepts -Warray-bounds])
2139     CFLAGS=-Warray-bounds
2140     AC_TRY_COMPILE(,, aros_array_bounds="yes", aros_array_bounds="no")
2141     AC_MSG_RESULT($aros_array_bounds)
2142     if test "x-$aros_array_bounds" = "x-yes" ; then
2143         aros_cflags_array_bounds=-Wno-array-bounds
2144     fi
2146     AC_MSG_CHECKING([whether ${CC} accepts -Wenum-compare])
2147     CFLAGS=-Wenum-compare
2148     AC_TRY_COMPILE(,, aros_enum_compare="yes", aros_enum_compare="no")
2149     AC_MSG_RESULT($aros_enum_compare)
2150     if test "x-$aros_enum_compare" = "x-yes" ; then
2151         aros_cflags_enum_compare=-Wno-enum-compare
2152     fi
2154     AC_MSG_CHECKING([whether ${CC} accepts -Wstrict-overflow])
2155     CFLAGS=-Wstrict-overflow
2156     AC_TRY_COMPILE(,, aros_strict_overflow="yes", aros_strict_overflow="no")
2157     AC_MSG_RESULT($aros_strict_overflow)
2158     if test "x-$aros_strict_overflow" = "x-yes" ; then
2159         aros_cflags_strict_overflow=-Wno-strict-overflow
2160     fi
2162     AC_MSG_CHECKING([whether ${CC} accepts -Wformat-security])
2163     CFLAGS=-Wformat-security
2164     AC_TRY_COMPILE(,, aros_format_security="yes", aros_format_security="no")
2165     AC_MSG_RESULT($aros_format_security)
2166     if test "x-$aros_format_security" = "x-yes" ; then
2167         aros_cflags_format_security=-Wno-format-security
2168     fi
2169 else
2170     # We do not know which gcc version we are going to build and what we need to know
2171     # here is different for different versions so this will be set later during the
2172     # build of crosstools.
2173     aros_cflags_unused_but_set_variable=@aros_cflags_unused_but_set_variable@
2174     aros_cflags_array_bounds=@aros_cflags_array_bounds@
2175     aros_cflags_enum_compare=@aros_cflags_enum_compare@
2176     aros_cflags_strict_overflow=@aros_cflags_strict_overflow@
2177     aros_cflags_format_security=@aros_cflags_format_security@
2180 #-----------------------------------------------------------------------------
2182 # Check if we can explicitly choose older version of symbol hashing
2184 CFLAGS="save_cflags -Wl,--hash-style=sysv"
2185 CC="$aros_kernel_cc"
2186 AC_MSG_CHECKING([whether ${CC} accepts -Wl,--hash-style=sysv])
2187 AC_TRY_LINK(,, use_hash_style="yes", use_hash_style="no")
2188 AC_MSG_RESULT($use_hash_style)
2189 if test "x-$use_hash_style" = "x-yes" ; then
2190     aros_kernel_cflags="$aros_kernel_cflags -Wl,--hash-style=sysv"
2192 CC="$save_cc"
2193 CFLAGS="$save_cflags"
2195 AC_SUBST(host_cflags_iquote)
2196 AC_SUBST(host_cflags_iquote_end)
2197 AC_SUBST(kernel_cflags_iquote)
2198 AC_SUBST(kernel_cflags_iquote_end)
2199 AC_SUBST(aros_cflags_iquote)
2200 AC_SUBST(aros_cflags_iquote_end)
2203 dnl Check if user specified --with-resolution=XRESxYRESxDEPTH
2204 AC_MSG_CHECKING([for default resolution of WBScreen])
2205 AC_ARG_WITH(resolution,AC_HELP_STRING([--with-resolution=XRESxYRESxDEPTH],[Default resolution of the initial WorkbenchScreen]),resolution=$withval,resolution=none)
2206 # We require an argument, so map --with/--without ("yes"/"no") to "none" specified
2207 if test "$resolution" = "yes" ; then
2208     resolution="none"
2210 if test "$resolution" = "no" ; then
2211     resolution="none"
2213 if test "$resolution" != "none" ; then
2214     aros_default_wbwidth=`echo $resolution | cut -d'x' -f1`
2215     aros_default_wbheight=`echo $resolution | cut -d'x' -f2`
2216     aros_default_wbdepth=`echo $resolution | cut -d'x' -f3`
2218 AC_MSG_RESULT($aros_default_wbwidth x $aros_default_wbheight x $aros_default_wbdepth)
2219 aros_cv_default_wbwidth=$aros_default_wbwidth
2220 aros_cv_default_wbheight=$aros_default_wbheight
2221 aros_cv_default_wbdepth=$aros_default_wbdepth
2223 dnl See if the user wants the serial debug output for native flavour
2224 AC_MSG_CHECKING([if serial debug is enabled])
2225 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)
2226 if test "$aros_serial_debug" = 0 ; then
2227     serial_debug_forced=""
2228     if test "$serial_debug" = "yes" ; then
2229         serial_debug="1"
2230     fi
2231     if test "$serial_debug" = "no" ; then
2232         serial_debug="none"
2233     fi
2234 else
2235     serial_debug_forced="(forced)"
2236     serial_debug=$aros_serial_debug
2238 if test "$serial_debug" != "none" ; then
2239     aros_serial_debug=$serial_debug
2240     AC_MSG_RESULT($serial_debug_forced on port $serial_debug)
2241 else
2242     AC_MSG_RESULT(no)
2245 dnl See if the user wants the palm debug output hack for palm native flavour
2246 AC_MSG_CHECKING([if palm debug hack is enabled])
2247 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")
2248 if test "$palm_debug_hack" = "yes" ; then
2249     aros_palm_debug_hack="1"
2251 AC_MSG_RESULT($palm_debug_hack)
2253 dnl See if dev wants the usb3.0 code
2254 AC_MSG_CHECKING([if usb3.0 code is enabled])
2255 AC_ARG_ENABLE(usb30_code,AC_HELP_STRING([--enable-usb30-code],[Enable usb3.0 code (default=no)]),usb30_code="yes",usb30_code="no")
2256 if test "$usb30_code" = "yes" ; then
2257     aros_config_cflags="$aros_config_cflags -DAROS_USB30_CODE"
2258     aros_kernel_cflags="$aros_kernel_cflags -DAROS_USB30_CODE"
2260 AC_MSG_RESULT($usb30_code)
2262 dnl See if the user wants nesting supervisor activated for unix flavour
2263 AC_MSG_CHECKING([if nesting supervisor support is enabled])
2264 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")
2265 if test "$nesting_supervisor" = "yes" ; then
2266     aros_nesting_supervisor="1"
2268 AC_MSG_RESULT($nesting_supervisor)
2270 dnl See if the user wants to disable MMU support
2271 dnl This can be overriden on per-target basis,
2272 dnl set $aros_enable_mmu to "yes" or "no" to do this
2273 if test "$aros_enable_mmu" = "" ; then
2274     AC_MSG_CHECKING([if MMU support is enabled])
2275     dnl Enabled by default
2276     AC_ARG_ENABLE(mmu,AC_HELP_STRING([--disable-mmu],[Disable MMU support (default=enabled)]),aros_enable_mmu=$enableval,aros_enable_mmu="yes")
2277     if test "$aros_enable_mmu" = "" ; then
2278         aros_enable_mmu="yes"
2279     fi
2280     AC_MSG_RESULT($aros_enable_mmu)
2282 if test "$aros_enable_mmu" = "no" ; then
2283     aros_enable_mmu="0"
2284 else
2285     aros_enable_mmu="1"
2287     
2289 dnl things specifically required for hosted flavours
2290 if test "x-$aros_flavour" = "x-emulation" -o "x-$aros_flavour" = "x-emulcompat" ; then
2292     if test "x-$need_dlopen" != "x-no" ; then
2293       save_libs="$LIBS"
2294       LIBS=""
2295       dnl some kind of dynamic library access system is required for hostlib.resource
2296       AC_CHECK_FUNC(dlopen, have_dl="yes", have_dl="no")
2297       if test "x-$have_dl" = "x-no" ; then
2298           AC_CHECK_LIB(dl, dlopen, [have_dl="yes"
2299                                     aros_host_ldflags="$aros_host_ldflags -ldl"],
2300                                     have_dl="no")
2301       fi
2302       if test "x-$have_dl" = "x-no" ; then
2303           AC_MSG_ERROR([dlopen() dynamic linker functions not available])
2304       fi
2305       LIBS="$save_libs"
2306     fi
2309     dnl x11 hidd
2310     AC_ARG_ENABLE(x11_hidd, AC_HELP_STRING([--enable-x11-hidd],
2311                                            [build X11 hidd for hosted (default=auto)]),
2312                                            x11_hidd="$enableval",
2313                                            x11_hidd="$need_x11")
2314     case "x-$x11_hidd" in
2315         x-yes|x-no|x-auto)                 ;;
2316         *)                 x11_hidd="$need_x11" ;;
2317     esac
2319     ENABLE_X11=0
2321     dnl they want it
2322     if test "x-$x11_hidd" != "x-no" ; then
2324         dnl find x11 stuff
2325         AC_PATH_X
2327         x_cflags=
2328         for path in $x_libraries
2329         do
2330             x_cflags="$x_cflags -L$path"
2331         done
2333         for path in $x_includes
2334         do
2335             x_cflags="$x_cflags -I$path"
2336         done
2337         
2338         if test "x-$no_x" = "x-yes" ; then
2340             dnl didn't find it
2341             if test "x-$x11_hidd" != "x-auto" ; then
2342                 dnl and they explicitly asked for it, bail out
2343                 AC_MSG_ERROR([X11 libs/headers not found, cannot build X11 hidd as requested])
2344             fi
2345         
2346         else
2347             dnl found it, setup the metatarget
2348             x11_hidd_target=kernel-x11gfx-kobj
2349             ENABLE_X11=1
2351             dnl setup shared memory extensions
2352             AC_ARG_ENABLE(x11_shm, AC_HELP_STRING([--enable-x11-shm],
2353                                                   [use X11 shared memory (default=auto)]),
2354                                                   x11_hidd_shm="$enableval",
2355                                                   x11_hidd_shm="auto")
2356             case "x-$x11_hidd_shm" in
2357                 x-yes|x-no|x-auto)                     ;;
2358                 *)                 x11_hidd_shm="auto" ;;
2359             esac
2361             have_xshm=no
2363             dnl they want it
2364             if test "x-$x11_hidd_shm" != "x-no" ; then
2366                 dnl system shm headers
2367                 AC_CHECK_HEADERS(sys/ipc.h)
2368                 AC_CHECK_HEADERS(sys/shm.h)
2370                 dnl got them
2371                 if test "x-$ac_cv_header_sys_ipc_h" = "x-yes" -a "x-$ac_cv_header_sys_shm_h" = "x-yes" ; then
2373                     dnl make sure X libs have shm functions
2374                     save_cflags="$CFLAGS"
2375                     CFLAGS="$CFLAGS $x_cflags"
2376                     AC_CHECK_LIB(Xext, XShmQueryExtension, have_xshm=yes)
2377                     CFLAGS="$save_cflags"
2378                 fi
2379             fi
2381             dnl detection done, prepare output
2382             if test "x-$have_xshm" = "x-yes" ; then
2383                 dnl we can do shm
2384                 DO_XSHM_SUPPORT="1"
2385             elif test "x-$x11_hidd_shm" = "x-yes" ; then
2386                 dnl they explicitly asked for it, but we can't do it
2387                 AC_MSG_ERROR([X11 has no support for shared memory, cannot enable it as requested])
2388             else
2389                 dnl otherwise just disable it
2390                 DO_XSHM_SUPPORT="0"
2391             fi
2393             
2394             dnl setup vidmode (fullscreen) extensions
2395             AC_ARG_ENABLE(x11_vidmode, AC_HELP_STRING([--enable-x11-vidmode],
2396                                                       [use X11 vidmode extension (default=auto)]),
2397                                                       x11_hidd_vidmode="$enableval",
2398                                                       x11_hidd_vidmode="auto")
2399             case "x-$x11_hidd_vidmode" in
2400                 x-yes|x-no|x-auto)                         ;;
2401                 *)                 x11_hidd_vidmode="auto" ;;
2402             esac
2404             have_vidmode=no
2406             dnl they want it
2407             if test "x-$x11_hidd_vidmode" != "x-no" ; then
2409                 dnl make sure X libs have vidmode functions
2410                 save_cflags="$CFLAGS"
2411                 CFLAGS="$CFLAGS $x_cflags"
2412                 AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryExtension, have_vidmode=yes)
2413                 CFLAGS="$save_cflags"
2414             fi
2416             dnl detection done, prepare output
2417             if test "x-$have_vidmode" = "x-yes" ; then
2418                 dnl we can do vidmode
2419                 DO_VIDMODE_SUPPORT="1"
2420             elif test "x-$x11_hidd_vidmode" = "x-yes" ; then
2421                 dnl they explicitly asked for it, but we can't do it
2422                 AC_MSG_ERROR([X11 vidmode extension not available, cannot enable it as requested])
2423             else
2424                 dnl otherwise just disable it
2425                 DO_VIDMODE_SUPPORT="0"
2426             fi
2427         fi
2429         aros_host_x11_includes=$x_includes 
2430         aros_host_x11_libdirs=$x_libraries
2431     fi
2434     dnl sdl hidd
2435     AC_ARG_ENABLE(sdl_hidd, AC_HELP_STRING([--enable-sdl-hidd],
2436                                            [build SDL hidd for hosted (default=auto)]),
2437                                            sdl_hidd="$enableval",
2438                                            sdl_hidd="auto")
2439     case "x-$sdl_hidd" in
2440         x-yes|x-no|x-auto)                 ;;
2441         *)                 sdl_hidd="auto" ;;
2442     esac
2444     dnl they want it
2445     if test "x-$sdl_hidd" != "x-no" ; then
2447         dnl find sdl
2448         AM_PATH_SDL([1.2.10], have_sdl="yes", have_sdl="no")
2450         if test "x-$have_sdl" != "x-yes" ; then
2452             dnl didn't find it
2453             if test "x-$sdl_hidd" != "x-auto" ; then
2454                 dnl and they explicitly asked for it, bail out
2455                 AC_MSG_ERROR([SDL libs/headers not found, cannot build SDL hidd as requested])
2456             fi
2458         else
2459             dnl found it, set up the metatarget
2460             sdl_hidd_target=kernel-hidd-sdl
2461             aros_host_sdl_cflags=SDL_CFLAGS
2462             aros_host_sdl_libs=SDL_LIBS
2463         fi
2464     fi
2466     dnl oss.library
2467     AC_CHECK_HEADER(sys/soundcard.h)
2468     if test "x-$ac_cv_header_sys_soundcard_h" = "x-yes" ; then
2469         oss_library_target=workbench-libs-oss-unix
2470     fi
2474 dnl See if the user wants dbus.library
2475 AC_MSG_CHECKING([if building of dbus.library is enabled])
2476 AC_ARG_ENABLE(dbus,AC_HELP_STRING([--enable-dbus],[Enable DBUS support via dbus.library (default=no)]),dbus="yes",dbus="no")
2477 if test "$dbus" = "yes" ; then
2478     ENABLE_DBUS=1
2479     DBUS_CFLAGS=`pkg-config --cflags dbus-1`
2480     DBUS_LIBFLAGS=`pkg-config --libs dbus-1`
2481     KERNEL_DBUS_KOBJ=kernel-dbus-kobj
2482     KERNEL_DBUS_INCLUDES=kernel-dbus-includes
2483 else
2484     ENABLE_DBUS=0
2486 AC_MSG_RESULT($dbus)
2488 if test "$use_kernel_cc_wrapper" = "yes" ; then
2489     aros_kernel_cc="${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-elf-gcc"
2492 if test "${crosstools}" != "yes" ; then
2493     aros_target_toolchain=no
2494 else
2495     aros_target_toolchain=yes
2498 dnl --------------------------------------------------------------------
2499 dnl Configuration Output Section
2500 dnl --------------------------------------------------------------------
2502 # Generic
2503 AC_SUBST(aros_arch)
2504 AC_SUBST(aros_cpu)
2505 AC_SUBST(aros_flavour)
2506 AC_SUBST(aros_flavour_uc)
2507 AC_SUBST(aros_target_toolchain)
2508 AC_SUBST(AROS_BUILDDIR)
2509 AC_SUBST(AROS_BUILDDIR_UNIX)
2510 AC_SUBST(SRCDIR)
2511 AC_SUBST(AROS_CROSSTOOLSDIR)
2512 AC_SUBST(AROS_PORTSSRCDIR)
2514 # Compatability with other Amiga-like operation systems
2515 AC_SUBST(aros_amigaos_compliance)
2517 # Host related
2518 AC_SUBST(aros_cc_pre)
2519 AC_SUBST(aros_host_strip)
2520 AC_SUBST(aros_host_arch)
2521 AC_SUBST(aros_host_cpu)
2522 AC_SUBST(aros_host_cpp)
2523 AC_SUBST(aros_host_cc)
2524 AC_SUBST(aros_host_cxx)
2525 AC_SUBST(aros_host_ar)
2526 AC_SUBST(aros_host_ranlib)
2527 AC_SUBST(aros_host_ld)
2528 AC_SUBST(aros_host_make)
2529 AC_SUBST(aros_host_cflags)
2530 AC_SUBST(aros_host_cxxflags)
2531 AC_SUBST(gnu89_inline)
2532 AC_SUBST(aros_host_ldflags)
2533 AC_SUBST(aros_host_debug)
2534 AC_SUBST(aros_host_mkdep)
2535 AC_SUBST(aros_host_mkargs)
2536 AC_SUBST(aros_host_exe_suffix)
2537 AC_SUBST(aros_host_lib_suffix)
2538 AC_SUBST(aros_tools_dir)
2539 AC_SUBST(aros_host_aclocal)
2540 AC_SUBST(aros_host_autoconf)
2541 AC_SUBST(aros_host_autoheader)
2542 AC_SUBST(aros_host_automake)
2543 AC_SUBST(ant)
2545 # Target Related
2546 AC_SUBST(aros_target_guitheme)
2547 AC_SUBST(aros_target_iconset)
2548 AC_SUBST(aros_target_bootloader)
2549 AC_SUBST(aros_target_arch)
2550 AC_SUBST(aros_target_family)
2551 AC_SUBST(aros_target_cpu)
2552 AC_SUBST(aros_target_variant)
2553 AC_SUBST(aros_target_suffix)
2554 AC_SUBST(aros_target_ar)
2555 AC_SUBST(aros_target_ranlib)
2556 AC_SUBST(aros_plain_nm)
2557 AC_SUBST(aros_plain_ar)
2558 AC_SUBST(aros_kernel_ar)
2559 AC_SUBST(aros_kernel_ranlib)
2560 AC_SUBST(orig_target_cc)
2561 AC_SUBST(aros_target_cc)
2562 AC_SUBST(aros_kernel_cc)
2563 AC_SUBST(orig_target_cxx)
2564 AC_SUBST(aros_target_cxx)
2565 AC_SUBST(aros_kernel_cxx)
2566 AC_SUBST(orig_target_cpp)
2567 AC_SUBST(aros_target_cpp)
2568 AC_SUBST(aros_kernel_cpp)
2569 AC_SUBST(orig_target_as)
2570 AC_SUBST(aros_target_as)
2571 AC_SUBST(aros_kernel_as)
2572 AC_SUBST(orig_target_ld)
2573 AC_SUBST(aros_target_ld)
2574 AC_SUBST(aros_kernel_ld)
2575 AC_SUBST(aros_target_cc_includes)
2576 AC_SUBST(aros_target_cc_path)
2577 AC_SUBST(aros_target_objdump)
2578 AC_SUBST(aros_target_objcopy)
2579 AC_SUBST(aros_target_strip)
2580 AC_SUBST(aros_target_nm)
2581 AC_SUBST(aros_kernel_rescomp)
2582 AC_SUBST(aros_shared_default)
2583 AC_SUBST(aros_shared_ld)
2584 AC_SUBST(aros_object_format)
2585 AC_SUBST(aros_compiler_libs)
2586 AC_SUBST(aros_arch_libs)
2588 AC_SUBST(aros_config_cflags)
2589 AC_SUBST(aros_config_aflags)
2590 AC_SUBST(aros_config_ldflags)
2592 AC_SUBST(aros_shared_cflags)
2593 AC_SUBST(aros_shared_aflags)
2594 AC_SUBST(aros_shared_ldflags)
2595 AC_SUBST(aros_kernel_cflags)
2596 AC_SUBST(aros_kernel_includes)
2597 AC_SUBST(aros_kernel_objcflags)
2598 AC_SUBST(aros_kernel_ldflags)
2599 AC_SUBST(aros_target_cflags)
2600 AC_SUBST(aros_debug_cflags)
2601 AC_SUBST(aros_debug_aflags)
2602 AC_SUBST(aros_debug_ldflags)
2603 AC_SUBST(aros_target_genmap)
2604 AC_SUBST(aros_target_strip_flags)
2606 AC_SUBST(crosstools_target)
2607 AC_SUBST(crosstools_cxx_target)
2609 # Delinting target compiler flags
2610 AC_SUBST(aros_cflags_unused_but_set_variable)
2611 AC_SUBST(aros_cflags_array_bounds)
2612 AC_SUBST(aros_cflags_enum_compare)
2613 AC_SUBST(aros_cflags_strict_overflow)
2614 AC_SUBST(aros_cflags_format_security)
2616 # Graphics Related
2617 AC_SUBST(x11_hidd_target)
2618 AC_SUBST(sdl_hidd_target)
2619 AC_SUBST(pci_hidd_target)
2620 AC_SUBST(oss_library_target)
2622 AC_SUBST(aros_default_wbwidth)
2623 AC_SUBST(aros_default_wbheight)
2624 AC_SUBST(aros_default_wbdepth)
2625 AC_SUBST(DO_XSHM_SUPPORT)
2626 AC_SUBST(DO_VIDMODE_SUPPORT)
2628 AC_SUBST(aros_host_x11_includes)
2629 AC_SUBST(aros_host_x11_libdirs)
2630 AC_SUBST(aros_host_sdl_cflags)
2631 AC_SUBST(aros_host_sdl_libs)
2633 # Native version related
2634 AC_SUBST(aros_serial_debug)
2636 # Palm native version related
2637 AC_SUBST(aros_palm_debug_hack)
2639 # Unix/Hosted version related
2640 AC_SUBST(aros_nesting_supervisor)
2642 # MMU related
2643 AC_SUBST(aros_enable_mmu)
2645 # Apple iOS related
2646 AC_SUBST(aros_ios_platform)
2647 AC_SUBST(aros_ios_version)
2648 AC_SUBST(aros_ios_sdk)
2650 # ARM default GCC target related
2651 AC_SUBST(gcc_default_cpu)
2652 AC_SUBST(gcc_default_cpu_tune)
2653 AC_SUBST(gcc_default_fpu)
2654 AC_SUBST(gcc_default_float_abi)
2656 # Android related
2657 AC_SUBST(android_tool)
2658 AC_SUBST(aros_android_level)
2660 # DBUS related
2661 AC_SUBST(ENABLE_DBUS)
2662 AC_SUBST(DBUS_CFLAGS)
2663 AC_SUBST(DBUS_LIBFLAGS)
2664 AC_SUBST(KERNEL_DBUS_KOBJ)
2665 AC_SUBST(KERNEL_DBUS_INCLUDES)
2667 #X11 related
2668 AC_SUBST(ENABLE_X11)
2670 # Debug related
2671 AC_SUBST(aros_debug)
2672 AC_SUBST(aros_mungwall_debug)
2673 AC_SUBST(aros_stack_debug)
2674 AC_SUBST(aros_modules_debug)
2676 # Collect-aros stuff: "-ius" to ignore undefined symbols
2677 AC_SUBST(ignore_undefined_symbols)
2679 # C compiler related
2680 AC_SUBST(gcc_target_cpu)
2682 # USB3.0 code
2683 AC_SUBST(aros_usb30_code)
2685 dnl Prepare for output, make up all the generated patches
2686 case "$aros_flavour" in
2687 emulation)      aros_flavour_uc="AROS_FLAVOUR_EMULATION"
2688                 aros_flavour="emulation" ;;
2689 emulcompat)     aros_flavour_uc="(AROS_FLAVOUR_EMULATION|AROS_FLAVOUR_BINCOMPAT)"
2690                 aros_flavour="emulation" ;;
2691 standalone)     aros_flavour_uc="AROS_FLAVOUR_STANDALONE"
2692                 aros_flavour="standalone";;
2693 standcompat)    aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_BINCOMPAT)"
2694                 aros_flavour="standalone";;
2695 native)         aros_flavour_uc="AROS_FLAVOUR_NATIVE"
2696                 aros_flavour="native" ;;
2697 nativecompat)   aros_flavour_uc="(AROS_FLAVOUR_NATIVE|AROS_FLAVOUR_BINCOMPAT)"
2698                 aros_flavour="native" ;;
2699 linklib)        aros_flavour_uc="AROS_FLAVOUR_LINKLIB"
2700                 aros_flavour="linklib" ;;
2701 palmnative)     aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
2702                 aros_flavour="palmnative" ;;
2703 mac68knative)   aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
2704                 aros_flavour="mac68knative" ;;
2705 ppcnative)      aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_BINCOMPAT)"
2706                 aros_flavour="ppcnative" ;;
2707 esac
2709 if test ! -d ${aros_inc_dir} ; then
2710     ${MKDIR} ${aros_inc_dir}
2712 if test ! -d ${aros_geninc_dir} ; then
2713     ${MKDIR} ${aros_geninc_dir}
2715 if test ! -d ${aros_hostcfg_dir} ; then
2716     ${MKDIR} ${aros_hostcfg_dir}
2718 if test ! -d ${aros_targetcfg_dir} ; then
2719     ${MKDIR} ${aros_targetcfg_dir}
2721 if test ! -d ${aros_tools_dir} ; then
2722     ${MKDIR} ${aros_tools_dir}
2724 if test ! -d ${aros_scripts_dir} ; then
2725     ${MKDIR} ${aros_scripts_dir}
2728 AC_CONFIG_HEADERS(${aros_geninc_dir}/host-conf.h:config/host-conf.h.in)
2730 AC_CONFIG_COMMANDS([compiler_executable],
2731     [
2732         prefix=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}
2733         mkdir -p $prefix
2734         prefix2=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros
2735         prefix3=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-elf
2737         echo ${prefix2}
2738         echo ${prefix3}
2739         chmod a+x ${prefix2}-gcc ${prefix2}-g++ ${prefix2}-ld ${prefix2}-cpp ${prefix3}-gcc
2741         ln -sf $orig_target_as$aros_host_exe_suffix      ${prefix2}-as$aros_host_exe_suffix
2742         ln -sf $orig_target_nm$aros_host_exe_suffix      ${prefix2}-nm$aros_host_exe_suffix
2743         ln -sf $orig_target_ar$aros_host_exe_suffix      ${prefix2}-ar$aros_host_exe_suffix
2744         ln -sf $orig_target_ranlib$aros_host_exe_suffix  ${prefix2}-ranlib$aros_host_exe_suffix
2745         ln -sf $orig_target_objcopy$aros_host_exe_suffix ${prefix2}-objcopy$aros_host_exe_suffix
2746         ln -sf $orig_target_objdump$aros_host_exe_suffix ${prefix2}-objdump$aros_host_exe_suffix
2747         ln -sf $orig_target_strip$aros_host_exe_suffix   ${prefix2}-strip$aros_host_exe_suffix
2749         ln -sf $aros_kernel_ld$aros_host_exe_suffix         ${prefix3}-ld$aros_host_exe_suffix
2750     ],
2751     [
2752         aros_host_exe_suffix=${aros_host_exe_suffix}
2753         aros_tools_dir=${aros_tools_dir}
2754         aros_target_cpu=${aros_target_cpu}
2755         aros_target_arch=${aros_target_arch}
2756         aros_target_suffix=${aros_target_suffix}
2757         orig_target_nm=${orig_target_nm}
2758         orig_target_as=${orig_target_as}
2759         orig_target_ar=${orig_target_ar}
2760         orig_target_ranlib=${orig_target_ranlib}
2761         orig_target_objdump=${orig_target_objdump}
2762         orig_target_objcopy=${orig_target_objcopy}
2763         orig_target_strip=${orig_target_strip}
2764         aros_kernel_ld=${aros_kernel_ld}
2765     ]
2767 AC_CONFIG_COMMANDS([genmf_executable],
2768     [chmod a+x ${aros_tools_dir}/genmf.py],
2769     [aros_tools_dir=${aros_tools_dir}]
2772 AC_CONFIG_FILES(
2773     Makefile
2774     config/make.cfg
2775     ${aros_inc_dir}/config.h:config/config.h.in
2776     ${aros_geninc_dir}/config.h:config/config.h.in
2777     ${aros_hostcfg_dir}/host.cfg:config/host.cfg.in
2778     ${aros_targetcfg_dir}/target.cfg:config/target.cfg.in
2779     mmake.config
2780     ${aros_targetcfg_dir}/make.defaults:config/make.defaults.in
2781     ${aros_targetcfg_dir}/specs:config/specs.in
2782     ${aros_targetcfg_dir}/elf-specs:${elf_specs_in}
2783     ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-cpp:scripts/aros-cpp.in
2784     ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-gcc:scripts/aros-gcc.in
2785     ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-g++:scripts/aros-g++.in
2786     ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-elf-gcc:scripts/elf-gcc.in
2787     ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-ld:scripts/aros-ld.in
2788     ${aros_tools_dir}/genmf.py:tools/genmf/genmf.py
2789     tools/collect-aros/env.h
2790     ${aros_gendir}/arch/all-android/bootstrap/app/default.properties:arch/all-android/bootstrap/app/default.properties.in
2793 AC_OUTPUT
2795 dnl This is in order to not define SHARED_CFLAGS sometimes
2796 dnl We don't always do aros_shared_ar, aros_shared_cflags
2798 #XXX compatability...
2799 aros_shared_ar="$aros_shared_ld $aros_shared_ldflags -o"
2801 if test -n "$aros_shared_cflags" ; then
2802     echo "SHARED_CFLAGS := $aros_shared_cflags" >> ${aros_hostcfg_dir}/host.cfg
2803     echo "SHARED_AR := $aros_shared_ar" >> ${aros_hostcfg_dir}/host.cfg