stack: Avoid duplicating some %PRESERVE-DYNAMIC-EXTENT nodes.
[sbcl.git] / make-config.sh
blob6bf2c7ed91049c88e8870b4bca9a8c4423c88373
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 if [ "$OSTYPE" = "cygwin" -o "$OSTYPE" = "msys" ]
23 then
24 SBCL_PREFIX="$PROGRAMFILES/sbcl"
25 else
26 SBCL_PREFIX="/usr/local"
28 SBCL_XC_HOST="sbcl --no-userinit --no-sysinit"
30 # Parse command-line options.
31 bad_option() {
32 echo $1
33 echo "Enter \"$0 --help\" for list of valid options."
34 exit 1
37 WITH_FEATURES=""
38 WITHOUT_FEATURES=""
39 FANCY_FEATURES=":sb-core-compression :sb-xref-for-internals :sb-after-xc-core"
40 CONTRIBS=""
41 for dir in `cd contrib ; echo *`; do
42 if [ -d "contrib/$dir" -a -f "contrib/$dir/Makefile" ]; then
43 CONTRIBS="$CONTRIBS ${dir}"
45 done
46 SBCL_CONTRIB_BLOCKLIST=${SBCL_CONTRIB_BLOCKLIST:-""}
48 perform_host_lisp_check=no
49 fancy=false
50 some_options=false
51 android=false
52 if [ -z "$ANDROID_API" ]; then
53 ANDROID_API=21
55 for option
57 optarg_ok=true
58 # Split --foo=bar into --foo and bar.
59 case $option in
60 *=*)
61 # For ease of scripting skip valued options with empty
62 # values.
63 optarg=`expr "X$option" : '[^=]*=\(.*\)'` || optarg_ok=false
64 option=`expr "X$option" : 'X\([^=]*=\).*'`
66 --with*)
67 optarg=`expr "X$option" : 'X--[^-]*-\(.*\)'` \
68 || bad_option "Malformed feature toggle: $option"
69 option=`expr "X$option" : 'X\(--[^-]*\).*'`
72 optarg=""
74 esac
76 case $option in
77 --help | -help | -h)
78 print_help="yes" ;;
79 --prefix=)
80 $optarg_ok && SBCL_PREFIX=$optarg
82 --arch=)
83 $oparg_ok && SBCL_ARCH=$optarg
85 --xc-host=)
86 $optarg_ok && SBCL_XC_HOST=$optarg
88 --host-location=)
89 $optarg_ok && SBCL_HOST_LOCATION=$optarg
91 --target-location=)
92 $optarg_ok && SBCL_TARGET_LOCATION=$optarg
94 --dynamic-space-size=)
95 $optarg_ok && SBCL_DYNAMIC_SPACE_SIZE=$optarg
97 --with)
98 WITH_FEATURES="$WITH_FEATURES :$optarg"
99 if [ "$optarg" = "android" ]
100 then
101 android=true
104 --without)
105 WITHOUT_FEATURES="$WITHOUT_FEATURES :$optarg"
106 case $CONTRIBS
107 in *"$optarg"*)
108 SBCL_CONTRIB_BLOCKLIST="$SBCL_CONTRIB_BLOCKLIST $optarg"
109 ;; esac
111 --android-api=)
112 $optarg_ok && ANDROID_API=$optarg
114 --ndk=)
115 $optarg_ok && NDK=$optarg
117 --fancy)
118 WITH_FEATURES="$WITH_FEATURES $FANCY_FEATURES"
119 # Lower down we add :sb-thread for platforms where it can be built.
120 fancy=true
122 --check-host-lisp)
123 perform_host_lisp_check=yes
126 bad_option "Unknown command-line option to $0: \"$option\""
129 if $some_options
130 then
131 bad_option "Unknown command-line option to $0: \"$option\""
132 else
133 SBCL_XC_HOST=$option
136 esac
137 some_options=true
138 done
140 if (test -f customize-target-features.lisp && \
141 (test -n "$WITH_FEATURES" || test -n "$WITHOUT_FEATURES"))
142 then
143 # Actually there's no reason why it would not work, but it would
144 # be confusing to say --with-thread only to have it turned off by
145 # customize-target-features.lisp...
146 echo "ERROR: Both customize-target-features.lisp, and feature-options"
147 echo "to make.sh present -- cannot use both at the same time."
148 exit 1
151 if test "$print_help" = "yes"
152 then
153 cat <<EOF
154 \`make.sh' drives the SBCL build.
156 Usage: $0 [OPTION]...
158 Important: make.sh does not currently control the entirety of the
159 build: configuration file customize-target-features.lisp and certain
160 environment variables play a role as well. see file INSTALL for
161 details.
163 Options:
164 -h, --help Display this help and exit.
166 --prefix=<path> Specify the install location.
168 Script install.sh installs SBCL under the specified prefix
169 path: runtime as prefix/bin/sbcl, additional files under
170 prefix/lib/sbcl, and documentation under prefix/share.
172 This option also affects the binaries: built-in default for
173 SBCL_HOME is: prefix/lib/sbcl/
175 Default prefix is: /usr/local
177 --dynamic-space-size=<size> Default dynamic-space size for target.
179 This specifies the default dynamic-space size for the SBCL
180 being built. If you need to control the dynamic-space size
181 of the host SBCL, use the --xc-host option.
183 If not provided, the default is platform-specific. <size> is
184 taken to be megabytes unless explicitly suffixed with Gb in
185 order to specify the size in gigabytes.
187 --with-<feature> Build with specified feature.
188 --without-<feature> Build wihout the specfied feature.
190 --fancy Build with several optional features:
192 $FANCY_FEATURES
194 Plus threading on platforms which support it.
196 --arch=<string> Specify the architecture to build for.
198 Mainly for doing x86 builds on x86-64.
200 --xc-host=<string> Specify the Common Lisp compilation host.
202 The string provided should be a command to invoke the
203 cross-compilation Lisp system in such a way, that it reads
204 commands from standard input, and terminates when it reaches end
205 of file on standard input.
207 Examples:
209 "sbcl --disable-debugger --no-sysinit --no-userinit"
210 Use an existing SBCL binary as a cross-compilation
211 host even though you have stuff in your
212 initialization files which makes it behave in such a
213 non-standard way that it keeps the build from
214 working. Also disable the debugger instead of
215 waiting endlessly for a programmer to help it out
216 with input on *DEBUG-IO*. (This is the default.)
218 "sbcl"
219 Use an existing SBCL binary as a cross-compilation
220 host, including your initialization files and
221 building with the debugger enabled. Not recommended
222 for casual users.
224 "lisp -noinit -batch"
225 Use an existing CMU CL binary as a cross-compilation
226 host when you have weird things in your .cmucl-init
227 file.
229 --host-location=<string> Location of the source directory on compilation host
231 The string is passed to the command rsync to transfer the
232 necessary files between the target and host directories during
233 the make-target-*.sh steps of cross-compilation (cf. make.sh)
235 Examples:
237 user@host-machine:/home/user/sbcl
238 Transfer the files to/from directory /home/user/sbcl
239 on host-machine.
242 exit 1
245 mkdir -p output
246 echo "SBCL_TEST_HOST=\"$SBCL_XC_HOST\"" > output/build-config
247 . output/build-config # may come out differently due to escaping
249 if [ $perform_host_lisp_check = yes ]
250 then
251 if echo '(lisp-implementation-type)' | $SBCL_TEST_HOST; then
253 else
254 echo "No working host Common Lisp implementation."
255 echo 'See ./INSTALL, the "SOURCE DISTRIBUTION" section'
256 exit 1
260 # Running make.sh with different options without clean.sh in the middle
261 # can break things.
262 sh clean.sh
264 # Save prefix for make and install.sh.
265 echo "SBCL_PREFIX='$SBCL_PREFIX'" > output/prefix.def
266 echo "$SBCL_DYNAMIC_SPACE_SIZE" > output/dynamic-space-size.txt
268 # FIXME: Tweak this script, and the rest of the system, to support
269 # a second bootstrapping pass in which the cross-compilation host is
270 # known to be SBCL itself, so that the cross-compiler can do some
271 # optimizations (especially specializable arrays) that it doesn't
272 # know how to implement how in a portable way. (Or maybe that wouldn't
273 # require a second pass, just testing at build-the-cross-compiler time
274 # whether the cross-compilation host returns suitable values from
275 # UPGRADED-ARRAY-ELEMENT-TYPE?)
277 . ./find-gnumake.sh
278 find_gnumake
280 ./generate-version.sh
282 # Now that we've done our option parsing and found various
283 # dependencies, write them out to a file to be sourced by other
284 # scripts.
286 echo "GNUMAKE=\"$GNUMAKE\"; export GNUMAKE" >> output/build-config
287 echo "SBCL_XC_HOST=\"$SBCL_XC_HOST\"; export SBCL_XC_HOST" >> output/build-config
288 if [ -n "$SBCL_HOST_LOCATION" ]; then
289 echo "SBCL_HOST_LOCATION=\"$SBCL_HOST_LOCATION\"; export SBCL_HOST_LOCATION" >> output/build-config
291 if [ -n "$SBCL_TARGET_LOCATION" ]; then
292 echo "SBCL_TARGET_LOCATION=\"$SBCL_TARGET_LOCATION\"; export SBCL_TARGET_LOCATION" >> output/build-config
294 echo "android=$android; export android" >> output/build-config
296 # And now, sorting out the per-target dependencies...
298 case `uname` in
299 Linux)
300 sbcl_os="linux"
302 *BSD)
303 case `uname` in
304 FreeBSD)
305 sbcl_os="freebsd"
307 GNU/kFreeBSD)
308 sbcl_os="gnu-kfreebsd"
310 OpenBSD)
311 sbcl_os="openbsd"
313 NetBSD)
314 sbcl_os="netbsd"
317 echo unsupported BSD variant: `uname`
318 exit 1
320 esac
322 DragonFly)
323 sbcl_os="dragonflybsd"
325 Darwin)
326 sbcl_os="darwin"
328 SunOS)
329 sbcl_os="sunos"
331 CYGWIN* | WindowsNT | MINGW* | MSYS*)
332 sbcl_os="win32"
334 Haiku)
335 sbcl_os="haiku"
338 echo unsupported OS type: `uname`
339 exit 1
341 esac
343 link_or_copy() {
344 if [ "$sbcl_os" = "win32" ] ; then
345 # Use preprocessor or makefile includes instead of copying if
346 # possible, to avoid unexpected use of the original, unchanged
347 # files when re-running only make-target-1 during development.
348 if echo "$1" | egrep '[.][ch]$'; then
349 echo "#include \"$1\"" >"$2"
350 elif echo "$1" | egrep '^Config[.]'; then
351 echo "include $1" >"$2"
352 else
353 cp -r "$1" "$2"
355 elif $android ; then
356 # adb push doesn't like symlinks on unrooted devices.
357 cp -r "$1" "$2"
358 else
359 ln -s "$1" "$2"
363 remove_dir_safely() {
364 if [ "$sbcl_os" = "win32" ] ; then
365 if [ -d "$1" ] ; then
366 rm -rf "$1"
367 elif [ -e "$1" ] ; then
368 echo "I'm afraid to remove non-directory $1."
369 exit 1
371 else
372 if [ -h "$1" ] ; then
373 rm "$1"
374 elif [ -w "$1" ] ; then
375 echo "I'm afraid to replace non-symlink $1 with a symlink."
376 exit 1
381 echo //entering make-config.sh
383 echo //ensuring the existence of output/ directory
384 if [ ! -d output ] ; then mkdir output; fi
386 echo //guessing default target CPU architecture from host architecture
387 if $android
388 then
389 uname_arch=`adb shell uname -m`
390 else
391 uname_arch=`uname -m`
394 case $uname_arch in
395 *86) guessed_sbcl_arch=x86 ;;
396 i86pc) guessed_sbcl_arch=x86 ;;
397 *x86_64) guessed_sbcl_arch=x86-64 ;;
398 amd64) guessed_sbcl_arch=x86-64 ;;
399 sparc*) guessed_sbcl_arch=sparc ;;
400 sun*) guessed_sbcl_arch=sparc ;;
401 *ppc) guessed_sbcl_arch=ppc ;;
402 ppc64) guessed_sbcl_arch=ppc ;;
403 ppc64le) guessed_sbcl_arch=ppc64 ;; # is ok because there was never 32-bit LE
404 Power*Macintosh) guessed_sbcl_arch=ppc ;;
405 ibmnws) guessed_sbcl_arch=ppc ;;
406 mips*) guessed_sbcl_arch=mips ;;
407 arm64) guessed_sbcl_arch=arm64 ;;
408 *arm*) guessed_sbcl_arch=arm ;;
409 aarch64) guessed_sbcl_arch=arm64 ;;
410 riscv32) guessed_sbcl_arch=riscv xlen=32;;
411 riscv64) guessed_sbcl_arch=riscv xlen=64;;
413 # If we're not building on a supported target architecture, we
414 # we have no guess, but it's not an error yet, since maybe
415 # target architecture will be specified explicitly below.
416 guessed_sbcl_arch=''
418 esac
420 # Under Solaris, uname -m returns "i86pc" even if CPU is amd64.
421 if [ "$sbcl_os" = "sunos" ] && [ `isainfo -k` = "amd64" ]; then
422 guessed_sbcl_arch=x86-64
425 # Under Darwin, uname -m returns "i386" even if CPU is x86_64.
426 # (I suspect this is not true any more - it reports "x86_64 for me)
427 if [ "$sbcl_os" = "darwin" ] && [ "`/usr/sbin/sysctl -n hw.optional.x86_64`" = "1" ]; then
428 guessed_sbcl_arch=x86-64
431 # Under NetBSD, uname -m returns "evbarm" even if CPU is arm64.
432 if [ "$sbcl_os" = "netbsd" ] && [ `uname -p` = "aarch64" ]; then
433 guessed_sbcl_arch=arm64
436 echo //setting up CPU-architecture-dependent information
437 if test -n "$SBCL_ARCH"
438 then
439 # Normalize it.
440 SBCL_ARCH=`echo $SBCL_ARCH | tr '[A-Z]' '[a-z]' | tr _ -`
441 case $SBCL_ARCH in
442 riscv*)
443 case $SBCL_ARCH in
444 riscv32) SBCL_ARCH=riscv xlen=32;;
445 riscv64) SBCL_ARCH=riscv xlen=64;;
447 echo "Please choose between riscv32 and riscv64."
448 exit 1
449 esac
450 esac
452 sbcl_arch=${SBCL_ARCH:-$guessed_sbcl_arch}
453 echo sbcl_arch=\"$sbcl_arch\"
454 if [ "$sbcl_arch" = "" ] ; then
455 echo "can't guess target SBCL architecture, please specify --arch=<name>"
456 exit 1
459 if $android
460 then
461 case $sbcl_arch in
462 arm64) TARGET_TAG=aarch64-linux-android ;;
463 arm) TARGET_TAG=armv7a-linux-androideabi
464 echo "Unsupported configuration"
465 exit 1
467 x86) TARGET_TAG=i686-linux-android
468 echo "Unsupported configuration"
469 exit 1
471 x86-64) TARGET_TAG=x86_64-linux-android ;;
472 esac
473 HOST_TAG=$sbcl_os-x86_64
474 TOOLCHAIN=$NDK/toolchains/llvm/prebuilt/$HOST_TAG
475 export CC=$TOOLCHAIN/bin/$TARGET_TAG$ANDROID_API-clang
476 echo "CC=$CC; export CC" >> output/build-config
477 echo "NDK=$NDK" > output/ndk-config
478 echo "HOST_TAG=$HOST_TAG" >> output/ndk-config
479 echo "TARGET_TAG=$TARGET_TAG" >> output/ndk-config
480 echo "TOOLCHAIN=$TOOLCHAIN" >> output/ndk-config
481 echo "ANDROID_API=$ANDROID_API" >> output/ndk-config
484 if $fancy
485 then
486 # If --fancy, enable threads on platforms where they can be built.
487 case $sbcl_arch in
488 x86|x86-64|ppc|arm64|riscv)
489 if [ "$sbcl_os" = "dragonflybsd" ]
490 then
491 echo "No threads on this platform."
492 else
493 WITH_FEATURES="$WITH_FEATURES :sb-thread"
494 echo "Enabling threads due to --fancy."
498 echo "No threads on this platform."
500 esac
501 else
502 case $sbcl_arch in
503 x86|x86-64)
504 case $sbcl_os in
505 linux|darwin)
506 WITH_FEATURES="$WITH_FEATURES :sb-thread"
507 esac
508 esac
509 case $sbcl_arch in
510 arm64|riscv)
511 WITH_FEATURES="$WITH_FEATURES :sb-thread"
512 esac
515 case "$sbcl_os" in
516 netbsd)
517 # default to using paxctl to disable mprotect restrictions
518 if [ "x$(sysctl -n security.pax.mprotect.enabled 2>/dev/null)" = x1 -a \
519 "x$SBCL_PAXCTL" = x ]; then
520 echo "SBCL_PAXCTL=\"/usr/sbin/paxctl +m\"; export SBCL_PAXCTL" \
521 >> output/build-config
524 openbsd)
525 # openbsd 6.0 and newer restrict mmap of RWX pages
526 if [ `uname -r | tr -d .` -gt 60 ]; then
527 rm -f tools-for-build/mmap-rwx
528 LDFLAGS="$LDFLAGS -Wl,-zwxneeded" $GNUMAKE -C tools-for-build mmap-rwx -I ../src/runtime
529 if ! ./tools-for-build/mmap-rwx; then
530 echo "Can't mmap() RWX pages!"
531 echo "Is the current filesystem mounted with wxallowed?"
532 exit 1
536 esac
538 ltf=`pwd`/local-target-features.lisp-expr
539 echo //initializing $ltf
540 echo ';;;; This is a machine-generated file.' > $ltf
541 echo ';;;; Please do not edit it by hand.' >> $ltf
542 echo ';;;; See make-config.sh.' >> $ltf
543 echo "(lambda (features) (set-difference (union features (list :${sbcl_arch}$WITH_FEATURES" >> $ltf
545 # Automatically block sb-simd on non-x86 platforms, at least for now.
546 case "$sbcl_arch" in
547 x86-64) ;; *) SBCL_CONTRIB_BLOCKLIST="$SBCL_CONTRIB_BLOCKLIST sb-simd" ;;
548 esac
550 echo //setting up OS-dependent information
552 original_dir=`pwd`
553 cd ./src/runtime/
554 rm -f Config target-arch-os.h target-arch.h target-os.h target-lispregs.h
555 rm -f sbcl.mk sbcl.o libsbcl.a
556 # KLUDGE: these two logically belong in the previous section
557 # ("architecture-dependent"); it seems silly to enforce this in terms
558 # of the shell script, though. -- CSR, 2002-02-03
559 link_or_copy $sbcl_arch-arch.h target-arch.h
560 link_or_copy $sbcl_arch-lispregs.h target-lispregs.h
561 case "$sbcl_os" in
562 linux)
563 printf ' :unix :linux :elf' >> $ltf
564 case "$sbcl_arch" in
565 arm64 | ppc64 | x86 | x86-64)
566 printf ' :gcc-tls' >> $ltf
567 esac
568 case "$sbcl_arch" in
569 arm | arm64 | ppc | ppc64 | x86 | x86-64)
570 printf ' :use-sys-mmap' >> $ltf
571 esac
573 # If you add other platforms here, don't forget to edit
574 # src/runtime/Config.foo-linux too.
575 case "$sbcl_arch" in
576 mips | arm | x86 | x86-64)
577 printf ' :largefile' >> $ltf
579 esac
580 if $android
581 then
582 link_or_copy Config.$sbcl_arch-android Config
583 link_or_copy $sbcl_arch-android-os.h target-arch-os.h
584 link_or_copy android-os.h target-os.h
585 else
586 link_or_copy Config.$sbcl_arch-linux Config
587 link_or_copy $sbcl_arch-linux-os.h target-arch-os.h
588 link_or_copy linux-os.h target-os.h
591 haiku)
592 printf ' :unix :haiku :elf :int4-breakpoints' >> $ltf
593 link_or_copy Config.$sbcl_arch-haiku Config
594 link_or_copy $sbcl_arch-haiku-os.h target-arch-os.h
595 link_or_copy haiku-os.h target-os.h
597 *bsd)
598 printf ' :unix :bsd :elf' >> $ltf
599 # FIXME: can we enable :gcc-tls across all variants?
600 link_or_copy $sbcl_arch-bsd-os.h target-arch-os.h
601 link_or_copy bsd-os.h target-os.h
602 case "$sbcl_os" in
603 *freebsd)
604 printf ' :freebsd' >> $ltf
605 printf ' :gcc-tls' >> $ltf
606 if [ $sbcl_os = "gnu-kfreebsd" ]; then
607 printf ' :gnu-kfreebsd' >> $ltf
609 link_or_copy Config.$sbcl_arch-$sbcl_os Config
611 openbsd)
612 printf ' :openbsd' >> $ltf
613 printf ' :gcc-tls' >> $ltf
614 link_or_copy Config.$sbcl_arch-openbsd Config
616 netbsd)
617 printf ' :netbsd' >> $ltf
618 link_or_copy Config.$sbcl_arch-netbsd Config
620 dragonflybsd)
621 printf ' :dragonfly' >> $ltf
622 link_or_copy Config.$sbcl_arch-dragonfly Config
625 echo unsupported BSD variant: `uname`
626 exit 1
628 esac
630 darwin)
631 printf ' :unix :bsd :darwin :mach-o' >> $ltf
632 darwin_version=`uname -r`
633 darwin_version_major=${DARWIN_VERSION_MAJOR:-${darwin_version%%.*}}
634 if (( 10 > $darwin_version_major )) || [ $sbcl_arch = "ppc" ]; then
635 printf ' :use-darwin-posix-semaphores :avoid-pthread-setname-np' >> $ltf
637 if (( 15 > $darwin_version_major )); then
638 printf ' :avoid-clock-gettime' >> $ltf
640 if [ $sbcl_arch = "x86-64" ]; then
641 if (( 8 < $darwin_version_major )); then
642 printf ' :inode64' >> $ltf
644 printf ' :gcc-tls' >> $ltf
646 if [ $sbcl_arch = "arm64" ]; then
647 printf ' :darwin-jit :gcc-tls' >> $ltf
649 if $android; then
650 echo "Android build is unsupported on darwin"
652 link_or_copy $sbcl_arch-darwin-os.h target-arch-os.h
653 link_or_copy bsd-os.h target-os.h
654 link_or_copy Config.$sbcl_arch-darwin Config
656 sunos)
657 printf ' :unix :sunos :elf' >> $ltf
658 link_or_copy Config.$sbcl_arch-sunos Config
659 link_or_copy $sbcl_arch-sunos-os.h target-arch-os.h
660 link_or_copy sunos-os.h target-os.h
662 win32)
663 printf ' :win32' >> $ltf
665 # Required features -- Some of these used to be optional, but
666 # building without them is no longer considered supported:
668 # (Of course it doesn't provide dlopen, but there is
669 # roughly-equivalent magic nevertheless:)
670 printf ' :os-provides-dlopen' >> $ltf
671 printf ' :sb-thread :sb-safepoint' >> $ltf
673 link_or_copy Config.$sbcl_arch-win32 Config
674 link_or_copy $sbcl_arch-win32-os.h target-arch-os.h
675 link_or_copy win32-os.h target-os.h
678 echo unsupported OS type: `uname`
679 exit 1
681 esac
682 cd "$original_dir"
684 # FIXME: Things like :c-stack-grows-..., etc, should be
685 # *derived-target-features* or equivalent, so that there was a nicer
686 # way to specify them then sprinkling them in this file. They should
687 # still be tweakable by advanced users, though, but probably not
688 # appear in *features* of target. #+/- should be adjusted to take
689 # them in account as well. At minimum the nicer specification stuff,
690 # though:
692 # (define-feature :dlopen (features)
693 # (union '(:bsd :linux :darwin :sunos) features))
695 # (define-feature :c-stack-grows-downwards-not-upwards (features)
696 # (member :x86 features))
698 if $android
699 then
700 . tools-for-build/android_run.sh
703 case "$sbcl_arch" in
704 x86)
705 if [ "$sbcl_os" = "win32" ]; then
706 # of course it doesn't provide dlopen, but there is
707 # roughly-equivalent magic nevertheless.
708 printf ' :os-provides-dlopen' >> $ltf
710 if [ "$sbcl_os" = "openbsd" ]; then
711 rm -f src/runtime/openbsd-sigcontext.h
712 sh tools-for-build/openbsd-sigcontext.sh > src/runtime/openbsd-sigcontext.h
715 x86-64)
716 printf ' :sb-simd-pack :sb-simd-pack-256 :avx2' >> $ltf # not mandatory
718 if $android; then
719 $GNUMAKE -C tools-for-build avx2 2> /dev/null
720 if ! android_run tools-for-build/avx2 ; then
721 SBCL_CONTRIB_BLOCKLIST="$SBCL_CONTRIB_BLOCKLIST sb-simd"
723 else
724 if ! $GNUMAKE -C tools-for-build avx2 2> /dev/null || tools-for-build/avx2 ; then
725 SBCL_CONTRIB_BLOCKLIST="$SBCL_CONTRIB_BLOCKLIST sb-simd"
729 case "$sbcl_os" in
730 linux | darwin | *bsd | win32)
731 printf ' :immobile-space' >> $ltf
732 esac
734 ppc)
735 if [ "$sbcl_os" = "linux" ]; then
736 # Use a C program to detect which kind of glibc we're building on,
737 # to bandage across the break in source compatibility between
738 # versions 2.3.1 and 2.3.2
740 # FIXME: integrate to grovel-features, mayhaps
741 $GNUMAKE -C tools-for-build where-is-mcontext -I ../src/runtime
742 tools-for-build/where-is-mcontext > src/runtime/ppc-linux-mcontext.h || (echo "error running where-is-mcontext"; exit 1)
743 elif [ "$sbcl_os" = "darwin" ]; then
744 # We provide a dlopen shim, so a little lie won't hurt
745 printf ' :os-provides-dlopen' >> $ltf
746 # The default stack ulimit under darwin is too small to run PURIFY.
747 # Best we can do is complain and exit at this stage
748 if [ "`ulimit -s`" = "512" ]; then
749 echo "Your stack size limit is too small to build SBCL."
750 echo "See the limit(1) or ulimit(1) commands and the README file."
751 exit 1
755 ppc64)
756 # there is no glibc bug that requires the 'where-is-mcontext' hack.
757 # (Sufficiently new glibc uses the correct definition, which is the same as
758 # 2.3.1, so define our constant for that)
759 echo '#define GLIBC231_STYLE_UCONTEXT 1' > src/runtime/ppc-linux-mcontext.h
761 riscv)
762 if [ "$xlen" = "64" ]; then
763 printf ' :64-bit' >> $ltf
764 elif [ "$xlen" = "32" ]; then
766 else
767 echo 'Architecture word width unspecified. (Either 32-bit or 64-bit.)'
768 exit 1
771 esac
773 if [ "$sbcl_os" = darwin -a "$sbcl_arch" = arm64 ]
774 then
775 # Launching new executables is pretty slow on macOS, but this configuration is pretty uniform
776 echo ' :little-endian :os-provides-dlopen :os-provides-dladdr :os-provides-blksize-t :os-provides-suseconds-t' >> $ltf
777 else
778 # Use a little C program to try to guess the endianness. Ware
779 # cross-compilers!
781 # FIXME: integrate to grovel-features, mayhaps
782 if $android
783 then
784 $CC tools-for-build/determine-endianness.c -o tools-for-build/determine-endianness
785 android_run tools-for-build/determine-endianness >> $ltf
786 else
787 $GNUMAKE -C tools-for-build determine-endianness -I ../src/runtime
788 tools-for-build/determine-endianness >> $ltf
790 export sbcl_os sbcl_arch android
791 sh tools-for-build/grovel-features.sh >> $ltf
795 echo //finishing $ltf
796 printf " %s" "`cat crossbuild-runner/backends/${sbcl_arch}/features`" >> $ltf
797 echo ")) (list$WITHOUT_FEATURES)))" >> $ltf
799 echo "SBCL_CONTRIB_BLOCKLIST=\"$SBCL_CONTRIB_BLOCKLIST\"; export SBCL_CONTRIB_BLOCKLIST" >> output/build-config
801 # FIXME: The version system should probably be redone along these lines:
803 # echo //setting up version information.
804 # versionfile=version.txt
805 # cp base-version.txt $versionfile
806 # echo " (built `date -u` by `whoami`@`hostname`)" >> $versionfile
807 # echo 'This is a machine-generated file and should not be edited by hand.' >> $versionfile
809 # Make a unique ID for this build (to discourage people from
810 # mismatching sbcl and *.core files).
811 if [ `uname` = "SunOS" ] ; then
812 # use /usr/xpg4/bin/id instead of /usr/bin/id
813 PATH=/usr/xpg4/bin:$PATH
815 echo '"'`hostname`-`id -un`-`date +%Y-%m-%d-%H-%M-%S`'"' > output/build-id.inc
817 if [ -n "$SBCL_HOST_LOCATION" ]; then
818 echo //setting up host configuration
819 rsync --delete-after -a output/ "$SBCL_HOST_LOCATION/output/"
820 rsync -a local-target-features.lisp-expr version.lisp-expr "$SBCL_HOST_LOCATION/"