seperate function for getting the stack pointer. moving towards a platform-specific...
[cake.git] / configure.in
blob1839e610925d68b2e1c1785875c311aef0672d82
1 dnl Copyright © 1997-2008, 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 #don't know where else to put this...
47 AC_MSG_CHECKING([Building AROS in .. ])
48 AROS_BUILDDIR=$PWD
49 AC_MSG_RESULT($AROS_BUILDDIR)
51 AC_MSG_CHECKING([AROS Source in .. ])
52 srcpwd=`cd ${srcdir} ; ${PWDCMD-pwd}`
53 SRCDIR=${srcpwd}
54 AC_MSG_RESULT($SRCDIR)
56 # Parse the target field into something useful.
57 changequote(<<,>>)
58 target_os=`echo $target | sed 's/^\([^-]*\)-\(.*\)$/\1/'`
59 target_cpu=`echo $target | sed 's/^\([^-]*\)-\(.*\)$/\2/'`
60 changequote([,])
62 dnl --------------------------------------------------------------------
63 dnl Set the default Workbench resolution
64 dnl --------------------------------------------------------------------
65 aros_default_wbwidth=800
66 aros_default_wbheight=600
67 aros_default_wbdepth=4
69 dnl --------------------------------------------------------------------
70 dnl Host Configuration Section
71 dnl --------------------------------------------------------------------
72 dnl
73 dnl The idea here is to find out all the information we need about the
74 dnl host. This means things like tools for building directory structures,
75 dnl copying files around and the like.
77 # The first step is to find the host binaries.
78 # Check for a compiler.
79 AC_PROG_CC
80 AC_PROG_CC_STDC
81 AC_PROG_CPP
83 # Check for a compatible awk
84 AC_CHECK_PROGS(AWK,[gawk nawk])
85 AROS_REQUIRED(gawk,$AWK)
86 AROS_PROG(MMAKE,mmake)
88 # Perform some default variable assignments. Note all of these will be
89 # Regenerated from the script, so there is no need to cache them.
91 aros_host_cc="$CC"
92 AROS_TOOL_CCPATH(aros_host_ld,ld)
93 AROS_REQUIRED(ld,$aros_host_ld)
94 aros_host_make="make"
95 aros_host_cflags=$CFLAGS
96 aros_host_ldflags=$LDFLAGS
97 aros_host_debug="-g -O0"
98 aros_host_mkdep="\$(SRCDIR)/scripts/mkdep"
99 aros_host_mkargs="--no-print-directory"
100 aros_host_incl="/usr/include"
101 aros_host_exe_suffix="$EXEEXT"
102 aros_host_lib_suffix=""
104 AC_CHECK_PROGS(aros_host_aclocal,[aclocal aclocal19 aclocal-1.9])
105 AC_CHECK_PROGS(aros_host_autoconf,[autoconf autoconf259 autoconf253])
106 AC_CHECK_PROGS(aros_host_autoheader,[autoheader autoheader259 autoheader253])
107 AC_CHECK_PROGS(aros_host_automake,[automake automake19 automake-1.9])
109 AROS_REQUIRED(aclocal/aclocal19/aclocal-1.9, $aros_host_aclocal)
110 AROS_REQUIRED(automake/automake19/automake-1.9, $aros_host_automake)
112 case "$aros_host_cc" in
113     *gcc*)
114         aros_host_cc_pipe="-pipe"
115         ;;
116     icc)
117         aros_host_cc_pipe=""
118         ;;
119     *)
120         aros_host_cc_pipe=""
121         ;;
122 esac
124 dnl Despite the name, this is really a host configuration variable.
125 aros_target_cc_includes=""
127 # This is the main host configuration section. It is where the host
128 # can change the values of any variables it needs to change. We do
129 # not look at anything that compiles to the target yet, we'll get
130 # to that later.
132 case "$host_os" in
133     aros*)
134         aros_host_arch="aros"
135         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
136         case "$host_cpu" in
137             *i?86*)
138                 aros_host_cpu="i386"
139                 ;;
140             *x86_64*)
141                 aros_host_cpu="x86_64"
142                 ;;
143             *)
144                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
145                 aros_host_cpu="$host_cpu"
146                 ;;
147         esac
148         ;;
150     linux*)
151         aros_host_arch="linux"
152         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
153         case "$host_cpu" in
154             *i?86*)
155                 aros_host_cpu="i386"
156                 ;;
157             *x86_64*)
158                 aros_host_cpu="x86_64"
159                 ;;
160             *m68k*)
161                 aros_host_cpu="m68k"
162                 ;;
163             *powerpc*)
164                 aros_host_cpu="ppc"
165                 ;;
166             *)
167                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
168                 aros_host_cpu="$host_cpu"
169                 ;;
170         esac
171         ;;
173     freebsd*)
174         aros_host_cc="$aros_host_cc $aros_host_cc_pipe -I/usr/local/include"
175         aros_host_make="gmake"
176         aros_host_arch="freebsd"
177         aros_host_cpu="i386"
179         aros_host_ldflags="$aros_host_ldflags -L/usr/local/lib -liconv"
181         dnl Need to override this here, it's just too hard later.
182         dnl This shouldn't be here at all...
183         dnl aros_target_cc_includes="/usr/include"
185         dnl FreeBSD 5.x (and later) has changed the default object format.
186         dnl The double [[]] is necessary to get around m4's quoting rules.
187         case $host_os in
188             freebsd[[234]]*)
189                 aros_object_format="elf_i386"
190                 ;;
192             *)
193                 aros_object_format="elf_i386_fbsd"
194                 ;;
195         esac
197         ;;
199     darwin*)
200         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
201         aros_host_arch="darwin"
202         case "$host_cpu" in
203             *i?86*)
204                 aros_host_cpu="i386"
205                 ;;
206             *powerpc*)
207                 aros_host_cpu="ppc"
208                 ;;
209             *)
210                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
211                 aros_host_cpu="$host_cpu"
212                 ;;
213         esac
215         aros_host_ldflags="$aros_host_ldflags -liconv"
217         ;;
219     netbsd*)
220         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
221         aros_host_make="gmake"
222         aros_host_arch="netbsd"
223         case "$host_cpu" in
224             *i?86*)
225                 aros_host_cpu="i386"
226                 ;;
227             *m68k*)
228                 aros_host_cpu="m68k"
229                 ;;
230             *)
231                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
232                 aros_host_cpu="$host_cpu"
233                 ;;
234         esac    
235         aros_host_lib_suffix=".0.0"
236         ;;
238     openbsd*)
239         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
240         aros_host_make="gmake"
241         aros_host_arch="openbsd"
242         case "$host_cpu" in
243             *i?86*)
244                 aros_host_cpu="i386"
245                 ;;
246             *)
247                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
248                 aros_host_cpu="$host_cpu"
249                 ;;
250         esac
251         ;;
252         
253     solaris*)
254         aros_host_arch="solaris"
255         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
256         case "$host_cpu" in
257             *i?86*)
258                 aros_host_cpu="i386"
259                 ;;
260             *sparc*)
261                 aros_host_cpu="sparc"
262                 ;;
263             *)
264                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
265                 aros_host_cpu="$host_cpu"
266                 ;;
267         esac
268         ;;
270     morphos*)
271         aros_host_arch="morphos"
272         aros_host_cpu="ppc"
273         ;;
275     amiga*)
276         aros_host_arch="amiga"
277         SORT="/gg/bin/sort"
278         TEST="/gg/bin/test"
279         UNIQ="/gg/bin/uniq"
280         FOR="for"
281         TOUCH="/gg/bin/touch"
282         case "$host_cpu" in
283             *m68k*)
284                 aros_host_cpu="m68k"
285                 ;;
286             *powerpc*)
287                 aros_host_cpu="ppc"
288                 ;;
289             *)
290                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
291                 aros_host_cpu="$host_cpu"
292                 ;;
293         esac
294         ;;
296     cygwin*)
297         aros_host_arch="cygwin"
298         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
299         case "$host_cpu" in
300             *i?86*)
301                 aros_host_cpu="i386"
302                 ;;
303             *)
304                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
305                 aros_host_cpu="$host_cpu"
306                 ;;
307         esac
308         ;;
310     mingw32*)
311         aros_host_arch="mingw32"
312         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
313         case "$host_cpu" in
314             *i?86*)
315                 aros_host_cpu="i386"
316                 ;;
317             *)
318                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
319                 aros_host_cpu="$host_cpu"
320                 ;;
321         esac
322         ;;
323     *)
324         AC_MSG_ERROR([Unsupported host architecture $host])
325         ;;
326 esac
328 AROS_PROG(aros_host_ar,[ar],[cr])
329 AROS_REQUIRED(ar,$aros_host_ar)
330 AROS_PROG(aros_host_ranlib,ranlib)
331 AROS_REQUIRED(ranlib,$aros_host_ranlib)
332 AROS_PROG(aros_host_strip,strip)
333 AROS_REQUIRED(strip,$aros_host_strip)
335 AROS_PROG(RM,[rm],[-rf])
336 AROS_REQUIRED(rm,$RM)
337 AROS_PROG(CP,[cp])
338 AROS_REQUIRED(cp,$CP)
339 AROS_PROG(MV,[mv])
340 AROS_REQUIRED(mv,$MV)
341 AROS_PROG(ECHO,[echo])
342 AROS_REQUIRED(echo,$ECHO)
343 AROS_PROG(MKDIR,[mkdir],[-p])
344 AROS_REQUIRED(mkdir,$MKDIR)
345 AROS_PROG(TOUCH,[touch])
346 AROS_REQUIRED(touch,$TOUCH)
347 AROS_PROG(SORT,[sort])
348 AROS_REQUIRED(sort,$SORT)
349 AROS_PROG(UNIQ,[uniq])
350 AROS_REQUIRED(uniq,$UNIQ)
351 AROS_PROG(NOP,[true])
352 AROS_REQUIRED(true,$NOP)
353 AROS_PROG(CAT,[cat])
354 AROS_REQUIRED(cat,$CAT)
355 AROS_PROG(BISON,[bison])
356 AROS_REQUIRED(bison,$BISON)
357 AROS_PROG(FLEX,[flex])
358 AROS_REQUIRED(flex,$FLEX)
359 AROS_PROG(PNGTOPNM,[pngtopnm])
360 AROS_REQUIRED(pngtopnm,$PNGTOPNM)
361 AROS_PROG(PPMTOILBM,[ppmtoilbm])
362 AROS_REQUIRED(ppmtoilbm,$PPMTOILBM)
363 AROS_PROG(SED,[sed])
364 AROS_REQUIRED(sed,$SED)
365 AROS_PROG(CHMOD,[chmod])
366 AROS_REQUIRED(chmod,$CHMOD)
368 AM_PATH_PYTHON(2.2.1)
370 AC_SUBST(FOR, for)
371 AC_SUBST(IF, if)
372 AC_SUBST(TEST, test)
373 AC_SUBST(CMP, cmp)
375 dnl ---------------------------------------------------------------------------
376 dnl Look for things about the host system, good for hosted targets.
377 dnl ---------------------------------------------------------------------------
379 # Check for some includes for the X11 HIDD and the kernel
380 AC_CHECK_HEADERS([sys/ipc.h sys/shm.h \
381     sys/mmap.h sys/mman.h sysexits.h \
382     sys/statfs.h sys/statvfs.h sys/vfs.h sys/param.h \
385 AC_CHECK_HEADERS([sys/mount.h],,,[#include <sys/param.h>])
387 AC_HEADER_DIRENT
388 AC_HEADER_STAT
389 AC_HEADER_STDC
390 AC_HEADER_SYS_WAIT
391 AC_HEADER_TIME
392 AC_STRUCT_ST_BLKSIZE
393 AC_STRUCT_ST_BLOCKS
394 AC_STRUCT_ST_RDEV
395 AC_STRUCT_TM
396 AC_STRUCT_TIMEZONE
397 AC_TYPE_OFF_T
398 AC_TYPE_PID_T
399 AC_TYPE_SIZE_T
400 AC_TYPE_UID_T
402 AC_CHECK_MEMBERS(struct tm.tm_gmtoff)
404 # Look for some functions
405 AC_CHECK_FUNCS([getpagesize kqueue statfs statvfs \
406     clone kse_create rfork_thread thr_create sa_register \
407     getcontext makecontext setcontext sigaltstack swapcontext])
409 AC_FUNC_MMAP
412 dnl --------------------------------------------------------------------
413 dnl Target Configuration Section
414 dnl --------------------------------------------------------------------
416 dnl The target configuration section is responsible for setting up all
417 dnl the paths for includes, and tools required to build AROS to some
418 dnl particular target.
420 aros_config_cflags="-Wall -Werror-implicit-function-declaration"
421 aros_config_aflags="-Wall -x assembler-with-cpp -c"
422 aros_config_ldflags=""
424 aros_shared_default=yes
426 aros_shared_cflags="-fPIC"
427 aros_shared_aflags=""
428 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
429 aros_kernel_ldflags="-Wl,-rpath,./lib"
431 aros_target_ar_flags="cr"
432 aros_target_nm_flags="-C -ul"
433 aros_target_strip_flags="--strip-unneeded -R.comment"
435 aros_compiler_libs=
437 aros_target_genmap="-Wl,-Map -Xlinker"
439 # Native flavour stuff
440 aros_bochs_hack="0"
441 aros_serial_debug="0"
443 # Palm native flavour stuff
444 aros_palm_debug_hack="0"
446 # Unix flavour stuff
447 aros_nesting_supervisor="0"
449 # Collect-aros stuff: "-ius" to ignore undefined symbols
450 ignore_undefined_symbols=""
452 #-----------------------------------------------------------------------------
455 # GCC 4.1+ has a stack protection feature that requires OS support. Ubuntu has
456 # it switched on by default, and we use the host compiler, so it compiles AROS
457 # code with this enabled resulting in link failures as we don't have support
458 # for it.
460 # We use two methods to disable it. For the host compiler (used to compile
461 # some hosted modules), we test to see if the compiler supports stack
462 # protection, and if it does we disable it in AROS_CONFIG_CFLAGS. This should
463 # work on all platforms.
465 # For the "cross" compiler we clear the "ssp_default" spec in config/specs.in
466 # (this is done unconditionally, as it should have no effect on compilers
467 # without the stack protection feature). This may be specific to the way that
468 # Ubuntu enables the feature, so may not work everywhere. My specs-fu isn't
469 # strong enough to disable it in a generic way though, so we'll live with it
470 # until another vendor ships GCC with it enabled in a different way, and deal
471 # with it then.
474 AC_MSG_CHECKING([whether ${CC} accepts -fno-stack-protector])
475 save_cflags="$CFLAGS"
476 CFLAGS="$CFLAGS -fno-stack-protector"
477 AC_TRY_COMPILE(,, use_no_stack_protector="yes", use_no_stack_protector="no")
478 AC_MSG_RESULT($use_no_stack_protector)
479 if test "x-$use_no_stack_protector" = "x-yes" ; then
480     aros_host_cflags="$aros_host_cflags -fno-stack-protector"
482 CFLAGS="$save_cflags"
485 #-----------------------------------------------------------------------------
487 # Disable pointer-signedness warnings if the compiler recognises the option
488 # (this only works for the host compiler at the moment)
490 AC_MSG_CHECKING([whether ${CC} accepts -Wno-pointer-sign])
491 save_cflags="$CFLAGS"
492 CFLAGS="$CFLAGS -Wno-pointer-sign"
493 AC_TRY_COMPILE(,, use_no_sign_warning="yes", use_no_sign_warning="no")
494 AC_MSG_RESULT($use_no_sign_warning)
495 if test "x-$use_no_sign_warning" = "x-yes" ; then
496     aros_host_cflags="$aros_host_cflags -Wno-pointer-sign"
498 CFLAGS="$save_cflags"
500 #-----------------------------------------------------------------------------
502 AC_MSG_CHECKING([for type of build])
503 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")
505 if test "$build_type" = "nightly"; then
506     build_type_string="NIGHTLY"
507 elif test "$build_type" = "snapshot"; then
508     build_type_string="SNAPSHOT"
509 elif test "$build_type" = "milestone"; then
510     build_type_string="MILESTONE"
511 elif test "$build_type" = "release"; then
512     build_type_string="RELEASE"
513 else
514     build_type_string="PERSONAL"
515     build_type="personal"
518 aros_config_cflags="$aros_config_cflags -DAROS_BUILD_TYPE=AROS_BUILD_TYPE_$build_type_string"
520 AC_MSG_RESULT($build_type)
522 #-----------------------------------------------------------------------------
523 all_debug_types="messages stack mungwall modules symbols"
525 AC_MSG_CHECKING([which debug types to enable])
526 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)]),
527  debug="$enableval",debug="")
529 if test "$debug" = "" -o "$debug" = "no"; then
530     debug="none"
531 elif test "$debug" = "yes"; then
532     debug="all"
535 if test "$debug" = "all" ; then
536     debug=$all_debug_types
537     for d in $all_debug_types; do
538         export aros_${d}_debug="1"
539     done
540 else
541     for d in $all_debug_types; do
542         export aros_${d}_debug="0"
543     done
546 if test "$debug" != "none"; then
547     debug=`echo $debug | sed s/,/\ /g`
548     for d in $debug; do
549         found="0"
550         for d2 in $all_debug_types; do
551             if test "$d2" = "$d"; then
552                 found="1"
553                 break
554             fi
555         done
556         if test "$found" = "0"; then
557             AC_MSG_ERROR([unrecognized debug type "$d". Available types are: all none $all_debug_types])
558         fi
559         export aros_${d}_debug="1"
560     done
561     aros_debug="yes"
563 AC_MSG_RESULT($debug)
565 if test "$aros_messages_debug" = "1"; then
566     aros_messages_debug="-DADEBUG=1 -DMDEBUG=1"
567 else
568     aros_messages_debug=""
570 if test "$aros_symbols_debug" = "1"; then
571     aros_symbols_debug="-g"
572 else
573     aros_symbols_debug=""
576 # These are the flags to pass when compiling debugged programs
577 aros_debug_cflags="$aros_symbols_debug $aros_messages_debug"
578 aros_debug_aflags=""
579 aros_debug_ldflags="$aros_symbols_debug"
581 aros_crosstools="no"
583 #-----------------------------------------------------------------------------
584 #   Checking if we should build crosstools..
585 AC_MSG_CHECKING([whether to build crosstools])
586 AC_ARG_ENABLE(crosstools,AC_HELP_STRING([--enable-crosstools],[Build cross-compiler toolchains if necessary (default=no).]),crosstools="$enableval",crosstools="no")
587 if test "$crosstools" != "" -a "$crosstools" != "no"; then
588     AC_MSG_RESULT(yes)
589         aros_crosstools="yes"
590 else
591     AC_MSG_RESULT(no)
594 #-----------------------------------------------------------------------------
595 #   Checking for distcc and ccache.
597 #   Always apply the transforms in this particular order. Basically you should
598 #   always run 'ccache distcc compiler' in that order for the best performance.
600 AC_MSG_CHECKING([whether to enable distcc])
601 AC_ARG_ENABLE(distcc,AC_HELP_STRING([--enable-distcc],[Use distcc as a front end to the compiler (default=no).]),distcc="$enableval",distcc="no")
602 if test "$distcc" != "" -a "$distcc" != "no"; then
603     # AC_CHECK_PROG will print out the result in this case
604     AC_PATH_PROG(DISTCC,[distcc],distcc,)
605 else
606     AC_MSG_RESULT(no)
609 AC_MSG_CHECKING([whether to enable ccache])
610 AC_ARG_ENABLE(ccache,AC_HELP_STRING([--enable-ccache],[Use ccache as a front end to the compiler (default=no).]),ccache="$enableval",ccache="no")
611 if test "$ccache" != "" -a "$ccache" != "no"; then
612     # AC_CHECK_PROG will print out the result in this case
613     AC_CHECK_PROG(CCACHE,[ccache],ccache,)
614 else
615     AC_MSG_RESULT(no)
618 #-----------------------------------------------------------------------------
619 AC_MSG_CHECKING([what optimization flags to use])
620 AC_ARG_WITH(optimization,AC_HELP_STRING([--with-optimization=FLAGS],[Use optimization flags FLAGS (default=-O2).]),optimization="$withval",optimization="unknown")
621 if test "$optimization" = "unknown"; then
622     dnl default is -O2 for normal builds, -O0 for debug builds
623     if test "$debug" != "none"; then
624         optimization="-O0"
625     else
626         optimization="-O2"
627     fi
629 aros_config_cflags="$aros_config_cflags $optimization"
630 AC_MSG_RESULT($optimization)
632 #-----------------------------------------------------------------------------
633 AC_MSG_CHECKING([what target variant to enable])
634 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")
635 if test "$target_variant" = "none"; then
636     aros_target_variant=""
637     aros_target_suffix=""
638 else
639     aros_target_variant="$target_variant"
640     aros_target_suffix="-$target_variant"
642 AC_MSG_RESULT($enableval)
644 target_bootloader="none"
646 #-----------------------------------------------------------------------------
647 # This is the target configuration switch.
648 case "$target_os" in
649     linux*)
650         aros_target_arch="linux"
651         case "$target_cpu" in
652             *m68k*)
653                 aros_target_cpu="m68k"
654                 aros_object_format="m68kelf"
655                 aros_flavour="emulcompat"
656                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D__mc68000 -D__linux__"
657                 aros_shared_ldflags="-Wl,-T,\$(TOP)/config/linux/m68k/script.so"
658                 aros_kernel_ldflags="-Wl,-rpath,./lib,-T,\$(TOP)/config/linux/m68k/script.normal"
659                 gcc_target_cpu="mc68000"
660                 ;;
661             *i?86*)
662                 aros_target_cpu="i386"
663                 aros_object_format="elf_i386"
664                 aros_flavour="emulation"
665                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__linux__"
666                 aros_default_wbdepth=8
667                 gcc_target_cpu="i386"
668                 ;;
669             *x86_64*)
670                 aros_target_cpu="x86_64"
671                 aros_object_format="elf_x86_64"
672                 aros_flavour="emulation"
673                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64 -D__linux__"
674                 aros_config_cflags="$aros_config_cflags -mno-red-zone"
675                 aros_default_wbdepth=8
676                 gcc_target_cpu="x86_64"
677                 ;;
678             *powerpc*)
679                 aros_target_cpu="ppc"
680                 aros_object_format="elf32ppc"
681                 aros_flavour="emulation"
682                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc -D__linux__"
683                 aros_default_wbdepth=8
684                 gcc_target_cpu="ppc"
685                 ;;
686 # TODO
687 # Same as powerpc, but I need this for the nightly build to work again.
688 # Actually, the nightly should be made working with powerpc target.
689 # That just was too much work for the moment, another week or two.
690             *ppc*)
691                 aros_target_cpu="ppc"
692                 aros_object_format="elf32ppc"
693                 aros_flavour="emulation"
694                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc -D__linux__"
695                 aros_default_wbdepth=8
696                 gcc_target_cpu="ppc"
697                 ;;
698             *)
699                 AC_MSG_ERROR("Unknown CPU for Linux -- $target_cpu")
700                 ;;
701         esac
702     ;;
704     pc)
705         aros_target_arch="pc"
706         aros_shared_default="no"
707         target_bootloader="grub2"
708         case "$target_cpu" in
709             *i?86*)
710                 aros_target_cpu="i386"
712                 dnl If somebody hasn't already set the target object
713                 dnl format, then use this value. Mostly to support
714                 dnl FreeBSD cross-compilation.
715                 dnl TODO: Remove when we always use our compiler.
717                 if test "$aros_object_format" = "" ; then
718                     aros_object_format="elf_i386"
719                 fi
720                 aros_flavour="standalone"
721                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
722                 aros_kernel_ldflags=""
723                 aros_default_wbwidth=640
724                 aros_default_wbheight=480
725                 gcc_target_cpu="i386"
726                 ;;
727             *x86_64*)
728                 aros_target_cpu="x86_64"
729                 aros_serial_debug=1
730                 if test "$aros_object_format" = "" ; then
731                     aros_object_format="elf_x86_64"
732                 fi
733                 aros_flavour="standalone"
734                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
735                 aros_config_cflags="$aros_config_cflags -fno-asynchronous-unwind-tables -mno-red-zone"
736                 aros_kernel_ldflags=""
737                 aros_default_wbwidth=640
738                 aros_default_wbheight=480
739                 gcc_target_cpu="x86_64"
740                 ;;
741             *)
742                 AC_MSG_ERROR("Unknown native CPU -- $target_cpu")
743                 ;;
744         esac
745         ;;
747     prep)
748         aros_target_arch="prep"
749         aros_shared_default="no"
750         aros_target_cpu="ppc"
751         aros_object_format="elf32ppc"
752         aros_flavour="ppcnative"
753         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
754         aros_kernel_ldflags=""
755         aros_default_wbwidth=640
756         aros_default_wbheight=480
757         gcc_target_cpu="ppc"
758         ;;
760     freebsd*)
761         aros_target_arch="freebsd"
762         aros_target_cpu="i386"
763         aros_flavour="emulation"
764         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
765         gcc_target_cpu="i386"
767         aros_target_strip_flags="-x"
768         ;;
770     darwin*)
771         aros_target_arch="darwin"
772         aros_flavour="emulation"
773         dnl FIXME
774         dnl This test bypass was implemented for Darwin by port's author.
775         dnl I wonder why, since darwin port needs this function.
776         dnl I left it here just because port author did it.
777         need_dlopen="no"
778         case "$target_cpu" in
779                 *i?86*)
780                         aros_target_cpu="i386"
781                         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
782                         gcc_target_cpu="i386"
783                         aros_object_format="elf_i386"
784                         aros_target_strip_flags="-x"
785                         ;;
786                 *)
787                         AC_MSG_ERROR("Unsupported target CPU for darwin hosted flavour -- $target_cpu")
788                         ;;
789         esac
790         ;;
791     netbsd*)
792         aros_target_arch="netbsd"
793         case "$target_cpu" in
794             *m68k*)
795                 aros_target_cpu="m68k"
796                 aros_object_format="m68kelf"
797                 aros_flavour="emulcompat"
798                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D__mc68000 -D__NetBSD__"
799                 gcc_target_cpu="mc68000"
800                 ;;
801             *i?86*)
802                 aros_target_cpu="i386"
803                 aros_object_format="elf_i386"
804                 aros_flavour="emulation"
805                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__NetBSD__"
806                 aros_default_wbdepth=8
807                 gcc_target_cpu="i386"
808                 ;;
809             *)
810                 AC_MSG_ERROR("Unknown CPU for NetBSD -- $target_cpu")
811                 ;;
812         esac
813         aros_target_genmap="-Wl,-M -Xlinker >"
814         aros_flavour="emulation"
815         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
816         ;;   
818     openbsd*)
819         aros_target_arch="openbsd"
820         case "$target_cpu" in
821             *i?86*)
822                 aros_target_cpu="i386"
823                 aros_object_format="elf_i386"
824                 aros_flavour="emulation"
825                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__OpenBSD__"
826                 gcc_target_cpu="i386"
827                 ;;
828             *)
829                 AC_MSG_ERROR("Unknown CPU for OpenBSD -- $target_cpu")
830                 ;;
831         esac
832         aros_target_genmap="-Wl,-M -Xlinker >"
833         aros_target_nm_flags="-u"
834         aros_flavour="emulation"
835         ;;
837     solaris*)
838         aros_target_arch="solaris"
839         case "$target_cpu" in
840            *i?86*)
841                aros_target_cpu="i386"
842                aros_object_format="elf_i386"
843                aros_flavour="emulation"
844                aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__Solaris__"
845                aros_default_wbdepth=8
846                gcc_target_cpu="i386"
847                ;;
848             *sparc*)
849                 aros_target_cpu="sparc"
850                 aros_object_format="elf_sparc"
851                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dsparc -D__Solaris__"
852                 gcc_target_cpu="sparc"
853                 ;;
854             *)
855                 AC_MSG_ERROR("Unknown CPU for Solaris -- $target_cpu")
856                 ;;
857         esac
858         aros_config_cflags="$aros_config_cflags -D$aros_target_cpu"
859         aros_flavour="emulation"
860         ;;
862     morphos*)
863         aros_target_arch="morphos"
864         aros_shared_default="no"
865         aros_target_cpu="ppc"
866         aros_object_format="elf_ppc"
867         aros_flavour="nativecompat"
868         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
869         gcc_target_cpu="ppc"
870         ;;
872     sam440)
873         aros_target_arch="sam440"
874         aros_shared_default="no"
875         aros_target_cpu="ppc"
876         aros_object_format="elf32ppc"
877         aros_flavour="ppcnative"
878         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
879         aros_kernel_ldflags=""
880         aros_default_wbwidth=640
881         aros_default_wbheight=480
882         aros_config_cflags="$aros_config_cflags -mcpu=440fp -mno-toc -fno-asynchronous-unwind-tables"
883         gcc_target_cpu="powerpc"
884         ;;
886     chrp)
887     aros_target_arch="chrp"
888     aros_shared_default="no"
889     aros_target_cpu="ppc"
890     aros_object_format="elf32ppc"
891     aros_flavour="ppcnative"
892     aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
893     aros_kernel_ldflags=""
894     aros_default_wbwidth=640
895     aros_default_wbheight=480
896     aros_config_cflags="$aros_config_cflags -mno-toc -fno-asynchronous-unwind-tables"    
897     gcc_target_cpu="powerpc"
898         case "$aros_target_variant" in
899             efika)
900             aros_config_cflags="$aros_config_cflags -DBIG_ENDIAN_OHCI=1 -mcpu=603e"
901             ;;
902         esac
903     ;;
905     amiga*)
906         aros_target_arch="amiga"
907         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D_AMIGA -DAMIGA"
908         aros_shared_default="no"
910         aros_config_cflags="$aros_config_cflags -fomit-frame-pointer -fbuiltin -ffreestanding"
912         case "$target_cpu" in
913             *m68k*)
914                 aros_target_cpu="m68k"
915                 aros_object_format="m68kelf"
916                 aros_flavour="nativecompat"
917                 gcc_target_cpu="mc68000"
918                 ;;
919             *ppc*)
920                 aros_cpu="ppc"
921                 aros_flavour="native"
922                 gcc_target_cpu="ppc"
923                 ;;
924             *)
925                 AC_MSG_ERROR("Unknown CPU for Amiga $target_cpu")
926                 ;;
927         esac
928         ;;
930     mingw32*)
931         aros_target_arch="mingw32"
932         aros_shared_default="no"
933         need_dlopen="no"
934         rescomp="windres"
935         case "$target_cpu" in
936             *i?86*)
937                 aros_target_cpu="i386"
938                 aros_object_format="elf_i386"
939                 aros_flavour="emulation"
940                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
941                 aros_shared_cflags=""
942                 aros_default_wbdepth=8
943                 gcc_target_cpu="i386"
944                 aros_target_cc="i386-aros-gcc"
945                 aros_target_ld="i386-aros-ld"
946                 aros_target_as="i386-aros-as"
947                 aros_target_ar="i386-aros-ar"
948                 aros_target_ranlib="i386-aros-ranlib"
949                 aros_target_nm="i386-aros-nm"
950                 aros_target_strip="i386-aros-strip"
951                 aros_target_objcopy="i386-aros-objcopy"
952                 aros_target_objdump="i386-aros-objdump"
953                 target_tool_prefix="i386-mingw32-"
954                 ;;
955             *)
956                 AC_MSG_ERROR("Unknown CPU for Mingw32 -- $target_cpu")
957                 ;;
958         esac
959         if test $host_os = "cygwin"; then
960                 aros_kernel_cflags="-mno-cygwin"
961         fi
962     ;;
963     pp*)
964         aros_target_arch="pp"
965         aros_shared_default="no"
966         case "$target_cpu" in
967             *m68k*)
968                 aros_target_cpu="m68k"
969                 aros_object_format="m68kelf"
970                 aros_flavour="palmnative"
971                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
972                 aros_kernel_ldflags=""
973                 aros_default_wbwidth=160
974                 aros_default_wbheight=160
975                 aros_default_wbdepth=1
976                 aros_target_ar_flags="cru"
977                 aros_compiler_libs="-lgcc1"
978                 aros_shared_default=no
979                 aros_shared_cflags="-fpic"
980                 aros_shared_aflags=""
981                 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
982                 aros_kernel_ldflags="-Wl,-rpath,./lib"
983                 aros_debug_cflags="-Wall -Werror-implicit-function-declaration $aros_symbols_debug  $aros_messages_debug -mc68000 -Wa,-mc68000"
984                 aros_debug_aflags=""
985                 aros_debug_ldflags="$aros_symbols_debug"
986                 aros_mungwall_debug="0"
987                 aros_modules_debug="0"
988                 gcc_target_cpu="mc68000"
989                 ignore_undefined_symbols="-ius"
990                 ;;
991            *)
992                 AC_MSG_ERROR("Unknown CPU for PalmPilot -- $target_cpu")
993                 ;;
994         esac
995         ;;
997     mac*)
998         aros_target_arch="mac"
999         aros_shared_default="no"
1000         case "$target_cpu" in
1001             *m68k*)
1002                 aros_target_cpu="m68k"
1003                 aros_object_format="m68kelf"
1004                 aros_flavour="mac68knative"
1005                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
1006                 aros_default_wbwidth=512
1007                 aros_default_wbheight=384
1008                 aros_default_wbdepth=8
1009                 aros_target_ar_flags="cru"
1010                 aros_compiler_libs="-lgcc1"
1011                 aros_shared_default=no
1012                 aros_shared_cflags="-fpic"
1013                 aros_shared_aflags=""
1014                 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
1015                 aros_kernel_ldflags="-Wl,-rpath,./lib"
1016                 aros_debug_cflags="-Wall -Werror-implicit-function-declaration $aros_symbols_debug  $aros_messages_debug -mc68000"
1017                 aros_debug_aflags=""
1018                 aros_debug_ldflags="$aros_symbols_debug"
1019                 aros_mungwall_debug="0"
1020                 aros_modules_debug="0"
1021                 gcc_target_cpu="mc68000"
1022                 ignore_undefined_symbols="-ius"
1023                 ;;
1024            *)
1025                 AC_MSG_ERROR("Unknown CPU for Mac68k -- $target_cpu")
1026                 ;;
1027         esac
1028         ;;
1030     *)
1031         AC_MSG_ERROR([Unsupported target architecture $target])
1032         ;;
1033 esac
1035 AC_MSG_CHECKING([Where to download sourcecode for external ports])
1036 AC_ARG_WITH(portssources,AC_HELP_STRING([--with-portssources=DIR],[Where to download sourcecode for external ports]),with_portssrcdir=$withval,with_portssrcdir="default")
1037 if test "$with_portssrcdir" = "default"; then
1038     AROS_PORTSSRCDIR="$AROS_BUILDDIR/bin/Sources"
1039 else
1040     AROS_PORTSSRCDIR="$with_portssrcdir"
1042 AC_MSG_RESULT($AROS_PORTSSRCDIR)
1044 AC_MSG_CHECKING([which bootloader to use])
1045 AC_ARG_WITH(bootloader,AC_HELP_STRING([--with-bootloader=NAME],[Use a specific bootloader]),target_bootloader=$withval,target_bootloader=$target_bootloader)
1046 if test "$target_bootloader" = "none"; then
1047     aros_target_bootloader=""
1048 else
1049     aros_target_bootloader="$target_bootloader"
1051 AC_MSG_RESULT($target_bootloader)
1053 AC_MSG_CHECKING([which icon-set to use])
1054 AC_ARG_WITH(iconset,AC_HELP_STRING([--with-iconset=NAME],[Use a specific Icon-set (default=Gorilla).]),target_iconset=$withval,target_iconset="default")
1055 if test "$target_iconset" = "default"; then
1056     aros_target_iconset="Gorilla"
1057     target_iconset="default (Gorilla)"
1058 else
1059     aros_target_iconset="$target_iconset"
1061 AC_MSG_RESULT($target_iconset)
1063 # Check LZO when compiling the grub2 bootloader on i386/x86_64.
1064 aros_liblzo_check="no"
1065 case "$aros_target_bootloader" in
1066     grub2*)
1067     case "$target_cpu" in
1068         *i?86*)
1069         aros_liblzo_check="yes"
1070         ;;
1071         *x86_64*)
1072         aros_liblzo_check="yes"  
1073         ;;
1074         *)
1075         ;;
1076     esac
1077   
1078     ;;
1079    *)
1080     ;;
1081 esac
1083 if test "$aros_liblzo_check" = "yes"; then
1084     # There are three possibilities. LZO version 2 installed with the name
1085     # liblzo2, with the name liblzo, and LZO version 1.  
1086     AC_CHECK_LIB(lzo2, __lzo_init_v2, [LIBLZO="-llzo2"],  
1087     AC_CHECK_LIB(lzo, __lzo_init_v2, [LIBLZO="-llzo"],
1088                 AC_CHECK_LIB(lzo, __lzo_init2, [LIBLZO="-llzo"],
1089                 AC_MSG_ERROR([LZO library version 1.02 or later is required]))))
1091     AC_SUBST(LIBLZO)
1092     LIBS="$LIBS $LIBLZO"
1093     AC_CHECK_FUNC(lzo1x_999_compress, ,
1094                 [AC_MSG_ERROR([LZO1X-999 must be enabled])])
1096     # LZO version 2 uses lzo/lzo1x.h, while LZO version 1 uses lzo1x.h.
1097     AC_CHECK_HEADERS(lzo/lzo1x.h lzo1x.h)
1100 AC_MSG_CHECKING([which GUI Theme to use])
1101 AC_ARG_WITH(theme,AC_HELP_STRING([--with-theme=NAME],[Use a specific GUI Theme]),target_guitheme=$withval,target_guitheme="default")
1102 if test "$target_guitheme" = "default"; then
1103     aros_target_guitheme="Ice"
1104 else
1105     aros_target_guitheme="$target_guitheme"
1107 AC_MSG_RESULT($aros_target_guitheme)
1109 # Find out if we are cross-compiling (ie. if we can't use the host compiler
1110 # for target code)
1111 cross_compiling=no
1112 if test "$aros_host_cpu" != "$aros_target_cpu" ; then
1113     cross_compiling=yes
1115 if test "$aros_host_arch" == "darwin" ; then
1116     cross_compiling=yes
1119 # Set prefix for target compiler etc. if we're cross-compiling
1120 # (should possibly be earlier but needs to be after AC_PROG_CC)
1121 if test "$cross_compiling" = "yes" ; then
1122     if test "$target_tool_prefix" = ""; then
1123         target_tool_prefix=${target_cpu}-elf-
1124     fi
1125     CC=${target_tool_prefix}gcc
1128 #-----------------------------------------------------------------------------
1130 # Disable pointer-signedness warnings if the compiler recognises the option
1132 AC_MSG_CHECKING([whether ${CC} accepts -Wno-pointer-sign])
1133 save_cflags="$CFLAGS"
1134 CFLAGS="$CFLAGS -Wno-pointer-sign"
1135 AC_TRY_COMPILE(,, use_no_sign_warning="yes", use_no_sign_warning="no")
1136 AC_MSG_RESULT($use_no_sign_warning)
1137 if test "x-$use_no_sign_warning" = "x-yes" ; then
1138     aros_config_cflags="$aros_config_cflags -Wno-pointer-sign"
1140 CFLAGS="$save_cflags"
1142 #-----------------------------------------------------------------------------
1144 # Find all the tools we need to compile. This could be cross-compiling
1145 # though! If that is the case we use the GNU form of the target and
1146 # simply add this to the front of the binary name. This is rather simple,
1147 # but it should work under most circumstances.
1149 # The default tools are to use the same as the host, but only if the
1150 # host and target CPU are the same. With GCC this is normally enough.
1153 aros_cc_pre=""
1154 aros_shared_ld="$aros_host_ld"
1156 aros_target_mkdep="$aros_host_mkdep"
1157 aros_target_incl_def="$aros_host_incl"
1159 AC_PATH_PROG(aros_kernel_cc,$CC)
1161 # The default tools executables to be linked to.
1162 if test "$aros_target_cc" != ""; then
1163     AC_PATH_PROG(aros_target_cc,$aros_target_cc)
1164     AROS_REQUIRED(gcc,$aros_target_cc)
1166 if test "$aros_target_ld" != ""; then
1167     AC_PATH_PROG(aros_target_ld,$aros_target_ld)
1168     AROS_REQUIRED(ld,$aros_target_ld)
1171 if test "$crosstools" != "yes"; then
1172     AROS_TOOL_TARGET(aros_target_as_ln,as,$aros_target_as)
1173     AROS_REQUIRED(as,$aros_target_as_ln)
1174     AROS_TOOL_TARGET(aros_kernel_ld,ld,$aros_kernel_ld)
1175     AROS_REQUIRED(ld,$aros_kernel_ld)
1176     AROS_TOOL_TARGET(aros_target_ar_ln,ar,$aros_target_ar)
1177     AROS_REQUIRED(ar,$aros_target_ar_ln)
1178     AROS_TOOL_TARGET(aros_target_nm_ln,nm,$aros_target_nm)
1179     AROS_REQUIRED(nm,$aros_target_nm_ln)
1180     AROS_TOOL_TARGET(aros_target_objcopy_ln,objcopy,$aros_target_objcopy)
1181     AROS_REQUIRED(objcopy,$aros_target_objcopy_ln)
1182     AROS_TOOL_TARGET(aros_target_objdump_ln,objdump,$aros_target_objdump)
1183     AROS_REQUIRED(objdump,$aros_target_objdump_ln)
1184     AROS_TOOL_TARGET(aros_target_ranlib_ln,ranlib,$aros_target_ranlib)
1185     AROS_REQUIRED(ranlib,$aros_target_ranlib_ln)
1186     AROS_TOOL_TARGET(aros_target_strip_ln,strip,$aros_target_strip)
1187     AROS_REQUIRED(strip,$aros_target_strip_ln)
1190 if test "$rescomp" != ""; then
1191     if test "$cross_compiling" = "yes" ; then
1192         rescomp=${target_tool_prefix}${rescomp}
1193     fi
1194     AC_PATH_PROG(aros_kernel_rescomp,$rescomp)
1195     AROS_REQUIRED($rescomp,$aros_kernel_rescomp)
1198 aros_hostcfg_dir="bin/${aros_host_arch}-${aros_host_cpu}/gen/config"
1199 aros_targetcfg_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/config"
1200 aros_inc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/AROS/Development/include/aros"
1201 aros_gendir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen"
1202 aros_geninc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/include/aros"
1203 aros_tools_dir="bin/${aros_host_arch}-${aros_host_cpu}/tools"
1204 aros_scripts_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/scripts"
1206 # aros_cc_pre is a variable that is added to the front of the compiler name
1207 # in the generated aros-gcc shell script. We need this to enable the cache
1208 # to work across cleaned builds. Also, support DISTCC using the correct
1209 # environment variable.
1212 if test "x${DISTCC}" != "x" ; then
1213     if test "x${CCACHE}" != "x" ; then
1214         aros_cc_pre="env CCACHE_PREFIX=${DISTCC} ${CCACHE} "
1215     else
1216         aros_cc_pre="${DISTCC} "
1217     fi
1218 else
1219     if test "x${CCACHE}" != "x" ; then
1220         aros_cc_pre="${CCACHE} "
1221     fi
1224 prefix="${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros"
1226 AC_SUBST(aros_target_nostdinc_cflags,-nostdinc)
1227 AC_SUBST(aros_target_nostartup_ldflags,-nostartfiles)
1228 AC_SUBST(aros_target_nix_ldflags,-nix)
1229 AC_SUBST(aros_target_detach_ldflags,-detach)
1230 AC_SUBST(aros_target_nostdlib_ldflags,-nostdlib)
1232 # Target tools
1233 if test "$aros_target_cc" = ""; then
1234     orig_target_cc=$aros_kernel_cc
1235 else
1236     orig_target_cc=$aros_target_cc
1238 if test "$aros_target_ld" = ""; then
1239     orig_target_ld=$aros_kernel_ld
1240 else
1241     orig_target_ld=$aros_target_ld
1243 if test "$GCC" = "yes"; then
1244     aros_target_cc_path=`$orig_target_cc -print-search-dirs | grep "programs: =" | cut -c 12-`
1246 aros_target_cc="${prefix}-gcc"
1247 aros_target_as="${prefix}-as"
1248 aros_target_ld="${prefix}-ld"
1249 aros_target_ar="${prefix}-ar $aros_target_ar_flags"
1250 aros_target_objcopy=${prefix}-objcopy
1251 aros_target_objdump=${prefix}-objdump
1252 aros_target_ranlib="${prefix}-ranlib $aros_target_ranlib_flags"
1253 aros_target_nm="${prefix}-nm $aros_target_nm_flags"
1254 aros_kernel_nm="${prefix}-nm"
1255 aros_target_strip=${prefix}-strip
1257 # Find the system include path. We can suggest that an alternative is
1258 # used if we don't get it correct. The default is to use /usr/include.
1259 # Which is set in the aros_target_incl_def variable.
1261 AC_ARG_ENABLE(includes,
1262 AC_HELP_STRING([--enable-includes=dir],[Alternative system include directory]),
1263 [aros_target_incl=$enable_includes], [aros_target_incl=$aros_target_incl_def])
1265 dnl find out about the target cc's include path
1266 AC_MSG_CHECKING([for the target compiler's include path])
1267 if test "$aros_target_cc_includes" = "" ; then
1268     #try to guess where the directory is
1269     aros_target_cc_includes=`dirname \`${orig_target_cc} -print-libgcc-file-name\``/include
1270     if ! test -d $aros_target_cc_includes; then
1271         #the directory doesn't exist, we need to do some more work
1272         aros_target_cc_includes=${PWD}/${aros_gendir}/cc_include
1273         
1274         #these are the headers we're looling for
1275         headers="limits.h mmintrin.h stdbool.h syslimits.h float.h \
1276                  stddef.h xmmintrin.h iso646.h stdarg.h unwind.h   \
1277                  zutil.h"
1279         dirs=
1280         for h in $headers; do
1281             #which other headers each of the above headers needs?
1282             deps=$(echo "#include <$h>" | \
1283                    $aros_host_cc -E -M - 2>/dev/null | \
1284                    sed 's/^.*://; s/\\$/ /g; s/[[ \t]]\+/ /g')
1285             
1286             #copy all the needed headers to a directory beneath gendir
1287             for d in $deps; do
1288                 h=$(basename $d)
1289                 dir=${aros_target_cc_includes}$(echo $(dirname $d) | \
1290                                                 sed -n "s,^.*/include\(/.*\),\1,p")
1291                 ! test -d $dir && mkdir -p $dir
1292                 ! test -f $dir/$h && { cp $d $dir; chmod u+w $dir/$h; }
1293             done
1294         done        
1295     fi
1297 AC_MSG_RESULT($aros_target_cc_includes)
1300 # For GCC < 4.0 -I- is used for giving the search path for '#include "..."'
1301 # On GCC >= 4.0 -iquote should be used
1304 save_cc="$CC"
1305 save_cflags="$CFLAGS"
1306 CFLAGS="-iquote."
1307 AC_MSG_CHECKING([whether ${CC} accepts -iquote])
1308 AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
1309 AC_MSG_RESULT($has_iquote)
1310 if test "x-$has_iquote" = "x-yes" ; then
1311     host_cflags_iquote=-iquote
1312     host_cflags_iquote_end=
1313 else
1314     host_cflags_iquote=-I
1315     host_cflags_iquote_end=-I-
1317 kernel_cflags_iquote=$host_cflags_iquote
1318 kernel_cflags_iquote_end=$host_cflags_iquote_end
1319 if test "x-$cross_compiling" = "x-yes"; then
1320     CC="$aros_kernel_cc"
1321     AC_MSG_CHECKING([whether ${CC} accepts -iquote])
1322     AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
1323     AC_MSG_RESULT($has_iquote)
1324     if test "x-$has_iquote" = "x-yes" ; then
1325         kernel_cflags_iquote=-iquote
1326         kernel_cflags_iquote_end=
1327     else
1328         kernel_cflags_iquote=-I
1329         kernel_cflags_iquote_end=-I-
1330     fi
1332 aros_cflags_iquote=$kernel_cflags_iquote
1333 aros_cflags_iquote_end=$kernel_cflags_iquote_end
1334 if test "$orig_target_cc" != "$aros_kernel_cc"; then
1335     CC="$orig_target_cc"
1336     AC_MSG_CHECKING([whether ${CC} accepts -iquote])
1337     AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
1338     AC_MSG_RESULT($has_iquote)
1339     if test "x-$has_iquote" = "x-yes" ; then
1340         aros_cflags_iquote=-iquote
1341         aros_cflags_iquote_end=
1342     else
1343         aros_cflags_iquote=-I
1344         aros_cflags_iquote_end=-I-
1345     fi
1347 CC="$save_cc"
1348 CFLAGS="$save_cflags"
1350 AC_SUBST(host_cflags_iquote)
1351 AC_SUBST(host_cflags_iquote_end)
1352 AC_SUBST(kernel_cflags_iquote)
1353 AC_SUBST(kernel_cflags_iquote_end)
1354 AC_SUBST(aros_cflags_iquote)
1355 AC_SUBST(aros_cflags_iquote_end)
1358 dnl Check if user specified --with-resolution=XRESxYRESxDEPTH
1359 AC_MSG_CHECKING([for default resolution of WBScreen])
1360 AC_ARG_WITH(resolution,AC_HELP_STRING([--with-resolution=XRESxYRESxDEPTH],[Default resolution of the initial WorkbenchScreen]),resolution=$withval,resolution=none)
1361 # We require an argument, so map --with/--without ("yes"/"no") to "none" specified
1362 if test "$resolution" = "yes" ; then
1363     resolution="none"
1365 if test "$resolution" = "no" ; then
1366     resolution="none"
1368 if test "$resolution" != "none" ; then
1369     aros_default_wbwidth=`echo $resolution | cut -d'x' -f1`
1370     aros_default_wbheight=`echo $resolution | cut -d'x' -f2`
1371     aros_default_wbdepth=`echo $resolution | cut -d'x' -f3`
1373 AC_MSG_RESULT($aros_default_wbwidth x $aros_default_wbheight x $aros_default_wbdepth)
1374 aros_cv_default_wbwidth=$aros_default_wbwidth
1375 aros_cv_default_wbheight=$aros_default_wbheight
1376 aros_cv_default_wbdepth=$aros_default_wbdepth
1378 dnl See if the user wants the BOCHS hack for native flavour
1379 AC_MSG_CHECKING([if bochs hack is enabled])
1380 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")
1381 if test "$bochs_hack" = "yes" ; then
1382     aros_bochs_hack="1"
1384 AC_MSG_RESULT($bochs_hack)
1386 dnl See if the user wants the serial debug output for native flavour
1387 AC_MSG_CHECKING([if serial debug is enabled])
1388 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)
1389 if test "$aros_serial_debug" = 0 ; then
1390     serial_debug_forced=""
1391     if test "$serial_debug" = "yes" ; then
1392         serial_debug="2"
1393     fi
1394     if test "$serial_debug" = "no" ; then
1395         serial_debug="none"
1396     fi
1397 else
1398     serial_debug_forced="(forced)"
1399     serial_debug=$aros_serial_debug
1401 if test "$serial_debug" != "none" ; then
1402     aros_serial_debug=$serial_debug
1403     AC_MSG_RESULT($serial_debug_forced on port $serial_debug)
1404 else
1405     AC_MSG_RESULT(no)
1408 dnl See if the user wants the palm debug output hack for palm native flavour
1409 AC_MSG_CHECKING([if palm debug hack is enabled])
1410 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")
1411 if test "$palm_debug_hack" = "yes" ; then
1412     aros_palm_debug_hack="1"
1414 AC_MSG_RESULT($palm_debug_hack)
1417 dnl See if the user wants nesting supervisor activated for unix flavour
1418 AC_MSG_CHECKING([if nesting supervisor support is enabled])
1419 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")
1420 if test "$nesting_supervisor" = "yes" ; then
1421     aros_nesting_supervisor="1"
1423 AC_MSG_RESULT($nesting_supervisor)
1426 dnl things specifically required for hosted flavours
1427 if test "x-$aros_flavour" = "x-emulation" -o "x-$aros_flavour" = "x-emulcompat" ; then
1429     if test "x-$need_dlopen" != "x-no" ; then
1430       dnl some kind of dynamic library access system is required for hostlib.resource
1431       AC_CHECK_FUNC(dlopen, have_dl="yes", have_dl="no")
1432       if test "x-$have_dl" = "x-no" ; then
1433           AC_CHECK_LIB(dl, dlopen, [have_dl="yes"
1434                                     aros_host_ldflags="$aros_host_ldflags -ldl"],
1435                                     have_dl="no")
1436       fi
1437       if test "x-$have_dl" = "x-no" ; then
1438           AC_MSG_ERROR([dlopen() dynamic linker functions not available])
1439       fi
1440     fi
1443     dnl x11 hidd
1444     AC_ARG_ENABLE(x11_hidd, AC_HELP_STRING([--enable-x11-hidd],
1445                                            [build X11 hidd for hosted (default=auto)]),
1446                                            x11_hidd="$enableval",
1447                                            x11_hidd="auto")
1448     case "x-$x11_hidd" in
1449         x-yes|x-no|x-auto)                 ;;
1450         *)                 x11_hidd="auto" ;;
1451     esac
1453     ENABLE_X11=0
1455     dnl they want it
1456     if test "x-$x11_hidd" != "x-no" ; then
1458         dnl find x11 stuff
1459         AC_PATH_X
1461         x_cflags=
1462         for path in $x_libraries
1463         do
1464             x_cflags="$x_cflags -L$path"
1465         done
1467         for path in $x_includes
1468         do
1469             x_cflags="$x_cflags -I$path"
1470         done
1471         
1472         if test "x-$no_x" = "x-yes" ; then
1474             dnl didn't find it
1475             if test "x-$x11_hidd" != "x-auto" ; then
1476                 dnl and they explicitly asked for it, bail out
1477                 AC_MSG_ERROR([X11 libs/headers not found, cannot build X11 hidd as requested])
1478             fi
1479         
1480         else
1481             dnl found it, setup the metatarget
1482             x11_hidd_target=kernel-x11gfx-kobj
1483             ENABLE_X11=1
1485             dnl setup shared memory extensions
1486             AC_ARG_ENABLE(x11_shm, AC_HELP_STRING([--enable-x11-shm],
1487                                                   [use X11 shared memory (default=auto)]),
1488                                                   x11_hidd_shm="$enableval",
1489                                                   x11_hidd_shm="auto")
1490             case "x-$x11_hidd_shm" in
1491                 x-yes|x-no|x-auto)                     ;;
1492                 *)                 x11_hidd_shm="auto" ;;
1493             esac
1495             have_xshm=no
1497             dnl they want it
1498             if test "x-$x11_hidd_shm" != "x-no" ; then
1500                 dnl system shm headers
1501                 AC_CHECK_HEADERS(sys/ipc.h)
1502                 AC_CHECK_HEADERS(sys/shm.h)
1504                 dnl got them
1505                 if test "x-$ac_cv_header_sys_ipc_h" = "x-yes" -a "x-$ac_cv_header_sys_shm_h" = "x-yes" ; then
1507                     dnl make sure X libs have shm functions
1508                     save_cflags="$CFLAGS"
1509                     CFLAGS="$CFLAGS $x_cflags"
1510                     AC_CHECK_LIB(Xext, XShmQueryExtension, have_xshm=yes)
1511                     CFLAGS="$save_cflags"
1512                 fi
1513             fi
1515             dnl detection done, prepare output
1516             if test "x-$have_xshm" = "x-yes" ; then
1517                 dnl we can do shm
1518                 DO_XSHM_SUPPORT="1"
1519             elif test "x-$x11_hidd_shm" = "x-yes" ; then
1520                 dnl they explicitly asked for it, but we can't do it
1521                 AC_MSG_ERROR([X11 has no support for shared memory, cannot enable it as requested])
1522             else
1523                 dnl otherwise just disable it
1524                 DO_XSHM_SUPPORT="0"
1525             fi
1527             
1528             dnl setup vidmode (fullscreen) extensions
1529             AC_ARG_ENABLE(x11_vidmode, AC_HELP_STRING([--enable-x11-vidmode],
1530                                                       [use X11 vidmode extension (default=auto)]),
1531                                                       x11_hidd_vidmode="$enableval",
1532                                                       x11_hidd_vidmode="auto")
1533             case "x-$x11_hidd_vidmode" in
1534                 x-yes|x-no|x-auto)                         ;;
1535                 *)                 x11_hidd_vidmode="auto" ;;
1536             esac
1538             have_vidmode=no
1540             dnl they want it
1541             if test "x-$x11_hidd_vidmode" != "x-no" ; then
1543                 dnl make sure X libs have vidmode functions
1544                 save_cflags="$CFLAGS"
1545                 CFLAGS="$CFLAGS $x_cflags"
1546                 AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryExtension, have_vidmode=yes)
1547                 CFLAGS="$save_cflags"
1548             fi
1550             dnl detection done, prepare output
1551             if test "x-$have_vidmode" = "x-yes" ; then
1552                 dnl we can do vidmode
1553                 DO_VIDMODE_SUPPORT="1"
1554             elif test "x-$x11_hidd_vidmode" = "x-yes" ; then
1555                 dnl they explicitly asked for it, but we can't do it
1556                 AC_MSG_ERROR([X11 vidmode extension not available, cannot enable it as requested])
1557             else
1558                 dnl otherwise just disable it
1559                 DO_VIDMODE_SUPPORT="0"
1560             fi
1561         fi
1563         aros_host_x11_includes=$x_includes 
1564         aros_host_x11_libdirs=$x_libraries
1565     fi
1568     dnl sdl hidd
1569     AC_ARG_ENABLE(sdl_hidd, AC_HELP_STRING([--enable-sdl-hidd],
1570                                            [build SDL hidd for hosted (default=auto)]),
1571                                            sdl_hidd="$enableval",
1572                                            sdl_hidd="auto")
1573     case "x-$sdl_hidd" in
1574         x-yes|x-no|x-auto)                 ;;
1575         *)                 sdl_hidd="auto" ;;
1576     esac
1578     dnl they want it
1579     if test "x-$sdl_hidd" != "x-no" ; then
1581         dnl find sdl
1582         AM_PATH_SDL([1.2.10], have_sdl="yes", have_sdl="no")
1584         if test "x-$have_sdl" != "x-yes" ; then
1586             dnl didn't find it
1587             if test "x-$sdl_hidd" != "x-auto" ; then
1588                 dnl and they explicitly asked for it, bail out
1589                 AC_MSG_ERROR([SDL libs/headers not found, cannot build SDL hidd as requested])
1590             fi
1592         else
1593             dnl found it, setup the metatarget
1594             sdl_hidd_target=kernel-hidd-sdl
1595             aros_host_sdl_cflags=SDL_CFLAGS
1596             aros_host_sdl_libs=SDL_LIBS
1597         fi
1598     fi
1603 dnl See if the user wants dbus.library
1604 AC_MSG_CHECKING([if building of dbus.library is enabled])
1605 AC_ARG_ENABLE(dbus,AC_HELP_STRING([--enable-dbus],[Enable DBUS support via dbus.library (default=no)]),dbus="yes",dbus="no")
1606 if test "$dbus" = "yes" ; then
1607     ENABLE_DBUS=1
1608     DBUS_CFLAGS=`pkg-config --cflags dbus-1`
1609     DBUS_LIBFLAGS=`pkg-config --libs dbus-1`
1610     KERNEL_DBUS_KOBJ=kernel-dbus-kobj
1611     KERNEL_DBUS_INCLUDES=kernel-dbus-includes
1612 else
1613     ENABLE_DBUS=0
1615 AC_MSG_RESULT($dbus)
1618 dnl --------------------------------------------------------------------
1619 dnl Configuration Output Section
1620 dnl --------------------------------------------------------------------
1622 # Generic
1623 AC_SUBST(aros_arch)
1624 AC_SUBST(aros_cpu)
1625 AC_SUBST(aros_flavour)
1626 AC_SUBST(aros_flavour_uc)
1627 AC_SUBST(AROS_BUILDDIR)
1628 AC_SUBST(SRCDIR)
1629 AC_SUBST(AROS_PORTSSRCDIR)
1631 # Host related
1632 AC_SUBST(aros_cc_pre)
1633 AC_SUBST(aros_host_strip)
1634 AC_SUBST(aros_host_arch)
1635 AC_SUBST(aros_host_cpu)
1636 AC_SUBST(aros_host_cc)
1637 AC_SUBST(aros_host_ar)
1638 AC_SUBST(aros_host_ranlib)
1639 AC_SUBST(aros_host_ld)
1640 AC_SUBST(aros_host_make)
1641 AC_SUBST(aros_host_cflags)
1642 AC_SUBST(aros_host_ldflags)
1643 AC_SUBST(aros_host_debug)
1644 AC_SUBST(aros_host_mkdep)
1645 AC_SUBST(aros_host_mkargs)
1646 AC_SUBST(aros_host_exe_suffix)
1647 AC_SUBST(aros_host_lib_suffix)
1648 AC_SUBST(aros_tools_dir)
1649 AC_SUBST(aros_host_aclocal)
1650 AC_SUBST(aros_host_autoconf)
1651 AC_SUBST(aros_host_autoheader)
1652 AC_SUBST(aros_host_automake)
1654 # Target Related
1655 AC_SUBST(aros_target_guitheme)
1656 AC_SUBST(aros_target_iconset)
1657 AC_SUBST(aros_target_bootloader)
1658 AC_SUBST(aros_target_arch)
1659 AC_SUBST(aros_target_cpu)
1660 AC_SUBST(aros_target_variant)
1661 AC_SUBST(aros_target_suffix)
1662 AC_SUBST(aros_target_incl)
1663 AC_SUBST(aros_target_ar)
1664 AC_SUBST(aros_target_ranlib)
1665 AC_SUBST(aros_kernel_nm)
1666 AC_SUBST(orig_target_cc)
1667 AC_SUBST(aros_target_cc)
1668 AC_SUBST(aros_kernel_cc)
1669 AC_SUBST(aros_target_as)
1670 AC_SUBST(orig_target_ld)
1671 AC_SUBST(aros_target_ld)
1672 AC_SUBST(aros_kernel_ld)
1673 AC_SUBST(aros_target_cc_includes)
1674 AC_SUBST(aros_target_cc_path)
1675 AC_SUBST(aros_target_objdump)
1676 AC_SUBST(aros_target_objcopy)
1677 AC_SUBST(aros_target_strip)
1678 AC_SUBST(aros_target_nm)
1679 AC_SUBST(aros_kernel_rescomp)
1680 AC_SUBST(aros_shared_default)
1681 AC_SUBST(aros_shared_ld)
1682 AC_SUBST(aros_object_format)
1683 AC_SUBST(aros_compiler_libs)
1685 AC_SUBST(aros_config_cflags)
1686 AC_SUBST(aros_config_aflags)
1687 AC_SUBST(aros_config_ldflags)
1689 AC_SUBST(aros_shared_cflags)
1690 AC_SUBST(aros_shared_aflags)
1691 AC_SUBST(aros_shared_ldflags)
1692 AC_SUBST(aros_kernel_cflags)
1693 AC_SUBST(aros_kernel_ldflags)
1694 AC_SUBST(aros_debug_cflags)
1695 AC_SUBST(aros_debug_aflags)
1696 AC_SUBST(aros_debug_ldflags)
1697 AC_SUBST(aros_target_genmap)
1698 AC_SUBST(aros_target_strip_flags)
1700 # Graphics Related
1701 AC_SUBST(x11_hidd_target)
1702 AC_SUBST(sdl_hidd_target)
1704 AC_SUBST(aros_default_wbwidth)
1705 AC_SUBST(aros_default_wbheight)
1706 AC_SUBST(aros_default_wbdepth)
1707 AC_SUBST(DO_XSHM_SUPPORT)
1708 AC_SUBST(DO_VIDMODE_SUPPORT)
1710 AC_SUBST(aros_host_x11_includes)
1711 AC_SUBST(aros_host_x11_libdirs)
1712 AC_SUBST(aros_host_sdl_cflags)
1713 AC_SUBST(aros_host_sdl_libs)
1715 # Native version related
1716 AC_SUBST(aros_bochs_hack)
1717 AC_SUBST(aros_serial_debug)
1719 # Palm native version related
1720 AC_SUBST(aros_palm_debug_hack)
1722 # Unix/Hosted version related
1723 AC_SUBST(aros_nesting_supervisor)
1725 # DBUS related
1726 AC_SUBST(ENABLE_DBUS)
1727 AC_SUBST(DBUS_CFLAGS)
1728 AC_SUBST(DBUS_LIBFLAGS)
1729 AC_SUBST(KERNEL_DBUS_KOBJ)
1730 AC_SUBST(KERNEL_DBUS_INCLUDES)
1732 #X11 related
1733 AC_SUBST(ENABLE_X11)
1735 # Debug related
1736 AC_SUBST(aros_debug)
1737 AC_SUBST(aros_mungwall_debug)
1738 AC_SUBST(aros_stack_debug)
1739 AC_SUBST(aros_modules_debug)
1741 # Collect-aros stuff: "-ius" to ignore undefined symbols
1742 AC_SUBST(ignore_undefined_symbols)
1744 # C compiler related
1745 AC_SUBST(gcc_target_cpu)
1747 dnl Prepare for output, make up all the generated patches
1748 case "$aros_flavour" in
1749 emulation)      aros_flavour_uc="AROS_FLAVOUR_EMULATION"
1750                 aros_flavour="emulation" ;;
1751 emulcompat)     aros_flavour_uc="(AROS_FLAVOUR_EMULATION|AROS_FLAVOUR_BINCOMPAT)"
1752                 aros_flavour="emulation" ;;
1753 standalone)     aros_flavour_uc="AROS_FLAVOUR_STANDALONE"
1754                 aros_flavour="standalone";;
1755 native)         aros_flavour_uc="AROS_FLAVOUR_NATIVE"
1756                 aros_flavour="native" ;;
1757 nativecompat)   aros_flavour_uc="(AROS_FLAVOUR_NATIVE|AROS_FLAVOUR_BINCOMPAT)"
1758                 aros_flavour="native" ;;
1759 linklib)        aros_flavour_uc="AROS_FLAVOUR_LINKLIB"
1760                 aros_flavour="linklib" ;;
1761 palmnative)     aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
1762                 aros_flavour="palmnative" ;;
1763 mac68knative)   aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
1764                 aros_flavour="mac68knative" ;;
1765 ppcnative)      aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_BINCOMPAT)"
1766                 aros_flavour="ppcnative" ;;
1767 esac
1769 if test ! -d ${aros_inc_dir} ; then
1770     ${MKDIR} ${aros_inc_dir}
1772 if test ! -d ${aros_geninc_dir} ; then
1773     ${MKDIR} ${aros_geninc_dir}
1775 if test ! -d ${aros_hostcfg_dir} ; then
1776     ${MKDIR} ${aros_hostcfg_dir}
1778 if test ! -d ${aros_targetcfg_dir} ; then
1779     ${MKDIR} ${aros_targetcfg_dir}
1781 if test ! -d ${aros_tools_dir} ; then
1782     ${MKDIR} ${aros_tools_dir}
1784 if test ! -d ${aros_scripts_dir} ; then
1785     ${MKDIR} ${aros_scripts_dir}
1788 AC_CONFIG_HEADERS(${aros_geninc_dir}/host-conf.h:config/host-conf.h.in)
1790 AC_CONFIG_COMMANDS([compiler_executable],
1791     [
1792         prefix=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}
1793         mkdir -p $prefix
1794         prefix="${prefix}/${aros_target_cpu}-aros"
1795         prefix2=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros
1797         echo ${prefix}
1798         echo ${prefix2}
1799         chmod a+x ${prefix2}-gcc ${prefix2}-ld
1801         ln -sf ${prefix2}-gcc          ${prefix}-gcc
1802         ln -sf ${prefix2}-ld           ${prefix}-ld
1804         ln -sf $aros_target_as_ln      ${prefix}-as
1805         ln -sf $aros_target_nm_ln      ${prefix}-nm
1806         ln -sf $aros_target_ar_ln      ${prefix}-ar
1807         ln -sf $aros_target_ranlib_ln  ${prefix}-ranlib
1808         ln -sf $aros_target_objcopy_ln ${prefix}-objcopy
1809         ln -sf $aros_target_objdump_ln ${prefix}-objdump
1810         ln -sf $aros_target_strip_ln   ${prefix}-strip
1812         ln -sf $aros_target_as_ln      ${prefix2}-as
1813         ln -sf $aros_target_nm_ln      ${prefix2}-nm
1814         ln -sf $aros_target_ar_ln      ${prefix2}-ar
1815         ln -sf $aros_target_ranlib_ln  ${prefix2}-ranlib
1816         ln -sf $aros_target_objcopy_ln ${prefix2}-objcopy
1817         ln -sf $aros_target_objdump_ln ${prefix2}-objdump
1818         ln -sf $aros_target_strip_ln   ${prefix2}-strip
1819     ],
1820     [
1821         aros_tools_dir=${aros_tools_dir}
1822         aros_target_cpu=${aros_target_cpu}
1823         aros_target_arch=${aros_target_arch}
1824         aros_target_suffix=${aros_target_suffix}
1825         aros_target_nm_ln=${aros_target_nm_ln}
1826         aros_target_as_ln=${aros_target_as_ln}
1827         aros_target_ar_ln=${aros_target_ar_ln}
1828         aros_target_ranlib_ln=${aros_target_ranlib_ln}
1829         aros_target_objdump_ln=${aros_target_objdump_ln}
1830         aros_target_objcopy_ln=${aros_target_objcopy_ln}
1831         aros_target_strip_ln=${aros_target_strip_ln}
1832     ]
1834 AC_CONFIG_COMMANDS([genshared_executable],
1835     [chmod a+x ${aros_scripts_dir}/genshared],
1836     [aros_scripts_dir=${aros_scripts_dir}]
1838 AC_CONFIG_COMMANDS([genmf_executable],
1839     [chmod a+x ${aros_tools_dir}/genmf.py],
1840     [aros_tools_dir=${aros_tools_dir}]
1842 AC_CONFIG_COMMANDS([adflib_myaros.conf_executable],
1843     [chmod a+x tools/adflib/myconf.aros]
1846 AC_CONFIG_FILES(
1847     Makefile
1848     config/make.cfg
1849     ${aros_inc_dir}/config.h:config/config.h.in
1850     ${aros_geninc_dir}/config.h:config/config.h.in
1851     ${aros_hostcfg_dir}/host.cfg:config/host.cfg.in
1852     ${aros_targetcfg_dir}/target.cfg:config/target.cfg.in
1853     mmake.config
1854     ${aros_targetcfg_dir}/make.defaults:config/make.defaults.in
1855     ${aros_targetcfg_dir}/specs:config/specs.in
1856     ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-gcc:scripts/aros-gcc.in
1857     ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-ld:scripts/aros-ld.in
1858     ${aros_scripts_dir}/genshared:compiler/c_lib/source/lib_source/genshared.in
1859     ${aros_tools_dir}/genmf.py:tools/genmf/genmf.py
1860     tools/adflib/myconf.aros
1861     tools/collect-aros/env.h
1864 AC_OUTPUT
1866 dnl This is in order to not define SHARED_CFLAGS sometimes
1867 dnl We don't always do aros_shared_ar, aros_shared_cflags
1869 #XXX compatability...
1870 aros_shared_ar="$aros_shared_ld $aros_shared_ldflags -o"
1872 if test -n "$aros_shared_cflags" ; then
1873     echo "SHARED_CFLAGS := $aros_shared_cflags" >> ${aros_hostcfg_dir}/host.cfg
1874     echo "SHARED_AR := $aros_shared_ar" >> ${aros_hostcfg_dir}/host.cfg