[PATCH xorg-gtest 1/5] Require gtest-source-path to be absolute

Peter Hutterer peter.hutterer at who-t.net
Thu Aug 9 22:38:11 PDT 2012


We implicitly already require this (examples/ won't build with relative
paths), so make it explicit in the macros

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 aclocal/xorg-gtest.m4 | 16 +++++++++++++---
 m4/gtest.m4           | 14 ++++++++++++--
 2 files changed, 25 insertions(+), 5 deletions(-)

diff --git a/aclocal/xorg-gtest.m4 b/aclocal/xorg-gtest.m4
index 238f892..d6a75af 100644
--- a/aclocal/xorg-gtest.m4
+++ b/aclocal/xorg-gtest.m4
@@ -1,4 +1,4 @@
-# serial 5
+# serial 6
 
 # Copyright (C) 2012 Canonical, Ltd.
 #
@@ -30,13 +30,23 @@ AC_DEFUN([_CHECK_GTEST],
   AC_ARG_WITH([gtest-source-path],
               [AS_HELP_STRING([--with-gtest-source-path],
                               [location of the Google test sources, defaults to /usr/src/gtest])],
-              [GTEST_SOURCE="$withval"; GTEST_CPPFLAGS="-I$withval/include"],
+              [GTEST_SOURCE="$withval"; GTEST_CPPFLAGS="-I$withval/include";
+               case "$withval" in
+                  /*) ;;
+                  *) AC_MSG_ERROR([gtest-source-path must be an absolute path ('$withval')]) ;;
+               esac
+              ],
               [GTEST_SOURCE="/usr/src/gtest"])
 
   AC_ARG_WITH([gtest-include-path],
               [AS_HELP_STRING([--with-gtest-include-path],
                               [location of the Google test headers])],
-              [GTEST_CPPFLAGS="-I$withval"])
+              [GTEST_CPPFLAGS="-I$withval";
+               case "$withval" in
+                  /*) ;;
+                  *) AC_MSG_ERROR([gtest-include-path must be an absolute path ('$withval')]) ;;
+               esac
+               ])
 
   GTEST_CPPFLAGS="$GTEST_CPPFLAGS -I$GTEST_SOURCE"
 
diff --git a/m4/gtest.m4 b/m4/gtest.m4
index 6722fef..352e5d6 100644
--- a/m4/gtest.m4
+++ b/m4/gtest.m4
@@ -28,13 +28,23 @@ AC_DEFUN([CHECK_GTEST],
   AC_ARG_WITH([gtest-source-path],
               [AS_HELP_STRING([--with-gtest-source-path],
                               [location of the Google test sources, defaults to /usr/src/gtest])],
-              [GTEST_SOURCE="$withval"; GTEST_CPPFLAGS="-I$withval/include"],
+              [GTEST_SOURCE="$withval"; GTEST_CPPFLAGS="-I$withval/include";
+               case "$withval" in
+                  /*) ;;
+                  *) AC_MSG_ERROR([gtest source path must be an absolute path ('$withval')]) ;;
+               esac
+              ],
               [GTEST_SOURCE="/usr/src/gtest"])
 
   AC_ARG_WITH([gtest-include-path],
               [AS_HELP_STRING([--with-gtest-include-path],
                               [location of the Google test headers])],
-              [GTEST_CPPFLAGS="-I$withval"])
+              [GTEST_CPPFLAGS="-I$withval";
+               case "$withval" in
+                  /*) ;;
+                  *) AC_MSG_ERROR([gtest-include-path must be an absolute path ('$withval')]) ;;
+               esac
+               ])
 
   GTEST_CPPFLAGS="$GTEST_CPPFLAGS -I$GTEST_SOURCE"
 
-- 
1.7.11.2



More information about the xorg-devel mailing list