1 dnl Copyright © 1997-2009, 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 #don't know where else to put this...
47 AC_MSG_CHECKING([Building AROS in .. ])
49 AC_MSG_RESULT($AROS_BUILDDIR)
50 AROS_BUILDDIR_NATIVE=$AROS_BUILDDIR
52 AC_MSG_CHECKING([AROS Source in .. ])
53 srcpwd=`cd ${srcdir} ; ${PWDCMD-pwd}`
55 AC_MSG_RESULT($SRCDIR)
57 # Parse the target field into something useful.
59 target_os=`echo $target | sed 's/^\([^-]*\)-\(.*\)$/\1/'`
60 target_cpu=`echo $target | sed 's/^\([^-]*\)-\(.*\)$/\2/'`
63 dnl --------------------------------------------------------------------
64 dnl Set the default Workbench resolution
65 dnl --------------------------------------------------------------------
66 aros_default_wbwidth=800
67 aros_default_wbheight=600
68 aros_default_wbdepth=4
70 dnl --------------------------------------------------------------------
71 dnl Host Configuration Section
72 dnl --------------------------------------------------------------------
74 dnl The idea here is to find out all the information we need about the
75 dnl host. This means things like tools for building directory structures,
76 dnl copying files around and the like.
78 # The first step is to find the host binaries.
79 # Check for a compiler.
84 # Check for a compatible awk
85 AC_CHECK_PROGS(AWK,[gawk nawk])
86 AROS_REQUIRED(gawk,$AWK)
87 AROS_PROG(MMAKE,mmake)
89 # Perform some default variable assignments. Note all of these will be
90 # Regenerated from the script, so there is no need to cache them.
93 AROS_TOOL_CCPATH(aros_host_ld,ld)
94 AROS_REQUIRED(ld,$aros_host_ld)
96 aros_host_cflags=$CFLAGS
97 aros_host_ldflags=$LDFLAGS
98 aros_host_debug="-g -O0"
99 aros_host_mkdep="\$(SRCDIR)/scripts/mkdep"
100 aros_host_mkargs="--no-print-directory"
101 aros_host_incl="/usr/include"
102 aros_host_exe_suffix="$EXEEXT"
103 aros_host_lib_suffix=""
105 AC_CHECK_PROGS(aros_host_aclocal,[aclocal aclocal19 aclocal-1.9])
106 AC_CHECK_PROGS(aros_host_autoconf,[autoconf autoconf259 autoconf253])
107 AC_CHECK_PROGS(aros_host_autoheader,[autoheader autoheader259 autoheader253])
108 AC_CHECK_PROGS(aros_host_automake,[automake automake19 automake-1.9])
110 AROS_REQUIRED(aclocal/aclocal19/aclocal-1.9, $aros_host_aclocal)
111 AROS_REQUIRED(automake/automake19/automake-1.9, $aros_host_automake)
113 case "$aros_host_cc" in
115 aros_host_cc_pipe="-pipe"
125 dnl Despite the name, this is really a host configuration variable.
126 aros_target_cc_includes=""
128 # This is the main host configuration section. It is where the host
129 # can change the values of any variables it needs to change. We do
130 # not look at anything that compiles to the target yet, we'll get
135 aros_host_arch="aros"
136 aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
142 aros_host_cpu="x86_64"
145 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
146 aros_host_cpu="$host_cpu"
152 aros_host_arch="linux"
153 aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
159 aros_host_cpu="x86_64"
168 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
169 aros_host_cpu="$host_cpu"
175 aros_host_cc="$aros_host_cc $aros_host_cc_pipe -I/usr/local/include"
176 aros_host_make="gmake"
177 aros_host_arch="freebsd"
180 aros_host_ldflags="$aros_host_ldflags -L/usr/local/lib -liconv"
182 dnl Need to override this here, it's just too hard later.
183 dnl This shouldn't be here at all...
184 dnl aros_target_cc_includes="/usr/include"
186 dnl FreeBSD 5.x (and later) has changed the default object format.
187 dnl The double [[]] is necessary to get around m4's quoting rules.
190 aros_object_format="elf_i386"
194 aros_object_format="elf_i386_fbsd"
201 aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
202 aros_host_arch="darwin"
211 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
212 aros_host_cpu="$host_cpu"
216 aros_host_ldflags="$aros_host_ldflags -liconv"
221 aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
222 aros_host_make="gmake"
223 aros_host_arch="dragonfly"
229 aros_host_cpu="x86_64"
232 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
233 aros_host_cpu="$host_cpu"
239 aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
240 aros_host_make="gmake"
241 aros_host_arch="netbsd"
250 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
251 aros_host_cpu="$host_cpu"
254 aros_host_lib_suffix=".0.0"
258 aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
259 aros_host_make="gmake"
260 aros_host_arch="openbsd"
266 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
267 aros_host_cpu="$host_cpu"
273 aros_host_arch="solaris"
274 aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
280 aros_host_cpu="sparc"
283 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
284 aros_host_cpu="$host_cpu"
290 aros_host_arch="morphos"
295 aros_host_arch="amiga"
300 TOUCH="/gg/bin/touch"
309 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
310 aros_host_cpu="$host_cpu"
316 aros_host_arch="cygwin"
317 aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
323 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
324 aros_host_cpu="$host_cpu"
330 aros_host_arch="mingw32"
331 aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
332 AROS_BUILDDIR_NATIVE=`pwd -W`
338 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
339 aros_host_cpu="$host_cpu"
344 AC_MSG_ERROR([Unsupported host architecture $host])
348 AROS_PROG(aros_host_ar,[ar],[cr])
349 AROS_REQUIRED(ar,$aros_host_ar)
350 AROS_PROG(aros_host_ranlib,ranlib)
351 AROS_REQUIRED(ranlib,$aros_host_ranlib)
352 AROS_PROG(aros_host_strip,strip)
353 AROS_REQUIRED(strip,$aros_host_strip)
355 AROS_PROG(RM,[rm],[-rf])
356 AROS_REQUIRED(rm,$RM)
358 AROS_REQUIRED(cp,$CP)
360 AROS_REQUIRED(mv,$MV)
361 AROS_PROG(ECHO,[echo])
362 AROS_REQUIRED(echo,$ECHO)
363 AROS_PROG(MKDIR,[mkdir],[-p])
364 AROS_REQUIRED(mkdir,$MKDIR)
365 AROS_PROG(TOUCH,[touch])
366 AROS_REQUIRED(touch,$TOUCH)
367 AROS_PROG(SORT,[sort])
368 AROS_REQUIRED(sort,$SORT)
369 AROS_PROG(UNIQ,[uniq])
370 AROS_REQUIRED(uniq,$UNIQ)
371 AROS_PROG(NOP,[true])
372 AROS_REQUIRED(true,$NOP)
374 AROS_REQUIRED(cat,$CAT)
375 AROS_PROG(BISON,[bison])
376 AROS_REQUIRED(bison,$BISON)
377 AROS_PROG(FLEX,[flex])
378 AROS_REQUIRED(flex,$FLEX)
379 AROS_PROG(PNGTOPNM,[pngtopnm])
380 AROS_REQUIRED(pngtopnm,$PNGTOPNM)
381 AROS_PROG(PPMTOILBM,[ppmtoilbm])
382 AROS_REQUIRED(ppmtoilbm,$PPMTOILBM)
384 AROS_REQUIRED(sed,$SED)
385 AROS_PROG(CHMOD,[chmod])
386 AROS_REQUIRED(chmod,$CHMOD)
388 AM_PATH_PYTHON(2.2.1)
395 dnl ---------------------------------------------------------------------------
396 dnl Look for things about the host system, good for hosted targets.
397 dnl ---------------------------------------------------------------------------
399 # Check for some includes for the X11 HIDD and the kernel
400 AC_CHECK_HEADERS([sys/ipc.h sys/shm.h \
401 sys/mmap.h sys/mman.h sysexits.h \
402 sys/statfs.h sys/statvfs.h sys/vfs.h sys/param.h \
405 AC_CHECK_HEADERS([sys/mount.h],,,[#include <sys/param.h>])
422 AC_CHECK_MEMBERS(struct tm.tm_gmtoff)
424 # Look for some functions
425 AC_CHECK_FUNCS([getpagesize kqueue statfs statvfs \
426 clone kse_create rfork_thread thr_create sa_register \
427 getcontext makecontext setcontext sigaltstack swapcontext])
432 dnl --------------------------------------------------------------------
433 dnl Target Configuration Section
434 dnl --------------------------------------------------------------------
436 dnl The target configuration section is responsible for setting up all
437 dnl the paths for includes, and tools required to build AROS to some
438 dnl particular target.
440 aros_config_cflags="-Wall -Werror-implicit-function-declaration"
441 aros_config_aflags="-Wall -x assembler-with-cpp -c"
442 aros_config_ldflags=""
444 aros_shared_default=yes
446 aros_shared_cflags="-fPIC"
447 aros_shared_aflags=""
448 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
449 aros_kernel_ldflags="-Wl,-rpath,./lib"
451 aros_target_ar_flags="cr"
452 aros_target_nm_flags="-C -ul"
453 aros_target_strip_flags="--strip-unneeded -R.comment"
458 aros_target_genmap="-Wl,-Map -Xlinker"
460 # Native flavour stuff
462 aros_serial_debug="0"
464 # Palm native flavour stuff
465 aros_palm_debug_hack="0"
468 aros_nesting_supervisor="0"
470 # Collect-aros stuff: "-ius" to ignore undefined symbols
471 ignore_undefined_symbols=""
473 #-----------------------------------------------------------------------------
476 # GCC 4.1+ has a stack protection feature that requires OS support. Ubuntu has
477 # it switched on by default, and we use the host compiler, so it compiles AROS
478 # code with this enabled resulting in link failures as we don't have support
481 # We use two methods to disable it. For the host compiler (used to compile
482 # some hosted modules), we test to see if the compiler supports stack
483 # protection, and if it does we disable it in AROS_CONFIG_CFLAGS. This should
484 # work on all platforms.
486 # For the "cross" compiler we clear the "ssp_default" spec in config/specs.in
487 # (this is done unconditionally, as it should have no effect on compilers
488 # without the stack protection feature). This may be specific to the way that
489 # Ubuntu enables the feature, so may not work everywhere. My specs-fu isn't
490 # strong enough to disable it in a generic way though, so we'll live with it
491 # until another vendor ships GCC with it enabled in a different way, and deal
495 AC_MSG_CHECKING([whether ${CC} accepts -fno-stack-protector])
497 save_cflags="$CFLAGS"
498 CFLAGS="$CFLAGS -fno-stack-protector"
499 AC_TRY_COMPILE(,, use_no_stack_protector="yes", use_no_stack_protector="no")
500 AC_MSG_RESULT($use_no_stack_protector)
501 if test "x-$use_no_stack_protector" = "x-yes" ; then
502 aros_host_cflags="$aros_host_cflags -fno-stack-protector"
504 if test "x-$cross_compiling" = "x-yes"; then
506 AC_MSG_CHECKING([whether ${CC} accepts -fno-stack-protector])
507 AC_TRY_COMPILE(,, use_no_stack_protector="yes", use_no_stack_protector="no")
508 AC_MSG_RESULT($use_no_stack_protector)
510 if test "x-$use_no_stack_protector" = "x-yes" ; then
511 aros_kernel_cflags="$aros_kernel_cflags -fno-stack-protector"
514 CFLAGS="$save_cflags"
517 #-----------------------------------------------------------------------------
519 # Check if we can explicitly choose older version of symbol hashing
521 save_cflags="$CFLAGS"
522 CFLAGS="$CFLAGS -Wl,--hash-style=sysv"
523 AC_MSG_CHECKING([whether ${CC} accepts -Wl,--hash-style=sysv])
524 AC_TRY_COMPILE(,, use_hash_style="yes", use_hash_style="no")
525 AC_MSG_RESULT($use_hash_style)
526 if test "x-$use_hash_style" = "x-yes" ; then
527 aros_kernel_cflags="$aros_kernel_cflags -Wl,--hash-style=sysv"
529 CFLAGS="$save_cflags"
532 #-----------------------------------------------------------------------------
534 # Disable pointer-signedness warnings if the compiler recognises the option
535 # (this only works for the host compiler at the moment)
537 AC_MSG_CHECKING([whether ${CC} accepts -Wno-pointer-sign])
538 save_cflags="$CFLAGS"
539 CFLAGS="$CFLAGS -Wno-pointer-sign"
540 AC_TRY_COMPILE(,, use_no_sign_warning="yes", use_no_sign_warning="no")
541 AC_MSG_RESULT($use_no_sign_warning)
542 if test "x-$use_no_sign_warning" = "x-yes" ; then
543 aros_host_cflags="$aros_host_cflags -Wno-pointer-sign"
545 CFLAGS="$save_cflags"
547 #-----------------------------------------------------------------------------
549 AC_MSG_CHECKING([for type of build])
550 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")
552 if test "$build_type" = "nightly"; then
553 build_type_string="NIGHTLY"
554 elif test "$build_type" = "snapshot"; then
555 build_type_string="SNAPSHOT"
556 elif test "$build_type" = "milestone"; then
557 build_type_string="MILESTONE"
558 elif test "$build_type" = "release"; then
559 build_type_string="RELEASE"
561 build_type_string="PERSONAL"
562 build_type="personal"
565 aros_config_cflags="$aros_config_cflags -DAROS_BUILD_TYPE=AROS_BUILD_TYPE_$build_type_string"
567 AC_MSG_RESULT($build_type)
569 #-----------------------------------------------------------------------------
570 all_debug_types="messages stack mungwall modules symbols"
572 AC_MSG_CHECKING([which debug types to enable])
573 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)]),
574 debug="$enableval",debug="")
576 if test "$debug" = "" -o "$debug" = "no"; then
578 elif test "$debug" = "yes"; then
582 if test "$debug" = "all" ; then
583 debug=$all_debug_types
584 for d in $all_debug_types; do
585 export aros_${d}_debug="1"
588 for d in $all_debug_types; do
589 export aros_${d}_debug="0"
593 if test "$debug" != "none"; then
594 debug=`echo $debug | sed s/,/\ /g`
597 for d2 in $all_debug_types; do
598 if test "$d2" = "$d"; then
603 if test "$found" = "0"; then
604 AC_MSG_ERROR([unrecognized debug type "$d". Available types are: all none $all_debug_types])
606 export aros_${d}_debug="1"
610 AC_MSG_RESULT($debug)
612 if test "$aros_messages_debug" = "1"; then
613 aros_messages_debug="-DADEBUG=1 -DMDEBUG=1"
615 aros_messages_debug=""
617 if test "$aros_symbols_debug" = "1"; then
618 aros_symbols_debug="-g"
620 aros_symbols_debug=""
623 # These are the flags to pass when compiling debugged programs
624 aros_debug_cflags="$aros_symbols_debug $aros_messages_debug"
626 aros_debug_ldflags="$aros_symbols_debug"
630 #-----------------------------------------------------------------------------
631 # Checking if we should build crosstools..
632 AC_MSG_CHECKING([whether to build crosstools])
633 AC_ARG_ENABLE(crosstools,AC_HELP_STRING([--enable-crosstools],[Build cross-compiler toolchains if necessary (default=no).]),crosstools="$enableval",crosstools="no")
634 if test "$crosstools" != "" -a "$crosstools" != "no"; then
636 aros_crosstools="yes"
641 #-----------------------------------------------------------------------------
642 # Checking for distcc and ccache.
644 # Always apply the transforms in this particular order. Basically you should
645 # always run 'ccache distcc compiler' in that order for the best performance.
647 AC_MSG_CHECKING([whether to enable distcc])
648 AC_ARG_ENABLE(distcc,AC_HELP_STRING([--enable-distcc],[Use distcc as a front end to the compiler (default=no).]),distcc="$enableval",distcc="no")
649 if test "$distcc" != "" -a "$distcc" != "no"; then
650 # AC_CHECK_PROG will print out the result in this case
651 AC_PATH_PROG(DISTCC,[distcc],distcc,)
656 AC_MSG_CHECKING([whether to enable ccache])
657 AC_ARG_ENABLE(ccache,AC_HELP_STRING([--enable-ccache],[Use ccache as a front end to the compiler (default=no).]),ccache="$enableval",ccache="no")
658 if test "$ccache" != "" -a "$ccache" != "no"; then
659 # AC_CHECK_PROG will print out the result in this case
660 AC_CHECK_PROG(CCACHE,[ccache],ccache,)
665 #-----------------------------------------------------------------------------
666 AC_MSG_CHECKING([what optimization flags to use])
667 AC_ARG_WITH(optimization,AC_HELP_STRING([--with-optimization=FLAGS],[Use optimization flags FLAGS (default=-O2).]),optimization="$withval",optimization="unknown")
668 if test "$optimization" = "unknown"; then
669 dnl default is -O2 for normal builds, -O0 for debug builds
670 if test "$debug" != "none"; then
676 aros_config_cflags="$aros_config_cflags $optimization"
677 AC_MSG_RESULT($optimization)
679 #-----------------------------------------------------------------------------
680 AC_MSG_CHECKING([what target variant to enable])
681 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")
682 if test "$target_variant" = "none"; then
683 aros_target_variant=""
684 aros_target_suffix=""
686 aros_target_variant="$target_variant"
687 aros_target_suffix="-$target_variant"
689 AC_MSG_RESULT($enableval)
691 target_bootloader="none"
693 #-----------------------------------------------------------------------------
694 # This is the target configuration switch.
697 aros_target_arch="linux"
698 case "$target_cpu" in
700 aros_target_cpu="m68k"
701 aros_object_format="m68kelf"
702 aros_flavour="emulcompat"
703 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D__mc68000 -D__linux__"
704 aros_shared_ldflags="-Wl,-T,\$(TOP)/config/linux/m68k/script.so"
705 aros_kernel_ldflags="-Wl,-rpath,./lib,-T,\$(TOP)/config/linux/m68k/script.normal"
706 gcc_target_cpu="mc68000"
709 aros_target_cpu="i386"
710 aros_object_format="elf_i386"
711 aros_flavour="emulation"
712 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__linux__"
713 aros_config_cflags="$aros_config_cflags -m32"
714 aros_kernel_cflags="$aros_kernel_cflags -m32"
715 aros_config_aflags="$aros_config_aflags -m32"
716 aros_config_ldflags="-m32"
717 aros_kernel_ldflags="-melf_i386"
718 aros_default_wbdepth=8
719 gcc_target_cpu="i386"
722 aros_target_cpu="x86_64"
723 aros_object_format="elf_x86_64"
724 aros_flavour="emulation"
725 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64 -D__linux__"
726 aros_config_cflags="$aros_config_cflags -mno-red-zone"
727 aros_default_wbdepth=8
728 gcc_target_cpu="x86_64"
731 aros_target_cpu="ppc"
732 aros_object_format="elf32ppc"
733 aros_flavour="emulation"
734 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc -D__linux__"
735 aros_default_wbdepth=8
739 # Same as powerpc, but I need this for the nightly build to work again.
740 # Actually, the nightly should be made working with powerpc target.
741 # That just was too much work for the moment, another week or two.
743 aros_target_cpu="ppc"
744 aros_object_format="elf32ppc"
745 aros_flavour="emulation"
746 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc -D__linux__"
747 aros_default_wbdepth=8
751 AC_MSG_ERROR("Unknown CPU for Linux -- $target_cpu")
757 aros_target_arch="pc"
758 aros_shared_default="no"
759 target_bootloader="grub2"
760 case "$target_cpu" in
762 aros_target_cpu="i386"
764 dnl If somebody hasn't already set the target object
765 dnl format, then use this value. Mostly to support
766 dnl FreeBSD cross-compilation.
767 dnl TODO: Remove when we always use our compiler.
769 if test "$aros_object_format" = "" ; then
770 aros_object_format="elf_i386"
772 aros_flavour="standalone"
773 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
774 aros_config_cflags="$aros_config_cflags -m32"
775 aros_kernel_cflags="$aros_kernel_cflags -m32"
776 aros_config_aflags="$aros_config_aflags -m32"
777 aros_config_ldflags="-m32"
778 aros_kernel_ldflags="-melf_i386"
779 aros_default_wbwidth=640
780 aros_default_wbheight=480
781 gcc_target_cpu="i386"
784 aros_target_cpu="x86_64"
786 if test "$aros_object_format" = "" ; then
787 aros_object_format="elf_x86_64"
789 aros_flavour="standalone"
790 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
791 aros_config_cflags="$aros_config_cflags -fno-asynchronous-unwind-tables -mno-red-zone"
792 aros_kernel_ldflags=""
793 aros_default_wbwidth=640
794 aros_default_wbheight=480
795 gcc_target_cpu="x86_64"
798 AC_MSG_ERROR("Unknown native CPU -- $target_cpu")
804 aros_target_arch="prep"
805 aros_shared_default="no"
806 aros_target_cpu="ppc"
807 aros_object_format="elf32ppc"
808 aros_flavour="ppcnative"
809 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
810 aros_kernel_ldflags=""
811 aros_default_wbwidth=640
812 aros_default_wbheight=480
817 aros_target_arch="freebsd"
818 aros_target_cpu="i386"
819 aros_flavour="emulation"
820 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
821 gcc_target_cpu="i386"
823 aros_target_strip_flags="-x"
827 aros_target_arch="darwin"
828 aros_flavour="emulation"
830 dnl This test bypass was implemented for Darwin by port's author.
831 dnl I wonder why, since darwin port needs this function.
832 dnl I left it here just because port author did it.
834 case "$target_cpu" in
836 aros_target_cpu="i386"
837 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
838 gcc_target_cpu="i386"
839 aros_object_format="elf_i386"
840 aros_target_strip_flags="-x"
843 AC_MSG_ERROR("Unsupported target CPU for darwin hosted flavour -- $target_cpu")
849 aros_target_arch="dragonfly"
850 aros_flavour="emulation"
851 case "$target_cpu" in
853 aros_target_cpu="i386"
854 aros_object_format="elf_i386"
855 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__DragonFly__"
858 aros_target_cpu="x86_64"
859 aros_object_format="elf_x86_64"
860 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64 -D__DragonFly__"
863 AC_MSG_ERROR("Unknown CPU for DragonFly -- $target_cpu")
869 aros_target_arch="netbsd"
870 case "$target_cpu" in
872 aros_target_cpu="m68k"
873 aros_object_format="m68kelf"
874 aros_flavour="emulcompat"
875 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D__mc68000 -D__NetBSD__"
876 gcc_target_cpu="mc68000"
879 aros_target_cpu="i386"
880 aros_object_format="elf_i386"
881 aros_flavour="emulation"
882 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__NetBSD__"
883 aros_default_wbdepth=8
884 gcc_target_cpu="i386"
887 AC_MSG_ERROR("Unknown CPU for NetBSD -- $target_cpu")
890 aros_target_genmap="-Wl,-M -Xlinker >"
891 aros_flavour="emulation"
892 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
896 aros_target_arch="openbsd"
897 case "$target_cpu" in
899 aros_target_cpu="i386"
900 aros_object_format="elf_i386"
901 aros_flavour="emulation"
902 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__OpenBSD__"
903 gcc_target_cpu="i386"
906 AC_MSG_ERROR("Unknown CPU for OpenBSD -- $target_cpu")
909 aros_target_genmap="-Wl,-M -Xlinker >"
910 aros_target_nm_flags="-u"
911 aros_flavour="emulation"
915 aros_target_arch="solaris"
916 case "$target_cpu" in
918 aros_target_cpu="i386"
919 aros_object_format="elf_i386"
920 aros_flavour="emulation"
921 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__Solaris__"
922 aros_default_wbdepth=8
923 gcc_target_cpu="i386"
926 aros_target_cpu="sparc"
927 aros_object_format="elf_sparc"
928 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dsparc -D__Solaris__"
929 gcc_target_cpu="sparc"
932 AC_MSG_ERROR("Unknown CPU for Solaris -- $target_cpu")
935 aros_config_cflags="$aros_config_cflags -D$aros_target_cpu"
936 aros_flavour="emulation"
940 aros_target_arch="morphos"
941 aros_shared_default="no"
942 aros_target_cpu="ppc"
943 aros_object_format="elf_ppc"
944 aros_flavour="nativecompat"
945 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
950 aros_target_arch="sam440"
951 aros_shared_default="no"
952 aros_target_cpu="ppc"
953 aros_object_format="elf32ppc"
954 aros_flavour="ppcnative"
955 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
956 aros_kernel_ldflags=""
957 aros_default_wbwidth=640
958 aros_default_wbheight=480
959 aros_config_cflags="$aros_config_cflags -mcpu=440fp -mno-toc -fno-asynchronous-unwind-tables"
960 gcc_target_cpu="powerpc"
964 aros_target_arch="efika"
965 aros_shared_default="no"
966 aros_target_cpu="arm"
967 aros_object_format="armelf_linux_eabi"
968 aros_flavour="standalone"
969 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
970 aros_kernel_ldflags=""
971 aros_default_wbwidth=1024
972 aros_default_wbheight=600
973 aros_arch_libs="-laeabi"
974 aros_config_cflags="$aros_config_cflags -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -fno-asynchronous-unwind-tables -fno-exceptions"
975 aros_config_aflags="$aros_config_aflags -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -fno-asynchronous-unwind-tables -fno-exceptions"
979 aros_target_arch="chrp"
980 aros_shared_default="no"
981 aros_target_cpu="ppc"
982 aros_object_format="elf32ppc"
983 aros_flavour="ppcnative"
984 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
985 aros_kernel_ldflags=""
986 aros_default_wbwidth=640
987 aros_default_wbheight=480
988 aros_config_cflags="$aros_config_cflags -mno-toc -fno-asynchronous-unwind-tables"
989 gcc_target_cpu="powerpc"
990 case "$aros_target_variant" in
992 aros_config_cflags="$aros_config_cflags -DBIG_ENDIAN_OHCI=1 -mcpu=603e"
998 aros_target_arch="amiga"
999 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D_AMIGA -DAMIGA"
1000 aros_shared_default="no"
1002 aros_config_cflags="$aros_config_cflags -fomit-frame-pointer -fbuiltin -ffreestanding"
1004 case "$target_cpu" in
1006 aros_target_cpu="m68k"
1007 aros_object_format="m68kelf"
1008 aros_flavour="nativecompat"
1009 gcc_target_cpu="mc68000"
1013 aros_flavour="native"
1014 gcc_target_cpu="ppc"
1017 AC_MSG_ERROR("Unknown CPU for Amiga $target_cpu")
1023 aros_target_arch="mingw32"
1024 aros_shared_default="no"
1027 case "$target_cpu" in
1029 aros_target_cpu="i386"
1030 aros_object_format="elf_i386"
1031 aros_flavour="emulation"
1032 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1033 aros_shared_cflags=""
1034 aros_default_wbdepth=8
1035 gcc_target_cpu="i386"
1036 aros_target_cc="i386-aros-gcc"
1037 aros_target_ld="i386-aros-ld"
1038 aros_target_as="i386-aros-as"
1039 aros_target_ar="i386-aros-ar"
1040 aros_target_ranlib="i386-aros-ranlib"
1041 aros_target_nm="i386-aros-nm"
1042 aros_target_strip="i386-aros-strip"
1043 aros_target_objcopy="i386-aros-objcopy"
1044 aros_target_objdump="i386-aros-objdump"
1045 target_tool_prefix="i386-mingw32-"
1048 AC_MSG_ERROR("Unknown CPU for Mingw32 -- $target_cpu")
1051 if test $host_os = "cygwin"; then
1052 aros_kernel_cflags="-mno-cygwin"
1056 aros_target_arch="pp"
1057 aros_shared_default="no"
1058 case "$target_cpu" in
1060 aros_target_cpu="m68k"
1061 aros_object_format="m68kelf"
1062 aros_flavour="palmnative"
1063 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
1064 aros_default_wbwidth=160
1065 aros_default_wbheight=160
1066 aros_default_wbdepth=1
1067 aros_target_ar_flags="cru"
1068 aros_compiler_libs="-lgcc1"
1069 aros_shared_default=no
1070 aros_shared_cflags="-fpic"
1071 aros_shared_aflags=""
1072 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
1073 aros_kernel_ldflags="-Wl,-rpath,./lib"
1074 aros_debug_cflags="-Wall -Werror-implicit-function-declaration $aros_symbols_debug $aros_messages_debug -mc68000 -Wa,-mc68000"
1075 aros_debug_aflags=""
1076 aros_debug_ldflags="$aros_symbols_debug"
1077 aros_mungwall_debug="0"
1078 aros_modules_debug="0"
1079 gcc_target_cpu="mc68000"
1080 ignore_undefined_symbols="-ius"
1083 AC_MSG_ERROR("Unknown CPU for PalmPilot -- $target_cpu")
1089 aros_target_arch="mac"
1090 aros_shared_default="no"
1091 case "$target_cpu" in
1093 aros_target_cpu="m68k"
1094 aros_object_format="m68kelf"
1095 aros_flavour="mac68knative"
1096 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
1097 aros_default_wbwidth=512
1098 aros_default_wbheight=384
1099 aros_default_wbdepth=8
1100 aros_target_ar_flags="cru"
1101 aros_compiler_libs="-lgcc1"
1102 aros_shared_default=no
1103 aros_shared_cflags="-fpic"
1104 aros_shared_aflags=""
1105 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
1106 aros_kernel_ldflags="-Wl,-rpath,./lib"
1107 aros_debug_cflags="-Wall -Werror-implicit-function-declaration $aros_symbols_debug $aros_messages_debug -mc68000"
1108 aros_debug_aflags=""
1109 aros_debug_ldflags="$aros_symbols_debug"
1110 aros_mungwall_debug="0"
1111 aros_modules_debug="0"
1112 gcc_target_cpu="mc68000"
1113 ignore_undefined_symbols="-ius"
1116 AC_MSG_ERROR("Unknown CPU for Mac68k -- $target_cpu")
1122 AC_MSG_ERROR([Unsupported target architecture $target])
1126 AC_MSG_CHECKING([Where to download sourcecode for external ports])
1127 AC_ARG_WITH(portssources,AC_HELP_STRING([--with-portssources=DIR],[Where to download sourcecode for external ports]),with_portssrcdir=$withval,with_portssrcdir="default")
1128 if test "$with_portssrcdir" = "default"; then
1129 AROS_PORTSSRCDIR="$AROS_BUILDDIR/bin/Sources"
1131 AROS_PORTSSRCDIR="$with_portssrcdir"
1133 AC_MSG_RESULT($AROS_PORTSSRCDIR)
1135 AC_MSG_CHECKING([which bootloader to use])
1136 AC_ARG_WITH(bootloader,AC_HELP_STRING([--with-bootloader=NAME],[Use a specific bootloader]),target_bootloader=$withval,target_bootloader=$target_bootloader)
1137 if test "$target_bootloader" = "none"; then
1138 aros_target_bootloader=""
1140 aros_target_bootloader="$target_bootloader"
1142 AC_MSG_RESULT($target_bootloader)
1144 AC_MSG_CHECKING([which icon-set to use])
1145 AC_ARG_WITH(iconset,AC_HELP_STRING([--with-iconset=NAME],[Use a specific Icon-set (default=Gorilla).]),target_iconset=$withval,target_iconset="default")
1146 if test "$target_iconset" = "default"; then
1147 aros_target_iconset="Gorilla"
1148 target_iconset="default (Gorilla)"
1150 aros_target_iconset="$target_iconset"
1152 AC_MSG_RESULT($target_iconset)
1154 AC_MSG_CHECKING([which GUI Theme to use])
1155 AC_ARG_WITH(theme,AC_HELP_STRING([--with-theme=NAME],[Use a specific GUI Theme]),target_guitheme=$withval,target_guitheme="default")
1156 if test "$target_guitheme" = "default"; then
1157 aros_target_guitheme="Ice"
1159 aros_target_guitheme="$target_guitheme"
1161 AC_MSG_RESULT($aros_target_guitheme)
1163 # Find out if we are cross-compiling (i.e. if we can't use the host compiler
1166 if test "$aros_host_cpu" != "$aros_target_cpu" ; then
1169 if test "$aros_host_cpu" == "x86_64" ; then
1170 if test "$aros_target_cpu" == "i386" ; then
1174 if test "$aros_host_arch" == "darwin" ; then
1178 # Set prefix for target compiler etc. if we're cross-compiling
1179 # (should possibly be earlier but needs to be after AC_PROG_CC)
1180 if test "$cross_compiling" = "yes" ; then
1181 if test "$target_tool_prefix" = ""; then
1182 target_tool_prefix=${target_cpu}-elf-
1184 CC=${target_tool_prefix}gcc
1187 #-----------------------------------------------------------------------------
1189 # Disable pointer-signedness warnings if the compiler recognises the option
1191 AC_MSG_CHECKING([whether ${CC} accepts -Wno-pointer-sign])
1192 save_cflags="$CFLAGS"
1193 CFLAGS="$CFLAGS -Wno-pointer-sign"
1194 AC_TRY_COMPILE(,, use_no_sign_warning="yes", use_no_sign_warning="no")
1195 AC_MSG_RESULT($use_no_sign_warning)
1196 if test "x-$use_no_sign_warning" = "x-yes" ; then
1197 aros_config_cflags="$aros_config_cflags -Wno-pointer-sign"
1199 CFLAGS="$save_cflags"
1201 #-----------------------------------------------------------------------------
1203 # Find all the tools we need to compile. This could be cross-compiling
1204 # though! If that is the case we use the GNU form of the target and
1205 # simply add this to the front of the binary name. This is rather simple,
1206 # but it should work under most circumstances.
1208 # The default tools are to use the same as the host, but only if the
1209 # host and target CPU are the same. With GCC this is normally enough.
1213 aros_shared_ld="$aros_host_ld"
1215 aros_target_mkdep="$aros_host_mkdep"
1216 aros_target_incl_def="$aros_host_incl"
1218 AC_PATH_PROG(aros_kernel_cc,$CC)
1220 # The default tools executables to be linked to.
1221 if test "$aros_target_cc" != ""; then
1222 AC_PATH_PROG(aros_target_cc,$aros_target_cc)
1223 AROS_REQUIRED(gcc,$aros_target_cc)
1225 if test "$aros_target_ld" != ""; then
1226 AC_PATH_PROG(aros_target_ld,$aros_target_ld)
1227 AROS_REQUIRED(ld,$aros_target_ld)
1230 if test "$crosstools" != "yes"; then
1231 AROS_TOOL_TARGET(aros_target_as_ln,as,$aros_target_as)
1232 AROS_REQUIRED(as,$aros_target_as_ln)
1233 AROS_TOOL_TARGET(aros_kernel_ld,ld,$aros_kernel_ld)
1234 AROS_REQUIRED(ld,$aros_kernel_ld)
1235 AROS_TOOL_TARGET(aros_target_ar_ln,ar,$aros_target_ar)
1236 AROS_REQUIRED(ar,$aros_target_ar_ln)
1237 AROS_TOOL_TARGET(aros_target_nm_ln,nm,$aros_target_nm)
1238 AROS_REQUIRED(nm,$aros_target_nm_ln)
1239 AROS_TOOL_TARGET(aros_target_objcopy_ln,objcopy,$aros_target_objcopy)
1240 AROS_REQUIRED(objcopy,$aros_target_objcopy_ln)
1241 AROS_TOOL_TARGET(aros_target_objdump_ln,objdump,$aros_target_objdump)
1242 AROS_REQUIRED(objdump,$aros_target_objdump_ln)
1243 AROS_TOOL_TARGET(aros_target_ranlib_ln,ranlib,$aros_target_ranlib)
1244 AROS_REQUIRED(ranlib,$aros_target_ranlib_ln)
1245 AROS_TOOL_TARGET(aros_target_strip_ln,strip,$aros_target_strip)
1246 AROS_REQUIRED(strip,$aros_target_strip_ln)
1249 if test "$rescomp" != ""; then
1250 if test "$cross_compiling" = "yes" ; then
1251 rescomp=${target_tool_prefix}${rescomp}
1253 AC_PATH_PROG(aros_kernel_rescomp,$rescomp)
1254 AROS_REQUIRED($rescomp,$aros_kernel_rescomp)
1257 aros_hostcfg_dir="bin/${aros_host_arch}-${aros_host_cpu}/gen/config"
1258 aros_targetcfg_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/config"
1259 aros_inc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/AROS/Development/include/aros"
1260 aros_gendir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen"
1261 aros_geninc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/include/aros"
1262 aros_tools_dir="bin/${aros_host_arch}-${aros_host_cpu}/tools"
1263 aros_scripts_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/scripts"
1265 # aros_cc_pre is a variable that is added to the front of the compiler name
1266 # in the generated aros-gcc shell script. We need this to enable the cache
1267 # to work across cleaned builds. Also, support DISTCC using the correct
1268 # environment variable.
1271 if test "x${DISTCC}" != "x" ; then
1272 if test "x${CCACHE}" != "x" ; then
1273 aros_cc_pre="env CCACHE_PREFIX=${DISTCC} ${CCACHE} "
1275 aros_cc_pre="${DISTCC} "
1278 if test "x${CCACHE}" != "x" ; then
1279 aros_cc_pre="${CCACHE} "
1283 prefix="${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros"
1285 AC_SUBST(aros_target_nostdinc_cflags,-nostdinc)
1286 AC_SUBST(aros_target_nostartup_ldflags,-nostartfiles)
1287 AC_SUBST(aros_target_nix_ldflags,-nix)
1288 AC_SUBST(aros_target_detach_ldflags,-detach)
1289 AC_SUBST(aros_target_nostdlib_ldflags,-nostdlib)
1292 if test "$aros_target_cc" = ""; then
1293 orig_target_cc=$aros_kernel_cc
1295 orig_target_cc=$aros_target_cc
1297 if test "$aros_target_ld" = ""; then
1298 orig_target_ld=$aros_kernel_ld
1300 orig_target_ld=$aros_target_ld
1302 if test "$GCC" = "yes"; then
1303 aros_target_cc_path=`$orig_target_cc -print-search-dirs | grep "programs: =" | cut -c 12-`
1305 aros_target_cc="${prefix}-gcc"
1306 aros_target_as="${prefix}-as"
1307 aros_target_ld="${prefix}-ld"
1308 aros_target_ar="${prefix}-ar $aros_target_ar_flags"
1309 aros_target_objcopy=${prefix}-objcopy
1310 aros_target_objdump=${prefix}-objdump
1311 aros_target_ranlib="${prefix}-ranlib $aros_target_ranlib_flags"
1312 aros_target_nm="${prefix}-nm $aros_target_nm_flags"
1313 aros_kernel_nm="${prefix}-nm"
1314 aros_target_strip=${prefix}-strip
1316 # Find the system include path. We can suggest that an alternative is
1317 # used if we don't get it correct. The default is to use /usr/include.
1318 # Which is set in the aros_target_incl_def variable.
1320 AC_ARG_ENABLE(includes,
1321 AC_HELP_STRING([--enable-includes=dir],[Alternative system include directory]),
1322 [aros_target_incl=$enable_includes], [aros_target_incl=$aros_target_incl_def])
1324 dnl find out about the target cc's include path
1325 AC_MSG_CHECKING([for the target compiler's include path])
1326 if test "$aros_target_cc_includes" = "" ; then
1327 #try to guess where the directory is
1328 aros_target_cc_includes=`dirname \`${orig_target_cc} -print-libgcc-file-name\``/include
1329 if ! test -d $aros_target_cc_includes; then
1330 #the directory doesn't exist, we need to do some more work
1331 aros_target_cc_includes=${PWD}/${aros_gendir}/cc_include
1333 #these are the headers we're looling for
1334 headers="limits.h mmintrin.h stdbool.h syslimits.h float.h \
1335 stddef.h xmmintrin.h iso646.h stdarg.h unwind.h \
1339 for h in $headers; do
1340 #which other headers each of the above headers needs?
1341 deps=$(echo "#include <$h>" | \
1342 $aros_host_cc -E -M - 2>/dev/null | \
1343 sed 's/^.*://; s/\\$/ /g; s/[[ \t]]\+/ /g')
1345 #copy all the needed headers to a directory beneath gendir
1348 dir=${aros_target_cc_includes}$(echo $(dirname $d) | \
1349 sed -n "s,^.*/include\(/.*\),\1,p")
1350 ! test -d $dir && mkdir -p $dir
1351 ! test -f $dir/$h && { cp $d $dir; chmod u+w $dir/$h; }
1356 AC_MSG_RESULT($aros_target_cc_includes)
1359 # For GCC < 4.0 -I- is used for giving the search path for '#include "..."'
1360 # On GCC >= 4.0 -iquote should be used
1364 save_cflags="$CFLAGS"
1366 AC_MSG_CHECKING([whether ${CC} accepts -iquote])
1367 AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
1368 AC_MSG_RESULT($has_iquote)
1369 if test "x-$has_iquote" = "x-yes" ; then
1370 host_cflags_iquote=-iquote
1371 host_cflags_iquote_end=
1373 host_cflags_iquote=-I
1374 host_cflags_iquote_end=-I-
1376 kernel_cflags_iquote=$host_cflags_iquote
1377 kernel_cflags_iquote_end=$host_cflags_iquote_end
1378 if test "x-$cross_compiling" = "x-yes"; then
1379 CC="$aros_kernel_cc"
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 kernel_cflags_iquote=-iquote
1385 kernel_cflags_iquote_end=
1387 kernel_cflags_iquote=-I
1388 kernel_cflags_iquote_end=-I-
1391 aros_cflags_iquote=$kernel_cflags_iquote
1392 aros_cflags_iquote_end=$kernel_cflags_iquote_end
1393 if test "$orig_target_cc" != "$aros_kernel_cc"; then
1394 CC="$orig_target_cc"
1395 AC_MSG_CHECKING([whether ${CC} accepts -iquote])
1396 AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
1397 AC_MSG_RESULT($has_iquote)
1398 if test "x-$has_iquote" = "x-yes" ; then
1399 aros_cflags_iquote=-iquote
1400 aros_cflags_iquote_end=
1402 aros_cflags_iquote=-I
1403 aros_cflags_iquote_end=-I-
1407 CFLAGS="$save_cflags"
1409 AC_SUBST(host_cflags_iquote)
1410 AC_SUBST(host_cflags_iquote_end)
1411 AC_SUBST(kernel_cflags_iquote)
1412 AC_SUBST(kernel_cflags_iquote_end)
1413 AC_SUBST(aros_cflags_iquote)
1414 AC_SUBST(aros_cflags_iquote_end)
1417 dnl Check if user specified --with-resolution=XRESxYRESxDEPTH
1418 AC_MSG_CHECKING([for default resolution of WBScreen])
1419 AC_ARG_WITH(resolution,AC_HELP_STRING([--with-resolution=XRESxYRESxDEPTH],[Default resolution of the initial WorkbenchScreen]),resolution=$withval,resolution=none)
1420 # We require an argument, so map --with/--without ("yes"/"no") to "none" specified
1421 if test "$resolution" = "yes" ; then
1424 if test "$resolution" = "no" ; then
1427 if test "$resolution" != "none" ; then
1428 aros_default_wbwidth=`echo $resolution | cut -d'x' -f1`
1429 aros_default_wbheight=`echo $resolution | cut -d'x' -f2`
1430 aros_default_wbdepth=`echo $resolution | cut -d'x' -f3`
1432 AC_MSG_RESULT($aros_default_wbwidth x $aros_default_wbheight x $aros_default_wbdepth)
1433 aros_cv_default_wbwidth=$aros_default_wbwidth
1434 aros_cv_default_wbheight=$aros_default_wbheight
1435 aros_cv_default_wbdepth=$aros_default_wbdepth
1437 dnl See if the user wants the BOCHS hack for native flavour
1438 AC_MSG_CHECKING([if bochs hack is enabled])
1439 AC_ARG_ENABLE(bochs_hack,AC_HELP_STRING([--enable-bochs-hack],[Enable hacks to make BOCHS (partly) work (default=no)]),bochs_hack="yes",bochs_hack="no")
1440 if test "$bochs_hack" = "yes" ; then
1443 AC_MSG_RESULT($bochs_hack)
1445 dnl See if the user wants the serial debug output for native flavour
1446 AC_MSG_CHECKING([if serial debug is enabled])
1447 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)
1448 if test "$aros_serial_debug" = 0 ; then
1449 serial_debug_forced=""
1450 if test "$serial_debug" = "yes" ; then
1453 if test "$serial_debug" = "no" ; then
1457 serial_debug_forced="(forced)"
1458 serial_debug=$aros_serial_debug
1460 if test "$serial_debug" != "none" ; then
1461 aros_serial_debug=$serial_debug
1462 AC_MSG_RESULT($serial_debug_forced on port $serial_debug)
1467 dnl See if the user wants the palm debug output hack for palm native flavour
1468 AC_MSG_CHECKING([if palm debug hack is enabled])
1469 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")
1470 if test "$palm_debug_hack" = "yes" ; then
1471 aros_palm_debug_hack="1"
1473 AC_MSG_RESULT($palm_debug_hack)
1476 dnl See if the user wants nesting supervisor activated for unix flavour
1477 AC_MSG_CHECKING([if nesting supervisor support is enabled])
1478 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")
1479 if test "$nesting_supervisor" = "yes" ; then
1480 aros_nesting_supervisor="1"
1482 AC_MSG_RESULT($nesting_supervisor)
1485 dnl things specifically required for hosted flavours
1486 if test "x-$aros_flavour" = "x-emulation" -o "x-$aros_flavour" = "x-emulcompat" ; then
1488 if test "x-$need_dlopen" != "x-no" ; then
1489 dnl some kind of dynamic library access system is required for hostlib.resource
1490 AC_CHECK_FUNC(dlopen, have_dl="yes", have_dl="no")
1491 if test "x-$have_dl" = "x-no" ; then
1492 AC_CHECK_LIB(dl, dlopen, [have_dl="yes"
1493 aros_host_ldflags="$aros_host_ldflags -ldl"],
1496 if test "x-$have_dl" = "x-no" ; then
1497 AC_MSG_ERROR([dlopen() dynamic linker functions not available])
1503 AC_ARG_ENABLE(x11_hidd, AC_HELP_STRING([--enable-x11-hidd],
1504 [build X11 hidd for hosted (default=auto)]),
1505 x11_hidd="$enableval",
1507 case "x-$x11_hidd" in
1508 x-yes|x-no|x-auto) ;;
1509 *) x11_hidd="auto" ;;
1515 if test "x-$x11_hidd" != "x-no" ; then
1521 for path in $x_libraries
1523 x_cflags="$x_cflags -L$path"
1526 for path in $x_includes
1528 x_cflags="$x_cflags -I$path"
1531 if test "x-$no_x" = "x-yes" ; then
1534 if test "x-$x11_hidd" != "x-auto" ; then
1535 dnl and they explicitly asked for it, bail out
1536 AC_MSG_ERROR([X11 libs/headers not found, cannot build X11 hidd as requested])
1540 dnl found it, setup the metatarget
1541 x11_hidd_target=kernel-x11gfx-kobj
1544 dnl setup shared memory extensions
1545 AC_ARG_ENABLE(x11_shm, AC_HELP_STRING([--enable-x11-shm],
1546 [use X11 shared memory (default=auto)]),
1547 x11_hidd_shm="$enableval",
1548 x11_hidd_shm="auto")
1549 case "x-$x11_hidd_shm" in
1550 x-yes|x-no|x-auto) ;;
1551 *) x11_hidd_shm="auto" ;;
1557 if test "x-$x11_hidd_shm" != "x-no" ; then
1559 dnl system shm headers
1560 AC_CHECK_HEADERS(sys/ipc.h)
1561 AC_CHECK_HEADERS(sys/shm.h)
1564 if test "x-$ac_cv_header_sys_ipc_h" = "x-yes" -a "x-$ac_cv_header_sys_shm_h" = "x-yes" ; then
1566 dnl make sure X libs have shm functions
1567 save_cflags="$CFLAGS"
1568 CFLAGS="$CFLAGS $x_cflags"
1569 AC_CHECK_LIB(Xext, XShmQueryExtension, have_xshm=yes)
1570 CFLAGS="$save_cflags"
1574 dnl detection done, prepare output
1575 if test "x-$have_xshm" = "x-yes" ; then
1578 elif test "x-$x11_hidd_shm" = "x-yes" ; then
1579 dnl they explicitly asked for it, but we can't do it
1580 AC_MSG_ERROR([X11 has no support for shared memory, cannot enable it as requested])
1582 dnl otherwise just disable it
1587 dnl setup vidmode (fullscreen) extensions
1588 AC_ARG_ENABLE(x11_vidmode, AC_HELP_STRING([--enable-x11-vidmode],
1589 [use X11 vidmode extension (default=auto)]),
1590 x11_hidd_vidmode="$enableval",
1591 x11_hidd_vidmode="auto")
1592 case "x-$x11_hidd_vidmode" in
1593 x-yes|x-no|x-auto) ;;
1594 *) x11_hidd_vidmode="auto" ;;
1600 if test "x-$x11_hidd_vidmode" != "x-no" ; then
1602 dnl make sure X libs have vidmode functions
1603 save_cflags="$CFLAGS"
1604 CFLAGS="$CFLAGS $x_cflags"
1605 AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryExtension, have_vidmode=yes)
1606 CFLAGS="$save_cflags"
1609 dnl detection done, prepare output
1610 if test "x-$have_vidmode" = "x-yes" ; then
1611 dnl we can do vidmode
1612 DO_VIDMODE_SUPPORT="1"
1613 elif test "x-$x11_hidd_vidmode" = "x-yes" ; then
1614 dnl they explicitly asked for it, but we can't do it
1615 AC_MSG_ERROR([X11 vidmode extension not available, cannot enable it as requested])
1617 dnl otherwise just disable it
1618 DO_VIDMODE_SUPPORT="0"
1622 aros_host_x11_includes=$x_includes
1623 aros_host_x11_libdirs=$x_libraries
1628 AC_ARG_ENABLE(sdl_hidd, AC_HELP_STRING([--enable-sdl-hidd],
1629 [build SDL hidd for hosted (default=auto)]),
1630 sdl_hidd="$enableval",
1632 case "x-$sdl_hidd" in
1633 x-yes|x-no|x-auto) ;;
1634 *) sdl_hidd="auto" ;;
1638 if test "x-$sdl_hidd" != "x-no" ; then
1641 AM_PATH_SDL([1.2.10], have_sdl="yes", have_sdl="no")
1643 if test "x-$have_sdl" != "x-yes" ; then
1646 if test "x-$sdl_hidd" != "x-auto" ; then
1647 dnl and they explicitly asked for it, bail out
1648 AC_MSG_ERROR([SDL libs/headers not found, cannot build SDL hidd as requested])
1652 dnl found it, set up the metatarget
1653 sdl_hidd_target=kernel-hidd-sdl
1654 aros_host_sdl_cflags=SDL_CFLAGS
1655 aros_host_sdl_libs=SDL_LIBS
1662 dnl See if the user wants dbus.library
1663 AC_MSG_CHECKING([if building of dbus.library is enabled])
1664 AC_ARG_ENABLE(dbus,AC_HELP_STRING([--enable-dbus],[Enable DBUS support via dbus.library (default=no)]),dbus="yes",dbus="no")
1665 if test "$dbus" = "yes" ; then
1667 DBUS_CFLAGS=`pkg-config --cflags dbus-1`
1668 DBUS_LIBFLAGS=`pkg-config --libs dbus-1`
1669 KERNEL_DBUS_KOBJ=kernel-dbus-kobj
1670 KERNEL_DBUS_INCLUDES=kernel-dbus-includes
1674 AC_MSG_RESULT($dbus)
1677 dnl --------------------------------------------------------------------
1678 dnl Configuration Output Section
1679 dnl --------------------------------------------------------------------
1684 AC_SUBST(aros_flavour)
1685 AC_SUBST(aros_flavour_uc)
1686 AC_SUBST(AROS_BUILDDIR)
1687 AC_SUBST(AROS_BUILDDIR_NATIVE)
1689 AC_SUBST(AROS_PORTSSRCDIR)
1692 AC_SUBST(aros_cc_pre)
1693 AC_SUBST(aros_host_strip)
1694 AC_SUBST(aros_host_arch)
1695 AC_SUBST(aros_host_cpu)
1696 AC_SUBST(aros_host_cc)
1697 AC_SUBST(aros_host_ar)
1698 AC_SUBST(aros_host_ranlib)
1699 AC_SUBST(aros_host_ld)
1700 AC_SUBST(aros_host_make)
1701 AC_SUBST(aros_host_cflags)
1702 AC_SUBST(aros_host_ldflags)
1703 AC_SUBST(aros_host_debug)
1704 AC_SUBST(aros_host_mkdep)
1705 AC_SUBST(aros_host_mkargs)
1706 AC_SUBST(aros_host_exe_suffix)
1707 AC_SUBST(aros_host_lib_suffix)
1708 AC_SUBST(aros_tools_dir)
1709 AC_SUBST(aros_host_aclocal)
1710 AC_SUBST(aros_host_autoconf)
1711 AC_SUBST(aros_host_autoheader)
1712 AC_SUBST(aros_host_automake)
1715 AC_SUBST(aros_target_guitheme)
1716 AC_SUBST(aros_target_iconset)
1717 AC_SUBST(aros_target_bootloader)
1718 AC_SUBST(aros_target_arch)
1719 AC_SUBST(aros_target_cpu)
1720 AC_SUBST(aros_target_variant)
1721 AC_SUBST(aros_target_suffix)
1722 AC_SUBST(aros_target_incl)
1723 AC_SUBST(aros_target_ar)
1724 AC_SUBST(aros_target_ranlib)
1725 AC_SUBST(aros_kernel_nm)
1726 AC_SUBST(orig_target_cc)
1727 AC_SUBST(aros_target_cc)
1728 AC_SUBST(aros_kernel_cc)
1729 AC_SUBST(aros_target_as)
1730 AC_SUBST(orig_target_ld)
1731 AC_SUBST(aros_target_ld)
1732 AC_SUBST(aros_kernel_ld)
1733 AC_SUBST(aros_target_cc_includes)
1734 AC_SUBST(aros_target_cc_path)
1735 AC_SUBST(aros_target_objdump)
1736 AC_SUBST(aros_target_objcopy)
1737 AC_SUBST(aros_target_strip)
1738 AC_SUBST(aros_target_nm)
1739 AC_SUBST(aros_kernel_rescomp)
1740 AC_SUBST(aros_shared_default)
1741 AC_SUBST(aros_shared_ld)
1742 AC_SUBST(aros_object_format)
1743 AC_SUBST(aros_compiler_libs)
1744 AC_SUBST(aros_arch_libs)
1746 AC_SUBST(aros_config_cflags)
1747 AC_SUBST(aros_config_aflags)
1748 AC_SUBST(aros_config_ldflags)
1750 AC_SUBST(aros_shared_cflags)
1751 AC_SUBST(aros_shared_aflags)
1752 AC_SUBST(aros_shared_ldflags)
1753 AC_SUBST(aros_kernel_cflags)
1754 AC_SUBST(aros_kernel_ldflags)
1755 AC_SUBST(aros_debug_cflags)
1756 AC_SUBST(aros_debug_aflags)
1757 AC_SUBST(aros_debug_ldflags)
1758 AC_SUBST(aros_target_genmap)
1759 AC_SUBST(aros_target_strip_flags)
1762 AC_SUBST(x11_hidd_target)
1763 AC_SUBST(sdl_hidd_target)
1765 AC_SUBST(aros_default_wbwidth)
1766 AC_SUBST(aros_default_wbheight)
1767 AC_SUBST(aros_default_wbdepth)
1768 AC_SUBST(DO_XSHM_SUPPORT)
1769 AC_SUBST(DO_VIDMODE_SUPPORT)
1771 AC_SUBST(aros_host_x11_includes)
1772 AC_SUBST(aros_host_x11_libdirs)
1773 AC_SUBST(aros_host_sdl_cflags)
1774 AC_SUBST(aros_host_sdl_libs)
1776 # Native version related
1777 AC_SUBST(aros_bochs_hack)
1778 AC_SUBST(aros_serial_debug)
1780 # Palm native version related
1781 AC_SUBST(aros_palm_debug_hack)
1783 # Unix/Hosted version related
1784 AC_SUBST(aros_nesting_supervisor)
1787 AC_SUBST(ENABLE_DBUS)
1788 AC_SUBST(DBUS_CFLAGS)
1789 AC_SUBST(DBUS_LIBFLAGS)
1790 AC_SUBST(KERNEL_DBUS_KOBJ)
1791 AC_SUBST(KERNEL_DBUS_INCLUDES)
1794 AC_SUBST(ENABLE_X11)
1797 AC_SUBST(aros_debug)
1798 AC_SUBST(aros_mungwall_debug)
1799 AC_SUBST(aros_stack_debug)
1800 AC_SUBST(aros_modules_debug)
1802 # Collect-aros stuff: "-ius" to ignore undefined symbols
1803 AC_SUBST(ignore_undefined_symbols)
1805 # C compiler related
1806 AC_SUBST(gcc_target_cpu)
1808 dnl Prepare for output, make up all the generated patches
1809 case "$aros_flavour" in
1810 emulation) aros_flavour_uc="AROS_FLAVOUR_EMULATION"
1811 aros_flavour="emulation" ;;
1812 emulcompat) aros_flavour_uc="(AROS_FLAVOUR_EMULATION|AROS_FLAVOUR_BINCOMPAT)"
1813 aros_flavour="emulation" ;;
1814 standalone) aros_flavour_uc="AROS_FLAVOUR_STANDALONE"
1815 aros_flavour="standalone";;
1816 native) aros_flavour_uc="AROS_FLAVOUR_NATIVE"
1817 aros_flavour="native" ;;
1818 nativecompat) aros_flavour_uc="(AROS_FLAVOUR_NATIVE|AROS_FLAVOUR_BINCOMPAT)"
1819 aros_flavour="native" ;;
1820 linklib) aros_flavour_uc="AROS_FLAVOUR_LINKLIB"
1821 aros_flavour="linklib" ;;
1822 palmnative) aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
1823 aros_flavour="palmnative" ;;
1824 mac68knative) aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
1825 aros_flavour="mac68knative" ;;
1826 ppcnative) aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_BINCOMPAT)"
1827 aros_flavour="ppcnative" ;;
1830 if test ! -d ${aros_inc_dir} ; then
1831 ${MKDIR} ${aros_inc_dir}
1833 if test ! -d ${aros_geninc_dir} ; then
1834 ${MKDIR} ${aros_geninc_dir}
1836 if test ! -d ${aros_hostcfg_dir} ; then
1837 ${MKDIR} ${aros_hostcfg_dir}
1839 if test ! -d ${aros_targetcfg_dir} ; then
1840 ${MKDIR} ${aros_targetcfg_dir}
1842 if test ! -d ${aros_tools_dir} ; then
1843 ${MKDIR} ${aros_tools_dir}
1845 if test ! -d ${aros_scripts_dir} ; then
1846 ${MKDIR} ${aros_scripts_dir}
1849 AC_CONFIG_HEADERS(${aros_geninc_dir}/host-conf.h:config/host-conf.h.in)
1851 AC_CONFIG_COMMANDS([compiler_executable],
1853 prefix=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}
1855 prefix="${prefix}/${aros_target_cpu}-aros"
1856 prefix2=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros
1860 chmod a+x ${prefix2}-gcc ${prefix2}-ld
1862 ln -sf ${prefix2}-gcc ${prefix}-gcc
1863 ln -sf ${prefix2}-ld ${prefix}-ld
1865 ln -sf $aros_target_as_ln$aros_host_exe_suffix ${prefix}-as
1866 ln -sf $aros_target_nm_ln$aros_host_exe_suffix ${prefix}-nm
1867 ln -sf $aros_target_ar_ln$aros_host_exe_suffix ${prefix}-ar
1868 ln -sf $aros_target_ranlib_ln$aros_host_exe_suffix ${prefix}-ranlib
1869 ln -sf $aros_target_objcopy_ln$aros_host_exe_suffix ${prefix}-objcopy
1870 ln -sf $aros_target_objdump_ln$aros_host_exe_suffix ${prefix}-objdump
1871 ln -sf $aros_target_strip_ln$aros_host_exe_suffix ${prefix}-strip
1873 ln -sf $aros_target_as_ln$aros_host_exe_suffix ${prefix2}-as
1874 ln -sf $aros_target_nm_ln$aros_host_exe_suffix ${prefix2}-nm
1875 ln -sf $aros_target_ar_ln$aros_host_exe_suffix ${prefix2}-ar
1876 ln -sf $aros_target_ranlib_ln$aros_host_exe_suffix ${prefix2}-ranlib
1877 ln -sf $aros_target_objcopy_ln$aros_host_exe_suffix ${prefix2}-objcopy
1878 ln -sf $aros_target_objdump_ln$aros_host_exe_suffix ${prefix2}-objdump
1879 ln -sf $aros_target_strip_ln$aros_host_exe_suffix ${prefix2}-strip
1882 aros_host_exe_suffix=${aros_host_exe_suffix}
1883 aros_tools_dir=${aros_tools_dir}
1884 aros_target_cpu=${aros_target_cpu}
1885 aros_target_arch=${aros_target_arch}
1886 aros_target_suffix=${aros_target_suffix}
1887 aros_target_nm_ln=${aros_target_nm_ln}
1888 aros_target_as_ln=${aros_target_as_ln}
1889 aros_target_ar_ln=${aros_target_ar_ln}
1890 aros_target_ranlib_ln=${aros_target_ranlib_ln}
1891 aros_target_objdump_ln=${aros_target_objdump_ln}
1892 aros_target_objcopy_ln=${aros_target_objcopy_ln}
1893 aros_target_strip_ln=${aros_target_strip_ln}
1896 AC_CONFIG_COMMANDS([genshared_executable],
1897 [chmod a+x ${aros_scripts_dir}/genshared],
1898 [aros_scripts_dir=${aros_scripts_dir}]
1900 AC_CONFIG_COMMANDS([genmf_executable],
1901 [chmod a+x ${aros_tools_dir}/genmf.py],
1902 [aros_tools_dir=${aros_tools_dir}]
1904 AC_CONFIG_COMMANDS([adflib_myaros.conf_executable],
1905 [chmod a+x tools/adflib/myconf.aros]
1911 ${aros_inc_dir}/config.h:config/config.h.in
1912 ${aros_geninc_dir}/config.h:config/config.h.in
1913 ${aros_hostcfg_dir}/host.cfg:config/host.cfg.in
1914 ${aros_targetcfg_dir}/target.cfg:config/target.cfg.in
1916 ${aros_targetcfg_dir}/make.defaults:config/make.defaults.in
1917 ${aros_targetcfg_dir}/specs:config/specs.in
1918 ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-gcc:scripts/aros-gcc.in
1919 ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-ld:scripts/aros-ld.in
1920 ${aros_scripts_dir}/genshared:compiler/c_lib/source/lib_source/genshared.in
1921 ${aros_tools_dir}/genmf.py:tools/genmf/genmf.py
1922 tools/adflib/myconf.aros
1923 tools/collect-aros/env.h
1928 dnl This is in order to not define SHARED_CFLAGS sometimes
1929 dnl We don't always do aros_shared_ar, aros_shared_cflags
1931 #XXX compatability...
1932 aros_shared_ar="$aros_shared_ld $aros_shared_ldflags -o"
1934 if test -n "$aros_shared_cflags" ; then
1935 echo "SHARED_CFLAGS := $aros_shared_cflags" >> ${aros_hostcfg_dir}/host.cfg
1936 echo "SHARED_AR := $aros_shared_ar" >> ${aros_hostcfg_dir}/host.cfg