arch/m68k-amiga: Define the gcc symbol 'start' instead of using .bss
[AROS.git] / configure.in
blob47c0f7d6e54f5840395ed0fed3bda3036dc93c0e
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([what iOS SDK version to use])
758     AC_ARG_WITH(sdk-version,AC_HELP_STRING([--with-sdk-version=VERSION],[Use iOS SDK version VERSION (default=4.1).]),aros_sdk_version="$withval",aros_sdk_version="4.1")
759     AC_MSG_RESULT($aros_sdk_version)
761     ;;
763 "android")
764     AC_MSG_CHECKING([Android SDK path])
765     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)
766     AC_MSG_RESULT($aros_android_sdk)
768     AC_MSG_CHECKING([Android NDK path])
769     AC_ARG_WITH(ndk,AC_HELP_STRING([--with-ndk=PATH],[Specify Android NDK path (default=none).]),aros_android_ndk="$withval",aros_android_ndk="none")
770     AC_MSG_RESULT($aros_android_ndk)
772     AC_MSG_CHECKING([what Android SDK version to use])
773     AC_ARG_WITH(sdk-version,AC_HELP_STRING([--with-sdk-version=LEVEL],[Use Android SDK for API LEVEL (default=12).]),aros_sdk_version="$withval",aros_sdk_version="12")
774     AC_MSG_RESULT($aros_sdk_version)
776     if test "$aros_android_ndk" != "none"; then
777         AC_MSG_CHECKING([what Android NDK version to use])
778         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")
779         AC_MSG_RESULT($aros_ndk_version)
780     fi
782     export PATH="$aros_android_sdk/tools:$PATH"
783     AC_PATH_PROG(android_tool, $android_tool)
784     AROS_REQUIRED(android,$android_tool)
786     aros_android_level=android-$aros_sdk_version
787     if test ! -d $aros_android_sdk/platforms/$aros_android_level; then
788         echo "Platform $aros_android_level is not installed in your SDK"
789         echo "Use --with-sdk-version=<API level number> to select another platform version"
790         echo "You can check what plaform versions are installed in your SDK"
791         echo "by examining contents of $aros_android_sdk/platforms directory"
792         AC_MSG_ERROR([Android platform $aros_android_level is not installed])
793     fi
795     AC_PATH_PROG(ant, ant)
796     if test "$ant" = ""; then
797         AC_MSG_WARN([Apache Ant is missing, Java bootstrap can't be built automatically])
798     fi
800     dnl MSYS bash can't run .bat files directly, then need to be started via cmd.exe
801     if test "$host_os" = "mingw32"; then
802         android_tool="cmd //c $android_tool"
803     fi
805     ;;
806 esac
808 #-----------------------------------------------------------------------------
809 # This is the target configuration switch.
810 case "$target_os" in
811     linux*)
812         aros_target_arch="linux"
813         aros_target_family="unix"
814         case "$target_cpu" in
815             *m68k*)
816                 aros_target_cpu="m68k"
817                 aros_object_format="m68kelf"
818                 aros_flavour="emulcompat"
819                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D__mc68000 -D__linux__"
820                 aros_shared_ldflags="-Wl,-T,\$(TOP)/config/linux/m68k/script.so"
821                 aros_kernel_ldflags="-Wl,-rpath,./lib,-T,\$(TOP)/config/linux/m68k/script.normal"
822                 gcc_target_cpu="mc68000"
823                 ;;
824             *i?86*)
825                 aros_target_cpu="i386"
826                 aros_object_format="elf_i386"
827                 aros_flavour="emulation"
828                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__linux__"
829                 aros_config_cflags="$aros_config_cflags -m32 -march=i486"
830                 aros_kernel_cflags="$aros_kernel_cflags -m32 -march=i486"
831                 aros_config_aflags="$aros_config_aflags -m32 -march=i486"
832                 aros_config_ldflags="-m32 -march=i486"
833                 aros_kernel_ldflags="-melf_i386"
834                 aros_default_wbdepth=8
835                 gcc_target_cpu="i386"
836                 pci_hidd_target="hidd-pci-linux"
837                 android_tool_dir_prefix="x86"
838                 android_tool_prefix="i686-android-linux"
839                 android_ndk_arch="x86"
840                 ;;
841             *x86_64*)
842                 aros_target_cpu="x86_64"
843                 aros_object_format="elf_x86_64"
844                 aros_flavour="emulation"
845                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64 -D__linux__"
846                 aros_config_cflags="$aros_config_cflags -mno-red-zone -fno-omit-frame-pointer"
847                 aros_default_wbdepth=8
848                 pci_hidd_target="hidd-pci-linux"
849                 ;;
850             *powerpc*)
851                 aros_target_cpu="ppc"
852                 aros_object_format="elf32ppc"
853                 aros_flavour="emulation"
854                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc -D__linux__"
855                 aros_default_wbdepth=8
856                 gcc_target_cpu="ppc"
857                 ;;
858 # TODO
859 # Same as powerpc, but I need this for the nightly build to work again.
860 # Actually, the nightly should be made working with powerpc target.
861 # That just was too much work for the moment, another week or two.
862             *ppc*)
863                 aros_target_cpu="ppc"
864                 aros_object_format="elf32ppc"
865                 aros_flavour="emulation"
866                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc -D__linux__"
867                 aros_default_wbdepth=8
868                 gcc_target_cpu="ppc"
869                 ;;
870             *arm*)
871                 aros_target_cpu="arm"
872                 aros_object_format="armelf_linux_eabi"
873                 aros_flavour="emulation"
874                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm -D__linux__"
875                 gcc_target_cpu="arm"
876                 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"
877                 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"
878                 aros_arch_libs="-laeabi"
879                 android_tool_dir_prefix="arm-linux-androideabi"
880                 android_tool_prefix="arm-linux-androideabi"
881                 android_ndk_arch="arm"
882                 ;;
883             *)
884                 AC_MSG_ERROR("Unknown CPU for Linux -- $target_cpu")
885                 ;;
886         esac
887         case "$aros_target_variant" in
888             android)
890                 dnl Not all Linux CPUs are supported by Android
891                 if test "$android_ndk_arch" = ""; then
892                     AC_MSG_ERROR("Unsupported CPU for Android -- $target_cpu")
893                 fi
895                 aros_default_wbwidth=320
896                 aros_default_wbheight=480
897                 if test "$aros_android_ndk" = "none"; then
898                     dnl Use standalone toolchain, don't adjust paths
899                     aros_kernel_cflags="-mandroid"
900                     aros_kernel_ldflags="-mandroid"
901                     CFLAGS="-mandroid"
902                 else
903                     export PATH="$aros_android_ndk/toolchains/$android_tool_dir_prefix-$target_tool_version/prebuilt/$android_build_os/bin:$PATH"
904                     aros_android_ndk="$aros_android_ndk/platforms/android-$aros_ndk_version/arch-$android_ndk_arch"
905                     aros_kernel_cflags="--sysroot $aros_android_ndk -mandroid"
906                     aros_kernel_ldflags="--sysroot $aros_android_ndk -mandroid"
907                     CFLAGS="$CFLAGS --sysroot $aros_android_ndk -mandroid"
908                     aros_kernel_includes="-isystem $aros_android_ndk/usr/include"
909                 fi
910                 need_x11=no
911                 dnl (Ab)use $(X11_HIDD_TARGET) as "Default display driver target"
912                 dnl in order not to fill mmakefiles with garbage
913                 x11_hidd_target=kernel-hidd-androidgfx-kobj
914                 target_tool_prefix="$android_tool_prefix-"
915             ;;
916         esac
917     ;;
919     pc)
920         aros_target_arch="pc"
921         aros_shared_default="no"
922         target_bootloader="grub2"
923         case "$target_cpu" in
924             *i?86*)
925                 aros_target_cpu="i386"
927                 dnl If somebody hasn't already set the target object
928                 dnl format, then use this value. Mostly to support
929                 dnl FreeBSD cross-compilation.
930                 dnl TODO: Remove when we always use our compiler.
932                 if test "$aros_object_format" = "" ; then
933                     aros_object_format="elf_i386"
934                 fi
935                 aros_flavour="standalone"
936                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
937                 aros_config_cflags="$aros_config_cflags -m32 -march=i486"
938                 aros_kernel_cflags="$aros_kernel_cflags -m32 -march=i486"
939                 aros_config_aflags="$aros_config_aflags -m32 -march=i486"
940                 aros_config_ldflags="-m32 -march=i486"
941                 aros_kernel_ldflags="-melf_i386"
942                 aros_default_wbwidth=640
943                 aros_default_wbheight=480
944                 gcc_target_cpu="i386"
945                 ;;
946             *x86_64*)
947                 aros_target_cpu="x86_64"
948                 aros_serial_debug=1
949                 if test "$aros_object_format" = "" ; then
950                     aros_object_format="elf_x86_64"
951                 fi
952                 aros_flavour="standalone"
953                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
954                 aros_config_cflags="$aros_config_cflags -fno-asynchronous-unwind-tables -mno-red-zone -fno-omit-frame-pointer"
955                 aros_kernel_ldflags=""
956                 aros_default_wbwidth=640
957                 aros_default_wbheight=480
958                 ;;
959             *)
960                 AC_MSG_ERROR("Unknown native CPU -- $target_cpu")
961                 ;;
962         esac
963         ;;
965     prep)
966         aros_target_arch="prep"
967         aros_shared_default="no"
968         aros_target_cpu="ppc"
969         aros_object_format="elf32ppc"
970         aros_flavour="ppcnative"
971         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
972         aros_kernel_ldflags=""
973         aros_default_wbwidth=640
974         aros_default_wbheight=480
975         gcc_target_cpu="ppc"
976         ;;
978     freebsd*)
979         aros_target_arch="freebsd"
980         aros_target_family="unix"
981         aros_target_cpu="i386"
982         aros_flavour="emulation"
983         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
984         gcc_target_cpu="i386"
986         aros_target_strip_flags="-x"
987         ;;
989     darwin*)
990         aros_target_arch="darwin"
991         aros_target_family="unix"
992         aros_flavour="emulation"
993         case "$target_cpu" in
994             *i?86*)
995                 aros_ios_platform="iPhoneSimulator"
996                 aros_target_cpu="i386"
997                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
998                 aros_kernel_ldflags=""
999                 aros_macosx_version="10.4"
1000                 aros_default_wbdepth=8
1001                 gcc_target_cpu="i386"
1002                 aros_object_format="elf_i386"
1003                 aros_kernel_ar_flags="-cr"
1004                 aros_target_strip_flags="-x"
1005                 target_tool_prefix="i686-apple-darwin10-"
1006                 target_tool_flags="-m32"
1007                 ;;
1008             *x86_64*)
1009                 aros_target_cpu="x86_64"
1010                 aros_object_format="elf_x86_64"
1011                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
1012                 aros_macosx_version="10.6"
1013                 aros_config_cflags="$aros_config_cflags -fno-omit-frame-pointer"
1014                 aros_kernel_cflags="-m64"
1015                 aros_kernel_ldflags="-m64"
1016                 aros_target_cflags="-mcmodel=large"
1017                 aros_default_wbdepth=8
1018                 aros_kernel_ar="ar"
1019                 aros_kernel_ar_flags="-cr"
1020                 aros_kernel_ld="ld"
1021                 aros_kernel_ranlib="ranlib"
1022                 target_tool_prefix="i686-apple-darwin10-"
1023                 ;;
1024             *ppc*)
1025                 aros_target_cpu="ppc"
1026                 aros_object_format="elf32ppc"
1027                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1028                 aros_kernel_ldflags=""
1029                 aros_macosx_version="10.0"
1030                 aros_default_wbdepth=8
1031                 gcc_target_cpu="ppc"
1032                 aros_kernel_ar="ar"
1033                 aros_kernel_ar_flags="-cr"
1034                 aros_kernel_ld="ld -arch ppc"
1035                 aros_kernel_ranlib="ranlib -arch ppc"
1036                 target_tool_prefix="powerpc-apple-darwin10-"
1037                 ;;
1038             *arm*)
1039                 aros_ios_platform="iPhoneOS"
1040                 aros_target_cpu="arm"
1041                 aros_object_format="armelf_linux_eabi"
1042                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
1043                 aros_config_cflags="$aros_config_cflags -marm -march=armv6 -mfpu=vfp -mfloat-abi=softfp -fno-asynchronous-unwind-tables -fno-exceptions"
1044                 aros_config_aflags="$aros_config_aflags -marm -march=armv6 -mfpu=vfp -mfloat-abi=softfp -fno-asynchronous-unwind-tables -fno-exceptions"
1045                 aros_arch_libs="-laeabi"
1046                 aros_default_wbdepth=8
1047                 gcc_target_cpu="arm"
1048                 aros_kernel_ar="ar"
1049                 aros_kernel_ar_flags="-cr"
1050                 aros_kernel_ld="ld -arch arm"
1051                 aros_kernel_ranlib="ranlib -arch arm"
1052                 target_tool_prefix="arm-apple-darwin10-" 
1053                 export PATH="$aros_xcode_path/Platforms/$aros_ios_platform.platform/Developer/usr/bin:$PATH"
1054                 ;;
1055             *)
1056                 AC_MSG_ERROR("Unsupported target CPU for darwin hosted flavour -- $target_cpu")
1057                 ;;
1058         esac
1059         case "$aros_target_variant" in
1060             ios)
1061                 aros_ios_version="3.0"
1062                 aros_default_wbwidth=320
1063                 aros_default_wbheight=480
1064                 aros_ios_sdk="$aros_xcode_path/Platforms/$aros_ios_platform.platform/Developer/SDKs/$aros_ios_platform$aros_sdk_version.sdk"
1065                 target_tool_flags="$target_tool_flags -isysroot $aros_ios_sdk"
1066                 aros_kernel_includes="-isystem $aros_ios_sdk/usr/include"
1067                 need_x11=no
1068                 # This is here because it may depend on iOS or SDK version
1069                 aros_kernel_cflags="$aros_kernel_cflags -miphoneos-version-min=$aros_ios_version"
1070                 aros_kernel_ldflags="$aros_kernel_ldflags -miphoneos-version-min=$aros_ios_version"
1071                 aros_kernel_objcflags="-fobjc-abi-version=2 -fobjc-legacy-dispatch"
1072             ;;
1073             *)
1074                 aros_kernel_cflags="$aros_kernel_cflags -mmacosx-version-min=$aros_macosx_version"
1075                 aros_kernel_ldflags="$aros_kernel_ldflags -mmacosx-version-min=$aros_macosx_version"
1076             ;;
1077         esac
1078         ;;
1080     dragonfly*)
1081         aros_target_arch="dragonfly"
1082         aros_target_family="unix"
1083         aros_flavour="emulation"
1084         case "$target_cpu" in
1085             *i?86*)
1086                 aros_target_cpu="i386"
1087                 aros_object_format="elf_i386"
1088                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__DragonFly__"
1089                 ;;
1090             *x86_64*)
1091                 aros_config_cflags="$aros_config_cflags -fno-omit-frame-pointer"
1092                 aros_target_cpu="x86_64"
1093                 aros_object_format="elf_x86_64"
1094                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64 -D__DragonFly__"
1095                 ;;
1096             *)
1097                 AC_MSG_ERROR("Unknown CPU for DragonFly -- $target_cpu")
1098                 ;;
1099         esac
1100         ;;
1102     netbsd*)
1103         aros_target_arch="netbsd"
1104         aros_target_family="unix"
1105         case "$target_cpu" in
1106             *m68k*)
1107                 aros_target_cpu="m68k"
1108                 aros_object_format="m68kelf"
1109                 aros_flavour="emulcompat"
1110                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D__mc68000 -D__NetBSD__"
1111                 gcc_target_cpu="mc68000"
1112                 ;;
1113             *i?86*)
1114                 aros_target_cpu="i386"
1115                 aros_object_format="elf_i386"
1116                 aros_flavour="emulation"
1117                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__NetBSD__"
1118                 aros_default_wbdepth=8
1119                 gcc_target_cpu="i386"
1120                 ;;
1121             *)
1122                 AC_MSG_ERROR("Unknown CPU for NetBSD -- $target_cpu")
1123                 ;;
1124         esac
1125         aros_target_genmap="-Wl,-M -Xlinker >"
1126         aros_flavour="emulation"
1127         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1128         ;;   
1130     openbsd*)
1131         aros_target_arch="openbsd"
1132         aros_target_family="unix"
1133         case "$target_cpu" in
1134             *i?86*)
1135                 aros_target_cpu="i386"
1136                 aros_object_format="elf_i386"
1137                 aros_flavour="emulation"
1138                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__OpenBSD__"
1139                 gcc_target_cpu="i386"
1140                 ;;
1141             *)
1142                 AC_MSG_ERROR("Unknown CPU for OpenBSD -- $target_cpu")
1143                 ;;
1144         esac
1145         aros_target_genmap="-Wl,-M -Xlinker >"
1146         aros_target_nm_flags="-u"
1147         aros_flavour="emulation"
1148         ;;
1150     solaris*)
1151         aros_target_arch="solaris"
1152         aros_target_family="unix"
1153         case "$target_cpu" in
1154            *i?86*)
1155                aros_target_cpu="i386"
1156                aros_object_format="elf_i386"
1157                aros_flavour="emulation"
1158                aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__Solaris__"
1159                aros_default_wbdepth=8
1160                gcc_target_cpu="i386"
1161                ;;
1162             *sparc*)
1163                 aros_target_cpu="sparc"
1164                 aros_object_format="elf_sparc"
1165                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dsparc -D__Solaris__"
1166                 gcc_target_cpu="sparc"
1167                 ;;
1168             *)
1169                 AC_MSG_ERROR("Unknown CPU for Solaris -- $target_cpu")
1170                 ;;
1171         esac
1172         aros_config_cflags="$aros_config_cflags -D$aros_target_cpu"
1173         aros_flavour="emulation"
1174         ;;
1176     morphos*)
1177         aros_target_arch="morphos"
1178         aros_shared_default="no"
1179         aros_target_cpu="ppc"
1180         aros_object_format="elf_ppc"
1181         aros_flavour="nativecompat"
1182         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1183         gcc_target_cpu="ppc"
1184         ;;
1186     sam440)
1187         aros_target_arch="sam440"
1188         aros_shared_default="no"
1189         aros_target_cpu="ppc"
1190         aros_object_format="elf32ppc"
1191         aros_flavour="ppcnative"
1192         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1193         aros_kernel_ldflags=""
1194         aros_default_wbwidth=1024
1195         aros_default_wbheight=768
1196         aros_default_wbdepth=24
1197         aros_config_cflags="$aros_config_cflags -mcpu=440fp -mno-toc -fno-asynchronous-unwind-tables"
1198         gcc_target_cpu="powerpc"
1199         ;;
1201     efika)
1202         aros_target_arch="efika"
1203         aros_shared_default="no"
1204         aros_target_cpu="arm"
1205         aros_object_format="armelf_linux_eabi"
1206         aros_flavour="standalone"
1207         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
1208         aros_kernel_ldflags=""
1209         aros_default_wbwidth=1024
1210         aros_default_wbheight=600
1211         aros_arch_libs="-laeabi"
1212         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"
1213         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"
1214         ;;
1215         
1216     chrp)
1217     aros_target_arch="chrp"
1218     aros_shared_default="no"
1219     aros_target_cpu="ppc"
1220     aros_object_format="elf32ppc"
1221     aros_flavour="ppcnative"
1222     aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1223     aros_kernel_ldflags=""
1224     aros_default_wbwidth=640
1225     aros_default_wbheight=480
1226     aros_config_cflags="$aros_config_cflags -mno-toc -fno-asynchronous-unwind-tables"    
1227     gcc_target_cpu="powerpc"
1228         case "$aros_target_variant" in
1229             efika)
1230             aros_config_cflags="$aros_config_cflags -DBIG_ENDIAN_OHCI=1 -mcpu=603e"
1231             ;;
1232         esac
1233     ;;
1235     amiga*)
1236         aros_target_arch="amiga"
1237         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D_AMIGA -DAMIGA"
1238         aros_shared_default="no"
1240         case "$target_cpu" in
1241             *m68k*)
1242                 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")
1243                 aros_enable_mmu=no
1244                 aros_target_cpu="m68k"
1245                 aros_object_format="m68kelf"
1246                 aros_flavour="standcompat"
1247                 gcc_target_cpu="m68000"
1248                 aros_config_cflags="$aros_config_cflags -fno-strict-aliasing -ffreestanding -fomit-frame-pointer -${gcc_target_cpu} -fbuiltin -Wno-volatile-register-var -Os"
1249                 aros_config_aflags="$aros_config_aflags -${gcc_target_cpu}"
1250                 target_tool_prefix="m68k-elf-"
1251                 # Needed to get the correct multilib
1252                 aros_config_ldflags="-${gcc_target_cpu}"
1253                 aros_shared_ldflags="-${gcc_target_cpu}"
1254                 aros_kernel_ldflags="-${gcc_target_cpu}"
1255                 aros_target_nostdlib_ldflags="-${gcc_target_cpu}"
1256                 aros_target_strip_flags="-R.comment --strip-debug"
1257                 aros_default_wbwidth=640
1258                 aros_default_wbheight=256
1259                 aros_default_wbdepth=2
1260                 ;;
1261             *ppc*)
1262                 aros_cpu="ppc"
1263                 aros_flavour="native"
1264                 gcc_target_cpu="ppc"
1265                 ;;
1266             *)
1267                 AC_MSG_ERROR("Unknown CPU for Amiga $target_cpu")
1268                 ;;
1269         esac
1270         ;;
1272     mingw*)
1273         aros_target_arch="mingw32"
1274         aros_shared_default="no"
1275         aros_flavour="emulation"
1276         aros_shared_cflags=""
1277         need_dlopen="no"
1278         rescomp="windres"
1279         case "$target_cpu" in
1280             *i?86*)
1281                 aros_target_cpu="i386"
1282                 aros_object_format="elf_i386"
1283                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1284                 aros_default_wbdepth=8
1285                 gcc_target_cpu="i386"
1287                 dnl Temporary hack, needed to get nightly build working
1288                 aros_target_as="i386-aros-as"
1289                 aros_target_ar="i386-aros-ar"
1290                 aros_target_ranlib="i386-aros-ranlib"
1291                 aros_target_nm="i386-aros-nm"
1292                 aros_target_strip="i386-aros-strip"
1293                 aros_target_objcopy="i386-aros-objcopy"
1294                 aros_target_objdump="i386-aros-objdump"
1296                 target_tool_prefix="i386-mingw32-"
1297                 ;;
1298             *x86_64*)
1299                 aros_target_cpu="x86_64"
1300                 aros_object_format="elf_x86_64"
1301                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
1302                 aros_config_cflags="$aros_config_cflags -fno-omit-frame-pointer"
1303                 aros_default_wbdepth=8
1304                 target_tool_prefix="x86_64-w64-mingw32-"
1305                 ;;
1306             *arm*)
1307                 aros_target_cpu="arm"
1308                 aros_object_format="armelf_linux_eabi"
1309                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
1310                 aros_arch_libs="-laeabi"
1311                 aros_default_wbdepth=8
1312                 gcc_target_cpu="arm"
1313                 target_tool_prefix="arm-mingw32ce-"
1314                 aros_default_wbwidth=160
1315                 aros_default_wbheight=160
1316                 ;;
1317             *)
1318                 AC_MSG_ERROR("Unknown CPU for Mingw32 -- $target_cpu")
1319                 ;;
1320         esac
1321         if test $host_os = "cygwin"; then
1322                 aros_kernel_cflags="-mno-cygwin"
1323         fi
1324     ;;
1325     pp*)
1326         aros_target_arch="pp"
1327         aros_shared_default="no"
1328         case "$target_cpu" in
1329             *m68k*)
1330                 aros_target_cpu="m68k"
1331                 aros_object_format="m68kelf"
1332                 aros_flavour="palmnative"
1333                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
1334                 aros_default_wbwidth=160
1335                 aros_default_wbheight=160
1336                 aros_default_wbdepth=1
1337                 aros_target_ar_flags="cru"
1338                 aros_compiler_libs="-lgcc1"
1339                 aros_shared_default=no
1340                 aros_shared_cflags="-fpic"
1341                 aros_shared_aflags=""
1342                 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
1343                 aros_kernel_ldflags="-Wl,-rpath,./lib"
1344                 aros_debug_cflags="$aros_symbols_debug  $aros_messages_debug -mc68000 -Wa,-mc68000"
1345                 aros_debug_aflags=""
1346                 aros_debug_ldflags="$aros_symbols_debug"
1347                 aros_mungwall_debug="0"
1348                 aros_modules_debug="0"
1349                 gcc_target_cpu="mc68000"
1350                 ignore_undefined_symbols="-ius"
1351                 ;;
1352            *)
1353                 AC_MSG_ERROR("Unknown CPU for PalmPilot -- $target_cpu")
1354                 ;;
1355         esac
1356         ;;
1358     mac*)
1359         aros_target_arch="mac"
1360         aros_shared_default="no"
1361         case "$target_cpu" in
1362             *m68k*)
1363                 aros_target_cpu="m68k"
1364                 aros_object_format="m68kelf"
1365                 aros_flavour="mac68knative"
1366                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
1367                 aros_default_wbwidth=512
1368                 aros_default_wbheight=384
1369                 aros_default_wbdepth=8
1370                 aros_target_ar_flags="cru"
1371                 aros_compiler_libs="-lgcc1"
1372                 aros_shared_default=no
1373                 aros_shared_cflags="-fpic"
1374                 aros_shared_aflags=""
1375                 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
1376                 aros_kernel_ldflags="-Wl,-rpath,./lib"
1377                 aros_debug_cflags="$aros_symbols_debug $aros_messages_debug -mc68000"
1378                 aros_debug_aflags=""
1379                 aros_debug_ldflags="$aros_symbols_debug"
1380                 aros_mungwall_debug="0"
1381                 aros_modules_debug="0"
1382                 gcc_target_cpu="mc68000"
1383                 ignore_undefined_symbols="-ius"
1384                 ;;
1385            *)
1386                 AC_MSG_ERROR("Unknown CPU for Mac68k -- $target_cpu")
1387                 ;;
1388         esac
1389         ;;
1391     *)
1392         AC_MSG_ERROR([Unsupported target architecture $target])
1393         ;;
1394 esac
1396 # Some formats need custom ELF specs.
1397 # For example for x86_64 it is needed in order for -m32 switch to work correctly.
1398 if test -f $SRCDIR/config/${aros_object_format}-specs.in; then
1399     elf_specs_in=config/${aros_object_format}-specs.in
1400 else
1401     elf_specs_in=config/elf-specs.in
1404 #-----------------------------------------------------------------------------
1405 AC_MSG_CHECKING([where to install or search for cross tools binaries])
1406 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")
1407 if test "$with_crosstools" = "default"; then
1408     AROS_CROSSTOOLSDIR="$AROS_BUILDDIR_UNIX/bin/$aros_host_arch-$aros_host_cpu/tools/crosstools"
1409 else
1410     AROS_CROSSTOOLSDIR="$with_crosstools"
1412 AC_MSG_RESULT($AROS_CROSSTOOLSDIR)
1414 if test "$crosstools" != "no" -o "$with_crosstools" != "default"; then
1416     dnl --with-crosstools with no --enable-crosstools implies --with-aros-gcc with no version specified
1417     dnl The same is about --enable-crosstools
1419     use_aros_gcc=yes
1420     PATH=$AROS_CROSSTOOLSDIR:$PATH
1423 AC_MSG_CHECKING([what specific AROS gcc version to use])
1424 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")
1425 case "$aros_gcc_version" in
1426 yes)
1427     aros_gcc_version="default"
1428     ;;
1430     aros_gcc_version="none"
1431     ;;
1432 esac
1433 AC_MSG_RESULT($aros_gcc_version)
1435 if test "$aros_gcc_version" != "none"; then
1437     dnl Here we either build own crosstools, or use preinstalled ones
1438     dnl Check for specific version requested, and append suffix if needed
1440     if test "$aros_gcc_version" != "default"; then
1441         aros_target_cc="$aros_target_cpu-aros-gcc-$aros_gcc_version"
1442         aros_target_cxx="$aros_target_cpu-aros-g++-$aros_gcc_version"
1443     else
1444         aros_target_cc="$aros_target_cpu-aros-gcc"
1445         aros_target_cxx="$aros_target_cpu-aros-g++"
1446     fi
1448     aros_target_ld="$aros_target_cpu-aros-ld"
1449     aros_target_as="$aros_target_cpu-aros-as"
1450     aros_target_ar="$aros_target_cpu-aros-ar"
1451     aros_target_ranlib="$aros_target_cpu-aros-ranlib"
1452     aros_target_nm="$aros_target_cpu-aros-nm"
1453     aros_target_strip="$aros_target_cpu-aros-strip"
1454     aros_target_objcopy="$aros_target_cpu-aros-objcopy"
1455     aros_target_objdump="$aros_target_cpu-aros-objdump"
1458 # Some compilers (ppc-elf-gcc is known to) have CPU defines in specs
1459 # Since we override specs, we may need to put these defines there
1460 if test "$gcc_target_cpu" != ""; then
1461     gcc_target_cpu="-D__${gcc_target_cpu}__"
1464 AC_MSG_CHECKING([where to download sourcecode for external ports])
1465 AC_ARG_WITH(portssources,AC_HELP_STRING([--with-portssources=DIR],[Where to download sourcecode for external ports]),with_portssrcdir=$withval,with_portssrcdir="default")
1466 if test "$with_portssrcdir" = "default"; then
1467     AROS_PORTSSRCDIR="$AROS_BUILDDIR_UNIX/bin/Sources"
1468 else
1469     AROS_PORTSSRCDIR="$with_portssrcdir"
1471 AC_MSG_RESULT($AROS_PORTSSRCDIR)
1473 AC_MSG_CHECKING([which bootloader to use])
1474 AC_ARG_WITH(bootloader,AC_HELP_STRING([--with-bootloader=NAME],[Use a specific bootloader]),target_bootloader=$withval,target_bootloader=$target_bootloader)
1475 if test "$target_bootloader" = "none"; then
1476     aros_target_bootloader=""
1477 else
1478     aros_target_bootloader="$target_bootloader"
1480 AC_MSG_RESULT($target_bootloader)
1482 AC_MSG_CHECKING([which icon-set to use])
1483 AC_ARG_WITH(iconset,AC_HELP_STRING([--with-iconset=NAME],[Use a specific Icon-set (default=Gorilla).]),target_iconset=$withval,target_iconset="default")
1484 if test "$target_iconset" = "default"; then
1485     aros_target_iconset="Gorilla"
1486     target_iconset="default (Gorilla)"
1487 else
1488     aros_target_iconset="$target_iconset"
1490 AC_MSG_RESULT($target_iconset)
1492 AC_MSG_CHECKING([which GUI Theme to use])
1493 AC_ARG_WITH(theme,AC_HELP_STRING([--with-theme=NAME],[Use a specific GUI Theme]),target_guitheme=$withval,target_guitheme="default")
1494 if test "$target_guitheme" = "default"; then
1495     aros_target_guitheme="Ice"
1496 else
1497     aros_target_guitheme="$target_guitheme"
1499 AC_MSG_RESULT($aros_target_guitheme)
1501 # Find out if we are cross-compiling (i.e. if we can't use the host compiler
1502 # for target code)
1503 cross_compiling=no
1504 if test "$aros_host_cpu" != "$aros_target_cpu" ; then
1505     cross_compiling=yes
1508 dnl Native x86-64 Linux toolchain can also produce i386 binaries, given -m32 flag.
1509 if test "$aros_host_cpu" == "x86_64" ; then
1510     if test "$aros_target_cpu" == "i386" ; then
1511         if test "$aros_target_arch" != "mingw32"; then
1512             cross_compiling=no
1513         fi
1514     fi
1517 dnl Enforce cross-compile if we are on Darwin, but our target is not Darwin.
1518 if test "$aros_host_arch" == "darwin" ; then
1519     if test "$aros_target_arch" != "darwin" ; then
1520         cross_compiling=yes
1521     fi
1524 dnl The same for MinGW
1525 if test "$aros_host_arch" == "mingw32" ; then
1526     if test "$aros_target_arch" != "mingw32" ; then
1527         cross_compiling=yes
1528     fi
1531 # I want to have this information in configure output, although it might be
1532 # misleading, e.g. for darwin hosted you cannot compile target code without a
1533 # cross compiler, but here it says no.
1535 # Note: it says 'yes' only if bootstrap ("kernel") is cross-compiled.
1536 # Target code is a little bit different thing.
1537 #                                                sonic
1538 echo "checking wether we are (AROS style) cross compiling... $cross_compiling"
1540 # Set prefix for target compiler etc. if we're cross-compiling
1541 # (should possibly be earlier but needs to be after AC_PROG_CC)
1542 if test "$cross_compiling" = "yes" ; then
1544     if test "x-$aros_flavour" = "x-standalone" -o "x-$aros_flavour" = "x-standcompat" ; then
1545         if test "$aros_gcc_version" != "none"; then
1547             dnl If we are cross-compiling a native port with AROS compiler, we can reuse
1548             dnl AROS compiler for bootstrap ("kernel"). This eliminates a need for one more
1549             dnl ELF compiler.
1551             dnl Use target toolchain as bootstrap one.
1552             target_tool_prefix=${target_cpu}-aros-
1553             target_tool_version=$aros_gcc_version
1554             use_kernel_cc_wrapper=yes
1556             dnl Cancel explicit AROS tools assignment. This will cause configure
1557             dnl to select the same tools for bootstrap and AROS.
1558             aros_target_cc=
1559             aros_target_ld=
1560             aros_target_as=
1561             aros_target_ar=
1562             aros_target_ranlib=
1563             aros_target_nm=
1564             aros_target_strip=
1565             aros_target_objcopy=
1566             aros_target_objdump=
1567         fi
1568     fi
1570     CC=${target_tool_prefix}gcc
1571     dnl CPP is needed for AC_CHECK_HEADER to work correctly
1572     CPP=${target_tool_prefix}cpp
1573     if test "$target_tool_version" != "default"; then
1574         CC="$CC-$target_tool_version"
1575         CPP="$CC-$target_tool_version"
1576     fi
1577     if test "$crosstools" != "yes" ; then
1578         AC_PATH_PROG(CC,$CC)
1579         AROS_REQUIRED(gcc,$CC)
1580     else
1581         CC=$AROS_CROSSTOOLSDIR/$CC
1582     fi
1584 CC="$CC $target_tool_flags"
1586 #-----------------------------------------------------------------------------
1588 # Disable pointer-signedness warnings if the compiler recognises the option
1590 AC_MSG_CHECKING([whether ${CC} accepts -Wno-pointer-sign])
1591 save_cflags="$CFLAGS"
1592 if test "$crosstools" != "yes" ; then
1593     CFLAGS="$CFLAGS -Wno-pointer-sign"
1594     AC_TRY_COMPILE(,, use_no_sign_warning="yes", use_no_sign_warning="no")
1595 else
1596     # we do know it is supported for the smallest version of gcc we are going to build
1597     # we assume it's also supported by later versions
1598     use_no_sign_warning=yes
1600 AC_MSG_RESULT($use_no_sign_warning)
1601 if test "x-$use_no_sign_warning" = "x-yes" ; then
1602     aros_config_cflags="$aros_config_cflags -Wno-pointer-sign"
1604 CFLAGS="$save_cflags"
1606 #-----------------------------------------------------------------------------
1608 # Find all the tools we need to compile. This could be cross-compiling
1609 # though! If that is the case we use the GNU form of the target and
1610 # simply add this to the front of the binary name. This is rather simple,
1611 # but it should work under most circumstances.
1613 # The default tools are to use the same as the host, but only if the
1614 # host and target CPU are the same. With GCC this is normally enough.
1617 aros_cc_pre=""
1618 aros_shared_ld="$aros_host_ld"
1620 aros_target_mkdep="$aros_host_mkdep"
1621 aros_target_incl_def="$aros_host_incl"
1623 aros_kernel_cc="$CC"
1625 # The default tools executables to be linked to.
1626 if test "$rescomp" != ""; then
1627     if test "$cross_compiling" = "yes" ; then
1628         rescomp=${target_tool_prefix}${rescomp}
1629     fi
1630     AC_PATH_PROG(aros_kernel_rescomp,$rescomp)
1631     AROS_REQUIRED($rescomp,$aros_kernel_rescomp)
1634 if test "$crosstools" != "yes"; then
1635     AROS_TOOL_TARGET(aros_kernel_ld,ld,$aros_kernel_ld)
1636     AROS_REQUIRED(ld,$aros_kernel_ld)
1637     AROS_TOOL_TARGET(aros_kernel_ar,ar,$aros_kernel_ar)
1638     AROS_REQUIRED(ld,$aros_kernel_ar)
1639     AROS_TOOL_TARGET(aros_kernel_ranlib,ranlib,$aros_kernel_ranlib)
1640     AROS_REQUIRED(ld,$aros_kernel_ranlib)
1642     dnl For non-ELF hosts we additionally have to look up ELF toolchain for AROS binaries
1643     dnl It can be either AROS toolchain selected earlier or generic ELF toolchain we select here.
1644     dnl This catches also Android-hosted case. Android gcc is a ELF compiler, but it can't be used
1645     dnl to build AROS binaries, at least on ARM. Android EABI is different from AROS EABI
1646     dnl (at least enum size is known to be different).
1647     if test "$target_tool_prefix" != "${target_cpu}-elf-" -a "$target_tool_prefix" != "${target_cpu}-aros-" ; then
1648         target_tool_prefix=${target_cpu}-elf-
1649         if test "$aros_target_cc" == ""; then
1650            aros_target_cc="${target_tool_prefix}gcc"
1651         fi
1652         if test "$aros_target_ld" == ""; then
1653            aros_target_ld="${target_tool_prefix}ld"
1654         fi
1655     fi
1656     AROS_TOOL_TARGET(aros_target_as_ln,as,$aros_target_as)
1657     AROS_REQUIRED(as,$aros_target_as_ln)
1658     AROS_TOOL_TARGET(aros_target_ar_ln,ar,$aros_target_ar)
1659     AROS_REQUIRED(ar,$aros_target_ar_ln)
1660     AROS_TOOL_TARGET(aros_target_nm_ln,nm,$aros_target_nm)
1661     AROS_REQUIRED(nm,$aros_target_nm_ln)
1662     AROS_TOOL_TARGET(aros_target_objcopy_ln,objcopy,$aros_target_objcopy)
1663     AROS_REQUIRED(objcopy,$aros_target_objcopy_ln)
1664     AROS_TOOL_TARGET(aros_target_objdump_ln,objdump,$aros_target_objdump)
1665     AROS_REQUIRED(objdump,$aros_target_objdump_ln)
1666     AROS_TOOL_TARGET(aros_target_ranlib_ln,ranlib,$aros_target_ranlib)
1667     AROS_REQUIRED(ranlib,$aros_target_ranlib_ln)
1668     AROS_TOOL_TARGET(aros_target_strip_ln,strip,$aros_target_strip)
1669     AROS_REQUIRED(strip,$aros_target_strip_ln)
1670     if test "$aros_target_cxx" != ""; then
1671         AC_PATH_PROG(aros_target_cxx,$aros_target_cxx)
1672         AROS_REQUIRED(c++,$aros_target_cxx)
1673     fi
1674 else
1675     aros_target_cc=$AROS_CROSSTOOLSDIR/$aros_target_cc
1676     aros_target_cxx=$AROS_CROSSTOOLSDIR/$aros_target_cxx
1677     aros_target_as_ln=$AROS_CROSSTOOLSDIR/$aros_target_as
1678     aros_target_ar_ln=$AROS_CROSSTOOLSDIR/$aros_target_ar
1679     aros_target_nm_ln=$AROS_CROSSTOOLSDIR/$aros_target_nm
1680     aros_target_objcopy_ln=$AROS_CROSSTOOLSDIR/$aros_target_objcopy
1681     aros_target_objdump_ln=$AROS_CROSSTOOLSDIR/$aros_target_objdump
1682     aros_target_ranlib_ln=$AROS_CROSSTOOLSDIR/$aros_target_ranlib
1683     aros_target_strip_ln=$AROS_CROSSTOOLSDIR/$aros_target_strip
1685     if test "$target_tool_prefix" != "${target_cpu}-aros-" ; then
1686         AROS_TOOL_TARGET(aros_kernel_ld,ld,$aros_kernel_ld)
1687         AROS_REQUIRED(ld,$aros_kernel_ld)
1688         AROS_TOOL_TARGET(aros_kernel_ar,ar,$aros_kernel_ar)
1689         AROS_REQUIRED(ld,$aros_kernel_ar)
1690         AROS_TOOL_TARGET(aros_kernel_ranlib,ranlib,$aros_kernel_ranlib)
1691         AROS_REQUIRED(ld,$aros_kernel_ranlib)
1692     else
1693         aros_kernel_ar=$AROS_CROSSTOOLSDIR/$aros_target_ar
1694         aros_kernel_ld=$AROS_CROSSTOOLSDIR/$aros_target_ld
1695         aros_kernel_ranlib=$AROS_CROSSTOOLSDIR/$aros_target_ranlib
1696     fi
1698     crosstools_target=tools-crosstools
1701 aros_kernel_ar="$aros_kernel_ar $aros_kernel_ar_flags"
1703 orig_target_cc=$aros_kernel_cc
1704 orig_target_ld=$aros_kernel_ld
1706 if test "$crosstools" != "yes"; then
1707     if test "$aros_target_cc" != ""; then
1708         AC_PATH_PROG(aros_target_cc,$aros_target_cc)
1709         AROS_REQUIRED(gcc,$aros_target_cc)
1710         orig_target_cc=$aros_target_cc
1711     fi
1712     if test "$aros_target_ld" != ""; then
1713         AC_PATH_PROG(aros_target_ld,$aros_target_ld)
1714         AROS_REQUIRED(ld,$aros_target_ld)
1715         orig_target_ld=$aros_target_ld
1716     fi
1717 else
1718     orig_target_cc=$aros_target_cc
1719     orig_target_ld=$aros_target_ld
1722 # Build crosstools if we have no C++ - temporary thing 
1723 if test "$aros_target_cxx" = "" -a "$crosstools" != "yes"; then
1724     crosstools_cxx_target=tools-crosstools
1727 aros_hostcfg_dir="bin/${aros_host_arch}-${aros_host_cpu}/gen/config"
1728 aros_targetcfg_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/config"
1729 aros_inc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/AROS/Development/include/aros"
1730 aros_gendir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen"
1731 aros_geninc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/include/aros"
1732 aros_tools_dir="bin/${aros_host_arch}-${aros_host_cpu}/tools"
1733 aros_scripts_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/scripts"
1735 # aros_cc_pre is a variable that is added to the front of the compiler name
1736 # in the generated aros-gcc shell script. We need this to enable the cache
1737 # to work across cleaned builds. Also, support DISTCC using the correct
1738 # environment variable.
1741 if test "x${DISTCC}" != "x" ; then
1742     if test "x${CCACHE}" != "x" ; then
1743         aros_cc_pre="env CCACHE_PREFIX=${DISTCC} ${CCACHE} "
1744     else
1745         aros_cc_pre="${DISTCC} "
1746     fi
1747 else
1748     if test "x${CCACHE}" != "x" ; then
1749         aros_cc_pre="${CCACHE} "
1750     fi
1753 prefix="${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros"
1755 AC_SUBST(aros_target_nostdinc_cflags,-nostdinc)
1756 AC_SUBST(aros_target_nostartup_ldflags,-nostartfiles)
1757 AC_SUBST(aros_target_nix_ldflags,-nix)
1758 AC_SUBST(aros_target_detach_ldflags,-detach)
1759 AC_SUBST(aros_target_nostdlib_ldflags,-nostdlib)
1761 # Target tools
1762 if test "$crosstools" != "yes"; then
1763     if test "$GCC" = "yes"; then
1764         aros_target_cc_path=`$orig_target_cc -print-search-dirs | grep "programs: =" | cut -c 12-`
1765     fi
1766 else
1767     # We do not know which gcc version we are going to build and what we need to know
1768     # here is different for different versions so this will be set later during the
1769     # build of crosstools.
1770     aros_target_cc_path=@aros_target_cc_path@
1772 aros_target_cc="${prefix}-gcc"
1773 aros_target_as="${prefix}-as"
1774 aros_target_ld="${prefix}-ld"
1775 aros_target_ar="${prefix}-ar $aros_target_ar_flags"
1776 aros_target_objcopy=${prefix}-objcopy
1777 aros_target_objdump=${prefix}-objdump
1778 aros_target_ranlib="${prefix}-ranlib $aros_target_ranlib_flags"
1779 aros_target_nm="${prefix}-nm $aros_target_nm_flags"
1780 aros_target_strip=${prefix}-strip
1781 aros_plain_nm="${prefix}-nm"
1782 aros_plain_ar="${prefix}-ar"
1784 # Find the system include path. We can suggest that an alternative is
1785 # used if we don't get it correct. The default is to use /usr/include.
1786 # Which is set in the aros_target_incl_def variable.
1788 AC_ARG_ENABLE(includes,
1789 AC_HELP_STRING([--enable-includes=dir],[Alternative system include directory]),
1790 [aros_target_incl=$enable_includes], [aros_target_incl=$aros_target_incl_def])
1792 if test "$aros_kernel_includes" = ""; then
1793     if test "x-$aros_flavour" = "x-emulation" -o "x-$aros_flavour" = "x-emulcompat" ; then
1794         # FIXME: for cross-compiling this should point to another location
1795         aros_kernel_includes="-isystem $aros_target_incl"
1796     fi
1799 if test "$aros_kernel_includes" != "" ; then
1800     dnl find out about the kernel cc's include path
1801     AC_MSG_CHECKING([for the kernel compiler's include path])
1802     if test "$aros_kernel_cc_includes" = "" ; then
1803         # Try to guess where the directory is.
1804         aros_kernel_cc_includes=`dirname \`${aros_kernel_cc} ${aros_kernel_cflags} -print-libgcc-file-name\``/include
1805         if test -d $aros_kernel_cc_includes; then
1806             # Check if there is also an include-fixed directory and add it
1807             # to kernel compiler's include path as it may contain some of
1808             # the headers we need.
1809             if test -d "$aros_kernel_cc_includes"-fixed; then
1810                 aros_kernel_cc_includes+=" -isystem $aros_kernel_cc_includes"-fixed
1811             fi
1812             # Check for specific includes directory. Neede for Ubuntu 11.10
1813             if test -d "/usr/include/i386-linux-gnu"; then
1814                 aros_kernel_cc_includes+=" -isystem /usr/include/i386-linux-gnu"
1815             fi
1816         else
1817             # The directory doesn't exist, we need to do some more work.
1818             aros_kernel_cc_includes=${PWD}/${aros_gendir}/cc_include
1820             # These are the headers we're looking for.
1821             headers="limits.h mmintrin.h stdbool.h syslimits.h float.h \
1822                      stddef.h xmmintrin.h iso646.h stdarg.h unwind.h   \
1823                      zutil.h"
1825             dnl This is for Darwin.
1826             dnl With XCode4.1 Apple thought it's a nice idea to move stdint.h away
1827             dnl to some very specific location
1828             if test ! -f $aros_target_incl/stdint.h; then
1829                 headers="$headers stdint.h"
1830             fi
1832             dirs=
1833             for h in $headers; do
1834                 # Which other headers are needed by each of the above?
1835                 deps=$(echo "#include <$h>" | \
1836                        $aros_kernel_cc -E -M - 2>/dev/null | \
1837                        sed 's/^.*://; s/\\$/ /g; s/[[ \t]]\+/ /g')
1839                 # Copy all the needed headers to a directory beneath gendir.
1840                 for d in $deps; do
1841                     h=$(basename $d)
1842                     dir=${aros_kernel_cc_includes}$(echo $(dirname $d) | \
1843                                                 sed -n "s,^.*/include\(/.*\),\1,p")
1844                     ! test -d $dir && mkdir -p $dir
1845                     ! test -f $dir/$h && { cp $d $dir; chmod u+w $dir/$h; }
1846                 done
1847             done            
1848         fi
1849     fi
1850     AC_MSG_RESULT($aros_kernel_cc_includes)
1851     # Adding -nostdinc to kernel includes as they are always used together.
1852     aros_kernel_includes="$aros_kernel_includes $aros_target_nostdinc_cflags -isystem $aros_kernel_cc_includes"
1855 if test "$crosstools" != "yes"; then
1856     dnl find out about the target cc's include path
1857     AC_MSG_CHECKING([for the target compiler's include path])
1858     if test "$aros_target_cc_includes" = "" ; then
1859         #try to guess where the directory is
1860         aros_target_cc_includes=`dirname \`${orig_target_cc} -print-libgcc-file-name\``/include
1861         if ! test -d $aros_target_cc_includes; then
1862             #the directory doesn't exist, we need to do some more work
1863             aros_target_cc_includes=${PWD}/${aros_gendir}/cc_include
1864         
1865             #these are the headers we're looking for
1866             headers="limits.h mmintrin.h stdbool.h syslimits.h float.h \
1867                     stddef.h xmmintrin.h iso646.h stdarg.h unwind.h   \
1868                     zutil.h"
1870             dirs=
1871             for h in $headers; do
1872                 #which other headers each of the above headers needs?
1873                 deps=$(echo "#include <$h>" | \
1874                     $orig_target_cc -E -M - 2>/dev/null | \
1875                     sed 's/^.*://; s/\\$/ /g; s/[[ \t]]\+/ /g')
1876             
1877                 #copy all the needed headers to a directory beneath gendir
1878                 for d in $deps; do
1879                     h=$(basename $d)
1880                     dir=${aros_target_cc_includes}$(echo $(dirname $d) | \
1881                                                 sed -n "s,^.*/include\(/.*\),\1,p")
1882                     ! test -d $dir && mkdir -p $dir
1883                     ! test -f $dir/$h && { cp $d $dir; chmod u+w $dir/$h; }
1884                 done
1885             done
1886         fi
1887     fi
1888     AC_MSG_RESULT($aros_target_cc_includes)
1889 else
1890     # We do not know which gcc version we are going to build and what we need to know
1891     # here is different for different versions so this will be set later during the
1892     # build of crosstools.
1893     aros_target_cc_includes=@aros_target_cc_includes@
1897 # For GCC < 4.0 -I- is used for giving the search path for '#include "..."'
1898 # On GCC >= 4.0 -iquote should be used
1901 save_cc="$CC"
1902 save_cflags="$CFLAGS"
1903 CFLAGS="-iquote."
1904 AC_MSG_CHECKING([whether ${CC} accepts -iquote])
1905 if test "x-$crosstools" != "x-yes"; then
1906     AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
1907 else
1908     # we do know it is supported for the smallest version of gcc we are going to build
1909     # we assume it's also supported by later versions
1910     has_iquote=yes
1912 AC_MSG_RESULT($has_iquote)
1913 if test "x-$has_iquote" = "x-yes" ; then
1914     host_cflags_iquote=-iquote
1915     host_cflags_iquote_end=
1916 else
1917     host_cflags_iquote=-I
1918     host_cflags_iquote_end=-I-
1920 kernel_cflags_iquote=$host_cflags_iquote
1921 kernel_cflags_iquote_end=$host_cflags_iquote_end
1922 if test "x-$cross_compiling" = "x-yes"; then
1923     CC="$aros_kernel_cc"
1924     AC_MSG_CHECKING([whether ${CC} accepts -fno-stack-protector])
1925     if test "x-$crosstools" != "x-yes"; then
1926         AC_TRY_COMPILE(,, use_no_stack_protector="yes", use_no_stack_protector="no")
1927     else
1928         # we do know it is supported for the smallest version of gcc we are going to build
1929         # we assume it's also supported by later versions
1930         use_no_stack_protector=yes
1931     fi
1932     AC_MSG_RESULT($use_no_stack_protector)
1933     AC_MSG_CHECKING([whether ${CC} accepts -iquote])
1934     if test "x-$crosstools" != "x-yes"; then
1935         AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
1936     else
1937         # we do know it is supported for the smallest version of gcc we are going to build
1938         # we assume it's also supported by later versions
1939         has_iquote=yes
1940     fi
1941     AC_MSG_RESULT($has_iquote)
1942     if test "x-$has_iquote" = "x-yes" ; then
1943         kernel_cflags_iquote=-iquote
1944         kernel_cflags_iquote_end=
1945     else
1946         kernel_cflags_iquote=-I
1947         kernel_cflags_iquote_end=-I-
1948     fi
1950 aros_cflags_iquote=$kernel_cflags_iquote
1951 aros_cflags_iquote_end=$kernel_cflags_iquote_end
1952 if test "$orig_target_cc" != "$aros_kernel_cc"; then
1953     CC="$orig_target_cc"
1954     AC_MSG_CHECKING([whether ${CC} accepts -iquote])
1955     if test "x-$crosstools" != "x-yes"; then
1956         AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
1957     else
1958         # we do know it is supported for the smallest version of gcc we are going to build
1959         # we assume it's also supported by later versions
1960         has_iquote=yes
1961     fi
1962     AC_MSG_RESULT($has_iquote)
1963     if test "x-$has_iquote" = "x-yes" ; then
1964         aros_cflags_iquote=-iquote
1965         aros_cflags_iquote_end=
1966     else
1967         aros_cflags_iquote=-I
1968         aros_cflags_iquote_end=-I-
1969     fi
1971 if test "x-$use_no_stack_protector" = "x-yes" ; then
1972     aros_kernel_cflags="$aros_kernel_cflags -fno-stack-protector"
1975 #-----------------------------------------------------------------------------
1977 # Check if we can explicitly choose older version of symbol hashing
1979 CFLAGS="save_cflags -Wl,--hash-style=sysv"
1980 CC="$aros_kernel_cc"
1981 AC_MSG_CHECKING([whether ${CC} accepts -Wl,--hash-style=sysv])
1982 AC_TRY_LINK(,, use_hash_style="yes", use_hash_style="no")
1983 AC_MSG_RESULT($use_hash_style)
1984 if test "x-$use_hash_style" = "x-yes" ; then
1985     aros_kernel_cflags="$aros_kernel_cflags -Wl,--hash-style=sysv"
1987 CC="$save_cc"
1988 CFLAGS="$save_cflags"
1990 AC_SUBST(host_cflags_iquote)
1991 AC_SUBST(host_cflags_iquote_end)
1992 AC_SUBST(kernel_cflags_iquote)
1993 AC_SUBST(kernel_cflags_iquote_end)
1994 AC_SUBST(aros_cflags_iquote)
1995 AC_SUBST(aros_cflags_iquote_end)
1998 dnl Check if user specified --with-resolution=XRESxYRESxDEPTH
1999 AC_MSG_CHECKING([for default resolution of WBScreen])
2000 AC_ARG_WITH(resolution,AC_HELP_STRING([--with-resolution=XRESxYRESxDEPTH],[Default resolution of the initial WorkbenchScreen]),resolution=$withval,resolution=none)
2001 # We require an argument, so map --with/--without ("yes"/"no") to "none" specified
2002 if test "$resolution" = "yes" ; then
2003     resolution="none"
2005 if test "$resolution" = "no" ; then
2006     resolution="none"
2008 if test "$resolution" != "none" ; then
2009     aros_default_wbwidth=`echo $resolution | cut -d'x' -f1`
2010     aros_default_wbheight=`echo $resolution | cut -d'x' -f2`
2011     aros_default_wbdepth=`echo $resolution | cut -d'x' -f3`
2013 AC_MSG_RESULT($aros_default_wbwidth x $aros_default_wbheight x $aros_default_wbdepth)
2014 aros_cv_default_wbwidth=$aros_default_wbwidth
2015 aros_cv_default_wbheight=$aros_default_wbheight
2016 aros_cv_default_wbdepth=$aros_default_wbdepth
2018 dnl See if the user wants the serial debug output for native flavour
2019 AC_MSG_CHECKING([if serial debug is enabled])
2020 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)
2021 if test "$aros_serial_debug" = 0 ; then
2022     serial_debug_forced=""
2023     if test "$serial_debug" = "yes" ; then
2024         serial_debug="1"
2025     fi
2026     if test "$serial_debug" = "no" ; then
2027         serial_debug="none"
2028     fi
2029 else
2030     serial_debug_forced="(forced)"
2031     serial_debug=$aros_serial_debug
2033 if test "$serial_debug" != "none" ; then
2034     aros_serial_debug=$serial_debug
2035     AC_MSG_RESULT($serial_debug_forced on port $serial_debug)
2036 else
2037     AC_MSG_RESULT(no)
2040 dnl See if the user wants the palm debug output hack for palm native flavour
2041 AC_MSG_CHECKING([if palm debug hack is enabled])
2042 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")
2043 if test "$palm_debug_hack" = "yes" ; then
2044     aros_palm_debug_hack="1"
2046 AC_MSG_RESULT($palm_debug_hack)
2048 dnl See if the user wants the usb3.0 code
2049 AC_MSG_CHECKING([if usb3.0 code is enabled])
2050 AC_ARG_ENABLE(usb30_code,AC_HELP_STRING([--enable-usb30-code],[Enable usb3.0 code (default=no)]),usb30_code="yes",usb30_code="no")
2051 if test "$usb30_code" = "yes" ; then
2052     aros_usb30_code="1"
2053 else
2054     aros_usb30_code="0"
2056 AC_MSG_RESULT($usb30_code)
2058 dnl See if the user wants nesting supervisor activated for unix flavour
2059 AC_MSG_CHECKING([if nesting supervisor support is enabled])
2060 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")
2061 if test "$nesting_supervisor" = "yes" ; then
2062     aros_nesting_supervisor="1"
2064 AC_MSG_RESULT($nesting_supervisor)
2066 dnl See if the user wants to disable MMU support
2067 dnl This can be overriden on per-target basis,
2068 dnl set $aros_enable_mmu to "yes" or "no" to do this
2069 if test "$aros_enable_mmu" = "" ; then
2070     AC_MSG_CHECKING([if MMU support is enabled])
2071     dnl Enabled by default
2072     AC_ARG_ENABLE(mmu,AC_HELP_STRING([--disable-mmu],[Disable MMU support (default=enabled)]),aros_enable_mmu=$enableval,aros_enable_mmu="yes")
2073     if test "$aros_enable_mmu" = "" ; then
2074         aros_enable_mmu="yes"
2075     fi
2076     AC_MSG_RESULT($aros_enable_mmu)
2078 if test "$aros_enable_mmu" = "no" ; then
2079     aros_enable_mmu="0"
2080 else
2081     aros_enable_mmu="1"
2083     
2085 dnl things specifically required for hosted flavours
2086 if test "x-$aros_flavour" = "x-emulation" -o "x-$aros_flavour" = "x-emulcompat" ; then
2088     if test "x-$need_dlopen" != "x-no" ; then
2089       dnl some kind of dynamic library access system is required for hostlib.resource
2090       AC_CHECK_FUNC(dlopen, have_dl="yes", have_dl="no")
2091       if test "x-$have_dl" = "x-no" ; then
2092           AC_CHECK_LIB(dl, dlopen, [have_dl="yes"
2093                                     aros_host_ldflags="$aros_host_ldflags -ldl"],
2094                                     have_dl="no")
2095       fi
2096       if test "x-$have_dl" = "x-no" ; then
2097           AC_MSG_ERROR([dlopen() dynamic linker functions not available])
2098       fi
2099     fi
2102     dnl x11 hidd
2103     AC_ARG_ENABLE(x11_hidd, AC_HELP_STRING([--enable-x11-hidd],
2104                                            [build X11 hidd for hosted (default=auto)]),
2105                                            x11_hidd="$enableval",
2106                                            x11_hidd="$need_x11")
2107     case "x-$x11_hidd" in
2108         x-yes|x-no|x-auto)                 ;;
2109         *)                 x11_hidd="$need_x11" ;;
2110     esac
2112     ENABLE_X11=0
2114     dnl they want it
2115     if test "x-$x11_hidd" != "x-no" ; then
2117         dnl find x11 stuff
2118         AC_PATH_X
2120         x_cflags=
2121         for path in $x_libraries
2122         do
2123             x_cflags="$x_cflags -L$path"
2124         done
2126         for path in $x_includes
2127         do
2128             x_cflags="$x_cflags -I$path"
2129         done
2130         
2131         if test "x-$no_x" = "x-yes" ; then
2133             dnl didn't find it
2134             if test "x-$x11_hidd" != "x-auto" ; then
2135                 dnl and they explicitly asked for it, bail out
2136                 AC_MSG_ERROR([X11 libs/headers not found, cannot build X11 hidd as requested])
2137             fi
2138         
2139         else
2140             dnl found it, setup the metatarget
2141             x11_hidd_target=kernel-x11gfx-kobj
2142             ENABLE_X11=1
2144             dnl setup shared memory extensions
2145             AC_ARG_ENABLE(x11_shm, AC_HELP_STRING([--enable-x11-shm],
2146                                                   [use X11 shared memory (default=auto)]),
2147                                                   x11_hidd_shm="$enableval",
2148                                                   x11_hidd_shm="auto")
2149             case "x-$x11_hidd_shm" in
2150                 x-yes|x-no|x-auto)                     ;;
2151                 *)                 x11_hidd_shm="auto" ;;
2152             esac
2154             have_xshm=no
2156             dnl they want it
2157             if test "x-$x11_hidd_shm" != "x-no" ; then
2159                 dnl system shm headers
2160                 AC_CHECK_HEADERS(sys/ipc.h)
2161                 AC_CHECK_HEADERS(sys/shm.h)
2163                 dnl got them
2164                 if test "x-$ac_cv_header_sys_ipc_h" = "x-yes" -a "x-$ac_cv_header_sys_shm_h" = "x-yes" ; then
2166                     dnl make sure X libs have shm functions
2167                     save_cflags="$CFLAGS"
2168                     CFLAGS="$CFLAGS $x_cflags"
2169                     AC_CHECK_LIB(Xext, XShmQueryExtension, have_xshm=yes)
2170                     CFLAGS="$save_cflags"
2171                 fi
2172             fi
2174             dnl detection done, prepare output
2175             if test "x-$have_xshm" = "x-yes" ; then
2176                 dnl we can do shm
2177                 DO_XSHM_SUPPORT="1"
2178             elif test "x-$x11_hidd_shm" = "x-yes" ; then
2179                 dnl they explicitly asked for it, but we can't do it
2180                 AC_MSG_ERROR([X11 has no support for shared memory, cannot enable it as requested])
2181             else
2182                 dnl otherwise just disable it
2183                 DO_XSHM_SUPPORT="0"
2184             fi
2186             
2187             dnl setup vidmode (fullscreen) extensions
2188             AC_ARG_ENABLE(x11_vidmode, AC_HELP_STRING([--enable-x11-vidmode],
2189                                                       [use X11 vidmode extension (default=auto)]),
2190                                                       x11_hidd_vidmode="$enableval",
2191                                                       x11_hidd_vidmode="auto")
2192             case "x-$x11_hidd_vidmode" in
2193                 x-yes|x-no|x-auto)                         ;;
2194                 *)                 x11_hidd_vidmode="auto" ;;
2195             esac
2197             have_vidmode=no
2199             dnl they want it
2200             if test "x-$x11_hidd_vidmode" != "x-no" ; then
2202                 dnl make sure X libs have vidmode functions
2203                 save_cflags="$CFLAGS"
2204                 CFLAGS="$CFLAGS $x_cflags"
2205                 AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryExtension, have_vidmode=yes)
2206                 CFLAGS="$save_cflags"
2207             fi
2209             dnl detection done, prepare output
2210             if test "x-$have_vidmode" = "x-yes" ; then
2211                 dnl we can do vidmode
2212                 DO_VIDMODE_SUPPORT="1"
2213             elif test "x-$x11_hidd_vidmode" = "x-yes" ; then
2214                 dnl they explicitly asked for it, but we can't do it
2215                 AC_MSG_ERROR([X11 vidmode extension not available, cannot enable it as requested])
2216             else
2217                 dnl otherwise just disable it
2218                 DO_VIDMODE_SUPPORT="0"
2219             fi
2220         fi
2222         aros_host_x11_includes=$x_includes 
2223         aros_host_x11_libdirs=$x_libraries
2224     fi
2227     dnl sdl hidd
2228     AC_ARG_ENABLE(sdl_hidd, AC_HELP_STRING([--enable-sdl-hidd],
2229                                            [build SDL hidd for hosted (default=auto)]),
2230                                            sdl_hidd="$enableval",
2231                                            sdl_hidd="auto")
2232     case "x-$sdl_hidd" in
2233         x-yes|x-no|x-auto)                 ;;
2234         *)                 sdl_hidd="auto" ;;
2235     esac
2237     dnl they want it
2238     if test "x-$sdl_hidd" != "x-no" ; then
2240         dnl find sdl
2241         AM_PATH_SDL([1.2.10], have_sdl="yes", have_sdl="no")
2243         if test "x-$have_sdl" != "x-yes" ; then
2245             dnl didn't find it
2246             if test "x-$sdl_hidd" != "x-auto" ; then
2247                 dnl and they explicitly asked for it, bail out
2248                 AC_MSG_ERROR([SDL libs/headers not found, cannot build SDL hidd as requested])
2249             fi
2251         else
2252             dnl found it, set up the metatarget
2253             sdl_hidd_target=kernel-hidd-sdl
2254             aros_host_sdl_cflags=SDL_CFLAGS
2255             aros_host_sdl_libs=SDL_LIBS
2256         fi
2257     fi
2259     dnl oss.library
2260     AC_CHECK_HEADER(sys/soundcard.h)
2261     if test "x-$ac_cv_header_sys_soundcard_h" = "x-yes" ; then
2262         oss_library_target=workbench-libs-oss-unix
2263     fi
2267 dnl See if the user wants dbus.library
2268 AC_MSG_CHECKING([if building of dbus.library is enabled])
2269 AC_ARG_ENABLE(dbus,AC_HELP_STRING([--enable-dbus],[Enable DBUS support via dbus.library (default=no)]),dbus="yes",dbus="no")
2270 if test "$dbus" = "yes" ; then
2271     ENABLE_DBUS=1
2272     DBUS_CFLAGS=`pkg-config --cflags dbus-1`
2273     DBUS_LIBFLAGS=`pkg-config --libs dbus-1`
2274     KERNEL_DBUS_KOBJ=kernel-dbus-kobj
2275     KERNEL_DBUS_INCLUDES=kernel-dbus-includes
2276 else
2277     ENABLE_DBUS=0
2279 AC_MSG_RESULT($dbus)
2281 if test "$use_kernel_cc_wrapper" = "yes" ; then
2282     aros_kernel_cc="${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-elf-gcc"
2285 dnl --------------------------------------------------------------------
2286 dnl Configuration Output Section
2287 dnl --------------------------------------------------------------------
2289 # Generic
2290 AC_SUBST(aros_arch)
2291 AC_SUBST(aros_cpu)
2292 AC_SUBST(aros_flavour)
2293 AC_SUBST(aros_flavour_uc)
2294 AC_SUBST(AROS_BUILDDIR)
2295 AC_SUBST(AROS_BUILDDIR_UNIX)
2296 AC_SUBST(SRCDIR)
2297 AC_SUBST(AROS_CROSSTOOLSDIR)
2298 AC_SUBST(AROS_PORTSSRCDIR)
2300 # Compatability with other Amiga-like operation systems
2301 AC_SUBST(aros_amigaos_compliance)
2303 # Host related
2304 AC_SUBST(aros_cc_pre)
2305 AC_SUBST(aros_host_strip)
2306 AC_SUBST(aros_host_arch)
2307 AC_SUBST(aros_host_cpu)
2308 AC_SUBST(aros_host_cc)
2309 AC_SUBST(aros_host_ar)
2310 AC_SUBST(aros_host_ranlib)
2311 AC_SUBST(aros_host_ld)
2312 AC_SUBST(aros_host_make)
2313 AC_SUBST(aros_host_cflags)
2314 AC_SUBST(gnu89_inline)
2315 AC_SUBST(aros_host_ldflags)
2316 AC_SUBST(aros_host_debug)
2317 AC_SUBST(aros_host_mkdep)
2318 AC_SUBST(aros_host_mkargs)
2319 AC_SUBST(aros_host_exe_suffix)
2320 AC_SUBST(aros_host_lib_suffix)
2321 AC_SUBST(aros_tools_dir)
2322 AC_SUBST(aros_host_aclocal)
2323 AC_SUBST(aros_host_autoconf)
2324 AC_SUBST(aros_host_autoheader)
2325 AC_SUBST(aros_host_automake)
2326 AC_SUBST(ant)
2328 # Target Related
2329 AC_SUBST(aros_target_guitheme)
2330 AC_SUBST(aros_target_iconset)
2331 AC_SUBST(aros_target_bootloader)
2332 AC_SUBST(aros_target_arch)
2333 AC_SUBST(aros_target_family)
2334 AC_SUBST(aros_target_cpu)
2335 AC_SUBST(aros_target_variant)
2336 AC_SUBST(aros_target_suffix)
2337 AC_SUBST(aros_target_incl)
2338 AC_SUBST(aros_target_ar)
2339 AC_SUBST(aros_target_ranlib)
2340 AC_SUBST(aros_plain_nm)
2341 AC_SUBST(aros_plain_ar)
2342 AC_SUBST(aros_kernel_ar)
2343 AC_SUBST(aros_kernel_ranlib)
2344 AC_SUBST(orig_target_cc)
2345 AC_SUBST(aros_target_cc)
2346 AC_SUBST(aros_target_cxx)
2347 AC_SUBST(aros_kernel_cc)
2348 AC_SUBST(aros_target_as)
2349 AC_SUBST(orig_target_ld)
2350 AC_SUBST(aros_target_ld)
2351 AC_SUBST(aros_kernel_ld)
2352 AC_SUBST(aros_target_cc_includes)
2353 AC_SUBST(aros_target_cc_path)
2354 AC_SUBST(aros_target_objdump)
2355 AC_SUBST(aros_target_objcopy)
2356 AC_SUBST(aros_target_strip)
2357 AC_SUBST(aros_target_nm)
2358 AC_SUBST(aros_kernel_rescomp)
2359 AC_SUBST(aros_shared_default)
2360 AC_SUBST(aros_shared_ld)
2361 AC_SUBST(aros_object_format)
2362 AC_SUBST(aros_compiler_libs)
2363 AC_SUBST(aros_arch_libs)
2365 AC_SUBST(aros_config_cflags)
2366 AC_SUBST(aros_config_aflags)
2367 AC_SUBST(aros_config_ldflags)
2369 AC_SUBST(aros_shared_cflags)
2370 AC_SUBST(aros_shared_aflags)
2371 AC_SUBST(aros_shared_ldflags)
2372 AC_SUBST(aros_kernel_cflags)
2373 AC_SUBST(aros_kernel_includes)
2374 AC_SUBST(aros_kernel_objcflags)
2375 AC_SUBST(aros_kernel_ldflags)
2376 AC_SUBST(aros_target_cflags)
2377 AC_SUBST(aros_debug_cflags)
2378 AC_SUBST(aros_debug_aflags)
2379 AC_SUBST(aros_debug_ldflags)
2380 AC_SUBST(aros_target_genmap)
2381 AC_SUBST(aros_target_strip_flags)
2383 AC_SUBST(crosstools_target)
2384 AC_SUBST(crosstools_cxx_target)
2386 # Graphics Related
2387 AC_SUBST(x11_hidd_target)
2388 AC_SUBST(sdl_hidd_target)
2389 AC_SUBST(pci_hidd_target)
2390 AC_SUBST(oss_library_target)
2392 AC_SUBST(aros_default_wbwidth)
2393 AC_SUBST(aros_default_wbheight)
2394 AC_SUBST(aros_default_wbdepth)
2395 AC_SUBST(DO_XSHM_SUPPORT)
2396 AC_SUBST(DO_VIDMODE_SUPPORT)
2398 AC_SUBST(aros_host_x11_includes)
2399 AC_SUBST(aros_host_x11_libdirs)
2400 AC_SUBST(aros_host_sdl_cflags)
2401 AC_SUBST(aros_host_sdl_libs)
2403 # Native version related
2404 AC_SUBST(aros_serial_debug)
2406 # Palm native version related
2407 AC_SUBST(aros_palm_debug_hack)
2409 # USB3.0 code
2410 AC_SUBST(aros_usb30_code)
2412 # Unix/Hosted version related
2413 AC_SUBST(aros_nesting_supervisor)
2415 # MMU related
2416 AC_SUBST(aros_enable_mmu)
2418 # Apple iOS related
2419 AC_SUBST(aros_ios_platform)
2420 AC_SUBST(aros_ios_version)
2421 AC_SUBST(aros_ios_sdk)
2423 # Android related
2424 AC_SUBST(android_tool)
2425 AC_SUBST(aros_android_level)
2427 # DBUS related
2428 AC_SUBST(ENABLE_DBUS)
2429 AC_SUBST(DBUS_CFLAGS)
2430 AC_SUBST(DBUS_LIBFLAGS)
2431 AC_SUBST(KERNEL_DBUS_KOBJ)
2432 AC_SUBST(KERNEL_DBUS_INCLUDES)
2434 #X11 related
2435 AC_SUBST(ENABLE_X11)
2437 # Debug related
2438 AC_SUBST(aros_debug)
2439 AC_SUBST(aros_mungwall_debug)
2440 AC_SUBST(aros_stack_debug)
2441 AC_SUBST(aros_modules_debug)
2443 # Collect-aros stuff: "-ius" to ignore undefined symbols
2444 AC_SUBST(ignore_undefined_symbols)
2446 # C compiler related
2447 AC_SUBST(gcc_target_cpu)
2449 dnl Prepare for output, make up all the generated patches
2450 case "$aros_flavour" in
2451 emulation)      aros_flavour_uc="AROS_FLAVOUR_EMULATION"
2452                 aros_flavour="emulation" ;;
2453 emulcompat)     aros_flavour_uc="(AROS_FLAVOUR_EMULATION|AROS_FLAVOUR_BINCOMPAT)"
2454                 aros_flavour="emulation" ;;
2455 standalone)     aros_flavour_uc="AROS_FLAVOUR_STANDALONE"
2456                 aros_flavour="standalone";;
2457 standcompat)    aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_BINCOMPAT)"
2458                 aros_flavour="standalone";;
2459 native)         aros_flavour_uc="AROS_FLAVOUR_NATIVE"
2460                 aros_flavour="native" ;;
2461 nativecompat)   aros_flavour_uc="(AROS_FLAVOUR_NATIVE|AROS_FLAVOUR_BINCOMPAT)"
2462                 aros_flavour="native" ;;
2463 linklib)        aros_flavour_uc="AROS_FLAVOUR_LINKLIB"
2464                 aros_flavour="linklib" ;;
2465 palmnative)     aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
2466                 aros_flavour="palmnative" ;;
2467 mac68knative)   aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
2468                 aros_flavour="mac68knative" ;;
2469 ppcnative)      aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_BINCOMPAT)"
2470                 aros_flavour="ppcnative" ;;
2471 esac
2473 if test ! -d ${aros_inc_dir} ; then
2474     ${MKDIR} ${aros_inc_dir}
2476 if test ! -d ${aros_geninc_dir} ; then
2477     ${MKDIR} ${aros_geninc_dir}
2479 if test ! -d ${aros_hostcfg_dir} ; then
2480     ${MKDIR} ${aros_hostcfg_dir}
2482 if test ! -d ${aros_targetcfg_dir} ; then
2483     ${MKDIR} ${aros_targetcfg_dir}
2485 if test ! -d ${aros_tools_dir} ; then
2486     ${MKDIR} ${aros_tools_dir}
2488 if test ! -d ${aros_scripts_dir} ; then
2489     ${MKDIR} ${aros_scripts_dir}
2492 AC_CONFIG_HEADERS(${aros_geninc_dir}/host-conf.h:config/host-conf.h.in)
2494 AC_CONFIG_COMMANDS([compiler_executable],
2495     [
2496         prefix=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}
2497         mkdir -p $prefix
2498         prefix2=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros
2499         prefix3=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-elf
2501         echo ${prefix2}
2502         echo ${prefix3}
2503         chmod a+x ${prefix2}-gcc ${prefix2}-ld ${prefix3}-gcc
2505         ln -sf $aros_target_as_ln$aros_host_exe_suffix      ${prefix2}-as$aros_host_exe_suffix
2506         ln -sf $aros_target_nm_ln$aros_host_exe_suffix      ${prefix2}-nm$aros_host_exe_suffix
2507         ln -sf $aros_target_ar_ln$aros_host_exe_suffix      ${prefix2}-ar$aros_host_exe_suffix
2508         ln -sf $aros_target_ranlib_ln$aros_host_exe_suffix  ${prefix2}-ranlib$aros_host_exe_suffix
2509         ln -sf $aros_target_objcopy_ln$aros_host_exe_suffix ${prefix2}-objcopy$aros_host_exe_suffix
2510         ln -sf $aros_target_objdump_ln$aros_host_exe_suffix ${prefix2}-objdump$aros_host_exe_suffix
2511         ln -sf $aros_target_strip_ln$aros_host_exe_suffix   ${prefix2}-strip$aros_host_exe_suffix
2513         ln -sf $aros_kernel_ld$aros_host_exe_suffix         ${prefix3}-ld$aros_host_exe_suffix
2514     ],
2515     [
2516         aros_host_exe_suffix=${aros_host_exe_suffix}
2517         aros_tools_dir=${aros_tools_dir}
2518         aros_target_cpu=${aros_target_cpu}
2519         aros_target_arch=${aros_target_arch}
2520         aros_target_suffix=${aros_target_suffix}
2521         aros_target_nm_ln=${aros_target_nm_ln}
2522         aros_target_as_ln=${aros_target_as_ln}
2523         aros_target_ar_ln=${aros_target_ar_ln}
2524         aros_target_ranlib_ln=${aros_target_ranlib_ln}
2525         aros_target_objdump_ln=${aros_target_objdump_ln}
2526         aros_target_objcopy_ln=${aros_target_objcopy_ln}
2527         aros_target_strip_ln=${aros_target_strip_ln}
2528         aros_kernel_ld=${aros_kernel_ld}
2529     ]
2531 AC_CONFIG_COMMANDS([genmf_executable],
2532     [chmod a+x ${aros_tools_dir}/genmf.py],
2533     [aros_tools_dir=${aros_tools_dir}]
2536 AC_CONFIG_FILES(
2537     Makefile
2538     config/make.cfg
2539     ${aros_inc_dir}/config.h:config/config.h.in
2540     ${aros_geninc_dir}/config.h:config/config.h.in
2541     ${aros_hostcfg_dir}/host.cfg:config/host.cfg.in
2542     ${aros_targetcfg_dir}/target.cfg:config/target.cfg.in
2543     mmake.config
2544     ${aros_targetcfg_dir}/make.defaults:config/make.defaults.in
2545     ${aros_targetcfg_dir}/specs:config/specs.in
2546     ${aros_targetcfg_dir}/elf-specs:${elf_specs_in}
2547     ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-gcc:scripts/aros-gcc.in
2548     ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-elf-gcc:scripts/elf-gcc.in
2549     ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-ld:scripts/aros-ld.in
2550     ${aros_tools_dir}/genmf.py:tools/genmf/genmf.py
2551     tools/collect-aros/env.h
2552     ${aros_gendir}/arch/all-android/bootstrap/app/default.properties:arch/all-android/bootstrap/app/default.properties.in
2555 AC_OUTPUT
2557 dnl This is in order to not define SHARED_CFLAGS sometimes
2558 dnl We don't always do aros_shared_ar, aros_shared_cflags
2560 #XXX compatability...
2561 aros_shared_ar="$aros_shared_ld $aros_shared_ldflags -o"
2563 if test -n "$aros_shared_cflags" ; then
2564     echo "SHARED_CFLAGS := $aros_shared_cflags" >> ${aros_hostcfg_dir}/host.cfg
2565     echo "SHARED_AR := $aros_shared_ar" >> ${aros_hostcfg_dir}/host.cfg