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.
95 aros_host_debug="-g -O0"
96 aros_host_mkdep="\$(TOP)/scripts/mkdep"
97 aros_host_mkargs="--no-print-directory"
98 aros_host_incl="/usr/include"
99 aros_host_exe_suffix="$EXEEXT"
100 aros_host_lib_suffix=""
104 aros_host_cc_pipe="-pipe"
114 dnl Despite the name, this is really a host configuration variable.
115 aros_target_cc_includes=""
117 # This is the main host configuration section. It is where the host
118 # can change the values of any variables it needs to change. We do
119 # not look at anything that compiles to the target yet, we'll get
124 aros_host_arch="linux"
125 aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
137 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
138 aros_host_cpu="$host_cpu"
144 aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
145 aros_host_make="gmake"
146 aros_host_arch="freebsd"
149 dnl Need to override this here, it's just too hard later.
150 dnl This shouldn't be here at all...
151 aros_target_cc_includes="/usr/include"
153 dnl FreeBSD 5.x has changed the default object format.
156 aros_object_format="elf_i386_fbsd"
160 aros_object_format="elf_i386"
166 aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
167 aros_host_make="gmake"
168 aros_host_arch="netbsd"
177 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
178 aros_host_cpu="$host_cpu"
181 aros_host_lib_suffix=".0.0"
185 aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
186 aros_host_make="gmake"
187 aros_host_arch="openbsd"
193 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
194 aros_host_cpu="$host_cpu"
200 aros_host_arch="solaris"
201 aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
204 aros_host_cpu="sparc"
207 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
208 aros_host_cpu="$host_cpu"
214 aros_host_cc="$aros_host_cc"
215 aros_host_arch="morphos"
220 aros_host_arch="amiga"
225 TOUCH="/gg/bin/touch"
234 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
235 aros_host_cpu="$host_cpu"
241 aros_host_arch="cygwin"
242 aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
248 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
249 aros_host_cpu="$host_cpu"
254 AC_MSG_ERROR([Unsupported host architecture $host])
258 AROS_PROG(HOST_AR,[ar],[cr])
259 AROS_REQUIRED(ar,$HOST_AR)
260 AROS_PROG(HOST_RANLIB,ranlib)
262 AROS_PROG(RM,[rm],[-rf])
263 AROS_REQUIRED(rm,$RM)
265 AROS_REQUIRED(cp,$CP)
267 AROS_REQUIRED(mv,$MV)
268 AROS_PROG(ECHO,[echo])
269 AROS_REQUIRED(echo,$ECHO)
270 AROS_PROG(MKDIR,[mkdir],[-p])
271 AROS_REQUIRED(mkdir,$MKDIR)
272 AROS_PROG(TOUCH,[touch])
273 AROS_REQUIRED(touch,$TOUCH)
274 AROS_PROG(SORT,[sort])
275 AROS_REQUIRED(sort,$SORT)
276 AROS_PROG(UNIQ,[uniq])
277 AROS_REQUIRED(uniq,$UNIQ)
278 AROS_PROG(NOP,[true])
279 AROS_REQUIRED(true,$NOP)
281 AROS_REQUIRED(cat,$CAT)
282 AROS_PROG(BISON,[bison])
283 AROS_REQUIRED(bison,$BISON)
284 AROS_PROG(PNGTOPNM,[pngtopnm])
285 AROS_REQUIRED(pngtopnm,$PNGTOPNM)
286 AROS_PROG(PPMTOILBM,[ppmtoilbm])
287 AROS_REQUIRED(ppmtoilbm,$PPMTOILBM)
288 AROS_PROG(STRIP,[strip])
289 AROS_REQUIRED(strip,$STRIP)
291 AROS_REQUIRED(sed,$SED)
292 AROS_PROG(CHMOD,[chmod])
293 AROS_REQUIRED(chmod,$CHMOD)
295 AM_PATH_PYTHON(2.2.1)
304 dnl ---------------------------------------------------------------------------
305 dnl Look for things about the host system, good for hosted targets.
306 dnl ---------------------------------------------------------------------------
308 # Check for some includes for the X11 HIDD and the kernel
309 AC_CHECK_HEADERS([sys/ipc.h sys/shm.h \
310 sys/mmap.h sys/mman.h sysexits.h \
311 sys/statfs.h sys/statvfs.h sys/vfs.h sys/param.h \
314 AC_CHECK_HEADERS([sys/mount.h],,,[#include <sys/param.h>])
331 AC_CHECK_MEMBERS(struct tm.tm_gmtoff)
333 # Look for some functions
334 AC_CHECK_FUNCS([getpagesize kqueue statfs statvfs \
335 clone kse_create rfork_thread thr_create sa_register \
336 getcontext makecontext setcontext sigaltstack swapcontext])
344 dnl --------------------------------------------------------------------
345 dnl Target Configuration Section
346 dnl --------------------------------------------------------------------
348 dnl The target configuration section is responsible for setting up all
349 dnl the paths for includes, and tools required to build AROS to some
350 dnl particular target.
352 # Find all the tools we need to compile. This could be cross-compiling
353 # though! If that is the case we use the GNU form of the target and
354 # simply add this to the front of the binary name. This is rather simple,
355 # but it should work under most circumstances.
357 # The default tools are to use the same as the host, but only if the
358 # host and target CPU are the same. With GCC this is normally enough.
362 aros_target_cc="$aros_host_cc"
363 aros_target_as="$aros_host_cc"
364 aros_shared_ld="$aros_host_ld"
365 aros_kernel_ld="$aros_host_ld"
366 aros_target_ld="/usr/bin/ld"
368 aros_target_mkdep="$aros_host_mkdep"
369 aros_target_incl_def="$aros_host_incl"
373 aros_target_ar_flags="cr"
375 aros_target_nm_flags="-C -ul"
376 aros_target_objcopy="objcopy"
377 aros_target_objdump="objdump"
378 aros_target_ranlib="ranlib"
379 aros_target_strip="strip"
381 # It is necessary to clear the include and link paths for target
382 # commands. This should help clear up problems when cross compiling.
383 aros_config_cflags="-Wall -Werror-implicit-function-declaration"
384 aros_config_aflags="-Wall -x assembler-with-cpp"
385 aros_config_ldflags=""
387 aros_shared_default=yes
389 aros_shared_cflags="-fPIC"
390 aros_shared_aflags=""
391 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
392 aros_kernel_ldflags="-Wl,-rpath,./lib"
396 aros_target_genmap="-Wl,-Map -Xlinker"
398 # Native flavour stuff
400 aros_serial_debug="0"
402 # Palm native flavour stuff
403 aros_palm_debug_hack="0"
406 aros_nesting_supervisor="0"
408 # Collect-aros stuff: "-ius" to ignore undefined symbols
409 ignore_undefined_symbols=""
415 #-----------------------------------------------------------------------------
417 AC_MSG_CHECKING([for type of build])
418 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")
420 if test "$build_type" = "nightly"; then
421 build_type_string="NIGHTLY"
422 elif test "$build_type" = "snapshot"; then
423 build_type_string="SNAPSHOT"
424 elif test "$build_type" = "milestone"; then
425 build_type_string="MILESTONE"
426 elif test "$build_type" = "release"; then
427 build_type_string="RELEASE"
429 build_type_string="PERSONAL"
430 build_type="personal"
433 aros_config_cflags="$aros_config_cflags -DAROS_BUILD_TYPE=AROS_BUILD_TYPE_$build_type_string"
435 AC_MSG_RESULT($build_type)
437 #-----------------------------------------------------------------------------
438 all_debug_types="messages stack mungwall modules symbols"
440 AC_MSG_CHECKING([which debug types to enable])
441 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)]),
442 debug="$enableval",debug="")
444 if test "$debug" = "" -o "$debug" = "no"; then
446 elif test "$debug" = "yes"; then
450 if test "$debug" = "all" ; then
451 debug=$all_debug_types
452 for d in $all_debug_types; do
453 export aros_${d}_debug="1"
456 for d in $all_debug_types; do
457 export aros_${d}_debug="0"
461 if test "$debug" != "none"; then
462 debug=`echo $debug | sed s/,/\ /g`
465 for d2 in $all_debug_types; do
466 if test "$d2" = "$d"; then
471 if test "$found" = "0"; then
472 AC_MSG_ERROR([unrecognized debug type "$d". Available types are: all none $all_debug_types])
474 export aros_${d}_debug="1"
478 AC_MSG_RESULT($debug)
480 if test "$aros_messages_debug" = "1"; then
481 aros_messages_debug="-DADEBUG=1 -DMDEBUG=1"
483 aros_messages_debug=""
485 if test "$aros_symbols_debug" = "1"; then
486 aros_symbols_debug="-g"
488 aros_symbols_debug=""
491 # These are the flags to pass when compiling debugged programs
492 aros_debug_cflags="$aros_symbols_debug $aros_messages_debug"
494 aros_debug_ldflags="$aros_symbols_debug"
496 #-----------------------------------------------------------------------------
497 # Checking for distcc and ccache.
499 # Always apply the transforms in this particular order. Basically you should
500 # always run 'ccache distcc compiler' in that order for the best performance.
502 AC_MSG_CHECKING([whether to enable distcc])
503 AC_ARG_ENABLE(distcc,AC_HELP_STRING([--enable-distcc],[Use distcc as a front end to the compiler (default=no).]),distcc="$enableval",distcc="no")
504 if test "$distcc" != "" -a "$distcc" != "no"; then
505 # AC_CHECK_PROG will print out the result in this case
506 AC_PATH_PROG(DISTCC,[distcc],distcc,no)
511 AC_MSG_CHECKING([whether to enable ccache])
512 AC_ARG_ENABLE(ccache,AC_HELP_STRING([--enable-ccache],[Use ccache as a front end to the compiler (default=no).]),ccache="$enableval",ccache="no")
513 if test "$ccache" != "" -a "$ccache" != "no"; then
514 # AC_CHECK_PROG will print out the result in this case
515 AC_CHECK_PROG(CCACHE,[ccache],ccache,no)
520 #-----------------------------------------------------------------------------
521 AC_MSG_CHECKING([what optimization flags to use])
522 AC_ARG_WITH(optimization,AC_HELP_STRING([--with-optimization=FLAGS],[Use optimization flags FLAGS (default=-O2).]),optimization="$withval",optimization="unknown")
523 if test "$optimization" = "unknown"; then
524 dnl default is -O2 for normal builds, -O0 for debug builds
525 if test "$debug" != "none"; then
531 aros_config_cflags="$aros_config_cflags $optimization"
532 AC_MSG_RESULT($optimization)
534 #-----------------------------------------------------------------------------
535 AC_MSG_CHECKING([what target variant to enable])
536 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")
537 if test "$target_variant" = "none"; then
538 aros_target_variant=""
539 aros_target_suffix=""
541 aros_target_variant="$target_variant"
542 aros_target_suffix="-$target_variant"
544 AC_MSG_RESULT($enableval)
546 #-----------------------------------------------------------------------------
547 # This is the target configuration switch.
550 aros_target_arch="linux"
551 case "$target_cpu" in
553 aros_target_cpu="m68k"
554 aros_object_format="m68kelf"
555 aros_flavour="emulcompat"
556 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D__mc68000 -D__linux__"
557 aros_shared_ldflags="-Wl,-T,\$(TOP)/config/linux/m68k/script.so"
558 aros_kernel_ldflags="-Wl,-rpath,./lib,-T,\$(TOP)/config/linux/m68k/script.normal"
559 gcc_target_cpu="mc68000"
562 aros_target_cpu="i386"
563 aros_object_format="elf_i386"
564 aros_flavour="emulation"
565 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__linux__"
566 aros_default_wbdepth=8
567 gcc_target_cpu="i386"
570 aros_target_cpu="ppc"
571 aros_object_format="elf32ppc"
572 aros_flavour="emulation"
573 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc -D__linux__"
574 aros_default_wbdepth=8
575 aros_compiler_libs="-lgcc"
579 AC_MSG_ERROR("Unknown CPU for Linux -- $target_cpu")
585 aros_target_arch="pc"
586 aros_shared_default="no"
587 case "$target_cpu" in
589 aros_target_cpu="i386"
591 dnl If somebody hasn't already set the target object
592 dnl format, then use this value. Mostly to support
593 dnl FreeBSD cross-compilation.
594 dnl TODO: Remove when we always use our compiler.
596 if test "$aros_object_format" = "" ; then
597 aros_object_format="elf_i386"
599 aros_flavour="standalone"
600 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
601 aros_kernel_ldflags=""
602 aros_default_wbwidth=640
603 aros_default_wbheight=480
604 gcc_target_cpu="i386"
607 AC_MSG_ERROR("Unknown native CPU -- $target_cpu")
613 aros_target_arch="prep"
614 aros_shared_default="no"
615 aros_target_cpu="ppc"
616 aros_object_format="elf32ppc"
617 aros_flavour="ppcnative"
618 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
619 aros_kernel_ldflags=""
620 aros_default_wbwidth=640
621 aros_default_wbheight=480
623 case "$target_cpu" in
625 aros_target_cc="ppc-linux-gcc -pipe"
626 aros_target_ld="ppc-linux-ld"
627 aros_target_as="ppc-linux-as"
628 aros_target_ar="ppc-linux-ar"
629 aros_target_ranlib="ppc-linux-ranlib"
630 aros_target_nm="ppc-linux-nm"
631 aros_target_strip="ppc-linux-strip"
632 aros_target_objcopy="ppc-linux-objcopy"
633 aros_target_objdump="ppc-linux-objdump"
634 aros_shared_ld="ppc-linux-ld"
635 aros_kernel_ld="ppc-linux-ld"
643 aros_target_arch="freebsd"
644 aros_target_cpu="i386"
645 aros_flavour="emulation"
646 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
647 gcc_target_cpu="i386"
653 aros_target_arch="netbsd"
654 case "$target_cpu" in
656 aros_target_cpu="m68k"
657 aros_object_format="m68kelf"
658 aros_flavour="emulcompat"
659 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D__mc68000 -D__NetBSD__"
660 gcc_target_cpu="mc68000"
663 aros_target_cpu="i386"
664 aros_object_format="elf_i386"
665 aros_flavour="emulation"
666 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__NetBSD__"
667 aros_default_wbdepth=8
668 gcc_target_cpu="i386"
671 AC_MSG_ERROR("Unknown CPU for NetBSD -- $target_cpu")
674 aros_target_genmap="-Wl,-M -Xlinker >"
675 aros_flavour="emulation"
676 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
680 aros_target_arch="openbsd"
681 case "$target_cpu" in
683 aros_target_cpu="i386"
684 aros_object_format="elf_i386"
685 aros_flavour="emulation"
686 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__OpenBSD__"
687 gcc_target_cpu="i386"
690 AC_MSG_ERROR("Unknown CPU for OpenBSD -- $target_cpu")
693 aros_target_genmap="-Wl,-M -Xlinker >"
694 aros_target_nm_flags="-u"
695 aros_flavour="emulation"
699 aros_target_arch="solaris"
700 case "$target_cpu" in
702 aros_target_cpu="sparc"
703 aros_object_format="elf_sparc"
704 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dsparc -D__Solaris__"
705 gcc_target_cpu="sparc"
708 AC_MSG_ERROR("Unknown CPU for Solaris -- $target_cpu")
711 aros_config_cflags="$aros_config_cflags -D$aros_target_cpu"
712 aros_flavour="emulation"
716 aros_target_arch="morphos"
717 aros_shared_default="no"
718 aros_target_cpu="ppc"
719 aros_object_format="elf_ppc"
720 aros_flavour="nativecompat"
721 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
726 aros_target_arch="amiga"
727 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D_AMIGA -DAMIGA"
728 aros_shared_default="no"
730 aros_config_cflags="$aros_config_cflags -fomit-frame-pointer -fbuiltin -ffreestanding"
732 case "$target_cpu" in
734 aros_target_cpu="m68k"
735 aros_object_format="m68kelf"
736 aros_flavour="nativecompat"
737 gcc_target_cpu="mc68000"
741 aros_flavour="native"
745 AC_MSG_ERROR("Unknown CPU for Amiga $target_cpu")
751 aros_target_arch="cygwin"
752 aros_shared_default="no"
753 case "$target_cpu" in
755 aros_target_cpu="i386"
756 aros_object_format="elf_i386"
757 aros_flavour="emulation"
758 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__CYGWIN32__"
759 aros_shared_cflags=""
760 aros_default_wbdepth=8
761 gcc_target_cpu="i386"
764 AC_MSG_ERROR("Unknown CPU for CygWin -- $target_cpu")
769 aros_target_arch="pp"
770 aros_shared_default="no"
771 case "$target_cpu" in
773 aros_target_cpu="m68k"
774 aros_object_format="m68kelf"
775 aros_flavour="palmnative"
776 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
777 aros_kernel_ldflags=""
778 aros_default_wbwidth=160
779 aros_default_wbheight=160
780 aros_default_wbdepth=1
781 aros_target_cc="m68k-elf-gcc -pipe"
782 aros_target_ld="$(which m68k-elf-ld)"
783 aros_target_as="m68k-elf-gcc -pipe"
784 aros_shared_ld="m68k-elf-gcc"
785 aros_kernel_ld="m68k-elf-gcc"
786 aros_target_ar="m68k-elf-ar"
787 aros_target_ar_flags="cru"
788 aros_target_ranlib="m68k-elf-ranlib"
789 aros_target_nm="m68k-elf-nm"
790 aros_target_objcopy="m68k-elf-objcopy"
791 aros_target_objdump="m68k-elf-objdump"
792 aros_compiler_libs="-lgcc1"
793 aros_shared_default=no
794 aros_shared_cflags="-fpic"
795 aros_shared_aflags=""
796 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
797 aros_kernel_ldflags="-Wl,-rpath,./lib"
798 aros_debug_cflags="-Wall -Werror-implicit-function-declaration $aros_symbols_debug $aros_messages_debug -mc68000 -Wa,-mc68000"
800 aros_debug_ldflags="$aros_symbols_debug"
801 aros_mungwall_debug="0"
802 aros_modules_debug="0"
803 gcc_target_cpu="mc68000"
804 ignore_undefined_symbols="-ius"
807 AC_MSG_ERROR("Unknown CPU for PalmPilot -- $target_cpu")
813 AC_MSG_ERROR([Unsupported target architecture $target])
817 aros_hostcfg_dir="bin/${aros_host_arch}-${aros_host_cpu}/gen/config"
818 aros_targetcfg_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/config"
819 aros_inc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/AROS/Development/include/aros"
820 aros_geninc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/include/aros"
821 aros_tools_dir="bin/${aros_host_arch}-${aros_host_cpu}/tools"
822 aros_scripts_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/scripts"
824 # aros_cc_pre is a variable that is added to the front of the compiler name
825 # in the generated aros-gcc shell script. We need this to enable the cache
826 # to work across cleaned builds. Also, support DISTCC using the correct
827 # environment variable.
830 if test "x${DISTCC}" != "x" ; then
831 if test "x${CCACHE}" != "x" ; then
832 aros_cc_pre="env CCACHE_PREFIX=${DISTCC} ${CCACHE} "
834 aros_cc_pre="${DISTCC} "
837 if test "x${CCACHE}" != "x" ; then
838 aros_cc_pre="${CCACHE} "
842 TARGET_CC="${TOPDIR}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-gcc"
846 NOSTDINC_CFLAGS=-nostdinc
848 NOSTARTUP_LDFLAGS=-nostartfiles
850 DETACH_LDFLAGS=-detach
851 NOSTDLIB_LDFLAGS=-nostdlib
856 AC_SUBST(NOSTDINC_CFLAGS)
857 AC_SUBST(NOSTARTUP_LDFLAGS)
858 AC_SUBST(NIX_LDFLAGS)
859 AC_SUBST(DETACH_LDFLAGS)
860 AC_SUBST(NOSTDLIB_LDFLAGS)
861 AC_SUBST(aros_cc_pre)
863 AROS_TOOL_CC(SHARED_LD,$aros_shared_ld)
864 AROS_TOOL_CC(KERNEL_LD,$aros_kernel_ld)
866 AROS_TOOL(AR,$aros_target_ar,$aros_target_ar_flags)
867 AROS_TOOL(RANLIB,$aros_target_ranlib,$aros_target_ranlib_flags)
868 AROS_TOOL(NM,$aros_target_nm,$aros_target_nm_flags)
869 AROS_TOOL(NM_PLAIN,$aros_target_nm,)
870 AROS_TOOL(STRIP,$aros_target_strip,$aros_target_strip_flags)
871 AROS_TOOL(OBJDUMP,$aros_target_objdump)
872 AROS_TOOL(OBJCOPY,$aros_target_objcopy)
874 #-----------------------------------------------------------------------------
875 # See if we can compile SHM support
877 if [[ "x$no_x" != "xyes" -a "x$ac_cv_header_sys_ipc_h" = "xyes" -a "x$ac_cv_header_sys_shm_h" = "xyes" ]]; then
878 AC_MSG_CHECKING(whether the X11 MIT-SHM extension can be compiled in)
879 if test -z "$x_includes" ; then
882 CFLAGS="-I $x_includes"
884 LIBS="-L/usr/X11/lib -L/usr/X11R6/lib -lX11 -lXext"
886 #include <sys/types.h>
887 #include <X11/Xlib.h>
888 #include <X11/Xutil.h>
889 #include <X11/keysym.h>
890 #include <X11/cursorfont.h>
893 #include <X11/extensions/XShm.h>],[
894 static XShmSegmentInfo shminfo;
895 static Display *display;
896 XShmAttach(display, &shminfo);
898 shmctl(shminfo.shmid, IPC_RMID, 0);
907 # Find the system include path. We can suggest that an alternative is
908 # used if we don't get it correct. The default is to use /usr/include.
909 # Which is set in the aros_target_incl_def variable.
911 AC_ARG_ENABLE(includes,
912 [ --enable-includes=dir Alternative system include directory],
913 [aros_target_incl=$enable_includes], [aros_target_incl=$aros_target_incl_def])
915 dnl find out about the target cc's include path
916 AC_MSG_CHECKING([for the target compiler's include path])
917 if test "$aros_target_cc_includes" = "" ; then
918 aros_target_cc_includes=`dirname \`${aros_target_cc} -print-libgcc-file-name\``/include
920 AC_MSG_RESULT($aros_target_cc_includes)
922 dnl Check if user specified --with-resolution=XRESxYRESxDEPTH
923 AC_MSG_CHECKING([for default resolution of WBScreen])
924 AC_ARG_WITH(resolution,[ --with-resolution=XRESxYRESxDEPTH Default resolution of the initial WorkbenchScreen],resolution=$withval,resolution=none)
925 # We require an argument, so map --with/--without ("yes"/"no") to "none" specified
926 if test "$resolution" = "yes" ; then
929 if test "$resolution" = "no" ; then
932 if test "$resolution" != "none" ; then
933 aros_default_wbwidth=`echo $resolution | cut -d'x' -f1`
934 aros_default_wbheight=`echo $resolution | cut -d'x' -f2`
935 aros_default_wbdepth=`echo $resolution | cut -d'x' -f3`
937 AC_MSG_RESULT($aros_default_wbwidth x $aros_default_wbheight x $aros_default_wbdepth)
938 aros_cv_default_wbwidth=$aros_default_wbwidth
939 aros_cv_default_wbheight=$aros_default_wbheight
940 aros_cv_default_wbdepth=$aros_default_wbdepth
942 dnl See if the user wants the BOCHS hack for native flavour
943 AC_MSG_CHECKING([if bochs hack is enabled])
944 AC_ARG_ENABLE(bochs_hack,[ --enable-bochs-hack Enable hacks to make BOCHS (partly) work (default=no)],bochs_hack="yes",bochs_hack="no")
945 if test "$bochs_hack" = "yes" ; then
948 AC_MSG_RESULT($bochs_hack)
950 dnl See if the user wants the serial debug output for native flavour
951 AC_MSG_CHECKING([if serial debug is enabled])
952 AC_ARG_WITH(serial-debug,[ --with-serial-debug Enable serial debug output in native (default=no)],serial_debug=$withval,serial_debug=none)
953 if test "$serial_debug" = "yes" ; then
956 if test "$serial_debug" = "no" ; then
959 if test "$serial_debug" != "none" ; then
960 aros_serial_debug=$serial_debug
961 AC_MSG_RESULT(on port $serial_debug)
966 dnl See if the user wants the palm debug output hack for palm native flavour
967 AC_MSG_CHECKING([if palm debug hack is enabled])
968 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")
969 if test "$palm_debug_hack" = "yes" ; then
970 aros_palm_debug_hack="1"
972 AC_MSG_RESULT($palm_debug_hack)
975 dnl See if the user wants nesting supervisor activated for unix flavour
976 AC_MSG_CHECKING([if nesting supervisor support is enabled])
977 AC_ARG_ENABLE(nesting_supervisor,[ --enable-nesting-supervisor Enable nesting supervisor support in unix (default=no)],nesting_supervisor="yes",nesting_supervisor="no")
978 if test "$nesting_supervisor" = "yes" ; then
979 aros_nesting_supervisor="1"
981 AC_MSG_RESULT($nesting_supervisor)
985 if test "$HAVE_XSHM_SUPPORT" = "1" ; then
986 dnl See if the user wants the X11 MIT-SHM extension to be enabled
987 AC_MSG_CHECKING([if X11 MIT-SHM extension is enabled])
988 AC_ARG_ENABLE(xshm_extension,[ --enable-xshm-extension Enable X11 MIT-SHM extension [default=yes]],xshm_extension="$enableval",xshm_extension="yes")
989 if test "$xshm_extension" = "no" ; then
992 AC_MSG_RESULT($xshm_extension)
997 dnl --------------------------------------------------------------------
998 dnl Configuration Output Section
999 dnl --------------------------------------------------------------------
1004 AC_SUBST(aros_flavour)
1005 AC_SUBST(aros_flavour_uc)
1009 AC_SUBST(aros_host_arch)
1010 AC_SUBST(aros_host_cpu)
1011 AC_SUBST(aros_host_cc)
1012 AC_SUBST(aros_host_ld)
1013 AC_SUBST(aros_host_make)
1014 AC_SUBST(aros_host_cflags)
1015 AC_SUBST(aros_host_ldflags)
1016 AC_SUBST(aros_host_debug)
1017 AC_SUBST(aros_host_mkdep)
1018 AC_SUBST(aros_host_mkargs)
1019 AC_SUBST(aros_host_exe_suffix)
1020 AC_SUBST(aros_host_lib_suffix)
1023 AC_SUBST(aros_target_arch)
1024 AC_SUBST(aros_target_cpu)
1025 AC_SUBST(aros_target_variant)
1026 AC_SUBST(aros_target_suffix)
1027 AC_SUBST(aros_target_incl)
1028 AC_SUBST(aros_target_cc)
1029 AC_SUBST(aros_target_cc_includes)
1030 AC_SUBST(aros_target_objdump)
1031 AC_SUBST(aros_target_objcopy)
1032 AC_SUBST(aros_target_strip)
1033 AC_SUBST(aros_target_as)
1034 AC_SUBST(aros_target_nm)
1035 AC_SUBST(aros_shared_default)
1036 AC_SUBST(aros_object_format)
1037 AC_SUBST(aros_compiler_libs)
1039 AC_SUBST(aros_config_cflags)
1040 AC_SUBST(aros_config_aflags)
1041 AC_SUBST(aros_target_ld)
1042 AC_SUBST(aros_config_ldflags)
1044 AC_SUBST(aros_shared_cflags)
1045 AC_SUBST(aros_shared_aflags)
1046 AC_SUBST(aros_shared_ldflags)
1047 AC_SUBST(aros_kernel_ldflags)
1048 AC_SUBST(aros_debug_cflags)
1049 AC_SUBST(aros_debug_aflags)
1050 AC_SUBST(aros_debug_ldflags)
1051 AC_SUBST(aros_target_genmap)
1054 AC_SUBST(aros_gui_libdir)
1055 AC_SUBST(aros_gui_ldflags)
1056 AC_SUBST(aros_gui_libflags)
1057 AC_SUBST(aros_gui_incdir)
1058 AC_SUBST(aros_gui_ccflags)
1060 AC_SUBST(aros_default_wbwidth)
1061 AC_SUBST(aros_default_wbheight)
1062 AC_SUBST(aros_default_wbdepth)
1063 AC_SUBST(DO_XSHM_SUPPORT)
1065 # Native version related
1066 AC_SUBST(aros_bochs_hack)
1067 AC_SUBST(aros_serial_debug)
1069 # Palm native version related
1070 AC_SUBST(aros_palm_debug_hack)
1072 # Unix/Hosted version related
1073 AC_SUBST(aros_nesting_supervisor)
1076 AC_SUBST(aros_debug)
1077 AC_SUBST(aros_mungwall_debug)
1078 AC_SUBST(aros_stack_debug)
1079 AC_SUBST(aros_modules_debug)
1081 # Collect-aros stuff: "-ius" to ignore undefined symbols
1082 AC_SUBST(ignore_undefined_symbols)
1084 # C compiler related
1085 AC_SUBST(gcc_target_cpu)
1087 dnl Prepare for output, make up all the generated patches
1088 case "$aros_flavour" in
1089 emulation) aros_flavour_uc="AROS_FLAVOUR_EMULATION"
1090 aros_flavour="emulation" ;;
1091 emulcompat) aros_flavour_uc="(AROS_FLAVOUR_EMULATION|AROS_FLAVOUR_BINCOMPAT)"
1092 aros_flavour="emulation" ;;
1093 standalone) aros_flavour_uc="AROS_FLAVOUR_STANDALONE"
1094 aros_flavour="standalone";;
1095 native) aros_flavour_uc="AROS_FLAVOUR_NATIVE"
1096 aros_flavour="native" ;;
1097 nativecompat) aros_flavour_uc="(AROS_FLAVOUR_NATIVE|AROS_FLAVOUR_BINCOMPAT)"
1098 aros_flavour="native" ;;
1099 linklib) aros_flavour_uc="AROS_FLAVOUR_LINKLIB"
1100 aros_flavour="linklib" ;;
1101 palmnative) aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
1102 aros_flavour="palmnative" ;;
1103 ppcnative) aros_flavour_uc="(AROS_FLAVOUR_NATIVE|AROS_FLAVOUR_BINCOMPAT)"
1104 aros_flavour="ppcnative" ;;
1107 if test -z "$aros_gui_basedir" ; then
1108 dnl Use X as the default GUI
1109 aros_gui_libdir="$x_libraries"
1110 if test -z "$x_libraries" ; then
1113 aros_gui_ldflags="-L $x_libraries"
1115 if test "$HAVE_XSHM_SUPPORT" = "1" ; then
1116 aros_gui_libflags="-lX11 -lXext"
1118 aros_gui_libflags="-lX11"
1120 aros_gui_incdir="$x_includes"
1121 if test -z "$x_includes" ; then
1124 aros_gui_ccflags="-I $x_includes"
1127 if test -n "$aros_gui_basedir" ; then
1128 aros_gui_libdir="${aros_gui_basedir}/lib"
1129 aros_gui_incdir="${aros_gui_basedir}/include"
1132 if test -n "$aros_gui_libdir" ; then
1133 aros_gui_ldflags="-L ${aros_gui_libdir}"
1136 if test -n "$aros_gui_incdir" ; then
1137 aros_gui_ccflags="-I ${aros_gui_incdir}"
1139 aros_gui_incdir="${aros_sysincludes}"
1144 if test ! -d ${aros_inc_dir} ; then
1145 ${MKDIR} ${aros_inc_dir}
1147 if test ! -d ${aros_geninc_dir} ; then
1148 ${MKDIR} ${aros_geninc_dir}
1150 if test ! -d ${aros_hostcfg_dir} ; then
1151 ${MKDIR} ${aros_hostcfg_dir}
1153 if test ! -d ${aros_targetcfg_dir} ; then
1154 ${MKDIR} ${aros_targetcfg_dir}
1156 if test ! -d ${aros_tools_dir} ; then
1157 ${MKDIR} ${aros_tools_dir}
1159 if test ! -d ${aros_scripts_dir} ; then
1160 ${MKDIR} ${aros_scripts_dir}
1163 AC_CONFIG_HEADERS(${aros_geninc_dir}/host-conf.h:config/host-conf.h.in)
1165 AC_CONFIG_COMMANDS([compiler_executable],
1167 chmod a+x ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-gcc
1169 prefix=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}
1171 prefix=${prefix}/${aros_target_cpu}-aros
1172 prefix2=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros
1174 ln -sf ${prefix2}-gcc ${prefix}-gcc
1176 ln -sf `which $aros_target_ld` ${prefix}-ld
1177 ln -sf `which $aros_target_nm` ${prefix}-nm
1178 ln -sf `which $aros_target_ar` ${prefix}-ar
1179 ln -sf `which $aros_target_ranlib` ${prefix}-ranlib
1180 ln -sf `which $aros_target_objcopy` ${prefix}-objcopy
1181 ln -sf `which $aros_target_objdump` ${prefix}-objdump
1183 ln -sf `which $aros_target_ld` ${prefix2}-ld
1184 ln -sf `which $aros_target_nm` ${prefix2}-nm
1185 ln -sf `which $aros_target_ar` ${prefix2}-ar
1186 ln -sf `which $aros_target_ranlib` ${prefix2}-ranlib
1187 ln -sf `which $aros_target_objcopy` ${prefix2}-objcopy
1188 ln -sf `which $aros_target_objdump` ${prefix2}-objdump
1191 aros_tools_dir=${aros_tools_dir}
1192 aros_target_cpu=${aros_target_cpu}
1193 aros_target_arch=${aros_target_arch}
1194 aros_target_suffix=${aros_target_suffix}
1195 aros_target_ld=${aros_target_ld}
1196 aros_target_nm=${aros_target_nm}
1197 aros_target_ar=${aros_target_ar}
1198 aros_target_ranlib=${aros_target_ranlib}
1199 aros_target_objdump=${aros_target_objdump}
1200 aros_target_objcopy=${aros_target_objcopy}
1203 AC_CONFIG_COMMANDS([genshared_executable],
1204 [chmod a+x ${aros_scripts_dir}/genshared],
1205 [aros_scripts_dir=${aros_scripts_dir}]
1207 AC_CONFIG_COMMANDS([genmf_executable],
1208 [chmod a+x ${aros_tools_dir}/genmf.py],
1209 [aros_tools_dir=${aros_tools_dir}]
1214 ${aros_inc_dir}/config.h:config/config.h.in
1215 ${aros_geninc_dir}/config.h:config/config.h.in
1216 ${aros_hostcfg_dir}/host.cfg:config/host.cfg.in
1217 ${aros_targetcfg_dir}/target.cfg:config/target.cfg.in
1219 ${aros_targetcfg_dir}/make.defaults:config/make.defaults.in
1220 ${aros_targetcfg_dir}/specs:config/specs.in
1221 ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-gcc:scripts/aros-gcc.in
1222 ${aros_scripts_dir}/genshared:compiler/c_lib/source/lib_source/genshared.in
1223 ${aros_tools_dir}/genmf.py:tools/genmf/genmf.py
1228 dnl This is in order to not defined SHARED_CFLAGS sometimes
1229 dnl We don't always do aros_shared_ar, aros_shared_cflags
1231 #XXX compatability...
1232 aros_shared_ar="$aros_shared_ld $aros_shared_ldflags -o"
1234 if test -n "$aros_shared_cflags" ; then
1235 echo "SHARED_CFLAGS := $aros_shared_cflags" >> ${aros_hostcfg_dir}/host.cfg
1236 echo "SHARED_AR := $aros_shared_ar" >> ${aros_hostcfg_dir}/host.cfg