Change the way callable arguments are asserted.
[sbcl.git] / make-config.sh
blob63828b425afcff16e825d6940bf55014382aa702
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 --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 --host-location=<string> Location of the source directory on compilation host
216 The string is passed to the command rsync to transfer the
217 necessary files between the target and host directories during
218 the make-target-*.sh steps of cross-compilation (cf. make.sh)
220 Examples:
222 user@host-machine:/home/user/sbcl
223 Transfer the files to/from directory /home/user/sbcl
224 on host-machine.
227 exit 1
230 # Running make.sh with different options without clean.sh in the middle
231 # can break things.
232 sh clean.sh
234 mkdir -p output
235 # Save prefix for make and install.sh.
236 echo "SBCL_PREFIX='$SBCL_PREFIX'" > output/prefix.def
237 echo "$SBCL_DYNAMIC_SPACE_SIZE" > output/dynamic-space-size.txt
239 # FIXME: Tweak this script, and the rest of the system, to support
240 # a second bootstrapping pass in which the cross-compilation host is
241 # known to be SBCL itself, so that the cross-compiler can do some
242 # optimizations (especially specializable arrays) that it doesn't
243 # know how to implement how in a portable way. (Or maybe that wouldn't
244 # require a second pass, just testing at build-the-cross-compiler time
245 # whether the cross-compilation host returns suitable values from
246 # UPGRADED-ARRAY-ELEMENT-TYPE?)
248 if [ "$OSTYPE" = "cygwin" -o "$OSTYPE" = "msys" ] ; then
249 DEVNULL=NUL
250 else
251 DEVNULL=/dev/null
253 export DEVNULL
255 . ./find-gnumake.sh
256 find_gnumake
258 ./generate-version.sh
260 # Now that we've done our option parsing and found various
261 # dependencies, write them out to a file to be sourced by other
262 # scripts.
264 echo "DEVNULL=\"$DEVNULL\"; export DEVNULL" > output/build-config
265 echo "GNUMAKE=\"$GNUMAKE\"; export GNUMAKE" >> output/build-config
266 echo "SBCL_XC_HOST=\"$SBCL_XC_HOST\"; export SBCL_XC_HOST" >> output/build-config
267 echo "legacy_xc_spec=\"$legacy_xc_spec\"; export legacy_xc_spec" >> output/build-config
268 if [ -n "$SBCL_HOST_LOCATION" ]; then
269 echo "SBCL_HOST_LOCATION=\"$SBCL_HOST_LOCATION\"; export SBCL_HOST_LOCATION" >> output/build-config
271 if [ -n "$SBCL_TARGET_LOCATION" ]; then
272 echo "SBCL_TARGET_LOCATION=\"$SBCL_TARGET_LOCATION\"; export SBCL_TARGET_LOCATION" >> output/build-config
275 # And now, sorting out the per-target dependencies...
277 case `uname` in
278 Linux)
279 sbcl_os="linux"
281 OSF1)
282 # it's changed name twice since it was called OSF/1: clearly
283 # the marketers forgot to tell the engineers about Digital Unix
284 # _or_ OSF/1 ...
285 sbcl_os="osf1"
287 *BSD)
288 case `uname` in
289 FreeBSD)
290 sbcl_os="freebsd"
292 GNU/kFreeBSD)
293 sbcl_os="gnu-kfreebsd"
295 OpenBSD)
296 sbcl_os="openbsd"
298 NetBSD)
299 sbcl_os="netbsd"
302 echo unsupported BSD variant: `uname`
303 exit 1
305 esac
307 DragonFly)
308 sbcl_os="dragonfly"
310 Darwin)
311 sbcl_os="darwin"
313 SunOS)
314 sbcl_os="sunos"
316 CYGWIN* | WindowsNT | MINGW* | MSYS*)
317 sbcl_os="win32"
319 HP-UX)
320 sbcl_os="hpux"
323 echo unsupported OS type: `uname`
324 exit 1
326 esac
328 link_or_copy() {
329 if [ "$sbcl_os" = "win32" ] ; then
330 # Use preprocessor or makefile includes instead of copying if
331 # possible, to avoid unexpected use of the original, unchanged
332 # files when re-running only make-target-1 during development.
333 if echo "$1" | egrep '[.][ch]$'; then
334 echo "#include \"$1\"" >"$2"
335 elif echo "$1" | egrep '^Config[.]'; then
336 echo "include $1" >"$2"
337 else
338 cp -r "$1" "$2"
340 else
341 ln -s "$1" "$2"
345 remove_dir_safely() {
346 if [ "$sbcl_os" = "win32" ] ; then
347 if [ -d "$1" ] ; then
348 rm -rf "$1"
349 elif [ -e "$1" ] ; then
350 echo "I'm afraid to remove non-directory $1."
351 exit 1
353 else
354 if [ -h "$1" ] ; then
355 rm "$1"
356 elif [ -w "$1" ] ; then
357 echo "I'm afraid to replace non-symlink $1 with a symlink."
358 exit 1
363 echo //entering make-config.sh
365 echo //ensuring the existence of output/ directory
366 if [ ! -d output ] ; then mkdir output; fi
368 echo //guessing default target CPU architecture from host architecture
369 case `uname -m` in
370 *86) guessed_sbcl_arch=x86 ;;
371 i86pc) guessed_sbcl_arch=x86 ;;
372 *x86_64) guessed_sbcl_arch=x86-64 ;;
373 amd64) guessed_sbcl_arch=x86-64 ;;
374 [Aa]lpha) guessed_sbcl_arch=alpha ;;
375 sparc*) guessed_sbcl_arch=sparc ;;
376 sun*) guessed_sbcl_arch=sparc ;;
377 *ppc) guessed_sbcl_arch=ppc ;;
378 ppc64) guessed_sbcl_arch=ppc ;;
379 Power*Macintosh) guessed_sbcl_arch=ppc ;;
380 ibmnws) guessed_sbcl_arch=ppc ;;
381 parisc) guessed_sbcl_arch=hppa ;;
382 9000/800) guessed_sbcl_arch=hppa ;;
383 mips*) guessed_sbcl_arch=mips ;;
384 *arm*) guessed_sbcl_arch=arm ;;
385 aarch64) guessed_sbcl_arch=arm64 ;;
387 # If we're not building on a supported target architecture, we
388 # we have no guess, but it's not an error yet, since maybe
389 # target architecture will be specified explicitly below.
390 guessed_sbcl_arch=''
392 esac
394 # Under Solaris, uname -m returns "i86pc" even if CPU is amd64.
395 if [ "$sbcl_os" = "sunos" ] && [ `isainfo -k` = "amd64" ]; then
396 guessed_sbcl_arch=x86-64
399 # Under Darwin, uname -m returns "i386" even if CPU is x86_64.
400 if [ "$sbcl_os" = "darwin" ] && [ "`/usr/sbin/sysctl -n hw.optional.x86_64`" = "1" ]; then
401 guessed_sbcl_arch=x86-64
404 echo //setting up CPU-architecture-dependent information
405 if test -n "$SBCL_ARCH"
406 then
407 # Normalize it.
408 SBCL_ARCH=`echo $SBCL_ARCH | tr '[A-Z]' '[a-z]' | tr _ -`
410 sbcl_arch=${SBCL_ARCH:-$guessed_sbcl_arch}
411 echo sbcl_arch=\"$sbcl_arch\"
412 if [ "$sbcl_arch" = "" ] ; then
413 echo "can't guess target SBCL architecture, please specify --arch=<name>"
414 exit 1
416 if $fancy
417 then
418 # If --fancy, enable threads on platforms where they can be built.
419 case $sbcl_arch in
420 x86|x86-64|ppc|arm64)
421 if ([ "$sbcl_os" = "sunos" ] && [ "$sbcl_arch" = "x86-64" ]) || \
422 [ "$sbcl_os" = "dragonfly" ]
423 then
424 echo "No threads on this platform."
425 else
426 WITH_FEATURES="$WITH_FEATURES :sb-thread"
427 echo "Enabling threads due to --fancy."
431 echo "No threads on this platform."
433 esac
434 else
435 case $sbcl_arch in
436 x86|x86-64|arm64)
437 case $sbcl_os in
438 # Be aware that if you use multiple threads on Darwin,
439 # it works well enough when threads don't interact much, but
440 # you might encounter https://bugs.launchpad.net/sbcl/+bug/901441
441 linux|darwin)
442 WITH_FEATURES="$WITH_FEATURES :sb-thread"
443 esac
444 esac
447 ltf=`pwd`/local-target-features.lisp-expr
448 echo //initializing $ltf
449 echo ';;;; This is a machine-generated file.' > $ltf
450 echo ';;;; Please do not edit it by hand.' >> $ltf
451 echo ';;;; See make-config.sh.' >> $ltf
452 echo "(lambda (features) (set-difference (union features (list$WITH_FEATURES " >> $ltf
454 printf ":%s" "$sbcl_arch" >> $ltf
456 echo //setting up OS-dependent information
457 # Under Darwin x86-64, guess whether Darwin 9+ or below.
458 if [ "$sbcl_os" = "darwin" ] && [ "$sbcl_arch" = "x86-64" ]; then
459 darwin_version=`uname -r`
460 darwin_version_major=${DARWIN_VERSION_MAJOR:-${darwin_version%%.*}}
461 if (( 8 < $darwin_version_major )); then
462 printf ' :inode64 :darwin9-or-better' >> $ltf
466 original_dir=`pwd`
467 cd ./src/runtime/
468 rm -f Config target-arch-os.h target-arch.h target-os.h target-lispregs.h
469 rm -f sbcl.mk sbcl.o libsbcl.a
470 # KLUDGE: these two logically belong in the previous section
471 # ("architecture-dependent"); it seems silly to enforce this in terms
472 # of the shell script, though. -- CSR, 2002-02-03
473 link_or_copy $sbcl_arch-arch.h target-arch.h
474 link_or_copy $sbcl_arch-lispregs.h target-lispregs.h
475 case "$sbcl_os" in
476 linux)
477 printf ' :unix' >> $ltf
478 printf ' :elf' >> $ltf
479 printf ' :linux' >> $ltf
481 # If you add other platforms here, don't forget to edit
482 # src/runtime/Config.foo-linux too.
483 case "$sbcl_arch" in
484 mips | arm)
485 printf ' :largefile' >> $ltf
487 x86 | x86-64)
488 printf ' :sb-futex :largefile' >> $ltf
490 ppc | arm64)
491 printf ' :sb-futex' >> $ltf
493 esac
496 link_or_copy Config.$sbcl_arch-linux Config
497 link_or_copy $sbcl_arch-linux-os.h target-arch-os.h
498 link_or_copy linux-os.h target-os.h
500 osf1)
501 printf ' :unix' >> $ltf
502 printf ' :elf' >> $ltf
503 printf ' :osf1' >> $ltf
504 link_or_copy Config.$sbcl_arch-osf1 Config
505 link_or_copy $sbcl_arch-osf1-os.h target-arch-os.h
506 link_or_copy osf1-os.h target-os.h
508 hpux)
509 printf ' :unix' >> $ltf
510 printf ' :elf' >> $ltf
511 printf ' :hpux' >> $ltf
512 link_or_copy Config.$sbcl_arch-hpux Config
513 link_or_copy $sbcl_arch-hpux-os.h target-arch-os.h
514 link_or_copy hpux-os.h target-os.h
516 *bsd)
517 printf ' :unix' >> $ltf
518 printf ' :bsd' >> $ltf
519 link_or_copy $sbcl_arch-bsd-os.h target-arch-os.h
520 link_or_copy bsd-os.h target-os.h
521 case "$sbcl_os" in
522 *freebsd)
523 printf ' :elf' >> $ltf
524 printf ' :freebsd' >> $ltf
525 printf ' :gcc-tls' >> $ltf
526 if [ $sbcl_os = "gnu-kfreebsd" ]; then
527 printf ' :gnu-kfreebsd' >> $ltf
530 if [ $sbcl_arch = "x86" ]; then
531 printf ' :restore-fs-segment-register-from-tls' >> $ltf
533 link_or_copy Config.$sbcl_arch-$sbcl_os Config
535 openbsd)
536 printf ' :elf' >> $ltf
537 printf ' :openbsd' >> $ltf
538 link_or_copy Config.$sbcl_arch-openbsd Config
540 netbsd)
541 printf ' :netbsd' >> $ltf
542 printf ' :elf' >> $ltf
543 link_or_copy Config.$sbcl_arch-netbsd Config
546 echo unsupported BSD variant: `uname`
547 exit 1
549 esac
551 dragonfly)
552 printf ' :unix' >> $ltf
553 printf ' :bsd' >> $ltf
554 printf ' :elf' >> $ltf
555 printf ' :dragonfly' >> $ltf
556 printf ' :sb-qshow' >> $ltf
557 if [ $sbcl_arch = "x86" ]; then
558 printf ' :restore-fs-segment-register-from-tls' >> $ltf
560 link_or_copy $sbcl_arch-bsd-os.h target-arch-os.h
561 link_or_copy bsd-os.h target-os.h
562 link_or_copy Config.$sbcl_arch-dragonfly Config
564 darwin)
565 printf ' :unix' >> $ltf
566 printf ' :mach-o' >> $ltf
567 printf ' :bsd' >> $ltf
568 printf ' :darwin' >> $ltf
569 if [ $sbcl_arch = "x86" ]; then
570 printf ' :mach-exception-handler :restore-fs-segment-register-from-tls :ud2-breakpoints' >> $ltf
572 if [ $sbcl_arch = "x86-64" ]; then
573 printf ' :mach-exception-handler :ud2-breakpoints' >> $ltf
575 link_or_copy $sbcl_arch-darwin-os.h target-arch-os.h
576 link_or_copy bsd-os.h target-os.h
577 link_or_copy Config.$sbcl_arch-darwin Config
579 sunos)
580 printf ' :unix' >> $ltf
581 printf ' :elf' >> $ltf
582 printf ' :sunos' >> $ltf
583 if [ $sbcl_arch = "x86-64" ]; then
584 printf ' :largefile' >> $ltf
586 link_or_copy Config.$sbcl_arch-sunos Config
587 link_or_copy $sbcl_arch-sunos-os.h target-arch-os.h
588 link_or_copy sunos-os.h target-os.h
590 win32)
591 printf ' :win32' >> $ltf
593 # Optional features -- We enable them by default, but the build
594 # ought to work perfectly without them:
596 printf ' :sb-futex' >> $ltf
597 printf ' :sb-qshow' >> $ltf
599 # Required features -- Some of these used to be optional, but
600 # building without them is no longer considered supported:
602 # (Of course it doesn't provide dlopen, but there is
603 # roughly-equivalent magic nevertheless:)
604 printf ' :sb-dynamic-core :os-provides-dlopen' >> $ltf
605 printf ' :sb-thread :sb-safepoint :sb-thruption :sb-wtimer' >> $ltf
606 printf ' :sb-safepoint-strictly' >> $ltf
608 link_or_copy Config.$sbcl_arch-win32 Config
609 link_or_copy $sbcl_arch-win32-os.h target-arch-os.h
610 link_or_copy win32-os.h target-os.h
613 echo unsupported OS type: `uname`
614 exit 1
616 esac
617 cd "$original_dir"
619 # FIXME: Things like :c-stack-grows-..., etc, should be
620 # *derived-target-features* or equivalent, so that there was a nicer
621 # way to specify them then sprinkling them in this file. They should
622 # still be tweakable by advanced users, though, but probably not
623 # appear in *features* of target. #!+/- should be adjusted to take
624 # them in account as well. At minimum the nicer specification stuff,
625 # though:
627 # (define-feature :dlopen (features)
628 # (union '(:bsd :linux :darwin :sunos) features))
630 # (define-feature :c-stack-grows-downwards-not-upwards (features)
631 # (member :x86 features))
633 # KLUDGE: currently the x86 only works with the generational garbage
634 # collector (indicated by the presence of :GENCGC in *FEATURES*) and
635 # alpha, sparc and ppc with the stop'n'copy collector (indicated by
636 # the absence of :GENCGC in *FEATURES*). This isn't a great
637 # separation, but for now, rather than have :GENCGC in
638 # base-target-features.lisp-expr, we add it into local-target-features
639 # if we're building for x86. -- CSR, 2002-02-21 Then we do something
640 # similar with :STACK-GROWS-FOOWARD, too. -- WHN 2002-03-03
641 if [ "$sbcl_arch" = "x86" ]; then
642 printf ' :gencgc :stack-grows-downward-not-upward :c-stack-is-control-stack' >> $ltf
643 printf ' :compare-and-swap-vops :unwind-to-frame-and-call-vop :raw-instance-init-vops' >> $ltf
644 printf ' :stack-allocatable-closures :stack-allocatable-vectors' >> $ltf
645 printf ' :stack-allocatable-lists :stack-allocatable-fixed-objects' >> $ltf
646 printf ' :alien-callbacks :cycle-counter :inline-constants :precise-arg-count-error' >> $ltf
647 printf ' :memory-barrier-vops :multiply-high-vops :ash-right-vops :symbol-info-vops' >> $ltf
648 printf ' :fp-and-pc-standard-save :raw-signed-word' >> $ltf
649 case "$sbcl_os" in
650 linux | freebsd | gnu-kfreebsd | netbsd | openbsd | sunos | darwin | win32 | dragonfly)
651 printf ' :linkage-table' >> $ltf
652 esac
653 if [ "$sbcl_os" = "win32" ]; then
654 # of course it doesn't provide dlopen, but there is
655 # roughly-equivalent magic nevertheless.
656 printf ' :os-provides-dlopen' >> $ltf
657 else
658 printf ' :relocatable-heap' >> $ltf
660 if [ "$sbcl_os" = "openbsd" ]; then
661 rm -f src/runtime/openbsd-sigcontext.h
662 sh tools-for-build/openbsd-sigcontext.sh > src/runtime/openbsd-sigcontext.h
664 elif [ "$sbcl_arch" = "x86-64" ]; then
665 printf ' :64-bit :64-bit-registers :gencgc :stack-grows-downward-not-upward :c-stack-is-control-stack :linkage-table' >> $ltf
666 printf ' :compare-and-swap-vops :unwind-to-frame-and-call-vop :raw-instance-init-vops' >> $ltf
667 printf ' :precise-arg-count-error :fp-and-pc-standard-save :unbind-n-vop' >> $ltf
668 printf ' :stack-allocatable-closures :stack-allocatable-vectors' >> $ltf
669 printf ' :stack-allocatable-lists :stack-allocatable-fixed-objects' >> $ltf
670 printf ' :alien-callbacks :cycle-counter :complex-float-vops :raw-signed-word' >> $ltf
671 printf ' :float-eql-vops :integer-eql-vop :inline-constants :memory-barrier-vops' >> $ltf
672 printf ' :multiply-high-vops :sb-simd-pack :ash-right-vops :symbol-info-vops' >> $ltf
673 printf ' :undefined-fun-restarts' >> $ltf
674 case "$sbcl_os" in
675 linux | darwin | *bsd)
676 printf ' :immobile-space :immobile-code :compact-instance-header' >> $ltf
677 printf ' :relocatable-heap' >> $ltf
678 esac
679 elif [ "$sbcl_arch" = "mips" ]; then
680 printf ' :cheneygc :linkage-table' >> $ltf
681 printf ' :stack-allocatable-closures :stack-allocatable-vectors' >> $ltf
682 printf ' :stack-allocatable-lists :stack-allocatable-fixed-objects' >> $ltf
683 printf ' :alien-callbacks' >> $ltf
684 elif [ "$sbcl_arch" = "ppc" ]; then
685 printf ' :gencgc :stack-allocatable-closures :stack-allocatable-vectors' >> $ltf
686 printf ' :stack-allocatable-lists :stack-allocatable-fixed-objects' >> $ltf
687 printf ' :linkage-table :raw-instance-init-vops :memory-barrier-vops' >> $ltf
688 printf ' :compare-and-swap-vops :multiply-high-vops :alien-callbacks' >> $ltf
689 printf ' :relocatable-heap' >> $ltf
690 if [ "$sbcl_os" = "linux" ]; then
691 # Use a C program to detect which kind of glibc we're building on,
692 # to bandage across the break in source compatibility between
693 # versions 2.3.1 and 2.3.2
695 # FIXME: integrate to grovel-features, mayhaps
696 $GNUMAKE -C tools-for-build where-is-mcontext -I ../src/runtime
697 tools-for-build/where-is-mcontext > src/runtime/ppc-linux-mcontext.h || (echo "error running where-is-mcontext"; exit 1)
698 elif [ "$sbcl_os" = "darwin" ]; then
699 # We provide a dlopen shim, so a little lie won't hurt
700 printf ' :os-provides-dlopen' >> $ltf
701 # The default stack ulimit under darwin is too small to run PURIFY.
702 # Best we can do is complain and exit at this stage
703 if [ "`ulimit -s`" = "512" ]; then
704 echo "Your stack size limit is too small to build SBCL."
705 echo "See the limit(1) or ulimit(1) commands and the README file."
706 exit 1
709 elif [ "$sbcl_arch" = "sparc" ]; then
710 # Test the compiler in order to see if we are building on Sun
711 # toolchain as opposed to GNU binutils, and write the appropriate
712 # FUNCDEF macro for assembler. No harm in running this on sparc-linux
713 # as well.
714 sh tools-for-build/sparc-funcdef.sh > src/runtime/sparc-funcdef.h
715 if [ "$sbcl_os" = "sunos" ] || [ "$sbcl_os" = "linux" ]; then
716 printf ' :gencgc :relocatable-heap' >> $ltf
717 else
718 echo '***'
719 echo '*** You are running SPARC on non-SunOS, non-Linux. Since'
720 echo '*** GENCGC is untested on this combination, make-config.sh'
721 echo '*** is falling back to CHENEYGC. Please consider adjusting'
722 echo '*** parms.lisp to build with GENCGC instead.'
723 echo '***'
724 printf ' :cheneygc' >> $ltf
726 if [ "$sbcl_os" = "sunos" ] || [ "$sbcl_os" = "linux" ]; then
727 printf ' :linkage-table' >> $ltf
729 printf ' :stack-allocatable-closures :stack-allocatable-lists' >> $ltf
730 elif [ "$sbcl_arch" = "alpha" ]; then
731 printf ' :cheneygc' >> $ltf
732 printf ' :64-bit-registers' >> $ltf
733 printf ' :stack-allocatable-closures :stack-allocatable-lists' >> $ltf
734 printf ' :stack-allocatable-fixed-objects' >> $ltf
735 elif [ "$sbcl_arch" = "hppa" ]; then
736 printf ' :cheneygc' >> $ltf
737 printf ' :stack-allocatable-vectors :stack-allocatable-fixed-objects' >> $ltf
738 printf ' :stack-allocatable-closures :stack-allocatable-lists' >> $ltf
739 elif [ "$sbcl_arch" = "arm" ]; then
740 printf ' :gencgc :linkage-table :alien-callbacks' >> $ltf
741 # As opposed to soft-float or FPA, we support VFP only (and
742 # possibly VFPv2 and higher only), but we'll leave the obvious
743 # hooks in for someone to add the support later.
744 printf ' :arm-vfp :arm-vfpv2' >> $ltf
745 printf ' :ash-right-vops :multiply-high-vops :symbol-info-vops' >> $ltf
746 printf ' :stack-allocatable-lists :stack-allocatable-fixed-objects' >> $ltf
747 printf ' :stack-allocatable-vectors :stack-allocatable-closures' >> $ltf
748 printf ' :precise-arg-count-error :unwind-to-frame-and-call-vop' >> $ltf
749 printf ' :fp-and-pc-standard-save :relocatable-heap' >> $ltf
750 elif [ "$sbcl_arch" = "arm64" ]; then
751 printf ' :64-bit :64-bit-registers :gencgc :linkage-table :fp-and-pc-standard-save' >> $ltf
752 printf ' :alien-callbacks :precise-arg-count-error :inline-constants' >> $ltf
753 printf ' :ash-right-vops :multiply-high-vops :symbol-info-vops' >> $ltf
754 printf ' :stack-allocatable-lists :stack-allocatable-fixed-objects' >> $ltf
755 printf ' :stack-allocatable-vectors :stack-allocatable-closures' >> $ltf
756 printf ' :unbind-n-vop :unwind-to-frame-and-call-vop :raw-signed-word' >> $ltf
757 printf ' :compare-and-swap-vops :memory-barrier-vops :undefined-fun-restarts' >> $ltf
758 printf ' :relocatable-heap' >> $ltf
759 else
760 # Nothing need be done in this case, but sh syntax wants a placeholder.
761 echo > /dev/null
764 # Use a little C program to try to guess the endianness. Ware
765 # cross-compilers!
767 # FIXME: integrate to grovel-features, mayhaps
768 $GNUMAKE -C tools-for-build determine-endianness -I ../src/runtime
769 tools-for-build/determine-endianness >> $ltf
771 export sbcl_os sbcl_arch
772 sh tools-for-build/grovel-features.sh >> $ltf
774 echo //finishing $ltf
775 echo ")) (list$WITHOUT_FEATURES)))" >> $ltf
777 # FIXME: The version system should probably be redone along these lines:
779 # echo //setting up version information.
780 # versionfile=version.txt
781 # cp base-version.txt $versionfile
782 # echo " (built `date -u` by `whoami`@`hostname`)" >> $versionfile
783 # echo 'This is a machine-generated file and should not be edited by hand.' >> $versionfile
785 # Make a unique ID for this build (to discourage people from
786 # mismatching sbcl and *.core files).
787 if [ `uname` = "SunOS" ] ; then
788 # use /usr/xpg4/bin/id instead of /usr/bin/id
789 PATH=/usr/xpg4/bin:$PATH
791 echo '"'`hostname`-`id -un`-`date +%Y-%m-%d-%H-%M-%S`'"' > output/build-id.inc
793 if [ -n "$SBCL_HOST_LOCATION" ]; then
794 echo //setting up host configuration
795 rsync --delete-after -a output/ "$SBCL_HOST_LOCATION/output/"
796 rsync -a local-target-features.lisp-expr version.lisp-expr "$SBCL_HOST_LOCATION/"