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