arch/m68k-amiga: Native Amiga support
[AROS.git] / configure.in
bloba1ab50fa619947db14863d0e32c66e84d0c114d9
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 if test "$target_os" = "ios"; then
671 AC_MSG_CHECKING([XCode path])
672 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")
673 AC_MSG_RESULT($aros_xcode_path)
675 AC_MSG_CHECKING([for minimum supported iOS version])
676 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")
677 AC_MSG_RESULT($aros_ios_version)
679 AC_MSG_CHECKING([what iOS SDK version to use])
680 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")
681 AC_MSG_RESULT($aros_ios_sdk)
685 #-----------------------------------------------------------------------------
686 AC_MSG_CHECKING([what target variant to enable])
687 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")
688 if test "$target_variant" = "none"; then
689     aros_target_variant=""
690     aros_target_suffix=""
691 else
692     aros_target_variant="$target_variant"
693     aros_target_suffix="-$target_variant"
695 AC_MSG_RESULT($enableval)
697 target_bootloader="none"
699 #-----------------------------------------------------------------------------
700 # This is the target configuration switch.
701 case "$target_os" in
702     linux*)
703         aros_target_arch="linux"
704         case "$target_cpu" in
705             *m68k*)
706                 aros_target_cpu="m68k"
707                 aros_object_format="m68kelf"
708                 aros_flavour="emulcompat"
709                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D__mc68000 -D__linux__"
710                 aros_shared_ldflags="-Wl,-T,\$(TOP)/config/linux/m68k/script.so"
711                 aros_kernel_ldflags="-Wl,-rpath,./lib,-T,\$(TOP)/config/linux/m68k/script.normal"
712                 gcc_target_cpu="mc68000"
713                 ;;
714             *i?86*)
715                 aros_target_cpu="i386"
716                 aros_object_format="elf_i386"
717                 aros_flavour="emulation"
718                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__linux__"
719                 aros_config_cflags="$aros_config_cflags -m32 -march=i486"
720                 aros_kernel_cflags="$aros_kernel_cflags -m32 -march=i486"
721                 aros_config_aflags="$aros_config_aflags -m32 -march=i486"
722                 aros_config_ldflags="-m32 -march=i486"
723                 aros_kernel_ldflags="-melf_i386"
724                 aros_default_wbdepth=8
725                 gcc_target_cpu="i386"
726                 ;;
727             *x86_64*)
728                 aros_target_cpu="x86_64"
729                 aros_object_format="elf_x86_64"
730                 aros_flavour="emulation"
731                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64 -D__linux__"
732                 aros_config_cflags="$aros_config_cflags -mno-red-zone"
733                 aros_default_wbdepth=8
734                 gcc_target_cpu="x86_64"
735                 ;;
736             *powerpc*)
737                 aros_target_cpu="ppc"
738                 aros_object_format="elf32ppc"
739                 aros_flavour="emulation"
740                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc -D__linux__"
741                 aros_default_wbdepth=8
742                 gcc_target_cpu="ppc"
743                 ;;
744 # TODO
745 # Same as powerpc, but I need this for the nightly build to work again.
746 # Actually, the nightly should be made working with powerpc target.
747 # That just was too much work for the moment, another week or two.
748             *ppc*)
749                 aros_target_cpu="ppc"
750                 aros_object_format="elf32ppc"
751                 aros_flavour="emulation"
752                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc -D__linux__"
753                 aros_default_wbdepth=8
754                 gcc_target_cpu="ppc"
755                 ;;
756             *arm*)
757                 aros_target_cpu="arm"
758                 aros_object_format="armelf_linux_eabi"
759                 aros_flavour="emulation"
760                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm -D__linux__"
761                 gcc_target_cpu="arm"
762                 aros_config_cflags="$aros_config_cflags -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -fno-asynchronous-unwind-tables -fno-exceptions"
763                 aros_config_aflags="$aros_config_aflags -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -fno-asynchronous-unwind-tables -fno-exceptions"
764                 ;;
765             *)
766                 AC_MSG_ERROR("Unknown CPU for Linux -- $target_cpu")
767                 ;;
768         esac
769     ;;
771     pc)
772         aros_target_arch="pc"
773         aros_shared_default="no"
774         target_bootloader="grub2"
775         case "$target_cpu" in
776             *i?86*)
777                 aros_target_cpu="i386"
779                 dnl If somebody hasn't already set the target object
780                 dnl format, then use this value. Mostly to support
781                 dnl FreeBSD cross-compilation.
782                 dnl TODO: Remove when we always use our compiler.
784                 if test "$aros_object_format" = "" ; then
785                     aros_object_format="elf_i386"
786                 fi
787                 aros_flavour="standalone"
788                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
789                 aros_config_cflags="$aros_config_cflags -m32 -march=i486"
790                 aros_kernel_cflags="$aros_kernel_cflags -m32 -march=i486"
791                 aros_config_aflags="$aros_config_aflags -m32 -march=i486"
792                 aros_config_ldflags="-m32 -march=i486"
793                 aros_kernel_ldflags="-melf_i386"
794                 aros_default_wbwidth=640
795                 aros_default_wbheight=480
796                 gcc_target_cpu="i386"
797                 ;;
798             *x86_64*)
799                 aros_target_cpu="x86_64"
800                 aros_serial_debug=1
801                 if test "$aros_object_format" = "" ; then
802                     aros_object_format="elf_x86_64"
803                 fi
804                 aros_flavour="standalone"
805                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
806                 aros_config_cflags="$aros_config_cflags -fno-asynchronous-unwind-tables -mno-red-zone"
807                 aros_kernel_ldflags=""
808                 aros_default_wbwidth=640
809                 aros_default_wbheight=480
810                 gcc_target_cpu="x86_64"
811                 ;;
812             *)
813                 AC_MSG_ERROR("Unknown native CPU -- $target_cpu")
814                 ;;
815         esac
816         ;;
818     prep)
819         aros_target_arch="prep"
820         aros_shared_default="no"
821         aros_target_cpu="ppc"
822         aros_object_format="elf32ppc"
823         aros_flavour="ppcnative"
824         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
825         aros_kernel_ldflags=""
826         aros_default_wbwidth=640
827         aros_default_wbheight=480
828         gcc_target_cpu="ppc"
829         ;;
831     freebsd*)
832         aros_target_arch="freebsd"
833         aros_target_cpu="i386"
834         aros_flavour="emulation"
835         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
836         gcc_target_cpu="i386"
838         aros_target_strip_flags="-x"
839         ;;
841     darwin*)
842         aros_target_arch="darwin"
843         aros_flavour="emulation"
844         case "$target_cpu" in
845             *i?86*)
846                 aros_target_cpu="i386"
847                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
848                 aros_kernel_cflags="$aros_kernel_cflags -m32"
849                 aros_kernel_ldflags="$aros_kernel_ldflags -m32"
850                 aros_default_wbdepth=8
851                 gcc_target_cpu="i386"
852                 aros_object_format="elf_i386"
853                 aros_target_strip_flags="-x"
854                 aros_target_cc="i386-aros-gcc"
855                 aros_target_cxx="i386-aros-g++"
856                 aros_target_ld="i386-aros-ld"
857                 aros_target_as="i386-aros-as"
858                 aros_target_ar="i386-aros-ar"
859                 aros_target_ranlib="i386-aros-ranlib"
860                 aros_target_nm="i386-aros-nm"
861                 aros_target_strip="i386-aros-strip"
862                 aros_target_objcopy="i386-aros-objcopy"
863                 aros_target_objdump="i386-aros-objdump"
864                 target_tool_prefix="i686-apple-darwin10-"
865                 ;;
866             *x86_64*)
867                 aros_target_cpu="x86_64"
868                 aros_object_format="elf_x86_64"
869                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
870                 aros_kernel_cflags="$aros_kernel_cflags -m64"
871                 aros_kernel_ldflags="$aros_kernel_ldflags -m64"
872                 aros_default_wbdepth=8
873                 gcc_target_cpu="x86_64"
874                 aros_target_cc="x86_64-aros-gcc"
875                 aros_target_cxx="x86_64-aros-g++"
876                 aros_target_ld="x86_64-aros-ld"
877                 aros_target_as="x86_64-aros-as"
878                 aros_target_ar="x86_64-aros-ar"
879                 aros_target_ranlib="x86_64-aros-ranlib"
880                 aros_target_nm="x86_64-aros-nm"
881                 aros_target_strip="x86_64-aros-strip"
882                 aros_target_objcopy="x86_64-aros-objcopy"
883                 aros_target_objdump="x86_64-aros-objdump"
884                 target_tool_prefix="i686-apple-darwin10-"
885                 ;;
886             *ppc*)
887                 aros_target_cpu="ppc"
888                 aros_object_format="elf32_ppc"
889                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
890                 aros_default_wbdepth=8
891                 gcc_target_cpu="ppc"
892                 aros_target_cc="ppc-aros-gcc"
893                 aros_target_cxx="ppc-aros-g++"
894                 aros_target_ld="ppc-aros-ld"
895                 aros_target_as="ppc-aros-as"
896                 aros_target_ar="ppc-aros-ar"
897                 aros_target_ranlib="ppc-aros-ranlib"
898                 aros_target_nm="ppc-aros-nm"
899                 aros_target_strip="ppc-aros-strip"
900                 aros_target_objcopy="ppc-aros-objcopy"
901                 aros_target_objdump="ppc-aros-objdump"
902                 target_tool_prefix="powerpc-apple-darwin10-"
903                 ;;
904             *)
905                 AC_MSG_ERROR("Unsupported target CPU for darwin hosted flavour -- $target_cpu")
906                 ;;
907         esac
908         ;;
910     ios*)
911         aros_target_arch="ios"
912         aros_flavour="emulation"
913         # This is here because it may depend on iOS or SDK version
914         aros_kernel_objcflags="-fobjc-abi-version=2 -fobjc-legacy-dispatch"
915         case "$target_cpu" in
916             *i?86*)
917                 aros_ios_platform="iPhoneSimulator"
918                 aros_target_cpu="i386"
919                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
920                 aros_default_wbdepth=8
921                 gcc_target_cpu="i386"
922                 aros_object_format="elf_i386"
923                 aros_target_strip_flags="-x"
924                 aros_target_cc="i386-aros-gcc"
925                 aros_target_cxx="i386-aros-g++"
926                 aros_target_ld="i386-aros-ld"
927                 aros_target_as="i386-aros-as"
928                 aros_target_ar="i386-aros-ar"
929                 aros_target_ranlib="i386-aros-ranlib"
930                 aros_target_nm="i386-aros-nm"
931                 aros_target_strip="i386-aros-strip"
932                 aros_target_objcopy="i386-aros-objcopy"
933                 aros_target_objdump="i386-aros-objdump"
934                 target_tool_prefix="i686-apple-darwin10-"
935                 target_tool_flags="-m32"
936                 ;;
937             *arm*)
938                 aros_ios_platform="iPhoneOS"
939                 aros_target_cpu="arm"
940                 aros_object_format="armelf_linux_eabi"
941                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
942                 aros_default_wbdepth=8
943                 gcc_target_cpu="arm"
944                 aros_kernel_ld="ld -arch armv6"
945                 aros_target_cc="arm-elf-gcc"
946                 aros_target_ld="arm-elf-ld"
947                 aros_target_as="arm-elf-as"
948                 aros_target_ar="arm-elf-ar"
949                 aros_target_ranlib="arm-elf-ranlib"
950                 aros_target_nm="arm-elf-nm"
951                 aros_target_strip="arm-elf-strip"
952                 aros_target_objcopy="arm-elf-objcopy"
953                 aros_target_objdump="arm-elf-objdump"
954                 target_tool_prefix="arm-apple-darwin10-" 
955                 aros_default_wbwidth=320
956                 aros_default_wbheight=480
957                 export PATH="$aros_xcode_path/Platforms/$aros_ios_platform.platform/Developer/usr/bin:$PATH"
958                 ;;
959             *)
960                 AC_MSG_ERROR("Unsupported target CPU for iOS hosted flavour -- $target_cpu")
961                 ;;
962         esac
963         aros_ios_sdk="$aros_xcode_path/Platforms/$aros_ios_platform.platform/Developer/SDKs/$aros_ios_platform$aros_ios_sdk.sdk"
964         target_tool_flags="$target_tool_flags --sysroot $aros_ios_sdk"
965         ;;
967     dragonfly*)
968         aros_target_arch="dragonfly"
969         aros_flavour="emulation"
970         case "$target_cpu" in
971             *i?86*)
972                 aros_target_cpu="i386"
973                 aros_object_format="elf_i386"
974                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__DragonFly__"
975                 ;;
976             *x86_64*)
977                 aros_target_cpu="x86_64"
978                 aros_object_format="elf_x86_64"
979                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64 -D__DragonFly__"
980                 ;;
981             *)
982                 AC_MSG_ERROR("Unknown CPU for DragonFly -- $target_cpu")
983                 ;;
984         esac
985         ;;
987     netbsd*)
988         aros_target_arch="netbsd"
989         case "$target_cpu" in
990             *m68k*)
991                 aros_target_cpu="m68k"
992                 aros_object_format="m68kelf"
993                 aros_flavour="emulcompat"
994                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D__mc68000 -D__NetBSD__"
995                 gcc_target_cpu="mc68000"
996                 ;;
997             *i?86*)
998                 aros_target_cpu="i386"
999                 aros_object_format="elf_i386"
1000                 aros_flavour="emulation"
1001                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__NetBSD__"
1002                 aros_default_wbdepth=8
1003                 gcc_target_cpu="i386"
1004                 ;;
1005             *)
1006                 AC_MSG_ERROR("Unknown CPU for NetBSD -- $target_cpu")
1007                 ;;
1008         esac
1009         aros_target_genmap="-Wl,-M -Xlinker >"
1010         aros_flavour="emulation"
1011         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1012         ;;   
1014     openbsd*)
1015         aros_target_arch="openbsd"
1016         case "$target_cpu" in
1017             *i?86*)
1018                 aros_target_cpu="i386"
1019                 aros_object_format="elf_i386"
1020                 aros_flavour="emulation"
1021                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__OpenBSD__"
1022                 gcc_target_cpu="i386"
1023                 ;;
1024             *)
1025                 AC_MSG_ERROR("Unknown CPU for OpenBSD -- $target_cpu")
1026                 ;;
1027         esac
1028         aros_target_genmap="-Wl,-M -Xlinker >"
1029         aros_target_nm_flags="-u"
1030         aros_flavour="emulation"
1031         ;;
1033     solaris*)
1034         aros_target_arch="solaris"
1035         case "$target_cpu" in
1036            *i?86*)
1037                aros_target_cpu="i386"
1038                aros_object_format="elf_i386"
1039                aros_flavour="emulation"
1040                aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__Solaris__"
1041                aros_default_wbdepth=8
1042                gcc_target_cpu="i386"
1043                ;;
1044             *sparc*)
1045                 aros_target_cpu="sparc"
1046                 aros_object_format="elf_sparc"
1047                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dsparc -D__Solaris__"
1048                 gcc_target_cpu="sparc"
1049                 ;;
1050             *)
1051                 AC_MSG_ERROR("Unknown CPU for Solaris -- $target_cpu")
1052                 ;;
1053         esac
1054         aros_config_cflags="$aros_config_cflags -D$aros_target_cpu"
1055         aros_flavour="emulation"
1056         ;;
1058     morphos*)
1059         aros_target_arch="morphos"
1060         aros_shared_default="no"
1061         aros_target_cpu="ppc"
1062         aros_object_format="elf_ppc"
1063         aros_flavour="nativecompat"
1064         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1065         gcc_target_cpu="ppc"
1066         ;;
1068     sam440)
1069         aros_target_arch="sam440"
1070         aros_shared_default="no"
1071         aros_target_cpu="ppc"
1072         aros_object_format="elf32ppc"
1073         aros_flavour="ppcnative"
1074         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1075         aros_kernel_ldflags=""
1076         aros_default_wbwidth=1024
1077         aros_default_wbheight=768
1078         aros_default_wbdepth=24
1079         aros_config_cflags="$aros_config_cflags -mcpu=440fp -mno-toc -fno-asynchronous-unwind-tables"
1080         gcc_target_cpu="powerpc"
1081         ;;
1083     efika)
1084         aros_target_arch="efika"
1085         aros_shared_default="no"
1086         aros_target_cpu="arm"
1087         aros_object_format="armelf_linux_eabi"
1088         aros_flavour="standalone"
1089         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
1090         aros_kernel_ldflags=""
1091         aros_default_wbwidth=1024
1092         aros_default_wbheight=600
1093         aros_arch_libs="-laeabi"
1094         aros_config_cflags="$aros_config_cflags -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -fno-asynchronous-unwind-tables -fno-exceptions"
1095         aros_config_aflags="$aros_config_aflags -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -fno-asynchronous-unwind-tables -fno-exceptions"
1096         ;;
1097         
1098     chrp)
1099     aros_target_arch="chrp"
1100     aros_shared_default="no"
1101     aros_target_cpu="ppc"
1102     aros_object_format="elf32ppc"
1103     aros_flavour="ppcnative"
1104     aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1105     aros_kernel_ldflags=""
1106     aros_default_wbwidth=640
1107     aros_default_wbheight=480
1108     aros_config_cflags="$aros_config_cflags -mno-toc -fno-asynchronous-unwind-tables"    
1109     gcc_target_cpu="powerpc"
1110         case "$aros_target_variant" in
1111             efika)
1112             aros_config_cflags="$aros_config_cflags -DBIG_ENDIAN_OHCI=1 -mcpu=603e"
1113             ;;
1114         esac
1115     ;;
1117     amiga*)
1118         aros_target_arch="amiga"
1119         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D_AMIGA -DAMIGA"
1120         aros_shared_default="no"
1122         case "$target_cpu" in
1123             *m68k-eabi)
1124                 aros_target_cpu="m68k"
1125                 aros_object_format="m68kelf"
1126                 aros_flavour="standalone"
1127                 gcc_target_cpu="mc68000"
1128                 aros_config_cflags="$aros_config_cflags -g3 -fno-strict-aliasing -ffreestanding -fomit-frame-pointer -${gcc_target_cpu} -fbuiltin"
1129                 aros_config_aflags="$aros_config_aflags -g3 -fno-strict-aliasing -ffreestanding -fomit-frame-pointer -${gcc_target_cpu}"
1130                 aros_debug_cflags="-Wall -Werror-implicit-function-declaration $aros_symbols_debug  $aros_messages_debug -${gcc_target_cpu}"
1131                 target_tool_prefix="m68k-elf-"
1132                 aros_target_nostdlib_ldflags="" # We always need -lgcc
1133                 aros_target_strip_flags="-R.comment"
1134                 ;;
1135             *m68k*)
1136                 aros_target_cpu="m68k"
1137                 aros_object_format="m68kelf"
1138                 aros_flavour="standcompat"
1139                 gcc_target_cpu="mc68000"
1140                 aros_config_cflags="$aros_config_cflags -g3 -fno-strict-aliasing -ffreestanding -fomit-frame-pointer -${gcc_target_cpu} -fbuiltin"
1141                 aros_config_aflags="$aros_config_aflags -g3 -fno-strict-aliasing -ffreestanding -fomit-frame-pointer -${gcc_target_cpu}"
1142                 aros_debug_cflags="-Wall -Werror-implicit-function-declaration $aros_symbols_debug  $aros_messages_debug -${gcc_target_cpu}"
1143                 target_tool_prefix="m68k-elf-"
1144                 aros_target_nostdlib_ldflags="" # We always need -lgcc
1145                 aros_target_strip_flags="-R.comment"
1146                 ;;
1147             *ppc*)
1148                 aros_cpu="ppc"
1149                 aros_flavour="native"
1150                 gcc_target_cpu="ppc"
1151                 ;;
1152             *)
1153                 AC_MSG_ERROR("Unknown CPU for Amiga $target_cpu")
1154                 ;;
1155         esac
1156         ;;
1158     mingw*)
1159         aros_target_arch="mingw32"
1160         aros_shared_default="no"
1161         aros_flavour="emulation"
1162         aros_shared_cflags=""
1163         need_dlopen="no"
1164         rescomp="windres"
1165         case "$target_cpu" in
1166             *i?86*)
1167                 aros_target_cpu="i386"
1168                 aros_object_format="elf_i386"
1169                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1170                 aros_default_wbdepth=8
1171                 gcc_target_cpu="i386"
1172                 aros_target_cc="i386-aros-gcc"
1173                 aros_target_cxx="i386-aros-g++"
1174                 aros_target_ld="i386-aros-ld"
1175                 aros_target_as="i386-aros-as"
1176                 aros_target_ar="i386-aros-ar"
1177                 aros_target_ranlib="i386-aros-ranlib"
1178                 aros_target_nm="i386-aros-nm"
1179                 aros_target_strip="i386-aros-strip"
1180                 aros_target_objcopy="i386-aros-objcopy"
1181                 aros_target_objdump="i386-aros-objdump"
1182                 target_tool_prefix="i386-mingw32-"
1183                 ;;
1184             *x86_64*)
1185                 aros_target_cpu="x86_64"
1186                 aros_object_format="elf_x86_64"
1187                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
1188                 aros_default_wbdepth=8
1189                 gcc_target_cpu="x86_64"
1190                 aros_target_cc="x86_64-aros-gcc"
1191                 aros_target_cxx="x86_64-aros-g++"
1192                 aros_target_ld="x86_64-aros-ld"
1193                 aros_target_as="x86_64-aros-as"
1194                 aros_target_ar="x86_64-aros-ar"
1195                 aros_target_ranlib="x86_64-aros-ranlib"
1196                 aros_target_nm="x86_64-aros-nm"
1197                 aros_target_strip="x86_64-aros-strip"
1198                 aros_target_objcopy="x86_64-aros-objcopy"
1199                 aros_target_objdump="x86_64-aros-objdump"
1200                 target_tool_prefix="x86_64-w64-mingw32-"
1201                 ;;
1202             *arm*)
1203                 aros_target_cpu="arm"
1204                 aros_object_format="armelf_linux_eabi"
1205                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
1206                 aros_default_wbdepth=8
1207                 gcc_target_cpu="arm"
1208                 aros_target_cc="arm-elf-gcc"
1209                 aros_target_ld="arm-elf-ld"
1210                 aros_target_as="arm-elf-as"
1211                 aros_target_ar="arm-elf-ar"
1212                 aros_target_ranlib="arm-elf-ranlib"
1213                 aros_target_nm="arm-elf-nm"
1214                 aros_target_strip="arm-elf-strip"
1215                 aros_target_objcopy="arm-elf-objcopy"
1216                 aros_target_objdump="arm-elf-objdump"
1217                 target_tool_prefix="arm-mingw32ce-"
1218                 aros_default_wbwidth=160
1219                 aros_default_wbheight=160
1220                 ;;
1221             *)
1222                 AC_MSG_ERROR("Unknown CPU for Mingw32 -- $target_cpu")
1223                 ;;
1224         esac
1225         if test $host_os = "cygwin"; then
1226                 aros_kernel_cflags="-mno-cygwin"
1227         fi
1228     ;;
1229     pp*)
1230         aros_target_arch="pp"
1231         aros_shared_default="no"
1232         case "$target_cpu" in
1233             *m68k*)
1234                 aros_target_cpu="m68k"
1235                 aros_object_format="m68kelf"
1236                 aros_flavour="palmnative"
1237                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
1238                 aros_default_wbwidth=160
1239                 aros_default_wbheight=160
1240                 aros_default_wbdepth=1
1241                 aros_target_ar_flags="cru"
1242                 aros_compiler_libs="-lgcc1"
1243                 aros_shared_default=no
1244                 aros_shared_cflags="-fpic"
1245                 aros_shared_aflags=""
1246                 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
1247                 aros_kernel_ldflags="-Wl,-rpath,./lib"
1248                 aros_debug_cflags="-Wall -Werror-implicit-function-declaration $aros_symbols_debug  $aros_messages_debug -mc68000 -Wa,-mc68000"
1249                 aros_debug_aflags=""
1250                 aros_debug_ldflags="$aros_symbols_debug"
1251                 aros_mungwall_debug="0"
1252                 aros_modules_debug="0"
1253                 gcc_target_cpu="mc68000"
1254                 ignore_undefined_symbols="-ius"
1255                 ;;
1256            *)
1257                 AC_MSG_ERROR("Unknown CPU for PalmPilot -- $target_cpu")
1258                 ;;
1259         esac
1260         ;;
1262     mac*)
1263         aros_target_arch="mac"
1264         aros_shared_default="no"
1265         case "$target_cpu" in
1266             *m68k*)
1267                 aros_target_cpu="m68k"
1268                 aros_object_format="m68kelf"
1269                 aros_flavour="mac68knative"
1270                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
1271                 aros_default_wbwidth=512
1272                 aros_default_wbheight=384
1273                 aros_default_wbdepth=8
1274                 aros_target_ar_flags="cru"
1275                 aros_compiler_libs="-lgcc1"
1276                 aros_shared_default=no
1277                 aros_shared_cflags="-fpic"
1278                 aros_shared_aflags=""
1279                 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
1280                 aros_kernel_ldflags="-Wl,-rpath,./lib"
1281                 aros_debug_cflags="-Wall -Werror-implicit-function-declaration $aros_symbols_debug  $aros_messages_debug -mc68000"
1282                 aros_debug_aflags=""
1283                 aros_debug_ldflags="$aros_symbols_debug"
1284                 aros_mungwall_debug="0"
1285                 aros_modules_debug="0"
1286                 gcc_target_cpu="mc68000"
1287                 ignore_undefined_symbols="-ius"
1288                 ;;
1289            *)
1290                 AC_MSG_ERROR("Unknown CPU for Mac68k -- $target_cpu")
1291                 ;;
1292         esac
1293         ;;
1295     *)
1296         AC_MSG_ERROR([Unsupported target architecture $target])
1297         ;;
1298 esac
1300 AC_MSG_CHECKING([Where to download sourcecode for external ports])
1301 AC_ARG_WITH(portssources,AC_HELP_STRING([--with-portssources=DIR],[Where to download sourcecode for external ports]),with_portssrcdir=$withval,with_portssrcdir="default")
1302 if test "$with_portssrcdir" = "default"; then
1303     AROS_PORTSSRCDIR="$AROS_BUILDDIR_UNIX/bin/Sources"
1304 else
1305     AROS_PORTSSRCDIR="$with_portssrcdir"
1307 AC_MSG_RESULT($AROS_PORTSSRCDIR)
1309 AC_MSG_CHECKING([which bootloader to use])
1310 AC_ARG_WITH(bootloader,AC_HELP_STRING([--with-bootloader=NAME],[Use a specific bootloader]),target_bootloader=$withval,target_bootloader=$target_bootloader)
1311 if test "$target_bootloader" = "none"; then
1312     aros_target_bootloader=""
1313 else
1314     aros_target_bootloader="$target_bootloader"
1316 AC_MSG_RESULT($target_bootloader)
1318 AC_MSG_CHECKING([which icon-set to use])
1319 AC_ARG_WITH(iconset,AC_HELP_STRING([--with-iconset=NAME],[Use a specific Icon-set (default=Gorilla).]),target_iconset=$withval,target_iconset="default")
1320 if test "$target_iconset" = "default"; then
1321     aros_target_iconset="Gorilla"
1322     target_iconset="default (Gorilla)"
1323 else
1324     aros_target_iconset="$target_iconset"
1326 AC_MSG_RESULT($target_iconset)
1328 AC_MSG_CHECKING([which GUI Theme to use])
1329 AC_ARG_WITH(theme,AC_HELP_STRING([--with-theme=NAME],[Use a specific GUI Theme]),target_guitheme=$withval,target_guitheme="default")
1330 if test "$target_guitheme" = "default"; then
1331     aros_target_guitheme="Ice"
1332 else
1333     aros_target_guitheme="$target_guitheme"
1335 AC_MSG_RESULT($aros_target_guitheme)
1337 # Find out if we are cross-compiling (i.e. if we can't use the host compiler
1338 # for target code)
1339 cross_compiling=no
1340 if test "$aros_host_cpu" != "$aros_target_cpu" ; then
1341     cross_compiling=yes
1343 if test "$aros_host_cpu" == "x86_64" ; then
1344     if test "$aros_target_cpu" == "i386" ; then
1345         if test "$aros_target_arch" != "mingw32"; then
1346             cross_compiling=no
1347         fi
1348     fi
1351 # Set prefix for target compiler etc. if we're cross-compiling
1352 # (should possibly be earlier but needs to be after AC_PROG_CC)
1353 if test "$cross_compiling" = "yes" ; then
1354     if test "$target_tool_prefix" = ""; then
1355         target_tool_prefix=${target_cpu}-elf-
1356     fi
1357     CC=${target_tool_prefix}gcc
1358     if test "$target_tool_version" != "default"; then
1359         CC="$CC-$target_tool_version"
1360     fi
1361     AC_PATH_PROG(CC,$CC)
1362     AROS_REQUIRED(gcc,$CC)
1364 CC="$CC $target_tool_flags"
1366 #-----------------------------------------------------------------------------
1368 # Disable pointer-signedness warnings if the compiler recognises the option
1370 AC_MSG_CHECKING([whether ${CC} accepts -Wno-pointer-sign])
1371 save_cflags="$CFLAGS"
1372 CFLAGS="$CFLAGS -Wno-pointer-sign"
1373 AC_TRY_COMPILE(,, use_no_sign_warning="yes", use_no_sign_warning="no")
1374 AC_MSG_RESULT($use_no_sign_warning)
1375 if test "x-$use_no_sign_warning" = "x-yes" ; then
1376     aros_config_cflags="$aros_config_cflags -Wno-pointer-sign"
1378 CFLAGS="$save_cflags"
1380 #-----------------------------------------------------------------------------
1382 # Find all the tools we need to compile. This could be cross-compiling
1383 # though! If that is the case we use the GNU form of the target and
1384 # simply add this to the front of the binary name. This is rather simple,
1385 # but it should work under most circumstances.
1387 # The default tools are to use the same as the host, but only if the
1388 # host and target CPU are the same. With GCC this is normally enough.
1391 aros_cc_pre=""
1392 aros_shared_ld="$aros_host_ld"
1394 aros_target_mkdep="$aros_host_mkdep"
1395 aros_target_incl_def="$aros_host_incl"
1397 aros_kernel_cc="$CC"
1399 # The default tools executables to be linked to.
1400 if test "$aros_target_cc" != ""; then
1401     AC_PATH_PROG(aros_target_cc,$aros_target_cc)
1402     AROS_REQUIRED(gcc,$aros_target_cc)
1404 if test "$aros_target_ld" != ""; then
1405     AC_PATH_PROG(aros_target_ld,$aros_target_ld)
1406     AROS_REQUIRED(ld,$aros_target_ld)
1409 if test "$crosstools" != "yes"; then
1410     AROS_TOOL_TARGET(aros_target_as_ln,as,$aros_target_as)
1411     AROS_REQUIRED(as,$aros_target_as_ln)
1412     AROS_TOOL_TARGET(aros_kernel_ld,ld,$aros_kernel_ld)
1413     AROS_REQUIRED(ld,$aros_kernel_ld)
1414     AROS_TOOL_TARGET(aros_target_ar_ln,ar,$aros_target_ar)
1415     AROS_REQUIRED(ar,$aros_target_ar_ln)
1416     AROS_TOOL_TARGET(aros_target_nm_ln,nm,$aros_target_nm)
1417     AROS_REQUIRED(nm,$aros_target_nm_ln)
1418     AROS_TOOL_TARGET(aros_target_objcopy_ln,objcopy,$aros_target_objcopy)
1419     AROS_REQUIRED(objcopy,$aros_target_objcopy_ln)
1420     AROS_TOOL_TARGET(aros_target_objdump_ln,objdump,$aros_target_objdump)
1421     AROS_REQUIRED(objdump,$aros_target_objdump_ln)
1422     AROS_TOOL_TARGET(aros_target_ranlib_ln,ranlib,$aros_target_ranlib)
1423     AROS_REQUIRED(ranlib,$aros_target_ranlib_ln)
1424     AROS_TOOL_TARGET(aros_target_strip_ln,strip,$aros_target_strip)
1425     AROS_REQUIRED(strip,$aros_target_strip_ln)
1426 # Temporarily disabled in order to let Windows-hosted port to build.
1427 #    if test "$aros_target_cxx" != ""; then
1428 #       AC_PATH_PROG(aros_target_cxx,$aros_target_cxx)
1429 #       AROS_REQUIRED(c++,$aros_target_cxx)
1430 #    fi
1431 else
1432 # Cancel preinstalled C++ compiler because it will be built as part of crosstools
1433     aros_target_cxx=""
1436 if test "$rescomp" != ""; then
1437     if test "$cross_compiling" = "yes" ; then
1438         rescomp=${target_tool_prefix}${rescomp}
1439     fi
1440     AC_PATH_PROG(aros_kernel_rescomp,$rescomp)
1441     AROS_REQUIRED($rescomp,$aros_kernel_rescomp)
1444 aros_hostcfg_dir="bin/${aros_host_arch}-${aros_host_cpu}/gen/config"
1445 aros_targetcfg_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/config"
1446 aros_inc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/AROS/Development/include/aros"
1447 aros_gendir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen"
1448 aros_geninc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/include/aros"
1449 aros_tools_dir="bin/${aros_host_arch}-${aros_host_cpu}/tools"
1450 aros_scripts_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/scripts"
1452 # aros_cc_pre is a variable that is added to the front of the compiler name
1453 # in the generated aros-gcc shell script. We need this to enable the cache
1454 # to work across cleaned builds. Also, support DISTCC using the correct
1455 # environment variable.
1458 if test "x${DISTCC}" != "x" ; then
1459     if test "x${CCACHE}" != "x" ; then
1460         aros_cc_pre="env CCACHE_PREFIX=${DISTCC} ${CCACHE} "
1461     else
1462         aros_cc_pre="${DISTCC} "
1463     fi
1464 else
1465     if test "x${CCACHE}" != "x" ; then
1466         aros_cc_pre="${CCACHE} "
1467     fi
1470 prefix="${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros"
1472 AC_SUBST(aros_target_nostdinc_cflags,-nostdinc)
1473 AC_SUBST(aros_target_nostartup_ldflags,-nostartfiles)
1474 AC_SUBST(aros_target_nix_ldflags,-nix)
1475 AC_SUBST(aros_target_detach_ldflags,-detach)
1476 AC_SUBST(aros_target_nostdlib_ldflags,-nostdlib)
1478 # Target tools
1479 if test "$aros_target_cc" = ""; then
1480     orig_target_cc=$aros_kernel_cc
1481 else
1482     orig_target_cc=$aros_target_cc
1484 if test "$aros_target_ld" = ""; then
1485     orig_target_ld=$aros_kernel_ld
1486 else
1487     orig_target_ld=$aros_target_ld
1489 if test "$GCC" = "yes"; then
1490     aros_target_cc_path=`$orig_target_cc -print-search-dirs | grep "programs: =" | cut -c 12-`
1492 aros_target_cc="${prefix}-gcc"
1493 aros_target_as="${prefix}-as"
1494 aros_target_ld="${prefix}-ld"
1495 aros_target_ar="${prefix}-ar $aros_target_ar_flags"
1496 aros_target_objcopy=${prefix}-objcopy
1497 aros_target_objdump=${prefix}-objdump
1498 aros_target_ranlib="${prefix}-ranlib $aros_target_ranlib_flags"
1499 aros_target_nm="${prefix}-nm $aros_target_nm_flags"
1500 aros_kernel_nm="${prefix}-nm"
1501 aros_target_strip=${prefix}-strip
1503 # Find the system include path. We can suggest that an alternative is
1504 # used if we don't get it correct. The default is to use /usr/include.
1505 # Which is set in the aros_target_incl_def variable.
1507 AC_ARG_ENABLE(includes,
1508 AC_HELP_STRING([--enable-includes=dir],[Alternative system include directory]),
1509 [aros_target_incl=$enable_includes], [aros_target_incl=$aros_target_incl_def])
1511 dnl find out about the target cc's include path
1512 AC_MSG_CHECKING([for the target compiler's include path])
1513 if test "$aros_target_cc_includes" = "" ; then
1514     #try to guess where the directory is
1515     aros_target_cc_includes=`dirname \`${orig_target_cc} -print-libgcc-file-name\``/include
1516     if ! test -d $aros_target_cc_includes; then
1517         #the directory doesn't exist, we need to do some more work
1518         aros_target_cc_includes=${PWD}/${aros_gendir}/cc_include
1519         
1520         #these are the headers we're looling for
1521         headers="limits.h mmintrin.h stdbool.h syslimits.h float.h \
1522                  stddef.h xmmintrin.h iso646.h stdarg.h unwind.h   \
1523                  zutil.h"
1525         dirs=
1526         for h in $headers; do
1527             #which other headers each of the above headers needs?
1528             deps=$(echo "#include <$h>" | \
1529                    $aros_host_cc -E -M - 2>/dev/null | \
1530                    sed 's/^.*://; s/\\$/ /g; s/[[ \t]]\+/ /g')
1531             
1532             #copy all the needed headers to a directory beneath gendir
1533             for d in $deps; do
1534                 h=$(basename $d)
1535                 dir=${aros_target_cc_includes}$(echo $(dirname $d) | \
1536                                                 sed -n "s,^.*/include\(/.*\),\1,p")
1537                 ! test -d $dir && mkdir -p $dir
1538                 ! test -f $dir/$h && { cp $d $dir; chmod u+w $dir/$h; }
1539             done
1540         done        
1541     fi
1543 AC_MSG_RESULT($aros_target_cc_includes)
1546 # For GCC < 4.0 -I- is used for giving the search path for '#include "..."'
1547 # On GCC >= 4.0 -iquote should be used
1550 save_cc="$CC"
1551 save_cflags="$CFLAGS"
1552 CFLAGS="-iquote."
1553 AC_MSG_CHECKING([whether ${CC} accepts -iquote])
1554 AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
1555 AC_MSG_RESULT($has_iquote)
1556 if test "x-$has_iquote" = "x-yes" ; then
1557     host_cflags_iquote=-iquote
1558     host_cflags_iquote_end=
1559 else
1560     host_cflags_iquote=-I
1561     host_cflags_iquote_end=-I-
1563 kernel_cflags_iquote=$host_cflags_iquote
1564 kernel_cflags_iquote_end=$host_cflags_iquote_end
1565 if test "x-$cross_compiling" = "x-yes"; then
1566     CC="$aros_kernel_cc"
1567     AC_MSG_CHECKING([whether ${CC} accepts -fno-stack-protector])
1568     AC_TRY_COMPILE(,, use_no_stack_protector="yes", use_no_stack_protector="no")
1569     AC_MSG_RESULT($use_no_stack_protector)
1570     AC_MSG_CHECKING([whether ${CC} accepts -iquote])
1571     AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
1572     AC_MSG_RESULT($has_iquote)
1573     if test "x-$has_iquote" = "x-yes" ; then
1574         kernel_cflags_iquote=-iquote
1575         kernel_cflags_iquote_end=
1576     else
1577         kernel_cflags_iquote=-I
1578         kernel_cflags_iquote_end=-I-
1579     fi
1581 aros_cflags_iquote=$kernel_cflags_iquote
1582 aros_cflags_iquote_end=$kernel_cflags_iquote_end
1583 if test "$orig_target_cc" != "$aros_kernel_cc"; then
1584     CC="$orig_target_cc"
1585     AC_MSG_CHECKING([whether ${CC} accepts -iquote])
1586     AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
1587     AC_MSG_RESULT($has_iquote)
1588     if test "x-$has_iquote" = "x-yes" ; then
1589         aros_cflags_iquote=-iquote
1590         aros_cflags_iquote_end=
1591     else
1592         aros_cflags_iquote=-I
1593         aros_cflags_iquote_end=-I-
1594     fi
1596 if test "x-$use_no_stack_protector" = "x-yes" ; then
1597     aros_kernel_cflags="$aros_kernel_cflags -fno-stack-protector"
1600 #-----------------------------------------------------------------------------
1602 # Check if we can explicitly choose older version of symbol hashing
1604 CFLAGS="save_cflags -Wl,--hash-style=sysv"
1605 CC="$aros_kernel_cc"
1606 AC_MSG_CHECKING([whether ${CC} accepts -Wl,--hash-style=sysv])
1607 AC_TRY_LINK(,, use_hash_style="yes", use_hash_style="no")
1608 AC_MSG_RESULT($use_hash_style)
1609 if test "x-$use_hash_style" = "x-yes" ; then
1610     aros_kernel_cflags="$aros_kernel_cflags -Wl,--hash-style=sysv"
1612 CC="$save_cc"
1613 CFLAGS="$save_cflags"
1615 AC_SUBST(host_cflags_iquote)
1616 AC_SUBST(host_cflags_iquote_end)
1617 AC_SUBST(kernel_cflags_iquote)
1618 AC_SUBST(kernel_cflags_iquote_end)
1619 AC_SUBST(aros_cflags_iquote)
1620 AC_SUBST(aros_cflags_iquote_end)
1623 dnl Check if user specified --with-resolution=XRESxYRESxDEPTH
1624 AC_MSG_CHECKING([for default resolution of WBScreen])
1625 AC_ARG_WITH(resolution,AC_HELP_STRING([--with-resolution=XRESxYRESxDEPTH],[Default resolution of the initial WorkbenchScreen]),resolution=$withval,resolution=none)
1626 # We require an argument, so map --with/--without ("yes"/"no") to "none" specified
1627 if test "$resolution" = "yes" ; then
1628     resolution="none"
1630 if test "$resolution" = "no" ; then
1631     resolution="none"
1633 if test "$resolution" != "none" ; then
1634     aros_default_wbwidth=`echo $resolution | cut -d'x' -f1`
1635     aros_default_wbheight=`echo $resolution | cut -d'x' -f2`
1636     aros_default_wbdepth=`echo $resolution | cut -d'x' -f3`
1638 AC_MSG_RESULT($aros_default_wbwidth x $aros_default_wbheight x $aros_default_wbdepth)
1639 aros_cv_default_wbwidth=$aros_default_wbwidth
1640 aros_cv_default_wbheight=$aros_default_wbheight
1641 aros_cv_default_wbdepth=$aros_default_wbdepth
1643 dnl See if the user wants the serial debug output for native flavour
1644 AC_MSG_CHECKING([if serial debug is enabled])
1645 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)
1646 if test "$aros_serial_debug" = 0 ; then
1647     serial_debug_forced=""
1648     if test "$serial_debug" = "yes" ; then
1649         serial_debug="2"
1650     fi
1651     if test "$serial_debug" = "no" ; then
1652         serial_debug="none"
1653     fi
1654 else
1655     serial_debug_forced="(forced)"
1656     serial_debug=$aros_serial_debug
1658 if test "$serial_debug" != "none" ; then
1659     aros_serial_debug=$serial_debug
1660     AC_MSG_RESULT($serial_debug_forced on port $serial_debug)
1661 else
1662     AC_MSG_RESULT(no)
1665 dnl See if the user wants the palm debug output hack for palm native flavour
1666 AC_MSG_CHECKING([if palm debug hack is enabled])
1667 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")
1668 if test "$palm_debug_hack" = "yes" ; then
1669     aros_palm_debug_hack="1"
1671 AC_MSG_RESULT($palm_debug_hack)
1674 dnl See if the user wants nesting supervisor activated for unix flavour
1675 AC_MSG_CHECKING([if nesting supervisor support is enabled])
1676 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")
1677 if test "$nesting_supervisor" = "yes" ; then
1678     aros_nesting_supervisor="1"
1680 AC_MSG_RESULT($nesting_supervisor)
1683 dnl things specifically required for hosted flavours
1684 if test "x-$aros_flavour" = "x-emulation" -o "x-$aros_flavour" = "x-emulcompat" ; then
1686     if test "x-$need_dlopen" != "x-no" ; then
1687       dnl some kind of dynamic library access system is required for hostlib.resource
1688       AC_CHECK_FUNC(dlopen, have_dl="yes", have_dl="no")
1689       if test "x-$have_dl" = "x-no" ; then
1690           AC_CHECK_LIB(dl, dlopen, [have_dl="yes"
1691                                     aros_host_ldflags="$aros_host_ldflags -ldl"],
1692                                     have_dl="no")
1693       fi
1694       if test "x-$have_dl" = "x-no" ; then
1695           AC_MSG_ERROR([dlopen() dynamic linker functions not available])
1696       fi
1697     fi
1700     dnl x11 hidd
1701     AC_ARG_ENABLE(x11_hidd, AC_HELP_STRING([--enable-x11-hidd],
1702                                            [build X11 hidd for hosted (default=auto)]),
1703                                            x11_hidd="$enableval",
1704                                            x11_hidd="auto")
1705     case "x-$x11_hidd" in
1706         x-yes|x-no|x-auto)                 ;;
1707         *)                 x11_hidd="auto" ;;
1708     esac
1710     ENABLE_X11=0
1712     dnl they want it
1713     if test "x-$x11_hidd" != "x-no" ; then
1715         dnl find x11 stuff
1716         AC_PATH_X
1718         x_cflags=
1719         for path in $x_libraries
1720         do
1721             x_cflags="$x_cflags -L$path"
1722         done
1724         for path in $x_includes
1725         do
1726             x_cflags="$x_cflags -I$path"
1727         done
1728         
1729         if test "x-$no_x" = "x-yes" ; then
1731             dnl didn't find it
1732             if test "x-$x11_hidd" != "x-auto" ; then
1733                 dnl and they explicitly asked for it, bail out
1734                 AC_MSG_ERROR([X11 libs/headers not found, cannot build X11 hidd as requested])
1735             fi
1736         
1737         else
1738             dnl found it, setup the metatarget
1739             x11_hidd_target=kernel-x11gfx-kobj
1740             ENABLE_X11=1
1742             dnl setup shared memory extensions
1743             AC_ARG_ENABLE(x11_shm, AC_HELP_STRING([--enable-x11-shm],
1744                                                   [use X11 shared memory (default=auto)]),
1745                                                   x11_hidd_shm="$enableval",
1746                                                   x11_hidd_shm="auto")
1747             case "x-$x11_hidd_shm" in
1748                 x-yes|x-no|x-auto)                     ;;
1749                 *)                 x11_hidd_shm="auto" ;;
1750             esac
1752             have_xshm=no
1754             dnl they want it
1755             if test "x-$x11_hidd_shm" != "x-no" ; then
1757                 dnl system shm headers
1758                 AC_CHECK_HEADERS(sys/ipc.h)
1759                 AC_CHECK_HEADERS(sys/shm.h)
1761                 dnl got them
1762                 if test "x-$ac_cv_header_sys_ipc_h" = "x-yes" -a "x-$ac_cv_header_sys_shm_h" = "x-yes" ; then
1764                     dnl make sure X libs have shm functions
1765                     save_cflags="$CFLAGS"
1766                     CFLAGS="$CFLAGS $x_cflags"
1767                     AC_CHECK_LIB(Xext, XShmQueryExtension, have_xshm=yes)
1768                     CFLAGS="$save_cflags"
1769                 fi
1770             fi
1772             dnl detection done, prepare output
1773             if test "x-$have_xshm" = "x-yes" ; then
1774                 dnl we can do shm
1775                 DO_XSHM_SUPPORT="1"
1776             elif test "x-$x11_hidd_shm" = "x-yes" ; then
1777                 dnl they explicitly asked for it, but we can't do it
1778                 AC_MSG_ERROR([X11 has no support for shared memory, cannot enable it as requested])
1779             else
1780                 dnl otherwise just disable it
1781                 DO_XSHM_SUPPORT="0"
1782             fi
1784             
1785             dnl setup vidmode (fullscreen) extensions
1786             AC_ARG_ENABLE(x11_vidmode, AC_HELP_STRING([--enable-x11-vidmode],
1787                                                       [use X11 vidmode extension (default=auto)]),
1788                                                       x11_hidd_vidmode="$enableval",
1789                                                       x11_hidd_vidmode="auto")
1790             case "x-$x11_hidd_vidmode" in
1791                 x-yes|x-no|x-auto)                         ;;
1792                 *)                 x11_hidd_vidmode="auto" ;;
1793             esac
1795             have_vidmode=no
1797             dnl they want it
1798             if test "x-$x11_hidd_vidmode" != "x-no" ; then
1800                 dnl make sure X libs have vidmode functions
1801                 save_cflags="$CFLAGS"
1802                 CFLAGS="$CFLAGS $x_cflags"
1803                 AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryExtension, have_vidmode=yes)
1804                 CFLAGS="$save_cflags"
1805             fi
1807             dnl detection done, prepare output
1808             if test "x-$have_vidmode" = "x-yes" ; then
1809                 dnl we can do vidmode
1810                 DO_VIDMODE_SUPPORT="1"
1811             elif test "x-$x11_hidd_vidmode" = "x-yes" ; then
1812                 dnl they explicitly asked for it, but we can't do it
1813                 AC_MSG_ERROR([X11 vidmode extension not available, cannot enable it as requested])
1814             else
1815                 dnl otherwise just disable it
1816                 DO_VIDMODE_SUPPORT="0"
1817             fi
1818         fi
1820         aros_host_x11_includes=$x_includes 
1821         aros_host_x11_libdirs=$x_libraries
1822     fi
1825     dnl sdl hidd
1826     AC_ARG_ENABLE(sdl_hidd, AC_HELP_STRING([--enable-sdl-hidd],
1827                                            [build SDL hidd for hosted (default=auto)]),
1828                                            sdl_hidd="$enableval",
1829                                            sdl_hidd="auto")
1830     case "x-$sdl_hidd" in
1831         x-yes|x-no|x-auto)                 ;;
1832         *)                 sdl_hidd="auto" ;;
1833     esac
1835     dnl they want it
1836     if test "x-$sdl_hidd" != "x-no" ; then
1838         dnl find sdl
1839         AM_PATH_SDL([1.2.10], have_sdl="yes", have_sdl="no")
1841         if test "x-$have_sdl" != "x-yes" ; then
1843             dnl didn't find it
1844             if test "x-$sdl_hidd" != "x-auto" ; then
1845                 dnl and they explicitly asked for it, bail out
1846                 AC_MSG_ERROR([SDL libs/headers not found, cannot build SDL hidd as requested])
1847             fi
1849         else
1850             dnl found it, set up the metatarget
1851             sdl_hidd_target=kernel-hidd-sdl
1852             aros_host_sdl_cflags=SDL_CFLAGS
1853             aros_host_sdl_libs=SDL_LIBS
1854         fi
1855     fi
1860 dnl See if the user wants dbus.library
1861 AC_MSG_CHECKING([if building of dbus.library is enabled])
1862 AC_ARG_ENABLE(dbus,AC_HELP_STRING([--enable-dbus],[Enable DBUS support via dbus.library (default=no)]),dbus="yes",dbus="no")
1863 if test "$dbus" = "yes" ; then
1864     ENABLE_DBUS=1
1865     DBUS_CFLAGS=`pkg-config --cflags dbus-1`
1866     DBUS_LIBFLAGS=`pkg-config --libs dbus-1`
1867     KERNEL_DBUS_KOBJ=kernel-dbus-kobj
1868     KERNEL_DBUS_INCLUDES=kernel-dbus-includes
1869 else
1870     ENABLE_DBUS=0
1872 AC_MSG_RESULT($dbus)
1875 dnl --------------------------------------------------------------------
1876 dnl Configuration Output Section
1877 dnl --------------------------------------------------------------------
1879 # Generic
1880 AC_SUBST(aros_arch)
1881 AC_SUBST(aros_cpu)
1882 AC_SUBST(aros_flavour)
1883 AC_SUBST(aros_flavour_uc)
1884 AC_SUBST(AROS_BUILDDIR)
1885 AC_SUBST(AROS_BUILDDIR_UNIX)
1886 AC_SUBST(SRCDIR)
1887 AC_SUBST(AROS_PORTSSRCDIR)
1889 # Host related
1890 AC_SUBST(aros_cc_pre)
1891 AC_SUBST(aros_host_strip)
1892 AC_SUBST(aros_host_arch)
1893 AC_SUBST(aros_host_cpu)
1894 AC_SUBST(aros_host_cc)
1895 AC_SUBST(aros_host_ar)
1896 AC_SUBST(aros_host_ranlib)
1897 AC_SUBST(aros_host_ld)
1898 AC_SUBST(aros_host_make)
1899 AC_SUBST(aros_host_cflags)
1900 AC_SUBST(aros_host_ldflags)
1901 AC_SUBST(aros_host_debug)
1902 AC_SUBST(aros_host_mkdep)
1903 AC_SUBST(aros_host_mkargs)
1904 AC_SUBST(aros_host_exe_suffix)
1905 AC_SUBST(aros_host_lib_suffix)
1906 AC_SUBST(aros_tools_dir)
1907 AC_SUBST(aros_host_aclocal)
1908 AC_SUBST(aros_host_autoconf)
1909 AC_SUBST(aros_host_autoheader)
1910 AC_SUBST(aros_host_automake)
1912 # Target Related
1913 AC_SUBST(aros_target_guitheme)
1914 AC_SUBST(aros_target_iconset)
1915 AC_SUBST(aros_target_bootloader)
1916 AC_SUBST(aros_target_arch)
1917 AC_SUBST(aros_target_cpu)
1918 AC_SUBST(aros_target_variant)
1919 AC_SUBST(aros_target_suffix)
1920 AC_SUBST(aros_target_incl)
1921 AC_SUBST(aros_target_ar)
1922 AC_SUBST(aros_target_ranlib)
1923 AC_SUBST(aros_kernel_nm)
1924 AC_SUBST(orig_target_cc)
1925 AC_SUBST(aros_target_cc)
1926 AC_SUBST(aros_target_cxx)
1927 AC_SUBST(aros_kernel_cc)
1928 AC_SUBST(aros_target_as)
1929 AC_SUBST(orig_target_ld)
1930 AC_SUBST(aros_target_ld)
1931 AC_SUBST(aros_kernel_ld)
1932 AC_SUBST(aros_target_cc_includes)
1933 AC_SUBST(aros_target_cc_path)
1934 AC_SUBST(aros_target_objdump)
1935 AC_SUBST(aros_target_objcopy)
1936 AC_SUBST(aros_target_strip)
1937 AC_SUBST(aros_target_nm)
1938 AC_SUBST(aros_kernel_rescomp)
1939 AC_SUBST(aros_shared_default)
1940 AC_SUBST(aros_shared_ld)
1941 AC_SUBST(aros_object_format)
1942 AC_SUBST(aros_compiler_libs)
1943 AC_SUBST(aros_arch_libs)
1945 AC_SUBST(aros_config_cflags)
1946 AC_SUBST(aros_config_aflags)
1947 AC_SUBST(aros_config_ldflags)
1949 AC_SUBST(aros_shared_cflags)
1950 AC_SUBST(aros_shared_aflags)
1951 AC_SUBST(aros_shared_ldflags)
1952 AC_SUBST(aros_kernel_cflags)
1953 AC_SUBST(aros_kernel_objcflags)
1954 AC_SUBST(aros_kernel_ldflags)
1955 AC_SUBST(aros_debug_cflags)
1956 AC_SUBST(aros_debug_aflags)
1957 AC_SUBST(aros_debug_ldflags)
1958 AC_SUBST(aros_target_genmap)
1959 AC_SUBST(aros_target_strip_flags)
1961 # Graphics Related
1962 AC_SUBST(x11_hidd_target)
1963 AC_SUBST(sdl_hidd_target)
1965 AC_SUBST(aros_default_wbwidth)
1966 AC_SUBST(aros_default_wbheight)
1967 AC_SUBST(aros_default_wbdepth)
1968 AC_SUBST(DO_XSHM_SUPPORT)
1969 AC_SUBST(DO_VIDMODE_SUPPORT)
1971 AC_SUBST(aros_host_x11_includes)
1972 AC_SUBST(aros_host_x11_libdirs)
1973 AC_SUBST(aros_host_sdl_cflags)
1974 AC_SUBST(aros_host_sdl_libs)
1976 # Native version related
1977 AC_SUBST(aros_serial_debug)
1979 # Palm native version related
1980 AC_SUBST(aros_palm_debug_hack)
1982 # Unix/Hosted version related
1983 AC_SUBST(aros_nesting_supervisor)
1985 # Apple iOS related
1986 AC_SUBST(aros_ios_platform)
1987 AC_SUBST(aros_ios_version)
1988 AC_SUBST(aros_ios_sdk)
1990 # DBUS related
1991 AC_SUBST(ENABLE_DBUS)
1992 AC_SUBST(DBUS_CFLAGS)
1993 AC_SUBST(DBUS_LIBFLAGS)
1994 AC_SUBST(KERNEL_DBUS_KOBJ)
1995 AC_SUBST(KERNEL_DBUS_INCLUDES)
1997 #X11 related
1998 AC_SUBST(ENABLE_X11)
2000 # Debug related
2001 AC_SUBST(aros_debug)
2002 AC_SUBST(aros_mungwall_debug)
2003 AC_SUBST(aros_stack_debug)
2004 AC_SUBST(aros_modules_debug)
2006 # Collect-aros stuff: "-ius" to ignore undefined symbols
2007 AC_SUBST(ignore_undefined_symbols)
2009 # C compiler related
2010 AC_SUBST(gcc_target_cpu)
2012 dnl Prepare for output, make up all the generated patches
2013 case "$aros_flavour" in
2014 emulation)      aros_flavour_uc="AROS_FLAVOUR_EMULATION"
2015                 aros_flavour="emulation" ;;
2016 emulcompat)     aros_flavour_uc="(AROS_FLAVOUR_EMULATION|AROS_FLAVOUR_BINCOMPAT)"
2017                 aros_flavour="emulation" ;;
2018 standalone)     aros_flavour_uc="AROS_FLAVOUR_STANDALONE"
2019                 aros_flavour="standalone";;
2020 standcompat)    aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_BINCOMPAT)"
2021                 aros_flavour="standalone";;
2022 native)         aros_flavour_uc="AROS_FLAVOUR_NATIVE"
2023                 aros_flavour="native" ;;
2024 nativecompat)   aros_flavour_uc="(AROS_FLAVOUR_NATIVE|AROS_FLAVOUR_BINCOMPAT)"
2025                 aros_flavour="native" ;;
2026 linklib)        aros_flavour_uc="AROS_FLAVOUR_LINKLIB"
2027                 aros_flavour="linklib" ;;
2028 palmnative)     aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
2029                 aros_flavour="palmnative" ;;
2030 mac68knative)   aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
2031                 aros_flavour="mac68knative" ;;
2032 ppcnative)      aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_BINCOMPAT)"
2033                 aros_flavour="ppcnative" ;;
2034 esac
2036 if test ! -d ${aros_inc_dir} ; then
2037     ${MKDIR} ${aros_inc_dir}
2039 if test ! -d ${aros_geninc_dir} ; then
2040     ${MKDIR} ${aros_geninc_dir}
2042 if test ! -d ${aros_hostcfg_dir} ; then
2043     ${MKDIR} ${aros_hostcfg_dir}
2045 if test ! -d ${aros_targetcfg_dir} ; then
2046     ${MKDIR} ${aros_targetcfg_dir}
2048 if test ! -d ${aros_tools_dir} ; then
2049     ${MKDIR} ${aros_tools_dir}
2051 if test ! -d ${aros_scripts_dir} ; then
2052     ${MKDIR} ${aros_scripts_dir}
2055 AC_CONFIG_HEADERS(${aros_geninc_dir}/host-conf.h:config/host-conf.h.in)
2057 AC_CONFIG_COMMANDS([compiler_executable],
2058     [
2059         prefix=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}
2060         mkdir -p $prefix
2061         prefix="${prefix}/${aros_target_cpu}-aros"
2062         prefix2=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros
2064         echo ${prefix}
2065         echo ${prefix2}
2066         chmod a+x ${prefix2}-gcc ${prefix2}-ld
2068         ln -sf ${prefix2}-gcc          ${prefix}-gcc
2069         ln -sf ${prefix2}-ld           ${prefix}-ld
2071         ln -sf $aros_target_as_ln$aros_host_exe_suffix      ${prefix}-as
2072         ln -sf $aros_target_nm_ln$aros_host_exe_suffix      ${prefix}-nm
2073         ln -sf $aros_target_ar_ln$aros_host_exe_suffix      ${prefix}-ar
2074         ln -sf $aros_target_ranlib_ln$aros_host_exe_suffix  ${prefix}-ranlib
2075         ln -sf $aros_target_objcopy_ln$aros_host_exe_suffix ${prefix}-objcopy
2076         ln -sf $aros_target_objdump_ln$aros_host_exe_suffix ${prefix}-objdump
2077         ln -sf $aros_target_strip_ln$aros_host_exe_suffix   ${prefix}-strip
2079         ln -sf $aros_target_as_ln$aros_host_exe_suffix      ${prefix2}-as
2080         ln -sf $aros_target_nm_ln$aros_host_exe_suffix      ${prefix2}-nm
2081         ln -sf $aros_target_ar_ln$aros_host_exe_suffix      ${prefix2}-ar
2082         ln -sf $aros_target_ranlib_ln$aros_host_exe_suffix  ${prefix2}-ranlib
2083         ln -sf $aros_target_objcopy_ln$aros_host_exe_suffix ${prefix2}-objcopy
2084         ln -sf $aros_target_objdump_ln$aros_host_exe_suffix ${prefix2}-objdump
2085         ln -sf $aros_target_strip_ln$aros_host_exe_suffix   ${prefix2}-strip
2086     ],
2087     [
2088         aros_host_exe_suffix=${aros_host_exe_suffix}
2089         aros_tools_dir=${aros_tools_dir}
2090         aros_target_cpu=${aros_target_cpu}
2091         aros_target_arch=${aros_target_arch}
2092         aros_target_suffix=${aros_target_suffix}
2093         aros_target_nm_ln=${aros_target_nm_ln}
2094         aros_target_as_ln=${aros_target_as_ln}
2095         aros_target_ar_ln=${aros_target_ar_ln}
2096         aros_target_ranlib_ln=${aros_target_ranlib_ln}
2097         aros_target_objdump_ln=${aros_target_objdump_ln}
2098         aros_target_objcopy_ln=${aros_target_objcopy_ln}
2099         aros_target_strip_ln=${aros_target_strip_ln}
2100     ]
2102 AC_CONFIG_COMMANDS([genshared_executable],
2103     [chmod a+x ${aros_scripts_dir}/genshared],
2104     [aros_scripts_dir=${aros_scripts_dir}]
2106 AC_CONFIG_COMMANDS([genmf_executable],
2107     [chmod a+x ${aros_tools_dir}/genmf.py],
2108     [aros_tools_dir=${aros_tools_dir}]
2111 AC_CONFIG_FILES(
2112     Makefile
2113     config/make.cfg
2114     ${aros_inc_dir}/config.h:config/config.h.in
2115     ${aros_geninc_dir}/config.h:config/config.h.in
2116     ${aros_hostcfg_dir}/host.cfg:config/host.cfg.in
2117     ${aros_targetcfg_dir}/target.cfg:config/target.cfg.in
2118     mmake.config
2119     ${aros_targetcfg_dir}/make.defaults:config/make.defaults.in
2120     ${aros_targetcfg_dir}/specs:config/specs.in
2121     ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-gcc:scripts/aros-gcc.in
2122     ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-ld:scripts/aros-ld.in
2123     ${aros_scripts_dir}/genshared:compiler/c_lib/source/lib_source/genshared.in
2124     ${aros_tools_dir}/genmf.py:tools/genmf/genmf.py
2125     tools/collect-aros/env.h
2128 AC_OUTPUT
2130 dnl This is in order to not define SHARED_CFLAGS sometimes
2131 dnl We don't always do aros_shared_ar, aros_shared_cflags
2133 #XXX compatability...
2134 aros_shared_ar="$aros_shared_ld $aros_shared_ldflags -o"
2136 if test -n "$aros_shared_cflags" ; then
2137     echo "SHARED_CFLAGS := $aros_shared_cflags" >> ${aros_hostcfg_dir}/host.cfg
2138     echo "SHARED_AR := $aros_shared_ar" >> ${aros_hostcfg_dir}/host.cfg