automoc/0004-auto-detect-case-insen...

57 lines
1.8 KiB
Diff

From bc0981b6fa49aa1821f9d0e649887b82b513dcd4 Mon Sep 17 00:00:00 2001
From: Benjamin Reed <ranger@befunk.com>
Date: Mon, 30 Mar 2009 14:24:47 +0000
Subject: [PATCH 04/33] auto-detect case-insensitive filesystem on OSX
svn path=/trunk/kdesupport/automoc/; revision=946924
---
kde4automoc.cpp | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/kde4automoc.cpp b/kde4automoc.cpp
index 7636601..e85ec62 100644
--- a/kde4automoc.cpp
+++ b/kde4automoc.cpp
@@ -47,6 +47,10 @@
#include <utime.h>
#endif
+#if defined(Q_OS_DARWIN) || defined(Q_OS_MAC)
+#include <unistd.h>
+#endif
+
// currently this is only used for the version number, Alex
#include "automoc4_config.h"
@@ -182,7 +186,7 @@ void AutoMoc::lazyInit()
// on the Mac, add -F always, otherwise headers in the frameworks won't be found
// is it necessary to do this only optionally ? Alex
-#ifdef Q_OS_MAC
+#if defined(Q_OS_DARWIN) || defined(Q_OS_MAC)
mocIncludes << "-F/Library/Frameworks";
#endif
@@ -284,9 +288,17 @@ bool AutoMoc::run()
QRegExp mocIncludeRegExp(QLatin1String("[\n]\\s*#\\s*include\\s+[\"<]((?:[^ \">]+/)?moc_[^ \">/]+\\.cpp|[^ \">]+\\.moc)[\">]"));
QRegExp qObjectRegExp(QLatin1String("[\n]\\s*Q_OBJECT\\b"));
QStringList headerExtensions;
-#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
+#if defined(Q_OS_WIN)
// not case sensitive
headerExtensions << ".h" << ".hpp" << ".hxx";
+#elif defined(Q_OS_DARWIN) || defined(Q_OS_MAC)
+ headerExtensions << ".h" << ".hpp" << ".hxx";
+
+ // detect case-sensitive filesystem
+ long caseSensitive = pathconf(srcdir.toLocal8Bit(), _PC_CASE_SENSITIVE);
+ if (caseSensitive == 1) {
+ headerExtensions << ".H";
+ }
#else
headerExtensions << ".h" << ".hpp" << ".hxx" << ".H";
#endif
--
2.4.3