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