]>
Commit | Line | Data |
---|---|---|
b75a7d8f | 1 | dnl aclocal.m4 for ICU |
374ca955 | 2 | dnl Copyright (c) 1999-2004, International Business Machines Corporation and |
b75a7d8f A |
3 | dnl others. All Rights Reserved. |
4 | dnl Stephen F. Booth | |
5 | ||
6 | dnl @TOP@ | |
7 | ||
8 | dnl ICU_CHECK_MH_FRAG | |
9 | AC_DEFUN(ICU_CHECK_MH_FRAG, [ | |
10 | AC_CACHE_CHECK( | |
11 | [which Makefile fragment to use], | |
12 | [icu_cv_host_frag], | |
13 | [ | |
14 | case "${host}" in | |
15 | *-*-solaris*) | |
374ca955 | 16 | if test "$GCC" = yes; then |
b75a7d8f A |
17 | icu_cv_host_frag=mh-solaris-gcc |
18 | else | |
19 | icu_cv_host_frag=mh-solaris | |
20 | fi ;; | |
21 | alpha*-*-linux-gnu) | |
374ca955 | 22 | if test "$GCC" = yes; then |
b75a7d8f A |
23 | icu_cv_host_frag=mh-alpha-linux-gcc |
24 | else | |
25 | icu_cv_host_frag=mh-alpha-linux-cc | |
26 | fi ;; | |
374ca955 A |
27 | powerpc*-*-linux*) |
28 | if test "$GCC" = yes; then | |
29 | icu_cv_host_frag=mh-linux | |
30 | else | |
31 | icu_cv_host_frag=mh-linux-va | |
32 | fi ;; | |
b75a7d8f A |
33 | *-*-linux*) icu_cv_host_frag=mh-linux ;; |
34 | *-*-cygwin) | |
374ca955 | 35 | if test "$GCC" = yes; then |
b75a7d8f A |
36 | icu_cv_host_frag=mh-cygwin |
37 | else | |
38 | icu_cv_host_frag=mh-cygwin-msvc | |
39 | fi ;; | |
374ca955 A |
40 | *-*-mingw32) |
41 | if test "$GCC" = yes; then | |
42 | icu_cv_host_frag=mh-mingw | |
43 | else | |
44 | icu_cv_host_frag=mh-cygwin-msvc | |
45 | fi ;; | |
b75a7d8f A |
46 | *-*-*bsd*) icu_cv_host_frag=mh-bsd-gcc ;; |
47 | *-*-aix*) | |
374ca955 A |
48 | if test "$GCC" = yes; then |
49 | icu_cv_host_frag=mh-aix-gcc | |
b75a7d8f | 50 | else |
374ca955 A |
51 | if test -n "`$CXX --help 2>&1 | grep 'IBM C and C++ Compilers$'`"; then |
52 | icu_cv_host_frag=mh-aix | |
53 | else | |
54 | icu_cv_host_frag=mh-aix-va | |
55 | fi | |
b75a7d8f A |
56 | fi ;; |
57 | *-*-hpux*) | |
374ca955 | 58 | if test "$GCC" = yes; then |
b75a7d8f A |
59 | icu_cv_host_frag=mh-hpux-gcc |
60 | else | |
61 | case "$CXX" in | |
62 | *aCC) icu_cv_host_frag=mh-hpux-acc ;; | |
63 | *CC) icu_cv_host_frag=mh-hpux-cc ;; | |
64 | esac | |
65 | fi ;; | |
66 | *-*ibm-openedition*|*-*-os390*) icu_cv_host_frag=mh-os390 ;; | |
67 | *-*-os400*) icu_cv_host_frag=mh-os400 ;; | |
68 | *-apple-rhapsody*) icu_cv_host_frag=mh-darwin ;; | |
69 | *-apple-darwin*) icu_cv_host_frag=mh-darwin ;; | |
374ca955 | 70 | *-*-beos) icu_cv_host_frag=mh-beos ;; |
b75a7d8f A |
71 | *-*-irix*) icu_cv_host_frag=mh-irix ;; |
72 | *-dec-osf*) icu_cv_host_frag=mh-alpha-osf ;; | |
73 | *-*-nto*) icu_cv_host_frag=mh-qnx ;; | |
374ca955 | 74 | *-ncr-*) icu_cv_host_frag=mh-mpras ;; |
b75a7d8f A |
75 | *-sequent-*) icu_cv_host_frag=mh-ptx ;; |
76 | *) icu_cv_host_frag=mh-unknown ;; | |
77 | esac | |
78 | ] | |
79 | ) | |
80 | ]) | |
81 | ||
374ca955 | 82 | dnl ICU_CONDITIONAL - similar example taken from Automake 1.4 |
b75a7d8f A |
83 | AC_DEFUN(ICU_CONDITIONAL, |
84 | [AC_SUBST($1_TRUE) | |
b75a7d8f A |
85 | if $2; then |
86 | $1_TRUE= | |
b75a7d8f A |
87 | else |
88 | $1_TRUE='#' | |
b75a7d8f A |
89 | fi]) |
90 | ||
91 | dnl AC_SEARCH_LIBS_FIRST(FUNCTION, SEARCH-LIBS [, ACTION-IF-FOUND | |
92 | dnl [, ACTION-IF-NOT-FOUND [, OTHER-LIBRARIES]]]) | |
93 | dnl Search for a library defining FUNC, then see if it's not already available. | |
94 | ||
95 | AC_DEFUN(AC_SEARCH_LIBS_FIRST, | |
96 | [AC_PREREQ([2.13]) | |
97 | AC_CACHE_CHECK([for library containing $1], [ac_cv_search_$1], | |
98 | [ac_func_search_save_LIBS="$LIBS" | |
99 | ac_cv_search_$1="no" | |
100 | for i in $2; do | |
101 | LIBS="-l$i $5 $ac_func_search_save_LIBS" | |
102 | AC_TRY_LINK_FUNC([$1], | |
103 | [ac_cv_search_$1="-l$i" | |
104 | break]) | |
105 | done | |
106 | if test "$ac_cv_search_$1" = "no"; then | |
107 | AC_TRY_LINK_FUNC([$1], [ac_cv_search_$1="none required"]) | |
108 | fi | |
109 | LIBS="$ac_func_search_save_LIBS"]) | |
110 | if test "$ac_cv_search_$1" != "no"; then | |
111 | test "$ac_cv_search_$1" = "none required" || LIBS="$ac_cv_search_$1 $LIBS" | |
112 | $3 | |
113 | else : | |
114 | $4 | |
115 | fi]) | |
116 | ||
117 | dnl Check if we can build and use 64-bit libraries | |
118 | AC_DEFUN(AC_CHECK_64BIT_LIBS, | |
119 | [ | |
120 | AC_ARG_ENABLE(64bit-libs, | |
121 | [ --enable-64bit-libs build 64-bit libraries [default=yes]], | |
122 | [ENABLE_64BIT_LIBS=${enableval}], | |
123 | [ENABLE_64BIT_LIBS=yes] | |
124 | ) | |
125 | dnl These results can't be cached because is sets compiler flags. | |
126 | AC_MSG_CHECKING([for 64-bit executable support]) | |
374ca955 | 127 | if test "$ENABLE_64BIT_LIBS" != no; then |
b75a7d8f A |
128 | case "${host}" in |
129 | *-*-solaris*) | |
374ca955 A |
130 | SPARCV9=`isainfo -n 2>&1 | grep sparcv9` |
131 | if test "$GCC" = yes; then | |
132 | # We could add a check for -m64 depending on the gcc version. | |
133 | ENABLE_64BIT_LIBS=no | |
134 | else | |
b75a7d8f | 135 | SOL64=`$CXX -xarch=v9 2>&1 && $CC -xarch=v9 2>&1 | grep -v usage:` |
b75a7d8f A |
136 | if test -z "$SOL64" && test -n "$SPARCV9"; then |
137 | CFLAGS="${CFLAGS} -xtarget=ultra -xarch=v9" | |
138 | CXXFLAGS="${CXXFLAGS} -xtarget=ultra -xarch=v9" | |
139 | LDFLAGS="${LDFLAGS} -xtarget=ultra -xarch=v9" | |
140 | ENABLE_64BIT_LIBS=yes | |
141 | else | |
142 | ENABLE_64BIT_LIBS=no | |
143 | fi | |
374ca955 A |
144 | fi |
145 | ;; | |
146 | ia64-*-linux*) | |
147 | if test "$GCC" = yes; then | |
148 | # gcc compiler support | |
149 | if test -n "`$CXX -dumpspecs 2>&1 && $CC -dumpspecs 2>&1 | grep -v __LP64__`"; then | |
150 | ENABLE_64BIT_LIBS=yes | |
151 | else | |
152 | ENABLE_64BIT_LIBS=no | |
153 | fi | |
b75a7d8f | 154 | else |
374ca955 A |
155 | # check for ecc/ecpc compiler support |
156 | if test -n "`$CXX --help 2>&1 && $CC --help 2>&1 | grep -v Intel`"; then | |
157 | if test -n "`$CXX --help 2>&1 && $CC --help 2>&1 | grep -v Itanium`"; then | |
158 | ENABLE_64BIT_LIBS=yes | |
159 | else | |
160 | ENABLE_64BIT_LIBS=no | |
161 | fi | |
162 | else | |
163 | # unknown | |
164 | ENABLE_64BIT_LIBS=no | |
165 | fi | |
b75a7d8f A |
166 | fi |
167 | ;; | |
374ca955 A |
168 | x86_64-*-linux*) |
169 | if test "$GCC" = yes; then | |
170 | if test -n "`$CXX -dumpspecs 2>&1 && $CC -dumpspecs 2>&1 | grep -v __LP64__`"; then | |
171 | ENABLE_64BIT_LIBS=yes | |
172 | else | |
173 | ENABLE_64BIT_LIBS=no | |
174 | fi | |
b75a7d8f | 175 | else |
374ca955 A |
176 | # unknown |
177 | ENABLE_64BIT_LIBS=no | |
178 | fi | |
179 | ;; | |
180 | *-*-aix*|powerpc64-*-linux*) | |
181 | if test "$ac_cv_prog_gcc" = no; then | |
182 | # Note: Have not tested 64-bitness with gcc. | |
183 | # Maybe the flag "-maix64" could be used with gcc? | |
184 | OLD_CFLAGS="${CFLAGS}" | |
185 | OLD_CXXFLAGS="${CXXFLAGS}" | |
186 | OLD_LDFLAGS="${LDFLAGS}" | |
187 | CFLAGS="${CFLAGS} -q64" | |
188 | CXXFLAGS="${CXXFLAGS} -q64" | |
189 | LDFLAGS="${LDFLAGS} -q64" | |
190 | AC_TRY_RUN(int main(void) {return 0;}, | |
191 | ENABLE_64BIT_LIBS=yes, ENABLE_64BIT_LIBS=no, ENABLE_64BIT_LIBS=no) | |
192 | if test "$ENABLE_64BIT_LIBS" = no; then | |
193 | CFLAGS="${OLD_CFLAGS}" | |
194 | CXXFLAGS="${OLD_CXXFLAGS}" | |
195 | LDFLAGS="${OLD_LDFLAGS}" | |
196 | else | |
197 | case "${host}" in | |
198 | *-*-aix*) | |
199 | ARFLAGS="${ARFLAGS} -X64" | |
200 | esac | |
201 | fi | |
b75a7d8f A |
202 | fi |
203 | ;; | |
204 | *-*-hpux*) | |
374ca955 A |
205 | dnl First we try the newer +DD64, if that doesn't work, |
206 | dnl try other options. | |
207 | ||
b75a7d8f A |
208 | OLD_CFLAGS="${CFLAGS}" |
209 | OLD_CXXFLAGS="${CXXFLAGS}" | |
374ca955 A |
210 | CFLAGS="${CFLAGS} +DD64" |
211 | CXXFLAGS="${CXXFLAGS} +DD64" | |
b75a7d8f A |
212 | AC_TRY_RUN(int main(void) {return 0;}, |
213 | ENABLE_64BIT_LIBS=yes, ENABLE_64BIT_LIBS=no, ENABLE_64BIT_LIBS=no) | |
214 | if test "$ENABLE_64BIT_LIBS" = no; then | |
215 | CFLAGS="${OLD_CFLAGS}" | |
216 | CXXFLAGS="${OLD_CXXFLAGS}" | |
374ca955 A |
217 | CFLAGS="${CFLAGS} +DA2.0W" |
218 | CXXFLAGS="${CXXFLAGS} +DA2.0W" | |
219 | AC_TRY_RUN(int main(void) {return 0;}, | |
220 | ENABLE_64BIT_LIBS=yes, ENABLE_64BIT_LIBS=no, ENABLE_64BIT_LIBS=no) | |
221 | if test "$ENABLE_64BIT_LIBS" = no; then | |
222 | CFLAGS="${OLD_CFLAGS}" | |
223 | CXXFLAGS="${OLD_CXXFLAGS}" | |
224 | fi | |
b75a7d8f A |
225 | fi |
226 | ;; | |
227 | *) | |
228 | ENABLE_64BIT_LIBS=no | |
229 | ;; | |
230 | esac | |
231 | fi | |
232 | dnl Individual tests that fail should reset their own flags. | |
233 | AC_MSG_RESULT($ENABLE_64BIT_LIBS) | |
234 | ]) | |
235 | ||
236 | dnl Strict compilation options. | |
237 | AC_DEFUN(AC_CHECK_STRICT_COMPILE, | |
238 | [ | |
239 | AC_MSG_CHECKING([whether strict compiling is on]) | |
240 | AC_ARG_ENABLE(strict,[ --enable-strict compile with strict compiler options [default=no]], [ | |
374ca955 A |
241 | if test "$enableval" = no |
242 | then | |
243 | ac_use_strict_options=no | |
b75a7d8f | 244 | else |
374ca955 | 245 | ac_use_strict_options=yes |
b75a7d8f A |
246 | fi |
247 | ], [ac_use_strict_options=no]) | |
248 | AC_MSG_RESULT($ac_use_strict_options) | |
249 | ||
250 | if test "$ac_use_strict_options" = yes | |
251 | then | |
252 | if test "$GCC" = yes | |
253 | then | |
374ca955 | 254 | CFLAGS="$CFLAGS -Wall -ansi -pedantic -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -Winline -Wno-long-long" |
b75a7d8f A |
255 | case "${host}" in |
256 | *-*-solaris*) | |
257 | CFLAGS="$CFLAGS -D__STDC__=0";; | |
258 | esac | |
374ca955 A |
259 | else |
260 | case "${host}" in | |
261 | *-*-cygwin) | |
262 | if test "`$CC /help 2>&1 | head -c9`" = "Microsoft" | |
263 | then | |
264 | CFLAGS="$CFLAGS /W4" | |
265 | fi | |
266 | esac | |
b75a7d8f A |
267 | fi |
268 | if test "$GXX" = yes | |
269 | then | |
374ca955 | 270 | CXXFLAGS="$CXXFLAGS -W -Wall -ansi -pedantic -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -Winline -Wno-long-long" |
b75a7d8f A |
271 | case "${host}" in |
272 | *-*-solaris*) | |
273 | CXXFLAGS="$CXXFLAGS -D__STDC__=0";; | |
274 | esac | |
374ca955 A |
275 | else |
276 | case "${host}" in | |
277 | *-*-cygwin) | |
278 | if test "`$CXX /help 2>&1 | head -c9`" = "Microsoft" | |
279 | then | |
280 | CXXFLAGS="$CXXFLAGS /W4" | |
281 | fi | |
282 | esac | |
b75a7d8f A |
283 | fi |
284 | fi | |
285 | ]) | |
286 | ||
287 | dnl Define a sizeof checking macro that is a bit better than autoconf's | |
288 | dnl builtin (and heavily based on it, of course). The new macro is | |
289 | dnl AC_DO_CHECK_SIZEOF(TYPE [, CROSS_SIZE [, INCLUDES]) | |
290 | AC_DEFUN(AC_DO_CHECK_SIZEOF, | |
291 | [changequote(<<, >>)dnl | |
292 | dnl The name to #define. | |
293 | define(<<AC_TYPE_NAME>>, translit(sizeof_$1, [a-z *], [A-Z_P]))dnl | |
294 | dnl The cache variable name. | |
295 | define(<<AC_CV_NAME>>, translit(ac_cv_sizeof_$1, [ *], [_p]))dnl | |
296 | changequote([, ])dnl | |
297 | AC_MSG_CHECKING(size of $1) | |
298 | AC_CACHE_VAL(AC_CV_NAME, | |
299 | [AC_TRY_RUN($3 | |
300 | [#include <stdio.h> | |
301 | main() | |
302 | { | |
303 | FILE *f=fopen("conftestval", "w"); | |
304 | if (!f) exit(1); | |
305 | fprintf(f, "%d\n", sizeof($1)); | |
306 | exit(0); | |
307 | }], AC_CV_NAME=`cat conftestval`, AC_CV_NAME=0, ifelse([$2], , , AC_CV_NAME=$2))])dnl | |
308 | AC_MSG_RESULT($AC_CV_NAME) | |
309 | AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME) | |
310 | undefine([AC_TYPE_NAME])dnl | |
311 | undefine([AC_CV_NAME])dnl | |
312 | ]) | |
374ca955 | 313 |