RFA: fix locale configure checks

Tom Tromey
2008-08-21T20:45:29Z

Today while exploring the charset code I happened to notice that gdb
never calls setlocale.

The code is there, but configure never does the checks that might
define HAVE_LOCALE_H, HAVE_SETLOCALE, or HAVE_LC_MESSAGES.

This patch fixes the problem. I just copied what GCC does here.

Built & regtested on x86-64. I also examined the config.h on my x86
box by hand.

Ok?

Tom

:ADDPATCH build:

2008-08-21 Tom Tromey <tromey@redhat.com>

* config.in, configure: Rebuild.
* configure.ac: Check for locale.h, setlocale. Call
AM_LC_MESSAGES.
* acinclude.m4: Include lcmessage.m4.

diff --git a/gdb/acinclude.m4 b/gdb/acinclude.m4
index 4e8f590..2a951e2 100644
--- a/gdb/acinclude.m4
+++ b/gdb/acinclude.m4
@@ -26,6 +26,9 @@ sinclude(../config/tcl.m4)
dnl For dependency tracking macros.
sinclude([../config/depstand.m4])

+dnl For AM_LC_MESSAGES
+sinclude([../config/lcmessage.m4])
+
#
# Sometimes the native compiler is a bogus stub for gcc or /usr/ucb/cc. This
# makes configure think it's cross compiling. If --target wasn't used, then
diff --git a/gdb/configure.ac b/gdb/configure.ac
index 680fba0..2d2c955 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -647,6 +647,7 @@ AC_CHECK_HEADERS(link.h, [], [],
# include <nlist.h>
#endif
])
+AC_CHECK_HEADERS(locale.h)
AC_CHECK_HEADERS(machine/reg.h)
AC_CHECK_HEADERS(poll.h sys/poll.h)
AC_CHECK_HEADERS(proc_service.h thread_db.h gnu/libc-version.h)
@@ -713,6 +714,7 @@ AC_CHECK_HEADERS(ctype.h time.h)
AC_CHECK_DECLS([free, malloc, realloc])
AC_CHECK_DECLS([strerror, strstr])
AC_CHECK_DECLS([getopt, snprintf, vsnprintf])
+AM_LC_MESSAGES

# ----------------------- #
# Checks for structures. #
@@ -753,6 +755,7 @@ AC_CHECK_FUNCS(poll)
AC_CHECK_FUNCS(pread64)
AC_CHECK_FUNCS(sbrk)
AC_CHECK_FUNCS(setpgid setpgrp setsid)
+AC_CHECK_FUNCS(setlocale)
AC_CHECK_FUNCS(sigaction sigprocmask sigsetmask)
AC_CHECK_FUNCS(socketpair)
AC_CHECK_FUNCS(syscall)