]> git.saurik.com Git - apple/icu.git/blame_incremental - icuSources/configure.in
ICU-491.11.3.tar.gz
[apple/icu.git] / icuSources / configure.in
... / ...
CommitLineData
1# -*-autoconf-*-
2AC_COPYRIGHT([ Copyright (c) 1999-2012, International Business Machines Corporation and others. All Rights Reserved. ])
3# configure.in for ICU
4# Stephen F. Booth, heavily modified by Yves and others
5
6# Check for autoconf version
7AC_PREREQ(2.68)
8
9# Process this file with autoconf to produce a configure script
10AC_INIT([ICU])
11
12#TODO: IcuBug:8502
13#AC_INIT([ICU],
14# m4_esyscmd_s([sed -n 's/^[ ]*#[ ]*define[ ]*U_ICU_VERSION[ ]*"\([^"]*\)".*/\1/p' "./common/unicode/uvernum.h]"),
15# [http://icu-project.org/bugs],
16# [International Components for Unicode],
17# [http://icu-project.org])
18
19AC_CONFIG_SRCDIR([common/unicode/utypes.h])
20
21PACKAGE="icu"
22AC_SUBST(PACKAGE)
23
24# Use custom echo test for newline option
25# Current autoconf (2.65) gives incorrect echo newline option
26# for icu-config
27# This may be removed later - mow (June 17, 2010)
28ICU_ECHO_C= ICU_ECHO_N= ICU_ECHO_T=
29case `/bin/sh -c "echo -n x"` in
30-n*)
31 case `/bin/sh -c "echo 'x\c'"` in
32 *c*) ICU_ECHO_T=' ';; # ECHO_T is single tab character.
33 *) ICU_ECHO_C='\c';;
34 esac;;
35*)
36 ICU_ECHO_N='-n';;
37esac
38AC_SUBST(ICU_ECHO_N)
39AC_SUBST(ICU_ECHO_C)
40AC_SUBST(ICU_ECHO_T)
41
42AC_MSG_CHECKING(for ICU version numbers)
43
44# Get the ICU version from uversion.h or other headers
45geticuversion() {
46 [sed -n 's/^[ ]*#[ ]*define[ ]*U_ICU_VERSION[ ]*"\([^"]*\)".*/\1/p' "$@"]
47}
48getuversion() {
49 [sed -n 's/^[ ]*#[ ]*define[ ]*U_UNICODE_VERSION[ ]*"\([^"]*\)".*/\1/p' "$@"]
50}
51VERSION=`geticuversion $srcdir/common/unicode/uvernum.h`
52if test x"$VERSION" = x; then
53 as_fn_error $? "Cannot determine ICU version number from uvernum.h header file" "$LINENO" 5
54fi
55
56#TODO: IcuBug:8502
57#if test "$VERSION" != "$PACKAGE_VERSION"; then
58# AC_MSG_ERROR([configure was generated for $PACKAGE_VERSION but uvernum.h has $VERSION - please rerun autoconf])
59#fi
60
61UNICODE_VERSION=`getuversion $srcdir/common/unicode/uchar.h`
62if test x"$UNICODE_VERSION" = x; then
63 AC_MSG_ERROR([Cannot determine Unicode version number from uchar.h header file])
64fi
65# Compute a reasonable library version from the release version. This is
66# very bad, but that's wanted... We want to make sure that the LIB_VERSION
67# has at least a dot in it, so we'll add a .0 if needed.
68#[LIB_VERSION=`echo $VERSION | sed -e 's/\.//' -e 's/^\([^.]*\)$/\1.0/'`]
69LIB_VERSION=$VERSION
70LIB_VERSION_MAJOR=`echo $LIB_VERSION | sed 's/\..*//'`
71AC_SUBST(VERSION)
72AC_SUBST(LIB_VERSION)
73AC_SUBST(LIB_VERSION_MAJOR)
74AC_MSG_RESULT([release $VERSION, library $LIB_VERSION, unicode version $UNICODE_VERSION])
75
76AC_SUBST(UNICODE_VERSION)
77
78# Determine the host system
79AC_CANONICAL_HOST
80
81AC_SUBST(CPPFLAGS)
82
83# This variable is needed on z/OS because the C++ compiler only recognizes .C
84_CXX_CXXSUFFIX=cpp
85export _CXX_CXXSUFFIX
86
87# Accumulate #defines
88CONFIG_CPPFLAGS=""
89UCONFIG_CPPFLAGS=""
90
91# Check whether to build debug libraries
92AC_MSG_CHECKING([whether to build debug libraries])
93enabled=no
94ENABLE_DEBUG=0
95AC_ARG_ENABLE(debug,
96 [ --enable-debug build debug libraries and enable the U_DEBUG define [default=no]],
97 [ case "${enableval}" in
98 yes|"") enabled=yes; ENABLE_DEBUG=1; CONFIG_CPPFLAGS="$CONFIG_CPPFLAGS -DU_DEBUG=1" ;;
99 *) ;;
100 esac],
101)
102AC_MSG_RESULT($enabled)
103AC_SUBST(ENABLE_DEBUG)
104
105# Check whether to build release libraries
106AC_MSG_CHECKING([whether to build release libraries])
107enabled=yes
108ENABLE_RELEASE=1
109AC_ARG_ENABLE(release,
110 [ --enable-release build release libraries [default=yes]],
111 [ case "${enableval}" in
112 no) enabled=no; ENABLE_RELEASE=0 ;;
113 *) ;;
114 esac],
115)
116AC_MSG_RESULT($enabled)
117AC_SUBST(ENABLE_RELEASE)
118
119# Don't use the default C/CXXFLags
120: ${CFLAGS=""}
121: ${CXXFLAGS=""}
122
123# Checks for programs
124AC_PROG_CC
125AC_PROG_CXX
126
127# Ensure that if CXXFLAGS/CFLAGS were not set when calling configure, set it correctly based on (enable/disable) debug or release option
128# The release mode use is the default one for autoconf
129if test "$GCC" = yes; then
130 if test "$CFLAGS" = ""; then
131 if test "$ENABLE_DEBUG" = 1; then
132 CFLAGS=-g
133 fi
134 if test "$ENABLE_RELEASE" = 1; then
135 CFLAGS="$CFLAGS -O2"
136 fi
137 fi
138 if test "$CXXFLAGS" = ""; then
139 if test "$ENABLE_DEBUG" = 1; then
140 CXXFLAGS=-g
141 fi
142 if test "$ENABLE_RELEASE" = 1; then
143 CXXFLAGS="$CXXFLAGS -O2"
144 fi
145 fi
146fi
147
148AC_PROG_CPP
149
150AC_PROG_INSTALL
151
152AC_SUBST(cross_compiling)
153
154dnl use the pld hack to get ac_fn_cxx_try_link defined globally and not local
155AC_LANG_PUSH([C++])
156AC_LINK_IFELSE([AC_LANG_PROGRAM()])
157AC_LANG_POP([C++])
158
159# make sure install is relative to srcdir - if a script
160if test "$srcdir" = "."; then
161 # If srcdir isn't just ., then (srcdir) is already prepended.
162 if test "${ac_install_sh}" = "${INSTALL}"; then
163 INSTALL="\\\$(top_srcdir)/${ac_install_sh}"
164 fi
165fi
166
167#AC_CHECK_PROG(AUTOCONF, autoconf, autoconf, true)
168#AC_CHECK_PROG(STRIP, strip, strip, true)
169
170# Check for the platform make
171AC_PATH_PROGS(U_MAKE, gmake gnumake, make)
172AC_SUBST(U_MAKE)
173
174
175AC_ARG_WITH(cross-build,
176 [ --with-cross-build=dir specify an absolute path to the build directory of an ICU built for the current platform [default=no cross dir]],
177 [cross_buildroot="${withval}"],
178 [cross_buildroot=""])
179
180if test "X$cross_buildroot" = "X"; then
181 if test "$cross_compiling" = "yes"; then
182 AC_MSG_ERROR([Error! Cross compiling but no --with-cross-build option specified - please supply the path to an executable ICU's build root])
183 dnl '
184 fi
185else
186 if test -f "${cross_buildroot}/config/icucross.mk"; then
187 AC_MSG_RESULT([Using cross buildroot: $cross_buildroot])
188 else
189 if test -d "${cross_buildroot}"; then
190 AC_MSG_ERROR([${cross_buildroot}/config/icucross.mk not found. Please build ICU in ${cross_buildroot} first.])
191 else
192 AC_MSG_ERROR([No such directory ${cross_buildroot} supplied as the argument to --with-cross-build. Use an absolute path.])
193 fi
194 fi
195fi
196AC_SUBST(cross_buildroot)
197
198# Check for doxygen to generate documentation
199AC_PATH_PROG(DOXYGEN,doxygen,,$PATH:/usr/local/bin:/usr/bin)
200
201# Check that the linker is usable
202ICU_PROG_LINK
203
204# Determine the executable suffix
205# We don't use AC_EXEEXT because some compilers output separate debugging
206# files, which confuses the AC_EXEEXT macro.
207AC_MSG_CHECKING(checking for executable suffix)
208case "${host}" in
209 *-*-cygwin*|*-*-mingw*) EXEEXT=.exe ;;
210 *) EXEEXT="" ;;
211esac
212ac_exeext=$EXEEXT
213AC_MSG_RESULT($EXEEXT)
214AC_SUBST(EXEEXT)
215
216# Determine how strict we want to be when compiling
217AC_CHECK_STRICT_COMPILE
218
219# Check if we can build and use 64-bit libraries
220AC_CHECK_64BIT_LIBS
221AC_SUBST(ARFLAGS)
222AC_SUBST(COMPILE_LINK_ENVVAR)
223
224# Determine the Makefile fragment
225ICU_CHECK_MH_FRAG
226
227# Checks for libraries and other host specific stuff
228# On HP/UX, don't link to -lm from a shared lib because it isn't
229# PIC (at least on 10.2)
230case "${host}" in
231 *-*-hpux*) AC_CHECK_LIB(m, floor, LIB_M="-lm") ;;
232
233 *) AC_CHECK_LIB(m, floor)
234 LIB_M="" ;;
235esac
236AC_SUBST(LIB_M)
237
238# Check whether to build shared libraries
239AC_MSG_CHECKING([whether to build shared libraries])
240enabled=no
241AC_ARG_ENABLE(shared,
242 [ --enable-shared build shared libraries [default=yes]],
243 [ case "${enableval}" in
244 yes|"") enabled=yes; ENABLE_SHARED=YES ;;
245 no);;
246 *) ;;
247 esac],
248 [enabled=yes; ENABLE_SHARED=YES]
249)
250AC_MSG_RESULT($enabled)
251AC_SUBST(ENABLE_SHARED)
252
253# Check whether to build static libraries
254AC_MSG_CHECKING([whether to build static libraries])
255enabled=no
256AC_ARG_ENABLE(static,
257 [ --enable-static build static libraries [default=no]],
258 [ case "${enableval}" in
259 yes|"") enabled=yes; ENABLE_STATIC=YES ;;
260 no) ;;
261 *) ;;
262 esac],
263)
264AC_MSG_RESULT($enabled)
265AC_SUBST(ENABLE_STATIC)
266
267# When building release static library, there might be some optimization flags we can use
268if test "$ENABLE_STATIC" = "YES"; then
269 if test "$ENABLE_SHARED" != "YES"; then
270 if test "$ENABLE_RELEASE" = 1; then
271 AC_MSG_CHECKING([whether we can use static library optimization option])
272 CHECK_STATIC_OPT_FLAG=no
273
274 OLD_CPPFLAGS="${CPPFLAGS}"
275 OLD_LDFLAGS="${LDFLAGS}"
276
277 case "${host}" in
278 *-linux*|i*86-*-*bsd*|i*86-pc-gnu)
279 if test "$ac_cv_c_compiler_gnu" = yes; then
280 CPPFLAGS="${CPPFLAGS} -ffunction-sections -fdata-sections"
281 LDFLAGS="${LDFLAGS} -Wl,--gc-sections"
282 fi
283 ;;
284 *)
285 ;;
286 esac
287
288 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], [CHECK_STATIC_OPT_FLAG=yes], [CHECK_STATIC_OPT_FLAG=no])
289 AC_MSG_RESULT($CHECK_STATIC_OPT_FLAG)
290 if test "$CHECK_STATIC_OPT_FLAG" = no; then
291 CPPFLAGS="${OLD_CPPFLAGS}"
292 LDFLAGS="${OLD_LDFLAGS}"
293 fi
294 fi
295 fi
296fi
297
298
299# Check whether to enable auto cleanup of libraries
300AC_MSG_CHECKING([whether to enable auto cleanup of libraries])
301enabled=no
302UCLN_NO_AUTO_CLEANUP=1
303AC_ARG_ENABLE(auto-cleanup,
304 [ --enable-auto-cleanup enable auto cleanup of libraries [default=no]],
305 [ case "${enableval}" in
306 yes) enabled=yes;
307 CONFIG_CPPFLAGS="$CONFIG_CPPFLAGS -DUCLN_NO_AUTO_CLEANUP=0";
308 UCLN_NO_AUTO_CLEANUP=0
309 ;;
310 *) ;;
311 esac],
312)
313AC_MSG_RESULT($enabled)
314AC_SUBST(UCLN_NO_AUTO_CLEANUP)
315
316# MSVC floating-point option
317MSVC_RELEASE_FLAG=""
318if test $enabled = yes
319then
320 if test $icu_cv_host_frag = mh-cygwin-msvc
321 then
322 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
323 #if defined _MSC_VER && _MSC_VER >= 1400
324 #else
325 Microsoft Visual C++ < 2005
326 #endif
327 ]], [[]])],[MSVC_RELEASE_FLAG="/fp:precise"],[MSVC_RELEASE_FLAG="/Op"])
328
329 CFLAGS="${CFLAGS} ${MSVC_RELEASE_FLAG}"
330 CXXFLAGS="${CXXFLAGS} ${MSVC_RELEASE_FLAG}"
331 fi
332fi
333
334# Check whether to enabled draft APIs
335AC_MSG_CHECKING([whether to enable draft APIs])
336enabled=yes
337U_DEFAULT_SHOW_DRAFT=1
338AC_ARG_ENABLE(draft,
339 [ --enable-draft enable draft APIs (and internal APIs) [default=yes]],
340 [ case "${enableval}" in
341 no) enabled=no; U_DEFAULT_SHOW_DRAFT=0;
342 CONFIG_CPPFLAGS="$CONFIG_CPPFLAGS -DU_DEFAULT_SHOW_DRAFT=0"
343 ;;
344 *) ;;
345 esac],
346)
347AC_MSG_RESULT($enabled)
348# Make sure that we can use draft API in ICU.
349if test "$U_DEFAULT_SHOW_DRAFT" = 0; then
350 CONFIG_CPPFLAGS="$CONFIG_CPPFLAGS -DU_SHOW_DRAFT_API"
351fi
352AC_SUBST(U_DEFAULT_SHOW_DRAFT)
353
354AC_PROG_RANLIB
355
356# look for 'ar' the proper way
357AC_CHECK_TOOL(AR, ar, false)
358
359AC_MSG_CHECKING([whether to enable renaming of symbols])
360enabled=yes
361U_DISABLE_RENAMING=0
362AC_ARG_ENABLE(renaming,
363 [ --enable-renaming add a version suffix to symbols [default=yes]],
364 [ case "${enableval}" in
365 yes|"") enabled=yes ;;
366 no) enabled=no; U_DISABLE_RENAMING=1;
367 UCONFIG_CPPFLAGS="${UCONFIG_CPPFLAGS} -DU_DISABLE_RENAMING=1"
368 ;;
369 *) ;;
370 esac],
371)
372AC_MSG_RESULT($enabled)
373AC_SUBST(U_DISABLE_RENAMING)
374
375AC_MSG_CHECKING([whether to enable function and data tracing])
376enabled=no
377U_ENABLE_TRACING=0
378AC_ARG_ENABLE(tracing,
379 [ --enable-tracing enable function and data tracing [default=no]],
380 [ case "${enableval}" in
381 yes|"") enabled=yes;
382 CONFIG_CPPFLAGS="$CONFIG_CPPFLAGS -DU_ENABLE_TRACING=1";
383 U_ENABLE_TRACING=1 ;;
384 no) enabled=no; U_ENABLE_TRACING=0 ;;
385 *) ;;
386 esac],
387)
388AC_MSG_RESULT($enabled)
389AC_SUBST(U_ENABLE_TRACING)
390
391
392U_ENABLE_DYLOAD=1
393enable=yes
394AC_MSG_CHECKING([whether to enable dynamic loading of plugins])
395AC_ARG_ENABLE(dyload,
396 [ --disable-dyload disable dynamic loading [default=no]],
397 [ case "${enableval}" in
398 yes|"")
399 U_ENABLE_DYLOAD=1
400 enable=yes
401 ;;
402 no)
403 U_ENABLE_DYLOAD=0;
404 enable=no;
405 CONFIG_CPPFLAGS="$CONFIG_CPPFLAGS -DU_ENABLE_DYLOAD=0";
406 ;;
407 *) ;;
408 esac],
409)
410AC_MSG_RESULT($enable)
411AC_SUBST(U_ENABLE_DYLOAD)
412
413if test "$enable" = "yes"; then
414 AC_CHECK_HEADERS([dlfcn.h])
415 #AC_MSG_RESULT($enabled)
416 AC_SEARCH_LIBS([dlopen], [dl])
417 AC_CHECK_FUNCS([dlopen])
418
419 if test "x$ac_cv_func_dlopen" != xyes; then
420 CONFIG_CPPFLAGS="$CONFIG_CPPFLAGS -DHAVE_DLOPEN=0"
421 fi
422fi
423
424# Check for miscellanous functions.
425# So, use for putil / tools only.
426# Note that this will generate HAVE_GETTIMEOFDAY, not U_HAVE_GETTIMEOFDAY
427AC_CHECK_FUNCS([gettimeofday])
428
429
430# Check whether to use the evil rpath or not
431AC_ARG_ENABLE(rpath,
432 [ --enable-rpath use rpath when linking [default is only if necessary]],
433 [ case "${enableval}" in
434 yes|"") ENABLE_RPATH=YES ;;
435 no) ;;
436 *) ;;
437 esac],
438 [ENABLE_RPATH=NO]
439)
440AC_SUBST(ENABLE_RPATH)
441
442
443
444AC_LANG_PUSH([C++])
445AC_MSG_CHECKING([[if we have a C++ compiler]])
446AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[cxx_okay=yes],[cxx_okay=no])
447if test $cxx_okay = yes
448then
449 AC_MSG_RESULT([[Good]])
450else
451 AC_MSG_RESULT([[no]])
452 AC_MSG_ERROR([[C++ compiler $CXX does not work or no compiler found]])
453fi
454
455AC_MSG_CHECKING([[if #include <string> works]])
456AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <string>]], [[]])], [ac_cv_header_stdstring=yes], [ac_cv_header_stdstring=no])
457AC_MSG_RESULT($ac_cv_header_stdstring)
458if test $ac_cv_header_stdstring = yes
459then
460 U_HAVE_STD_STRING=1
461else
462 U_HAVE_STD_STRING=0
463 CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_STD_STRING=0"
464fi
465AC_SUBST(U_HAVE_STD_STRING)
466AC_LANG_POP([C++])
467
468threads=true
469
470# Enable/disable threads
471AC_ARG_ENABLE(threads,
472 [ --enable-threads build ICU with thread safety [default=yes]],
473 [case "${enableval}" in
474 yes) threads=true ;;
475 no) threads=false ;;
476 *) AC_MSG_ERROR(bad value ${enableval} for --enable-threads) ;;
477 esac],
478 threads=true)
479ICU_CONDITIONAL(THREADS, test "$threads" = true)
480
481ICU_USE_THREADS=0
482OLD_LIBS=${LIBS}
483
484if test $threads = true; then
485 # For Compaq Tru64 (OSF1), we must look for pthread_attr_init
486 # and must do this before seaching for pthread_mutex_destroy, or
487 # we will pick up libpthreads.so not libpthread.so
488 # If this fails, then we must test for HPUX specials, before
489 # moving on to a more generic test
490
491 AC_CHECK_LIB(pthread, pthread_attr_init)
492 if test $ac_cv_lib_pthread_pthread_attr_init = yes; then
493 ICU_USE_THREADS=1
494 else
495 # Locate the right library for POSIX threads. We look for the
496 # symbols in the libraries first, because on Solaris libc provides
497 # pthread_create but libpthread has the real code :(
498 # AIX uses libpthreads instead of libpthread, and HP/UX uses libpthread
499 # FreeBSD users may need libpthread if they do not have libc_r.
500
501 AC_SEARCH_LIBS_FIRST(pthread_mutex_destroy, pthread pthreads c_r )
502
503 if test "$ac_cv_search_pthread_mutex_destroy" != no; then
504 ICU_USE_THREADS=1
505 else
506 # For HP 11
507 AC_CHECK_LIB(pthread, pthread_mutex_init)
508 if test $ac_cv_lib_pthread_pthread_mutex_init = yes; then
509 ICU_USE_THREADS=1
510 fi
511 fi
512
513 AC_CHECK_FUNC(pthread_mutex_lock)
514
515 if test $ac_cv_func_pthread_mutex_lock = yes; then
516 ICU_USE_THREADS=1
517 fi
518 fi
519 # Check to see if we are using CygWin with MSVC
520 case "${host}" in
521 *-pc-cygwin*|*-pc-mingw*)
522 # For gcc, the thread options are set by mh-mingw/mh-cygwin
523 # For msvc, the thread options are set by runConfigureICU
524 ICU_USE_THREADS=1
525 ;;
526 *-*-hpux*)
527 # Add -mt because it does several nice things on newer compilers.
528 case "${icu_cv_host_frag}" in
529 mh-hpux-acc)
530 OLD_CXXFLAGS="${CXXFLAGS}"
531 CXXFLAGS="${CXXFLAGS} -mt"
532 if test x"`${CXX} ${CXXFLAGS} 2>&1`" != x""; then
533 CXXFLAGS="${OLD_CXXFLAGS}"
534 fi
535 ;;
536 esac
537 ;;
538 *-*-solaris*)
539 case "${icu_cv_host_frag}" in
540 mh-solaris)
541 LIBS="${LIBS} -mt"
542 ;;
543 esac
544 ;;
545 esac
546fi
547
548AC_SUBST(ICU_USE_THREADS)
549
550AC_ARG_ENABLE(weak-threads,
551 [ --enable-weak-threads weakly reference the threading library [default=no]],
552 [case "${enableval}" in
553 yes)
554 LIB_THREAD="${LIBS%${OLD_LIBS}}"
555 LIBS=${OLD_LIBS}
556 ;;
557 no) ;;
558 *) AC_MSG_ERROR(bad value ${enableval} for --enable-weak-threads) ;;
559 esac])
560AC_SUBST(LIB_THREAD)
561
562# Check for mmap()
563
564# The AC_FUNC_MMAP macro doesn't work properly. It seems to be too specific.
565# Do this check instead.
566HAVE_MMAP=0
567AC_MSG_CHECKING([for mmap])
568AC_CACHE_VAL(ac_cv_func_mmap_ok,
569 [AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <unistd.h>
570#include <sys/mman.h>
571#include <sys/stat.h>
572#include <fcntl.h>], [mmap((void *)0, 0, PROT_READ, 0, 0, 0);])],[ac_cv_func_mmap_ok=yes],[ac_cv_func_mmap_ok=no])] )
573AC_MSG_RESULT($ac_cv_func_mmap_ok)
574if test $ac_cv_func_mmap_ok = yes
575then
576 HAVE_MMAP=1
577else
578 CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_MMAP=0"
579fi
580AC_SUBST(HAVE_MMAP)
581
582AC_MSG_CHECKING([for genccode assembly])
583
584# Check to see if genccode can generate simple assembly.
585GENCCODE_ASSEMBLY=
586case "${host}" in
587*-linux*|*-kfreebsd*-gnu*|i*86-*-*bsd*|i*86-pc-gnu)
588 if test "$GCC" = yes; then
589 # We're using gcc, and the simple -a gcc command line works for genccode
590 GENCCODE_ASSEMBLY="-a gcc"
591 fi ;;
592i*86-*-solaris*)
593 if test "$GCC" = yes; then
594 # When using gcc, look if we're also using GNU as.
595 # When using GNU as, the simple -a gcc command line works for genccode.
596 asv=`"${CC}" -print-prog-name=as 2>/dev/null`
597 asv=`"${asv}" --version 2>/dev/null`
598 case "X${asv}" in
599 X*GNU*) GENCCODE_ASSEMBLY="-a gcc" ;;
600 X*) GENCCODE_ASSEMBLY="-a sun-x86" ;;
601 esac
602 unset asv
603 else
604 GENCCODE_ASSEMBLY="-a sun-x86"
605 fi ;;
606sparc-*-solaris*)
607 GENCCODE_ASSEMBLY="-a sun"
608 ;;
609ia64-*-hpux*)
610 GENCCODE_ASSEMBLY="-a aCC-ia64"
611 ;;
612esac
613AC_SUBST(GENCCODE_ASSEMBLY)
614
615AC_MSG_RESULT($GENCCODE_ASSEMBLY)
616
617# Checks for header files
618AC_CHECK_HEADERS(inttypes.h)
619if test $ac_cv_header_inttypes_h = no; then
620 U_HAVE_INTTYPES_H=0
621 CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_INTTYPES_H=0"
622else
623 U_HAVE_INTTYPES_H=1
624fi
625if test "$CC" = ccc; then
626 AC_MSG_RESULT("C compiler set to CCC ${CC}" )
627 case "${host}" in
628 alpha*-*-*) U_HAVE_INTTYPES_H=0;
629 CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_INTTYPES_H=0"
630 esac
631fi
632
633AC_SUBST(U_HAVE_INTTYPES_H)
634
635AC_CHECK_HEADERS(dirent.h)
636if test $ac_cv_header_dirent_h = no; then
637 U_HAVE_DIRENT_H=0
638 CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_DIRENT_H=0"
639else
640 U_HAVE_DIRENT_H=1
641fi
642
643AC_SUBST(U_HAVE_DIRENT_H)
644
645# Check for endianness
646AC_C_BIGENDIAN()
647if test $ac_cv_c_bigendian = no; then
648U_IS_BIG_ENDIAN=0
649U_ENDIAN_CHAR="l"
650else
651U_IS_BIG_ENDIAN=1
652U_ENDIAN_CHAR="b"
653fi
654AC_SUBST(U_IS_BIG_ENDIAN)
655
656# Do various POSIX related checks
657U_HAVE_NL_LANGINFO_CODESET=0
658U_NL_LANGINFO_CODESET=-1
659AC_CHECK_FUNC(nl_langinfo,[U_HAVE_NL_LANGINFO=1],[U_HAVE_NL_LANGINFO=0])
660dnl AC_SUBST(U_HAVE_NL_LANGINFO)
661if test $U_HAVE_NL_LANGINFO -eq 1; then
662 AC_CACHE_CHECK([for nl_langinfo's argument to obtain the codeset],
663 ac_cv_nl_langinfo_codeset,
664 [ac_cv_nl_langinfo_codeset="unknown"
665 for a in CODESET _NL_CTYPE_CODESET_NAME; do
666 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <langinfo.h>]], [[nl_langinfo($a);]])],[ac_cv_nl_langinfo_codeset="$a"; break],[])]
667 done)
668 if test x$ac_cv_nl_langinfo_codeset != xunknown
669 then
670 U_HAVE_NL_LANGINFO_CODESET=1
671 U_NL_LANGINFO_CODESET=$ac_cv_nl_langinfo_codeset
672 if test "x${ac_cv_nl_langinfo_codeset}" != "xCODESET"
673 then
674 CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DNL_LANGINFO_CODESET=${ac_cv_nl_langinfo_codeset}"
675 fi
676 else
677 CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_NL_LANGINFO_CODESET=0"
678 fi
679fi
680AC_SUBST(U_HAVE_NL_LANGINFO_CODESET)
681AC_SUBST(U_NL_LANGINFO_CODESET)
682
683# Namespace support checks
684AC_LANG(C++)
685AC_MSG_CHECKING([for namespace support])
686AC_CACHE_VAL(ac_cv_namespace_ok,
687 [AC_LINK_IFELSE([AC_LANG_PROGRAM([namespace x_version {void f(){}}
688 namespace x = x_version;
689 using namespace x_version;
690 ], [f();])],[ac_cv_namespace_ok=yes],[ac_cv_namespace_ok=no])] )
691AC_MSG_RESULT($ac_cv_namespace_ok)
692U_HAVE_NAMESPACE=1
693if test $ac_cv_namespace_ok = no
694then
695 AC_MSG_ERROR(Namespace support is required to build ICU.)
696 U_HAVE_NAMESPACE=0
697fi
698AC_SUBST(U_HAVE_NAMESPACE)
699
700AC_MSG_CHECKING([for properly overriding new and delete])
701U_OVERRIDE_CXX_ALLOCATION=0
702U_HAVE_PLACEMENT_NEW=0
703AC_CACHE_VAL(ac_cv_override_cxx_allocation_ok,
704 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>
705 class UMemory {
706 public:
707 void *operator new(size_t size) {return malloc(size);}
708 void *operator new[](size_t size) {return malloc(size);}
709 void operator delete(void *p) {free(p);}
710 void operator delete[](void *p) {free(p);}
711 };
712 ]], [])],[ac_cv_override_cxx_allocation_ok=yes],[ac_cv_override_cxx_allocation_ok=no])] )
713AC_MSG_RESULT($ac_cv_override_cxx_allocation_ok)
714if test $ac_cv_override_cxx_allocation_ok = yes
715then
716 U_OVERRIDE_CXX_ALLOCATION=1
717 AC_MSG_CHECKING([for placement new and delete])
718 AC_CACHE_VAL(ac_cv_override_placement_new_ok,
719 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>
720 class UMemory {
721 public:
722 void *operator new(size_t size) {return malloc(size);}
723 void *operator new[](size_t size) {return malloc(size);}
724 void operator delete(void *p) {free(p);}
725 void operator delete[](void *p) {free(p);}
726 void * operator new(size_t, void *ptr) { return ptr; }
727 void operator delete(void *, void *) {}
728 };
729 ]], [])],[ac_cv_override_placement_new_ok=yes],[ac_cv_override_placement_new_ok=no])] )
730 AC_MSG_RESULT($ac_cv_override_placement_new_ok)
731 if test $ac_cv_override_placement_new_ok = yes
732 then
733 U_HAVE_PLACEMENT_NEW=1
734 else
735 CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_PLACEMENT_NEW=0"
736 fi
737else
738 CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_OVERRIDE_CXX_ALLOCATION=0"
739fi
740AC_SUBST(U_OVERRIDE_CXX_ALLOCATION)
741AC_SUBST(U_HAVE_PLACEMENT_NEW)
742
743AC_LANG(C)
744AC_CHECK_FUNC(popen)
745if test x$ac_cv_func_popen = xyes
746then
747 U_HAVE_POPEN=1
748else
749 CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_POPEN=0"
750 U_HAVE_POPEN=0
751fi
752AC_SUBST(U_HAVE_POPEN)
753
754AC_CHECK_FUNC(tzset)
755U_HAVE_TZSET=0
756if test x$ac_cv_func_tzset = xyes
757then
758 U_TZSET=tzset
759 U_HAVE_TZSET=1
760else
761 AC_CHECK_FUNC(_tzset)
762 if test x$ac_cv_func__tzset = xyes
763 then
764 U_TZSET=_tzset
765 U_HAVE_TZSET=1
766 else
767 CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_TZSET=0"
768 fi
769fi
770AC_SUBST(U_HAVE_TZSET)
771AC_SUBST(U_TZSET)
772
773U_HAVE_TZNAME=0
774AC_CACHE_CHECK(for tzname,ac_cv_var_tzname,
775[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#ifndef __USE_POSIX
776#define __USE_POSIX
777#endif
778#include <stdlib.h>
779#include <time.h>
780#ifndef tzname /* For SGI. */
781extern char *tzname[]; /* RS6000 and others reject char **tzname. */
782#endif]], [atoi(*tzname);])],[ac_cv_var_tzname=yes],[ac_cv_var_tzname=no])])
783if test $ac_cv_var_tzname = yes; then
784 U_TZNAME=tzname
785 U_HAVE_TZNAME=1
786else
787 AC_CACHE_CHECK(for _tzname,ac_cv_var__tzname,
788 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>
789 #include <time.h>
790 extern char *_tzname[];]], [atoi(*_tzname);])],[ac_cv_var__tzname=yes],[ac_cv_var__tzname=no])])
791 if test $ac_cv_var__tzname = yes; then
792 U_TZNAME=_tzname
793 U_HAVE_TZNAME=1
794 else
795 CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_TZNAME=0"
796 fi
797fi
798AC_SUBST(U_HAVE_TZNAME)
799AC_SUBST(U_TZNAME)
800
801AC_CACHE_CHECK(for timezone,ac_cv_var_timezone,
802[AC_LINK_IFELSE([AC_LANG_PROGRAM([#ifndef __USE_POSIX
803#define __USE_POSIX
804#endif
805#ifndef __USE_XOPEN
806#define __USE_XOPEN
807#endif
808#include <time.h>
809], [[timezone = 1;]])],[ac_cv_var_timezone=yes],[ac_cv_var_timezone=no])])
810U_HAVE_TIMEZONE=0
811if test $ac_cv_var_timezone = yes; then
812 U_TIMEZONE=timezone
813 U_HAVE_TIMEZONE=1
814else
815 AC_CACHE_CHECK(for __timezone,ac_cv_var___timezone,
816 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[__timezone = 1;]])],[ac_cv_var___timezone=yes],[ac_cv_var___timezone=no])])
817 if test $ac_cv_var___timezone = yes; then
818 U_TIMEZONE=__timezone
819 U_HAVE_TIMEZONE=1
820 else
821 AC_CACHE_CHECK(for _timezone,ac_cv_var__timezone,
822 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[_timezone = 1;]])],[ac_cv_var__timezone=yes],[ac_cv_var__timezone=no])])
823 if test $ac_cv_var__timezone = yes; then
824 U_TIMEZONE=_timezone
825 U_HAVE_TIMEZONE=1
826 else
827 CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_TIMEZONE=0"
828 fi
829 fi
830fi
831AC_SUBST(U_HAVE_TIMEZONE)
832AC_SUBST(U_TIMEZONE)
833
834# Checks for typedefs
835AC_CHECK_TYPE(int8_t,signed char)
836AC_CHECK_TYPE(uint8_t,unsigned char)
837AC_CHECK_TYPE(int16_t,signed short)
838AC_CHECK_TYPE(uint16_t,unsigned short)
839AC_CHECK_TYPE(int32_t,signed long)
840AC_CHECK_TYPE(uint32_t,unsigned long)
841AC_CHECK_TYPE(int64_t,signed long long)
842AC_CHECK_TYPE(uint64_t,unsigned long long)
843
844if test $ac_cv_type_int8_t = no; then
845CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_INT8_T=0"
846fi
847
848if test $ac_cv_type_uint8_t = no; then
849CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_UINT8_T=0"
850fi
851
852if test $ac_cv_type_int16_t = no; then
853CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_INT16_T=0"
854fi
855
856if test $ac_cv_type_uint16_t = no; then
857CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_UINT16_T=0"
858fi
859
860if test $ac_cv_type_int32_t = no; then
861CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_INT32_T=0"
862fi
863
864if test $ac_cv_type_uint32_t = no; then
865CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_UINT32_T=0"
866fi
867
868if test $ac_cv_type_int64_t = no; then
869CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_INT64_T=0"
870fi
871
872if test $ac_cv_type_uint64_t = no; then
873CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_UINT64_T=0"
874fi
875
876# Do various wchar_t related checks
877AC_CHECK_HEADER(wchar.h)
878if test "$ac_cv_header_wchar_h" = no
879then
880 U_HAVE_WCHAR_H=0
881 U_HAVE_WCSCPY=0
882 CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_WCHAR_H=0 -DU_HAVE_WCSCPY=0"
883else
884 AC_DEFINE([HAVE_WCHAR_H], [1], [wchar.h was found.])
885 U_HAVE_WCHAR_H=1
886 # Some broken systems have wchar.h but not some of its functions...
887 AC_SEARCH_LIBS(wcscpy, wcs w)
888 if test "$ac_cv_search_wcscpy" != no; then
889 U_HAVE_WCSCPY=1
890 else
891 U_HAVE_WCSCPY=0
892 CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_WCSCPY=0"
893 fi
894fi
895AC_SUBST(U_HAVE_WCHAR_H)
896AC_SUBST(U_HAVE_WCSCPY)
897
898AC_CHECK_SIZEOF([wchar_t], 0, [
899#if STDC_HEADERS
900#include <stddef.h>
901#endif
902#include <stdlib.h>
903#if HAVE_WCHAR_H
904#include <string.h>
905#include <wchar.h>
906#endif])
907U_SIZEOF_WCHAR_T=$ac_cv_sizeof_wchar_t
908# We do this check to verify that everything is okay.
909if test $U_SIZEOF_WCHAR_T = 0; then
910 if test $U_HAVE_WCHAR_H=1; then
911 AC_MSG_ERROR(There is wchar.h but the size of wchar_t is 0)
912 fi
913fi
914
915AC_MSG_CHECKING([for UTF-16 string literal support])
916U_CHECK_UTF16_STRING=1
917CHECK_UTF16_STRING_RESULT="unknown"
918
919case "${host}" in
920*-*-aix*|powerpc64-*-linux*)
921 if test "$ac_cv_c_compiler_gnu" = no; then
922 OLD_CFLAGS="${CFLAGS}"
923 OLD_CXXFLAGS="${CXXFLAGS}"
924 CFLAGS="${CFLAGS} -qutf"
925 CXXFLAGS="${CXXFLAGS} -qutf"
926 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[const unsigned short hello[] = u"hello";]], [[]])],[U_CHECK_UTF16_STRING=1],[U_CHECK_UTF16_STRING=0])
927 if test "$U_CHECK_UTF16_STRING" = 0; then
928 CFLAGS="${OLD_CFLAGS}"
929 CXXFLAGS="${OLD_CXXFLAGS}"
930 else
931 CHECK_UTF16_STRING_RESULT="-qutf"
932 fi
933 fi
934 ;;
935*-*-solaris*)
936 if test "$ac_cv_c_compiler_gnu" = no; then
937 OLD_CFLAGS="${CFLAGS}"
938 OLD_CXXFLAGS="${CXXFLAGS}"
939 CFLAGS="${CFLAGS} -xustr=ascii_utf16_ushort"
940 CXXFLAGS="${CXXFLAGS} -xustr=ascii_utf16_ushort"
941 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[const unsigned short hello[] = U"hello";]], [[]])],[U_CHECK_UTF16_STRING=1],[U_CHECK_UTF16_STRING=0])
942 if test "$U_CHECK_UTF16_STRING" = 0; then
943 CFLAGS="${OLD_CFLAGS}"
944 CXXFLAGS="${OLD_CXXFLAGS}"
945 else
946 CHECK_UTF16_STRING_RESULT="-xustr=ascii_utf16_ushort"
947
948 # Since we can't detect the availability of this UTF-16 syntax at compile time,
949 # we depend on configure telling us that we can use it.
950 # Since we can't ensure ICU users use -xustr=ascii_utf16_ushort,
951 # we only use this macro within ICU.
952 # If an ICU user uses icu-config, this feature will be enabled.
953 CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_CHECK_UTF16_STRING=1"
954 U_CHECK_UTF16_STRING=0
955 fi
956 fi
957 ;;
958*-*-hpux*)
959 if test "$ac_cv_c_compiler_gnu" = no; then
960 # The option will be detected at compile time without additional compiler options.
961 CHECK_UTF16_STRING_RESULT="available"
962 fi
963 ;;
964*-*-cygwin)
965 # wchar_t can be used
966 CHECK_UTF16_STRING_RESULT="available"
967 ;;
968*)
969 ;;
970esac
971
972# GCC >= 4.4 supports UTF16 string literals. The CFLAGS and CXXFLAGS may change in the future.
973# Since we have to use a different standard, if strict is enable, don't enable UTF16 string literals.
974U_CHECK_GNUC_UTF16_STRING=0
975if test "$ac_use_strict_options" = no && test "$CHECK_UTF16_STRING_RESULT" = "unknown"; then
976 if test "$ac_cv_c_compiler_gnu" = yes; then
977 OLD_CFLAGS="${CFLAGS}"
978 OLD_CXXFLAGS="${CXXFLAGS}"
979 CFLAGS="${CFLAGS} -std=gnu99 -D_GCC_"
980 CXXFLAGS="${CXXFLAGS} -std=c++0x"
981 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
982#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
983#ifdef _GCC_
984typedef __CHAR16_TYPE__ char16_t;
985#endif
986char16_t test[] = u"This is a UTF16 literal string.";
987#else
988GCC IS TOO OLD!
989#endif
990 ]], [[]])],[U_CHECK_UTF16_STRING=1],[U_CHECK_UTF16_STRING=0])
991 if test "$U_CHECK_UTF16_STRING" = 1; then
992 CHECK_UTF16_STRING_RESULT="available";
993 U_CHECK_GNUC_UTF16_STRING=1
994 else
995 CFLAGS="${OLD_CFLAGS}"
996 CXXFLAGS="${OLD_CXXFLAGS}"
997 fi
998 fi
999fi
1000AC_SUBST(U_CHECK_GNUC_UTF16_STRING)
1001
1002AC_MSG_RESULT($CHECK_UTF16_STRING_RESULT)
1003AC_SUBST(U_CHECK_UTF16_STRING)
1004
1005# Enable/disable extras
1006AC_ARG_ENABLE(extras,
1007 [ --enable-extras build ICU extras [default=yes]],
1008 [case "${enableval}" in
1009 yes) extras=true ;;
1010 no) extras=false ;;
1011 *) AC_MSG_ERROR(bad value ${enableval} for --enable-extras) ;;
1012 esac],
1013 extras=true)
1014ICU_CONDITIONAL(EXTRAS, test "$extras" = true)
1015AC_ARG_ENABLE(icuio,
1016 [ --enable-icuio build ICU's icuio library [default=yes]],
1017 [case "${enableval}" in
1018 yes) icuio=true ;;
1019 no) icuio=false ;;
1020 *) AC_MSG_ERROR(bad value ${enableval} for --enable-icuio) ;;
1021 esac],
1022 icuio=true)
1023ICU_CONDITIONAL(ICUIO, test "$icuio" = true)
1024
1025# Enable/disable layout
1026AC_ARG_ENABLE(layout,
1027 [ --enable-layout build ICU's layout library [default=yes]],
1028 [case "${enableval}" in
1029 yes) layout=true ;;
1030 no) layout=false ;;
1031 *) AC_MSG_ERROR(bad value ${enableval} for --enable-layout) ;;
1032 esac],
1033 layout=true)
1034ICU_CONDITIONAL(LAYOUT, test "$layout" = true)
1035
1036AC_ARG_WITH(data-packaging,
1037 [ --with-data-packaging=type specify how to package ICU data (files, archive, library, static, auto) [default=auto]],
1038 [case "${withval}" in
1039 files|archive|library) datapackaging=$withval ;;
1040 auto) datapackaging=$withval ;;
1041 common) datapackaging=archive ;;
1042 dll) datapackaging=library ;;
1043 static) datapackaging=static ;;
1044 *) AC_MSG_ERROR(bad value ${withval} for --with-data-packaging) ;;
1045 esac],
1046 [datapackaging=])
1047
1048# Note: 'thesysconfdir' is an evaluated version, for Man pages, so also for thedatadir, thelibdir, etc..
1049# thesysconfdir=`eval echo $sysconfdir`
1050dnl# AC_SUBST(thesysconfdir)
1051dnl# thelibdir=`test "x$exec_prefix" = xNONE && exec_prefix="$prefix"; eval echo $libdir`
1052dnl# AC_SUBST(thelibdir)
1053thedatadir=`eval echo $datadir`
1054dnl# AC_SUBST(thedatadir)
1055# 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}.
1056pkgicudatadir=$datadir
1057thepkgicudatadir=$thedatadir
1058AC_SUBST(pkgicudatadir)
1059AC_SUBST(thepkgicudatadir)
1060
1061dnl# Shouldn't need the AC_SUBST
1062
1063if test x"$datapackaging" = x -o x"$datapackaging" = xauto; then
1064 # default to library
1065 datapackaging=library
1066 if test "$ENABLE_STATIC" = "YES"; then
1067 if test "$ENABLE_SHARED" != "YES"; then
1068 datapackaging=static
1069 fi
1070 fi
1071fi
1072
1073datapackaging_dir=`eval echo $thedatadir`"/icu/${VERSION}"
1074
1075datapackaging_msg="(No explaination for mode $datapackaging.)"
1076
1077datapackaging_msg_path="ICU will look in $datapackaging_dir which is the installation location. Call u_setDataDirectory() or use the ICU_DATA environment variable to override."
1078datapackaging_msg_set="ICU will use the linked data library. If linked with the stub library located in stubdata/, the application can use udata_setCommonData() or set a data path to override."
1079datapackaging_howfound="(unknown)"
1080
1081case "$datapackaging" in
1082 files)
1083 DATA_PACKAGING_MODE=files
1084 datapackaging_msg="ICU data will be stored in individual files."
1085 datapackaging_howfound="$datapackaging_msg_path"
1086 ;;
1087 archive)
1088 DATA_PACKAGING_MODE=common
1089 datapackaging_msg="ICU data will be stored in a single .dat file."
1090 datapackaging_howfound="$datapackaging_msg_path"
1091 ;;
1092 library)
1093 DATA_PACKAGING_MODE=dll
1094 datapackaging_msg="ICU data will be linked with ICU."
1095 if test "$ENABLE_STATIC" = "YES"; then
1096 datapackaging_msg="$datapackaging_msg A static data library will be built. "
1097 fi
1098 if test "$ENABLE_SHARED" = "YES"; then
1099 datapackaging_msg="$datapackaging_msg A shared data library will be built. "
1100 fi
1101 datapackaging_howfound="$datapackaging_msg_set"
1102 ;;
1103 static)
1104 DATA_PACKAGING_MODE=static
1105 datapackaging_msg="ICU data will be stored in a static library."
1106 datapackaging_howfound="$datapackaging_msg_set"
1107 ;;
1108esac
1109AC_SUBST(DATA_PACKAGING_MODE)
1110
1111# Sets a library suffix
1112AC_MSG_CHECKING([for a library suffix to use])
1113AC_ARG_WITH(library-suffix,
1114 [ --with-library-suffix=suffix tag a suffix to the library names [default=]],
1115 [ICULIBSUFFIX="${withval}"],
1116 [ICULIBSUFFIX=])
1117msg=$ICULIBSUFFIX
1118if test "$msg" = ""; then
1119 msg=none
1120fi
1121AC_MSG_RESULT($msg)
1122AC_SUBST(ICULIBSUFFIX)
1123if test "$ICULIBSUFFIX" != ""
1124then
1125 U_HAVE_LIB_SUFFIX=1
1126 ICULIBSUFFIXCNAME=`echo _$ICULIBSUFFIX | sed 's/[^A-Za-z0-9_]/_/g'`
1127 UCONFIG_CPPFLAGS="${UCONFIG_CPPFLAGS} -DU_HAVE_LIB_SUFFIX=1 -DU_LIB_SUFFIX_C_NAME=${ICULIBSUFFIXCNAME} "
1128else
1129 U_HAVE_LIB_SUFFIX=0
1130fi
1131AC_SUBST(U_HAVE_LIB_SUFFIX)
1132AC_SUBST(ICULIBSUFFIXCNAME)
1133
1134# Enable/disable tests
1135AC_ARG_ENABLE(tests,
1136 [ --enable-tests build ICU tests [default=yes]],
1137 [case "${enableval}" in
1138 yes) tests=true ;;
1139 no) tests=false ;;
1140 *) AC_MSG_ERROR(bad value ${enableval} for --enable-tests) ;;
1141 esac],
1142 tests=true)
1143ICU_CONDITIONAL(TESTS, test "$tests" = true)
1144
1145# Enable/disable samples
1146AC_ARG_ENABLE(samples,
1147 [ --enable-samples build ICU samples [default=yes]
1148
1149Additionally, the variable FORCE_LIBS may be set before calling configure.
1150If set, it will REPLACE any automatic list of libraries.],
1151 [case "${enableval}" in
1152 yes) samples=true ;;
1153 no) samples=false ;;
1154 *) AC_MSG_ERROR(bad value ${enableval} for --enable-samples) ;;
1155 esac],
1156 samples=true)
1157ICU_CONDITIONAL(SAMPLES, test "$samples" = true)
1158
1159ICUDATA_CHAR=$U_ENDIAN_CHAR
1160
1161# Platform-specific Makefile setup
1162# set ICUDATA_CHAR to 'e' for any EBCDIC (which should be big endian) platform.
1163case "${host}" in
1164 *-*-solaris*) platform=U_SOLARIS ;;
1165 *-*-linux*|*-*-gnu|*-*-k*bsd*-gnu|*-*-kopensolaris*-gnu) platform=U_LINUX ;;
1166 *-*-*bsd*|*-*-dragonfly*) platform=U_BSD ;;
1167 *-*-aix*) platform=U_AIX ;;
1168 *-*-hpux*) platform=U_HPUX ;;
1169 *-apple-darwin*|*-apple-rhapsody*) platform=U_DARWIN ;;
1170 *-*-cygwin*) platform=U_CYGWIN ;;
1171 *-*-mingw*) platform=U_MINGW ;;
1172 *-*ibm-openedition*|*-*-os390*) platform=OS390
1173 if test "${ICU_ENABLE_ASCII_STRINGS}" != "1"; then
1174 ICUDATA_CHAR="e"
1175 fi ;;
1176 *-*-os400*) platform=OS400
1177 if test "${ICU_ENABLE_ASCII_STRINGS}" != "1"; then
1178 ICUDATA_CHAR="e"
1179 fi ;;
1180 *-*-nto*) platform=U_QNX ;;
1181 *-dec-osf*) platform=U_OSF ;;
1182 *-*-beos) platform=U_BEOS ;;
1183 *-*-irix*) platform=U_IRIX ;;
1184 *-ncr-*) platform=U_MPRAS ;;
1185 *) platform=U_UNKNOWN_PLATFORM ;;
1186esac
1187AC_SUBST(ICUDATA_CHAR)
1188AC_SUBST(platform)
1189platform_make_fragment_name="$icu_cv_host_frag"
1190platform_make_fragment='$(top_srcdir)/config/'"$platform_make_fragment_name"
1191AC_SUBST(platform_make_fragment_name)
1192AC_SUBST(platform_make_fragment)
1193
1194if test "${FORCE_LIBS}" != ""; then
1195 echo " *** Overriding automatically chosen [LIBS=$LIBS], using instead [FORCE_LIBS=${FORCE_LIBS}]" 1>&6
1196 LIBS=${FORCE_LIBS}
1197fi
1198
1199# Now that we're done using CPPFLAGS etc. for tests, we can change it
1200# for build.
1201
1202if test $ICU_USE_THREADS -ne 0
1203then
1204 CPPFLAGS="$CPPFLAGS \$(THREADSCPPFLAGS)"
1205 CFLAGS="$CFLAGS \$(THREADSCFLAGS)"
1206 CXXFLAGS="$CXXFLAGS \$(THREADSCXXFLAGS)"
1207else
1208 CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DICU_USE_THREADS=0"
1209fi
1210
1211AC_SUBST(LIBCFLAGS)
1212AC_SUBST(LIBCXXFLAGS)
1213
1214# append all config cppflags
1215CPPFLAGS="$CPPFLAGS $CONFIG_CPPFLAGS $UCONFIG_CPPFLAGS"
1216
1217echo "CPPFLAGS=$CPPFLAGS"
1218echo "CFLAGS=$CFLAGS"
1219echo "CXXFLAGS=$CXXFLAGS"
1220
1221
1222# output the Makefiles
1223AC_CONFIG_FILES([icudefs.mk \
1224 Makefile \
1225 data/pkgdataMakefile \
1226 config/Makefile.inc \
1227 config/icu.pc \
1228 config/pkgdataMakefile \
1229 data/Makefile \
1230 stubdata/Makefile \
1231 common/Makefile \
1232 i18n/Makefile \
1233 layout/Makefile \
1234 layoutex/Makefile \
1235 io/Makefile \
1236 extra/Makefile \
1237 extra/uconv/Makefile \
1238 extra/uconv/pkgdataMakefile \
1239 extra/scrptrun/Makefile \
1240 tools/Makefile \
1241 tools/ctestfw/Makefile \
1242 tools/toolutil/Makefile \
1243 tools/makeconv/Makefile \
1244 tools/genrb/Makefile \
1245 tools/genccode/Makefile \
1246 tools/gencmn/Makefile \
1247 tools/gencnval/Makefile \
1248 tools/genctd/Makefile \
1249 tools/gentest/Makefile \
1250 tools/gennorm2/Makefile \
1251 tools/genbrk/Makefile \
1252 tools/gensprep/Makefile \
1253 tools/icuinfo/Makefile \
1254 tools/icupkg/Makefile \
1255 tools/icuswap/Makefile \
1256 tools/pkgdata/Makefile \
1257 tools/tzcode/Makefile \
1258 tools/gencfu/Makefile \
1259 test/Makefile \
1260 test/compat/Makefile \
1261 test/testdata/Makefile \
1262 test/testdata/pkgdataMakefile \
1263 test/hdrtst/Makefile \
1264 test/intltest/Makefile \
1265 test/cintltst/Makefile \
1266 test/iotest/Makefile \
1267 test/letest/Makefile \
1268 test/perf/Makefile \
1269 test/perf/collationperf/Makefile \
1270 test/perf/dicttrieperf/Makefile \
1271 test/perf/ubrkperf/Makefile \
1272 test/perf/charperf/Makefile \
1273 test/perf/convperf/Makefile \
1274 test/perf/normperf/Makefile \
1275 test/perf/DateFmtPerf/Makefile \
1276 test/perf/howExpensiveIs/Makefile \
1277 test/perf/strsrchperf/Makefile \
1278 test/perf/unisetperf/Makefile \
1279 test/perf/usetperf/Makefile \
1280 test/perf/ustrperf/Makefile \
1281 test/perf/utfperf/Makefile \
1282 test/perf/utrie2perf/Makefile \
1283 samples/Makefile samples/date/Makefile \
1284 samples/cal/Makefile samples/layout/Makefile])
1285AC_OUTPUT
1286
1287echo
1288echo "ICU for C/C++ $VERSION is ready to be built."
1289echo "=== Important Notes: ==="
1290
1291if test $ICU_USE_THREADS = 0; then
1292 echo
1293 echo "** ICU was configured without mutex or thread support. Multithread-safe operation will not be tested. If this is unexpected, then run configure with --enable-threads=yes or check the messages [above] to see why thread support was not found." 1>&6
1294 echo
1295fi
1296
1297echo "Data Packaging: $datapackaging"
1298echo " This means: $datapackaging_msg"
1299echo " To locate data: $datapackaging_howfound"
1300
1301if test -n "`$U_MAKE -v 2>&1 | grep '^GNU Make'`"; then
1302echo "Building ICU: Use a GNU make such as $U_MAKE to build ICU."
1303else
1304echo "** WARNING: $U_MAKE may not be GNU make."
1305echo "This may cause ICU to fail to build. Please make sure that GNU make"
1306echo "is in your PATH so that the configure script can detect its location."
1307fi
1308if test "x$AR" = "xfalse"; then
1309 echo "*** WARNING: Archiver ar not found. Set AR= or fix PATH. Some builds (such as static) may fail."
1310fi
1311
1312AC_MSG_CHECKING([the version of "$U_MAKE"])
1313if "$U_MAKE" -f "$srcdir/config/gmakever.mk" PLATFORM="$platform"; then
1314AC_MSG_RESULT([ok])
1315else
1316AC_MSG_RESULT([too old or test failed - try upgrading GNU Make])
1317fi
1318
1319if test -n "$UCONFIG_CPPFLAGS"; then
1320 HDRFILE="uconfig.h.prepend"
1321 echo "*** WARNING: You must set the following flags before code compiled against this ICU will function properly:"
1322 echo
1323 echo " ${UCONFIG_CPPFLAGS}"
1324 echo
1325 echo 'The recommended way to do this is to prepend the following lines to source/common/unicode/uconfig.h or #include them near the top of that file.'
1326 echo "Creating the file ${HDRFILE}"
1327 echo
1328 echo '--------------- ' "${HDRFILE}"
1329 echo > "${HDRFILE}"
1330 echo '/* ICU customizations: put these lines at the top of uconfig.h */' >> "${HDRFILE}"
1331 echo >> "${HDRFILE}"
1332 for flag in ${UCONFIG_CPPFLAGS};
1333 do
1334 echo " /* $flag */" >> "${HDRFILE}"
1335 case "${flag}" in
1336 -D*=*)
1337 [ \echo "${flag}" | sed -n 's%-D\([^=]*\)=%#define \1 %p' >> "${HDRFILE}" ]
1338 \echo >> "${HDRFILE}"
1339 ;;
1340 -D*)
1341 [ \echo "${flag}" | sed -n 's%-D\([^=]*\)%#define \1 %p' >> "${HDRFILE}" ]
1342 \echo >> "${HDRFILE}"
1343 ;;
1344 *)
1345 \echo "/* Not sure how to handle this argument: ${flag} */" >> "${HDRFILE}"
1346 \echo >> "${HDRFILE}"
1347 ;;
1348 esac
1349 done
1350 cat "${HDRFILE}"
1351 \echo "/* End of ${HDRFILE} ------------ */" >> "${HDRFILE}"
1352 echo >> "${HDRFILE}"
1353 echo '--------------- end ' "${HDRFILE}"
1354fi
1355
1356$as_unset _CXX_CXXSUFFIX