From 7fade4eb31d7d8bc930e1fe2486fa9dd19366fb4 Mon Sep 17 00:00:00 2001
From: Thomas Jahns <jahns@dkrz.de>
Date: Wed, 21 Aug 2019 19:29:26 +0200
Subject: [PATCH] Re-apply libtool patches.

---
 config/ltmain.sh | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/config/ltmain.sh b/config/ltmain.sh
index 0f0a2da3..e8a25b75 100644
--- a/config/ltmain.sh
+++ b/config/ltmain.sh
@@ -310,6 +310,18 @@ test -z "$GREP" && {
 # in the command search PATH.
 
 : ${CP="cp -f"}
+# work around bug in libtool which raises an error when running in a
+# parallel make that should have been handled in printf internally
+printf()
+{
+  while ! builtin printf "$@" ; do
+    errcode=$?
+    # errcode might be EAGAIN=11 which means to simply try again
+    if [ $errcode != 11 ]; then
+      return $errcode
+    fi
+  done
+}
 : ${ECHO="printf %s\n"}
 : ${EGREP="$GREP -E"}
 : ${FGREP="$GREP -F"}
