• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#objective-cqt誰得windowscocoapythonphprubygameguibathyscaphec翻訳omegat計画中(planning stage)frameworktwittertestdomvb.netdirectxbtronarduinopreviewerゲームエンジン

POSIX.1 National Language Support API for MinGW


Commit MetaInfo

Revision1af8e879812fe290179444cd5d4a03c37201cd21 (tree)
Zeit2007-11-12 02:31:32
AutorKeith Marshall <keithmarshall@user...>
CommiterKeith Marshall

Log Message

* catgets.c [HAVE_WINDOWS_H]: Include windows.h.
(mc_is_dirsep): New macro...
(mc_nlspath_open): Use it.
[_WIN32] (mc_dirname_strip, mc_dirname_len): New inline functions.
[_WIN32] (mc_mbstowcs, mc_wcstombs): New inline functions; these
abstract the nastiness of the Win32 MultiByteToWideChar API.
[_WIN32] (mc_validate_mapped): New static function; use it as a
wrapper around mc_validate(), to map POSIX style message catalogue
path names into the installation tree of the calling application.
(mc_resolve) [_WIN32]: New inline function...
(mc_resolve) [!_WIN32]: New do nothing' macro...
(catopen): Use it to clean up temporary resources, allocated for the
Win32 case, where mc_validate() is wrapped by mc_validate_mapped().
(mc_pop_locale): Make it inline.

* nlspath.h.in (mc_MK_NLSPATH): New macro; use it to...
(APP_NLSPATH, SYS_NLSPATH): Construct these new defines, from...
(APP_NLSPATH_PREFERRED, APP_NLSPATH_ALTERNATE): These new defines...
(SYS_NLSPATH_PREFERRED, SYS_NLSPATH_ALTERNATE): and these likewise.
(NLSPATH_DEFAULT): Redefined, based on APP_NLSPATH and SYS_NLSPATH.

* configure.ac (AC_CHECK_HEADERS): Include windows.h.
* configure, config.h.in: Regenerated.

Ändern Zusammenfassung

Diff

