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