Blame m4/intlmacosx.m4

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