Check that the supplied path is a full patch name and not a relative
path name.

Autoconf configure srcipt does the same check:
error: expected an absolute directory name for --libdir: lib

Signed-off-by: Gaetan Nadon <[email protected]>
---
 build.sh |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/build.sh b/build.sh
index 659450e..ae1adf0 100755
--- a/build.sh
+++ b/build.sh
@@ -980,6 +980,21 @@ usage() {
     envoptions
 }
 
+# Ensure the named variable value contains a full path name
+# arguments:
+#   $1 - the variable value (the path to examin)
+#   $2 - the name of the variable
+# returns:
+#   returns nothing or exit on error with message
+check_full_path () {
+    if [ X"`expr substr $1 1 1`" != X/ ]; then
+       echo "The path \"$1\" supplied by \"$2\" must be a full path name"
+       echo ""
+       usage
+       exit 1
+    fi
+}
+
 HAVE_ARCH="`uname -i`"
 DIR_ARCH=""
 DIR_CONFIG="."
@@ -1178,35 +1193,43 @@ if [ X"${PREFIX}" = X ] && [ X"$LISTONLY" = X ]; then
     exit 1
 fi
 
+check_full_path $PREFIX PREFIX
+
 # Set the default value for EPREFIX
 if [ X"$EPREFIX_SET" = X ]; then
     EPREFIX=$PREFIX
 fi
+check_full_path $EPREFIX EPREFIX
 
 # Set the default value for BINDIR
 if [ X"$BINDIR_SET" = X ]; then
     BINDIR=$EPREFIX/bin
 fi
+check_full_path $BINDIR BINDIR
 
 # Set the default value for DATAROOTDIR
 if [ X"$DATAROOTDIR_SET" = X ]; then
     DATAROOTDIR=$PREFIX/share
 fi
+check_full_path $DATAROOTDIR DATAROOTDIR
 
 # Set the default value for DATADIR
 if [ X"$DATADIR_SET" = X ]; then
     DATADIR=$DATAROOTDIR
 fi
+check_full_path $DATADIR DATADIR
 
 # Set the default value for LIBDIR
 if [ X"$LIBDIR_SET" = X ]; then
     LIBDIR=$EPREFIX/lib
 fi
+check_full_path $LIBDIR LIBDIR
 
 # Set the default value for LOCALSTATEDIR
 if [ X"$LIBDIR_SET" = X ]; then
     LOCALSTATEDIR=$PREFIX/var
 fi
+check_full_path $LOCALSTATEDIR LOCALSTATEDIR
 
 HOST_OS=`uname -s`
 export HOST_OS
-- 
1.6.0.4

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to