8585
8686check_prerequisites ()
8787{
88+ unamestr=` uname`
89+ if [[ " $unamestr " == ' Darwin' ]]; then
90+ if [ -f /usr/bin/gcc ]; then
91+ CC=/usr/bin/gcc
92+ else
93+ echo " Missing /usr/bin/gcc, which must exist and be an Apple LLVM version."
94+ exit 1
95+ fi
96+ if [ -f /usr/bin/g++ ]; then
97+ CXX=/usr/bin/g++
98+ else
99+ echo " Missing /usr/bin/g++, which must exist and be an Apple LLVM version."
100+ exit 1
101+ fi
102+ else
103+ # If this is not OS X, default to the user-specified compiler.
104+ # If there is no user-specified compiler, use whatever the
105+ # GNU compilers are in the path.
106+ if [ -z $CC ]; then
107+ CC=gcc
108+ fi
109+ if [ -z $CXX ]; then
110+ CXX=g++
111+ fi
112+ fi
113+
114+ # Verify that 'wget' is is in the path.
88115 if ! type wget > /dev/null; then
89116 echo
90- echo " $cmd requires 'wget'. Please install it. Aborting."
91- exit 1;
92- elif ! type make > /dev/null; then
117+ echo " $cmd requires 'wget'. Please ensure that it is installed and in your path. Aborting."
118+ exit 1
119+ fi
120+ if ! type make > /dev/null; then
93121 echo
94- echo " $cmd requires 'make'. Please install it . Aborting."
95- exit 1;
122+ echo " $cmd requires 'make'. Please ensure that it is installed and in your path . Aborting."
123+ exit 1
96124 fi
97125}
98126
@@ -118,7 +146,7 @@ unpack()
118146build ()
119147{
120148 cd cmake-$version &&
121- ./bootstrap --prefix=$install_path &&
149+ CC= $CC CXX= $CXX ./bootstrap --prefix=$install_path &&
122150 make -j $num_threads
123151}
124152
147175 check_prerequisites &&
148176 download &&
149177 unpack &&
150- build $version $install_path $num_threads
178+ CC= $CC CXX= $CXX build $version $install_path $num_threads
151179 } >&1 | tee build.log
152180 echo " "
153181 echo " Check build.log for results. If the build was successful, type"
0 commit comments