disable stack protection via specs so that anything using this compiler (eg build_wit...
[cake.git] / configure.in
blobd9ded9679c88a9b0e765171f0754a92a315e4ce9
1 dnl Copyright © 1997-2006, 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.53)
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 TOPDIR=$PWD
49 # Parse the target field into something useful.
50 changequote(<<,>>)
51 target_os=`echo $target | sed 's/^\([^-]*\)-\(.*\)$/\1/'`
52 target_cpu=`echo $target | sed 's/^\([^-]*\)-\(.*\)$/\2/'`
53 changequote([,])
55 dnl --------------------------------------------------------------------
56 dnl Set the default Workbench resolution
57 dnl --------------------------------------------------------------------
58 aros_default_wbwidth=800
59 aros_default_wbheight=600
60 aros_default_wbdepth=4
62 dnl --------------------------------------------------------------------
63 dnl Host Configuration Section
64 dnl --------------------------------------------------------------------
65 dnl
66 dnl The idea here is to find out all the information we need about the
67 dnl host. This means things like tools for building directory structures,
68 dnl copying files around and the like.
70 # The first step is to find the host binaries.
71 # Check for a compiler.
72 AC_PROG_CC
73 AC_PROG_CC_STDC
74 AC_PROG_CPP
76 # Check for a compatible awk
77 AC_CHECK_PROGS(AWK,[gawk nawk])
78 AROS_REQUIRED(gawk,$AWK)
79 AROS_PROG(MMAKE,mmake)
81 # Perform some default variable assignments. Note all of these will be
82 # Regenerated from the script, so there is no need to cache them.
84 aros_host_cc="$CC"
85 AROS_TOOL_CCPATH(aros_host_ld,ld)
86 AROS_REQUIRED(ld,$aros_host_ld)
87 aros_host_make="make"
88 aros_host_cflags=$CFLAGS
89 aros_host_ldflags=$LDFLAGS
90 aros_host_debug="-g -O0"
91 aros_host_mkdep="\$(TOP)/scripts/mkdep"
92 aros_host_mkargs="--no-print-directory"
93 aros_host_incl="/usr/include"
94 aros_host_exe_suffix="$EXEEXT"
95 aros_host_lib_suffix=""
97 AC_CHECK_PROGS(aros_host_aclocal,[aclocal aclocal19])
98 AC_CHECK_PROGS(aros_host_autoconf,[autoconf autoconf259 autoconf253])
99 AC_CHECK_PROGS(aros_host_autoheader,[autoheader autoheader259 autoheader253])
100 AC_CHECK_PROGS(aros_host_automake,[automake automake19])
102 case "$aros_host_cc" in
103     *gcc*)
104         aros_host_cc_pipe="-pipe"
105         ;;
106     icc)
107         aros_host_cc_pipe=""
108         ;;
109     *)
110         aros_host_cc_pipe=""
111         ;;
112 esac
114 dnl Despite the name, this is really a host configuration variable.
115 aros_target_cc_includes=""
116 aros_target_cc_options=""
118 # This is the main host configuration section. It is where the host
119 # can change the values of any variables it needs to change. We do
120 # not look at anything that compiles to the target yet, we'll get
121 # to that later.
123 case "$host_os" in
124     linux*)
125         aros_host_arch="linux"
126         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
127         case "$host_cpu" in
128             *i?86*)
129                 aros_host_cpu="i386"
130                 ;;
131             *x86_64*)
132                 aros_host_cpu="x86_64"
133                 ;;
134             *m68k*)
135                 aros_host_cpu="m68k"
136                 ;;
137             *powerpc*)
138                 aros_host_cpu="ppc"
139                 ;;
140             *)
141                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
142                 aros_host_cpu="$host_cpu"
143                 ;;
144         esac
145         ;;
147     freebsd*)
148         aros_host_cc="$aros_host_cc $aros_host_cc_pipe -I/usr/local/include"
149         aros_host_make="gmake"
150         aros_host_arch="freebsd"
151         aros_host_cpu="i386"
153         aros_host_ldflags="$aros_host_ldflags -L/usr/local/lib -liconv"
155         dnl Need to override this here, it's just too hard later.
156         dnl This shouldn't be here at all...
157         dnl aros_target_cc_includes="/usr/include"
159         dnl FreeBSD 5.x (and later) has changed the default object format.
160         dnl The double [[]] is necessary to get around m4's quoting rules.
161         case $host_os in
162             freebsd[[234]]*)
163                 aros_object_format="elf_i386"
164                 ;;
166             *)
167                 aros_object_format="elf_i386_fbsd"
168                 ;;
169         esac
171         ;;
173     darwin*)
174         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
175         aros_host_arch="darwin"
176         case "$host_cpu" in
177             *i?86*)
178                 aros_host_cpu="i386"
179                 ;;
180             *powerpc*)
181                 aros_host_cpu="ppc"
182                 ;;
183             *)
184                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
185                 aros_host_cpu="$host_cpu"
186                 ;;
187         esac
189         aros_host_ldflags="$aros_host_ldflags -liconv"
191         ;;
193     netbsd*)
194         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
195         aros_host_make="gmake"
196         aros_host_arch="netbsd"
197         case "$host_cpu" in
198             *i?86*)
199                 aros_host_cpu="i386"
200                 ;;
201             *m68k*)
202                 aros_host_cpu="m68k"
203                 ;;
204             *)
205                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
206                 aros_host_cpu="$host_cpu"
207                 ;;
208         esac    
209         aros_host_lib_suffix=".0.0"
210         ;;
212     openbsd*)
213         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
214         aros_host_make="gmake"
215         aros_host_arch="openbsd"
216         case "$host_cpu" in
217             *i?86*)
218                 aros_host_cpu="i386"
219                 ;;
220             *)
221                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
222                 aros_host_cpu="$host_cpu"
223                 ;;
224         esac
225         ;;
226         
227     solaris*)
228         aros_host_arch="solaris"
229         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
230         case "$host_cpu" in
231             *sparc*)
232                 aros_host_cpu="sparc"
233                 ;;
234             *)
235                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
236                 aros_host_cpu="$host_cpu"
237                 ;;
238         esac
239         ;;
241     morphos*)
242         aros_host_arch="morphos"
243         aros_host_cpu="ppc"
244         ;;
246     amiga*)
247         aros_host_arch="amiga"
248         SORT="/gg/bin/sort"
249         TEST="/gg/bin/test"
250         UNIQ="/gg/bin/uniq"
251         FOR="for"
252         TOUCH="/gg/bin/touch"
253         case "$host_cpu" in
254             *m68k*)
255                 aros_host_cpu="m68k"
256                 ;;
257             *powerpc*)
258                 aros_host_cpu="ppc"
259                 ;;
260             *)
261                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
262                 aros_host_cpu="$host_cpu"
263                 ;;
264         esac
265         ;;
267     cygwin*)
268         aros_host_arch="cygwin"
269         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
270         case "$host_cpu" in
271             *i?86*)
272                 aros_host_cpu="i386"
273                 ;;
274             *)
275                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
276                 aros_host_cpu="$host_cpu"
277                 ;;
278         esac
279         ;;
280     *)
281         AC_MSG_ERROR([Unsupported host architecture $host])
282         ;;
283 esac
285 AROS_PROG(aros_host_ar,[ar],[cr])
286 AROS_REQUIRED(ar,$aros_host_ar)
287 AROS_PROG(aros_host_ranlib,ranlib)
288 AROS_REQUIRED(ranlib,$aros_host_ranlib)
289 AROS_PROG(aros_host_strip,strip)
290 AROS_REQUIRED(strip,$aros_host_strip)
292 AROS_PROG(RM,[rm],[-rf])
293 AROS_REQUIRED(rm,$RM)
294 AROS_PROG(CP,[cp])
295 AROS_REQUIRED(cp,$CP)
296 AROS_PROG(MV,[mv])
297 AROS_REQUIRED(mv,$MV)
298 AROS_PROG(ECHO,[echo])
299 AROS_REQUIRED(echo,$ECHO)
300 AROS_PROG(MKDIR,[mkdir],[-p])
301 AROS_REQUIRED(mkdir,$MKDIR)
302 AROS_PROG(TOUCH,[touch])
303 AROS_REQUIRED(touch,$TOUCH)
304 AROS_PROG(SORT,[sort])
305 AROS_REQUIRED(sort,$SORT)
306 AROS_PROG(UNIQ,[uniq])
307 AROS_REQUIRED(uniq,$UNIQ)
308 AROS_PROG(NOP,[true])
309 AROS_REQUIRED(true,$NOP)
310 AROS_PROG(CAT,[cat])
311 AROS_REQUIRED(cat,$CAT)
312 AROS_PROG(BISON,[bison])
313 AROS_REQUIRED(bison,$BISON)
314 AROS_PROG(FLEX,[flex])
315 AROS_REQUIRED(flex,$FLEX)
316 AROS_PROG(PNGTOPNM,[pngtopnm])
317 AROS_REQUIRED(pngtopnm,$PNGTOPNM)
318 AROS_PROG(PPMTOILBM,[ppmtoilbm])
319 AROS_REQUIRED(ppmtoilbm,$PPMTOILBM)
320 AROS_PROG(SED,[sed])
321 AROS_REQUIRED(sed,$SED)
322 AROS_PROG(CHMOD,[chmod])
323 AROS_REQUIRED(chmod,$CHMOD)
325 AM_PATH_PYTHON(2.2.1)
327 AC_SUBST(FOR, for)
328 AC_SUBST(IF, if)
329 AC_SUBST(TEST, test)
330 AC_SUBST(CMP, cmp)
332 dnl ---------------------------------------------------------------------------
333 dnl Look for things about the host system, good for hosted targets.
334 dnl ---------------------------------------------------------------------------
336 # Check for some includes for the X11 HIDD and the kernel
337 AC_CHECK_HEADERS([sys/ipc.h sys/shm.h \
338     sys/mmap.h sys/mman.h sysexits.h \
339     sys/statfs.h sys/statvfs.h sys/vfs.h sys/param.h \
342 AC_CHECK_HEADERS([sys/mount.h],,,[#include <sys/param.h>])
344 AC_HEADER_DIRENT
345 AC_HEADER_STAT
346 AC_HEADER_STDC
347 AC_HEADER_SYS_WAIT
348 AC_HEADER_TIME
349 AC_STRUCT_ST_BLKSIZE
350 AC_STRUCT_ST_BLOCKS
351 AC_STRUCT_ST_RDEV
352 AC_STRUCT_TM
353 AC_STRUCT_TIMEZONE
354 AC_TYPE_OFF_T
355 AC_TYPE_PID_T
356 AC_TYPE_SIZE_T
357 AC_TYPE_UID_T
359 AC_CHECK_MEMBERS(struct tm.tm_gmtoff)
361 # Look for some functions
362 AC_CHECK_FUNCS([getpagesize kqueue statfs statvfs \
363     clone kse_create rfork_thread thr_create sa_register \
364     getcontext makecontext setcontext sigaltstack swapcontext])
366 AC_FUNC_MMAP
369 dnl --------------------------------------------------------------------
370 dnl Target Configuration Section
371 dnl --------------------------------------------------------------------
373 dnl The target configuration section is responsible for setting up all
374 dnl the paths for includes, and tools required to build AROS to some
375 dnl particular target.
377 aros_config_cflags="-Wall -Werror-implicit-function-declaration"
378 aros_config_aflags="-Wall -x assembler-with-cpp -c"
379 aros_config_ldflags=""
381 aros_shared_default=yes
383 aros_shared_cflags="-fPIC"
384 aros_shared_aflags=""
385 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
386 aros_kernel_ldflags="-Wl,-rpath,./lib"
388 aros_target_ar_flags="cr"
389 aros_target_nm_flags="-C -ul"
390 aros_target_strip_flags="--strip-unneeded -R.comment"
392 aros_compiler_libs=
394 aros_target_genmap="-Wl,-Map -Xlinker"
396 # Native flavour stuff
397 aros_bochs_hack="0"
398 aros_serial_debug="0"
400 # Palm native flavour stuff
401 aros_palm_debug_hack="0"
403 # Unix flavour stuff
404 aros_nesting_supervisor="0"
406 # Collect-aros stuff: "-ius" to ignore undefined symbols
407 ignore_undefined_symbols=""
409 #-----------------------------------------------------------------------------
411 AC_MSG_CHECKING([whether ${CC} accepts -fno-stack-protector])
412 save_cflags="$CFLAGS"
413 CFLAGS="$CFLAGS -fno-stack-protector"
414 AC_TRY_COMPILE(,, use_no_stack_protector="yes", use_no_stack_protector="no")
415 AC_MSG_RESULT($use_no_stack_protector)
416 if test "x-$use_no_stack_protector" = "x-yes" ; then
417     aros_target_cc_options="-fno-stack-protector"
419 CFLAGS="$save_cflags"
421 #-----------------------------------------------------------------------------
423 AC_MSG_CHECKING([for type of build])
424 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")
426 if test "$build_type" = "nightly"; then
427     build_type_string="NIGHTLY"
428 elif test "$build_type" = "snapshot"; then
429     build_type_string="SNAPSHOT"
430 elif test "$build_type" = "milestone"; then
431     build_type_string="MILESTONE"
432 elif test "$build_type" = "release"; then
433     build_type_string="RELEASE"
434 else
435     build_type_string="PERSONAL"
436     build_type="personal"
439 aros_config_cflags="$aros_config_cflags -DAROS_BUILD_TYPE=AROS_BUILD_TYPE_$build_type_string"
441 AC_MSG_RESULT($build_type)
443 #-----------------------------------------------------------------------------
444 all_debug_types="messages stack mungwall modules symbols"
446 AC_MSG_CHECKING([which debug types to enable])
447 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)]),
448  debug="$enableval",debug="")
450 if test "$debug" = "" -o "$debug" = "no"; then
451     debug="none"
452 elif test "$debug" = "yes"; then
453     debug="all"
456 if test "$debug" = "all" ; then
457     debug=$all_debug_types
458     for d in $all_debug_types; do
459         export aros_${d}_debug="1"
460     done
461 else
462     for d in $all_debug_types; do
463         export aros_${d}_debug="0"
464     done
467 if test "$debug" != "none"; then
468     debug=`echo $debug | sed s/,/\ /g`
469     for d in $debug; do
470         found="0"
471         for d2 in $all_debug_types; do
472             if test "$d2" = "$d"; then
473                 found="1"
474                 break
475             fi
476         done
477         if test "$found" = "0"; then
478             AC_MSG_ERROR([unrecognized debug type "$d". Available types are: all none $all_debug_types])
479         fi
480         export aros_${d}_debug="1"
481     done
482     aros_debug="yes"
484 AC_MSG_RESULT($debug)
486 if test "$aros_messages_debug" = "1"; then
487     aros_messages_debug="-DADEBUG=1 -DMDEBUG=1"
488 else
489     aros_messages_debug=""
491 if test "$aros_symbols_debug" = "1"; then
492     aros_symbols_debug="-g"
493 else
494     aros_symbols_debug=""
497 # These are the flags to pass when compiling debugged programs
498 aros_debug_cflags="$aros_symbols_debug $aros_messages_debug"
499 aros_debug_aflags=""
500 aros_debug_ldflags="$aros_symbols_debug"
502 #-----------------------------------------------------------------------------
503 #   Checking for distcc and ccache.
505 #   Always apply the transforms in this particular order. Basically you should
506 #   always run 'ccache distcc compiler' in that order for the best performance.
508 AC_MSG_CHECKING([whether to enable distcc])
509 AC_ARG_ENABLE(distcc,AC_HELP_STRING([--enable-distcc],[Use distcc as a front end to the compiler (default=no).]),distcc="$enableval",distcc="no")
510 if test "$distcc" != "" -a "$distcc" != "no"; then
511     # AC_CHECK_PROG will print out the result in this case
512     AC_PATH_PROG(DISTCC,[distcc],distcc,)
513 else
514     AC_MSG_RESULT(no)
517 AC_MSG_CHECKING([whether to enable ccache])
518 AC_ARG_ENABLE(ccache,AC_HELP_STRING([--enable-ccache],[Use ccache as a front end to the compiler (default=no).]),ccache="$enableval",ccache="no")
519 if test "$ccache" != "" -a "$ccache" != "no"; then
520     # AC_CHECK_PROG will print out the result in this case
521     AC_CHECK_PROG(CCACHE,[ccache],ccache,)
522 else
523     AC_MSG_RESULT(no)
526 #-----------------------------------------------------------------------------
527 AC_MSG_CHECKING([what optimization flags to use])
528 AC_ARG_WITH(optimization,AC_HELP_STRING([--with-optimization=FLAGS],[Use optimization flags FLAGS (default=-O2).]),optimization="$withval",optimization="unknown")
529 if test "$optimization" = "unknown"; then
530     dnl default is -O2 for normal builds, -O0 for debug builds
531     if test "$debug" != "none"; then
532         optimization="-O0"
533     else
534         optimization="-O2"
535     fi
537 aros_config_cflags="$aros_config_cflags $optimization"
538 AC_MSG_RESULT($optimization)
540 #-----------------------------------------------------------------------------
541 AC_MSG_CHECKING([what target variant to enable])
542 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")
543 if test "$target_variant" = "none"; then
544     aros_target_variant=""
545     aros_target_suffix=""
546 else
547     aros_target_variant="$target_variant"
548     aros_target_suffix="-$target_variant"
550 AC_MSG_RESULT($enableval)
552 #-----------------------------------------------------------------------------
553 # This is the target configuration switch.
554 case "$target_os" in
555     linux*)
556         aros_target_arch="linux"
557         case "$target_cpu" in
558             *m68k*)
559                 aros_target_cpu="m68k"
560                 aros_object_format="m68kelf"
561                 aros_flavour="emulcompat"
562                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D__mc68000 -D__linux__"
563                 aros_shared_ldflags="-Wl,-T,\$(TOP)/config/linux/m68k/script.so"
564                 aros_kernel_ldflags="-Wl,-rpath,./lib,-T,\$(TOP)/config/linux/m68k/script.normal"
565                 gcc_target_cpu="mc68000"
566                 ;;
567             *i?86*)
568                 aros_target_cpu="i386"
569                 aros_object_format="elf_i386"
570                 aros_flavour="emulation"
571                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__linux__"
572                 aros_default_wbdepth=8
573                 gcc_target_cpu="i386"
574                 ;;
575             *x86_64*)
576                 aros_target_cpu="x86_64"
577                 aros_object_format="elf_x86_64"
578                 aros_flavour="emulation"
579                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64 -D__linux__"
580                 aros_default_wbdepth=8
581                 gcc_target_cpu="x86_64"
582                 ;;
583             *powerpc*)
584                 aros_target_cpu="ppc"
585                 aros_object_format="elf32ppc"
586                 aros_flavour="emulation"
587                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc -D__linux__"
588                 aros_default_wbdepth=8
589                 gcc_target_cpu="ppc"
590                 ;;
591             *)
592                 AC_MSG_ERROR("Unknown CPU for Linux -- $target_cpu")
593                 ;;
594         esac
595     ;;
597     pc)
598         aros_target_arch="pc"
599         aros_shared_default="no"
600         case "$target_cpu" in
601             *i?86*)
602                 aros_target_cpu="i386"
604                 dnl If somebody hasn't already set the target object
605                 dnl format, then use this value. Mostly to support
606                 dnl FreeBSD cross-compilation.
607                 dnl TODO: Remove when we always use our compiler.
609                 if test "$aros_object_format" = "" ; then
610                     aros_object_format="elf_i386"
611                 fi
612                 aros_flavour="standalone"
613                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
614                 aros_kernel_ldflags=""
615                 aros_default_wbwidth=640
616                 aros_default_wbheight=480
617                 gcc_target_cpu="i386"
618                 ;;
619             *x86_64*)
620                 aros_target_cpu="x86_64"
621                 if test "$aros_object_format" = "" ; then
622                     aros_object_format="elf_x86_64"
623                 fi
624                 aros_flavour="standalone"
625                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
626                 aros_config_cflags="$aros_config_cflags -fno-asynchronous-unwind-tables"
627                 aros_kernel_ldflags=""
628                 aros_default_wbwidth=640
629                 aros_default_wbheight=480
630                 gcc_target_cpu="x86_64"
631                 ;;
632             *)
633                 AC_MSG_ERROR("Unknown native CPU -- $target_cpu")
634                 ;;
635         esac
636         ;;
638     prep)
639         aros_target_arch="prep"
640         aros_shared_default="no"
641         aros_target_cpu="ppc"
642         aros_object_format="elf32ppc"
643         aros_flavour="ppcnative"
644         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
645         aros_kernel_ldflags=""
646         aros_default_wbwidth=640
647         aros_default_wbheight=480
648         gcc_target_cpu="ppc"
649         case "$target_cpu" in
650             *cross*)
651                 aros_target_cc="ppc-linux-gcc -pipe"
652                 aros_target_ld="ppc-linux-ld"
653                 aros_target_as="ppc-linux-as"
654                 aros_target_ar="ppc-linux-ar"
655                 aros_target_ranlib="ppc-linux-ranlib"
656                 aros_target_nm="ppc-linux-nm"
657                 aros_target_strip="ppc-linux-strip"
658                 aros_target_objcopy="ppc-linux-objcopy"
659                 aros_target_objdump="ppc-linux-objdump"
660                 aros_shared_ld="ppc-linux-ld"
661                 aros_kernel_ld="ppc-linux-ld"
662                 ;;
663             *)
664                 ;;
665         esac
666         ;;
668     freebsd*)
669         aros_target_arch="freebsd"
670         aros_target_cpu="i386"
671         aros_flavour="emulation"
672         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
673         gcc_target_cpu="i386"
675         aros_target_strip_flags="-x"
676         ;;
678     darwin*)
679         aros_target_arch="darwin"
680         aros_target_cpu="i386"
681         aros_flavour="emulation"
682         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
683         gcc_target_cpu="i386"
685         aros_target_strip_flags="-x"
686         ;;
688     netbsd*)
689         aros_target_arch="netbsd"
690         case "$target_cpu" in
691             *m68k*)
692                 aros_target_cpu="m68k"
693                 aros_object_format="m68kelf"
694                 aros_flavour="emulcompat"
695                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D__mc68000 -D__NetBSD__"
696                 gcc_target_cpu="mc68000"
697                 ;;
698             *i?86*)
699                 aros_target_cpu="i386"
700                 aros_object_format="elf_i386"
701                 aros_flavour="emulation"
702                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__NetBSD__"
703                 aros_default_wbdepth=8
704                 gcc_target_cpu="i386"
705                 ;;
706             *)
707                 AC_MSG_ERROR("Unknown CPU for NetBSD -- $target_cpu")
708                 ;;
709         esac
710         aros_target_genmap="-Wl,-M -Xlinker >"
711         aros_flavour="emulation"
712         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
713         ;;   
715     openbsd*)
716         aros_target_arch="openbsd"
717         case "$target_cpu" in
718             *i?86*)
719                 aros_target_cpu="i386"
720                 aros_object_format="elf_i386"
721                 aros_flavour="emulation"
722                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__OpenBSD__"
723                 gcc_target_cpu="i386"
724                 ;;
725             *)
726                 AC_MSG_ERROR("Unknown CPU for OpenBSD -- $target_cpu")
727                 ;;
728         esac
729         aros_target_genmap="-Wl,-M -Xlinker >"
730         aros_target_nm_flags="-u"
731         aros_flavour="emulation"
732         ;;
734     solaris*)
735         aros_target_arch="solaris"
736         case "$target_cpu" in
737             *sparc*)
738                 aros_target_cpu="sparc"
739                 aros_object_format="elf_sparc"
740                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dsparc -D__Solaris__"
741                 gcc_target_cpu="sparc"
742                 ;;
743             *)
744                 AC_MSG_ERROR("Unknown CPU for Solaris -- $target_cpu")
745                 ;;
746         esac
747         aros_config_cflags="$aros_config_cflags -D$aros_target_cpu"
748         aros_flavour="emulation"
749         ;;
751     morphos*)
752         aros_target_arch="morphos"
753         aros_shared_default="no"
754         aros_target_cpu="ppc"
755         aros_object_format="elf_ppc"
756         aros_flavour="nativecompat"
757         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
758         gcc_target_cpu="ppc"
759         ;;
761     amiga*)
762         aros_target_arch="amiga"
763         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D_AMIGA -DAMIGA"
764         aros_shared_default="no"
766         aros_config_cflags="$aros_config_cflags -fomit-frame-pointer -fbuiltin -ffreestanding"
768         case "$target_cpu" in
769             *m68k*)
770                 aros_target_cpu="m68k"
771                 aros_object_format="m68kelf"
772                 aros_flavour="nativecompat"
773                 gcc_target_cpu="mc68000"
774                 ;;
775             *ppc*)
776                 aros_cpu="ppc"
777                 aros_flavour="native"
778                 gcc_target_cpu="ppc"
779                 ;;
780             *)
781                 AC_MSG_ERROR("Unknown CPU for Amiga $target_cpu")
782                 ;;
783         esac
784         ;;
786     cygwin*)
787         aros_target_arch="cygwin"
788         aros_shared_default="no"
789         case "$target_cpu" in
790             *i?86*)
791                 aros_target_cpu="i386"
792                 aros_object_format="elf_i386"
793                 aros_flavour="emulation"
794                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__CYGWIN32__"
795                 aros_shared_cflags=""
796                 aros_default_wbdepth=8
797                 gcc_target_cpu="i386"
798                 ;;
799             *)
800                 AC_MSG_ERROR("Unknown CPU for CygWin -- $target_cpu")
801                 ;;
802         esac
803     ;;
804     pp*)
805         aros_target_arch="pp"
806         aros_shared_default="no"
807         case "$target_cpu" in
808             *m68k*)
809                 aros_target_cpu="m68k"
810                 aros_object_format="m68kelf"
811                 aros_flavour="palmnative"
812                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
813                 aros_kernel_ldflags=""
814                 aros_default_wbwidth=160
815                 aros_default_wbheight=160
816                 aros_default_wbdepth=1
817                 aros_target_cc="m68k-elf-gcc -pipe"
818                 aros_target_ld="$(which m68k-elf-ld)"
819                 aros_target_as="m68k-elf-gcc -pipe"
820                 aros_shared_ld="m68k-elf-gcc"
821                 aros_kernel_ld="m68k-elf-gcc"
822                 aros_target_ar="m68k-elf-ar"
823                 aros_target_ar_flags="cru"
824                 aros_target_ranlib="m68k-elf-ranlib"
825                 aros_target_nm="m68k-elf-nm"
826                 aros_target_objcopy="m68k-elf-objcopy"
827                 aros_target_objdump="m68k-elf-objdump"
828                 aros_compiler_libs="-lgcc1"
829                 aros_shared_default=no
830                 aros_shared_cflags="-fpic"
831                 aros_shared_aflags=""
832                 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
833                 aros_kernel_ldflags="-Wl,-rpath,./lib"
834                 aros_debug_cflags="-Wall -Werror-implicit-function-declaration $aros_symbols_debug  $aros_messages_debug -mc68000 -Wa,-mc68000"
835                 aros_debug_aflags=""
836                 aros_debug_ldflags="$aros_symbols_debug"
837                 aros_mungwall_debug="0"
838                 aros_modules_debug="0"
839                 gcc_target_cpu="mc68000"
840                 ignore_undefined_symbols="-ius"
841                 ;;
842            *)
843                 AC_MSG_ERROR("Unknown CPU for PalmPilot -- $target_cpu")
844                 ;;
845         esac
846         ;;
848     mac*)
849         aros_target_arch="mac"
850         aros_shared_default="no"
851         case "$target_cpu" in
852             *m68k*)
853                 aros_target_cpu="m68k"
854                 aros_object_format="m68kelf"
855                 aros_flavour="mac68knative"
856                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
857                 aros_default_wbwidth=512
858                 aros_default_wbheight=384
859                 aros_default_wbdepth=8
860                 aros_target_cc="m68k-elf-gcc -pipe"
861                 aros_target_ld="$(which m68k-elf-ld)"
862                 aros_target_as="m68k-elf-gcc -pipe"
863                 aros_shared_ld="m68k-elf-gcc"
864                 aros_kernel_ld="m68k-elf-gcc"
865                 aros_target_ar="m68k-elf-ar"
866                 aros_target_ar_flags="cru"
867                 aros_target_ranlib="m68k-elf-ranlib"
868                 aros_target_nm="m68k-elf-nm"
869                 aros_target_objcopy="m68k-elf-objcopy"
870                 aros_target_objdump="m68k-elf-objdump"
871                 aros_compiler_libs="-lgcc1"
872                 aros_shared_default=no
873                 aros_shared_cflags="-fpic"
874                 aros_shared_aflags=""
875                 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
876                 aros_kernel_ldflags="-Wl,-rpath,./lib"
877                 aros_debug_cflags="-Wall -Werror-implicit-function-declaration $aros_symbols_debug  $aros_messages_debug -mc68000"
878                 aros_debug_aflags=""
879                 aros_debug_ldflags="$aros_symbols_debug"
880                 aros_mungwall_debug="0"
881                 aros_modules_debug="0"
882                 gcc_target_cpu="mc68000"
883                 ignore_undefined_symbols="-ius"
884                 ;;
885            *)
886                 AC_MSG_ERROR("Unknown CPU for Mac68k -- $target_cpu")
887                 ;;
888         esac
889         ;;
891     *)
892         AC_MSG_ERROR([Unsupported target architecture $target])
893         ;;
894 esac
897 # Find out if we are cross-compiling (ie. if we can't use the host compiler
898 # for target code)
899 cross_compiling=no
900 if test "$aros_host_cpu" != "$aros_target_cpu" ; then
901     cross_compiling=yes
903 if test "$aros_host_arch" == "darwin" ; then
904     cross_compiling=yes
907 # Set prefix for target compiler etc. if we're cross-compiling
908 # (should possibly be earlier but needs to be after AC_PROG_CC)
909 if test "$cross_compiling" = "yes" ; then
910     target_tool_prefix=${target_cpu}-elf-
911     CC=${target_tool_prefix}gcc
914 # Find all the tools we need to compile. This could be cross-compiling
915 # though! If that is the case we use the GNU form of the target and
916 # simply add this to the front of the binary name. This is rather simple,
917 # but it should work under most circumstances.
919 # The default tools are to use the same as the host, but only if the
920 # host and target CPU are the same. With GCC this is normally enough.
923 aros_cc_pre=""
924 aros_shared_ld="$aros_host_ld"
926 aros_target_mkdep="$aros_host_mkdep"
927 aros_target_incl_def="$aros_host_incl"
929 AC_PATH_PROG(aros_kernel_cc,$CC)
931 # The default tools executables to be linked to.
932 AROS_TOOL_TARGET(aros_target_as_ln,as)
933 AROS_REQUIRED(as,$aros_target_as_ln)
934 AROS_TOOL_TARGET(aros_kernel_ld,ld)
935 AROS_REQUIRED(ld,$aros_kernel_ld)
936 AROS_TOOL_TARGET(aros_target_ar_ln,ar)
937 AROS_REQUIRED(ar,$aros_target_ar_ln)
938 AROS_TOOL_TARGET(aros_target_nm_ln,nm)
939 AROS_REQUIRED(nm,$aros_target_nm_ln)
940 AROS_TOOL_TARGET(aros_target_objcopy_ln,objcopy)
941 AROS_REQUIRED(objcopy,$aros_target_objcopy_ln)
942 AROS_TOOL_TARGET(aros_target_objdump_ln,objdump)
943 AROS_REQUIRED(objdump,$aros_target_objdump_ln)
944 AROS_TOOL_TARGET(aros_target_ranlib_ln,ranlib)
945 AROS_REQUIRED(ranlib,$aros_target_ranlib_ln)
946 AROS_TOOL_TARGET(aros_target_strip_ln,strip)
947 AROS_REQUIRED(strip,$aros_target_strip_ln)
949 if test "$GCC" = "yes"; then
950     aros_target_cc_path=`$aros_kernel_cc -print-search-dirs | grep "programs: =" | cut -c 12-`
953 aros_hostcfg_dir="bin/${aros_host_arch}-${aros_host_cpu}/gen/config"
954 aros_targetcfg_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/config"
955 aros_inc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/AROS/Development/include/aros"
956 aros_gendir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen"
957 aros_geninc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/include/aros"
958 aros_tools_dir="bin/${aros_host_arch}-${aros_host_cpu}/tools"
959 aros_scripts_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/scripts"
961 # aros_cc_pre is a variable that is added to the front of the compiler name
962 # in the generated aros-gcc shell script. We need this to enable the cache
963 # to work across cleaned builds. Also, support DISTCC using the correct
964 # environment variable.
967 if test "x${DISTCC}" != "x" ; then
968     if test "x${CCACHE}" != "x" ; then
969         aros_cc_pre="env CCACHE_PREFIX=${DISTCC} ${CCACHE} "
970     else
971         aros_cc_pre="${DISTCC} "
972     fi
973 else
974     if test "x${CCACHE}" != "x" ; then
975         aros_cc_pre="${CCACHE} "
976     fi
979 prefix="${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros"
981 AC_SUBST(aros_target_nostdinc_cflags,-nostdinc)
982 AC_SUBST(aros_target_nostartup_ldflags,-nostartfiles)
983 AC_SUBST(aros_target_nix_ldflags,-nix)
984 AC_SUBST(aros_target_detach_ldflags,-detach)
985 AC_SUBST(aros_target_nostdlib_ldflags,-nostdlib)
987 # Target tools
988 aros_target_cc="${prefix}-gcc"
989 aros_target_as="${prefix}-as"
990 aros_target_ld="${prefix}-ld"
991 aros_target_ar="${prefix}-ar $aros_target_ar_flags"
992 aros_target_objcopy=${prefix}-objcopy
993 aros_target_objdump=${prefix}-objdump
994 aros_target_ranlib="${prefix}-ranlib $aros_target_ranlib_flags"
995 aros_target_nm="${prefix}-nm $aros_target_nm_flags"
996 aros_kernel_nm="${prefix}-nm"
997 aros_target_strip=${prefix}-strip
1000 # Find the system include path. We can suggest that an alternative is
1001 # used if we don't get it correct. The default is to use /usr/include.
1002 # Which is set in the aros_target_incl_def variable.
1004 AC_ARG_ENABLE(includes,
1005 AC_HELP_STRING([--enable-includes=dir],[Alternative system include directory]),
1006 [aros_target_incl=$enable_includes], [aros_target_incl=$aros_target_incl_def])
1008 dnl find out about the target cc's include path
1009 AC_MSG_CHECKING([for the target compiler's include path])
1010 if test "$aros_target_cc_includes" = "" ; then
1011     #try to guess where the directory is
1012     aros_target_cc_includes=`dirname \`${aros_kernel_cc} -print-libgcc-file-name\``/include
1013     if ! test -d $aros_target_cc_includes; then
1014         #the directory doesn't exist, we need to do some more work
1015         aros_target_cc_includes=${PWD}/${aros_gendir}/cc_include
1016         
1017         #these are the headers we're looling for
1018         headers="limits.h mmintrin.h stdbool.h syslimits.h float.h \
1019                  stddef.h xmmintrin.h iso646.h stdarg.h unwind.h   \
1020                  zutil.h"
1022         dirs=
1023         for h in $headers; do
1024             #which other headers each of the above headers needs?
1025             deps=$(echo "#include <$h>" | \
1026                    $aros_host_cc -E -M - 2>/dev/null | \
1027                    sed 's/^.*://; s/\\$/ /g; s/[[ \t]]\+/ /g')
1028             
1029             #copy all the needed headers to a directory beneath gendir
1030             for d in $deps; do
1031                 h=$(basename $d)
1032                 dir=${aros_target_cc_includes}$(echo $(dirname $d) | \
1033                                                 sed -n "s,^.*/include\(/.*\),\1,p")
1034                 ! test -d $dir && mkdir -p $dir
1035                 ! test -f $dir/$h && { cp $d $dir; chmod u+w $dir/$h; }
1036             done
1037         done        
1038     fi
1040 AC_MSG_RESULT($aros_target_cc_includes)
1042 dnl Check if user specified --with-resolution=XRESxYRESxDEPTH
1043 AC_MSG_CHECKING([for default resolution of WBScreen])
1044 AC_ARG_WITH(resolution,AC_HELP_STRING([--with-resolution=XRESxYRESxDEPTH],[Default resolution of the initial WorkbenchScreen]),resolution=$withval,resolution=none)
1045 # We require an argument, so map --with/--without ("yes"/"no") to "none" specified
1046 if test "$resolution" = "yes" ; then
1047     resolution="none"
1049 if test "$resolution" = "no" ; then
1050     resolution="none"
1052 if test "$resolution" != "none" ; then
1053     aros_default_wbwidth=`echo $resolution | cut -d'x' -f1`
1054     aros_default_wbheight=`echo $resolution | cut -d'x' -f2`
1055     aros_default_wbdepth=`echo $resolution | cut -d'x' -f3`
1057 AC_MSG_RESULT($aros_default_wbwidth x $aros_default_wbheight x $aros_default_wbdepth)
1058 aros_cv_default_wbwidth=$aros_default_wbwidth
1059 aros_cv_default_wbheight=$aros_default_wbheight
1060 aros_cv_default_wbdepth=$aros_default_wbdepth
1062 dnl See if the user wants the BOCHS hack for native flavour
1063 AC_MSG_CHECKING([if bochs hack is enabled])
1064 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")
1065 if test "$bochs_hack" = "yes" ; then
1066     aros_bochs_hack="1"
1068 AC_MSG_RESULT($bochs_hack)
1070 dnl See if the user wants the serial debug output for native flavour
1071 AC_MSG_CHECKING([if serial debug is enabled])
1072 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)
1073 if test "$serial_debug" = "yes" ; then
1074     serial_debug="2"
1076 if test "$serial_debug" = "no" ; then
1077     serial_debug="none"
1079 if test "$serial_debug" != "none" ; then
1080     aros_serial_debug=$serial_debug
1081     AC_MSG_RESULT(on port $serial_debug)
1082 else
1083     AC_MSG_RESULT(no)
1086 dnl See if the user wants the palm debug output hack for palm native flavour
1087 AC_MSG_CHECKING([if palm debug hack is enabled])
1088 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")
1089 if test "$palm_debug_hack" = "yes" ; then
1090     aros_palm_debug_hack="1"
1092 AC_MSG_RESULT($palm_debug_hack)
1095 dnl See if the user wants nesting supervisor activated for unix flavour
1096 AC_MSG_CHECKING([if nesting supervisor support is enabled])
1097 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")
1098 if test "$nesting_supervisor" = "yes" ; then
1099     aros_nesting_supervisor="1"
1101 AC_MSG_RESULT($nesting_supervisor)
1104 dnl things specifically required for hosted flavours
1105 if test "x-$aros_flavour" = "x-emulation" -o "x-$aros_flavour" = "x-emulcompat" ; then
1107     dnl some kind of dynamic library access system is required for hostlib.resource
1108     AC_CHECK_FUNC(dlopen, have_dl="yes", have_dl="no")
1109     if test "x-$have_dl" = "x-no" ; then
1110         AC_CHECK_LIB(dl, dlopen, [have_dl="yes"
1111                                   aros_host_ldflags="$aros_host_ldflags -ldl"],
1112                                  have_dl="no")
1113     fi
1114     if test "x-$have_dl" = "x-no" ; then
1115          AC_MSG_ERROR([dlopen() dynamic linker functions not available])
1116     fi
1119     dnl x11 hidd
1120     AC_ARG_ENABLE(x11_hidd, AC_HELP_STRING([--enable-x11-hidd],
1121                                            [build X11 hidd for hosted (default=auto)]),
1122                                            x11_hidd="$enableval",
1123                                            x11_hidd="auto")
1124     case "x-$x11_hidd" in
1125         x-yes|x-no|x-auto)                 ;;
1126         *)                 x11_hidd="auto" ;;
1127     esac
1129     dnl they want it
1130     if test "x-$x11_hidd" != "x-no" ; then
1132         dnl find x11 stuff
1133         AC_PATH_X
1135         if test "x-$no_x" = "x-yes" ; then
1137             dnl didn't find it
1138             if test "x-$x11_hidd" != "x-auto" ; then
1139                 dnl and they explicitly asked for it, bail out
1140                 AC_MSG_ERROR([X11 libs/headers not found, cannot build X11 hidd as requested])
1141             fi
1142         
1143         else
1144             dnl found it, setup the metatarget
1145             x11_hidd_target=kernel-x11gfx
1148             dnl setup shared memory extensions
1149             AC_ARG_ENABLE(x11_shm, AC_HELP_STRING([--enable-x11-shm],
1150                                                   [use X11 shared memory (default=auto)]),
1151                                                   x11_hidd_shm="$enableval",
1152                                                   x11_hidd_shm="auto")
1153             case "x-$x11_hidd_shm" in
1154                 x-yes|x-no|x-auto)                     ;;
1155                 *)                 x11_hidd_shm="auto" ;;
1156             esac
1158             have_xshm=no
1160             dnl they want it
1161             if test "x-$x11_hidd_shm" != "x-no" ; then
1163                 dnl system shm headers
1164                 AC_CHECK_HEADERS(sys/ipc.h)
1165                 AC_CHECK_HEADERS(sys/shm.h)
1167                 dnl got them
1168                 if test "x-$ac_cv_header_sys_ipc_h" = "x-yes" -a "x-$ac_cv_header_sys_shm_h" = "x-yes" ; then
1170                     dnl make sure X libs have shm functions
1171                     save_libs="$LIBS"
1172                     save_cflags="$CFLAGS"
1173                     LIBS="$x_libraries"
1174                     CFLAGS="$x_includes"
1175                     AC_CHECK_LIB(Xext, XShmQueryExtension, have_xshm=yes)
1176                     LIBS="$save_libs"
1177                     CFLAGS="$save_cflags"
1178                 fi
1179             fi
1181             dnl detection done, prepare output
1182             if test "x-$have_xshm" = "x-yes" ; then
1183                 dnl we can do shm
1184                 DO_XSHM_SUPPORT="1"
1185             elif test "x-$x11_hidd_shm" = "x-yes" ; then
1186                 dnl they explicitly asked for it, but we can't do it
1187                 AC_MSG_ERROR([X11 has no support for shared memory, cannot enable it as requested])
1188             else
1189                 dnl otherwise just disable it
1190                 DO_XSHM_SUPPORT="0"
1191             fi
1193             
1194             dnl setup vidmode (fullscreen) extensions
1195             AC_ARG_ENABLE(x11_vidmode, AC_HELP_STRING([--enable-x11-vidmode],
1196                                                       [use X11 vidmode extension (default=auto)]),
1197                                                       x11_hidd_vidmode="$enableval",
1198                                                       x11_hidd_vidmode="auto")
1199             case "x-$x11_hidd_vidmode" in
1200                 x-yes|x-no|x-auto)                         ;;
1201                 *)                 x11_hidd_vidmode="auto" ;;
1202             esac
1204             have_vidmode=no
1206             dnl they want it
1207             if test "x-$x11_hidd_vidmode" != "x-no" ; then
1209                 dnl make sure X libs have vidmode functions
1210                 save_libs="$LIBS"
1211                 save_cflags="$CFLAGS"
1212                 LIBS="$x_libraries"
1213                 CFLAGS="$x_includes"
1214                 AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryExtension, have_vidmode=yes)
1215                 LIBS="$save_libs"
1216                 CFLAGS="$save_cflags"
1217             fi
1219             dnl detection done, prepare output
1220             if test "x-$have_vidmode" = "x-yes" ; then
1221                 dnl we can do vidmode
1222                 DO_VIDMODE_SUPPORT="1"
1223             elif test "x-$x11_hidd_vidmode" = "x-yes" ; then
1224                 dnl they explicitly asked for it, but we can't do it
1225                 AC_MSG_ERROR([X11 vidmode extension not available, cannot enable it as requested])
1226             else
1227                 dnl otherwise just disable it
1228                 DO_VIDMODE_SUPPORT="0"
1229             fi
1230         fi
1232     fi
1235     dnl sdl hidd
1236     AC_ARG_ENABLE(sdl_hidd, AC_HELP_STRING([--enable-sdl-hidd],
1237                                            [build SDL hidd for hosted (default=auto)]),
1238                                            sdl_hidd="$enableval",
1239                                            sdl_hidd="auto")
1240     case "x-$sdl_hidd" in
1241         x-yes|x-no|x-auto)                 ;;
1242         *)                 sdl_hidd="auto" ;;
1243     esac
1245     dnl they want it
1246     if test "x-$sdl_hidd" != "x-no" ; then
1248         dnl find sdl
1249         AM_PATH_SDL([1.2.10], have_sdl="yes", have_sdl="no")
1251         if test "x-$have_sdl" != "x-yes" ; then
1253             dnl didn't find it
1254             if test "x-$sdl_hidd" != "x-auto" ; then
1255                 dnl and they explicitly asked for it, bail out
1256                 AC_MSG_ERROR([SDL libs/headers not found, cannot build SDL hidd as requested])
1257             fi
1259         else
1260             dnl found it, setup the metatarget
1261             sdl_hidd_target=kernel-hidd-sdl
1262         fi
1263     fi
1268 dnl See if the user wants dbus.library
1269 AC_MSG_CHECKING([if building of dbus.library is enabled])
1270 AC_ARG_ENABLE(dbus,AC_HELP_STRING([--enable-dbus],[Enable DBUS support via dbus.library (default=no)]),dbus="yes",dbus="no")
1271 if test "$dbus" = "yes" ; then
1272     ENABLE_DBUS=1
1273     DBUS_CFLAGS=`pkg-config --cflags dbus-1`
1274     DBUS_LIBFLAGS=`pkg-config --libs dbus-1`
1275     KERNEL_DBUS_KOBJ=kernel-dbus-kobj
1276     KERNEL_DBUS_INCLUDES=kernel-dbus-includes
1277 else
1278     ENABLE_DBUS=0
1280 AC_MSG_RESULT($dbus)
1283 dnl --------------------------------------------------------------------
1284 dnl Configuration Output Section
1285 dnl --------------------------------------------------------------------
1287 # Generic
1288 AC_SUBST(aros_arch)
1289 AC_SUBST(aros_cpu)
1290 AC_SUBST(aros_flavour)
1291 AC_SUBST(aros_flavour_uc)
1292 AC_SUBST(TOPDIR)
1294 # Host related
1295 AC_SUBST(aros_cc_pre)
1296 AC_SUBST(aros_host_strip)
1297 AC_SUBST(aros_host_arch)
1298 AC_SUBST(aros_host_cpu)
1299 AC_SUBST(aros_host_cc)
1300 AC_SUBST(aros_host_ar)
1301 AC_SUBST(aros_host_ranlib)
1302 AC_SUBST(aros_host_ld)
1303 AC_SUBST(aros_host_make)
1304 AC_SUBST(aros_host_cflags)
1305 AC_SUBST(aros_host_ldflags)
1306 AC_SUBST(aros_host_debug)
1307 AC_SUBST(aros_host_mkdep)
1308 AC_SUBST(aros_host_mkargs)
1309 AC_SUBST(aros_host_exe_suffix)
1310 AC_SUBST(aros_host_lib_suffix)
1311 AC_SUBST(aros_tools_dir)
1312 AC_SUBST(aros_host_aclocal)
1313 AC_SUBST(aros_host_autoconf)
1314 AC_SUBST(aros_host_autoheader)
1315 AC_SUBST(aros_host_automake)
1317 # Target Related
1318 AC_SUBST(aros_target_arch)
1319 AC_SUBST(aros_target_cpu)
1320 AC_SUBST(aros_target_variant)
1321 AC_SUBST(aros_target_suffix)
1322 AC_SUBST(aros_target_incl)
1323 AC_SUBST(aros_target_ar)
1324 AC_SUBST(aros_target_ranlib)
1325 AC_SUBST(aros_kernel_nm)
1326 AC_SUBST(aros_target_cc)
1327 AC_SUBST(aros_kernel_cc)
1328 AC_SUBST(aros_target_as)
1329 AC_SUBST(aros_target_ld)
1330 AC_SUBST(aros_kernel_ld)
1331 AC_SUBST(aros_target_cc_includes)
1332 AC_SUBST(aros_target_cc_options)
1333 AC_SUBST(aros_target_cc_path)
1334 AC_SUBST(aros_target_objdump)
1335 AC_SUBST(aros_target_objcopy)
1336 AC_SUBST(aros_target_strip)
1337 AC_SUBST(aros_target_nm)
1338 AC_SUBST(aros_shared_default)
1339 AC_SUBST(aros_shared_ld)
1340 AC_SUBST(aros_object_format)
1341 AC_SUBST(aros_compiler_libs)
1343 AC_SUBST(aros_config_cflags)
1344 AC_SUBST(aros_config_aflags)
1345 AC_SUBST(aros_config_ldflags)
1347 AC_SUBST(aros_shared_cflags)
1348 AC_SUBST(aros_shared_aflags)
1349 AC_SUBST(aros_shared_ldflags)
1350 AC_SUBST(aros_kernel_ldflags)
1351 AC_SUBST(aros_debug_cflags)
1352 AC_SUBST(aros_debug_aflags)
1353 AC_SUBST(aros_debug_ldflags)
1354 AC_SUBST(aros_target_genmap)
1355 AC_SUBST(aros_target_strip_flags)
1357 # Graphics Related
1358 AC_SUBST(aros_gui_libdir)
1359 AC_SUBST(aros_gui_ldflags)
1360 AC_SUBST(aros_gui_libflags)
1361 AC_SUBST(aros_gui_incdir)
1362 AC_SUBST(aros_gui_ccflags)
1364 AC_SUBST(x11_hidd_target)
1365 AC_SUBST(sdl_hidd_target)
1367 AC_SUBST(aros_default_wbwidth)
1368 AC_SUBST(aros_default_wbheight)
1369 AC_SUBST(aros_default_wbdepth)
1370 AC_SUBST(DO_XSHM_SUPPORT)
1371 AC_SUBST(DO_VIDMODE_SUPPORT)
1373 # Native version related
1374 AC_SUBST(aros_bochs_hack)
1375 AC_SUBST(aros_serial_debug)
1377 # Palm native version related
1378 AC_SUBST(aros_palm_debug_hack)
1380 # Unix/Hosted version related
1381 AC_SUBST(aros_nesting_supervisor)
1383 # DBUS related
1384 AC_SUBST(ENABLE_DBUS)
1385 AC_SUBST(DBUS_CFLAGS)
1386 AC_SUBST(DBUS_LIBFLAGS)
1387 AC_SUBST(KERNEL_DBUS_KOBJ)
1388 AC_SUBST(KERNEL_DBUS_INCLUDES)
1390 # Debug related
1391 AC_SUBST(aros_debug)
1392 AC_SUBST(aros_mungwall_debug)
1393 AC_SUBST(aros_stack_debug)
1394 AC_SUBST(aros_modules_debug)
1396 # Collect-aros stuff: "-ius" to ignore undefined symbols
1397 AC_SUBST(ignore_undefined_symbols)
1399 # C compiler related
1400 AC_SUBST(gcc_target_cpu)
1402 dnl Prepare for output, make up all the generated patches
1403 case "$aros_flavour" in
1404 emulation)      aros_flavour_uc="AROS_FLAVOUR_EMULATION"
1405                 aros_flavour="emulation" ;;
1406 emulcompat)     aros_flavour_uc="(AROS_FLAVOUR_EMULATION|AROS_FLAVOUR_BINCOMPAT)"
1407                 aros_flavour="emulation" ;;
1408 standalone)     aros_flavour_uc="AROS_FLAVOUR_STANDALONE"
1409                 aros_flavour="standalone";;
1410 native)         aros_flavour_uc="AROS_FLAVOUR_NATIVE"
1411                 aros_flavour="native" ;;
1412 nativecompat)   aros_flavour_uc="(AROS_FLAVOUR_NATIVE|AROS_FLAVOUR_BINCOMPAT)"
1413                 aros_flavour="native" ;;
1414 linklib)        aros_flavour_uc="AROS_FLAVOUR_LINKLIB"
1415                 aros_flavour="linklib" ;;
1416 palmnative)     aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
1417                 aros_flavour="palmnative" ;;
1418 mac68knative)   aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
1419                 aros_flavour="mac68knative" ;;
1420 ppcnative)      aros_flavour_uc="(AROS_FLAVOUR_NATIVE|AROS_FLAVOUR_BINCOMPAT)"
1421                 aros_flavour="ppcnative" ;;
1422 esac
1424 dnl XXX I guess this is some legacy stuff, since aros_gui_basedir isn't
1425 dnl defined anywhere
1427 dnl if test -z "$aros_gui_basedir" ; then
1428 dnl 
1429 dnl         aros_gui_incdir="$x_includes"
1430 dnl         if test -z "$x_includes" ; then
1431 dnl             aros_gui_ccflags=""
1432 dnl         else
1433 dnl             aros_gui_ccflags="-I $x_includes"
1434 dnl         fi
1435 dnl     fi
1436 dnl 
1437 dnl else
1438 dnl     if test -n "$aros_gui_basedir" ; then
1439 dnl     aros_gui_libdir="${aros_gui_basedir}/lib"
1440 dnl     aros_gui_incdir="${aros_gui_basedir}/include"
1441 dnl     fi
1442 dnl 
1443 dnl     if test -n "$aros_gui_libdir" ; then
1444 dnl     aros_gui_ldflags="-L ${aros_gui_libdir}"
1445 dnl     fi
1446 dnl 
1447 dnl     if test -n "$aros_gui_incdir" ; then
1448 dnl     aros_gui_ccflags="-I ${aros_gui_incdir}"
1449 dnl     else
1450 dnl     aros_gui_incdir="${aros_sysincludes}"
1451 dnl     aros_gui_ccflags=""
1452 dnl     fi
1453 dnl fi
1455 if test ! -d ${aros_inc_dir} ; then
1456     ${MKDIR} ${aros_inc_dir}
1458 if test ! -d ${aros_geninc_dir} ; then
1459     ${MKDIR} ${aros_geninc_dir}
1461 if test ! -d ${aros_hostcfg_dir} ; then
1462     ${MKDIR} ${aros_hostcfg_dir}
1464 if test ! -d ${aros_targetcfg_dir} ; then
1465     ${MKDIR} ${aros_targetcfg_dir}
1467 if test ! -d ${aros_tools_dir} ; then
1468     ${MKDIR} ${aros_tools_dir}
1470 if test ! -d ${aros_scripts_dir} ; then
1471     ${MKDIR} ${aros_scripts_dir}
1474 AC_CONFIG_HEADERS(${aros_geninc_dir}/host-conf.h:config/host-conf.h.in)
1476 AC_CONFIG_COMMANDS([compiler_executable],
1477     [
1478         prefix=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}
1479         mkdir -p $prefix
1480         prefix="${prefix}/${aros_target_cpu}-aros"
1481         prefix2=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros
1483         echo ${prefix}
1484         echo ${prefix2}
1485         chmod a+x ${prefix2}-gcc ${prefix2}-ld
1487         ln -sf ${prefix2}-gcc          ${prefix}-gcc
1488         ln -sf ${prefix2}-ld           ${prefix}-ld
1490         ln -sf $aros_target_as_ln      ${prefix}-as
1491         ln -sf $aros_target_nm_ln      ${prefix}-nm
1492         ln -sf $aros_target_ar_ln      ${prefix}-ar
1493         ln -sf $aros_target_ranlib_ln  ${prefix}-ranlib
1494         ln -sf $aros_target_objcopy_ln ${prefix}-objcopy
1495         ln -sf $aros_target_objdump_ln ${prefix}-objdump
1496         ln -sf $aros_target_strip_ln   ${prefix}-strip
1498         ln -sf $aros_target_as_ln      ${prefix2}-as
1499         ln -sf $aros_target_nm_ln      ${prefix2}-nm
1500         ln -sf $aros_target_ar_ln      ${prefix2}-ar
1501         ln -sf $aros_target_ranlib_ln  ${prefix2}-ranlib
1502         ln -sf $aros_target_objcopy_ln ${prefix2}-objcopy
1503         ln -sf $aros_target_objdump_ln ${prefix2}-objdump
1504         ln -sf $aros_target_strip_ln   ${prefix2}-strip
1505     ],
1506     [
1507         aros_tools_dir=${aros_tools_dir}
1508         aros_target_cpu=${aros_target_cpu}
1509         aros_target_arch=${aros_target_arch}
1510         aros_target_suffix=${aros_target_suffix}
1511         aros_target_nm_ln=${aros_target_nm_ln}
1512         aros_target_as_ln=${aros_target_as_ln}
1513         aros_target_ar_ln=${aros_target_ar_ln}
1514         aros_target_ranlib_ln=${aros_target_ranlib_ln}
1515         aros_target_objdump_ln=${aros_target_objdump_ln}
1516         aros_target_objcopy_ln=${aros_target_objcopy_ln}
1517         aros_target_strip_ln=${aros_target_strip_ln}
1518     ]
1520 AC_CONFIG_COMMANDS([genshared_executable],
1521     [chmod a+x ${aros_scripts_dir}/genshared],
1522     [aros_scripts_dir=${aros_scripts_dir}]
1524 AC_CONFIG_COMMANDS([genmf_executable],
1525     [chmod a+x ${aros_tools_dir}/genmf.py],
1526     [aros_tools_dir=${aros_tools_dir}]
1528 AC_CONFIG_COMMANDS([adflib_myaros.conf_executable],
1529     [chmod a+x tools/adflib/myconf.aros]
1532 AC_CONFIG_FILES(
1533     Makefile
1534     rom/mmakefile
1535     ${aros_inc_dir}/config.h:config/config.h.in
1536     ${aros_geninc_dir}/config.h:config/config.h.in
1537     ${aros_hostcfg_dir}/host.cfg:config/host.cfg.in
1538     ${aros_targetcfg_dir}/target.cfg:config/target.cfg.in
1539     mmake.config
1540     ${aros_targetcfg_dir}/make.defaults:config/make.defaults.in
1541     ${aros_targetcfg_dir}/specs:config/specs.in
1542     ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-gcc:scripts/aros-gcc.in
1543     ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-ld:scripts/aros-ld.in
1544     ${aros_scripts_dir}/genshared:compiler/c_lib/source/lib_source/genshared.in
1545     ${aros_tools_dir}/genmf.py:tools/genmf/genmf.py
1546     tools/adflib/myconf.aros
1547     tools/collect-aros/env.h
1550 AC_OUTPUT
1552 dnl This is in order to not define SHARED_CFLAGS sometimes
1553 dnl We don't always do aros_shared_ar, aros_shared_cflags
1555 #XXX compatability...
1556 aros_shared_ar="$aros_shared_ld $aros_shared_ldflags -o"
1558 if test -n "$aros_shared_cflags" ; then
1559     echo "SHARED_CFLAGS := $aros_shared_cflags" >> ${aros_hostcfg_dir}/host.cfg
1560     echo "SHARED_AR := $aros_shared_ar" >> ${aros_hostcfg_dir}/host.cfg