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