summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-07-14 17:16:32 +0000
committerrubidium <rubidium@openttd.org>2009-07-14 17:16:32 +0000
commit6f0d8acf552d13114783a495fb9860432234e43d (patch)
tree121dd77def960eda3e4c095b11f3ca0bbb842638
parente3c7a77b4066f00f3248e390184da874bd20d7ee (diff)
downloadopenttd-6f0d8acf552d13114783a495fb9860432234e43d.tar.xz
(svn r16828) -Codechange: attempt at making OSX compile with the 10.6 SDK too; no guarantees ofcourse...
-rw-r--r--config.lib45
-rw-r--r--src/os/macosx/osx_stdafx.h3
-rw-r--r--src/stdafx.h9
3 files changed, 48 insertions, 9 deletions
diff --git a/config.lib b/config.lib
index 54bac073b..a72025098 100644
--- a/config.lib
+++ b/config.lib
@@ -2019,16 +2019,53 @@ detect_cocoa() {
log 1 "checking whether to enable the Quartz window subdriver... no"
fi
+ detect_quickdraw
+}
+
+detect_quickdraw() {
+ # 0 means no, 1 is auto-detect, 2 is force
+
# 64 bits doesn't have quickdraw
if [ "$cpu_type" = "64" ]; then
enable_cocoa_quickdraw="0"
+ log 1 "checking Quickdraw window subdriver... disabled (64 bits)"
+ return 0
fi
- if [ "$enable_cocoa_quickdraw" != "0" ]; then
- log 1 "checking whether to enable the Quickdraw window subdriver... yes"
- else
- log 1 "checking whether to enable the Quickdraw window subdriver... no"
+ if [ "$enable_cocoa_quickdraw" = "0" ]; then
+ log 1 "checking Quickdraw window subdriver... disabled"
+
+ return 0
+ fi
+
+cat > tmp.osx.mm << EOF
+#define MAC_OS_X_VERSION_MAX_ALLOWED MAC_OS_X_VERSION_10_3
+#define MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_3
+#include <AvailabilityMacros.h>
+#import <Cocoa/Cocoa.h>
+int main(int argc, char *argv[]) { return 0; }
+EOF
+ execute="$cxx_host $CFLAGS tmp.osx.mm -framework Cocoa -o tmp.osx 2>&1"
+ eval $execute > /dev/null
+ ret=$?
+ log 2 "executing $execute"
+ log 2 " exit code $ret"
+ rm -f tmp.osx.mm tmp.osx
+ if [ "$ret" != "0" ]; then
+ log 1 "checking Quickdraw window subdriver... not found"
+
+ # It was forced, so it should be found.
+ if [ "$enable_cocoa_quickdraw" != "1" ]; then
+ log 1 "configure: error: Quickdraw window driver could not be found"
+ exit 1
+ fi
+
+ enable_cocoa_quickdraw=0
+ return 0
fi
+
+ enable_cocoa_quickdraw=1
+ log 1 "checking Quickdraw window subdriver... found"
}
detect_library() {
diff --git a/src/os/macosx/osx_stdafx.h b/src/os/macosx/osx_stdafx.h
index ee150dd8b..963783c21 100644
--- a/src/os/macosx/osx_stdafx.h
+++ b/src/os/macosx/osx_stdafx.h
@@ -5,6 +5,9 @@
#ifndef MACOS_STDAFX_H
#define MACOS_STDAFX_H
+#define __STDC_LIMIT_MACROS
+#include <stdint.h>
+
/* We need to include this first as that "depends" on the compiler's setting
* of __LP64__. So before we define __LP64__ so it can be used. */
#include <sys/cdefs.h>
diff --git a/src/stdafx.h b/src/stdafx.h
index ca6504091..bbb25639e 100644
--- a/src/stdafx.h
+++ b/src/stdafx.h
@@ -22,11 +22,10 @@
/* It seems that we need to include stdint.h before anything else
* We need INT64_MAX, which for most systems comes from stdint.h. However, MSVC
* does not have stdint.h and apparently neither does MorphOS, so define
- * INT64_MAX for them ourselves.
- * Sometimes OSX headers manages to include stdint.h before this but without
- * __STDC_LIMIT_MACROS so it will be without INT64_*. We need to define those
- * too if this is the case. */
-#if !defined(_MSC_VER) && !defined( __MORPHOS__) && !defined(_STDINT_H_)
+ * INT64_MAX for them ourselves. */
+#if defined(__APPLE__)
+ /* Already done in osx_stdafx.h */
+#elif !defined(_MSC_VER) && !defined( __MORPHOS__) && !defined(_STDINT_H_)
#if defined(SUNOS)
/* SunOS/Solaris does not have stdint.h, but inttypes.h defines everything
* stdint.h defines and we need. */