]>
Commit | Line | Data |
---|---|---|
b331163b | 1 | # Copyright (c) 1999-2014, International Business Machines Corporation and |
57a6839d A |
2 | # others. All Rights Reserved. |
3 | # acinclude.m4 for ICU | |
4 | # Don't edit aclocal.m4, do edit acinclude.m4 | |
5 | # Stephen F. Booth | |
6 | ||
7 | # @TOP@ | |
8 | ||
9 | # ICU_CHECK_MH_FRAG | |
10 | AC_DEFUN([ICU_CHECK_MH_FRAG], [ | |
11 | AC_CACHE_CHECK( | |
12 | [which Makefile fragment to use for ${host}], | |
13 | [icu_cv_host_frag], | |
14 | [ | |
15 | case "${host}" in | |
16 | *-*-solaris*) | |
17 | if test "$GCC" = yes; then | |
18 | icu_cv_host_frag=mh-solaris-gcc | |
19 | else | |
20 | icu_cv_host_frag=mh-solaris | |
21 | fi ;; | |
22 | alpha*-*-linux-gnu) | |
23 | if test "$GCC" = yes; then | |
24 | icu_cv_host_frag=mh-alpha-linux-gcc | |
25 | else | |
26 | icu_cv_host_frag=mh-alpha-linux-cc | |
27 | fi ;; | |
28 | powerpc*-*-linux*) | |
29 | if test "$GCC" = yes; then | |
30 | icu_cv_host_frag=mh-linux | |
31 | else | |
32 | icu_cv_host_frag=mh-linux-va | |
33 | fi ;; | |
34 | *-*-linux*|*-*-gnu|*-*-k*bsd*-gnu|*-*-kopensolaris*-gnu) icu_cv_host_frag=mh-linux ;; | |
b331163b | 35 | i[[34567]]86-*-cygwin) |
57a6839d | 36 | if test "$GCC" = yes; then |
b331163b A |
37 | icu_cv_host_frag=mh-cygwin |
38 | else | |
39 | icu_cv_host_frag=mh-cygwin-msvc | |
40 | fi ;; | |
41 | x86_64-*-cygwin) | |
42 | if test "$GCC" = yes; then | |
43 | icu_cv_host_frag=mh-cygwin64 | |
44 | else | |
45 | icu_cv_host_frag=mh-cygwin-msvc | |
46 | fi ;; | |
47 | *-*-mingw*) | |
48 | if test "$GCC" = yes; then | |
49 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | |
57a6839d A |
50 | #ifndef __MINGW64__ |
51 | #error This is not MinGW64 | |
b331163b A |
52 | #endif]])], [icu_cv_host_frag=mh-mingw64], |
53 | [icu_cv_host_frag=mh-mingw]) | |
57a6839d | 54 | else |
b331163b A |
55 | case "${host}" in |
56 | *-*-mingw*) icu_cv_host_frag=mh-msys-msvc ;; | |
57 | *-*-cygwin) icu_cv_host_frag=mh-cygwin-msvc ;; | |
58 | esac | |
57a6839d A |
59 | fi ;; |
60 | *-*-*bsd*|*-*-dragonfly*) icu_cv_host_frag=mh-bsd-gcc ;; | |
61 | *-*-aix*) | |
62 | if test "$GCC" = yes; then | |
63 | icu_cv_host_frag=mh-aix-gcc | |
64 | else | |
65 | icu_cv_host_frag=mh-aix-va | |
66 | fi ;; | |
67 | *-*-hpux*) | |
68 | if test "$GCC" = yes; then | |
69 | icu_cv_host_frag=mh-hpux-gcc | |
70 | else | |
71 | case "$CXX" in | |
72 | *aCC) icu_cv_host_frag=mh-hpux-acc ;; | |
73 | esac | |
74 | fi ;; | |
75 | *-*ibm-openedition*|*-*-os390*) icu_cv_host_frag=mh-os390 ;; | |
76 | *-*-os400*) icu_cv_host_frag=mh-os400 ;; | |
77 | *-apple-rhapsody*) icu_cv_host_frag=mh-darwin ;; | |
78 | *-apple-darwin*) icu_cv_host_frag=mh-darwin ;; | |
79 | *-*-beos) icu_cv_host_frag=mh-beos ;; | |
80 | *-*-haiku) icu_cv_host_frag=mh-haiku ;; | |
81 | *-*-irix*) icu_cv_host_frag=mh-irix ;; | |
82 | *-dec-osf*) icu_cv_host_frag=mh-alpha-osf ;; | |
83 | *-*-nto*) icu_cv_host_frag=mh-qnx ;; | |
84 | *-ncr-*) icu_cv_host_frag=mh-mpras ;; | |
85 | *) icu_cv_host_frag=mh-unknown ;; | |
86 | esac | |
87 | ] | |
88 | ) | |
89 | ]) | |
90 | ||
91 | # ICU_CONDITIONAL - similar example taken from Automake 1.4 | |
92 | AC_DEFUN([ICU_CONDITIONAL], | |
93 | [AC_SUBST($1_TRUE) | |
94 | if $2; then | |
95 | $1_TRUE= | |
96 | else | |
97 | $1_TRUE='#' | |
98 | fi]) | |
99 | ||
100 | # ICU_PROG_LINK - Make sure that the linker is usable | |
101 | AC_DEFUN([ICU_PROG_LINK], | |
102 | [ | |
103 | case "${host}" in | |
104 | *-*-cygwin*|*-*-mingw*) | |
105 | if test "$GCC" != yes && test -n "`link --version 2>&1 | grep 'GNU coreutils'`"; then | |
106 | AC_MSG_ERROR([link.exe is not a valid linker. Your PATH is incorrect. | |
107 | Please follow the directions in ICU's readme.]) | |
108 | fi;; | |
109 | *);; | |
110 | esac]) | |
111 | ||
112 | # AC_SEARCH_LIBS_FIRST(FUNCTION, SEARCH-LIBS [, ACTION-IF-FOUND | |
113 | # [, ACTION-IF-NOT-FOUND [, OTHER-LIBRARIES]]]) | |
114 | # Search for a library defining FUNC, then see if it's not already available. | |
115 | ||
116 | AC_DEFUN([AC_SEARCH_LIBS_FIRST], | |
117 | [AC_PREREQ([2.13]) | |
118 | AC_CACHE_CHECK([for library containing $1], [ac_cv_search_$1], | |
119 | [ac_func_search_save_LIBS="$LIBS" | |
120 | ac_cv_search_$1="no" | |
121 | for i in $2; do | |
122 | LIBS="-l$i $5 $ac_func_search_save_LIBS" | |
123 | AC_TRY_LINK_FUNC([$1], | |
124 | [ac_cv_search_$1="-l$i" | |
125 | break]) | |
126 | done | |
127 | if test "$ac_cv_search_$1" = "no"; then | |
128 | AC_TRY_LINK_FUNC([$1], [ac_cv_search_$1="none required"]) | |
129 | fi | |
130 | LIBS="$ac_func_search_save_LIBS"]) | |
131 | if test "$ac_cv_search_$1" != "no"; then | |
132 | test "$ac_cv_search_$1" = "none required" || LIBS="$ac_cv_search_$1 $LIBS" | |
133 | $3 | |
134 | else : | |
135 | $4 | |
136 | fi]) | |
137 | ||
138 | ||
139 | ||
140 | # Check if we can build and use 64-bit libraries | |
141 | AC_DEFUN([AC_CHECK_64BIT_LIBS], | |
142 | [ | |
143 | BITS_REQ=nochange | |
144 | ENABLE_64BIT_LIBS=unknown | |
145 | ## revisit this for cross-compile. | |
146 | ||
147 | AC_ARG_ENABLE(64bit-libs, | |
148 | [ --enable-64bit-libs (deprecated, use --with-library-bits) build 64-bit libraries [default= platform default]], | |
149 | [echo "note, use --with-library-bits instead of --*-64bit-libs" | |
150 | case "${enableval}" in | |
151 | no|false|32) with_library_bits=32; ;; | |
152 | yes|true|64) with_library_bits=64else32 ;; | |
153 | nochange) with_library_bits=nochange; ;; | |
154 | *) AC_MSG_ERROR(bad value ${enableval} for '--*-64bit-libs') ;; | |
155 | esac] ) | |
156 | ||
157 | ||
158 | AC_ARG_WITH(library-bits, | |
159 | [ --with-library-bits=bits specify how many bits to use for the library (32, 64, 64else32, nochange) [default=nochange]], | |
160 | [case "${withval}" in | |
161 | ""|nochange) BITS_REQ=$withval ;; | |
162 | 32|64|64else32) BITS_REQ=$withval ;; | |
163 | *) AC_MSG_ERROR(bad value ${withval} for --with-library-bits) ;; | |
164 | esac]) | |
165 | ||
166 | # don't use these for cross compiling | |
167 | if test "$cross_compiling" = "yes" -a "${BITS_REQ}" != "nochange"; then | |
168 | AC_MSG_ERROR([Don't specify bitness when cross compiling. See readme.html for help with cross compilation., and set compiler options manually.]) | |
169 | fi | |
170 | AC_CHECK_SIZEOF([void *]) | |
171 | AC_MSG_CHECKING([whether runnable 64 bit binaries are built by default]) | |
172 | case $ac_cv_sizeof_void_p in | |
173 | 8) DEFAULT_64BIT=yes ;; | |
174 | 4) DEFAULT_64BIT=no ;; | |
175 | *) DEFAULT_64BIT=unknown | |
176 | esac | |
177 | BITS_GOT=unknown | |
178 | ||
179 | # 'OK' here means, we can exit any further checking, everything's copa | |
180 | BITS_OK=yes | |
181 | ||
182 | # do we need to check for buildable/runnable 32 or 64 bit? | |
183 | BITS_CHECK_32=no | |
184 | BITS_CHECK_64=no | |
185 | ||
186 | # later, can we run the 32/64 bit binaries so made? | |
187 | BITS_RUN_32=no | |
188 | BITS_RUN_64=no | |
189 | ||
190 | if test "$DEFAULT_64BIT" = "yes"; then | |
191 | # we get 64 bits by default. | |
192 | BITS_GOT=64 | |
193 | case "$BITS_REQ" in | |
194 | 32) | |
195 | # need to look for 32 bit support. | |
196 | BITS_CHECK_32=yes | |
197 | # not copa. | |
198 | BITS_OK=no;; | |
199 | # everyone else is happy. | |
200 | nochange) ;; | |
201 | *) ;; | |
202 | esac | |
203 | elif test "$DEFAULT_64BIT" = "no"; then | |
204 | # not 64 bit by default. | |
205 | BITS_GOT=32 | |
206 | case "$BITS_REQ" in | |
207 | 64|64else32) | |
208 | BITS_CHECK_64=yes | |
209 | #BITS_CHECK_32=yes | |
210 | BITS_OK=no;; | |
211 | nochange) ;; | |
212 | *) ;; | |
213 | esac | |
214 | elif test "$DEFAULT_64BIT" = "unknown"; then | |
215 | # cross compiling. | |
216 | BITS_GOT=unknown | |
217 | case "$BITS_REQ" in | |
218 | 64|64else32) BITS_OK=no | |
219 | BITS_CHECK_32=yes | |
220 | BITS_CHECK_64=yes ;; | |
221 | 32) BITS_OK=no;; | |
222 | nochange) ;; | |
223 | *) ;; | |
224 | esac | |
225 | fi | |
226 | ||
227 | AC_MSG_RESULT($DEFAULT_64BIT); | |
228 | ||
229 | if test "$BITS_OK" != "yes"; then | |
230 | # not copa. back these up. | |
231 | CFLAGS_OLD="${CFLAGS}" | |
232 | CXXFLAGS_OLD="${CXXFLAGS}" | |
233 | LDFLAGS_OLD="${LDFLAGS}" | |
234 | ARFLAGS_OLD="${ARFLAGS}" | |
235 | ||
236 | CFLAGS_32="${CFLAGS}" | |
237 | CXXFLAGS_32="${CXXFLAGS}" | |
238 | LDFLAGS_32="${LDFLAGS}" | |
239 | ARFLAGS_32="${ARFLAGS}" | |
240 | ||
241 | CFLAGS_64="${CFLAGS}" | |
242 | CXXFLAGS_64="${CXXFLAGS}" | |
243 | LDFLAGS_64="${LDFLAGS}" | |
244 | ARFLAGS_64="${ARFLAGS}" | |
245 | ||
246 | CAN_BUILD_64=unknown | |
247 | CAN_BUILD_32=unknown | |
248 | # These results can't be cached because is sets compiler flags. | |
249 | if test "$BITS_CHECK_64" = "yes"; then | |
250 | AC_MSG_CHECKING([how to build 64-bit executables]) | |
251 | CAN_BUILD_64=no | |
252 | #### | |
253 | # Find out if we think we can *build* for 64 bit. Doesn't check whether we can run it. | |
254 | # Note, we don't have to actually check if the options work- we'll try them before using them. | |
255 | # So, only try actually testing the options, if you are trying to decide between multiple options. | |
256 | # On exit from the following clauses: | |
257 | # if CAN_BUILD_64=yes: | |
258 | # *FLAGS are assumed to contain the right settings for 64bit | |
259 | # else if CAN_BUILD_64=no: (default) | |
260 | # *FLAGS are assumed to be trashed, and will be reset from *FLAGS_OLD | |
261 | ||
262 | if test "$GCC" = yes; then | |
263 | CFLAGS="${CFLAGS} -m64" | |
264 | CXXFLAGS="${CXXFLAGS} -m64" | |
265 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([int main(void) {return (sizeof(void*)*8==64)?0:1;}])], | |
266 | CAN_BUILD_64=yes, CAN_BUILD_64=no) | |
267 | else | |
268 | case "${host}" in | |
269 | sparc*-*-solaris*) | |
270 | # 1. try -m64 | |
271 | CFLAGS="${CFLAGS} -m64" | |
272 | CXXFLAGS="${CXXFLAGS} -m64" | |
273 | AC_RUN_IFELSE([AC_LANG_SOURCE([int main(void) {return (sizeof(void*)*8==64)?0:1;}])], | |
274 | CAN_BUILD_64=yes, CAN_BUILD_64=no, CAN_BUILD_64=unknown) | |
275 | if test "$CAN_BUILD_64" != yes; then | |
276 | # Nope. back out changes. | |
277 | CFLAGS="${CFLAGS_OLD}" | |
b331163b | 278 | CXXFLAGS="${CXXFLAGS_OLD}" |
57a6839d A |
279 | # 2. try xarch=v9 [deprecated] |
280 | ## TODO: cross compile: the following won't work. | |
281 | SPARCV9=`isainfo -n 2>&1 | grep sparcv9` | |
282 | SOL64=`$CXX -xarch=v9 2>&1 && $CC -xarch=v9 2>&1 | grep -v usage:` | |
283 | # "Warning: -xarch=v9 is deprecated, use -m64 to create 64-bit programs" | |
284 | if test -z "$SOL64" && test -n "$SPARCV9"; then | |
285 | CFLAGS="${CFLAGS} -xtarget=ultra -xarch=v9" | |
286 | CXXFLAGS="${CXXFLAGS} -xtarget=ultra -xarch=v9" | |
287 | LDFLAGS="${LDFLAGS} -xtarget=ultra -xarch=v9" | |
288 | CAN_BUILD_64=yes | |
289 | fi | |
290 | fi | |
291 | ;; | |
292 | i386-*-solaris*) | |
293 | # 1. try -m64 | |
294 | CFLAGS="${CFLAGS} -m64" | |
295 | CXXFLAGS="${CXXFLAGS} -m64" | |
296 | AC_RUN_IFELSE([AC_LANG_SOURCE([int main(void) {return (sizeof(void*)*8==64)?0:1;}])], | |
297 | CAN_BUILD_64=yes, CAN_BUILD_64=no, CAN_BUILD_64=unknown) | |
298 | if test "$CAN_BUILD_64" != yes; then | |
299 | # Nope. back out changes. | |
300 | CFLAGS="${CFLAGS_OLD}" | |
301 | CXXFLAGS="${CXXFLAGS_OLD}" | |
302 | # 2. try the older compiler option | |
303 | ## TODO: cross compile problem | |
304 | AMD64=`isainfo -n 2>&1 | grep amd64` | |
305 | SOL64=`$CXX -xtarget=generic64 2>&1 && $CC -xtarget=generic64 2>&1 | grep -v usage:` | |
306 | if test -z "$SOL64" && test -n "$AMD64"; then | |
307 | CFLAGS="${CFLAGS} -xtarget=generic64" | |
308 | CXXFLAGS="${CXXFLAGS} -xtarget=generic64" | |
309 | CAN_BUILD_64=yes | |
310 | fi | |
311 | fi | |
312 | ;; | |
313 | ia64-*-linux*) | |
314 | # check for ecc/ecpc compiler support | |
315 | ## TODO: cross compiler problem | |
316 | if test -n "`$CXX --help 2>&1 && $CC --help 2>&1 | grep -v Intel`"; then | |
317 | if test -n "`$CXX --help 2>&1 && $CC --help 2>&1 | grep -v Itanium`"; then | |
318 | CAN_BUILD_64=yes | |
319 | fi | |
320 | fi | |
321 | ;; | |
322 | *-*-cygwin) | |
323 | # vcvarsamd64.bat should have been used to enable 64-bit builds. | |
324 | # We only do this check to display the correct answer. | |
325 | ## TODO: cross compiler problem | |
326 | if test -n "`$CXX -help 2>&1 | grep 'for x64'`"; then | |
327 | CAN_BUILD_64=yes | |
328 | fi | |
329 | ;; | |
330 | *-*-aix*|powerpc64-*-linux*) | |
331 | CFLAGS="${CFLAGS} -q64" | |
332 | CXXFLAGS="${CXXFLAGS} -q64" | |
333 | LDFLAGS="${LDFLAGS} -q64" | |
334 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([int main(void) {return (sizeof(void*)*8==64)?0:1;}])], | |
335 | CAN_BUILD_64=yes, CAN_BUILD_64=no) | |
336 | if test "$CAN_BUILD_64" = yes; then | |
337 | # worked- set other options. | |
338 | case "${host}" in | |
339 | *-*-aix*) | |
340 | # tell AIX what executable mode to use. | |
341 | ARFLAGS="${ARFLAGS} -X64" | |
342 | esac | |
343 | fi | |
344 | ;; | |
345 | *-*-hpux*) | |
346 | # First we try the newer +DD64, if that doesn't work, | |
347 | # try other options. | |
348 | ||
349 | CFLAGS="${CFLAGS} +DD64" | |
350 | CXXFLAGS="${CXXFLAGS} +DD64" | |
351 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([int main(void) {return (sizeof(void*)*8==64)?0:1;}])], | |
352 | CAN_BUILD_64=yes, CAN_BUILD_64=no) | |
353 | if test "$CAN_BUILD_64" != yes; then | |
354 | # reset | |
355 | CFLAGS="${CFLAGS_OLD}" | |
356 | CXXFLAGS="${CXXFLAGS_OLD}" | |
357 | # append | |
358 | CFLAGS="${CFLAGS} +DA2.0W" | |
359 | CXXFLAGS="${CXXFLAGS} +DA2.0W" | |
360 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([int main(void) {return (sizeof(void*)*8==64)?0:1;}])], | |
361 | CAN_BUILD_64=yes, CAN_BUILD_64=no) | |
362 | fi | |
363 | ;; | |
364 | *-*ibm-openedition*|*-*-os390*) | |
365 | CFLAGS="${CFLAGS} -Wc,lp64" | |
366 | CXXFLAGS="${CXXFLAGS} -Wc,lp64" | |
367 | LDFLAGS="${LDFLAGS} -Wl,lp64" | |
368 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([int main(void) {return (sizeof(void*)*8==64)?0:1;}])], | |
369 | CAN_BUILD_64=yes, CAN_BUILD_64=no) | |
370 | ;; | |
371 | *) | |
372 | # unknown platform. | |
373 | ;; | |
374 | esac | |
375 | fi | |
376 | AC_MSG_RESULT($CAN_BUILD_64) | |
377 | if test "$CAN_BUILD_64" = yes; then | |
378 | AC_MSG_CHECKING([whether runnable 64-bit binaries are being built ]) | |
379 | AC_RUN_IFELSE([AC_LANG_SOURCE([int main(void) {return (sizeof(void*)*8==64)?0:1;}])], | |
380 | BITS_RUN_64=yes, BITS_RUN_64=no, BITS_RUN_64=unknown) | |
381 | AC_MSG_RESULT($BITS_RUN_64); | |
382 | ||
383 | CFLAGS_64="${CFLAGS}" | |
384 | CXXFLAGS_64="${CXXFLAGS}" | |
385 | LDFLAGS_64="${LDFLAGS}" | |
386 | ARFLAGS_64="${ARFLAGS}" | |
387 | fi | |
388 | # put it back. | |
389 | CFLAGS="${CFLAGS_OLD}" | |
390 | CXXFLAGS="${CXXFLAGS_OLD}" | |
391 | LDFLAGS="${LDFLAGS_OLD}" | |
392 | ARFLAGS="${ARFLAGS_OLD}" | |
393 | fi | |
394 | if test "$BITS_CHECK_32" = "yes"; then | |
395 | # see comment under 'if BITS_CHECK_64', above. | |
396 | AC_MSG_CHECKING([how to build 32-bit executables]) | |
397 | if test "$GCC" = yes; then | |
398 | CFLAGS="${CFLAGS} -m32" | |
399 | CXXFLAGS="${CXXFLAGS} -m32" | |
400 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([int main(void) {return (sizeof(void*)*8==32)?0:1;}])], | |
401 | CAN_BUILD_32=yes, CAN_BUILD_32=no) | |
402 | fi | |
403 | AC_MSG_RESULT($CAN_BUILD_32) | |
404 | if test "$CAN_BUILD_32" = yes; then | |
405 | AC_MSG_CHECKING([whether runnable 32-bit binaries are being built ]) | |
406 | AC_RUN_IFELSE([AC_LANG_SOURCE([int main(void) {return (sizeof(void*)*8==32)?0:1;}])], | |
407 | BITS_RUN_32=yes, BITS_RUN_32=no, BITS_RUN_32=unknown) | |
408 | AC_MSG_RESULT($BITS_RUN_32); | |
409 | CFLAGS_32="${CFLAGS}" | |
410 | CXXFLAGS_32="${CXXFLAGS}" | |
411 | LDFLAGS_32="${LDFLAGS}" | |
412 | ARFLAGS_32="${ARFLAGS}" | |
413 | fi | |
414 | # put it back. | |
415 | CFLAGS="${CFLAGS_OLD}" | |
416 | CXXFLAGS="${CXXFLAGS_OLD}" | |
417 | LDFLAGS="${LDFLAGS_OLD}" | |
418 | ARFLAGS="${ARFLAGS_OLD}" | |
419 | fi | |
420 | ||
421 | ## | |
422 | # OK. Now, we've tested for 32 and 64 bitness. Let's see what we'll do. | |
423 | # | |
424 | ||
425 | # First, implement 64else32 | |
426 | if test "$BITS_REQ" = "64else32"; then | |
427 | if test "$BITS_RUN_64" = "yes"; then | |
428 | BITS_REQ=64 | |
429 | else | |
430 | # no changes. | |
431 | BITS_OK=yes | |
432 | fi | |
433 | fi | |
434 | ||
435 | # implement. | |
436 | if test "$BITS_REQ" = "32" -a "$BITS_RUN_32" = "yes"; then | |
437 | CFLAGS="${CFLAGS_32}" | |
438 | CXXFLAGS="${CXXFLAGS_32}" | |
439 | LDFLAGS="${LDFLAGS_32}" | |
440 | ARFLAGS="${ARFLAGS_32}" | |
441 | BITS_OK=yes | |
442 | elif test "$BITS_REQ" = "64" -a "$BITS_RUN_64" = "yes"; then | |
443 | CFLAGS="${CFLAGS_64}" | |
444 | CXXFLAGS="${CXXFLAGS_64}" | |
445 | LDFLAGS="${LDFLAGS_64}" | |
446 | ARFLAGS="${ARFLAGS_64}" | |
447 | BITS_OK=yes | |
448 | elif test "$BITS_OK" != "yes"; then | |
449 | AC_MSG_ERROR([Requested $BITS_REQ bit binaries but could not compile and execute them. See readme.html for help with cross compilation., and set compiler options manually.]) | |
450 | fi | |
451 | fi | |
452 | ]) | |
453 | ||
454 | # Strict compilation options. | |
455 | AC_DEFUN([AC_CHECK_STRICT_COMPILE], | |
456 | [ | |
457 | AC_MSG_CHECKING([whether strict compiling is on]) | |
458 | AC_ARG_ENABLE(strict,[ --enable-strict compile with strict compiler options [default=yes]], [ | |
459 | if test "$enableval" = no | |
460 | then | |
461 | ac_use_strict_options=no | |
462 | else | |
463 | ac_use_strict_options=yes | |
464 | fi | |
465 | ], [ac_use_strict_options=yes]) | |
466 | AC_MSG_RESULT($ac_use_strict_options) | |
467 | ||
468 | if test "$ac_use_strict_options" = yes | |
469 | then | |
470 | if test "$GCC" = yes | |
471 | then | |
472 | case "${host}" in | |
57a6839d A |
473 | *) |
474 | # Do not use -ansi. It limits us to C90, and it breaks some platforms. | |
475 | # We use -std=c99 to disable the gnu99 defaults and its associated warnings | |
476 | CFLAGS="$CFLAGS -std=c99" | |
477 | ;; | |
478 | esac | |
479 | ||
480 | CFLAGS="$CFLAGS -Wall -pedantic -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings" | |
481 | else | |
482 | case "${host}" in | |
483 | *-*-cygwin) | |
484 | if test "`$CC /help 2>&1 | head -c9`" = "Microsoft" | |
485 | then | |
486 | CFLAGS="$CFLAGS /W4" | |
b331163b A |
487 | fi ;; |
488 | *-*-mingw*) | |
489 | CFLAGS="$CFLAGS -W4" ;; | |
57a6839d A |
490 | esac |
491 | fi | |
492 | if test "$GXX" = yes | |
493 | then | |
494 | CXXFLAGS="$CXXFLAGS -W -Wall -pedantic -Wpointer-arith -Wwrite-strings -Wno-long-long" | |
495 | else | |
496 | case "${host}" in | |
497 | *-*-cygwin) | |
498 | if test "`$CXX /help 2>&1 | head -c9`" = "Microsoft" | |
499 | then | |
500 | CXXFLAGS="$CXXFLAGS /W4" | |
b331163b A |
501 | fi ;; |
502 | *-*-mingw*) | |
503 | CFLAGS="$CFLAGS -W4" ;; | |
57a6839d A |
504 | esac |
505 | fi | |
506 | fi | |
507 | ]) | |
508 | ||
509 |