Make INFO's compiler-macro more forgiving.
[sbcl.git] / make-config.sh
blob85129329a5a5416ef68896103ff643661e3bddf5
1 #!/bin/sh
2 set -e
4 # The make-config.sh script uses information about the target machine
5 # to set things up for compilation. It's vaguely like a stripped-down
6 # version of autoconf. It's intended to be run as part of make.sh. The
7 # only time you'd want to run it by itself is if you're trying to
8 # cross-compile the system or if you're doing some kind of
9 # troubleshooting.
11 # This software is part of the SBCL system. See the README file for
12 # more information.
14 # This software is derived from the CMU CL system, which was
15 # written at Carnegie Mellon University and released into the
16 # public domain. The software is in the public domain and is
17 # provided with absolutely no warranty. See the COPYING and CREDITS
18 # files for more information.
20 print_help="no"
22 # The classic form here was to use --userinit $DEVNULL --sysinit
23 # $DEVNULL, but that doesn't work on Win32 because SBCL doesn't handle
24 # device names properly. We still need $DEVNULL to be NUL on Win32
25 # because it's used elsewhere (such as canonicalize-whitespace), so we
26 # need an alternate solution for the init file overrides. --no-foos
27 # have now been available long enough that this should not stop anyone
28 # from building.
29 if [ "$OSTYPE" = "cygwin" -o "$OSTYPE" = "msys" ]
30 then
31 SBCL_PREFIX="$PROGRAMFILES/sbcl"
32 else
33 SBCL_PREFIX="/usr/local"
35 SBCL_XC_HOST="sbcl --disable-debugger --no-userinit --no-sysinit"
36 export SBCL_XC_HOST
38 # Parse command-line options.
39 bad_option() {
40 echo $1
41 echo "Enter \"$0 --help\" for list of valid options."
42 exit 1
45 WITH_FEATURES=""
46 WITHOUT_FEATURES=""
47 FANCY_FEATURES=":sb-core-compression :sb-xref-for-internals :sb-after-xc-core"
49 fancy=false
50 some_options=false
51 for option
53 optarg_ok=true
54 # Split --foo=bar into --foo and bar.
55 case $option in
56 *=*)
57 # For ease of scripting skip valued options with empty
58 # values.
59 optarg=`expr "X$option" : '[^=]*=\(.*\)'` || optarg_ok=false
60 option=`expr "X$option" : 'X\([^=]*=\).*'`
62 --with*)
63 optarg=`expr "X$option" : 'X--[^-]*-\(.*\)'` \
64 || bad_option "Malformed feature toggle: $option"
65 option=`expr "X$option" : 'X\(--[^-]*\).*'`
68 optarg=""
70 esac
72 case $option in
73 --help | -help | -h)
74 print_help="yes" ;;
75 --prefix=)
76 $optarg_ok && SBCL_PREFIX=$optarg
78 --arch=)
79 $oparg_ok && SBCL_ARCH=$optarg
81 --xc-host=)
82 $optarg_ok && SBCL_XC_HOST=$optarg
84 --host-location=)
85 $optarg_ok && SBCL_HOST_LOCATION=$optarg
87 --target-location=)
88 $optarg_ok && SBCL_TARGET_LOCATION=$optarg
90 --dynamic-space-size=)
91 $optarg_ok && SBCL_DYNAMIC_SPACE_SIZE=$optarg
93 --with)
94 WITH_FEATURES="$WITH_FEATURES :$optarg"
96 --without)
97 WITHOUT_FEATURES="$WITHOUT_FEATURES :$optarg"
99 --fancy)
100 WITH_FEATURES="$WITH_FEATURES $FANCY_FEATURES"
101 # Lower down we add :sb-thread for platforms where it can be built.
102 fancy=true
105 bad_option "Unknown command-line option to $0: \"$option\""
108 if $some_options
109 then
110 bad_option "Unknown command-line option to $0: \"$option\""
111 else
112 legacy_xc_spec=$option
115 esac
116 some_options=true
117 done
119 if (test -f customize-target-features.lisp && \
120 (test -n "$WITH_FEATURES" || test -n "$WITHOUT_FEATURES"))
121 then
122 # Actually there's no reason why it would not work, but it would
123 # be confusing to say --with-thread only to have it turned off by
124 # customize-target-features.lisp...
125 echo "ERROR: Both customize-target-features.lisp, and feature-options"
126 echo "to make.sh present -- cannot use both at the same time."
127 exit 1
130 # Previously XC host was provided as a positional argument.
131 if test -n "$legacy_xc_spec"
132 then
133 SBCL_XC_HOST="$legacy_xc_spec"
136 if test "$print_help" = "yes"
137 then
138 cat <<EOF
139 \`make.sh' drives the SBCL build.
141 Usage: $0 [OPTION]...
143 Important: make.sh does not currently control the entirety of the
144 build: configuration file customize-target-features.lisp and certain
145 environment variables play a role as well. see file INSTALL for
146 details.
148 Options:
149 -h, --help Display this help and exit.
151 --prefix=<path> Specify the install location.
153 Script install.sh installs SBCL under the specified prefix
154 path: runtime as prefix/bin/sbcl, additional files under
155 prefix/lib/sbcl, and documentation under prefix/share.
157 This option also affects the binaries: built-in default for
158 SBCL_HOME is: prefix/lib/sbcl/
160 Default prefix is: /usr/local
162 --dynamic-space-size=<size> Default dynamic-space size for target.
164 This specifies the default dynamic-space size for the SBCL
165 being built. If you need to control the dynamic-space size
166 of the host SBCL, use the --xc-host option.
168 If not provided, the default is platform-specific. <size> is
169 taken to be megabytes unless explicitly suffixed with Gb in
170 order to specify the size in gigabytes.
172 --with-<feature> Build with specified feature.
173 --without-<feature> Build wihout the specfied feature.
175 --fancy Build with several optional features:
177 $FANCY_FEATURES
179 Plus threading on platforms which support it.
181 --arch=<string> Specify the architecture to build for.
183 Mainly for doing x86 builds on x86-64.
185 --xc-host=<string> Specify the Common Lisp compilation host.
187 The string provided should be a command to invoke the
188 cross-compilation Lisp system in such a way, that it reads
189 commands from standard input, and terminates when it reaches end
190 of file on standard input.
192 Examples:
194 "sbcl --disable-debugger --no-sysinit --no-userinit"
195 Use an existing SBCL binary as a cross-compilation
196 host even though you have stuff in your
197 initialization files which makes it behave in such a
198 non-standard way that it keeps the build from
199 working. Also disable the debugger instead of
200 waiting endlessly for a programmer to help it out
201 with input on *DEBUG-IO*. (This is the default.)
203 "sbcl"
204 Use an existing SBCL binary as a cross-compilation
205 host, including your initialization files and
206 building with the debugger enabled. Not recommended
207 for casual users.
209 "lisp -noinit -batch"
210 Use an existing CMU CL binary as a cross-compilation
211 host when you have weird things in your .cmucl-init
212 file.
214 exit 1
217 # Running make.sh with different options without clean.sh in the middle
218 # can break things.
219 sh clean.sh
221 mkdir -p output
222 # Save prefix for make and install.sh.
223 echo "SBCL_PREFIX='$SBCL_PREFIX'" > output/prefix.def
224 echo "$SBCL_DYNAMIC_SPACE_SIZE" > output/dynamic-space-size.txt
226 # FIXME: Tweak this script, and the rest of the system, to support
227 # a second bootstrapping pass in which the cross-compilation host is
228 # known to be SBCL itself, so that the cross-compiler can do some
229 # optimizations (especially specializable arrays) that it doesn't
230 # know how to implement how in a portable way. (Or maybe that wouldn't
231 # require a second pass, just testing at build-the-cross-compiler time
232 # whether the cross-compilation host returns suitable values from
233 # UPGRADED-ARRAY-ELEMENT-TYPE?)
235 if [ "$OSTYPE" = "cygwin" -o "$OSTYPE" = "msys" ] ; then
236 DEVNULL=NUL
237 else
238 DEVNULL=/dev/null
240 export DEVNULL
242 . ./find-gnumake.sh
243 find_gnumake
245 ./generate-version.sh
247 # Now that we've done our option parsing and found various
248 # dependencies, write them out to a file to be sourced by other
249 # scripts.
251 echo "DEVNULL=\"$DEVNULL\"; export DEVNULL" > output/build-config
252 echo "GNUMAKE=\"$GNUMAKE\"; export GNUMAKE" >> output/build-config
253 echo "SBCL_XC_HOST=\"$SBCL_XC_HOST\"; export SBCL_XC_HOST" >> output/build-config
254 echo "legacy_xc_spec=\"$legacy_xc_spec\"; export legacy_xc_spec" >> output/build-config
255 if [ -n "$SBCL_HOST_LOCATION" ]; then
256 echo "SBCL_HOST_LOCATION=\"$SBCL_HOST_LOCATION\"; export SBCL_HOST_LOCATION" >> output/build-config
258 if [ -n "$SBCL_TARGET_LOCATION" ]; then
259 echo "SBCL_TARGET_LOCATION=\"$SBCL_TARGET_LOCATION\"; export SBCL_TARGET_LOCATION" >> output/build-config
262 # And now, sorting out the per-target dependencies...
264 case `uname` in
265 Linux)
266 sbcl_os="linux"
268 OSF1)
269 # it's changed name twice since it was called OSF/1: clearly
270 # the marketers forgot to tell the engineers about Digital Unix
271 # _or_ OSF/1 ...
272 sbcl_os="osf1"
274 *BSD)
275 case `uname` in
276 FreeBSD)
277 sbcl_os="freebsd"
279 GNU/kFreeBSD)
280 sbcl_os="gnu-kfreebsd"
282 OpenBSD)
283 sbcl_os="openbsd"
285 NetBSD)
286 sbcl_os="netbsd"
289 echo unsupported BSD variant: `uname`
290 exit 1
292 esac
294 DragonFly)
295 sbcl_os="dragonfly"
297 Darwin)
298 sbcl_os="darwin"
300 SunOS)
301 sbcl_os="sunos"
303 CYGWIN* | WindowsNT | MINGW* | MSYS*)
304 sbcl_os="win32"
306 HP-UX)
307 sbcl_os="hpux"
310 echo unsupported OS type: `uname`
311 exit 1
313 esac
315 link_or_copy() {
316 if [ "$sbcl_os" = "win32" ] ; then
317 # Use preprocessor or makefile includes instead of copying if
318 # possible, to avoid unexpected use of the original, unchanged
319 # files when re-running only make-target-1 during development.
320 if echo "$1" | egrep '[.][ch]$'; then
321 echo "#include \"$1\"" >"$2"
322 elif echo "$1" | egrep '^Config[.]'; then
323 echo "include $1" >"$2"
324 else
325 cp -r "$1" "$2"
327 else
328 ln -s "$1" "$2"
332 remove_dir_safely() {
333 if [ "$sbcl_os" = "win32" ] ; then
334 if [ -d "$1" ] ; then
335 rm -rf "$1"
336 elif [ -e "$1" ] ; then
337 echo "I'm afraid to remove non-directory $1."
338 exit 1
340 else
341 if [ -h "$1" ] ; then
342 rm "$1"
343 elif [ -w "$1" ] ; then
344 echo "I'm afraid to replace non-symlink $1 with a symlink."
345 exit 1
350 echo //entering make-config.sh
352 echo //ensuring the existence of output/ directory
353 if [ ! -d output ] ; then mkdir output; fi
355 echo //guessing default target CPU architecture from host architecture
356 case `uname -m` in
357 *86) guessed_sbcl_arch=x86 ;;
358 i86pc) guessed_sbcl_arch=x86 ;;
359 *x86_64) guessed_sbcl_arch=x86-64 ;;
360 amd64) guessed_sbcl_arch=x86-64 ;;
361 [Aa]lpha) guessed_sbcl_arch=alpha ;;
362 sparc*) guessed_sbcl_arch=sparc ;;
363 sun*) guessed_sbcl_arch=sparc ;;
364 *ppc) guessed_sbcl_arch=ppc ;;
365 ppc64) guessed_sbcl_arch=ppc ;;
366 Power*Macintosh) guessed_sbcl_arch=ppc ;;
367 ibmnws) guessed_sbcl_arch=ppc ;;
368 parisc) guessed_sbcl_arch=hppa ;;
369 9000/800) guessed_sbcl_arch=hppa ;;
370 mips*) guessed_sbcl_arch=mips ;;
371 arm*) guessed_sbcl_arch=arm ;;
373 # If we're not building on a supported target architecture, we
374 # we have no guess, but it's not an error yet, since maybe
375 # target architecture will be specified explicitly below.
376 guessed_sbcl_arch=''
378 esac
380 # Under Solaris, uname -m returns "i86pc" even if CPU is amd64.
381 if [ "$sbcl_os" = "sunos" ] && [ `isainfo -k` = "amd64" ]; then
382 guessed_sbcl_arch=x86-64
385 # Under Darwin, uname -m returns "i386" even if CPU is x86_64.
386 if [ "$sbcl_os" = "darwin" ] && [ "`/usr/sbin/sysctl -n hw.optional.x86_64`" = "1" ]; then
387 guessed_sbcl_arch=x86-64
390 echo //setting up CPU-architecture-dependent information
391 if test -n "$SBCL_ARCH"
392 then
393 # Normalize it.
394 SBCL_ARCH=`echo $SBCL_ARCH | tr '[A-Z]' '[a-z]' | tr _ -`
396 sbcl_arch=${SBCL_ARCH:-$guessed_sbcl_arch}
397 echo sbcl_arch=\"$sbcl_arch\"
398 if [ "$sbcl_arch" = "" ] ; then
399 echo "can't guess target SBCL architecture, please specify --arch=<name>"
400 exit 1
402 if $fancy
403 then
404 # If --fancy, enable threads on platforms where they can be built.
405 case $sbcl_arch in
406 x86|x86-64|ppc)
407 if ([ "$sbcl_os" = "sunos" ] && [ "$sbcl_arch" = "x86-64" ]) || \
408 [ "$sbcl_os" = "dragonfly" ]
409 then
410 echo "No threads on this platform."
411 else
412 WITH_FEATURES="$WITH_FEATURES :sb-thread"
413 echo "Enabling threads due to --fancy."
417 echo "No threads on this platform."
419 esac
420 else
421 case $sbcl_arch in
422 x86|x86-64)
423 case $sbcl_os in
424 linux)
425 WITH_FEATURES="$WITH_FEATURES :sb-thread"
426 esac
427 esac
430 ltf=`pwd`/local-target-features.lisp-expr
431 echo //initializing $ltf
432 echo ';;;; This is a machine-generated file.' > $ltf
433 echo ';;;; Please do not edit it by hand.' >> $ltf
434 echo ';;;; See make-config.sh.' >> $ltf
435 echo "(lambda (features) (union (set-difference (union features (list$WITH_FEATURES)) (list$WITHOUT_FEATURES))" >> $ltf
436 printf " (list " >> $ltf
438 printf ":%s" "$sbcl_arch" >> $ltf
440 echo //setting up OS-dependent information
441 # Under Darwin x86-64, guess whether Darwin 9+ or below.
442 if [ "$sbcl_os" = "darwin" ] && [ "$sbcl_arch" = "x86-64" ]; then
443 darwin_version=`uname -r`
444 darwin_version_major=${DARWIN_VERSION_MAJOR:-${darwin_version%%.*}}
445 if (( 8 < $darwin_version_major )); then
446 printf ' :inode64 :darwin9-or-better' >> $ltf
450 original_dir=`pwd`
451 cd ./src/runtime/
452 rm -f Config target-arch-os.h target-arch.h target-os.h target-lispregs.h
453 # KLUDGE: these two logically belong in the previous section
454 # ("architecture-dependent"); it seems silly to enforce this in terms
455 # of the shell script, though. -- CSR, 2002-02-03
456 link_or_copy $sbcl_arch-arch.h target-arch.h
457 link_or_copy $sbcl_arch-lispregs.h target-lispregs.h
458 case "$sbcl_os" in
459 linux)
460 printf ' :unix' >> $ltf
461 printf ' :elf' >> $ltf
462 printf ' :linux' >> $ltf
464 # If you add other platforms here, don't forget to edit
465 # src/runtime/Config.foo-linux too.
466 case "$sbcl_arch" in
467 mips | arm)
468 printf ' :largefile' >> $ltf
470 x86 | x86-64)
471 printf ' :sb-futex :largefile' >> $ltf
473 ppc)
474 printf ' :sb-futex' >> $ltf
476 esac
479 link_or_copy Config.$sbcl_arch-linux Config
480 link_or_copy $sbcl_arch-linux-os.h target-arch-os.h
481 link_or_copy linux-os.h target-os.h
483 osf1)
484 printf ' :unix' >> $ltf
485 printf ' :elf' >> $ltf
486 printf ' :osf1' >> $ltf
487 link_or_copy Config.$sbcl_arch-osf1 Config
488 link_or_copy $sbcl_arch-osf1-os.h target-arch-os.h
489 link_or_copy osf1-os.h target-os.h
491 hpux)
492 printf ' :unix' >> $ltf
493 printf ' :elf' >> $ltf
494 printf ' :hpux' >> $ltf
495 link_or_copy Config.$sbcl_arch-hpux Config
496 link_or_copy $sbcl_arch-hpux-os.h target-arch-os.h
497 link_or_copy hpux-os.h target-os.h
499 *bsd)
500 printf ' :unix' >> $ltf
501 printf ' :bsd' >> $ltf
502 link_or_copy $sbcl_arch-bsd-os.h target-arch-os.h
503 link_or_copy bsd-os.h target-os.h
504 case "$sbcl_os" in
505 *freebsd)
506 printf ' :elf' >> $ltf
507 printf ' :freebsd' >> $ltf
508 printf ' :gcc-tls' >> $ltf
509 if [ $sbcl_os = "gnu-kfreebsd" ]; then
510 printf ' :gnu-kfreebsd' >> $ltf
513 if [ $sbcl_arch = "x86" ]; then
514 printf ' :restore-fs-segment-register-from-tls' >> $ltf
516 link_or_copy Config.$sbcl_arch-$sbcl_os Config
518 openbsd)
519 printf ' :elf' >> $ltf
520 printf ' :openbsd' >> $ltf
521 link_or_copy Config.$sbcl_arch-openbsd Config
523 netbsd)
524 printf ' :netbsd' >> $ltf
525 printf ' :elf' >> $ltf
526 link_or_copy Config.$sbcl_arch-netbsd Config
529 echo unsupported BSD variant: `uname`
530 exit 1
532 esac
534 dragonfly)
535 printf ' :unix' >> $ltf
536 printf ' :bsd' >> $ltf
537 printf ' :elf' >> $ltf
538 printf ' :dragonfly' >> $ltf
539 printf ' :sb-qshow' >> $ltf
540 if [ $sbcl_arch = "x86" ]; then
541 printf ' :restore-fs-segment-register-from-tls' >> $ltf
543 link_or_copy $sbcl_arch-bsd-os.h target-arch-os.h
544 link_or_copy bsd-os.h target-os.h
545 link_or_copy Config.$sbcl_arch-dragonfly Config
547 darwin)
548 printf ' :unix' >> $ltf
549 printf ' :mach-o' >> $ltf
550 printf ' :bsd' >> $ltf
551 printf ' :darwin' >> $ltf
552 if [ $sbcl_arch = "x86" ]; then
553 printf ' :mach-exception-handler :restore-fs-segment-register-from-tls :ud2-breakpoints' >> $ltf
555 if [ $sbcl_arch = "x86-64" ]; then
556 printf ' :mach-exception-handler :ud2-breakpoints' >> $ltf
558 link_or_copy $sbcl_arch-darwin-os.h target-arch-os.h
559 link_or_copy bsd-os.h target-os.h
560 link_or_copy Config.$sbcl_arch-darwin Config
562 sunos)
563 printf ' :unix' >> $ltf
564 printf ' :elf' >> $ltf
565 printf ' :sunos' >> $ltf
566 if [ $sbcl_arch = "x86-64" ]; then
567 printf ' :largefile' >> $ltf
569 link_or_copy Config.$sbcl_arch-sunos Config
570 link_or_copy $sbcl_arch-sunos-os.h target-arch-os.h
571 link_or_copy sunos-os.h target-os.h
573 win32)
574 printf ' :win32' >> $ltf
576 # Optional features -- We enable them by default, but the build
577 # ought to work perfectly without them:
579 printf ' :sb-futex' >> $ltf
580 printf ' :sb-qshow' >> $ltf
582 # Required features -- Some of these used to be optional, but
583 # building without them is no longer considered supported:
585 # (Of course it doesn't provide dlopen, but there is
586 # roughly-equivalent magic nevertheless:)
587 printf ' :sb-dynamic-core :os-provides-dlopen' >> $ltf
588 printf ' :sb-thread :sb-safepoint :sb-thruption :sb-wtimer' >> $ltf
589 printf ' :sb-safepoint-strictly' >> $ltf
591 link_or_copy Config.$sbcl_arch-win32 Config
592 link_or_copy $sbcl_arch-win32-os.h target-arch-os.h
593 link_or_copy win32-os.h target-os.h
596 echo unsupported OS type: `uname`
597 exit 1
599 esac
600 cd "$original_dir"
602 # FIXME: Things like :c-stack-grows-..., etc, should be
603 # *derived-target-features* or equivalent, so that there was a nicer
604 # way to specify them then sprinkling them in this file. They should
605 # still be tweakable by advanced users, though, but probably not
606 # appear in *features* of target. #!+/- should be adjusted to take
607 # them in account as well. At minimum the nicer specification stuff,
608 # though:
610 # (define-feature :dlopen (features)
611 # (union '(:bsd :linux :darwin :sunos) features))
613 # (define-feature :c-stack-grows-downwards-not-upwards (features)
614 # (member :x86 features))
616 # KLUDGE: currently the x86 only works with the generational garbage
617 # collector (indicated by the presence of :GENCGC in *FEATURES*) and
618 # alpha, sparc and ppc with the stop'n'copy collector (indicated by
619 # the absence of :GENCGC in *FEATURES*). This isn't a great
620 # separation, but for now, rather than have :GENCGC in
621 # base-target-features.lisp-expr, we add it into local-target-features
622 # if we're building for x86. -- CSR, 2002-02-21 Then we do something
623 # similar with :STACK-GROWS-FOOWARD, too. -- WHN 2002-03-03
624 if [ "$sbcl_arch" = "x86" ]; then
625 printf ' :gencgc :stack-grows-downward-not-upward :c-stack-is-control-stack' >> $ltf
626 printf ' :compare-and-swap-vops :unwind-to-frame-and-call-vop :raw-instance-init-vops' >> $ltf
627 printf ' :stack-allocatable-closures :stack-allocatable-vectors' >> $ltf
628 printf ' :stack-allocatable-lists :stack-allocatable-fixed-objects' >> $ltf
629 printf ' :alien-callbacks :cycle-counter :inline-constants :precise-arg-count-error' >> $ltf
630 printf ' :memory-barrier-vops :multiply-high-vops :ash-right-vops :symbol-info-vops' >> $ltf
631 case "$sbcl_os" in
632 linux | freebsd | gnu-kfreebsd | netbsd | openbsd | sunos | darwin | win32 | dragonfly)
633 printf ' :linkage-table' >> $ltf
634 esac
635 if [ "$sbcl_os" = "win32" ]; then
636 # of course it doesn't provide dlopen, but there is
637 # roughly-equivalent magic nevertheless.
638 printf ' :os-provides-dlopen' >> $ltf
640 if [ "$sbcl_os" = "openbsd" ]; then
641 rm -f src/runtime/openbsd-sigcontext.h
642 sh tools-for-build/openbsd-sigcontext.sh > src/runtime/openbsd-sigcontext.h
644 elif [ "$sbcl_arch" = "x86-64" ]; then
645 printf ' :gencgc :stack-grows-downward-not-upward :c-stack-is-control-stack :linkage-table' >> $ltf
646 printf ' :compare-and-swap-vops :unwind-to-frame-and-call-vop :raw-instance-init-vops' >> $ltf
647 printf ' :interleaved-raw-slots :precise-arg-count-error' >> $ltf
648 printf ' :stack-allocatable-closures :stack-allocatable-vectors' >> $ltf
649 printf ' :stack-allocatable-lists :stack-allocatable-fixed-objects' >> $ltf
650 printf ' :alien-callbacks :cycle-counter :complex-float-vops' >> $ltf
651 printf ' :float-eql-vops :integer-eql-vop :inline-constants :memory-barrier-vops' >> $ltf
652 printf ' :multiply-high-vops :sb-simd-pack :ash-right-vops :symbol-info-vops' >> $ltf
653 elif [ "$sbcl_arch" = "mips" ]; then
654 printf ' :cheneygc :linkage-table' >> $ltf
655 printf ' :stack-allocatable-closures :stack-allocatable-vectors' >> $ltf
656 printf ' :stack-allocatable-lists :stack-allocatable-fixed-objects' >> $ltf
657 printf ' :alien-callbacks' >> $ltf
658 elif [ "$sbcl_arch" = "ppc" ]; then
659 printf ' :gencgc :stack-allocatable-closures :stack-allocatable-vectors' >> $ltf
660 printf ' :stack-allocatable-lists :stack-allocatable-fixed-objects' >> $ltf
661 printf ' :linkage-table :raw-instance-init-vops :memory-barrier-vops' >> $ltf
662 printf ' :compare-and-swap-vops :multiply-high-vops :alien-callbacks' >> $ltf
663 if [ "$sbcl_os" = "linux" ]; then
664 # Use a C program to detect which kind of glibc we're building on,
665 # to bandage across the break in source compatibility between
666 # versions 2.3.1 and 2.3.2
668 # FIXME: integrate to grovel-features, mayhaps
669 $GNUMAKE -C tools-for-build where-is-mcontext -I ../src/runtime
670 tools-for-build/where-is-mcontext > src/runtime/ppc-linux-mcontext.h || (echo "error running where-is-mcontext"; exit 1)
671 elif [ "$sbcl_os" = "darwin" ]; then
672 # We provide a dlopen shim, so a little lie won't hurt
673 printf ' :os-provides-dlopen' >> $ltf
674 # The default stack ulimit under darwin is too small to run PURIFY.
675 # Best we can do is complain and exit at this stage
676 if [ "`ulimit -s`" = "512" ]; then
677 echo "Your stack size limit is too small to build SBCL."
678 echo "See the limit(1) or ulimit(1) commands and the README file."
679 exit 1
682 elif [ "$sbcl_arch" = "sparc" ]; then
683 # Test the compiler in order to see if we are building on Sun
684 # toolchain as opposed to GNU binutils, and write the appropriate
685 # FUNCDEF macro for assembler. No harm in running this on sparc-linux
686 # as well.
687 sh tools-for-build/sparc-funcdef.sh > src/runtime/sparc-funcdef.h
688 if [ "$sbcl_os" = "sunos" ] || [ "$sbcl_os" = "linux" ]; then
689 printf ' :gencgc' >> $ltf
690 else
691 echo '***'
692 echo '*** You are running SPARC on non-SunOS, non-Linux. Since'
693 echo '*** GENCGC is untested on this combination, make-config.sh'
694 echo '*** is falling back to CHENEYGC. Please consider adjusting'
695 echo '*** parms.lisp to build with GENCGC instead.'
696 echo '***'
697 printf ' :cheneygc' >> $ltf
699 if [ "$sbcl_os" = "sunos" ] || [ "$sbcl_os" = "linux" ]; then
700 printf ' :linkage-table' >> $ltf
702 printf ' :stack-allocatable-closures :stack-allocatable-lists' >> $ltf
703 elif [ "$sbcl_arch" = "alpha" ]; then
704 printf ' :cheneygc' >> $ltf
705 printf ' :stack-allocatable-closures :stack-allocatable-lists' >> $ltf
706 elif [ "$sbcl_arch" = "hppa" ]; then
707 printf ' :cheneygc' >> $ltf
708 printf ' :stack-allocatable-vectors :stack-allocatable-fixed-objects' >> $ltf
709 printf ' :stack-allocatable-lists' >> $ltf
710 elif [ "$sbcl_arch" = "arm" ]; then
711 printf ' :gencgc :linkage-table :alien-callbacks' >> $ltf
712 # As opposed to soft-float or FPA, we support VFP only (and
713 # possibly VFPv2 and higher only), but we'll leave the obvious
714 # hooks in for someone to add the support later.
715 printf ' :arm-vfp :arm-vfpv2' >> $ltf
716 printf ' :ash-right-vops :multiply-high-vops :symbol-info-vops' >> $ltf
717 printf ' :stack-allocatable-lists :stack-allocatable-fixed-objects' >> $ltf
718 printf ' :stack-allocatable-vectors :stack-allocatable-closures' >> $ltf
719 printf ' :precise-arg-count-error :unwind-to-frame-and-call-vop' >> $ltf
720 else
721 # Nothing need be done in this case, but sh syntax wants a placeholder.
722 echo > /dev/null
725 # Use a little C program to try to guess the endianness. Ware
726 # cross-compilers!
728 # FIXME: integrate to grovel-features, mayhaps
729 $GNUMAKE -C tools-for-build determine-endianness -I ../src/runtime
730 tools-for-build/determine-endianness >> $ltf
732 export sbcl_os sbcl_arch
733 sh tools-for-build/grovel-features.sh >> $ltf
735 echo //finishing $ltf
736 echo ')))' >> $ltf
738 # FIXME: The version system should probably be redone along these lines:
740 # echo //setting up version information.
741 # versionfile=version.txt
742 # cp base-version.txt $versionfile
743 # echo " (built `date -u` by `whoami`@`hostname`)" >> $versionfile
744 # echo 'This is a machine-generated file and should not be edited by hand.' >> $versionfile
746 # Make a unique ID for this build (to discourage people from
747 # mismatching sbcl and *.core files).
748 if [ `uname` = "SunOS" ] ; then
749 # use /usr/xpg4/bin/id instead of /usr/bin/id
750 PATH=/usr/xpg4/bin:$PATH
752 echo '"'`hostname`-`id -un`-`date +%Y-%m-%d-%H-%M-%S`'"' > output/build-id.tmp
754 if [ -n "$SBCL_HOST_LOCATION" ]; then
755 echo //setting up host configuration
756 rsync --delete-after -a output/ "$SBCL_HOST_LOCATION/output/"
757 rsync -a local-target-features.lisp-expr version.lisp-expr "$SBCL_HOST_LOCATION/"