1 dnl Copyright (C) 1997-2005 AROS - The Amiga Research OS
4 dnl Desc: Autoconf source for configuration file
8 # method of getting shared/non-shared ld/ar tool for target.
9 # ar, ranlib, strip, nm for target
12 # ------------------------------------------------------------------------
13 # Here starts the first section of the configure.in file.
14 # ------------------------------------------------------------------------
18 AC_CONFIG_AUX_DIR(scripts/autoconf)
20 # Check what host we are running on.
21 # If a target is not suggested, we use this one.
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...
49 # Parse the target field into something useful.
51 target_os=`echo $target | sed 's/^\([^-]*\)-\(.*\)$/\1/'`
52 target_cpu=`echo $target | sed 's/^\([^-]*\)-\(.*\)$/\2/'`
55 dnl --------------------------------------------------------------------
56 dnl Set the default Workbench resolution
57 dnl --------------------------------------------------------------------
58 aros_default_wbwidth=800
59 aros_default_wbheight=600
60 aros_default_wbdepth=4
62 dnl --------------------------------------------------------------------
63 dnl Host Configuration Section
64 dnl --------------------------------------------------------------------
66 dnl The idea here is to find out all the information we need about the
67 dnl host. This means things like tools for building directory structures
68 dnl copying files around and the like.
70 # The first step is to find the host binaries.
71 # Check for a compiler.
76 # We don't yet support cross-compiling, but we may later on.
81 # Check for gawk and mmake.
82 AC_CHECK_PROGS(AWK,[gawk nawk])
84 AROS_REQUIRED(gawk,$AWK)
85 AROS_PROG(MMAKE,mmake)
87 # Perform some default variable assignments. Note all of these will be
88 # Regenerated from the script, so there is no need to cache them.
91 AROS_TOOL_CCPATH(aros_host_ld,ld)
92 AROS_REQUIRED(ld,$aros_host_ld)
94 aros_host_cflags=$CFLAGS
95 aros_host_ldflags=$LDFLAGS
96 aros_host_debug="-g -O0"
97 aros_host_mkdep="\$(TOP)/scripts/mkdep"
98 aros_host_mkargs="--no-print-directory"
99 aros_host_incl="/usr/include"
100 aros_host_exe_suffix="$EXEEXT"
101 aros_host_lib_suffix=""
103 AC_CHECK_PROGS(aros_host_aclocal,[aclocal aclocal19])
104 AC_CHECK_PROGS(aros_host_autoconf,[autoconf autoconf259 autoconf253])
105 AC_CHECK_PROGS(aros_host_autoheader,[autoheader autoheader259 autoheader253])
106 AC_CHECK_PROGS(aros_host_automake,[automake automake19])
110 aros_host_cc_pipe="-pipe"
120 dnl Despite the name, this is really a host configuration variable.
121 aros_target_cc_includes=""
123 # This is the main host configuration section. It is where the host
124 # can change the values of any variables it needs to change. We do
125 # not look at anything that compiles to the target yet, we'll get
130 aros_host_arch="linux"
131 aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
137 aros_host_cpu="x86_64"
146 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
147 aros_host_cpu="$host_cpu"
153 aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
154 aros_host_make="gmake"
155 aros_host_arch="freebsd"
158 dnl Need to override this here, it's just too hard later.
159 dnl This shouldn't be here at all...
160 dnl aros_target_cc_includes="/usr/include"
162 dnl FreeBSD 5.x has changed the default object format.
163 dnl The double [[]] is necessary to get around m4's quoting rules.
166 aros_object_format="elf_i386_fbsd"
170 aros_object_format="elf_i386"
176 aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
177 aros_host_make="gmake"
178 aros_host_arch="netbsd"
187 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
188 aros_host_cpu="$host_cpu"
191 aros_host_lib_suffix=".0.0"
195 aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
196 aros_host_make="gmake"
197 aros_host_arch="openbsd"
203 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
204 aros_host_cpu="$host_cpu"
210 aros_host_arch="solaris"
211 aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
214 aros_host_cpu="sparc"
217 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
218 aros_host_cpu="$host_cpu"
224 aros_host_cc="$aros_host_cc"
225 aros_host_arch="morphos"
230 aros_host_arch="amiga"
235 TOUCH="/gg/bin/touch"
244 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
245 aros_host_cpu="$host_cpu"
251 aros_host_arch="cygwin"
252 aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
258 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
259 aros_host_cpu="$host_cpu"
264 AC_MSG_ERROR([Unsupported host architecture $host])
268 AROS_PROG(HOST_AR,[ar],[cr])
269 AROS_REQUIRED(ar,$HOST_AR)
270 AROS_PROG(HOST_RANLIB,ranlib)
272 AROS_PROG(RM,[rm],[-rf])
273 AROS_REQUIRED(rm,$RM)
275 AROS_REQUIRED(cp,$CP)
277 AROS_REQUIRED(mv,$MV)
278 AROS_PROG(ECHO,[echo])
279 AROS_REQUIRED(echo,$ECHO)
280 AROS_PROG(MKDIR,[mkdir],[-p])
281 AROS_REQUIRED(mkdir,$MKDIR)
282 AROS_PROG(TOUCH,[touch])
283 AROS_REQUIRED(touch,$TOUCH)
284 AROS_PROG(SORT,[sort])
285 AROS_REQUIRED(sort,$SORT)
286 AROS_PROG(UNIQ,[uniq])
287 AROS_REQUIRED(uniq,$UNIQ)
288 AROS_PROG(NOP,[true])
289 AROS_REQUIRED(true,$NOP)
291 AROS_REQUIRED(cat,$CAT)
292 AROS_PROG(BISON,[bison])
293 AROS_REQUIRED(bison,$BISON)
294 AROS_PROG(PNGTOPNM,[pngtopnm])
295 AROS_REQUIRED(pngtopnm,$PNGTOPNM)
296 AROS_PROG(PPMTOILBM,[ppmtoilbm])
297 AROS_REQUIRED(ppmtoilbm,$PPMTOILBM)
298 AROS_PROG(STRIP,[strip])
299 AROS_REQUIRED(strip,$STRIP)
301 AROS_REQUIRED(sed,$SED)
302 AROS_PROG(CHMOD,[chmod])
303 AROS_REQUIRED(chmod,$CHMOD)
305 AM_PATH_PYTHON(2.2.1)
316 dnl ---------------------------------------------------------------------------
317 dnl Look for things about the host system, good for hosted targets.
318 dnl ---------------------------------------------------------------------------
320 # Check for some includes for the X11 HIDD and the kernel
321 AC_CHECK_HEADERS([sys/ipc.h sys/shm.h \
322 sys/mmap.h sys/mman.h sysexits.h \
323 sys/statfs.h sys/statvfs.h sys/vfs.h sys/param.h \
326 AC_CHECK_HEADERS([sys/mount.h],,,[#include <sys/param.h>])
343 AC_CHECK_MEMBERS(struct tm.tm_gmtoff)
345 # Look for some functions
346 AC_CHECK_FUNCS([getpagesize kqueue statfs statvfs \
347 clone kse_create rfork_thread thr_create sa_register \
348 getcontext makecontext setcontext sigaltstack swapcontext])
356 dnl --------------------------------------------------------------------
357 dnl Target Configuration Section
358 dnl --------------------------------------------------------------------
360 dnl The target configuration section is responsible for setting up all
361 dnl the paths for includes, and tools required to build AROS to some
362 dnl particular target.
364 # Find all the tools we need to compile. This could be cross-compiling
365 # though! If that is the case we use the GNU form of the target and
366 # simply add this to the front of the binary name. This is rather simple,
367 # but it should work under most circumstances.
369 # The default tools are to use the same as the host, but only if the
370 # host and target CPU are the same. With GCC this is normally enough.
374 aros_target_cc="$aros_host_cc"
375 aros_target_as="$aros_host_cc"
376 aros_shared_ld="$aros_host_ld"
377 aros_kernel_ld="$aros_host_ld"
378 aros_target_ld="$aros_host_ld"
380 aros_target_mkdep="$aros_host_mkdep"
381 aros_target_incl_def="$aros_host_incl"
383 # The default tools executables to be linked at.
384 AROS_TOOL_CCPATH(aros_target_ar_ln,ar)
385 AROS_REQUIRED(ar,$aros_target_ar_ln)
386 AROS_TOOL_CCPATH(aros_target_nm_ln,nm)
387 AROS_REQUIRED(nm,$aros_target_nm_ln)
388 AROS_TOOL_CCPATH(aros_target_objcopy_ln,objcopy)
389 AROS_REQUIRED(objcopy,$aros_target_objcopy_ln)
390 AROS_TOOL_CCPATH(aros_target_objdump_ln,objdump)
391 AROS_REQUIRED(objdump,$aros_target_objdump_ln)
392 AROS_TOOL_CCPATH(aros_target_ranlib_ln,ranlib)
393 AROS_REQUIRED(ranlib,$aros_target_ranlib_ln)
394 AROS_TOOL_CCPATH(aros_target_strip_ln,strip)
395 AROS_REQUIRED(strip,$aros_target_strip_ln)
397 if test "$GCC" = "yes"; then
398 aros_target_cc_path=`$CC -print-search-dirs | grep "programs: =" | cut -c 12-`
401 # It is necessary to clear the include and link paths for target
402 # commands. This should help clear up problems when cross compiling.
403 aros_config_cflags="-Wall -Werror-implicit-function-declaration"
404 aros_config_aflags="-Wall -x assembler-with-cpp"
405 aros_config_ldflags=""
407 aros_shared_default=yes
409 aros_shared_cflags="-fPIC"
410 aros_shared_aflags=""
411 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
412 aros_kernel_ldflags="-Wl,-rpath,./lib"
416 aros_target_genmap="-Wl,-Map -Xlinker"
418 # Native flavour stuff
420 aros_serial_debug="0"
422 # Palm native flavour stuff
423 aros_palm_debug_hack="0"
426 aros_nesting_supervisor="0"
428 # Collect-aros stuff: "-ius" to ignore undefined symbols
429 ignore_undefined_symbols=""
435 #-----------------------------------------------------------------------------
437 AC_MSG_CHECKING([for type of build])
438 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")
440 if test "$build_type" = "nightly"; then
441 build_type_string="NIGHTLY"
442 elif test "$build_type" = "snapshot"; then
443 build_type_string="SNAPSHOT"
444 elif test "$build_type" = "milestone"; then
445 build_type_string="MILESTONE"
446 elif test "$build_type" = "release"; then
447 build_type_string="RELEASE"
449 build_type_string="PERSONAL"
450 build_type="personal"
453 aros_config_cflags="$aros_config_cflags -DAROS_BUILD_TYPE=AROS_BUILD_TYPE_$build_type_string"
455 AC_MSG_RESULT($build_type)
457 #-----------------------------------------------------------------------------
458 all_debug_types="messages stack mungwall modules symbols"
460 AC_MSG_CHECKING([which debug types to enable])
461 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)]),
462 debug="$enableval",debug="")
464 if test "$debug" = "" -o "$debug" = "no"; then
466 elif test "$debug" = "yes"; then
470 if test "$debug" = "all" ; then
471 debug=$all_debug_types
472 for d in $all_debug_types; do
473 export aros_${d}_debug="1"
476 for d in $all_debug_types; do
477 export aros_${d}_debug="0"
481 if test "$debug" != "none"; then
482 debug=`echo $debug | sed s/,/\ /g`
485 for d2 in $all_debug_types; do
486 if test "$d2" = "$d"; then
491 if test "$found" = "0"; then
492 AC_MSG_ERROR([unrecognized debug type "$d". Available types are: all none $all_debug_types])
494 export aros_${d}_debug="1"
498 AC_MSG_RESULT($debug)
500 if test "$aros_messages_debug" = "1"; then
501 aros_messages_debug="-DADEBUG=1 -DMDEBUG=1"
503 aros_messages_debug=""
505 if test "$aros_symbols_debug" = "1"; then
506 aros_symbols_debug="-g"
508 aros_symbols_debug=""
511 # These are the flags to pass when compiling debugged programs
512 aros_debug_cflags="$aros_symbols_debug $aros_messages_debug"
514 aros_debug_ldflags="$aros_symbols_debug"
516 #-----------------------------------------------------------------------------
517 # Checking for distcc and ccache.
519 # Always apply the transforms in this particular order. Basically you should
520 # always run 'ccache distcc compiler' in that order for the best performance.
522 AC_MSG_CHECKING([whether to enable distcc])
523 AC_ARG_ENABLE(distcc,AC_HELP_STRING([--enable-distcc],[Use distcc as a front end to the compiler (default=no).]),distcc="$enableval",distcc="no")
524 if test "$distcc" != "" -a "$distcc" != "no"; then
525 # AC_CHECK_PROG will print out the result in this case
526 AC_PATH_PROG(DISTCC,[distcc],distcc,no)
531 AC_MSG_CHECKING([whether to enable ccache])
532 AC_ARG_ENABLE(ccache,AC_HELP_STRING([--enable-ccache],[Use ccache as a front end to the compiler (default=no).]),ccache="$enableval",ccache="no")
533 if test "$ccache" != "" -a "$ccache" != "no"; then
534 # AC_CHECK_PROG will print out the result in this case
535 AC_CHECK_PROG(CCACHE,[ccache],ccache,no)
540 #-----------------------------------------------------------------------------
541 AC_MSG_CHECKING([what optimization flags to use])
542 AC_ARG_WITH(optimization,AC_HELP_STRING([--with-optimization=FLAGS],[Use optimization flags FLAGS (default=-O2).]),optimization="$withval",optimization="unknown")
543 if test "$optimization" = "unknown"; then
544 dnl default is -O2 for normal builds, -O0 for debug builds
545 if test "$debug" != "none"; then
551 aros_config_cflags="$aros_config_cflags $optimization"
552 AC_MSG_RESULT($optimization)
554 #-----------------------------------------------------------------------------
555 AC_MSG_CHECKING([what target variant to enable])
556 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")
557 if test "$target_variant" = "none"; then
558 aros_target_variant=""
559 aros_target_suffix=""
561 aros_target_variant="$target_variant"
562 aros_target_suffix="-$target_variant"
564 AC_MSG_RESULT($enableval)
566 #-----------------------------------------------------------------------------
567 # This is the target configuration switch.
570 aros_target_arch="linux"
571 case "$target_cpu" in
573 aros_target_cpu="m68k"
574 aros_object_format="m68kelf"
575 aros_flavour="emulcompat"
576 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D__mc68000 -D__linux__"
577 aros_shared_ldflags="-Wl,-T,\$(TOP)/config/linux/m68k/script.so"
578 aros_kernel_ldflags="-Wl,-rpath,./lib,-T,\$(TOP)/config/linux/m68k/script.normal"
579 gcc_target_cpu="mc68000"
582 aros_target_cpu="i386"
583 aros_object_format="elf_i386"
584 aros_flavour="emulation"
585 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__linux__"
586 aros_default_wbdepth=8
587 gcc_target_cpu="i386"
590 aros_target_cpu="x86_64"
591 aros_object_format="elf_x86_64"
592 aros_flavour="emulation"
593 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64 -D__linux__"
594 aros_default_wbdepth=8
595 gcc_target_cpu="x86_64"
598 aros_target_cpu="ppc"
599 aros_object_format="elf32ppc"
600 aros_flavour="emulation"
601 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc -D__linux__"
602 aros_default_wbdepth=8
603 aros_compiler_libs="-lgcc"
607 AC_MSG_ERROR("Unknown CPU for Linux -- $target_cpu")
613 aros_target_arch="pc"
614 aros_shared_default="no"
615 case "$target_cpu" in
617 aros_target_cpu="i386"
619 dnl If somebody hasn't already set the target object
620 dnl format, then use this value. Mostly to support
621 dnl FreeBSD cross-compilation.
622 dnl TODO: Remove when we always use our compiler.
624 if test "$aros_object_format" = "" ; then
625 aros_object_format="elf_i386"
627 aros_flavour="standalone"
628 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
629 aros_kernel_ldflags=""
630 aros_default_wbwidth=640
631 aros_default_wbheight=480
632 gcc_target_cpu="i386"
635 AC_MSG_ERROR("Unknown native CPU -- $target_cpu")
641 aros_target_arch="prep"
642 aros_shared_default="no"
643 aros_target_cpu="ppc"
644 aros_object_format="elf32ppc"
645 aros_flavour="ppcnative"
646 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
647 aros_kernel_ldflags=""
648 aros_default_wbwidth=640
649 aros_default_wbheight=480
651 case "$target_cpu" in
653 aros_target_cc="ppc-linux-gcc -pipe"
654 aros_target_ld="ppc-linux-ld"
655 aros_target_as="ppc-linux-as"
656 aros_target_ar="ppc-linux-ar"
657 aros_target_ranlib="ppc-linux-ranlib"
658 aros_target_nm="ppc-linux-nm"
659 aros_target_strip="ppc-linux-strip"
660 aros_target_objcopy="ppc-linux-objcopy"
661 aros_target_objdump="ppc-linux-objdump"
662 aros_shared_ld="ppc-linux-ld"
663 aros_kernel_ld="ppc-linux-ld"
671 aros_target_arch="freebsd"
672 aros_target_cpu="i386"
673 aros_flavour="emulation"
674 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
675 gcc_target_cpu="i386"
681 aros_target_arch="netbsd"
682 case "$target_cpu" in
684 aros_target_cpu="m68k"
685 aros_object_format="m68kelf"
686 aros_flavour="emulcompat"
687 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D__mc68000 -D__NetBSD__"
688 gcc_target_cpu="mc68000"
691 aros_target_cpu="i386"
692 aros_object_format="elf_i386"
693 aros_flavour="emulation"
694 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__NetBSD__"
695 aros_default_wbdepth=8
696 gcc_target_cpu="i386"
699 AC_MSG_ERROR("Unknown CPU for NetBSD -- $target_cpu")
702 aros_target_genmap="-Wl,-M -Xlinker >"
703 aros_flavour="emulation"
704 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
708 aros_target_arch="openbsd"
709 case "$target_cpu" in
711 aros_target_cpu="i386"
712 aros_object_format="elf_i386"
713 aros_flavour="emulation"
714 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__OpenBSD__"
715 gcc_target_cpu="i386"
718 AC_MSG_ERROR("Unknown CPU for OpenBSD -- $target_cpu")
721 aros_target_genmap="-Wl,-M -Xlinker >"
722 aros_target_nm_flags="-u"
723 aros_flavour="emulation"
727 aros_target_arch="solaris"
728 case "$target_cpu" in
730 aros_target_cpu="sparc"
731 aros_object_format="elf_sparc"
732 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dsparc -D__Solaris__"
733 gcc_target_cpu="sparc"
736 AC_MSG_ERROR("Unknown CPU for Solaris -- $target_cpu")
739 aros_config_cflags="$aros_config_cflags -D$aros_target_cpu"
740 aros_flavour="emulation"
744 aros_target_arch="morphos"
745 aros_shared_default="no"
746 aros_target_cpu="ppc"
747 aros_object_format="elf_ppc"
748 aros_flavour="nativecompat"
749 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
754 aros_target_arch="amiga"
755 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D_AMIGA -DAMIGA"
756 aros_shared_default="no"
758 aros_config_cflags="$aros_config_cflags -fomit-frame-pointer -fbuiltin -ffreestanding"
760 case "$target_cpu" in
762 aros_target_cpu="m68k"
763 aros_object_format="m68kelf"
764 aros_flavour="nativecompat"
765 gcc_target_cpu="mc68000"
769 aros_flavour="native"
773 AC_MSG_ERROR("Unknown CPU for Amiga $target_cpu")
779 aros_target_arch="cygwin"
780 aros_shared_default="no"
781 case "$target_cpu" in
783 aros_target_cpu="i386"
784 aros_object_format="elf_i386"
785 aros_flavour="emulation"
786 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__CYGWIN32__"
787 aros_shared_cflags=""
788 aros_default_wbdepth=8
789 gcc_target_cpu="i386"
792 AC_MSG_ERROR("Unknown CPU for CygWin -- $target_cpu")
797 aros_target_arch="pp"
798 aros_shared_default="no"
799 case "$target_cpu" in
801 aros_target_cpu="m68k"
802 aros_object_format="m68kelf"
803 aros_flavour="palmnative"
804 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
805 aros_kernel_ldflags=""
806 aros_default_wbwidth=160
807 aros_default_wbheight=160
808 aros_default_wbdepth=1
809 aros_target_cc="m68k-elf-gcc -pipe"
810 aros_target_ld="$(which m68k-elf-ld)"
811 aros_target_as="m68k-elf-gcc -pipe"
812 aros_shared_ld="m68k-elf-gcc"
813 aros_kernel_ld="m68k-elf-gcc"
814 aros_target_ar="m68k-elf-ar"
815 aros_target_ar_flags="cru"
816 aros_target_ranlib="m68k-elf-ranlib"
817 aros_target_nm="m68k-elf-nm"
818 aros_target_objcopy="m68k-elf-objcopy"
819 aros_target_objdump="m68k-elf-objdump"
820 aros_compiler_libs="-lgcc1"
821 aros_shared_default=no
822 aros_shared_cflags="-fpic"
823 aros_shared_aflags=""
824 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
825 aros_kernel_ldflags="-Wl,-rpath,./lib"
826 aros_debug_cflags="-Wall -Werror-implicit-function-declaration $aros_symbols_debug $aros_messages_debug -mc68000 -Wa,-mc68000"
828 aros_debug_ldflags="$aros_symbols_debug"
829 aros_mungwall_debug="0"
830 aros_modules_debug="0"
831 gcc_target_cpu="mc68000"
832 ignore_undefined_symbols="-ius"
835 AC_MSG_ERROR("Unknown CPU for PalmPilot -- $target_cpu")
841 AC_MSG_ERROR([Unsupported target architecture $target])
845 aros_hostcfg_dir="bin/${aros_host_arch}-${aros_host_cpu}/gen/config"
846 aros_targetcfg_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/config"
847 aros_inc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/AROS/Development/include/aros"
848 aros_gendir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen"
849 aros_geninc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/include/aros"
850 aros_tools_dir="bin/${aros_host_arch}-${aros_host_cpu}/tools"
851 aros_scripts_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/scripts"
853 # aros_cc_pre is a variable that is added to the front of the compiler name
854 # in the generated aros-gcc shell script. We need this to enable the cache
855 # to work across cleaned builds. Also, support DISTCC using the correct
856 # environment variable.
859 if test "x${DISTCC}" != "x" ; then
860 if test "x${CCACHE}" != "x" ; then
861 aros_cc_pre="env CCACHE_PREFIX=${DISTCC} ${CCACHE} "
863 aros_cc_pre="${DISTCC} "
866 if test "x${CCACHE}" != "x" ; then
867 aros_cc_pre="${CCACHE} "
871 prefix="${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros"
873 TARGET_CC="${prefix}-gcc"
874 TARGET_AS="$TARGET_CC"
875 TARGET_LD="${prefix}-ld"
876 aros_target_ld="${prefix}-ld"
878 NOSTDINC_CFLAGS=-nostdinc
880 NOSTARTUP_LDFLAGS=-nostartfiles
882 DETACH_LDFLAGS=-detach
883 NOSTDLIB_LDFLAGS=-nostdlib
885 AROS_TOOL_CC(SHARED_LD,$aros_shared_ld)
886 AROS_TOOL_CC(KERNEL_LD,$aros_kernel_ld)
889 aros_target_ar=${prefix}-ar
890 aros_target_ar_flags="cr"
891 aros_target_nm=${prefix}-nm
892 aros_target_nm_flags="-C -ul"
893 aros_target_objcopy=${prefix}-objcopy
894 aros_target_objdump=${prefix}-objdump
895 aros_target_ranlib=${prefix}-ranlib
896 aros_target_strip="${prefix}-strip --strip-unneeded -R.comment"
898 prefix="\$(TOOLDIR)/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros"
899 AR="${prefix}-ar $aros_target_ar_flags"
900 RANLIB="${prefix}-ranlib $aros_target_ranlib_flags"
901 NM="${prefix}-nm $aros_target_nm_flags"
902 NM_PLAIN="${prefix}-nm"
903 STRIP="${prefix}-strip $aros_target_strip_flags"
904 OBJDUMP="${prefix}-objdump"
905 OBJCOPY="${prefix}-objcopy"
910 AC_SUBST(NOSTDINC_CFLAGS)
911 AC_SUBST(NOSTARTUP_LDFLAGS)
912 AC_SUBST(NIX_LDFLAGS)
913 AC_SUBST(DETACH_LDFLAGS)
914 AC_SUBST(NOSTDLIB_LDFLAGS)
915 AC_SUBST(aros_cc_pre)
924 #-----------------------------------------------------------------------------
925 # See if we can compile SHM support
927 if [[ "x$no_x" != "xyes" -a "x$ac_cv_header_sys_ipc_h" = "xyes" -a "x$ac_cv_header_sys_shm_h" = "xyes" ]]; then
928 AC_MSG_CHECKING(whether the X11 MIT-SHM extension can be compiled in)
929 if test -z "$x_includes" ; then
932 CFLAGS="-I $x_includes"
934 LIBS="-L/usr/X11/lib -L/usr/X11R6/lib -lX11 -lXext"
936 #include <sys/types.h>
937 #include <X11/Xlib.h>
938 #include <X11/Xutil.h>
939 #include <X11/keysym.h>
940 #include <X11/cursorfont.h>
943 #include <X11/extensions/XShm.h>],[
944 static XShmSegmentInfo shminfo;
945 static Display *display;
946 XShmAttach(display, &shminfo);
948 shmctl(shminfo.shmid, IPC_RMID, 0);
957 # Find the system include path. We can suggest that an alternative is
958 # used if we don't get it correct. The default is to use /usr/include.
959 # Which is set in the aros_target_incl_def variable.
961 AC_ARG_ENABLE(includes,
962 [ --enable-includes=dir Alternative system include directory],
963 [aros_target_incl=$enable_includes], [aros_target_incl=$aros_target_incl_def])
965 dnl find out about the target cc's include path
966 AC_MSG_CHECKING([for the target compiler's include path])
967 if test "$aros_target_cc_includes" = "" ; then
968 #try to guess where the directory is
969 aros_target_cc_includes=`dirname \`${aros_target_cc} -print-libgcc-file-name\``/include
970 if ! test -d $aros_target_cc_includes; then
971 #the directory doesn't exist, we need to do some more work
972 aros_target_cc_includes=${PWD}/${aros_gendir}/cc_include
974 #these are the headers we're looling for
975 headers="limits.h mmintrin.h stdbool.h syslimits.h float.h \
976 stddef.h xmmintrin.h iso646.h stdarg.h unwind.h \
980 for h in $headers; do
981 #which other headers each of the above headers needs?
982 deps=$(echo "#include <$h>" | \
983 $aros_host_cc -E -M - 2>/dev/null | \
984 sed 's/^.*://; s/\\$/ /g; s/[[ \t]]\+/ /g')
986 #copy all the needed headers to a directory beneath gendir
989 dir=${aros_target_cc_includes}$(echo $(dirname $d) | \
990 sed -n "s,^.*/include\(/.*\),\1,p")
991 ! test -d $dir && mkdir -p $dir
992 ! test -f $dir/$h && { cp $d $dir; chmod u+w $dir/$h; }
997 AC_MSG_RESULT($aros_target_cc_includes)
999 dnl Check if user specified --with-resolution=XRESxYRESxDEPTH
1000 AC_MSG_CHECKING([for default resolution of WBScreen])
1001 AC_ARG_WITH(resolution,[ --with-resolution=XRESxYRESxDEPTH Default resolution of the initial WorkbenchScreen],resolution=$withval,resolution=none)
1002 # We require an argument, so map --with/--without ("yes"/"no") to "none" specified
1003 if test "$resolution" = "yes" ; then
1006 if test "$resolution" = "no" ; then
1009 if test "$resolution" != "none" ; then
1010 aros_default_wbwidth=`echo $resolution | cut -d'x' -f1`
1011 aros_default_wbheight=`echo $resolution | cut -d'x' -f2`
1012 aros_default_wbdepth=`echo $resolution | cut -d'x' -f3`
1014 AC_MSG_RESULT($aros_default_wbwidth x $aros_default_wbheight x $aros_default_wbdepth)
1015 aros_cv_default_wbwidth=$aros_default_wbwidth
1016 aros_cv_default_wbheight=$aros_default_wbheight
1017 aros_cv_default_wbdepth=$aros_default_wbdepth
1019 dnl See if the user wants the BOCHS hack for native flavour
1020 AC_MSG_CHECKING([if bochs hack is enabled])
1021 AC_ARG_ENABLE(bochs_hack,[ --enable-bochs-hack Enable hacks to make BOCHS (partly) work (default=no)],bochs_hack="yes",bochs_hack="no")
1022 if test "$bochs_hack" = "yes" ; then
1025 AC_MSG_RESULT($bochs_hack)
1027 dnl See if the user wants the serial debug output for native flavour
1028 AC_MSG_CHECKING([if serial debug is enabled])
1029 AC_ARG_WITH(serial-debug,[ --with-serial-debug Enable serial debug output in native (default=no)],serial_debug=$withval,serial_debug=none)
1030 if test "$serial_debug" = "yes" ; then
1033 if test "$serial_debug" = "no" ; then
1036 if test "$serial_debug" != "none" ; then
1037 aros_serial_debug=$serial_debug
1038 AC_MSG_RESULT(on port $serial_debug)
1043 dnl See if the user wants the palm debug output hack for palm native flavour
1044 AC_MSG_CHECKING([if palm debug hack is enabled])
1045 AC_ARG_ENABLE(palm_debug_hack,[ --enable-palm-debug-hack Enable palm debug output hack in palm native (default=no)],palm_debug_hack="yes",palm_debug_hack="no")
1046 if test "$palm_debug_hack" = "yes" ; then
1047 aros_palm_debug_hack="1"
1049 AC_MSG_RESULT($palm_debug_hack)
1052 dnl See if the user wants nesting supervisor activated for unix flavour
1053 AC_MSG_CHECKING([if nesting supervisor support is enabled])
1054 AC_ARG_ENABLE(nesting_supervisor,[ --enable-nesting-supervisor Enable nesting supervisor support in unix (default=no)],nesting_supervisor="yes",nesting_supervisor="no")
1055 if test "$nesting_supervisor" = "yes" ; then
1056 aros_nesting_supervisor="1"
1058 AC_MSG_RESULT($nesting_supervisor)
1062 if test "$HAVE_XSHM_SUPPORT" = "1" ; then
1063 dnl See if the user wants the X11 MIT-SHM extension to be enabled
1064 AC_MSG_CHECKING([if X11 MIT-SHM extension is enabled])
1065 AC_ARG_ENABLE(xshm_extension,[ --enable-xshm-extension Enable X11 MIT-SHM extension [default=yes]],xshm_extension="$enableval",xshm_extension="yes")
1066 if test "$xshm_extension" = "no" ; then
1069 AC_MSG_RESULT($xshm_extension)
1076 dnl See if the user wants dbus.library
1077 AC_MSG_CHECKING([if building of dbus.library is enabled])
1078 AC_ARG_ENABLE(dbus,[ --enable-dbus Enable DBUS support via dbus.library (default=no)],dbus="yes",dbus="no")
1079 if test "$dbus" = "yes" ; then
1081 DBUS_CFLAGS=`pkg-config --cflags dbus-1`
1082 DBUS_LIBFLAGS=`pkg-config --libs dbus-1`
1083 KERNEL_DBUS_KOBJ=kernel-dbus-kobj
1084 KERNEL_DBUS_INCLUDES=kernel-dbus-includes
1088 AC_MSG_RESULT($dbus)
1091 dnl --------------------------------------------------------------------
1092 dnl Configuration Output Section
1093 dnl --------------------------------------------------------------------
1098 AC_SUBST(aros_flavour)
1099 AC_SUBST(aros_flavour_uc)
1103 AC_SUBST(aros_host_arch)
1104 AC_SUBST(aros_host_cpu)
1105 AC_SUBST(aros_host_cc)
1106 AC_SUBST(aros_host_ld)
1107 AC_SUBST(aros_host_make)
1108 AC_SUBST(aros_host_cflags)
1109 AC_SUBST(aros_host_ldflags)
1110 AC_SUBST(aros_host_debug)
1111 AC_SUBST(aros_host_mkdep)
1112 AC_SUBST(aros_host_mkargs)
1113 AC_SUBST(aros_host_exe_suffix)
1114 AC_SUBST(aros_host_lib_suffix)
1115 AC_SUBST(aros_tools_dir)
1116 AC_SUBST(aros_host_aclocal)
1117 AC_SUBST(aros_host_autoconf)
1118 AC_SUBST(aros_host_autoheader)
1119 AC_SUBST(aros_host_automake)
1122 AC_SUBST(aros_target_arch)
1123 AC_SUBST(aros_target_cpu)
1124 AC_SUBST(aros_target_variant)
1125 AC_SUBST(aros_target_suffix)
1126 AC_SUBST(aros_target_incl)
1127 AC_SUBST(aros_target_cc)
1128 AC_SUBST(aros_target_cc_includes)
1129 AC_SUBST(aros_target_cc_path)
1130 AC_SUBST(aros_target_objdump)
1131 AC_SUBST(aros_target_objcopy)
1132 AC_SUBST(aros_target_strip)
1133 AC_SUBST(aros_target_as)
1134 AC_SUBST(aros_target_nm)
1135 AC_SUBST(aros_shared_default)
1136 AC_SUBST(aros_object_format)
1137 AC_SUBST(aros_compiler_libs)
1139 AC_SUBST(aros_config_cflags)
1140 AC_SUBST(aros_config_aflags)
1141 AC_SUBST(aros_target_ld)
1142 AC_SUBST(aros_config_ldflags)
1144 AC_SUBST(aros_shared_cflags)
1145 AC_SUBST(aros_shared_aflags)
1146 AC_SUBST(aros_shared_ldflags)
1147 AC_SUBST(aros_kernel_ldflags)
1148 AC_SUBST(aros_debug_cflags)
1149 AC_SUBST(aros_debug_aflags)
1150 AC_SUBST(aros_debug_ldflags)
1151 AC_SUBST(aros_target_genmap)
1154 AC_SUBST(aros_gui_libdir)
1155 AC_SUBST(aros_gui_ldflags)
1156 AC_SUBST(aros_gui_libflags)
1157 AC_SUBST(aros_gui_incdir)
1158 AC_SUBST(aros_gui_ccflags)
1160 AC_SUBST(aros_default_wbwidth)
1161 AC_SUBST(aros_default_wbheight)
1162 AC_SUBST(aros_default_wbdepth)
1163 AC_SUBST(DO_XSHM_SUPPORT)
1165 # Native version related
1166 AC_SUBST(aros_bochs_hack)
1167 AC_SUBST(aros_serial_debug)
1169 # Palm native version related
1170 AC_SUBST(aros_palm_debug_hack)
1172 # Unix/Hosted version related
1173 AC_SUBST(aros_nesting_supervisor)
1176 AC_SUBST(ENABLE_DBUS)
1177 AC_SUBST(DBUS_CFLAGS)
1178 AC_SUBST(DBUS_LIBFLAGS)
1179 AC_SUBST(KERNEL_DBUS_KOBJ)
1180 AC_SUBST(KERNEL_DBUS_INCLUDES)
1183 AC_SUBST(aros_debug)
1184 AC_SUBST(aros_mungwall_debug)
1185 AC_SUBST(aros_stack_debug)
1186 AC_SUBST(aros_modules_debug)
1188 # Collect-aros stuff: "-ius" to ignore undefined symbols
1189 AC_SUBST(ignore_undefined_symbols)
1191 # C compiler related
1192 AC_SUBST(gcc_target_cpu)
1194 dnl Prepare for output, make up all the generated patches
1195 case "$aros_flavour" in
1196 emulation) aros_flavour_uc="AROS_FLAVOUR_EMULATION"
1197 aros_flavour="emulation" ;;
1198 emulcompat) aros_flavour_uc="(AROS_FLAVOUR_EMULATION|AROS_FLAVOUR_BINCOMPAT)"
1199 aros_flavour="emulation" ;;
1200 standalone) aros_flavour_uc="AROS_FLAVOUR_STANDALONE"
1201 aros_flavour="standalone";;
1202 native) aros_flavour_uc="AROS_FLAVOUR_NATIVE"
1203 aros_flavour="native" ;;
1204 nativecompat) aros_flavour_uc="(AROS_FLAVOUR_NATIVE|AROS_FLAVOUR_BINCOMPAT)"
1205 aros_flavour="native" ;;
1206 linklib) aros_flavour_uc="AROS_FLAVOUR_LINKLIB"
1207 aros_flavour="linklib" ;;
1208 palmnative) aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
1209 aros_flavour="palmnative" ;;
1210 ppcnative) aros_flavour_uc="(AROS_FLAVOUR_NATIVE|AROS_FLAVOUR_BINCOMPAT)"
1211 aros_flavour="ppcnative" ;;
1214 if test -z "$aros_gui_basedir" ; then
1215 dnl Use X as the default GUI
1216 aros_gui_libdir="$x_libraries"
1217 if test -z "$x_libraries" ; then
1220 aros_gui_ldflags="-L $x_libraries"
1222 if test "$HAVE_XSHM_SUPPORT" = "1" ; then
1223 aros_gui_libflags="-lX11 -lXext"
1225 aros_gui_libflags="-lX11"
1227 aros_gui_incdir="$x_includes"
1228 if test -z "$x_includes" ; then
1231 aros_gui_ccflags="-I $x_includes"
1234 if test -n "$aros_gui_basedir" ; then
1235 aros_gui_libdir="${aros_gui_basedir}/lib"
1236 aros_gui_incdir="${aros_gui_basedir}/include"
1239 if test -n "$aros_gui_libdir" ; then
1240 aros_gui_ldflags="-L ${aros_gui_libdir}"
1243 if test -n "$aros_gui_incdir" ; then
1244 aros_gui_ccflags="-I ${aros_gui_incdir}"
1246 aros_gui_incdir="${aros_sysincludes}"
1251 if test ! -d ${aros_inc_dir} ; then
1252 ${MKDIR} ${aros_inc_dir}
1254 if test ! -d ${aros_geninc_dir} ; then
1255 ${MKDIR} ${aros_geninc_dir}
1257 if test ! -d ${aros_hostcfg_dir} ; then
1258 ${MKDIR} ${aros_hostcfg_dir}
1260 if test ! -d ${aros_targetcfg_dir} ; then
1261 ${MKDIR} ${aros_targetcfg_dir}
1263 if test ! -d ${aros_tools_dir} ; then
1264 ${MKDIR} ${aros_tools_dir}
1266 if test ! -d ${aros_scripts_dir} ; then
1267 ${MKDIR} ${aros_scripts_dir}
1270 AC_CONFIG_HEADERS(${aros_geninc_dir}/host-conf.h:config/host-conf.h.in)
1272 AC_CONFIG_COMMANDS([compiler_executable],
1274 prefix=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}
1276 prefix="${prefix}/${aros_target_cpu}-aros"
1277 prefix2=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros
1281 chmod a+x ${prefix2}-gcc ${prefix2}-ld
1283 ln -sf ${prefix2}-gcc ${prefix}-gcc
1284 ln -sf ${prefix2}-ld ${prefix}-ld
1286 ln -sf $aros_target_nm_ln ${prefix}-nm
1287 ln -sf $aros_target_ar_ln ${prefix}-ar
1288 ln -sf $aros_target_ranlib_ln ${prefix}-ranlib
1289 ln -sf $aros_target_objcopy_ln ${prefix}-objcopy
1290 ln -sf $aros_target_objdump_ln ${prefix}-objdump
1291 ln -sf $aros_target_strip_ln ${prefix}-strip
1293 ln -sf $aros_target_nm_ln ${prefix2}-nm
1294 ln -sf $aros_target_ar_ln ${prefix2}-ar
1295 ln -sf $aros_target_ranlib_ln ${prefix2}-ranlib
1296 ln -sf $aros_target_objcopy_ln ${prefix2}-objcopy
1297 ln -sf $aros_target_objdump_ln ${prefix2}-objdump
1298 ln -sf $aros_target_strip_ln ${prefix2}-strip
1301 aros_tools_dir=${aros_tools_dir}
1302 aros_target_cpu=${aros_target_cpu}
1303 aros_target_arch=${aros_target_arch}
1304 aros_target_suffix=${aros_target_suffix}
1305 aros_target_nm_ln=${aros_target_nm_ln}
1306 aros_target_ar_ln=${aros_target_ar_ln}
1307 aros_target_ranlib_ln=${aros_target_ranlib_ln}
1308 aros_target_objdump_ln=${aros_target_objdump_ln}
1309 aros_target_objcopy_ln=${aros_target_objcopy_ln}
1310 aros_target_strip_ln=${aros_target_strip_ln}
1313 AC_CONFIG_COMMANDS([genshared_executable],
1314 [chmod a+x ${aros_scripts_dir}/genshared],
1315 [aros_scripts_dir=${aros_scripts_dir}]
1317 AC_CONFIG_COMMANDS([genmf_executable],
1318 [chmod a+x ${aros_tools_dir}/genmf.py],
1319 [aros_tools_dir=${aros_tools_dir}]
1321 AC_CONFIG_COMMANDS([adflib_myaros.conf_executable],
1322 [chmod a+x tools/adflib/myconf.aros]
1328 ${aros_inc_dir}/config.h:config/config.h.in
1329 ${aros_geninc_dir}/config.h:config/config.h.in
1330 ${aros_hostcfg_dir}/host.cfg:config/host.cfg.in
1331 ${aros_targetcfg_dir}/target.cfg:config/target.cfg.in
1333 ${aros_targetcfg_dir}/make.defaults:config/make.defaults.in
1334 ${aros_targetcfg_dir}/specs:config/specs.in
1335 ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-gcc:scripts/aros-gcc.in
1336 ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-ld:scripts/aros-ld.in
1337 ${aros_scripts_dir}/genshared:compiler/c_lib/source/lib_source/genshared.in
1338 ${aros_tools_dir}/genmf.py:tools/genmf/genmf.py
1339 tools/adflib/myconf.aros
1344 dnl This is in order to not defined SHARED_CFLAGS sometimes
1345 dnl We don't always do aros_shared_ar, aros_shared_cflags
1347 #XXX compatability...
1348 aros_shared_ar="$aros_shared_ld $aros_shared_ldflags -o"
1350 if test -n "$aros_shared_cflags" ; then
1351 echo "SHARED_CFLAGS := $aros_shared_cflags" >> ${aros_hostcfg_dir}/host.cfg
1352 echo "SHARED_AR := $aros_shared_ar" >> ${aros_hostcfg_dir}/host.cfg