From f550ced3aa8d53edcbf2ae21cd2834e3bf15e042 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= <tor.arne.vestbo@digia.com>
Date: Wed, 22 Jan 2014 12:36:35 +0100
Subject: [PATCH] Don't rely on makedepend on OS X

It's not shipped as part of the default installation, but the binary
in /usr/X11R6/bin/makedepend exists and will trigger a dialog that
asks you to install X11. This is not needed when we can use the
compiler to resolve the dependencies for us.

Change-Id: I67e35a63d0f7101b7673127228df4dcefd3c1fdc
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
---
 configure | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/configure b/configure
index 40126cbc36..f3e09fcc3d 100755
--- a/configure
+++ b/configure
@@ -4024,13 +4024,19 @@ if true; then ###[ '!' -f "$outpath/bin/qmake" ];
         if [ $QT_EDITION = "QT_EDITION_OPENSOURCE" ]; then
             echo "EXTRA_CPPFLAGS = -DQMAKE_OPENSOURCE_EDITION" >> "$mkfile"
         fi
-        cat "$in_mkfile" >> "$mkfile"
 
-        if "$WHICH" makedepend >/dev/null 2>&1 && grep 'depend:' "$mkfile" >/dev/null 2>&1; then
-            (cd "$outpath/qmake" && "$MAKE" -f "$mkfile" depend) >/dev/null 2>&1
-            sed 's,^.*/\([^/]*.o\):,\1:,g' "$mkfile" >"$mkfile.tmp"
-	    sed "s,$outpath,$adjoutpath,g" "$mkfile.tmp" >"$mkfile"
-	    rm "$mkfile.tmp"
+        if [ "$BUILD_ON_MAC" = "yes" ]; then
+            echo "EXTRA_CXXFLAGS += -MMD" >> "$mkfile"
+            cat "$in_mkfile" >> "$mkfile"
+            echo "-include \$(notdir \$(DEPEND_SRC:%.cpp=%.d))" >> "$mkfile"
+        else
+            cat "$in_mkfile" >> "$mkfile"
+            if "$WHICH" makedepend >/dev/null 2>&1 && grep 'depend:' "$mkfile" >/dev/null 2>&1; then
+                (cd "$outpath/qmake" && "$MAKE" -f "$mkfile" depend) >/dev/null 2>&1
+                sed 's,^.*/\([^/]*.o\):,\1:,g' "$mkfile" >"$mkfile.tmp"
+                sed "s,$outpath,$adjoutpath,g" "$mkfile.tmp" >"$mkfile"
+                rm "$mkfile.tmp"
+            fi
         fi
     done