Debian Codegraph @

intl/icu/source/configure.ac

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