Always close arosc.library when child launcher() reaches end.
[AROS.git] / configure.in
blob388b2f0eadeade68aedecf7a141df7d1d4f2ed24
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     cross_compile=no
37 else
38     if test "$target" = "" ; then
39         target=$host_os-$host_cpu
40         cross_compile=no
41     else
42         cross_compile=yes
43     fi
45 AC_MSG_RESULT($target)
47 if test "$host_os" = "mingw32" ; then
48     PWDCMD="pwd -W"
51 #don't know where else to put this...
52 AC_MSG_CHECKING([Building AROS in .. ])
53 AROS_BUILDDIR=`${PWDCMD-pwd}`
54 AROS_BUILDDIR_UNIX=${PWD}
55 AC_MSG_RESULT($AROS_BUILDDIR)
57 AC_MSG_CHECKING([AROS Source in .. ])
58 srcpwd=`cd ${srcdir} ; ${PWDCMD-pwd}`
59 SRCDIR=${srcpwd}
60 AC_MSG_RESULT($SRCDIR)
62 # Parse the target field into something useful.
63 changequote(<<,>>)
64 target_os=`echo $target | sed 's/^\([^-]*\)-\(.*\)$/\1/'`
65 target_cpu=`echo $target | sed 's/^\([^-]*\)-\(.*\)$/\2/'`
66 changequote([,])
68 dnl --------------------------------------------------------------------
69 dnl Set the default Workbench resolution
70 dnl --------------------------------------------------------------------
71 aros_default_wbwidth=800
72 aros_default_wbheight=600
73 aros_default_wbdepth=4
75 dnl --------------------------------------------------------------------
76 dnl Host Configuration Section
77 dnl --------------------------------------------------------------------
78 dnl
79 dnl The idea here is to find out all the information we need about the
80 dnl host. This means things like tools for building directory structures,
81 dnl copying files around and the like.
83 # The first step is to find the host binaries.
84 # Check for a compiler.
85 AC_PROG_CC
86 AC_PROG_CC_STDC
87 AC_PROG_CPP
89 # Check for a compatible awk
90 AC_CHECK_PROGS(AWK,[gawk nawk])
91 AROS_REQUIRED(gawk,$AWK)
92 AROS_PROG(MMAKE,mmake)
94 # Perform some default variable assignments. Note all of these will be
95 # Regenerated from the script, so there is no need to cache them.
97 aros_host_cc="$CC"
98 AROS_TOOL_CCPATH(aros_host_ld,ld)
99 AROS_REQUIRED(ld,$aros_host_ld)
100 aros_host_make="make"
101 aros_host_cflags=$CFLAGS
102 aros_host_ldflags=$LDFLAGS
103 aros_host_debug="-g -O0"
104 aros_host_mkdep="\$(SRCDIR)/scripts/mkdep"
105 aros_host_mkargs="--no-print-directory"
106 aros_host_incl="/usr/include"
107 aros_host_exe_suffix="$EXEEXT"
108 aros_host_lib_suffix=""
110 AC_CHECK_PROGS(aros_host_aclocal,[aclocal aclocal19 aclocal-1.9])
111 AC_CHECK_PROGS(aros_host_autoconf,[autoconf autoconf259 autoconf253])
112 AC_CHECK_PROGS(aros_host_autoheader,[autoheader autoheader259 autoheader253])
113 AC_CHECK_PROGS(aros_host_automake,[automake automake19 automake-1.9])
115 AROS_REQUIRED(aclocal/aclocal19/aclocal-1.9, $aros_host_aclocal)
116 AROS_REQUIRED(automake/automake19/automake-1.9, $aros_host_automake)
118 case "$aros_host_cc" in
119     *gcc*)
120         aros_host_cc_pipe="-pipe"
121         ;;
122     icc)
123         aros_host_cc_pipe=""
124         ;;
125     *)
126         aros_host_cc_pipe=""
127         ;;
128 esac
130 aros_kernel_cc_includes=""
131 aros_target_cc_includes=""
133 # This is the main host configuration section. It is where the host
134 # can change the values of any variables it needs to change. We do
135 # not look at anything that compiles to the target yet, we'll get
136 # to that later.
138 case "$host_os" in
139     aros*)
140         aros_host_arch="aros"
141         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
142         case "$host_cpu" in
143             *i?86*)
144                 aros_host_cpu="i386"
145                 ;;
146             *x86_64*)
147                 aros_host_cpu="x86_64"
148                 ;;
149             *powerpc*)
150                 aros_host_cpu="ppc"
151                 ;;
152             *)
153                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
154                 aros_host_cpu="$host_cpu"
155                 ;;
156         esac
157         ;;
159     linux*)
160         aros_host_arch="linux"
161         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
162         case "$host_cpu" in
163             *i?86*)
164                 aros_host_cpu="i386"
165                 ;;
166             *x86_64*)
167                 aros_host_cpu="x86_64"
168                 ;;
169             *m68k*)
170                 aros_host_cpu="m68k"
171                 ;;
172             *powerpc*)
173                 aros_host_cpu="ppc"
174                 ;;
175             *arm*)
176                 aros_host_cpu="arm"
177                 ;;
178             *)
179                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
180                 aros_host_cpu="$host_cpu"
181                 ;;
182         esac
183         ;;
185     freebsd*)
186         aros_host_cc="$aros_host_cc $aros_host_cc_pipe -I/usr/local/include"
187         aros_host_make="gmake"
188         aros_host_arch="freebsd"
189         aros_host_cpu="i386"
191         aros_host_ldflags="$aros_host_ldflags -L/usr/local/lib -liconv"
193         dnl FreeBSD 5.x (and later) has changed the default object format.
194         dnl The double [[]] is necessary to get around m4's quoting rules.
195         case $host_os in
196             freebsd[[234]]*)
197                 aros_object_format="elf_i386"
198                 ;;
200             *)
201                 aros_object_format="elf_i386_fbsd"
202                 ;;
203         esac
205         ;;
207     darwin*)
208         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
209         aros_host_arch="darwin"
210         case "$host_cpu" in
211             *i?86*)
212                 aros_host_cpu="i386"
213                 ;;
214             *x86_64*)
215                 aros_host_cpu="x86_64"
216                 ;;
217             *powerpc*)
218                 aros_host_cpu="ppc"
219                 ;;
220             *)
221                 AC_MSG_WARN("Unknown CPU for Darwin host -- $host_cpu")
222                 aros_host_cpu="$host_cpu"
223                 ;;
224         esac
226         aros_host_ldflags="$aros_host_ldflags -liconv"
228         ;;
230     dragonfly*)
231         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
232         aros_host_make="gmake"
233         aros_host_arch="dragonfly"
234         case $host_cpu in
235             *i?86*)
236                 aros_host_cpu="i386"
237                 ;;
238             *amd64*)
239                 aros_host_cpu="x86_64"
240                 ;;
241             *)
242                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
243                 aros_host_cpu="$host_cpu"
244                 ;;
245         esac
246         ;;
248     netbsd*)
249         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
250         aros_host_make="gmake"
251         aros_host_arch="netbsd"
252         case "$host_cpu" in
253             *i?86*)
254                 aros_host_cpu="i386"
255                 ;;
256             *m68k*)
257                 aros_host_cpu="m68k"
258                 ;;
259             *)
260                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
261                 aros_host_cpu="$host_cpu"
262                 ;;
263         esac    
264         aros_host_lib_suffix=".0.0"
265         ;;
267     openbsd*)
268         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
269         aros_host_make="gmake"
270         aros_host_arch="openbsd"
271         case "$host_cpu" in
272             *i?86*)
273                 aros_host_cpu="i386"
274                 ;;
275             *)
276                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
277                 aros_host_cpu="$host_cpu"
278                 ;;
279         esac
280         ;;
281         
282     solaris*)
283         aros_host_arch="solaris"
284         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
285         case "$host_cpu" in
286             *i?86*)
287                 aros_host_cpu="i386"
288                 ;;
289             *sparc*)
290                 aros_host_cpu="sparc"
291                 ;;
292             *)
293                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
294                 aros_host_cpu="$host_cpu"
295                 ;;
296         esac
297         ;;
299     morphos*)
300         aros_host_arch="morphos"
301         aros_host_cpu="ppc"
302         ;;
304     amiga*)
305         aros_host_arch="amiga"
306         SORT="/gg/bin/sort"
307         TEST="/gg/bin/test"
308         UNIQ="/gg/bin/uniq"
309         FOR="for"
310         TOUCH="/gg/bin/touch"
311         case "$host_cpu" in
312             *m68k*)
313                 aros_host_cpu="m68k"
314                 ;;
315             *powerpc*)
316                 aros_host_cpu="ppc"
317                 ;;
318             *)
319                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
320                 aros_host_cpu="$host_cpu"
321                 ;;
322         esac
323         ;;
325     cygwin*)
326         aros_host_arch="cygwin"
327         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
328         android_build_os="windows"
329         android_tool="android.bat"
330         default_android_sdk="/cygdrive/c/android-sdk-windows-1.6_r1"
332         case "$host_cpu" in
333             *i?86*)
334                 aros_host_cpu="i386"
335                 ;;
336             *)
337                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
338                 aros_host_cpu="$host_cpu"
339                 ;;
340         esac
341         ;;
343     mingw32*)
344         aros_host_arch="mingw32"
345         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
346         android_build_os="windows"
347         android_tool="android.bat"
348         default_android_sdk="/c/android-sdk-windows-1.6_r1"
350         case "$host_cpu" in
351             *i?86*)
352                 aros_host_cpu="i386"
353                 ;;
354             *)
355                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
356                 aros_host_cpu="$host_cpu"
357                 ;;
358         esac
359         ;;
360     *)
361         AC_MSG_ERROR([Unsupported host architecture $host])
362         ;;
363 esac
365 AROS_PROG(aros_host_ar,[ar],[cr])
366 AROS_REQUIRED(ar,$aros_host_ar)
367 AROS_PROG(aros_host_ranlib,ranlib)
368 AROS_REQUIRED(ranlib,$aros_host_ranlib)
369 AROS_PROG(aros_host_strip,strip)
370 AROS_REQUIRED(strip,$aros_host_strip)
372 AROS_PROG(RM,[rm],[-rf])
373 AROS_REQUIRED(rm,$RM)
374 AROS_PROG(CP,[cp])
375 AROS_REQUIRED(cp,$CP)
376 AROS_PROG(MV,[mv])
377 AROS_REQUIRED(mv,$MV)
378 AROS_PROG(ECHO,[echo])
379 AROS_REQUIRED(echo,$ECHO)
380 AROS_PROG(MKDIR,[mkdir],[-p])
381 AROS_REQUIRED(mkdir,$MKDIR)
382 AROS_PROG(TOUCH,[touch])
383 AROS_REQUIRED(touch,$TOUCH)
384 AROS_PROG(SORT,[sort])
385 AROS_REQUIRED(sort,$SORT)
386 AROS_PROG(UNIQ,[uniq])
387 AROS_REQUIRED(uniq,$UNIQ)
388 AROS_PROG(NOP,[true])
389 AROS_REQUIRED(true,$NOP)
390 AROS_PROG(CAT,[cat])
391 AROS_REQUIRED(cat,$CAT)
392 AROS_PROG(BISON,[bison])
393 AROS_REQUIRED(bison,$BISON)
394 AROS_PROG(FLEX,[flex])
395 AROS_REQUIRED(flex,$FLEX)
396 AROS_PROG(PNGTOPNM,[pngtopnm])
397 AROS_REQUIRED(pngtopnm,$PNGTOPNM)
398 AROS_PROG(PPMTOILBM,[ppmtoilbm])
399 AROS_REQUIRED(ppmtoilbm,$PPMTOILBM)
400 AROS_PROG(SED,[sed])
401 AROS_REQUIRED(sed,$SED)
402 AROS_PROG(CHMOD,[chmod])
403 AROS_REQUIRED(chmod,$CHMOD)
404 AROS_PROG(PATCH,[patch])
405 AROS_REQUIRED(patch,$PATCH)
407 AM_PATH_PYTHON(2.5)
409 AC_SUBST(FOR, for)
410 AC_SUBST(IF, if)
411 AC_SUBST(TEST, test)
412 AC_SUBST(CMP, cmp)
414 dnl ---------------------------------------------------------------------------
415 dnl Look for things about the host system, good for hosted targets.
416 dnl ---------------------------------------------------------------------------
418 # Check for some includes for the X11 HIDD and the kernel
419 AC_CHECK_HEADERS([sys/ipc.h sys/shm.h \
420     sys/mmap.h sys/mman.h sysexits.h \
421     sys/statfs.h sys/statvfs.h sys/vfs.h sys/param.h \
424 AC_CHECK_HEADERS([sys/mount.h],,,[#include <sys/param.h>])
426 AC_HEADER_DIRENT
427 AC_HEADER_STAT
428 AC_HEADER_STDC
429 AC_HEADER_SYS_WAIT
430 AC_HEADER_TIME
431 AC_STRUCT_ST_BLKSIZE
432 AC_STRUCT_ST_BLOCKS
433 AC_STRUCT_ST_RDEV
434 AC_STRUCT_TM
435 AC_STRUCT_TIMEZONE
436 AC_TYPE_OFF_T
437 AC_TYPE_PID_T
438 AC_TYPE_SIZE_T
439 AC_TYPE_UID_T
441 AC_CHECK_MEMBERS(struct tm.tm_gmtoff)
443 # Look for some functions
444 AC_CHECK_FUNCS([getpagesize kqueue statfs statvfs \
445     clone kse_create rfork_thread thr_create sa_register \
446     getcontext makecontext setcontext sigaltstack swapcontext])
448 AC_FUNC_MMAP
451 dnl --------------------------------------------------------------------
452 dnl Target Configuration Section
453 dnl --------------------------------------------------------------------
455 dnl The target configuration section is responsible for setting up all
456 dnl the paths for includes, and tools required to build AROS to some
457 dnl particular target.
459 aros_config_cflags="-Wall -Werror-implicit-function-declaration"
460 aros_config_aflags="-Wall -x assembler-with-cpp -c"
461 aros_config_ldflags=""
463 aros_shared_default=yes
465 aros_shared_cflags="-fPIC"
466 aros_shared_aflags=""
467 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
468 aros_kernel_ldflags="-Wl,-rpath,./lib"
470 aros_target_ar_flags="cr"
471 aros_target_nm_flags="-C -ul"
472 aros_target_strip_flags="--strip-unneeded -R.comment"
474 aros_compiler_libs=
475 aros_arch_libs=
477 aros_target_genmap="-Wl,-Map -Xlinker"
479 # Native flavour stuff
480 aros_serial_debug="0"
482 # Palm native flavour stuff
483 aros_palm_debug_hack="0"
485 # Unix flavour stuff
486 aros_nesting_supervisor="0"
488 # Collect-aros stuff: "-ius" to ignore undefined symbols
489 ignore_undefined_symbols=""
491 # Check for X11 by default
492 need_x11="auto"
494 #-----------------------------------------------------------------------------
497 # GCC 4.1+ has a stack protection feature that requires OS support. Ubuntu has
498 # it switched on by default, and we use the host compiler, so it compiles AROS
499 # code with this enabled resulting in link failures as we don't have support
500 # for it.
502 # We use two methods to disable it. For the host compiler (used to compile
503 # some hosted modules), we test to see if the compiler supports stack
504 # protection, and if it does we disable it in AROS_CONFIG_CFLAGS. This should
505 # work on all platforms.
507 # For the "cross" compiler we clear the "ssp_default" spec in config/specs.in
508 # (this is done unconditionally, as it should have no effect on compilers
509 # without the stack protection feature). This may be specific to the way that
510 # Ubuntu enables the feature, so may not work everywhere. My specs-fu isn't
511 # strong enough to disable it in a generic way though, so we'll live with it
512 # until another vendor ships GCC with it enabled in a different way, and deal
513 # with it then.
516 AC_MSG_CHECKING([whether ${CC} accepts -fno-stack-protector])
517 save_cflags="$CFLAGS"
518 CFLAGS="$CFLAGS -fno-stack-protector"
519 AC_TRY_COMPILE(,, use_no_stack_protector="yes", use_no_stack_protector="no")
520 AC_MSG_RESULT($use_no_stack_protector)
521 if test "x-$use_no_stack_protector" = "x-yes" ; then
522     aros_host_cflags="$aros_host_cflags -fno-stack-protector"
524 CFLAGS="$save_cflags"
526 #-----------------------------------------------------------------------------
528 # Disable pointer-signedness warnings if the compiler recognises the option
529 # (this only works for the host compiler at the moment)
531 AC_MSG_CHECKING([whether ${CC} accepts -Wno-pointer-sign])
532 save_cflags="$CFLAGS"
533 CFLAGS="$CFLAGS -Wno-pointer-sign"
534 AC_TRY_COMPILE(,, use_no_sign_warning="yes", use_no_sign_warning="no")
535 AC_MSG_RESULT($use_no_sign_warning)
536 if test "x-$use_no_sign_warning" = "x-yes" ; then
537     aros_host_cflags="$aros_host_cflags -Wno-pointer-sign"
539 CFLAGS="$save_cflags"
541 #-----------------------------------------------------------------------------
543 # Check if host compiler supports -fgnu89-inline, can be needed for crosstools.
545 AC_MSG_CHECKING([whether ${CC} accepts -fgnu89-inline])
546 save_cflags="$CFLAGS"
547 CFLAGS="$CFLAGS -fgnu89-inline"
548 AC_TRY_COMPILE(,, use_gnu89_inline="yes", use_gnu89_inline="no")
549 AC_MSG_RESULT($use_gnu89_inline)
550 if test "x-$use_gnu89_inline" = "x-yes" ; then
551     gnu89_inline="-fgnu89-inline"
553 CFLAGS="$save_cflags"
555 #-----------------------------------------------------------------------------
557 AC_MSG_CHECKING([for type of build])
558 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")
560 if test "$build_type" = "nightly"; then
561     build_type_string="NIGHTLY"
562 elif test "$build_type" = "snapshot"; then
563     build_type_string="SNAPSHOT"
564 elif test "$build_type" = "milestone"; then
565     build_type_string="MILESTONE"
566 elif test "$build_type" = "release"; then
567     build_type_string="RELEASE"
568 else
569     build_type_string="PERSONAL"
570     build_type="personal"
573 aros_config_cflags="$aros_config_cflags -DAROS_BUILD_TYPE=AROS_BUILD_TYPE_$build_type_string"
575 AC_MSG_RESULT($build_type)
577 #-----------------------------------------------------------------------------
578 all_debug_types="messages stack modules mungwall symbols"
580 AC_MSG_CHECKING([which debug types to enable])
581 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)]),
582  debug="$enableval",debug="")
584 if test "$debug" = "" -o "$debug" = "no"; then
585     debug="none"
586 elif test "$debug" = "yes"; then
587     debug="all"
590 if test "$debug" = "all" ; then
591     debug="messages stack modules symbols"
592     for d in $all_debug_types; do
593         export aros_${d}_debug="1"
594     done
595 else
596     for d in $all_debug_types; do
597         export aros_${d}_debug="0"
598     done
601 if test "$debug" != "none"; then
602     debug=`echo $debug | sed s/,/\ /g`
603     for d in $debug; do
604         found="0"
605         for d2 in $all_debug_types; do
606             if test "$d2" = "$d"; then
607                 found="1"
608                 break
609             fi
610         done
611         if test "$found" = "0"; then
612             AC_MSG_ERROR([unrecognized debug type "$d". Available types are: all none $all_debug_types])
613         fi
614         export aros_${d}_debug="1"
615     done
616     aros_debug="yes"
618 AC_MSG_RESULT($debug)
620 if test "$aros_messages_debug" = "1"; then
621     aros_messages_debug="-DADEBUG=1 -DMDEBUG=1"
622 else
623     aros_messages_debug=""
625 if test "$aros_symbols_debug" = "1"; then
626     aros_symbols_debug="-g"
627 else
628     aros_symbols_debug=""
631 # These are the flags to pass when compiling debugged programs
632 aros_debug_cflags="$aros_symbols_debug $aros_messages_debug"
633 aros_debug_aflags=""
634 aros_debug_ldflags="$aros_symbols_debug"
636 aros_crosstools="no"
638 #-----------------------------------------------------------------------------
639 #   Checking if we should build crosstools..
640 AC_MSG_CHECKING([whether to build crosstools])
641 AC_ARG_ENABLE(crosstools,AC_HELP_STRING([--enable-crosstools],[Build cross-compiler toolchains if necessary (default=no).]),crosstools="$enableval",crosstools="no")
642 if test "$crosstools" != "" -a "$crosstools" != "no"; then
643     AC_MSG_RESULT(yes)
644         aros_crosstools="yes"
645 else
646     AC_MSG_RESULT(no)
649 #-----------------------------------------------------------------------------
650 #   Checking for distcc and ccache.
652 #   Always apply the transforms in this particular order. Basically you should
653 #   always run 'ccache distcc compiler' in that order for the best performance.
655 AC_MSG_CHECKING([whether to enable distcc])
656 AC_ARG_ENABLE(distcc,AC_HELP_STRING([--enable-distcc],[Use distcc as a front end to the compiler (default=no).]),distcc="$enableval",distcc="no")
657 if test "$distcc" != "" -a "$distcc" != "no"; then
658     # AC_CHECK_PROG will print out the result in this case
659     AC_PATH_PROG(DISTCC,[distcc],distcc,)
660 else
661     AC_MSG_RESULT(no)
664 AC_MSG_CHECKING([whether to enable ccache])
665 AC_ARG_ENABLE(ccache,AC_HELP_STRING([--enable-ccache],[Use ccache as a front end to the compiler (default=no).]),ccache="$enableval",ccache="no")
666 if test "$ccache" != "" -a "$ccache" != "no"; then
667     # AC_CHECK_PROG will print out the result in this case
668     AC_CHECK_PROG(CCACHE,[ccache],ccache,)
669 else
670     AC_MSG_RESULT(no)
673 #-----------------------------------------------------------------------------
674 AC_MSG_CHECKING([what specific gcc version to use])
675 AC_ARG_WITH(gcc-version,AC_HELP_STRING([--with-gcc-version=VERSION],[Use gcc-VERSION for building AROS]),target_tool_version="$withval",target_tool_version="default")
676 AC_MSG_RESULT($target_tool_version)
678 #-----------------------------------------------------------------------------
679 AC_MSG_CHECKING([what optimization flags to use])
680 AC_ARG_WITH(optimization,AC_HELP_STRING([--with-optimization=FLAGS],[Use optimization flags FLAGS (default=-O2).]),optimization="$withval",optimization="unknown")
681 if test "$optimization" = "unknown"; then
682     dnl default is -O2 for normal builds, -O0 for debug builds
683     if test "$debug" != "none"; then
684         optimization="-O0"
685     else
686         optimization="-O2"
687     fi
689 aros_config_cflags="$aros_config_cflags $optimization"
690 AC_MSG_RESULT($optimization)
692 #-----------------------------------------------------------------------------
693 AC_MSG_CHECKING([what paranoia flags to use])
694 AC_ARG_WITH(paranoia,AC_HELP_STRING([--with-paranoia=FLAGS],[CC flags to enable paranoia]),[paranoia_flags="$withval"],[paranoia_flags="default"])
695 if test "$paranoia_flags" = "default"; then
696         paranoia_flags=""
697 else if test "$paranoia_flags" = "yes"; then
698         paranoia_flags="-Wall -Werror"
699 fi fi
700 AC_MSG_RESULT($paranoia_flags)
701 aros_paranoia_cflags="$paranoia_flags"
703 #-----------------------------------------------------------------------------
704 AC_MSG_CHECKING([what target variant to enable])
705 AC_ARG_ENABLE(target_variant,AC_HELP_STRING([--enable-target-variant=NAME],[Enable a specific target variant(default=none)]),target_variant=$enableval,target_variant="")
706 if test "$target_variant" = ""; then
707     aros_target_variant=""
708     aros_target_suffix=""
709     enableval="none"
710 else
711     aros_target_variant="$target_variant"
712     aros_target_suffix="-$target_variant"
714 AC_MSG_RESULT($enableval)
716 target_bootloader="none"
718 #-----------------------------------------------------------------------------
719 case "$aros_target_variant" in
720 ios)
721     AC_MSG_CHECKING([XCode path])
722     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")
723     AC_MSG_RESULT($aros_xcode_path)
725     AC_MSG_CHECKING([for minimum supported iOS version])
726     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")
727     AC_MSG_RESULT($aros_ios_version)
729     AC_MSG_CHECKING([what iOS SDK version to use])
730     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")
731     AC_MSG_RESULT($aros_ios_sdk)
733     ;;
735 "android")
736     AC_MSG_CHECKING([Android SDK path])
737     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)
738     AC_MSG_RESULT($aros_android_sdk)
740     AC_MSG_CHECKING([Android NDK path])
741     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="")
742     AC_MSG_RESULT($aros_android_ndk)
744     AC_MSG_CHECKING([what Android version to use])
745     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")
746     AC_MSG_RESULT($aros_android_version)
748     export PATH="$aros_android_sdk/tools:$PATH"
749     AC_PATH_PROG(android_tool, $android_tool)
750     AROS_REQUIRED(android,$android_tool)
752     dnl MSYS bash can't run .bat files directly, then need to be started via cmd.exe
753     if test $host_os = "mingw32"; then
754         android_tool="cmd //c $android_tool"
755     fi
757     ;;
758 esac
760 #-----------------------------------------------------------------------------
761 # This is the target configuration switch.
762 case "$target_os" in
763     linux*)
764         aros_target_arch="linux"
765         aros_target_family="unix"
766         case "$target_cpu" in
767             *m68k*)
768                 aros_target_cpu="m68k"
769                 aros_object_format="m68kelf"
770                 aros_flavour="emulcompat"
771                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D__mc68000 -D__linux__"
772                 aros_shared_ldflags="-Wl,-T,\$(TOP)/config/linux/m68k/script.so"
773                 aros_kernel_ldflags="-Wl,-rpath,./lib,-T,\$(TOP)/config/linux/m68k/script.normal"
774                 gcc_target_cpu="mc68000"
775                 ;;
776             *i?86*)
777                 aros_target_cpu="i386"
778                 aros_object_format="elf_i386"
779                 aros_flavour="emulation"
780                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__linux__"
781                 aros_config_cflags="$aros_config_cflags -m32 -march=i486"
782                 aros_kernel_cflags="$aros_kernel_cflags -m32 -march=i486"
783                 aros_config_aflags="$aros_config_aflags -m32 -march=i486"
784                 aros_config_ldflags="-m32 -march=i486"
785                 aros_kernel_ldflags="-melf_i386"
786                 aros_default_wbdepth=8
787                 gcc_target_cpu="i386"
788                 pci_hidd_target="hidd-pci-linux"
789                 ;;
790             *x86_64*)
791                 aros_target_cpu="x86_64"
792                 aros_object_format="elf_x86_64"
793                 aros_flavour="emulation"
794                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64 -D__linux__"
795                 aros_config_cflags="$aros_config_cflags -mno-red-zone -fno-omit-frame-pointer"
796                 aros_default_wbdepth=8
797                 gcc_target_cpu="x86_64"
798                 pci_hidd_target="hidd-pci-linux"
799                 ;;
800             *powerpc*)
801                 aros_target_cpu="ppc"
802                 aros_object_format="elf32ppc"
803                 aros_flavour="emulation"
804                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc -D__linux__"
805                 aros_default_wbdepth=8
806                 gcc_target_cpu="ppc"
807                 ;;
808 # TODO
809 # Same as powerpc, but I need this for the nightly build to work again.
810 # Actually, the nightly should be made working with powerpc target.
811 # That just was too much work for the moment, another week or two.
812             *ppc*)
813                 aros_target_cpu="ppc"
814                 aros_object_format="elf32ppc"
815                 aros_flavour="emulation"
816                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc -D__linux__"
817                 aros_default_wbdepth=8
818                 gcc_target_cpu="ppc"
819                 ;;
820             *arm*)
821                 aros_target_cpu="arm"
822                 aros_object_format="armelf_linux_eabi"
823                 aros_flavour="emulation"
824                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm -D__linux__"
825                 gcc_target_cpu="arm"
826                 aros_config_cflags="$aros_config_cflags -marm -march=armv6 -mfpu=vfp -mfloat-abi=softfp -fno-asynchronous-unwind-tables -fno-exceptions -fno-strict-aliasing"
827                 aros_config_aflags="$aros_config_aflags -marm -march=armv6 -mfpu=vfp -mfloat-abi=softfp -fno-asynchronous-unwind-tables -fno-exceptions -fno-strict-aliasing"
828                 aros_arch_libs="-laeabi"
829                 ;;
830             *)
831                 AC_MSG_ERROR("Unknown CPU for Linux -- $target_cpu")
832                 ;;
833         esac
834         case "$aros_target_variant" in
835             android)
836                 case "$aros_android_version" in
837                 2.2)
838                     aros_android_level=android-8
839                     ;;
840                 *)
841                     aros_android_level=android-9
842                     ;;
843                 esac
844                 aros_default_wbwidth=320
845                 aros_default_wbheight=480
846                 dnl Android gcc and AROS gcc use different enums size, so we use AROS gcc
847                 aros_target_cc="arm-aros-gcc"
848                 aros_target_cxx="arm-aros-g++"
849                 aros_target_ld="arm-aros-ld"
850                 aros_target_as="arm-aros-as"
851                 aros_target_ar="arm-aros-ar"
852                 aros_target_ranlib="arm-aros-ranlib"
853                 aros_target_nm="arm-aros-nm"
854                 aros_target_strip="arm-aros-strip"
855                 aros_target_objcopy="arm-aros-objcopy"
856                 aros_target_objdump="arm-aros-objdump"
857                 if test "$aros_android_ndk" = ""; then
858                     aros_kernel_cflags="-mandroid"
859                     aros_kernel_ldflags="-mandroid"
860                     CFLAGS="-mandroid"
861                 else
862                     export PATH="$aros_android_ndk/toolchains/arm-linux-androideabi-$target_tool_version/prebuilt/$android_build_os/bin:$PATH"
863                     aros_android_ndk="$aros_android_ndk/platforms/$aros_android_level/arch-arm"
864                     aros_kernel_cflags="--sysroot $aros_android_ndk -mandroid"
865                     aros_kernel_ldflags="--sysroot $aros_android_ndk -mandroid"
866                     CFLAGS="$CFLAGS --sysroot $aros_android_ndk -mandroid"
867                     aros_kernel_includes="-isystem $aros_android_ndk/usr/include"
868                 fi
869                 need_x11=no
870                 target_tool_prefix="arm-linux-androideabi-"
871             ;;
872         esac
873     ;;
875     pc)
876         aros_target_arch="pc"
877         aros_shared_default="no"
878         target_bootloader="grub2"
879         case "$target_cpu" in
880             *i?86*)
881                 aros_target_cpu="i386"
883                 dnl If somebody hasn't already set the target object
884                 dnl format, then use this value. Mostly to support
885                 dnl FreeBSD cross-compilation.
886                 dnl TODO: Remove when we always use our compiler.
888                 if test "$aros_object_format" = "" ; then
889                     aros_object_format="elf_i386"
890                 fi
891                 aros_flavour="standalone"
892                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
893                 aros_config_cflags="$aros_config_cflags -m32 -march=i486"
894                 aros_kernel_cflags="$aros_kernel_cflags -m32 -march=i486"
895                 aros_config_aflags="$aros_config_aflags -m32 -march=i486"
896                 aros_config_ldflags="-m32 -march=i486"
897                 aros_kernel_ldflags="-melf_i386"
898                 aros_default_wbwidth=640
899                 aros_default_wbheight=480
900                 gcc_target_cpu="i386"
901                 ;;
902             *x86_64*)
903                 aros_target_cpu="x86_64"
904                 aros_serial_debug=1
905                 if test "$aros_object_format" = "" ; then
906                     aros_object_format="elf_x86_64"
907                 fi
908                 aros_flavour="standalone"
909                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
910                 aros_config_cflags="$aros_config_cflags -fno-asynchronous-unwind-tables -mno-red-zone -fno-omit-frame-pointer"
911                 aros_kernel_ldflags=""
912                 aros_default_wbwidth=640
913                 aros_default_wbheight=480
914                 gcc_target_cpu="x86_64"
915                 ;;
916             *)
917                 AC_MSG_ERROR("Unknown native CPU -- $target_cpu")
918                 ;;
919         esac
920         ;;
922     prep)
923         aros_target_arch="prep"
924         aros_shared_default="no"
925         aros_target_cpu="ppc"
926         aros_object_format="elf32ppc"
927         aros_flavour="ppcnative"
928         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
929         aros_kernel_ldflags=""
930         aros_default_wbwidth=640
931         aros_default_wbheight=480
932         gcc_target_cpu="ppc"
933         ;;
935     freebsd*)
936         aros_target_arch="freebsd"
937         aros_target_family="unix"
938         aros_target_cpu="i386"
939         aros_flavour="emulation"
940         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
941         gcc_target_cpu="i386"
943         aros_target_strip_flags="-x"
944         ;;
946     darwin*)
947         aros_target_arch="darwin"
948         aros_target_family="unix"
949         aros_flavour="emulation"
950         case "$target_cpu" in
951             *i?86*)
952                 aros_ios_platform="iPhoneSimulator"
953                 aros_target_cpu="i386"
954                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
955                 aros_kernel_ldflags=""
956                 aros_macosx_version="10.4"
957                 aros_default_wbdepth=8
958                 gcc_target_cpu="i386"
959                 aros_object_format="elf_i386"
960                 aros_target_strip_flags="-x"
961                 aros_target_cc="i386-aros-gcc"
962                 aros_target_cxx="i386-aros-g++"
963                 aros_target_ld="i386-aros-ld"
964                 aros_target_as="i386-aros-as"
965                 aros_target_ar="i386-aros-ar"
966                 aros_target_ranlib="i386-aros-ranlib"
967                 aros_target_nm="i386-aros-nm"
968                 aros_target_strip="i386-aros-strip"
969                 aros_target_objcopy="i386-aros-objcopy"
970                 aros_target_objdump="i386-aros-objdump"
971                 target_tool_prefix="i686-apple-darwin10-"
972                 target_tool_flags="-m32"
973                 ;;
974             *x86_64*)
975                 aros_target_cpu="x86_64"
976                 aros_object_format="elf_x86_64"
977                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
978                 aros_macosx_version="10.6"
979                 aros_config_cflags="$aros_config_cflags -fno-omit-frame-pointer"
980                 aros_kernel_cflags="-m64"
981                 aros_kernel_ldflags="-m64"
982                 aros_target_cflags="-mcmodel=large"
983                 aros_default_wbdepth=8
984                 gcc_target_cpu="x86_64"
985                 aros_kernel_ld="ld"
986                 aros_target_cc="x86_64-aros-gcc"
987                 aros_target_cxx="x86_64-aros-g++"
988                 aros_target_ld="x86_64-aros-ld"
989                 aros_target_as="x86_64-aros-as"
990                 aros_target_ar="x86_64-aros-ar"
991                 aros_target_ranlib="x86_64-aros-ranlib"
992                 aros_target_nm="x86_64-aros-nm"
993                 aros_target_strip="x86_64-aros-strip"
994                 aros_target_objcopy="x86_64-aros-objcopy"
995                 aros_target_objdump="x86_64-aros-objdump"
996                 target_tool_prefix="i686-apple-darwin10-"
997                 ;;
998             *ppc*)
999                 aros_target_cpu="ppc"
1000                 aros_object_format="elf32ppc"
1001                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1002                 aros_kernel_ldflags=""
1003                 aros_macosx_version="10.0"
1004                 aros_default_wbdepth=8
1005                 gcc_target_cpu="ppc"
1006                 aros_kernel_ld="ld -arch ppc"
1007                 aros_target_cc="ppc-aros-gcc"
1008                 aros_target_cxx="ppc-aros-g++"
1009                 aros_target_ld="ppc-aros-ld"
1010                 aros_target_as="ppc-aros-as"
1011                 aros_target_ar="ppc-aros-ar"
1012                 aros_target_ranlib="ppc-aros-ranlib"
1013                 aros_target_nm="ppc-aros-nm"
1014                 aros_target_strip="ppc-aros-strip"
1015                 aros_target_objcopy="ppc-aros-objcopy"
1016                 aros_target_objdump="ppc-aros-objdump"
1017                 target_tool_prefix="powerpc-apple-darwin10-"
1018                 ;;
1019             *arm*)
1020                 aros_ios_platform="iPhoneOS"
1021                 aros_target_cpu="arm"
1022                 aros_object_format="armelf_linux_eabi"
1023                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
1024                 aros_config_cflags="$aros_config_cflags -marm -march=armv6 -mfpu=vfp -mfloat-abi=softfp -fno-asynchronous-unwind-tables -fno-exceptions"
1025                 aros_config_aflags="$aros_config_aflags -marm -march=armv6 -mfpu=vfp -mfloat-abi=softfp -fno-asynchronous-unwind-tables -fno-exceptions"
1026                 aros_arch_libs="-laeabi"
1027                 aros_default_wbdepth=8
1028                 gcc_target_cpu="arm"
1029                 aros_kernel_ld="ld -arch armv6"
1030                 aros_target_cc="arm-aros-gcc"
1031                 aros_target_cxx="arm-aros-g++"
1032                 aros_target_ld="arm-aros-ld"
1033                 aros_target_as="arm-aros-as"
1034                 aros_target_ar="arm-aros-ar"
1035                 aros_target_ranlib="arm-aros-ranlib"
1036                 aros_target_nm="arm-aros-nm"
1037                 aros_target_strip="arm-aros-strip"
1038                 aros_target_objcopy="arm-aros-objcopy"
1039                 aros_target_objdump="arm-aros-objdump"
1040                 target_tool_prefix="arm-apple-darwin10-" 
1041                 export PATH="$aros_xcode_path/Platforms/$aros_ios_platform.platform/Developer/usr/bin:$PATH"
1042                 ;;
1043             *)
1044                 AC_MSG_ERROR("Unsupported target CPU for darwin hosted flavour -- $target_cpu")
1045                 ;;
1046         esac
1047         case "$aros_target_variant" in
1048             ios)
1049                 aros_default_wbwidth=320
1050                 aros_default_wbheight=480
1051                 aros_ios_sdk="$aros_xcode_path/Platforms/$aros_ios_platform.platform/Developer/SDKs/$aros_ios_platform$aros_ios_sdk.sdk"
1052                 target_tool_flags="$target_tool_flags --sysroot $aros_ios_sdk"
1053                 aros_kernel_includes="-isystem $aros_ios_sdk/usr/include"
1054                 need_x11=no
1055                 # This is here because it may depend on iOS or SDK version
1056                 aros_kernel_cflags="$aros_kernel_cflags -miphoneos-version-min=$aros_ios_version"
1057                 aros_kernel_ldflags="$aros_kernel_ldflags -miphoneos-version-min=$aros_ios_version"
1058                 aros_kernel_objcflags="-fobjc-abi-version=2 -fobjc-legacy-dispatch"
1059             ;;
1060             *)
1061                 aros_kernel_cflags="$aros_kernel_cflags -mmacosx-version-min=$aros_macosx_version"
1062                 aros_kernel_ldflags="$aros_kernel_ldflags -mmacosx-version-min=$aros_macosx_version"
1063             ;;
1064         esac
1065         ;;
1067     dragonfly*)
1068         aros_target_arch="dragonfly"
1069         aros_target_family="unix"
1070         aros_flavour="emulation"
1071         case "$target_cpu" in
1072             *i?86*)
1073                 aros_target_cpu="i386"
1074                 aros_object_format="elf_i386"
1075                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__DragonFly__"
1076                 ;;
1077             *x86_64*)
1078                 aros_config_cflags="$aros_config_cflags -fno-omit-frame-pointer"
1079                 aros_target_cpu="x86_64"
1080                 aros_object_format="elf_x86_64"
1081                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64 -D__DragonFly__"
1082                 ;;
1083             *)
1084                 AC_MSG_ERROR("Unknown CPU for DragonFly -- $target_cpu")
1085                 ;;
1086         esac
1087         ;;
1089     netbsd*)
1090         aros_target_arch="netbsd"
1091         aros_target_family="unix"
1092         case "$target_cpu" in
1093             *m68k*)
1094                 aros_target_cpu="m68k"
1095                 aros_object_format="m68kelf"
1096                 aros_flavour="emulcompat"
1097                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D__mc68000 -D__NetBSD__"
1098                 gcc_target_cpu="mc68000"
1099                 ;;
1100             *i?86*)
1101                 aros_target_cpu="i386"
1102                 aros_object_format="elf_i386"
1103                 aros_flavour="emulation"
1104                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__NetBSD__"
1105                 aros_default_wbdepth=8
1106                 gcc_target_cpu="i386"
1107                 ;;
1108             *)
1109                 AC_MSG_ERROR("Unknown CPU for NetBSD -- $target_cpu")
1110                 ;;
1111         esac
1112         aros_target_genmap="-Wl,-M -Xlinker >"
1113         aros_flavour="emulation"
1114         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1115         ;;   
1117     openbsd*)
1118         aros_target_arch="openbsd"
1119         aros_target_family="unix"
1120         case "$target_cpu" in
1121             *i?86*)
1122                 aros_target_cpu="i386"
1123                 aros_object_format="elf_i386"
1124                 aros_flavour="emulation"
1125                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__OpenBSD__"
1126                 gcc_target_cpu="i386"
1127                 ;;
1128             *)
1129                 AC_MSG_ERROR("Unknown CPU for OpenBSD -- $target_cpu")
1130                 ;;
1131         esac
1132         aros_target_genmap="-Wl,-M -Xlinker >"
1133         aros_target_nm_flags="-u"
1134         aros_flavour="emulation"
1135         ;;
1137     solaris*)
1138         aros_target_arch="solaris"
1139         aros_target_family="unix"
1140         case "$target_cpu" in
1141            *i?86*)
1142                aros_target_cpu="i386"
1143                aros_object_format="elf_i386"
1144                aros_flavour="emulation"
1145                aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__Solaris__"
1146                aros_default_wbdepth=8
1147                gcc_target_cpu="i386"
1148                ;;
1149             *sparc*)
1150                 aros_target_cpu="sparc"
1151                 aros_object_format="elf_sparc"
1152                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dsparc -D__Solaris__"
1153                 gcc_target_cpu="sparc"
1154                 ;;
1155             *)
1156                 AC_MSG_ERROR("Unknown CPU for Solaris -- $target_cpu")
1157                 ;;
1158         esac
1159         aros_config_cflags="$aros_config_cflags -D$aros_target_cpu"
1160         aros_flavour="emulation"
1161         ;;
1163     morphos*)
1164         aros_target_arch="morphos"
1165         aros_shared_default="no"
1166         aros_target_cpu="ppc"
1167         aros_object_format="elf_ppc"
1168         aros_flavour="nativecompat"
1169         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1170         gcc_target_cpu="ppc"
1171         ;;
1173     sam440)
1174         aros_target_arch="sam440"
1175         aros_shared_default="no"
1176         aros_target_cpu="ppc"
1177         aros_object_format="elf32ppc"
1178         aros_flavour="ppcnative"
1179         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1180         aros_kernel_ldflags=""
1181         aros_default_wbwidth=1024
1182         aros_default_wbheight=768
1183         aros_default_wbdepth=24
1184         aros_config_cflags="$aros_config_cflags -mcpu=440fp -mno-toc -fno-asynchronous-unwind-tables"
1185         gcc_target_cpu="powerpc"
1186         ;;
1188     efika)
1189         aros_target_arch="efika"
1190         aros_shared_default="no"
1191         aros_target_cpu="arm"
1192         aros_object_format="armelf_linux_eabi"
1193         aros_flavour="standalone"
1194         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
1195         aros_kernel_ldflags=""
1196         aros_default_wbwidth=1024
1197         aros_default_wbheight=600
1198         aros_arch_libs="-laeabi"
1199         aros_config_cflags="$aros_config_cflags -marm -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -fno-asynchronous-unwind-tables -fno-exceptions -fno-strict-aliasing"
1200         aros_config_aflags="$aros_config_aflags -marm -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -fno-asynchronous-unwind-tables -fno-exceptions -fno-strict-aliasing"
1201         ;;
1202         
1203     chrp)
1204     aros_target_arch="chrp"
1205     aros_shared_default="no"
1206     aros_target_cpu="ppc"
1207     aros_object_format="elf32ppc"
1208     aros_flavour="ppcnative"
1209     aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1210     aros_kernel_ldflags=""
1211     aros_default_wbwidth=640
1212     aros_default_wbheight=480
1213     aros_config_cflags="$aros_config_cflags -mno-toc -fno-asynchronous-unwind-tables"    
1214     gcc_target_cpu="powerpc"
1215         case "$aros_target_variant" in
1216             efika)
1217             aros_config_cflags="$aros_config_cflags -DBIG_ENDIAN_OHCI=1 -mcpu=603e"
1218             ;;
1219         esac
1220     ;;
1222     amiga*)
1223         aros_target_arch="amiga"
1224         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D_AMIGA -DAMIGA"
1225         aros_shared_default="no"
1227         case "$target_cpu" in
1228             *m68k*)
1229                 aros_enable_mmu=no
1230                 aros_target_cpu="m68k"
1231                 aros_object_format="m68kelf"
1232                 aros_flavour="standcompat"
1233                 gcc_target_cpu="m68000"
1234                 aros_config_cflags="$aros_config_cflags -g3 -fno-strict-aliasing -ffreestanding -fomit-frame-pointer -${gcc_target_cpu} -fbuiltin -Wno-volatile-register-var -DAROS_DOS_PACKETS"
1235                 aros_config_aflags="$aros_config_aflags -g3 -${gcc_target_cpu}"
1236                 aros_paranoia_cflags="$aros_paranoia_cflags -Wno-volatile-register-var"
1237                 aros_debug_cflags="-Wall -Werror-implicit-function-declaration $aros_symbols_debug  $aros_messages_debug -${gcc_target_cpu}"
1238                 target_tool_prefix="m68k-elf-"
1239                 # Needed to get the correct multilib
1240                 aros_config_ldflags="-${gcc_target_cpu}"
1241                 aros_debug_ldflags="-${gcc_target_cpu}"
1242                 aros_shared_ldflags="-${gcc_target_cpu}"
1243                 aros_kernel_ldflags="-${gcc_target_cpu}"
1244                 aros_target_nostdlib_ldflags="-${gcc_target_cpu}"
1245                 aros_target_strip_flags="-R.comment --strip-debug"
1246                 aros_default_wbwidth=640
1247                 aros_default_wbheight=256
1248                 ;;
1249             *ppc*)
1250                 aros_cpu="ppc"
1251                 aros_flavour="native"
1252                 gcc_target_cpu="ppc"
1253                 ;;
1254             *)
1255                 AC_MSG_ERROR("Unknown CPU for Amiga $target_cpu")
1256                 ;;
1257         esac
1258         ;;
1260     mingw*)
1261         aros_target_arch="mingw32"
1262         aros_shared_default="no"
1263         aros_flavour="emulation"
1264         aros_shared_cflags=""
1265         need_dlopen="no"
1266         rescomp="windres"
1267         case "$target_cpu" in
1268             *i?86*)
1269                 aros_target_cpu="i386"
1270                 aros_object_format="elf_i386"
1271                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1272                 aros_default_wbdepth=8
1273                 gcc_target_cpu="i386"
1274                 aros_target_cc="i386-aros-gcc"
1275                 aros_target_cxx="i386-aros-g++"
1276                 aros_target_ld="i386-aros-ld"
1277                 aros_target_as="i386-aros-as"
1278                 aros_target_ar="i386-aros-ar"
1279                 aros_target_ranlib="i386-aros-ranlib"
1280                 aros_target_nm="i386-aros-nm"
1281                 aros_target_strip="i386-aros-strip"
1282                 aros_target_objcopy="i386-aros-objcopy"
1283                 aros_target_objdump="i386-aros-objdump"
1284                 target_tool_prefix="i386-mingw32-"
1285                 ;;
1286             *x86_64*)
1287                 aros_target_cpu="x86_64"
1288                 aros_object_format="elf_x86_64"
1289                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
1290                 aros_config_cflags="$aros_config_cflags -fno-omit-frame-pointer"
1291                 aros_default_wbdepth=8
1292                 gcc_target_cpu="x86_64"
1293                 aros_target_cc="x86_64-aros-gcc"
1294                 aros_target_cxx="x86_64-aros-g++"
1295                 aros_target_ld="x86_64-aros-ld"
1296                 aros_target_as="x86_64-aros-as"
1297                 aros_target_ar="x86_64-aros-ar"
1298                 aros_target_ranlib="x86_64-aros-ranlib"
1299                 aros_target_nm="x86_64-aros-nm"
1300                 aros_target_strip="x86_64-aros-strip"
1301                 aros_target_objcopy="x86_64-aros-objcopy"
1302                 aros_target_objdump="x86_64-aros-objdump"
1303                 target_tool_prefix="x86_64-w64-mingw32-"
1304                 ;;
1305             *arm*)
1306                 aros_target_cpu="arm"
1307                 aros_object_format="armelf_linux_eabi"
1308                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
1309                 aros_arch_libs="-laeabi"
1310                 aros_default_wbdepth=8
1311                 gcc_target_cpu="arm"
1312                 aros_target_cc="arm-aros-gcc"
1313                 aros_target_cxx="arm-aros-g++"
1314                 aros_target_ld="arm-aros-ld"
1315                 aros_target_as="arm-aros-as"
1316                 aros_target_ar="arm-aros-ar"
1317                 aros_target_ranlib="arm-aros-ranlib"
1318                 aros_target_nm="arm-aros-nm"
1319                 aros_target_strip="arm-aros-strip"
1320                 aros_target_objcopy="arm-aros-objcopy"
1321                 aros_target_objdump="arm-aros-objdump"
1322                 target_tool_prefix="arm-mingw32ce-"
1323                 aros_default_wbwidth=160
1324                 aros_default_wbheight=160
1325                 ;;
1326             *)
1327                 AC_MSG_ERROR("Unknown CPU for Mingw32 -- $target_cpu")
1328                 ;;
1329         esac
1330         if test $host_os = "cygwin"; then
1331                 aros_kernel_cflags="-mno-cygwin"
1332         fi
1333     ;;
1334     pp*)
1335         aros_target_arch="pp"
1336         aros_shared_default="no"
1337         case "$target_cpu" in
1338             *m68k*)
1339                 aros_target_cpu="m68k"
1340                 aros_object_format="m68kelf"
1341                 aros_flavour="palmnative"
1342                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
1343                 aros_default_wbwidth=160
1344                 aros_default_wbheight=160
1345                 aros_default_wbdepth=1
1346                 aros_target_ar_flags="cru"
1347                 aros_compiler_libs="-lgcc1"
1348                 aros_shared_default=no
1349                 aros_shared_cflags="-fpic"
1350                 aros_shared_aflags=""
1351                 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
1352                 aros_kernel_ldflags="-Wl,-rpath,./lib"
1353                 aros_debug_cflags="-Wall -Werror-implicit-function-declaration $aros_symbols_debug  $aros_messages_debug -mc68000 -Wa,-mc68000"
1354                 aros_debug_aflags=""
1355                 aros_debug_ldflags="$aros_symbols_debug"
1356                 aros_mungwall_debug="0"
1357                 aros_modules_debug="0"
1358                 gcc_target_cpu="mc68000"
1359                 ignore_undefined_symbols="-ius"
1360                 ;;
1361            *)
1362                 AC_MSG_ERROR("Unknown CPU for PalmPilot -- $target_cpu")
1363                 ;;
1364         esac
1365         ;;
1367     mac*)
1368         aros_target_arch="mac"
1369         aros_shared_default="no"
1370         case "$target_cpu" in
1371             *m68k*)
1372                 aros_target_cpu="m68k"
1373                 aros_object_format="m68kelf"
1374                 aros_flavour="mac68knative"
1375                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
1376                 aros_default_wbwidth=512
1377                 aros_default_wbheight=384
1378                 aros_default_wbdepth=8
1379                 aros_target_ar_flags="cru"
1380                 aros_compiler_libs="-lgcc1"
1381                 aros_shared_default=no
1382                 aros_shared_cflags="-fpic"
1383                 aros_shared_aflags=""
1384                 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
1385                 aros_kernel_ldflags="-Wl,-rpath,./lib"
1386                 aros_debug_cflags="-Wall -Werror-implicit-function-declaration $aros_symbols_debug  $aros_messages_debug -mc68000"
1387                 aros_debug_aflags=""
1388                 aros_debug_ldflags="$aros_symbols_debug"
1389                 aros_mungwall_debug="0"
1390                 aros_modules_debug="0"
1391                 gcc_target_cpu="mc68000"
1392                 ignore_undefined_symbols="-ius"
1393                 ;;
1394            *)
1395                 AC_MSG_ERROR("Unknown CPU for Mac68k -- $target_cpu")
1396                 ;;
1397         esac
1398         ;;
1400     *)
1401         AC_MSG_ERROR([Unsupported target architecture $target])
1402         ;;
1403 esac
1405 AC_MSG_CHECKING([Where to download sourcecode for external ports])
1406 AC_ARG_WITH(portssources,AC_HELP_STRING([--with-portssources=DIR],[Where to download sourcecode for external ports]),with_portssrcdir=$withval,with_portssrcdir="default")
1407 if test "$with_portssrcdir" = "default"; then
1408     AROS_PORTSSRCDIR="$AROS_BUILDDIR_UNIX/bin/Sources"
1409 else
1410     AROS_PORTSSRCDIR="$with_portssrcdir"
1412 AC_MSG_RESULT($AROS_PORTSSRCDIR)
1414 AC_MSG_CHECKING([which bootloader to use])
1415 AC_ARG_WITH(bootloader,AC_HELP_STRING([--with-bootloader=NAME],[Use a specific bootloader]),target_bootloader=$withval,target_bootloader=$target_bootloader)
1416 if test "$target_bootloader" = "none"; then
1417     aros_target_bootloader=""
1418 else
1419     aros_target_bootloader="$target_bootloader"
1421 AC_MSG_RESULT($target_bootloader)
1423 AC_MSG_CHECKING([which icon-set to use])
1424 AC_ARG_WITH(iconset,AC_HELP_STRING([--with-iconset=NAME],[Use a specific Icon-set (default=Gorilla).]),target_iconset=$withval,target_iconset="default")
1425 if test "$target_iconset" = "default"; then
1426     aros_target_iconset="Gorilla"
1427     target_iconset="default (Gorilla)"
1428 else
1429     aros_target_iconset="$target_iconset"
1431 AC_MSG_RESULT($target_iconset)
1433 AC_MSG_CHECKING([which GUI Theme to use])
1434 AC_ARG_WITH(theme,AC_HELP_STRING([--with-theme=NAME],[Use a specific GUI Theme]),target_guitheme=$withval,target_guitheme="default")
1435 if test "$target_guitheme" = "default"; then
1436     aros_target_guitheme="Ice"
1437 else
1438     aros_target_guitheme="$target_guitheme"
1440 AC_MSG_RESULT($aros_target_guitheme)
1442 # Find out if we are cross-compiling (i.e. if we can't use the host compiler
1443 # for target code)
1444 cross_compiling=no
1445 if test "$aros_host_cpu" != "$aros_target_cpu" ; then
1446     cross_compiling=yes
1448 if test "$aros_host_cpu" == "x86_64" ; then
1449     if test "$aros_target_cpu" == "i386" ; then
1450         if test "$aros_target_arch" != "mingw32"; then
1451             cross_compiling=no
1452         fi
1453     fi
1455 if test "$aros_host_arch" == "darwin" ; then
1456     if test "$aros_target_arch" != "darwin" ; then
1457         cross_compiling=yes
1458     fi
1461 # Set prefix for target compiler etc. if we're cross-compiling
1462 # (should possibly be earlier but needs to be after AC_PROG_CC)
1463 if test "$cross_compiling" = "yes" ; then
1464     if test "$target_tool_prefix" = ""; then
1465         target_tool_prefix=${target_cpu}-elf-
1466     fi
1467     CC=${target_tool_prefix}gcc
1468     dnl CPP is needed for AC_CHECK_HEADER to work correctly
1469     CPP=${target_tool_prefix}cpp
1470     if test "$target_tool_version" != "default"; then
1471         CC="$CC-$target_tool_version"
1472         CPP="$CC-$target_tool_version"
1473     fi
1474     AC_PATH_PROG(CC,$CC)
1475     AROS_REQUIRED(gcc,$CC)
1477 CC="$CC $target_tool_flags"
1479 #-----------------------------------------------------------------------------
1481 # Disable pointer-signedness warnings if the compiler recognises the option
1483 AC_MSG_CHECKING([whether ${CC} accepts -Wno-pointer-sign])
1484 save_cflags="$CFLAGS"
1485 CFLAGS="$CFLAGS -Wno-pointer-sign"
1486 AC_TRY_COMPILE(,, use_no_sign_warning="yes", use_no_sign_warning="no")
1487 AC_MSG_RESULT($use_no_sign_warning)
1488 if test "x-$use_no_sign_warning" = "x-yes" ; then
1489     aros_config_cflags="$aros_config_cflags -Wno-pointer-sign"
1491 CFLAGS="$save_cflags"
1493 #-----------------------------------------------------------------------------
1495 # Find all the tools we need to compile. This could be cross-compiling
1496 # though! If that is the case we use the GNU form of the target and
1497 # simply add this to the front of the binary name. This is rather simple,
1498 # but it should work under most circumstances.
1500 # The default tools are to use the same as the host, but only if the
1501 # host and target CPU are the same. With GCC this is normally enough.
1504 aros_cc_pre=""
1505 aros_shared_ld="$aros_host_ld"
1507 aros_target_mkdep="$aros_host_mkdep"
1508 aros_target_incl_def="$aros_host_incl"
1510 aros_kernel_cc="$CC"
1512 # The default tools executables to be linked to.
1513 if test "$aros_target_cc" != ""; then
1514     AC_PATH_PROG(aros_target_cc,$aros_target_cc)
1515     AROS_REQUIRED(gcc,$aros_target_cc)
1517 if test "$aros_target_ld" != ""; then
1518     AC_PATH_PROG(aros_target_ld,$aros_target_ld)
1519     AROS_REQUIRED(ld,$aros_target_ld)
1522 if test "$crosstools" != "yes"; then
1523     AROS_TOOL_TARGET(aros_target_as_ln,as,$aros_target_as)
1524     AROS_REQUIRED(as,$aros_target_as_ln)
1525     AROS_TOOL_TARGET(aros_kernel_ld,ld,$aros_kernel_ld)
1526     AROS_REQUIRED(ld,$aros_kernel_ld)
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 # Temporarily disabled in order to let Mingw32-hosted nightly build to work
1542 #       AROS_REQUIRED(c++,$aros_target_cxx)
1543     fi
1544 else
1545 # Cancel preinstalled C++ compiler because it will be built as part of crosstools
1546     aros_target_cxx=""
1549 # Build crosstools if we have no C++ - temporary thing 
1550 if test "$aros_target_cxx" = ""; then
1551     crosstools_target=tools-crosstools
1554 if test "$rescomp" != ""; then
1555     if test "$cross_compiling" = "yes" ; then
1556         rescomp=${target_tool_prefix}${rescomp}
1557     fi
1558     AC_PATH_PROG(aros_kernel_rescomp,$rescomp)
1559     AROS_REQUIRED($rescomp,$aros_kernel_rescomp)
1562 aros_hostcfg_dir="bin/${aros_host_arch}-${aros_host_cpu}/gen/config"
1563 aros_targetcfg_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/config"
1564 aros_inc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/AROS/Development/include/aros"
1565 aros_gendir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen"
1566 aros_geninc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/include/aros"
1567 aros_tools_dir="bin/${aros_host_arch}-${aros_host_cpu}/tools"
1568 aros_scripts_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/scripts"
1570 # aros_cc_pre is a variable that is added to the front of the compiler name
1571 # in the generated aros-gcc shell script. We need this to enable the cache
1572 # to work across cleaned builds. Also, support DISTCC using the correct
1573 # environment variable.
1576 if test "x${DISTCC}" != "x" ; then
1577     if test "x${CCACHE}" != "x" ; then
1578         aros_cc_pre="env CCACHE_PREFIX=${DISTCC} ${CCACHE} "
1579     else
1580         aros_cc_pre="${DISTCC} "
1581     fi
1582 else
1583     if test "x${CCACHE}" != "x" ; then
1584         aros_cc_pre="${CCACHE} "
1585     fi
1588 prefix="${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros"
1590 AC_SUBST(aros_target_nostdinc_cflags,-nostdinc)
1591 AC_SUBST(aros_target_nostartup_ldflags,-nostartfiles)
1592 AC_SUBST(aros_target_nix_ldflags,-nix)
1593 AC_SUBST(aros_target_detach_ldflags,-detach)
1594 AC_SUBST(aros_target_nostdlib_ldflags,-nostdlib)
1596 # Target tools
1597 if test "$aros_target_cc" = ""; then
1598     orig_target_cc=$aros_kernel_cc
1599 else
1600     orig_target_cc=$aros_target_cc
1602 if test "$aros_target_ld" = ""; then
1603     orig_target_ld=$aros_kernel_ld
1604 else
1605     orig_target_ld=$aros_target_ld
1607 if test "$GCC" = "yes"; then
1608     aros_target_cc_path=`$orig_target_cc -print-search-dirs | grep "programs: =" | cut -c 12-`
1610 aros_target_cc="${prefix}-gcc"
1611 aros_target_as="${prefix}-as"
1612 aros_target_ld="${prefix}-ld"
1613 aros_target_ar="${prefix}-ar $aros_target_ar_flags"
1614 aros_target_objcopy=${prefix}-objcopy
1615 aros_target_objdump=${prefix}-objdump
1616 aros_target_ranlib="${prefix}-ranlib $aros_target_ranlib_flags"
1617 aros_target_nm="${prefix}-nm $aros_target_nm_flags"
1618 aros_kernel_nm="${prefix}-nm"
1619 aros_target_strip=${prefix}-strip
1621 # Find the system include path. We can suggest that an alternative is
1622 # used if we don't get it correct. The default is to use /usr/include.
1623 # Which is set in the aros_target_incl_def variable.
1625 AC_ARG_ENABLE(includes,
1626 AC_HELP_STRING([--enable-includes=dir],[Alternative system include directory]),
1627 [aros_target_incl=$enable_includes], [aros_target_incl=$aros_target_incl_def])
1629 if test "$aros_kernel_includes" = ""; then
1630     if test "x-$aros_flavour" = "x-emulation" -o "x-$aros_flavour" = "x-emulcompat" ; then
1631         # FIXME: for cross-compiling this should point to another location
1632         aros_kernel_includes="-isystem $aros_target_incl"
1633     fi
1636 if test "$aros_kernel_includes" != "" ; then
1637     dnl find out about the kernel cc's include path
1638     AC_MSG_CHECKING([for the kernel compiler's include path])
1639     if test "$aros_kernel_cc_includes" = "" ; then
1640         # Try to guess where the directory is.
1641         aros_kernel_cc_includes=`dirname \`${aros_kernel_cc} ${aros_kernel_cflags} -print-libgcc-file-name\``/include
1642         if test -d $aros_kernel_cc_includes; then
1643             # Check if there is also an include-fixed directory and add it
1644             # to kernel compiler's include path as it may contain some of
1645             # the headers we need.
1646             if test -d "$aros_kernel_cc_includes"-fixed; then
1647                 aros_kernel_cc_includes+=" -isystem $aros_kernel_cc_includes"-fixed
1648             fi
1649         else
1650             # The directory doesn't exist, we need to do some more work.
1651             aros_kernel_cc_includes=${PWD}/${aros_gendir}/cc_include
1653             # These are the headers we're looking for.
1654             headers="limits.h mmintrin.h stdbool.h syslimits.h float.h \
1655                      stddef.h xmmintrin.h iso646.h stdarg.h unwind.h   \
1656                      zutil.h"
1658             dirs=
1659             for h in $headers; do
1660                 # Which other headers are needed by each of the above?
1661                 deps=$(echo "#include <$h>" | \
1662                        $aros_kernel_cc -E -M - 2>/dev/null | \
1663                        sed 's/^.*://; s/\\$/ /g; s/[[ \t]]\+/ /g')
1665                 # Copy all the needed headers to a directory beneath gendir.
1666                 for d in $deps; do
1667                     h=$(basename $d)
1668                     dir=${aros_kernel_cc_includes}$(echo $(dirname $d) | \
1669                                                 sed -n "s,^.*/include\(/.*\),\1,p")
1670                     ! test -d $dir && mkdir -p $dir
1671                     ! test -f $dir/$h && { cp $d $dir; chmod u+w $dir/$h; }
1672                 done
1673             done            
1674         fi
1675     fi
1676     AC_MSG_RESULT($aros_kernel_cc_includes)
1677     # Adding -nostdinc to kernel includes as they are always used together.
1678     aros_kernel_includes="$aros_kernel_includes $aros_target_nostdinc_cflags -isystem $aros_kernel_cc_includes"
1681 dnl find out about the target cc's include path
1682 AC_MSG_CHECKING([for the target compiler's include path])
1683 if test "$aros_target_cc_includes" = "" ; then
1684     #try to guess where the directory is
1685     aros_target_cc_includes=`dirname \`${orig_target_cc} -print-libgcc-file-name\``/include
1686     if ! test -d $aros_target_cc_includes; then
1687         #the directory doesn't exist, we need to do some more work
1688         aros_target_cc_includes=${PWD}/${aros_gendir}/cc_include
1689         
1690         #these are the headers we're looling for
1691         headers="limits.h mmintrin.h stdbool.h syslimits.h float.h \
1692                  stddef.h xmmintrin.h iso646.h stdarg.h unwind.h   \
1693                  zutil.h"
1695         dirs=
1696         for h in $headers; do
1697             #which other headers each of the above headers needs?
1698             deps=$(echo "#include <$h>" | \
1699                    $orig_target_cc -E -M - 2>/dev/null | \
1700                    sed 's/^.*://; s/\\$/ /g; s/[[ \t]]\+/ /g')
1701             
1702             #copy all the needed headers to a directory beneath gendir
1703             for d in $deps; do
1704                 h=$(basename $d)
1705                 dir=${aros_target_cc_includes}$(echo $(dirname $d) | \
1706                                                 sed -n "s,^.*/include\(/.*\),\1,p")
1707                 ! test -d $dir && mkdir -p $dir
1708                 ! test -f $dir/$h && { cp $d $dir; chmod u+w $dir/$h; }
1709             done
1710         done        
1711     fi
1713 AC_MSG_RESULT($aros_target_cc_includes)
1716 # For GCC < 4.0 -I- is used for giving the search path for '#include "..."'
1717 # On GCC >= 4.0 -iquote should be used
1720 save_cc="$CC"
1721 save_cflags="$CFLAGS"
1722 CFLAGS="-iquote."
1723 AC_MSG_CHECKING([whether ${CC} accepts -iquote])
1724 AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
1725 AC_MSG_RESULT($has_iquote)
1726 if test "x-$has_iquote" = "x-yes" ; then
1727     host_cflags_iquote=-iquote
1728     host_cflags_iquote_end=
1729 else
1730     host_cflags_iquote=-I
1731     host_cflags_iquote_end=-I-
1733 kernel_cflags_iquote=$host_cflags_iquote
1734 kernel_cflags_iquote_end=$host_cflags_iquote_end
1735 if test "x-$cross_compiling" = "x-yes"; then
1736     CC="$aros_kernel_cc"
1737     AC_MSG_CHECKING([whether ${CC} accepts -fno-stack-protector])
1738     AC_TRY_COMPILE(,, use_no_stack_protector="yes", use_no_stack_protector="no")
1739     AC_MSG_RESULT($use_no_stack_protector)
1740     AC_MSG_CHECKING([whether ${CC} accepts -iquote])
1741     AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
1742     AC_MSG_RESULT($has_iquote)
1743     if test "x-$has_iquote" = "x-yes" ; then
1744         kernel_cflags_iquote=-iquote
1745         kernel_cflags_iquote_end=
1746     else
1747         kernel_cflags_iquote=-I
1748         kernel_cflags_iquote_end=-I-
1749     fi
1751 aros_cflags_iquote=$kernel_cflags_iquote
1752 aros_cflags_iquote_end=$kernel_cflags_iquote_end
1753 if test "$orig_target_cc" != "$aros_kernel_cc"; then
1754     CC="$orig_target_cc"
1755     AC_MSG_CHECKING([whether ${CC} accepts -iquote])
1756     AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
1757     AC_MSG_RESULT($has_iquote)
1758     if test "x-$has_iquote" = "x-yes" ; then
1759         aros_cflags_iquote=-iquote
1760         aros_cflags_iquote_end=
1761     else
1762         aros_cflags_iquote=-I
1763         aros_cflags_iquote_end=-I-
1764     fi
1766 if test "x-$use_no_stack_protector" = "x-yes" ; then
1767     aros_kernel_cflags="$aros_kernel_cflags -fno-stack-protector"
1770 #-----------------------------------------------------------------------------
1772 # Check if we can explicitly choose older version of symbol hashing
1774 CFLAGS="save_cflags -Wl,--hash-style=sysv"
1775 CC="$aros_kernel_cc"
1776 AC_MSG_CHECKING([whether ${CC} accepts -Wl,--hash-style=sysv])
1777 AC_TRY_LINK(,, use_hash_style="yes", use_hash_style="no")
1778 AC_MSG_RESULT($use_hash_style)
1779 if test "x-$use_hash_style" = "x-yes" ; then
1780     aros_kernel_cflags="$aros_kernel_cflags -Wl,--hash-style=sysv"
1782 CC="$save_cc"
1783 CFLAGS="$save_cflags"
1785 AC_SUBST(host_cflags_iquote)
1786 AC_SUBST(host_cflags_iquote_end)
1787 AC_SUBST(kernel_cflags_iquote)
1788 AC_SUBST(kernel_cflags_iquote_end)
1789 AC_SUBST(aros_cflags_iquote)
1790 AC_SUBST(aros_cflags_iquote_end)
1793 dnl Check if user specified --with-resolution=XRESxYRESxDEPTH
1794 AC_MSG_CHECKING([for default resolution of WBScreen])
1795 AC_ARG_WITH(resolution,AC_HELP_STRING([--with-resolution=XRESxYRESxDEPTH],[Default resolution of the initial WorkbenchScreen]),resolution=$withval,resolution=none)
1796 # We require an argument, so map --with/--without ("yes"/"no") to "none" specified
1797 if test "$resolution" = "yes" ; then
1798     resolution="none"
1800 if test "$resolution" = "no" ; then
1801     resolution="none"
1803 if test "$resolution" != "none" ; then
1804     aros_default_wbwidth=`echo $resolution | cut -d'x' -f1`
1805     aros_default_wbheight=`echo $resolution | cut -d'x' -f2`
1806     aros_default_wbdepth=`echo $resolution | cut -d'x' -f3`
1808 AC_MSG_RESULT($aros_default_wbwidth x $aros_default_wbheight x $aros_default_wbdepth)
1809 aros_cv_default_wbwidth=$aros_default_wbwidth
1810 aros_cv_default_wbheight=$aros_default_wbheight
1811 aros_cv_default_wbdepth=$aros_default_wbdepth
1813 dnl See if the user wants the serial debug output for native flavour
1814 AC_MSG_CHECKING([if serial debug is enabled])
1815 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)
1816 if test "$aros_serial_debug" = 0 ; then
1817     serial_debug_forced=""
1818     if test "$serial_debug" = "yes" ; then
1819         serial_debug="2"
1820     fi
1821     if test "$serial_debug" = "no" ; then
1822         serial_debug="none"
1823     fi
1824 else
1825     serial_debug_forced="(forced)"
1826     serial_debug=$aros_serial_debug
1828 if test "$serial_debug" != "none" ; then
1829     aros_serial_debug=$serial_debug
1830     AC_MSG_RESULT($serial_debug_forced on port $serial_debug)
1831 else
1832     AC_MSG_RESULT(no)
1835 dnl See if the user wants the palm debug output hack for palm native flavour
1836 AC_MSG_CHECKING([if palm debug hack is enabled])
1837 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")
1838 if test "$palm_debug_hack" = "yes" ; then
1839     aros_palm_debug_hack="1"
1841 AC_MSG_RESULT($palm_debug_hack)
1844 dnl See if the user wants nesting supervisor activated for unix flavour
1845 AC_MSG_CHECKING([if nesting supervisor support is enabled])
1846 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")
1847 if test "$nesting_supervisor" = "yes" ; then
1848     aros_nesting_supervisor="1"
1850 AC_MSG_RESULT($nesting_supervisor)
1852 dnl See if the user wants to disable MMU support
1853 dnl This can be overriden on per-target basis,
1854 dnl set $aros_enable_mmu to "yes" or "no" to do this
1855 if test "$aros_enable_mmu" = "" ; then
1856     AC_MSG_CHECKING([if MMU support is enabled])
1857     dnl Enabled by default
1858     AC_ARG_ENABLE(mmu,AC_HELP_STRING([--disable-mmu],[Disable MMU support (default=enabled)]),aros_enable_mmu=$enableval,aros_enable_mmu="yes")
1859     if test "$aros_enable_mmu" = "" ; then
1860         aros_enable_mmu="yes"
1861     fi
1862     AC_MSG_RESULT($aros_enable_mmu)
1864 if test "$aros_enable_mmu" = "no" ; then
1865     aros_enable_mmu="0"
1866 else
1867     aros_enable_mmu="1"
1869     
1871 dnl things specifically required for hosted flavours
1872 if test "x-$aros_flavour" = "x-emulation" -o "x-$aros_flavour" = "x-emulcompat" ; then
1874     if test "x-$need_dlopen" != "x-no" ; then
1875       dnl some kind of dynamic library access system is required for hostlib.resource
1876       AC_CHECK_FUNC(dlopen, have_dl="yes", have_dl="no")
1877       if test "x-$have_dl" = "x-no" ; then
1878           AC_CHECK_LIB(dl, dlopen, [have_dl="yes"
1879                                     aros_host_ldflags="$aros_host_ldflags -ldl"],
1880                                     have_dl="no")
1881       fi
1882       if test "x-$have_dl" = "x-no" ; then
1883           AC_MSG_ERROR([dlopen() dynamic linker functions not available])
1884       fi
1885     fi
1888     dnl x11 hidd
1889     AC_ARG_ENABLE(x11_hidd, AC_HELP_STRING([--enable-x11-hidd],
1890                                            [build X11 hidd for hosted (default=auto)]),
1891                                            x11_hidd="$enableval",
1892                                            x11_hidd="$need_x11")
1893     case "x-$x11_hidd" in
1894         x-yes|x-no|x-auto)                 ;;
1895         *)                 x11_hidd="$need_x11" ;;
1896     esac
1898     ENABLE_X11=0
1900     dnl they want it
1901     if test "x-$x11_hidd" != "x-no" ; then
1903         dnl find x11 stuff
1904         AC_PATH_X
1906         x_cflags=
1907         for path in $x_libraries
1908         do
1909             x_cflags="$x_cflags -L$path"
1910         done
1912         for path in $x_includes
1913         do
1914             x_cflags="$x_cflags -I$path"
1915         done
1916         
1917         if test "x-$no_x" = "x-yes" ; then
1919             dnl didn't find it
1920             if test "x-$x11_hidd" != "x-auto" ; then
1921                 dnl and they explicitly asked for it, bail out
1922                 AC_MSG_ERROR([X11 libs/headers not found, cannot build X11 hidd as requested])
1923             fi
1924         
1925         else
1926             dnl found it, setup the metatarget
1927             x11_hidd_target=kernel-x11gfx-kobj
1928             ENABLE_X11=1
1930             dnl setup shared memory extensions
1931             AC_ARG_ENABLE(x11_shm, AC_HELP_STRING([--enable-x11-shm],
1932                                                   [use X11 shared memory (default=auto)]),
1933                                                   x11_hidd_shm="$enableval",
1934                                                   x11_hidd_shm="auto")
1935             case "x-$x11_hidd_shm" in
1936                 x-yes|x-no|x-auto)                     ;;
1937                 *)                 x11_hidd_shm="auto" ;;
1938             esac
1940             have_xshm=no
1942             dnl they want it
1943             if test "x-$x11_hidd_shm" != "x-no" ; then
1945                 dnl system shm headers
1946                 AC_CHECK_HEADERS(sys/ipc.h)
1947                 AC_CHECK_HEADERS(sys/shm.h)
1949                 dnl got them
1950                 if test "x-$ac_cv_header_sys_ipc_h" = "x-yes" -a "x-$ac_cv_header_sys_shm_h" = "x-yes" ; then
1952                     dnl make sure X libs have shm functions
1953                     save_cflags="$CFLAGS"
1954                     CFLAGS="$CFLAGS $x_cflags"
1955                     AC_CHECK_LIB(Xext, XShmQueryExtension, have_xshm=yes)
1956                     CFLAGS="$save_cflags"
1957                 fi
1958             fi
1960             dnl detection done, prepare output
1961             if test "x-$have_xshm" = "x-yes" ; then
1962                 dnl we can do shm
1963                 DO_XSHM_SUPPORT="1"
1964             elif test "x-$x11_hidd_shm" = "x-yes" ; then
1965                 dnl they explicitly asked for it, but we can't do it
1966                 AC_MSG_ERROR([X11 has no support for shared memory, cannot enable it as requested])
1967             else
1968                 dnl otherwise just disable it
1969                 DO_XSHM_SUPPORT="0"
1970             fi
1972             
1973             dnl setup vidmode (fullscreen) extensions
1974             AC_ARG_ENABLE(x11_vidmode, AC_HELP_STRING([--enable-x11-vidmode],
1975                                                       [use X11 vidmode extension (default=auto)]),
1976                                                       x11_hidd_vidmode="$enableval",
1977                                                       x11_hidd_vidmode="auto")
1978             case "x-$x11_hidd_vidmode" in
1979                 x-yes|x-no|x-auto)                         ;;
1980                 *)                 x11_hidd_vidmode="auto" ;;
1981             esac
1983             have_vidmode=no
1985             dnl they want it
1986             if test "x-$x11_hidd_vidmode" != "x-no" ; then
1988                 dnl make sure X libs have vidmode functions
1989                 save_cflags="$CFLAGS"
1990                 CFLAGS="$CFLAGS $x_cflags"
1991                 AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryExtension, have_vidmode=yes)
1992                 CFLAGS="$save_cflags"
1993             fi
1995             dnl detection done, prepare output
1996             if test "x-$have_vidmode" = "x-yes" ; then
1997                 dnl we can do vidmode
1998                 DO_VIDMODE_SUPPORT="1"
1999             elif test "x-$x11_hidd_vidmode" = "x-yes" ; then
2000                 dnl they explicitly asked for it, but we can't do it
2001                 AC_MSG_ERROR([X11 vidmode extension not available, cannot enable it as requested])
2002             else
2003                 dnl otherwise just disable it
2004                 DO_VIDMODE_SUPPORT="0"
2005             fi
2006         fi
2008         aros_host_x11_includes=$x_includes 
2009         aros_host_x11_libdirs=$x_libraries
2010     fi
2013     dnl sdl hidd
2014     AC_ARG_ENABLE(sdl_hidd, AC_HELP_STRING([--enable-sdl-hidd],
2015                                            [build SDL hidd for hosted (default=auto)]),
2016                                            sdl_hidd="$enableval",
2017                                            sdl_hidd="auto")
2018     case "x-$sdl_hidd" in
2019         x-yes|x-no|x-auto)                 ;;
2020         *)                 sdl_hidd="auto" ;;
2021     esac
2023     dnl they want it
2024     if test "x-$sdl_hidd" != "x-no" ; then
2026         dnl find sdl
2027         AM_PATH_SDL([1.2.10], have_sdl="yes", have_sdl="no")
2029         if test "x-$have_sdl" != "x-yes" ; then
2031             dnl didn't find it
2032             if test "x-$sdl_hidd" != "x-auto" ; then
2033                 dnl and they explicitly asked for it, bail out
2034                 AC_MSG_ERROR([SDL libs/headers not found, cannot build SDL hidd as requested])
2035             fi
2037         else
2038             dnl found it, set up the metatarget
2039             sdl_hidd_target=kernel-hidd-sdl
2040             aros_host_sdl_cflags=SDL_CFLAGS
2041             aros_host_sdl_libs=SDL_LIBS
2042         fi
2043     fi
2045     dnl oss.library
2046     AC_CHECK_HEADER(sys/soundcard.h)
2047     if test "x-$ac_cv_header_sys_soundcard_h" = "x-yes" ; then
2048         oss_library_target=workbench-libs-oss-unix
2049     fi
2053 dnl See if the user wants dbus.library
2054 AC_MSG_CHECKING([if building of dbus.library is enabled])
2055 AC_ARG_ENABLE(dbus,AC_HELP_STRING([--enable-dbus],[Enable DBUS support via dbus.library (default=no)]),dbus="yes",dbus="no")
2056 if test "$dbus" = "yes" ; then
2057     ENABLE_DBUS=1
2058     DBUS_CFLAGS=`pkg-config --cflags dbus-1`
2059     DBUS_LIBFLAGS=`pkg-config --libs dbus-1`
2060     KERNEL_DBUS_KOBJ=kernel-dbus-kobj
2061     KERNEL_DBUS_INCLUDES=kernel-dbus-includes
2062 else
2063     ENABLE_DBUS=0
2065 AC_MSG_RESULT($dbus)
2068 dnl --------------------------------------------------------------------
2069 dnl Configuration Output Section
2070 dnl --------------------------------------------------------------------
2072 # Generic
2073 AC_SUBST(aros_arch)
2074 AC_SUBST(aros_cpu)
2075 AC_SUBST(aros_flavour)
2076 AC_SUBST(aros_flavour_uc)
2077 AC_SUBST(AROS_BUILDDIR)
2078 AC_SUBST(AROS_BUILDDIR_UNIX)
2079 AC_SUBST(SRCDIR)
2080 AC_SUBST(AROS_PORTSSRCDIR)
2082 # Host related
2083 AC_SUBST(aros_cc_pre)
2084 AC_SUBST(aros_host_strip)
2085 AC_SUBST(aros_host_arch)
2086 AC_SUBST(aros_host_cpu)
2087 AC_SUBST(aros_host_cc)
2088 AC_SUBST(aros_host_ar)
2089 AC_SUBST(aros_host_ranlib)
2090 AC_SUBST(aros_host_ld)
2091 AC_SUBST(aros_host_make)
2092 AC_SUBST(aros_host_cflags)
2093 AC_SUBST(gnu89_inline)
2094 AC_SUBST(aros_host_ldflags)
2095 AC_SUBST(aros_host_debug)
2096 AC_SUBST(aros_host_mkdep)
2097 AC_SUBST(aros_host_mkargs)
2098 AC_SUBST(aros_host_exe_suffix)
2099 AC_SUBST(aros_host_lib_suffix)
2100 AC_SUBST(aros_tools_dir)
2101 AC_SUBST(aros_host_aclocal)
2102 AC_SUBST(aros_host_autoconf)
2103 AC_SUBST(aros_host_autoheader)
2104 AC_SUBST(aros_host_automake)
2106 # Target Related
2107 AC_SUBST(aros_target_guitheme)
2108 AC_SUBST(aros_target_iconset)
2109 AC_SUBST(aros_target_bootloader)
2110 AC_SUBST(aros_target_arch)
2111 AC_SUBST(aros_target_family)
2112 AC_SUBST(aros_target_cpu)
2113 AC_SUBST(aros_target_variant)
2114 AC_SUBST(aros_target_suffix)
2115 AC_SUBST(aros_target_incl)
2116 AC_SUBST(aros_target_ar)
2117 AC_SUBST(aros_target_ranlib)
2118 AC_SUBST(aros_kernel_nm)
2119 AC_SUBST(orig_target_cc)
2120 AC_SUBST(aros_target_cc)
2121 AC_SUBST(aros_target_cxx)
2122 AC_SUBST(aros_kernel_cc)
2123 AC_SUBST(aros_target_as)
2124 AC_SUBST(orig_target_ld)
2125 AC_SUBST(aros_target_ld)
2126 AC_SUBST(aros_kernel_ld)
2127 AC_SUBST(aros_target_cc_includes)
2128 AC_SUBST(aros_target_cc_path)
2129 AC_SUBST(aros_target_objdump)
2130 AC_SUBST(aros_target_objcopy)
2131 AC_SUBST(aros_target_strip)
2132 AC_SUBST(aros_target_nm)
2133 AC_SUBST(aros_kernel_rescomp)
2134 AC_SUBST(aros_shared_default)
2135 AC_SUBST(aros_shared_ld)
2136 AC_SUBST(aros_object_format)
2137 AC_SUBST(aros_compiler_libs)
2138 AC_SUBST(aros_arch_libs)
2140 AC_SUBST(aros_config_cflags)
2141 AC_SUBST(aros_config_aflags)
2142 AC_SUBST(aros_config_ldflags)
2144 AC_SUBST(aros_shared_cflags)
2145 AC_SUBST(aros_shared_aflags)
2146 AC_SUBST(aros_shared_ldflags)
2147 AC_SUBST(aros_kernel_cflags)
2148 AC_SUBST(aros_kernel_includes)
2149 AC_SUBST(aros_kernel_objcflags)
2150 AC_SUBST(aros_kernel_ldflags)
2151 AC_SUBST(aros_target_cflags)
2152 AC_SUBST(aros_debug_cflags)
2153 AC_SUBST(aros_debug_aflags)
2154 AC_SUBST(aros_debug_ldflags)
2155 AC_SUBST(aros_paranoia_cflags)
2156 AC_SUBST(aros_target_genmap)
2157 AC_SUBST(aros_target_strip_flags)
2159 AC_SUBST(crosstools_target)
2161 # Graphics Related
2162 AC_SUBST(x11_hidd_target)
2163 AC_SUBST(sdl_hidd_target)
2164 AC_SUBST(pci_hidd_target)
2165 AC_SUBST(oss_library_target)
2167 AC_SUBST(aros_default_wbwidth)
2168 AC_SUBST(aros_default_wbheight)
2169 AC_SUBST(aros_default_wbdepth)
2170 AC_SUBST(DO_XSHM_SUPPORT)
2171 AC_SUBST(DO_VIDMODE_SUPPORT)
2173 AC_SUBST(aros_host_x11_includes)
2174 AC_SUBST(aros_host_x11_libdirs)
2175 AC_SUBST(aros_host_sdl_cflags)
2176 AC_SUBST(aros_host_sdl_libs)
2178 # Native version related
2179 AC_SUBST(aros_serial_debug)
2181 # Palm native version related
2182 AC_SUBST(aros_palm_debug_hack)
2184 # Unix/Hosted version related
2185 AC_SUBST(aros_nesting_supervisor)
2187 # MMU related
2188 AC_SUBST(aros_enable_mmu)
2190 # Apple iOS related
2191 AC_SUBST(aros_ios_platform)
2192 AC_SUBST(aros_ios_version)
2193 AC_SUBST(aros_ios_sdk)
2195 # Android related
2196 AC_SUBST(android_tool)
2197 AC_SUBST(aros_android_level)
2199 # DBUS related
2200 AC_SUBST(ENABLE_DBUS)
2201 AC_SUBST(DBUS_CFLAGS)
2202 AC_SUBST(DBUS_LIBFLAGS)
2203 AC_SUBST(KERNEL_DBUS_KOBJ)
2204 AC_SUBST(KERNEL_DBUS_INCLUDES)
2206 #X11 related
2207 AC_SUBST(ENABLE_X11)
2209 # Debug related
2210 AC_SUBST(aros_debug)
2211 AC_SUBST(aros_mungwall_debug)
2212 AC_SUBST(aros_stack_debug)
2213 AC_SUBST(aros_modules_debug)
2215 # Collect-aros stuff: "-ius" to ignore undefined symbols
2216 AC_SUBST(ignore_undefined_symbols)
2218 # C compiler related
2219 AC_SUBST(gcc_target_cpu)
2221 dnl Prepare for output, make up all the generated patches
2222 case "$aros_flavour" in
2223 emulation)      aros_flavour_uc="AROS_FLAVOUR_EMULATION"
2224                 aros_flavour="emulation" ;;
2225 emulcompat)     aros_flavour_uc="(AROS_FLAVOUR_EMULATION|AROS_FLAVOUR_BINCOMPAT)"
2226                 aros_flavour="emulation" ;;
2227 standalone)     aros_flavour_uc="AROS_FLAVOUR_STANDALONE"
2228                 aros_flavour="standalone";;
2229 standcompat)    aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_BINCOMPAT)"
2230                 aros_flavour="standalone";;
2231 native)         aros_flavour_uc="AROS_FLAVOUR_NATIVE"
2232                 aros_flavour="native" ;;
2233 nativecompat)   aros_flavour_uc="(AROS_FLAVOUR_NATIVE|AROS_FLAVOUR_BINCOMPAT)"
2234                 aros_flavour="native" ;;
2235 linklib)        aros_flavour_uc="AROS_FLAVOUR_LINKLIB"
2236                 aros_flavour="linklib" ;;
2237 palmnative)     aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
2238                 aros_flavour="palmnative" ;;
2239 mac68knative)   aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
2240                 aros_flavour="mac68knative" ;;
2241 ppcnative)      aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_BINCOMPAT)"
2242                 aros_flavour="ppcnative" ;;
2243 esac
2245 if test ! -d ${aros_inc_dir} ; then
2246     ${MKDIR} ${aros_inc_dir}
2248 if test ! -d ${aros_geninc_dir} ; then
2249     ${MKDIR} ${aros_geninc_dir}
2251 if test ! -d ${aros_hostcfg_dir} ; then
2252     ${MKDIR} ${aros_hostcfg_dir}
2254 if test ! -d ${aros_targetcfg_dir} ; then
2255     ${MKDIR} ${aros_targetcfg_dir}
2257 if test ! -d ${aros_tools_dir} ; then
2258     ${MKDIR} ${aros_tools_dir}
2260 if test ! -d ${aros_scripts_dir} ; then
2261     ${MKDIR} ${aros_scripts_dir}
2264 AC_CONFIG_HEADERS(${aros_geninc_dir}/host-conf.h:config/host-conf.h.in)
2266 AC_CONFIG_COMMANDS([compiler_executable],
2267     [
2268         prefix=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}
2269         mkdir -p $prefix
2270         prefix="${prefix}/${aros_target_cpu}-aros"
2271         prefix2=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros
2273         echo ${prefix}
2274         echo ${prefix2}
2275         chmod a+x ${prefix2}-gcc ${prefix2}-ld
2277         ln -sf ${prefix2}-gcc          ${prefix}-gcc
2278         ln -sf ${prefix2}-ld           ${prefix}-ld
2280         ln -sf $aros_target_as_ln$aros_host_exe_suffix      ${prefix}-as
2281         ln -sf $aros_target_nm_ln$aros_host_exe_suffix      ${prefix}-nm
2282         ln -sf $aros_target_ar_ln$aros_host_exe_suffix      ${prefix}-ar
2283         ln -sf $aros_target_ranlib_ln$aros_host_exe_suffix  ${prefix}-ranlib
2284         ln -sf $aros_target_objcopy_ln$aros_host_exe_suffix ${prefix}-objcopy
2285         ln -sf $aros_target_objdump_ln$aros_host_exe_suffix ${prefix}-objdump
2286         ln -sf $aros_target_strip_ln$aros_host_exe_suffix   ${prefix}-strip
2288         ln -sf $aros_target_as_ln$aros_host_exe_suffix      ${prefix2}-as
2289         ln -sf $aros_target_nm_ln$aros_host_exe_suffix      ${prefix2}-nm
2290         ln -sf $aros_target_ar_ln$aros_host_exe_suffix      ${prefix2}-ar
2291         ln -sf $aros_target_ranlib_ln$aros_host_exe_suffix  ${prefix2}-ranlib
2292         ln -sf $aros_target_objcopy_ln$aros_host_exe_suffix ${prefix2}-objcopy
2293         ln -sf $aros_target_objdump_ln$aros_host_exe_suffix ${prefix2}-objdump
2294         ln -sf $aros_target_strip_ln$aros_host_exe_suffix   ${prefix2}-strip
2295     ],
2296     [
2297         aros_host_exe_suffix=${aros_host_exe_suffix}
2298         aros_tools_dir=${aros_tools_dir}
2299         aros_target_cpu=${aros_target_cpu}
2300         aros_target_arch=${aros_target_arch}
2301         aros_target_suffix=${aros_target_suffix}
2302         aros_target_nm_ln=${aros_target_nm_ln}
2303         aros_target_as_ln=${aros_target_as_ln}
2304         aros_target_ar_ln=${aros_target_ar_ln}
2305         aros_target_ranlib_ln=${aros_target_ranlib_ln}
2306         aros_target_objdump_ln=${aros_target_objdump_ln}
2307         aros_target_objcopy_ln=${aros_target_objcopy_ln}
2308         aros_target_strip_ln=${aros_target_strip_ln}
2309     ]
2311 AC_CONFIG_COMMANDS([genshared_executable],
2312     [chmod a+x ${aros_scripts_dir}/genshared],
2313     [aros_scripts_dir=${aros_scripts_dir}]
2315 AC_CONFIG_COMMANDS([genmf_executable],
2316     [chmod a+x ${aros_tools_dir}/genmf.py],
2317     [aros_tools_dir=${aros_tools_dir}]
2320 AC_CONFIG_FILES(
2321     Makefile
2322     config/make.cfg
2323     ${aros_inc_dir}/config.h:config/config.h.in
2324     ${aros_geninc_dir}/config.h:config/config.h.in
2325     ${aros_hostcfg_dir}/host.cfg:config/host.cfg.in
2326     ${aros_targetcfg_dir}/target.cfg:config/target.cfg.in
2327     mmake.config
2328     ${aros_targetcfg_dir}/make.defaults:config/make.defaults.in
2329     ${aros_targetcfg_dir}/specs:config/specs.in
2330     ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-gcc:scripts/aros-gcc.in
2331     ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-ld:scripts/aros-ld.in
2332     ${aros_scripts_dir}/genshared:compiler/library_template_c/source/lib_source/genshared.in
2333     ${aros_tools_dir}/genmf.py:tools/genmf/genmf.py
2334     tools/collect-aros/env.h
2335     ${aros_gendir}/arch/all-android/bootstrap/app/default.properties:arch/all-android/bootstrap/app/default.properties.in
2338 AC_OUTPUT
2340 dnl This is in order to not define SHARED_CFLAGS sometimes
2341 dnl We don't always do aros_shared_ar, aros_shared_cflags
2343 #XXX compatability...
2344 aros_shared_ar="$aros_shared_ld $aros_shared_ldflags -o"
2346 if test -n "$aros_shared_cflags" ; then
2347     echo "SHARED_CFLAGS := $aros_shared_cflags" >> ${aros_hostcfg_dir}/host.cfg
2348     echo "SHARED_AR := $aros_shared_ar" >> ${aros_hostcfg_dir}/host.cfg