glsl/tests/warnings-test: add fallback srcdir/abs_builddir defines
[mesa.git] / src / compiler / glsl / tests / warnings-test.sh
index b19e2fe517190dd52dc5ef79a135d48fb84d3aaf..7891c2477fe15d112a64c7778a6d1a0ed67ba689 100755 (executable)
@@ -1,8 +1,21 @@
 #!/bin/sh
 
+if [ -z "$srcdir" -o -z "$abs_builddir" ]; then
+    echo ""
+    echo "Warning: you're invoking the script manually and things may fail."
+    echo "Attempting to determine/set srcdir and abs_builddir variables."
+    echo ""
+
+    # Variable should point to the Makefile.glsl.am
+    srcdir=./../../
+    cd `dirname "$0"`
+    # Variable should point to glsl_compiler
+    abs_builddir=`pwd`/../../
+fi
+
 # Execute several shaders, and check that the InfoLog outcome is the expected.
 
-compiler=./glsl_compiler
+compiler=$abs_builddir/glsl_compiler
 total=0
 pass=0