Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/tools/build/jam_src/build.sh @ 12

Last change on this file since 12 was 12, checked in by landauf, 17 years ago

added boost

  • Property svn:executable set to *
File size: 8.2 KB
Line 
1#!/bin/sh
2
3#~ Copyright 2002-2005 Rene Rivera.
4#~ Distributed under the Boost Software License, Version 1.0.
5#~ (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
6
7# Reset the toolset.
8BOOST_JAM_TOOLSET=
9
10# Run a command, and echo before doing so. Also checks the exit
11# status and quits if there was an error.
12echo_run ()
13{
14    echo "$@"
15    $@
16    r=$?
17    if test $r -ne 0 ; then
18        exit $r
19    fi
20}
21
22# Print an error message, and exit with a status of 1.
23error_exit ()
24{
25    echo "###"
26    echo "###" "$@"
27    echo "###"
28    echo "### You can specify the toolset as the argument, i.e.:"
29    echo "###     ./build.sh gcc"
30    echo "###"
31    echo "### Toolsets supported by this script are:"
32    echo "###     acc, como, darwin, gcc, intel-linux, kcc, kylix, mipspro,"
33    echo "###     sunpro, tru64cxx, vacpp"
34    echo "###"
35    echo "### A special toolset; cc, is available which is used as a fallback"
36    echo "### when a more specific toolset is not found and the cc command is"
37    echo "### detected. The 'cc' toolset will use the CC, CFLAGS, and LIBS"
38    echo "### envrironment variables, if present."
39    echo "###"
40    exit 1
41}
42
43# Check that a command is in the PATH.
44test_path ()
45{
46    if `command -v command 1>/dev/null 2>/dev/null`; then
47        command -v $1 1>/dev/null 2>/dev/null
48    else
49        hash $1 1>/dev/null 2>/dev/null
50    fi
51}
52
53# Check that the OS name, as returned by "uname", is as given.
54test_uname ()
55{
56    if test_path uname; then
57        test `uname` = $*
58    fi
59}
60
61# Try and guess the toolset to bootstrap the build with...
62Guess_Toolset ()
63{
64    if test_uname Darwin ; then BOOST_JAM_TOOLSET=darwin
65    elif test_uname IRIX ; then BOOST_JAM_TOOLSET=mipspro
66    elif test_uname IRIX64 ; then BOOST_JAM_TOOLSET=mipspro
67    elif test_uname OSF1 ; then BOOST_JAM_TOOLSET=tru64cxx
68    elif test_uname QNX && test_path qcc ; then BOOST_JAM_TOOLSET=qcc
69    elif test_path gcc ; then BOOST_JAM_TOOLSET=gcc
70    elif test_path icc ; then BOOST_JAM_TOOLSET=intel-linux
71    elif test -r /opt/intel/cc/9.0/bin/iccvars.sh ; then
72        BOOST_JAM_TOOLSET=intel-linux
73        BOOST_JAM_TOOLSET_ROOT=/opt/intel/cc/9.0
74    elif test -r /opt/intel_cc_80/bin/iccvars.sh ; then
75        BOOST_JAM_TOOLSET=intel-linux
76        BOOST_JAM_TOOLSET_ROOT=/opt/intel_cc_80
77    elif test -r /opt/intel/compiler70/ia32/bin/iccvars.sh ; then
78        BOOST_JAM_TOOLSET=intel-linux
79        BOOST_JAM_TOOLSET_ROOT=/opt/intel/compiler70/ia32/
80    elif test -r /opt/intel/compiler60/ia32/bin/iccvars.sh ; then
81        BOOST_JAM_TOOLSET=intel-linux
82        BOOST_JAM_TOOLSET_ROOT=/opt/intel/compiler60/ia32/
83    elif test -r /opt/intel/compiler50/ia32/bin/iccvars.sh ; then
84        BOOST_JAM_TOOLSET=intel-linux
85        BOOST_JAM_TOOLSET_ROOT=/opt/intel/compiler50/ia32/
86    elif test_path xlc ; then BOOST_JAM_TOOLSET=vacpp
87    elif test_path como ; then BOOST_JAM_TOOLSET=como
88    elif test_path KCC ; then BOOST_JAM_TOOLSET=kcc
89    elif test_path bc++ ; then BOOST_JAM_TOOLSET=kylix
90    elif test_path aCC ; then BOOST_JAM_TOOLSET=acc
91    elif test_uname HP-UX ; then BOOST_JAM_TOOLSET=acc
92    elif test -r /opt/SUNWspro/bin/cc ; then
93        BOOST_JAM_TOOLSET=sunpro
94        BOOST_JAM_TOOLSET_ROOT=/opt/SUNWspro/
95    # Test for "cc" as the default fallback.
96    elif test_path $CC ; then BOOST_JAM_TOOLSET=cc
97    elif test_path cc ; then
98        BOOST_JAM_TOOLSET=cc
99        CC=cc
100    fi
101    if test "$BOOST_JAM_TOOLSET" = "" ; then
102        error_exit "Could not find a suitable toolset."
103    fi
104}
105
106# The one option we support in the invocation
107# is the name of the toolset to force building
108# with.
109case "$1" in
110    --guess-toolset) Guess_Toolset ; echo "$BOOST_JAM_TOOLSET" ; exit 1 ;;
111    -*) Guess_Toolset ;;
112    ?*) BOOST_JAM_TOOLSET=$1 ; shift ;;
113    *) Guess_Toolset ;;
114esac
115BOOST_JAM_OPT_JAM="-o bootstrap/jam0"
116BOOST_JAM_OPT_MKJAMBASE="-o bootstrap/mkjambase0"
117BOOST_JAM_OPT_YYACC="-o bootstrap/yyacc0"
118case $BOOST_JAM_TOOLSET in
119    gcc)
120    BOOST_JAM_CC=gcc
121    ;;
122   
123    darwin)
124    BOOST_JAM_CC=cc
125    ;;
126   
127    intel-linux)
128    if test -r /opt/intel/cc/9.0/bin/iccvars.sh ; then
129        BOOST_JAM_TOOLSET_ROOT=/opt/intel/cc/9.0/
130    elif test -r /opt/intel_cc_80/bin/iccvars.sh ; then
131        BOOST_JAM_TOOLSET_ROOT=/opt/intel_cc_80/
132    elif test -r /opt/intel/compiler70/ia32/bin/iccvars.sh ; then
133        BOOST_JAM_TOOLSET_ROOT=/opt/intel/compiler70/ia32/
134    elif test -r /opt/intel/compiler60/ia32/bin/iccvars.sh ; then
135        BOOST_JAM_TOOLSET_ROOT=/opt/intel/compiler60/ia32/
136    elif test -r /opt/intel/compiler50/ia32/bin/iccvars.sh ; then
137        BOOST_JAM_TOOLSET_ROOT=/opt/intel/compiler50/ia32/
138    fi
139    if test -r ${BOOST_JAM_TOOLSET_ROOT}bin/iccvars.sh ; then
140        # iccvars doesn't change LD_RUN_PATH. We adjust LD_RUN_PATH
141        # here in order not to have to rely on ld.so.conf knowing the
142        # icc library directory. We do this before running iccvars.sh
143        # in order to allow a user to add modifications to LD_RUN_PATH
144        # in iccvars.sh.
145        if test -z "${LD_RUN_PATH}"; then
146            LD_RUN_PATH="${BOOST_JAM_TOOLSET_ROOT}lib"
147        else
148            LD_RUN_PATH="${BOOST_JAM_TOOLSET_ROOT}lib:${LD_RUN_PATH}"
149        fi
150        export LD_RUN_PATH
151        . ${BOOST_JAM_TOOLSET_ROOT}bin/iccvars.sh
152    fi
153    BOOST_JAM_CC=icc
154    ;;
155   
156    vacpp)
157    BOOST_JAM_CC=xlc
158    ;;
159   
160    como)
161    BOOST_JAM_CC="como --c"
162    ;;
163   
164    kcc)
165    BOOST_JAM_CC=KCC
166    ;;
167   
168    kylix)
169    BOOST_JAM_CC=bc++
170    ;;
171   
172    mipspro)
173    BOOST_JAM_CC=cc
174    ;;
175   
176    sunpro)
177    if test -r /opt/SUNWspro/bin/cc ; then
178        BOOST_JAM_TOOLSET_ROOT=/opt/SUNWspro/
179    fi
180    if test -r $BOOST_JAM_TOOLSET_ROOTbin/cc ; then
181        export PATH=$BOOST_JAM_TOOLSET_ROOTbin:$PATH
182    fi
183    BOOST_JAM_CC=cc
184    ;;
185   
186    tru64cxx)
187    BOOST_JAM_CC=cc
188    ;;
189   
190    acc)
191    BOOST_JAM_CC="cc -Ae"
192    ;;
193   
194    cc)
195    if test -z "$CC" ; then CC=cc ; fi
196    BOOST_JAM_CC=$CC
197    BOOST_JAM_OPT_JAM="$BOOST_JAM_OPT_JAM $CFLAGS $LIBS"
198    BOOST_JAM_OPT_MKJAMBASE="$BOOST_JAM_OPT_MKJAMBASE $CFLAGS $LIBS"
199    BOOST_JAM_OPT_YYACC="$BOOST_JAM_OPT_YYACC $CFLAGS $LIBS"
200    ;;
201   
202    qcc)
203    BOOST_JAM_CC=qcc
204    ;;
205   
206    *)
207    error_exit "Unknown toolset: $BOOST_JAM_TOOLSET"
208    ;;
209esac
210
211echo "###"
212echo "### Using '$BOOST_JAM_TOOLSET' toolset."
213echo "###"
214
215YYACC_SOURCES="yyacc.c"
216MKJAMBASE_SOURCES="mkjambase.c"
217BJAM_SOURCES="\
218 command.c compile.c execnt.c execunix.c execvms.c expand.c\
219 filent.c fileos2.c fileunix.c filevms.c glob.c hash.c\
220 hdrmacro.c headers.c jam.c jambase.c jamgram.c lists.c make.c make1.c\
221 newstr.c option.c parse.c pathunix.c pathvms.c regexp.c\
222 rules.c scan.c search.c subst.c timestamp.c variable.c modules.c\
223 strings.c filesys.c builtins.c pwd.c class.c native.c modules/set.c\
224 modules/path.c modules/regex.c modules/property-set.c\
225 modules/sequence.c modules/order.c"
226
227BJAM_UPDATE=
228if test "$1" = "--update" -o "$2" = "--update" -o "$3" = "--update" -o "$4" = "--update"  ; then
229    BJAM_UPDATE="update"
230fi
231if test "${BJAM_UPDATE}" = "update" -a ! -x "./bootstrap/jam0" ; then
232    BJAM_UPDATE=
233fi
234
235if test "${BJAM_UPDATE}" != "update" ; then
236    echo_run rm -rf bootstrap
237    echo_run mkdir bootstrap
238    if test ! -r jamgram.y -o ! -r jamgramtab.h ; then
239        echo_run ${BOOST_JAM_CC} ${BOOST_JAM_OPT_YYACC} ${YYACC_SOURCES}
240        if test -x "./bootstrap/yyacc0" ; then
241            echo_run ./bootstrap/yyacc0 jamgram.y jamgramtab.h jamgram.yy
242        fi
243    fi
244    if test ! -r jamgram.c -o ! -r jamgram.h ; then
245        if test_path yacc ; then YACC="yacc -d"
246        elif test_path bison ; then YACC="bison -y -d --yacc"
247        fi
248        echo_run $YACC jamgram.y
249        mv -f y.tab.c jamgram.c
250        mv -f y.tab.h jamgram.h
251    fi
252    if test ! -r jambase.c ; then
253        echo_run ${BOOST_JAM_CC} ${BOOST_JAM_OPT_MKJAMBASE} ${MKJAMBASE_SOURCES}
254        if test -x "./bootstrap/mkjambase0" ; then
255            echo_run ./bootstrap/mkjambase0 jambase.c Jambase
256        fi
257    fi
258    echo_run ${BOOST_JAM_CC} ${BOOST_JAM_OPT_JAM} ${BJAM_SOURCES}
259fi
260if test -x "./bootstrap/jam0" ; then
261    if test "${BJAM_UPDATE}" != "update" ; then
262        echo_run ./bootstrap/jam0 -f build.jam --toolset=$BOOST_JAM_TOOLSET "--toolset-root=$BOOST_JAM_TOOLSET_ROOT" clean
263    fi
264    echo_run ./bootstrap/jam0 -f build.jam --toolset=$BOOST_JAM_TOOLSET "--toolset-root=$BOOST_JAM_TOOLSET_ROOT" "$@"
265fi
Note: See TracBrowser for help on using the repository browser.