Created
December 22, 2008 13:04
-
-
Save herzi/38974 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/depends/check-libgmp3.sh b/depends/check-libgmp3.sh | |
index d3054ef..e8b0359 100755 | |
--- a/depends/check-libgmp3.sh | |
+++ b/depends/check-libgmp3.sh | |
@@ -2,4 +2,5 @@ | |
# check-libgmp3.sh by Dan Peori (danpeori@oopo.net) | |
## Check for libgmp3. | |
- ( ls -l /usr/include/gmp.h || ls -l /usr/include/local/gmp.h ) 1> /dev/null 2> /dev/null || { echo "ERROR: Install libgmp3 before continuing."; exit 1; } | |
+ ../depends/try-compile.sh cpp '#include <gmp.h>' \ | |
+ || { echo "ERROR: Install libgmp3 before continuing."; exit 1; } | |
diff --git a/depends/check-libmpfr.sh b/depends/check-libmpfr.sh | |
index 6aae8be..67636ff 100755 | |
--- a/depends/check-libmpfr.sh | |
+++ b/depends/check-libmpfr.sh | |
@@ -1,5 +1,6 @@ | |
#!/bin/sh | |
# check-libmpfr.sh by Dan Peori (danpeori@oopo.net) | |
- ## Check for libmprf. | |
- ( ls -l /usr/include/mpfr.h || ls -l /usr/local/include/mpfr.h ) 1> /dev/null 2> /dev/null || { echo "ERROR: Install libmpfr before continuing."; exit 1; } | |
+ ## Check for libmpfr. | |
+ ../depends/try-compile.sh cpp '#include <mpfr.h>' \ | |
+ || { echo "ERROR: Install libmpfr before continuing."; exit 1; } | |
diff --git a/depends/try-compile.sh b/depends/try-compile.sh | |
new file mode 100755 | |
index 0000000..75d95b8 | |
--- /dev/null | |
+++ b/depends/try-compile.sh | |
@@ -0,0 +1,48 @@ | |
+#!/bin/bash | |
+# This file is part of ps3toolchain | |
+# | |
+# AUTHORS | |
+# Sven Herzberg <sven@imendio.com> | |
+# | |
+# Copyright (C) 2008 Sven Herzberg | |
+# | |
+# This work is provided "as is"; redistribution and modification | |
+# in whole or in part, in any medium, physical or electronic is | |
+# permitted without restriction. | |
+# | |
+# This work is distributed in the hope that it will be useful, | |
+# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
+# | |
+# In no event shall the authors or contributors be liable for any | |
+# direct, indirect, incidental, special, exemplary, or consequential | |
+# damages (including, but not limited to, procurement of substitute | |
+# goods or services; loss of use, data, or profits; or business | |
+# interruption) however caused and on any theory of liability, whether | |
+# in contract, strict liability, or tort (including negligence or | |
+# otherwise) arising in any way out of the use of this software, even | |
+# if advised of the possibility of such damage. | |
+ | |
+if test $# -ne 2; then | |
+ echo "Usage: $0 [compiler] [input]" >&2 | |
+ echo | |
+ exit 1 | |
+fi | |
+ | |
+try_compile () | |
+{ | |
+ error="`echo "$2" | $1 $CFLAGS 2>&1 >/dev/null`" | |
+ | |
+ if test $? != 0; then | |
+ echo >&2 | |
+ echo "Failed compiling program:" >&2 | |
+ echo "$error" >&2 | |
+ echo | |
+ echo "Failed input was:" >&2 | |
+ echo "$2" | |
+ exit 1 | |
+ fi | |
+} | |
+ | |
+try_compile "$1" "$2" || exit $? | |
+ | |
diff --git a/toolchain.sh b/toolchain.sh | |
index 9e755c9..b19225d 100755 | |
--- a/toolchain.sh | |
+++ b/toolchain.sh | |
@@ -11,7 +11,7 @@ | |
cd build || { echo "ERROR: Could not enter the build directory."; exit 1; } | |
## Fetch the depend scripts. | |
- DEPEND_SCRIPTS=(`ls ../depends/*.sh | sort`) | |
+ DEPEND_SCRIPTS=(`ls ../depends/check*.sh | sort`) | |
## Run all the depend scripts. | |
for SCRIPT in ${DEPEND_SCRIPTS[@]}; do "$SCRIPT" || { echo "$SCRIPT: Failed."; exit 1; } done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment