1 dnl Copyright (C) 1997-2003 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=""
105 aros_host_cc_pipe="-pipe"
115 dnl Despite the name, this is really a host configuration variable.
116 aros_target_cc_includes=""
118 # This is the main host configuration section. It is where the host
119 # can change the values of any variables it needs to change. We do
120 # not look at anything that compiles to the target yet, we'll get
125 aros_host_arch="linux"
126 aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
138 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
139 aros_host_cpu="$host_cpu"
145 aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
146 aros_host_make="gmake"
147 aros_host_arch="freebsd"
150 dnl Need to override this here, it's just too hard later.
151 dnl This shouldn't be here at all...
152 aros_target_cc_includes="/usr/include"
154 dnl FreeBSD 5.x has changed the default object format.
157 aros_object_format="elf_i386_fbsd"
161 aros_object_format="elf_i386"
167 aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
168 aros_host_make="gmake"
169 aros_host_arch="netbsd"
178 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
179 aros_host_cpu="$host_cpu"
182 aros_host_lib_suffix=".0.0"
186 aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
187 aros_host_make="gmake"
188 aros_host_arch="openbsd"
194 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
195 aros_host_cpu="$host_cpu"
201 aros_host_arch="solaris"
202 aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
205 aros_host_cpu="sparc"
208 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
209 aros_host_cpu="$host_cpu"
215 aros_host_cc="$aros_host_cc"
216 aros_host_arch="morphos"
221 aros_host_arch="amiga"
226 TOUCH="/gg/bin/touch"
235 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
236 aros_host_cpu="$host_cpu"
242 aros_host_arch="cygwin"
243 aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
249 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
250 aros_host_cpu="$host_cpu"
255 AC_MSG_ERROR([Unsupported host architecture $host])
259 AROS_PROG(HOST_AR,[ar],[cr])
260 AROS_REQUIRED(ar,$HOST_AR)
261 AROS_PROG(HOST_RANLIB,ranlib)
263 AROS_PROG(RM,[rm],[-rf])
264 AROS_REQUIRED(rm,$RM)
266 AROS_REQUIRED(cp,$CP)
268 AROS_REQUIRED(mv,$MV)
269 AROS_PROG(ECHO,[echo])
270 AROS_REQUIRED(echo,$ECHO)
271 AROS_PROG(MKDIR,[mkdir],[-p])
272 AROS_REQUIRED(mkdir,$MKDIR)
273 AROS_PROG(TOUCH,[touch])
274 AROS_REQUIRED(touch,$TOUCH)
275 AROS_PROG(SORT,[sort])
276 AROS_REQUIRED(sort,$SORT)
277 AROS_PROG(UNIQ,[uniq])
278 AROS_REQUIRED(uniq,$UNIQ)
279 AROS_PROG(NOP,[true])
280 AROS_REQUIRED(true,$NOP)
282 AROS_REQUIRED(cat,$CAT)
283 AROS_PROG(BISON,[bison])
284 AROS_REQUIRED(bison,$BISON)
285 AROS_PROG(PNGTOPNM,[pngtopnm])
286 AROS_REQUIRED(pngtopnm,$PNGTOPNM)
287 AROS_PROG(PPMTOILBM,[ppmtoilbm])
288 AROS_REQUIRED(ppmtoilbm,$PPMTOILBM)
289 AROS_PROG(STRIP,[strip])
290 AROS_REQUIRED(strip,$STRIP)
292 AROS_REQUIRED(sed,$SED)
293 AROS_PROG(CHMOD,[chmod])
294 AROS_REQUIRED(chmod,$CHMOD)
296 AM_PATH_PYTHON(2.2.1)
305 dnl ---------------------------------------------------------------------------
306 dnl Look for things about the host system, good for hosted targets.
307 dnl ---------------------------------------------------------------------------
309 # Check for some includes for the X11 HIDD and the kernel
310 AC_CHECK_HEADERS([sys/ipc.h sys/shm.h \
311 sys/mmap.h sys/mman.h sysexits.h \
312 sys/statfs.h sys/statvfs.h sys/vfs.h sys/param.h \
315 AC_CHECK_HEADERS([sys/mount.h],,,[#include <sys/param.h>])
332 AC_CHECK_MEMBERS(struct tm.tm_gmtoff)
334 # Look for some functions
335 AC_CHECK_FUNCS([getpagesize kqueue statfs statvfs \
336 clone kse_create rfork_thread thr_create sa_register \
337 getcontext makecontext setcontext sigaltstack swapcontext])
345 dnl --------------------------------------------------------------------
346 dnl Target Configuration Section
347 dnl --------------------------------------------------------------------
349 dnl The target configuration section is responsible for setting up all
350 dnl the paths for includes, and tools required to build AROS to some
351 dnl particular target.
353 # Find all the tools we need to compile. This could be cross-compiling
354 # though! If that is the case we use the GNU form of the target and
355 # simply add this to the front of the binary name. This is rather simple,
356 # but it should work under most circumstances.
358 # The default tools are to use the same as the host, but only if the
359 # host and target CPU are the same. With GCC this is normally enough.
363 aros_target_cc="$aros_host_cc"
364 aros_target_as="$aros_host_cc"
365 aros_shared_ld="$aros_host_ld"
366 aros_kernel_ld="$aros_host_ld"
367 aros_target_ld="$aros_host_ld"
369 aros_target_mkdep="$aros_host_mkdep"
370 aros_target_incl_def="$aros_host_incl"
372 # The default tools executables to be linked at.
373 AROS_TOOL_CCPATH(aros_target_ar_ln,ar)
374 AROS_REQUIRED(ar,$aros_target_ar_ln)
375 AROS_TOOL_CCPATH(aros_target_nm_ln,nm)
376 AROS_REQUIRED(nm,$aros_target_nm_ln)
377 AROS_TOOL_CCPATH(aros_target_objcopy_ln,objcopy)
378 AROS_REQUIRED(objcopy,$aros_target_objcopy_ln)
379 AROS_TOOL_CCPATH(aros_target_objdump_ln,objdump)
380 AROS_REQUIRED(objdump,$aros_target_objdump_ln)
381 AROS_TOOL_CCPATH(aros_target_ranlib_ln,ranlib)
382 AROS_REQUIRED(ranlib,$aros_target_ranlib_ln)
383 AROS_TOOL_CCPATH(aros_target_strip_ln,strip)
384 AROS_REQUIRED(strip,$aros_target_strip_ln)
386 if test "$GCC" = "yes"; then
387 aros_target_cc_path=`$CC -print-search-dirs | grep "programs: =" | cut -c 12-`
390 # It is necessary to clear the include and link paths for target
391 # commands. This should help clear up problems when cross compiling.
392 aros_config_cflags="-Wall -Werror-implicit-function-declaration"
393 aros_config_aflags="-Wall -x assembler-with-cpp"
394 aros_config_ldflags=""
396 aros_shared_default=yes
398 aros_shared_cflags="-fPIC"
399 aros_shared_aflags=""
400 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
401 aros_kernel_ldflags="-Wl,-rpath,./lib"
405 aros_target_genmap="-Wl,-Map -Xlinker"
407 # Native flavour stuff
409 aros_serial_debug="0"
411 # Palm native flavour stuff
412 aros_palm_debug_hack="0"
415 aros_nesting_supervisor="0"
417 # Collect-aros stuff: "-ius" to ignore undefined symbols
418 ignore_undefined_symbols=""
424 #-----------------------------------------------------------------------------
426 AC_MSG_CHECKING([for type of build])
427 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")
429 if test "$build_type" = "nightly"; then
430 build_type_string="NIGHTLY"
431 elif test "$build_type" = "snapshot"; then
432 build_type_string="SNAPSHOT"
433 elif test "$build_type" = "milestone"; then
434 build_type_string="MILESTONE"
435 elif test "$build_type" = "release"; then
436 build_type_string="RELEASE"
438 build_type_string="PERSONAL"
439 build_type="personal"
442 aros_config_cflags="$aros_config_cflags -DAROS_BUILD_TYPE=AROS_BUILD_TYPE_$build_type_string"
444 AC_MSG_RESULT($build_type)
446 #-----------------------------------------------------------------------------
447 all_debug_types="messages stack mungwall modules symbols"
449 AC_MSG_CHECKING([which debug types to enable])
450 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)]),
451 debug="$enableval",debug="")
453 if test "$debug" = "" -o "$debug" = "no"; then
455 elif test "$debug" = "yes"; then
459 if test "$debug" = "all" ; then
460 debug=$all_debug_types
461 for d in $all_debug_types; do
462 export aros_${d}_debug="1"
465 for d in $all_debug_types; do
466 export aros_${d}_debug="0"
470 if test "$debug" != "none"; then
471 debug=`echo $debug | sed s/,/\ /g`
474 for d2 in $all_debug_types; do
475 if test "$d2" = "$d"; then
480 if test "$found" = "0"; then
481 AC_MSG_ERROR([unrecognized debug type "$d". Available types are: all none $all_debug_types])
483 export aros_${d}_debug="1"
487 AC_MSG_RESULT($debug)
489 if test "$aros_messages_debug" = "1"; then
490 aros_messages_debug="-DADEBUG=1 -DMDEBUG=1"
492 aros_messages_debug=""
494 if test "$aros_symbols_debug" = "1"; then
495 aros_symbols_debug="-g"
497 aros_symbols_debug=""
500 # These are the flags to pass when compiling debugged programs
501 aros_debug_cflags="$aros_symbols_debug $aros_messages_debug"
503 aros_debug_ldflags="$aros_symbols_debug"
505 #-----------------------------------------------------------------------------
506 # Checking for distcc and ccache.
508 # Always apply the transforms in this particular order. Basically you should
509 # always run 'ccache distcc compiler' in that order for the best performance.
511 AC_MSG_CHECKING([whether to enable distcc])
512 AC_ARG_ENABLE(distcc,AC_HELP_STRING([--enable-distcc],[Use distcc as a front end to the compiler (default=no).]),distcc="$enableval",distcc="no")
513 if test "$distcc" != "" -a "$distcc" != "no"; then
514 # AC_CHECK_PROG will print out the result in this case
515 AC_PATH_PROG(DISTCC,[distcc],distcc,no)
520 AC_MSG_CHECKING([whether to enable ccache])
521 AC_ARG_ENABLE(ccache,AC_HELP_STRING([--enable-ccache],[Use ccache as a front end to the compiler (default=no).]),ccache="$enableval",ccache="no")
522 if test "$ccache" != "" -a "$ccache" != "no"; then
523 # AC_CHECK_PROG will print out the result in this case
524 AC_CHECK_PROG(CCACHE,[ccache],ccache,no)
529 #-----------------------------------------------------------------------------
530 AC_MSG_CHECKING([what optimization flags to use])
531 AC_ARG_WITH(optimization,AC_HELP_STRING([--with-optimization=FLAGS],[Use optimization flags FLAGS (default=-O2).]),optimization="$withval",optimization="unknown")
532 if test "$optimization" = "unknown"; then
533 dnl default is -O2 for normal builds, -O0 for debug builds
534 if test "$debug" != "none"; then
540 aros_config_cflags="$aros_config_cflags $optimization"
541 AC_MSG_RESULT($optimization)
543 #-----------------------------------------------------------------------------
544 AC_MSG_CHECKING([what target variant to enable])
545 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")
546 if test "$target_variant" = "none"; then
547 aros_target_variant=""
548 aros_target_suffix=""
550 aros_target_variant="$target_variant"
551 aros_target_suffix="-$target_variant"
553 AC_MSG_RESULT($enableval)
555 #-----------------------------------------------------------------------------
556 # This is the target configuration switch.
559 aros_target_arch="linux"
560 case "$target_cpu" in
562 aros_target_cpu="m68k"
563 aros_object_format="m68kelf"
564 aros_flavour="emulcompat"
565 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D__mc68000 -D__linux__"
566 aros_shared_ldflags="-Wl,-T,\$(TOP)/config/linux/m68k/script.so"
567 aros_kernel_ldflags="-Wl,-rpath,./lib,-T,\$(TOP)/config/linux/m68k/script.normal"
568 gcc_target_cpu="mc68000"
571 aros_target_cpu="i386"
572 aros_object_format="elf_i386"
573 aros_flavour="emulation"
574 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__linux__"
575 aros_default_wbdepth=8
576 gcc_target_cpu="i386"
579 aros_target_cpu="ppc"
580 aros_object_format="elf32ppc"
581 aros_flavour="emulation"
582 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc -D__linux__"
583 aros_default_wbdepth=8
584 aros_compiler_libs="-lgcc"
588 AC_MSG_ERROR("Unknown CPU for Linux -- $target_cpu")
594 aros_target_arch="pc"
595 aros_shared_default="no"
596 case "$target_cpu" in
598 aros_target_cpu="i386"
600 dnl If somebody hasn't already set the target object
601 dnl format, then use this value. Mostly to support
602 dnl FreeBSD cross-compilation.
603 dnl TODO: Remove when we always use our compiler.
605 if test "$aros_object_format" = "" ; then
606 aros_object_format="elf_i386"
608 aros_flavour="standalone"
609 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
610 aros_kernel_ldflags=""
611 aros_default_wbwidth=640
612 aros_default_wbheight=480
613 gcc_target_cpu="i386"
616 AC_MSG_ERROR("Unknown native CPU -- $target_cpu")
622 aros_target_arch="prep"
623 aros_shared_default="no"
624 aros_target_cpu="ppc"
625 aros_object_format="elf32ppc"
626 aros_flavour="ppcnative"
627 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
628 aros_kernel_ldflags=""
629 aros_default_wbwidth=640
630 aros_default_wbheight=480
632 case "$target_cpu" in
634 aros_target_cc="ppc-linux-gcc -pipe"
635 aros_target_ld="ppc-linux-ld"
636 aros_target_as="ppc-linux-as"
637 aros_target_ar="ppc-linux-ar"
638 aros_target_ranlib="ppc-linux-ranlib"
639 aros_target_nm="ppc-linux-nm"
640 aros_target_strip="ppc-linux-strip"
641 aros_target_objcopy="ppc-linux-objcopy"
642 aros_target_objdump="ppc-linux-objdump"
643 aros_shared_ld="ppc-linux-ld"
644 aros_kernel_ld="ppc-linux-ld"
652 aros_target_arch="freebsd"
653 aros_target_cpu="i386"
654 aros_flavour="emulation"
655 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
656 gcc_target_cpu="i386"
662 aros_target_arch="netbsd"
663 case "$target_cpu" in
665 aros_target_cpu="m68k"
666 aros_object_format="m68kelf"
667 aros_flavour="emulcompat"
668 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D__mc68000 -D__NetBSD__"
669 gcc_target_cpu="mc68000"
672 aros_target_cpu="i386"
673 aros_object_format="elf_i386"
674 aros_flavour="emulation"
675 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__NetBSD__"
676 aros_default_wbdepth=8
677 gcc_target_cpu="i386"
680 AC_MSG_ERROR("Unknown CPU for NetBSD -- $target_cpu")
683 aros_target_genmap="-Wl,-M -Xlinker >"
684 aros_flavour="emulation"
685 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
689 aros_target_arch="openbsd"
690 case "$target_cpu" in
692 aros_target_cpu="i386"
693 aros_object_format="elf_i386"
694 aros_flavour="emulation"
695 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__OpenBSD__"
696 gcc_target_cpu="i386"
699 AC_MSG_ERROR("Unknown CPU for OpenBSD -- $target_cpu")
702 aros_target_genmap="-Wl,-M -Xlinker >"
703 aros_target_nm_flags="-u"
704 aros_flavour="emulation"
708 aros_target_arch="solaris"
709 case "$target_cpu" in
711 aros_target_cpu="sparc"
712 aros_object_format="elf_sparc"
713 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dsparc -D__Solaris__"
714 gcc_target_cpu="sparc"
717 AC_MSG_ERROR("Unknown CPU for Solaris -- $target_cpu")
720 aros_config_cflags="$aros_config_cflags -D$aros_target_cpu"
721 aros_flavour="emulation"
725 aros_target_arch="morphos"
726 aros_shared_default="no"
727 aros_target_cpu="ppc"
728 aros_object_format="elf_ppc"
729 aros_flavour="nativecompat"
730 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
735 aros_target_arch="amiga"
736 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D_AMIGA -DAMIGA"
737 aros_shared_default="no"
739 aros_config_cflags="$aros_config_cflags -fomit-frame-pointer -fbuiltin -ffreestanding"
741 case "$target_cpu" in
743 aros_target_cpu="m68k"
744 aros_object_format="m68kelf"
745 aros_flavour="nativecompat"
746 gcc_target_cpu="mc68000"
750 aros_flavour="native"
754 AC_MSG_ERROR("Unknown CPU for Amiga $target_cpu")
760 aros_target_arch="cygwin"
761 aros_shared_default="no"
762 case "$target_cpu" in
764 aros_target_cpu="i386"
765 aros_object_format="elf_i386"
766 aros_flavour="emulation"
767 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__CYGWIN32__"
768 aros_shared_cflags=""
769 aros_default_wbdepth=8
770 gcc_target_cpu="i386"
773 AC_MSG_ERROR("Unknown CPU for CygWin -- $target_cpu")
778 aros_target_arch="pp"
779 aros_shared_default="no"
780 case "$target_cpu" in
782 aros_target_cpu="m68k"
783 aros_object_format="m68kelf"
784 aros_flavour="palmnative"
785 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
786 aros_kernel_ldflags=""
787 aros_default_wbwidth=160
788 aros_default_wbheight=160
789 aros_default_wbdepth=1
790 aros_target_cc="m68k-elf-gcc -pipe"
791 aros_target_ld="$(which m68k-elf-ld)"
792 aros_target_as="m68k-elf-gcc -pipe"
793 aros_shared_ld="m68k-elf-gcc"
794 aros_kernel_ld="m68k-elf-gcc"
795 aros_target_ar="m68k-elf-ar"
796 aros_target_ar_flags="cru"
797 aros_target_ranlib="m68k-elf-ranlib"
798 aros_target_nm="m68k-elf-nm"
799 aros_target_objcopy="m68k-elf-objcopy"
800 aros_target_objdump="m68k-elf-objdump"
801 aros_compiler_libs="-lgcc1"
802 aros_shared_default=no
803 aros_shared_cflags="-fpic"
804 aros_shared_aflags=""
805 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
806 aros_kernel_ldflags="-Wl,-rpath,./lib"
807 aros_debug_cflags="-Wall -Werror-implicit-function-declaration $aros_symbols_debug $aros_messages_debug -mc68000 -Wa,-mc68000"
809 aros_debug_ldflags="$aros_symbols_debug"
810 aros_mungwall_debug="0"
811 aros_modules_debug="0"
812 gcc_target_cpu="mc68000"
813 ignore_undefined_symbols="-ius"
816 AC_MSG_ERROR("Unknown CPU for PalmPilot -- $target_cpu")
822 AC_MSG_ERROR([Unsupported target architecture $target])
826 aros_hostcfg_dir="bin/${aros_host_arch}-${aros_host_cpu}/gen/config"
827 aros_targetcfg_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/config"
828 aros_inc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/AROS/Development/include/aros"
829 aros_geninc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/include/aros"
830 aros_tools_dir="bin/${aros_host_arch}-${aros_host_cpu}/tools"
831 aros_scripts_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/scripts"
833 # aros_cc_pre is a variable that is added to the front of the compiler name
834 # in the generated aros-gcc shell script. We need this to enable the cache
835 # to work across cleaned builds. Also, support DISTCC using the correct
836 # environment variable.
839 if test "x${DISTCC}" != "x" ; then
840 if test "x${CCACHE}" != "x" ; then
841 aros_cc_pre="env CCACHE_PREFIX=${DISTCC} ${CCACHE} "
843 aros_cc_pre="${DISTCC} "
846 if test "x${CCACHE}" != "x" ; then
847 aros_cc_pre="${CCACHE} "
851 prefix="${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros"
853 TARGET_CC="${prefix}-gcc"
854 TARGET_AS="$TARGET_CC"
855 TARGET_LD="${prefix}-ld"
856 aros_target_ld="${prefix}-ld"
858 NOSTDINC_CFLAGS=-nostdinc
860 NOSTARTUP_LDFLAGS=-nostartfiles
862 DETACH_LDFLAGS=-detach
863 NOSTDLIB_LDFLAGS=-nostdlib
865 AROS_TOOL_CC(SHARED_LD,$aros_shared_ld)
866 AROS_TOOL_CC(KERNEL_LD,$aros_kernel_ld)
869 aros_target_ar=${prefix}-ar
870 aros_target_ar_flags="cr"
871 aros_target_nm=${prefix}-nm
872 aros_target_nm_flags="-C -ul"
873 aros_target_objcopy=${prefix}-objcopy
874 aros_target_objdump=${prefix}-objdump
875 aros_target_ranlib=${prefix}-ranlib
876 aros_target_strip="${prefix}-strip --strip-unneeded -R.comment"
878 prefix="\$(TOOLDIR)/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros"
879 AR="${prefix}-ar $aros_target_ar_flags"
880 RANLIB="${prefix}-ranlib $aros_target_ranlib_flags"
881 NM="${prefix}-nm $aros_target_nm_flags"
882 NM_PLAIN="${prefix}-nm"
883 STRIP="${prefix}-strip $aros_target_strip_flags"
884 OBJDUMP="${prefix}-objdump"
885 OBJCOPY="${prefix}-objcopy"
890 AC_SUBST(NOSTDINC_CFLAGS)
891 AC_SUBST(NOSTARTUP_LDFLAGS)
892 AC_SUBST(NIX_LDFLAGS)
893 AC_SUBST(DETACH_LDFLAGS)
894 AC_SUBST(NOSTDLIB_LDFLAGS)
895 AC_SUBST(aros_cc_pre)
904 #-----------------------------------------------------------------------------
905 # See if we can compile SHM support
907 if [[ "x$no_x" != "xyes" -a "x$ac_cv_header_sys_ipc_h" = "xyes" -a "x$ac_cv_header_sys_shm_h" = "xyes" ]]; then
908 AC_MSG_CHECKING(whether the X11 MIT-SHM extension can be compiled in)
909 if test -z "$x_includes" ; then
912 CFLAGS="-I $x_includes"
914 LIBS="-L/usr/X11/lib -L/usr/X11R6/lib -lX11 -lXext"
916 #include <sys/types.h>
917 #include <X11/Xlib.h>
918 #include <X11/Xutil.h>
919 #include <X11/keysym.h>
920 #include <X11/cursorfont.h>
923 #include <X11/extensions/XShm.h>],[
924 static XShmSegmentInfo shminfo;
925 static Display *display;
926 XShmAttach(display, &shminfo);
928 shmctl(shminfo.shmid, IPC_RMID, 0);
937 # Find the system include path. We can suggest that an alternative is
938 # used if we don't get it correct. The default is to use /usr/include.
939 # Which is set in the aros_target_incl_def variable.
941 AC_ARG_ENABLE(includes,
942 [ --enable-includes=dir Alternative system include directory],
943 [aros_target_incl=$enable_includes], [aros_target_incl=$aros_target_incl_def])
945 dnl find out about the target cc's include path
946 AC_MSG_CHECKING([for the target compiler's include path])
947 if test "$aros_target_cc_includes" = "" ; then
948 aros_target_cc_includes=`dirname \`${aros_target_cc} -print-libgcc-file-name\``/include
950 AC_MSG_RESULT($aros_target_cc_includes)
952 dnl Check if user specified --with-resolution=XRESxYRESxDEPTH
953 AC_MSG_CHECKING([for default resolution of WBScreen])
954 AC_ARG_WITH(resolution,[ --with-resolution=XRESxYRESxDEPTH Default resolution of the initial WorkbenchScreen],resolution=$withval,resolution=none)
955 # We require an argument, so map --with/--without ("yes"/"no") to "none" specified
956 if test "$resolution" = "yes" ; then
959 if test "$resolution" = "no" ; then
962 if test "$resolution" != "none" ; then
963 aros_default_wbwidth=`echo $resolution | cut -d'x' -f1`
964 aros_default_wbheight=`echo $resolution | cut -d'x' -f2`
965 aros_default_wbdepth=`echo $resolution | cut -d'x' -f3`
967 AC_MSG_RESULT($aros_default_wbwidth x $aros_default_wbheight x $aros_default_wbdepth)
968 aros_cv_default_wbwidth=$aros_default_wbwidth
969 aros_cv_default_wbheight=$aros_default_wbheight
970 aros_cv_default_wbdepth=$aros_default_wbdepth
972 dnl See if the user wants the BOCHS hack for native flavour
973 AC_MSG_CHECKING([if bochs hack is enabled])
974 AC_ARG_ENABLE(bochs_hack,[ --enable-bochs-hack Enable hacks to make BOCHS (partly) work (default=no)],bochs_hack="yes",bochs_hack="no")
975 if test "$bochs_hack" = "yes" ; then
978 AC_MSG_RESULT($bochs_hack)
980 dnl See if the user wants the serial debug output for native flavour
981 AC_MSG_CHECKING([if serial debug is enabled])
982 AC_ARG_WITH(serial-debug,[ --with-serial-debug Enable serial debug output in native (default=no)],serial_debug=$withval,serial_debug=none)
983 if test "$serial_debug" = "yes" ; then
986 if test "$serial_debug" = "no" ; then
989 if test "$serial_debug" != "none" ; then
990 aros_serial_debug=$serial_debug
991 AC_MSG_RESULT(on port $serial_debug)
996 dnl See if the user wants the palm debug output hack for palm native flavour
997 AC_MSG_CHECKING([if palm debug hack is enabled])
998 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")
999 if test "$palm_debug_hack" = "yes" ; then
1000 aros_palm_debug_hack="1"
1002 AC_MSG_RESULT($palm_debug_hack)
1005 dnl See if the user wants nesting supervisor activated for unix flavour
1006 AC_MSG_CHECKING([if nesting supervisor support is enabled])
1007 AC_ARG_ENABLE(nesting_supervisor,[ --enable-nesting-supervisor Enable nesting supervisor support in unix (default=no)],nesting_supervisor="yes",nesting_supervisor="no")
1008 if test "$nesting_supervisor" = "yes" ; then
1009 aros_nesting_supervisor="1"
1011 AC_MSG_RESULT($nesting_supervisor)
1015 if test "$HAVE_XSHM_SUPPORT" = "1" ; then
1016 dnl See if the user wants the X11 MIT-SHM extension to be enabled
1017 AC_MSG_CHECKING([if X11 MIT-SHM extension is enabled])
1018 AC_ARG_ENABLE(xshm_extension,[ --enable-xshm-extension Enable X11 MIT-SHM extension [default=yes]],xshm_extension="$enableval",xshm_extension="yes")
1019 if test "$xshm_extension" = "no" ; then
1022 AC_MSG_RESULT($xshm_extension)
1029 dnl See if the user wants dbus.library
1030 AC_MSG_CHECKING([if building of dbus.library is enabled])
1031 AC_ARG_ENABLE(dbus,[ --enable-dbus Enable DBUS support via dbus.library (default=no)],dbus="yes",dbus="no")
1032 if test "$dbus" = "yes" ; then
1034 DBUS_CFLAGS=`pkg-config --cflags dbus-1`
1035 DBUS_LIBFLAGS=`pkg-config --libs dbus-1`
1036 KERNEL_DBUS_KOBJ=kernel-dbus-kobj
1037 KERNEL_DBUS_INCLUDES=kernel-dbus-includes
1041 AC_MSG_RESULT($dbus)
1044 dnl --------------------------------------------------------------------
1045 dnl Configuration Output Section
1046 dnl --------------------------------------------------------------------
1051 AC_SUBST(aros_flavour)
1052 AC_SUBST(aros_flavour_uc)
1056 AC_SUBST(aros_host_arch)
1057 AC_SUBST(aros_host_cpu)
1058 AC_SUBST(aros_host_cc)
1059 AC_SUBST(aros_host_ld)
1060 AC_SUBST(aros_host_make)
1061 AC_SUBST(aros_host_cflags)
1062 AC_SUBST(aros_host_ldflags)
1063 AC_SUBST(aros_host_debug)
1064 AC_SUBST(aros_host_mkdep)
1065 AC_SUBST(aros_host_mkargs)
1066 AC_SUBST(aros_host_exe_suffix)
1067 AC_SUBST(aros_host_lib_suffix)
1068 AC_SUBST(aros_tools_dir)
1071 AC_SUBST(aros_target_arch)
1072 AC_SUBST(aros_target_cpu)
1073 AC_SUBST(aros_target_variant)
1074 AC_SUBST(aros_target_suffix)
1075 AC_SUBST(aros_target_incl)
1076 AC_SUBST(aros_target_cc)
1077 AC_SUBST(aros_target_cc_includes)
1078 AC_SUBST(aros_target_cc_path)
1079 AC_SUBST(aros_target_objdump)
1080 AC_SUBST(aros_target_objcopy)
1081 AC_SUBST(aros_target_strip)
1082 AC_SUBST(aros_target_as)
1083 AC_SUBST(aros_target_nm)
1084 AC_SUBST(aros_shared_default)
1085 AC_SUBST(aros_object_format)
1086 AC_SUBST(aros_compiler_libs)
1088 AC_SUBST(aros_config_cflags)
1089 AC_SUBST(aros_config_aflags)
1090 AC_SUBST(aros_target_ld)
1091 AC_SUBST(aros_config_ldflags)
1093 AC_SUBST(aros_shared_cflags)
1094 AC_SUBST(aros_shared_aflags)
1095 AC_SUBST(aros_shared_ldflags)
1096 AC_SUBST(aros_kernel_ldflags)
1097 AC_SUBST(aros_debug_cflags)
1098 AC_SUBST(aros_debug_aflags)
1099 AC_SUBST(aros_debug_ldflags)
1100 AC_SUBST(aros_target_genmap)
1103 AC_SUBST(aros_gui_libdir)
1104 AC_SUBST(aros_gui_ldflags)
1105 AC_SUBST(aros_gui_libflags)
1106 AC_SUBST(aros_gui_incdir)
1107 AC_SUBST(aros_gui_ccflags)
1109 AC_SUBST(aros_default_wbwidth)
1110 AC_SUBST(aros_default_wbheight)
1111 AC_SUBST(aros_default_wbdepth)
1112 AC_SUBST(DO_XSHM_SUPPORT)
1114 # Native version related
1115 AC_SUBST(aros_bochs_hack)
1116 AC_SUBST(aros_serial_debug)
1118 # Palm native version related
1119 AC_SUBST(aros_palm_debug_hack)
1121 # Unix/Hosted version related
1122 AC_SUBST(aros_nesting_supervisor)
1125 AC_SUBST(ENABLE_DBUS)
1126 AC_SUBST(DBUS_CFLAGS)
1127 AC_SUBST(DBUS_LIBFLAGS)
1128 AC_SUBST(KERNEL_DBUS_KOBJ)
1129 AC_SUBST(KERNEL_DBUS_INCLUDES)
1132 AC_SUBST(aros_debug)
1133 AC_SUBST(aros_mungwall_debug)
1134 AC_SUBST(aros_stack_debug)
1135 AC_SUBST(aros_modules_debug)
1137 # Collect-aros stuff: "-ius" to ignore undefined symbols
1138 AC_SUBST(ignore_undefined_symbols)
1140 # C compiler related
1141 AC_SUBST(gcc_target_cpu)
1143 dnl Prepare for output, make up all the generated patches
1144 case "$aros_flavour" in
1145 emulation) aros_flavour_uc="AROS_FLAVOUR_EMULATION"
1146 aros_flavour="emulation" ;;
1147 emulcompat) aros_flavour_uc="(AROS_FLAVOUR_EMULATION|AROS_FLAVOUR_BINCOMPAT)"
1148 aros_flavour="emulation" ;;
1149 standalone) aros_flavour_uc="AROS_FLAVOUR_STANDALONE"
1150 aros_flavour="standalone";;
1151 native) aros_flavour_uc="AROS_FLAVOUR_NATIVE"
1152 aros_flavour="native" ;;
1153 nativecompat) aros_flavour_uc="(AROS_FLAVOUR_NATIVE|AROS_FLAVOUR_BINCOMPAT)"
1154 aros_flavour="native" ;;
1155 linklib) aros_flavour_uc="AROS_FLAVOUR_LINKLIB"
1156 aros_flavour="linklib" ;;
1157 palmnative) aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
1158 aros_flavour="palmnative" ;;
1159 ppcnative) aros_flavour_uc="(AROS_FLAVOUR_NATIVE|AROS_FLAVOUR_BINCOMPAT)"
1160 aros_flavour="ppcnative" ;;
1163 if test -z "$aros_gui_basedir" ; then
1164 dnl Use X as the default GUI
1165 aros_gui_libdir="$x_libraries"
1166 if test -z "$x_libraries" ; then
1169 aros_gui_ldflags="-L $x_libraries"
1171 if test "$HAVE_XSHM_SUPPORT" = "1" ; then
1172 aros_gui_libflags="-lX11 -lXext"
1174 aros_gui_libflags="-lX11"
1176 aros_gui_incdir="$x_includes"
1177 if test -z "$x_includes" ; then
1180 aros_gui_ccflags="-I $x_includes"
1183 if test -n "$aros_gui_basedir" ; then
1184 aros_gui_libdir="${aros_gui_basedir}/lib"
1185 aros_gui_incdir="${aros_gui_basedir}/include"
1188 if test -n "$aros_gui_libdir" ; then
1189 aros_gui_ldflags="-L ${aros_gui_libdir}"
1192 if test -n "$aros_gui_incdir" ; then
1193 aros_gui_ccflags="-I ${aros_gui_incdir}"
1195 aros_gui_incdir="${aros_sysincludes}"
1200 if test ! -d ${aros_inc_dir} ; then
1201 ${MKDIR} ${aros_inc_dir}
1203 if test ! -d ${aros_geninc_dir} ; then
1204 ${MKDIR} ${aros_geninc_dir}
1206 if test ! -d ${aros_hostcfg_dir} ; then
1207 ${MKDIR} ${aros_hostcfg_dir}
1209 if test ! -d ${aros_targetcfg_dir} ; then
1210 ${MKDIR} ${aros_targetcfg_dir}
1212 if test ! -d ${aros_tools_dir} ; then
1213 ${MKDIR} ${aros_tools_dir}
1215 if test ! -d ${aros_scripts_dir} ; then
1216 ${MKDIR} ${aros_scripts_dir}
1219 AC_CONFIG_HEADERS(${aros_geninc_dir}/host-conf.h:config/host-conf.h.in)
1221 AC_CONFIG_COMMANDS([compiler_executable],
1223 prefix=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}
1225 prefix="${prefix}/${aros_target_cpu}-aros"
1226 prefix2=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros
1230 chmod a+x ${prefix2}-gcc ${prefix2}-ld
1232 ln -sf ${prefix2}-gcc ${prefix}-gcc
1233 ln -sf ${prefix2}-ld ${prefix}-ld
1235 ln -sf $aros_target_nm_ln ${prefix}-nm
1236 ln -sf $aros_target_ar_ln ${prefix}-ar
1237 ln -sf $aros_target_ranlib_ln ${prefix}-ranlib
1238 ln -sf $aros_target_objcopy_ln ${prefix}-objcopy
1239 ln -sf $aros_target_objdump_ln ${prefix}-objdump
1240 ln -sf $aros_target_strip_ln ${prefix}-strip
1242 ln -sf $aros_target_nm_ln ${prefix2}-nm
1243 ln -sf $aros_target_ar_ln ${prefix2}-ar
1244 ln -sf $aros_target_ranlib_ln ${prefix2}-ranlib
1245 ln -sf $aros_target_objcopy_ln ${prefix2}-objcopy
1246 ln -sf $aros_target_objdump_ln ${prefix2}-objdump
1247 ln -sf $aros_target_strip_ln ${prefix2}-strip
1250 aros_tools_dir=${aros_tools_dir}
1251 aros_target_cpu=${aros_target_cpu}
1252 aros_target_arch=${aros_target_arch}
1253 aros_target_suffix=${aros_target_suffix}
1254 aros_target_nm_ln=${aros_target_nm_ln}
1255 aros_target_ar_ln=${aros_target_ar_ln}
1256 aros_target_ranlib_ln=${aros_target_ranlib_ln}
1257 aros_target_objdump_ln=${aros_target_objdump_ln}
1258 aros_target_objcopy_ln=${aros_target_objcopy_ln}
1259 aros_target_strip_ln=${aros_target_strip_ln}
1262 AC_CONFIG_COMMANDS([genshared_executable],
1263 [chmod a+x ${aros_scripts_dir}/genshared],
1264 [aros_scripts_dir=${aros_scripts_dir}]
1266 AC_CONFIG_COMMANDS([genmf_executable],
1267 [chmod a+x ${aros_tools_dir}/genmf.py],
1268 [aros_tools_dir=${aros_tools_dir}]
1270 AC_CONFIG_COMMANDS([adflib_myaros.conf_executable],
1271 [chmod a+x tools/adflib/myconf.aros]
1277 ${aros_inc_dir}/config.h:config/config.h.in
1278 ${aros_geninc_dir}/config.h:config/config.h.in
1279 ${aros_hostcfg_dir}/host.cfg:config/host.cfg.in
1280 ${aros_targetcfg_dir}/target.cfg:config/target.cfg.in
1282 ${aros_targetcfg_dir}/make.defaults:config/make.defaults.in
1283 ${aros_targetcfg_dir}/specs:config/specs.in
1284 ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-gcc:scripts/aros-gcc.in
1285 ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-ld:scripts/aros-ld.in
1286 ${aros_scripts_dir}/genshared:compiler/c_lib/source/lib_source/genshared.in
1287 ${aros_tools_dir}/genmf.py:tools/genmf/genmf.py
1288 tools/adflib/myconf.aros
1293 dnl This is in order to not defined SHARED_CFLAGS sometimes
1294 dnl We don't always do aros_shared_ar, aros_shared_cflags
1296 #XXX compatability...
1297 aros_shared_ar="$aros_shared_ld $aros_shared_ldflags -o"
1299 if test -n "$aros_shared_cflags" ; then
1300 echo "SHARED_CFLAGS := $aros_shared_cflags" >> ${aros_hostcfg_dir}/host.cfg
1301 echo "SHARED_AR := $aros_shared_ar" >> ${aros_hostcfg_dir}/host.cfg