]> git.saurik.com Git - apple/icu.git/blame - icuSources/configure.in
ICU-8.11.4.tar.gz
[apple/icu.git] / icuSources / configure.in
CommitLineData
b75a7d8f
A
1dnl -*-m4-*-
2dnl configure.in for ICU
73c04bcf 3dnl Copyright (c) 1999-2006, International Business Machines Corporation and
b75a7d8f
A
4dnl others. All Rights Reserved.
5dnl Stephen F. Booth, heavily modified by Yves and others
6
b75a7d8f
A
7dnl Process this file with autoconf to produce a configure script
8AC_INIT(common/unicode/utypes.h)
9
10AC_CONFIG_HEADER(common/icucfg.h)
11PACKAGE="icu"
12AC_SUBST(PACKAGE)
13
14AC_MSG_CHECKING(for ICU version numbers)
15
16dnl Get the ICU version from uversion.h or other headers
17geticuversion() {
18 [sed -n 's/^[ ]*#[ ]*define[ ]*U_ICU_VERSION[ ]*"\([^"]*\)".*/\1/p' "$@"]
19}
20VERSION=`geticuversion $srcdir/common/unicode/uversion.h`
21if 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
26fi
27dnl Compute a reasonable library version from the release version. This is
28dnl very bad, but that's wanted... We want to make sure that the LIB_VERSION
29dnl 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/'`]
31LIB_VERSION_MAJOR=`echo $LIB_VERSION | sed 's/\..*//'`
32AC_SUBST(VERSION)
33AC_SUBST(LIB_VERSION)
34AC_SUBST(LIB_VERSION_MAJOR)
35AC_MSG_RESULT([release $VERSION, library $LIB_VERSION])
36
73c04bcf 37UNICODE_VERSION="5.0"
b75a7d8f
A
38AC_SUBST(UNICODE_VERSION)
39
73c04bcf
A
40dnl Determine the host system
41AC_CANONICAL_HOST
42
b75a7d8f
A
43AC_SUBST(CPPFLAGS)
44
73c04bcf
A
45dnl This variable is needed on z/OS because the C++ compiler only recognizes .C
46_CXX_CXXSUFFIX=cc
47export _CXX_CXXSUFFIX
b75a7d8f
A
48dnl Checks for programs
49AC_PROG_CC
50AC_PROG_CXX
51AC_PROG_INSTALL
52
53# make sure install is relative to srcdir - if a script
54if 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
59fi
60
374ca955 61#AC_CHECK_PROG(AUTOCONF, autoconf, autoconf, true)
73c04bcf 62#AC_CHECK_PROG(STRIP, strip, strip, true)
b75a7d8f
A
63
64dnl Check for the platform make
65AC_PATH_PROGS(U_MAKE, gmake gnumake, make)
66AC_SUBST(U_MAKE)
67
68dnl Check for doxygen to generate documentation
69AC_PATH_PROG(DOXYGEN,doxygen,,$PATH:/usr/local/bin:/usr/bin)
70
73c04bcf
A
71dnl Check that the linker is usable
72ICU_PROG_LINK
73
74dnl Determine the executable suffix
75dnl We don't use AC_EXEEXT because some compilers output separate debugging
76dnl files, which confuses the AC_EXEEXT macro.
77AC_MSG_CHECKING(checking for executable suffix)
78case "${host}" in
79 *-*-cygwin*|*-*-mingw*) EXEEXT=.exe ;;
80 *) EXEEXT="" ;;
81esac
82ac_exeext=$EXEEXT
83AC_MSG_RESULT($EXEEXT)
84AC_SUBST(EXEEXT)
b75a7d8f
A
85
86dnl Determine how strict we want to be when compiling
87AC_CHECK_STRICT_COMPILE
88
89dnl Check if we can build and use 64-bit libraries
90AC_CHECK_64BIT_LIBS
91AC_SUBST(ARFLAGS)
92AC_SUBST(COMPILE_LINK_ENVVAR)
93
73c04bcf 94dnl Determine the Makefile fragment
b75a7d8f
A
95ICU_CHECK_MH_FRAG
96
b75a7d8f
A
97dnl Checks for libraries and other host specific stuff
98dnl On HP/UX, don't link to -lm from a shared lib because it isn't
99dnl PIC (at least on 10.2)
100case "${host}" in
b75a7d8f
A
101 *-*-hpux*) AC_CHECK_LIB(m, floor, LIB_M="-lm") ;;
102
103 *) AC_CHECK_LIB(m, floor)
104 LIB_M="" ;;
105esac
106AC_SUBST(LIB_M)
107
b75a7d8f
A
108dnl Check whether to build shared libraries
109AC_MSG_CHECKING([whether to build shared libraries])
110enabled=no
111AC_ARG_ENABLE(shared,
374ca955 112 [ --enable-shared build shared libraries [default=yes]],
b75a7d8f
A
113 [ case "${enableval}" in
114 yes|"") enabled=yes; ENABLE_SHARED=YES ;;
115 no);;
116 *) ;;
117 esac],
118 [enabled=yes; ENABLE_SHARED=YES]
119)
120AC_MSG_RESULT($enabled)
121AC_SUBST(ENABLE_SHARED)
122
123dnl Check whether to build static libraries
124AC_MSG_CHECKING([whether to build static libraries])
125enabled=no
126AC_ARG_ENABLE(static,
374ca955 127 [ --enable-static build static libraries [default=no]],
b75a7d8f
A
128 [ case "${enableval}" in
129 yes|"") enabled=yes; ENABLE_STATIC=YES ;;
130 no) ;;
131 *) ;;
132 esac],
133)
134AC_MSG_RESULT($enabled)
135AC_SUBST(ENABLE_STATIC)
136
374ca955
A
137dnl Check whether to build debug libraries
138AC_MSG_CHECKING([whether to build debug libraries])
139enabled=no
140ENABLE_DEBUG=0
141AC_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)
148AC_MSG_RESULT($enabled)
149AC_SUBST(ENABLE_DEBUG)
150
151dnl Check whether to build release libraries
152AC_MSG_CHECKING([whether to build release libraries])
153enabled=yes
154ENABLE_RELEASE=1
155AC_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)
162AC_MSG_RESULT($enabled)
163AC_SUBST(ENABLE_RELEASE)
164
73c04bcf
A
165dnl Check whether to enabled draft APIs
166AC_MSG_CHECKING([whether to enable draft APIs])
167enabled=yes
168U_DEFAULT_SHOW_DRAFT=1
169AC_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)
176AC_MSG_RESULT($enabled)
177dnl Make sure that we can use draft API in ICU.
178if test "$U_DEFAULT_SHOW_DRAFT" = 0; then
179 CPPFLAGS="$CPPFLAGS -DU_SHOW_DRAFT_API"
180fi
181AC_SUBST(U_DEFAULT_SHOW_DRAFT)
182
b75a7d8f
A
183AC_PROG_RANLIB
184AC_PATH_PROG(AR,ar,[echo archiver ar not found re-run configure ; false],$PATH:/bin:/usr/bin:/usr/ccs/bin)
185
186AC_MSG_CHECKING([whether to enable renaming of symbols])
187enabled=yes
188U_DISABLE_RENAMING=0
189AC_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)
197AC_MSG_RESULT($enabled)
198AC_SUBST(U_DISABLE_RENAMING)
199
374ca955
A
200AC_MSG_CHECKING([whether to enable function and data tracing])
201enabled=yes
202U_ENABLE_TRACING=1
203AC_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)
211AC_MSG_RESULT($enabled)
212AC_SUBST(U_ENABLE_TRACING)
213
b75a7d8f
A
214dnl Check whether to use the evil rpath or not
215AC_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)
224AC_SUBST(ENABLE_RPATH)
225
226
227dnl set up U_INLINE.
228dnl Copy the definition of AC_C_INLINE, with slight mods.
229dnl
230AC_CACHE_CHECK([for definition of U_INLINE for C], ac_cv_c_inline,
231[ac_cv_c_inline=no
232for ac_kw in inline __inline__ __inline; do
374ca955 233 AC_TRY_COMPILE(, [return 0;} $ac_kw int foo() {], [ac_cv_c_inline=$ac_kw; break])
b75a7d8f
A
234 done
235 ])
236case "$ac_cv_c_inline" in
237 yes) U_INLINE= "inline" ;;
238 no ) U_INLINE= ;;
239 *) U_INLINE=$ac_cv_c_inline ;;
240esac
241AC_SUBST(U_INLINE)
242
243threads=true
244
245dnl Enable/disable threads
246AC_ARG_ENABLE(threads,
374ca955 247 [ --enable-threads build ICU with thread safety [default=yes]],
b75a7d8f
A
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)
254ICU_CONDITIONAL(THREADS, test "$threads" = true)
255
256ICU_USE_THREADS=0
257
258if test $threads = true; then
b75a7d8f
A
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
73c04bcf 267 ICU_USE_THREADS=1
b75a7d8f 268 else
73c04bcf
A
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.
b75a7d8f 274
73c04bcf 275 AC_SEARCH_LIBS_FIRST(pthread_mutex_destroy, pthread pthreads c_r )
b75a7d8f 276
73c04bcf
A
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
b75a7d8f
A
290 ICU_USE_THREADS=1
291 fi
b75a7d8f 292 fi
73c04bcf
A
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
b75a7d8f
A
324fi
325
326AC_SUBST(ICU_USE_THREADS)
327
328dnl 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.
332HAVE_MMAP=0
333AC_MSG_CHECKING([for mmap])
334AC_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)] )
347AC_MSG_RESULT($ac_cv_func_mmap_ok)
348if test $ac_cv_func_mmap_ok = yes
349then
350 HAVE_MMAP=1
351fi
352AC_SUBST(HAVE_MMAP)
353
374ca955
A
354dnl Check to see if genccode can generate simple assembly.
355GENCCODE_ASSEMBLY=
356case "${host}" in
73c04bcf 357i*86-*-linux*|x86_64-*-linux*|powerpc*-*-linux*|i*86-*-*bsd*|i*86-*-solaris*)
374ca955
A
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 ;;
73c04bcf
A
362sparc-*-solaris*)
363 GENCCODE_ASSEMBLY="-a sun"
364 ;;
374ca955
A
365esac
366AC_SUBST(GENCCODE_ASSEMBLY)
367
368
b75a7d8f
A
369dnl Checks for header files
370AC_CHECK_HEADERS(inttypes.h)
371if test $ac_cv_header_inttypes_h = no; then
372 U_HAVE_INTTYPES_H=0
373else
374 U_HAVE_INTTYPES_H=1
375fi
376if 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
381fi
382
383AC_SUBST(U_HAVE_INTTYPES_H)
384
385AC_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
396U_IOSTREAM_SOURCE=0
397if test x$streams != xnone
398then
399 AC_LANG_SAVE
400 AC_LANG_CPLUSPLUS
374ca955
A
401 OLD_CXXFLAGS="${CXXFLAGS}"
402 case "${icu_cv_host_frag}" in
403 mh-hpux-acc)
404 CXXFLAGS="${CXXFLAGS} -AA"
405 ;;
406 esac
73c04bcf 407 AC_MSG_CHECKING([for iostream usability])
b75a7d8f
A
408 AC_TRY_COMPILE([#include <iostream>],[],
409 [ac_cv_header_iostream=yes],[ac_cv_header_iostream=no])
374ca955
A
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
b75a7d8f
A
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
374ca955 422 CXXFLAGS="${OLD_CXXFLAGS}"
73c04bcf
A
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
b75a7d8f
A
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
374ca955
A
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
b75a7d8f
A
444 else
445 AC_MSG_ERROR(${withval} iostream is not available)
446 fi
447 fi
448fi
449AC_SUBST(U_IOSTREAM_SOURCE)
450AC_LANG_RESTORE
451
452dnl Check for endianness
453AC_C_BIGENDIAN()
454if test $ac_cv_c_bigendian = no; then
455U_IS_BIG_ENDIAN=0
456U_ENDIAN_CHAR="l"
457else
458U_IS_BIG_ENDIAN=1
459U_ENDIAN_CHAR="b"
460fi
461AC_SUBST(U_IS_BIG_ENDIAN)
462
463dnl Do various POSIX related checks
464U_HAVE_NL_LANGINFO_CODESET=0
465U_NL_LANGINFO_CODESET=-1
466AC_CHECK_FUNC(nl_langinfo,[U_HAVE_NL_LANGINFO=1],[U_HAVE_NL_LANGINFO=0])
467AC_SUBST(U_HAVE_NL_LANGINFO)
468if 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
480fi
481AC_SUBST(U_HAVE_NL_LANGINFO_CODESET)
482AC_SUBST(U_NL_LANGINFO_CODESET)
483
484dnl Namespace support checks
485AC_LANG_CPLUSPLUS
486AC_MSG_CHECKING([for namespace support])
487AC_CACHE_VAL(ac_cv_namespace_ok,
488 [AC_TRY_LINK(
489 changequote(<<, >>)dnl
73c04bcf 490 <<namespace x_version {void f(){}}
b75a7d8f
A
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)] )
496AC_MSG_RESULT($ac_cv_namespace_ok)
497U_HAVE_NAMESPACE=1
498if test $ac_cv_namespace_ok = no
499then
500 U_HAVE_NAMESPACE=0
501fi
502AC_SUBST(U_HAVE_NAMESPACE)
503
504AC_MSG_CHECKING([for properly overriding new and delete])
505U_OVERRIDE_CXX_ALLOCATION=0
506U_HAVE_PLACEMENT_NEW=0
507AC_CACHE_VAL(ac_cv_override_cxx_allocation_ok,
508 [AC_TRY_LINK(
509 changequote(<<, >>)dnl
510 <<#include <stdlib.h>
374ca955
A
511 class UMemory {
512 public:
b75a7d8f
A
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)] )
521AC_MSG_RESULT($ac_cv_override_cxx_allocation_ok)
522if test $ac_cv_override_cxx_allocation_ok = yes
523then
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>
374ca955
A
530 class UMemory {
531 public:
b75a7d8f
A
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
547fi
548AC_SUBST(U_OVERRIDE_CXX_ALLOCATION)
549AC_SUBST(U_HAVE_PLACEMENT_NEW)
550
551AC_LANG_C
552AC_CHECK_FUNC(popen)
553if test x$ac_cv_func_popen = xyes
554then
555 U_HAVE_POPEN=1
556else
557 U_HAVE_POPEN=0
558fi
559AC_SUBST(U_HAVE_POPEN)
560
561AC_CHECK_FUNC(tzset)
374ca955 562U_HAVE_TZSET=0
b75a7d8f
A
563if test x$ac_cv_func_tzset = xyes
564then
565 U_TZSET=tzset
374ca955 566 U_HAVE_TZSET=1
b75a7d8f
A
567else
568 AC_CHECK_FUNC(_tzset)
569 if test x$ac_cv_func__tzset = xyes
570 then
374ca955
A
571 U_TZSET=_tzset
572 U_HAVE_TZSET=1
b75a7d8f
A
573 fi
574fi
374ca955 575AC_SUBST(U_HAVE_TZSET)
b75a7d8f 576AC_SUBST(U_TZSET)
374ca955
A
577
578U_HAVE_TZNAME=0
b75a7d8f
A
579AC_CACHE_CHECK(for tzname,ac_cv_var_tzname,
580[AC_TRY_LINK(
581changequote(<<, >>)dnl
582<<#ifndef __USE_POSIX
583#define __USE_POSIX
584#endif
374ca955 585#include <stdlib.h>
b75a7d8f
A
586#include <time.h>
587#ifndef tzname /* For SGI. */
588extern char *tzname[]; /* RS6000 and others reject char **tzname. */
589#endif>>,
590changequote([, ])dnl
591[atoi(*tzname);], ac_cv_var_tzname=yes, ac_cv_var_tzname=no)])
592if test $ac_cv_var_tzname = yes; then
593 U_TZNAME=tzname
374ca955 594 U_HAVE_TZNAME=1
b75a7d8f
A
595else
596 AC_CACHE_CHECK(for _tzname,ac_cv_var__tzname,
597 [AC_TRY_LINK(
598 changequote(<<, >>)dnl
374ca955
A
599 <<#include <stdlib.h>
600 #include <time.h>
b75a7d8f
A
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
374ca955 607 U_HAVE_TZNAME=1
b75a7d8f
A
608 fi
609fi
374ca955 610AC_SUBST(U_HAVE_TZNAME)
b75a7d8f
A
611AC_SUBST(U_TZNAME)
612
613AC_CACHE_CHECK(for timezone,ac_cv_var_timezone,
614[AC_TRY_LINK(
615changequote(<<, >>)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>>,
624changequote([, ])dnl
625[timezone = 1;], ac_cv_var_timezone=yes, ac_cv_var_timezone=no)])
626U_HAVE_TIMEZONE=0
627if test $ac_cv_var_timezone = yes; then
628 U_TIMEZONE=timezone
629 U_HAVE_TIMEZONE=1
630else
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
654fi
655AC_SUBST(U_HAVE_TIMEZONE)
656AC_SUBST(U_TIMEZONE)
657
658dnl Checks for typedefs
659AC_CHECK_TYPE(int8_t,signed char)
660AC_CHECK_TYPE(uint8_t,unsigned char)
661AC_CHECK_TYPE(int16_t,signed short)
662AC_CHECK_TYPE(uint16_t,unsigned short)
663AC_CHECK_TYPE(int32_t,signed long)
664AC_CHECK_TYPE(uint32_t,unsigned long)
665AC_CHECK_TYPE(int64_t,signed long long)
666AC_CHECK_TYPE(uint64_t,unsigned long long)
667
668if test $ac_cv_type_int8_t = no; then
669HAVE_INT8_T=0
670else
671HAVE_INT8_T=1
672fi
673AC_SUBST(HAVE_INT8_T)
674
675if test $ac_cv_type_uint8_t = no; then
676HAVE_UINT8_T=0
677else
678HAVE_UINT8_T=1
679fi
680AC_SUBST(HAVE_UINT8_T)
681
682if test $ac_cv_type_int16_t = no; then
683HAVE_INT16_T=0
684else
685HAVE_INT16_T=1
686fi
687AC_SUBST(HAVE_INT16_T)
688
689if test $ac_cv_type_uint16_t = no; then
690HAVE_UINT16_T=0
691else
692HAVE_UINT16_T=1
693fi
694AC_SUBST(HAVE_UINT16_T)
695
696if test $ac_cv_type_int32_t = no; then
697HAVE_INT32_T=0
698else
699HAVE_INT32_T=1
700fi
701AC_SUBST(HAVE_INT32_T)
702
703if test $ac_cv_type_uint32_t = no; then
704HAVE_UINT32_T=0
705else
706HAVE_UINT32_T=1
707fi
708AC_SUBST(HAVE_UINT32_T)
709
710if test $ac_cv_type_int64_t = no; then
711HAVE_INT64_T=0
712else
713HAVE_INT64_T=1
714fi
715AC_SUBST(HAVE_INT64_T)
716
717if test $ac_cv_type_uint64_t = no; then
718HAVE_UINT64_T=0
719else
720HAVE_UINT64_T=1
721fi
722AC_SUBST(HAVE_UINT64_T)
723
724dnl Do various wchar_t related checks
725AC_CHECK_HEADER(wchar.h)
726if test "$ac_cv_header_wchar_h" = no
727then
728 U_HAVE_WCHAR_H=0
729 U_HAVE_WCSCPY=0
730else
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
740fi
741AC_SUBST(U_HAVE_WCHAR_H)
742AC_SUBST(U_HAVE_WCSCPY)
743
744ac_default_sizeof_wchar_t=4
745AC_DO_CHECK_SIZEOF(wchar_t,$ac_default_sizeof_wchar_t,[
746#if STDC_HEADERS
747#include <stddef.h>
748#endif
73c04bcf 749#include <stdlib.h>
b75a7d8f
A
750#if HAVE_WCHAR_H
751#include <string.h>
752#include <wchar.h>
753#endif])
754dnl We could set ac_cv_sizeof_wchar_t to the default if the check returned
755dnl 0 (unknown) but we'd rather do it in the headers, so we know we had no
756dnl clue at configure time.
757U_SIZEOF_WCHAR_T=$ac_cv_sizeof_wchar_t
758if 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
762fi
763AC_SUBST(U_SIZEOF_WCHAR_T)
764
374ca955
A
765#dnl Echo
766#ECHO_N=$ac_n
767#ECHO_C=$ac_c
768#AC_SUBST(ECHO_N)
769#AC_SUBST(ECHO_C)
b75a7d8f
A
770
771dnl Enable/disable extras
772AC_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)
780ICU_CONDITIONAL(EXTRAS, test "$extras" = true)
73c04bcf 781AC_ARG_ENABLE(icuio,
374ca955 782 [ --enable-icuio build ICU's icuio library [default=yes]],
b75a7d8f 783 [case "${enableval}" in
374ca955
A
784 yes) icuio=true ;;
785 no) icuio=false ;;
786 *) AC_MSG_ERROR(bad value ${enableval} for --enable-icuio) ;;
b75a7d8f 787 esac],
374ca955
A
788 icuio=true)
789ICU_CONDITIONAL(ICUIO, test "$icuio" = true)
b75a7d8f
A
790
791dnl Enable/disable layout
792AC_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)
800ICU_CONDITIONAL(LAYOUT, test "$layout" = true)
801
802AC_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 ;;
374ca955
A
809 static) datapackaging=static ;;
810 *) AC_MSG_ERROR(bad value ${withval} for --with-data-packaging) ;;
b75a7d8f
A
811 esac],
812 [datapackaging=])
813
374ca955 814dnl Note: 'thesysconfdir' is an evaluated version, for Man pages, so also for thedatadir, thelibdir, etc..
73c04bcf
A
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)
b75a7d8f
A
819thedatadir=`eval echo $datadir`
820AC_SUBST(thedatadir)
374ca955
A
821dnl 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}.
822pkgicudatadir=$datadir
823thepkgicudatadir=$thedatadir
b75a7d8f
A
824AC_SUBST(pkgicudatadir)
825AC_SUBST(thepkgicudatadir)
826
827dnl Shouldn't need the AC_SUBST
b75a7d8f
A
828
829if test x"$datapackaging" = x -o x"$datapackaging" = xauto; then
830 datapackaging=library
831fi
832
833case "$datapackaging" in
834 files)
b75a7d8f
A
835 DATA_PACKAGING_MODE=files
836 ;;
837 archive)
b75a7d8f
A
838 DATA_PACKAGING_MODE=common
839 ;;
840 library)
b75a7d8f
A
841 DATA_PACKAGING_MODE=dll
842 ;;
843esac
b75a7d8f
A
844AC_SUBST(DATA_PACKAGING_MODE)
845
846dnl Sets a library suffix
847AC_MSG_CHECKING([for a library suffix to use])
848AC_ARG_WITH(library-suffix,
849 [ --with-library-suffix=suffix tag a suffix to the library names [default=]],
850 [ICULIBSUFFIX="${withval}"],
851 [ICULIBSUFFIX=])
852msg=$ICULIBSUFFIX
853if test "$msg" = ""; then
854 msg=none
855fi
856AC_MSG_RESULT($msg)
857AC_SUBST(ICULIBSUFFIX)
858changequote(<<, >>)dnl
859if test "$ICULIBSUFFIX" != ""
860then
861 U_HAVE_LIB_SUFFIX=1
862 ICULIBSUFFIXCNAME=`echo _$ICULIBSUFFIX | sed 's/[^A-Za-z0-9_]/_/g'`
863else
864 U_HAVE_LIB_SUFFIX=0
865fi
866changequote([, ])dnl
867AC_SUBST(U_HAVE_LIB_SUFFIX)
868AC_SUBST(ICULIBSUFFIXCNAME)
869
870dnl Enable/disable tests
871AC_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)
879ICU_CONDITIONAL(TESTS, test "$tests" = true)
880
881dnl Enable/disable samples
882AC_ARG_ENABLE(samples,
883 [ --enable-samples build ICU samples [default=yes]
884Additionally, 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)
891ICU_CONDITIONAL(SAMPLES, test "$samples" = true)
892
893ICUDATA_CHAR=$U_ENDIAN_CHAR
894
895dnl Platform-specific Makefile setup
896dnl set ICUDATA_CHAR to 'e' for any EBCDIC (which should be big endian) platform.
897case "${host}" in
898 *-*-solaris*) platform=U_SOLARIS ;;
899 *-*-linux*) platform=U_LINUX ;;
73c04bcf 900 *-*-*bsd*|*-*-dragonfly*) platform=U_BSD ;;
374ca955
A
901 *-*-aix*) platform=U_AIX ;;
902 *-*-hpux*) platform=U_HPUX ;;
b75a7d8f
A
903 *-apple-darwin*|*-apple-rhapsody*) platform=U_DARWIN ;;
904 *-*-cygwin*|*-*-mingw*) platform=U_CYGWIN ;;
905 *-*ibm-openedition*|*-*-os390*) platform=OS390
73c04bcf
A
906 if test "${ICU_ENABLE_ASCII_STRINGS}" != "1"; then
907 ICUDATA_CHAR="e"
908 fi ;;
b75a7d8f 909 *-*-os400*) platform=OS400
73c04bcf
A
910 if test "${ICU_ENABLE_ASCII_STRINGS}" != "1"; then
911 ICUDATA_CHAR="e"
912 fi ;;
b75a7d8f
A
913 *-*-nto*) platform=U_QNX ;;
914 *-dec-osf*) platform=U_OSF ;;
374ca955
A
915 *-*-beos) platform=U_BEOS ;;
916 *-*-irix*) platform=U_IRIX ;;
917 *-ncr-*) platform=U_MPRAS ;;
b75a7d8f
A
918 *) platform=U_UNKNOWN_PLATFORM ;;
919esac
920AC_SUBST(ICUDATA_CHAR)
921AC_SUBST(platform)
922platform_make_fragment_name="$icu_cv_host_frag"
923platform_make_fragment='$(top_srcdir)/config/'"$platform_make_fragment_name"
924AC_SUBST(platform_make_fragment_name)
925AC_SUBST(platform_make_fragment)
926
927dnl Handle -rpath options for shared library paths
928case "${host}" in
929 *-*-solaris*) ld_rpath_suf=":" ;;
930 *-*-linux*) ld_rpath_suf=" " ;;
73c04bcf 931 *-*-*bsd*|*-*-dragonfly*) ld_rpath_suf=" " ;;
b75a7d8f
A
932 *-*-aix*) ld_rpath_suf="" ;;
933 *-*-hpux*) ld_rpath_suf=":" ;;
934 *-*ibm-openedition*|*-*-os390*) ld_rpath_suf="" ;;
935 *-*-os400*) ld_rpath_suf=" " ;;
b75a7d8f
A
936 *-*-irix*) ld_rpath_suf=" " ;;
937 *) ld_rpath_suf="" ;;
938esac
939AC_SUBST(ld_rpath_suf)
940
941dnl On HP/UX, main() functions compiled in C don't invoke
942dnl static constructors in C++ libs. Hack around that here
943dnl by renaming some .c files to .cpp
944case "${host}" in
945 *-*-hpux*)
374ca955 946 if test "${icu_cv_host_frag}" = "mh-hpux-cc"; then
b75a7d8f
A
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 \
374ca955 955 tools/gencase/gencase \
73c04bcf 956 tools/genbidi/genbidi \
374ca955 957 tools/gensprep/gensprep
b75a7d8f
A
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 ;;
967esac
968
969if test "${FORCE_LIBS}" != ""; then
970 echo " *** Overriding automatically chosen [LIBS=$LIBS], using instead [FORCE_LIBS=${FORCE_LIBS}]" 1>&6
971 LIBS=${FORCE_LIBS}
972fi
973
974
975if test "${AIX_SHLIB}" != ""; then
976 echo " *** setting AIX_SHLIB (AIX only) to ${AIX_SHLIB}]" 1>&6
977else
978 AIX_SHLIB=makeC++SharedLib_r
979fi
980
981AC_SUBST(AIX_SHLIB)
982
983
b75a7d8f
A
984dnl Now that we're done using CPPFLAGS etc. for tests, we can change it
985dnl for build.
986
987if test $ICU_USE_THREADS -ne 0
988then
989 CPPFLAGS="$CPPFLAGS \$(THREADSCPPFLAGS)"
990 CFLAGS="$CFLAGS \$(THREADSCFLAGS)"
991 CXXFLAGS="$CXXFLAGS \$(THREADSCXXFLAGS)"
992fi
993
b75a7d8f 994dnl output the Makefiles
374ca955 995AC_OUTPUT([icudefs.mk \
b75a7d8f 996 Makefile \
374ca955
A
997 data/icupkg.inc \
998 config/Makefile.inc \
999 data/Makefile \
1000 stubdata/Makefile \
1001 common/Makefile \
1002 i18n/Makefile \
b75a7d8f
A
1003 layout/Makefile \
1004 layoutex/Makefile \
374ca955
A
1005 io/Makefile \
1006 extra/Makefile \
73c04bcf
A
1007 extra/uconv/Makefile \
1008 extra/scrptrun/Makefile \
1009 tools/Makefile \
1010 tools/ctestfw/Makefile \
1011 tools/toolutil/Makefile \
374ca955
A
1012 tools/makeconv/Makefile \
1013 tools/genrb/Makefile \
1014 tools/genuca/Makefile \
1015 tools/genccode/Makefile \
1016 tools/gencmn/Makefile \
1017 tools/gencnval/Makefile \
73c04bcf 1018 tools/genctd/Makefile \
374ca955 1019 tools/gennames/Makefile \
b75a7d8f
A
1020 tools/gentest/Makefile \
1021 tools/gennorm/Makefile \
1022 tools/genprops/Makefile \
374ca955 1023 tools/gencase/Makefile \
73c04bcf 1024 tools/genbidi/Makefile \
b75a7d8f
A
1025 tools/genpname/Makefile \
1026 tools/genbrk/Makefile \
374ca955 1027 tools/gensprep/Makefile \
73c04bcf 1028 tools/icupkg/Makefile \
374ca955
A
1029 tools/icuswap/Makefile \
1030 tools/pkgdata/Makefile \
b75a7d8f 1031 tools/dumpce/Makefile \
73c04bcf 1032 tools/tzcode/Makefile \
374ca955
A
1033 test/Makefile \
1034 test/testdata/Makefile \
1035 test/testdata/pkgdata.inc \
1036 test/hdrtst/Makefile \
b75a7d8f
A
1037 test/intltest/Makefile \
1038 test/cintltst/Makefile \
1039 test/iotest/Makefile \
b75a7d8f
A
1040 test/thaitest/Makefile \
1041 test/testmap/Makefile \
1042 test/letest/Makefile \
1043 test/threadtest/Makefile \
1044 samples/Makefile samples/date/Makefile \
73c04bcf 1045 samples/cal/Makefile samples/csdet/Makefile samples/layout/Makefile \
b75a7d8f
A
1046 common/unicode/platform.h])
1047
1048if 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
1050fi
1051
73c04bcf 1052if test -n "`$U_MAKE -v 2>&1 | grep '^GNU Make'`"; then
b75a7d8f 1053echo "You must use $U_MAKE to build ICU."
73c04bcf
A
1054else
1055echo "WARNING: $U_MAKE may not be GNU make."
1056echo "This may cause ICU to fail to build. Please make sure that GNU make"
1057echo "is in your PATH so that this configure script can detect its location."
1058fi
1059
1060$as_unset _CXX_CXXSUFFIX