0.6.12.4:
[sbcl.git] / make-config.sh
1 #!/bin/sh
2
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.
9
10 # This software is part of the SBCL system. See the README file for
11 # more information.
12 #
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.
18
19 echo //entering make-config.sh
20
21 ltf=`pwd`/local-target-features.lisp-expr
22 echo //initializing $ltf
23 echo '; This is a machine-generated file and should not be edited by hand.' > $ltf
24 echo -n '(' >> $ltf
25
26 echo '//setting up "target"-named symlinks to designate target architecture'
27 # Currently supported: x86 alpha
28 sbcl_arch=x86
29 echo -n ":$sbcl_arch" >> $ltf 
30 for d in src/compiler src/assembly; do
31     echo //setting up symlink $d/target
32     original_dir=`pwd`
33     cd $d
34     if [ -L target ] ; then
35         rm target
36     elif [ -e target ] ; then
37         echo "I'm afraid to replace non-symlink $d/target with a symlink."
38         exit 1
39     fi
40     if [ -d $sbcl_arch ] ; then
41         ln -s $sbcl_arch target
42     else
43         echo "missing sbcl_arch directory $PWD/$sbcl_arch"
44         exit 1
45     fi
46     cd $original_dir
47 done
48
49 echo //setting up OS-dependent information
50 original_dir=`pwd`
51 cd src/runtime/
52 rm -f Config
53 if [ `uname` = Linux ]; then
54     echo -n ' :linux' >> $ltf
55     ln -s Config.$sbcl_arch-linux Config
56 elif uname | grep BSD; then
57     echo -n ' :bsd' >> $ltf
58     if [ `uname` = FreeBSD ]; then
59         echo -n ' :freebsd' >> $ltf
60         ln -s Config.$sbcl_arch-freebsd Config
61     elif [ `uname` = OpenBSD ]; then
62         echo -n ' :openbsd' >> $ltf
63         ln -s Config.$sbcl_arch-openbsd Config
64     else
65         echo unsupported BSD variant: `uname`
66         exit 1
67     fi
68 else
69     echo unsupported OS type: `uname`
70     exit 1
71 fi
72 cd $original_dir
73
74 echo //finishing $ltf
75 echo ')' >> $ltf
76
77 # FIXME: The version system should probably be redone along these lines:
78 #
79 # echo //setting up version information.
80 # versionfile=version.txt
81 # cp base-version.txt $versionfile
82 # echo " (built `date -u` by `whoami`@`hostname`)" >> $versionfile
83 # echo 'This is a machine-generated file and should not be edited by hand.' >> $versionfile