Revert "rom: Big Pile of WIP"
[AROS.git] / configure.in
blob3eef5ea7f41d16d852f62f1f4dc27f8a596a0043
1 dnl Copyright © 1997-2010, 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 AROS_BUILDDIR_UNIX=${PWD}
54 AC_MSG_RESULT($AROS_BUILDDIR)
56 AC_MSG_CHECKING([AROS Source in .. ])
57 srcpwd=`cd ${srcdir} ; ${PWDCMD-pwd}`
58 SRCDIR=${srcpwd}
59 AC_MSG_RESULT($SRCDIR)
61 # Parse the target field into something useful.
62 changequote(<<,>>)
63 target_os=`echo $target | sed 's/^\([^-]*\)-\(.*\)$/\1/'`
64 target_cpu=`echo $target | sed 's/^\([^-]*\)-\(.*\)$/\2/'`
65 changequote([,])
67 dnl --------------------------------------------------------------------
68 dnl Set the default Workbench resolution
69 dnl --------------------------------------------------------------------
70 aros_default_wbwidth=800
71 aros_default_wbheight=600
72 aros_default_wbdepth=4
74 dnl --------------------------------------------------------------------
75 dnl Host Configuration Section
76 dnl --------------------------------------------------------------------
77 dnl
78 dnl The idea here is to find out all the information we need about the
79 dnl host. This means things like tools for building directory structures,
80 dnl copying files around and the like.
82 # The first step is to find the host binaries.
83 # Check for a compiler.
84 AC_PROG_CC
85 AC_PROG_CC_STDC
86 AC_PROG_CPP
88 # Check for a compatible awk
89 AC_CHECK_PROGS(AWK,[gawk nawk])
90 AROS_REQUIRED(gawk,$AWK)
91 AROS_PROG(MMAKE,mmake)
93 # Perform some default variable assignments. Note all of these will be
94 # Regenerated from the script, so there is no need to cache them.
96 aros_host_cc="$CC"
97 AROS_TOOL_CCPATH(aros_host_ld,ld)
98 AROS_REQUIRED(ld,$aros_host_ld)
99 aros_host_make="make"
100 aros_host_cflags=$CFLAGS
101 aros_host_ldflags=$LDFLAGS
102 aros_host_debug="-g -O0"
103 aros_host_mkdep="\$(SRCDIR)/scripts/mkdep"
104 aros_host_mkargs="--no-print-directory"
105 aros_host_incl="/usr/include"
106 aros_host_exe_suffix="$EXEEXT"
107 aros_host_lib_suffix=""
109 AC_CHECK_PROGS(aros_host_aclocal,[aclocal aclocal19 aclocal-1.9])
110 AC_CHECK_PROGS(aros_host_autoconf,[autoconf autoconf259 autoconf253])
111 AC_CHECK_PROGS(aros_host_autoheader,[autoheader autoheader259 autoheader253])
112 AC_CHECK_PROGS(aros_host_automake,[automake automake19 automake-1.9])
114 AROS_REQUIRED(aclocal/aclocal19/aclocal-1.9, $aros_host_aclocal)
115 AROS_REQUIRED(automake/automake19/automake-1.9, $aros_host_automake)
117 case "$aros_host_cc" in
118     *gcc*)
119         aros_host_cc_pipe="-pipe"
120         ;;
121     icc)
122         aros_host_cc_pipe=""
123         ;;
124     *)
125         aros_host_cc_pipe=""
126         ;;
127 esac
129 dnl Despite the name, this is really a host configuration variable.
130 aros_target_cc_includes=""
132 # This is the main host configuration section. It is where the host
133 # can change the values of any variables it needs to change. We do
134 # not look at anything that compiles to the target yet, we'll get
135 # to that later.
137 case "$host_os" in
138     aros*)
139         aros_host_arch="aros"
140         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
141         case "$host_cpu" in
142             *i?86*)
143                 aros_host_cpu="i386"
144                 ;;
145             *x86_64*)
146                 aros_host_cpu="x86_64"
147                 ;;
148             *powerpc*)
149                 aros_host_cpu="ppc"
150                 ;;
151             *)
152                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
153                 aros_host_cpu="$host_cpu"
154                 ;;
155         esac
156         ;;
158     linux*)
159         aros_host_arch="linux"
160         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
161         case "$host_cpu" in
162             *i?86*)
163                 aros_host_cpu="i386"
164                 ;;
165             *x86_64*)
166                 aros_host_cpu="x86_64"
167                 ;;
168             *m68k*)
169                 aros_host_cpu="m68k"
170                 ;;
171             *powerpc*)
172                 aros_host_cpu="ppc"
173                 ;;
174             *arm*)
175                 aros_host_cpu="arm"
176                 ;;
177             *)
178                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
179                 aros_host_cpu="$host_cpu"
180                 ;;
181         esac
182         ;;
184     freebsd*)
185         aros_host_cc="$aros_host_cc $aros_host_cc_pipe -I/usr/local/include"
186         aros_host_make="gmake"
187         aros_host_arch="freebsd"
188         aros_host_cpu="i386"
190         aros_host_ldflags="$aros_host_ldflags -L/usr/local/lib -liconv"
192         dnl Need to override this here, it's just too hard later.
193         dnl This shouldn't be here at all...
194         dnl aros_target_cc_includes="/usr/include"
196         dnl FreeBSD 5.x (and later) has changed the default object format.
197         dnl The double [[]] is necessary to get around m4's quoting rules.
198         case $host_os in
199             freebsd[[234]]*)
200                 aros_object_format="elf_i386"
201                 ;;
203             *)
204                 aros_object_format="elf_i386_fbsd"
205                 ;;
206         esac
208         ;;
210     darwin*)
211         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
212         aros_host_arch="darwin"
213         case "$host_cpu" in
214             *i?86*)
215                 aros_host_cpu="i386"
216                 ;;
217             *x86_64*)
218                 aros_host_cpu="x86_64"
219                 ;;
220             *powerpc*)
221                 aros_host_cpu="ppc"
222                 ;;
223             *)
224                 AC_MSG_WARN("Unknown CPU for Darwin host -- $host_cpu")
225                 aros_host_cpu="$host_cpu"
226                 ;;
227         esac
229         aros_host_ldflags="$aros_host_ldflags -liconv"
231         ;;
233     dragonfly*)
234         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
235         aros_host_make="gmake"
236         aros_host_arch="dragonfly"
237         case $host_cpu in
238             *i?86*)
239                 aros_host_cpu="i386"
240                 ;;
241             *amd64*)
242                 aros_host_cpu="x86_64"
243                 ;;
244             *)
245                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
246                 aros_host_cpu="$host_cpu"
247                 ;;
248         esac
249         ;;
251     netbsd*)
252         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
253         aros_host_make="gmake"
254         aros_host_arch="netbsd"
255         case "$host_cpu" in
256             *i?86*)
257                 aros_host_cpu="i386"
258                 ;;
259             *m68k*)
260                 aros_host_cpu="m68k"
261                 ;;
262             *)
263                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
264                 aros_host_cpu="$host_cpu"
265                 ;;
266         esac    
267         aros_host_lib_suffix=".0.0"
268         ;;
270     openbsd*)
271         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
272         aros_host_make="gmake"
273         aros_host_arch="openbsd"
274         case "$host_cpu" in
275             *i?86*)
276                 aros_host_cpu="i386"
277                 ;;
278             *)
279                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
280                 aros_host_cpu="$host_cpu"
281                 ;;
282         esac
283         ;;
284         
285     solaris*)
286         aros_host_arch="solaris"
287         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
288         case "$host_cpu" in
289             *i?86*)
290                 aros_host_cpu="i386"
291                 ;;
292             *sparc*)
293                 aros_host_cpu="sparc"
294                 ;;
295             *)
296                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
297                 aros_host_cpu="$host_cpu"
298                 ;;
299         esac
300         ;;
302     morphos*)
303         aros_host_arch="morphos"
304         aros_host_cpu="ppc"
305         ;;
307     amiga*)
308         aros_host_arch="amiga"
309         SORT="/gg/bin/sort"
310         TEST="/gg/bin/test"
311         UNIQ="/gg/bin/uniq"
312         FOR="for"
313         TOUCH="/gg/bin/touch"
314         case "$host_cpu" in
315             *m68k*)
316                 aros_host_cpu="m68k"
317                 ;;
318             *powerpc*)
319                 aros_host_cpu="ppc"
320                 ;;
321             *)
322                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
323                 aros_host_cpu="$host_cpu"
324                 ;;
325         esac
326         ;;
328     cygwin*)
329         aros_host_arch="cygwin"
330         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
331         case "$host_cpu" in
332             *i?86*)
333                 aros_host_cpu="i386"
334                 ;;
335             *)
336                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
337                 aros_host_cpu="$host_cpu"
338                 ;;
339         esac
340         ;;
342     mingw32*)
343         aros_host_arch="mingw32"
344         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
345         case "$host_cpu" in
346             *i?86*)
347                 aros_host_cpu="i386"
348                 ;;
349             *)
350                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
351                 aros_host_cpu="$host_cpu"
352                 ;;
353         esac
354         ;;
355     *)
356         AC_MSG_ERROR([Unsupported host architecture $host])
357         ;;
358 esac
360 AROS_PROG(aros_host_ar,[ar],[cr])
361 AROS_REQUIRED(ar,$aros_host_ar)
362 AROS_PROG(aros_host_ranlib,ranlib)
363 AROS_REQUIRED(ranlib,$aros_host_ranlib)
364 AROS_PROG(aros_host_strip,strip)
365 AROS_REQUIRED(strip,$aros_host_strip)
367 AROS_PROG(RM,[rm],[-rf])
368 AROS_REQUIRED(rm,$RM)
369 AROS_PROG(CP,[cp])
370 AROS_REQUIRED(cp,$CP)
371 AROS_PROG(MV,[mv])
372 AROS_REQUIRED(mv,$MV)
373 AROS_PROG(ECHO,[echo])
374 AROS_REQUIRED(echo,$ECHO)
375 AROS_PROG(MKDIR,[mkdir],[-p])
376 AROS_REQUIRED(mkdir,$MKDIR)
377 AROS_PROG(TOUCH,[touch])
378 AROS_REQUIRED(touch,$TOUCH)
379 AROS_PROG(SORT,[sort])
380 AROS_REQUIRED(sort,$SORT)
381 AROS_PROG(UNIQ,[uniq])
382 AROS_REQUIRED(uniq,$UNIQ)
383 AROS_PROG(NOP,[true])
384 AROS_REQUIRED(true,$NOP)
385 AROS_PROG(CAT,[cat])
386 AROS_REQUIRED(cat,$CAT)
387 AROS_PROG(BISON,[bison])
388 AROS_REQUIRED(bison,$BISON)
389 AROS_PROG(FLEX,[flex])
390 AROS_REQUIRED(flex,$FLEX)
391 AROS_PROG(PNGTOPNM,[pngtopnm])
392 AROS_REQUIRED(pngtopnm,$PNGTOPNM)
393 AROS_PROG(PPMTOILBM,[ppmtoilbm])
394 AROS_REQUIRED(ppmtoilbm,$PPMTOILBM)
395 AROS_PROG(SED,[sed])
396 AROS_REQUIRED(sed,$SED)
397 AROS_PROG(CHMOD,[chmod])
398 AROS_REQUIRED(chmod,$CHMOD)
400 AM_PATH_PYTHON(2.5)
402 AC_SUBST(FOR, for)
403 AC_SUBST(IF, if)
404 AC_SUBST(TEST, test)
405 AC_SUBST(CMP, cmp)
407 dnl ---------------------------------------------------------------------------
408 dnl Look for things about the host system, good for hosted targets.
409 dnl ---------------------------------------------------------------------------
411 # Check for some includes for the X11 HIDD and the kernel
412 AC_CHECK_HEADERS([sys/ipc.h sys/shm.h \
413     sys/mmap.h sys/mman.h sysexits.h \
414     sys/statfs.h sys/statvfs.h sys/vfs.h sys/param.h \
417 AC_CHECK_HEADERS([sys/mount.h],,,[#include <sys/param.h>])
419 AC_HEADER_DIRENT
420 AC_HEADER_STAT
421 AC_HEADER_STDC
422 AC_HEADER_SYS_WAIT
423 AC_HEADER_TIME
424 AC_STRUCT_ST_BLKSIZE
425 AC_STRUCT_ST_BLOCKS
426 AC_STRUCT_ST_RDEV
427 AC_STRUCT_TM
428 AC_STRUCT_TIMEZONE
429 AC_TYPE_OFF_T
430 AC_TYPE_PID_T
431 AC_TYPE_SIZE_T
432 AC_TYPE_UID_T
434 AC_CHECK_MEMBERS(struct tm.tm_gmtoff)
436 # Look for some functions
437 AC_CHECK_FUNCS([getpagesize kqueue statfs statvfs \
438     clone kse_create rfork_thread thr_create sa_register \
439     getcontext makecontext setcontext sigaltstack swapcontext])
441 AC_FUNC_MMAP
444 dnl --------------------------------------------------------------------
445 dnl Target Configuration Section
446 dnl --------------------------------------------------------------------
448 dnl The target configuration section is responsible for setting up all
449 dnl the paths for includes, and tools required to build AROS to some
450 dnl particular target.
452 aros_config_cflags="-Wall -Werror-implicit-function-declaration"
453 aros_config_aflags="-Wall -x assembler-with-cpp -c"
454 aros_config_ldflags=""
456 aros_shared_default=yes
458 aros_shared_cflags="-fPIC"
459 aros_shared_aflags=""
460 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
461 aros_kernel_ldflags="-Wl,-rpath,./lib"
463 aros_target_ar_flags="cr"
464 aros_target_nm_flags="-C -ul"
465 aros_target_strip_flags="--strip-unneeded -R.comment"
467 aros_compiler_libs=
468 aros_arch_libs=
470 aros_target_genmap="-Wl,-Map -Xlinker"
472 # Native flavour stuff
473 aros_serial_debug="0"
475 # Palm native flavour stuff
476 aros_palm_debug_hack="0"
478 # Unix flavour stuff
479 aros_nesting_supervisor="0"
481 # Collect-aros stuff: "-ius" to ignore undefined symbols
482 ignore_undefined_symbols=""
484 #-----------------------------------------------------------------------------
487 # GCC 4.1+ has a stack protection feature that requires OS support. Ubuntu has
488 # it switched on by default, and we use the host compiler, so it compiles AROS
489 # code with this enabled resulting in link failures as we don't have support
490 # for it.
492 # We use two methods to disable it. For the host compiler (used to compile
493 # some hosted modules), we test to see if the compiler supports stack
494 # protection, and if it does we disable it in AROS_CONFIG_CFLAGS. This should
495 # work on all platforms.
497 # For the "cross" compiler we clear the "ssp_default" spec in config/specs.in
498 # (this is done unconditionally, as it should have no effect on compilers
499 # without the stack protection feature). This may be specific to the way that
500 # Ubuntu enables the feature, so may not work everywhere. My specs-fu isn't
501 # strong enough to disable it in a generic way though, so we'll live with it
502 # until another vendor ships GCC with it enabled in a different way, and deal
503 # with it then.
506 AC_MSG_CHECKING([whether ${CC} accepts -fno-stack-protector])
507 save_cflags="$CFLAGS"
508 CFLAGS="$CFLAGS -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)
511 if test "x-$use_no_stack_protector" = "x-yes" ; then
512     aros_host_cflags="$aros_host_cflags -fno-stack-protector"
514 CFLAGS="$save_cflags"
516 #-----------------------------------------------------------------------------
518 # Disable pointer-signedness warnings if the compiler recognises the option
519 # (this only works for the host compiler at the moment)
521 AC_MSG_CHECKING([whether ${CC} accepts -Wno-pointer-sign])
522 save_cflags="$CFLAGS"
523 CFLAGS="$CFLAGS -Wno-pointer-sign"
524 AC_TRY_COMPILE(,, use_no_sign_warning="yes", use_no_sign_warning="no")
525 AC_MSG_RESULT($use_no_sign_warning)
526 if test "x-$use_no_sign_warning" = "x-yes" ; then
527     aros_host_cflags="$aros_host_cflags -Wno-pointer-sign"
529 CFLAGS="$save_cflags"
531 #-----------------------------------------------------------------------------
533 AC_MSG_CHECKING([for type of build])
534 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")
536 if test "$build_type" = "nightly"; then
537     build_type_string="NIGHTLY"
538 elif test "$build_type" = "snapshot"; then
539     build_type_string="SNAPSHOT"
540 elif test "$build_type" = "milestone"; then
541     build_type_string="MILESTONE"
542 elif test "$build_type" = "release"; then
543     build_type_string="RELEASE"
544 else
545     build_type_string="PERSONAL"
546     build_type="personal"
549 aros_config_cflags="$aros_config_cflags -DAROS_BUILD_TYPE=AROS_BUILD_TYPE_$build_type_string"
551 AC_MSG_RESULT($build_type)
553 #-----------------------------------------------------------------------------
554 all_debug_types="messages stack modules mungwall symbols"
556 AC_MSG_CHECKING([which debug types to enable])
557 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)]),
558  debug="$enableval",debug="")
560 if test "$debug" = "" -o "$debug" = "no"; then
561     debug="none"
562 elif test "$debug" = "yes"; then
563     debug="all"
566 if test "$debug" = "all" ; then
567     debug="messages stack modules symbols"
568     for d in $all_debug_types; do
569         export aros_${d}_debug="1"
570     done
571 else
572     for d in $all_debug_types; do
573         export aros_${d}_debug="0"
574     done
577 if test "$debug" != "none"; then
578     debug=`echo $debug | sed s/,/\ /g`
579     for d in $debug; do
580         found="0"
581         for d2 in $all_debug_types; do
582             if test "$d2" = "$d"; then
583                 found="1"
584                 break
585             fi
586         done
587         if test "$found" = "0"; then
588             AC_MSG_ERROR([unrecognized debug type "$d". Available types are: all none $all_debug_types])
589         fi
590         export aros_${d}_debug="1"
591     done
592     aros_debug="yes"
594 AC_MSG_RESULT($debug)
596 if test "$aros_messages_debug" = "1"; then
597     aros_messages_debug="-DADEBUG=1 -DMDEBUG=1"
598 else
599     aros_messages_debug=""
601 if test "$aros_symbols_debug" = "1"; then
602     aros_symbols_debug="-g"
603 else
604     aros_symbols_debug=""
607 # These are the flags to pass when compiling debugged programs
608 aros_debug_cflags="$aros_symbols_debug $aros_messages_debug"
609 aros_debug_aflags=""
610 aros_debug_ldflags="$aros_symbols_debug"
612 aros_crosstools="no"
614 #-----------------------------------------------------------------------------
615 #   Checking if we should build crosstools..
616 AC_MSG_CHECKING([whether to build crosstools])
617 AC_ARG_ENABLE(crosstools,AC_HELP_STRING([--enable-crosstools],[Build cross-compiler toolchains if necessary (default=no).]),crosstools="$enableval",crosstools="no")
618 if test "$crosstools" != "" -a "$crosstools" != "no"; then
619     AC_MSG_RESULT(yes)
620         aros_crosstools="yes"
621 else
622     AC_MSG_RESULT(no)
625 #-----------------------------------------------------------------------------
626 #   Checking for distcc and ccache.
628 #   Always apply the transforms in this particular order. Basically you should
629 #   always run 'ccache distcc compiler' in that order for the best performance.
631 AC_MSG_CHECKING([whether to enable distcc])
632 AC_ARG_ENABLE(distcc,AC_HELP_STRING([--enable-distcc],[Use distcc as a front end to the compiler (default=no).]),distcc="$enableval",distcc="no")
633 if test "$distcc" != "" -a "$distcc" != "no"; then
634     # AC_CHECK_PROG will print out the result in this case
635     AC_PATH_PROG(DISTCC,[distcc],distcc,)
636 else
637     AC_MSG_RESULT(no)
640 AC_MSG_CHECKING([whether to enable ccache])
641 AC_ARG_ENABLE(ccache,AC_HELP_STRING([--enable-ccache],[Use ccache as a front end to the compiler (default=no).]),ccache="$enableval",ccache="no")
642 if test "$ccache" != "" -a "$ccache" != "no"; then
643     # AC_CHECK_PROG will print out the result in this case
644     AC_CHECK_PROG(CCACHE,[ccache],ccache,)
645 else
646     AC_MSG_RESULT(no)
649 #-----------------------------------------------------------------------------
650 AC_MSG_CHECKING([what specific gcc version to use])
651 AC_ARG_WITH(gcc-version,AC_HELP_STRING([--with-gcc-version=VERSION],[Use gcc-VERSION for building AROS]),target_tool_version="$withval",target_tool_version="default")
652 AC_MSG_RESULT($target_tool_version)
654 #-----------------------------------------------------------------------------
655 AC_MSG_CHECKING([what optimization flags to use])
656 AC_ARG_WITH(optimization,AC_HELP_STRING([--with-optimization=FLAGS],[Use optimization flags FLAGS (default=-O2).]),optimization="$withval",optimization="unknown")
657 if test "$optimization" = "unknown"; then
658     dnl default is -O2 for normal builds, -O0 for debug builds
659     if test "$debug" != "none"; then
660         optimization="-O0"
661     else
662         optimization="-O2"
663     fi
665 aros_config_cflags="$aros_config_cflags $optimization"
666 AC_MSG_RESULT($optimization)
668 #-----------------------------------------------------------------------------
669 if test "$target_os" = "ios"; then
671 AC_MSG_CHECKING([XCode path])
672 AC_ARG_WITH(xcode-path,AC_HELP_STRING([--with-xcode=PATH],[Specify XCode path for iOS targets (default=/Developer).]),aros_xcode_path="$withval",aros_xcode_path="/Developer")
673 AC_MSG_RESULT($aros_xcode_path)
675 AC_MSG_CHECKING([for minimum supported iOS version])
676 AC_ARG_WITH(ios-version,AC_HELP_STRING([--with-ios-version=VERSION],[Specify minimum supported iOS version (default=2.0).]),aros_ios_version="$withval",aros_ios_version="2.0")
677 AC_MSG_RESULT($aros_ios_version)
679 AC_MSG_CHECKING([what iOS SDK version to use])
680 AC_ARG_WITH(ios-sdk,AC_HELP_STRING([--with-ios-sdk=VERSION],[Use iOS SDK version VERSION (default=4.1).]),aros_ios_sdk="$withval",aros_ios_sdk="4.1")
681 AC_MSG_RESULT($aros_ios_sdk)
685 #-----------------------------------------------------------------------------
686 AC_MSG_CHECKING([what target variant to enable])
687 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")
688 if test "$target_variant" = "none"; then
689     aros_target_variant=""
690     aros_target_suffix=""
691 else
692     aros_target_variant="$target_variant"
693     aros_target_suffix="-$target_variant"
695 AC_MSG_RESULT($enableval)
697 target_bootloader="none"
699 #-----------------------------------------------------------------------------
700 # This is the target configuration switch.
701 case "$target_os" in
702     linux*)
703         aros_target_arch="linux"
704         case "$target_cpu" in
705             *m68k*)
706                 aros_target_cpu="m68k"
707                 aros_object_format="m68kelf"
708                 aros_flavour="emulcompat"
709                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D__mc68000 -D__linux__"
710                 aros_shared_ldflags="-Wl,-T,\$(TOP)/config/linux/m68k/script.so"
711                 aros_kernel_ldflags="-Wl,-rpath,./lib,-T,\$(TOP)/config/linux/m68k/script.normal"
712                 gcc_target_cpu="mc68000"
713                 ;;
714             *i?86*)
715                 aros_target_cpu="i386"
716                 aros_object_format="elf_i386"
717                 aros_flavour="emulation"
718                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__linux__"
719                 aros_config_cflags="$aros_config_cflags -m32 -march=i486"
720                 aros_kernel_cflags="$aros_kernel_cflags -m32 -march=i486"
721                 aros_config_aflags="$aros_config_aflags -m32 -march=i486"
722                 aros_config_ldflags="-m32 -march=i486"
723                 aros_kernel_ldflags="-melf_i386"
724                 aros_default_wbdepth=8
725                 gcc_target_cpu="i386"
726                 ;;
727             *x86_64*)
728                 aros_target_cpu="x86_64"
729                 aros_object_format="elf_x86_64"
730                 aros_flavour="emulation"
731                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64 -D__linux__"
732                 aros_config_cflags="$aros_config_cflags -mno-red-zone"
733                 aros_default_wbdepth=8
734                 gcc_target_cpu="x86_64"
735                 ;;
736             *powerpc*)
737                 aros_target_cpu="ppc"
738                 aros_object_format="elf32ppc"
739                 aros_flavour="emulation"
740                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc -D__linux__"
741                 aros_default_wbdepth=8
742                 gcc_target_cpu="ppc"
743                 ;;
744 # TODO
745 # Same as powerpc, but I need this for the nightly build to work again.
746 # Actually, the nightly should be made working with powerpc target.
747 # That just was too much work for the moment, another week or two.
748             *ppc*)
749                 aros_target_cpu="ppc"
750                 aros_object_format="elf32ppc"
751                 aros_flavour="emulation"
752                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc -D__linux__"
753                 aros_default_wbdepth=8
754                 gcc_target_cpu="ppc"
755                 ;;
756             *arm*)
757                 aros_target_cpu="arm"
758                 aros_object_format="armelf_linux_eabi"
759                 aros_flavour="emulation"
760                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm -D__linux__"
761                 gcc_target_cpu="arm"
762                 aros_config_cflags="$aros_config_cflags -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -fno-asynchronous-unwind-tables -fno-exceptions"
763                 aros_config_aflags="$aros_config_aflags -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -fno-asynchronous-unwind-tables -fno-exceptions"
764                 ;;
765             *)
766                 AC_MSG_ERROR("Unknown CPU for Linux -- $target_cpu")
767                 ;;
768         esac
769     ;;
771     pc)
772         aros_target_arch="pc"
773         aros_shared_default="no"
774         target_bootloader="grub2"
775         case "$target_cpu" in
776             *i?86*)
777                 aros_target_cpu="i386"
779                 dnl If somebody hasn't already set the target object
780                 dnl format, then use this value. Mostly to support
781                 dnl FreeBSD cross-compilation.
782                 dnl TODO: Remove when we always use our compiler.
784                 if test "$aros_object_format" = "" ; then
785                     aros_object_format="elf_i386"
786                 fi
787                 aros_flavour="standalone"
788                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
789                 aros_config_cflags="$aros_config_cflags -m32 -march=i486"
790                 aros_kernel_cflags="$aros_kernel_cflags -m32 -march=i486"
791                 aros_config_aflags="$aros_config_aflags -m32 -march=i486"
792                 aros_config_ldflags="-m32 -march=i486"
793                 aros_kernel_ldflags="-melf_i386"
794                 aros_default_wbwidth=640
795                 aros_default_wbheight=480
796                 gcc_target_cpu="i386"
797                 ;;
798             *x86_64*)
799                 aros_target_cpu="x86_64"
800                 aros_serial_debug=1
801                 if test "$aros_object_format" = "" ; then
802                     aros_object_format="elf_x86_64"
803                 fi
804                 aros_flavour="standalone"
805                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
806                 aros_config_cflags="$aros_config_cflags -fno-asynchronous-unwind-tables -mno-red-zone"
807                 aros_kernel_ldflags=""
808                 aros_default_wbwidth=640
809                 aros_default_wbheight=480
810                 gcc_target_cpu="x86_64"
811                 ;;
812             *)
813                 AC_MSG_ERROR("Unknown native CPU -- $target_cpu")
814                 ;;
815         esac
816         ;;
818     prep)
819         aros_target_arch="prep"
820         aros_shared_default="no"
821         aros_target_cpu="ppc"
822         aros_object_format="elf32ppc"
823         aros_flavour="ppcnative"
824         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
825         aros_kernel_ldflags=""
826         aros_default_wbwidth=640
827         aros_default_wbheight=480
828         gcc_target_cpu="ppc"
829         ;;
831     freebsd*)
832         aros_target_arch="freebsd"
833         aros_target_cpu="i386"
834         aros_flavour="emulation"
835         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
836         gcc_target_cpu="i386"
838         aros_target_strip_flags="-x"
839         ;;
841     darwin*)
842         aros_target_arch="darwin"
843         aros_flavour="emulation"
844         case "$target_cpu" in
845             *i?86*)
846                 aros_target_cpu="i386"
847                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
848                 aros_kernel_cflags="$aros_kernel_cflags -m32"
849                 aros_kernel_ldflags="$aros_kernel_ldflags -m32"
850                 aros_default_wbdepth=8
851                 gcc_target_cpu="i386"
852                 aros_object_format="elf_i386"
853                 aros_target_strip_flags="-x"
854                 aros_target_cc="i386-aros-gcc"
855                 aros_target_cxx="i386-aros-g++"
856                 aros_target_ld="i386-aros-ld"
857                 aros_target_as="i386-aros-as"
858                 aros_target_ar="i386-aros-ar"
859                 aros_target_ranlib="i386-aros-ranlib"
860                 aros_target_nm="i386-aros-nm"
861                 aros_target_strip="i386-aros-strip"
862                 aros_target_objcopy="i386-aros-objcopy"
863                 aros_target_objdump="i386-aros-objdump"
864                 target_tool_prefix="i686-apple-darwin10-"
865                 ;;
866             *x86_64*)
867                 aros_target_cpu="x86_64"
868                 aros_object_format="elf_x86_64"
869                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
870                 aros_kernel_cflags="$aros_kernel_cflags -m64"
871                 aros_kernel_ldflags="$aros_kernel_ldflags -m64"
872                 aros_default_wbdepth=8
873                 gcc_target_cpu="x86_64"
874                 aros_target_cc="x86_64-aros-gcc"
875                 aros_target_cxx="x86_64-aros-g++"
876                 aros_target_ld="x86_64-aros-ld"
877                 aros_target_as="x86_64-aros-as"
878                 aros_target_ar="x86_64-aros-ar"
879                 aros_target_ranlib="x86_64-aros-ranlib"
880                 aros_target_nm="x86_64-aros-nm"
881                 aros_target_strip="x86_64-aros-strip"
882                 aros_target_objcopy="x86_64-aros-objcopy"
883                 aros_target_objdump="x86_64-aros-objdump"
884                 target_tool_prefix="i686-apple-darwin10-"
885                 ;;
886             *ppc*)
887                 aros_target_cpu="ppc"
888                 aros_object_format="elf32_ppc"
889                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
890                 aros_default_wbdepth=8
891                 gcc_target_cpu="ppc"
892                 aros_target_cc="ppc-aros-gcc"
893                 aros_target_cxx="ppc-aros-g++"
894                 aros_target_ld="ppc-aros-ld"
895                 aros_target_as="ppc-aros-as"
896                 aros_target_ar="ppc-aros-ar"
897                 aros_target_ranlib="ppc-aros-ranlib"
898                 aros_target_nm="ppc-aros-nm"
899                 aros_target_strip="ppc-aros-strip"
900                 aros_target_objcopy="ppc-aros-objcopy"
901                 aros_target_objdump="ppc-aros-objdump"
902                 target_tool_prefix="powerpc-apple-darwin10-"
903                 ;;
904             *)
905                 AC_MSG_ERROR("Unsupported target CPU for darwin hosted flavour -- $target_cpu")
906                 ;;
907         esac
908         ;;
910     ios*)
911         aros_target_arch="ios"
912         aros_flavour="emulation"
913         # This is here because it may depend on iOS or SDK version
914         aros_kernel_objcflags="-fobjc-abi-version=2 -fobjc-legacy-dispatch"
915         case "$target_cpu" in
916             *i?86*)
917                 aros_ios_platform="iPhoneSimulator"
918                 aros_target_cpu="i386"
919                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
920                 aros_default_wbdepth=8
921                 gcc_target_cpu="i386"
922                 aros_object_format="elf_i386"
923                 aros_target_strip_flags="-x"
924                 aros_target_cc="i386-aros-gcc"
925                 aros_target_cxx="i386-aros-g++"
926                 aros_target_ld="i386-aros-ld"
927                 aros_target_as="i386-aros-as"
928                 aros_target_ar="i386-aros-ar"
929                 aros_target_ranlib="i386-aros-ranlib"
930                 aros_target_nm="i386-aros-nm"
931                 aros_target_strip="i386-aros-strip"
932                 aros_target_objcopy="i386-aros-objcopy"
933                 aros_target_objdump="i386-aros-objdump"
934                 target_tool_prefix="i686-apple-darwin10-"
935                 target_tool_flags="-m32"
936                 ;;
937             *arm*)
938                 aros_ios_platform="iPhoneOS"
939                 aros_target_cpu="arm"
940                 aros_object_format="armelf_linux_eabi"
941                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
942                 aros_default_wbdepth=8
943                 gcc_target_cpu="arm"
944                 aros_kernel_ld="ld -arch armv6"
945                 aros_target_cc="arm-elf-gcc"
946                 aros_target_ld="arm-elf-ld"
947                 aros_target_as="arm-elf-as"
948                 aros_target_ar="arm-elf-ar"
949                 aros_target_ranlib="arm-elf-ranlib"
950                 aros_target_nm="arm-elf-nm"
951                 aros_target_strip="arm-elf-strip"
952                 aros_target_objcopy="arm-elf-objcopy"
953                 aros_target_objdump="arm-elf-objdump"
954                 target_tool_prefix="arm-apple-darwin10-" 
955                 aros_default_wbwidth=320
956                 aros_default_wbheight=480
957                 export PATH="$aros_xcode_path/Platforms/$aros_ios_platform.platform/Developer/usr/bin:$PATH"
958                 ;;
959             *)
960                 AC_MSG_ERROR("Unsupported target CPU for iOS hosted flavour -- $target_cpu")
961                 ;;
962         esac
963         aros_ios_sdk="$aros_xcode_path/Platforms/$aros_ios_platform.platform/Developer/SDKs/$aros_ios_platform$aros_ios_sdk.sdk"
964         target_tool_flags="$target_tool_flags --sysroot $aros_ios_sdk"
965         ;;
967     dragonfly*)
968         aros_target_arch="dragonfly"
969         aros_flavour="emulation"
970         case "$target_cpu" in
971             *i?86*)
972                 aros_target_cpu="i386"
973                 aros_object_format="elf_i386"
974                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__DragonFly__"
975                 ;;
976             *x86_64*)
977                 aros_target_cpu="x86_64"
978                 aros_object_format="elf_x86_64"
979                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64 -D__DragonFly__"
980                 ;;
981             *)
982                 AC_MSG_ERROR("Unknown CPU for DragonFly -- $target_cpu")
983                 ;;
984         esac
985         ;;
987     netbsd*)
988         aros_target_arch="netbsd"
989         case "$target_cpu" in
990             *m68k*)
991                 aros_target_cpu="m68k"
992                 aros_object_format="m68kelf"
993                 aros_flavour="emulcompat"
994                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D__mc68000 -D__NetBSD__"
995                 gcc_target_cpu="mc68000"
996                 ;;
997             *i?86*)
998                 aros_target_cpu="i386"
999                 aros_object_format="elf_i386"
1000                 aros_flavour="emulation"
1001                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__NetBSD__"
1002                 aros_default_wbdepth=8
1003                 gcc_target_cpu="i386"
1004                 ;;
1005             *)
1006                 AC_MSG_ERROR("Unknown CPU for NetBSD -- $target_cpu")
1007                 ;;
1008         esac
1009         aros_target_genmap="-Wl,-M -Xlinker >"
1010         aros_flavour="emulation"
1011         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1012         ;;   
1014     openbsd*)
1015         aros_target_arch="openbsd"
1016         case "$target_cpu" in
1017             *i?86*)
1018                 aros_target_cpu="i386"
1019                 aros_object_format="elf_i386"
1020                 aros_flavour="emulation"
1021                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__OpenBSD__"
1022                 gcc_target_cpu="i386"
1023                 ;;
1024             *)
1025                 AC_MSG_ERROR("Unknown CPU for OpenBSD -- $target_cpu")
1026                 ;;
1027         esac
1028         aros_target_genmap="-Wl,-M -Xlinker >"
1029         aros_target_nm_flags="-u"
1030         aros_flavour="emulation"
1031         ;;
1033     solaris*)
1034         aros_target_arch="solaris"
1035         case "$target_cpu" in
1036            *i?86*)
1037                aros_target_cpu="i386"
1038                aros_object_format="elf_i386"
1039                aros_flavour="emulation"
1040                aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__Solaris__"
1041                aros_default_wbdepth=8
1042                gcc_target_cpu="i386"
1043                ;;
1044             *sparc*)
1045                 aros_target_cpu="sparc"
1046                 aros_object_format="elf_sparc"
1047                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dsparc -D__Solaris__"
1048                 gcc_target_cpu="sparc"
1049                 ;;
1050             *)
1051                 AC_MSG_ERROR("Unknown CPU for Solaris -- $target_cpu")
1052                 ;;
1053         esac
1054         aros_config_cflags="$aros_config_cflags -D$aros_target_cpu"
1055         aros_flavour="emulation"
1056         ;;
1058     morphos*)
1059         aros_target_arch="morphos"
1060         aros_shared_default="no"
1061         aros_target_cpu="ppc"
1062         aros_object_format="elf_ppc"
1063         aros_flavour="nativecompat"
1064         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1065         gcc_target_cpu="ppc"
1066         ;;
1068     sam440)
1069         aros_target_arch="sam440"
1070         aros_shared_default="no"
1071         aros_target_cpu="ppc"
1072         aros_object_format="elf32ppc"
1073         aros_flavour="ppcnative"
1074         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1075         aros_kernel_ldflags=""
1076         aros_default_wbwidth=1024
1077         aros_default_wbheight=768
1078         aros_default_wbdepth=24
1079         aros_config_cflags="$aros_config_cflags -mcpu=440fp -mno-toc -fno-asynchronous-unwind-tables"
1080         gcc_target_cpu="powerpc"
1081         ;;
1083     efika)
1084         aros_target_arch="efika"
1085         aros_shared_default="no"
1086         aros_target_cpu="arm"
1087         aros_object_format="armelf_linux_eabi"
1088         aros_flavour="standalone"
1089         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
1090         aros_kernel_ldflags=""
1091         aros_default_wbwidth=1024
1092         aros_default_wbheight=600
1093         aros_arch_libs="-laeabi"
1094         aros_config_cflags="$aros_config_cflags -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -fno-asynchronous-unwind-tables -fno-exceptions"
1095         aros_config_aflags="$aros_config_aflags -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -fno-asynchronous-unwind-tables -fno-exceptions"
1096         ;;
1097         
1098     chrp)
1099     aros_target_arch="chrp"
1100     aros_shared_default="no"
1101     aros_target_cpu="ppc"
1102     aros_object_format="elf32ppc"
1103     aros_flavour="ppcnative"
1104     aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
1105     aros_kernel_ldflags=""
1106     aros_default_wbwidth=640
1107     aros_default_wbheight=480
1108     aros_config_cflags="$aros_config_cflags -mno-toc -fno-asynchronous-unwind-tables"    
1109     gcc_target_cpu="powerpc"
1110         case "$aros_target_variant" in
1111             efika)
1112             aros_config_cflags="$aros_config_cflags -DBIG_ENDIAN_OHCI=1 -mcpu=603e"
1113             ;;
1114         esac
1115     ;;
1117     amiga*)
1118         aros_target_arch="amiga"
1119         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D_AMIGA -DAMIGA"
1120         aros_shared_default="no"
1122         case "$target_cpu" in
1123             *m68k*)
1124                 aros_target_cpu="m68k"
1125                 aros_object_format="m68kelf"
1126                 aros_flavour="standalone"
1127                 gcc_target_cpu="mc68000"
1128                 aros_config_cflags="$aros_config_cflags -g3 -fno-strict-aliasing -ffreestanding -fomit-frame-pointer -${gcc_target_cpu} -fbuiltin"
1129                 aros_config_aflags="$aros_config_aflags -g3 -fno-strict-aliasing -ffreestanding -fomit-frame-pointer -${gcc_target_cpu}"
1130                 aros_debug_cflags="-Wall -Werror-implicit-function-declaration $aros_symbols_debug  $aros_messages_debug -${gcc_target_cpu}"
1131                 target_tool_prefix="m68k-elf-"
1132                 aros_target_nostdlib_ldflags="" # We always need -lgcc
1133                 aros_target_strip_flags="-R.comment"
1134                 ;;
1135             *ppc*)
1136                 aros_cpu="ppc"
1137                 aros_flavour="native"
1138                 gcc_target_cpu="ppc"
1139                 ;;
1140             *)
1141                 AC_MSG_ERROR("Unknown CPU for Amiga $target_cpu")
1142                 ;;
1143         esac
1144         ;;
1146     mingw*)
1147         aros_target_arch="mingw32"
1148         aros_shared_default="no"
1149         aros_flavour="emulation"
1150         aros_shared_cflags=""
1151         need_dlopen="no"
1152         rescomp="windres"
1153         case "$target_cpu" in
1154             *i?86*)
1155                 aros_target_cpu="i386"
1156                 aros_object_format="elf_i386"
1157                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
1158                 aros_default_wbdepth=8
1159                 gcc_target_cpu="i386"
1160                 aros_target_cc="i386-aros-gcc"
1161                 aros_target_cxx="i386-aros-g++"
1162                 aros_target_ld="i386-aros-ld"
1163                 aros_target_as="i386-aros-as"
1164                 aros_target_ar="i386-aros-ar"
1165                 aros_target_ranlib="i386-aros-ranlib"
1166                 aros_target_nm="i386-aros-nm"
1167                 aros_target_strip="i386-aros-strip"
1168                 aros_target_objcopy="i386-aros-objcopy"
1169                 aros_target_objdump="i386-aros-objdump"
1170                 target_tool_prefix="i386-mingw32-"
1171                 ;;
1172             *x86_64*)
1173                 aros_target_cpu="x86_64"
1174                 aros_object_format="elf_x86_64"
1175                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
1176                 aros_default_wbdepth=8
1177                 gcc_target_cpu="x86_64"
1178                 aros_target_cc="x86_64-aros-gcc"
1179                 aros_target_cxx="x86_64-aros-g++"
1180                 aros_target_ld="x86_64-aros-ld"
1181                 aros_target_as="x86_64-aros-as"
1182                 aros_target_ar="x86_64-aros-ar"
1183                 aros_target_ranlib="x86_64-aros-ranlib"
1184                 aros_target_nm="x86_64-aros-nm"
1185                 aros_target_strip="x86_64-aros-strip"
1186                 aros_target_objcopy="x86_64-aros-objcopy"
1187                 aros_target_objdump="x86_64-aros-objdump"
1188                 target_tool_prefix="x86_64-w64-mingw32-"
1189                 ;;
1190             *arm*)
1191                 aros_target_cpu="arm"
1192                 aros_object_format="armelf_linux_eabi"
1193                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Darm"
1194                 aros_default_wbdepth=8
1195                 gcc_target_cpu="arm"
1196                 aros_target_cc="arm-elf-gcc"
1197                 aros_target_ld="arm-elf-ld"
1198                 aros_target_as="arm-elf-as"
1199                 aros_target_ar="arm-elf-ar"
1200                 aros_target_ranlib="arm-elf-ranlib"
1201                 aros_target_nm="arm-elf-nm"
1202                 aros_target_strip="arm-elf-strip"
1203                 aros_target_objcopy="arm-elf-objcopy"
1204                 aros_target_objdump="arm-elf-objdump"
1205                 target_tool_prefix="arm-mingw32ce-"
1206                 aros_default_wbwidth=160
1207                 aros_default_wbheight=160
1208                 ;;
1209             *)
1210                 AC_MSG_ERROR("Unknown CPU for Mingw32 -- $target_cpu")
1211                 ;;
1212         esac
1213         if test $host_os = "cygwin"; then
1214                 aros_kernel_cflags="-mno-cygwin"
1215         fi
1216     ;;
1217     pp*)
1218         aros_target_arch="pp"
1219         aros_shared_default="no"
1220         case "$target_cpu" in
1221             *m68k*)
1222                 aros_target_cpu="m68k"
1223                 aros_object_format="m68kelf"
1224                 aros_flavour="palmnative"
1225                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
1226                 aros_default_wbwidth=160
1227                 aros_default_wbheight=160
1228                 aros_default_wbdepth=1
1229                 aros_target_ar_flags="cru"
1230                 aros_compiler_libs="-lgcc1"
1231                 aros_shared_default=no
1232                 aros_shared_cflags="-fpic"
1233                 aros_shared_aflags=""
1234                 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
1235                 aros_kernel_ldflags="-Wl,-rpath,./lib"
1236                 aros_debug_cflags="-Wall -Werror-implicit-function-declaration $aros_symbols_debug  $aros_messages_debug -mc68000 -Wa,-mc68000"
1237                 aros_debug_aflags=""
1238                 aros_debug_ldflags="$aros_symbols_debug"
1239                 aros_mungwall_debug="0"
1240                 aros_modules_debug="0"
1241                 gcc_target_cpu="mc68000"
1242                 ignore_undefined_symbols="-ius"
1243                 ;;
1244            *)
1245                 AC_MSG_ERROR("Unknown CPU for PalmPilot -- $target_cpu")
1246                 ;;
1247         esac
1248         ;;
1250     mac*)
1251         aros_target_arch="mac"
1252         aros_shared_default="no"
1253         case "$target_cpu" in
1254             *m68k*)
1255                 aros_target_cpu="m68k"
1256                 aros_object_format="m68kelf"
1257                 aros_flavour="mac68knative"
1258                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
1259                 aros_default_wbwidth=512
1260                 aros_default_wbheight=384
1261                 aros_default_wbdepth=8
1262                 aros_target_ar_flags="cru"
1263                 aros_compiler_libs="-lgcc1"
1264                 aros_shared_default=no
1265                 aros_shared_cflags="-fpic"
1266                 aros_shared_aflags=""
1267                 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
1268                 aros_kernel_ldflags="-Wl,-rpath,./lib"
1269                 aros_debug_cflags="-Wall -Werror-implicit-function-declaration $aros_symbols_debug  $aros_messages_debug -mc68000"
1270                 aros_debug_aflags=""
1271                 aros_debug_ldflags="$aros_symbols_debug"
1272                 aros_mungwall_debug="0"
1273                 aros_modules_debug="0"
1274                 gcc_target_cpu="mc68000"
1275                 ignore_undefined_symbols="-ius"
1276                 ;;
1277            *)
1278                 AC_MSG_ERROR("Unknown CPU for Mac68k -- $target_cpu")
1279                 ;;
1280         esac
1281         ;;
1283     *)
1284         AC_MSG_ERROR([Unsupported target architecture $target])
1285         ;;
1286 esac
1288 AC_MSG_CHECKING([Where to download sourcecode for external ports])
1289 AC_ARG_WITH(portssources,AC_HELP_STRING([--with-portssources=DIR],[Where to download sourcecode for external ports]),with_portssrcdir=$withval,with_portssrcdir="default")
1290 if test "$with_portssrcdir" = "default"; then
1291     AROS_PORTSSRCDIR="$AROS_BUILDDIR_UNIX/bin/Sources"
1292 else
1293     AROS_PORTSSRCDIR="$with_portssrcdir"
1295 AC_MSG_RESULT($AROS_PORTSSRCDIR)
1297 AC_MSG_CHECKING([which bootloader to use])
1298 AC_ARG_WITH(bootloader,AC_HELP_STRING([--with-bootloader=NAME],[Use a specific bootloader]),target_bootloader=$withval,target_bootloader=$target_bootloader)
1299 if test "$target_bootloader" = "none"; then
1300     aros_target_bootloader=""
1301 else
1302     aros_target_bootloader="$target_bootloader"
1304 AC_MSG_RESULT($target_bootloader)
1306 AC_MSG_CHECKING([which icon-set to use])
1307 AC_ARG_WITH(iconset,AC_HELP_STRING([--with-iconset=NAME],[Use a specific Icon-set (default=Gorilla).]),target_iconset=$withval,target_iconset="default")
1308 if test "$target_iconset" = "default"; then
1309     aros_target_iconset="Gorilla"
1310     target_iconset="default (Gorilla)"
1311 else
1312     aros_target_iconset="$target_iconset"
1314 AC_MSG_RESULT($target_iconset)
1316 AC_MSG_CHECKING([which GUI Theme to use])
1317 AC_ARG_WITH(theme,AC_HELP_STRING([--with-theme=NAME],[Use a specific GUI Theme]),target_guitheme=$withval,target_guitheme="default")
1318 if test "$target_guitheme" = "default"; then
1319     aros_target_guitheme="Ice"
1320 else
1321     aros_target_guitheme="$target_guitheme"
1323 AC_MSG_RESULT($aros_target_guitheme)
1325 # Find out if we are cross-compiling (i.e. if we can't use the host compiler
1326 # for target code)
1327 cross_compiling=no
1328 if test "$aros_host_cpu" != "$aros_target_cpu" ; then
1329     cross_compiling=yes
1331 if test "$aros_host_cpu" == "x86_64" ; then
1332     if test "$aros_target_cpu" == "i386" ; then
1333         if test "$aros_target_arch" != "mingw32"; then
1334             cross_compiling=no
1335         fi
1336     fi
1339 # Set prefix for target compiler etc. if we're cross-compiling
1340 # (should possibly be earlier but needs to be after AC_PROG_CC)
1341 if test "$cross_compiling" = "yes" ; then
1342     if test "$target_tool_prefix" = ""; then
1343         target_tool_prefix=${target_cpu}-elf-
1344     fi
1345     CC=${target_tool_prefix}gcc
1346     if test "$target_tool_version" != "default"; then
1347         CC="$CC-$target_tool_version"
1348     fi
1349     AC_PATH_PROG(CC,$CC)
1350     AROS_REQUIRED(gcc,$CC)
1352 CC="$CC $target_tool_flags"
1354 #-----------------------------------------------------------------------------
1356 # Disable pointer-signedness warnings if the compiler recognises the option
1358 AC_MSG_CHECKING([whether ${CC} accepts -Wno-pointer-sign])
1359 save_cflags="$CFLAGS"
1360 CFLAGS="$CFLAGS -Wno-pointer-sign"
1361 AC_TRY_COMPILE(,, use_no_sign_warning="yes", use_no_sign_warning="no")
1362 AC_MSG_RESULT($use_no_sign_warning)
1363 if test "x-$use_no_sign_warning" = "x-yes" ; then
1364     aros_config_cflags="$aros_config_cflags -Wno-pointer-sign"
1366 CFLAGS="$save_cflags"
1368 #-----------------------------------------------------------------------------
1370 # Find all the tools we need to compile. This could be cross-compiling
1371 # though! If that is the case we use the GNU form of the target and
1372 # simply add this to the front of the binary name. This is rather simple,
1373 # but it should work under most circumstances.
1375 # The default tools are to use the same as the host, but only if the
1376 # host and target CPU are the same. With GCC this is normally enough.
1379 aros_cc_pre=""
1380 aros_shared_ld="$aros_host_ld"
1382 aros_target_mkdep="$aros_host_mkdep"
1383 aros_target_incl_def="$aros_host_incl"
1385 aros_kernel_cc="$CC"
1387 # The default tools executables to be linked to.
1388 if test "$aros_target_cc" != ""; then
1389     AC_PATH_PROG(aros_target_cc,$aros_target_cc)
1390     AROS_REQUIRED(gcc,$aros_target_cc)
1392 if test "$aros_target_ld" != ""; then
1393     AC_PATH_PROG(aros_target_ld,$aros_target_ld)
1394     AROS_REQUIRED(ld,$aros_target_ld)
1397 if test "$crosstools" != "yes"; then
1398     AROS_TOOL_TARGET(aros_target_as_ln,as,$aros_target_as)
1399     AROS_REQUIRED(as,$aros_target_as_ln)
1400     AROS_TOOL_TARGET(aros_kernel_ld,ld,$aros_kernel_ld)
1401     AROS_REQUIRED(ld,$aros_kernel_ld)
1402     AROS_TOOL_TARGET(aros_target_ar_ln,ar,$aros_target_ar)
1403     AROS_REQUIRED(ar,$aros_target_ar_ln)
1404     AROS_TOOL_TARGET(aros_target_nm_ln,nm,$aros_target_nm)
1405     AROS_REQUIRED(nm,$aros_target_nm_ln)
1406     AROS_TOOL_TARGET(aros_target_objcopy_ln,objcopy,$aros_target_objcopy)
1407     AROS_REQUIRED(objcopy,$aros_target_objcopy_ln)
1408     AROS_TOOL_TARGET(aros_target_objdump_ln,objdump,$aros_target_objdump)
1409     AROS_REQUIRED(objdump,$aros_target_objdump_ln)
1410     AROS_TOOL_TARGET(aros_target_ranlib_ln,ranlib,$aros_target_ranlib)
1411     AROS_REQUIRED(ranlib,$aros_target_ranlib_ln)
1412     AROS_TOOL_TARGET(aros_target_strip_ln,strip,$aros_target_strip)
1413     AROS_REQUIRED(strip,$aros_target_strip_ln)
1414 # Temporarily disabled in order to let Windows-hosted port to build.
1415 #    if test "$aros_target_cxx" != ""; then
1416 #       AC_PATH_PROG(aros_target_cxx,$aros_target_cxx)
1417 #       AROS_REQUIRED(c++,$aros_target_cxx)
1418 #    fi
1419 else
1420 # Cancel preinstalled C++ compiler because it will be built as part of crosstools
1421     aros_target_cxx=""
1424 if test "$rescomp" != ""; then
1425     if test "$cross_compiling" = "yes" ; then
1426         rescomp=${target_tool_prefix}${rescomp}
1427     fi
1428     AC_PATH_PROG(aros_kernel_rescomp,$rescomp)
1429     AROS_REQUIRED($rescomp,$aros_kernel_rescomp)
1432 aros_hostcfg_dir="bin/${aros_host_arch}-${aros_host_cpu}/gen/config"
1433 aros_targetcfg_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/config"
1434 aros_inc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/AROS/Development/include/aros"
1435 aros_gendir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen"
1436 aros_geninc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/include/aros"
1437 aros_tools_dir="bin/${aros_host_arch}-${aros_host_cpu}/tools"
1438 aros_scripts_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/scripts"
1440 # aros_cc_pre is a variable that is added to the front of the compiler name
1441 # in the generated aros-gcc shell script. We need this to enable the cache
1442 # to work across cleaned builds. Also, support DISTCC using the correct
1443 # environment variable.
1446 if test "x${DISTCC}" != "x" ; then
1447     if test "x${CCACHE}" != "x" ; then
1448         aros_cc_pre="env CCACHE_PREFIX=${DISTCC} ${CCACHE} "
1449     else
1450         aros_cc_pre="${DISTCC} "
1451     fi
1452 else
1453     if test "x${CCACHE}" != "x" ; then
1454         aros_cc_pre="${CCACHE} "
1455     fi
1458 prefix="${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros"
1460 AC_SUBST(aros_target_nostdinc_cflags,-nostdinc)
1461 AC_SUBST(aros_target_nostartup_ldflags,-nostartfiles)
1462 AC_SUBST(aros_target_nix_ldflags,-nix)
1463 AC_SUBST(aros_target_detach_ldflags,-detach)
1464 AC_SUBST(aros_target_nostdlib_ldflags,-nostdlib)
1466 # Target tools
1467 if test "$aros_target_cc" = ""; then
1468     orig_target_cc=$aros_kernel_cc
1469 else
1470     orig_target_cc=$aros_target_cc
1472 if test "$aros_target_ld" = ""; then
1473     orig_target_ld=$aros_kernel_ld
1474 else
1475     orig_target_ld=$aros_target_ld
1477 if test "$GCC" = "yes"; then
1478     aros_target_cc_path=`$orig_target_cc -print-search-dirs | grep "programs: =" | cut -c 12-`
1480 aros_target_cc="${prefix}-gcc"
1481 aros_target_as="${prefix}-as"
1482 aros_target_ld="${prefix}-ld"
1483 aros_target_ar="${prefix}-ar $aros_target_ar_flags"
1484 aros_target_objcopy=${prefix}-objcopy
1485 aros_target_objdump=${prefix}-objdump
1486 aros_target_ranlib="${prefix}-ranlib $aros_target_ranlib_flags"
1487 aros_target_nm="${prefix}-nm $aros_target_nm_flags"
1488 aros_kernel_nm="${prefix}-nm"
1489 aros_target_strip=${prefix}-strip
1491 # Find the system include path. We can suggest that an alternative is
1492 # used if we don't get it correct. The default is to use /usr/include.
1493 # Which is set in the aros_target_incl_def variable.
1495 AC_ARG_ENABLE(includes,
1496 AC_HELP_STRING([--enable-includes=dir],[Alternative system include directory]),
1497 [aros_target_incl=$enable_includes], [aros_target_incl=$aros_target_incl_def])
1499 dnl find out about the target cc's include path
1500 AC_MSG_CHECKING([for the target compiler's include path])
1501 if test "$aros_target_cc_includes" = "" ; then
1502     #try to guess where the directory is
1503     aros_target_cc_includes=`dirname \`${orig_target_cc} -print-libgcc-file-name\``/include
1504     if ! test -d $aros_target_cc_includes; then
1505         #the directory doesn't exist, we need to do some more work
1506         aros_target_cc_includes=${PWD}/${aros_gendir}/cc_include
1507         
1508         #these are the headers we're looling for
1509         headers="limits.h mmintrin.h stdbool.h syslimits.h float.h \
1510                  stddef.h xmmintrin.h iso646.h stdarg.h unwind.h   \
1511                  zutil.h"
1513         dirs=
1514         for h in $headers; do
1515             #which other headers each of the above headers needs?
1516             deps=$(echo "#include <$h>" | \
1517                    $aros_host_cc -E -M - 2>/dev/null | \
1518                    sed 's/^.*://; s/\\$/ /g; s/[[ \t]]\+/ /g')
1519             
1520             #copy all the needed headers to a directory beneath gendir
1521             for d in $deps; do
1522                 h=$(basename $d)
1523                 dir=${aros_target_cc_includes}$(echo $(dirname $d) | \
1524                                                 sed -n "s,^.*/include\(/.*\),\1,p")
1525                 ! test -d $dir && mkdir -p $dir
1526                 ! test -f $dir/$h && { cp $d $dir; chmod u+w $dir/$h; }
1527             done
1528         done        
1529     fi
1531 AC_MSG_RESULT($aros_target_cc_includes)
1534 # For GCC < 4.0 -I- is used for giving the search path for '#include "..."'
1535 # On GCC >= 4.0 -iquote should be used
1538 save_cc="$CC"
1539 save_cflags="$CFLAGS"
1540 CFLAGS="-iquote."
1541 AC_MSG_CHECKING([whether ${CC} accepts -iquote])
1542 AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
1543 AC_MSG_RESULT($has_iquote)
1544 if test "x-$has_iquote" = "x-yes" ; then
1545     host_cflags_iquote=-iquote
1546     host_cflags_iquote_end=
1547 else
1548     host_cflags_iquote=-I
1549     host_cflags_iquote_end=-I-
1551 kernel_cflags_iquote=$host_cflags_iquote
1552 kernel_cflags_iquote_end=$host_cflags_iquote_end
1553 if test "x-$cross_compiling" = "x-yes"; then
1554     CC="$aros_kernel_cc"
1555     AC_MSG_CHECKING([whether ${CC} accepts -fno-stack-protector])
1556     AC_TRY_COMPILE(,, use_no_stack_protector="yes", use_no_stack_protector="no")
1557     AC_MSG_RESULT($use_no_stack_protector)
1558     AC_MSG_CHECKING([whether ${CC} accepts -iquote])
1559     AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
1560     AC_MSG_RESULT($has_iquote)
1561     if test "x-$has_iquote" = "x-yes" ; then
1562         kernel_cflags_iquote=-iquote
1563         kernel_cflags_iquote_end=
1564     else
1565         kernel_cflags_iquote=-I
1566         kernel_cflags_iquote_end=-I-
1567     fi
1569 aros_cflags_iquote=$kernel_cflags_iquote
1570 aros_cflags_iquote_end=$kernel_cflags_iquote_end
1571 if test "$orig_target_cc" != "$aros_kernel_cc"; then
1572     CC="$orig_target_cc"
1573     AC_MSG_CHECKING([whether ${CC} accepts -iquote])
1574     AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
1575     AC_MSG_RESULT($has_iquote)
1576     if test "x-$has_iquote" = "x-yes" ; then
1577         aros_cflags_iquote=-iquote
1578         aros_cflags_iquote_end=
1579     else
1580         aros_cflags_iquote=-I
1581         aros_cflags_iquote_end=-I-
1582     fi
1584 if test "x-$use_no_stack_protector" = "x-yes" ; then
1585     aros_kernel_cflags="$aros_kernel_cflags -fno-stack-protector"
1588 #-----------------------------------------------------------------------------
1590 # Check if we can explicitly choose older version of symbol hashing
1592 CFLAGS="save_cflags -Wl,--hash-style=sysv"
1593 CC="$aros_kernel_cc"
1594 AC_MSG_CHECKING([whether ${CC} accepts -Wl,--hash-style=sysv])
1595 AC_TRY_LINK(,, use_hash_style="yes", use_hash_style="no")
1596 AC_MSG_RESULT($use_hash_style)
1597 if test "x-$use_hash_style" = "x-yes" ; then
1598     aros_kernel_cflags="$aros_kernel_cflags -Wl,--hash-style=sysv"
1600 CC="$save_cc"
1601 CFLAGS="$save_cflags"
1603 AC_SUBST(host_cflags_iquote)
1604 AC_SUBST(host_cflags_iquote_end)
1605 AC_SUBST(kernel_cflags_iquote)
1606 AC_SUBST(kernel_cflags_iquote_end)
1607 AC_SUBST(aros_cflags_iquote)
1608 AC_SUBST(aros_cflags_iquote_end)
1611 dnl Check if user specified --with-resolution=XRESxYRESxDEPTH
1612 AC_MSG_CHECKING([for default resolution of WBScreen])
1613 AC_ARG_WITH(resolution,AC_HELP_STRING([--with-resolution=XRESxYRESxDEPTH],[Default resolution of the initial WorkbenchScreen]),resolution=$withval,resolution=none)
1614 # We require an argument, so map --with/--without ("yes"/"no") to "none" specified
1615 if test "$resolution" = "yes" ; then
1616     resolution="none"
1618 if test "$resolution" = "no" ; then
1619     resolution="none"
1621 if test "$resolution" != "none" ; then
1622     aros_default_wbwidth=`echo $resolution | cut -d'x' -f1`
1623     aros_default_wbheight=`echo $resolution | cut -d'x' -f2`
1624     aros_default_wbdepth=`echo $resolution | cut -d'x' -f3`
1626 AC_MSG_RESULT($aros_default_wbwidth x $aros_default_wbheight x $aros_default_wbdepth)
1627 aros_cv_default_wbwidth=$aros_default_wbwidth
1628 aros_cv_default_wbheight=$aros_default_wbheight
1629 aros_cv_default_wbdepth=$aros_default_wbdepth
1631 dnl See if the user wants the serial debug output for native flavour
1632 AC_MSG_CHECKING([if serial debug is enabled])
1633 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)
1634 if test "$aros_serial_debug" = 0 ; then
1635     serial_debug_forced=""
1636     if test "$serial_debug" = "yes" ; then
1637         serial_debug="2"
1638     fi
1639     if test "$serial_debug" = "no" ; then
1640         serial_debug="none"
1641     fi
1642 else
1643     serial_debug_forced="(forced)"
1644     serial_debug=$aros_serial_debug
1646 if test "$serial_debug" != "none" ; then
1647     aros_serial_debug=$serial_debug
1648     AC_MSG_RESULT($serial_debug_forced on port $serial_debug)
1649 else
1650     AC_MSG_RESULT(no)
1653 dnl See if the user wants the palm debug output hack for palm native flavour
1654 AC_MSG_CHECKING([if palm debug hack is enabled])
1655 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")
1656 if test "$palm_debug_hack" = "yes" ; then
1657     aros_palm_debug_hack="1"
1659 AC_MSG_RESULT($palm_debug_hack)
1662 dnl See if the user wants nesting supervisor activated for unix flavour
1663 AC_MSG_CHECKING([if nesting supervisor support is enabled])
1664 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")
1665 if test "$nesting_supervisor" = "yes" ; then
1666     aros_nesting_supervisor="1"
1668 AC_MSG_RESULT($nesting_supervisor)
1671 dnl things specifically required for hosted flavours
1672 if test "x-$aros_flavour" = "x-emulation" -o "x-$aros_flavour" = "x-emulcompat" ; then
1674     if test "x-$need_dlopen" != "x-no" ; then
1675       dnl some kind of dynamic library access system is required for hostlib.resource
1676       AC_CHECK_FUNC(dlopen, have_dl="yes", have_dl="no")
1677       if test "x-$have_dl" = "x-no" ; then
1678           AC_CHECK_LIB(dl, dlopen, [have_dl="yes"
1679                                     aros_host_ldflags="$aros_host_ldflags -ldl"],
1680                                     have_dl="no")
1681       fi
1682       if test "x-$have_dl" = "x-no" ; then
1683           AC_MSG_ERROR([dlopen() dynamic linker functions not available])
1684       fi
1685     fi
1688     dnl x11 hidd
1689     AC_ARG_ENABLE(x11_hidd, AC_HELP_STRING([--enable-x11-hidd],
1690                                            [build X11 hidd for hosted (default=auto)]),
1691                                            x11_hidd="$enableval",
1692                                            x11_hidd="auto")
1693     case "x-$x11_hidd" in
1694         x-yes|x-no|x-auto)                 ;;
1695         *)                 x11_hidd="auto" ;;
1696     esac
1698     ENABLE_X11=0
1700     dnl they want it
1701     if test "x-$x11_hidd" != "x-no" ; then
1703         dnl find x11 stuff
1704         AC_PATH_X
1706         x_cflags=
1707         for path in $x_libraries
1708         do
1709             x_cflags="$x_cflags -L$path"
1710         done
1712         for path in $x_includes
1713         do
1714             x_cflags="$x_cflags -I$path"
1715         done
1716         
1717         if test "x-$no_x" = "x-yes" ; then
1719             dnl didn't find it
1720             if test "x-$x11_hidd" != "x-auto" ; then
1721                 dnl and they explicitly asked for it, bail out
1722                 AC_MSG_ERROR([X11 libs/headers not found, cannot build X11 hidd as requested])
1723             fi
1724         
1725         else
1726             dnl found it, setup the metatarget
1727             x11_hidd_target=kernel-x11gfx-kobj
1728             ENABLE_X11=1
1730             dnl setup shared memory extensions
1731             AC_ARG_ENABLE(x11_shm, AC_HELP_STRING([--enable-x11-shm],
1732                                                   [use X11 shared memory (default=auto)]),
1733                                                   x11_hidd_shm="$enableval",
1734                                                   x11_hidd_shm="auto")
1735             case "x-$x11_hidd_shm" in
1736                 x-yes|x-no|x-auto)                     ;;
1737                 *)                 x11_hidd_shm="auto" ;;
1738             esac
1740             have_xshm=no
1742             dnl they want it
1743             if test "x-$x11_hidd_shm" != "x-no" ; then
1745                 dnl system shm headers
1746                 AC_CHECK_HEADERS(sys/ipc.h)
1747                 AC_CHECK_HEADERS(sys/shm.h)
1749                 dnl got them
1750                 if test "x-$ac_cv_header_sys_ipc_h" = "x-yes" -a "x-$ac_cv_header_sys_shm_h" = "x-yes" ; then
1752                     dnl make sure X libs have shm functions
1753                     save_cflags="$CFLAGS"
1754                     CFLAGS="$CFLAGS $x_cflags"
1755                     AC_CHECK_LIB(Xext, XShmQueryExtension, have_xshm=yes)
1756                     CFLAGS="$save_cflags"
1757                 fi
1758             fi
1760             dnl detection done, prepare output
1761             if test "x-$have_xshm" = "x-yes" ; then
1762                 dnl we can do shm
1763                 DO_XSHM_SUPPORT="1"
1764             elif test "x-$x11_hidd_shm" = "x-yes" ; then
1765                 dnl they explicitly asked for it, but we can't do it
1766                 AC_MSG_ERROR([X11 has no support for shared memory, cannot enable it as requested])
1767             else
1768                 dnl otherwise just disable it
1769                 DO_XSHM_SUPPORT="0"
1770             fi
1772             
1773             dnl setup vidmode (fullscreen) extensions
1774             AC_ARG_ENABLE(x11_vidmode, AC_HELP_STRING([--enable-x11-vidmode],
1775                                                       [use X11 vidmode extension (default=auto)]),
1776                                                       x11_hidd_vidmode="$enableval",
1777                                                       x11_hidd_vidmode="auto")
1778             case "x-$x11_hidd_vidmode" in
1779                 x-yes|x-no|x-auto)                         ;;
1780                 *)                 x11_hidd_vidmode="auto" ;;
1781             esac
1783             have_vidmode=no
1785             dnl they want it
1786             if test "x-$x11_hidd_vidmode" != "x-no" ; then
1788                 dnl make sure X libs have vidmode functions
1789                 save_cflags="$CFLAGS"
1790                 CFLAGS="$CFLAGS $x_cflags"
1791                 AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryExtension, have_vidmode=yes)
1792                 CFLAGS="$save_cflags"
1793             fi
1795             dnl detection done, prepare output
1796             if test "x-$have_vidmode" = "x-yes" ; then
1797                 dnl we can do vidmode
1798                 DO_VIDMODE_SUPPORT="1"
1799             elif test "x-$x11_hidd_vidmode" = "x-yes" ; then
1800                 dnl they explicitly asked for it, but we can't do it
1801                 AC_MSG_ERROR([X11 vidmode extension not available, cannot enable it as requested])
1802             else
1803                 dnl otherwise just disable it
1804                 DO_VIDMODE_SUPPORT="0"
1805             fi
1806         fi
1808         aros_host_x11_includes=$x_includes 
1809         aros_host_x11_libdirs=$x_libraries
1810     fi
1813     dnl sdl hidd
1814     AC_ARG_ENABLE(sdl_hidd, AC_HELP_STRING([--enable-sdl-hidd],
1815                                            [build SDL hidd for hosted (default=auto)]),
1816                                            sdl_hidd="$enableval",
1817                                            sdl_hidd="auto")
1818     case "x-$sdl_hidd" in
1819         x-yes|x-no|x-auto)                 ;;
1820         *)                 sdl_hidd="auto" ;;
1821     esac
1823     dnl they want it
1824     if test "x-$sdl_hidd" != "x-no" ; then
1826         dnl find sdl
1827         AM_PATH_SDL([1.2.10], have_sdl="yes", have_sdl="no")
1829         if test "x-$have_sdl" != "x-yes" ; then
1831             dnl didn't find it
1832             if test "x-$sdl_hidd" != "x-auto" ; then
1833                 dnl and they explicitly asked for it, bail out
1834                 AC_MSG_ERROR([SDL libs/headers not found, cannot build SDL hidd as requested])
1835             fi
1837         else
1838             dnl found it, set up the metatarget
1839             sdl_hidd_target=kernel-hidd-sdl
1840             aros_host_sdl_cflags=SDL_CFLAGS
1841             aros_host_sdl_libs=SDL_LIBS
1842         fi
1843     fi
1848 dnl See if the user wants dbus.library
1849 AC_MSG_CHECKING([if building of dbus.library is enabled])
1850 AC_ARG_ENABLE(dbus,AC_HELP_STRING([--enable-dbus],[Enable DBUS support via dbus.library (default=no)]),dbus="yes",dbus="no")
1851 if test "$dbus" = "yes" ; then
1852     ENABLE_DBUS=1
1853     DBUS_CFLAGS=`pkg-config --cflags dbus-1`
1854     DBUS_LIBFLAGS=`pkg-config --libs dbus-1`
1855     KERNEL_DBUS_KOBJ=kernel-dbus-kobj
1856     KERNEL_DBUS_INCLUDES=kernel-dbus-includes
1857 else
1858     ENABLE_DBUS=0
1860 AC_MSG_RESULT($dbus)
1863 dnl --------------------------------------------------------------------
1864 dnl Configuration Output Section
1865 dnl --------------------------------------------------------------------
1867 # Generic
1868 AC_SUBST(aros_arch)
1869 AC_SUBST(aros_cpu)
1870 AC_SUBST(aros_flavour)
1871 AC_SUBST(aros_flavour_uc)
1872 AC_SUBST(AROS_BUILDDIR)
1873 AC_SUBST(AROS_BUILDDIR_UNIX)
1874 AC_SUBST(SRCDIR)
1875 AC_SUBST(AROS_PORTSSRCDIR)
1877 # Host related
1878 AC_SUBST(aros_cc_pre)
1879 AC_SUBST(aros_host_strip)
1880 AC_SUBST(aros_host_arch)
1881 AC_SUBST(aros_host_cpu)
1882 AC_SUBST(aros_host_cc)
1883 AC_SUBST(aros_host_ar)
1884 AC_SUBST(aros_host_ranlib)
1885 AC_SUBST(aros_host_ld)
1886 AC_SUBST(aros_host_make)
1887 AC_SUBST(aros_host_cflags)
1888 AC_SUBST(aros_host_ldflags)
1889 AC_SUBST(aros_host_debug)
1890 AC_SUBST(aros_host_mkdep)
1891 AC_SUBST(aros_host_mkargs)
1892 AC_SUBST(aros_host_exe_suffix)
1893 AC_SUBST(aros_host_lib_suffix)
1894 AC_SUBST(aros_tools_dir)
1895 AC_SUBST(aros_host_aclocal)
1896 AC_SUBST(aros_host_autoconf)
1897 AC_SUBST(aros_host_autoheader)
1898 AC_SUBST(aros_host_automake)
1900 # Target Related
1901 AC_SUBST(aros_target_guitheme)
1902 AC_SUBST(aros_target_iconset)
1903 AC_SUBST(aros_target_bootloader)
1904 AC_SUBST(aros_target_arch)
1905 AC_SUBST(aros_target_cpu)
1906 AC_SUBST(aros_target_variant)
1907 AC_SUBST(aros_target_suffix)
1908 AC_SUBST(aros_target_incl)
1909 AC_SUBST(aros_target_ar)
1910 AC_SUBST(aros_target_ranlib)
1911 AC_SUBST(aros_kernel_nm)
1912 AC_SUBST(orig_target_cc)
1913 AC_SUBST(aros_target_cc)
1914 AC_SUBST(aros_target_cxx)
1915 AC_SUBST(aros_kernel_cc)
1916 AC_SUBST(aros_target_as)
1917 AC_SUBST(orig_target_ld)
1918 AC_SUBST(aros_target_ld)
1919 AC_SUBST(aros_kernel_ld)
1920 AC_SUBST(aros_target_cc_includes)
1921 AC_SUBST(aros_target_cc_path)
1922 AC_SUBST(aros_target_objdump)
1923 AC_SUBST(aros_target_objcopy)
1924 AC_SUBST(aros_target_strip)
1925 AC_SUBST(aros_target_nm)
1926 AC_SUBST(aros_kernel_rescomp)
1927 AC_SUBST(aros_shared_default)
1928 AC_SUBST(aros_shared_ld)
1929 AC_SUBST(aros_object_format)
1930 AC_SUBST(aros_compiler_libs)
1931 AC_SUBST(aros_arch_libs)
1933 AC_SUBST(aros_config_cflags)
1934 AC_SUBST(aros_config_aflags)
1935 AC_SUBST(aros_config_ldflags)
1937 AC_SUBST(aros_shared_cflags)
1938 AC_SUBST(aros_shared_aflags)
1939 AC_SUBST(aros_shared_ldflags)
1940 AC_SUBST(aros_kernel_cflags)
1941 AC_SUBST(aros_kernel_objcflags)
1942 AC_SUBST(aros_kernel_ldflags)
1943 AC_SUBST(aros_debug_cflags)
1944 AC_SUBST(aros_debug_aflags)
1945 AC_SUBST(aros_debug_ldflags)
1946 AC_SUBST(aros_target_genmap)
1947 AC_SUBST(aros_target_strip_flags)
1949 # Graphics Related
1950 AC_SUBST(x11_hidd_target)
1951 AC_SUBST(sdl_hidd_target)
1953 AC_SUBST(aros_default_wbwidth)
1954 AC_SUBST(aros_default_wbheight)
1955 AC_SUBST(aros_default_wbdepth)
1956 AC_SUBST(DO_XSHM_SUPPORT)
1957 AC_SUBST(DO_VIDMODE_SUPPORT)
1959 AC_SUBST(aros_host_x11_includes)
1960 AC_SUBST(aros_host_x11_libdirs)
1961 AC_SUBST(aros_host_sdl_cflags)
1962 AC_SUBST(aros_host_sdl_libs)
1964 # Native version related
1965 AC_SUBST(aros_serial_debug)
1967 # Palm native version related
1968 AC_SUBST(aros_palm_debug_hack)
1970 # Unix/Hosted version related
1971 AC_SUBST(aros_nesting_supervisor)
1973 # Apple iOS related
1974 AC_SUBST(aros_ios_platform)
1975 AC_SUBST(aros_ios_version)
1976 AC_SUBST(aros_ios_sdk)
1978 # DBUS related
1979 AC_SUBST(ENABLE_DBUS)
1980 AC_SUBST(DBUS_CFLAGS)
1981 AC_SUBST(DBUS_LIBFLAGS)
1982 AC_SUBST(KERNEL_DBUS_KOBJ)
1983 AC_SUBST(KERNEL_DBUS_INCLUDES)
1985 #X11 related
1986 AC_SUBST(ENABLE_X11)
1988 # Debug related
1989 AC_SUBST(aros_debug)
1990 AC_SUBST(aros_mungwall_debug)
1991 AC_SUBST(aros_stack_debug)
1992 AC_SUBST(aros_modules_debug)
1994 # Collect-aros stuff: "-ius" to ignore undefined symbols
1995 AC_SUBST(ignore_undefined_symbols)
1997 # C compiler related
1998 AC_SUBST(gcc_target_cpu)
2000 dnl Prepare for output, make up all the generated patches
2001 case "$aros_flavour" in
2002 emulation)      aros_flavour_uc="AROS_FLAVOUR_EMULATION"
2003                 aros_flavour="emulation" ;;
2004 emulcompat)     aros_flavour_uc="(AROS_FLAVOUR_EMULATION|AROS_FLAVOUR_BINCOMPAT)"
2005                 aros_flavour="emulation" ;;
2006 standalone)     aros_flavour_uc="AROS_FLAVOUR_STANDALONE"
2007                 aros_flavour="standalone";;
2008 native)         aros_flavour_uc="AROS_FLAVOUR_NATIVE"
2009                 aros_flavour="native" ;;
2010 nativecompat)   aros_flavour_uc="(AROS_FLAVOUR_NATIVE|AROS_FLAVOUR_BINCOMPAT)"
2011                 aros_flavour="native" ;;
2012 linklib)        aros_flavour_uc="AROS_FLAVOUR_LINKLIB"
2013                 aros_flavour="linklib" ;;
2014 palmnative)     aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
2015                 aros_flavour="palmnative" ;;
2016 mac68knative)   aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
2017                 aros_flavour="mac68knative" ;;
2018 ppcnative)      aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_BINCOMPAT)"
2019                 aros_flavour="ppcnative" ;;
2020 esac
2022 if test ! -d ${aros_inc_dir} ; then
2023     ${MKDIR} ${aros_inc_dir}
2025 if test ! -d ${aros_geninc_dir} ; then
2026     ${MKDIR} ${aros_geninc_dir}
2028 if test ! -d ${aros_hostcfg_dir} ; then
2029     ${MKDIR} ${aros_hostcfg_dir}
2031 if test ! -d ${aros_targetcfg_dir} ; then
2032     ${MKDIR} ${aros_targetcfg_dir}
2034 if test ! -d ${aros_tools_dir} ; then
2035     ${MKDIR} ${aros_tools_dir}
2037 if test ! -d ${aros_scripts_dir} ; then
2038     ${MKDIR} ${aros_scripts_dir}
2041 AC_CONFIG_HEADERS(${aros_geninc_dir}/host-conf.h:config/host-conf.h.in)
2043 AC_CONFIG_COMMANDS([compiler_executable],
2044     [
2045         prefix=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}
2046         mkdir -p $prefix
2047         prefix="${prefix}/${aros_target_cpu}-aros"
2048         prefix2=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros
2050         echo ${prefix}
2051         echo ${prefix2}
2052         chmod a+x ${prefix2}-gcc ${prefix2}-ld
2054         ln -sf ${prefix2}-gcc          ${prefix}-gcc
2055         ln -sf ${prefix2}-ld           ${prefix}-ld
2057         ln -sf $aros_target_as_ln$aros_host_exe_suffix      ${prefix}-as
2058         ln -sf $aros_target_nm_ln$aros_host_exe_suffix      ${prefix}-nm
2059         ln -sf $aros_target_ar_ln$aros_host_exe_suffix      ${prefix}-ar
2060         ln -sf $aros_target_ranlib_ln$aros_host_exe_suffix  ${prefix}-ranlib
2061         ln -sf $aros_target_objcopy_ln$aros_host_exe_suffix ${prefix}-objcopy
2062         ln -sf $aros_target_objdump_ln$aros_host_exe_suffix ${prefix}-objdump
2063         ln -sf $aros_target_strip_ln$aros_host_exe_suffix   ${prefix}-strip
2065         ln -sf $aros_target_as_ln$aros_host_exe_suffix      ${prefix2}-as
2066         ln -sf $aros_target_nm_ln$aros_host_exe_suffix      ${prefix2}-nm
2067         ln -sf $aros_target_ar_ln$aros_host_exe_suffix      ${prefix2}-ar
2068         ln -sf $aros_target_ranlib_ln$aros_host_exe_suffix  ${prefix2}-ranlib
2069         ln -sf $aros_target_objcopy_ln$aros_host_exe_suffix ${prefix2}-objcopy
2070         ln -sf $aros_target_objdump_ln$aros_host_exe_suffix ${prefix2}-objdump
2071         ln -sf $aros_target_strip_ln$aros_host_exe_suffix   ${prefix2}-strip
2072     ],
2073     [
2074         aros_host_exe_suffix=${aros_host_exe_suffix}
2075         aros_tools_dir=${aros_tools_dir}
2076         aros_target_cpu=${aros_target_cpu}
2077         aros_target_arch=${aros_target_arch}
2078         aros_target_suffix=${aros_target_suffix}
2079         aros_target_nm_ln=${aros_target_nm_ln}
2080         aros_target_as_ln=${aros_target_as_ln}
2081         aros_target_ar_ln=${aros_target_ar_ln}
2082         aros_target_ranlib_ln=${aros_target_ranlib_ln}
2083         aros_target_objdump_ln=${aros_target_objdump_ln}
2084         aros_target_objcopy_ln=${aros_target_objcopy_ln}
2085         aros_target_strip_ln=${aros_target_strip_ln}
2086     ]
2088 AC_CONFIG_COMMANDS([genshared_executable],
2089     [chmod a+x ${aros_scripts_dir}/genshared],
2090     [aros_scripts_dir=${aros_scripts_dir}]
2092 AC_CONFIG_COMMANDS([genmf_executable],
2093     [chmod a+x ${aros_tools_dir}/genmf.py],
2094     [aros_tools_dir=${aros_tools_dir}]
2097 AC_CONFIG_FILES(
2098     Makefile
2099     config/make.cfg
2100     ${aros_inc_dir}/config.h:config/config.h.in
2101     ${aros_geninc_dir}/config.h:config/config.h.in
2102     ${aros_hostcfg_dir}/host.cfg:config/host.cfg.in
2103     ${aros_targetcfg_dir}/target.cfg:config/target.cfg.in
2104     mmake.config
2105     ${aros_targetcfg_dir}/make.defaults:config/make.defaults.in
2106     ${aros_targetcfg_dir}/specs:config/specs.in
2107     ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-gcc:scripts/aros-gcc.in
2108     ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-ld:scripts/aros-ld.in
2109     ${aros_scripts_dir}/genshared:compiler/c_lib/source/lib_source/genshared.in
2110     ${aros_tools_dir}/genmf.py:tools/genmf/genmf.py
2111     tools/collect-aros/env.h
2114 AC_OUTPUT
2116 dnl This is in order to not define SHARED_CFLAGS sometimes
2117 dnl We don't always do aros_shared_ar, aros_shared_cflags
2119 #XXX compatability...
2120 aros_shared_ar="$aros_shared_ld $aros_shared_ldflags -o"
2122 if test -n "$aros_shared_cflags" ; then
2123     echo "SHARED_CFLAGS := $aros_shared_cflags" >> ${aros_hostcfg_dir}/host.cfg
2124     echo "SHARED_AR := $aros_shared_ar" >> ${aros_hostcfg_dir}/host.cfg