summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Huddleston <jeremyhu@freedesktop.org>2008-04-25 19:00:23 -0700
committerJeremy Huddleston <jeremyhu@freedesktop.org>2008-04-25 19:00:23 -0700
commit280774466dc9f57b4b46c618345f7938290dbb2c (patch)
treed0a5d2fe26d96a1b5f185dee7cc67e952b52450b
parent0806ae2ecfdcb4ad5f3b7a66dcc9bc5d29d72649 (diff)
Apple: Added some OSX version protection, so this will still compile on Tiger and below.
-rw-r--r--Makefile.am2
-rw-r--r--configure.ac11
-rw-r--r--xinit.c10
3 files changed, 12 insertions, 11 deletions
diff --git a/Makefile.am b/Makefile.am
index d514251..c778487 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -27,7 +27,7 @@ bin_SCRIPTS = startx
xinit_CFLAGS = $(XINIT_CFLAGS) -DXINITDIR=\"$(XINITDIR)\" -DBINDIR=\"$(bindir)\"
xinit_LDADD = $(XINIT_LIBS)
-if APPLE
+if APPLE_LEOPARD
xinit_LDFLAGS = -framework CoreServices
endif
diff --git a/configure.ac b/configure.ac
index f33fd13..b476c1c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -109,18 +109,15 @@ if test "x$LAUNCHD" = "xyes" ; then
AC_DEFINE(HAVE_LAUNCHD, 1, [launchd support available])
case $host_os in
- darwin*)
- # For now, this is how we find X11.app on OS-X...
- # A future version of launchd should let us do this cleaner
- #XSERVER=\'\`'$(libexecdir)/x11-exec'\`\'
- AM_CONDITIONAL(APPLE, true)
+ darwin9*|darwin1*)
+ AM_CONDITIONAL(APPLE_LEOPARD, true)
;;
*)
- AM_CONDITIONAL(APPLE, false)
+ AM_CONDITIONAL(APPLE_LEOPARD, false)
;;
esac
else
- AM_CONDITIONAL(APPLE,false)
+ AM_CONDITIONAL(APPLE_LEOPARD,false)
launchagentsdir=""
launchdaemonsdir=""
fi
diff --git a/xinit.c b/xinit.c
index 3de74c3..6940c89 100644
--- a/xinit.c
+++ b/xinit.c
@@ -40,6 +40,10 @@ in this Software without prior written authorization from The Open Group.
#include <stdint.h>
#ifdef __APPLE__
+#include <AvailabilityMacros.h>
+#endif
+
+#if defined(__APPLE__) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
#include <CoreServices/CoreServices.h>
#define kX11AppBundleId "org.x.X11"
#define kX11AppBundlePath "/Contents/MacOS/X11"
@@ -176,7 +180,7 @@ static char **client = clientargv + 2; /* make sure room for sh .xinitrc args *
static char *displayNum = NULL;
static char *program = NULL;
static Display *xd = NULL; /* server connection */
-#ifdef __APPLE__
+#if defined(__APPLE__) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
static char x11_path[PATH_MAX + 1];
#endif
#ifndef SYSV
@@ -228,7 +232,7 @@ sigUsr1(int sig)
#endif
}
-#ifdef __APPLE__
+#if defined(__APPLE__) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
static void set_x11_path() {
CFURLRef appURL = NULL;
OSStatus osstatus = LSFindApplicationForInfo(kLSUnknownCreator, CFSTR(kX11AppBundleId), nil, nil, &appURL);
@@ -266,7 +270,7 @@ static void
Execute(char **vec, /* has room from up above */
char **envp)
{
-#ifdef __APPLE__
+#if defined(__APPLE__) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
/* This is ugly, but currently, we need to trick OS-X into thinking X is in
* the X11.app bundle. Hopefully UI, icons, etc will eventually be set
* by Xquartz, but this is how we're doing it for now. -JH