summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt2
-rw-r--r--borlandc/config.h7
-rw-r--r--configh.cmake.in7
-rw-r--r--configh.in7
-rw-r--r--configure.in3
-rw-r--r--makefiles/config.mingw7
-rw-r--r--makefiles/config.os2x7
-rw-r--r--src/Fl_Input.cxx12
-rw-r--r--vcnet/config.h7
-rw-r--r--visualc/config.h7
-rw-r--r--watcom/config.h7
11 files changed, 72 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c7fc4325f..5d2455598 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -85,6 +85,7 @@ CHECK_INCLUDE_FILE_CONCAT("OpenGL/glu.h" HAVE_OPENGL_GLU_H)
CHECK_INCLUDE_FILE_CONCAT("dirent.h" HAVE_DIRENT_H)
CHECK_INCLUDE_FILE_CONCAT("stdio.h" HAVE_STDIO_H)
CHECK_INCLUDE_FILE_CONCAT("strings.h" HAVE_STRINGS_H)
+CHECK_INCLUDE_FILE_CONCAT("locale.h" HAVE_LOCALE_H)
CHECK_INCLUDE_FILE_CONCAT("sys/dir.h" HAVE_SYS_DIR_H)
CHECK_INCLUDE_FILE_CONCAT("sys/ndir.h" HAVE_SYS_NDIR_H)
CHECK_INCLUDE_FILE_CONCAT("sys/select.h" HAVE_SYS_SELECT_H)
@@ -105,6 +106,7 @@ CHECK_SYMBOL_EXISTS(strlcpy "${PROJECT_INCLUDES}" HAVE_STRLCPY)
CHECK_SYMBOL_EXISTS(vsnprintf "${PROJECT_INCLUDES}" HAVE_VSNPRINTF)
CHECK_SYMBOL_EXISTS(snprintf "${PROJECT_INCLUDES}" HAVE_SNPRINTF)
CHECK_SYMBOL_EXISTS(scandir "${PROJECT_INCLUDES}" HAVE_SCANDIR)
+CHECK_SYMBOL_EXISTS(localeconv "${PROJECT_INCLUDES}" HAVE_LOCALECONV)
INCLUDE(CheckTypeSize)
diff --git a/borlandc/config.h b/borlandc/config.h
index 8add48878..607bba8ce 100644
--- a/borlandc/config.h
+++ b/borlandc/config.h
@@ -163,6 +163,13 @@
/* #undef HAVE_STRLCPY */
/*
+ * Do we have POSIX locale support?
+ */
+
+#define HAVE_LOCALE_H 1
+#define HAVE_LOCALECONV 1
+
+/*
* HAVE_SYS_SELECT_H:
*
* Whether or not select() call has its own header file.
diff --git a/configh.cmake.in b/configh.cmake.in
index d230df5f3..ee5b4605e 100644
--- a/configh.cmake.in
+++ b/configh.cmake.in
@@ -190,6 +190,13 @@
#cmakedefine HAVE_STRLCPY @HAVE_STRLCPY@
/*
+ * 'locale' functions
+ */
+
+#cmakedefine HAVE_LOCALE_H @HAVE_LOCALE_H@
+#cmakedefine HAVE_LOCALECONV @HAVE_LOCALECONV@
+
+/*
* HAVE_SYS_SELECT_H:
*
* Whether or not select() call has its own header file.
diff --git a/configh.in b/configh.in
index 4679e45c1..3f8146933 100644
--- a/configh.in
+++ b/configh.in
@@ -190,6 +190,13 @@
#undef HAVE_STRLCPY
/*
+ * Do we have POSIX locale support?
+ */
+
+#undef HAVE_LOCALE_H
+#undef HAVE_LOCALECONV
+
+/*
* HAVE_SYS_SELECT_H:
*
* Whether or not select() call has its own header file.
diff --git a/configure.in b/configure.in
index 7c6aaf855..e1a6cf4e5 100644
--- a/configure.in
+++ b/configure.in
@@ -369,6 +369,9 @@ AC_CHECK_FUNC(snprintf,[
AC_CHECK_HEADER(strings.h, AC_DEFINE(HAVE_STRINGS_H))
AC_CHECK_FUNCS(strcasecmp strlcat strlcpy)
+AC_CHECK_HEADER(locale.h, AC_DEFINE(HAVE_LOCALE_H))
+AC_CHECK_FUNCS(localeconv)
+
dnl FLTK library uses math library functions...
AC_SEARCH_LIBS(pow, m)
diff --git a/makefiles/config.mingw b/makefiles/config.mingw
index 6f8486c25..f6b5b3d1e 100644
--- a/makefiles/config.mingw
+++ b/makefiles/config.mingw
@@ -169,6 +169,13 @@
/* #undef HAVE_STRLCPY */
/*
+ * Do we have POSIX locale support?
+ */
+
+#define HAVE_LOCALE_H 1
+#define HAVE_LOCALECONV 1
+
+/*
* HAVE_SYS_SELECT_H:
*
* Whether or not select() call has its own header file.
diff --git a/makefiles/config.os2x b/makefiles/config.os2x
index 0fc4c52fc..868a428af 100644
--- a/makefiles/config.os2x
+++ b/makefiles/config.os2x
@@ -166,6 +166,13 @@
/* #undef HAVE_STRLCPY*/
/*
+ * Do we have POSIX locale support?
+ */
+
+#define HAVE_LOCALE_H 1
+#define HAVE_LOCALECONV 1
+
+/*
* HAVE_SYS_SELECT_H:
*
* Whether or not select() call has its own header file.
diff --git a/src/Fl_Input.cxx b/src/Fl_Input.cxx
index 93f278bbb..4bf5ee2b5 100644
--- a/src/Fl_Input.cxx
+++ b/src/Fl_Input.cxx
@@ -33,13 +33,17 @@
#include <stdio.h>
#include <stdlib.h>
-#include <locale.h>
#include <FL/Fl.H>
#include <FL/Fl_Input.H>
#include <FL/fl_draw.H>
#include <FL/fl_ask.H>
#include "flstring.h"
+#ifdef HAVE_LOCALE_H
+# include <locale.h>
+#endif
+
+
void Fl_Input::draw() {
if (input_type() == FL_HIDDEN_INPUT) return;
Fl_Boxtype b = box();
@@ -69,8 +73,12 @@ int Fl_Input::shift_up_down_position(int p) {
// into account (for example, continental Europe uses a comma instead
// of a decimal point). For back compatibility reasons, we always
// allow the decimal point.
+#ifdef HAVE_LOCALECONV
static char *standard_fp_chars = ".eE+-";
static char *legal_fp_chars = 0L;
+#else
+static char *legal_fp_chars = ".eE+-";
+#endif
int Fl_Input::handle_key() {
@@ -86,6 +94,7 @@ int Fl_Input::handle_key() {
Fl::compose_reset(); // ignore any foreign letters...
// initialize the list of legal characters inside a floating point number
+#ifdef HAVE_LOCALECONV
if (!legal_fp_chars) {
int len = strlen(standard_fp_chars);
struct lconv *lc = localeconv();
@@ -106,6 +115,7 @@ int Fl_Input::handle_key() {
if (lc->negative_sign) strcat(legal_fp_chars, lc->negative_sign);
}
}
+#endif
// This is complex to allow "0xff12" hex to be typed:
if (!position() && (ascii == '+' || ascii == '-') ||
diff --git a/vcnet/config.h b/vcnet/config.h
index 05867eaf0..e5a25f105 100644
--- a/vcnet/config.h
+++ b/vcnet/config.h
@@ -153,6 +153,13 @@
/*#undef HAVE_STRLCPY*/
/*
+ * Do we have POSIX locale support?
+ */
+
+#define HAVE_LOCALE_H 1
+#define HAVE_LOCALECONV 1
+
+/*
* HAVE_POLL:
*
* Use poll() if we don't have select().
diff --git a/visualc/config.h b/visualc/config.h
index 05867eaf0..e5a25f105 100644
--- a/visualc/config.h
+++ b/visualc/config.h
@@ -153,6 +153,13 @@
/*#undef HAVE_STRLCPY*/
/*
+ * Do we have POSIX locale support?
+ */
+
+#define HAVE_LOCALE_H 1
+#define HAVE_LOCALECONV 1
+
+/*
* HAVE_POLL:
*
* Use poll() if we don't have select().
diff --git a/watcom/config.h b/watcom/config.h
index 7aebfbe85..0952b5073 100644
--- a/watcom/config.h
+++ b/watcom/config.h
@@ -163,6 +163,13 @@
/* #undef HAVE_STRLCPY */
/*
+ * Do we have POSIX locale support?
+ */
+
+#define HAVE_LOCALE_H 1
+#define HAVE_LOCALECONV 1
+
+/*
* HAVE_SYS_SELECT_H:
*
* Whether or not select() call has its own header file.