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