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