Mercurial > gnulib
annotate m4/wctob.m4 @ 40196:e63f5d3edab5
relocatable-prog: Update documentation.
* doc/relocatable-maint.texi (Supporting Relocation): Update to match
the recent changes.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Sun, 24 Feb 2019 01:49:15 +0100 |
parents | b06060465f09 |
children |
rev | line source |
---|---|
18993
a75cfc731331
Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents:
18626
diff
changeset
|
1 # wctob.m4 serial 11 |
40057
b06060465f09
maint: Run 'make update-copyright'
Paul Eggert <eggert@cs.ucla.edu>
parents:
19484
diff
changeset
|
2 dnl Copyright (C) 2008-2019 Free Software Foundation, Inc. |
10905 | 3 dnl This file is free software; the Free Software Foundation |
4 dnl gives unlimited permission to copy and/or distribute it, | |
5 dnl with or without modifications, as long as this notice is preserved. | |
6 | |
7 AC_DEFUN([gl_FUNC_WCTOB], | |
8 [ | |
9 AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) | |
10 | |
11 AC_CHECK_FUNCS_ONCE([wctob]) | |
12 if test $ac_cv_func_wctob = no; then | |
15163
ff1ca7dbde1e
wctob: Move AC_LIBOBJ invocations to module description.
Bruno Haible <bruno@clisp.org>
parents:
14685
diff
changeset
|
13 HAVE_WCTOB=0 |
10917
e5c15988572b
Ensure wctob is declared on IRIX 6.5.
Bruno Haible <bruno@clisp.org>
parents:
10905
diff
changeset
|
14 HAVE_DECL_WCTOB=0 |
e5c15988572b
Ensure wctob is declared on IRIX 6.5.
Bruno Haible <bruno@clisp.org>
parents:
10905
diff
changeset
|
15 else |
15163
ff1ca7dbde1e
wctob: Move AC_LIBOBJ invocations to module description.
Bruno Haible <bruno@clisp.org>
parents:
14685
diff
changeset
|
16 HAVE_WCTOB=1 |
10922
91831148c181
Work around wctob bug on Solaris 9.
Bruno Haible <bruno@clisp.org>
parents:
10917
diff
changeset
|
17 |
91831148c181
Work around wctob bug on Solaris 9.
Bruno Haible <bruno@clisp.org>
parents:
10917
diff
changeset
|
18 dnl Solaris 9 has the wctob() function but it does not work. |
13298
1a9111853b72
wctob: Work around nasty Cygwin 1.7.2 bug.
Bruno Haible <bruno@clisp.org>
parents:
12559
diff
changeset
|
19 dnl Cygwin 1.7.2 has the wctob() function but it clobbers caller-owned |
19192
d86e08b1f555
all: Replace many more http URLs by https URLs. Update stale URLs.
Bruno Haible <bruno@clisp.org>
parents:
18993
diff
changeset
|
20 dnl registers, see <https://cygwin.com/ml/cygwin/2010-05/msg00015.html>. |
10922
91831148c181
Work around wctob bug on Solaris 9.
Bruno Haible <bruno@clisp.org>
parents:
10917
diff
changeset
|
21 AC_REQUIRE([AC_PROG_CC]) |
91831148c181
Work around wctob bug on Solaris 9.
Bruno Haible <bruno@clisp.org>
parents:
10917
diff
changeset
|
22 AC_REQUIRE([gt_LOCALE_FR]) |
91831148c181
Work around wctob bug on Solaris 9.
Bruno Haible <bruno@clisp.org>
parents:
10917
diff
changeset
|
23 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles |
91831148c181
Work around wctob bug on Solaris 9.
Bruno Haible <bruno@clisp.org>
parents:
10917
diff
changeset
|
24 AC_CACHE_CHECK([whether wctob works], |
91831148c181
Work around wctob bug on Solaris 9.
Bruno Haible <bruno@clisp.org>
parents:
10917
diff
changeset
|
25 [gl_cv_func_wctob_works], |
91831148c181
Work around wctob bug on Solaris 9.
Bruno Haible <bruno@clisp.org>
parents:
10917
diff
changeset
|
26 [ |
91831148c181
Work around wctob bug on Solaris 9.
Bruno Haible <bruno@clisp.org>
parents:
10917
diff
changeset
|
27 dnl Initial guess, used when cross-compiling or when no suitable locale |
91831148c181
Work around wctob bug on Solaris 9.
Bruno Haible <bruno@clisp.org>
parents:
10917
diff
changeset
|
28 dnl is present. |
91831148c181
Work around wctob bug on Solaris 9.
Bruno Haible <bruno@clisp.org>
parents:
10917
diff
changeset
|
29 changequote(,)dnl |
91831148c181
Work around wctob bug on Solaris 9.
Bruno Haible <bruno@clisp.org>
parents:
10917
diff
changeset
|
30 case "$host_os" in |
13298
1a9111853b72
wctob: Work around nasty Cygwin 1.7.2 bug.
Bruno Haible <bruno@clisp.org>
parents:
12559
diff
changeset
|
31 # Guess no on Solaris <= 9 and Cygwin. |
1a9111853b72
wctob: Work around nasty Cygwin 1.7.2 bug.
Bruno Haible <bruno@clisp.org>
parents:
12559
diff
changeset
|
32 solaris2.[1-9] | solaris2.[1-9].* | cygwin*) |
10922
91831148c181
Work around wctob bug on Solaris 9.
Bruno Haible <bruno@clisp.org>
parents:
10917
diff
changeset
|
33 gl_cv_func_wctob_works="guessing no" ;; |
18993
a75cfc731331
Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents:
18626
diff
changeset
|
34 # Guess no on native Windows. |
a75cfc731331
Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents:
18626
diff
changeset
|
35 mingw*) |
a75cfc731331
Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents:
18626
diff
changeset
|
36 gl_cv_func_wctob_works="guessing no" ;; |
10922
91831148c181
Work around wctob bug on Solaris 9.
Bruno Haible <bruno@clisp.org>
parents:
10917
diff
changeset
|
37 # Guess yes otherwise. |
91831148c181
Work around wctob bug on Solaris 9.
Bruno Haible <bruno@clisp.org>
parents:
10917
diff
changeset
|
38 *) gl_cv_func_wctob_works="guessing yes" ;; |
91831148c181
Work around wctob bug on Solaris 9.
Bruno Haible <bruno@clisp.org>
parents:
10917
diff
changeset
|
39 esac |
91831148c181
Work around wctob bug on Solaris 9.
Bruno Haible <bruno@clisp.org>
parents:
10917
diff
changeset
|
40 changequote([,])dnl |
13298
1a9111853b72
wctob: Work around nasty Cygwin 1.7.2 bug.
Bruno Haible <bruno@clisp.org>
parents:
12559
diff
changeset
|
41 case "$host_os" in |
1a9111853b72
wctob: Work around nasty Cygwin 1.7.2 bug.
Bruno Haible <bruno@clisp.org>
parents:
12559
diff
changeset
|
42 cygwin*) |
13579
da9779900713
Modernize AC_TRY_RUN invocations.
Bruno Haible <bruno@clisp.org>
parents:
13298
diff
changeset
|
43 AC_RUN_IFELSE( |
da9779900713
Modernize AC_TRY_RUN invocations.
Bruno Haible <bruno@clisp.org>
parents:
13298
diff
changeset
|
44 [AC_LANG_SOURCE([[ |
13298
1a9111853b72
wctob: Work around nasty Cygwin 1.7.2 bug.
Bruno Haible <bruno@clisp.org>
parents:
12559
diff
changeset
|
45 #include <locale.h> |
14020
318a4063e921
Ensure all prerequisites of <wchar.h> are included.
Bruno Haible <bruno@clisp.org>
parents:
13579
diff
changeset
|
46 /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before |
318a4063e921
Ensure all prerequisites of <wchar.h> are included.
Bruno Haible <bruno@clisp.org>
parents:
13579
diff
changeset
|
47 <wchar.h>. |
318a4063e921
Ensure all prerequisites of <wchar.h> are included.
Bruno Haible <bruno@clisp.org>
parents:
13579
diff
changeset
|
48 BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be |
318a4063e921
Ensure all prerequisites of <wchar.h> are included.
Bruno Haible <bruno@clisp.org>
parents:
13579
diff
changeset
|
49 included before <wchar.h>. */ |
318a4063e921
Ensure all prerequisites of <wchar.h> are included.
Bruno Haible <bruno@clisp.org>
parents:
13579
diff
changeset
|
50 #include <stddef.h> |
318a4063e921
Ensure all prerequisites of <wchar.h> are included.
Bruno Haible <bruno@clisp.org>
parents:
13579
diff
changeset
|
51 #include <stdio.h> |
318a4063e921
Ensure all prerequisites of <wchar.h> are included.
Bruno Haible <bruno@clisp.org>
parents:
13579
diff
changeset
|
52 #include <time.h> |
13298
1a9111853b72
wctob: Work around nasty Cygwin 1.7.2 bug.
Bruno Haible <bruno@clisp.org>
parents:
12559
diff
changeset
|
53 #include <wchar.h> |
1a9111853b72
wctob: Work around nasty Cygwin 1.7.2 bug.
Bruno Haible <bruno@clisp.org>
parents:
12559
diff
changeset
|
54 |
1a9111853b72
wctob: Work around nasty Cygwin 1.7.2 bug.
Bruno Haible <bruno@clisp.org>
parents:
12559
diff
changeset
|
55 register long global __asm__ ("%ebx"); |
1a9111853b72
wctob: Work around nasty Cygwin 1.7.2 bug.
Bruno Haible <bruno@clisp.org>
parents:
12559
diff
changeset
|
56 |
1a9111853b72
wctob: Work around nasty Cygwin 1.7.2 bug.
Bruno Haible <bruno@clisp.org>
parents:
12559
diff
changeset
|
57 int main () |
1a9111853b72
wctob: Work around nasty Cygwin 1.7.2 bug.
Bruno Haible <bruno@clisp.org>
parents:
12559
diff
changeset
|
58 { |
1a9111853b72
wctob: Work around nasty Cygwin 1.7.2 bug.
Bruno Haible <bruno@clisp.org>
parents:
12559
diff
changeset
|
59 setlocale (LC_ALL, "en_US.UTF-8"); |
1a9111853b72
wctob: Work around nasty Cygwin 1.7.2 bug.
Bruno Haible <bruno@clisp.org>
parents:
12559
diff
changeset
|
60 |
1a9111853b72
wctob: Work around nasty Cygwin 1.7.2 bug.
Bruno Haible <bruno@clisp.org>
parents:
12559
diff
changeset
|
61 global = 0x12345678; |
1a9111853b72
wctob: Work around nasty Cygwin 1.7.2 bug.
Bruno Haible <bruno@clisp.org>
parents:
12559
diff
changeset
|
62 if (wctob (0x00FC) != -1) |
1a9111853b72
wctob: Work around nasty Cygwin 1.7.2 bug.
Bruno Haible <bruno@clisp.org>
parents:
12559
diff
changeset
|
63 return 1; |
1a9111853b72
wctob: Work around nasty Cygwin 1.7.2 bug.
Bruno Haible <bruno@clisp.org>
parents:
12559
diff
changeset
|
64 if (global != 0x12345678) |
1a9111853b72
wctob: Work around nasty Cygwin 1.7.2 bug.
Bruno Haible <bruno@clisp.org>
parents:
12559
diff
changeset
|
65 return 2; |
1a9111853b72
wctob: Work around nasty Cygwin 1.7.2 bug.
Bruno Haible <bruno@clisp.org>
parents:
12559
diff
changeset
|
66 return 0; |
13579
da9779900713
Modernize AC_TRY_RUN invocations.
Bruno Haible <bruno@clisp.org>
parents:
13298
diff
changeset
|
67 }]])], |
da9779900713
Modernize AC_TRY_RUN invocations.
Bruno Haible <bruno@clisp.org>
parents:
13298
diff
changeset
|
68 [:], |
da9779900713
Modernize AC_TRY_RUN invocations.
Bruno Haible <bruno@clisp.org>
parents:
13298
diff
changeset
|
69 [gl_cv_func_wctob_works=no], |
da9779900713
Modernize AC_TRY_RUN invocations.
Bruno Haible <bruno@clisp.org>
parents:
13298
diff
changeset
|
70 [:]) |
13298
1a9111853b72
wctob: Work around nasty Cygwin 1.7.2 bug.
Bruno Haible <bruno@clisp.org>
parents:
12559
diff
changeset
|
71 ;; |
1a9111853b72
wctob: Work around nasty Cygwin 1.7.2 bug.
Bruno Haible <bruno@clisp.org>
parents:
12559
diff
changeset
|
72 esac |
1a9111853b72
wctob: Work around nasty Cygwin 1.7.2 bug.
Bruno Haible <bruno@clisp.org>
parents:
12559
diff
changeset
|
73 if test "$gl_cv_func_wctob_works" != no && test $LOCALE_FR != none; then |
13579
da9779900713
Modernize AC_TRY_RUN invocations.
Bruno Haible <bruno@clisp.org>
parents:
13298
diff
changeset
|
74 AC_RUN_IFELSE( |
da9779900713
Modernize AC_TRY_RUN invocations.
Bruno Haible <bruno@clisp.org>
parents:
13298
diff
changeset
|
75 [AC_LANG_SOURCE([[ |
10922
91831148c181
Work around wctob bug on Solaris 9.
Bruno Haible <bruno@clisp.org>
parents:
10917
diff
changeset
|
76 #include <locale.h> |
91831148c181
Work around wctob bug on Solaris 9.
Bruno Haible <bruno@clisp.org>
parents:
10917
diff
changeset
|
77 #include <string.h> |
14020
318a4063e921
Ensure all prerequisites of <wchar.h> are included.
Bruno Haible <bruno@clisp.org>
parents:
13579
diff
changeset
|
78 /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before |
318a4063e921
Ensure all prerequisites of <wchar.h> are included.
Bruno Haible <bruno@clisp.org>
parents:
13579
diff
changeset
|
79 <wchar.h>. |
318a4063e921
Ensure all prerequisites of <wchar.h> are included.
Bruno Haible <bruno@clisp.org>
parents:
13579
diff
changeset
|
80 BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be |
318a4063e921
Ensure all prerequisites of <wchar.h> are included.
Bruno Haible <bruno@clisp.org>
parents:
13579
diff
changeset
|
81 included before <wchar.h>. */ |
318a4063e921
Ensure all prerequisites of <wchar.h> are included.
Bruno Haible <bruno@clisp.org>
parents:
13579
diff
changeset
|
82 #include <stddef.h> |
318a4063e921
Ensure all prerequisites of <wchar.h> are included.
Bruno Haible <bruno@clisp.org>
parents:
13579
diff
changeset
|
83 #include <stdio.h> |
318a4063e921
Ensure all prerequisites of <wchar.h> are included.
Bruno Haible <bruno@clisp.org>
parents:
13579
diff
changeset
|
84 #include <time.h> |
10922
91831148c181
Work around wctob bug on Solaris 9.
Bruno Haible <bruno@clisp.org>
parents:
10917
diff
changeset
|
85 #include <wchar.h> |
91831148c181
Work around wctob bug on Solaris 9.
Bruno Haible <bruno@clisp.org>
parents:
10917
diff
changeset
|
86 int main () |
91831148c181
Work around wctob bug on Solaris 9.
Bruno Haible <bruno@clisp.org>
parents:
10917
diff
changeset
|
87 { |
91831148c181
Work around wctob bug on Solaris 9.
Bruno Haible <bruno@clisp.org>
parents:
10917
diff
changeset
|
88 if (setlocale (LC_ALL, "$LOCALE_FR") != NULL) |
91831148c181
Work around wctob bug on Solaris 9.
Bruno Haible <bruno@clisp.org>
parents:
10917
diff
changeset
|
89 { |
91831148c181
Work around wctob bug on Solaris 9.
Bruno Haible <bruno@clisp.org>
parents:
10917
diff
changeset
|
90 wchar_t wc; |
91831148c181
Work around wctob bug on Solaris 9.
Bruno Haible <bruno@clisp.org>
parents:
10917
diff
changeset
|
91 |
91831148c181
Work around wctob bug on Solaris 9.
Bruno Haible <bruno@clisp.org>
parents:
10917
diff
changeset
|
92 if (mbtowc (&wc, "\374", 1) == 1) |
91831148c181
Work around wctob bug on Solaris 9.
Bruno Haible <bruno@clisp.org>
parents:
10917
diff
changeset
|
93 if (wctob (wc) != (unsigned char) '\374') |
91831148c181
Work around wctob bug on Solaris 9.
Bruno Haible <bruno@clisp.org>
parents:
10917
diff
changeset
|
94 return 1; |
91831148c181
Work around wctob bug on Solaris 9.
Bruno Haible <bruno@clisp.org>
parents:
10917
diff
changeset
|
95 } |
91831148c181
Work around wctob bug on Solaris 9.
Bruno Haible <bruno@clisp.org>
parents:
10917
diff
changeset
|
96 return 0; |
13579
da9779900713
Modernize AC_TRY_RUN invocations.
Bruno Haible <bruno@clisp.org>
parents:
13298
diff
changeset
|
97 }]])], |
10922
91831148c181
Work around wctob bug on Solaris 9.
Bruno Haible <bruno@clisp.org>
parents:
10917
diff
changeset
|
98 [gl_cv_func_wctob_works=yes], |
91831148c181
Work around wctob bug on Solaris 9.
Bruno Haible <bruno@clisp.org>
parents:
10917
diff
changeset
|
99 [gl_cv_func_wctob_works=no], |
11493
fcd8e65744b2
Fix cross-compilation results.
Bruno Haible <bruno@clisp.org>
parents:
10922
diff
changeset
|
100 [:]) |
10922
91831148c181
Work around wctob bug on Solaris 9.
Bruno Haible <bruno@clisp.org>
parents:
10917
diff
changeset
|
101 fi |
91831148c181
Work around wctob bug on Solaris 9.
Bruno Haible <bruno@clisp.org>
parents:
10917
diff
changeset
|
102 ]) |
91831148c181
Work around wctob bug on Solaris 9.
Bruno Haible <bruno@clisp.org>
parents:
10917
diff
changeset
|
103 case "$gl_cv_func_wctob_works" in |
91831148c181
Work around wctob bug on Solaris 9.
Bruno Haible <bruno@clisp.org>
parents:
10917
diff
changeset
|
104 *yes) ;; |
91831148c181
Work around wctob bug on Solaris 9.
Bruno Haible <bruno@clisp.org>
parents:
10917
diff
changeset
|
105 *) REPLACE_WCTOB=1 ;; |
91831148c181
Work around wctob bug on Solaris 9.
Bruno Haible <bruno@clisp.org>
parents:
10917
diff
changeset
|
106 esac |
15163
ff1ca7dbde1e
wctob: Move AC_LIBOBJ invocations to module description.
Bruno Haible <bruno@clisp.org>
parents:
14685
diff
changeset
|
107 if test $REPLACE_WCTOB = 0; then |
10922
91831148c181
Work around wctob bug on Solaris 9.
Bruno Haible <bruno@clisp.org>
parents:
10917
diff
changeset
|
108 |
91831148c181
Work around wctob bug on Solaris 9.
Bruno Haible <bruno@clisp.org>
parents:
10917
diff
changeset
|
109 dnl IRIX 6.5 has the wctob() function but does not declare it. |
15618
9d4b273deacd
Properly quote AC_CHECK_DECLS' 4th argument.
Bruno Haible <bruno@clisp.org>
parents:
15163
diff
changeset
|
110 AC_CHECK_DECLS([wctob], [], [], [[ |
10917
e5c15988572b
Ensure wctob is declared on IRIX 6.5.
Bruno Haible <bruno@clisp.org>
parents:
10905
diff
changeset
|
111 /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before |
e5c15988572b
Ensure wctob is declared on IRIX 6.5.
Bruno Haible <bruno@clisp.org>
parents:
10905
diff
changeset
|
112 <wchar.h>. |
e5c15988572b
Ensure wctob is declared on IRIX 6.5.
Bruno Haible <bruno@clisp.org>
parents:
10905
diff
changeset
|
113 BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be included |
e5c15988572b
Ensure wctob is declared on IRIX 6.5.
Bruno Haible <bruno@clisp.org>
parents:
10905
diff
changeset
|
114 before <wchar.h>. */ |
e5c15988572b
Ensure wctob is declared on IRIX 6.5.
Bruno Haible <bruno@clisp.org>
parents:
10905
diff
changeset
|
115 #include <stddef.h> |
e5c15988572b
Ensure wctob is declared on IRIX 6.5.
Bruno Haible <bruno@clisp.org>
parents:
10905
diff
changeset
|
116 #include <stdio.h> |
e5c15988572b
Ensure wctob is declared on IRIX 6.5.
Bruno Haible <bruno@clisp.org>
parents:
10905
diff
changeset
|
117 #include <time.h> |
e5c15988572b
Ensure wctob is declared on IRIX 6.5.
Bruno Haible <bruno@clisp.org>
parents:
10905
diff
changeset
|
118 #include <wchar.h> |
15618
9d4b273deacd
Properly quote AC_CHECK_DECLS' 4th argument.
Bruno Haible <bruno@clisp.org>
parents:
15163
diff
changeset
|
119 ]]) |
10922
91831148c181
Work around wctob bug on Solaris 9.
Bruno Haible <bruno@clisp.org>
parents:
10917
diff
changeset
|
120 if test $ac_cv_have_decl_wctob != yes; then |
91831148c181
Work around wctob bug on Solaris 9.
Bruno Haible <bruno@clisp.org>
parents:
10917
diff
changeset
|
121 HAVE_DECL_WCTOB=0 |
91831148c181
Work around wctob bug on Solaris 9.
Bruno Haible <bruno@clisp.org>
parents:
10917
diff
changeset
|
122 fi |
10917
e5c15988572b
Ensure wctob is declared on IRIX 6.5.
Bruno Haible <bruno@clisp.org>
parents:
10905
diff
changeset
|
123 fi |
10905 | 124 fi |
125 ]) | |
126 | |
127 # Prerequisites of lib/wctob.c. | |
128 AC_DEFUN([gl_PREREQ_WCTOB], [ | |
129 : | |
130 ]) |