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