]>
Commit | Line | Data |
---|---|---|
b75a7d8f A |
1 | dnl -*-m4-*- |
2 | dnl configure.in for ICU | |
3 | dnl Copyright (c) 1999-2003, International Business Machines Corporation and | |
4 | dnl others. All Rights Reserved. | |
5 | dnl Stephen F. Booth, heavily modified by Yves and others | |
6 | ||
7 | dnl $Id: configure.in,v 1.1.1.2 2003/07/03 18:13:30 avery Exp $ | |
8 | ||
9 | dnl Process this file with autoconf to produce a configure script | |
10 | AC_INIT(common/unicode/utypes.h) | |
11 | ||
12 | AC_CONFIG_HEADER(common/icucfg.h) | |
13 | PACKAGE="icu" | |
14 | AC_SUBST(PACKAGE) | |
15 | ||
16 | AC_MSG_CHECKING(for ICU version numbers) | |
17 | ||
18 | dnl Get the ICU version from uversion.h or other headers | |
19 | geticuversion() { | |
20 | [sed -n 's/^[ ]*#[ ]*define[ ]*U_ICU_VERSION[ ]*"\([^"]*\)".*/\1/p' "$@"] | |
21 | } | |
22 | VERSION=`geticuversion $srcdir/common/unicode/uversion.h` | |
23 | if test x"$VERSION" = x; then | |
24 | VERSION=`geticuversion $srcdir/common/unicode/*.h` | |
25 | if test x"$VERSION" = x; then | |
26 | AC_MSG_ERROR([Cannot determine ICU version number from header files]) | |
27 | fi | |
28 | fi | |
29 | dnl Compute a reasonable library version from the release version. This is | |
30 | dnl very bad, but that's wanted... We want to make sure that the LIB_VERSION | |
31 | dnl has at least a dot in it, so we'll add a .0 if needed. | |
32 | [LIB_VERSION=`echo $VERSION | sed -e 's/\.//' -e 's/^\([^.]*\)$/\1.0/'`] | |
33 | LIB_VERSION_MAJOR=`echo $LIB_VERSION | sed 's/\..*//'` | |
34 | AC_SUBST(VERSION) | |
35 | AC_SUBST(LIB_VERSION) | |
36 | AC_SUBST(LIB_VERSION_MAJOR) | |
37 | AC_MSG_RESULT([release $VERSION, library $LIB_VERSION]) | |
38 | ||
39 | UNICODE_VERSION="4" | |
40 | AC_SUBST(UNICODE_VERSION) | |
41 | ||
42 | AC_SUBST(CPPFLAGS) | |
43 | ||
44 | dnl Checks for programs | |
45 | AC_PROG_CC | |
46 | AC_PROG_CXX | |
47 | AC_PROG_INSTALL | |
48 | ||
49 | # make sure install is relative to srcdir - if a script | |
50 | if test "$srcdir" = "."; then | |
51 | # If srcdir isn't just ., then (srcdir) is already prepended. | |
52 | if test "${ac_install_sh}" = "${INSTALL}"; then | |
53 | INSTALL="\\\$(top_srcdir)/${ac_install_sh}" | |
54 | fi | |
55 | fi | |
56 | ||
57 | AC_CHECK_PROG(AUTOCONF, autoconf, autoconf, true) | |
58 | AC_CHECK_PROG(STRIP, strip, strip, true) | |
59 | ||
60 | dnl Check for the platform make | |
61 | AC_PATH_PROGS(U_MAKE, gmake gnumake, make) | |
62 | AC_SUBST(U_MAKE) | |
63 | ||
64 | dnl Check for doxygen to generate documentation | |
65 | AC_PATH_PROG(DOXYGEN,doxygen,,$PATH:/usr/local/bin:/usr/bin) | |
66 | ||
67 | dnl Determine the host system and Makefile fragment | |
68 | AC_CANONICAL_HOST | |
69 | AC_EXEEXT | |
70 | ||
71 | dnl Determine how strict we want to be when compiling | |
72 | AC_CHECK_STRICT_COMPILE | |
73 | ||
74 | dnl Check if we can build and use 64-bit libraries | |
75 | AC_CHECK_64BIT_LIBS | |
76 | AC_SUBST(ARFLAGS) | |
77 | AC_SUBST(COMPILE_LINK_ENVVAR) | |
78 | ||
79 | ICU_CHECK_MH_FRAG | |
80 | ||
81 | hpuxcma=false | |
82 | ||
83 | dnl Checks for libraries and other host specific stuff | |
84 | dnl On HP/UX, don't link to -lm from a shared lib because it isn't | |
85 | dnl PIC (at least on 10.2) | |
86 | case "${host}" in | |
87 | *-*-hpux10*) hpuxcma=true | |
88 | AC_CHECK_LIB(m, floor, LIB_M="-lm") ;; | |
89 | *-*-hpux*) AC_CHECK_LIB(m, floor, LIB_M="-lm") ;; | |
90 | ||
91 | *) AC_CHECK_LIB(m, floor) | |
92 | LIB_M="" ;; | |
93 | esac | |
94 | AC_SUBST(LIB_M) | |
95 | ||
96 | dnl Enable/disable hpuxcma | |
97 | ||
98 | if test $hpuxcma = false; then | |
99 | AC_ARG_ENABLE(hpuxcma, | |
100 | [ --enable-hpuxcma build ICU with HPUX CMA threads (only ver>=11) [default=no]], | |
101 | [case "${enableval}" in | |
102 | yes) hpuxcma=true;; | |
103 | no) hpuxcma=false;; | |
104 | *) AC_MSG_ERROR(bad value ${enableval} for --enable-hpuxcma) ;; | |
105 | esac], | |
106 | ) | |
107 | fi | |
108 | ||
109 | dnl Note, we set the conditional outside of IF for non hpux plats | |
110 | ICU_CONDITIONAL(HPUX_CMA, test "$hpuxcma" = true) | |
111 | ||
112 | dnl Should this be a nested CASE? | |
113 | if test $hpuxcma = true; then | |
114 | case "${host}" in | |
115 | *-*-hpux*) hpuxcma=true ;; | |
116 | *) AC_MSG_ERROR(--enable-hpuxcma is not valid on this platform ${host}) ;; | |
117 | esac | |
118 | fi | |
119 | ||
120 | dnl Check whether to build shared libraries | |
121 | AC_MSG_CHECKING([whether to build shared libraries]) | |
122 | enabled=no | |
123 | AC_ARG_ENABLE(shared, | |
124 | [ --enable-shared[=PKGS] build shared libraries [default=yes]], | |
125 | [ case "${enableval}" in | |
126 | yes|"") enabled=yes; ENABLE_SHARED=YES ;; | |
127 | no);; | |
128 | *) ;; | |
129 | esac], | |
130 | [enabled=yes; ENABLE_SHARED=YES] | |
131 | ) | |
132 | AC_MSG_RESULT($enabled) | |
133 | AC_SUBST(ENABLE_SHARED) | |
134 | ||
135 | dnl Check whether to build static libraries | |
136 | AC_MSG_CHECKING([whether to build static libraries]) | |
137 | enabled=no | |
138 | AC_ARG_ENABLE(static, | |
139 | [ --enable-static[=PKGS] build static libraries [default=no]], | |
140 | [ case "${enableval}" in | |
141 | yes|"") enabled=yes; ENABLE_STATIC=YES ;; | |
142 | no) ;; | |
143 | *) ;; | |
144 | esac], | |
145 | ) | |
146 | AC_MSG_RESULT($enabled) | |
147 | AC_SUBST(ENABLE_STATIC) | |
148 | ||
149 | AC_PROG_RANLIB | |
150 | AC_PATH_PROG(AR,ar,[echo archiver ar not found re-run configure ; false],$PATH:/bin:/usr/bin:/usr/ccs/bin) | |
151 | ||
152 | AC_MSG_CHECKING([whether to enable renaming of symbols]) | |
153 | enabled=yes | |
154 | U_DISABLE_RENAMING=0 | |
155 | AC_ARG_ENABLE(renaming, | |
156 | [ --enable-renaming add a version suffix to symbols [default=yes]], | |
157 | [ case "${enableval}" in | |
158 | yes|"") enabled=yes ;; | |
159 | no) enabled=no; U_DISABLE_RENAMING=1 ;; | |
160 | *) ;; | |
161 | esac], | |
162 | ) | |
163 | AC_MSG_RESULT($enabled) | |
164 | AC_SUBST(U_DISABLE_RENAMING) | |
165 | ||
166 | dnl Check whether to use the evil rpath or not | |
167 | AC_ARG_ENABLE(rpath, | |
168 | [ --enable-rpath use rpath when linking [default is only if necessary]], | |
169 | [ case "${enableval}" in | |
170 | yes|"") ENABLE_RPATH=YES ;; | |
171 | no) ;; | |
172 | *) ;; | |
173 | esac], | |
174 | [ENABLE_RPATH=NO] | |
175 | ) | |
176 | AC_SUBST(ENABLE_RPATH) | |
177 | ||
178 | ||
179 | dnl set up U_INLINE. | |
180 | dnl Copy the definition of AC_C_INLINE, with slight mods. | |
181 | dnl | |
182 | AC_CACHE_CHECK([for definition of U_INLINE for C], ac_cv_c_inline, | |
183 | [ac_cv_c_inline=no | |
184 | for ac_kw in inline __inline__ __inline; do | |
185 | AC_TRY_COMPILE(, [} $ac_kw foo() {], [ac_cv_c_inline=$ac_kw; break]) | |
186 | done | |
187 | ]) | |
188 | case "$ac_cv_c_inline" in | |
189 | yes) U_INLINE= "inline" ;; | |
190 | no ) U_INLINE= ;; | |
191 | *) U_INLINE=$ac_cv_c_inline ;; | |
192 | esac | |
193 | AC_SUBST(U_INLINE) | |
194 | ||
195 | threads=true | |
196 | ||
197 | dnl Enable/disable threads | |
198 | AC_ARG_ENABLE(threads, | |
199 | [ --enable-threads build ICU with threads [default=yes]], | |
200 | [case "${enableval}" in | |
201 | yes) threads=true ;; | |
202 | no) threads=false ;; | |
203 | *) AC_MSG_ERROR(bad value ${enableval} for --enable-threads) ;; | |
204 | esac], | |
205 | threads=true) | |
206 | ICU_CONDITIONAL(THREADS, test "$threads" = true) | |
207 | ||
208 | ICU_USE_THREADS=0 | |
209 | ||
210 | if test $threads = true; then | |
211 | dnl Test for HPUX cma threads first.. | |
212 | if test $hpuxcma = true; then | |
213 | dnl HPUX cma case | |
214 | AC_CHECK_LIB(cma, pthread_create) | |
215 | if test $ac_cv_lib_cma_pthread_create = yes; then | |
216 | ICU_USE_THREADS=1 | |
217 | fi | |
218 | else | |
219 | dnl For Compaq Tru64 (OSF1), we must look for pthread_attr_init | |
220 | dnl and must do this before seaching for pthread_mutex_destroy, or | |
221 | dnl we will pick up libpthreads.so not libpthread.so | |
222 | dnl If this fails, then we must test for HPUX specials, before | |
223 | dnl moving on to a more generic test | |
224 | ||
225 | AC_CHECK_LIB(pthread, pthread_attr_init) | |
226 | if test $ac_cv_lib_pthread_pthread_attr_init = yes; then | |
227 | ICU_USE_THREADS=1 | |
228 | else | |
229 | dnl Locate the right library for POSIX threads. We look for the | |
230 | dnl symbols in the libraries first, because on Solaris libc provides | |
231 | dnl pthread_create but libpthread has the real code :( | |
232 | dnl AIX uses libpthreads instead of libpthread, and HP/UX uses libcma | |
233 | dnl (but that was checked above). | |
234 | dnl FreeBSD users may need libpthread if they do not have libc_r. | |
235 | ||
236 | AC_SEARCH_LIBS_FIRST(pthread_mutex_destroy, pthread pthreads c_r cma) | |
237 | ||
238 | if test "$ac_cv_search_pthread_mutex_destroy" != no; then | |
239 | ICU_USE_THREADS=1 | |
240 | else | |
241 | dnl For HP 11 | |
242 | AC_CHECK_LIB(pthread, pthread_mutex_init) | |
243 | if test $ac_cv_lib_pthread_pthread_mutex_init = yes; then | |
244 | ICU_USE_THREADS=1 | |
245 | fi | |
246 | fi | |
247 | ||
248 | AC_CHECK_FUNC(pthread_mutex_lock) | |
249 | ||
250 | if test $ac_cv_func_pthread_mutex_lock = yes; then | |
251 | ICU_USE_THREADS=1 | |
252 | fi | |
253 | fi | |
254 | fi | |
255 | fi | |
256 | ||
257 | AC_SUBST(ICU_USE_THREADS) | |
258 | ||
259 | dnl Check for mmap() | |
260 | ||
261 | # The AC_FUNC_MMAP macro doesn't work properly. It seems to be too specific. | |
262 | # Do this check instead. | |
263 | HAVE_MMAP=0 | |
264 | AC_MSG_CHECKING([for mmap]) | |
265 | AC_CACHE_VAL(ac_cv_func_mmap_ok, | |
266 | [AC_TRY_LINK( | |
267 | changequote(<<, >>)dnl | |
268 | << | |
269 | #include <unistd.h> | |
270 | #include <sys/mman.h> | |
271 | #include <sys/stat.h> | |
272 | #include <fcntl.h> | |
273 | >>, | |
274 | changequote([, ])dnl | |
275 | [mmap((void *)0, 0, PROT_READ, 0, 0, 0);], | |
276 | ac_cv_func_mmap_ok=yes, | |
277 | ac_cv_func_mmap_ok=no)] ) | |
278 | AC_MSG_RESULT($ac_cv_func_mmap_ok) | |
279 | if test $ac_cv_func_mmap_ok = yes | |
280 | then | |
281 | HAVE_MMAP=1 | |
282 | fi | |
283 | AC_SUBST(HAVE_MMAP) | |
284 | ||
285 | dnl Checks for header files | |
286 | AC_CHECK_HEADERS(inttypes.h) | |
287 | if test $ac_cv_header_inttypes_h = no; then | |
288 | U_HAVE_INTTYPES_H=0 | |
289 | else | |
290 | U_HAVE_INTTYPES_H=1 | |
291 | fi | |
292 | if test "$CC" = ccc; then | |
293 | AC_MSG_RESULT("C compiler set to CCC ${CC}" ) | |
294 | case "${host}" in | |
295 | alpha*-*-*) U_HAVE_INTTYPES_H=0; | |
296 | esac | |
297 | fi | |
298 | ||
299 | AC_SUBST(U_HAVE_INTTYPES_H) | |
300 | ||
301 | AC_ARG_WITH(iostream, | |
302 | [ --with-iostream=version specify the version of iostream to use (none, old, std, auto) [default=auto]], | |
303 | [case "${withval}" in | |
304 | none) streams=none ;; | |
305 | old) streams=198506 ;; | |
306 | std) streams=199711 ;; | |
307 | auto) streams= ;; | |
308 | *) AC_MSG_ERROR(bad value ${withval} for --with-iostream) ;; | |
309 | esac], | |
310 | [streams=]) | |
311 | ||
312 | U_IOSTREAM_SOURCE=0 | |
313 | if test x$streams != xnone | |
314 | then | |
315 | AC_LANG_SAVE | |
316 | AC_LANG_CPLUSPLUS | |
317 | AC_MSG_CHECKING([iostream usability]) | |
318 | AC_TRY_COMPILE([#include <iostream>],[], | |
319 | [ac_cv_header_iostream=yes],[ac_cv_header_iostream=no]) | |
320 | AC_MSG_RESULT($ac_cv_header_iostream) | |
321 | if test $ac_cv_header_iostream = yes | |
322 | then | |
323 | U_IOSTREAM_SOURCE=199711 | |
324 | else | |
325 | AC_CHECK_HEADER(iostream.h) | |
326 | if test $ac_cv_header_iostream_h = yes; then | |
327 | AC_MSG_CHECKING([whether ostream is really defined]) | |
328 | AC_CACHE_VAL(ac_cv_iostream_ok, | |
329 | AC_TRY_LINK([#include <iostream.h>],[ostream &testout = cout; testout << "test" << endl;],ac_cv_iostream_ok=yes,ac_cv_iostream_ok=no)) | |
330 | AC_MSG_RESULT($ac_cv_iostream_ok) | |
331 | if test $ac_cv_iostream_ok = yes | |
332 | then | |
333 | U_IOSTREAM_SOURCE=198506 | |
334 | fi | |
335 | fi | |
336 | fi | |
337 | if test x$streams != x | |
338 | then | |
339 | if test $U_IOSTREAM_SOURCE -ge $streams | |
340 | then | |
341 | U_IOSTREAM_SOURCE=$streams | |
342 | else | |
343 | AC_MSG_ERROR(${withval} iostream is not available) | |
344 | fi | |
345 | fi | |
346 | fi | |
347 | AC_SUBST(U_IOSTREAM_SOURCE) | |
348 | AC_LANG_RESTORE | |
349 | ||
350 | dnl Check for endianness | |
351 | AC_C_BIGENDIAN() | |
352 | if test $ac_cv_c_bigendian = no; then | |
353 | U_IS_BIG_ENDIAN=0 | |
354 | U_ENDIAN_CHAR="l" | |
355 | else | |
356 | U_IS_BIG_ENDIAN=1 | |
357 | U_ENDIAN_CHAR="b" | |
358 | fi | |
359 | AC_SUBST(U_IS_BIG_ENDIAN) | |
360 | ||
361 | dnl Do various POSIX related checks | |
362 | U_HAVE_NL_LANGINFO_CODESET=0 | |
363 | U_NL_LANGINFO_CODESET=-1 | |
364 | AC_CHECK_FUNC(nl_langinfo,[U_HAVE_NL_LANGINFO=1],[U_HAVE_NL_LANGINFO=0]) | |
365 | AC_SUBST(U_HAVE_NL_LANGINFO) | |
366 | if test $U_HAVE_NL_LANGINFO -eq 1; then | |
367 | AC_CACHE_CHECK([for nl_langinfo's argument to obtain the codeset], | |
368 | ac_cv_nl_langinfo_codeset, | |
369 | [ac_cv_nl_langinfo_codeset="unknown" | |
370 | for a in CODESET _NL_CTYPE_CODESET_NAME; do | |
371 | AC_TRY_LINK([#include <langinfo.h>],[nl_langinfo($a);],[ac_cv_nl_langinfo_codeset="$a"; break])] | |
372 | done) | |
373 | if test x$ac_cv_nl_langinfo_codeset != xunknown | |
374 | then | |
375 | U_HAVE_NL_LANGINFO_CODESET=1 | |
376 | U_NL_LANGINFO_CODESET=$ac_cv_nl_langinfo_codeset | |
377 | fi | |
378 | fi | |
379 | AC_SUBST(U_HAVE_NL_LANGINFO_CODESET) | |
380 | AC_SUBST(U_NL_LANGINFO_CODESET) | |
381 | ||
382 | dnl Namespace support checks | |
383 | AC_LANG_CPLUSPLUS | |
384 | AC_MSG_CHECKING([for namespace support]) | |
385 | AC_CACHE_VAL(ac_cv_namespace_ok, | |
386 | [AC_TRY_LINK( | |
387 | changequote(<<, >>)dnl | |
388 | <<namespace x_version {void f(){}}; | |
389 | namespace x = x_version; | |
390 | using namespace x_version; | |
391 | >>, | |
392 | changequote([, ])dnl | |
393 | [f();], ac_cv_namespace_ok=yes, ac_cv_namespace_ok=no)] ) | |
394 | AC_MSG_RESULT($ac_cv_namespace_ok) | |
395 | U_HAVE_NAMESPACE=1 | |
396 | if test $ac_cv_namespace_ok = no | |
397 | then | |
398 | U_HAVE_NAMESPACE=0 | |
399 | fi | |
400 | AC_SUBST(U_HAVE_NAMESPACE) | |
401 | ||
402 | AC_MSG_CHECKING([for properly overriding new and delete]) | |
403 | U_OVERRIDE_CXX_ALLOCATION=0 | |
404 | U_HAVE_PLACEMENT_NEW=0 | |
405 | AC_CACHE_VAL(ac_cv_override_cxx_allocation_ok, | |
406 | [AC_TRY_LINK( | |
407 | changequote(<<, >>)dnl | |
408 | <<#include <stdlib.h> | |
409 | class UObject { | |
410 | void *operator new(size_t size) {return malloc(size);} | |
411 | void *operator new[](size_t size) {return malloc(size);} | |
412 | void operator delete(void *p) {free(p);} | |
413 | void operator delete[](void *p) {free(p);} | |
414 | }; | |
415 | >>, | |
416 | changequote([, ])dnl | |
417 | [], ac_cv_override_cxx_allocation_ok=yes, ac_cv_override_cxx_allocation_ok=no)] ) | |
418 | AC_MSG_RESULT($ac_cv_override_cxx_allocation_ok) | |
419 | if test $ac_cv_override_cxx_allocation_ok = yes | |
420 | then | |
421 | U_OVERRIDE_CXX_ALLOCATION=1 | |
422 | AC_MSG_CHECKING([for placement new and delete]) | |
423 | AC_CACHE_VAL(ac_cv_override_placement_new_ok, | |
424 | [AC_TRY_LINK( | |
425 | changequote(<<, >>)dnl | |
426 | <<#include <stdlib.h> | |
427 | class UObject { | |
428 | void *operator new(size_t size) {return malloc(size);} | |
429 | void *operator new[](size_t size) {return malloc(size);} | |
430 | void operator delete(void *p) {free(p);} | |
431 | void operator delete[](void *p) {free(p);} | |
432 | void * operator new(size_t, void *ptr) { return ptr; } | |
433 | void operator delete(void *, void *) {} | |
434 | }; | |
435 | >>, | |
436 | changequote([, ])dnl | |
437 | [], ac_cv_override_placement_new_ok=yes, ac_cv_override_placement_new_ok=no)] ) | |
438 | AC_MSG_RESULT($ac_cv_override_placement_new_ok) | |
439 | if test $ac_cv_override_placement_new_ok = yes | |
440 | then | |
441 | U_HAVE_PLACEMENT_NEW=1 | |
442 | fi | |
443 | fi | |
444 | AC_SUBST(U_OVERRIDE_CXX_ALLOCATION) | |
445 | AC_SUBST(U_HAVE_PLACEMENT_NEW) | |
446 | ||
447 | AC_LANG_C | |
448 | AC_CHECK_FUNC(popen) | |
449 | if test x$ac_cv_func_popen = xyes | |
450 | then | |
451 | U_HAVE_POPEN=1 | |
452 | else | |
453 | U_HAVE_POPEN=0 | |
454 | fi | |
455 | AC_SUBST(U_HAVE_POPEN) | |
456 | ||
457 | AC_CHECK_FUNC(tzset) | |
458 | if test x$ac_cv_func_tzset = xyes | |
459 | then | |
460 | U_TZSET=tzset | |
461 | else | |
462 | AC_CHECK_FUNC(_tzset) | |
463 | if test x$ac_cv_func__tzset = xyes | |
464 | then | |
465 | U_TZSET=_tzset | |
466 | fi | |
467 | fi | |
468 | AC_SUBST(U_TZSET) | |
469 | AC_CACHE_CHECK(for tzname,ac_cv_var_tzname, | |
470 | [AC_TRY_LINK( | |
471 | changequote(<<, >>)dnl | |
472 | <<#ifndef __USE_POSIX | |
473 | #define __USE_POSIX | |
474 | #endif | |
475 | #include <time.h> | |
476 | #ifndef tzname /* For SGI. */ | |
477 | extern char *tzname[]; /* RS6000 and others reject char **tzname. */ | |
478 | #endif>>, | |
479 | changequote([, ])dnl | |
480 | [atoi(*tzname);], ac_cv_var_tzname=yes, ac_cv_var_tzname=no)]) | |
481 | if test $ac_cv_var_tzname = yes; then | |
482 | U_TZNAME=tzname | |
483 | else | |
484 | AC_CACHE_CHECK(for _tzname,ac_cv_var__tzname, | |
485 | [AC_TRY_LINK( | |
486 | changequote(<<, >>)dnl | |
487 | <<#include <time.h> | |
488 | extern char *_tzname[]; | |
489 | >>, | |
490 | changequote([, ])dnl | |
491 | [atoi(*_tzname);], ac_cv_var__tzname=yes, ac_cv_var__tzname=no)]) | |
492 | if test $ac_cv_var__tzname = yes; then | |
493 | U_TZNAME=_tzname | |
494 | fi | |
495 | fi | |
496 | AC_SUBST(U_TZNAME) | |
497 | ||
498 | AC_CACHE_CHECK(for timezone,ac_cv_var_timezone, | |
499 | [AC_TRY_LINK( | |
500 | changequote(<<, >>)dnl | |
501 | <<#ifndef __USE_POSIX | |
502 | #define __USE_POSIX | |
503 | #endif | |
504 | #ifndef __USE_XOPEN | |
505 | #define __USE_XOPEN | |
506 | #endif | |
507 | #include <time.h> | |
508 | >>, | |
509 | changequote([, ])dnl | |
510 | [timezone = 1;], ac_cv_var_timezone=yes, ac_cv_var_timezone=no)]) | |
511 | U_HAVE_TIMEZONE=0 | |
512 | if test $ac_cv_var_timezone = yes; then | |
513 | U_TIMEZONE=timezone | |
514 | U_HAVE_TIMEZONE=1 | |
515 | else | |
516 | AC_CACHE_CHECK(for __timezone,ac_cv_var___timezone, | |
517 | [AC_TRY_LINK( | |
518 | changequote(<<, >>)dnl | |
519 | <<#include <time.h> | |
520 | >>, | |
521 | changequote([, ])dnl | |
522 | [__timezone = 1;], ac_cv_var___timezone=yes, ac_cv_var___timezone=no)]) | |
523 | if test $ac_cv_var___timezone = yes; then | |
524 | U_TIMEZONE=__timezone | |
525 | U_HAVE_TIMEZONE=1 | |
526 | else | |
527 | AC_CACHE_CHECK(for _timezone,ac_cv_var__timezone, | |
528 | [AC_TRY_LINK( | |
529 | changequote(<<, >>)dnl | |
530 | <<#include <time.h> | |
531 | >>, | |
532 | changequote([, ])dnl | |
533 | [_timezone = 1;], ac_cv_var__timezone=yes, ac_cv_var__timezone=no)]) | |
534 | if test $ac_cv_var__timezone = yes; then | |
535 | U_TIMEZONE=_timezone | |
536 | U_HAVE_TIMEZONE=1 | |
537 | fi | |
538 | fi | |
539 | fi | |
540 | AC_SUBST(U_HAVE_TIMEZONE) | |
541 | AC_SUBST(U_TIMEZONE) | |
542 | ||
543 | dnl Checks for typedefs | |
544 | AC_CHECK_TYPE(int8_t,signed char) | |
545 | AC_CHECK_TYPE(uint8_t,unsigned char) | |
546 | AC_CHECK_TYPE(int16_t,signed short) | |
547 | AC_CHECK_TYPE(uint16_t,unsigned short) | |
548 | AC_CHECK_TYPE(int32_t,signed long) | |
549 | AC_CHECK_TYPE(uint32_t,unsigned long) | |
550 | AC_CHECK_TYPE(int64_t,signed long long) | |
551 | AC_CHECK_TYPE(uint64_t,unsigned long long) | |
552 | ||
553 | if test $ac_cv_type_int8_t = no; then | |
554 | HAVE_INT8_T=0 | |
555 | else | |
556 | HAVE_INT8_T=1 | |
557 | fi | |
558 | AC_SUBST(HAVE_INT8_T) | |
559 | ||
560 | if test $ac_cv_type_uint8_t = no; then | |
561 | HAVE_UINT8_T=0 | |
562 | else | |
563 | HAVE_UINT8_T=1 | |
564 | fi | |
565 | AC_SUBST(HAVE_UINT8_T) | |
566 | ||
567 | if test $ac_cv_type_int16_t = no; then | |
568 | HAVE_INT16_T=0 | |
569 | else | |
570 | HAVE_INT16_T=1 | |
571 | fi | |
572 | AC_SUBST(HAVE_INT16_T) | |
573 | ||
574 | if test $ac_cv_type_uint16_t = no; then | |
575 | HAVE_UINT16_T=0 | |
576 | else | |
577 | HAVE_UINT16_T=1 | |
578 | fi | |
579 | AC_SUBST(HAVE_UINT16_T) | |
580 | ||
581 | if test $ac_cv_type_int32_t = no; then | |
582 | HAVE_INT32_T=0 | |
583 | else | |
584 | HAVE_INT32_T=1 | |
585 | fi | |
586 | AC_SUBST(HAVE_INT32_T) | |
587 | ||
588 | if test $ac_cv_type_uint32_t = no; then | |
589 | HAVE_UINT32_T=0 | |
590 | else | |
591 | HAVE_UINT32_T=1 | |
592 | fi | |
593 | AC_SUBST(HAVE_UINT32_T) | |
594 | ||
595 | if test $ac_cv_type_int64_t = no; then | |
596 | HAVE_INT64_T=0 | |
597 | else | |
598 | HAVE_INT64_T=1 | |
599 | fi | |
600 | AC_SUBST(HAVE_INT64_T) | |
601 | ||
602 | if test $ac_cv_type_uint64_t = no; then | |
603 | HAVE_UINT64_T=0 | |
604 | else | |
605 | HAVE_UINT64_T=1 | |
606 | fi | |
607 | AC_SUBST(HAVE_UINT64_T) | |
608 | ||
609 | dnl Do various wchar_t related checks | |
610 | AC_CHECK_HEADER(wchar.h) | |
611 | if test "$ac_cv_header_wchar_h" = no | |
612 | then | |
613 | U_HAVE_WCHAR_H=0 | |
614 | U_HAVE_WCSCPY=0 | |
615 | else | |
616 | AC_DEFINE(HAVE_WCHAR_H) | |
617 | U_HAVE_WCHAR_H=1 | |
618 | dnl Some broken systems have wchar.h but not some of its functions... | |
619 | AC_SEARCH_LIBS(wcscpy, wcs w) | |
620 | if test "$ac_cv_search_wcscpy" != no; then | |
621 | U_HAVE_WCSCPY=1 | |
622 | else | |
623 | U_HAVE_WCSCPY=0 | |
624 | fi | |
625 | fi | |
626 | AC_SUBST(U_HAVE_WCHAR_H) | |
627 | AC_SUBST(U_HAVE_WCSCPY) | |
628 | ||
629 | ac_default_sizeof_wchar_t=4 | |
630 | AC_DO_CHECK_SIZEOF(wchar_t,$ac_default_sizeof_wchar_t,[ | |
631 | #if STDC_HEADERS | |
632 | #include <stddef.h> | |
633 | #endif | |
634 | #if HAVE_WCHAR_H | |
635 | #include <string.h> | |
636 | #include <wchar.h> | |
637 | #endif]) | |
638 | dnl We could set ac_cv_sizeof_wchar_t to the default if the check returned | |
639 | dnl 0 (unknown) but we'd rather do it in the headers, so we know we had no | |
640 | dnl clue at configure time. | |
641 | U_SIZEOF_WCHAR_T=$ac_cv_sizeof_wchar_t | |
642 | if test $U_SIZEOF_WCHAR_T = 0; then | |
643 | if test $U_HAVE_WCHAR_H=1; then | |
644 | AC_MSG_ERROR(There is wchar.h but the size of wchar_t is 0) | |
645 | fi | |
646 | fi | |
647 | AC_SUBST(U_SIZEOF_WCHAR_T) | |
648 | ||
649 | dnl Echo | |
650 | ECHO_N=$ac_n | |
651 | ECHO_C=$ac_c | |
652 | AC_SUBST(ECHO_N) | |
653 | AC_SUBST(ECHO_C) | |
654 | ||
655 | dnl Enable/disable extras | |
656 | AC_ARG_ENABLE(extras, | |
657 | [ --enable-extras build ICU extras [default=yes]], | |
658 | [case "${enableval}" in | |
659 | yes) extras=true ;; | |
660 | no) extras=false ;; | |
661 | *) AC_MSG_ERROR(bad value ${enableval} for --enable-extras) ;; | |
662 | esac], | |
663 | extras=true) | |
664 | ICU_CONDITIONAL(EXTRAS, test "$extras" = true) | |
665 | AC_ARG_ENABLE(extras, | |
666 | [ --enable-ustdio build ICU's ustdio library [default=yes]], | |
667 | [case "${enableval}" in | |
668 | yes) ustdio=true ;; | |
669 | no) ustdio=false ;; | |
670 | *) AC_MSG_ERROR(bad value ${enableval} for --enable-ustdio) ;; | |
671 | esac], | |
672 | ustdio=true) | |
673 | ICU_CONDITIONAL(USTDIO, test "$ustdio" = true) | |
674 | ||
675 | dnl Enable/disable layout | |
676 | AC_ARG_ENABLE(layout, | |
677 | [ --enable-layout build ICU's layout library [default=yes]], | |
678 | [case "${enableval}" in | |
679 | yes) layout=true ;; | |
680 | no) layout=false ;; | |
681 | *) AC_MSG_ERROR(bad value ${enableval} for --enable-layout) ;; | |
682 | esac], | |
683 | layout=true) | |
684 | ICU_CONDITIONAL(LAYOUT, test "$layout" = true) | |
685 | ||
686 | AC_ARG_WITH(data-packaging, | |
687 | [ --with-data-packaging=type specify how to package ICU data (files, archive, library, auto) [default=auto]], | |
688 | [case "${withval}" in | |
689 | files|archive|library) datapackaging=$withval ;; | |
690 | auto) datapackaging=$withval ;; | |
691 | common) datapackaging=archive ;; | |
692 | dll) datapackaging=library ;; | |
693 | *) AC_MSG_ERROR(bad value ${withval} for --with-iostream) ;; | |
694 | esac], | |
695 | [datapackaging=]) | |
696 | ||
697 | thesysconfdir=`eval echo $sysconfdir` | |
698 | AC_SUBST(thesysconfdir) | |
699 | thedatadir=`eval echo $datadir` | |
700 | AC_SUBST(thedatadir) | |
701 | thelibdir=`test "x$exec_prefix" = xNONE && exec_prefix="$prefix"; eval echo $libdir` | |
702 | AC_SUBST(thelibdir) | |
703 | case $datapackaging in | |
704 | common) | |
705 | pkgicudatadir=$datadir | |
706 | thepkgicudatadir=$thedatadir | |
707 | ;; | |
708 | *) | |
709 | pkgicudatadir=$libdir | |
710 | thepkgicudatadir=$thelibdir | |
711 | ;; | |
712 | esac | |
713 | AC_SUBST(pkgicudatadir) | |
714 | AC_SUBST(thepkgicudatadir) | |
715 | ||
716 | dnl Shouldn't need the AC_SUBST | |
717 | dnl Deprecated support for --enable-mapped | |
718 | ||
719 | AC_ARG_ENABLE(mapped,, | |
720 | [case "${enableval}" in | |
721 | yes) mapped=archive ;; | |
722 | no) mapped=library ;; | |
723 | *) AC_MSG_ERROR(bad value ${enableval} for --enable-mapped; use --with-data-packaging now) ;; | |
724 | esac], | |
725 | [mapped=]) | |
726 | ||
727 | if test x"$mapped" != x; then | |
728 | case $mapped in | |
729 | archive) | |
730 | AC_MSG_WARN(use --with-data-packaging=archive instead of --enable-mapped) | |
731 | ;; | |
732 | library) | |
733 | AC_MSG_WARN(use --with-data-packaging=library instead of --disable-mapped) | |
734 | ;; | |
735 | esac | |
736 | if test x"$datapackaging" != x -a x"$mapped" != x"$datapackaging"; then | |
737 | AC_MSG_ERROR(conflicting values used for --with-data-packaging and deprecated --enable-mapped) | |
738 | fi | |
739 | datapackaging=$mapped | |
740 | fi | |
741 | ||
742 | if test x"$datapackaging" = x -o x"$datapackaging" = xauto; then | |
743 | datapackaging=library | |
744 | fi | |
745 | ||
746 | case "$datapackaging" in | |
747 | files) | |
748 | DATA_PACKAGING_CPPFLAGS=-DUDATA_FILES | |
749 | DATA_PACKAGING_MODE=files | |
750 | ;; | |
751 | archive) | |
752 | DATA_PACKAGING_CPPFLAGS=-DUDATA_MAP | |
753 | DATA_PACKAGING_MODE=common | |
754 | ;; | |
755 | library) | |
756 | DATA_PACKAGING_CPPFLAGS=-DUDATA_DLL | |
757 | DATA_PACKAGING_MODE=dll | |
758 | ;; | |
759 | esac | |
760 | AC_SUBST(DATA_PACKAGING_CPPFLAGS) | |
761 | AC_SUBST(DATA_PACKAGING_MODE) | |
762 | ||
763 | dnl Sets a library suffix | |
764 | AC_MSG_CHECKING([for a library suffix to use]) | |
765 | AC_ARG_WITH(library-suffix, | |
766 | [ --with-library-suffix=suffix tag a suffix to the library names [default=]], | |
767 | [ICULIBSUFFIX="${withval}"], | |
768 | [ICULIBSUFFIX=]) | |
769 | msg=$ICULIBSUFFIX | |
770 | if test "$msg" = ""; then | |
771 | msg=none | |
772 | fi | |
773 | AC_MSG_RESULT($msg) | |
774 | AC_SUBST(ICULIBSUFFIX) | |
775 | changequote(<<, >>)dnl | |
776 | if test "$ICULIBSUFFIX" != "" | |
777 | then | |
778 | U_HAVE_LIB_SUFFIX=1 | |
779 | ICULIBSUFFIXCNAME=`echo _$ICULIBSUFFIX | sed 's/[^A-Za-z0-9_]/_/g'` | |
780 | else | |
781 | U_HAVE_LIB_SUFFIX=0 | |
782 | fi | |
783 | changequote([, ])dnl | |
784 | AC_SUBST(U_HAVE_LIB_SUFFIX) | |
785 | AC_SUBST(ICULIBSUFFIXCNAME) | |
786 | ||
787 | dnl Enable/disable tests | |
788 | AC_ARG_ENABLE(tests, | |
789 | [ --enable-tests build ICU tests [default=yes]], | |
790 | [case "${enableval}" in | |
791 | yes) tests=true ;; | |
792 | no) tests=false ;; | |
793 | *) AC_MSG_ERROR(bad value ${enableval} for --enable-tests) ;; | |
794 | esac], | |
795 | tests=true) | |
796 | ICU_CONDITIONAL(TESTS, test "$tests" = true) | |
797 | ||
798 | dnl Enable/disable samples | |
799 | AC_ARG_ENABLE(samples, | |
800 | [ --enable-samples build ICU samples [default=yes] | |
801 | Additionally, the variable FORCE_LIBS may be set before calling configure. If set, it will REPLACE any automatic list of libraries.], | |
802 | [case "${enableval}" in | |
803 | yes) samples=true ;; | |
804 | no) samples=false ;; | |
805 | *) AC_MSG_ERROR(bad value ${enableval} for --enable-samples) ;; | |
806 | esac], | |
807 | samples=true) | |
808 | ICU_CONDITIONAL(SAMPLES, test "$samples" = true) | |
809 | ||
810 | ICUDATA_CHAR=$U_ENDIAN_CHAR | |
811 | ||
812 | dnl Platform-specific Makefile setup | |
813 | dnl set ICUDATA_CHAR to 'e' for any EBCDIC (which should be big endian) platform. | |
814 | case "${host}" in | |
815 | *-*-solaris*) platform=U_SOLARIS ;; | |
816 | *-*-linux*) platform=U_LINUX ;; | |
817 | *-*-*bsd*) platform=U_BSD ;; | |
818 | *-*-aix*) platform=AIX ;; | |
819 | *-*-hpux*) platform=HPUX ;; | |
820 | *-apple-darwin*|*-apple-rhapsody*) platform=U_DARWIN ;; | |
821 | *-*-cygwin*|*-*-mingw*) platform=U_CYGWIN ;; | |
822 | *-*ibm-openedition*|*-*-os390*) platform=OS390 | |
823 | ICUDATA_CHAR="e" ;; | |
824 | *-*-os400*) platform=OS400 | |
825 | ICUDATA_CHAR="e" ;; | |
826 | *-*-nto*) platform=U_QNX ;; | |
827 | *-dec-osf*) platform=U_OSF ;; | |
828 | *-*-irix*) platform=IRIX ;; | |
829 | *-sequent-*) platform=PTX ;; | |
830 | *) platform=U_UNKNOWN_PLATFORM ;; | |
831 | esac | |
832 | AC_SUBST(ICUDATA_CHAR) | |
833 | AC_SUBST(platform) | |
834 | platform_make_fragment_name="$icu_cv_host_frag" | |
835 | platform_make_fragment='$(top_srcdir)/config/'"$platform_make_fragment_name" | |
836 | AC_SUBST(platform_make_fragment_name) | |
837 | AC_SUBST(platform_make_fragment) | |
838 | ||
839 | dnl Handle -rpath options for shared library paths | |
840 | case "${host}" in | |
841 | *-*-solaris*) ld_rpath_suf=":" ;; | |
842 | *-*-linux*) ld_rpath_suf=" " ;; | |
843 | *-*-*bsd*) ld_rpath_suf=" " ;; | |
844 | *-*-aix*) ld_rpath_suf="" ;; | |
845 | *-*-hpux*) ld_rpath_suf=":" ;; | |
846 | *-*ibm-openedition*|*-*-os390*) ld_rpath_suf="" ;; | |
847 | *-*-os400*) ld_rpath_suf=" " ;; | |
848 | *-sequent-*) ld_rpath_suf="" ;; | |
849 | *-*-irix*) ld_rpath_suf=" " ;; | |
850 | *) ld_rpath_suf="" ;; | |
851 | esac | |
852 | AC_SUBST(ld_rpath_suf) | |
853 | ||
854 | dnl On HP/UX, main() functions compiled in C don't invoke | |
855 | dnl static constructors in C++ libs. Hack around that here | |
856 | dnl by renaming some .c files to .cpp | |
857 | case "${host}" in | |
858 | *-*-hpux*) | |
859 | if test "$ac_cv_prog_gcc" != yes; then | |
860 | for file in samples/date/date \ | |
861 | samples/cal/cal test/cintltst/cintltst \ | |
862 | tools/makeconv/makeconv tools/genrb/genrb \ | |
863 | tools/genrb/derb tools/genccode/genccode \ | |
864 | tools/gencmn/gencmn tools/gencmn/decmn \ | |
865 | tools/gencnval/gencnval tools/gennorm/gennorm \ | |
866 | tools/gennames/gennames tools/gentest/gentest \ | |
867 | tools/pkgdata/pkgdata tools/genprops/genprops \ | |
868 | tools/genidna/genidna | |
869 | do | |
870 | if test -f $file.c; then | |
871 | mv $file.c $file.cpp | |
872 | else | |
873 | echo "# $file.c does not exist or is already renamed [warning]" | |
874 | fi | |
875 | done | |
876 | fi | |
877 | ;; | |
878 | esac | |
879 | ||
880 | if test "${FORCE_LIBS}" != ""; then | |
881 | echo " *** Overriding automatically chosen [LIBS=$LIBS], using instead [FORCE_LIBS=${FORCE_LIBS}]" 1>&6 | |
882 | LIBS=${FORCE_LIBS} | |
883 | fi | |
884 | ||
885 | ||
886 | if test "${AIX_SHLIB}" != ""; then | |
887 | echo " *** setting AIX_SHLIB (AIX only) to ${AIX_SHLIB}]" 1>&6 | |
888 | else | |
889 | AIX_SHLIB=makeC++SharedLib_r | |
890 | fi | |
891 | ||
892 | AC_SUBST(AIX_SHLIB) | |
893 | ||
894 | ||
895 | dnl SPECIAL handling for HPUX 10 and also '11 & --enable-hpuxcma=true' | |
896 | if test $hpuxcma = true; then | |
897 | CPPFLAGS="${CPPFLAGS} -D_PTHREADS_DRAFT4 -DHPUX_CMA" | |
898 | fi | |
899 | dnl END special | |
900 | ||
901 | dnl Now that we're done using CPPFLAGS etc. for tests, we can change it | |
902 | dnl for build. | |
903 | ||
904 | if test $ICU_USE_THREADS -ne 0 | |
905 | then | |
906 | CPPFLAGS="$CPPFLAGS \$(THREADSCPPFLAGS)" | |
907 | CFLAGS="$CFLAGS \$(THREADSCFLAGS)" | |
908 | CXXFLAGS="$CXXFLAGS \$(THREADSCXXFLAGS)" | |
909 | fi | |
910 | ||
911 | if test "$ac_cv_lib_dld_shl_load" = "yes"; then | |
912 | CPPFLAGS="${CPPFLAGS} -DICU_USE_SHL_LOAD" | |
913 | fi | |
914 | ||
915 | dnl added for s/390 DLL loading detection | |
916 | ||
917 | if test "$ac_cv_func_dllload" = "yes"; then | |
918 | CPPFLAGS="${CPPFLAGS} -DICU_USE_SHL_LOAD" | |
919 | fi | |
920 | ||
921 | dnl output the Makefiles | |
922 | AC_OUTPUT([README icudefs.mk \ | |
923 | Makefile \ | |
924 | data/Makefile data/icupkg.inc \ | |
925 | common/Makefile config/Makefile.inc i18n/Makefile \ | |
926 | layout/Makefile \ | |
927 | layoutex/Makefile \ | |
928 | extra/Makefile extra/ustdio/Makefile \ | |
929 | extra/uconv/Makefile extra/scrptrun/Makefile | |
930 | stubdata/Makefile \ | |
931 | tools/Makefile tools/ctestfw/Makefile tools/makeconv/Makefile \ | |
932 | tools/genrb/Makefile \ | |
933 | tools/genuca/Makefile \ | |
934 | tools/pkgdata/Makefile \ | |
935 | tools/genccode/Makefile tools/gencmn/Makefile \ | |
936 | tools/gencnval/Makefile tools/gentz/Makefile \ | |
937 | tools/gennames/Makefile tools/toolutil/Makefile \ | |
938 | tools/gentest/Makefile \ | |
939 | tools/gennorm/Makefile \ | |
940 | tools/genprops/Makefile \ | |
941 | tools/genpname/Makefile \ | |
942 | tools/genbrk/Makefile \ | |
943 | tools/genidna/Makefile \ | |
944 | tools/dumpce/Makefile \ | |
945 | test/Makefile test/testdata/Makefile \ | |
946 | test/intltest/Makefile \ | |
947 | test/cintltst/Makefile \ | |
948 | test/iotest/Makefile \ | |
949 | test/ieeetest/Makefile \ | |
950 | test/thaitest/Makefile \ | |
951 | test/testmap/Makefile \ | |
952 | test/letest/Makefile \ | |
953 | test/threadtest/Makefile \ | |
954 | samples/Makefile samples/date/Makefile \ | |
955 | samples/cal/Makefile samples/layout/Makefile \ | |
956 | common/unicode/platform.h]) | |
957 | ||
958 | if test $ICU_USE_THREADS = 0; then | |
959 | echo " *** Note: configuring the ICU without pthread support or testing. If this isn't what you want, then run configure with --enable-threads=yes or check the messages [above] to see why we couldn't find pthread_create()" 1>&6 | |
960 | fi | |
961 | ||
962 | echo "You must use $U_MAKE to build ICU." |