1 dnl Copyright © 1997-2016, The AROS Development Team. All rights reserved.
4 dnl Desc: Autoconf source for configuration file
7 # Note: After file changes, generate configure anew and commit _both_ files.
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 # ------------------------------------------------------------------------
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.
25 # Default versions for the gnu tools we build
26 default_gcc_version="4.6.4"
27 default_binutils_version="2.23.2"
28 toolchain_needs_sysroot=no
30 # The AROS target is slightly different to the normal GNU style
31 # format. We don't have the middle part, and we reverse the order
32 # of the $(CPU) and $(OS) bits.
34 # Don't strip the version of the target yet, it might be
35 # useful on some systems.
37 AC_MSG_CHECKING([for AROS style target])
39 if test "$target" = "NONE" ; then
40 target=$host_os-$host_cpu
42 if test "$target" = "" ; then
43 target=$host_os-$host_cpu
46 AC_MSG_RESULT($target)
48 if test "$host_os" = "mingw32" ; then
52 # Don't know where else to put this...
53 AC_MSG_CHECKING([building AROS in])
54 AROS_BUILDDIR=`${PWDCMD-pwd}`
55 AROS_BUILDDIR_UNIX=${PWD}
56 AC_MSG_RESULT($AROS_BUILDDIR)
58 AC_MSG_CHECKING([AROS source in])
59 srcpwd=`cd ${srcdir} ; ${PWDCMD-pwd}`
61 AC_MSG_RESULT($SRCDIR)
63 # Parse the target field into something useful.
65 target_os=`echo $target | sed 's/^\([^-].*\)-\(.*\)$/\1/'`
66 target_cpu=`echo $target | sed 's/^\([^-].*\)-\(.*\)$/\2/'`
69 # Some debug output, to be removed again.
70 AC_MSG_CHECKING([for target system (debug output)])
71 AC_MSG_RESULT($target_os)
72 AC_MSG_CHECKING([for target cpu (debug output)])
73 AC_MSG_RESULT($target_cpu)
75 dnl --------------------------------------------------------------------
76 dnl Set the default Workbench resolution
77 dnl --------------------------------------------------------------------
78 aros_nominal_width=800
79 aros_nominal_height=600
82 dnl --------------------------------------------------------------------
83 dnl Host Configuration Section
84 dnl --------------------------------------------------------------------
86 dnl The idea here is to find out all the information we need about the
87 dnl host. This means things like tools for building directory structures,
88 dnl copying files around and the like.
90 default_c_compilers="gcc clang cc"
91 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="")
92 if test "$use_c_compiler" = ""; then
93 host_c_compilers="$default_c_compilers"
95 host_c_compilers="$use_c_compiler"
98 default_cxx_compilers="g++ clang++ c++"
99 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="")
100 if test "$use_cxx_compiler" = ""; then
101 host_cxx_compilers="$default_cxx_compilers"
103 host_cxx_compilers="$use_cxx_compiler"
107 # The first step is to find the host binaries.
108 # Check for a compiler.
109 # Due to a bug in autoconf check for c++ compiler first.
110 # For mor info see, http://osdir.com/ml/bug-autoconf-gnu/2010-05/msg00001.html.
111 AC_PROG_CXX([${host_cxx_compilers}])
112 AC_PROG_CC([${host_c_compilers}])
113 aros_host_def_cc="$CC"
117 # Check for a compatible awk
118 AC_CHECK_PROGS(AWK,[gawk nawk])
119 AROS_REQUIRED(gawk,$AWK)
120 AROS_PROG(MMAKE,mmake)
122 AC_MSG_CHECKING([Which toolchain family to use ...])
123 AC_ARG_WITH(toolchain,AC_HELP_STRING([--with-toolchain=family],[Which toolchain family to crosscompile with (defaults to gnu)]),aros_toolchain="$withval",aros_toolchain="gnu")
124 AC_MSG_RESULT($aros_toolchain)
126 case "$aros_toolchain" in
128 toolchain_needs_sysroot=yes
129 toolchain_c_compiler="clang"
130 toolchain_cxx_compiler="clang++"
131 toolchain_cpp_preprocessor="clang"
134 toolchain_c_compiler="gcc"
135 toolchain_cxx_compiler="g++"
136 toolchain_cpp_preprocessor="cpp"
139 AC_MSG_WARN("Unknown toolchain family!")
140 toolchain_c_compiler="cc"
141 toolchain_cxx_compiler="c++"
142 toolchain_cpp_preprocessor="cpp"
147 # Perform some default variable assignments. Note all of these will be
148 # Regenerated from the script, so there is no need to cache them.
150 aros_build_host=$host
154 AROS_TOOL_CCPATH(aros_host_ld,ld)
155 AROS_REQUIRED(ld,$aros_host_ld)
156 aros_host_make="make"
157 aros_host_cflags="$CFLAGS"
158 aros_host_cxxflags="$CXXFLAGS"
159 aros_host_ldflags="$LDFLAGS"
160 aros_host_debug="-g -O0"
161 aros_host_mkdep="\$(SRCDIR)/scripts/mkdep"
162 aros_host_mkargs="--no-print-directory"
163 aros_host_exe_suffix="$EXEEXT"
164 aros_host_lib_suffix=""
166 # Ignore all compliance, AROS ROMs = 0
167 # KickStart v1.0 = 30
168 # KickStart v1.3 = 34
169 # KickStart v2.0 = 37
170 # KickStart v3.0 = 39
171 # KickStart v3.1 = 40
173 aros_amigaos_compliance=0
175 AC_CHECK_PROGS(aros_host_aclocal,[aclocal aclocal19 aclocal-1.9])
176 AC_CHECK_PROGS(aros_host_autoconf,[autoconf autoconf259 autoconf253])
177 AC_CHECK_PROGS(aros_host_autoheader,[autoheader autoheader259 autoheader253])
178 AC_CHECK_PROGS(aros_host_automake,[automake automake19 automake-1.9])
180 AROS_REQUIRED(aclocal/aclocal19/aclocal-1.9, $aros_host_aclocal)
181 AROS_REQUIRED(automake/automake19/automake-1.9, $aros_host_automake)
183 case "$aros_host_cc" in
188 aros_host_cc_pipe="-pipe"
198 aros_kernel_cc_includes=""
199 aros_target_cc_includes=""
202 # ----------------------------------------------------------------------------------------
203 # Host-specific defaults
205 # This is the main host configuration section. It is where the host
206 # can change the values of any variables it needs to change. We do
207 # not look at anything that compiles to the target yet, we'll get
212 aros_host_arch="aros"
213 aros_host_cflags="$aros_host_cflags $aros_host_cc_pipe"
219 aros_host_cpu="x86_64"
225 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
226 aros_host_cpu="$host_cpu"
232 aros_host_arch="linux"
233 aros_host_cflags="$aros_host_cflags $aros_host_cc_pipe"
234 android_build_os="linux-x86"
235 android_tool="android"
236 default_android_sdk="/opt/android-sdk-linux_x86"
242 aros_host_cpu="x86_64"
254 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
255 aros_host_cpu="$host_cpu"
261 aros_host_cflags="$aros_host_cflags $aros_host_cc_pipe -I/usr/local/include"
262 aros_host_make="gmake"
263 aros_host_arch="freebsd"
266 aros_host_ldflags="$aros_host_ldflags -L/usr/local/lib -liconv"
268 dnl FreeBSD 5.x (and later) has changed the default object format.
269 dnl The double [[]] is necessary to get around m4's quoting rules.
272 aros_object_format="elf_i386"
276 aros_object_format="elf_i386_fbsd"
283 aros_host_cflags="$aros_host_cflags $aros_host_cc_pipe"
284 aros_host_arch="darwin"
286 if [[ -z ${SED+x} ]]; then SED="gsed"; fi
287 android_build_os="darwin-x86"
288 android_tool="android"
289 default_android_sdk="/android-sdk-mac_x86"
295 aros_host_cpu="x86_64"
301 AC_MSG_WARN("Unknown CPU for Darwin host -- $host_cpu")
302 aros_host_cpu="$host_cpu"
306 aros_host_ldflags="$aros_host_ldflags -liconv"
311 aros_host_cflags="$aros_host_cflags $aros_host_cc_pipe"
312 aros_host_make="gmake"
313 aros_host_arch="dragonfly"
319 aros_host_cpu="x86_64"
322 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
323 aros_host_cpu="$host_cpu"
329 aros_host_cflags="$aros_host_cflags $aros_host_cc_pipe"
330 aros_host_make="gmake"
331 aros_host_arch="netbsd"
340 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
341 aros_host_cpu="$host_cpu"
344 aros_host_lib_suffix=".0.0"
348 aros_host_cflags="$aros_host_cflags $aros_host_cc_pipe"
349 aros_host_make="gmake"
350 aros_host_arch="openbsd"
356 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
357 aros_host_cpu="$host_cpu"
363 aros_host_arch="solaris"
364 aros_host_cflags="$aros_host_cflags $aros_host_cc_pipe"
370 aros_host_cpu="sparc"
373 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
374 aros_host_cpu="$host_cpu"
380 aros_host_arch="morphos"
386 aros_host_arch="amiga"
392 TOUCH="/gg/bin/touch"
401 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
402 aros_host_cpu="$host_cpu"
408 aros_host_arch="cygwin"
409 aros_host_cflags="$aros_host_cflags $aros_host_cc_pipe"
411 android_build_os="windows"
412 android_tool="android.bat"
413 default_android_sdk="/cygdrive/c/android-sdk-windows-1.6_r1"
420 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
421 aros_host_cpu="$host_cpu"
427 aros_host_arch="mingw32"
428 aros_host_cflags="$aros_host_cflags $aros_host_cc_pipe"
430 android_build_os="windows"
431 android_tool="android.bat"
432 default_android_sdk="/c/android-sdk-windows-1.6_r1"
436 dnl Currently there's neither 64-bit MinGW nor MSYS. Both environments are 32-bit
437 dnl and run under emulation. Consequently, uname reports i386 even on 64-bit systems.
438 dnl Here we attempt to detect Windows home platform by asking gcc about its target.
439 dnl 64-bit gcc will output "x86_64-w64-mingw32" here.
441 AC_MSG_CHECKING([for Windows native gcc target])
442 host_cpu=`gcc -dumpmachine`
443 AC_MSG_RESULT($host_cpu)
454 dnl Native i386 gcc for MinGW32 reports 'mingw32' with -dumpmachine switch
459 aros_host_cpu="x86_64"
460 dnl Dragon's x86_64-w64-mingw32-gcc is a bit broken. It ignores standard $prefix/include
461 dnl directory, so we have to add it explicitly here.
462 aros_host_cflags="$aros_host_cflags -isystem /mingw/include"
466 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
467 aros_host_cpu="$host_cpu"
472 AC_MSG_ERROR([Unsupported host architecture $host])
476 AROS_PROG(aros_host_ar,[ar],[cr])
477 AROS_REQUIRED(ar,$aros_host_ar)
478 AROS_PROG(aros_host_ranlib,ranlib)
479 AROS_REQUIRED(ranlib,$aros_host_ranlib)
480 AROS_PROG(aros_host_strip,strip)
481 AROS_REQUIRED(strip,$aros_host_strip)
483 AROS_PROG(RM,[rm],[-rf])
484 AROS_REQUIRED(rm,$RM)
486 AROS_REQUIRED(cp,$CP)
488 AROS_REQUIRED(mv,$MV)
489 AROS_PROG(ECHO,[echo])
490 AROS_REQUIRED(echo,$ECHO)
491 AROS_PROG(MKDIR,[mkdir],[-p])
492 AROS_REQUIRED(mkdir,$MKDIR)
493 AROS_PROG(TOUCH,[touch])
494 AROS_REQUIRED(touch,$TOUCH)
495 AROS_PROG(SORT,[sort])
496 AROS_REQUIRED(sort,$SORT)
497 AROS_PROG(UNIQ,[uniq])
498 AROS_REQUIRED(uniq,$UNIQ)
499 AROS_PROG(NOP,[true])
500 AROS_REQUIRED(true,$NOP)
502 AROS_REQUIRED(cat,$CAT)
503 AROS_PROG(BISON,[bison])
504 AROS_REQUIRED(bison,$BISON)
505 AROS_PROG(FLEX,[flex])
506 AROS_REQUIRED(flex,$FLEX)
507 AROS_PROG(PNGTOPNM,[pngtopnm])
508 AROS_REQUIRED(pngtopnm,$PNGTOPNM)
509 AROS_PROG(PPMTOILBM,[ppmtoilbm])
510 AROS_REQUIRED(ppmtoilbm,$PPMTOILBM)
512 AROS_REQUIRED(sed,$SED)
513 AROS_PROG(CHMOD,[chmod])
514 AROS_REQUIRED(chmod,$CHMOD)
515 AROS_PROG(PATCH,[patch])
516 AROS_REQUIRED(patch,$PATCH)
520 AC_CHECK_LIB(png, png_read_png)
521 AROS_REQUIRED(libpng, $ac_cv_lib_png_png_read_png)
528 dnl ---------------------------------------------------------------------------
529 dnl Look for things about the host system, good for hosted targets.
530 dnl ---------------------------------------------------------------------------
532 # Check for some includes for the X11 HIDD and the kernel
533 AC_CHECK_HEADERS([sys/ipc.h sys/shm.h \
534 sys/mmap.h sys/mman.h sysexits.h \
535 sys/statfs.h sys/statvfs.h sys/vfs.h sys/param.h \
538 AC_CHECK_HEADERS([sys/mount.h],,,[#include <sys/param.h>])
555 AC_CHECK_MEMBERS(struct tm.tm_gmtoff)
557 # Look for some functions
558 AC_CHECK_FUNCS([getpagesize kqueue statfs statvfs \
559 clone kse_create rfork_thread thr_create sa_register \
560 getcontext makecontext setcontext sigaltstack swapcontext])
565 dnl --------------------------------------------------------------------
566 dnl Target Configuration Section
567 dnl --------------------------------------------------------------------
569 dnl The target configuration section is responsible for setting up all
570 dnl the paths for includes, and tools required to build AROS to some
571 dnl particular target.
573 aros_config_cflags="-Wall -Werror-implicit-function-declaration -Wno-parentheses"
574 aros_config_aflags="-Wall -x assembler-with-cpp -c"
575 aros_config_ldflags=""
577 aros_shared_default=yes
579 aros_shared_cflags="-fPIC"
580 aros_shared_aflags=""
581 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
582 aros_kernel_ldflags="-Wl,-rpath,./lib"
584 aros_kernel_ar_flags="cr"
585 aros_target_ar_flags="cr"
586 aros_target_nm_flags="-C -ul"
587 aros_target_strip_flags="--strip-unneeded -R.comment"
592 aros_target_genmap="-Wl,-Map -Xlinker"
594 # Native flavour stuff
595 aros_serial_debug="0"
597 # Palm native flavour stuff
598 aros_palm_debug_hack="0"
601 aros_nesting_supervisor="0"
603 # Collect-aros stuff: "-ius" to ignore undefined symbols
604 ignore_undefined_symbols=""
606 # Check for X11 by default
613 #-----------------------------------------------------------------------------
616 # GCC 4.1+ has a stack protection feature that requires OS support. Ubuntu has
617 # it switched on by default, and we use the host compiler, so it compiles AROS
618 # code with this enabled resulting in link failures as we don't have support
621 # We use two methods to disable it. For the host compiler (used to compile
622 # some hosted modules), we test to see if the compiler supports stack
623 # protection, and if it does we disable it in AROS_CONFIG_CFLAGS. This should
624 # work on all platforms.
626 # For the "cross" compiler we clear the "ssp_default" spec in config/specs.in
627 # (this is done unconditionally, as it should have no effect on compilers
628 # without the stack protection feature). This may be specific to the way that
629 # Ubuntu enables the feature, so may not work everywhere. My specs-fu isn't
630 # strong enough to disable it in a generic way though, so we'll live with it
631 # until another vendor ships GCC with it enabled in a different way, and deal
635 AC_MSG_CHECKING([whether ${CC} accepts -fno-stack-protector])
636 save_cflags="$CFLAGS"
637 CFLAGS="$CFLAGS -fno-stack-protector"
638 AC_TRY_COMPILE(,, use_no_stack_protector="yes", use_no_stack_protector="no")
639 AC_MSG_RESULT($use_no_stack_protector)
640 if test "x-$use_no_stack_protector" = "x-yes" ; then
641 aros_host_cflags="$aros_host_cflags -fno-stack-protector"
643 CFLAGS="$save_cflags"
645 #-----------------------------------------------------------------------------
647 # Disable pointer-signedness warnings if the compiler recognises the option
648 # (this only works for the host compiler at the moment)
650 AC_MSG_CHECKING([whether ${CC} accepts -Wno-pointer-sign])
651 save_cflags="$CFLAGS"
652 CFLAGS="$CFLAGS -Wno-pointer-sign"
653 AC_TRY_COMPILE(,, use_no_sign_warning="yes", use_no_sign_warning="no")
654 AC_MSG_RESULT($use_no_sign_warning)
655 if test "x-$use_no_sign_warning" = "x-yes" ; then
656 aros_host_cflags="$aros_host_cflags -Wno-pointer-sign"
658 CFLAGS="$save_cflags"
660 #-----------------------------------------------------------------------------
662 # Check if host compiler supports -fgnu89-inline, can be needed for crosstools.
664 AC_MSG_CHECKING([whether ${CC} accepts -fgnu89-inline])
665 save_cflags="$CFLAGS"
666 CFLAGS="$CFLAGS -fgnu89-inline"
667 AC_TRY_COMPILE(,, use_gnu89_inline="yes", use_gnu89_inline="no")
668 AC_MSG_RESULT($use_gnu89_inline)
669 if test "x-$use_gnu89_inline" = "x-yes" ; then
670 gnu89_inline="-fgnu89-inline"
672 CFLAGS="$save_cflags"
674 #-----------------------------------------------------------------------------
676 AC_MSG_CHECKING([for type of build])
677 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")
679 if test "$build_type" = "nightly"; then
680 build_type_string="NIGHTLY"
681 elif test "$build_type" = "snapshot"; then
682 build_type_string="SNAPSHOT"
683 elif test "$build_type" = "milestone"; then
684 build_type_string="MILESTONE"
685 elif test "$build_type" = "release"; then
686 build_type_string="RELEASE"
688 build_type_string="PERSONAL"
689 build_type="personal"
692 aros_config_cflags="$aros_config_cflags -DAROS_BUILD_TYPE=AROS_BUILD_TYPE_$build_type_string"
694 AC_MSG_RESULT($build_type)
696 #-----------------------------------------------------------------------------
697 all_debug_types="messages stack modules mungwall symbols"
699 AC_MSG_CHECKING([which debug types to enable])
700 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)]),
701 debug="$enableval",debug="")
703 if test "$debug" = "" -o "$debug" = "no"; then
705 elif test "$debug" = "yes"; then
709 if test "$debug" = "all" ; then
710 debug="messages stack modules symbols"
711 for d in $all_debug_types; do
712 export aros_${d}_debug="1"
715 for d in $all_debug_types; do
716 export aros_${d}_debug="0"
720 if test "$debug" != "none"; then
721 debug=`echo $debug | sed s/,/\ /g`
724 for d2 in $all_debug_types; do
725 if test "$d2" = "$d"; then
730 if test "$found" = "0"; then
731 AC_MSG_ERROR([unrecognized debug type "$d". Available types are: all none $all_debug_types])
733 export aros_${d}_debug="1"
737 AC_MSG_RESULT($debug)
739 if test "$aros_messages_debug" = "1"; then
740 aros_messages_debug="-DADEBUG=1 -DMDEBUG=1"
742 aros_messages_debug=""
744 if test "$aros_symbols_debug" = "1"; then
745 aros_symbols_debug="-g"
747 aros_symbols_debug=""
750 # These are the flags to pass when compiling debugged programs
751 aros_debug_cflags="$aros_symbols_debug $aros_messages_debug"
753 aros_debug_ldflags="$aros_symbols_debug"
755 #-----------------------------------------------------------------------------
756 # Checking for distcc and ccache.
758 # Always apply the transforms in this particular order. Basically you should
759 # always run 'ccache distcc compiler' in that order for the best performance.
761 AC_MSG_CHECKING([whether to enable distcc])
762 AC_ARG_ENABLE(distcc,AC_HELP_STRING([--enable-distcc],[Use distcc as a front end to the compiler (default=no).]),distcc="$enableval",distcc="no")
763 if test "$distcc" != "" -a "$distcc" != "no"; then
764 # AC_CHECK_PROG will print out the result in this case
765 AC_PATH_PROG(DISTCC,[distcc],distcc,)
770 AC_MSG_CHECKING([whether to enable ccache])
771 AC_ARG_ENABLE(ccache,AC_HELP_STRING([--enable-ccache],[Use ccache as a front end to the compiler (default=no).]),ccache="$enableval",ccache="no")
772 if test "$ccache" != "" -a "$ccache" != "no"; then
773 # AC_CHECK_PROG will print out the result in this case
774 AC_CHECK_PROG(CCACHE,[ccache],ccache,)
779 #-----------------------------------------------------------------------------
780 AC_MSG_CHECKING([what specific host gcc version to use])
781 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="")
782 AC_MSG_RESULT($kernel_tool_version)
784 #-----------------------------------------------------------------------------
785 AC_MSG_CHECKING([what optimization flags to use])
786 AC_ARG_WITH(optimization,AC_HELP_STRING([--with-optimization=FLAGS],[Use optimization flags FLAGS (default=-O2).]),optimization="$withval",optimization="unknown")
787 if test "$optimization" = "unknown"; then
788 dnl default is -O2 for normal builds, -O0 for debug builds
789 if test "$debug" != "none"; then
795 aros_optimization_cflags="$optimization"
796 AC_MSG_RESULT($optimization)
798 #-----------------------------------------------------------------------------
799 AC_MSG_CHECKING([what paranoia flags to use])
800 AC_ARG_WITH(paranoia,AC_HELP_STRING([--with-paranoia=FLAGS],[CC flags to enable paranoia]),[paranoia_flags="$withval"],[paranoia_flags="default"])
801 if test "$paranoia_flags" = "default"; then
803 else if test "$paranoia_flags" = "yes"; then
804 paranoia_flags="-Wall -Werror"
806 AC_MSG_RESULT($paranoia_flags)
807 aros_config_cflags="$aros_config_cflags $paranoia_flags"
809 #-----------------------------------------------------------------------------
810 AC_MSG_CHECKING([what target variant to enable])
811 AC_ARG_ENABLE(target_variant,AC_HELP_STRING([--enable-target-variant=NAME],[Enable a specific target variant(default=none)]),target_variant=$enableval,target_variant="")
812 if test "$target_variant" = ""; then
813 aros_target_variant=""
814 aros_target_suffix=""
817 aros_target_variant="$target_variant"
818 aros_target_suffix="-$target_variant"
820 AC_MSG_RESULT($enableval)
822 #-----------------------------------------------------------------------------
823 # Target-specific defaults. You can override then on a per-target basis.
825 # Bootloader name. Currently used by PC target.
826 target_bootloader="none"
829 #-----------------------------------------------------------------------------
830 # Additional options for some specific targets
832 case "$aros_target_variant" in
834 AC_MSG_CHECKING([XCode path])
835 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")
836 AC_MSG_RESULT($aros_xcode_path)
838 AC_MSG_CHECKING([what iOS SDK version to use])
839 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")
840 AC_MSG_RESULT($aros_sdk_version)
845 AC_MSG_CHECKING([Android SDK path])
846 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)
847 AC_MSG_RESULT($aros_android_sdk)
849 AC_MSG_CHECKING([Android NDK path])
850 AC_ARG_WITH(ndk,AC_HELP_STRING([--with-ndk=PATH],[Specify Android NDK path (default=none).]),aros_android_ndk="$withval",aros_android_ndk="none")
851 AC_MSG_RESULT($aros_android_ndk)
853 AC_MSG_CHECKING([what Android SDK version to use])
854 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")
855 AC_MSG_RESULT($aros_sdk_version)
857 aros_android_level=android-$aros_sdk_version
858 if test ! -d $aros_android_sdk/platforms/$aros_android_level; then
859 echo "Platform $aros_android_level is not installed in your SDK"
860 echo "Use --with-sdk-version=<API level number> to select another platform version"
861 echo "You can check what plaform versions are installed in your SDK"
862 echo "by examining contents of $aros_android_sdk/platforms directory"
863 AC_MSG_ERROR([Android platform $aros_android_level is not installed])
866 export PATH="$aros_android_sdk/tools:$PATH"
867 AC_PATH_PROG(android_tool, $android_tool)
868 AROS_REQUIRED(android,$android_tool)
870 if test "$aros_android_ndk" != "none"; then
871 AC_MSG_CHECKING([what Android NDK version to use])
872 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")
873 AC_MSG_RESULT($aros_ndk_version)
876 AC_PATH_PROG(ant, ant)
877 if test "$ant" = ""; then
878 AC_MSG_WARN([Apache Ant is missing, Java bootstrap can't be built automatically])
881 AC_MSG_CHECKING([Build debug or release apk])
882 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)
883 if test $aros_android_antapk != release -a $aros_android_antapk != debug; then
884 AC_MSG_ERROR([apk-version has to be release or debug])
886 AC_MSG_RESULT($aros_android_antapk)
888 dnl MSYS bash can't run .bat files directly, then need to be started via cmd.exe
889 if test "$host_os" = "mingw32"; then
890 android_tool="cmd //c $android_tool"
898 #-----------------------------------------------------------------------------
899 # External toolchains
900 kernel_tool_prefix="none"
901 aros_tool_prefix="none"
902 elf_tool_prefix="${target_cpu}-elf-"
904 # This is the target configuration switch.
907 aros_target_arch="linux"
908 aros_target_family="unix"
909 case "$target_cpu" in
911 aros_target_cpu="m68k"
912 aros_object_format="m68kelf"
913 aros_flavour="emulcompat"
914 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D__mc68000 -D__linux__"
915 aros_shared_ldflags="-Wl,-T,\$(TOP)/config/linux/m68k/script.so"
916 aros_kernel_ldflags="-Wl,-rpath,./lib,-T,\$(TOP)/config/linux/m68k/script.normal"
917 gcc_target_cpu="mc68000"
920 aros_target_cpu="i386"
921 aros_object_format="elf_i386"
922 aros_flavour="emulation"
923 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__linux__"
924 aros_kernel_ldflags="-Wl,-melf_i386"
926 gcc_target_cpu="i386"
927 pci_hidd_target="hidd-pci-linux"
928 android_tool_dir_prefix="x86"
929 android_tool_prefix="i686-android-linux"
930 android_ndk_arch="x86"
933 aros_target_cpu="x86_64"
934 aros_object_format="elf_x86_64"
935 aros_flavour="emulation"
936 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64 -D__linux__"
937 aros_config_cflags="$aros_config_cflags -mcmodel=large -mno-red-zone -fno-omit-frame-pointer"
939 pci_hidd_target="hidd-pci-linux"
942 aros_target_cpu="ppc"
943 aros_object_format="elf32ppc"
944 aros_flavour="emulation"
945 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc -D__linux__"
950 # Same as powerpc, but I need this for the nightly build to work again.
951 # Actually, the nightly should be made working with powerpc target.
952 # That just was too much work for the moment, another week or two.
954 aros_target_cpu="ppc"
955 aros_object_format="elf32ppc"
956 aros_flavour="emulation"
957 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc -D__linux__"
962 aros_target_cpu="arm"
964 aros_object_format="armelf_aros"
965 aros_flavour="emulation"
966 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm -D__linux__"
968 aros_config_cflags="$aros_config_cflags -fno-strict-aliasing -fno-omit-frame-pointer"
969 aros_config_aflags="$aros_config_aflags -fno-strict-aliasing"
970 aros_arch_libs="-laeabi"
971 gcc_default_float_abi="hard"
972 android_tool_dir_prefix="arm-linux-androideabi"
973 android_tool_prefix="arm-linux-androideabi"
974 android_ndk_arch="arm"
975 kernel_tool_prefix="arm-linux-gnueabihf-"
978 aros_target_cpu="arm"
979 aros_object_format="armelf_aros"
980 aros_flavour="emulation"
981 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm -D__linux__"
983 aros_config_cflags="$aros_config_cflags -fno-strict-aliasing -fno-omit-frame-pointer"
984 aros_config_aflags="$aros_config_aflags -fno-strict-aliasing"
985 aros_arch_libs="-laeabi"
986 android_tool_dir_prefix="arm-linux-androideabi"
987 android_tool_prefix="arm-linux-androideabi"
988 android_ndk_arch="arm"
989 kernel_tool_prefix="arm-linux-gnueabi-"
992 AC_MSG_ERROR("Unknown CPU for Linux -- $target_cpu")
995 case "$aros_target_variant" in
998 dnl Not all Linux CPUs are supported by Android
999 if test "$android_ndk_arch" = ""; then
1000 AC_MSG_ERROR("Unsupported CPU for Android -- $target_cpu")
1003 aros_nominal_width=320
1004 aros_nominal_height=480
1005 if test "$aros_android_ndk" = "none"; then
1006 dnl Use standalone toolchain, don't adjust paths
1007 aros_kernel_cflags="-mandroid"
1008 aros_kernel_ldflags="-mandroid"
1011 dnl In Android NDK toolchains are placed in own directories,
1012 dnl but tool names are not suffixed with version
1013 export PATH="$aros_android_ndk/toolchains/$android_tool_dir_prefix-$kernel_tool_version/prebuilt/$android_build_os/bin:$PATH"
1014 kernel_tool_version=""
1015 aros_android_ndk="$aros_android_ndk/platforms/android-$aros_ndk_version/arch-$android_ndk_arch"
1016 aros_kernel_cflags="--sysroot $aros_android_ndk -mandroid"
1017 aros_kernel_ldflags="--sysroot $aros_android_ndk -mandroid"
1018 CFLAGS="$CFLAGS --sysroot $aros_android_ndk -mandroid"
1019 aros_kernel_includes="-isystem $aros_android_ndk/usr/include"
1022 host_android_gfx=yes
1023 # Disable implicit PIC mode
1024 aros_target_cflags="$aros_target_cflags -fno-pic"
1025 kernel_tool_prefix="$android_tool_prefix-"
1031 aros_target_arch="pc"
1032 aros_shared_default="no"
1033 target_bootloader="grub2"
1034 case "$target_cpu" in
1036 aros_target_cpu="i386"
1038 dnl If somebody hasn't already set the target object
1039 dnl format, then use this value. Mostly to support
1040 dnl FreeBSD cross-compilation.
1041 dnl TODO: Remove when we always use our compiler.
1043 if test "$aros_object_format" = "" ; then
1044 aros_object_format="elf_i386"
1046 aros_flavour="standalone"
1047 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1048 aros_kernel_ldflags="-Wl,-melf_i386"
1049 aros_nominal_width=640
1050 aros_nominal_height=480
1051 gcc_target_cpu="i386"
1054 aros_target_cpu="x86_64"
1056 if test "$aros_object_format" = "" ; then
1057 aros_object_format="elf_x86_64"
1059 aros_flavour="standalone"
1060 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
1061 aros_config_cflags="$aros_config_cflags -mcmodel=large -fno-asynchronous-unwind-tables -mno-red-zone -fno-omit-frame-pointer"
1062 aros_kernel_ldflags=""
1063 aros_nominal_width=640
1064 aros_nominal_height=480
1065 case "$aros_target_variant" in
1067 ENABLE_EXECSMP="#define __AROSEXEC_SMP__"
1072 AC_MSG_ERROR("Unknown native CPU -- $target_cpu")
1078 aros_target_arch="prep"
1079 aros_shared_default="no"
1080 aros_target_cpu="ppc"
1081 aros_object_format="elf32ppc"
1082 aros_flavour="ppcnative"
1083 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1084 aros_kernel_ldflags=""
1085 aros_nominal_width=640
1086 aros_nominal_height=480
1087 gcc_target_cpu="ppc"
1091 aros_target_arch="freebsd"
1092 aros_target_family="unix"
1093 aros_target_cpu="i386"
1094 aros_flavour="emulation"
1095 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1096 gcc_target_cpu="i386"
1098 aros_target_strip_flags="-x"
1102 aros_target_arch="darwin"
1103 aros_target_family="unix"
1104 aros_flavour="emulation"
1105 case "$target_cpu" in
1107 aros_ios_platform="iPhoneSimulator"
1108 aros_target_cpu="i386"
1109 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1110 aros_kernel_ldflags=""
1111 aros_macosx_version="10.4"
1112 aros_nominal_depth=8
1113 gcc_target_cpu="i386"
1114 aros_object_format="elf_i386"
1115 aros_kernel_ar_flags="-cr"
1116 aros_target_strip_flags="-x"
1117 kernel_tool_flags="-m32"
1120 aros_target_cpu="x86_64"
1121 aros_object_format="elf_x86_64"
1122 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
1123 aros_macosx_version="10.6"
1124 aros_config_cflags="$aros_config_cflags -fno-omit-frame-pointer"
1125 aros_kernel_cflags="-m64"
1126 aros_kernel_ldflags="-m64"
1127 aros_target_cflags="-mcmodel=large"
1128 aros_nominal_depth=8
1130 aros_kernel_ar_flags="-cr"
1133 aros_kernel_ranlib="ranlib"
1135 aros_kernel_strip="strip"
1136 kernel_tool_prefix="i686-apple-darwin10-"
1139 aros_target_cpu="ppc"
1140 aros_object_format="elf32ppc"
1141 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1142 aros_kernel_ldflags=""
1143 aros_macosx_version="10.0"
1144 aros_nominal_depth=8
1145 gcc_target_cpu="ppc"
1147 aros_kernel_ar_flags="-cr"
1148 aros_kernel_ld="ld -arch ppc"
1149 aros_kernel_as="as -arch ppc"
1150 aros_kernel_ranlib="ranlib -arch ppc"
1151 aros_kernel_nm="nm -arch ppc"
1152 aros_kernel_strip="strip -arch ppc"
1153 kernel_tool_prefix="powerpc-apple-darwin10-"
1156 aros_ios_platform="iPhoneOS"
1157 aros_target_cpu="arm"
1158 aros_object_format="armelf_aros"
1159 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
1160 aros_arch_libs="-laeabi"
1161 aros_nominal_depth=8
1162 gcc_target_cpu="arm"
1164 aros_kernel_ar_flags="-cr"
1165 aros_kernel_ld="ld -arch arm"
1166 aros_kernel_ranlib="ranlib -arch arm"
1167 kernel_tool_prefix="arm-apple-darwin10-"
1168 export PATH="$aros_xcode_path/Platforms/$aros_ios_platform.platform/Developer/usr/bin:$PATH"
1171 AC_MSG_ERROR("Unsupported target CPU for darwin hosted flavour -- $target_cpu")
1174 case "$aros_target_variant" in
1176 aros_ios_version="3.0"
1177 aros_nominal_width=320
1178 aros_nominal_height=480
1179 aros_ios_sdk="$aros_xcode_path/Platforms/$aros_ios_platform.platform/Developer/SDKs/$aros_ios_platform$aros_sdk_version.sdk"
1180 kernel_tool_flags="$target_tool_flags -isysroot $aros_ios_sdk"
1181 aros_kernel_includes="-isystem $aros_ios_sdk/usr/include"
1183 # This is here because it may depend on iOS or SDK version
1184 aros_kernel_cflags="$aros_kernel_cflags -miphoneos-version-min=$aros_ios_version"
1185 aros_kernel_ldflags="$aros_kernel_ldflags -miphoneos-version-min=$aros_ios_version"
1186 aros_kernel_objcflags="-fobjc-abi-version=2 -fobjc-legacy-dispatch"
1189 aros_kernel_cflags="$aros_kernel_cflags -mmacosx-version-min=$aros_macosx_version"
1190 aros_kernel_ldflags="$aros_kernel_ldflags -mmacosx-version-min=$aros_macosx_version"
1196 aros_target_arch="dragonfly"
1197 aros_target_family="unix"
1198 aros_flavour="emulation"
1199 case "$target_cpu" in
1201 aros_target_cpu="i386"
1202 aros_object_format="elf_i386"
1203 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__DragonFly__"
1206 aros_config_cflags="$aros_config_cflags -fno-omit-frame-pointer"
1207 aros_target_cpu="x86_64"
1208 aros_object_format="elf_x86_64"
1209 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64 -D__DragonFly__"
1212 AC_MSG_ERROR("Unknown CPU for DragonFly -- $target_cpu")
1218 aros_target_arch="netbsd"
1219 aros_target_family="unix"
1220 case "$target_cpu" in
1222 aros_target_cpu="m68k"
1223 aros_object_format="m68kelf"
1224 aros_flavour="emulcompat"
1225 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D__mc68000 -D__NetBSD__"
1226 gcc_target_cpu="mc68000"
1229 aros_target_cpu="i386"
1230 aros_object_format="elf_i386"
1231 aros_flavour="emulation"
1232 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__NetBSD__"
1233 aros_nominal_depth=8
1234 gcc_target_cpu="i386"
1237 AC_MSG_ERROR("Unknown CPU for NetBSD -- $target_cpu")
1240 aros_target_genmap="-Wl,-M -Xlinker >"
1241 aros_flavour="emulation"
1242 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1246 aros_target_arch="openbsd"
1247 aros_target_family="unix"
1248 case "$target_cpu" in
1250 aros_target_cpu="i386"
1251 aros_object_format="elf_i386"
1252 aros_flavour="emulation"
1253 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__OpenBSD__"
1254 gcc_target_cpu="i386"
1257 AC_MSG_ERROR("Unknown CPU for OpenBSD -- $target_cpu")
1260 aros_target_genmap="-Wl,-M -Xlinker >"
1261 aros_target_nm_flags="-u"
1262 aros_flavour="emulation"
1266 aros_target_arch="solaris"
1267 aros_target_family="unix"
1268 case "$target_cpu" in
1270 aros_target_cpu="i386"
1271 aros_object_format="elf_i386"
1272 aros_flavour="emulation"
1273 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__Solaris__"
1274 aros_nominal_depth=8
1275 gcc_target_cpu="i386"
1278 aros_target_cpu="sparc"
1279 aros_object_format="elf_sparc"
1280 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dsparc -D__Solaris__"
1281 gcc_target_cpu="sparc"
1284 AC_MSG_ERROR("Unknown CPU for Solaris -- $target_cpu")
1287 aros_config_cflags="$aros_config_cflags -D$aros_target_cpu"
1288 aros_flavour="emulation"
1292 aros_target_arch="morphos"
1293 aros_shared_default="no"
1294 aros_target_cpu="ppc"
1295 aros_object_format="elf_ppc"
1296 aros_flavour="nativecompat"
1297 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1298 gcc_target_cpu="ppc"
1302 aros_target_arch="sam440"
1303 aros_shared_default="no"
1304 aros_target_cpu="ppc"
1305 aros_object_format="elf32ppc"
1306 aros_flavour="ppcnative"
1307 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1308 aros_kernel_ldflags=""
1309 aros_nominal_width=1024
1310 aros_nominal_height=768
1311 aros_nominal_depth=24
1312 aros_config_cflags="$aros_config_cflags -mcpu=440fp -mno-toc -fno-asynchronous-unwind-tables"
1313 gcc_target_cpu="powerpc"
1317 aros_target_arch="efika"
1318 aros_shared_default="no"
1319 aros_target_cpu="arm"
1320 aros_object_format="armelf_aros"
1321 aros_flavour="standalone"
1322 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
1323 aros_kernel_ldflags=""
1324 aros_nominal_width=1024
1325 aros_nominal_height=600
1326 aros_arch_libs="-laeabi"
1327 gcc_default_cpu="armv7-a"
1328 gcc_default_fpu="vfpv3"
1329 aros_config_cflags="$aros_config_cflags -mtune=cortex-a8 -fno-strict-aliasing -fno-asynchronous-unwind-tables"
1330 aros_config_aflags="$aros_config_aflags -mtune=cortex-a8 -fno-strict-aliasing -fno-asynchronous-unwind-tables"
1331 aros_optimization_cflags="$aros_optimization_cflags -Os"
1332 case "$target_cpu" in
1334 gcc_default_float_abi="hard"
1339 gcc_default_float_abi="softfp"
1342 AC_MSG_ERROR("Unknown CPU for EfikaMX $target_cpu")
1348 aros_target_arch="chrp"
1349 aros_shared_default="no"
1350 aros_target_cpu="ppc"
1351 aros_object_format="elf32ppc"
1352 aros_flavour="ppcnative"
1353 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1354 aros_kernel_ldflags=""
1355 aros_nominal_width=640
1356 aros_nominal_height=480
1357 aros_config_cflags="$aros_config_cflags -mno-toc -fno-asynchronous-unwind-tables"
1358 gcc_target_cpu="powerpc"
1359 case "$aros_target_variant" in
1361 aros_config_cflags="$aros_config_cflags -DBIG_ENDIAN_OHCI=1 -mcpu=603e"
1367 aros_flavour="standalone"
1368 aros_target_arch="raspi"
1369 aros_target_cpu="arm"
1370 aros_object_format="armelf_aros"
1371 aros_shared_default="no"
1372 aros_arch_libs="-laeabi"
1374 gcc_default_cpu="armv6zk"
1375 gcc_default_cpu_tune="arm1176jzf-s"
1377 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
1378 aros_config_cflags="$aros_config_cflags -marm -Wno-error -fno-asynchronous-unwind-tables -fno-exceptions"
1379 aros_config_aflags="$aros_config_aflags -marm -Wno-error -fno-asynchronous-unwind-tables -fno-exceptions"
1380 aros_kernel_cflags="$aros_kernel_cflags -marm -Wno-error -fno-asynchronous-unwind-tables -fno-exceptions"
1381 aros_target_cflags="$aros_kernel_cflags -marm -Wno-error -fno-asynchronous-unwind-tables -fno-exceptions"
1382 case "$aros_target_variant" in
1384 ENABLE_EXECSMP="#define __AROSEXEC_SMP__"
1390 aros_flavour="standalone"
1391 aros_target_arch="stm32f7_discovery"
1392 aros_target_cpu="arm"
1393 aros_target_cpu_mode="thumb2"
1394 aros_object_format="armelf_aros"
1395 aros_shared_default="no"
1397 # stm32f7 has DSP opcode support
1398 gcc_default_cpu="armv7e-m"
1399 # gcc_default_cpu="armv7-m"
1400 gcc_default_cpu_tune="cortex-m7"
1401 gcc_default_fpu="fpv4-sp-d16"
1402 # GCC does not recognize fpv5-sp-d16 which should be the correct one to use, or not...
1403 # gcc_default_fpu="fpv5-sp-d16"
1404 gcc_default_float_abi="hard"
1406 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dthumb"
1410 aros_target_arch="amiga"
1411 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D_AMIGA -DAMIGA"
1412 aros_shared_default="no"
1414 case "$target_cpu" in
1416 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")
1418 aros_target_cpu="m68k"
1419 aros_object_format="m68kelf"
1420 aros_flavour="standcompat"
1421 gcc_target_cpu="m68000"
1422 aros_config_cflags="$aros_config_cflags -fno-strict-aliasing -ffreestanding -fomit-frame-pointer -fbuiltin -Wno-volatile-register-var -DNOLIBINLINE"
1423 aros_optimization_cflags="$aros_optimization_cflags -Os"
1424 aros_config_aflags="$aros_config_aflags"
1425 aros_target_strip_flags="-R.comment --strip-debug"
1426 aros_nominal_width=640
1427 aros_nominal_height=256
1428 aros_nominal_depth=2
1432 aros_flavour="native"
1433 gcc_target_cpu="ppc"
1436 AC_MSG_ERROR("Unknown CPU for Amiga $target_cpu")
1442 aros_target_arch="mingw32"
1443 aros_shared_default="no"
1444 aros_flavour="emulation"
1445 aros_shared_cflags=""
1446 need_crosstools="yes"
1449 case "$target_cpu" in
1451 aros_target_cpu="i386"
1452 aros_object_format="elf_i386"
1453 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1454 aros_nominal_depth=8
1455 gcc_target_cpu="i386"
1457 kernel_tool_prefix="i386-mingw32-"
1460 aros_target_cpu="x86_64"
1461 aros_object_format="elf_x86_64"
1462 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
1463 aros_config_cflags="$aros_config_cflags -fno-omit-frame-pointer"
1464 aros_nominal_depth=8
1465 kernel_tool_prefix="x86_64-w64-mingw32-"
1468 aros_target_cpu="arm"
1469 aros_object_format="armelf_aros"
1470 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
1471 aros_arch_libs="-laeabi"
1472 aros_nominal_depth=8
1473 gcc_target_cpu="arm"
1474 gcc_default_float_abi="soft"
1475 kernel_tool_prefix="arm-mingw32ce-"
1476 aros_nominal_width=160
1477 aros_nominal_height=160
1480 AC_MSG_ERROR("Unknown CPU for Mingw32 -- $target_cpu")
1483 if test $host_os = "cygwin"; then
1484 aros_kernel_cflags="-mno-cygwin"
1488 aros_target_arch="pp"
1489 aros_shared_default="no"
1490 case "$target_cpu" in
1492 aros_target_cpu="m68k"
1493 aros_object_format="m68kelf"
1494 aros_flavour="palmnative"
1495 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
1496 aros_nominal_width=160
1497 aros_nominal_height=160
1498 aros_nominal_depth=1
1499 aros_target_ar_flags="cru"
1500 aros_compiler_libs="-lgcc1"
1501 aros_shared_default=no
1502 aros_shared_cflags="-fpic"
1503 aros_shared_aflags=""
1504 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
1505 aros_kernel_ldflags="-Wl,-rpath,./lib"
1506 aros_debug_cflags="$aros_symbols_debug $aros_messages_debug"
1507 aros_debug_aflags=""
1508 aros_debug_ldflags="$aros_symbols_debug"
1509 aros_mungwall_debug="0"
1510 aros_modules_debug="0"
1511 gcc_target_cpu="mc68000"
1512 ignore_undefined_symbols="-ius"
1515 AC_MSG_ERROR("Unknown CPU for PalmPilot -- $target_cpu")
1521 aros_target_arch="mac"
1522 aros_shared_default="no"
1523 case "$target_cpu" in
1525 aros_target_cpu="m68k"
1526 aros_object_format="m68kelf"
1527 aros_flavour="mac68knative"
1528 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
1529 aros_nominal_width=512
1530 aros_nominal_height=384
1531 aros_nominal_depth=8
1532 aros_target_ar_flags="cru"
1533 aros_compiler_libs="-lgcc1"
1534 aros_shared_default=no
1535 aros_shared_cflags="-fpic"
1536 aros_shared_aflags=""
1537 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
1538 aros_kernel_ldflags="-Wl,-rpath,./lib"
1539 aros_debug_cflags="$aros_symbols_debug $aros_messages_debug"
1540 aros_debug_aflags=""
1541 aros_debug_ldflags="$aros_symbols_debug"
1542 aros_mungwall_debug="0"
1543 aros_modules_debug="0"
1544 gcc_target_cpu="mc68000"
1545 ignore_undefined_symbols="-ius"
1548 AC_MSG_ERROR("Unknown CPU for Mac68k -- $target_cpu")
1554 AC_MSG_ERROR([Unsupported target architecture $target])
1558 #-----------------------------------------------------------------------------
1559 crosstools_guess="yes"
1560 aros_target_toolchain="no"
1561 aros_config_sysroot=""
1562 aros_kernel_sysroot=""
1564 AC_MSG_CHECKING([Kernel toolchain prefix])
1565 AC_ARG_WITH(kernel-toolchain-prefix,AC_HELP_STRING([--with-kernel-toolchain-prefix=...],[Specify crosscompile toolchain prefix for kernel objects]),[kernel_tool_prefix="$withval"])
1566 AC_MSG_RESULT($kernel_tool_prefix)
1568 AC_MSG_CHECKING([ELF toolchain prefix])
1569 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"
1570 crosstools_guess="no"])
1571 AC_MSG_RESULT($elf_tool_prefix)
1573 AC_MSG_CHECKING([AROS toolchain prefix])
1574 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"
1575 crosstools_guess="no"])
1576 if test "$aros_tool_prefix" = "yes" ; then
1577 aros_tool_prefix=$aros_target_cpu-aros-
1579 AC_MSG_RESULT($aros_tool_prefix)
1581 #-----------------------------------------------------------------------------
1582 # Checking if we should build crosstools..
1583 AC_MSG_CHECKING([whether to build crosstools])
1584 AC_ARG_ENABLE(crosstools,AC_HELP_STRING([--disable-crosstools],[Do not build cross-compiler toolchain]),crosstools="$enableval",crosstools="$crosstools_guess")
1585 AC_MSG_RESULT($crosstools)
1587 if test "${crosstools}" = "yes"; then
1588 if test "${crosstools_guess}" = "no"; then
1589 AC_MSG_ERROR([Cannot build external toolchain if an external ELF or AROS toolchain is specified])
1593 if test "${crosstools}" = "yes" || test "${crosstools_guess}" = "no"; then
1594 aros_target_toolchain="yes"
1597 AC_MSG_CHECKING([where to install the crosstools binaries])
1598 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])
1599 if test "x$aros_toolchain_install" = "x"; then
1600 AROS_CROSSTOOLSDIR="$AROS_BUILDDIR_UNIX/bin/$aros_host_arch-$aros_host_cpu/tools/crosstools"
1602 AROS_CROSSTOOLSDIR="$aros_toolchain_install"
1603 PATH="$AROS_CROSSTOOLSDIR:$PATH"
1604 if test "$crosstools_guess" = "no" ; then
1605 toolchain_needs_sysroot=yes
1607 if test "x-$aros_flavour" != "x-emulation" -a "x-$aros_flavour" != "x-emulcompat" ; then
1608 aros_kernel_sysroot = $aros_config_sysroot
1612 AC_MSG_RESULT($AROS_CROSSTOOLSDIR)
1614 AC_MSG_CHECKING([If we need to use --sysroot])
1615 if test "$toolchain_needs_sysroot" = "yes" ; then
1616 aros_config_sysroot="--sysroot $AROS_BUILDDIR_UNIX/bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/AROS/Development"
1618 AC_MSG_RESULT($toolchain_needs_sysroot)
1620 #-----------------------------------------------------------------------------
1621 AC_MSG_CHECKING([what specific target binutils version to use])
1622 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="")
1623 if test "$use_binutils_version" = ""; then
1624 target_binutils_version="$default_binutils_version"
1626 target_binutils_version="$use_binutils_version"
1628 AC_MSG_RESULT($target_binutils_version)
1631 # Helper to identify gcc version
1632 AC_DEFUN([CROSS_GCC_VERSION], [
1633 target_gcc_version=""
1634 AC_CACHE_CHECK([gcc version],[ax_cv_gcc_version],[
1635 ax_cv_gcc_version="`$AROS_CROSSTOOLSDIR/${aros_tool_prefix}${toolchain_cpp_preprocessor} -dumpversion`"
1636 AS_IF([test "x$ax_cv_gcc_version" = "x"],[
1637 ax_cv_gcc_version=""
1640 target_gcc_version=$ax_cv_gcc_version
1641 AC_SUBST([target_gcc_version])
1644 #-----------------------------------------------------------------------------
1645 AC_MSG_CHECKING([what specific target gcc version to use])
1646 AC_ARG_WITH(gcc-version,AC_HELP_STRING([--with-gcc-version=VERSION],[Use gcc-VERSION for building AROS]),use_gcc_version="$withval",use_gcc_version="")
1647 if test "$use_gcc_version" = ""; then
1648 if test "${crosstools}" = "no"; then
1649 if test "x$aros_toolchain_install" != "x"; then
1653 if test "$use_gcc_version" = ""; then
1654 target_gcc_version="$default_gcc_version"
1657 target_gcc_version="$use_gcc_version"
1659 AC_MSG_RESULT($target_gcc_version)
1661 GCC_VERSION_MAJOR=$(echo $target_gcc_version | cut -d'.' -f1)
1662 GCC_VERSION_MINOR=$(echo $target_gcc_version | cut -d'.' -f2)
1663 GCC_VERSION_PATCH=$(echo $target_gcc_version | cut -d'.' -f3)
1665 gcc_fix_bitfields="false"
1666 if test "$GCC_VERSION_MAJOR" -gt "4" ; then
1667 gcc_fix_bitfields="true"
1669 if test "$GCC_VERSION_MAJOR" -gt "3" ; then
1670 if test "$GCC_VERSION_MINOR" -gt "6" ; then
1671 gcc_fix_bitfields="true"
1676 if test "$gcc_fix_bitfields" = "true" ; then
1677 case "$aros_target_cpu" in
1679 aros_kernel_cflags="$aros_kernel_cflags -mno-ms-bitfields"
1680 aros_target_cflags="$aros_target_cflags -mno-ms-bitfields"
1683 aros_kernel_cflags="$aros_kernel_cflags -mno-ms-bitfields"
1684 aros_target_cflags="$aros_target_cflags -mno-ms-bitfields"
1689 AC_MSG_CHECKING([whether to enable Objective-C suppport])
1690 AC_ARG_ENABLE(objc,AC_HELP_STRING([--enable-objc],[Enable Objectve-C support (default=no)]),objc="$enableval",objc="no")
1691 AC_MSG_RESULT($objc)
1692 if test "x$objc" = "xyes"; then
1695 objc_target="no-objc"
1698 AC_MSG_CHECKING([whether to enable Java suppport])
1699 AC_ARG_ENABLE(java,AC_HELP_STRING([--enable-java],[Enable Java support (default=no)]),java="$enableval",java="no")
1700 AC_MSG_RESULT($java)
1701 if test "x$java" != "xno"; then
1704 java_target="no-java"
1707 spec_obj_format="-m $aros_object_format"
1708 # Now process extra architecture-specific options.
1709 # Currently this is implemented only for ARM. We can specify which minimum CPU and FPU to use,\
1710 # as well as floating-point ABI.
1711 case "$aros_target_cpu" in
1713 dnl x86_64 can build 32 or 64bit code
1714 spec_obj_format="%{!m32:-m elf_x86_64} %{m32:-m elf_i386}"
1717 dnl ARM defaults are: armv6 + vfp (unless overriden in per-target section above)
1718 if test "$gcc_default_cpu" = ""; then
1719 gcc_default_cpu="armv6"
1721 if test "$gcc_default_fpu" = ""; then
1722 gcc_default_fpu="vfp"
1724 if test "$gcc_default_float_abi" = ""; then
1725 if test "$target_cpu" = "armhf"; then
1726 gcc_default_float_abi="hard"
1728 gcc_default_float_abi="softfp"
1732 AC_MSG_CHECKING([Which minimum CPU to use])
1733 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)
1734 AC_MSG_RESULT($aros_gcc_cpu)
1736 AC_MSG_CHECKING([Which minimum FPU to use])
1737 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)
1738 AC_MSG_RESULT($aros_gcc_fpu)
1740 AC_MSG_CHECKING([Which floating point ABI to use])
1741 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)
1742 AC_MSG_RESULT($aros_gcc_float_abi)
1744 AC_MSG_CHECKING([Which ARM mode to use])
1745 if test "$aros_target_cpu_mode" = ""; then
1746 aros_target_cpu_mode="arm32"
1747 AC_MSG_RESULT([Defaulting to $aros_target_cpu_mode])
1749 AC_MSG_RESULT([$aros_target_cpu_mode])
1752 case "$aros_target_cpu_mode" in
1754 gcc_default_mode="arm"
1755 aros_isa_flags="-m$gcc_default_mode -mthumb-interwork -march=$aros_gcc_cpu -mfpu=$aros_gcc_fpu -mfloat-abi=$aros_gcc_float_abi"
1758 AC_MSG_ERROR([ARM 64-bit mode is unsupported])
1761 AC_MSG_ERROR([Thumb1 16-bit mode is unsupported])
1764 AC_MSG_ERROR([Thumb1 16-bit mode is unsupported])
1767 gcc_default_mode="thumb"
1768 # Do not specify -mthumb-interwork as it may add extra code to support arm/thumb interwork
1769 aros_isa_flags="-m$gcc_default_mode -march=$aros_gcc_cpu -mfpu=$aros_gcc_fpu -mfloat-abi=$aros_gcc_float_abi"
1772 AC_MSG_ERROR([Unsupported ARM mode specified $aros_target_cpu_mode])
1776 aros_config_cflags="$aros_config_cflags -fno-asynchronous-unwind-tables -fno-exceptions"
1777 aros_config_aflags="$aros_config_aflags -fno-asynchronous-unwind-tables -fno-exceptions"
1780 aros_isa_flags="-m32 -march=i486"
1781 aros_kernel_cflags="$aros_kernel_cflags $aros_isa_flags"
1782 aros_kernel_ldflags="$aros_kernel_ldflags -m32"
1786 # Some architectures may need custom ELF specs.
1787 if test -f $SRCDIR/config/${aros_object_format}-specs.in; then
1788 elf_specs_in=config/${aros_object_format}-specs.in
1790 elf_specs_in=config/elf-specs.in
1793 # Some compilers (ppc-elf-gcc is known to) have CPU defines in specs
1794 # Since we override specs, we may need to put these defines there
1795 if test "$gcc_target_cpu" != ""; then
1796 gcc_target_cpu="-D__${gcc_target_cpu}__"
1799 AC_MSG_CHECKING([where to download sourcecode for external ports])
1800 AC_ARG_WITH(portssources,AC_HELP_STRING([--with-portssources=DIR],[Where to download sourcecode for external ports]),with_portssrcdir=$withval,with_portssrcdir="default")
1801 if test "$with_portssrcdir" = "default"; then
1802 AROS_PORTSSRCDIR="$AROS_BUILDDIR_UNIX/bin/Sources"
1804 AROS_PORTSSRCDIR="$with_portssrcdir"
1806 AC_MSG_RESULT($AROS_PORTSSRCDIR)
1808 AC_MSG_CHECKING([which bootloader to use])
1809 AC_ARG_WITH(bootloader,AC_HELP_STRING([--with-bootloader=NAME],[Use a specific bootloader]),target_bootloader=$withval,target_bootloader=$target_bootloader)
1810 if test "$target_bootloader" = "none"; then
1811 aros_target_bootloader=""
1813 aros_target_bootloader="$target_bootloader"
1815 AC_MSG_RESULT($target_bootloader)
1817 AC_MSG_CHECKING([which icon-set to use])
1818 AC_ARG_WITH(iconset,AC_HELP_STRING([--with-iconset=NAME],[Use a specific Icon-set (default=Gorilla).]),target_iconset=$withval,target_iconset="default")
1819 if test "$target_iconset" = "default"; then
1820 aros_target_iconset="Gorilla"
1821 target_iconset="default (Gorilla)"
1823 aros_target_iconset="$target_iconset"
1825 AC_MSG_RESULT($target_iconset)
1827 AC_MSG_CHECKING([which GUI Theme to use])
1828 AC_ARG_WITH(theme,AC_HELP_STRING([--with-theme=NAME],[Use a specific GUI Theme]),target_guitheme=$withval,target_guitheme="default")
1829 if test "$target_guitheme" = "default"; then
1830 aros_target_guitheme="Ice"
1832 aros_target_guitheme="$target_guitheme"
1834 AC_MSG_RESULT($aros_target_guitheme)
1836 # Find out if we are cross-compiling (i.e. if we can't use the host compiler
1840 dnl The first case is simple. If we are compiling for another CPU, we are cross-compiling for sure
1841 if test "$aros_host_cpu" != "$aros_target_cpu" ; then
1845 dnl x86-64 toolchains can also produce i386 binaries, given -m32 flag.
1846 dnl The flag itself is given in per-target section, because some targets require to pass it
1847 dnl in a different manner, otherwise some tests fail.
1848 dnl TODO: Justify this.
1849 if test "$aros_host_cpu" == "x86_64" ; then
1850 if test "$aros_target_cpu" == "i386" ; then
1855 if test "x-$aros_flavour" = "x-emulation" -o "x-$aros_flavour" = "x-emulcompat" ; then
1856 dnl For a hosted build we are cross-compiling if host OS differs from build OS.
1857 dnl TODO: This might get a little bit more tricky if we ever cross-compile ARM-Android-hosted
1858 dnl AROS on ARM Linux, or even vice versa (Linux-hosted ARM AROS building on ARM Android).
1859 dnl ARM ABIs of Linux and Android are not compatible (despite very close), so host_cc can't be
1860 dnl used to build bootstrap for target arch in either case.
1861 dnl For us Android is not a separate OS, but a variant of Linux, so both systems will be
1862 dnl identified as 'linux'. If this ever involves, we'll have to implement some additional check,
1863 dnl perhaps introducing aros_host_variant
1864 if test "$aros_host_arch" != "$aros_target_arch" ; then
1868 dnl For a native build we only care if our host_cc can produce static ELF files. If so, we can use
1869 dnl it as kernel_cc. If not, (e. g. we are on Windows or Darwin), we need a crosscompiler.
1870 if test "$host_cc_elf" = "no" ; then
1875 if test "$cross_compiling" = "no" ; then
1876 kernel_tool_prefix=""
1877 if test "$host_cc_elf" = "yes" ; then
1882 if test "$kernel_tool_version" != ""; then
1883 kernel_tool_version="-$kernel_tool_version"
1886 #######################################################################
1887 ## Compute what toolchains to use, and their paths ##
1888 #######################################################################
1890 # This takes, as input:
1891 # crosstools {yes,no}
1892 # kernel_tool_version {"",[version]}
1893 # target_tool_version {"",[version]}
1894 # kernel_tool_prefix {none,[some-arch-os-]}
1896 # target_tool_prefix ${aros_target_cpu}-aros-
1897 # aros_tool_prefix ${aros_target_cpu}-aros-
1900 # aros_kernel_{cpp,cc,ar,ld,as,ranlib,nm,strip}
1901 # Where the 'kernel' binaries are located
1902 # orig_target_{cpp,cc,ar,ld,as,ranlib,nm,strip}
1903 # Where the 'target' binaries are located
1904 # (not the symlink farm - that is aros_target_*!)
1907 # if crosstools then
1908 # if kernel_tools_prefix = "no-kernel-prefix-"
1909 # aros_kernel_* = crosstools cc paths
1910 # aros_kernel_cc = elf cc wrapper around crosstools cc
1912 # VALIDATE(${kernel_tools_prefix}*)
1913 # aros_kernel_* = ${kernel_tools_prefix}*
1914 # if ${kernel_tools_prefix}cc is an AROS gcc
1915 # aros_kernel_cc = ${kernel_tools_prefix}cc
1917 # aros_kernel_cc = elf cc wrapper around ${kernel_tools_prefix}cc
1921 # orig_target_* = aros built crosstools
1922 # orig_target_cc = elf cc wrapper around crosstools cc
1924 # VALIDATE(${kernel_tools_prefix}*)
1926 # orig_target_* = aros_kernel_*
1927 # if aros_kernel_cc is an AROS gcc
1928 # orig_target_cc = aros_kernel_cc
1930 # orig_target_cc = aros cc wrapper around aros_kernel_cc
1934 if test "$aros_toolchain" = "gnu" ; then
1935 target_tool_prefix="${aros_target_cpu}-aros-"
1936 elif test "$aros_toolchain" = "llvm" ; then
1937 target_tool_prefix="bin/"
1940 AC_MSG_CHECKING([which kernel tools])
1941 AC_MSG_RESULT([$kernel_tool_prefix]);
1943 if test "$kernel_tool_prefix" = "none" ; then
1944 dnl ELF wrapper can be used only for native bootstrap
1945 if test "x-$aros_flavour" = "x-emulation" -o "x-$aros_flavour" = "x-emulcompat" ; then
1946 AC_MSG_ERROR([--with-kernel-toolchain-prefix= is required for this arch])
1949 # Kernel tools required - find them
1950 # Note that 'normally', aros_kernel_* overrides will be
1951 # empty, unless specified in the per-arch sections above.
1952 if test "x$aros_kernel_cpp" = "x"; then
1953 aros_kernel_cpp=${kernel_tool_prefix}${CPP}
1955 AROS_TOOL_KERNEL(aros_kernel_cpp,cpp,$aros_kernel_cpp${kernel_tool_version})
1956 AROS_REQUIRED(cpp,$aros_kernel_cpp)
1957 if test "x$aros_kernel_cc" = "x"; then
1958 aros_kernel_cc=${kernel_tool_prefix}${CC}
1960 AROS_TOOL_KERNEL(aros_kernel_cc,cc,$aros_kernel_cc${kernel_tool_version})
1961 AROS_REQUIRED(cc,$aros_kernel_cc)
1962 if test "x$aros_kernel_cxx" = "x"; then
1963 aros_kernel_cxx=${kernel_tool_prefix}${CXX}
1965 AROS_TOOL_KERNEL(aros_kernel_cxx,cxx,$aros_kernel_cxx${kernel_tool_version})
1966 # If it's set, make sure it's really there
1967 if test "x$aros_kernel_cxx" != "x" ; then
1968 AROS_REQUIRED(cxx,$aros_kernel_cxx)
1970 AROS_TOOL_KERNEL(aros_kernel_ld,ld,$aros_kernel_ld)
1971 AROS_REQUIRED(ld,$aros_kernel_ld)
1972 AROS_TOOL_KERNEL(aros_kernel_as,as,$aros_kernel_as)
1973 AROS_REQUIRED(as,$aros_kernel_as)
1974 AROS_TOOL_KERNEL(aros_kernel_ar,ar,$aros_kernel_ar)
1975 AROS_REQUIRED(ar,$aros_kernel_ar)
1976 AROS_TOOL_KERNEL(aros_kernel_ranlib,ranlib,$aros_kernel_ranlib)
1977 AROS_REQUIRED(ranlib,$aros_kernel_ranlib)
1978 AROS_TOOL_KERNEL(aros_kernel_nm,nm,$aros_kernel_nm)
1979 AROS_REQUIRED(nm,$aros_kernel_nm)
1980 AROS_TOOL_KERNEL(aros_kernel_strip,strip,$aros_kernel_strip)
1981 AROS_REQUIRED(strip,$aros_kernel_strip)
1983 # Objcopy and objdump are not required for the kernel
1984 # toolchain on many architectures.
1985 # So we'll look for them, but not make them strictly required.
1986 AROS_TOOL_KERNEL(aros_kernel_objcopy,objcopy,$aros_kernel_objcopy)
1987 AROS_TOOL_KERNEL(aros_kernel_objdump,objdump,$aros_kernel_objdump)
1988 if test "x${crosstools}" != "xyes" ; then
1989 AROS_REQUIRED(objcopy,$aros_kernel_objcopy)
1990 AROS_REQUIRED(objdump,$aros_kernel_objdump)
1994 AC_MSG_CHECKING([which target tools to use])
1995 if test "$aros_target_toolchain" = "yes"; then
1996 AC_MSG_RESULT([$target_tool_prefix])
1997 # We are building AROS crosstools
1998 tmp_tool_prefix="$AROS_CROSSTOOLSDIR/${target_tool_prefix}"
1999 orig_target_cc="${tmp_tool_prefix}${toolchain_c_compiler}${target_tool_version}"
2000 orig_target_cxx="${tmp_tool_prefix}${toolchain_cxx_compiler}${target_tool_version}"
2001 orig_target_cpp="${tmp_tool_prefix}${toolchain_cpp_preprocessor}"
2002 orig_target_ld="${tmp_tool_prefix}ld"
2003 orig_target_as="${tmp_tool_prefix}as"
2004 orig_target_ar="${tmp_tool_prefix}ar"
2005 orig_target_ranlib="${tmp_tool_prefix}ranlib"
2006 orig_target_nm="${tmp_tool_prefix}nm"
2007 orig_target_strip="${tmp_tool_prefix}strip"
2008 orig_target_objcopy="${tmp_tool_prefix}objcopy"
2009 orig_target_objdump="${tmp_tool_prefix}objdump"
2011 # Determine whether AROS or ELF tools should be used
2012 if test "$aros_tool_prefix" = "none"; then
2013 aros_tool_prefix="${elf_tool_prefix}"
2016 AC_MSG_RESULT([$aros_tool_prefix])
2017 # We are *not* building AROS crosstools - use the AROS or ELF tools
2018 AROS_TOOL_TARGET(orig_target_cpp,cpp,${aros_tool_prefix}${toolchain_cpp_preprocessor}${target_tool_version})
2019 AROS_REQUIRED(cpp,$orig_target_cpp)
2020 AROS_TOOL_TARGET(orig_target_cc,gcc,${aros_tool_prefix}${toolchain_c_compiler}${target_tool_version})
2021 AROS_REQUIRED(cc,$orig_target_cc)
2022 AROS_TOOL_TARGET(orig_target_cxx,g++,${aros_tool_prefix}${toolchain_cxx_compiler}${target_tool_version})
2023 AROS_REQUIRED(cxx,$orig_target_cxx)
2024 AROS_TOOL_TARGET(orig_target_ld,gcc,${aros_tool_prefix}ld)
2025 AROS_REQUIRED(ld,$orig_target_ld)
2026 AROS_TOOL_TARGET(orig_target_as,as,${aros_tool_prefix}as)
2027 AROS_REQUIRED(as,$orig_target_as)
2028 AROS_TOOL_TARGET(orig_target_ar,ar,${aros_tool_prefix}ar)
2029 AROS_REQUIRED(ar,$orig_target_ar)
2030 AROS_TOOL_TARGET(orig_target_ranlib,ar,${aros_tool_prefix}ranlib)
2031 AROS_REQUIRED(ranlib,$orig_target_ranlib)
2032 AROS_TOOL_TARGET(orig_target_nm,nm,${aros_tool_prefix}nm)
2033 AROS_REQUIRED(nm,$orig_target_nm)
2034 AROS_TOOL_TARGET(orig_target_strip,strip,${aros_tool_prefix}strip)
2035 AROS_REQUIRED(strip,$orig_target_strip)
2036 AROS_TOOL_TARGET(orig_target_objcopy,objcopy,${aros_tool_prefix}objcopy)
2037 AROS_REQUIRED(objcopy,$orig_target_objcopy)
2038 AROS_TOOL_TARGET(orig_target_objdump,objdump,${aros_tool_prefix}objdump)
2039 AROS_REQUIRED(objdump,$orig_target_objdump)
2042 if test "$kernel_tool_prefix" = "none" ; then
2043 # No kernel tools specified
2044 # Assume target tools == kernel tools with ELF wrapper
2045 aros_kernel_cc=$orig_target_cc
2046 aros_kernel_cxx=$orig_target_cxx
2047 aros_kernel_cpp=$orig_target_cpp
2048 aros_kernel_ld=$orig_target_ld
2049 aros_kernel_as=$orig_target_as
2050 aros_kernel_ar=$orig_target_ar
2051 aros_kernel_ranlib=$orig_target_ranlib
2052 aros_kernel_nm=$orig_target_nm
2053 aros_kernel_strip=$orig_target_strip
2054 aros_kernel_objcopy=$orig_target_objcopy
2055 aros_kernel_objdump=$orig_target_objdump
2056 use_kernel_cc_wrapper=yes
2059 # At this point, all aros_kernel_* and aros_target_*
2060 # tools should be set up correctly
2062 CC="$aros_kernel_cc $kernel_tool_flags"
2063 CPP="$aros_kernel_cpp"
2065 #-----------------------------------------------------------------------------
2067 # Find all the tools we need to compile. This could be cross-compiling
2068 # though! If that is the case we use the GNU form of the target and
2069 # simply add this to the front of the binary name. This is rather simple,
2070 # but it should work under most circumstances.
2072 # The default tools are to use the same as the host, but only if the
2073 # host and target CPU are the same. With GCC this is normally enough.
2077 aros_shared_ld="$aros_host_ld"
2079 aros_target_mkdep="$aros_host_mkdep"
2081 # The default tools executables to be linked to.
2082 if test "$rescomp" != ""; then
2083 AC_PATH_PROG(aros_kernel_rescomp,${kernel_tool_prefix}$rescomp)
2084 AROS_REQUIRED($rescomp,$aros_kernel_rescomp)
2087 # Set up the sources for the symlink farm
2088 if test "$crosstools" = "yes"; then
2089 crosstools_target=tools-crosstools
2092 aros_kernel_cc="$aros_kernel_cc $kernel_tool_flags"
2093 aros_kernel_ar="$aros_kernel_ar $aros_kernel_ar_flags"
2095 aros_hostcfg_dir="bin/${aros_host_arch}-${aros_host_cpu}/gen/host/config"
2096 aros_targetcfg_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/config"
2097 aros_inc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/AROS/Development/include/aros"
2098 aros_gendir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen"
2099 aros_geninc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/include/aros"
2100 aros_tools_dir="bin/${aros_host_arch}-${aros_host_cpu}/tools"
2101 aros_scripts_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/scripts"
2103 # aros_cc_pre is a variable that is added to the front of the compiler name
2104 # in the generated aros-gcc shell script. We need this to enable the cache
2105 # to work across cleaned builds. Also, support DISTCC using the correct
2106 # environment variable.
2109 if test "x${DISTCC}" != "x" ; then
2110 if test "x${CCACHE}" != "x" ; then
2111 aros_cc_pre="env CCACHE_PREFIX=${DISTCC} ${CCACHE} "
2113 aros_cc_pre="${DISTCC} "
2116 if test "x${CCACHE}" != "x" ; then
2117 aros_cc_pre="${CCACHE} "
2121 AC_SUBST(aros_target_nostdinc_cflags,-nostdinc)
2122 AC_SUBST(aros_target_nostartup_ldflags,-nostartfiles)
2123 AC_SUBST(aros_target_nix_ldflags,-nix)
2124 AC_SUBST(aros_target_detach_ldflags,-detach)
2125 AC_SUBST(aros_target_nostdlib_ldflags,-nostdlib)
2128 AC_SUBST(aros_toolchain)
2129 if test "$aros_target_toolchain" != "yes"; then
2130 prefix="${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-"
2131 if test "$GCC" = "yes"; then
2132 aros_target_cc_path=`$orig_target_cc -print-search-dirs | grep "programs: =" | cut -c 12-`
2135 # We do not know which c compiler version we are going to build and what we need to know
2136 # here is different for different versions so this will be set later during the
2137 # build of crosstools.
2138 if test "$aros_toolchain" = "gnu" ; then
2139 prefix="$AROS_CROSSTOOLSDIR/${aros_target_cpu}-aros-"
2140 elif test "$aros_toolchain" = "llvm" ; then
2141 prefix="$AROS_CROSSTOOLSDIR/bin/"
2143 aros_target_cc_path=@aros_target_cc_path@
2145 aros_target_cpp="${prefix}${toolchain_cpp_preprocessor}"
2146 aros_target_cc="${prefix}${toolchain_c_compiler}"
2147 aros_target_cxx="${prefix}${toolchain_cxx_compiler}"
2148 aros_target_as="${prefix}as"
2149 aros_target_ld="${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-ld"
2150 aros_target_ar="${prefix}ar $aros_target_ar_flags"
2151 aros_target_objcopy="${prefix}objcopy"
2152 aros_target_objdump="${prefix}objdump"
2153 aros_target_ranlib="${prefix}ranlib $aros_target_ranlib_flags"
2154 aros_target_nm="${prefix}nm $aros_target_nm_flags"
2155 aros_target_strip="${prefix}strip"
2156 aros_plain_nm="${prefix}nm"
2157 aros_plain_ar="${prefix}ar"
2159 AC_ARG_ENABLE(includes,
2160 AC_HELP_STRING([--enable-includes=dir],[Alternative system include directory]),
2161 [aros_target_incl=$enable_includes], [aros_target_incl=`$aros_kernel_cc -print-sysroot`/`$aros_kernel_cc --print-sysroot-headers-suffix 2>/dev/null || echo usr/include`])
2163 if test "$aros_kernel_includes" = ""; then
2164 if test "x-$aros_flavour" = "x-emulation" -o "x-$aros_flavour" = "x-emulcompat" ; then
2165 aros_kernel_includes="-isystem $aros_target_incl"
2169 if test "$aros_kernel_includes" != "" ; then
2170 dnl find out about the kernel cc's include path
2171 AC_MSG_CHECKING([for the kernel compiler's include path])
2172 if test "$aros_kernel_cc_includes" = "" ; then
2173 # Try to guess where the directory is.
2174 aros_kernel_cc_includes=`dirname \`${aros_kernel_cc} ${aros_kernel_cflags} -print-libgcc-file-name\``/include
2175 if test -d $aros_kernel_cc_includes; then
2176 # Check if there is also an include-fixed directory and add it
2177 # to kernel compiler's include path as it may contain some of
2178 # the headers we need.
2179 if test -d "$aros_kernel_cc_includes"-fixed; then
2180 aros_kernel_cc_includes+=" -isystem $aros_kernel_cc_includes"-fixed
2182 # Check for specific includes directory. Needed for Ubuntu 11.10 and Debian
2188 host_cpu_glibc=${host_cpu}
2191 if test -d "/usr/include/${host_cpu_glibc}-linux-gnu"; then
2192 aros_kernel_cc_includes+=" -isystem /usr/include/${host_cpu_glibc}-linux-gnu"
2195 # The directory doesn't exist, we need to do some more work.
2196 aros_kernel_cc_includes=${PWD}/${aros_gendir}/cc_include
2198 # These are the headers we're looking for.
2199 headers="limits.h mmintrin.h stdbool.h syslimits.h float.h \
2200 stddef.h xmmintrin.h iso646.h stdarg.h unwind.h \
2204 for h in $headers; do
2205 # Which other headers are needed by each of the above?
2206 deps=$(echo "#include <$h>" | \
2207 $aros_kernel_cc -E -M - 2>/dev/null | \
2208 sed 's/^.*://; s/\\$/ /g; s/[[ \t]]\+/ /g')
2210 # Copy all the needed headers to a directory beneath gendir.
2213 dir=${aros_kernel_cc_includes}$(echo $(dirname $d) | \
2214 sed -n "s,^.*/include\(/.*\),\1,p")
2215 ! test -d $dir && mkdir -p $dir
2216 ! test -f $dir/$h && { cp $d $dir; chmod u+w $dir/$h; }
2221 AC_MSG_RESULT($aros_kernel_cc_includes)
2222 # Adding -nostdinc to kernel includes as they are always used together.
2223 aros_kernel_includes="$aros_kernel_includes $aros_target_nostdinc_cflags -isystem $aros_kernel_cc_includes"
2226 if test "$crosstools" != "yes"; then
2227 dnl find out about the target cc's include path
2228 AC_MSG_CHECKING([for the target compiler's include path])
2229 if test "$aros_target_cc_includes" = "" ; then
2230 #try to guess where the directory is
2231 aros_target_cc_includes=`dirname \`${orig_target_cc} -print-libgcc-file-name\``/include
2232 if ! test -d $aros_target_cc_includes; then
2233 #the directory doesn't exist, we need to do some more work
2234 aros_target_cc_includes=${PWD}/${aros_gendir}/cc_include
2236 #these are the headers we're looking for
2237 headers="limits.h mmintrin.h stdbool.h syslimits.h float.h \
2238 stddef.h xmmintrin.h iso646.h stdarg.h unwind.h \
2242 for h in $headers; do
2243 #which other headers each of the above headers needs?
2244 deps=$(echo "#include <$h>" | \
2245 $orig_target_cc -E -M - 2>/dev/null | \
2246 sed 's/^.*://; s/\\$/ /g; s/[[ \t]]\+/ /g')
2248 #copy all the needed headers to a directory beneath gendir
2251 dir=${aros_target_cc_includes}$(echo $(dirname $d) | \
2252 sed -n "s,^.*/include\(/.*\),\1,p")
2253 ! test -d $dir && mkdir -p $dir
2254 ! test -f $dir/$h && { cp $d $dir; chmod u+w $dir/$h; }
2259 AC_MSG_RESULT($aros_target_cc_includes)
2261 # We do not know which c compiler version we are going to build and what we need to know
2262 # here is different for different versions so this will be set later during the
2263 # build of crosstools.
2264 aros_target_cc_includes=@aros_target_cc_includes@
2268 # For GCC < 4.0 -I- is used for giving the search path for '#include "..."'
2269 # On GCC >= 4.0 -iquote should be used
2273 save_cflags="$CFLAGS"
2275 AC_MSG_CHECKING([whether ${CC} accepts -iquote])
2276 if test "x-$crosstools" != "x-yes"; then
2277 AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
2279 # we do know it is supported for the smallest version of ${toolchain_c_compiler} we are going to build
2280 # we assume it's also supported by later versions
2283 AC_MSG_RESULT($has_iquote)
2284 if test "x-$has_iquote" = "x-yes" ; then
2285 host_cflags_iquote=-iquote
2286 host_cflags_iquote_end=
2288 host_cflags_iquote=-I
2289 host_cflags_iquote_end=-I-
2291 kernel_cflags_iquote=$host_cflags_iquote
2292 kernel_cflags_iquote_end=$host_cflags_iquote_end
2293 if test "x-$cross_compiling" = "x-yes"; then
2294 CC="$aros_kernel_cc"
2295 AC_MSG_CHECKING([whether ${CC} accepts -fno-stack-protector])
2296 if test "x-$crosstools" != "x-yes"; then
2297 AC_TRY_COMPILE(,, use_no_stack_protector="yes", use_no_stack_protector="no")
2299 # we do know it is supported for the smallest version of gcc we are going to build
2300 # we assume it's also supported by later versions
2301 use_no_stack_protector=yes
2303 AC_MSG_RESULT($use_no_stack_protector)
2304 AC_MSG_CHECKING([whether ${CC} accepts -iquote])
2305 if test "x-$crosstools" != "x-yes"; then
2306 AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
2308 # we do know it is supported for the smallest version of gcc we are going to build
2309 # we assume it's also supported by later versions
2312 AC_MSG_RESULT($has_iquote)
2313 if test "x-$has_iquote" = "x-yes" ; then
2314 kernel_cflags_iquote=-iquote
2315 kernel_cflags_iquote_end=
2317 kernel_cflags_iquote=-I
2318 kernel_cflags_iquote_end=-I-
2321 aros_cflags_iquote=$kernel_cflags_iquote
2322 aros_cflags_iquote_end=$kernel_cflags_iquote_end
2323 if test "$orig_target_cc" != "$aros_kernel_cc"; then
2324 CC="$orig_target_cc"
2325 AC_MSG_CHECKING([whether ${CC} accepts -iquote])
2326 if test "x-$crosstools" != "x-yes"; then
2327 AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
2329 # we do know it is supported for the smallest version of gcc we are going to build
2330 # we assume it's also supported by later versions
2333 AC_MSG_RESULT($has_iquote)
2334 if test "x-$has_iquote" = "x-yes" ; then
2335 aros_cflags_iquote=-iquote
2336 aros_cflags_iquote_end=
2338 aros_cflags_iquote=-I
2339 aros_cflags_iquote_end=-I-
2342 if test "x-$use_no_stack_protector" = "x-yes" ; then
2343 aros_kernel_cflags="$aros_kernel_cflags -fno-stack-protector"
2346 #-----------------------------------------------------------------------------
2348 # Check if we can explicitly choose older version of symbol hashing
2350 CFLAGS="save_cflags -Wl,--hash-style=sysv"
2351 CC="$aros_kernel_cc"
2352 AC_MSG_CHECKING([whether ${CC} accepts -Wl,--hash-style=sysv])
2353 AC_TRY_LINK(,, use_hash_style="yes", use_hash_style="no")
2354 AC_MSG_RESULT($use_hash_style)
2355 if test "x-$use_hash_style" = "x-yes" ; then
2356 aros_kernel_cflags="$aros_kernel_cflags -Wl,--hash-style=sysv"
2359 CFLAGS="$save_cflags"
2361 AC_SUBST(host_cflags_iquote)
2362 AC_SUBST(host_cflags_iquote_end)
2363 AC_SUBST(kernel_cflags_iquote)
2364 AC_SUBST(kernel_cflags_iquote_end)
2365 AC_SUBST(aros_cflags_iquote)
2366 AC_SUBST(aros_cflags_iquote_end)
2369 dnl Check if user specified --with-resolution=XRESxYRESxDEPTH
2370 AC_MSG_CHECKING([for default resolution of WBScreen])
2371 AC_ARG_WITH(resolution,AC_HELP_STRING([--with-resolution=XRESxYRESxDEPTH],[Default resolution of the initial WorkbenchScreen]),resolution=$withval,resolution=none)
2372 # We require an argument, so map --with/--without ("yes"/"no") to "none" specified
2373 if test "$resolution" = "yes" ; then
2376 if test "$resolution" = "no" ; then
2379 if test "$resolution" != "none" ; then
2380 aros_nominal_width=`echo $resolution | cut -d'x' -f1`
2381 aros_nominal_height=`echo $resolution | cut -d'x' -f2`
2382 aros_nominal_depth=`echo $resolution | cut -d'x' -f3`
2384 AC_MSG_RESULT($aros_nominal_width x $aros_nominal_height x $aros_nominal_depth)
2385 aros_cv_nominal_width=$aros_nominal_width
2386 aros_cv_nominal_height=$aros_nominal_height
2387 aros_cv_nominal_depth=$aros_nominal_depth
2389 dnl See if the user wants the serial debug output for native flavour
2390 AC_MSG_CHECKING([if serial debug is enabled])
2391 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)
2392 if test "$aros_serial_debug" = 0 ; then
2393 serial_debug_forced=""
2394 if test "$serial_debug" = "yes" ; then
2397 if test "$serial_debug" = "no" ; then
2401 serial_debug_forced="(forced)"
2402 serial_debug=$aros_serial_debug
2404 if test "$serial_debug" != "none" ; then
2405 aros_serial_debug=$serial_debug
2406 AC_MSG_RESULT($serial_debug_forced on port $serial_debug)
2411 dnl See if the user wants the palm debug output hack for palm native flavour
2412 AC_MSG_CHECKING([if palm debug hack is enabled])
2413 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")
2414 if test "$palm_debug_hack" = "yes" ; then
2415 aros_palm_debug_hack="1"
2417 AC_MSG_RESULT($palm_debug_hack)
2419 dnl See if dev wants the usb3.0 code
2420 AC_MSG_CHECKING([if usb3.0 code is enabled])
2421 AC_ARG_ENABLE(usb30_code,AC_HELP_STRING([--enable-usb30-code],[Enable usb3.0 code (default=no)]),usb30_code="yes",usb30_code="no")
2422 if test "$usb30_code" = "yes" ; then
2423 aros_config_cflags="$aros_config_cflags -DAROS_USB30_CODE"
2424 aros_kernel_cflags="$aros_kernel_cflags -DAROS_USB30_CODE"
2426 AC_MSG_RESULT($usb30_code)
2428 dnl See if the user wants nesting supervisor activated for unix flavour
2429 AC_MSG_CHECKING([if nesting supervisor support is enabled])
2430 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")
2431 if test "$nesting_supervisor" = "yes" ; then
2432 aros_nesting_supervisor="1"
2434 AC_MSG_RESULT($nesting_supervisor)
2436 dnl See if the user wants to disable MMU support
2437 dnl This can be overriden on per-target basis,
2438 dnl set $aros_enable_mmu to "yes" or "no" to do this
2439 if test "$aros_enable_mmu" = "" ; then
2440 AC_MSG_CHECKING([if MMU support is enabled])
2441 dnl Enabled by default
2442 AC_ARG_ENABLE(mmu,AC_HELP_STRING([--disable-mmu],[Disable MMU support (default=enabled)]),aros_enable_mmu=$enableval,aros_enable_mmu="yes")
2443 if test "$aros_enable_mmu" = "" ; then
2444 aros_enable_mmu="yes"
2446 AC_MSG_RESULT($aros_enable_mmu)
2448 if test "$aros_enable_mmu" = "no" ; then
2455 dnl things specifically required for hosted flavours
2456 if test "x-$aros_flavour" = "x-emulation" -o "x-$aros_flavour" = "x-emulcompat" ; then
2458 if test "x-$need_dlopen" != "x-no" ; then
2461 dnl some kind of dynamic library access system is required for hostlib.resource
2462 AC_CHECK_FUNC(dlopen, have_dl="yes", have_dl="no")
2463 if test "x-$have_dl" = "x-no" ; then
2464 AC_CHECK_LIB(dl, dlopen, [have_dl="yes"
2465 aros_host_ldflags="$aros_host_ldflags -ldl"],
2468 if test "x-$have_dl" = "x-no" ; then
2469 AC_MSG_ERROR([dlopen() dynamic linker functions not available])
2476 AC_ARG_ENABLE(x11_hidd, AC_HELP_STRING([--enable-x11-hidd],
2477 [build X11 hidd for hosted (default=auto)]),
2478 x11_hidd="$enableval",
2479 x11_hidd="$need_x11")
2480 case "x-$x11_hidd" in
2481 x-yes|x-no|x-auto) ;;
2482 *) x11_hidd="$need_x11" ;;
2488 if test "x-$x11_hidd" != "x-no" ; then
2494 for path in $x_libraries
2496 x_cflags="$x_cflags -L$path"
2499 for path in $x_includes
2501 x_cflags="$x_cflags -I$path"
2504 if test "x-$no_x" = "x-yes" ; then
2507 if test "x-$x11_hidd" != "x-auto" ; then
2508 dnl and they explicitly asked for it, bail out
2509 AC_MSG_ERROR([X11 libs/headers not found, cannot build X11 hidd as requested])
2513 dnl found it, setup the metatarget
2517 dnl setup shared memory extensions
2518 AC_ARG_ENABLE(x11_shm, AC_HELP_STRING([--enable-x11-shm],
2519 [use X11 shared memory (default=auto)]),
2520 x11_hidd_shm="$enableval",
2521 x11_hidd_shm="auto")
2522 case "x-$x11_hidd_shm" in
2523 x-yes|x-no|x-auto) ;;
2524 *) x11_hidd_shm="auto" ;;
2530 if test "x-$x11_hidd_shm" != "x-no" ; then
2532 dnl system shm headers
2533 AC_CHECK_HEADERS(sys/ipc.h)
2534 AC_CHECK_HEADERS(sys/shm.h)
2537 if test "x-$ac_cv_header_sys_ipc_h" = "x-yes" -a "x-$ac_cv_header_sys_shm_h" = "x-yes" ; then
2539 dnl make sure X libs have shm functions
2540 save_cflags="$CFLAGS"
2541 CFLAGS="$CFLAGS $x_cflags"
2542 AC_CHECK_LIB(Xext, XShmQueryExtension, have_xshm=yes)
2543 CFLAGS="$save_cflags"
2547 dnl detection done, prepare output
2548 if test "x-$have_xshm" = "x-yes" ; then
2551 elif test "x-$x11_hidd_shm" = "x-yes" ; then
2552 dnl they explicitly asked for it, but we can't do it
2553 AC_MSG_ERROR([X11 has no support for shared memory, cannot enable it as requested])
2555 dnl otherwise just disable it
2560 dnl setup vidmode (fullscreen) extensions
2561 AC_ARG_ENABLE(x11_vidmode, AC_HELP_STRING([--enable-x11-vidmode],
2562 [use X11 vidmode extension (default=auto)]),
2563 x11_hidd_vidmode="$enableval",
2564 x11_hidd_vidmode="auto")
2565 case "x-$x11_hidd_vidmode" in
2566 x-yes|x-no|x-auto) ;;
2567 *) x11_hidd_vidmode="auto" ;;
2573 if test "x-$x11_hidd_vidmode" != "x-no" ; then
2575 dnl make sure X libs have vidmode functions
2576 save_cflags="$CFLAGS"
2577 CFLAGS="$CFLAGS $x_cflags"
2578 AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryExtension, have_vidmode=yes)
2579 CFLAGS="$save_cflags"
2582 dnl detection done, prepare output
2583 if test "x-$have_vidmode" = "x-yes" ; then
2584 dnl we can do vidmode
2585 DO_VIDMODE_SUPPORT="1"
2586 elif test "x-$x11_hidd_vidmode" = "x-yes" ; then
2587 dnl they explicitly asked for it, but we can't do it
2588 AC_MSG_ERROR([X11 vidmode extension not available, cannot enable it as requested])
2590 dnl otherwise just disable it
2591 DO_VIDMODE_SUPPORT="0"
2595 aros_host_x11_includes=$x_includes
2596 aros_host_x11_libdirs=$x_libraries
2601 AC_ARG_ENABLE(sdl_hidd, AC_HELP_STRING([--enable-sdl-hidd],
2602 [build SDL hidd for hosted (default=auto)]),
2603 sdl_hidd="$enableval",
2605 case "x-$sdl_hidd" in
2606 x-yes|x-no|x-auto) ;;
2607 *) sdl_hidd="auto" ;;
2611 if test "x-$sdl_hidd" != "x-no" ; then
2615 AM_PATH_SDL($SDL_VERSION, [have_sdl="yes"],
2618 if test "x-$have_sdl" != "x-yes" ; then
2621 if test "x-$sdl_hidd" != "x-auto" ; then
2622 dnl and they explicitly asked for it, bail out
2623 AC_MSG_ERROR([SDL libs/headers not found, cannot build SDL hidd as requested])
2627 dnl found it, enable the build
2629 aros_host_sdl_cflags=$SDL_CFLAGS
2630 aros_host_sdl_libs=$SDL_LIBS
2637 dnl See if the user wants dbus.library
2638 AC_MSG_CHECKING([if building of dbus.library is enabled])
2639 AC_ARG_ENABLE(dbus,AC_HELP_STRING([--enable-dbus],[Enable DBUS support via dbus.library (default=no)]),dbus="yes",dbus="no")
2640 if test "$dbus" = "yes" ; then
2642 DBUS_CFLAGS=`pkg-config --cflags dbus-1`
2643 DBUS_LIBFLAGS=`pkg-config --libs dbus-1`
2644 KERNEL_DBUS_KOBJ=kernel-dbus-kobj
2645 KERNEL_DBUS_INCLUDES=kernel-dbus-includes
2649 AC_MSG_RESULT($dbus)
2651 if test "$use_kernel_cc_wrapper" = "yes" ; then
2652 aros_kernel_cc="${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-elf-${toolchain_c_compiler}"
2655 dnl --------------------------------------------------------------------
2656 dnl Configuration Output Section
2657 dnl --------------------------------------------------------------------
2662 AC_SUBST(aros_flavour)
2663 AC_SUBST(aros_flavour_uc)
2664 AC_SUBST(aros_target_toolchain)
2665 AC_SUBST(aros_build_host)
2666 AC_SUBST(AROS_BUILDDIR)
2667 AC_SUBST(AROS_BUILDDIR_UNIX)
2669 AC_SUBST(AROS_CROSSTOOLSDIR)
2670 AC_SUBST(AROS_PORTSSRCDIR)
2672 # Compatability with other Amiga-like operation systems
2673 AC_SUBST(aros_amigaos_compliance)
2676 AC_SUBST(aros_cc_pre)
2677 AC_SUBST(aros_host_strip)
2678 AC_SUBST(aros_host_arch)
2679 AC_SUBST(aros_host_cpu)
2680 AC_SUBST(aros_host_cpp)
2681 AC_SUBST(aros_host_def_cc)
2682 AC_SUBST(aros_host_cc)
2683 AC_SUBST(aros_host_cxx)
2684 AC_SUBST(aros_host_ar)
2685 AC_SUBST(aros_host_ranlib)
2686 AC_SUBST(aros_host_ld)
2687 AC_SUBST(aros_host_make)
2688 AC_SUBST(aros_host_cflags)
2689 AC_SUBST(aros_host_cxxflags)
2690 AC_SUBST(gnu89_inline)
2691 AC_SUBST(aros_host_ldflags)
2692 AC_SUBST(aros_host_debug)
2693 AC_SUBST(aros_host_mkdep)
2694 AC_SUBST(aros_host_mkargs)
2695 AC_SUBST(aros_host_exe_suffix)
2696 AC_SUBST(aros_host_lib_suffix)
2697 AC_SUBST(aros_tools_dir)
2698 AC_SUBST(aros_host_aclocal)
2699 AC_SUBST(aros_host_autoconf)
2700 AC_SUBST(aros_host_autoheader)
2701 AC_SUBST(aros_host_automake)
2705 AC_SUBST(aros_target_guitheme)
2706 AC_SUBST(aros_target_iconset)
2707 AC_SUBST(aros_target_bootloader)
2708 AC_SUBST(aros_target_arch)
2709 AC_SUBST(aros_target_family)
2710 AC_SUBST(aros_target_cpu)
2711 AC_SUBST(aros_target_cpu_mode)
2712 AC_SUBST(aros_target_variant)
2713 AC_SUBST(aros_target_suffix)
2714 AC_SUBST(aros_target_ar)
2715 AC_SUBST(aros_target_ranlib)
2716 AC_SUBST(aros_plain_nm)
2717 AC_SUBST(aros_plain_ar)
2718 AC_SUBST(aros_kernel_ar)
2719 AC_SUBST(aros_kernel_ranlib)
2720 AC_SUBST(orig_target_cc)
2721 AC_SUBST(aros_target_cc)
2722 AC_SUBST(aros_kernel_cc)
2723 AC_SUBST(orig_target_cxx)
2724 AC_SUBST(aros_target_cxx)
2725 AC_SUBST(aros_kernel_cxx)
2726 AC_SUBST(orig_target_cpp)
2727 AC_SUBST(aros_target_cpp)
2728 AC_SUBST(aros_kernel_cpp)
2729 AC_SUBST(orig_target_as)
2730 AC_SUBST(aros_target_as)
2731 AC_SUBST(aros_kernel_as)
2732 AC_SUBST(orig_target_ld)
2733 AC_SUBST(aros_target_ld)
2734 AC_SUBST(aros_kernel_ld)
2735 AC_SUBST(aros_target_cc_includes)
2736 AC_SUBST(aros_target_cc_path)
2737 AC_SUBST(aros_target_objdump)
2738 AC_SUBST(aros_target_objcopy)
2739 AC_SUBST(aros_target_strip)
2740 AC_SUBST(aros_target_nm)
2741 AC_SUBST(aros_kernel_rescomp)
2742 AC_SUBST(aros_shared_default)
2743 AC_SUBST(aros_shared_ld)
2744 AC_SUBST(aros_object_format)
2745 AC_SUBST(spec_obj_format)
2746 AC_SUBST(aros_compiler_libs)
2747 AC_SUBST(aros_arch_libs)
2749 AC_SUBST(aros_shared_cflags)
2750 AC_SUBST(aros_shared_aflags)
2751 AC_SUBST(aros_shared_ldflags)
2753 AC_SUBST(aros_config_sysroot)
2754 AC_SUBST(aros_config_cflags)
2755 AC_SUBST(aros_config_aflags)
2756 AC_SUBST(aros_config_ldflags)
2758 AC_SUBST(aros_kernel_sysroot)
2759 AC_SUBST(aros_kernel_cflags)
2760 AC_SUBST(aros_kernel_includes)
2761 AC_SUBST(aros_kernel_objcflags)
2762 AC_SUBST(aros_kernel_ldflags)
2763 AC_SUBST(aros_target_cflags)
2764 AC_SUBST(aros_debug_cflags)
2765 AC_SUBST(aros_debug_aflags)
2766 AC_SUBST(aros_debug_ldflags)
2767 AC_SUBST(aros_target_genmap)
2768 AC_SUBST(aros_target_strip_flags)
2769 AC_SUBST(aros_optimization_cflags)
2770 AC_SUBST(aros_isa_flags)
2772 AC_SUBST(crosstools_target)
2773 AC_SUBST(crosstools_cxx_target)
2775 # Hosted Graphics Related
2776 AC_SUBST(host_x_gfx)
2777 AC_SUBST(host_sdl_gfx)
2778 AC_SUBST(host_android_gfx)
2780 AC_SUBST(pci_hidd_target)
2782 AC_SUBST(aros_nominal_width)
2783 AC_SUBST(aros_nominal_height)
2784 AC_SUBST(aros_nominal_depth)
2785 AC_SUBST(DO_XSHM_SUPPORT)
2786 AC_SUBST(DO_VIDMODE_SUPPORT)
2788 AC_SUBST(aros_host_x11_includes)
2789 AC_SUBST(aros_host_x11_libdirs)
2790 AC_SUBST(aros_host_sdl_cflags)
2791 AC_SUBST(aros_host_sdl_libs)
2793 # Native version related
2794 AC_SUBST(aros_serial_debug)
2795 AC_SUBST(ENABLE_EXECSMP)
2797 # Palm native version related
2798 AC_SUBST(aros_palm_debug_hack)
2800 # Unix/Hosted version related
2801 AC_SUBST(aros_nesting_supervisor)
2804 AC_SUBST(aros_enable_mmu)
2807 AC_SUBST(aros_ios_platform)
2808 AC_SUBST(aros_ios_version)
2809 AC_SUBST(aros_ios_sdk)
2811 # ARM default GCC target related
2812 AC_SUBST(gcc_default_cpu)
2813 AC_SUBST(gcc_default_cpu_tune)
2814 AC_SUBST(gcc_default_fpu)
2815 AC_SUBST(gcc_default_float_abi)
2816 AC_SUBST(gcc_default_mode)
2819 AC_SUBST(android_tool)
2820 AC_SUBST(aros_android_level)
2821 AC_SUBST(aros_android_antapk)
2824 AC_SUBST(ENABLE_DBUS)
2825 AC_SUBST(DBUS_CFLAGS)
2826 AC_SUBST(DBUS_LIBFLAGS)
2827 AC_SUBST(KERNEL_DBUS_KOBJ)
2828 AC_SUBST(KERNEL_DBUS_INCLUDES)
2831 AC_SUBST(ENABLE_X11)
2834 AC_SUBST(aros_debug)
2835 AC_SUBST(aros_mungwall_debug)
2836 AC_SUBST(aros_stack_debug)
2837 AC_SUBST(aros_modules_debug)
2839 # Collect-aros stuff: "-ius" to ignore undefined symbols
2840 AC_SUBST(ignore_undefined_symbols)
2842 # C compiler related
2843 AC_SUBST(gcc_target_cpu)
2844 AC_SUBST(target_binutils_version)
2845 AC_SUBST(target_gcc_version)
2847 #ObjC compiler related
2848 AC_SUBST(objc_target)
2851 AC_SUBST(java_target)
2854 AC_SUBST(aros_usb30_code)
2856 dnl Prepare for output, make up all the generated patches
2857 case "$aros_flavour" in
2858 emulation) aros_flavour_uc="AROS_FLAVOUR_EMULATION"
2859 aros_flavour="emulation" ;;
2860 emulcompat) aros_flavour_uc="(AROS_FLAVOUR_EMULATION|AROS_FLAVOUR_BINCOMPAT)"
2861 aros_flavour="emulation" ;;
2862 standalone) aros_flavour_uc="AROS_FLAVOUR_STANDALONE"
2863 aros_flavour="standalone";;
2864 standcompat) aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_BINCOMPAT)"
2865 aros_flavour="standalone";;
2866 native) aros_flavour_uc="AROS_FLAVOUR_NATIVE"
2867 aros_flavour="native" ;;
2868 nativecompat) aros_flavour_uc="(AROS_FLAVOUR_NATIVE|AROS_FLAVOUR_BINCOMPAT)"
2869 aros_flavour="native" ;;
2870 linklib) aros_flavour_uc="AROS_FLAVOUR_LINKLIB"
2871 aros_flavour="linklib" ;;
2872 palmnative) aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
2873 aros_flavour="palmnative" ;;
2874 mac68knative) aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
2875 aros_flavour="mac68knative" ;;
2876 ppcnative) aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_BINCOMPAT)"
2877 aros_flavour="ppcnative" ;;
2880 if test ! -d ${aros_inc_dir} ; then
2881 ${MKDIR} ${aros_inc_dir}
2883 if test ! -d ${aros_geninc_dir} ; then
2884 ${MKDIR} ${aros_geninc_dir}
2886 if test ! -d ${aros_hostcfg_dir} ; then
2887 ${MKDIR} ${aros_hostcfg_dir}
2889 if test ! -d ${aros_targetcfg_dir} ; then
2890 ${MKDIR} ${aros_targetcfg_dir}
2892 if test ! -d ${aros_tools_dir} ; then
2893 ${MKDIR} ${aros_tools_dir}
2895 if test ! -d ${aros_scripts_dir} ; then
2896 ${MKDIR} ${aros_scripts_dir}
2899 AC_CONFIG_HEADERS(${aros_geninc_dir}/host-conf.h:config/host-conf.h.in)
2901 # Generic build tools (metamake, etc)
2902 AC_CONFIG_COMMANDS([genmf-executable-support],
2903 [chmod a+x ${aros_tools_dir}/genmf.py],
2904 [aros_tools_dir=${aros_tools_dir}]
2909 ${aros_inc_dir}/config.h:config/config.h.in
2910 ${aros_geninc_dir}/config.h:config/config.h.in
2911 ${aros_hostcfg_dir}/host.cfg:config/host.cfg.in
2912 ${aros_targetcfg_dir}/target.cfg:config/target.cfg.in
2913 ${aros_targetcfg_dir}/build.cfg:config/build.cfg.in
2915 ${aros_targetcfg_dir}/make.defaults:config/make.defaults.in
2916 ${aros_tools_dir}/genmf.py:tools/genmf/genmf.py
2917 tools/collect-aros/env.h
2921 AC_CONFIG_COMMANDS([binutils-support],
2923 prefix=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}
2925 prefix2=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros
2927 chmod a+x ${prefix2}-ld
2929 ln -sf $orig_target_as$aros_host_exe_suffix ${prefix2}-as$aros_host_exe_suffix
2930 ln -sf $orig_target_nm$aros_host_exe_suffix ${prefix2}-nm$aros_host_exe_suffix
2931 ln -sf $orig_target_ar$aros_host_exe_suffix ${prefix2}-ar$aros_host_exe_suffix
2932 ln -sf $orig_target_ranlib$aros_host_exe_suffix ${prefix2}-ranlib$aros_host_exe_suffix
2933 ln -sf $orig_target_objcopy$aros_host_exe_suffix ${prefix2}-objcopy$aros_host_exe_suffix
2934 ln -sf $orig_target_objdump$aros_host_exe_suffix ${prefix2}-objdump$aros_host_exe_suffix
2935 ln -sf $orig_target_strip$aros_host_exe_suffix ${prefix2}-strip$aros_host_exe_suffix
2938 aros_host_exe_suffix=${aros_host_exe_suffix}
2939 aros_tools_dir=${aros_tools_dir}
2940 aros_target_cpu=${aros_target_cpu}
2941 aros_target_arch=${aros_target_arch}
2942 aros_target_suffix=${aros_target_suffix}
2943 orig_target_nm=${orig_target_nm}
2944 orig_target_as=${orig_target_as}
2945 orig_target_ar=${orig_target_ar}
2946 orig_target_ranlib=${orig_target_ranlib}
2947 orig_target_objdump=${orig_target_objdump}
2948 orig_target_objcopy=${orig_target_objcopy}
2949 orig_target_strip=${orig_target_strip}
2950 aros_kernel_ld=${aros_kernel_ld}
2954 ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-ld:scripts/aros-ld.in
2957 # Bare Elf support script and spec
2958 if test "${use_kernel_cc_wrapper}" = "yes"; then
2959 AC_CONFIG_COMMANDS([elf-compiler-support],
2961 prefix=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}
2963 prefix2=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-elf
2965 chmod a+x ${prefix2}-gcc
2967 ln -sf $aros_kernel_ld$aros_host_exe_suffix ${prefix2}-ld$aros_host_exe_suffix
2970 aros_host_exe_suffix=${aros_host_exe_suffix}
2971 aros_tools_dir=${aros_tools_dir}
2972 aros_target_cpu=${aros_target_cpu}
2973 aros_target_arch=${aros_target_arch}
2974 aros_target_suffix=${aros_target_suffix}
2975 aros_kernel_ld=${aros_kernel_ld}
2979 ${aros_targetcfg_dir}/elf-specs:${elf_specs_in}
2980 ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-elf-gcc:scripts/elf-gcc.in
2984 # Host compiler support scripts and spec
2985 if test "${aros_target_toolchain}" = "no"; then
2986 AC_CONFIG_COMMANDS([host-compiler-wrapper-support],
2988 prefix=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}
2990 prefix2=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros
2992 chmod a+x ${prefix2}-${toolchain_c_compiler} ${prefix2}-${toolchain_cxx_compiler} ${prefix2}-${toolchain_cpp_preprocessor}
2995 aros_host_exe_suffix=${aros_host_exe_suffix}
2996 aros_tools_dir=${aros_tools_dir}
2997 aros_target_cpu=${aros_target_cpu}
2998 aros_target_arch=${aros_target_arch}
2999 aros_target_suffix=${aros_target_suffix}
3003 ${aros_targetcfg_dir}/specs:config/specs.in
3004 ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-${toolchain_cpp_preprocessor}:scripts/aros-${toolchain_cpp_preprocessor}.in
3005 ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-${toolchain_c_compiler}:scripts/aros-${toolchain_c_compiler}.in
3006 ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-${toolchain_cxx_compiler}:scripts/aros-${toolchain_cxx_compiler}.in
3011 if test "$aros_target_variant" == "android"; then
3012 AC_CONFIG_FILES(${aros_gendir}/arch/all-android/bootstrap/app/default.properties:arch/all-android/bootstrap/app/default.properties.in)
3016 AC_CONFIG_FILES(${aros_targetcfg_dir}/conf.cmake:config/conf.cmake.in)
3020 dnl This is in order to not define SHARED_CFLAGS sometimes
3021 dnl We don't always do aros_shared_ar, aros_shared_cflags
3023 #XXX compatability...
3024 aros_shared_ar="$aros_shared_ld $aros_shared_ldflags -o"
3026 if test -n "$aros_shared_cflags" ; then
3027 echo "SHARED_CFLAGS := $aros_shared_cflags" >> ${aros_hostcfg_dir}/host.cfg
3028 echo "SHARED_AR := $aros_shared_ar" >> ${aros_hostcfg_dir}/host.cfg