0.7.1.41:
[sbcl/lichteblau.git] / make-config.sh
blob89078337cbbcceecb67d4bbce9ad316d6cfac08d
1 #!/bin/sh
3 # The make-config.sh script uses information about the target machine
4 # to set things up for compilation. It's vaguely like a stripped-down
5 # version of autoconf. It's intended to be run as part of make.sh. The
6 # only time you'd want to run it by itself is if you're trying to
7 # cross-compile the system or if you're doing some kind of
8 # troubleshooting.
10 # This software is part of the SBCL system. See the README file for
11 # more information.
13 # This software is derived from the CMU CL system, which was
14 # written at Carnegie Mellon University and released into the
15 # public domain. The software is in the public domain and is
16 # provided with absolutely no warranty. See the COPYING and CREDITS
17 # files for more information.
19 echo //entering make-config.sh
21 echo //ensuring the existence of output/ directory
22 if [ ! -d output ] ; then mkdir output; fi
24 ltf=`pwd`/local-target-features.lisp-expr
25 echo //initializing $ltf
26 echo ';;;; This is a machine-generated file.' > $ltf
27 echo ';;;; Please do not edit it by hand.' >> $ltf
28 echo ';;;; See make-config.sh.' >> $ltf
29 echo -n '(' >> $ltf
31 echo //guessing default target CPU architecture from host architecture
32 case `uname -m` in
33 *86) guessed_sbcl_arch=x86 ;;
34 [Aa]lpha) guessed_sbcl_arch=alpha ;;
35 sparc*) guessed_sbcl_arch=sparc ;;
36 ppc) guessed_sbcl_arch=ppc ;;
38 # If we're not building on a supported target architecture, we
39 # we have no guess, but it's not an error yet, since maybe
40 # target architecture will be specified explicitly below.
41 guessed_sbcl_arch=''
43 esac
45 echo //setting up CPU-architecture-dependent information
46 sbcl_arch=${SBCL_ARCH:-$guessed_sbcl_arch}
47 echo sbcl_arch=\"$sbcl_arch\"
48 if [ "$sbcl_arch" = "" ] ; then
49 echo "can't guess target SBCL architecture, need SBCL_ARCH environment var"
50 exit 1
52 echo -n ":$sbcl_arch" >> $ltf
53 # KLUDGE: currently the x86 only works with the generational garbage
54 # collector (indicated by the presence of :GENCGC in *FEATURES*) and
55 # alpha, sparc and ppc with the stop'n'copy collector (indicated by
56 # the absence of :GENCGC in *FEATURES*). This isn't a great
57 # separation, but for now, rather than have :GENCGC in
58 # base-target-features.lisp-expr, we add it into local-target-features
59 # if we're building for x86. -- CSR, 2002-02-21 Then we do something
60 # similar with :STACK-GROWS-FOOWARD, too. -- WHN 2002-03-03
61 if [ "$sbcl_arch" = "x86" ] ; then
62 echo -n ' :gencgc :stack-grows-downward-not-upward' >> $ltf
63 else
64 # Nothing need be done in this case, but sh syntax wants a placeholder.
65 echo > /dev/null
67 for d in src/compiler src/assembly; do
68 echo //setting up symlink $d/target
69 original_dir=`pwd`
70 cd $d
71 if [ -L target ] ; then
72 rm target
73 elif [ -e target ] ; then
74 echo "I'm afraid to replace non-symlink $d/target with a symlink."
75 exit 1
77 if [ -d $sbcl_arch ] ; then
78 ln -s $sbcl_arch target
79 else
80 echo "missing sbcl_arch directory $PWD/$sbcl_arch"
81 exit 1
83 cd $original_dir
84 done
86 echo //setting up OS-dependent information
87 original_dir=`pwd`
88 cd src/runtime/
89 rm -f Config target-arch-os.h target-arch.h target-os.h target-lispregs.h
90 # KLUDGE: these two logically belong in the previous section
91 # ("architecture-dependent"); it seems silly to enforce this in terms
92 # of the shell script, though. -- CSR, 2002-02-03
93 ln -s $sbcl_arch-arch.h target-arch.h
94 ln -s $sbcl_arch-lispregs.h target-lispregs.h
95 case `uname` in
96 Linux)
97 echo -n ' :linux' >> $ltf
98 ln -s Config.$sbcl_arch-linux Config
99 ln -s $sbcl_arch-linux-os.h target-arch-os.h
100 ln -s linux-os.h target-os.h
102 *BSD)
103 echo -n ' :bsd' >> $ltf
104 ln -s $sbcl_arch-bsd-os.h target-arch-os.h
105 ln -s bsd-os.h target-os.h
106 case `uname` in
107 FreeBSD)
108 echo -n ' :freebsd' >> $ltf
109 ln -s Config.$sbcl_arch-freebsd Config
111 OpenBSD)
112 echo -n ' :openbsd' >> $ltf
113 ln -s Config.$sbcl_arch-openbsd Config
116 echo unsupported BSD variant: `uname`
117 exit 1
119 esac
122 echo unsupported OS type: `uname`
123 exit 1
125 esac
126 cd $original_dir
128 echo //finishing $ltf
129 echo ')' >> $ltf
131 # FIXME: The version system should probably be redone along these lines:
133 # echo //setting up version information.
134 # versionfile=version.txt
135 # cp base-version.txt $versionfile
136 # echo " (built `date -u` by `whoami`@`hostname`)" >> $versionfile
137 # echo 'This is a machine-generated file and should not be edited by hand.' >> $versionfile