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