Blame m4/intlmacosx.m4

Packit Service 4684c1
# intlmacosx.m4 serial 8 (gettext-0.20.2)
Packit Service 4684c1
dnl Copyright (C) 2004-2014, 2016, 2019-2020 Free Software Foundation, Inc.
Packit Service 4684c1
dnl This file is free software; the Free Software Foundation
Packit Service 4684c1
dnl gives unlimited permission to copy and/or distribute it,
Packit Service 4684c1
dnl with or without modifications, as long as this notice is preserved.
Packit Service 4684c1
dnl
Packit Service 4684c1
dnl This file can be used in projects which are not available under
Packit Service 4684c1
dnl the GNU General Public License or the GNU Lesser General Public
Packit Service 4684c1
dnl License but which still want to provide support for the GNU gettext
Packit Service 4684c1
dnl functionality.
Packit Service 4684c1
dnl Please note that the actual code of the GNU gettext library is covered
Packit Service 4684c1
dnl by the GNU Lesser General Public License, and the rest of the GNU
Packit Service 4684c1
dnl gettext package is covered by the GNU General Public License.
Packit Service 4684c1
dnl They are *not* in the public domain.
Packit Service 4684c1
Packit Service 4684c1
dnl Checks for special options needed on Mac OS X.
Packit Service 4684c1
dnl Defines INTL_MACOSX_LIBS.
Packit Service 4684c1
AC_DEFUN([gt_INTL_MACOSX],
Packit Service 4684c1
[
Packit Service 4684c1
  dnl Check for API introduced in Mac OS X 10.4.
Packit Service 4684c1
  AC_CACHE_CHECK([for CFPreferencesCopyAppValue],
Packit Service 4684c1
    [gt_cv_func_CFPreferencesCopyAppValue],
Packit Service 4684c1
    [gt_save_LIBS="$LIBS"
Packit Service 4684c1
     LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation"
Packit Service 4684c1
     AC_LINK_IFELSE(
Packit Service 4684c1
       [AC_LANG_PROGRAM(
Packit Service 4684c1
          [[#include <CoreFoundation/CFPreferences.h>]],
Packit Service 4684c1
          [[CFPreferencesCopyAppValue(NULL, NULL)]])],
Packit Service 4684c1
       [gt_cv_func_CFPreferencesCopyAppValue=yes],
Packit Service 4684c1
       [gt_cv_func_CFPreferencesCopyAppValue=no])
Packit Service 4684c1
     LIBS="$gt_save_LIBS"])
Packit Service 4684c1
  if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then
Packit Service 4684c1
    AC_DEFINE([HAVE_CFPREFERENCESCOPYAPPVALUE], [1],
Packit Service 4684c1
      [Define to 1 if you have the Mac OS X function CFPreferencesCopyAppValue in the CoreFoundation framework.])
Packit Service 4684c1
  fi
Packit Service 4684c1
  dnl Don't check for the API introduced in Mac OS X 10.5, CFLocaleCopyCurrent,
Packit Service 4684c1
  dnl because in macOS 10.13.4 it has the following behaviour:
Packit Service 4684c1
  dnl When two or more languages are specified in the
Packit Service 4684c1
  dnl "System Preferences > Language & Region > Preferred Languages" panel,
Packit Service 4684c1
  dnl it returns en_CC where CC is the territory (even when English is not among
Packit Service 4684c1
  dnl the preferred languages!).  What we want instead is what
Packit Service 4684c1
  dnl CFLocaleCopyCurrent returned in earlier macOS releases and what
Packit Service 4684c1
  dnl CFPreferencesCopyAppValue still returns, namely ll_CC where ll is the
Packit Service 4684c1
  dnl first among the preferred languages and CC is the territory.
Packit Service 4684c1
  AC_CACHE_CHECK([for CFLocaleCopyPreferredLanguages], [gt_cv_func_CFLocaleCopyPreferredLanguages],
Packit Service 4684c1
    [gt_save_LIBS="$LIBS"
Packit Service 4684c1
     LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation"
Packit Service 4684c1
     AC_LINK_IFELSE(
Packit Service 4684c1
       [AC_LANG_PROGRAM(
Packit Service 4684c1
          [[#include <CoreFoundation/CFLocale.h>]],
Packit Service 4684c1
          [[CFLocaleCopyPreferredLanguages();]])],
Packit Service 4684c1
       [gt_cv_func_CFLocaleCopyPreferredLanguages=yes],
Packit Service 4684c1
       [gt_cv_func_CFLocaleCopyPreferredLanguages=no])
Packit Service 4684c1
     LIBS="$gt_save_LIBS"])
Packit Service 4684c1
  if test $gt_cv_func_CFLocaleCopyPreferredLanguages = yes; then
Packit Service 4684c1
    AC_DEFINE([HAVE_CFLOCALECOPYPREFERREDLANGUAGES], [1],
Packit Service 4684c1
      [Define to 1 if you have the Mac OS X function CFLocaleCopyPreferredLanguages in the CoreFoundation framework.])
Packit Service 4684c1
  fi
Packit Service 4684c1
  INTL_MACOSX_LIBS=
Packit Service 4684c1
  if test $gt_cv_func_CFPreferencesCopyAppValue = yes \
Packit Service 4684c1
     || test $gt_cv_func_CFLocaleCopyPreferredLanguages = yes; then
Packit Service 4684c1
    INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation"
Packit Service 4684c1
  fi
Packit Service 4684c1
  AC_SUBST([INTL_MACOSX_LIBS])
Packit Service 4684c1
])