changeset 18053:cf94cfe2b99c

localename: fix link error on Illumos Illumos defines __sun, but does not have getlocalename_l nor the equivalent. This partially reverts commit 387c214. * m4/localename.m4 (gl_LOCALENAME): Check if getlocalename_l is available, as well as uselocale. * lib/localename.c [HAVE_USELOCALE && __sun]: Don't fallback to use getlocalename_l if it is not available.
author Daiki Ueno <ueno@gnu.org>
date Tue, 07 Jul 2015 15:36:43 +0900
parents 20a313c1ef00
children 7355448d5e2d
files ChangeLog lib/localename.c m4/localename.m4
diffstat 3 files changed, 17 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Jul 07 15:12:52 2015 +0900
+++ b/ChangeLog	Tue Jul 07 15:36:43 2015 +0900
@@ -1,3 +1,13 @@
+2015-07-07  Daiki Ueno  <ueno@gnu.org>
+
+	localename: fix link error on Illumos
+	Illumos defines __sun, but does not have getlocalename_l nor the
+	equivalent.  This partially reverts commit 387c214.
+	* m4/localename.m4 (gl_LOCALENAME): Check if getlocalename_l is
+	available, as well as uselocale.
+	* lib/localename.c [HAVE_USELOCALE && __sun]: Don't fallback to
+	use getlocalename_l if it is not available.
+
 2015-07-07  Daiki Ueno  <ueno@gnu.org>
 
 	unistr/uN-strtok-tests: avoid a trivial leak
--- a/lib/localename.c	Tue Jul 07 15:12:52 2015 +0900
+++ b/lib/localename.c	Tue Jul 07 15:36:43 2015 +0900
@@ -42,7 +42,7 @@
 # if !defined IN_LIBINTL
 #  include "glthread/lock.h"
 # endif
-# if defined __sun
+# if defined __sun && HAVE_GETLOCALENAME_L
 /* Solaris >= 12.  */
 extern char * getlocalename_l(int, locale_t);
 # endif
@@ -2727,7 +2727,7 @@
             return "";
           }
         return querylocale (mask, thread_locale);
-#  elif defined __sun
+#  elif defined __sun && HAVE_GETLOCALENAME_L
         /* Solaris >= 12.  */
         return getlocalename_l (category, thread_locale);
 #  elif defined __ANDROID__
--- a/m4/localename.m4	Tue Jul 07 15:12:52 2015 +0900
+++ b/m4/localename.m4	Tue Jul 07 15:36:43 2015 +0900
@@ -9,4 +9,9 @@
   AC_REQUIRE([gt_LC_MESSAGES])
   AC_REQUIRE([gt_INTL_MACOSX])
   AC_CHECK_FUNCS([setlocale uselocale])
+  dnl Solaris 12 provides getlocalename_l, while Illumos doesn't have
+  dnl it nor the equivalent.
+  if test $ac_cv_func_uselocale = yes; then
+    AC_CHECK_FUNCS([getlocalename_l])
+  fi
 ])