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