[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[patches] Fix cross-localedef build



I've applied this patch to fix the build of cross-localedef after recent 
libc changes.  -DNOT_IN_libc is needed when building cross-localedef for 
use in intl/l10nflist.c and, if building with a host libc that doesn't 
have locale_t and the associated interfaces, appropriate wrappers to 
convert __isalnum_l to plain isalnum (etc.) are also needed.  (At this 
point localedef is running in the C locale for LC_CTYPE and the *_l code 
is always using a locale_t object for the C locale so this does not change 
semantics at all.)

Index: config.h.in
===================================================================
--- config.h.in	(revision 15408)
+++ config.h.in	(working copy)
@@ -57,6 +57,9 @@
 /* Define to 1 if you have the `posix4' library (-lposix4). */
 #undef HAVE_LIBPOSIX4
 
+/* Define if you have the locale_t type */
+#undef HAVE_LOCALE_T
+
 /* Define if you have the lseek64() function */
 #undef HAVE_LSEEK64
 
Index: configure
===================================================================
--- configure	(revision 15408)
+++ configure	(working copy)
@@ -4339,6 +4339,110 @@
 
 fi
 
+{ $as_echo "$as_me:$LINENO: checking for locale_t" >&5
+$as_echo_n "checking for locale_t... " >&6; }
+if test "${ac_cv_type_locale_t+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  ac_cv_type_locale_t=no
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <locale.h>
+
+int
+main ()
+{
+if (sizeof (locale_t))
+       return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <locale.h>
+
+int
+main ()
+{
+if (sizeof ((locale_t)))
+	  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  :
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_type_locale_t=yes
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_locale_t" >&5
+$as_echo "$ac_cv_type_locale_t" >&6; }
+if test "x$ac_cv_type_locale_t" = x""yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_LOCALE_T 1
+_ACEOF
+
+fi
+
 { $as_echo "$as_me:$LINENO: checking for __compar_fn_t" >&5
 $as_echo_n "checking for __compar_fn_t... " >&6; }
 if test "${ac_cv_type___compar_fn_t+set}" = set; then
Index: Makefile.in
===================================================================
--- Makefile.in	(revision 15408)
+++ Makefile.in	(working copy)
@@ -25,10 +25,11 @@
 		  -DLOCALE_ALIAS_PATH='"$(msgcatdir)"' \
 		  -DCHARMAP_PATH='"$(i18ndir)/charmaps"' \
 		  -DREPERTOIREMAP_PATH='"$(i18ndir)/repertoiremaps"' \
-		  -DLOCSRCDIR='"$(i18ndir)/locales"'
+		  -DLOCSRCDIR='"$(i18ndir)/locales"' \
+		  -DNOT_IN_libc
 INCLUDES	= -Iglibc/locale/programs \
+		  -I$(srcdir)/include \
 		  -Iglibc/locale \
-		  -I$(srcdir)/include \
 		  -I$(srcdir) \
 		  -I$(objdir) \
 		  -include $(srcdir)/include/always.h
Index: include/locale.h
===================================================================
--- include/locale.h	(revision 0)
+++ include/locale.h	(revision 0)
@@ -0,0 +1,9 @@
+#include_next <locale.h>
+
+#ifndef HAVE_LOCALE_T
+#ifndef DUMMY_LOCALE_T
+#define DUMMY_LOCALE_T 1
+typedef int locale_t;
+#define newlocale(a, b, c) 0
+#endif
+#endif
Index: include/ctype.h
===================================================================
--- include/ctype.h	(revision 15408)
+++ include/ctype.h	(working copy)
@@ -19,3 +19,10 @@
 #  define _ISbit(bit)	((bit) < 8 ? ((1 << (bit)) << 8) : ((1 << (bit)) >> 8))
 # endif
 #endif
+
+#ifndef HAVE_LOCALE_T
+#define __isalnum_l(c, l) isalnum (c)
+#define __isalpha_l(c, l) isalpha (c)
+#define __isdigit_l(c, l) isdigit (c)
+#define __tolower_l(c, l) tolower (c)
+#endif
Index: configure.ac
===================================================================
--- configure.ac	(revision 15408)
+++ configure.ac	(working copy)
@@ -34,6 +34,7 @@
 LOCAL_CHECK_TYPE([off64_t])
 LOCAL_CHECK_TYPE([blksize_t])
 LOCAL_CHECK_TYPE([int_fast32_t])
+LOCAL_CHECK_TYPE([locale_t], [#include <locale.h>])
 LOCAL_CHECK_TYPE([__compar_fn_t], [#include <stdlib.h>])
 LOCAL_CHECK_TYPE([comparison_fn_t], [#include <stdlib.h>])
 LOCAL_CHECK_FUNC([readdir64], [#include <dirent.h>])
Index: ChangeLog.eglibc
===================================================================
--- ChangeLog.eglibc	(revision 15408)
+++ ChangeLog.eglibc	(working copy)
@@ -1,3 +1,13 @@
+2011-09-21  Joseph Myers  <joseph@xxxxxxxxxxxxxxxx>
+
+	* configure.ac: Test for locale_t.
+	* Makefile.in (DEFINES): Add -DNOT_IN_libc.
+	(INCLUDES): Move -I$(srcdir)/include before -Iglibc/locale.
+	* include/locale.h: New.
+	* include/ctype.h (__isalnum_l, __isalpha_l, __isdigit_l)
+	(__tolower_l): Define.
+	* configure, config.h.in: Regenerate.
+
 2010-06-29  Maxim Kuvyrkov  <maxim@xxxxxxxxxxxxxxxx>
 
 	* include/sys/cdefs.h (__REDIRECT_NTH): Define if not present in host

-- 
Joseph S. Myers
joseph@xxxxxxxxxxxxxxxx