add --fancy option to make.sh
[sbcl.git] / make-config.sh
1 #!/bin/sh
2 set -e
3
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.
10
11 # This software is part of the SBCL system. See the README file for
12 # more information.
13 #
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.
19
20 print_help="no"
21
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"
34 fi
35 SBCL_XC_HOST="sbcl --disable-debugger --no-userinit --no-sysinit"
36 export SBCL_XC_HOST
37
38 # Parse command-line options.
39 bad_option() {
40     echo $1
41     echo "Enter \"$0 --help\" for list of valid options."
42     exit 1
43 }
44
45 WITH_FEATURES=""
46 WITHOUT_FEATURES=""
47
48 fancy=false
49 some_options=false
50 for option
51 do
52   optarg_ok=true
53   # Split --foo=bar into --foo and bar.
54   case $option in
55       *=*)
56         # For ease of scripting skip valued options with empty
57         # values.
58         optarg=`expr "X$option" : '[^=]*=\(.*\)'` || optarg_ok=false
59         option=`expr "X$option" : 'X\([^=]*=\).*'`
60         ;;
61       --with*)
62         optarg=`expr "X$option" : 'X--[^-]*-\(.*\)'` \
63             || bad_option "Malformed feature toggle: $option"
64         option=`expr "X$option" : 'X\(--[^-]*\).*'`
65         ;;
66       *)
67         optarg=""
68         ;;
69   esac
70
71   case $option in
72       --help | -help | -h)
73         print_help="yes" ;;
74       --prefix=)
75         $optarg_ok && SBCL_PREFIX=$optarg
76         ;;
77       --arch=)
78         $oparg_ok && SBCL_ARCH=$optarg
79         ;;
80       --xc-host=)
81         $optarg_ok && SBCL_XC_HOST=$optarg
82         ;;
83       --dynamic-space-size=)
84         $optarg_ok && SBCL_DYNAMIC_SPACE_SIZE=$optarg
85         ;;
86       --with)
87         WITH_FEATURES="$WITH_FEATURES :$optarg"
88         ;;
89       --without)
90         WITHOUT_FEATURES="$WITHOUT_FEATURES :$optarg"
91         ;;
92       --fancy)
93         WITH_FEATURES="$WITH_FEATURES :sb-core-compression :sb-xref-for-internals :sb-after-xc-core"
94         # Lower down we add :sb-thread for platforms where it can be built.
95         fancy=true
96         ;;
97       -*)
98         bad_option "Unknown command-line option to $0: \"$option\""
99         ;;
100       *)
101         if $some_options
102         then
103             bad_option "Unknown command-line option to $0: \"$option\""
104         else
105             legacy_xc_spec=$option
106         fi
107         ;;
108   esac
109   some_options=true
110 done
111
112 if (test -f customize-target-features.lisp && \
113     (test -n "$WITH_FEATURES" || test -n "$WITHOUT_FEATURES"))
114 then
115     # Actually there's no reason why it would not work, but it would
116     # be confusing to say --with-thread only to have it turned off by
117     # customize-target-features.lisp...
118     echo "ERROR: Both customize-target-features.lisp, and feature-options"
119     echo "to make.sh present -- cannot use both at the same time."
120 fi
121
122 # Previously XC host was provided as a positional argument. 
123 if test -n "$legacy_xc_spec"
124 then
125     SBCL_XC_HOST="$legacy_xc_spec"
126 fi
127
128 if test "$print_help" = "yes"
129 then
130   cat <<EOF
131 \`make.sh' drives the SBCL build.
132
133 Usage: $0 [OPTION]...
134
135   Important: make.sh does not currently control the entirety of the
136   build: configuration file customize-target-features.lisp and certain
137   environment variables play a role as well. see file INSTALL for
138   details.
139
140 Options:
141   -h, --help           Display this help and exit.
142
143   --prefix=<path>      Specify the install location.
144
145       Script install.sh installs SBCL under the specified prefix
146       path: runtime as prefix/bin/sbcl, additional files under
147       prefix/lib/sbcl, and documentation under prefix/share.
148
149       This option also affects the binaries: built-in default for
150       SBCL_HOME is: prefix/lib/sbcl/
151
152       Default prefix is: /usr/local
153
154   --dynamic-space-size=<size> Default dynamic-space size for target.
155
156       This specifies the default dynamic-space size for the SBCL
157       being built. If you need to control the dynamic-space size
158       of the host SBCL, use the --xc-host option.
159
160       If not provided, the default is platform-specific. <size> is
161       taken to be megabytes unless explicitly suffixed with Gb in
162       order to specify the size in gigabytes.
163
164   --with-<feature>     Build with specified feature.
165   --without-<feature>  Build wihout the specfied feature.
166
167   --arch=<string>      Specify the architecture to build for.
168
169       Mainly for doing x86 builds on x86-64.
170
171   --xc-host=<string>   Specify the Common Lisp compilation host.
172
173       The string provided should be a command to invoke the
174       cross-compilation Lisp system in such a way, that it reads
175       commands from standard input, and terminates when it reaches end
176       of file on standard input.
177
178       Examples:
179
180        "sbcl --disable-debugger --no-sysinit --no-userinit"
181                   Use an existing SBCL binary as a cross-compilation
182                   host even though you have stuff in your
183                   initialization files which makes it behave in such a
184                   non-standard way that it keeps the build from
185                   working. Also disable the debugger instead of
186                   waiting endlessly for a programmer to help it out
187                   with input on *DEBUG-IO*. (This is the default.)
188
189        "sbcl"
190                   Use an existing SBCL binary as a cross-compilation
191                   host, including your initialization files and
192                   building with the debugger enabled. Not recommended
193                   for casual users.
194
195        "lisp -noinit -batch"
196                   Use an existing CMU CL binary as a cross-compilation
197                   host when you have weird things in your .cmucl-init
198                   file.
199 EOF
200   exit 1
201 fi
202
203 mkdir -p output
204 # Save prefix for make and install.sh.
205 echo "SBCL_PREFIX='$SBCL_PREFIX'" > output/prefix.def
206 echo "$SBCL_DYNAMIC_SPACE_SIZE" > output/dynamic-space-size.txt
207
208 # FIXME: Tweak this script, and the rest of the system, to support
209 # a second bootstrapping pass in which the cross-compilation host is
210 # known to be SBCL itself, so that the cross-compiler can do some
211 # optimizations (especially specializable arrays) that it doesn't
212 # know how to implement how in a portable way. (Or maybe that wouldn't
213 # require a second pass, just testing at build-the-cross-compiler time
214 # whether the cross-compilation host returns suitable values from
215 # UPGRADED-ARRAY-ELEMENT-TYPE?)
216
217 if [ "$OSTYPE" = "cygwin" -o "$OSTYPE" = "msys" ] ; then
218     DEVNULL=NUL
219 else
220     DEVNULL=/dev/null
221 fi
222 export DEVNULL
223
224 . ./find-gnumake.sh
225 find_gnumake
226
227 . ./generate-version.sh
228 generate_version
229
230 # Now that we've done our option parsing and found various
231 # dependencies, write them out to a file to be sourced by other
232 # scripts.
233
234 echo "DEVNULL=\"$DEVNULL\"; export DEVNULL" > output/build-config
235 echo "GNUMAKE=\"$GNUMAKE\"; export GNUMAKE" >> output/build-config
236 echo "SBCL_XC_HOST=\"$SBCL_XC_HOST\"; export SBCL_XC_HOST" >> output/build-config
237 echo "legacy_xc_spec=\"$legacy_xc_spec\"; export legacy_xc_spec" >> output/build-config
238
239 # And now, sorting out the per-target dependencies...
240
241 case `uname` in
242     Linux)
243         sbcl_os="linux"
244         ;;
245     OSF1)
246         # it's changed name twice since it was called OSF/1: clearly
247         # the marketers forgot to tell the engineers about Digital Unix
248         # _or_ OSF/1 ...
249         sbcl_os="osf1"
250         ;;
251     *BSD)
252         case `uname` in
253             FreeBSD)
254                 sbcl_os="freebsd"
255                 ;;
256             OpenBSD)
257                 sbcl_os="openbsd"
258                 ;;
259             NetBSD)
260                 sbcl_os="netbsd"
261                 ;;
262             *)
263                 echo unsupported BSD variant: `uname`
264                 exit 1
265                 ;;
266         esac
267         ;;
268     Darwin)
269         sbcl_os="darwin"
270         ;;
271     SunOS)
272         sbcl_os="sunos"
273         ;;
274     CYGWIN* | WindowsNT | MINGW*)
275         sbcl_os="win32"
276         ;;
277     HP-UX)
278         sbcl_os="hpux"
279         ;;
280     *)
281         echo unsupported OS type: `uname`
282         exit 1
283         ;;
284 esac
285
286 link_or_copy() {
287    if [ "$sbcl_os" = "win32" ] ; then
288        cp -r "$1" "$2"
289    else
290        ln -s "$1" "$2"
291    fi
292 }
293
294 remove_dir_safely() {
295    if [ "$sbcl_os" = "win32" ] ; then
296         if [ -d "$1" ] ; then
297             rm -rf "$1"
298         elif [ -e "$1" ] ; then
299             echo "I'm afraid to remove non-directory $1."
300             exit 1
301         fi
302     else
303         if [ -h "$1" ] ; then
304             rm "$1"
305         elif [ -w "$1" ] ; then
306             echo "I'm afraid to replace non-symlink $1 with a symlink."
307             exit 1
308         fi
309     fi
310 }
311
312 echo //entering make-config.sh
313
314 echo //ensuring the existence of output/ directory
315 if [ ! -d output ] ; then mkdir output; fi
316
317 echo //guessing default target CPU architecture from host architecture
318 case `uname -m` in
319     *86) guessed_sbcl_arch=x86 ;;
320     i86pc) guessed_sbcl_arch=x86 ;;
321     *x86_64) guessed_sbcl_arch=x86-64 ;;
322     amd64) guessed_sbcl_arch=x86-64 ;;
323     [Aa]lpha) guessed_sbcl_arch=alpha ;;
324     sparc*) guessed_sbcl_arch=sparc ;;
325     sun*) guessed_sbcl_arch=sparc ;;
326     *ppc) guessed_sbcl_arch=ppc ;;
327     ppc64) guessed_sbcl_arch=ppc ;;
328     Power*Macintosh) guessed_sbcl_arch=ppc ;;
329     parisc) guessed_sbcl_arch=hppa ;;
330     9000/800) guessed_sbcl_arch=hppa ;;
331     mips*) guessed_sbcl_arch=mips ;;
332     *)
333         # If we're not building on a supported target architecture, we
334         # we have no guess, but it's not an error yet, since maybe
335         # target architecture will be specified explicitly below.
336         guessed_sbcl_arch=''
337         ;;
338 esac
339
340 # Under Solaris, uname -m returns "i86pc" even if CPU is amd64.
341 if [ "$sbcl_os" = "sunos" ] && [ `isainfo -k` = "amd64" ]; then
342     guessed_sbcl_arch=x86-64
343 fi
344
345 # Under Darwin, uname -m returns "i386" even if CPU is x86_64.
346 if [ "$sbcl_os" = "darwin" ] && [ "`/usr/sbin/sysctl -n hw.optional.x86_64`" = "1" ]; then
347     guessed_sbcl_arch=x86-64
348 fi
349
350 echo //setting up CPU-architecture-dependent information
351 if test -n "$SBCL_ARCH"
352 then
353     # Normalize it.
354     SBCL_ARCH=`echo $SBCL_ARCH | tr '[A-Z]' '[a-z]' | tr _ -`
355 fi
356 sbcl_arch=${SBCL_ARCH:-$guessed_sbcl_arch}
357 echo sbcl_arch=\"$sbcl_arch\"
358 if [ "$sbcl_arch" = "" ] ; then
359     echo "can't guess target SBCL architecture, please specify --arch=<name>"
360     exit 1
361 fi
362 if $fancy
363 then
364     # If --fancy, enable threads on platforms where they can be built.
365     case $sbcl_arch in
366         x86|x86-64|ppc)
367             WITH_FEATURES="$WITH_FEATURES :sb-thread"
368             echo "Enabling threads due to --fancy."
369             ;;
370         *)
371             echo "No threads on this platform."
372             ;;
373     esac
374 fi
375
376 ltf=`pwd`/local-target-features.lisp-expr
377 echo //initializing $ltf
378 echo ';;;; This is a machine-generated file.' > $ltf
379 echo ';;;; Please do not edit it by hand.' >> $ltf
380 echo ';;;; See make-config.sh.' >> $ltf
381 echo "((lambda (features) (set-difference features (list$WITHOUT_FEATURES)))" >> $ltf
382 printf " (union (list$WITH_FEATURES) (list " >> $ltf
383
384 printf ":%s" "$sbcl_arch" >> $ltf
385
386 echo //setting up OS-dependent information
387 # Under Darwin x86-64, guess whether Darwin 9+ or below.
388 if [ "$sbcl_os" = "darwin" ] && [ "$sbcl_arch" = "x86-64" ]; then
389     darwin_version=`uname -r`
390     darwin_version_major=${DARWIN_VERSION_MAJOR:-${darwin_version%%.*}}
391     if (( 8 < $darwin_version_major )); then
392         printf ' :inode64 :darwin9-or-better' >> $ltf
393     fi
394 fi
395
396 original_dir=`pwd`
397 cd ./src/runtime/
398 rm -f Config target-arch-os.h target-arch.h target-os.h target-lispregs.h
399 # KLUDGE: these two logically belong in the previous section
400 # ("architecture-dependent"); it seems silly to enforce this in terms
401 # of the shell script, though. -- CSR, 2002-02-03
402 link_or_copy $sbcl_arch-arch.h target-arch.h
403 link_or_copy $sbcl_arch-lispregs.h target-lispregs.h
404 case "$sbcl_os" in
405     linux)
406         printf ' :unix' >> $ltf
407         printf ' :elf' >> $ltf
408         printf ' :linux' >> $ltf
409
410         # If you add other platforms here, don't forget to edit
411         # src/runtime/Config.foo-linux too.
412         case "$sbcl_arch" in
413             mips)
414                 printf ' :largefile' >> $ltf
415                 ;;
416             x86 | x86-64)
417                 printf ' :sb-thread :sb-futex :largefile' >> $ltf
418                 ;;
419             ppc)
420                 printf ' :sb-futex' >> $ltf
421                 ;;
422         esac
423
424         if [ $sbcl_arch = "x86-64" ]; then
425             link_or_copy Config.x86_64-linux Config
426         else
427             link_or_copy Config.$sbcl_arch-linux Config
428         fi
429         link_or_copy $sbcl_arch-linux-os.h target-arch-os.h
430         link_or_copy linux-os.h target-os.h
431         ;;
432     osf1)
433         printf ' :unix' >> $ltf
434         printf ' :elf' >> $ltf
435         printf ' :osf1' >> $ltf
436         link_or_copy Config.$sbcl_arch-osf1 Config
437         link_or_copy $sbcl_arch-osf1-os.h target-arch-os.h
438         link_or_copy osf1-os.h target-os.h
439         ;;
440     hpux)
441         printf ' :unix' >> $ltf
442         printf ' :elf' >> $ltf
443         printf ' :hpux' >> $ltf
444         link_or_copy Config.$sbcl_arch-hpux Config
445         link_or_copy $sbcl_arch-hpux-os.h target-arch-os.h
446         link_or_copy hpux-os.h target-os.h
447         ;;
448     *bsd)
449         printf ' :unix' >> $ltf
450         printf ' :bsd' >> $ltf
451         link_or_copy $sbcl_arch-bsd-os.h target-arch-os.h
452         link_or_copy bsd-os.h target-os.h
453         case "$sbcl_os" in
454             freebsd)
455                 printf ' :elf' >> $ltf
456                 printf ' :freebsd' >> $ltf
457                 printf ' :gcc-tls' >> $ltf
458                 if [ $sbcl_arch = "x86" ]; then
459                     printf ' :restore-tls-segment-register-from-context' >> $ltf
460                 fi
461                 link_or_copy Config.$sbcl_arch-freebsd Config
462                 ;;
463             openbsd)
464                 printf ' :elf' >> $ltf
465                 printf ' :openbsd' >> $ltf
466                 link_or_copy Config.$sbcl_arch-openbsd Config
467                 ;;
468             netbsd)
469                 printf ' :netbsd' >> $ltf
470                 printf ' :elf' >> $ltf
471                 link_or_copy Config.$sbcl_arch-netbsd Config
472                 ;;
473             *)
474                 echo unsupported BSD variant: `uname`
475                 exit 1
476                 ;;
477         esac
478         ;;
479     darwin)
480         printf ' :unix' >> $ltf
481         printf ' :mach-o' >> $ltf
482         printf ' :bsd' >> $ltf
483         printf ' :darwin' >> $ltf
484         if [ $sbcl_arch = "x86" ]; then
485             printf ' :mach-exception-handler :restore-fs-segment-register-from-tls :ud2-breakpoints' >> $ltf
486         fi
487         if [ $sbcl_arch = "x86-64" ]; then
488             printf ' :mach-exception-handler :ud2-breakpoints' >> $ltf
489         fi
490         link_or_copy $sbcl_arch-darwin-os.h target-arch-os.h
491         link_or_copy bsd-os.h target-os.h
492         link_or_copy Config.$sbcl_arch-darwin Config
493         ;;
494     sunos)
495         printf ' :unix' >> $ltf
496         printf ' :elf' >> $ltf
497         printf ' :sunos' >> $ltf
498         if [ $sbcl_arch = "x86-64" ]; then
499             printf ' :largefile' >> $ltf
500         fi
501         link_or_copy Config.$sbcl_arch-sunos Config
502         link_or_copy $sbcl_arch-sunos-os.h target-arch-os.h
503         link_or_copy sunos-os.h target-os.h
504         ;;
505     win32)
506         printf ' :win32' >> $ltf
507         link_or_copy Config.$sbcl_arch-win32 Config
508         link_or_copy $sbcl_arch-win32-os.h target-arch-os.h
509         link_or_copy win32-os.h target-os.h
510         ;;
511     *)
512         echo unsupported OS type: `uname`
513         exit 1
514         ;;
515 esac
516 cd "$original_dir"
517
518 # FIXME: Things like :c-stack-grows-..., etc, should be
519 # *derived-target-features* or equivalent, so that there was a nicer
520 # way to specify them then sprinkling them in this file. They should
521 # still be tweakable by advanced users, though, but probably not
522 # appear in *features* of target. #!+/- should be adjusted to take
523 # them in account as well. At minimum the nicer specification stuff,
524 # though:
525 #
526 # (define-feature :dlopen (features)
527 #   (union '(:bsd :linux :darwin :sunos) features))
528 #
529 # (define-feature :c-stack-grows-downwards-not-upwards (features)
530 #   (member :x86 features))
531
532 # KLUDGE: currently the x86 only works with the generational garbage
533 # collector (indicated by the presence of :GENCGC in *FEATURES*) and
534 # alpha, sparc and ppc with the stop'n'copy collector (indicated by
535 # the absence of :GENCGC in *FEATURES*). This isn't a great
536 # separation, but for now, rather than have :GENCGC in
537 # base-target-features.lisp-expr, we add it into local-target-features
538 # if we're building for x86. -- CSR, 2002-02-21 Then we do something
539 # similar with :STACK-GROWS-FOOWARD, too. -- WHN 2002-03-03
540 if [ "$sbcl_arch" = "x86" ]; then
541     printf ' :gencgc :stack-grows-downward-not-upward :c-stack-is-control-stack' >> $ltf
542     printf ' :compare-and-swap-vops :unwind-to-frame-and-call-vop :raw-instance-init-vops' >> $ltf
543     printf ' :stack-allocatable-closures :stack-allocatable-vectors' >> $ltf
544     printf ' :stack-allocatable-lists :stack-allocatable-fixed-objects' >> $ltf
545     printf ' :alien-callbacks :cycle-counter :inline-constants ' >> $ltf
546     printf ' :memory-barrier-vops :multiply-high-vops' >> $ltf
547     case "$sbcl_os" in
548     linux | freebsd | netbsd | openbsd | sunos | darwin | win32)
549         printf ' :linkage-table' >> $ltf
550     esac
551     if [ "$sbcl_os" = "win32" ]; then
552         # of course it doesn't provide dlopen, but there is
553         # roughly-equivalent magic nevertheless.
554         printf ' :os-provides-dlopen' >> $ltf
555     fi
556     if [ "$sbcl_os" = "openbsd" ]; then
557         rm -f src/runtime/openbsd-sigcontext.h
558         sh tools-for-build/openbsd-sigcontext.sh > src/runtime/openbsd-sigcontext.h
559     fi
560 elif [ "$sbcl_arch" = "x86-64" ]; then
561     printf ' :gencgc :stack-grows-downward-not-upward :c-stack-is-control-stack :linkage-table' >> $ltf
562     printf ' :compare-and-swap-vops :unwind-to-frame-and-call-vop :raw-instance-init-vops' >> $ltf
563     printf ' :stack-allocatable-closures :stack-allocatable-vectors' >> $ltf
564     printf ' :stack-allocatable-lists :stack-allocatable-fixed-objects' >> $ltf
565     printf ' :alien-callbacks :cycle-counter :complex-float-vops' >> $ltf
566     printf ' :float-eql-vops :inline-constants :memory-barrier-vops' >> $ltf
567     printf ' :multiply-high-vops' >> $ltf
568 elif [ "$sbcl_arch" = "mips" ]; then
569     printf ' :linkage-table' >> $ltf
570     printf ' :stack-allocatable-closures :stack-allocatable-vectors' >> $ltf
571     printf ' :stack-allocatable-lists :stack-allocatable-fixed-objects' >> $ltf
572     printf ' :alien-callbacks' >> $ltf
573     # Use a little C program to try to guess the endianness.  Ware
574     # cross-compilers!
575     #
576     # FIXME: integrate to grovel-features, mayhaps
577     $GNUMAKE -C tools-for-build determine-endianness -I ../src/runtime
578     tools-for-build/determine-endianness >> $ltf
579 elif [ "$sbcl_arch" = "ppc" ]; then
580     printf ' :gencgc :stack-allocatable-closures :stack-allocatable-lists' >> $ltf
581     printf ' :linkage-table :raw-instance-init-vops :memory-barrier-vops' >> $ltf
582     printf ' :compare-and-swap-vops :multiply-high-vops' >> $ltf
583     if [ "$sbcl_os" = "linux" ]; then
584         # Use a C program to detect which kind of glibc we're building on,
585         # to bandage across the break in source compatibility between
586         # versions 2.3.1 and 2.3.2
587         #
588         # FIXME: integrate to grovel-features, mayhaps
589         $GNUMAKE -C tools-for-build where-is-mcontext -I ../src/runtime
590         tools-for-build/where-is-mcontext > src/runtime/ppc-linux-mcontext.h || (echo "error running where-is-mcontext"; exit 1)
591     elif [ "$sbcl_os" = "darwin" ]; then
592         # We provide a dlopen shim, so a little lie won't hurt
593         printf " :os-provides-dlopen :alien-callbacks" >> $ltf
594         # The default stack ulimit under darwin is too small to run PURIFY.
595         # Best we can do is complain and exit at this stage
596         if [ "`ulimit -s`" = "512" ]; then
597             echo "Your stack size limit is too small to build SBCL."
598             echo "See the limit(1) or ulimit(1) commands and the README file."
599             exit 1
600         fi
601     fi
602 elif [ "$sbcl_arch" = "sparc" ]; then
603     # Test the compiler in order to see if we are building on Sun
604     # toolchain as opposed to GNU binutils, and write the appropriate
605     # FUNCDEF macro for assembler. No harm in running this on sparc-linux
606     # as well.
607     sh tools-for-build/sparc-funcdef.sh > src/runtime/sparc-funcdef.h
608     if [ "$sbcl_os" = "sunos" ] || [ "$sbcl_os" = "linux" ]; then
609         printf ' :linkage-table' >> $ltf
610     fi
611     printf ' :stack-allocatable-closures :stack-allocatable-lists' >> $ltf
612 elif [ "$sbcl_arch" = "alpha" ]; then
613     printf ' :stack-allocatable-closures :stack-allocatable-lists' >> $ltf
614 elif [ "$sbcl_arch" = "hppa" ]; then
615     printf ' :stack-allocatable-vectors :stack-allocatable-fixed-objects' >> $ltf
616     printf ' :stack-allocatable-lists' >> $ltf
617 else
618     # Nothing need be done in this case, but sh syntax wants a placeholder.
619     echo > /dev/null
620 fi
621
622 export sbcl_os sbcl_arch
623 sh tools-for-build/grovel-features.sh >> $ltf
624
625 echo //finishing $ltf
626 echo ')))' >> $ltf
627
628 # FIXME: The version system should probably be redone along these lines:
629 #
630 # echo //setting up version information.
631 # versionfile=version.txt
632 # cp base-version.txt $versionfile
633 # echo " (built `date -u` by `whoami`@`hostname`)" >> $versionfile
634 # echo 'This is a machine-generated file and should not be edited by hand.' >> $versionfile
635
636 # Make a unique ID for this build (to discourage people from
637 # mismatching sbcl and *.core files).
638 if [ `uname` = "SunOS" ] ; then
639   # use /usr/xpg4/bin/id instead of /usr/bin/id
640   PATH=/usr/xpg4/bin:$PATH
641 fi
642 echo '"'`hostname`-`id -un`-`date +%Y-%m-%d-%H-%M-%S`'"' > output/build-id.tmp