From 0a3a34b8565aa1256796e766bd3f0c95d9f011b3 Mon Sep 17 00:00:00 2001
From: Andre Maroneze <andre.maroneze@cea.fr>
Date: Tue, 12 Jan 2021 10:55:54 +0100
Subject: [PATCH] [configure] detect build directory name issues

Currently, the makefile fails catastrophically if the build directory contains
spaces or quotes, so we better detect them early.
---
 configure.in | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/configure.in b/configure.in
index 69dcc5f9248..f9f82982205 100644
--- a/configure.in
+++ b/configure.in
@@ -82,14 +82,21 @@ if test "$VERBOSEMAKE" = yes ; then
   AC_MSG_RESULT(Make will be verbose.)
 fi
 
-##########################################
-# Check for invalid command-line options #
-##########################################
+##############################################################
+# Check for invalid command-line options and build directory #
+##############################################################
 case $prefix in
   *\ * ) AC_MSG_ERROR(spaces not allowed in --prefix argument "$prefix");;
   * ) ;;
 esac
 
+case $(pwd) in
+  *\ * ) AC_MSG_ERROR(spaces not allowed in build directory "$(pwd)");;
+  *\'* ) AC_MSG_ERROR(single quotes not allowed in build directory "$(pwd)");;
+  *\"* ) AC_MSG_ERROR(double quotes not allowed in build directory "$(pwd)");;
+  * ) ;;
+esac
+
 #############################
 # Check for Ocaml compilers #
 #############################
-- 
GitLab