From 8d037c678d8d3d0c0e4e1ddb22e47306567ed88a Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Thu, 20 Mar 2014 12:32:36 +0000 Subject: [PATCH] build: Include Cocoa/Carbon in Libs.private if targetting Mac OS X This allows static linking against GIO on OS X, which would previously fail due to unresolved symbols from the above two frameworks. https://bugzilla.gnome.org/show_bug.cgi?id=668152 --- configure.ac | 14 +++++++++----- gio-2.0.pc.in | 2 +- glib-2.0.pc.in | 2 +- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/configure.ac b/configure.ac index 1ede00f..b94e6f3 100644 --- a/configure.ac +++ b/configure.ac @@ -213,13 +213,17 @@ AM_CONDITIONAL(MS_LIB_AVAILABLE, [test x$ms_librarian = xyes]) AS_IF([test "x$glib_have_carbon" = "xyes"], [ AC_DEFINE(HAVE_CARBON, 1, [define to 1 if Carbon is available]) - LDFLAGS="$LDFLAGS -Wl,-framework,Carbon" -]) + CARBON_LIBS="-Wl,-framework,Carbon" + LDFLAGS="$LDFLAGS $CARBON_LIBS" +], [CARBON_LIBS=""]) -if test "x$glib_have_cocoa" = "xyes"; then +AS_IF([test "x$glib_have_cocoa" = "xyes"], [ AC_DEFINE(HAVE_COCOA, 1, [define to 1 if Cocoa is available]) - LDFLAGS="$LDFLAGS -Wl,-framework,Foundation" -fi + COCOA_LIBS="-Wl,-framework,Foundation" + LDFLAGS="$LDFLAGS $COCOA_LIBS" +], [COCOA_LIBS=""]) + +AC_SUBST([COCOA_LIBS]) dnl declare --enable-* args and collect ac_help strings AC_ARG_ENABLE(debug, diff --git a/gio-2.0.pc.in b/gio-2.0.pc.in index a61eaaf..899af0c 100644 --- a/gio-2.0.pc.in +++ b/gio-2.0.pc.in @@ -14,5 +14,5 @@ Version: @VERSION@ Requires: glib-2.0 gobject-2.0 Requires.private: gmodule-no-export-2.0 Libs: -L${libdir} -lgio-2.0 -Libs.private: @ZLIB_LIBS@ @NETWORK_LIBS@ @SELINUX_LIBS@ +Libs.private: @ZLIB_LIBS@ @NETWORK_LIBS@ @SELINUX_LIBS@ @COCOA_LIBS@ @CARBON_LIBS@ Cflags: diff --git a/glib-2.0.pc.in b/glib-2.0.pc.in index 4a8898e..275fc01 100644 --- a/glib-2.0.pc.in +++ b/glib-2.0.pc.in @@ -12,5 +12,5 @@ Description: C Utility Library Version: @VERSION@ Requires.private: @PCRE_REQUIRES@ Libs: -L${libdir} -lglib-2.0 @INTLLIBS@ -Libs.private: @G_THREAD_LIBS@ @G_LIBS_EXTRA@ @PCRE_LIBS@ @INTLLIBS@ @ICONV_LIBS@ +Libs.private: @G_THREAD_LIBS@ @G_LIBS_EXTRA@ @PCRE_LIBS@ @INTLLIBS@ @ICONV_LIBS@ @CARBON_LIBS@ @COCOA_LIBS@ Cflags: -I${includedir}/glib-2.0 -I${libdir}/glib-2.0/include @GLIB_EXTRA_CFLAGS@ -- 2.7.4