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 AC_MSG_RESULT($AROS_BUILDDIR)
55 AC_MSG_CHECKING([AROS Source in .. ])
56 srcpwd=`cd ${srcdir} ; ${PWDCMD-pwd}`
58 AC_MSG_RESULT($SRCDIR)
60 # Parse the target field into something useful.
62 target_os=`echo $target | sed 's/^\([^-]*\)-\(.*\)$/\1/'`
63 target_cpu=`echo $target | sed 's/^\([^-]*\)-\(.*\)$/\2/'`
66 dnl --------------------------------------------------------------------
67 dnl Set the default Workbench resolution
68 dnl --------------------------------------------------------------------
69 aros_default_wbwidth=800
70 aros_default_wbheight=600
71 aros_default_wbdepth=4
73 dnl --------------------------------------------------------------------
74 dnl Host Configuration Section
75 dnl --------------------------------------------------------------------
77 dnl The idea here is to find out all the information we need about the
78 dnl host. This means things like tools for building directory structures,
79 dnl copying files around and the like.
81 # The first step is to find the host binaries.
82 # Check for a compiler.
87 # Check for a compatible awk
88 AC_CHECK_PROGS(AWK,[gawk nawk])
89 AROS_REQUIRED(gawk,$AWK)
90 AROS_PROG(MMAKE,mmake)
92 # Perform some default variable assignments. Note all of these will be
93 # Regenerated from the script, so there is no need to cache them.
96 AROS_TOOL_CCPATH(aros_host_ld,ld)
97 AROS_REQUIRED(ld,$aros_host_ld)
99 aros_host_cflags=$CFLAGS
100 aros_host_ldflags=$LDFLAGS
101 aros_host_debug="-g -O0"
102 aros_host_mkdep="\$(SRCDIR)/scripts/mkdep"
103 aros_host_mkargs="--no-print-directory"
104 aros_host_incl="/usr/include"
105 aros_host_exe_suffix="$EXEEXT"
106 aros_host_lib_suffix=""
108 AC_CHECK_PROGS(aros_host_aclocal,[aclocal aclocal19 aclocal-1.9])
109 AC_CHECK_PROGS(aros_host_autoconf,[autoconf autoconf259 autoconf253])
110 AC_CHECK_PROGS(aros_host_autoheader,[autoheader autoheader259 autoheader253])
111 AC_CHECK_PROGS(aros_host_automake,[automake automake19 automake-1.9])
113 AROS_REQUIRED(aclocal/aclocal19/aclocal-1.9, $aros_host_aclocal)
114 AROS_REQUIRED(automake/automake19/automake-1.9, $aros_host_automake)
116 case "$aros_host_cc" in
118 aros_host_cc_pipe="-pipe"
128 dnl Despite the name, this is really a host configuration variable.
129 aros_target_cc_includes=""
131 # This is the main host configuration section. It is where the host
132 # can change the values of any variables it needs to change. We do
133 # not look at anything that compiles to the target yet, we'll get
138 aros_host_arch="aros"
139 aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
145 aros_host_cpu="x86_64"
148 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
149 aros_host_cpu="$host_cpu"
155 aros_host_arch="linux"
156 aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
162 aros_host_cpu="x86_64"
171 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
172 aros_host_cpu="$host_cpu"
178 aros_host_cc="$aros_host_cc $aros_host_cc_pipe -I/usr/local/include"
179 aros_host_make="gmake"
180 aros_host_arch="freebsd"
183 aros_host_ldflags="$aros_host_ldflags -L/usr/local/lib -liconv"
185 dnl Need to override this here, it's just too hard later.
186 dnl This shouldn't be here at all...
187 dnl aros_target_cc_includes="/usr/include"
189 dnl FreeBSD 5.x (and later) has changed the default object format.
190 dnl The double [[]] is necessary to get around m4's quoting rules.
193 aros_object_format="elf_i386"
197 aros_object_format="elf_i386_fbsd"
204 aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
205 aros_host_arch="darwin"
214 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
215 aros_host_cpu="$host_cpu"
219 aros_host_ldflags="$aros_host_ldflags -liconv"
224 aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
225 aros_host_make="gmake"
226 aros_host_arch="dragonfly"
232 aros_host_cpu="x86_64"
235 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
236 aros_host_cpu="$host_cpu"
242 aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
243 aros_host_make="gmake"
244 aros_host_arch="netbsd"
253 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
254 aros_host_cpu="$host_cpu"
257 aros_host_lib_suffix=".0.0"
261 aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
262 aros_host_make="gmake"
263 aros_host_arch="openbsd"
269 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
270 aros_host_cpu="$host_cpu"
276 aros_host_arch="solaris"
277 aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
283 aros_host_cpu="sparc"
286 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
287 aros_host_cpu="$host_cpu"
293 aros_host_arch="morphos"
298 aros_host_arch="amiga"
303 TOUCH="/gg/bin/touch"
312 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
313 aros_host_cpu="$host_cpu"
319 aros_host_arch="cygwin"
320 aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
326 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
327 aros_host_cpu="$host_cpu"
333 aros_host_arch="mingw32"
334 aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
340 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
341 aros_host_cpu="$host_cpu"
346 AC_MSG_ERROR([Unsupported host architecture $host])
350 AROS_PROG(aros_host_ar,[ar],[cr])
351 AROS_REQUIRED(ar,$aros_host_ar)
352 AROS_PROG(aros_host_ranlib,ranlib)
353 AROS_REQUIRED(ranlib,$aros_host_ranlib)
354 AROS_PROG(aros_host_strip,strip)
355 AROS_REQUIRED(strip,$aros_host_strip)
357 AROS_PROG(RM,[rm],[-rf])
358 AROS_REQUIRED(rm,$RM)
360 AROS_REQUIRED(cp,$CP)
362 AROS_REQUIRED(mv,$MV)
363 AROS_PROG(ECHO,[echo])
364 AROS_REQUIRED(echo,$ECHO)
365 AROS_PROG(MKDIR,[mkdir],[-p])
366 AROS_REQUIRED(mkdir,$MKDIR)
367 AROS_PROG(TOUCH,[touch])
368 AROS_REQUIRED(touch,$TOUCH)
369 AROS_PROG(SORT,[sort])
370 AROS_REQUIRED(sort,$SORT)
371 AROS_PROG(UNIQ,[uniq])
372 AROS_REQUIRED(uniq,$UNIQ)
373 AROS_PROG(NOP,[true])
374 AROS_REQUIRED(true,$NOP)
376 AROS_REQUIRED(cat,$CAT)
377 AROS_PROG(BISON,[bison])
378 AROS_REQUIRED(bison,$BISON)
379 AROS_PROG(FLEX,[flex])
380 AROS_REQUIRED(flex,$FLEX)
381 AROS_PROG(PNGTOPNM,[pngtopnm])
382 AROS_REQUIRED(pngtopnm,$PNGTOPNM)
383 AROS_PROG(PPMTOILBM,[ppmtoilbm])
384 AROS_REQUIRED(ppmtoilbm,$PPMTOILBM)
386 AROS_REQUIRED(sed,$SED)
387 AROS_PROG(CHMOD,[chmod])
388 AROS_REQUIRED(chmod,$CHMOD)
390 AM_PATH_PYTHON(2.2.1)
397 dnl ---------------------------------------------------------------------------
398 dnl Look for things about the host system, good for hosted targets.
399 dnl ---------------------------------------------------------------------------
401 # Check for some includes for the X11 HIDD and the kernel
402 AC_CHECK_HEADERS([sys/ipc.h sys/shm.h \
403 sys/mmap.h sys/mman.h sysexits.h \
404 sys/statfs.h sys/statvfs.h sys/vfs.h sys/param.h \
407 AC_CHECK_HEADERS([sys/mount.h],,,[#include <sys/param.h>])
424 AC_CHECK_MEMBERS(struct tm.tm_gmtoff)
426 # Look for some functions
427 AC_CHECK_FUNCS([getpagesize kqueue statfs statvfs \
428 clone kse_create rfork_thread thr_create sa_register \
429 getcontext makecontext setcontext sigaltstack swapcontext])
434 dnl --------------------------------------------------------------------
435 dnl Target Configuration Section
436 dnl --------------------------------------------------------------------
438 dnl The target configuration section is responsible for setting up all
439 dnl the paths for includes, and tools required to build AROS to some
440 dnl particular target.
442 aros_config_cflags="-Wall -Werror-implicit-function-declaration"
443 aros_config_aflags="-Wall -x assembler-with-cpp -c"
444 aros_config_ldflags=""
446 aros_shared_default=yes
448 aros_shared_cflags="-fPIC"
449 aros_shared_aflags=""
450 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
451 aros_kernel_ldflags="-Wl,-rpath,./lib"
453 aros_target_ar_flags="cr"
454 aros_target_nm_flags="-C -ul"
455 aros_target_strip_flags="--strip-unneeded -R.comment"
460 aros_target_genmap="-Wl,-Map -Xlinker"
462 # Native flavour stuff
464 aros_serial_debug="0"
466 # Palm native flavour stuff
467 aros_palm_debug_hack="0"
470 aros_nesting_supervisor="0"
472 # Collect-aros stuff: "-ius" to ignore undefined symbols
473 ignore_undefined_symbols=""
475 #-----------------------------------------------------------------------------
478 # GCC 4.1+ has a stack protection feature that requires OS support. Ubuntu has
479 # it switched on by default, and we use the host compiler, so it compiles AROS
480 # code with this enabled resulting in link failures as we don't have support
483 # We use two methods to disable it. For the host compiler (used to compile
484 # some hosted modules), we test to see if the compiler supports stack
485 # protection, and if it does we disable it in AROS_CONFIG_CFLAGS. This should
486 # work on all platforms.
488 # For the "cross" compiler we clear the "ssp_default" spec in config/specs.in
489 # (this is done unconditionally, as it should have no effect on compilers
490 # without the stack protection feature). This may be specific to the way that
491 # Ubuntu enables the feature, so may not work everywhere. My specs-fu isn't
492 # strong enough to disable it in a generic way though, so we'll live with it
493 # until another vendor ships GCC with it enabled in a different way, and deal
497 AC_MSG_CHECKING([whether ${CC} accepts -fno-stack-protector])
498 save_cflags="$CFLAGS"
499 CFLAGS="$CFLAGS -fno-stack-protector"
500 AC_TRY_COMPILE(,, use_no_stack_protector="yes", use_no_stack_protector="no")
501 AC_MSG_RESULT($use_no_stack_protector)
502 if test "x-$use_no_stack_protector" = "x-yes" ; then
503 aros_host_cflags="$aros_host_cflags -fno-stack-protector"
505 CFLAGS="$save_cflags"
507 #-----------------------------------------------------------------------------
509 # Disable pointer-signedness warnings if the compiler recognises the option
510 # (this only works for the host compiler at the moment)
512 AC_MSG_CHECKING([whether ${CC} accepts -Wno-pointer-sign])
513 save_cflags="$CFLAGS"
514 CFLAGS="$CFLAGS -Wno-pointer-sign"
515 AC_TRY_COMPILE(,, use_no_sign_warning="yes", use_no_sign_warning="no")
516 AC_MSG_RESULT($use_no_sign_warning)
517 if test "x-$use_no_sign_warning" = "x-yes" ; then
518 aros_host_cflags="$aros_host_cflags -Wno-pointer-sign"
520 CFLAGS="$save_cflags"
522 #-----------------------------------------------------------------------------
524 AC_MSG_CHECKING([for type of build])
525 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")
527 if test "$build_type" = "nightly"; then
528 build_type_string="NIGHTLY"
529 elif test "$build_type" = "snapshot"; then
530 build_type_string="SNAPSHOT"
531 elif test "$build_type" = "milestone"; then
532 build_type_string="MILESTONE"
533 elif test "$build_type" = "release"; then
534 build_type_string="RELEASE"
536 build_type_string="PERSONAL"
537 build_type="personal"
540 aros_config_cflags="$aros_config_cflags -DAROS_BUILD_TYPE=AROS_BUILD_TYPE_$build_type_string"
542 AC_MSG_RESULT($build_type)
544 #-----------------------------------------------------------------------------
545 all_debug_types="messages stack mungwall modules symbols"
547 AC_MSG_CHECKING([which debug types to enable])
548 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)]),
549 debug="$enableval",debug="")
551 if test "$debug" = "" -o "$debug" = "no"; then
553 elif test "$debug" = "yes"; then
557 if test "$debug" = "all" ; then
558 debug=$all_debug_types
559 for d in $all_debug_types; do
560 export aros_${d}_debug="1"
563 for d in $all_debug_types; do
564 export aros_${d}_debug="0"
568 if test "$debug" != "none"; then
569 debug=`echo $debug | sed s/,/\ /g`
572 for d2 in $all_debug_types; do
573 if test "$d2" = "$d"; then
578 if test "$found" = "0"; then
579 AC_MSG_ERROR([unrecognized debug type "$d". Available types are: all none $all_debug_types])
581 export aros_${d}_debug="1"
585 AC_MSG_RESULT($debug)
587 if test "$aros_messages_debug" = "1"; then
588 aros_messages_debug="-DADEBUG=1 -DMDEBUG=1"
590 aros_messages_debug=""
592 if test "$aros_symbols_debug" = "1"; then
593 aros_symbols_debug="-g"
595 aros_symbols_debug=""
598 # These are the flags to pass when compiling debugged programs
599 aros_debug_cflags="$aros_symbols_debug $aros_messages_debug"
601 aros_debug_ldflags="$aros_symbols_debug"
605 #-----------------------------------------------------------------------------
606 # Checking if we should build crosstools..
607 AC_MSG_CHECKING([whether to build crosstools])
608 AC_ARG_ENABLE(crosstools,AC_HELP_STRING([--enable-crosstools],[Build cross-compiler toolchains if necessary (default=no).]),crosstools="$enableval",crosstools="no")
609 if test "$crosstools" != "" -a "$crosstools" != "no"; then
611 aros_crosstools="yes"
616 #-----------------------------------------------------------------------------
617 # Checking for distcc and ccache.
619 # Always apply the transforms in this particular order. Basically you should
620 # always run 'ccache distcc compiler' in that order for the best performance.
622 AC_MSG_CHECKING([whether to enable distcc])
623 AC_ARG_ENABLE(distcc,AC_HELP_STRING([--enable-distcc],[Use distcc as a front end to the compiler (default=no).]),distcc="$enableval",distcc="no")
624 if test "$distcc" != "" -a "$distcc" != "no"; then
625 # AC_CHECK_PROG will print out the result in this case
626 AC_PATH_PROG(DISTCC,[distcc],distcc,)
631 AC_MSG_CHECKING([whether to enable ccache])
632 AC_ARG_ENABLE(ccache,AC_HELP_STRING([--enable-ccache],[Use ccache as a front end to the compiler (default=no).]),ccache="$enableval",ccache="no")
633 if test "$ccache" != "" -a "$ccache" != "no"; then
634 # AC_CHECK_PROG will print out the result in this case
635 AC_CHECK_PROG(CCACHE,[ccache],ccache,)
640 #-----------------------------------------------------------------------------
641 AC_MSG_CHECKING([what optimization flags to use])
642 AC_ARG_WITH(optimization,AC_HELP_STRING([--with-optimization=FLAGS],[Use optimization flags FLAGS (default=-O2).]),optimization="$withval",optimization="unknown")
643 if test "$optimization" = "unknown"; then
644 dnl default is -O2 for normal builds, -O0 for debug builds
645 if test "$debug" != "none"; then
651 aros_config_cflags="$aros_config_cflags $optimization"
652 AC_MSG_RESULT($optimization)
654 #-----------------------------------------------------------------------------
655 AC_MSG_CHECKING([what target variant to enable])
656 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")
657 if test "$target_variant" = "none"; then
658 aros_target_variant=""
659 aros_target_suffix=""
661 aros_target_variant="$target_variant"
662 aros_target_suffix="-$target_variant"
664 AC_MSG_RESULT($enableval)
666 target_bootloader="none"
668 #-----------------------------------------------------------------------------
669 # This is the target configuration switch.
672 aros_target_arch="linux"
673 case "$target_cpu" in
675 aros_target_cpu="m68k"
676 aros_object_format="m68kelf"
677 aros_flavour="emulcompat"
678 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D__mc68000 -D__linux__"
679 aros_shared_ldflags="-Wl,-T,\$(TOP)/config/linux/m68k/script.so"
680 aros_kernel_ldflags="-Wl,-rpath,./lib,-T,\$(TOP)/config/linux/m68k/script.normal"
681 gcc_target_cpu="mc68000"
684 aros_target_cpu="i386"
685 aros_object_format="elf_i386"
686 aros_flavour="emulation"
687 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__linux__"
688 aros_config_cflags="$aros_config_cflags -m32 -march=i486"
689 aros_kernel_cflags="$aros_kernel_cflags -m32 -march=i486"
690 aros_config_aflags="$aros_config_aflags -m32 -march=i486"
691 aros_config_ldflags="-m32 -march=i486"
692 aros_kernel_ldflags="-melf_i386"
693 aros_default_wbdepth=8
694 gcc_target_cpu="i386"
697 aros_target_cpu="x86_64"
698 aros_object_format="elf_x86_64"
699 aros_flavour="emulation"
700 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64 -D__linux__"
701 aros_config_cflags="$aros_config_cflags -mno-red-zone"
702 aros_default_wbdepth=8
703 gcc_target_cpu="x86_64"
706 aros_target_cpu="ppc"
707 aros_object_format="elf32ppc"
708 aros_flavour="emulation"
709 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc -D__linux__"
710 aros_default_wbdepth=8
714 # Same as powerpc, but I need this for the nightly build to work again.
715 # Actually, the nightly should be made working with powerpc target.
716 # That just was too much work for the moment, another week or two.
718 aros_target_cpu="ppc"
719 aros_object_format="elf32ppc"
720 aros_flavour="emulation"
721 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc -D__linux__"
722 aros_default_wbdepth=8
726 AC_MSG_ERROR("Unknown CPU for Linux -- $target_cpu")
732 aros_target_arch="pc"
733 aros_shared_default="no"
734 target_bootloader="grub2"
735 case "$target_cpu" in
737 aros_target_cpu="i386"
739 dnl If somebody hasn't already set the target object
740 dnl format, then use this value. Mostly to support
741 dnl FreeBSD cross-compilation.
742 dnl TODO: Remove when we always use our compiler.
744 if test "$aros_object_format" = "" ; then
745 aros_object_format="elf_i386"
747 aros_flavour="standalone"
748 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
749 aros_config_cflags="$aros_config_cflags -m32 -march=i486"
750 aros_kernel_cflags="$aros_kernel_cflags -m32 -march=i486"
751 aros_config_aflags="$aros_config_aflags -m32 -march=i486"
752 aros_config_ldflags="-m32 -march=i486"
753 aros_kernel_ldflags="-melf_i386"
754 aros_default_wbwidth=640
755 aros_default_wbheight=480
756 gcc_target_cpu="i386"
759 aros_target_cpu="x86_64"
761 if test "$aros_object_format" = "" ; then
762 aros_object_format="elf_x86_64"
764 aros_flavour="standalone"
765 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
766 aros_config_cflags="$aros_config_cflags -fno-asynchronous-unwind-tables -mno-red-zone"
767 aros_kernel_ldflags=""
768 aros_default_wbwidth=640
769 aros_default_wbheight=480
770 gcc_target_cpu="x86_64"
773 AC_MSG_ERROR("Unknown native CPU -- $target_cpu")
779 aros_target_arch="prep"
780 aros_shared_default="no"
781 aros_target_cpu="ppc"
782 aros_object_format="elf32ppc"
783 aros_flavour="ppcnative"
784 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
785 aros_kernel_ldflags=""
786 aros_default_wbwidth=640
787 aros_default_wbheight=480
792 aros_target_arch="freebsd"
793 aros_target_cpu="i386"
794 aros_flavour="emulation"
795 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
796 gcc_target_cpu="i386"
798 aros_target_strip_flags="-x"
802 aros_target_arch="darwin"
803 aros_flavour="emulation"
805 dnl This test bypass was implemented for Darwin by port's author.
806 dnl I wonder why, since darwin port needs this function.
807 dnl I left it here just because port author did it.
809 case "$target_cpu" in
811 aros_target_cpu="i386"
812 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
813 gcc_target_cpu="i386"
814 aros_object_format="elf_i386"
815 aros_target_strip_flags="-x"
818 AC_MSG_ERROR("Unsupported target CPU for darwin hosted flavour -- $target_cpu")
824 aros_target_arch="dragonfly"
825 aros_flavour="emulation"
826 case "$target_cpu" in
828 aros_target_cpu="i386"
829 aros_object_format="elf_i386"
830 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__DragonFly__"
833 aros_target_cpu="x86_64"
834 aros_object_format="elf_x86_64"
835 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64 -D__DragonFly__"
838 AC_MSG_ERROR("Unknown CPU for DragonFly -- $target_cpu")
844 aros_target_arch="netbsd"
845 case "$target_cpu" in
847 aros_target_cpu="m68k"
848 aros_object_format="m68kelf"
849 aros_flavour="emulcompat"
850 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D__mc68000 -D__NetBSD__"
851 gcc_target_cpu="mc68000"
854 aros_target_cpu="i386"
855 aros_object_format="elf_i386"
856 aros_flavour="emulation"
857 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__NetBSD__"
858 aros_default_wbdepth=8
859 gcc_target_cpu="i386"
862 AC_MSG_ERROR("Unknown CPU for NetBSD -- $target_cpu")
865 aros_target_genmap="-Wl,-M -Xlinker >"
866 aros_flavour="emulation"
867 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
871 aros_target_arch="openbsd"
872 case "$target_cpu" in
874 aros_target_cpu="i386"
875 aros_object_format="elf_i386"
876 aros_flavour="emulation"
877 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__OpenBSD__"
878 gcc_target_cpu="i386"
881 AC_MSG_ERROR("Unknown CPU for OpenBSD -- $target_cpu")
884 aros_target_genmap="-Wl,-M -Xlinker >"
885 aros_target_nm_flags="-u"
886 aros_flavour="emulation"
890 aros_target_arch="solaris"
891 case "$target_cpu" in
893 aros_target_cpu="i386"
894 aros_object_format="elf_i386"
895 aros_flavour="emulation"
896 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__Solaris__"
897 aros_default_wbdepth=8
898 gcc_target_cpu="i386"
901 aros_target_cpu="sparc"
902 aros_object_format="elf_sparc"
903 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dsparc -D__Solaris__"
904 gcc_target_cpu="sparc"
907 AC_MSG_ERROR("Unknown CPU for Solaris -- $target_cpu")
910 aros_config_cflags="$aros_config_cflags -D$aros_target_cpu"
911 aros_flavour="emulation"
915 aros_target_arch="morphos"
916 aros_shared_default="no"
917 aros_target_cpu="ppc"
918 aros_object_format="elf_ppc"
919 aros_flavour="nativecompat"
920 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
925 aros_target_arch="sam440"
926 aros_shared_default="no"
927 aros_target_cpu="ppc"
928 aros_object_format="elf32ppc"
929 aros_flavour="ppcnative"
930 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
931 aros_kernel_ldflags=""
932 aros_default_wbwidth=1024
933 aros_default_wbheight=768
934 aros_config_cflags="$aros_config_cflags -mcpu=440fp -mno-toc -fno-asynchronous-unwind-tables"
935 gcc_target_cpu="powerpc"
939 aros_target_arch="efika"
940 aros_shared_default="no"
941 aros_target_cpu="arm"
942 aros_object_format="armelf_linux_eabi"
943 aros_flavour="standalone"
944 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
945 aros_kernel_ldflags=""
946 aros_default_wbwidth=1024
947 aros_default_wbheight=600
948 aros_arch_libs="-laeabi"
949 aros_config_cflags="$aros_config_cflags -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -fno-asynchronous-unwind-tables -fno-exceptions"
950 aros_config_aflags="$aros_config_aflags -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -fno-asynchronous-unwind-tables -fno-exceptions"
954 aros_target_arch="chrp"
955 aros_shared_default="no"
956 aros_target_cpu="ppc"
957 aros_object_format="elf32ppc"
958 aros_flavour="ppcnative"
959 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
960 aros_kernel_ldflags=""
961 aros_default_wbwidth=640
962 aros_default_wbheight=480
963 aros_config_cflags="$aros_config_cflags -mno-toc -fno-asynchronous-unwind-tables"
964 gcc_target_cpu="powerpc"
965 case "$aros_target_variant" in
967 aros_config_cflags="$aros_config_cflags -DBIG_ENDIAN_OHCI=1 -mcpu=603e"
973 aros_target_arch="amiga"
974 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D_AMIGA -DAMIGA"
975 aros_shared_default="no"
977 aros_config_cflags="$aros_config_cflags -fomit-frame-pointer -fbuiltin -ffreestanding"
979 case "$target_cpu" in
981 aros_target_cpu="m68k"
982 aros_object_format="m68kelf"
983 aros_flavour="nativecompat"
984 gcc_target_cpu="mc68000"
988 aros_flavour="native"
992 AC_MSG_ERROR("Unknown CPU for Amiga $target_cpu")
998 aros_target_arch="mingw32"
999 aros_shared_default="no"
1002 case "$target_cpu" in
1004 aros_target_cpu="i386"
1005 aros_object_format="elf_i386"
1006 aros_flavour="emulation"
1007 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1008 aros_shared_cflags=""
1009 aros_default_wbdepth=8
1010 gcc_target_cpu="i386"
1011 aros_target_cc="i386-aros-gcc"
1012 aros_target_ld="i386-aros-ld"
1013 aros_target_as="i386-aros-as"
1014 aros_target_ar="i386-aros-ar"
1015 aros_target_ranlib="i386-aros-ranlib"
1016 aros_target_nm="i386-aros-nm"
1017 aros_target_strip="i386-aros-strip"
1018 aros_target_objcopy="i386-aros-objcopy"
1019 aros_target_objdump="i386-aros-objdump"
1020 target_tool_prefix="i386-mingw32-"
1023 AC_MSG_ERROR("Unknown CPU for Mingw32 -- $target_cpu")
1026 if test $host_os = "cygwin"; then
1027 aros_kernel_cflags="-mno-cygwin"
1031 aros_target_arch="pp"
1032 aros_shared_default="no"
1033 case "$target_cpu" in
1035 aros_target_cpu="m68k"
1036 aros_object_format="m68kelf"
1037 aros_flavour="palmnative"
1038 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
1039 aros_default_wbwidth=160
1040 aros_default_wbheight=160
1041 aros_default_wbdepth=1
1042 aros_target_ar_flags="cru"
1043 aros_compiler_libs="-lgcc1"
1044 aros_shared_default=no
1045 aros_shared_cflags="-fpic"
1046 aros_shared_aflags=""
1047 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
1048 aros_kernel_ldflags="-Wl,-rpath,./lib"
1049 aros_debug_cflags="-Wall -Werror-implicit-function-declaration $aros_symbols_debug $aros_messages_debug -mc68000 -Wa,-mc68000"
1050 aros_debug_aflags=""
1051 aros_debug_ldflags="$aros_symbols_debug"
1052 aros_mungwall_debug="0"
1053 aros_modules_debug="0"
1054 gcc_target_cpu="mc68000"
1055 ignore_undefined_symbols="-ius"
1058 AC_MSG_ERROR("Unknown CPU for PalmPilot -- $target_cpu")
1064 aros_target_arch="mac"
1065 aros_shared_default="no"
1066 case "$target_cpu" in
1068 aros_target_cpu="m68k"
1069 aros_object_format="m68kelf"
1070 aros_flavour="mac68knative"
1071 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
1072 aros_default_wbwidth=512
1073 aros_default_wbheight=384
1074 aros_default_wbdepth=8
1075 aros_target_ar_flags="cru"
1076 aros_compiler_libs="-lgcc1"
1077 aros_shared_default=no
1078 aros_shared_cflags="-fpic"
1079 aros_shared_aflags=""
1080 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
1081 aros_kernel_ldflags="-Wl,-rpath,./lib"
1082 aros_debug_cflags="-Wall -Werror-implicit-function-declaration $aros_symbols_debug $aros_messages_debug -mc68000"
1083 aros_debug_aflags=""
1084 aros_debug_ldflags="$aros_symbols_debug"
1085 aros_mungwall_debug="0"
1086 aros_modules_debug="0"
1087 gcc_target_cpu="mc68000"
1088 ignore_undefined_symbols="-ius"
1091 AC_MSG_ERROR("Unknown CPU for Mac68k -- $target_cpu")
1097 AC_MSG_ERROR([Unsupported target architecture $target])
1101 AC_MSG_CHECKING([Where to download sourcecode for external ports])
1102 AC_ARG_WITH(portssources,AC_HELP_STRING([--with-portssources=DIR],[Where to download sourcecode for external ports]),with_portssrcdir=$withval,with_portssrcdir="default")
1103 if test "$with_portssrcdir" = "default"; then
1104 AROS_PORTSSRCDIR="$AROS_BUILDDIR/bin/Sources"
1106 AROS_PORTSSRCDIR="$with_portssrcdir"
1108 AC_MSG_RESULT($AROS_PORTSSRCDIR)
1110 AC_MSG_CHECKING([which bootloader to use])
1111 AC_ARG_WITH(bootloader,AC_HELP_STRING([--with-bootloader=NAME],[Use a specific bootloader]),target_bootloader=$withval,target_bootloader=$target_bootloader)
1112 if test "$target_bootloader" = "none"; then
1113 aros_target_bootloader=""
1115 aros_target_bootloader="$target_bootloader"
1117 AC_MSG_RESULT($target_bootloader)
1119 AC_MSG_CHECKING([which icon-set to use])
1120 AC_ARG_WITH(iconset,AC_HELP_STRING([--with-iconset=NAME],[Use a specific Icon-set (default=Gorilla).]),target_iconset=$withval,target_iconset="default")
1121 if test "$target_iconset" = "default"; then
1122 aros_target_iconset="Gorilla"
1123 target_iconset="default (Gorilla)"
1125 aros_target_iconset="$target_iconset"
1127 AC_MSG_RESULT($target_iconset)
1129 AC_MSG_CHECKING([which GUI Theme to use])
1130 AC_ARG_WITH(theme,AC_HELP_STRING([--with-theme=NAME],[Use a specific GUI Theme]),target_guitheme=$withval,target_guitheme="default")
1131 if test "$target_guitheme" = "default"; then
1132 aros_target_guitheme="Ice"
1134 aros_target_guitheme="$target_guitheme"
1136 AC_MSG_RESULT($aros_target_guitheme)
1138 # Find out if we are cross-compiling (i.e. if we can't use the host compiler
1141 if test "$aros_host_cpu" != "$aros_target_cpu" ; then
1144 if test "$aros_host_cpu" == "x86_64" ; then
1145 if test "$aros_target_cpu" == "i386" ; then
1146 if test "$aros_target_arch" != "mingw32"; then
1151 if test "$aros_host_arch" == "darwin" ; then
1155 # Set prefix for target compiler etc. if we're cross-compiling
1156 # (should possibly be earlier but needs to be after AC_PROG_CC)
1157 if test "$cross_compiling" = "yes" ; then
1158 if test "$target_tool_prefix" = ""; then
1159 target_tool_prefix=${target_cpu}-elf-
1161 CC=${target_tool_prefix}gcc
1164 #-----------------------------------------------------------------------------
1166 # Disable pointer-signedness warnings if the compiler recognises the option
1168 AC_MSG_CHECKING([whether ${CC} accepts -Wno-pointer-sign])
1169 save_cflags="$CFLAGS"
1170 CFLAGS="$CFLAGS -Wno-pointer-sign"
1171 AC_TRY_COMPILE(,, use_no_sign_warning="yes", use_no_sign_warning="no")
1172 AC_MSG_RESULT($use_no_sign_warning)
1173 if test "x-$use_no_sign_warning" = "x-yes" ; then
1174 aros_config_cflags="$aros_config_cflags -Wno-pointer-sign"
1176 CFLAGS="$save_cflags"
1178 #-----------------------------------------------------------------------------
1180 # Find all the tools we need to compile. This could be cross-compiling
1181 # though! If that is the case we use the GNU form of the target and
1182 # simply add this to the front of the binary name. This is rather simple,
1183 # but it should work under most circumstances.
1185 # The default tools are to use the same as the host, but only if the
1186 # host and target CPU are the same. With GCC this is normally enough.
1190 aros_shared_ld="$aros_host_ld"
1192 aros_target_mkdep="$aros_host_mkdep"
1193 aros_target_incl_def="$aros_host_incl"
1195 aros_kernel_cc="$CC"
1197 # The default tools executables to be linked to.
1198 if test "$aros_target_cc" != ""; then
1199 AC_PATH_PROG(aros_target_cc,$aros_target_cc)
1200 AROS_REQUIRED(gcc,$aros_target_cc)
1202 if test "$aros_target_ld" != ""; then
1203 AC_PATH_PROG(aros_target_ld,$aros_target_ld)
1204 AROS_REQUIRED(ld,$aros_target_ld)
1207 if test "$crosstools" != "yes"; then
1208 AROS_TOOL_TARGET(aros_target_as_ln,as,$aros_target_as)
1209 AROS_REQUIRED(as,$aros_target_as_ln)
1210 AROS_TOOL_TARGET(aros_kernel_ld,ld,$aros_kernel_ld)
1211 AROS_REQUIRED(ld,$aros_kernel_ld)
1212 AROS_TOOL_TARGET(aros_target_ar_ln,ar,$aros_target_ar)
1213 AROS_REQUIRED(ar,$aros_target_ar_ln)
1214 AROS_TOOL_TARGET(aros_target_nm_ln,nm,$aros_target_nm)
1215 AROS_REQUIRED(nm,$aros_target_nm_ln)
1216 AROS_TOOL_TARGET(aros_target_objcopy_ln,objcopy,$aros_target_objcopy)
1217 AROS_REQUIRED(objcopy,$aros_target_objcopy_ln)
1218 AROS_TOOL_TARGET(aros_target_objdump_ln,objdump,$aros_target_objdump)
1219 AROS_REQUIRED(objdump,$aros_target_objdump_ln)
1220 AROS_TOOL_TARGET(aros_target_ranlib_ln,ranlib,$aros_target_ranlib)
1221 AROS_REQUIRED(ranlib,$aros_target_ranlib_ln)
1222 AROS_TOOL_TARGET(aros_target_strip_ln,strip,$aros_target_strip)
1223 AROS_REQUIRED(strip,$aros_target_strip_ln)
1226 if test "$rescomp" != ""; then
1227 if test "$cross_compiling" = "yes" ; then
1228 rescomp=${target_tool_prefix}${rescomp}
1230 AC_PATH_PROG(aros_kernel_rescomp,$rescomp)
1231 AROS_REQUIRED($rescomp,$aros_kernel_rescomp)
1234 aros_hostcfg_dir="bin/${aros_host_arch}-${aros_host_cpu}/gen/config"
1235 aros_targetcfg_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/config"
1236 aros_inc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/AROS/Development/include/aros"
1237 aros_gendir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen"
1238 aros_geninc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/include/aros"
1239 aros_tools_dir="bin/${aros_host_arch}-${aros_host_cpu}/tools"
1240 aros_scripts_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/scripts"
1242 # aros_cc_pre is a variable that is added to the front of the compiler name
1243 # in the generated aros-gcc shell script. We need this to enable the cache
1244 # to work across cleaned builds. Also, support DISTCC using the correct
1245 # environment variable.
1248 if test "x${DISTCC}" != "x" ; then
1249 if test "x${CCACHE}" != "x" ; then
1250 aros_cc_pre="env CCACHE_PREFIX=${DISTCC} ${CCACHE} "
1252 aros_cc_pre="${DISTCC} "
1255 if test "x${CCACHE}" != "x" ; then
1256 aros_cc_pre="${CCACHE} "
1260 prefix="${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros"
1262 AC_SUBST(aros_target_nostdinc_cflags,-nostdinc)
1263 AC_SUBST(aros_target_nostartup_ldflags,-nostartfiles)
1264 AC_SUBST(aros_target_nix_ldflags,-nix)
1265 AC_SUBST(aros_target_detach_ldflags,-detach)
1266 AC_SUBST(aros_target_nostdlib_ldflags,-nostdlib)
1269 if test "$aros_target_cc" = ""; then
1270 orig_target_cc=$aros_kernel_cc
1272 orig_target_cc=$aros_target_cc
1274 if test "$aros_target_ld" = ""; then
1275 orig_target_ld=$aros_kernel_ld
1277 orig_target_ld=$aros_target_ld
1279 if test "$GCC" = "yes"; then
1280 aros_target_cc_path=`$orig_target_cc -print-search-dirs | grep "programs: =" | cut -c 12-`
1282 aros_target_cc="${prefix}-gcc"
1283 aros_target_as="${prefix}-as"
1284 aros_target_ld="${prefix}-ld"
1285 aros_target_ar="${prefix}-ar $aros_target_ar_flags"
1286 aros_target_objcopy=${prefix}-objcopy
1287 aros_target_objdump=${prefix}-objdump
1288 aros_target_ranlib="${prefix}-ranlib $aros_target_ranlib_flags"
1289 aros_target_nm="${prefix}-nm $aros_target_nm_flags"
1290 aros_kernel_nm="${prefix}-nm"
1291 aros_target_strip=${prefix}-strip
1293 # Find the system include path. We can suggest that an alternative is
1294 # used if we don't get it correct. The default is to use /usr/include.
1295 # Which is set in the aros_target_incl_def variable.
1297 AC_ARG_ENABLE(includes,
1298 AC_HELP_STRING([--enable-includes=dir],[Alternative system include directory]),
1299 [aros_target_incl=$enable_includes], [aros_target_incl=$aros_target_incl_def])
1301 dnl find out about the target cc's include path
1302 AC_MSG_CHECKING([for the target compiler's include path])
1303 if test "$aros_target_cc_includes" = "" ; then
1304 #try to guess where the directory is
1305 aros_target_cc_includes=`dirname \`${orig_target_cc} -print-libgcc-file-name\``/include
1306 if ! test -d $aros_target_cc_includes; then
1307 #the directory doesn't exist, we need to do some more work
1308 aros_target_cc_includes=${PWD}/${aros_gendir}/cc_include
1310 #these are the headers we're looling for
1311 headers="limits.h mmintrin.h stdbool.h syslimits.h float.h \
1312 stddef.h xmmintrin.h iso646.h stdarg.h unwind.h \
1316 for h in $headers; do
1317 #which other headers each of the above headers needs?
1318 deps=$(echo "#include <$h>" | \
1319 $aros_host_cc -E -M - 2>/dev/null | \
1320 sed 's/^.*://; s/\\$/ /g; s/[[ \t]]\+/ /g')
1322 #copy all the needed headers to a directory beneath gendir
1325 dir=${aros_target_cc_includes}$(echo $(dirname $d) | \
1326 sed -n "s,^.*/include\(/.*\),\1,p")
1327 ! test -d $dir && mkdir -p $dir
1328 ! test -f $dir/$h && { cp $d $dir; chmod u+w $dir/$h; }
1333 AC_MSG_RESULT($aros_target_cc_includes)
1336 # For GCC < 4.0 -I- is used for giving the search path for '#include "..."'
1337 # On GCC >= 4.0 -iquote should be used
1341 save_cflags="$CFLAGS"
1343 AC_MSG_CHECKING([whether ${CC} accepts -iquote])
1344 AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
1345 AC_MSG_RESULT($has_iquote)
1346 if test "x-$has_iquote" = "x-yes" ; then
1347 host_cflags_iquote=-iquote
1348 host_cflags_iquote_end=
1350 host_cflags_iquote=-I
1351 host_cflags_iquote_end=-I-
1353 kernel_cflags_iquote=$host_cflags_iquote
1354 kernel_cflags_iquote_end=$host_cflags_iquote_end
1355 if test "x-$cross_compiling" = "x-yes"; then
1356 CC="$aros_kernel_cc"
1357 AC_MSG_CHECKING([whether ${CC} accepts -fno-stack-protector])
1358 AC_TRY_COMPILE(,, use_no_stack_protector="yes", use_no_stack_protector="no")
1359 AC_MSG_RESULT($use_no_stack_protector)
1360 AC_MSG_CHECKING([whether ${CC} accepts -iquote])
1361 AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
1362 AC_MSG_RESULT($has_iquote)
1363 if test "x-$has_iquote" = "x-yes" ; then
1364 kernel_cflags_iquote=-iquote
1365 kernel_cflags_iquote_end=
1367 kernel_cflags_iquote=-I
1368 kernel_cflags_iquote_end=-I-
1371 aros_cflags_iquote=$kernel_cflags_iquote
1372 aros_cflags_iquote_end=$kernel_cflags_iquote_end
1373 if test "$orig_target_cc" != "$aros_kernel_cc"; then
1374 CC="$orig_target_cc"
1375 AC_MSG_CHECKING([whether ${CC} accepts -iquote])
1376 AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
1377 AC_MSG_RESULT($has_iquote)
1378 if test "x-$has_iquote" = "x-yes" ; then
1379 aros_cflags_iquote=-iquote
1380 aros_cflags_iquote_end=
1382 aros_cflags_iquote=-I
1383 aros_cflags_iquote_end=-I-
1386 if test "x-$use_no_stack_protector" = "x-yes" ; then
1387 aros_kernel_cflags="$aros_kernel_cflags -fno-stack-protector"
1390 #-----------------------------------------------------------------------------
1392 # Check if we can explicitly choose older version of symbol hashing
1394 CFLAGS="save_cflags -Wl,--hash-style=sysv"
1395 CC="$aros_kernel_cc"
1396 AC_MSG_CHECKING([whether ${CC} accepts -Wl,--hash-style=sysv])
1397 AC_TRY_LINK(,, use_hash_style="yes", use_hash_style="no")
1398 AC_MSG_RESULT($use_hash_style)
1399 if test "x-$use_hash_style" = "x-yes" ; then
1400 aros_kernel_cflags="$aros_kernel_cflags -Wl,--hash-style=sysv"
1403 CFLAGS="$save_cflags"
1405 AC_SUBST(host_cflags_iquote)
1406 AC_SUBST(host_cflags_iquote_end)
1407 AC_SUBST(kernel_cflags_iquote)
1408 AC_SUBST(kernel_cflags_iquote_end)
1409 AC_SUBST(aros_cflags_iquote)
1410 AC_SUBST(aros_cflags_iquote_end)
1413 dnl Check if user specified --with-resolution=XRESxYRESxDEPTH
1414 AC_MSG_CHECKING([for default resolution of WBScreen])
1415 AC_ARG_WITH(resolution,AC_HELP_STRING([--with-resolution=XRESxYRESxDEPTH],[Default resolution of the initial WorkbenchScreen]),resolution=$withval,resolution=none)
1416 # We require an argument, so map --with/--without ("yes"/"no") to "none" specified
1417 if test "$resolution" = "yes" ; then
1420 if test "$resolution" = "no" ; then
1423 if test "$resolution" != "none" ; then
1424 aros_default_wbwidth=`echo $resolution | cut -d'x' -f1`
1425 aros_default_wbheight=`echo $resolution | cut -d'x' -f2`
1426 aros_default_wbdepth=`echo $resolution | cut -d'x' -f3`
1428 AC_MSG_RESULT($aros_default_wbwidth x $aros_default_wbheight x $aros_default_wbdepth)
1429 aros_cv_default_wbwidth=$aros_default_wbwidth
1430 aros_cv_default_wbheight=$aros_default_wbheight
1431 aros_cv_default_wbdepth=$aros_default_wbdepth
1433 dnl See if the user wants the BOCHS hack for native flavour
1434 AC_MSG_CHECKING([if bochs hack is enabled])
1435 AC_ARG_ENABLE(bochs_hack,AC_HELP_STRING([--enable-bochs-hack],[Enable hacks to make BOCHS (partly) work (default=no)]),bochs_hack="yes",bochs_hack="no")
1436 if test "$bochs_hack" = "yes" ; then
1439 AC_MSG_RESULT($bochs_hack)
1441 dnl See if the user wants the serial debug output for native flavour
1442 AC_MSG_CHECKING([if serial debug is enabled])
1443 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)
1444 if test "$aros_serial_debug" = 0 ; then
1445 serial_debug_forced=""
1446 if test "$serial_debug" = "yes" ; then
1449 if test "$serial_debug" = "no" ; then
1453 serial_debug_forced="(forced)"
1454 serial_debug=$aros_serial_debug
1456 if test "$serial_debug" != "none" ; then
1457 aros_serial_debug=$serial_debug
1458 AC_MSG_RESULT($serial_debug_forced on port $serial_debug)
1463 dnl See if the user wants the palm debug output hack for palm native flavour
1464 AC_MSG_CHECKING([if palm debug hack is enabled])
1465 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")
1466 if test "$palm_debug_hack" = "yes" ; then
1467 aros_palm_debug_hack="1"
1469 AC_MSG_RESULT($palm_debug_hack)
1472 dnl See if the user wants nesting supervisor activated for unix flavour
1473 AC_MSG_CHECKING([if nesting supervisor support is enabled])
1474 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")
1475 if test "$nesting_supervisor" = "yes" ; then
1476 aros_nesting_supervisor="1"
1478 AC_MSG_RESULT($nesting_supervisor)
1481 dnl things specifically required for hosted flavours
1482 if test "x-$aros_flavour" = "x-emulation" -o "x-$aros_flavour" = "x-emulcompat" ; then
1484 if test "x-$need_dlopen" != "x-no" ; then
1485 dnl some kind of dynamic library access system is required for hostlib.resource
1486 AC_CHECK_FUNC(dlopen, have_dl="yes", have_dl="no")
1487 if test "x-$have_dl" = "x-no" ; then
1488 AC_CHECK_LIB(dl, dlopen, [have_dl="yes"
1489 aros_host_ldflags="$aros_host_ldflags -ldl"],
1492 if test "x-$have_dl" = "x-no" ; then
1493 AC_MSG_ERROR([dlopen() dynamic linker functions not available])
1499 AC_ARG_ENABLE(x11_hidd, AC_HELP_STRING([--enable-x11-hidd],
1500 [build X11 hidd for hosted (default=auto)]),
1501 x11_hidd="$enableval",
1503 case "x-$x11_hidd" in
1504 x-yes|x-no|x-auto) ;;
1505 *) x11_hidd="auto" ;;
1511 if test "x-$x11_hidd" != "x-no" ; then
1517 for path in $x_libraries
1519 x_cflags="$x_cflags -L$path"
1522 for path in $x_includes
1524 x_cflags="$x_cflags -I$path"
1527 if test "x-$no_x" = "x-yes" ; then
1530 if test "x-$x11_hidd" != "x-auto" ; then
1531 dnl and they explicitly asked for it, bail out
1532 AC_MSG_ERROR([X11 libs/headers not found, cannot build X11 hidd as requested])
1536 dnl found it, setup the metatarget
1537 x11_hidd_target=kernel-x11gfx-kobj
1540 dnl setup shared memory extensions
1541 AC_ARG_ENABLE(x11_shm, AC_HELP_STRING([--enable-x11-shm],
1542 [use X11 shared memory (default=auto)]),
1543 x11_hidd_shm="$enableval",
1544 x11_hidd_shm="auto")
1545 case "x-$x11_hidd_shm" in
1546 x-yes|x-no|x-auto) ;;
1547 *) x11_hidd_shm="auto" ;;
1553 if test "x-$x11_hidd_shm" != "x-no" ; then
1555 dnl system shm headers
1556 AC_CHECK_HEADERS(sys/ipc.h)
1557 AC_CHECK_HEADERS(sys/shm.h)
1560 if test "x-$ac_cv_header_sys_ipc_h" = "x-yes" -a "x-$ac_cv_header_sys_shm_h" = "x-yes" ; then
1562 dnl make sure X libs have shm functions
1563 save_cflags="$CFLAGS"
1564 CFLAGS="$CFLAGS $x_cflags"
1565 AC_CHECK_LIB(Xext, XShmQueryExtension, have_xshm=yes)
1566 CFLAGS="$save_cflags"
1570 dnl detection done, prepare output
1571 if test "x-$have_xshm" = "x-yes" ; then
1574 elif test "x-$x11_hidd_shm" = "x-yes" ; then
1575 dnl they explicitly asked for it, but we can't do it
1576 AC_MSG_ERROR([X11 has no support for shared memory, cannot enable it as requested])
1578 dnl otherwise just disable it
1583 dnl setup vidmode (fullscreen) extensions
1584 AC_ARG_ENABLE(x11_vidmode, AC_HELP_STRING([--enable-x11-vidmode],
1585 [use X11 vidmode extension (default=auto)]),
1586 x11_hidd_vidmode="$enableval",
1587 x11_hidd_vidmode="auto")
1588 case "x-$x11_hidd_vidmode" in
1589 x-yes|x-no|x-auto) ;;
1590 *) x11_hidd_vidmode="auto" ;;
1596 if test "x-$x11_hidd_vidmode" != "x-no" ; then
1598 dnl make sure X libs have vidmode functions
1599 save_cflags="$CFLAGS"
1600 CFLAGS="$CFLAGS $x_cflags"
1601 AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryExtension, have_vidmode=yes)
1602 CFLAGS="$save_cflags"
1605 dnl detection done, prepare output
1606 if test "x-$have_vidmode" = "x-yes" ; then
1607 dnl we can do vidmode
1608 DO_VIDMODE_SUPPORT="1"
1609 elif test "x-$x11_hidd_vidmode" = "x-yes" ; then
1610 dnl they explicitly asked for it, but we can't do it
1611 AC_MSG_ERROR([X11 vidmode extension not available, cannot enable it as requested])
1613 dnl otherwise just disable it
1614 DO_VIDMODE_SUPPORT="0"
1618 aros_host_x11_includes=$x_includes
1619 aros_host_x11_libdirs=$x_libraries
1624 AC_ARG_ENABLE(sdl_hidd, AC_HELP_STRING([--enable-sdl-hidd],
1625 [build SDL hidd for hosted (default=auto)]),
1626 sdl_hidd="$enableval",
1628 case "x-$sdl_hidd" in
1629 x-yes|x-no|x-auto) ;;
1630 *) sdl_hidd="auto" ;;
1634 if test "x-$sdl_hidd" != "x-no" ; then
1637 AM_PATH_SDL([1.2.10], have_sdl="yes", have_sdl="no")
1639 if test "x-$have_sdl" != "x-yes" ; then
1642 if test "x-$sdl_hidd" != "x-auto" ; then
1643 dnl and they explicitly asked for it, bail out
1644 AC_MSG_ERROR([SDL libs/headers not found, cannot build SDL hidd as requested])
1648 dnl found it, set up the metatarget
1649 sdl_hidd_target=kernel-hidd-sdl
1650 aros_host_sdl_cflags=SDL_CFLAGS
1651 aros_host_sdl_libs=SDL_LIBS
1658 dnl See if the user wants dbus.library
1659 AC_MSG_CHECKING([if building of dbus.library is enabled])
1660 AC_ARG_ENABLE(dbus,AC_HELP_STRING([--enable-dbus],[Enable DBUS support via dbus.library (default=no)]),dbus="yes",dbus="no")
1661 if test "$dbus" = "yes" ; then
1663 DBUS_CFLAGS=`pkg-config --cflags dbus-1`
1664 DBUS_LIBFLAGS=`pkg-config --libs dbus-1`
1665 KERNEL_DBUS_KOBJ=kernel-dbus-kobj
1666 KERNEL_DBUS_INCLUDES=kernel-dbus-includes
1670 AC_MSG_RESULT($dbus)
1673 dnl --------------------------------------------------------------------
1674 dnl Configuration Output Section
1675 dnl --------------------------------------------------------------------
1680 AC_SUBST(aros_flavour)
1681 AC_SUBST(aros_flavour_uc)
1682 AC_SUBST(AROS_BUILDDIR)
1684 AC_SUBST(AROS_PORTSSRCDIR)
1687 AC_SUBST(aros_cc_pre)
1688 AC_SUBST(aros_host_strip)
1689 AC_SUBST(aros_host_arch)
1690 AC_SUBST(aros_host_cpu)
1691 AC_SUBST(aros_host_cc)
1692 AC_SUBST(aros_host_ar)
1693 AC_SUBST(aros_host_ranlib)
1694 AC_SUBST(aros_host_ld)
1695 AC_SUBST(aros_host_make)
1696 AC_SUBST(aros_host_cflags)
1697 AC_SUBST(aros_host_ldflags)
1698 AC_SUBST(aros_host_debug)
1699 AC_SUBST(aros_host_mkdep)
1700 AC_SUBST(aros_host_mkargs)
1701 AC_SUBST(aros_host_exe_suffix)
1702 AC_SUBST(aros_host_lib_suffix)
1703 AC_SUBST(aros_tools_dir)
1704 AC_SUBST(aros_host_aclocal)
1705 AC_SUBST(aros_host_autoconf)
1706 AC_SUBST(aros_host_autoheader)
1707 AC_SUBST(aros_host_automake)
1710 AC_SUBST(aros_target_guitheme)
1711 AC_SUBST(aros_target_iconset)
1712 AC_SUBST(aros_target_bootloader)
1713 AC_SUBST(aros_target_arch)
1714 AC_SUBST(aros_target_cpu)
1715 AC_SUBST(aros_target_variant)
1716 AC_SUBST(aros_target_suffix)
1717 AC_SUBST(aros_target_incl)
1718 AC_SUBST(aros_target_ar)
1719 AC_SUBST(aros_target_ranlib)
1720 AC_SUBST(aros_kernel_nm)
1721 AC_SUBST(orig_target_cc)
1722 AC_SUBST(aros_target_cc)
1723 AC_SUBST(aros_kernel_cc)
1724 AC_SUBST(aros_target_as)
1725 AC_SUBST(orig_target_ld)
1726 AC_SUBST(aros_target_ld)
1727 AC_SUBST(aros_kernel_ld)
1728 AC_SUBST(aros_target_cc_includes)
1729 AC_SUBST(aros_target_cc_path)
1730 AC_SUBST(aros_target_objdump)
1731 AC_SUBST(aros_target_objcopy)
1732 AC_SUBST(aros_target_strip)
1733 AC_SUBST(aros_target_nm)
1734 AC_SUBST(aros_kernel_rescomp)
1735 AC_SUBST(aros_shared_default)
1736 AC_SUBST(aros_shared_ld)
1737 AC_SUBST(aros_object_format)
1738 AC_SUBST(aros_compiler_libs)
1739 AC_SUBST(aros_arch_libs)
1741 AC_SUBST(aros_config_cflags)
1742 AC_SUBST(aros_config_aflags)
1743 AC_SUBST(aros_config_ldflags)
1745 AC_SUBST(aros_shared_cflags)
1746 AC_SUBST(aros_shared_aflags)
1747 AC_SUBST(aros_shared_ldflags)
1748 AC_SUBST(aros_kernel_cflags)
1749 AC_SUBST(aros_kernel_ldflags)
1750 AC_SUBST(aros_debug_cflags)
1751 AC_SUBST(aros_debug_aflags)
1752 AC_SUBST(aros_debug_ldflags)
1753 AC_SUBST(aros_target_genmap)
1754 AC_SUBST(aros_target_strip_flags)
1757 AC_SUBST(x11_hidd_target)
1758 AC_SUBST(sdl_hidd_target)
1760 AC_SUBST(aros_default_wbwidth)
1761 AC_SUBST(aros_default_wbheight)
1762 AC_SUBST(aros_default_wbdepth)
1763 AC_SUBST(DO_XSHM_SUPPORT)
1764 AC_SUBST(DO_VIDMODE_SUPPORT)
1766 AC_SUBST(aros_host_x11_includes)
1767 AC_SUBST(aros_host_x11_libdirs)
1768 AC_SUBST(aros_host_sdl_cflags)
1769 AC_SUBST(aros_host_sdl_libs)
1771 # Native version related
1772 AC_SUBST(aros_bochs_hack)
1773 AC_SUBST(aros_serial_debug)
1775 # Palm native version related
1776 AC_SUBST(aros_palm_debug_hack)
1778 # Unix/Hosted version related
1779 AC_SUBST(aros_nesting_supervisor)
1782 AC_SUBST(ENABLE_DBUS)
1783 AC_SUBST(DBUS_CFLAGS)
1784 AC_SUBST(DBUS_LIBFLAGS)
1785 AC_SUBST(KERNEL_DBUS_KOBJ)
1786 AC_SUBST(KERNEL_DBUS_INCLUDES)
1789 AC_SUBST(ENABLE_X11)
1792 AC_SUBST(aros_debug)
1793 AC_SUBST(aros_mungwall_debug)
1794 AC_SUBST(aros_stack_debug)
1795 AC_SUBST(aros_modules_debug)
1797 # Collect-aros stuff: "-ius" to ignore undefined symbols
1798 AC_SUBST(ignore_undefined_symbols)
1800 # C compiler related
1801 AC_SUBST(gcc_target_cpu)
1803 dnl Prepare for output, make up all the generated patches
1804 case "$aros_flavour" in
1805 emulation) aros_flavour_uc="AROS_FLAVOUR_EMULATION"
1806 aros_flavour="emulation" ;;
1807 emulcompat) aros_flavour_uc="(AROS_FLAVOUR_EMULATION|AROS_FLAVOUR_BINCOMPAT)"
1808 aros_flavour="emulation" ;;
1809 standalone) aros_flavour_uc="AROS_FLAVOUR_STANDALONE"
1810 aros_flavour="standalone";;
1811 native) aros_flavour_uc="AROS_FLAVOUR_NATIVE"
1812 aros_flavour="native" ;;
1813 nativecompat) aros_flavour_uc="(AROS_FLAVOUR_NATIVE|AROS_FLAVOUR_BINCOMPAT)"
1814 aros_flavour="native" ;;
1815 linklib) aros_flavour_uc="AROS_FLAVOUR_LINKLIB"
1816 aros_flavour="linklib" ;;
1817 palmnative) aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
1818 aros_flavour="palmnative" ;;
1819 mac68knative) aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
1820 aros_flavour="mac68knative" ;;
1821 ppcnative) aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_BINCOMPAT)"
1822 aros_flavour="ppcnative" ;;
1825 if test ! -d ${aros_inc_dir} ; then
1826 ${MKDIR} ${aros_inc_dir}
1828 if test ! -d ${aros_geninc_dir} ; then
1829 ${MKDIR} ${aros_geninc_dir}
1831 if test ! -d ${aros_hostcfg_dir} ; then
1832 ${MKDIR} ${aros_hostcfg_dir}
1834 if test ! -d ${aros_targetcfg_dir} ; then
1835 ${MKDIR} ${aros_targetcfg_dir}
1837 if test ! -d ${aros_tools_dir} ; then
1838 ${MKDIR} ${aros_tools_dir}
1840 if test ! -d ${aros_scripts_dir} ; then
1841 ${MKDIR} ${aros_scripts_dir}
1844 AC_CONFIG_HEADERS(${aros_geninc_dir}/host-conf.h:config/host-conf.h.in)
1846 AC_CONFIG_COMMANDS([compiler_executable],
1848 prefix=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}
1850 prefix="${prefix}/${aros_target_cpu}-aros"
1851 prefix2=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros
1855 chmod a+x ${prefix2}-gcc ${prefix2}-ld
1857 ln -sf ${prefix2}-gcc ${prefix}-gcc
1858 ln -sf ${prefix2}-ld ${prefix}-ld
1860 ln -sf $aros_target_as_ln$aros_host_exe_suffix ${prefix}-as
1861 ln -sf $aros_target_nm_ln$aros_host_exe_suffix ${prefix}-nm
1862 ln -sf $aros_target_ar_ln$aros_host_exe_suffix ${prefix}-ar
1863 ln -sf $aros_target_ranlib_ln$aros_host_exe_suffix ${prefix}-ranlib
1864 ln -sf $aros_target_objcopy_ln$aros_host_exe_suffix ${prefix}-objcopy
1865 ln -sf $aros_target_objdump_ln$aros_host_exe_suffix ${prefix}-objdump
1866 ln -sf $aros_target_strip_ln$aros_host_exe_suffix ${prefix}-strip
1868 ln -sf $aros_target_as_ln$aros_host_exe_suffix ${prefix2}-as
1869 ln -sf $aros_target_nm_ln$aros_host_exe_suffix ${prefix2}-nm
1870 ln -sf $aros_target_ar_ln$aros_host_exe_suffix ${prefix2}-ar
1871 ln -sf $aros_target_ranlib_ln$aros_host_exe_suffix ${prefix2}-ranlib
1872 ln -sf $aros_target_objcopy_ln$aros_host_exe_suffix ${prefix2}-objcopy
1873 ln -sf $aros_target_objdump_ln$aros_host_exe_suffix ${prefix2}-objdump
1874 ln -sf $aros_target_strip_ln$aros_host_exe_suffix ${prefix2}-strip
1877 aros_host_exe_suffix=${aros_host_exe_suffix}
1878 aros_tools_dir=${aros_tools_dir}
1879 aros_target_cpu=${aros_target_cpu}
1880 aros_target_arch=${aros_target_arch}
1881 aros_target_suffix=${aros_target_suffix}
1882 aros_target_nm_ln=${aros_target_nm_ln}
1883 aros_target_as_ln=${aros_target_as_ln}
1884 aros_target_ar_ln=${aros_target_ar_ln}
1885 aros_target_ranlib_ln=${aros_target_ranlib_ln}
1886 aros_target_objdump_ln=${aros_target_objdump_ln}
1887 aros_target_objcopy_ln=${aros_target_objcopy_ln}
1888 aros_target_strip_ln=${aros_target_strip_ln}
1891 AC_CONFIG_COMMANDS([genshared_executable],
1892 [chmod a+x ${aros_scripts_dir}/genshared],
1893 [aros_scripts_dir=${aros_scripts_dir}]
1895 AC_CONFIG_COMMANDS([genmf_executable],
1896 [chmod a+x ${aros_tools_dir}/genmf.py],
1897 [aros_tools_dir=${aros_tools_dir}]
1903 ${aros_inc_dir}/config.h:config/config.h.in
1904 ${aros_geninc_dir}/config.h:config/config.h.in
1905 ${aros_hostcfg_dir}/host.cfg:config/host.cfg.in
1906 ${aros_targetcfg_dir}/target.cfg:config/target.cfg.in
1908 ${aros_targetcfg_dir}/make.defaults:config/make.defaults.in
1909 ${aros_targetcfg_dir}/specs:config/specs.in
1910 ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-gcc:scripts/aros-gcc.in
1911 ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-ld:scripts/aros-ld.in
1912 ${aros_scripts_dir}/genshared:compiler/c_lib/source/lib_source/genshared.in
1913 ${aros_tools_dir}/genmf.py:tools/genmf/genmf.py
1914 tools/collect-aros/env.h
1919 dnl This is in order to not define SHARED_CFLAGS sometimes
1920 dnl We don't always do aros_shared_ar, aros_shared_cflags
1922 #XXX compatability...
1923 aros_shared_ar="$aros_shared_ld $aros_shared_ldflags -o"
1925 if test -n "$aros_shared_cflags" ; then
1926 echo "SHARED_CFLAGS := $aros_shared_cflags" >> ${aros_hostcfg_dir}/host.cfg
1927 echo "SHARED_AR := $aros_shared_ar" >> ${aros_hostcfg_dir}/host.cfg