diff options
author | Karl Berry <karl@freefriends.org> | 2017-02-15 22:52:41 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2017-02-15 22:52:41 +0000 |
commit | 70090e3ff9ef701f4712fbf70b7d9d93b6fd23d7 (patch) | |
tree | 9b74c1bf86f887bc3b71df29bc82d9f3d8939444 | |
parent | e1d7bddac7d75ef6bb337f709e67cbd35a6b1e09 (diff) |
locale portability patch from Martin; autoreconf
git-svn-id: svn://tug.org/texlive/trunk@43238 c570f23f-e606-0410-a88d-b1316a301751
12 files changed, 90 insertions, 82 deletions
diff --git a/Build/source/texk/dvisvgm/Makefile.in b/Build/source/texk/dvisvgm/Makefile.in index 4346a957c4c..8fb1099f565 100644 --- a/Build/source/texk/dvisvgm/Makefile.in +++ b/Build/source/texk/dvisvgm/Makefile.in @@ -14,7 +14,7 @@ @SET_MAKE@ -# $Id: Makefile.am 43103 2017-01-31 18:39:23Z karl $ +# $Id: Makefile.am 43208 2017-02-13 17:57:19Z karl $ # Makefile.am for the TeX Live subdirectory texk/dvisvgm/ # # Copyright 2015-2017 Karl Berry <tex-live@tug.org> diff --git a/Build/source/texk/dvisvgm/config.h.in b/Build/source/texk/dvisvgm/config.h.in index b6992e12fa0..7dd62bf7d94 100644 --- a/Build/source/texk/dvisvgm/config.h.in +++ b/Build/source/texk/dvisvgm/config.h.in @@ -165,6 +165,9 @@ /* Define to 1 if you have the <unistd.h> header file. */ #undef HAVE_UNISTD_H +/* Define to 1 if you have the `uselocale' function. */ +#undef HAVE_USELOCALE + /* Define to 1 if you have the `vprintf' function. */ #undef HAVE_VPRINTF diff --git a/Build/source/texk/dvisvgm/configure b/Build/source/texk/dvisvgm/configure index a2717cbd660..6e3ec8be620 100755 --- a/Build/source/texk/dvisvgm/configure +++ b/Build/source/texk/dvisvgm/configure @@ -19325,18 +19325,6 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu -for ac_func in ftime gettimeofday -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - for ac_header in sys/time.h sys/timeb.h xlocale.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` @@ -22596,7 +22584,7 @@ fi done -for ac_func in memset strcasecmp strtol +for ac_func in ftime gettimeofday memset strcasecmp strtol uselocale do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" diff --git a/Build/source/texk/dvisvgm/configure.ac b/Build/source/texk/dvisvgm/configure.ac index 15b103806d2..fadc9ebd05d 100644 --- a/Build/source/texk/dvisvgm/configure.ac +++ b/Build/source/texk/dvisvgm/configure.ac @@ -40,7 +40,6 @@ KPSE_CXX_HACK AC_PROG_RANLIB AC_LANG(C) -AC_CHECK_FUNCS([ftime gettimeofday]) AC_CHECK_HEADERS([sys/time.h sys/timeb.h xlocale.h]) AC_HEADER_TIOCGWINSZ @@ -159,7 +158,7 @@ AC_FUNC_ERROR_AT_LINE AC_FUNC_MALLOC AC_FUNC_STAT AC_FUNC_VPRINTF -AC_CHECK_FUNCS([memset strcasecmp strtol]) +AC_CHECK_FUNCS([ftime gettimeofday memset strcasecmp strtol uselocale]) AC_ARG_ENABLE([woff], [AS_HELP_STRING([--disable-woff], [Disable WOFF support @<:@no@:>@])], diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/Makefile.in b/Build/source/texk/dvisvgm/dvisvgm-src/Makefile.in index 3c2dbd8d16f..1b652420238 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/Makefile.in +++ b/Build/source/texk/dvisvgm/dvisvgm-src/Makefile.in @@ -167,7 +167,7 @@ ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/Makefile.in AUTHORS COPYING INSTALL NEWS \ - README ar-lib ltmain.sh + README DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/Makefile.am b/Build/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/Makefile.am index 2864abed4bf..41ecdbadbdd 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/Makefile.am +++ b/Build/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/Makefile.am @@ -14,6 +14,8 @@ libfontforge_a_SOURCES = \ fontforge/edgelist2.h \ fontforge/encoding.c \ fontforge/encoding.h \ + fontforge/fflocale.c \ + fontforge/fflocale.h \ fontforge/fontforge-config.h \ fontforge/fontforge.h \ fontforge/fontforgevw.h \ diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/Makefile.in b/Build/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/Makefile.in index 6dd50061ca7..ef286840abd 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/Makefile.in +++ b/Build/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/Makefile.in @@ -125,12 +125,12 @@ am_libfontforge_a_OBJECTS = fontforge/alphabet.$(OBJEXT) \ fontforge/asmfpst.$(OBJEXT) fontforge/autohint.$(OBJEXT) \ fontforge/char.$(OBJEXT) fontforge/cjk.$(OBJEXT) \ fontforge/cvundoes.$(OBJEXT) fontforge/dumppfa.$(OBJEXT) \ - fontforge/encoding.$(OBJEXT) fontforge/fvfonts.$(OBJEXT) \ - fontforge/gwwiconv.$(OBJEXT) fontforge/lookups.$(OBJEXT) \ - fontforge/macbinary.$(OBJEXT) fontforge/macenc.$(OBJEXT) \ - fontforge/mathconstants.$(OBJEXT) fontforge/memory.$(OBJEXT) \ - fontforge/mm.$(OBJEXT) fontforge/namelist.$(OBJEXT) \ - fontforge/nouiutil.$(OBJEXT) \ + fontforge/encoding.$(OBJEXT) fontforge/fflocale.$(OBJEXT) \ + fontforge/fvfonts.$(OBJEXT) fontforge/gwwiconv.$(OBJEXT) \ + fontforge/lookups.$(OBJEXT) fontforge/macbinary.$(OBJEXT) \ + fontforge/macenc.$(OBJEXT) fontforge/mathconstants.$(OBJEXT) \ + fontforge/memory.$(OBJEXT) fontforge/mm.$(OBJEXT) \ + fontforge/namelist.$(OBJEXT) fontforge/nouiutil.$(OBJEXT) \ fontforge/nowakowskittfinstr.$(OBJEXT) \ fontforge/parsepfa.$(OBJEXT) fontforge/parsettf.$(OBJEXT) \ fontforge/parsettfatt.$(OBJEXT) fontforge/psread.$(OBJEXT) \ @@ -394,6 +394,8 @@ libfontforge_a_SOURCES = \ fontforge/edgelist2.h \ fontforge/encoding.c \ fontforge/encoding.h \ + fontforge/fflocale.c \ + fontforge/fflocale.h \ fontforge/fontforge-config.h \ fontforge/fontforge.h \ fontforge/fontforgevw.h \ @@ -520,6 +522,8 @@ fontforge/dumppfa.$(OBJEXT): fontforge/$(am__dirstamp) \ fontforge/$(DEPDIR)/$(am__dirstamp) fontforge/encoding.$(OBJEXT): fontforge/$(am__dirstamp) \ fontforge/$(DEPDIR)/$(am__dirstamp) +fontforge/fflocale.$(OBJEXT): fontforge/$(am__dirstamp) \ + fontforge/$(DEPDIR)/$(am__dirstamp) fontforge/fvfonts.$(OBJEXT): fontforge/$(am__dirstamp) \ fontforge/$(DEPDIR)/$(am__dirstamp) fontforge/gwwiconv.$(OBJEXT): fontforge/$(am__dirstamp) \ @@ -621,6 +625,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@fontforge/$(DEPDIR)/cvundoes.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@fontforge/$(DEPDIR)/dumppfa.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@fontforge/$(DEPDIR)/encoding.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@fontforge/$(DEPDIR)/fflocale.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@fontforge/$(DEPDIR)/fvfonts.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@fontforge/$(DEPDIR)/gwwiconv.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@fontforge/$(DEPDIR)/lookups.Po@am__quote@ diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/fontforge/fflocale.c b/Build/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/fontforge/fflocale.c new file mode 100644 index 00000000000..3912686b5e8 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/fontforge/fflocale.c @@ -0,0 +1,44 @@ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include "fflocale.h" + +void switch_to_c_locale(ff_locale_t * tmplocale_p, ff_locale_t * oldlocale_p) { +#ifdef HAVE_USELOCALE + *tmplocale_p = newlocale(LC_NUMERIC_MASK, "C", NULL); + if (*tmplocale_p == NULL) + fprintf(stderr, "Failed to create temporary locale.\n"); + else if ((*oldlocale_p = uselocale(*tmplocale_p)) == NULL) { + fprintf(stderr, "Failed to change locale.\n"); + freelocale(*tmplocale_p); *tmplocale_p = NULL; + } +#else + *tmplocale_p = setlocale(LC_NUMERIC, "C"); + if (*tmplocale_p) + *oldlocale_p = strdup(*tmplocale_p); + else { + *oldlocale_p = NULL; + fprintf(stderr, "Failed to change locale.\n"); + } +#endif +} + +void switch_to_old_locale(ff_locale_t * tmplocale_p, ff_locale_t * oldlocale_p) { +#ifdef HAVE_USELOCALE + if (*oldlocale_p) + uselocale(*oldlocale_p); + else + uselocale(LC_GLOBAL_LOCALE); + *oldlocale_p = NULL; // This ends the lifecycle of the temporary old locale storage. + if (*tmplocale_p) { + freelocale(*tmplocale_p); + *tmplocale_p = NULL; + } +#else + if (*oldlocale_p) { + setlocale(LC_NUMERIC, *oldlocale_p); + free(*oldlocale_p); + *oldlocale_p = NULL; + } +#endif +} diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/fontforge/fflocale.h b/Build/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/fontforge/fflocale.h new file mode 100644 index 00000000000..51bcd83d147 --- /dev/null +++ b/Build/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/fontforge/fflocale.h @@ -0,0 +1,23 @@ +#ifndef FFLOCALE_H +#define FFLOCALE_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <locale.h> +#ifdef HAVE_XLOCALE_H +#include <xlocale.h> +#endif + +#ifdef HAVE_USELOCALE +typedef locale_t ff_locale_t; +#else +typedef char* ff_locale_t; +#endif // HAVE_USELOCALE + +void switch_to_c_locale(ff_locale_t *tmplocale_p, ff_locale_t *oldlocale_p); +void switch_to_old_locale(ff_locale_t *tmplocale_p, ff_locale_t *oldlocale_p); + +#endif /* FFLOCALE_H */ + diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/fontforge/sfd.c b/Build/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/fontforge/sfd.c index 53671118138..1f6ca428f93 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/fontforge/sfd.c +++ b/Build/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/fontforge/sfd.c @@ -4646,7 +4646,7 @@ static SplineFont *SFD_Read(char *filename,FILE *sfd, int fromdir) { } if ( sfd==NULL ) return( NULL ); - locale_t tmplocale; locale_t oldlocale; // Declare temporary locale storage. + ff_locale_t tmplocale, oldlocale; // Declare temporary locale storage. switch_to_c_locale(&tmplocale, &oldlocale); // Switch to the C locale temporarily and cache the old locale. ff_progress_change_stages(2); if ( (version = SFDStartsCorrectly(sfd,tok))!=-1 ) diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/fontforge/splinefont.h b/Build/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/fontforge/splinefont.h index 6ecf7996506..09945f456d8 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/fontforge/splinefont.h +++ b/Build/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/fontforge/splinefont.h @@ -33,15 +33,12 @@ #include <basics.h> #include <dlist.h> #include "configure-fontforge.h" +#include "fflocale.h" #ifdef HAVE_ICONV # include <iconv.h> #else # include <gwwiconv.h> #endif -#include <locale.h> -#ifdef HAVE_XLOCALE_H -#include <xlocale.h> -#endif #include <gnetwork.h> #ifdef FONTFORGE_CONFIG_USE_DOUBLE @@ -2554,57 +2551,4 @@ char * upper_case(const char * input); #include "ustring.h" -#ifdef _WIN32 -#define BAD_LOCALE_HACK -typedef char* locale_t; -#define LC_GLOBAL_LOCALE ((locale_t)-1) -#define LC_ALL_MASK LC_ALL -#define LC_COLLATE_MASK LC_COLLATE -#define LC_CTYPE_MASK LC_CTYPE -#define LC_MONETARY_MASK LC_MONETARY -#define LC_NUMERIC_MASK LC_NUMERIC -#define LC_TIME_MASK LC_TIME -#endif - -static inline void switch_to_c_locale(locale_t * tmplocale_p, locale_t * oldlocale_p) { -#ifndef BAD_LOCALE_HACK - *tmplocale_p = newlocale(LC_NUMERIC_MASK, "C", NULL); - if (*tmplocale_p == NULL) fprintf(stderr, "Failed to create temporary locale.\n"); - else if ((*oldlocale_p = uselocale(*tmplocale_p)) == NULL) { - fprintf(stderr, "Failed to change locale.\n"); - freelocale(*tmplocale_p); *tmplocale_p = NULL; - } -#else - // Yes, it is dirty. But so is an operating system that doesn't support threaded locales. - *oldlocale_p = (locale_t)copy(setlocale(LC_NUMERIC_MASK, "C")); - if (*oldlocale_p == NULL) fprintf(stderr, "Failed to change locale.\n"); -#endif -} - -static inline void switch_to_old_locale(locale_t * tmplocale_p, locale_t * oldlocale_p) { -#ifndef BAD_LOCALE_HACK - if (*oldlocale_p != NULL) { uselocale(*oldlocale_p); } else { uselocale(LC_GLOBAL_LOCALE); } - *oldlocale_p = NULL; // This ends the lifecycle of the temporary old locale storage. - if (*tmplocale_p != NULL) { freelocale(*tmplocale_p); *tmplocale_p = NULL; } -#else - if (*oldlocale_p != NULL) { - setlocale(LC_NUMERIC_MASK, (char*)(*oldlocale_p)); - free((char*)(*oldlocale_p)); - *oldlocale_p = NULL; - } -#endif -} - -#if 0 -#define DECLARE_TEMP_LOCALE() char oldloc[25]; -#define SWITCH_TO_C_LOCALE() strncpy( oldloc,setlocale(LC_NUMERIC,NULL),24 ); oldloc[24]='\0'; setlocale(LC_NUMERIC,"C"); -#define SWITCH_TO_OLD_LOCALE() setlocale(LC_NUMERIC,oldloc); -#else -#define DECLARE_TEMP_LOCALE() locale_t tmplocale; locale_t oldlocale; // Declare temporary locale storage. -#define SWITCH_TO_C_LOCALE() switch_to_c_locale(&tmplocale, &oldlocale); // Switch to the C locale temporarily and cache the old locale. -#define SWITCH_TO_OLD_LOCALE() switch_to_old_locale(&tmplocale, &oldlocale); // Switch to the cached locale. -#endif - - - #endif diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/fontforge/tottf.c b/Build/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/fontforge/tottf.c index e3257c1fc38..57c61c0cc24 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/fontforge/tottf.c +++ b/Build/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/fontforge/tottf.c @@ -5925,7 +5925,7 @@ int _WriteTTFFont(FILE *ttf,SplineFont *sf,enum fontformat format, short_too_long_warned = 0; // This is a static variable defined for putshort. /* TrueType probably doesn't need this, but OpenType does for floats in dictionaries */ - locale_t tmplocale; locale_t oldlocale; // Declare temporary locale storage. + ff_locale_t tmplocale, oldlocale; // Declare temporary locale storage. switch_to_c_locale(&tmplocale, &oldlocale); // Switch to the C locale temporarily and cache the old locale. if ( format==ff_otfcid || format== ff_cffcid ) { |