+if [ -f build-mpc/.success ]; then
+ printf "Skipping MPC as it is already built\n"
+else
+printf "Building MPC ${MPC_VERSION} ... "
+(
+ #test `uname` = "Darwin" && CFLAGS="$CFLAGS -force_cpusubtype_ALL"
+ cd build-mpc
+ rm -f .failed
+ ../${MPC_DIR}/configure --disable-shared --prefix=$TARGETDIR \
+ --infodir=$TARGETDIR/info --with-mpfr=$DESTDIR$TARGETDIR \
+ --with-gmp=$DESTDIR$TARGETDIR CFLAGS="$HOSTCFLAGS" || touch .failed
+ $MAKE $JOBS || touch .failed
+ $MAKE install DESTDIR=$DESTDIR || touch .failed
+
+ if [ ! -f .failed ]; then touch .success; fi
+) > build-mpc/crossgcc-build.log 2>&1
+test -r build-mpc/.failed && printf "${RED}failed${NC}\n" || printf "${green}ok${NC}\n"
+test -r build-mpc/.failed && exit 1
+fi
+
+if [ -f build-libelf/.success ]; then
+ printf "Skipping libelf as it is already built\n"
+else
+printf "Building libelf ${LIBELF_VERSION} ... "
+(
+ cd build-libelf
+ rm -f .failed
+ echo "$HOSTCFLAGS"
+ CFLAGS="$HOSTCFLAGS" libelf_cv_elf_h_works=no ../${LIBELF_DIR}/configure --disable-shared --prefix=$TARGETDIR \
+ --infodir=$TARGETDIR/info CFLAGS="$HOSTCFLAGS" || touch .failed
+ $MAKE $JOBS || touch .failed
+ $MAKE install DESTDIR=$DESTDIR || touch .failed
+
+ if [ ! -f .failed ]; then touch .success; fi
+) > build-libelf/crossgcc-build.log 2>&1
+test -r build-libelf/.failed && printf "${RED}failed${NC}\n" || printf "${green}ok${NC}\n"
+test -r build-libelf/.failed && exit 1
+fi
+