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