Trivial fixes to command descriptions.
[tangerine.git] / configure.in
blob398aa79b9059cc078f2c927669e71b74db2fcfcb
1 dnl Copyright (C) 1997-2005 AROS - The Amiga Research OS
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.
9 # ar, ranlib, strip, nm for target
12 # ------------------------------------------------------------------------
13 # Here starts the first section of the configure.in file.
14 # ------------------------------------------------------------------------
16 AC_INIT(mmakefile)
17 AC_PREREQ(2.53)
18 AC_CONFIG_AUX_DIR(scripts/autoconf)
20 # Check what host we are running on.
21 # If a target is not suggested, we use this one.
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 # We don't yet support cross-compiling, but we may later on.
77 AC_CYGWIN
78 AC_EXEEXT
79 AC_OBJEXT
81 # Check for gawk and mmake.
82 AC_CHECK_PROGS(AWK,[gawk nawk])
83 AC_SUBST(AWK)
84 AROS_REQUIRED(gawk,$AWK)
85 AROS_PROG(MMAKE,mmake)
87 # Perform some default variable assignments. Note all of these will be
88 # Regenerated from the script, so there is no need to cache them.
90 aros_host_cc="$CC"
91 AROS_TOOL_CCPATH(aros_host_ld,ld)
92 AROS_REQUIRED(ld,$aros_host_ld)
93 aros_host_make="make"
94 aros_host_cflags=$CFLAGS
95 aros_host_ldflags=$LDFLAGS
96 aros_host_debug="-g -O0"
97 aros_host_mkdep="\$(TOP)/scripts/mkdep"
98 aros_host_mkargs="--no-print-directory"
99 aros_host_incl="/usr/include"
100 aros_host_exe_suffix="$EXEEXT"
101 aros_host_lib_suffix=""
103 AC_CHECK_PROGS(aros_host_aclocal,[aclocal aclocal19])
104 AC_CHECK_PROGS(aros_host_autoconf,[autoconf autoconf259 autoconf253])
105 AC_CHECK_PROGS(aros_host_autoheader,[autoheader autoheader259 autoheader253])
106 AC_CHECK_PROGS(aros_host_automake,[automake automake19])
108 case "$CC" in
109     *gcc*)
110         aros_host_cc_pipe="-pipe"
111         ;;
112     icc)
113         aros_host_cc_pipe=""
114         ;;
115     *)
116         aros_host_cc_pipe=""
117         ;;
118 esac
120 dnl Despite the name, this is really a host configuration variable.
121 aros_target_cc_includes=""
123 # This is the main host configuration section. It is where the host
124 # can change the values of any variables it needs to change. We do
125 # not look at anything that compiles to the target yet, we'll get
126 # to that later.
128 case "$host_os" in
129     linux*)
130         aros_host_arch="linux"
131         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
132         case "$host_cpu" in
133             *i?86*)
134                 aros_host_cpu="i386"
135                 ;;
136             *x86_64*)
137                 aros_host_cpu="x86_64"
138                 ;;
139             *m68k*)
140                 aros_host_cpu="m68k"
141                 ;;
142             *powerpc*)
143                 aros_host_cpu="ppc"
144                 ;;
145             *)
146                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
147                 aros_host_cpu="$host_cpu"
148                 ;;
149         esac
150         ;;
152     freebsd*)
153         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
154         aros_host_make="gmake"
155         aros_host_arch="freebsd"
156         aros_host_cpu="i386"
158         dnl Need to override this here, it's just too hard later.
159         dnl This shouldn't be here at all...
160         dnl aros_target_cc_includes="/usr/include"
162         dnl FreeBSD 5.x (and later) has changed the default object format.
163         dnl The double [[]] is necessary to get around m4's quoting rules.
164         case $host_os in
165             freebsd[[234]]*)
166                 aros_object_format="elf_i386"
167                 ;;
169             *)
170                 aros_object_format="elf_i386_fbsd"
171                 ;;
172         esac
174         ;;
176     netbsd*)
177         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
178         aros_host_make="gmake"
179         aros_host_arch="netbsd"
180         case "$host_cpu" in
181             *i?86*)
182                 aros_host_cpu="i386"
183                 ;;
184             *m68k*)
185                 aros_host_cpu="m68k"
186                 ;;
187             *)
188                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
189                 aros_host_cpu="$host_cpu"
190                 ;;
191         esac    
192         aros_host_lib_suffix=".0.0"
193         ;;
195     openbsd*)
196         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
197         aros_host_make="gmake"
198         aros_host_arch="openbsd"
199         case "$host_cpu" in
200             *i?86*)
201                 aros_host_cpu="i386"
202                 ;;
203             *)
204                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
205                 aros_host_cpu="$host_cpu"
206                 ;;
207         esac
208         ;;
209         
210     solaris*)
211         aros_host_arch="solaris"
212         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
213         case "$host_cpu" in
214             *sparc*)
215                 aros_host_cpu="sparc"
216                 ;;
217             *)
218                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
219                 aros_host_cpu="$host_cpu"
220                 ;;
221         esac
222         ;;
224     morphos*)
225         aros_host_cc="$aros_host_cc"
226         aros_host_arch="morphos"
227         aros_host_cpu="ppc"
228         ;;
230     amiga*)
231         aros_host_arch="amiga"
232         SORT="/gg/bin/sort"
233         TEST="/gg/bin/test"
234         UNIQ="/gg/bin/uniq"
235         FOR="for"
236         TOUCH="/gg/bin/touch"
237         case "$host_cpu" in
238             *m68k*)
239                 aros_host_cpu="m68k"
240                 ;;
241             *powerpc*)
242                 aros_host_cpu="ppc"
243                 ;;
244             *)
245                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
246                 aros_host_cpu="$host_cpu"
247                 ;;
248         esac
249         ;;
251     cygwin*)
252         aros_host_arch="cygwin"
253         aros_host_cc="$aros_host_cc $aros_host_cc_pipe"
254         case "$host_cpu" in
255             *i?86*)
256                 aros_host_cpu="i386"
257                 ;;
258             *)
259                 AC_MSG_WARN("Unknown CPU for host -- $host_cpu")
260                 aros_host_cpu="$host_cpu"
261                 ;;
262         esac
263         ;;
264     *)
265         AC_MSG_ERROR([Unsupported host architecture $host])
266         ;;
267 esac
269 AROS_PROG(HOST_AR,[ar],[cr])
270 AROS_REQUIRED(ar,$HOST_AR)
271 AROS_PROG(HOST_RANLIB,ranlib)
273 AROS_PROG(RM,[rm],[-rf])
274 AROS_REQUIRED(rm,$RM)
275 AROS_PROG(CP,[cp])
276 AROS_REQUIRED(cp,$CP)
277 AROS_PROG(MV,[mv])
278 AROS_REQUIRED(mv,$MV)
279 AROS_PROG(ECHO,[echo])
280 AROS_REQUIRED(echo,$ECHO)
281 AROS_PROG(MKDIR,[mkdir],[-p])
282 AROS_REQUIRED(mkdir,$MKDIR)
283 AROS_PROG(TOUCH,[touch])
284 AROS_REQUIRED(touch,$TOUCH)
285 AROS_PROG(SORT,[sort])
286 AROS_REQUIRED(sort,$SORT)
287 AROS_PROG(UNIQ,[uniq])
288 AROS_REQUIRED(uniq,$UNIQ)
289 AROS_PROG(NOP,[true])
290 AROS_REQUIRED(true,$NOP)
291 AROS_PROG(CAT,[cat])
292 AROS_REQUIRED(cat,$CAT)
293 AROS_PROG(BISON,[bison])
294 AROS_REQUIRED(bison,$BISON)
295 AROS_PROG(PNGTOPNM,[pngtopnm])
296 AROS_REQUIRED(pngtopnm,$PNGTOPNM)
297 AROS_PROG(PPMTOILBM,[ppmtoilbm])
298 AROS_REQUIRED(ppmtoilbm,$PPMTOILBM)
299 AROS_PROG(STRIP,[strip])
300 AROS_REQUIRED(strip,$STRIP)
301 AROS_PROG(SED,[sed])
302 AROS_REQUIRED(sed,$SED)
303 AROS_PROG(CHMOD,[chmod])
304 AROS_REQUIRED(chmod,$CHMOD)
306 AM_PATH_PYTHON(2.2.1)
308 FOR=for
309 IF=if
310 TEST=test
311 CMP=cmp
312 AC_SUBST(FOR)
313 AC_SUBST(IF)
314 AC_SUBST(TEST)
315 AC_SUBST(CMP)
317 dnl ---------------------------------------------------------------------------
318 dnl Look for things about the host system, good for hosted targets.
319 dnl ---------------------------------------------------------------------------
321 # Check for some includes for the X11 HIDD and the kernel
322 AC_CHECK_HEADERS([sys/ipc.h sys/shm.h \
323     sys/mmap.h sys/mman.h sysexits.h \
324     sys/statfs.h sys/statvfs.h sys/vfs.h sys/param.h \
327 AC_CHECK_HEADERS([sys/mount.h],,,[#include <sys/param.h>])
329 AC_HEADER_DIRENT
330 AC_HEADER_STAT
331 AC_HEADER_STDC
332 AC_HEADER_SYS_WAIT
333 AC_HEADER_TIME
334 AC_STRUCT_ST_BLKSIZE
335 AC_STRUCT_ST_BLOCKS
336 AC_STRUCT_ST_RDEV
337 AC_STRUCT_TM
338 AC_STRUCT_TIMEZONE
339 AC_TYPE_OFF_T
340 AC_TYPE_PID_T
341 AC_TYPE_SIZE_T
342 AC_TYPE_UID_T
344 AC_CHECK_MEMBERS(struct tm.tm_gmtoff)
346 # Look for some functions
347 AC_CHECK_FUNCS([getpagesize kqueue statfs statvfs \
348     clone kse_create rfork_thread thr_create sa_register \
349     getcontext makecontext setcontext sigaltstack swapcontext])
351 AC_FUNC_MMAP
353 # Find X
354 AC_PATH_X
357 dnl --------------------------------------------------------------------
358 dnl Target Configuration Section
359 dnl --------------------------------------------------------------------
361 dnl The target configuration section is responsible for setting up all
362 dnl the paths for includes, and tools required to build AROS to some
363 dnl particular target.
365 # Find all the tools we need to compile. This could be cross-compiling
366 # though! If that is the case we use the GNU form of the target and
367 # simply add this to the front of the binary name. This is rather simple,
368 # but it should work under most circumstances.
370 # The default tools are to use the same as the host, but only if the
371 # host and target CPU are the same. With GCC this is normally enough.
374 aros_cc_pre=""
375 aros_target_cc="$aros_host_cc"
376 aros_target_as="$aros_host_cc"
377 aros_shared_ld="$aros_host_ld"
378 aros_kernel_ld="$aros_host_ld"
379 aros_target_ld="$aros_host_ld"
381 aros_target_mkdep="$aros_host_mkdep"
382 aros_target_incl_def="$aros_host_incl"
384 # The default tools executables to be linked at.
385 AROS_TOOL_CCPATH(aros_target_ar_ln,ar)
386 AROS_REQUIRED(ar,$aros_target_ar_ln)
387 AROS_TOOL_CCPATH(aros_target_nm_ln,nm)
388 AROS_REQUIRED(nm,$aros_target_nm_ln)
389 AROS_TOOL_CCPATH(aros_target_objcopy_ln,objcopy)
390 AROS_REQUIRED(objcopy,$aros_target_objcopy_ln)
391 AROS_TOOL_CCPATH(aros_target_objdump_ln,objdump)
392 AROS_REQUIRED(objdump,$aros_target_objdump_ln)
393 AROS_TOOL_CCPATH(aros_target_ranlib_ln,ranlib)
394 AROS_REQUIRED(ranlib,$aros_target_ranlib_ln)
395 AROS_TOOL_CCPATH(aros_target_strip_ln,strip)
396 AROS_REQUIRED(strip,$aros_target_strip_ln)
398 if test "$GCC" = "yes"; then
399     aros_target_cc_path=`$CC -print-search-dirs | grep "programs: =" | cut -c 12-`
402 # It is necessary to clear the include and link paths for target
403 # commands. This should help clear up problems when cross compiling.
404 aros_config_cflags="-Wall -Werror-implicit-function-declaration"
405 aros_config_aflags="-Wall -x assembler-with-cpp"
406 aros_config_ldflags=""
408 aros_shared_default=yes
410 aros_shared_cflags="-fPIC"
411 aros_shared_aflags=""
412 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
413 aros_kernel_ldflags="-Wl,-rpath,./lib"
415 aros_compiler_libs=
417 aros_target_genmap="-Wl,-Map -Xlinker"
419 # Native flavour stuff
420 aros_bochs_hack="0"
421 aros_serial_debug="0"
423 # Palm native flavour stuff
424 aros_palm_debug_hack="0"
426 # Unix flavour stuff
427 aros_nesting_supervisor="0"
429 # Collect-aros stuff: "-ius" to ignore undefined symbols
430 ignore_undefined_symbols=""
432 # X11 Xshm
433 DO_XSHM_SUPPORT="1"
434 DO_VIDMODE_SUPPORT="1"
436 #-----------------------------------------------------------------------------
438 AC_MSG_CHECKING([for type of build])
439 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")
441 if test "$build_type" = "nightly"; then
442     build_type_string="NIGHTLY"
443 elif test "$build_type" = "snapshot"; then
444     build_type_string="SNAPSHOT"
445 elif test "$build_type" = "milestone"; then
446     build_type_string="MILESTONE"
447 elif test "$build_type" = "release"; then
448     build_type_string="RELEASE"
449 else
450     build_type_string="PERSONAL"
451     build_type="personal"
454 aros_config_cflags="$aros_config_cflags -DAROS_BUILD_TYPE=AROS_BUILD_TYPE_$build_type_string"
456 AC_MSG_RESULT($build_type)
458 #-----------------------------------------------------------------------------
459 all_debug_types="messages stack mungwall modules symbols"
461 AC_MSG_CHECKING([which debug types to enable])
462 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)]),
463  debug="$enableval",debug="")
465 if test "$debug" = "" -o "$debug" = "no"; then
466     debug="none"
467 elif test "$debug" = "yes"; then
468     debug="all"
471 if test "$debug" = "all" ; then
472     debug=$all_debug_types
473     for d in $all_debug_types; do
474         export aros_${d}_debug="1"
475     done
476 else
477     for d in $all_debug_types; do
478         export aros_${d}_debug="0"
479     done
482 if test "$debug" != "none"; then
483     debug=`echo $debug | sed s/,/\ /g`
484     for d in $debug; do
485         found="0"
486         for d2 in $all_debug_types; do
487             if test "$d2" = "$d"; then
488                 found="1"
489                 break
490             fi
491         done
492         if test "$found" = "0"; then
493             AC_MSG_ERROR([unrecognized debug type "$d". Available types are: all none $all_debug_types])
494         fi
495         export aros_${d}_debug="1"
496     done
497     aros_debug="yes"
499 AC_MSG_RESULT($debug)
501 if test "$aros_messages_debug" = "1"; then
502     aros_messages_debug="-DADEBUG=1 -DMDEBUG=1"
503 else
504     aros_messages_debug=""
506 if test "$aros_symbols_debug" = "1"; then
507     aros_symbols_debug="-g"
508 else
509     aros_symbols_debug=""
512 # These are the flags to pass when compiling debugged programs
513 aros_debug_cflags="$aros_symbols_debug $aros_messages_debug"
514 aros_debug_aflags=""
515 aros_debug_ldflags="$aros_symbols_debug"
517 #-----------------------------------------------------------------------------
518 #   Checking for distcc and ccache.
520 #   Always apply the transforms in this particular order. Basically you should
521 #   always run 'ccache distcc compiler' in that order for the best performance.
523 AC_MSG_CHECKING([whether to enable distcc])
524 AC_ARG_ENABLE(distcc,AC_HELP_STRING([--enable-distcc],[Use distcc as a front end to the compiler (default=no).]),distcc="$enableval",distcc="no")
525 if test "$distcc" != "" -a "$distcc" != "no"; then
526     # AC_CHECK_PROG will print out the result in this case
527     AC_PATH_PROG(DISTCC,[distcc],distcc,)
528 else
529     AC_MSG_RESULT(no)
532 AC_MSG_CHECKING([whether to enable ccache])
533 AC_ARG_ENABLE(ccache,AC_HELP_STRING([--enable-ccache],[Use ccache as a front end to the compiler (default=no).]),ccache="$enableval",ccache="no")
534 if test "$ccache" != "" -a "$ccache" != "no"; then
535     # AC_CHECK_PROG will print out the result in this case
536     AC_CHECK_PROG(CCACHE,[ccache],ccache,)
537 else
538     AC_MSG_RESULT(no)
541 #-----------------------------------------------------------------------------
542 AC_MSG_CHECKING([what optimization flags to use])
543 AC_ARG_WITH(optimization,AC_HELP_STRING([--with-optimization=FLAGS],[Use optimization flags FLAGS (default=-O2).]),optimization="$withval",optimization="unknown")
544 if test "$optimization" = "unknown"; then
545     dnl default is -O2 for normal builds, -O0 for debug builds
546     if test "$debug" != "none"; then
547         optimization="-O0"
548     else
549         optimization="-O2"
550     fi
552 aros_config_cflags="$aros_config_cflags $optimization"
553 AC_MSG_RESULT($optimization)
555 #-----------------------------------------------------------------------------
556 AC_MSG_CHECKING([what target variant to enable])
557 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")
558 if test "$target_variant" = "none"; then
559     aros_target_variant=""
560     aros_target_suffix=""
561 else
562     aros_target_variant="$target_variant"
563     aros_target_suffix="-$target_variant"
565 AC_MSG_RESULT($enableval)
567 #-----------------------------------------------------------------------------
568 # This is the target configuration switch.
569 case "$target_os" in
570     linux*)
571         aros_target_arch="linux"
572         case "$target_cpu" in
573             *m68k*)
574                 aros_target_cpu="m68k"
575                 aros_object_format="m68kelf"
576                 aros_flavour="emulcompat"
577                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D__mc68000 -D__linux__"
578                 aros_shared_ldflags="-Wl,-T,\$(TOP)/config/linux/m68k/script.so"
579                 aros_kernel_ldflags="-Wl,-rpath,./lib,-T,\$(TOP)/config/linux/m68k/script.normal"
580                 gcc_target_cpu="mc68000"
581                 ;;
582             *i?86*)
583                 aros_target_cpu="i386"
584                 aros_object_format="elf_i386"
585                 aros_flavour="emulation"
586                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__linux__"
587                 aros_default_wbdepth=8
588                 gcc_target_cpu="i386"
589                 ;;
590             *x86_64*)
591                 aros_target_cpu="x86_64"
592                 aros_object_format="elf_x86_64"
593                 aros_flavour="emulation"
594                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dx86_64 -D__linux__"
595                 aros_default_wbdepth=8
596                 gcc_target_cpu="x86_64"
597                 ;;
598             *powerpc*)
599                 aros_target_cpu="ppc"
600                 aros_object_format="elf32ppc"
601                 aros_flavour="emulation"
602                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc -D__linux__"
603                 aros_default_wbdepth=8
604                 aros_compiler_libs="-lgcc"
605                 gcc_target_cpu="ppc"
606                 ;;
607             *)
608                 AC_MSG_ERROR("Unknown CPU for Linux -- $target_cpu")
609                 ;;
610         esac
611     ;;
613     pc)
614         aros_target_arch="pc"
615         aros_shared_default="no"
616         case "$target_cpu" in
617             *i?86*)
618                 aros_target_cpu="i386"
620                 dnl If somebody hasn't already set the target object
621                 dnl format, then use this value. Mostly to support
622                 dnl FreeBSD cross-compilation.
623                 dnl TODO: Remove when we always use our compiler.
625                 if test "$aros_object_format" = "" ; then
626                     aros_object_format="elf_i386"
627                 fi
628                 aros_flavour="standalone"
629                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
630                 aros_kernel_ldflags=""
631                 aros_default_wbwidth=640
632                 aros_default_wbheight=480
633                 gcc_target_cpu="i386"
634                 ;;
635             *)
636                 AC_MSG_ERROR("Unknown native CPU -- $target_cpu")
637                 ;;
638         esac
639         ;;
641     prep)
642         aros_target_arch="prep"
643         aros_shared_default="no"
644         aros_target_cpu="ppc"
645         aros_object_format="elf32ppc"
646         aros_flavour="ppcnative"
647         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
648         aros_kernel_ldflags=""
649         aros_default_wbwidth=640
650         aros_default_wbheight=480
651         gcc_target_cpu="ppc"
652         case "$target_cpu" in
653             *cross*)
654                 aros_target_cc="ppc-linux-gcc -pipe"
655                 aros_target_ld="ppc-linux-ld"
656                 aros_target_as="ppc-linux-as"
657                 aros_target_ar="ppc-linux-ar"
658                 aros_target_ranlib="ppc-linux-ranlib"
659                 aros_target_nm="ppc-linux-nm"
660                 aros_target_strip="ppc-linux-strip"
661                 aros_target_objcopy="ppc-linux-objcopy"
662                 aros_target_objdump="ppc-linux-objdump"
663                 aros_shared_ld="ppc-linux-ld"
664                 aros_kernel_ld="ppc-linux-ld"
665                 ;;
666             *)
667                 ;;
668         esac
669         ;;
671     freebsd*)
672         aros_target_arch="freebsd"
673         aros_target_cpu="i386"
674         aros_flavour="emulation"
675         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
676         gcc_target_cpu="i386"
678         strip_args="-x"
679         ;;
681     netbsd*)
682         aros_target_arch="netbsd"
683         case "$target_cpu" in
684             *m68k*)
685                 aros_target_cpu="m68k"
686                 aros_object_format="m68kelf"
687                 aros_flavour="emulcompat"
688                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D__mc68000 -D__NetBSD__"
689                 gcc_target_cpu="mc68000"
690                 ;;
691             *i?86*)
692                 aros_target_cpu="i386"
693                 aros_object_format="elf_i386"
694                 aros_flavour="emulation"
695                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__NetBSD__"
696                 aros_default_wbdepth=8
697                 gcc_target_cpu="i386"
698                 ;;
699             *)
700                 AC_MSG_ERROR("Unknown CPU for NetBSD -- $target_cpu")
701                 ;;
702         esac
703         aros_target_genmap="-Wl,-M -Xlinker >"
704         aros_flavour="emulation"
705         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386"
706         ;;   
708     openbsd*)
709         aros_target_arch="openbsd"
710         case "$target_cpu" in
711             *i?86*)
712                 aros_target_cpu="i386"
713                 aros_object_format="elf_i386"
714                 aros_flavour="emulation"
715                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__OpenBSD__"
716                 gcc_target_cpu="i386"
717                 ;;
718             *)
719                 AC_MSG_ERROR("Unknown CPU for OpenBSD -- $target_cpu")
720                 ;;
721         esac
722         aros_target_genmap="-Wl,-M -Xlinker >"
723         aros_target_nm_flags="-u"
724         aros_flavour="emulation"
725         ;;
727     solaris*)
728         aros_target_arch="solaris"
729         case "$target_cpu" in
730             *sparc*)
731                 aros_target_cpu="sparc"
732                 aros_object_format="elf_sparc"
733                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dsparc -D__Solaris__"
734                 gcc_target_cpu="sparc"
735                 ;;
736             *)
737                 AC_MSG_ERROR("Unknown CPU for Solaris -- $target_cpu")
738                 ;;
739         esac
740         aros_config_cflags="$aros_config_cflags -D$aros_target_cpu"
741         aros_flavour="emulation"
742         ;;
744     morphos*)
745         aros_target_arch="morphos"
746         aros_shared_default="no"
747         aros_target_cpu="ppc"
748         aros_object_format="elf_ppc"
749         aros_flavour="nativecompat"
750         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dppc"
751         gcc_target_cpu="ppc"
752         ;;
754     amiga*)
755         aros_target_arch="amiga"
756         aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -D_AMIGA -DAMIGA"
757         aros_shared_default="no"
759         aros_config_cflags="$aros_config_cflags -fomit-frame-pointer -fbuiltin -ffreestanding"
761         case "$target_cpu" in
762             *m68k*)
763                 aros_target_cpu="m68k"
764                 aros_object_format="m68kelf"
765                 aros_flavour="nativecompat"
766                 gcc_target_cpu="mc68000"
767                 ;;
768             *ppc*)
769                 aros_cpu="ppc"
770                 aros_flavour="native"
771                 gcc_target_cpu="ppc"
772                 ;;
773             *)
774                 AC_MSG_ERROR("Unknown CPU for Amiga $target_cpu")
775                 ;;
776         esac
777         ;;
779     cygwin*)
780         aros_target_arch="cygwin"
781         aros_shared_default="no"
782         case "$target_cpu" in
783             *i?86*)
784                 aros_target_cpu="i386"
785                 aros_object_format="elf_i386"
786                 aros_flavour="emulation"
787                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Di386 -D__CYGWIN32__"
788                 aros_shared_cflags=""
789                 aros_default_wbdepth=8
790                 gcc_target_cpu="i386"
791                 ;;
792             *)
793                 AC_MSG_ERROR("Unknown CPU for CygWin -- $target_cpu")
794                 ;;
795         esac
796     ;;
797     pp*)
798         aros_target_arch="pp"
799         aros_shared_default="no"
800         case "$target_cpu" in
801             *m68k*)
802                 aros_target_cpu="m68k"
803                 aros_object_format="m68kelf"
804                 aros_flavour="palmnative"
805                 aros_target_mkdep="$aros_target_mkdep -D__GNUC__ -Dm68k"
806                 aros_kernel_ldflags=""
807                 aros_default_wbwidth=160
808                 aros_default_wbheight=160
809                 aros_default_wbdepth=1
810                 aros_target_cc="m68k-elf-gcc -pipe"
811                 aros_target_ld="$(which m68k-elf-ld)"
812                 aros_target_as="m68k-elf-gcc -pipe"
813                 aros_shared_ld="m68k-elf-gcc"
814                 aros_kernel_ld="m68k-elf-gcc"
815                 aros_target_ar="m68k-elf-ar"
816                 aros_target_ar_flags="cru"
817                 aros_target_ranlib="m68k-elf-ranlib"
818                 aros_target_nm="m68k-elf-nm"
819                 aros_target_objcopy="m68k-elf-objcopy"
820                 aros_target_objdump="m68k-elf-objdump"
821                 aros_compiler_libs="-lgcc1"
822                 aros_shared_default=no
823                 aros_shared_cflags="-fpic"
824                 aros_shared_aflags=""
825                 aros_shared_ldflags="-Wl,-rpath,./lib -shared"
826                 aros_kernel_ldflags="-Wl,-rpath,./lib"
827                 aros_debug_cflags="-Wall -Werror-implicit-function-declaration $aros_symbols_debug  $aros_messages_debug -mc68000 -Wa,-mc68000"
828                 aros_debug_aflags=""
829                 aros_debug_ldflags="$aros_symbols_debug"
830                 aros_mungwall_debug="0"
831                 aros_modules_debug="0"
832                 gcc_target_cpu="mc68000"
833                 ignore_undefined_symbols="-ius"
834                 ;;
835            *)
836                 AC_MSG_ERROR("Unknown CPU for PalmPilot -- $target_cpu")
837                 ;;
838         esac
839         ;;
841     *)
842         AC_MSG_ERROR([Unsupported target architecture $target])
843         ;;
844 esac
846 aros_hostcfg_dir="bin/${aros_host_arch}-${aros_host_cpu}/gen/config"
847 aros_targetcfg_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/config"
848 aros_inc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/AROS/Development/include/aros"
849 aros_gendir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen"
850 aros_geninc_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/include/aros"
851 aros_tools_dir="bin/${aros_host_arch}-${aros_host_cpu}/tools"
852 aros_scripts_dir="bin/${aros_target_arch}-${aros_target_cpu}${aros_target_suffix}/gen/scripts"
854 # aros_cc_pre is a variable that is added to the front of the compiler name
855 # in the generated aros-gcc shell script. We need this to enable the cache
856 # to work across cleaned builds. Also, support DISTCC using the correct
857 # environment variable.
860 if test "x${DISTCC}" != "x" ; then
861     if test "x${CCACHE}" != "x" ; then
862         aros_cc_pre="env CCACHE_PREFIX=${DISTCC} ${CCACHE} "
863     else
864         aros_cc_pre="${DISTCC} "
865     fi
866 else
867     if test "x${CCACHE}" != "x" ; then
868         aros_cc_pre="${CCACHE} "
869     fi
872 prefix="${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros"
874 TARGET_CC="${prefix}-gcc"
875 TARGET_AS="$TARGET_CC"
876 TARGET_LD="${prefix}-ld"
877 aros_target_ld="${prefix}-ld"
879 NOSTDINC_CFLAGS=-nostdinc
881 NOSTARTUP_LDFLAGS=-nostartfiles
882 NIX_LDFLAGS=-nix
883 DETACH_LDFLAGS=-detach
884 NOSTDLIB_LDFLAGS=-nostdlib
886 AROS_TOOL_CC(SHARED_LD,$aros_shared_ld)
887 AROS_TOOL_CC(KERNEL_LD,$aros_kernel_ld)
889 # The default tools
890 aros_target_ar=${prefix}-ar
891 aros_target_ar_flags="cr"
892 aros_target_nm=${prefix}-nm
893 aros_target_nm_flags="-C -ul"
894 aros_target_objcopy=${prefix}-objcopy
895 aros_target_objdump=${prefix}-objdump
896 aros_target_ranlib=${prefix}-ranlib
897 aros_target_strip="${prefix}-strip --strip-unneeded -R.comment"
899 prefix="\$(TOOLDIR)/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros"
900 AR="${prefix}-ar $aros_target_ar_flags"
901 RANLIB="${prefix}-ranlib $aros_target_ranlib_flags"
902 NM="${prefix}-nm $aros_target_nm_flags"
903 NM_PLAIN="${prefix}-nm"
904 STRIP="${prefix}-strip $aros_target_strip_flags"
905 OBJDUMP="${prefix}-objdump"
906 OBJCOPY="${prefix}-objcopy"
908 AC_SUBST(TARGET_CC)
909 AC_SUBST(TARGET_AS)
910 AC_SUBST(TARGET_LD)
911 AC_SUBST(NOSTDINC_CFLAGS)
912 AC_SUBST(NOSTARTUP_LDFLAGS)
913 AC_SUBST(NIX_LDFLAGS)
914 AC_SUBST(DETACH_LDFLAGS)
915 AC_SUBST(NOSTDLIB_LDFLAGS)
916 AC_SUBST(aros_cc_pre)
917 AC_SUBST(AR)
918 AC_SUBST(RANLIB)
919 AC_SUBST(NM)
920 AC_SUBST(NM_PLAIN)
921 AC_SUBST(STRIP)
922 AC_SUBST(OBJDUMP)
923 AC_SUBST(OBJCOPY)
925 #-----------------------------------------------------------------------------
926 # See if we can compile SHM support
927 HAVE_XSHM_SUPPORT=0
928 if [[ "x$no_x" != "xyes" -a "x$ac_cv_header_sys_ipc_h" = "xyes" -a "x$ac_cv_header_sys_shm_h" = "xyes" ]]; then
929   AC_MSG_CHECKING(whether the X11 MIT-SHM extension can be compiled in)
930   if test -z "$x_includes" ; then
931     CFLAGS=""
932   else
933     CFLAGS="-I $x_includes"
934   fi
935   LIBS="-L/usr/X11/lib -L/usr/X11R6/lib -lX11 -lXext"
936   AC_TRY_LINK([
937 #include <sys/types.h>
938 #include <X11/Xlib.h>
939 #include <X11/Xutil.h>
940 #include <X11/keysym.h>
941 #include <X11/cursorfont.h>
942 #include <sys/ipc.h>
943 #include <sys/shm.h>
944 #include <X11/extensions/XShm.h>],[
945 static XShmSegmentInfo shminfo;
946 static Display *display;
947 XShmAttach(display, &shminfo);
948 XSync(display,0);
949 shmctl(shminfo.shmid, IPC_RMID, 0);
951 HAVE_XSHM_SUPPORT=1
952 AC_MSG_RESULT(yes),
953 HAVE_XSHM_SUPPORT=0
954 AC_MSG_RESULT(no))
957 #-----------------------------------------------------------------------------
958 # See if we can compile VIDMODE support
959 HAVE_VIDMODE_SUPPORT=0
960 if [[ "x$no_x" != "xyes" ]]; then
961   LIBS=""
962   AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryExtension, HAVE_VIDMODE_SUPPORT=1, HAVE_VIDMODE_SUPPORT=0, [ -L/usr/X11R6/lib -lXext -lX11 ])
966 # Find the system include path. We can suggest that an alternative is
967 # used if we don't get it correct. The default is to use /usr/include.
968 # Which is set in the aros_target_incl_def variable.
970 AC_ARG_ENABLE(includes,
971 AC_HELP_STRING([--enable-includes=dir],[Alternative system include directory]),
972 [aros_target_incl=$enable_includes], [aros_target_incl=$aros_target_incl_def])
974 dnl find out about the target cc's include path
975 AC_MSG_CHECKING([for the target compiler's include path])
976 if test "$aros_target_cc_includes" = "" ; then
977     #try to guess where the directory is
978     aros_target_cc_includes=`dirname \`${aros_target_cc} -print-libgcc-file-name\``/include
979     if ! test -d $aros_target_cc_includes; then
980         #the directory doesn't exist, we need to do some more work
981         aros_target_cc_includes=${PWD}/${aros_gendir}/cc_include
982         
983         #these are the headers we're looling for
984         headers="limits.h mmintrin.h stdbool.h syslimits.h float.h \
985                  stddef.h xmmintrin.h iso646.h stdarg.h unwind.h   \
986                  zutil.h"
988         dirs=
989         for h in $headers; do
990             #which other headers each of the above headers needs?
991             deps=$(echo "#include <$h>" | \
992                    $aros_host_cc -E -M - 2>/dev/null | \
993                    sed 's/^.*://; s/\\$/ /g; s/[[ \t]]\+/ /g')
994             
995             #copy all the needed headers to a directory beneath gendir
996             for d in $deps; do
997                 h=$(basename $d)
998                 dir=${aros_target_cc_includes}$(echo $(dirname $d) | \
999                                                 sed -n "s,^.*/include\(/.*\),\1,p")
1000                 ! test -d $dir && mkdir -p $dir
1001                 ! test -f $dir/$h && { cp $d $dir; chmod u+w $dir/$h; }
1002             done
1003         done        
1004     fi
1006 AC_MSG_RESULT($aros_target_cc_includes)
1008 dnl Check if user specified --with-resolution=XRESxYRESxDEPTH
1009 AC_MSG_CHECKING([for default resolution of WBScreen])
1010 AC_ARG_WITH(resolution,AC_HELP_STRING([--with-resolution=XRESxYRESxDEPTH],[Default resolution of the initial WorkbenchScreen]),resolution=$withval,resolution=none)
1011 # We require an argument, so map --with/--without ("yes"/"no") to "none" specified
1012 if test "$resolution" = "yes" ; then
1013     resolution="none"
1015 if test "$resolution" = "no" ; then
1016     resolution="none"
1018 if test "$resolution" != "none" ; then
1019     aros_default_wbwidth=`echo $resolution | cut -d'x' -f1`
1020     aros_default_wbheight=`echo $resolution | cut -d'x' -f2`
1021     aros_default_wbdepth=`echo $resolution | cut -d'x' -f3`
1023 AC_MSG_RESULT($aros_default_wbwidth x $aros_default_wbheight x $aros_default_wbdepth)
1024 aros_cv_default_wbwidth=$aros_default_wbwidth
1025 aros_cv_default_wbheight=$aros_default_wbheight
1026 aros_cv_default_wbdepth=$aros_default_wbdepth
1028 dnl See if the user wants the BOCHS hack for native flavour
1029 AC_MSG_CHECKING([if bochs hack is enabled])
1030 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")
1031 if test "$bochs_hack" = "yes" ; then
1032     aros_bochs_hack="1"
1034 AC_MSG_RESULT($bochs_hack)
1036 dnl See if the user wants the serial debug output for native flavour
1037 AC_MSG_CHECKING([if serial debug is enabled])
1038 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)
1039 if test "$serial_debug" = "yes" ; then
1040     serial_debug="2"
1042 if test "$serial_debug" = "no" ; then
1043     serial_debug="none"
1045 if test "$serial_debug" != "none" ; then
1046     aros_serial_debug=$serial_debug
1047     AC_MSG_RESULT(on port $serial_debug)
1048 else
1049     AC_MSG_RESULT(no)
1052 dnl See if the user wants the palm debug output hack for palm native flavour
1053 AC_MSG_CHECKING([if palm debug hack is enabled])
1054 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")
1055 if test "$palm_debug_hack" = "yes" ; then
1056     aros_palm_debug_hack="1"
1058 AC_MSG_RESULT($palm_debug_hack)
1061 dnl See if the user wants nesting supervisor activated for unix flavour
1062 AC_MSG_CHECKING([if nesting supervisor support is enabled])
1063 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")
1064 if test "$nesting_supervisor" = "yes" ; then
1065     aros_nesting_supervisor="1"
1067 AC_MSG_RESULT($nesting_supervisor)
1071 if test "$HAVE_XSHM_SUPPORT" = "1" ; then
1072   dnl See if the user wants the X11 MIT-SHM extension to be enabled
1073   AC_MSG_CHECKING([if X11 MIT-SHM extension is enabled])
1074   AC_ARG_ENABLE(xshm_extension,AC_HELP_STRING([--enable-xshm-extension],[Enable X11 MIT-SHM extension (default=yes)]),xshm_extension="$enableval",xshm_extension="yes")
1075   if test "$xshm_extension" = "no" ; then
1076       DO_XSHM_SUPPORT="0"
1077   fi
1078   AC_MSG_RESULT($xshm_extension)
1079 else
1080   DO_XSHM_SUPPORT="0"
1083 if test "$HAVE_VIDMODE_SUPPORT" = "1" ; then
1084   dnl See if the user wants the X11 vidmode extension to be enabled
1085   AC_MSG_CHECKING([if vidmode extension is enabled])
1086   AC_ARG_ENABLE(vidmodeextension,AC_HELP_STRING([--enable-vidmode-extension],[Enable X11 vidmode extension (default=yes)]),vidmode_extension="$enableval",vidmode_extension="yes")
1087   if test "$vidmode_extension" = "no" ; then
1088       DO_VIDMODE_SUPPORT="0"
1089   fi
1090   AC_MSG_RESULT($vidmode_extension)
1091 else
1092   DO_VIDMODE_SUPPORT="0"
1096 dnl See if the user wants dbus.library
1097 AC_MSG_CHECKING([if building of dbus.library is enabled])
1098 AC_ARG_ENABLE(dbus,AC_HELP_STRING([--enable-dbus],[Enable DBUS support via dbus.library (default=no)]),dbus="yes",dbus="no")
1099 if test "$dbus" = "yes" ; then
1100     ENABLE_DBUS=1
1101     DBUS_CFLAGS=`pkg-config --cflags dbus-1`
1102     DBUS_LIBFLAGS=`pkg-config --libs dbus-1`
1103     KERNEL_DBUS_KOBJ=kernel-dbus-kobj
1104     KERNEL_DBUS_INCLUDES=kernel-dbus-includes
1105 else
1106     ENABLE_DBUS=0
1108 AC_MSG_RESULT($dbus)
1111 dnl --------------------------------------------------------------------
1112 dnl Configuration Output Section
1113 dnl --------------------------------------------------------------------
1115 # Generic
1116 AC_SUBST(aros_arch)
1117 AC_SUBST(aros_cpu)
1118 AC_SUBST(aros_flavour)
1119 AC_SUBST(aros_flavour_uc)
1120 AC_SUBST(TOPDIR)
1122 # Host related
1123 AC_SUBST(aros_host_arch)
1124 AC_SUBST(aros_host_cpu)
1125 AC_SUBST(aros_host_cc)
1126 AC_SUBST(aros_host_ld)
1127 AC_SUBST(aros_host_make)
1128 AC_SUBST(aros_host_cflags)
1129 AC_SUBST(aros_host_ldflags)
1130 AC_SUBST(aros_host_debug)
1131 AC_SUBST(aros_host_mkdep)
1132 AC_SUBST(aros_host_mkargs)
1133 AC_SUBST(aros_host_exe_suffix)
1134 AC_SUBST(aros_host_lib_suffix)
1135 AC_SUBST(aros_tools_dir)
1136 AC_SUBST(aros_host_aclocal)
1137 AC_SUBST(aros_host_autoconf)
1138 AC_SUBST(aros_host_autoheader)
1139 AC_SUBST(aros_host_automake)
1141 # Target Related
1142 AC_SUBST(aros_target_arch)
1143 AC_SUBST(aros_target_cpu)
1144 AC_SUBST(aros_target_variant)
1145 AC_SUBST(aros_target_suffix)
1146 AC_SUBST(aros_target_incl)
1147 AC_SUBST(aros_target_cc)
1148 AC_SUBST(aros_target_cc_includes)
1149 AC_SUBST(aros_target_cc_path)
1150 AC_SUBST(aros_target_objdump)
1151 AC_SUBST(aros_target_objcopy)
1152 AC_SUBST(aros_target_strip)
1153 AC_SUBST(aros_target_as)
1154 AC_SUBST(aros_target_nm)
1155 AC_SUBST(aros_shared_default)
1156 AC_SUBST(aros_object_format)
1157 AC_SUBST(aros_compiler_libs)
1159 AC_SUBST(aros_config_cflags)
1160 AC_SUBST(aros_config_aflags)
1161 AC_SUBST(aros_target_ld)
1162 AC_SUBST(aros_config_ldflags)
1164 AC_SUBST(aros_shared_cflags)
1165 AC_SUBST(aros_shared_aflags)
1166 AC_SUBST(aros_shared_ldflags)
1167 AC_SUBST(aros_kernel_ldflags)
1168 AC_SUBST(aros_debug_cflags)
1169 AC_SUBST(aros_debug_aflags)
1170 AC_SUBST(aros_debug_ldflags)
1171 AC_SUBST(aros_target_genmap)
1173 # Graphics Related
1174 AC_SUBST(aros_gui_libdir)
1175 AC_SUBST(aros_gui_ldflags)
1176 AC_SUBST(aros_gui_libflags)
1177 AC_SUBST(aros_gui_incdir)
1178 AC_SUBST(aros_gui_ccflags)
1180 AC_SUBST(aros_default_wbwidth)
1181 AC_SUBST(aros_default_wbheight)
1182 AC_SUBST(aros_default_wbdepth)
1183 AC_SUBST(DO_XSHM_SUPPORT)
1184 AC_SUBST(DO_VIDMODE_SUPPORT)
1186 # Native version related
1187 AC_SUBST(aros_bochs_hack)
1188 AC_SUBST(aros_serial_debug)
1190 # Palm native version related
1191 AC_SUBST(aros_palm_debug_hack)
1193 # Unix/Hosted version related
1194 AC_SUBST(aros_nesting_supervisor)
1196 # DBUS related
1197 AC_SUBST(ENABLE_DBUS)
1198 AC_SUBST(DBUS_CFLAGS)
1199 AC_SUBST(DBUS_LIBFLAGS)
1200 AC_SUBST(KERNEL_DBUS_KOBJ)
1201 AC_SUBST(KERNEL_DBUS_INCLUDES)
1203 # Debug related
1204 AC_SUBST(aros_debug)
1205 AC_SUBST(aros_mungwall_debug)
1206 AC_SUBST(aros_stack_debug)
1207 AC_SUBST(aros_modules_debug)
1209 # Collect-aros stuff: "-ius" to ignore undefined symbols
1210 AC_SUBST(ignore_undefined_symbols)
1212 # C compiler related
1213 AC_SUBST(gcc_target_cpu)
1215 dnl Prepare for output, make up all the generated patches
1216 case "$aros_flavour" in
1217 emulation)      aros_flavour_uc="AROS_FLAVOUR_EMULATION"
1218                 aros_flavour="emulation" ;;
1219 emulcompat)     aros_flavour_uc="(AROS_FLAVOUR_EMULATION|AROS_FLAVOUR_BINCOMPAT)"
1220                 aros_flavour="emulation" ;;
1221 standalone)     aros_flavour_uc="AROS_FLAVOUR_STANDALONE"
1222                 aros_flavour="standalone";;
1223 native)         aros_flavour_uc="AROS_FLAVOUR_NATIVE"
1224                 aros_flavour="native" ;;
1225 nativecompat)   aros_flavour_uc="(AROS_FLAVOUR_NATIVE|AROS_FLAVOUR_BINCOMPAT)"
1226                 aros_flavour="native" ;;
1227 linklib)        aros_flavour_uc="AROS_FLAVOUR_LINKLIB"
1228                 aros_flavour="linklib" ;;
1229 palmnative)     aros_flavour_uc="(AROS_FLAVOUR_STANDALONE|AROS_FLAVOUR_EMULATION)"
1230                 aros_flavour="palmnative" ;;
1231 ppcnative)      aros_flavour_uc="(AROS_FLAVOUR_NATIVE|AROS_FLAVOUR_BINCOMPAT)"
1232                 aros_flavour="ppcnative" ;;
1233 esac
1235 if test -z "$aros_gui_basedir" ; then
1236     dnl Use X as the default GUI
1237     aros_gui_libdir="$x_libraries"
1238     if test -z "$x_libraries" ; then
1239         aros_gui_ldflags=""
1240     else
1241         aros_gui_ldflags="-L $x_libraries"
1242     fi
1243     if test "$HAVE_XSHM_SUPPORT" = "1" ; then
1244       aros_gui_libflags="-lX11 -lXext"
1245     else
1246       aros_gui_libflags="-lX11"
1247     fi
1248     if test "$HAVE_VIDMODE_SUPPORT" = "1"; then
1249       aros_gui_libflags="$aros_gui_libflags -lXxf86vm"
1250     fi
1251     
1252     aros_gui_incdir="$x_includes"
1253     if test -z "$x_includes" ; then
1254         aros_gui_ccflags=""
1255     else
1256         aros_gui_ccflags="-I $x_includes"
1257     fi
1258 else
1259     if test -n "$aros_gui_basedir" ; then
1260         aros_gui_libdir="${aros_gui_basedir}/lib"
1261         aros_gui_incdir="${aros_gui_basedir}/include"
1262     fi
1264     if test -n "$aros_gui_libdir" ; then
1265         aros_gui_ldflags="-L ${aros_gui_libdir}"
1266     fi
1268     if test -n "$aros_gui_incdir" ; then
1269         aros_gui_ccflags="-I ${aros_gui_incdir}"
1270     else
1271         aros_gui_incdir="${aros_sysincludes}"
1272         aros_gui_ccflags=""
1273     fi
1276 if test ! -d ${aros_inc_dir} ; then
1277     ${MKDIR} ${aros_inc_dir}
1279 if test ! -d ${aros_geninc_dir} ; then
1280     ${MKDIR} ${aros_geninc_dir}
1282 if test ! -d ${aros_hostcfg_dir} ; then
1283     ${MKDIR} ${aros_hostcfg_dir}
1285 if test ! -d ${aros_targetcfg_dir} ; then
1286     ${MKDIR} ${aros_targetcfg_dir}
1288 if test ! -d ${aros_tools_dir} ; then
1289     ${MKDIR} ${aros_tools_dir}
1291 if test ! -d ${aros_scripts_dir} ; then
1292     ${MKDIR} ${aros_scripts_dir}
1295 AC_CONFIG_HEADERS(${aros_geninc_dir}/host-conf.h:config/host-conf.h.in)
1297 AC_CONFIG_COMMANDS([compiler_executable],
1298     [
1299         prefix=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}
1300         mkdir -p $prefix
1301         prefix="${prefix}/${aros_target_cpu}-aros"
1302         prefix2=${PWD}/${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros
1304         echo ${prefix}
1305         echo ${prefix2}
1306         chmod a+x ${prefix2}-gcc ${prefix2}-ld
1307         
1308         ln -sf ${prefix2}-gcc          ${prefix}-gcc
1309         ln -sf ${prefix2}-ld           ${prefix}-ld
1310         
1311         ln -sf $aros_target_nm_ln      ${prefix}-nm
1312         ln -sf $aros_target_ar_ln      ${prefix}-ar
1313         ln -sf $aros_target_ranlib_ln  ${prefix}-ranlib
1314         ln -sf $aros_target_objcopy_ln ${prefix}-objcopy
1315         ln -sf $aros_target_objdump_ln ${prefix}-objdump
1316         ln -sf $aros_target_strip_ln   ${prefix}-strip
1317     
1318         ln -sf $aros_target_nm_ln      ${prefix2}-nm
1319         ln -sf $aros_target_ar_ln      ${prefix2}-ar
1320         ln -sf $aros_target_ranlib_ln  ${prefix2}-ranlib
1321         ln -sf $aros_target_objcopy_ln ${prefix2}-objcopy
1322         ln -sf $aros_target_objdump_ln ${prefix2}-objdump
1323         ln -sf $aros_target_strip_ln   ${prefix2}-strip
1324     ],
1325     [
1326         aros_tools_dir=${aros_tools_dir}
1327         aros_target_cpu=${aros_target_cpu}
1328         aros_target_arch=${aros_target_arch}
1329         aros_target_suffix=${aros_target_suffix}
1330         aros_target_nm_ln=${aros_target_nm_ln}
1331         aros_target_ar_ln=${aros_target_ar_ln}
1332         aros_target_ranlib_ln=${aros_target_ranlib_ln}
1333         aros_target_objdump_ln=${aros_target_objdump_ln}
1334         aros_target_objcopy_ln=${aros_target_objcopy_ln}
1335         aros_target_strip_ln=${aros_target_strip_ln}
1336     ]
1338 AC_CONFIG_COMMANDS([genshared_executable],
1339     [chmod a+x ${aros_scripts_dir}/genshared],
1340     [aros_scripts_dir=${aros_scripts_dir}]
1342 AC_CONFIG_COMMANDS([genmf_executable],
1343     [chmod a+x ${aros_tools_dir}/genmf.py],
1344     [aros_tools_dir=${aros_tools_dir}]
1346 AC_CONFIG_COMMANDS([adflib_myaros.conf_executable],
1347     [chmod a+x tools/adflib/myconf.aros]
1350 AC_CONFIG_FILES(
1351     Makefile
1352     rom/mmakefile
1353     ${aros_inc_dir}/config.h:config/config.h.in
1354     ${aros_geninc_dir}/config.h:config/config.h.in
1355     ${aros_hostcfg_dir}/host.cfg:config/host.cfg.in
1356     ${aros_targetcfg_dir}/target.cfg:config/target.cfg.in
1357     mmake.config
1358     ${aros_targetcfg_dir}/make.defaults:config/make.defaults.in
1359     ${aros_targetcfg_dir}/specs:config/specs.in
1360     ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-gcc:scripts/aros-gcc.in
1361     ${aros_tools_dir}/${aros_target_cpu}-${aros_target_arch}${aros_target_suffix}-aros-ld:scripts/aros-ld.in
1362     ${aros_scripts_dir}/genshared:compiler/c_lib/source/lib_source/genshared.in
1363     ${aros_tools_dir}/genmf.py:tools/genmf/genmf.py
1364     tools/adflib/myconf.aros
1367 AC_OUTPUT
1368          
1369 dnl This is in order to not defined SHARED_CFLAGS sometimes
1370 dnl We don't always do aros_shared_ar, aros_shared_cflags
1372 #XXX compatability...
1373 aros_shared_ar="$aros_shared_ld $aros_shared_ldflags -o"
1375 if test -n "$aros_shared_cflags" ; then
1376     echo "SHARED_CFLAGS := $aros_shared_cflags" >> ${aros_hostcfg_dir}/host.cfg
1377     echo "SHARED_AR := $aros_shared_ar" >> ${aros_hostcfg_dir}/host.cfg