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