summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2020-05-18 11:54:08 +0200
committerStephan Bergmann <sbergman@redhat.com>2020-05-18 15:03:14 +0200
commitcce42f7de6bdc406f40a0a16ad15285adc4a4c62 (patch)
tree5b64b41039e76f0f3cac195ba7844cfbd948c5da
parentda552b29a4c894e02262c3ea26f231cf1a9a0858 (diff)
Apply dirname to the first word of CXX
...in case it contains addtional arguments like -fsized-deallocation besides the compiler's pathname, which would have caused failures like basename: extra operand '-fsized-deallocation' Try 'basename --help' for more information. dirname: missing operand Try 'dirname --help' for more information. dirname: missing operand Try 'dirname --help' for more information. (printf reuses the format operand to satisfy all argument operands, so that \n | head hack is needed to get just the first one, assuming that CXX did not contain any carefully crafted escape sequences inside that first argument that would expand to a newline when printing. Also, this does not cater for leading var=value or (even more far-fetched) redirection words in CXX, but the original code did not, either.) Change-Id: Iae4d1a0ae3b67cc5e8c7a8a36258230f8ab8fd70 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94406 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
-rw-r--r--configure.ac2
1 files changed, 1 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index 1d531f32edec..6e5e18021a3c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -7205,7 +7205,7 @@ if test "$COM_IS_CLANG" = "TRUE"; then
dnl The prefix where Clang resides, override to where Clang resides if
dnl using a source build:
if test -z "$CLANGDIR"; then
- CLANGDIR=$(dirname $(dirname $($CXX -print-prog-name=$(basename $CXX))))
+ CLANGDIR=$(dirname $(dirname $($CXX -print-prog-name=$(basename $(printf '%s\n' $CXX | head -n 1)))))
fi
# Assume Clang is self-built, but allow overriding COMPILER_PLUGINS_CXX to the compiler Clang was built with.
if test -z "$COMPILER_PLUGINS_CXX"; then