summaryrefslogtreecommitdiff
path: root/m4macros
diff options
context:
space:
mode:
authorPhilip Withnall <philip.withnall@collabora.co.uk>2014-03-07 12:42:28 +0000
committerPhilip Withnall <withnall@endlessm.com>2017-04-03 10:32:55 +0100
commit3a926db37b3925464d7b38febf56a23612e5d1ce (patch)
treeabd8c52309717cba197f880ce96d42ee2ddc148c /m4macros
parent4c91b7f9358b335606ef0d3c680dc27141991946 (diff)
downloadglib-3a926db37b3925464d7b38febf56a23612e5d1ce.tar.gz
build: Include gettext libraries for static compilation on Mac OS X
When compiling statically against the system-provided gettext on Mac OS X, GLib needs to be linked against CoreFramework, which provides some functions used by gettext. Fix this by including the necessary macro magic from upstream gettext. https://bugzilla.gnome.org/show_bug.cgi?id=725894
Diffstat (limited to 'm4macros')
-rw-r--r--m4macros/glib-gettext.m449
1 files changed, 48 insertions, 1 deletions
diff --git a/m4macros/glib-gettext.m4 b/m4macros/glib-gettext.m4
index 155b1d83d..dc17a98db 100644
--- a/m4macros/glib-gettext.m4
+++ b/m4macros/glib-gettext.m4
@@ -97,6 +97,51 @@ fi
AC_SUBST($1)dnl
])
+dnl Checks for special options needed on Mac OS X.
+dnl Defines INTL_MACOSX_LIBS.
+dnl
+dnl Copied from intlmacosx.m4 in gettext, GPL.
+dnl Copyright (C) 2004-2013 Free Software Foundation, Inc.
+glib_DEFUN([glib_gt_INTL_MACOSX],
+[
+ dnl Check for API introduced in Mac OS X 10.2.
+ AC_CACHE_CHECK([for CFPreferencesCopyAppValue],
+ [gt_cv_func_CFPreferencesCopyAppValue],
+ [gt_save_LIBS="$LIBS"
+ LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation"
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <CoreFoundation/CFPreferences.h>]],
+ [[CFPreferencesCopyAppValue(NULL, NULL)]])],
+ [gt_cv_func_CFPreferencesCopyAppValue=yes],
+ [gt_cv_func_CFPreferencesCopyAppValue=no])
+ LIBS="$gt_save_LIBS"])
+ if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then
+ AC_DEFINE([HAVE_CFPREFERENCESCOPYAPPVALUE], [1],
+ [Define to 1 if you have the Mac OS X function CFPreferencesCopyAppValue in the CoreFoundation framework.])
+ fi
+ dnl Check for API introduced in Mac OS X 10.3.
+ AC_CACHE_CHECK([for CFLocaleCopyCurrent], [gt_cv_func_CFLocaleCopyCurrent],
+ [gt_save_LIBS="$LIBS"
+ LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation"
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <CoreFoundation/CFLocale.h>]],
+ [[CFLocaleCopyCurrent();]])],
+ [gt_cv_func_CFLocaleCopyCurrent=yes],
+ [gt_cv_func_CFLocaleCopyCurrent=no])
+ LIBS="$gt_save_LIBS"])
+ if test $gt_cv_func_CFLocaleCopyCurrent = yes; then
+ AC_DEFINE([HAVE_CFLOCALECOPYCURRENT], [1],
+ [Define to 1 if you have the Mac OS X function CFLocaleCopyCurrent in the CoreFoundation framework.])
+ fi
+ INTL_MACOSX_LIBS=
+ if test $gt_cv_func_CFPreferencesCopyAppValue = yes || test $gt_cv_func_CFLocaleCopyCurrent = yes; then
+ INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation"
+ fi
+ AC_SUBST([INTL_MACOSX_LIBS])
+])
+
# GLIB_WITH_NLS
#-----------------
glib_DEFUN([GLIB_WITH_NLS],
@@ -110,6 +155,8 @@ glib_DEFUN([GLIB_WITH_NLS],
XGETTEXT=:
INTLLIBS=
+ glib_gt_INTL_MACOSX
+
AC_CHECK_HEADER(libintl.h,
[gt_cv_func_dgettext_libintl="no"
libintl_extra_libs=""
@@ -193,7 +240,7 @@ glib_DEFUN([GLIB_WITH_NLS],
fi
if test "$gt_cv_func_dgettext_libintl" = "yes"; then
- INTLLIBS="-lintl $libintl_extra_libs"
+ INTLLIBS="-lintl $libintl_extra_libs $INTL_MACOSX_LIBS"
fi
if test "$gt_cv_have_gettext" = "yes"; then