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