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