intlmacosx.m4 3.2 KB

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