Minor indentation white space fixes.
[AROS.git] / configure.in
blob043778d15dcdf66849b0be491c29c1062fba07d3
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 # Override this to "default" in order to force a specific build to use real AROS crosscompiler
130 # instead of a wrapper script.
131 # Useful for non-ELF hosts (like Windows and Darwin).
132 use_aros_gcc="no"
134 # This is the main host configuration section. It is where the host
135 # can change the values of any variables it needs to change. We do
136 # not look at anything that compiles to the target yet, we'll get
137 # to that later.
139 case "$host_os" in
140     aros*)
141         aros_host_arch="aros"
142         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
143         case "$host_cpu" in
144             *i?86*)
145                 aros_host_cpu="i386"
146                 ;;
147             *x86_64*)
148                 aros_host_cpu="x86_64"
149                 ;;
150             *powerpc*)
151                 aros_host_cpu="ppc"
152                 ;;
153             *)
154                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
155                 aros_host_cpu="$host_cpu"
156                 ;;
157         esac
158         ;;
160     linux*)
161         aros_host_arch="linux"
162         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
163         case "$host_cpu" in
164             *i?86*)
165                 aros_host_cpu="i386"
166                 ;;
167             *x86_64*)
168                 aros_host_cpu="x86_64"
169                 ;;
170             *m68k*)
171                 aros_host_cpu="m68k"
172                 ;;
173             *powerpc*)
174                 aros_host_cpu="ppc"
175                 ;;
176             *arm*)
177                 aros_host_cpu="arm"
178                 ;;
179             *)
180                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
181                 aros_host_cpu="$host_cpu"
182                 ;;
183         esac
184         ;;
186     freebsd*)
187         aros_host_cc="$aros_host_cc $aros_host_cc_pipe -I/usr/local/include"
188         aros_host_make="gmake"
189         aros_host_arch="freebsd"
190         aros_host_cpu="i386"
192         aros_host_ldflags="$aros_host_ldflags -L/usr/local/lib -liconv"
194         dnl FreeBSD 5.x (and later) has changed the default object format.
195         dnl The double [[]] is necessary to get around m4's quoting rules.
196         case $host_os in
197             freebsd[[234]]*)
198                 aros_object_format="elf_i386"
199                 ;;
201             *)
202                 aros_object_format="elf_i386_fbsd"
203                 ;;
204         esac
206         ;;
208     darwin*)
209         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
210         aros_host_arch="darwin"
211         use_aros_gcc="yes"
212         android_build_os="darwin-x86"
213         android_tool="android"
214         default_android_sdk="/android-sdk-mac_x86"
215         default_android_ndk="/android-ndk-r5b"
216         case "$host_cpu" in
217             *i?86*)
218                 aros_host_cpu="i386"
219                 ;;
220             *x86_64*)
221                 aros_host_cpu="x86_64"
222                 ;;
223             *powerpc*)
224                 aros_host_cpu="ppc"
225                 ;;
226             *)
227                 AC_MSG_WARN("Unknown CPU for Darwin host -- $host_cpu")
228                 aros_host_cpu="$host_cpu"
229                 ;;
230         esac
232         aros_host_ldflags="$aros_host_ldflags -liconv"
234         ;;
236     dragonfly*)
237         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
238         aros_host_make="gmake"
239         aros_host_arch="dragonfly"
240         case $host_cpu in
241             *i?86*)
242                 aros_host_cpu="i386"
243                 ;;
244             *amd64*)
245                 aros_host_cpu="x86_64"
246                 ;;
247             *)
248                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
249                 aros_host_cpu="$host_cpu"
250                 ;;
251         esac
252         ;;
254     netbsd*)
255         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
256         aros_host_make="gmake"
257         aros_host_arch="netbsd"
258         case "$host_cpu" in
259             *i?86*)
260                 aros_host_cpu="i386"
261                 ;;
262             *m68k*)
263                 aros_host_cpu="m68k"
264                 ;;
265             *)
266                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
267                 aros_host_cpu="$host_cpu"
268                 ;;
269         esac    
270         aros_host_lib_suffix=".0.0"
271         ;;
273     openbsd*)
274         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
275         aros_host_make="gmake"
276         aros_host_arch="openbsd"
277         case "$host_cpu" in
278             *i?86*)
279                 aros_host_cpu="i386"
280                 ;;
281             *)
282                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
283                 aros_host_cpu="$host_cpu"
284                 ;;
285         esac
286         ;;
287         
288     solaris*)
289         aros_host_arch="solaris"
290         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
291         case "$host_cpu" in
292             *i?86*)
293                 aros_host_cpu="i386"
294                 ;;
295             *sparc*)
296                 aros_host_cpu="sparc"
297                 ;;
298             *)
299                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
300                 aros_host_cpu="$host_cpu"
301                 ;;
302         esac
303         ;;
305     morphos*)
306         aros_host_arch="morphos"
307         aros_host_cpu="ppc"
308         ;;
310     amiga*)
311         aros_host_arch="amiga"
312         SORT="/gg/bin/sort"
313         TEST="/gg/bin/test"
314         UNIQ="/gg/bin/uniq"
315         FOR="for"
316         TOUCH="/gg/bin/touch"
317         case "$host_cpu" in
318             *m68k*)
319                 aros_host_cpu="m68k"
320                 ;;
321             *powerpc*)
322                 aros_host_cpu="ppc"
323                 ;;
324             *)
325                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
326                 aros_host_cpu="$host_cpu"
327                 ;;
328         esac
329         ;;
331     cygwin*)
332         aros_host_arch="cygwin"
333         use_aros_gcc="yes"
334         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
335         android_build_os="windows"
336         android_tool="android.bat"
337         default_android_sdk="/cygdrive/c/android-sdk-windows-1.6_r1"
339         case "$host_cpu" in
340             *i?86*)
341                 aros_host_cpu="i386"
342                 ;;
343             *)
344                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
345                 aros_host_cpu="$host_cpu"
346                 ;;
347         esac
348         ;;
350     mingw32*)
351         aros_host_arch="mingw32"
352         use_aros_gcc="yes"
353         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
354         android_build_os="windows"
355         android_tool="android.bat"
356         default_android_sdk="/c/android-sdk-windows-1.6_r1"
358         case "$host_cpu" in
359             *i?86*)
360                 aros_host_cpu="i386"
361                 ;;
362             *)
363                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
364                 aros_host_cpu="$host_cpu"
365                 ;;
366         esac
367         ;;
368     *)
369         AC_MSG_ERROR([Unsupported host architecture $host])
370         ;;
371 esac
373 AROS_PROG(aros_host_ar,[ar],[cr])
374 AROS_REQUIRED(ar,$aros_host_ar)
375 AROS_PROG(aros_host_ranlib,ranlib)
376 AROS_REQUIRED(ranlib,$aros_host_ranlib)
377 AROS_PROG(aros_host_strip,strip)
378 AROS_REQUIRED(strip,$aros_host_strip)
380 AROS_PROG(RM,[rm],[-rf])
381 AROS_REQUIRED(rm,$RM)
382 AROS_PROG(CP,[cp])
383 AROS_REQUIRED(cp,$CP)
384 AROS_PROG(MV,[mv])
385 AROS_REQUIRED(mv,$MV)
386 AROS_PROG(ECHO,[echo])
387 AROS_REQUIRED(echo,$ECHO)
388 AROS_PROG(MKDIR,[mkdir],[-p])
389 AROS_REQUIRED(mkdir,$MKDIR)
390 AROS_PROG(TOUCH,[touch])
391 AROS_REQUIRED(touch,$TOUCH)
392 AROS_PROG(SORT,[sort])
393 AROS_REQUIRED(sort,$SORT)
394 AROS_PROG(UNIQ,[uniq])
395 AROS_REQUIRED(uniq,$UNIQ)
396 AROS_PROG(NOP,[true])
397 AROS_REQUIRED(true,$NOP)
398 AROS_PROG(CAT,[cat])
399 AROS_REQUIRED(cat,$CAT)
400 AROS_PROG(BISON,[bison])
401 AROS_REQUIRED(bison,$BISON)
402 AROS_PROG(FLEX,[flex])
403 AROS_REQUIRED(flex,$FLEX)
404 AROS_PROG(PNGTOPNM,[pngtopnm])
405 AROS_REQUIRED(pngtopnm,$PNGTOPNM)
406 AROS_PROG(PPMTOILBM,[ppmtoilbm])
407 AROS_REQUIRED(ppmtoilbm,$PPMTOILBM)
408 AROS_PROG(SED,[sed])
409 AROS_REQUIRED(sed,$SED)
410 AROS_PROG(CHMOD,[chmod])
411 AROS_REQUIRED(chmod,$CHMOD)
412 AROS_PROG(PATCH,[patch])
413 AROS_REQUIRED(patch,$PATCH)
415 AM_PATH_PYTHON(2.5)
417 AC_SUBST(FOR, for)
418 AC_SUBST(IF, if)
419 AC_SUBST(TEST, test)
420 AC_SUBST(CMP, cmp)
422 dnl ---------------------------------------------------------------------------
423 dnl Look for things about the host system, good for hosted targets.
424 dnl ---------------------------------------------------------------------------
426 # Check for some includes for the X11 HIDD and the kernel
427 AC_CHECK_HEADERS([sys/ipc.h sys/shm.h \
428     sys/mmap.h sys/mman.h sysexits.h \
429     sys/statfs.h sys/statvfs.h sys/vfs.h sys/param.h \
432 AC_CHECK_HEADERS([sys/mount.h],,,[#include <sys/param.h>])
434 AC_HEADER_DIRENT
435 AC_HEADER_STAT
436 AC_HEADER_STDC
437 AC_HEADER_SYS_WAIT
438 AC_HEADER_TIME
439 AC_STRUCT_ST_BLKSIZE
440 AC_STRUCT_ST_BLOCKS
441 AC_STRUCT_ST_RDEV
442 AC_STRUCT_TM
443 AC_STRUCT_TIMEZONE
444 AC_TYPE_OFF_T
445 AC_TYPE_PID_T
446 AC_TYPE_SIZE_T
447 AC_TYPE_UID_T
449 AC_CHECK_MEMBERS(struct tm.tm_gmtoff)
451 # Look for some functions
452 AC_CHECK_FUNCS([getpagesize kqueue statfs statvfs \
453     clone kse_create rfork_thread thr_create sa_register \
454     getcontext makecontext setcontext sigaltstack swapcontext])
456 AC_FUNC_MMAP
459 dnl --------------------------------------------------------------------
460 dnl Target Configuration Section
461 dnl --------------------------------------------------------------------
463 dnl The target configuration section is responsible for setting up all
464 dnl the paths for includes, and tools required to build AROS to some
465 dnl particular target.
467 aros_config_cflags="-Wall -Werror-implicit-function-declaration"
468 aros_config_aflags="-Wall -x assembler-with-cpp -c"
469 aros_config_ldflags=""
471 aros_shared_default=yes
473 aros_shared_cflags="-fPIC"
474 aros_shared_aflags=""
475 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
476 aros_kernel_ldflags="-Wl,-rpath,./lib"
478 aros_target_ar_flags="cr"
479 aros_target_nm_flags="-C -ul"
480 aros_target_strip_flags="--strip-unneeded -R.comment"
482 aros_compiler_libs=
483 aros_arch_libs=
485 aros_target_genmap="-Wl,-Map -Xlinker"
487 # Native flavour stuff
488 aros_serial_debug="0"
490 # Palm native flavour stuff
491 aros_palm_debug_hack="0"
493 # Unix flavour stuff
494 aros_nesting_supervisor="0"
496 # Collect-aros stuff: "-ius" to ignore undefined symbols
497 ignore_undefined_symbols=""
499 # Check for X11 by default
500 need_x11="auto"
502 #-----------------------------------------------------------------------------
505 # GCC 4.1+ has a stack protection feature that requires OS support. Ubuntu has
506 # it switched on by default, and we use the host compiler, so it compiles AROS
507 # code with this enabled resulting in link failures as we don't have support
508 # for it.
510 # We use two methods to disable it. For the host compiler (used to compile
511 # some hosted modules), we test to see if the compiler supports stack
512 # protection, and if it does we disable it in AROS_CONFIG_CFLAGS. This should
513 # work on all platforms.
515 # For the "cross" compiler we clear the "ssp_default" spec in config/specs.in
516 # (this is done unconditionally, as it should have no effect on compilers
517 # without the stack protection feature). This may be specific to the way that
518 # Ubuntu enables the feature, so may not work everywhere. My specs-fu isn't
519 # strong enough to disable it in a generic way though, so we'll live with it
520 # until another vendor ships GCC with it enabled in a different way, and deal
521 # with it then.
524 AC_MSG_CHECKING([whether ${CC} accepts -fno-stack-protector])
525 save_cflags="$CFLAGS"
526 CFLAGS="$CFLAGS -fno-stack-protector"
527 AC_TRY_COMPILE(,, use_no_stack_protector="yes", use_no_stack_protector="no")
528 AC_MSG_RESULT($use_no_stack_protector)
529 if test "x-$use_no_stack_protector" = "x-yes" ; then
530     aros_host_cflags="$aros_host_cflags -fno-stack-protector"
532 CFLAGS="$save_cflags"
534 #-----------------------------------------------------------------------------
536 # Disable pointer-signedness warnings if the compiler recognises the option
537 # (this only works for the host compiler at the moment)
539 AC_MSG_CHECKING([whether ${CC} accepts -Wno-pointer-sign])
540 save_cflags="$CFLAGS"
541 CFLAGS="$CFLAGS -Wno-pointer-sign"
542 AC_TRY_COMPILE(,, use_no_sign_warning="yes", use_no_sign_warning="no")
543 AC_MSG_RESULT($use_no_sign_warning)
544 if test "x-$use_no_sign_warning" = "x-yes" ; then
545     aros_host_cflags="$aros_host_cflags -Wno-pointer-sign"
547 CFLAGS="$save_cflags"
549 #-----------------------------------------------------------------------------
551 # Check if host compiler supports -fgnu89-inline, can be needed for crosstools.
553 AC_MSG_CHECKING([whether ${CC} accepts -fgnu89-inline])
554 save_cflags="$CFLAGS"
555 CFLAGS="$CFLAGS -fgnu89-inline"
556 AC_TRY_COMPILE(,, use_gnu89_inline="yes", use_gnu89_inline="no")
557 AC_MSG_RESULT($use_gnu89_inline)
558 if test "x-$use_gnu89_inline" = "x-yes" ; then
559     gnu89_inline="-fgnu89-inline"
561 CFLAGS="$save_cflags"
563 #-----------------------------------------------------------------------------
565 AC_MSG_CHECKING([for type of build])
566 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")
568 if test "$build_type" = "nightly"; then
569     build_type_string="NIGHTLY"
570 elif test "$build_type" = "snapshot"; then
571     build_type_string="SNAPSHOT"
572 elif test "$build_type" = "milestone"; then
573     build_type_string="MILESTONE"
574 elif test "$build_type" = "release"; then
575     build_type_string="RELEASE"
576 else
577     build_type_string="PERSONAL"
578     build_type="personal"
581 aros_config_cflags="$aros_config_cflags -DAROS_BUILD_TYPE=AROS_BUILD_TYPE_$build_type_string"
583 AC_MSG_RESULT($build_type)
585 #-----------------------------------------------------------------------------
586 all_debug_types="messages stack modules mungwall symbols"
588 AC_MSG_CHECKING([which debug types to enable])
589 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)]),
590  debug="$enableval",debug="")
592 if test "$debug" = "" -o "$debug" = "no"; then
593     debug="none"
594 elif test "$debug" = "yes"; then
595     debug="all"
598 if test "$debug" = "all" ; then
599     debug="messages stack modules symbols"
600     for d in $all_debug_types; do
601         export aros_${d}_debug="1"
602     done
603 else
604     for d in $all_debug_types; do
605         export aros_${d}_debug="0"
606     done
609 if test "$debug" != "none"; then
610     debug=`echo $debug | sed s/,/\ /g`
611     for d in $debug; do
612         found="0"
613         for d2 in $all_debug_types; do
614             if test "$d2" = "$d"; then
615                 found="1"
616                 break
617             fi
618         done
619         if test "$found" = "0"; then
620             AC_MSG_ERROR([unrecognized debug type "$d". Available types are: all none $all_debug_types])
621         fi
622         export aros_${d}_debug="1"
623     done
624     aros_debug="yes"
626 AC_MSG_RESULT($debug)
628 if test "$aros_messages_debug" = "1"; then
629     aros_messages_debug="-DADEBUG=1 -DMDEBUG=1"
630 else
631     aros_messages_debug=""
633 if test "$aros_symbols_debug" = "1"; then
634     aros_symbols_debug="-g"
635 else
636     aros_symbols_debug=""
639 # These are the flags to pass when compiling debugged programs
640 aros_debug_cflags="$aros_symbols_debug $aros_messages_debug"
641 aros_debug_aflags=""
642 aros_debug_ldflags="$aros_symbols_debug"
644 aros_crosstools="no"
646 #-----------------------------------------------------------------------------
647 #   Checking if we should build crosstools..
648 AC_MSG_CHECKING([whether to build crosstools])
649 AC_ARG_ENABLE(crosstools,AC_HELP_STRING([--enable-crosstools],[Build cross-compiler toolchains if necessary (default=no).]),crosstools="$enableval",crosstools="no")
650 if test "$crosstools" != "" -a "$crosstools" != "no"; then
651     AC_MSG_RESULT(yes)
652         aros_crosstools="yes"
653 else
654     AC_MSG_RESULT(no)
657 #-----------------------------------------------------------------------------
658 #   Checking for distcc and ccache.
660 #   Always apply the transforms in this particular order. Basically you should
661 #   always run 'ccache distcc compiler' in that order for the best performance.
663 AC_MSG_CHECKING([whether to enable distcc])
664 AC_ARG_ENABLE(distcc,AC_HELP_STRING([--enable-distcc],[Use distcc as a front end to the compiler (default=no).]),distcc="$enableval",distcc="no")
665 if test "$distcc" != "" -a "$distcc" != "no"; then
666     # AC_CHECK_PROG will print out the result in this case
667     AC_PATH_PROG(DISTCC,[distcc],distcc,)
668 else
669     AC_MSG_RESULT(no)
672 AC_MSG_CHECKING([whether to enable ccache])
673 AC_ARG_ENABLE(ccache,AC_HELP_STRING([--enable-ccache],[Use ccache as a front end to the compiler (default=no).]),ccache="$enableval",ccache="no")
674 if test "$ccache" != "" -a "$ccache" != "no"; then
675     # AC_CHECK_PROG will print out the result in this case
676     AC_CHECK_PROG(CCACHE,[ccache],ccache,)
677 else
678     AC_MSG_RESULT(no)
681 #-----------------------------------------------------------------------------
682 AC_MSG_CHECKING([what specific host gcc version to use])
683 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")
684 AC_MSG_RESULT($target_tool_version)
686 #-----------------------------------------------------------------------------
687 AC_MSG_CHECKING([what optimization flags to use])
688 AC_ARG_WITH(optimization,AC_HELP_STRING([--with-optimization=FLAGS],[Use optimization flags FLAGS (default=-O2).]),optimization="$withval",optimization="unknown")
689 if test "$optimization" = "unknown"; then
690     dnl default is -O2 for normal builds, -O0 for debug builds
691     if test "$debug" != "none"; then
692         optimization="-O0"
693     else
694         optimization="-O2"
695     fi
697 aros_config_cflags="$aros_config_cflags $optimization"
698 AC_MSG_RESULT($optimization)
700 #-----------------------------------------------------------------------------
701 AC_MSG_CHECKING([what paranoia flags to use])
702 AC_ARG_WITH(paranoia,AC_HELP_STRING([--with-paranoia=FLAGS],[CC flags to enable paranoia]),[paranoia_flags="$withval"],[paranoia_flags="default"])
703 if test "$paranoia_flags" = "default"; then
704         paranoia_flags=""
705 else if test "$paranoia_flags" = "yes"; then
706         paranoia_flags="-Wall -Werror"
707 fi fi
708 AC_MSG_RESULT($paranoia_flags)
709 aros_paranoia_cflags="$paranoia_flags"
711 #-----------------------------------------------------------------------------
712 AC_MSG_CHECKING([what target variant to enable])
713 AC_ARG_ENABLE(target_variant,AC_HELP_STRING([--enable-target-variant=NAME],[Enable a specific target variant(default=none)]),target_variant=$enableval,target_variant="")
714 if test "$target_variant" = ""; then
715     aros_target_variant=""
716     aros_target_suffix=""
717     enableval="none"
718 else
719     aros_target_variant="$target_variant"
720     aros_target_suffix="-$target_variant"
722 AC_MSG_RESULT($enableval)
724 target_bootloader="none"
726 #-----------------------------------------------------------------------------
727 case "$aros_target_variant" in
728 ios)
729     AC_MSG_CHECKING([XCode path])
730     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")
731     AC_MSG_RESULT($aros_xcode_path)
733     AC_MSG_CHECKING([for minimum supported iOS version])
734     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")
735     AC_MSG_RESULT($aros_ios_version)
737     AC_MSG_CHECKING([what iOS SDK version to use])
738     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")
739     AC_MSG_RESULT($aros_ios_sdk)
741     ;;
743 "android")
744     AC_MSG_CHECKING([Android SDK path])
745     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)
746     AC_MSG_RESULT($aros_android_sdk)
748     AC_MSG_CHECKING([Android NDK path])
749     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")
750     AC_MSG_RESULT($aros_android_ndk)
752     AC_MSG_CHECKING([what Android version to use])
753     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")
754     AC_MSG_RESULT($aros_android_version)
756     export PATH="$aros_android_sdk/tools:$PATH"
757     AC_PATH_PROG(android_tool, $android_tool)
758     AROS_REQUIRED(android,$android_tool)
760     dnl MSYS bash can't run .bat files directly, then need to be started via cmd.exe
761     if test $host_os = "mingw32"; then
762         android_tool="cmd //c $android_tool"
763     fi
765     ;;
766 esac
768 #-----------------------------------------------------------------------------
769 # This is the target configuration switch.
770 case "$target_os" in
771     linux*)
772         aros_target_arch="linux"
773         aros_target_family="unix"
774         case "$target_cpu" in
775             *m68k*)
776                 aros_target_cpu="m68k"
777                 aros_object_format="m68kelf"
778                 aros_flavour="emulcompat"
779                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D__mc68000 -D__linux__"
780                 aros_shared_ldflags="-Wl,-T,\$(TOP)/config/linux/m68k/script.so"
781                 aros_kernel_ldflags="-Wl,-rpath,./lib,-T,\$(TOP)/config/linux/m68k/script.normal"
782                 gcc_target_cpu="mc68000"
783                 ;;
784             *i?86*)
785                 aros_target_cpu="i386"
786                 aros_object_format="elf_i386"
787                 aros_flavour="emulation"
788                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__linux__"
789                 aros_config_cflags="$aros_config_cflags -m32 -march=i486"
790                 aros_kernel_cflags="$aros_kernel_cflags -m32 -march=i486"
791                 aros_config_aflags="$aros_config_aflags -m32 -march=i486"
792                 aros_config_ldflags="-m32 -march=i486"
793                 aros_kernel_ldflags="-melf_i386"
794                 aros_default_wbdepth=8
795                 gcc_target_cpu="i386"
796                 pci_hidd_target="hidd-pci-linux"
797                 ;;
798             *x86_64*)
799                 aros_target_cpu="x86_64"
800                 aros_object_format="elf_x86_64"
801                 aros_flavour="emulation"
802                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64 -D__linux__"
803                 aros_config_cflags="$aros_config_cflags -mno-red-zone -fno-omit-frame-pointer"
804                 aros_default_wbdepth=8
805                 gcc_target_cpu="x86_64"
806                 pci_hidd_target="hidd-pci-linux"
807                 ;;
808             *powerpc*)
809                 aros_target_cpu="ppc"
810                 aros_object_format="elf32ppc"
811                 aros_flavour="emulation"
812                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc -D__linux__"
813                 aros_default_wbdepth=8
814                 gcc_target_cpu="ppc"
815                 ;;
816 # TODO
817 # Same as powerpc, but I need this for the nightly build to work again.
818 # Actually, the nightly should be made working with powerpc target.
819 # That just was too much work for the moment, another week or two.
820             *ppc*)
821                 aros_target_cpu="ppc"
822                 aros_object_format="elf32ppc"
823                 aros_flavour="emulation"
824                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc -D__linux__"
825                 aros_default_wbdepth=8
826                 gcc_target_cpu="ppc"
827                 ;;
828             *arm*)
829                 aros_target_cpu="arm"
830                 aros_object_format="armelf_linux_eabi"
831                 aros_flavour="emulation"
832                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm -D__linux__"
833                 gcc_target_cpu="arm"
834                 aros_config_cflags="$aros_config_cflags -marm -march=armv6 -mfpu=vfp -mfloat-abi=softfp -fno-asynchronous-unwind-tables -fno-exceptions -fno-strict-aliasing"
835                 aros_config_aflags="$aros_config_aflags -marm -march=armv6 -mfpu=vfp -mfloat-abi=softfp -fno-asynchronous-unwind-tables -fno-exceptions -fno-strict-aliasing"
836                 aros_arch_libs="-laeabi"
837                 ;;
838             *)
839                 AC_MSG_ERROR("Unknown CPU for Linux -- $target_cpu")
840                 ;;
841         esac
842         case "$aros_target_variant" in
843             android)
844                 case "$aros_android_version" in
845                 2.2)
846                     aros_android_level=android-8
847                     ;;
848                 *)
849                     aros_android_level=android-9
850                     ;;
851                 esac
852                 aros_default_wbwidth=320
853                 aros_default_wbheight=480
854                 dnl Android gcc and AROS gcc use different enums size, so we use AROS gcc
855                 aros_target_cc="arm-aros-gcc"
856                 aros_target_cxx="arm-aros-g++"
857                 aros_target_ld="arm-aros-ld"
858                 aros_target_as="arm-aros-as"
859                 aros_target_ar="arm-aros-ar"
860                 aros_target_ranlib="arm-aros-ranlib"
861                 aros_target_nm="arm-aros-nm"
862                 aros_target_strip="arm-aros-strip"
863                 aros_target_objcopy="arm-aros-objcopy"
864                 aros_target_objdump="arm-aros-objdump"
865                 if test "$aros_android_ndk" = ""; then
866                     aros_kernel_cflags="-mandroid"
867                     aros_kernel_ldflags="-mandroid"
868                     CFLAGS="-mandroid"
869                 else
870                     export PATH="$aros_android_ndk/toolchains/arm-linux-androideabi-$target_tool_version/prebuilt/$android_build_os/bin:$PATH"
871                     aros_android_ndk="$aros_android_ndk/platforms/$aros_android_level/arch-arm"
872                     aros_kernel_cflags="--sysroot $aros_android_ndk -mandroid"
873                     aros_kernel_ldflags="--sysroot $aros_android_ndk -mandroid"
874                     CFLAGS="$CFLAGS --sysroot $aros_android_ndk -mandroid"
875                     aros_kernel_includes="-isystem $aros_android_ndk/usr/include"
876                 fi
877                 need_x11=no
878                 target_tool_prefix="arm-linux-androideabi-"
879             ;;
880         esac
881     ;;
883     pc)
884         aros_target_arch="pc"
885         aros_shared_default="no"
886         target_bootloader="grub2"
887         case "$target_cpu" in
888             *i?86*)
889                 aros_target_cpu="i386"
891                 dnl If somebody hasn't already set the target object
892                 dnl format, then use this value. Mostly to support
893                 dnl FreeBSD cross-compilation.
894                 dnl TODO: Remove when we always use our compiler.
896                 if test "$aros_object_format" = "" ; then
897                     aros_object_format="elf_i386"
898                 fi
899                 aros_flavour="standalone"
900                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
901                 aros_config_cflags="$aros_config_cflags -m32 -march=i486"
902                 aros_kernel_cflags="$aros_kernel_cflags -m32 -march=i486"
903                 aros_config_aflags="$aros_config_aflags -m32 -march=i486"
904                 aros_config_ldflags="-m32 -march=i486"
905                 aros_kernel_ldflags="-melf_i386"
906                 aros_default_wbwidth=640
907                 aros_default_wbheight=480
908                 gcc_target_cpu="i386"
909                 ;;
910             *x86_64*)
911                 aros_target_cpu="x86_64"
912                 aros_serial_debug=1
913                 if test "$aros_object_format" = "" ; then
914                     aros_object_format="elf_x86_64"
915                 fi
916                 aros_flavour="standalone"
917                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
918                 aros_config_cflags="$aros_config_cflags -fno-asynchronous-unwind-tables -mno-red-zone -fno-omit-frame-pointer"
919                 aros_kernel_ldflags=""
920                 aros_default_wbwidth=640
921                 aros_default_wbheight=480
922                 gcc_target_cpu="x86_64"
923                 ;;
924             *)
925                 AC_MSG_ERROR("Unknown native CPU -- $target_cpu")
926                 ;;
927         esac
928         ;;
930     prep)
931         aros_target_arch="prep"
932         aros_shared_default="no"
933         aros_target_cpu="ppc"
934         aros_object_format="elf32ppc"
935         aros_flavour="ppcnative"
936         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
937         aros_kernel_ldflags=""
938         aros_default_wbwidth=640
939         aros_default_wbheight=480
940         gcc_target_cpu="ppc"
941         ;;
943     freebsd*)
944         aros_target_arch="freebsd"
945         aros_target_family="unix"
946         aros_target_cpu="i386"
947         aros_flavour="emulation"
948         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
949         gcc_target_cpu="i386"
951         aros_target_strip_flags="-x"
952         ;;
954     darwin*)
955         aros_target_arch="darwin"
956         aros_target_family="unix"
957         aros_flavour="emulation"
958         case "$target_cpu" in
959             *i?86*)
960                 aros_ios_platform="iPhoneSimulator"
961                 aros_target_cpu="i386"
962                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
963                 aros_kernel_ldflags=""
964                 aros_macosx_version="10.4"
965                 aros_default_wbdepth=8
966                 gcc_target_cpu="i386"
967                 aros_object_format="elf_i386"
968                 aros_target_strip_flags="-x"
969                 target_tool_prefix="i686-apple-darwin10-"
970                 target_tool_flags="-m32"
971                 ;;
972             *x86_64*)
973                 aros_target_cpu="x86_64"
974                 aros_object_format="elf_x86_64"
975                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
976                 aros_macosx_version="10.6"
977                 aros_config_cflags="$aros_config_cflags -fno-omit-frame-pointer"
978                 aros_kernel_cflags="-m64"
979                 aros_kernel_ldflags="-m64"
980                 aros_target_cflags="-mcmodel=large"
981                 aros_default_wbdepth=8
982                 gcc_target_cpu="x86_64"
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                 target_tool_prefix="arm-apple-darwin10-" 
1008                 export PATH="$aros_xcode_path/Platforms/$aros_ios_platform.platform/Developer/usr/bin:$PATH"
1009                 ;;
1010             *)
1011                 AC_MSG_ERROR("Unsupported target CPU for darwin hosted flavour -- $target_cpu")
1012                 ;;
1013         esac
1014         case "$aros_target_variant" in
1015             ios)
1016                 aros_default_wbwidth=320
1017                 aros_default_wbheight=480
1018                 aros_ios_sdk="$aros_xcode_path/Platforms/$aros_ios_platform.platform/Developer/SDKs/$aros_ios_platform$aros_ios_sdk.sdk"
1019                 target_tool_flags="$target_tool_flags --sysroot $aros_ios_sdk"
1020                 aros_kernel_includes="-isystem $aros_ios_sdk/usr/include"
1021                 need_x11=no
1022                 # This is here because it may depend on iOS or SDK version
1023                 aros_kernel_cflags="$aros_kernel_cflags -miphoneos-version-min=$aros_ios_version"
1024                 aros_kernel_ldflags="$aros_kernel_ldflags -miphoneos-version-min=$aros_ios_version"
1025                 aros_kernel_objcflags="-fobjc-abi-version=2 -fobjc-legacy-dispatch"
1026             ;;
1027             *)
1028                 aros_kernel_cflags="$aros_kernel_cflags -mmacosx-version-min=$aros_macosx_version"
1029                 aros_kernel_ldflags="$aros_kernel_ldflags -mmacosx-version-min=$aros_macosx_version"
1030             ;;
1031         esac
1032         ;;
1034     dragonfly*)
1035         aros_target_arch="dragonfly"
1036         aros_target_family="unix"
1037         aros_flavour="emulation"
1038         case "$target_cpu" in
1039             *i?86*)
1040                 aros_target_cpu="i386"
1041                 aros_object_format="elf_i386"
1042                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__DragonFly__"
1043                 ;;
1044             *x86_64*)
1045                 aros_config_cflags="$aros_config_cflags -fno-omit-frame-pointer"
1046                 aros_target_cpu="x86_64"
1047                 aros_object_format="elf_x86_64"
1048                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64 -D__DragonFly__"
1049                 ;;
1050             *)
1051                 AC_MSG_ERROR("Unknown CPU for DragonFly -- $target_cpu")
1052                 ;;
1053         esac
1054         ;;
1056     netbsd*)
1057         aros_target_arch="netbsd"
1058         aros_target_family="unix"
1059         case "$target_cpu" in
1060             *m68k*)
1061                 aros_target_cpu="m68k"
1062                 aros_object_format="m68kelf"
1063                 aros_flavour="emulcompat"
1064                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D__mc68000 -D__NetBSD__"
1065                 gcc_target_cpu="mc68000"
1066                 ;;
1067             *i?86*)
1068                 aros_target_cpu="i386"
1069                 aros_object_format="elf_i386"
1070                 aros_flavour="emulation"
1071                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__NetBSD__"
1072                 aros_default_wbdepth=8
1073                 gcc_target_cpu="i386"
1074                 ;;
1075             *)
1076                 AC_MSG_ERROR("Unknown CPU for NetBSD -- $target_cpu")
1077                 ;;
1078         esac
1079         aros_target_genmap="-Wl,-M -Xlinker >"
1080         aros_flavour="emulation"
1081         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1082         ;;   
1084     openbsd*)
1085         aros_target_arch="openbsd"
1086         aros_target_family="unix"
1087         case "$target_cpu" in
1088             *i?86*)
1089                 aros_target_cpu="i386"
1090                 aros_object_format="elf_i386"
1091                 aros_flavour="emulation"
1092                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__OpenBSD__"
1093                 gcc_target_cpu="i386"
1094                 ;;
1095             *)
1096                 AC_MSG_ERROR("Unknown CPU for OpenBSD -- $target_cpu")
1097                 ;;
1098         esac
1099         aros_target_genmap="-Wl,-M -Xlinker >"
1100         aros_target_nm_flags="-u"
1101         aros_flavour="emulation"
1102         ;;
1104     solaris*)
1105         aros_target_arch="solaris"
1106         aros_target_family="unix"
1107         case "$target_cpu" in
1108            *i?86*)
1109                aros_target_cpu="i386"
1110                aros_object_format="elf_i386"
1111                aros_flavour="emulation"
1112                aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__Solaris__"
1113                aros_default_wbdepth=8
1114                gcc_target_cpu="i386"
1115                ;;
1116             *sparc*)
1117                 aros_target_cpu="sparc"
1118                 aros_object_format="elf_sparc"
1119                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dsparc -D__Solaris__"
1120                 gcc_target_cpu="sparc"
1121                 ;;
1122             *)
1123                 AC_MSG_ERROR("Unknown CPU for Solaris -- $target_cpu")
1124                 ;;
1125         esac
1126         aros_config_cflags="$aros_config_cflags -D$aros_target_cpu"
1127         aros_flavour="emulation"
1128         ;;
1130     morphos*)
1131         aros_target_arch="morphos"
1132         aros_shared_default="no"
1133         aros_target_cpu="ppc"
1134         aros_object_format="elf_ppc"
1135         aros_flavour="nativecompat"
1136         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1137         gcc_target_cpu="ppc"
1138         ;;
1140     sam440)
1141         aros_target_arch="sam440"
1142         aros_shared_default="no"
1143         aros_target_cpu="ppc"
1144         aros_object_format="elf32ppc"
1145         aros_flavour="ppcnative"
1146         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1147         aros_kernel_ldflags=""
1148         aros_default_wbwidth=1024
1149         aros_default_wbheight=768
1150         aros_default_wbdepth=24
1151         aros_config_cflags="$aros_config_cflags -mcpu=440fp -mno-toc -fno-asynchronous-unwind-tables"
1152         gcc_target_cpu="powerpc"
1153         ;;
1155     efika)
1156         aros_target_arch="efika"
1157         aros_shared_default="no"
1158         aros_target_cpu="arm"
1159         aros_object_format="armelf_linux_eabi"
1160         aros_flavour="standalone"
1161         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
1162         aros_kernel_ldflags=""
1163         aros_default_wbwidth=1024
1164         aros_default_wbheight=600
1165         aros_arch_libs="-laeabi"
1166         aros_config_cflags="$aros_config_cflags -marm -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -fno-asynchronous-unwind-tables -fno-exceptions -fno-strict-aliasing"
1167         aros_config_aflags="$aros_config_aflags -marm -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -fno-asynchronous-unwind-tables -fno-exceptions -fno-strict-aliasing"
1168         ;;
1169         
1170     chrp)
1171     aros_target_arch="chrp"
1172     aros_shared_default="no"
1173     aros_target_cpu="ppc"
1174     aros_object_format="elf32ppc"
1175     aros_flavour="ppcnative"
1176     aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1177     aros_kernel_ldflags=""
1178     aros_default_wbwidth=640
1179     aros_default_wbheight=480
1180     aros_config_cflags="$aros_config_cflags -mno-toc -fno-asynchronous-unwind-tables"    
1181     gcc_target_cpu="powerpc"
1182         case "$aros_target_variant" in
1183             efika)
1184             aros_config_cflags="$aros_config_cflags -DBIG_ENDIAN_OHCI=1 -mcpu=603e"
1185             ;;
1186         esac
1187     ;;
1189     amiga*)
1190         aros_target_arch="amiga"
1191         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D_AMIGA -DAMIGA"
1192         aros_shared_default="no"
1194         case "$target_cpu" in
1195             *m68k*)
1196                 aros_enable_mmu=no
1197                 aros_target_cpu="m68k"
1198                 aros_object_format="m68kelf"
1199                 aros_flavour="standcompat"
1200                 gcc_target_cpu="m68000"
1201                 aros_config_cflags="$aros_config_cflags -fno-strict-aliasing -ffreestanding -fomit-frame-pointer -${gcc_target_cpu} -fbuiltin -Wno-volatile-register-var -DAROS_DOS_PACKETS"
1202                 aros_config_aflags="$aros_config_aflags -${gcc_target_cpu}"
1203                 aros_paranoia_cflags="$aros_paranoia_cflags -Wno-volatile-register-var"
1204                 aros_debug_cflags="$aros_debug_cflags -Wall -Wno-volatile-register-var"
1205                 target_tool_prefix="m68k-elf-"
1206                 # Needed to get the correct multilib
1207                 aros_config_ldflags="-${gcc_target_cpu}"
1208                 aros_shared_ldflags="-${gcc_target_cpu}"
1209                 aros_kernel_ldflags="-${gcc_target_cpu}"
1210                 aros_target_nostdlib_ldflags="-${gcc_target_cpu}"
1211                 aros_target_strip_flags="-R.comment --strip-debug"
1212                 aros_default_wbwidth=640
1213                 aros_default_wbheight=256
1214                 aros_default_wbdepth=2
1215                 ;;
1216             *ppc*)
1217                 aros_cpu="ppc"
1218                 aros_flavour="native"
1219                 gcc_target_cpu="ppc"
1220                 ;;
1221             *)
1222                 AC_MSG_ERROR("Unknown CPU for Amiga $target_cpu")
1223                 ;;
1224         esac
1225         ;;
1227     mingw*)
1228         aros_target_arch="mingw32"
1229         aros_shared_default="no"
1230         aros_flavour="emulation"
1231         aros_shared_cflags=""
1232         need_dlopen="no"
1233         rescomp="windres"
1234         case "$target_cpu" in
1235             *i?86*)
1236                 aros_target_cpu="i386"
1237                 aros_object_format="elf_i386"
1238                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1239                 aros_default_wbdepth=8
1240                 gcc_target_cpu="i386"
1241                 target_tool_prefix="i386-mingw32-"
1242                 ;;
1243             *x86_64*)
1244                 aros_target_cpu="x86_64"
1245                 aros_object_format="elf_x86_64"
1246                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
1247                 aros_config_cflags="$aros_config_cflags -fno-omit-frame-pointer"
1248                 aros_default_wbdepth=8
1249                 gcc_target_cpu="x86_64"
1250                 target_tool_prefix="x86_64-w64-mingw32-"
1251                 ;;
1252             *arm*)
1253                 aros_target_cpu="arm"
1254                 aros_object_format="armelf_linux_eabi"
1255                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
1256                 aros_arch_libs="-laeabi"
1257                 aros_default_wbdepth=8
1258                 gcc_target_cpu="arm"
1259                 target_tool_prefix="arm-mingw32ce-"
1260                 aros_default_wbwidth=160
1261                 aros_default_wbheight=160
1262                 ;;
1263             *)
1264                 AC_MSG_ERROR("Unknown CPU for Mingw32 -- $target_cpu")
1265                 ;;
1266         esac
1267         if test $host_os = "cygwin"; then
1268                 aros_kernel_cflags="-mno-cygwin"
1269         fi
1270     ;;
1271     pp*)
1272         aros_target_arch="pp"
1273         aros_shared_default="no"
1274         case "$target_cpu" in
1275             *m68k*)
1276                 aros_target_cpu="m68k"
1277                 aros_object_format="m68kelf"
1278                 aros_flavour="palmnative"
1279                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
1280                 aros_default_wbwidth=160
1281                 aros_default_wbheight=160
1282                 aros_default_wbdepth=1
1283                 aros_target_ar_flags="cru"
1284                 aros_compiler_libs="-lgcc1"
1285                 aros_shared_default=no
1286                 aros_shared_cflags="-fpic"
1287                 aros_shared_aflags=""
1288                 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
1289                 aros_kernel_ldflags="-Wl,-rpath,./lib"
1290                 aros_debug_cflags="-Wall -Werror-implicit-function-declaration $aros_symbols_debug  $aros_messages_debug -mc68000 -Wa,-mc68000"
1291                 aros_debug_aflags=""
1292                 aros_debug_ldflags="$aros_symbols_debug"
1293                 aros_mungwall_debug="0"
1294                 aros_modules_debug="0"
1295                 gcc_target_cpu="mc68000"
1296                 ignore_undefined_symbols="-ius"
1297                 ;;
1298            *)
1299                 AC_MSG_ERROR("Unknown CPU for PalmPilot -- $target_cpu")
1300                 ;;
1301         esac
1302         ;;
1304     mac*)
1305         aros_target_arch="mac"
1306         aros_shared_default="no"
1307         case "$target_cpu" in
1308             *m68k*)
1309                 aros_target_cpu="m68k"
1310                 aros_object_format="m68kelf"
1311                 aros_flavour="mac68knative"
1312                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
1313                 aros_default_wbwidth=512
1314                 aros_default_wbheight=384
1315                 aros_default_wbdepth=8
1316                 aros_target_ar_flags="cru"
1317                 aros_compiler_libs="-lgcc1"
1318                 aros_shared_default=no
1319                 aros_shared_cflags="-fpic"
1320                 aros_shared_aflags=""
1321                 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
1322                 aros_kernel_ldflags="-Wl,-rpath,./lib"
1323                 aros_debug_cflags="-Wall -Werror-implicit-function-declaration $aros_symbols_debug  $aros_messages_debug -mc68000"
1324                 aros_debug_aflags=""
1325                 aros_debug_ldflags="$aros_symbols_debug"
1326                 aros_mungwall_debug="0"
1327                 aros_modules_debug="0"
1328                 gcc_target_cpu="mc68000"
1329                 ignore_undefined_symbols="-ius"
1330                 ;;
1331            *)
1332                 AC_MSG_ERROR("Unknown CPU for Mac68k -- $target_cpu")
1333                 ;;
1334         esac
1335         ;;
1337     *)
1338         AC_MSG_ERROR([Unsupported target architecture $target])
1339         ;;
1340 esac
1342 #-----------------------------------------------------------------------------
1343 AC_MSG_CHECKING([what specific AROS gcc version to use])
1344 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")
1345 case "$aros_gcc_version" in
1346 yes)
1347     aros_gcc_version="default"
1348     ;;
1350     aros_gcc_version="none"
1351     ;;
1352 esac
1353 AC_MSG_RESULT($aros_gcc_version)
1355 if test "$aros_gcc_version" != "none"; then
1356     if test "$aros_gcc_version" != "default"; then
1357         aros_target_cc="$aros_target_cpu-aros-gcc-$aros_gcc_version"
1358         aros_target_cxx="$aros_target_cpu-aros-g++-$aros_gcc_version"
1359     else
1360         aros_target_cc="$aros_target_cpu-aros-gcc"
1361         aros_target_cxx="$aros_target_cpu-aros-g++"
1362     fi
1364     aros_target_ld="$aros_target_cpu-aros-ld"
1365     aros_target_as="$aros_target_cpu-aros-as"
1366     aros_target_ar="$aros_target_cpu-aros-ar"
1367     aros_target_ranlib="$aros_target_cpu-aros-ranlib"
1368     aros_target_nm="$aros_target_cpu-aros-nm"
1369     aros_target_strip="$aros_target_cpu-aros-strip"
1370     aros_target_objcopy="$aros_target_cpu-aros-objcopy"
1371     aros_target_objdump="$aros_target_cpu-aros-objdump"
1375 AC_MSG_CHECKING([Where to download sourcecode for external ports])
1376 AC_ARG_WITH(portssources,AC_HELP_STRING([--with-portssources=DIR],[Where to download sourcecode for external ports]),with_portssrcdir=$withval,with_portssrcdir="default")
1377 if test "$with_portssrcdir" = "default"; then
1378     AROS_PORTSSRCDIR="$AROS_BUILDDIR_UNIX/bin/Sources"
1379 else
1380     AROS_PORTSSRCDIR="$with_portssrcdir"
1382 AC_MSG_RESULT($AROS_PORTSSRCDIR)
1384 AC_MSG_CHECKING([which bootloader to use])
1385 AC_ARG_WITH(bootloader,AC_HELP_STRING([--with-bootloader=NAME],[Use a specific bootloader]),target_bootloader=$withval,target_bootloader=$target_bootloader)
1386 if test "$target_bootloader" = "none"; then
1387     aros_target_bootloader=""
1388 else
1389     aros_target_bootloader="$target_bootloader"
1391 AC_MSG_RESULT($target_bootloader)
1393 AC_MSG_CHECKING([which icon-set to use])
1394 AC_ARG_WITH(iconset,AC_HELP_STRING([--with-iconset=NAME],[Use a specific Icon-set (default=Gorilla).]),target_iconset=$withval,target_iconset="default")
1395 if test "$target_iconset" = "default"; then
1396     aros_target_iconset="Gorilla"
1397     target_iconset="default (Gorilla)"
1398 else
1399     aros_target_iconset="$target_iconset"
1401 AC_MSG_RESULT($target_iconset)
1403 AC_MSG_CHECKING([which GUI Theme to use])
1404 AC_ARG_WITH(theme,AC_HELP_STRING([--with-theme=NAME],[Use a specific GUI Theme]),target_guitheme=$withval,target_guitheme="default")
1405 if test "$target_guitheme" = "default"; then
1406     aros_target_guitheme="Ice"
1407 else
1408     aros_target_guitheme="$target_guitheme"
1410 AC_MSG_RESULT($aros_target_guitheme)
1412 # Find out if we are cross-compiling (i.e. if we can't use the host compiler
1413 # for target code)
1414 cross_compiling=no
1415 if test "$aros_host_cpu" != "$aros_target_cpu" ; then
1416     cross_compiling=yes
1419 dnl Native x86-64 Linux toolchain can also produce i386 binaries, given -m32 flag.
1420 if test "$aros_host_cpu" == "x86_64" ; then
1421     if test "$aros_target_cpu" == "i386" ; then
1422         if test "$aros_target_arch" != "mingw32"; then
1423             cross_compiling=no
1424         fi
1425     fi
1428 dnl Enforce cross-compile if we are on Darwin, but our target is not Darwin
1429 if test "$aros_host_arch" == "darwin" ; then
1430     if test "$aros_target_arch" != "darwin" ; then
1431         cross_compiling=yes
1432     fi
1435 # Set prefix for target compiler etc. if we're cross-compiling
1436 # (should possibly be earlier but needs to be after AC_PROG_CC)
1437 if test "$cross_compiling" = "yes" ; then
1438     if test "$target_tool_prefix" = ""; then
1439         target_tool_prefix=${target_cpu}-elf-
1440     fi
1441     CC=${target_tool_prefix}gcc
1442     dnl CPP is needed for AC_CHECK_HEADER to work correctly
1443     CPP=${target_tool_prefix}cpp
1444     if test "$target_tool_version" != "default"; then
1445         CC="$CC-$target_tool_version"
1446         CPP="$CC-$target_tool_version"
1447     fi
1448     AC_PATH_PROG(CC,$CC)
1449     AROS_REQUIRED(gcc,$CC)
1451 CC="$CC $target_tool_flags"
1453 #-----------------------------------------------------------------------------
1455 # Disable pointer-signedness warnings if the compiler recognises the option
1457 AC_MSG_CHECKING([whether ${CC} accepts -Wno-pointer-sign])
1458 save_cflags="$CFLAGS"
1459 CFLAGS="$CFLAGS -Wno-pointer-sign"
1460 AC_TRY_COMPILE(,, use_no_sign_warning="yes", use_no_sign_warning="no")
1461 AC_MSG_RESULT($use_no_sign_warning)
1462 if test "x-$use_no_sign_warning" = "x-yes" ; then
1463     aros_config_cflags="$aros_config_cflags -Wno-pointer-sign"
1465 CFLAGS="$save_cflags"
1467 #-----------------------------------------------------------------------------
1469 # Find all the tools we need to compile. This could be cross-compiling
1470 # though! If that is the case we use the GNU form of the target and
1471 # simply add this to the front of the binary name. This is rather simple,
1472 # but it should work under most circumstances.
1474 # The default tools are to use the same as the host, but only if the
1475 # host and target CPU are the same. With GCC this is normally enough.
1478 aros_cc_pre=""
1479 aros_shared_ld="$aros_host_ld"
1481 aros_target_mkdep="$aros_host_mkdep"
1482 aros_target_incl_def="$aros_host_incl"
1484 aros_kernel_cc="$CC"
1486 # The default tools executables to be linked to.
1487 if test "$aros_target_cc" != ""; then
1488     AC_PATH_PROG(aros_target_cc,$aros_target_cc)
1489     AROS_REQUIRED(gcc,$aros_target_cc)
1491 if test "$aros_target_ld" != ""; then
1492     AC_PATH_PROG(aros_target_ld,$aros_target_ld)
1493     AROS_REQUIRED(ld,$aros_target_ld)
1496 if test "$crosstools" != "yes"; then
1497     AROS_TOOL_TARGET(aros_target_as_ln,as,$aros_target_as)
1498     AROS_REQUIRED(as,$aros_target_as_ln)
1499     AROS_TOOL_TARGET(aros_kernel_ld,ld,$aros_kernel_ld)
1500     AROS_REQUIRED(ld,$aros_kernel_ld)
1501     AROS_TOOL_TARGET(aros_target_ar_ln,ar,$aros_target_ar)
1502     AROS_REQUIRED(ar,$aros_target_ar_ln)
1503     AROS_TOOL_TARGET(aros_target_nm_ln,nm,$aros_target_nm)
1504     AROS_REQUIRED(nm,$aros_target_nm_ln)
1505     AROS_TOOL_TARGET(aros_target_objcopy_ln,objcopy,$aros_target_objcopy)
1506     AROS_REQUIRED(objcopy,$aros_target_objcopy_ln)
1507     AROS_TOOL_TARGET(aros_target_objdump_ln,objdump,$aros_target_objdump)
1508     AROS_REQUIRED(objdump,$aros_target_objdump_ln)
1509     AROS_TOOL_TARGET(aros_target_ranlib_ln,ranlib,$aros_target_ranlib)
1510     AROS_REQUIRED(ranlib,$aros_target_ranlib_ln)
1511     AROS_TOOL_TARGET(aros_target_strip_ln,strip,$aros_target_strip)
1512     AROS_REQUIRED(strip,$aros_target_strip_ln)
1513     if test "$aros_target_cxx" != ""; then
1514         AC_PATH_PROG(aros_target_cxx,$aros_target_cxx)
1515 # Temporarily disabled in order to let Mingw32-hosted nightly build to work
1516 #       AROS_REQUIRED(c++,$aros_target_cxx)
1517     fi
1518 else
1519 # Cancel preinstalled C++ compiler because it will be built as part of crosstools
1520     aros_target_cxx=""
1523 # Build crosstools if we have no C++ - temporary thing 
1524 if test "$aros_target_cxx" = ""; then
1525     crosstools_target=tools-crosstools
1528 if test "$rescomp" != ""; then
1529     if test "$cross_compiling" = "yes" ; then
1530         rescomp=${target_tool_prefix}${rescomp}
1531     fi
1532     AC_PATH_PROG(aros_kernel_rescomp,$rescomp)
1533     AROS_REQUIRED($rescomp,$aros_kernel_rescomp)
1536 aros_hostcfg_dir="bin/${aros_host_arch}-${aros_host_cpu}/gen/config"
1537 aros_targetcfg_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/config"
1538 aros_inc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/AROS/Development/include/aros"
1539 aros_gendir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen"
1540 aros_geninc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/include/aros"
1541 aros_tools_dir="bin/${aros_host_arch}-${aros_host_cpu}/tools"
1542 aros_scripts_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/scripts"
1544 # aros_cc_pre is a variable that is added to the front of the compiler name
1545 # in the generated aros-gcc shell script. We need this to enable the cache
1546 # to work across cleaned builds. Also, support DISTCC using the correct
1547 # environment variable.
1550 if test "x${DISTCC}" != "x" ; then
1551     if test "x${CCACHE}" != "x" ; then
1552         aros_cc_pre="env CCACHE_PREFIX=${DISTCC} ${CCACHE} "
1553     else
1554         aros_cc_pre="${DISTCC} "
1555     fi
1556 else
1557     if test "x${CCACHE}" != "x" ; then
1558         aros_cc_pre="${CCACHE} "
1559     fi
1562 prefix="${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros"
1564 AC_SUBST(aros_target_nostdinc_cflags,-nostdinc)
1565 AC_SUBST(aros_target_nostartup_ldflags,-nostartfiles)
1566 AC_SUBST(aros_target_nix_ldflags,-nix)
1567 AC_SUBST(aros_target_detach_ldflags,-detach)
1568 AC_SUBST(aros_target_nostdlib_ldflags,-nostdlib)
1570 # Target tools
1571 if test "$aros_target_cc" = ""; then
1572     orig_target_cc=$aros_kernel_cc
1573 else
1574     orig_target_cc=$aros_target_cc
1576 if test "$aros_target_ld" = ""; then
1577     orig_target_ld=$aros_kernel_ld
1578 else
1579     orig_target_ld=$aros_target_ld
1581 if test "$GCC" = "yes"; then
1582     aros_target_cc_path=`$orig_target_cc -print-search-dirs | grep "programs: =" | cut -c 12-`
1584 aros_target_cc="${prefix}-gcc"
1585 aros_target_as="${prefix}-as"
1586 aros_target_ld="${prefix}-ld"
1587 aros_target_ar="${prefix}-ar $aros_target_ar_flags"
1588 aros_target_objcopy=${prefix}-objcopy
1589 aros_target_objdump=${prefix}-objdump
1590 aros_target_ranlib="${prefix}-ranlib $aros_target_ranlib_flags"
1591 aros_target_nm="${prefix}-nm $aros_target_nm_flags"
1592 aros_kernel_nm="${prefix}-nm"
1593 aros_target_strip=${prefix}-strip
1595 # Find the system include path. We can suggest that an alternative is
1596 # used if we don't get it correct. The default is to use /usr/include.
1597 # Which is set in the aros_target_incl_def variable.
1599 AC_ARG_ENABLE(includes,
1600 AC_HELP_STRING([--enable-includes=dir],[Alternative system include directory]),
1601 [aros_target_incl=$enable_includes], [aros_target_incl=$aros_target_incl_def])
1603 if test "$aros_kernel_includes" = ""; then
1604     if test "x-$aros_flavour" = "x-emulation" -o "x-$aros_flavour" = "x-emulcompat" ; then
1605         # FIXME: for cross-compiling this should point to another location
1606         aros_kernel_includes="-isystem $aros_target_incl"
1607     fi
1610 if test "$aros_kernel_includes" != "" ; then
1611     dnl find out about the kernel cc's include path
1612     AC_MSG_CHECKING([for the kernel compiler's include path])
1613     if test "$aros_kernel_cc_includes" = "" ; then
1614         # Try to guess where the directory is.
1615         aros_kernel_cc_includes=`dirname \`${aros_kernel_cc} ${aros_kernel_cflags} -print-libgcc-file-name\``/include
1616         if test -d $aros_kernel_cc_includes; then
1617             # Check if there is also an include-fixed directory and add it
1618             # to kernel compiler's include path as it may contain some of
1619             # the headers we need.
1620             if test -d "$aros_kernel_cc_includes"-fixed; then
1621                 aros_kernel_cc_includes+=" -isystem $aros_kernel_cc_includes"-fixed
1622             fi
1623         else
1624             # The directory doesn't exist, we need to do some more work.
1625             aros_kernel_cc_includes=${PWD}/${aros_gendir}/cc_include
1627             # These are the headers we're looking for.
1628             headers="limits.h mmintrin.h stdbool.h syslimits.h float.h \
1629                      stddef.h xmmintrin.h iso646.h stdarg.h unwind.h   \
1630                      zutil.h"
1632             dirs=
1633             for h in $headers; do
1634                 # Which other headers are needed by each of the above?
1635                 deps=$(echo "#include <$h>" | \
1636                        $aros_kernel_cc -E -M - 2>/dev/null | \
1637                        sed 's/^.*://; s/\\$/ /g; s/[[ \t]]\+/ /g')
1639                 # Copy all the needed headers to a directory beneath gendir.
1640                 for d in $deps; do
1641                     h=$(basename $d)
1642                     dir=${aros_kernel_cc_includes}$(echo $(dirname $d) | \
1643                                                 sed -n "s,^.*/include\(/.*\),\1,p")
1644                     ! test -d $dir && mkdir -p $dir
1645                     ! test -f $dir/$h && { cp $d $dir; chmod u+w $dir/$h; }
1646                 done
1647             done            
1648         fi
1649     fi
1650     AC_MSG_RESULT($aros_kernel_cc_includes)
1651     # Adding -nostdinc to kernel includes as they are always used together.
1652     aros_kernel_includes="$aros_kernel_includes $aros_target_nostdinc_cflags -isystem $aros_kernel_cc_includes"
1655 dnl find out about the target cc's include path
1656 AC_MSG_CHECKING([for the target compiler's include path])
1657 if test "$aros_target_cc_includes" = "" ; then
1658     #try to guess where the directory is
1659     aros_target_cc_includes=`dirname \`${orig_target_cc} -print-libgcc-file-name\``/include
1660     if ! test -d $aros_target_cc_includes; then
1661         #the directory doesn't exist, we need to do some more work
1662         aros_target_cc_includes=${PWD}/${aros_gendir}/cc_include
1663         
1664         #these are the headers we're looling for
1665         headers="limits.h mmintrin.h stdbool.h syslimits.h float.h \
1666                  stddef.h xmmintrin.h iso646.h stdarg.h unwind.h   \
1667                  zutil.h"
1669         dirs=
1670         for h in $headers; do
1671             #which other headers each of the above headers needs?
1672             deps=$(echo "#include <$h>" | \
1673                    $orig_target_cc -E -M - 2>/dev/null | \
1674                    sed 's/^.*://; s/\\$/ /g; s/[[ \t]]\+/ /g')
1675             
1676             #copy all the needed headers to a directory beneath gendir
1677             for d in $deps; do
1678                 h=$(basename $d)
1679                 dir=${aros_target_cc_includes}$(echo $(dirname $d) | \
1680                                                 sed -n "s,^.*/include\(/.*\),\1,p")
1681                 ! test -d $dir && mkdir -p $dir
1682                 ! test -f $dir/$h && { cp $d $dir; chmod u+w $dir/$h; }
1683             done
1684         done        
1685     fi
1687 AC_MSG_RESULT($aros_target_cc_includes)
1690 # For GCC < 4.0 -I- is used for giving the search path for '#include "..."'
1691 # On GCC >= 4.0 -iquote should be used
1694 save_cc="$CC"
1695 save_cflags="$CFLAGS"
1696 CFLAGS="-iquote."
1697 AC_MSG_CHECKING([whether ${CC} accepts -iquote])
1698 AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
1699 AC_MSG_RESULT($has_iquote)
1700 if test "x-$has_iquote" = "x-yes" ; then
1701     host_cflags_iquote=-iquote
1702     host_cflags_iquote_end=
1703 else
1704     host_cflags_iquote=-I
1705     host_cflags_iquote_end=-I-
1707 kernel_cflags_iquote=$host_cflags_iquote
1708 kernel_cflags_iquote_end=$host_cflags_iquote_end
1709 if test "x-$cross_compiling" = "x-yes"; then
1710     CC="$aros_kernel_cc"
1711     AC_MSG_CHECKING([whether ${CC} accepts -fno-stack-protector])
1712     AC_TRY_COMPILE(,, use_no_stack_protector="yes", use_no_stack_protector="no")
1713     AC_MSG_RESULT($use_no_stack_protector)
1714     AC_MSG_CHECKING([whether ${CC} accepts -iquote])
1715     AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
1716     AC_MSG_RESULT($has_iquote)
1717     if test "x-$has_iquote" = "x-yes" ; then
1718         kernel_cflags_iquote=-iquote
1719         kernel_cflags_iquote_end=
1720     else
1721         kernel_cflags_iquote=-I
1722         kernel_cflags_iquote_end=-I-
1723     fi
1725 aros_cflags_iquote=$kernel_cflags_iquote
1726 aros_cflags_iquote_end=$kernel_cflags_iquote_end
1727 if test "$orig_target_cc" != "$aros_kernel_cc"; then
1728     CC="$orig_target_cc"
1729     AC_MSG_CHECKING([whether ${CC} accepts -iquote])
1730     AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
1731     AC_MSG_RESULT($has_iquote)
1732     if test "x-$has_iquote" = "x-yes" ; then
1733         aros_cflags_iquote=-iquote
1734         aros_cflags_iquote_end=
1735     else
1736         aros_cflags_iquote=-I
1737         aros_cflags_iquote_end=-I-
1738     fi
1740 if test "x-$use_no_stack_protector" = "x-yes" ; then
1741     aros_kernel_cflags="$aros_kernel_cflags -fno-stack-protector"
1744 #-----------------------------------------------------------------------------
1746 # Check if we can explicitly choose older version of symbol hashing
1748 CFLAGS="save_cflags -Wl,--hash-style=sysv"
1749 CC="$aros_kernel_cc"
1750 AC_MSG_CHECKING([whether ${CC} accepts -Wl,--hash-style=sysv])
1751 AC_TRY_LINK(,, use_hash_style="yes", use_hash_style="no")
1752 AC_MSG_RESULT($use_hash_style)
1753 if test "x-$use_hash_style" = "x-yes" ; then
1754     aros_kernel_cflags="$aros_kernel_cflags -Wl,--hash-style=sysv"
1756 CC="$save_cc"
1757 CFLAGS="$save_cflags"
1759 AC_SUBST(host_cflags_iquote)
1760 AC_SUBST(host_cflags_iquote_end)
1761 AC_SUBST(kernel_cflags_iquote)
1762 AC_SUBST(kernel_cflags_iquote_end)
1763 AC_SUBST(aros_cflags_iquote)
1764 AC_SUBST(aros_cflags_iquote_end)
1767 dnl Check if user specified --with-resolution=XRESxYRESxDEPTH
1768 AC_MSG_CHECKING([for default resolution of WBScreen])
1769 AC_ARG_WITH(resolution,AC_HELP_STRING([--with-resolution=XRESxYRESxDEPTH],[Default resolution of the initial WorkbenchScreen]),resolution=$withval,resolution=none)
1770 # We require an argument, so map --with/--without ("yes"/"no") to "none" specified
1771 if test "$resolution" = "yes" ; then
1772     resolution="none"
1774 if test "$resolution" = "no" ; then
1775     resolution="none"
1777 if test "$resolution" != "none" ; then
1778     aros_default_wbwidth=`echo $resolution | cut -d'x' -f1`
1779     aros_default_wbheight=`echo $resolution | cut -d'x' -f2`
1780     aros_default_wbdepth=`echo $resolution | cut -d'x' -f3`
1782 AC_MSG_RESULT($aros_default_wbwidth x $aros_default_wbheight x $aros_default_wbdepth)
1783 aros_cv_default_wbwidth=$aros_default_wbwidth
1784 aros_cv_default_wbheight=$aros_default_wbheight
1785 aros_cv_default_wbdepth=$aros_default_wbdepth
1787 dnl See if the user wants the serial debug output for native flavour
1788 AC_MSG_CHECKING([if serial debug is enabled])
1789 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)
1790 if test "$aros_serial_debug" = 0 ; then
1791     serial_debug_forced=""
1792     if test "$serial_debug" = "yes" ; then
1793         serial_debug="2"
1794     fi
1795     if test "$serial_debug" = "no" ; then
1796         serial_debug="none"
1797     fi
1798 else
1799     serial_debug_forced="(forced)"
1800     serial_debug=$aros_serial_debug
1802 if test "$serial_debug" != "none" ; then
1803     aros_serial_debug=$serial_debug
1804     AC_MSG_RESULT($serial_debug_forced on port $serial_debug)
1805 else
1806     AC_MSG_RESULT(no)
1809 dnl See if the user wants the palm debug output hack for palm native flavour
1810 AC_MSG_CHECKING([if palm debug hack is enabled])
1811 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")
1812 if test "$palm_debug_hack" = "yes" ; then
1813     aros_palm_debug_hack="1"
1815 AC_MSG_RESULT($palm_debug_hack)
1818 dnl See if the user wants nesting supervisor activated for unix flavour
1819 AC_MSG_CHECKING([if nesting supervisor support is enabled])
1820 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")
1821 if test "$nesting_supervisor" = "yes" ; then
1822     aros_nesting_supervisor="1"
1824 AC_MSG_RESULT($nesting_supervisor)
1826 dnl See if the user wants to disable MMU support
1827 dnl This can be overriden on per-target basis,
1828 dnl set $aros_enable_mmu to "yes" or "no" to do this
1829 if test "$aros_enable_mmu" = "" ; then
1830     AC_MSG_CHECKING([if MMU support is enabled])
1831     dnl Enabled by default
1832     AC_ARG_ENABLE(mmu,AC_HELP_STRING([--disable-mmu],[Disable MMU support (default=enabled)]),aros_enable_mmu=$enableval,aros_enable_mmu="yes")
1833     if test "$aros_enable_mmu" = "" ; then
1834         aros_enable_mmu="yes"
1835     fi
1836     AC_MSG_RESULT($aros_enable_mmu)
1838 if test "$aros_enable_mmu" = "no" ; then
1839     aros_enable_mmu="0"
1840 else
1841     aros_enable_mmu="1"
1843     
1845 dnl things specifically required for hosted flavours
1846 if test "x-$aros_flavour" = "x-emulation" -o "x-$aros_flavour" = "x-emulcompat" ; then
1848     if test "x-$need_dlopen" != "x-no" ; then
1849       dnl some kind of dynamic library access system is required for hostlib.resource
1850       AC_CHECK_FUNC(dlopen, have_dl="yes", have_dl="no")
1851       if test "x-$have_dl" = "x-no" ; then
1852           AC_CHECK_LIB(dl, dlopen, [have_dl="yes"
1853                                     aros_host_ldflags="$aros_host_ldflags -ldl"],
1854                                     have_dl="no")
1855       fi
1856       if test "x-$have_dl" = "x-no" ; then
1857           AC_MSG_ERROR([dlopen() dynamic linker functions not available])
1858       fi
1859     fi
1862     dnl x11 hidd
1863     AC_ARG_ENABLE(x11_hidd, AC_HELP_STRING([--enable-x11-hidd],
1864                                            [build X11 hidd for hosted (default=auto)]),
1865                                            x11_hidd="$enableval",
1866                                            x11_hidd="$need_x11")
1867     case "x-$x11_hidd" in
1868         x-yes|x-no|x-auto)                 ;;
1869         *)                 x11_hidd="$need_x11" ;;
1870     esac
1872     ENABLE_X11=0
1874     dnl they want it
1875     if test "x-$x11_hidd" != "x-no" ; then
1877         dnl find x11 stuff
1878         AC_PATH_X
1880         x_cflags=
1881         for path in $x_libraries
1882         do
1883             x_cflags="$x_cflags -L$path"
1884         done
1886         for path in $x_includes
1887         do
1888             x_cflags="$x_cflags -I$path"
1889         done
1890         
1891         if test "x-$no_x" = "x-yes" ; then
1893             dnl didn't find it
1894             if test "x-$x11_hidd" != "x-auto" ; then
1895                 dnl and they explicitly asked for it, bail out
1896                 AC_MSG_ERROR([X11 libs/headers not found, cannot build X11 hidd as requested])
1897             fi
1898         
1899         else
1900             dnl found it, setup the metatarget
1901             x11_hidd_target=kernel-x11gfx-kobj
1902             ENABLE_X11=1
1904             dnl setup shared memory extensions
1905             AC_ARG_ENABLE(x11_shm, AC_HELP_STRING([--enable-x11-shm],
1906                                                   [use X11 shared memory (default=auto)]),
1907                                                   x11_hidd_shm="$enableval",
1908                                                   x11_hidd_shm="auto")
1909             case "x-$x11_hidd_shm" in
1910                 x-yes|x-no|x-auto)                     ;;
1911                 *)                 x11_hidd_shm="auto" ;;
1912             esac
1914             have_xshm=no
1916             dnl they want it
1917             if test "x-$x11_hidd_shm" != "x-no" ; then
1919                 dnl system shm headers
1920                 AC_CHECK_HEADERS(sys/ipc.h)
1921                 AC_CHECK_HEADERS(sys/shm.h)
1923                 dnl got them
1924                 if test "x-$ac_cv_header_sys_ipc_h" = "x-yes" -a "x-$ac_cv_header_sys_shm_h" = "x-yes" ; then
1926                     dnl make sure X libs have shm functions
1927                     save_cflags="$CFLAGS"
1928                     CFLAGS="$CFLAGS $x_cflags"
1929                     AC_CHECK_LIB(Xext, XShmQueryExtension, have_xshm=yes)
1930                     CFLAGS="$save_cflags"
1931                 fi
1932             fi
1934             dnl detection done, prepare output
1935             if test "x-$have_xshm" = "x-yes" ; then
1936                 dnl we can do shm
1937                 DO_XSHM_SUPPORT="1"
1938             elif test "x-$x11_hidd_shm" = "x-yes" ; then
1939                 dnl they explicitly asked for it, but we can't do it
1940                 AC_MSG_ERROR([X11 has no support for shared memory, cannot enable it as requested])
1941             else
1942                 dnl otherwise just disable it
1943                 DO_XSHM_SUPPORT="0"
1944             fi
1946             
1947             dnl setup vidmode (fullscreen) extensions
1948             AC_ARG_ENABLE(x11_vidmode, AC_HELP_STRING([--enable-x11-vidmode],
1949                                                       [use X11 vidmode extension (default=auto)]),
1950                                                       x11_hidd_vidmode="$enableval",
1951                                                       x11_hidd_vidmode="auto")
1952             case "x-$x11_hidd_vidmode" in
1953                 x-yes|x-no|x-auto)                         ;;
1954                 *)                 x11_hidd_vidmode="auto" ;;
1955             esac
1957             have_vidmode=no
1959             dnl they want it
1960             if test "x-$x11_hidd_vidmode" != "x-no" ; then
1962                 dnl make sure X libs have vidmode functions
1963                 save_cflags="$CFLAGS"
1964                 CFLAGS="$CFLAGS $x_cflags"
1965                 AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryExtension, have_vidmode=yes)
1966                 CFLAGS="$save_cflags"
1967             fi
1969             dnl detection done, prepare output
1970             if test "x-$have_vidmode" = "x-yes" ; then
1971                 dnl we can do vidmode
1972                 DO_VIDMODE_SUPPORT="1"
1973             elif test "x-$x11_hidd_vidmode" = "x-yes" ; then
1974                 dnl they explicitly asked for it, but we can't do it
1975                 AC_MSG_ERROR([X11 vidmode extension not available, cannot enable it as requested])
1976             else
1977                 dnl otherwise just disable it
1978                 DO_VIDMODE_SUPPORT="0"
1979             fi
1980         fi
1982         aros_host_x11_includes=$x_includes 
1983         aros_host_x11_libdirs=$x_libraries
1984     fi
1987     dnl sdl hidd
1988     AC_ARG_ENABLE(sdl_hidd, AC_HELP_STRING([--enable-sdl-hidd],
1989                                            [build SDL hidd for hosted (default=auto)]),
1990                                            sdl_hidd="$enableval",
1991                                            sdl_hidd="auto")
1992     case "x-$sdl_hidd" in
1993         x-yes|x-no|x-auto)                 ;;
1994         *)                 sdl_hidd="auto" ;;
1995     esac
1997     dnl they want it
1998     if test "x-$sdl_hidd" != "x-no" ; then
2000         dnl find sdl
2001         AM_PATH_SDL([1.2.10], have_sdl="yes", have_sdl="no")
2003         if test "x-$have_sdl" != "x-yes" ; then
2005             dnl didn't find it
2006             if test "x-$sdl_hidd" != "x-auto" ; then
2007                 dnl and they explicitly asked for it, bail out
2008                 AC_MSG_ERROR([SDL libs/headers not found, cannot build SDL hidd as requested])
2009             fi
2011         else
2012             dnl found it, set up the metatarget
2013             sdl_hidd_target=kernel-hidd-sdl
2014             aros_host_sdl_cflags=SDL_CFLAGS
2015             aros_host_sdl_libs=SDL_LIBS
2016         fi
2017     fi
2019     dnl oss.library
2020     AC_CHECK_HEADER(sys/soundcard.h)
2021     if test "x-$ac_cv_header_sys_soundcard_h" = "x-yes" ; then
2022         oss_library_target=workbench-libs-oss-unix
2023     fi
2027 dnl See if the user wants dbus.library
2028 AC_MSG_CHECKING([if building of dbus.library is enabled])
2029 AC_ARG_ENABLE(dbus,AC_HELP_STRING([--enable-dbus],[Enable DBUS support via dbus.library (default=no)]),dbus="yes",dbus="no")
2030 if test "$dbus" = "yes" ; then
2031     ENABLE_DBUS=1
2032     DBUS_CFLAGS=`pkg-config --cflags dbus-1`
2033     DBUS_LIBFLAGS=`pkg-config --libs dbus-1`
2034     KERNEL_DBUS_KOBJ=kernel-dbus-kobj
2035     KERNEL_DBUS_INCLUDES=kernel-dbus-includes
2036 else
2037     ENABLE_DBUS=0
2039 AC_MSG_RESULT($dbus)
2042 dnl --------------------------------------------------------------------
2043 dnl Configuration Output Section
2044 dnl --------------------------------------------------------------------
2046 # Generic
2047 AC_SUBST(aros_arch)
2048 AC_SUBST(aros_cpu)
2049 AC_SUBST(aros_flavour)
2050 AC_SUBST(aros_flavour_uc)
2051 AC_SUBST(AROS_BUILDDIR)
2052 AC_SUBST(AROS_BUILDDIR_UNIX)
2053 AC_SUBST(SRCDIR)
2054 AC_SUBST(AROS_PORTSSRCDIR)
2056 # Host related
2057 AC_SUBST(aros_cc_pre)
2058 AC_SUBST(aros_host_strip)
2059 AC_SUBST(aros_host_arch)
2060 AC_SUBST(aros_host_cpu)
2061 AC_SUBST(aros_host_cc)
2062 AC_SUBST(aros_host_ar)
2063 AC_SUBST(aros_host_ranlib)
2064 AC_SUBST(aros_host_ld)
2065 AC_SUBST(aros_host_make)
2066 AC_SUBST(aros_host_cflags)
2067 AC_SUBST(gnu89_inline)
2068 AC_SUBST(aros_host_ldflags)
2069 AC_SUBST(aros_host_debug)
2070 AC_SUBST(aros_host_mkdep)
2071 AC_SUBST(aros_host_mkargs)
2072 AC_SUBST(aros_host_exe_suffix)
2073 AC_SUBST(aros_host_lib_suffix)
2074 AC_SUBST(aros_tools_dir)
2075 AC_SUBST(aros_host_aclocal)
2076 AC_SUBST(aros_host_autoconf)
2077 AC_SUBST(aros_host_autoheader)
2078 AC_SUBST(aros_host_automake)
2080 # Target Related
2081 AC_SUBST(aros_target_guitheme)
2082 AC_SUBST(aros_target_iconset)
2083 AC_SUBST(aros_target_bootloader)
2084 AC_SUBST(aros_target_arch)
2085 AC_SUBST(aros_target_family)
2086 AC_SUBST(aros_target_cpu)
2087 AC_SUBST(aros_target_variant)
2088 AC_SUBST(aros_target_suffix)
2089 AC_SUBST(aros_target_incl)
2090 AC_SUBST(aros_target_ar)
2091 AC_SUBST(aros_target_ranlib)
2092 AC_SUBST(aros_kernel_nm)
2093 AC_SUBST(orig_target_cc)
2094 AC_SUBST(aros_target_cc)
2095 AC_SUBST(aros_target_cxx)
2096 AC_SUBST(aros_kernel_cc)
2097 AC_SUBST(aros_target_as)
2098 AC_SUBST(orig_target_ld)
2099 AC_SUBST(aros_target_ld)
2100 AC_SUBST(aros_kernel_ld)
2101 AC_SUBST(aros_target_cc_includes)
2102 AC_SUBST(aros_target_cc_path)
2103 AC_SUBST(aros_target_objdump)
2104 AC_SUBST(aros_target_objcopy)
2105 AC_SUBST(aros_target_strip)
2106 AC_SUBST(aros_target_nm)
2107 AC_SUBST(aros_kernel_rescomp)
2108 AC_SUBST(aros_shared_default)
2109 AC_SUBST(aros_shared_ld)
2110 AC_SUBST(aros_object_format)
2111 AC_SUBST(aros_compiler_libs)
2112 AC_SUBST(aros_arch_libs)
2114 AC_SUBST(aros_config_cflags)
2115 AC_SUBST(aros_config_aflags)
2116 AC_SUBST(aros_config_ldflags)
2118 AC_SUBST(aros_shared_cflags)
2119 AC_SUBST(aros_shared_aflags)
2120 AC_SUBST(aros_shared_ldflags)
2121 AC_SUBST(aros_kernel_cflags)
2122 AC_SUBST(aros_kernel_includes)
2123 AC_SUBST(aros_kernel_objcflags)
2124 AC_SUBST(aros_kernel_ldflags)
2125 AC_SUBST(aros_target_cflags)
2126 AC_SUBST(aros_debug_cflags)
2127 AC_SUBST(aros_debug_aflags)
2128 AC_SUBST(aros_debug_ldflags)
2129 AC_SUBST(aros_paranoia_cflags)
2130 AC_SUBST(aros_target_genmap)
2131 AC_SUBST(aros_target_strip_flags)
2133 AC_SUBST(crosstools_target)
2135 # Graphics Related
2136 AC_SUBST(x11_hidd_target)
2137 AC_SUBST(sdl_hidd_target)
2138 AC_SUBST(pci_hidd_target)
2139 AC_SUBST(oss_library_target)
2141 AC_SUBST(aros_default_wbwidth)
2142 AC_SUBST(aros_default_wbheight)
2143 AC_SUBST(aros_default_wbdepth)
2144 AC_SUBST(DO_XSHM_SUPPORT)
2145 AC_SUBST(DO_VIDMODE_SUPPORT)
2147 AC_SUBST(aros_host_x11_includes)
2148 AC_SUBST(aros_host_x11_libdirs)
2149 AC_SUBST(aros_host_sdl_cflags)
2150 AC_SUBST(aros_host_sdl_libs)
2152 # Native version related
2153 AC_SUBST(aros_serial_debug)
2155 # Palm native version related
2156 AC_SUBST(aros_palm_debug_hack)
2158 # Unix/Hosted version related
2159 AC_SUBST(aros_nesting_supervisor)
2161 # MMU related
2162 AC_SUBST(aros_enable_mmu)
2164 # Apple iOS related
2165 AC_SUBST(aros_ios_platform)
2166 AC_SUBST(aros_ios_version)
2167 AC_SUBST(aros_ios_sdk)
2169 # Android related
2170 AC_SUBST(android_tool)
2171 AC_SUBST(aros_android_level)
2173 # DBUS related
2174 AC_SUBST(ENABLE_DBUS)
2175 AC_SUBST(DBUS_CFLAGS)
2176 AC_SUBST(DBUS_LIBFLAGS)
2177 AC_SUBST(KERNEL_DBUS_KOBJ)
2178 AC_SUBST(KERNEL_DBUS_INCLUDES)
2180 #X11 related
2181 AC_SUBST(ENABLE_X11)
2183 # Debug related
2184 AC_SUBST(aros_debug)
2185 AC_SUBST(aros_mungwall_debug)
2186 AC_SUBST(aros_stack_debug)
2187 AC_SUBST(aros_modules_debug)
2189 # Collect-aros stuff: "-ius" to ignore undefined symbols
2190 AC_SUBST(ignore_undefined_symbols)
2192 # C compiler related
2193 AC_SUBST(gcc_target_cpu)
2195 dnl Prepare for output, make up all the generated patches
2196 case "$aros_flavour" in
2197 emulation)      aros_flavour_uc="AROS_FLAVOUR_EMULATION"
2198                 aros_flavour="emulation" ;;
2199 emulcompat)     aros_flavour_uc="(AROS_FLAVOUR_EMULATION|AROS_FLAVOUR_BINCOMPAT)"
2200                 aros_flavour="emulation" ;;
2201 standalone)     aros_flavour_uc="AROS_FLAVOUR_STANDALONE"
2202                 aros_flavour="standalone";;
2203 standcompat)    aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_BINCOMPAT)"
2204                 aros_flavour="standalone";;
2205 native)         aros_flavour_uc="AROS_FLAVOUR_NATIVE"
2206                 aros_flavour="native" ;;
2207 nativecompat)   aros_flavour_uc="(AROS_FLAVOUR_NATIVE|AROS_FLAVOUR_BINCOMPAT)"
2208                 aros_flavour="native" ;;
2209 linklib)        aros_flavour_uc="AROS_FLAVOUR_LINKLIB"
2210                 aros_flavour="linklib" ;;
2211 palmnative)     aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
2212                 aros_flavour="palmnative" ;;
2213 mac68knative)   aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
2214                 aros_flavour="mac68knative" ;;
2215 ppcnative)      aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_BINCOMPAT)"
2216                 aros_flavour="ppcnative" ;;
2217 esac
2219 if test ! -d ${aros_inc_dir} ; then
2220     ${MKDIR} ${aros_inc_dir}
2222 if test ! -d ${aros_geninc_dir} ; then
2223     ${MKDIR} ${aros_geninc_dir}
2225 if test ! -d ${aros_hostcfg_dir} ; then
2226     ${MKDIR} ${aros_hostcfg_dir}
2228 if test ! -d ${aros_targetcfg_dir} ; then
2229     ${MKDIR} ${aros_targetcfg_dir}
2231 if test ! -d ${aros_tools_dir} ; then
2232     ${MKDIR} ${aros_tools_dir}
2234 if test ! -d ${aros_scripts_dir} ; then
2235     ${MKDIR} ${aros_scripts_dir}
2238 AC_CONFIG_HEADERS(${aros_geninc_dir}/host-conf.h:config/host-conf.h.in)
2240 AC_CONFIG_COMMANDS([compiler_executable],
2241     [
2242         prefix=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}
2243         mkdir -p $prefix
2244         prefix="${prefix}/${aros_target_cpu}-aros"
2245         prefix2=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros
2247         echo ${prefix}
2248         echo ${prefix2}
2249         chmod a+x ${prefix2}-gcc ${prefix2}-ld
2251         ln -sf ${prefix2}-gcc          ${prefix}-gcc
2252         ln -sf ${prefix2}-ld           ${prefix}-ld
2254         ln -sf $aros_target_as_ln$aros_host_exe_suffix      ${prefix}-as
2255         ln -sf $aros_target_nm_ln$aros_host_exe_suffix      ${prefix}-nm
2256         ln -sf $aros_target_ar_ln$aros_host_exe_suffix      ${prefix}-ar
2257         ln -sf $aros_target_ranlib_ln$aros_host_exe_suffix  ${prefix}-ranlib
2258         ln -sf $aros_target_objcopy_ln$aros_host_exe_suffix ${prefix}-objcopy
2259         ln -sf $aros_target_objdump_ln$aros_host_exe_suffix ${prefix}-objdump
2260         ln -sf $aros_target_strip_ln$aros_host_exe_suffix   ${prefix}-strip
2262         ln -sf $aros_target_as_ln$aros_host_exe_suffix      ${prefix2}-as
2263         ln -sf $aros_target_nm_ln$aros_host_exe_suffix      ${prefix2}-nm
2264         ln -sf $aros_target_ar_ln$aros_host_exe_suffix      ${prefix2}-ar
2265         ln -sf $aros_target_ranlib_ln$aros_host_exe_suffix  ${prefix2}-ranlib
2266         ln -sf $aros_target_objcopy_ln$aros_host_exe_suffix ${prefix2}-objcopy
2267         ln -sf $aros_target_objdump_ln$aros_host_exe_suffix ${prefix2}-objdump
2268         ln -sf $aros_target_strip_ln$aros_host_exe_suffix   ${prefix2}-strip
2269     ],
2270     [
2271         aros_host_exe_suffix=${aros_host_exe_suffix}
2272         aros_tools_dir=${aros_tools_dir}
2273         aros_target_cpu=${aros_target_cpu}
2274         aros_target_arch=${aros_target_arch}
2275         aros_target_suffix=${aros_target_suffix}
2276         aros_target_nm_ln=${aros_target_nm_ln}
2277         aros_target_as_ln=${aros_target_as_ln}
2278         aros_target_ar_ln=${aros_target_ar_ln}
2279         aros_target_ranlib_ln=${aros_target_ranlib_ln}
2280         aros_target_objdump_ln=${aros_target_objdump_ln}
2281         aros_target_objcopy_ln=${aros_target_objcopy_ln}
2282         aros_target_strip_ln=${aros_target_strip_ln}
2283     ]
2285 AC_CONFIG_COMMANDS([genshared_executable],
2286     [chmod a+x ${aros_scripts_dir}/genshared],
2287     [aros_scripts_dir=${aros_scripts_dir}]
2289 AC_CONFIG_COMMANDS([genmf_executable],
2290     [chmod a+x ${aros_tools_dir}/genmf.py],
2291     [aros_tools_dir=${aros_tools_dir}]
2294 AC_CONFIG_FILES(
2295     Makefile
2296     config/make.cfg
2297     ${aros_inc_dir}/config.h:config/config.h.in
2298     ${aros_geninc_dir}/config.h:config/config.h.in
2299     ${aros_hostcfg_dir}/host.cfg:config/host.cfg.in
2300     ${aros_targetcfg_dir}/target.cfg:config/target.cfg.in
2301     mmake.config
2302     ${aros_targetcfg_dir}/make.defaults:config/make.defaults.in
2303     ${aros_targetcfg_dir}/specs:config/specs.in
2304     ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-gcc:scripts/aros-gcc.in
2305     ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-ld:scripts/aros-ld.in
2306     ${aros_scripts_dir}/genshared:compiler/library_template_c/source/lib_source/genshared.in
2307     ${aros_tools_dir}/genmf.py:tools/genmf/genmf.py
2308     tools/collect-aros/env.h
2309     ${aros_gendir}/arch/all-android/bootstrap/app/default.properties:arch/all-android/bootstrap/app/default.properties.in
2312 AC_OUTPUT
2314 dnl This is in order to not define SHARED_CFLAGS sometimes
2315 dnl We don't always do aros_shared_ar, aros_shared_cflags
2317 #XXX compatability...
2318 aros_shared_ar="$aros_shared_ld $aros_shared_ldflags -o"
2320 if test -n "$aros_shared_cflags" ; then
2321     echo "SHARED_CFLAGS := $aros_shared_cflags" >> ${aros_hostcfg_dir}/host.cfg
2322     echo "SHARED_AR := $aros_shared_ar" >> ${aros_hostcfg_dir}/host.cfg