arch/m68k-all/include/gencall: Proper regcall stubs
[AROS.git] / configure.in
blob3d733de624e7c956115ee3eeb8e04166c2e6a7c0
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-aros-gcc"
960                 aros_target_cxx="arm-aros-g++"
961                 aros_target_ld="arm-aros-ld"
962                 aros_target_as="arm-aros-as"
963                 aros_target_ar="arm-aros-ar"
964                 aros_target_ranlib="arm-aros-ranlib"
965                 aros_target_nm="arm-aros-nm"
966                 aros_target_strip="arm-aros-strip"
967                 aros_target_objcopy="arm-aros-objcopy"
968                 aros_target_objdump="arm-aros-objdump"
969                 target_tool_prefix="arm-apple-darwin10-" 
970                 aros_default_wbwidth=320
971                 aros_default_wbheight=480
972                 export PATH="$aros_xcode_path/Platforms/$aros_ios_platform.platform/Developer/usr/bin:$PATH"
973                 ;;
974             *)
975                 AC_MSG_ERROR("Unsupported target CPU for iOS hosted flavour -- $target_cpu")
976                 ;;
977         esac
978         aros_ios_sdk="$aros_xcode_path/Platforms/$aros_ios_platform.platform/Developer/SDKs/$aros_ios_platform$aros_ios_sdk.sdk"
979         target_tool_flags="$target_tool_flags --sysroot $aros_ios_sdk"
980         ;;
982     dragonfly*)
983         aros_target_arch="dragonfly"
984         aros_flavour="emulation"
985         case "$target_cpu" in
986             *i?86*)
987                 aros_target_cpu="i386"
988                 aros_object_format="elf_i386"
989                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__DragonFly__"
990                 ;;
991             *x86_64*)
992                 aros_target_cpu="x86_64"
993                 aros_object_format="elf_x86_64"
994                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64 -D__DragonFly__"
995                 ;;
996             *)
997                 AC_MSG_ERROR("Unknown CPU for DragonFly -- $target_cpu")
998                 ;;
999         esac
1000         ;;
1002     netbsd*)
1003         aros_target_arch="netbsd"
1004         case "$target_cpu" in
1005             *m68k*)
1006                 aros_target_cpu="m68k"
1007                 aros_object_format="m68kelf"
1008                 aros_flavour="emulcompat"
1009                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D__mc68000 -D__NetBSD__"
1010                 gcc_target_cpu="mc68000"
1011                 ;;
1012             *i?86*)
1013                 aros_target_cpu="i386"
1014                 aros_object_format="elf_i386"
1015                 aros_flavour="emulation"
1016                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__NetBSD__"
1017                 aros_default_wbdepth=8
1018                 gcc_target_cpu="i386"
1019                 ;;
1020             *)
1021                 AC_MSG_ERROR("Unknown CPU for NetBSD -- $target_cpu")
1022                 ;;
1023         esac
1024         aros_target_genmap="-Wl,-M -Xlinker >"
1025         aros_flavour="emulation"
1026         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1027         ;;   
1029     openbsd*)
1030         aros_target_arch="openbsd"
1031         case "$target_cpu" in
1032             *i?86*)
1033                 aros_target_cpu="i386"
1034                 aros_object_format="elf_i386"
1035                 aros_flavour="emulation"
1036                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__OpenBSD__"
1037                 gcc_target_cpu="i386"
1038                 ;;
1039             *)
1040                 AC_MSG_ERROR("Unknown CPU for OpenBSD -- $target_cpu")
1041                 ;;
1042         esac
1043         aros_target_genmap="-Wl,-M -Xlinker >"
1044         aros_target_nm_flags="-u"
1045         aros_flavour="emulation"
1046         ;;
1048     solaris*)
1049         aros_target_arch="solaris"
1050         case "$target_cpu" in
1051            *i?86*)
1052                aros_target_cpu="i386"
1053                aros_object_format="elf_i386"
1054                aros_flavour="emulation"
1055                aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__Solaris__"
1056                aros_default_wbdepth=8
1057                gcc_target_cpu="i386"
1058                ;;
1059             *sparc*)
1060                 aros_target_cpu="sparc"
1061                 aros_object_format="elf_sparc"
1062                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dsparc -D__Solaris__"
1063                 gcc_target_cpu="sparc"
1064                 ;;
1065             *)
1066                 AC_MSG_ERROR("Unknown CPU for Solaris -- $target_cpu")
1067                 ;;
1068         esac
1069         aros_config_cflags="$aros_config_cflags -D$aros_target_cpu"
1070         aros_flavour="emulation"
1071         ;;
1073     morphos*)
1074         aros_target_arch="morphos"
1075         aros_shared_default="no"
1076         aros_target_cpu="ppc"
1077         aros_object_format="elf_ppc"
1078         aros_flavour="nativecompat"
1079         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1080         gcc_target_cpu="ppc"
1081         ;;
1083     sam440)
1084         aros_target_arch="sam440"
1085         aros_shared_default="no"
1086         aros_target_cpu="ppc"
1087         aros_object_format="elf32ppc"
1088         aros_flavour="ppcnative"
1089         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1090         aros_kernel_ldflags=""
1091         aros_default_wbwidth=1024
1092         aros_default_wbheight=768
1093         aros_default_wbdepth=24
1094         aros_config_cflags="$aros_config_cflags -mcpu=440fp -mno-toc -fno-asynchronous-unwind-tables"
1095         gcc_target_cpu="powerpc"
1096         ;;
1098     efika)
1099         aros_target_arch="efika"
1100         aros_shared_default="no"
1101         aros_target_cpu="arm"
1102         aros_object_format="armelf_linux_eabi"
1103         aros_flavour="standalone"
1104         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
1105         aros_kernel_ldflags=""
1106         aros_default_wbwidth=1024
1107         aros_default_wbheight=600
1108         aros_arch_libs="-laeabi"
1109         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"
1110         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"
1111         ;;
1112         
1113     chrp)
1114     aros_target_arch="chrp"
1115     aros_shared_default="no"
1116     aros_target_cpu="ppc"
1117     aros_object_format="elf32ppc"
1118     aros_flavour="ppcnative"
1119     aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1120     aros_kernel_ldflags=""
1121     aros_default_wbwidth=640
1122     aros_default_wbheight=480
1123     aros_config_cflags="$aros_config_cflags -mno-toc -fno-asynchronous-unwind-tables"    
1124     gcc_target_cpu="powerpc"
1125         case "$aros_target_variant" in
1126             efika)
1127             aros_config_cflags="$aros_config_cflags -DBIG_ENDIAN_OHCI=1 -mcpu=603e"
1128             ;;
1129         esac
1130     ;;
1132     amiga*)
1133         aros_target_arch="amiga"
1134         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D_AMIGA -DAMIGA"
1135         aros_shared_default="no"
1137         case "$target_cpu" in
1138             *m68k-eabi)
1139                 aros_target_cpu="m68k"
1140                 aros_object_format="m68kelf"
1141                 aros_flavour="standalone"
1142                 gcc_target_cpu="mc68000"
1143                 aros_config_cflags="$aros_config_cflags -g3 -fno-strict-aliasing -ffreestanding -fomit-frame-pointer -${gcc_target_cpu} -fbuiltin"
1144                 aros_config_aflags="$aros_config_aflags -g3 -fno-strict-aliasing -ffreestanding -fomit-frame-pointer -${gcc_target_cpu}"
1145                 aros_debug_cflags="-Wall -Werror-implicit-function-declaration $aros_symbols_debug  $aros_messages_debug -${gcc_target_cpu}"
1146                 target_tool_prefix="m68k-elf-"
1147                 aros_target_nostdlib_ldflags="" # We always need -lgcc
1148                 aros_target_strip_flags="-R.comment"
1149                 ;;
1150             *m68k*)
1151                 aros_target_cpu="m68k"
1152                 aros_object_format="m68kelf"
1153                 aros_flavour="standcompat"
1154                 gcc_target_cpu="mc68000"
1155                 aros_config_cflags="$aros_config_cflags -g3 -fno-strict-aliasing -ffreestanding -fomit-frame-pointer -${gcc_target_cpu} -fbuiltin"
1156                 aros_config_aflags="$aros_config_aflags -g3 -fno-strict-aliasing -ffreestanding -fomit-frame-pointer -${gcc_target_cpu}"
1157                 aros_debug_cflags="-Wall -Werror-implicit-function-declaration $aros_symbols_debug  $aros_messages_debug -${gcc_target_cpu}"
1158                 target_tool_prefix="m68k-elf-"
1159                 aros_target_nostdlib_ldflags="" # We always need -lgcc
1160                 aros_target_strip_flags="-R.comment"
1161                 ;;
1162             *ppc*)
1163                 aros_cpu="ppc"
1164                 aros_flavour="native"
1165                 gcc_target_cpu="ppc"
1166                 ;;
1167             *)
1168                 AC_MSG_ERROR("Unknown CPU for Amiga $target_cpu")
1169                 ;;
1170         esac
1171         ;;
1173     mingw*)
1174         aros_target_arch="mingw32"
1175         aros_shared_default="no"
1176         aros_flavour="emulation"
1177         aros_shared_cflags=""
1178         need_dlopen="no"
1179         rescomp="windres"
1180         case "$target_cpu" in
1181             *i?86*)
1182                 aros_target_cpu="i386"
1183                 aros_object_format="elf_i386"
1184                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1185                 aros_default_wbdepth=8
1186                 gcc_target_cpu="i386"
1187                 aros_target_cc="i386-aros-gcc"
1188                 aros_target_cxx="i386-aros-g++"
1189                 aros_target_ld="i386-aros-ld"
1190                 aros_target_as="i386-aros-as"
1191                 aros_target_ar="i386-aros-ar"
1192                 aros_target_ranlib="i386-aros-ranlib"
1193                 aros_target_nm="i386-aros-nm"
1194                 aros_target_strip="i386-aros-strip"
1195                 aros_target_objcopy="i386-aros-objcopy"
1196                 aros_target_objdump="i386-aros-objdump"
1197                 target_tool_prefix="i386-mingw32-"
1198                 ;;
1199             *x86_64*)
1200                 aros_target_cpu="x86_64"
1201                 aros_object_format="elf_x86_64"
1202                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
1203                 aros_default_wbdepth=8
1204                 gcc_target_cpu="x86_64"
1205                 aros_target_cc="x86_64-aros-gcc"
1206                 aros_target_cxx="x86_64-aros-g++"
1207                 aros_target_ld="x86_64-aros-ld"
1208                 aros_target_as="x86_64-aros-as"
1209                 aros_target_ar="x86_64-aros-ar"
1210                 aros_target_ranlib="x86_64-aros-ranlib"
1211                 aros_target_nm="x86_64-aros-nm"
1212                 aros_target_strip="x86_64-aros-strip"
1213                 aros_target_objcopy="x86_64-aros-objcopy"
1214                 aros_target_objdump="x86_64-aros-objdump"
1215                 target_tool_prefix="x86_64-w64-mingw32-"
1216                 ;;
1217             *arm*)
1218                 aros_target_cpu="arm"
1219                 aros_object_format="armelf_linux_eabi"
1220                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
1221                 aros_arch_libs="-laeabi"
1222                 aros_default_wbdepth=8
1223                 gcc_target_cpu="arm"
1224                 aros_target_cc="arm-aros-gcc"
1225                 aros_target_cxx="arm-aros-g++"
1226                 aros_target_ld="arm-aros-ld"
1227                 aros_target_as="arm-aros-as"
1228                 aros_target_ar="arm-aros-ar"
1229                 aros_target_ranlib="arm-aros-ranlib"
1230                 aros_target_nm="arm-aros-nm"
1231                 aros_target_strip="arm-aros-strip"
1232                 aros_target_objcopy="arm-aros-objcopy"
1233                 aros_target_objdump="arm-aros-objdump"
1234                 target_tool_prefix="arm-mingw32ce-"
1235                 aros_default_wbwidth=160
1236                 aros_default_wbheight=160
1237                 ;;
1238             *)
1239                 AC_MSG_ERROR("Unknown CPU for Mingw32 -- $target_cpu")
1240                 ;;
1241         esac
1242         if test $host_os = "cygwin"; then
1243                 aros_kernel_cflags="-mno-cygwin"
1244         fi
1245     ;;
1246     pp*)
1247         aros_target_arch="pp"
1248         aros_shared_default="no"
1249         case "$target_cpu" in
1250             *m68k*)
1251                 aros_target_cpu="m68k"
1252                 aros_object_format="m68kelf"
1253                 aros_flavour="palmnative"
1254                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
1255                 aros_default_wbwidth=160
1256                 aros_default_wbheight=160
1257                 aros_default_wbdepth=1
1258                 aros_target_ar_flags="cru"
1259                 aros_compiler_libs="-lgcc1"
1260                 aros_shared_default=no
1261                 aros_shared_cflags="-fpic"
1262                 aros_shared_aflags=""
1263                 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
1264                 aros_kernel_ldflags="-Wl,-rpath,./lib"
1265                 aros_debug_cflags="-Wall -Werror-implicit-function-declaration $aros_symbols_debug  $aros_messages_debug -mc68000 -Wa,-mc68000"
1266                 aros_debug_aflags=""
1267                 aros_debug_ldflags="$aros_symbols_debug"
1268                 aros_mungwall_debug="0"
1269                 aros_modules_debug="0"
1270                 gcc_target_cpu="mc68000"
1271                 ignore_undefined_symbols="-ius"
1272                 ;;
1273            *)
1274                 AC_MSG_ERROR("Unknown CPU for PalmPilot -- $target_cpu")
1275                 ;;
1276         esac
1277         ;;
1279     mac*)
1280         aros_target_arch="mac"
1281         aros_shared_default="no"
1282         case "$target_cpu" in
1283             *m68k*)
1284                 aros_target_cpu="m68k"
1285                 aros_object_format="m68kelf"
1286                 aros_flavour="mac68knative"
1287                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
1288                 aros_default_wbwidth=512
1289                 aros_default_wbheight=384
1290                 aros_default_wbdepth=8
1291                 aros_target_ar_flags="cru"
1292                 aros_compiler_libs="-lgcc1"
1293                 aros_shared_default=no
1294                 aros_shared_cflags="-fpic"
1295                 aros_shared_aflags=""
1296                 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
1297                 aros_kernel_ldflags="-Wl,-rpath,./lib"
1298                 aros_debug_cflags="-Wall -Werror-implicit-function-declaration $aros_symbols_debug  $aros_messages_debug -mc68000"
1299                 aros_debug_aflags=""
1300                 aros_debug_ldflags="$aros_symbols_debug"
1301                 aros_mungwall_debug="0"
1302                 aros_modules_debug="0"
1303                 gcc_target_cpu="mc68000"
1304                 ignore_undefined_symbols="-ius"
1305                 ;;
1306            *)
1307                 AC_MSG_ERROR("Unknown CPU for Mac68k -- $target_cpu")
1308                 ;;
1309         esac
1310         ;;
1312     *)
1313         AC_MSG_ERROR([Unsupported target architecture $target])
1314         ;;
1315 esac
1317 AC_MSG_CHECKING([Where to download sourcecode for external ports])
1318 AC_ARG_WITH(portssources,AC_HELP_STRING([--with-portssources=DIR],[Where to download sourcecode for external ports]),with_portssrcdir=$withval,with_portssrcdir="default")
1319 if test "$with_portssrcdir" = "default"; then
1320     AROS_PORTSSRCDIR="$AROS_BUILDDIR_UNIX/bin/Sources"
1321 else
1322     AROS_PORTSSRCDIR="$with_portssrcdir"
1324 AC_MSG_RESULT($AROS_PORTSSRCDIR)
1326 AC_MSG_CHECKING([which bootloader to use])
1327 AC_ARG_WITH(bootloader,AC_HELP_STRING([--with-bootloader=NAME],[Use a specific bootloader]),target_bootloader=$withval,target_bootloader=$target_bootloader)
1328 if test "$target_bootloader" = "none"; then
1329     aros_target_bootloader=""
1330 else
1331     aros_target_bootloader="$target_bootloader"
1333 AC_MSG_RESULT($target_bootloader)
1335 AC_MSG_CHECKING([which icon-set to use])
1336 AC_ARG_WITH(iconset,AC_HELP_STRING([--with-iconset=NAME],[Use a specific Icon-set (default=Gorilla).]),target_iconset=$withval,target_iconset="default")
1337 if test "$target_iconset" = "default"; then
1338     aros_target_iconset="Gorilla"
1339     target_iconset="default (Gorilla)"
1340 else
1341     aros_target_iconset="$target_iconset"
1343 AC_MSG_RESULT($target_iconset)
1345 AC_MSG_CHECKING([which GUI Theme to use])
1346 AC_ARG_WITH(theme,AC_HELP_STRING([--with-theme=NAME],[Use a specific GUI Theme]),target_guitheme=$withval,target_guitheme="default")
1347 if test "$target_guitheme" = "default"; then
1348     aros_target_guitheme="Ice"
1349 else
1350     aros_target_guitheme="$target_guitheme"
1352 AC_MSG_RESULT($aros_target_guitheme)
1354 # Find out if we are cross-compiling (i.e. if we can't use the host compiler
1355 # for target code)
1356 cross_compiling=no
1357 if test "$aros_host_cpu" != "$aros_target_cpu" ; then
1358     cross_compiling=yes
1360 if test "$aros_host_cpu" == "x86_64" ; then
1361     if test "$aros_target_cpu" == "i386" ; then
1362         if test "$aros_target_arch" != "mingw32"; then
1363             cross_compiling=no
1364         fi
1365     fi
1368 # Set prefix for target compiler etc. if we're cross-compiling
1369 # (should possibly be earlier but needs to be after AC_PROG_CC)
1370 if test "$cross_compiling" = "yes" ; then
1371     if test "$target_tool_prefix" = ""; then
1372         target_tool_prefix=${target_cpu}-elf-
1373     fi
1374     CC=${target_tool_prefix}gcc
1375     if test "$target_tool_version" != "default"; then
1376         CC="$CC-$target_tool_version"
1377     fi
1378     AC_PATH_PROG(CC,$CC)
1379     AROS_REQUIRED(gcc,$CC)
1381 CC="$CC $target_tool_flags"
1383 #-----------------------------------------------------------------------------
1385 # Disable pointer-signedness warnings if the compiler recognises the option
1387 AC_MSG_CHECKING([whether ${CC} accepts -Wno-pointer-sign])
1388 save_cflags="$CFLAGS"
1389 CFLAGS="$CFLAGS -Wno-pointer-sign"
1390 AC_TRY_COMPILE(,, use_no_sign_warning="yes", use_no_sign_warning="no")
1391 AC_MSG_RESULT($use_no_sign_warning)
1392 if test "x-$use_no_sign_warning" = "x-yes" ; then
1393     aros_config_cflags="$aros_config_cflags -Wno-pointer-sign"
1395 CFLAGS="$save_cflags"
1397 #-----------------------------------------------------------------------------
1399 # Find all the tools we need to compile. This could be cross-compiling
1400 # though! If that is the case we use the GNU form of the target and
1401 # simply add this to the front of the binary name. This is rather simple,
1402 # but it should work under most circumstances.
1404 # The default tools are to use the same as the host, but only if the
1405 # host and target CPU are the same. With GCC this is normally enough.
1408 aros_cc_pre=""
1409 aros_shared_ld="$aros_host_ld"
1411 aros_target_mkdep="$aros_host_mkdep"
1412 aros_target_incl_def="$aros_host_incl"
1414 aros_kernel_cc="$CC"
1416 # The default tools executables to be linked to.
1417 if test "$aros_target_cc" != ""; then
1418     AC_PATH_PROG(aros_target_cc,$aros_target_cc)
1419     AROS_REQUIRED(gcc,$aros_target_cc)
1421 if test "$aros_target_ld" != ""; then
1422     AC_PATH_PROG(aros_target_ld,$aros_target_ld)
1423     AROS_REQUIRED(ld,$aros_target_ld)
1426 if test "$crosstools" != "yes"; then
1427     AROS_TOOL_TARGET(aros_target_as_ln,as,$aros_target_as)
1428     AROS_REQUIRED(as,$aros_target_as_ln)
1429     AROS_TOOL_TARGET(aros_kernel_ld,ld,$aros_kernel_ld)
1430     AROS_REQUIRED(ld,$aros_kernel_ld)
1431     AROS_TOOL_TARGET(aros_target_ar_ln,ar,$aros_target_ar)
1432     AROS_REQUIRED(ar,$aros_target_ar_ln)
1433     AROS_TOOL_TARGET(aros_target_nm_ln,nm,$aros_target_nm)
1434     AROS_REQUIRED(nm,$aros_target_nm_ln)
1435     AROS_TOOL_TARGET(aros_target_objcopy_ln,objcopy,$aros_target_objcopy)
1436     AROS_REQUIRED(objcopy,$aros_target_objcopy_ln)
1437     AROS_TOOL_TARGET(aros_target_objdump_ln,objdump,$aros_target_objdump)
1438     AROS_REQUIRED(objdump,$aros_target_objdump_ln)
1439     AROS_TOOL_TARGET(aros_target_ranlib_ln,ranlib,$aros_target_ranlib)
1440     AROS_REQUIRED(ranlib,$aros_target_ranlib_ln)
1441     AROS_TOOL_TARGET(aros_target_strip_ln,strip,$aros_target_strip)
1442     AROS_REQUIRED(strip,$aros_target_strip_ln)
1443     if test "$aros_target_cxx" != ""; then
1444         AC_PATH_PROG(aros_target_cxx,$aros_target_cxx)
1445 # Temporarily disabled in order to let Mingw32-hosted nightly build to work
1446 #       AROS_REQUIRED(c++,$aros_target_cxx)
1447     fi
1448 else
1449 # Cancel preinstalled C++ compiler because it will be built as part of crosstools
1450     aros_target_cxx=""
1453 # Build crosstools if we have no C++ - temporary thing 
1454 if test "$aros_target_cxx" = ""; then
1455     crosstools_target=tools-crosstools
1458 if test "$rescomp" != ""; then
1459     if test "$cross_compiling" = "yes" ; then
1460         rescomp=${target_tool_prefix}${rescomp}
1461     fi
1462     AC_PATH_PROG(aros_kernel_rescomp,$rescomp)
1463     AROS_REQUIRED($rescomp,$aros_kernel_rescomp)
1466 aros_hostcfg_dir="bin/${aros_host_arch}-${aros_host_cpu}/gen/config"
1467 aros_targetcfg_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/config"
1468 aros_inc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/AROS/Development/include/aros"
1469 aros_gendir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen"
1470 aros_geninc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/include/aros"
1471 aros_tools_dir="bin/${aros_host_arch}-${aros_host_cpu}/tools"
1472 aros_scripts_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/scripts"
1474 # aros_cc_pre is a variable that is added to the front of the compiler name
1475 # in the generated aros-gcc shell script. We need this to enable the cache
1476 # to work across cleaned builds. Also, support DISTCC using the correct
1477 # environment variable.
1480 if test "x${DISTCC}" != "x" ; then
1481     if test "x${CCACHE}" != "x" ; then
1482         aros_cc_pre="env CCACHE_PREFIX=${DISTCC} ${CCACHE} "
1483     else
1484         aros_cc_pre="${DISTCC} "
1485     fi
1486 else
1487     if test "x${CCACHE}" != "x" ; then
1488         aros_cc_pre="${CCACHE} "
1489     fi
1492 prefix="${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros"
1494 AC_SUBST(aros_target_nostdinc_cflags,-nostdinc)
1495 AC_SUBST(aros_target_nostartup_ldflags,-nostartfiles)
1496 AC_SUBST(aros_target_nix_ldflags,-nix)
1497 AC_SUBST(aros_target_detach_ldflags,-detach)
1498 AC_SUBST(aros_target_nostdlib_ldflags,-nostdlib)
1500 # Target tools
1501 if test "$aros_target_cc" = ""; then
1502     orig_target_cc=$aros_kernel_cc
1503 else
1504     orig_target_cc=$aros_target_cc
1506 if test "$aros_target_ld" = ""; then
1507     orig_target_ld=$aros_kernel_ld
1508 else
1509     orig_target_ld=$aros_target_ld
1511 if test "$GCC" = "yes"; then
1512     aros_target_cc_path=`$orig_target_cc -print-search-dirs | grep "programs: =" | cut -c 12-`
1514 aros_target_cc="${prefix}-gcc"
1515 aros_target_as="${prefix}-as"
1516 aros_target_ld="${prefix}-ld"
1517 aros_target_ar="${prefix}-ar $aros_target_ar_flags"
1518 aros_target_objcopy=${prefix}-objcopy
1519 aros_target_objdump=${prefix}-objdump
1520 aros_target_ranlib="${prefix}-ranlib $aros_target_ranlib_flags"
1521 aros_target_nm="${prefix}-nm $aros_target_nm_flags"
1522 aros_kernel_nm="${prefix}-nm"
1523 aros_target_strip=${prefix}-strip
1525 # Find the system include path. We can suggest that an alternative is
1526 # used if we don't get it correct. The default is to use /usr/include.
1527 # Which is set in the aros_target_incl_def variable.
1529 AC_ARG_ENABLE(includes,
1530 AC_HELP_STRING([--enable-includes=dir],[Alternative system include directory]),
1531 [aros_target_incl=$enable_includes], [aros_target_incl=$aros_target_incl_def])
1533 dnl find out about the target cc's include path
1534 AC_MSG_CHECKING([for the target compiler's include path])
1535 if test "$aros_target_cc_includes" = "" ; then
1536     #try to guess where the directory is
1537     aros_target_cc_includes=`dirname \`${orig_target_cc} -print-libgcc-file-name\``/include
1538     if ! test -d $aros_target_cc_includes; then
1539         #the directory doesn't exist, we need to do some more work
1540         aros_target_cc_includes=${PWD}/${aros_gendir}/cc_include
1541         
1542         #these are the headers we're looling for
1543         headers="limits.h mmintrin.h stdbool.h syslimits.h float.h \
1544                  stddef.h xmmintrin.h iso646.h stdarg.h unwind.h   \
1545                  zutil.h"
1547         dirs=
1548         for h in $headers; do
1549             #which other headers each of the above headers needs?
1550             deps=$(echo "#include <$h>" | \
1551                    $aros_host_cc -E -M - 2>/dev/null | \
1552                    sed 's/^.*://; s/\\$/ /g; s/[[ \t]]\+/ /g')
1553             
1554             #copy all the needed headers to a directory beneath gendir
1555             for d in $deps; do
1556                 h=$(basename $d)
1557                 dir=${aros_target_cc_includes}$(echo $(dirname $d) | \
1558                                                 sed -n "s,^.*/include\(/.*\),\1,p")
1559                 ! test -d $dir && mkdir -p $dir
1560                 ! test -f $dir/$h && { cp $d $dir; chmod u+w $dir/$h; }
1561             done
1562         done        
1563     fi
1565 AC_MSG_RESULT($aros_target_cc_includes)
1568 # For GCC < 4.0 -I- is used for giving the search path for '#include "..."'
1569 # On GCC >= 4.0 -iquote should be used
1572 save_cc="$CC"
1573 save_cflags="$CFLAGS"
1574 CFLAGS="-iquote."
1575 AC_MSG_CHECKING([whether ${CC} accepts -iquote])
1576 AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
1577 AC_MSG_RESULT($has_iquote)
1578 if test "x-$has_iquote" = "x-yes" ; then
1579     host_cflags_iquote=-iquote
1580     host_cflags_iquote_end=
1581 else
1582     host_cflags_iquote=-I
1583     host_cflags_iquote_end=-I-
1585 kernel_cflags_iquote=$host_cflags_iquote
1586 kernel_cflags_iquote_end=$host_cflags_iquote_end
1587 if test "x-$cross_compiling" = "x-yes"; then
1588     CC="$aros_kernel_cc"
1589     AC_MSG_CHECKING([whether ${CC} accepts -fno-stack-protector])
1590     AC_TRY_COMPILE(,, use_no_stack_protector="yes", use_no_stack_protector="no")
1591     AC_MSG_RESULT($use_no_stack_protector)
1592     AC_MSG_CHECKING([whether ${CC} accepts -iquote])
1593     AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
1594     AC_MSG_RESULT($has_iquote)
1595     if test "x-$has_iquote" = "x-yes" ; then
1596         kernel_cflags_iquote=-iquote
1597         kernel_cflags_iquote_end=
1598     else
1599         kernel_cflags_iquote=-I
1600         kernel_cflags_iquote_end=-I-
1601     fi
1603 aros_cflags_iquote=$kernel_cflags_iquote
1604 aros_cflags_iquote_end=$kernel_cflags_iquote_end
1605 if test "$orig_target_cc" != "$aros_kernel_cc"; then
1606     CC="$orig_target_cc"
1607     AC_MSG_CHECKING([whether ${CC} accepts -iquote])
1608     AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
1609     AC_MSG_RESULT($has_iquote)
1610     if test "x-$has_iquote" = "x-yes" ; then
1611         aros_cflags_iquote=-iquote
1612         aros_cflags_iquote_end=
1613     else
1614         aros_cflags_iquote=-I
1615         aros_cflags_iquote_end=-I-
1616     fi
1618 if test "x-$use_no_stack_protector" = "x-yes" ; then
1619     aros_kernel_cflags="$aros_kernel_cflags -fno-stack-protector"
1622 #-----------------------------------------------------------------------------
1624 # Check if we can explicitly choose older version of symbol hashing
1626 CFLAGS="save_cflags -Wl,--hash-style=sysv"
1627 CC="$aros_kernel_cc"
1628 AC_MSG_CHECKING([whether ${CC} accepts -Wl,--hash-style=sysv])
1629 AC_TRY_LINK(,, use_hash_style="yes", use_hash_style="no")
1630 AC_MSG_RESULT($use_hash_style)
1631 if test "x-$use_hash_style" = "x-yes" ; then
1632     aros_kernel_cflags="$aros_kernel_cflags -Wl,--hash-style=sysv"
1634 CC="$save_cc"
1635 CFLAGS="$save_cflags"
1637 AC_SUBST(host_cflags_iquote)
1638 AC_SUBST(host_cflags_iquote_end)
1639 AC_SUBST(kernel_cflags_iquote)
1640 AC_SUBST(kernel_cflags_iquote_end)
1641 AC_SUBST(aros_cflags_iquote)
1642 AC_SUBST(aros_cflags_iquote_end)
1645 dnl Check if user specified --with-resolution=XRESxYRESxDEPTH
1646 AC_MSG_CHECKING([for default resolution of WBScreen])
1647 AC_ARG_WITH(resolution,AC_HELP_STRING([--with-resolution=XRESxYRESxDEPTH],[Default resolution of the initial WorkbenchScreen]),resolution=$withval,resolution=none)
1648 # We require an argument, so map --with/--without ("yes"/"no") to "none" specified
1649 if test "$resolution" = "yes" ; then
1650     resolution="none"
1652 if test "$resolution" = "no" ; then
1653     resolution="none"
1655 if test "$resolution" != "none" ; then
1656     aros_default_wbwidth=`echo $resolution | cut -d'x' -f1`
1657     aros_default_wbheight=`echo $resolution | cut -d'x' -f2`
1658     aros_default_wbdepth=`echo $resolution | cut -d'x' -f3`
1660 AC_MSG_RESULT($aros_default_wbwidth x $aros_default_wbheight x $aros_default_wbdepth)
1661 aros_cv_default_wbwidth=$aros_default_wbwidth
1662 aros_cv_default_wbheight=$aros_default_wbheight
1663 aros_cv_default_wbdepth=$aros_default_wbdepth
1665 dnl See if the user wants the serial debug output for native flavour
1666 AC_MSG_CHECKING([if serial debug is enabled])
1667 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)
1668 if test "$aros_serial_debug" = 0 ; then
1669     serial_debug_forced=""
1670     if test "$serial_debug" = "yes" ; then
1671         serial_debug="2"
1672     fi
1673     if test "$serial_debug" = "no" ; then
1674         serial_debug="none"
1675     fi
1676 else
1677     serial_debug_forced="(forced)"
1678     serial_debug=$aros_serial_debug
1680 if test "$serial_debug" != "none" ; then
1681     aros_serial_debug=$serial_debug
1682     AC_MSG_RESULT($serial_debug_forced on port $serial_debug)
1683 else
1684     AC_MSG_RESULT(no)
1687 dnl See if the user wants the palm debug output hack for palm native flavour
1688 AC_MSG_CHECKING([if palm debug hack is enabled])
1689 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")
1690 if test "$palm_debug_hack" = "yes" ; then
1691     aros_palm_debug_hack="1"
1693 AC_MSG_RESULT($palm_debug_hack)
1696 dnl See if the user wants nesting supervisor activated for unix flavour
1697 AC_MSG_CHECKING([if nesting supervisor support is enabled])
1698 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")
1699 if test "$nesting_supervisor" = "yes" ; then
1700     aros_nesting_supervisor="1"
1702 AC_MSG_RESULT($nesting_supervisor)
1705 dnl things specifically required for hosted flavours
1706 if test "x-$aros_flavour" = "x-emulation" -o "x-$aros_flavour" = "x-emulcompat" ; then
1708     if test "x-$need_dlopen" != "x-no" ; then
1709       dnl some kind of dynamic library access system is required for hostlib.resource
1710       AC_CHECK_FUNC(dlopen, have_dl="yes", have_dl="no")
1711       if test "x-$have_dl" = "x-no" ; then
1712           AC_CHECK_LIB(dl, dlopen, [have_dl="yes"
1713                                     aros_host_ldflags="$aros_host_ldflags -ldl"],
1714                                     have_dl="no")
1715       fi
1716       if test "x-$have_dl" = "x-no" ; then
1717           AC_MSG_ERROR([dlopen() dynamic linker functions not available])
1718       fi
1719     fi
1722     dnl x11 hidd
1723     AC_ARG_ENABLE(x11_hidd, AC_HELP_STRING([--enable-x11-hidd],
1724                                            [build X11 hidd for hosted (default=auto)]),
1725                                            x11_hidd="$enableval",
1726                                            x11_hidd="auto")
1727     case "x-$x11_hidd" in
1728         x-yes|x-no|x-auto)                 ;;
1729         *)                 x11_hidd="auto" ;;
1730     esac
1732     ENABLE_X11=0
1734     dnl they want it
1735     if test "x-$x11_hidd" != "x-no" ; then
1737         dnl find x11 stuff
1738         AC_PATH_X
1740         x_cflags=
1741         for path in $x_libraries
1742         do
1743             x_cflags="$x_cflags -L$path"
1744         done
1746         for path in $x_includes
1747         do
1748             x_cflags="$x_cflags -I$path"
1749         done
1750         
1751         if test "x-$no_x" = "x-yes" ; then
1753             dnl didn't find it
1754             if test "x-$x11_hidd" != "x-auto" ; then
1755                 dnl and they explicitly asked for it, bail out
1756                 AC_MSG_ERROR([X11 libs/headers not found, cannot build X11 hidd as requested])
1757             fi
1758         
1759         else
1760             dnl found it, setup the metatarget
1761             x11_hidd_target=kernel-x11gfx-kobj
1762             ENABLE_X11=1
1764             dnl setup shared memory extensions
1765             AC_ARG_ENABLE(x11_shm, AC_HELP_STRING([--enable-x11-shm],
1766                                                   [use X11 shared memory (default=auto)]),
1767                                                   x11_hidd_shm="$enableval",
1768                                                   x11_hidd_shm="auto")
1769             case "x-$x11_hidd_shm" in
1770                 x-yes|x-no|x-auto)                     ;;
1771                 *)                 x11_hidd_shm="auto" ;;
1772             esac
1774             have_xshm=no
1776             dnl they want it
1777             if test "x-$x11_hidd_shm" != "x-no" ; then
1779                 dnl system shm headers
1780                 AC_CHECK_HEADERS(sys/ipc.h)
1781                 AC_CHECK_HEADERS(sys/shm.h)
1783                 dnl got them
1784                 if test "x-$ac_cv_header_sys_ipc_h" = "x-yes" -a "x-$ac_cv_header_sys_shm_h" = "x-yes" ; then
1786                     dnl make sure X libs have shm functions
1787                     save_cflags="$CFLAGS"
1788                     CFLAGS="$CFLAGS $x_cflags"
1789                     AC_CHECK_LIB(Xext, XShmQueryExtension, have_xshm=yes)
1790                     CFLAGS="$save_cflags"
1791                 fi
1792             fi
1794             dnl detection done, prepare output
1795             if test "x-$have_xshm" = "x-yes" ; then
1796                 dnl we can do shm
1797                 DO_XSHM_SUPPORT="1"
1798             elif test "x-$x11_hidd_shm" = "x-yes" ; then
1799                 dnl they explicitly asked for it, but we can't do it
1800                 AC_MSG_ERROR([X11 has no support for shared memory, cannot enable it as requested])
1801             else
1802                 dnl otherwise just disable it
1803                 DO_XSHM_SUPPORT="0"
1804             fi
1806             
1807             dnl setup vidmode (fullscreen) extensions
1808             AC_ARG_ENABLE(x11_vidmode, AC_HELP_STRING([--enable-x11-vidmode],
1809                                                       [use X11 vidmode extension (default=auto)]),
1810                                                       x11_hidd_vidmode="$enableval",
1811                                                       x11_hidd_vidmode="auto")
1812             case "x-$x11_hidd_vidmode" in
1813                 x-yes|x-no|x-auto)                         ;;
1814                 *)                 x11_hidd_vidmode="auto" ;;
1815             esac
1817             have_vidmode=no
1819             dnl they want it
1820             if test "x-$x11_hidd_vidmode" != "x-no" ; then
1822                 dnl make sure X libs have vidmode functions
1823                 save_cflags="$CFLAGS"
1824                 CFLAGS="$CFLAGS $x_cflags"
1825                 AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryExtension, have_vidmode=yes)
1826                 CFLAGS="$save_cflags"
1827             fi
1829             dnl detection done, prepare output
1830             if test "x-$have_vidmode" = "x-yes" ; then
1831                 dnl we can do vidmode
1832                 DO_VIDMODE_SUPPORT="1"
1833             elif test "x-$x11_hidd_vidmode" = "x-yes" ; then
1834                 dnl they explicitly asked for it, but we can't do it
1835                 AC_MSG_ERROR([X11 vidmode extension not available, cannot enable it as requested])
1836             else
1837                 dnl otherwise just disable it
1838                 DO_VIDMODE_SUPPORT="0"
1839             fi
1840         fi
1842         aros_host_x11_includes=$x_includes 
1843         aros_host_x11_libdirs=$x_libraries
1844     fi
1847     dnl sdl hidd
1848     AC_ARG_ENABLE(sdl_hidd, AC_HELP_STRING([--enable-sdl-hidd],
1849                                            [build SDL hidd for hosted (default=auto)]),
1850                                            sdl_hidd="$enableval",
1851                                            sdl_hidd="auto")
1852     case "x-$sdl_hidd" in
1853         x-yes|x-no|x-auto)                 ;;
1854         *)                 sdl_hidd="auto" ;;
1855     esac
1857     dnl they want it
1858     if test "x-$sdl_hidd" != "x-no" ; then
1860         dnl find sdl
1861         AM_PATH_SDL([1.2.10], have_sdl="yes", have_sdl="no")
1863         if test "x-$have_sdl" != "x-yes" ; then
1865             dnl didn't find it
1866             if test "x-$sdl_hidd" != "x-auto" ; then
1867                 dnl and they explicitly asked for it, bail out
1868                 AC_MSG_ERROR([SDL libs/headers not found, cannot build SDL hidd as requested])
1869             fi
1871         else
1872             dnl found it, set up the metatarget
1873             sdl_hidd_target=kernel-hidd-sdl
1874             aros_host_sdl_cflags=SDL_CFLAGS
1875             aros_host_sdl_libs=SDL_LIBS
1876         fi
1877     fi
1882 dnl See if the user wants dbus.library
1883 AC_MSG_CHECKING([if building of dbus.library is enabled])
1884 AC_ARG_ENABLE(dbus,AC_HELP_STRING([--enable-dbus],[Enable DBUS support via dbus.library (default=no)]),dbus="yes",dbus="no")
1885 if test "$dbus" = "yes" ; then
1886     ENABLE_DBUS=1
1887     DBUS_CFLAGS=`pkg-config --cflags dbus-1`
1888     DBUS_LIBFLAGS=`pkg-config --libs dbus-1`
1889     KERNEL_DBUS_KOBJ=kernel-dbus-kobj
1890     KERNEL_DBUS_INCLUDES=kernel-dbus-includes
1891 else
1892     ENABLE_DBUS=0
1894 AC_MSG_RESULT($dbus)
1897 dnl --------------------------------------------------------------------
1898 dnl Configuration Output Section
1899 dnl --------------------------------------------------------------------
1901 # Generic
1902 AC_SUBST(aros_arch)
1903 AC_SUBST(aros_cpu)
1904 AC_SUBST(aros_flavour)
1905 AC_SUBST(aros_flavour_uc)
1906 AC_SUBST(AROS_BUILDDIR)
1907 AC_SUBST(AROS_BUILDDIR_UNIX)
1908 AC_SUBST(SRCDIR)
1909 AC_SUBST(AROS_PORTSSRCDIR)
1911 # Host related
1912 AC_SUBST(aros_cc_pre)
1913 AC_SUBST(aros_host_strip)
1914 AC_SUBST(aros_host_arch)
1915 AC_SUBST(aros_host_cpu)
1916 AC_SUBST(aros_host_cc)
1917 AC_SUBST(aros_host_ar)
1918 AC_SUBST(aros_host_ranlib)
1919 AC_SUBST(aros_host_ld)
1920 AC_SUBST(aros_host_make)
1921 AC_SUBST(aros_host_cflags)
1922 AC_SUBST(aros_host_ldflags)
1923 AC_SUBST(aros_host_debug)
1924 AC_SUBST(aros_host_mkdep)
1925 AC_SUBST(aros_host_mkargs)
1926 AC_SUBST(aros_host_exe_suffix)
1927 AC_SUBST(aros_host_lib_suffix)
1928 AC_SUBST(aros_tools_dir)
1929 AC_SUBST(aros_host_aclocal)
1930 AC_SUBST(aros_host_autoconf)
1931 AC_SUBST(aros_host_autoheader)
1932 AC_SUBST(aros_host_automake)
1934 # Target Related
1935 AC_SUBST(aros_target_guitheme)
1936 AC_SUBST(aros_target_iconset)
1937 AC_SUBST(aros_target_bootloader)
1938 AC_SUBST(aros_target_arch)
1939 AC_SUBST(aros_target_cpu)
1940 AC_SUBST(aros_target_variant)
1941 AC_SUBST(aros_target_suffix)
1942 AC_SUBST(aros_target_incl)
1943 AC_SUBST(aros_target_ar)
1944 AC_SUBST(aros_target_ranlib)
1945 AC_SUBST(aros_kernel_nm)
1946 AC_SUBST(orig_target_cc)
1947 AC_SUBST(aros_target_cc)
1948 AC_SUBST(aros_target_cxx)
1949 AC_SUBST(aros_kernel_cc)
1950 AC_SUBST(aros_target_as)
1951 AC_SUBST(orig_target_ld)
1952 AC_SUBST(aros_target_ld)
1953 AC_SUBST(aros_kernel_ld)
1954 AC_SUBST(aros_target_cc_includes)
1955 AC_SUBST(aros_target_cc_path)
1956 AC_SUBST(aros_target_objdump)
1957 AC_SUBST(aros_target_objcopy)
1958 AC_SUBST(aros_target_strip)
1959 AC_SUBST(aros_target_nm)
1960 AC_SUBST(aros_kernel_rescomp)
1961 AC_SUBST(aros_shared_default)
1962 AC_SUBST(aros_shared_ld)
1963 AC_SUBST(aros_object_format)
1964 AC_SUBST(aros_compiler_libs)
1965 AC_SUBST(aros_arch_libs)
1967 AC_SUBST(aros_config_cflags)
1968 AC_SUBST(aros_config_aflags)
1969 AC_SUBST(aros_config_ldflags)
1971 AC_SUBST(aros_shared_cflags)
1972 AC_SUBST(aros_shared_aflags)
1973 AC_SUBST(aros_shared_ldflags)
1974 AC_SUBST(aros_kernel_cflags)
1975 AC_SUBST(aros_kernel_objcflags)
1976 AC_SUBST(aros_kernel_ldflags)
1977 AC_SUBST(aros_debug_cflags)
1978 AC_SUBST(aros_debug_aflags)
1979 AC_SUBST(aros_debug_ldflags)
1980 AC_SUBST(aros_paranoia_cflags)
1981 AC_SUBST(aros_target_genmap)
1982 AC_SUBST(aros_target_strip_flags)
1984 AC_SUBST(crosstools_target)
1986 # Graphics Related
1987 AC_SUBST(x11_hidd_target)
1988 AC_SUBST(sdl_hidd_target)
1990 AC_SUBST(aros_default_wbwidth)
1991 AC_SUBST(aros_default_wbheight)
1992 AC_SUBST(aros_default_wbdepth)
1993 AC_SUBST(DO_XSHM_SUPPORT)
1994 AC_SUBST(DO_VIDMODE_SUPPORT)
1996 AC_SUBST(aros_host_x11_includes)
1997 AC_SUBST(aros_host_x11_libdirs)
1998 AC_SUBST(aros_host_sdl_cflags)
1999 AC_SUBST(aros_host_sdl_libs)
2001 # Native version related
2002 AC_SUBST(aros_serial_debug)
2004 # Palm native version related
2005 AC_SUBST(aros_palm_debug_hack)
2007 # Unix/Hosted version related
2008 AC_SUBST(aros_nesting_supervisor)
2010 # Apple iOS related
2011 AC_SUBST(aros_ios_platform)
2012 AC_SUBST(aros_ios_version)
2013 AC_SUBST(aros_ios_sdk)
2015 # DBUS related
2016 AC_SUBST(ENABLE_DBUS)
2017 AC_SUBST(DBUS_CFLAGS)
2018 AC_SUBST(DBUS_LIBFLAGS)
2019 AC_SUBST(KERNEL_DBUS_KOBJ)
2020 AC_SUBST(KERNEL_DBUS_INCLUDES)
2022 #X11 related
2023 AC_SUBST(ENABLE_X11)
2025 # Debug related
2026 AC_SUBST(aros_debug)
2027 AC_SUBST(aros_mungwall_debug)
2028 AC_SUBST(aros_stack_debug)
2029 AC_SUBST(aros_modules_debug)
2031 # Collect-aros stuff: "-ius" to ignore undefined symbols
2032 AC_SUBST(ignore_undefined_symbols)
2034 # C compiler related
2035 AC_SUBST(gcc_target_cpu)
2037 dnl Prepare for output, make up all the generated patches
2038 case "$aros_flavour" in
2039 emulation)      aros_flavour_uc="AROS_FLAVOUR_EMULATION"
2040                 aros_flavour="emulation" ;;
2041 emulcompat)     aros_flavour_uc="(AROS_FLAVOUR_EMULATION|AROS_FLAVOUR_BINCOMPAT)"
2042                 aros_flavour="emulation" ;;
2043 standalone)     aros_flavour_uc="AROS_FLAVOUR_STANDALONE"
2044                 aros_flavour="standalone";;
2045 standcompat)    aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_BINCOMPAT)"
2046                 aros_flavour="standalone";;
2047 native)         aros_flavour_uc="AROS_FLAVOUR_NATIVE"
2048                 aros_flavour="native" ;;
2049 nativecompat)   aros_flavour_uc="(AROS_FLAVOUR_NATIVE|AROS_FLAVOUR_BINCOMPAT)"
2050                 aros_flavour="native" ;;
2051 linklib)        aros_flavour_uc="AROS_FLAVOUR_LINKLIB"
2052                 aros_flavour="linklib" ;;
2053 palmnative)     aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
2054                 aros_flavour="palmnative" ;;
2055 mac68knative)   aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
2056                 aros_flavour="mac68knative" ;;
2057 ppcnative)      aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_BINCOMPAT)"
2058                 aros_flavour="ppcnative" ;;
2059 esac
2061 if test ! -d ${aros_inc_dir} ; then
2062     ${MKDIR} ${aros_inc_dir}
2064 if test ! -d ${aros_geninc_dir} ; then
2065     ${MKDIR} ${aros_geninc_dir}
2067 if test ! -d ${aros_hostcfg_dir} ; then
2068     ${MKDIR} ${aros_hostcfg_dir}
2070 if test ! -d ${aros_targetcfg_dir} ; then
2071     ${MKDIR} ${aros_targetcfg_dir}
2073 if test ! -d ${aros_tools_dir} ; then
2074     ${MKDIR} ${aros_tools_dir}
2076 if test ! -d ${aros_scripts_dir} ; then
2077     ${MKDIR} ${aros_scripts_dir}
2080 AC_CONFIG_HEADERS(${aros_geninc_dir}/host-conf.h:config/host-conf.h.in)
2082 AC_CONFIG_COMMANDS([compiler_executable],
2083     [
2084         prefix=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}
2085         mkdir -p $prefix
2086         prefix="${prefix}/${aros_target_cpu}-aros"
2087         prefix2=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros
2089         echo ${prefix}
2090         echo ${prefix2}
2091         chmod a+x ${prefix2}-gcc ${prefix2}-ld
2093         ln -sf ${prefix2}-gcc          ${prefix}-gcc
2094         ln -sf ${prefix2}-ld           ${prefix}-ld
2096         ln -sf $aros_target_as_ln$aros_host_exe_suffix      ${prefix}-as
2097         ln -sf $aros_target_nm_ln$aros_host_exe_suffix      ${prefix}-nm
2098         ln -sf $aros_target_ar_ln$aros_host_exe_suffix      ${prefix}-ar
2099         ln -sf $aros_target_ranlib_ln$aros_host_exe_suffix  ${prefix}-ranlib
2100         ln -sf $aros_target_objcopy_ln$aros_host_exe_suffix ${prefix}-objcopy
2101         ln -sf $aros_target_objdump_ln$aros_host_exe_suffix ${prefix}-objdump
2102         ln -sf $aros_target_strip_ln$aros_host_exe_suffix   ${prefix}-strip
2104         ln -sf $aros_target_as_ln$aros_host_exe_suffix      ${prefix2}-as
2105         ln -sf $aros_target_nm_ln$aros_host_exe_suffix      ${prefix2}-nm
2106         ln -sf $aros_target_ar_ln$aros_host_exe_suffix      ${prefix2}-ar
2107         ln -sf $aros_target_ranlib_ln$aros_host_exe_suffix  ${prefix2}-ranlib
2108         ln -sf $aros_target_objcopy_ln$aros_host_exe_suffix ${prefix2}-objcopy
2109         ln -sf $aros_target_objdump_ln$aros_host_exe_suffix ${prefix2}-objdump
2110         ln -sf $aros_target_strip_ln$aros_host_exe_suffix   ${prefix2}-strip
2111     ],
2112     [
2113         aros_host_exe_suffix=${aros_host_exe_suffix}
2114         aros_tools_dir=${aros_tools_dir}
2115         aros_target_cpu=${aros_target_cpu}
2116         aros_target_arch=${aros_target_arch}
2117         aros_target_suffix=${aros_target_suffix}
2118         aros_target_nm_ln=${aros_target_nm_ln}
2119         aros_target_as_ln=${aros_target_as_ln}
2120         aros_target_ar_ln=${aros_target_ar_ln}
2121         aros_target_ranlib_ln=${aros_target_ranlib_ln}
2122         aros_target_objdump_ln=${aros_target_objdump_ln}
2123         aros_target_objcopy_ln=${aros_target_objcopy_ln}
2124         aros_target_strip_ln=${aros_target_strip_ln}
2125     ]
2127 AC_CONFIG_COMMANDS([genshared_executable],
2128     [chmod a+x ${aros_scripts_dir}/genshared],
2129     [aros_scripts_dir=${aros_scripts_dir}]
2131 AC_CONFIG_COMMANDS([genmf_executable],
2132     [chmod a+x ${aros_tools_dir}/genmf.py],
2133     [aros_tools_dir=${aros_tools_dir}]
2136 AC_CONFIG_FILES(
2137     Makefile
2138     config/make.cfg
2139     ${aros_inc_dir}/config.h:config/config.h.in
2140     ${aros_geninc_dir}/config.h:config/config.h.in
2141     ${aros_hostcfg_dir}/host.cfg:config/host.cfg.in
2142     ${aros_targetcfg_dir}/target.cfg:config/target.cfg.in
2143     mmake.config
2144     ${aros_targetcfg_dir}/make.defaults:config/make.defaults.in
2145     ${aros_targetcfg_dir}/specs:config/specs.in
2146     ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-gcc:scripts/aros-gcc.in
2147     ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-ld:scripts/aros-ld.in
2148     ${aros_scripts_dir}/genshared:compiler/c_lib/source/lib_source/genshared.in
2149     ${aros_tools_dir}/genmf.py:tools/genmf/genmf.py
2150     tools/collect-aros/env.h
2153 AC_OUTPUT
2155 dnl This is in order to not define SHARED_CFLAGS sometimes
2156 dnl We don't always do aros_shared_ar, aros_shared_cflags
2158 #XXX compatability...
2159 aros_shared_ar="$aros_shared_ld $aros_shared_ldflags -o"
2161 if test -n "$aros_shared_cflags" ; then
2162     echo "SHARED_CFLAGS := $aros_shared_cflags" >> ${aros_hostcfg_dir}/host.cfg
2163     echo "SHARED_AR := $aros_shared_ar" >> ${aros_hostcfg_dir}/host.cfg