1 dnl Copyright © 1997-2006, 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)
51 AC_MSG_CHECKING([AROS Source in .. ])
52 srcpwd=`cd ${srcdir} ; ${PWDCMD-pwd}`
54 AC_MSG_RESULT($AROS_SRCDIR)
56 # Parse the target field into something useful.
58 target_os=`echo $target | sed 's/^\([^-]*\)-\(.*\)$/\1/'`
59 target_cpu=`echo $target | sed 's/^\([^-]*\)-\(.*\)$/\2/'`
62 dnl --------------------------------------------------------------------
63 dnl Set the default Workbench resolution
64 dnl --------------------------------------------------------------------
65 aros_default_wbwidth=800
66 aros_default_wbheight=600
67 aros_default_wbdepth=4
69 dnl --------------------------------------------------------------------
70 dnl Host Configuration Section
71 dnl --------------------------------------------------------------------
73 dnl The idea here is to find out all the information we need about the
74 dnl host. This means things like tools for building directory structures,
75 dnl copying files around and the like.
77 # The first step is to find the host binaries.
78 # Check for a compiler.
83 # Check for a compatible awk
84 AC_CHECK_PROGS(AWK,[gawk nawk])
85 AROS_REQUIRED(gawk,$AWK)
86 AROS_PROG(MMAKE,mmake)
88 # Perform some default variable assignments. Note all of these will be
89 # Regenerated from the script, so there is no need to cache them.
92 AROS_TOOL_CCPATH(aros_host_ld,ld)
93 AROS_REQUIRED(ld,$aros_host_ld)
95 aros_host_cflags=$CFLAGS
96 aros_host_ldflags=$LDFLAGS
97 aros_host_debug="-g -O0"
98 aros_host_mkdep="\$(TOP)/scripts/mkdep"
99 aros_host_mkargs="--no-print-directory"
100 aros_host_incl="/usr/include"
101 aros_host_exe_suffix="$EXEEXT"
102 aros_host_lib_suffix=""
104 AC_CHECK_PROGS(aros_host_aclocal,[aclocal aclocal19])
105 AC_CHECK_PROGS(aros_host_autoconf,[autoconf autoconf259 autoconf253])
106 AC_CHECK_PROGS(aros_host_autoheader,[autoheader autoheader259 autoheader253])
107 AC_CHECK_PROGS(aros_host_automake,[automake automake19])
109 case "$aros_host_cc" in
111 aros_host_cc_pipe="-pipe"
121 dnl Despite the name, this is really a host configuration variable.
122 aros_target_cc_includes=""
124 # This is the main host configuration section. It is where the host
125 # can change the values of any variables it needs to change. We do
126 # not look at anything that compiles to the target yet, we'll get
131 aros_host_arch="linux"
132 aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
138 aros_host_cpu="x86_64"
147 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
148 aros_host_cpu="$host_cpu"
154 aros_host_cc="$aros_host_cc $aros_host_cc_pipe -I/usr/local/include"
155 aros_host_make="gmake"
156 aros_host_arch="freebsd"
159 aros_host_ldflags="$aros_host_ldflags -L/usr/local/lib -liconv"
161 dnl Need to override this here, it's just too hard later.
162 dnl This shouldn't be here at all...
163 dnl aros_target_cc_includes="/usr/include"
165 dnl FreeBSD 5.x (and later) has changed the default object format.
166 dnl The double [[]] is necessary to get around m4's quoting rules.
169 aros_object_format="elf_i386"
173 aros_object_format="elf_i386_fbsd"
180 aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
181 aros_host_arch="darwin"
190 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
191 aros_host_cpu="$host_cpu"
195 aros_host_ldflags="$aros_host_ldflags -liconv"
200 aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
201 aros_host_make="gmake"
202 aros_host_arch="netbsd"
211 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
212 aros_host_cpu="$host_cpu"
215 aros_host_lib_suffix=".0.0"
219 aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
220 aros_host_make="gmake"
221 aros_host_arch="openbsd"
227 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
228 aros_host_cpu="$host_cpu"
234 aros_host_arch="solaris"
235 aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
241 aros_host_cpu="sparc"
244 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
245 aros_host_cpu="$host_cpu"
251 aros_host_arch="morphos"
256 aros_host_arch="amiga"
261 TOUCH="/gg/bin/touch"
270 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
271 aros_host_cpu="$host_cpu"
277 aros_host_arch="cygwin"
278 aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
284 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
285 aros_host_cpu="$host_cpu"
291 aros_host_arch="mingw32"
292 aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
298 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
299 aros_host_cpu="$host_cpu"
304 AC_MSG_ERROR([Unsupported host architecture $host])
308 AROS_PROG(aros_host_ar,[ar],[cr])
309 AROS_REQUIRED(ar,$aros_host_ar)
310 AROS_PROG(aros_host_ranlib,ranlib)
311 AROS_REQUIRED(ranlib,$aros_host_ranlib)
312 AROS_PROG(aros_host_strip,strip)
313 AROS_REQUIRED(strip,$aros_host_strip)
315 AROS_PROG(RM,[rm],[-rf])
316 AROS_REQUIRED(rm,$RM)
318 AROS_REQUIRED(cp,$CP)
320 AROS_REQUIRED(mv,$MV)
321 AROS_PROG(ECHO,[echo])
322 AROS_REQUIRED(echo,$ECHO)
323 AROS_PROG(MKDIR,[mkdir],[-p])
324 AROS_REQUIRED(mkdir,$MKDIR)
325 AROS_PROG(TOUCH,[touch])
326 AROS_REQUIRED(touch,$TOUCH)
327 AROS_PROG(SORT,[sort])
328 AROS_REQUIRED(sort,$SORT)
329 AROS_PROG(UNIQ,[uniq])
330 AROS_REQUIRED(uniq,$UNIQ)
331 AROS_PROG(NOP,[true])
332 AROS_REQUIRED(true,$NOP)
334 AROS_REQUIRED(cat,$CAT)
335 AROS_PROG(BISON,[bison])
336 AROS_REQUIRED(bison,$BISON)
337 AROS_PROG(FLEX,[flex])
338 AROS_REQUIRED(flex,$FLEX)
339 AROS_PROG(PNGTOPNM,[pngtopnm])
340 AROS_REQUIRED(pngtopnm,$PNGTOPNM)
341 AROS_PROG(PPMTOILBM,[ppmtoilbm])
342 AROS_REQUIRED(ppmtoilbm,$PPMTOILBM)
344 AROS_REQUIRED(sed,$SED)
345 AROS_PROG(CHMOD,[chmod])
346 AROS_REQUIRED(chmod,$CHMOD)
348 AM_PATH_PYTHON(2.2.1)
355 dnl ---------------------------------------------------------------------------
356 dnl Look for things about the host system, good for hosted targets.
357 dnl ---------------------------------------------------------------------------
359 # Check for some includes for the X11 HIDD and the kernel
360 AC_CHECK_HEADERS([sys/ipc.h sys/shm.h \
361 sys/mmap.h sys/mman.h sysexits.h \
362 sys/statfs.h sys/statvfs.h sys/vfs.h sys/param.h \
365 AC_CHECK_HEADERS([sys/mount.h],,,[#include <sys/param.h>])
382 AC_CHECK_MEMBERS(struct tm.tm_gmtoff)
384 # Look for some functions
385 AC_CHECK_FUNCS([getpagesize kqueue statfs statvfs \
386 clone kse_create rfork_thread thr_create sa_register \
387 getcontext makecontext setcontext sigaltstack swapcontext])
392 dnl --------------------------------------------------------------------
393 dnl Target Configuration Section
394 dnl --------------------------------------------------------------------
396 dnl The target configuration section is responsible for setting up all
397 dnl the paths for includes, and tools required to build AROS to some
398 dnl particular target.
400 aros_config_cflags="-Wall -Werror-implicit-function-declaration"
401 aros_config_aflags="-Wall -x assembler-with-cpp -c"
402 aros_config_ldflags=""
404 aros_shared_default=yes
406 aros_shared_cflags="-fPIC"
407 aros_shared_aflags=""
408 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
409 aros_kernel_ldflags="-Wl,-rpath,./lib"
411 aros_target_ar_flags="cr"
412 aros_target_nm_flags="-C -ul"
413 aros_target_strip_flags="--strip-unneeded -R.comment"
417 aros_target_genmap="-Wl,-Map -Xlinker"
419 # Native flavour stuff
421 aros_serial_debug="0"
423 # Palm native flavour stuff
424 aros_palm_debug_hack="0"
427 aros_nesting_supervisor="0"
429 # Collect-aros stuff: "-ius" to ignore undefined symbols
430 ignore_undefined_symbols=""
432 #-----------------------------------------------------------------------------
435 # GCC 4.1+ has a stack protection feature that requires OS support. Ubuntu has
436 # it switched on by default, and we use the host compiler, so it compiles AROS
437 # code with this enabled resulting in link failures as we don't have support
440 # We use two methods to disable it. For the host compiler (used to compile
441 # some hosted modules), we test to see if the compiler supports stack
442 # protection, and if it does we disable it in AROS_CONFIG_CFLAGS. This should
443 # work on all platforms.
445 # For the "cross" compiler we clear the "ssp_default" spec in config/specs.in
446 # (this is done unconditionally, as it should have no effect on compilers
447 # without the stack protection feature). This may be specific to the way that
448 # Ubuntu enables the feature, so may not work everywhere. My specs-fu isn't
449 # strong enough to disable it in a generic way though, so we'll live with it
450 # until another vendor ships GCC with it enabled in a different way, and deal
454 AC_MSG_CHECKING([whether ${CC} accepts -fno-stack-protector])
455 save_cflags="$CFLAGS"
456 CFLAGS="$CFLAGS -fno-stack-protector"
457 AC_TRY_COMPILE(,, use_no_stack_protector="yes", use_no_stack_protector="no")
458 AC_MSG_RESULT($use_no_stack_protector)
459 if test "x-$use_no_stack_protector" = "x-yes" ; then
460 aros_host_cflags="$aros_host_cflags -fno-stack-protector"
462 CFLAGS="$save_cflags"
465 #-----------------------------------------------------------------------------
467 # Disable pointer-signedness warnings if the compiler recognises the option
468 # (this only works for the host compiler at the moment)
470 AC_MSG_CHECKING([whether ${CC} accepts -Wno-pointer-sign])
471 save_cflags="$CFLAGS"
472 CFLAGS="$CFLAGS -Wno-pointer-sign"
473 AC_TRY_COMPILE(,, use_no_sign_warning="yes", use_no_sign_warning="no")
474 AC_MSG_RESULT($use_no_sign_warning)
475 if test "x-$use_no_sign_warning" = "x-yes" ; then
476 aros_host_cflags="$aros_host_cflags -Wno-pointer-sign"
478 CFLAGS="$save_cflags"
480 #-----------------------------------------------------------------------------
482 AC_MSG_CHECKING([for type of build])
483 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")
485 if test "$build_type" = "nightly"; then
486 build_type_string="NIGHTLY"
487 elif test "$build_type" = "snapshot"; then
488 build_type_string="SNAPSHOT"
489 elif test "$build_type" = "milestone"; then
490 build_type_string="MILESTONE"
491 elif test "$build_type" = "release"; then
492 build_type_string="RELEASE"
494 build_type_string="PERSONAL"
495 build_type="personal"
498 aros_config_cflags="$aros_config_cflags -DAROS_BUILD_TYPE=AROS_BUILD_TYPE_$build_type_string"
500 AC_MSG_RESULT($build_type)
502 #-----------------------------------------------------------------------------
503 all_debug_types="messages stack mungwall modules symbols"
505 AC_MSG_CHECKING([which debug types to enable])
506 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)]),
507 debug="$enableval",debug="")
509 if test "$debug" = "" -o "$debug" = "no"; then
511 elif test "$debug" = "yes"; then
515 if test "$debug" = "all" ; then
516 debug=$all_debug_types
517 for d in $all_debug_types; do
518 export aros_${d}_debug="1"
521 for d in $all_debug_types; do
522 export aros_${d}_debug="0"
526 if test "$debug" != "none"; then
527 debug=`echo $debug | sed s/,/\ /g`
530 for d2 in $all_debug_types; do
531 if test "$d2" = "$d"; then
536 if test "$found" = "0"; then
537 AC_MSG_ERROR([unrecognized debug type "$d". Available types are: all none $all_debug_types])
539 export aros_${d}_debug="1"
543 AC_MSG_RESULT($debug)
545 if test "$aros_messages_debug" = "1"; then
546 aros_messages_debug="-DADEBUG=1 -DMDEBUG=1"
548 aros_messages_debug=""
550 if test "$aros_symbols_debug" = "1"; then
551 aros_symbols_debug="-g"
553 aros_symbols_debug=""
556 # These are the flags to pass when compiling debugged programs
557 aros_debug_cflags="$aros_symbols_debug $aros_messages_debug"
559 aros_debug_ldflags="$aros_symbols_debug"
561 #-----------------------------------------------------------------------------
562 # Checking for distcc and ccache.
564 # Always apply the transforms in this particular order. Basically you should
565 # always run 'ccache distcc compiler' in that order for the best performance.
567 AC_MSG_CHECKING([whether to enable distcc])
568 AC_ARG_ENABLE(distcc,AC_HELP_STRING([--enable-distcc],[Use distcc as a front end to the compiler (default=no).]),distcc="$enableval",distcc="no")
569 if test "$distcc" != "" -a "$distcc" != "no"; then
570 # AC_CHECK_PROG will print out the result in this case
571 AC_PATH_PROG(DISTCC,[distcc],distcc,)
576 AC_MSG_CHECKING([whether to enable ccache])
577 AC_ARG_ENABLE(ccache,AC_HELP_STRING([--enable-ccache],[Use ccache as a front end to the compiler (default=no).]),ccache="$enableval",ccache="no")
578 if test "$ccache" != "" -a "$ccache" != "no"; then
579 # AC_CHECK_PROG will print out the result in this case
580 AC_CHECK_PROG(CCACHE,[ccache],ccache,)
585 #-----------------------------------------------------------------------------
586 AC_MSG_CHECKING([what optimization flags to use])
587 AC_ARG_WITH(optimization,AC_HELP_STRING([--with-optimization=FLAGS],[Use optimization flags FLAGS (default=-O2).]),optimization="$withval",optimization="unknown")
588 if test "$optimization" = "unknown"; then
589 dnl default is -O2 for normal builds, -O0 for debug builds
590 if test "$debug" != "none"; then
596 aros_config_cflags="$aros_config_cflags $optimization"
597 AC_MSG_RESULT($optimization)
599 #-----------------------------------------------------------------------------
600 AC_MSG_CHECKING([what target variant to enable])
601 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")
602 if test "$target_variant" = "none"; then
603 aros_target_variant=""
604 aros_target_suffix=""
606 aros_target_variant="$target_variant"
607 aros_target_suffix="-$target_variant"
609 AC_MSG_RESULT($enableval)
611 target_bootloader="none"
613 #-----------------------------------------------------------------------------
614 # This is the target configuration switch.
617 aros_target_arch="linux"
618 case "$target_cpu" in
620 aros_target_cpu="m68k"
621 aros_object_format="m68kelf"
622 aros_flavour="emulcompat"
623 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D__mc68000 -D__linux__"
624 aros_shared_ldflags="-Wl,-T,\$(TOP)/config/linux/m68k/script.so"
625 aros_kernel_ldflags="-Wl,-rpath,./lib,-T,\$(TOP)/config/linux/m68k/script.normal"
626 gcc_target_cpu="mc68000"
629 aros_target_cpu="i386"
630 aros_object_format="elf_i386"
631 aros_flavour="emulation"
632 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__linux__"
633 aros_default_wbdepth=8
634 gcc_target_cpu="i386"
637 aros_target_cpu="x86_64"
638 aros_object_format="elf_x86_64"
639 aros_flavour="emulation"
640 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64 -D__linux__"
641 aros_config_cflags="$aros_config_cflags -mno-red-zone"
642 aros_default_wbdepth=8
643 gcc_target_cpu="x86_64"
646 aros_target_cpu="ppc"
647 aros_object_format="elf32ppc"
648 aros_flavour="emulation"
649 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc -D__linux__"
650 aros_default_wbdepth=8
654 # Same as powerpc, but I need this for the nightly build to work again.
655 # Actually, the nightly should be made working with powerpc target.
656 # That just was too much work for the moment, another week or two.
658 aros_target_cpu="ppc"
659 aros_object_format="elf32ppc"
660 aros_flavour="emulation"
661 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc -D__linux__"
662 aros_default_wbdepth=8
666 AC_MSG_ERROR("Unknown CPU for Linux -- $target_cpu")
672 aros_target_arch="pc"
673 aros_shared_default="no"
674 target_bootloader="grub"
675 case "$target_cpu" in
677 aros_target_cpu="i386"
679 dnl If somebody hasn't already set the target object
680 dnl format, then use this value. Mostly to support
681 dnl FreeBSD cross-compilation.
682 dnl TODO: Remove when we always use our compiler.
684 if test "$aros_object_format" = "" ; then
685 aros_object_format="elf_i386"
687 aros_flavour="standalone"
688 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
689 aros_kernel_ldflags=""
690 aros_default_wbwidth=640
691 aros_default_wbheight=480
692 gcc_target_cpu="i386"
695 aros_target_cpu="x86_64"
697 if test "$aros_object_format" = "" ; then
698 aros_object_format="elf_x86_64"
700 aros_flavour="standalone"
701 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
702 aros_config_cflags="$aros_config_cflags -fno-asynchronous-unwind-tables -mno-red-zone"
703 aros_kernel_ldflags=""
704 aros_default_wbwidth=640
705 aros_default_wbheight=480
706 gcc_target_cpu="x86_64"
709 AC_MSG_ERROR("Unknown native CPU -- $target_cpu")
715 aros_target_arch="prep"
716 aros_shared_default="no"
717 aros_target_cpu="ppc"
718 aros_object_format="elf32ppc"
719 aros_flavour="ppcnative"
720 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
721 aros_kernel_ldflags=""
722 aros_default_wbwidth=640
723 aros_default_wbheight=480
725 case "$target_cpu" in
727 aros_target_cc="ppc-linux-gcc -pipe"
728 aros_target_ld="ppc-linux-ld"
729 aros_target_as="ppc-linux-as"
730 aros_target_ar="ppc-linux-ar"
731 aros_target_ranlib="ppc-linux-ranlib"
732 aros_target_nm="ppc-linux-nm"
733 aros_target_strip="ppc-linux-strip"
734 aros_target_objcopy="ppc-linux-objcopy"
735 aros_target_objdump="ppc-linux-objdump"
736 aros_shared_ld="ppc-linux-ld"
737 aros_kernel_ld="ppc-linux-ld"
745 aros_target_arch="freebsd"
746 aros_target_cpu="i386"
747 aros_flavour="emulation"
748 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
749 gcc_target_cpu="i386"
751 aros_target_strip_flags="-x"
755 aros_target_arch="darwin"
756 aros_target_cpu="i386"
757 aros_flavour="emulation"
758 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
759 gcc_target_cpu="i386"
761 aros_target_strip_flags="-x"
765 aros_target_arch="netbsd"
766 case "$target_cpu" in
768 aros_target_cpu="m68k"
769 aros_object_format="m68kelf"
770 aros_flavour="emulcompat"
771 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D__mc68000 -D__NetBSD__"
772 gcc_target_cpu="mc68000"
775 aros_target_cpu="i386"
776 aros_object_format="elf_i386"
777 aros_flavour="emulation"
778 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__NetBSD__"
779 aros_default_wbdepth=8
780 gcc_target_cpu="i386"
783 AC_MSG_ERROR("Unknown CPU for NetBSD -- $target_cpu")
786 aros_target_genmap="-Wl,-M -Xlinker >"
787 aros_flavour="emulation"
788 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
792 aros_target_arch="openbsd"
793 case "$target_cpu" in
795 aros_target_cpu="i386"
796 aros_object_format="elf_i386"
797 aros_flavour="emulation"
798 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__OpenBSD__"
799 gcc_target_cpu="i386"
802 AC_MSG_ERROR("Unknown CPU for OpenBSD -- $target_cpu")
805 aros_target_genmap="-Wl,-M -Xlinker >"
806 aros_target_nm_flags="-u"
807 aros_flavour="emulation"
811 aros_target_arch="solaris"
812 case "$target_cpu" in
814 aros_target_cpu="i386"
815 aros_object_format="elf_i386"
816 aros_flavour="emulation"
817 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__Solaris__"
818 aros_default_wbdepth=8
819 gcc_target_cpu="i386"
822 aros_target_cpu="sparc"
823 aros_object_format="elf_sparc"
824 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dsparc -D__Solaris__"
825 gcc_target_cpu="sparc"
828 AC_MSG_ERROR("Unknown CPU for Solaris -- $target_cpu")
831 aros_config_cflags="$aros_config_cflags -D$aros_target_cpu"
832 aros_flavour="emulation"
836 aros_target_arch="morphos"
837 aros_shared_default="no"
838 aros_target_cpu="ppc"
839 aros_object_format="elf_ppc"
840 aros_flavour="nativecompat"
841 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
846 aros_target_arch="sam440"
847 aros_shared_default="no"
848 aros_target_cpu="ppc"
849 aros_object_format="elf32ppc"
850 aros_flavour="ppcnative"
851 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
852 aros_kernel_ldflags=""
853 aros_default_wbwidth=640
854 aros_default_wbheight=480
855 aros_config_cflags="$aros_config_cflags -mcpu=440fp -mno-toc -fno-asynchronous-unwind-tables"
856 gcc_target_cpu="powerpc"
857 case "$target_cpu" in
859 aros_target_cc="powerpc-linux-gcc -pipe"
860 aros_target_ld="powerpc-linux-ld"
861 aros_target_as="powerpc-linux-as"
862 aros_target_ar="powerpc-linux-ar"
863 aros_target_ranlib="powerpc-linux-ranlib"
864 aros_target_nm="powerpc-linux-nm"
865 aros_target_strip="powerpc-linux-strip"
866 aros_target_objcopy="powerpc-linux-objcopy"
867 aros_target_objdump="powerpc-linux-objdump"
868 aros_shared_ld="powerpc-linux-ld"
869 aros_kernel_ld="powerpc-linux-ld"
877 aros_target_arch="amiga"
878 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D_AMIGA -DAMIGA"
879 aros_shared_default="no"
881 aros_config_cflags="$aros_config_cflags -fomit-frame-pointer -fbuiltin -ffreestanding"
883 case "$target_cpu" in
885 aros_target_cpu="m68k"
886 aros_object_format="m68kelf"
887 aros_flavour="nativecompat"
888 gcc_target_cpu="mc68000"
892 aros_flavour="native"
896 AC_MSG_ERROR("Unknown CPU for Amiga $target_cpu")
902 aros_target_arch="cygwin"
903 aros_shared_default="no"
904 case "$target_cpu" in
906 aros_target_cpu="i386"
907 aros_object_format="elf_i386"
908 aros_flavour="emulation"
909 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__CYGWIN32__"
910 aros_shared_cflags=""
911 aros_default_wbdepth=8
912 gcc_target_cpu="i386"
915 AC_MSG_ERROR("Unknown CPU for CygWin -- $target_cpu")
921 aros_target_arch="mingw32"
922 aros_shared_default="no"
923 case "$target_cpu" in
925 aros_target_cpu="i386"
926 aros_object_format="elf_i386"
927 aros_flavour="emulation"
928 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
929 aros_shared_cflags=""
930 aros_default_wbdepth=8
931 gcc_target_cpu="i386"
934 AC_MSG_ERROR("Unknown CPU for Mingw32 -- $target_cpu")
937 if test $host_os = "cygwin"; then
938 aros_config_cflags="$aros_config_cflags -mno-cygwin"
939 aros_config_ldflags="$aros_config_ldflags -mno-cygwin"
940 aros_kernel_ldflags="$aros_kernel_ldflags -mno-cygwin"
944 aros_target_arch="pp"
945 aros_shared_default="no"
946 case "$target_cpu" in
948 aros_target_cpu="m68k"
949 aros_object_format="m68kelf"
950 aros_flavour="palmnative"
951 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
952 aros_kernel_ldflags=""
953 aros_default_wbwidth=160
954 aros_default_wbheight=160
955 aros_default_wbdepth=1
956 aros_target_cc="m68k-elf-gcc -pipe"
957 aros_target_ld="$(which m68k-elf-ld)"
958 aros_target_as="m68k-elf-gcc -pipe"
959 aros_shared_ld="m68k-elf-gcc"
960 aros_kernel_ld="m68k-elf-gcc"
961 aros_target_ar="m68k-elf-ar"
962 aros_target_ar_flags="cru"
963 aros_target_ranlib="m68k-elf-ranlib"
964 aros_target_nm="m68k-elf-nm"
965 aros_target_objcopy="m68k-elf-objcopy"
966 aros_target_objdump="m68k-elf-objdump"
967 aros_compiler_libs="-lgcc1"
968 aros_shared_default=no
969 aros_shared_cflags="-fpic"
970 aros_shared_aflags=""
971 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
972 aros_kernel_ldflags="-Wl,-rpath,./lib"
973 aros_debug_cflags="-Wall -Werror-implicit-function-declaration $aros_symbols_debug $aros_messages_debug -mc68000 -Wa,-mc68000"
975 aros_debug_ldflags="$aros_symbols_debug"
976 aros_mungwall_debug="0"
977 aros_modules_debug="0"
978 gcc_target_cpu="mc68000"
979 ignore_undefined_symbols="-ius"
982 AC_MSG_ERROR("Unknown CPU for PalmPilot -- $target_cpu")
988 aros_target_arch="mac"
989 aros_shared_default="no"
990 case "$target_cpu" in
992 aros_target_cpu="m68k"
993 aros_object_format="m68kelf"
994 aros_flavour="mac68knative"
995 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
996 aros_default_wbwidth=512
997 aros_default_wbheight=384
998 aros_default_wbdepth=8
999 aros_target_cc="m68k-elf-gcc -pipe"
1000 aros_target_ld="$(which m68k-elf-ld)"
1001 aros_target_as="m68k-elf-gcc -pipe"
1002 aros_shared_ld="m68k-elf-gcc"
1003 aros_kernel_ld="m68k-elf-gcc"
1004 aros_target_ar="m68k-elf-ar"
1005 aros_target_ar_flags="cru"
1006 aros_target_ranlib="m68k-elf-ranlib"
1007 aros_target_nm="m68k-elf-nm"
1008 aros_target_objcopy="m68k-elf-objcopy"
1009 aros_target_objdump="m68k-elf-objdump"
1010 aros_compiler_libs="-lgcc1"
1011 aros_shared_default=no
1012 aros_shared_cflags="-fpic"
1013 aros_shared_aflags=""
1014 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
1015 aros_kernel_ldflags="-Wl,-rpath,./lib"
1016 aros_debug_cflags="-Wall -Werror-implicit-function-declaration $aros_symbols_debug $aros_messages_debug -mc68000"
1017 aros_debug_aflags=""
1018 aros_debug_ldflags="$aros_symbols_debug"
1019 aros_mungwall_debug="0"
1020 aros_modules_debug="0"
1021 gcc_target_cpu="mc68000"
1022 ignore_undefined_symbols="-ius"
1025 AC_MSG_ERROR("Unknown CPU for Mac68k -- $target_cpu")
1031 AC_MSG_ERROR([Unsupported target architecture $target])
1035 AC_MSG_CHECKING([Where to download sourcecode for external ports])
1036 AC_ARG_WITH(portssources,AC_HELP_STRING([--with-portssources=DIR],[Where to download sourcecode for external ports]),with_portssrcdir=$withval,with_portssrcdir="default")
1037 if test "$with_portssrcdir" = "default"; then
1038 AROS_PORTSSRCDIR="$AROS_BUILDDIR/bin/Sources"
1040 AROS_PORTSSRCDIR="$with_portssrcdir"
1042 AC_MSG_RESULT($AROS_PORTSSRCDIR)
1044 AC_MSG_CHECKING([which bootloader to use])
1045 AC_ARG_WITH(bootloader,AC_HELP_STRING([--with-bootloader=NAME],[Use a specific bootloader]),target_bootloader=$withval,target_bootloader=$target_bootloader)
1046 if test "$target_bootloader" = "none"; then
1047 aros_target_bootloader=""
1049 aros_target_bootloader="$target_bootloader"
1051 AC_MSG_RESULT($target_bootloader)
1053 # Check LZO when compiling the grub2 bootloader on i386/x86_64.
1054 aros_liblzo_check="no"
1055 case "$aros_target_bootloader" in
1057 case "$target_cpu" in
1059 aros_liblzo_check="yes"
1062 aros_liblzo_check="yes"
1073 if test "$aros_liblzo_check" = "yes"; then
1074 # There are three possibilities. LZO version 2 installed with the name
1075 # liblzo2, with the name liblzo, and LZO version 1.
1076 AC_CHECK_LIB(lzo2, __lzo_init_v2, [LIBLZO="-llzo2"],
1077 AC_CHECK_LIB(lzo, __lzo_init_v2, [LIBLZO="-llzo"],
1078 AC_CHECK_LIB(lzo, __lzo_init2, [LIBLZO="-llzo"],
1079 AC_MSG_ERROR([LZO library version 1.02 or later is required]))))
1082 LIBS="$LIBS $LIBLZO"
1083 AC_CHECK_FUNC(lzo1x_999_compress, ,
1084 [AC_MSG_ERROR([LZO1X-999 must be enabled])])
1086 # LZO version 2 uses lzo/lzo1x.h, while LZO version 1 uses lzo1x.h.
1087 AC_CHECK_HEADERS(lzo/lzo1x.h lzo1x.h)
1090 AC_MSG_CHECKING([which GUI Theme to use])
1091 AC_ARG_WITH(theme,AC_HELP_STRING([--with-theme=NAME],[Use a specific GUI Theme]),target_guitheme=$withval,target_guitheme="default")
1092 if test "$target_guitheme" = "default"; then
1093 aros_target_guitheme="Ice"
1095 aros_target_guitheme="$target_guitheme"
1097 AC_MSG_RESULT($aros_target_guitheme)
1099 # Find out if we are cross-compiling (ie. if we can't use the host compiler
1102 if test "$aros_host_cpu" != "$aros_target_cpu" ; then
1105 if test "$aros_host_arch" == "darwin" ; then
1109 # Set prefix for target compiler etc. if we're cross-compiling
1110 # (should possibly be earlier but needs to be after AC_PROG_CC)
1111 if test "$cross_compiling" = "yes" ; then
1112 target_tool_prefix=${target_cpu}-elf-
1113 CC=${target_tool_prefix}gcc
1116 # Find all the tools we need to compile. This could be cross-compiling
1117 # though! If that is the case we use the GNU form of the target and
1118 # simply add this to the front of the binary name. This is rather simple,
1119 # but it should work under most circumstances.
1121 # The default tools are to use the same as the host, but only if the
1122 # host and target CPU are the same. With GCC this is normally enough.
1126 aros_shared_ld="$aros_host_ld"
1128 aros_target_mkdep="$aros_host_mkdep"
1129 aros_target_incl_def="$aros_host_incl"
1131 AC_PATH_PROG(aros_kernel_cc,$CC)
1133 # The default tools executables to be linked to.
1134 AROS_TOOL_TARGET(aros_target_as_ln,as)
1135 AROS_REQUIRED(as,$aros_target_as_ln)
1136 AROS_TOOL_TARGET(aros_kernel_ld,ld)
1137 AROS_REQUIRED(ld,$aros_kernel_ld)
1138 AROS_TOOL_TARGET(aros_target_ar_ln,ar)
1139 AROS_REQUIRED(ar,$aros_target_ar_ln)
1140 AROS_TOOL_TARGET(aros_target_nm_ln,nm)
1141 AROS_REQUIRED(nm,$aros_target_nm_ln)
1142 AROS_TOOL_TARGET(aros_target_objcopy_ln,objcopy)
1143 AROS_REQUIRED(objcopy,$aros_target_objcopy_ln)
1144 AROS_TOOL_TARGET(aros_target_objdump_ln,objdump)
1145 AROS_REQUIRED(objdump,$aros_target_objdump_ln)
1146 AROS_TOOL_TARGET(aros_target_ranlib_ln,ranlib)
1147 AROS_REQUIRED(ranlib,$aros_target_ranlib_ln)
1148 AROS_TOOL_TARGET(aros_target_strip_ln,strip)
1149 AROS_REQUIRED(strip,$aros_target_strip_ln)
1151 if test "$GCC" = "yes"; then
1152 aros_target_cc_path=`$aros_kernel_cc -print-search-dirs | grep "programs: =" | cut -c 12-`
1155 aros_hostcfg_dir="bin/${aros_host_arch}-${aros_host_cpu}/gen/config"
1156 aros_targetcfg_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/config"
1157 aros_inc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/AROS/Development/include/aros"
1158 aros_gendir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen"
1159 aros_geninc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/include/aros"
1160 aros_tools_dir="bin/${aros_host_arch}-${aros_host_cpu}/tools"
1161 aros_scripts_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/scripts"
1163 # aros_cc_pre is a variable that is added to the front of the compiler name
1164 # in the generated aros-gcc shell script. We need this to enable the cache
1165 # to work across cleaned builds. Also, support DISTCC using the correct
1166 # environment variable.
1169 if test "x${DISTCC}" != "x" ; then
1170 if test "x${CCACHE}" != "x" ; then
1171 aros_cc_pre="env CCACHE_PREFIX=${DISTCC} ${CCACHE} "
1173 aros_cc_pre="${DISTCC} "
1176 if test "x${CCACHE}" != "x" ; then
1177 aros_cc_pre="${CCACHE} "
1181 prefix="${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros"
1183 AC_SUBST(aros_target_nostdinc_cflags,-nostdinc)
1184 AC_SUBST(aros_target_nostartup_ldflags,-nostartfiles)
1185 AC_SUBST(aros_target_nix_ldflags,-nix)
1186 AC_SUBST(aros_target_detach_ldflags,-detach)
1187 AC_SUBST(aros_target_nostdlib_ldflags,-nostdlib)
1190 aros_target_cc="${prefix}-gcc"
1191 aros_target_as="${prefix}-as"
1192 aros_target_ld="${prefix}-ld"
1193 aros_target_ar="${prefix}-ar $aros_target_ar_flags"
1194 aros_target_objcopy=${prefix}-objcopy
1195 aros_target_objdump=${prefix}-objdump
1196 aros_target_ranlib="${prefix}-ranlib $aros_target_ranlib_flags"
1197 aros_target_nm="${prefix}-nm $aros_target_nm_flags"
1198 aros_kernel_nm="${prefix}-nm"
1199 aros_target_strip=${prefix}-strip
1201 # Find the system include path. We can suggest that an alternative is
1202 # used if we don't get it correct. The default is to use /usr/include.
1203 # Which is set in the aros_target_incl_def variable.
1205 AC_ARG_ENABLE(includes,
1206 AC_HELP_STRING([--enable-includes=dir],[Alternative system include directory]),
1207 [aros_target_incl=$enable_includes], [aros_target_incl=$aros_target_incl_def])
1209 dnl find out about the target cc's include path
1210 AC_MSG_CHECKING([for the target compiler's include path])
1211 if test "$aros_target_cc_includes" = "" ; then
1212 #try to guess where the directory is
1213 aros_target_cc_includes=`dirname \`${aros_kernel_cc} -print-libgcc-file-name\``/include
1214 if ! test -d $aros_target_cc_includes; then
1215 #the directory doesn't exist, we need to do some more work
1216 aros_target_cc_includes=${PWD}/${aros_gendir}/cc_include
1218 #these are the headers we're looling for
1219 headers="limits.h mmintrin.h stdbool.h syslimits.h float.h \
1220 stddef.h xmmintrin.h iso646.h stdarg.h unwind.h \
1224 for h in $headers; do
1225 #which other headers each of the above headers needs?
1226 deps=$(echo "#include <$h>" | \
1227 $aros_host_cc -E -M - 2>/dev/null | \
1228 sed 's/^.*://; s/\\$/ /g; s/[[ \t]]\+/ /g')
1230 #copy all the needed headers to a directory beneath gendir
1233 dir=${aros_target_cc_includes}$(echo $(dirname $d) | \
1234 sed -n "s,^.*/include\(/.*\),\1,p")
1235 ! test -d $dir && mkdir -p $dir
1236 ! test -f $dir/$h && { cp $d $dir; chmod u+w $dir/$h; }
1241 AC_MSG_RESULT($aros_target_cc_includes)
1244 # For GCC < 4.0 -I- is used for giving the search path for '#include "..."'
1245 # On GCC >= 4.0 -iquote should be used
1249 save_cflags="$CFLAGS"
1250 CC="$aros_kernel_cc"
1252 AC_MSG_CHECKING([whether ${CC} accepts -iquote])
1253 AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
1254 AC_MSG_RESULT($has_iquote)
1255 if test "x-$has_iquote" = "x-yes" ; then
1256 aros_cflags_iquote=-iquote
1257 aros_cflags_iquote_end=
1259 aros_cflags_iquote=-I
1260 aros_cflags_iquote_end=-I-
1263 CFLAGS="$save_cflags"
1265 AC_SUBST(aros_cflags_iquote)
1266 AC_SUBST(aros_cflags_iquote_end)
1269 dnl Check if user specified --with-resolution=XRESxYRESxDEPTH
1270 AC_MSG_CHECKING([for default resolution of WBScreen])
1271 AC_ARG_WITH(resolution,AC_HELP_STRING([--with-resolution=XRESxYRESxDEPTH],[Default resolution of the initial WorkbenchScreen]),resolution=$withval,resolution=none)
1272 # We require an argument, so map --with/--without ("yes"/"no") to "none" specified
1273 if test "$resolution" = "yes" ; then
1276 if test "$resolution" = "no" ; then
1279 if test "$resolution" != "none" ; then
1280 aros_default_wbwidth=`echo $resolution | cut -d'x' -f1`
1281 aros_default_wbheight=`echo $resolution | cut -d'x' -f2`
1282 aros_default_wbdepth=`echo $resolution | cut -d'x' -f3`
1284 AC_MSG_RESULT($aros_default_wbwidth x $aros_default_wbheight x $aros_default_wbdepth)
1285 aros_cv_default_wbwidth=$aros_default_wbwidth
1286 aros_cv_default_wbheight=$aros_default_wbheight
1287 aros_cv_default_wbdepth=$aros_default_wbdepth
1289 dnl See if the user wants the BOCHS hack for native flavour
1290 AC_MSG_CHECKING([if bochs hack is enabled])
1291 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")
1292 if test "$bochs_hack" = "yes" ; then
1295 AC_MSG_RESULT($bochs_hack)
1297 dnl See if the user wants the serial debug output for native flavour
1298 AC_MSG_CHECKING([if serial debug is enabled])
1299 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)
1300 if test "$aros_serial_debug" = 0 ; then
1301 serial_debug_forced=""
1302 if test "$serial_debug" = "yes" ; then
1305 if test "$serial_debug" = "no" ; then
1309 serial_debug_forced="(forced)"
1310 serial_debug=$aros_serial_debug
1312 if test "$serial_debug" != "none" ; then
1313 aros_serial_debug=$serial_debug
1314 AC_MSG_RESULT($serial_debug_forced on port $serial_debug)
1319 dnl See if the user wants the palm debug output hack for palm native flavour
1320 AC_MSG_CHECKING([if palm debug hack is enabled])
1321 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")
1322 if test "$palm_debug_hack" = "yes" ; then
1323 aros_palm_debug_hack="1"
1325 AC_MSG_RESULT($palm_debug_hack)
1328 dnl See if the user wants nesting supervisor activated for unix flavour
1329 AC_MSG_CHECKING([if nesting supervisor support is enabled])
1330 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")
1331 if test "$nesting_supervisor" = "yes" ; then
1332 aros_nesting_supervisor="1"
1334 AC_MSG_RESULT($nesting_supervisor)
1337 dnl things specifically required for hosted flavours
1338 if test "x-$aros_flavour" = "x-emulation" -o "x-$aros_flavour" = "x-emulcompat" ; then
1340 if test "x-$aros_host_arch" != "x-darwin" ; then
1341 dnl some kind of dynamic library access system is required for hostlib.resource
1342 AC_CHECK_FUNC(dlopen, have_dl="yes", have_dl="no")
1343 if test "x-$have_dl" = "x-no" ; then
1344 AC_CHECK_LIB(dl, dlopen, [have_dl="yes"
1345 aros_host_ldflags="$aros_host_ldflags -ldl"],
1348 if test "x-$have_dl" = "x-no" ; then
1349 AC_MSG_ERROR([dlopen() dynamic linker functions not available])
1355 AC_ARG_ENABLE(x11_hidd, AC_HELP_STRING([--enable-x11-hidd],
1356 [build X11 hidd for hosted (default=auto)]),
1357 x11_hidd="$enableval",
1359 case "x-$x11_hidd" in
1360 x-yes|x-no|x-auto) ;;
1361 *) x11_hidd="auto" ;;
1365 if test "x-$x11_hidd" != "x-no" ; then
1371 for path in $x_libraries
1373 x_cflags="$x_cflags -L$path"
1376 for path in $x_includes
1378 x_cflags="$x_cflags -I$path"
1381 if test "x-$no_x" = "x-yes" ; then
1384 if test "x-$x11_hidd" != "x-auto" ; then
1385 dnl and they explicitly asked for it, bail out
1386 AC_MSG_ERROR([X11 libs/headers not found, cannot build X11 hidd as requested])
1390 dnl found it, setup the metatarget
1391 x11_hidd_target=kernel-x11gfx
1394 dnl setup shared memory extensions
1395 AC_ARG_ENABLE(x11_shm, AC_HELP_STRING([--enable-x11-shm],
1396 [use X11 shared memory (default=auto)]),
1397 x11_hidd_shm="$enableval",
1398 x11_hidd_shm="auto")
1399 case "x-$x11_hidd_shm" in
1400 x-yes|x-no|x-auto) ;;
1401 *) x11_hidd_shm="auto" ;;
1407 if test "x-$x11_hidd_shm" != "x-no" ; then
1409 dnl system shm headers
1410 AC_CHECK_HEADERS(sys/ipc.h)
1411 AC_CHECK_HEADERS(sys/shm.h)
1414 if test "x-$ac_cv_header_sys_ipc_h" = "x-yes" -a "x-$ac_cv_header_sys_shm_h" = "x-yes" ; then
1416 dnl make sure X libs have shm functions
1417 save_cflags="$CFLAGS"
1418 CFLAGS="$CFLAGS $x_cflags"
1419 AC_CHECK_LIB(Xext, XShmQueryExtension, have_xshm=yes)
1420 CFLAGS="$save_cflags"
1424 dnl detection done, prepare output
1425 if test "x-$have_xshm" = "x-yes" ; then
1428 elif test "x-$x11_hidd_shm" = "x-yes" ; then
1429 dnl they explicitly asked for it, but we can't do it
1430 AC_MSG_ERROR([X11 has no support for shared memory, cannot enable it as requested])
1432 dnl otherwise just disable it
1437 dnl setup vidmode (fullscreen) extensions
1438 AC_ARG_ENABLE(x11_vidmode, AC_HELP_STRING([--enable-x11-vidmode],
1439 [use X11 vidmode extension (default=auto)]),
1440 x11_hidd_vidmode="$enableval",
1441 x11_hidd_vidmode="auto")
1442 case "x-$x11_hidd_vidmode" in
1443 x-yes|x-no|x-auto) ;;
1444 *) x11_hidd_vidmode="auto" ;;
1450 if test "x-$x11_hidd_vidmode" != "x-no" ; then
1452 dnl make sure X libs have vidmode functions
1453 save_cflags="$CFLAGS"
1454 CFLAGS="$CFLAGS $x_cflags"
1455 AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryExtension, have_vidmode=yes)
1456 CFLAGS="$save_cflags"
1459 dnl detection done, prepare output
1460 if test "x-$have_vidmode" = "x-yes" ; then
1461 dnl we can do vidmode
1462 DO_VIDMODE_SUPPORT="1"
1463 elif test "x-$x11_hidd_vidmode" = "x-yes" ; then
1464 dnl they explicitly asked for it, but we can't do it
1465 AC_MSG_ERROR([X11 vidmode extension not available, cannot enable it as requested])
1467 dnl otherwise just disable it
1468 DO_VIDMODE_SUPPORT="0"
1472 aros_host_x11_includes=$x_includes
1473 aros_host_x11_libdirs=$x_libraries
1478 AC_ARG_ENABLE(sdl_hidd, AC_HELP_STRING([--enable-sdl-hidd],
1479 [build SDL hidd for hosted (default=auto)]),
1480 sdl_hidd="$enableval",
1482 case "x-$sdl_hidd" in
1483 x-yes|x-no|x-auto) ;;
1484 *) sdl_hidd="auto" ;;
1488 if test "x-$sdl_hidd" != "x-no" ; then
1491 AM_PATH_SDL([1.2.10], have_sdl="yes", have_sdl="no")
1493 if test "x-$have_sdl" != "x-yes" ; then
1496 if test "x-$sdl_hidd" != "x-auto" ; then
1497 dnl and they explicitly asked for it, bail out
1498 AC_MSG_ERROR([SDL libs/headers not found, cannot build SDL hidd as requested])
1502 dnl found it, setup the metatarget
1503 sdl_hidd_target=kernel-hidd-sdl
1504 aros_host_sdl_cflags=SDL_CFLAGS
1505 aros_host_sdl_libs=SDL_LIBS
1512 dnl See if the user wants dbus.library
1513 AC_MSG_CHECKING([if building of dbus.library is enabled])
1514 AC_ARG_ENABLE(dbus,AC_HELP_STRING([--enable-dbus],[Enable DBUS support via dbus.library (default=no)]),dbus="yes",dbus="no")
1515 if test "$dbus" = "yes" ; then
1517 DBUS_CFLAGS=`pkg-config --cflags dbus-1`
1518 DBUS_LIBFLAGS=`pkg-config --libs dbus-1`
1519 KERNEL_DBUS_KOBJ=kernel-dbus-kobj
1520 KERNEL_DBUS_INCLUDES=kernel-dbus-includes
1524 AC_MSG_RESULT($dbus)
1527 dnl --------------------------------------------------------------------
1528 dnl Configuration Output Section
1529 dnl --------------------------------------------------------------------
1534 AC_SUBST(aros_flavour)
1535 AC_SUBST(aros_flavour_uc)
1536 AC_SUBST(AROS_BUILDDIR)
1537 AC_SUBST(AROS_SRCDIR)
1538 AC_SUBST(AROS_PORTSSRCDIR)
1541 AC_SUBST(aros_cc_pre)
1542 AC_SUBST(aros_host_strip)
1543 AC_SUBST(aros_host_arch)
1544 AC_SUBST(aros_host_cpu)
1545 AC_SUBST(aros_host_cc)
1546 AC_SUBST(aros_host_ar)
1547 AC_SUBST(aros_host_ranlib)
1548 AC_SUBST(aros_host_ld)
1549 AC_SUBST(aros_host_make)
1550 AC_SUBST(aros_host_cflags)
1551 AC_SUBST(aros_host_ldflags)
1552 AC_SUBST(aros_host_debug)
1553 AC_SUBST(aros_host_mkdep)
1554 AC_SUBST(aros_host_mkargs)
1555 AC_SUBST(aros_host_exe_suffix)
1556 AC_SUBST(aros_host_lib_suffix)
1557 AC_SUBST(aros_tools_dir)
1558 AC_SUBST(aros_host_aclocal)
1559 AC_SUBST(aros_host_autoconf)
1560 AC_SUBST(aros_host_autoheader)
1561 AC_SUBST(aros_host_automake)
1564 AC_SUBST(aros_target_guitheme)
1565 AC_SUBST(aros_target_bootloader)
1566 AC_SUBST(aros_target_arch)
1567 AC_SUBST(aros_target_cpu)
1568 AC_SUBST(aros_target_variant)
1569 AC_SUBST(aros_target_suffix)
1570 AC_SUBST(aros_target_incl)
1571 AC_SUBST(aros_target_ar)
1572 AC_SUBST(aros_target_ranlib)
1573 AC_SUBST(aros_kernel_nm)
1574 AC_SUBST(aros_target_cc)
1575 AC_SUBST(aros_kernel_cc)
1576 AC_SUBST(aros_target_as)
1577 AC_SUBST(aros_target_ld)
1578 AC_SUBST(aros_kernel_ld)
1579 AC_SUBST(aros_target_cc_includes)
1580 AC_SUBST(aros_target_cc_path)
1581 AC_SUBST(aros_target_objdump)
1582 AC_SUBST(aros_target_objcopy)
1583 AC_SUBST(aros_target_strip)
1584 AC_SUBST(aros_target_nm)
1585 AC_SUBST(aros_shared_default)
1586 AC_SUBST(aros_shared_ld)
1587 AC_SUBST(aros_object_format)
1588 AC_SUBST(aros_compiler_libs)
1590 AC_SUBST(aros_config_cflags)
1591 AC_SUBST(aros_config_aflags)
1592 AC_SUBST(aros_config_ldflags)
1594 AC_SUBST(aros_shared_cflags)
1595 AC_SUBST(aros_shared_aflags)
1596 AC_SUBST(aros_shared_ldflags)
1597 AC_SUBST(aros_kernel_ldflags)
1598 AC_SUBST(aros_debug_cflags)
1599 AC_SUBST(aros_debug_aflags)
1600 AC_SUBST(aros_debug_ldflags)
1601 AC_SUBST(aros_target_genmap)
1602 AC_SUBST(aros_target_strip_flags)
1605 AC_SUBST(x11_hidd_target)
1606 AC_SUBST(sdl_hidd_target)
1608 AC_SUBST(aros_default_wbwidth)
1609 AC_SUBST(aros_default_wbheight)
1610 AC_SUBST(aros_default_wbdepth)
1611 AC_SUBST(DO_XSHM_SUPPORT)
1612 AC_SUBST(DO_VIDMODE_SUPPORT)
1614 AC_SUBST(aros_host_x11_includes)
1615 AC_SUBST(aros_host_x11_libdirs)
1616 AC_SUBST(aros_host_sdl_cflags)
1617 AC_SUBST(aros_host_sdl_libs)
1619 # Native version related
1620 AC_SUBST(aros_bochs_hack)
1621 AC_SUBST(aros_serial_debug)
1623 # Palm native version related
1624 AC_SUBST(aros_palm_debug_hack)
1626 # Unix/Hosted version related
1627 AC_SUBST(aros_nesting_supervisor)
1630 AC_SUBST(ENABLE_DBUS)
1631 AC_SUBST(DBUS_CFLAGS)
1632 AC_SUBST(DBUS_LIBFLAGS)
1633 AC_SUBST(KERNEL_DBUS_KOBJ)
1634 AC_SUBST(KERNEL_DBUS_INCLUDES)
1637 AC_SUBST(aros_debug)
1638 AC_SUBST(aros_mungwall_debug)
1639 AC_SUBST(aros_stack_debug)
1640 AC_SUBST(aros_modules_debug)
1642 # Collect-aros stuff: "-ius" to ignore undefined symbols
1643 AC_SUBST(ignore_undefined_symbols)
1645 # C compiler related
1646 AC_SUBST(gcc_target_cpu)
1648 dnl Prepare for output, make up all the generated patches
1649 case "$aros_flavour" in
1650 emulation) aros_flavour_uc="AROS_FLAVOUR_EMULATION"
1651 aros_flavour="emulation" ;;
1652 emulcompat) aros_flavour_uc="(AROS_FLAVOUR_EMULATION|AROS_FLAVOUR_BINCOMPAT)"
1653 aros_flavour="emulation" ;;
1654 standalone) aros_flavour_uc="AROS_FLAVOUR_STANDALONE"
1655 aros_flavour="standalone";;
1656 native) aros_flavour_uc="AROS_FLAVOUR_NATIVE"
1657 aros_flavour="native" ;;
1658 nativecompat) aros_flavour_uc="(AROS_FLAVOUR_NATIVE|AROS_FLAVOUR_BINCOMPAT)"
1659 aros_flavour="native" ;;
1660 linklib) aros_flavour_uc="AROS_FLAVOUR_LINKLIB"
1661 aros_flavour="linklib" ;;
1662 palmnative) aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
1663 aros_flavour="palmnative" ;;
1664 mac68knative) aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
1665 aros_flavour="mac68knative" ;;
1666 ppcnative) aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_BINCOMPAT)"
1667 aros_flavour="ppcnative" ;;
1670 if test ! -d ${aros_inc_dir} ; then
1671 ${MKDIR} ${aros_inc_dir}
1673 if test ! -d ${aros_geninc_dir} ; then
1674 ${MKDIR} ${aros_geninc_dir}
1676 if test ! -d ${aros_hostcfg_dir} ; then
1677 ${MKDIR} ${aros_hostcfg_dir}
1679 if test ! -d ${aros_targetcfg_dir} ; then
1680 ${MKDIR} ${aros_targetcfg_dir}
1682 if test ! -d ${aros_tools_dir} ; then
1683 ${MKDIR} ${aros_tools_dir}
1685 if test ! -d ${aros_scripts_dir} ; then
1686 ${MKDIR} ${aros_scripts_dir}
1689 AC_CONFIG_HEADERS(${aros_geninc_dir}/host-conf.h:config/host-conf.h.in)
1691 AC_CONFIG_COMMANDS([compiler_executable],
1693 prefix=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}
1695 prefix="${prefix}/${aros_target_cpu}-aros"
1696 prefix2=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros
1700 chmod a+x ${prefix2}-gcc ${prefix2}-ld
1702 ln -sf ${prefix2}-gcc ${prefix}-gcc
1703 ln -sf ${prefix2}-ld ${prefix}-ld
1705 ln -sf $aros_target_as_ln ${prefix}-as
1706 ln -sf $aros_target_nm_ln ${prefix}-nm
1707 ln -sf $aros_target_ar_ln ${prefix}-ar
1708 ln -sf $aros_target_ranlib_ln ${prefix}-ranlib
1709 ln -sf $aros_target_objcopy_ln ${prefix}-objcopy
1710 ln -sf $aros_target_objdump_ln ${prefix}-objdump
1711 ln -sf $aros_target_strip_ln ${prefix}-strip
1713 ln -sf $aros_target_as_ln ${prefix2}-as
1714 ln -sf $aros_target_nm_ln ${prefix2}-nm
1715 ln -sf $aros_target_ar_ln ${prefix2}-ar
1716 ln -sf $aros_target_ranlib_ln ${prefix2}-ranlib
1717 ln -sf $aros_target_objcopy_ln ${prefix2}-objcopy
1718 ln -sf $aros_target_objdump_ln ${prefix2}-objdump
1719 ln -sf $aros_target_strip_ln ${prefix2}-strip
1722 aros_tools_dir=${aros_tools_dir}
1723 aros_target_cpu=${aros_target_cpu}
1724 aros_target_arch=${aros_target_arch}
1725 aros_target_suffix=${aros_target_suffix}
1726 aros_target_nm_ln=${aros_target_nm_ln}
1727 aros_target_as_ln=${aros_target_as_ln}
1728 aros_target_ar_ln=${aros_target_ar_ln}
1729 aros_target_ranlib_ln=${aros_target_ranlib_ln}
1730 aros_target_objdump_ln=${aros_target_objdump_ln}
1731 aros_target_objcopy_ln=${aros_target_objcopy_ln}
1732 aros_target_strip_ln=${aros_target_strip_ln}
1735 AC_CONFIG_COMMANDS([genshared_executable],
1736 [chmod a+x ${aros_scripts_dir}/genshared],
1737 [aros_scripts_dir=${aros_scripts_dir}]
1739 AC_CONFIG_COMMANDS([genmf_executable],
1740 [chmod a+x ${aros_tools_dir}/genmf.py],
1741 [aros_tools_dir=${aros_tools_dir}]
1743 AC_CONFIG_COMMANDS([adflib_myaros.conf_executable],
1744 [chmod a+x tools/adflib/myconf.aros]
1751 ${aros_inc_dir}/config.h:config/config.h.in
1752 ${aros_geninc_dir}/config.h:config/config.h.in
1753 ${aros_hostcfg_dir}/host.cfg:config/host.cfg.in
1754 ${aros_targetcfg_dir}/target.cfg:config/target.cfg.in
1756 ${aros_targetcfg_dir}/make.defaults:config/make.defaults.in
1757 ${aros_targetcfg_dir}/specs:config/specs.in
1758 ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-gcc:scripts/aros-gcc.in
1759 ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-ld:scripts/aros-ld.in
1760 ${aros_scripts_dir}/genshared:compiler/c_lib/source/lib_source/genshared.in
1761 ${aros_tools_dir}/genmf.py:tools/genmf/genmf.py
1762 tools/adflib/myconf.aros
1763 tools/collect-aros/env.h
1768 dnl This is in order to not define SHARED_CFLAGS sometimes
1769 dnl We don't always do aros_shared_ar, aros_shared_cflags
1771 #XXX compatability...
1772 aros_shared_ar="$aros_shared_ld $aros_shared_ldflags -o"
1774 if test -n "$aros_shared_cflags" ; then
1775 echo "SHARED_CFLAGS := $aros_shared_cflags" >> ${aros_hostcfg_dir}/host.cfg
1776 echo "SHARED_AR := $aros_shared_ar" >> ${aros_hostcfg_dir}/host.cfg