blob: ebd9937c1aaabb4756fda8aa5eb80717013e1139 [file] [log] [blame]
Andrew Geissler4ed12e12020-06-05 18:00:41 -05001# intlmacosx.m4 serial 8 (gettext-0.20.2)
2dnl Copyright (C) 2004-2014, 2016, 2019-2020 Free Software Foundation, Inc.
Andrew Geissler82c905d2020-04-13 13:39:40 -05003dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6dnl
7dnl This file can be used in projects which are not available under
Andrew Geissler4ed12e12020-06-05 18:00:41 -05008dnl the GNU General Public License or the GNU Lesser General Public
Andrew Geissler82c905d2020-04-13 13:39:40 -05009dnl License but which still want to provide support for the GNU gettext
10dnl functionality.
11dnl Please note that the actual code of the GNU gettext library is covered
Andrew Geissler4ed12e12020-06-05 18:00:41 -050012dnl by the GNU Lesser General Public License, and the rest of the GNU
Andrew Geissler82c905d2020-04-13 13:39:40 -050013dnl gettext package is covered by the GNU General Public License.
14dnl They are *not* in the public domain.
15
16dnl Checks for special options needed on Mac OS X.
17dnl Defines INTL_MACOSX_LIBS.
18AC_DEFUN([gt_INTL_MACOSX],
19[
20 dnl Check for API introduced in Mac OS X 10.4.
21 AC_CACHE_CHECK([for CFPreferencesCopyAppValue],
22 [gt_cv_func_CFPreferencesCopyAppValue],
23 [gt_save_LIBS="$LIBS"
24 LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation"
25 AC_LINK_IFELSE(
26 [AC_LANG_PROGRAM(
27 [[#include <CoreFoundation/CFPreferences.h>]],
28 [[CFPreferencesCopyAppValue(NULL, NULL)]])],
29 [gt_cv_func_CFPreferencesCopyAppValue=yes],
30 [gt_cv_func_CFPreferencesCopyAppValue=no])
31 LIBS="$gt_save_LIBS"])
32 if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then
33 AC_DEFINE([HAVE_CFPREFERENCESCOPYAPPVALUE], [1],
34 [Define to 1 if you have the Mac OS X function CFPreferencesCopyAppValue in the CoreFoundation framework.])
35 fi
Andrew Geissler4ed12e12020-06-05 18:00:41 -050036 dnl Don't check for the API introduced in Mac OS X 10.5, CFLocaleCopyCurrent,
37 dnl because in macOS 10.13.4 it has the following behaviour:
38 dnl When two or more languages are specified in the
39 dnl "System Preferences > Language & Region > Preferred Languages" panel,
40 dnl it returns en_CC where CC is the territory (even when English is not among
41 dnl the preferred languages!). What we want instead is what
42 dnl CFLocaleCopyCurrent returned in earlier macOS releases and what
43 dnl CFPreferencesCopyAppValue still returns, namely ll_CC where ll is the
44 dnl first among the preferred languages and CC is the territory.
Andrew Geissler82c905d2020-04-13 13:39:40 -050045 AC_CACHE_CHECK([for CFLocaleCopyPreferredLanguages], [gt_cv_func_CFLocaleCopyPreferredLanguages],
46 [gt_save_LIBS="$LIBS"
47 LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation"
48 AC_LINK_IFELSE(
49 [AC_LANG_PROGRAM(
50 [[#include <CoreFoundation/CFLocale.h>]],
51 [[CFLocaleCopyPreferredLanguages();]])],
52 [gt_cv_func_CFLocaleCopyPreferredLanguages=yes],
53 [gt_cv_func_CFLocaleCopyPreferredLanguages=no])
54 LIBS="$gt_save_LIBS"])
55 if test $gt_cv_func_CFLocaleCopyPreferredLanguages = yes; then
56 AC_DEFINE([HAVE_CFLOCALECOPYPREFERREDLANGUAGES], [1],
57 [Define to 1 if you have the Mac OS X function CFLocaleCopyPreferredLanguages in the CoreFoundation framework.])
58 fi
59 INTL_MACOSX_LIBS=
60 if test $gt_cv_func_CFPreferencesCopyAppValue = yes \
Andrew Geissler82c905d2020-04-13 13:39:40 -050061 || test $gt_cv_func_CFLocaleCopyPreferredLanguages = yes; then
62 INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation"
63 fi
64 AC_SUBST([INTL_MACOSX_LIBS])
65])