TaggedOpenLibrary constants off by one fix.
[AROS.git] / configure.in
blobe771452ab6bbbfd46e9823d414e440fc774c536a
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                 aros_default_wbdepth=2
1249                 ;;
1250             *ppc*)
1251                 aros_cpu="ppc"
1252                 aros_flavour="native"
1253                 gcc_target_cpu="ppc"
1254                 ;;
1255             *)
1256                 AC_MSG_ERROR("Unknown CPU for Amiga $target_cpu")
1257                 ;;
1258         esac
1259         ;;
1261     mingw*)
1262         aros_target_arch="mingw32"
1263         aros_shared_default="no"
1264         aros_flavour="emulation"
1265         aros_shared_cflags=""
1266         need_dlopen="no"
1267         rescomp="windres"
1268         case "$target_cpu" in
1269             *i?86*)
1270                 aros_target_cpu="i386"
1271                 aros_object_format="elf_i386"
1272                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1273                 aros_default_wbdepth=8
1274                 gcc_target_cpu="i386"
1275                 aros_target_cc="i386-aros-gcc"
1276                 aros_target_cxx="i386-aros-g++"
1277                 aros_target_ld="i386-aros-ld"
1278                 aros_target_as="i386-aros-as"
1279                 aros_target_ar="i386-aros-ar"
1280                 aros_target_ranlib="i386-aros-ranlib"
1281                 aros_target_nm="i386-aros-nm"
1282                 aros_target_strip="i386-aros-strip"
1283                 aros_target_objcopy="i386-aros-objcopy"
1284                 aros_target_objdump="i386-aros-objdump"
1285                 target_tool_prefix="i386-mingw32-"
1286                 ;;
1287             *x86_64*)
1288                 aros_target_cpu="x86_64"
1289                 aros_object_format="elf_x86_64"
1290                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
1291                 aros_config_cflags="$aros_config_cflags -fno-omit-frame-pointer"
1292                 aros_default_wbdepth=8
1293                 gcc_target_cpu="x86_64"
1294                 aros_target_cc="x86_64-aros-gcc"
1295                 aros_target_cxx="x86_64-aros-g++"
1296                 aros_target_ld="x86_64-aros-ld"
1297                 aros_target_as="x86_64-aros-as"
1298                 aros_target_ar="x86_64-aros-ar"
1299                 aros_target_ranlib="x86_64-aros-ranlib"
1300                 aros_target_nm="x86_64-aros-nm"
1301                 aros_target_strip="x86_64-aros-strip"
1302                 aros_target_objcopy="x86_64-aros-objcopy"
1303                 aros_target_objdump="x86_64-aros-objdump"
1304                 target_tool_prefix="x86_64-w64-mingw32-"
1305                 ;;
1306             *arm*)
1307                 aros_target_cpu="arm"
1308                 aros_object_format="armelf_linux_eabi"
1309                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
1310                 aros_arch_libs="-laeabi"
1311                 aros_default_wbdepth=8
1312                 gcc_target_cpu="arm"
1313                 aros_target_cc="arm-aros-gcc"
1314                 aros_target_cxx="arm-aros-g++"
1315                 aros_target_ld="arm-aros-ld"
1316                 aros_target_as="arm-aros-as"
1317                 aros_target_ar="arm-aros-ar"
1318                 aros_target_ranlib="arm-aros-ranlib"
1319                 aros_target_nm="arm-aros-nm"
1320                 aros_target_strip="arm-aros-strip"
1321                 aros_target_objcopy="arm-aros-objcopy"
1322                 aros_target_objdump="arm-aros-objdump"
1323                 target_tool_prefix="arm-mingw32ce-"
1324                 aros_default_wbwidth=160
1325                 aros_default_wbheight=160
1326                 ;;
1327             *)
1328                 AC_MSG_ERROR("Unknown CPU for Mingw32 -- $target_cpu")
1329                 ;;
1330         esac
1331         if test $host_os = "cygwin"; then
1332                 aros_kernel_cflags="-mno-cygwin"
1333         fi
1334     ;;
1335     pp*)
1336         aros_target_arch="pp"
1337         aros_shared_default="no"
1338         case "$target_cpu" in
1339             *m68k*)
1340                 aros_target_cpu="m68k"
1341                 aros_object_format="m68kelf"
1342                 aros_flavour="palmnative"
1343                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
1344                 aros_default_wbwidth=160
1345                 aros_default_wbheight=160
1346                 aros_default_wbdepth=1
1347                 aros_target_ar_flags="cru"
1348                 aros_compiler_libs="-lgcc1"
1349                 aros_shared_default=no
1350                 aros_shared_cflags="-fpic"
1351                 aros_shared_aflags=""
1352                 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
1353                 aros_kernel_ldflags="-Wl,-rpath,./lib"
1354                 aros_debug_cflags="-Wall -Werror-implicit-function-declaration $aros_symbols_debug  $aros_messages_debug -mc68000 -Wa,-mc68000"
1355                 aros_debug_aflags=""
1356                 aros_debug_ldflags="$aros_symbols_debug"
1357                 aros_mungwall_debug="0"
1358                 aros_modules_debug="0"
1359                 gcc_target_cpu="mc68000"
1360                 ignore_undefined_symbols="-ius"
1361                 ;;
1362            *)
1363                 AC_MSG_ERROR("Unknown CPU for PalmPilot -- $target_cpu")
1364                 ;;
1365         esac
1366         ;;
1368     mac*)
1369         aros_target_arch="mac"
1370         aros_shared_default="no"
1371         case "$target_cpu" in
1372             *m68k*)
1373                 aros_target_cpu="m68k"
1374                 aros_object_format="m68kelf"
1375                 aros_flavour="mac68knative"
1376                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
1377                 aros_default_wbwidth=512
1378                 aros_default_wbheight=384
1379                 aros_default_wbdepth=8
1380                 aros_target_ar_flags="cru"
1381                 aros_compiler_libs="-lgcc1"
1382                 aros_shared_default=no
1383                 aros_shared_cflags="-fpic"
1384                 aros_shared_aflags=""
1385                 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
1386                 aros_kernel_ldflags="-Wl,-rpath,./lib"
1387                 aros_debug_cflags="-Wall -Werror-implicit-function-declaration $aros_symbols_debug  $aros_messages_debug -mc68000"
1388                 aros_debug_aflags=""
1389                 aros_debug_ldflags="$aros_symbols_debug"
1390                 aros_mungwall_debug="0"
1391                 aros_modules_debug="0"
1392                 gcc_target_cpu="mc68000"
1393                 ignore_undefined_symbols="-ius"
1394                 ;;
1395            *)
1396                 AC_MSG_ERROR("Unknown CPU for Mac68k -- $target_cpu")
1397                 ;;
1398         esac
1399         ;;
1401     *)
1402         AC_MSG_ERROR([Unsupported target architecture $target])
1403         ;;
1404 esac
1406 AC_MSG_CHECKING([Where to download sourcecode for external ports])
1407 AC_ARG_WITH(portssources,AC_HELP_STRING([--with-portssources=DIR],[Where to download sourcecode for external ports]),with_portssrcdir=$withval,with_portssrcdir="default")
1408 if test "$with_portssrcdir" = "default"; then
1409     AROS_PORTSSRCDIR="$AROS_BUILDDIR_UNIX/bin/Sources"
1410 else
1411     AROS_PORTSSRCDIR="$with_portssrcdir"
1413 AC_MSG_RESULT($AROS_PORTSSRCDIR)
1415 AC_MSG_CHECKING([which bootloader to use])
1416 AC_ARG_WITH(bootloader,AC_HELP_STRING([--with-bootloader=NAME],[Use a specific bootloader]),target_bootloader=$withval,target_bootloader=$target_bootloader)
1417 if test "$target_bootloader" = "none"; then
1418     aros_target_bootloader=""
1419 else
1420     aros_target_bootloader="$target_bootloader"
1422 AC_MSG_RESULT($target_bootloader)
1424 AC_MSG_CHECKING([which icon-set to use])
1425 AC_ARG_WITH(iconset,AC_HELP_STRING([--with-iconset=NAME],[Use a specific Icon-set (default=Gorilla).]),target_iconset=$withval,target_iconset="default")
1426 if test "$target_iconset" = "default"; then
1427     aros_target_iconset="Gorilla"
1428     target_iconset="default (Gorilla)"
1429 else
1430     aros_target_iconset="$target_iconset"
1432 AC_MSG_RESULT($target_iconset)
1434 AC_MSG_CHECKING([which GUI Theme to use])
1435 AC_ARG_WITH(theme,AC_HELP_STRING([--with-theme=NAME],[Use a specific GUI Theme]),target_guitheme=$withval,target_guitheme="default")
1436 if test "$target_guitheme" = "default"; then
1437     aros_target_guitheme="Ice"
1438 else
1439     aros_target_guitheme="$target_guitheme"
1441 AC_MSG_RESULT($aros_target_guitheme)
1443 # Find out if we are cross-compiling (i.e. if we can't use the host compiler
1444 # for target code)
1445 cross_compiling=no
1446 if test "$aros_host_cpu" != "$aros_target_cpu" ; then
1447     cross_compiling=yes
1449 if test "$aros_host_cpu" == "x86_64" ; then
1450     if test "$aros_target_cpu" == "i386" ; then
1451         if test "$aros_target_arch" != "mingw32"; then
1452             cross_compiling=no
1453         fi
1454     fi
1456 if test "$aros_host_arch" == "darwin" ; then
1457     if test "$aros_target_arch" != "darwin" ; then
1458         cross_compiling=yes
1459     fi
1462 # Set prefix for target compiler etc. if we're cross-compiling
1463 # (should possibly be earlier but needs to be after AC_PROG_CC)
1464 if test "$cross_compiling" = "yes" ; then
1465     if test "$target_tool_prefix" = ""; then
1466         target_tool_prefix=${target_cpu}-elf-
1467     fi
1468     CC=${target_tool_prefix}gcc
1469     dnl CPP is needed for AC_CHECK_HEADER to work correctly
1470     CPP=${target_tool_prefix}cpp
1471     if test "$target_tool_version" != "default"; then
1472         CC="$CC-$target_tool_version"
1473         CPP="$CC-$target_tool_version"
1474     fi
1475     AC_PATH_PROG(CC,$CC)
1476     AROS_REQUIRED(gcc,$CC)
1478 CC="$CC $target_tool_flags"
1480 #-----------------------------------------------------------------------------
1482 # Disable pointer-signedness warnings if the compiler recognises the option
1484 AC_MSG_CHECKING([whether ${CC} accepts -Wno-pointer-sign])
1485 save_cflags="$CFLAGS"
1486 CFLAGS="$CFLAGS -Wno-pointer-sign"
1487 AC_TRY_COMPILE(,, use_no_sign_warning="yes", use_no_sign_warning="no")
1488 AC_MSG_RESULT($use_no_sign_warning)
1489 if test "x-$use_no_sign_warning" = "x-yes" ; then
1490     aros_config_cflags="$aros_config_cflags -Wno-pointer-sign"
1492 CFLAGS="$save_cflags"
1494 #-----------------------------------------------------------------------------
1496 # Find all the tools we need to compile. This could be cross-compiling
1497 # though! If that is the case we use the GNU form of the target and
1498 # simply add this to the front of the binary name. This is rather simple,
1499 # but it should work under most circumstances.
1501 # The default tools are to use the same as the host, but only if the
1502 # host and target CPU are the same. With GCC this is normally enough.
1505 aros_cc_pre=""
1506 aros_shared_ld="$aros_host_ld"
1508 aros_target_mkdep="$aros_host_mkdep"
1509 aros_target_incl_def="$aros_host_incl"
1511 aros_kernel_cc="$CC"
1513 # The default tools executables to be linked to.
1514 if test "$aros_target_cc" != ""; then
1515     AC_PATH_PROG(aros_target_cc,$aros_target_cc)
1516     AROS_REQUIRED(gcc,$aros_target_cc)
1518 if test "$aros_target_ld" != ""; then
1519     AC_PATH_PROG(aros_target_ld,$aros_target_ld)
1520     AROS_REQUIRED(ld,$aros_target_ld)
1523 if test "$crosstools" != "yes"; then
1524     AROS_TOOL_TARGET(aros_target_as_ln,as,$aros_target_as)
1525     AROS_REQUIRED(as,$aros_target_as_ln)
1526     AROS_TOOL_TARGET(aros_kernel_ld,ld,$aros_kernel_ld)
1527     AROS_REQUIRED(ld,$aros_kernel_ld)
1528     AROS_TOOL_TARGET(aros_target_ar_ln,ar,$aros_target_ar)
1529     AROS_REQUIRED(ar,$aros_target_ar_ln)
1530     AROS_TOOL_TARGET(aros_target_nm_ln,nm,$aros_target_nm)
1531     AROS_REQUIRED(nm,$aros_target_nm_ln)
1532     AROS_TOOL_TARGET(aros_target_objcopy_ln,objcopy,$aros_target_objcopy)
1533     AROS_REQUIRED(objcopy,$aros_target_objcopy_ln)
1534     AROS_TOOL_TARGET(aros_target_objdump_ln,objdump,$aros_target_objdump)
1535     AROS_REQUIRED(objdump,$aros_target_objdump_ln)
1536     AROS_TOOL_TARGET(aros_target_ranlib_ln,ranlib,$aros_target_ranlib)
1537     AROS_REQUIRED(ranlib,$aros_target_ranlib_ln)
1538     AROS_TOOL_TARGET(aros_target_strip_ln,strip,$aros_target_strip)
1539     AROS_REQUIRED(strip,$aros_target_strip_ln)
1540     if test "$aros_target_cxx" != ""; then
1541         AC_PATH_PROG(aros_target_cxx,$aros_target_cxx)
1542 # Temporarily disabled in order to let Mingw32-hosted nightly build to work
1543 #       AROS_REQUIRED(c++,$aros_target_cxx)
1544     fi
1545 else
1546 # Cancel preinstalled C++ compiler because it will be built as part of crosstools
1547     aros_target_cxx=""
1550 # Build crosstools if we have no C++ - temporary thing 
1551 if test "$aros_target_cxx" = ""; then
1552     crosstools_target=tools-crosstools
1555 if test "$rescomp" != ""; then
1556     if test "$cross_compiling" = "yes" ; then
1557         rescomp=${target_tool_prefix}${rescomp}
1558     fi
1559     AC_PATH_PROG(aros_kernel_rescomp,$rescomp)
1560     AROS_REQUIRED($rescomp,$aros_kernel_rescomp)
1563 aros_hostcfg_dir="bin/${aros_host_arch}-${aros_host_cpu}/gen/config"
1564 aros_targetcfg_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/config"
1565 aros_inc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/AROS/Development/include/aros"
1566 aros_gendir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen"
1567 aros_geninc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/include/aros"
1568 aros_tools_dir="bin/${aros_host_arch}-${aros_host_cpu}/tools"
1569 aros_scripts_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/scripts"
1571 # aros_cc_pre is a variable that is added to the front of the compiler name
1572 # in the generated aros-gcc shell script. We need this to enable the cache
1573 # to work across cleaned builds. Also, support DISTCC using the correct
1574 # environment variable.
1577 if test "x${DISTCC}" != "x" ; then
1578     if test "x${CCACHE}" != "x" ; then
1579         aros_cc_pre="env CCACHE_PREFIX=${DISTCC} ${CCACHE} "
1580     else
1581         aros_cc_pre="${DISTCC} "
1582     fi
1583 else
1584     if test "x${CCACHE}" != "x" ; then
1585         aros_cc_pre="${CCACHE} "
1586     fi
1589 prefix="${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros"
1591 AC_SUBST(aros_target_nostdinc_cflags,-nostdinc)
1592 AC_SUBST(aros_target_nostartup_ldflags,-nostartfiles)
1593 AC_SUBST(aros_target_nix_ldflags,-nix)
1594 AC_SUBST(aros_target_detach_ldflags,-detach)
1595 AC_SUBST(aros_target_nostdlib_ldflags,-nostdlib)
1597 # Target tools
1598 if test "$aros_target_cc" = ""; then
1599     orig_target_cc=$aros_kernel_cc
1600 else
1601     orig_target_cc=$aros_target_cc
1603 if test "$aros_target_ld" = ""; then
1604     orig_target_ld=$aros_kernel_ld
1605 else
1606     orig_target_ld=$aros_target_ld
1608 if test "$GCC" = "yes"; then
1609     aros_target_cc_path=`$orig_target_cc -print-search-dirs | grep "programs: =" | cut -c 12-`
1611 aros_target_cc="${prefix}-gcc"
1612 aros_target_as="${prefix}-as"
1613 aros_target_ld="${prefix}-ld"
1614 aros_target_ar="${prefix}-ar $aros_target_ar_flags"
1615 aros_target_objcopy=${prefix}-objcopy
1616 aros_target_objdump=${prefix}-objdump
1617 aros_target_ranlib="${prefix}-ranlib $aros_target_ranlib_flags"
1618 aros_target_nm="${prefix}-nm $aros_target_nm_flags"
1619 aros_kernel_nm="${prefix}-nm"
1620 aros_target_strip=${prefix}-strip
1622 # Find the system include path. We can suggest that an alternative is
1623 # used if we don't get it correct. The default is to use /usr/include.
1624 # Which is set in the aros_target_incl_def variable.
1626 AC_ARG_ENABLE(includes,
1627 AC_HELP_STRING([--enable-includes=dir],[Alternative system include directory]),
1628 [aros_target_incl=$enable_includes], [aros_target_incl=$aros_target_incl_def])
1630 if test "$aros_kernel_includes" = ""; then
1631     if test "x-$aros_flavour" = "x-emulation" -o "x-$aros_flavour" = "x-emulcompat" ; then
1632         # FIXME: for cross-compiling this should point to another location
1633         aros_kernel_includes="-isystem $aros_target_incl"
1634     fi
1637 if test "$aros_kernel_includes" != "" ; then
1638     dnl find out about the kernel cc's include path
1639     AC_MSG_CHECKING([for the kernel compiler's include path])
1640     if test "$aros_kernel_cc_includes" = "" ; then
1641         # Try to guess where the directory is.
1642         aros_kernel_cc_includes=`dirname \`${aros_kernel_cc} ${aros_kernel_cflags} -print-libgcc-file-name\``/include
1643         if test -d $aros_kernel_cc_includes; then
1644             # Check if there is also an include-fixed directory and add it
1645             # to kernel compiler's include path as it may contain some of
1646             # the headers we need.
1647             if test -d "$aros_kernel_cc_includes"-fixed; then
1648                 aros_kernel_cc_includes+=" -isystem $aros_kernel_cc_includes"-fixed
1649             fi
1650         else
1651             # The directory doesn't exist, we need to do some more work.
1652             aros_kernel_cc_includes=${PWD}/${aros_gendir}/cc_include
1654             # These are the headers we're looking for.
1655             headers="limits.h mmintrin.h stdbool.h syslimits.h float.h \
1656                      stddef.h xmmintrin.h iso646.h stdarg.h unwind.h   \
1657                      zutil.h"
1659             dirs=
1660             for h in $headers; do
1661                 # Which other headers are needed by each of the above?
1662                 deps=$(echo "#include <$h>" | \
1663                        $aros_kernel_cc -E -M - 2>/dev/null | \
1664                        sed 's/^.*://; s/\\$/ /g; s/[[ \t]]\+/ /g')
1666                 # Copy all the needed headers to a directory beneath gendir.
1667                 for d in $deps; do
1668                     h=$(basename $d)
1669                     dir=${aros_kernel_cc_includes}$(echo $(dirname $d) | \
1670                                                 sed -n "s,^.*/include\(/.*\),\1,p")
1671                     ! test -d $dir && mkdir -p $dir
1672                     ! test -f $dir/$h && { cp $d $dir; chmod u+w $dir/$h; }
1673                 done
1674             done            
1675         fi
1676     fi
1677     AC_MSG_RESULT($aros_kernel_cc_includes)
1678     # Adding -nostdinc to kernel includes as they are always used together.
1679     aros_kernel_includes="$aros_kernel_includes $aros_target_nostdinc_cflags -isystem $aros_kernel_cc_includes"
1682 dnl find out about the target cc's include path
1683 AC_MSG_CHECKING([for the target compiler's include path])
1684 if test "$aros_target_cc_includes" = "" ; then
1685     #try to guess where the directory is
1686     aros_target_cc_includes=`dirname \`${orig_target_cc} -print-libgcc-file-name\``/include
1687     if ! test -d $aros_target_cc_includes; then
1688         #the directory doesn't exist, we need to do some more work
1689         aros_target_cc_includes=${PWD}/${aros_gendir}/cc_include
1690         
1691         #these are the headers we're looling for
1692         headers="limits.h mmintrin.h stdbool.h syslimits.h float.h \
1693                  stddef.h xmmintrin.h iso646.h stdarg.h unwind.h   \
1694                  zutil.h"
1696         dirs=
1697         for h in $headers; do
1698             #which other headers each of the above headers needs?
1699             deps=$(echo "#include <$h>" | \
1700                    $orig_target_cc -E -M - 2>/dev/null | \
1701                    sed 's/^.*://; s/\\$/ /g; s/[[ \t]]\+/ /g')
1702             
1703             #copy all the needed headers to a directory beneath gendir
1704             for d in $deps; do
1705                 h=$(basename $d)
1706                 dir=${aros_target_cc_includes}$(echo $(dirname $d) | \
1707                                                 sed -n "s,^.*/include\(/.*\),\1,p")
1708                 ! test -d $dir && mkdir -p $dir
1709                 ! test -f $dir/$h && { cp $d $dir; chmod u+w $dir/$h; }
1710             done
1711         done        
1712     fi
1714 AC_MSG_RESULT($aros_target_cc_includes)
1717 # For GCC < 4.0 -I- is used for giving the search path for '#include "..."'
1718 # On GCC >= 4.0 -iquote should be used
1721 save_cc="$CC"
1722 save_cflags="$CFLAGS"
1723 CFLAGS="-iquote."
1724 AC_MSG_CHECKING([whether ${CC} accepts -iquote])
1725 AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
1726 AC_MSG_RESULT($has_iquote)
1727 if test "x-$has_iquote" = "x-yes" ; then
1728     host_cflags_iquote=-iquote
1729     host_cflags_iquote_end=
1730 else
1731     host_cflags_iquote=-I
1732     host_cflags_iquote_end=-I-
1734 kernel_cflags_iquote=$host_cflags_iquote
1735 kernel_cflags_iquote_end=$host_cflags_iquote_end
1736 if test "x-$cross_compiling" = "x-yes"; then
1737     CC="$aros_kernel_cc"
1738     AC_MSG_CHECKING([whether ${CC} accepts -fno-stack-protector])
1739     AC_TRY_COMPILE(,, use_no_stack_protector="yes", use_no_stack_protector="no")
1740     AC_MSG_RESULT($use_no_stack_protector)
1741     AC_MSG_CHECKING([whether ${CC} accepts -iquote])
1742     AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
1743     AC_MSG_RESULT($has_iquote)
1744     if test "x-$has_iquote" = "x-yes" ; then
1745         kernel_cflags_iquote=-iquote
1746         kernel_cflags_iquote_end=
1747     else
1748         kernel_cflags_iquote=-I
1749         kernel_cflags_iquote_end=-I-
1750     fi
1752 aros_cflags_iquote=$kernel_cflags_iquote
1753 aros_cflags_iquote_end=$kernel_cflags_iquote_end
1754 if test "$orig_target_cc" != "$aros_kernel_cc"; then
1755     CC="$orig_target_cc"
1756     AC_MSG_CHECKING([whether ${CC} accepts -iquote])
1757     AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
1758     AC_MSG_RESULT($has_iquote)
1759     if test "x-$has_iquote" = "x-yes" ; then
1760         aros_cflags_iquote=-iquote
1761         aros_cflags_iquote_end=
1762     else
1763         aros_cflags_iquote=-I
1764         aros_cflags_iquote_end=-I-
1765     fi
1767 if test "x-$use_no_stack_protector" = "x-yes" ; then
1768     aros_kernel_cflags="$aros_kernel_cflags -fno-stack-protector"
1771 #-----------------------------------------------------------------------------
1773 # Check if we can explicitly choose older version of symbol hashing
1775 CFLAGS="save_cflags -Wl,--hash-style=sysv"
1776 CC="$aros_kernel_cc"
1777 AC_MSG_CHECKING([whether ${CC} accepts -Wl,--hash-style=sysv])
1778 AC_TRY_LINK(,, use_hash_style="yes", use_hash_style="no")
1779 AC_MSG_RESULT($use_hash_style)
1780 if test "x-$use_hash_style" = "x-yes" ; then
1781     aros_kernel_cflags="$aros_kernel_cflags -Wl,--hash-style=sysv"
1783 CC="$save_cc"
1784 CFLAGS="$save_cflags"
1786 AC_SUBST(host_cflags_iquote)
1787 AC_SUBST(host_cflags_iquote_end)
1788 AC_SUBST(kernel_cflags_iquote)
1789 AC_SUBST(kernel_cflags_iquote_end)
1790 AC_SUBST(aros_cflags_iquote)
1791 AC_SUBST(aros_cflags_iquote_end)
1794 dnl Check if user specified --with-resolution=XRESxYRESxDEPTH
1795 AC_MSG_CHECKING([for default resolution of WBScreen])
1796 AC_ARG_WITH(resolution,AC_HELP_STRING([--with-resolution=XRESxYRESxDEPTH],[Default resolution of the initial WorkbenchScreen]),resolution=$withval,resolution=none)
1797 # We require an argument, so map --with/--without ("yes"/"no") to "none" specified
1798 if test "$resolution" = "yes" ; then
1799     resolution="none"
1801 if test "$resolution" = "no" ; then
1802     resolution="none"
1804 if test "$resolution" != "none" ; then
1805     aros_default_wbwidth=`echo $resolution | cut -d'x' -f1`
1806     aros_default_wbheight=`echo $resolution | cut -d'x' -f2`
1807     aros_default_wbdepth=`echo $resolution | cut -d'x' -f3`
1809 AC_MSG_RESULT($aros_default_wbwidth x $aros_default_wbheight x $aros_default_wbdepth)
1810 aros_cv_default_wbwidth=$aros_default_wbwidth
1811 aros_cv_default_wbheight=$aros_default_wbheight
1812 aros_cv_default_wbdepth=$aros_default_wbdepth
1814 dnl See if the user wants the serial debug output for native flavour
1815 AC_MSG_CHECKING([if serial debug is enabled])
1816 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)
1817 if test "$aros_serial_debug" = 0 ; then
1818     serial_debug_forced=""
1819     if test "$serial_debug" = "yes" ; then
1820         serial_debug="2"
1821     fi
1822     if test "$serial_debug" = "no" ; then
1823         serial_debug="none"
1824     fi
1825 else
1826     serial_debug_forced="(forced)"
1827     serial_debug=$aros_serial_debug
1829 if test "$serial_debug" != "none" ; then
1830     aros_serial_debug=$serial_debug
1831     AC_MSG_RESULT($serial_debug_forced on port $serial_debug)
1832 else
1833     AC_MSG_RESULT(no)
1836 dnl See if the user wants the palm debug output hack for palm native flavour
1837 AC_MSG_CHECKING([if palm debug hack is enabled])
1838 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")
1839 if test "$palm_debug_hack" = "yes" ; then
1840     aros_palm_debug_hack="1"
1842 AC_MSG_RESULT($palm_debug_hack)
1845 dnl See if the user wants nesting supervisor activated for unix flavour
1846 AC_MSG_CHECKING([if nesting supervisor support is enabled])
1847 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")
1848 if test "$nesting_supervisor" = "yes" ; then
1849     aros_nesting_supervisor="1"
1851 AC_MSG_RESULT($nesting_supervisor)
1853 dnl See if the user wants to disable MMU support
1854 dnl This can be overriden on per-target basis,
1855 dnl set $aros_enable_mmu to "yes" or "no" to do this
1856 if test "$aros_enable_mmu" = "" ; then
1857     AC_MSG_CHECKING([if MMU support is enabled])
1858     dnl Enabled by default
1859     AC_ARG_ENABLE(mmu,AC_HELP_STRING([--disable-mmu],[Disable MMU support (default=enabled)]),aros_enable_mmu=$enableval,aros_enable_mmu="yes")
1860     if test "$aros_enable_mmu" = "" ; then
1861         aros_enable_mmu="yes"
1862     fi
1863     AC_MSG_RESULT($aros_enable_mmu)
1865 if test "$aros_enable_mmu" = "no" ; then
1866     aros_enable_mmu="0"
1867 else
1868     aros_enable_mmu="1"
1870     
1872 dnl things specifically required for hosted flavours
1873 if test "x-$aros_flavour" = "x-emulation" -o "x-$aros_flavour" = "x-emulcompat" ; then
1875     if test "x-$need_dlopen" != "x-no" ; then
1876       dnl some kind of dynamic library access system is required for hostlib.resource
1877       AC_CHECK_FUNC(dlopen, have_dl="yes", have_dl="no")
1878       if test "x-$have_dl" = "x-no" ; then
1879           AC_CHECK_LIB(dl, dlopen, [have_dl="yes"
1880                                     aros_host_ldflags="$aros_host_ldflags -ldl"],
1881                                     have_dl="no")
1882       fi
1883       if test "x-$have_dl" = "x-no" ; then
1884           AC_MSG_ERROR([dlopen() dynamic linker functions not available])
1885       fi
1886     fi
1889     dnl x11 hidd
1890     AC_ARG_ENABLE(x11_hidd, AC_HELP_STRING([--enable-x11-hidd],
1891                                            [build X11 hidd for hosted (default=auto)]),
1892                                            x11_hidd="$enableval",
1893                                            x11_hidd="$need_x11")
1894     case "x-$x11_hidd" in
1895         x-yes|x-no|x-auto)                 ;;
1896         *)                 x11_hidd="$need_x11" ;;
1897     esac
1899     ENABLE_X11=0
1901     dnl they want it
1902     if test "x-$x11_hidd" != "x-no" ; then
1904         dnl find x11 stuff
1905         AC_PATH_X
1907         x_cflags=
1908         for path in $x_libraries
1909         do
1910             x_cflags="$x_cflags -L$path"
1911         done
1913         for path in $x_includes
1914         do
1915             x_cflags="$x_cflags -I$path"
1916         done
1917         
1918         if test "x-$no_x" = "x-yes" ; then
1920             dnl didn't find it
1921             if test "x-$x11_hidd" != "x-auto" ; then
1922                 dnl and they explicitly asked for it, bail out
1923                 AC_MSG_ERROR([X11 libs/headers not found, cannot build X11 hidd as requested])
1924             fi
1925         
1926         else
1927             dnl found it, setup the metatarget
1928             x11_hidd_target=kernel-x11gfx-kobj
1929             ENABLE_X11=1
1931             dnl setup shared memory extensions
1932             AC_ARG_ENABLE(x11_shm, AC_HELP_STRING([--enable-x11-shm],
1933                                                   [use X11 shared memory (default=auto)]),
1934                                                   x11_hidd_shm="$enableval",
1935                                                   x11_hidd_shm="auto")
1936             case "x-$x11_hidd_shm" in
1937                 x-yes|x-no|x-auto)                     ;;
1938                 *)                 x11_hidd_shm="auto" ;;
1939             esac
1941             have_xshm=no
1943             dnl they want it
1944             if test "x-$x11_hidd_shm" != "x-no" ; then
1946                 dnl system shm headers
1947                 AC_CHECK_HEADERS(sys/ipc.h)
1948                 AC_CHECK_HEADERS(sys/shm.h)
1950                 dnl got them
1951                 if test "x-$ac_cv_header_sys_ipc_h" = "x-yes" -a "x-$ac_cv_header_sys_shm_h" = "x-yes" ; then
1953                     dnl make sure X libs have shm functions
1954                     save_cflags="$CFLAGS"
1955                     CFLAGS="$CFLAGS $x_cflags"
1956                     AC_CHECK_LIB(Xext, XShmQueryExtension, have_xshm=yes)
1957                     CFLAGS="$save_cflags"
1958                 fi
1959             fi
1961             dnl detection done, prepare output
1962             if test "x-$have_xshm" = "x-yes" ; then
1963                 dnl we can do shm
1964                 DO_XSHM_SUPPORT="1"
1965             elif test "x-$x11_hidd_shm" = "x-yes" ; then
1966                 dnl they explicitly asked for it, but we can't do it
1967                 AC_MSG_ERROR([X11 has no support for shared memory, cannot enable it as requested])
1968             else
1969                 dnl otherwise just disable it
1970                 DO_XSHM_SUPPORT="0"
1971             fi
1973             
1974             dnl setup vidmode (fullscreen) extensions
1975             AC_ARG_ENABLE(x11_vidmode, AC_HELP_STRING([--enable-x11-vidmode],
1976                                                       [use X11 vidmode extension (default=auto)]),
1977                                                       x11_hidd_vidmode="$enableval",
1978                                                       x11_hidd_vidmode="auto")
1979             case "x-$x11_hidd_vidmode" in
1980                 x-yes|x-no|x-auto)                         ;;
1981                 *)                 x11_hidd_vidmode="auto" ;;
1982             esac
1984             have_vidmode=no
1986             dnl they want it
1987             if test "x-$x11_hidd_vidmode" != "x-no" ; then
1989                 dnl make sure X libs have vidmode functions
1990                 save_cflags="$CFLAGS"
1991                 CFLAGS="$CFLAGS $x_cflags"
1992                 AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryExtension, have_vidmode=yes)
1993                 CFLAGS="$save_cflags"
1994             fi
1996             dnl detection done, prepare output
1997             if test "x-$have_vidmode" = "x-yes" ; then
1998                 dnl we can do vidmode
1999                 DO_VIDMODE_SUPPORT="1"
2000             elif test "x-$x11_hidd_vidmode" = "x-yes" ; then
2001                 dnl they explicitly asked for it, but we can't do it
2002                 AC_MSG_ERROR([X11 vidmode extension not available, cannot enable it as requested])
2003             else
2004                 dnl otherwise just disable it
2005                 DO_VIDMODE_SUPPORT="0"
2006             fi
2007         fi
2009         aros_host_x11_includes=$x_includes 
2010         aros_host_x11_libdirs=$x_libraries
2011     fi
2014     dnl sdl hidd
2015     AC_ARG_ENABLE(sdl_hidd, AC_HELP_STRING([--enable-sdl-hidd],
2016                                            [build SDL hidd for hosted (default=auto)]),
2017                                            sdl_hidd="$enableval",
2018                                            sdl_hidd="auto")
2019     case "x-$sdl_hidd" in
2020         x-yes|x-no|x-auto)                 ;;
2021         *)                 sdl_hidd="auto" ;;
2022     esac
2024     dnl they want it
2025     if test "x-$sdl_hidd" != "x-no" ; then
2027         dnl find sdl
2028         AM_PATH_SDL([1.2.10], have_sdl="yes", have_sdl="no")
2030         if test "x-$have_sdl" != "x-yes" ; then
2032             dnl didn't find it
2033             if test "x-$sdl_hidd" != "x-auto" ; then
2034                 dnl and they explicitly asked for it, bail out
2035                 AC_MSG_ERROR([SDL libs/headers not found, cannot build SDL hidd as requested])
2036             fi
2038         else
2039             dnl found it, set up the metatarget
2040             sdl_hidd_target=kernel-hidd-sdl
2041             aros_host_sdl_cflags=SDL_CFLAGS
2042             aros_host_sdl_libs=SDL_LIBS
2043         fi
2044     fi
2046     dnl oss.library
2047     AC_CHECK_HEADER(sys/soundcard.h)
2048     if test "x-$ac_cv_header_sys_soundcard_h" = "x-yes" ; then
2049         oss_library_target=workbench-libs-oss-unix
2050     fi
2054 dnl See if the user wants dbus.library
2055 AC_MSG_CHECKING([if building of dbus.library is enabled])
2056 AC_ARG_ENABLE(dbus,AC_HELP_STRING([--enable-dbus],[Enable DBUS support via dbus.library (default=no)]),dbus="yes",dbus="no")
2057 if test "$dbus" = "yes" ; then
2058     ENABLE_DBUS=1
2059     DBUS_CFLAGS=`pkg-config --cflags dbus-1`
2060     DBUS_LIBFLAGS=`pkg-config --libs dbus-1`
2061     KERNEL_DBUS_KOBJ=kernel-dbus-kobj
2062     KERNEL_DBUS_INCLUDES=kernel-dbus-includes
2063 else
2064     ENABLE_DBUS=0
2066 AC_MSG_RESULT($dbus)
2069 dnl --------------------------------------------------------------------
2070 dnl Configuration Output Section
2071 dnl --------------------------------------------------------------------
2073 # Generic
2074 AC_SUBST(aros_arch)
2075 AC_SUBST(aros_cpu)
2076 AC_SUBST(aros_flavour)
2077 AC_SUBST(aros_flavour_uc)
2078 AC_SUBST(AROS_BUILDDIR)
2079 AC_SUBST(AROS_BUILDDIR_UNIX)
2080 AC_SUBST(SRCDIR)
2081 AC_SUBST(AROS_PORTSSRCDIR)
2083 # Host related
2084 AC_SUBST(aros_cc_pre)
2085 AC_SUBST(aros_host_strip)
2086 AC_SUBST(aros_host_arch)
2087 AC_SUBST(aros_host_cpu)
2088 AC_SUBST(aros_host_cc)
2089 AC_SUBST(aros_host_ar)
2090 AC_SUBST(aros_host_ranlib)
2091 AC_SUBST(aros_host_ld)
2092 AC_SUBST(aros_host_make)
2093 AC_SUBST(aros_host_cflags)
2094 AC_SUBST(gnu89_inline)
2095 AC_SUBST(aros_host_ldflags)
2096 AC_SUBST(aros_host_debug)
2097 AC_SUBST(aros_host_mkdep)
2098 AC_SUBST(aros_host_mkargs)
2099 AC_SUBST(aros_host_exe_suffix)
2100 AC_SUBST(aros_host_lib_suffix)
2101 AC_SUBST(aros_tools_dir)
2102 AC_SUBST(aros_host_aclocal)
2103 AC_SUBST(aros_host_autoconf)
2104 AC_SUBST(aros_host_autoheader)
2105 AC_SUBST(aros_host_automake)
2107 # Target Related
2108 AC_SUBST(aros_target_guitheme)
2109 AC_SUBST(aros_target_iconset)
2110 AC_SUBST(aros_target_bootloader)
2111 AC_SUBST(aros_target_arch)
2112 AC_SUBST(aros_target_family)
2113 AC_SUBST(aros_target_cpu)
2114 AC_SUBST(aros_target_variant)
2115 AC_SUBST(aros_target_suffix)
2116 AC_SUBST(aros_target_incl)
2117 AC_SUBST(aros_target_ar)
2118 AC_SUBST(aros_target_ranlib)
2119 AC_SUBST(aros_kernel_nm)
2120 AC_SUBST(orig_target_cc)
2121 AC_SUBST(aros_target_cc)
2122 AC_SUBST(aros_target_cxx)
2123 AC_SUBST(aros_kernel_cc)
2124 AC_SUBST(aros_target_as)
2125 AC_SUBST(orig_target_ld)
2126 AC_SUBST(aros_target_ld)
2127 AC_SUBST(aros_kernel_ld)
2128 AC_SUBST(aros_target_cc_includes)
2129 AC_SUBST(aros_target_cc_path)
2130 AC_SUBST(aros_target_objdump)
2131 AC_SUBST(aros_target_objcopy)
2132 AC_SUBST(aros_target_strip)
2133 AC_SUBST(aros_target_nm)
2134 AC_SUBST(aros_kernel_rescomp)
2135 AC_SUBST(aros_shared_default)
2136 AC_SUBST(aros_shared_ld)
2137 AC_SUBST(aros_object_format)
2138 AC_SUBST(aros_compiler_libs)
2139 AC_SUBST(aros_arch_libs)
2141 AC_SUBST(aros_config_cflags)
2142 AC_SUBST(aros_config_aflags)
2143 AC_SUBST(aros_config_ldflags)
2145 AC_SUBST(aros_shared_cflags)
2146 AC_SUBST(aros_shared_aflags)
2147 AC_SUBST(aros_shared_ldflags)
2148 AC_SUBST(aros_kernel_cflags)
2149 AC_SUBST(aros_kernel_includes)
2150 AC_SUBST(aros_kernel_objcflags)
2151 AC_SUBST(aros_kernel_ldflags)
2152 AC_SUBST(aros_target_cflags)
2153 AC_SUBST(aros_debug_cflags)
2154 AC_SUBST(aros_debug_aflags)
2155 AC_SUBST(aros_debug_ldflags)
2156 AC_SUBST(aros_paranoia_cflags)
2157 AC_SUBST(aros_target_genmap)
2158 AC_SUBST(aros_target_strip_flags)
2160 AC_SUBST(crosstools_target)
2162 # Graphics Related
2163 AC_SUBST(x11_hidd_target)
2164 AC_SUBST(sdl_hidd_target)
2165 AC_SUBST(pci_hidd_target)
2166 AC_SUBST(oss_library_target)
2168 AC_SUBST(aros_default_wbwidth)
2169 AC_SUBST(aros_default_wbheight)
2170 AC_SUBST(aros_default_wbdepth)
2171 AC_SUBST(DO_XSHM_SUPPORT)
2172 AC_SUBST(DO_VIDMODE_SUPPORT)
2174 AC_SUBST(aros_host_x11_includes)
2175 AC_SUBST(aros_host_x11_libdirs)
2176 AC_SUBST(aros_host_sdl_cflags)
2177 AC_SUBST(aros_host_sdl_libs)
2179 # Native version related
2180 AC_SUBST(aros_serial_debug)
2182 # Palm native version related
2183 AC_SUBST(aros_palm_debug_hack)
2185 # Unix/Hosted version related
2186 AC_SUBST(aros_nesting_supervisor)
2188 # MMU related
2189 AC_SUBST(aros_enable_mmu)
2191 # Apple iOS related
2192 AC_SUBST(aros_ios_platform)
2193 AC_SUBST(aros_ios_version)
2194 AC_SUBST(aros_ios_sdk)
2196 # Android related
2197 AC_SUBST(android_tool)
2198 AC_SUBST(aros_android_level)
2200 # DBUS related
2201 AC_SUBST(ENABLE_DBUS)
2202 AC_SUBST(DBUS_CFLAGS)
2203 AC_SUBST(DBUS_LIBFLAGS)
2204 AC_SUBST(KERNEL_DBUS_KOBJ)
2205 AC_SUBST(KERNEL_DBUS_INCLUDES)
2207 #X11 related
2208 AC_SUBST(ENABLE_X11)
2210 # Debug related
2211 AC_SUBST(aros_debug)
2212 AC_SUBST(aros_mungwall_debug)
2213 AC_SUBST(aros_stack_debug)
2214 AC_SUBST(aros_modules_debug)
2216 # Collect-aros stuff: "-ius" to ignore undefined symbols
2217 AC_SUBST(ignore_undefined_symbols)
2219 # C compiler related
2220 AC_SUBST(gcc_target_cpu)
2222 dnl Prepare for output, make up all the generated patches
2223 case "$aros_flavour" in
2224 emulation)      aros_flavour_uc="AROS_FLAVOUR_EMULATION"
2225                 aros_flavour="emulation" ;;
2226 emulcompat)     aros_flavour_uc="(AROS_FLAVOUR_EMULATION|AROS_FLAVOUR_BINCOMPAT)"
2227                 aros_flavour="emulation" ;;
2228 standalone)     aros_flavour_uc="AROS_FLAVOUR_STANDALONE"
2229                 aros_flavour="standalone";;
2230 standcompat)    aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_BINCOMPAT)"
2231                 aros_flavour="standalone";;
2232 native)         aros_flavour_uc="AROS_FLAVOUR_NATIVE"
2233                 aros_flavour="native" ;;
2234 nativecompat)   aros_flavour_uc="(AROS_FLAVOUR_NATIVE|AROS_FLAVOUR_BINCOMPAT)"
2235                 aros_flavour="native" ;;
2236 linklib)        aros_flavour_uc="AROS_FLAVOUR_LINKLIB"
2237                 aros_flavour="linklib" ;;
2238 palmnative)     aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
2239                 aros_flavour="palmnative" ;;
2240 mac68knative)   aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
2241                 aros_flavour="mac68knative" ;;
2242 ppcnative)      aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_BINCOMPAT)"
2243                 aros_flavour="ppcnative" ;;
2244 esac
2246 if test ! -d ${aros_inc_dir} ; then
2247     ${MKDIR} ${aros_inc_dir}
2249 if test ! -d ${aros_geninc_dir} ; then
2250     ${MKDIR} ${aros_geninc_dir}
2252 if test ! -d ${aros_hostcfg_dir} ; then
2253     ${MKDIR} ${aros_hostcfg_dir}
2255 if test ! -d ${aros_targetcfg_dir} ; then
2256     ${MKDIR} ${aros_targetcfg_dir}
2258 if test ! -d ${aros_tools_dir} ; then
2259     ${MKDIR} ${aros_tools_dir}
2261 if test ! -d ${aros_scripts_dir} ; then
2262     ${MKDIR} ${aros_scripts_dir}
2265 AC_CONFIG_HEADERS(${aros_geninc_dir}/host-conf.h:config/host-conf.h.in)
2267 AC_CONFIG_COMMANDS([compiler_executable],
2268     [
2269         prefix=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}
2270         mkdir -p $prefix
2271         prefix="${prefix}/${aros_target_cpu}-aros"
2272         prefix2=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros
2274         echo ${prefix}
2275         echo ${prefix2}
2276         chmod a+x ${prefix2}-gcc ${prefix2}-ld
2278         ln -sf ${prefix2}-gcc          ${prefix}-gcc
2279         ln -sf ${prefix2}-ld           ${prefix}-ld
2281         ln -sf $aros_target_as_ln$aros_host_exe_suffix      ${prefix}-as
2282         ln -sf $aros_target_nm_ln$aros_host_exe_suffix      ${prefix}-nm
2283         ln -sf $aros_target_ar_ln$aros_host_exe_suffix      ${prefix}-ar
2284         ln -sf $aros_target_ranlib_ln$aros_host_exe_suffix  ${prefix}-ranlib
2285         ln -sf $aros_target_objcopy_ln$aros_host_exe_suffix ${prefix}-objcopy
2286         ln -sf $aros_target_objdump_ln$aros_host_exe_suffix ${prefix}-objdump
2287         ln -sf $aros_target_strip_ln$aros_host_exe_suffix   ${prefix}-strip
2289         ln -sf $aros_target_as_ln$aros_host_exe_suffix      ${prefix2}-as
2290         ln -sf $aros_target_nm_ln$aros_host_exe_suffix      ${prefix2}-nm
2291         ln -sf $aros_target_ar_ln$aros_host_exe_suffix      ${prefix2}-ar
2292         ln -sf $aros_target_ranlib_ln$aros_host_exe_suffix  ${prefix2}-ranlib
2293         ln -sf $aros_target_objcopy_ln$aros_host_exe_suffix ${prefix2}-objcopy
2294         ln -sf $aros_target_objdump_ln$aros_host_exe_suffix ${prefix2}-objdump
2295         ln -sf $aros_target_strip_ln$aros_host_exe_suffix   ${prefix2}-strip
2296     ],
2297     [
2298         aros_host_exe_suffix=${aros_host_exe_suffix}
2299         aros_tools_dir=${aros_tools_dir}
2300         aros_target_cpu=${aros_target_cpu}
2301         aros_target_arch=${aros_target_arch}
2302         aros_target_suffix=${aros_target_suffix}
2303         aros_target_nm_ln=${aros_target_nm_ln}
2304         aros_target_as_ln=${aros_target_as_ln}
2305         aros_target_ar_ln=${aros_target_ar_ln}
2306         aros_target_ranlib_ln=${aros_target_ranlib_ln}
2307         aros_target_objdump_ln=${aros_target_objdump_ln}
2308         aros_target_objcopy_ln=${aros_target_objcopy_ln}
2309         aros_target_strip_ln=${aros_target_strip_ln}
2310     ]
2312 AC_CONFIG_COMMANDS([genshared_executable],
2313     [chmod a+x ${aros_scripts_dir}/genshared],
2314     [aros_scripts_dir=${aros_scripts_dir}]
2316 AC_CONFIG_COMMANDS([genmf_executable],
2317     [chmod a+x ${aros_tools_dir}/genmf.py],
2318     [aros_tools_dir=${aros_tools_dir}]
2321 AC_CONFIG_FILES(
2322     Makefile
2323     config/make.cfg
2324     ${aros_inc_dir}/config.h:config/config.h.in
2325     ${aros_geninc_dir}/config.h:config/config.h.in
2326     ${aros_hostcfg_dir}/host.cfg:config/host.cfg.in
2327     ${aros_targetcfg_dir}/target.cfg:config/target.cfg.in
2328     mmake.config
2329     ${aros_targetcfg_dir}/make.defaults:config/make.defaults.in
2330     ${aros_targetcfg_dir}/specs:config/specs.in
2331     ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-gcc:scripts/aros-gcc.in
2332     ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-ld:scripts/aros-ld.in
2333     ${aros_scripts_dir}/genshared:compiler/library_template_c/source/lib_source/genshared.in
2334     ${aros_tools_dir}/genmf.py:tools/genmf/genmf.py
2335     tools/collect-aros/env.h
2336     ${aros_gendir}/arch/all-android/bootstrap/app/default.properties:arch/all-android/bootstrap/app/default.properties.in
2339 AC_OUTPUT
2341 dnl This is in order to not define SHARED_CFLAGS sometimes
2342 dnl We don't always do aros_shared_ar, aros_shared_cflags
2344 #XXX compatability...
2345 aros_shared_ar="$aros_shared_ld $aros_shared_ldflags -o"
2347 if test -n "$aros_shared_cflags" ; then
2348     echo "SHARED_CFLAGS := $aros_shared_cflags" >> ${aros_hostcfg_dir}/host.cfg
2349     echo "SHARED_AR := $aros_shared_ar" >> ${aros_hostcfg_dir}/host.cfg