Partition sizes can now be specified and existing partitions can be preserved.
[cake.git] / configure.in
blob4cf76fc9daf3c1bfaf696d73c17d30754109f854
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=""
117 # This is the main host configuration section. It is where the host
118 # can change the values of any variables it needs to change. We do
119 # not look at anything that compiles to the target yet, we'll get
120 # to that later.
122 case "$host_os" in
123     linux*)
124         aros_host_arch="linux"
125         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
126         case "$host_cpu" in
127             *i?86*)
128                 aros_host_cpu="i386"
129                 ;;
130             *x86_64*)
131                 aros_host_cpu="x86_64"
132                 ;;
133             *m68k*)
134                 aros_host_cpu="m68k"
135                 ;;
136             *powerpc*)
137                 aros_host_cpu="ppc"
138                 ;;
139             *)
140                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
141                 aros_host_cpu="$host_cpu"
142                 ;;
143         esac
145         dnl bring in dlopen() and friends. doing this directly sucks, but
146         dnl it always exists on linux and its not clear to me where the
147         dnl appropriate place for a test would be. this file is a mess.
148         aros_host_ldflags="$aros_host_ldflags -ldl"
149         ;;
151     freebsd*)
152         aros_host_cc="$aros_host_cc $aros_host_cc_pipe -I/usr/local/include"
153         aros_host_make="gmake"
154         aros_host_arch="freebsd"
155         aros_host_cpu="i386"
157         aros_host_ldflags="$aros_host_ldflags -L/usr/local/lib -liconv"
159         dnl Need to override this here, it's just too hard later.
160         dnl This shouldn't be here at all...
161         dnl aros_target_cc_includes="/usr/include"
163         dnl FreeBSD 5.x (and later) has changed the default object format.
164         dnl The double [[]] is necessary to get around m4's quoting rules.
165         case $host_os in
166             freebsd[[234]]*)
167                 aros_object_format="elf_i386"
168                 ;;
170             *)
171                 aros_object_format="elf_i386_fbsd"
172                 ;;
173         esac
175         ;;
177     darwin*)
178         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
179         aros_host_arch="darwin"
180         case "$host_cpu" in
181             *i?86*)
182                 aros_host_cpu="i386"
183                 ;;
184             *powerpc*)
185                 aros_host_cpu="ppc"
186                 ;;
187             *)
188                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
189                 aros_host_cpu="$host_cpu"
190                 ;;
191         esac
193         aros_host_ldflags="$aros_host_ldflags -liconv"
195         ;;
197     netbsd*)
198         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
199         aros_host_make="gmake"
200         aros_host_arch="netbsd"
201         case "$host_cpu" in
202             *i?86*)
203                 aros_host_cpu="i386"
204                 ;;
205             *m68k*)
206                 aros_host_cpu="m68k"
207                 ;;
208             *)
209                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
210                 aros_host_cpu="$host_cpu"
211                 ;;
212         esac    
213         aros_host_lib_suffix=".0.0"
214         ;;
216     openbsd*)
217         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
218         aros_host_make="gmake"
219         aros_host_arch="openbsd"
220         case "$host_cpu" in
221             *i?86*)
222                 aros_host_cpu="i386"
223                 ;;
224             *)
225                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
226                 aros_host_cpu="$host_cpu"
227                 ;;
228         esac
229         ;;
230         
231     solaris*)
232         aros_host_arch="solaris"
233         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
234         case "$host_cpu" in
235             *sparc*)
236                 aros_host_cpu="sparc"
237                 ;;
238             *)
239                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
240                 aros_host_cpu="$host_cpu"
241                 ;;
242         esac
243         ;;
245     morphos*)
246         aros_host_arch="morphos"
247         aros_host_cpu="ppc"
248         ;;
250     amiga*)
251         aros_host_arch="amiga"
252         SORT="/gg/bin/sort"
253         TEST="/gg/bin/test"
254         UNIQ="/gg/bin/uniq"
255         FOR="for"
256         TOUCH="/gg/bin/touch"
257         case "$host_cpu" in
258             *m68k*)
259                 aros_host_cpu="m68k"
260                 ;;
261             *powerpc*)
262                 aros_host_cpu="ppc"
263                 ;;
264             *)
265                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
266                 aros_host_cpu="$host_cpu"
267                 ;;
268         esac
269         ;;
271     cygwin*)
272         aros_host_arch="cygwin"
273         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
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         AC_MSG_ERROR([Unsupported host architecture $host])
286         ;;
287 esac
289 AROS_PROG(aros_host_ar,[ar],[cr])
290 AROS_REQUIRED(ar,$aros_host_ar)
291 AROS_PROG(aros_host_ranlib,ranlib)
292 AROS_REQUIRED(ranlib,$aros_host_ranlib)
293 AROS_PROG(aros_host_strip,strip)
294 AROS_REQUIRED(strip,$aros_host_strip)
296 AROS_PROG(RM,[rm],[-rf])
297 AROS_REQUIRED(rm,$RM)
298 AROS_PROG(CP,[cp])
299 AROS_REQUIRED(cp,$CP)
300 AROS_PROG(MV,[mv])
301 AROS_REQUIRED(mv,$MV)
302 AROS_PROG(ECHO,[echo])
303 AROS_REQUIRED(echo,$ECHO)
304 AROS_PROG(MKDIR,[mkdir],[-p])
305 AROS_REQUIRED(mkdir,$MKDIR)
306 AROS_PROG(TOUCH,[touch])
307 AROS_REQUIRED(touch,$TOUCH)
308 AROS_PROG(SORT,[sort])
309 AROS_REQUIRED(sort,$SORT)
310 AROS_PROG(UNIQ,[uniq])
311 AROS_REQUIRED(uniq,$UNIQ)
312 AROS_PROG(NOP,[true])
313 AROS_REQUIRED(true,$NOP)
314 AROS_PROG(CAT,[cat])
315 AROS_REQUIRED(cat,$CAT)
316 AROS_PROG(BISON,[bison])
317 AROS_REQUIRED(bison,$BISON)
318 AROS_PROG(FLEX,[flex])
319 AROS_REQUIRED(flex,$FLEX)
320 AROS_PROG(PNGTOPNM,[pngtopnm])
321 AROS_REQUIRED(pngtopnm,$PNGTOPNM)
322 AROS_PROG(PPMTOILBM,[ppmtoilbm])
323 AROS_REQUIRED(ppmtoilbm,$PPMTOILBM)
324 AROS_PROG(SED,[sed])
325 AROS_REQUIRED(sed,$SED)
326 AROS_PROG(CHMOD,[chmod])
327 AROS_REQUIRED(chmod,$CHMOD)
329 AM_PATH_PYTHON(2.2.1)
331 AC_SUBST(FOR, for)
332 AC_SUBST(IF, if)
333 AC_SUBST(TEST, test)
334 AC_SUBST(CMP, cmp)
336 dnl ---------------------------------------------------------------------------
337 dnl Look for things about the host system, good for hosted targets.
338 dnl ---------------------------------------------------------------------------
340 # Check for some includes for the X11 HIDD and the kernel
341 AC_CHECK_HEADERS([sys/ipc.h sys/shm.h \
342     sys/mmap.h sys/mman.h sysexits.h \
343     sys/statfs.h sys/statvfs.h sys/vfs.h sys/param.h \
346 AC_CHECK_HEADERS([sys/mount.h],,,[#include <sys/param.h>])
348 AC_HEADER_DIRENT
349 AC_HEADER_STAT
350 AC_HEADER_STDC
351 AC_HEADER_SYS_WAIT
352 AC_HEADER_TIME
353 AC_STRUCT_ST_BLKSIZE
354 AC_STRUCT_ST_BLOCKS
355 AC_STRUCT_ST_RDEV
356 AC_STRUCT_TM
357 AC_STRUCT_TIMEZONE
358 AC_TYPE_OFF_T
359 AC_TYPE_PID_T
360 AC_TYPE_SIZE_T
361 AC_TYPE_UID_T
363 AC_CHECK_MEMBERS(struct tm.tm_gmtoff)
365 # Look for some functions
366 AC_CHECK_FUNCS([getpagesize kqueue statfs statvfs \
367     clone kse_create rfork_thread thr_create sa_register \
368     getcontext makecontext setcontext sigaltstack swapcontext])
370 AC_FUNC_MMAP
372 # Find X
373 AC_PATH_X
376 dnl --------------------------------------------------------------------
377 dnl Target Configuration Section
378 dnl --------------------------------------------------------------------
380 dnl The target configuration section is responsible for setting up all
381 dnl the paths for includes, and tools required to build AROS to some
382 dnl particular target.
384 aros_config_cflags="-Wall -Werror-implicit-function-declaration"
385 aros_config_aflags="-Wall -x assembler-with-cpp -c"
386 aros_config_ldflags=""
388 aros_shared_default=yes
390 aros_shared_cflags="-fPIC"
391 aros_shared_aflags=""
392 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
393 aros_kernel_ldflags="-Wl,-rpath,./lib"
395 aros_target_ar_flags="cr"
396 aros_target_nm_flags="-C -ul"
397 aros_target_strip_flags="--strip-unneeded -R.comment"
399 aros_compiler_libs=
401 aros_target_genmap="-Wl,-Map -Xlinker"
403 # Native flavour stuff
404 aros_bochs_hack="0"
405 aros_serial_debug="0"
407 # Palm native flavour stuff
408 aros_palm_debug_hack="0"
410 # Unix flavour stuff
411 aros_nesting_supervisor="0"
413 # Collect-aros stuff: "-ius" to ignore undefined symbols
414 ignore_undefined_symbols=""
416 # X11 Xshm
417 DO_XSHM_SUPPORT="1"
418 DO_VIDMODE_SUPPORT="1"
420 #-----------------------------------------------------------------------------
422 AC_MSG_CHECKING([for type of build])
423 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")
425 if test "$build_type" = "nightly"; then
426     build_type_string="NIGHTLY"
427 elif test "$build_type" = "snapshot"; then
428     build_type_string="SNAPSHOT"
429 elif test "$build_type" = "milestone"; then
430     build_type_string="MILESTONE"
431 elif test "$build_type" = "release"; then
432     build_type_string="RELEASE"
433 else
434     build_type_string="PERSONAL"
435     build_type="personal"
438 aros_config_cflags="$aros_config_cflags -DAROS_BUILD_TYPE=AROS_BUILD_TYPE_$build_type_string"
440 AC_MSG_RESULT($build_type)
442 #-----------------------------------------------------------------------------
443 all_debug_types="messages stack mungwall modules symbols"
445 AC_MSG_CHECKING([which debug types to enable])
446 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)]),
447  debug="$enableval",debug="")
449 if test "$debug" = "" -o "$debug" = "no"; then
450     debug="none"
451 elif test "$debug" = "yes"; then
452     debug="all"
455 if test "$debug" = "all" ; then
456     debug=$all_debug_types
457     for d in $all_debug_types; do
458         export aros_${d}_debug="1"
459     done
460 else
461     for d in $all_debug_types; do
462         export aros_${d}_debug="0"
463     done
466 if test "$debug" != "none"; then
467     debug=`echo $debug | sed s/,/\ /g`
468     for d in $debug; do
469         found="0"
470         for d2 in $all_debug_types; do
471             if test "$d2" = "$d"; then
472                 found="1"
473                 break
474             fi
475         done
476         if test "$found" = "0"; then
477             AC_MSG_ERROR([unrecognized debug type "$d". Available types are: all none $all_debug_types])
478         fi
479         export aros_${d}_debug="1"
480     done
481     aros_debug="yes"
483 AC_MSG_RESULT($debug)
485 if test "$aros_messages_debug" = "1"; then
486     aros_messages_debug="-DADEBUG=1 -DMDEBUG=1"
487 else
488     aros_messages_debug=""
490 if test "$aros_symbols_debug" = "1"; then
491     aros_symbols_debug="-g"
492 else
493     aros_symbols_debug=""
496 # These are the flags to pass when compiling debugged programs
497 aros_debug_cflags="$aros_symbols_debug $aros_messages_debug"
498 aros_debug_aflags=""
499 aros_debug_ldflags="$aros_symbols_debug"
501 #-----------------------------------------------------------------------------
502 #   Checking for distcc and ccache.
504 #   Always apply the transforms in this particular order. Basically you should
505 #   always run 'ccache distcc compiler' in that order for the best performance.
507 AC_MSG_CHECKING([whether to enable distcc])
508 AC_ARG_ENABLE(distcc,AC_HELP_STRING([--enable-distcc],[Use distcc as a front end to the compiler (default=no).]),distcc="$enableval",distcc="no")
509 if test "$distcc" != "" -a "$distcc" != "no"; then
510     # AC_CHECK_PROG will print out the result in this case
511     AC_PATH_PROG(DISTCC,[distcc],distcc,)
512 else
513     AC_MSG_RESULT(no)
516 AC_MSG_CHECKING([whether to enable ccache])
517 AC_ARG_ENABLE(ccache,AC_HELP_STRING([--enable-ccache],[Use ccache as a front end to the compiler (default=no).]),ccache="$enableval",ccache="no")
518 if test "$ccache" != "" -a "$ccache" != "no"; then
519     # AC_CHECK_PROG will print out the result in this case
520     AC_CHECK_PROG(CCACHE,[ccache],ccache,)
521 else
522     AC_MSG_RESULT(no)
525 #-----------------------------------------------------------------------------
526 AC_MSG_CHECKING([what optimization flags to use])
527 AC_ARG_WITH(optimization,AC_HELP_STRING([--with-optimization=FLAGS],[Use optimization flags FLAGS (default=-O2).]),optimization="$withval",optimization="unknown")
528 if test "$optimization" = "unknown"; then
529     dnl default is -O2 for normal builds, -O0 for debug builds
530     if test "$debug" != "none"; then
531         optimization="-O0"
532     else
533         optimization="-O2"
534     fi
536 aros_config_cflags="$aros_config_cflags $optimization"
537 AC_MSG_RESULT($optimization)
539 #-----------------------------------------------------------------------------
540 AC_MSG_CHECKING([what target variant to enable])
541 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")
542 if test "$target_variant" = "none"; then
543     aros_target_variant=""
544     aros_target_suffix=""
545 else
546     aros_target_variant="$target_variant"
547     aros_target_suffix="-$target_variant"
549 AC_MSG_RESULT($enableval)
551 #-----------------------------------------------------------------------------
552 # This is the target configuration switch.
553 case "$target_os" in
554     linux*)
555         aros_target_arch="linux"
556         case "$target_cpu" in
557             *m68k*)
558                 aros_target_cpu="m68k"
559                 aros_object_format="m68kelf"
560                 aros_flavour="emulcompat"
561                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D__mc68000 -D__linux__"
562                 aros_shared_ldflags="-Wl,-T,\$(TOP)/config/linux/m68k/script.so"
563                 aros_kernel_ldflags="-Wl,-rpath,./lib,-T,\$(TOP)/config/linux/m68k/script.normal"
564                 gcc_target_cpu="mc68000"
565                 ;;
566             *i?86*)
567                 aros_target_cpu="i386"
568                 aros_object_format="elf_i386"
569                 aros_flavour="emulation"
570                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__linux__"
571                 aros_default_wbdepth=8
572                 gcc_target_cpu="i386"
573                 ;;
574             *x86_64*)
575                 aros_target_cpu="x86_64"
576                 aros_object_format="elf_x86_64"
577                 aros_flavour="emulation"
578                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64 -D__linux__"
579                 aros_default_wbdepth=8
580                 gcc_target_cpu="x86_64"
581                 ;;
582             *powerpc*)
583                 aros_target_cpu="ppc"
584                 aros_object_format="elf32ppc"
585                 aros_flavour="emulation"
586                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc -D__linux__"
587                 aros_default_wbdepth=8
588                 gcc_target_cpu="ppc"
589                 ;;
590             *)
591                 AC_MSG_ERROR("Unknown CPU for Linux -- $target_cpu")
592                 ;;
593         esac
594     ;;
596     pc)
597         aros_target_arch="pc"
598         aros_shared_default="no"
599         case "$target_cpu" in
600             *i?86*)
601                 aros_target_cpu="i386"
603                 dnl If somebody hasn't already set the target object
604                 dnl format, then use this value. Mostly to support
605                 dnl FreeBSD cross-compilation.
606                 dnl TODO: Remove when we always use our compiler.
608                 if test "$aros_object_format" = "" ; then
609                     aros_object_format="elf_i386"
610                 fi
611                 aros_flavour="standalone"
612                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
613                 aros_kernel_ldflags=""
614                 aros_default_wbwidth=640
615                 aros_default_wbheight=480
616                 gcc_target_cpu="i386"
617                 ;;
618             *x86_64*)
619                 aros_target_cpu="x86_64"
620                 if test "$aros_object_format" = "" ; then
621                     aros_object_format="elf_x86_64"
622                 fi
623                 aros_flavour="standalone"
624                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
625                 aros_config_cflags="$aros_config_cflags -fno-asynchronous-unwind-tables"
626                 aros_kernel_ldflags=""
627                 aros_default_wbwidth=640
628                 aros_default_wbheight=480
629                 gcc_target_cpu="x86_64"
630                 ;;
631             *)
632                 AC_MSG_ERROR("Unknown native CPU -- $target_cpu")
633                 ;;
634         esac
635         ;;
637     prep)
638         aros_target_arch="prep"
639         aros_shared_default="no"
640         aros_target_cpu="ppc"
641         aros_object_format="elf32ppc"
642         aros_flavour="ppcnative"
643         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
644         aros_kernel_ldflags=""
645         aros_default_wbwidth=640
646         aros_default_wbheight=480
647         gcc_target_cpu="ppc"
648         case "$target_cpu" in
649             *cross*)
650                 aros_target_cc="ppc-linux-gcc -pipe"
651                 aros_target_ld="ppc-linux-ld"
652                 aros_target_as="ppc-linux-as"
653                 aros_target_ar="ppc-linux-ar"
654                 aros_target_ranlib="ppc-linux-ranlib"
655                 aros_target_nm="ppc-linux-nm"
656                 aros_target_strip="ppc-linux-strip"
657                 aros_target_objcopy="ppc-linux-objcopy"
658                 aros_target_objdump="ppc-linux-objdump"
659                 aros_shared_ld="ppc-linux-ld"
660                 aros_kernel_ld="ppc-linux-ld"
661                 ;;
662             *)
663                 ;;
664         esac
665         ;;
667     freebsd*)
668         aros_target_arch="freebsd"
669         aros_target_cpu="i386"
670         aros_flavour="emulation"
671         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
672         gcc_target_cpu="i386"
674         aros_target_strip_flags="-x"
675         ;;
677     darwin*)
678         aros_target_arch="darwin"
679         aros_target_cpu="i386"
680         aros_flavour="emulation"
681         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
682         gcc_target_cpu="i386"
684         aros_target_strip_flags="-x"
685         ;;
687     netbsd*)
688         aros_target_arch="netbsd"
689         case "$target_cpu" in
690             *m68k*)
691                 aros_target_cpu="m68k"
692                 aros_object_format="m68kelf"
693                 aros_flavour="emulcompat"
694                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D__mc68000 -D__NetBSD__"
695                 gcc_target_cpu="mc68000"
696                 ;;
697             *i?86*)
698                 aros_target_cpu="i386"
699                 aros_object_format="elf_i386"
700                 aros_flavour="emulation"
701                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__NetBSD__"
702                 aros_default_wbdepth=8
703                 gcc_target_cpu="i386"
704                 ;;
705             *)
706                 AC_MSG_ERROR("Unknown CPU for NetBSD -- $target_cpu")
707                 ;;
708         esac
709         aros_target_genmap="-Wl,-M -Xlinker >"
710         aros_flavour="emulation"
711         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
712         ;;   
714     openbsd*)
715         aros_target_arch="openbsd"
716         case "$target_cpu" in
717             *i?86*)
718                 aros_target_cpu="i386"
719                 aros_object_format="elf_i386"
720                 aros_flavour="emulation"
721                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__OpenBSD__"
722                 gcc_target_cpu="i386"
723                 ;;
724             *)
725                 AC_MSG_ERROR("Unknown CPU for OpenBSD -- $target_cpu")
726                 ;;
727         esac
728         aros_target_genmap="-Wl,-M -Xlinker >"
729         aros_target_nm_flags="-u"
730         aros_flavour="emulation"
731         ;;
733     solaris*)
734         aros_target_arch="solaris"
735         case "$target_cpu" in
736             *sparc*)
737                 aros_target_cpu="sparc"
738                 aros_object_format="elf_sparc"
739                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dsparc -D__Solaris__"
740                 gcc_target_cpu="sparc"
741                 ;;
742             *)
743                 AC_MSG_ERROR("Unknown CPU for Solaris -- $target_cpu")
744                 ;;
745         esac
746         aros_config_cflags="$aros_config_cflags -D$aros_target_cpu"
747         aros_flavour="emulation"
748         ;;
750     morphos*)
751         aros_target_arch="morphos"
752         aros_shared_default="no"
753         aros_target_cpu="ppc"
754         aros_object_format="elf_ppc"
755         aros_flavour="nativecompat"
756         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
757         gcc_target_cpu="ppc"
758         ;;
760     amiga*)
761         aros_target_arch="amiga"
762         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D_AMIGA -DAMIGA"
763         aros_shared_default="no"
765         aros_config_cflags="$aros_config_cflags -fomit-frame-pointer -fbuiltin -ffreestanding"
767         case "$target_cpu" in
768             *m68k*)
769                 aros_target_cpu="m68k"
770                 aros_object_format="m68kelf"
771                 aros_flavour="nativecompat"
772                 gcc_target_cpu="mc68000"
773                 ;;
774             *ppc*)
775                 aros_cpu="ppc"
776                 aros_flavour="native"
777                 gcc_target_cpu="ppc"
778                 ;;
779             *)
780                 AC_MSG_ERROR("Unknown CPU for Amiga $target_cpu")
781                 ;;
782         esac
783         ;;
785     cygwin*)
786         aros_target_arch="cygwin"
787         aros_shared_default="no"
788         case "$target_cpu" in
789             *i?86*)
790                 aros_target_cpu="i386"
791                 aros_object_format="elf_i386"
792                 aros_flavour="emulation"
793                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__CYGWIN32__"
794                 aros_shared_cflags=""
795                 aros_default_wbdepth=8
796                 gcc_target_cpu="i386"
797                 ;;
798             *)
799                 AC_MSG_ERROR("Unknown CPU for CygWin -- $target_cpu")
800                 ;;
801         esac
802     ;;
803     pp*)
804         aros_target_arch="pp"
805         aros_shared_default="no"
806         case "$target_cpu" in
807             *m68k*)
808                 aros_target_cpu="m68k"
809                 aros_object_format="m68kelf"
810                 aros_flavour="palmnative"
811                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
812                 aros_kernel_ldflags=""
813                 aros_default_wbwidth=160
814                 aros_default_wbheight=160
815                 aros_default_wbdepth=1
816                 aros_target_cc="m68k-elf-gcc -pipe"
817                 aros_target_ld="$(which m68k-elf-ld)"
818                 aros_target_as="m68k-elf-gcc -pipe"
819                 aros_shared_ld="m68k-elf-gcc"
820                 aros_kernel_ld="m68k-elf-gcc"
821                 aros_target_ar="m68k-elf-ar"
822                 aros_target_ar_flags="cru"
823                 aros_target_ranlib="m68k-elf-ranlib"
824                 aros_target_nm="m68k-elf-nm"
825                 aros_target_objcopy="m68k-elf-objcopy"
826                 aros_target_objdump="m68k-elf-objdump"
827                 aros_compiler_libs="-lgcc1"
828                 aros_shared_default=no
829                 aros_shared_cflags="-fpic"
830                 aros_shared_aflags=""
831                 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
832                 aros_kernel_ldflags="-Wl,-rpath,./lib"
833                 aros_debug_cflags="-Wall -Werror-implicit-function-declaration $aros_symbols_debug  $aros_messages_debug -mc68000 -Wa,-mc68000"
834                 aros_debug_aflags=""
835                 aros_debug_ldflags="$aros_symbols_debug"
836                 aros_mungwall_debug="0"
837                 aros_modules_debug="0"
838                 gcc_target_cpu="mc68000"
839                 ignore_undefined_symbols="-ius"
840                 ;;
841            *)
842                 AC_MSG_ERROR("Unknown CPU for PalmPilot -- $target_cpu")
843                 ;;
844         esac
845         ;;
847     mac*)
848         aros_target_arch="mac"
849         aros_shared_default="no"
850         case "$target_cpu" in
851             *m68k*)
852                 aros_target_cpu="m68k"
853                 aros_object_format="m68kelf"
854                 aros_flavour="mac68knative"
855                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
856                 aros_default_wbwidth=512
857                 aros_default_wbheight=384
858                 aros_default_wbdepth=8
859                 aros_target_cc="m68k-elf-gcc -pipe"
860                 aros_target_ld="$(which m68k-elf-ld)"
861                 aros_target_as="m68k-elf-gcc -pipe"
862                 aros_shared_ld="m68k-elf-gcc"
863                 aros_kernel_ld="m68k-elf-gcc"
864                 aros_target_ar="m68k-elf-ar"
865                 aros_target_ar_flags="cru"
866                 aros_target_ranlib="m68k-elf-ranlib"
867                 aros_target_nm="m68k-elf-nm"
868                 aros_target_objcopy="m68k-elf-objcopy"
869                 aros_target_objdump="m68k-elf-objdump"
870                 aros_compiler_libs="-lgcc1"
871                 aros_shared_default=no
872                 aros_shared_cflags="-fpic"
873                 aros_shared_aflags=""
874                 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
875                 aros_kernel_ldflags="-Wl,-rpath,./lib"
876                 aros_debug_cflags="-Wall -Werror-implicit-function-declaration $aros_symbols_debug  $aros_messages_debug -mc68000"
877                 aros_debug_aflags=""
878                 aros_debug_ldflags="$aros_symbols_debug"
879                 aros_mungwall_debug="0"
880                 aros_modules_debug="0"
881                 gcc_target_cpu="mc68000"
882                 ignore_undefined_symbols="-ius"
883                 ;;
884            *)
885                 AC_MSG_ERROR("Unknown CPU for Mac68k -- $target_cpu")
886                 ;;
887         esac
888         ;;
890     *)
891         AC_MSG_ERROR([Unsupported target architecture $target])
892         ;;
893 esac
896 # Find out if we are cross-compiling (ie. if we can't use the host compiler
897 # for target code)
898 cross_compiling=no
899 if test "$aros_host_cpu" != "$aros_target_cpu" ; then
900     cross_compiling=yes
902 if test "$aros_host_arch" == "darwin" ; then
903     cross_compiling=yes
906 # Set prefix for target compiler etc. if we're cross-compiling
907 # (should possibly be earlier but needs to be after AC_PROG_CC)
908 if test "$cross_compiling" = "yes" ; then
909     target_tool_prefix=${target_cpu}-elf-
910     CC=${target_tool_prefix}gcc
913 # Find all the tools we need to compile. This could be cross-compiling
914 # though! If that is the case we use the GNU form of the target and
915 # simply add this to the front of the binary name. This is rather simple,
916 # but it should work under most circumstances.
918 # The default tools are to use the same as the host, but only if the
919 # host and target CPU are the same. With GCC this is normally enough.
922 aros_cc_pre=""
923 aros_shared_ld="$aros_host_ld"
925 aros_target_mkdep="$aros_host_mkdep"
926 aros_target_incl_def="$aros_host_incl"
928 AC_PATH_PROG(aros_kernel_cc,$CC)
930 # The default tools executables to be linked to.
931 AROS_TOOL_TARGET(aros_target_as_ln,as)
932 AROS_REQUIRED(as,$aros_target_as_ln)
933 AROS_TOOL_TARGET(aros_kernel_ld,ld)
934 AROS_REQUIRED(ld,$aros_kernel_ld)
935 AROS_TOOL_TARGET(aros_target_ar_ln,ar)
936 AROS_REQUIRED(ar,$aros_target_ar_ln)
937 AROS_TOOL_TARGET(aros_target_nm_ln,nm)
938 AROS_REQUIRED(nm,$aros_target_nm_ln)
939 AROS_TOOL_TARGET(aros_target_objcopy_ln,objcopy)
940 AROS_REQUIRED(objcopy,$aros_target_objcopy_ln)
941 AROS_TOOL_TARGET(aros_target_objdump_ln,objdump)
942 AROS_REQUIRED(objdump,$aros_target_objdump_ln)
943 AROS_TOOL_TARGET(aros_target_ranlib_ln,ranlib)
944 AROS_REQUIRED(ranlib,$aros_target_ranlib_ln)
945 AROS_TOOL_TARGET(aros_target_strip_ln,strip)
946 AROS_REQUIRED(strip,$aros_target_strip_ln)
948 if test "$GCC" = "yes"; then
949     aros_target_cc_path=`$aros_kernel_cc -print-search-dirs | grep "programs: =" | cut -c 12-`
952 aros_hostcfg_dir="bin/${aros_host_arch}-${aros_host_cpu}/gen/config"
953 aros_targetcfg_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/config"
954 aros_inc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/AROS/Development/include/aros"
955 aros_gendir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen"
956 aros_geninc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/include/aros"
957 aros_tools_dir="bin/${aros_host_arch}-${aros_host_cpu}/tools"
958 aros_scripts_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/scripts"
960 # aros_cc_pre is a variable that is added to the front of the compiler name
961 # in the generated aros-gcc shell script. We need this to enable the cache
962 # to work across cleaned builds. Also, support DISTCC using the correct
963 # environment variable.
966 if test "x${DISTCC}" != "x" ; then
967     if test "x${CCACHE}" != "x" ; then
968         aros_cc_pre="env CCACHE_PREFIX=${DISTCC} ${CCACHE} "
969     else
970         aros_cc_pre="${DISTCC} "
971     fi
972 else
973     if test "x${CCACHE}" != "x" ; then
974         aros_cc_pre="${CCACHE} "
975     fi
978 prefix="${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros"
980 AC_SUBST(aros_target_nostdinc_cflags,-nostdinc)
981 AC_SUBST(aros_target_nostartup_ldflags,-nostartfiles)
982 AC_SUBST(aros_target_nix_ldflags,-nix)
983 AC_SUBST(aros_target_detach_ldflags,-detach)
984 AC_SUBST(aros_target_nostdlib_ldflags,-nostdlib)
986 # Target tools
987 aros_target_cc="${prefix}-gcc"
988 aros_target_as="${prefix}-as"
989 aros_target_ld="${prefix}-ld"
990 aros_target_ar="${prefix}-ar $aros_target_ar_flags"
991 aros_target_objcopy=${prefix}-objcopy
992 aros_target_objdump=${prefix}-objdump
993 aros_target_ranlib="${prefix}-ranlib $aros_target_ranlib_flags"
994 aros_target_nm="${prefix}-nm $aros_target_nm_flags"
995 aros_kernel_nm="${prefix}-nm"
996 aros_target_strip=${prefix}-strip
998 #-----------------------------------------------------------------------------
999 # See if we can compile SHM support
1000 HAVE_XSHM_SUPPORT=0
1001 if [[ "x$no_x" != "xyes" -a "x$ac_cv_header_sys_ipc_h" = "xyes" -a "x$ac_cv_header_sys_shm_h" = "xyes" ]]; then
1002   AC_MSG_CHECKING(whether the X11 MIT-SHM extension can be compiled in)
1003   if test -z "$x_includes" ; then
1004     CFLAGS=""
1005   else
1006     CFLAGS="-I $x_includes"
1007   fi
1008   LIBS="-L/usr/X11/lib -L/usr/X11R6/lib -lX11 -lXext"
1009   AC_TRY_LINK([
1010 #include <sys/types.h>
1011 #include <X11/Xlib.h>
1012 #include <X11/Xutil.h>
1013 #include <X11/keysym.h>
1014 #include <X11/cursorfont.h>
1015 #include <sys/ipc.h>
1016 #include <sys/shm.h>
1017 #include <X11/extensions/XShm.h>],[
1018 static XShmSegmentInfo shminfo;
1019 static Display *display;
1020 XShmAttach(display, &shminfo);
1021 XSync(display,0);
1022 shmctl(shminfo.shmid, IPC_RMID, 0);
1024 HAVE_XSHM_SUPPORT=1
1025 AC_MSG_RESULT(yes),
1026 HAVE_XSHM_SUPPORT=0
1027 AC_MSG_RESULT(no))
1030 #-----------------------------------------------------------------------------
1031 # See if we can compile VIDMODE support
1032 HAVE_VIDMODE_SUPPORT=0
1033 if [[ "x$no_x" != "xyes" ]]; then
1034   LIBS=""
1035   AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryExtension, HAVE_VIDMODE_SUPPORT=1, HAVE_VIDMODE_SUPPORT=0, [ -L/usr/X11R6/lib -lXext -lX11 ])
1039 # Find the system include path. We can suggest that an alternative is
1040 # used if we don't get it correct. The default is to use /usr/include.
1041 # Which is set in the aros_target_incl_def variable.
1043 AC_ARG_ENABLE(includes,
1044 AC_HELP_STRING([--enable-includes=dir],[Alternative system include directory]),
1045 [aros_target_incl=$enable_includes], [aros_target_incl=$aros_target_incl_def])
1047 dnl find out about the target cc's include path
1048 AC_MSG_CHECKING([for the target compiler's include path])
1049 if test "$aros_target_cc_includes" = "" ; then
1050     #try to guess where the directory is
1051     aros_target_cc_includes=`dirname \`${aros_kernel_cc} -print-libgcc-file-name\``/include
1052     if ! test -d $aros_target_cc_includes; then
1053         #the directory doesn't exist, we need to do some more work
1054         aros_target_cc_includes=${PWD}/${aros_gendir}/cc_include
1055         
1056         #these are the headers we're looling for
1057         headers="limits.h mmintrin.h stdbool.h syslimits.h float.h \
1058                  stddef.h xmmintrin.h iso646.h stdarg.h unwind.h   \
1059                  zutil.h"
1061         dirs=
1062         for h in $headers; do
1063             #which other headers each of the above headers needs?
1064             deps=$(echo "#include <$h>" | \
1065                    $aros_host_cc -E -M - 2>/dev/null | \
1066                    sed 's/^.*://; s/\\$/ /g; s/[[ \t]]\+/ /g')
1067             
1068             #copy all the needed headers to a directory beneath gendir
1069             for d in $deps; do
1070                 h=$(basename $d)
1071                 dir=${aros_target_cc_includes}$(echo $(dirname $d) | \
1072                                                 sed -n "s,^.*/include\(/.*\),\1,p")
1073                 ! test -d $dir && mkdir -p $dir
1074                 ! test -f $dir/$h && { cp $d $dir; chmod u+w $dir/$h; }
1075             done
1076         done        
1077     fi
1079 AC_MSG_RESULT($aros_target_cc_includes)
1081 dnl Check if user specified --with-resolution=XRESxYRESxDEPTH
1082 AC_MSG_CHECKING([for default resolution of WBScreen])
1083 AC_ARG_WITH(resolution,AC_HELP_STRING([--with-resolution=XRESxYRESxDEPTH],[Default resolution of the initial WorkbenchScreen]),resolution=$withval,resolution=none)
1084 # We require an argument, so map --with/--without ("yes"/"no") to "none" specified
1085 if test "$resolution" = "yes" ; then
1086     resolution="none"
1088 if test "$resolution" = "no" ; then
1089     resolution="none"
1091 if test "$resolution" != "none" ; then
1092     aros_default_wbwidth=`echo $resolution | cut -d'x' -f1`
1093     aros_default_wbheight=`echo $resolution | cut -d'x' -f2`
1094     aros_default_wbdepth=`echo $resolution | cut -d'x' -f3`
1096 AC_MSG_RESULT($aros_default_wbwidth x $aros_default_wbheight x $aros_default_wbdepth)
1097 aros_cv_default_wbwidth=$aros_default_wbwidth
1098 aros_cv_default_wbheight=$aros_default_wbheight
1099 aros_cv_default_wbdepth=$aros_default_wbdepth
1101 dnl See if the user wants the BOCHS hack for native flavour
1102 AC_MSG_CHECKING([if bochs hack is enabled])
1103 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")
1104 if test "$bochs_hack" = "yes" ; then
1105     aros_bochs_hack="1"
1107 AC_MSG_RESULT($bochs_hack)
1109 dnl See if the user wants the serial debug output for native flavour
1110 AC_MSG_CHECKING([if serial debug is enabled])
1111 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)
1112 if test "$serial_debug" = "yes" ; then
1113     serial_debug="2"
1115 if test "$serial_debug" = "no" ; then
1116     serial_debug="none"
1118 if test "$serial_debug" != "none" ; then
1119     aros_serial_debug=$serial_debug
1120     AC_MSG_RESULT(on port $serial_debug)
1121 else
1122     AC_MSG_RESULT(no)
1125 dnl See if the user wants the palm debug output hack for palm native flavour
1126 AC_MSG_CHECKING([if palm debug hack is enabled])
1127 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")
1128 if test "$palm_debug_hack" = "yes" ; then
1129     aros_palm_debug_hack="1"
1131 AC_MSG_RESULT($palm_debug_hack)
1134 dnl See if the user wants nesting supervisor activated for unix flavour
1135 AC_MSG_CHECKING([if nesting supervisor support is enabled])
1136 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")
1137 if test "$nesting_supervisor" = "yes" ; then
1138     aros_nesting_supervisor="1"
1140 AC_MSG_RESULT($nesting_supervisor)
1144 if test "$HAVE_XSHM_SUPPORT" = "1" ; then
1145   dnl See if the user wants the X11 MIT-SHM extension to be enabled
1146   AC_MSG_CHECKING([if X11 MIT-SHM extension is enabled])
1147   AC_ARG_ENABLE(xshm_extension,AC_HELP_STRING([--enable-xshm-extension],[Enable X11 MIT-SHM extension (default=yes)]),xshm_extension="$enableval",xshm_extension="yes")
1148   if test "$xshm_extension" = "no" ; then
1149       DO_XSHM_SUPPORT="0"
1150   fi
1151   AC_MSG_RESULT($xshm_extension)
1152 else
1153   DO_XSHM_SUPPORT="0"
1156 if test "$HAVE_VIDMODE_SUPPORT" = "1" ; then
1157   dnl See if the user wants the X11 vidmode extension to be enabled
1158   AC_MSG_CHECKING([if vidmode extension is enabled])
1159   AC_ARG_ENABLE(vidmodeextension,AC_HELP_STRING([--enable-vidmode-extension],[Enable X11 vidmode extension (default=yes)]),vidmode_extension="$enableval",vidmode_extension="yes")
1160   if test "$vidmode_extension" = "no" ; then
1161       DO_VIDMODE_SUPPORT="0"
1162   fi
1163   AC_MSG_RESULT($vidmode_extension)
1164 else
1165   DO_VIDMODE_SUPPORT="0"
1169 dnl See if the user wants dbus.library
1170 AC_MSG_CHECKING([if building of dbus.library is enabled])
1171 AC_ARG_ENABLE(dbus,AC_HELP_STRING([--enable-dbus],[Enable DBUS support via dbus.library (default=no)]),dbus="yes",dbus="no")
1172 if test "$dbus" = "yes" ; then
1173     ENABLE_DBUS=1
1174     DBUS_CFLAGS=`pkg-config --cflags dbus-1`
1175     DBUS_LIBFLAGS=`pkg-config --libs dbus-1`
1176     KERNEL_DBUS_KOBJ=kernel-dbus-kobj
1177     KERNEL_DBUS_INCLUDES=kernel-dbus-includes
1178 else
1179     ENABLE_DBUS=0
1181 AC_MSG_RESULT($dbus)
1184 dnl --------------------------------------------------------------------
1185 dnl Configuration Output Section
1186 dnl --------------------------------------------------------------------
1188 # Generic
1189 AC_SUBST(aros_arch)
1190 AC_SUBST(aros_cpu)
1191 AC_SUBST(aros_flavour)
1192 AC_SUBST(aros_flavour_uc)
1193 AC_SUBST(TOPDIR)
1195 # Host related
1196 AC_SUBST(aros_cc_pre)
1197 AC_SUBST(aros_host_strip)
1198 AC_SUBST(aros_host_arch)
1199 AC_SUBST(aros_host_cpu)
1200 AC_SUBST(aros_host_cc)
1201 AC_SUBST(aros_host_ar)
1202 AC_SUBST(aros_host_ranlib)
1203 AC_SUBST(aros_host_ld)
1204 AC_SUBST(aros_host_make)
1205 AC_SUBST(aros_host_cflags)
1206 AC_SUBST(aros_host_ldflags)
1207 AC_SUBST(aros_host_debug)
1208 AC_SUBST(aros_host_mkdep)
1209 AC_SUBST(aros_host_mkargs)
1210 AC_SUBST(aros_host_exe_suffix)
1211 AC_SUBST(aros_host_lib_suffix)
1212 AC_SUBST(aros_tools_dir)
1213 AC_SUBST(aros_host_aclocal)
1214 AC_SUBST(aros_host_autoconf)
1215 AC_SUBST(aros_host_autoheader)
1216 AC_SUBST(aros_host_automake)
1218 # Target Related
1219 AC_SUBST(aros_target_arch)
1220 AC_SUBST(aros_target_cpu)
1221 AC_SUBST(aros_target_variant)
1222 AC_SUBST(aros_target_suffix)
1223 AC_SUBST(aros_target_incl)
1224 AC_SUBST(aros_target_ar)
1225 AC_SUBST(aros_target_ranlib)
1226 AC_SUBST(aros_kernel_nm)
1227 AC_SUBST(aros_target_cc)
1228 AC_SUBST(aros_kernel_cc)
1229 AC_SUBST(aros_target_as)
1230 AC_SUBST(aros_target_ld)
1231 AC_SUBST(aros_kernel_ld)
1232 AC_SUBST(aros_target_cc_includes)
1233 AC_SUBST(aros_target_cc_path)
1234 AC_SUBST(aros_target_objdump)
1235 AC_SUBST(aros_target_objcopy)
1236 AC_SUBST(aros_target_strip)
1237 AC_SUBST(aros_target_nm)
1238 AC_SUBST(aros_shared_default)
1239 AC_SUBST(aros_shared_ld)
1240 AC_SUBST(aros_object_format)
1241 AC_SUBST(aros_compiler_libs)
1243 AC_SUBST(aros_config_cflags)
1244 AC_SUBST(aros_config_aflags)
1245 AC_SUBST(aros_config_ldflags)
1247 AC_SUBST(aros_shared_cflags)
1248 AC_SUBST(aros_shared_aflags)
1249 AC_SUBST(aros_shared_ldflags)
1250 AC_SUBST(aros_kernel_ldflags)
1251 AC_SUBST(aros_debug_cflags)
1252 AC_SUBST(aros_debug_aflags)
1253 AC_SUBST(aros_debug_ldflags)
1254 AC_SUBST(aros_target_genmap)
1255 AC_SUBST(aros_target_strip_flags)
1257 # Graphics Related
1258 AC_SUBST(aros_gui_libdir)
1259 AC_SUBST(aros_gui_ldflags)
1260 AC_SUBST(aros_gui_libflags)
1261 AC_SUBST(aros_gui_incdir)
1262 AC_SUBST(aros_gui_ccflags)
1264 AC_SUBST(aros_default_wbwidth)
1265 AC_SUBST(aros_default_wbheight)
1266 AC_SUBST(aros_default_wbdepth)
1267 AC_SUBST(DO_XSHM_SUPPORT)
1268 AC_SUBST(DO_VIDMODE_SUPPORT)
1270 # Native version related
1271 AC_SUBST(aros_bochs_hack)
1272 AC_SUBST(aros_serial_debug)
1274 # Palm native version related
1275 AC_SUBST(aros_palm_debug_hack)
1277 # Unix/Hosted version related
1278 AC_SUBST(aros_nesting_supervisor)
1280 # DBUS related
1281 AC_SUBST(ENABLE_DBUS)
1282 AC_SUBST(DBUS_CFLAGS)
1283 AC_SUBST(DBUS_LIBFLAGS)
1284 AC_SUBST(KERNEL_DBUS_KOBJ)
1285 AC_SUBST(KERNEL_DBUS_INCLUDES)
1287 # Debug related
1288 AC_SUBST(aros_debug)
1289 AC_SUBST(aros_mungwall_debug)
1290 AC_SUBST(aros_stack_debug)
1291 AC_SUBST(aros_modules_debug)
1293 # Collect-aros stuff: "-ius" to ignore undefined symbols
1294 AC_SUBST(ignore_undefined_symbols)
1296 # C compiler related
1297 AC_SUBST(gcc_target_cpu)
1299 dnl Prepare for output, make up all the generated patches
1300 case "$aros_flavour" in
1301 emulation)      aros_flavour_uc="AROS_FLAVOUR_EMULATION"
1302                 aros_flavour="emulation" ;;
1303 emulcompat)     aros_flavour_uc="(AROS_FLAVOUR_EMULATION|AROS_FLAVOUR_BINCOMPAT)"
1304                 aros_flavour="emulation" ;;
1305 standalone)     aros_flavour_uc="AROS_FLAVOUR_STANDALONE"
1306                 aros_flavour="standalone";;
1307 native)         aros_flavour_uc="AROS_FLAVOUR_NATIVE"
1308                 aros_flavour="native" ;;
1309 nativecompat)   aros_flavour_uc="(AROS_FLAVOUR_NATIVE|AROS_FLAVOUR_BINCOMPAT)"
1310                 aros_flavour="native" ;;
1311 linklib)        aros_flavour_uc="AROS_FLAVOUR_LINKLIB"
1312                 aros_flavour="linklib" ;;
1313 palmnative)     aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
1314                 aros_flavour="palmnative" ;;
1315 mac68knative)   aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
1316                 aros_flavour="mac68knative" ;;
1317 ppcnative)      aros_flavour_uc="(AROS_FLAVOUR_NATIVE|AROS_FLAVOUR_BINCOMPAT)"
1318                 aros_flavour="ppcnative" ;;
1319 esac
1321 if test -z "$aros_gui_basedir" ; then
1322     dnl Use X as the default GUI
1323     aros_gui_libdir="$x_libraries"
1324     if test -z "$x_libraries" ; then
1325         aros_gui_ldflags=""
1326     else
1327         aros_gui_ldflags="-L $x_libraries"
1328     fi
1329     if test "$HAVE_XSHM_SUPPORT" = "1" ; then
1330       aros_gui_libflags="-lX11 -lXext"
1331     else
1332       aros_gui_libflags="-lX11"
1333     fi
1334     if test "$HAVE_VIDMODE_SUPPORT" = "1"; then
1335       aros_gui_libflags="$aros_gui_libflags -lXxf86vm"
1336     fi
1337     
1338     aros_gui_incdir="$x_includes"
1339     if test -z "$x_includes" ; then
1340         aros_gui_ccflags=""
1341     else
1342         aros_gui_ccflags="-I $x_includes"
1343     fi
1344 else
1345     if test -n "$aros_gui_basedir" ; then
1346         aros_gui_libdir="${aros_gui_basedir}/lib"
1347         aros_gui_incdir="${aros_gui_basedir}/include"
1348     fi
1350     if test -n "$aros_gui_libdir" ; then
1351         aros_gui_ldflags="-L ${aros_gui_libdir}"
1352     fi
1354     if test -n "$aros_gui_incdir" ; then
1355         aros_gui_ccflags="-I ${aros_gui_incdir}"
1356     else
1357         aros_gui_incdir="${aros_sysincludes}"
1358         aros_gui_ccflags=""
1359     fi
1362 if test ! -d ${aros_inc_dir} ; then
1363     ${MKDIR} ${aros_inc_dir}
1365 if test ! -d ${aros_geninc_dir} ; then
1366     ${MKDIR} ${aros_geninc_dir}
1368 if test ! -d ${aros_hostcfg_dir} ; then
1369     ${MKDIR} ${aros_hostcfg_dir}
1371 if test ! -d ${aros_targetcfg_dir} ; then
1372     ${MKDIR} ${aros_targetcfg_dir}
1374 if test ! -d ${aros_tools_dir} ; then
1375     ${MKDIR} ${aros_tools_dir}
1377 if test ! -d ${aros_scripts_dir} ; then
1378     ${MKDIR} ${aros_scripts_dir}
1381 AC_CONFIG_HEADERS(${aros_geninc_dir}/host-conf.h:config/host-conf.h.in)
1383 AC_CONFIG_COMMANDS([compiler_executable],
1384     [
1385         prefix=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}
1386         mkdir -p $prefix
1387         prefix="${prefix}/${aros_target_cpu}-aros"
1388         prefix2=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros
1390         echo ${prefix}
1391         echo ${prefix2}
1392         chmod a+x ${prefix2}-gcc ${prefix2}-ld
1394         ln -sf ${prefix2}-gcc          ${prefix}-gcc
1395         ln -sf ${prefix2}-ld           ${prefix}-ld
1397         ln -sf $aros_target_as_ln      ${prefix}-as
1398         ln -sf $aros_target_nm_ln      ${prefix}-nm
1399         ln -sf $aros_target_ar_ln      ${prefix}-ar
1400         ln -sf $aros_target_ranlib_ln  ${prefix}-ranlib
1401         ln -sf $aros_target_objcopy_ln ${prefix}-objcopy
1402         ln -sf $aros_target_objdump_ln ${prefix}-objdump
1403         ln -sf $aros_target_strip_ln   ${prefix}-strip
1405         ln -sf $aros_target_as_ln      ${prefix2}-as
1406         ln -sf $aros_target_nm_ln      ${prefix2}-nm
1407         ln -sf $aros_target_ar_ln      ${prefix2}-ar
1408         ln -sf $aros_target_ranlib_ln  ${prefix2}-ranlib
1409         ln -sf $aros_target_objcopy_ln ${prefix2}-objcopy
1410         ln -sf $aros_target_objdump_ln ${prefix2}-objdump
1411         ln -sf $aros_target_strip_ln   ${prefix2}-strip
1412     ],
1413     [
1414         aros_tools_dir=${aros_tools_dir}
1415         aros_target_cpu=${aros_target_cpu}
1416         aros_target_arch=${aros_target_arch}
1417         aros_target_suffix=${aros_target_suffix}
1418         aros_target_nm_ln=${aros_target_nm_ln}
1419         aros_target_as_ln=${aros_target_as_ln}
1420         aros_target_ar_ln=${aros_target_ar_ln}
1421         aros_target_ranlib_ln=${aros_target_ranlib_ln}
1422         aros_target_objdump_ln=${aros_target_objdump_ln}
1423         aros_target_objcopy_ln=${aros_target_objcopy_ln}
1424         aros_target_strip_ln=${aros_target_strip_ln}
1425     ]
1427 AC_CONFIG_COMMANDS([genshared_executable],
1428     [chmod a+x ${aros_scripts_dir}/genshared],
1429     [aros_scripts_dir=${aros_scripts_dir}]
1431 AC_CONFIG_COMMANDS([genmf_executable],
1432     [chmod a+x ${aros_tools_dir}/genmf.py],
1433     [aros_tools_dir=${aros_tools_dir}]
1435 AC_CONFIG_COMMANDS([adflib_myaros.conf_executable],
1436     [chmod a+x tools/adflib/myconf.aros]
1439 AC_CONFIG_FILES(
1440     Makefile
1441     rom/mmakefile
1442     ${aros_inc_dir}/config.h:config/config.h.in
1443     ${aros_geninc_dir}/config.h:config/config.h.in
1444     ${aros_hostcfg_dir}/host.cfg:config/host.cfg.in
1445     ${aros_targetcfg_dir}/target.cfg:config/target.cfg.in
1446     mmake.config
1447     ${aros_targetcfg_dir}/make.defaults:config/make.defaults.in
1448     ${aros_targetcfg_dir}/specs:config/specs.in
1449     ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-gcc:scripts/aros-gcc.in
1450     ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-ld:scripts/aros-ld.in
1451     ${aros_scripts_dir}/genshared:compiler/c_lib/source/lib_source/genshared.in
1452     ${aros_tools_dir}/genmf.py:tools/genmf/genmf.py
1453     tools/adflib/myconf.aros
1454     tools/collect-aros/env.h
1457 AC_OUTPUT
1459 dnl This is in order to not define SHARED_CFLAGS sometimes
1460 dnl We don't always do aros_shared_ar, aros_shared_cflags
1462 #XXX compatability...
1463 aros_shared_ar="$aros_shared_ld $aros_shared_ldflags -o"
1465 if test -n "$aros_shared_cflags" ; then
1466     echo "SHARED_CFLAGS := $aros_shared_cflags" >> ${aros_hostcfg_dir}/host.cfg
1467     echo "SHARED_AR := $aros_shared_ar" >> ${aros_hostcfg_dir}/host.cfg