amiga-m68k: More work on the gcc 4.5.1 thunking
[AROS.git] / configure.in
blob13b106265ce1ddc0c2b96938d575f0edcc6e64a6
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 dnl Despite the name, this is really a host configuration variable.
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 Need to override this here, it's just too hard later.
193         dnl This shouldn't be here at all...
194         dnl aros_target_cc_includes="/usr/include"
196         dnl FreeBSD 5.x (and later) has changed the default object format.
197         dnl The double [[]] is necessary to get around m4's quoting rules.
198         case $host_os in
199             freebsd[[234]]*)
200                 aros_object_format="elf_i386"
201                 ;;
203             *)
204                 aros_object_format="elf_i386_fbsd"
205                 ;;
206         esac
208         ;;
210     darwin*)
211         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
212         aros_host_arch="darwin"
213         case "$host_cpu" in
214             *i?86*)
215                 aros_host_cpu="i386"
216                 ;;
217             *x86_64*)
218                 aros_host_cpu="x86_64"
219                 ;;
220             *powerpc*)
221                 aros_host_cpu="ppc"
222                 ;;
223             *)
224                 AC_MSG_WARN("Unknown CPU for Darwin host -- $host_cpu")
225                 aros_host_cpu="$host_cpu"
226                 ;;
227         esac
229         aros_host_ldflags="$aros_host_ldflags -liconv"
231         ;;
233     dragonfly*)
234         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
235         aros_host_make="gmake"
236         aros_host_arch="dragonfly"
237         case $host_cpu in
238             *i?86*)
239                 aros_host_cpu="i386"
240                 ;;
241             *amd64*)
242                 aros_host_cpu="x86_64"
243                 ;;
244             *)
245                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
246                 aros_host_cpu="$host_cpu"
247                 ;;
248         esac
249         ;;
251     netbsd*)
252         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
253         aros_host_make="gmake"
254         aros_host_arch="netbsd"
255         case "$host_cpu" in
256             *i?86*)
257                 aros_host_cpu="i386"
258                 ;;
259             *m68k*)
260                 aros_host_cpu="m68k"
261                 ;;
262             *)
263                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
264                 aros_host_cpu="$host_cpu"
265                 ;;
266         esac    
267         aros_host_lib_suffix=".0.0"
268         ;;
270     openbsd*)
271         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
272         aros_host_make="gmake"
273         aros_host_arch="openbsd"
274         case "$host_cpu" in
275             *i?86*)
276                 aros_host_cpu="i386"
277                 ;;
278             *)
279                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
280                 aros_host_cpu="$host_cpu"
281                 ;;
282         esac
283         ;;
284         
285     solaris*)
286         aros_host_arch="solaris"
287         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
288         case "$host_cpu" in
289             *i?86*)
290                 aros_host_cpu="i386"
291                 ;;
292             *sparc*)
293                 aros_host_cpu="sparc"
294                 ;;
295             *)
296                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
297                 aros_host_cpu="$host_cpu"
298                 ;;
299         esac
300         ;;
302     morphos*)
303         aros_host_arch="morphos"
304         aros_host_cpu="ppc"
305         ;;
307     amiga*)
308         aros_host_arch="amiga"
309         SORT="/gg/bin/sort"
310         TEST="/gg/bin/test"
311         UNIQ="/gg/bin/uniq"
312         FOR="for"
313         TOUCH="/gg/bin/touch"
314         case "$host_cpu" in
315             *m68k*)
316                 aros_host_cpu="m68k"
317                 ;;
318             *powerpc*)
319                 aros_host_cpu="ppc"
320                 ;;
321             *)
322                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
323                 aros_host_cpu="$host_cpu"
324                 ;;
325         esac
326         ;;
328     cygwin*)
329         aros_host_arch="cygwin"
330         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
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         case "$host_cpu" in
346             *i?86*)
347                 aros_host_cpu="i386"
348                 ;;
349             *)
350                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
351                 aros_host_cpu="$host_cpu"
352                 ;;
353         esac
354         ;;
355     *)
356         AC_MSG_ERROR([Unsupported host architecture $host])
357         ;;
358 esac
360 AROS_PROG(aros_host_ar,[ar],[cr])
361 AROS_REQUIRED(ar,$aros_host_ar)
362 AROS_PROG(aros_host_ranlib,ranlib)
363 AROS_REQUIRED(ranlib,$aros_host_ranlib)
364 AROS_PROG(aros_host_strip,strip)
365 AROS_REQUIRED(strip,$aros_host_strip)
367 AROS_PROG(RM,[rm],[-rf])
368 AROS_REQUIRED(rm,$RM)
369 AROS_PROG(CP,[cp])
370 AROS_REQUIRED(cp,$CP)
371 AROS_PROG(MV,[mv])
372 AROS_REQUIRED(mv,$MV)
373 AROS_PROG(ECHO,[echo])
374 AROS_REQUIRED(echo,$ECHO)
375 AROS_PROG(MKDIR,[mkdir],[-p])
376 AROS_REQUIRED(mkdir,$MKDIR)
377 AROS_PROG(TOUCH,[touch])
378 AROS_REQUIRED(touch,$TOUCH)
379 AROS_PROG(SORT,[sort])
380 AROS_REQUIRED(sort,$SORT)
381 AROS_PROG(UNIQ,[uniq])
382 AROS_REQUIRED(uniq,$UNIQ)
383 AROS_PROG(NOP,[true])
384 AROS_REQUIRED(true,$NOP)
385 AROS_PROG(CAT,[cat])
386 AROS_REQUIRED(cat,$CAT)
387 AROS_PROG(BISON,[bison])
388 AROS_REQUIRED(bison,$BISON)
389 AROS_PROG(FLEX,[flex])
390 AROS_REQUIRED(flex,$FLEX)
391 AROS_PROG(PNGTOPNM,[pngtopnm])
392 AROS_REQUIRED(pngtopnm,$PNGTOPNM)
393 AROS_PROG(PPMTOILBM,[ppmtoilbm])
394 AROS_REQUIRED(ppmtoilbm,$PPMTOILBM)
395 AROS_PROG(SED,[sed])
396 AROS_REQUIRED(sed,$SED)
397 AROS_PROG(CHMOD,[chmod])
398 AROS_REQUIRED(chmod,$CHMOD)
400 AM_PATH_PYTHON(2.5)
402 AC_SUBST(FOR, for)
403 AC_SUBST(IF, if)
404 AC_SUBST(TEST, test)
405 AC_SUBST(CMP, cmp)
407 dnl ---------------------------------------------------------------------------
408 dnl Look for things about the host system, good for hosted targets.
409 dnl ---------------------------------------------------------------------------
411 # Check for some includes for the X11 HIDD and the kernel
412 AC_CHECK_HEADERS([sys/ipc.h sys/shm.h \
413     sys/mmap.h sys/mman.h sysexits.h \
414     sys/statfs.h sys/statvfs.h sys/vfs.h sys/param.h \
417 AC_CHECK_HEADERS([sys/mount.h],,,[#include <sys/param.h>])
419 AC_HEADER_DIRENT
420 AC_HEADER_STAT
421 AC_HEADER_STDC
422 AC_HEADER_SYS_WAIT
423 AC_HEADER_TIME
424 AC_STRUCT_ST_BLKSIZE
425 AC_STRUCT_ST_BLOCKS
426 AC_STRUCT_ST_RDEV
427 AC_STRUCT_TM
428 AC_STRUCT_TIMEZONE
429 AC_TYPE_OFF_T
430 AC_TYPE_PID_T
431 AC_TYPE_SIZE_T
432 AC_TYPE_UID_T
434 AC_CHECK_MEMBERS(struct tm.tm_gmtoff)
436 # Look for some functions
437 AC_CHECK_FUNCS([getpagesize kqueue statfs statvfs \
438     clone kse_create rfork_thread thr_create sa_register \
439     getcontext makecontext setcontext sigaltstack swapcontext])
441 AC_FUNC_MMAP
444 dnl --------------------------------------------------------------------
445 dnl Target Configuration Section
446 dnl --------------------------------------------------------------------
448 dnl The target configuration section is responsible for setting up all
449 dnl the paths for includes, and tools required to build AROS to some
450 dnl particular target.
452 aros_config_cflags="-Wall -Werror-implicit-function-declaration"
453 aros_config_aflags="-Wall -x assembler-with-cpp -c"
454 aros_config_ldflags=""
456 aros_shared_default=yes
458 aros_shared_cflags="-fPIC"
459 aros_shared_aflags=""
460 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
461 aros_kernel_ldflags="-Wl,-rpath,./lib"
463 aros_target_ar_flags="cr"
464 aros_target_nm_flags="-C -ul"
465 aros_target_strip_flags="--strip-unneeded -R.comment"
467 aros_compiler_libs=
468 aros_arch_libs=
470 aros_target_genmap="-Wl,-Map -Xlinker"
472 # Native flavour stuff
473 aros_serial_debug="0"
475 # Palm native flavour stuff
476 aros_palm_debug_hack="0"
478 # Unix flavour stuff
479 aros_nesting_supervisor="0"
481 # Collect-aros stuff: "-ius" to ignore undefined symbols
482 ignore_undefined_symbols=""
484 #-----------------------------------------------------------------------------
487 # GCC 4.1+ has a stack protection feature that requires OS support. Ubuntu has
488 # it switched on by default, and we use the host compiler, so it compiles AROS
489 # code with this enabled resulting in link failures as we don't have support
490 # for it.
492 # We use two methods to disable it. For the host compiler (used to compile
493 # some hosted modules), we test to see if the compiler supports stack
494 # protection, and if it does we disable it in AROS_CONFIG_CFLAGS. This should
495 # work on all platforms.
497 # For the "cross" compiler we clear the "ssp_default" spec in config/specs.in
498 # (this is done unconditionally, as it should have no effect on compilers
499 # without the stack protection feature). This may be specific to the way that
500 # Ubuntu enables the feature, so may not work everywhere. My specs-fu isn't
501 # strong enough to disable it in a generic way though, so we'll live with it
502 # until another vendor ships GCC with it enabled in a different way, and deal
503 # with it then.
506 AC_MSG_CHECKING([whether ${CC} accepts -fno-stack-protector])
507 save_cflags="$CFLAGS"
508 CFLAGS="$CFLAGS -fno-stack-protector"
509 AC_TRY_COMPILE(,, use_no_stack_protector="yes", use_no_stack_protector="no")
510 AC_MSG_RESULT($use_no_stack_protector)
511 if test "x-$use_no_stack_protector" = "x-yes" ; then
512     aros_host_cflags="$aros_host_cflags -fno-stack-protector"
514 CFLAGS="$save_cflags"
516 #-----------------------------------------------------------------------------
518 # Disable pointer-signedness warnings if the compiler recognises the option
519 # (this only works for the host compiler at the moment)
521 AC_MSG_CHECKING([whether ${CC} accepts -Wno-pointer-sign])
522 save_cflags="$CFLAGS"
523 CFLAGS="$CFLAGS -Wno-pointer-sign"
524 AC_TRY_COMPILE(,, use_no_sign_warning="yes", use_no_sign_warning="no")
525 AC_MSG_RESULT($use_no_sign_warning)
526 if test "x-$use_no_sign_warning" = "x-yes" ; then
527     aros_host_cflags="$aros_host_cflags -Wno-pointer-sign"
529 CFLAGS="$save_cflags"
531 #-----------------------------------------------------------------------------
533 AC_MSG_CHECKING([for type of build])
534 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")
536 if test "$build_type" = "nightly"; then
537     build_type_string="NIGHTLY"
538 elif test "$build_type" = "snapshot"; then
539     build_type_string="SNAPSHOT"
540 elif test "$build_type" = "milestone"; then
541     build_type_string="MILESTONE"
542 elif test "$build_type" = "release"; then
543     build_type_string="RELEASE"
544 else
545     build_type_string="PERSONAL"
546     build_type="personal"
549 aros_config_cflags="$aros_config_cflags -DAROS_BUILD_TYPE=AROS_BUILD_TYPE_$build_type_string"
551 AC_MSG_RESULT($build_type)
553 #-----------------------------------------------------------------------------
554 all_debug_types="messages stack modules mungwall symbols"
556 AC_MSG_CHECKING([which debug types to enable])
557 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)]),
558  debug="$enableval",debug="")
560 if test "$debug" = "" -o "$debug" = "no"; then
561     debug="none"
562 elif test "$debug" = "yes"; then
563     debug="all"
566 if test "$debug" = "all" ; then
567     debug="messages stack modules symbols"
568     for d in $all_debug_types; do
569         export aros_${d}_debug="1"
570     done
571 else
572     for d in $all_debug_types; do
573         export aros_${d}_debug="0"
574     done
577 if test "$debug" != "none"; then
578     debug=`echo $debug | sed s/,/\ /g`
579     for d in $debug; do
580         found="0"
581         for d2 in $all_debug_types; do
582             if test "$d2" = "$d"; then
583                 found="1"
584                 break
585             fi
586         done
587         if test "$found" = "0"; then
588             AC_MSG_ERROR([unrecognized debug type "$d". Available types are: all none $all_debug_types])
589         fi
590         export aros_${d}_debug="1"
591     done
592     aros_debug="yes"
594 AC_MSG_RESULT($debug)
596 if test "$aros_messages_debug" = "1"; then
597     aros_messages_debug="-DADEBUG=1 -DMDEBUG=1"
598 else
599     aros_messages_debug=""
601 if test "$aros_symbols_debug" = "1"; then
602     aros_symbols_debug="-g"
603 else
604     aros_symbols_debug=""
607 # These are the flags to pass when compiling debugged programs
608 aros_debug_cflags="$aros_symbols_debug $aros_messages_debug"
609 aros_debug_aflags=""
610 aros_debug_ldflags="$aros_symbols_debug"
612 aros_crosstools="no"
614 #-----------------------------------------------------------------------------
615 #   Checking if we should build crosstools..
616 AC_MSG_CHECKING([whether to build crosstools])
617 AC_ARG_ENABLE(crosstools,AC_HELP_STRING([--enable-crosstools],[Build cross-compiler toolchains if necessary (default=no).]),crosstools="$enableval",crosstools="no")
618 if test "$crosstools" != "" -a "$crosstools" != "no"; then
619     AC_MSG_RESULT(yes)
620         aros_crosstools="yes"
621 else
622     AC_MSG_RESULT(no)
625 #-----------------------------------------------------------------------------
626 #   Checking for distcc and ccache.
628 #   Always apply the transforms in this particular order. Basically you should
629 #   always run 'ccache distcc compiler' in that order for the best performance.
631 AC_MSG_CHECKING([whether to enable distcc])
632 AC_ARG_ENABLE(distcc,AC_HELP_STRING([--enable-distcc],[Use distcc as a front end to the compiler (default=no).]),distcc="$enableval",distcc="no")
633 if test "$distcc" != "" -a "$distcc" != "no"; then
634     # AC_CHECK_PROG will print out the result in this case
635     AC_PATH_PROG(DISTCC,[distcc],distcc,)
636 else
637     AC_MSG_RESULT(no)
640 AC_MSG_CHECKING([whether to enable ccache])
641 AC_ARG_ENABLE(ccache,AC_HELP_STRING([--enable-ccache],[Use ccache as a front end to the compiler (default=no).]),ccache="$enableval",ccache="no")
642 if test "$ccache" != "" -a "$ccache" != "no"; then
643     # AC_CHECK_PROG will print out the result in this case
644     AC_CHECK_PROG(CCACHE,[ccache],ccache,)
645 else
646     AC_MSG_RESULT(no)
649 #-----------------------------------------------------------------------------
650 AC_MSG_CHECKING([what specific gcc version to use])
651 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")
652 AC_MSG_RESULT($target_tool_version)
654 #-----------------------------------------------------------------------------
655 AC_MSG_CHECKING([what optimization flags to use])
656 AC_ARG_WITH(optimization,AC_HELP_STRING([--with-optimization=FLAGS],[Use optimization flags FLAGS (default=-O2).]),optimization="$withval",optimization="unknown")
657 if test "$optimization" = "unknown"; then
658     dnl default is -O2 for normal builds, -O0 for debug builds
659     if test "$debug" != "none"; then
660         optimization="-O0"
661     else
662         optimization="-O2"
663     fi
665 aros_config_cflags="$aros_config_cflags $optimization"
666 AC_MSG_RESULT($optimization)
668 #-----------------------------------------------------------------------------
669 AC_MSG_CHECKING([what paranoia flags to use])
670 AC_ARG_WITH(paranoia,AC_HELP_STRING([--with-paranoia=FLAGS],[CC flags to enable paranoia]),[paranoia_flags="$withval"],[paranoia_flags="default"])
671 if test "$paranoia_flags" = "default"; then
672         paranoia_flags=""
673 else if test "$paranoia_flags" = "yes"; then
674         paranoia_flags="-Wall -W -Werror"
675 fi fi
676 AC_MSG_RESULT($paranoia_flags)
677 aros_paranoia_cflags="$paranoia_flags"
679 #-----------------------------------------------------------------------------
680 if test "$target_os" = "ios"; then
682 AC_MSG_CHECKING([XCode path])
683 AC_ARG_WITH(xcode-path,AC_HELP_STRING([--with-xcode=PATH],[Specify XCode path for iOS targets (default=/Developer).]),aros_xcode_path="$withval",aros_xcode_path="/Developer")
684 AC_MSG_RESULT($aros_xcode_path)
686 AC_MSG_CHECKING([for minimum supported iOS version])
687 AC_ARG_WITH(ios-version,AC_HELP_STRING([--with-ios-version=VERSION],[Specify minimum supported iOS version (default=2.0).]),aros_ios_version="$withval",aros_ios_version="2.0")
688 AC_MSG_RESULT($aros_ios_version)
690 AC_MSG_CHECKING([what iOS SDK version to use])
691 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")
692 AC_MSG_RESULT($aros_ios_sdk)
696 #-----------------------------------------------------------------------------
697 AC_MSG_CHECKING([what target variant to enable])
698 AC_ARG_ENABLE(target_variant,AC_HELP_STRING([--enable-target-variant=NAME],[Enable a specific target variant(default=none)]),target_variant=$enableval,target_variant="none")
699 if test "$target_variant" = "none"; then
700     aros_target_variant=""
701     aros_target_suffix=""
702 else
703     aros_target_variant="$target_variant"
704     aros_target_suffix="-$target_variant"
706 AC_MSG_RESULT($enableval)
708 target_bootloader="none"
710 #-----------------------------------------------------------------------------
711 # This is the target configuration switch.
712 case "$target_os" in
713     linux*)
714         aros_target_arch="linux"
715         case "$target_cpu" in
716             *m68k*)
717                 aros_target_cpu="m68k"
718                 aros_object_format="m68kelf"
719                 aros_flavour="emulcompat"
720                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D__mc68000 -D__linux__"
721                 aros_shared_ldflags="-Wl,-T,\$(TOP)/config/linux/m68k/script.so"
722                 aros_kernel_ldflags="-Wl,-rpath,./lib,-T,\$(TOP)/config/linux/m68k/script.normal"
723                 gcc_target_cpu="mc68000"
724                 ;;
725             *i?86*)
726                 aros_target_cpu="i386"
727                 aros_object_format="elf_i386"
728                 aros_flavour="emulation"
729                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__linux__"
730                 aros_config_cflags="$aros_config_cflags -m32 -march=i486"
731                 aros_kernel_cflags="$aros_kernel_cflags -m32 -march=i486"
732                 aros_config_aflags="$aros_config_aflags -m32 -march=i486"
733                 aros_config_ldflags="-m32 -march=i486"
734                 aros_kernel_ldflags="-melf_i386"
735                 aros_default_wbdepth=8
736                 gcc_target_cpu="i386"
737                 ;;
738             *x86_64*)
739                 aros_target_cpu="x86_64"
740                 aros_object_format="elf_x86_64"
741                 aros_flavour="emulation"
742                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64 -D__linux__"
743                 aros_config_cflags="$aros_config_cflags -mno-red-zone"
744                 aros_default_wbdepth=8
745                 gcc_target_cpu="x86_64"
746                 ;;
747             *powerpc*)
748                 aros_target_cpu="ppc"
749                 aros_object_format="elf32ppc"
750                 aros_flavour="emulation"
751                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc -D__linux__"
752                 aros_default_wbdepth=8
753                 gcc_target_cpu="ppc"
754                 ;;
755 # TODO
756 # Same as powerpc, but I need this for the nightly build to work again.
757 # Actually, the nightly should be made working with powerpc target.
758 # That just was too much work for the moment, another week or two.
759             *ppc*)
760                 aros_target_cpu="ppc"
761                 aros_object_format="elf32ppc"
762                 aros_flavour="emulation"
763                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc -D__linux__"
764                 aros_default_wbdepth=8
765                 gcc_target_cpu="ppc"
766                 ;;
767             *arm*)
768                 aros_target_cpu="arm"
769                 aros_object_format="armelf_linux_eabi"
770                 aros_flavour="emulation"
771                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm -D__linux__"
772                 gcc_target_cpu="arm"
773                 aros_config_cflags="$aros_config_cflags -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -fno-asynchronous-unwind-tables -fno-exceptions"
774                 aros_config_aflags="$aros_config_aflags -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -fno-asynchronous-unwind-tables -fno-exceptions"
775                 ;;
776             *)
777                 AC_MSG_ERROR("Unknown CPU for Linux -- $target_cpu")
778                 ;;
779         esac
780     ;;
782     pc)
783         aros_target_arch="pc"
784         aros_shared_default="no"
785         target_bootloader="grub2"
786         case "$target_cpu" in
787             *i?86*)
788                 aros_target_cpu="i386"
790                 dnl If somebody hasn't already set the target object
791                 dnl format, then use this value. Mostly to support
792                 dnl FreeBSD cross-compilation.
793                 dnl TODO: Remove when we always use our compiler.
795                 if test "$aros_object_format" = "" ; then
796                     aros_object_format="elf_i386"
797                 fi
798                 aros_flavour="standalone"
799                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
800                 aros_config_cflags="$aros_config_cflags -m32 -march=i486"
801                 aros_kernel_cflags="$aros_kernel_cflags -m32 -march=i486"
802                 aros_config_aflags="$aros_config_aflags -m32 -march=i486"
803                 aros_config_ldflags="-m32 -march=i486"
804                 aros_kernel_ldflags="-melf_i386"
805                 aros_default_wbwidth=640
806                 aros_default_wbheight=480
807                 gcc_target_cpu="i386"
808                 ;;
809             *x86_64*)
810                 aros_target_cpu="x86_64"
811                 aros_serial_debug=1
812                 if test "$aros_object_format" = "" ; then
813                     aros_object_format="elf_x86_64"
814                 fi
815                 aros_flavour="standalone"
816                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
817                 aros_config_cflags="$aros_config_cflags -fno-asynchronous-unwind-tables -mno-red-zone"
818                 aros_kernel_ldflags=""
819                 aros_default_wbwidth=640
820                 aros_default_wbheight=480
821                 gcc_target_cpu="x86_64"
822                 ;;
823             *)
824                 AC_MSG_ERROR("Unknown native CPU -- $target_cpu")
825                 ;;
826         esac
827         ;;
829     prep)
830         aros_target_arch="prep"
831         aros_shared_default="no"
832         aros_target_cpu="ppc"
833         aros_object_format="elf32ppc"
834         aros_flavour="ppcnative"
835         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
836         aros_kernel_ldflags=""
837         aros_default_wbwidth=640
838         aros_default_wbheight=480
839         gcc_target_cpu="ppc"
840         ;;
842     freebsd*)
843         aros_target_arch="freebsd"
844         aros_target_cpu="i386"
845         aros_flavour="emulation"
846         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
847         gcc_target_cpu="i386"
849         aros_target_strip_flags="-x"
850         ;;
852     darwin*)
853         aros_target_arch="darwin"
854         aros_flavour="emulation"
855         case "$target_cpu" in
856             *i?86*)
857                 aros_target_cpu="i386"
858                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
859                 aros_kernel_cflags="$aros_kernel_cflags -m32"
860                 aros_kernel_ldflags="$aros_kernel_ldflags -m32"
861                 aros_default_wbdepth=8
862                 gcc_target_cpu="i386"
863                 aros_object_format="elf_i386"
864                 aros_target_strip_flags="-x"
865                 aros_target_cc="i386-aros-gcc"
866                 aros_target_cxx="i386-aros-g++"
867                 aros_target_ld="i386-aros-ld"
868                 aros_target_as="i386-aros-as"
869                 aros_target_ar="i386-aros-ar"
870                 aros_target_ranlib="i386-aros-ranlib"
871                 aros_target_nm="i386-aros-nm"
872                 aros_target_strip="i386-aros-strip"
873                 aros_target_objcopy="i386-aros-objcopy"
874                 aros_target_objdump="i386-aros-objdump"
875                 target_tool_prefix="i686-apple-darwin10-"
876                 ;;
877             *x86_64*)
878                 aros_target_cpu="x86_64"
879                 aros_object_format="elf_x86_64"
880                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
881                 aros_kernel_cflags="$aros_kernel_cflags -m64"
882                 aros_kernel_ldflags="$aros_kernel_ldflags -m64"
883                 aros_default_wbdepth=8
884                 gcc_target_cpu="x86_64"
885                 aros_target_cc="x86_64-aros-gcc"
886                 aros_target_cxx="x86_64-aros-g++"
887                 aros_target_ld="x86_64-aros-ld"
888                 aros_target_as="x86_64-aros-as"
889                 aros_target_ar="x86_64-aros-ar"
890                 aros_target_ranlib="x86_64-aros-ranlib"
891                 aros_target_nm="x86_64-aros-nm"
892                 aros_target_strip="x86_64-aros-strip"
893                 aros_target_objcopy="x86_64-aros-objcopy"
894                 aros_target_objdump="x86_64-aros-objdump"
895                 target_tool_prefix="i686-apple-darwin10-"
896                 ;;
897             *ppc*)
898                 aros_target_cpu="ppc"
899                 aros_object_format="elf32_ppc"
900                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
901                 aros_default_wbdepth=8
902                 gcc_target_cpu="ppc"
903                 aros_target_cc="ppc-aros-gcc"
904                 aros_target_cxx="ppc-aros-g++"
905                 aros_target_ld="ppc-aros-ld"
906                 aros_target_as="ppc-aros-as"
907                 aros_target_ar="ppc-aros-ar"
908                 aros_target_ranlib="ppc-aros-ranlib"
909                 aros_target_nm="ppc-aros-nm"
910                 aros_target_strip="ppc-aros-strip"
911                 aros_target_objcopy="ppc-aros-objcopy"
912                 aros_target_objdump="ppc-aros-objdump"
913                 target_tool_prefix="powerpc-apple-darwin10-"
914                 ;;
915             *)
916                 AC_MSG_ERROR("Unsupported target CPU for darwin hosted flavour -- $target_cpu")
917                 ;;
918         esac
919         ;;
921     ios*)
922         aros_target_arch="ios"
923         aros_flavour="emulation"
924         # This is here because it may depend on iOS or SDK version
925         aros_kernel_objcflags="-fobjc-abi-version=2 -fobjc-legacy-dispatch"
926         case "$target_cpu" in
927             *i?86*)
928                 aros_ios_platform="iPhoneSimulator"
929                 aros_target_cpu="i386"
930                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
931                 aros_default_wbdepth=8
932                 gcc_target_cpu="i386"
933                 aros_object_format="elf_i386"
934                 aros_target_strip_flags="-x"
935                 aros_target_cc="i386-aros-gcc"
936                 aros_target_cxx="i386-aros-g++"
937                 aros_target_ld="i386-aros-ld"
938                 aros_target_as="i386-aros-as"
939                 aros_target_ar="i386-aros-ar"
940                 aros_target_ranlib="i386-aros-ranlib"
941                 aros_target_nm="i386-aros-nm"
942                 aros_target_strip="i386-aros-strip"
943                 aros_target_objcopy="i386-aros-objcopy"
944                 aros_target_objdump="i386-aros-objdump"
945                 target_tool_prefix="i686-apple-darwin10-"
946                 target_tool_flags="-m32"
947                 ;;
948             *arm*)
949                 aros_ios_platform="iPhoneOS"
950                 aros_target_cpu="arm"
951                 aros_object_format="armelf_linux_eabi"
952                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
953                 aros_config_cflags="$aros_config_cflags -march=armv6 -mfpu=neon -mfloat-abi=softfp -fno-asynchronous-unwind-tables -fno-exceptions"
954                 aros_config_aflags="$aros_config_aflags -march=armv6 -mfpu=neon -mfloat-abi=softfp -fno-asynchronous-unwind-tables -fno-exceptions"
955                 aros_arch_libs="-laeabi"
956                 aros_default_wbdepth=8
957                 gcc_target_cpu="arm"
958                 aros_kernel_ld="ld -arch armv6"
959                 aros_target_cc="arm-linux-gnueabi-gcc"
960                 aros_target_ld="arm-linux-gnueabi-ld"
961                 aros_target_as="arm-linux-gnueabi-as"
962                 aros_target_ar="arm-linux-gnueabi-ar"
963                 aros_target_ranlib="arm-linux-gnueabi-ranlib"
964                 aros_target_nm="arm-linux-gnueabi-nm"
965                 aros_target_strip="arm-linux-gnueabi-strip"
966                 aros_target_objcopy="arm-linux-gnueabi-objcopy"
967                 aros_target_objdump="arm-linux-gnueabi-objdump"
968                 target_tool_prefix="arm-apple-darwin10-" 
969                 aros_default_wbwidth=320
970                 aros_default_wbheight=480
971                 export PATH="$aros_xcode_path/Platforms/$aros_ios_platform.platform/Developer/usr/bin:$PATH"
972                 ;;
973             *)
974                 AC_MSG_ERROR("Unsupported target CPU for iOS hosted flavour -- $target_cpu")
975                 ;;
976         esac
977         aros_ios_sdk="$aros_xcode_path/Platforms/$aros_ios_platform.platform/Developer/SDKs/$aros_ios_platform$aros_ios_sdk.sdk"
978         target_tool_flags="$target_tool_flags --sysroot $aros_ios_sdk"
979         ;;
981     dragonfly*)
982         aros_target_arch="dragonfly"
983         aros_flavour="emulation"
984         case "$target_cpu" in
985             *i?86*)
986                 aros_target_cpu="i386"
987                 aros_object_format="elf_i386"
988                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__DragonFly__"
989                 ;;
990             *x86_64*)
991                 aros_target_cpu="x86_64"
992                 aros_object_format="elf_x86_64"
993                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64 -D__DragonFly__"
994                 ;;
995             *)
996                 AC_MSG_ERROR("Unknown CPU for DragonFly -- $target_cpu")
997                 ;;
998         esac
999         ;;
1001     netbsd*)
1002         aros_target_arch="netbsd"
1003         case "$target_cpu" in
1004             *m68k*)
1005                 aros_target_cpu="m68k"
1006                 aros_object_format="m68kelf"
1007                 aros_flavour="emulcompat"
1008                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D__mc68000 -D__NetBSD__"
1009                 gcc_target_cpu="mc68000"
1010                 ;;
1011             *i?86*)
1012                 aros_target_cpu="i386"
1013                 aros_object_format="elf_i386"
1014                 aros_flavour="emulation"
1015                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__NetBSD__"
1016                 aros_default_wbdepth=8
1017                 gcc_target_cpu="i386"
1018                 ;;
1019             *)
1020                 AC_MSG_ERROR("Unknown CPU for NetBSD -- $target_cpu")
1021                 ;;
1022         esac
1023         aros_target_genmap="-Wl,-M -Xlinker >"
1024         aros_flavour="emulation"
1025         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1026         ;;   
1028     openbsd*)
1029         aros_target_arch="openbsd"
1030         case "$target_cpu" in
1031             *i?86*)
1032                 aros_target_cpu="i386"
1033                 aros_object_format="elf_i386"
1034                 aros_flavour="emulation"
1035                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__OpenBSD__"
1036                 gcc_target_cpu="i386"
1037                 ;;
1038             *)
1039                 AC_MSG_ERROR("Unknown CPU for OpenBSD -- $target_cpu")
1040                 ;;
1041         esac
1042         aros_target_genmap="-Wl,-M -Xlinker >"
1043         aros_target_nm_flags="-u"
1044         aros_flavour="emulation"
1045         ;;
1047     solaris*)
1048         aros_target_arch="solaris"
1049         case "$target_cpu" in
1050            *i?86*)
1051                aros_target_cpu="i386"
1052                aros_object_format="elf_i386"
1053                aros_flavour="emulation"
1054                aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__Solaris__"
1055                aros_default_wbdepth=8
1056                gcc_target_cpu="i386"
1057                ;;
1058             *sparc*)
1059                 aros_target_cpu="sparc"
1060                 aros_object_format="elf_sparc"
1061                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dsparc -D__Solaris__"
1062                 gcc_target_cpu="sparc"
1063                 ;;
1064             *)
1065                 AC_MSG_ERROR("Unknown CPU for Solaris -- $target_cpu")
1066                 ;;
1067         esac
1068         aros_config_cflags="$aros_config_cflags -D$aros_target_cpu"
1069         aros_flavour="emulation"
1070         ;;
1072     morphos*)
1073         aros_target_arch="morphos"
1074         aros_shared_default="no"
1075         aros_target_cpu="ppc"
1076         aros_object_format="elf_ppc"
1077         aros_flavour="nativecompat"
1078         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1079         gcc_target_cpu="ppc"
1080         ;;
1082     sam440)
1083         aros_target_arch="sam440"
1084         aros_shared_default="no"
1085         aros_target_cpu="ppc"
1086         aros_object_format="elf32ppc"
1087         aros_flavour="ppcnative"
1088         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1089         aros_kernel_ldflags=""
1090         aros_default_wbwidth=1024
1091         aros_default_wbheight=768
1092         aros_default_wbdepth=24
1093         aros_config_cflags="$aros_config_cflags -mcpu=440fp -mno-toc -fno-asynchronous-unwind-tables"
1094         gcc_target_cpu="powerpc"
1095         ;;
1097     efika)
1098         aros_target_arch="efika"
1099         aros_shared_default="no"
1100         aros_target_cpu="arm"
1101         aros_object_format="armelf_linux_eabi"
1102         aros_flavour="standalone"
1103         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
1104         aros_kernel_ldflags=""
1105         aros_default_wbwidth=1024
1106         aros_default_wbheight=600
1107         aros_arch_libs="-laeabi"
1108         aros_config_cflags="$aros_config_cflags -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -fno-asynchronous-unwind-tables -fno-exceptions -fno-strict-aliasing"
1109         aros_config_aflags="$aros_config_aflags -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -fno-asynchronous-unwind-tables -fno-exceptions -fno-strict-aliasing"
1110         ;;
1111         
1112     chrp)
1113     aros_target_arch="chrp"
1114     aros_shared_default="no"
1115     aros_target_cpu="ppc"
1116     aros_object_format="elf32ppc"
1117     aros_flavour="ppcnative"
1118     aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1119     aros_kernel_ldflags=""
1120     aros_default_wbwidth=640
1121     aros_default_wbheight=480
1122     aros_config_cflags="$aros_config_cflags -mno-toc -fno-asynchronous-unwind-tables"    
1123     gcc_target_cpu="powerpc"
1124         case "$aros_target_variant" in
1125             efika)
1126             aros_config_cflags="$aros_config_cflags -DBIG_ENDIAN_OHCI=1 -mcpu=603e"
1127             ;;
1128         esac
1129     ;;
1131     amiga*)
1132         aros_target_arch="amiga"
1133         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D_AMIGA -DAMIGA"
1134         aros_shared_default="no"
1136         case "$target_cpu" in
1137             *m68k-eabi)
1138                 aros_target_cpu="m68k"
1139                 aros_object_format="m68kelf"
1140                 aros_flavour="standalone"
1141                 gcc_target_cpu="mc68000"
1142                 aros_config_cflags="$aros_config_cflags -g3 -fno-strict-aliasing -ffreestanding -fomit-frame-pointer -${gcc_target_cpu} -fbuiltin"
1143                 aros_config_aflags="$aros_config_aflags -g3 -fno-strict-aliasing -ffreestanding -fomit-frame-pointer -${gcc_target_cpu}"
1144                 aros_debug_cflags="-Wall -Werror-implicit-function-declaration $aros_symbols_debug  $aros_messages_debug -${gcc_target_cpu}"
1145                 target_tool_prefix="m68k-elf-"
1146                 aros_target_nostdlib_ldflags="" # We always need -lgcc
1147                 aros_target_strip_flags="-R.comment"
1148                 ;;
1149             *m68k*)
1150                 aros_target_cpu="m68k"
1151                 aros_object_format="m68kelf"
1152                 aros_flavour="standcompat"
1153                 gcc_target_cpu="mc68000"
1154                 aros_config_cflags="$aros_config_cflags -g3 -fno-strict-aliasing -ffreestanding -fomit-frame-pointer -${gcc_target_cpu} -fbuiltin"
1155                 aros_config_aflags="$aros_config_aflags -g3 -fno-strict-aliasing -ffreestanding -fomit-frame-pointer -${gcc_target_cpu}"
1156                 aros_debug_cflags="-Wall -Werror-implicit-function-declaration $aros_symbols_debug  $aros_messages_debug -${gcc_target_cpu}"
1157                 target_tool_prefix="m68k-elf-"
1158                 aros_target_nostdlib_ldflags="" # We always need -lgcc
1159                 aros_target_strip_flags="-R.comment"
1160                 ;;
1161             *ppc*)
1162                 aros_cpu="ppc"
1163                 aros_flavour="native"
1164                 gcc_target_cpu="ppc"
1165                 ;;
1166             *)
1167                 AC_MSG_ERROR("Unknown CPU for Amiga $target_cpu")
1168                 ;;
1169         esac
1170         ;;
1172     mingw*)
1173         aros_target_arch="mingw32"
1174         aros_shared_default="no"
1175         aros_flavour="emulation"
1176         aros_shared_cflags=""
1177         need_dlopen="no"
1178         rescomp="windres"
1179         case "$target_cpu" in
1180             *i?86*)
1181                 aros_target_cpu="i386"
1182                 aros_object_format="elf_i386"
1183                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1184                 aros_default_wbdepth=8
1185                 gcc_target_cpu="i386"
1186                 aros_target_cc="i386-aros-gcc"
1187                 aros_target_cxx="i386-aros-g++"
1188                 aros_target_ld="i386-aros-ld"
1189                 aros_target_as="i386-aros-as"
1190                 aros_target_ar="i386-aros-ar"
1191                 aros_target_ranlib="i386-aros-ranlib"
1192                 aros_target_nm="i386-aros-nm"
1193                 aros_target_strip="i386-aros-strip"
1194                 aros_target_objcopy="i386-aros-objcopy"
1195                 aros_target_objdump="i386-aros-objdump"
1196                 target_tool_prefix="i386-mingw32-"
1197                 ;;
1198             *x86_64*)
1199                 aros_target_cpu="x86_64"
1200                 aros_object_format="elf_x86_64"
1201                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
1202                 aros_default_wbdepth=8
1203                 gcc_target_cpu="x86_64"
1204                 aros_target_cc="x86_64-aros-gcc"
1205                 aros_target_cxx="x86_64-aros-g++"
1206                 aros_target_ld="x86_64-aros-ld"
1207                 aros_target_as="x86_64-aros-as"
1208                 aros_target_ar="x86_64-aros-ar"
1209                 aros_target_ranlib="x86_64-aros-ranlib"
1210                 aros_target_nm="x86_64-aros-nm"
1211                 aros_target_strip="x86_64-aros-strip"
1212                 aros_target_objcopy="x86_64-aros-objcopy"
1213                 aros_target_objdump="x86_64-aros-objdump"
1214                 target_tool_prefix="x86_64-w64-mingw32-"
1215                 ;;
1216             *arm*)
1217                 aros_target_cpu="arm"
1218                 aros_object_format="armelf_linux_eabi"
1219                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
1220                 aros_default_wbdepth=8
1221                 gcc_target_cpu="arm"
1222                 aros_target_cc="arm-linux-gnueabi-gcc"
1223                 aros_target_ld="arm-linux-gnueabi-ld"
1224                 aros_target_as="arm-linux-gnueabi-as"
1225                 aros_target_ar="arm-linux-gnueabi-ar"
1226                 aros_target_ranlib="arm-linux-gnueabi-ranlib"
1227                 aros_target_nm="arm-linux-gnueabi-nm"
1228                 aros_target_strip="arm-linux-gnueabi-strip"
1229                 aros_target_objcopy="arm-linux-gnueabi-objcopy"
1230                 aros_target_objdump="arm-linux-gnueabi-objdump"
1231                 target_tool_prefix="arm-mingw32ce-"
1232                 aros_default_wbwidth=160
1233                 aros_default_wbheight=160
1234                 ;;
1235             *)
1236                 AC_MSG_ERROR("Unknown CPU for Mingw32 -- $target_cpu")
1237                 ;;
1238         esac
1239         if test $host_os = "cygwin"; then
1240                 aros_kernel_cflags="-mno-cygwin"
1241         fi
1242     ;;
1243     pp*)
1244         aros_target_arch="pp"
1245         aros_shared_default="no"
1246         case "$target_cpu" in
1247             *m68k*)
1248                 aros_target_cpu="m68k"
1249                 aros_object_format="m68kelf"
1250                 aros_flavour="palmnative"
1251                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
1252                 aros_default_wbwidth=160
1253                 aros_default_wbheight=160
1254                 aros_default_wbdepth=1
1255                 aros_target_ar_flags="cru"
1256                 aros_compiler_libs="-lgcc1"
1257                 aros_shared_default=no
1258                 aros_shared_cflags="-fpic"
1259                 aros_shared_aflags=""
1260                 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
1261                 aros_kernel_ldflags="-Wl,-rpath,./lib"
1262                 aros_debug_cflags="-Wall -Werror-implicit-function-declaration $aros_symbols_debug  $aros_messages_debug -mc68000 -Wa,-mc68000"
1263                 aros_debug_aflags=""
1264                 aros_debug_ldflags="$aros_symbols_debug"
1265                 aros_mungwall_debug="0"
1266                 aros_modules_debug="0"
1267                 gcc_target_cpu="mc68000"
1268                 ignore_undefined_symbols="-ius"
1269                 ;;
1270            *)
1271                 AC_MSG_ERROR("Unknown CPU for PalmPilot -- $target_cpu")
1272                 ;;
1273         esac
1274         ;;
1276     mac*)
1277         aros_target_arch="mac"
1278         aros_shared_default="no"
1279         case "$target_cpu" in
1280             *m68k*)
1281                 aros_target_cpu="m68k"
1282                 aros_object_format="m68kelf"
1283                 aros_flavour="mac68knative"
1284                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
1285                 aros_default_wbwidth=512
1286                 aros_default_wbheight=384
1287                 aros_default_wbdepth=8
1288                 aros_target_ar_flags="cru"
1289                 aros_compiler_libs="-lgcc1"
1290                 aros_shared_default=no
1291                 aros_shared_cflags="-fpic"
1292                 aros_shared_aflags=""
1293                 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
1294                 aros_kernel_ldflags="-Wl,-rpath,./lib"
1295                 aros_debug_cflags="-Wall -Werror-implicit-function-declaration $aros_symbols_debug  $aros_messages_debug -mc68000"
1296                 aros_debug_aflags=""
1297                 aros_debug_ldflags="$aros_symbols_debug"
1298                 aros_mungwall_debug="0"
1299                 aros_modules_debug="0"
1300                 gcc_target_cpu="mc68000"
1301                 ignore_undefined_symbols="-ius"
1302                 ;;
1303            *)
1304                 AC_MSG_ERROR("Unknown CPU for Mac68k -- $target_cpu")
1305                 ;;
1306         esac
1307         ;;
1309     *)
1310         AC_MSG_ERROR([Unsupported target architecture $target])
1311         ;;
1312 esac
1314 AC_MSG_CHECKING([Where to download sourcecode for external ports])
1315 AC_ARG_WITH(portssources,AC_HELP_STRING([--with-portssources=DIR],[Where to download sourcecode for external ports]),with_portssrcdir=$withval,with_portssrcdir="default")
1316 if test "$with_portssrcdir" = "default"; then
1317     AROS_PORTSSRCDIR="$AROS_BUILDDIR_UNIX/bin/Sources"
1318 else
1319     AROS_PORTSSRCDIR="$with_portssrcdir"
1321 AC_MSG_RESULT($AROS_PORTSSRCDIR)
1323 AC_MSG_CHECKING([which bootloader to use])
1324 AC_ARG_WITH(bootloader,AC_HELP_STRING([--with-bootloader=NAME],[Use a specific bootloader]),target_bootloader=$withval,target_bootloader=$target_bootloader)
1325 if test "$target_bootloader" = "none"; then
1326     aros_target_bootloader=""
1327 else
1328     aros_target_bootloader="$target_bootloader"
1330 AC_MSG_RESULT($target_bootloader)
1332 AC_MSG_CHECKING([which icon-set to use])
1333 AC_ARG_WITH(iconset,AC_HELP_STRING([--with-iconset=NAME],[Use a specific Icon-set (default=Gorilla).]),target_iconset=$withval,target_iconset="default")
1334 if test "$target_iconset" = "default"; then
1335     aros_target_iconset="Gorilla"
1336     target_iconset="default (Gorilla)"
1337 else
1338     aros_target_iconset="$target_iconset"
1340 AC_MSG_RESULT($target_iconset)
1342 AC_MSG_CHECKING([which GUI Theme to use])
1343 AC_ARG_WITH(theme,AC_HELP_STRING([--with-theme=NAME],[Use a specific GUI Theme]),target_guitheme=$withval,target_guitheme="default")
1344 if test "$target_guitheme" = "default"; then
1345     aros_target_guitheme="Ice"
1346 else
1347     aros_target_guitheme="$target_guitheme"
1349 AC_MSG_RESULT($aros_target_guitheme)
1351 # Find out if we are cross-compiling (i.e. if we can't use the host compiler
1352 # for target code)
1353 cross_compiling=no
1354 if test "$aros_host_cpu" != "$aros_target_cpu" ; then
1355     cross_compiling=yes
1357 if test "$aros_host_cpu" == "x86_64" ; then
1358     if test "$aros_target_cpu" == "i386" ; then
1359         if test "$aros_target_arch" != "mingw32"; then
1360             cross_compiling=no
1361         fi
1362     fi
1365 # Set prefix for target compiler etc. if we're cross-compiling
1366 # (should possibly be earlier but needs to be after AC_PROG_CC)
1367 if test "$cross_compiling" = "yes" ; then
1368     if test "$target_tool_prefix" = ""; then
1369         target_tool_prefix=${target_cpu}-elf-
1370     fi
1371     CC=${target_tool_prefix}gcc
1372     if test "$target_tool_version" != "default"; then
1373         CC="$CC-$target_tool_version"
1374     fi
1375     AC_PATH_PROG(CC,$CC)
1376     AROS_REQUIRED(gcc,$CC)
1378 CC="$CC $target_tool_flags"
1380 #-----------------------------------------------------------------------------
1382 # Disable pointer-signedness warnings if the compiler recognises the option
1384 AC_MSG_CHECKING([whether ${CC} accepts -Wno-pointer-sign])
1385 save_cflags="$CFLAGS"
1386 CFLAGS="$CFLAGS -Wno-pointer-sign"
1387 AC_TRY_COMPILE(,, use_no_sign_warning="yes", use_no_sign_warning="no")
1388 AC_MSG_RESULT($use_no_sign_warning)
1389 if test "x-$use_no_sign_warning" = "x-yes" ; then
1390     aros_config_cflags="$aros_config_cflags -Wno-pointer-sign"
1392 CFLAGS="$save_cflags"
1394 #-----------------------------------------------------------------------------
1396 # Find all the tools we need to compile. This could be cross-compiling
1397 # though! If that is the case we use the GNU form of the target and
1398 # simply add this to the front of the binary name. This is rather simple,
1399 # but it should work under most circumstances.
1401 # The default tools are to use the same as the host, but only if the
1402 # host and target CPU are the same. With GCC this is normally enough.
1405 aros_cc_pre=""
1406 aros_shared_ld="$aros_host_ld"
1408 aros_target_mkdep="$aros_host_mkdep"
1409 aros_target_incl_def="$aros_host_incl"
1411 aros_kernel_cc="$CC"
1413 # The default tools executables to be linked to.
1414 if test "$aros_target_cc" != ""; then
1415     AC_PATH_PROG(aros_target_cc,$aros_target_cc)
1416     AROS_REQUIRED(gcc,$aros_target_cc)
1418 if test "$aros_target_ld" != ""; then
1419     AC_PATH_PROG(aros_target_ld,$aros_target_ld)
1420     AROS_REQUIRED(ld,$aros_target_ld)
1423 if test "$crosstools" != "yes"; then
1424     AROS_TOOL_TARGET(aros_target_as_ln,as,$aros_target_as)
1425     AROS_REQUIRED(as,$aros_target_as_ln)
1426     AROS_TOOL_TARGET(aros_kernel_ld,ld,$aros_kernel_ld)
1427     AROS_REQUIRED(ld,$aros_kernel_ld)
1428     AROS_TOOL_TARGET(aros_target_ar_ln,ar,$aros_target_ar)
1429     AROS_REQUIRED(ar,$aros_target_ar_ln)
1430     AROS_TOOL_TARGET(aros_target_nm_ln,nm,$aros_target_nm)
1431     AROS_REQUIRED(nm,$aros_target_nm_ln)
1432     AROS_TOOL_TARGET(aros_target_objcopy_ln,objcopy,$aros_target_objcopy)
1433     AROS_REQUIRED(objcopy,$aros_target_objcopy_ln)
1434     AROS_TOOL_TARGET(aros_target_objdump_ln,objdump,$aros_target_objdump)
1435     AROS_REQUIRED(objdump,$aros_target_objdump_ln)
1436     AROS_TOOL_TARGET(aros_target_ranlib_ln,ranlib,$aros_target_ranlib)
1437     AROS_REQUIRED(ranlib,$aros_target_ranlib_ln)
1438     AROS_TOOL_TARGET(aros_target_strip_ln,strip,$aros_target_strip)
1439     AROS_REQUIRED(strip,$aros_target_strip_ln)
1440     if test "$aros_target_cxx" != ""; then
1441         AC_PATH_PROG(aros_target_cxx,$aros_target_cxx)
1442 # Temporarily disabled in order to let Mingw32-hosted nightly build to work
1443 #       AROS_REQUIRED(c++,$aros_target_cxx)
1444     fi
1445 else
1446 # Cancel preinstalled C++ compiler because it will be built as part of crosstools
1447     aros_target_cxx=""
1450 # Build crosstools if we have no C++ - temporary thing 
1451 if test "$aros_target_cxx" = ""; then
1452     crosstools_target=tools-crosstools
1455 if test "$rescomp" != ""; then
1456     if test "$cross_compiling" = "yes" ; then
1457         rescomp=${target_tool_prefix}${rescomp}
1458     fi
1459     AC_PATH_PROG(aros_kernel_rescomp,$rescomp)
1460     AROS_REQUIRED($rescomp,$aros_kernel_rescomp)
1463 aros_hostcfg_dir="bin/${aros_host_arch}-${aros_host_cpu}/gen/config"
1464 aros_targetcfg_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/config"
1465 aros_inc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/AROS/Development/include/aros"
1466 aros_gendir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen"
1467 aros_geninc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/include/aros"
1468 aros_tools_dir="bin/${aros_host_arch}-${aros_host_cpu}/tools"
1469 aros_scripts_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/scripts"
1471 # aros_cc_pre is a variable that is added to the front of the compiler name
1472 # in the generated aros-gcc shell script. We need this to enable the cache
1473 # to work across cleaned builds. Also, support DISTCC using the correct
1474 # environment variable.
1477 if test "x${DISTCC}" != "x" ; then
1478     if test "x${CCACHE}" != "x" ; then
1479         aros_cc_pre="env CCACHE_PREFIX=${DISTCC} ${CCACHE} "
1480     else
1481         aros_cc_pre="${DISTCC} "
1482     fi
1483 else
1484     if test "x${CCACHE}" != "x" ; then
1485         aros_cc_pre="${CCACHE} "
1486     fi
1489 prefix="${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros"
1491 AC_SUBST(aros_target_nostdinc_cflags,-nostdinc)
1492 AC_SUBST(aros_target_nostartup_ldflags,-nostartfiles)
1493 AC_SUBST(aros_target_nix_ldflags,-nix)
1494 AC_SUBST(aros_target_detach_ldflags,-detach)
1495 AC_SUBST(aros_target_nostdlib_ldflags,-nostdlib)
1497 # Target tools
1498 if test "$aros_target_cc" = ""; then
1499     orig_target_cc=$aros_kernel_cc
1500 else
1501     orig_target_cc=$aros_target_cc
1503 if test "$aros_target_ld" = ""; then
1504     orig_target_ld=$aros_kernel_ld
1505 else
1506     orig_target_ld=$aros_target_ld
1508 if test "$GCC" = "yes"; then
1509     aros_target_cc_path=`$orig_target_cc -print-search-dirs | grep "programs: =" | cut -c 12-`
1511 aros_target_cc="${prefix}-gcc"
1512 aros_target_as="${prefix}-as"
1513 aros_target_ld="${prefix}-ld"
1514 aros_target_ar="${prefix}-ar $aros_target_ar_flags"
1515 aros_target_objcopy=${prefix}-objcopy
1516 aros_target_objdump=${prefix}-objdump
1517 aros_target_ranlib="${prefix}-ranlib $aros_target_ranlib_flags"
1518 aros_target_nm="${prefix}-nm $aros_target_nm_flags"
1519 aros_kernel_nm="${prefix}-nm"
1520 aros_target_strip=${prefix}-strip
1522 # Find the system include path. We can suggest that an alternative is
1523 # used if we don't get it correct. The default is to use /usr/include.
1524 # Which is set in the aros_target_incl_def variable.
1526 AC_ARG_ENABLE(includes,
1527 AC_HELP_STRING([--enable-includes=dir],[Alternative system include directory]),
1528 [aros_target_incl=$enable_includes], [aros_target_incl=$aros_target_incl_def])
1530 dnl find out about the target cc's include path
1531 AC_MSG_CHECKING([for the target compiler's include path])
1532 if test "$aros_target_cc_includes" = "" ; then
1533     #try to guess where the directory is
1534     aros_target_cc_includes=`dirname \`${orig_target_cc} -print-libgcc-file-name\``/include
1535     if ! test -d $aros_target_cc_includes; then
1536         #the directory doesn't exist, we need to do some more work
1537         aros_target_cc_includes=${PWD}/${aros_gendir}/cc_include
1538         
1539         #these are the headers we're looling for
1540         headers="limits.h mmintrin.h stdbool.h syslimits.h float.h \
1541                  stddef.h xmmintrin.h iso646.h stdarg.h unwind.h   \
1542                  zutil.h"
1544         dirs=
1545         for h in $headers; do
1546             #which other headers each of the above headers needs?
1547             deps=$(echo "#include <$h>" | \
1548                    $aros_host_cc -E -M - 2>/dev/null | \
1549                    sed 's/^.*://; s/\\$/ /g; s/[[ \t]]\+/ /g')
1550             
1551             #copy all the needed headers to a directory beneath gendir
1552             for d in $deps; do
1553                 h=$(basename $d)
1554                 dir=${aros_target_cc_includes}$(echo $(dirname $d) | \
1555                                                 sed -n "s,^.*/include\(/.*\),\1,p")
1556                 ! test -d $dir && mkdir -p $dir
1557                 ! test -f $dir/$h && { cp $d $dir; chmod u+w $dir/$h; }
1558             done
1559         done        
1560     fi
1562 AC_MSG_RESULT($aros_target_cc_includes)
1565 # For GCC < 4.0 -I- is used for giving the search path for '#include "..."'
1566 # On GCC >= 4.0 -iquote should be used
1569 save_cc="$CC"
1570 save_cflags="$CFLAGS"
1571 CFLAGS="-iquote."
1572 AC_MSG_CHECKING([whether ${CC} accepts -iquote])
1573 AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
1574 AC_MSG_RESULT($has_iquote)
1575 if test "x-$has_iquote" = "x-yes" ; then
1576     host_cflags_iquote=-iquote
1577     host_cflags_iquote_end=
1578 else
1579     host_cflags_iquote=-I
1580     host_cflags_iquote_end=-I-
1582 kernel_cflags_iquote=$host_cflags_iquote
1583 kernel_cflags_iquote_end=$host_cflags_iquote_end
1584 if test "x-$cross_compiling" = "x-yes"; then
1585     CC="$aros_kernel_cc"
1586     AC_MSG_CHECKING([whether ${CC} accepts -fno-stack-protector])
1587     AC_TRY_COMPILE(,, use_no_stack_protector="yes", use_no_stack_protector="no")
1588     AC_MSG_RESULT($use_no_stack_protector)
1589     AC_MSG_CHECKING([whether ${CC} accepts -iquote])
1590     AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
1591     AC_MSG_RESULT($has_iquote)
1592     if test "x-$has_iquote" = "x-yes" ; then
1593         kernel_cflags_iquote=-iquote
1594         kernel_cflags_iquote_end=
1595     else
1596         kernel_cflags_iquote=-I
1597         kernel_cflags_iquote_end=-I-
1598     fi
1600 aros_cflags_iquote=$kernel_cflags_iquote
1601 aros_cflags_iquote_end=$kernel_cflags_iquote_end
1602 if test "$orig_target_cc" != "$aros_kernel_cc"; then
1603     CC="$orig_target_cc"
1604     AC_MSG_CHECKING([whether ${CC} accepts -iquote])
1605     AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
1606     AC_MSG_RESULT($has_iquote)
1607     if test "x-$has_iquote" = "x-yes" ; then
1608         aros_cflags_iquote=-iquote
1609         aros_cflags_iquote_end=
1610     else
1611         aros_cflags_iquote=-I
1612         aros_cflags_iquote_end=-I-
1613     fi
1615 if test "x-$use_no_stack_protector" = "x-yes" ; then
1616     aros_kernel_cflags="$aros_kernel_cflags -fno-stack-protector"
1619 #-----------------------------------------------------------------------------
1621 # Check if we can explicitly choose older version of symbol hashing
1623 CFLAGS="save_cflags -Wl,--hash-style=sysv"
1624 CC="$aros_kernel_cc"
1625 AC_MSG_CHECKING([whether ${CC} accepts -Wl,--hash-style=sysv])
1626 AC_TRY_LINK(,, use_hash_style="yes", use_hash_style="no")
1627 AC_MSG_RESULT($use_hash_style)
1628 if test "x-$use_hash_style" = "x-yes" ; then
1629     aros_kernel_cflags="$aros_kernel_cflags -Wl,--hash-style=sysv"
1631 CC="$save_cc"
1632 CFLAGS="$save_cflags"
1634 AC_SUBST(host_cflags_iquote)
1635 AC_SUBST(host_cflags_iquote_end)
1636 AC_SUBST(kernel_cflags_iquote)
1637 AC_SUBST(kernel_cflags_iquote_end)
1638 AC_SUBST(aros_cflags_iquote)
1639 AC_SUBST(aros_cflags_iquote_end)
1642 dnl Check if user specified --with-resolution=XRESxYRESxDEPTH
1643 AC_MSG_CHECKING([for default resolution of WBScreen])
1644 AC_ARG_WITH(resolution,AC_HELP_STRING([--with-resolution=XRESxYRESxDEPTH],[Default resolution of the initial WorkbenchScreen]),resolution=$withval,resolution=none)
1645 # We require an argument, so map --with/--without ("yes"/"no") to "none" specified
1646 if test "$resolution" = "yes" ; then
1647     resolution="none"
1649 if test "$resolution" = "no" ; then
1650     resolution="none"
1652 if test "$resolution" != "none" ; then
1653     aros_default_wbwidth=`echo $resolution | cut -d'x' -f1`
1654     aros_default_wbheight=`echo $resolution | cut -d'x' -f2`
1655     aros_default_wbdepth=`echo $resolution | cut -d'x' -f3`
1657 AC_MSG_RESULT($aros_default_wbwidth x $aros_default_wbheight x $aros_default_wbdepth)
1658 aros_cv_default_wbwidth=$aros_default_wbwidth
1659 aros_cv_default_wbheight=$aros_default_wbheight
1660 aros_cv_default_wbdepth=$aros_default_wbdepth
1662 dnl See if the user wants the serial debug output for native flavour
1663 AC_MSG_CHECKING([if serial debug is enabled])
1664 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)
1665 if test "$aros_serial_debug" = 0 ; then
1666     serial_debug_forced=""
1667     if test "$serial_debug" = "yes" ; then
1668         serial_debug="2"
1669     fi
1670     if test "$serial_debug" = "no" ; then
1671         serial_debug="none"
1672     fi
1673 else
1674     serial_debug_forced="(forced)"
1675     serial_debug=$aros_serial_debug
1677 if test "$serial_debug" != "none" ; then
1678     aros_serial_debug=$serial_debug
1679     AC_MSG_RESULT($serial_debug_forced on port $serial_debug)
1680 else
1681     AC_MSG_RESULT(no)
1684 dnl See if the user wants the palm debug output hack for palm native flavour
1685 AC_MSG_CHECKING([if palm debug hack is enabled])
1686 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")
1687 if test "$palm_debug_hack" = "yes" ; then
1688     aros_palm_debug_hack="1"
1690 AC_MSG_RESULT($palm_debug_hack)
1693 dnl See if the user wants nesting supervisor activated for unix flavour
1694 AC_MSG_CHECKING([if nesting supervisor support is enabled])
1695 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")
1696 if test "$nesting_supervisor" = "yes" ; then
1697     aros_nesting_supervisor="1"
1699 AC_MSG_RESULT($nesting_supervisor)
1702 dnl things specifically required for hosted flavours
1703 if test "x-$aros_flavour" = "x-emulation" -o "x-$aros_flavour" = "x-emulcompat" ; then
1705     if test "x-$need_dlopen" != "x-no" ; then
1706       dnl some kind of dynamic library access system is required for hostlib.resource
1707       AC_CHECK_FUNC(dlopen, have_dl="yes", have_dl="no")
1708       if test "x-$have_dl" = "x-no" ; then
1709           AC_CHECK_LIB(dl, dlopen, [have_dl="yes"
1710                                     aros_host_ldflags="$aros_host_ldflags -ldl"],
1711                                     have_dl="no")
1712       fi
1713       if test "x-$have_dl" = "x-no" ; then
1714           AC_MSG_ERROR([dlopen() dynamic linker functions not available])
1715       fi
1716     fi
1719     dnl x11 hidd
1720     AC_ARG_ENABLE(x11_hidd, AC_HELP_STRING([--enable-x11-hidd],
1721                                            [build X11 hidd for hosted (default=auto)]),
1722                                            x11_hidd="$enableval",
1723                                            x11_hidd="auto")
1724     case "x-$x11_hidd" in
1725         x-yes|x-no|x-auto)                 ;;
1726         *)                 x11_hidd="auto" ;;
1727     esac
1729     ENABLE_X11=0
1731     dnl they want it
1732     if test "x-$x11_hidd" != "x-no" ; then
1734         dnl find x11 stuff
1735         AC_PATH_X
1737         x_cflags=
1738         for path in $x_libraries
1739         do
1740             x_cflags="$x_cflags -L$path"
1741         done
1743         for path in $x_includes
1744         do
1745             x_cflags="$x_cflags -I$path"
1746         done
1747         
1748         if test "x-$no_x" = "x-yes" ; then
1750             dnl didn't find it
1751             if test "x-$x11_hidd" != "x-auto" ; then
1752                 dnl and they explicitly asked for it, bail out
1753                 AC_MSG_ERROR([X11 libs/headers not found, cannot build X11 hidd as requested])
1754             fi
1755         
1756         else
1757             dnl found it, setup the metatarget
1758             x11_hidd_target=kernel-x11gfx-kobj
1759             ENABLE_X11=1
1761             dnl setup shared memory extensions
1762             AC_ARG_ENABLE(x11_shm, AC_HELP_STRING([--enable-x11-shm],
1763                                                   [use X11 shared memory (default=auto)]),
1764                                                   x11_hidd_shm="$enableval",
1765                                                   x11_hidd_shm="auto")
1766             case "x-$x11_hidd_shm" in
1767                 x-yes|x-no|x-auto)                     ;;
1768                 *)                 x11_hidd_shm="auto" ;;
1769             esac
1771             have_xshm=no
1773             dnl they want it
1774             if test "x-$x11_hidd_shm" != "x-no" ; then
1776                 dnl system shm headers
1777                 AC_CHECK_HEADERS(sys/ipc.h)
1778                 AC_CHECK_HEADERS(sys/shm.h)
1780                 dnl got them
1781                 if test "x-$ac_cv_header_sys_ipc_h" = "x-yes" -a "x-$ac_cv_header_sys_shm_h" = "x-yes" ; then
1783                     dnl make sure X libs have shm functions
1784                     save_cflags="$CFLAGS"
1785                     CFLAGS="$CFLAGS $x_cflags"
1786                     AC_CHECK_LIB(Xext, XShmQueryExtension, have_xshm=yes)
1787                     CFLAGS="$save_cflags"
1788                 fi
1789             fi
1791             dnl detection done, prepare output
1792             if test "x-$have_xshm" = "x-yes" ; then
1793                 dnl we can do shm
1794                 DO_XSHM_SUPPORT="1"
1795             elif test "x-$x11_hidd_shm" = "x-yes" ; then
1796                 dnl they explicitly asked for it, but we can't do it
1797                 AC_MSG_ERROR([X11 has no support for shared memory, cannot enable it as requested])
1798             else
1799                 dnl otherwise just disable it
1800                 DO_XSHM_SUPPORT="0"
1801             fi
1803             
1804             dnl setup vidmode (fullscreen) extensions
1805             AC_ARG_ENABLE(x11_vidmode, AC_HELP_STRING([--enable-x11-vidmode],
1806                                                       [use X11 vidmode extension (default=auto)]),
1807                                                       x11_hidd_vidmode="$enableval",
1808                                                       x11_hidd_vidmode="auto")
1809             case "x-$x11_hidd_vidmode" in
1810                 x-yes|x-no|x-auto)                         ;;
1811                 *)                 x11_hidd_vidmode="auto" ;;
1812             esac
1814             have_vidmode=no
1816             dnl they want it
1817             if test "x-$x11_hidd_vidmode" != "x-no" ; then
1819                 dnl make sure X libs have vidmode functions
1820                 save_cflags="$CFLAGS"
1821                 CFLAGS="$CFLAGS $x_cflags"
1822                 AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryExtension, have_vidmode=yes)
1823                 CFLAGS="$save_cflags"
1824             fi
1826             dnl detection done, prepare output
1827             if test "x-$have_vidmode" = "x-yes" ; then
1828                 dnl we can do vidmode
1829                 DO_VIDMODE_SUPPORT="1"
1830             elif test "x-$x11_hidd_vidmode" = "x-yes" ; then
1831                 dnl they explicitly asked for it, but we can't do it
1832                 AC_MSG_ERROR([X11 vidmode extension not available, cannot enable it as requested])
1833             else
1834                 dnl otherwise just disable it
1835                 DO_VIDMODE_SUPPORT="0"
1836             fi
1837         fi
1839         aros_host_x11_includes=$x_includes 
1840         aros_host_x11_libdirs=$x_libraries
1841     fi
1844     dnl sdl hidd
1845     AC_ARG_ENABLE(sdl_hidd, AC_HELP_STRING([--enable-sdl-hidd],
1846                                            [build SDL hidd for hosted (default=auto)]),
1847                                            sdl_hidd="$enableval",
1848                                            sdl_hidd="auto")
1849     case "x-$sdl_hidd" in
1850         x-yes|x-no|x-auto)                 ;;
1851         *)                 sdl_hidd="auto" ;;
1852     esac
1854     dnl they want it
1855     if test "x-$sdl_hidd" != "x-no" ; then
1857         dnl find sdl
1858         AM_PATH_SDL([1.2.10], have_sdl="yes", have_sdl="no")
1860         if test "x-$have_sdl" != "x-yes" ; then
1862             dnl didn't find it
1863             if test "x-$sdl_hidd" != "x-auto" ; then
1864                 dnl and they explicitly asked for it, bail out
1865                 AC_MSG_ERROR([SDL libs/headers not found, cannot build SDL hidd as requested])
1866             fi
1868         else
1869             dnl found it, set up the metatarget
1870             sdl_hidd_target=kernel-hidd-sdl
1871             aros_host_sdl_cflags=SDL_CFLAGS
1872             aros_host_sdl_libs=SDL_LIBS
1873         fi
1874     fi
1879 dnl See if the user wants dbus.library
1880 AC_MSG_CHECKING([if building of dbus.library is enabled])
1881 AC_ARG_ENABLE(dbus,AC_HELP_STRING([--enable-dbus],[Enable DBUS support via dbus.library (default=no)]),dbus="yes",dbus="no")
1882 if test "$dbus" = "yes" ; then
1883     ENABLE_DBUS=1
1884     DBUS_CFLAGS=`pkg-config --cflags dbus-1`
1885     DBUS_LIBFLAGS=`pkg-config --libs dbus-1`
1886     KERNEL_DBUS_KOBJ=kernel-dbus-kobj
1887     KERNEL_DBUS_INCLUDES=kernel-dbus-includes
1888 else
1889     ENABLE_DBUS=0
1891 AC_MSG_RESULT($dbus)
1894 dnl --------------------------------------------------------------------
1895 dnl Configuration Output Section
1896 dnl --------------------------------------------------------------------
1898 # Generic
1899 AC_SUBST(aros_arch)
1900 AC_SUBST(aros_cpu)
1901 AC_SUBST(aros_flavour)
1902 AC_SUBST(aros_flavour_uc)
1903 AC_SUBST(AROS_BUILDDIR)
1904 AC_SUBST(AROS_BUILDDIR_UNIX)
1905 AC_SUBST(SRCDIR)
1906 AC_SUBST(AROS_PORTSSRCDIR)
1908 # Host related
1909 AC_SUBST(aros_cc_pre)
1910 AC_SUBST(aros_host_strip)
1911 AC_SUBST(aros_host_arch)
1912 AC_SUBST(aros_host_cpu)
1913 AC_SUBST(aros_host_cc)
1914 AC_SUBST(aros_host_ar)
1915 AC_SUBST(aros_host_ranlib)
1916 AC_SUBST(aros_host_ld)
1917 AC_SUBST(aros_host_make)
1918 AC_SUBST(aros_host_cflags)
1919 AC_SUBST(aros_host_ldflags)
1920 AC_SUBST(aros_host_debug)
1921 AC_SUBST(aros_host_mkdep)
1922 AC_SUBST(aros_host_mkargs)
1923 AC_SUBST(aros_host_exe_suffix)
1924 AC_SUBST(aros_host_lib_suffix)
1925 AC_SUBST(aros_tools_dir)
1926 AC_SUBST(aros_host_aclocal)
1927 AC_SUBST(aros_host_autoconf)
1928 AC_SUBST(aros_host_autoheader)
1929 AC_SUBST(aros_host_automake)
1931 # Target Related
1932 AC_SUBST(aros_target_guitheme)
1933 AC_SUBST(aros_target_iconset)
1934 AC_SUBST(aros_target_bootloader)
1935 AC_SUBST(aros_target_arch)
1936 AC_SUBST(aros_target_cpu)
1937 AC_SUBST(aros_target_variant)
1938 AC_SUBST(aros_target_suffix)
1939 AC_SUBST(aros_target_incl)
1940 AC_SUBST(aros_target_ar)
1941 AC_SUBST(aros_target_ranlib)
1942 AC_SUBST(aros_kernel_nm)
1943 AC_SUBST(orig_target_cc)
1944 AC_SUBST(aros_target_cc)
1945 AC_SUBST(aros_target_cxx)
1946 AC_SUBST(aros_kernel_cc)
1947 AC_SUBST(aros_target_as)
1948 AC_SUBST(orig_target_ld)
1949 AC_SUBST(aros_target_ld)
1950 AC_SUBST(aros_kernel_ld)
1951 AC_SUBST(aros_target_cc_includes)
1952 AC_SUBST(aros_target_cc_path)
1953 AC_SUBST(aros_target_objdump)
1954 AC_SUBST(aros_target_objcopy)
1955 AC_SUBST(aros_target_strip)
1956 AC_SUBST(aros_target_nm)
1957 AC_SUBST(aros_kernel_rescomp)
1958 AC_SUBST(aros_shared_default)
1959 AC_SUBST(aros_shared_ld)
1960 AC_SUBST(aros_object_format)
1961 AC_SUBST(aros_compiler_libs)
1962 AC_SUBST(aros_arch_libs)
1964 AC_SUBST(aros_config_cflags)
1965 AC_SUBST(aros_config_aflags)
1966 AC_SUBST(aros_config_ldflags)
1968 AC_SUBST(aros_shared_cflags)
1969 AC_SUBST(aros_shared_aflags)
1970 AC_SUBST(aros_shared_ldflags)
1971 AC_SUBST(aros_kernel_cflags)
1972 AC_SUBST(aros_kernel_objcflags)
1973 AC_SUBST(aros_kernel_ldflags)
1974 AC_SUBST(aros_debug_cflags)
1975 AC_SUBST(aros_debug_aflags)
1976 AC_SUBST(aros_debug_ldflags)
1977 AC_SUBST(aros_paranoia_cflags)
1978 AC_SUBST(aros_target_genmap)
1979 AC_SUBST(aros_target_strip_flags)
1981 AC_SUBST(crosstools_target)
1983 # Graphics Related
1984 AC_SUBST(x11_hidd_target)
1985 AC_SUBST(sdl_hidd_target)
1987 AC_SUBST(aros_default_wbwidth)
1988 AC_SUBST(aros_default_wbheight)
1989 AC_SUBST(aros_default_wbdepth)
1990 AC_SUBST(DO_XSHM_SUPPORT)
1991 AC_SUBST(DO_VIDMODE_SUPPORT)
1993 AC_SUBST(aros_host_x11_includes)
1994 AC_SUBST(aros_host_x11_libdirs)
1995 AC_SUBST(aros_host_sdl_cflags)
1996 AC_SUBST(aros_host_sdl_libs)
1998 # Native version related
1999 AC_SUBST(aros_serial_debug)
2001 # Palm native version related
2002 AC_SUBST(aros_palm_debug_hack)
2004 # Unix/Hosted version related
2005 AC_SUBST(aros_nesting_supervisor)
2007 # Apple iOS related
2008 AC_SUBST(aros_ios_platform)
2009 AC_SUBST(aros_ios_version)
2010 AC_SUBST(aros_ios_sdk)
2012 # DBUS related
2013 AC_SUBST(ENABLE_DBUS)
2014 AC_SUBST(DBUS_CFLAGS)
2015 AC_SUBST(DBUS_LIBFLAGS)
2016 AC_SUBST(KERNEL_DBUS_KOBJ)
2017 AC_SUBST(KERNEL_DBUS_INCLUDES)
2019 #X11 related
2020 AC_SUBST(ENABLE_X11)
2022 # Debug related
2023 AC_SUBST(aros_debug)
2024 AC_SUBST(aros_mungwall_debug)
2025 AC_SUBST(aros_stack_debug)
2026 AC_SUBST(aros_modules_debug)
2028 # Collect-aros stuff: "-ius" to ignore undefined symbols
2029 AC_SUBST(ignore_undefined_symbols)
2031 # C compiler related
2032 AC_SUBST(gcc_target_cpu)
2034 dnl Prepare for output, make up all the generated patches
2035 case "$aros_flavour" in
2036 emulation)      aros_flavour_uc="AROS_FLAVOUR_EMULATION"
2037                 aros_flavour="emulation" ;;
2038 emulcompat)     aros_flavour_uc="(AROS_FLAVOUR_EMULATION|AROS_FLAVOUR_BINCOMPAT)"
2039                 aros_flavour="emulation" ;;
2040 standalone)     aros_flavour_uc="AROS_FLAVOUR_STANDALONE"
2041                 aros_flavour="standalone";;
2042 standcompat)    aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_BINCOMPAT)"
2043                 aros_flavour="standalone";;
2044 native)         aros_flavour_uc="AROS_FLAVOUR_NATIVE"
2045                 aros_flavour="native" ;;
2046 nativecompat)   aros_flavour_uc="(AROS_FLAVOUR_NATIVE|AROS_FLAVOUR_BINCOMPAT)"
2047                 aros_flavour="native" ;;
2048 linklib)        aros_flavour_uc="AROS_FLAVOUR_LINKLIB"
2049                 aros_flavour="linklib" ;;
2050 palmnative)     aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
2051                 aros_flavour="palmnative" ;;
2052 mac68knative)   aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
2053                 aros_flavour="mac68knative" ;;
2054 ppcnative)      aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_BINCOMPAT)"
2055                 aros_flavour="ppcnative" ;;
2056 esac
2058 if test ! -d ${aros_inc_dir} ; then
2059     ${MKDIR} ${aros_inc_dir}
2061 if test ! -d ${aros_geninc_dir} ; then
2062     ${MKDIR} ${aros_geninc_dir}
2064 if test ! -d ${aros_hostcfg_dir} ; then
2065     ${MKDIR} ${aros_hostcfg_dir}
2067 if test ! -d ${aros_targetcfg_dir} ; then
2068     ${MKDIR} ${aros_targetcfg_dir}
2070 if test ! -d ${aros_tools_dir} ; then
2071     ${MKDIR} ${aros_tools_dir}
2073 if test ! -d ${aros_scripts_dir} ; then
2074     ${MKDIR} ${aros_scripts_dir}
2077 AC_CONFIG_HEADERS(${aros_geninc_dir}/host-conf.h:config/host-conf.h.in)
2079 AC_CONFIG_COMMANDS([compiler_executable],
2080     [
2081         prefix=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}
2082         mkdir -p $prefix
2083         prefix="${prefix}/${aros_target_cpu}-aros"
2084         prefix2=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros
2086         echo ${prefix}
2087         echo ${prefix2}
2088         chmod a+x ${prefix2}-gcc ${prefix2}-ld
2090         ln -sf ${prefix2}-gcc          ${prefix}-gcc
2091         ln -sf ${prefix2}-ld           ${prefix}-ld
2093         ln -sf $aros_target_as_ln$aros_host_exe_suffix      ${prefix}-as
2094         ln -sf $aros_target_nm_ln$aros_host_exe_suffix      ${prefix}-nm
2095         ln -sf $aros_target_ar_ln$aros_host_exe_suffix      ${prefix}-ar
2096         ln -sf $aros_target_ranlib_ln$aros_host_exe_suffix  ${prefix}-ranlib
2097         ln -sf $aros_target_objcopy_ln$aros_host_exe_suffix ${prefix}-objcopy
2098         ln -sf $aros_target_objdump_ln$aros_host_exe_suffix ${prefix}-objdump
2099         ln -sf $aros_target_strip_ln$aros_host_exe_suffix   ${prefix}-strip
2101         ln -sf $aros_target_as_ln$aros_host_exe_suffix      ${prefix2}-as
2102         ln -sf $aros_target_nm_ln$aros_host_exe_suffix      ${prefix2}-nm
2103         ln -sf $aros_target_ar_ln$aros_host_exe_suffix      ${prefix2}-ar
2104         ln -sf $aros_target_ranlib_ln$aros_host_exe_suffix  ${prefix2}-ranlib
2105         ln -sf $aros_target_objcopy_ln$aros_host_exe_suffix ${prefix2}-objcopy
2106         ln -sf $aros_target_objdump_ln$aros_host_exe_suffix ${prefix2}-objdump
2107         ln -sf $aros_target_strip_ln$aros_host_exe_suffix   ${prefix2}-strip
2108     ],
2109     [
2110         aros_host_exe_suffix=${aros_host_exe_suffix}
2111         aros_tools_dir=${aros_tools_dir}
2112         aros_target_cpu=${aros_target_cpu}
2113         aros_target_arch=${aros_target_arch}
2114         aros_target_suffix=${aros_target_suffix}
2115         aros_target_nm_ln=${aros_target_nm_ln}
2116         aros_target_as_ln=${aros_target_as_ln}
2117         aros_target_ar_ln=${aros_target_ar_ln}
2118         aros_target_ranlib_ln=${aros_target_ranlib_ln}
2119         aros_target_objdump_ln=${aros_target_objdump_ln}
2120         aros_target_objcopy_ln=${aros_target_objcopy_ln}
2121         aros_target_strip_ln=${aros_target_strip_ln}
2122     ]
2124 AC_CONFIG_COMMANDS([genshared_executable],
2125     [chmod a+x ${aros_scripts_dir}/genshared],
2126     [aros_scripts_dir=${aros_scripts_dir}]
2128 AC_CONFIG_COMMANDS([genmf_executable],
2129     [chmod a+x ${aros_tools_dir}/genmf.py],
2130     [aros_tools_dir=${aros_tools_dir}]
2133 AC_CONFIG_FILES(
2134     Makefile
2135     config/make.cfg
2136     ${aros_inc_dir}/config.h:config/config.h.in
2137     ${aros_geninc_dir}/config.h:config/config.h.in
2138     ${aros_hostcfg_dir}/host.cfg:config/host.cfg.in
2139     ${aros_targetcfg_dir}/target.cfg:config/target.cfg.in
2140     mmake.config
2141     ${aros_targetcfg_dir}/make.defaults:config/make.defaults.in
2142     ${aros_targetcfg_dir}/specs:config/specs.in
2143     ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-gcc:scripts/aros-gcc.in
2144     ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-ld:scripts/aros-ld.in
2145     ${aros_scripts_dir}/genshared:compiler/c_lib/source/lib_source/genshared.in
2146     ${aros_tools_dir}/genmf.py:tools/genmf/genmf.py
2147     tools/collect-aros/env.h
2150 AC_OUTPUT
2152 dnl This is in order to not define SHARED_CFLAGS sometimes
2153 dnl We don't always do aros_shared_ar, aros_shared_cflags
2155 #XXX compatability...
2156 aros_shared_ar="$aros_shared_ld $aros_shared_ldflags -o"
2158 if test -n "$aros_shared_cflags" ; then
2159     echo "SHARED_CFLAGS := $aros_shared_cflags" >> ${aros_hostcfg_dir}/host.cfg
2160     echo "SHARED_AR := $aros_shared_ar" >> ${aros_hostcfg_dir}/host.cfg