consistency
[AROS.git] / configure.in
blob16b8e5f3fa94dac19b035282e3a0d2b1aa02f71d
1 dnl Copyright © 1997-2010, The AROS Development Team. All rights reserved.
2 dnl $Id$
3 dnl
4 dnl Desc: Autoconf source for configuration file
5 dnl Lang: english
7 #TODO
8 # method of getting shared/non-shared ld/ar tool for target.
11 # ------------------------------------------------------------------------
12 # Here starts the first section of the configure.in file.
13 # ------------------------------------------------------------------------
15 AC_INIT(mmakefile)
16 AC_PREREQ(2.61)
17 AC_CONFIG_AUX_DIR(scripts/autoconf)
19 # Check what host we are running on.
20 # If a target is not suggested, we use this one.
21 # Note that what we call a target, Autoconf calls a host.
22 AC_CANONICAL_HOST
24 # The AROS target is slightly different to the normal GNU style
25 # format. We don't have the middle part, and we reverse the order
26 # of the $(CPU) and $(OS) bits.
28 # Don't strip the version of the target yet, it might be
29 # useful on some systems.
31 AC_MSG_CHECKING([for AROS style target])
33 if test "$target" = "NONE" ; then
34     target=$host_os-$host_cpu
35     cross_compile=no
36 else
37     if test "$target" = "" ; then
38         target=$host_os-$host_cpu
39         cross_compile=no
40     else
41         cross_compile=yes
42     fi
44 AC_MSG_RESULT($target)
46 if test "$host_os" = "mingw32" ; then
47     PWDCMD="pwd -W"
50 #don't know where else to put this...
51 AC_MSG_CHECKING([Building AROS in .. ])
52 AROS_BUILDDIR=`${PWDCMD-pwd}`
53 AROS_BUILDDIR_UNIX=${PWD}
54 AC_MSG_RESULT($AROS_BUILDDIR)
56 AC_MSG_CHECKING([AROS Source in .. ])
57 srcpwd=`cd ${srcdir} ; ${PWDCMD-pwd}`
58 SRCDIR=${srcpwd}
59 AC_MSG_RESULT($SRCDIR)
61 # Parse the target field into something useful.
62 changequote(<<,>>)
63 target_os=`echo $target | sed 's/^\([^-]*\)-\(.*\)$/\1/'`
64 target_cpu=`echo $target | sed 's/^\([^-]*\)-\(.*\)$/\2/'`
65 changequote([,])
67 dnl --------------------------------------------------------------------
68 dnl Set the default Workbench resolution
69 dnl --------------------------------------------------------------------
70 aros_default_wbwidth=800
71 aros_default_wbheight=600
72 aros_default_wbdepth=4
74 dnl --------------------------------------------------------------------
75 dnl Host Configuration Section
76 dnl --------------------------------------------------------------------
77 dnl
78 dnl The idea here is to find out all the information we need about the
79 dnl host. This means things like tools for building directory structures,
80 dnl copying files around and the like.
82 # The first step is to find the host binaries.
83 # Check for a compiler.
84 AC_PROG_CC
85 AC_PROG_CC_STDC
86 AC_PROG_CPP
88 # Check for a compatible awk
89 AC_CHECK_PROGS(AWK,[gawk nawk])
90 AROS_REQUIRED(gawk,$AWK)
91 AROS_PROG(MMAKE,mmake)
93 # Perform some default variable assignments. Note all of these will be
94 # Regenerated from the script, so there is no need to cache them.
96 aros_host_cc="$CC"
97 AROS_TOOL_CCPATH(aros_host_ld,ld)
98 AROS_REQUIRED(ld,$aros_host_ld)
99 aros_host_make="make"
100 aros_host_cflags=$CFLAGS
101 aros_host_ldflags=$LDFLAGS
102 aros_host_debug="-g -O0"
103 aros_host_mkdep="\$(SRCDIR)/scripts/mkdep"
104 aros_host_mkargs="--no-print-directory"
105 aros_host_incl="/usr/include"
106 aros_host_exe_suffix="$EXEEXT"
107 aros_host_lib_suffix=""
109 AC_CHECK_PROGS(aros_host_aclocal,[aclocal aclocal19 aclocal-1.9])
110 AC_CHECK_PROGS(aros_host_autoconf,[autoconf autoconf259 autoconf253])
111 AC_CHECK_PROGS(aros_host_autoheader,[autoheader autoheader259 autoheader253])
112 AC_CHECK_PROGS(aros_host_automake,[automake automake19 automake-1.9])
114 AROS_REQUIRED(aclocal/aclocal19/aclocal-1.9, $aros_host_aclocal)
115 AROS_REQUIRED(automake/automake19/automake-1.9, $aros_host_automake)
117 case "$aros_host_cc" in
118     *gcc*)
119         aros_host_cc_pipe="-pipe"
120         ;;
121     icc)
122         aros_host_cc_pipe=""
123         ;;
124     *)
125         aros_host_cc_pipe=""
126         ;;
127 esac
129 aros_kernel_cc_includes=""
130 aros_target_cc_includes=""
132 # This is the main host configuration section. It is where the host
133 # can change the values of any variables it needs to change. We do
134 # not look at anything that compiles to the target yet, we'll get
135 # to that later.
137 case "$host_os" in
138     aros*)
139         aros_host_arch="aros"
140         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
141         case "$host_cpu" in
142             *i?86*)
143                 aros_host_cpu="i386"
144                 ;;
145             *x86_64*)
146                 aros_host_cpu="x86_64"
147                 ;;
148             *powerpc*)
149                 aros_host_cpu="ppc"
150                 ;;
151             *)
152                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
153                 aros_host_cpu="$host_cpu"
154                 ;;
155         esac
156         ;;
158     linux*)
159         aros_host_arch="linux"
160         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
161         case "$host_cpu" in
162             *i?86*)
163                 aros_host_cpu="i386"
164                 ;;
165             *x86_64*)
166                 aros_host_cpu="x86_64"
167                 ;;
168             *m68k*)
169                 aros_host_cpu="m68k"
170                 ;;
171             *powerpc*)
172                 aros_host_cpu="ppc"
173                 ;;
174             *arm*)
175                 aros_host_cpu="arm"
176                 ;;
177             *)
178                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
179                 aros_host_cpu="$host_cpu"
180                 ;;
181         esac
182         ;;
184     freebsd*)
185         aros_host_cc="$aros_host_cc $aros_host_cc_pipe -I/usr/local/include"
186         aros_host_make="gmake"
187         aros_host_arch="freebsd"
188         aros_host_cpu="i386"
190         aros_host_ldflags="$aros_host_ldflags -L/usr/local/lib -liconv"
192         dnl FreeBSD 5.x (and later) has changed the default object format.
193         dnl The double [[]] is necessary to get around m4's quoting rules.
194         case $host_os in
195             freebsd[[234]]*)
196                 aros_object_format="elf_i386"
197                 ;;
199             *)
200                 aros_object_format="elf_i386_fbsd"
201                 ;;
202         esac
204         ;;
206     darwin*)
207         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
208         aros_host_arch="darwin"
209         case "$host_cpu" in
210             *i?86*)
211                 aros_host_cpu="i386"
212                 ;;
213             *x86_64*)
214                 aros_host_cpu="x86_64"
215                 ;;
216             *powerpc*)
217                 aros_host_cpu="ppc"
218                 ;;
219             *)
220                 AC_MSG_WARN("Unknown CPU for Darwin host -- $host_cpu")
221                 aros_host_cpu="$host_cpu"
222                 ;;
223         esac
225         aros_host_ldflags="$aros_host_ldflags -liconv"
227         ;;
229     dragonfly*)
230         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
231         aros_host_make="gmake"
232         aros_host_arch="dragonfly"
233         case $host_cpu in
234             *i?86*)
235                 aros_host_cpu="i386"
236                 ;;
237             *amd64*)
238                 aros_host_cpu="x86_64"
239                 ;;
240             *)
241                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
242                 aros_host_cpu="$host_cpu"
243                 ;;
244         esac
245         ;;
247     netbsd*)
248         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
249         aros_host_make="gmake"
250         aros_host_arch="netbsd"
251         case "$host_cpu" in
252             *i?86*)
253                 aros_host_cpu="i386"
254                 ;;
255             *m68k*)
256                 aros_host_cpu="m68k"
257                 ;;
258             *)
259                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
260                 aros_host_cpu="$host_cpu"
261                 ;;
262         esac    
263         aros_host_lib_suffix=".0.0"
264         ;;
266     openbsd*)
267         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
268         aros_host_make="gmake"
269         aros_host_arch="openbsd"
270         case "$host_cpu" in
271             *i?86*)
272                 aros_host_cpu="i386"
273                 ;;
274             *)
275                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
276                 aros_host_cpu="$host_cpu"
277                 ;;
278         esac
279         ;;
280         
281     solaris*)
282         aros_host_arch="solaris"
283         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
284         case "$host_cpu" in
285             *i?86*)
286                 aros_host_cpu="i386"
287                 ;;
288             *sparc*)
289                 aros_host_cpu="sparc"
290                 ;;
291             *)
292                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
293                 aros_host_cpu="$host_cpu"
294                 ;;
295         esac
296         ;;
298     morphos*)
299         aros_host_arch="morphos"
300         aros_host_cpu="ppc"
301         ;;
303     amiga*)
304         aros_host_arch="amiga"
305         SORT="/gg/bin/sort"
306         TEST="/gg/bin/test"
307         UNIQ="/gg/bin/uniq"
308         FOR="for"
309         TOUCH="/gg/bin/touch"
310         case "$host_cpu" in
311             *m68k*)
312                 aros_host_cpu="m68k"
313                 ;;
314             *powerpc*)
315                 aros_host_cpu="ppc"
316                 ;;
317             *)
318                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
319                 aros_host_cpu="$host_cpu"
320                 ;;
321         esac
322         ;;
324     cygwin*)
325         aros_host_arch="cygwin"
326         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
327         case "$host_cpu" in
328             *i?86*)
329                 aros_host_cpu="i386"
330                 ;;
331             *)
332                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
333                 aros_host_cpu="$host_cpu"
334                 ;;
335         esac
336         ;;
338     mingw32*)
339         aros_host_arch="mingw32"
340         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
341         case "$host_cpu" in
342             *i?86*)
343                 aros_host_cpu="i386"
344                 ;;
345             *)
346                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
347                 aros_host_cpu="$host_cpu"
348                 ;;
349         esac
350         ;;
351     *)
352         AC_MSG_ERROR([Unsupported host architecture $host])
353         ;;
354 esac
356 AROS_PROG(aros_host_ar,[ar],[cr])
357 AROS_REQUIRED(ar,$aros_host_ar)
358 AROS_PROG(aros_host_ranlib,ranlib)
359 AROS_REQUIRED(ranlib,$aros_host_ranlib)
360 AROS_PROG(aros_host_strip,strip)
361 AROS_REQUIRED(strip,$aros_host_strip)
363 AROS_PROG(RM,[rm],[-rf])
364 AROS_REQUIRED(rm,$RM)
365 AROS_PROG(CP,[cp])
366 AROS_REQUIRED(cp,$CP)
367 AROS_PROG(MV,[mv])
368 AROS_REQUIRED(mv,$MV)
369 AROS_PROG(ECHO,[echo])
370 AROS_REQUIRED(echo,$ECHO)
371 AROS_PROG(MKDIR,[mkdir],[-p])
372 AROS_REQUIRED(mkdir,$MKDIR)
373 AROS_PROG(TOUCH,[touch])
374 AROS_REQUIRED(touch,$TOUCH)
375 AROS_PROG(SORT,[sort])
376 AROS_REQUIRED(sort,$SORT)
377 AROS_PROG(UNIQ,[uniq])
378 AROS_REQUIRED(uniq,$UNIQ)
379 AROS_PROG(NOP,[true])
380 AROS_REQUIRED(true,$NOP)
381 AROS_PROG(CAT,[cat])
382 AROS_REQUIRED(cat,$CAT)
383 AROS_PROG(BISON,[bison])
384 AROS_REQUIRED(bison,$BISON)
385 AROS_PROG(FLEX,[flex])
386 AROS_REQUIRED(flex,$FLEX)
387 AROS_PROG(PNGTOPNM,[pngtopnm])
388 AROS_REQUIRED(pngtopnm,$PNGTOPNM)
389 AROS_PROG(PPMTOILBM,[ppmtoilbm])
390 AROS_REQUIRED(ppmtoilbm,$PPMTOILBM)
391 AROS_PROG(SED,[sed])
392 AROS_REQUIRED(sed,$SED)
393 AROS_PROG(CHMOD,[chmod])
394 AROS_REQUIRED(chmod,$CHMOD)
396 AM_PATH_PYTHON(2.5)
398 AC_SUBST(FOR, for)
399 AC_SUBST(IF, if)
400 AC_SUBST(TEST, test)
401 AC_SUBST(CMP, cmp)
403 dnl ---------------------------------------------------------------------------
404 dnl Look for things about the host system, good for hosted targets.
405 dnl ---------------------------------------------------------------------------
407 # Check for some includes for the X11 HIDD and the kernel
408 AC_CHECK_HEADERS([sys/ipc.h sys/shm.h \
409     sys/mmap.h sys/mman.h sysexits.h \
410     sys/statfs.h sys/statvfs.h sys/vfs.h sys/param.h \
413 AC_CHECK_HEADERS([sys/mount.h],,,[#include <sys/param.h>])
415 AC_HEADER_DIRENT
416 AC_HEADER_STAT
417 AC_HEADER_STDC
418 AC_HEADER_SYS_WAIT
419 AC_HEADER_TIME
420 AC_STRUCT_ST_BLKSIZE
421 AC_STRUCT_ST_BLOCKS
422 AC_STRUCT_ST_RDEV
423 AC_STRUCT_TM
424 AC_STRUCT_TIMEZONE
425 AC_TYPE_OFF_T
426 AC_TYPE_PID_T
427 AC_TYPE_SIZE_T
428 AC_TYPE_UID_T
430 AC_CHECK_MEMBERS(struct tm.tm_gmtoff)
432 # Look for some functions
433 AC_CHECK_FUNCS([getpagesize kqueue statfs statvfs \
434     clone kse_create rfork_thread thr_create sa_register \
435     getcontext makecontext setcontext sigaltstack swapcontext])
437 AC_FUNC_MMAP
440 dnl --------------------------------------------------------------------
441 dnl Target Configuration Section
442 dnl --------------------------------------------------------------------
444 dnl The target configuration section is responsible for setting up all
445 dnl the paths for includes, and tools required to build AROS to some
446 dnl particular target.
448 aros_config_cflags="-Wall -Werror-implicit-function-declaration"
449 aros_config_aflags="-Wall -x assembler-with-cpp -c"
450 aros_config_ldflags=""
452 aros_shared_default=yes
454 aros_shared_cflags="-fPIC"
455 aros_shared_aflags=""
456 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
457 aros_kernel_ldflags="-Wl,-rpath,./lib"
459 aros_target_ar_flags="cr"
460 aros_target_nm_flags="-C -ul"
461 aros_target_strip_flags="--strip-unneeded -R.comment"
463 aros_compiler_libs=
464 aros_arch_libs=
466 aros_target_genmap="-Wl,-Map -Xlinker"
468 # Native flavour stuff
469 aros_serial_debug="0"
471 # Palm native flavour stuff
472 aros_palm_debug_hack="0"
474 # Unix flavour stuff
475 aros_nesting_supervisor="0"
477 # Collect-aros stuff: "-ius" to ignore undefined symbols
478 ignore_undefined_symbols=""
480 # Check for X11 by default
481 need_x11="auto"
483 #-----------------------------------------------------------------------------
486 # GCC 4.1+ has a stack protection feature that requires OS support. Ubuntu has
487 # it switched on by default, and we use the host compiler, so it compiles AROS
488 # code with this enabled resulting in link failures as we don't have support
489 # for it.
491 # We use two methods to disable it. For the host compiler (used to compile
492 # some hosted modules), we test to see if the compiler supports stack
493 # protection, and if it does we disable it in AROS_CONFIG_CFLAGS. This should
494 # work on all platforms.
496 # For the "cross" compiler we clear the "ssp_default" spec in config/specs.in
497 # (this is done unconditionally, as it should have no effect on compilers
498 # without the stack protection feature). This may be specific to the way that
499 # Ubuntu enables the feature, so may not work everywhere. My specs-fu isn't
500 # strong enough to disable it in a generic way though, so we'll live with it
501 # until another vendor ships GCC with it enabled in a different way, and deal
502 # with it then.
505 AC_MSG_CHECKING([whether ${CC} accepts -fno-stack-protector])
506 save_cflags="$CFLAGS"
507 CFLAGS="$CFLAGS -fno-stack-protector"
508 AC_TRY_COMPILE(,, use_no_stack_protector="yes", use_no_stack_protector="no")
509 AC_MSG_RESULT($use_no_stack_protector)
510 if test "x-$use_no_stack_protector" = "x-yes" ; then
511     aros_host_cflags="$aros_host_cflags -fno-stack-protector"
513 CFLAGS="$save_cflags"
515 #-----------------------------------------------------------------------------
517 # Disable pointer-signedness warnings if the compiler recognises the option
518 # (this only works for the host compiler at the moment)
520 AC_MSG_CHECKING([whether ${CC} accepts -Wno-pointer-sign])
521 save_cflags="$CFLAGS"
522 CFLAGS="$CFLAGS -Wno-pointer-sign"
523 AC_TRY_COMPILE(,, use_no_sign_warning="yes", use_no_sign_warning="no")
524 AC_MSG_RESULT($use_no_sign_warning)
525 if test "x-$use_no_sign_warning" = "x-yes" ; then
526     aros_host_cflags="$aros_host_cflags -Wno-pointer-sign"
528 CFLAGS="$save_cflags"
530 #-----------------------------------------------------------------------------
532 AC_MSG_CHECKING([for type of build])
533 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")
535 if test "$build_type" = "nightly"; then
536     build_type_string="NIGHTLY"
537 elif test "$build_type" = "snapshot"; then
538     build_type_string="SNAPSHOT"
539 elif test "$build_type" = "milestone"; then
540     build_type_string="MILESTONE"
541 elif test "$build_type" = "release"; then
542     build_type_string="RELEASE"
543 else
544     build_type_string="PERSONAL"
545     build_type="personal"
548 aros_config_cflags="$aros_config_cflags -DAROS_BUILD_TYPE=AROS_BUILD_TYPE_$build_type_string"
550 AC_MSG_RESULT($build_type)
552 #-----------------------------------------------------------------------------
553 all_debug_types="messages stack modules mungwall symbols"
555 AC_MSG_CHECKING([which debug types to enable])
556 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)]),
557  debug="$enableval",debug="")
559 if test "$debug" = "" -o "$debug" = "no"; then
560     debug="none"
561 elif test "$debug" = "yes"; then
562     debug="all"
565 if test "$debug" = "all" ; then
566     debug="messages stack modules symbols"
567     for d in $all_debug_types; do
568         export aros_${d}_debug="1"
569     done
570 else
571     for d in $all_debug_types; do
572         export aros_${d}_debug="0"
573     done
576 if test "$debug" != "none"; then
577     debug=`echo $debug | sed s/,/\ /g`
578     for d in $debug; do
579         found="0"
580         for d2 in $all_debug_types; do
581             if test "$d2" = "$d"; then
582                 found="1"
583                 break
584             fi
585         done
586         if test "$found" = "0"; then
587             AC_MSG_ERROR([unrecognized debug type "$d". Available types are: all none $all_debug_types])
588         fi
589         export aros_${d}_debug="1"
590     done
591     aros_debug="yes"
593 AC_MSG_RESULT($debug)
595 if test "$aros_messages_debug" = "1"; then
596     aros_messages_debug="-DADEBUG=1 -DMDEBUG=1"
597 else
598     aros_messages_debug=""
600 if test "$aros_symbols_debug" = "1"; then
601     aros_symbols_debug="-g"
602 else
603     aros_symbols_debug=""
606 # These are the flags to pass when compiling debugged programs
607 aros_debug_cflags="$aros_symbols_debug $aros_messages_debug"
608 aros_debug_aflags=""
609 aros_debug_ldflags="$aros_symbols_debug"
611 aros_crosstools="no"
613 #-----------------------------------------------------------------------------
614 #   Checking if we should build crosstools..
615 AC_MSG_CHECKING([whether to build crosstools])
616 AC_ARG_ENABLE(crosstools,AC_HELP_STRING([--enable-crosstools],[Build cross-compiler toolchains if necessary (default=no).]),crosstools="$enableval",crosstools="no")
617 if test "$crosstools" != "" -a "$crosstools" != "no"; then
618     AC_MSG_RESULT(yes)
619         aros_crosstools="yes"
620 else
621     AC_MSG_RESULT(no)
624 #-----------------------------------------------------------------------------
625 #   Checking for distcc and ccache.
627 #   Always apply the transforms in this particular order. Basically you should
628 #   always run 'ccache distcc compiler' in that order for the best performance.
630 AC_MSG_CHECKING([whether to enable distcc])
631 AC_ARG_ENABLE(distcc,AC_HELP_STRING([--enable-distcc],[Use distcc as a front end to the compiler (default=no).]),distcc="$enableval",distcc="no")
632 if test "$distcc" != "" -a "$distcc" != "no"; then
633     # AC_CHECK_PROG will print out the result in this case
634     AC_PATH_PROG(DISTCC,[distcc],distcc,)
635 else
636     AC_MSG_RESULT(no)
639 AC_MSG_CHECKING([whether to enable ccache])
640 AC_ARG_ENABLE(ccache,AC_HELP_STRING([--enable-ccache],[Use ccache as a front end to the compiler (default=no).]),ccache="$enableval",ccache="no")
641 if test "$ccache" != "" -a "$ccache" != "no"; then
642     # AC_CHECK_PROG will print out the result in this case
643     AC_CHECK_PROG(CCACHE,[ccache],ccache,)
644 else
645     AC_MSG_RESULT(no)
648 #-----------------------------------------------------------------------------
649 AC_MSG_CHECKING([what specific gcc version to use])
650 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")
651 AC_MSG_RESULT($target_tool_version)
653 #-----------------------------------------------------------------------------
654 AC_MSG_CHECKING([what optimization flags to use])
655 AC_ARG_WITH(optimization,AC_HELP_STRING([--with-optimization=FLAGS],[Use optimization flags FLAGS (default=-O2).]),optimization="$withval",optimization="unknown")
656 if test "$optimization" = "unknown"; then
657     dnl default is -O2 for normal builds, -O0 for debug builds
658     if test "$debug" != "none"; then
659         optimization="-O0"
660     else
661         optimization="-O2"
662     fi
664 aros_config_cflags="$aros_config_cflags $optimization"
665 AC_MSG_RESULT($optimization)
667 #-----------------------------------------------------------------------------
668 AC_MSG_CHECKING([what paranoia flags to use])
669 AC_ARG_WITH(paranoia,AC_HELP_STRING([--with-paranoia=FLAGS],[CC flags to enable paranoia]),[paranoia_flags="$withval"],[paranoia_flags="default"])
670 if test "$paranoia_flags" = "default"; then
671         paranoia_flags=""
672 else if test "$paranoia_flags" = "yes"; then
673         paranoia_flags="-Wall -Werror"
674 fi fi
675 AC_MSG_RESULT($paranoia_flags)
676 aros_paranoia_cflags="$paranoia_flags"
678 #-----------------------------------------------------------------------------
679 AC_MSG_CHECKING([what target variant to enable])
680 AC_ARG_ENABLE(target_variant,AC_HELP_STRING([--enable-target-variant=NAME],[Enable a specific target variant(default=none)]),target_variant=$enableval,target_variant="")
681 if test "$target_variant" = ""; then
682     aros_target_variant=""
683     aros_target_suffix=""
684     enableval="none"
685 else
686     aros_target_variant="$target_variant"
687     aros_target_suffix="-$target_variant"
689 AC_MSG_RESULT($enableval)
691 target_bootloader="none"
693 #-----------------------------------------------------------------------------
694 if test "$aros_target_variant" = "ios"; then
696 AC_MSG_CHECKING([XCode path])
697 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")
698 AC_MSG_RESULT($aros_xcode_path)
700 AC_MSG_CHECKING([for minimum supported iOS version])
701 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")
702 AC_MSG_RESULT($aros_ios_version)
704 AC_MSG_CHECKING([what iOS SDK version to use])
705 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")
706 AC_MSG_RESULT($aros_ios_sdk)
710 #-----------------------------------------------------------------------------
711 # This is the target configuration switch.
712 case "$target_os" in
713     linux*)
714         aros_target_arch="linux"
715         aros_target_family="unix"
716         case "$target_cpu" in
717             *m68k*)
718                 aros_target_cpu="m68k"
719                 aros_object_format="m68kelf"
720                 aros_flavour="emulcompat"
721                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D__mc68000 -D__linux__"
722                 aros_shared_ldflags="-Wl,-T,\$(TOP)/config/linux/m68k/script.so"
723                 aros_kernel_ldflags="-Wl,-rpath,./lib,-T,\$(TOP)/config/linux/m68k/script.normal"
724                 gcc_target_cpu="mc68000"
725                 ;;
726             *i?86*)
727                 aros_target_cpu="i386"
728                 aros_object_format="elf_i386"
729                 aros_flavour="emulation"
730                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__linux__"
731                 aros_config_cflags="$aros_config_cflags -m32 -march=i486"
732                 aros_kernel_cflags="$aros_kernel_cflags -m32 -march=i486"
733                 aros_config_aflags="$aros_config_aflags -m32 -march=i486"
734                 aros_config_ldflags="-m32 -march=i486"
735                 aros_kernel_ldflags="-melf_i386"
736                 aros_default_wbdepth=8
737                 gcc_target_cpu="i386"
738                 pci_hidd_target="hidd-pci-linux"
739                 ;;
740             *x86_64*)
741                 aros_target_cpu="x86_64"
742                 aros_object_format="elf_x86_64"
743                 aros_flavour="emulation"
744                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64 -D__linux__"
745                 aros_config_cflags="$aros_config_cflags -mno-red-zone"
746                 aros_default_wbdepth=8
747                 gcc_target_cpu="x86_64"
748                 pci_hidd_target="hidd-pci-linux"
749                 ;;
750             *powerpc*)
751                 aros_target_cpu="ppc"
752                 aros_object_format="elf32ppc"
753                 aros_flavour="emulation"
754                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc -D__linux__"
755                 aros_default_wbdepth=8
756                 gcc_target_cpu="ppc"
757                 ;;
758 # TODO
759 # Same as powerpc, but I need this for the nightly build to work again.
760 # Actually, the nightly should be made working with powerpc target.
761 # That just was too much work for the moment, another week or two.
762             *ppc*)
763                 aros_target_cpu="ppc"
764                 aros_object_format="elf32ppc"
765                 aros_flavour="emulation"
766                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc -D__linux__"
767                 aros_default_wbdepth=8
768                 gcc_target_cpu="ppc"
769                 ;;
770             *arm*)
771                 aros_target_cpu="arm"
772                 aros_object_format="armelf_linux_eabi"
773                 aros_flavour="emulation"
774                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm -D__linux__"
775                 gcc_target_cpu="arm"
776                 aros_config_cflags="$aros_config_cflags -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -fno-asynchronous-unwind-tables -fno-exceptions"
777                 aros_config_aflags="$aros_config_aflags -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -fno-asynchronous-unwind-tables -fno-exceptions"
778                 aros_arch_libs="-laeabi"
779                 ;;
780             *)
781                 AC_MSG_ERROR("Unknown CPU for Linux -- $target_cpu")
782                 ;;
783         esac
784     ;;
786     pc)
787         aros_target_arch="pc"
788         aros_shared_default="no"
789         target_bootloader="grub2"
790         case "$target_cpu" in
791             *i?86*)
792                 aros_target_cpu="i386"
794                 dnl If somebody hasn't already set the target object
795                 dnl format, then use this value. Mostly to support
796                 dnl FreeBSD cross-compilation.
797                 dnl TODO: Remove when we always use our compiler.
799                 if test "$aros_object_format" = "" ; then
800                     aros_object_format="elf_i386"
801                 fi
802                 aros_flavour="standalone"
803                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
804                 aros_config_cflags="$aros_config_cflags -m32 -march=i486"
805                 aros_kernel_cflags="$aros_kernel_cflags -m32 -march=i486"
806                 aros_config_aflags="$aros_config_aflags -m32 -march=i486"
807                 aros_config_ldflags="-m32 -march=i486"
808                 aros_kernel_ldflags="-melf_i386"
809                 aros_default_wbwidth=640
810                 aros_default_wbheight=480
811                 gcc_target_cpu="i386"
812                 ;;
813             *x86_64*)
814                 aros_target_cpu="x86_64"
815                 aros_serial_debug=1
816                 if test "$aros_object_format" = "" ; then
817                     aros_object_format="elf_x86_64"
818                 fi
819                 aros_flavour="standalone"
820                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
821                 aros_config_cflags="$aros_config_cflags -fno-asynchronous-unwind-tables -mno-red-zone"
822                 aros_kernel_ldflags=""
823                 aros_default_wbwidth=640
824                 aros_default_wbheight=480
825                 gcc_target_cpu="x86_64"
826                 ;;
827             *)
828                 AC_MSG_ERROR("Unknown native CPU -- $target_cpu")
829                 ;;
830         esac
831         ;;
833     prep)
834         aros_target_arch="prep"
835         aros_shared_default="no"
836         aros_target_cpu="ppc"
837         aros_object_format="elf32ppc"
838         aros_flavour="ppcnative"
839         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
840         aros_kernel_ldflags=""
841         aros_default_wbwidth=640
842         aros_default_wbheight=480
843         gcc_target_cpu="ppc"
844         ;;
846     freebsd*)
847         aros_target_arch="freebsd"
848         aros_target_family="unix"
849         aros_target_cpu="i386"
850         aros_flavour="emulation"
851         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
852         gcc_target_cpu="i386"
854         aros_target_strip_flags="-x"
855         ;;
857     darwin*)
858         aros_target_arch="darwin"
859         aros_target_family="unix"
860         aros_flavour="emulation"
861         case "$target_cpu" in
862             *i?86*)
863                 aros_ios_platform="iPhoneSimulator"
864                 aros_target_cpu="i386"
865                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
866                 aros_default_wbdepth=8
867                 gcc_target_cpu="i386"
868                 aros_object_format="elf_i386"
869                 aros_target_strip_flags="-x"
870                 aros_target_cc="i386-aros-gcc"
871                 aros_target_cxx="i386-aros-g++"
872                 aros_target_ld="i386-aros-ld"
873                 aros_target_as="i386-aros-as"
874                 aros_target_ar="i386-aros-ar"
875                 aros_target_ranlib="i386-aros-ranlib"
876                 aros_target_nm="i386-aros-nm"
877                 aros_target_strip="i386-aros-strip"
878                 aros_target_objcopy="i386-aros-objcopy"
879                 aros_target_objdump="i386-aros-objdump"
880                 target_tool_prefix="i686-apple-darwin10-"
881                 target_tool_flags="-m32"
882                 ;;
883             *x86_64*)
884                 aros_target_cpu="x86_64"
885                 aros_object_format="elf_x86_64"
886                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
887                 aros_kernel_cflags="$aros_kernel_cflags -m64"
888                 aros_kernel_ldflags="$aros_kernel_ldflags -m64"
889                 aros_default_wbdepth=8
890                 gcc_target_cpu="x86_64"
891                 aros_target_cc="x86_64-aros-gcc"
892                 aros_target_cxx="x86_64-aros-g++"
893                 aros_target_ld="x86_64-aros-ld"
894                 aros_target_as="x86_64-aros-as"
895                 aros_target_ar="x86_64-aros-ar"
896                 aros_target_ranlib="x86_64-aros-ranlib"
897                 aros_target_nm="x86_64-aros-nm"
898                 aros_target_strip="x86_64-aros-strip"
899                 aros_target_objcopy="x86_64-aros-objcopy"
900                 aros_target_objdump="x86_64-aros-objdump"
901                 target_tool_prefix="i686-apple-darwin10-"
902                 ;;
903             *ppc*)
904                 aros_target_cpu="ppc"
905                 aros_object_format="elf32_ppc"
906                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
907                 aros_default_wbdepth=8
908                 gcc_target_cpu="ppc"
909                 aros_target_cc="ppc-aros-gcc"
910                 aros_target_cxx="ppc-aros-g++"
911                 aros_target_ld="ppc-aros-ld"
912                 aros_target_as="ppc-aros-as"
913                 aros_target_ar="ppc-aros-ar"
914                 aros_target_ranlib="ppc-aros-ranlib"
915                 aros_target_nm="ppc-aros-nm"
916                 aros_target_strip="ppc-aros-strip"
917                 aros_target_objcopy="ppc-aros-objcopy"
918                 aros_target_objdump="ppc-aros-objdump"
919                 target_tool_prefix="powerpc-apple-darwin10-"
920                 ;;
921             *arm*)
922                 aros_ios_platform="iPhoneOS"
923                 aros_target_cpu="arm"
924                 aros_object_format="armelf_linux_eabi"
925                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
926                 aros_config_cflags="$aros_config_cflags -march=armv6 -mfpu=neon -mfloat-abi=softfp -fno-asynchronous-unwind-tables -fno-exceptions"
927                 aros_config_aflags="$aros_config_aflags -march=armv6 -mfpu=neon -mfloat-abi=softfp -fno-asynchronous-unwind-tables -fno-exceptions"
928                 aros_arch_libs="-laeabi"
929                 aros_default_wbdepth=8
930                 gcc_target_cpu="arm"
931                 aros_kernel_ld="ld -arch armv6"
932                 aros_target_cc="arm-aros-gcc"
933                 aros_target_cxx="arm-aros-g++"
934                 aros_target_ld="arm-aros-ld"
935                 aros_target_as="arm-aros-as"
936                 aros_target_ar="arm-aros-ar"
937                 aros_target_ranlib="arm-aros-ranlib"
938                 aros_target_nm="arm-aros-nm"
939                 aros_target_strip="arm-aros-strip"
940                 aros_target_objcopy="arm-aros-objcopy"
941                 aros_target_objdump="arm-aros-objdump"
942                 target_tool_prefix="arm-apple-darwin10-" 
943                 export PATH="$aros_xcode_path/Platforms/$aros_ios_platform.platform/Developer/usr/bin:$PATH"
944                 ;;
945             *)
946                 AC_MSG_ERROR("Unsupported target CPU for darwin hosted flavour -- $target_cpu")
947                 ;;
948         esac
949         case "$aros_target_variant" in
950             ios)
951                 aros_default_wbwidth=320
952                 aros_default_wbheight=480
953                 aros_ios_sdk="$aros_xcode_path/Platforms/$aros_ios_platform.platform/Developer/SDKs/$aros_ios_platform$aros_ios_sdk.sdk"
954                 target_tool_flags="$target_tool_flags --sysroot $aros_ios_sdk"
955                 aros_kernel_includes="-isystem $aros_ios_sdk/usr/include"
956                 need_x11=no
957                 # This is here because it may depend on iOS or SDK version
958                 aros_kernel_objcflags="-fobjc-abi-version=2 -fobjc-legacy-dispatch"
959             ;;
960         esac
961         ;;
963     dragonfly*)
964         aros_target_arch="dragonfly"
965         aros_target_family="unix"
966         aros_flavour="emulation"
967         case "$target_cpu" in
968             *i?86*)
969                 aros_target_cpu="i386"
970                 aros_object_format="elf_i386"
971                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__DragonFly__"
972                 ;;
973             *x86_64*)
974                 aros_target_cpu="x86_64"
975                 aros_object_format="elf_x86_64"
976                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64 -D__DragonFly__"
977                 ;;
978             *)
979                 AC_MSG_ERROR("Unknown CPU for DragonFly -- $target_cpu")
980                 ;;
981         esac
982         ;;
984     netbsd*)
985         aros_target_arch="netbsd"
986         aros_target_family="unix"
987         case "$target_cpu" in
988             *m68k*)
989                 aros_target_cpu="m68k"
990                 aros_object_format="m68kelf"
991                 aros_flavour="emulcompat"
992                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D__mc68000 -D__NetBSD__"
993                 gcc_target_cpu="mc68000"
994                 ;;
995             *i?86*)
996                 aros_target_cpu="i386"
997                 aros_object_format="elf_i386"
998                 aros_flavour="emulation"
999                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__NetBSD__"
1000                 aros_default_wbdepth=8
1001                 gcc_target_cpu="i386"
1002                 ;;
1003             *)
1004                 AC_MSG_ERROR("Unknown CPU for NetBSD -- $target_cpu")
1005                 ;;
1006         esac
1007         aros_target_genmap="-Wl,-M -Xlinker >"
1008         aros_flavour="emulation"
1009         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1010         ;;   
1012     openbsd*)
1013         aros_target_arch="openbsd"
1014         aros_target_family="unix"
1015         case "$target_cpu" in
1016             *i?86*)
1017                 aros_target_cpu="i386"
1018                 aros_object_format="elf_i386"
1019                 aros_flavour="emulation"
1020                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__OpenBSD__"
1021                 gcc_target_cpu="i386"
1022                 ;;
1023             *)
1024                 AC_MSG_ERROR("Unknown CPU for OpenBSD -- $target_cpu")
1025                 ;;
1026         esac
1027         aros_target_genmap="-Wl,-M -Xlinker >"
1028         aros_target_nm_flags="-u"
1029         aros_flavour="emulation"
1030         ;;
1032     solaris*)
1033         aros_target_arch="solaris"
1034         aros_target_family="unix"
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 -fno-strict-aliasing"
1095         aros_config_aflags="$aros_config_aflags -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -fno-asynchronous-unwind-tables -fno-exceptions -fno-strict-aliasing"
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 -Wno-volatile-register-var -DAROS_CREATE_ROM"
1141                 aros_config_aflags="$aros_config_aflags -g3 -${gcc_target_cpu}"
1142                 aros_paranoia_cflags="$aros_paranoia_cflags -Wno-volatile-register-var"
1143                 aros_debug_cflags="-Wall -Werror-implicit-function-declaration $aros_symbols_debug  $aros_messages_debug -${gcc_target_cpu}"
1144                 target_tool_prefix="m68k-elf-"
1145                 aros_target_nostdlib_ldflags="" # We always need -lgcc
1146                 aros_target_strip_flags="-R.comment"
1147                 ;;
1148             *ppc*)
1149                 aros_cpu="ppc"
1150                 aros_flavour="native"
1151                 gcc_target_cpu="ppc"
1152                 ;;
1153             *)
1154                 AC_MSG_ERROR("Unknown CPU for Amiga $target_cpu")
1155                 ;;
1156         esac
1157         ;;
1159     mingw*)
1160         aros_target_arch="mingw32"
1161         aros_shared_default="no"
1162         aros_flavour="emulation"
1163         aros_shared_cflags=""
1164         need_dlopen="no"
1165         rescomp="windres"
1166         case "$target_cpu" in
1167             *i?86*)
1168                 aros_target_cpu="i386"
1169                 aros_object_format="elf_i386"
1170                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1171                 aros_default_wbdepth=8
1172                 gcc_target_cpu="i386"
1173                 aros_target_cc="i386-aros-gcc"
1174                 aros_target_cxx="i386-aros-g++"
1175                 aros_target_ld="i386-aros-ld"
1176                 aros_target_as="i386-aros-as"
1177                 aros_target_ar="i386-aros-ar"
1178                 aros_target_ranlib="i386-aros-ranlib"
1179                 aros_target_nm="i386-aros-nm"
1180                 aros_target_strip="i386-aros-strip"
1181                 aros_target_objcopy="i386-aros-objcopy"
1182                 aros_target_objdump="i386-aros-objdump"
1183                 target_tool_prefix="i386-mingw32-"
1184                 ;;
1185             *x86_64*)
1186                 aros_target_cpu="x86_64"
1187                 aros_object_format="elf_x86_64"
1188                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
1189                 aros_default_wbdepth=8
1190                 gcc_target_cpu="x86_64"
1191                 aros_target_cc="x86_64-aros-gcc"
1192                 aros_target_cxx="x86_64-aros-g++"
1193                 aros_target_ld="x86_64-aros-ld"
1194                 aros_target_as="x86_64-aros-as"
1195                 aros_target_ar="x86_64-aros-ar"
1196                 aros_target_ranlib="x86_64-aros-ranlib"
1197                 aros_target_nm="x86_64-aros-nm"
1198                 aros_target_strip="x86_64-aros-strip"
1199                 aros_target_objcopy="x86_64-aros-objcopy"
1200                 aros_target_objdump="x86_64-aros-objdump"
1201                 target_tool_prefix="x86_64-w64-mingw32-"
1202                 ;;
1203             *arm*)
1204                 aros_target_cpu="arm"
1205                 aros_object_format="armelf_linux_eabi"
1206                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
1207                 aros_arch_libs="-laeabi"
1208                 aros_default_wbdepth=8
1209                 gcc_target_cpu="arm"
1210                 aros_target_cc="arm-aros-gcc"
1211                 aros_target_cxx="arm-aros-g++"
1212                 aros_target_ld="arm-aros-ld"
1213                 aros_target_as="arm-aros-as"
1214                 aros_target_ar="arm-aros-ar"
1215                 aros_target_ranlib="arm-aros-ranlib"
1216                 aros_target_nm="arm-aros-nm"
1217                 aros_target_strip="arm-aros-strip"
1218                 aros_target_objcopy="arm-aros-objcopy"
1219                 aros_target_objdump="arm-aros-objdump"
1220                 target_tool_prefix="arm-mingw32ce-"
1221                 aros_default_wbwidth=160
1222                 aros_default_wbheight=160
1223                 ;;
1224             *)
1225                 AC_MSG_ERROR("Unknown CPU for Mingw32 -- $target_cpu")
1226                 ;;
1227         esac
1228         if test $host_os = "cygwin"; then
1229                 aros_kernel_cflags="-mno-cygwin"
1230         fi
1231     ;;
1232     pp*)
1233         aros_target_arch="pp"
1234         aros_shared_default="no"
1235         case "$target_cpu" in
1236             *m68k*)
1237                 aros_target_cpu="m68k"
1238                 aros_object_format="m68kelf"
1239                 aros_flavour="palmnative"
1240                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
1241                 aros_default_wbwidth=160
1242                 aros_default_wbheight=160
1243                 aros_default_wbdepth=1
1244                 aros_target_ar_flags="cru"
1245                 aros_compiler_libs="-lgcc1"
1246                 aros_shared_default=no
1247                 aros_shared_cflags="-fpic"
1248                 aros_shared_aflags=""
1249                 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
1250                 aros_kernel_ldflags="-Wl,-rpath,./lib"
1251                 aros_debug_cflags="-Wall -Werror-implicit-function-declaration $aros_symbols_debug  $aros_messages_debug -mc68000 -Wa,-mc68000"
1252                 aros_debug_aflags=""
1253                 aros_debug_ldflags="$aros_symbols_debug"
1254                 aros_mungwall_debug="0"
1255                 aros_modules_debug="0"
1256                 gcc_target_cpu="mc68000"
1257                 ignore_undefined_symbols="-ius"
1258                 ;;
1259            *)
1260                 AC_MSG_ERROR("Unknown CPU for PalmPilot -- $target_cpu")
1261                 ;;
1262         esac
1263         ;;
1265     mac*)
1266         aros_target_arch="mac"
1267         aros_shared_default="no"
1268         case "$target_cpu" in
1269             *m68k*)
1270                 aros_target_cpu="m68k"
1271                 aros_object_format="m68kelf"
1272                 aros_flavour="mac68knative"
1273                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
1274                 aros_default_wbwidth=512
1275                 aros_default_wbheight=384
1276                 aros_default_wbdepth=8
1277                 aros_target_ar_flags="cru"
1278                 aros_compiler_libs="-lgcc1"
1279                 aros_shared_default=no
1280                 aros_shared_cflags="-fpic"
1281                 aros_shared_aflags=""
1282                 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
1283                 aros_kernel_ldflags="-Wl,-rpath,./lib"
1284                 aros_debug_cflags="-Wall -Werror-implicit-function-declaration $aros_symbols_debug  $aros_messages_debug -mc68000"
1285                 aros_debug_aflags=""
1286                 aros_debug_ldflags="$aros_symbols_debug"
1287                 aros_mungwall_debug="0"
1288                 aros_modules_debug="0"
1289                 gcc_target_cpu="mc68000"
1290                 ignore_undefined_symbols="-ius"
1291                 ;;
1292            *)
1293                 AC_MSG_ERROR("Unknown CPU for Mac68k -- $target_cpu")
1294                 ;;
1295         esac
1296         ;;
1298     *)
1299         AC_MSG_ERROR([Unsupported target architecture $target])
1300         ;;
1301 esac
1303 if test "$aros_kernel_includes" = ""; then
1304     if test "x-$aros_flavour" = "x-emulation" -o "x-$aros_flavour" = "x-emulcompat" ; then
1305         # FIXME: for cross-compiling this should point to another location
1306         aros_kernel_includes="-isystem /usr/include"
1307     fi
1310 AC_MSG_CHECKING([Where to download sourcecode for external ports])
1311 AC_ARG_WITH(portssources,AC_HELP_STRING([--with-portssources=DIR],[Where to download sourcecode for external ports]),with_portssrcdir=$withval,with_portssrcdir="default")
1312 if test "$with_portssrcdir" = "default"; then
1313     AROS_PORTSSRCDIR="$AROS_BUILDDIR_UNIX/bin/Sources"
1314 else
1315     AROS_PORTSSRCDIR="$with_portssrcdir"
1317 AC_MSG_RESULT($AROS_PORTSSRCDIR)
1319 AC_MSG_CHECKING([which bootloader to use])
1320 AC_ARG_WITH(bootloader,AC_HELP_STRING([--with-bootloader=NAME],[Use a specific bootloader]),target_bootloader=$withval,target_bootloader=$target_bootloader)
1321 if test "$target_bootloader" = "none"; then
1322     aros_target_bootloader=""
1323 else
1324     aros_target_bootloader="$target_bootloader"
1326 AC_MSG_RESULT($target_bootloader)
1328 AC_MSG_CHECKING([which icon-set to use])
1329 AC_ARG_WITH(iconset,AC_HELP_STRING([--with-iconset=NAME],[Use a specific Icon-set (default=Gorilla).]),target_iconset=$withval,target_iconset="default")
1330 if test "$target_iconset" = "default"; then
1331     aros_target_iconset="Gorilla"
1332     target_iconset="default (Gorilla)"
1333 else
1334     aros_target_iconset="$target_iconset"
1336 AC_MSG_RESULT($target_iconset)
1338 AC_MSG_CHECKING([which GUI Theme to use])
1339 AC_ARG_WITH(theme,AC_HELP_STRING([--with-theme=NAME],[Use a specific GUI Theme]),target_guitheme=$withval,target_guitheme="default")
1340 if test "$target_guitheme" = "default"; then
1341     aros_target_guitheme="Ice"
1342 else
1343     aros_target_guitheme="$target_guitheme"
1345 AC_MSG_RESULT($aros_target_guitheme)
1347 # Find out if we are cross-compiling (i.e. if we can't use the host compiler
1348 # for target code)
1349 cross_compiling=no
1350 if test "$aros_host_cpu" != "$aros_target_cpu" ; then
1351     cross_compiling=yes
1353 if test "$aros_host_cpu" == "x86_64" ; then
1354     if test "$aros_target_cpu" == "i386" ; then
1355         if test "$aros_target_arch" != "mingw32"; then
1356             cross_compiling=no
1357         fi
1358     fi
1360 if test "$aros_host_arch" == "darwin" ; then
1361     if test "$aros_target_arch" != "darwin" ; then
1362         cross_compiling=yes
1363     fi
1366 # Set prefix for target compiler etc. if we're cross-compiling
1367 # (should possibly be earlier but needs to be after AC_PROG_CC)
1368 if test "$cross_compiling" = "yes" ; then
1369     if test "$target_tool_prefix" = ""; then
1370         target_tool_prefix=${target_cpu}-elf-
1371     fi
1372     CC=${target_tool_prefix}gcc
1373     dnl CPP is needed for AC_CHECK_HEADER to work correctly
1374     CPP=${target_tool_prefix}cpp
1375     if test "$target_tool_version" != "default"; then
1376         CC="$CC-$target_tool_version"
1377         CPP="$CC-$target_tool_version"
1378     fi
1379     AC_PATH_PROG(CC,$CC)
1380     AROS_REQUIRED(gcc,$CC)
1382 CC="$CC $target_tool_flags"
1384 #-----------------------------------------------------------------------------
1386 # Disable pointer-signedness warnings if the compiler recognises the option
1388 AC_MSG_CHECKING([whether ${CC} accepts -Wno-pointer-sign])
1389 save_cflags="$CFLAGS"
1390 CFLAGS="$CFLAGS -Wno-pointer-sign"
1391 AC_TRY_COMPILE(,, use_no_sign_warning="yes", use_no_sign_warning="no")
1392 AC_MSG_RESULT($use_no_sign_warning)
1393 if test "x-$use_no_sign_warning" = "x-yes" ; then
1394     aros_config_cflags="$aros_config_cflags -Wno-pointer-sign"
1396 CFLAGS="$save_cflags"
1398 #-----------------------------------------------------------------------------
1400 # Find all the tools we need to compile. This could be cross-compiling
1401 # though! If that is the case we use the GNU form of the target and
1402 # simply add this to the front of the binary name. This is rather simple,
1403 # but it should work under most circumstances.
1405 # The default tools are to use the same as the host, but only if the
1406 # host and target CPU are the same. With GCC this is normally enough.
1409 aros_cc_pre=""
1410 aros_shared_ld="$aros_host_ld"
1412 aros_target_mkdep="$aros_host_mkdep"
1413 aros_target_incl_def="$aros_host_incl"
1415 aros_kernel_cc="$CC"
1417 # The default tools executables to be linked to.
1418 if test "$aros_target_cc" != ""; then
1419     AC_PATH_PROG(aros_target_cc,$aros_target_cc)
1420     AROS_REQUIRED(gcc,$aros_target_cc)
1422 if test "$aros_target_ld" != ""; then
1423     AC_PATH_PROG(aros_target_ld,$aros_target_ld)
1424     AROS_REQUIRED(ld,$aros_target_ld)
1427 if test "$crosstools" != "yes"; then
1428     AROS_TOOL_TARGET(aros_target_as_ln,as,$aros_target_as)
1429     AROS_REQUIRED(as,$aros_target_as_ln)
1430     AROS_TOOL_TARGET(aros_kernel_ld,ld,$aros_kernel_ld)
1431     AROS_REQUIRED(ld,$aros_kernel_ld)
1432     AROS_TOOL_TARGET(aros_target_ar_ln,ar,$aros_target_ar)
1433     AROS_REQUIRED(ar,$aros_target_ar_ln)
1434     AROS_TOOL_TARGET(aros_target_nm_ln,nm,$aros_target_nm)
1435     AROS_REQUIRED(nm,$aros_target_nm_ln)
1436     AROS_TOOL_TARGET(aros_target_objcopy_ln,objcopy,$aros_target_objcopy)
1437     AROS_REQUIRED(objcopy,$aros_target_objcopy_ln)
1438     AROS_TOOL_TARGET(aros_target_objdump_ln,objdump,$aros_target_objdump)
1439     AROS_REQUIRED(objdump,$aros_target_objdump_ln)
1440     AROS_TOOL_TARGET(aros_target_ranlib_ln,ranlib,$aros_target_ranlib)
1441     AROS_REQUIRED(ranlib,$aros_target_ranlib_ln)
1442     AROS_TOOL_TARGET(aros_target_strip_ln,strip,$aros_target_strip)
1443     AROS_REQUIRED(strip,$aros_target_strip_ln)
1444     if test "$aros_target_cxx" != ""; then
1445         AC_PATH_PROG(aros_target_cxx,$aros_target_cxx)
1446 # Temporarily disabled in order to let Mingw32-hosted nightly build to work
1447 #       AROS_REQUIRED(c++,$aros_target_cxx)
1448     fi
1449 else
1450 # Cancel preinstalled C++ compiler because it will be built as part of crosstools
1451     aros_target_cxx=""
1454 # Build crosstools if we have no C++ - temporary thing 
1455 if test "$aros_target_cxx" = ""; then
1456     crosstools_target=tools-crosstools
1459 if test "$rescomp" != ""; then
1460     if test "$cross_compiling" = "yes" ; then
1461         rescomp=${target_tool_prefix}${rescomp}
1462     fi
1463     AC_PATH_PROG(aros_kernel_rescomp,$rescomp)
1464     AROS_REQUIRED($rescomp,$aros_kernel_rescomp)
1467 aros_hostcfg_dir="bin/${aros_host_arch}-${aros_host_cpu}/gen/config"
1468 aros_targetcfg_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/config"
1469 aros_inc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/AROS/Development/include/aros"
1470 aros_gendir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen"
1471 aros_geninc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/include/aros"
1472 aros_tools_dir="bin/${aros_host_arch}-${aros_host_cpu}/tools"
1473 aros_scripts_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/scripts"
1475 # aros_cc_pre is a variable that is added to the front of the compiler name
1476 # in the generated aros-gcc shell script. We need this to enable the cache
1477 # to work across cleaned builds. Also, support DISTCC using the correct
1478 # environment variable.
1481 if test "x${DISTCC}" != "x" ; then
1482     if test "x${CCACHE}" != "x" ; then
1483         aros_cc_pre="env CCACHE_PREFIX=${DISTCC} ${CCACHE} "
1484     else
1485         aros_cc_pre="${DISTCC} "
1486     fi
1487 else
1488     if test "x${CCACHE}" != "x" ; then
1489         aros_cc_pre="${CCACHE} "
1490     fi
1493 prefix="${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros"
1495 AC_SUBST(aros_target_nostdinc_cflags,-nostdinc)
1496 AC_SUBST(aros_target_nostartup_ldflags,-nostartfiles)
1497 AC_SUBST(aros_target_nix_ldflags,-nix)
1498 AC_SUBST(aros_target_detach_ldflags,-detach)
1499 AC_SUBST(aros_target_nostdlib_ldflags,-nostdlib)
1501 # Target tools
1502 if test "$aros_target_cc" = ""; then
1503     orig_target_cc=$aros_kernel_cc
1504 else
1505     orig_target_cc=$aros_target_cc
1507 if test "$aros_target_ld" = ""; then
1508     orig_target_ld=$aros_kernel_ld
1509 else
1510     orig_target_ld=$aros_target_ld
1512 if test "$GCC" = "yes"; then
1513     aros_target_cc_path=`$orig_target_cc -print-search-dirs | grep "programs: =" | cut -c 12-`
1515 aros_target_cc="${prefix}-gcc"
1516 aros_target_as="${prefix}-as"
1517 aros_target_ld="${prefix}-ld"
1518 aros_target_ar="${prefix}-ar $aros_target_ar_flags"
1519 aros_target_objcopy=${prefix}-objcopy
1520 aros_target_objdump=${prefix}-objdump
1521 aros_target_ranlib="${prefix}-ranlib $aros_target_ranlib_flags"
1522 aros_target_nm="${prefix}-nm $aros_target_nm_flags"
1523 aros_kernel_nm="${prefix}-nm"
1524 aros_target_strip=${prefix}-strip
1526 # Find the system include path. We can suggest that an alternative is
1527 # used if we don't get it correct. The default is to use /usr/include.
1528 # Which is set in the aros_target_incl_def variable.
1530 AC_ARG_ENABLE(includes,
1531 AC_HELP_STRING([--enable-includes=dir],[Alternative system include directory]),
1532 [aros_target_incl=$enable_includes], [aros_target_incl=$aros_target_incl_def])
1534 if test "$aros_kernel_includes" != "" ; then
1535     dnl find out about the kernel cc's include path
1536     AC_MSG_CHECKING([for the kernel compiler's include path])
1537     if test "$aros_kernel_cc_includes" = "" ; then
1538         # Try to guess where the directory is.
1539         aros_kernel_cc_includes=`dirname \`${aros_kernel_cc} ${aros_kernel_cflags} -print-libgcc-file-name\``/include
1540         if ! test -d $aros_kernel_cc_includes; then
1541             # The directory doesn't exist, we need to do some more work.
1542             aros_kernel_cc_includes=${PWD}/${aros_gendir}/cc_include
1544             # These are the headers we're looking for.
1545             headers="limits.h mmintrin.h stdbool.h syslimits.h float.h \
1546                      stddef.h xmmintrin.h iso646.h stdarg.h unwind.h   \
1547                      zutil.h"
1549             dirs=
1550             for h in $headers; do
1551                 # Which other headers are needed by each of the above?
1552                 deps=$(echo "#include <$h>" | \
1553                        $aros_kernel_cc -E -M - 2>/dev/null | \
1554                        sed 's/^.*://; s/\\$/ /g; s/[[ \t]]\+/ /g')
1556                 # Copy all the needed headers to a directory beneath gendir.
1557                 for d in $deps; do
1558                     h=$(basename $d)
1559                     dir=${aros_kernel_cc_includes}$(echo $(dirname $d) | \
1560                                                 sed -n "s,^.*/include\(/.*\),\1,p")
1561                     ! test -d $dir && mkdir -p $dir
1562                     ! test -f $dir/$h && { cp $d $dir; chmod u+w $dir/$h; }
1563                 done
1564             done            
1565         fi
1566     fi
1567     AC_MSG_RESULT($aros_kernel_cc_includes)
1568     # Adding -nostdinc to kernel includes as they are always used together.
1569     aros_kernel_includes="$aros_kernel_includes $aros_target_nostdinc_cflags -isystem $aros_kernel_cc_includes"
1572 dnl find out about the target cc's include path
1573 AC_MSG_CHECKING([for the target compiler's include path])
1574 if test "$aros_target_cc_includes" = "" ; then
1575     #try to guess where the directory is
1576     aros_target_cc_includes=`dirname \`${orig_target_cc} -print-libgcc-file-name\``/include
1577     if ! test -d $aros_target_cc_includes; then
1578         #the directory doesn't exist, we need to do some more work
1579         aros_target_cc_includes=${PWD}/${aros_gendir}/cc_include
1580         
1581         #these are the headers we're looling for
1582         headers="limits.h mmintrin.h stdbool.h syslimits.h float.h \
1583                  stddef.h xmmintrin.h iso646.h stdarg.h unwind.h   \
1584                  zutil.h"
1586         dirs=
1587         for h in $headers; do
1588             #which other headers each of the above headers needs?
1589             deps=$(echo "#include <$h>" | \
1590                    $orig_target_cc -E -M - 2>/dev/null | \
1591                    sed 's/^.*://; s/\\$/ /g; s/[[ \t]]\+/ /g')
1592             
1593             #copy all the needed headers to a directory beneath gendir
1594             for d in $deps; do
1595                 h=$(basename $d)
1596                 dir=${aros_target_cc_includes}$(echo $(dirname $d) | \
1597                                                 sed -n "s,^.*/include\(/.*\),\1,p")
1598                 ! test -d $dir && mkdir -p $dir
1599                 ! test -f $dir/$h && { cp $d $dir; chmod u+w $dir/$h; }
1600             done
1601         done        
1602     fi
1604 AC_MSG_RESULT($aros_target_cc_includes)
1607 # For GCC < 4.0 -I- is used for giving the search path for '#include "..."'
1608 # On GCC >= 4.0 -iquote should be used
1611 save_cc="$CC"
1612 save_cflags="$CFLAGS"
1613 CFLAGS="-iquote."
1614 AC_MSG_CHECKING([whether ${CC} accepts -iquote])
1615 AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
1616 AC_MSG_RESULT($has_iquote)
1617 if test "x-$has_iquote" = "x-yes" ; then
1618     host_cflags_iquote=-iquote
1619     host_cflags_iquote_end=
1620 else
1621     host_cflags_iquote=-I
1622     host_cflags_iquote_end=-I-
1624 kernel_cflags_iquote=$host_cflags_iquote
1625 kernel_cflags_iquote_end=$host_cflags_iquote_end
1626 if test "x-$cross_compiling" = "x-yes"; then
1627     CC="$aros_kernel_cc"
1628     AC_MSG_CHECKING([whether ${CC} accepts -fno-stack-protector])
1629     AC_TRY_COMPILE(,, use_no_stack_protector="yes", use_no_stack_protector="no")
1630     AC_MSG_RESULT($use_no_stack_protector)
1631     AC_MSG_CHECKING([whether ${CC} accepts -iquote])
1632     AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
1633     AC_MSG_RESULT($has_iquote)
1634     if test "x-$has_iquote" = "x-yes" ; then
1635         kernel_cflags_iquote=-iquote
1636         kernel_cflags_iquote_end=
1637     else
1638         kernel_cflags_iquote=-I
1639         kernel_cflags_iquote_end=-I-
1640     fi
1642 aros_cflags_iquote=$kernel_cflags_iquote
1643 aros_cflags_iquote_end=$kernel_cflags_iquote_end
1644 if test "$orig_target_cc" != "$aros_kernel_cc"; then
1645     CC="$orig_target_cc"
1646     AC_MSG_CHECKING([whether ${CC} accepts -iquote])
1647     AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
1648     AC_MSG_RESULT($has_iquote)
1649     if test "x-$has_iquote" = "x-yes" ; then
1650         aros_cflags_iquote=-iquote
1651         aros_cflags_iquote_end=
1652     else
1653         aros_cflags_iquote=-I
1654         aros_cflags_iquote_end=-I-
1655     fi
1657 if test "x-$use_no_stack_protector" = "x-yes" ; then
1658     aros_kernel_cflags="$aros_kernel_cflags -fno-stack-protector"
1661 #-----------------------------------------------------------------------------
1663 # Check if we can explicitly choose older version of symbol hashing
1665 CFLAGS="save_cflags -Wl,--hash-style=sysv"
1666 CC="$aros_kernel_cc"
1667 AC_MSG_CHECKING([whether ${CC} accepts -Wl,--hash-style=sysv])
1668 AC_TRY_LINK(,, use_hash_style="yes", use_hash_style="no")
1669 AC_MSG_RESULT($use_hash_style)
1670 if test "x-$use_hash_style" = "x-yes" ; then
1671     aros_kernel_cflags="$aros_kernel_cflags -Wl,--hash-style=sysv"
1673 CC="$save_cc"
1674 CFLAGS="$save_cflags"
1676 AC_SUBST(host_cflags_iquote)
1677 AC_SUBST(host_cflags_iquote_end)
1678 AC_SUBST(kernel_cflags_iquote)
1679 AC_SUBST(kernel_cflags_iquote_end)
1680 AC_SUBST(aros_cflags_iquote)
1681 AC_SUBST(aros_cflags_iquote_end)
1684 dnl Check if user specified --with-resolution=XRESxYRESxDEPTH
1685 AC_MSG_CHECKING([for default resolution of WBScreen])
1686 AC_ARG_WITH(resolution,AC_HELP_STRING([--with-resolution=XRESxYRESxDEPTH],[Default resolution of the initial WorkbenchScreen]),resolution=$withval,resolution=none)
1687 # We require an argument, so map --with/--without ("yes"/"no") to "none" specified
1688 if test "$resolution" = "yes" ; then
1689     resolution="none"
1691 if test "$resolution" = "no" ; then
1692     resolution="none"
1694 if test "$resolution" != "none" ; then
1695     aros_default_wbwidth=`echo $resolution | cut -d'x' -f1`
1696     aros_default_wbheight=`echo $resolution | cut -d'x' -f2`
1697     aros_default_wbdepth=`echo $resolution | cut -d'x' -f3`
1699 AC_MSG_RESULT($aros_default_wbwidth x $aros_default_wbheight x $aros_default_wbdepth)
1700 aros_cv_default_wbwidth=$aros_default_wbwidth
1701 aros_cv_default_wbheight=$aros_default_wbheight
1702 aros_cv_default_wbdepth=$aros_default_wbdepth
1704 dnl See if the user wants the serial debug output for native flavour
1705 AC_MSG_CHECKING([if serial debug is enabled])
1706 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)
1707 if test "$aros_serial_debug" = 0 ; then
1708     serial_debug_forced=""
1709     if test "$serial_debug" = "yes" ; then
1710         serial_debug="2"
1711     fi
1712     if test "$serial_debug" = "no" ; then
1713         serial_debug="none"
1714     fi
1715 else
1716     serial_debug_forced="(forced)"
1717     serial_debug=$aros_serial_debug
1719 if test "$serial_debug" != "none" ; then
1720     aros_serial_debug=$serial_debug
1721     AC_MSG_RESULT($serial_debug_forced on port $serial_debug)
1722 else
1723     AC_MSG_RESULT(no)
1726 dnl See if the user wants the palm debug output hack for palm native flavour
1727 AC_MSG_CHECKING([if palm debug hack is enabled])
1728 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")
1729 if test "$palm_debug_hack" = "yes" ; then
1730     aros_palm_debug_hack="1"
1732 AC_MSG_RESULT($palm_debug_hack)
1735 dnl See if the user wants nesting supervisor activated for unix flavour
1736 AC_MSG_CHECKING([if nesting supervisor support is enabled])
1737 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")
1738 if test "$nesting_supervisor" = "yes" ; then
1739     aros_nesting_supervisor="1"
1741 AC_MSG_RESULT($nesting_supervisor)
1744 dnl things specifically required for hosted flavours
1745 if test "x-$aros_flavour" = "x-emulation" -o "x-$aros_flavour" = "x-emulcompat" ; then
1747     if test "x-$need_dlopen" != "x-no" ; then
1748       dnl some kind of dynamic library access system is required for hostlib.resource
1749       AC_CHECK_FUNC(dlopen, have_dl="yes", have_dl="no")
1750       if test "x-$have_dl" = "x-no" ; then
1751           AC_CHECK_LIB(dl, dlopen, [have_dl="yes"
1752                                     aros_host_ldflags="$aros_host_ldflags -ldl"],
1753                                     have_dl="no")
1754       fi
1755       if test "x-$have_dl" = "x-no" ; then
1756           AC_MSG_ERROR([dlopen() dynamic linker functions not available])
1757       fi
1758     fi
1761     dnl x11 hidd
1762     AC_ARG_ENABLE(x11_hidd, AC_HELP_STRING([--enable-x11-hidd],
1763                                            [build X11 hidd for hosted (default=auto)]),
1764                                            x11_hidd="$enableval",
1765                                            x11_hidd="$need_x11")
1766     case "x-$x11_hidd" in
1767         x-yes|x-no|x-auto)                 ;;
1768         *)                 x11_hidd="$need_x11" ;;
1769     esac
1771     ENABLE_X11=0
1773     dnl they want it
1774     if test "x-$x11_hidd" != "x-no" ; then
1776         dnl find x11 stuff
1777         AC_PATH_X
1779         x_cflags=
1780         for path in $x_libraries
1781         do
1782             x_cflags="$x_cflags -L$path"
1783         done
1785         for path in $x_includes
1786         do
1787             x_cflags="$x_cflags -I$path"
1788         done
1789         
1790         if test "x-$no_x" = "x-yes" ; then
1792             dnl didn't find it
1793             if test "x-$x11_hidd" != "x-auto" ; then
1794                 dnl and they explicitly asked for it, bail out
1795                 AC_MSG_ERROR([X11 libs/headers not found, cannot build X11 hidd as requested])
1796             fi
1797         
1798         else
1799             dnl found it, setup the metatarget
1800             x11_hidd_target=kernel-x11gfx-kobj
1801             ENABLE_X11=1
1803             dnl setup shared memory extensions
1804             AC_ARG_ENABLE(x11_shm, AC_HELP_STRING([--enable-x11-shm],
1805                                                   [use X11 shared memory (default=auto)]),
1806                                                   x11_hidd_shm="$enableval",
1807                                                   x11_hidd_shm="auto")
1808             case "x-$x11_hidd_shm" in
1809                 x-yes|x-no|x-auto)                     ;;
1810                 *)                 x11_hidd_shm="auto" ;;
1811             esac
1813             have_xshm=no
1815             dnl they want it
1816             if test "x-$x11_hidd_shm" != "x-no" ; then
1818                 dnl system shm headers
1819                 AC_CHECK_HEADERS(sys/ipc.h)
1820                 AC_CHECK_HEADERS(sys/shm.h)
1822                 dnl got them
1823                 if test "x-$ac_cv_header_sys_ipc_h" = "x-yes" -a "x-$ac_cv_header_sys_shm_h" = "x-yes" ; then
1825                     dnl make sure X libs have shm functions
1826                     save_cflags="$CFLAGS"
1827                     CFLAGS="$CFLAGS $x_cflags"
1828                     AC_CHECK_LIB(Xext, XShmQueryExtension, have_xshm=yes)
1829                     CFLAGS="$save_cflags"
1830                 fi
1831             fi
1833             dnl detection done, prepare output
1834             if test "x-$have_xshm" = "x-yes" ; then
1835                 dnl we can do shm
1836                 DO_XSHM_SUPPORT="1"
1837             elif test "x-$x11_hidd_shm" = "x-yes" ; then
1838                 dnl they explicitly asked for it, but we can't do it
1839                 AC_MSG_ERROR([X11 has no support for shared memory, cannot enable it as requested])
1840             else
1841                 dnl otherwise just disable it
1842                 DO_XSHM_SUPPORT="0"
1843             fi
1845             
1846             dnl setup vidmode (fullscreen) extensions
1847             AC_ARG_ENABLE(x11_vidmode, AC_HELP_STRING([--enable-x11-vidmode],
1848                                                       [use X11 vidmode extension (default=auto)]),
1849                                                       x11_hidd_vidmode="$enableval",
1850                                                       x11_hidd_vidmode="auto")
1851             case "x-$x11_hidd_vidmode" in
1852                 x-yes|x-no|x-auto)                         ;;
1853                 *)                 x11_hidd_vidmode="auto" ;;
1854             esac
1856             have_vidmode=no
1858             dnl they want it
1859             if test "x-$x11_hidd_vidmode" != "x-no" ; then
1861                 dnl make sure X libs have vidmode functions
1862                 save_cflags="$CFLAGS"
1863                 CFLAGS="$CFLAGS $x_cflags"
1864                 AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryExtension, have_vidmode=yes)
1865                 CFLAGS="$save_cflags"
1866             fi
1868             dnl detection done, prepare output
1869             if test "x-$have_vidmode" = "x-yes" ; then
1870                 dnl we can do vidmode
1871                 DO_VIDMODE_SUPPORT="1"
1872             elif test "x-$x11_hidd_vidmode" = "x-yes" ; then
1873                 dnl they explicitly asked for it, but we can't do it
1874                 AC_MSG_ERROR([X11 vidmode extension not available, cannot enable it as requested])
1875             else
1876                 dnl otherwise just disable it
1877                 DO_VIDMODE_SUPPORT="0"
1878             fi
1879         fi
1881         aros_host_x11_includes=$x_includes 
1882         aros_host_x11_libdirs=$x_libraries
1883     fi
1886     dnl sdl hidd
1887     AC_ARG_ENABLE(sdl_hidd, AC_HELP_STRING([--enable-sdl-hidd],
1888                                            [build SDL hidd for hosted (default=auto)]),
1889                                            sdl_hidd="$enableval",
1890                                            sdl_hidd="auto")
1891     case "x-$sdl_hidd" in
1892         x-yes|x-no|x-auto)                 ;;
1893         *)                 sdl_hidd="auto" ;;
1894     esac
1896     dnl they want it
1897     if test "x-$sdl_hidd" != "x-no" ; then
1899         dnl find sdl
1900         AM_PATH_SDL([1.2.10], have_sdl="yes", have_sdl="no")
1902         if test "x-$have_sdl" != "x-yes" ; then
1904             dnl didn't find it
1905             if test "x-$sdl_hidd" != "x-auto" ; then
1906                 dnl and they explicitly asked for it, bail out
1907                 AC_MSG_ERROR([SDL libs/headers not found, cannot build SDL hidd as requested])
1908             fi
1910         else
1911             dnl found it, set up the metatarget
1912             sdl_hidd_target=kernel-hidd-sdl
1913             aros_host_sdl_cflags=SDL_CFLAGS
1914             aros_host_sdl_libs=SDL_LIBS
1915         fi
1916     fi
1918     dnl oss.library
1919     AC_CHECK_HEADER(sys/soundcard.h)
1920     if test "x-$ac_cv_header_sys_soundcard_h" = "x-yes" ; then
1921         oss_library_target=workbench-libs-oss-unix
1922     fi
1926 dnl See if the user wants dbus.library
1927 AC_MSG_CHECKING([if building of dbus.library is enabled])
1928 AC_ARG_ENABLE(dbus,AC_HELP_STRING([--enable-dbus],[Enable DBUS support via dbus.library (default=no)]),dbus="yes",dbus="no")
1929 if test "$dbus" = "yes" ; then
1930     ENABLE_DBUS=1
1931     DBUS_CFLAGS=`pkg-config --cflags dbus-1`
1932     DBUS_LIBFLAGS=`pkg-config --libs dbus-1`
1933     KERNEL_DBUS_KOBJ=kernel-dbus-kobj
1934     KERNEL_DBUS_INCLUDES=kernel-dbus-includes
1935 else
1936     ENABLE_DBUS=0
1938 AC_MSG_RESULT($dbus)
1941 dnl --------------------------------------------------------------------
1942 dnl Configuration Output Section
1943 dnl --------------------------------------------------------------------
1945 # Generic
1946 AC_SUBST(aros_arch)
1947 AC_SUBST(aros_cpu)
1948 AC_SUBST(aros_flavour)
1949 AC_SUBST(aros_flavour_uc)
1950 AC_SUBST(AROS_BUILDDIR)
1951 AC_SUBST(AROS_BUILDDIR_UNIX)
1952 AC_SUBST(SRCDIR)
1953 AC_SUBST(AROS_PORTSSRCDIR)
1955 # Host related
1956 AC_SUBST(aros_cc_pre)
1957 AC_SUBST(aros_host_strip)
1958 AC_SUBST(aros_host_arch)
1959 AC_SUBST(aros_host_cpu)
1960 AC_SUBST(aros_host_cc)
1961 AC_SUBST(aros_host_ar)
1962 AC_SUBST(aros_host_ranlib)
1963 AC_SUBST(aros_host_ld)
1964 AC_SUBST(aros_host_make)
1965 AC_SUBST(aros_host_cflags)
1966 AC_SUBST(aros_host_ldflags)
1967 AC_SUBST(aros_host_debug)
1968 AC_SUBST(aros_host_mkdep)
1969 AC_SUBST(aros_host_mkargs)
1970 AC_SUBST(aros_host_exe_suffix)
1971 AC_SUBST(aros_host_lib_suffix)
1972 AC_SUBST(aros_tools_dir)
1973 AC_SUBST(aros_host_aclocal)
1974 AC_SUBST(aros_host_autoconf)
1975 AC_SUBST(aros_host_autoheader)
1976 AC_SUBST(aros_host_automake)
1978 # Target Related
1979 AC_SUBST(aros_target_guitheme)
1980 AC_SUBST(aros_target_iconset)
1981 AC_SUBST(aros_target_bootloader)
1982 AC_SUBST(aros_target_arch)
1983 AC_SUBST(aros_target_family)
1984 AC_SUBST(aros_target_cpu)
1985 AC_SUBST(aros_target_variant)
1986 AC_SUBST(aros_target_suffix)
1987 AC_SUBST(aros_target_incl)
1988 AC_SUBST(aros_target_ar)
1989 AC_SUBST(aros_target_ranlib)
1990 AC_SUBST(aros_kernel_nm)
1991 AC_SUBST(orig_target_cc)
1992 AC_SUBST(aros_target_cc)
1993 AC_SUBST(aros_target_cxx)
1994 AC_SUBST(aros_kernel_cc)
1995 AC_SUBST(aros_target_as)
1996 AC_SUBST(orig_target_ld)
1997 AC_SUBST(aros_target_ld)
1998 AC_SUBST(aros_kernel_ld)
1999 AC_SUBST(aros_target_cc_includes)
2000 AC_SUBST(aros_target_cc_path)
2001 AC_SUBST(aros_target_objdump)
2002 AC_SUBST(aros_target_objcopy)
2003 AC_SUBST(aros_target_strip)
2004 AC_SUBST(aros_target_nm)
2005 AC_SUBST(aros_kernel_rescomp)
2006 AC_SUBST(aros_shared_default)
2007 AC_SUBST(aros_shared_ld)
2008 AC_SUBST(aros_object_format)
2009 AC_SUBST(aros_compiler_libs)
2010 AC_SUBST(aros_arch_libs)
2012 AC_SUBST(aros_config_cflags)
2013 AC_SUBST(aros_config_aflags)
2014 AC_SUBST(aros_config_ldflags)
2016 AC_SUBST(aros_shared_cflags)
2017 AC_SUBST(aros_shared_aflags)
2018 AC_SUBST(aros_shared_ldflags)
2019 AC_SUBST(aros_kernel_cflags)
2020 AC_SUBST(aros_kernel_includes)
2021 AC_SUBST(aros_kernel_objcflags)
2022 AC_SUBST(aros_kernel_ldflags)
2023 AC_SUBST(aros_debug_cflags)
2024 AC_SUBST(aros_debug_aflags)
2025 AC_SUBST(aros_debug_ldflags)
2026 AC_SUBST(aros_paranoia_cflags)
2027 AC_SUBST(aros_target_genmap)
2028 AC_SUBST(aros_target_strip_flags)
2030 AC_SUBST(crosstools_target)
2032 # Graphics Related
2033 AC_SUBST(x11_hidd_target)
2034 AC_SUBST(sdl_hidd_target)
2035 AC_SUBST(pci_hidd_target)
2036 AC_SUBST(oss_library_target)
2038 AC_SUBST(aros_default_wbwidth)
2039 AC_SUBST(aros_default_wbheight)
2040 AC_SUBST(aros_default_wbdepth)
2041 AC_SUBST(DO_XSHM_SUPPORT)
2042 AC_SUBST(DO_VIDMODE_SUPPORT)
2044 AC_SUBST(aros_host_x11_includes)
2045 AC_SUBST(aros_host_x11_libdirs)
2046 AC_SUBST(aros_host_sdl_cflags)
2047 AC_SUBST(aros_host_sdl_libs)
2049 # Native version related
2050 AC_SUBST(aros_serial_debug)
2052 # Palm native version related
2053 AC_SUBST(aros_palm_debug_hack)
2055 # Unix/Hosted version related
2056 AC_SUBST(aros_nesting_supervisor)
2058 # Apple iOS related
2059 AC_SUBST(aros_ios_platform)
2060 AC_SUBST(aros_ios_version)
2061 AC_SUBST(aros_ios_sdk)
2063 # DBUS related
2064 AC_SUBST(ENABLE_DBUS)
2065 AC_SUBST(DBUS_CFLAGS)
2066 AC_SUBST(DBUS_LIBFLAGS)
2067 AC_SUBST(KERNEL_DBUS_KOBJ)
2068 AC_SUBST(KERNEL_DBUS_INCLUDES)
2070 #X11 related
2071 AC_SUBST(ENABLE_X11)
2073 # Debug related
2074 AC_SUBST(aros_debug)
2075 AC_SUBST(aros_mungwall_debug)
2076 AC_SUBST(aros_stack_debug)
2077 AC_SUBST(aros_modules_debug)
2079 # Collect-aros stuff: "-ius" to ignore undefined symbols
2080 AC_SUBST(ignore_undefined_symbols)
2082 # C compiler related
2083 AC_SUBST(gcc_target_cpu)
2085 dnl Prepare for output, make up all the generated patches
2086 case "$aros_flavour" in
2087 emulation)      aros_flavour_uc="AROS_FLAVOUR_EMULATION"
2088                 aros_flavour="emulation" ;;
2089 emulcompat)     aros_flavour_uc="(AROS_FLAVOUR_EMULATION|AROS_FLAVOUR_BINCOMPAT)"
2090                 aros_flavour="emulation" ;;
2091 standalone)     aros_flavour_uc="AROS_FLAVOUR_STANDALONE"
2092                 aros_flavour="standalone";;
2093 standcompat)    aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_BINCOMPAT)"
2094                 aros_flavour="standalone";;
2095 native)         aros_flavour_uc="AROS_FLAVOUR_NATIVE"
2096                 aros_flavour="native" ;;
2097 nativecompat)   aros_flavour_uc="(AROS_FLAVOUR_NATIVE|AROS_FLAVOUR_BINCOMPAT)"
2098                 aros_flavour="native" ;;
2099 linklib)        aros_flavour_uc="AROS_FLAVOUR_LINKLIB"
2100                 aros_flavour="linklib" ;;
2101 palmnative)     aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
2102                 aros_flavour="palmnative" ;;
2103 mac68knative)   aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
2104                 aros_flavour="mac68knative" ;;
2105 ppcnative)      aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_BINCOMPAT)"
2106                 aros_flavour="ppcnative" ;;
2107 esac
2109 if test ! -d ${aros_inc_dir} ; then
2110     ${MKDIR} ${aros_inc_dir}
2112 if test ! -d ${aros_geninc_dir} ; then
2113     ${MKDIR} ${aros_geninc_dir}
2115 if test ! -d ${aros_hostcfg_dir} ; then
2116     ${MKDIR} ${aros_hostcfg_dir}
2118 if test ! -d ${aros_targetcfg_dir} ; then
2119     ${MKDIR} ${aros_targetcfg_dir}
2121 if test ! -d ${aros_tools_dir} ; then
2122     ${MKDIR} ${aros_tools_dir}
2124 if test ! -d ${aros_scripts_dir} ; then
2125     ${MKDIR} ${aros_scripts_dir}
2128 AC_CONFIG_HEADERS(${aros_geninc_dir}/host-conf.h:config/host-conf.h.in)
2130 AC_CONFIG_COMMANDS([compiler_executable],
2131     [
2132         prefix=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}
2133         mkdir -p $prefix
2134         prefix="${prefix}/${aros_target_cpu}-aros"
2135         prefix2=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros
2137         echo ${prefix}
2138         echo ${prefix2}
2139         chmod a+x ${prefix2}-gcc ${prefix2}-ld
2141         ln -sf ${prefix2}-gcc          ${prefix}-gcc
2142         ln -sf ${prefix2}-ld           ${prefix}-ld
2144         ln -sf $aros_target_as_ln$aros_host_exe_suffix      ${prefix}-as
2145         ln -sf $aros_target_nm_ln$aros_host_exe_suffix      ${prefix}-nm
2146         ln -sf $aros_target_ar_ln$aros_host_exe_suffix      ${prefix}-ar
2147         ln -sf $aros_target_ranlib_ln$aros_host_exe_suffix  ${prefix}-ranlib
2148         ln -sf $aros_target_objcopy_ln$aros_host_exe_suffix ${prefix}-objcopy
2149         ln -sf $aros_target_objdump_ln$aros_host_exe_suffix ${prefix}-objdump
2150         ln -sf $aros_target_strip_ln$aros_host_exe_suffix   ${prefix}-strip
2152         ln -sf $aros_target_as_ln$aros_host_exe_suffix      ${prefix2}-as
2153         ln -sf $aros_target_nm_ln$aros_host_exe_suffix      ${prefix2}-nm
2154         ln -sf $aros_target_ar_ln$aros_host_exe_suffix      ${prefix2}-ar
2155         ln -sf $aros_target_ranlib_ln$aros_host_exe_suffix  ${prefix2}-ranlib
2156         ln -sf $aros_target_objcopy_ln$aros_host_exe_suffix ${prefix2}-objcopy
2157         ln -sf $aros_target_objdump_ln$aros_host_exe_suffix ${prefix2}-objdump
2158         ln -sf $aros_target_strip_ln$aros_host_exe_suffix   ${prefix2}-strip
2159     ],
2160     [
2161         aros_host_exe_suffix=${aros_host_exe_suffix}
2162         aros_tools_dir=${aros_tools_dir}
2163         aros_target_cpu=${aros_target_cpu}
2164         aros_target_arch=${aros_target_arch}
2165         aros_target_suffix=${aros_target_suffix}
2166         aros_target_nm_ln=${aros_target_nm_ln}
2167         aros_target_as_ln=${aros_target_as_ln}
2168         aros_target_ar_ln=${aros_target_ar_ln}
2169         aros_target_ranlib_ln=${aros_target_ranlib_ln}
2170         aros_target_objdump_ln=${aros_target_objdump_ln}
2171         aros_target_objcopy_ln=${aros_target_objcopy_ln}
2172         aros_target_strip_ln=${aros_target_strip_ln}
2173     ]
2175 AC_CONFIG_COMMANDS([genshared_executable],
2176     [chmod a+x ${aros_scripts_dir}/genshared],
2177     [aros_scripts_dir=${aros_scripts_dir}]
2179 AC_CONFIG_COMMANDS([genmf_executable],
2180     [chmod a+x ${aros_tools_dir}/genmf.py],
2181     [aros_tools_dir=${aros_tools_dir}]
2184 AC_CONFIG_FILES(
2185     Makefile
2186     config/make.cfg
2187     ${aros_inc_dir}/config.h:config/config.h.in
2188     ${aros_geninc_dir}/config.h:config/config.h.in
2189     ${aros_hostcfg_dir}/host.cfg:config/host.cfg.in
2190     ${aros_targetcfg_dir}/target.cfg:config/target.cfg.in
2191     mmake.config
2192     ${aros_targetcfg_dir}/make.defaults:config/make.defaults.in
2193     ${aros_targetcfg_dir}/specs:config/specs.in
2194     ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-gcc:scripts/aros-gcc.in
2195     ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-ld:scripts/aros-ld.in
2196     ${aros_scripts_dir}/genshared:compiler/c_lib/source/lib_source/genshared.in
2197     ${aros_tools_dir}/genmf.py:tools/genmf/genmf.py
2198     tools/collect-aros/env.h
2201 AC_OUTPUT
2203 dnl This is in order to not define SHARED_CFLAGS sometimes
2204 dnl We don't always do aros_shared_ar, aros_shared_cflags
2206 #XXX compatability...
2207 aros_shared_ar="$aros_shared_ld $aros_shared_ldflags -o"
2209 if test -n "$aros_shared_cflags" ; then
2210     echo "SHARED_CFLAGS := $aros_shared_cflags" >> ${aros_hostcfg_dir}/host.cfg
2211     echo "SHARED_AR := $aros_shared_ar" >> ${aros_hostcfg_dir}/host.cfg