Do not try to get stack pointer from invalid ESP field, which coincidentally
[AROS.git] / configure.in
blob40805541deb91a0ec345745b9023b11c87497d9b
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_target_ar_flags="cr"
483 aros_target_nm_flags="-C -ul"
484 aros_target_strip_flags="--strip-unneeded -R.comment"
486 aros_compiler_libs=
487 aros_arch_libs=
489 aros_target_genmap="-Wl,-Map -Xlinker"
491 # Native flavour stuff
492 aros_serial_debug="0"
494 # Palm native flavour stuff
495 aros_palm_debug_hack="0"
497 # Unix flavour stuff
498 aros_nesting_supervisor="0"
500 # Collect-aros stuff: "-ius" to ignore undefined symbols
501 ignore_undefined_symbols=""
503 # Check for X11 by default
504 need_x11="auto"
506 #-----------------------------------------------------------------------------
509 # GCC 4.1+ has a stack protection feature that requires OS support. Ubuntu has
510 # it switched on by default, and we use the host compiler, so it compiles AROS
511 # code with this enabled resulting in link failures as we don't have support
512 # for it.
514 # We use two methods to disable it. For the host compiler (used to compile
515 # some hosted modules), we test to see if the compiler supports stack
516 # protection, and if it does we disable it in AROS_CONFIG_CFLAGS. This should
517 # work on all platforms.
519 # For the "cross" compiler we clear the "ssp_default" spec in config/specs.in
520 # (this is done unconditionally, as it should have no effect on compilers
521 # without the stack protection feature). This may be specific to the way that
522 # Ubuntu enables the feature, so may not work everywhere. My specs-fu isn't
523 # strong enough to disable it in a generic way though, so we'll live with it
524 # until another vendor ships GCC with it enabled in a different way, and deal
525 # with it then.
528 AC_MSG_CHECKING([whether ${CC} accepts -fno-stack-protector])
529 save_cflags="$CFLAGS"
530 CFLAGS="$CFLAGS -fno-stack-protector"
531 AC_TRY_COMPILE(,, use_no_stack_protector="yes", use_no_stack_protector="no")
532 AC_MSG_RESULT($use_no_stack_protector)
533 if test "x-$use_no_stack_protector" = "x-yes" ; then
534     aros_host_cflags="$aros_host_cflags -fno-stack-protector"
536 CFLAGS="$save_cflags"
538 #-----------------------------------------------------------------------------
540 # Disable pointer-signedness warnings if the compiler recognises the option
541 # (this only works for the host compiler at the moment)
543 AC_MSG_CHECKING([whether ${CC} accepts -Wno-pointer-sign])
544 save_cflags="$CFLAGS"
545 CFLAGS="$CFLAGS -Wno-pointer-sign"
546 AC_TRY_COMPILE(,, use_no_sign_warning="yes", use_no_sign_warning="no")
547 AC_MSG_RESULT($use_no_sign_warning)
548 if test "x-$use_no_sign_warning" = "x-yes" ; then
549     aros_host_cflags="$aros_host_cflags -Wno-pointer-sign"
551 CFLAGS="$save_cflags"
553 #-----------------------------------------------------------------------------
555 # Check if host compiler supports -fgnu89-inline, can be needed for crosstools.
557 AC_MSG_CHECKING([whether ${CC} accepts -fgnu89-inline])
558 save_cflags="$CFLAGS"
559 CFLAGS="$CFLAGS -fgnu89-inline"
560 AC_TRY_COMPILE(,, use_gnu89_inline="yes", use_gnu89_inline="no")
561 AC_MSG_RESULT($use_gnu89_inline)
562 if test "x-$use_gnu89_inline" = "x-yes" ; then
563     gnu89_inline="-fgnu89-inline"
565 CFLAGS="$save_cflags"
567 #-----------------------------------------------------------------------------
569 AC_MSG_CHECKING([for type of build])
570 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")
572 if test "$build_type" = "nightly"; then
573     build_type_string="NIGHTLY"
574 elif test "$build_type" = "snapshot"; then
575     build_type_string="SNAPSHOT"
576 elif test "$build_type" = "milestone"; then
577     build_type_string="MILESTONE"
578 elif test "$build_type" = "release"; then
579     build_type_string="RELEASE"
580 else
581     build_type_string="PERSONAL"
582     build_type="personal"
585 aros_config_cflags="$aros_config_cflags -DAROS_BUILD_TYPE=AROS_BUILD_TYPE_$build_type_string"
587 AC_MSG_RESULT($build_type)
589 #-----------------------------------------------------------------------------
590 all_debug_types="messages stack modules mungwall symbols"
592 AC_MSG_CHECKING([which debug types to enable])
593 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)]),
594  debug="$enableval",debug="")
596 if test "$debug" = "" -o "$debug" = "no"; then
597     debug="none"
598 elif test "$debug" = "yes"; then
599     debug="all"
602 if test "$debug" = "all" ; then
603     debug="messages stack modules symbols"
604     for d in $all_debug_types; do
605         export aros_${d}_debug="1"
606     done
607 else
608     for d in $all_debug_types; do
609         export aros_${d}_debug="0"
610     done
613 if test "$debug" != "none"; then
614     debug=`echo $debug | sed s/,/\ /g`
615     for d in $debug; do
616         found="0"
617         for d2 in $all_debug_types; do
618             if test "$d2" = "$d"; then
619                 found="1"
620                 break
621             fi
622         done
623         if test "$found" = "0"; then
624             AC_MSG_ERROR([unrecognized debug type "$d". Available types are: all none $all_debug_types])
625         fi
626         export aros_${d}_debug="1"
627     done
628     aros_debug="yes"
630 AC_MSG_RESULT($debug)
632 if test "$aros_messages_debug" = "1"; then
633     aros_messages_debug="-DADEBUG=1 -DMDEBUG=1"
634 else
635     aros_messages_debug=""
637 if test "$aros_symbols_debug" = "1"; then
638     aros_symbols_debug="-g"
639 else
640     aros_symbols_debug=""
643 # These are the flags to pass when compiling debugged programs
644 aros_debug_cflags="$aros_symbols_debug $aros_messages_debug"
645 aros_debug_aflags=""
646 aros_debug_ldflags="$aros_symbols_debug"
648 aros_crosstools="no"
650 #-----------------------------------------------------------------------------
651 #   Checking if we should build crosstools..
652 AC_MSG_CHECKING([whether to build crosstools])
653 AC_ARG_ENABLE(crosstools,AC_HELP_STRING([--enable-crosstools],[Build cross-compiler toolchains if necessary (default=no).]),crosstools="$enableval",crosstools="no")
654 if test "$crosstools" != "" -a "$crosstools" != "no"; then
655     AC_MSG_RESULT(yes)
656         aros_crosstools="yes"
657 else
658     AC_MSG_RESULT(no)
661 #-----------------------------------------------------------------------------
662 #   Checking for distcc and ccache.
664 #   Always apply the transforms in this particular order. Basically you should
665 #   always run 'ccache distcc compiler' in that order for the best performance.
667 AC_MSG_CHECKING([whether to enable distcc])
668 AC_ARG_ENABLE(distcc,AC_HELP_STRING([--enable-distcc],[Use distcc as a front end to the compiler (default=no).]),distcc="$enableval",distcc="no")
669 if test "$distcc" != "" -a "$distcc" != "no"; then
670     # AC_CHECK_PROG will print out the result in this case
671     AC_PATH_PROG(DISTCC,[distcc],distcc,)
672 else
673     AC_MSG_RESULT(no)
676 AC_MSG_CHECKING([whether to enable ccache])
677 AC_ARG_ENABLE(ccache,AC_HELP_STRING([--enable-ccache],[Use ccache as a front end to the compiler (default=no).]),ccache="$enableval",ccache="no")
678 if test "$ccache" != "" -a "$ccache" != "no"; then
679     # AC_CHECK_PROG will print out the result in this case
680     AC_CHECK_PROG(CCACHE,[ccache],ccache,)
681 else
682     AC_MSG_RESULT(no)
685 #-----------------------------------------------------------------------------
686 AC_MSG_CHECKING([what specific host gcc version to use])
687 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")
688 AC_MSG_RESULT($target_tool_version)
690 #-----------------------------------------------------------------------------
691 AC_MSG_CHECKING([what optimization flags to use])
692 AC_ARG_WITH(optimization,AC_HELP_STRING([--with-optimization=FLAGS],[Use optimization flags FLAGS (default=-O2).]),optimization="$withval",optimization="unknown")
693 if test "$optimization" = "unknown"; then
694     dnl default is -O2 for normal builds, -O0 for debug builds
695     if test "$debug" != "none"; then
696         optimization="-O0"
697     else
698         optimization="-O2"
699     fi
701 aros_config_cflags="$aros_config_cflags $optimization"
702 AC_MSG_RESULT($optimization)
704 #-----------------------------------------------------------------------------
705 AC_MSG_CHECKING([what paranoia flags to use])
706 AC_ARG_WITH(paranoia,AC_HELP_STRING([--with-paranoia=FLAGS],[CC flags to enable paranoia]),[paranoia_flags="$withval"],[paranoia_flags="default"])
707 if test "$paranoia_flags" = "default"; then
708         paranoia_flags=""
709 else if test "$paranoia_flags" = "yes"; then
710         paranoia_flags="-Wall -Werror"
711 fi fi
712 AC_MSG_RESULT($paranoia_flags)
713 aros_paranoia_cflags="$paranoia_flags"
715 #-----------------------------------------------------------------------------
716 AC_MSG_CHECKING([what target variant to enable])
717 AC_ARG_ENABLE(target_variant,AC_HELP_STRING([--enable-target-variant=NAME],[Enable a specific target variant(default=none)]),target_variant=$enableval,target_variant="")
718 if test "$target_variant" = ""; then
719     aros_target_variant=""
720     aros_target_suffix=""
721     enableval="none"
722 else
723     aros_target_variant="$target_variant"
724     aros_target_suffix="-$target_variant"
726 AC_MSG_RESULT($enableval)
728 #-----------------------------------------------------------------------------
729 # Target-specific defaults. You can override then on a per-target basis.
731 # Bootloader name. Currently used by PC target.
732 target_bootloader="none"
734 # Prefix for toolchain used to build bootstrap. For hosted ports, this should be a toolchain for target host OS.
735 # (i. e. when building mingw32-i386 port this should be set to "i386-mingw32-").
736 # For native ports this toolchain is used to build a bootloader and second-level bootstrap (if present).
737 target_tool_prefix=${target_cpu}-elf-
739 #-----------------------------------------------------------------------------
740 # Additional options for some specific targets
742 case "$aros_target_variant" in
743 ios)
744     AC_MSG_CHECKING([XCode path])
745     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")
746     AC_MSG_RESULT($aros_xcode_path)
748     AC_MSG_CHECKING([for minimum supported iOS version])
749     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")
750     AC_MSG_RESULT($aros_ios_version)
752     AC_MSG_CHECKING([what iOS SDK version to use])
753     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")
754     AC_MSG_RESULT($aros_ios_sdk)
756     ;;
758 "android")
759     AC_MSG_CHECKING([Android SDK path])
760     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)
761     AC_MSG_RESULT($aros_android_sdk)
763     AC_MSG_CHECKING([Android NDK path])
764     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")
765     AC_MSG_RESULT($aros_android_ndk)
767     AC_MSG_CHECKING([what Android version to use])
768     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")
769     AC_MSG_RESULT($aros_android_version)
771     export PATH="$aros_android_sdk/tools:$PATH"
772     AC_PATH_PROG(android_tool, $android_tool)
773     AROS_REQUIRED(android,$android_tool)
775     dnl MSYS bash can't run .bat files directly, then need to be started via cmd.exe
776     if test $host_os = "mingw32"; then
777         android_tool="cmd //c $android_tool"
778     fi
780     ;;
781 esac
783 #-----------------------------------------------------------------------------
784 # This is the target configuration switch.
785 case "$target_os" in
786     linux*)
787         aros_target_arch="linux"
788         aros_target_family="unix"
789         case "$target_cpu" in
790             *m68k*)
791                 aros_target_cpu="m68k"
792                 aros_object_format="m68kelf"
793                 aros_flavour="emulcompat"
794                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D__mc68000 -D__linux__"
795                 aros_shared_ldflags="-Wl,-T,\$(TOP)/config/linux/m68k/script.so"
796                 aros_kernel_ldflags="-Wl,-rpath,./lib,-T,\$(TOP)/config/linux/m68k/script.normal"
797                 gcc_target_cpu="mc68000"
798                 ;;
799             *i?86*)
800                 aros_target_cpu="i386"
801                 aros_object_format="elf_i386"
802                 aros_flavour="emulation"
803                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__linux__"
804                 aros_config_cflags="$aros_config_cflags -m32 -march=i486"
805                 aros_kernel_cflags="$aros_kernel_cflags -m32 -march=i486"
806                 aros_config_aflags="$aros_config_aflags -m32 -march=i486"
807                 aros_config_ldflags="-m32 -march=i486"
808                 aros_kernel_ldflags="-melf_i386"
809                 aros_default_wbdepth=8
810                 gcc_target_cpu="i386"
811                 pci_hidd_target="hidd-pci-linux"
812                 ;;
813             *x86_64*)
814                 aros_target_cpu="x86_64"
815                 aros_object_format="elf_x86_64"
816                 aros_flavour="emulation"
817                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64 -D__linux__"
818                 aros_config_cflags="$aros_config_cflags -mno-red-zone -fno-omit-frame-pointer"
819                 aros_default_wbdepth=8
820                 pci_hidd_target="hidd-pci-linux"
821                 ;;
822             *powerpc*)
823                 aros_target_cpu="ppc"
824                 aros_object_format="elf32ppc"
825                 aros_flavour="emulation"
826                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc -D__linux__"
827                 aros_default_wbdepth=8
828                 gcc_target_cpu="ppc"
829                 ;;
830 # TODO
831 # Same as powerpc, but I need this for the nightly build to work again.
832 # Actually, the nightly should be made working with powerpc target.
833 # That just was too much work for the moment, another week or two.
834             *ppc*)
835                 aros_target_cpu="ppc"
836                 aros_object_format="elf32ppc"
837                 aros_flavour="emulation"
838                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc -D__linux__"
839                 aros_default_wbdepth=8
840                 gcc_target_cpu="ppc"
841                 ;;
842             *arm*)
843                 aros_target_cpu="arm"
844                 aros_object_format="armelf_linux_eabi"
845                 aros_flavour="emulation"
846                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm -D__linux__"
847                 gcc_target_cpu="arm"
848                 aros_config_cflags="$aros_config_cflags -marm -march=armv6 -mfpu=vfp -mfloat-abi=softfp -fno-asynchronous-unwind-tables -fno-exceptions -fno-strict-aliasing"
849                 aros_config_aflags="$aros_config_aflags -marm -march=armv6 -mfpu=vfp -mfloat-abi=softfp -fno-asynchronous-unwind-tables -fno-exceptions -fno-strict-aliasing"
850                 aros_arch_libs="-laeabi"
851                 ;;
852             *)
853                 AC_MSG_ERROR("Unknown CPU for Linux -- $target_cpu")
854                 ;;
855         esac
856         case "$aros_target_variant" in
857             android)
858                 case "$aros_android_version" in
859                 2.2)
860                     aros_android_level=android-8
861                     ;;
862                 *)
863                     aros_android_level=android-9
864                     ;;
865                 esac
866                 aros_default_wbwidth=320
867                 aros_default_wbheight=480
868                 dnl Android gcc and AROS gcc use different enums size, so we use AROS gcc
869                 use_aros_gcc="yes"
870                 if test "$aros_android_ndk" = ""; then
871                     aros_kernel_cflags="-mandroid"
872                     aros_kernel_ldflags="-mandroid"
873                     CFLAGS="-mandroid"
874                 else
875                     export PATH="$aros_android_ndk/toolchains/arm-linux-androideabi-$target_tool_version/prebuilt/$android_build_os/bin:$PATH"
876                     aros_android_ndk="$aros_android_ndk/platforms/$aros_android_level/arch-arm"
877                     aros_kernel_cflags="--sysroot $aros_android_ndk -mandroid"
878                     aros_kernel_ldflags="--sysroot $aros_android_ndk -mandroid"
879                     CFLAGS="$CFLAGS --sysroot $aros_android_ndk -mandroid"
880                     aros_kernel_includes="-isystem $aros_android_ndk/usr/include"
881                 fi
882                 need_x11=no
883                 target_tool_prefix="arm-linux-androideabi-"
884             ;;
885         esac
886     ;;
888     pc)
889         aros_target_arch="pc"
890         aros_shared_default="no"
891         target_bootloader="grub2"
892         case "$target_cpu" in
893             *i?86*)
894                 aros_target_cpu="i386"
896                 dnl If somebody hasn't already set the target object
897                 dnl format, then use this value. Mostly to support
898                 dnl FreeBSD cross-compilation.
899                 dnl TODO: Remove when we always use our compiler.
901                 if test "$aros_object_format" = "" ; then
902                     aros_object_format="elf_i386"
903                 fi
904                 aros_flavour="standalone"
905                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
906                 aros_config_cflags="$aros_config_cflags -m32 -march=i486"
907                 aros_kernel_cflags="$aros_kernel_cflags -m32 -march=i486"
908                 aros_config_aflags="$aros_config_aflags -m32 -march=i486"
909                 aros_config_ldflags="-m32 -march=i486"
910                 aros_kernel_ldflags="-melf_i386"
911                 aros_default_wbwidth=640
912                 aros_default_wbheight=480
913                 gcc_target_cpu="i386"
914                 ;;
915             *x86_64*)
916                 aros_target_cpu="x86_64"
917                 aros_serial_debug=1
918                 if test "$aros_object_format" = "" ; then
919                     aros_object_format="elf_x86_64"
920                 fi
921                 aros_flavour="standalone"
922                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
923                 aros_config_cflags="$aros_config_cflags -fno-asynchronous-unwind-tables -mno-red-zone -fno-omit-frame-pointer"
924                 aros_kernel_ldflags=""
925                 aros_default_wbwidth=640
926                 aros_default_wbheight=480
927                 ;;
928             *)
929                 AC_MSG_ERROR("Unknown native CPU -- $target_cpu")
930                 ;;
931         esac
932         ;;
934     prep)
935         aros_target_arch="prep"
936         aros_shared_default="no"
937         aros_target_cpu="ppc"
938         aros_object_format="elf32ppc"
939         aros_flavour="ppcnative"
940         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
941         aros_kernel_ldflags=""
942         aros_default_wbwidth=640
943         aros_default_wbheight=480
944         gcc_target_cpu="ppc"
945         ;;
947     freebsd*)
948         aros_target_arch="freebsd"
949         aros_target_family="unix"
950         aros_target_cpu="i386"
951         aros_flavour="emulation"
952         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
953         gcc_target_cpu="i386"
955         aros_target_strip_flags="-x"
956         ;;
958     darwin*)
959         aros_target_arch="darwin"
960         aros_target_family="unix"
961         aros_flavour="emulation"
962         case "$target_cpu" in
963             *i?86*)
964                 aros_ios_platform="iPhoneSimulator"
965                 aros_target_cpu="i386"
966                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
967                 aros_kernel_ldflags=""
968                 aros_macosx_version="10.4"
969                 aros_default_wbdepth=8
970                 gcc_target_cpu="i386"
971                 aros_object_format="elf_i386"
972                 aros_target_strip_flags="-x"
973                 target_tool_prefix="i686-apple-darwin10-"
974                 target_tool_flags="-m32"
975                 ;;
976             *x86_64*)
977                 aros_target_cpu="x86_64"
978                 aros_object_format="elf_x86_64"
979                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
980                 aros_macosx_version="10.6"
981                 aros_config_cflags="$aros_config_cflags -fno-omit-frame-pointer"
982                 aros_kernel_cflags="-m64"
983                 aros_kernel_ldflags="-m64"
984                 aros_target_cflags="-mcmodel=large"
985                 aros_default_wbdepth=8
986                 aros_kernel_ld="ld"
987                 target_tool_prefix="i686-apple-darwin10-"
988                 ;;
989             *ppc*)
990                 aros_target_cpu="ppc"
991                 aros_object_format="elf32ppc"
992                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
993                 aros_kernel_ldflags=""
994                 aros_macosx_version="10.0"
995                 aros_default_wbdepth=8
996                 gcc_target_cpu="ppc"
997                 aros_kernel_ld="ld -arch ppc"
998                 target_tool_prefix="powerpc-apple-darwin10-"
999                 ;;
1000             *arm*)
1001                 aros_ios_platform="iPhoneOS"
1002                 aros_target_cpu="arm"
1003                 aros_object_format="armelf_linux_eabi"
1004                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
1005                 aros_config_cflags="$aros_config_cflags -marm -march=armv6 -mfpu=vfp -mfloat-abi=softfp -fno-asynchronous-unwind-tables -fno-exceptions"
1006                 aros_config_aflags="$aros_config_aflags -marm -march=armv6 -mfpu=vfp -mfloat-abi=softfp -fno-asynchronous-unwind-tables -fno-exceptions"
1007                 aros_arch_libs="-laeabi"
1008                 aros_default_wbdepth=8
1009                 gcc_target_cpu="arm"
1010                 aros_kernel_ld="ld -arch arm"
1011                 target_tool_prefix="arm-apple-darwin10-" 
1012                 export PATH="$aros_xcode_path/Platforms/$aros_ios_platform.platform/Developer/usr/bin:$PATH"
1013                 ;;
1014             *)
1015                 AC_MSG_ERROR("Unsupported target CPU for darwin hosted flavour -- $target_cpu")
1016                 ;;
1017         esac
1018         case "$aros_target_variant" in
1019             ios)
1020                 aros_default_wbwidth=320
1021                 aros_default_wbheight=480
1022                 aros_ios_sdk="$aros_xcode_path/Platforms/$aros_ios_platform.platform/Developer/SDKs/$aros_ios_platform$aros_ios_sdk.sdk"
1023                 target_tool_flags="$target_tool_flags -isysroot $aros_ios_sdk"
1024                 aros_kernel_includes="-isystem $aros_ios_sdk/usr/include"
1025                 need_x11=no
1026                 # This is here because it may depend on iOS or SDK version
1027                 aros_kernel_cflags="$aros_kernel_cflags -miphoneos-version-min=$aros_ios_version"
1028                 aros_kernel_ldflags="$aros_kernel_ldflags -miphoneos-version-min=$aros_ios_version"
1029                 aros_kernel_objcflags="-fobjc-abi-version=2 -fobjc-legacy-dispatch"
1030             ;;
1031             *)
1032                 aros_kernel_cflags="$aros_kernel_cflags -mmacosx-version-min=$aros_macosx_version"
1033                 aros_kernel_ldflags="$aros_kernel_ldflags -mmacosx-version-min=$aros_macosx_version"
1034             ;;
1035         esac
1036         ;;
1038     dragonfly*)
1039         aros_target_arch="dragonfly"
1040         aros_target_family="unix"
1041         aros_flavour="emulation"
1042         case "$target_cpu" in
1043             *i?86*)
1044                 aros_target_cpu="i386"
1045                 aros_object_format="elf_i386"
1046                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__DragonFly__"
1047                 ;;
1048             *x86_64*)
1049                 aros_config_cflags="$aros_config_cflags -fno-omit-frame-pointer"
1050                 aros_target_cpu="x86_64"
1051                 aros_object_format="elf_x86_64"
1052                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64 -D__DragonFly__"
1053                 ;;
1054             *)
1055                 AC_MSG_ERROR("Unknown CPU for DragonFly -- $target_cpu")
1056                 ;;
1057         esac
1058         ;;
1060     netbsd*)
1061         aros_target_arch="netbsd"
1062         aros_target_family="unix"
1063         case "$target_cpu" in
1064             *m68k*)
1065                 aros_target_cpu="m68k"
1066                 aros_object_format="m68kelf"
1067                 aros_flavour="emulcompat"
1068                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D__mc68000 -D__NetBSD__"
1069                 gcc_target_cpu="mc68000"
1070                 ;;
1071             *i?86*)
1072                 aros_target_cpu="i386"
1073                 aros_object_format="elf_i386"
1074                 aros_flavour="emulation"
1075                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__NetBSD__"
1076                 aros_default_wbdepth=8
1077                 gcc_target_cpu="i386"
1078                 ;;
1079             *)
1080                 AC_MSG_ERROR("Unknown CPU for NetBSD -- $target_cpu")
1081                 ;;
1082         esac
1083         aros_target_genmap="-Wl,-M -Xlinker >"
1084         aros_flavour="emulation"
1085         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1086         ;;   
1088     openbsd*)
1089         aros_target_arch="openbsd"
1090         aros_target_family="unix"
1091         case "$target_cpu" in
1092             *i?86*)
1093                 aros_target_cpu="i386"
1094                 aros_object_format="elf_i386"
1095                 aros_flavour="emulation"
1096                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__OpenBSD__"
1097                 gcc_target_cpu="i386"
1098                 ;;
1099             *)
1100                 AC_MSG_ERROR("Unknown CPU for OpenBSD -- $target_cpu")
1101                 ;;
1102         esac
1103         aros_target_genmap="-Wl,-M -Xlinker >"
1104         aros_target_nm_flags="-u"
1105         aros_flavour="emulation"
1106         ;;
1108     solaris*)
1109         aros_target_arch="solaris"
1110         aros_target_family="unix"
1111         case "$target_cpu" in
1112            *i?86*)
1113                aros_target_cpu="i386"
1114                aros_object_format="elf_i386"
1115                aros_flavour="emulation"
1116                aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__Solaris__"
1117                aros_default_wbdepth=8
1118                gcc_target_cpu="i386"
1119                ;;
1120             *sparc*)
1121                 aros_target_cpu="sparc"
1122                 aros_object_format="elf_sparc"
1123                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dsparc -D__Solaris__"
1124                 gcc_target_cpu="sparc"
1125                 ;;
1126             *)
1127                 AC_MSG_ERROR("Unknown CPU for Solaris -- $target_cpu")
1128                 ;;
1129         esac
1130         aros_config_cflags="$aros_config_cflags -D$aros_target_cpu"
1131         aros_flavour="emulation"
1132         ;;
1134     morphos*)
1135         aros_target_arch="morphos"
1136         aros_shared_default="no"
1137         aros_target_cpu="ppc"
1138         aros_object_format="elf_ppc"
1139         aros_flavour="nativecompat"
1140         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1141         gcc_target_cpu="ppc"
1142         ;;
1144     sam440)
1145         aros_target_arch="sam440"
1146         aros_shared_default="no"
1147         aros_target_cpu="ppc"
1148         aros_object_format="elf32ppc"
1149         aros_flavour="ppcnative"
1150         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1151         aros_kernel_ldflags=""
1152         aros_default_wbwidth=1024
1153         aros_default_wbheight=768
1154         aros_default_wbdepth=24
1155         aros_config_cflags="$aros_config_cflags -mcpu=440fp -mno-toc -fno-asynchronous-unwind-tables"
1156         gcc_target_cpu="powerpc"
1157         ;;
1159     efika)
1160         aros_target_arch="efika"
1161         aros_shared_default="no"
1162         aros_target_cpu="arm"
1163         aros_object_format="armelf_linux_eabi"
1164         aros_flavour="standalone"
1165         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
1166         aros_kernel_ldflags=""
1167         aros_default_wbwidth=1024
1168         aros_default_wbheight=600
1169         aros_arch_libs="-laeabi"
1170         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"
1171         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"
1172         ;;
1173         
1174     chrp)
1175     aros_target_arch="chrp"
1176     aros_shared_default="no"
1177     aros_target_cpu="ppc"
1178     aros_object_format="elf32ppc"
1179     aros_flavour="ppcnative"
1180     aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1181     aros_kernel_ldflags=""
1182     aros_default_wbwidth=640
1183     aros_default_wbheight=480
1184     aros_config_cflags="$aros_config_cflags -mno-toc -fno-asynchronous-unwind-tables"    
1185     gcc_target_cpu="powerpc"
1186         case "$aros_target_variant" in
1187             efika)
1188             aros_config_cflags="$aros_config_cflags -DBIG_ENDIAN_OHCI=1 -mcpu=603e"
1189             ;;
1190         esac
1191     ;;
1193     amiga*)
1194         aros_target_arch="amiga"
1195         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D_AMIGA -DAMIGA"
1196         aros_shared_default="no"
1198         case "$target_cpu" in
1199             *m68k*)
1200                 aros_enable_mmu=no
1201                 aros_target_cpu="m68k"
1202                 aros_object_format="m68kelf"
1203                 aros_flavour="standcompat"
1204                 gcc_target_cpu="m68000"
1205                 aros_config_cflags="$aros_config_cflags -fno-strict-aliasing -ffreestanding -fomit-frame-pointer -${gcc_target_cpu} -fbuiltin -Wno-volatile-register-var -DAROS_DOS_PACKETS"
1206                 aros_config_aflags="$aros_config_aflags -${gcc_target_cpu}"
1207                 aros_paranoia_cflags="$aros_paranoia_cflags -Wno-volatile-register-var"
1208                 aros_debug_cflags="$aros_debug_cflags -Wall -Wno-volatile-register-var"
1209                 target_tool_prefix="m68k-elf-"
1210                 # Needed to get the correct multilib
1211                 aros_config_ldflags="-${gcc_target_cpu}"
1212                 aros_shared_ldflags="-${gcc_target_cpu}"
1213                 aros_kernel_ldflags="-${gcc_target_cpu}"
1214                 aros_target_nostdlib_ldflags="-${gcc_target_cpu}"
1215                 aros_target_strip_flags="-R.comment --strip-debug"
1216                 aros_default_wbwidth=640
1217                 aros_default_wbheight=256
1218                 aros_default_wbdepth=2
1219                 ;;
1220             *ppc*)
1221                 aros_cpu="ppc"
1222                 aros_flavour="native"
1223                 gcc_target_cpu="ppc"
1224                 ;;
1225             *)
1226                 AC_MSG_ERROR("Unknown CPU for Amiga $target_cpu")
1227                 ;;
1228         esac
1229         ;;
1231     mingw*)
1232         aros_target_arch="mingw32"
1233         aros_shared_default="no"
1234         aros_flavour="emulation"
1235         aros_shared_cflags=""
1236         need_dlopen="no"
1237         rescomp="windres"
1238         case "$target_cpu" in
1239             *i?86*)
1240                 aros_target_cpu="i386"
1241                 aros_object_format="elf_i386"
1242                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1243                 aros_default_wbdepth=8
1244                 gcc_target_cpu="i386"
1246                 dnl Temporary hack, needed to get nightly build working
1247                 aros_target_as="i386-aros-as"
1248                 aros_target_ar="i386-aros-ar"
1249                 aros_target_ranlib="i386-aros-ranlib"
1250                 aros_target_nm="i386-aros-nm"
1251                 aros_target_strip="i386-aros-strip"
1252                 aros_target_objcopy="i386-aros-objcopy"
1253                 aros_target_objdump="i386-aros-objdump"
1255                 target_tool_prefix="i386-mingw32-"
1256                 ;;
1257             *x86_64*)
1258                 aros_target_cpu="x86_64"
1259                 aros_object_format="elf_x86_64"
1260                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
1261                 aros_config_cflags="$aros_config_cflags -fno-omit-frame-pointer"
1262                 aros_default_wbdepth=8
1263                 target_tool_prefix="x86_64-w64-mingw32-"
1264                 ;;
1265             *arm*)
1266                 aros_target_cpu="arm"
1267                 aros_object_format="armelf_linux_eabi"
1268                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
1269                 aros_arch_libs="-laeabi"
1270                 aros_default_wbdepth=8
1271                 gcc_target_cpu="arm"
1272                 target_tool_prefix="arm-mingw32ce-"
1273                 aros_default_wbwidth=160
1274                 aros_default_wbheight=160
1275                 ;;
1276             *)
1277                 AC_MSG_ERROR("Unknown CPU for Mingw32 -- $target_cpu")
1278                 ;;
1279         esac
1280         if test $host_os = "cygwin"; then
1281                 aros_kernel_cflags="-mno-cygwin"
1282         fi
1283     ;;
1284     pp*)
1285         aros_target_arch="pp"
1286         aros_shared_default="no"
1287         case "$target_cpu" in
1288             *m68k*)
1289                 aros_target_cpu="m68k"
1290                 aros_object_format="m68kelf"
1291                 aros_flavour="palmnative"
1292                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
1293                 aros_default_wbwidth=160
1294                 aros_default_wbheight=160
1295                 aros_default_wbdepth=1
1296                 aros_target_ar_flags="cru"
1297                 aros_compiler_libs="-lgcc1"
1298                 aros_shared_default=no
1299                 aros_shared_cflags="-fpic"
1300                 aros_shared_aflags=""
1301                 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
1302                 aros_kernel_ldflags="-Wl,-rpath,./lib"
1303                 aros_debug_cflags="-Wall -Werror-implicit-function-declaration $aros_symbols_debug  $aros_messages_debug -mc68000 -Wa,-mc68000"
1304                 aros_debug_aflags=""
1305                 aros_debug_ldflags="$aros_symbols_debug"
1306                 aros_mungwall_debug="0"
1307                 aros_modules_debug="0"
1308                 gcc_target_cpu="mc68000"
1309                 ignore_undefined_symbols="-ius"
1310                 ;;
1311            *)
1312                 AC_MSG_ERROR("Unknown CPU for PalmPilot -- $target_cpu")
1313                 ;;
1314         esac
1315         ;;
1317     mac*)
1318         aros_target_arch="mac"
1319         aros_shared_default="no"
1320         case "$target_cpu" in
1321             *m68k*)
1322                 aros_target_cpu="m68k"
1323                 aros_object_format="m68kelf"
1324                 aros_flavour="mac68knative"
1325                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
1326                 aros_default_wbwidth=512
1327                 aros_default_wbheight=384
1328                 aros_default_wbdepth=8
1329                 aros_target_ar_flags="cru"
1330                 aros_compiler_libs="-lgcc1"
1331                 aros_shared_default=no
1332                 aros_shared_cflags="-fpic"
1333                 aros_shared_aflags=""
1334                 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
1335                 aros_kernel_ldflags="-Wl,-rpath,./lib"
1336                 aros_debug_cflags="-Wall -Werror-implicit-function-declaration $aros_symbols_debug  $aros_messages_debug -mc68000"
1337                 aros_debug_aflags=""
1338                 aros_debug_ldflags="$aros_symbols_debug"
1339                 aros_mungwall_debug="0"
1340                 aros_modules_debug="0"
1341                 gcc_target_cpu="mc68000"
1342                 ignore_undefined_symbols="-ius"
1343                 ;;
1344            *)
1345                 AC_MSG_ERROR("Unknown CPU for Mac68k -- $target_cpu")
1346                 ;;
1347         esac
1348         ;;
1350     *)
1351         AC_MSG_ERROR([Unsupported target architecture $target])
1352         ;;
1353 esac
1355 #-----------------------------------------------------------------------------
1356 AC_MSG_CHECKING([what specific AROS gcc version to use])
1357 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")
1358 case "$aros_gcc_version" in
1359 yes)
1360     aros_gcc_version="default"
1361     ;;
1363     aros_gcc_version="none"
1364     ;;
1365 esac
1366 AC_MSG_RESULT($aros_gcc_version)
1368 if test "$aros_gcc_version" != "none"; then
1369     if test "$aros_gcc_version" != "default"; then
1370         aros_target_cc="$aros_target_cpu-aros-gcc-$aros_gcc_version"
1371         aros_target_cxx="$aros_target_cpu-aros-g++-$aros_gcc_version"
1372     else
1373         aros_target_cc="$aros_target_cpu-aros-gcc"
1374         aros_target_cxx="$aros_target_cpu-aros-g++"
1375     fi
1377     aros_target_ld="$aros_target_cpu-aros-ld"
1378     aros_target_as="$aros_target_cpu-aros-as"
1379     aros_target_ar="$aros_target_cpu-aros-ar"
1380     aros_target_ranlib="$aros_target_cpu-aros-ranlib"
1381     aros_target_nm="$aros_target_cpu-aros-nm"
1382     aros_target_strip="$aros_target_cpu-aros-strip"
1383     aros_target_objcopy="$aros_target_cpu-aros-objcopy"
1384     aros_target_objdump="$aros_target_cpu-aros-objdump"
1387 # Some compilers (ppc-elf-gcc is known to) have CPU defines in specs
1388 # Since we override specs, we may need to put these defines there
1389 if test "$gcc_target_cpu" != ""; then
1390     gcc_target_cpu="-D__${gcc_target_cpu}__"
1393 AC_MSG_CHECKING([Where to download sourcecode for external ports])
1394 AC_ARG_WITH(portssources,AC_HELP_STRING([--with-portssources=DIR],[Where to download sourcecode for external ports]),with_portssrcdir=$withval,with_portssrcdir="default")
1395 if test "$with_portssrcdir" = "default"; then
1396     AROS_PORTSSRCDIR="$AROS_BUILDDIR_UNIX/bin/Sources"
1397 else
1398     AROS_PORTSSRCDIR="$with_portssrcdir"
1400 AC_MSG_RESULT($AROS_PORTSSRCDIR)
1402 AC_MSG_CHECKING([which bootloader to use])
1403 AC_ARG_WITH(bootloader,AC_HELP_STRING([--with-bootloader=NAME],[Use a specific bootloader]),target_bootloader=$withval,target_bootloader=$target_bootloader)
1404 if test "$target_bootloader" = "none"; then
1405     aros_target_bootloader=""
1406 else
1407     aros_target_bootloader="$target_bootloader"
1409 AC_MSG_RESULT($target_bootloader)
1411 AC_MSG_CHECKING([which icon-set to use])
1412 AC_ARG_WITH(iconset,AC_HELP_STRING([--with-iconset=NAME],[Use a specific Icon-set (default=Gorilla).]),target_iconset=$withval,target_iconset="default")
1413 if test "$target_iconset" = "default"; then
1414     aros_target_iconset="Gorilla"
1415     target_iconset="default (Gorilla)"
1416 else
1417     aros_target_iconset="$target_iconset"
1419 AC_MSG_RESULT($target_iconset)
1421 AC_MSG_CHECKING([which GUI Theme to use])
1422 AC_ARG_WITH(theme,AC_HELP_STRING([--with-theme=NAME],[Use a specific GUI Theme]),target_guitheme=$withval,target_guitheme="default")
1423 if test "$target_guitheme" = "default"; then
1424     aros_target_guitheme="Ice"
1425 else
1426     aros_target_guitheme="$target_guitheme"
1428 AC_MSG_RESULT($aros_target_guitheme)
1430 # Find out if we are cross-compiling (i.e. if we can't use the host compiler
1431 # for target code)
1432 cross_compiling=no
1433 if test "$aros_host_cpu" != "$aros_target_cpu" ; then
1434     cross_compiling=yes
1437 dnl Native x86-64 Linux toolchain can also produce i386 binaries, given -m32 flag.
1438 if test "$aros_host_cpu" == "x86_64" ; then
1439     if test "$aros_target_cpu" == "i386" ; then
1440         if test "$aros_target_arch" != "mingw32"; then
1441             cross_compiling=no
1442         fi
1443     fi
1446 dnl Enforce cross-compile if we are on Darwin, but our target is not Darwin
1447 if test "$aros_host_arch" == "darwin" ; then
1448     if test "$aros_target_arch" != "darwin" ; then
1449         cross_compiling=yes
1450     fi
1453 # Set prefix for target compiler etc. if we're cross-compiling
1454 # (should possibly be earlier but needs to be after AC_PROG_CC)
1455 if test "$cross_compiling" = "yes" ; then
1456     CC=${target_tool_prefix}gcc
1457     dnl CPP is needed for AC_CHECK_HEADER to work correctly
1458     CPP=${target_tool_prefix}cpp
1459     if test "$target_tool_version" != "default"; then
1460         CC="$CC-$target_tool_version"
1461         CPP="$CC-$target_tool_version"
1462     fi
1463     AC_PATH_PROG(CC,$CC)
1464     AROS_REQUIRED(gcc,$CC)
1466 CC="$CC $target_tool_flags"
1468 #-----------------------------------------------------------------------------
1470 # Disable pointer-signedness warnings if the compiler recognises the option
1472 AC_MSG_CHECKING([whether ${CC} accepts -Wno-pointer-sign])
1473 save_cflags="$CFLAGS"
1474 CFLAGS="$CFLAGS -Wno-pointer-sign"
1475 AC_TRY_COMPILE(,, use_no_sign_warning="yes", use_no_sign_warning="no")
1476 AC_MSG_RESULT($use_no_sign_warning)
1477 if test "x-$use_no_sign_warning" = "x-yes" ; then
1478     aros_config_cflags="$aros_config_cflags -Wno-pointer-sign"
1480 CFLAGS="$save_cflags"
1482 #-----------------------------------------------------------------------------
1484 # Find all the tools we need to compile. This could be cross-compiling
1485 # though! If that is the case we use the GNU form of the target and
1486 # simply add this to the front of the binary name. This is rather simple,
1487 # but it should work under most circumstances.
1489 # The default tools are to use the same as the host, but only if the
1490 # host and target CPU are the same. With GCC this is normally enough.
1493 aros_cc_pre=""
1494 aros_shared_ld="$aros_host_ld"
1496 aros_target_mkdep="$aros_host_mkdep"
1497 aros_target_incl_def="$aros_host_incl"
1499 aros_kernel_cc="$CC"
1501 # The default tools executables to be linked to.
1502 if test "$rescomp" != ""; then
1503     if test "$cross_compiling" = "yes" ; then
1504         rescomp=${target_tool_prefix}${rescomp}
1505     fi
1506     AC_PATH_PROG(aros_kernel_rescomp,$rescomp)
1507     AROS_REQUIRED($rescomp,$aros_kernel_rescomp)
1510 if test "$crosstools" != "yes"; then
1511     AROS_TOOL_TARGET(aros_kernel_ld,ld,$aros_kernel_ld)
1512     AROS_REQUIRED(ld,$aros_kernel_ld)
1514     dnl For non-ELF hosts we additionally have to look up ELF toolchain for AROS binaries
1515     dnl It can be either AROS toolchain selected earlier or generic ELF toolchain we select here.
1516     if test "$target_tool_prefix" != "${target_cpu}-elf-" ; then
1517         target_tool_prefix=${target_cpu}-elf-
1518         if test "$aros_target_cc" == ""; then
1519            aros_target_cc="${target_tool_prefix}gcc"
1520         fi
1521         if test "$aros_target_ld" == ""; then
1522            aros_target_ld="${target_tool_prefix}ld"
1523         fi
1524     fi
1525     AROS_TOOL_TARGET(aros_target_as_ln,as,$aros_target_as)
1526     AROS_REQUIRED(as,$aros_target_as_ln)
1527     AROS_TOOL_TARGET(aros_target_ar_ln,ar,$aros_target_ar)
1528     AROS_REQUIRED(ar,$aros_target_ar_ln)
1529     AROS_TOOL_TARGET(aros_target_nm_ln,nm,$aros_target_nm)
1530     AROS_REQUIRED(nm,$aros_target_nm_ln)
1531     AROS_TOOL_TARGET(aros_target_objcopy_ln,objcopy,$aros_target_objcopy)
1532     AROS_REQUIRED(objcopy,$aros_target_objcopy_ln)
1533     AROS_TOOL_TARGET(aros_target_objdump_ln,objdump,$aros_target_objdump)
1534     AROS_REQUIRED(objdump,$aros_target_objdump_ln)
1535     AROS_TOOL_TARGET(aros_target_ranlib_ln,ranlib,$aros_target_ranlib)
1536     AROS_REQUIRED(ranlib,$aros_target_ranlib_ln)
1537     AROS_TOOL_TARGET(aros_target_strip_ln,strip,$aros_target_strip)
1538     AROS_REQUIRED(strip,$aros_target_strip_ln)
1539     if test "$aros_target_cxx" != ""; then
1540         AC_PATH_PROG(aros_target_cxx,$aros_target_cxx)
1541         AROS_REQUIRED(c++,$aros_target_cxx)
1542     fi
1543 else
1544     dnl Cancel preinstalled C++ compiler because it will be built as part of crosstools
1545     aros_target_cxx=""
1548 orig_target_cc=$aros_kernel_cc
1549 orig_target_ld=$aros_kernel_ld
1551 if test "$aros_target_cc" != ""; then
1552     AC_PATH_PROG(aros_target_cc,$aros_target_cc)
1553     AROS_REQUIRED(gcc,$aros_target_cc)
1554     orig_target_cc=$aros_target_cc
1556 if test "$aros_target_ld" != ""; then
1557     AC_PATH_PROG(aros_target_ld,$aros_target_ld)
1558     AROS_REQUIRED(ld,$aros_target_ld)
1559     orig_target_ld=$aros_target_ld
1562 # Build crosstools if we have no C++ - temporary thing 
1563 if test "$aros_target_cxx" = ""; then
1564     crosstools_target=tools-crosstools
1567 aros_hostcfg_dir="bin/${aros_host_arch}-${aros_host_cpu}/gen/config"
1568 aros_targetcfg_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/config"
1569 aros_inc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/AROS/Development/include/aros"
1570 aros_gendir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen"
1571 aros_geninc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/include/aros"
1572 aros_tools_dir="bin/${aros_host_arch}-${aros_host_cpu}/tools"
1573 aros_scripts_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/scripts"
1575 # aros_cc_pre is a variable that is added to the front of the compiler name
1576 # in the generated aros-gcc shell script. We need this to enable the cache
1577 # to work across cleaned builds. Also, support DISTCC using the correct
1578 # environment variable.
1581 if test "x${DISTCC}" != "x" ; then
1582     if test "x${CCACHE}" != "x" ; then
1583         aros_cc_pre="env CCACHE_PREFIX=${DISTCC} ${CCACHE} "
1584     else
1585         aros_cc_pre="${DISTCC} "
1586     fi
1587 else
1588     if test "x${CCACHE}" != "x" ; then
1589         aros_cc_pre="${CCACHE} "
1590     fi
1593 prefix="${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros"
1595 AC_SUBST(aros_target_nostdinc_cflags,-nostdinc)
1596 AC_SUBST(aros_target_nostartup_ldflags,-nostartfiles)
1597 AC_SUBST(aros_target_nix_ldflags,-nix)
1598 AC_SUBST(aros_target_detach_ldflags,-detach)
1599 AC_SUBST(aros_target_nostdlib_ldflags,-nostdlib)
1601 # Target tools
1602 if test "$GCC" = "yes"; then
1603     aros_target_cc_path=`$orig_target_cc -print-search-dirs | grep "programs: =" | cut -c 12-`
1605 aros_target_cc="${prefix}-gcc"
1606 aros_target_as="${prefix}-as"
1607 aros_target_ld="${prefix}-ld"
1608 aros_target_ar="${prefix}-ar $aros_target_ar_flags"
1609 aros_target_objcopy=${prefix}-objcopy
1610 aros_target_objdump=${prefix}-objdump
1611 aros_target_ranlib="${prefix}-ranlib $aros_target_ranlib_flags"
1612 aros_target_nm="${prefix}-nm $aros_target_nm_flags"
1613 aros_kernel_nm="${prefix}-nm"
1614 aros_target_strip=${prefix}-strip
1615 aros_kernel_ar="${prefix}-ar"
1617 # Find the system include path. We can suggest that an alternative is
1618 # used if we don't get it correct. The default is to use /usr/include.
1619 # Which is set in the aros_target_incl_def variable.
1621 AC_ARG_ENABLE(includes,
1622 AC_HELP_STRING([--enable-includes=dir],[Alternative system include directory]),
1623 [aros_target_incl=$enable_includes], [aros_target_incl=$aros_target_incl_def])
1625 if test "$aros_kernel_includes" = ""; then
1626     if test "x-$aros_flavour" = "x-emulation" -o "x-$aros_flavour" = "x-emulcompat" ; then
1627         # FIXME: for cross-compiling this should point to another location
1628         aros_kernel_includes="-isystem $aros_target_incl"
1629     fi
1632 if test "$aros_kernel_includes" != "" ; then
1633     dnl find out about the kernel cc's include path
1634     AC_MSG_CHECKING([for the kernel compiler's include path])
1635     if test "$aros_kernel_cc_includes" = "" ; then
1636         # Try to guess where the directory is.
1637         aros_kernel_cc_includes=`dirname \`${aros_kernel_cc} ${aros_kernel_cflags} -print-libgcc-file-name\``/include
1638         if test -d $aros_kernel_cc_includes; then
1639             # Check if there is also an include-fixed directory and add it
1640             # to kernel compiler's include path as it may contain some of
1641             # the headers we need.
1642             if test -d "$aros_kernel_cc_includes"-fixed; then
1643                 aros_kernel_cc_includes+=" -isystem $aros_kernel_cc_includes"-fixed
1644             fi
1645         else
1646             # The directory doesn't exist, we need to do some more work.
1647             aros_kernel_cc_includes=${PWD}/${aros_gendir}/cc_include
1649             # These are the headers we're looking for.
1650             headers="limits.h mmintrin.h stdbool.h syslimits.h float.h \
1651                      stddef.h xmmintrin.h iso646.h stdarg.h unwind.h   \
1652                      zutil.h"
1654             dirs=
1655             for h in $headers; do
1656                 # Which other headers are needed by each of the above?
1657                 deps=$(echo "#include <$h>" | \
1658                        $aros_kernel_cc -E -M - 2>/dev/null | \
1659                        sed 's/^.*://; s/\\$/ /g; s/[[ \t]]\+/ /g')
1661                 # Copy all the needed headers to a directory beneath gendir.
1662                 for d in $deps; do
1663                     h=$(basename $d)
1664                     dir=${aros_kernel_cc_includes}$(echo $(dirname $d) | \
1665                                                 sed -n "s,^.*/include\(/.*\),\1,p")
1666                     ! test -d $dir && mkdir -p $dir
1667                     ! test -f $dir/$h && { cp $d $dir; chmod u+w $dir/$h; }
1668                 done
1669             done            
1670         fi
1671     fi
1672     AC_MSG_RESULT($aros_kernel_cc_includes)
1673     # Adding -nostdinc to kernel includes as they are always used together.
1674     aros_kernel_includes="$aros_kernel_includes $aros_target_nostdinc_cflags -isystem $aros_kernel_cc_includes"
1677 dnl find out about the target cc's include path
1678 AC_MSG_CHECKING([for the target compiler's include path])
1679 if test "$aros_target_cc_includes" = "" ; then
1680     #try to guess where the directory is
1681     aros_target_cc_includes=`dirname \`${orig_target_cc} -print-libgcc-file-name\``/include
1682     if ! test -d $aros_target_cc_includes; then
1683         #the directory doesn't exist, we need to do some more work
1684         aros_target_cc_includes=${PWD}/${aros_gendir}/cc_include
1685         
1686         #these are the headers we're looling for
1687         headers="limits.h mmintrin.h stdbool.h syslimits.h float.h \
1688                  stddef.h xmmintrin.h iso646.h stdarg.h unwind.h   \
1689                  zutil.h"
1691         dirs=
1692         for h in $headers; do
1693             #which other headers each of the above headers needs?
1694             deps=$(echo "#include <$h>" | \
1695                    $orig_target_cc -E -M - 2>/dev/null | \
1696                    sed 's/^.*://; s/\\$/ /g; s/[[ \t]]\+/ /g')
1697             
1698             #copy all the needed headers to a directory beneath gendir
1699             for d in $deps; do
1700                 h=$(basename $d)
1701                 dir=${aros_target_cc_includes}$(echo $(dirname $d) | \
1702                                                 sed -n "s,^.*/include\(/.*\),\1,p")
1703                 ! test -d $dir && mkdir -p $dir
1704                 ! test -f $dir/$h && { cp $d $dir; chmod u+w $dir/$h; }
1705             done
1706         done        
1707     fi
1709 AC_MSG_RESULT($aros_target_cc_includes)
1712 # For GCC < 4.0 -I- is used for giving the search path for '#include "..."'
1713 # On GCC >= 4.0 -iquote should be used
1716 save_cc="$CC"
1717 save_cflags="$CFLAGS"
1718 CFLAGS="-iquote."
1719 AC_MSG_CHECKING([whether ${CC} accepts -iquote])
1720 AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
1721 AC_MSG_RESULT($has_iquote)
1722 if test "x-$has_iquote" = "x-yes" ; then
1723     host_cflags_iquote=-iquote
1724     host_cflags_iquote_end=
1725 else
1726     host_cflags_iquote=-I
1727     host_cflags_iquote_end=-I-
1729 kernel_cflags_iquote=$host_cflags_iquote
1730 kernel_cflags_iquote_end=$host_cflags_iquote_end
1731 if test "x-$cross_compiling" = "x-yes"; then
1732     CC="$aros_kernel_cc"
1733     AC_MSG_CHECKING([whether ${CC} accepts -fno-stack-protector])
1734     AC_TRY_COMPILE(,, use_no_stack_protector="yes", use_no_stack_protector="no")
1735     AC_MSG_RESULT($use_no_stack_protector)
1736     AC_MSG_CHECKING([whether ${CC} accepts -iquote])
1737     AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
1738     AC_MSG_RESULT($has_iquote)
1739     if test "x-$has_iquote" = "x-yes" ; then
1740         kernel_cflags_iquote=-iquote
1741         kernel_cflags_iquote_end=
1742     else
1743         kernel_cflags_iquote=-I
1744         kernel_cflags_iquote_end=-I-
1745     fi
1747 aros_cflags_iquote=$kernel_cflags_iquote
1748 aros_cflags_iquote_end=$kernel_cflags_iquote_end
1749 if test "$orig_target_cc" != "$aros_kernel_cc"; then
1750     CC="$orig_target_cc"
1751     AC_MSG_CHECKING([whether ${CC} accepts -iquote])
1752     AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
1753     AC_MSG_RESULT($has_iquote)
1754     if test "x-$has_iquote" = "x-yes" ; then
1755         aros_cflags_iquote=-iquote
1756         aros_cflags_iquote_end=
1757     else
1758         aros_cflags_iquote=-I
1759         aros_cflags_iquote_end=-I-
1760     fi
1762 if test "x-$use_no_stack_protector" = "x-yes" ; then
1763     aros_kernel_cflags="$aros_kernel_cflags -fno-stack-protector"
1766 #-----------------------------------------------------------------------------
1768 # Check if we can explicitly choose older version of symbol hashing
1770 CFLAGS="save_cflags -Wl,--hash-style=sysv"
1771 CC="$aros_kernel_cc"
1772 AC_MSG_CHECKING([whether ${CC} accepts -Wl,--hash-style=sysv])
1773 AC_TRY_LINK(,, use_hash_style="yes", use_hash_style="no")
1774 AC_MSG_RESULT($use_hash_style)
1775 if test "x-$use_hash_style" = "x-yes" ; then
1776     aros_kernel_cflags="$aros_kernel_cflags -Wl,--hash-style=sysv"
1778 CC="$save_cc"
1779 CFLAGS="$save_cflags"
1781 AC_SUBST(host_cflags_iquote)
1782 AC_SUBST(host_cflags_iquote_end)
1783 AC_SUBST(kernel_cflags_iquote)
1784 AC_SUBST(kernel_cflags_iquote_end)
1785 AC_SUBST(aros_cflags_iquote)
1786 AC_SUBST(aros_cflags_iquote_end)
1789 dnl Check if user specified --with-resolution=XRESxYRESxDEPTH
1790 AC_MSG_CHECKING([for default resolution of WBScreen])
1791 AC_ARG_WITH(resolution,AC_HELP_STRING([--with-resolution=XRESxYRESxDEPTH],[Default resolution of the initial WorkbenchScreen]),resolution=$withval,resolution=none)
1792 # We require an argument, so map --with/--without ("yes"/"no") to "none" specified
1793 if test "$resolution" = "yes" ; then
1794     resolution="none"
1796 if test "$resolution" = "no" ; then
1797     resolution="none"
1799 if test "$resolution" != "none" ; then
1800     aros_default_wbwidth=`echo $resolution | cut -d'x' -f1`
1801     aros_default_wbheight=`echo $resolution | cut -d'x' -f2`
1802     aros_default_wbdepth=`echo $resolution | cut -d'x' -f3`
1804 AC_MSG_RESULT($aros_default_wbwidth x $aros_default_wbheight x $aros_default_wbdepth)
1805 aros_cv_default_wbwidth=$aros_default_wbwidth
1806 aros_cv_default_wbheight=$aros_default_wbheight
1807 aros_cv_default_wbdepth=$aros_default_wbdepth
1809 dnl See if the user wants the serial debug output for native flavour
1810 AC_MSG_CHECKING([if serial debug is enabled])
1811 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)
1812 if test "$aros_serial_debug" = 0 ; then
1813     serial_debug_forced=""
1814     if test "$serial_debug" = "yes" ; then
1815         serial_debug="2"
1816     fi
1817     if test "$serial_debug" = "no" ; then
1818         serial_debug="none"
1819     fi
1820 else
1821     serial_debug_forced="(forced)"
1822     serial_debug=$aros_serial_debug
1824 if test "$serial_debug" != "none" ; then
1825     aros_serial_debug=$serial_debug
1826     AC_MSG_RESULT($serial_debug_forced on port $serial_debug)
1827 else
1828     AC_MSG_RESULT(no)
1831 dnl See if the user wants the palm debug output hack for palm native flavour
1832 AC_MSG_CHECKING([if palm debug hack is enabled])
1833 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")
1834 if test "$palm_debug_hack" = "yes" ; then
1835     aros_palm_debug_hack="1"
1837 AC_MSG_RESULT($palm_debug_hack)
1840 dnl See if the user wants nesting supervisor activated for unix flavour
1841 AC_MSG_CHECKING([if nesting supervisor support is enabled])
1842 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")
1843 if test "$nesting_supervisor" = "yes" ; then
1844     aros_nesting_supervisor="1"
1846 AC_MSG_RESULT($nesting_supervisor)
1848 dnl See if the user wants to disable MMU support
1849 dnl This can be overriden on per-target basis,
1850 dnl set $aros_enable_mmu to "yes" or "no" to do this
1851 if test "$aros_enable_mmu" = "" ; then
1852     AC_MSG_CHECKING([if MMU support is enabled])
1853     dnl Enabled by default
1854     AC_ARG_ENABLE(mmu,AC_HELP_STRING([--disable-mmu],[Disable MMU support (default=enabled)]),aros_enable_mmu=$enableval,aros_enable_mmu="yes")
1855     if test "$aros_enable_mmu" = "" ; then
1856         aros_enable_mmu="yes"
1857     fi
1858     AC_MSG_RESULT($aros_enable_mmu)
1860 if test "$aros_enable_mmu" = "no" ; then
1861     aros_enable_mmu="0"
1862 else
1863     aros_enable_mmu="1"
1865     
1867 dnl things specifically required for hosted flavours
1868 if test "x-$aros_flavour" = "x-emulation" -o "x-$aros_flavour" = "x-emulcompat" ; then
1870     if test "x-$need_dlopen" != "x-no" ; then
1871       dnl some kind of dynamic library access system is required for hostlib.resource
1872       AC_CHECK_FUNC(dlopen, have_dl="yes", have_dl="no")
1873       if test "x-$have_dl" = "x-no" ; then
1874           AC_CHECK_LIB(dl, dlopen, [have_dl="yes"
1875                                     aros_host_ldflags="$aros_host_ldflags -ldl"],
1876                                     have_dl="no")
1877       fi
1878       if test "x-$have_dl" = "x-no" ; then
1879           AC_MSG_ERROR([dlopen() dynamic linker functions not available])
1880       fi
1881     fi
1884     dnl x11 hidd
1885     AC_ARG_ENABLE(x11_hidd, AC_HELP_STRING([--enable-x11-hidd],
1886                                            [build X11 hidd for hosted (default=auto)]),
1887                                            x11_hidd="$enableval",
1888                                            x11_hidd="$need_x11")
1889     case "x-$x11_hidd" in
1890         x-yes|x-no|x-auto)                 ;;
1891         *)                 x11_hidd="$need_x11" ;;
1892     esac
1894     ENABLE_X11=0
1896     dnl they want it
1897     if test "x-$x11_hidd" != "x-no" ; then
1899         dnl find x11 stuff
1900         AC_PATH_X
1902         x_cflags=
1903         for path in $x_libraries
1904         do
1905             x_cflags="$x_cflags -L$path"
1906         done
1908         for path in $x_includes
1909         do
1910             x_cflags="$x_cflags -I$path"
1911         done
1912         
1913         if test "x-$no_x" = "x-yes" ; then
1915             dnl didn't find it
1916             if test "x-$x11_hidd" != "x-auto" ; then
1917                 dnl and they explicitly asked for it, bail out
1918                 AC_MSG_ERROR([X11 libs/headers not found, cannot build X11 hidd as requested])
1919             fi
1920         
1921         else
1922             dnl found it, setup the metatarget
1923             x11_hidd_target=kernel-x11gfx-kobj
1924             ENABLE_X11=1
1926             dnl setup shared memory extensions
1927             AC_ARG_ENABLE(x11_shm, AC_HELP_STRING([--enable-x11-shm],
1928                                                   [use X11 shared memory (default=auto)]),
1929                                                   x11_hidd_shm="$enableval",
1930                                                   x11_hidd_shm="auto")
1931             case "x-$x11_hidd_shm" in
1932                 x-yes|x-no|x-auto)                     ;;
1933                 *)                 x11_hidd_shm="auto" ;;
1934             esac
1936             have_xshm=no
1938             dnl they want it
1939             if test "x-$x11_hidd_shm" != "x-no" ; then
1941                 dnl system shm headers
1942                 AC_CHECK_HEADERS(sys/ipc.h)
1943                 AC_CHECK_HEADERS(sys/shm.h)
1945                 dnl got them
1946                 if test "x-$ac_cv_header_sys_ipc_h" = "x-yes" -a "x-$ac_cv_header_sys_shm_h" = "x-yes" ; then
1948                     dnl make sure X libs have shm functions
1949                     save_cflags="$CFLAGS"
1950                     CFLAGS="$CFLAGS $x_cflags"
1951                     AC_CHECK_LIB(Xext, XShmQueryExtension, have_xshm=yes)
1952                     CFLAGS="$save_cflags"
1953                 fi
1954             fi
1956             dnl detection done, prepare output
1957             if test "x-$have_xshm" = "x-yes" ; then
1958                 dnl we can do shm
1959                 DO_XSHM_SUPPORT="1"
1960             elif test "x-$x11_hidd_shm" = "x-yes" ; then
1961                 dnl they explicitly asked for it, but we can't do it
1962                 AC_MSG_ERROR([X11 has no support for shared memory, cannot enable it as requested])
1963             else
1964                 dnl otherwise just disable it
1965                 DO_XSHM_SUPPORT="0"
1966             fi
1968             
1969             dnl setup vidmode (fullscreen) extensions
1970             AC_ARG_ENABLE(x11_vidmode, AC_HELP_STRING([--enable-x11-vidmode],
1971                                                       [use X11 vidmode extension (default=auto)]),
1972                                                       x11_hidd_vidmode="$enableval",
1973                                                       x11_hidd_vidmode="auto")
1974             case "x-$x11_hidd_vidmode" in
1975                 x-yes|x-no|x-auto)                         ;;
1976                 *)                 x11_hidd_vidmode="auto" ;;
1977             esac
1979             have_vidmode=no
1981             dnl they want it
1982             if test "x-$x11_hidd_vidmode" != "x-no" ; then
1984                 dnl make sure X libs have vidmode functions
1985                 save_cflags="$CFLAGS"
1986                 CFLAGS="$CFLAGS $x_cflags"
1987                 AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryExtension, have_vidmode=yes)
1988                 CFLAGS="$save_cflags"
1989             fi
1991             dnl detection done, prepare output
1992             if test "x-$have_vidmode" = "x-yes" ; then
1993                 dnl we can do vidmode
1994                 DO_VIDMODE_SUPPORT="1"
1995             elif test "x-$x11_hidd_vidmode" = "x-yes" ; then
1996                 dnl they explicitly asked for it, but we can't do it
1997                 AC_MSG_ERROR([X11 vidmode extension not available, cannot enable it as requested])
1998             else
1999                 dnl otherwise just disable it
2000                 DO_VIDMODE_SUPPORT="0"
2001             fi
2002         fi
2004         aros_host_x11_includes=$x_includes 
2005         aros_host_x11_libdirs=$x_libraries
2006     fi
2009     dnl sdl hidd
2010     AC_ARG_ENABLE(sdl_hidd, AC_HELP_STRING([--enable-sdl-hidd],
2011                                            [build SDL hidd for hosted (default=auto)]),
2012                                            sdl_hidd="$enableval",
2013                                            sdl_hidd="auto")
2014     case "x-$sdl_hidd" in
2015         x-yes|x-no|x-auto)                 ;;
2016         *)                 sdl_hidd="auto" ;;
2017     esac
2019     dnl they want it
2020     if test "x-$sdl_hidd" != "x-no" ; then
2022         dnl find sdl
2023         AM_PATH_SDL([1.2.10], have_sdl="yes", have_sdl="no")
2025         if test "x-$have_sdl" != "x-yes" ; then
2027             dnl didn't find it
2028             if test "x-$sdl_hidd" != "x-auto" ; then
2029                 dnl and they explicitly asked for it, bail out
2030                 AC_MSG_ERROR([SDL libs/headers not found, cannot build SDL hidd as requested])
2031             fi
2033         else
2034             dnl found it, set up the metatarget
2035             sdl_hidd_target=kernel-hidd-sdl
2036             aros_host_sdl_cflags=SDL_CFLAGS
2037             aros_host_sdl_libs=SDL_LIBS
2038         fi
2039     fi
2041     dnl oss.library
2042     AC_CHECK_HEADER(sys/soundcard.h)
2043     if test "x-$ac_cv_header_sys_soundcard_h" = "x-yes" ; then
2044         oss_library_target=workbench-libs-oss-unix
2045     fi
2049 dnl See if the user wants dbus.library
2050 AC_MSG_CHECKING([if building of dbus.library is enabled])
2051 AC_ARG_ENABLE(dbus,AC_HELP_STRING([--enable-dbus],[Enable DBUS support via dbus.library (default=no)]),dbus="yes",dbus="no")
2052 if test "$dbus" = "yes" ; then
2053     ENABLE_DBUS=1
2054     DBUS_CFLAGS=`pkg-config --cflags dbus-1`
2055     DBUS_LIBFLAGS=`pkg-config --libs dbus-1`
2056     KERNEL_DBUS_KOBJ=kernel-dbus-kobj
2057     KERNEL_DBUS_INCLUDES=kernel-dbus-includes
2058 else
2059     ENABLE_DBUS=0
2061 AC_MSG_RESULT($dbus)
2064 dnl --------------------------------------------------------------------
2065 dnl Configuration Output Section
2066 dnl --------------------------------------------------------------------
2068 # Generic
2069 AC_SUBST(aros_arch)
2070 AC_SUBST(aros_cpu)
2071 AC_SUBST(aros_flavour)
2072 AC_SUBST(aros_flavour_uc)
2073 AC_SUBST(AROS_BUILDDIR)
2074 AC_SUBST(AROS_BUILDDIR_UNIX)
2075 AC_SUBST(SRCDIR)
2076 AC_SUBST(AROS_PORTSSRCDIR)
2078 # Host related
2079 AC_SUBST(aros_cc_pre)
2080 AC_SUBST(aros_host_strip)
2081 AC_SUBST(aros_host_arch)
2082 AC_SUBST(aros_host_cpu)
2083 AC_SUBST(aros_host_cc)
2084 AC_SUBST(aros_host_ar)
2085 AC_SUBST(aros_host_ranlib)
2086 AC_SUBST(aros_host_ld)
2087 AC_SUBST(aros_host_make)
2088 AC_SUBST(aros_host_cflags)
2089 AC_SUBST(gnu89_inline)
2090 AC_SUBST(aros_host_ldflags)
2091 AC_SUBST(aros_host_debug)
2092 AC_SUBST(aros_host_mkdep)
2093 AC_SUBST(aros_host_mkargs)
2094 AC_SUBST(aros_host_exe_suffix)
2095 AC_SUBST(aros_host_lib_suffix)
2096 AC_SUBST(aros_tools_dir)
2097 AC_SUBST(aros_host_aclocal)
2098 AC_SUBST(aros_host_autoconf)
2099 AC_SUBST(aros_host_autoheader)
2100 AC_SUBST(aros_host_automake)
2102 # Target Related
2103 AC_SUBST(aros_target_guitheme)
2104 AC_SUBST(aros_target_iconset)
2105 AC_SUBST(aros_target_bootloader)
2106 AC_SUBST(aros_target_arch)
2107 AC_SUBST(aros_target_family)
2108 AC_SUBST(aros_target_cpu)
2109 AC_SUBST(aros_target_variant)
2110 AC_SUBST(aros_target_suffix)
2111 AC_SUBST(aros_target_incl)
2112 AC_SUBST(aros_target_ar)
2113 AC_SUBST(aros_target_ranlib)
2114 AC_SUBST(aros_kernel_nm)
2115 AC_SUBST(aros_kernel_ar)
2116 AC_SUBST(orig_target_cc)
2117 AC_SUBST(aros_target_cc)
2118 AC_SUBST(aros_target_cxx)
2119 AC_SUBST(aros_kernel_cc)
2120 AC_SUBST(aros_target_as)
2121 AC_SUBST(orig_target_ld)
2122 AC_SUBST(aros_target_ld)
2123 AC_SUBST(aros_kernel_ld)
2124 AC_SUBST(aros_target_cc_includes)
2125 AC_SUBST(aros_target_cc_path)
2126 AC_SUBST(aros_target_objdump)
2127 AC_SUBST(aros_target_objcopy)
2128 AC_SUBST(aros_target_strip)
2129 AC_SUBST(aros_target_nm)
2130 AC_SUBST(aros_kernel_rescomp)
2131 AC_SUBST(aros_shared_default)
2132 AC_SUBST(aros_shared_ld)
2133 AC_SUBST(aros_object_format)
2134 AC_SUBST(aros_compiler_libs)
2135 AC_SUBST(aros_arch_libs)
2137 AC_SUBST(aros_config_cflags)
2138 AC_SUBST(aros_config_aflags)
2139 AC_SUBST(aros_config_ldflags)
2141 AC_SUBST(aros_shared_cflags)
2142 AC_SUBST(aros_shared_aflags)
2143 AC_SUBST(aros_shared_ldflags)
2144 AC_SUBST(aros_kernel_cflags)
2145 AC_SUBST(aros_kernel_includes)
2146 AC_SUBST(aros_kernel_objcflags)
2147 AC_SUBST(aros_kernel_ldflags)
2148 AC_SUBST(aros_target_cflags)
2149 AC_SUBST(aros_debug_cflags)
2150 AC_SUBST(aros_debug_aflags)
2151 AC_SUBST(aros_debug_ldflags)
2152 AC_SUBST(aros_paranoia_cflags)
2153 AC_SUBST(aros_target_genmap)
2154 AC_SUBST(aros_target_strip_flags)
2156 AC_SUBST(crosstools_target)
2158 # Graphics Related
2159 AC_SUBST(x11_hidd_target)
2160 AC_SUBST(sdl_hidd_target)
2161 AC_SUBST(pci_hidd_target)
2162 AC_SUBST(oss_library_target)
2164 AC_SUBST(aros_default_wbwidth)
2165 AC_SUBST(aros_default_wbheight)
2166 AC_SUBST(aros_default_wbdepth)
2167 AC_SUBST(DO_XSHM_SUPPORT)
2168 AC_SUBST(DO_VIDMODE_SUPPORT)
2170 AC_SUBST(aros_host_x11_includes)
2171 AC_SUBST(aros_host_x11_libdirs)
2172 AC_SUBST(aros_host_sdl_cflags)
2173 AC_SUBST(aros_host_sdl_libs)
2175 # Native version related
2176 AC_SUBST(aros_serial_debug)
2178 # Palm native version related
2179 AC_SUBST(aros_palm_debug_hack)
2181 # Unix/Hosted version related
2182 AC_SUBST(aros_nesting_supervisor)
2184 # MMU related
2185 AC_SUBST(aros_enable_mmu)
2187 # Apple iOS related
2188 AC_SUBST(aros_ios_platform)
2189 AC_SUBST(aros_ios_version)
2190 AC_SUBST(aros_ios_sdk)
2192 # Android related
2193 AC_SUBST(android_tool)
2194 AC_SUBST(aros_android_level)
2196 # DBUS related
2197 AC_SUBST(ENABLE_DBUS)
2198 AC_SUBST(DBUS_CFLAGS)
2199 AC_SUBST(DBUS_LIBFLAGS)
2200 AC_SUBST(KERNEL_DBUS_KOBJ)
2201 AC_SUBST(KERNEL_DBUS_INCLUDES)
2203 #X11 related
2204 AC_SUBST(ENABLE_X11)
2206 # Debug related
2207 AC_SUBST(aros_debug)
2208 AC_SUBST(aros_mungwall_debug)
2209 AC_SUBST(aros_stack_debug)
2210 AC_SUBST(aros_modules_debug)
2212 # Collect-aros stuff: "-ius" to ignore undefined symbols
2213 AC_SUBST(ignore_undefined_symbols)
2215 # C compiler related
2216 AC_SUBST(gcc_target_cpu)
2218 dnl Prepare for output, make up all the generated patches
2219 case "$aros_flavour" in
2220 emulation)      aros_flavour_uc="AROS_FLAVOUR_EMULATION"
2221                 aros_flavour="emulation" ;;
2222 emulcompat)     aros_flavour_uc="(AROS_FLAVOUR_EMULATION|AROS_FLAVOUR_BINCOMPAT)"
2223                 aros_flavour="emulation" ;;
2224 standalone)     aros_flavour_uc="AROS_FLAVOUR_STANDALONE"
2225                 aros_flavour="standalone";;
2226 standcompat)    aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_BINCOMPAT)"
2227                 aros_flavour="standalone";;
2228 native)         aros_flavour_uc="AROS_FLAVOUR_NATIVE"
2229                 aros_flavour="native" ;;
2230 nativecompat)   aros_flavour_uc="(AROS_FLAVOUR_NATIVE|AROS_FLAVOUR_BINCOMPAT)"
2231                 aros_flavour="native" ;;
2232 linklib)        aros_flavour_uc="AROS_FLAVOUR_LINKLIB"
2233                 aros_flavour="linklib" ;;
2234 palmnative)     aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
2235                 aros_flavour="palmnative" ;;
2236 mac68knative)   aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
2237                 aros_flavour="mac68knative" ;;
2238 ppcnative)      aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_BINCOMPAT)"
2239                 aros_flavour="ppcnative" ;;
2240 esac
2242 if test ! -d ${aros_inc_dir} ; then
2243     ${MKDIR} ${aros_inc_dir}
2245 if test ! -d ${aros_geninc_dir} ; then
2246     ${MKDIR} ${aros_geninc_dir}
2248 if test ! -d ${aros_hostcfg_dir} ; then
2249     ${MKDIR} ${aros_hostcfg_dir}
2251 if test ! -d ${aros_targetcfg_dir} ; then
2252     ${MKDIR} ${aros_targetcfg_dir}
2254 if test ! -d ${aros_tools_dir} ; then
2255     ${MKDIR} ${aros_tools_dir}
2257 if test ! -d ${aros_scripts_dir} ; then
2258     ${MKDIR} ${aros_scripts_dir}
2261 AC_CONFIG_HEADERS(${aros_geninc_dir}/host-conf.h:config/host-conf.h.in)
2263 AC_CONFIG_COMMANDS([compiler_executable],
2264     [
2265         prefix=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}
2266         mkdir -p $prefix
2267         prefix="${prefix}/${aros_target_cpu}-aros"
2268         prefix2=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros
2270         echo ${prefix}
2271         echo ${prefix2}
2272         chmod a+x ${prefix2}-gcc ${prefix2}-ld
2274         ln -sf ${prefix2}-gcc          ${prefix}-gcc
2275         ln -sf ${prefix2}-ld           ${prefix}-ld
2277         ln -sf $aros_target_as_ln$aros_host_exe_suffix      ${prefix}-as
2278         ln -sf $aros_target_nm_ln$aros_host_exe_suffix      ${prefix}-nm
2279         ln -sf $aros_target_ar_ln$aros_host_exe_suffix      ${prefix}-ar
2280         ln -sf $aros_target_ranlib_ln$aros_host_exe_suffix  ${prefix}-ranlib
2281         ln -sf $aros_target_objcopy_ln$aros_host_exe_suffix ${prefix}-objcopy
2282         ln -sf $aros_target_objdump_ln$aros_host_exe_suffix ${prefix}-objdump
2283         ln -sf $aros_target_strip_ln$aros_host_exe_suffix   ${prefix}-strip
2285         ln -sf $aros_target_as_ln$aros_host_exe_suffix      ${prefix2}-as
2286         ln -sf $aros_target_nm_ln$aros_host_exe_suffix      ${prefix2}-nm
2287         ln -sf $aros_target_ar_ln$aros_host_exe_suffix      ${prefix2}-ar
2288         ln -sf $aros_target_ranlib_ln$aros_host_exe_suffix  ${prefix2}-ranlib
2289         ln -sf $aros_target_objcopy_ln$aros_host_exe_suffix ${prefix2}-objcopy
2290         ln -sf $aros_target_objdump_ln$aros_host_exe_suffix ${prefix2}-objdump
2291         ln -sf $aros_target_strip_ln$aros_host_exe_suffix   ${prefix2}-strip
2292     ],
2293     [
2294         aros_host_exe_suffix=${aros_host_exe_suffix}
2295         aros_tools_dir=${aros_tools_dir}
2296         aros_target_cpu=${aros_target_cpu}
2297         aros_target_arch=${aros_target_arch}
2298         aros_target_suffix=${aros_target_suffix}
2299         aros_target_nm_ln=${aros_target_nm_ln}
2300         aros_target_as_ln=${aros_target_as_ln}
2301         aros_target_ar_ln=${aros_target_ar_ln}
2302         aros_target_ranlib_ln=${aros_target_ranlib_ln}
2303         aros_target_objdump_ln=${aros_target_objdump_ln}
2304         aros_target_objcopy_ln=${aros_target_objcopy_ln}
2305         aros_target_strip_ln=${aros_target_strip_ln}
2306     ]
2308 AC_CONFIG_COMMANDS([genmf_executable],
2309     [chmod a+x ${aros_tools_dir}/genmf.py],
2310     [aros_tools_dir=${aros_tools_dir}]
2313 AC_CONFIG_FILES(
2314     Makefile
2315     config/make.cfg
2316     ${aros_inc_dir}/config.h:config/config.h.in
2317     ${aros_geninc_dir}/config.h:config/config.h.in
2318     ${aros_hostcfg_dir}/host.cfg:config/host.cfg.in
2319     ${aros_targetcfg_dir}/target.cfg:config/target.cfg.in
2320     mmake.config
2321     ${aros_targetcfg_dir}/make.defaults:config/make.defaults.in
2322     ${aros_targetcfg_dir}/specs:config/specs.in
2323     ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-gcc:scripts/aros-gcc.in
2324     ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-ld:scripts/aros-ld.in
2325     ${aros_tools_dir}/genmf.py:tools/genmf/genmf.py
2326     tools/collect-aros/env.h
2327     ${aros_gendir}/arch/all-android/bootstrap/app/default.properties:arch/all-android/bootstrap/app/default.properties.in
2330 AC_OUTPUT
2332 dnl This is in order to not define SHARED_CFLAGS sometimes
2333 dnl We don't always do aros_shared_ar, aros_shared_cflags
2335 #XXX compatability...
2336 aros_shared_ar="$aros_shared_ld $aros_shared_ldflags -o"
2338 if test -n "$aros_shared_cflags" ; then
2339     echo "SHARED_CFLAGS := $aros_shared_cflags" >> ${aros_hostcfg_dir}/host.cfg
2340     echo "SHARED_AR := $aros_shared_ar" >> ${aros_hostcfg_dir}/host.cfg