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