--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,29 @@
1+2007-11-11 Keith Marshall <keithmarshall@users.sourceforge.net>
2+
3+ * catgets.c [HAVE_WINDOWS_H]: Include windows.h.
4+ (mc_is_dirsep): New macro...
5+ (mc_nlspath_open): Use it.
6+ [_WIN32] (mc_dirname_strip, mc_dirname_len): New inline functions.
7+ [_WIN32] (mc_mbstowcs, mc_wcstombs): New inline functions; these
8+ abstract the nastiness of the Win32 MultiByteToWideChar API.
9+ [_WIN32] (mc_validate_mapped): New static function; use it as a
10+ wrapper around mc_validate(), to map POSIX style message catalogue
11+ path names into the installation tree of the calling application.
12+ (mc_resolve) [_WIN32]: New inline function...
13+ (mc_resolve) [!_WIN32]: New `do nothing' macro...
14+ (catopen): Use it to clean up temporary resources, allocated for the
15+ Win32 case, where mc_validate() is wrapped by mc_validate_mapped().
16+ (mc_pop_locale): Make it inline.
17+
18+ * nlspath.h.in (mc_MK_NLSPATH): New macro; use it to...
19+ (APP_NLSPATH, SYS_NLSPATH): Construct these new defines, from...
20+ (APP_NLSPATH_PREFERRED, APP_NLSPATH_ALTERNATE): These new defines...
21+ (SYS_NLSPATH_PREFERRED, SYS_NLSPATH_ALTERNATE): and these likewise.
22+ (NLSPATH_DEFAULT): Redefined, based on APP_NLSPATH and SYS_NLSPATH.
23+
24+ * configure.ac (AC_CHECK_HEADERS): Include windows.h.
25+ * configure, config.h.in: Regenerated.
26+
127 2007-11-10 Keith Marshall <keithmarshall@users.sourceforge.net>
228
329 * Makefile.in (install-man): Require pre-existing ${prefix};
--- a/catopen.c
+++ b/catopen.c
@@ -9,7 +9,7 @@
99 * POSIX compatible national language message catalogues in MinGW.
1010 *
1111 * Written by Keith Marshall <keithmarshall@users.sourceforge.net>
12- * Last modification: 22-Sept-2007
12+ * Last modification: 10-Nov-2007
1313 *
1414 *
1515 * This is free software. It is provided AS IS, in the hope that it may
@@ -33,6 +33,10 @@
3333 #include <config.h>
3434 #endif
3535
36+#ifdef HAVE_WINDOWS_H
37+#include <windows.h>
38+#endif
39+
3640 #include <stdlib.h>
3741 #include <stdarg.h>
3842 #include <fcntl.h>
@@ -113,7 +117,205 @@ int mc_validate( __const char *name )
113117 return (int)(-1);
114118 }
115119
120+#ifdef _WIN32
121+/*
122+ * On Win32 platforms, we need to work around the lack of any definitive
123+ * standard for a file system hierarchy; to accomplish this, we need some
124+ * additional helper functions, for analysing and modifying path names,
125+ * performing all operations in the wide character domain.
126+ */
127+#define mc_is_dirsep(C) (((C) == L'/') || ((C) == L'\\'))
128+
129+static inline
130+size_t mc_dirname_strip( wchar_t *path, size_t len )
131+{
132+ /* Local inline helper to discard trailing dirname separators
133+ * from the end of a path name in the wide character domain.
134+ */
135+ while( (len > 0) && mc_is_dirsep( path[len] ) )
136+ path[len--] = L'\0';
137+ return len;
138+}
139+
140+static inline
141+size_t mc_dirname_len( wchar_t *path, size_t len )
142+{
143+ /* Local inline helper to establish the length of the `dirname'
144+ * component of a path name in the wide character domain.
145+ */
146+ len = mc_dirname_strip( path, len );
147+ while( (len > 0) && ! mc_is_dirsep( path[len] ) )
148+ --len;
149+ return len;
150+}
151+
152+static inline
153+size_t mc_mbstowcs( wchar_t *buf, size_t len, const char *mbs )
154+{
155+ /* Inline helper to convert path names from the multibyte character
156+ * domain defined by the system code page, to the wide character domain.
157+ */
158+ return MultiByteToWideChar( CP_ACP, 0, mbs, (size_t)(-1), buf, len );
159+}
160+
161+static inline
162+size_t mc_wcstombs( char *buf, size_t len, const wchar_t *wcs )
163+{
164+ /* Inline helper to convert path names from the wide character domain
165+ * to the multibyte character domain defined by the system code page.
166+ */
167+ return WideCharToMultiByte( CP_ACP, 0, wcs, (size_t)(-1), buf, len, NULL, NULL );
168+}
169+
116170 static
171+int mc_validate_mapped( __const char *name )
172+{
173+ /* Wrapper function for calls to `mc_validate', on Win32 hosts.
174+ * We assume that, for an application installed into a directory
175+ * designated by `${prefix}', that its message catalogues will be
176+ * in `${prefix}/name'; thus, for any `name' argument which is in
177+ * the form of a POSIX absolute path name, (i.e. it begins with a
178+ * dirname separator as its first character), we deduce `${prefix}'
179+ * from the path name of the executable file, and we prefix it to
180+ * the `name' argument, before passing this modified argument to
181+ * `mc_validate', for consideration as a possible location for
182+ * the message catalogue to be opened.
183+ */
184+ static char *mapped_name = NULL;
185+ static size_t root_len = (size_t)(-1);
186+
187+ wchar_t chk;
188+
189+ if( name == NULL )
190+ {
191+ /* No catalogue path name to map;
192+ * we may assume that this is a request to...
193+ */
194+ if( mapped_name != NULL )
195+ {
196+ /* ...release temporary resources, allocated while
197+ * mapping catalogue paths into the file system space
198+ * in which the calling application is installed.
199+ */
200+ free( mapped_name );
201+ mapped_name = NULL;
202+ root_len = (size_t)(-1);
203+ }
204+ /* If this was not a deliberate request to free resources,
205+ * then an error has occurred, so return accordingly.
206+ */
207+ return (int)(-1);
208+ }
209+
210+ /* If we get to here,
211+ * then we have a message catalogue to locate...
212+ */
213+ if( (mbtowc( &chk, name, MB_CUR_MAX ) > 0) && ! mc_is_dirsep( chk ) )
214+ /*
215+ * The message catalogue path specified in this request is
216+ * not absolute, as a POSIX path, so handle it literally.
217+ */
218+ return mc_validate( name );
219+
220+ /* ...and if here, then the path is specified by an
221+ * absolute POSIX style path name...
222+ */
223+ if( mapped_name == NULL )
224+ {
225+ /* ...but we don't yet know the Win32 path name for the effective
226+ * root directory in our emulated POSIX file system hierarchy; we
227+ * must deduce this from the path name of the calling executable.
228+ */
229+ size_t path_len = strlen( name ) + 1;
230+ wchar_t chroot[ root_len = mc_mbstowcs( NULL, 0, _pgmptr ) ];
231+ (void) mc_mbstowcs( chroot, root_len, _pgmptr );
232+
233+ /* Discard the executable file name, from the end of this path name.
234+ */
235+ root_len = mc_dirname_len( chroot, root_len - 1 );
236+ if( mc_is_dirsep( chroot[ root_len ] ) )
237+ {
238+ size_t offset;
239+
240+ /* When we have distinct dirname and basename components, then we
241+ * discard the basename, and also any newly exposed trailing dirname
242+ * separator characters.
243+ */
244+ root_len = mc_dirname_len( chroot, root_len );
245+
246+ /* Check if the leaf directory name is `bin' or `sbin'...
247+ * The executable may be installed as `${prefix}/bin/appname.exe',
248+ * or as `${prefix}/sbin/appname.exe'; thus, to identify `${prefix}',
249+ * we must prune away this final directory name, and its preceeding
250+ * dirname separator(s), in addition to the executable name, which
251+ * we've already discarded.
252+ */
253+ offset = root_len + 1;
254+ if( (chroot[ offset ] == L's') || (chroot[ offset ] == L'S') )
255+ ++offset;
256+ if( _wcsicmp( chroot + offset, L"bin" ) == 0 )
257+ (void) mc_dirname_strip( chroot, root_len );
258+ }
259+
260+ /* Transform this name back to the multibyte character domain,
261+ * computing the resultant length of the application root prefix;
262+ * allocate memory to accommodate it, with the message catalogue
263+ * path name concatenated, and populate it.
264+ */
265+ root_len = mc_wcstombs( NULL, 0, chroot ) - 1;
266+ mapped_name = mc_realloc( mapped_name, root_len + path_len );
267+ (void) mc_wcstombs( mapped_name, root_len + 1, chroot );
268+ (void) memcpy( mapped_name + root_len, name, path_len );
269+ }
270+
271+ else
272+ {
273+ /* We had already identified the application's root prefix,
274+ * during a previous search, so now we simply adjust the memory
275+ * allocation, and insert the new message catalogue path name,
276+ * at the appropriate offset.
277+ */
278+ size_t path_len = strlen( name ) + 1;
279+ mapped_name = mc_realloc( mapped_name, root_len + path_len );
280+ (void) memcpy( mapped_name + root_len, name, path_len );
281+ }
282+
283+ /* However we arrived at the mapped message catalogue path name,
284+ * we hand it off for validation.
285+ */
286+ return mc_validate( mapped_name );
287+}
288+
289+/* Throughout the remainder of this module,
290+ * redirect references to `mc_validate' through `mc_validate_mapped'.
291+ */
292+#define mc_validate( name ) mc_validate_mapped( name )
293+
294+static inline
295+nl_catd mc_resolved( nl_catd fd )
296+{
297+ /* A simple wrapper function, which allows `catopen' to release
298+ * the memory temporarily allocated by `mc_validate_mapped', when
299+ * searching for message catalogues on Win32 file systems.
300+ */
301+ (void) mc_validate_mapped( NULL );
302+ return fd;
303+}
304+
305+#else
306+/*
307+ * On non-Win32 platforms, there are no file system hierarchy issues
308+ * to be resolved, so `mc_resolved' may simply evaluate its argument,
309+ * and transparently leave the result inline.
310+ */
311+#define mc_resolved( expr ) expr
312+
313+/* On these platforms, we accept only '/' as the dirname separator.
314+ */
315+#define mc_is_dirsep(C) ((C) == L'/')
316+#endif
317+
318+static inline
117319 int mc_pop_locale( int LC_TYPE, char *working_locale, int retval )
118320 {
119321 /* This convenience function is used by `mc_nlspath_open', (below),
@@ -206,7 +408,7 @@ int mc_nlspath_open( __const char *msgcat, unsigned flags )
206408 /* First, check if the given `msgcat' spec begins with a pair of
207409 * characters which appear to represent a Win32 drive specifier.
208410 */
209- if( (chk != L'/') && (chk != L'\\') )
411+ if( ! mc_is_dirsep( chk ) )
210412 {
211413 /* We assume that it is, when the first character is *not* a
212414 * directory name separator, and the second *is* a colon...
@@ -224,7 +426,7 @@ int mc_nlspath_open( __const char *msgcat, unsigned flags )
224426 */
225427 while( step > 0 )
226428 {
227- if( (chk == L'/') || (chk == L'\\') )
429+ if( mc_is_dirsep( chk ) )
228430 {
229431 /* The `msgcat' spec includes at least one directory name separator,
230432 * so pass it back to `catopen', as an exact catalogue file reference.
@@ -493,7 +695,7 @@ nl_catd catopen( __const char *name, int flags )
493695 {
494696 /* ...with all the hard work done by the `mc_open' call-back from `_mctab_'.
495697 */
496- return (nl_catd)_mctab_( mc_open, name, flags );
698+ return mc_resolved( (nl_catd)_mctab_( mc_open, name, flags ) );
497699 }
498700
499-/* $RCSfile$Revision: 1.4 $: end of file */
701+/* $RCSfile$Revision: 1.5 $: end of file */
--- a/config.h.in
+++ b/config.h.in
@@ -6,6 +6,9 @@
66 /* Define numerically to the catgets minor version number */
77 #undef CATGETS_VERSION_MINOR
88
9+/* Define to 1 if you have the `basename' function. */
10+#undef HAVE_BASENAME
11+
912 /* Define to 1 if you have the <iconv.h> header file. */
1013 #undef HAVE_ICONV_H
1114
@@ -21,9 +24,6 @@
2124 /* Define to 1 if you have the `nl_langinfo' function. */
2225 #undef HAVE_NL_LANGINFO
2326
24-/* Define to 1 if you have the <nl_types.h> header file. */
25-#undef HAVE_NL_TYPES_H
26-
2727 /* Define to 1 if you have the <stdint.h> header file. */
2828 #undef HAVE_STDINT_H
2929
@@ -45,6 +45,12 @@
4545 /* Define to 1 if you have the <unistd.h> header file. */
4646 #undef HAVE_UNISTD_H
4747
48+/* Define to 1 if you have the <windows.h> header file. */
49+#undef HAVE_WINDOWS_H
50+
51+/* Define to 1 if you have the `_mingw_setlocale' function. */
52+#undef HAVE__MINGW_SETLOCALE
53+
4854 /* Define to `const' if iconv declaration requires const. */
4955 #undef ICONV_CONST
5056
--- a/configure
+++ b/configure
@@ -3721,8 +3721,160 @@ fi
37213721
37223722
37233723
3724-# For a native Win32 build, we need the MinGW locale extensions.
3724+# Building for a native Win32 host, we need the `windows.h' header,
3725+# (which is not required for a cross-hosted tool chain build), and
3726+# also the MinGW locale extensions.
37253727 #
3728+
3729+for ac_header in windows.h
3730+do
3731+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
3732+if eval "test \"\${$as_ac_Header+set}\" = set"; then
3733+ echo "$as_me:$LINENO: checking for $ac_header" >&5
3734+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
3735+if eval "test \"\${$as_ac_Header+set}\" = set"; then
3736+ echo $ECHO_N "(cached) $ECHO_C" >&6
3737+fi
3738+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
3739+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
3740+else
3741+ # Is the header compilable?
3742+echo "$as_me:$LINENO: checking $ac_header usability" >&5
3743+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
3744+cat >conftest.$ac_ext <<_ACEOF
3745+/* confdefs.h. */
3746+_ACEOF
3747+cat confdefs.h >>conftest.$ac_ext
3748+cat >>conftest.$ac_ext <<_ACEOF
3749+/* end confdefs.h. */
3750+$ac_includes_default
3751+#include <$ac_header>
3752+_ACEOF
3753+rm -f conftest.$ac_objext
3754+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
3755+ (eval $ac_compile) 2>conftest.er1
3756+ ac_status=$?
3757+ grep -v '^ *+' conftest.er1 >conftest.err
3758+ rm -f conftest.er1
3759+ cat conftest.err >&5
3760+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
3761+ (exit $ac_status); } &&
3762+ { ac_try='test -z "$ac_c_werror_flag"
3763+ || test ! -s conftest.err'
3764+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
3765+ (eval $ac_try) 2>&5
3766+ ac_status=$?
3767+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
3768+ (exit $ac_status); }; } &&
3769+ { ac_try='test -s conftest.$ac_objext'
3770+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
3771+ (eval $ac_try) 2>&5
3772+ ac_status=$?
3773+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
3774+ (exit $ac_status); }; }; then
3775+ ac_header_compiler=yes
3776+else
3777+ echo "$as_me: failed program was:" >&5
3778+sed 's/^/| /' conftest.$ac_ext >&5
3779+
3780+ac_header_compiler=no
3781+fi
3782+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
3783+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
3784+echo "${ECHO_T}$ac_header_compiler" >&6
3785+
3786+# Is the header present?
3787+echo "$as_me:$LINENO: checking $ac_header presence" >&5
3788+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
3789+cat >conftest.$ac_ext <<_ACEOF
3790+/* confdefs.h. */
3791+_ACEOF
3792+cat confdefs.h >>conftest.$ac_ext
3793+cat >>conftest.$ac_ext <<_ACEOF
3794+/* end confdefs.h. */
3795+#include <$ac_header>
3796+_ACEOF
3797+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
3798+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
3799+ ac_status=$?
3800+ grep -v '^ *+' conftest.er1 >conftest.err
3801+ rm -f conftest.er1
3802+ cat conftest.err >&5
3803+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
3804+ (exit $ac_status); } >/dev/null; then
3805+ if test -s conftest.err; then
3806+ ac_cpp_err=$ac_c_preproc_warn_flag
3807+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
3808+ else
3809+ ac_cpp_err=
3810+ fi
3811+else
3812+ ac_cpp_err=yes
3813+fi
3814+if test -z "$ac_cpp_err"; then
3815+ ac_header_preproc=yes
3816+else
3817+ echo "$as_me: failed program was:" >&5
3818+sed 's/^/| /' conftest.$ac_ext >&5
3819+
3820+ ac_header_preproc=no
3821+fi
3822+rm -f conftest.err conftest.$ac_ext
3823+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
3824+echo "${ECHO_T}$ac_header_preproc" >&6
3825+
3826+# So? What about this header?
3827+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
3828+ yes:no: )
3829+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
3830+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
3831+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
3832+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
3833+ ac_header_preproc=yes
3834+ ;;
3835+ no:yes:* )
3836+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
3837+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
3838+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
3839+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
3840+ { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
3841+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
3842+ { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
3843+echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
3844+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
3845+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
3846+ { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
3847+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
3848+ (
3849+ cat <<\_ASBOX
3850+## ------------------------------------------------------------------------- ##
3851+## Report this to https://sourceforge.net/tracker/?group_id=2435&atid=102435 ##
3852+## ------------------------------------------------------------------------- ##
3853+_ASBOX
3854+ ) |
3855+ sed "s/^/$as_me: WARNING: /" >&2
3856+ ;;
3857+esac
3858+echo "$as_me:$LINENO: checking for $ac_header" >&5
3859+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
3860+if eval "test \"\${$as_ac_Header+set}\" = set"; then
3861+ echo $ECHO_N "(cached) $ECHO_C" >&6
3862+else
3863+ eval "$as_ac_Header=\$ac_header_preproc"
3864+fi
3865+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
3866+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
3867+
3868+fi
3869+if test `eval echo '${'$as_ac_Header'}'` = yes; then
3870+ cat >>confdefs.h <<_ACEOF
3871+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
3872+_ACEOF
3873+
3874+fi
3875+
3876+done
3877+
37263878 GENCAT_OBJECTS=${GENCAT_OBJECTS-'gencat.$(OBJEXT)'}
37273879
37283880 test x$mingw_cv_win32_host = xyes || mingw_cv_lc_extensions="not required"
@@ -5994,4 +6146,4 @@ if test "$no_create" != yes; then
59946146 fi
59956147
59966148 #
5997-# $RCSfile$Revision: 1.1.1.1 $: end of file
6149+# $RCSfile$Revision: 1.2 $: end of file
--- a/configure.ac
+++ b/configure.ac
@@ -90,8 +90,11 @@
9090 MINGW_AC_CHECK_HEADER([REPLACEMENT_HEADERS], [nl_types.h])
9191 MINGW_AC_CHECK_HEADER([REPLACEMENT_HEADERS], [langinfo.h])
9292
93-# For a native Win32 build, we need the MinGW locale extensions.
93+# Building for a native Win32 host, we need the `windows.h' header,
94+# (which is not required for a cross-hosted tool chain build), and
95+# also the MinGW locale extensions.
9496 #
97+ AC_CHECK_HEADERS([windows.h])
9598 MINGW_AC_LC_EXTENSIONS([LOCAL_HEADERS])
9699
97100 # Object modules required to build the `gencat' executable.
@@ -120,4 +123,4 @@
120123 AC_CONFIG_FILES([Makefile])
121124 AC_OUTPUT
122125 #
123-# $RCSfile$Revision: 1.1.1.1 $: end of file
126+# $RCSfile$Revision: 1.2 $: end of file
--- a/nlspath.h.in
+++ b/nlspath.h.in
@@ -9,7 +9,7 @@
99 * This header specifies the `compiled-in' default for NLSPATH.
1010 *
1111 * Written by Keith Marshall <keithmarshall@users.sourceforge.net>
12- * Last modification: 07-Dec-2006
12+ * Last modification: 02-Nov-2007
1313 *
1414 *
1515 * This is free software. It is provided AS IS, in the hope that it may
@@ -29,14 +29,37 @@
2929 */
3030 #define _NLSPATH_H_
3131
32-#define _prefix_ "@HOST_PREFIX@"
33-#define _pathsep_ "@PATH_SEPARATOR_INTERNAL@"
32+#define _prefix_ "@HOST_PREFIX@"
33+#define _pathsep_ "@PATH_SEPARATOR_INTERNAL@"
3434
3535 #define NLSPATH_SEPARATOR_CHAR L'@PATH_SEPARATOR_INTERNAL@'
3636
37-#define NLSPATH_PREFERRED _prefix_ "/share/locale/%L/%N"
38-#define NLSPATH_ALTERNATE _prefix_ "/share/locale/%L/LC_MESSAGES/%N"
37+#define APP_NLSPATH_PREFERRED "/share/locale/%L/%N"
38+#define APP_NLSPATH_ALTERNATE "/share/locale/%L/LC_MESSAGES/%N"
3939
40-#define NLSPATH_DEFAULT NLSPATH_PREFERRED _pathsep_ NLSPATH_ALTERNATE
40+#define SYS_NLSPATH_PREFERRED _prefix_ APP_NLSPATH_PREFERRED
41+#define SYS_NLSPATH_ALTERNATE _prefix_ APP_NLSPATH_ALTERNATE
4142
42-#endif /* _NLSPATH_H_: $RCSfile$Revision$: end of file */
43+#define mc_MK_NLSPATH(TAG) TAG##_PREFERRED _pathsep_ TAG##_ALTERNATE
44+
45+#ifdef _WIN32
46+/*
47+ * On Win32 hosts, we establish a default NLSPATH which will first
48+ * search in the calling application's installation tree, falling back
49+ * to a system default, only if that search is unproductive.
50+ */
51+#define APP_NLSPATH mc_MK_NLSPATH( APP_NLSPATH )
52+#define SYS_NLSPATH mc_MK_NLSPATH( SYS_NLSPATH )
53+
54+#define NLSPATH_DEFAULT APP_NLSPATH _pathsep_ SYS_NLSPATH
55+
56+#else
57+/*
58+ * On non-Win32 hosts, we assume that applications will install their
59+ * message catalogues into the system path, so here is no need for an
60+ * application specific local tree search.
61+ */
62+#define NLSPATH_DEFAULT mc_MK_NLSPATH( SYS_NLSPATH )
63+#endif
64+
65+#endif /* _NLSPATH_H_: $RCSfile$Revision: 1.1.1.1 $: end of file */