From d7ed6049d313e5c0fc7adcb88e19e50df60b3d58 Mon Sep 17 00:00:00 2001
From: Thomas Jahns <jahns@dkrz.de>
Date: Mon, 30 Jan 2017 15:36:55 +0100
Subject: [PATCH] Fix EAGAIN problem in libtool.

* This work-around is needed until both bash and libtool wisen up.
---
 config/ltmain.sh | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/config/ltmain.sh b/config/ltmain.sh
index 63ae69dc..cfc9c20d 100644
--- a/config/ltmain.sh
+++ b/config/ltmain.sh
@@ -136,6 +136,18 @@ progpath="$0"
 
 
 : ${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
+}
 test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'}
 : ${MAKE="make"}
 : ${MKDIR="mkdir"}
