Revert r44241, it is not needed, asr is logical right shift (new leftmost bit is...
[AROS.git] / configure.in
blob8e40f0ef4b0ecceab494802c22be66928ba888f2
1 dnl Copyright © 1997-2011, 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 # Note: After file changes, generate configure anew and commit _both_ files.
9 #TODO
10 # method of getting shared/non-shared ld/ar tool for target.
12 # ------------------------------------------------------------------------
13 # Here starts the first section of the configure.in file.
14 # ------------------------------------------------------------------------
16 AC_INIT(mmakefile)
17 AC_PREREQ(2.61)
18 AC_CONFIG_AUX_DIR(scripts/autoconf)
20 # Check what host we are running on.
21 # If a target is not suggested, we use this one.
22 # Note that what we call a target, Autoconf calls a host.
23 AC_CANONICAL_HOST
25 # The AROS target is slightly different to the normal GNU style
26 # format. We don't have the middle part, and we reverse the order
27 # of the $(CPU) and $(OS) bits.
29 # Don't strip the version of the target yet, it might be
30 # useful on some systems.
32 AC_MSG_CHECKING([for AROS style target])
34 if test "$target" = "NONE" ; then
35     target=$host_os-$host_cpu
36 else
37     if test "$target" = "" ; then
38         target=$host_os-$host_cpu
39     fi
41 AC_MSG_RESULT($target)
43 if test "$host_os" = "mingw32" ; then
44     PWDCMD="pwd -W"
47 #don't know where else to put this...
48 AC_MSG_CHECKING([building AROS in])
49 AROS_BUILDDIR=`${PWDCMD-pwd}`
50 AROS_BUILDDIR_UNIX=${PWD}
51 AC_MSG_RESULT($AROS_BUILDDIR)
53 AC_MSG_CHECKING([AROS source in])
54 srcpwd=`cd ${srcdir} ; ${PWDCMD-pwd}`
55 SRCDIR=${srcpwd}
56 AC_MSG_RESULT($SRCDIR)
58 # Parse the target field into something useful.
59 changequote(<<,>>)
60 target_os=`echo $target | sed 's/^\([^-]*\)-\(.*\)$/\1/'`
61 target_cpu=`echo $target | sed 's/^\([^-]*\)-\(.*\)$/\2/'`
62 changequote([,])
64 dnl --------------------------------------------------------------------
65 dnl Set the default Workbench resolution
66 dnl --------------------------------------------------------------------
67 aros_default_wbwidth=800
68 aros_default_wbheight=600
69 aros_default_wbdepth=4
71 dnl --------------------------------------------------------------------
72 dnl Host Configuration Section
73 dnl --------------------------------------------------------------------
74 dnl
75 dnl The idea here is to find out all the information we need about the
76 dnl host. This means things like tools for building directory structures,
77 dnl copying files around and the like.
79 # The first step is to find the host binaries.
80 # Check for a compiler.
81 AC_PROG_CC
82 AC_PROG_CC_STDC
83 AC_PROG_CPP
85 # Check for a compatible awk
86 AC_CHECK_PROGS(AWK,[gawk nawk])
87 AROS_REQUIRED(gawk,$AWK)
88 AROS_PROG(MMAKE,mmake)
90 # Perform some default variable assignments. Note all of these will be
91 # Regenerated from the script, so there is no need to cache them.
93 aros_host_cpp="$CPP"
94 aros_host_cc="$CC"
95 AROS_TOOL_CCPATH(aros_host_ld,ld)
96 AROS_REQUIRED(ld,$aros_host_ld)
97 aros_host_make="make"
98 aros_host_cflags=$CFLAGS
99 aros_host_ldflags=$LDFLAGS
100 aros_host_debug="-g -O0"
101 aros_host_mkdep="\$(SRCDIR)/scripts/mkdep"
102 aros_host_mkargs="--no-print-directory"
103 aros_host_exe_suffix="$EXEEXT"
104 aros_host_lib_suffix=""
106 # Ignore all compliance, AROS ROMs = 0
107 # KickStart v1.0 = 30
108 # KickStart v1.3 = 34
109 # KickStart v2.0 = 37
110 # KickStart v3.0 = 39
111 # KickStart v3.1 = 40
112 # AmigaOS   v3.5 = 44
113 aros_amigaos_compliance=0
115 AC_CHECK_PROGS(aros_host_aclocal,[aclocal aclocal19 aclocal-1.9])
116 AC_CHECK_PROGS(aros_host_autoconf,[autoconf autoconf259 autoconf253])
117 AC_CHECK_PROGS(aros_host_autoheader,[autoheader autoheader259 autoheader253])
118 AC_CHECK_PROGS(aros_host_automake,[automake automake19 automake-1.9])
120 AROS_REQUIRED(aclocal/aclocal19/aclocal-1.9, $aros_host_aclocal)
121 AROS_REQUIRED(automake/automake19/automake-1.9, $aros_host_automake)
123 case "$aros_host_cc" in
124     *gcc*)
125         aros_host_cc_pipe="-pipe"
126         ;;
127     icc)
128         aros_host_cc_pipe=""
129         ;;
130     *)
131         aros_host_cc_pipe=""
132         ;;
133 esac
135 aros_kernel_cc_includes=""
136 aros_target_cc_includes=""
138 # ----------------------------------------------------------------------------------------
139 # Host-specific defaults
141 # Override this to "yes" in order to force a specific build to use real AROS crosscompiler
142 # instead of a wrapper script.
143 # Useful for non-ELF hosts (like Windows and Darwin).
144 # Can also be overriden in target section below
145 use_aros_gcc="no"
147 # This is the main host configuration section. It is where the host
148 # can change the values of any variables it needs to change. We do
149 # not look at anything that compiles to the target yet, we'll get
150 # to that later.
152 case "$host_os" in
153     aros*)
154         aros_host_arch="aros"
155         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
156         case "$host_cpu" in
157             *i?86*)
158                 aros_host_cpu="i386"
159                 ;;
160             *x86_64*)
161                 aros_host_cpu="x86_64"
162                 ;;
163             *powerpc*)
164                 aros_host_cpu="ppc"
165                 ;;
166             *)
167                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
168                 aros_host_cpu="$host_cpu"
169                 ;;
170         esac
171         ;;
173     linux*)
174         aros_host_arch="linux"
175         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
176         android_build_os="linux-x86"
177         android_tool="android"
178         default_android_sdk="/opt/android-sdk-linux_x86"
179         case "$host_cpu" in
180             *i?86*)
181                 aros_host_cpu="i386"
182                 ;;
183             *x86_64*)
184                 aros_host_cpu="x86_64"
185                 ;;
186             *m68k*)
187                 aros_host_cpu="m68k"
188                 ;;
189             *powerpc*)
190                 aros_host_cpu="ppc"
191                 ;;
192             *arm*)
193                 aros_host_cpu="arm"
194                 ;;
195             *)
196                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
197                 aros_host_cpu="$host_cpu"
198                 ;;
199         esac
200         ;;
202     freebsd*)
203         aros_host_cc="$aros_host_cc $aros_host_cc_pipe -I/usr/local/include"
204         aros_host_make="gmake"
205         aros_host_arch="freebsd"
206         aros_host_cpu="i386"
208         aros_host_ldflags="$aros_host_ldflags -L/usr/local/lib -liconv"
210         dnl FreeBSD 5.x (and later) has changed the default object format.
211         dnl The double [[]] is necessary to get around m4's quoting rules.
212         case $host_os in
213             freebsd[[234]]*)
214                 aros_object_format="elf_i386"
215                 ;;
217             *)
218                 aros_object_format="elf_i386_fbsd"
219                 ;;
220         esac
222         ;;
224     darwin*)
225         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
226         aros_host_arch="darwin"
227         use_aros_gcc="yes"
228         android_build_os="darwin-x86"
229         android_tool="android"
230         default_android_sdk="/android-sdk-mac_x86"
231         case "$host_cpu" in
232             *i?86*)
233                 aros_host_cpu="i386"
234                 ;;
235             *x86_64*)
236                 aros_host_cpu="x86_64"
237                 ;;
238             *powerpc*)
239                 aros_host_cpu="ppc"
240                 ;;
241             *)
242                 AC_MSG_WARN("Unknown CPU for Darwin host -- $host_cpu")
243                 aros_host_cpu="$host_cpu"
244                 ;;
245         esac
247         aros_host_ldflags="$aros_host_ldflags -liconv"
249         ;;
251     dragonfly*)
252         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
253         aros_host_make="gmake"
254         aros_host_arch="dragonfly"
255         case $host_cpu in
256             *i?86*)
257                 aros_host_cpu="i386"
258                 ;;
259             *amd64*)
260                 aros_host_cpu="x86_64"
261                 ;;
262             *)
263                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
264                 aros_host_cpu="$host_cpu"
265                 ;;
266         esac
267         ;;
269     netbsd*)
270         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
271         aros_host_make="gmake"
272         aros_host_arch="netbsd"
273         case "$host_cpu" in
274             *i?86*)
275                 aros_host_cpu="i386"
276                 ;;
277             *m68k*)
278                 aros_host_cpu="m68k"
279                 ;;
280             *)
281                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
282                 aros_host_cpu="$host_cpu"
283                 ;;
284         esac    
285         aros_host_lib_suffix=".0.0"
286         ;;
288     openbsd*)
289         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
290         aros_host_make="gmake"
291         aros_host_arch="openbsd"
292         case "$host_cpu" in
293             *i?86*)
294                 aros_host_cpu="i386"
295                 ;;
296             *)
297                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
298                 aros_host_cpu="$host_cpu"
299                 ;;
300         esac
301         ;;
302         
303     solaris*)
304         aros_host_arch="solaris"
305         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
306         case "$host_cpu" in
307             *i?86*)
308                 aros_host_cpu="i386"
309                 ;;
310             *sparc*)
311                 aros_host_cpu="sparc"
312                 ;;
313             *)
314                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
315                 aros_host_cpu="$host_cpu"
316                 ;;
317         esac
318         ;;
320     morphos*)
321         aros_host_arch="morphos"
322         aros_host_cpu="ppc"
323         ;;
325     amiga*)
326         aros_host_arch="amiga"
327         SORT="/gg/bin/sort"
328         TEST="/gg/bin/test"
329         UNIQ="/gg/bin/uniq"
330         FOR="for"
331         TOUCH="/gg/bin/touch"
332         case "$host_cpu" in
333             *m68k*)
334                 aros_host_cpu="m68k"
335                 ;;
336             *powerpc*)
337                 aros_host_cpu="ppc"
338                 ;;
339             *)
340                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
341                 aros_host_cpu="$host_cpu"
342                 ;;
343         esac
344         ;;
346     cygwin*)
347         aros_host_arch="cygwin"
348         use_aros_gcc="yes"
349         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
350         android_build_os="windows"
351         android_tool="android.bat"
352         default_android_sdk="/cygdrive/c/android-sdk-windows-1.6_r1"
354         case "$host_cpu" in
355             *i?86*)
356                 aros_host_cpu="i386"
357                 ;;
358             *)
359                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
360                 aros_host_cpu="$host_cpu"
361                 ;;
362         esac
363         ;;
365     mingw32*)
366         aros_host_arch="mingw32"
367         use_aros_gcc="yes"
368         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
369         android_build_os="windows"
370         android_tool="android.bat"
371         default_android_sdk="/c/android-sdk-windows-1.6_r1"
373         case "$host_cpu" in
374         *i?86*)
375             dnl Currently there's neither 64-bit MinGW nor MSYS. Both environments are 32-bit
376             dnl and run under emulation. Consequently, uname reports i386 even on 64-bit systems.
377             dnl Here we attempt to detect Windows home platform by asking gcc about its target.
378             dnl 64-bit gcc will output "x86_64-w64-mingw32" here.
380             AC_MSG_CHECKING([for Windows native gcc target])
381             host_cpu=`gcc -dumpmachine`
382             AC_MSG_RESULT($host_cpu)
383             ;;
385         esac
387         case "$host_cpu" in
388         *i?86*)
389             aros_host_cpu="i386"
390             ;;
392         *x86_64*)
393             aros_host_cpu="x86_64"
394             dnl Dragon's x86_64-w64-mingw32-gcc is a bit broken. It ignores standard $prefix/include
395             dnl directory, so we have to add it explicitly here.
396             aros_host_cflags="$aros_host_cflags -isystem /mingw/include"
397             ;;
399         *)
400             AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
401             aros_host_cpu="$host_cpu"
402             ;;
403         esac
404         ;;
405     *)
406         AC_MSG_ERROR([Unsupported host architecture $host])
407         ;;
408 esac
410 AROS_PROG(aros_host_ar,[ar],[cr])
411 AROS_REQUIRED(ar,$aros_host_ar)
412 AROS_PROG(aros_host_ranlib,ranlib)
413 AROS_REQUIRED(ranlib,$aros_host_ranlib)
414 AROS_PROG(aros_host_strip,strip)
415 AROS_REQUIRED(strip,$aros_host_strip)
417 AROS_PROG(RM,[rm],[-rf])
418 AROS_REQUIRED(rm,$RM)
419 AROS_PROG(CP,[cp])
420 AROS_REQUIRED(cp,$CP)
421 AROS_PROG(MV,[mv])
422 AROS_REQUIRED(mv,$MV)
423 AROS_PROG(ECHO,[echo])
424 AROS_REQUIRED(echo,$ECHO)
425 AROS_PROG(MKDIR,[mkdir],[-p])
426 AROS_REQUIRED(mkdir,$MKDIR)
427 AROS_PROG(TOUCH,[touch])
428 AROS_REQUIRED(touch,$TOUCH)
429 AROS_PROG(SORT,[sort])
430 AROS_REQUIRED(sort,$SORT)
431 AROS_PROG(UNIQ,[uniq])
432 AROS_REQUIRED(uniq,$UNIQ)
433 AROS_PROG(NOP,[true])
434 AROS_REQUIRED(true,$NOP)
435 AROS_PROG(CAT,[cat])
436 AROS_REQUIRED(cat,$CAT)
437 AROS_PROG(BISON,[bison])
438 AROS_REQUIRED(bison,$BISON)
439 AROS_PROG(FLEX,[flex])
440 AROS_REQUIRED(flex,$FLEX)
441 AROS_PROG(PNGTOPNM,[pngtopnm])
442 AROS_REQUIRED(pngtopnm,$PNGTOPNM)
443 AROS_PROG(PPMTOILBM,[ppmtoilbm])
444 AROS_REQUIRED(ppmtoilbm,$PPMTOILBM)
445 AROS_PROG(SED,[sed])
446 AROS_REQUIRED(sed,$SED)
447 AROS_PROG(CHMOD,[chmod])
448 AROS_REQUIRED(chmod,$CHMOD)
449 AROS_PROG(PATCH,[patch])
450 AROS_REQUIRED(patch,$PATCH)
452 AM_PATH_PYTHON(2.5)
454 AC_SUBST(FOR, for)
455 AC_SUBST(IF, if)
456 AC_SUBST(TEST, test)
457 AC_SUBST(CMP, cmp)
459 dnl ---------------------------------------------------------------------------
460 dnl Look for things about the host system, good for hosted targets.
461 dnl ---------------------------------------------------------------------------
463 # Check for some includes for the X11 HIDD and the kernel
464 AC_CHECK_HEADERS([sys/ipc.h sys/shm.h \
465     sys/mmap.h sys/mman.h sysexits.h \
466     sys/statfs.h sys/statvfs.h sys/vfs.h sys/param.h \
469 AC_CHECK_HEADERS([sys/mount.h],,,[#include <sys/param.h>])
471 AC_HEADER_DIRENT
472 AC_HEADER_STAT
473 AC_HEADER_STDC
474 AC_HEADER_SYS_WAIT
475 AC_HEADER_TIME
476 AC_STRUCT_ST_BLKSIZE
477 AC_STRUCT_ST_BLOCKS
478 AC_STRUCT_ST_RDEV
479 AC_STRUCT_TM
480 AC_STRUCT_TIMEZONE
481 AC_TYPE_OFF_T
482 AC_TYPE_PID_T
483 AC_TYPE_SIZE_T
484 AC_TYPE_UID_T
486 AC_CHECK_MEMBERS(struct tm.tm_gmtoff)
488 # Look for some functions
489 AC_CHECK_FUNCS([getpagesize kqueue statfs statvfs \
490     clone kse_create rfork_thread thr_create sa_register \
491     getcontext makecontext setcontext sigaltstack swapcontext])
493 AC_FUNC_MMAP
496 dnl --------------------------------------------------------------------
497 dnl Target Configuration Section
498 dnl --------------------------------------------------------------------
500 dnl The target configuration section is responsible for setting up all
501 dnl the paths for includes, and tools required to build AROS to some
502 dnl particular target.
504 aros_config_cflags="-Wall -Werror-implicit-function-declaration"
505 aros_config_aflags="-Wall -x assembler-with-cpp -c"
506 aros_config_ldflags=""
508 aros_shared_default=yes
510 aros_shared_cflags="-fPIC"
511 aros_shared_aflags=""
512 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
513 aros_kernel_ldflags="-Wl,-rpath,./lib"
515 aros_kernel_ar_flags="cr"
516 aros_target_ar_flags="cr"
517 aros_target_nm_flags="-C -ul"
518 aros_target_strip_flags="--strip-unneeded -R.comment"
520 aros_compiler_libs=
521 aros_arch_libs=
523 aros_target_genmap="-Wl,-Map -Xlinker"
525 # Native flavour stuff
526 aros_serial_debug="0"
528 # Palm native flavour stuff
529 aros_palm_debug_hack="0"
531 # Unix flavour stuff
532 aros_nesting_supervisor="0"
534 # Collect-aros stuff: "-ius" to ignore undefined symbols
535 ignore_undefined_symbols=""
537 # Check for X11 by default
538 need_x11="auto"
540 #-----------------------------------------------------------------------------
543 # GCC 4.1+ has a stack protection feature that requires OS support. Ubuntu has
544 # it switched on by default, and we use the host compiler, so it compiles AROS
545 # code with this enabled resulting in link failures as we don't have support
546 # for it.
548 # We use two methods to disable it. For the host compiler (used to compile
549 # some hosted modules), we test to see if the compiler supports stack
550 # protection, and if it does we disable it in AROS_CONFIG_CFLAGS. This should
551 # work on all platforms.
553 # For the "cross" compiler we clear the "ssp_default" spec in config/specs.in
554 # (this is done unconditionally, as it should have no effect on compilers
555 # without the stack protection feature). This may be specific to the way that
556 # Ubuntu enables the feature, so may not work everywhere. My specs-fu isn't
557 # strong enough to disable it in a generic way though, so we'll live with it
558 # until another vendor ships GCC with it enabled in a different way, and deal
559 # with it then.
562 AC_MSG_CHECKING([whether ${CC} accepts -fno-stack-protector])
563 save_cflags="$CFLAGS"
564 CFLAGS="$CFLAGS -fno-stack-protector"
565 AC_TRY_COMPILE(,, use_no_stack_protector="yes", use_no_stack_protector="no")
566 AC_MSG_RESULT($use_no_stack_protector)
567 if test "x-$use_no_stack_protector" = "x-yes" ; then
568     aros_host_cflags="$aros_host_cflags -fno-stack-protector"
570 CFLAGS="$save_cflags"
572 #-----------------------------------------------------------------------------
574 # Disable pointer-signedness warnings if the compiler recognises the option
575 # (this only works for the host compiler at the moment)
577 AC_MSG_CHECKING([whether ${CC} accepts -Wno-pointer-sign])
578 save_cflags="$CFLAGS"
579 CFLAGS="$CFLAGS -Wno-pointer-sign"
580 AC_TRY_COMPILE(,, use_no_sign_warning="yes", use_no_sign_warning="no")
581 AC_MSG_RESULT($use_no_sign_warning)
582 if test "x-$use_no_sign_warning" = "x-yes" ; then
583     aros_host_cflags="$aros_host_cflags -Wno-pointer-sign"
585 CFLAGS="$save_cflags"
587 #-----------------------------------------------------------------------------
589 # Check if host compiler supports -fgnu89-inline, can be needed for crosstools.
591 AC_MSG_CHECKING([whether ${CC} accepts -fgnu89-inline])
592 save_cflags="$CFLAGS"
593 CFLAGS="$CFLAGS -fgnu89-inline"
594 AC_TRY_COMPILE(,, use_gnu89_inline="yes", use_gnu89_inline="no")
595 AC_MSG_RESULT($use_gnu89_inline)
596 if test "x-$use_gnu89_inline" = "x-yes" ; then
597     gnu89_inline="-fgnu89-inline"
599 CFLAGS="$save_cflags"
601 #-----------------------------------------------------------------------------
603 AC_MSG_CHECKING([for type of build])
604 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")
606 if test "$build_type" = "nightly"; then
607     build_type_string="NIGHTLY"
608 elif test "$build_type" = "snapshot"; then
609     build_type_string="SNAPSHOT"
610 elif test "$build_type" = "milestone"; then
611     build_type_string="MILESTONE"
612 elif test "$build_type" = "release"; then
613     build_type_string="RELEASE"
614 else
615     build_type_string="PERSONAL"
616     build_type="personal"
619 aros_config_cflags="$aros_config_cflags -DAROS_BUILD_TYPE=AROS_BUILD_TYPE_$build_type_string"
621 AC_MSG_RESULT($build_type)
623 #-----------------------------------------------------------------------------
624 all_debug_types="messages stack modules mungwall symbols"
626 AC_MSG_CHECKING([which debug types to enable])
627 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)]),
628  debug="$enableval",debug="")
630 if test "$debug" = "" -o "$debug" = "no"; then
631     debug="none"
632 elif test "$debug" = "yes"; then
633     debug="all"
636 if test "$debug" = "all" ; then
637     debug="messages stack modules symbols"
638     for d in $all_debug_types; do
639         export aros_${d}_debug="1"
640     done
641 else
642     for d in $all_debug_types; do
643         export aros_${d}_debug="0"
644     done
647 if test "$debug" != "none"; then
648     debug=`echo $debug | sed s/,/\ /g`
649     for d in $debug; do
650         found="0"
651         for d2 in $all_debug_types; do
652             if test "$d2" = "$d"; then
653                 found="1"
654                 break
655             fi
656         done
657         if test "$found" = "0"; then
658             AC_MSG_ERROR([unrecognized debug type "$d". Available types are: all none $all_debug_types])
659         fi
660         export aros_${d}_debug="1"
661     done
662     aros_debug="yes"
664 AC_MSG_RESULT($debug)
666 if test "$aros_messages_debug" = "1"; then
667     aros_messages_debug="-DADEBUG=1 -DMDEBUG=1"
668 else
669     aros_messages_debug=""
671 if test "$aros_symbols_debug" = "1"; then
672     aros_symbols_debug="-g"
673 else
674     aros_symbols_debug=""
677 # These are the flags to pass when compiling debugged programs
678 aros_debug_cflags="$aros_symbols_debug $aros_messages_debug"
679 aros_debug_aflags=""
680 aros_debug_ldflags="$aros_symbols_debug"
682 #-----------------------------------------------------------------------------
683 #   Checking if we should build crosstools..
684 AC_MSG_CHECKING([whether to build crosstools])
685 AC_ARG_ENABLE(crosstools,AC_HELP_STRING([--disable-crosstools],[Do not build cross-compiler toolchain]),crosstools="$enableval",crosstools="yes")
686 AC_MSG_RESULT($crosstools)
688 #-----------------------------------------------------------------------------
689 #   Checking for distcc and ccache.
691 #   Always apply the transforms in this particular order. Basically you should
692 #   always run 'ccache distcc compiler' in that order for the best performance.
694 AC_MSG_CHECKING([whether to enable distcc])
695 AC_ARG_ENABLE(distcc,AC_HELP_STRING([--enable-distcc],[Use distcc as a front end to the compiler (default=no).]),distcc="$enableval",distcc="no")
696 if test "$distcc" != "" -a "$distcc" != "no"; then
697     # AC_CHECK_PROG will print out the result in this case
698     AC_PATH_PROG(DISTCC,[distcc],distcc,)
699 else
700     AC_MSG_RESULT(no)
703 AC_MSG_CHECKING([whether to enable ccache])
704 AC_ARG_ENABLE(ccache,AC_HELP_STRING([--enable-ccache],[Use ccache as a front end to the compiler (default=no).]),ccache="$enableval",ccache="no")
705 if test "$ccache" != "" -a "$ccache" != "no"; then
706     # AC_CHECK_PROG will print out the result in this case
707     AC_CHECK_PROG(CCACHE,[ccache],ccache,)
708 else
709     AC_MSG_RESULT(no)
712 #-----------------------------------------------------------------------------
713 AC_MSG_CHECKING([what specific host gcc version to use])
714 AC_ARG_WITH(gcc-version,AC_HELP_STRING([--with-kernel-gcc-version=VERSION],[Use host gcc-VERSION for building AROS]),kernel_tool_version="$withval",kernel_tool_version="default")
715 AC_MSG_RESULT($kernel_tool_version)
717 #-----------------------------------------------------------------------------
718 AC_MSG_CHECKING([what specific target gcc version to use])
719 AC_ARG_WITH(gcc-version,AC_HELP_STRING([--with-gcc-version=VERSION],[Use host gcc-VERSION for building AROS]),target_tool_version="$withval",target_tool_version="default")
720 AC_MSG_RESULT($target_tool_version)
722 #-----------------------------------------------------------------------------
723 AC_MSG_CHECKING([what optimization flags to use])
724 AC_ARG_WITH(optimization,AC_HELP_STRING([--with-optimization=FLAGS],[Use optimization flags FLAGS (default=-O2).]),optimization="$withval",optimization="unknown")
725 if test "$optimization" = "unknown"; then
726     dnl default is -O2 for normal builds, -O0 for debug builds
727     if test "$debug" != "none"; then
728         optimization="-O0"
729     else
730         optimization="-O2"
731     fi
733 aros_config_cflags="$aros_config_cflags $optimization"
734 AC_MSG_RESULT($optimization)
736 #-----------------------------------------------------------------------------
737 AC_MSG_CHECKING([what paranoia flags to use])
738 AC_ARG_WITH(paranoia,AC_HELP_STRING([--with-paranoia=FLAGS],[CC flags to enable paranoia]),[paranoia_flags="$withval"],[paranoia_flags="default"])
739 if test "$paranoia_flags" = "default"; then
740         paranoia_flags=""
741 else if test "$paranoia_flags" = "yes"; then
742         paranoia_flags="-Wall -Werror"
743 fi fi
744 AC_MSG_RESULT($paranoia_flags)
745 aros_config_cflags="$aros_config_cflags $paranoia_flags"
747 #-----------------------------------------------------------------------------
748 AC_MSG_CHECKING([what target variant to enable])
749 AC_ARG_ENABLE(target_variant,AC_HELP_STRING([--enable-target-variant=NAME],[Enable a specific target variant(default=none)]),target_variant=$enableval,target_variant="")
750 if test "$target_variant" = ""; then
751     aros_target_variant=""
752     aros_target_suffix=""
753     enableval="none"
754 else
755     aros_target_variant="$target_variant"
756     aros_target_suffix="-$target_variant"
758 AC_MSG_RESULT($enableval)
760 #-----------------------------------------------------------------------------
761 # Target-specific defaults. You can override then on a per-target basis.
763 # Bootloader name. Currently used by PC target.
764 target_bootloader="none"
766 # Prefix for toolchain used to build bootstrap. For hosted ports, this should be a toolchain for target host OS.
767 # (i. e. when building mingw32-i386 port this should be set to "i386-mingw32-").
768 # For native ports this toolchain is used to build a bootloader and second-level bootstrap (if present).
769 if test "$crosstools" != "yes"; then
770     target_tool_prefix=${target_cpu}-elf-
771 else
772     target_tool_prefix=${target_cpu}-aros-
774 AC_MSG_CHECKING([Target tool prefix])
775 AC_MSG_RESULT($target_tool_prefix)
777 #-----------------------------------------------------------------------------
778 # Additional options for some specific targets
780 case "$aros_target_variant" in
781 ios)
782     AC_MSG_CHECKING([XCode path])
783     AC_ARG_WITH(xcode,AC_HELP_STRING([--with-xcode=PATH],[Specify XCode path for iOS targets (default=/Developer).]),aros_xcode_path="$withval",aros_xcode_path="/Developer")
784     AC_MSG_RESULT($aros_xcode_path)
786     AC_MSG_CHECKING([what iOS SDK version to use])
787     AC_ARG_WITH(sdk-version,AC_HELP_STRING([--with-sdk-version=VERSION],[Use iOS SDK version VERSION (default=4.1).]),aros_sdk_version="$withval",aros_sdk_version="4.1")
788     AC_MSG_RESULT($aros_sdk_version)
790     ;;
792 "android")
793     AC_MSG_CHECKING([Android SDK path])
794     AC_ARG_WITH(sdk,AC_HELP_STRING([--with-sdk=PATH],[Specify Android SDK path (default=$default_android_sdk).]),aros_android_sdk="$withval",aros_android_sdk=$default_android_sdk)
795     AC_MSG_RESULT($aros_android_sdk)
797     AC_MSG_CHECKING([Android NDK path])
798     AC_ARG_WITH(ndk,AC_HELP_STRING([--with-ndk=PATH],[Specify Android NDK path (default=none).]),aros_android_ndk="$withval",aros_android_ndk="none")
799     AC_MSG_RESULT($aros_android_ndk)
801     AC_MSG_CHECKING([what Android SDK version to use])
802     AC_ARG_WITH(sdk-version,AC_HELP_STRING([--with-sdk-version=LEVEL],[Use Android SDK for API LEVEL (default=12).]),aros_sdk_version="$withval",aros_sdk_version="12")
803     AC_MSG_RESULT($aros_sdk_version)
805     if test "$aros_android_ndk" != "none"; then
806         AC_MSG_CHECKING([what Android NDK version to use])
807         AC_ARG_WITH(ndk-version,AC_HELP_STRING([--with-ndk-version=LEVEL],[Use Android NDK for API LEVEL (default=9).]),aros_ndk_version="$withval",aros_ndk_version="9")
808         AC_MSG_RESULT($aros_ndk_version)
809     fi
811     export PATH="$aros_android_sdk/tools:$PATH"
812     AC_PATH_PROG(android_tool, $android_tool)
813     AROS_REQUIRED(android,$android_tool)
815     aros_android_level=android-$aros_sdk_version
816     if test ! -d $aros_android_sdk/platforms/$aros_android_level; then
817         echo "Platform $aros_android_level is not installed in your SDK"
818         echo "Use --with-sdk-version=<API level number> to select another platform version"
819         echo "You can check what plaform versions are installed in your SDK"
820         echo "by examining contents of $aros_android_sdk/platforms directory"
821         AC_MSG_ERROR([Android platform $aros_android_level is not installed])
822     fi
824     AC_PATH_PROG(ant, ant)
825     if test "$ant" = ""; then
826         AC_MSG_WARN([Apache Ant is missing, Java bootstrap can't be built automatically])
827     fi
829     dnl MSYS bash can't run .bat files directly, then need to be started via cmd.exe
830     if test "$host_os" = "mingw32"; then
831         android_tool="cmd //c $android_tool"
832     fi
834     ;;
835 esac
837 #-----------------------------------------------------------------------------
839 # This is the target configuration switch.
840 case "$target_os" in
841     linux*)
842         aros_target_arch="linux"
843         aros_target_family="unix"
844         case "$target_cpu" in
845             *m68k*)
846                 aros_target_cpu="m68k"
847                 aros_object_format="m68kelf"
848                 aros_flavour="emulcompat"
849                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D__mc68000 -D__linux__"
850                 aros_shared_ldflags="-Wl,-T,\$(TOP)/config/linux/m68k/script.so"
851                 aros_kernel_ldflags="-Wl,-rpath,./lib,-T,\$(TOP)/config/linux/m68k/script.normal"
852                 gcc_target_cpu="mc68000"
853                 ;;
854             *i?86*)
855                 aros_target_cpu="i386"
856                 aros_object_format="elf_i386"
857                 aros_flavour="emulation"
858                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__linux__"
859                 aros_config_cflags="$aros_config_cflags -m32 -march=i486"
860                 aros_kernel_cflags="$aros_kernel_cflags -m32 -march=i486"
861                 aros_config_aflags="$aros_config_aflags -m32 -march=i486"
862                 aros_config_ldflags="-m32 -march=i486"
863                 aros_kernel_ldflags="-melf_i386"
864                 aros_default_wbdepth=8
865                 gcc_target_cpu="i386"
866                 pci_hidd_target="hidd-pci-linux"
867                 android_tool_dir_prefix="x86"
868                 android_tool_prefix="i686-android-linux"
869                 android_ndk_arch="x86"
870                 ;;
871             *x86_64*)
872                 aros_target_cpu="x86_64"
873                 aros_object_format="elf_x86_64"
874                 aros_flavour="emulation"
875                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64 -D__linux__"
876                 aros_config_cflags="$aros_config_cflags -mno-red-zone -fno-omit-frame-pointer"
877                 aros_default_wbdepth=8
878                 pci_hidd_target="hidd-pci-linux"
879                 ;;
880             *powerpc*)
881                 aros_target_cpu="ppc"
882                 aros_object_format="elf32ppc"
883                 aros_flavour="emulation"
884                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc -D__linux__"
885                 aros_default_wbdepth=8
886                 gcc_target_cpu="ppc"
887                 ;;
888 # TODO
889 # Same as powerpc, but I need this for the nightly build to work again.
890 # Actually, the nightly should be made working with powerpc target.
891 # That just was too much work for the moment, another week or two.
892             *ppc*)
893                 aros_target_cpu="ppc"
894                 aros_object_format="elf32ppc"
895                 aros_flavour="emulation"
896                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc -D__linux__"
897                 aros_default_wbdepth=8
898                 gcc_target_cpu="ppc"
899                 ;;
900             *arm*)
901                 aros_target_cpu="arm"
902                 aros_object_format="armelf_linux_eabi"
903                 aros_flavour="emulation"
904                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm -D__linux__"
905                 gcc_target_cpu="arm"
906                 aros_config_cflags="$aros_config_cflags -fno-strict-aliasing -fno-omit-frame-pointer"
907                 aros_config_aflags="$aros_config_aflags -fno-strict-aliasing"
908                 aros_arch_libs="-laeabi"
909                 android_tool_dir_prefix="arm-linux-androideabi"
910                 android_tool_prefix="arm-linux-androideabi"
911                 android_ndk_arch="arm"
912                 ;;
913             *)
914                 AC_MSG_ERROR("Unknown CPU for Linux -- $target_cpu")
915                 ;;
916         esac
917         case "$aros_target_variant" in
918             android)
920                 dnl Not all Linux CPUs are supported by Android
921                 if test "$android_ndk_arch" = ""; then
922                     AC_MSG_ERROR("Unsupported CPU for Android -- $target_cpu")
923                 fi
925                 aros_default_wbwidth=320
926                 aros_default_wbheight=480
927                 if test "$aros_android_ndk" = "none"; then
928                     dnl Use standalone toolchain, don't adjust paths
929                     aros_kernel_cflags="-mandroid"
930                     aros_kernel_ldflags="-mandroid"
931                     CFLAGS="-mandroid"
932                 else
933                     export PATH="$aros_android_ndk/toolchains/$android_tool_dir_prefix-$target_tool_version/prebuilt/$android_build_os/bin:$PATH"
934                     aros_android_ndk="$aros_android_ndk/platforms/android-$aros_ndk_version/arch-$android_ndk_arch"
935                     aros_kernel_cflags="--sysroot $aros_android_ndk -mandroid"
936                     aros_kernel_ldflags="--sysroot $aros_android_ndk -mandroid"
937                     CFLAGS="$CFLAGS --sysroot $aros_android_ndk -mandroid"
938                     aros_kernel_includes="-isystem $aros_android_ndk/usr/include"
939                 fi
940                 need_x11=no
941                 dnl (Ab)use $(X11_HIDD_TARGET) as "Default display driver target"
942                 dnl in order not to fill mmakefiles with garbage
943                 x11_hidd_target=kernel-hidd-androidgfx-kobj
944                 # Disable implicit PIC mode
945                 aros_kernel_cflags="$aros_kernel_cflags -fno-pic"
946                 aros_target_cflags="$aros_target_cflags -fno-pic"
947                 kernel_tool_prefix="$android_tool_prefix-"
948             ;;
949         esac
950     ;;
952     pc)
953         aros_target_arch="pc"
954         aros_shared_default="no"
955         target_bootloader="grub2"
956         case "$target_cpu" in
957             *i?86*)
958                 aros_target_cpu="i386"
960                 dnl If somebody hasn't already set the target object
961                 dnl format, then use this value. Mostly to support
962                 dnl FreeBSD cross-compilation.
963                 dnl TODO: Remove when we always use our compiler.
965                 if test "$aros_object_format" = "" ; then
966                     aros_object_format="elf_i386"
967                 fi
968                 aros_flavour="standalone"
969                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
970                 aros_config_cflags="$aros_config_cflags -m32 -march=i486"
971                 aros_kernel_cflags="$aros_kernel_cflags -m32 -march=i486"
972                 aros_config_aflags="$aros_config_aflags -m32 -march=i486"
973                 aros_config_ldflags="-m32 -march=i486"
974                 aros_kernel_ldflags="-melf_i386"
975                 aros_default_wbwidth=640
976                 aros_default_wbheight=480
977                 gcc_target_cpu="i386"
978                 ;;
979             *x86_64*)
980                 aros_target_cpu="x86_64"
981                 aros_serial_debug=1
982                 if test "$aros_object_format" = "" ; then
983                     aros_object_format="elf_x86_64"
984                 fi
985                 aros_flavour="standalone"
986                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
987                 aros_config_cflags="$aros_config_cflags -fno-asynchronous-unwind-tables -mno-red-zone -fno-omit-frame-pointer"
988                 aros_kernel_ldflags=""
989                 aros_default_wbwidth=640
990                 aros_default_wbheight=480
991                 ;;
992             *)
993                 AC_MSG_ERROR("Unknown native CPU -- $target_cpu")
994                 ;;
995         esac
996         ;;
998     prep)
999         aros_target_arch="prep"
1000         aros_shared_default="no"
1001         aros_target_cpu="ppc"
1002         aros_object_format="elf32ppc"
1003         aros_flavour="ppcnative"
1004         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1005         aros_kernel_ldflags=""
1006         aros_default_wbwidth=640
1007         aros_default_wbheight=480
1008         gcc_target_cpu="ppc"
1009         ;;
1011     freebsd*)
1012         aros_target_arch="freebsd"
1013         aros_target_family="unix"
1014         aros_target_cpu="i386"
1015         aros_flavour="emulation"
1016         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1017         gcc_target_cpu="i386"
1019         aros_target_strip_flags="-x"
1020         ;;
1022     darwin*)
1023         aros_target_arch="darwin"
1024         aros_target_family="unix"
1025         aros_flavour="emulation"
1026         case "$target_cpu" in
1027             *i?86*)
1028                 aros_ios_platform="iPhoneSimulator"
1029                 aros_target_cpu="i386"
1030                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1031                 aros_kernel_ldflags=""
1032                 aros_macosx_version="10.4"
1033                 aros_default_wbdepth=8
1034                 gcc_target_cpu="i386"
1035                 aros_object_format="elf_i386"
1036                 aros_kernel_ar_flags="-cr"
1037                 aros_target_strip_flags="-x"
1038                 kernel_tool_flags="-m32"
1039                 ;;
1040             *x86_64*)
1041                 aros_target_cpu="x86_64"
1042                 aros_object_format="elf_x86_64"
1043                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
1044                 aros_macosx_version="10.6"
1045                 aros_config_cflags="$aros_config_cflags -fno-omit-frame-pointer"
1046                 aros_kernel_cflags="-m64"
1047                 aros_kernel_ldflags="-m64"
1048                 aros_target_cflags="-mcmodel=large"
1049                 aros_default_wbdepth=8
1050                 aros_kernel_ar="ar"
1051                 aros_kernel_ar_flags="-cr"
1052                 aros_kernel_ld="ld"
1053                 aros_kernel_ranlib="ranlib"
1054                 ;;
1055             *ppc*)
1056                 aros_target_cpu="ppc"
1057                 aros_object_format="elf32ppc"
1058                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1059                 aros_kernel_ldflags=""
1060                 aros_macosx_version="10.0"
1061                 aros_default_wbdepth=8
1062                 gcc_target_cpu="ppc"
1063                 aros_kernel_ar="ar"
1064                 aros_kernel_ar_flags="-cr"
1065                 aros_kernel_ld="ld -arch ppc"
1066                 aros_kernel_ranlib="ranlib -arch ppc"
1067                 kernel_tool_prefix="powerpc-apple-darwin10-"
1068                 ;;
1069             *arm*)
1070                 aros_ios_platform="iPhoneOS"
1071                 aros_target_cpu="arm"
1072                 aros_object_format="armelf_linux_eabi"
1073                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
1074                 aros_arch_libs="-laeabi"
1075                 aros_default_wbdepth=8
1076                 gcc_target_cpu="arm"
1077                 aros_kernel_ar="ar"
1078                 aros_kernel_ar_flags="-cr"
1079                 aros_kernel_ld="ld -arch arm"
1080                 aros_kernel_ranlib="ranlib -arch arm"
1081                 kernel_tool_prefix="arm-apple-darwin10-" 
1082                 export PATH="$aros_xcode_path/Platforms/$aros_ios_platform.platform/Developer/usr/bin:$PATH"
1083                 ;;
1084             *)
1085                 AC_MSG_ERROR("Unsupported target CPU for darwin hosted flavour -- $target_cpu")
1086                 ;;
1087         esac
1088         case "$aros_target_variant" in
1089             ios)
1090                 aros_ios_version="3.0"
1091                 aros_default_wbwidth=320
1092                 aros_default_wbheight=480
1093                 aros_ios_sdk="$aros_xcode_path/Platforms/$aros_ios_platform.platform/Developer/SDKs/$aros_ios_platform$aros_sdk_version.sdk"
1094                 kernel_tool_flags="$target_tool_flags -isysroot $aros_ios_sdk"
1095                 aros_kernel_includes="-isystem $aros_ios_sdk/usr/include"
1096                 need_x11=no
1097                 # This is here because it may depend on iOS or SDK version
1098                 aros_kernel_cflags="$aros_kernel_cflags -miphoneos-version-min=$aros_ios_version"
1099                 aros_kernel_ldflags="$aros_kernel_ldflags -miphoneos-version-min=$aros_ios_version"
1100                 aros_kernel_objcflags="-fobjc-abi-version=2 -fobjc-legacy-dispatch"
1101             ;;
1102             *)
1103                 aros_kernel_cflags="$aros_kernel_cflags -mmacosx-version-min=$aros_macosx_version"
1104                 aros_kernel_ldflags="$aros_kernel_ldflags -mmacosx-version-min=$aros_macosx_version"
1105             ;;
1106         esac
1107         ;;
1109     dragonfly*)
1110         aros_target_arch="dragonfly"
1111         aros_target_family="unix"
1112         aros_flavour="emulation"
1113         case "$target_cpu" in
1114             *i?86*)
1115                 aros_target_cpu="i386"
1116                 aros_object_format="elf_i386"
1117                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__DragonFly__"
1118                 ;;
1119             *x86_64*)
1120                 aros_config_cflags="$aros_config_cflags -fno-omit-frame-pointer"
1121                 aros_target_cpu="x86_64"
1122                 aros_object_format="elf_x86_64"
1123                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64 -D__DragonFly__"
1124                 ;;
1125             *)
1126                 AC_MSG_ERROR("Unknown CPU for DragonFly -- $target_cpu")
1127                 ;;
1128         esac
1129         ;;
1131     netbsd*)
1132         aros_target_arch="netbsd"
1133         aros_target_family="unix"
1134         case "$target_cpu" in
1135             *m68k*)
1136                 aros_target_cpu="m68k"
1137                 aros_object_format="m68kelf"
1138                 aros_flavour="emulcompat"
1139                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D__mc68000 -D__NetBSD__"
1140                 gcc_target_cpu="mc68000"
1141                 ;;
1142             *i?86*)
1143                 aros_target_cpu="i386"
1144                 aros_object_format="elf_i386"
1145                 aros_flavour="emulation"
1146                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__NetBSD__"
1147                 aros_default_wbdepth=8
1148                 gcc_target_cpu="i386"
1149                 ;;
1150             *)
1151                 AC_MSG_ERROR("Unknown CPU for NetBSD -- $target_cpu")
1152                 ;;
1153         esac
1154         aros_target_genmap="-Wl,-M -Xlinker >"
1155         aros_flavour="emulation"
1156         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1157         ;;   
1159     openbsd*)
1160         aros_target_arch="openbsd"
1161         aros_target_family="unix"
1162         case "$target_cpu" in
1163             *i?86*)
1164                 aros_target_cpu="i386"
1165                 aros_object_format="elf_i386"
1166                 aros_flavour="emulation"
1167                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__OpenBSD__"
1168                 gcc_target_cpu="i386"
1169                 ;;
1170             *)
1171                 AC_MSG_ERROR("Unknown CPU for OpenBSD -- $target_cpu")
1172                 ;;
1173         esac
1174         aros_target_genmap="-Wl,-M -Xlinker >"
1175         aros_target_nm_flags="-u"
1176         aros_flavour="emulation"
1177         ;;
1179     solaris*)
1180         aros_target_arch="solaris"
1181         aros_target_family="unix"
1182         case "$target_cpu" in
1183            *i?86*)
1184                aros_target_cpu="i386"
1185                aros_object_format="elf_i386"
1186                aros_flavour="emulation"
1187                aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__Solaris__"
1188                aros_default_wbdepth=8
1189                gcc_target_cpu="i386"
1190                ;;
1191             *sparc*)
1192                 aros_target_cpu="sparc"
1193                 aros_object_format="elf_sparc"
1194                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dsparc -D__Solaris__"
1195                 gcc_target_cpu="sparc"
1196                 ;;
1197             *)
1198                 AC_MSG_ERROR("Unknown CPU for Solaris -- $target_cpu")
1199                 ;;
1200         esac
1201         aros_config_cflags="$aros_config_cflags -D$aros_target_cpu"
1202         aros_flavour="emulation"
1203         ;;
1205     morphos*)
1206         aros_target_arch="morphos"
1207         aros_shared_default="no"
1208         aros_target_cpu="ppc"
1209         aros_object_format="elf_ppc"
1210         aros_flavour="nativecompat"
1211         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1212         gcc_target_cpu="ppc"
1213         ;;
1215     sam440)
1216         aros_target_arch="sam440"
1217         aros_shared_default="no"
1218         aros_target_cpu="ppc"
1219         aros_object_format="elf32ppc"
1220         aros_flavour="ppcnative"
1221         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1222         aros_kernel_ldflags=""
1223         aros_default_wbwidth=1024
1224         aros_default_wbheight=768
1225         aros_default_wbdepth=24
1226         aros_config_cflags="$aros_config_cflags -mcpu=440fp -mno-toc -fno-asynchronous-unwind-tables"
1227         gcc_target_cpu="powerpc"
1228         ;;
1230     efika)
1231         aros_target_arch="efika"
1232         aros_shared_default="no"
1233         aros_target_cpu="arm"
1234         aros_object_format="armelf_linux_eabi"
1235         aros_flavour="standalone"
1236         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
1237         aros_kernel_ldflags=""
1238         aros_default_wbwidth=1024
1239         aros_default_wbheight=600
1240         aros_arch_libs="-laeabi"
1241         gcc_default_cpu="armv7-a"
1242         gcc_default_fpu="vfpv3"
1243         gcc_default_float_abi="softfp"
1244         aros_config_cflags="$aros_config_cflags -mtune=cortex-a8 -fno-strict-aliasing"
1245         aros_config_aflags="$aros_config_aflags -mtune=cortex-a8 -fno-strict-aliasing"
1246         ;;
1247         
1248     chrp)
1249     aros_target_arch="chrp"
1250     aros_shared_default="no"
1251     aros_target_cpu="ppc"
1252     aros_object_format="elf32ppc"
1253     aros_flavour="ppcnative"
1254     aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1255     aros_kernel_ldflags=""
1256     aros_default_wbwidth=640
1257     aros_default_wbheight=480
1258     aros_config_cflags="$aros_config_cflags -mno-toc -fno-asynchronous-unwind-tables"    
1259     gcc_target_cpu="powerpc"
1260         case "$aros_target_variant" in
1261             efika)
1262             aros_config_cflags="$aros_config_cflags -DBIG_ENDIAN_OHCI=1 -mcpu=603e"
1263             ;;
1264         esac
1265     ;;
1267     amiga*)
1268         aros_target_arch="amiga"
1269         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D_AMIGA -DAMIGA"
1270         aros_shared_default="no"
1272         case "$target_cpu" in
1273             *m68k*)
1274                 AC_ARG_ENABLE(amigaos_compliance,AC_HELP_STRING([--enable-amigaos-compliance=VERSION],[Enforce userspace AmigaOS compliance to a specific KickStart version (default=none).]),aros_amigaos_compliance="$enableval")
1275                 aros_enable_mmu=no
1276                 aros_target_cpu="m68k"
1277                 aros_object_format="m68kelf"
1278                 aros_flavour="standcompat"
1279                 gcc_target_cpu="m68000"
1280                 aros_config_cflags="$aros_config_cflags -fno-strict-aliasing -ffreestanding -fomit-frame-pointer -${gcc_target_cpu} -fbuiltin -Wno-volatile-register-var -Os"
1281                 aros_config_aflags="$aros_config_aflags -${gcc_target_cpu}"
1282                 # Needed to get the correct multilib
1283                 aros_config_ldflags="-${gcc_target_cpu}"
1284                 aros_shared_ldflags="-${gcc_target_cpu}"
1285                 aros_kernel_ldflags="-${gcc_target_cpu}"
1286                 aros_target_nostdlib_ldflags="-${gcc_target_cpu}"
1287                 aros_target_strip_flags="-R.comment --strip-debug"
1288                 aros_default_wbwidth=640
1289                 aros_default_wbheight=256
1290                 aros_default_wbdepth=2
1291                 ;;
1292             *ppc*)
1293                 aros_cpu="ppc"
1294                 aros_flavour="native"
1295                 gcc_target_cpu="ppc"
1296                 ;;
1297             *)
1298                 AC_MSG_ERROR("Unknown CPU for Amiga $target_cpu")
1299                 ;;
1300         esac
1301         ;;
1303     mingw*)
1304         aros_target_arch="mingw32"
1305         aros_shared_default="no"
1306         aros_flavour="emulation"
1307         aros_shared_cflags=""
1308         need_dlopen="no"
1309         rescomp="windres"
1310         case "$target_cpu" in
1311             *i?86*)
1312                 aros_target_cpu="i386"
1313                 aros_object_format="elf_i386"
1314                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1315                 aros_default_wbdepth=8
1316                 gcc_target_cpu="i386"
1318                 dnl Temporary hack, needed to get nightly build working
1319                 aros_target_cpp="i386-aros-cpp"
1320                 aros_target_as="i386-aros-as"
1321                 aros_target_ar="i386-aros-ar"
1322                 aros_target_ranlib="i386-aros-ranlib"
1323                 aros_target_nm="i386-aros-nm"
1324                 aros_target_strip="i386-aros-strip"
1325                 aros_target_objcopy="i386-aros-objcopy"
1326                 aros_target_objdump="i386-aros-objdump"
1328                 kernel_tool_prefix="i386-mingw32-"
1329                 ;;
1330             *x86_64*)
1331                 aros_target_cpu="x86_64"
1332                 aros_object_format="elf_x86_64"
1333                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
1334                 aros_config_cflags="$aros_config_cflags -fno-omit-frame-pointer"
1335                 aros_default_wbdepth=8
1336                 kernel_tool_prefix="x86_64-w64-mingw32-"
1337                 ;;
1338             *arm*)
1339                 aros_target_cpu="arm"
1340                 aros_object_format="armelf_linux_eabi"
1341                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
1342                 aros_arch_libs="-laeabi"
1343                 aros_default_wbdepth=8
1344                 gcc_target_cpu="arm"
1345                 gcc_default_float_abi="soft"
1346                 kernel_tool_prefix="arm-mingw32ce-"
1347                 aros_default_wbwidth=160
1348                 aros_default_wbheight=160
1349                 ;;
1350             *)
1351                 AC_MSG_ERROR("Unknown CPU for Mingw32 -- $target_cpu")
1352                 ;;
1353         esac
1354         if test $host_os = "cygwin"; then
1355                 aros_kernel_cflags="-mno-cygwin"
1356         fi
1357     ;;
1358     pp*)
1359         aros_target_arch="pp"
1360         aros_shared_default="no"
1361         case "$target_cpu" in
1362             *m68k*)
1363                 aros_target_cpu="m68k"
1364                 aros_object_format="m68kelf"
1365                 aros_flavour="palmnative"
1366                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
1367                 aros_default_wbwidth=160
1368                 aros_default_wbheight=160
1369                 aros_default_wbdepth=1
1370                 aros_target_ar_flags="cru"
1371                 aros_compiler_libs="-lgcc1"
1372                 aros_shared_default=no
1373                 aros_shared_cflags="-fpic"
1374                 aros_shared_aflags=""
1375                 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
1376                 aros_kernel_ldflags="-Wl,-rpath,./lib"
1377                 aros_debug_cflags="$aros_symbols_debug  $aros_messages_debug -mc68000 -Wa,-mc68000"
1378                 aros_debug_aflags=""
1379                 aros_debug_ldflags="$aros_symbols_debug"
1380                 aros_mungwall_debug="0"
1381                 aros_modules_debug="0"
1382                 gcc_target_cpu="mc68000"
1383                 ignore_undefined_symbols="-ius"
1384                 ;;
1385            *)
1386                 AC_MSG_ERROR("Unknown CPU for PalmPilot -- $target_cpu")
1387                 ;;
1388         esac
1389         ;;
1391     mac*)
1392         aros_target_arch="mac"
1393         aros_shared_default="no"
1394         case "$target_cpu" in
1395             *m68k*)
1396                 aros_target_cpu="m68k"
1397                 aros_object_format="m68kelf"
1398                 aros_flavour="mac68knative"
1399                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
1400                 aros_default_wbwidth=512
1401                 aros_default_wbheight=384
1402                 aros_default_wbdepth=8
1403                 aros_target_ar_flags="cru"
1404                 aros_compiler_libs="-lgcc1"
1405                 aros_shared_default=no
1406                 aros_shared_cflags="-fpic"
1407                 aros_shared_aflags=""
1408                 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
1409                 aros_kernel_ldflags="-Wl,-rpath,./lib"
1410                 aros_debug_cflags="$aros_symbols_debug $aros_messages_debug -mc68000"
1411                 aros_debug_aflags=""
1412                 aros_debug_ldflags="$aros_symbols_debug"
1413                 aros_mungwall_debug="0"
1414                 aros_modules_debug="0"
1415                 gcc_target_cpu="mc68000"
1416                 ignore_undefined_symbols="-ius"
1417                 ;;
1418            *)
1419                 AC_MSG_ERROR("Unknown CPU for Mac68k -- $target_cpu")
1420                 ;;
1421         esac
1422         ;;
1424     *)
1425         AC_MSG_ERROR([Unsupported target architecture $target])
1426         ;;
1427 esac
1429 AC_MSG_CHECKING([Kernel tool prefix])
1430 AC_ARG_WITH(kernel-tool-prefix,AC_HELP_STRING([--with-kernel-tool-prefix=...],[Specify crosscompile toolchain prefix for kernel objects]),kernel_tool_prefix="$withval")
1431 AC_MSG_RESULT($kernel_tool_prefix)
1433 # Now process extra architecture-specific options.
1434 # Currently this is implemented only for ARM. We can specify which minimum CPU and FPU to use,\
1435 # as well as floating-point ABI.
1436 case "$aros_target_cpu" in
1437 arm)
1438     dnl ARM defaults are: armv6 + vfp (unless overriden in per-target section above)
1439     if test "$gcc_default_cpu" = ""; then
1440         gcc_default_cpu="armv6"
1441     fi
1442     if test "$gcc_default_fpu" = ""; then
1443         gcc_default_fpu="vfp"
1444     fi
1445     if test "$gcc_default_float_abi" = ""; then
1446         gcc_default_float_abi="softfp"
1447     fi
1449     AC_MSG_CHECKING([Which minimum CPU to use])
1450     AC_ARG_WITH(cpu,AC_HELP_STRING([--with-cpu=<spec>],[Specify minumum CPU (default=$gcc_default_cpu).]),aros_gcc_cpu="$withval",aros_gcc_cpu=$gcc_default_cpu)
1451     AC_MSG_RESULT($aros_gcc_cpu)
1453     AC_MSG_CHECKING([Which minimum FPU to use])
1454     AC_ARG_WITH(fpu,AC_HELP_STRING([--with-fpu=<spec>],[Specify minumum FPU (default=$gcc_default_fpu).]),aros_gcc_fpu="$withval",aros_gcc_fpu=$gcc_default_fpu)
1455     AC_MSG_RESULT($aros_gcc_fpu)
1457     AC_MSG_CHECKING([Which floating point ABI to use])
1458     AC_ARG_WITH(float,AC_HELP_STRING([--with-float=<spec>],[Specify floating point ABI (default=$gcc_default_float_abi).]),aros_gcc_float_abi="$withval",aros_gcc_float_abi=$gcc_default_float_abi)
1459     AC_MSG_RESULT($aros_gcc_float_abi)
1461     aros_config_cflags="$aros_config_cflags -marm -mthumb-interwork -march=$aros_gcc_cpu -mfpu=$aros_gcc_fpu -mfloat-abi=$aros_gcc_float_abi -fno-asynchronous-unwind-tables -fno-exceptions"
1462     aros_config_aflags="$aros_config_aflags -marm -mthumb-interwork -march=$aros_gcc_cpu -mfpu=$aros_gcc_fpu -mfloat-abi=$aros_gcc_float_abi -fno-asynchronous-unwind-tables -fno-exceptions"
1463     ;;
1464 esac
1466 # Some formats need custom ELF specs.
1467 # For example for x86_64 it is needed in order for -m32 switch to work correctly.
1468 if test -f $SRCDIR/config/${aros_object_format}-specs.in; then
1469     elf_specs_in=config/${aros_object_format}-specs.in
1470 else
1471     elf_specs_in=config/elf-specs.in
1474 #-----------------------------------------------------------------------------
1475 AC_MSG_CHECKING([where to install or search for cross tools binaries])
1476 AC_ARG_WITH(crosstools,AC_HELP_STRING([--with-crosstools=DIR],[Where to install or search for cross tools binaries]),with_crosstools=$withval,with_crosstools="default")
1477 if test "$with_crosstools" = "default"; then
1478     AROS_CROSSTOOLSDIR="$AROS_BUILDDIR_UNIX/bin/$aros_host_arch-$aros_host_cpu/tools/crosstools"
1479 else
1480     AROS_CROSSTOOLSDIR="$with_crosstools"
1482 AC_MSG_RESULT($AROS_CROSSTOOLSDIR)
1484 if test "$crosstools" != "no" -o "$with_crosstools" != "default"; then
1486     dnl --with-crosstools with no --enable-crosstools implies --with-aros-gcc with no version specified
1487     dnl The same is about --enable-crosstools
1489     use_aros_gcc=yes
1490     PATH=$AROS_CROSSTOOLSDIR:$PATH
1493 AC_MSG_CHECKING([what specific AROS gcc version to use])
1494 AC_ARG_WITH(aros-gcc,AC_HELP_STRING([--with-aros-gcc=VERSION],[Use aros-gcc-VERSION for building AROS]),aros_gcc_version="$withval",aros_gcc_version="$use_aros_gcc")
1495 case "$aros_gcc_version" in
1496 yes)
1497     aros_gcc_version="default"
1498     ;;
1500     aros_gcc_version="none"
1501     ;;
1502 esac
1503 AC_MSG_RESULT($aros_gcc_version)
1505 if test "$aros_gcc_version" != "none"; then
1507     dnl Here we either build own crosstools, or use preinstalled ones
1508     dnl Check for specific version requested, and append suffix if needed
1510     if test "$aros_gcc_version" != "default"; then
1511         aros_target_cc="${target_tool_prefix}gcc-$aros_gcc_version"
1512         aros_target_cxx="${target_tool_prefix}g++-$aros_gcc_version"
1513     else
1514         aros_target_cc="${target_tool_prefix}gcc"
1515         aros_target_cxx="${target_tool_prefix}g++"
1516     fi
1518     aros_target_cpp="${target_tool_prefix}cpp"
1519     aros_target_ld="${target_tool_prefix}ld"
1520     aros_target_as="${target_tool_prefix}as"
1521     aros_target_ar="${target_tool_prefix}ar"
1522     aros_target_ranlib="${target_tool_prefix}ranlib"
1523     aros_target_nm="${target_tool_prefix}nm"
1524     aros_target_strip="${target_tool_prefix}strip"
1525     aros_target_objcopy="${target_tool_prefix}objcopy"
1526     aros_target_objdump="${target_tool_prefix}objdump"
1528     dnl Check for specific version requested, and append suffix if needed
1530     if test "$aros_gcc_version" != "default"; then
1531         aros_kernel_cc="${kernel_tool_prefix}gcc-$aros_gcc_version"
1532         aros_kernel_cxx="${kernel_tool_prefix}g++-$aros_gcc_version"
1533     else
1534         aros_kernel_cc="${kernel_tool_prefix}gcc"
1535         aros_kernel_cxx="${kernel_tool_prefix}g++"
1536     fi
1538     aros_kernel_cpp="${kernel_tool_prefix}cpp"
1539     aros_kernel_ld="${kernel_tool_prefix}ld"
1540     aros_kernel_as="${kernel_tool_prefix}as"
1541     aros_kernel_ar="${kernel_tool_prefix}ar"
1542     aros_kernel_ranlib="${kernel_tool_prefix}ranlib"
1543     aros_kernel_nm="${kernel_tool_prefix}nm"
1544     aros_kernel_strip="${kernel_tool_prefix}strip"
1545     aros_kernel_objcopy="${kernel_tool_prefix}objcopy"
1546     aros_kernel_objdump="${kernel_tool_prefix}objdump"
1549 # Some compilers (ppc-elf-gcc is known to) have CPU defines in specs
1550 # Since we override specs, we may need to put these defines there
1551 if test "$gcc_target_cpu" != ""; then
1552     gcc_target_cpu="-D__${gcc_target_cpu}__"
1555 AC_MSG_CHECKING([where to download sourcecode for external ports])
1556 AC_ARG_WITH(portssources,AC_HELP_STRING([--with-portssources=DIR],[Where to download sourcecode for external ports]),with_portssrcdir=$withval,with_portssrcdir="default")
1557 if test "$with_portssrcdir" = "default"; then
1558     AROS_PORTSSRCDIR="$AROS_BUILDDIR_UNIX/bin/Sources"
1559 else
1560     AROS_PORTSSRCDIR="$with_portssrcdir"
1562 AC_MSG_RESULT($AROS_PORTSSRCDIR)
1564 AC_MSG_CHECKING([which bootloader to use])
1565 AC_ARG_WITH(bootloader,AC_HELP_STRING([--with-bootloader=NAME],[Use a specific bootloader]),target_bootloader=$withval,target_bootloader=$target_bootloader)
1566 if test "$target_bootloader" = "none"; then
1567     aros_target_bootloader=""
1568 else
1569     aros_target_bootloader="$target_bootloader"
1571 AC_MSG_RESULT($target_bootloader)
1573 AC_MSG_CHECKING([which icon-set to use])
1574 AC_ARG_WITH(iconset,AC_HELP_STRING([--with-iconset=NAME],[Use a specific Icon-set (default=Gorilla).]),target_iconset=$withval,target_iconset="default")
1575 if test "$target_iconset" = "default"; then
1576     aros_target_iconset="Gorilla"
1577     target_iconset="default (Gorilla)"
1578 else
1579     aros_target_iconset="$target_iconset"
1581 AC_MSG_RESULT($target_iconset)
1583 AC_MSG_CHECKING([which GUI Theme to use])
1584 AC_ARG_WITH(theme,AC_HELP_STRING([--with-theme=NAME],[Use a specific GUI Theme]),target_guitheme=$withval,target_guitheme="default")
1585 if test "$target_guitheme" = "default"; then
1586     aros_target_guitheme="Ice"
1587 else
1588     aros_target_guitheme="$target_guitheme"
1590 AC_MSG_RESULT($aros_target_guitheme)
1592 # Find out if we are cross-compiling (i.e. if we can't use the host compiler
1593 # for target code)
1594 cross_compiling=no
1595 if test "$aros_host_cpu" != "$aros_target_cpu" ; then
1596     cross_compiling=yes
1599 dnl Native x86-64 Linux toolchain can also produce i386 binaries, given -m32 flag.
1600 if test "$aros_host_cpu" == "x86_64" ; then
1601     if test "$aros_target_cpu" == "i386" ; then
1602         if test "$aros_target_arch" != "mingw32"; then
1603             cross_compiling=no
1604         fi
1605     fi
1608 dnl Enforce cross-compile if we are on Darwin, but our target is not Darwin.
1609 dnl If target is Darwin disable cross-compiling otherwise kernel 
1610 dnl not setup correctly.
1611 if test "$aros_host_arch" == "darwin" ; then
1612     if test "$aros_target_arch" != "darwin" ; then
1613         cross_compiling=yes
1614     else
1615         cross_compiling=no
1616     fi
1619 dnl The same for MinGW
1620 if test "$aros_host_arch" == "mingw32" ; then
1621     if test "$aros_target_arch" != "mingw32" ; then
1622         cross_compiling=yes
1623     fi
1626 # I want to have this information in configure output, although it might be
1627 # misleading, e.g. for darwin hosted you cannot compile target code without a
1628 # cross compiler, but here it says no.
1630 # Note: it says 'yes' only if bootstrap ("kernel") is cross-compiled.
1631 # Target code is a little bit different thing.
1632 #                                                sonic
1633 echo "checking whether we are (AROS style) cross compiling... $cross_compiling"
1635 # Set prefix for target compiler etc. if we're cross-compiling
1636 # (should possibly be earlier but needs to be after AC_PROG_CC)
1637 if test "$cross_compiling" = "yes" ; then
1639     if test "x-$aros_flavour" = "x-standalone" -o "x-$aros_flavour" = "x-standcompat" ; then
1640         if test "$aros_gcc_version" != "none"; then
1642             dnl If we are cross-compiling a native port with AROS compiler, we can reuse
1643             dnl AROS compiler for bootstrap ("kernel"). This eliminates a need for one more
1644             dnl ELF compiler.
1646             dnl Use target toolchain as bootstrap one.
1647             target_tool_prefix=${target_cpu}-aros-
1648             target_tool_version=$aros_gcc_version
1649             use_kernel_cc_wrapper=yes
1651             dnl Cancel explicit AROS tools assignment. This will cause configure
1652             dnl to select the same tools for bootstrap and AROS.
1653             if test "$crosstools" != yes; then
1654                 aros_target_cc=
1655                 aros_target_ld=
1656                 aros_target_cpp=
1657                 aros_target_as=
1658                 aros_target_ar=
1659                 aros_target_ranlib=
1660                 aros_target_nm=
1661                 aros_target_strip=
1662                 aros_target_objcopy=
1663                 aros_target_objdump=
1664             fi
1665         fi
1666     fi
1668     aros_kernel_cc=${kernel_tool_prefix}gcc
1669     if test "$kernel_tool_version" != "default"; then
1670         aros_kernel_cc="${aros_kernel_cc}-$kernel_tool_version"
1671     fi
1673 AROS_TOOL_KERNEL(aros_kernel_cpp,cpp,$aros_kernel_cpp)
1674 AROS_REQUIRED(cpp,$aros_kernel_cpp)
1675 AROS_TOOL_KERNEL(aros_kernel_cc,gcc,$aros_kernel_cc)
1676 AROS_REQUIRED(cc,$aros_kernel_cc)
1677 CC="$aros_kernel_cc $kernel_tool_flags"
1678 CPP="$aros_kernel_cpp"
1680 #-----------------------------------------------------------------------------
1682 # Disable pointer-signedness warnings if the compiler recognises the option
1684 AC_MSG_CHECKING([whether ${CC} accepts -Wno-pointer-sign])
1685 save_cflags="$CFLAGS"
1686 if test "$crosstools" != "yes" ; then
1687     CFLAGS="$CFLAGS -Wno-pointer-sign"
1688     AC_TRY_COMPILE(,, use_no_sign_warning="yes", use_no_sign_warning="no")
1689 else
1690     # we do know it is supported for the smallest version of gcc we are going to build
1691     # we assume it's also supported by later versions
1692     use_no_sign_warning=yes
1694 AC_MSG_RESULT($use_no_sign_warning)
1695 if test "x-$use_no_sign_warning" = "x-yes" ; then
1696     aros_config_cflags="$aros_config_cflags -Wno-pointer-sign"
1698 CFLAGS="$save_cflags"
1700 #-----------------------------------------------------------------------------
1702 # Find all the tools we need to compile. This could be cross-compiling
1703 # though! If that is the case we use the GNU form of the target and
1704 # simply add this to the front of the binary name. This is rather simple,
1705 # but it should work under most circumstances.
1707 # The default tools are to use the same as the host, but only if the
1708 # host and target CPU are the same. With GCC this is normally enough.
1711 aros_cc_pre=""
1712 aros_shared_ld="$aros_host_ld"
1714 aros_target_mkdep="$aros_host_mkdep"
1716 # The default tools executables to be linked to.
1717 if test "$rescomp" != ""; then
1718     AROS_TOOL_KERNEL(aros_kernel_rescomp,$rescomp)
1719     AROS_REQUIRED($rescomp,$aros_kernel_rescomp)
1722 if test "$crosstools" != "yes"; then
1724     dnl For non-ELF hosts we additionally have to look up ELF toolchain for AROS binaries
1725     dnl It can be either AROS toolchain selected earlier or generic ELF toolchain we select here.
1726     dnl This catches also Android-hosted case. Android gcc is a ELF compiler, but it can't be used
1727     dnl to build AROS binaries, at least on ARM. Android EABI is different from AROS EABI
1728     dnl (at least enum size is known to be different).
1729     if test "$target_tool_prefix" != "${target_cpu}-elf-" -a "$target_tool_prefix" != "${target_cpu}-aros-" ; then
1730         target_tool_prefix=${target_cpu}-elf-
1731         if test "$aros_target_cc" == ""; then
1732            aros_target_cc="${target_tool_prefix}gcc"
1733         fi
1734         if test "$aros_target_ld" == ""; then
1735            aros_target_ld="${target_tool_prefix}ld"
1736         fi
1737         if test "$aros_target_cpp" == ""; then
1738            aros_target_cpp="${target_tool_prefix}cpp"
1739         fi
1740     fi
1741     AROS_TOOL_TARGET(aros_target_as_ln,as,$aros_target_as)
1742     AROS_REQUIRED(as,$aros_target_as_ln)
1743     AROS_TOOL_TARGET(aros_target_ar_ln,ar,$aros_target_ar)
1744     AROS_REQUIRED(ar,$aros_target_ar_ln)
1745     AROS_TOOL_TARGET(aros_target_nm_ln,nm,$aros_target_nm)
1746     AROS_REQUIRED(nm,$aros_target_nm_ln)
1747     AROS_TOOL_TARGET(aros_target_objcopy_ln,objcopy,$aros_target_objcopy)
1748     AROS_REQUIRED(objcopy,$aros_target_objcopy_ln)
1749     AROS_TOOL_TARGET(aros_target_objdump_ln,objdump,$aros_target_objdump)
1750     AROS_REQUIRED(objdump,$aros_target_objdump_ln)
1751     AROS_TOOL_TARGET(aros_target_ranlib_ln,ranlib,$aros_target_ranlib)
1752     AROS_REQUIRED(ranlib,$aros_target_ranlib_ln)
1753     AROS_TOOL_TARGET(aros_target_strip_ln,strip,$aros_target_strip)
1754     AROS_REQUIRED(strip,$aros_target_strip_ln)
1755     if test "$aros_target_cxx" != ""; then
1756         AC_PATH_PROG(aros_target_cxx,$aros_target_cxx)
1757         AROS_REQUIRED(c++,$aros_target_cxx)
1758     fi
1759 else
1760     aros_target_cc=$AROS_CROSSTOOLSDIR/$aros_target_cc
1761     aros_target_cxx=$AROS_CROSSTOOLSDIR/$aros_target_cxx
1762     aros_target_cpp=$AROS_CROSSTOOLSDIR/$aros_target_cpp
1763     aros_target_as_ln=$AROS_CROSSTOOLSDIR/$aros_target_as
1764     aros_target_ar_ln=$AROS_CROSSTOOLSDIR/$aros_target_ar
1765     aros_target_nm_ln=$AROS_CROSSTOOLSDIR/$aros_target_nm
1766     aros_target_objcopy_ln=$AROS_CROSSTOOLSDIR/$aros_target_objcopy
1767     aros_target_objdump_ln=$AROS_CROSSTOOLSDIR/$aros_target_objdump
1768     aros_target_ranlib_ln=$AROS_CROSSTOOLSDIR/$aros_target_ranlib
1769     aros_target_strip_ln=$AROS_CROSSTOOLSDIR/$aros_target_strip
1771     crosstools_target=tools-crosstools
1774 AROS_TOOL_TARGET(aros_kernel_cpp,cpp,$aros_kernel_cpp)
1775 AROS_REQUIRED(cpp,$aros_kernel_cpp)
1776 AROS_TOOL_TARGET(aros_kernel_ld,ld,$aros_kernel_ld)
1777 AROS_REQUIRED(ld,$aros_kernel_ld)
1778 AROS_TOOL_TARGET(aros_kernel_ar,ar,$aros_kernel_ar)
1779 AROS_REQUIRED(ld,$aros_kernel_ar)
1780 AROS_TOOL_TARGET(aros_kernel_ranlib,ranlib,$aros_kernel_ranlib)
1781 AROS_REQUIRED(ld,$aros_kernel_ranlib)
1783 aros_kernel_cc="$aros_kernel_cc $kernel_tool_flags"
1784 aros_kernel_ar="$aros_kernel_ar $aros_kernel_ar_flags"
1786 orig_target_cpp=$aros_kernel_cpp
1787 orig_target_cc=$aros_kernel_cc
1788 orig_target_ld=$aros_kernel_ld
1790 if test "$crosstools" != "yes"; then
1791     if test "$aros_target_cc" != ""; then
1792         AC_PATH_PROG(aros_target_cc,$aros_target_cc)
1793         AROS_REQUIRED(gcc,$aros_target_cc)
1794         orig_target_cc=$aros_target_cc
1795     fi
1796     if test "$aros_target_ld" != ""; then
1797         AC_PATH_PROG(aros_target_ld,$aros_target_ld)
1798         AROS_REQUIRED(ld,$aros_target_ld)
1799         orig_target_ld=$aros_target_ld
1800     fi
1801     if test "$aros_target_cpp" != ""; then
1802         AC_PATH_PROG(aros_target_cpp,$aros_target_cpp)
1803         AROS_REQUIRED(cpp,$aros_target_cpp)
1804         orig_target_cpp=$aros_target_cpp
1805     fi
1806 else
1807     orig_target_cc=$aros_target_cc
1808     orig_target_ld=$aros_target_ld
1809     orig_target_cpp=$aros_target_cpp
1812 # Build crosstools if we have no C++ - temporary thing 
1813 if test "$aros_target_cxx" = "" -a "$crosstools" != "yes"; then
1814     crosstools_cxx_target=tools-crosstools
1817 aros_hostcfg_dir="bin/${aros_host_arch}-${aros_host_cpu}/gen/config"
1818 aros_targetcfg_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/config"
1819 aros_inc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/AROS/Development/include/aros"
1820 aros_gendir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen"
1821 aros_geninc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/include/aros"
1822 aros_tools_dir="bin/${aros_host_arch}-${aros_host_cpu}/tools"
1823 aros_scripts_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/scripts"
1825 # aros_cc_pre is a variable that is added to the front of the compiler name
1826 # in the generated aros-gcc shell script. We need this to enable the cache
1827 # to work across cleaned builds. Also, support DISTCC using the correct
1828 # environment variable.
1831 if test "x${DISTCC}" != "x" ; then
1832     if test "x${CCACHE}" != "x" ; then
1833         aros_cc_pre="env CCACHE_PREFIX=${DISTCC} ${CCACHE} "
1834     else
1835         aros_cc_pre="${DISTCC} "
1836     fi
1837 else
1838     if test "x${CCACHE}" != "x" ; then
1839         aros_cc_pre="${CCACHE} "
1840     fi
1843 prefix="${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros"
1845 AC_SUBST(aros_target_nostdinc_cflags,-nostdinc)
1846 AC_SUBST(aros_target_nostartup_ldflags,-nostartfiles)
1847 AC_SUBST(aros_target_nix_ldflags,-nix)
1848 AC_SUBST(aros_target_detach_ldflags,-detach)
1849 AC_SUBST(aros_target_nostdlib_ldflags,-nostdlib)
1851 # Target tools
1852 if test "$crosstools" != "yes"; then
1853     if test "$GCC" = "yes"; then
1854         aros_target_cc_path=`$orig_target_cc -print-search-dirs | grep "programs: =" | cut -c 12-`
1855     fi
1856 else
1857     # We do not know which gcc version we are going to build and what we need to know
1858     # here is different for different versions so this will be set later during the
1859     # build of crosstools.
1860     aros_target_cc_path=@aros_target_cc_path@
1862 aros_target_cpp="${prefix}-cpp"
1863 aros_target_cc="${prefix}-gcc"
1864 aros_target_as="${prefix}-as"
1865 aros_target_ld="${prefix}-ld"
1866 aros_target_ar="${prefix}-ar $aros_target_ar_flags"
1867 aros_target_objcopy=${prefix}-objcopy
1868 aros_target_objdump=${prefix}-objdump
1869 aros_target_ranlib="${prefix}-ranlib $aros_target_ranlib_flags"
1870 aros_target_nm="${prefix}-nm $aros_target_nm_flags"
1871 aros_target_strip=${prefix}-strip
1872 aros_plain_nm="${prefix}-nm"
1873 aros_plain_ar="${prefix}-ar"
1875 if test "$aros_kernel_includes" != "" ; then
1876     dnl find out about the kernel cc's include path
1877     AC_MSG_CHECKING([for the kernel compiler's include path])
1878     if test "$aros_kernel_cc_includes" = "" ; then
1879         # Try to guess where the directory is.
1880         aros_kernel_cc_includes=`dirname \`${aros_kernel_cc} ${aros_kernel_cflags} -print-libgcc-file-name\``/include
1881         if test -d $aros_kernel_cc_includes; then
1882             # Check if there is also an include-fixed directory and add it
1883             # to kernel compiler's include path as it may contain some of
1884             # the headers we need.
1885             if test -d "$aros_kernel_cc_includes"-fixed; then
1886                 aros_kernel_cc_includes+=" -isystem $aros_kernel_cc_includes"-fixed
1887             fi
1888             # Check for specific includes directory. Neede for Ubuntu 11.10
1889             if test -d "/usr/include/i386-linux-gnu"; then
1890                 aros_kernel_cc_includes+=" -isystem /usr/include/i386-linux-gnu"
1891             fi
1892         else
1893             # The directory doesn't exist, we need to do some more work.
1894             aros_kernel_cc_includes=${PWD}/${aros_gendir}/cc_include
1896             # These are the headers we're looking for.
1897             headers="limits.h mmintrin.h stdbool.h syslimits.h float.h \
1898                      stddef.h xmmintrin.h iso646.h stdarg.h unwind.h   \
1899                      zutil.h stdint.h"
1901             dirs=
1902             for h in $headers; do
1903                 # Which other headers are needed by each of the above?
1904                 deps=$(echo "#include <$h>" | \
1905                        $aros_kernel_cc -E -M - 2>/dev/null | \
1906                        sed 's/^.*://; s/\\$/ /g; s/[[ \t]]\+/ /g')
1908                 # Copy all the needed headers to a directory beneath gendir.
1909                 for d in $deps; do
1910                     h=$(basename $d)
1911                     dir=${aros_kernel_cc_includes}$(echo $(dirname $d) | \
1912                                                 sed -n "s,^.*/include\(/.*\),\1,p")
1913                     ! test -d $dir && mkdir -p $dir
1914                     ! test -f $dir/$h && { cp $d $dir; chmod u+w $dir/$h; }
1915                 done
1916             done            
1917         fi
1918     fi
1919     AC_MSG_RESULT($aros_kernel_cc_includes)
1920     # Adding -nostdinc to kernel includes as they are always used together.
1921     aros_kernel_includes="$aros_kernel_includes $aros_target_nostdinc_cflags -isystem $aros_kernel_cc_includes"
1924 if test "$crosstools" != "yes"; then
1925     dnl find out about the target cc's include path
1926     AC_MSG_CHECKING([for the target compiler's include path])
1927     if test "$aros_target_cc_includes" = "" ; then
1928         #try to guess where the directory is
1929         aros_target_cc_includes=`dirname \`${orig_target_cc} -print-libgcc-file-name\``/include
1930         if ! test -d $aros_target_cc_includes; then
1931             #the directory doesn't exist, we need to do some more work
1932             aros_target_cc_includes=${PWD}/${aros_gendir}/cc_include
1933         
1934             #these are the headers we're looking for
1935             headers="limits.h mmintrin.h stdbool.h syslimits.h float.h \
1936                     stddef.h xmmintrin.h iso646.h stdarg.h unwind.h   \
1937                     zutil.h"
1939             dirs=
1940             for h in $headers; do
1941                 #which other headers each of the above headers needs?
1942                 deps=$(echo "#include <$h>" | \
1943                     $orig_target_cc -E -M - 2>/dev/null | \
1944                     sed 's/^.*://; s/\\$/ /g; s/[[ \t]]\+/ /g')
1945             
1946                 #copy all the needed headers to a directory beneath gendir
1947                 for d in $deps; do
1948                     h=$(basename $d)
1949                     dir=${aros_target_cc_includes}$(echo $(dirname $d) | \
1950                                                 sed -n "s,^.*/include\(/.*\),\1,p")
1951                     ! test -d $dir && mkdir -p $dir
1952                     ! test -f $dir/$h && { cp $d $dir; chmod u+w $dir/$h; }
1953                 done
1954             done
1955         fi
1956     fi
1957     AC_MSG_RESULT($aros_target_cc_includes)
1958 else
1959     # We do not know which gcc version we are going to build and what we need to know
1960     # here is different for different versions so this will be set later during the
1961     # build of crosstools.
1962     aros_target_cc_includes=@aros_target_cc_includes@
1966 # For GCC < 4.0 -I- is used for giving the search path for '#include "..."'
1967 # On GCC >= 4.0 -iquote should be used
1970 save_cc="$CC"
1971 save_cflags="$CFLAGS"
1972 CFLAGS="-iquote."
1973 AC_MSG_CHECKING([whether ${CC} accepts -iquote])
1974 if test "x-$crosstools" != "x-yes"; then
1975     AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
1976 else
1977     # we do know it is supported for the smallest version of gcc we are going to build
1978     # we assume it's also supported by later versions
1979     has_iquote=yes
1981 AC_MSG_RESULT($has_iquote)
1982 if test "x-$has_iquote" = "x-yes" ; then
1983     host_cflags_iquote=-iquote
1984     host_cflags_iquote_end=
1985 else
1986     host_cflags_iquote=-I
1987     host_cflags_iquote_end=-I-
1989 kernel_cflags_iquote=$host_cflags_iquote
1990 kernel_cflags_iquote_end=$host_cflags_iquote_end
1991 if test "x-$cross_compiling" = "x-yes"; then
1992     CC="$aros_kernel_cc"
1993     AC_MSG_CHECKING([whether ${CC} accepts -fno-stack-protector])
1994     if test "x-$crosstools" != "x-yes"; then
1995         AC_TRY_COMPILE(,, use_no_stack_protector="yes", use_no_stack_protector="no")
1996     else
1997         # we do know it is supported for the smallest version of gcc we are going to build
1998         # we assume it's also supported by later versions
1999         use_no_stack_protector=yes
2000     fi
2001     AC_MSG_RESULT($use_no_stack_protector)
2002     AC_MSG_CHECKING([whether ${CC} accepts -iquote])
2003     if test "x-$crosstools" != "x-yes"; then
2004         AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
2005     else
2006         # we do know it is supported for the smallest version of gcc we are going to build
2007         # we assume it's also supported by later versions
2008         has_iquote=yes
2009     fi
2010     AC_MSG_RESULT($has_iquote)
2011     if test "x-$has_iquote" = "x-yes" ; then
2012         kernel_cflags_iquote=-iquote
2013         kernel_cflags_iquote_end=
2014     else
2015         kernel_cflags_iquote=-I
2016         kernel_cflags_iquote_end=-I-
2017     fi
2019 aros_cflags_iquote=$kernel_cflags_iquote
2020 aros_cflags_iquote_end=$kernel_cflags_iquote_end
2021 if test "$orig_target_cc" != "$aros_kernel_cc"; then
2022     CC="$orig_target_cc"
2023     AC_MSG_CHECKING([whether ${CC} accepts -iquote])
2024     if test "x-$crosstools" != "x-yes"; then
2025         AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
2026     else
2027         # we do know it is supported for the smallest version of gcc we are going to build
2028         # we assume it's also supported by later versions
2029         has_iquote=yes
2030     fi
2031     AC_MSG_RESULT($has_iquote)
2032     if test "x-$has_iquote" = "x-yes" ; then
2033         aros_cflags_iquote=-iquote
2034         aros_cflags_iquote_end=
2035     else
2036         aros_cflags_iquote=-I
2037         aros_cflags_iquote_end=-I-
2038     fi
2040 if test "x-$use_no_stack_protector" = "x-yes" ; then
2041     aros_kernel_cflags="$aros_kernel_cflags -fno-stack-protector"
2045 #-----------------------------------------------------------------------------
2047 # Check if the target compiler supports some options used for delinting:
2048 #  -Wunused-but-set-variable
2049 #  -Warray-bounds
2050 #  -Wenum-compare
2051 #  -Wstrict-overflow
2052 #  -Wformat-security
2054 if test "x-$crosstools" != "x-yes"; then
2055     if test "$orig_target_cc" != "$aros_kernel_cc"; then
2056         CC="$orig_target_cc"
2057     fi
2058     AC_MSG_CHECKING([whether ${CC} accepts -Wunused-but-set-variable])
2059     CFLAGS=-Wunused-but-set-variable
2060     AC_TRY_COMPILE(,, aros_unused_but_set_variable="yes", aros_unused_but_set_variable="no")
2061     AC_MSG_RESULT($aros_unused_but_set_variable)
2062     if test "x-$aros_unused_but_set_variable" = "x-yes" ; then
2063         aros_cflags_unused_but_set_variable=-Wno-unused-but-set-variable
2064     fi
2066     AC_MSG_CHECKING([whether ${CC} accepts -Warray-bounds])
2067     CFLAGS=-Warray-bounds
2068     AC_TRY_COMPILE(,, aros_array_bounds="yes", aros_array_bounds="no")
2069     AC_MSG_RESULT($aros_array_bounds)
2070     if test "x-$aros_array_bounds" = "x-yes" ; then
2071         aros_cflags_array_bounds=-Wno-array-bounds
2072     fi
2074     AC_MSG_CHECKING([whether ${CC} accepts -Wenum-compare])
2075     CFLAGS=-Wenum-compare
2076     AC_TRY_COMPILE(,, aros_enum_compare="yes", aros_enum_compare="no")
2077     AC_MSG_RESULT($aros_enum_compare)
2078     if test "x-$aros_enum_compare" = "x-yes" ; then
2079         aros_cflags_enum_compare=-Wno-enum-compare
2080     fi
2082     AC_MSG_CHECKING([whether ${CC} accepts -Wstrict-overflow])
2083     CFLAGS=-Wstrict-overflow
2084     AC_TRY_COMPILE(,, aros_strict_overflow="yes", aros_strict_overflow="no")
2085     AC_MSG_RESULT($aros_strict_overflow)
2086     if test "x-$aros_strict_overflow" = "x-yes" ; then
2087         aros_cflags_strict_overflow=-Wno-strict-overflow
2088     fi
2090     AC_MSG_CHECKING([whether ${CC} accepts -Wformat-security])
2091     CFLAGS=-Wformat-security
2092     AC_TRY_COMPILE(,, aros_format_security="yes", aros_format_security="no")
2093     AC_MSG_RESULT($aros_format_security)
2094     if test "x-$aros_format_security" = "x-yes" ; then
2095         aros_cflags_format_security=-Wno-format-security
2096     fi
2097 else
2098     # We do not know which gcc version we are going to build and what we need to know
2099     # here is different for different versions so this will be set later during the
2100     # build of crosstools.
2101     aros_cflags_unused_but_set_variable=@aros_cflags_unused_but_set_variable@
2102     aros_cflags_array_bounds=@aros_cflags_array_bounds@
2103     aros_cflags_enum_compare=@aros_cflags_enum_compare@
2104     aros_cflags_strict_overflow=@aros_cflags_strict_overflow@
2105     aros_cflags_format_security=@aros_cflags_format_security@
2108 #-----------------------------------------------------------------------------
2110 # Check if we can explicitly choose older version of symbol hashing
2112 CFLAGS="save_cflags -Wl,--hash-style=sysv"
2113 CC="$aros_kernel_cc"
2114 AC_MSG_CHECKING([whether ${CC} accepts -Wl,--hash-style=sysv])
2115 AC_TRY_LINK(,, use_hash_style="yes", use_hash_style="no")
2116 AC_MSG_RESULT($use_hash_style)
2117 if test "x-$use_hash_style" = "x-yes" ; then
2118     aros_kernel_cflags="$aros_kernel_cflags -Wl,--hash-style=sysv"
2120 CC="$save_cc"
2121 CFLAGS="$save_cflags"
2123 AC_SUBST(host_cflags_iquote)
2124 AC_SUBST(host_cflags_iquote_end)
2125 AC_SUBST(kernel_cflags_iquote)
2126 AC_SUBST(kernel_cflags_iquote_end)
2127 AC_SUBST(aros_cflags_iquote)
2128 AC_SUBST(aros_cflags_iquote_end)
2131 dnl Check if user specified --with-resolution=XRESxYRESxDEPTH
2132 AC_MSG_CHECKING([for default resolution of WBScreen])
2133 AC_ARG_WITH(resolution,AC_HELP_STRING([--with-resolution=XRESxYRESxDEPTH],[Default resolution of the initial WorkbenchScreen]),resolution=$withval,resolution=none)
2134 # We require an argument, so map --with/--without ("yes"/"no") to "none" specified
2135 if test "$resolution" = "yes" ; then
2136     resolution="none"
2138 if test "$resolution" = "no" ; then
2139     resolution="none"
2141 if test "$resolution" != "none" ; then
2142     aros_default_wbwidth=`echo $resolution | cut -d'x' -f1`
2143     aros_default_wbheight=`echo $resolution | cut -d'x' -f2`
2144     aros_default_wbdepth=`echo $resolution | cut -d'x' -f3`
2146 AC_MSG_RESULT($aros_default_wbwidth x $aros_default_wbheight x $aros_default_wbdepth)
2147 aros_cv_default_wbwidth=$aros_default_wbwidth
2148 aros_cv_default_wbheight=$aros_default_wbheight
2149 aros_cv_default_wbdepth=$aros_default_wbdepth
2151 dnl See if the user wants the serial debug output for native flavour
2152 AC_MSG_CHECKING([if serial debug is enabled])
2153 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)
2154 if test "$aros_serial_debug" = 0 ; then
2155     serial_debug_forced=""
2156     if test "$serial_debug" = "yes" ; then
2157         serial_debug="1"
2158     fi
2159     if test "$serial_debug" = "no" ; then
2160         serial_debug="none"
2161     fi
2162 else
2163     serial_debug_forced="(forced)"
2164     serial_debug=$aros_serial_debug
2166 if test "$serial_debug" != "none" ; then
2167     aros_serial_debug=$serial_debug
2168     AC_MSG_RESULT($serial_debug_forced on port $serial_debug)
2169 else
2170     AC_MSG_RESULT(no)
2173 dnl See if the user wants the palm debug output hack for palm native flavour
2174 AC_MSG_CHECKING([if palm debug hack is enabled])
2175 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")
2176 if test "$palm_debug_hack" = "yes" ; then
2177     aros_palm_debug_hack="1"
2179 AC_MSG_RESULT($palm_debug_hack)
2181 dnl See if the user wants the usb3.0 code
2182 AC_MSG_CHECKING([if usb3.0 code is enabled])
2183 AC_ARG_ENABLE(usb30_code,AC_HELP_STRING([--enable-usb30-code],[Enable usb3.0 code (default=no)]),usb30_code="yes",usb30_code="no")
2184 if test "$usb30_code" = "yes" ; then
2185     aros_config_cflags="$aros_config_cflags -DAROS_USB30_CODE"
2186     aros_kernel_cflags="$aros_kernel_cflags -DAROS_USB30_CODE"
2188 AC_MSG_RESULT($usb30_code)
2190 dnl See if the user wants nesting supervisor activated for unix flavour
2191 AC_MSG_CHECKING([if nesting supervisor support is enabled])
2192 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")
2193 if test "$nesting_supervisor" = "yes" ; then
2194     aros_nesting_supervisor="1"
2196 AC_MSG_RESULT($nesting_supervisor)
2198 dnl See if the user wants to disable MMU support
2199 dnl This can be overriden on per-target basis,
2200 dnl set $aros_enable_mmu to "yes" or "no" to do this
2201 if test "$aros_enable_mmu" = "" ; then
2202     AC_MSG_CHECKING([if MMU support is enabled])
2203     dnl Enabled by default
2204     AC_ARG_ENABLE(mmu,AC_HELP_STRING([--disable-mmu],[Disable MMU support (default=enabled)]),aros_enable_mmu=$enableval,aros_enable_mmu="yes")
2205     if test "$aros_enable_mmu" = "" ; then
2206         aros_enable_mmu="yes"
2207     fi
2208     AC_MSG_RESULT($aros_enable_mmu)
2210 if test "$aros_enable_mmu" = "no" ; then
2211     aros_enable_mmu="0"
2212 else
2213     aros_enable_mmu="1"
2215     
2217 dnl things specifically required for hosted flavours
2218 if test "x-$aros_flavour" = "x-emulation" -o "x-$aros_flavour" = "x-emulcompat" ; then
2220     if test "x-$need_dlopen" != "x-no" ; then
2221       dnl some kind of dynamic library access system is required for hostlib.resource
2222       AC_CHECK_FUNC(dlopen, have_dl="yes", have_dl="no")
2223       if test "x-$have_dl" = "x-no" ; then
2224           AC_CHECK_LIB(dl, dlopen, [have_dl="yes"
2225                                     aros_host_ldflags="$aros_host_ldflags -ldl"],
2226                                     have_dl="no")
2227       fi
2228       if test "x-$have_dl" = "x-no" ; then
2229           AC_MSG_ERROR([dlopen() dynamic linker functions not available])
2230       fi
2231     fi
2234     dnl x11 hidd
2235     AC_ARG_ENABLE(x11_hidd, AC_HELP_STRING([--enable-x11-hidd],
2236                                            [build X11 hidd for hosted (default=auto)]),
2237                                            x11_hidd="$enableval",
2238                                            x11_hidd="$need_x11")
2239     case "x-$x11_hidd" in
2240         x-yes|x-no|x-auto)                 ;;
2241         *)                 x11_hidd="$need_x11" ;;
2242     esac
2244     ENABLE_X11=0
2246     dnl they want it
2247     if test "x-$x11_hidd" != "x-no" ; then
2249         dnl find x11 stuff
2250         AC_PATH_X
2252         x_cflags=
2253         for path in $x_libraries
2254         do
2255             x_cflags="$x_cflags -L$path"
2256         done
2258         for path in $x_includes
2259         do
2260             x_cflags="$x_cflags -I$path"
2261         done
2262         
2263         if test "x-$no_x" = "x-yes" ; then
2265             dnl didn't find it
2266             if test "x-$x11_hidd" != "x-auto" ; then
2267                 dnl and they explicitly asked for it, bail out
2268                 AC_MSG_ERROR([X11 libs/headers not found, cannot build X11 hidd as requested])
2269             fi
2270         
2271         else
2272             dnl found it, setup the metatarget
2273             x11_hidd_target=kernel-x11gfx-kobj
2274             ENABLE_X11=1
2276             dnl setup shared memory extensions
2277             AC_ARG_ENABLE(x11_shm, AC_HELP_STRING([--enable-x11-shm],
2278                                                   [use X11 shared memory (default=auto)]),
2279                                                   x11_hidd_shm="$enableval",
2280                                                   x11_hidd_shm="auto")
2281             case "x-$x11_hidd_shm" in
2282                 x-yes|x-no|x-auto)                     ;;
2283                 *)                 x11_hidd_shm="auto" ;;
2284             esac
2286             have_xshm=no
2288             dnl they want it
2289             if test "x-$x11_hidd_shm" != "x-no" ; then
2291                 dnl system shm headers
2292                 AC_CHECK_HEADERS(sys/ipc.h)
2293                 AC_CHECK_HEADERS(sys/shm.h)
2295                 dnl got them
2296                 if test "x-$ac_cv_header_sys_ipc_h" = "x-yes" -a "x-$ac_cv_header_sys_shm_h" = "x-yes" ; then
2298                     dnl make sure X libs have shm functions
2299                     save_cflags="$CFLAGS"
2300                     CFLAGS="$CFLAGS $x_cflags"
2301                     AC_CHECK_LIB(Xext, XShmQueryExtension, have_xshm=yes)
2302                     CFLAGS="$save_cflags"
2303                 fi
2304             fi
2306             dnl detection done, prepare output
2307             if test "x-$have_xshm" = "x-yes" ; then
2308                 dnl we can do shm
2309                 DO_XSHM_SUPPORT="1"
2310             elif test "x-$x11_hidd_shm" = "x-yes" ; then
2311                 dnl they explicitly asked for it, but we can't do it
2312                 AC_MSG_ERROR([X11 has no support for shared memory, cannot enable it as requested])
2313             else
2314                 dnl otherwise just disable it
2315                 DO_XSHM_SUPPORT="0"
2316             fi
2318             
2319             dnl setup vidmode (fullscreen) extensions
2320             AC_ARG_ENABLE(x11_vidmode, AC_HELP_STRING([--enable-x11-vidmode],
2321                                                       [use X11 vidmode extension (default=auto)]),
2322                                                       x11_hidd_vidmode="$enableval",
2323                                                       x11_hidd_vidmode="auto")
2324             case "x-$x11_hidd_vidmode" in
2325                 x-yes|x-no|x-auto)                         ;;
2326                 *)                 x11_hidd_vidmode="auto" ;;
2327             esac
2329             have_vidmode=no
2331             dnl they want it
2332             if test "x-$x11_hidd_vidmode" != "x-no" ; then
2334                 dnl make sure X libs have vidmode functions
2335                 save_cflags="$CFLAGS"
2336                 CFLAGS="$CFLAGS $x_cflags"
2337                 AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryExtension, have_vidmode=yes)
2338                 CFLAGS="$save_cflags"
2339             fi
2341             dnl detection done, prepare output
2342             if test "x-$have_vidmode" = "x-yes" ; then
2343                 dnl we can do vidmode
2344                 DO_VIDMODE_SUPPORT="1"
2345             elif test "x-$x11_hidd_vidmode" = "x-yes" ; then
2346                 dnl they explicitly asked for it, but we can't do it
2347                 AC_MSG_ERROR([X11 vidmode extension not available, cannot enable it as requested])
2348             else
2349                 dnl otherwise just disable it
2350                 DO_VIDMODE_SUPPORT="0"
2351             fi
2352         fi
2354         aros_host_x11_includes=$x_includes 
2355         aros_host_x11_libdirs=$x_libraries
2356     fi
2359     dnl sdl hidd
2360     AC_ARG_ENABLE(sdl_hidd, AC_HELP_STRING([--enable-sdl-hidd],
2361                                            [build SDL hidd for hosted (default=auto)]),
2362                                            sdl_hidd="$enableval",
2363                                            sdl_hidd="auto")
2364     case "x-$sdl_hidd" in
2365         x-yes|x-no|x-auto)                 ;;
2366         *)                 sdl_hidd="auto" ;;
2367     esac
2369     dnl they want it
2370     if test "x-$sdl_hidd" != "x-no" ; then
2372         dnl find sdl
2373         AM_PATH_SDL([1.2.10], have_sdl="yes", have_sdl="no")
2375         if test "x-$have_sdl" != "x-yes" ; then
2377             dnl didn't find it
2378             if test "x-$sdl_hidd" != "x-auto" ; then
2379                 dnl and they explicitly asked for it, bail out
2380                 AC_MSG_ERROR([SDL libs/headers not found, cannot build SDL hidd as requested])
2381             fi
2383         else
2384             dnl found it, set up the metatarget
2385             sdl_hidd_target=kernel-hidd-sdl
2386             aros_host_sdl_cflags=SDL_CFLAGS
2387             aros_host_sdl_libs=SDL_LIBS
2388         fi
2389     fi
2391     dnl oss.library
2392     AC_CHECK_HEADER(sys/soundcard.h)
2393     if test "x-$ac_cv_header_sys_soundcard_h" = "x-yes" ; then
2394         oss_library_target=workbench-libs-oss-unix
2395     fi
2399 dnl See if the user wants dbus.library
2400 AC_MSG_CHECKING([if building of dbus.library is enabled])
2401 AC_ARG_ENABLE(dbus,AC_HELP_STRING([--enable-dbus],[Enable DBUS support via dbus.library (default=no)]),dbus="yes",dbus="no")
2402 if test "$dbus" = "yes" ; then
2403     ENABLE_DBUS=1
2404     DBUS_CFLAGS=`pkg-config --cflags dbus-1`
2405     DBUS_LIBFLAGS=`pkg-config --libs dbus-1`
2406     KERNEL_DBUS_KOBJ=kernel-dbus-kobj
2407     KERNEL_DBUS_INCLUDES=kernel-dbus-includes
2408 else
2409     ENABLE_DBUS=0
2411 AC_MSG_RESULT($dbus)
2413 if test "$use_kernel_cc_wrapper" = "yes" ; then
2414     aros_kernel_cc="${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-elf-gcc"
2417 dnl --------------------------------------------------------------------
2418 dnl Configuration Output Section
2419 dnl --------------------------------------------------------------------
2421 # Generic
2422 AC_SUBST(aros_arch)
2423 AC_SUBST(aros_cpu)
2424 AC_SUBST(aros_flavour)
2425 AC_SUBST(aros_flavour_uc)
2426 AC_SUBST(AROS_BUILDDIR)
2427 AC_SUBST(AROS_BUILDDIR_UNIX)
2428 AC_SUBST(SRCDIR)
2429 AC_SUBST(AROS_CROSSTOOLSDIR)
2430 AC_SUBST(AROS_PORTSSRCDIR)
2432 # Compatability with other Amiga-like operation systems
2433 AC_SUBST(aros_amigaos_compliance)
2435 # Host related
2436 AC_SUBST(aros_cc_pre)
2437 AC_SUBST(aros_host_strip)
2438 AC_SUBST(aros_host_arch)
2439 AC_SUBST(aros_host_cpu)
2440 AC_SUBST(aros_host_cpp)
2441 AC_SUBST(aros_host_cc)
2442 AC_SUBST(aros_host_ar)
2443 AC_SUBST(aros_host_ranlib)
2444 AC_SUBST(aros_host_ld)
2445 AC_SUBST(aros_host_make)
2446 AC_SUBST(aros_host_cflags)
2447 AC_SUBST(gnu89_inline)
2448 AC_SUBST(aros_host_ldflags)
2449 AC_SUBST(aros_host_debug)
2450 AC_SUBST(aros_host_mkdep)
2451 AC_SUBST(aros_host_mkargs)
2452 AC_SUBST(aros_host_exe_suffix)
2453 AC_SUBST(aros_host_lib_suffix)
2454 AC_SUBST(aros_tools_dir)
2455 AC_SUBST(aros_host_aclocal)
2456 AC_SUBST(aros_host_autoconf)
2457 AC_SUBST(aros_host_autoheader)
2458 AC_SUBST(aros_host_automake)
2459 AC_SUBST(ant)
2461 # Target Related
2462 AC_SUBST(aros_target_guitheme)
2463 AC_SUBST(aros_target_iconset)
2464 AC_SUBST(aros_target_bootloader)
2465 AC_SUBST(aros_target_arch)
2466 AC_SUBST(aros_target_family)
2467 AC_SUBST(aros_target_cpu)
2468 AC_SUBST(aros_target_variant)
2469 AC_SUBST(aros_target_suffix)
2470 AC_SUBST(aros_target_ar)
2471 AC_SUBST(aros_target_ranlib)
2472 AC_SUBST(aros_plain_nm)
2473 AC_SUBST(aros_plain_ar)
2474 AC_SUBST(aros_kernel_ar)
2475 AC_SUBST(aros_kernel_ranlib)
2476 AC_SUBST(orig_target_cc)
2477 AC_SUBST(aros_target_cc)
2478 AC_SUBST(aros_target_cxx)
2479 AC_SUBST(aros_kernel_cc)
2480 AC_SUBST(orig_target_cpp)
2481 AC_SUBST(aros_target_cpp)
2482 AC_SUBST(aros_kernel_cpp)
2483 AC_SUBST(aros_target_as)
2484 AC_SUBST(orig_target_ld)
2485 AC_SUBST(aros_target_ld)
2486 AC_SUBST(aros_kernel_ld)
2487 AC_SUBST(aros_target_cc_includes)
2488 AC_SUBST(aros_target_cc_path)
2489 AC_SUBST(aros_target_objdump)
2490 AC_SUBST(aros_target_objcopy)
2491 AC_SUBST(aros_target_strip)
2492 AC_SUBST(aros_target_nm)
2493 AC_SUBST(aros_kernel_rescomp)
2494 AC_SUBST(aros_shared_default)
2495 AC_SUBST(aros_shared_ld)
2496 AC_SUBST(aros_object_format)
2497 AC_SUBST(aros_compiler_libs)
2498 AC_SUBST(aros_arch_libs)
2500 AC_SUBST(aros_config_cflags)
2501 AC_SUBST(aros_config_aflags)
2502 AC_SUBST(aros_config_ldflags)
2504 AC_SUBST(aros_shared_cflags)
2505 AC_SUBST(aros_shared_aflags)
2506 AC_SUBST(aros_shared_ldflags)
2507 AC_SUBST(aros_kernel_cflags)
2508 AC_SUBST(aros_kernel_includes)
2509 AC_SUBST(aros_kernel_objcflags)
2510 AC_SUBST(aros_kernel_ldflags)
2511 AC_SUBST(aros_target_cflags)
2512 AC_SUBST(aros_debug_cflags)
2513 AC_SUBST(aros_debug_aflags)
2514 AC_SUBST(aros_debug_ldflags)
2515 AC_SUBST(aros_target_genmap)
2516 AC_SUBST(aros_target_strip_flags)
2518 AC_SUBST(crosstools_target)
2519 AC_SUBST(crosstools_cxx_target)
2521 # Delinting target compiler flags
2522 AC_SUBST(aros_cflags_unused_but_set_variable)
2523 AC_SUBST(aros_cflags_array_bounds)
2524 AC_SUBST(aros_cflags_enum_compare)
2525 AC_SUBST(aros_cflags_strict_overflow)
2526 AC_SUBST(aros_cflags_format_security)
2528 # Graphics Related
2529 AC_SUBST(x11_hidd_target)
2530 AC_SUBST(sdl_hidd_target)
2531 AC_SUBST(pci_hidd_target)
2532 AC_SUBST(oss_library_target)
2534 AC_SUBST(aros_default_wbwidth)
2535 AC_SUBST(aros_default_wbheight)
2536 AC_SUBST(aros_default_wbdepth)
2537 AC_SUBST(DO_XSHM_SUPPORT)
2538 AC_SUBST(DO_VIDMODE_SUPPORT)
2540 AC_SUBST(aros_host_x11_includes)
2541 AC_SUBST(aros_host_x11_libdirs)
2542 AC_SUBST(aros_host_sdl_cflags)
2543 AC_SUBST(aros_host_sdl_libs)
2545 # Native version related
2546 AC_SUBST(aros_serial_debug)
2548 # Palm native version related
2549 AC_SUBST(aros_palm_debug_hack)
2551 # USB3.0 code
2552 AC_SUBST(aros_usb30_code)
2554 # Unix/Hosted version related
2555 AC_SUBST(aros_nesting_supervisor)
2557 # MMU related
2558 AC_SUBST(aros_enable_mmu)
2560 # Apple iOS related
2561 AC_SUBST(aros_ios_platform)
2562 AC_SUBST(aros_ios_version)
2563 AC_SUBST(aros_ios_sdk)
2565 # Android related
2566 AC_SUBST(android_tool)
2567 AC_SUBST(aros_android_level)
2569 # DBUS related
2570 AC_SUBST(ENABLE_DBUS)
2571 AC_SUBST(DBUS_CFLAGS)
2572 AC_SUBST(DBUS_LIBFLAGS)
2573 AC_SUBST(KERNEL_DBUS_KOBJ)
2574 AC_SUBST(KERNEL_DBUS_INCLUDES)
2576 #X11 related
2577 AC_SUBST(ENABLE_X11)
2579 # Debug related
2580 AC_SUBST(aros_debug)
2581 AC_SUBST(aros_mungwall_debug)
2582 AC_SUBST(aros_stack_debug)
2583 AC_SUBST(aros_modules_debug)
2585 # Collect-aros stuff: "-ius" to ignore undefined symbols
2586 AC_SUBST(ignore_undefined_symbols)
2588 # C compiler related
2589 AC_SUBST(gcc_target_cpu)
2591 dnl Prepare for output, make up all the generated patches
2592 case "$aros_flavour" in
2593 emulation)      aros_flavour_uc="AROS_FLAVOUR_EMULATION"
2594                 aros_flavour="emulation" ;;
2595 emulcompat)     aros_flavour_uc="(AROS_FLAVOUR_EMULATION|AROS_FLAVOUR_BINCOMPAT)"
2596                 aros_flavour="emulation" ;;
2597 standalone)     aros_flavour_uc="AROS_FLAVOUR_STANDALONE"
2598                 aros_flavour="standalone";;
2599 standcompat)    aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_BINCOMPAT)"
2600                 aros_flavour="standalone";;
2601 native)         aros_flavour_uc="AROS_FLAVOUR_NATIVE"
2602                 aros_flavour="native" ;;
2603 nativecompat)   aros_flavour_uc="(AROS_FLAVOUR_NATIVE|AROS_FLAVOUR_BINCOMPAT)"
2604                 aros_flavour="native" ;;
2605 linklib)        aros_flavour_uc="AROS_FLAVOUR_LINKLIB"
2606                 aros_flavour="linklib" ;;
2607 palmnative)     aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
2608                 aros_flavour="palmnative" ;;
2609 mac68knative)   aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
2610                 aros_flavour="mac68knative" ;;
2611 ppcnative)      aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_BINCOMPAT)"
2612                 aros_flavour="ppcnative" ;;
2613 esac
2615 if test ! -d ${aros_inc_dir} ; then
2616     ${MKDIR} ${aros_inc_dir}
2618 if test ! -d ${aros_geninc_dir} ; then
2619     ${MKDIR} ${aros_geninc_dir}
2621 if test ! -d ${aros_hostcfg_dir} ; then
2622     ${MKDIR} ${aros_hostcfg_dir}
2624 if test ! -d ${aros_targetcfg_dir} ; then
2625     ${MKDIR} ${aros_targetcfg_dir}
2627 if test ! -d ${aros_tools_dir} ; then
2628     ${MKDIR} ${aros_tools_dir}
2630 if test ! -d ${aros_scripts_dir} ; then
2631     ${MKDIR} ${aros_scripts_dir}
2634 AC_CONFIG_HEADERS(${aros_geninc_dir}/host-conf.h:config/host-conf.h.in)
2636 AC_CONFIG_COMMANDS([compiler_executable],
2637     [
2638         prefix=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}
2639         mkdir -p $prefix
2640         prefix2=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros
2641         prefix3=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-elf
2643         echo ${prefix2}
2644         echo ${prefix3}
2645         chmod a+x ${prefix2}-gcc ${prefix2}-ld ${prefix2}-cpp ${prefix3}-gcc
2647         ln -sf $aros_target_as_ln$aros_host_exe_suffix      ${prefix2}-as$aros_host_exe_suffix
2648         ln -sf $aros_target_nm_ln$aros_host_exe_suffix      ${prefix2}-nm$aros_host_exe_suffix
2649         ln -sf $aros_target_ar_ln$aros_host_exe_suffix      ${prefix2}-ar$aros_host_exe_suffix
2650         ln -sf $aros_target_ranlib_ln$aros_host_exe_suffix  ${prefix2}-ranlib$aros_host_exe_suffix
2651         ln -sf $aros_target_objcopy_ln$aros_host_exe_suffix ${prefix2}-objcopy$aros_host_exe_suffix
2652         ln -sf $aros_target_objdump_ln$aros_host_exe_suffix ${prefix2}-objdump$aros_host_exe_suffix
2653         ln -sf $aros_target_strip_ln$aros_host_exe_suffix   ${prefix2}-strip$aros_host_exe_suffix
2655         ln -sf $aros_kernel_ld$aros_host_exe_suffix         ${prefix3}-ld$aros_host_exe_suffix
2656     ],
2657     [
2658         aros_host_exe_suffix=${aros_host_exe_suffix}
2659         aros_tools_dir=${aros_tools_dir}
2660         aros_target_cpu=${aros_target_cpu}
2661         aros_target_arch=${aros_target_arch}
2662         aros_target_suffix=${aros_target_suffix}
2663         aros_target_nm_ln=${aros_target_nm_ln}
2664         aros_target_as_ln=${aros_target_as_ln}
2665         aros_target_ar_ln=${aros_target_ar_ln}
2666         aros_target_ranlib_ln=${aros_target_ranlib_ln}
2667         aros_target_objdump_ln=${aros_target_objdump_ln}
2668         aros_target_objcopy_ln=${aros_target_objcopy_ln}
2669         aros_target_strip_ln=${aros_target_strip_ln}
2670         aros_kernel_ld=${aros_kernel_ld}
2671     ]
2673 AC_CONFIG_COMMANDS([genmf_executable],
2674     [chmod a+x ${aros_tools_dir}/genmf.py],
2675     [aros_tools_dir=${aros_tools_dir}]
2678 AC_CONFIG_FILES(
2679     Makefile
2680     config/make.cfg
2681     ${aros_inc_dir}/config.h:config/config.h.in
2682     ${aros_geninc_dir}/config.h:config/config.h.in
2683     ${aros_hostcfg_dir}/host.cfg:config/host.cfg.in
2684     ${aros_targetcfg_dir}/target.cfg:config/target.cfg.in
2685     mmake.config
2686     ${aros_targetcfg_dir}/make.defaults:config/make.defaults.in
2687     ${aros_targetcfg_dir}/specs:config/specs.in
2688     ${aros_targetcfg_dir}/elf-specs:${elf_specs_in}
2689     ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-cpp:scripts/aros-cpp.in
2690     ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-gcc:scripts/aros-gcc.in
2691     ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-elf-gcc:scripts/elf-gcc.in
2692     ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-ld:scripts/aros-ld.in
2693     ${aros_tools_dir}/genmf.py:tools/genmf/genmf.py
2694     tools/collect-aros/env.h
2695     ${aros_gendir}/arch/all-android/bootstrap/app/default.properties:arch/all-android/bootstrap/app/default.properties.in
2698 AC_OUTPUT
2700 dnl This is in order to not define SHARED_CFLAGS sometimes
2701 dnl We don't always do aros_shared_ar, aros_shared_cflags
2703 #XXX compatability...
2704 aros_shared_ar="$aros_shared_ld $aros_shared_ldflags -o"
2706 if test -n "$aros_shared_cflags" ; then
2707     echo "SHARED_CFLAGS := $aros_shared_cflags" >> ${aros_hostcfg_dir}/host.cfg
2708     echo "SHARED_AR := $aros_shared_ar" >> ${aros_hostcfg_dir}/host.cfg