Bugfix for: [ 1942506 ] JanoEditor - Random characters in search field
[cake.git] / configure.in
blob74f61e9de5814456e44a97a725a3de2c46a47bf6
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.61)
17 AC_CONFIG_AUX_DIR(scripts/autoconf)
19 # Check what host we are running on.
20 # If a target is not suggested, we use this one.
21 # Note that what we call a target, Autoconf calls a host.
22 AC_CANONICAL_HOST
24 # The AROS target is slightly different to the normal GNU style
25 # format. We don't have the middle part, and we reverse the order
26 # of the $(CPU) and $(OS) bits.
28 # Don't strip the version of the target yet, it might be
29 # useful on some systems.
31 AC_MSG_CHECKING([for AROS style target])
33 if test "$target" = "NONE" ; then
34     target=$host_os-$host_cpu
35     cross_compile=no
36 else
37     if test "$target" = "" ; then
38         target=$host_os-$host_cpu
39         cross_compile=no
40     else
41         cross_compile=yes
42     fi
44 AC_MSG_RESULT($target)
46 #don't know where else to put this...
47 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         ;;
280     mingw32*)
281         aros_host_arch="mingw32"
282         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
283         case "$host_cpu" in
284             *i?86*)
285                 aros_host_cpu="i386"
286                 ;;
287             *)
288                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
289                 aros_host_cpu="$host_cpu"
290                 ;;
291         esac
292         ;;
293     *)
294         AC_MSG_ERROR([Unsupported host architecture $host])
295         ;;
296 esac
298 AROS_PROG(aros_host_ar,[ar],[cr])
299 AROS_REQUIRED(ar,$aros_host_ar)
300 AROS_PROG(aros_host_ranlib,ranlib)
301 AROS_REQUIRED(ranlib,$aros_host_ranlib)
302 AROS_PROG(aros_host_strip,strip)
303 AROS_REQUIRED(strip,$aros_host_strip)
305 AROS_PROG(RM,[rm],[-rf])
306 AROS_REQUIRED(rm,$RM)
307 AROS_PROG(CP,[cp])
308 AROS_REQUIRED(cp,$CP)
309 AROS_PROG(MV,[mv])
310 AROS_REQUIRED(mv,$MV)
311 AROS_PROG(ECHO,[echo])
312 AROS_REQUIRED(echo,$ECHO)
313 AROS_PROG(MKDIR,[mkdir],[-p])
314 AROS_REQUIRED(mkdir,$MKDIR)
315 AROS_PROG(TOUCH,[touch])
316 AROS_REQUIRED(touch,$TOUCH)
317 AROS_PROG(SORT,[sort])
318 AROS_REQUIRED(sort,$SORT)
319 AROS_PROG(UNIQ,[uniq])
320 AROS_REQUIRED(uniq,$UNIQ)
321 AROS_PROG(NOP,[true])
322 AROS_REQUIRED(true,$NOP)
323 AROS_PROG(CAT,[cat])
324 AROS_REQUIRED(cat,$CAT)
325 AROS_PROG(BISON,[bison])
326 AROS_REQUIRED(bison,$BISON)
327 AROS_PROG(FLEX,[flex])
328 AROS_REQUIRED(flex,$FLEX)
329 AROS_PROG(PNGTOPNM,[pngtopnm])
330 AROS_REQUIRED(pngtopnm,$PNGTOPNM)
331 AROS_PROG(PPMTOILBM,[ppmtoilbm])
332 AROS_REQUIRED(ppmtoilbm,$PPMTOILBM)
333 AROS_PROG(SED,[sed])
334 AROS_REQUIRED(sed,$SED)
335 AROS_PROG(CHMOD,[chmod])
336 AROS_REQUIRED(chmod,$CHMOD)
338 AM_PATH_PYTHON(2.2.1)
340 AC_SUBST(FOR, for)
341 AC_SUBST(IF, if)
342 AC_SUBST(TEST, test)
343 AC_SUBST(CMP, cmp)
345 dnl ---------------------------------------------------------------------------
346 dnl Look for things about the host system, good for hosted targets.
347 dnl ---------------------------------------------------------------------------
349 # Check for some includes for the X11 HIDD and the kernel
350 AC_CHECK_HEADERS([sys/ipc.h sys/shm.h \
351     sys/mmap.h sys/mman.h sysexits.h \
352     sys/statfs.h sys/statvfs.h sys/vfs.h sys/param.h \
355 AC_CHECK_HEADERS([sys/mount.h],,,[#include <sys/param.h>])
357 AC_HEADER_DIRENT
358 AC_HEADER_STAT
359 AC_HEADER_STDC
360 AC_HEADER_SYS_WAIT
361 AC_HEADER_TIME
362 AC_STRUCT_ST_BLKSIZE
363 AC_STRUCT_ST_BLOCKS
364 AC_STRUCT_ST_RDEV
365 AC_STRUCT_TM
366 AC_STRUCT_TIMEZONE
367 AC_TYPE_OFF_T
368 AC_TYPE_PID_T
369 AC_TYPE_SIZE_T
370 AC_TYPE_UID_T
372 AC_CHECK_MEMBERS(struct tm.tm_gmtoff)
374 # Look for some functions
375 AC_CHECK_FUNCS([getpagesize kqueue statfs statvfs \
376     clone kse_create rfork_thread thr_create sa_register \
377     getcontext makecontext setcontext sigaltstack swapcontext])
379 AC_FUNC_MMAP
382 dnl --------------------------------------------------------------------
383 dnl Target Configuration Section
384 dnl --------------------------------------------------------------------
386 dnl The target configuration section is responsible for setting up all
387 dnl the paths for includes, and tools required to build AROS to some
388 dnl particular target.
390 aros_config_cflags="-Wall -Werror-implicit-function-declaration"
391 aros_config_aflags="-Wall -x assembler-with-cpp -c"
392 aros_config_ldflags=""
394 aros_shared_default=yes
396 aros_shared_cflags="-fPIC"
397 aros_shared_aflags=""
398 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
399 aros_kernel_ldflags="-Wl,-rpath,./lib"
401 aros_target_ar_flags="cr"
402 aros_target_nm_flags="-C -ul"
403 aros_target_strip_flags="--strip-unneeded -R.comment"
405 aros_compiler_libs=
407 aros_target_genmap="-Wl,-Map -Xlinker"
409 # Native flavour stuff
410 aros_bochs_hack="0"
411 aros_serial_debug="0"
413 # Palm native flavour stuff
414 aros_palm_debug_hack="0"
416 # Unix flavour stuff
417 aros_nesting_supervisor="0"
419 # Collect-aros stuff: "-ius" to ignore undefined symbols
420 ignore_undefined_symbols=""
422 #-----------------------------------------------------------------------------
425 # GCC 4.1+ has a stack protection feature that requires OS support. Ubuntu has
426 # it switched on by default, and we use the host compiler, so it compiles AROS
427 # code with this enabled resulting in link failures as we don't have support
428 # for it.
430 # We use two methods to disable it. For the host compiler (used to compile
431 # some hosted modules), we test to see if the compiler supports stack
432 # protection, and if it does we disable it in AROS_CONFIG_CFLAGS. This should
433 # work on all platforms.
435 # For the "cross" compiler we clear the "ssp_default" spec in config/specs.in
436 # (this is done unconditionally, as it should have no effect on compilers
437 # without the stack protection feature). This may be specific to the way that
438 # Ubuntu enables the feature, so may not work everywhere. My specs-fu isn't
439 # strong enough to disable it in a generic way though, so we'll live with it
440 # until another vendor ships GCC with it enabled in a different way, and deal
441 # with it then.
444 AC_MSG_CHECKING([whether ${CC} accepts -fno-stack-protector])
445 save_cflags="$CFLAGS"
446 CFLAGS="$CFLAGS -fno-stack-protector"
447 AC_TRY_COMPILE(,, use_no_stack_protector="yes", use_no_stack_protector="no")
448 AC_MSG_RESULT($use_no_stack_protector)
449 if test "x-$use_no_stack_protector" = "x-yes" ; then
450     aros_config_cflags="$aros_config_cflags -fno-stack-protector"
452 CFLAGS="$save_cflags"
454 #-----------------------------------------------------------------------------
456 # Disable pointer-signedness warnings if the compiler recognises the option
457 # (this only works for the host compiler at the moment)
459 AC_MSG_CHECKING([whether ${CC} accepts -Wno-pointer-sign])
460 save_cflags="$CFLAGS"
461 CFLAGS="$CFLAGS -Wno-pointer-sign"
462 AC_TRY_COMPILE(,, use_no_sign_warning="yes", use_no_sign_warning="no")
463 AC_MSG_RESULT($use_no_sign_warning)
464 if test "x-$use_no_sign_warning" = "x-yesnnn" ; then
465     aros_host_cflags="$aros_host_cflags -Wno-pointer-sign"
467 CFLAGS="$save_cflags"
469 #-----------------------------------------------------------------------------
471 AC_MSG_CHECKING([for type of build])
472 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")
474 if test "$build_type" = "nightly"; then
475     build_type_string="NIGHTLY"
476 elif test "$build_type" = "snapshot"; then
477     build_type_string="SNAPSHOT"
478 elif test "$build_type" = "milestone"; then
479     build_type_string="MILESTONE"
480 elif test "$build_type" = "release"; then
481     build_type_string="RELEASE"
482 else
483     build_type_string="PERSONAL"
484     build_type="personal"
487 aros_config_cflags="$aros_config_cflags -DAROS_BUILD_TYPE=AROS_BUILD_TYPE_$build_type_string"
489 AC_MSG_RESULT($build_type)
491 #-----------------------------------------------------------------------------
492 all_debug_types="messages stack mungwall modules symbols"
494 AC_MSG_CHECKING([which debug types to enable])
495 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)]),
496  debug="$enableval",debug="")
498 if test "$debug" = "" -o "$debug" = "no"; then
499     debug="none"
500 elif test "$debug" = "yes"; then
501     debug="all"
504 if test "$debug" = "all" ; then
505     debug=$all_debug_types
506     for d in $all_debug_types; do
507         export aros_${d}_debug="1"
508     done
509 else
510     for d in $all_debug_types; do
511         export aros_${d}_debug="0"
512     done
515 if test "$debug" != "none"; then
516     debug=`echo $debug | sed s/,/\ /g`
517     for d in $debug; do
518         found="0"
519         for d2 in $all_debug_types; do
520             if test "$d2" = "$d"; then
521                 found="1"
522                 break
523             fi
524         done
525         if test "$found" = "0"; then
526             AC_MSG_ERROR([unrecognized debug type "$d". Available types are: all none $all_debug_types])
527         fi
528         export aros_${d}_debug="1"
529     done
530     aros_debug="yes"
532 AC_MSG_RESULT($debug)
534 if test "$aros_messages_debug" = "1"; then
535     aros_messages_debug="-DADEBUG=1 -DMDEBUG=1"
536 else
537     aros_messages_debug=""
539 if test "$aros_symbols_debug" = "1"; then
540     aros_symbols_debug="-g"
541 else
542     aros_symbols_debug=""
545 # These are the flags to pass when compiling debugged programs
546 aros_debug_cflags="$aros_symbols_debug $aros_messages_debug"
547 aros_debug_aflags=""
548 aros_debug_ldflags="$aros_symbols_debug"
550 #-----------------------------------------------------------------------------
551 #   Checking for distcc and ccache.
553 #   Always apply the transforms in this particular order. Basically you should
554 #   always run 'ccache distcc compiler' in that order for the best performance.
556 AC_MSG_CHECKING([whether to enable distcc])
557 AC_ARG_ENABLE(distcc,AC_HELP_STRING([--enable-distcc],[Use distcc as a front end to the compiler (default=no).]),distcc="$enableval",distcc="no")
558 if test "$distcc" != "" -a "$distcc" != "no"; then
559     # AC_CHECK_PROG will print out the result in this case
560     AC_PATH_PROG(DISTCC,[distcc],distcc,)
561 else
562     AC_MSG_RESULT(no)
565 AC_MSG_CHECKING([whether to enable ccache])
566 AC_ARG_ENABLE(ccache,AC_HELP_STRING([--enable-ccache],[Use ccache as a front end to the compiler (default=no).]),ccache="$enableval",ccache="no")
567 if test "$ccache" != "" -a "$ccache" != "no"; then
568     # AC_CHECK_PROG will print out the result in this case
569     AC_CHECK_PROG(CCACHE,[ccache],ccache,)
570 else
571     AC_MSG_RESULT(no)
574 #-----------------------------------------------------------------------------
575 AC_MSG_CHECKING([what optimization flags to use])
576 AC_ARG_WITH(optimization,AC_HELP_STRING([--with-optimization=FLAGS],[Use optimization flags FLAGS (default=-O2).]),optimization="$withval",optimization="unknown")
577 if test "$optimization" = "unknown"; then
578     dnl default is -O2 for normal builds, -O0 for debug builds
579     if test "$debug" != "none"; then
580         optimization="-O0"
581     else
582         optimization="-O2"
583     fi
585 aros_config_cflags="$aros_config_cflags $optimization"
586 AC_MSG_RESULT($optimization)
588 #-----------------------------------------------------------------------------
589 AC_MSG_CHECKING([what target variant to enable])
590 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")
591 if test "$target_variant" = "none"; then
592     aros_target_variant=""
593     aros_target_suffix=""
594 else
595     aros_target_variant="$target_variant"
596     aros_target_suffix="-$target_variant"
598 AC_MSG_RESULT($enableval)
600 target_bootloader="none"
602 #-----------------------------------------------------------------------------
603 # This is the target configuration switch.
604 case "$target_os" in
605     linux*)
606         aros_target_arch="linux"
607         case "$target_cpu" in
608             *m68k*)
609                 aros_target_cpu="m68k"
610                 aros_object_format="m68kelf"
611                 aros_flavour="emulcompat"
612                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D__mc68000 -D__linux__"
613                 aros_shared_ldflags="-Wl,-T,\$(TOP)/config/linux/m68k/script.so"
614                 aros_kernel_ldflags="-Wl,-rpath,./lib,-T,\$(TOP)/config/linux/m68k/script.normal"
615                 gcc_target_cpu="mc68000"
616                 ;;
617             *i?86*)
618                 aros_target_cpu="i386"
619                 aros_object_format="elf_i386"
620                 aros_flavour="emulation"
621                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__linux__"
622                 aros_default_wbdepth=8
623                 gcc_target_cpu="i386"
624                 ;;
625             *x86_64*)
626                 aros_target_cpu="x86_64"
627                 aros_object_format="elf_x86_64"
628                 aros_flavour="emulation"
629                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64 -D__linux__"
630                 aros_default_wbdepth=8
631                 gcc_target_cpu="x86_64"
632                 ;;
633             *powerpc*)
634                 aros_target_cpu="ppc"
635                 aros_object_format="elf32ppc"
636                 aros_flavour="emulation"
637                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc -D__linux__"
638                 aros_default_wbdepth=8
639                 gcc_target_cpu="ppc"
640                 ;;
641             *)
642                 AC_MSG_ERROR("Unknown CPU for Linux -- $target_cpu")
643                 ;;
644         esac
645     ;;
647     pc)
648         aros_target_arch="pc"
649         aros_shared_default="no"
650         target_bootloader="grub"
651         case "$target_cpu" in
652             *i?86*)
653                 aros_target_cpu="i386"
655                 dnl If somebody hasn't already set the target object
656                 dnl format, then use this value. Mostly to support
657                 dnl FreeBSD cross-compilation.
658                 dnl TODO: Remove when we always use our compiler.
660                 if test "$aros_object_format" = "" ; then
661                     aros_object_format="elf_i386"
662                 fi
663                 aros_flavour="standalone"
664                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
665                 aros_kernel_ldflags=""
666                 aros_default_wbwidth=640
667                 aros_default_wbheight=480
668                 gcc_target_cpu="i386"
669                 ;;
670             *x86_64*)
671                 aros_target_cpu="x86_64"
672                 if test "$aros_object_format" = "" ; then
673                     aros_object_format="elf_x86_64"
674                 fi
675                 aros_flavour="standalone"
676                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64"
677                 aros_config_cflags="$aros_config_cflags -fno-asynchronous-unwind-tables -mno-red-zone"
678                 aros_kernel_ldflags=""
679                 aros_default_wbwidth=640
680                 aros_default_wbheight=480
681                 gcc_target_cpu="x86_64"
682                 ;;
683             *)
684                 AC_MSG_ERROR("Unknown native CPU -- $target_cpu")
685                 ;;
686         esac
687         ;;
689     prep)
690         aros_target_arch="prep"
691         aros_shared_default="no"
692         aros_target_cpu="ppc"
693         aros_object_format="elf32ppc"
694         aros_flavour="ppcnative"
695         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
696         aros_kernel_ldflags=""
697         aros_default_wbwidth=640
698         aros_default_wbheight=480
699         gcc_target_cpu="ppc"
700         case "$target_cpu" in
701             *cross*)
702                 aros_target_cc="ppc-linux-gcc -pipe"
703                 aros_target_ld="ppc-linux-ld"
704                 aros_target_as="ppc-linux-as"
705                 aros_target_ar="ppc-linux-ar"
706                 aros_target_ranlib="ppc-linux-ranlib"
707                 aros_target_nm="ppc-linux-nm"
708                 aros_target_strip="ppc-linux-strip"
709                 aros_target_objcopy="ppc-linux-objcopy"
710                 aros_target_objdump="ppc-linux-objdump"
711                 aros_shared_ld="ppc-linux-ld"
712                 aros_kernel_ld="ppc-linux-ld"
713                 ;;
714             *)
715                 ;;
716         esac
717         ;;
719     freebsd*)
720         aros_target_arch="freebsd"
721         aros_target_cpu="i386"
722         aros_flavour="emulation"
723         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
724         gcc_target_cpu="i386"
726         aros_target_strip_flags="-x"
727         ;;
729     darwin*)
730         aros_target_arch="darwin"
731         aros_target_cpu="i386"
732         aros_flavour="emulation"
733         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
734         gcc_target_cpu="i386"
736         aros_target_strip_flags="-x"
737         ;;
739     netbsd*)
740         aros_target_arch="netbsd"
741         case "$target_cpu" in
742             *m68k*)
743                 aros_target_cpu="m68k"
744                 aros_object_format="m68kelf"
745                 aros_flavour="emulcompat"
746                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D__mc68000 -D__NetBSD__"
747                 gcc_target_cpu="mc68000"
748                 ;;
749             *i?86*)
750                 aros_target_cpu="i386"
751                 aros_object_format="elf_i386"
752                 aros_flavour="emulation"
753                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__NetBSD__"
754                 aros_default_wbdepth=8
755                 gcc_target_cpu="i386"
756                 ;;
757             *)
758                 AC_MSG_ERROR("Unknown CPU for NetBSD -- $target_cpu")
759                 ;;
760         esac
761         aros_target_genmap="-Wl,-M -Xlinker >"
762         aros_flavour="emulation"
763         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
764         ;;   
766     openbsd*)
767         aros_target_arch="openbsd"
768         case "$target_cpu" in
769             *i?86*)
770                 aros_target_cpu="i386"
771                 aros_object_format="elf_i386"
772                 aros_flavour="emulation"
773                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__OpenBSD__"
774                 gcc_target_cpu="i386"
775                 ;;
776             *)
777                 AC_MSG_ERROR("Unknown CPU for OpenBSD -- $target_cpu")
778                 ;;
779         esac
780         aros_target_genmap="-Wl,-M -Xlinker >"
781         aros_target_nm_flags="-u"
782         aros_flavour="emulation"
783         ;;
785     solaris*)
786         aros_target_arch="solaris"
787         case "$target_cpu" in
788             *sparc*)
789                 aros_target_cpu="sparc"
790                 aros_object_format="elf_sparc"
791                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dsparc -D__Solaris__"
792                 gcc_target_cpu="sparc"
793                 ;;
794             *)
795                 AC_MSG_ERROR("Unknown CPU for Solaris -- $target_cpu")
796                 ;;
797         esac
798         aros_config_cflags="$aros_config_cflags -D$aros_target_cpu"
799         aros_flavour="emulation"
800         ;;
802     morphos*)
803         aros_target_arch="morphos"
804         aros_shared_default="no"
805         aros_target_cpu="ppc"
806         aros_object_format="elf_ppc"
807         aros_flavour="nativecompat"
808         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
809         gcc_target_cpu="ppc"
810         ;;
812     sam440)
813         aros_target_arch="sam440"
814         aros_shared_default="no"
815         aros_target_cpu="ppc"
816         aros_object_format="elf32ppc"
817         aros_flavour="ppcnative"
818         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
819         aros_kernel_ldflags=""
820         aros_default_wbwidth=640
821         aros_default_wbheight=480
822         aros_config_cflags="$aros_config_cflags -mcpu=440fp -mno-toc -fno-asynchronous-unwind-tables"
823         gcc_target_cpu="powerpc"
824         case "$target_cpu" in
825             *powerpc*)
826                 aros_target_cc="powerpc-linux-gcc -pipe"
827                 aros_target_ld="powerpc-linux-ld"
828                 aros_target_as="powerpc-linux-as"
829                 aros_target_ar="powerpc-linux-ar"
830                 aros_target_ranlib="powerpc-linux-ranlib"
831                 aros_target_nm="powerpc-linux-nm"
832                 aros_target_strip="powerpc-linux-strip"
833                 aros_target_objcopy="powerpc-linux-objcopy"
834                 aros_target_objdump="powerpc-linux-objdump"
835                 aros_shared_ld="powerpc-linux-ld"
836                 aros_kernel_ld="powerpc-linux-ld"
837                 ;;
838             *)
839                 ;;
840         esac
841         ;;
843     amiga*)
844         aros_target_arch="amiga"
845         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D_AMIGA -DAMIGA"
846         aros_shared_default="no"
848         aros_config_cflags="$aros_config_cflags -fomit-frame-pointer -fbuiltin -ffreestanding"
850         case "$target_cpu" in
851             *m68k*)
852                 aros_target_cpu="m68k"
853                 aros_object_format="m68kelf"
854                 aros_flavour="nativecompat"
855                 gcc_target_cpu="mc68000"
856                 ;;
857             *ppc*)
858                 aros_cpu="ppc"
859                 aros_flavour="native"
860                 gcc_target_cpu="ppc"
861                 ;;
862             *)
863                 AC_MSG_ERROR("Unknown CPU for Amiga $target_cpu")
864                 ;;
865         esac
866         ;;
868     cygwin*)
869         aros_target_arch="cygwin"
870         aros_shared_default="no"
871         case "$target_cpu" in
872             *i?86*)
873                 aros_target_cpu="i386"
874                 aros_object_format="elf_i386"
875                 aros_flavour="emulation"
876                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__CYGWIN32__"
877                 aros_shared_cflags=""
878                 aros_default_wbdepth=8
879                 gcc_target_cpu="i386"
880                 ;;
881             *)
882                 AC_MSG_ERROR("Unknown CPU for CygWin -- $target_cpu")
883                 ;;
884         esac
885     ;;
887     mingw32*)
888         aros_target_arch="mingw32"
889         aros_shared_default="no"
890         case "$target_cpu" in
891             *i?86*)
892                 aros_target_cpu="i386"
893                 aros_object_format="elf_i386"
894                 aros_flavour="emulation"
895                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
896                 aros_shared_cflags=""
897                 aros_default_wbdepth=8
898                 gcc_target_cpu="i386"
899                 ;;
900             *)
901                 AC_MSG_ERROR("Unknown CPU for Mingw32 -- $target_cpu")
902                 ;;
903         esac
904     ;;
905     pp*)
906         aros_target_arch="pp"
907         aros_shared_default="no"
908         case "$target_cpu" in
909             *m68k*)
910                 aros_target_cpu="m68k"
911                 aros_object_format="m68kelf"
912                 aros_flavour="palmnative"
913                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
914                 aros_kernel_ldflags=""
915                 aros_default_wbwidth=160
916                 aros_default_wbheight=160
917                 aros_default_wbdepth=1
918                 aros_target_cc="m68k-elf-gcc -pipe"
919                 aros_target_ld="$(which m68k-elf-ld)"
920                 aros_target_as="m68k-elf-gcc -pipe"
921                 aros_shared_ld="m68k-elf-gcc"
922                 aros_kernel_ld="m68k-elf-gcc"
923                 aros_target_ar="m68k-elf-ar"
924                 aros_target_ar_flags="cru"
925                 aros_target_ranlib="m68k-elf-ranlib"
926                 aros_target_nm="m68k-elf-nm"
927                 aros_target_objcopy="m68k-elf-objcopy"
928                 aros_target_objdump="m68k-elf-objdump"
929                 aros_compiler_libs="-lgcc1"
930                 aros_shared_default=no
931                 aros_shared_cflags="-fpic"
932                 aros_shared_aflags=""
933                 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
934                 aros_kernel_ldflags="-Wl,-rpath,./lib"
935                 aros_debug_cflags="-Wall -Werror-implicit-function-declaration $aros_symbols_debug  $aros_messages_debug -mc68000 -Wa,-mc68000"
936                 aros_debug_aflags=""
937                 aros_debug_ldflags="$aros_symbols_debug"
938                 aros_mungwall_debug="0"
939                 aros_modules_debug="0"
940                 gcc_target_cpu="mc68000"
941                 ignore_undefined_symbols="-ius"
942                 ;;
943            *)
944                 AC_MSG_ERROR("Unknown CPU for PalmPilot -- $target_cpu")
945                 ;;
946         esac
947         ;;
949     mac*)
950         aros_target_arch="mac"
951         aros_shared_default="no"
952         case "$target_cpu" in
953             *m68k*)
954                 aros_target_cpu="m68k"
955                 aros_object_format="m68kelf"
956                 aros_flavour="mac68knative"
957                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
958                 aros_default_wbwidth=512
959                 aros_default_wbheight=384
960                 aros_default_wbdepth=8
961                 aros_target_cc="m68k-elf-gcc -pipe"
962                 aros_target_ld="$(which m68k-elf-ld)"
963                 aros_target_as="m68k-elf-gcc -pipe"
964                 aros_shared_ld="m68k-elf-gcc"
965                 aros_kernel_ld="m68k-elf-gcc"
966                 aros_target_ar="m68k-elf-ar"
967                 aros_target_ar_flags="cru"
968                 aros_target_ranlib="m68k-elf-ranlib"
969                 aros_target_nm="m68k-elf-nm"
970                 aros_target_objcopy="m68k-elf-objcopy"
971                 aros_target_objdump="m68k-elf-objdump"
972                 aros_compiler_libs="-lgcc1"
973                 aros_shared_default=no
974                 aros_shared_cflags="-fpic"
975                 aros_shared_aflags=""
976                 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
977                 aros_kernel_ldflags="-Wl,-rpath,./lib"
978                 aros_debug_cflags="-Wall -Werror-implicit-function-declaration $aros_symbols_debug  $aros_messages_debug -mc68000"
979                 aros_debug_aflags=""
980                 aros_debug_ldflags="$aros_symbols_debug"
981                 aros_mungwall_debug="0"
982                 aros_modules_debug="0"
983                 gcc_target_cpu="mc68000"
984                 ignore_undefined_symbols="-ius"
985                 ;;
986            *)
987                 AC_MSG_ERROR("Unknown CPU for Mac68k -- $target_cpu")
988                 ;;
989         esac
990         ;;
992     *)
993         AC_MSG_ERROR([Unsupported target architecture $target])
994         ;;
995 esac
997 AC_MSG_CHECKING([which bootloader to use])
998 AC_ARG_ENABLE(bootloader,AC_HELP_STRING([--enable-bootloader=NAME],[Enable a specific bootloader]),target_bootloader=$enableval,target_bootloader=$target_bootloader)
999 if test "$target_bootloader" = "none"; then
1000     aros_target_bootloader=""
1001 else
1002     aros_target_bootloader="$target_bootloader"
1004 AC_MSG_RESULT($target_bootloader)
1006 # Check LZO when compiling the grub2 bootloader on i386/x86_64.
1007 aros_liblzo_check="no"
1008 case "$aros_target_bootloader" in
1009     grub2*)
1010     case "$target_cpu" in
1011         *i?86*)
1012         aros_liblzo_check="yes"
1013         ;;
1014         *x86_64*)
1015         aros_liblzo_check="yes"  
1016         ;;
1017         *)
1018         ;;
1019     esac
1020   
1021     ;;
1022    *)
1023     ;;
1024 esac
1026 if test "$aros_liblzo_check" = "yes"; then
1027     # There are three possibilities. LZO version 2 installed with the name
1028     # liblzo2, with the name liblzo, and LZO version 1.  
1029     AC_CHECK_LIB(lzo2, __lzo_init_v2, [LIBLZO="-llzo2"],  
1030     AC_CHECK_LIB(lzo, __lzo_init_v2, [LIBLZO="-llzo"],
1031                 AC_CHECK_LIB(lzo, __lzo_init2, [LIBLZO="-llzo"],
1032                 AC_MSG_ERROR([LZO library version 1.02 or later is required]))))
1034     AC_SUBST(LIBLZO)
1035     LIBS="$LIBS $LIBLZO"
1036     AC_CHECK_FUNC(lzo1x_999_compress, ,
1037                 [AC_MSG_ERROR([LZO1X-999 must be enabled])])
1039     # LZO version 2 uses lzo/lzo1x.h, while LZO version 1 uses lzo1x.h.
1040     AC_CHECK_HEADERS(lzo/lzo1x.h lzo1x.h)
1043 AC_MSG_CHECKING([which GUI Theme to use])
1044 AC_ARG_ENABLE(theme,AC_HELP_STRING([--enable-theme=NAME],[Enable a specific GUI Theme]),target_guitheme=$enableval,target_guitheme="default")
1045 if test "$target_guitheme" = "default"; then
1046     aros_target_guitheme="Ice"
1047 else
1048     aros_target_guitheme="$target_guitheme"
1050 AC_MSG_RESULT($aros_target_guitheme)
1052 # Find out if we are cross-compiling (ie. if we can't use the host compiler
1053 # for target code)
1054 cross_compiling=no
1055 if test "$aros_host_cpu" != "$aros_target_cpu" ; then
1056     cross_compiling=yes
1058 if test "$aros_host_arch" == "darwin" ; then
1059     cross_compiling=yes
1062 # Set prefix for target compiler etc. if we're cross-compiling
1063 # (should possibly be earlier but needs to be after AC_PROG_CC)
1064 if test "$cross_compiling" = "yes" ; then
1065     target_tool_prefix=${target_cpu}-elf-
1066     CC=${target_tool_prefix}gcc
1069 # Find all the tools we need to compile. This could be cross-compiling
1070 # though! If that is the case we use the GNU form of the target and
1071 # simply add this to the front of the binary name. This is rather simple,
1072 # but it should work under most circumstances.
1074 # The default tools are to use the same as the host, but only if the
1075 # host and target CPU are the same. With GCC this is normally enough.
1078 aros_cc_pre=""
1079 aros_shared_ld="$aros_host_ld"
1081 aros_target_mkdep="$aros_host_mkdep"
1082 aros_target_incl_def="$aros_host_incl"
1084 AC_PATH_PROG(aros_kernel_cc,$CC)
1086 # The default tools executables to be linked to.
1087 AROS_TOOL_TARGET(aros_target_as_ln,as)
1088 AROS_REQUIRED(as,$aros_target_as_ln)
1089 AROS_TOOL_TARGET(aros_kernel_ld,ld)
1090 AROS_REQUIRED(ld,$aros_kernel_ld)
1091 AROS_TOOL_TARGET(aros_target_ar_ln,ar)
1092 AROS_REQUIRED(ar,$aros_target_ar_ln)
1093 AROS_TOOL_TARGET(aros_target_nm_ln,nm)
1094 AROS_REQUIRED(nm,$aros_target_nm_ln)
1095 AROS_TOOL_TARGET(aros_target_objcopy_ln,objcopy)
1096 AROS_REQUIRED(objcopy,$aros_target_objcopy_ln)
1097 AROS_TOOL_TARGET(aros_target_objdump_ln,objdump)
1098 AROS_REQUIRED(objdump,$aros_target_objdump_ln)
1099 AROS_TOOL_TARGET(aros_target_ranlib_ln,ranlib)
1100 AROS_REQUIRED(ranlib,$aros_target_ranlib_ln)
1101 AROS_TOOL_TARGET(aros_target_strip_ln,strip)
1102 AROS_REQUIRED(strip,$aros_target_strip_ln)
1104 if test "$GCC" = "yes"; then
1105     aros_target_cc_path=`$aros_kernel_cc -print-search-dirs | grep "programs: =" | cut -c 12-`
1108 aros_hostcfg_dir="bin/${aros_host_arch}-${aros_host_cpu}/gen/config"
1109 aros_targetcfg_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/config"
1110 aros_inc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/AROS/Development/include/aros"
1111 aros_gendir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen"
1112 aros_geninc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/include/aros"
1113 aros_tools_dir="bin/${aros_host_arch}-${aros_host_cpu}/tools"
1114 aros_scripts_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/scripts"
1116 # aros_cc_pre is a variable that is added to the front of the compiler name
1117 # in the generated aros-gcc shell script. We need this to enable the cache
1118 # to work across cleaned builds. Also, support DISTCC using the correct
1119 # environment variable.
1122 if test "x${DISTCC}" != "x" ; then
1123     if test "x${CCACHE}" != "x" ; then
1124         aros_cc_pre="env CCACHE_PREFIX=${DISTCC} ${CCACHE} "
1125     else
1126         aros_cc_pre="${DISTCC} "
1127     fi
1128 else
1129     if test "x${CCACHE}" != "x" ; then
1130         aros_cc_pre="${CCACHE} "
1131     fi
1134 prefix="${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros"
1136 AC_SUBST(aros_target_nostdinc_cflags,-nostdinc)
1137 AC_SUBST(aros_target_nostartup_ldflags,-nostartfiles)
1138 AC_SUBST(aros_target_nix_ldflags,-nix)
1139 AC_SUBST(aros_target_detach_ldflags,-detach)
1140 AC_SUBST(aros_target_nostdlib_ldflags,-nostdlib)
1142 # Target tools
1143 aros_target_cc="${prefix}-gcc"
1144 aros_target_as="${prefix}-as"
1145 aros_target_ld="${prefix}-ld"
1146 aros_target_ar="${prefix}-ar $aros_target_ar_flags"
1147 aros_target_objcopy=${prefix}-objcopy
1148 aros_target_objdump=${prefix}-objdump
1149 aros_target_ranlib="${prefix}-ranlib $aros_target_ranlib_flags"
1150 aros_target_nm="${prefix}-nm $aros_target_nm_flags"
1151 aros_kernel_nm="${prefix}-nm"
1152 aros_target_strip=${prefix}-strip
1154 # Find the system include path. We can suggest that an alternative is
1155 # used if we don't get it correct. The default is to use /usr/include.
1156 # Which is set in the aros_target_incl_def variable.
1158 AC_ARG_ENABLE(includes,
1159 AC_HELP_STRING([--enable-includes=dir],[Alternative system include directory]),
1160 [aros_target_incl=$enable_includes], [aros_target_incl=$aros_target_incl_def])
1162 dnl find out about the target cc's include path
1163 AC_MSG_CHECKING([for the target compiler's include path])
1164 if test "$aros_target_cc_includes" = "" ; then
1165     #try to guess where the directory is
1166     aros_target_cc_includes=`dirname \`${aros_kernel_cc} -print-libgcc-file-name\``/include
1167     if ! test -d $aros_target_cc_includes; then
1168         #the directory doesn't exist, we need to do some more work
1169         aros_target_cc_includes=${PWD}/${aros_gendir}/cc_include
1170         
1171         #these are the headers we're looling for
1172         headers="limits.h mmintrin.h stdbool.h syslimits.h float.h \
1173                  stddef.h xmmintrin.h iso646.h stdarg.h unwind.h   \
1174                  zutil.h"
1176         dirs=
1177         for h in $headers; do
1178             #which other headers each of the above headers needs?
1179             deps=$(echo "#include <$h>" | \
1180                    $aros_host_cc -E -M - 2>/dev/null | \
1181                    sed 's/^.*://; s/\\$/ /g; s/[[ \t]]\+/ /g')
1182             
1183             #copy all the needed headers to a directory beneath gendir
1184             for d in $deps; do
1185                 h=$(basename $d)
1186                 dir=${aros_target_cc_includes}$(echo $(dirname $d) | \
1187                                                 sed -n "s,^.*/include\(/.*\),\1,p")
1188                 ! test -d $dir && mkdir -p $dir
1189                 ! test -f $dir/$h && { cp $d $dir; chmod u+w $dir/$h; }
1190             done
1191         done        
1192     fi
1194 AC_MSG_RESULT($aros_target_cc_includes)
1196 dnl Check if user specified --with-resolution=XRESxYRESxDEPTH
1197 AC_MSG_CHECKING([for default resolution of WBScreen])
1198 AC_ARG_WITH(resolution,AC_HELP_STRING([--with-resolution=XRESxYRESxDEPTH],[Default resolution of the initial WorkbenchScreen]),resolution=$withval,resolution=none)
1199 # We require an argument, so map --with/--without ("yes"/"no") to "none" specified
1200 if test "$resolution" = "yes" ; then
1201     resolution="none"
1203 if test "$resolution" = "no" ; then
1204     resolution="none"
1206 if test "$resolution" != "none" ; then
1207     aros_default_wbwidth=`echo $resolution | cut -d'x' -f1`
1208     aros_default_wbheight=`echo $resolution | cut -d'x' -f2`
1209     aros_default_wbdepth=`echo $resolution | cut -d'x' -f3`
1211 AC_MSG_RESULT($aros_default_wbwidth x $aros_default_wbheight x $aros_default_wbdepth)
1212 aros_cv_default_wbwidth=$aros_default_wbwidth
1213 aros_cv_default_wbheight=$aros_default_wbheight
1214 aros_cv_default_wbdepth=$aros_default_wbdepth
1216 dnl See if the user wants the BOCHS hack for native flavour
1217 AC_MSG_CHECKING([if bochs hack is enabled])
1218 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")
1219 if test "$bochs_hack" = "yes" ; then
1220     aros_bochs_hack="1"
1222 AC_MSG_RESULT($bochs_hack)
1224 dnl See if the user wants the serial debug output for native flavour
1225 AC_MSG_CHECKING([if serial debug is enabled])
1226 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)
1227 if test "$serial_debug" = "yes" ; then
1228     serial_debug="2"
1230 if test "$serial_debug" = "no" ; then
1231     serial_debug="none"
1233 if test "$serial_debug" != "none" ; then
1234     aros_serial_debug=$serial_debug
1235     AC_MSG_RESULT(on port $serial_debug)
1236 else
1237     AC_MSG_RESULT(no)
1240 dnl See if the user wants the palm debug output hack for palm native flavour
1241 AC_MSG_CHECKING([if palm debug hack is enabled])
1242 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")
1243 if test "$palm_debug_hack" = "yes" ; then
1244     aros_palm_debug_hack="1"
1246 AC_MSG_RESULT($palm_debug_hack)
1249 dnl See if the user wants nesting supervisor activated for unix flavour
1250 AC_MSG_CHECKING([if nesting supervisor support is enabled])
1251 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")
1252 if test "$nesting_supervisor" = "yes" ; then
1253     aros_nesting_supervisor="1"
1255 AC_MSG_RESULT($nesting_supervisor)
1258 dnl things specifically required for hosted flavours
1259 if test "x-$aros_flavour" = "x-emulation" -o "x-$aros_flavour" = "x-emulcompat" ; then
1261     dnl some kind of dynamic library access system is required for hostlib.resource
1262     AC_CHECK_FUNC(dlopen, have_dl="yes", have_dl="no")
1263     if test "x-$have_dl" = "x-no" ; then
1264         AC_CHECK_LIB(dl, dlopen, [have_dl="yes"
1265                                   aros_host_ldflags="$aros_host_ldflags -ldl"],
1266                                  have_dl="no")
1267     fi
1268     if test "x-$have_dl" = "x-no" ; then
1269          AC_MSG_ERROR([dlopen() dynamic linker functions not available])
1270     fi
1273     dnl x11 hidd
1274     AC_ARG_ENABLE(x11_hidd, AC_HELP_STRING([--enable-x11-hidd],
1275                                            [build X11 hidd for hosted (default=auto)]),
1276                                            x11_hidd="$enableval",
1277                                            x11_hidd="auto")
1278     case "x-$x11_hidd" in
1279         x-yes|x-no|x-auto)                 ;;
1280         *)                 x11_hidd="auto" ;;
1281     esac
1283     dnl they want it
1284     if test "x-$x11_hidd" != "x-no" ; then
1286         dnl find x11 stuff
1287         AC_PATH_X
1289         x_cflags=
1290         for path in $x_libraries
1291         do
1292             x_cflags="$x_cflags -L$path"
1293         done
1295         for path in $x_includes
1296         do
1297             x_cflags="$x_cflags -I$path"
1298         done
1299         
1300         if test "x-$no_x" = "x-yes" ; then
1302             dnl didn't find it
1303             if test "x-$x11_hidd" != "x-auto" ; then
1304                 dnl and they explicitly asked for it, bail out
1305                 AC_MSG_ERROR([X11 libs/headers not found, cannot build X11 hidd as requested])
1306             fi
1307         
1308         else
1309             dnl found it, setup the metatarget
1310             x11_hidd_target=kernel-x11gfx
1313             dnl setup shared memory extensions
1314             AC_ARG_ENABLE(x11_shm, AC_HELP_STRING([--enable-x11-shm],
1315                                                   [use X11 shared memory (default=auto)]),
1316                                                   x11_hidd_shm="$enableval",
1317                                                   x11_hidd_shm="auto")
1318             case "x-$x11_hidd_shm" in
1319                 x-yes|x-no|x-auto)                     ;;
1320                 *)                 x11_hidd_shm="auto" ;;
1321             esac
1323             have_xshm=no
1325             dnl they want it
1326             if test "x-$x11_hidd_shm" != "x-no" ; then
1328                 dnl system shm headers
1329                 AC_CHECK_HEADERS(sys/ipc.h)
1330                 AC_CHECK_HEADERS(sys/shm.h)
1332                 dnl got them
1333                 if test "x-$ac_cv_header_sys_ipc_h" = "x-yes" -a "x-$ac_cv_header_sys_shm_h" = "x-yes" ; then
1335                     dnl make sure X libs have shm functions
1336                     save_cflags="$CFLAGS"
1337                     CFLAGS="$CFLAGS $x_cflags"
1338                     AC_CHECK_LIB(Xext, XShmQueryExtension, have_xshm=yes)
1339                     CFLAGS="$save_cflags"
1340                 fi
1341             fi
1343             dnl detection done, prepare output
1344             if test "x-$have_xshm" = "x-yes" ; then
1345                 dnl we can do shm
1346                 DO_XSHM_SUPPORT="1"
1347             elif test "x-$x11_hidd_shm" = "x-yes" ; then
1348                 dnl they explicitly asked for it, but we can't do it
1349                 AC_MSG_ERROR([X11 has no support for shared memory, cannot enable it as requested])
1350             else
1351                 dnl otherwise just disable it
1352                 DO_XSHM_SUPPORT="0"
1353             fi
1355             
1356             dnl setup vidmode (fullscreen) extensions
1357             AC_ARG_ENABLE(x11_vidmode, AC_HELP_STRING([--enable-x11-vidmode],
1358                                                       [use X11 vidmode extension (default=auto)]),
1359                                                       x11_hidd_vidmode="$enableval",
1360                                                       x11_hidd_vidmode="auto")
1361             case "x-$x11_hidd_vidmode" in
1362                 x-yes|x-no|x-auto)                         ;;
1363                 *)                 x11_hidd_vidmode="auto" ;;
1364             esac
1366             have_vidmode=no
1368             dnl they want it
1369             if test "x-$x11_hidd_vidmode" != "x-no" ; then
1371                 dnl make sure X libs have vidmode functions
1372                 save_cflags="$CFLAGS"
1373                 CFLAGS="$CFLAGS $x_cflags"
1374                 AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryExtension, have_vidmode=yes)
1375                 CFLAGS="$save_cflags"
1376             fi
1378             dnl detection done, prepare output
1379             if test "x-$have_vidmode" = "x-yes" ; then
1380                 dnl we can do vidmode
1381                 DO_VIDMODE_SUPPORT="1"
1382             elif test "x-$x11_hidd_vidmode" = "x-yes" ; then
1383                 dnl they explicitly asked for it, but we can't do it
1384                 AC_MSG_ERROR([X11 vidmode extension not available, cannot enable it as requested])
1385             else
1386                 dnl otherwise just disable it
1387                 DO_VIDMODE_SUPPORT="0"
1388             fi
1389         fi
1391         aros_host_x11_includes=$x_includes 
1392         aros_host_x11_libdirs=$x_libraries
1393     fi
1396     dnl sdl hidd
1397     AC_ARG_ENABLE(sdl_hidd, AC_HELP_STRING([--enable-sdl-hidd],
1398                                            [build SDL hidd for hosted (default=auto)]),
1399                                            sdl_hidd="$enableval",
1400                                            sdl_hidd="auto")
1401     case "x-$sdl_hidd" in
1402         x-yes|x-no|x-auto)                 ;;
1403         *)                 sdl_hidd="auto" ;;
1404     esac
1406     dnl they want it
1407     if test "x-$sdl_hidd" != "x-no" ; then
1409         dnl find sdl
1410         AM_PATH_SDL([1.2.10], have_sdl="yes", have_sdl="no")
1412         if test "x-$have_sdl" != "x-yes" ; then
1414             dnl didn't find it
1415             if test "x-$sdl_hidd" != "x-auto" ; then
1416                 dnl and they explicitly asked for it, bail out
1417                 AC_MSG_ERROR([SDL libs/headers not found, cannot build SDL hidd as requested])
1418             fi
1420         else
1421             dnl found it, setup the metatarget
1422             sdl_hidd_target=kernel-hidd-sdl
1423             aros_host_sdl_cflags=SDL_CFLAGS
1424             aros_host_sdl_libs=SDL_LIBS
1425         fi
1426     fi
1431 dnl See if the user wants dbus.library
1432 AC_MSG_CHECKING([if building of dbus.library is enabled])
1433 AC_ARG_ENABLE(dbus,AC_HELP_STRING([--enable-dbus],[Enable DBUS support via dbus.library (default=no)]),dbus="yes",dbus="no")
1434 if test "$dbus" = "yes" ; then
1435     ENABLE_DBUS=1
1436     DBUS_CFLAGS=`pkg-config --cflags dbus-1`
1437     DBUS_LIBFLAGS=`pkg-config --libs dbus-1`
1438     KERNEL_DBUS_KOBJ=kernel-dbus-kobj
1439     KERNEL_DBUS_INCLUDES=kernel-dbus-includes
1440 else
1441     ENABLE_DBUS=0
1443 AC_MSG_RESULT($dbus)
1446 dnl --------------------------------------------------------------------
1447 dnl Configuration Output Section
1448 dnl --------------------------------------------------------------------
1450 # Generic
1451 AC_SUBST(aros_arch)
1452 AC_SUBST(aros_cpu)
1453 AC_SUBST(aros_flavour)
1454 AC_SUBST(aros_flavour_uc)
1455 AC_SUBST(TOPDIR)
1457 # Host related
1458 AC_SUBST(aros_cc_pre)
1459 AC_SUBST(aros_host_strip)
1460 AC_SUBST(aros_host_arch)
1461 AC_SUBST(aros_host_cpu)
1462 AC_SUBST(aros_host_cc)
1463 AC_SUBST(aros_host_ar)
1464 AC_SUBST(aros_host_ranlib)
1465 AC_SUBST(aros_host_ld)
1466 AC_SUBST(aros_host_make)
1467 AC_SUBST(aros_host_cflags)
1468 AC_SUBST(aros_host_ldflags)
1469 AC_SUBST(aros_host_debug)
1470 AC_SUBST(aros_host_mkdep)
1471 AC_SUBST(aros_host_mkargs)
1472 AC_SUBST(aros_host_exe_suffix)
1473 AC_SUBST(aros_host_lib_suffix)
1474 AC_SUBST(aros_tools_dir)
1475 AC_SUBST(aros_host_aclocal)
1476 AC_SUBST(aros_host_autoconf)
1477 AC_SUBST(aros_host_autoheader)
1478 AC_SUBST(aros_host_automake)
1480 # Target Related
1481 AC_SUBST(aros_target_guitheme)
1482 AC_SUBST(aros_target_bootloader)
1483 AC_SUBST(aros_target_arch)
1484 AC_SUBST(aros_target_cpu)
1485 AC_SUBST(aros_target_variant)
1486 AC_SUBST(aros_target_suffix)
1487 AC_SUBST(aros_target_incl)
1488 AC_SUBST(aros_target_ar)
1489 AC_SUBST(aros_target_ranlib)
1490 AC_SUBST(aros_kernel_nm)
1491 AC_SUBST(aros_target_cc)
1492 AC_SUBST(aros_kernel_cc)
1493 AC_SUBST(aros_target_as)
1494 AC_SUBST(aros_target_ld)
1495 AC_SUBST(aros_kernel_ld)
1496 AC_SUBST(aros_target_cc_includes)
1497 AC_SUBST(aros_target_cc_path)
1498 AC_SUBST(aros_target_objdump)
1499 AC_SUBST(aros_target_objcopy)
1500 AC_SUBST(aros_target_strip)
1501 AC_SUBST(aros_target_nm)
1502 AC_SUBST(aros_shared_default)
1503 AC_SUBST(aros_shared_ld)
1504 AC_SUBST(aros_object_format)
1505 AC_SUBST(aros_compiler_libs)
1507 AC_SUBST(aros_config_cflags)
1508 AC_SUBST(aros_config_aflags)
1509 AC_SUBST(aros_config_ldflags)
1511 AC_SUBST(aros_shared_cflags)
1512 AC_SUBST(aros_shared_aflags)
1513 AC_SUBST(aros_shared_ldflags)
1514 AC_SUBST(aros_kernel_ldflags)
1515 AC_SUBST(aros_debug_cflags)
1516 AC_SUBST(aros_debug_aflags)
1517 AC_SUBST(aros_debug_ldflags)
1518 AC_SUBST(aros_target_genmap)
1519 AC_SUBST(aros_target_strip_flags)
1521 # Graphics Related
1522 AC_SUBST(x11_hidd_target)
1523 AC_SUBST(sdl_hidd_target)
1525 AC_SUBST(aros_default_wbwidth)
1526 AC_SUBST(aros_default_wbheight)
1527 AC_SUBST(aros_default_wbdepth)
1528 AC_SUBST(DO_XSHM_SUPPORT)
1529 AC_SUBST(DO_VIDMODE_SUPPORT)
1531 AC_SUBST(aros_host_x11_includes)
1532 AC_SUBST(aros_host_x11_libdirs)
1533 AC_SUBST(aros_host_sdl_cflags)
1534 AC_SUBST(aros_host_sdl_libs)
1536 # Native version related
1537 AC_SUBST(aros_bochs_hack)
1538 AC_SUBST(aros_serial_debug)
1540 # Palm native version related
1541 AC_SUBST(aros_palm_debug_hack)
1543 # Unix/Hosted version related
1544 AC_SUBST(aros_nesting_supervisor)
1546 # DBUS related
1547 AC_SUBST(ENABLE_DBUS)
1548 AC_SUBST(DBUS_CFLAGS)
1549 AC_SUBST(DBUS_LIBFLAGS)
1550 AC_SUBST(KERNEL_DBUS_KOBJ)
1551 AC_SUBST(KERNEL_DBUS_INCLUDES)
1553 # Debug related
1554 AC_SUBST(aros_debug)
1555 AC_SUBST(aros_mungwall_debug)
1556 AC_SUBST(aros_stack_debug)
1557 AC_SUBST(aros_modules_debug)
1559 # Collect-aros stuff: "-ius" to ignore undefined symbols
1560 AC_SUBST(ignore_undefined_symbols)
1562 # C compiler related
1563 AC_SUBST(gcc_target_cpu)
1565 dnl Prepare for output, make up all the generated patches
1566 case "$aros_flavour" in
1567 emulation)      aros_flavour_uc="AROS_FLAVOUR_EMULATION"
1568                 aros_flavour="emulation" ;;
1569 emulcompat)     aros_flavour_uc="(AROS_FLAVOUR_EMULATION|AROS_FLAVOUR_BINCOMPAT)"
1570                 aros_flavour="emulation" ;;
1571 standalone)     aros_flavour_uc="AROS_FLAVOUR_STANDALONE"
1572                 aros_flavour="standalone";;
1573 native)         aros_flavour_uc="AROS_FLAVOUR_NATIVE"
1574                 aros_flavour="native" ;;
1575 nativecompat)   aros_flavour_uc="(AROS_FLAVOUR_NATIVE|AROS_FLAVOUR_BINCOMPAT)"
1576                 aros_flavour="native" ;;
1577 linklib)        aros_flavour_uc="AROS_FLAVOUR_LINKLIB"
1578                 aros_flavour="linklib" ;;
1579 palmnative)     aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
1580                 aros_flavour="palmnative" ;;
1581 mac68knative)   aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
1582                 aros_flavour="mac68knative" ;;
1583 ppcnative)      aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_BINCOMPAT)"
1584                 aros_flavour="ppcnative" ;;
1585 esac
1587 if test ! -d ${aros_inc_dir} ; then
1588     ${MKDIR} ${aros_inc_dir}
1590 if test ! -d ${aros_geninc_dir} ; then
1591     ${MKDIR} ${aros_geninc_dir}
1593 if test ! -d ${aros_hostcfg_dir} ; then
1594     ${MKDIR} ${aros_hostcfg_dir}
1596 if test ! -d ${aros_targetcfg_dir} ; then
1597     ${MKDIR} ${aros_targetcfg_dir}
1599 if test ! -d ${aros_tools_dir} ; then
1600     ${MKDIR} ${aros_tools_dir}
1602 if test ! -d ${aros_scripts_dir} ; then
1603     ${MKDIR} ${aros_scripts_dir}
1606 AC_CONFIG_HEADERS(${aros_geninc_dir}/host-conf.h:config/host-conf.h.in)
1608 AC_CONFIG_COMMANDS([compiler_executable],
1609     [
1610         prefix=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}
1611         mkdir -p $prefix
1612         prefix="${prefix}/${aros_target_cpu}-aros"
1613         prefix2=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros
1615         echo ${prefix}
1616         echo ${prefix2}
1617         chmod a+x ${prefix2}-gcc ${prefix2}-ld
1619         ln -sf ${prefix2}-gcc          ${prefix}-gcc
1620         ln -sf ${prefix2}-ld           ${prefix}-ld
1622         ln -sf $aros_target_as_ln      ${prefix}-as
1623         ln -sf $aros_target_nm_ln      ${prefix}-nm
1624         ln -sf $aros_target_ar_ln      ${prefix}-ar
1625         ln -sf $aros_target_ranlib_ln  ${prefix}-ranlib
1626         ln -sf $aros_target_objcopy_ln ${prefix}-objcopy
1627         ln -sf $aros_target_objdump_ln ${prefix}-objdump
1628         ln -sf $aros_target_strip_ln   ${prefix}-strip
1630         ln -sf $aros_target_as_ln      ${prefix2}-as
1631         ln -sf $aros_target_nm_ln      ${prefix2}-nm
1632         ln -sf $aros_target_ar_ln      ${prefix2}-ar
1633         ln -sf $aros_target_ranlib_ln  ${prefix2}-ranlib
1634         ln -sf $aros_target_objcopy_ln ${prefix2}-objcopy
1635         ln -sf $aros_target_objdump_ln ${prefix2}-objdump
1636         ln -sf $aros_target_strip_ln   ${prefix2}-strip
1637     ],
1638     [
1639         aros_tools_dir=${aros_tools_dir}
1640         aros_target_cpu=${aros_target_cpu}
1641         aros_target_arch=${aros_target_arch}
1642         aros_target_suffix=${aros_target_suffix}
1643         aros_target_nm_ln=${aros_target_nm_ln}
1644         aros_target_as_ln=${aros_target_as_ln}
1645         aros_target_ar_ln=${aros_target_ar_ln}
1646         aros_target_ranlib_ln=${aros_target_ranlib_ln}
1647         aros_target_objdump_ln=${aros_target_objdump_ln}
1648         aros_target_objcopy_ln=${aros_target_objcopy_ln}
1649         aros_target_strip_ln=${aros_target_strip_ln}
1650     ]
1652 AC_CONFIG_COMMANDS([genshared_executable],
1653     [chmod a+x ${aros_scripts_dir}/genshared],
1654     [aros_scripts_dir=${aros_scripts_dir}]
1656 AC_CONFIG_COMMANDS([genmf_executable],
1657     [chmod a+x ${aros_tools_dir}/genmf.py],
1658     [aros_tools_dir=${aros_tools_dir}]
1660 AC_CONFIG_COMMANDS([adflib_myaros.conf_executable],
1661     [chmod a+x tools/adflib/myconf.aros]
1664 AC_CONFIG_FILES(
1665     Makefile
1666     rom/mmakefile
1667     ${aros_inc_dir}/config.h:config/config.h.in
1668     ${aros_geninc_dir}/config.h:config/config.h.in
1669     ${aros_hostcfg_dir}/host.cfg:config/host.cfg.in
1670     ${aros_targetcfg_dir}/target.cfg:config/target.cfg.in
1671     mmake.config
1672     ${aros_targetcfg_dir}/make.defaults:config/make.defaults.in
1673     ${aros_targetcfg_dir}/specs:config/specs.in
1674     ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-gcc:scripts/aros-gcc.in
1675     ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-ld:scripts/aros-ld.in
1676     ${aros_scripts_dir}/genshared:compiler/c_lib/source/lib_source/genshared.in
1677     ${aros_tools_dir}/genmf.py:tools/genmf/genmf.py
1678     tools/adflib/myconf.aros
1679     tools/collect-aros/env.h
1682 AC_OUTPUT
1684 dnl This is in order to not define SHARED_CFLAGS sometimes
1685 dnl We don't always do aros_shared_ar, aros_shared_cflags
1687 #XXX compatability...
1688 aros_shared_ar="$aros_shared_ld $aros_shared_ldflags -o"
1690 if test -n "$aros_shared_cflags" ; then
1691     echo "SHARED_CFLAGS := $aros_shared_cflags" >> ${aros_hostcfg_dir}/host.cfg
1692     echo "SHARED_AR := $aros_shared_ar" >> ${aros_hostcfg_dir}/host.cfg