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