disable debug
[AROS.git] / configure.in
blob726ef69713749297302a5c6a5e20e6e47e3a2274
1 dnl Copyright (C) 1997-2019, 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 # Default versions for the gnu tools we build
26 default_toolchain_family=`cat ${srcdir}/config/toolchain_def`
27 default_gcc_version=`cat ${srcdir}/config/gcc_def`
28 exp_gcc_version=`cat ${srcdir}/config/gcc_exp`
29 default_binutils_version=`cat ${srcdir}/config/binutils_def`
30 exp_binutils_version=`cat ${srcdir}/config/binutils_exp`
31 default_grub2_version="2.02"
32 target_grub2_version=$default_grub2_version
34 # The AROS target is slightly different to the normal GNU style
35 # format. We don't have the middle part, and we reverse the order
36 # of the $(CPU) and $(OS) bits.
38 # Don't strip the version of the target yet, it might be
39 # useful on some systems.
41 AC_MSG_CHECKING([for AROS style target])
43 if test "$target" = "NONE" ; then
44     target=$host_os-$host_cpu
45 else
46     if test "$target" = "" ; then
47         target=$host_os-$host_cpu
48     fi
50 AC_MSG_RESULT($target)
52 if test "$host_os" = "mingw32" ; then
53     PWDCMD="pwd -W"
56 # Don't know where else to put this...
57 AC_MSG_CHECKING([building AROS in])
58 AROS_BUILDDIR=`${PWDCMD-pwd}`
59 AROS_BUILDDIR_UNIX=${PWD}
60 AC_MSG_RESULT($AROS_BUILDDIR)
62 AC_MSG_CHECKING([AROS source in])
63 srcpwd=`cd ${srcdir} ; ${PWDCMD-pwd}`
64 SRCDIR=${srcpwd}
65 AC_MSG_RESULT($SRCDIR)
67 # Parse the target field into something useful.
68 changequote(<<,>>)
69 target_os=`echo $target | sed 's/^\([^-].*\)-\(.*\)$/\1/'`
70 target_cpu=`echo $target | sed 's/^\([^-].*\)-\(.*\)$/\2/'`
71 changequote([,])
73 # Some debug output, to be removed again.
74 AC_MSG_CHECKING([for target system (debug output)])
75 AC_MSG_RESULT($target_os)
76 AC_MSG_CHECKING([for target cpu (debug output)])
77 AC_MSG_RESULT($target_cpu)
79 dnl --------------------------------------------------------------------
80 dnl Set the default Workbench resolution
81 dnl --------------------------------------------------------------------
82 aros_nominal_width=800
83 aros_nominal_height=600
84 aros_nominal_depth=4
86 dnl --------------------------------------------------------------------
87 dnl Host Configuration Section
88 dnl --------------------------------------------------------------------
89 dnl
90 dnl The idea here is to find out all the information we need about the
91 dnl host. This means things like tools for building directory structures,
92 dnl copying files around and the like.
94 HOST_WANTS_X11=
95 HOST_WANTS_GLX=
96 HOST_WANTS_SDL=
97 HOST_WANTS_DBUS=
98 HOST_WANTS_DLOPEN=
100 default_c_compilers="gcc clang cc"
101 AC_ARG_WITH(c-compiler,AC_HELP_STRING([--with-c-compiler=VERSION],[Use specified c compiler for building AROS]),use_c_compiler="$withval",use_c_compiler="")
102 if test "$use_c_compiler" = ""; then
103     host_c_compilers="$default_c_compilers"
104 else
105     host_c_compilers="$use_c_compiler"
106     CC=$use_c_compiler
109 default_cxx_compilers="g++ clang++ c++"
110 AC_ARG_WITH(cxx-compiler,AC_HELP_STRING([--with-cxx-compiler=VERSION],[Use specified c++ compiler building AROS]),use_cxx_compiler="$withval",use_cxx_compiler="")
111 if test "$use_cxx_compiler" = ""; then
112         host_cxx_compilers="$default_cxx_compilers"
113 else
114     host_cxx_compilers="$use_cxx_compiler"
115     CXX=$use_cxx_compiler
119 # The first step is to find the host binaries.
120 # Check for a compiler.
121 # Due to a bug in autoconf check for c++ compiler first.
122 # For mor info see, http://osdir.com/ml/bug-autoconf-gnu/2010-05/msg00001.html.
123 AC_PROG_CXX([${host_cxx_compilers}])
124 CXX_BASE=$CXX
125 AC_PATH_PROG(CXX,$CXX)
126 AC_PROG_CC([${host_c_compilers}])
127 CC_BASE=$CC
128 AC_PROG_CPP
129 CPP_BASE=$CPP
130 AC_PATH_PROG(CC,$CC)
131 aros_host_def_cc="$CC"
132 AC_PROG_CC_STDC
133 AC_PROG_CPP
135 # detect the compiler version
136 AC_MSG_CHECKING([which toolchain family ${CC_BASE} belongs to])
137 HOST_COMPILER_VERSION=`"$CC" --version 2>/dev/null`
138 if test x"$HOST_COMPILER_VERSION" = "x"; then
139     HOST_COMPILER_VERSION=`"$CC" --qversion 2>/dev/null`
141 if test x"$HOST_COMPILER_VERSION" = "x"; then
142     HOST_COMPILER_VERSION=`"$CC" -V 2>/dev/null`
145 IS_SUN_COMPILER=`echo $HOST_COMPILER_VERSION | grep -i -c -E 'Sun C\+\+'`
146 if test "$IS_SUN_COMPILER" -ne "0"; then
147     HOST_TOOLCHAIN_PREFIX=
148     HOST_TOOLCHAIN_SUFFIX=
149     HOST_TOOLCHAIN_FAMILY=sun
151 IS_LLVM_COMPILER=`echo $HOST_COMPILER_VERSION | grep -i -c -E 'LLVM|clang'`
152 if test "$IS_LLVM_COMPILER" -ne "0"; then
153     if test "$CC_BASE" != "gcc"; then
154         HOST_TOOLCHAIN_PREFIX=llvm-
155         HOST_TOOLCHAIN_SUFFIX="`echo $CC_BASE | sed -e \"s|clang||g\"`"
156         HOST_TOOLCHAIN_FAMILY=llvm
157     else
158         IS_GNU_COMPILER=1
159     fi
161 if test "x$IS_GNU_COMPILER" = "x"; then
162     IS_GNU_COMPILER=`echo $HOST_COMPILER_VERSION | grep -i -c -E 'gcc'`
164 if test "$IS_GNU_COMPILER" -ne "0"; then
165     HOST_TOOLCHAIN_PREFIX=
166     HOST_TOOLCHAIN_SUFFIX=
167     HOST_TOOLCHAIN_FAMILY=gnu
169 if test x"$HOST_TOOLCHAIN_FAMILY" = "x"; then
170     HOST_TOOLCHAIN_FAMILY=unknown
172 AC_MSG_RESULT($HOST_TOOLCHAIN_FAMILY)
174 # Check for a compatible awk
175 AC_CHECK_PROGS(AWK,[gawk nawk])
176 AROS_REQUIRED(gawk,$AWK)
177 AROS_PROG(MMAKE,mmake)
179 # Perform some default variable assignments. Note all of these will be
180 # Regenerated from the script, so there is no need to cache them.
182 aros_build_host=$host
183 aros_host_cpp="$CPP"
184 aros_host_cc="$CC"
185 aros_host_cxx="$CXX"
186 base_ld_name=${HOST_TOOLCHAIN_PREFIX}ld${HOST_TOOLCHAIN_SUFFIX}
187 if test "$HOST_TOOLCHAIN_FAMILY" = "llvm"; then
188     AC_CHECK_PROGS(base_lld_name,[$base_ld_name ld.lld${HOST_TOOLCHAIN_SUFFIX} ld64.lld${HOST_TOOLCHAIN_SUFFIX} ld-link${HOST_TOOLCHAIN_SUFFIX}.exe ld${HOST_TOOLCHAIN_SUFFIX}])
189     base_ld_name=$base_lld_name
191 AROS_TOOL_CCPATH(aros_host_ld,ld,$base_ld_name)
192 AROS_REQUIRED(ld,$aros_host_ld)
193 aros_host_make="make"
194 aros_host_cflags="$CFLAGS"
195 aros_host_cxxflags="$CXXFLAGS"
196 aros_host_cppflags="$CPPFLAGS"
197 aros_host_ldflags="$LDFLAGS"
198 aros_host_debug="-g -O0"
199 aros_host_mkdep="\$(SRCDIR)/scripts/mkdep"
200 aros_host_mkargs="--no-print-directory"
201 aros_host_exe_suffix="$EXEEXT"
202 aros_host_lib_suffix=""
204 # Ignore all compliance, AROS ROMs = 0
205 # KickStart v1.0 = 30
206 # KickStart v1.3 = 34
207 # KickStart v2.0 = 37
208 # KickStart v3.0 = 39
209 # KickStart v3.1 = 40
210 # AmigaOS   v3.5 = 44
211 aros_amigaos_compliance=0
213 AC_CHECK_PROGS(aros_host_aclocal,[aclocal aclocal19 aclocal-1.9])
214 AC_CHECK_PROGS(aros_host_autoconf,[autoconf autoconf259 autoconf253])
215 AC_CHECK_PROGS(aros_host_autoheader,[autoheader autoheader259 autoheader253])
216 AC_CHECK_PROGS(aros_host_automake,[automake automake19 automake-1.9])
218 AROS_REQUIRED(aclocal/aclocal19/aclocal-1.9, $aros_host_aclocal)
219 AROS_REQUIRED(automake/automake19/automake-1.9, $aros_host_automake)
221 case "$aros_host_cc" in
222     *clang*)
223         aros_host_cc_pipe=""
224         ;;
225     *gcc*)
226         aros_host_cc_pipe="-pipe"
227         ;;
228     icc)
229         aros_host_cc_pipe=""
230         ;;
231     *)
232         aros_host_cc_pipe=""
233         ;;
234 esac
236 aros_kernel_cc_includes=""
237 aros_target_cc_includes=""
238 host_cc_elf=yes
240 # ----------------------------------------------------------------------------------------
241 # Host-specific defaults
243 # This is the main host configuration section. It is where the host
244 # can change the values of any variables it needs to change. We do
245 # not look at anything that compiles to the target yet, we'll get
246 # to that later.
248 case "$host_os" in
249     aros*)
250         aros_host_arch="aros"
251         aros_host_cflags="$aros_host_cflags $aros_host_cc_pipe"
252         case "$host_cpu" in
253             *i?86*)
254                 aros_host_cpu="i386"
255                 ;;
256             *x86_64*)
257                 aros_host_cpu="x86_64"
258                 ;;
259             *powerpc*)
260                 aros_host_cpu="ppc"
261                 ;;
262             *)
263                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
264                 aros_host_cpu="$host_cpu"
265                 ;;
266         esac
267         ;;
269     linux*)
270         aros_host_arch="linux"
271         aros_host_cflags="$aros_host_cflags $aros_host_cc_pipe"
272         android_build_os="linux-x86"
273         android_tool="android"
274         default_android_sdk="/opt/android-sdk-linux_x86"
275         case "$host_cpu" in
276             *i?86*)
277                 aros_host_cpu="i386"
278                 ;;
279             *x86_64*)
280                 aros_host_cpu="x86_64"
281                 ;;
282             *m68k*)
283                 aros_host_cpu="m68k"
284                 ;;
285             *powerpc*)
286                 aros_host_cpu="ppc"
287                 ;;
288             *arm*)
289                 aros_host_cpu="arm"
290                 ;;
291             *)
292                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
293                 aros_host_cpu="$host_cpu"
294                 ;;
295         esac
296         ;;
298     freebsd*)
299         aros_host_cflags="$aros_host_cflags $aros_host_cc_pipe -I/usr/local/include"
300         aros_host_make="gmake"
301         aros_host_arch="freebsd"
302         aros_host_cpu="i386"
304         aros_host_ldflags="$aros_host_ldflags -L/usr/local/lib -liconv"
306         dnl FreeBSD 5.x (and later) has changed the default object format.
307         dnl The double [[]] is necessary to get around m4's quoting rules.
308         case $host_os in
309             freebsd[[234]]*)
310                 aros_object_format="elf_i386"
311                 ;;
313             *)
314                 aros_object_format="elf_i386_fbsd"
315                 ;;
316         esac
318         ;;
320     darwin*)
321         AC_MSG_CHECKING([for macOS SDK files])
322         LOC=$( xcode-select -p )
323         AS_IF([ test $? != 0],[AC_MSG_ERROR([XCode incorrectly configured!
324 please run 'xcode-select --install' before
325 re-running configure])])
326         AC_MSG_RESULT($LOC)
327         aros_host_cflags="$aros_host_cflags $aros_host_cc_pipe"
328         aros_host_arch="darwin"
329         host_cc_elf=no
330         if [[ -z ${SED+x} ]]; then SED="gsed"; fi
331         android_build_os="darwin-x86"
332         android_tool="android"
333         default_android_sdk="/android-sdk-mac_x86"
334         case "$host_cpu" in
335             *i?86*)
336                 aros_host_cpu="i386"
337                 ;;
338             *x86_64*)
339                 aros_host_cpu="x86_64"
340                 ;;
341             *powerpc*)
342                 aros_host_cpu="ppc"
343                 ;;
344             *)
345                 AC_MSG_WARN("Unknown CPU for Darwin host -- $host_cpu")
346                 aros_host_cpu="$host_cpu"
347                 ;;
348         esac
350         aros_host_ldflags="$aros_host_ldflags -liconv"
352         ;;
354     dragonfly*)
355         aros_host_cflags="$aros_host_cflags $aros_host_cc_pipe"
356         aros_host_make="gmake"
357         aros_host_arch="dragonfly"
358         case $host_cpu in
359             *i?86*)
360                 aros_host_cpu="i386"
361                 ;;
362             *amd64*)
363                 aros_host_cpu="x86_64"
364                 ;;
365             *)
366                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
367                 aros_host_cpu="$host_cpu"
368                 ;;
369         esac
370         ;;
372     netbsd*)
373         aros_host_cflags="$aros_host_cflags $aros_host_cc_pipe"
374         aros_host_make="gmake"
375         aros_host_arch="netbsd"
376         case "$host_cpu" in
377             *i?86*)
378                 aros_host_cpu="i386"
379                 ;;
380             *m68k*)
381                 aros_host_cpu="m68k"
382                 ;;
383             *)
384                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
385                 aros_host_cpu="$host_cpu"
386                 ;;
387         esac    
388         aros_host_lib_suffix=".0.0"
389         ;;
391     openbsd*)
392         aros_host_cflags="$aros_host_cflags $aros_host_cc_pipe"
393         aros_host_make="gmake"
394         aros_host_arch="openbsd"
395         case "$host_cpu" in
396             *i?86*)
397                 aros_host_cpu="i386"
398                 ;;
399             *)
400                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
401                 aros_host_cpu="$host_cpu"
402                 ;;
403         esac
404         ;;
405         
406     solaris*)
407         aros_host_arch="solaris"
408         aros_host_cflags="$aros_host_cflags $aros_host_cc_pipe"
409         case "$host_cpu" in
410             *i?86*)
411                 aros_host_cpu="i386"
412                 ;;
413             *sparc*)
414                 aros_host_cpu="sparc"
415                 ;;
416             *)
417                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
418                 aros_host_cpu="$host_cpu"
419                 ;;
420         esac
421         ;;
423     morphos*)
424         aros_host_arch="morphos"
425         aros_host_cpu="ppc"
426         host_cc_elf=no
427         ;;
429     amiga*)
430         aros_host_arch="amiga"
431         host_cc_elf=no
432         SORT="/gg/bin/sort"
433         TEST="/gg/bin/test"
434         UNIQ="/gg/bin/uniq"
435         FOR="for"
436         TOUCH="/gg/bin/touch"
437         case "$host_cpu" in
438             *m68k*)
439                 aros_host_cpu="m68k"
440                 ;;
441             *powerpc*)
442                 aros_host_cpu="ppc"
443                 ;;
444             *)
445                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
446                 aros_host_cpu="$host_cpu"
447                 ;;
448         esac
449         ;;
451     cygwin*)
452         aros_host_arch="cygwin"
453         aros_host_cflags="$aros_host_cflags $aros_host_cc_pipe"
454         host_cc_elf=no
455         android_build_os="windows"
456         android_tool="android.bat"
457         default_android_sdk="/cygdrive/c/android-sdk-windows-1.6_r1"
459         case "$host_cpu" in
460             *i?86*)
461                 aros_host_cpu="i386"
462                 ;;
463             *)
464                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
465                 aros_host_cpu="$host_cpu"
466                 ;;
467         esac
468         ;;
470     mingw32*)
471         aros_host_arch="mingw32"
472         aros_host_cflags="$aros_host_cflags $aros_host_cc_pipe"
473         host_cc_elf=no
474         android_build_os="windows"
475         android_tool="android.bat"
476         default_android_sdk="/c/android-sdk-windows-1.6_r1"
478         libpng_libextra="-lws2_32"
480         case "$host_cpu" in
481         *i?86*)
482             dnl Currently there's neither 64-bit MinGW nor MSYS. Both environments are 32-bit
483             dnl and run under emulation. Consequently, uname reports i386 even on 64-bit systems.
484             dnl Here we attempt to detect Windows home platform by asking gcc about its target.
485             dnl 64-bit gcc will output "x86_64-w64-mingw32" here.
487             AC_MSG_CHECKING([for Windows native gcc target])
488             host_cpu=`gcc -dumpmachine`
489             AC_MSG_RESULT($host_cpu)
490             ;;
492         esac
494         case "$host_cpu" in
495         *i?86*)
496             aros_host_cpu="i386"
497             ;;
499         mingw32*)
500             dnl Native i386 gcc for MinGW32 reports 'mingw32' with -dumpmachine switch
501             aros_host_cpu="i386"
502             ;;
504         *x86_64*)
505             aros_host_cpu="x86_64"
506             dnl Dragon's x86_64-w64-mingw32-gcc is a bit broken. It ignores standard $prefix/include
507             dnl directory, so we have to add it explicitly here.
508             aros_host_cflags="$aros_host_cflags -isystem /mingw/include"
509             ;;
511         *)
512             AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
513             aros_host_cpu="$host_cpu"
514             ;;
515         esac
516         ;;
517     *)
518         AC_MSG_ERROR([Unsupported host architecture $host])
519         ;;
520 esac
522 base_ar_name=${HOST_TOOLCHAIN_PREFIX}ar${HOST_TOOLCHAIN_SUFFIX}
523 AROS_PROG(aros_host_cmd_ar,$base_ar_name,[cr])
524 AROS_PATH_PROG(aros_host_plain_ar,$aros_host_cmd_ar)
525 aros_host_ar=`echo $aros_host_cmd_ar | sed -e "s|$base_ar_name|$aros_host_plain_ar|g"`
526 AROS_REQUIRED(ar,$aros_host_ar)
527 base_ranlib_name=${HOST_TOOLCHAIN_PREFIX}ranlib${HOST_TOOLCHAIN_SUFFIX}
528 AROS_PATH_PROG(aros_host_ranlib,$base_ranlib_name)
529 AROS_REQUIRED(ranlib,$aros_host_ranlib)
530 AROS_PROG(aros_host_strip,strip)
531 AROS_REQUIRED(strip,$aros_host_strip)
533 AROS_PROG(RM,[rm],[-rf])
534 AROS_REQUIRED(rm,$RM)
535 AROS_PROG(CP,[cp])
536 AROS_REQUIRED(cp,$CP)
537 AROS_PROG(MV,[mv])
538 AROS_REQUIRED(mv,$MV)
539 AROS_PROG(ECHO,[echo])
540 AROS_REQUIRED(echo,$ECHO)
541 AROS_PROG(MKDIR,[mkdir],[-p])
542 AROS_REQUIRED(mkdir,$MKDIR)
543 AROS_PROG(TOUCH,[touch])
544 AROS_REQUIRED(touch,$TOUCH)
545 AROS_PROG(SORT,[sort])
546 AROS_REQUIRED(sort,$SORT)
547 AROS_PROG(UNIQ,[uniq])
548 AROS_REQUIRED(uniq,$UNIQ)
549 AROS_PROG(NOP,[true])
550 AROS_REQUIRED(true,$NOP)
551 AROS_PROG(CAT,[cat])
552 AROS_REQUIRED(cat,$CAT)
553 AROS_PROG(BISON,[bison])
554 AROS_REQUIRED(bison,$BISON)
555 AROS_PROG(FLEX,[flex])
556 AROS_REQUIRED(flex,$FLEX)
557 AC_MSG_CHECKING([version of $FLEX])
558 ax_cv_flex_version="`$FLEX --version | cut -d\" \" -f2`"
559 AC_MSG_RESULT($ax_cv_flex_version)
560 AROS_PROG(PNGTOPNM,[pngtopnm])
561 AROS_REQUIRED(pngtopnm,$PNGTOPNM)
562 AROS_PROG(PPMTOILBM,[ppmtoilbm])
563 AROS_REQUIRED(ppmtoilbm,$PPMTOILBM)
564 AROS_PROG(SED,[sed])
565 AROS_REQUIRED(sed,$SED)
566 AROS_PROG(CHMOD,[chmod])
567 AROS_REQUIRED(chmod,$CHMOD)
568 AROS_PROG(PATCH,[patch])
569 AROS_REQUIRED(patch,$PATCH)
571 AM_PATH_PYTHON(2.5)
573 AC_ARG_ENABLE([libpng-config], [--disable-libpng-config    disable libpng-config test and configuration])
574 if test "$enable_libpng_config" != "no"; then
575   AC_CHECK_PROG([arosconfig_use_libpngconfig],[libpng-config],[yes],[no])
577 if test "$arosconfig_use_libpngconfig" = "yes"; then
578     AC_MSG_CHECKING([libpng-config library])
579     libpng_incdir="`libpng-config --cflags`"
580     libpng_libextra="$libpng_libextra `libpng-config --ldflags`"
581     libpng="`libpng-config --libs`"
582     AC_MSG_RESULT($libpng)
583 else
584     AC_CHECK_LIB(png, png_read_png, [libpng="-lpng"], [libpng="no"])
585     if test "$libpng_libextra" != ""; then
586         if test "$libpng" != "no"; then
587             libpng_libextra="$libpng_libextra $libpng"
588         fi
589     fi
591 AROS_REQUIRED(libpng, $libpng)
592 AC_SUBST(libpng)
593 AC_SUBST(libpng_libextra)
594 AC_SUBST(libpng_incdir)
596 AC_SUBST(FOR, for)
597 AC_SUBST(IF, if)
598 AC_SUBST(TEST, test)
599 AC_SUBST(CMP, cmp)
601 dnl ---------------------------------------------------------------------------
602 dnl Look for things about the host system, good for hosted targets.
603 dnl ---------------------------------------------------------------------------
605 # Check for some includes for the X11 HIDD and the kernel
606 AC_CHECK_HEADERS([sys/ipc.h sys/shm.h \
607     sys/mmap.h sys/mman.h sysexits.h \
608     sys/statfs.h sys/statvfs.h sys/vfs.h sys/param.h \
611 AC_CHECK_HEADERS([sys/mount.h],,,[#include <sys/param.h>])
612 AC_CHECK_HEADERS([GL/glx.h],[host_feature_glx=yes],[host_feature_glx=no],)
614 AC_MSG_CHECKING([if __unused conflicts with sys/stat.h])
615 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
616      [[
617      #define __unused __attribute__((unused))
618      #include <sys/stat.h>
619      ]])],
620      [host_stat_h__unused_used=no],
621      [host_stat_h__unused_used=yes])
622 AC_MSG_RESULT($host_stat_h__unused_used)
624 AC_HEADER_DIRENT
625 AC_HEADER_STAT
626 AC_HEADER_STDC
627 AC_HEADER_SYS_WAIT
628 AC_HEADER_TIME
629 AC_STRUCT_ST_BLKSIZE
630 AC_STRUCT_ST_BLOCKS
631 AC_STRUCT_ST_RDEV
632 AC_STRUCT_TM
633 AC_STRUCT_TIMEZONE
634 AC_TYPE_OFF_T
635 AC_TYPE_PID_T
636 AC_TYPE_SIZE_T
637 AC_TYPE_UID_T
639 AC_CHECK_MEMBERS(struct tm.tm_gmtoff)
641 # Look for some functions
642 AC_CHECK_FUNCS([getpagesize kqueue statfs statvfs \
643     clone kse_create rfork_thread thr_create sa_register \
644     getcontext makecontext setcontext sigaltstack swapcontext])
646 AC_FUNC_MMAP
648 #-----------------------------------------------------------------------------
651 # GCC 4.1+ has a stack protection feature that requires OS support. Ubuntu has
652 # it switched on by default, and we use the host compiler, so it compiles AROS
653 # code with this enabled resulting in link failures as we don't have support
654 # for it.
656 # We use two methods to disable it. For the host compiler (used to compile
657 # some hosted modules), we test to see if the compiler supports stack
658 # protection, and if it does we disable it in AROS_CONFIG_CFLAGS. This should
659 # work on all platforms.
662 AC_MSG_CHECKING([whether ${CC_BASE} accepts -fno-stack-protector])
663 save_cflags="$CFLAGS"
664 CFLAGS="$CFLAGS -fno-stack-protector"
665 AC_TRY_COMPILE(,, use_no_stack_protector="yes", use_no_stack_protector="no")
666 AC_MSG_RESULT($use_no_stack_protector)
667 if test "x-$use_no_stack_protector" = "x-yes" ; then
668     aros_host_cflags="$aros_host_cflags -fno-stack-protector"
670 CFLAGS="$save_cflags"
672 #-----------------------------------------------------------------------------
674 # Disable pointer-signedness warnings if the compiler recognises the option
675 # (this only works for the host compiler at the moment)
677 AC_MSG_CHECKING([whether ${CC_BASE} accepts -Wno-pointer-sign])
678 save_cflags="$CFLAGS"
679 CFLAGS="$CFLAGS -Wno-pointer-sign"
680 AC_TRY_COMPILE(,, use_no_sign_warning="yes", use_no_sign_warning="no")
681 AC_MSG_RESULT($use_no_sign_warning)
682 if test "x-$use_no_sign_warning" = "x-yes" ; then
683     aros_host_cflags="$aros_host_cflags -Wno-pointer-sign"
685 CFLAGS="$save_cflags"
687 #-----------------------------------------------------------------------------
689 # Check if host compiler supports -fgnu89-inline, can be needed for crosstools.
691 AC_MSG_CHECKING([whether ${CC_BASE} accepts -fgnu89-inline])
692 save_cflags="$CFLAGS"
693 CFLAGS="$CFLAGS -fgnu89-inline"
694 AC_TRY_COMPILE(,, use_gnu89_inline="yes", use_gnu89_inline="no")
695 AC_MSG_RESULT($use_gnu89_inline)
696 if test "x-$use_gnu89_inline" = "x-yes" ; then
697     gnu89_inline="-fgnu89-inline"
699 CFLAGS="$save_cflags"
702 # For GCC < 4.0 -I- is used for giving the search path for '#include "..."'
703 # On GCC >= 4.0 -iquote should be used
705 AC_MSG_CHECKING([whether ${CC_BASE} accepts -iquote])
706 CFLAGS="$CFLAGS -iquote."
707 AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
708 AC_MSG_RESULT($has_iquote)
709 if test "x-$has_iquote" = "x-yes" ; then
710     host_cflags_iquote=-iquote
711     host_cflags_iquote_end=
712 else
713     host_cflags_iquote=-I
714     host_cflags_iquote_end=-I-
717 AC_MSG_NOTICE([Performing target configuration...])
719 dnl --------------------------------------------------------------------
720 dnl Target Configuration Section
721 dnl --------------------------------------------------------------------
723 dnl The target configuration section is responsible for setting up all
724 dnl the paths for includes, and tools required to build AROS to some
725 dnl particular target.
727 test_kernel_cc=no
729 aros_nowarn_flags="NOWARN_UNUSED_COMMAND_LINE_ARGUMENT NOWARN_UNKNOWN_WARNING_OPTION NOWARN_POINTER_SIGN NOWARN_PARENTHESES"
730 export_newline="
733 aros_elf_translate=
734 aros_warn_flags=
735 aros_isa_extra=
736 aros_isa_flags=
737 aros_kernel_isaflags=
738 aros_config_cppflags=
739 aros_config_cflags=
740 aros_config_cxxflags=
741 aros_config_aflags="$""(WARN_ALL) -x assembler-with-cpp -c"
742 aros_config_ldflags=""
744 aros_shared_default=yes
746 aros_shared_cflags="-fPIC"
747 aros_shared_aflags=""
748 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
749 aros_kernel_ldflags="-Wl,-rpath,./lib"
751 aros_kernel_ar_flags="cr"
752 aros_target_ar_flags="cr"
753 aros_target_nm_flags="-C -ul"
754 aros_target_strip_flags="--strip-unneeded -R.comment"
756 aros_c_libs=
757 aros_cxx_libs=
759 aros_target_genmap="-Wl,-Map -Xlinker"
761 # Native flavour stuff
762 aros_serial_debug="0"
764 # Palm native flavour stuff
765 aros_palm_debug_hack="0"
767 # Unix flavour stuff
768 aros_nesting_supervisor="0"
770 # Collect-aros stuff: "-ius" to ignore undefined symbols
771 ignore_undefined_symbols=""
773 # Check for X11 by default
774 need_x11="auto"
776 AC_MSG_CHECKING([Which toolchain family to use ...])
777 AC_ARG_WITH(toolchain,AC_HELP_STRING([--with-toolchain=family],[Which toolchain family to crosscompile with (defaults to gnu)]),aros_toolchain="$withval",aros_toolchain="$default_toolchain_family")
778 AC_MSG_RESULT($aros_toolchain)
781 AC_MSG_CHECKING([if we should enable link time optimizations (LTO)])
782 AC_ARG_ENABLE(lto,AC_HELP_STRING([--enable-lto=[yes|no]],[Enable link time optimizations if the target compiler supports them (default=no)]),
783  aros_config_lto="$enableval",aros_config_lto="no")
784 if test "$aros_config_lto" != "no"; then
785     aros_config_lto="yes"
787 AC_MSG_RESULT($aros_config_lto)
789 AC_MSG_CHECKING([if we should enable coverage instrumentation])
790 AC_ARG_ENABLE(coverage,AC_HELP_STRING([--enable-coverage=[yes|no]],[Enable coverage instrumentation if the target compiler supports it (default=no)]),
791  aros_config_coverage="$enableval",aros_config_coverage="no")
792 if test "$aros_config_coverage" != "no"; then
793     aros_config_coverage="yes"
795 AC_MSG_RESULT($aros_config_coverage)
797 use_ld_wrapper=yes
799 case "$aros_toolchain" in
800     *llvm*)
801         toolchain_c_compiler="clang"
802         toolchain_cxx_compiler="clang++"
803         toolchain_cpp_preprocessor="clang"
804         toolchain_cpp_opts=" -E"
805         toolchain_ld="ld.lld"
806         aros_ld="ld"
807         toolchain_as="llvm-as"
808         toolchain_ar="llvm-ar"
809         toolchain_ranlib="llvm-ranlib"
810         toolchain_nm="llvm-nm"
811         toolchain_strip="true"
812         toolchain_objcopy="llvm-objcopy"
813         toolchain_objdump="llvm-objdump"
814         use_libatomic=yes
815         toolchain_def_opt_lvl="-O2"
816         toolchain_debug_opt_lvl="-O0"
817         toolchain_size_opt_lvl="-Os"
818         ;;
819     *gnu*)
820         toolchain_c_compiler="gcc"
821         toolchain_cxx_compiler="g++"
822         toolchain_cpp_preprocessor="gcc"
823         toolchain_cpp_opts=" -E"
824         toolchain_as="as"
825         aros_ld="ld"
826         if test "$aros_config_lto" != "yes"; then
827             toolchain_ld="ld"
828             toolchain_ar="ar"
829             toolchain_ranlib="ranlib"
830             toolchain_nm="nm"
831         else
832             toolchain_ld="ld.bfd"
833             toolchain_ar="gcc-ar"
834             toolchain_ranlib="gcc-ranlib"
835             toolchain_nm="gcc-nm"
836         fi
837         toolchain_strip="strip"
838         toolchain_objcopy="objcopy"
839         toolchain_objdump="objdump"
840         use_libatomic=yes
841         toolchain_def_opt_lvl="-O2"
842         toolchain_debug_opt_lvl="-O0"
843         toolchain_size_opt_lvl="-Os"
844         ;;
845     *)
846         AC_MSG_WARN("Unknown toolchain family!")
847         toolchain_c_compiler="cc"
848         toolchain_cxx_compiler="c++"
849         toolchain_cpp_preprocessor="cpp"
850         toolchain_cpp_opts=
851         toolchain_ld="ld"
852         aros_ld="ld"
853         toolchain_as="as"
854         toolchain_ar="ar"
855         toolchain_ranlib="ranlib"
856         toolchain_nm="nm"
857         toolchain_strip="strip"
858         toolchain_objcopy="objcopy"
859         toolchain_objdump="objdump"
860         ;;
861 esac
863 #-----------------------------------------------------------------------------
865 AC_MSG_CHECKING([which type of build to do])
866 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")
868 if test "$build_type" = "nightly"; then
869     build_type_string="NIGHTLY"
870 elif test "$build_type" = "snapshot"; then
871     build_type_string="SNAPSHOT"
872 elif test "$build_type" = "milestone"; then
873     build_type_string="MILESTONE"
874 elif test "$build_type" = "release"; then
875     build_type_string="RELEASE"
876 else
877     build_type_string="PERSONAL"
878     build_type="personal"
881 aros_config_cppflags="$aros_config_cppflags -DAROS_BUILD_TYPE=AROS_BUILD_TYPE_$build_type_string"
883 AC_MSG_RESULT($build_type)
885 #-----------------------------------------------------------------------------
886 all_debug_types="messages stack modules mungwall symbols"
888 AC_MSG_CHECKING([which debug types to enable])
889 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)]),
890  debug="$enableval",debug="")
892 if test "$debug" = "" -o "$debug" = "no"; then
893     debug="none"
894 elif test "$debug" = "yes"; then
895     debug="all"
898 if test "$debug" = "all" ; then
899     debug="messages stack modules symbols"
900     for d in $all_debug_types; do
901         export aros_${d}_debug="1"
902     done
903 else
904     for d in $all_debug_types; do
905         export aros_${d}_debug="0"
906     done
909 if test "$debug" != "none"; then
910     debug=`echo $debug | sed s/,/\ /g`
911     for d in $debug; do
912         found="0"
913         for d2 in $all_debug_types; do
914             if test "$d2" = "$d"; then
915                 found="1"
916                 break
917             fi
918         done
919         if test "$found" = "0"; then
920             AC_MSG_ERROR([unrecognized debug type "$d". Available types are: all none $all_debug_types])
921         fi
922         export aros_${d}_debug="1"
923     done
924     aros_debug="yes"
926 AC_MSG_RESULT($debug)
928 if test "$aros_messages_debug" = "1"; then
929     aros_messages_debug="-DADEBUG=1 -DMDEBUG=1"
930 else
931     aros_messages_debug=""
933 if test "$aros_symbols_debug" = "1"; then
934     aros_symbols_debug="-g"
935 else
936     aros_symbols_debug=""
939 # These are the flags to pass when compiling debugged programs
940 aros_debug_cppflags="$aros_messages_debug"
941 aros_debug_cflags="$aros_symbols_debug"
942 aros_debug_cxxflags=
943 aros_debug_aflags=""
944 aros_debug_ldflags="$aros_symbols_debug"
946 #-----------------------------------------------------------------------------
947 #   Checking for distcc and ccache.
949 #   Always apply the transforms in this particular order. Basically you should
950 #   always run 'ccache distcc compiler' in that order for the best performance.
952 AC_MSG_CHECKING([whether to enable distcc])
953 AC_ARG_ENABLE(distcc,AC_HELP_STRING([--enable-distcc],[Use distcc as a front end to the compiler (default=no).]),distcc="$enableval",distcc="no")
954 if test "$distcc" != "" -a "$distcc" != "no"; then
955     # AC_CHECK_PROG will print out the result in this case
956     AC_PATH_PROG(DISTCC,[distcc],distcc,)
957 else
958     AC_MSG_RESULT(no)
961 AC_MSG_CHECKING([whether to enable ccache])
962 AC_ARG_ENABLE(ccache,AC_HELP_STRING([--enable-ccache],[Use ccache as a front end to the compiler (default=no).]),ccache="$enableval",ccache="no")
963 if test "$ccache" != "" -a "$ccache" != "no"; then
964     # AC_CHECK_PROG will print out the result in this case
965     AC_CHECK_PROG(CCACHE,[ccache],ccache,)
966 else
967     AC_MSG_RESULT(no)
970 #-----------------------------------------------------------------------------
971 AC_MSG_CHECKING([what specific host gcc version to use])
972 AC_ARG_WITH(kernel-gcc-version,AC_HELP_STRING([--with-kernel-gcc-version=VERSION],[Use gcc-VERSION for building bootstrap]),kernel_tool_version="$withval",kernel_tool_version="")
973 if test "$kernel_tool_version" != "" ; then
974     msg_result=$kernel_tool_version
975 else
976     msg_result="default"
978 AC_MSG_RESULT($msg_result)
980 #-----------------------------------------------------------------------------
981 AC_MSG_CHECKING([what optimization flags to use])
982 AC_ARG_WITH(optimization,AC_HELP_STRING([--with-optimization=FLAGS],[Use optimization flags FLAGS (e.g --with-optimization=-O2).]),optimization_level="$withval",optimization_level="unknown")
983 if test "$optimization_level" = "unknown"; then
984     dnl use the toolchain defaults for normal and debug builds
985     optimization="default"
986     if test "$debug" != "none"; then
987         optimization_level=$toolchain_debug_opt_lvl
988     else
989         optimization_level=$toolchain_def_opt_lvl
990     fi
991 else
992     optimization="$optimization_level"
994 AC_MSG_RESULT($optimization)
996 paranoia_default=yes
997 #-----------------------------------------------------------------------------
998 AC_MSG_CHECKING([which paranoia flags to use])
999 AC_ARG_WITH(paranoia,AC_HELP_STRING([--with-paranoia=(yes|no|FLAGS)],[Specific compiler warning FLAGS to enable for paranoia builds (default=-Wall -Werror)]),[paranoia_flags="$withval"],[paranoia_flags="$paranoia_default"])
1000 if test "$paranoia_flags" = "no"; then
1001         paranoia_flags="$""(WARN_ALL) -Werror-implicit-function-declaration"
1002         msg_result="none"
1003 else
1004     if test "$paranoia_flags" = "yes"; then
1005         paranoia_flags="$""(WARN_ALL) $""(WARN_ERROR)"
1006     fi
1007     msg_result="$paranoia_flags"
1009 AC_MSG_RESULT($msg_result)
1010 aros_warn_flags="$aros_warn_flags $paranoia_flags"
1012 #-----------------------------------------------------------------------------
1013 AC_MSG_CHECKING([what target variant to enable])
1014 AC_ARG_ENABLE(target_variant,AC_HELP_STRING([--enable-target-variant=NAME],[Enable a specific target variant (default=none)]),target_variant=$enableval,target_variant="")
1015 if test "$target_variant" = ""; then
1016     aros_target_variant=""
1017     aros_target_suffix=""
1018     enableval="none"
1019 else
1020     aros_target_variant="$target_variant"
1021     aros_target_suffix="-$target_variant"
1023 AC_MSG_RESULT($enableval)
1025 #-----------------------------------------------------------------------------
1026 # Target-specific defaults. You can override then on a per-target basis.
1028 # Bootloader name. Currently used by PC target.
1029 target_bootloader="none"
1030 PLATFORM_EXECSMP=
1031 ENABLE_EXECSMP=
1033 #-----------------------------------------------------------------------------
1034 # Additional options for some specific targets
1036 case "$aros_target_variant" in
1037 ios)
1038     AC_MSG_CHECKING([XCode path])
1039     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")
1040     AC_MSG_RESULT($aros_xcode_path)
1042     AC_MSG_CHECKING([what iOS SDK version to use])
1043     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")
1044     AC_MSG_RESULT($aros_sdk_version)
1046     ;;
1048 "android")
1049     AC_MSG_CHECKING([Android SDK path])
1050     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)
1051     AC_MSG_RESULT($aros_android_sdk)
1053     AC_MSG_CHECKING([Android NDK path])
1054     AC_ARG_WITH(ndk,AC_HELP_STRING([--with-ndk=PATH],[Specify Android NDK path (default=none).]),aros_android_ndk="$withval",aros_android_ndk="none")
1055     AC_MSG_RESULT($aros_android_ndk)
1057     AC_MSG_CHECKING([what Android SDK version to use])
1058     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")
1059     AC_MSG_RESULT($aros_sdk_version)
1061     aros_android_level=android-$aros_sdk_version
1062     if test ! -d $aros_android_sdk/platforms/$aros_android_level; then
1063         echo "Platform $aros_android_level is not installed in your SDK"
1064         echo "Use --with-sdk-version=<API level number> to select another platform version"
1065         echo "You can check what plaform versions are installed in your SDK"
1066         echo "by examining contents of $aros_android_sdk/platforms directory"
1067         AC_MSG_ERROR([Android platform $aros_android_level is not installed])
1068     fi
1070     export PATH="$aros_android_sdk/tools:$PATH"
1071     AC_PATH_PROG(android_tool, $android_tool)
1072     AROS_REQUIRED(android,$android_tool)
1074     if test "$aros_android_ndk" != "none"; then
1075         AC_MSG_CHECKING([what Android NDK version to use])
1076         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")
1077         AC_MSG_RESULT($aros_ndk_version)
1078     fi
1080     AC_PATH_PROG(ant, ant)
1081     if test "$ant" = ""; then
1082         AC_MSG_WARN([Apache Ant is missing, Java bootstrap can't be built automatically])
1083     fi
1085     AC_MSG_CHECKING([Build debug or release apk])
1086     AC_ARG_WITH(apk-version,AC_HELP_STRING([--with-apk-version=(release|debug)],[Which version of AROSBootstrap.apk to compile. Release version needs key for signing, debug version will only run in emulator. (default=release)]),aros_android_antapk=$withval,aros_android_antapk=release)
1087     if test $aros_android_antapk != release -a $aros_android_antapk != debug; then
1088         AC_MSG_ERROR([apk-version has to be release or debug])
1089     fi
1090     AC_MSG_RESULT($aros_android_antapk)
1092     target_extra_cfg+="$export_newline""# Android$export_newline""AROS_ANDROID_ANTAPK           := $aros_android_antapk$export_newline"
1093     host_extra_cfg+="$export_newline""# Android-specific$export_newline""ANDROID                       := $android_tool$export_newline""ANT                                   := $ant$export_newline"
1094     aros_target_options+="$export_newline""# Enable Android Gfx Driver$export_newline""OPT_HOST_ANDROIDGFX           := yes$export_newline"
1096     dnl MSYS bash can't run .bat files directly, then need to be started via cmd.exe
1097     if test "$host_os" = "mingw32"; then
1098         android_tool="cmd //c $android_tool"
1099     fi
1101     need_dlopen="no"
1103     ;;
1104 esac
1106 #-----------------------------------------------------------------------------
1107 # External toolchains
1108 kernel_tool_prefix="none"
1109 aros_tool_prefix="none"
1110 elf_tool_prefix="${target_cpu}-elf-"
1112 # Base target cpu ISA configuration switch.
1113 case "$target_cpu" in
1114     *aarch64*)
1115         ;;
1116     *arm*)
1117         ;;
1118     *m68k*)
1119         m68k_isa_extra="ISA_MC68000_FLAGS             = -march=68000"
1120         m68k_020_isa_extra="ISA_MC68020_FLAGS             = -march=68020"
1121         m68k_030_isa_extra="ISA_MC68030_FLAGS             = -march=68030"
1122         m68k_040_isa_extra="ISA_MC68040_FLAGS             = -march=68040"
1123         m68k_060_isa_extra="ISA_MC68060_FLAGS             = -march=68060"
1124         m68k_ac080_isa_extra="ISA_AC68080_FLAGS             = -march=68040"
1125         m68k_020_ext="ISA_MC68020_EXT               :=020"
1126         m68k_030_ext="ISA_MC68030_EXT               :=030"
1127         m68k_040_ext="ISA_MC68040_EXT               :=040"
1128         m68k_060_ext="ISA_MC68060_EXT               :=060"
1129         m68k_020_cflags="ISA_MC68020_CFLAGS            ="
1130         m68k_030_cflags="ISA_MC68030_CFLAGS            ="
1131         m68k_040_cflags="ISA_MC68040_CFLAGS            ="
1132         m68k_060_cflags="ISA_MC68060_CFLAGS            ="
1133         m68k_020_cppflags="ISA_MC68020_CPPFLAGS          ="
1134         m68k_030_cppflags="ISA_MC68030_CPPFLAGS          ="
1135         m68k_040_cppflags="ISA_MC68040_CPPFLAGS          ="
1136         m68k_060_cppflags="ISA_MC68060_CPPFLAGS          ="
1137         m68k_020_ldflags="ISA_MC68020_LDFLAGS           ="
1138         m68k_030_ldflags="ISA_MC68030_LDFLAGS           ="
1139         m68k_040_ldflags="ISA_MC68040_LDFLAGS           ="
1140         m68k_060_ldflags="ISA_MC68060_LDFLAGS           ="
1141         ;;
1142     *x86_64* | *i?86*)
1143         x86_isa_extra="ISA_X86_FLAGS                 = -m32 -march=i486"
1144         x86_64_isa_extra="ISA_X8664_FLAGS               = -mcmodel=large"
1145         ;;
1146     *powerpc*)
1147         ;;
1148 esac
1150 # This is the target configuration switch.
1151 case "$target_os" in
1152     linux*)
1153         HOST_WANTS_X11=yes
1154         HOST_WANTS_GLX=yes
1155         HOST_WANTS_SDL=yes
1156         HOST_WANTS_DBUS=yes
1157         HOST_WANTS_DLOPEN=yes
1158         aros_target_arch="linux"
1159         aros_target_family="unix"
1160         case "$target_cpu" in
1161             *m68k*)
1162                 aros_target_cpu="m68k"
1163                 aros_object_format="m68kelf"
1164                 aros_flavour="emulcompat"
1165                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D__mc68000 -D__linux__"
1166                 aros_isa_flags="$""(ISA_MC68000_FLAGS)"
1167                 aros_shared_ldflags="-Wl,-T,\$(TOP)/config/linux/m68k/script.so"
1168                 aros_kernel_ldflags="-Wl,-rpath,./lib,-T,\$(TOP)/config/linux/m68k/script.normal"
1169                 gcc_target_cpu="mc68000"
1170                 ;;
1171             *i?86*)
1172                 aros_target_cpu="i386"
1173                 aros_object_format="elf_i386"
1174                 aros_flavour="emulation"
1175                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__linux__"
1176                 aros_isa_flags="$""(ISA_X86_FLAGS)"
1177                 x86_64_isa_extra="$x86_64_isa_extra $""(CFLAGS_NO_RED_ZONE)"
1178                 aros_kernel_ldflags="-Wl,-melf_i386"
1179                 aros_nominal_depth=8
1180                 gcc_target_cpu="i386"
1181                 pci_hidd_target="hidd-pci-linux"
1182                 android_tool_dir_prefix="x86"
1183                 android_tool_prefix="i686-android-linux"
1184                 android_ndk_arch="x86"
1185                 ;;
1186             *x86_64*)
1187                 aros_target_cpu="x86_64"
1188                 aros_object_format="elf_x86_64"
1189                 aros_flavour="emulation"
1190                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64 -D__linux__"
1191                 aros_isa_flags="$""(ISA_X8664_FLAGS)"
1192                 x86_64_isa_extra="$x86_64_isa_extra $""(CFLAGS_NO_RED_ZONE)"
1193                 aros_config_cflags="$aros_config_cflags $""(CFLAGS_NO_OMIT_FP)"
1194                 aros_config_cxxflags="$aros_config_cxxflags $""(CFLAGS_NO_OMIT_FP)"
1195                 aros_nominal_depth=8
1196                 pci_hidd_target="hidd-pci-linux"
1197                 ;;
1198             *powerpc*)
1199                 aros_target_cpu="ppc"
1200                 aros_object_format="elf32ppc"
1201                 aros_flavour="emulation"
1202                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc -D__linux__"
1203                 aros_nominal_depth=8
1204                 gcc_target_cpu="ppc"
1205                 ;;
1206 # TODO
1207 # Same as powerpc, but I need this for the nightly build to work again.
1208 # Actually, the nightly should be made working with powerpc target.
1209 # That just was too much work for the moment, another week or two.
1210             *ppc*)
1211                 aros_target_cpu="ppc"
1212                 aros_object_format="elf32ppc"
1213                 aros_flavour="emulation"
1214                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc -D__linux__"
1215                 aros_nominal_depth=8
1216                 gcc_target_cpu="ppc"
1217                 ;;
1218             *aarch64*)
1219                 aros_target_cpu="aarch64"
1220                 target_cpu="aarch64"
1221                 aros_object_format="aarch64elf_aros"
1222                 aros_flavour="emulation"
1223                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm -D__linux__"
1224                 gcc_target_cpu="aarch64"
1225                 aros_config_cflags="$aros_config_cflags $""(CFLAGS_NO_STRICT_ALIASING) $""(CFLAGS_NO_OMIT_FP)"
1226                 aros_config_cxxflags="$aros_config_cxxflags $""(CFLAGS_NO_STRICT_ALIASING) $""(CFLAGS_NO_OMIT_FP)"
1227                 aros_config_aflags="$aros_config_aflags $""(CFLAGS_NO_STRICT_ALIASING)"
1228                 aros_c_libs="$aros_c_libs -laeabi"
1229                 gcc_default_float_abi="hard"
1230                 kernel_tool_prefix="aarch64-linux-gnueabihf-"
1231                 ;;
1232             *armhf*)
1233                 aros_target_cpu="arm"
1234                 target_cpu="arm"
1235                 aros_object_format="armelf_aros"
1236                 aros_flavour="emulation"
1237                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm -D__linux__"
1238                 gcc_target_cpu="arm"
1239                 aros_config_cflags="$aros_config_cflags $""(CFLAGS_NO_STRICT_ALIASING) $""(CFLAGS_NO_OMIT_FP)"
1240                 aros_config_cxxflags="$aros_config_cxxflags $""(CFLAGS_NO_STRICT_ALIASING) $""(CFLAGS_NO_OMIT_FP)"
1241                 aros_config_aflags="$aros_config_aflags $""(CFLAGS_NO_STRICT_ALIASING)"
1242                 aros_c_libs="$aros_c_libs -laeabi"
1243                 gcc_default_float_abi="hard"
1244                 android_tool_dir_prefix="arm-linux-androideabi"
1245                 android_tool_prefix="arm-linux-androideabi"
1246                 android_ndk_arch="arm"
1247                 kernel_tool_prefix="arm-linux-gnueabihf-"
1248                 ;;
1249             *arm*)
1250                 aros_target_cpu="arm"
1251                 aros_object_format="armelf_aros"
1252                 aros_flavour="emulation"
1253                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm -D__linux__"
1254                 gcc_target_cpu="arm"
1255                 aros_config_cflags="$aros_config_cflags $""(CFLAGS_NO_STRICT_ALIASING) $""(CFLAGS_NO_OMIT_FP)"
1256                 aros_config_cxxflags="$aros_config_cxxflags $""(CFLAGS_NO_STRICT_ALIASING) $""(CFLAGS_NO_OMIT_FP)"
1257                 aros_config_aflags="$aros_config_aflags $""(CFLAGS_NO_STRICT_ALIASING)"
1258                 aros_c_libs="$aros_c_libs -laeabi"
1259                 android_tool_dir_prefix="arm-linux-androideabi"
1260                 android_tool_prefix="arm-linux-androideabi"
1261                 android_ndk_arch="arm"
1262                 kernel_tool_prefix="arm-linux-gnueabi-"
1263                 ;;
1264             *)
1265                 AC_MSG_ERROR("Unknown CPU for Linux -- $target_cpu")
1266                 ;;
1267         esac
1268         case "$aros_target_variant" in
1269             android)
1271                 dnl Not all Linux CPUs are supported by Android
1272                 if test "$android_ndk_arch" = ""; then
1273                     AC_MSG_ERROR("Unsupported CPU for Android -- $target_cpu")
1274                 fi
1276                 aros_nominal_width=320
1277                 aros_nominal_height=480
1278                 if test "$aros_android_ndk" = "none"; then
1279                     dnl Use standalone toolchain, don't adjust paths
1280                     aros_kernel_cflags="-mandroid"
1281                     aros_kernel_ldflags="-mandroid"
1282                     CFLAGS="-mandroid"
1283                 else
1284                     dnl In Android NDK toolchains are placed in own directories,
1285                     dnl but tool names are not suffixed with version 
1286                     export PATH="$aros_android_ndk/toolchains/$android_tool_dir_prefix-$kernel_tool_version/prebuilt/$android_build_os/bin:$PATH"
1287                     kernel_tool_version=""
1288                     aros_android_ndk="$aros_android_ndk/platforms/android-$aros_ndk_version/arch-$android_ndk_arch"
1289                     aros_kernel_cflags="--sysroot $aros_android_ndk -mandroid"
1290                     aros_kernel_ldflags="--sysroot $aros_android_ndk -mandroid"
1291                     CFLAGS="$CFLAGS --sysroot $aros_android_ndk -mandroid"
1292                     aros_kernel_includes="-isystem $aros_android_ndk/usr/include"
1293                 fi
1294                 need_x11=no
1295                 # Disable implicit PIC mode
1296                 aros_config_cflags="$aros_config_cflags -fno-pic"
1297                 kernel_tool_prefix="$android_tool_prefix-"
1298             ;;
1299         esac
1300     ;;
1302     pc)
1303         aros_target_arch="pc"
1304         aros_shared_default="no"
1305         target_bootloader="grub2"
1306         case "$target_cpu" in
1307             *i?86*)
1308                 aros_target_cpu="i386"
1310                 dnl If somebody hasn't already set the target object
1311                 dnl format, then use this value. Mostly to support
1312                 dnl FreeBSD cross-compilation.
1313                 dnl TODO: Remove when we always use our compiler.
1315                 if test "$aros_object_format" = "" ; then
1316                     aros_object_format="elf_i386"
1317                 fi
1318                 aros_flavour="standalone"
1319                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1320                 aros_isa_flags="$""(ISA_X86_FLAGS)"
1321                 x86_64_isa_extra="$x86_64_isa_extra $""(CFLAGS_NO_RED_ZONE)"
1322                 aros_kernel_ldflags="-Wl,-melf_i386"
1323                 aros_nominal_width=640
1324                 aros_nominal_height=480
1325                 gcc_target_cpu="i386"
1326                 ;;
1327             *x86_64*)
1328                 PLATFORM_EXECSMP="#define __AROSPLATFORM_SMP__"
1329                 aros_target_cpu="x86_64"
1330                 aros_serial_debug=1
1331                 if test "$aros_object_format" = "" ; then
1332                     aros_object_format="elf_x86_64"
1333                 fi
1334                 aros_flavour="standalone"
1335                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
1336                 aros_isa_flags="$""(ISA_X8664_FLAGS)"
1337                 x86_64_isa_extra="$x86_64_isa_extra $""(CFLAGS_NO_RED_ZONE)"
1338                 aros_config_cflags="$aros_config_cflags $""(CFLAGS_NO_ASYNCHRONOUS_UNWIND_TABLES) $""(CFLAGS_NO_OMIT_FP)"
1339                 aros_config_cxxflags="$aros_config_cxxflags $""(CFLAGS_NO_ASYNCHRONOUS_UNWIND_TABLES) $""(CFLAGS_NO_OMIT_FP)"
1340                 aros_kernel_ldflags=""
1341                 aros_nominal_width=640
1342                 aros_nominal_height=480
1343                 case "$aros_target_variant" in
1344                     smp)
1345                         ENABLE_EXECSMP="#define __AROSEXEC_SMP__"
1346                     ;;
1347                 esac
1348                 ;;
1349             *)
1350                 AC_MSG_ERROR("Unknown native CPU -- $target_cpu")
1351                 ;;
1352         esac
1353         ;;
1355     prep)
1356         aros_target_arch="prep"
1357         aros_shared_default="no"
1358         aros_target_cpu="ppc"
1359         aros_object_format="elf32ppc"
1360         aros_flavour="ppcnative"
1361         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1362         aros_kernel_ldflags=""
1363         aros_nominal_width=640
1364         aros_nominal_height=480
1365         gcc_target_cpu="ppc"
1366         ;;
1368     freebsd*)
1369         HOST_WANTS_X11=yes
1370         HOST_WANTS_GLX=yes
1371         HOST_WANTS_SDL=yes
1372         HOST_WANTS_DBUS=yes
1373         HOST_WANTS_DLOPEN=yes
1374         aros_target_arch="freebsd"
1375         aros_target_family="unix"
1376         aros_target_cpu="i386"
1377         aros_flavour="emulation"
1378         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1379         gcc_target_cpu="i386"
1381         aros_target_strip_flags="-x"
1382         ;;
1384     darwin*)
1385         HOST_WANTS_X11=yes
1386         HOST_WANTS_GLX=yes
1387         HOST_WANTS_SDL=yes
1388         HOST_WANTS_DBUS=yes
1389         HOST_WANTS_DLOPEN=yes
1390         aros_target_arch="darwin"
1391         aros_target_family="unix"
1392         aros_flavour="emulation"
1393         case "$target_cpu" in
1394             *i?86*)
1395                 aros_ios_platform="iPhoneSimulator"
1396                 aros_target_cpu="i386"
1397                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1398                 aros_isa_flags="$""(ISA_X86_FLAGS)"
1399                 aros_kernel_ldflags=""
1400                 aros_macosx_version="10.4"
1401                 aros_nominal_depth=8
1402                 gcc_target_cpu="i386"
1403                 aros_object_format="elf_i386"
1404                 aros_kernel_ar_flags="-cr"
1405                 aros_target_strip_flags="-x"
1406                 kernel_tool_flags="-m32"
1407                 ;;
1408             *x86_64*)
1409                 aros_target_cpu="x86_64"
1410                 aros_object_format="elf_x86_64"
1411                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
1412                 aros_isa_flags="$""(ISA_X8664_FLAGS)"
1413                 aros_macosx_version="10.6"
1414                 aros_config_cflags="$aros_config_cflags $""(CFLAGS_NO_OMIT_FP)"
1415                 aros_config_cxxflags="$aros_config_cxxflags $""(CFLAGS_NO_OMIT_FP)"
1416                 aros_kernel_cflags="-m64"
1417                 aros_kernel_ldflags="-m64"
1418                 aros_nominal_depth=8
1419                 aros_kernel_rs="$toolchain_ar"
1420                 aros_kernel_ar_flags="-cr"
1421                 aros_kernel_ld="$toolchain_ld"
1422                 aros_kernel_as="$toolchain_as"
1423                 aros_kernel_ranlib="$toolchain_ranlib"
1424                 aros_kernel_nm="$toolchain_nm"
1425                 aros_kernel_strip="strip"
1426                 kernel_tool_prefix="i686-apple-darwin10-"
1427                 ;;
1428             *ppc*)
1429                 aros_target_cpu="ppc"
1430                 aros_object_format="elf32ppc"
1431                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1432                 aros_kernel_ldflags=""
1433                 aros_macosx_version="10.0"
1434                 aros_nominal_depth=8
1435                 gcc_target_cpu="ppc"
1436                 aros_kernel_rs="$toolchain_ar"
1437                 aros_kernel_ar_flags="-cr"
1438                 aros_kernel_ld="$toolchain_ld -arch ppc"
1439                 aros_kernel_as="$toolchain_as -arch ppc"
1440                 aros_kernel_ranlib="$toolchain_ranlib -arch ppc"
1441                 aros_kernel_nm="$toolchain_nm -arch ppc"
1442                 aros_kernel_strip="strip -arch ppc"
1443                 kernel_tool_prefix="powerpc-apple-darwin10-"
1444                 ;;
1445             *arm*)
1446                 aros_ios_platform="iPhoneOS"
1447                 aros_target_cpu="arm"
1448                 aros_object_format="armelf_aros"
1449                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
1450                 aros_c_libs="$aros_c_libs -laeabi"
1451                 aros_nominal_depth=8
1452                 gcc_target_cpu="arm"
1453                 aros_kernel_rs="$toolchain_ar"
1454                 aros_kernel_ar_flags="-cr"
1455                 aros_kernel_ld="$toolchain_ld -arch arm"
1456                 aros_kernel_ranlib="$toolchain_ranlib -arch arm"
1457                 kernel_tool_prefix="arm-apple-darwin10-" 
1458                 export PATH="$aros_xcode_path/Platforms/$aros_ios_platform.platform/Developer/usr/bin:$PATH"
1459                 ;;
1460             *)
1461                 AC_MSG_ERROR("Unsupported target CPU for darwin hosted flavour -- $target_cpu")
1462                 ;;
1463         esac
1464         case "$aros_target_variant" in
1465             ios)
1466                 make_extra_targetcfg="$export_newline""# Apple iOS stuff for gcc$export_newline""IOS_LDFLAGS  := -F$""(IOS_SDK_PATH)/System/Library/Frameworks$export_newline"
1467                 aros_ios_version="3.0"
1468                 aros_nominal_width=320
1469                 aros_nominal_height=480
1470                 aros_ios_sdk="$aros_xcode_path/Platforms/$aros_ios_platform.platform/Developer/SDKs/$aros_ios_platform$aros_sdk_version.sdk"
1471                 target_extra_cfg+="$export_newline""# Apple iOS specific$export_newline""IOS_PLATFORM            := $aros_ios_platform$export_newline""IOS_OS_VERSION          := $aros_ios_version$export_newline""IOS_SDK_PATH            := $aros_ios_sdk$export_newline"
1472                 kernel_tool_flags="$target_tool_flags -isysroot $aros_ios_sdk"
1473                 aros_kernel_includes="-isystem $aros_ios_sdk/usr/include"
1474                 need_x11=no
1475                 # This is here because it may depend on iOS or SDK version
1476                 aros_kernel_cflags="$aros_kernel_cflags -miphoneos-version-min=$aros_ios_version"
1477                 aros_kernel_ldflags="$aros_kernel_ldflags -miphoneos-version-min=$aros_ios_version"
1478                 aros_kernel_objcflags="-fobjc-abi-version=2 -fobjc-legacy-dispatch"
1479             ;;
1480             *)
1481                 aros_kernel_cflags="$aros_kernel_cflags -mmacosx-version-min=$aros_macosx_version"
1482                 aros_kernel_ldflags="$aros_kernel_ldflags -mmacosx-version-min=$aros_macosx_version"
1483             ;;
1484         esac
1485         ;;
1487     dragonfly*)
1488         HOST_WANTS_X11=yes
1489         HOST_WANTS_GLX=yes
1490         HOST_WANTS_SDL=yes
1491         HOST_WANTS_DBUS=yes
1492         HOST_WANTS_DLOPEN=yes
1493         aros_target_arch="dragonfly"
1494         aros_target_family="unix"
1495         aros_flavour="emulation"
1496         case "$target_cpu" in
1497             *i?86*)
1498                 aros_target_cpu="i386"
1499                 aros_object_format="elf_i386"
1500                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__DragonFly__"
1501                 aros_isa_flags="$""(ISA_X86_FLAGS)"
1502                 ;;
1503             *x86_64*)
1504                 aros_config_cflags="$aros_config_cflags $""(CFLAGS_NO_OMIT_FP)"
1505                 aros_config_cxxflags="$aros_config_cxxflags $""(CFLAGS_NO_OMIT_FP)"
1506                 aros_target_cpu="x86_64"
1507                 aros_object_format="elf_x86_64"
1508                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64 -D__DragonFly__"
1509                 aros_isa_flags="$""(ISA_X8664_FLAGS)"
1510                 ;;
1511             *)
1512                 AC_MSG_ERROR("Unknown CPU for DragonFly -- $target_cpu")
1513                 ;;
1514         esac
1515         ;;
1517     netbsd*)
1518         HOST_WANTS_X11=yes
1519         HOST_WANTS_GLX=yes
1520         HOST_WANTS_SDL=yes
1521         HOST_WANTS_DBUS=yes
1522         HOST_WANTS_DLOPEN=yes
1523         aros_target_arch="netbsd"
1524         aros_target_family="unix"
1525         case "$target_cpu" in
1526             *m68k*)
1527                 aros_target_cpu="m68k"
1528                 aros_object_format="m68kelf"
1529                 aros_flavour="emulcompat"
1530                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D__mc68000 -D__NetBSD__"
1531                 aros_isa_flags="$""(ISA_MC68000_FLAGS)"
1532                 gcc_target_cpu="mc68000"
1533                 ;;
1534             *i?86*)
1535                 aros_target_cpu="i386"
1536                 aros_object_format="elf_i386"
1537                 aros_flavour="emulation"
1538                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__NetBSD__"
1539                 aros_isa_flags="$""(ISA_X86_FLAGS)"
1540                 aros_nominal_depth=8
1541                 gcc_target_cpu="i386"
1542                 ;;
1543             *)
1544                 AC_MSG_ERROR("Unknown CPU for NetBSD -- $target_cpu")
1545                 ;;
1546         esac
1547         aros_target_genmap="-Wl,-M -Xlinker >"
1548         aros_flavour="emulation"
1549         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1550         ;;   
1552     openbsd*)
1553         HOST_WANTS_X11=yes
1554         HOST_WANTS_GLX=yes
1555         HOST_WANTS_SDL=yes
1556         HOST_WANTS_DBUS=yes
1557         HOST_WANTS_DLOPEN=yes
1558         aros_target_arch="openbsd"
1559         aros_target_family="unix"
1560         case "$target_cpu" in
1561             *i?86*)
1562                 aros_target_cpu="i386"
1563                 aros_object_format="elf_i386"
1564                 aros_flavour="emulation"
1565                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__OpenBSD__"
1566                 aros_isa_flags="$""(ISA_X86_FLAGS)"
1567                 gcc_target_cpu="i386"
1568                 ;;
1569             *)
1570                 AC_MSG_ERROR("Unknown CPU for OpenBSD -- $target_cpu")
1571                 ;;
1572         esac
1573         aros_target_genmap="-Wl,-M -Xlinker >"
1574         aros_target_nm_flags="-u"
1575         aros_flavour="emulation"
1576         ;;
1578     solaris*)
1579         aros_target_arch="solaris"
1580         aros_target_family="unix"
1581         case "$target_cpu" in
1582            *i?86*)
1583                aros_target_cpu="i386"
1584                aros_object_format="elf_i386"
1585                aros_flavour="emulation"
1586                aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__Solaris__"
1587                aros_isa_flags="$""(ISA_X86_FLAGS)"
1588                aros_nominal_depth=8
1589                gcc_target_cpu="i386"
1590                ;;
1591             *sparc*)
1592                 aros_target_cpu="sparc"
1593                 aros_object_format="elf_sparc"
1594                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dsparc -D__Solaris__"
1595                 gcc_target_cpu="sparc"
1596                 ;;
1597             *)
1598                 AC_MSG_ERROR("Unknown CPU for Solaris -- $target_cpu")
1599                 ;;
1600         esac
1601         aros_config_cppflags="$aros_config_cppflags -D$aros_target_cpu"
1602         aros_flavour="emulation"
1603         ;;
1605     morphos*)
1606         aros_target_arch="morphos"
1607         aros_shared_default="no"
1608         aros_target_cpu="ppc"
1609         aros_object_format="elf_ppc"
1610         aros_flavour="nativecompat"
1611         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1612         gcc_target_cpu="ppc"
1613         ;;
1615     sam440)
1616         aros_target_arch="sam440"
1617         aros_shared_default="no"
1618         aros_target_cpu="ppc"
1619         aros_object_format="elf32ppc"
1620         aros_flavour="ppcnative"
1621         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1622         aros_kernel_ldflags=""
1623         aros_nominal_width=1024
1624         aros_nominal_height=768
1625         aros_nominal_depth=24
1626         aros_isa_flags="$aros_isa_flags -mcpu=440fp -mno-toc"
1627         aros_config_cflags="$aros_config_cflags $""(CFLAGS_NO_ASYNCHRONOUS_UNWIND_TABLES)"
1628         aros_config_cxxflags="$aros_config_cxxflags $""(CFLAGS_NO_ASYNCHRONOUS_UNWIND_TABLES)"
1629         gcc_target_cpu="powerpc"
1630         ;;
1632     efika)
1633         aros_target_arch="efika"
1634         aros_shared_default="no"
1635         aros_target_cpu="arm"
1636         aros_object_format="armelf_aros"
1637         aros_flavour="standalone"
1638         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
1639         aros_kernel_ldflags=""
1640         aros_nominal_width=1024
1641         aros_nominal_height=600
1642         aros_c_libs="$aros_c_libs -laeabi"
1643         gcc_default_cpu="armv7-a"
1644         gcc_default_fpu="vfpv3"
1645         aros_isa_flags="$aros_isa_flags -mtune=cortex-a8"
1646         aros_config_cflags="$aros_config_cflags $""(CFLAGS_NO_STRICT_ALIASING) $""(CFLAGS_NO_ASYNCHRONOUS_UNWIND_TABLES)"
1647         aros_config_cxxflags="$aros_config_cxxflags $""(CFLAGS_NO_STRICT_ALIASING) $""(CFLAGS_NO_ASYNCHRONOUS_UNWIND_TABLES)"
1648         aros_config_aflags="$aros_config_aflags $""(CFLAGS_NO_STRICT_ALIASING) $""(CFLAGS_NO_ASYNCHRONOUS_UNWIND_TABLES)"
1649         if test "$optimization" = "default"; then
1650             optimization_level=$toolchain_size_opt_lvl
1651         fi
1652         case "$target_cpu" in
1653             *armhf*)
1654                 gcc_default_float_abi="hard"
1655                 target_cpu=arm
1656                 aros_target_cpu=arm
1657                 ;;
1658             *arm*)
1659                 gcc_default_float_abi="softfp"
1660                 ;;
1661             *)
1662                 AC_MSG_ERROR("Unknown CPU for EfikaMX $target_cpu")
1663                 ;;
1664         esac
1665         ;;
1666         
1667     chrp)
1668         aros_target_arch="chrp"
1669         aros_shared_default="no"
1670         aros_target_cpu="ppc"
1671         aros_object_format="elf32ppc"
1672         aros_flavour="ppcnative"
1673         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1674         aros_kernel_ldflags=""
1675         aros_nominal_width=640
1676         aros_nominal_height=480
1677         aros_isa_flags="$aros_isa_flags -mno-toc"
1678         aros_config_cflags="$aros_config_cflags $""(CFLAGS_NO_ASYNCHRONOUS_UNWIND_TABLES)"
1679         aros_config_cxxflags="$aros_config_cxxflags $""(CFLAGS_NO_ASYNCHRONOUS_UNWIND_TABLES)"
1680         gcc_target_cpu="powerpc"
1681         case "$aros_target_variant" in
1682             efika)
1683                 aros_isa_flags="$aros_isa_flags -mcpu=603e"
1684                 aros_config_cppflags="$aros_config_cppflags -DBIG_ENDIAN_OHCI=1"
1685             ;;
1686         esac
1687         ;;
1689     r*pi)
1690         PLATFORM_EXECSMP="#define __AROSPLATFORM_SMP__"
1691         aros_flavour="standalone"
1692         aros_target_arch="raspi"
1694         aros_shared_default="no"
1696         aros_target_mkdep="$aros_target_mkdep -D__GNUC__"
1697         
1698         case "$target_cpu" in
1699             *aarch64*)
1700                 aros_target_cpu="aarch64"
1701                 gcc_default_cpu="aarch64"
1702                 aros_object_format="aarch64elf_aros"
1703                 ;;
1704             *armhf*)
1705                 aros_target_cpu="arm"
1706                 gcc_default_cpu="armv6zk"
1707                 gcc_default_cpu_tune="arm1176jzf-s"
1708                 aros_object_format="armelf_aros"
1709                 aros_isa_flags="$aros_isa_flags -marm"
1710                 aros_config_cflags="$aros_config_cflags"
1711                 aros_config_cxxflags="$aros_config_cxxflags"
1712                 aros_config_aflags="$aros_config_aflags -marm"
1713                 aros_kernel_cflags="$aros_kernel_cflags -marm"
1714                 aros_target_mkdep="$aros_target_mkdep -Darm"
1715                 aros_c_libs="$aros_c_libs -laeabi"
1716                 ;;
1717             *armeb*)
1718                 aros_flavour="standcompat"
1719                 aros_target_cpu="armeb"
1720                 gcc_default_float_abi="hard"
1721                 gcc_default_cpu="armv7ve"
1722                 gcc_default_cpu_tune="cortex-a7"
1723                 aros_object_format="armelfb_aros"
1724                 aros_isa_flags="$aros_isa_flags -marm"
1725                 aros_config_cflags="$aros_config_cflags"
1726                 aros_config_cxxflags="$aros_config_cxxflags"
1727                 aros_config_aflags="$aros_config_aflags -marm"
1728                 aros_kernel_cflags="$aros_kernel_cflags -marm"
1729                 aros_target_mkdep="$aros_target_mkdep -Darm"
1730                 aros_c_libs="$aros_c_libs -laeabi"
1731                 ;;
1732             *arm*)
1733                 aros_target_cpu="arm"
1734                 gcc_default_cpu="armv6zk"
1735                 gcc_default_cpu_tune="arm1176jzf-s"
1736                 aros_object_format="armelf_aros"
1737                 aros_isa_flags="$aros_isa_flags -marm"
1738                 aros_config_cflags="$aros_config_cflags"
1739                 aros_config_cxxflags="$aros_config_cxxflags"
1740                 aros_config_aflags="$aros_config_aflags -marm"
1741                 aros_kernel_cflags="$aros_kernel_cflags -marm"
1742                 aros_target_mkdep="$aros_target_mkdep -Darm"
1743                 aros_c_libs="$aros_c_libs -laeabi"
1744                 ;;
1745             *)
1746                 AC_MSG_ERROR("Unknown CPU for RasPi $target_cpu")
1747                 ;;
1748         esac
1750         aros_config_cflags="$aros_config_cflags $""(CFLAGS_NO_ASYNCHRONOUS_UNWIND_TABLES) $""(CFLAGS_NO_EXCEPTIONS)"
1751         aros_config_cxxflags="$aros_config_cxxflags $""(CFLAGS_NO_ASYNCHRONOUS_UNWIND_TABLES) $""(CFLAGS_NO_EXCEPTIONS)"
1752         aros_config_aflags="$aros_config_aflags $""(CFLAGS_NO_ASYNCHRONOUS_UNWIND_TABLES) $""(CFLAGS_NO_EXCEPTIONS)"
1753         aros_kernel_cflags="$aros_kernel_cflags $""(CFLAGS_NO_ASYNCHRONOUS_UNWIND_TABLES) $""(CFLAGS_NO_EXCEPTIONS)"
1755         case "$aros_target_variant" in
1756             smp)
1757                 ENABLE_EXECSMP="#define __AROSEXEC_SMP__"
1758             ;;
1759         esac
1760         ;;
1762     stm32f7_discovery)
1763         aros_flavour="standalone"
1764         aros_target_arch="stm32f7_discovery"
1765         aros_target_cpu="arm"
1766         aros_target_cpu_mode="thumb2"
1767         aros_object_format="armelf_aros"
1768         aros_shared_default="no"
1770         gcc_default_cpu="armv7e-m"
1771         gcc_default_cpu_tune="cortex-m7"
1772         gcc_default_fpu="fpv5-sp-d16"
1773         gcc_default_float_abi="hard"
1775         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dthumb"
1776         ;;
1778     amiga*)
1779         aros_elf_translate="$""(ELF2HUNK)"
1780         make_extra_commands="$export_newline""ELF2HUNK  := $""(TOOLDIR)/elf2hunk$""(HOST_EXE_SUFFIX)$export_newline"
1781         aros_target_arch="amiga"
1782         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D_AMIGA -DAMIGA"
1783         aros_shared_default="no"
1785         case "$target_cpu" in
1786             *m68k*)
1787                 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")
1788                 aros_enable_mmu=no
1789                 aros_target_cpu="m68k"
1790                 aros_object_format="m68kelf"
1791                 aros_flavour="standcompat"
1792                 gcc_target_cpu="m68000"
1793                 aros_isa_flags="$""(ISA_MC68000_FLAGS)"
1794                 aros_nowarn_flags="$aros_nowarn_flags NOWARN_VOLATILE_REGISTER_VAR"
1795                 aros_config_cppflags="$aros_config_cppflags -DNOLIBINLINE"
1796                 aros_config_cflags="$aros_config_cflags $""(CFLAGS_NO_STRICT_ALIASING) $""(CFLAGS_FREESTANDING) $""(CFLAGS_OMIT_FP) $""(CFLAGS_BUILTIN)"
1797                 aros_config_cxxflags="$aros_config_cxxflags $""(CFLAGS_NO_STRICT_ALIASING) $""(CFLAGS_FREESTANDING) $""(CFLAGS_OMIT_FP) $""(CFLAGS_BUILTIN)"
1798                 if test "$optimization" = "default"; then
1799                     optimization_level=$toolchain_size_opt_lvl
1800                 fi
1801                 aros_config_aflags="$aros_config_aflags"
1802                 aros_target_strip_flags="-R.comment --strip-debug"
1803                 aros_nominal_width=640
1804                 aros_nominal_height=256
1805                 aros_nominal_depth=2
1806                 ;;
1807             *ppc*)
1808                 aros_cpu="ppc"
1809                 aros_flavour="native"
1810                 gcc_target_cpu="ppc"
1811                 ;;
1812             *)
1813                 AC_MSG_ERROR("Unknown CPU for Amiga $target_cpu")
1814                 ;;
1815         esac
1816         ;;
1818     mingw*)
1819         aros_target_arch="mingw32"
1820         aros_shared_default="no"
1821         aros_flavour="emulation"
1822         aros_shared_cflags=""
1823         need_crosstools="yes"
1824         need_dlopen="no"
1825         rescomp="windres"
1826         case "$target_cpu" in
1827             *i?86*)
1828                 aros_target_cpu="i386"
1829                 aros_object_format="elf_i386"
1830                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1831                 aros_isa_flags="$""(ISA_X86_FLAGS)"
1832                 aros_nominal_depth=8
1833                 gcc_target_cpu="i386"
1835                 kernel_tool_prefix="i386-mingw32-"
1836                 ;;
1837             *x86_64*)
1838                 aros_target_cpu="x86_64"
1839                 aros_object_format="elf_x86_64"
1840                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
1841                 aros_isa_flags="$""(ISA_X8664_FLAGS)"
1842                 aros_config_cflags="$aros_config_cflags $""(CFLAGS_NO_OMIT_FP)"
1843                 aros_config_cxxflags="$aros_config_cxxflags $""(CFLAGS_NO_OMIT_FP)"
1844                 aros_nominal_depth=8
1845                 kernel_tool_prefix="x86_64-w64-mingw32-"
1846                 ;;
1847             *arm*)
1848                 aros_target_cpu="arm"
1849                 aros_object_format="armelf_aros"
1850                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
1851                 aros_c_libs="$aros_c_libs -laeabi"
1852                 aros_nominal_depth=8
1853                 gcc_target_cpu="arm"
1854                 gcc_default_float_abi="soft"
1855                 kernel_tool_prefix="arm-mingw32ce-"
1856                 aros_nominal_width=160
1857                 aros_nominal_height=160
1858                 ;;
1859             *)
1860                 AC_MSG_ERROR("Unknown CPU for Mingw32 -- $target_cpu")
1861                 ;;
1862         esac
1863         if test $host_os = "cygwin"; then
1864                 aros_kernel_cflags="-mno-cygwin"
1865         fi
1866     ;;
1867     pp*)
1868         aros_target_arch="pp"
1869         aros_shared_default="no"
1870         case "$target_cpu" in
1871             *m68k*)
1872                 aros_target_cpu="m68k"
1873                 aros_object_format="m68kelf"
1874                 aros_flavour="palmnative"
1875                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
1876                 aros_isa_flags="$""(ISA_MC68000_FLAGS)"
1877                 aros_nominal_width=160
1878                 aros_nominal_height=160
1879                 aros_nominal_depth=1
1880                 aros_target_ar_flags="cru"
1881                 aros_c_libs="$aros_c_libs -lgcc1"
1882                 aros_shared_default=no
1883                 aros_shared_cflags="-fpic"
1884                 aros_shared_aflags=""
1885                 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
1886                 aros_kernel_ldflags="-Wl,-rpath,./lib"
1887                 aros_debug_cppflags="$aros_messages_debug"
1888                 aros_debug_cflags="$aros_symbols_debug"
1889                 aros_debug_aflags=""
1890                 aros_debug_ldflags="$aros_symbols_debug"
1891                 aros_mungwall_debug="0"
1892                 aros_modules_debug="0"
1893                 gcc_target_cpu="mc68000"
1894                 ignore_undefined_symbols="-ius"
1895                 ;;
1896            *)
1897                 AC_MSG_ERROR("Unknown CPU for PalmPilot -- $target_cpu")
1898                 ;;
1899         esac
1900         ;;
1902     mac*)
1903         aros_target_arch="mac"
1904         aros_shared_default="no"
1905         case "$target_cpu" in
1906             *m68k*)
1907                 aros_target_cpu="m68k"
1908                 aros_object_format="m68kelf"
1909                 aros_flavour="mac68knative"
1910                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
1911                 aros_isa_flags="$""(ISA_MC68000_FLAGS)"
1912                 aros_nominal_width=512
1913                 aros_nominal_height=384
1914                 aros_nominal_depth=8
1915                 aros_target_ar_flags="cru"
1916                 aros_c_libs="$aros_c_libs -lgcc1"
1917                 aros_shared_default=no
1918                 aros_shared_cflags="-fpic"
1919                 aros_shared_aflags=""
1920                 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
1921                 aros_kernel_ldflags="-Wl,-rpath,./lib"
1922                 aros_debug_cppflags="$aros_messages_debug"
1923                 aros_debug_cflags="$aros_symbols_debug"
1924                 aros_debug_aflags=""
1925                 aros_debug_ldflags="$aros_symbols_debug"
1926                 aros_mungwall_debug="0"
1927                 aros_modules_debug="0"
1928                 gcc_target_cpu="mc68000"
1929                 ignore_undefined_symbols="-ius"
1930                 ;;
1931            *)
1932                 AC_MSG_ERROR("Unknown CPU for Mac68k -- $target_cpu")
1933                 ;;
1934         esac
1935         ;;
1937     *)
1938         AC_MSG_ERROR([Unsupported target architecture $target])
1939         ;;
1940 esac
1942 #-----------------------------------------------------------------------------
1943 crosstools_guess="yes"
1944 aros_target_toolchain="no"
1945 aros_kernel_sysroot=""
1947 AC_MSG_CHECKING([Kernel toolchain prefix])
1948 AC_ARG_WITH(kernel-toolchain-prefix,AC_HELP_STRING([--with-kernel-toolchain-prefix=...],[Specify crosscompile toolchain prefix for kernel objects]),[kernel_tool_prefix="$withval"])
1949 AC_MSG_RESULT($kernel_tool_prefix)
1951 AC_MSG_CHECKING([ELF toolchain prefix])
1952 AC_ARG_WITH(elf-toolchain-prefix,AC_HELP_STRING([--with-elf-toolchain-prefix=...],[Specify crosscompile toolchain prefix to wrap for AROS objects]),[elf_tool_prefix="$withval"
1953                                                  crosstools_guess="no"])
1954 AC_MSG_RESULT($elf_tool_prefix)
1956 AC_MSG_CHECKING([AROS toolchain prefix])
1957 AC_ARG_WITH(aros-toolchain,AC_HELP_STRING([--with-aros-toolchain=PREFIX],[Specify prebuilt AROS toolchain. Use yes for default name]),[aros_tool_prefix="$withval"
1958                 crosstools_guess="no"])
1959 if test "$aros_tool_prefix" = "yes" ; then
1960     aros_tool_prefix=$aros_target_cpu-aros-
1962 AC_MSG_RESULT($aros_tool_prefix)
1964 #-----------------------------------------------------------------------------
1965 #   Checking if we should build crosstools..
1966 AC_MSG_CHECKING([whether to build crosstools])
1967 AC_ARG_ENABLE(crosstools,AC_HELP_STRING([--disable-crosstools],[Do not build cross-compiler toolchain]),crosstools="$enableval",crosstools="$crosstools_guess")
1968 AC_MSG_RESULT($crosstools)
1970 if test "${crosstools}" = "yes"; then
1971     if test "${crosstools_guess}" = "no"; then
1972         AC_MSG_ERROR([Cannot build external toolchain if an external ELF or AROS toolchain is specified])
1973     fi
1976 if test "${crosstools}" = "yes" || test "${crosstools_guess}" = "no"; then
1977     aros_target_toolchain="yes"
1980 AC_MSG_CHECKING([where to install the crosstools binaries])
1981 AC_ARG_WITH(aros-toolchain-install,AC_HELP_STRING([--with-aros-toolchain-install=DIR],[Where to install or search for cross tools binaries]),[aros_toolchain_install=$withval])
1982 if test "x$aros_toolchain_install" = "x"; then
1983     AROS_CROSSTOOLSDIR="$AROS_BUILDDIR_UNIX/bin/$aros_host_arch-$aros_host_cpu/tools/crosstools"
1984 else
1985     AROS_CROSSTOOLSDIR="$aros_toolchain_install"
1986     PATH="$AROS_CROSSTOOLSDIR:$PATH"
1987     if test "$crosstools_guess" = "no" ; then
1988         if test "x-$aros_flavour" != "x-emulation" -a "x-$aros_flavour" != "x-emulcompat" ; then
1989             aros_kernel_sysroot="$""(TARGET_SYSROOT)"
1990         fi
1991     fi
1993 AC_MSG_RESULT($AROS_CROSSTOOLSDIR)
1995 #-----------------------------------------------------------------------------
1996 if test "$aros_toolchain" = "gnu" ; then
1997     AC_MSG_CHECKING([what specific target binutils version to use])
1999 AC_ARG_WITH(binutils-version,AC_HELP_STRING([--with-binutils-version=VERSION],[Use binutils-VERSION for building AROS]),use_binutils_version="$withval",use_binutils_version="")
2000 if test "$use_binutils_version" = ""; then
2001         target_binutils_version="$default_binutils_version"
2002 else
2003     target_binutils_version="$use_binutils_version"
2005 if test "$aros_toolchain" = "gnu" ; then
2006     AC_MSG_RESULT($target_binutils_version)
2010 # Helper to identify gcc version
2011 AC_DEFUN([CROSS_GCC_VERSION], [
2012   target_gcc_version=""
2013   AC_CACHE_CHECK([gcc version],[ax_cv_gcc_version],[
2014     ax_cv_gcc_version="`$AROS_CROSSTOOLSDIR/${aros_tool_prefix}${toolchain_cpp_preprocessor}$(toolchain_cpp_opts) -dumpversion`"
2015     AS_IF([test "x$ax_cv_gcc_version" = "x"],[
2016       ax_cv_gcc_version=""
2017     ])
2018   ])
2019   target_gcc_version=$ax_cv_gcc_version
2020   AC_SUBST([target_gcc_version])
2023 #-----------------------------------------------------------------------------
2024 if test "$aros_toolchain" = "gnu" ; then
2025     AC_MSG_CHECKING([what specific target gcc version to use])
2027 AC_ARG_WITH(gcc-version,AC_HELP_STRING([--with-gcc-version=VERSION],[Compile gcc-VERSION for AROS]),use_gcc_version="$withval",use_gcc_version="")
2028 if test "$use_gcc_version" = ""; then
2029     if test "${crosstools}" = "no"; then
2030       if test "x$aros_toolchain_install" != "x"; then
2031           CROSS_GCC_VERSION
2032       fi
2033     fi
2034     if test "$use_gcc_version" = ""; then
2035         target_gcc_version="$default_gcc_version"
2036     fi
2037 else
2038     target_gcc_version="$use_gcc_version"
2040 if test "$aros_toolchain" = "gnu" ; then
2041     AC_MSG_RESULT($target_gcc_version)
2043     AC_MSG_CHECKING([version string style])
2044     if test "${target_gcc_version#*$'-'}" != "$target_gcc_version" ; then
2045         AC_MSG_RESULT(snapshot)
2046         GCC_VERSION_MAJOR=$(echo $target_gcc_version | cut -d'-' -f1)
2047         GCC_VERSION_MINOR=-1
2048         GCC_VERSION_PATCH=-1
2049     else
2050         AC_MSG_RESULT(release)
2051         GCC_VERSION_MAJOR=$(echo $target_gcc_version | cut -d'.' -f1)
2052         GCC_VERSION_MINOR=$(echo $target_gcc_version | cut -d'.' -f2)
2053         GCC_VERSION_PATCH=$(echo $target_gcc_version | cut -d'.' -f3)
2054     fi
2056     gcc_fix_bitfields="false"
2057     if test "$GCC_VERSION_MAJOR" -gt "4" ; then
2058         gcc_fix_bitfields="true"
2059     else
2060         if test "$GCC_VERSION_MAJOR" -gt "3" ; then
2061             if test "$GCC_VERSION_MINOR" -gt "6" ; then
2062                 gcc_fix_bitfields="true"
2063             fi
2064         fi
2065     fi
2067     if test "$gcc_fix_bitfields" = "true" ; then
2068         case "$aros_target_cpu" in
2069         *x86_64* | *i?86*)
2070             x86_isa_extra="$x86_isa_extra $""(CFLAGS_NO_MS_BITFIELDS)"
2071             x86_64_isa_extra="$x86_64_isa_extra $""(CFLAGS_NO_MS_BITFIELDS)"
2072             ;;
2073         esac
2074     fi
2077 AC_MSG_CHECKING([whether to enable Objective-C suppport])
2078 AC_ARG_ENABLE(objc,AC_HELP_STRING([--enable-objc],[Enable Objectve-C support (default=no)]),objc="$enableval",objc="no")
2079 AC_MSG_RESULT($objc)
2080 if test "x$objc" = "xyes"; then
2081     objc_target="$objc"
2082 else
2083     objc_target="no-objc"
2086 AC_MSG_CHECKING([whether to enable Java suppport])
2087 AC_ARG_ENABLE(java,AC_HELP_STRING([--enable-java],[Enable Java support (default=no)]),java="$enableval",java="no")
2088 AC_MSG_RESULT($java)
2089 if test "x$java" != "xno"; then
2090     java_target="$java"
2091 else
2092     java_target="no-java"
2095 spec_obj_format="-m $aros_object_format"
2096 # Now process extra architecture-specific options.
2097 # Currently this is implemented only for ARM. We can specify which minimum CPU and FPU to use,\
2098 # as well as floating-point ABI.
2099 case "$aros_target_cpu" in
2100     *m68k*)
2101         aros_isa_targets="M68K_ISA_TARGETS              :=MC68020 MC68040"
2102         aros_isa_extra="$aros_isa_extra$export_newline$aros_isa_targets$export_newline"
2103         aros_isa_extra="$aros_isa_extra$m68k_isa_extra$export_newline$m68k_020_isa_extra$export_newline$m68k_030_isa_extra$export_newline$m68k_040_isa_extra$export_newline$m68k_060_isa_extra$export_newline$m68k_ac080_isa_extra$export_newline"
2104         aros_isa_extra="$aros_isa_extra$m68k_020_cppflags$export_newline$m68k_030_cppflags$export_newline$m68k_040_cppflags$export_newline$m68k_060_cppflags$export_newline"
2105         aros_isa_extra="$aros_isa_extra$m68k_020_cflags$export_newline$m68k_030_cflags$export_newline$m68k_040_cflags$export_newline$m68k_060_cflags$export_newline"
2106         aros_isa_extra="$aros_isa_extra$m68k_020_ldflags$export_newline$m68k_030_ldflags$export_newline$m68k_040_ldflags$export_newline$m68k_060_ldflags$export_newline"
2107         aros_isa_extra="$aros_isa_extra$m68k_020_ext$export_newline$m68k_030_ext$export_newline$m68k_040_ext$export_newline$m68k_060_ext$export_newline"
2108         ;;
2109     *x86_64*)
2110         aros_isa_extra="$export_newline$x86_isa_extra$export_newline$x86_64_isa_extra$export_newline"
2111         dnl x86_64 can build 32 or 64bit code
2112         spec_obj_format="%{!m32:-m elf_x86_64} %{m32:-m elf_i386}"
2113         ;;
2114     arm*)
2115         dnl ARM defaults are: armv6 + vfp (unless overriden in per-target section above)
2116         if test "$gcc_default_cpu" = ""; then
2117             gcc_default_cpu="armv6"
2118         fi
2119         if test "$gcc_default_fpu" = ""; then
2120             gcc_default_fpu="vfp"
2121         fi
2122         if test "$gcc_default_endian" = ""; then
2123             if test "$target_cpu" = "armeb"; then
2124                 gcc_default_endian="big-endian"
2125             else
2126                 gcc_default_endian="little-endian"
2127             fi
2128         fi
2129         if test "$gcc_default_float_abi" = ""; then
2130             if test "$target_cpu" = "armhf"; then
2131                 gcc_default_float_abi="hard"
2132             else
2133                 gcc_default_float_abi="softfp"
2134             fi
2135         fi
2137         AC_MSG_CHECKING([Which minimum CPU to use])
2138         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)
2139         AC_MSG_RESULT($aros_gcc_cpu)
2141         AC_MSG_CHECKING([Which minimum FPU to use])
2142         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)
2143         AC_MSG_RESULT($aros_gcc_fpu)
2145         AC_MSG_CHECKING([Which floating point ABI to use])
2146         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)
2147         AC_MSG_RESULT($aros_gcc_float_abi)
2149         AC_MSG_CHECKING([Which ARM mode to use])
2150         if test "$aros_target_cpu_mode" = ""; then
2151             aros_target_cpu_mode="arm32"
2152             AC_MSG_RESULT([Defaulting to $aros_target_cpu_mode])
2153         else
2154             AC_MSG_RESULT([$aros_target_cpu_mode])
2155         fi
2157         case "$aros_target_cpu_mode" in
2158         arm32)
2159             gcc_default_mode="arm"
2160             aros_isa_flags="$aros_isa_flags -m$gcc_default_mode -m$gcc_default_endian -mthumb-interwork -march=$aros_gcc_cpu -mfpu=$aros_gcc_fpu -mfloat-abi=$aros_gcc_float_abi"
2161         ;;
2162         arm64)
2163             AC_MSG_ERROR([ARM 64-bit mode is unsupported])
2164         ;;
2165         thumb)
2166             AC_MSG_ERROR([Thumb1 16-bit mode is unsupported])
2167         ;;
2168         thumb1)
2169             AC_MSG_ERROR([Thumb1 16-bit mode is unsupported])
2170         ;;
2171         thumb2)
2172             gcc_default_mode="thumb"
2173             # Do not specify -mthumb-interwork as it may add extra code to support arm/thumb interwork
2174             aros_isa_flags="$aros_isa_flags -m$gcc_default_mode -$gcc_default_endian -march=$aros_gcc_cpu -mfpu=$aros_gcc_fpu -mfloat-abi=$aros_gcc_float_abi"
2175         ;;
2176         *)
2177             AC_MSG_ERROR([Unsupported ARM mode specified $aros_target_cpu_mode])
2178         ;;
2179         esac
2181         aros_config_cflags="$aros_config_cflags $""(CFLAGS_NO_ASYNCHRONOUS_UNWIND_TABLES) $""(CFLAGS_NO_EXCEPTIONS)"
2182         aros_config_cxxflags="$aros_config_cxxflags $""(CFLAGS_NO_ASYNCHRONOUS_UNWIND_TABLES) $""(CFLAGS_NO_EXCEPTIONS)"
2183         aros_config_aflags="$aros_config_aflags $""(CFLAGS_NO_ASYNCHRONOUS_UNWIND_TABLES) $""(CFLAGS_NO_EXCEPTIONS)"
2184         ;;
2185     i386)
2186         aros_isa_extra="$x86_isa_extra$export_newline$x86_64_isa_extra$export_newline"
2187         aros_kernel_ldflags="$aros_kernel_ldflags -m32" 
2188         ;;
2189 esac
2191 # Some architectures may need custom ELF specs.
2192 if test -f $SRCDIR/config/${aros_object_format}-specs.in; then
2193     elf_specs_in=config/${aros_object_format}-specs.in
2194 else
2195     elf_specs_in=config/elf-specs.in
2198 # Some compilers (ppc-elf-gcc is known to) have CPU defines in specs
2199 # Since we override specs, we may need to put these defines there
2200 if test "$gcc_target_cpu" != ""; then
2201     gcc_target_cpu="-D__${gcc_target_cpu}__"
2204 AC_MSG_CHECKING([where to download sourcecode for external ports])
2205 AC_ARG_WITH(portssources,AC_HELP_STRING([--with-portssources=DIR],[Where to download sourcecode for external ports]),with_portssrcdir=$withval,with_portssrcdir="default")
2206 if test "$with_portssrcdir" = "default"; then
2207     AROS_PORTSSRCDIR="$AROS_BUILDDIR_UNIX/bin/Sources"
2208 else
2209     AROS_PORTSSRCDIR="$with_portssrcdir"
2211 AC_MSG_RESULT($AROS_PORTSSRCDIR)
2213 AC_MSG_CHECKING([which bootloader to use])
2214 AC_ARG_WITH(bootloader,AC_HELP_STRING([--with-bootloader=NAME],[Use a specific bootloader]),target_bootloader=$withval,target_bootloader=$target_bootloader)
2215 if test "$target_bootloader" = "none"; then
2216     aros_target_bootloader=""
2217 else
2218     aros_target_bootloader="$target_bootloader"
2220 AC_MSG_RESULT($target_bootloader)
2222 AC_MSG_CHECKING([which icon-set to use])
2223 AC_ARG_WITH(iconset,AC_HELP_STRING([--with-iconset=NAME],[Use a specific Icon-set (default=Gorilla).]),target_iconset=$withval,target_iconset="default")
2224 if test "$target_iconset" = "default"; then
2225     aros_target_iconset="Gorilla"
2226     target_iconset="default (Gorilla)"
2227 else
2228     aros_target_iconset="$target_iconset"
2230 AC_MSG_RESULT($target_iconset)
2232 AC_MSG_CHECKING([which GUI Theme to use])
2233 AC_ARG_WITH(theme,AC_HELP_STRING([--with-theme=NAME],[Use a specific GUI Theme]),target_guitheme=$withval,target_guitheme="default")
2234 if test "$target_guitheme" = "default"; then
2235     aros_target_guitheme="Ice"
2236 else
2237     aros_target_guitheme="$target_guitheme"
2239 AC_MSG_RESULT($aros_target_guitheme)
2241 # Find out if we are cross-compiling (i.e. if we can't use the host compiler
2242 # for target code)
2243 cross_compiling=no
2245 dnl The first case is simple. If we are compiling for another CPU, we are cross-compiling for sure
2246 if test "$aros_host_cpu" != "$aros_target_cpu" ; then
2247     cross_compiling=yes
2250 dnl x86-64 toolchains can also produce i386 binaries, given -m32 flag.
2251 dnl The flag itself is given in per-target section, because some targets require to pass it
2252 dnl in a different manner, otherwise some tests fail.
2253 dnl TODO: Justify this.
2254 if test "$aros_host_cpu" == "x86_64" ; then
2255     if test "$aros_target_cpu" == "i386" ; then
2256         cross_compiling=no
2257     fi
2260 if test "x-$aros_flavour" = "x-emulation" -o "x-$aros_flavour" = "x-emulcompat" ; then
2261     dnl For a hosted build we are cross-compiling if host OS differs from build OS.
2262     dnl TODO: This might get a little bit more tricky if we ever cross-compile ARM-Android-hosted
2263     dnl AROS on ARM Linux, or even vice versa (Linux-hosted ARM AROS building on ARM Android).
2264     dnl ARM ABIs of Linux and Android are not compatible (despite very close), so host_cc can't be
2265     dnl used to build bootstrap for target arch in either case.
2266     dnl For us Android is not a separate OS, but a variant of Linux, so both systems will be
2267     dnl identified as 'linux'. If this ever involves, we'll have to implement some additional check,
2268     dnl perhaps introducing aros_host_variant
2269     if test "$aros_host_arch" != "$aros_target_arch" ; then
2270         cross_compiling=yes
2271     fi
2272 else
2273     dnl For a native build we only care if our host_cc can produce static ELF files. If so, we can use
2274     dnl it as kernel_cc. If not, (e.g. we are on Windows or Darwin), we need a crosscompiler.
2275     dnl if test "$host_cc_elf" = "no" ; then
2276         cross_compiling=yes
2277     dnl fi
2280 if test "$cross_compiling" = "no" ; then
2281     kernel_tool_prefix=""
2282     if test "$host_cc_elf" = "yes" ; then
2283         elf_tool_prefix=""
2284     fi
2287 if test "$kernel_tool_version" != ""; then
2288     kernel_tool_version="-$kernel_tool_version"
2291 #######################################################################
2292 ## Compute what toolchains to use, and their paths                   ##
2293 #######################################################################
2295 # This takes, as input:
2296 #   crosstools             {yes,no}
2297 #   kernel_tool_version    {"",[version]}
2298 #   target_tool_version    {"",[version]}
2299 #   kernel_tool_prefix     {none,[some-arch-os-]}
2300 #   gnu-toolchain -:
2301 #     target_tool_prefix     ${aros_target_cpu}-aros-
2302 #     aros_tool_prefix       ${aros_target_cpu}-aros-
2304 # The output is
2305 #   aros_kernel_{cpp,cc,ar,ld,as,ranlib,nm,strip}
2306 #        Where the 'kernel' binaries are located
2307 #   orig_target_{cpp,cc,ar,ld,as,ranlib,nm,strip}
2308 #        Where the 'target' binaries are located
2309 #        (not the symlink farm - that is aros_target_*!)
2311 # The rules are:
2312 #   if crosstools then
2313 #      if kernel_tools_prefix = "no-kernel-prefix-"
2314 #          aros_kernel_* = crosstools cc paths
2315 #          aros_kernel_cc = elf cc wrapper around crosstools cc
2316 #      else
2317 #          VALIDATE(${kernel_tools_prefix}*)
2318 #          aros_kernel_* = ${kernel_tools_prefix}*
2319 #          if ${kernel_tools_prefix}cc is an AROS gcc
2320 #              aros_kernel_cc = ${kernel_tools_prefix}cc
2321 #          else
2322 #              aros_kernel_cc = elf cc wrapper around ${kernel_tools_prefix}cc
2323 #          fi
2324 #      fi
2326 #      orig_target_* = aros built crosstools
2327 #      orig_target_cc = elf cc wrapper around crosstools cc
2328 #   else
2329 #      VALIDATE(${kernel_tools_prefix}*)
2331 #      orig_target_* = aros_kernel_*
2332 #      if aros_kernel_cc is an AROS gcc
2333 #          orig_target_cc = aros_kernel_cc
2334 #      else
2335 #          orig_target_cc = aros cc wrapper around aros_kernel_cc
2336 #      fi
2337 #   fi
2339 if test "$aros_toolchain" = "gnu" ; then
2340     target_tool_prefix="${aros_target_cpu}-aros-"
2341 elif test "$aros_toolchain" = "llvm" ; then
2342     target_tool_prefix="bin/"
2345 if test "$kernel_tool_prefix" != "" ; then
2346     AC_MSG_CHECKING([which kernel tools])
2347     AC_MSG_RESULT([$kernel_tool_prefix]);
2350 if test "$kernel_tool_prefix" = "none" ; then
2351     dnl ELF wrapper can be used only for native bootstrap
2352     if test "x-$aros_flavour" = "x-emulation" -o "x-$aros_flavour" = "x-emulcompat" ; then
2353         AC_MSG_ERROR([--with-kernel-toolchain-prefix= is required for this arch])
2354     fi
2355 else
2356     if test "x-$aros_flavour" != "x-standalone" -o "x-$aros_flavour" != "x-standcompat" ; then
2357         # Kernel tools required - find them
2358         # Note that 'normally', aros_kernel_* overrides will be
2359         # empty, unless specified in the per-arch sections above.
2360         test_kernel_cc=yes
2361         if test "x$aros_kernel_cpp" = "x"; then
2362             aros_kernel_cpp=${kernel_tool_prefix}${CPP_BASE}
2363         fi
2364         AROS_BUILDCMD(aros_kernel_cpp,$aros_kernel_cpp,${kernel_tool_version})
2365         AROS_TOOL_KERNEL(aros_kernel_cpp,cpp,$aros_kernel_cpp)
2366         AROS_REQUIRED(cpp,$aros_kernel_cpp)
2368         if test "x$aros_kernel_cc" = "x"; then
2369             aros_kernel_cc=${kernel_tool_prefix}${CC_BASE}
2370         fi
2371         AROS_BUILDCMD(aros_kernel_cc,$aros_kernel_cc,${kernel_tool_version})
2372         AROS_TOOL_KERNEL(aros_kernel_cc,cc,$aros_kernel_cc)
2373         AROS_REQUIRED(cc,$aros_kernel_cc)
2375         if test "x$aros_kernel_cxx" = "x"; then
2376             aros_kernel_cxx=${kernel_tool_prefix}${CXX_BASE}
2377         fi
2378         AROS_BUILDCMD(aros_kernel_cxx,$aros_kernel_cxx,${kernel_tool_version})
2379         AROS_TOOL_KERNEL(aros_kernel_cxx,cxx,$aros_kernel_cxx)
2380         # If it's set, make sure it's really there
2381         if test "x$aros_kernel_cxx" != "x" ; then
2382             AROS_REQUIRED(cxx,$aros_kernel_cxx)
2383         fi
2384         if test "x$aros_kernel_ld" = "x"; then
2385             aros_kernel_ld=$aros_host_ld
2386         fi
2387         AROS_TOOL_KERNEL(aros_kernel_ld,ld,$aros_kernel_ld)
2388         AROS_REQUIRED(ld,$aros_kernel_ld)
2389         if test "x$aros_kernel_as" = "x"; then
2390             aros_kernel_as=$aros_host_as
2391             if test "x$aros_kernel_as" = "x"; then
2392                 aros_kernel_as=${HOST_TOOLCHAIN_PREFIX}as${HOST_TOOLCHAIN_SUFFIX}
2393             fi
2394         fi
2395         AROS_TOOL_KERNEL(aros_kernel_as,as,$aros_kernel_as)
2396         AROS_REQUIRED(as,$aros_kernel_as)
2397         if test "x$aros_kernel_ar" = "x"; then
2398             aros_kernel_ar=$aros_host_plain_ar
2399         fi
2400         AROS_TOOL_KERNEL(aros_kernel_ar,ar,$aros_kernel_ar)
2401         AROS_REQUIRED(ar,$aros_kernel_ar)
2402         if test "x$aros_kernel_ranlib" = "x"; then
2403             aros_kernel_ranlib=$aros_host_ranlib
2404         fi
2405         AROS_TOOL_KERNEL(aros_kernel_ranlib,ranlib,$aros_kernel_ranlib)
2406         AROS_REQUIRED(ranlib,$aros_kernel_ranlib)
2407         if test "x$aros_kernel_nm" = "x"; then
2408             aros_kernel_nm=$aros_host_nm
2409             if test "x$aros_kernel_nm" = "x"; then
2410                 aros_kernel_nm=${HOST_TOOLCHAIN_PREFIX}nm${HOST_TOOLCHAIN_SUFFIX}
2411             fi
2412         fi
2413         AROS_TOOL_KERNEL(aros_kernel_nm,nm,$aros_kernel_nm)
2414         AROS_REQUIRED(nm,$aros_kernel_nm)
2415         AROS_TOOL_KERNEL(aros_kernel_strip,strip,$aros_kernel_strip)
2416         AROS_REQUIRED(strip,$aros_kernel_strip)
2418         # Objcopy and objdump are not required for the kernel
2419         # toolchain on many architectures.
2420         # So we'll look for them, but not make them strictly required.
2421         if test "x$aros_kernel_objcopy" = "x"; then
2422             aros_kernel_objcopy=$aros_host_objcopy
2423             if test "x$aros_kernel_objcopy" = "x"; then
2424                 aros_kernel_objcopy=${HOST_TOOLCHAIN_PREFIX}objcopy${HOST_TOOLCHAIN_SUFFIX}
2425             fi
2426         fi
2427         AROS_TOOL_KERNEL(aros_kernel_objcopy,objcopy,$aros_kernel_objcopy)
2428         if test "x$aros_kernel_objdump" = "x"; then
2429             aros_kernel_objdump=$aros_host_objdump
2430             if test "x$aros_kernel_objdump" = "x"; then
2431                 aros_kernel_objdump=${HOST_TOOLCHAIN_PREFIX}objdump${HOST_TOOLCHAIN_SUFFIX}
2432             fi
2433         fi
2434         AROS_TOOL_KERNEL(aros_kernel_objdump,objdump,$aros_kernel_objdump)
2435         if test "x${crosstools}" != "xyes" ; then
2436             AROS_REQUIRED(objcopy,$aros_kernel_objcopy)
2437             AROS_REQUIRED(objdump,$aros_kernel_objdump)
2438         fi
2439     fi
2442 AC_MSG_CHECKING([which target tools to use])
2443 if test "$aros_target_toolchain" = "yes"; then
2444     if test "$aros_toolchain" = "llvm" ; then
2445         msg_result="llvm"
2446     else
2447         msg_result=$target_tool_prefix
2448     fi
2449     AC_MSG_RESULT([$msg_result])
2450     # We are building AROS crosstools
2451     tmp_tool_prefix="$AROS_CROSSTOOLSDIR/${target_tool_prefix}"
2452     orig_target_cc="${tmp_tool_prefix}${toolchain_c_compiler}${target_tool_version}"
2453     orig_target_cxx="${tmp_tool_prefix}${toolchain_cxx_compiler}${target_tool_version}"
2454     orig_target_cpp="${tmp_tool_prefix}${toolchain_cpp_preprocessor}${toolchain_cpp_opts}"
2455     orig_target_ld="${tmp_tool_prefix}${toolchain_ld}"
2456     orig_target_as="${tmp_tool_prefix}${toolchain_as}"
2457     orig_target_ar="${tmp_tool_prefix}${toolchain_ar}"
2458     orig_target_ranlib="${tmp_tool_prefix}${toolchain_ranlib}"
2459     orig_target_nm="${tmp_tool_prefix}${toolchain_nm}"
2460     orig_target_strip="${tmp_tool_prefix}${toolchain_strip}"
2461     orig_target_objcopy="${tmp_tool_prefix}${toolchain_objcopy}"
2462     orig_target_objdump="${tmp_tool_prefix}${toolchain_objdump}"
2463 else
2464     # Determine whether AROS or ELF tools should be used
2465     if test "$aros_tool_prefix" = "none"; then
2466         aros_tool_prefix="${elf_tool_prefix}"
2467     fi
2469     AC_MSG_RESULT([$aros_tool_prefix])
2470     # We are *not* building AROS crosstools - use the AROS or ELF tools
2471     AROS_TOOL_TARGET(orig_target_cpp,cpp,${aros_tool_prefix}${toolchain_cpp_preprocessor}${target_tool_version}${toolchain_cpp_opts})
2472     AROS_REQUIRED(cpp,$orig_target_cpp)
2473     AROS_TOOL_TARGET(orig_target_cc,gcc,${aros_tool_prefix}${toolchain_c_compiler}${target_tool_version})
2474     AROS_REQUIRED(cc,$orig_target_cc)
2475     AROS_TOOL_TARGET(orig_target_cxx,g++,${aros_tool_prefix}${toolchain_cxx_compiler}${target_tool_version})
2476     AROS_REQUIRED(cxx,$orig_target_cxx)
2477     AROS_TOOL_TARGET(orig_target_ld,gcc,${aros_tool_prefix}${toolchain_ld})
2478     AROS_REQUIRED(ld,$orig_target_ld)
2479     AROS_TOOL_TARGET(orig_target_as,as,aros_tool_prefix}${toolchain_as})
2480     AROS_REQUIRED(as,$orig_target_as)
2481     AROS_TOOL_TARGET(orig_target_ar,ar,${aros_tool_prefix}${toolchain_ar})
2482     AROS_REQUIRED(ar,$orig_target_ar)
2483     AROS_TOOL_TARGET(orig_target_ranlib,ar,${aros_tool_prefix}${toolchain_ranlib})
2484     AROS_REQUIRED(ranlib,$orig_target_ranlib)
2485     AROS_TOOL_TARGET(orig_target_nm,nm,${aros_tool_prefix}${toolchain_nm})
2486     AROS_REQUIRED(nm,$orig_target_nm)
2487     AROS_TOOL_TARGET(orig_target_strip,strip,${aros_tool_prefix}${toolchain_strip})
2488     AROS_REQUIRED(strip,$orig_target_strip)
2489     AROS_TOOL_TARGET(orig_target_objcopy,objcopy,${aros_tool_prefix}${toolchain_objcopy})
2490     AROS_REQUIRED(objcopy,$orig_target_objcopy)
2491     AROS_TOOL_TARGET(orig_target_objdump,objdump,${aros_tool_prefix}${toolchain_objdump})
2492     AROS_REQUIRED(objdump,$orig_target_objdump)
2495 if test "$kernel_tool_prefix" = "none" ; then
2496     # No kernel tools specified
2497     # Assume kernel tools == target tools with ELF wrapper
2498     aros_kernel_cc=$orig_target_cc
2499     aros_kernel_cxx=$orig_target_cxx
2500     aros_kernel_cpp="$orig_target_cpp"
2501     aros_kernel_ld=$orig_target_ld
2502     aros_kernel_as=$orig_target_as
2503     aros_kernel_ar=$orig_target_ar
2504     aros_kernel_ranlib=$orig_target_ranlib
2505     aros_kernel_nm=$orig_target_nm
2506     aros_kernel_strip=$orig_target_strip
2507     aros_kernel_objcopy=$orig_target_objcopy
2508     aros_kernel_objdump=$orig_target_objdump
2509     aros_kernel_isa_flags=$aros_isa_flags
2510     use_kernel_cc_wrapper=yes
2513 # At this point, all aros_kernel_* and aros_target_* 
2514 # tools should be set up correctly
2516 CC="$aros_kernel_cc $kernel_tool_flags"
2517 CPP="$aros_kernel_cpp"
2519 #-----------------------------------------------------------------------------
2521 # Find all the tools we need to compile. This could be cross-compiling
2522 # though! If that is the case we use the GNU form of the target and
2523 # simply add this to the front of the binary name. This is rather simple,
2524 # but it should work under most circumstances.
2526 # The default tools are to use the same as the host, but only if the
2527 # host and target CPU are the same. With GCC this is normally enough.
2530 aros_cc_pre=""
2531 aros_shared_ld="$aros_host_ld"
2533 aros_target_mkdep="$aros_host_mkdep"
2535 # The default tools executables to be linked to.
2536 if test "$rescomp" != ""; then
2537     AC_PATH_PROG(aros_kernel_rescomp,${kernel_tool_prefix}$rescomp)
2538     AROS_REQUIRED($rescomp,$aros_kernel_rescomp)
2541 # Set up the sources for the symlink farm
2542 if test "$crosstools" = "yes"; then
2543     crosstools_target=tools-crosstools
2546 aros_kernel_cc="$aros_kernel_cc $kernel_tool_flags"
2547 aros_kernel_ar="$aros_kernel_ar $aros_kernel_ar_flags"
2549 aros_hostcfg_dir="bin/${aros_host_arch}-${aros_host_cpu}/gen/host/config"
2550 aros_targetcfg_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/config"
2551 aros_inc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/AROS/Developer/include/aros"
2552 aros_gendir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen"
2553 aros_geninc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/include/aros"
2554 aros_tools_dir="bin/${aros_host_arch}-${aros_host_cpu}/tools"
2555 aros_scripts_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/scripts"
2557 # aros_cc_pre is a variable that is added to the front of the compiler name
2558 # in the generated aros-gcc shell script. We need this to enable the cache
2559 # to work across cleaned builds. Also, support DISTCC using the correct
2560 # environment variable.
2563 if test "x${DISTCC}" != "x" ; then
2564     if test "x${CCACHE}" != "x" ; then
2565         aros_cc_pre="env CCACHE_PREFIX=${DISTCC} ${CCACHE} "
2566     else
2567         aros_cc_pre="${DISTCC} "
2568     fi
2569 else
2570     if test "x${CCACHE}" != "x" ; then
2571         aros_cc_pre="${CCACHE} "
2572     fi
2575 AC_SUBST(aros_target_nostdinc_cflags,-nostdinc)
2576 AC_SUBST(aros_target_nostartup_ldflags,-nostartfiles)
2577 AC_SUBST(aros_target_nix_ldflags,-nix)
2578 AC_SUBST(aros_target_detach_ldflags,-detach)
2579 AC_SUBST(aros_target_nostdlib_ldflags,-nostdlib)
2581 aros_target_cc_path=
2583 # Target tools
2584 AC_SUBST(aros_toolchain)
2585 if test "$aros_target_toolchain" != "yes"; then
2586     prefix="${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-"
2587     if test "$GCC" = "yes"; then
2588         aros_target_cc_path=`$orig_target_cc -print-search-dirs | grep "programs: =" | cut -c 12-`
2589     fi
2590 else
2591     # We do not know which c compiler version we are going to build and what we need to know
2592     # here is different for different versions so this will be set later during the
2593     # build of crosstools.
2594     if test "$aros_toolchain" = "gnu" ; then
2595         prefix="$AROS_CROSSTOOLSDIR/${aros_target_cpu}-aros-"
2596     elif test "$aros_toolchain" = "llvm" ; then
2597         prefix="$AROS_CROSSTOOLSDIR/bin/"
2598     fi
2599     aros_target_cc_path=@aros_target_cc_path@
2601 aros_target_cpp="${prefix}${toolchain_cpp_preprocessor}${toolchain_cpp_opts}"
2602 aros_target_cc="${prefix}${toolchain_c_compiler}"
2603 aros_target_cxx="${prefix}${toolchain_cxx_compiler}"
2604 aros_target_as="${prefix}${toolchain_as}"
2605 if test "${use_ld_wrapper}" = "yes"; then
2606     aros_target_ld="${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-${aros_ld}"
2607 else
2608     aros_target_ld="${prefix}${toolchain_ld}"
2610 aros_toolchain_ld="${prefix}${toolchain_ld}"
2612 aros_target_ar="${prefix}${toolchain_ar} $aros_target_ar_flags"
2613 aros_target_objcopy="${prefix}${toolchain_objcopy}"
2614 aros_target_objdump="${prefix}${toolchain_objdump}"
2615 aros_target_ranlib="${prefix}${toolchain_ranlib} $aros_target_ranlib_flags"
2616 aros_target_nm="${prefix}${toolchain_nm} $aros_target_nm_flags"
2617 aros_target_strip="${prefix}${toolchain_strip}"
2618 aros_plain_nm="${prefix}${toolchain_nm}"
2619 aros_plain_ar="${prefix}${toolchain_ar}"
2621 AC_ARG_ENABLE(includes,
2622 AC_HELP_STRING([--enable-includes=dir],[Alternative system include directory]),
2623 [aros_target_incl=$enable_includes], [aros_target_incl=no])
2625 if test "x$aros_target_incl" = "xno"; then
2626     if test "x$test_kernel_cc" != "xno"; then
2627         aros_target_incl=`$aros_kernel_cc -print-sysroot 2>/dev/null`/`$aros_kernel_cc --print-sysroot-headers-suffix 2>/dev/null || echo usr/include`
2628     else
2629         aros_target_incl=
2630     fi
2633 if test "x$aros_kernel_includes" = "x"; then
2634     if test "x-$aros_flavour" = "x-emulation" -o "x-$aros_flavour" = "x-emulcompat" ; then
2635         if test "x$aros_target_incl" != "x"; then
2636             aros_kernel_includes="-isystem $aros_target_incl"
2637         fi
2638     fi
2641 if test "x$test_kernel_cc" != "xno"; then
2642     if test "$aros_kernel_includes" != "" ; then
2643         dnl find out about the kernel cc's include path
2644         AC_MSG_CHECKING([for the kernel compiler's include path])
2645         if test "$aros_kernel_cc_includes" = "" ; then
2646             # Try to guess where the directory is.
2647             aros_kernel_cc_includes=`dirname \`${aros_kernel_cc} ${aros_kernel_cflags} -print-libgcc-file-name\``/include
2648             if test -d $aros_kernel_cc_includes; then
2649                 # Check if there is also an include-fixed directory and add it
2650                 # to kernel compiler's include path as it may contain some of
2651                 # the headers we need.
2652                 if test -d "$aros_kernel_cc_includes"-fixed; then
2653                     aros_kernel_cc_includes+=" -isystem $aros_kernel_cc_includes"-fixed
2654                 fi
2655                 # Check for specific includes directory. Needed for Ubuntu 11.10 and Debian
2656                 if test -d "/usr/include/${aros_target_cpu}-linux-gnu"; then
2657                     aros_kernel_cc_includes+=" -isystem /usr/include/${aros_target_cpu}-linux-gnu"
2658                 fi
2659             else
2660                 # The directory doesn't exist, we need to do some more work.
2661                 aros_kernel_cc_includes=${PWD}/${aros_gendir}/cc_include
2663                 # These are the headers we're looking for.
2664                 headers="limits.h mmintrin.h stdbool.h syslimits.h float.h \
2665                          stddef.h xmmintrin.h iso646.h stdarg.h unwind.h   \
2666                          zutil.h stdint.h"
2668                 dirs=
2669                 for h in $headers; do
2670                     # Which other headers are needed by each of the above?
2671                     deps=$(echo "#include <$h>" | \
2672                            $aros_kernel_cc -E -M - 2>/dev/null | \
2673                            sed 's/^.*://; s/\\$/ /g; s/[[ \t]]\+/ /g')
2675                     # Copy all the needed headers to a directory beneath gendir.
2676                     for d in $deps; do
2677                         h=$(basename $d)
2678                         dir=${aros_kernel_cc_includes}$(echo $(dirname $d) | \
2679                                                 sed -n "s,^.*/include\(/.*\),\1,p")
2680                         ! test -d $dir && mkdir -p $dir
2681                         ! test -f $dir/$h && { cp $d $dir; chmod u+w $dir/$h; }
2682                     done
2683                 done            
2684             fi
2685         fi
2686         AC_MSG_RESULT($aros_kernel_cc_includes)
2687         # Adding -nostdinc to kernel includes as they are always used together.
2688         aros_kernel_includes="$aros_kernel_includes $aros_target_nostdinc_cflags -isystem $aros_kernel_cc_includes"
2689     fi
2692 if test "$crosstools" != "yes"; then
2693     dnl find out about the target cc's include path
2694     AC_MSG_CHECKING([for the target compiler's include path])
2695     if test "$aros_target_cc_includes" = "" ; then
2696         #try to guess where the directory is
2697         aros_target_cc_includes=`dirname \`${orig_target_cc} -print-libgcc-file-name\``/include
2698         if ! test -d $aros_target_cc_includes; then
2699             #the directory doesn't exist, we need to do some more work
2700             aros_target_cc_includes=${PWD}/${aros_gendir}/cc_include
2701         
2702             #these are the headers we're looking for
2703             headers="limits.h mmintrin.h stdbool.h syslimits.h float.h \
2704                     stddef.h xmmintrin.h iso646.h stdarg.h unwind.h   \
2705                     zutil.h"
2707             dirs=
2708             for h in $headers; do
2709                 #which other headers each of the above headers needs?
2710                 deps=$(echo "#include <$h>" | \
2711                     $orig_target_cc -E -M - 2>/dev/null | \
2712                     sed 's/^.*://; s/\\$/ /g; s/[[ \t]]\+/ /g')
2713             
2714                 #copy all the needed headers to a directory beneath gendir
2715                 for d in $deps; do
2716                     h=$(basename $d)
2717                     dir=${aros_target_cc_includes}$(echo $(dirname $d) | \
2718                                                 sed -n "s,^.*/include\(/.*\),\1,p")
2719                     ! test -d $dir && mkdir -p $dir
2720                     ! test -f $dir/$h && { cp $d $dir; chmod u+w $dir/$h; }
2721                 done
2722             done
2723         fi
2724     fi
2725     AC_MSG_RESULT($aros_target_cc_includes)
2726 else
2727     # We do not know which c compiler version we are going to build and what we need to know
2728     # here is different for different versions so this will be set later during the
2729     # build of crosstools.
2730     aros_target_cc_includes=@aros_target_cc_includes@
2734 # For GCC < 4.0 -I- is used for giving the search path for '#include "..."'
2735 # On GCC >= 4.0 -iquote should be used
2738 save_cc="$CC"
2739 save_cflags="$CFLAGS"
2740 if test "x$test_kernel_cc" != "xno"; then
2741     CFLAGS="-iquote."
2742     kernel_cflags_iquote=$host_cflags_iquote
2743     kernel_cflags_iquote_end=$host_cflags_iquote_end
2744     if test "x-$cross_compiling" = "x-yes"; then
2745         CC="$aros_kernel_cc"
2746         AC_MSG_CHECKING([whether ${CC} accepts -fno-stack-protector])
2747         if test "x-$crosstools" != "x-yes"; then
2748             AC_TRY_COMPILE(,, use_no_stack_protector="yes", use_no_stack_protector="no")
2749         else
2750             # we do know it is supported for the smallest version of gcc we are going to build
2751             # we assume it's also supported by later versions
2752             use_no_stack_protector=yes
2753         fi
2754         AC_MSG_RESULT($use_no_stack_protector)
2755         AC_MSG_CHECKING([whether ${CC} accepts -iquote])
2756         if test "x-$crosstools" != "x-yes"; then
2757             AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
2758         else
2759             # we do know it is supported for the smallest version of gcc we are going to build
2760             # we assume it's also supported by later versions
2761             has_iquote=yes
2762         fi
2763         AC_MSG_RESULT($has_iquote)
2764         if test "x-$has_iquote" = "x-yes" ; then
2765             kernel_cflags_iquote=-iquote
2766             kernel_cflags_iquote_end=
2767         else
2768             kernel_cflags_iquote=-I
2769             kernel_cflags_iquote_end=-I-
2770         fi
2771     fi
2772     if test "x-$use_no_stack_protector" = "x-yes" ; then
2773         aros_kernel_cflags="$aros_kernel_cflags -fno-stack-protector"
2774     fi
2776     #-----------------------------------------------------------------------------
2778     # Check if we can explicitly choose older version of symbol hashing
2780     CFLAGS="save_cflags -Wl,--hash-style=sysv"
2781     CC="$aros_kernel_cc"
2782     AC_MSG_CHECKING([whether ${CC} accepts -Wl,--hash-style=sysv])
2783     AC_TRY_LINK(,, use_hash_style="yes", use_hash_style="no")
2784     AC_MSG_RESULT($use_hash_style)
2785     if test "x-$use_hash_style" = "x-yes" ; then
2786         aros_kernel_cflags="$aros_kernel_cflags -Wl,--hash-style=sysv"
2787     fi
2788 else
2789     kernel_cflags_iquote="$""(CFLAGS_IQUOTE)"
2790     kernel_cflags_iquote_end="$""(CFLAGS_IQUOTE_END)"
2792 CC="$save_cc"
2793 CFLAGS="$save_cflags"
2795 AC_SUBST(host_cflags_iquote)
2796 AC_SUBST(host_cflags_iquote_end)
2797 AC_SUBST(kernel_cflags_iquote)
2798 AC_SUBST(kernel_cflags_iquote_end)
2801 dnl Check if user specified --with-resolution=XRESxYRESxDEPTH
2802 AC_MSG_CHECKING([for default resolution of WBScreen])
2803 AC_ARG_WITH(resolution,AC_HELP_STRING([--with-resolution=XRESxYRESxDEPTH],[Default resolution of the initial WorkbenchScreen]),resolution=$withval,resolution=none)
2804 # We require an argument, so map --with/--without ("yes"/"no") to "none" specified
2805 if test "$resolution" = "yes" ; then
2806     resolution="none"
2808 if test "$resolution" = "no" ; then
2809     resolution="none"
2811 if test "$resolution" != "none" ; then
2812     aros_nominal_width=`echo $resolution | cut -d'x' -f1`
2813     aros_nominal_height=`echo $resolution | cut -d'x' -f2`
2814     aros_nominal_depth=`echo $resolution | cut -d'x' -f3`
2816 AC_MSG_RESULT($aros_nominal_width x $aros_nominal_height x $aros_nominal_depth)
2817 aros_cv_nominal_width=$aros_nominal_width
2818 aros_cv_nominal_height=$aros_nominal_height
2819 aros_cv_nominal_depth=$aros_nominal_depth
2821 dnl See if the user wants the serial debug output for native flavour
2822 AC_MSG_CHECKING([whether serial debug is enabled])
2823 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)
2824 if test "$aros_serial_debug" = 0 ; then
2825     serial_debug_forced=""
2826     if test "$serial_debug" = "yes" ; then
2827         serial_debug="1"
2828     fi
2829     if test "$serial_debug" = "no" ; then
2830         serial_debug="none"
2831     fi
2832 else
2833     serial_debug_forced="(forced)"
2834     serial_debug=$aros_serial_debug
2836 if test "$serial_debug" != "none" ; then
2837     aros_serial_debug=$serial_debug
2838     AC_MSG_RESULT($serial_debug_forced on port $serial_debug)
2839 else
2840     AC_MSG_RESULT(no)
2843 dnl See if the user wants the palm debug output hack for palm native flavour
2844 AC_MSG_CHECKING([whether palm debug hack is enabled])
2845 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")
2846 if test "$palm_debug_hack" = "yes" ; then
2847     aros_palm_debug_hack="1"
2849 AC_MSG_RESULT($palm_debug_hack)
2851 dnl See if dev wants the usb3.0 code
2852 AC_MSG_CHECKING([whether usb3.0 code is enabled])
2853 AC_ARG_ENABLE(usb30_code,AC_HELP_STRING([--enable-usb30-code],[Enable usb3.0 code (default=no)]),usb30_code="yes",usb30_code="no")
2854 if test "$usb30_code" = "yes" ; then
2855     aros_config_cppflags="$aros_config_cppflags -DAROS_USB30_CODE"
2856     aros_kernel_cflags="$aros_kernel_cflags -DAROS_USB30_CODE"
2858 AC_MSG_RESULT($usb30_code)
2860 dnl See if the user wants nesting supervisor activated for unix flavour
2861 AC_MSG_CHECKING([whether nesting supervisor support is enabled])
2862 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")
2863 if test "$nesting_supervisor" = "yes" ; then
2864     aros_nesting_supervisor="1"
2866 AC_MSG_RESULT($nesting_supervisor)
2868 dnl See if the user wants to disable MMU support
2869 dnl This can be overriden on per-target basis,
2870 dnl set $aros_enable_mmu to "yes" or "no" to do this
2871 if test "$aros_enable_mmu" = "" ; then
2872     AC_MSG_CHECKING([whether MMU support is enabled])
2873     dnl Enabled by default
2874     AC_ARG_ENABLE(mmu,AC_HELP_STRING([--disable-mmu],[Disable MMU support (default=enabled)]),aros_enable_mmu=$enableval,aros_enable_mmu="yes")
2875     if test "$aros_enable_mmu" = "" ; then
2876         aros_enable_mmu="yes"
2877     fi
2878     AC_MSG_RESULT($aros_enable_mmu)
2880 if test "$aros_enable_mmu" = "no" ; then
2881     aros_enable_mmu="0"
2882 else
2883     aros_enable_mmu="1"
2885     
2887 dnl things specifically required for hosted flavours
2888 if test "x-$aros_flavour" = "x-emulation" -o "x-$aros_flavour" = "x-emulcompat" ; then
2890     if test "x-$need_dlopen" != "x-no" ; then
2891       save_libs="$LIBS"
2892       LIBS=""
2893       dnl some kind of dynamic library access system is required for hostlib.resource
2894       AC_CHECK_FUNC(dlopen, have_dl="yes", have_dl="no")
2895       if test "x-$have_dl" = "x-no" ; then
2896           AC_CHECK_LIB(dl, dlopen, [have_dl="yes"
2897                                     aros_host_ldflags="$aros_host_ldflags -ldl"],
2898                                     have_dl="no")
2899       fi
2900       if test "x-$have_dl" = "x-no" ; then
2901           AC_MSG_ERROR([dlopen() dynamic linker functions not available])
2902       fi
2903       LIBS="$save_libs"
2904     fi
2907     dnl x11 hidd
2908     AC_ARG_ENABLE(x11_hidd, AC_HELP_STRING([--enable-x11-hidd],
2909                                            [build X11 hidd for hosted (default=auto)]),
2910                                            x11_hidd="$enableval",
2911                                            x11_hidd="$need_x11")
2912     case "x-$x11_hidd" in
2913         x-yes|x-no|x-auto)                 ;;
2914         *)                 x11_hidd="$need_x11" ;;
2915     esac
2917     ENABLE_X11=0
2919     dnl they want it
2920     if test "x-$x11_hidd" != "x-no" ; then
2922         dnl find x11 stuff
2923         AC_PATH_X
2925         if test -n "$x_includes"; then
2926             X_CFLAGS="$X_CFLAGS -I$x_includes"
2927         fi
2929         if test -n "$x_libraries"; then
2930             X_LIBS="$X_LIBS -L$x_libraries"
2931         fi
2933         if test "x-$no_x" = "x-yes" ; then
2935             dnl didn't find it
2936             if test "x-$x11_hidd" != "x-auto" ; then
2937                 dnl and they explicitly asked for it, bail out
2938                 AC_MSG_ERROR([X11 libs/headers not found, cannot build X11 hidd as requested])
2939             fi
2940         
2941         else
2942             dnl found it, setup the metatarget
2943             aros_target_options+="$export_newline""# Enable X11 Gfx Driver$export_newline""OPT_HOST_X11GFX               := yes$export_newline"
2944             if test "x-$host_feature_glx" != "x-no" ; then
2945                 aros_target_options+="$export_newline""# Enable X11 HostGL 3D Passthrough$export_newline""OPT_HOST_X11_HOSTGL           := yes$export_newline"
2946             fi
2947             ENABLE_X11=1
2949             aros_host_x11_cflags="$X_CFLAGS"
2950             aros_host_x11_ldflags="$X_LIBS  -lX11"
2952             dnl setup shared memory extensions
2953             AC_ARG_ENABLE(x11_shm, AC_HELP_STRING([--enable-x11-shm],
2954                                                   [use X11 shared memory (default=auto)]),
2955                                                   x11_hidd_shm="$enableval",
2956                                                   x11_hidd_shm="auto")
2957             case "x-$x11_hidd_shm" in
2958                 x-yes|x-no|x-auto)                     ;;
2959                 *)                 x11_hidd_shm="auto" ;;
2960             esac
2962             have_xshm=no
2964             dnl they want it
2965             if test "x-$x11_hidd_shm" != "x-no" ; then
2967                 dnl system shm headers
2968                 AC_CHECK_HEADERS(sys/ipc.h)
2969                 AC_CHECK_HEADERS(sys/shm.h)
2971                 dnl got them
2972                 if test "x-$ac_cv_header_sys_ipc_h" = "x-yes" -a "x-$ac_cv_header_sys_shm_h" = "x-yes" ; then
2974                     dnl make sure X libs have shm functions
2975                     save_cflags="$CFLAGS"
2976                     save_ldflags="$LDFLAGS"
2977                     CFLAGS="$CFLAGS $X_CFLAGS"
2978                     LDFLAGS="$LDFLAGS $X_LIBS"
2979                     AC_CHECK_LIB(Xext, XShmQueryExtension, have_xshm=yes)
2980                     CFLAGS="$save_cflags"
2981                     LDFLAGS="$save_ldflags"
2982                 fi
2983             fi
2985             dnl detection done, prepare output
2986             if test "x-$have_xshm" = "x-yes" ; then
2987                 dnl we can do shm
2988                 DO_XSHM_SUPPORT="1"
2989             elif test "x-$x11_hidd_shm" = "x-yes" ; then
2990                 dnl they explicitly asked for it, but we can't do it
2991                 AC_MSG_ERROR([X11 has no support for shared memory, cannot enable it as requested])
2992             else
2993                 dnl otherwise just disable it
2994                 DO_XSHM_SUPPORT="0"
2995             fi
2997             
2998             dnl setup vidmode (fullscreen) extensions
2999             AC_ARG_ENABLE(x11_vidmode, AC_HELP_STRING([--enable-x11-vidmode],
3000                                                       [use X11 vidmode extension (default=auto)]),
3001                                                       x11_hidd_vidmode="$enableval",
3002                                                       x11_hidd_vidmode="auto")
3003             case "x-$x11_hidd_vidmode" in
3004                 x-yes|x-no|x-auto)                         ;;
3005                 *)                 x11_hidd_vidmode="auto" ;;
3006             esac
3008             have_vidmode=no
3010             dnl they want it
3011             if test "x-$x11_hidd_vidmode" != "x-no" ; then
3013                 dnl make sure X libs have vidmode functions
3014                 save_cflags="$CFLAGS"
3015                 save_ldflags="$LDFLAGS"
3016                 CFLAGS="$CFLAGS $X_CFLAGS"
3017                 LDFLAGS="$LDFLAGS $X_LIBS"
3018                 AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryExtension, have_vidmode=yes)
3019                 CFLAGS="$save_cflags"
3020                 LDFLAGS="$save_ldflags"
3021             fi
3023             dnl detection done, prepare output
3024             if test "x-$have_vidmode" = "x-yes" ; then
3025                 dnl we can do vidmode
3026                 DO_VIDMODE_SUPPORT="1"
3027             elif test "x-$x11_hidd_vidmode" = "x-yes" ; then
3028                 dnl they explicitly asked for it, but we can't do it
3029                 AC_MSG_ERROR([X11 vidmode extension not available, cannot enable it as requested])
3030             else
3031                 dnl otherwise just disable it
3032                 DO_VIDMODE_SUPPORT="0"
3033             fi
3034         fi
3035     fi
3037     dnl sdl hidd
3038     AC_ARG_ENABLE(sdl_hidd, AC_HELP_STRING([--enable-sdl-hidd],
3039                                            [build SDL hidd for hosted (default=auto)]),
3040                                            sdl_hidd="$enableval",
3041                                            sdl_hidd="auto")
3042     case "x-$sdl_hidd" in
3043         x-yes|x-no|x-auto)                 ;;
3044         *)                 sdl_hidd="auto" ;;
3045     esac
3047     dnl they want it
3048     if test "x-$sdl_hidd" != "x-no" ; then
3050         dnl find sdl
3051         SDL_VERSION=1.2.5
3052         AM_PATH_SDL($SDL_VERSION, [have_sdl="yes"],
3053             [have_sdl="no"])
3055         if test "x-$have_sdl" != "x-yes" ; then
3057             dnl didn't find it
3058             if test "x-$sdl_hidd" != "x-auto" ; then
3059                 dnl and they explicitly asked for it, bail out
3060                 AC_MSG_ERROR([SDL libs/headers not found, cannot build SDL hidd as requested])
3061             fi
3063         else
3064             dnl found it, enable the build
3065             aros_target_options+="$export_newline""# Enable SDL Gfx Driver$export_newline""OPT_HOST_SDLGFX               := yes$export_newline"
3066             aros_host_sdl_cflags=$SDL_CFLAGS
3067             aros_host_sdl_libs=$SDL_LIBS
3068         fi
3069     fi
3074 dnl See if the user wants dbus.library
3075 AC_MSG_CHECKING([whether building of dbus.library is enabled])
3076 AC_ARG_ENABLE(dbus,AC_HELP_STRING([--enable-dbus],[Enable DBUS support via dbus.library (default=no)]),dbus="yes",dbus="no")
3077 if test "$dbus" = "yes" ; then
3078     ENABLE_DBUS=1
3079     DBUS_CFLAGS=`pkg-config --cflags dbus-1`
3080     DBUS_LIBFLAGS=`pkg-config --libs dbus-1`
3081     KERNEL_DBUS_KOBJ=kernel-dbus-kobj
3082     KERNEL_DBUS_INCLUDES=kernel-dbus-includes
3083 else
3084     ENABLE_DBUS=0
3086 AC_MSG_RESULT($dbus)
3088 if test "$use_kernel_cc_wrapper" = "yes" ; then
3089     aros_kernel_cc="${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-elf-${toolchain_c_compiler}"
3092 aros_kernel_cppflags=$aros_config_cppflags
3093 aros_optimization_cflags="$optimization_level"
3094 if test "$optimization" = "default"; then
3095 AC_MSG_CHECKING([default optimization level to use])
3096 AC_MSG_RESULT($optimization_level)
3099 if ! test "$gcc_default_cpu" = "" ; then
3100     target_extra_cfg+="$export_newline""# ARM gcc default target$export_newline""GCC_DEFAULT_CPU         := $gcc_default_cpu$export_newline""GCC_DEFAULT_FPU         := $gcc_default_fpu$export_newline""GCC_DEFAULT_FLOAT_ABI   := $gcc_default_float_abi$export_newline""GCC_DEFAULT_MODE        := $gcc_default_mode$export_newline"
3103 if test "$use_libatomic" = "yes" ; then
3104     aros_cxx_libs="$aros_cxx_libs  -latomic"
3107 dnl --------------------------------------------------------------------
3108 dnl Configuration Output Section
3109 dnl --------------------------------------------------------------------
3111 # Generic
3112 AC_SUBST(aros_arch)
3113 AC_SUBST(aros_cpu)
3114 AC_SUBST(aros_flavour)
3115 AC_SUBST(aros_flavour_uc)
3116 AC_SUBST(aros_target_toolchain)
3117 AC_SUBST(aros_toolchain_ld)
3118 AC_SUBST(aros_build_host)
3119 AC_SUBST(AROS_BUILDDIR)
3120 AC_SUBST(AROS_BUILDDIR_UNIX)
3121 AC_SUBST(SRCDIR)
3122 AC_SUBST(AROS_CROSSTOOLSDIR)
3123 AC_SUBST(AROS_PORTSSRCDIR)
3125 # Compatability with other Amiga-like operating systems
3126 AC_SUBST(aros_amigaos_compliance)
3128 # Host Related ###########################
3129 AC_SUBST(host_stat_h__unused_used)
3130 AC_SUBST(ax_cv_flex_version)
3131 AC_SUBST(host_extra_cfg)
3132 AC_SUBST(aros_cc_pre)
3133 AC_SUBST(aros_host_strip)
3134 AC_SUBST(aros_host_arch)
3135 AC_SUBST(aros_host_cpu)
3136 AC_SUBST(aros_host_cpp)
3137 AC_SUBST(aros_host_def_cc)
3138 AC_SUBST(aros_host_cc)
3139 AC_SUBST(aros_host_cxx)
3140 AC_SUBST(aros_host_ar)
3141 AC_SUBST(aros_host_ranlib)
3142 AC_SUBST(aros_host_ld)
3143 AC_SUBST(aros_host_make)
3144 AC_SUBST(aros_host_cppflags)
3145 AC_SUBST(aros_host_cflags)
3146 AC_SUBST(aros_host_cxxflags)
3147 AC_SUBST(gnu89_inline)
3148 AC_SUBST(aros_host_ldflags)
3149 AC_SUBST(aros_host_debug)
3150 AC_SUBST(aros_host_mkdep)
3151 AC_SUBST(aros_host_mkargs)
3152 AC_SUBST(aros_host_exe_suffix)
3153 AC_SUBST(aros_host_lib_suffix)
3154 AC_SUBST(aros_tools_dir)
3155 AC_SUBST(aros_host_aclocal)
3156 AC_SUBST(aros_host_autoconf)
3157 AC_SUBST(aros_host_autoheader)
3158 AC_SUBST(aros_host_automake)
3160 # Target Related #########################
3161 AC_SUBST(aros_elf_translate)
3162 AC_SUBST(make_extra_commands)
3163 AC_SUBST(make_extra_targetcfg)
3164 AC_SUBST(target_extra_cfg)
3165 AC_SUBST(aros_target_options)
3167 AC_SUBST(aros_target_guitheme)
3168 AC_SUBST(aros_target_iconset)
3169 AC_SUBST(aros_target_bootloader)
3170 AC_SUBST(aros_target_arch)
3171 AC_SUBST(aros_target_family)
3172 AC_SUBST(aros_target_cpu)
3173 AC_SUBST(aros_target_cpu_mode)
3174 AC_SUBST(aros_target_variant)
3175 AC_SUBST(aros_target_suffix)
3176 AC_SUBST(aros_target_ar)
3177 AC_SUBST(aros_target_ranlib)
3178 AC_SUBST(aros_plain_nm)
3179 AC_SUBST(aros_plain_ar)
3180 AC_SUBST(aros_kernel_ar)
3181 AC_SUBST(aros_kernel_ranlib)
3182 AC_SUBST(orig_target_cc)
3183 AC_SUBST(aros_target_cc)
3184 AC_SUBST(aros_kernel_cc)
3185 AC_SUBST(orig_target_cxx)
3186 AC_SUBST(aros_target_cxx)
3187 AC_SUBST(aros_kernel_cxx)
3188 AC_SUBST(orig_target_cpp)
3189 AC_SUBST(aros_target_cpp)
3190 AC_SUBST(aros_kernel_cpp)
3191 AC_SUBST(orig_target_as)
3192 AC_SUBST(aros_target_as)
3193 AC_SUBST(aros_kernel_as)
3194 AC_SUBST(orig_target_ld)
3195 AC_SUBST(aros_target_ld)
3196 AC_SUBST(aros_kernel_ld)
3197 AC_SUBST(aros_target_cc_includes)
3198 AC_SUBST(aros_target_cc_path)
3199 AC_SUBST(aros_target_objdump)
3200 AC_SUBST(aros_target_objcopy)
3201 AC_SUBST(aros_target_strip)
3202 AC_SUBST(aros_target_nm)
3203 AC_SUBST(aros_kernel_rescomp)
3204 AC_SUBST(aros_shared_default)
3205 AC_SUBST(aros_shared_ld)
3206 AC_SUBST(aros_object_format)
3207 AC_SUBST(spec_obj_format)
3208 AC_SUBST(aros_c_libs)
3209 AC_SUBST(aros_cxx_libs)
3211 AC_SUBST(aros_shared_cflags)
3212 AC_SUBST(aros_shared_aflags)
3213 AC_SUBST(aros_shared_ldflags)
3215 AC_SUBST(aros_warn_flags)
3216 AC_SUBST(aros_nowarn_flags)
3217 AC_SUBST(aros_config_cppflags)
3218 AC_SUBST(aros_config_cflags)
3219 AC_SUBST(aros_config_cxxflags)
3220 AC_SUBST(aros_config_aflags)
3221 AC_SUBST(aros_config_ldflags)
3223 AC_SUBST(aros_kernel_sysroot)
3224 AC_SUBST(aros_kernel_cppflags)
3225 AC_SUBST(aros_kernel_cflags)
3226 AC_SUBST(aros_kernel_includes)
3227 AC_SUBST(aros_kernel_objcflags)
3228 AC_SUBST(aros_kernel_ldflags)
3229 AC_SUBST(aros_debug_cppflags)
3230 AC_SUBST(aros_debug_cflags)
3231 AC_SUBST(aros_debug_cxxflags)
3232 AC_SUBST(aros_debug_aflags)
3233 AC_SUBST(aros_debug_ldflags)
3234 AC_SUBST(aros_target_genmap)
3235 AC_SUBST(aros_target_strip_flags)
3236 AC_SUBST(aros_config_lto)
3237 AC_SUBST(aros_config_coverage)
3238 AC_SUBST(aros_optimization_cflags)
3239 AC_SUBST(aros_kernel_isa_flags)
3240 AC_SUBST(aros_isa_extra)
3241 AC_SUBST(aros_isa_flags)
3243 AC_SUBST(crosstools_target)
3244 AC_SUBST(crosstools_cxx_target)
3246 AC_SUBST(use_libatomic)
3248 AC_SUBST(pci_hidd_target)
3250 AC_SUBST(aros_nominal_width)
3251 AC_SUBST(aros_nominal_height)
3252 AC_SUBST(aros_nominal_depth)
3254 # Native version related
3255 AC_SUBST(aros_serial_debug)
3256 AC_SUBST(PLATFORM_EXECSMP)
3257 AC_SUBST(ENABLE_EXECSMP)
3259 # MMU related
3260 AC_SUBST(aros_enable_mmu)
3262 # Bootloader related
3263 AC_SUBST(target_grub2_version)
3265 # Unix/Hosted version related
3266 AC_SUBST(aros_nesting_supervisor)
3268 # ARM default GCC target related
3269 AC_SUBST(gcc_default_cpu)
3270 AC_SUBST(gcc_default_cpu_tune)
3271 AC_SUBST(gcc_default_fpu)
3272 AC_SUBST(gcc_default_float_abi)
3273 AC_SUBST(gcc_default_mode)
3275 # Palm native version related
3276 AC_SUBST(aros_palm_debug_hack)
3278 # Apple iOS related
3279 AC_SUBST(aros_ios_platform)
3280 AC_SUBST(aros_ios_version)
3281 AC_SUBST(aros_ios_sdk)
3283 # Android related
3284 AC_SUBST(ant)
3285 AC_SUBST(android_tool)
3286 AC_SUBST(aros_android_level)
3287 AC_SUBST(aros_android_antapk)
3289 # Debug related
3290 AC_SUBST(aros_debug)
3291 AC_SUBST(aros_mungwall_debug)
3292 AC_SUBST(aros_stack_debug)
3293 AC_SUBST(aros_modules_debug)
3295 # Collect-aros stuff: "-ius" to ignore undefined symbols
3296 AC_SUBST(ignore_undefined_symbols)
3298 # C compiler related
3299 AC_SUBST(gcc_target_cpu)
3300 AC_SUBST(target_binutils_version)
3301 AC_SUBST(target_gcc_version)
3303 #ObjC compiler related
3304 AC_SUBST(objc_target)
3306 #Java related
3307 AC_SUBST(java_target)
3309 # DBUS related
3310 AC_SUBST(ENABLE_DBUS)
3311 AC_SUBST(DBUS_CFLAGS)
3312 AC_SUBST(DBUS_LIBFLAGS)
3313 AC_SUBST(KERNEL_DBUS_KOBJ)
3314 AC_SUBST(KERNEL_DBUS_INCLUDES)
3316 #X11 related
3317 AC_SUBST(ENABLE_X11)
3318 AC_SUBST(DO_XSHM_SUPPORT)
3319 AC_SUBST(DO_VIDMODE_SUPPORT)
3321 AC_SUBST(aros_host_x11_cflags)
3322 AC_SUBST(aros_host_x11_ldflags)
3324 #SDL related
3325 AC_SUBST(aros_host_sdl_cflags)
3326 AC_SUBST(aros_host_sdl_libs)
3328 # USB3.0 code
3329 AC_SUBST(aros_usb30_code)
3331 dnl Prepare for output, make up all the generated patches
3332 case "$aros_flavour" in
3333 emulation)      aros_flavour_uc="AROS_FLAVOUR_EMULATION"
3334                 aros_flavour="emulation" ;;
3335 emulcompat)     aros_flavour_uc="(AROS_FLAVOUR_EMULATION|AROS_FLAVOUR_BINCOMPAT)"
3336                 aros_flavour="emulation" ;;
3337 standalone)     aros_flavour_uc="AROS_FLAVOUR_STANDALONE"
3338                 aros_flavour="standalone";;
3339 standcompat)    aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_BINCOMPAT)"
3340                 aros_flavour="standalone";;
3341 native)         aros_flavour_uc="AROS_FLAVOUR_NATIVE"
3342                 aros_flavour="native" ;;
3343 nativecompat)   aros_flavour_uc="(AROS_FLAVOUR_NATIVE|AROS_FLAVOUR_BINCOMPAT)"
3344                 aros_flavour="native" ;;
3345 linklib)        aros_flavour_uc="AROS_FLAVOUR_LINKLIB"
3346                 aros_flavour="linklib" ;;
3347 palmnative)     aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
3348                 aros_flavour="palmnative" ;;
3349 mac68knative)   aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
3350                 aros_flavour="mac68knative" ;;
3351 ppcnative)      aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_BINCOMPAT)"
3352                 aros_flavour="ppcnative" ;;
3353 esac
3355 if test ! -d ${aros_inc_dir} ; then
3356     ${MKDIR} ${aros_inc_dir}
3358 if test ! -d ${aros_geninc_dir} ; then
3359     ${MKDIR} ${aros_geninc_dir}
3361 if test ! -d ${aros_hostcfg_dir} ; then
3362     ${MKDIR} ${aros_hostcfg_dir}
3364 if test ! -d ${aros_targetcfg_dir} ; then
3365     ${MKDIR} ${aros_targetcfg_dir}
3367 if test ! -d ${aros_tools_dir} ; then
3368     ${MKDIR} ${aros_tools_dir}
3370 if test ! -d ${aros_scripts_dir} ; then
3371     ${MKDIR} ${aros_scripts_dir}
3374 AC_CONFIG_HEADERS(${aros_geninc_dir}/host-conf.h:config/host-conf.h.in)
3376 # Generic build tools (metamake, etc)
3377 AC_CONFIG_COMMANDS([genmf-executable-support],
3378     [
3379         chmod a+x ${AROS_CROSSTOOLSDIR}/${aros_target_cpu}-aros-uname
3380         chmod a+x ${aros_tools_dir}/genmf.py
3381     ],
3382     [
3383         AROS_CROSSTOOLSDIR=${AROS_CROSSTOOLSDIR}
3384         aros_tools_dir=${aros_tools_dir}
3385     ]
3387 AC_CONFIG_FILES(
3388     Makefile
3389     config/make.cfg
3390     ${aros_inc_dir}/config.h:config/config.h.in
3391     ${aros_geninc_dir}/config.h:config/config.h.in
3392     ${aros_hostcfg_dir}/host.cfg:config/host.cfg.in
3393     ${aros_targetcfg_dir}/target.cfg:config/target.cfg.in
3394     ${aros_targetcfg_dir}/build.cfg:config/build.cfg.in
3395     mmake.config
3396     compiler/include/geninc.cfg:compiler/include/geninc.cfg.in
3397     ${aros_targetcfg_dir}/make.defaults:config/make.defaults.in
3398     ${aros_tools_dir}/genmf.py:tools/genmf/genmf.py
3399     ${AROS_CROSSTOOLSDIR}/${aros_target_cpu}-aros-uname:scripts/uname.in
3400     tools/collect-aros/env.h
3403 # Binutils
3404 AC_CONFIG_COMMANDS([binutils-support],
3405     [
3406         prefix=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}
3407         mkdir -p $prefix
3408         prefix2=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros
3410         chmod a+x ${prefix2}-ld
3412         ln -sf $orig_target_as$aros_host_exe_suffix      ${prefix2}-as$aros_host_exe_suffix
3413         ln -sf $orig_target_nm$aros_host_exe_suffix      ${prefix2}-nm$aros_host_exe_suffix
3414         ln -sf $orig_target_ar$aros_host_exe_suffix      ${prefix2}-ar$aros_host_exe_suffix
3415         ln -sf $orig_target_ranlib$aros_host_exe_suffix  ${prefix2}-ranlib$aros_host_exe_suffix
3416         ln -sf $orig_target_objcopy$aros_host_exe_suffix ${prefix2}-objcopy$aros_host_exe_suffix
3417         ln -sf $orig_target_objdump$aros_host_exe_suffix ${prefix2}-objdump$aros_host_exe_suffix
3418         ln -sf $orig_target_strip$aros_host_exe_suffix   ${prefix2}-strip$aros_host_exe_suffix
3419     ],
3420     [
3421         aros_host_exe_suffix=${aros_host_exe_suffix}
3422         aros_tools_dir=${aros_tools_dir}
3423         aros_target_cpu=${aros_target_cpu}
3424         aros_target_arch=${aros_target_arch}
3425         aros_target_suffix=${aros_target_suffix}
3426         orig_target_nm=${orig_target_nm}
3427         orig_target_as=${orig_target_as}
3428         orig_target_ar=${orig_target_ar}
3429         orig_target_ranlib=${orig_target_ranlib}
3430         orig_target_objdump=${orig_target_objdump}
3431         orig_target_objcopy=${orig_target_objcopy}
3432         orig_target_strip=${orig_target_strip}
3433         aros_kernel_ld=${aros_kernel_ld}
3434     ]
3436 if test "${use_ld_wrapper}" = "yes"; then
3437     AC_CONFIG_FILES(
3438         ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-${aros_ld}:scripts/aros-ld.in
3439     )
3441 # Bare Elf support script and spec
3442 if test "${use_kernel_cc_wrapper}" = "yes"; then
3443     AC_CONFIG_COMMANDS([elf-compiler-support],
3444         [
3445             prefix=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}
3446             mkdir -p $prefix
3447             prefix2=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-elf
3449             chmod a+x ${prefix2}-gcc
3451             ln -sf $aros_kernel_ld$aros_host_exe_suffix         ${prefix2}-ld$aros_host_exe_suffix
3452         ],
3453         [
3454             aros_host_exe_suffix=${aros_host_exe_suffix}
3455             aros_tools_dir=${aros_tools_dir}
3456             aros_target_cpu=${aros_target_cpu}
3457             aros_target_arch=${aros_target_arch}
3458             aros_target_suffix=${aros_target_suffix}
3459             aros_kernel_ld=${aros_kernel_ld}
3460         ]
3461     )
3462     AC_CONFIG_FILES(
3463         ${aros_targetcfg_dir}/elf-specs:${elf_specs_in}
3464         ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-elf-gcc:scripts/elf-gcc.in
3465     )
3468 # Host compiler support scripts and spec
3469 if test "${aros_target_toolchain}" = "no"; then
3470     AC_CONFIG_COMMANDS([host-compiler-wrapper-support],
3471         [
3472             prefix=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}
3473             mkdir -p $prefix
3474             prefix2=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros
3476             chmod a+x ${prefix2}-${toolchain_c_compiler} ${prefix2}-${toolchain_cxx_compiler} ${prefix2}-${toolchain_cpp_preprocessor}
3477         ],
3478         [
3479             aros_host_exe_suffix=${aros_host_exe_suffix}
3480             aros_tools_dir=${aros_tools_dir}
3481             aros_target_cpu=${aros_target_cpu}
3482             aros_target_arch=${aros_target_arch}
3483             aros_target_suffix=${aros_target_suffix}
3484         ]
3485     )
3486     AC_CONFIG_FILES(
3487         ${aros_targetcfg_dir}/specs:config/specs.in
3488         ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-${toolchain_cpp_preprocessor}:scripts/aros-${toolchain_cpp_preprocessor}.in
3489         ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-${toolchain_c_compiler}:scripts/aros-${toolchain_c_compiler}.in
3490         ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-${toolchain_cxx_compiler}:scripts/aros-${toolchain_cxx_compiler}.in
3491     )
3494 # Android support
3495 if test "$aros_target_variant" == "android"; then
3496     AC_CONFIG_FILES(${aros_gendir}/arch/all-android/bootstrap/app/default.properties:arch/all-android/bootstrap/app/default.properties.in)
3499 # cmake helper
3500 AC_CONFIG_FILES(${aros_targetcfg_dir}/conf.cmake:config/conf.cmake.in)
3502 AC_OUTPUT
3504 dnl This is in order to not define SHARED_CFLAGS sometimes
3505 dnl We don't always do aros_shared_ar, aros_shared_cflags
3507 #XXX compatability...
3508 aros_shared_ar="$aros_shared_ld $aros_shared_ldflags -o"
3510 if test -n "$aros_shared_cflags" ; then
3511     echo "SHARED_CFLAGS := $aros_shared_cflags" >> ${aros_hostcfg_dir}/host.cfg
3512     echo "SHARED_AR := $aros_shared_ar" >> ${aros_hostcfg_dir}/host.cfg