1 dnl Copyright © 1997-2010, The AROS Development Team. All rights reserved.
4 dnl Desc: Autoconf source for configuration file
8 # method of getting shared/non-shared ld/ar tool for target.
11 # ------------------------------------------------------------------------
12 # Here starts the first section of the configure.in file.
13 # ------------------------------------------------------------------------
17 AC_CONFIG_AUX_DIR(scripts/autoconf)
19 # Check what host we are running on.
20 # If a target is not suggested, we use this one.
21 # Note that what we call a target, Autoconf calls a host.
24 # The AROS target is slightly different to the normal GNU style
25 # format. We don't have the middle part, and we reverse the order
26 # of the $(CPU) and $(OS) bits.
28 # Don't strip the version of the target yet, it might be
29 # useful on some systems.
31 AC_MSG_CHECKING([for AROS style target])
33 if test "$target" = "NONE" ; then
34 target=$host_os-$host_cpu
37 if test "$target" = "" ; then
38 target=$host_os-$host_cpu
44 AC_MSG_RESULT($target)
46 if test "$host_os" = "mingw32" ; then
50 #don't know where else to put this...
51 AC_MSG_CHECKING([Building AROS in .. ])
52 AROS_BUILDDIR=`${PWDCMD-pwd}`
53 AROS_BUILDDIR_UNIX=${PWD}
54 AC_MSG_RESULT($AROS_BUILDDIR)
56 AC_MSG_CHECKING([AROS Source in .. ])
57 srcpwd=`cd ${srcdir} ; ${PWDCMD-pwd}`
59 AC_MSG_RESULT($SRCDIR)
61 # Parse the target field into something useful.
63 target_os=`echo $target | sed 's/^\([^-]*\)-\(.*\)$/\1/'`
64 target_cpu=`echo $target | sed 's/^\([^-]*\)-\(.*\)$/\2/'`
67 dnl --------------------------------------------------------------------
68 dnl Set the default Workbench resolution
69 dnl --------------------------------------------------------------------
70 aros_default_wbwidth=800
71 aros_default_wbheight=600
72 aros_default_wbdepth=4
74 dnl --------------------------------------------------------------------
75 dnl Host Configuration Section
76 dnl --------------------------------------------------------------------
78 dnl The idea here is to find out all the information we need about the
79 dnl host. This means things like tools for building directory structures,
80 dnl copying files around and the like.
82 # The first step is to find the host binaries.
83 # Check for a compiler.
88 # Check for a compatible awk
89 AC_CHECK_PROGS(AWK,[gawk nawk])
90 AROS_REQUIRED(gawk,$AWK)
91 AROS_PROG(MMAKE,mmake)
93 # Perform some default variable assignments. Note all of these will be
94 # Regenerated from the script, so there is no need to cache them.
97 AROS_TOOL_CCPATH(aros_host_ld,ld)
98 AROS_REQUIRED(ld,$aros_host_ld)
100 aros_host_cflags=$CFLAGS
101 aros_host_ldflags=$LDFLAGS
102 aros_host_debug="-g -O0"
103 aros_host_mkdep="\$(SRCDIR)/scripts/mkdep"
104 aros_host_mkargs="--no-print-directory"
105 aros_host_incl="/usr/include"
106 aros_host_exe_suffix="$EXEEXT"
107 aros_host_lib_suffix=""
109 AC_CHECK_PROGS(aros_host_aclocal,[aclocal aclocal19 aclocal-1.9])
110 AC_CHECK_PROGS(aros_host_autoconf,[autoconf autoconf259 autoconf253])
111 AC_CHECK_PROGS(aros_host_autoheader,[autoheader autoheader259 autoheader253])
112 AC_CHECK_PROGS(aros_host_automake,[automake automake19 automake-1.9])
114 AROS_REQUIRED(aclocal/aclocal19/aclocal-1.9, $aros_host_aclocal)
115 AROS_REQUIRED(automake/automake19/automake-1.9, $aros_host_automake)
117 case "$aros_host_cc" in
119 aros_host_cc_pipe="-pipe"
129 dnl Despite the name, this is really a host configuration variable.
130 aros_target_cc_includes=""
132 # This is the main host configuration section. It is where the host
133 # can change the values of any variables it needs to change. We do
134 # not look at anything that compiles to the target yet, we'll get
139 aros_host_arch="aros"
140 aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
146 aros_host_cpu="x86_64"
149 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
150 aros_host_cpu="$host_cpu"
156 aros_host_arch="linux"
157 aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
163 aros_host_cpu="x86_64"
175 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
176 aros_host_cpu="$host_cpu"
182 aros_host_cc="$aros_host_cc $aros_host_cc_pipe -I/usr/local/include"
183 aros_host_make="gmake"
184 aros_host_arch="freebsd"
187 aros_host_ldflags="$aros_host_ldflags -L/usr/local/lib -liconv"
189 dnl Need to override this here, it's just too hard later.
190 dnl This shouldn't be here at all...
191 dnl aros_target_cc_includes="/usr/include"
193 dnl FreeBSD 5.x (and later) has changed the default object format.
194 dnl The double [[]] is necessary to get around m4's quoting rules.
197 aros_object_format="elf_i386"
201 aros_object_format="elf_i386_fbsd"
208 aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
209 aros_host_arch="darwin"
218 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
219 aros_host_cpu="$host_cpu"
223 aros_host_ldflags="$aros_host_ldflags -liconv"
228 aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
229 aros_host_make="gmake"
230 aros_host_arch="dragonfly"
236 aros_host_cpu="x86_64"
239 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
240 aros_host_cpu="$host_cpu"
246 aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
247 aros_host_make="gmake"
248 aros_host_arch="netbsd"
257 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
258 aros_host_cpu="$host_cpu"
261 aros_host_lib_suffix=".0.0"
265 aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
266 aros_host_make="gmake"
267 aros_host_arch="openbsd"
273 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
274 aros_host_cpu="$host_cpu"
280 aros_host_arch="solaris"
281 aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
287 aros_host_cpu="sparc"
290 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
291 aros_host_cpu="$host_cpu"
297 aros_host_arch="morphos"
302 aros_host_arch="amiga"
307 TOUCH="/gg/bin/touch"
316 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
317 aros_host_cpu="$host_cpu"
323 aros_host_arch="cygwin"
324 aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
330 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
331 aros_host_cpu="$host_cpu"
337 aros_host_arch="mingw32"
338 aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
344 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
345 aros_host_cpu="$host_cpu"
350 AC_MSG_ERROR([Unsupported host architecture $host])
354 AROS_PROG(aros_host_ar,[ar],[cr])
355 AROS_REQUIRED(ar,$aros_host_ar)
356 AROS_PROG(aros_host_ranlib,ranlib)
357 AROS_REQUIRED(ranlib,$aros_host_ranlib)
358 AROS_PROG(aros_host_strip,strip)
359 AROS_REQUIRED(strip,$aros_host_strip)
361 AROS_PROG(RM,[rm],[-rf])
362 AROS_REQUIRED(rm,$RM)
364 AROS_REQUIRED(cp,$CP)
366 AROS_REQUIRED(mv,$MV)
367 AROS_PROG(ECHO,[echo])
368 AROS_REQUIRED(echo,$ECHO)
369 AROS_PROG(MKDIR,[mkdir],[-p])
370 AROS_REQUIRED(mkdir,$MKDIR)
371 AROS_PROG(TOUCH,[touch])
372 AROS_REQUIRED(touch,$TOUCH)
373 AROS_PROG(SORT,[sort])
374 AROS_REQUIRED(sort,$SORT)
375 AROS_PROG(UNIQ,[uniq])
376 AROS_REQUIRED(uniq,$UNIQ)
377 AROS_PROG(NOP,[true])
378 AROS_REQUIRED(true,$NOP)
380 AROS_REQUIRED(cat,$CAT)
381 AROS_PROG(BISON,[bison])
382 AROS_REQUIRED(bison,$BISON)
383 AROS_PROG(FLEX,[flex])
384 AROS_REQUIRED(flex,$FLEX)
385 AROS_PROG(PNGTOPNM,[pngtopnm])
386 AROS_REQUIRED(pngtopnm,$PNGTOPNM)
387 AROS_PROG(PPMTOILBM,[ppmtoilbm])
388 AROS_REQUIRED(ppmtoilbm,$PPMTOILBM)
390 AROS_REQUIRED(sed,$SED)
391 AROS_PROG(CHMOD,[chmod])
392 AROS_REQUIRED(chmod,$CHMOD)
394 AM_PATH_PYTHON(2.2.1)
401 dnl ---------------------------------------------------------------------------
402 dnl Look for things about the host system, good for hosted targets.
403 dnl ---------------------------------------------------------------------------
405 # Check for some includes for the X11 HIDD and the kernel
406 AC_CHECK_HEADERS([sys/ipc.h sys/shm.h \
407 sys/mmap.h sys/mman.h sysexits.h \
408 sys/statfs.h sys/statvfs.h sys/vfs.h sys/param.h \
411 AC_CHECK_HEADERS([sys/mount.h],,,[#include <sys/param.h>])
428 AC_CHECK_MEMBERS(struct tm.tm_gmtoff)
430 # Look for some functions
431 AC_CHECK_FUNCS([getpagesize kqueue statfs statvfs \
432 clone kse_create rfork_thread thr_create sa_register \
433 getcontext makecontext setcontext sigaltstack swapcontext])
438 dnl --------------------------------------------------------------------
439 dnl Target Configuration Section
440 dnl --------------------------------------------------------------------
442 dnl The target configuration section is responsible for setting up all
443 dnl the paths for includes, and tools required to build AROS to some
444 dnl particular target.
446 aros_config_cflags="-Wall -Werror-implicit-function-declaration"
447 aros_config_aflags="-Wall -x assembler-with-cpp -c"
448 aros_config_ldflags=""
450 aros_shared_default=yes
452 aros_shared_cflags="-fPIC"
453 aros_shared_aflags=""
454 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
455 aros_kernel_ldflags="-Wl,-rpath,./lib"
457 aros_target_ar_flags="cr"
458 aros_target_nm_flags="-C -ul"
459 aros_target_strip_flags="--strip-unneeded -R.comment"
464 aros_target_genmap="-Wl,-Map -Xlinker"
466 # Native flavour stuff
467 aros_serial_debug="0"
469 # Palm native flavour stuff
470 aros_palm_debug_hack="0"
473 aros_nesting_supervisor="0"
475 # Collect-aros stuff: "-ius" to ignore undefined symbols
476 ignore_undefined_symbols=""
478 #-----------------------------------------------------------------------------
481 # GCC 4.1+ has a stack protection feature that requires OS support. Ubuntu has
482 # it switched on by default, and we use the host compiler, so it compiles AROS
483 # code with this enabled resulting in link failures as we don't have support
486 # We use two methods to disable it. For the host compiler (used to compile
487 # some hosted modules), we test to see if the compiler supports stack
488 # protection, and if it does we disable it in AROS_CONFIG_CFLAGS. This should
489 # work on all platforms.
491 # For the "cross" compiler we clear the "ssp_default" spec in config/specs.in
492 # (this is done unconditionally, as it should have no effect on compilers
493 # without the stack protection feature). This may be specific to the way that
494 # Ubuntu enables the feature, so may not work everywhere. My specs-fu isn't
495 # strong enough to disable it in a generic way though, so we'll live with it
496 # until another vendor ships GCC with it enabled in a different way, and deal
500 AC_MSG_CHECKING([whether ${CC} accepts -fno-stack-protector])
501 save_cflags="$CFLAGS"
502 CFLAGS="$CFLAGS -fno-stack-protector"
503 AC_TRY_COMPILE(,, use_no_stack_protector="yes", use_no_stack_protector="no")
504 AC_MSG_RESULT($use_no_stack_protector)
505 if test "x-$use_no_stack_protector" = "x-yes" ; then
506 aros_host_cflags="$aros_host_cflags -fno-stack-protector"
508 CFLAGS="$save_cflags"
510 #-----------------------------------------------------------------------------
512 # Disable pointer-signedness warnings if the compiler recognises the option
513 # (this only works for the host compiler at the moment)
515 AC_MSG_CHECKING([whether ${CC} accepts -Wno-pointer-sign])
516 save_cflags="$CFLAGS"
517 CFLAGS="$CFLAGS -Wno-pointer-sign"
518 AC_TRY_COMPILE(,, use_no_sign_warning="yes", use_no_sign_warning="no")
519 AC_MSG_RESULT($use_no_sign_warning)
520 if test "x-$use_no_sign_warning" = "x-yes" ; then
521 aros_host_cflags="$aros_host_cflags -Wno-pointer-sign"
523 CFLAGS="$save_cflags"
525 #-----------------------------------------------------------------------------
527 AC_MSG_CHECKING([for type of build])
528 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")
530 if test "$build_type" = "nightly"; then
531 build_type_string="NIGHTLY"
532 elif test "$build_type" = "snapshot"; then
533 build_type_string="SNAPSHOT"
534 elif test "$build_type" = "milestone"; then
535 build_type_string="MILESTONE"
536 elif test "$build_type" = "release"; then
537 build_type_string="RELEASE"
539 build_type_string="PERSONAL"
540 build_type="personal"
543 aros_config_cflags="$aros_config_cflags -DAROS_BUILD_TYPE=AROS_BUILD_TYPE_$build_type_string"
545 AC_MSG_RESULT($build_type)
547 #-----------------------------------------------------------------------------
548 all_debug_types="messages stack modules mungwall symbols"
550 AC_MSG_CHECKING([which debug types to enable])
551 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)]),
552 debug="$enableval",debug="")
554 if test "$debug" = "" -o "$debug" = "no"; then
556 elif test "$debug" = "yes"; then
560 if test "$debug" = "all" ; then
561 debug="messages stack modules symbols"
562 for d in $all_debug_types; do
563 export aros_${d}_debug="1"
566 for d in $all_debug_types; do
567 export aros_${d}_debug="0"
571 if test "$debug" != "none"; then
572 debug=`echo $debug | sed s/,/\ /g`
575 for d2 in $all_debug_types; do
576 if test "$d2" = "$d"; then
581 if test "$found" = "0"; then
582 AC_MSG_ERROR([unrecognized debug type "$d". Available types are: all none $all_debug_types])
584 export aros_${d}_debug="1"
588 AC_MSG_RESULT($debug)
590 if test "$aros_messages_debug" = "1"; then
591 aros_messages_debug="-DADEBUG=1 -DMDEBUG=1"
593 aros_messages_debug=""
595 if test "$aros_symbols_debug" = "1"; then
596 aros_symbols_debug="-g"
598 aros_symbols_debug=""
601 # These are the flags to pass when compiling debugged programs
602 aros_debug_cflags="$aros_symbols_debug $aros_messages_debug"
604 aros_debug_ldflags="$aros_symbols_debug"
608 #-----------------------------------------------------------------------------
609 # Checking if we should build crosstools..
610 AC_MSG_CHECKING([whether to build crosstools])
611 AC_ARG_ENABLE(crosstools,AC_HELP_STRING([--enable-crosstools],[Build cross-compiler toolchains if necessary (default=no).]),crosstools="$enableval",crosstools="no")
612 if test "$crosstools" != "" -a "$crosstools" != "no"; then
614 aros_crosstools="yes"
619 #-----------------------------------------------------------------------------
620 # Checking for distcc and ccache.
622 # Always apply the transforms in this particular order. Basically you should
623 # always run 'ccache distcc compiler' in that order for the best performance.
625 AC_MSG_CHECKING([whether to enable distcc])
626 AC_ARG_ENABLE(distcc,AC_HELP_STRING([--enable-distcc],[Use distcc as a front end to the compiler (default=no).]),distcc="$enableval",distcc="no")
627 if test "$distcc" != "" -a "$distcc" != "no"; then
628 # AC_CHECK_PROG will print out the result in this case
629 AC_PATH_PROG(DISTCC,[distcc],distcc,)
634 AC_MSG_CHECKING([whether to enable ccache])
635 AC_ARG_ENABLE(ccache,AC_HELP_STRING([--enable-ccache],[Use ccache as a front end to the compiler (default=no).]),ccache="$enableval",ccache="no")
636 if test "$ccache" != "" -a "$ccache" != "no"; then
637 # AC_CHECK_PROG will print out the result in this case
638 AC_CHECK_PROG(CCACHE,[ccache],ccache,)
643 #-----------------------------------------------------------------------------
644 AC_MSG_CHECKING([what optimization flags to use])
645 AC_ARG_WITH(optimization,AC_HELP_STRING([--with-optimization=FLAGS],[Use optimization flags FLAGS (default=-O2).]),optimization="$withval",optimization="unknown")
646 if test "$optimization" = "unknown"; then
647 dnl default is -O2 for normal builds, -O0 for debug builds
648 if test "$debug" != "none"; then
654 aros_config_cflags="$aros_config_cflags $optimization"
655 AC_MSG_RESULT($optimization)
657 #-----------------------------------------------------------------------------
658 AC_MSG_CHECKING([what target variant to enable])
659 AC_ARG_ENABLE(target_variant,AC_HELP_STRING([--enable-target-variant=NAME],[Enable a specific target variant(default=none)]),target_variant=$enableval,target_variant="none")
660 if test "$target_variant" = "none"; then
661 aros_target_variant=""
662 aros_target_suffix=""
664 aros_target_variant="$target_variant"
665 aros_target_suffix="-$target_variant"
667 AC_MSG_RESULT($enableval)
669 target_bootloader="none"
671 #-----------------------------------------------------------------------------
672 # This is the target configuration switch.
675 aros_target_arch="linux"
676 case "$target_cpu" in
678 aros_target_cpu="m68k"
679 aros_object_format="m68kelf"
680 aros_flavour="emulcompat"
681 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D__mc68000 -D__linux__"
682 aros_shared_ldflags="-Wl,-T,\$(TOP)/config/linux/m68k/script.so"
683 aros_kernel_ldflags="-Wl,-rpath,./lib,-T,\$(TOP)/config/linux/m68k/script.normal"
684 gcc_target_cpu="mc68000"
687 aros_target_cpu="i386"
688 aros_object_format="elf_i386"
689 aros_flavour="emulation"
690 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__linux__"
691 aros_config_cflags="$aros_config_cflags -m32 -march=i486"
692 aros_kernel_cflags="$aros_kernel_cflags -m32 -march=i486"
693 aros_config_aflags="$aros_config_aflags -m32 -march=i486"
694 aros_config_ldflags="-m32 -march=i486"
695 aros_kernel_ldflags="-melf_i386"
696 aros_default_wbdepth=8
697 gcc_target_cpu="i386"
700 aros_target_cpu="x86_64"
701 aros_object_format="elf_x86_64"
702 aros_flavour="emulation"
703 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64 -D__linux__"
704 aros_config_cflags="$aros_config_cflags -mno-red-zone"
705 aros_default_wbdepth=8
706 gcc_target_cpu="x86_64"
709 aros_target_cpu="ppc"
710 aros_object_format="elf32ppc"
711 aros_flavour="emulation"
712 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc -D__linux__"
713 aros_default_wbdepth=8
717 # Same as powerpc, but I need this for the nightly build to work again.
718 # Actually, the nightly should be made working with powerpc target.
719 # That just was too much work for the moment, another week or two.
721 aros_target_cpu="ppc"
722 aros_object_format="elf32ppc"
723 aros_flavour="emulation"
724 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc -D__linux__"
725 aros_default_wbdepth=8
729 aros_target_cpu="arm"
730 aros_object_format="armelf_linux_eabi"
731 aros_flavour="emulation"
732 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm -D__linux__"
734 aros_config_cflags="$aros_config_cflags -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -fno-asynchronous-unwind-tables -fno-exceptions"
735 aros_config_aflags="$aros_config_aflags -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -fno-asynchronous-unwind-tables -fno-exceptions"
738 AC_MSG_ERROR("Unknown CPU for Linux -- $target_cpu")
744 aros_target_arch="pc"
745 aros_shared_default="no"
746 target_bootloader="grub2"
747 case "$target_cpu" in
749 aros_target_cpu="i386"
751 dnl If somebody hasn't already set the target object
752 dnl format, then use this value. Mostly to support
753 dnl FreeBSD cross-compilation.
754 dnl TODO: Remove when we always use our compiler.
756 if test "$aros_object_format" = "" ; then
757 aros_object_format="elf_i386"
759 aros_flavour="standalone"
760 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
761 aros_config_cflags="$aros_config_cflags -m32 -march=i486"
762 aros_kernel_cflags="$aros_kernel_cflags -m32 -march=i486"
763 aros_config_aflags="$aros_config_aflags -m32 -march=i486"
764 aros_config_ldflags="-m32 -march=i486"
765 aros_kernel_ldflags="-melf_i386"
766 aros_default_wbwidth=640
767 aros_default_wbheight=480
768 gcc_target_cpu="i386"
771 aros_target_cpu="x86_64"
773 if test "$aros_object_format" = "" ; then
774 aros_object_format="elf_x86_64"
776 aros_flavour="standalone"
777 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
778 aros_config_cflags="$aros_config_cflags -fno-asynchronous-unwind-tables -mno-red-zone"
779 aros_kernel_ldflags=""
780 aros_default_wbwidth=640
781 aros_default_wbheight=480
782 gcc_target_cpu="x86_64"
785 AC_MSG_ERROR("Unknown native CPU -- $target_cpu")
791 aros_target_arch="prep"
792 aros_shared_default="no"
793 aros_target_cpu="ppc"
794 aros_object_format="elf32ppc"
795 aros_flavour="ppcnative"
796 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
797 aros_kernel_ldflags=""
798 aros_default_wbwidth=640
799 aros_default_wbheight=480
804 aros_target_arch="freebsd"
805 aros_target_cpu="i386"
806 aros_flavour="emulation"
807 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
808 gcc_target_cpu="i386"
810 aros_target_strip_flags="-x"
814 aros_target_arch="darwin"
815 aros_flavour="emulation"
817 dnl This test bypass was implemented for Darwin by port's author.
818 dnl I wonder why, since darwin port needs this function.
819 dnl I left it here just because port author did it.
821 case "$target_cpu" in
823 aros_target_cpu="i386"
824 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
825 gcc_target_cpu="i386"
826 aros_object_format="elf_i386"
827 aros_target_strip_flags="-x"
830 AC_MSG_ERROR("Unsupported target CPU for darwin hosted flavour -- $target_cpu")
836 aros_target_arch="dragonfly"
837 aros_flavour="emulation"
838 case "$target_cpu" in
840 aros_target_cpu="i386"
841 aros_object_format="elf_i386"
842 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__DragonFly__"
845 aros_target_cpu="x86_64"
846 aros_object_format="elf_x86_64"
847 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64 -D__DragonFly__"
850 AC_MSG_ERROR("Unknown CPU for DragonFly -- $target_cpu")
856 aros_target_arch="netbsd"
857 case "$target_cpu" in
859 aros_target_cpu="m68k"
860 aros_object_format="m68kelf"
861 aros_flavour="emulcompat"
862 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D__mc68000 -D__NetBSD__"
863 gcc_target_cpu="mc68000"
866 aros_target_cpu="i386"
867 aros_object_format="elf_i386"
868 aros_flavour="emulation"
869 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__NetBSD__"
870 aros_default_wbdepth=8
871 gcc_target_cpu="i386"
874 AC_MSG_ERROR("Unknown CPU for NetBSD -- $target_cpu")
877 aros_target_genmap="-Wl,-M -Xlinker >"
878 aros_flavour="emulation"
879 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
883 aros_target_arch="openbsd"
884 case "$target_cpu" in
886 aros_target_cpu="i386"
887 aros_object_format="elf_i386"
888 aros_flavour="emulation"
889 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__OpenBSD__"
890 gcc_target_cpu="i386"
893 AC_MSG_ERROR("Unknown CPU for OpenBSD -- $target_cpu")
896 aros_target_genmap="-Wl,-M -Xlinker >"
897 aros_target_nm_flags="-u"
898 aros_flavour="emulation"
902 aros_target_arch="solaris"
903 case "$target_cpu" in
905 aros_target_cpu="i386"
906 aros_object_format="elf_i386"
907 aros_flavour="emulation"
908 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__Solaris__"
909 aros_default_wbdepth=8
910 gcc_target_cpu="i386"
913 aros_target_cpu="sparc"
914 aros_object_format="elf_sparc"
915 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dsparc -D__Solaris__"
916 gcc_target_cpu="sparc"
919 AC_MSG_ERROR("Unknown CPU for Solaris -- $target_cpu")
922 aros_config_cflags="$aros_config_cflags -D$aros_target_cpu"
923 aros_flavour="emulation"
927 aros_target_arch="morphos"
928 aros_shared_default="no"
929 aros_target_cpu="ppc"
930 aros_object_format="elf_ppc"
931 aros_flavour="nativecompat"
932 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
937 aros_target_arch="sam440"
938 aros_shared_default="no"
939 aros_target_cpu="ppc"
940 aros_object_format="elf32ppc"
941 aros_flavour="ppcnative"
942 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
943 aros_kernel_ldflags=""
944 aros_default_wbwidth=1024
945 aros_default_wbheight=768
946 aros_default_wbdepth=24
947 aros_config_cflags="$aros_config_cflags -mcpu=440fp -mno-toc -fno-asynchronous-unwind-tables"
948 gcc_target_cpu="powerpc"
952 aros_target_arch="efika"
953 aros_shared_default="no"
954 aros_target_cpu="arm"
955 aros_object_format="armelf_linux_eabi"
956 aros_flavour="standalone"
957 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
958 aros_kernel_ldflags=""
959 aros_default_wbwidth=1024
960 aros_default_wbheight=600
961 aros_arch_libs="-laeabi"
962 aros_config_cflags="$aros_config_cflags -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -fno-asynchronous-unwind-tables -fno-exceptions"
963 aros_config_aflags="$aros_config_aflags -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -fno-asynchronous-unwind-tables -fno-exceptions"
967 aros_target_arch="chrp"
968 aros_shared_default="no"
969 aros_target_cpu="ppc"
970 aros_object_format="elf32ppc"
971 aros_flavour="ppcnative"
972 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
973 aros_kernel_ldflags=""
974 aros_default_wbwidth=640
975 aros_default_wbheight=480
976 aros_config_cflags="$aros_config_cflags -mno-toc -fno-asynchronous-unwind-tables"
977 gcc_target_cpu="powerpc"
978 case "$aros_target_variant" in
980 aros_config_cflags="$aros_config_cflags -DBIG_ENDIAN_OHCI=1 -mcpu=603e"
986 aros_target_arch="amiga"
987 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D_AMIGA -DAMIGA"
988 aros_shared_default="no"
990 aros_config_cflags="$aros_config_cflags -fomit-frame-pointer -fbuiltin -ffreestanding"
992 case "$target_cpu" in
994 aros_target_cpu="m68k"
995 aros_object_format="m68kelf"
996 aros_flavour="nativecompat"
997 gcc_target_cpu="mc68000"
1001 aros_flavour="native"
1002 gcc_target_cpu="ppc"
1005 AC_MSG_ERROR("Unknown CPU for Amiga $target_cpu")
1011 aros_target_arch="mingw32"
1012 aros_shared_default="no"
1013 aros_flavour="emulation"
1014 aros_shared_cflags=""
1017 case "$target_cpu" in
1019 aros_target_cpu="i386"
1020 aros_object_format="elf_i386"
1021 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1022 aros_default_wbdepth=8
1023 gcc_target_cpu="i386"
1024 aros_target_cc="i386-aros-gcc"
1025 aros_target_ld="i386-aros-ld"
1026 aros_target_as="i386-aros-as"
1027 aros_target_ar="i386-aros-ar"
1028 aros_target_ranlib="i386-aros-ranlib"
1029 aros_target_nm="i386-aros-nm"
1030 aros_target_strip="i386-aros-strip"
1031 aros_target_objcopy="i386-aros-objcopy"
1032 aros_target_objdump="i386-aros-objdump"
1033 target_tool_prefix="i386-mingw32-"
1036 aros_target_cpu="x86_64"
1037 aros_object_format="elf_x86_64"
1038 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
1039 aros_default_wbdepth=8
1040 gcc_target_cpu="x86_64"
1041 aros_target_cc="x86_64-aros-gcc"
1042 aros_target_ld="x86_64-aros-ld"
1043 aros_target_as="x86_64-aros-as"
1044 aros_target_ar="x86_64-aros-ar"
1045 aros_target_ranlib="x86_64-aros-ranlib"
1046 aros_target_nm="x86_64-aros-nm"
1047 aros_target_strip="x86_64-aros-strip"
1048 aros_target_objcopy="x86_64-aros-objcopy"
1049 aros_target_objdump="x86_64-aros-objdump"
1050 target_tool_prefix="x86_64-w64-mingw32-"
1053 aros_target_cpu="arm"
1054 aros_object_format="armelf_linux_eabi"
1055 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
1056 aros_default_wbdepth=8
1057 gcc_target_cpu="arm"
1058 aros_target_cc="arm-elf-gcc"
1059 aros_target_ld="arm-elf-ld"
1060 aros_target_as="arm-elf-as"
1061 aros_target_ar="arm-elf-ar"
1062 aros_target_ranlib="arm-elf-ranlib"
1063 aros_target_nm="arm-elf-nm"
1064 aros_target_strip="arm-elf-strip"
1065 aros_target_objcopy="arm-elf-objcopy"
1066 aros_target_objdump="arm-elf-objdump"
1067 target_tool_prefix="arm-mingw32ce-"
1068 aros_default_wbwidth=160
1069 aros_default_wbheight=160
1072 AC_MSG_ERROR("Unknown CPU for Mingw32 -- $target_cpu")
1075 if test $host_os = "cygwin"; then
1076 aros_kernel_cflags="-mno-cygwin"
1080 aros_target_arch="pp"
1081 aros_shared_default="no"
1082 case "$target_cpu" in
1084 aros_target_cpu="m68k"
1085 aros_object_format="m68kelf"
1086 aros_flavour="palmnative"
1087 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
1088 aros_default_wbwidth=160
1089 aros_default_wbheight=160
1090 aros_default_wbdepth=1
1091 aros_target_ar_flags="cru"
1092 aros_compiler_libs="-lgcc1"
1093 aros_shared_default=no
1094 aros_shared_cflags="-fpic"
1095 aros_shared_aflags=""
1096 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
1097 aros_kernel_ldflags="-Wl,-rpath,./lib"
1098 aros_debug_cflags="-Wall -Werror-implicit-function-declaration $aros_symbols_debug $aros_messages_debug -mc68000 -Wa,-mc68000"
1099 aros_debug_aflags=""
1100 aros_debug_ldflags="$aros_symbols_debug"
1101 aros_mungwall_debug="0"
1102 aros_modules_debug="0"
1103 gcc_target_cpu="mc68000"
1104 ignore_undefined_symbols="-ius"
1107 AC_MSG_ERROR("Unknown CPU for PalmPilot -- $target_cpu")
1113 aros_target_arch="mac"
1114 aros_shared_default="no"
1115 case "$target_cpu" in
1117 aros_target_cpu="m68k"
1118 aros_object_format="m68kelf"
1119 aros_flavour="mac68knative"
1120 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
1121 aros_default_wbwidth=512
1122 aros_default_wbheight=384
1123 aros_default_wbdepth=8
1124 aros_target_ar_flags="cru"
1125 aros_compiler_libs="-lgcc1"
1126 aros_shared_default=no
1127 aros_shared_cflags="-fpic"
1128 aros_shared_aflags=""
1129 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
1130 aros_kernel_ldflags="-Wl,-rpath,./lib"
1131 aros_debug_cflags="-Wall -Werror-implicit-function-declaration $aros_symbols_debug $aros_messages_debug -mc68000"
1132 aros_debug_aflags=""
1133 aros_debug_ldflags="$aros_symbols_debug"
1134 aros_mungwall_debug="0"
1135 aros_modules_debug="0"
1136 gcc_target_cpu="mc68000"
1137 ignore_undefined_symbols="-ius"
1140 AC_MSG_ERROR("Unknown CPU for Mac68k -- $target_cpu")
1146 AC_MSG_ERROR([Unsupported target architecture $target])
1150 AC_MSG_CHECKING([Where to download sourcecode for external ports])
1151 AC_ARG_WITH(portssources,AC_HELP_STRING([--with-portssources=DIR],[Where to download sourcecode for external ports]),with_portssrcdir=$withval,with_portssrcdir="default")
1152 if test "$with_portssrcdir" = "default"; then
1153 AROS_PORTSSRCDIR="$AROS_BUILDDIR_UNIX/bin/Sources"
1155 AROS_PORTSSRCDIR="$with_portssrcdir"
1157 AC_MSG_RESULT($AROS_PORTSSRCDIR)
1159 AC_MSG_CHECKING([which bootloader to use])
1160 AC_ARG_WITH(bootloader,AC_HELP_STRING([--with-bootloader=NAME],[Use a specific bootloader]),target_bootloader=$withval,target_bootloader=$target_bootloader)
1161 if test "$target_bootloader" = "none"; then
1162 aros_target_bootloader=""
1164 aros_target_bootloader="$target_bootloader"
1166 AC_MSG_RESULT($target_bootloader)
1168 AC_MSG_CHECKING([which icon-set to use])
1169 AC_ARG_WITH(iconset,AC_HELP_STRING([--with-iconset=NAME],[Use a specific Icon-set (default=Gorilla).]),target_iconset=$withval,target_iconset="default")
1170 if test "$target_iconset" = "default"; then
1171 aros_target_iconset="Gorilla"
1172 target_iconset="default (Gorilla)"
1174 aros_target_iconset="$target_iconset"
1176 AC_MSG_RESULT($target_iconset)
1178 AC_MSG_CHECKING([which GUI Theme to use])
1179 AC_ARG_WITH(theme,AC_HELP_STRING([--with-theme=NAME],[Use a specific GUI Theme]),target_guitheme=$withval,target_guitheme="default")
1180 if test "$target_guitheme" = "default"; then
1181 aros_target_guitheme="Ice"
1183 aros_target_guitheme="$target_guitheme"
1185 AC_MSG_RESULT($aros_target_guitheme)
1187 # Find out if we are cross-compiling (i.e. if we can't use the host compiler
1190 if test "$aros_host_cpu" != "$aros_target_cpu" ; then
1193 if test "$aros_host_cpu" == "x86_64" ; then
1194 if test "$aros_target_cpu" == "i386" ; then
1195 if test "$aros_target_arch" != "mingw32"; then
1200 if test "$aros_host_arch" == "darwin" ; then
1204 # Set prefix for target compiler etc. if we're cross-compiling
1205 # (should possibly be earlier but needs to be after AC_PROG_CC)
1206 if test "$cross_compiling" = "yes" ; then
1207 if test "$target_tool_prefix" = ""; then
1208 target_tool_prefix=${target_cpu}-elf-
1210 CC=${target_tool_prefix}gcc
1213 #-----------------------------------------------------------------------------
1215 # Disable pointer-signedness warnings if the compiler recognises the option
1217 AC_MSG_CHECKING([whether ${CC} accepts -Wno-pointer-sign])
1218 save_cflags="$CFLAGS"
1219 CFLAGS="$CFLAGS -Wno-pointer-sign"
1220 AC_TRY_COMPILE(,, use_no_sign_warning="yes", use_no_sign_warning="no")
1221 AC_MSG_RESULT($use_no_sign_warning)
1222 if test "x-$use_no_sign_warning" = "x-yes" ; then
1223 aros_config_cflags="$aros_config_cflags -Wno-pointer-sign"
1225 CFLAGS="$save_cflags"
1227 #-----------------------------------------------------------------------------
1229 # Find all the tools we need to compile. This could be cross-compiling
1230 # though! If that is the case we use the GNU form of the target and
1231 # simply add this to the front of the binary name. This is rather simple,
1232 # but it should work under most circumstances.
1234 # The default tools are to use the same as the host, but only if the
1235 # host and target CPU are the same. With GCC this is normally enough.
1239 aros_shared_ld="$aros_host_ld"
1241 aros_target_mkdep="$aros_host_mkdep"
1242 aros_target_incl_def="$aros_host_incl"
1244 aros_kernel_cc="$CC"
1246 # The default tools executables to be linked to.
1247 if test "$aros_target_cc" != ""; then
1248 AC_PATH_PROG(aros_target_cc,$aros_target_cc)
1249 AROS_REQUIRED(gcc,$aros_target_cc)
1251 if test "$aros_target_ld" != ""; then
1252 AC_PATH_PROG(aros_target_ld,$aros_target_ld)
1253 AROS_REQUIRED(ld,$aros_target_ld)
1256 if test "$crosstools" != "yes"; then
1257 AROS_TOOL_TARGET(aros_target_as_ln,as,$aros_target_as)
1258 AROS_REQUIRED(as,$aros_target_as_ln)
1259 AROS_TOOL_TARGET(aros_kernel_ld,ld,$aros_kernel_ld)
1260 AROS_REQUIRED(ld,$aros_kernel_ld)
1261 AROS_TOOL_TARGET(aros_target_ar_ln,ar,$aros_target_ar)
1262 AROS_REQUIRED(ar,$aros_target_ar_ln)
1263 AROS_TOOL_TARGET(aros_target_nm_ln,nm,$aros_target_nm)
1264 AROS_REQUIRED(nm,$aros_target_nm_ln)
1265 AROS_TOOL_TARGET(aros_target_objcopy_ln,objcopy,$aros_target_objcopy)
1266 AROS_REQUIRED(objcopy,$aros_target_objcopy_ln)
1267 AROS_TOOL_TARGET(aros_target_objdump_ln,objdump,$aros_target_objdump)
1268 AROS_REQUIRED(objdump,$aros_target_objdump_ln)
1269 AROS_TOOL_TARGET(aros_target_ranlib_ln,ranlib,$aros_target_ranlib)
1270 AROS_REQUIRED(ranlib,$aros_target_ranlib_ln)
1271 AROS_TOOL_TARGET(aros_target_strip_ln,strip,$aros_target_strip)
1272 AROS_REQUIRED(strip,$aros_target_strip_ln)
1275 if test "$rescomp" != ""; then
1276 if test "$cross_compiling" = "yes" ; then
1277 rescomp=${target_tool_prefix}${rescomp}
1279 AC_PATH_PROG(aros_kernel_rescomp,$rescomp)
1280 AROS_REQUIRED($rescomp,$aros_kernel_rescomp)
1283 aros_hostcfg_dir="bin/${aros_host_arch}-${aros_host_cpu}/gen/config"
1284 aros_targetcfg_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/config"
1285 aros_inc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/AROS/Development/include/aros"
1286 aros_gendir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen"
1287 aros_geninc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/include/aros"
1288 aros_tools_dir="bin/${aros_host_arch}-${aros_host_cpu}/tools"
1289 aros_scripts_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/scripts"
1291 # aros_cc_pre is a variable that is added to the front of the compiler name
1292 # in the generated aros-gcc shell script. We need this to enable the cache
1293 # to work across cleaned builds. Also, support DISTCC using the correct
1294 # environment variable.
1297 if test "x${DISTCC}" != "x" ; then
1298 if test "x${CCACHE}" != "x" ; then
1299 aros_cc_pre="env CCACHE_PREFIX=${DISTCC} ${CCACHE} "
1301 aros_cc_pre="${DISTCC} "
1304 if test "x${CCACHE}" != "x" ; then
1305 aros_cc_pre="${CCACHE} "
1309 prefix="${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros"
1311 AC_SUBST(aros_target_nostdinc_cflags,-nostdinc)
1312 AC_SUBST(aros_target_nostartup_ldflags,-nostartfiles)
1313 AC_SUBST(aros_target_nix_ldflags,-nix)
1314 AC_SUBST(aros_target_detach_ldflags,-detach)
1315 AC_SUBST(aros_target_nostdlib_ldflags,-nostdlib)
1318 if test "$aros_target_cc" = ""; then
1319 orig_target_cc=$aros_kernel_cc
1321 orig_target_cc=$aros_target_cc
1323 if test "$aros_target_ld" = ""; then
1324 orig_target_ld=$aros_kernel_ld
1326 orig_target_ld=$aros_target_ld
1328 if test "$GCC" = "yes"; then
1329 aros_target_cc_path=`$orig_target_cc -print-search-dirs | grep "programs: =" | cut -c 12-`
1331 aros_target_cc="${prefix}-gcc"
1332 aros_target_as="${prefix}-as"
1333 aros_target_ld="${prefix}-ld"
1334 aros_target_ar="${prefix}-ar $aros_target_ar_flags"
1335 aros_target_objcopy=${prefix}-objcopy
1336 aros_target_objdump=${prefix}-objdump
1337 aros_target_ranlib="${prefix}-ranlib $aros_target_ranlib_flags"
1338 aros_target_nm="${prefix}-nm $aros_target_nm_flags"
1339 aros_kernel_nm="${prefix}-nm"
1340 aros_target_strip=${prefix}-strip
1342 # Find the system include path. We can suggest that an alternative is
1343 # used if we don't get it correct. The default is to use /usr/include.
1344 # Which is set in the aros_target_incl_def variable.
1346 AC_ARG_ENABLE(includes,
1347 AC_HELP_STRING([--enable-includes=dir],[Alternative system include directory]),
1348 [aros_target_incl=$enable_includes], [aros_target_incl=$aros_target_incl_def])
1350 dnl find out about the target cc's include path
1351 AC_MSG_CHECKING([for the target compiler's include path])
1352 if test "$aros_target_cc_includes" = "" ; then
1353 #try to guess where the directory is
1354 aros_target_cc_includes=`dirname \`${orig_target_cc} -print-libgcc-file-name\``/include
1355 if ! test -d $aros_target_cc_includes; then
1356 #the directory doesn't exist, we need to do some more work
1357 aros_target_cc_includes=${PWD}/${aros_gendir}/cc_include
1359 #these are the headers we're looling for
1360 headers="limits.h mmintrin.h stdbool.h syslimits.h float.h \
1361 stddef.h xmmintrin.h iso646.h stdarg.h unwind.h \
1365 for h in $headers; do
1366 #which other headers each of the above headers needs?
1367 deps=$(echo "#include <$h>" | \
1368 $aros_host_cc -E -M - 2>/dev/null | \
1369 sed 's/^.*://; s/\\$/ /g; s/[[ \t]]\+/ /g')
1371 #copy all the needed headers to a directory beneath gendir
1374 dir=${aros_target_cc_includes}$(echo $(dirname $d) | \
1375 sed -n "s,^.*/include\(/.*\),\1,p")
1376 ! test -d $dir && mkdir -p $dir
1377 ! test -f $dir/$h && { cp $d $dir; chmod u+w $dir/$h; }
1382 AC_MSG_RESULT($aros_target_cc_includes)
1385 # For GCC < 4.0 -I- is used for giving the search path for '#include "..."'
1386 # On GCC >= 4.0 -iquote should be used
1390 save_cflags="$CFLAGS"
1392 AC_MSG_CHECKING([whether ${CC} accepts -iquote])
1393 AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
1394 AC_MSG_RESULT($has_iquote)
1395 if test "x-$has_iquote" = "x-yes" ; then
1396 host_cflags_iquote=-iquote
1397 host_cflags_iquote_end=
1399 host_cflags_iquote=-I
1400 host_cflags_iquote_end=-I-
1402 kernel_cflags_iquote=$host_cflags_iquote
1403 kernel_cflags_iquote_end=$host_cflags_iquote_end
1404 if test "x-$cross_compiling" = "x-yes"; then
1405 CC="$aros_kernel_cc"
1406 AC_MSG_CHECKING([whether ${CC} accepts -fno-stack-protector])
1407 AC_TRY_COMPILE(,, use_no_stack_protector="yes", use_no_stack_protector="no")
1408 AC_MSG_RESULT($use_no_stack_protector)
1409 AC_MSG_CHECKING([whether ${CC} accepts -iquote])
1410 AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
1411 AC_MSG_RESULT($has_iquote)
1412 if test "x-$has_iquote" = "x-yes" ; then
1413 kernel_cflags_iquote=-iquote
1414 kernel_cflags_iquote_end=
1416 kernel_cflags_iquote=-I
1417 kernel_cflags_iquote_end=-I-
1420 aros_cflags_iquote=$kernel_cflags_iquote
1421 aros_cflags_iquote_end=$kernel_cflags_iquote_end
1422 if test "$orig_target_cc" != "$aros_kernel_cc"; then
1423 CC="$orig_target_cc"
1424 AC_MSG_CHECKING([whether ${CC} accepts -iquote])
1425 AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
1426 AC_MSG_RESULT($has_iquote)
1427 if test "x-$has_iquote" = "x-yes" ; then
1428 aros_cflags_iquote=-iquote
1429 aros_cflags_iquote_end=
1431 aros_cflags_iquote=-I
1432 aros_cflags_iquote_end=-I-
1435 if test "x-$use_no_stack_protector" = "x-yes" ; then
1436 aros_kernel_cflags="$aros_kernel_cflags -fno-stack-protector"
1439 #-----------------------------------------------------------------------------
1441 # Check if we can explicitly choose older version of symbol hashing
1443 CFLAGS="save_cflags -Wl,--hash-style=sysv"
1444 CC="$aros_kernel_cc"
1445 AC_MSG_CHECKING([whether ${CC} accepts -Wl,--hash-style=sysv])
1446 AC_TRY_LINK(,, use_hash_style="yes", use_hash_style="no")
1447 AC_MSG_RESULT($use_hash_style)
1448 if test "x-$use_hash_style" = "x-yes" ; then
1449 aros_kernel_cflags="$aros_kernel_cflags -Wl,--hash-style=sysv"
1452 CFLAGS="$save_cflags"
1454 AC_SUBST(host_cflags_iquote)
1455 AC_SUBST(host_cflags_iquote_end)
1456 AC_SUBST(kernel_cflags_iquote)
1457 AC_SUBST(kernel_cflags_iquote_end)
1458 AC_SUBST(aros_cflags_iquote)
1459 AC_SUBST(aros_cflags_iquote_end)
1462 dnl Check if user specified --with-resolution=XRESxYRESxDEPTH
1463 AC_MSG_CHECKING([for default resolution of WBScreen])
1464 AC_ARG_WITH(resolution,AC_HELP_STRING([--with-resolution=XRESxYRESxDEPTH],[Default resolution of the initial WorkbenchScreen]),resolution=$withval,resolution=none)
1465 # We require an argument, so map --with/--without ("yes"/"no") to "none" specified
1466 if test "$resolution" = "yes" ; then
1469 if test "$resolution" = "no" ; then
1472 if test "$resolution" != "none" ; then
1473 aros_default_wbwidth=`echo $resolution | cut -d'x' -f1`
1474 aros_default_wbheight=`echo $resolution | cut -d'x' -f2`
1475 aros_default_wbdepth=`echo $resolution | cut -d'x' -f3`
1477 AC_MSG_RESULT($aros_default_wbwidth x $aros_default_wbheight x $aros_default_wbdepth)
1478 aros_cv_default_wbwidth=$aros_default_wbwidth
1479 aros_cv_default_wbheight=$aros_default_wbheight
1480 aros_cv_default_wbdepth=$aros_default_wbdepth
1482 dnl See if the user wants the serial debug output for native flavour
1483 AC_MSG_CHECKING([if serial debug is enabled])
1484 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)
1485 if test "$aros_serial_debug" = 0 ; then
1486 serial_debug_forced=""
1487 if test "$serial_debug" = "yes" ; then
1490 if test "$serial_debug" = "no" ; then
1494 serial_debug_forced="(forced)"
1495 serial_debug=$aros_serial_debug
1497 if test "$serial_debug" != "none" ; then
1498 aros_serial_debug=$serial_debug
1499 AC_MSG_RESULT($serial_debug_forced on port $serial_debug)
1504 dnl See if the user wants the palm debug output hack for palm native flavour
1505 AC_MSG_CHECKING([if palm debug hack is enabled])
1506 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")
1507 if test "$palm_debug_hack" = "yes" ; then
1508 aros_palm_debug_hack="1"
1510 AC_MSG_RESULT($palm_debug_hack)
1513 dnl See if the user wants nesting supervisor activated for unix flavour
1514 AC_MSG_CHECKING([if nesting supervisor support is enabled])
1515 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")
1516 if test "$nesting_supervisor" = "yes" ; then
1517 aros_nesting_supervisor="1"
1519 AC_MSG_RESULT($nesting_supervisor)
1522 dnl things specifically required for hosted flavours
1523 if test "x-$aros_flavour" = "x-emulation" -o "x-$aros_flavour" = "x-emulcompat" ; then
1525 if test "x-$need_dlopen" != "x-no" ; then
1526 dnl some kind of dynamic library access system is required for hostlib.resource
1527 AC_CHECK_FUNC(dlopen, have_dl="yes", have_dl="no")
1528 if test "x-$have_dl" = "x-no" ; then
1529 AC_CHECK_LIB(dl, dlopen, [have_dl="yes"
1530 aros_host_ldflags="$aros_host_ldflags -ldl"],
1533 if test "x-$have_dl" = "x-no" ; then
1534 AC_MSG_ERROR([dlopen() dynamic linker functions not available])
1540 AC_ARG_ENABLE(x11_hidd, AC_HELP_STRING([--enable-x11-hidd],
1541 [build X11 hidd for hosted (default=auto)]),
1542 x11_hidd="$enableval",
1544 case "x-$x11_hidd" in
1545 x-yes|x-no|x-auto) ;;
1546 *) x11_hidd="auto" ;;
1552 if test "x-$x11_hidd" != "x-no" ; then
1558 for path in $x_libraries
1560 x_cflags="$x_cflags -L$path"
1563 for path in $x_includes
1565 x_cflags="$x_cflags -I$path"
1568 if test "x-$no_x" = "x-yes" ; then
1571 if test "x-$x11_hidd" != "x-auto" ; then
1572 dnl and they explicitly asked for it, bail out
1573 AC_MSG_ERROR([X11 libs/headers not found, cannot build X11 hidd as requested])
1577 dnl found it, setup the metatarget
1578 x11_hidd_target=kernel-x11gfx-kobj
1581 dnl setup shared memory extensions
1582 AC_ARG_ENABLE(x11_shm, AC_HELP_STRING([--enable-x11-shm],
1583 [use X11 shared memory (default=auto)]),
1584 x11_hidd_shm="$enableval",
1585 x11_hidd_shm="auto")
1586 case "x-$x11_hidd_shm" in
1587 x-yes|x-no|x-auto) ;;
1588 *) x11_hidd_shm="auto" ;;
1594 if test "x-$x11_hidd_shm" != "x-no" ; then
1596 dnl system shm headers
1597 AC_CHECK_HEADERS(sys/ipc.h)
1598 AC_CHECK_HEADERS(sys/shm.h)
1601 if test "x-$ac_cv_header_sys_ipc_h" = "x-yes" -a "x-$ac_cv_header_sys_shm_h" = "x-yes" ; then
1603 dnl make sure X libs have shm functions
1604 save_cflags="$CFLAGS"
1605 CFLAGS="$CFLAGS $x_cflags"
1606 AC_CHECK_LIB(Xext, XShmQueryExtension, have_xshm=yes)
1607 CFLAGS="$save_cflags"
1611 dnl detection done, prepare output
1612 if test "x-$have_xshm" = "x-yes" ; then
1615 elif test "x-$x11_hidd_shm" = "x-yes" ; then
1616 dnl they explicitly asked for it, but we can't do it
1617 AC_MSG_ERROR([X11 has no support for shared memory, cannot enable it as requested])
1619 dnl otherwise just disable it
1624 dnl setup vidmode (fullscreen) extensions
1625 AC_ARG_ENABLE(x11_vidmode, AC_HELP_STRING([--enable-x11-vidmode],
1626 [use X11 vidmode extension (default=auto)]),
1627 x11_hidd_vidmode="$enableval",
1628 x11_hidd_vidmode="auto")
1629 case "x-$x11_hidd_vidmode" in
1630 x-yes|x-no|x-auto) ;;
1631 *) x11_hidd_vidmode="auto" ;;
1637 if test "x-$x11_hidd_vidmode" != "x-no" ; then
1639 dnl make sure X libs have vidmode functions
1640 save_cflags="$CFLAGS"
1641 CFLAGS="$CFLAGS $x_cflags"
1642 AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryExtension, have_vidmode=yes)
1643 CFLAGS="$save_cflags"
1646 dnl detection done, prepare output
1647 if test "x-$have_vidmode" = "x-yes" ; then
1648 dnl we can do vidmode
1649 DO_VIDMODE_SUPPORT="1"
1650 elif test "x-$x11_hidd_vidmode" = "x-yes" ; then
1651 dnl they explicitly asked for it, but we can't do it
1652 AC_MSG_ERROR([X11 vidmode extension not available, cannot enable it as requested])
1654 dnl otherwise just disable it
1655 DO_VIDMODE_SUPPORT="0"
1659 aros_host_x11_includes=$x_includes
1660 aros_host_x11_libdirs=$x_libraries
1665 AC_ARG_ENABLE(sdl_hidd, AC_HELP_STRING([--enable-sdl-hidd],
1666 [build SDL hidd for hosted (default=auto)]),
1667 sdl_hidd="$enableval",
1669 case "x-$sdl_hidd" in
1670 x-yes|x-no|x-auto) ;;
1671 *) sdl_hidd="auto" ;;
1675 if test "x-$sdl_hidd" != "x-no" ; then
1678 AM_PATH_SDL([1.2.10], have_sdl="yes", have_sdl="no")
1680 if test "x-$have_sdl" != "x-yes" ; then
1683 if test "x-$sdl_hidd" != "x-auto" ; then
1684 dnl and they explicitly asked for it, bail out
1685 AC_MSG_ERROR([SDL libs/headers not found, cannot build SDL hidd as requested])
1689 dnl found it, set up the metatarget
1690 sdl_hidd_target=kernel-hidd-sdl
1691 aros_host_sdl_cflags=SDL_CFLAGS
1692 aros_host_sdl_libs=SDL_LIBS
1699 dnl See if the user wants dbus.library
1700 AC_MSG_CHECKING([if building of dbus.library is enabled])
1701 AC_ARG_ENABLE(dbus,AC_HELP_STRING([--enable-dbus],[Enable DBUS support via dbus.library (default=no)]),dbus="yes",dbus="no")
1702 if test "$dbus" = "yes" ; then
1704 DBUS_CFLAGS=`pkg-config --cflags dbus-1`
1705 DBUS_LIBFLAGS=`pkg-config --libs dbus-1`
1706 KERNEL_DBUS_KOBJ=kernel-dbus-kobj
1707 KERNEL_DBUS_INCLUDES=kernel-dbus-includes
1711 AC_MSG_RESULT($dbus)
1714 dnl --------------------------------------------------------------------
1715 dnl Configuration Output Section
1716 dnl --------------------------------------------------------------------
1721 AC_SUBST(aros_flavour)
1722 AC_SUBST(aros_flavour_uc)
1723 AC_SUBST(AROS_BUILDDIR)
1724 AC_SUBST(AROS_BUILDDIR_UNIX)
1726 AC_SUBST(AROS_PORTSSRCDIR)
1729 AC_SUBST(aros_cc_pre)
1730 AC_SUBST(aros_host_strip)
1731 AC_SUBST(aros_host_arch)
1732 AC_SUBST(aros_host_cpu)
1733 AC_SUBST(aros_host_cc)
1734 AC_SUBST(aros_host_ar)
1735 AC_SUBST(aros_host_ranlib)
1736 AC_SUBST(aros_host_ld)
1737 AC_SUBST(aros_host_make)
1738 AC_SUBST(aros_host_cflags)
1739 AC_SUBST(aros_host_ldflags)
1740 AC_SUBST(aros_host_debug)
1741 AC_SUBST(aros_host_mkdep)
1742 AC_SUBST(aros_host_mkargs)
1743 AC_SUBST(aros_host_exe_suffix)
1744 AC_SUBST(aros_host_lib_suffix)
1745 AC_SUBST(aros_tools_dir)
1746 AC_SUBST(aros_host_aclocal)
1747 AC_SUBST(aros_host_autoconf)
1748 AC_SUBST(aros_host_autoheader)
1749 AC_SUBST(aros_host_automake)
1752 AC_SUBST(aros_target_guitheme)
1753 AC_SUBST(aros_target_iconset)
1754 AC_SUBST(aros_target_bootloader)
1755 AC_SUBST(aros_target_arch)
1756 AC_SUBST(aros_target_cpu)
1757 AC_SUBST(aros_target_variant)
1758 AC_SUBST(aros_target_suffix)
1759 AC_SUBST(aros_target_incl)
1760 AC_SUBST(aros_target_ar)
1761 AC_SUBST(aros_target_ranlib)
1762 AC_SUBST(aros_kernel_nm)
1763 AC_SUBST(orig_target_cc)
1764 AC_SUBST(aros_target_cc)
1765 AC_SUBST(aros_kernel_cc)
1766 AC_SUBST(aros_target_as)
1767 AC_SUBST(orig_target_ld)
1768 AC_SUBST(aros_target_ld)
1769 AC_SUBST(aros_kernel_ld)
1770 AC_SUBST(aros_target_cc_includes)
1771 AC_SUBST(aros_target_cc_path)
1772 AC_SUBST(aros_target_objdump)
1773 AC_SUBST(aros_target_objcopy)
1774 AC_SUBST(aros_target_strip)
1775 AC_SUBST(aros_target_nm)
1776 AC_SUBST(aros_kernel_rescomp)
1777 AC_SUBST(aros_shared_default)
1778 AC_SUBST(aros_shared_ld)
1779 AC_SUBST(aros_object_format)
1780 AC_SUBST(aros_compiler_libs)
1781 AC_SUBST(aros_arch_libs)
1783 AC_SUBST(aros_config_cflags)
1784 AC_SUBST(aros_config_aflags)
1785 AC_SUBST(aros_config_ldflags)
1787 AC_SUBST(aros_shared_cflags)
1788 AC_SUBST(aros_shared_aflags)
1789 AC_SUBST(aros_shared_ldflags)
1790 AC_SUBST(aros_kernel_cflags)
1791 AC_SUBST(aros_kernel_ldflags)
1792 AC_SUBST(aros_debug_cflags)
1793 AC_SUBST(aros_debug_aflags)
1794 AC_SUBST(aros_debug_ldflags)
1795 AC_SUBST(aros_target_genmap)
1796 AC_SUBST(aros_target_strip_flags)
1799 AC_SUBST(x11_hidd_target)
1800 AC_SUBST(sdl_hidd_target)
1802 AC_SUBST(aros_default_wbwidth)
1803 AC_SUBST(aros_default_wbheight)
1804 AC_SUBST(aros_default_wbdepth)
1805 AC_SUBST(DO_XSHM_SUPPORT)
1806 AC_SUBST(DO_VIDMODE_SUPPORT)
1808 AC_SUBST(aros_host_x11_includes)
1809 AC_SUBST(aros_host_x11_libdirs)
1810 AC_SUBST(aros_host_sdl_cflags)
1811 AC_SUBST(aros_host_sdl_libs)
1813 # Native version related
1814 AC_SUBST(aros_serial_debug)
1816 # Palm native version related
1817 AC_SUBST(aros_palm_debug_hack)
1819 # Unix/Hosted version related
1820 AC_SUBST(aros_nesting_supervisor)
1823 AC_SUBST(ENABLE_DBUS)
1824 AC_SUBST(DBUS_CFLAGS)
1825 AC_SUBST(DBUS_LIBFLAGS)
1826 AC_SUBST(KERNEL_DBUS_KOBJ)
1827 AC_SUBST(KERNEL_DBUS_INCLUDES)
1830 AC_SUBST(ENABLE_X11)
1833 AC_SUBST(aros_debug)
1834 AC_SUBST(aros_mungwall_debug)
1835 AC_SUBST(aros_stack_debug)
1836 AC_SUBST(aros_modules_debug)
1838 # Collect-aros stuff: "-ius" to ignore undefined symbols
1839 AC_SUBST(ignore_undefined_symbols)
1841 # C compiler related
1842 AC_SUBST(gcc_target_cpu)
1844 dnl Prepare for output, make up all the generated patches
1845 case "$aros_flavour" in
1846 emulation) aros_flavour_uc="AROS_FLAVOUR_EMULATION"
1847 aros_flavour="emulation" ;;
1848 emulcompat) aros_flavour_uc="(AROS_FLAVOUR_EMULATION|AROS_FLAVOUR_BINCOMPAT)"
1849 aros_flavour="emulation" ;;
1850 standalone) aros_flavour_uc="AROS_FLAVOUR_STANDALONE"
1851 aros_flavour="standalone";;
1852 native) aros_flavour_uc="AROS_FLAVOUR_NATIVE"
1853 aros_flavour="native" ;;
1854 nativecompat) aros_flavour_uc="(AROS_FLAVOUR_NATIVE|AROS_FLAVOUR_BINCOMPAT)"
1855 aros_flavour="native" ;;
1856 linklib) aros_flavour_uc="AROS_FLAVOUR_LINKLIB"
1857 aros_flavour="linklib" ;;
1858 palmnative) aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
1859 aros_flavour="palmnative" ;;
1860 mac68knative) aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
1861 aros_flavour="mac68knative" ;;
1862 ppcnative) aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_BINCOMPAT)"
1863 aros_flavour="ppcnative" ;;
1866 if test ! -d ${aros_inc_dir} ; then
1867 ${MKDIR} ${aros_inc_dir}
1869 if test ! -d ${aros_geninc_dir} ; then
1870 ${MKDIR} ${aros_geninc_dir}
1872 if test ! -d ${aros_hostcfg_dir} ; then
1873 ${MKDIR} ${aros_hostcfg_dir}
1875 if test ! -d ${aros_targetcfg_dir} ; then
1876 ${MKDIR} ${aros_targetcfg_dir}
1878 if test ! -d ${aros_tools_dir} ; then
1879 ${MKDIR} ${aros_tools_dir}
1881 if test ! -d ${aros_scripts_dir} ; then
1882 ${MKDIR} ${aros_scripts_dir}
1885 AC_CONFIG_HEADERS(${aros_geninc_dir}/host-conf.h:config/host-conf.h.in)
1887 AC_CONFIG_COMMANDS([compiler_executable],
1889 prefix=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}
1891 prefix="${prefix}/${aros_target_cpu}-aros"
1892 prefix2=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros
1896 chmod a+x ${prefix2}-gcc ${prefix2}-ld
1898 ln -sf ${prefix2}-gcc ${prefix}-gcc
1899 ln -sf ${prefix2}-ld ${prefix}-ld
1901 ln -sf $aros_target_as_ln$aros_host_exe_suffix ${prefix}-as
1902 ln -sf $aros_target_nm_ln$aros_host_exe_suffix ${prefix}-nm
1903 ln -sf $aros_target_ar_ln$aros_host_exe_suffix ${prefix}-ar
1904 ln -sf $aros_target_ranlib_ln$aros_host_exe_suffix ${prefix}-ranlib
1905 ln -sf $aros_target_objcopy_ln$aros_host_exe_suffix ${prefix}-objcopy
1906 ln -sf $aros_target_objdump_ln$aros_host_exe_suffix ${prefix}-objdump
1907 ln -sf $aros_target_strip_ln$aros_host_exe_suffix ${prefix}-strip
1909 ln -sf $aros_target_as_ln$aros_host_exe_suffix ${prefix2}-as
1910 ln -sf $aros_target_nm_ln$aros_host_exe_suffix ${prefix2}-nm
1911 ln -sf $aros_target_ar_ln$aros_host_exe_suffix ${prefix2}-ar
1912 ln -sf $aros_target_ranlib_ln$aros_host_exe_suffix ${prefix2}-ranlib
1913 ln -sf $aros_target_objcopy_ln$aros_host_exe_suffix ${prefix2}-objcopy
1914 ln -sf $aros_target_objdump_ln$aros_host_exe_suffix ${prefix2}-objdump
1915 ln -sf $aros_target_strip_ln$aros_host_exe_suffix ${prefix2}-strip
1918 aros_host_exe_suffix=${aros_host_exe_suffix}
1919 aros_tools_dir=${aros_tools_dir}
1920 aros_target_cpu=${aros_target_cpu}
1921 aros_target_arch=${aros_target_arch}
1922 aros_target_suffix=${aros_target_suffix}
1923 aros_target_nm_ln=${aros_target_nm_ln}
1924 aros_target_as_ln=${aros_target_as_ln}
1925 aros_target_ar_ln=${aros_target_ar_ln}
1926 aros_target_ranlib_ln=${aros_target_ranlib_ln}
1927 aros_target_objdump_ln=${aros_target_objdump_ln}
1928 aros_target_objcopy_ln=${aros_target_objcopy_ln}
1929 aros_target_strip_ln=${aros_target_strip_ln}
1932 AC_CONFIG_COMMANDS([genshared_executable],
1933 [chmod a+x ${aros_scripts_dir}/genshared],
1934 [aros_scripts_dir=${aros_scripts_dir}]
1936 AC_CONFIG_COMMANDS([genmf_executable],
1937 [chmod a+x ${aros_tools_dir}/genmf.py],
1938 [aros_tools_dir=${aros_tools_dir}]
1944 ${aros_inc_dir}/config.h:config/config.h.in
1945 ${aros_geninc_dir}/config.h:config/config.h.in
1946 ${aros_hostcfg_dir}/host.cfg:config/host.cfg.in
1947 ${aros_targetcfg_dir}/target.cfg:config/target.cfg.in
1949 ${aros_targetcfg_dir}/make.defaults:config/make.defaults.in
1950 ${aros_targetcfg_dir}/specs:config/specs.in
1951 ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-gcc:scripts/aros-gcc.in
1952 ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-ld:scripts/aros-ld.in
1953 ${aros_scripts_dir}/genshared:compiler/c_lib/source/lib_source/genshared.in
1954 ${aros_tools_dir}/genmf.py:tools/genmf/genmf.py
1955 tools/collect-aros/env.h
1960 dnl This is in order to not define SHARED_CFLAGS sometimes
1961 dnl We don't always do aros_shared_ar, aros_shared_cflags
1963 #XXX compatability...
1964 aros_shared_ar="$aros_shared_ld $aros_shared_ldflags -o"
1966 if test -n "$aros_shared_cflags" ; then
1967 echo "SHARED_CFLAGS := $aros_shared_cflags" >> ${aros_hostcfg_dir}/host.cfg
1968 echo "SHARED_AR := $aros_shared_ar" >> ${aros_hostcfg_dir}/host.cfg