]> git.saurik.com Git - apple/icu.git/blob - icuSources/configure.in
ICU-400.40.tar.gz
[apple/icu.git] / icuSources / configure.in
1 dnl -*-m4-*-
2 dnl configure.in for ICU
3 dnl Copyright (c) 1999-2008, 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.1"
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 dnl Check if we can hide variables from
184 AC_MSG_CHECKING([for library API export])
185 SHAREDLIBEXPORT=no
186 U_USE_GCC_VISIBILITY_ATTRIBUTE=0
187 OLD_CFLAGS="${CFLAGS}"
188 OLD_CXXFLAGS="${CXXFLAGS}"
189 if test "$ac_cv_c_compiler_gnu" = yes; then
190 LIBCFLAGS="-fvisibility=hidden"
191 LIBCXXFLAGS="-fvisibility=hidden"
192 CFLAGS="${CFLAGS} ${LIBCFLAGS}"
193 CXXFLAGS="${CXXFLAGS} ${LIBCXXFLAGS}"
194 AC_TRY_LINK([__attribute__ ((visibility ("default"))) void f(void);
195 #include <stdlib.h>],[exit(0);],
196 [SHAREDLIBEXPORT=yes],[SHAREDLIBEXPORT=no])
197 if test "$SHAREDLIBEXPORT" = no; then
198 LIBCFLAGS=
199 LIBCXXFLAGS=
200 else
201 U_USE_GCC_VISIBILITY_ATTRIBUTE=1
202 fi
203 else
204 case "${host}" in
205 *-*-solaris*)
206 LIBCFLAGS="-xldscope=hidden"
207 LIBCXXFLAGS="-xldscope=hidden"
208 CFLAGS="${CFLAGS} ${LIBCFLAGS}"
209 CXXFLAGS="${CXXFLAGS} ${LIBCXXFLAGS}"
210 AC_TRY_LINK([__global void f(void);
211 #include <stdlib.h>],[exit(0);],
212 [SHAREDLIBEXPORT=yes],[SHAREDLIBEXPORT=no])
213 if test "$SHAREDLIBEXPORT" = no; then
214 LIBCFLAGS=
215 LIBCXXFLAGS=
216 fi
217 ;;
218 *-*-hpux*)
219 dnl ICU isn't set up to follow the HP syntax yet.
220 ;;
221 *)
222 esac
223 fi
224 # Restore to their original state because the Intel compiler chokes
225 # on this option when checking for the wchar_t size, but the
226 # option otherwise works.
227 CFLAGS="${OLD_CFLAGS}"
228 CXXFLAGS="${OLD_CXXFLAGS}"
229 AC_MSG_RESULT($SHAREDLIBEXPORT)
230 AC_SUBST(U_USE_GCC_VISIBILITY_ATTRIBUTE)
231 AC_SUBST(LIBCFLAGS)
232 AC_SUBST(LIBCXXFLAGS)
233
234 AC_PROG_RANLIB
235 AC_PATH_PROG(AR,ar,[echo archiver ar not found re-run configure ; false],$PATH:/bin:/usr/bin:/usr/ccs/bin)
236
237 AC_MSG_CHECKING([whether to enable renaming of symbols])
238 enabled=yes
239 U_DISABLE_RENAMING=0
240 AC_ARG_ENABLE(renaming,
241 [ --enable-renaming add a version suffix to symbols [default=yes]],
242 [ case "${enableval}" in
243 yes|"") enabled=yes ;;
244 no) enabled=no; U_DISABLE_RENAMING=1 ;;
245 *) ;;
246 esac],
247 )
248 AC_MSG_RESULT($enabled)
249 AC_SUBST(U_DISABLE_RENAMING)
250
251 AC_MSG_CHECKING([whether to enable function and data tracing])
252 enabled=yes
253 U_ENABLE_TRACING=0
254 AC_ARG_ENABLE(tracing,
255 [ --enable-tracing enable function and data tracing [default=no]],
256 [ case "${enableval}" in
257 yes|"") enabled=yes ;;
258 no) enabled=no; U_ENABLE_TRACING=0 ;;
259 *) ;;
260 esac],
261 )
262 AC_MSG_RESULT($enabled)
263 AC_SUBST(U_ENABLE_TRACING)
264
265 dnl Check whether to use the evil rpath or not
266 AC_ARG_ENABLE(rpath,
267 [ --enable-rpath use rpath when linking [default is only if necessary]],
268 [ case "${enableval}" in
269 yes|"") ENABLE_RPATH=YES ;;
270 no) ;;
271 *) ;;
272 esac],
273 [ENABLE_RPATH=NO]
274 )
275 AC_SUBST(ENABLE_RPATH)
276
277
278 dnl set up U_INLINE.
279 dnl Copy the definition of AC_C_INLINE, with slight mods.
280 dnl
281 AC_CACHE_CHECK([for definition of U_INLINE for C], ac_cv_c_inline,
282 [ac_cv_c_inline=no
283 for ac_kw in inline __inline__ __inline; do
284 AC_TRY_COMPILE(, [return 0;} $ac_kw int foo() {], [ac_cv_c_inline=$ac_kw; break])
285 done
286 ])
287 case "$ac_cv_c_inline" in
288 yes) U_INLINE= "inline" ;;
289 no ) U_INLINE= ;;
290 *) U_INLINE=$ac_cv_c_inline ;;
291 esac
292 AC_SUBST(U_INLINE)
293
294 threads=true
295
296 dnl Enable/disable threads
297 AC_ARG_ENABLE(threads,
298 [ --enable-threads build ICU with thread safety [default=yes]],
299 [case "${enableval}" in
300 yes) threads=true ;;
301 no) threads=false ;;
302 *) AC_MSG_ERROR(bad value ${enableval} for --enable-threads) ;;
303 esac],
304 threads=true)
305 ICU_CONDITIONAL(THREADS, test "$threads" = true)
306
307 ICU_USE_THREADS=0
308 OLD_LIBS=${LIBS}
309
310 if test $threads = true; then
311 dnl For Compaq Tru64 (OSF1), we must look for pthread_attr_init
312 dnl and must do this before seaching for pthread_mutex_destroy, or
313 dnl we will pick up libpthreads.so not libpthread.so
314 dnl If this fails, then we must test for HPUX specials, before
315 dnl moving on to a more generic test
316
317 AC_CHECK_LIB(pthread, pthread_attr_init)
318 if test $ac_cv_lib_pthread_pthread_attr_init = yes; then
319 ICU_USE_THREADS=1
320 else
321 dnl Locate the right library for POSIX threads. We look for the
322 dnl symbols in the libraries first, because on Solaris libc provides
323 dnl pthread_create but libpthread has the real code :(
324 dnl AIX uses libpthreads instead of libpthread, and HP/UX uses libpthread
325 dnl FreeBSD users may need libpthread if they do not have libc_r.
326
327 AC_SEARCH_LIBS_FIRST(pthread_mutex_destroy, pthread pthreads c_r )
328
329 if test "$ac_cv_search_pthread_mutex_destroy" != no; then
330 ICU_USE_THREADS=1
331 else
332 dnl For HP 11
333 AC_CHECK_LIB(pthread, pthread_mutex_init)
334 if test $ac_cv_lib_pthread_pthread_mutex_init = yes; then
335 ICU_USE_THREADS=1
336 fi
337 fi
338
339 AC_CHECK_FUNC(pthread_mutex_lock)
340
341 if test $ac_cv_func_pthread_mutex_lock = yes; then
342 ICU_USE_THREADS=1
343 fi
344 fi
345 dnl Check to see if we are using CygWin with MSVC
346 case "${host}" in
347 *-pc-cygwin*|*-pc-mingw*)
348 dnl For gcc, the thread options are set by mh-mingw/mh-cygwin
349 ICU_USE_THREADS=1
350 if test "$ac_cv_prog_gcc" = no; then
351 dnl We're using normal windows compilers. Threading is available.
352 ICU_USE_THREADS=1
353 if test $ENABLE_DEBUG = 1; then
354 dnl /MDd means 'compiles and links a debugable multithreaded program with DLL'
355 CFLAGS="${CFLAGS} /MDd"
356 CXXFLAGS="${CXXFLAGS} /MDd"
357 else
358 dnl /MD means 'compiles and links a multithreaded program with DLL'
359 CFLAGS="${CFLAGS} /MD"
360 CXXFLAGS="${CXXFLAGS} /MD"
361 fi
362 fi ;;
363 *-*-hpux*)
364 dnl Add -mt because it does several nice things on newer compilers.
365 case "${icu_cv_host_frag}" in
366 mh-hpux-acc)
367 OLD_CXXFLAGS="${CXXFLAGS}"
368 CXXFLAGS="${CXXFLAGS} -mt"
369 if test x"`${CXX} ${CXXFLAGS} 2>&1`" != x""; then
370 CXXFLAGS="${OLD_CXXFLAGS}"
371 fi
372 ;;
373 esac
374 ;;
375 esac
376 fi
377
378 AC_SUBST(ICU_USE_THREADS)
379
380 AC_ARG_ENABLE(weak-threads,
381 [ --enable-weak-threads weakly reference the threading library [default=no]],
382 [case "${enableval}" in
383 yes)
384 LIB_THREAD="${LIBS%${OLD_LIBS}}"
385 LIBS=${OLD_LIBS}
386 ;;
387 no) ;;
388 *) AC_MSG_ERROR(bad value ${enableval} for --enable-weak-threads) ;;
389 esac])
390 AC_SUBST(LIB_THREAD)
391
392 dnl Check for mmap()
393
394 # The AC_FUNC_MMAP macro doesn't work properly. It seems to be too specific.
395 # Do this check instead.
396 HAVE_MMAP=0
397 AC_MSG_CHECKING([for mmap])
398 AC_CACHE_VAL(ac_cv_func_mmap_ok,
399 [AC_TRY_LINK(
400 changequote(<<, >>)dnl
401 <<
402 #include <unistd.h>
403 #include <sys/mman.h>
404 #include <sys/stat.h>
405 #include <fcntl.h>
406 >>,
407 changequote([, ])dnl
408 [mmap((void *)0, 0, PROT_READ, 0, 0, 0);],
409 ac_cv_func_mmap_ok=yes,
410 ac_cv_func_mmap_ok=no)] )
411 AC_MSG_RESULT($ac_cv_func_mmap_ok)
412 if test $ac_cv_func_mmap_ok = yes
413 then
414 HAVE_MMAP=1
415 fi
416 AC_SUBST(HAVE_MMAP)
417
418 dnl Check to see if genccode can generate simple assembly.
419 GENCCODE_ASSEMBLY=
420 case "${host}" in
421 i*86-*-linux*|x86_64-*-linux*|powerpc*-*-linux*|i*86-*-*bsd*|i*86-pc-gnu)
422 if test "$GCC" = yes; then
423 dnl We're using gcc, and the simple -a gcc command line works for genccode
424 GENCCODE_ASSEMBLY="-a gcc"
425 fi ;;
426 i*86-*-solaris*)
427 if test "$GCC" = yes; then
428 dnl When using gcc, look if we're also using GNU as.
429 dnl When using GNU as, the simple -a gcc command line works for genccode.
430 asv=`"${CC}" -print-prog-name=as 2>/dev/null`
431 asv=`"${asv}" --version 2>/dev/null`
432 case "X${asv}" in
433 X*GNU*) GENCCODE_ASSEMBLY="-a gcc" ;;
434 X*) GENCCODE_ASSEMBLY="-a sun-x86" ;;
435 esac
436 unset asv
437 else
438 GENCCODE_ASSEMBLY="-a sun-x86"
439 fi ;;
440 sparc-*-solaris*)
441 GENCCODE_ASSEMBLY="-a sun"
442 ;;
443 ia64-*-hpux*)
444 GENCCODE_ASSEMBLY="-a aCC-ia64"
445 ;;
446 esac
447 AC_SUBST(GENCCODE_ASSEMBLY)
448
449
450 dnl Checks for header files
451 AC_CHECK_HEADERS(inttypes.h)
452 if test $ac_cv_header_inttypes_h = no; then
453 U_HAVE_INTTYPES_H=0
454 else
455 U_HAVE_INTTYPES_H=1
456 fi
457 if test "$CC" = ccc; then
458 AC_MSG_RESULT("C compiler set to CCC ${CC}" )
459 case "${host}" in
460 alpha*-*-*) U_HAVE_INTTYPES_H=0;
461 esac
462 fi
463
464 AC_SUBST(U_HAVE_INTTYPES_H)
465
466 AC_ARG_WITH(iostream,
467 [ --with-iostream=version specify the version of iostream to use (none, old, std, auto) [default=auto]],
468 [case "${withval}" in
469 none) streams=none ;;
470 old) streams=198506 ;;
471 std) streams=199711 ;;
472 auto) streams= ;;
473 *) AC_MSG_ERROR(bad value ${withval} for --with-iostream) ;;
474 esac],
475 [streams=])
476
477 U_IOSTREAM_SOURCE=0
478 if test x$streams != xnone
479 then
480 AC_LANG_SAVE
481 AC_LANG_CPLUSPLUS
482 OLD_CXXFLAGS="${CXXFLAGS}"
483 case "${icu_cv_host_frag}" in
484 mh-hpux-acc)
485 CXXFLAGS="${CXXFLAGS} -AA"
486 ;;
487 esac
488 AC_MSG_CHECKING([for iostream usability])
489 AC_TRY_COMPILE([#include <iostream>],[],
490 [ac_cv_header_iostream=yes],[ac_cv_header_iostream=no])
491 if test $icu_cv_host_frag = mh-cygwin-msvc
492 then
493 dnl <iostream> is always there on Windows.
494 dnl We do this to prevent the C++ preprocessor from being used because
495 dnl autoconf can't deal with the Windows C++ preprocessor
496 ac_cv_header_iostream=yes
497 fi
498 AC_MSG_RESULT($ac_cv_header_iostream)
499 if test $ac_cv_header_iostream = yes
500 then
501 U_IOSTREAM_SOURCE=199711
502 else
503 CXXFLAGS="${OLD_CXXFLAGS}"
504 AC_MSG_CHECKING([whether ostream in iostream.h is really defined])
505 AC_CACHE_VAL(ac_cv_iostream_ok,
506 AC_TRY_LINK([#include <iostream.h>],[ostream &testout = cout; testout << "test" << endl;],ac_cv_iostream_ok=yes,ac_cv_iostream_ok=no))
507 AC_MSG_RESULT($ac_cv_iostream_ok)
508 if test $ac_cv_iostream_ok = yes
509 then
510 U_IOSTREAM_SOURCE=198506
511 fi
512 fi
513 if test x$streams != x
514 then
515 if test $U_IOSTREAM_SOURCE -ge $streams
516 then
517 U_IOSTREAM_SOURCE=$streams
518 case "${icu_cv_host_frag}" in
519 mh-hpux-acc)
520 if test $U_IOSTREAM_SOURCE -lt 199711; then
521 CXXFLAGS=${OLD_CXXFLAGS}
522 fi
523 ;;
524 esac
525 else
526 AC_MSG_ERROR(${withval} iostream is not available)
527 fi
528 fi
529 fi
530 AC_SUBST(U_IOSTREAM_SOURCE)
531 AC_LANG_RESTORE
532
533 dnl Check for endianness
534 AC_C_BIGENDIAN()
535 if test $ac_cv_c_bigendian = no; then
536 U_IS_BIG_ENDIAN=0
537 U_ENDIAN_CHAR="l"
538 else
539 U_IS_BIG_ENDIAN=1
540 U_ENDIAN_CHAR="b"
541 fi
542 AC_SUBST(U_IS_BIG_ENDIAN)
543
544 dnl Do various POSIX related checks
545 U_HAVE_NL_LANGINFO_CODESET=0
546 U_NL_LANGINFO_CODESET=-1
547 AC_CHECK_FUNC(nl_langinfo,[U_HAVE_NL_LANGINFO=1],[U_HAVE_NL_LANGINFO=0])
548 dnl AC_SUBST(U_HAVE_NL_LANGINFO)
549 if test $U_HAVE_NL_LANGINFO -eq 1; then
550 AC_CACHE_CHECK([for nl_langinfo's argument to obtain the codeset],
551 ac_cv_nl_langinfo_codeset,
552 [ac_cv_nl_langinfo_codeset="unknown"
553 for a in CODESET _NL_CTYPE_CODESET_NAME; do
554 AC_TRY_LINK([#include <langinfo.h>],[nl_langinfo($a);],[ac_cv_nl_langinfo_codeset="$a"; break])]
555 done)
556 if test x$ac_cv_nl_langinfo_codeset != xunknown
557 then
558 U_HAVE_NL_LANGINFO_CODESET=1
559 U_NL_LANGINFO_CODESET=$ac_cv_nl_langinfo_codeset
560 fi
561 fi
562 AC_SUBST(U_HAVE_NL_LANGINFO_CODESET)
563 AC_SUBST(U_NL_LANGINFO_CODESET)
564
565 dnl Namespace support checks
566 AC_LANG_CPLUSPLUS
567 AC_MSG_CHECKING([for namespace support])
568 AC_CACHE_VAL(ac_cv_namespace_ok,
569 [AC_TRY_LINK(
570 changequote(<<, >>)dnl
571 <<namespace x_version {void f(){}}
572 namespace x = x_version;
573 using namespace x_version;
574 >>,
575 changequote([, ])dnl
576 [f();], ac_cv_namespace_ok=yes, ac_cv_namespace_ok=no)] )
577 AC_MSG_RESULT($ac_cv_namespace_ok)
578 U_HAVE_NAMESPACE=1
579 if test $ac_cv_namespace_ok = no
580 then
581 U_HAVE_NAMESPACE=0
582 fi
583 AC_SUBST(U_HAVE_NAMESPACE)
584
585 AC_MSG_CHECKING([for properly overriding new and delete])
586 U_OVERRIDE_CXX_ALLOCATION=0
587 U_HAVE_PLACEMENT_NEW=0
588 AC_CACHE_VAL(ac_cv_override_cxx_allocation_ok,
589 [AC_TRY_LINK(
590 changequote(<<, >>)dnl
591 <<#include <stdlib.h>
592 class UMemory {
593 public:
594 void *operator new(size_t size) {return malloc(size);}
595 void *operator new[](size_t size) {return malloc(size);}
596 void operator delete(void *p) {free(p);}
597 void operator delete[](void *p) {free(p);}
598 };
599 >>,
600 changequote([, ])dnl
601 [], ac_cv_override_cxx_allocation_ok=yes, ac_cv_override_cxx_allocation_ok=no)] )
602 AC_MSG_RESULT($ac_cv_override_cxx_allocation_ok)
603 if test $ac_cv_override_cxx_allocation_ok = yes
604 then
605 U_OVERRIDE_CXX_ALLOCATION=1
606 AC_MSG_CHECKING([for placement new and delete])
607 AC_CACHE_VAL(ac_cv_override_placement_new_ok,
608 [AC_TRY_LINK(
609 changequote(<<, >>)dnl
610 <<#include <stdlib.h>
611 class UMemory {
612 public:
613 void *operator new(size_t size) {return malloc(size);}
614 void *operator new[](size_t size) {return malloc(size);}
615 void operator delete(void *p) {free(p);}
616 void operator delete[](void *p) {free(p);}
617 void * operator new(size_t, void *ptr) { return ptr; }
618 void operator delete(void *, void *) {}
619 };
620 >>,
621 changequote([, ])dnl
622 [], ac_cv_override_placement_new_ok=yes, ac_cv_override_placement_new_ok=no)] )
623 AC_MSG_RESULT($ac_cv_override_placement_new_ok)
624 if test $ac_cv_override_placement_new_ok = yes
625 then
626 U_HAVE_PLACEMENT_NEW=1
627 fi
628 fi
629 AC_SUBST(U_OVERRIDE_CXX_ALLOCATION)
630 AC_SUBST(U_HAVE_PLACEMENT_NEW)
631
632 AC_LANG_C
633 AC_CHECK_FUNC(popen)
634 if test x$ac_cv_func_popen = xyes
635 then
636 U_HAVE_POPEN=1
637 else
638 U_HAVE_POPEN=0
639 fi
640 AC_SUBST(U_HAVE_POPEN)
641
642 AC_CHECK_FUNC(tzset)
643 U_HAVE_TZSET=0
644 if test x$ac_cv_func_tzset = xyes
645 then
646 U_TZSET=tzset
647 U_HAVE_TZSET=1
648 else
649 AC_CHECK_FUNC(_tzset)
650 if test x$ac_cv_func__tzset = xyes
651 then
652 U_TZSET=_tzset
653 U_HAVE_TZSET=1
654 fi
655 fi
656 AC_SUBST(U_HAVE_TZSET)
657 AC_SUBST(U_TZSET)
658
659 U_HAVE_TZNAME=0
660 AC_CACHE_CHECK(for tzname,ac_cv_var_tzname,
661 [AC_TRY_LINK(
662 changequote(<<, >>)dnl
663 <<#ifndef __USE_POSIX
664 #define __USE_POSIX
665 #endif
666 #include <stdlib.h>
667 #include <time.h>
668 #ifndef tzname /* For SGI. */
669 extern char *tzname[]; /* RS6000 and others reject char **tzname. */
670 #endif>>,
671 changequote([, ])dnl
672 [atoi(*tzname);], ac_cv_var_tzname=yes, ac_cv_var_tzname=no)])
673 if test $ac_cv_var_tzname = yes; then
674 U_TZNAME=tzname
675 U_HAVE_TZNAME=1
676 else
677 AC_CACHE_CHECK(for _tzname,ac_cv_var__tzname,
678 [AC_TRY_LINK(
679 changequote(<<, >>)dnl
680 <<#include <stdlib.h>
681 #include <time.h>
682 extern char *_tzname[];
683 >>,
684 changequote([, ])dnl
685 [atoi(*_tzname);], ac_cv_var__tzname=yes, ac_cv_var__tzname=no)])
686 if test $ac_cv_var__tzname = yes; then
687 U_TZNAME=_tzname
688 U_HAVE_TZNAME=1
689 fi
690 fi
691 AC_SUBST(U_HAVE_TZNAME)
692 AC_SUBST(U_TZNAME)
693
694 AC_CACHE_CHECK(for timezone,ac_cv_var_timezone,
695 [AC_TRY_LINK(
696 changequote(<<, >>)dnl
697 <<#ifndef __USE_POSIX
698 #define __USE_POSIX
699 #endif
700 #ifndef __USE_XOPEN
701 #define __USE_XOPEN
702 #endif
703 #include <time.h>
704 >>,
705 changequote([, ])dnl
706 [timezone = 1;], ac_cv_var_timezone=yes, ac_cv_var_timezone=no)])
707 U_HAVE_TIMEZONE=0
708 if test $ac_cv_var_timezone = yes; then
709 U_TIMEZONE=timezone
710 U_HAVE_TIMEZONE=1
711 else
712 AC_CACHE_CHECK(for __timezone,ac_cv_var___timezone,
713 [AC_TRY_LINK([#include <time.h>],
714 [__timezone = 1;], ac_cv_var___timezone=yes, ac_cv_var___timezone=no)])
715 if test $ac_cv_var___timezone = yes; then
716 U_TIMEZONE=__timezone
717 U_HAVE_TIMEZONE=1
718 else
719 AC_CACHE_CHECK(for _timezone,ac_cv_var__timezone,
720 [AC_TRY_LINK([#include <time.h>],
721 [_timezone = 1;], ac_cv_var__timezone=yes, ac_cv_var__timezone=no)])
722 if test $ac_cv_var__timezone = yes; then
723 U_TIMEZONE=_timezone
724 U_HAVE_TIMEZONE=1
725 fi
726 fi
727 fi
728 AC_SUBST(U_HAVE_TIMEZONE)
729 AC_SUBST(U_TIMEZONE)
730
731 dnl Checks for typedefs
732 AC_CHECK_TYPE(int8_t,signed char)
733 AC_CHECK_TYPE(uint8_t,unsigned char)
734 AC_CHECK_TYPE(int16_t,signed short)
735 AC_CHECK_TYPE(uint16_t,unsigned short)
736 AC_CHECK_TYPE(int32_t,signed long)
737 AC_CHECK_TYPE(uint32_t,unsigned long)
738 AC_CHECK_TYPE(int64_t,signed long long)
739 AC_CHECK_TYPE(uint64_t,unsigned long long)
740
741 if test $ac_cv_type_int8_t = no; then
742 HAVE_INT8_T=0
743 else
744 HAVE_INT8_T=1
745 fi
746 AC_SUBST(HAVE_INT8_T)
747
748 if test $ac_cv_type_uint8_t = no; then
749 HAVE_UINT8_T=0
750 else
751 HAVE_UINT8_T=1
752 fi
753 AC_SUBST(HAVE_UINT8_T)
754
755 if test $ac_cv_type_int16_t = no; then
756 HAVE_INT16_T=0
757 else
758 HAVE_INT16_T=1
759 fi
760 AC_SUBST(HAVE_INT16_T)
761
762 if test $ac_cv_type_uint16_t = no; then
763 HAVE_UINT16_T=0
764 else
765 HAVE_UINT16_T=1
766 fi
767 AC_SUBST(HAVE_UINT16_T)
768
769 if test $ac_cv_type_int32_t = no; then
770 HAVE_INT32_T=0
771 else
772 HAVE_INT32_T=1
773 fi
774 AC_SUBST(HAVE_INT32_T)
775
776 if test $ac_cv_type_uint32_t = no; then
777 HAVE_UINT32_T=0
778 else
779 HAVE_UINT32_T=1
780 fi
781 AC_SUBST(HAVE_UINT32_T)
782
783 if test $ac_cv_type_int64_t = no; then
784 HAVE_INT64_T=0
785 else
786 HAVE_INT64_T=1
787 fi
788 AC_SUBST(HAVE_INT64_T)
789
790 if test $ac_cv_type_uint64_t = no; then
791 HAVE_UINT64_T=0
792 else
793 HAVE_UINT64_T=1
794 fi
795 AC_SUBST(HAVE_UINT64_T)
796
797 dnl Do various wchar_t related checks
798 AC_CHECK_HEADER(wchar.h)
799 if test "$ac_cv_header_wchar_h" = no
800 then
801 U_HAVE_WCHAR_H=0
802 U_HAVE_WCSCPY=0
803 else
804 AC_DEFINE(HAVE_WCHAR_H)
805 U_HAVE_WCHAR_H=1
806 dnl Some broken systems have wchar.h but not some of its functions...
807 AC_SEARCH_LIBS(wcscpy, wcs w)
808 if test "$ac_cv_search_wcscpy" != no; then
809 U_HAVE_WCSCPY=1
810 else
811 U_HAVE_WCSCPY=0
812 fi
813 fi
814 AC_SUBST(U_HAVE_WCHAR_H)
815 AC_SUBST(U_HAVE_WCSCPY)
816
817 AC_CHECK_SIZEOF([wchar_t], 0, [
818 #if STDC_HEADERS
819 #include <stddef.h>
820 #endif
821 #include <stdlib.h>
822 #if HAVE_WCHAR_H
823 #include <string.h>
824 #include <wchar.h>
825 #endif])
826 U_SIZEOF_WCHAR_T=$ac_cv_sizeof_wchar_t
827 # We do this check to verify that everything is okay.
828 if test $U_SIZEOF_WCHAR_T = 0; then
829 if test $U_HAVE_WCHAR_H=1; then
830 AC_MSG_ERROR(There is wchar.h but the size of wchar_t is 0)
831 fi
832 fi
833 AC_SUBST(U_SIZEOF_WCHAR_T)
834
835 AC_MSG_CHECKING([for UTF-16 string literal support])
836 U_CHECK_UTF16_STRING=1
837 CHECK_UTF16_STRING_RESULT="unknown"
838 case "${host}" in
839 *-*-aix*|powerpc64-*-linux*)
840 if test "$ac_cv_prog_gcc" = no; then
841 OLD_CFLAGS="${CFLAGS}"
842 OLD_CXXFLAGS="${CXXFLAGS}"
843 CFLAGS="${CFLAGS} -qutf"
844 CXXFLAGS="${CXXFLAGS} -qutf"
845 AC_TRY_COMPILE([const unsigned short hello[] = u"hello";],[],
846 [U_CHECK_UTF16_STRING=1],[U_CHECK_UTF16_STRING=0])
847 if test "$U_CHECK_UTF16_STRING" = 0; then
848 CFLAGS="${OLD_CFLAGS}"
849 CXXFLAGS="${OLD_CXXFLAGS}"
850 else
851 CHECK_UTF16_STRING_RESULT="-qutf"
852 fi
853 fi
854 ;;
855 *-*-solaris*)
856 if test "$ac_cv_prog_gcc" = no; then
857 OLD_CFLAGS="${CFLAGS}"
858 OLD_CXXFLAGS="${CXXFLAGS}"
859 CFLAGS="${CFLAGS} -xustr=ascii_utf16_ushort"
860 CXXFLAGS="${CXXFLAGS} -xustr=ascii_utf16_ushort"
861 AC_TRY_COMPILE([const unsigned short hello[] = U"hello";],[],
862 [U_CHECK_UTF16_STRING=1],[U_CHECK_UTF16_STRING=0])
863 if test "$U_CHECK_UTF16_STRING" = 0; then
864 CFLAGS="${OLD_CFLAGS}"
865 CXXFLAGS="${OLD_CXXFLAGS}"
866 else
867 CHECK_UTF16_STRING_RESULT="-xustr=ascii_utf16_ushort"
868
869 # Since we can't detect the availability of this UTF-16 syntax at compile time,
870 # we depend on configure telling us that we can use it.
871 # Since we can't ensure ICU users use -xustr=ascii_utf16_ushort,
872 # we only use this macro within ICU.
873 # If an ICU user uses icu-config, this feature will be enabled.
874 CPPFLAGS="${CPPFLAGS} -DU_CHECK_UTF16_STRING=1"
875 U_CHECK_UTF16_STRING=0
876 fi
877 fi
878 ;;
879 *-*-hpux*)
880 if test "$ac_cv_prog_gcc" = no; then
881 dnl The option will be detected at compile time without additional compiler options.
882 CHECK_UTF16_STRING_RESULT="available"
883 fi
884 ;;
885 *-*-cygwin)
886 dnl wchar_t can be used
887 CHECK_UTF16_STRING_RESULT="available"
888 ;;
889 *)
890 ;;
891 esac
892 AC_MSG_RESULT($CHECK_UTF16_STRING_RESULT)
893 AC_SUBST(U_CHECK_UTF16_STRING)
894
895 dnl Enable/disable extras
896 AC_ARG_ENABLE(extras,
897 [ --enable-extras build ICU extras [default=yes]],
898 [case "${enableval}" in
899 yes) extras=true ;;
900 no) extras=false ;;
901 *) AC_MSG_ERROR(bad value ${enableval} for --enable-extras) ;;
902 esac],
903 extras=true)
904 ICU_CONDITIONAL(EXTRAS, test "$extras" = true)
905 AC_ARG_ENABLE(icuio,
906 [ --enable-icuio build ICU's icuio library [default=yes]],
907 [case "${enableval}" in
908 yes) icuio=true ;;
909 no) icuio=false ;;
910 *) AC_MSG_ERROR(bad value ${enableval} for --enable-icuio) ;;
911 esac],
912 icuio=true)
913 ICU_CONDITIONAL(ICUIO, test "$icuio" = true)
914
915 dnl Enable/disable layout
916 AC_ARG_ENABLE(layout,
917 [ --enable-layout build ICU's layout library [default=yes]],
918 [case "${enableval}" in
919 yes) layout=true ;;
920 no) layout=false ;;
921 *) AC_MSG_ERROR(bad value ${enableval} for --enable-layout) ;;
922 esac],
923 layout=true)
924 ICU_CONDITIONAL(LAYOUT, test "$layout" = true)
925
926 AC_ARG_WITH(data-packaging,
927 [ --with-data-packaging=type specify how to package ICU data (files, archive, library, auto) [default=auto]],
928 [case "${withval}" in
929 files|archive|library) datapackaging=$withval ;;
930 auto) datapackaging=$withval ;;
931 common) datapackaging=archive ;;
932 dll) datapackaging=library ;;
933 static) datapackaging=static ;;
934 *) AC_MSG_ERROR(bad value ${withval} for --with-data-packaging) ;;
935 esac],
936 [datapackaging=])
937
938 dnl Note: 'thesysconfdir' is an evaluated version, for Man pages, so also for thedatadir, thelibdir, etc..
939 dnl thesysconfdir=`eval echo $sysconfdir`
940 dnl AC_SUBST(thesysconfdir)
941 dnl thelibdir=`test "x$exec_prefix" = xNONE && exec_prefix="$prefix"; eval echo $libdir`
942 dnl AC_SUBST(thelibdir)
943 thedatadir=`eval echo $datadir`
944 dnl AC_SUBST(thedatadir)
945 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}.
946 pkgicudatadir=$datadir
947 thepkgicudatadir=$thedatadir
948 AC_SUBST(pkgicudatadir)
949 AC_SUBST(thepkgicudatadir)
950
951 dnl Shouldn't need the AC_SUBST
952
953 if test x"$datapackaging" = x -o x"$datapackaging" = xauto; then
954 datapackaging=library
955 fi
956
957 case "$datapackaging" in
958 files)
959 DATA_PACKAGING_MODE=files
960 ;;
961 archive)
962 DATA_PACKAGING_MODE=common
963 ;;
964 library)
965 DATA_PACKAGING_MODE=dll
966 ;;
967 esac
968 AC_SUBST(DATA_PACKAGING_MODE)
969
970 dnl Sets a library suffix
971 AC_MSG_CHECKING([for a library suffix to use])
972 AC_ARG_WITH(library-suffix,
973 [ --with-library-suffix=suffix tag a suffix to the library names [default=]],
974 [ICULIBSUFFIX="${withval}"],
975 [ICULIBSUFFIX=])
976 msg=$ICULIBSUFFIX
977 if test "$msg" = ""; then
978 msg=none
979 fi
980 AC_MSG_RESULT($msg)
981 AC_SUBST(ICULIBSUFFIX)
982 changequote(<<, >>)dnl
983 if test "$ICULIBSUFFIX" != ""
984 then
985 U_HAVE_LIB_SUFFIX=1
986 ICULIBSUFFIXCNAME=`echo _$ICULIBSUFFIX | sed 's/[^A-Za-z0-9_]/_/g'`
987 else
988 U_HAVE_LIB_SUFFIX=0
989 fi
990 changequote([, ])dnl
991 AC_SUBST(U_HAVE_LIB_SUFFIX)
992 AC_SUBST(ICULIBSUFFIXCNAME)
993
994 dnl Enable/disable tests
995 AC_ARG_ENABLE(tests,
996 [ --enable-tests build ICU tests [default=yes]],
997 [case "${enableval}" in
998 yes) tests=true ;;
999 no) tests=false ;;
1000 *) AC_MSG_ERROR(bad value ${enableval} for --enable-tests) ;;
1001 esac],
1002 tests=true)
1003 ICU_CONDITIONAL(TESTS, test "$tests" = true)
1004
1005 dnl Enable/disable samples
1006 AC_ARG_ENABLE(samples,
1007 [ --enable-samples build ICU samples [default=yes]
1008
1009 Additionally, the variable FORCE_LIBS may be set before calling configure.
1010 If set, it will REPLACE any automatic list of libraries.],
1011 [case "${enableval}" in
1012 yes) samples=true ;;
1013 no) samples=false ;;
1014 *) AC_MSG_ERROR(bad value ${enableval} for --enable-samples) ;;
1015 esac],
1016 samples=true)
1017 ICU_CONDITIONAL(SAMPLES, test "$samples" = true)
1018
1019 ICUDATA_CHAR=$U_ENDIAN_CHAR
1020
1021 dnl Platform-specific Makefile setup
1022 dnl set ICUDATA_CHAR to 'e' for any EBCDIC (which should be big endian) platform.
1023 case "${host}" in
1024 *-*-solaris*) platform=U_SOLARIS ;;
1025 *-*-linux*) platform=U_LINUX ;;
1026 *-pc-gnu) platform=U_HURD ;;
1027 *-*-*bsd*|*-*-dragonfly*) platform=U_BSD ;;
1028 *-*-aix*) platform=U_AIX ;;
1029 *-*-hpux*) platform=U_HPUX ;;
1030 *-apple-darwin*|*-apple-rhapsody*) platform=U_DARWIN ;;
1031 *-*-cygwin*|*-*-mingw*) platform=U_CYGWIN ;;
1032 *-*ibm-openedition*|*-*-os390*) platform=OS390
1033 if test "${ICU_ENABLE_ASCII_STRINGS}" != "1"; then
1034 ICUDATA_CHAR="e"
1035 fi ;;
1036 *-*-os400*) platform=OS400
1037 if test "${ICU_ENABLE_ASCII_STRINGS}" != "1"; then
1038 ICUDATA_CHAR="e"
1039 fi ;;
1040 *-*-nto*) platform=U_QNX ;;
1041 *-dec-osf*) platform=U_OSF ;;
1042 *-*-beos) platform=U_BEOS ;;
1043 *-*-irix*) platform=U_IRIX ;;
1044 *-ncr-*) platform=U_MPRAS ;;
1045 *) platform=U_UNKNOWN_PLATFORM ;;
1046 esac
1047 AC_SUBST(ICUDATA_CHAR)
1048 AC_SUBST(platform)
1049 platform_make_fragment_name="$icu_cv_host_frag"
1050 platform_make_fragment='$(top_srcdir)/config/'"$platform_make_fragment_name"
1051 AC_SUBST(platform_make_fragment_name)
1052 AC_SUBST(platform_make_fragment)
1053
1054 if test "${FORCE_LIBS}" != ""; then
1055 echo " *** Overriding automatically chosen [LIBS=$LIBS], using instead [FORCE_LIBS=${FORCE_LIBS}]" 1>&6
1056 LIBS=${FORCE_LIBS}
1057 fi
1058
1059
1060 dnl Now that we're done using CPPFLAGS etc. for tests, we can change it
1061 dnl for build.
1062
1063 if test $ICU_USE_THREADS -ne 0
1064 then
1065 CPPFLAGS="$CPPFLAGS \$(THREADSCPPFLAGS)"
1066 CFLAGS="$CFLAGS \$(THREADSCFLAGS)"
1067 CXXFLAGS="$CXXFLAGS \$(THREADSCXXFLAGS)"
1068 fi
1069
1070 dnl output the Makefiles
1071 AC_OUTPUT([icudefs.mk \
1072 Makefile \
1073 data/icupkg.inc \
1074 config/Makefile.inc \
1075 data/Makefile \
1076 stubdata/Makefile \
1077 common/Makefile \
1078 i18n/Makefile \
1079 layout/Makefile \
1080 layoutex/Makefile \
1081 io/Makefile \
1082 extra/Makefile \
1083 extra/uconv/Makefile \
1084 extra/scrptrun/Makefile \
1085 tools/Makefile \
1086 tools/ctestfw/Makefile \
1087 tools/toolutil/Makefile \
1088 tools/makeconv/Makefile \
1089 tools/genrb/Makefile \
1090 tools/genuca/Makefile \
1091 tools/genccode/Makefile \
1092 tools/gencmn/Makefile \
1093 tools/gencnval/Makefile \
1094 tools/genctd/Makefile \
1095 tools/gennames/Makefile \
1096 tools/gentest/Makefile \
1097 tools/gennorm/Makefile \
1098 tools/genprops/Makefile \
1099 tools/gencase/Makefile \
1100 tools/genbidi/Makefile \
1101 tools/genpname/Makefile \
1102 tools/genbrk/Makefile \
1103 tools/gensprep/Makefile \
1104 tools/icupkg/Makefile \
1105 tools/icuswap/Makefile \
1106 tools/pkgdata/Makefile \
1107 tools/tzcode/Makefile \
1108 test/Makefile \
1109 test/compat/Makefile \
1110 test/testdata/Makefile \
1111 test/testdata/pkgdata.inc \
1112 test/hdrtst/Makefile \
1113 test/intltest/Makefile \
1114 test/cintltst/Makefile \
1115 test/iotest/Makefile \
1116 test/letest/Makefile \
1117 test/perf/Makefile \
1118 test/perf/collationperf/Makefile \
1119 test/perf/ubrkperf/Makefile \
1120 test/perf/charperf/Makefile \
1121 test/perf/convperf/Makefile \
1122 test/perf/normperf/Makefile \
1123 test/perf/strsrchperf/Makefile \
1124 test/perf/unisetperf/Makefile \
1125 test/perf/usetperf/Makefile \
1126 test/perf/ustrperf/Makefile \
1127 test/perf/utfperf/Makefile \
1128 samples/Makefile samples/date/Makefile \
1129 samples/cal/Makefile samples/layout/Makefile \
1130 common/unicode/platform.h])
1131
1132 if test $ICU_USE_THREADS = 0; then
1133 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
1134 fi
1135
1136 if test -n "`$U_MAKE -v 2>&1 | grep '^GNU Make'`"; then
1137 echo "You must use $U_MAKE to build ICU."
1138 else
1139 echo "WARNING: $U_MAKE may not be GNU make."
1140 echo "This may cause ICU to fail to build. Please make sure that GNU make"
1141 echo "is in your PATH so that this configure script can detect its location."
1142 fi
1143
1144 $as_unset _CXX_CXXSUFFIX