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"
172 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
173 aros_host_cpu="$host_cpu"
179 aros_host_cc="$aros_host_cc $aros_host_cc_pipe -I/usr/local/include"
180 aros_host_make="gmake"
181 aros_host_arch="freebsd"
184 aros_host_ldflags="$aros_host_ldflags -L/usr/local/lib -liconv"
186 dnl Need to override this here, it's just too hard later.
187 dnl This shouldn't be here at all...
188 dnl aros_target_cc_includes="/usr/include"
190 dnl FreeBSD 5.x (and later) has changed the default object format.
191 dnl The double [[]] is necessary to get around m4's quoting rules.
194 aros_object_format="elf_i386"
198 aros_object_format="elf_i386_fbsd"
205 aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
206 aros_host_arch="darwin"
215 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
216 aros_host_cpu="$host_cpu"
220 aros_host_ldflags="$aros_host_ldflags -liconv"
225 aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
226 aros_host_make="gmake"
227 aros_host_arch="dragonfly"
233 aros_host_cpu="x86_64"
236 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
237 aros_host_cpu="$host_cpu"
243 aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
244 aros_host_make="gmake"
245 aros_host_arch="netbsd"
254 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
255 aros_host_cpu="$host_cpu"
258 aros_host_lib_suffix=".0.0"
262 aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
263 aros_host_make="gmake"
264 aros_host_arch="openbsd"
270 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
271 aros_host_cpu="$host_cpu"
277 aros_host_arch="solaris"
278 aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
284 aros_host_cpu="sparc"
287 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
288 aros_host_cpu="$host_cpu"
294 aros_host_arch="morphos"
299 aros_host_arch="amiga"
304 TOUCH="/gg/bin/touch"
313 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
314 aros_host_cpu="$host_cpu"
320 aros_host_arch="cygwin"
321 aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
327 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
328 aros_host_cpu="$host_cpu"
334 aros_host_arch="mingw32"
335 aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
341 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
342 aros_host_cpu="$host_cpu"
347 AC_MSG_ERROR([Unsupported host architecture $host])
351 AROS_PROG(aros_host_ar,[ar],[cr])
352 AROS_REQUIRED(ar,$aros_host_ar)
353 AROS_PROG(aros_host_ranlib,ranlib)
354 AROS_REQUIRED(ranlib,$aros_host_ranlib)
355 AROS_PROG(aros_host_strip,strip)
356 AROS_REQUIRED(strip,$aros_host_strip)
358 AROS_PROG(RM,[rm],[-rf])
359 AROS_REQUIRED(rm,$RM)
361 AROS_REQUIRED(cp,$CP)
363 AROS_REQUIRED(mv,$MV)
364 AROS_PROG(ECHO,[echo])
365 AROS_REQUIRED(echo,$ECHO)
366 AROS_PROG(MKDIR,[mkdir],[-p])
367 AROS_REQUIRED(mkdir,$MKDIR)
368 AROS_PROG(TOUCH,[touch])
369 AROS_REQUIRED(touch,$TOUCH)
370 AROS_PROG(SORT,[sort])
371 AROS_REQUIRED(sort,$SORT)
372 AROS_PROG(UNIQ,[uniq])
373 AROS_REQUIRED(uniq,$UNIQ)
374 AROS_PROG(NOP,[true])
375 AROS_REQUIRED(true,$NOP)
377 AROS_REQUIRED(cat,$CAT)
378 AROS_PROG(BISON,[bison])
379 AROS_REQUIRED(bison,$BISON)
380 AROS_PROG(FLEX,[flex])
381 AROS_REQUIRED(flex,$FLEX)
382 AROS_PROG(PNGTOPNM,[pngtopnm])
383 AROS_REQUIRED(pngtopnm,$PNGTOPNM)
384 AROS_PROG(PPMTOILBM,[ppmtoilbm])
385 AROS_REQUIRED(ppmtoilbm,$PPMTOILBM)
387 AROS_REQUIRED(sed,$SED)
388 AROS_PROG(CHMOD,[chmod])
389 AROS_REQUIRED(chmod,$CHMOD)
391 AM_PATH_PYTHON(2.2.1)
398 dnl ---------------------------------------------------------------------------
399 dnl Look for things about the host system, good for hosted targets.
400 dnl ---------------------------------------------------------------------------
402 # Check for some includes for the X11 HIDD and the kernel
403 AC_CHECK_HEADERS([sys/ipc.h sys/shm.h \
404 sys/mmap.h sys/mman.h sysexits.h \
405 sys/statfs.h sys/statvfs.h sys/vfs.h sys/param.h \
408 AC_CHECK_HEADERS([sys/mount.h],,,[#include <sys/param.h>])
425 AC_CHECK_MEMBERS(struct tm.tm_gmtoff)
427 # Look for some functions
428 AC_CHECK_FUNCS([getpagesize kqueue statfs statvfs \
429 clone kse_create rfork_thread thr_create sa_register \
430 getcontext makecontext setcontext sigaltstack swapcontext])
435 dnl --------------------------------------------------------------------
436 dnl Target Configuration Section
437 dnl --------------------------------------------------------------------
439 dnl The target configuration section is responsible for setting up all
440 dnl the paths for includes, and tools required to build AROS to some
441 dnl particular target.
443 aros_config_cflags="-Wall -Werror-implicit-function-declaration"
444 aros_config_aflags="-Wall -x assembler-with-cpp -c"
445 aros_config_ldflags=""
447 aros_shared_default=yes
449 aros_shared_cflags="-fPIC"
450 aros_shared_aflags=""
451 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
452 aros_kernel_ldflags="-Wl,-rpath,./lib"
454 aros_target_ar_flags="cr"
455 aros_target_nm_flags="-C -ul"
456 aros_target_strip_flags="--strip-unneeded -R.comment"
461 aros_target_genmap="-Wl,-Map -Xlinker"
463 # 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_default_wbdepth=24
935 aros_config_cflags="$aros_config_cflags -mcpu=440fp -mno-toc -fno-asynchronous-unwind-tables"
936 gcc_target_cpu="powerpc"
940 aros_target_arch="efika"
941 aros_shared_default="no"
942 aros_target_cpu="arm"
943 aros_object_format="armelf_linux_eabi"
944 aros_flavour="standalone"
945 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
946 aros_kernel_ldflags=""
947 aros_default_wbwidth=1024
948 aros_default_wbheight=600
949 aros_arch_libs="-laeabi"
950 aros_config_cflags="$aros_config_cflags -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -fno-asynchronous-unwind-tables -fno-exceptions"
951 aros_config_aflags="$aros_config_aflags -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -fno-asynchronous-unwind-tables -fno-exceptions"
955 aros_target_arch="chrp"
956 aros_shared_default="no"
957 aros_target_cpu="ppc"
958 aros_object_format="elf32ppc"
959 aros_flavour="ppcnative"
960 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
961 aros_kernel_ldflags=""
962 aros_default_wbwidth=640
963 aros_default_wbheight=480
964 aros_config_cflags="$aros_config_cflags -mno-toc -fno-asynchronous-unwind-tables"
965 gcc_target_cpu="powerpc"
966 case "$aros_target_variant" in
968 aros_config_cflags="$aros_config_cflags -DBIG_ENDIAN_OHCI=1 -mcpu=603e"
974 aros_target_arch="amiga"
975 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D_AMIGA -DAMIGA"
976 aros_shared_default="no"
978 aros_config_cflags="$aros_config_cflags -fomit-frame-pointer -fbuiltin -ffreestanding"
980 case "$target_cpu" in
982 aros_target_cpu="m68k"
983 aros_object_format="m68kelf"
984 aros_flavour="nativecompat"
985 gcc_target_cpu="mc68000"
989 aros_flavour="native"
993 AC_MSG_ERROR("Unknown CPU for Amiga $target_cpu")
999 aros_target_arch="mingw32"
1000 aros_shared_default="no"
1001 aros_flavour="emulation"
1002 aros_shared_cflags=""
1005 case "$target_cpu" in
1007 aros_target_cpu="i386"
1008 aros_object_format="elf_i386"
1009 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1010 aros_default_wbdepth=8
1011 gcc_target_cpu="i386"
1012 aros_target_cc="i386-aros-gcc"
1013 aros_target_ld="i386-aros-ld"
1014 aros_target_as="i386-aros-as"
1015 aros_target_ar="i386-aros-ar"
1016 aros_target_ranlib="i386-aros-ranlib"
1017 aros_target_nm="i386-aros-nm"
1018 aros_target_strip="i386-aros-strip"
1019 aros_target_objcopy="i386-aros-objcopy"
1020 aros_target_objdump="i386-aros-objdump"
1021 target_tool_prefix="i386-mingw32-"
1024 aros_target_cpu="x86_64"
1025 aros_object_format="elf_x86_64"
1026 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
1027 aros_default_wbdepth=8
1028 gcc_target_cpu="x86_64"
1029 aros_target_cc="x86_64-aros-gcc"
1030 aros_target_ld="x86_64-aros-ld"
1031 aros_target_as="x86_64-aros-as"
1032 aros_target_ar="x86_64-aros-ar"
1033 aros_target_ranlib="x86_64-aros-ranlib"
1034 aros_target_nm="x86_64-aros-nm"
1035 aros_target_strip="x86_64-aros-strip"
1036 aros_target_objcopy="x86_64-aros-objcopy"
1037 aros_target_objdump="x86_64-aros-objdump"
1038 target_tool_prefix="x86_64-w64-mingw32-"
1041 aros_target_cpu="arm"
1042 aros_object_format="armelf_linux_eabi"
1043 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
1044 aros_default_wbdepth=8
1045 gcc_target_cpu="arm"
1046 aros_target_cc="arm-elf-gcc"
1047 aros_target_ld="arm-elf-ld"
1048 aros_target_as="arm-elf-as"
1049 aros_target_ar="arm-elf-ar"
1050 aros_target_ranlib="arm-elf-ranlib"
1051 aros_target_nm="arm-elf-nm"
1052 aros_target_strip="arm-elf-strip"
1053 aros_target_objcopy="arm-elf-objcopy"
1054 aros_target_objdump="arm-elf-objdump"
1055 target_tool_prefix="arm-mingw32ce-"
1056 aros_default_wbwidth=160
1057 aros_default_wbheight=160
1060 AC_MSG_ERROR("Unknown CPU for Mingw32 -- $target_cpu")
1063 if test $host_os = "cygwin"; then
1064 aros_kernel_cflags="-mno-cygwin"
1068 aros_target_arch="pp"
1069 aros_shared_default="no"
1070 case "$target_cpu" in
1072 aros_target_cpu="m68k"
1073 aros_object_format="m68kelf"
1074 aros_flavour="palmnative"
1075 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
1076 aros_default_wbwidth=160
1077 aros_default_wbheight=160
1078 aros_default_wbdepth=1
1079 aros_target_ar_flags="cru"
1080 aros_compiler_libs="-lgcc1"
1081 aros_shared_default=no
1082 aros_shared_cflags="-fpic"
1083 aros_shared_aflags=""
1084 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
1085 aros_kernel_ldflags="-Wl,-rpath,./lib"
1086 aros_debug_cflags="-Wall -Werror-implicit-function-declaration $aros_symbols_debug $aros_messages_debug -mc68000 -Wa,-mc68000"
1087 aros_debug_aflags=""
1088 aros_debug_ldflags="$aros_symbols_debug"
1089 aros_mungwall_debug="0"
1090 aros_modules_debug="0"
1091 gcc_target_cpu="mc68000"
1092 ignore_undefined_symbols="-ius"
1095 AC_MSG_ERROR("Unknown CPU for PalmPilot -- $target_cpu")
1101 aros_target_arch="mac"
1102 aros_shared_default="no"
1103 case "$target_cpu" in
1105 aros_target_cpu="m68k"
1106 aros_object_format="m68kelf"
1107 aros_flavour="mac68knative"
1108 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
1109 aros_default_wbwidth=512
1110 aros_default_wbheight=384
1111 aros_default_wbdepth=8
1112 aros_target_ar_flags="cru"
1113 aros_compiler_libs="-lgcc1"
1114 aros_shared_default=no
1115 aros_shared_cflags="-fpic"
1116 aros_shared_aflags=""
1117 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
1118 aros_kernel_ldflags="-Wl,-rpath,./lib"
1119 aros_debug_cflags="-Wall -Werror-implicit-function-declaration $aros_symbols_debug $aros_messages_debug -mc68000"
1120 aros_debug_aflags=""
1121 aros_debug_ldflags="$aros_symbols_debug"
1122 aros_mungwall_debug="0"
1123 aros_modules_debug="0"
1124 gcc_target_cpu="mc68000"
1125 ignore_undefined_symbols="-ius"
1128 AC_MSG_ERROR("Unknown CPU for Mac68k -- $target_cpu")
1134 AC_MSG_ERROR([Unsupported target architecture $target])
1138 AC_MSG_CHECKING([Where to download sourcecode for external ports])
1139 AC_ARG_WITH(portssources,AC_HELP_STRING([--with-portssources=DIR],[Where to download sourcecode for external ports]),with_portssrcdir=$withval,with_portssrcdir="default")
1140 if test "$with_portssrcdir" = "default"; then
1141 AROS_PORTSSRCDIR="$AROS_BUILDDIR_UNIX/bin/Sources"
1143 AROS_PORTSSRCDIR="$with_portssrcdir"
1145 AC_MSG_RESULT($AROS_PORTSSRCDIR)
1147 AC_MSG_CHECKING([which bootloader to use])
1148 AC_ARG_WITH(bootloader,AC_HELP_STRING([--with-bootloader=NAME],[Use a specific bootloader]),target_bootloader=$withval,target_bootloader=$target_bootloader)
1149 if test "$target_bootloader" = "none"; then
1150 aros_target_bootloader=""
1152 aros_target_bootloader="$target_bootloader"
1154 AC_MSG_RESULT($target_bootloader)
1156 AC_MSG_CHECKING([which icon-set to use])
1157 AC_ARG_WITH(iconset,AC_HELP_STRING([--with-iconset=NAME],[Use a specific Icon-set (default=Gorilla).]),target_iconset=$withval,target_iconset="default")
1158 if test "$target_iconset" = "default"; then
1159 aros_target_iconset="Gorilla"
1160 target_iconset="default (Gorilla)"
1162 aros_target_iconset="$target_iconset"
1164 AC_MSG_RESULT($target_iconset)
1166 AC_MSG_CHECKING([which GUI Theme to use])
1167 AC_ARG_WITH(theme,AC_HELP_STRING([--with-theme=NAME],[Use a specific GUI Theme]),target_guitheme=$withval,target_guitheme="default")
1168 if test "$target_guitheme" = "default"; then
1169 aros_target_guitheme="Ice"
1171 aros_target_guitheme="$target_guitheme"
1173 AC_MSG_RESULT($aros_target_guitheme)
1175 # Find out if we are cross-compiling (i.e. if we can't use the host compiler
1178 if test "$aros_host_cpu" != "$aros_target_cpu" ; then
1181 if test "$aros_host_cpu" == "x86_64" ; then
1182 if test "$aros_target_cpu" == "i386" ; then
1183 if test "$aros_target_arch" != "mingw32"; then
1188 if test "$aros_host_arch" == "darwin" ; then
1192 # Set prefix for target compiler etc. if we're cross-compiling
1193 # (should possibly be earlier but needs to be after AC_PROG_CC)
1194 if test "$cross_compiling" = "yes" ; then
1195 if test "$target_tool_prefix" = ""; then
1196 target_tool_prefix=${target_cpu}-elf-
1198 CC=${target_tool_prefix}gcc
1201 #-----------------------------------------------------------------------------
1203 # Disable pointer-signedness warnings if the compiler recognises the option
1205 AC_MSG_CHECKING([whether ${CC} accepts -Wno-pointer-sign])
1206 save_cflags="$CFLAGS"
1207 CFLAGS="$CFLAGS -Wno-pointer-sign"
1208 AC_TRY_COMPILE(,, use_no_sign_warning="yes", use_no_sign_warning="no")
1209 AC_MSG_RESULT($use_no_sign_warning)
1210 if test "x-$use_no_sign_warning" = "x-yes" ; then
1211 aros_config_cflags="$aros_config_cflags -Wno-pointer-sign"
1213 CFLAGS="$save_cflags"
1215 #-----------------------------------------------------------------------------
1217 # Find all the tools we need to compile. This could be cross-compiling
1218 # though! If that is the case we use the GNU form of the target and
1219 # simply add this to the front of the binary name. This is rather simple,
1220 # but it should work under most circumstances.
1222 # The default tools are to use the same as the host, but only if the
1223 # host and target CPU are the same. With GCC this is normally enough.
1227 aros_shared_ld="$aros_host_ld"
1229 aros_target_mkdep="$aros_host_mkdep"
1230 aros_target_incl_def="$aros_host_incl"
1232 aros_kernel_cc="$CC"
1234 # The default tools executables to be linked to.
1235 if test "$aros_target_cc" != ""; then
1236 AC_PATH_PROG(aros_target_cc,$aros_target_cc)
1237 AROS_REQUIRED(gcc,$aros_target_cc)
1239 if test "$aros_target_ld" != ""; then
1240 AC_PATH_PROG(aros_target_ld,$aros_target_ld)
1241 AROS_REQUIRED(ld,$aros_target_ld)
1244 if test "$crosstools" != "yes"; then
1245 AROS_TOOL_TARGET(aros_target_as_ln,as,$aros_target_as)
1246 AROS_REQUIRED(as,$aros_target_as_ln)
1247 AROS_TOOL_TARGET(aros_kernel_ld,ld,$aros_kernel_ld)
1248 AROS_REQUIRED(ld,$aros_kernel_ld)
1249 AROS_TOOL_TARGET(aros_target_ar_ln,ar,$aros_target_ar)
1250 AROS_REQUIRED(ar,$aros_target_ar_ln)
1251 AROS_TOOL_TARGET(aros_target_nm_ln,nm,$aros_target_nm)
1252 AROS_REQUIRED(nm,$aros_target_nm_ln)
1253 AROS_TOOL_TARGET(aros_target_objcopy_ln,objcopy,$aros_target_objcopy)
1254 AROS_REQUIRED(objcopy,$aros_target_objcopy_ln)
1255 AROS_TOOL_TARGET(aros_target_objdump_ln,objdump,$aros_target_objdump)
1256 AROS_REQUIRED(objdump,$aros_target_objdump_ln)
1257 AROS_TOOL_TARGET(aros_target_ranlib_ln,ranlib,$aros_target_ranlib)
1258 AROS_REQUIRED(ranlib,$aros_target_ranlib_ln)
1259 AROS_TOOL_TARGET(aros_target_strip_ln,strip,$aros_target_strip)
1260 AROS_REQUIRED(strip,$aros_target_strip_ln)
1263 if test "$rescomp" != ""; then
1264 if test "$cross_compiling" = "yes" ; then
1265 rescomp=${target_tool_prefix}${rescomp}
1267 AC_PATH_PROG(aros_kernel_rescomp,$rescomp)
1268 AROS_REQUIRED($rescomp,$aros_kernel_rescomp)
1271 aros_hostcfg_dir="bin/${aros_host_arch}-${aros_host_cpu}/gen/config"
1272 aros_targetcfg_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/config"
1273 aros_inc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/AROS/Development/include/aros"
1274 aros_gendir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen"
1275 aros_geninc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/include/aros"
1276 aros_tools_dir="bin/${aros_host_arch}-${aros_host_cpu}/tools"
1277 aros_scripts_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/scripts"
1279 # aros_cc_pre is a variable that is added to the front of the compiler name
1280 # in the generated aros-gcc shell script. We need this to enable the cache
1281 # to work across cleaned builds. Also, support DISTCC using the correct
1282 # environment variable.
1285 if test "x${DISTCC}" != "x" ; then
1286 if test "x${CCACHE}" != "x" ; then
1287 aros_cc_pre="env CCACHE_PREFIX=${DISTCC} ${CCACHE} "
1289 aros_cc_pre="${DISTCC} "
1292 if test "x${CCACHE}" != "x" ; then
1293 aros_cc_pre="${CCACHE} "
1297 prefix="${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros"
1299 AC_SUBST(aros_target_nostdinc_cflags,-nostdinc)
1300 AC_SUBST(aros_target_nostartup_ldflags,-nostartfiles)
1301 AC_SUBST(aros_target_nix_ldflags,-nix)
1302 AC_SUBST(aros_target_detach_ldflags,-detach)
1303 AC_SUBST(aros_target_nostdlib_ldflags,-nostdlib)
1306 if test "$aros_target_cc" = ""; then
1307 orig_target_cc=$aros_kernel_cc
1309 orig_target_cc=$aros_target_cc
1311 if test "$aros_target_ld" = ""; then
1312 orig_target_ld=$aros_kernel_ld
1314 orig_target_ld=$aros_target_ld
1316 if test "$GCC" = "yes"; then
1317 aros_target_cc_path=`$orig_target_cc -print-search-dirs | grep "programs: =" | cut -c 12-`
1319 aros_target_cc="${prefix}-gcc"
1320 aros_target_as="${prefix}-as"
1321 aros_target_ld="${prefix}-ld"
1322 aros_target_ar="${prefix}-ar $aros_target_ar_flags"
1323 aros_target_objcopy=${prefix}-objcopy
1324 aros_target_objdump=${prefix}-objdump
1325 aros_target_ranlib="${prefix}-ranlib $aros_target_ranlib_flags"
1326 aros_target_nm="${prefix}-nm $aros_target_nm_flags"
1327 aros_kernel_nm="${prefix}-nm"
1328 aros_target_strip=${prefix}-strip
1330 # Find the system include path. We can suggest that an alternative is
1331 # used if we don't get it correct. The default is to use /usr/include.
1332 # Which is set in the aros_target_incl_def variable.
1334 AC_ARG_ENABLE(includes,
1335 AC_HELP_STRING([--enable-includes=dir],[Alternative system include directory]),
1336 [aros_target_incl=$enable_includes], [aros_target_incl=$aros_target_incl_def])
1338 dnl find out about the target cc's include path
1339 AC_MSG_CHECKING([for the target compiler's include path])
1340 if test "$aros_target_cc_includes" = "" ; then
1341 #try to guess where the directory is
1342 aros_target_cc_includes=`dirname \`${orig_target_cc} -print-libgcc-file-name\``/include
1343 if ! test -d $aros_target_cc_includes; then
1344 #the directory doesn't exist, we need to do some more work
1345 aros_target_cc_includes=${PWD}/${aros_gendir}/cc_include
1347 #these are the headers we're looling for
1348 headers="limits.h mmintrin.h stdbool.h syslimits.h float.h \
1349 stddef.h xmmintrin.h iso646.h stdarg.h unwind.h \
1353 for h in $headers; do
1354 #which other headers each of the above headers needs?
1355 deps=$(echo "#include <$h>" | \
1356 $aros_host_cc -E -M - 2>/dev/null | \
1357 sed 's/^.*://; s/\\$/ /g; s/[[ \t]]\+/ /g')
1359 #copy all the needed headers to a directory beneath gendir
1362 dir=${aros_target_cc_includes}$(echo $(dirname $d) | \
1363 sed -n "s,^.*/include\(/.*\),\1,p")
1364 ! test -d $dir && mkdir -p $dir
1365 ! test -f $dir/$h && { cp $d $dir; chmod u+w $dir/$h; }
1370 AC_MSG_RESULT($aros_target_cc_includes)
1373 # For GCC < 4.0 -I- is used for giving the search path for '#include "..."'
1374 # On GCC >= 4.0 -iquote should be used
1378 save_cflags="$CFLAGS"
1380 AC_MSG_CHECKING([whether ${CC} accepts -iquote])
1381 AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
1382 AC_MSG_RESULT($has_iquote)
1383 if test "x-$has_iquote" = "x-yes" ; then
1384 host_cflags_iquote=-iquote
1385 host_cflags_iquote_end=
1387 host_cflags_iquote=-I
1388 host_cflags_iquote_end=-I-
1390 kernel_cflags_iquote=$host_cflags_iquote
1391 kernel_cflags_iquote_end=$host_cflags_iquote_end
1392 if test "x-$cross_compiling" = "x-yes"; then
1393 CC="$aros_kernel_cc"
1394 AC_MSG_CHECKING([whether ${CC} accepts -fno-stack-protector])
1395 AC_TRY_COMPILE(,, use_no_stack_protector="yes", use_no_stack_protector="no")
1396 AC_MSG_RESULT($use_no_stack_protector)
1397 AC_MSG_CHECKING([whether ${CC} accepts -iquote])
1398 AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
1399 AC_MSG_RESULT($has_iquote)
1400 if test "x-$has_iquote" = "x-yes" ; then
1401 kernel_cflags_iquote=-iquote
1402 kernel_cflags_iquote_end=
1404 kernel_cflags_iquote=-I
1405 kernel_cflags_iquote_end=-I-
1408 aros_cflags_iquote=$kernel_cflags_iquote
1409 aros_cflags_iquote_end=$kernel_cflags_iquote_end
1410 if test "$orig_target_cc" != "$aros_kernel_cc"; then
1411 CC="$orig_target_cc"
1412 AC_MSG_CHECKING([whether ${CC} accepts -iquote])
1413 AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
1414 AC_MSG_RESULT($has_iquote)
1415 if test "x-$has_iquote" = "x-yes" ; then
1416 aros_cflags_iquote=-iquote
1417 aros_cflags_iquote_end=
1419 aros_cflags_iquote=-I
1420 aros_cflags_iquote_end=-I-
1423 if test "x-$use_no_stack_protector" = "x-yes" ; then
1424 aros_kernel_cflags="$aros_kernel_cflags -fno-stack-protector"
1427 #-----------------------------------------------------------------------------
1429 # Check if we can explicitly choose older version of symbol hashing
1431 CFLAGS="save_cflags -Wl,--hash-style=sysv"
1432 CC="$aros_kernel_cc"
1433 AC_MSG_CHECKING([whether ${CC} accepts -Wl,--hash-style=sysv])
1434 AC_TRY_LINK(,, use_hash_style="yes", use_hash_style="no")
1435 AC_MSG_RESULT($use_hash_style)
1436 if test "x-$use_hash_style" = "x-yes" ; then
1437 aros_kernel_cflags="$aros_kernel_cflags -Wl,--hash-style=sysv"
1440 CFLAGS="$save_cflags"
1442 AC_SUBST(host_cflags_iquote)
1443 AC_SUBST(host_cflags_iquote_end)
1444 AC_SUBST(kernel_cflags_iquote)
1445 AC_SUBST(kernel_cflags_iquote_end)
1446 AC_SUBST(aros_cflags_iquote)
1447 AC_SUBST(aros_cflags_iquote_end)
1450 dnl Check if user specified --with-resolution=XRESxYRESxDEPTH
1451 AC_MSG_CHECKING([for default resolution of WBScreen])
1452 AC_ARG_WITH(resolution,AC_HELP_STRING([--with-resolution=XRESxYRESxDEPTH],[Default resolution of the initial WorkbenchScreen]),resolution=$withval,resolution=none)
1453 # We require an argument, so map --with/--without ("yes"/"no") to "none" specified
1454 if test "$resolution" = "yes" ; then
1457 if test "$resolution" = "no" ; then
1460 if test "$resolution" != "none" ; then
1461 aros_default_wbwidth=`echo $resolution | cut -d'x' -f1`
1462 aros_default_wbheight=`echo $resolution | cut -d'x' -f2`
1463 aros_default_wbdepth=`echo $resolution | cut -d'x' -f3`
1465 AC_MSG_RESULT($aros_default_wbwidth x $aros_default_wbheight x $aros_default_wbdepth)
1466 aros_cv_default_wbwidth=$aros_default_wbwidth
1467 aros_cv_default_wbheight=$aros_default_wbheight
1468 aros_cv_default_wbdepth=$aros_default_wbdepth
1470 dnl See if the user wants the serial debug output for native flavour
1471 AC_MSG_CHECKING([if serial debug is enabled])
1472 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)
1473 if test "$aros_serial_debug" = 0 ; then
1474 serial_debug_forced=""
1475 if test "$serial_debug" = "yes" ; then
1478 if test "$serial_debug" = "no" ; then
1482 serial_debug_forced="(forced)"
1483 serial_debug=$aros_serial_debug
1485 if test "$serial_debug" != "none" ; then
1486 aros_serial_debug=$serial_debug
1487 AC_MSG_RESULT($serial_debug_forced on port $serial_debug)
1492 dnl See if the user wants the palm debug output hack for palm native flavour
1493 AC_MSG_CHECKING([if palm debug hack is enabled])
1494 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")
1495 if test "$palm_debug_hack" = "yes" ; then
1496 aros_palm_debug_hack="1"
1498 AC_MSG_RESULT($palm_debug_hack)
1501 dnl See if the user wants nesting supervisor activated for unix flavour
1502 AC_MSG_CHECKING([if nesting supervisor support is enabled])
1503 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")
1504 if test "$nesting_supervisor" = "yes" ; then
1505 aros_nesting_supervisor="1"
1507 AC_MSG_RESULT($nesting_supervisor)
1510 dnl things specifically required for hosted flavours
1511 if test "x-$aros_flavour" = "x-emulation" -o "x-$aros_flavour" = "x-emulcompat" ; then
1513 if test "x-$need_dlopen" != "x-no" ; then
1514 dnl some kind of dynamic library access system is required for hostlib.resource
1515 AC_CHECK_FUNC(dlopen, have_dl="yes", have_dl="no")
1516 if test "x-$have_dl" = "x-no" ; then
1517 AC_CHECK_LIB(dl, dlopen, [have_dl="yes"
1518 aros_host_ldflags="$aros_host_ldflags -ldl"],
1521 if test "x-$have_dl" = "x-no" ; then
1522 AC_MSG_ERROR([dlopen() dynamic linker functions not available])
1528 AC_ARG_ENABLE(x11_hidd, AC_HELP_STRING([--enable-x11-hidd],
1529 [build X11 hidd for hosted (default=auto)]),
1530 x11_hidd="$enableval",
1532 case "x-$x11_hidd" in
1533 x-yes|x-no|x-auto) ;;
1534 *) x11_hidd="auto" ;;
1540 if test "x-$x11_hidd" != "x-no" ; then
1546 for path in $x_libraries
1548 x_cflags="$x_cflags -L$path"
1551 for path in $x_includes
1553 x_cflags="$x_cflags -I$path"
1556 if test "x-$no_x" = "x-yes" ; then
1559 if test "x-$x11_hidd" != "x-auto" ; then
1560 dnl and they explicitly asked for it, bail out
1561 AC_MSG_ERROR([X11 libs/headers not found, cannot build X11 hidd as requested])
1565 dnl found it, setup the metatarget
1566 x11_hidd_target=kernel-x11gfx-kobj
1569 dnl setup shared memory extensions
1570 AC_ARG_ENABLE(x11_shm, AC_HELP_STRING([--enable-x11-shm],
1571 [use X11 shared memory (default=auto)]),
1572 x11_hidd_shm="$enableval",
1573 x11_hidd_shm="auto")
1574 case "x-$x11_hidd_shm" in
1575 x-yes|x-no|x-auto) ;;
1576 *) x11_hidd_shm="auto" ;;
1582 if test "x-$x11_hidd_shm" != "x-no" ; then
1584 dnl system shm headers
1585 AC_CHECK_HEADERS(sys/ipc.h)
1586 AC_CHECK_HEADERS(sys/shm.h)
1589 if test "x-$ac_cv_header_sys_ipc_h" = "x-yes" -a "x-$ac_cv_header_sys_shm_h" = "x-yes" ; then
1591 dnl make sure X libs have shm functions
1592 save_cflags="$CFLAGS"
1593 CFLAGS="$CFLAGS $x_cflags"
1594 AC_CHECK_LIB(Xext, XShmQueryExtension, have_xshm=yes)
1595 CFLAGS="$save_cflags"
1599 dnl detection done, prepare output
1600 if test "x-$have_xshm" = "x-yes" ; then
1603 elif test "x-$x11_hidd_shm" = "x-yes" ; then
1604 dnl they explicitly asked for it, but we can't do it
1605 AC_MSG_ERROR([X11 has no support for shared memory, cannot enable it as requested])
1607 dnl otherwise just disable it
1612 dnl setup vidmode (fullscreen) extensions
1613 AC_ARG_ENABLE(x11_vidmode, AC_HELP_STRING([--enable-x11-vidmode],
1614 [use X11 vidmode extension (default=auto)]),
1615 x11_hidd_vidmode="$enableval",
1616 x11_hidd_vidmode="auto")
1617 case "x-$x11_hidd_vidmode" in
1618 x-yes|x-no|x-auto) ;;
1619 *) x11_hidd_vidmode="auto" ;;
1625 if test "x-$x11_hidd_vidmode" != "x-no" ; then
1627 dnl make sure X libs have vidmode functions
1628 save_cflags="$CFLAGS"
1629 CFLAGS="$CFLAGS $x_cflags"
1630 AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryExtension, have_vidmode=yes)
1631 CFLAGS="$save_cflags"
1634 dnl detection done, prepare output
1635 if test "x-$have_vidmode" = "x-yes" ; then
1636 dnl we can do vidmode
1637 DO_VIDMODE_SUPPORT="1"
1638 elif test "x-$x11_hidd_vidmode" = "x-yes" ; then
1639 dnl they explicitly asked for it, but we can't do it
1640 AC_MSG_ERROR([X11 vidmode extension not available, cannot enable it as requested])
1642 dnl otherwise just disable it
1643 DO_VIDMODE_SUPPORT="0"
1647 aros_host_x11_includes=$x_includes
1648 aros_host_x11_libdirs=$x_libraries
1653 AC_ARG_ENABLE(sdl_hidd, AC_HELP_STRING([--enable-sdl-hidd],
1654 [build SDL hidd for hosted (default=auto)]),
1655 sdl_hidd="$enableval",
1657 case "x-$sdl_hidd" in
1658 x-yes|x-no|x-auto) ;;
1659 *) sdl_hidd="auto" ;;
1663 if test "x-$sdl_hidd" != "x-no" ; then
1666 AM_PATH_SDL([1.2.10], have_sdl="yes", have_sdl="no")
1668 if test "x-$have_sdl" != "x-yes" ; then
1671 if test "x-$sdl_hidd" != "x-auto" ; then
1672 dnl and they explicitly asked for it, bail out
1673 AC_MSG_ERROR([SDL libs/headers not found, cannot build SDL hidd as requested])
1677 dnl found it, set up the metatarget
1678 sdl_hidd_target=kernel-hidd-sdl
1679 aros_host_sdl_cflags=SDL_CFLAGS
1680 aros_host_sdl_libs=SDL_LIBS
1687 dnl See if the user wants dbus.library
1688 AC_MSG_CHECKING([if building of dbus.library is enabled])
1689 AC_ARG_ENABLE(dbus,AC_HELP_STRING([--enable-dbus],[Enable DBUS support via dbus.library (default=no)]),dbus="yes",dbus="no")
1690 if test "$dbus" = "yes" ; then
1692 DBUS_CFLAGS=`pkg-config --cflags dbus-1`
1693 DBUS_LIBFLAGS=`pkg-config --libs dbus-1`
1694 KERNEL_DBUS_KOBJ=kernel-dbus-kobj
1695 KERNEL_DBUS_INCLUDES=kernel-dbus-includes
1699 AC_MSG_RESULT($dbus)
1702 dnl --------------------------------------------------------------------
1703 dnl Configuration Output Section
1704 dnl --------------------------------------------------------------------
1709 AC_SUBST(aros_flavour)
1710 AC_SUBST(aros_flavour_uc)
1711 AC_SUBST(AROS_BUILDDIR)
1712 AC_SUBST(AROS_BUILDDIR_UNIX)
1714 AC_SUBST(AROS_PORTSSRCDIR)
1717 AC_SUBST(aros_cc_pre)
1718 AC_SUBST(aros_host_strip)
1719 AC_SUBST(aros_host_arch)
1720 AC_SUBST(aros_host_cpu)
1721 AC_SUBST(aros_host_cc)
1722 AC_SUBST(aros_host_ar)
1723 AC_SUBST(aros_host_ranlib)
1724 AC_SUBST(aros_host_ld)
1725 AC_SUBST(aros_host_make)
1726 AC_SUBST(aros_host_cflags)
1727 AC_SUBST(aros_host_ldflags)
1728 AC_SUBST(aros_host_debug)
1729 AC_SUBST(aros_host_mkdep)
1730 AC_SUBST(aros_host_mkargs)
1731 AC_SUBST(aros_host_exe_suffix)
1732 AC_SUBST(aros_host_lib_suffix)
1733 AC_SUBST(aros_tools_dir)
1734 AC_SUBST(aros_host_aclocal)
1735 AC_SUBST(aros_host_autoconf)
1736 AC_SUBST(aros_host_autoheader)
1737 AC_SUBST(aros_host_automake)
1740 AC_SUBST(aros_target_guitheme)
1741 AC_SUBST(aros_target_iconset)
1742 AC_SUBST(aros_target_bootloader)
1743 AC_SUBST(aros_target_arch)
1744 AC_SUBST(aros_target_cpu)
1745 AC_SUBST(aros_target_variant)
1746 AC_SUBST(aros_target_suffix)
1747 AC_SUBST(aros_target_incl)
1748 AC_SUBST(aros_target_ar)
1749 AC_SUBST(aros_target_ranlib)
1750 AC_SUBST(aros_kernel_nm)
1751 AC_SUBST(orig_target_cc)
1752 AC_SUBST(aros_target_cc)
1753 AC_SUBST(aros_kernel_cc)
1754 AC_SUBST(aros_target_as)
1755 AC_SUBST(orig_target_ld)
1756 AC_SUBST(aros_target_ld)
1757 AC_SUBST(aros_kernel_ld)
1758 AC_SUBST(aros_target_cc_includes)
1759 AC_SUBST(aros_target_cc_path)
1760 AC_SUBST(aros_target_objdump)
1761 AC_SUBST(aros_target_objcopy)
1762 AC_SUBST(aros_target_strip)
1763 AC_SUBST(aros_target_nm)
1764 AC_SUBST(aros_kernel_rescomp)
1765 AC_SUBST(aros_shared_default)
1766 AC_SUBST(aros_shared_ld)
1767 AC_SUBST(aros_object_format)
1768 AC_SUBST(aros_compiler_libs)
1769 AC_SUBST(aros_arch_libs)
1771 AC_SUBST(aros_config_cflags)
1772 AC_SUBST(aros_config_aflags)
1773 AC_SUBST(aros_config_ldflags)
1775 AC_SUBST(aros_shared_cflags)
1776 AC_SUBST(aros_shared_aflags)
1777 AC_SUBST(aros_shared_ldflags)
1778 AC_SUBST(aros_kernel_cflags)
1779 AC_SUBST(aros_kernel_ldflags)
1780 AC_SUBST(aros_debug_cflags)
1781 AC_SUBST(aros_debug_aflags)
1782 AC_SUBST(aros_debug_ldflags)
1783 AC_SUBST(aros_target_genmap)
1784 AC_SUBST(aros_target_strip_flags)
1787 AC_SUBST(x11_hidd_target)
1788 AC_SUBST(sdl_hidd_target)
1790 AC_SUBST(aros_default_wbwidth)
1791 AC_SUBST(aros_default_wbheight)
1792 AC_SUBST(aros_default_wbdepth)
1793 AC_SUBST(DO_XSHM_SUPPORT)
1794 AC_SUBST(DO_VIDMODE_SUPPORT)
1796 AC_SUBST(aros_host_x11_includes)
1797 AC_SUBST(aros_host_x11_libdirs)
1798 AC_SUBST(aros_host_sdl_cflags)
1799 AC_SUBST(aros_host_sdl_libs)
1801 # Native version related
1802 AC_SUBST(aros_serial_debug)
1804 # Palm native version related
1805 AC_SUBST(aros_palm_debug_hack)
1807 # Unix/Hosted version related
1808 AC_SUBST(aros_nesting_supervisor)
1811 AC_SUBST(ENABLE_DBUS)
1812 AC_SUBST(DBUS_CFLAGS)
1813 AC_SUBST(DBUS_LIBFLAGS)
1814 AC_SUBST(KERNEL_DBUS_KOBJ)
1815 AC_SUBST(KERNEL_DBUS_INCLUDES)
1818 AC_SUBST(ENABLE_X11)
1821 AC_SUBST(aros_debug)
1822 AC_SUBST(aros_mungwall_debug)
1823 AC_SUBST(aros_stack_debug)
1824 AC_SUBST(aros_modules_debug)
1826 # Collect-aros stuff: "-ius" to ignore undefined symbols
1827 AC_SUBST(ignore_undefined_symbols)
1829 # C compiler related
1830 AC_SUBST(gcc_target_cpu)
1832 dnl Prepare for output, make up all the generated patches
1833 case "$aros_flavour" in
1834 emulation) aros_flavour_uc="AROS_FLAVOUR_EMULATION"
1835 aros_flavour="emulation" ;;
1836 emulcompat) aros_flavour_uc="(AROS_FLAVOUR_EMULATION|AROS_FLAVOUR_BINCOMPAT)"
1837 aros_flavour="emulation" ;;
1838 standalone) aros_flavour_uc="AROS_FLAVOUR_STANDALONE"
1839 aros_flavour="standalone";;
1840 native) aros_flavour_uc="AROS_FLAVOUR_NATIVE"
1841 aros_flavour="native" ;;
1842 nativecompat) aros_flavour_uc="(AROS_FLAVOUR_NATIVE|AROS_FLAVOUR_BINCOMPAT)"
1843 aros_flavour="native" ;;
1844 linklib) aros_flavour_uc="AROS_FLAVOUR_LINKLIB"
1845 aros_flavour="linklib" ;;
1846 palmnative) aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
1847 aros_flavour="palmnative" ;;
1848 mac68knative) aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
1849 aros_flavour="mac68knative" ;;
1850 ppcnative) aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_BINCOMPAT)"
1851 aros_flavour="ppcnative" ;;
1854 if test ! -d ${aros_inc_dir} ; then
1855 ${MKDIR} ${aros_inc_dir}
1857 if test ! -d ${aros_geninc_dir} ; then
1858 ${MKDIR} ${aros_geninc_dir}
1860 if test ! -d ${aros_hostcfg_dir} ; then
1861 ${MKDIR} ${aros_hostcfg_dir}
1863 if test ! -d ${aros_targetcfg_dir} ; then
1864 ${MKDIR} ${aros_targetcfg_dir}
1866 if test ! -d ${aros_tools_dir} ; then
1867 ${MKDIR} ${aros_tools_dir}
1869 if test ! -d ${aros_scripts_dir} ; then
1870 ${MKDIR} ${aros_scripts_dir}
1873 AC_CONFIG_HEADERS(${aros_geninc_dir}/host-conf.h:config/host-conf.h.in)
1875 AC_CONFIG_COMMANDS([compiler_executable],
1877 prefix=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}
1879 prefix="${prefix}/${aros_target_cpu}-aros"
1880 prefix2=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros
1884 chmod a+x ${prefix2}-gcc ${prefix2}-ld
1886 ln -sf ${prefix2}-gcc ${prefix}-gcc
1887 ln -sf ${prefix2}-ld ${prefix}-ld
1889 ln -sf $aros_target_as_ln$aros_host_exe_suffix ${prefix}-as
1890 ln -sf $aros_target_nm_ln$aros_host_exe_suffix ${prefix}-nm
1891 ln -sf $aros_target_ar_ln$aros_host_exe_suffix ${prefix}-ar
1892 ln -sf $aros_target_ranlib_ln$aros_host_exe_suffix ${prefix}-ranlib
1893 ln -sf $aros_target_objcopy_ln$aros_host_exe_suffix ${prefix}-objcopy
1894 ln -sf $aros_target_objdump_ln$aros_host_exe_suffix ${prefix}-objdump
1895 ln -sf $aros_target_strip_ln$aros_host_exe_suffix ${prefix}-strip
1897 ln -sf $aros_target_as_ln$aros_host_exe_suffix ${prefix2}-as
1898 ln -sf $aros_target_nm_ln$aros_host_exe_suffix ${prefix2}-nm
1899 ln -sf $aros_target_ar_ln$aros_host_exe_suffix ${prefix2}-ar
1900 ln -sf $aros_target_ranlib_ln$aros_host_exe_suffix ${prefix2}-ranlib
1901 ln -sf $aros_target_objcopy_ln$aros_host_exe_suffix ${prefix2}-objcopy
1902 ln -sf $aros_target_objdump_ln$aros_host_exe_suffix ${prefix2}-objdump
1903 ln -sf $aros_target_strip_ln$aros_host_exe_suffix ${prefix2}-strip
1906 aros_host_exe_suffix=${aros_host_exe_suffix}
1907 aros_tools_dir=${aros_tools_dir}
1908 aros_target_cpu=${aros_target_cpu}
1909 aros_target_arch=${aros_target_arch}
1910 aros_target_suffix=${aros_target_suffix}
1911 aros_target_nm_ln=${aros_target_nm_ln}
1912 aros_target_as_ln=${aros_target_as_ln}
1913 aros_target_ar_ln=${aros_target_ar_ln}
1914 aros_target_ranlib_ln=${aros_target_ranlib_ln}
1915 aros_target_objdump_ln=${aros_target_objdump_ln}
1916 aros_target_objcopy_ln=${aros_target_objcopy_ln}
1917 aros_target_strip_ln=${aros_target_strip_ln}
1920 AC_CONFIG_COMMANDS([genshared_executable],
1921 [chmod a+x ${aros_scripts_dir}/genshared],
1922 [aros_scripts_dir=${aros_scripts_dir}]
1924 AC_CONFIG_COMMANDS([genmf_executable],
1925 [chmod a+x ${aros_tools_dir}/genmf.py],
1926 [aros_tools_dir=${aros_tools_dir}]
1932 ${aros_inc_dir}/config.h:config/config.h.in
1933 ${aros_geninc_dir}/config.h:config/config.h.in
1934 ${aros_hostcfg_dir}/host.cfg:config/host.cfg.in
1935 ${aros_targetcfg_dir}/target.cfg:config/target.cfg.in
1937 ${aros_targetcfg_dir}/make.defaults:config/make.defaults.in
1938 ${aros_targetcfg_dir}/specs:config/specs.in
1939 ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-gcc:scripts/aros-gcc.in
1940 ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-ld:scripts/aros-ld.in
1941 ${aros_scripts_dir}/genshared:compiler/c_lib/source/lib_source/genshared.in
1942 ${aros_tools_dir}/genmf.py:tools/genmf/genmf.py
1943 tools/collect-aros/env.h
1948 dnl This is in order to not define SHARED_CFLAGS sometimes
1949 dnl We don't always do aros_shared_ar, aros_shared_cflags
1951 #XXX compatability...
1952 aros_shared_ar="$aros_shared_ld $aros_shared_ldflags -o"
1954 if test -n "$aros_shared_cflags" ; then
1955 echo "SHARED_CFLAGS := $aros_shared_cflags" >> ${aros_hostcfg_dir}/host.cfg
1956 echo "SHARED_AR := $aros_shared_ar" >> ${aros_hostcfg_dir}/host.cfg