[glib] Be more precise about Carbon v. Cocoa.



commit 69d929e67fd44d9a20c64064cc7e06f5d3cead82
Author: William Hua <william attente ca>
Date:   Wed Apr 11 23:25:09 2012 -0400

    Be more precise about Carbon v. Cocoa.

 configure.ac                   |   14 ++++++++++++++
 gio/Makefile.am                |    7 ++-----
 gio/giomodule.c                |    2 +-
 gio/gsettingsbackendinternal.h |    2 +-
 4 files changed, 18 insertions(+), 7 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index cf24f39..5e0cf62 100644
--- a/configure.ac
+++ b/configure.ac
@@ -175,11 +175,20 @@ AC_TRY_CPP([
 
 AC_MSG_RESULT([$glib_have_carbon])
 
+glib_have_cocoa=no
+AC_MSG_CHECKING([for Mac OS X Cocoa support])
+AC_TRY_CPP([
+#include <Foundation/Foundation.h>
+], glib_have_cocoa=yes)
+
+AC_MSG_RESULT([$glib_have_cocoa])
+
 AM_CONDITIONAL(OS_WIN32, [test "$glib_native_win32" = "yes"])
 AM_CONDITIONAL(OS_WIN32_X64, [test "$LIB_EXE_MACHINE_FLAG" = "X64"])
 AM_CONDITIONAL(OS_UNIX, [test "$glib_native_win32" != "yes"])
 AM_CONDITIONAL(OS_LINUX, [test "$glib_os_linux" = "yes"])
 AM_CONDITIONAL(OS_CARBON, [test "$glib_have_carbon" = "yes"])
+AM_CONDITIONAL(OS_COCOA, [test "$glib_have_cocoa" = "yes"])
 
 if test "$glib_native_win32" = "yes"; then
   AC_CHECK_TOOL(WINDRES, windres, no)
@@ -210,6 +219,11 @@ if test "x$glib_have_carbon" = "xyes"; then
   LDFLAGS="$LDFLAGS -framework Carbon"
 fi
 
+if test "x$glib_have_cocoa" = "xyes"; then
+  AC_DEFINE(HAVE_COCOA, 1, [define to 1 if Cocoa is available])
+  LDFLAGS="$LDFLAGS -framework Foundation"
+fi
+
 gl_GLIBC21
 if test "x$GLIBC21" = "xyes"; then
   AC_DEFINE([_GNU_SOURCE], 1, [Make all glibc extensions visible])
diff --git a/gio/Makefile.am b/gio/Makefile.am
index 106a183..b0ae4de 100644
--- a/gio/Makefile.am
+++ b/gio/Makefile.am
@@ -124,9 +124,7 @@ settings_sources += \
 	gregistrysettingsbackend.c
 endif
 
-if OS_CARBON
-AM_CPPFLAGS += -DG_OS_CARBON
-
+if OS_COCOA
 settings_sources += \
 	gnextstepsettingsbackend.c
 endif
@@ -488,8 +486,7 @@ libgio_2_0_la_LDFLAGS = $(GLIB_LINK_FLAGS) \
 	-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
 	-export-dynamic $(no_undefined) $(export_symbols)
 
-# This condition is misnamed.  It's really checking for Cocoa, not Carbon
-if OS_CARBON
+if OS_COCOA
 # This is dumb.  The ObjC source file should be properly named .m
 libgio_2_0_la_CFLAGS = -xobjective-c
 libgio_2_0_la_LDFLAGS += -framework Foundation
diff --git a/gio/giomodule.c b/gio/giomodule.c
index 4afdedd..480f2f0 100644
--- a/gio/giomodule.c
+++ b/gio/giomodule.c
@@ -918,7 +918,7 @@ _g_io_modules_ensure_loaded (void)
       g_win32_directory_monitor_get_type ();
       g_registry_backend_get_type ();
 #endif
-#ifdef G_OS_CARBON
+#ifdef HAVE_CARBON
       g_nextstep_settings_backend_get_type ();
 #endif
 #ifdef G_OS_UNIX
diff --git a/gio/gsettingsbackendinternal.h b/gio/gsettingsbackendinternal.h
index 5837dcc..368c54b 100644
--- a/gio/gsettingsbackendinternal.h
+++ b/gio/gsettingsbackendinternal.h
@@ -100,7 +100,7 @@ GType                   g_null_settings_backend_get_type                (void);
 G_GNUC_INTERNAL
 GType                   g_memory_settings_backend_get_type              (void);
 
-#ifdef G_OS_CARBON
+#ifdef HAVE_COCOA
 G_GNUC_INTERNAL
 GType                   g_nextstep_settings_backend_get_type            (void);
 #endif



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]