From 11903bd586a83c52fadf812dbb29f721d23e4f8d Mon Sep 17 00:00:00 2001
From: Jorrit Fahlke <joe@dune-project.org>
Date: Wed, 20 Oct 2010 00:11:58 +0000
Subject: [PATCH] [mpi-config.m4] When stripping options, make sure not to
 leave partial options behind.

This makes it possible to compile programs again with openmpi.

Also, keep -Wl,OPTION options which pass OPTION down to the linker.

[[Imported from SVN: r6196]]
---
 m4/mpi-config.m4 | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/m4/mpi-config.m4 b/m4/mpi-config.m4
index 37d35544f..644f4d5d5 100644
--- a/m4/mpi-config.m4
+++ b/m4/mpi-config.m4
@@ -25,7 +25,9 @@ mpi_getflags () {
     retval=`echo $retval | sed -e "s/ ${2} / /"`
   fi
   # remove optimization, warning, etc paramters
-  retval=`echo $retval | sed -e 's/-g//g' -e 's/-W[[a-z0-9]]\+//g' -e 's/-O[[0-9]]\+//g' -e 's/^ *//g'`
+  retval=`echo " $retval " | sed -e 's/ -g / /g' -e 's/ -W[[a-z0-9]]\+ / /g' -e 's/ -O[[0-9]]\+ / /g'`
+  # strip leading and trailing spaces
+  retval=`echo "$retval" | sed 's/^ *//g;s/ *$//g'`
 }
 
 # removes regexp $2 from string $1
-- 
GitLab