use the cpp_cpu spec
[AROS.git] / configure.in
blob203a5e5c4d4c6b71956b0920c389a6ae5e7f0aa7
1 dnl Copyright © 1997-2014, 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         SED="gsed"
235         android_build_os="darwin-x86"
236         android_tool="android"
237         default_android_sdk="/android-sdk-mac_x86"
238         case "$host_cpu" in
239             *i?86*)
240                 aros_host_cpu="i386"
241                 ;;
242             *x86_64*)
243                 aros_host_cpu="x86_64"
244                 ;;
245             *powerpc*)
246                 aros_host_cpu="ppc"
247                 ;;
248             *)
249                 AC_MSG_WARN("Unknown CPU for Darwin host -- $host_cpu")
250                 aros_host_cpu="$host_cpu"
251                 ;;
252         esac
254         aros_host_ldflags="$aros_host_ldflags -liconv"
256         ;;
258     dragonfly*)
259         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
260         aros_host_make="gmake"
261         aros_host_arch="dragonfly"
262         case $host_cpu in
263             *i?86*)
264                 aros_host_cpu="i386"
265                 ;;
266             *amd64*)
267                 aros_host_cpu="x86_64"
268                 ;;
269             *)
270                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
271                 aros_host_cpu="$host_cpu"
272                 ;;
273         esac
274         ;;
276     netbsd*)
277         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
278         aros_host_make="gmake"
279         aros_host_arch="netbsd"
280         case "$host_cpu" in
281             *i?86*)
282                 aros_host_cpu="i386"
283                 ;;
284             *m68k*)
285                 aros_host_cpu="m68k"
286                 ;;
287             *)
288                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
289                 aros_host_cpu="$host_cpu"
290                 ;;
291         esac    
292         aros_host_lib_suffix=".0.0"
293         ;;
295     openbsd*)
296         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
297         aros_host_make="gmake"
298         aros_host_arch="openbsd"
299         case "$host_cpu" in
300             *i?86*)
301                 aros_host_cpu="i386"
302                 ;;
303             *)
304                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
305                 aros_host_cpu="$host_cpu"
306                 ;;
307         esac
308         ;;
309         
310     solaris*)
311         aros_host_arch="solaris"
312         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
313         case "$host_cpu" in
314             *i?86*)
315                 aros_host_cpu="i386"
316                 ;;
317             *sparc*)
318                 aros_host_cpu="sparc"
319                 ;;
320             *)
321                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
322                 aros_host_cpu="$host_cpu"
323                 ;;
324         esac
325         ;;
327     morphos*)
328         aros_host_arch="morphos"
329         aros_host_cpu="ppc"
330         host_cc_elf=no
331         ;;
333     amiga*)
334         aros_host_arch="amiga"
335         host_cc_elf=no
336         SORT="/gg/bin/sort"
337         TEST="/gg/bin/test"
338         UNIQ="/gg/bin/uniq"
339         FOR="for"
340         TOUCH="/gg/bin/touch"
341         case "$host_cpu" in
342             *m68k*)
343                 aros_host_cpu="m68k"
344                 ;;
345             *powerpc*)
346                 aros_host_cpu="ppc"
347                 ;;
348             *)
349                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
350                 aros_host_cpu="$host_cpu"
351                 ;;
352         esac
353         ;;
355     cygwin*)
356         aros_host_arch="cygwin"
357         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
358         host_cc_elf=no
359         android_build_os="windows"
360         android_tool="android.bat"
361         default_android_sdk="/cygdrive/c/android-sdk-windows-1.6_r1"
363         case "$host_cpu" in
364             *i?86*)
365                 aros_host_cpu="i386"
366                 ;;
367             *)
368                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
369                 aros_host_cpu="$host_cpu"
370                 ;;
371         esac
372         ;;
374     mingw32*)
375         aros_host_arch="mingw32"
376         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
377         host_cc_elf=no
378         android_build_os="windows"
379         android_tool="android.bat"
380         default_android_sdk="/c/android-sdk-windows-1.6_r1"
382         case "$host_cpu" in
383         *i?86*)
384             dnl Currently there's neither 64-bit MinGW nor MSYS. Both environments are 32-bit
385             dnl and run under emulation. Consequently, uname reports i386 even on 64-bit systems.
386             dnl Here we attempt to detect Windows home platform by asking gcc about its target.
387             dnl 64-bit gcc will output "x86_64-w64-mingw32" here.
389             AC_MSG_CHECKING([for Windows native gcc target])
390             host_cpu=`gcc -dumpmachine`
391             AC_MSG_RESULT($host_cpu)
392             ;;
394         esac
396         case "$host_cpu" in
397         *i?86*)
398             aros_host_cpu="i386"
399             ;;
401         mingw32*)
402             dnl Native i386 gcc for MinGW32 reports 'mingw32' with -dumpmachine switch
403             aros_host_cpu="i386"
404             ;;
406         *x86_64*)
407             aros_host_cpu="x86_64"
408             dnl Dragon's x86_64-w64-mingw32-gcc is a bit broken. It ignores standard $prefix/include
409             dnl directory, so we have to add it explicitly here.
410             aros_host_cflags="$aros_host_cflags -isystem /mingw/include"
411             ;;
413         *)
414             AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
415             aros_host_cpu="$host_cpu"
416             ;;
417         esac
418         ;;
419     *)
420         AC_MSG_ERROR([Unsupported host architecture $host])
421         ;;
422 esac
424 AROS_PROG(aros_host_ar,[ar],[cr])
425 AROS_REQUIRED(ar,$aros_host_ar)
426 AROS_PROG(aros_host_ranlib,ranlib)
427 AROS_REQUIRED(ranlib,$aros_host_ranlib)
428 AROS_PROG(aros_host_strip,strip)
429 AROS_REQUIRED(strip,$aros_host_strip)
431 AROS_PROG(RM,[rm],[-rf])
432 AROS_REQUIRED(rm,$RM)
433 AROS_PROG(CP,[cp])
434 AROS_REQUIRED(cp,$CP)
435 AROS_PROG(MV,[mv])
436 AROS_REQUIRED(mv,$MV)
437 AROS_PROG(ECHO,[echo])
438 AROS_REQUIRED(echo,$ECHO)
439 AROS_PROG(MKDIR,[mkdir],[-p])
440 AROS_REQUIRED(mkdir,$MKDIR)
441 AROS_PROG(TOUCH,[touch])
442 AROS_REQUIRED(touch,$TOUCH)
443 AROS_PROG(SORT,[sort])
444 AROS_REQUIRED(sort,$SORT)
445 AROS_PROG(UNIQ,[uniq])
446 AROS_REQUIRED(uniq,$UNIQ)
447 AROS_PROG(NOP,[true])
448 AROS_REQUIRED(true,$NOP)
449 AROS_PROG(CAT,[cat])
450 AROS_REQUIRED(cat,$CAT)
451 AROS_PROG(BISON,[bison])
452 AROS_REQUIRED(bison,$BISON)
453 AROS_PROG(FLEX,[flex])
454 AROS_REQUIRED(flex,$FLEX)
455 AROS_PROG(PNGTOPNM,[pngtopnm])
456 AROS_REQUIRED(pngtopnm,$PNGTOPNM)
457 AROS_PROG(PPMTOILBM,[ppmtoilbm])
458 AROS_REQUIRED(ppmtoilbm,$PPMTOILBM)
459 AROS_PROG(SED,[sed])
460 AROS_REQUIRED(sed,$SED)
461 AROS_PROG(CHMOD,[chmod])
462 AROS_REQUIRED(chmod,$CHMOD)
463 AROS_PROG(PATCH,[patch])
464 AROS_REQUIRED(patch,$PATCH)
466 AM_PATH_PYTHON(2.5)
468 AC_CHECK_LIB(png, png_read_png)
469 AROS_REQUIRED(libpng, $ac_cv_lib_png_png_read_png)
471 AC_SUBST(FOR, for)
472 AC_SUBST(IF, if)
473 AC_SUBST(TEST, test)
474 AC_SUBST(CMP, cmp)
476 dnl ---------------------------------------------------------------------------
477 dnl Look for things about the host system, good for hosted targets.
478 dnl ---------------------------------------------------------------------------
480 # Check for some includes for the X11 HIDD and the kernel
481 AC_CHECK_HEADERS([sys/ipc.h sys/shm.h \
482     sys/mmap.h sys/mman.h sysexits.h \
483     sys/statfs.h sys/statvfs.h sys/vfs.h sys/param.h \
486 AC_CHECK_HEADERS([sys/mount.h],,,[#include <sys/param.h>])
488 AC_HEADER_DIRENT
489 AC_HEADER_STAT
490 AC_HEADER_STDC
491 AC_HEADER_SYS_WAIT
492 AC_HEADER_TIME
493 AC_STRUCT_ST_BLKSIZE
494 AC_STRUCT_ST_BLOCKS
495 AC_STRUCT_ST_RDEV
496 AC_STRUCT_TM
497 AC_STRUCT_TIMEZONE
498 AC_TYPE_OFF_T
499 AC_TYPE_PID_T
500 AC_TYPE_SIZE_T
501 AC_TYPE_UID_T
503 AC_CHECK_MEMBERS(struct tm.tm_gmtoff)
505 # Look for some functions
506 AC_CHECK_FUNCS([getpagesize kqueue statfs statvfs \
507     clone kse_create rfork_thread thr_create sa_register \
508     getcontext makecontext setcontext sigaltstack swapcontext])
510 AC_FUNC_MMAP
513 dnl --------------------------------------------------------------------
514 dnl Target Configuration Section
515 dnl --------------------------------------------------------------------
517 dnl The target configuration section is responsible for setting up all
518 dnl the paths for includes, and tools required to build AROS to some
519 dnl particular target.
521 aros_config_cflags="-Wall -Werror-implicit-function-declaration"
522 aros_config_aflags="-Wall -x assembler-with-cpp -c"
523 aros_config_ldflags=""
525 aros_shared_default=yes
527 aros_shared_cflags="-fPIC"
528 aros_shared_aflags=""
529 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
530 aros_kernel_ldflags="-Wl,-rpath,./lib"
532 aros_kernel_ar_flags="cr"
533 aros_target_ar_flags="cr"
534 aros_target_nm_flags="-C -ul"
535 aros_target_strip_flags="--strip-unneeded -R.comment"
537 aros_compiler_libs=
538 aros_arch_libs=
540 aros_target_genmap="-Wl,-Map -Xlinker"
542 # Native flavour stuff
543 aros_serial_debug="0"
545 # Palm native flavour stuff
546 aros_palm_debug_hack="0"
548 # Unix flavour stuff
549 aros_nesting_supervisor="0"
551 # Collect-aros stuff: "-ius" to ignore undefined symbols
552 ignore_undefined_symbols=""
554 # Check for X11 by default
555 need_x11="auto"
557 #-----------------------------------------------------------------------------
560 # GCC 4.1+ has a stack protection feature that requires OS support. Ubuntu has
561 # it switched on by default, and we use the host compiler, so it compiles AROS
562 # code with this enabled resulting in link failures as we don't have support
563 # for it.
565 # We use two methods to disable it. For the host compiler (used to compile
566 # some hosted modules), we test to see if the compiler supports stack
567 # protection, and if it does we disable it in AROS_CONFIG_CFLAGS. This should
568 # work on all platforms.
570 # For the "cross" compiler we clear the "ssp_default" spec in config/specs.in
571 # (this is done unconditionally, as it should have no effect on compilers
572 # without the stack protection feature). This may be specific to the way that
573 # Ubuntu enables the feature, so may not work everywhere. My specs-fu isn't
574 # strong enough to disable it in a generic way though, so we'll live with it
575 # until another vendor ships GCC with it enabled in a different way, and deal
576 # with it then.
579 AC_MSG_CHECKING([whether ${CC} accepts -fno-stack-protector])
580 save_cflags="$CFLAGS"
581 CFLAGS="$CFLAGS -fno-stack-protector"
582 AC_TRY_COMPILE(,, use_no_stack_protector="yes", use_no_stack_protector="no")
583 AC_MSG_RESULT($use_no_stack_protector)
584 if test "x-$use_no_stack_protector" = "x-yes" ; then
585     aros_host_cflags="$aros_host_cflags -fno-stack-protector"
587 CFLAGS="$save_cflags"
589 #-----------------------------------------------------------------------------
591 # Disable pointer-signedness warnings if the compiler recognises the option
592 # (this only works for the host compiler at the moment)
594 AC_MSG_CHECKING([whether ${CC} accepts -Wno-pointer-sign])
595 save_cflags="$CFLAGS"
596 CFLAGS="$CFLAGS -Wno-pointer-sign"
597 AC_TRY_COMPILE(,, use_no_sign_warning="yes", use_no_sign_warning="no")
598 AC_MSG_RESULT($use_no_sign_warning)
599 if test "x-$use_no_sign_warning" = "x-yes" ; then
600     aros_host_cflags="$aros_host_cflags -Wno-pointer-sign"
602 CFLAGS="$save_cflags"
604 #-----------------------------------------------------------------------------
606 # Check if host compiler supports -fgnu89-inline, can be needed for crosstools.
608 AC_MSG_CHECKING([whether ${CC} accepts -fgnu89-inline])
609 save_cflags="$CFLAGS"
610 CFLAGS="$CFLAGS -fgnu89-inline"
611 AC_TRY_COMPILE(,, use_gnu89_inline="yes", use_gnu89_inline="no")
612 AC_MSG_RESULT($use_gnu89_inline)
613 if test "x-$use_gnu89_inline" = "x-yes" ; then
614     gnu89_inline="-fgnu89-inline"
616 CFLAGS="$save_cflags"
618 #-----------------------------------------------------------------------------
620 AC_MSG_CHECKING([for type of build])
621 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")
623 if test "$build_type" = "nightly"; then
624     build_type_string="NIGHTLY"
625 elif test "$build_type" = "snapshot"; then
626     build_type_string="SNAPSHOT"
627 elif test "$build_type" = "milestone"; then
628     build_type_string="MILESTONE"
629 elif test "$build_type" = "release"; then
630     build_type_string="RELEASE"
631 else
632     build_type_string="PERSONAL"
633     build_type="personal"
636 aros_config_cflags="$aros_config_cflags -DAROS_BUILD_TYPE=AROS_BUILD_TYPE_$build_type_string"
638 AC_MSG_RESULT($build_type)
640 #-----------------------------------------------------------------------------
641 all_debug_types="messages stack modules mungwall symbols"
643 AC_MSG_CHECKING([which debug types to enable])
644 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)]),
645  debug="$enableval",debug="")
647 if test "$debug" = "" -o "$debug" = "no"; then
648     debug="none"
649 elif test "$debug" = "yes"; then
650     debug="all"
653 if test "$debug" = "all" ; then
654     debug="messages stack modules symbols"
655     for d in $all_debug_types; do
656         export aros_${d}_debug="1"
657     done
658 else
659     for d in $all_debug_types; do
660         export aros_${d}_debug="0"
661     done
664 if test "$debug" != "none"; then
665     debug=`echo $debug | sed s/,/\ /g`
666     for d in $debug; do
667         found="0"
668         for d2 in $all_debug_types; do
669             if test "$d2" = "$d"; then
670                 found="1"
671                 break
672             fi
673         done
674         if test "$found" = "0"; then
675             AC_MSG_ERROR([unrecognized debug type "$d". Available types are: all none $all_debug_types])
676         fi
677         export aros_${d}_debug="1"
678     done
679     aros_debug="yes"
681 AC_MSG_RESULT($debug)
683 if test "$aros_messages_debug" = "1"; then
684     aros_messages_debug="-DADEBUG=1 -DMDEBUG=1"
685 else
686     aros_messages_debug=""
688 if test "$aros_symbols_debug" = "1"; then
689     aros_symbols_debug="-g"
690 else
691     aros_symbols_debug=""
694 # These are the flags to pass when compiling debugged programs
695 aros_debug_cflags="$aros_symbols_debug $aros_messages_debug"
696 aros_debug_aflags=""
697 aros_debug_ldflags="$aros_symbols_debug"
699 #-----------------------------------------------------------------------------
700 #   Checking for distcc and ccache.
702 #   Always apply the transforms in this particular order. Basically you should
703 #   always run 'ccache distcc compiler' in that order for the best performance.
705 AC_MSG_CHECKING([whether to enable distcc])
706 AC_ARG_ENABLE(distcc,AC_HELP_STRING([--enable-distcc],[Use distcc as a front end to the compiler (default=no).]),distcc="$enableval",distcc="no")
707 if test "$distcc" != "" -a "$distcc" != "no"; then
708     # AC_CHECK_PROG will print out the result in this case
709     AC_PATH_PROG(DISTCC,[distcc],distcc,)
710 else
711     AC_MSG_RESULT(no)
714 AC_MSG_CHECKING([whether to enable ccache])
715 AC_ARG_ENABLE(ccache,AC_HELP_STRING([--enable-ccache],[Use ccache as a front end to the compiler (default=no).]),ccache="$enableval",ccache="no")
716 if test "$ccache" != "" -a "$ccache" != "no"; then
717     # AC_CHECK_PROG will print out the result in this case
718     AC_CHECK_PROG(CCACHE,[ccache],ccache,)
719 else
720     AC_MSG_RESULT(no)
723 #-----------------------------------------------------------------------------
724 AC_MSG_CHECKING([what specific host gcc version to use])
725 AC_ARG_WITH(kernel-gcc-version,AC_HELP_STRING([--with-kernel-gcc-version=VERSION],[Use gcc-VERSION for building bootstrap]),kernel_tool_version="$withval",kernel_tool_version="")
726 AC_MSG_RESULT($kernel_tool_version)
728 #-----------------------------------------------------------------------------
729 AC_MSG_CHECKING([what optimization flags to use])
730 AC_ARG_WITH(optimization,AC_HELP_STRING([--with-optimization=FLAGS],[Use optimization flags FLAGS (default=-O2).]),optimization="$withval",optimization="unknown")
731 if test "$optimization" = "unknown"; then
732     dnl default is -O2 for normal builds, -O0 for debug builds
733     if test "$debug" != "none"; then
734         optimization="-O0"
735     else
736         optimization="-O2"
737     fi
739 aros_optimization_cflags="$optimization"
740 AC_MSG_RESULT($optimization)
742 #-----------------------------------------------------------------------------
743 AC_MSG_CHECKING([what paranoia flags to use])
744 AC_ARG_WITH(paranoia,AC_HELP_STRING([--with-paranoia=FLAGS],[CC flags to enable paranoia]),[paranoia_flags="$withval"],[paranoia_flags="default"])
745 if test "$paranoia_flags" = "default"; then
746         paranoia_flags=""
747 else if test "$paranoia_flags" = "yes"; then
748         paranoia_flags="-Wall -Werror"
749 fi fi
750 AC_MSG_RESULT($paranoia_flags)
751 aros_config_cflags="$aros_config_cflags $paranoia_flags"
753 #-----------------------------------------------------------------------------
754 AC_MSG_CHECKING([what target variant to enable])
755 AC_ARG_ENABLE(target_variant,AC_HELP_STRING([--enable-target-variant=NAME],[Enable a specific target variant(default=none)]),target_variant=$enableval,target_variant="")
756 if test "$target_variant" = ""; then
757     aros_target_variant=""
758     aros_target_suffix=""
759     enableval="none"
760 else
761     aros_target_variant="$target_variant"
762     aros_target_suffix="-$target_variant"
764 AC_MSG_RESULT($enableval)
766 #-----------------------------------------------------------------------------
767 # Target-specific defaults. You can override then on a per-target basis.
769 # Bootloader name. Currently used by PC target.
770 target_bootloader="none"
772 #-----------------------------------------------------------------------------
773 # Additional options for some specific targets
775 case "$aros_target_variant" in
776 ios)
777     AC_MSG_CHECKING([XCode path])
778     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")
779     AC_MSG_RESULT($aros_xcode_path)
781     AC_MSG_CHECKING([what iOS SDK version to use])
782     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")
783     AC_MSG_RESULT($aros_sdk_version)
785     ;;
787 "android")
788     AC_MSG_CHECKING([Android SDK path])
789     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)
790     AC_MSG_RESULT($aros_android_sdk)
792     AC_MSG_CHECKING([Android NDK path])
793     AC_ARG_WITH(ndk,AC_HELP_STRING([--with-ndk=PATH],[Specify Android NDK path (default=none).]),aros_android_ndk="$withval",aros_android_ndk="none")
794     AC_MSG_RESULT($aros_android_ndk)
796     AC_MSG_CHECKING([what Android SDK version to use])
797     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")
798     AC_MSG_RESULT($aros_sdk_version)
800     aros_android_level=android-$aros_sdk_version
801     if test ! -d $aros_android_sdk/platforms/$aros_android_level; then
802         echo "Platform $aros_android_level is not installed in your SDK"
803         echo "Use --with-sdk-version=<API level number> to select another platform version"
804         echo "You can check what plaform versions are installed in your SDK"
805         echo "by examining contents of $aros_android_sdk/platforms directory"
806         AC_MSG_ERROR([Android platform $aros_android_level is not installed])
807     fi
809     export PATH="$aros_android_sdk/tools:$PATH"
810     AC_PATH_PROG(android_tool, $android_tool)
811     AROS_REQUIRED(android,$android_tool)
813     if test "$aros_android_ndk" != "none"; then
814         AC_MSG_CHECKING([what Android NDK version to use])
815         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")
816         AC_MSG_RESULT($aros_ndk_version)
817     fi
819     AC_PATH_PROG(ant, ant)
820     if test "$ant" = ""; then
821         AC_MSG_WARN([Apache Ant is missing, Java bootstrap can't be built automatically])
822     fi
824     AC_MSG_CHECKING([Build debug or release apk])
825     AC_ARG_WITH(apk-version,AC_HELP_STRING([--with-apk-version=(release|debug)],[Which version of AROSBootstrap.apk to compile. Release version needs key for signing, debug version will only run in emulator. (default=release)]),aros_android_antapk=$withval,aros_android_antapk=release)
826     if test $aros_android_antapk != release -a $aros_android_antapk != debug; then
827         AC_MSG_ERROR([apk-version has to be release or debug])
828     fi
829     AC_MSG_RESULT($aros_android_antapk)
831     dnl MSYS bash can't run .bat files directly, then need to be started via cmd.exe
832     if test "$host_os" = "mingw32"; then
833         android_tool="cmd //c $android_tool"
834     fi
836     need_dlopen="no"
838     ;;
839 esac
841 #-----------------------------------------------------------------------------
842 # External toolchains
843 kernel_tool_prefix="none"
844 aros_tool_prefix="none"
845 elf_tool_prefix="${target_cpu}-elf-"
847 # This is the target configuration switch.
848 case "$target_os" in
849     linux*)
850         aros_target_arch="linux"
851         aros_target_family="unix"
852         case "$target_cpu" in
853             *m68k*)
854                 aros_target_cpu="m68k"
855                 aros_object_format="m68kelf"
856                 aros_flavour="emulcompat"
857                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D__mc68000 -D__linux__"
858                 aros_shared_ldflags="-Wl,-T,\$(TOP)/config/linux/m68k/script.so"
859                 aros_kernel_ldflags="-Wl,-rpath,./lib,-T,\$(TOP)/config/linux/m68k/script.normal"
860                 gcc_target_cpu="mc68000"
861                 ;;
862             *i?86*)
863                 aros_target_cpu="i386"
864                 aros_object_format="elf_i386"
865                 aros_flavour="emulation"
866                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__linux__"
867                 aros_kernel_ldflags="-Wl,-melf_i386"
868                 aros_default_wbdepth=8
869                 gcc_target_cpu="i386"
870                 pci_hidd_target="hidd-pci-linux"
871                 android_tool_dir_prefix="x86"
872                 android_tool_prefix="i686-android-linux"
873                 android_ndk_arch="x86"
874                 ;;
875             *x86_64*)
876                 aros_target_cpu="x86_64"
877                 aros_object_format="elf_x86_64"
878                 aros_flavour="emulation"
879                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64 -D__linux__"
880                 aros_config_cflags="$aros_config_cflags -mno-red-zone -fno-omit-frame-pointer"
881                 aros_default_wbdepth=8
882                 pci_hidd_target="hidd-pci-linux"
883                 ;;
884             *powerpc*)
885                 aros_target_cpu="ppc"
886                 aros_object_format="elf32ppc"
887                 aros_flavour="emulation"
888                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc -D__linux__"
889                 aros_default_wbdepth=8
890                 gcc_target_cpu="ppc"
891                 ;;
892 # TODO
893 # Same as powerpc, but I need this for the nightly build to work again.
894 # Actually, the nightly should be made working with powerpc target.
895 # That just was too much work for the moment, another week or two.
896             *ppc*)
897                 aros_target_cpu="ppc"
898                 aros_object_format="elf32ppc"
899                 aros_flavour="emulation"
900                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc -D__linux__"
901                 aros_default_wbdepth=8
902                 gcc_target_cpu="ppc"
903                 ;;
904             *armhf*)
905                 aros_target_cpu="arm"
906                 target_cpu="arm"
907                 aros_object_format="armelf_aros"
908                 aros_flavour="emulation"
909                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm -D__linux__"
910                 gcc_target_cpu="arm"
911                 aros_config_cflags="$aros_config_cflags -fno-strict-aliasing -fno-omit-frame-pointer"
912                 aros_config_aflags="$aros_config_aflags -fno-strict-aliasing"
913                 aros_arch_libs="-laeabi"
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_aros"
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                     dnl In Android NDK toolchains are placed in own directories,
955                     dnl but tool names are not suffixed with version 
956                     export PATH="$aros_android_ndk/toolchains/$android_tool_dir_prefix-$kernel_tool_version/prebuilt/$android_build_os/bin:$PATH"
957                     kernel_tool_version=""
958                     aros_android_ndk="$aros_android_ndk/platforms/android-$aros_ndk_version/arch-$android_ndk_arch"
959                     aros_kernel_cflags="--sysroot $aros_android_ndk -mandroid"
960                     aros_kernel_ldflags="--sysroot $aros_android_ndk -mandroid"
961                     CFLAGS="$CFLAGS --sysroot $aros_android_ndk -mandroid"
962                     aros_kernel_includes="-isystem $aros_android_ndk/usr/include"
963                 fi
964                 need_x11=no
965                 unixgfx_hidd_target=kernel-hidd-androidgfx
966                 # Disable implicit PIC mode
967                 aros_target_cflags="$aros_target_cflags -fno-pic"
968                 kernel_tool_prefix="$android_tool_prefix-"
969             ;;
970         esac
971     ;;
973     pc)
974         aros_target_arch="pc"
975         aros_shared_default="no"
976         target_bootloader="grub2"
977         case "$target_cpu" in
978             *i?86*)
979                 aros_target_cpu="i386"
981                 dnl If somebody hasn't already set the target object
982                 dnl format, then use this value. Mostly to support
983                 dnl FreeBSD cross-compilation.
984                 dnl TODO: Remove when we always use our compiler.
986                 if test "$aros_object_format" = "" ; then
987                     aros_object_format="elf_i386"
988                 fi
989                 aros_flavour="standalone"
990                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
991                 aros_kernel_ldflags="-Wl,-melf_i386"
992                 aros_default_wbwidth=640
993                 aros_default_wbheight=480
994                 gcc_target_cpu="i386"
995                 ;;
996             *x86_64*)
997                 aros_target_cpu="x86_64"
998                 aros_serial_debug=1
999                 if test "$aros_object_format" = "" ; then
1000                     aros_object_format="elf_x86_64"
1001                 fi
1002                 aros_flavour="standalone"
1003                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
1004                 aros_config_cflags="$aros_config_cflags -fno-asynchronous-unwind-tables -mno-red-zone -fno-omit-frame-pointer"
1005                 aros_kernel_ldflags=""
1006                 aros_default_wbwidth=640
1007                 aros_default_wbheight=480
1008                 ;;
1009             *)
1010                 AC_MSG_ERROR("Unknown native CPU -- $target_cpu")
1011                 ;;
1012         esac
1013         ;;
1015     prep)
1016         aros_target_arch="prep"
1017         aros_shared_default="no"
1018         aros_target_cpu="ppc"
1019         aros_object_format="elf32ppc"
1020         aros_flavour="ppcnative"
1021         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1022         aros_kernel_ldflags=""
1023         aros_default_wbwidth=640
1024         aros_default_wbheight=480
1025         gcc_target_cpu="ppc"
1026         ;;
1028     freebsd*)
1029         aros_target_arch="freebsd"
1030         aros_target_family="unix"
1031         aros_target_cpu="i386"
1032         aros_flavour="emulation"
1033         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1034         gcc_target_cpu="i386"
1036         aros_target_strip_flags="-x"
1037         ;;
1039     darwin*)
1040         aros_target_arch="darwin"
1041         aros_target_family="unix"
1042         aros_flavour="emulation"
1043         case "$target_cpu" in
1044             *i?86*)
1045                 aros_ios_platform="iPhoneSimulator"
1046                 aros_target_cpu="i386"
1047                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1048                 aros_kernel_ldflags=""
1049                 aros_macosx_version="10.4"
1050                 aros_default_wbdepth=8
1051                 gcc_target_cpu="i386"
1052                 aros_object_format="elf_i386"
1053                 aros_kernel_ar_flags="-cr"
1054                 aros_target_strip_flags="-x"
1055                 kernel_tool_flags="-m32"
1056                 ;;
1057             *x86_64*)
1058                 aros_target_cpu="x86_64"
1059                 aros_object_format="elf_x86_64"
1060                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
1061                 aros_macosx_version="10.6"
1062                 aros_config_cflags="$aros_config_cflags -fno-omit-frame-pointer"
1063                 aros_kernel_cflags="-m64"
1064                 aros_kernel_ldflags="-m64"
1065                 aros_target_cflags="-mcmodel=large"
1066                 aros_default_wbdepth=8
1067                 aros_kernel_ar="ar"
1068                 aros_kernel_ar_flags="-cr"
1069                 aros_kernel_ld="ld"
1070                 aros_kernel_as="as"
1071                 aros_kernel_ranlib="ranlib"
1072                 aros_kernel_nm="nm"
1073                 aros_kernel_strip="strip"
1074                 kernel_tool_prefix="i686-apple-darwin10-"
1075                 ;;
1076             *ppc*)
1077                 aros_target_cpu="ppc"
1078                 aros_object_format="elf32ppc"
1079                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1080                 aros_kernel_ldflags=""
1081                 aros_macosx_version="10.0"
1082                 aros_default_wbdepth=8
1083                 gcc_target_cpu="ppc"
1084                 aros_kernel_ar="ar"
1085                 aros_kernel_ar_flags="-cr"
1086                 aros_kernel_ld="ld -arch ppc"
1087                 aros_kernel_as="as -arch ppc"
1088                 aros_kernel_ranlib="ranlib -arch ppc"
1089                 aros_kernel_nm="nm -arch ppc"
1090                 aros_kernel_strip="strip -arch ppc"
1091                 kernel_tool_prefix="powerpc-apple-darwin10-"
1092                 ;;
1093             *arm*)
1094                 aros_ios_platform="iPhoneOS"
1095                 aros_target_cpu="arm"
1096                 aros_object_format="armelf_aros"
1097                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
1098                 aros_arch_libs="-laeabi"
1099                 aros_default_wbdepth=8
1100                 gcc_target_cpu="arm"
1101                 aros_kernel_ar="ar"
1102                 aros_kernel_ar_flags="-cr"
1103                 aros_kernel_ld="ld -arch arm"
1104                 aros_kernel_ranlib="ranlib -arch arm"
1105                 kernel_tool_prefix="arm-apple-darwin10-" 
1106                 export PATH="$aros_xcode_path/Platforms/$aros_ios_platform.platform/Developer/usr/bin:$PATH"
1107                 ;;
1108             *)
1109                 AC_MSG_ERROR("Unsupported target CPU for darwin hosted flavour -- $target_cpu")
1110                 ;;
1111         esac
1112         case "$aros_target_variant" in
1113             ios)
1114                 aros_ios_version="3.0"
1115                 aros_default_wbwidth=320
1116                 aros_default_wbheight=480
1117                 aros_ios_sdk="$aros_xcode_path/Platforms/$aros_ios_platform.platform/Developer/SDKs/$aros_ios_platform$aros_sdk_version.sdk"
1118                 kernel_tool_flags="$target_tool_flags -isysroot $aros_ios_sdk"
1119                 aros_kernel_includes="-isystem $aros_ios_sdk/usr/include"
1120                 need_x11=no
1121                 # This is here because it may depend on iOS or SDK version
1122                 aros_kernel_cflags="$aros_kernel_cflags -miphoneos-version-min=$aros_ios_version"
1123                 aros_kernel_ldflags="$aros_kernel_ldflags -miphoneos-version-min=$aros_ios_version"
1124                 aros_kernel_objcflags="-fobjc-abi-version=2 -fobjc-legacy-dispatch"
1125             ;;
1126             *)
1127                 aros_kernel_cflags="$aros_kernel_cflags -mmacosx-version-min=$aros_macosx_version"
1128                 aros_kernel_ldflags="$aros_kernel_ldflags -mmacosx-version-min=$aros_macosx_version"
1129             ;;
1130         esac
1131         ;;
1133     dragonfly*)
1134         aros_target_arch="dragonfly"
1135         aros_target_family="unix"
1136         aros_flavour="emulation"
1137         case "$target_cpu" in
1138             *i?86*)
1139                 aros_target_cpu="i386"
1140                 aros_object_format="elf_i386"
1141                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__DragonFly__"
1142                 ;;
1143             *x86_64*)
1144                 aros_config_cflags="$aros_config_cflags -fno-omit-frame-pointer"
1145                 aros_target_cpu="x86_64"
1146                 aros_object_format="elf_x86_64"
1147                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64 -D__DragonFly__"
1148                 ;;
1149             *)
1150                 AC_MSG_ERROR("Unknown CPU for DragonFly -- $target_cpu")
1151                 ;;
1152         esac
1153         ;;
1155     netbsd*)
1156         aros_target_arch="netbsd"
1157         aros_target_family="unix"
1158         case "$target_cpu" in
1159             *m68k*)
1160                 aros_target_cpu="m68k"
1161                 aros_object_format="m68kelf"
1162                 aros_flavour="emulcompat"
1163                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D__mc68000 -D__NetBSD__"
1164                 gcc_target_cpu="mc68000"
1165                 ;;
1166             *i?86*)
1167                 aros_target_cpu="i386"
1168                 aros_object_format="elf_i386"
1169                 aros_flavour="emulation"
1170                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__NetBSD__"
1171                 aros_default_wbdepth=8
1172                 gcc_target_cpu="i386"
1173                 ;;
1174             *)
1175                 AC_MSG_ERROR("Unknown CPU for NetBSD -- $target_cpu")
1176                 ;;
1177         esac
1178         aros_target_genmap="-Wl,-M -Xlinker >"
1179         aros_flavour="emulation"
1180         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1181         ;;   
1183     openbsd*)
1184         aros_target_arch="openbsd"
1185         aros_target_family="unix"
1186         case "$target_cpu" in
1187             *i?86*)
1188                 aros_target_cpu="i386"
1189                 aros_object_format="elf_i386"
1190                 aros_flavour="emulation"
1191                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__OpenBSD__"
1192                 gcc_target_cpu="i386"
1193                 ;;
1194             *)
1195                 AC_MSG_ERROR("Unknown CPU for OpenBSD -- $target_cpu")
1196                 ;;
1197         esac
1198         aros_target_genmap="-Wl,-M -Xlinker >"
1199         aros_target_nm_flags="-u"
1200         aros_flavour="emulation"
1201         ;;
1203     solaris*)
1204         aros_target_arch="solaris"
1205         aros_target_family="unix"
1206         case "$target_cpu" in
1207            *i?86*)
1208                aros_target_cpu="i386"
1209                aros_object_format="elf_i386"
1210                aros_flavour="emulation"
1211                aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__Solaris__"
1212                aros_default_wbdepth=8
1213                gcc_target_cpu="i386"
1214                ;;
1215             *sparc*)
1216                 aros_target_cpu="sparc"
1217                 aros_object_format="elf_sparc"
1218                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dsparc -D__Solaris__"
1219                 gcc_target_cpu="sparc"
1220                 ;;
1221             *)
1222                 AC_MSG_ERROR("Unknown CPU for Solaris -- $target_cpu")
1223                 ;;
1224         esac
1225         aros_config_cflags="$aros_config_cflags -D$aros_target_cpu"
1226         aros_flavour="emulation"
1227         ;;
1229     morphos*)
1230         aros_target_arch="morphos"
1231         aros_shared_default="no"
1232         aros_target_cpu="ppc"
1233         aros_object_format="elf_ppc"
1234         aros_flavour="nativecompat"
1235         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1236         gcc_target_cpu="ppc"
1237         ;;
1239     sam440)
1240         aros_target_arch="sam440"
1241         aros_shared_default="no"
1242         aros_target_cpu="ppc"
1243         aros_object_format="elf32ppc"
1244         aros_flavour="ppcnative"
1245         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1246         aros_kernel_ldflags=""
1247         aros_default_wbwidth=1024
1248         aros_default_wbheight=768
1249         aros_default_wbdepth=24
1250         aros_config_cflags="$aros_config_cflags -mcpu=440fp -mno-toc -fno-asynchronous-unwind-tables"
1251         gcc_target_cpu="powerpc"
1252         ;;
1254     efika)
1255         aros_target_arch="efika"
1256         aros_shared_default="no"
1257         aros_target_cpu="arm"
1258         aros_object_format="armelf_aros"
1259         aros_flavour="standalone"
1260         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
1261         aros_kernel_ldflags=""
1262         aros_default_wbwidth=1024
1263         aros_default_wbheight=600
1264         aros_arch_libs="-laeabi"
1265         gcc_default_cpu="armv7-a"
1266         gcc_default_fpu="vfpv3"
1267         aros_config_cflags="$aros_config_cflags -mtune=cortex-a8 -fno-strict-aliasing -fno-asynchronous-unwind-tables"
1268         aros_config_aflags="$aros_config_aflags -mtune=cortex-a8 -fno-strict-aliasing -fno-asynchronous-unwind-tables"
1269         aros_optimization_cflags="$aros_optimization_cflags -Os"
1270         case "$target_cpu" in
1271             *armhf*)
1272                 gcc_default_float_abi="hard"
1273                 target_cpu=arm
1274                 aros_target_cpu=arm
1275                 ;;
1276             *arm*)
1277                 gcc_default_float_abi="softfp"
1278                 ;;
1279             *)
1280                 AC_MSG_ERROR("Unknown CPU for EfikaMX $target_cpu")
1281                 ;;
1282         esac
1283         ;;
1284         
1285     chrp)
1286     aros_target_arch="chrp"
1287     aros_shared_default="no"
1288     aros_target_cpu="ppc"
1289     aros_object_format="elf32ppc"
1290     aros_flavour="ppcnative"
1291     aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1292     aros_kernel_ldflags=""
1293     aros_default_wbwidth=640
1294     aros_default_wbheight=480
1295     aros_config_cflags="$aros_config_cflags -mno-toc -fno-asynchronous-unwind-tables"    
1296     gcc_target_cpu="powerpc"
1297         case "$aros_target_variant" in
1298             efika)
1299             aros_config_cflags="$aros_config_cflags -DBIG_ENDIAN_OHCI=1 -mcpu=603e"
1300             ;;
1301         esac
1302     ;;
1304     r*pi)
1305         aros_flavour="standalone"
1306         aros_target_arch="raspi"
1307         aros_target_cpu="arm"
1308         aros_object_format="armelf_aros"
1309         aros_shared_default="no"
1310         aros_arch_libs="-laeabi"
1312         gcc_default_cpu="armv6"
1313         gcc_default_cpu_tune="arm1176jzf-s"
1314         case "$target_cpu" in
1315             *armhf*)
1316                 gcc_default_float_abi="hard"
1317                 ;;
1318             *arm*)
1319                 gcc_default_float_abi="softfp"
1320                 ;;
1321             *)
1322                 AC_MSG_ERROR("Unknown CPU for RasPi $target_cpu")
1323                 ;;
1324         esac
1326         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
1327         aros_config_cflags="$aros_config_cflags -marm -Wno-error -fno-asynchronous-unwind-tables -fno-exceptions"
1328         aros_config_aflags="$aros_config_aflags -marm -Wno-error -fno-asynchronous-unwind-tables -fno-exceptions"
1329         aros_kernel_cflags="$aros_kernel_cflags -marm -Wno-error -fno-asynchronous-unwind-tables -fno-exceptions"
1330         aros_target_cflags="$aros_kernel_cflags -marm -Wno-error -fno-asynchronous-unwind-tables -fno-exceptions"
1331         ;;
1333     sun4i)
1334         aros_flavour="standalone"
1335         aros_target_arch="sun4i"
1336         aros_target_cpu="arm"
1337         aros_object_format="armelf_aros"
1338         aros_shared_default="no"
1339         aros_arch_libs="-laeabi"
1341                 gcc_default_cpu="armv7-a"
1342         gcc_default_fpu="neon"
1343         gcc_default_cpu_tune="cortex-a8"
1344                 gcc_default_float_abi="hard"
1346         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
1347         aros_optimization_cflags=""
1348         aros_config_cflags="$aros_config_cflags -mcpu=cortex-a8 -mtune=cortex-a8 -fno-strict-aliasing"
1349         aros_config_aflags="$aros_config_aflags -mcpu=cortex-a8 -mtune=cortex-a8 -fno-strict-aliasing"
1350         ;;
1352     amiga*)
1353         aros_target_arch="amiga"
1354         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D_AMIGA -DAMIGA"
1355         aros_shared_default="no"
1357         case "$target_cpu" in
1358             *m68k*)
1359                 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")
1360                 aros_enable_mmu=no
1361                 aros_target_cpu="m68k"
1362                 aros_object_format="m68kelf"
1363                 aros_flavour="standcompat"
1364                 gcc_target_cpu="m68000"
1365                 aros_config_cflags="$aros_config_cflags -fno-strict-aliasing -ffreestanding -fomit-frame-pointer -fbuiltin -Wno-volatile-register-var -DNOLIBINLINE"
1366                 aros_optimization_cflags="$aros_optimization_cflags -Os"
1367                 aros_config_aflags="$aros_config_aflags"
1368                 aros_target_strip_flags="-R.comment --strip-debug"
1369                 aros_default_wbwidth=640
1370                 aros_default_wbheight=256
1371                 aros_default_wbdepth=2
1372                 ;;
1373             *ppc*)
1374                 aros_cpu="ppc"
1375                 aros_flavour="native"
1376                 gcc_target_cpu="ppc"
1377                 ;;
1378             *)
1379                 AC_MSG_ERROR("Unknown CPU for Amiga $target_cpu")
1380                 ;;
1381         esac
1382         ;;
1384     mingw*)
1385         aros_target_arch="mingw32"
1386         aros_shared_default="no"
1387         aros_flavour="emulation"
1388         aros_shared_cflags=""
1389         need_crosstools="yes"
1390         need_dlopen="no"
1391         rescomp="windres"
1392         case "$target_cpu" in
1393             *i?86*)
1394                 aros_target_cpu="i386"
1395                 aros_object_format="elf_i386"
1396                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1397                 aros_default_wbdepth=8
1398                 gcc_target_cpu="i386"
1400                 kernel_tool_prefix="i386-mingw32-"
1401                 ;;
1402             *x86_64*)
1403                 aros_target_cpu="x86_64"
1404                 aros_object_format="elf_x86_64"
1405                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
1406                 aros_config_cflags="$aros_config_cflags -fno-omit-frame-pointer"
1407                 aros_default_wbdepth=8
1408                 kernel_tool_prefix="x86_64-w64-mingw32-"
1409                 ;;
1410             *arm*)
1411                 aros_target_cpu="arm"
1412                 aros_object_format="armelf_aros"
1413                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
1414                 aros_arch_libs="-laeabi"
1415                 aros_default_wbdepth=8
1416                 gcc_target_cpu="arm"
1417                 gcc_default_float_abi="soft"
1418                 kernel_tool_prefix="arm-mingw32ce-"
1419                 aros_default_wbwidth=160
1420                 aros_default_wbheight=160
1421                 ;;
1422             *)
1423                 AC_MSG_ERROR("Unknown CPU for Mingw32 -- $target_cpu")
1424                 ;;
1425         esac
1426         if test $host_os = "cygwin"; then
1427                 aros_kernel_cflags="-mno-cygwin"
1428         fi
1429     ;;
1430     pp*)
1431         aros_target_arch="pp"
1432         aros_shared_default="no"
1433         case "$target_cpu" in
1434             *m68k*)
1435                 aros_target_cpu="m68k"
1436                 aros_object_format="m68kelf"
1437                 aros_flavour="palmnative"
1438                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
1439                 aros_default_wbwidth=160
1440                 aros_default_wbheight=160
1441                 aros_default_wbdepth=1
1442                 aros_target_ar_flags="cru"
1443                 aros_compiler_libs="-lgcc1"
1444                 aros_shared_default=no
1445                 aros_shared_cflags="-fpic"
1446                 aros_shared_aflags=""
1447                 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
1448                 aros_kernel_ldflags="-Wl,-rpath,./lib"
1449                 aros_debug_cflags="$aros_symbols_debug  $aros_messages_debug"
1450                 aros_debug_aflags=""
1451                 aros_debug_ldflags="$aros_symbols_debug"
1452                 aros_mungwall_debug="0"
1453                 aros_modules_debug="0"
1454                 gcc_target_cpu="mc68000"
1455                 ignore_undefined_symbols="-ius"
1456                 ;;
1457            *)
1458                 AC_MSG_ERROR("Unknown CPU for PalmPilot -- $target_cpu")
1459                 ;;
1460         esac
1461         ;;
1463     mac*)
1464         aros_target_arch="mac"
1465         aros_shared_default="no"
1466         case "$target_cpu" in
1467             *m68k*)
1468                 aros_target_cpu="m68k"
1469                 aros_object_format="m68kelf"
1470                 aros_flavour="mac68knative"
1471                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
1472                 aros_default_wbwidth=512
1473                 aros_default_wbheight=384
1474                 aros_default_wbdepth=8
1475                 aros_target_ar_flags="cru"
1476                 aros_compiler_libs="-lgcc1"
1477                 aros_shared_default=no
1478                 aros_shared_cflags="-fpic"
1479                 aros_shared_aflags=""
1480                 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
1481                 aros_kernel_ldflags="-Wl,-rpath,./lib"
1482                 aros_debug_cflags="$aros_symbols_debug $aros_messages_debug"
1483                 aros_debug_aflags=""
1484                 aros_debug_ldflags="$aros_symbols_debug"
1485                 aros_mungwall_debug="0"
1486                 aros_modules_debug="0"
1487                 gcc_target_cpu="mc68000"
1488                 ignore_undefined_symbols="-ius"
1489                 ;;
1490            *)
1491                 AC_MSG_ERROR("Unknown CPU for Mac68k -- $target_cpu")
1492                 ;;
1493         esac
1494         ;;
1496     *)
1497         AC_MSG_ERROR([Unsupported target architecture $target])
1498         ;;
1499 esac
1501 #-----------------------------------------------------------------------------
1502 crosstools_guess=yes
1504 AC_MSG_CHECKING([Kernel toolchain prefix])
1505 AC_ARG_WITH(kernel-toolchain-prefix,AC_HELP_STRING([--with-kernel-toolchain-prefix=...],[Specify crosscompile toolchain prefix for kernel objects]),[kernel_tool_prefix="$withval"])
1506 AC_MSG_RESULT($kernel_tool_prefix)
1508 AC_MSG_CHECKING([ELF toolchain prefix])
1509 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"
1510                                                  crosstools_guess=no])
1511 AC_MSG_RESULT($elf_tool_prefix)
1513 AC_MSG_CHECKING([AROS toolchain prefix])
1514 AC_ARG_WITH(aros-toolchain,AC_HELP_STRING([--with-aros-toolchain=PREFIX],[Specify prebuilt AROS toolchain. Use yes for default name]),[aros_tool_prefix="$withval"
1515                 crosstools_guess=no])
1516 if test "$aros_tool_prefix" = "yes" ; then
1517     aros_tool_prefix=$aros_target_cpu-aros-
1519 AC_MSG_RESULT($aros_tool_prefix)
1521 #-----------------------------------------------------------------------------
1522 #   Checking if we should build crosstools..
1523 AC_MSG_CHECKING([whether to build crosstools])
1524 AC_ARG_ENABLE(crosstools,AC_HELP_STRING([--disable-crosstools],[Do not build cross-compiler toolchain]),crosstools="$enableval",crosstools="$crosstools_guess")
1525 AC_MSG_RESULT($crosstools)
1527 if test "${crosstools}" = "yes"; then
1528     if test "${crosstools_guess}" = "no"; then
1529         AC_MSG_ERROR([Cannot build external toolchain if an external ELF or AROS toolchain is specified])
1530     fi
1533 AC_MSG_CHECKING([where to install the crosstools binaries])
1534 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])
1535 if test "x$aros_toolchain_install" = "x"; then
1536     AROS_CROSSTOOLSDIR="$AROS_BUILDDIR_UNIX/bin/$aros_host_arch-$aros_host_cpu/tools/crosstools"
1537 else
1538     AROS_CROSSTOOLSDIR="$aros_toolchain_install"
1539     PATH="$AROS_CROSSTOOLSDIR:$PATH"
1541 AC_MSG_RESULT($AROS_CROSSTOOLSDIR)
1543 # Helper to identify gcc version
1544 AC_DEFUN([CROSS_GCC_VERSION], [
1545   target_gcc_version=""
1546   AC_CACHE_CHECK([gcc version],[ax_cv_gcc_version],[
1547     ax_cv_gcc_version="`$AROS_CROSSTOOLSDIR/${aros_tool_prefix}cpp -dumpversion`"
1548     AS_IF([test "x$ax_cv_gcc_version" = "x"],[
1549       ax_cv_gcc_version=""
1550     ])
1551   ])
1552   target_gcc_version=$ax_cv_gcc_version
1553   AC_SUBST([target_gcc_version])
1556 #-----------------------------------------------------------------------------
1557 AC_MSG_CHECKING([what specific target gcc version to use])
1558 AC_ARG_WITH(gcc-version,AC_HELP_STRING([--with-gcc-version=VERSION],[Use gcc-VERSION for building AROS]),use_gcc_version="$withval",use_gcc_version="")
1559 if test "$use_gcc_version" = ""; then
1560     if test "${crosstools}" = "no"; then
1561       if test "x$aros_toolchain_install" != "x"; then
1562           CROSS_GCC_VERSION
1563       fi
1564     fi
1565     if test "$use_gcc_version" = ""; then
1566         target_gcc_version="4.6.4"
1567     fi
1568 else
1569     target_gcc_version="$use_gcc_version"
1571 AC_MSG_RESULT($target_gcc_version)
1573 AC_MSG_CHECKING([whether to enable Objective-C suppport])
1574 AC_ARG_ENABLE(objc,AC_HELP_STRING([--enable-objc],[Enable Objectve-C support (default=yes)]),objc="$enableval",objc="yes")
1575 AC_MSG_RESULT($objc)
1576 if test "x$objc" = "xyes"; then
1577     objc_target="$objc"
1578 else
1579     objc_target="no-objc"
1582 AC_MSG_CHECKING([whether to enable Java suppport])
1583 AC_ARG_ENABLE(java,AC_HELP_STRING([--enable-java],[Enable Java support (default=no)]),java="$enableval",java="no")
1584 AC_MSG_RESULT($java)
1585 if test "x$java" != "xno"; then
1586     java_target="$java"
1587 else
1588     java_target="no-java"
1591 spec_obj_format="-m $aros_object_format"
1592 # Now process extra architecture-specific options.
1593 # Currently this is implemented only for ARM. We can specify which minimum CPU and FPU to use,\
1594 # as well as floating-point ABI.
1595 case "$aros_target_cpu" in
1596 *x86_64*)
1597     dnl x86_64 can build 32 or 64bit code
1598     spec_obj_format="%{!m32:-m elf_x86_64} %{m32:-m elf_i386}"
1599     ;;
1600 arm)
1601     dnl ARM defaults are: armv6 + vfp (unless overriden in per-target section above)
1602     if test "$gcc_default_cpu" = ""; then
1603         gcc_default_cpu="armv6"
1604     fi
1605     if test "$gcc_default_fpu" = ""; then
1606         gcc_default_fpu="vfp"
1607     fi
1608     if test "$gcc_default_float_abi" = ""; then
1609         gcc_default_float_abi="softfp"
1610     fi
1612     AC_MSG_CHECKING([Which minimum CPU to use])
1613     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)
1614     AC_MSG_RESULT($aros_gcc_cpu)
1616     AC_MSG_CHECKING([Which minimum FPU to use])
1617     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)
1618     AC_MSG_RESULT($aros_gcc_fpu)
1620     AC_MSG_CHECKING([Which floating point ABI to use])
1621     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)
1622     AC_MSG_RESULT($aros_gcc_float_abi)
1624     aros_isa_flags="-marm -mthumb-interwork -march=$aros_gcc_cpu -mfpu=$aros_gcc_fpu -mfloat-abi=$aros_gcc_float_abi"
1625     aros_config_cflags="$aros_config_cflags -fno-asynchronous-unwind-tables -fno-exceptions"
1626     aros_config_aflags="$aros_config_aflags -fno-asynchronous-unwind-tables -fno-exceptions"
1627     ;;
1628 i386)
1629     aros_isa_flags="-m32 -march=i486"
1630     aros_kernel_cflags="$aros_kernel_cflags $aros_isa_flags"
1631     aros_kernel_ldflags="$aros_kernel_ldflags -m32" 
1632     ;;
1633 esac
1635 # Some architectures may need custom ELF specs.
1636 if test -f $SRCDIR/config/${aros_object_format}-specs.in; then
1637     elf_specs_in=config/${aros_object_format}-specs.in
1638 else
1639     elf_specs_in=config/elf-specs.in
1642 # Some compilers (ppc-elf-gcc is known to) have CPU defines in specs
1643 # Since we override specs, we may need to put these defines there
1644 if test "$gcc_target_cpu" != ""; then
1645     gcc_target_cpu="-D__${gcc_target_cpu}__"
1648 AC_MSG_CHECKING([where to download sourcecode for external ports])
1649 AC_ARG_WITH(portssources,AC_HELP_STRING([--with-portssources=DIR],[Where to download sourcecode for external ports]),with_portssrcdir=$withval,with_portssrcdir="default")
1650 if test "$with_portssrcdir" = "default"; then
1651     AROS_PORTSSRCDIR="$AROS_BUILDDIR_UNIX/bin/Sources"
1652 else
1653     AROS_PORTSSRCDIR="$with_portssrcdir"
1655 AC_MSG_RESULT($AROS_PORTSSRCDIR)
1657 AC_MSG_CHECKING([which bootloader to use])
1658 AC_ARG_WITH(bootloader,AC_HELP_STRING([--with-bootloader=NAME],[Use a specific bootloader]),target_bootloader=$withval,target_bootloader=$target_bootloader)
1659 if test "$target_bootloader" = "none"; then
1660     aros_target_bootloader=""
1661 else
1662     aros_target_bootloader="$target_bootloader"
1664 AC_MSG_RESULT($target_bootloader)
1666 AC_MSG_CHECKING([which icon-set to use])
1667 AC_ARG_WITH(iconset,AC_HELP_STRING([--with-iconset=NAME],[Use a specific Icon-set (default=Gorilla).]),target_iconset=$withval,target_iconset="default")
1668 if test "$target_iconset" = "default"; then
1669     aros_target_iconset="Gorilla"
1670     target_iconset="default (Gorilla)"
1671 else
1672     aros_target_iconset="$target_iconset"
1674 AC_MSG_RESULT($target_iconset)
1676 AC_MSG_CHECKING([which GUI Theme to use])
1677 AC_ARG_WITH(theme,AC_HELP_STRING([--with-theme=NAME],[Use a specific GUI Theme]),target_guitheme=$withval,target_guitheme="default")
1678 if test "$target_guitheme" = "default"; then
1679     aros_target_guitheme="Ice"
1680 else
1681     aros_target_guitheme="$target_guitheme"
1683 AC_MSG_RESULT($aros_target_guitheme)
1685 # Find out if we are cross-compiling (i.e. if we can't use the host compiler
1686 # for target code)
1687 cross_compiling=no
1689 dnl The first case is simple. If we are compiling for another CPU, we are cross-compiling for sure
1690 if test "$aros_host_cpu" != "$aros_target_cpu" ; then
1691     cross_compiling=yes
1694 dnl x86-64 toolchains can also produce i386 binaries, given -m32 flag.
1695 dnl The flag itself is given in per-target section, because some targets require to pass it
1696 dnl in a different manner, otherwise some tests fail.
1697 dnl TODO: Justify this.
1698 if test "$aros_host_cpu" == "x86_64" ; then
1699     if test "$aros_target_cpu" == "i386" ; then
1700         cross_compiling=no
1701     fi
1704 if test "x-$aros_flavour" = "x-emulation" -o "x-$aros_flavour" = "x-emulcompat" ; then
1705     dnl For a hosted build we are cross-compiling if host OS differs from build OS.
1706     dnl TODO: This might get a little bit more tricky if we ever cross-compile ARM-Android-hosted
1707     dnl AROS on ARM Linux, or even vice versa (Linux-hosted ARM AROS building on ARM Android).
1708     dnl ARM ABIs of Linux and Android are not compatible (despite very close), so host_cc can't be
1709     dnl used to build bootstrap for target arch in either case.
1710     dnl For us Android is not a separate OS, but a variant of Linux, so both systems will be
1711     dnl identified as 'linux'. If this ever involves, we'll have to implement some additional check,
1712     dnl perhaps introducing aros_host_variant
1713     if test "$aros_host_arch" != "$aros_target_arch" ; then
1714         cross_compiling=yes
1715     fi
1716 else
1717     dnl For a native build we only care if our host_cc can produce static ELF files. If so, we can use
1718     dnl it as kernel_cc. If not, (e. g. we are on Windows or Darwin), we need a crosscompiler.
1719     if test "$host_cc_elf" = "no" ; then
1720         cross_compiling=yes
1721     fi
1724 if test "$cross_compiling" = "no" ; then
1725     kernel_tool_prefix=""
1726     if test "$host_cc_elf" = "yes" ; then
1727         elf_tool_prefix=""
1728     fi
1731 if test "$kernel_tool_version" != ""; then
1732     kernel_tool_version="-$kernel_tool_version"
1735 #######################################################################
1736 ## Compute what toolchains to use, and their paths                   ##
1737 #######################################################################
1739 # This takes, as input:
1740 #   crosstools             {yes,no}
1741 #   kernel_tool_version    {"",[version]}
1742 #   target_tool_version    {"",[version]}
1743 #   kernel_tool_prefix     {none,[some-arch-os-]}
1744 #   target_tool_prefix     ${aros_target_cpu}-aros-
1745 #   aros_tool_prefix       ${aros_target_cpu}-aros-
1747 # The output is
1748 #   aros_kernel_{cpp,cc,ar,ld,as,ranlib,nm,strip}
1749 #        Where the 'kernel' binaries are located
1750 #   orig_target_{cpp,cc,ar,ld,as,ranlib,nm,strip}
1751 #        Where the 'target' binaries are located
1752 #        (not the symlink farm - that is aros_target_*!)
1754 # The rules are:
1755 #   if crosstools then
1756 #      if kernel_tools_prefix = "no-kernel-prefix-"
1757 #          aros_kernel_* = crosstools cc paths
1758 #          aros_kernel_cc = elf cc wrapper around crosstools cc
1759 #      else
1760 #          VALIDATE(${kernel_tools_prefix}*)
1761 #          aros_kernel_* = ${kernel_tools_prefix}*
1762 #          if ${kernel_tools_prefix}cc is an AROS gcc
1763 #              aros_kernel_cc = ${kernel_tools_prefix}cc
1764 #          else
1765 #              aros_kernel_cc = elf cc wrapper around ${kernel_tools_prefix}cc
1766 #          fi
1767 #      fi
1769 #      orig_target_* = aros built crosstools
1770 #      orig_target_cc = elf cc wrapper around crosstools cc
1771 #   else
1772 #      VALIDATE(${kernel_tools_prefix}*)
1774 #      orig_target_* = aros_kernel_*
1775 #      if aros_kernel_cc is an AROS gcc
1776 #          orig_target_cc = aros_kernel_cc
1777 #      else
1778 #          orig_target_cc = aros cc wrapper around aros_kernel_cc
1779 #      fi
1780 #   fi
1782 target_tool_prefix="${aros_target_cpu}-aros-"
1784 AC_MSG_CHECKING([which kernel tools])
1785 AC_MSG_RESULT([$kernel_tool_prefix]);
1787 if test "$kernel_tool_prefix" = "none" ; then
1788     dnl ELF wrapper can be used only for native bootstrap
1789     if test "x-$aros_flavour" = "x-emulation" -o "x-$aros_flavour" = "x-emulcompat" ; then
1790         AC_MSG_ERROR([--with-kernel-toolchain-prefix= is required for this arch])
1791     fi
1792 else
1793     # Kernel tools required - find them
1794     # Note that 'normally', aros_kernel_* overrides will be
1795     # empty, unless specified in the per-arch sections above.
1796     if test "x$aros_kernel_cpp" = "x"; then
1797         aros_kernel_cpp=${kernel_tool_prefix}cpp
1798     fi
1799     AROS_TOOL_KERNEL(aros_kernel_cpp,cpp,$aros_kernel_cpp${kernel_tool_version})
1800     AROS_REQUIRED(cpp,$aros_kernel_cpp)
1801     if test "x$aros_kernel_cc" = "x"; then
1802         aros_kernel_cc=${kernel_tool_prefix}gcc
1803     fi
1804     AROS_TOOL_KERNEL(aros_kernel_cc,cc,$aros_kernel_cc${kernel_tool_version})
1805     AROS_REQUIRED(cc,$aros_kernel_cc)
1806     if test "x$aros_kernel_cxx" = "x"; then
1807         aros_kernel_cxx=${kernel_tool_prefix}g++
1808     fi
1809     AROS_TOOL_KERNEL(aros_kernel_cxx,cxx,$aros_kernel_cxx${kernel_tool_version})
1810     # If it's set, make sure it's really there
1811     if test "x$aros_kernel_cxx" != "x" ; then
1812         AROS_REQUIRED(cxx,$aros_kernel_cxx)
1813     fi
1814     AROS_TOOL_KERNEL(aros_kernel_ld,ld,$aros_kernel_ld)
1815     AROS_REQUIRED(ld,$aros_kernel_ld)
1816     AROS_TOOL_KERNEL(aros_kernel_as,as,$aros_kernel_as)
1817     AROS_REQUIRED(as,$aros_kernel_as)
1818     AROS_TOOL_KERNEL(aros_kernel_ar,ar,$aros_kernel_ar)
1819     AROS_REQUIRED(ar,$aros_kernel_ar)
1820     AROS_TOOL_KERNEL(aros_kernel_ranlib,ranlib,$aros_kernel_ranlib)
1821     AROS_REQUIRED(ranlib,$aros_kernel_ranlib)
1822     AROS_TOOL_KERNEL(aros_kernel_nm,nm,$aros_kernel_nm)
1823     AROS_REQUIRED(nm,$aros_kernel_nm)
1824     AROS_TOOL_KERNEL(aros_kernel_strip,strip,$aros_kernel_strip)
1825     AROS_REQUIRED(strip,$aros_kernel_strip)
1827     # Objcopy and objdump are not required for the kernel
1828     # toolchain on many architectures.
1829     # So we'll look for them, but not make them strictly required.
1830     AROS_TOOL_KERNEL(aros_kernel_objcopy,objcopy,$aros_kernel_objcopy)
1831     AROS_TOOL_KERNEL(aros_kernel_objdump,objdump,$aros_kernel_objdump)
1832     if test "x${crosstools}" != "xyes" ; then
1833         AROS_REQUIRED(objcopy,$aros_kernel_objcopy)
1834         AROS_REQUIRED(objdump,$aros_kernel_objdump)
1835     fi
1838 AC_MSG_CHECKING([which target tools to use])
1839 if test "$crosstools" = "yes"; then
1840     AC_MSG_RESULT([$target_tool_prefix])
1841     # We are building AROS crosstools
1842     tmp_tool_prefix="$AROS_CROSSTOOLSDIR/${target_tool_prefix}"
1843     orig_target_cc="${tmp_tool_prefix}gcc${target_tool_version}"
1844     orig_target_cxx="${tmp_tool_prefix}g++${target_tool_version}"
1845     orig_target_cpp="${tmp_tool_prefix}cpp"
1846     orig_target_ld="${tmp_tool_prefix}ld"
1847     orig_target_as="${tmp_tool_prefix}as"
1848     orig_target_ar="${tmp_tool_prefix}ar"
1849     orig_target_ranlib="${tmp_tool_prefix}ranlib"
1850     orig_target_nm="${tmp_tool_prefix}nm"
1851     orig_target_strip="${tmp_tool_prefix}strip"
1852     orig_target_objcopy="${tmp_tool_prefix}objcopy"
1853     orig_target_objdump="${tmp_tool_prefix}objdump"
1854 else
1855     # Determine whether AROS or ELF tools should be used
1856     if test "$aros_tool_prefix" = "none"; then
1857         aros_tool_prefix="${elf_tool_prefix}"
1858     fi
1860     AC_MSG_RESULT([$aros_tool_prefix])
1861     # We are *not* building AROS crosstools - use the AROS or ELF tools
1862     AROS_TOOL_TARGET(orig_target_cpp,cpp,${aros_tool_prefix}cpp${target_tool_version})
1863     AROS_REQUIRED(cpp,$orig_target_cpp)
1864     AROS_TOOL_TARGET(orig_target_cc,gcc,${aros_tool_prefix}gcc${target_tool_version})
1865     AROS_REQUIRED(cc,$orig_target_cc)
1866     AROS_TOOL_TARGET(orig_target_cxx,g++,${aros_tool_prefix}g++${target_tool_version})
1867     AROS_REQUIRED(cxx,$orig_target_cxx)
1868     AROS_TOOL_TARGET(orig_target_ld,gcc,${aros_tool_prefix}ld)
1869     AROS_REQUIRED(ld,$orig_target_ld)
1870     AROS_TOOL_TARGET(orig_target_as,as,${aros_tool_prefix}as)
1871     AROS_REQUIRED(as,$orig_target_as)
1872     AROS_TOOL_TARGET(orig_target_ar,ar,${aros_tool_prefix}ar)
1873     AROS_REQUIRED(ar,$orig_target_ar)
1874     AROS_TOOL_TARGET(orig_target_ranlib,ar,${aros_tool_prefix}ranlib)
1875     AROS_REQUIRED(ranlib,$orig_target_ranlib)
1876     AROS_TOOL_TARGET(orig_target_nm,nm,${aros_tool_prefix}nm)
1877     AROS_REQUIRED(nm,$orig_target_nm)
1878     AROS_TOOL_TARGET(orig_target_strip,strip,${aros_tool_prefix}strip)
1879     AROS_REQUIRED(strip,$orig_target_strip)
1880     AROS_TOOL_TARGET(orig_target_objcopy,objcopy,${aros_tool_prefix}objcopy)
1881     AROS_REQUIRED(objcopy,$orig_target_objcopy)
1882     AROS_TOOL_TARGET(orig_target_objdump,objdump,${aros_tool_prefix}objdump)
1883     AROS_REQUIRED(objdump,$orig_target_objdump)
1886 if test "$kernel_tool_prefix" = "none" ; then
1887     # No kernel tools specified
1888     # Assume target tools == kernel tools with ELF wrapper
1889     aros_kernel_cc=$orig_target_cc
1890     aros_kernel_cxx=$orig_target_cxx
1891     aros_kernel_cpp=$orig_target_cpp
1892     aros_kernel_ld=$orig_target_ld
1893     aros_kernel_as=$orig_target_as
1894     aros_kernel_ar=$orig_target_ar
1895     aros_kernel_ranlib=$orig_target_ranlib
1896     aros_kernel_nm=$orig_target_nm
1897     aros_kernel_strip=$orig_target_strip
1898     aros_kernel_objcopy=$orig_target_objcopy
1899     aros_kernel_objdump=$orig_target_objdump
1900     use_kernel_cc_wrapper=yes
1903 # At this point, all aros_kernel_* and aros_target_* 
1904 # tools should be set up correctly
1906 CC="$aros_kernel_cc $kernel_tool_flags"
1907 CPP="$aros_kernel_cpp"
1909 #-----------------------------------------------------------------------------
1911 # Disable pointer-signedness warnings if the compiler recognises the option
1913 AC_MSG_CHECKING([whether ${CC} accepts -Wno-pointer-sign])
1914 save_cflags="$CFLAGS"
1915 if test "$crosstools" != "yes" ; then
1916     CFLAGS="$CFLAGS -Wno-pointer-sign"
1917     AC_TRY_COMPILE(,, use_no_sign_warning="yes", use_no_sign_warning="no")
1918 else
1919     # we do know it is supported for the smallest version of gcc we are going to build
1920     # we assume it's also supported by later versions
1921     use_no_sign_warning=yes
1923 AC_MSG_RESULT($use_no_sign_warning)
1924 if test "x-$use_no_sign_warning" = "x-yes" ; then
1925     aros_config_cflags="$aros_config_cflags -Wno-pointer-sign"
1927 CFLAGS="$save_cflags"
1929 #-----------------------------------------------------------------------------
1931 # Find all the tools we need to compile. This could be cross-compiling
1932 # though! If that is the case we use the GNU form of the target and
1933 # simply add this to the front of the binary name. This is rather simple,
1934 # but it should work under most circumstances.
1936 # The default tools are to use the same as the host, but only if the
1937 # host and target CPU are the same. With GCC this is normally enough.
1940 aros_cc_pre=""
1941 aros_shared_ld="$aros_host_ld"
1943 aros_target_mkdep="$aros_host_mkdep"
1945 # The default tools executables to be linked to.
1946 if test "$rescomp" != ""; then
1947     AC_PATH_PROG(aros_kernel_rescomp,${kernel_tool_prefix}$rescomp)
1948     AROS_REQUIRED($rescomp,$aros_kernel_rescomp)
1951 # Set up the sources for the symlink farm
1952 if test "$crosstools" = "yes"; then
1953     crosstools_target=tools-crosstools
1956 aros_kernel_cc="$aros_kernel_cc $kernel_tool_flags"
1957 aros_kernel_ar="$aros_kernel_ar $aros_kernel_ar_flags"
1959 aros_hostcfg_dir="bin/${aros_host_arch}-${aros_host_cpu}/gen/config"
1960 aros_targetcfg_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/config"
1961 aros_inc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/AROS/Development/include/aros"
1962 aros_gendir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen"
1963 aros_geninc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/include/aros"
1964 aros_tools_dir="bin/${aros_host_arch}-${aros_host_cpu}/tools"
1965 aros_scripts_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/scripts"
1967 # aros_cc_pre is a variable that is added to the front of the compiler name
1968 # in the generated aros-gcc shell script. We need this to enable the cache
1969 # to work across cleaned builds. Also, support DISTCC using the correct
1970 # environment variable.
1973 if test "x${DISTCC}" != "x" ; then
1974     if test "x${CCACHE}" != "x" ; then
1975         aros_cc_pre="env CCACHE_PREFIX=${DISTCC} ${CCACHE} "
1976     else
1977         aros_cc_pre="${DISTCC} "
1978     fi
1979 else
1980     if test "x${CCACHE}" != "x" ; then
1981         aros_cc_pre="${CCACHE} "
1982     fi
1985 AC_SUBST(aros_target_nostdinc_cflags,-nostdinc)
1986 AC_SUBST(aros_target_nostartup_ldflags,-nostartfiles)
1987 AC_SUBST(aros_target_nix_ldflags,-nix)
1988 AC_SUBST(aros_target_detach_ldflags,-detach)
1989 AC_SUBST(aros_target_nostdlib_ldflags,-nostdlib)
1991 # Target tools
1992 if test "$crosstools" != "yes"; then
1993     prefix="${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-"
1994     if test "$GCC" = "yes"; then
1995         aros_target_cc_path=`$orig_target_cc -print-search-dirs | grep "programs: =" | cut -c 12-`
1996     fi
1997 else
1998     # We do not know which gcc version we are going to build and what we need to know
1999     # here is different for different versions so this will be set later during the
2000     # build of crosstools.
2001     prefix="$AROS_CROSSTOOLSDIR/${aros_target_cpu}-aros-"
2002     aros_target_cc_path=@aros_target_cc_path@
2004 aros_target_cpp="${prefix}cpp"
2005 aros_target_cc="${prefix}gcc"
2006 aros_target_cxx="${prefix}g++"
2007 aros_target_as="${prefix}as"
2008 aros_target_ld="${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-ld"
2009 aros_target_ar="${prefix}ar $aros_target_ar_flags"
2010 aros_target_objcopy="${prefix}objcopy"
2011 aros_target_objdump="${prefix}objdump"
2012 aros_target_ranlib="${prefix}ranlib $aros_target_ranlib_flags"
2013 aros_target_nm="${prefix}nm $aros_target_nm_flags"
2014 aros_target_strip="${prefix}strip"
2015 aros_plain_nm="${prefix}nm"
2016 aros_plain_ar="${prefix}ar"
2018 AC_ARG_ENABLE(includes,
2019 AC_HELP_STRING([--enable-includes=dir],[Alternative system include directory]),
2020 [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`])
2022 if test "$aros_kernel_includes" = ""; then
2023     if test "x-$aros_flavour" = "x-emulation" -o "x-$aros_flavour" = "x-emulcompat" ; then
2024         aros_kernel_includes="-isystem $aros_target_incl"
2025     fi
2028 if test "$aros_kernel_includes" != "" ; then
2029     dnl find out about the kernel cc's include path
2030     AC_MSG_CHECKING([for the kernel compiler's include path])
2031     if test "$aros_kernel_cc_includes" = "" ; then
2032         # Try to guess where the directory is.
2033         aros_kernel_cc_includes=`dirname \`${aros_kernel_cc} ${aros_kernel_cflags} -print-libgcc-file-name\``/include
2034         if test -d $aros_kernel_cc_includes; then
2035             # Check if there is also an include-fixed directory and add it
2036             # to kernel compiler's include path as it may contain some of
2037             # the headers we need.
2038             if test -d "$aros_kernel_cc_includes"-fixed; then
2039                 aros_kernel_cc_includes+=" -isystem $aros_kernel_cc_includes"-fixed
2040             fi
2041             # Check for specific includes directory. Neede for Ubuntu 11.10
2042             if test -d "/usr/include/i386-linux-gnu"; then
2043                 aros_kernel_cc_includes+=" -isystem /usr/include/i386-linux-gnu"
2044             fi
2045         else
2046             # The directory doesn't exist, we need to do some more work.
2047             aros_kernel_cc_includes=${PWD}/${aros_gendir}/cc_include
2049             # These are the headers we're looking for.
2050             headers="limits.h mmintrin.h stdbool.h syslimits.h float.h \
2051                      stddef.h xmmintrin.h iso646.h stdarg.h unwind.h   \
2052                      zutil.h stdint.h"
2054             dirs=
2055             for h in $headers; do
2056                 # Which other headers are needed by each of the above?
2057                 deps=$(echo "#include <$h>" | \
2058                        $aros_kernel_cc -E -M - 2>/dev/null | \
2059                        sed 's/^.*://; s/\\$/ /g; s/[[ \t]]\+/ /g')
2061                 # Copy all the needed headers to a directory beneath gendir.
2062                 for d in $deps; do
2063                     h=$(basename $d)
2064                     dir=${aros_kernel_cc_includes}$(echo $(dirname $d) | \
2065                                                 sed -n "s,^.*/include\(/.*\),\1,p")
2066                     ! test -d $dir && mkdir -p $dir
2067                     ! test -f $dir/$h && { cp $d $dir; chmod u+w $dir/$h; }
2068                 done
2069             done            
2070         fi
2071     fi
2072     AC_MSG_RESULT($aros_kernel_cc_includes)
2073     # Adding -nostdinc to kernel includes as they are always used together.
2074     aros_kernel_includes="$aros_kernel_includes $aros_target_nostdinc_cflags -isystem $aros_kernel_cc_includes"
2077 if test "$crosstools" != "yes"; then
2078     dnl find out about the target cc's include path
2079     AC_MSG_CHECKING([for the target compiler's include path])
2080     if test "$aros_target_cc_includes" = "" ; then
2081         #try to guess where the directory is
2082         aros_target_cc_includes=`dirname \`${orig_target_cc} -print-libgcc-file-name\``/include
2083         if ! test -d $aros_target_cc_includes; then
2084             #the directory doesn't exist, we need to do some more work
2085             aros_target_cc_includes=${PWD}/${aros_gendir}/cc_include
2086         
2087             #these are the headers we're looking for
2088             headers="limits.h mmintrin.h stdbool.h syslimits.h float.h \
2089                     stddef.h xmmintrin.h iso646.h stdarg.h unwind.h   \
2090                     zutil.h"
2092             dirs=
2093             for h in $headers; do
2094                 #which other headers each of the above headers needs?
2095                 deps=$(echo "#include <$h>" | \
2096                     $orig_target_cc -E -M - 2>/dev/null | \
2097                     sed 's/^.*://; s/\\$/ /g; s/[[ \t]]\+/ /g')
2098             
2099                 #copy all the needed headers to a directory beneath gendir
2100                 for d in $deps; do
2101                     h=$(basename $d)
2102                     dir=${aros_target_cc_includes}$(echo $(dirname $d) | \
2103                                                 sed -n "s,^.*/include\(/.*\),\1,p")
2104                     ! test -d $dir && mkdir -p $dir
2105                     ! test -f $dir/$h && { cp $d $dir; chmod u+w $dir/$h; }
2106                 done
2107             done
2108         fi
2109     fi
2110     AC_MSG_RESULT($aros_target_cc_includes)
2111 else
2112     # We do not know which gcc version we are going to build and what we need to know
2113     # here is different for different versions so this will be set later during the
2114     # build of crosstools.
2115     aros_target_cc_includes=@aros_target_cc_includes@
2119 # For GCC < 4.0 -I- is used for giving the search path for '#include "..."'
2120 # On GCC >= 4.0 -iquote should be used
2123 save_cc="$CC"
2124 save_cflags="$CFLAGS"
2125 CFLAGS="-iquote."
2126 AC_MSG_CHECKING([whether ${CC} accepts -iquote])
2127 if test "x-$crosstools" != "x-yes"; then
2128     AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
2129 else
2130     # we do know it is supported for the smallest version of gcc we are going to build
2131     # we assume it's also supported by later versions
2132     has_iquote=yes
2134 AC_MSG_RESULT($has_iquote)
2135 if test "x-$has_iquote" = "x-yes" ; then
2136     host_cflags_iquote=-iquote
2137     host_cflags_iquote_end=
2138 else
2139     host_cflags_iquote=-I
2140     host_cflags_iquote_end=-I-
2142 kernel_cflags_iquote=$host_cflags_iquote
2143 kernel_cflags_iquote_end=$host_cflags_iquote_end
2144 if test "x-$cross_compiling" = "x-yes"; then
2145     CC="$aros_kernel_cc"
2146     AC_MSG_CHECKING([whether ${CC} accepts -fno-stack-protector])
2147     if test "x-$crosstools" != "x-yes"; then
2148         AC_TRY_COMPILE(,, use_no_stack_protector="yes", use_no_stack_protector="no")
2149     else
2150         # we do know it is supported for the smallest version of gcc we are going to build
2151         # we assume it's also supported by later versions
2152         use_no_stack_protector=yes
2153     fi
2154     AC_MSG_RESULT($use_no_stack_protector)
2155     AC_MSG_CHECKING([whether ${CC} accepts -iquote])
2156     if test "x-$crosstools" != "x-yes"; then
2157         AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
2158     else
2159         # we do know it is supported for the smallest version of gcc we are going to build
2160         # we assume it's also supported by later versions
2161         has_iquote=yes
2162     fi
2163     AC_MSG_RESULT($has_iquote)
2164     if test "x-$has_iquote" = "x-yes" ; then
2165         kernel_cflags_iquote=-iquote
2166         kernel_cflags_iquote_end=
2167     else
2168         kernel_cflags_iquote=-I
2169         kernel_cflags_iquote_end=-I-
2170     fi
2172 aros_cflags_iquote=$kernel_cflags_iquote
2173 aros_cflags_iquote_end=$kernel_cflags_iquote_end
2174 if test "$orig_target_cc" != "$aros_kernel_cc"; then
2175     CC="$orig_target_cc"
2176     AC_MSG_CHECKING([whether ${CC} accepts -iquote])
2177     if test "x-$crosstools" != "x-yes"; then
2178         AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
2179     else
2180         # we do know it is supported for the smallest version of gcc we are going to build
2181         # we assume it's also supported by later versions
2182         has_iquote=yes
2183     fi
2184     AC_MSG_RESULT($has_iquote)
2185     if test "x-$has_iquote" = "x-yes" ; then
2186         aros_cflags_iquote=-iquote
2187         aros_cflags_iquote_end=
2188     else
2189         aros_cflags_iquote=-I
2190         aros_cflags_iquote_end=-I-
2191     fi
2193 if test "x-$use_no_stack_protector" = "x-yes" ; then
2194     aros_kernel_cflags="$aros_kernel_cflags -fno-stack-protector"
2198 #-----------------------------------------------------------------------------
2200 # Check if the target compiler supports some options used for delinting:
2201 #  -Wunused-but-set-variable
2202 #  -Warray-bounds
2203 #  -Wenum-compare
2204 #  -Wstrict-overflow
2205 #  -Wformat-security
2207 if test "x-$crosstools" != "x-yes"; then
2208     if test "$orig_target_cc" != "$aros_kernel_cc"; then
2209         CC="$orig_target_cc"
2210     fi
2211     AC_MSG_CHECKING([whether ${CC} accepts -Wunused-but-set-variable])
2212     CFLAGS=-Wunused-but-set-variable
2213     AC_TRY_COMPILE(,, aros_unused_but_set_variable="yes", aros_unused_but_set_variable="no")
2214     AC_MSG_RESULT($aros_unused_but_set_variable)
2215     if test "x-$aros_unused_but_set_variable" = "x-yes" ; then
2216         aros_cflags_unused_but_set_variable=-Wno-unused-but-set-variable
2217     fi
2219     AC_MSG_CHECKING([whether ${CC} accepts -Warray-bounds])
2220     CFLAGS=-Warray-bounds
2221     AC_TRY_COMPILE(,, aros_array_bounds="yes", aros_array_bounds="no")
2222     AC_MSG_RESULT($aros_array_bounds)
2223     if test "x-$aros_array_bounds" = "x-yes" ; then
2224         aros_cflags_array_bounds=-Wno-array-bounds
2225     fi
2227     AC_MSG_CHECKING([whether ${CC} accepts -Wenum-compare])
2228     CFLAGS=-Wenum-compare
2229     AC_TRY_COMPILE(,, aros_enum_compare="yes", aros_enum_compare="no")
2230     AC_MSG_RESULT($aros_enum_compare)
2231     if test "x-$aros_enum_compare" = "x-yes" ; then
2232         aros_cflags_enum_compare=-Wno-enum-compare
2233     fi
2235     AC_MSG_CHECKING([whether ${CC} accepts -Wstrict-overflow])
2236     CFLAGS=-Wstrict-overflow
2237     AC_TRY_COMPILE(,, aros_strict_overflow="yes", aros_strict_overflow="no")
2238     AC_MSG_RESULT($aros_strict_overflow)
2239     if test "x-$aros_strict_overflow" = "x-yes" ; then
2240         aros_cflags_strict_overflow=-Wno-strict-overflow
2241     fi
2243     AC_MSG_CHECKING([whether ${CC} accepts -Wformat-security])
2244     CFLAGS=-Wformat-security
2245     AC_TRY_COMPILE(,, aros_format_security="yes", aros_format_security="no")
2246     AC_MSG_RESULT($aros_format_security)
2247     if test "x-$aros_format_security" = "x-yes" ; then
2248         aros_cflags_format_security=-Wno-format-security
2249     fi
2250 else
2251     # We do not know which gcc version we are going to build and what we need to know
2252     # here is different for different versions so this will be set later during the
2253     # build of crosstools.
2254     aros_cflags_unused_but_set_variable=@aros_cflags_unused_but_set_variable@
2255     aros_cflags_array_bounds=@aros_cflags_array_bounds@
2256     aros_cflags_enum_compare=@aros_cflags_enum_compare@
2257     aros_cflags_strict_overflow=@aros_cflags_strict_overflow@
2258     aros_cflags_format_security=@aros_cflags_format_security@
2261 #-----------------------------------------------------------------------------
2263 # Check if we can explicitly choose older version of symbol hashing
2265 CFLAGS="save_cflags -Wl,--hash-style=sysv"
2266 CC="$aros_kernel_cc"
2267 AC_MSG_CHECKING([whether ${CC} accepts -Wl,--hash-style=sysv])
2268 AC_TRY_LINK(,, use_hash_style="yes", use_hash_style="no")
2269 AC_MSG_RESULT($use_hash_style)
2270 if test "x-$use_hash_style" = "x-yes" ; then
2271     aros_kernel_cflags="$aros_kernel_cflags -Wl,--hash-style=sysv"
2273 CC="$save_cc"
2274 CFLAGS="$save_cflags"
2276 AC_SUBST(host_cflags_iquote)
2277 AC_SUBST(host_cflags_iquote_end)
2278 AC_SUBST(kernel_cflags_iquote)
2279 AC_SUBST(kernel_cflags_iquote_end)
2280 AC_SUBST(aros_cflags_iquote)
2281 AC_SUBST(aros_cflags_iquote_end)
2284 dnl Check if user specified --with-resolution=XRESxYRESxDEPTH
2285 AC_MSG_CHECKING([for default resolution of WBScreen])
2286 AC_ARG_WITH(resolution,AC_HELP_STRING([--with-resolution=XRESxYRESxDEPTH],[Default resolution of the initial WorkbenchScreen]),resolution=$withval,resolution=none)
2287 # We require an argument, so map --with/--without ("yes"/"no") to "none" specified
2288 if test "$resolution" = "yes" ; then
2289     resolution="none"
2291 if test "$resolution" = "no" ; then
2292     resolution="none"
2294 if test "$resolution" != "none" ; then
2295     aros_default_wbwidth=`echo $resolution | cut -d'x' -f1`
2296     aros_default_wbheight=`echo $resolution | cut -d'x' -f2`
2297     aros_default_wbdepth=`echo $resolution | cut -d'x' -f3`
2299 AC_MSG_RESULT($aros_default_wbwidth x $aros_default_wbheight x $aros_default_wbdepth)
2300 aros_cv_default_wbwidth=$aros_default_wbwidth
2301 aros_cv_default_wbheight=$aros_default_wbheight
2302 aros_cv_default_wbdepth=$aros_default_wbdepth
2304 dnl See if the user wants the serial debug output for native flavour
2305 AC_MSG_CHECKING([if serial debug is enabled])
2306 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)
2307 if test "$aros_serial_debug" = 0 ; then
2308     serial_debug_forced=""
2309     if test "$serial_debug" = "yes" ; then
2310         serial_debug="1"
2311     fi
2312     if test "$serial_debug" = "no" ; then
2313         serial_debug="none"
2314     fi
2315 else
2316     serial_debug_forced="(forced)"
2317     serial_debug=$aros_serial_debug
2319 if test "$serial_debug" != "none" ; then
2320     aros_serial_debug=$serial_debug
2321     AC_MSG_RESULT($serial_debug_forced on port $serial_debug)
2322 else
2323     AC_MSG_RESULT(no)
2326 dnl See if the user wants the palm debug output hack for palm native flavour
2327 AC_MSG_CHECKING([if palm debug hack is enabled])
2328 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")
2329 if test "$palm_debug_hack" = "yes" ; then
2330     aros_palm_debug_hack="1"
2332 AC_MSG_RESULT($palm_debug_hack)
2334 dnl See if dev wants the usb3.0 code
2335 AC_MSG_CHECKING([if usb3.0 code is enabled])
2336 AC_ARG_ENABLE(usb30_code,AC_HELP_STRING([--enable-usb30-code],[Enable usb3.0 code (default=no)]),usb30_code="yes",usb30_code="no")
2337 if test "$usb30_code" = "yes" ; then
2338     aros_config_cflags="$aros_config_cflags -DAROS_USB30_CODE"
2339     aros_kernel_cflags="$aros_kernel_cflags -DAROS_USB30_CODE"
2341 AC_MSG_RESULT($usb30_code)
2343 dnl See if the user wants nesting supervisor activated for unix flavour
2344 AC_MSG_CHECKING([if nesting supervisor support is enabled])
2345 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")
2346 if test "$nesting_supervisor" = "yes" ; then
2347     aros_nesting_supervisor="1"
2349 AC_MSG_RESULT($nesting_supervisor)
2351 dnl See if the user wants to disable MMU support
2352 dnl This can be overriden on per-target basis,
2353 dnl set $aros_enable_mmu to "yes" or "no" to do this
2354 if test "$aros_enable_mmu" = "" ; then
2355     AC_MSG_CHECKING([if MMU support is enabled])
2356     dnl Enabled by default
2357     AC_ARG_ENABLE(mmu,AC_HELP_STRING([--disable-mmu],[Disable MMU support (default=enabled)]),aros_enable_mmu=$enableval,aros_enable_mmu="yes")
2358     if test "$aros_enable_mmu" = "" ; then
2359         aros_enable_mmu="yes"
2360     fi
2361     AC_MSG_RESULT($aros_enable_mmu)
2363 if test "$aros_enable_mmu" = "no" ; then
2364     aros_enable_mmu="0"
2365 else
2366     aros_enable_mmu="1"
2368     
2370 dnl things specifically required for hosted flavours
2371 if test "x-$aros_flavour" = "x-emulation" -o "x-$aros_flavour" = "x-emulcompat" ; then
2373     if test "x-$need_dlopen" != "x-no" ; then
2374       save_libs="$LIBS"
2375       LIBS=""
2376       dnl some kind of dynamic library access system is required for hostlib.resource
2377       AC_CHECK_FUNC(dlopen, have_dl="yes", have_dl="no")
2378       if test "x-$have_dl" = "x-no" ; then
2379           AC_CHECK_LIB(dl, dlopen, [have_dl="yes"
2380                                     aros_host_ldflags="$aros_host_ldflags -ldl"],
2381                                     have_dl="no")
2382       fi
2383       if test "x-$have_dl" = "x-no" ; then
2384           AC_MSG_ERROR([dlopen() dynamic linker functions not available])
2385       fi
2386       LIBS="$save_libs"
2387     fi
2390     dnl x11 hidd
2391     AC_ARG_ENABLE(x11_hidd, AC_HELP_STRING([--enable-x11-hidd],
2392                                            [build X11 hidd for hosted (default=auto)]),
2393                                            x11_hidd="$enableval",
2394                                            x11_hidd="$need_x11")
2395     case "x-$x11_hidd" in
2396         x-yes|x-no|x-auto)                 ;;
2397         *)                 x11_hidd="$need_x11" ;;
2398     esac
2400     ENABLE_X11=0
2402     dnl they want it
2403     if test "x-$x11_hidd" != "x-no" ; then
2405         dnl find x11 stuff
2406         AC_PATH_X
2408         x_cflags=
2409         for path in $x_libraries
2410         do
2411             x_cflags="$x_cflags -L$path"
2412         done
2414         for path in $x_includes
2415         do
2416             x_cflags="$x_cflags -I$path"
2417         done
2418         
2419         if test "x-$no_x" = "x-yes" ; then
2421             dnl didn't find it
2422             if test "x-$x11_hidd" != "x-auto" ; then
2423                 dnl and they explicitly asked for it, bail out
2424                 AC_MSG_ERROR([X11 libs/headers not found, cannot build X11 hidd as requested])
2425             fi
2426         
2427         else
2428             dnl found it, setup the metatarget
2429             unixgfx_hidd_target=kernel-x11gfx
2430             ENABLE_X11=1
2432             dnl setup shared memory extensions
2433             AC_ARG_ENABLE(x11_shm, AC_HELP_STRING([--enable-x11-shm],
2434                                                   [use X11 shared memory (default=auto)]),
2435                                                   x11_hidd_shm="$enableval",
2436                                                   x11_hidd_shm="auto")
2437             case "x-$x11_hidd_shm" in
2438                 x-yes|x-no|x-auto)                     ;;
2439                 *)                 x11_hidd_shm="auto" ;;
2440             esac
2442             have_xshm=no
2444             dnl they want it
2445             if test "x-$x11_hidd_shm" != "x-no" ; then
2447                 dnl system shm headers
2448                 AC_CHECK_HEADERS(sys/ipc.h)
2449                 AC_CHECK_HEADERS(sys/shm.h)
2451                 dnl got them
2452                 if test "x-$ac_cv_header_sys_ipc_h" = "x-yes" -a "x-$ac_cv_header_sys_shm_h" = "x-yes" ; then
2454                     dnl make sure X libs have shm functions
2455                     save_cflags="$CFLAGS"
2456                     CFLAGS="$CFLAGS $x_cflags"
2457                     AC_CHECK_LIB(Xext, XShmQueryExtension, have_xshm=yes)
2458                     CFLAGS="$save_cflags"
2459                 fi
2460             fi
2462             dnl detection done, prepare output
2463             if test "x-$have_xshm" = "x-yes" ; then
2464                 dnl we can do shm
2465                 DO_XSHM_SUPPORT="1"
2466             elif test "x-$x11_hidd_shm" = "x-yes" ; then
2467                 dnl they explicitly asked for it, but we can't do it
2468                 AC_MSG_ERROR([X11 has no support for shared memory, cannot enable it as requested])
2469             else
2470                 dnl otherwise just disable it
2471                 DO_XSHM_SUPPORT="0"
2472             fi
2474             
2475             dnl setup vidmode (fullscreen) extensions
2476             AC_ARG_ENABLE(x11_vidmode, AC_HELP_STRING([--enable-x11-vidmode],
2477                                                       [use X11 vidmode extension (default=auto)]),
2478                                                       x11_hidd_vidmode="$enableval",
2479                                                       x11_hidd_vidmode="auto")
2480             case "x-$x11_hidd_vidmode" in
2481                 x-yes|x-no|x-auto)                         ;;
2482                 *)                 x11_hidd_vidmode="auto" ;;
2483             esac
2485             have_vidmode=no
2487             dnl they want it
2488             if test "x-$x11_hidd_vidmode" != "x-no" ; then
2490                 dnl make sure X libs have vidmode functions
2491                 save_cflags="$CFLAGS"
2492                 CFLAGS="$CFLAGS $x_cflags"
2493                 AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryExtension, have_vidmode=yes)
2494                 CFLAGS="$save_cflags"
2495             fi
2497             dnl detection done, prepare output
2498             if test "x-$have_vidmode" = "x-yes" ; then
2499                 dnl we can do vidmode
2500                 DO_VIDMODE_SUPPORT="1"
2501             elif test "x-$x11_hidd_vidmode" = "x-yes" ; then
2502                 dnl they explicitly asked for it, but we can't do it
2503                 AC_MSG_ERROR([X11 vidmode extension not available, cannot enable it as requested])
2504             else
2505                 dnl otherwise just disable it
2506                 DO_VIDMODE_SUPPORT="0"
2507             fi
2508         fi
2510         aros_host_x11_includes=$x_includes 
2511         aros_host_x11_libdirs=$x_libraries
2512     fi
2515     dnl sdl hidd
2516     AC_ARG_ENABLE(sdl_hidd, AC_HELP_STRING([--enable-sdl-hidd],
2517                                            [build SDL hidd for hosted (default=auto)]),
2518                                            sdl_hidd="$enableval",
2519                                            sdl_hidd="auto")
2520     case "x-$sdl_hidd" in
2521         x-yes|x-no|x-auto)                 ;;
2522         *)                 sdl_hidd="auto" ;;
2523     esac
2525     dnl they want it
2526     if test "x-$sdl_hidd" != "x-no" ; then
2528         dnl find sdl
2529         AM_PATH_SDL([1.2.10], have_sdl="yes", have_sdl="no")
2531         if test "x-$have_sdl" != "x-yes" ; then
2533             dnl didn't find it
2534             if test "x-$sdl_hidd" != "x-auto" ; then
2535                 dnl and they explicitly asked for it, bail out
2536                 AC_MSG_ERROR([SDL libs/headers not found, cannot build SDL hidd as requested])
2537             fi
2539         else
2540             dnl found it, set up the metatarget
2541             sdl_hidd_target=kernel-hidd-sdl
2542             aros_host_sdl_cflags=SDL_CFLAGS
2543             aros_host_sdl_libs=SDL_LIBS
2544         fi
2545     fi
2547     dnl oss.library
2548     AC_CHECK_HEADER(sys/soundcard.h)
2549     if test "x-$ac_cv_header_sys_soundcard_h" = "x-yes" ; then
2550         oss_library_target=workbench-libs-oss-unix
2551     fi
2555 dnl See if the user wants dbus.library
2556 AC_MSG_CHECKING([if building of dbus.library is enabled])
2557 AC_ARG_ENABLE(dbus,AC_HELP_STRING([--enable-dbus],[Enable DBUS support via dbus.library (default=no)]),dbus="yes",dbus="no")
2558 if test "$dbus" = "yes" ; then
2559     ENABLE_DBUS=1
2560     DBUS_CFLAGS=`pkg-config --cflags dbus-1`
2561     DBUS_LIBFLAGS=`pkg-config --libs dbus-1`
2562     KERNEL_DBUS_KOBJ=kernel-dbus-kobj
2563     KERNEL_DBUS_INCLUDES=kernel-dbus-includes
2564 else
2565     ENABLE_DBUS=0
2567 AC_MSG_RESULT($dbus)
2569 if test "$use_kernel_cc_wrapper" = "yes" ; then
2570     aros_kernel_cc="${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-elf-gcc"
2573 if test "${crosstools}" = "yes" || test "${crosstools_guess}" = "no"; then
2574     aros_target_toolchain=yes
2575 else
2576     aros_target_toolchain=no
2579 dnl --------------------------------------------------------------------
2580 dnl Configuration Output Section
2581 dnl --------------------------------------------------------------------
2583 # Generic
2584 AC_SUBST(aros_arch)
2585 AC_SUBST(aros_cpu)
2586 AC_SUBST(aros_flavour)
2587 AC_SUBST(aros_flavour_uc)
2588 AC_SUBST(aros_target_toolchain)
2589 AC_SUBST(AROS_BUILDDIR)
2590 AC_SUBST(AROS_BUILDDIR_UNIX)
2591 AC_SUBST(SRCDIR)
2592 AC_SUBST(AROS_CROSSTOOLSDIR)
2593 AC_SUBST(AROS_PORTSSRCDIR)
2595 # Compatability with other Amiga-like operation systems
2596 AC_SUBST(aros_amigaos_compliance)
2598 # Host related
2599 AC_SUBST(aros_cc_pre)
2600 AC_SUBST(aros_host_strip)
2601 AC_SUBST(aros_host_arch)
2602 AC_SUBST(aros_host_cpu)
2603 AC_SUBST(aros_host_cpp)
2604 AC_SUBST(aros_host_cc)
2605 AC_SUBST(aros_host_cxx)
2606 AC_SUBST(aros_host_ar)
2607 AC_SUBST(aros_host_ranlib)
2608 AC_SUBST(aros_host_ld)
2609 AC_SUBST(aros_host_make)
2610 AC_SUBST(aros_host_cflags)
2611 AC_SUBST(aros_host_cxxflags)
2612 AC_SUBST(gnu89_inline)
2613 AC_SUBST(aros_host_ldflags)
2614 AC_SUBST(aros_host_debug)
2615 AC_SUBST(aros_host_mkdep)
2616 AC_SUBST(aros_host_mkargs)
2617 AC_SUBST(aros_host_exe_suffix)
2618 AC_SUBST(aros_host_lib_suffix)
2619 AC_SUBST(aros_tools_dir)
2620 AC_SUBST(aros_host_aclocal)
2621 AC_SUBST(aros_host_autoconf)
2622 AC_SUBST(aros_host_autoheader)
2623 AC_SUBST(aros_host_automake)
2624 AC_SUBST(ant)
2626 # Target Related
2627 AC_SUBST(aros_target_guitheme)
2628 AC_SUBST(aros_target_iconset)
2629 AC_SUBST(aros_target_bootloader)
2630 AC_SUBST(aros_target_arch)
2631 AC_SUBST(aros_target_family)
2632 AC_SUBST(aros_target_cpu)
2633 AC_SUBST(aros_target_variant)
2634 AC_SUBST(aros_target_suffix)
2635 AC_SUBST(aros_target_ar)
2636 AC_SUBST(aros_target_ranlib)
2637 AC_SUBST(aros_plain_nm)
2638 AC_SUBST(aros_plain_ar)
2639 AC_SUBST(aros_kernel_ar)
2640 AC_SUBST(aros_kernel_ranlib)
2641 AC_SUBST(orig_target_cc)
2642 AC_SUBST(aros_target_cc)
2643 AC_SUBST(aros_kernel_cc)
2644 AC_SUBST(orig_target_cxx)
2645 AC_SUBST(aros_target_cxx)
2646 AC_SUBST(aros_kernel_cxx)
2647 AC_SUBST(orig_target_cpp)
2648 AC_SUBST(aros_target_cpp)
2649 AC_SUBST(aros_kernel_cpp)
2650 AC_SUBST(orig_target_as)
2651 AC_SUBST(aros_target_as)
2652 AC_SUBST(aros_kernel_as)
2653 AC_SUBST(orig_target_ld)
2654 AC_SUBST(aros_target_ld)
2655 AC_SUBST(aros_kernel_ld)
2656 AC_SUBST(aros_target_cc_includes)
2657 AC_SUBST(aros_target_cc_path)
2658 AC_SUBST(aros_target_objdump)
2659 AC_SUBST(aros_target_objcopy)
2660 AC_SUBST(aros_target_strip)
2661 AC_SUBST(aros_target_nm)
2662 AC_SUBST(aros_kernel_rescomp)
2663 AC_SUBST(aros_shared_default)
2664 AC_SUBST(aros_shared_ld)
2665 AC_SUBST(aros_object_format)
2666 AC_SUBST(spec_obj_format)
2667 AC_SUBST(aros_compiler_libs)
2668 AC_SUBST(aros_arch_libs)
2670 AC_SUBST(aros_config_cflags)
2671 AC_SUBST(aros_config_aflags)
2672 AC_SUBST(aros_config_ldflags)
2674 AC_SUBST(aros_shared_cflags)
2675 AC_SUBST(aros_shared_aflags)
2676 AC_SUBST(aros_shared_ldflags)
2677 AC_SUBST(aros_kernel_cflags)
2678 AC_SUBST(aros_kernel_includes)
2679 AC_SUBST(aros_kernel_objcflags)
2680 AC_SUBST(aros_kernel_ldflags)
2681 AC_SUBST(aros_target_cflags)
2682 AC_SUBST(aros_debug_cflags)
2683 AC_SUBST(aros_debug_aflags)
2684 AC_SUBST(aros_debug_ldflags)
2685 AC_SUBST(aros_target_genmap)
2686 AC_SUBST(aros_target_strip_flags)
2687 AC_SUBST(aros_optimization_cflags)
2688 AC_SUBST(aros_isa_flags)
2690 AC_SUBST(crosstools_target)
2691 AC_SUBST(crosstools_cxx_target)
2693 # Delinting target compiler flags
2694 AC_SUBST(aros_cflags_unused_but_set_variable)
2695 AC_SUBST(aros_cflags_array_bounds)
2696 AC_SUBST(aros_cflags_enum_compare)
2697 AC_SUBST(aros_cflags_strict_overflow)
2698 AC_SUBST(aros_cflags_format_security)
2700 # Graphics Related
2701 AC_SUBST(unixgfx_hidd_target)
2702 AC_SUBST(sdl_hidd_target)
2703 AC_SUBST(pci_hidd_target)
2704 AC_SUBST(oss_library_target)
2706 AC_SUBST(aros_default_wbwidth)
2707 AC_SUBST(aros_default_wbheight)
2708 AC_SUBST(aros_default_wbdepth)
2709 AC_SUBST(DO_XSHM_SUPPORT)
2710 AC_SUBST(DO_VIDMODE_SUPPORT)
2712 AC_SUBST(aros_host_x11_includes)
2713 AC_SUBST(aros_host_x11_libdirs)
2714 AC_SUBST(aros_host_sdl_cflags)
2715 AC_SUBST(aros_host_sdl_libs)
2717 # Native version related
2718 AC_SUBST(aros_serial_debug)
2720 # Palm native version related
2721 AC_SUBST(aros_palm_debug_hack)
2723 # Unix/Hosted version related
2724 AC_SUBST(aros_nesting_supervisor)
2726 # MMU related
2727 AC_SUBST(aros_enable_mmu)
2729 # Apple iOS related
2730 AC_SUBST(aros_ios_platform)
2731 AC_SUBST(aros_ios_version)
2732 AC_SUBST(aros_ios_sdk)
2734 # ARM default GCC target related
2735 AC_SUBST(gcc_default_cpu)
2736 AC_SUBST(gcc_default_cpu_tune)
2737 AC_SUBST(gcc_default_fpu)
2738 AC_SUBST(gcc_default_float_abi)
2740 # Android related
2741 AC_SUBST(android_tool)
2742 AC_SUBST(aros_android_level)
2743 AC_SUBST(aros_android_antapk)
2745 # DBUS related
2746 AC_SUBST(ENABLE_DBUS)
2747 AC_SUBST(DBUS_CFLAGS)
2748 AC_SUBST(DBUS_LIBFLAGS)
2749 AC_SUBST(KERNEL_DBUS_KOBJ)
2750 AC_SUBST(KERNEL_DBUS_INCLUDES)
2752 #X11 related
2753 AC_SUBST(ENABLE_X11)
2755 # Debug related
2756 AC_SUBST(aros_debug)
2757 AC_SUBST(aros_mungwall_debug)
2758 AC_SUBST(aros_stack_debug)
2759 AC_SUBST(aros_modules_debug)
2761 # Collect-aros stuff: "-ius" to ignore undefined symbols
2762 AC_SUBST(ignore_undefined_symbols)
2764 # C compiler related
2765 AC_SUBST(gcc_target_cpu)
2766 AC_SUBST(target_gcc_version)
2768 #ObjC compiler related
2769 AC_SUBST(objc_target)
2771 #Java related
2772 AC_SUBST(java_target)
2774 # USB3.0 code
2775 AC_SUBST(aros_usb30_code)
2777 dnl Prepare for output, make up all the generated patches
2778 case "$aros_flavour" in
2779 emulation)      aros_flavour_uc="AROS_FLAVOUR_EMULATION"
2780                 aros_flavour="emulation" ;;
2781 emulcompat)     aros_flavour_uc="(AROS_FLAVOUR_EMULATION|AROS_FLAVOUR_BINCOMPAT)"
2782                 aros_flavour="emulation" ;;
2783 standalone)     aros_flavour_uc="AROS_FLAVOUR_STANDALONE"
2784                 aros_flavour="standalone";;
2785 standcompat)    aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_BINCOMPAT)"
2786                 aros_flavour="standalone";;
2787 native)         aros_flavour_uc="AROS_FLAVOUR_NATIVE"
2788                 aros_flavour="native" ;;
2789 nativecompat)   aros_flavour_uc="(AROS_FLAVOUR_NATIVE|AROS_FLAVOUR_BINCOMPAT)"
2790                 aros_flavour="native" ;;
2791 linklib)        aros_flavour_uc="AROS_FLAVOUR_LINKLIB"
2792                 aros_flavour="linklib" ;;
2793 palmnative)     aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
2794                 aros_flavour="palmnative" ;;
2795 mac68knative)   aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
2796                 aros_flavour="mac68knative" ;;
2797 ppcnative)      aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_BINCOMPAT)"
2798                 aros_flavour="ppcnative" ;;
2799 esac
2801 if test ! -d ${aros_inc_dir} ; then
2802     ${MKDIR} ${aros_inc_dir}
2804 if test ! -d ${aros_geninc_dir} ; then
2805     ${MKDIR} ${aros_geninc_dir}
2807 if test ! -d ${aros_hostcfg_dir} ; then
2808     ${MKDIR} ${aros_hostcfg_dir}
2810 if test ! -d ${aros_targetcfg_dir} ; then
2811     ${MKDIR} ${aros_targetcfg_dir}
2813 if test ! -d ${aros_tools_dir} ; then
2814     ${MKDIR} ${aros_tools_dir}
2816 if test ! -d ${aros_scripts_dir} ; then
2817     ${MKDIR} ${aros_scripts_dir}
2820 AC_CONFIG_HEADERS(${aros_geninc_dir}/host-conf.h:config/host-conf.h.in)
2822 # Generic build tools (metamake, etc)
2823 AC_CONFIG_COMMANDS([genmf-executable-support],
2824     [chmod a+x ${aros_tools_dir}/genmf.py],
2825     [aros_tools_dir=${aros_tools_dir}]
2827 AC_CONFIG_FILES(
2828     Makefile
2829     config/make.cfg
2830     ${aros_inc_dir}/config.h:config/config.h.in
2831     ${aros_geninc_dir}/config.h:config/config.h.in
2832     ${aros_hostcfg_dir}/host.cfg:config/host.cfg.in
2833     ${aros_targetcfg_dir}/target.cfg:config/target.cfg.in
2834     mmake.config
2835     ${aros_targetcfg_dir}/make.defaults:config/make.defaults.in
2836     ${aros_tools_dir}/genmf.py:tools/genmf/genmf.py
2837     tools/collect-aros/env.h
2840 # Binutils
2841 AC_CONFIG_COMMANDS([binutils-support],
2842     [
2843         prefix=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}
2844         mkdir -p $prefix
2845         prefix2=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros
2847         chmod a+x ${prefix2}-ld
2849         ln -sf $orig_target_as$aros_host_exe_suffix      ${prefix2}-as$aros_host_exe_suffix
2850         ln -sf $orig_target_nm$aros_host_exe_suffix      ${prefix2}-nm$aros_host_exe_suffix
2851         ln -sf $orig_target_ar$aros_host_exe_suffix      ${prefix2}-ar$aros_host_exe_suffix
2852         ln -sf $orig_target_ranlib$aros_host_exe_suffix  ${prefix2}-ranlib$aros_host_exe_suffix
2853         ln -sf $orig_target_objcopy$aros_host_exe_suffix ${prefix2}-objcopy$aros_host_exe_suffix
2854         ln -sf $orig_target_objdump$aros_host_exe_suffix ${prefix2}-objdump$aros_host_exe_suffix
2855         ln -sf $orig_target_strip$aros_host_exe_suffix   ${prefix2}-strip$aros_host_exe_suffix
2856     ],
2857     [
2858         aros_host_exe_suffix=${aros_host_exe_suffix}
2859         aros_tools_dir=${aros_tools_dir}
2860         aros_target_cpu=${aros_target_cpu}
2861         aros_target_arch=${aros_target_arch}
2862         aros_target_suffix=${aros_target_suffix}
2863         orig_target_nm=${orig_target_nm}
2864         orig_target_as=${orig_target_as}
2865         orig_target_ar=${orig_target_ar}
2866         orig_target_ranlib=${orig_target_ranlib}
2867         orig_target_objdump=${orig_target_objdump}
2868         orig_target_objcopy=${orig_target_objcopy}
2869         orig_target_strip=${orig_target_strip}
2870         aros_kernel_ld=${aros_kernel_ld}
2871     ]
2873 AC_CONFIG_FILES(
2874     ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-ld:scripts/aros-ld.in
2877 # Bare Elf support script and spec
2878 if test "${use_kernel_cc_wrapper}" = "yes"; then
2879     AC_CONFIG_COMMANDS([elf-compiler-support],
2880         [
2881             prefix=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}
2882             mkdir -p $prefix
2883             prefix2=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-elf
2885             chmod a+x ${prefix2}-gcc
2887             ln -sf $aros_kernel_ld$aros_host_exe_suffix         ${prefix2}-ld$aros_host_exe_suffix
2888         ],
2889         [
2890             aros_host_exe_suffix=${aros_host_exe_suffix}
2891             aros_tools_dir=${aros_tools_dir}
2892             aros_target_cpu=${aros_target_cpu}
2893             aros_target_arch=${aros_target_arch}
2894             aros_target_suffix=${aros_target_suffix}
2895             aros_kernel_ld=${aros_kernel_ld}
2896         ]
2897     )
2898     AC_CONFIG_FILES(
2899         ${aros_targetcfg_dir}/elf-specs:${elf_specs_in}
2900         ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-elf-gcc:scripts/elf-gcc.in
2901     )
2904 # Host compiler support scripts and spec
2905 if test "${crosstools}" = "no"; then
2906     if test "${crosstools_guess}" = "no"; then
2907         AC_CONFIG_COMMANDS([host-compiler-wrapper-support],
2908             [
2909                 prefix=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}
2910                 mkdir -p $prefix
2911                 prefix2=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros
2913                 chmod a+x ${prefix2}-gcc ${prefix2}-g++ ${prefix2}-cpp
2914             ],
2915             [
2916                 aros_host_exe_suffix=${aros_host_exe_suffix}
2917                 aros_tools_dir=${aros_tools_dir}
2918                 aros_target_cpu=${aros_target_cpu}
2919                 aros_target_arch=${aros_target_arch}
2920                 aros_target_suffix=${aros_target_suffix}
2921             ]
2922         )
2923         AC_CONFIG_FILES(
2924             ${aros_targetcfg_dir}/specs:config/specs.in
2925             ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-cpp:scripts/aros-cpp.in
2926             ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-gcc:scripts/aros-gcc.in
2927             ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-g++:scripts/aros-g++.in
2928         )
2929     fi
2932 # Android support
2933 if test "$aros_target_variant" == "android"; then
2934     AC_CONFIG_FILES(${aros_gendir}/arch/all-android/bootstrap/app/default.properties:arch/all-android/bootstrap/app/default.properties.in)
2937 AC_OUTPUT
2939 dnl This is in order to not define SHARED_CFLAGS sometimes
2940 dnl We don't always do aros_shared_ar, aros_shared_cflags
2942 #XXX compatability...
2943 aros_shared_ar="$aros_shared_ld $aros_shared_ldflags -o"
2945 if test -n "$aros_shared_cflags" ; then
2946     echo "SHARED_CFLAGS := $aros_shared_cflags" >> ${aros_hostcfg_dir}/host.cfg
2947     echo "SHARED_AR := $aros_shared_ar" >> ${aros_hostcfg_dir}/host.cfg