patch 9.1.0408: configure fails on Fedora when including perl

Problem:  configure fails on Fedora when including perl
          (chesheer-smile)
Solution: Filter out -spec=<path> from $LIBS and $LDFLAGS to avoid
          linking relocation errors for unrelated autoconf tests.

closes: #14526

Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/configure.ac b/src/configure.ac
index f6e54b3..e092f68 100644
--- a/src/configure.ac
+++ b/src/configure.ac
@@ -1173,13 +1173,17 @@
 		-e 's/-W[[^ ]]*//g' \
 		-e 's/-D_FORTIFY_SOURCE=.//g'`
       dnl Remove "-lc", it breaks on FreeBSD when using "-pthread".
+      dnl Remove -specs=<file-path>, the hardened flags cause relocation errors
       perllibs=`cd $srcdir; $vi_cv_path_perl -MExtUtils::Embed -e 'ldopts' | \
 		sed -e '/Warning/d' -e '/Note (probably harmless)/d' \
+			-e 's/-specs=[[^ ]*]//g' \
 			-e 's/-bE:perl.exp//' -e 's/-lc //'`
       dnl Don't add perl lib to $LIBS: if it's not in LD_LIBRARY_PATH
       dnl a test in configure may fail because of that.
+      dnl Remove -specs=<file-path>, the hardened flags cause relocation errors
       perlldflags=`cd $srcdir; $vi_cv_path_perl -MExtUtils::Embed \
-		-e 'ccdlflags' | sed -e 's/-bE:perl.exp//'`
+		-e 'ccdlflags' | sed -e 's/-bE:perl.exp//' \
+		-e 's/-specs=[[^ ]*]//g' `
 
       dnl check that compiling a simple program still works with the flags
       dnl added for Perl.