capsable missing
[AROS.git] / configure.in
blobd0e9f402f5206d7133ae6dc7f87f09b693f4d10e
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         aros_config_cflags="$aros_config_cflags -fomit-frame-pointer -fbuiltin -ffreestanding"
1124         case "$target_cpu" in
1125             *m68k*)
1126                 aros_target_cpu="m68k"
1127                 aros_object_format="m68kelf"
1128                 aros_flavour="nativecompat"
1129                 gcc_target_cpu="mc68000"
1130                 ;;
1131             *ppc*)
1132                 aros_cpu="ppc"
1133                 aros_flavour="native"
1134                 gcc_target_cpu="ppc"
1135                 ;;
1136             *)
1137                 AC_MSG_ERROR("Unknown CPU for Amiga $target_cpu")
1138                 ;;
1139         esac
1140         ;;
1142     mingw*)
1143         aros_target_arch="mingw32"
1144         aros_shared_default="no"
1145         aros_flavour="emulation"
1146         aros_shared_cflags=""
1147         need_dlopen="no"
1148         rescomp="windres"
1149         case "$target_cpu" in
1150             *i?86*)
1151                 aros_target_cpu="i386"
1152                 aros_object_format="elf_i386"
1153                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1154                 aros_default_wbdepth=8
1155                 gcc_target_cpu="i386"
1156                 aros_target_cc="i386-aros-gcc"
1157                 aros_target_cxx="i386-aros-g++"
1158                 aros_target_ld="i386-aros-ld"
1159                 aros_target_as="i386-aros-as"
1160                 aros_target_ar="i386-aros-ar"
1161                 aros_target_ranlib="i386-aros-ranlib"
1162                 aros_target_nm="i386-aros-nm"
1163                 aros_target_strip="i386-aros-strip"
1164                 aros_target_objcopy="i386-aros-objcopy"
1165                 aros_target_objdump="i386-aros-objdump"
1166                 target_tool_prefix="i386-mingw32-"
1167                 ;;
1168             *x86_64*)
1169                 aros_target_cpu="x86_64"
1170                 aros_object_format="elf_x86_64"
1171                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
1172                 aros_default_wbdepth=8
1173                 gcc_target_cpu="x86_64"
1174                 aros_target_cc="x86_64-aros-gcc"
1175                 aros_target_cxx="x86_64-aros-g++"
1176                 aros_target_ld="x86_64-aros-ld"
1177                 aros_target_as="x86_64-aros-as"
1178                 aros_target_ar="x86_64-aros-ar"
1179                 aros_target_ranlib="x86_64-aros-ranlib"
1180                 aros_target_nm="x86_64-aros-nm"
1181                 aros_target_strip="x86_64-aros-strip"
1182                 aros_target_objcopy="x86_64-aros-objcopy"
1183                 aros_target_objdump="x86_64-aros-objdump"
1184                 target_tool_prefix="x86_64-w64-mingw32-"
1185                 ;;
1186             *arm*)
1187                 aros_target_cpu="arm"
1188                 aros_object_format="armelf_linux_eabi"
1189                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
1190                 aros_default_wbdepth=8
1191                 gcc_target_cpu="arm"
1192                 aros_target_cc="arm-elf-gcc"
1193                 aros_target_ld="arm-elf-ld"
1194                 aros_target_as="arm-elf-as"
1195                 aros_target_ar="arm-elf-ar"
1196                 aros_target_ranlib="arm-elf-ranlib"
1197                 aros_target_nm="arm-elf-nm"
1198                 aros_target_strip="arm-elf-strip"
1199                 aros_target_objcopy="arm-elf-objcopy"
1200                 aros_target_objdump="arm-elf-objdump"
1201                 target_tool_prefix="arm-mingw32ce-"
1202                 aros_default_wbwidth=160
1203                 aros_default_wbheight=160
1204                 ;;
1205             *)
1206                 AC_MSG_ERROR("Unknown CPU for Mingw32 -- $target_cpu")
1207                 ;;
1208         esac
1209         if test $host_os = "cygwin"; then
1210                 aros_kernel_cflags="-mno-cygwin"
1211         fi
1212     ;;
1213     pp*)
1214         aros_target_arch="pp"
1215         aros_shared_default="no"
1216         case "$target_cpu" in
1217             *m68k*)
1218                 aros_target_cpu="m68k"
1219                 aros_object_format="m68kelf"
1220                 aros_flavour="palmnative"
1221                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
1222                 aros_default_wbwidth=160
1223                 aros_default_wbheight=160
1224                 aros_default_wbdepth=1
1225                 aros_target_ar_flags="cru"
1226                 aros_compiler_libs="-lgcc1"
1227                 aros_shared_default=no
1228                 aros_shared_cflags="-fpic"
1229                 aros_shared_aflags=""
1230                 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
1231                 aros_kernel_ldflags="-Wl,-rpath,./lib"
1232                 aros_debug_cflags="-Wall -Werror-implicit-function-declaration $aros_symbols_debug  $aros_messages_debug -mc68000 -Wa,-mc68000"
1233                 aros_debug_aflags=""
1234                 aros_debug_ldflags="$aros_symbols_debug"
1235                 aros_mungwall_debug="0"
1236                 aros_modules_debug="0"
1237                 gcc_target_cpu="mc68000"
1238                 ignore_undefined_symbols="-ius"
1239                 ;;
1240            *)
1241                 AC_MSG_ERROR("Unknown CPU for PalmPilot -- $target_cpu")
1242                 ;;
1243         esac
1244         ;;
1246     mac*)
1247         aros_target_arch="mac"
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="mac68knative"
1254                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
1255                 aros_default_wbwidth=512
1256                 aros_default_wbheight=384
1257                 aros_default_wbdepth=8
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"
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 Mac68k -- $target_cpu")
1275                 ;;
1276         esac
1277         ;;
1279     *)
1280         AC_MSG_ERROR([Unsupported target architecture $target])
1281         ;;
1282 esac
1284 AC_MSG_CHECKING([Where to download sourcecode for external ports])
1285 AC_ARG_WITH(portssources,AC_HELP_STRING([--with-portssources=DIR],[Where to download sourcecode for external ports]),with_portssrcdir=$withval,with_portssrcdir="default")
1286 if test "$with_portssrcdir" = "default"; then
1287     AROS_PORTSSRCDIR="$AROS_BUILDDIR_UNIX/bin/Sources"
1288 else
1289     AROS_PORTSSRCDIR="$with_portssrcdir"
1291 AC_MSG_RESULT($AROS_PORTSSRCDIR)
1293 AC_MSG_CHECKING([which bootloader to use])
1294 AC_ARG_WITH(bootloader,AC_HELP_STRING([--with-bootloader=NAME],[Use a specific bootloader]),target_bootloader=$withval,target_bootloader=$target_bootloader)
1295 if test "$target_bootloader" = "none"; then
1296     aros_target_bootloader=""
1297 else
1298     aros_target_bootloader="$target_bootloader"
1300 AC_MSG_RESULT($target_bootloader)
1302 AC_MSG_CHECKING([which icon-set to use])
1303 AC_ARG_WITH(iconset,AC_HELP_STRING([--with-iconset=NAME],[Use a specific Icon-set (default=Gorilla).]),target_iconset=$withval,target_iconset="default")
1304 if test "$target_iconset" = "default"; then
1305     aros_target_iconset="Gorilla"
1306     target_iconset="default (Gorilla)"
1307 else
1308     aros_target_iconset="$target_iconset"
1310 AC_MSG_RESULT($target_iconset)
1312 AC_MSG_CHECKING([which GUI Theme to use])
1313 AC_ARG_WITH(theme,AC_HELP_STRING([--with-theme=NAME],[Use a specific GUI Theme]),target_guitheme=$withval,target_guitheme="default")
1314 if test "$target_guitheme" = "default"; then
1315     aros_target_guitheme="Ice"
1316 else
1317     aros_target_guitheme="$target_guitheme"
1319 AC_MSG_RESULT($aros_target_guitheme)
1321 # Find out if we are cross-compiling (i.e. if we can't use the host compiler
1322 # for target code)
1323 cross_compiling=no
1324 if test "$aros_host_cpu" != "$aros_target_cpu" ; then
1325     cross_compiling=yes
1327 if test "$aros_host_cpu" == "x86_64" ; then
1328     if test "$aros_target_cpu" == "i386" ; then
1329         if test "$aros_target_arch" != "mingw32"; then
1330             cross_compiling=no
1331         fi
1332     fi
1335 # Set prefix for target compiler etc. if we're cross-compiling
1336 # (should possibly be earlier but needs to be after AC_PROG_CC)
1337 if test "$cross_compiling" = "yes" ; then
1338     if test "$target_tool_prefix" = ""; then
1339         target_tool_prefix=${target_cpu}-elf-
1340     fi
1341     CC=${target_tool_prefix}gcc
1342     if test "$target_tool_version" != "default"; then
1343         CC="$CC-$target_tool_version"
1344     fi
1345     AC_PATH_PROG(CC,$CC)
1346     AROS_REQUIRED(gcc,$CC)
1348 CC="$CC $target_tool_flags"
1350 #-----------------------------------------------------------------------------
1352 # Disable pointer-signedness warnings if the compiler recognises the option
1354 AC_MSG_CHECKING([whether ${CC} accepts -Wno-pointer-sign])
1355 save_cflags="$CFLAGS"
1356 CFLAGS="$CFLAGS -Wno-pointer-sign"
1357 AC_TRY_COMPILE(,, use_no_sign_warning="yes", use_no_sign_warning="no")
1358 AC_MSG_RESULT($use_no_sign_warning)
1359 if test "x-$use_no_sign_warning" = "x-yes" ; then
1360     aros_config_cflags="$aros_config_cflags -Wno-pointer-sign"
1362 CFLAGS="$save_cflags"
1364 #-----------------------------------------------------------------------------
1366 # Find all the tools we need to compile. This could be cross-compiling
1367 # though! If that is the case we use the GNU form of the target and
1368 # simply add this to the front of the binary name. This is rather simple,
1369 # but it should work under most circumstances.
1371 # The default tools are to use the same as the host, but only if the
1372 # host and target CPU are the same. With GCC this is normally enough.
1375 aros_cc_pre=""
1376 aros_shared_ld="$aros_host_ld"
1378 aros_target_mkdep="$aros_host_mkdep"
1379 aros_target_incl_def="$aros_host_incl"
1381 aros_kernel_cc="$CC"
1383 # The default tools executables to be linked to.
1384 if test "$aros_target_cc" != ""; then
1385     AC_PATH_PROG(aros_target_cc,$aros_target_cc)
1386     AROS_REQUIRED(gcc,$aros_target_cc)
1388 if test "$aros_target_ld" != ""; then
1389     AC_PATH_PROG(aros_target_ld,$aros_target_ld)
1390     AROS_REQUIRED(ld,$aros_target_ld)
1393 if test "$crosstools" != "yes"; then
1394     AROS_TOOL_TARGET(aros_target_as_ln,as,$aros_target_as)
1395     AROS_REQUIRED(as,$aros_target_as_ln)
1396     AROS_TOOL_TARGET(aros_kernel_ld,ld,$aros_kernel_ld)
1397     AROS_REQUIRED(ld,$aros_kernel_ld)
1398     AROS_TOOL_TARGET(aros_target_ar_ln,ar,$aros_target_ar)
1399     AROS_REQUIRED(ar,$aros_target_ar_ln)
1400     AROS_TOOL_TARGET(aros_target_nm_ln,nm,$aros_target_nm)
1401     AROS_REQUIRED(nm,$aros_target_nm_ln)
1402     AROS_TOOL_TARGET(aros_target_objcopy_ln,objcopy,$aros_target_objcopy)
1403     AROS_REQUIRED(objcopy,$aros_target_objcopy_ln)
1404     AROS_TOOL_TARGET(aros_target_objdump_ln,objdump,$aros_target_objdump)
1405     AROS_REQUIRED(objdump,$aros_target_objdump_ln)
1406     AROS_TOOL_TARGET(aros_target_ranlib_ln,ranlib,$aros_target_ranlib)
1407     AROS_REQUIRED(ranlib,$aros_target_ranlib_ln)
1408     AROS_TOOL_TARGET(aros_target_strip_ln,strip,$aros_target_strip)
1409     AROS_REQUIRED(strip,$aros_target_strip_ln)
1410 # Temporarily disabled in order to let Windows-hosted port to build.
1411 #    if test "$aros_target_cxx" != ""; then
1412 #       AC_PATH_PROG(aros_target_cxx,$aros_target_cxx)
1413 #       AROS_REQUIRED(c++,$aros_target_cxx)
1414 #    fi
1415 else
1416 # Cancel preinstalled C++ compiler because it will be built as part of crosstools
1417     aros_target_cxx=""
1420 if test "$rescomp" != ""; then
1421     if test "$cross_compiling" = "yes" ; then
1422         rescomp=${target_tool_prefix}${rescomp}
1423     fi
1424     AC_PATH_PROG(aros_kernel_rescomp,$rescomp)
1425     AROS_REQUIRED($rescomp,$aros_kernel_rescomp)
1428 aros_hostcfg_dir="bin/${aros_host_arch}-${aros_host_cpu}/gen/config"
1429 aros_targetcfg_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/config"
1430 aros_inc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/AROS/Development/include/aros"
1431 aros_gendir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen"
1432 aros_geninc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/include/aros"
1433 aros_tools_dir="bin/${aros_host_arch}-${aros_host_cpu}/tools"
1434 aros_scripts_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/scripts"
1436 # aros_cc_pre is a variable that is added to the front of the compiler name
1437 # in the generated aros-gcc shell script. We need this to enable the cache
1438 # to work across cleaned builds. Also, support DISTCC using the correct
1439 # environment variable.
1442 if test "x${DISTCC}" != "x" ; then
1443     if test "x${CCACHE}" != "x" ; then
1444         aros_cc_pre="env CCACHE_PREFIX=${DISTCC} ${CCACHE} "
1445     else
1446         aros_cc_pre="${DISTCC} "
1447     fi
1448 else
1449     if test "x${CCACHE}" != "x" ; then
1450         aros_cc_pre="${CCACHE} "
1451     fi
1454 prefix="${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros"
1456 AC_SUBST(aros_target_nostdinc_cflags,-nostdinc)
1457 AC_SUBST(aros_target_nostartup_ldflags,-nostartfiles)
1458 AC_SUBST(aros_target_nix_ldflags,-nix)
1459 AC_SUBST(aros_target_detach_ldflags,-detach)
1460 AC_SUBST(aros_target_nostdlib_ldflags,-nostdlib)
1462 # Target tools
1463 if test "$aros_target_cc" = ""; then
1464     orig_target_cc=$aros_kernel_cc
1465 else
1466     orig_target_cc=$aros_target_cc
1468 if test "$aros_target_ld" = ""; then
1469     orig_target_ld=$aros_kernel_ld
1470 else
1471     orig_target_ld=$aros_target_ld
1473 if test "$GCC" = "yes"; then
1474     aros_target_cc_path=`$orig_target_cc -print-search-dirs | grep "programs: =" | cut -c 12-`
1476 aros_target_cc="${prefix}-gcc"
1477 aros_target_as="${prefix}-as"
1478 aros_target_ld="${prefix}-ld"
1479 aros_target_ar="${prefix}-ar $aros_target_ar_flags"
1480 aros_target_objcopy=${prefix}-objcopy
1481 aros_target_objdump=${prefix}-objdump
1482 aros_target_ranlib="${prefix}-ranlib $aros_target_ranlib_flags"
1483 aros_target_nm="${prefix}-nm $aros_target_nm_flags"
1484 aros_kernel_nm="${prefix}-nm"
1485 aros_target_strip=${prefix}-strip
1487 # Find the system include path. We can suggest that an alternative is
1488 # used if we don't get it correct. The default is to use /usr/include.
1489 # Which is set in the aros_target_incl_def variable.
1491 AC_ARG_ENABLE(includes,
1492 AC_HELP_STRING([--enable-includes=dir],[Alternative system include directory]),
1493 [aros_target_incl=$enable_includes], [aros_target_incl=$aros_target_incl_def])
1495 dnl find out about the target cc's include path
1496 AC_MSG_CHECKING([for the target compiler's include path])
1497 if test "$aros_target_cc_includes" = "" ; then
1498     #try to guess where the directory is
1499     aros_target_cc_includes=`dirname \`${orig_target_cc} -print-libgcc-file-name\``/include
1500     if ! test -d $aros_target_cc_includes; then
1501         #the directory doesn't exist, we need to do some more work
1502         aros_target_cc_includes=${PWD}/${aros_gendir}/cc_include
1503         
1504         #these are the headers we're looling for
1505         headers="limits.h mmintrin.h stdbool.h syslimits.h float.h \
1506                  stddef.h xmmintrin.h iso646.h stdarg.h unwind.h   \
1507                  zutil.h"
1509         dirs=
1510         for h in $headers; do
1511             #which other headers each of the above headers needs?
1512             deps=$(echo "#include <$h>" | \
1513                    $aros_host_cc -E -M - 2>/dev/null | \
1514                    sed 's/^.*://; s/\\$/ /g; s/[[ \t]]\+/ /g')
1515             
1516             #copy all the needed headers to a directory beneath gendir
1517             for d in $deps; do
1518                 h=$(basename $d)
1519                 dir=${aros_target_cc_includes}$(echo $(dirname $d) | \
1520                                                 sed -n "s,^.*/include\(/.*\),\1,p")
1521                 ! test -d $dir && mkdir -p $dir
1522                 ! test -f $dir/$h && { cp $d $dir; chmod u+w $dir/$h; }
1523             done
1524         done        
1525     fi
1527 AC_MSG_RESULT($aros_target_cc_includes)
1530 # For GCC < 4.0 -I- is used for giving the search path for '#include "..."'
1531 # On GCC >= 4.0 -iquote should be used
1534 save_cc="$CC"
1535 save_cflags="$CFLAGS"
1536 CFLAGS="-iquote."
1537 AC_MSG_CHECKING([whether ${CC} accepts -iquote])
1538 AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
1539 AC_MSG_RESULT($has_iquote)
1540 if test "x-$has_iquote" = "x-yes" ; then
1541     host_cflags_iquote=-iquote
1542     host_cflags_iquote_end=
1543 else
1544     host_cflags_iquote=-I
1545     host_cflags_iquote_end=-I-
1547 kernel_cflags_iquote=$host_cflags_iquote
1548 kernel_cflags_iquote_end=$host_cflags_iquote_end
1549 if test "x-$cross_compiling" = "x-yes"; then
1550     CC="$aros_kernel_cc"
1551     AC_MSG_CHECKING([whether ${CC} accepts -fno-stack-protector])
1552     AC_TRY_COMPILE(,, use_no_stack_protector="yes", use_no_stack_protector="no")
1553     AC_MSG_RESULT($use_no_stack_protector)
1554     AC_MSG_CHECKING([whether ${CC} accepts -iquote])
1555     AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
1556     AC_MSG_RESULT($has_iquote)
1557     if test "x-$has_iquote" = "x-yes" ; then
1558         kernel_cflags_iquote=-iquote
1559         kernel_cflags_iquote_end=
1560     else
1561         kernel_cflags_iquote=-I
1562         kernel_cflags_iquote_end=-I-
1563     fi
1565 aros_cflags_iquote=$kernel_cflags_iquote
1566 aros_cflags_iquote_end=$kernel_cflags_iquote_end
1567 if test "$orig_target_cc" != "$aros_kernel_cc"; then
1568     CC="$orig_target_cc"
1569     AC_MSG_CHECKING([whether ${CC} accepts -iquote])
1570     AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
1571     AC_MSG_RESULT($has_iquote)
1572     if test "x-$has_iquote" = "x-yes" ; then
1573         aros_cflags_iquote=-iquote
1574         aros_cflags_iquote_end=
1575     else
1576         aros_cflags_iquote=-I
1577         aros_cflags_iquote_end=-I-
1578     fi
1580 if test "x-$use_no_stack_protector" = "x-yes" ; then
1581     aros_kernel_cflags="$aros_kernel_cflags -fno-stack-protector"
1584 #-----------------------------------------------------------------------------
1586 # Check if we can explicitly choose older version of symbol hashing
1588 CFLAGS="save_cflags -Wl,--hash-style=sysv"
1589 CC="$aros_kernel_cc"
1590 AC_MSG_CHECKING([whether ${CC} accepts -Wl,--hash-style=sysv])
1591 AC_TRY_LINK(,, use_hash_style="yes", use_hash_style="no")
1592 AC_MSG_RESULT($use_hash_style)
1593 if test "x-$use_hash_style" = "x-yes" ; then
1594     aros_kernel_cflags="$aros_kernel_cflags -Wl,--hash-style=sysv"
1596 CC="$save_cc"
1597 CFLAGS="$save_cflags"
1599 AC_SUBST(host_cflags_iquote)
1600 AC_SUBST(host_cflags_iquote_end)
1601 AC_SUBST(kernel_cflags_iquote)
1602 AC_SUBST(kernel_cflags_iquote_end)
1603 AC_SUBST(aros_cflags_iquote)
1604 AC_SUBST(aros_cflags_iquote_end)
1607 dnl Check if user specified --with-resolution=XRESxYRESxDEPTH
1608 AC_MSG_CHECKING([for default resolution of WBScreen])
1609 AC_ARG_WITH(resolution,AC_HELP_STRING([--with-resolution=XRESxYRESxDEPTH],[Default resolution of the initial WorkbenchScreen]),resolution=$withval,resolution=none)
1610 # We require an argument, so map --with/--without ("yes"/"no") to "none" specified
1611 if test "$resolution" = "yes" ; then
1612     resolution="none"
1614 if test "$resolution" = "no" ; then
1615     resolution="none"
1617 if test "$resolution" != "none" ; then
1618     aros_default_wbwidth=`echo $resolution | cut -d'x' -f1`
1619     aros_default_wbheight=`echo $resolution | cut -d'x' -f2`
1620     aros_default_wbdepth=`echo $resolution | cut -d'x' -f3`
1622 AC_MSG_RESULT($aros_default_wbwidth x $aros_default_wbheight x $aros_default_wbdepth)
1623 aros_cv_default_wbwidth=$aros_default_wbwidth
1624 aros_cv_default_wbheight=$aros_default_wbheight
1625 aros_cv_default_wbdepth=$aros_default_wbdepth
1627 dnl See if the user wants the serial debug output for native flavour
1628 AC_MSG_CHECKING([if serial debug is enabled])
1629 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)
1630 if test "$aros_serial_debug" = 0 ; then
1631     serial_debug_forced=""
1632     if test "$serial_debug" = "yes" ; then
1633         serial_debug="2"
1634     fi
1635     if test "$serial_debug" = "no" ; then
1636         serial_debug="none"
1637     fi
1638 else
1639     serial_debug_forced="(forced)"
1640     serial_debug=$aros_serial_debug
1642 if test "$serial_debug" != "none" ; then
1643     aros_serial_debug=$serial_debug
1644     AC_MSG_RESULT($serial_debug_forced on port $serial_debug)
1645 else
1646     AC_MSG_RESULT(no)
1649 dnl See if the user wants the palm debug output hack for palm native flavour
1650 AC_MSG_CHECKING([if palm debug hack is enabled])
1651 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")
1652 if test "$palm_debug_hack" = "yes" ; then
1653     aros_palm_debug_hack="1"
1655 AC_MSG_RESULT($palm_debug_hack)
1658 dnl See if the user wants nesting supervisor activated for unix flavour
1659 AC_MSG_CHECKING([if nesting supervisor support is enabled])
1660 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")
1661 if test "$nesting_supervisor" = "yes" ; then
1662     aros_nesting_supervisor="1"
1664 AC_MSG_RESULT($nesting_supervisor)
1667 dnl things specifically required for hosted flavours
1668 if test "x-$aros_flavour" = "x-emulation" -o "x-$aros_flavour" = "x-emulcompat" ; then
1670     if test "x-$need_dlopen" != "x-no" ; then
1671       dnl some kind of dynamic library access system is required for hostlib.resource
1672       AC_CHECK_FUNC(dlopen, have_dl="yes", have_dl="no")
1673       if test "x-$have_dl" = "x-no" ; then
1674           AC_CHECK_LIB(dl, dlopen, [have_dl="yes"
1675                                     aros_host_ldflags="$aros_host_ldflags -ldl"],
1676                                     have_dl="no")
1677       fi
1678       if test "x-$have_dl" = "x-no" ; then
1679           AC_MSG_ERROR([dlopen() dynamic linker functions not available])
1680       fi
1681     fi
1684     dnl x11 hidd
1685     AC_ARG_ENABLE(x11_hidd, AC_HELP_STRING([--enable-x11-hidd],
1686                                            [build X11 hidd for hosted (default=auto)]),
1687                                            x11_hidd="$enableval",
1688                                            x11_hidd="auto")
1689     case "x-$x11_hidd" in
1690         x-yes|x-no|x-auto)                 ;;
1691         *)                 x11_hidd="auto" ;;
1692     esac
1694     ENABLE_X11=0
1696     dnl they want it
1697     if test "x-$x11_hidd" != "x-no" ; then
1699         dnl find x11 stuff
1700         AC_PATH_X
1702         x_cflags=
1703         for path in $x_libraries
1704         do
1705             x_cflags="$x_cflags -L$path"
1706         done
1708         for path in $x_includes
1709         do
1710             x_cflags="$x_cflags -I$path"
1711         done
1712         
1713         if test "x-$no_x" = "x-yes" ; then
1715             dnl didn't find it
1716             if test "x-$x11_hidd" != "x-auto" ; then
1717                 dnl and they explicitly asked for it, bail out
1718                 AC_MSG_ERROR([X11 libs/headers not found, cannot build X11 hidd as requested])
1719             fi
1720         
1721         else
1722             dnl found it, setup the metatarget
1723             x11_hidd_target=kernel-x11gfx-kobj
1724             ENABLE_X11=1
1726             dnl setup shared memory extensions
1727             AC_ARG_ENABLE(x11_shm, AC_HELP_STRING([--enable-x11-shm],
1728                                                   [use X11 shared memory (default=auto)]),
1729                                                   x11_hidd_shm="$enableval",
1730                                                   x11_hidd_shm="auto")
1731             case "x-$x11_hidd_shm" in
1732                 x-yes|x-no|x-auto)                     ;;
1733                 *)                 x11_hidd_shm="auto" ;;
1734             esac
1736             have_xshm=no
1738             dnl they want it
1739             if test "x-$x11_hidd_shm" != "x-no" ; then
1741                 dnl system shm headers
1742                 AC_CHECK_HEADERS(sys/ipc.h)
1743                 AC_CHECK_HEADERS(sys/shm.h)
1745                 dnl got them
1746                 if test "x-$ac_cv_header_sys_ipc_h" = "x-yes" -a "x-$ac_cv_header_sys_shm_h" = "x-yes" ; then
1748                     dnl make sure X libs have shm functions
1749                     save_cflags="$CFLAGS"
1750                     CFLAGS="$CFLAGS $x_cflags"
1751                     AC_CHECK_LIB(Xext, XShmQueryExtension, have_xshm=yes)
1752                     CFLAGS="$save_cflags"
1753                 fi
1754             fi
1756             dnl detection done, prepare output
1757             if test "x-$have_xshm" = "x-yes" ; then
1758                 dnl we can do shm
1759                 DO_XSHM_SUPPORT="1"
1760             elif test "x-$x11_hidd_shm" = "x-yes" ; then
1761                 dnl they explicitly asked for it, but we can't do it
1762                 AC_MSG_ERROR([X11 has no support for shared memory, cannot enable it as requested])
1763             else
1764                 dnl otherwise just disable it
1765                 DO_XSHM_SUPPORT="0"
1766             fi
1768             
1769             dnl setup vidmode (fullscreen) extensions
1770             AC_ARG_ENABLE(x11_vidmode, AC_HELP_STRING([--enable-x11-vidmode],
1771                                                       [use X11 vidmode extension (default=auto)]),
1772                                                       x11_hidd_vidmode="$enableval",
1773                                                       x11_hidd_vidmode="auto")
1774             case "x-$x11_hidd_vidmode" in
1775                 x-yes|x-no|x-auto)                         ;;
1776                 *)                 x11_hidd_vidmode="auto" ;;
1777             esac
1779             have_vidmode=no
1781             dnl they want it
1782             if test "x-$x11_hidd_vidmode" != "x-no" ; then
1784                 dnl make sure X libs have vidmode functions
1785                 save_cflags="$CFLAGS"
1786                 CFLAGS="$CFLAGS $x_cflags"
1787                 AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryExtension, have_vidmode=yes)
1788                 CFLAGS="$save_cflags"
1789             fi
1791             dnl detection done, prepare output
1792             if test "x-$have_vidmode" = "x-yes" ; then
1793                 dnl we can do vidmode
1794                 DO_VIDMODE_SUPPORT="1"
1795             elif test "x-$x11_hidd_vidmode" = "x-yes" ; then
1796                 dnl they explicitly asked for it, but we can't do it
1797                 AC_MSG_ERROR([X11 vidmode extension not available, cannot enable it as requested])
1798             else
1799                 dnl otherwise just disable it
1800                 DO_VIDMODE_SUPPORT="0"
1801             fi
1802         fi
1804         aros_host_x11_includes=$x_includes 
1805         aros_host_x11_libdirs=$x_libraries
1806     fi
1809     dnl sdl hidd
1810     AC_ARG_ENABLE(sdl_hidd, AC_HELP_STRING([--enable-sdl-hidd],
1811                                            [build SDL hidd for hosted (default=auto)]),
1812                                            sdl_hidd="$enableval",
1813                                            sdl_hidd="auto")
1814     case "x-$sdl_hidd" in
1815         x-yes|x-no|x-auto)                 ;;
1816         *)                 sdl_hidd="auto" ;;
1817     esac
1819     dnl they want it
1820     if test "x-$sdl_hidd" != "x-no" ; then
1822         dnl find sdl
1823         AM_PATH_SDL([1.2.10], have_sdl="yes", have_sdl="no")
1825         if test "x-$have_sdl" != "x-yes" ; then
1827             dnl didn't find it
1828             if test "x-$sdl_hidd" != "x-auto" ; then
1829                 dnl and they explicitly asked for it, bail out
1830                 AC_MSG_ERROR([SDL libs/headers not found, cannot build SDL hidd as requested])
1831             fi
1833         else
1834             dnl found it, set up the metatarget
1835             sdl_hidd_target=kernel-hidd-sdl
1836             aros_host_sdl_cflags=SDL_CFLAGS
1837             aros_host_sdl_libs=SDL_LIBS
1838         fi
1839     fi
1844 dnl See if the user wants dbus.library
1845 AC_MSG_CHECKING([if building of dbus.library is enabled])
1846 AC_ARG_ENABLE(dbus,AC_HELP_STRING([--enable-dbus],[Enable DBUS support via dbus.library (default=no)]),dbus="yes",dbus="no")
1847 if test "$dbus" = "yes" ; then
1848     ENABLE_DBUS=1
1849     DBUS_CFLAGS=`pkg-config --cflags dbus-1`
1850     DBUS_LIBFLAGS=`pkg-config --libs dbus-1`
1851     KERNEL_DBUS_KOBJ=kernel-dbus-kobj
1852     KERNEL_DBUS_INCLUDES=kernel-dbus-includes
1853 else
1854     ENABLE_DBUS=0
1856 AC_MSG_RESULT($dbus)
1859 dnl --------------------------------------------------------------------
1860 dnl Configuration Output Section
1861 dnl --------------------------------------------------------------------
1863 # Generic
1864 AC_SUBST(aros_arch)
1865 AC_SUBST(aros_cpu)
1866 AC_SUBST(aros_flavour)
1867 AC_SUBST(aros_flavour_uc)
1868 AC_SUBST(AROS_BUILDDIR)
1869 AC_SUBST(AROS_BUILDDIR_UNIX)
1870 AC_SUBST(SRCDIR)
1871 AC_SUBST(AROS_PORTSSRCDIR)
1873 # Host related
1874 AC_SUBST(aros_cc_pre)
1875 AC_SUBST(aros_host_strip)
1876 AC_SUBST(aros_host_arch)
1877 AC_SUBST(aros_host_cpu)
1878 AC_SUBST(aros_host_cc)
1879 AC_SUBST(aros_host_ar)
1880 AC_SUBST(aros_host_ranlib)
1881 AC_SUBST(aros_host_ld)
1882 AC_SUBST(aros_host_make)
1883 AC_SUBST(aros_host_cflags)
1884 AC_SUBST(aros_host_ldflags)
1885 AC_SUBST(aros_host_debug)
1886 AC_SUBST(aros_host_mkdep)
1887 AC_SUBST(aros_host_mkargs)
1888 AC_SUBST(aros_host_exe_suffix)
1889 AC_SUBST(aros_host_lib_suffix)
1890 AC_SUBST(aros_tools_dir)
1891 AC_SUBST(aros_host_aclocal)
1892 AC_SUBST(aros_host_autoconf)
1893 AC_SUBST(aros_host_autoheader)
1894 AC_SUBST(aros_host_automake)
1896 # Target Related
1897 AC_SUBST(aros_target_guitheme)
1898 AC_SUBST(aros_target_iconset)
1899 AC_SUBST(aros_target_bootloader)
1900 AC_SUBST(aros_target_arch)
1901 AC_SUBST(aros_target_cpu)
1902 AC_SUBST(aros_target_variant)
1903 AC_SUBST(aros_target_suffix)
1904 AC_SUBST(aros_target_incl)
1905 AC_SUBST(aros_target_ar)
1906 AC_SUBST(aros_target_ranlib)
1907 AC_SUBST(aros_kernel_nm)
1908 AC_SUBST(orig_target_cc)
1909 AC_SUBST(aros_target_cc)
1910 AC_SUBST(aros_target_cxx)
1911 AC_SUBST(aros_kernel_cc)
1912 AC_SUBST(aros_target_as)
1913 AC_SUBST(orig_target_ld)
1914 AC_SUBST(aros_target_ld)
1915 AC_SUBST(aros_kernel_ld)
1916 AC_SUBST(aros_target_cc_includes)
1917 AC_SUBST(aros_target_cc_path)
1918 AC_SUBST(aros_target_objdump)
1919 AC_SUBST(aros_target_objcopy)
1920 AC_SUBST(aros_target_strip)
1921 AC_SUBST(aros_target_nm)
1922 AC_SUBST(aros_kernel_rescomp)
1923 AC_SUBST(aros_shared_default)
1924 AC_SUBST(aros_shared_ld)
1925 AC_SUBST(aros_object_format)
1926 AC_SUBST(aros_compiler_libs)
1927 AC_SUBST(aros_arch_libs)
1929 AC_SUBST(aros_config_cflags)
1930 AC_SUBST(aros_config_aflags)
1931 AC_SUBST(aros_config_ldflags)
1933 AC_SUBST(aros_shared_cflags)
1934 AC_SUBST(aros_shared_aflags)
1935 AC_SUBST(aros_shared_ldflags)
1936 AC_SUBST(aros_kernel_cflags)
1937 AC_SUBST(aros_kernel_objcflags)
1938 AC_SUBST(aros_kernel_ldflags)
1939 AC_SUBST(aros_debug_cflags)
1940 AC_SUBST(aros_debug_aflags)
1941 AC_SUBST(aros_debug_ldflags)
1942 AC_SUBST(aros_target_genmap)
1943 AC_SUBST(aros_target_strip_flags)
1945 # Graphics Related
1946 AC_SUBST(x11_hidd_target)
1947 AC_SUBST(sdl_hidd_target)
1949 AC_SUBST(aros_default_wbwidth)
1950 AC_SUBST(aros_default_wbheight)
1951 AC_SUBST(aros_default_wbdepth)
1952 AC_SUBST(DO_XSHM_SUPPORT)
1953 AC_SUBST(DO_VIDMODE_SUPPORT)
1955 AC_SUBST(aros_host_x11_includes)
1956 AC_SUBST(aros_host_x11_libdirs)
1957 AC_SUBST(aros_host_sdl_cflags)
1958 AC_SUBST(aros_host_sdl_libs)
1960 # Native version related
1961 AC_SUBST(aros_serial_debug)
1963 # Palm native version related
1964 AC_SUBST(aros_palm_debug_hack)
1966 # Unix/Hosted version related
1967 AC_SUBST(aros_nesting_supervisor)
1969 # Apple iOS related
1970 AC_SUBST(aros_ios_platform)
1971 AC_SUBST(aros_ios_version)
1972 AC_SUBST(aros_ios_sdk)
1974 # DBUS related
1975 AC_SUBST(ENABLE_DBUS)
1976 AC_SUBST(DBUS_CFLAGS)
1977 AC_SUBST(DBUS_LIBFLAGS)
1978 AC_SUBST(KERNEL_DBUS_KOBJ)
1979 AC_SUBST(KERNEL_DBUS_INCLUDES)
1981 #X11 related
1982 AC_SUBST(ENABLE_X11)
1984 # Debug related
1985 AC_SUBST(aros_debug)
1986 AC_SUBST(aros_mungwall_debug)
1987 AC_SUBST(aros_stack_debug)
1988 AC_SUBST(aros_modules_debug)
1990 # Collect-aros stuff: "-ius" to ignore undefined symbols
1991 AC_SUBST(ignore_undefined_symbols)
1993 # C compiler related
1994 AC_SUBST(gcc_target_cpu)
1996 dnl Prepare for output, make up all the generated patches
1997 case "$aros_flavour" in
1998 emulation)      aros_flavour_uc="AROS_FLAVOUR_EMULATION"
1999                 aros_flavour="emulation" ;;
2000 emulcompat)     aros_flavour_uc="(AROS_FLAVOUR_EMULATION|AROS_FLAVOUR_BINCOMPAT)"
2001                 aros_flavour="emulation" ;;
2002 standalone)     aros_flavour_uc="AROS_FLAVOUR_STANDALONE"
2003                 aros_flavour="standalone";;
2004 native)         aros_flavour_uc="AROS_FLAVOUR_NATIVE"
2005                 aros_flavour="native" ;;
2006 nativecompat)   aros_flavour_uc="(AROS_FLAVOUR_NATIVE|AROS_FLAVOUR_BINCOMPAT)"
2007                 aros_flavour="native" ;;
2008 linklib)        aros_flavour_uc="AROS_FLAVOUR_LINKLIB"
2009                 aros_flavour="linklib" ;;
2010 palmnative)     aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
2011                 aros_flavour="palmnative" ;;
2012 mac68knative)   aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
2013                 aros_flavour="mac68knative" ;;
2014 ppcnative)      aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_BINCOMPAT)"
2015                 aros_flavour="ppcnative" ;;
2016 esac
2018 if test ! -d ${aros_inc_dir} ; then
2019     ${MKDIR} ${aros_inc_dir}
2021 if test ! -d ${aros_geninc_dir} ; then
2022     ${MKDIR} ${aros_geninc_dir}
2024 if test ! -d ${aros_hostcfg_dir} ; then
2025     ${MKDIR} ${aros_hostcfg_dir}
2027 if test ! -d ${aros_targetcfg_dir} ; then
2028     ${MKDIR} ${aros_targetcfg_dir}
2030 if test ! -d ${aros_tools_dir} ; then
2031     ${MKDIR} ${aros_tools_dir}
2033 if test ! -d ${aros_scripts_dir} ; then
2034     ${MKDIR} ${aros_scripts_dir}
2037 AC_CONFIG_HEADERS(${aros_geninc_dir}/host-conf.h:config/host-conf.h.in)
2039 AC_CONFIG_COMMANDS([compiler_executable],
2040     [
2041         prefix=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}
2042         mkdir -p $prefix
2043         prefix="${prefix}/${aros_target_cpu}-aros"
2044         prefix2=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros
2046         echo ${prefix}
2047         echo ${prefix2}
2048         chmod a+x ${prefix2}-gcc ${prefix2}-ld
2050         ln -sf ${prefix2}-gcc          ${prefix}-gcc
2051         ln -sf ${prefix2}-ld           ${prefix}-ld
2053         ln -sf $aros_target_as_ln$aros_host_exe_suffix      ${prefix}-as
2054         ln -sf $aros_target_nm_ln$aros_host_exe_suffix      ${prefix}-nm
2055         ln -sf $aros_target_ar_ln$aros_host_exe_suffix      ${prefix}-ar
2056         ln -sf $aros_target_ranlib_ln$aros_host_exe_suffix  ${prefix}-ranlib
2057         ln -sf $aros_target_objcopy_ln$aros_host_exe_suffix ${prefix}-objcopy
2058         ln -sf $aros_target_objdump_ln$aros_host_exe_suffix ${prefix}-objdump
2059         ln -sf $aros_target_strip_ln$aros_host_exe_suffix   ${prefix}-strip
2061         ln -sf $aros_target_as_ln$aros_host_exe_suffix      ${prefix2}-as
2062         ln -sf $aros_target_nm_ln$aros_host_exe_suffix      ${prefix2}-nm
2063         ln -sf $aros_target_ar_ln$aros_host_exe_suffix      ${prefix2}-ar
2064         ln -sf $aros_target_ranlib_ln$aros_host_exe_suffix  ${prefix2}-ranlib
2065         ln -sf $aros_target_objcopy_ln$aros_host_exe_suffix ${prefix2}-objcopy
2066         ln -sf $aros_target_objdump_ln$aros_host_exe_suffix ${prefix2}-objdump
2067         ln -sf $aros_target_strip_ln$aros_host_exe_suffix   ${prefix2}-strip
2068     ],
2069     [
2070         aros_host_exe_suffix=${aros_host_exe_suffix}
2071         aros_tools_dir=${aros_tools_dir}
2072         aros_target_cpu=${aros_target_cpu}
2073         aros_target_arch=${aros_target_arch}
2074         aros_target_suffix=${aros_target_suffix}
2075         aros_target_nm_ln=${aros_target_nm_ln}
2076         aros_target_as_ln=${aros_target_as_ln}
2077         aros_target_ar_ln=${aros_target_ar_ln}
2078         aros_target_ranlib_ln=${aros_target_ranlib_ln}
2079         aros_target_objdump_ln=${aros_target_objdump_ln}
2080         aros_target_objcopy_ln=${aros_target_objcopy_ln}
2081         aros_target_strip_ln=${aros_target_strip_ln}
2082     ]
2084 AC_CONFIG_COMMANDS([genshared_executable],
2085     [chmod a+x ${aros_scripts_dir}/genshared],
2086     [aros_scripts_dir=${aros_scripts_dir}]
2088 AC_CONFIG_COMMANDS([genmf_executable],
2089     [chmod a+x ${aros_tools_dir}/genmf.py],
2090     [aros_tools_dir=${aros_tools_dir}]
2093 AC_CONFIG_FILES(
2094     Makefile
2095     config/make.cfg
2096     ${aros_inc_dir}/config.h:config/config.h.in
2097     ${aros_geninc_dir}/config.h:config/config.h.in
2098     ${aros_hostcfg_dir}/host.cfg:config/host.cfg.in
2099     ${aros_targetcfg_dir}/target.cfg:config/target.cfg.in
2100     mmake.config
2101     ${aros_targetcfg_dir}/make.defaults:config/make.defaults.in
2102     ${aros_targetcfg_dir}/specs:config/specs.in
2103     ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-gcc:scripts/aros-gcc.in
2104     ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-ld:scripts/aros-ld.in
2105     ${aros_scripts_dir}/genshared:compiler/c_lib/source/lib_source/genshared.in
2106     ${aros_tools_dir}/genmf.py:tools/genmf/genmf.py
2107     tools/collect-aros/env.h
2110 AC_OUTPUT
2112 dnl This is in order to not define SHARED_CFLAGS sometimes
2113 dnl We don't always do aros_shared_ar, aros_shared_cflags
2115 #XXX compatability...
2116 aros_shared_ar="$aros_shared_ld $aros_shared_ldflags -o"
2118 if test -n "$aros_shared_cflags" ; then
2119     echo "SHARED_CFLAGS := $aros_shared_cflags" >> ${aros_hostcfg_dir}/host.cfg
2120     echo "SHARED_AR := $aros_shared_ar" >> ${aros_hostcfg_dir}/host.cfg