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_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"
1000 aros_flavour="emulation"
1001 aros_shared_cflags=""
1004 case "$target_cpu" in
1006 aros_target_cpu="i386"
1007 aros_object_format="elf_i386"
1008 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
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 aros_target_cpu="x86_64"
1024 aros_object_format="elf_x86_64"
1025 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
1026 aros_default_wbdepth=8
1027 gcc_target_cpu="x86_64"
1028 aros_target_cc="x86_64-aros-gcc"
1029 aros_target_ld="x86_64-aros-ld"
1030 aros_target_as="x86_64-aros-as"
1031 aros_target_ar="x86_64-aros-ar"
1032 aros_target_ranlib="x86_64-aros-ranlib"
1033 aros_target_nm="x86_64-aros-nm"
1034 aros_target_strip="x86_64-aros-strip"
1035 aros_target_objcopy="x86_64-aros-objcopy"
1036 aros_target_objdump="x86_64-aros-objdump"
1037 target_tool_prefix="x86_64-w64-mingw32-"
1040 aros_target_cpu="arm"
1041 aros_object_format="armelf_linux_eabi"
1042 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
1043 aros_default_wbdepth=8
1044 gcc_target_cpu="arm"
1045 aros_target_cc="arm-elf-gcc"
1046 aros_target_ld="arm-elf-ld"
1047 aros_target_as="arm-elf-as"
1048 aros_target_ar="arm-elf-ar"
1049 aros_target_ranlib="arm-elf-ranlib"
1050 aros_target_nm="arm-elf-nm"
1051 aros_target_strip="arm-elf-strip"
1052 aros_target_objcopy="arm-elf-objcopy"
1053 aros_target_objdump="arm-elf-objdump"
1054 target_tool_prefix="arm-mingw32ce-"
1055 aros_default_wbwidth=160
1056 aros_default_wbheight=160
1059 AC_MSG_ERROR("Unknown CPU for Mingw32 -- $target_cpu")
1062 if test $host_os = "cygwin"; then
1063 aros_kernel_cflags="-mno-cygwin"
1067 aros_target_arch="pp"
1068 aros_shared_default="no"
1069 case "$target_cpu" in
1071 aros_target_cpu="m68k"
1072 aros_object_format="m68kelf"
1073 aros_flavour="palmnative"
1074 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
1075 aros_default_wbwidth=160
1076 aros_default_wbheight=160
1077 aros_default_wbdepth=1
1078 aros_target_ar_flags="cru"
1079 aros_compiler_libs="-lgcc1"
1080 aros_shared_default=no
1081 aros_shared_cflags="-fpic"
1082 aros_shared_aflags=""
1083 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
1084 aros_kernel_ldflags="-Wl,-rpath,./lib"
1085 aros_debug_cflags="-Wall -Werror-implicit-function-declaration $aros_symbols_debug $aros_messages_debug -mc68000 -Wa,-mc68000"
1086 aros_debug_aflags=""
1087 aros_debug_ldflags="$aros_symbols_debug"
1088 aros_mungwall_debug="0"
1089 aros_modules_debug="0"
1090 gcc_target_cpu="mc68000"
1091 ignore_undefined_symbols="-ius"
1094 AC_MSG_ERROR("Unknown CPU for PalmPilot -- $target_cpu")
1100 aros_target_arch="mac"
1101 aros_shared_default="no"
1102 case "$target_cpu" in
1104 aros_target_cpu="m68k"
1105 aros_object_format="m68kelf"
1106 aros_flavour="mac68knative"
1107 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
1108 aros_default_wbwidth=512
1109 aros_default_wbheight=384
1110 aros_default_wbdepth=8
1111 aros_target_ar_flags="cru"
1112 aros_compiler_libs="-lgcc1"
1113 aros_shared_default=no
1114 aros_shared_cflags="-fpic"
1115 aros_shared_aflags=""
1116 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
1117 aros_kernel_ldflags="-Wl,-rpath,./lib"
1118 aros_debug_cflags="-Wall -Werror-implicit-function-declaration $aros_symbols_debug $aros_messages_debug -mc68000"
1119 aros_debug_aflags=""
1120 aros_debug_ldflags="$aros_symbols_debug"
1121 aros_mungwall_debug="0"
1122 aros_modules_debug="0"
1123 gcc_target_cpu="mc68000"
1124 ignore_undefined_symbols="-ius"
1127 AC_MSG_ERROR("Unknown CPU for Mac68k -- $target_cpu")
1133 AC_MSG_ERROR([Unsupported target architecture $target])
1137 AC_MSG_CHECKING([Where to download sourcecode for external ports])
1138 AC_ARG_WITH(portssources,AC_HELP_STRING([--with-portssources=DIR],[Where to download sourcecode for external ports]),with_portssrcdir=$withval,with_portssrcdir="default")
1139 if test "$with_portssrcdir" = "default"; then
1140 AROS_PORTSSRCDIR="$AROS_BUILDDIR_UNIX/bin/Sources"
1142 AROS_PORTSSRCDIR="$with_portssrcdir"
1144 AC_MSG_RESULT($AROS_PORTSSRCDIR)
1146 AC_MSG_CHECKING([which bootloader to use])
1147 AC_ARG_WITH(bootloader,AC_HELP_STRING([--with-bootloader=NAME],[Use a specific bootloader]),target_bootloader=$withval,target_bootloader=$target_bootloader)
1148 if test "$target_bootloader" = "none"; then
1149 aros_target_bootloader=""
1151 aros_target_bootloader="$target_bootloader"
1153 AC_MSG_RESULT($target_bootloader)
1155 AC_MSG_CHECKING([which icon-set to use])
1156 AC_ARG_WITH(iconset,AC_HELP_STRING([--with-iconset=NAME],[Use a specific Icon-set (default=Gorilla).]),target_iconset=$withval,target_iconset="default")
1157 if test "$target_iconset" = "default"; then
1158 aros_target_iconset="Gorilla"
1159 target_iconset="default (Gorilla)"
1161 aros_target_iconset="$target_iconset"
1163 AC_MSG_RESULT($target_iconset)
1165 AC_MSG_CHECKING([which GUI Theme to use])
1166 AC_ARG_WITH(theme,AC_HELP_STRING([--with-theme=NAME],[Use a specific GUI Theme]),target_guitheme=$withval,target_guitheme="default")
1167 if test "$target_guitheme" = "default"; then
1168 aros_target_guitheme="Ice"
1170 aros_target_guitheme="$target_guitheme"
1172 AC_MSG_RESULT($aros_target_guitheme)
1174 # Find out if we are cross-compiling (i.e. if we can't use the host compiler
1177 if test "$aros_host_cpu" != "$aros_target_cpu" ; then
1180 if test "$aros_host_cpu" == "x86_64" ; then
1181 if test "$aros_target_cpu" == "i386" ; then
1182 if test "$aros_target_arch" != "mingw32"; then
1187 if test "$aros_host_arch" == "darwin" ; then
1191 # Set prefix for target compiler etc. if we're cross-compiling
1192 # (should possibly be earlier but needs to be after AC_PROG_CC)
1193 if test "$cross_compiling" = "yes" ; then
1194 if test "$target_tool_prefix" = ""; then
1195 target_tool_prefix=${target_cpu}-elf-
1197 CC=${target_tool_prefix}gcc
1200 #-----------------------------------------------------------------------------
1202 # Disable pointer-signedness warnings if the compiler recognises the option
1204 AC_MSG_CHECKING([whether ${CC} accepts -Wno-pointer-sign])
1205 save_cflags="$CFLAGS"
1206 CFLAGS="$CFLAGS -Wno-pointer-sign"
1207 AC_TRY_COMPILE(,, use_no_sign_warning="yes", use_no_sign_warning="no")
1208 AC_MSG_RESULT($use_no_sign_warning)
1209 if test "x-$use_no_sign_warning" = "x-yes" ; then
1210 aros_config_cflags="$aros_config_cflags -Wno-pointer-sign"
1212 CFLAGS="$save_cflags"
1214 #-----------------------------------------------------------------------------
1216 # Find all the tools we need to compile. This could be cross-compiling
1217 # though! If that is the case we use the GNU form of the target and
1218 # simply add this to the front of the binary name. This is rather simple,
1219 # but it should work under most circumstances.
1221 # The default tools are to use the same as the host, but only if the
1222 # host and target CPU are the same. With GCC this is normally enough.
1226 aros_shared_ld="$aros_host_ld"
1228 aros_target_mkdep="$aros_host_mkdep"
1229 aros_target_incl_def="$aros_host_incl"
1231 aros_kernel_cc="$CC"
1233 # The default tools executables to be linked to.
1234 if test "$aros_target_cc" != ""; then
1235 AC_PATH_PROG(aros_target_cc,$aros_target_cc)
1236 AROS_REQUIRED(gcc,$aros_target_cc)
1238 if test "$aros_target_ld" != ""; then
1239 AC_PATH_PROG(aros_target_ld,$aros_target_ld)
1240 AROS_REQUIRED(ld,$aros_target_ld)
1243 if test "$crosstools" != "yes"; then
1244 AROS_TOOL_TARGET(aros_target_as_ln,as,$aros_target_as)
1245 AROS_REQUIRED(as,$aros_target_as_ln)
1246 AROS_TOOL_TARGET(aros_kernel_ld,ld,$aros_kernel_ld)
1247 AROS_REQUIRED(ld,$aros_kernel_ld)
1248 AROS_TOOL_TARGET(aros_target_ar_ln,ar,$aros_target_ar)
1249 AROS_REQUIRED(ar,$aros_target_ar_ln)
1250 AROS_TOOL_TARGET(aros_target_nm_ln,nm,$aros_target_nm)
1251 AROS_REQUIRED(nm,$aros_target_nm_ln)
1252 AROS_TOOL_TARGET(aros_target_objcopy_ln,objcopy,$aros_target_objcopy)
1253 AROS_REQUIRED(objcopy,$aros_target_objcopy_ln)
1254 AROS_TOOL_TARGET(aros_target_objdump_ln,objdump,$aros_target_objdump)
1255 AROS_REQUIRED(objdump,$aros_target_objdump_ln)
1256 AROS_TOOL_TARGET(aros_target_ranlib_ln,ranlib,$aros_target_ranlib)
1257 AROS_REQUIRED(ranlib,$aros_target_ranlib_ln)
1258 AROS_TOOL_TARGET(aros_target_strip_ln,strip,$aros_target_strip)
1259 AROS_REQUIRED(strip,$aros_target_strip_ln)
1262 if test "$rescomp" != ""; then
1263 if test "$cross_compiling" = "yes" ; then
1264 rescomp=${target_tool_prefix}${rescomp}
1266 AC_PATH_PROG(aros_kernel_rescomp,$rescomp)
1267 AROS_REQUIRED($rescomp,$aros_kernel_rescomp)
1270 aros_hostcfg_dir="bin/${aros_host_arch}-${aros_host_cpu}/gen/config"
1271 aros_targetcfg_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/config"
1272 aros_inc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/AROS/Development/include/aros"
1273 aros_gendir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen"
1274 aros_geninc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/include/aros"
1275 aros_tools_dir="bin/${aros_host_arch}-${aros_host_cpu}/tools"
1276 aros_scripts_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/scripts"
1278 # aros_cc_pre is a variable that is added to the front of the compiler name
1279 # in the generated aros-gcc shell script. We need this to enable the cache
1280 # to work across cleaned builds. Also, support DISTCC using the correct
1281 # environment variable.
1284 if test "x${DISTCC}" != "x" ; then
1285 if test "x${CCACHE}" != "x" ; then
1286 aros_cc_pre="env CCACHE_PREFIX=${DISTCC} ${CCACHE} "
1288 aros_cc_pre="${DISTCC} "
1291 if test "x${CCACHE}" != "x" ; then
1292 aros_cc_pre="${CCACHE} "
1296 prefix="${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros"
1298 AC_SUBST(aros_target_nostdinc_cflags,-nostdinc)
1299 AC_SUBST(aros_target_nostartup_ldflags,-nostartfiles)
1300 AC_SUBST(aros_target_nix_ldflags,-nix)
1301 AC_SUBST(aros_target_detach_ldflags,-detach)
1302 AC_SUBST(aros_target_nostdlib_ldflags,-nostdlib)
1305 if test "$aros_target_cc" = ""; then
1306 orig_target_cc=$aros_kernel_cc
1308 orig_target_cc=$aros_target_cc
1310 if test "$aros_target_ld" = ""; then
1311 orig_target_ld=$aros_kernel_ld
1313 orig_target_ld=$aros_target_ld
1315 if test "$GCC" = "yes"; then
1316 aros_target_cc_path=`$orig_target_cc -print-search-dirs | grep "programs: =" | cut -c 12-`
1318 aros_target_cc="${prefix}-gcc"
1319 aros_target_as="${prefix}-as"
1320 aros_target_ld="${prefix}-ld"
1321 aros_target_ar="${prefix}-ar $aros_target_ar_flags"
1322 aros_target_objcopy=${prefix}-objcopy
1323 aros_target_objdump=${prefix}-objdump
1324 aros_target_ranlib="${prefix}-ranlib $aros_target_ranlib_flags"
1325 aros_target_nm="${prefix}-nm $aros_target_nm_flags"
1326 aros_kernel_nm="${prefix}-nm"
1327 aros_target_strip=${prefix}-strip
1329 # Find the system include path. We can suggest that an alternative is
1330 # used if we don't get it correct. The default is to use /usr/include.
1331 # Which is set in the aros_target_incl_def variable.
1333 AC_ARG_ENABLE(includes,
1334 AC_HELP_STRING([--enable-includes=dir],[Alternative system include directory]),
1335 [aros_target_incl=$enable_includes], [aros_target_incl=$aros_target_incl_def])
1337 dnl find out about the target cc's include path
1338 AC_MSG_CHECKING([for the target compiler's include path])
1339 if test "$aros_target_cc_includes" = "" ; then
1340 #try to guess where the directory is
1341 aros_target_cc_includes=`dirname \`${orig_target_cc} -print-libgcc-file-name\``/include
1342 if ! test -d $aros_target_cc_includes; then
1343 #the directory doesn't exist, we need to do some more work
1344 aros_target_cc_includes=${PWD}/${aros_gendir}/cc_include
1346 #these are the headers we're looling for
1347 headers="limits.h mmintrin.h stdbool.h syslimits.h float.h \
1348 stddef.h xmmintrin.h iso646.h stdarg.h unwind.h \
1352 for h in $headers; do
1353 #which other headers each of the above headers needs?
1354 deps=$(echo "#include <$h>" | \
1355 $aros_host_cc -E -M - 2>/dev/null | \
1356 sed 's/^.*://; s/\\$/ /g; s/[[ \t]]\+/ /g')
1358 #copy all the needed headers to a directory beneath gendir
1361 dir=${aros_target_cc_includes}$(echo $(dirname $d) | \
1362 sed -n "s,^.*/include\(/.*\),\1,p")
1363 ! test -d $dir && mkdir -p $dir
1364 ! test -f $dir/$h && { cp $d $dir; chmod u+w $dir/$h; }
1369 AC_MSG_RESULT($aros_target_cc_includes)
1372 # For GCC < 4.0 -I- is used for giving the search path for '#include "..."'
1373 # On GCC >= 4.0 -iquote should be used
1377 save_cflags="$CFLAGS"
1379 AC_MSG_CHECKING([whether ${CC} accepts -iquote])
1380 AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
1381 AC_MSG_RESULT($has_iquote)
1382 if test "x-$has_iquote" = "x-yes" ; then
1383 host_cflags_iquote=-iquote
1384 host_cflags_iquote_end=
1386 host_cflags_iquote=-I
1387 host_cflags_iquote_end=-I-
1389 kernel_cflags_iquote=$host_cflags_iquote
1390 kernel_cflags_iquote_end=$host_cflags_iquote_end
1391 if test "x-$cross_compiling" = "x-yes"; then
1392 CC="$aros_kernel_cc"
1393 AC_MSG_CHECKING([whether ${CC} accepts -fno-stack-protector])
1394 AC_TRY_COMPILE(,, use_no_stack_protector="yes", use_no_stack_protector="no")
1395 AC_MSG_RESULT($use_no_stack_protector)
1396 AC_MSG_CHECKING([whether ${CC} accepts -iquote])
1397 AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
1398 AC_MSG_RESULT($has_iquote)
1399 if test "x-$has_iquote" = "x-yes" ; then
1400 kernel_cflags_iquote=-iquote
1401 kernel_cflags_iquote_end=
1403 kernel_cflags_iquote=-I
1404 kernel_cflags_iquote_end=-I-
1407 aros_cflags_iquote=$kernel_cflags_iquote
1408 aros_cflags_iquote_end=$kernel_cflags_iquote_end
1409 if test "$orig_target_cc" != "$aros_kernel_cc"; then
1410 CC="$orig_target_cc"
1411 AC_MSG_CHECKING([whether ${CC} accepts -iquote])
1412 AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
1413 AC_MSG_RESULT($has_iquote)
1414 if test "x-$has_iquote" = "x-yes" ; then
1415 aros_cflags_iquote=-iquote
1416 aros_cflags_iquote_end=
1418 aros_cflags_iquote=-I
1419 aros_cflags_iquote_end=-I-
1422 if test "x-$use_no_stack_protector" = "x-yes" ; then
1423 aros_kernel_cflags="$aros_kernel_cflags -fno-stack-protector"
1426 #-----------------------------------------------------------------------------
1428 # Check if we can explicitly choose older version of symbol hashing
1430 CFLAGS="save_cflags -Wl,--hash-style=sysv"
1431 CC="$aros_kernel_cc"
1432 AC_MSG_CHECKING([whether ${CC} accepts -Wl,--hash-style=sysv])
1433 AC_TRY_LINK(,, use_hash_style="yes", use_hash_style="no")
1434 AC_MSG_RESULT($use_hash_style)
1435 if test "x-$use_hash_style" = "x-yes" ; then
1436 aros_kernel_cflags="$aros_kernel_cflags -Wl,--hash-style=sysv"
1439 CFLAGS="$save_cflags"
1441 AC_SUBST(host_cflags_iquote)
1442 AC_SUBST(host_cflags_iquote_end)
1443 AC_SUBST(kernel_cflags_iquote)
1444 AC_SUBST(kernel_cflags_iquote_end)
1445 AC_SUBST(aros_cflags_iquote)
1446 AC_SUBST(aros_cflags_iquote_end)
1449 dnl Check if user specified --with-resolution=XRESxYRESxDEPTH
1450 AC_MSG_CHECKING([for default resolution of WBScreen])
1451 AC_ARG_WITH(resolution,AC_HELP_STRING([--with-resolution=XRESxYRESxDEPTH],[Default resolution of the initial WorkbenchScreen]),resolution=$withval,resolution=none)
1452 # We require an argument, so map --with/--without ("yes"/"no") to "none" specified
1453 if test "$resolution" = "yes" ; then
1456 if test "$resolution" = "no" ; then
1459 if test "$resolution" != "none" ; then
1460 aros_default_wbwidth=`echo $resolution | cut -d'x' -f1`
1461 aros_default_wbheight=`echo $resolution | cut -d'x' -f2`
1462 aros_default_wbdepth=`echo $resolution | cut -d'x' -f3`
1464 AC_MSG_RESULT($aros_default_wbwidth x $aros_default_wbheight x $aros_default_wbdepth)
1465 aros_cv_default_wbwidth=$aros_default_wbwidth
1466 aros_cv_default_wbheight=$aros_default_wbheight
1467 aros_cv_default_wbdepth=$aros_default_wbdepth
1469 dnl See if the user wants the serial debug output for native flavour
1470 AC_MSG_CHECKING([if serial debug is enabled])
1471 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)
1472 if test "$aros_serial_debug" = 0 ; then
1473 serial_debug_forced=""
1474 if test "$serial_debug" = "yes" ; then
1477 if test "$serial_debug" = "no" ; then
1481 serial_debug_forced="(forced)"
1482 serial_debug=$aros_serial_debug
1484 if test "$serial_debug" != "none" ; then
1485 aros_serial_debug=$serial_debug
1486 AC_MSG_RESULT($serial_debug_forced on port $serial_debug)
1491 dnl See if the user wants the palm debug output hack for palm native flavour
1492 AC_MSG_CHECKING([if palm debug hack is enabled])
1493 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")
1494 if test "$palm_debug_hack" = "yes" ; then
1495 aros_palm_debug_hack="1"
1497 AC_MSG_RESULT($palm_debug_hack)
1500 dnl See if the user wants nesting supervisor activated for unix flavour
1501 AC_MSG_CHECKING([if nesting supervisor support is enabled])
1502 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")
1503 if test "$nesting_supervisor" = "yes" ; then
1504 aros_nesting_supervisor="1"
1506 AC_MSG_RESULT($nesting_supervisor)
1509 dnl things specifically required for hosted flavours
1510 if test "x-$aros_flavour" = "x-emulation" -o "x-$aros_flavour" = "x-emulcompat" ; then
1512 if test "x-$need_dlopen" != "x-no" ; then
1513 dnl some kind of dynamic library access system is required for hostlib.resource
1514 AC_CHECK_FUNC(dlopen, have_dl="yes", have_dl="no")
1515 if test "x-$have_dl" = "x-no" ; then
1516 AC_CHECK_LIB(dl, dlopen, [have_dl="yes"
1517 aros_host_ldflags="$aros_host_ldflags -ldl"],
1520 if test "x-$have_dl" = "x-no" ; then
1521 AC_MSG_ERROR([dlopen() dynamic linker functions not available])
1527 AC_ARG_ENABLE(x11_hidd, AC_HELP_STRING([--enable-x11-hidd],
1528 [build X11 hidd for hosted (default=auto)]),
1529 x11_hidd="$enableval",
1531 case "x-$x11_hidd" in
1532 x-yes|x-no|x-auto) ;;
1533 *) x11_hidd="auto" ;;
1539 if test "x-$x11_hidd" != "x-no" ; then
1545 for path in $x_libraries
1547 x_cflags="$x_cflags -L$path"
1550 for path in $x_includes
1552 x_cflags="$x_cflags -I$path"
1555 if test "x-$no_x" = "x-yes" ; then
1558 if test "x-$x11_hidd" != "x-auto" ; then
1559 dnl and they explicitly asked for it, bail out
1560 AC_MSG_ERROR([X11 libs/headers not found, cannot build X11 hidd as requested])
1564 dnl found it, setup the metatarget
1565 x11_hidd_target=kernel-x11gfx-kobj
1568 dnl setup shared memory extensions
1569 AC_ARG_ENABLE(x11_shm, AC_HELP_STRING([--enable-x11-shm],
1570 [use X11 shared memory (default=auto)]),
1571 x11_hidd_shm="$enableval",
1572 x11_hidd_shm="auto")
1573 case "x-$x11_hidd_shm" in
1574 x-yes|x-no|x-auto) ;;
1575 *) x11_hidd_shm="auto" ;;
1581 if test "x-$x11_hidd_shm" != "x-no" ; then
1583 dnl system shm headers
1584 AC_CHECK_HEADERS(sys/ipc.h)
1585 AC_CHECK_HEADERS(sys/shm.h)
1588 if test "x-$ac_cv_header_sys_ipc_h" = "x-yes" -a "x-$ac_cv_header_sys_shm_h" = "x-yes" ; then
1590 dnl make sure X libs have shm functions
1591 save_cflags="$CFLAGS"
1592 CFLAGS="$CFLAGS $x_cflags"
1593 AC_CHECK_LIB(Xext, XShmQueryExtension, have_xshm=yes)
1594 CFLAGS="$save_cflags"
1598 dnl detection done, prepare output
1599 if test "x-$have_xshm" = "x-yes" ; then
1602 elif test "x-$x11_hidd_shm" = "x-yes" ; then
1603 dnl they explicitly asked for it, but we can't do it
1604 AC_MSG_ERROR([X11 has no support for shared memory, cannot enable it as requested])
1606 dnl otherwise just disable it
1611 dnl setup vidmode (fullscreen) extensions
1612 AC_ARG_ENABLE(x11_vidmode, AC_HELP_STRING([--enable-x11-vidmode],
1613 [use X11 vidmode extension (default=auto)]),
1614 x11_hidd_vidmode="$enableval",
1615 x11_hidd_vidmode="auto")
1616 case "x-$x11_hidd_vidmode" in
1617 x-yes|x-no|x-auto) ;;
1618 *) x11_hidd_vidmode="auto" ;;
1624 if test "x-$x11_hidd_vidmode" != "x-no" ; then
1626 dnl make sure X libs have vidmode functions
1627 save_cflags="$CFLAGS"
1628 CFLAGS="$CFLAGS $x_cflags"
1629 AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryExtension, have_vidmode=yes)
1630 CFLAGS="$save_cflags"
1633 dnl detection done, prepare output
1634 if test "x-$have_vidmode" = "x-yes" ; then
1635 dnl we can do vidmode
1636 DO_VIDMODE_SUPPORT="1"
1637 elif test "x-$x11_hidd_vidmode" = "x-yes" ; then
1638 dnl they explicitly asked for it, but we can't do it
1639 AC_MSG_ERROR([X11 vidmode extension not available, cannot enable it as requested])
1641 dnl otherwise just disable it
1642 DO_VIDMODE_SUPPORT="0"
1646 aros_host_x11_includes=$x_includes
1647 aros_host_x11_libdirs=$x_libraries
1652 AC_ARG_ENABLE(sdl_hidd, AC_HELP_STRING([--enable-sdl-hidd],
1653 [build SDL hidd for hosted (default=auto)]),
1654 sdl_hidd="$enableval",
1656 case "x-$sdl_hidd" in
1657 x-yes|x-no|x-auto) ;;
1658 *) sdl_hidd="auto" ;;
1662 if test "x-$sdl_hidd" != "x-no" ; then
1665 AM_PATH_SDL([1.2.10], have_sdl="yes", have_sdl="no")
1667 if test "x-$have_sdl" != "x-yes" ; then
1670 if test "x-$sdl_hidd" != "x-auto" ; then
1671 dnl and they explicitly asked for it, bail out
1672 AC_MSG_ERROR([SDL libs/headers not found, cannot build SDL hidd as requested])
1676 dnl found it, set up the metatarget
1677 sdl_hidd_target=kernel-hidd-sdl
1678 aros_host_sdl_cflags=SDL_CFLAGS
1679 aros_host_sdl_libs=SDL_LIBS
1686 dnl See if the user wants dbus.library
1687 AC_MSG_CHECKING([if building of dbus.library is enabled])
1688 AC_ARG_ENABLE(dbus,AC_HELP_STRING([--enable-dbus],[Enable DBUS support via dbus.library (default=no)]),dbus="yes",dbus="no")
1689 if test "$dbus" = "yes" ; then
1691 DBUS_CFLAGS=`pkg-config --cflags dbus-1`
1692 DBUS_LIBFLAGS=`pkg-config --libs dbus-1`
1693 KERNEL_DBUS_KOBJ=kernel-dbus-kobj
1694 KERNEL_DBUS_INCLUDES=kernel-dbus-includes
1698 AC_MSG_RESULT($dbus)
1701 dnl --------------------------------------------------------------------
1702 dnl Configuration Output Section
1703 dnl --------------------------------------------------------------------
1708 AC_SUBST(aros_flavour)
1709 AC_SUBST(aros_flavour_uc)
1710 AC_SUBST(AROS_BUILDDIR)
1711 AC_SUBST(AROS_BUILDDIR_UNIX)
1713 AC_SUBST(AROS_PORTSSRCDIR)
1716 AC_SUBST(aros_cc_pre)
1717 AC_SUBST(aros_host_strip)
1718 AC_SUBST(aros_host_arch)
1719 AC_SUBST(aros_host_cpu)
1720 AC_SUBST(aros_host_cc)
1721 AC_SUBST(aros_host_ar)
1722 AC_SUBST(aros_host_ranlib)
1723 AC_SUBST(aros_host_ld)
1724 AC_SUBST(aros_host_make)
1725 AC_SUBST(aros_host_cflags)
1726 AC_SUBST(aros_host_ldflags)
1727 AC_SUBST(aros_host_debug)
1728 AC_SUBST(aros_host_mkdep)
1729 AC_SUBST(aros_host_mkargs)
1730 AC_SUBST(aros_host_exe_suffix)
1731 AC_SUBST(aros_host_lib_suffix)
1732 AC_SUBST(aros_tools_dir)
1733 AC_SUBST(aros_host_aclocal)
1734 AC_SUBST(aros_host_autoconf)
1735 AC_SUBST(aros_host_autoheader)
1736 AC_SUBST(aros_host_automake)
1739 AC_SUBST(aros_target_guitheme)
1740 AC_SUBST(aros_target_iconset)
1741 AC_SUBST(aros_target_bootloader)
1742 AC_SUBST(aros_target_arch)
1743 AC_SUBST(aros_target_cpu)
1744 AC_SUBST(aros_target_variant)
1745 AC_SUBST(aros_target_suffix)
1746 AC_SUBST(aros_target_incl)
1747 AC_SUBST(aros_target_ar)
1748 AC_SUBST(aros_target_ranlib)
1749 AC_SUBST(aros_kernel_nm)
1750 AC_SUBST(orig_target_cc)
1751 AC_SUBST(aros_target_cc)
1752 AC_SUBST(aros_kernel_cc)
1753 AC_SUBST(aros_target_as)
1754 AC_SUBST(orig_target_ld)
1755 AC_SUBST(aros_target_ld)
1756 AC_SUBST(aros_kernel_ld)
1757 AC_SUBST(aros_target_cc_includes)
1758 AC_SUBST(aros_target_cc_path)
1759 AC_SUBST(aros_target_objdump)
1760 AC_SUBST(aros_target_objcopy)
1761 AC_SUBST(aros_target_strip)
1762 AC_SUBST(aros_target_nm)
1763 AC_SUBST(aros_kernel_rescomp)
1764 AC_SUBST(aros_shared_default)
1765 AC_SUBST(aros_shared_ld)
1766 AC_SUBST(aros_object_format)
1767 AC_SUBST(aros_compiler_libs)
1768 AC_SUBST(aros_arch_libs)
1770 AC_SUBST(aros_config_cflags)
1771 AC_SUBST(aros_config_aflags)
1772 AC_SUBST(aros_config_ldflags)
1774 AC_SUBST(aros_shared_cflags)
1775 AC_SUBST(aros_shared_aflags)
1776 AC_SUBST(aros_shared_ldflags)
1777 AC_SUBST(aros_kernel_cflags)
1778 AC_SUBST(aros_kernel_ldflags)
1779 AC_SUBST(aros_debug_cflags)
1780 AC_SUBST(aros_debug_aflags)
1781 AC_SUBST(aros_debug_ldflags)
1782 AC_SUBST(aros_target_genmap)
1783 AC_SUBST(aros_target_strip_flags)
1786 AC_SUBST(x11_hidd_target)
1787 AC_SUBST(sdl_hidd_target)
1789 AC_SUBST(aros_default_wbwidth)
1790 AC_SUBST(aros_default_wbheight)
1791 AC_SUBST(aros_default_wbdepth)
1792 AC_SUBST(DO_XSHM_SUPPORT)
1793 AC_SUBST(DO_VIDMODE_SUPPORT)
1795 AC_SUBST(aros_host_x11_includes)
1796 AC_SUBST(aros_host_x11_libdirs)
1797 AC_SUBST(aros_host_sdl_cflags)
1798 AC_SUBST(aros_host_sdl_libs)
1800 # Native version related
1801 AC_SUBST(aros_serial_debug)
1803 # Palm native version related
1804 AC_SUBST(aros_palm_debug_hack)
1806 # Unix/Hosted version related
1807 AC_SUBST(aros_nesting_supervisor)
1810 AC_SUBST(ENABLE_DBUS)
1811 AC_SUBST(DBUS_CFLAGS)
1812 AC_SUBST(DBUS_LIBFLAGS)
1813 AC_SUBST(KERNEL_DBUS_KOBJ)
1814 AC_SUBST(KERNEL_DBUS_INCLUDES)
1817 AC_SUBST(ENABLE_X11)
1820 AC_SUBST(aros_debug)
1821 AC_SUBST(aros_mungwall_debug)
1822 AC_SUBST(aros_stack_debug)
1823 AC_SUBST(aros_modules_debug)
1825 # Collect-aros stuff: "-ius" to ignore undefined symbols
1826 AC_SUBST(ignore_undefined_symbols)
1828 # C compiler related
1829 AC_SUBST(gcc_target_cpu)
1831 dnl Prepare for output, make up all the generated patches
1832 case "$aros_flavour" in
1833 emulation) aros_flavour_uc="AROS_FLAVOUR_EMULATION"
1834 aros_flavour="emulation" ;;
1835 emulcompat) aros_flavour_uc="(AROS_FLAVOUR_EMULATION|AROS_FLAVOUR_BINCOMPAT)"
1836 aros_flavour="emulation" ;;
1837 standalone) aros_flavour_uc="AROS_FLAVOUR_STANDALONE"
1838 aros_flavour="standalone";;
1839 native) aros_flavour_uc="AROS_FLAVOUR_NATIVE"
1840 aros_flavour="native" ;;
1841 nativecompat) aros_flavour_uc="(AROS_FLAVOUR_NATIVE|AROS_FLAVOUR_BINCOMPAT)"
1842 aros_flavour="native" ;;
1843 linklib) aros_flavour_uc="AROS_FLAVOUR_LINKLIB"
1844 aros_flavour="linklib" ;;
1845 palmnative) aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
1846 aros_flavour="palmnative" ;;
1847 mac68knative) aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
1848 aros_flavour="mac68knative" ;;
1849 ppcnative) aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_BINCOMPAT)"
1850 aros_flavour="ppcnative" ;;
1853 if test ! -d ${aros_inc_dir} ; then
1854 ${MKDIR} ${aros_inc_dir}
1856 if test ! -d ${aros_geninc_dir} ; then
1857 ${MKDIR} ${aros_geninc_dir}
1859 if test ! -d ${aros_hostcfg_dir} ; then
1860 ${MKDIR} ${aros_hostcfg_dir}
1862 if test ! -d ${aros_targetcfg_dir} ; then
1863 ${MKDIR} ${aros_targetcfg_dir}
1865 if test ! -d ${aros_tools_dir} ; then
1866 ${MKDIR} ${aros_tools_dir}
1868 if test ! -d ${aros_scripts_dir} ; then
1869 ${MKDIR} ${aros_scripts_dir}
1872 AC_CONFIG_HEADERS(${aros_geninc_dir}/host-conf.h:config/host-conf.h.in)
1874 AC_CONFIG_COMMANDS([compiler_executable],
1876 prefix=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}
1878 prefix="${prefix}/${aros_target_cpu}-aros"
1879 prefix2=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros
1883 chmod a+x ${prefix2}-gcc ${prefix2}-ld
1885 ln -sf ${prefix2}-gcc ${prefix}-gcc
1886 ln -sf ${prefix2}-ld ${prefix}-ld
1888 ln -sf $aros_target_as_ln$aros_host_exe_suffix ${prefix}-as
1889 ln -sf $aros_target_nm_ln$aros_host_exe_suffix ${prefix}-nm
1890 ln -sf $aros_target_ar_ln$aros_host_exe_suffix ${prefix}-ar
1891 ln -sf $aros_target_ranlib_ln$aros_host_exe_suffix ${prefix}-ranlib
1892 ln -sf $aros_target_objcopy_ln$aros_host_exe_suffix ${prefix}-objcopy
1893 ln -sf $aros_target_objdump_ln$aros_host_exe_suffix ${prefix}-objdump
1894 ln -sf $aros_target_strip_ln$aros_host_exe_suffix ${prefix}-strip
1896 ln -sf $aros_target_as_ln$aros_host_exe_suffix ${prefix2}-as
1897 ln -sf $aros_target_nm_ln$aros_host_exe_suffix ${prefix2}-nm
1898 ln -sf $aros_target_ar_ln$aros_host_exe_suffix ${prefix2}-ar
1899 ln -sf $aros_target_ranlib_ln$aros_host_exe_suffix ${prefix2}-ranlib
1900 ln -sf $aros_target_objcopy_ln$aros_host_exe_suffix ${prefix2}-objcopy
1901 ln -sf $aros_target_objdump_ln$aros_host_exe_suffix ${prefix2}-objdump
1902 ln -sf $aros_target_strip_ln$aros_host_exe_suffix ${prefix2}-strip
1905 aros_host_exe_suffix=${aros_host_exe_suffix}
1906 aros_tools_dir=${aros_tools_dir}
1907 aros_target_cpu=${aros_target_cpu}
1908 aros_target_arch=${aros_target_arch}
1909 aros_target_suffix=${aros_target_suffix}
1910 aros_target_nm_ln=${aros_target_nm_ln}
1911 aros_target_as_ln=${aros_target_as_ln}
1912 aros_target_ar_ln=${aros_target_ar_ln}
1913 aros_target_ranlib_ln=${aros_target_ranlib_ln}
1914 aros_target_objdump_ln=${aros_target_objdump_ln}
1915 aros_target_objcopy_ln=${aros_target_objcopy_ln}
1916 aros_target_strip_ln=${aros_target_strip_ln}
1919 AC_CONFIG_COMMANDS([genshared_executable],
1920 [chmod a+x ${aros_scripts_dir}/genshared],
1921 [aros_scripts_dir=${aros_scripts_dir}]
1923 AC_CONFIG_COMMANDS([genmf_executable],
1924 [chmod a+x ${aros_tools_dir}/genmf.py],
1925 [aros_tools_dir=${aros_tools_dir}]
1931 ${aros_inc_dir}/config.h:config/config.h.in
1932 ${aros_geninc_dir}/config.h:config/config.h.in
1933 ${aros_hostcfg_dir}/host.cfg:config/host.cfg.in
1934 ${aros_targetcfg_dir}/target.cfg:config/target.cfg.in
1936 ${aros_targetcfg_dir}/make.defaults:config/make.defaults.in
1937 ${aros_targetcfg_dir}/specs:config/specs.in
1938 ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-gcc:scripts/aros-gcc.in
1939 ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-ld:scripts/aros-ld.in
1940 ${aros_scripts_dir}/genshared:compiler/c_lib/source/lib_source/genshared.in
1941 ${aros_tools_dir}/genmf.py:tools/genmf/genmf.py
1942 tools/collect-aros/env.h
1947 dnl This is in order to not define SHARED_CFLAGS sometimes
1948 dnl We don't always do aros_shared_ar, aros_shared_cflags
1950 #XXX compatability...
1951 aros_shared_ar="$aros_shared_ld $aros_shared_ldflags -o"
1953 if test -n "$aros_shared_cflags" ; then
1954 echo "SHARED_CFLAGS := $aros_shared_cflags" >> ${aros_hostcfg_dir}/host.cfg
1955 echo "SHARED_AR := $aros_shared_ar" >> ${aros_hostcfg_dir}/host.cfg