Using host_cc as kernel_cc is not very crosscompiling friendly.
[AROS.git] / configure.in
blobb91a0a55ad31223b187cdece75a9edb0af470897
1 dnl Copyright © 1997-2009, The AROS Development Team. All rights reserved.
2 dnl $Id$
3 dnl
4 dnl Desc: Autoconf source for configuration file
5 dnl Lang: english
7 #TODO
8 # method of getting shared/non-shared ld/ar tool for target.
11 # ------------------------------------------------------------------------
12 # Here starts the first section of the configure.in file.
13 # ------------------------------------------------------------------------
15 AC_INIT(mmakefile)
16 AC_PREREQ(2.61)
17 AC_CONFIG_AUX_DIR(scripts/autoconf)
19 # Check what host we are running on.
20 # If a target is not suggested, we use this one.
21 # Note that what we call a target, Autoconf calls a host.
22 AC_CANONICAL_HOST
24 # The AROS target is slightly different to the normal GNU style
25 # format. We don't have the middle part, and we reverse the order
26 # of the $(CPU) and $(OS) bits.
28 # Don't strip the version of the target yet, it might be
29 # useful on some systems.
31 AC_MSG_CHECKING([for AROS style target])
33 if test "$target" = "NONE" ; then
34     target=$host_os-$host_cpu
35     cross_compile=no
36 else
37     if test "$target" = "" ; then
38         target=$host_os-$host_cpu
39         cross_compile=no
40     else
41         cross_compile=yes
42     fi
44 AC_MSG_RESULT($target)
46 if test "$host_os" = "mingw32" ; then
47     PWDCMD="pwd -W"
50 #don't know where else to put this...
51 AC_MSG_CHECKING([Building AROS in .. ])
52 AROS_BUILDDIR=`${PWDCMD-pwd}`
53 AC_MSG_RESULT($AROS_BUILDDIR)
55 AC_MSG_CHECKING([AROS Source in .. ])
56 srcpwd=`cd ${srcdir} ; ${PWDCMD-pwd}`
57 SRCDIR=${srcpwd}
58 AC_MSG_RESULT($SRCDIR)
60 # Parse the target field into something useful.
61 changequote(<<,>>)
62 target_os=`echo $target | sed 's/^\([^-]*\)-\(.*\)$/\1/'`
63 target_cpu=`echo $target | sed 's/^\([^-]*\)-\(.*\)$/\2/'`
64 changequote([,])
66 dnl --------------------------------------------------------------------
67 dnl Set the default Workbench resolution
68 dnl --------------------------------------------------------------------
69 aros_default_wbwidth=800
70 aros_default_wbheight=600
71 aros_default_wbdepth=4
73 dnl --------------------------------------------------------------------
74 dnl Host Configuration Section
75 dnl --------------------------------------------------------------------
76 dnl
77 dnl The idea here is to find out all the information we need about the
78 dnl host. This means things like tools for building directory structures,
79 dnl copying files around and the like.
81 # The first step is to find the host binaries.
82 # Check for a compiler.
83 AC_PROG_CC
84 AC_PROG_CC_STDC
85 AC_PROG_CPP
87 # Check for a compatible awk
88 AC_CHECK_PROGS(AWK,[gawk nawk])
89 AROS_REQUIRED(gawk,$AWK)
90 AROS_PROG(MMAKE,mmake)
92 # Perform some default variable assignments. Note all of these will be
93 # Regenerated from the script, so there is no need to cache them.
95 aros_host_cc="$CC"
96 AROS_TOOL_CCPATH(aros_host_ld,ld)
97 AROS_REQUIRED(ld,$aros_host_ld)
98 aros_host_make="make"
99 aros_host_cflags=$CFLAGS
100 aros_host_ldflags=$LDFLAGS
101 aros_host_debug="-g -O0"
102 aros_host_mkdep="\$(SRCDIR)/scripts/mkdep"
103 aros_host_mkargs="--no-print-directory"
104 aros_host_incl="/usr/include"
105 aros_host_exe_suffix="$EXEEXT"
106 aros_host_lib_suffix=""
108 AC_CHECK_PROGS(aros_host_aclocal,[aclocal aclocal19 aclocal-1.9])
109 AC_CHECK_PROGS(aros_host_autoconf,[autoconf autoconf259 autoconf253])
110 AC_CHECK_PROGS(aros_host_autoheader,[autoheader autoheader259 autoheader253])
111 AC_CHECK_PROGS(aros_host_automake,[automake automake19 automake-1.9])
113 AROS_REQUIRED(aclocal/aclocal19/aclocal-1.9, $aros_host_aclocal)
114 AROS_REQUIRED(automake/automake19/automake-1.9, $aros_host_automake)
116 case "$aros_host_cc" in
117     *gcc*)
118         aros_host_cc_pipe="-pipe"
119         ;;
120     icc)
121         aros_host_cc_pipe=""
122         ;;
123     *)
124         aros_host_cc_pipe=""
125         ;;
126 esac
128 dnl Despite the name, this is really a host configuration variable.
129 aros_target_cc_includes=""
131 # This is the main host configuration section. It is where the host
132 # can change the values of any variables it needs to change. We do
133 # not look at anything that compiles to the target yet, we'll get
134 # to that later.
136 case "$host_os" in
137     aros*)
138         aros_host_arch="aros"
139         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
140         case "$host_cpu" in
141             *i?86*)
142                 aros_host_cpu="i386"
143                 ;;
144             *x86_64*)
145                 aros_host_cpu="x86_64"
146                 ;;
147             *)
148                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
149                 aros_host_cpu="$host_cpu"
150                 ;;
151         esac
152         ;;
154     linux*)
155         aros_host_arch="linux"
156         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
157         case "$host_cpu" in
158             *i?86*)
159                 aros_host_cpu="i386"
160                 ;;
161             *x86_64*)
162                 aros_host_cpu="x86_64"
163                 ;;
164             *m68k*)
165                 aros_host_cpu="m68k"
166                 ;;
167             *powerpc*)
168                 aros_host_cpu="ppc"
169                 ;;
170             *)
171                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
172                 aros_host_cpu="$host_cpu"
173                 ;;
174         esac
175         ;;
177     freebsd*)
178         aros_host_cc="$aros_host_cc $aros_host_cc_pipe -I/usr/local/include"
179         aros_host_make="gmake"
180         aros_host_arch="freebsd"
181         aros_host_cpu="i386"
183         aros_host_ldflags="$aros_host_ldflags -L/usr/local/lib -liconv"
185         dnl Need to override this here, it's just too hard later.
186         dnl This shouldn't be here at all...
187         dnl aros_target_cc_includes="/usr/include"
189         dnl FreeBSD 5.x (and later) has changed the default object format.
190         dnl The double [[]] is necessary to get around m4's quoting rules.
191         case $host_os in
192             freebsd[[234]]*)
193                 aros_object_format="elf_i386"
194                 ;;
196             *)
197                 aros_object_format="elf_i386_fbsd"
198                 ;;
199         esac
201         ;;
203     darwin*)
204         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
205         aros_host_arch="darwin"
206         case "$host_cpu" in
207             *i?86*)
208                 aros_host_cpu="i386"
209                 ;;
210             *powerpc*)
211                 aros_host_cpu="ppc"
212                 ;;
213             *)
214                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
215                 aros_host_cpu="$host_cpu"
216                 ;;
217         esac
219         aros_host_ldflags="$aros_host_ldflags -liconv"
221         ;;
223     dragonfly*)
224         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
225         aros_host_make="gmake"
226         aros_host_arch="dragonfly"
227         case $host_cpu in
228             *i?86*)
229                 aros_host_cpu="i386"
230                 ;;
231             *amd64*)
232                 aros_host_cpu="x86_64"
233                 ;;
234             *)
235                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
236                 aros_host_cpu="$host_cpu"
237                 ;;
238         esac
239         ;;
241     netbsd*)
242         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
243         aros_host_make="gmake"
244         aros_host_arch="netbsd"
245         case "$host_cpu" in
246             *i?86*)
247                 aros_host_cpu="i386"
248                 ;;
249             *m68k*)
250                 aros_host_cpu="m68k"
251                 ;;
252             *)
253                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
254                 aros_host_cpu="$host_cpu"
255                 ;;
256         esac    
257         aros_host_lib_suffix=".0.0"
258         ;;
260     openbsd*)
261         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
262         aros_host_make="gmake"
263         aros_host_arch="openbsd"
264         case "$host_cpu" in
265             *i?86*)
266                 aros_host_cpu="i386"
267                 ;;
268             *)
269                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
270                 aros_host_cpu="$host_cpu"
271                 ;;
272         esac
273         ;;
274         
275     solaris*)
276         aros_host_arch="solaris"
277         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
278         case "$host_cpu" in
279             *i?86*)
280                 aros_host_cpu="i386"
281                 ;;
282             *sparc*)
283                 aros_host_cpu="sparc"
284                 ;;
285             *)
286                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
287                 aros_host_cpu="$host_cpu"
288                 ;;
289         esac
290         ;;
292     morphos*)
293         aros_host_arch="morphos"
294         aros_host_cpu="ppc"
295         ;;
297     amiga*)
298         aros_host_arch="amiga"
299         SORT="/gg/bin/sort"
300         TEST="/gg/bin/test"
301         UNIQ="/gg/bin/uniq"
302         FOR="for"
303         TOUCH="/gg/bin/touch"
304         case "$host_cpu" in
305             *m68k*)
306                 aros_host_cpu="m68k"
307                 ;;
308             *powerpc*)
309                 aros_host_cpu="ppc"
310                 ;;
311             *)
312                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
313                 aros_host_cpu="$host_cpu"
314                 ;;
315         esac
316         ;;
318     cygwin*)
319         aros_host_arch="cygwin"
320         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
321         case "$host_cpu" in
322             *i?86*)
323                 aros_host_cpu="i386"
324                 ;;
325             *)
326                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
327                 aros_host_cpu="$host_cpu"
328                 ;;
329         esac
330         ;;
332     mingw32*)
333         aros_host_arch="mingw32"
334         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
335         case "$host_cpu" in
336             *i?86*)
337                 aros_host_cpu="i386"
338                 ;;
339             *)
340                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
341                 aros_host_cpu="$host_cpu"
342                 ;;
343         esac
344         ;;
345     *)
346         AC_MSG_ERROR([Unsupported host architecture $host])
347         ;;
348 esac
350 AROS_PROG(aros_host_ar,[ar],[cr])
351 AROS_REQUIRED(ar,$aros_host_ar)
352 AROS_PROG(aros_host_ranlib,ranlib)
353 AROS_REQUIRED(ranlib,$aros_host_ranlib)
354 AROS_PROG(aros_host_strip,strip)
355 AROS_REQUIRED(strip,$aros_host_strip)
357 AROS_PROG(RM,[rm],[-rf])
358 AROS_REQUIRED(rm,$RM)
359 AROS_PROG(CP,[cp])
360 AROS_REQUIRED(cp,$CP)
361 AROS_PROG(MV,[mv])
362 AROS_REQUIRED(mv,$MV)
363 AROS_PROG(ECHO,[echo])
364 AROS_REQUIRED(echo,$ECHO)
365 AROS_PROG(MKDIR,[mkdir],[-p])
366 AROS_REQUIRED(mkdir,$MKDIR)
367 AROS_PROG(TOUCH,[touch])
368 AROS_REQUIRED(touch,$TOUCH)
369 AROS_PROG(SORT,[sort])
370 AROS_REQUIRED(sort,$SORT)
371 AROS_PROG(UNIQ,[uniq])
372 AROS_REQUIRED(uniq,$UNIQ)
373 AROS_PROG(NOP,[true])
374 AROS_REQUIRED(true,$NOP)
375 AROS_PROG(CAT,[cat])
376 AROS_REQUIRED(cat,$CAT)
377 AROS_PROG(BISON,[bison])
378 AROS_REQUIRED(bison,$BISON)
379 AROS_PROG(FLEX,[flex])
380 AROS_REQUIRED(flex,$FLEX)
381 AROS_PROG(PNGTOPNM,[pngtopnm])
382 AROS_REQUIRED(pngtopnm,$PNGTOPNM)
383 AROS_PROG(PPMTOILBM,[ppmtoilbm])
384 AROS_REQUIRED(ppmtoilbm,$PPMTOILBM)
385 AROS_PROG(SED,[sed])
386 AROS_REQUIRED(sed,$SED)
387 AROS_PROG(CHMOD,[chmod])
388 AROS_REQUIRED(chmod,$CHMOD)
390 AM_PATH_PYTHON(2.2.1)
392 AC_SUBST(FOR, for)
393 AC_SUBST(IF, if)
394 AC_SUBST(TEST, test)
395 AC_SUBST(CMP, cmp)
397 dnl ---------------------------------------------------------------------------
398 dnl Look for things about the host system, good for hosted targets.
399 dnl ---------------------------------------------------------------------------
401 # Check for some includes for the X11 HIDD and the kernel
402 AC_CHECK_HEADERS([sys/ipc.h sys/shm.h \
403     sys/mmap.h sys/mman.h sysexits.h \
404     sys/statfs.h sys/statvfs.h sys/vfs.h sys/param.h \
407 AC_CHECK_HEADERS([sys/mount.h],,,[#include <sys/param.h>])
409 AC_HEADER_DIRENT
410 AC_HEADER_STAT
411 AC_HEADER_STDC
412 AC_HEADER_SYS_WAIT
413 AC_HEADER_TIME
414 AC_STRUCT_ST_BLKSIZE
415 AC_STRUCT_ST_BLOCKS
416 AC_STRUCT_ST_RDEV
417 AC_STRUCT_TM
418 AC_STRUCT_TIMEZONE
419 AC_TYPE_OFF_T
420 AC_TYPE_PID_T
421 AC_TYPE_SIZE_T
422 AC_TYPE_UID_T
424 AC_CHECK_MEMBERS(struct tm.tm_gmtoff)
426 # Look for some functions
427 AC_CHECK_FUNCS([getpagesize kqueue statfs statvfs \
428     clone kse_create rfork_thread thr_create sa_register \
429     getcontext makecontext setcontext sigaltstack swapcontext])
431 AC_FUNC_MMAP
434 dnl --------------------------------------------------------------------
435 dnl Target Configuration Section
436 dnl --------------------------------------------------------------------
438 dnl The target configuration section is responsible for setting up all
439 dnl the paths for includes, and tools required to build AROS to some
440 dnl particular target.
442 aros_config_cflags="-Wall -Werror-implicit-function-declaration"
443 aros_config_aflags="-Wall -x assembler-with-cpp -c"
444 aros_config_ldflags=""
446 aros_shared_default=yes
448 aros_shared_cflags="-fPIC"
449 aros_shared_aflags=""
450 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
451 aros_kernel_ldflags="-Wl,-rpath,./lib"
453 aros_target_ar_flags="cr"
454 aros_target_nm_flags="-C -ul"
455 aros_target_strip_flags="--strip-unneeded -R.comment"
457 aros_compiler_libs=
458 aros_arch_libs=
460 aros_target_genmap="-Wl,-Map -Xlinker"
462 # Native flavour stuff
463 aros_bochs_hack="0"
464 aros_serial_debug="0"
466 # Palm native flavour stuff
467 aros_palm_debug_hack="0"
469 # Unix flavour stuff
470 aros_nesting_supervisor="0"
472 # Collect-aros stuff: "-ius" to ignore undefined symbols
473 ignore_undefined_symbols=""
475 #-----------------------------------------------------------------------------
478 # GCC 4.1+ has a stack protection feature that requires OS support. Ubuntu has
479 # it switched on by default, and we use the host compiler, so it compiles AROS
480 # code with this enabled resulting in link failures as we don't have support
481 # for it.
483 # We use two methods to disable it. For the host compiler (used to compile
484 # some hosted modules), we test to see if the compiler supports stack
485 # protection, and if it does we disable it in AROS_CONFIG_CFLAGS. This should
486 # work on all platforms.
488 # For the "cross" compiler we clear the "ssp_default" spec in config/specs.in
489 # (this is done unconditionally, as it should have no effect on compilers
490 # without the stack protection feature). This may be specific to the way that
491 # Ubuntu enables the feature, so may not work everywhere. My specs-fu isn't
492 # strong enough to disable it in a generic way though, so we'll live with it
493 # until another vendor ships GCC with it enabled in a different way, and deal
494 # with it then.
497 AC_MSG_CHECKING([whether ${CC} accepts -fno-stack-protector])
498 save_cc="$CC"
499 save_cflags="$CFLAGS"
500 CFLAGS="$CFLAGS -fno-stack-protector"
501 AC_TRY_COMPILE(,, use_no_stack_protector="yes", use_no_stack_protector="no")
502 AC_MSG_RESULT($use_no_stack_protector)
503 if test "x-$use_no_stack_protector" = "x-yes" ; then
504     aros_host_cflags="$aros_host_cflags -fno-stack-protector"
506 if test "x-$cross_compiling" = "x-yes"; then
507     CC="$aros_kernel_cc"
508     AC_MSG_CHECKING([whether ${CC} accepts -fno-stack-protector])
509     AC_TRY_COMPILE(,, use_no_stack_protector="yes", use_no_stack_protector="no")
510     AC_MSG_RESULT($use_no_stack_protector)
512 if test "x-$use_no_stack_protector" = "x-yes" ; then
513     aros_kernel_cflags="$aros_kernel_cflags -fno-stack-protector"
515 CC="$save_cc"
516 CFLAGS="$save_cflags"
519 #-----------------------------------------------------------------------------
521 # Check if we can explicitly choose older version of symbol hashing
523 save_cflags="$CFLAGS"
524 CFLAGS="$CFLAGS -Wl,--hash-style=sysv"
525 AC_MSG_CHECKING([whether ${CC} accepts -Wl,--hash-style=sysv])
526 AC_TRY_LINK(,, use_hash_style="yes", use_hash_style="no")
527 AC_MSG_RESULT($use_hash_style)
528 if test "x-$use_hash_style" = "x-yes" ; then
529     aros_kernel_cflags="$aros_kernel_cflags -Wl,--hash-style=sysv"
531 CFLAGS="$save_cflags"
534 #-----------------------------------------------------------------------------
536 # Disable pointer-signedness warnings if the compiler recognises the option
537 # (this only works for the host compiler at the moment)
539 AC_MSG_CHECKING([whether ${CC} accepts -Wno-pointer-sign])
540 save_cflags="$CFLAGS"
541 CFLAGS="$CFLAGS -Wno-pointer-sign"
542 AC_TRY_COMPILE(,, use_no_sign_warning="yes", use_no_sign_warning="no")
543 AC_MSG_RESULT($use_no_sign_warning)
544 if test "x-$use_no_sign_warning" = "x-yes" ; then
545     aros_host_cflags="$aros_host_cflags -Wno-pointer-sign"
547 CFLAGS="$save_cflags"
549 #-----------------------------------------------------------------------------
551 AC_MSG_CHECKING([for type of build])
552 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")
554 if test "$build_type" = "nightly"; then
555     build_type_string="NIGHTLY"
556 elif test "$build_type" = "snapshot"; then
557     build_type_string="SNAPSHOT"
558 elif test "$build_type" = "milestone"; then
559     build_type_string="MILESTONE"
560 elif test "$build_type" = "release"; then
561     build_type_string="RELEASE"
562 else
563     build_type_string="PERSONAL"
564     build_type="personal"
567 aros_config_cflags="$aros_config_cflags -DAROS_BUILD_TYPE=AROS_BUILD_TYPE_$build_type_string"
569 AC_MSG_RESULT($build_type)
571 #-----------------------------------------------------------------------------
572 all_debug_types="messages stack mungwall modules symbols"
574 AC_MSG_CHECKING([which debug types to enable])
575 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)]),
576  debug="$enableval",debug="")
578 if test "$debug" = "" -o "$debug" = "no"; then
579     debug="none"
580 elif test "$debug" = "yes"; then
581     debug="all"
584 if test "$debug" = "all" ; then
585     debug=$all_debug_types
586     for d in $all_debug_types; do
587         export aros_${d}_debug="1"
588     done
589 else
590     for d in $all_debug_types; do
591         export aros_${d}_debug="0"
592     done
595 if test "$debug" != "none"; then
596     debug=`echo $debug | sed s/,/\ /g`
597     for d in $debug; do
598         found="0"
599         for d2 in $all_debug_types; do
600             if test "$d2" = "$d"; then
601                 found="1"
602                 break
603             fi
604         done
605         if test "$found" = "0"; then
606             AC_MSG_ERROR([unrecognized debug type "$d". Available types are: all none $all_debug_types])
607         fi
608         export aros_${d}_debug="1"
609     done
610     aros_debug="yes"
612 AC_MSG_RESULT($debug)
614 if test "$aros_messages_debug" = "1"; then
615     aros_messages_debug="-DADEBUG=1 -DMDEBUG=1"
616 else
617     aros_messages_debug=""
619 if test "$aros_symbols_debug" = "1"; then
620     aros_symbols_debug="-g"
621 else
622     aros_symbols_debug=""
625 # These are the flags to pass when compiling debugged programs
626 aros_debug_cflags="$aros_symbols_debug $aros_messages_debug"
627 aros_debug_aflags=""
628 aros_debug_ldflags="$aros_symbols_debug"
630 aros_crosstools="no"
632 #-----------------------------------------------------------------------------
633 #   Checking if we should build crosstools..
634 AC_MSG_CHECKING([whether to build crosstools])
635 AC_ARG_ENABLE(crosstools,AC_HELP_STRING([--enable-crosstools],[Build cross-compiler toolchains if necessary (default=no).]),crosstools="$enableval",crosstools="no")
636 if test "$crosstools" != "" -a "$crosstools" != "no"; then
637     AC_MSG_RESULT(yes)
638         aros_crosstools="yes"
639 else
640     AC_MSG_RESULT(no)
643 #-----------------------------------------------------------------------------
644 #   Checking for distcc and ccache.
646 #   Always apply the transforms in this particular order. Basically you should
647 #   always run 'ccache distcc compiler' in that order for the best performance.
649 AC_MSG_CHECKING([whether to enable distcc])
650 AC_ARG_ENABLE(distcc,AC_HELP_STRING([--enable-distcc],[Use distcc as a front end to the compiler (default=no).]),distcc="$enableval",distcc="no")
651 if test "$distcc" != "" -a "$distcc" != "no"; then
652     # AC_CHECK_PROG will print out the result in this case
653     AC_PATH_PROG(DISTCC,[distcc],distcc,)
654 else
655     AC_MSG_RESULT(no)
658 AC_MSG_CHECKING([whether to enable ccache])
659 AC_ARG_ENABLE(ccache,AC_HELP_STRING([--enable-ccache],[Use ccache as a front end to the compiler (default=no).]),ccache="$enableval",ccache="no")
660 if test "$ccache" != "" -a "$ccache" != "no"; then
661     # AC_CHECK_PROG will print out the result in this case
662     AC_CHECK_PROG(CCACHE,[ccache],ccache,)
663 else
664     AC_MSG_RESULT(no)
667 #-----------------------------------------------------------------------------
668 AC_MSG_CHECKING([what optimization flags to use])
669 AC_ARG_WITH(optimization,AC_HELP_STRING([--with-optimization=FLAGS],[Use optimization flags FLAGS (default=-O2).]),optimization="$withval",optimization="unknown")
670 if test "$optimization" = "unknown"; then
671     dnl default is -O2 for normal builds, -O0 for debug builds
672     if test "$debug" != "none"; then
673         optimization="-O0"
674     else
675         optimization="-O2"
676     fi
678 aros_config_cflags="$aros_config_cflags $optimization"
679 AC_MSG_RESULT($optimization)
681 #-----------------------------------------------------------------------------
682 AC_MSG_CHECKING([what target variant to enable])
683 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")
684 if test "$target_variant" = "none"; then
685     aros_target_variant=""
686     aros_target_suffix=""
687 else
688     aros_target_variant="$target_variant"
689     aros_target_suffix="-$target_variant"
691 AC_MSG_RESULT($enableval)
693 target_bootloader="none"
695 #-----------------------------------------------------------------------------
696 # This is the target configuration switch.
697 case "$target_os" in
698     linux*)
699         aros_target_arch="linux"
700         case "$target_cpu" in
701             *m68k*)
702                 aros_target_cpu="m68k"
703                 aros_object_format="m68kelf"
704                 aros_flavour="emulcompat"
705                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D__mc68000 -D__linux__"
706                 aros_shared_ldflags="-Wl,-T,\$(TOP)/config/linux/m68k/script.so"
707                 aros_kernel_ldflags="-Wl,-rpath,./lib,-T,\$(TOP)/config/linux/m68k/script.normal"
708                 gcc_target_cpu="mc68000"
709                 ;;
710             *i?86*)
711                 aros_target_cpu="i386"
712                 aros_object_format="elf_i386"
713                 aros_flavour="emulation"
714                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__linux__"
715                 aros_config_cflags="$aros_config_cflags -m32"
716                 aros_kernel_cflags="$aros_kernel_cflags -m32"
717                 aros_config_aflags="$aros_config_aflags -m32"
718                 aros_config_ldflags="-m32"
719                 aros_kernel_ldflags="-melf_i386"
720                 aros_default_wbdepth=8
721                 gcc_target_cpu="i386"
722                 ;;
723             *x86_64*)
724                 aros_target_cpu="x86_64"
725                 aros_object_format="elf_x86_64"
726                 aros_flavour="emulation"
727                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64 -D__linux__"
728                 aros_config_cflags="$aros_config_cflags -mno-red-zone"
729                 aros_default_wbdepth=8
730                 gcc_target_cpu="x86_64"
731                 ;;
732             *powerpc*)
733                 aros_target_cpu="ppc"
734                 aros_object_format="elf32ppc"
735                 aros_flavour="emulation"
736                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc -D__linux__"
737                 aros_default_wbdepth=8
738                 gcc_target_cpu="ppc"
739                 ;;
740 # TODO
741 # Same as powerpc, but I need this for the nightly build to work again.
742 # Actually, the nightly should be made working with powerpc target.
743 # That just was too much work for the moment, another week or two.
744             *ppc*)
745                 aros_target_cpu="ppc"
746                 aros_object_format="elf32ppc"
747                 aros_flavour="emulation"
748                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc -D__linux__"
749                 aros_default_wbdepth=8
750                 gcc_target_cpu="ppc"
751                 ;;
752             *)
753                 AC_MSG_ERROR("Unknown CPU for Linux -- $target_cpu")
754                 ;;
755         esac
756     ;;
758     pc)
759         aros_target_arch="pc"
760         aros_shared_default="no"
761         target_bootloader="grub2"
762         case "$target_cpu" in
763             *i?86*)
764                 aros_target_cpu="i386"
766                 dnl If somebody hasn't already set the target object
767                 dnl format, then use this value. Mostly to support
768                 dnl FreeBSD cross-compilation.
769                 dnl TODO: Remove when we always use our compiler.
771                 if test "$aros_object_format" = "" ; then
772                     aros_object_format="elf_i386"
773                 fi
774                 aros_flavour="standalone"
775                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
776                 aros_config_cflags="$aros_config_cflags -m32"
777                 aros_kernel_cflags="$aros_kernel_cflags -m32"
778                 aros_config_aflags="$aros_config_aflags -m32"
779                 aros_config_ldflags="-m32"
780                 aros_kernel_ldflags="-melf_i386"
781                 aros_default_wbwidth=640
782                 aros_default_wbheight=480
783                 gcc_target_cpu="i386"
784                 ;;
785             *x86_64*)
786                 aros_target_cpu="x86_64"
787                 aros_serial_debug=1
788                 if test "$aros_object_format" = "" ; then
789                     aros_object_format="elf_x86_64"
790                 fi
791                 aros_flavour="standalone"
792                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
793                 aros_config_cflags="$aros_config_cflags -fno-asynchronous-unwind-tables -mno-red-zone"
794                 aros_kernel_ldflags=""
795                 aros_default_wbwidth=640
796                 aros_default_wbheight=480
797                 gcc_target_cpu="x86_64"
798                 ;;
799             *)
800                 AC_MSG_ERROR("Unknown native CPU -- $target_cpu")
801                 ;;
802         esac
803         ;;
805     prep)
806         aros_target_arch="prep"
807         aros_shared_default="no"
808         aros_target_cpu="ppc"
809         aros_object_format="elf32ppc"
810         aros_flavour="ppcnative"
811         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
812         aros_kernel_ldflags=""
813         aros_default_wbwidth=640
814         aros_default_wbheight=480
815         gcc_target_cpu="ppc"
816         ;;
818     freebsd*)
819         aros_target_arch="freebsd"
820         aros_target_cpu="i386"
821         aros_flavour="emulation"
822         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
823         gcc_target_cpu="i386"
825         aros_target_strip_flags="-x"
826         ;;
828     darwin*)
829         aros_target_arch="darwin"
830         aros_flavour="emulation"
831         dnl FIXME
832         dnl This test bypass was implemented for Darwin by port's author.
833         dnl I wonder why, since darwin port needs this function.
834         dnl I left it here just because port author did it.
835         need_dlopen="no"
836         case "$target_cpu" in
837                 *i?86*)
838                         aros_target_cpu="i386"
839                         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
840                         gcc_target_cpu="i386"
841                         aros_object_format="elf_i386"
842                         aros_target_strip_flags="-x"
843                         ;;
844                 *)
845                         AC_MSG_ERROR("Unsupported target CPU for darwin hosted flavour -- $target_cpu")
846                         ;;
847         esac
848         ;;
850     dragonfly*)
851         aros_target_arch="dragonfly"
852         aros_flavour="emulation"
853         case "$target_cpu" in
854             *i?86*)
855                 aros_target_cpu="i386"
856                 aros_object_format="elf_i386"
857                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__DragonFly__"
858                 ;;
859             *x86_64*)
860                 aros_target_cpu="x86_64"
861                 aros_object_format="elf_x86_64"
862                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64 -D__DragonFly__"
863                 ;;
864             *)
865                 AC_MSG_ERROR("Unknown CPU for DragonFly -- $target_cpu")
866                 ;;
867         esac
868         ;;
870     netbsd*)
871         aros_target_arch="netbsd"
872         case "$target_cpu" in
873             *m68k*)
874                 aros_target_cpu="m68k"
875                 aros_object_format="m68kelf"
876                 aros_flavour="emulcompat"
877                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D__mc68000 -D__NetBSD__"
878                 gcc_target_cpu="mc68000"
879                 ;;
880             *i?86*)
881                 aros_target_cpu="i386"
882                 aros_object_format="elf_i386"
883                 aros_flavour="emulation"
884                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__NetBSD__"
885                 aros_default_wbdepth=8
886                 gcc_target_cpu="i386"
887                 ;;
888             *)
889                 AC_MSG_ERROR("Unknown CPU for NetBSD -- $target_cpu")
890                 ;;
891         esac
892         aros_target_genmap="-Wl,-M -Xlinker >"
893         aros_flavour="emulation"
894         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
895         ;;   
897     openbsd*)
898         aros_target_arch="openbsd"
899         case "$target_cpu" in
900             *i?86*)
901                 aros_target_cpu="i386"
902                 aros_object_format="elf_i386"
903                 aros_flavour="emulation"
904                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__OpenBSD__"
905                 gcc_target_cpu="i386"
906                 ;;
907             *)
908                 AC_MSG_ERROR("Unknown CPU for OpenBSD -- $target_cpu")
909                 ;;
910         esac
911         aros_target_genmap="-Wl,-M -Xlinker >"
912         aros_target_nm_flags="-u"
913         aros_flavour="emulation"
914         ;;
916     solaris*)
917         aros_target_arch="solaris"
918         case "$target_cpu" in
919            *i?86*)
920                aros_target_cpu="i386"
921                aros_object_format="elf_i386"
922                aros_flavour="emulation"
923                aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__Solaris__"
924                aros_default_wbdepth=8
925                gcc_target_cpu="i386"
926                ;;
927             *sparc*)
928                 aros_target_cpu="sparc"
929                 aros_object_format="elf_sparc"
930                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dsparc -D__Solaris__"
931                 gcc_target_cpu="sparc"
932                 ;;
933             *)
934                 AC_MSG_ERROR("Unknown CPU for Solaris -- $target_cpu")
935                 ;;
936         esac
937         aros_config_cflags="$aros_config_cflags -D$aros_target_cpu"
938         aros_flavour="emulation"
939         ;;
941     morphos*)
942         aros_target_arch="morphos"
943         aros_shared_default="no"
944         aros_target_cpu="ppc"
945         aros_object_format="elf_ppc"
946         aros_flavour="nativecompat"
947         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
948         gcc_target_cpu="ppc"
949         ;;
951     sam440)
952         aros_target_arch="sam440"
953         aros_shared_default="no"
954         aros_target_cpu="ppc"
955         aros_object_format="elf32ppc"
956         aros_flavour="ppcnative"
957         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
958         aros_kernel_ldflags=""
959         aros_default_wbwidth=640
960         aros_default_wbheight=480
961         aros_config_cflags="$aros_config_cflags -mcpu=440fp -mno-toc -fno-asynchronous-unwind-tables"
962         gcc_target_cpu="powerpc"
963         ;;
965     efika)
966         aros_target_arch="efika"
967         aros_shared_default="no"
968         aros_target_cpu="arm"
969         aros_object_format="armelf_linux_eabi"
970         aros_flavour="standalone"
971         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
972         aros_kernel_ldflags=""
973         aros_default_wbwidth=1024
974         aros_default_wbheight=600
975         aros_arch_libs="-laeabi"
976         aros_config_cflags="$aros_config_cflags -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -fno-asynchronous-unwind-tables -fno-exceptions"
977         aros_config_aflags="$aros_config_aflags -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -fno-asynchronous-unwind-tables -fno-exceptions"
978         ;;
979         
980     chrp)
981     aros_target_arch="chrp"
982     aros_shared_default="no"
983     aros_target_cpu="ppc"
984     aros_object_format="elf32ppc"
985     aros_flavour="ppcnative"
986     aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
987     aros_kernel_ldflags=""
988     aros_default_wbwidth=640
989     aros_default_wbheight=480
990     aros_config_cflags="$aros_config_cflags -mno-toc -fno-asynchronous-unwind-tables"    
991     gcc_target_cpu="powerpc"
992         case "$aros_target_variant" in
993             efika)
994             aros_config_cflags="$aros_config_cflags -DBIG_ENDIAN_OHCI=1 -mcpu=603e"
995             ;;
996         esac
997     ;;
999     amiga*)
1000         aros_target_arch="amiga"
1001         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D_AMIGA -DAMIGA"
1002         aros_shared_default="no"
1004         aros_config_cflags="$aros_config_cflags -fomit-frame-pointer -fbuiltin -ffreestanding"
1006         case "$target_cpu" in
1007             *m68k*)
1008                 aros_target_cpu="m68k"
1009                 aros_object_format="m68kelf"
1010                 aros_flavour="nativecompat"
1011                 gcc_target_cpu="mc68000"
1012                 ;;
1013             *ppc*)
1014                 aros_cpu="ppc"
1015                 aros_flavour="native"
1016                 gcc_target_cpu="ppc"
1017                 ;;
1018             *)
1019                 AC_MSG_ERROR("Unknown CPU for Amiga $target_cpu")
1020                 ;;
1021         esac
1022         ;;
1024     mingw32*)
1025         aros_target_arch="mingw32"
1026         aros_shared_default="no"
1027         need_dlopen="no"
1028         rescomp="windres"
1029         case "$target_cpu" in
1030             *i?86*)
1031                 aros_target_cpu="i386"
1032                 aros_object_format="elf_i386"
1033                 aros_flavour="emulation"
1034                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1035                 aros_shared_cflags=""
1036                 aros_default_wbdepth=8
1037                 gcc_target_cpu="i386"
1038                 aros_target_cc="i386-aros-gcc"
1039                 aros_target_ld="i386-aros-ld"
1040                 aros_target_as="i386-aros-as"
1041                 aros_target_ar="i386-aros-ar"
1042                 aros_target_ranlib="i386-aros-ranlib"
1043                 aros_target_nm="i386-aros-nm"
1044                 aros_target_strip="i386-aros-strip"
1045                 aros_target_objcopy="i386-aros-objcopy"
1046                 aros_target_objdump="i386-aros-objdump"
1047                 target_tool_prefix="i386-mingw32-"
1048                 ;;
1049             *)
1050                 AC_MSG_ERROR("Unknown CPU for Mingw32 -- $target_cpu")
1051                 ;;
1052         esac
1053         if test $host_os = "cygwin"; then
1054                 aros_kernel_cflags="-mno-cygwin"
1055         fi
1056     ;;
1057     pp*)
1058         aros_target_arch="pp"
1059         aros_shared_default="no"
1060         case "$target_cpu" in
1061             *m68k*)
1062                 aros_target_cpu="m68k"
1063                 aros_object_format="m68kelf"
1064                 aros_flavour="palmnative"
1065                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
1066                 aros_default_wbwidth=160
1067                 aros_default_wbheight=160
1068                 aros_default_wbdepth=1
1069                 aros_target_ar_flags="cru"
1070                 aros_compiler_libs="-lgcc1"
1071                 aros_shared_default=no
1072                 aros_shared_cflags="-fpic"
1073                 aros_shared_aflags=""
1074                 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
1075                 aros_kernel_ldflags="-Wl,-rpath,./lib"
1076                 aros_debug_cflags="-Wall -Werror-implicit-function-declaration $aros_symbols_debug  $aros_messages_debug -mc68000 -Wa,-mc68000"
1077                 aros_debug_aflags=""
1078                 aros_debug_ldflags="$aros_symbols_debug"
1079                 aros_mungwall_debug="0"
1080                 aros_modules_debug="0"
1081                 gcc_target_cpu="mc68000"
1082                 ignore_undefined_symbols="-ius"
1083                 ;;
1084            *)
1085                 AC_MSG_ERROR("Unknown CPU for PalmPilot -- $target_cpu")
1086                 ;;
1087         esac
1088         ;;
1090     mac*)
1091         aros_target_arch="mac"
1092         aros_shared_default="no"
1093         case "$target_cpu" in
1094             *m68k*)
1095                 aros_target_cpu="m68k"
1096                 aros_object_format="m68kelf"
1097                 aros_flavour="mac68knative"
1098                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
1099                 aros_default_wbwidth=512
1100                 aros_default_wbheight=384
1101                 aros_default_wbdepth=8
1102                 aros_target_ar_flags="cru"
1103                 aros_compiler_libs="-lgcc1"
1104                 aros_shared_default=no
1105                 aros_shared_cflags="-fpic"
1106                 aros_shared_aflags=""
1107                 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
1108                 aros_kernel_ldflags="-Wl,-rpath,./lib"
1109                 aros_debug_cflags="-Wall -Werror-implicit-function-declaration $aros_symbols_debug  $aros_messages_debug -mc68000"
1110                 aros_debug_aflags=""
1111                 aros_debug_ldflags="$aros_symbols_debug"
1112                 aros_mungwall_debug="0"
1113                 aros_modules_debug="0"
1114                 gcc_target_cpu="mc68000"
1115                 ignore_undefined_symbols="-ius"
1116                 ;;
1117            *)
1118                 AC_MSG_ERROR("Unknown CPU for Mac68k -- $target_cpu")
1119                 ;;
1120         esac
1121         ;;
1123     *)
1124         AC_MSG_ERROR([Unsupported target architecture $target])
1125         ;;
1126 esac
1128 AC_MSG_CHECKING([Where to download sourcecode for external ports])
1129 AC_ARG_WITH(portssources,AC_HELP_STRING([--with-portssources=DIR],[Where to download sourcecode for external ports]),with_portssrcdir=$withval,with_portssrcdir="default")
1130 if test "$with_portssrcdir" = "default"; then
1131     AROS_PORTSSRCDIR="$AROS_BUILDDIR/bin/Sources"
1132 else
1133     AROS_PORTSSRCDIR="$with_portssrcdir"
1135 AC_MSG_RESULT($AROS_PORTSSRCDIR)
1137 AC_MSG_CHECKING([which bootloader to use])
1138 AC_ARG_WITH(bootloader,AC_HELP_STRING([--with-bootloader=NAME],[Use a specific bootloader]),target_bootloader=$withval,target_bootloader=$target_bootloader)
1139 if test "$target_bootloader" = "none"; then
1140     aros_target_bootloader=""
1141 else
1142     aros_target_bootloader="$target_bootloader"
1144 AC_MSG_RESULT($target_bootloader)
1146 AC_MSG_CHECKING([which icon-set to use])
1147 AC_ARG_WITH(iconset,AC_HELP_STRING([--with-iconset=NAME],[Use a specific Icon-set (default=Gorilla).]),target_iconset=$withval,target_iconset="default")
1148 if test "$target_iconset" = "default"; then
1149     aros_target_iconset="Gorilla"
1150     target_iconset="default (Gorilla)"
1151 else
1152     aros_target_iconset="$target_iconset"
1154 AC_MSG_RESULT($target_iconset)
1156 AC_MSG_CHECKING([which GUI Theme to use])
1157 AC_ARG_WITH(theme,AC_HELP_STRING([--with-theme=NAME],[Use a specific GUI Theme]),target_guitheme=$withval,target_guitheme="default")
1158 if test "$target_guitheme" = "default"; then
1159     aros_target_guitheme="Ice"
1160 else
1161     aros_target_guitheme="$target_guitheme"
1163 AC_MSG_RESULT($aros_target_guitheme)
1165 # Find out if we are cross-compiling (i.e. if we can't use the host compiler
1166 # for target code)
1167 cross_compiling=no
1168 if test "$aros_host_cpu" != "$aros_target_cpu" ; then
1169     cross_compiling=yes
1171 if test "$aros_host_cpu" == "x86_64" ; then
1172     if test "$aros_target_cpu" == "i386" ; then
1173         cross_compiling=no
1174     fi
1176 if test "$aros_host_arch" == "darwin" ; then
1177     cross_compiling=yes
1180 # Set prefix for target compiler etc. if we're cross-compiling
1181 # (should possibly be earlier but needs to be after AC_PROG_CC)
1182 if test "$cross_compiling" = "yes" ; then
1183     if test "$target_tool_prefix" = ""; then
1184         target_tool_prefix=${target_cpu}-elf-
1185     fi
1186     CC=${target_tool_prefix}gcc
1189 #-----------------------------------------------------------------------------
1191 # Disable pointer-signedness warnings if the compiler recognises the option
1193 AC_MSG_CHECKING([whether ${CC} accepts -Wno-pointer-sign])
1194 save_cflags="$CFLAGS"
1195 CFLAGS="$CFLAGS -Wno-pointer-sign"
1196 AC_TRY_COMPILE(,, use_no_sign_warning="yes", use_no_sign_warning="no")
1197 AC_MSG_RESULT($use_no_sign_warning)
1198 if test "x-$use_no_sign_warning" = "x-yes" ; then
1199     aros_config_cflags="$aros_config_cflags -Wno-pointer-sign"
1201 CFLAGS="$save_cflags"
1203 #-----------------------------------------------------------------------------
1205 # Find all the tools we need to compile. This could be cross-compiling
1206 # though! If that is the case we use the GNU form of the target and
1207 # simply add this to the front of the binary name. This is rather simple,
1208 # but it should work under most circumstances.
1210 # The default tools are to use the same as the host, but only if the
1211 # host and target CPU are the same. With GCC this is normally enough.
1214 aros_cc_pre=""
1215 aros_shared_ld="$aros_host_ld"
1217 aros_target_mkdep="$aros_host_mkdep"
1218 aros_target_incl_def="$aros_host_incl"
1220 aros_kernel_cc="$CC"
1222 # The default tools executables to be linked to.
1223 if test "$aros_target_cc" != ""; then
1224     AC_PATH_PROG(aros_target_cc,$aros_target_cc)
1225     AROS_REQUIRED(gcc,$aros_target_cc)
1227 if test "$aros_target_ld" != ""; then
1228     AC_PATH_PROG(aros_target_ld,$aros_target_ld)
1229     AROS_REQUIRED(ld,$aros_target_ld)
1232 if test "$crosstools" != "yes"; then
1233     AROS_TOOL_TARGET(aros_target_as_ln,as,$aros_target_as)
1234     AROS_REQUIRED(as,$aros_target_as_ln)
1235     AROS_TOOL_TARGET(aros_kernel_ld,ld,$aros_kernel_ld)
1236     AROS_REQUIRED(ld,$aros_kernel_ld)
1237     AROS_TOOL_TARGET(aros_target_ar_ln,ar,$aros_target_ar)
1238     AROS_REQUIRED(ar,$aros_target_ar_ln)
1239     AROS_TOOL_TARGET(aros_target_nm_ln,nm,$aros_target_nm)
1240     AROS_REQUIRED(nm,$aros_target_nm_ln)
1241     AROS_TOOL_TARGET(aros_target_objcopy_ln,objcopy,$aros_target_objcopy)
1242     AROS_REQUIRED(objcopy,$aros_target_objcopy_ln)
1243     AROS_TOOL_TARGET(aros_target_objdump_ln,objdump,$aros_target_objdump)
1244     AROS_REQUIRED(objdump,$aros_target_objdump_ln)
1245     AROS_TOOL_TARGET(aros_target_ranlib_ln,ranlib,$aros_target_ranlib)
1246     AROS_REQUIRED(ranlib,$aros_target_ranlib_ln)
1247     AROS_TOOL_TARGET(aros_target_strip_ln,strip,$aros_target_strip)
1248     AROS_REQUIRED(strip,$aros_target_strip_ln)
1251 if test "$rescomp" != ""; then
1252     if test "$cross_compiling" = "yes" ; then
1253         rescomp=${target_tool_prefix}${rescomp}
1254     fi
1255     AC_PATH_PROG(aros_kernel_rescomp,$rescomp)
1256     AROS_REQUIRED($rescomp,$aros_kernel_rescomp)
1259 aros_hostcfg_dir="bin/${aros_host_arch}-${aros_host_cpu}/gen/config"
1260 aros_targetcfg_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/config"
1261 aros_inc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/AROS/Development/include/aros"
1262 aros_gendir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen"
1263 aros_geninc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/include/aros"
1264 aros_tools_dir="bin/${aros_host_arch}-${aros_host_cpu}/tools"
1265 aros_scripts_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/scripts"
1267 # aros_cc_pre is a variable that is added to the front of the compiler name
1268 # in the generated aros-gcc shell script. We need this to enable the cache
1269 # to work across cleaned builds. Also, support DISTCC using the correct
1270 # environment variable.
1273 if test "x${DISTCC}" != "x" ; then
1274     if test "x${CCACHE}" != "x" ; then
1275         aros_cc_pre="env CCACHE_PREFIX=${DISTCC} ${CCACHE} "
1276     else
1277         aros_cc_pre="${DISTCC} "
1278     fi
1279 else
1280     if test "x${CCACHE}" != "x" ; then
1281         aros_cc_pre="${CCACHE} "
1282     fi
1285 prefix="${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros"
1287 AC_SUBST(aros_target_nostdinc_cflags,-nostdinc)
1288 AC_SUBST(aros_target_nostartup_ldflags,-nostartfiles)
1289 AC_SUBST(aros_target_nix_ldflags,-nix)
1290 AC_SUBST(aros_target_detach_ldflags,-detach)
1291 AC_SUBST(aros_target_nostdlib_ldflags,-nostdlib)
1293 # Target tools
1294 if test "$aros_target_cc" = ""; then
1295     orig_target_cc=$aros_kernel_cc
1296 else
1297     orig_target_cc=$aros_target_cc
1299 if test "$aros_target_ld" = ""; then
1300     orig_target_ld=$aros_kernel_ld
1301 else
1302     orig_target_ld=$aros_target_ld
1304 if test "$GCC" = "yes"; then
1305     aros_target_cc_path=`$orig_target_cc -print-search-dirs | grep "programs: =" | cut -c 12-`
1307 aros_target_cc="${prefix}-gcc"
1308 aros_target_as="${prefix}-as"
1309 aros_target_ld="${prefix}-ld"
1310 aros_target_ar="${prefix}-ar $aros_target_ar_flags"
1311 aros_target_objcopy=${prefix}-objcopy
1312 aros_target_objdump=${prefix}-objdump
1313 aros_target_ranlib="${prefix}-ranlib $aros_target_ranlib_flags"
1314 aros_target_nm="${prefix}-nm $aros_target_nm_flags"
1315 aros_kernel_nm="${prefix}-nm"
1316 aros_target_strip=${prefix}-strip
1318 # Find the system include path. We can suggest that an alternative is
1319 # used if we don't get it correct. The default is to use /usr/include.
1320 # Which is set in the aros_target_incl_def variable.
1322 AC_ARG_ENABLE(includes,
1323 AC_HELP_STRING([--enable-includes=dir],[Alternative system include directory]),
1324 [aros_target_incl=$enable_includes], [aros_target_incl=$aros_target_incl_def])
1326 dnl find out about the target cc's include path
1327 AC_MSG_CHECKING([for the target compiler's include path])
1328 if test "$aros_target_cc_includes" = "" ; then
1329     #try to guess where the directory is
1330     aros_target_cc_includes=`dirname \`${orig_target_cc} -print-libgcc-file-name\``/include
1331     if ! test -d $aros_target_cc_includes; then
1332         #the directory doesn't exist, we need to do some more work
1333         aros_target_cc_includes=${PWD}/${aros_gendir}/cc_include
1334         
1335         #these are the headers we're looling for
1336         headers="limits.h mmintrin.h stdbool.h syslimits.h float.h \
1337                  stddef.h xmmintrin.h iso646.h stdarg.h unwind.h   \
1338                  zutil.h"
1340         dirs=
1341         for h in $headers; do
1342             #which other headers each of the above headers needs?
1343             deps=$(echo "#include <$h>" | \
1344                    $aros_host_cc -E -M - 2>/dev/null | \
1345                    sed 's/^.*://; s/\\$/ /g; s/[[ \t]]\+/ /g')
1346             
1347             #copy all the needed headers to a directory beneath gendir
1348             for d in $deps; do
1349                 h=$(basename $d)
1350                 dir=${aros_target_cc_includes}$(echo $(dirname $d) | \
1351                                                 sed -n "s,^.*/include\(/.*\),\1,p")
1352                 ! test -d $dir && mkdir -p $dir
1353                 ! test -f $dir/$h && { cp $d $dir; chmod u+w $dir/$h; }
1354             done
1355         done        
1356     fi
1358 AC_MSG_RESULT($aros_target_cc_includes)
1361 # For GCC < 4.0 -I- is used for giving the search path for '#include "..."'
1362 # On GCC >= 4.0 -iquote should be used
1365 save_cc="$CC"
1366 save_cflags="$CFLAGS"
1367 CFLAGS="-iquote."
1368 AC_MSG_CHECKING([whether ${CC} accepts -iquote])
1369 AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
1370 AC_MSG_RESULT($has_iquote)
1371 if test "x-$has_iquote" = "x-yes" ; then
1372     host_cflags_iquote=-iquote
1373     host_cflags_iquote_end=
1374 else
1375     host_cflags_iquote=-I
1376     host_cflags_iquote_end=-I-
1378 kernel_cflags_iquote=$host_cflags_iquote
1379 kernel_cflags_iquote_end=$host_cflags_iquote_end
1380 if test "x-$cross_compiling" = "x-yes"; then
1381     CC="$aros_kernel_cc"
1382     AC_MSG_CHECKING([whether ${CC} accepts -iquote])
1383     AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
1384     AC_MSG_RESULT($has_iquote)
1385     if test "x-$has_iquote" = "x-yes" ; then
1386         kernel_cflags_iquote=-iquote
1387         kernel_cflags_iquote_end=
1388     else
1389         kernel_cflags_iquote=-I
1390         kernel_cflags_iquote_end=-I-
1391     fi
1393 aros_cflags_iquote=$kernel_cflags_iquote
1394 aros_cflags_iquote_end=$kernel_cflags_iquote_end
1395 if test "$orig_target_cc" != "$aros_kernel_cc"; then
1396     CC="$orig_target_cc"
1397     AC_MSG_CHECKING([whether ${CC} accepts -iquote])
1398     AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
1399     AC_MSG_RESULT($has_iquote)
1400     if test "x-$has_iquote" = "x-yes" ; then
1401         aros_cflags_iquote=-iquote
1402         aros_cflags_iquote_end=
1403     else
1404         aros_cflags_iquote=-I
1405         aros_cflags_iquote_end=-I-
1406     fi
1408 CC="$save_cc"
1409 CFLAGS="$save_cflags"
1411 AC_SUBST(host_cflags_iquote)
1412 AC_SUBST(host_cflags_iquote_end)
1413 AC_SUBST(kernel_cflags_iquote)
1414 AC_SUBST(kernel_cflags_iquote_end)
1415 AC_SUBST(aros_cflags_iquote)
1416 AC_SUBST(aros_cflags_iquote_end)
1419 dnl Check if user specified --with-resolution=XRESxYRESxDEPTH
1420 AC_MSG_CHECKING([for default resolution of WBScreen])
1421 AC_ARG_WITH(resolution,AC_HELP_STRING([--with-resolution=XRESxYRESxDEPTH],[Default resolution of the initial WorkbenchScreen]),resolution=$withval,resolution=none)
1422 # We require an argument, so map --with/--without ("yes"/"no") to "none" specified
1423 if test "$resolution" = "yes" ; then
1424     resolution="none"
1426 if test "$resolution" = "no" ; then
1427     resolution="none"
1429 if test "$resolution" != "none" ; then
1430     aros_default_wbwidth=`echo $resolution | cut -d'x' -f1`
1431     aros_default_wbheight=`echo $resolution | cut -d'x' -f2`
1432     aros_default_wbdepth=`echo $resolution | cut -d'x' -f3`
1434 AC_MSG_RESULT($aros_default_wbwidth x $aros_default_wbheight x $aros_default_wbdepth)
1435 aros_cv_default_wbwidth=$aros_default_wbwidth
1436 aros_cv_default_wbheight=$aros_default_wbheight
1437 aros_cv_default_wbdepth=$aros_default_wbdepth
1439 dnl See if the user wants the BOCHS hack for native flavour
1440 AC_MSG_CHECKING([if bochs hack is enabled])
1441 AC_ARG_ENABLE(bochs_hack,AC_HELP_STRING([--enable-bochs-hack],[Enable hacks to make BOCHS (partly) work (default=no)]),bochs_hack="yes",bochs_hack="no")
1442 if test "$bochs_hack" = "yes" ; then
1443     aros_bochs_hack="1"
1445 AC_MSG_RESULT($bochs_hack)
1447 dnl See if the user wants the serial debug output for native flavour
1448 AC_MSG_CHECKING([if serial debug is enabled])
1449 AC_ARG_WITH(serial-debug,AC_HELP_STRING([--with-serial-debug],[Enable serial debug output in native (default=no)]),serial_debug=$withval,serial_debug=none)
1450 if test "$aros_serial_debug" = 0 ; then
1451     serial_debug_forced=""
1452     if test "$serial_debug" = "yes" ; then
1453         serial_debug="2"
1454     fi
1455     if test "$serial_debug" = "no" ; then
1456         serial_debug="none"
1457     fi
1458 else
1459     serial_debug_forced="(forced)"
1460     serial_debug=$aros_serial_debug
1462 if test "$serial_debug" != "none" ; then
1463     aros_serial_debug=$serial_debug
1464     AC_MSG_RESULT($serial_debug_forced on port $serial_debug)
1465 else
1466     AC_MSG_RESULT(no)
1469 dnl See if the user wants the palm debug output hack for palm native flavour
1470 AC_MSG_CHECKING([if palm debug hack is enabled])
1471 AC_ARG_ENABLE(palm_debug_hack,AC_HELP_STRING([--enable-palm-debug-hack],[Enable palm debug output hack in palm native (default=no)]),palm_debug_hack="yes",palm_debug_hack="no")
1472 if test "$palm_debug_hack" = "yes" ; then
1473     aros_palm_debug_hack="1"
1475 AC_MSG_RESULT($palm_debug_hack)
1478 dnl See if the user wants nesting supervisor activated for unix flavour
1479 AC_MSG_CHECKING([if nesting supervisor support is enabled])
1480 AC_ARG_ENABLE(nesting_supervisor,AC_HELP_STRING([--enable-nesting-supervisor],[Enable nesting supervisor support in unix (default=no)]),nesting_supervisor="yes",nesting_supervisor="no")
1481 if test "$nesting_supervisor" = "yes" ; then
1482     aros_nesting_supervisor="1"
1484 AC_MSG_RESULT($nesting_supervisor)
1487 dnl things specifically required for hosted flavours
1488 if test "x-$aros_flavour" = "x-emulation" -o "x-$aros_flavour" = "x-emulcompat" ; then
1490     if test "x-$need_dlopen" != "x-no" ; then
1491       dnl some kind of dynamic library access system is required for hostlib.resource
1492       AC_CHECK_FUNC(dlopen, have_dl="yes", have_dl="no")
1493       if test "x-$have_dl" = "x-no" ; then
1494           AC_CHECK_LIB(dl, dlopen, [have_dl="yes"
1495                                     aros_host_ldflags="$aros_host_ldflags -ldl"],
1496                                     have_dl="no")
1497       fi
1498       if test "x-$have_dl" = "x-no" ; then
1499           AC_MSG_ERROR([dlopen() dynamic linker functions not available])
1500       fi
1501     fi
1504     dnl x11 hidd
1505     AC_ARG_ENABLE(x11_hidd, AC_HELP_STRING([--enable-x11-hidd],
1506                                            [build X11 hidd for hosted (default=auto)]),
1507                                            x11_hidd="$enableval",
1508                                            x11_hidd="auto")
1509     case "x-$x11_hidd" in
1510         x-yes|x-no|x-auto)                 ;;
1511         *)                 x11_hidd="auto" ;;
1512     esac
1514     ENABLE_X11=0
1516     dnl they want it
1517     if test "x-$x11_hidd" != "x-no" ; then
1519         dnl find x11 stuff
1520         AC_PATH_X
1522         x_cflags=
1523         for path in $x_libraries
1524         do
1525             x_cflags="$x_cflags -L$path"
1526         done
1528         for path in $x_includes
1529         do
1530             x_cflags="$x_cflags -I$path"
1531         done
1532         
1533         if test "x-$no_x" = "x-yes" ; then
1535             dnl didn't find it
1536             if test "x-$x11_hidd" != "x-auto" ; then
1537                 dnl and they explicitly asked for it, bail out
1538                 AC_MSG_ERROR([X11 libs/headers not found, cannot build X11 hidd as requested])
1539             fi
1540         
1541         else
1542             dnl found it, setup the metatarget
1543             x11_hidd_target=kernel-x11gfx-kobj
1544             ENABLE_X11=1
1546             dnl setup shared memory extensions
1547             AC_ARG_ENABLE(x11_shm, AC_HELP_STRING([--enable-x11-shm],
1548                                                   [use X11 shared memory (default=auto)]),
1549                                                   x11_hidd_shm="$enableval",
1550                                                   x11_hidd_shm="auto")
1551             case "x-$x11_hidd_shm" in
1552                 x-yes|x-no|x-auto)                     ;;
1553                 *)                 x11_hidd_shm="auto" ;;
1554             esac
1556             have_xshm=no
1558             dnl they want it
1559             if test "x-$x11_hidd_shm" != "x-no" ; then
1561                 dnl system shm headers
1562                 AC_CHECK_HEADERS(sys/ipc.h)
1563                 AC_CHECK_HEADERS(sys/shm.h)
1565                 dnl got them
1566                 if test "x-$ac_cv_header_sys_ipc_h" = "x-yes" -a "x-$ac_cv_header_sys_shm_h" = "x-yes" ; then
1568                     dnl make sure X libs have shm functions
1569                     save_cflags="$CFLAGS"
1570                     CFLAGS="$CFLAGS $x_cflags"
1571                     AC_CHECK_LIB(Xext, XShmQueryExtension, have_xshm=yes)
1572                     CFLAGS="$save_cflags"
1573                 fi
1574             fi
1576             dnl detection done, prepare output
1577             if test "x-$have_xshm" = "x-yes" ; then
1578                 dnl we can do shm
1579                 DO_XSHM_SUPPORT="1"
1580             elif test "x-$x11_hidd_shm" = "x-yes" ; then
1581                 dnl they explicitly asked for it, but we can't do it
1582                 AC_MSG_ERROR([X11 has no support for shared memory, cannot enable it as requested])
1583             else
1584                 dnl otherwise just disable it
1585                 DO_XSHM_SUPPORT="0"
1586             fi
1588             
1589             dnl setup vidmode (fullscreen) extensions
1590             AC_ARG_ENABLE(x11_vidmode, AC_HELP_STRING([--enable-x11-vidmode],
1591                                                       [use X11 vidmode extension (default=auto)]),
1592                                                       x11_hidd_vidmode="$enableval",
1593                                                       x11_hidd_vidmode="auto")
1594             case "x-$x11_hidd_vidmode" in
1595                 x-yes|x-no|x-auto)                         ;;
1596                 *)                 x11_hidd_vidmode="auto" ;;
1597             esac
1599             have_vidmode=no
1601             dnl they want it
1602             if test "x-$x11_hidd_vidmode" != "x-no" ; then
1604                 dnl make sure X libs have vidmode functions
1605                 save_cflags="$CFLAGS"
1606                 CFLAGS="$CFLAGS $x_cflags"
1607                 AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryExtension, have_vidmode=yes)
1608                 CFLAGS="$save_cflags"
1609             fi
1611             dnl detection done, prepare output
1612             if test "x-$have_vidmode" = "x-yes" ; then
1613                 dnl we can do vidmode
1614                 DO_VIDMODE_SUPPORT="1"
1615             elif test "x-$x11_hidd_vidmode" = "x-yes" ; then
1616                 dnl they explicitly asked for it, but we can't do it
1617                 AC_MSG_ERROR([X11 vidmode extension not available, cannot enable it as requested])
1618             else
1619                 dnl otherwise just disable it
1620                 DO_VIDMODE_SUPPORT="0"
1621             fi
1622         fi
1624         aros_host_x11_includes=$x_includes 
1625         aros_host_x11_libdirs=$x_libraries
1626     fi
1629     dnl sdl hidd
1630     AC_ARG_ENABLE(sdl_hidd, AC_HELP_STRING([--enable-sdl-hidd],
1631                                            [build SDL hidd for hosted (default=auto)]),
1632                                            sdl_hidd="$enableval",
1633                                            sdl_hidd="auto")
1634     case "x-$sdl_hidd" in
1635         x-yes|x-no|x-auto)                 ;;
1636         *)                 sdl_hidd="auto" ;;
1637     esac
1639     dnl they want it
1640     if test "x-$sdl_hidd" != "x-no" ; then
1642         dnl find sdl
1643         AM_PATH_SDL([1.2.10], have_sdl="yes", have_sdl="no")
1645         if test "x-$have_sdl" != "x-yes" ; then
1647             dnl didn't find it
1648             if test "x-$sdl_hidd" != "x-auto" ; then
1649                 dnl and they explicitly asked for it, bail out
1650                 AC_MSG_ERROR([SDL libs/headers not found, cannot build SDL hidd as requested])
1651             fi
1653         else
1654             dnl found it, set up the metatarget
1655             sdl_hidd_target=kernel-hidd-sdl
1656             aros_host_sdl_cflags=SDL_CFLAGS
1657             aros_host_sdl_libs=SDL_LIBS
1658         fi
1659     fi
1664 dnl See if the user wants dbus.library
1665 AC_MSG_CHECKING([if building of dbus.library is enabled])
1666 AC_ARG_ENABLE(dbus,AC_HELP_STRING([--enable-dbus],[Enable DBUS support via dbus.library (default=no)]),dbus="yes",dbus="no")
1667 if test "$dbus" = "yes" ; then
1668     ENABLE_DBUS=1
1669     DBUS_CFLAGS=`pkg-config --cflags dbus-1`
1670     DBUS_LIBFLAGS=`pkg-config --libs dbus-1`
1671     KERNEL_DBUS_KOBJ=kernel-dbus-kobj
1672     KERNEL_DBUS_INCLUDES=kernel-dbus-includes
1673 else
1674     ENABLE_DBUS=0
1676 AC_MSG_RESULT($dbus)
1679 dnl --------------------------------------------------------------------
1680 dnl Configuration Output Section
1681 dnl --------------------------------------------------------------------
1683 # Generic
1684 AC_SUBST(aros_arch)
1685 AC_SUBST(aros_cpu)
1686 AC_SUBST(aros_flavour)
1687 AC_SUBST(aros_flavour_uc)
1688 AC_SUBST(AROS_BUILDDIR)
1689 AC_SUBST(SRCDIR)
1690 AC_SUBST(AROS_PORTSSRCDIR)
1692 # Host related
1693 AC_SUBST(aros_cc_pre)
1694 AC_SUBST(aros_host_strip)
1695 AC_SUBST(aros_host_arch)
1696 AC_SUBST(aros_host_cpu)
1697 AC_SUBST(aros_host_cc)
1698 AC_SUBST(aros_host_ar)
1699 AC_SUBST(aros_host_ranlib)
1700 AC_SUBST(aros_host_ld)
1701 AC_SUBST(aros_host_make)
1702 AC_SUBST(aros_host_cflags)
1703 AC_SUBST(aros_host_ldflags)
1704 AC_SUBST(aros_host_debug)
1705 AC_SUBST(aros_host_mkdep)
1706 AC_SUBST(aros_host_mkargs)
1707 AC_SUBST(aros_host_exe_suffix)
1708 AC_SUBST(aros_host_lib_suffix)
1709 AC_SUBST(aros_tools_dir)
1710 AC_SUBST(aros_host_aclocal)
1711 AC_SUBST(aros_host_autoconf)
1712 AC_SUBST(aros_host_autoheader)
1713 AC_SUBST(aros_host_automake)
1715 # Target Related
1716 AC_SUBST(aros_target_guitheme)
1717 AC_SUBST(aros_target_iconset)
1718 AC_SUBST(aros_target_bootloader)
1719 AC_SUBST(aros_target_arch)
1720 AC_SUBST(aros_target_cpu)
1721 AC_SUBST(aros_target_variant)
1722 AC_SUBST(aros_target_suffix)
1723 AC_SUBST(aros_target_incl)
1724 AC_SUBST(aros_target_ar)
1725 AC_SUBST(aros_target_ranlib)
1726 AC_SUBST(aros_kernel_nm)
1727 AC_SUBST(orig_target_cc)
1728 AC_SUBST(aros_target_cc)
1729 AC_SUBST(aros_kernel_cc)
1730 AC_SUBST(aros_target_as)
1731 AC_SUBST(orig_target_ld)
1732 AC_SUBST(aros_target_ld)
1733 AC_SUBST(aros_kernel_ld)
1734 AC_SUBST(aros_target_cc_includes)
1735 AC_SUBST(aros_target_cc_path)
1736 AC_SUBST(aros_target_objdump)
1737 AC_SUBST(aros_target_objcopy)
1738 AC_SUBST(aros_target_strip)
1739 AC_SUBST(aros_target_nm)
1740 AC_SUBST(aros_kernel_rescomp)
1741 AC_SUBST(aros_shared_default)
1742 AC_SUBST(aros_shared_ld)
1743 AC_SUBST(aros_object_format)
1744 AC_SUBST(aros_compiler_libs)
1745 AC_SUBST(aros_arch_libs)
1747 AC_SUBST(aros_config_cflags)
1748 AC_SUBST(aros_config_aflags)
1749 AC_SUBST(aros_config_ldflags)
1751 AC_SUBST(aros_shared_cflags)
1752 AC_SUBST(aros_shared_aflags)
1753 AC_SUBST(aros_shared_ldflags)
1754 AC_SUBST(aros_kernel_cflags)
1755 AC_SUBST(aros_kernel_ldflags)
1756 AC_SUBST(aros_debug_cflags)
1757 AC_SUBST(aros_debug_aflags)
1758 AC_SUBST(aros_debug_ldflags)
1759 AC_SUBST(aros_target_genmap)
1760 AC_SUBST(aros_target_strip_flags)
1762 # Graphics Related
1763 AC_SUBST(x11_hidd_target)
1764 AC_SUBST(sdl_hidd_target)
1766 AC_SUBST(aros_default_wbwidth)
1767 AC_SUBST(aros_default_wbheight)
1768 AC_SUBST(aros_default_wbdepth)
1769 AC_SUBST(DO_XSHM_SUPPORT)
1770 AC_SUBST(DO_VIDMODE_SUPPORT)
1772 AC_SUBST(aros_host_x11_includes)
1773 AC_SUBST(aros_host_x11_libdirs)
1774 AC_SUBST(aros_host_sdl_cflags)
1775 AC_SUBST(aros_host_sdl_libs)
1777 # Native version related
1778 AC_SUBST(aros_bochs_hack)
1779 AC_SUBST(aros_serial_debug)
1781 # Palm native version related
1782 AC_SUBST(aros_palm_debug_hack)
1784 # Unix/Hosted version related
1785 AC_SUBST(aros_nesting_supervisor)
1787 # DBUS related
1788 AC_SUBST(ENABLE_DBUS)
1789 AC_SUBST(DBUS_CFLAGS)
1790 AC_SUBST(DBUS_LIBFLAGS)
1791 AC_SUBST(KERNEL_DBUS_KOBJ)
1792 AC_SUBST(KERNEL_DBUS_INCLUDES)
1794 #X11 related
1795 AC_SUBST(ENABLE_X11)
1797 # Debug related
1798 AC_SUBST(aros_debug)
1799 AC_SUBST(aros_mungwall_debug)
1800 AC_SUBST(aros_stack_debug)
1801 AC_SUBST(aros_modules_debug)
1803 # Collect-aros stuff: "-ius" to ignore undefined symbols
1804 AC_SUBST(ignore_undefined_symbols)
1806 # C compiler related
1807 AC_SUBST(gcc_target_cpu)
1809 dnl Prepare for output, make up all the generated patches
1810 case "$aros_flavour" in
1811 emulation)      aros_flavour_uc="AROS_FLAVOUR_EMULATION"
1812                 aros_flavour="emulation" ;;
1813 emulcompat)     aros_flavour_uc="(AROS_FLAVOUR_EMULATION|AROS_FLAVOUR_BINCOMPAT)"
1814                 aros_flavour="emulation" ;;
1815 standalone)     aros_flavour_uc="AROS_FLAVOUR_STANDALONE"
1816                 aros_flavour="standalone";;
1817 native)         aros_flavour_uc="AROS_FLAVOUR_NATIVE"
1818                 aros_flavour="native" ;;
1819 nativecompat)   aros_flavour_uc="(AROS_FLAVOUR_NATIVE|AROS_FLAVOUR_BINCOMPAT)"
1820                 aros_flavour="native" ;;
1821 linklib)        aros_flavour_uc="AROS_FLAVOUR_LINKLIB"
1822                 aros_flavour="linklib" ;;
1823 palmnative)     aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
1824                 aros_flavour="palmnative" ;;
1825 mac68knative)   aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
1826                 aros_flavour="mac68knative" ;;
1827 ppcnative)      aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_BINCOMPAT)"
1828                 aros_flavour="ppcnative" ;;
1829 esac
1831 if test ! -d ${aros_inc_dir} ; then
1832     ${MKDIR} ${aros_inc_dir}
1834 if test ! -d ${aros_geninc_dir} ; then
1835     ${MKDIR} ${aros_geninc_dir}
1837 if test ! -d ${aros_hostcfg_dir} ; then
1838     ${MKDIR} ${aros_hostcfg_dir}
1840 if test ! -d ${aros_targetcfg_dir} ; then
1841     ${MKDIR} ${aros_targetcfg_dir}
1843 if test ! -d ${aros_tools_dir} ; then
1844     ${MKDIR} ${aros_tools_dir}
1846 if test ! -d ${aros_scripts_dir} ; then
1847     ${MKDIR} ${aros_scripts_dir}
1850 AC_CONFIG_HEADERS(${aros_geninc_dir}/host-conf.h:config/host-conf.h.in)
1852 AC_CONFIG_COMMANDS([compiler_executable],
1853     [
1854         prefix=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}
1855         mkdir -p $prefix
1856         prefix="${prefix}/${aros_target_cpu}-aros"
1857         prefix2=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros
1859         echo ${prefix}
1860         echo ${prefix2}
1861         chmod a+x ${prefix2}-gcc ${prefix2}-ld
1863         ln -sf ${prefix2}-gcc          ${prefix}-gcc
1864         ln -sf ${prefix2}-ld           ${prefix}-ld
1866         ln -sf $aros_target_as_ln$aros_host_exe_suffix      ${prefix}-as
1867         ln -sf $aros_target_nm_ln$aros_host_exe_suffix      ${prefix}-nm
1868         ln -sf $aros_target_ar_ln$aros_host_exe_suffix      ${prefix}-ar
1869         ln -sf $aros_target_ranlib_ln$aros_host_exe_suffix  ${prefix}-ranlib
1870         ln -sf $aros_target_objcopy_ln$aros_host_exe_suffix ${prefix}-objcopy
1871         ln -sf $aros_target_objdump_ln$aros_host_exe_suffix ${prefix}-objdump
1872         ln -sf $aros_target_strip_ln$aros_host_exe_suffix   ${prefix}-strip
1874         ln -sf $aros_target_as_ln$aros_host_exe_suffix      ${prefix2}-as
1875         ln -sf $aros_target_nm_ln$aros_host_exe_suffix      ${prefix2}-nm
1876         ln -sf $aros_target_ar_ln$aros_host_exe_suffix      ${prefix2}-ar
1877         ln -sf $aros_target_ranlib_ln$aros_host_exe_suffix  ${prefix2}-ranlib
1878         ln -sf $aros_target_objcopy_ln$aros_host_exe_suffix ${prefix2}-objcopy
1879         ln -sf $aros_target_objdump_ln$aros_host_exe_suffix ${prefix2}-objdump
1880         ln -sf $aros_target_strip_ln$aros_host_exe_suffix   ${prefix2}-strip
1881     ],
1882     [
1883         aros_host_exe_suffix=${aros_host_exe_suffix}
1884         aros_tools_dir=${aros_tools_dir}
1885         aros_target_cpu=${aros_target_cpu}
1886         aros_target_arch=${aros_target_arch}
1887         aros_target_suffix=${aros_target_suffix}
1888         aros_target_nm_ln=${aros_target_nm_ln}
1889         aros_target_as_ln=${aros_target_as_ln}
1890         aros_target_ar_ln=${aros_target_ar_ln}
1891         aros_target_ranlib_ln=${aros_target_ranlib_ln}
1892         aros_target_objdump_ln=${aros_target_objdump_ln}
1893         aros_target_objcopy_ln=${aros_target_objcopy_ln}
1894         aros_target_strip_ln=${aros_target_strip_ln}
1895     ]
1897 AC_CONFIG_COMMANDS([genshared_executable],
1898     [chmod a+x ${aros_scripts_dir}/genshared],
1899     [aros_scripts_dir=${aros_scripts_dir}]
1901 AC_CONFIG_COMMANDS([genmf_executable],
1902     [chmod a+x ${aros_tools_dir}/genmf.py],
1903     [aros_tools_dir=${aros_tools_dir}]
1906 AC_CONFIG_FILES(
1907     Makefile
1908     config/make.cfg
1909     ${aros_inc_dir}/config.h:config/config.h.in
1910     ${aros_geninc_dir}/config.h:config/config.h.in
1911     ${aros_hostcfg_dir}/host.cfg:config/host.cfg.in
1912     ${aros_targetcfg_dir}/target.cfg:config/target.cfg.in
1913     mmake.config
1914     ${aros_targetcfg_dir}/make.defaults:config/make.defaults.in
1915     ${aros_targetcfg_dir}/specs:config/specs.in
1916     ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-gcc:scripts/aros-gcc.in
1917     ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-ld:scripts/aros-ld.in
1918     ${aros_scripts_dir}/genshared:compiler/c_lib/source/lib_source/genshared.in
1919     ${aros_tools_dir}/genmf.py:tools/genmf/genmf.py
1920     tools/collect-aros/env.h
1923 AC_OUTPUT
1925 dnl This is in order to not define SHARED_CFLAGS sometimes
1926 dnl We don't always do aros_shared_ar, aros_shared_cflags
1928 #XXX compatability...
1929 aros_shared_ar="$aros_shared_ld $aros_shared_ldflags -o"
1931 if test -n "$aros_shared_cflags" ; then
1932     echo "SHARED_CFLAGS := $aros_shared_cflags" >> ${aros_hostcfg_dir}/host.cfg
1933     echo "SHARED_AR := $aros_shared_ar" >> ${aros_hostcfg_dir}/host.cfg