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