Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/tools/jam/src/build.sh @ 29

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

updated boost from 1_33_1 to 1_34_1

  • Property svn:executable set to *
File size: 8.6 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 "###     mingw(msys), qcc, 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 -r /mingw/bin/gcc ; then
65        BOOST_JAM_TOOLSET=mingw
66        BOOST_JAM_TOOLSET_ROOT=/mingw/
67    elif test_uname Darwin ; then BOOST_JAM_TOOLSET=darwin
68    elif test_uname IRIX ; then BOOST_JAM_TOOLSET=mipspro
69    elif test_uname IRIX64 ; then BOOST_JAM_TOOLSET=mipspro
70    elif test_uname OSF1 ; then BOOST_JAM_TOOLSET=tru64cxx
71    elif test_uname QNX && test_path qcc ; then BOOST_JAM_TOOLSET=qcc
72    elif test_path gcc ; then BOOST_JAM_TOOLSET=gcc
73    elif test_path icc ; then BOOST_JAM_TOOLSET=intel-linux
74    elif test -r /opt/intel/cc/9.0/bin/iccvars.sh ; then
75        BOOST_JAM_TOOLSET=intel-linux
76        BOOST_JAM_TOOLSET_ROOT=/opt/intel/cc/9.0
77    elif test -r /opt/intel_cc_80/bin/iccvars.sh ; then
78        BOOST_JAM_TOOLSET=intel-linux
79        BOOST_JAM_TOOLSET_ROOT=/opt/intel_cc_80
80    elif test -r /opt/intel/compiler70/ia32/bin/iccvars.sh ; then
81        BOOST_JAM_TOOLSET=intel-linux
82        BOOST_JAM_TOOLSET_ROOT=/opt/intel/compiler70/ia32/
83    elif test -r /opt/intel/compiler60/ia32/bin/iccvars.sh ; then
84        BOOST_JAM_TOOLSET=intel-linux
85        BOOST_JAM_TOOLSET_ROOT=/opt/intel/compiler60/ia32/
86    elif test -r /opt/intel/compiler50/ia32/bin/iccvars.sh ; then
87        BOOST_JAM_TOOLSET=intel-linux
88        BOOST_JAM_TOOLSET_ROOT=/opt/intel/compiler50/ia32/
89    elif test_path xlc ; then BOOST_JAM_TOOLSET=vacpp
90    elif test_path como ; then BOOST_JAM_TOOLSET=como
91    elif test_path KCC ; then BOOST_JAM_TOOLSET=kcc
92    elif test_path bc++ ; then BOOST_JAM_TOOLSET=kylix
93    elif test_path aCC ; then BOOST_JAM_TOOLSET=acc
94    elif test_uname HP-UX ; then BOOST_JAM_TOOLSET=acc
95    elif test -r /opt/SUNWspro/bin/cc ; then
96        BOOST_JAM_TOOLSET=sunpro
97        BOOST_JAM_TOOLSET_ROOT=/opt/SUNWspro/
98    # Test for "cc" as the default fallback.
99    elif test_path $CC ; then BOOST_JAM_TOOLSET=cc
100    elif test_path cc ; then
101        BOOST_JAM_TOOLSET=cc
102        CC=cc
103    fi
104    if test "$BOOST_JAM_TOOLSET" = "" ; then
105        error_exit "Could not find a suitable toolset."
106    fi
107}
108
109# The one option we support in the invocation
110# is the name of the toolset to force building
111# with.
112case "$1" in
113    --guess-toolset) Guess_Toolset ; echo "$BOOST_JAM_TOOLSET" ; exit 1 ;;
114    -*) Guess_Toolset ;;
115    ?*) BOOST_JAM_TOOLSET=$1 ; shift ;;
116    *) Guess_Toolset ;;
117esac
118BOOST_JAM_OPT_JAM="-o bootstrap/jam0"
119BOOST_JAM_OPT_MKJAMBASE="-o bootstrap/mkjambase0"
120BOOST_JAM_OPT_YYACC="-o bootstrap/yyacc0"
121case $BOOST_JAM_TOOLSET in
122    mingw)
123    if test -r ${BOOST_JAM_TOOLSET_ROOT}bin/gcc ; then
124        export PATH=${BOOST_JAM_TOOLSET_ROOT}bin:$PATH
125    fi
126    BOOST_JAM_CC="gcc -DNT"
127    ;;
128   
129    gcc)
130    BOOST_JAM_CC=gcc
131    ;;
132   
133    darwin)
134    BOOST_JAM_CC=cc
135    ;;
136   
137    intel-linux)
138    if test -r /opt/intel/cc/9.0/bin/iccvars.sh ; then
139        BOOST_JAM_TOOLSET_ROOT=/opt/intel/cc/9.0/
140    elif test -r /opt/intel_cc_80/bin/iccvars.sh ; then
141        BOOST_JAM_TOOLSET_ROOT=/opt/intel_cc_80/
142    elif test -r /opt/intel/compiler70/ia32/bin/iccvars.sh ; then
143        BOOST_JAM_TOOLSET_ROOT=/opt/intel/compiler70/ia32/
144    elif test -r /opt/intel/compiler60/ia32/bin/iccvars.sh ; then
145        BOOST_JAM_TOOLSET_ROOT=/opt/intel/compiler60/ia32/
146    elif test -r /opt/intel/compiler50/ia32/bin/iccvars.sh ; then
147        BOOST_JAM_TOOLSET_ROOT=/opt/intel/compiler50/ia32/
148    fi
149    if test -r ${BOOST_JAM_TOOLSET_ROOT}bin/iccvars.sh ; then
150        # iccvars doesn't change LD_RUN_PATH. We adjust LD_RUN_PATH
151        # here in order not to have to rely on ld.so.conf knowing the
152        # icc library directory. We do this before running iccvars.sh
153        # in order to allow a user to add modifications to LD_RUN_PATH
154        # in iccvars.sh.
155        if test -z "${LD_RUN_PATH}"; then
156            LD_RUN_PATH="${BOOST_JAM_TOOLSET_ROOT}lib"
157        else
158            LD_RUN_PATH="${BOOST_JAM_TOOLSET_ROOT}lib:${LD_RUN_PATH}"
159        fi
160        export LD_RUN_PATH
161        . ${BOOST_JAM_TOOLSET_ROOT}bin/iccvars.sh
162    fi
163    BOOST_JAM_CC=icc
164    ;;
165   
166    vacpp)
167    BOOST_JAM_CC=xlc
168    ;;
169   
170    como)
171    BOOST_JAM_CC="como --c"
172    ;;
173   
174    kcc)
175    BOOST_JAM_CC=KCC
176    ;;
177   
178    kylix)
179    BOOST_JAM_CC=bc++
180    ;;
181   
182    mipspro)
183    BOOST_JAM_CC=cc
184    ;;
185   
186    sunpro)
187    if test -z "${BOOST_JAM_TOOLSET_ROOT}" -a -r /opt/SUNWspro/bin/cc ; then
188        BOOST_JAM_TOOLSET_ROOT=/opt/SUNWspro/
189    fi
190    if test -r "${BOOST_JAM_TOOLSET_ROOT}bin/cc" ; then
191        PATH=${BOOST_JAM_TOOLSET_ROOT}bin:${PATH}
192        export PATH
193    fi
194    BOOST_JAM_CC=cc
195    ;;
196   
197    tru64cxx)
198    BOOST_JAM_CC=cc
199    ;;
200   
201    acc)
202    BOOST_JAM_CC="cc -Ae"
203    ;;
204   
205    cc)
206    if test -z "$CC" ; then CC=cc ; fi
207    BOOST_JAM_CC=$CC
208    BOOST_JAM_OPT_JAM="$BOOST_JAM_OPT_JAM $CFLAGS $LIBS"
209    BOOST_JAM_OPT_MKJAMBASE="$BOOST_JAM_OPT_MKJAMBASE $CFLAGS $LIBS"
210    BOOST_JAM_OPT_YYACC="$BOOST_JAM_OPT_YYACC $CFLAGS $LIBS"
211    ;;
212   
213    qcc)
214    BOOST_JAM_CC=qcc
215    ;;
216   
217    *)
218    error_exit "Unknown toolset: $BOOST_JAM_TOOLSET"
219    ;;
220esac
221
222echo "###"
223echo "### Using '$BOOST_JAM_TOOLSET' toolset."
224echo "###"
225
226YYACC_SOURCES="yyacc.c"
227MKJAMBASE_SOURCES="mkjambase.c"
228BJAM_SOURCES="\
229 command.c compile.c debug.c execunix.c expand.c fileunix.c glob.c hash.c\
230 hdrmacro.c headers.c jam.c jambase.c jamgram.c lists.c make.c make1.c\
231 newstr.c option.c parse.c pathunix.c pathvms.c regexp.c\
232 rules.c scan.c search.c subst.c timestamp.c variable.c modules.c\
233 strings.c filesys.c builtins.c pwd.c class.c native.c w32_getreg.c\
234 modules/set.c modules/path.c modules/regex.c modules/property-set.c\
235 modules/sequence.c modules/order.c\
236 execnt.c filent.c"
237
238BJAM_UPDATE=
239if test "$1" = "--update" -o "$2" = "--update" -o "$3" = "--update" -o "$4" = "--update"  ; then
240    BJAM_UPDATE="update"
241fi
242if test "${BJAM_UPDATE}" = "update" -a ! -x "./bootstrap/jam0" ; then
243    BJAM_UPDATE=
244fi
245
246if test "${BJAM_UPDATE}" != "update" ; then
247    echo_run rm -rf bootstrap
248    echo_run mkdir bootstrap
249    if test ! -r jamgram.y -o ! -r jamgramtab.h ; then
250        echo_run ${BOOST_JAM_CC} ${BOOST_JAM_OPT_YYACC} ${YYACC_SOURCES}
251        if test -x "./bootstrap/yyacc0" ; then
252            echo_run ./bootstrap/yyacc0 jamgram.y jamgramtab.h jamgram.yy
253        fi
254    fi
255    if test ! -r jamgram.c -o ! -r jamgram.h ; then
256        if test_path yacc ; then YACC="yacc -d"
257        elif test_path bison ; then YACC="bison -y -d --yacc"
258        fi
259        echo_run $YACC jamgram.y
260        mv -f y.tab.c jamgram.c
261        mv -f y.tab.h jamgram.h
262    fi
263    if test ! -r jambase.c ; then
264        echo_run ${BOOST_JAM_CC} ${BOOST_JAM_OPT_MKJAMBASE} ${MKJAMBASE_SOURCES}
265        if test -x "./bootstrap/mkjambase0" ; then
266            echo_run ./bootstrap/mkjambase0 jambase.c Jambase
267        fi
268    fi
269    echo_run ${BOOST_JAM_CC} ${BOOST_JAM_OPT_JAM} ${BJAM_SOURCES}
270fi
271if test -x "./bootstrap/jam0" ; then
272    if test "${BJAM_UPDATE}" != "update" ; then
273        echo_run ./bootstrap/jam0 -f build.jam --toolset=$BOOST_JAM_TOOLSET "--toolset-root=$BOOST_JAM_TOOLSET_ROOT" clean
274    fi
275    echo_run ./bootstrap/jam0 -f build.jam --toolset=$BOOST_JAM_TOOLSET "--toolset-root=$BOOST_JAM_TOOLSET_ROOT" "$@"
276fi
Note: See TracBrowser for help on using the repository browser.