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 dnl aros_target_cc_includes="/usr/include"
154 dnl FreeBSD 5.x has changed the default object format.
155 dnl The double [[]] is necessary to get around m4's quoting rules.
158 aros_object_format="elf_i386_fbsd"
162 aros_object_format="elf_i386"
168 aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
169 aros_host_make="gmake"
170 aros_host_arch="netbsd"
179 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
180 aros_host_cpu="$host_cpu"
183 aros_host_lib_suffix=".0.0"
187 aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
188 aros_host_make="gmake"
189 aros_host_arch="openbsd"
195 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
196 aros_host_cpu="$host_cpu"
202 aros_host_arch="solaris"
203 aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
206 aros_host_cpu="sparc"
209 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
210 aros_host_cpu="$host_cpu"
216 aros_host_cc="$aros_host_cc"
217 aros_host_arch="morphos"
222 aros_host_arch="amiga"
227 TOUCH="/gg/bin/touch"
236 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
237 aros_host_cpu="$host_cpu"
243 aros_host_arch="cygwin"
244 aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
250 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
251 aros_host_cpu="$host_cpu"
256 AC_MSG_ERROR([Unsupported host architecture $host])
260 AROS_PROG(HOST_AR,[ar],[cr])
261 AROS_REQUIRED(ar,$HOST_AR)
262 AROS_PROG(HOST_RANLIB,ranlib)
264 AROS_PROG(RM,[rm],[-rf])
265 AROS_REQUIRED(rm,$RM)
267 AROS_REQUIRED(cp,$CP)
269 AROS_REQUIRED(mv,$MV)
270 AROS_PROG(ECHO,[echo])
271 AROS_REQUIRED(echo,$ECHO)
272 AROS_PROG(MKDIR,[mkdir],[-p])
273 AROS_REQUIRED(mkdir,$MKDIR)
274 AROS_PROG(TOUCH,[touch])
275 AROS_REQUIRED(touch,$TOUCH)
276 AROS_PROG(SORT,[sort])
277 AROS_REQUIRED(sort,$SORT)
278 AROS_PROG(UNIQ,[uniq])
279 AROS_REQUIRED(uniq,$UNIQ)
280 AROS_PROG(NOP,[true])
281 AROS_REQUIRED(true,$NOP)
283 AROS_REQUIRED(cat,$CAT)
284 AROS_PROG(BISON,[bison])
285 AROS_REQUIRED(bison,$BISON)
286 AROS_PROG(PNGTOPNM,[pngtopnm])
287 AROS_REQUIRED(pngtopnm,$PNGTOPNM)
288 AROS_PROG(PPMTOILBM,[ppmtoilbm])
289 AROS_REQUIRED(ppmtoilbm,$PPMTOILBM)
290 AROS_PROG(STRIP,[strip])
291 AROS_REQUIRED(strip,$STRIP)
293 AROS_REQUIRED(sed,$SED)
294 AROS_PROG(CHMOD,[chmod])
295 AROS_REQUIRED(chmod,$CHMOD)
297 AM_PATH_PYTHON(2.2.1)
306 dnl ---------------------------------------------------------------------------
307 dnl Look for things about the host system, good for hosted targets.
308 dnl ---------------------------------------------------------------------------
310 # Check for some includes for the X11 HIDD and the kernel
311 AC_CHECK_HEADERS([sys/ipc.h sys/shm.h \
312 sys/mmap.h sys/mman.h sysexits.h \
313 sys/statfs.h sys/statvfs.h sys/vfs.h sys/param.h \
316 AC_CHECK_HEADERS([sys/mount.h],,,[#include <sys/param.h>])
333 AC_CHECK_MEMBERS(struct tm.tm_gmtoff)
335 # Look for some functions
336 AC_CHECK_FUNCS([getpagesize kqueue statfs statvfs \
337 clone kse_create rfork_thread thr_create sa_register \
338 getcontext makecontext setcontext sigaltstack swapcontext])
346 dnl --------------------------------------------------------------------
347 dnl Target Configuration Section
348 dnl --------------------------------------------------------------------
350 dnl The target configuration section is responsible for setting up all
351 dnl the paths for includes, and tools required to build AROS to some
352 dnl particular target.
354 # Find all the tools we need to compile. This could be cross-compiling
355 # though! If that is the case we use the GNU form of the target and
356 # simply add this to the front of the binary name. This is rather simple,
357 # but it should work under most circumstances.
359 # The default tools are to use the same as the host, but only if the
360 # host and target CPU are the same. With GCC this is normally enough.
364 aros_target_cc="$aros_host_cc"
365 aros_target_as="$aros_host_cc"
366 aros_shared_ld="$aros_host_ld"
367 aros_kernel_ld="$aros_host_ld"
368 aros_target_ld="$aros_host_ld"
370 aros_target_mkdep="$aros_host_mkdep"
371 aros_target_incl_def="$aros_host_incl"
373 # The default tools executables to be linked at.
374 AROS_TOOL_CCPATH(aros_target_ar_ln,ar)
375 AROS_REQUIRED(ar,$aros_target_ar_ln)
376 AROS_TOOL_CCPATH(aros_target_nm_ln,nm)
377 AROS_REQUIRED(nm,$aros_target_nm_ln)
378 AROS_TOOL_CCPATH(aros_target_objcopy_ln,objcopy)
379 AROS_REQUIRED(objcopy,$aros_target_objcopy_ln)
380 AROS_TOOL_CCPATH(aros_target_objdump_ln,objdump)
381 AROS_REQUIRED(objdump,$aros_target_objdump_ln)
382 AROS_TOOL_CCPATH(aros_target_ranlib_ln,ranlib)
383 AROS_REQUIRED(ranlib,$aros_target_ranlib_ln)
384 AROS_TOOL_CCPATH(aros_target_strip_ln,strip)
385 AROS_REQUIRED(strip,$aros_target_strip_ln)
387 if test "$GCC" = "yes"; then
388 aros_target_cc_path=`$CC -print-search-dirs | grep "programs: =" | cut -c 12-`
391 # It is necessary to clear the include and link paths for target
392 # commands. This should help clear up problems when cross compiling.
393 aros_config_cflags="-Wall -Werror-implicit-function-declaration"
394 aros_config_aflags="-Wall -x assembler-with-cpp"
395 aros_config_ldflags=""
397 aros_shared_default=yes
399 aros_shared_cflags="-fPIC"
400 aros_shared_aflags=""
401 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
402 aros_kernel_ldflags="-Wl,-rpath,./lib"
406 aros_target_genmap="-Wl,-Map -Xlinker"
408 # Native flavour stuff
410 aros_serial_debug="0"
412 # Palm native flavour stuff
413 aros_palm_debug_hack="0"
416 aros_nesting_supervisor="0"
418 # Collect-aros stuff: "-ius" to ignore undefined symbols
419 ignore_undefined_symbols=""
425 #-----------------------------------------------------------------------------
427 AC_MSG_CHECKING([for type of build])
428 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")
430 if test "$build_type" = "nightly"; then
431 build_type_string="NIGHTLY"
432 elif test "$build_type" = "snapshot"; then
433 build_type_string="SNAPSHOT"
434 elif test "$build_type" = "milestone"; then
435 build_type_string="MILESTONE"
436 elif test "$build_type" = "release"; then
437 build_type_string="RELEASE"
439 build_type_string="PERSONAL"
440 build_type="personal"
443 aros_config_cflags="$aros_config_cflags -DAROS_BUILD_TYPE=AROS_BUILD_TYPE_$build_type_string"
445 AC_MSG_RESULT($build_type)
447 #-----------------------------------------------------------------------------
448 all_debug_types="messages stack mungwall modules symbols"
450 AC_MSG_CHECKING([which debug types to enable])
451 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)]),
452 debug="$enableval",debug="")
454 if test "$debug" = "" -o "$debug" = "no"; then
456 elif test "$debug" = "yes"; then
460 if test "$debug" = "all" ; then
461 debug=$all_debug_types
462 for d in $all_debug_types; do
463 export aros_${d}_debug="1"
466 for d in $all_debug_types; do
467 export aros_${d}_debug="0"
471 if test "$debug" != "none"; then
472 debug=`echo $debug | sed s/,/\ /g`
475 for d2 in $all_debug_types; do
476 if test "$d2" = "$d"; then
481 if test "$found" = "0"; then
482 AC_MSG_ERROR([unrecognized debug type "$d". Available types are: all none $all_debug_types])
484 export aros_${d}_debug="1"
488 AC_MSG_RESULT($debug)
490 if test "$aros_messages_debug" = "1"; then
491 aros_messages_debug="-DADEBUG=1 -DMDEBUG=1"
493 aros_messages_debug=""
495 if test "$aros_symbols_debug" = "1"; then
496 aros_symbols_debug="-g"
498 aros_symbols_debug=""
501 # These are the flags to pass when compiling debugged programs
502 aros_debug_cflags="$aros_symbols_debug $aros_messages_debug"
504 aros_debug_ldflags="$aros_symbols_debug"
506 #-----------------------------------------------------------------------------
507 # Checking for distcc and ccache.
509 # Always apply the transforms in this particular order. Basically you should
510 # always run 'ccache distcc compiler' in that order for the best performance.
512 AC_MSG_CHECKING([whether to enable distcc])
513 AC_ARG_ENABLE(distcc,AC_HELP_STRING([--enable-distcc],[Use distcc as a front end to the compiler (default=no).]),distcc="$enableval",distcc="no")
514 if test "$distcc" != "" -a "$distcc" != "no"; then
515 # AC_CHECK_PROG will print out the result in this case
516 AC_PATH_PROG(DISTCC,[distcc],distcc,no)
521 AC_MSG_CHECKING([whether to enable ccache])
522 AC_ARG_ENABLE(ccache,AC_HELP_STRING([--enable-ccache],[Use ccache as a front end to the compiler (default=no).]),ccache="$enableval",ccache="no")
523 if test "$ccache" != "" -a "$ccache" != "no"; then
524 # AC_CHECK_PROG will print out the result in this case
525 AC_CHECK_PROG(CCACHE,[ccache],ccache,no)
530 #-----------------------------------------------------------------------------
531 AC_MSG_CHECKING([what optimization flags to use])
532 AC_ARG_WITH(optimization,AC_HELP_STRING([--with-optimization=FLAGS],[Use optimization flags FLAGS (default=-O2).]),optimization="$withval",optimization="unknown")
533 if test "$optimization" = "unknown"; then
534 dnl default is -O2 for normal builds, -O0 for debug builds
535 if test "$debug" != "none"; then
541 aros_config_cflags="$aros_config_cflags $optimization"
542 AC_MSG_RESULT($optimization)
544 #-----------------------------------------------------------------------------
545 AC_MSG_CHECKING([what target variant to enable])
546 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")
547 if test "$target_variant" = "none"; then
548 aros_target_variant=""
549 aros_target_suffix=""
551 aros_target_variant="$target_variant"
552 aros_target_suffix="-$target_variant"
554 AC_MSG_RESULT($enableval)
556 #-----------------------------------------------------------------------------
557 # This is the target configuration switch.
560 aros_target_arch="linux"
561 case "$target_cpu" in
563 aros_target_cpu="m68k"
564 aros_object_format="m68kelf"
565 aros_flavour="emulcompat"
566 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D__mc68000 -D__linux__"
567 aros_shared_ldflags="-Wl,-T,\$(TOP)/config/linux/m68k/script.so"
568 aros_kernel_ldflags="-Wl,-rpath,./lib,-T,\$(TOP)/config/linux/m68k/script.normal"
569 gcc_target_cpu="mc68000"
572 aros_target_cpu="i386"
573 aros_object_format="elf_i386"
574 aros_flavour="emulation"
575 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__linux__"
576 aros_default_wbdepth=8
577 gcc_target_cpu="i386"
580 aros_target_cpu="ppc"
581 aros_object_format="elf32ppc"
582 aros_flavour="emulation"
583 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc -D__linux__"
584 aros_default_wbdepth=8
585 aros_compiler_libs="-lgcc"
589 AC_MSG_ERROR("Unknown CPU for Linux -- $target_cpu")
595 aros_target_arch="pc"
596 aros_shared_default="no"
597 case "$target_cpu" in
599 aros_target_cpu="i386"
601 dnl If somebody hasn't already set the target object
602 dnl format, then use this value. Mostly to support
603 dnl FreeBSD cross-compilation.
604 dnl TODO: Remove when we always use our compiler.
606 if test "$aros_object_format" = "" ; then
607 aros_object_format="elf_i386"
609 aros_flavour="standalone"
610 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
611 aros_kernel_ldflags=""
612 aros_default_wbwidth=640
613 aros_default_wbheight=480
614 gcc_target_cpu="i386"
617 AC_MSG_ERROR("Unknown native CPU -- $target_cpu")
623 aros_target_arch="prep"
624 aros_shared_default="no"
625 aros_target_cpu="ppc"
626 aros_object_format="elf32ppc"
627 aros_flavour="ppcnative"
628 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
629 aros_kernel_ldflags=""
630 aros_default_wbwidth=640
631 aros_default_wbheight=480
633 case "$target_cpu" in
635 aros_target_cc="ppc-linux-gcc -pipe"
636 aros_target_ld="ppc-linux-ld"
637 aros_target_as="ppc-linux-as"
638 aros_target_ar="ppc-linux-ar"
639 aros_target_ranlib="ppc-linux-ranlib"
640 aros_target_nm="ppc-linux-nm"
641 aros_target_strip="ppc-linux-strip"
642 aros_target_objcopy="ppc-linux-objcopy"
643 aros_target_objdump="ppc-linux-objdump"
644 aros_shared_ld="ppc-linux-ld"
645 aros_kernel_ld="ppc-linux-ld"
653 aros_target_arch="freebsd"
654 aros_target_cpu="i386"
655 aros_flavour="emulation"
656 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
657 gcc_target_cpu="i386"
663 aros_target_arch="netbsd"
664 case "$target_cpu" in
666 aros_target_cpu="m68k"
667 aros_object_format="m68kelf"
668 aros_flavour="emulcompat"
669 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D__mc68000 -D__NetBSD__"
670 gcc_target_cpu="mc68000"
673 aros_target_cpu="i386"
674 aros_object_format="elf_i386"
675 aros_flavour="emulation"
676 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__NetBSD__"
677 aros_default_wbdepth=8
678 gcc_target_cpu="i386"
681 AC_MSG_ERROR("Unknown CPU for NetBSD -- $target_cpu")
684 aros_target_genmap="-Wl,-M -Xlinker >"
685 aros_flavour="emulation"
686 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
690 aros_target_arch="openbsd"
691 case "$target_cpu" in
693 aros_target_cpu="i386"
694 aros_object_format="elf_i386"
695 aros_flavour="emulation"
696 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__OpenBSD__"
697 gcc_target_cpu="i386"
700 AC_MSG_ERROR("Unknown CPU for OpenBSD -- $target_cpu")
703 aros_target_genmap="-Wl,-M -Xlinker >"
704 aros_target_nm_flags="-u"
705 aros_flavour="emulation"
709 aros_target_arch="solaris"
710 case "$target_cpu" in
712 aros_target_cpu="sparc"
713 aros_object_format="elf_sparc"
714 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dsparc -D__Solaris__"
715 gcc_target_cpu="sparc"
718 AC_MSG_ERROR("Unknown CPU for Solaris -- $target_cpu")
721 aros_config_cflags="$aros_config_cflags -D$aros_target_cpu"
722 aros_flavour="emulation"
726 aros_target_arch="morphos"
727 aros_shared_default="no"
728 aros_target_cpu="ppc"
729 aros_object_format="elf_ppc"
730 aros_flavour="nativecompat"
731 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
736 aros_target_arch="amiga"
737 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D_AMIGA -DAMIGA"
738 aros_shared_default="no"
740 aros_config_cflags="$aros_config_cflags -fomit-frame-pointer -fbuiltin -ffreestanding"
742 case "$target_cpu" in
744 aros_target_cpu="m68k"
745 aros_object_format="m68kelf"
746 aros_flavour="nativecompat"
747 gcc_target_cpu="mc68000"
751 aros_flavour="native"
755 AC_MSG_ERROR("Unknown CPU for Amiga $target_cpu")
761 aros_target_arch="cygwin"
762 aros_shared_default="no"
763 case "$target_cpu" in
765 aros_target_cpu="i386"
766 aros_object_format="elf_i386"
767 aros_flavour="emulation"
768 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__CYGWIN32__"
769 aros_shared_cflags=""
770 aros_default_wbdepth=8
771 gcc_target_cpu="i386"
774 AC_MSG_ERROR("Unknown CPU for CygWin -- $target_cpu")
779 aros_target_arch="pp"
780 aros_shared_default="no"
781 case "$target_cpu" in
783 aros_target_cpu="m68k"
784 aros_object_format="m68kelf"
785 aros_flavour="palmnative"
786 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
787 aros_kernel_ldflags=""
788 aros_default_wbwidth=160
789 aros_default_wbheight=160
790 aros_default_wbdepth=1
791 aros_target_cc="m68k-elf-gcc -pipe"
792 aros_target_ld="$(which m68k-elf-ld)"
793 aros_target_as="m68k-elf-gcc -pipe"
794 aros_shared_ld="m68k-elf-gcc"
795 aros_kernel_ld="m68k-elf-gcc"
796 aros_target_ar="m68k-elf-ar"
797 aros_target_ar_flags="cru"
798 aros_target_ranlib="m68k-elf-ranlib"
799 aros_target_nm="m68k-elf-nm"
800 aros_target_objcopy="m68k-elf-objcopy"
801 aros_target_objdump="m68k-elf-objdump"
802 aros_compiler_libs="-lgcc1"
803 aros_shared_default=no
804 aros_shared_cflags="-fpic"
805 aros_shared_aflags=""
806 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
807 aros_kernel_ldflags="-Wl,-rpath,./lib"
808 aros_debug_cflags="-Wall -Werror-implicit-function-declaration $aros_symbols_debug $aros_messages_debug -mc68000 -Wa,-mc68000"
810 aros_debug_ldflags="$aros_symbols_debug"
811 aros_mungwall_debug="0"
812 aros_modules_debug="0"
813 gcc_target_cpu="mc68000"
814 ignore_undefined_symbols="-ius"
817 AC_MSG_ERROR("Unknown CPU for PalmPilot -- $target_cpu")
823 AC_MSG_ERROR([Unsupported target architecture $target])
827 aros_hostcfg_dir="bin/${aros_host_arch}-${aros_host_cpu}/gen/config"
828 aros_targetcfg_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/config"
829 aros_inc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/AROS/Development/include/aros"
830 aros_gendir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen"
831 aros_geninc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/include/aros"
832 aros_tools_dir="bin/${aros_host_arch}-${aros_host_cpu}/tools"
833 aros_scripts_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/scripts"
835 # aros_cc_pre is a variable that is added to the front of the compiler name
836 # in the generated aros-gcc shell script. We need this to enable the cache
837 # to work across cleaned builds. Also, support DISTCC using the correct
838 # environment variable.
841 if test "x${DISTCC}" != "x" ; then
842 if test "x${CCACHE}" != "x" ; then
843 aros_cc_pre="env CCACHE_PREFIX=${DISTCC} ${CCACHE} "
845 aros_cc_pre="${DISTCC} "
848 if test "x${CCACHE}" != "x" ; then
849 aros_cc_pre="${CCACHE} "
853 prefix="${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros"
855 TARGET_CC="${prefix}-gcc"
856 TARGET_AS="$TARGET_CC"
857 TARGET_LD="${prefix}-ld"
858 aros_target_ld="${prefix}-ld"
860 NOSTDINC_CFLAGS=-nostdinc
862 NOSTARTUP_LDFLAGS=-nostartfiles
864 DETACH_LDFLAGS=-detach
865 NOSTDLIB_LDFLAGS=-nostdlib
867 AROS_TOOL_CC(SHARED_LD,$aros_shared_ld)
868 AROS_TOOL_CC(KERNEL_LD,$aros_kernel_ld)
871 aros_target_ar=${prefix}-ar
872 aros_target_ar_flags="cr"
873 aros_target_nm=${prefix}-nm
874 aros_target_nm_flags="-C -ul"
875 aros_target_objcopy=${prefix}-objcopy
876 aros_target_objdump=${prefix}-objdump
877 aros_target_ranlib=${prefix}-ranlib
878 aros_target_strip="${prefix}-strip --strip-unneeded -R.comment"
880 prefix="\$(TOOLDIR)/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros"
881 AR="${prefix}-ar $aros_target_ar_flags"
882 RANLIB="${prefix}-ranlib $aros_target_ranlib_flags"
883 NM="${prefix}-nm $aros_target_nm_flags"
884 NM_PLAIN="${prefix}-nm"
885 STRIP="${prefix}-strip $aros_target_strip_flags"
886 OBJDUMP="${prefix}-objdump"
887 OBJCOPY="${prefix}-objcopy"
892 AC_SUBST(NOSTDINC_CFLAGS)
893 AC_SUBST(NOSTARTUP_LDFLAGS)
894 AC_SUBST(NIX_LDFLAGS)
895 AC_SUBST(DETACH_LDFLAGS)
896 AC_SUBST(NOSTDLIB_LDFLAGS)
897 AC_SUBST(aros_cc_pre)
906 #-----------------------------------------------------------------------------
907 # See if we can compile SHM support
909 if [[ "x$no_x" != "xyes" -a "x$ac_cv_header_sys_ipc_h" = "xyes" -a "x$ac_cv_header_sys_shm_h" = "xyes" ]]; then
910 AC_MSG_CHECKING(whether the X11 MIT-SHM extension can be compiled in)
911 if test -z "$x_includes" ; then
914 CFLAGS="-I $x_includes"
916 LIBS="-L/usr/X11/lib -L/usr/X11R6/lib -lX11 -lXext"
918 #include <sys/types.h>
919 #include <X11/Xlib.h>
920 #include <X11/Xutil.h>
921 #include <X11/keysym.h>
922 #include <X11/cursorfont.h>
925 #include <X11/extensions/XShm.h>],[
926 static XShmSegmentInfo shminfo;
927 static Display *display;
928 XShmAttach(display, &shminfo);
930 shmctl(shminfo.shmid, IPC_RMID, 0);
939 # Find the system include path. We can suggest that an alternative is
940 # used if we don't get it correct. The default is to use /usr/include.
941 # Which is set in the aros_target_incl_def variable.
943 AC_ARG_ENABLE(includes,
944 [ --enable-includes=dir Alternative system include directory],
945 [aros_target_incl=$enable_includes], [aros_target_incl=$aros_target_incl_def])
947 dnl find out about the target cc's include path
948 AC_MSG_CHECKING([for the target compiler's include path])
949 if test "$aros_target_cc_includes" = "" ; then
950 #try to guess where the directory is
951 aros_target_cc_includes=`dirname \`${aros_target_cc} -print-libgcc-file-name\``/include
952 if ! test -d $aros_target_cc_includes; then
953 #the directory doesn't exist, we need to do some more work
954 aros_target_cc_includes=${PWD}/${aros_gendir}/cc_include
956 #these are the headers we're looling for
957 headers="limits.h mmintrin.h stdbool.h syslimits.h float.h \
958 stddef.h xmmintrin.h iso646.h stdarg.h unwind.h \
962 for h in $headers; do
963 #which other headers each of the above headers needs?
964 deps=$(echo "#include <$h>" | \
965 $aros_host_cc -E -M - 2>/dev/null | \
966 sed 's/^.*://; s/\\$/ /g; s/[[ \t]]\+/ /g')
968 #copy all the needed headers to a directory beneath gendir
971 dir=${aros_target_cc_includes}$(echo $(dirname $d) | \
972 sed -n "s,^.*/include\(/.*\),\1,p")
973 ! test -d $dir && mkdir -p $dir
974 ! test -f $dir/$h && { cp $d $dir; chmod u+w $dir/$h; }
979 AC_MSG_RESULT($aros_target_cc_includes)
981 dnl Check if user specified --with-resolution=XRESxYRESxDEPTH
982 AC_MSG_CHECKING([for default resolution of WBScreen])
983 AC_ARG_WITH(resolution,[ --with-resolution=XRESxYRESxDEPTH Default resolution of the initial WorkbenchScreen],resolution=$withval,resolution=none)
984 # We require an argument, so map --with/--without ("yes"/"no") to "none" specified
985 if test "$resolution" = "yes" ; then
988 if test "$resolution" = "no" ; then
991 if test "$resolution" != "none" ; then
992 aros_default_wbwidth=`echo $resolution | cut -d'x' -f1`
993 aros_default_wbheight=`echo $resolution | cut -d'x' -f2`
994 aros_default_wbdepth=`echo $resolution | cut -d'x' -f3`
996 AC_MSG_RESULT($aros_default_wbwidth x $aros_default_wbheight x $aros_default_wbdepth)
997 aros_cv_default_wbwidth=$aros_default_wbwidth
998 aros_cv_default_wbheight=$aros_default_wbheight
999 aros_cv_default_wbdepth=$aros_default_wbdepth
1001 dnl See if the user wants the BOCHS hack for native flavour
1002 AC_MSG_CHECKING([if bochs hack is enabled])
1003 AC_ARG_ENABLE(bochs_hack,[ --enable-bochs-hack Enable hacks to make BOCHS (partly) work (default=no)],bochs_hack="yes",bochs_hack="no")
1004 if test "$bochs_hack" = "yes" ; then
1007 AC_MSG_RESULT($bochs_hack)
1009 dnl See if the user wants the serial debug output for native flavour
1010 AC_MSG_CHECKING([if serial debug is enabled])
1011 AC_ARG_WITH(serial-debug,[ --with-serial-debug Enable serial debug output in native (default=no)],serial_debug=$withval,serial_debug=none)
1012 if test "$serial_debug" = "yes" ; then
1015 if test "$serial_debug" = "no" ; then
1018 if test "$serial_debug" != "none" ; then
1019 aros_serial_debug=$serial_debug
1020 AC_MSG_RESULT(on port $serial_debug)
1025 dnl See if the user wants the palm debug output hack for palm native flavour
1026 AC_MSG_CHECKING([if palm debug hack is enabled])
1027 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")
1028 if test "$palm_debug_hack" = "yes" ; then
1029 aros_palm_debug_hack="1"
1031 AC_MSG_RESULT($palm_debug_hack)
1034 dnl See if the user wants nesting supervisor activated for unix flavour
1035 AC_MSG_CHECKING([if nesting supervisor support is enabled])
1036 AC_ARG_ENABLE(nesting_supervisor,[ --enable-nesting-supervisor Enable nesting supervisor support in unix (default=no)],nesting_supervisor="yes",nesting_supervisor="no")
1037 if test "$nesting_supervisor" = "yes" ; then
1038 aros_nesting_supervisor="1"
1040 AC_MSG_RESULT($nesting_supervisor)
1044 if test "$HAVE_XSHM_SUPPORT" = "1" ; then
1045 dnl See if the user wants the X11 MIT-SHM extension to be enabled
1046 AC_MSG_CHECKING([if X11 MIT-SHM extension is enabled])
1047 AC_ARG_ENABLE(xshm_extension,[ --enable-xshm-extension Enable X11 MIT-SHM extension [default=yes]],xshm_extension="$enableval",xshm_extension="yes")
1048 if test "$xshm_extension" = "no" ; then
1051 AC_MSG_RESULT($xshm_extension)
1058 dnl See if the user wants dbus.library
1059 AC_MSG_CHECKING([if building of dbus.library is enabled])
1060 AC_ARG_ENABLE(dbus,[ --enable-dbus Enable DBUS support via dbus.library (default=no)],dbus="yes",dbus="no")
1061 if test "$dbus" = "yes" ; then
1063 DBUS_CFLAGS=`pkg-config --cflags dbus-1`
1064 DBUS_LIBFLAGS=`pkg-config --libs dbus-1`
1065 KERNEL_DBUS_KOBJ=kernel-dbus-kobj
1066 KERNEL_DBUS_INCLUDES=kernel-dbus-includes
1070 AC_MSG_RESULT($dbus)
1073 dnl --------------------------------------------------------------------
1074 dnl Configuration Output Section
1075 dnl --------------------------------------------------------------------
1080 AC_SUBST(aros_flavour)
1081 AC_SUBST(aros_flavour_uc)
1085 AC_SUBST(aros_host_arch)
1086 AC_SUBST(aros_host_cpu)
1087 AC_SUBST(aros_host_cc)
1088 AC_SUBST(aros_host_ld)
1089 AC_SUBST(aros_host_make)
1090 AC_SUBST(aros_host_cflags)
1091 AC_SUBST(aros_host_ldflags)
1092 AC_SUBST(aros_host_debug)
1093 AC_SUBST(aros_host_mkdep)
1094 AC_SUBST(aros_host_mkargs)
1095 AC_SUBST(aros_host_exe_suffix)
1096 AC_SUBST(aros_host_lib_suffix)
1097 AC_SUBST(aros_tools_dir)
1100 AC_SUBST(aros_target_arch)
1101 AC_SUBST(aros_target_cpu)
1102 AC_SUBST(aros_target_variant)
1103 AC_SUBST(aros_target_suffix)
1104 AC_SUBST(aros_target_incl)
1105 AC_SUBST(aros_target_cc)
1106 AC_SUBST(aros_target_cc_includes)
1107 AC_SUBST(aros_target_cc_path)
1108 AC_SUBST(aros_target_objdump)
1109 AC_SUBST(aros_target_objcopy)
1110 AC_SUBST(aros_target_strip)
1111 AC_SUBST(aros_target_as)
1112 AC_SUBST(aros_target_nm)
1113 AC_SUBST(aros_shared_default)
1114 AC_SUBST(aros_object_format)
1115 AC_SUBST(aros_compiler_libs)
1117 AC_SUBST(aros_config_cflags)
1118 AC_SUBST(aros_config_aflags)
1119 AC_SUBST(aros_target_ld)
1120 AC_SUBST(aros_config_ldflags)
1122 AC_SUBST(aros_shared_cflags)
1123 AC_SUBST(aros_shared_aflags)
1124 AC_SUBST(aros_shared_ldflags)
1125 AC_SUBST(aros_kernel_ldflags)
1126 AC_SUBST(aros_debug_cflags)
1127 AC_SUBST(aros_debug_aflags)
1128 AC_SUBST(aros_debug_ldflags)
1129 AC_SUBST(aros_target_genmap)
1132 AC_SUBST(aros_gui_libdir)
1133 AC_SUBST(aros_gui_ldflags)
1134 AC_SUBST(aros_gui_libflags)
1135 AC_SUBST(aros_gui_incdir)
1136 AC_SUBST(aros_gui_ccflags)
1138 AC_SUBST(aros_default_wbwidth)
1139 AC_SUBST(aros_default_wbheight)
1140 AC_SUBST(aros_default_wbdepth)
1141 AC_SUBST(DO_XSHM_SUPPORT)
1143 # Native version related
1144 AC_SUBST(aros_bochs_hack)
1145 AC_SUBST(aros_serial_debug)
1147 # Palm native version related
1148 AC_SUBST(aros_palm_debug_hack)
1150 # Unix/Hosted version related
1151 AC_SUBST(aros_nesting_supervisor)
1154 AC_SUBST(ENABLE_DBUS)
1155 AC_SUBST(DBUS_CFLAGS)
1156 AC_SUBST(DBUS_LIBFLAGS)
1157 AC_SUBST(KERNEL_DBUS_KOBJ)
1158 AC_SUBST(KERNEL_DBUS_INCLUDES)
1161 AC_SUBST(aros_debug)
1162 AC_SUBST(aros_mungwall_debug)
1163 AC_SUBST(aros_stack_debug)
1164 AC_SUBST(aros_modules_debug)
1166 # Collect-aros stuff: "-ius" to ignore undefined symbols
1167 AC_SUBST(ignore_undefined_symbols)
1169 # C compiler related
1170 AC_SUBST(gcc_target_cpu)
1172 dnl Prepare for output, make up all the generated patches
1173 case "$aros_flavour" in
1174 emulation) aros_flavour_uc="AROS_FLAVOUR_EMULATION"
1175 aros_flavour="emulation" ;;
1176 emulcompat) aros_flavour_uc="(AROS_FLAVOUR_EMULATION|AROS_FLAVOUR_BINCOMPAT)"
1177 aros_flavour="emulation" ;;
1178 standalone) aros_flavour_uc="AROS_FLAVOUR_STANDALONE"
1179 aros_flavour="standalone";;
1180 native) aros_flavour_uc="AROS_FLAVOUR_NATIVE"
1181 aros_flavour="native" ;;
1182 nativecompat) aros_flavour_uc="(AROS_FLAVOUR_NATIVE|AROS_FLAVOUR_BINCOMPAT)"
1183 aros_flavour="native" ;;
1184 linklib) aros_flavour_uc="AROS_FLAVOUR_LINKLIB"
1185 aros_flavour="linklib" ;;
1186 palmnative) aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
1187 aros_flavour="palmnative" ;;
1188 ppcnative) aros_flavour_uc="(AROS_FLAVOUR_NATIVE|AROS_FLAVOUR_BINCOMPAT)"
1189 aros_flavour="ppcnative" ;;
1192 if test -z "$aros_gui_basedir" ; then
1193 dnl Use X as the default GUI
1194 aros_gui_libdir="$x_libraries"
1195 if test -z "$x_libraries" ; then
1198 aros_gui_ldflags="-L $x_libraries"
1200 if test "$HAVE_XSHM_SUPPORT" = "1" ; then
1201 aros_gui_libflags="-lX11 -lXext"
1203 aros_gui_libflags="-lX11"
1205 aros_gui_incdir="$x_includes"
1206 if test -z "$x_includes" ; then
1209 aros_gui_ccflags="-I $x_includes"
1212 if test -n "$aros_gui_basedir" ; then
1213 aros_gui_libdir="${aros_gui_basedir}/lib"
1214 aros_gui_incdir="${aros_gui_basedir}/include"
1217 if test -n "$aros_gui_libdir" ; then
1218 aros_gui_ldflags="-L ${aros_gui_libdir}"
1221 if test -n "$aros_gui_incdir" ; then
1222 aros_gui_ccflags="-I ${aros_gui_incdir}"
1224 aros_gui_incdir="${aros_sysincludes}"
1229 if test ! -d ${aros_inc_dir} ; then
1230 ${MKDIR} ${aros_inc_dir}
1232 if test ! -d ${aros_geninc_dir} ; then
1233 ${MKDIR} ${aros_geninc_dir}
1235 if test ! -d ${aros_hostcfg_dir} ; then
1236 ${MKDIR} ${aros_hostcfg_dir}
1238 if test ! -d ${aros_targetcfg_dir} ; then
1239 ${MKDIR} ${aros_targetcfg_dir}
1241 if test ! -d ${aros_tools_dir} ; then
1242 ${MKDIR} ${aros_tools_dir}
1244 if test ! -d ${aros_scripts_dir} ; then
1245 ${MKDIR} ${aros_scripts_dir}
1248 AC_CONFIG_HEADERS(${aros_geninc_dir}/host-conf.h:config/host-conf.h.in)
1250 AC_CONFIG_COMMANDS([compiler_executable],
1252 prefix=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}
1254 prefix="${prefix}/${aros_target_cpu}-aros"
1255 prefix2=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros
1259 chmod a+x ${prefix2}-gcc ${prefix2}-ld
1261 ln -sf ${prefix2}-gcc ${prefix}-gcc
1262 ln -sf ${prefix2}-ld ${prefix}-ld
1264 ln -sf $aros_target_nm_ln ${prefix}-nm
1265 ln -sf $aros_target_ar_ln ${prefix}-ar
1266 ln -sf $aros_target_ranlib_ln ${prefix}-ranlib
1267 ln -sf $aros_target_objcopy_ln ${prefix}-objcopy
1268 ln -sf $aros_target_objdump_ln ${prefix}-objdump
1269 ln -sf $aros_target_strip_ln ${prefix}-strip
1271 ln -sf $aros_target_nm_ln ${prefix2}-nm
1272 ln -sf $aros_target_ar_ln ${prefix2}-ar
1273 ln -sf $aros_target_ranlib_ln ${prefix2}-ranlib
1274 ln -sf $aros_target_objcopy_ln ${prefix2}-objcopy
1275 ln -sf $aros_target_objdump_ln ${prefix2}-objdump
1276 ln -sf $aros_target_strip_ln ${prefix2}-strip
1279 aros_tools_dir=${aros_tools_dir}
1280 aros_target_cpu=${aros_target_cpu}
1281 aros_target_arch=${aros_target_arch}
1282 aros_target_suffix=${aros_target_suffix}
1283 aros_target_nm_ln=${aros_target_nm_ln}
1284 aros_target_ar_ln=${aros_target_ar_ln}
1285 aros_target_ranlib_ln=${aros_target_ranlib_ln}
1286 aros_target_objdump_ln=${aros_target_objdump_ln}
1287 aros_target_objcopy_ln=${aros_target_objcopy_ln}
1288 aros_target_strip_ln=${aros_target_strip_ln}
1291 AC_CONFIG_COMMANDS([genshared_executable],
1292 [chmod a+x ${aros_scripts_dir}/genshared],
1293 [aros_scripts_dir=${aros_scripts_dir}]
1295 AC_CONFIG_COMMANDS([genmf_executable],
1296 [chmod a+x ${aros_tools_dir}/genmf.py],
1297 [aros_tools_dir=${aros_tools_dir}]
1299 AC_CONFIG_COMMANDS([adflib_myaros.conf_executable],
1300 [chmod a+x tools/adflib/myconf.aros]
1306 ${aros_inc_dir}/config.h:config/config.h.in
1307 ${aros_geninc_dir}/config.h:config/config.h.in
1308 ${aros_hostcfg_dir}/host.cfg:config/host.cfg.in
1309 ${aros_targetcfg_dir}/target.cfg:config/target.cfg.in
1311 ${aros_targetcfg_dir}/make.defaults:config/make.defaults.in
1312 ${aros_targetcfg_dir}/specs:config/specs.in
1313 ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-gcc:scripts/aros-gcc.in
1314 ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-ld:scripts/aros-ld.in
1315 ${aros_scripts_dir}/genshared:compiler/c_lib/source/lib_source/genshared.in
1316 ${aros_tools_dir}/genmf.py:tools/genmf/genmf.py
1317 tools/adflib/myconf.aros
1322 dnl This is in order to not defined SHARED_CFLAGS sometimes
1323 dnl We don't always do aros_shared_ar, aros_shared_cflags
1325 #XXX compatability...
1326 aros_shared_ar="$aros_shared_ld $aros_shared_ldflags -o"
1328 if test -n "$aros_shared_cflags" ; then
1329 echo "SHARED_CFLAGS := $aros_shared_cflags" >> ${aros_hostcfg_dir}/host.cfg
1330 echo "SHARED_AR := $aros_shared_ar" >> ${aros_hostcfg_dir}/host.cfg