sb-posix NetBSD fixups
[sbcl.git] / make-config.sh
blobb219dfc666013fcef626fd1047ef0a811d22e251
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
246 generate_version
248 # Now that we've done our option parsing and found various
249 # dependencies, write them out to a file to be sourced by other
250 # scripts.
252 echo "DEVNULL=\"$DEVNULL\"; export DEVNULL" > output/build-config
253 echo "GNUMAKE=\"$GNUMAKE\"; export GNUMAKE" >> output/build-config
254 echo "SBCL_XC_HOST=\"$SBCL_XC_HOST\"; export SBCL_XC_HOST" >> output/build-config
255 echo "legacy_xc_spec=\"$legacy_xc_spec\"; export legacy_xc_spec" >> output/build-config
256 if [ -n "$SBCL_HOST_LOCATION" ]; then
257 echo "SBCL_HOST_LOCATION=\"$SBCL_HOST_LOCATION\"; export SBCL_HOST_LOCATION" >> output/build-config
259 if [ -n "$SBCL_TARGET_LOCATION" ]; then
260 echo "SBCL_TARGET_LOCATION=\"$SBCL_TARGET_LOCATION\"; export SBCL_TARGET_LOCATION" >> output/build-config
263 # And now, sorting out the per-target dependencies...
265 case `uname` in
266 Linux)
267 sbcl_os="linux"
269 OSF1)
270 # it's changed name twice since it was called OSF/1: clearly
271 # the marketers forgot to tell the engineers about Digital Unix
272 # _or_ OSF/1 ...
273 sbcl_os="osf1"
275 *BSD)
276 case `uname` in
277 *FreeBSD)
278 sbcl_os="freebsd"
280 OpenBSD)
281 sbcl_os="openbsd"
283 NetBSD)
284 sbcl_os="netbsd"
287 echo unsupported BSD variant: `uname`
288 exit 1
290 esac
292 Darwin)
293 sbcl_os="darwin"
295 SunOS)
296 sbcl_os="sunos"
298 CYGWIN* | WindowsNT | MINGW*)
299 sbcl_os="win32"
301 HP-UX)
302 sbcl_os="hpux"
305 echo unsupported OS type: `uname`
306 exit 1
308 esac
310 link_or_copy() {
311 if [ "$sbcl_os" = "win32" ] ; then
312 # Use preprocessor or makefile includes instead of copying if
313 # possible, to avoid unexpected use of the original, unchanged
314 # files when re-running only make-target-1 during development.
315 if echo "$1" | egrep '[.][ch]$'; then
316 echo "#include \"$1\"" >"$2"
317 elif echo "$1" | egrep '^Config[.]'; then
318 echo "include $1" >"$2"
319 else
320 cp -r "$1" "$2"
322 else
323 ln -s "$1" "$2"
327 remove_dir_safely() {
328 if [ "$sbcl_os" = "win32" ] ; then
329 if [ -d "$1" ] ; then
330 rm -rf "$1"
331 elif [ -e "$1" ] ; then
332 echo "I'm afraid to remove non-directory $1."
333 exit 1
335 else
336 if [ -h "$1" ] ; then
337 rm "$1"
338 elif [ -w "$1" ] ; then
339 echo "I'm afraid to replace non-symlink $1 with a symlink."
340 exit 1
345 echo //entering make-config.sh
347 echo //ensuring the existence of output/ directory
348 if [ ! -d output ] ; then mkdir output; fi
350 echo //guessing default target CPU architecture from host architecture
351 case `uname -m` in
352 *86) guessed_sbcl_arch=x86 ;;
353 i86pc) guessed_sbcl_arch=x86 ;;
354 *x86_64) guessed_sbcl_arch=x86-64 ;;
355 amd64) guessed_sbcl_arch=x86-64 ;;
356 [Aa]lpha) guessed_sbcl_arch=alpha ;;
357 sparc*) guessed_sbcl_arch=sparc ;;
358 sun*) guessed_sbcl_arch=sparc ;;
359 *ppc) guessed_sbcl_arch=ppc ;;
360 ppc64) guessed_sbcl_arch=ppc ;;
361 Power*Macintosh) guessed_sbcl_arch=ppc ;;
362 ibmnws) guessed_sbcl_arch=ppc ;;
363 parisc) guessed_sbcl_arch=hppa ;;
364 9000/800) guessed_sbcl_arch=hppa ;;
365 mips*) guessed_sbcl_arch=mips ;;
366 arm*) guessed_sbcl_arch=arm ;;
368 # If we're not building on a supported target architecture, we
369 # we have no guess, but it's not an error yet, since maybe
370 # target architecture will be specified explicitly below.
371 guessed_sbcl_arch=''
373 esac
375 # Under Solaris, uname -m returns "i86pc" even if CPU is amd64.
376 if [ "$sbcl_os" = "sunos" ] && [ `isainfo -k` = "amd64" ]; then
377 guessed_sbcl_arch=x86-64
380 # Under Darwin, uname -m returns "i386" even if CPU is x86_64.
381 if [ "$sbcl_os" = "darwin" ] && [ "`/usr/sbin/sysctl -n hw.optional.x86_64`" = "1" ]; then
382 guessed_sbcl_arch=x86-64
385 echo //setting up CPU-architecture-dependent information
386 if test -n "$SBCL_ARCH"
387 then
388 # Normalize it.
389 SBCL_ARCH=`echo $SBCL_ARCH | tr '[A-Z]' '[a-z]' | tr _ -`
391 sbcl_arch=${SBCL_ARCH:-$guessed_sbcl_arch}
392 echo sbcl_arch=\"$sbcl_arch\"
393 if [ "$sbcl_arch" = "" ] ; then
394 echo "can't guess target SBCL architecture, please specify --arch=<name>"
395 exit 1
397 if $fancy
398 then
399 # If --fancy, enable threads on platforms where they can be built.
400 case $sbcl_arch in
401 x86|x86-64|ppc)
402 if [ "$sbcl_os" = "sunos" ] && [ "$sbcl_arch" = "x86-64" ]
403 then
404 echo "No threads on this platform."
405 else
406 WITH_FEATURES="$WITH_FEATURES :sb-thread"
407 echo "Enabling threads due to --fancy."
411 echo "No threads on this platform."
413 esac
416 ltf=`pwd`/local-target-features.lisp-expr
417 echo //initializing $ltf
418 echo ';;;; This is a machine-generated file.' > $ltf
419 echo ';;;; Please do not edit it by hand.' >> $ltf
420 echo ';;;; See make-config.sh.' >> $ltf
421 echo "(lambda (features) (union (set-difference features (list$WITHOUT_FEATURES))" >> $ltf
422 printf " (union (list$WITH_FEATURES) (list " >> $ltf
424 printf ":%s" "$sbcl_arch" >> $ltf
426 echo //setting up OS-dependent information
427 # Under Darwin x86-64, guess whether Darwin 9+ or below.
428 if [ "$sbcl_os" = "darwin" ] && [ "$sbcl_arch" = "x86-64" ]; then
429 darwin_version=`uname -r`
430 darwin_version_major=${DARWIN_VERSION_MAJOR:-${darwin_version%%.*}}
431 if (( 8 < $darwin_version_major )); then
432 printf ' :inode64 :darwin9-or-better' >> $ltf
436 original_dir=`pwd`
437 cd ./src/runtime/
438 rm -f Config target-arch-os.h target-arch.h target-os.h target-lispregs.h
439 # KLUDGE: these two logically belong in the previous section
440 # ("architecture-dependent"); it seems silly to enforce this in terms
441 # of the shell script, though. -- CSR, 2002-02-03
442 link_or_copy $sbcl_arch-arch.h target-arch.h
443 link_or_copy $sbcl_arch-lispregs.h target-lispregs.h
444 case "$sbcl_os" in
445 linux)
446 printf ' :unix' >> $ltf
447 printf ' :elf' >> $ltf
448 printf ' :linux' >> $ltf
450 # If you add other platforms here, don't forget to edit
451 # src/runtime/Config.foo-linux too.
452 case "$sbcl_arch" in
453 mips | arm)
454 printf ' :largefile' >> $ltf
456 x86 | x86-64)
457 printf ' :sb-thread :sb-futex :largefile' >> $ltf
459 ppc)
460 printf ' :sb-futex' >> $ltf
462 esac
465 link_or_copy Config.$sbcl_arch-linux Config
466 link_or_copy $sbcl_arch-linux-os.h target-arch-os.h
467 link_or_copy linux-os.h target-os.h
469 osf1)
470 printf ' :unix' >> $ltf
471 printf ' :elf' >> $ltf
472 printf ' :osf1' >> $ltf
473 link_or_copy Config.$sbcl_arch-osf1 Config
474 link_or_copy $sbcl_arch-osf1-os.h target-arch-os.h
475 link_or_copy osf1-os.h target-os.h
477 hpux)
478 printf ' :unix' >> $ltf
479 printf ' :elf' >> $ltf
480 printf ' :hpux' >> $ltf
481 link_or_copy Config.$sbcl_arch-hpux Config
482 link_or_copy $sbcl_arch-hpux-os.h target-arch-os.h
483 link_or_copy hpux-os.h target-os.h
485 *bsd)
486 printf ' :unix' >> $ltf
487 printf ' :bsd' >> $ltf
488 link_or_copy $sbcl_arch-bsd-os.h target-arch-os.h
489 link_or_copy bsd-os.h target-os.h
490 case "$sbcl_os" in
491 freebsd)
492 printf ' :elf' >> $ltf
493 printf ' :freebsd' >> $ltf
494 printf ' :gcc-tls' >> $ltf
495 if [ $sbcl_arch = "x86" ]; then
496 printf ' :restore-fs-segment-register-from-tls' >> $ltf
498 link_or_copy Config.$sbcl_arch-freebsd Config
500 openbsd)
501 printf ' :elf' >> $ltf
502 printf ' :openbsd' >> $ltf
503 link_or_copy Config.$sbcl_arch-openbsd Config
505 netbsd)
506 printf ' :netbsd' >> $ltf
507 printf ' :elf' >> $ltf
508 link_or_copy Config.$sbcl_arch-netbsd Config
511 echo unsupported BSD variant: `uname`
512 exit 1
514 esac
516 darwin)
517 printf ' :unix' >> $ltf
518 printf ' :mach-o' >> $ltf
519 printf ' :bsd' >> $ltf
520 printf ' :darwin' >> $ltf
521 if [ $sbcl_arch = "x86" ]; then
522 printf ' :mach-exception-handler :restore-fs-segment-register-from-tls :ud2-breakpoints' >> $ltf
524 if [ $sbcl_arch = "x86-64" ]; then
525 printf ' :mach-exception-handler :ud2-breakpoints' >> $ltf
527 link_or_copy $sbcl_arch-darwin-os.h target-arch-os.h
528 link_or_copy bsd-os.h target-os.h
529 link_or_copy Config.$sbcl_arch-darwin Config
531 sunos)
532 printf ' :unix' >> $ltf
533 printf ' :elf' >> $ltf
534 printf ' :sunos' >> $ltf
535 if [ $sbcl_arch = "x86-64" ]; then
536 printf ' :largefile' >> $ltf
538 link_or_copy Config.$sbcl_arch-sunos Config
539 link_or_copy $sbcl_arch-sunos-os.h target-arch-os.h
540 link_or_copy sunos-os.h target-os.h
542 win32)
543 printf ' :win32' >> $ltf
545 # Optional features -- We enable them by default, but the build
546 # ought to work perfectly without them:
548 printf ' :sb-futex' >> $ltf
549 printf ' :sb-qshow' >> $ltf
551 # Required features -- Some of these used to be optional, but
552 # building without them is no longer considered supported:
554 # (Of course it doesn't provide dlopen, but there is
555 # roughly-equivalent magic nevertheless:)
556 printf ' :sb-dynamic-core :os-provides-dlopen' >> $ltf
557 printf ' :sb-thread :sb-safepoint :sb-thruption :sb-wtimer' >> $ltf
558 printf ' :sb-safepoint-strictly' >> $ltf
560 link_or_copy Config.$sbcl_arch-win32 Config
561 link_or_copy $sbcl_arch-win32-os.h target-arch-os.h
562 link_or_copy win32-os.h target-os.h
565 echo unsupported OS type: `uname`
566 exit 1
568 esac
569 cd "$original_dir"
571 # FIXME: Things like :c-stack-grows-..., etc, should be
572 # *derived-target-features* or equivalent, so that there was a nicer
573 # way to specify them then sprinkling them in this file. They should
574 # still be tweakable by advanced users, though, but probably not
575 # appear in *features* of target. #!+/- should be adjusted to take
576 # them in account as well. At minimum the nicer specification stuff,
577 # though:
579 # (define-feature :dlopen (features)
580 # (union '(:bsd :linux :darwin :sunos) features))
582 # (define-feature :c-stack-grows-downwards-not-upwards (features)
583 # (member :x86 features))
585 # KLUDGE: currently the x86 only works with the generational garbage
586 # collector (indicated by the presence of :GENCGC in *FEATURES*) and
587 # alpha, sparc and ppc with the stop'n'copy collector (indicated by
588 # the absence of :GENCGC in *FEATURES*). This isn't a great
589 # separation, but for now, rather than have :GENCGC in
590 # base-target-features.lisp-expr, we add it into local-target-features
591 # if we're building for x86. -- CSR, 2002-02-21 Then we do something
592 # similar with :STACK-GROWS-FOOWARD, too. -- WHN 2002-03-03
593 if [ "$sbcl_arch" = "x86" ]; then
594 printf ' :gencgc :stack-grows-downward-not-upward :c-stack-is-control-stack' >> $ltf
595 printf ' :compare-and-swap-vops :unwind-to-frame-and-call-vop :raw-instance-init-vops' >> $ltf
596 printf ' :stack-allocatable-closures :stack-allocatable-vectors' >> $ltf
597 printf ' :stack-allocatable-lists :stack-allocatable-fixed-objects' >> $ltf
598 printf ' :alien-callbacks :cycle-counter :inline-constants ' >> $ltf
599 printf ' :memory-barrier-vops :multiply-high-vops :ash-right-vops :symbol-info-vops' >> $ltf
600 case "$sbcl_os" in
601 linux | freebsd | netbsd | openbsd | sunos | darwin | win32)
602 printf ' :linkage-table' >> $ltf
603 esac
604 if [ "$sbcl_os" = "win32" ]; then
605 # of course it doesn't provide dlopen, but there is
606 # roughly-equivalent magic nevertheless.
607 printf ' :os-provides-dlopen' >> $ltf
609 if [ "$sbcl_os" = "openbsd" ]; then
610 rm -f src/runtime/openbsd-sigcontext.h
611 sh tools-for-build/openbsd-sigcontext.sh > src/runtime/openbsd-sigcontext.h
613 elif [ "$sbcl_arch" = "x86-64" ]; then
614 printf ' :gencgc :stack-grows-downward-not-upward :c-stack-is-control-stack :linkage-table' >> $ltf
615 printf ' :compare-and-swap-vops :unwind-to-frame-and-call-vop :raw-instance-init-vops' >> $ltf
616 printf ' :stack-allocatable-closures :stack-allocatable-vectors' >> $ltf
617 printf ' :stack-allocatable-lists :stack-allocatable-fixed-objects' >> $ltf
618 printf ' :alien-callbacks :cycle-counter :complex-float-vops' >> $ltf
619 printf ' :float-eql-vops :inline-constants :memory-barrier-vops' >> $ltf
620 printf ' :multiply-high-vops :sb-simd-pack :ash-right-vops :symbol-info-vops' >> $ltf
621 elif [ "$sbcl_arch" = "mips" ]; then
622 printf ' :cheneygc :linkage-table' >> $ltf
623 printf ' :stack-allocatable-closures :stack-allocatable-vectors' >> $ltf
624 printf ' :stack-allocatable-lists :stack-allocatable-fixed-objects' >> $ltf
625 printf ' :alien-callbacks' >> $ltf
626 elif [ "$sbcl_arch" = "ppc" ]; then
627 printf ' :gencgc :stack-allocatable-closures :stack-allocatable-vectors' >> $ltf
628 printf ' :stack-allocatable-lists :stack-allocatable-fixed-objects' >> $ltf
629 printf ' :linkage-table :raw-instance-init-vops :memory-barrier-vops' >> $ltf
630 printf ' :compare-and-swap-vops :multiply-high-vops :alien-callbacks' >> $ltf
631 if [ "$sbcl_os" = "linux" ]; then
632 # Use a C program to detect which kind of glibc we're building on,
633 # to bandage across the break in source compatibility between
634 # versions 2.3.1 and 2.3.2
636 # FIXME: integrate to grovel-features, mayhaps
637 $GNUMAKE -C tools-for-build where-is-mcontext -I ../src/runtime
638 tools-for-build/where-is-mcontext > src/runtime/ppc-linux-mcontext.h || (echo "error running where-is-mcontext"; exit 1)
639 elif [ "$sbcl_os" = "darwin" ]; then
640 # We provide a dlopen shim, so a little lie won't hurt
641 printf ' :os-provides-dlopen' >> $ltf
642 # The default stack ulimit under darwin is too small to run PURIFY.
643 # Best we can do is complain and exit at this stage
644 if [ "`ulimit -s`" = "512" ]; then
645 echo "Your stack size limit is too small to build SBCL."
646 echo "See the limit(1) or ulimit(1) commands and the README file."
647 exit 1
650 elif [ "$sbcl_arch" = "sparc" ]; then
651 # Test the compiler in order to see if we are building on Sun
652 # toolchain as opposed to GNU binutils, and write the appropriate
653 # FUNCDEF macro for assembler. No harm in running this on sparc-linux
654 # as well.
655 sh tools-for-build/sparc-funcdef.sh > src/runtime/sparc-funcdef.h
656 if [ "$sbcl_os" = "sunos" ] || [ "$sbcl_os" = "linux" ]; then
657 printf ' :gencgc' >> $ltf
658 else
659 echo '***'
660 echo '*** You are running SPARC on non-SunOS, non-Linux. Since'
661 echo '*** GENCGC is untested on this combination, make-config.sh'
662 echo '*** is falling back to CHENEYGC. Please consider adjusting'
663 echo '*** parms.lisp to build with GENCGC instead.'
664 echo '***'
665 printf ' :cheneygc' >> $ltf
667 if [ "$sbcl_os" = "sunos" ] || [ "$sbcl_os" = "linux" ]; then
668 printf ' :linkage-table' >> $ltf
670 printf ' :stack-allocatable-closures :stack-allocatable-lists' >> $ltf
671 elif [ "$sbcl_arch" = "alpha" ]; then
672 printf ' :cheneygc' >> $ltf
673 printf ' :stack-allocatable-closures :stack-allocatable-lists' >> $ltf
674 elif [ "$sbcl_arch" = "hppa" ]; then
675 printf ' :cheneygc' >> $ltf
676 printf ' :stack-allocatable-vectors :stack-allocatable-fixed-objects' >> $ltf
677 printf ' :stack-allocatable-lists' >> $ltf
678 elif [ "$sbcl_arch" = "arm" ]; then
679 printf ' :gencgc :linkage-table :alien-callbacks' >> $ltf
680 # As opposed to soft-float or FPA, we support VFP only (and
681 # possibly VFPv2 and higher only), but we'll leave the obvious
682 # hooks in for someone to add the support later.
683 printf ' :arm-vfp :arm-vfpv2' >> $ltf
684 printf ' :ash-right-vops :multiply-high-vops :symbol-info-vops' >> $ltf
685 printf ' :stack-allocatable-lists :stack-allocatable-fixed-objects' >> $ltf
686 printf ' :stack-allocatable-vectors :stack-allocatable-closures' >> $ltf
687 else
688 # Nothing need be done in this case, but sh syntax wants a placeholder.
689 echo > /dev/null
692 # Use a little C program to try to guess the endianness. Ware
693 # cross-compilers!
695 # FIXME: integrate to grovel-features, mayhaps
696 $GNUMAKE -C tools-for-build determine-endianness -I ../src/runtime
697 tools-for-build/determine-endianness >> $ltf
699 export sbcl_os sbcl_arch
700 sh tools-for-build/grovel-features.sh >> $ltf
702 echo //finishing $ltf
703 echo '))))' >> $ltf
705 # FIXME: The version system should probably be redone along these lines:
707 # echo //setting up version information.
708 # versionfile=version.txt
709 # cp base-version.txt $versionfile
710 # echo " (built `date -u` by `whoami`@`hostname`)" >> $versionfile
711 # echo 'This is a machine-generated file and should not be edited by hand.' >> $versionfile
713 # Make a unique ID for this build (to discourage people from
714 # mismatching sbcl and *.core files).
715 if [ `uname` = "SunOS" ] ; then
716 # use /usr/xpg4/bin/id instead of /usr/bin/id
717 PATH=/usr/xpg4/bin:$PATH
719 echo '"'`hostname`-`id -un`-`date +%Y-%m-%d-%H-%M-%S`'"' > output/build-id.tmp
721 if [ -n "$SBCL_HOST_LOCATION" ]; then
722 echo //setting up host configuration
723 rsync --delete-after -a output/ "$SBCL_HOST_LOCATION/output/"
724 rsync -a local-target-features.lisp-expr version.lisp-expr "$SBCL_HOST_LOCATION/"