tidied up OpenBSD-vs.-FreeBSD stuff, and src/runtime/Config.x86-*
[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 sbcl_arch=x86 # (the only possibility supported, at least as of sbcl-0.6.7)
28 echo -n ":x86" >> $ltf # (again, the only possibility supported)
29 for d in src/compiler src/assembly; do
30     echo //setting up symlink $d/target
31     original_dir=`pwd`
32     cd $d
33     if [ -L target ] ; then
34         rm target
35     elif [ -e target ] ; then
36         echo "I'm afraid to replace non-symlink $d/target with a symlink."
37         exit 1
38     fi
39     if [ -d $sbcl_arch ] ; then
40         ln -s $sbcl_arch target
41     else
42         echo "missing sbcl_arch directory $PWD/$sbcl_arch"
43         exit 1
44     fi
45     cd $original_dir
46 done
47
48 echo //setting up OS-dependent information
49 original_dir=`pwd`
50 cd src/runtime/
51 rm -f Config
52 if [ `uname` = Linux ]; then
53     echo -n ' :linux' >> $ltf
54     ln -s Config.x86-linux Config
55 elif uname | grep BSD; then
56     echo -n ' :bsd' >> $ltf
57     if [ `uname` = FreeBSD ]; then
58         echo -n ' :freebsd' >> $ltf
59         ln -s Config.x86-freebsd Config
60     elif [ `uname` = OpenBSD ]; then
61         echo -n ' :openbsd' >> $ltf
62         ln -s Config.x86-openbsd Config
63     else
64         echo unsupported BSD variant: `uname`
65         exit 1
66     fi
67 else
68     echo unsupported OS type: `uname`
69     exit 1
70 fi
71 cd $original_dir
72
73 echo //finishing $ltf
74 echo ')' >> $ltf
75
76 # FIXME: The version system should probably be redone along these lines:
77 #
78 # echo //setting up version information.
79 # versionfile=version.txt
80 # cp base-version.txt $versionfile
81 # echo " (built `date -u` by `whoami`@`hostname`)" >> $versionfile
82 # echo 'This is a machine-generated file and should not be edited by hand.' >> $versionfile