1 dnl This is the newlib configure.in file.
2 dnl Process this file with autoconf to produce a configure script.
4 AC_INIT([newlib],[NEWLIB_VERSION])
5 AC_CONFIG_SRCDIR([libc])
7 dnl Since we can't control what defines autoheader picks up (various autoconf
8 dnl macros will add their own), filter out all the ones w/out a _ prefix. All
9 dnl the ones we want to export use a _ prefix, and all the rest we don't want
10 dnl to export as it'll pollute the namespace of newlib users.
11 dnl We also filter out version defines that we want in _newlib_version.h.
12 dnl NB: newlib.h must be the first AC_CONFIG_HEADERS call for autoheader.
14 [newlib.h:newlib.hin],
15 [sed -i.tmp -E -e '/^#define [^_]/d' -e '/^\/\* #undef [^_]/d' -e '/_NEWLIB_VERSION|__NEWLIB_(MINOR|PATCHLEVEL)__|__NEWLIB__/d' newlib.h && rm -f newlib.h.tmp])
16 AH_TOP([/* NB: The contents are filtered before being installed. */
19 #define __NEWLIB_H__ 1
22 #include <_newlib_version.h>])
23 AH_BOTTOM([#endif /* !__NEWLIB_H__ */])
25 AC_CONFIG_HEADERS([_newlib_version.h:_newlib_version.hin])
27 dnl Can't be done in NEWLIB_CONFIGURE because that confuses automake.
30 dnl Support --enable-newlib-io-pos-args
31 dnl This option is actually read in libc/configure.in. It is repeated
32 dnl here so that it shows up in the help text.
33 AC_ARG_ENABLE(newlib-io-pos-args,
34 [ --enable-newlib-io-pos-args enable printf-family positional arg support],
35 [case "${enableval}" in
36 yes) newlib_io_pos_args=yes ;;
37 no) newlib_io_pos_args=no ;;
38 *) AC_MSG_ERROR(bad value ${enableval} for newlib-io-pos-args option) ;;
39 esac], [newlib_io_pos_args=])dnl
41 dnl Support --enable-newlib-io-c99-formats
42 AC_ARG_ENABLE(newlib-io-c99-formats,
43 [ --enable-newlib-io-c99-formats enable C99 support in IO functions like printf/scanf],
44 [case "${enableval}" in
45 yes) newlib_io_c99_formats=yes;;
46 no) newlib_io_c99_formats=no ;;
47 *) AC_MSG_ERROR(bad value ${enableval} for newlib-io-c99-formats option) ;;
48 esac], [newlib_io_c99_formats=])dnl
50 dnl Support --enable-newlib-register-fini
51 AC_ARG_ENABLE(newlib-register-fini,
52 [ --enable-newlib-register-fini enable finalization function registration using atexit],
53 [case "${enableval}" in
54 yes) newlib_register_fini=yes;;
55 no) newlib_register_fini=no ;;
56 *) AC_MSG_ERROR(bad value ${enableval} for newlib-register-fini option) ;;
57 esac], [newlib_register_fini=])dnl
59 dnl Support --enable-newlib-io-long-long
60 AC_ARG_ENABLE(newlib-io-long-long,
61 [ --enable-newlib-io-long-long enable long long type support in IO functions like printf/scanf],
62 [case "${enableval}" in
63 yes) newlib_io_long_long=yes;;
64 no) newlib_io_long_long=no ;;
65 *) AC_MSG_ERROR(bad value ${enableval} for newlib-io-long-long option) ;;
66 esac], [newlib_io_long_long=])dnl
68 dnl Support --enable-newlib-io-long-double
69 AC_ARG_ENABLE(newlib-io-long-double,
70 [ --enable-newlib-io-long-double enable long double type support in IO functions printf/scanf],
71 [case "${enableval}" in
72 yes) newlib_io_long_double=yes;;
73 no) newlib_io_long_double=no ;;
74 *) AC_MSG_ERROR(bad value ${enableval} for newlib-io-long-double option) ;;
75 esac], [newlib_io_long_double=])dnl
77 dnl If multibyte support is enabled, iconv should be enabled too
78 dnl Support --enable-newlib-mb
79 AC_ARG_ENABLE(newlib-mb,
80 [ --enable-newlib-mb enable multibyte support],
81 [case "${enableval}" in
84 *) AC_MSG_ERROR(bad value ${enableval} for newlib-mb option) ;;
85 esac], [newlib_mb=])dnl
87 dnl Enable verification of successful memory allocation for _REENT_CHECK family of macros
88 dnl Support --disable-newlib-reent-check-verify
89 AC_ARG_ENABLE(newlib-reent-check-verify,
90 [ --disable-newlib-reent-check-verify disable checking of _REENT_CHECK memory allocation],
91 [case "${enableval}" in
92 yes) newlib_reent_check_verify=yes;;
93 no) newlib_reent_check_verify=no ;;
94 *) AC_MSG_ERROR(bad value ${enableval} for newlib-reent-check-verify option) ;;
95 esac], [newlib_reent_check_verify=])dnl
97 dnl Support --enable-newlib-iconv-encodings
98 AC_ARG_ENABLE(newlib-iconv-encodings,
99 [ --enable-newlib-iconv-encodings enable specific comma-separated list of bidirectional iconv encodings to be built-in],
100 [if test x${enableval} = x; then
101 AC_MSG_ERROR(bad value ${enableval} for newlib-iconv-encodings option - use comma-separated encodings list)
103 iconv_encodings=${enableval}
104 ], [iconv_encodings=])dnl
106 dnl Support --enable-newlib-iconv-from-encodings
107 AC_ARG_ENABLE(newlib-iconv-from-encodings,
108 [ --enable-newlib-iconv-from-encodings enable specific comma-separated list of \"from\" iconv encodings to be built-in],
109 [if test x${enableval} = x; then
110 AC_MSG_ERROR(bad value ${enableval} for newlib-iconv-from-encodings option - use comma-separated encodings list)
112 iconv_from_encodings=${enableval}
113 ], [iconv_from_encodings=])dnl
115 dnl Support --enable-newlib-iconv-to-encodings
116 AC_ARG_ENABLE(newlib-iconv-to-encodings,
117 [ --enable-newlib-iconv-to-encodings enable specific comma-separated list of \"to\" iconv encodings to be built-in],
118 [if test x${enableval} = x; then
119 AC_MSG_ERROR(bad value ${enableval} for newlib-iconv-to-encodings option - use comma-separated encodings list)
121 iconv_to_encodings=${enableval}
122 ], [iconv_to_encodings=])dnl
124 dnl Support --enable-newlib-iconv-external-ccs
125 AC_ARG_ENABLE(newlib-iconv-external-ccs,
126 [ --enable-newlib-iconv-external-ccs enable capabilities to load external CCS files for iconv],
127 [if test "${newlib_iconv_external_ccs+set}" != set; then
128 case "${enableval}" in
129 yes) newlib_iconv_external_ccs=yes ;;
130 no) newlib_iconv_external_ccs=no ;;
131 *) AC_MSG_ERROR(bad value ${enableval} for newlib-iconv-external-ccs option) ;;
133 fi], [newlib_iconv_external_ccs=${newlib_iconv_external_ccs}])dnl
135 dnl Support --disable-newlib-atexit-dynamic-alloc
136 AC_ARG_ENABLE(newlib-atexit-dynamic-alloc,
137 [ --disable-newlib-atexit-dynamic-alloc disable dynamic allocation of atexit entries],
138 [if test "${newlib_atexit_dynamic_alloc+set}" != set; then
139 case "${enableval}" in
140 yes) newlib_atexit_dynamic_alloc=yes ;;
141 no) newlib_atexit_dynamic_alloc=no ;;
142 *) AC_MSG_ERROR(bad value ${enableval} for newlib-atexit-dynamic-alloc option) ;;
144 fi], [newlib_atexit_dynamic_alloc=${newlib_atexit_dynamic_alloc}])dnl
146 dnl Support --enable-newlib-global-atexit
147 dnl Enable atexit data structure as global variables to save memory usage in
148 dnl _reent. This is no longer optional. It is enabled in all Newlib
150 AC_ARG_ENABLE(newlib-global-atexit,
151 [ --enable-newlib-global-atexit enable atexit data structure as global],
152 [if test "${newlib_global_atexit+set}" != set; then
153 case "${enableval}" in
154 yes) newlib_global_atexit=yes ;;
155 *) AC_MSG_ERROR(bad value ${enableval} for newlib-global-atexit option) ;;
157 fi], [newlib_global_atexit=yes])dnl
159 dnl Support --enable-newlib-reent-small
160 AC_ARG_ENABLE(newlib-reent-small,
161 [ --enable-newlib-reent-small enable small reentrant struct support],
162 [case "${enableval}" in
163 yes) newlib_reent_small=yes;;
164 no) newlib_reent_small=no ;;
165 *) AC_MSG_ERROR(bad value ${enableval} for newlib-reent-small option) ;;
166 esac], [newlib_reent_small=])dnl
168 dnl Support --enable-newlib-reent-binary-compat
169 AC_ARG_ENABLE(newlib-reent-binary-compat,
170 [ --enable-newlib-reent-binary-compat enable backward binary compatibility for struct _reent],
171 [if test "${newlib_reent_binary_compat+set}" != set; then
172 case "${enableval}" in
173 yes) newlib_reent_binary_compat=yes ;;
174 no) newlib_reent_binary_compat=no ;;
175 *) AC_MSG_ERROR(bad value ${enableval} for newlib-enable-reent-binary-compat option) ;;
177 fi], [newlib_reent_binary_compat=no])dnl
179 dnl Support --enable-newlib-reent-thread-local
180 AC_ARG_ENABLE(newlib-reent-thread-local,
181 [ --enable-newlib-reent-thread-local enable thread-local storage objects as a replacment for struct _reent members],
182 [if test "${newlib_reent_thread_local+set}" != set; then
183 case "${enableval}" in
184 yes) newlib_reent_thread_local=yes ;;
185 no) newlib_reent_thread_local=no ;;
186 *) AC_MSG_ERROR(bad value ${enableval} for newlib-enable-reent-thread-local option) ;;
188 fi], [newlib_reent_thread_local=no])dnl
190 dnl Support --enable-newlib-global-stdio-streams
191 dnl This is no longer optional. It is enabled in all Newlib configurations.
192 AC_ARG_ENABLE(newlib-global-stdio-streams,
193 [ --enable-newlib-global-stdio-streams enable global stdio streams],
194 [case "${enableval}" in
195 yes) newlib_global_stdio_streams=yes;;
196 *) AC_MSG_ERROR(bad value ${enableval} for newlib-global-stdio-streams option) ;;
197 esac], [newlib_global_stdio_streams=yes])dnl
199 dnl Support --disable-newlib-fvwrite-in-streamio
200 AC_ARG_ENABLE(newlib-fvwrite-in-streamio,
201 [ --disable-newlib-fvwrite-in-streamio disable iov in streamio],
202 [if test "${newlib_fvwrite_in_streamio+set}" != set; then
203 case "${enableval}" in
204 yes) newlib_fvwrite_in_streamio=yes ;;
205 no) newlib_fvwrite_in_streamio=no ;;
206 *) AC_MSG_ERROR(bad value ${enableval} for newlib-fvwrite-in-streamio option) ;;
208 fi], [newlib_fvwrite_in_streamio=yes])dnl
210 dnl Support --disable-newlib-fseek-optimization
211 AC_ARG_ENABLE(newlib-fseek-optimization,
212 [ --disable-newlib-fseek-optimization disable fseek optimization],
213 [if test "${newlib_fseek_optimization+set}" != set; then
214 case "${enableval}" in
215 yes) newlib_fseek_optimization=yes ;;
216 no) newlib_fseek_optimization=no ;;
217 *) AC_MSG_ERROR(bad value ${enableval} for newlib-fseek-optimization option) ;;
219 fi], [newlib_fseek_optimization=yes])dnl
221 dnl Support --enable-newlib-wide-orient
222 dnl This option is also read in libc/configure.in. It is repeated
223 dnl here so that it shows up in the help text.
224 AC_ARG_ENABLE(newlib_wide_orient,
225 [ --disable-newlib-wide-orient Turn off wide orientation in streamio],
226 [case "${enableval}" in
227 yes) newlib_wide_orient=yes ;;
228 no) newlib_wide_orient=no ;;
229 *) AC_MSG_ERROR(bad value ${enableval} for newlib-wide-orient) ;;
230 esac],[newlib_wide_orient=yes])
232 dnl Support --enable-newlib-nano-malloc
233 dnl This option is also read in libc/configure.in. It is repeated
234 dnl here so that it shows up in the help text.
235 AC_ARG_ENABLE(newlib-nano-malloc,
236 [ --enable-newlib-nano-malloc use small-footprint nano-malloc implementation],
237 [if test "${newlib_nano_malloc+set}" != set; then
238 case "${enableval}" in
239 yes) newlib_nano_malloc=yes ;;
240 no) newlib_nano_malloc=no ;;
241 *) AC_MSG_ERROR(bad value ${enableval} for newlib-nano-malloc option) ;;
243 fi], [newlib_nano_malloc=])dnl
244 AM_CONDITIONAL(NEWLIB_NANO_MALLOC, test x$newlib_nano_malloc = xyes)
246 dnl Support --disable-newlib-unbuf-stream-opt
247 AC_ARG_ENABLE(newlib-unbuf-stream-opt,
248 [ --disable-newlib-unbuf-stream-opt disable unbuffered stream optimization in streamio],
249 [if test "${newlib_unbuf_stream_opt+set}" != set; then
250 case "${enableval}" in
251 yes) newlib_unbuf_stream_opt=yes ;;
252 no) newlib_unbuf_stream_opt=no ;;
253 *) AC_MSG_ERROR(bad value ${enableval} for newlib-unbuf-stream-opt option) ;;
255 fi], [newlib_unbuf_stream_opt=yes])dnl
257 dnl Support --enable-lite-exit
258 dnl Lite exit is a size-reduced implementation of exit that doesn't invoke
259 dnl clean-up functions such as _fini or global destructors.
260 AC_ARG_ENABLE(lite-exit,
261 [ --enable-lite-exit enable light weight exit],
262 [if test "${lite_exit+set}" != set; then
263 case "${enableval}" in
264 yes) lite_exit=yes ;;
266 *) AC_MSG_ERROR(bad value ${enableval} for lite-exit option) ;;
268 fi], [lite_exit=no])dnl
270 dnl Support --enable-newlib-nano-formatted-io
271 dnl This option is also read in libc/configure.in. It is repeated
272 dnl here so that it shows up in the help text.
273 AC_ARG_ENABLE(newlib_nano_formatted_io,
274 [ --enable-newlib-nano-formatted-io Use small-footprint nano-formatted-IO implementation],
275 [case "${enableval}" in
276 yes) newlib_nano_formatted_io=yes ;;
277 no) newlib_nano_formatted_io=no ;;
278 *) AC_MSG_ERROR(bad value ${enableval} for newlib-nano-formatted-io) ;;
279 esac],[newlib_nano_formatted_io=no])
280 AM_CONDITIONAL(NEWLIB_NANO_FORMATTED_IO, test x$newlib_nano_formatted_io = xyes)
282 dnl Support --enable-retargetable-locking
283 dnl This option is also read in libc/configure.in. It is repeated
284 dnl here so that it shows up in the help text.
285 AC_ARG_ENABLE(newlib-retargetable-locking,
286 [ --enable-newlib-retargetable-locking Allow locking routines to be retargeted at link time],
287 [case "${enableval}" in
288 yes) newlib_retargetable_locking=yes ;;
289 no) newlib_retargetable_locking=no ;;
290 *) AC_MSG_ERROR(bad value ${enableval} for newlib-retargetable-locking) ;;
291 esac],[newlib_retargetable_locking=no])
292 AM_CONDITIONAL(NEWLIB_RETARGETABLE_LOCKING, test x$newlib_retargetable_locking = xyes)
294 dnl Support --enable-newlib-long-time_t
295 AC_ARG_ENABLE(newlib-long-time_t,
296 [ --enable-newlib-long-time_t define time_t to long],
297 [if test "${newlib_long_time_t+set}" != set; then
298 case "${enableval}" in
299 yes) newlib_long_time_t=yes ;;
300 no) newlib_long_time_t=no ;;
301 *) AC_MSG_ERROR(bad value ${enableval} for newlib-long-time_t option) ;;
303 fi], [newlib_long_time_t=no])dnl
305 dnl Support --enable-newlib-use-gdtoa
306 AC_ARG_ENABLE(newlib-use-gdtoa,
307 [ --enable-newlib-use-gdtoa Use gdtoa rather than legacy ldtoa],
308 [if test "${newlib_use_gdtoa+set}" != set; then
309 case "${enableval}" in
310 yes) newlib_use_gdtoa=yes ;;
311 no) newlib_use_gdtoa=no ;;
312 *) AC_MSG_ERROR(bad value ${enableval} for newlib-use-gdtoa option) ;;
314 fi], [newlib_use_gdtoa=yes])dnl
316 AM_ENABLE_MULTILIB(, ..)
319 dnl The following is being disabled because the mathfp library is
320 dnl not up to standard due to inaccuracies caused by some of the
321 dnl floating-point algorithms used. If you wish to work on this,
322 dnl comment out the following line and uncomment out the lines
323 dnl following it to re-enable the feature.
325 #AC_ARG_ENABLE(newlib_hw_fp,
326 #[ --enable-newlib-hw-fp Turn on hardware floating point math],
327 #[case "${enableval}" in
328 # yes) newlib_hw_fp=true ;;
329 # no) newlib_hw_fp=false ;;
330 # *) AC_MSG_ERROR(bad value ${enableval} for --enable-newlib-hw-fp) ;;
331 # esac],[newlib_hw_fp=false])
332 AM_CONDITIONAL(NEWLIB_HW_FP, test x$newlib_hw_fp = xtrue)
334 # These get added in the top-level configure.in, except in the case where
335 # newlib is being built natively.
336 LIBC_INCLUDE_GREP=`echo ${CC} | grep \/libc\/include`
337 if test -z "${LIBC_INCLUDE_GREP}"; then
338 CC_FOR_NEWLIB="${CC} -I$PWD/targ-include -I${abs_newlib_basedir}/libc/include"
340 CC_FOR_NEWLIB="${CC}"
342 AC_SUBST(CC_FOR_NEWLIB)
344 m4_include([libc/acinclude.m4])
345 m4_include([libm/acinclude.m4])
347 if test -z "${with_multisubdir}"; then
352 AM_CONDITIONAL(HAVE_DOC, test x$have_multisubdir = xno)
354 # Some run-time support libraries provided by GCC (e.g. libgomp) use configure
355 # checks to detect certain features, e.g. availability of thread-local storage.
356 # The configure script generates a test program and tries to compile and link
357 # it. It should use target libraries and startfiles of the build tree if
358 # available and not random ones from the installation prefix for this
359 # procedure. The search directories specified by -B are a bit special, see
360 # for_each_path() in gcc.c of the GCC sources. First a search is performed on
361 # all search paths with the multilib directory appended (if desired), then a
362 # second search is performed on demand with the base directory only. For each
363 # multilib there is a "newlib" subdirectory. This directory is specified by a
364 # -B option for the support libraries. In order to find the newlib artifacts
365 # (ctr0.o, libc.a, libg.a and libm.a) they must be located in a proper multilib
366 # subdirectory withing the build directory.
367 AM_CONDITIONAL(HAVE_MULTISUBDIR, test x$have_multisubdir = xyes)
371 if test "x${have_crt0}" = "xyes"; then
373 CRT0_DIR=libc/sys/${sys_dir}/
375 AM_CONDITIONAL(HAVE_CRT0, test x$have_crt0 = xyes)
381 if test -n "${crt1_dir}"; then
382 CRT1_DIR=${crt1_dir}/
387 # Put a plausible default for CC_FOR_BUILD in Makefile.
388 if test -z "$CC_FOR_BUILD"; then
389 if test "x$cross_compiling" = "xno"; then
395 AC_SUBST(CC_FOR_BUILD)
397 # Also set EXEEXT_FOR_BUILD.
398 if test "x$cross_compiling" = "xno"; then
399 EXEEXT_FOR_BUILD='$(EXEEXT)'
401 AC_CACHE_CHECK([for build system executable suffix], newlib_cv_build_exeext,
402 [cat > ac_c_test.c << 'EOF'
404 /* Nothing needed here */
407 ${CC_FOR_BUILD} -o ac_c_test am_c_test.c 1>&5 2>&5
408 newlib_cv_build_exeext=`echo ac_c_test.* | grep -v ac_c_test.c | sed -e s/ac_c_test//`
410 test x"${newlib_cv_build_exeext}" = x && newlib_cv_build_exeext=no])
412 test x"${newlib_cv_build_exeext}" != xno && EXEEXT_FOR_BUILD=${newlib_cv_build_exeext}
414 AC_SUBST(EXEEXT_FOR_BUILD)
416 AC_DEFINE(_NEWLIB_VERSION, "NEWLIB_VERSION", [The newlib version in string format.])
417 AC_DEFINE(__NEWLIB__, NEWLIB_MAJOR_VERSION, [The newlib major version number.])
418 AC_DEFINE(__NEWLIB_MINOR__, NEWLIB_MINOR_VERSION, [The newlib minor version number.])
419 AC_DEFINE(__NEWLIB_PATCHLEVEL__, NEWLIB_PATCHLEVEL_VERSION, [The newlib patch level.])
421 if test "${newlib_elix_level}" -gt "0"; then
422 AC_DEFINE_UNQUOTED(_ELIX_LEVEL, ${newlib_elix_level}, [EL/IX level])
425 if test "${newlib_reent_check_verify}" = "yes"; then
426 AC_DEFINE(_REENT_CHECK_VERIFY, 1, [Verify _REENT_CHECK macros allocate memory successfully.])
429 if test "${newlib_io_c99_formats}" = "yes"; then
430 AC_DEFINE(_WANT_IO_C99_FORMATS, 1, [Enable C99 formats support (e.g. %a, %zu, ...) in IO functions like printf/scanf.])
433 if test "${newlib_register_fini}" = "yes"; then
434 AC_DEFINE(_WANT_REGISTER_FINI, 1, [Register application finalization function using atexit.])
437 if test "${newlib_io_long_long}" = "yes"; then
438 AC_DEFINE(_WANT_IO_LONG_LONG, 1, [Define to enable long long type support in IO functions like printf/scanf.])
441 if test "${newlib_io_long_double}" = "yes"; then
442 AC_DEFINE(_WANT_IO_LONG_DOUBLE, 1, [Define to enable long double type support in IO functions like printf/scanf.])
445 if test "${newlib_io_pos_args}" = "yes"; then
446 AC_DEFINE(_WANT_IO_POS_ARGS, 1, [Positional argument support in printf functions enabled.])
449 if test "${newlib_reent_small}" = "yes"; then
450 AC_DEFINE(_WANT_REENT_SMALL, 1, [Optional reentrant struct support. Used mostly on platforms with very restricted storage.])
453 if test "${newlib_reent_binary_compat}" = "yes"; then
454 AC_DEFINE(_WANT_REENT_BACKWARD_BINARY_COMPAT, 1, [Define to enable backward binary compatibility for struct _reent.])
457 if test "${newlib_reent_thread_local}" = "yes"; then
458 AC_DEFINE(_WANT_REENT_THREAD_LOCAL, 1, [Define to enable thread-local storage objects as a replacment for struct _reent members.])
462 if test "${newlib_mb}" = "yes"; then
463 AC_DEFINE(_MB_CAPABLE, 1, [Multibyte supported.])
466 AC_DEFINE_UNQUOTED(_MB_LEN_MAX, $_mb_len_max, [Multibyte max length.])
468 dnl These are AC_SUBST instead of AC_DEFINE as they're hand maintained in a
469 dnl dedicated _newlib_version.h, and we don't want them in newlib.h.
470 AC_SUBST([NEWLIB_VERSION])
471 AC_SUBST([NEWLIB_MAJOR_VERSION])
472 AC_SUBST([NEWLIB_MINOR_VERSION])
473 AC_SUBST([NEWLIB_PATCHLEVEL_VERSION])
475 if test "${newlib_iconv}" = "yes"; then
476 AC_DEFINE(_ICONV_ENABLED, 1, [ICONV enabled.])
479 if test "x${newlib_iconv_external_ccs}" = "xyes"; then
480 if test "x${newlib_iconv}" = "x"; then
481 AC_MSG_ERROR(--enable-newlib-iconv-external-ccs option can't be used if iconv library is disabled, use --enable-newlib-iconv to enable it.)
483 AC_DEFINE(_ICONV_ENABLE_EXTERNAL_CCS, 1, [Enable ICONV external CCS files loading capabilities.])
486 if test "${newlib_atexit_dynamic_alloc}" = "yes"; then
487 AC_DEFINE(_ATEXIT_DYNAMIC_ALLOC, 1, [If atexit() may dynamically allocate space for cleanup functions.])
490 if test "${newlib_fvwrite_in_streamio}" = "yes"; then
491 AC_DEFINE(_FVWRITE_IN_STREAMIO, 1, [Define if ivo supported in streamio.])
494 if test "${newlib_fseek_optimization}" = "yes"; then
495 AC_DEFINE(_FSEEK_OPTIMIZATION, 1, [Define if fseek functions support seek optimization.])
498 if test "${newlib_wide_orient}" = "yes"; then
499 AC_DEFINE(_WIDE_ORIENT, 1, [Define if wide char orientation is supported.])
502 if test "${newlib_nano_malloc}" = "yes"; then
503 AC_DEFINE(_NANO_MALLOC, 1, [nano version of malloc is used.])
506 if test "${newlib_unbuf_stream_opt}" = "yes"; then
507 AC_DEFINE(_UNBUF_STREAM_OPT, 1, [Define if unbuffered stream file optimization is supported.])
510 if test "${lite_exit}" = "yes"; then
511 AC_DEFINE(_LITE_EXIT, 1, [Define if lite version of exit supported.])
514 if test "${newlib_nano_formatted_io}" = "yes"; then
515 AC_DEFINE(_NANO_FORMATTED_IO, 1, [Define if small footprint nano-formatted-IO implementation used.])
518 if test "${newlib_retargetable_locking}" = "yes"; then
519 AC_DEFINE(_RETARGETABLE_LOCKING, 1, [Define if using retargetable functions for default lock routines.])
522 if test "${newlib_long_time_t}" = "yes"; then
523 AC_DEFINE(_WANT_USE_LONG_TIME_T, 1, [Define to use type long for time_t.])
526 if test "${newlib_use_gdtoa}" = "yes"; then
527 AC_DEFINE(_WANT_USE_GDTOA, 1, [Define if using gdtoa rather than legacy ldtoa.])
531 dnl Parse --enable-newlib-iconv-encodings option argument
534 if test "x${iconv_encodings}" != "x" \
535 || test "x${iconv_to_encodings}" != "x" \
536 || test "x${iconv_from_encodings}" != "x"; then
537 if test "x${newlib_iconv}" = "x"; then
538 AC_MSG_ERROR([--enable-newlib-iconv-encodings, --enable-newlib-iconv-from-encodings and --enable-newlib-iconv-to-encodings option can't be used if iconv library is disabled, use --enable-newlib-iconv to enable it.])
541 dnl Normalize encodings names and delete commas
542 iconv_encodings=`echo "${iconv_encodings}" | sed -e 's/,/ /g' -e 's/-/_/g' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
543 iconv_to_encodings=`echo "${iconv_to_encodings}" | sed -e 's/,/ /g' -e 's/-/_/g' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
544 iconv_from_encodings=`echo "${iconv_from_encodings}" | sed -e 's/,/ /g' -e 's/-/_/g' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
546 dnl Get the list of available encodings excluding comments
547 dnl Join line with previous if the first character is whitespace
548 available_encodings=`cat "${srcdir}/libc/iconv/encoding.aliases" | sed -e '/^#.*/d'`
550 dnl Check if required encodings are supported
551 dnl Convert aliases to names
554 iconv_encodings1="${iconv_encodings}"
556 for encoding in ${iconv_encodings1}; do
557 result=`echo "${available_encodings}" | grep -e "\(^\| \)${encoding}\( \|\$\)"`
558 if test $? != "0"; then
559 AC_MSG_ERROR(${encoding} is not supported - see ${srcdir}/libc/iconv/encoding.aliases file for the list of available encodings)
561 encoding1=`echo "${result}" | sed -e 's/\(^[[^ ]]*\).*$/\1/'`
562 iconv_encodings="${iconv_encodings} ${encoding1}"
564 dnl Enable appropriate option in newlib.h
565 for encoding in ${iconv_encodings}; do
566 opt=_ICONV_TO_ENCODING_`echo "${encoding}" | sed -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
568 opt=_ICONV_FROM_ENCODING_`echo "${encoding}" | sed -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
572 dnl iconv_to_encodings
573 iconv_encodings1="${iconv_to_encodings}"
574 iconv_to_encodings=""
575 for encoding in ${iconv_encodings1}; do
576 result=`echo "${available_encodings}" | grep -e "\(^\| \)${encoding}\( \|\$\)"`
577 if test $? != "0"; then
578 AC_MSG_ERROR(${encoding} is not supported - see ${srcdir}/libc/iconv/encoding.aliases file for the list of available encodings)
580 encoding1=`echo "${result}" | sed -e 's/\(^[[^ ]]*\).*$/\1/'`
581 iconv_to_encodings="${iconv_to_encodings} ${encoding1}"
583 dnl Enable appropriate option in newlib.h
584 for encoding in ${iconv_to_encodings}; do
585 opt=_ICONV_TO_ENCODING_`echo "${encoding}" | sed -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
589 dnl iconv_from_encodings
590 iconv_encodings1="${iconv_from_encodings}"
591 iconv_from_encodings=""
592 for encoding in ${iconv_encodings1}; do
593 result=`echo "${available_encodings}" | grep -e "\(^\| \)${encoding}\( \|\$\)"`
594 if test $? != "0"; then
595 AC_MSG_ERROR(${encoding} is not supported - see ${srcdir}/libc/iconv/encoding.aliases file for the list of available encodings)
597 encoding1=`echo "${result}" | sed -e 's/\(^[[^ ]]*\).*$/\1/'`
598 iconv_from_encodings="${iconv_from_encodings} ${encoding1}"
600 dnl Enable appropriate option in newlib.h
601 for encoding in ${iconv_from_encodings}; do
602 opt=_ICONV_FROM_ENCODING_`echo "${encoding}" | sed -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
608 AC_CACHE_CHECK(for .preinit_array/.init_array/.fini_array support,
609 newlib_cv_initfinit_array, [dnl
610 cat > conftest.c <<EOF
611 int _start (void) { return 0; }
612 int __start (void) { return 0; }
613 int foo (void) { return 1; }
614 int (*fp) (void) __attribute__ ((section (".init_array"))) = foo;
616 if AC_TRY_COMMAND([${CC} $CFLAGS $CPPFLAGS -c -o conftest conftest.c
617 1>&AS_MESSAGE_LOG_FD])
619 if ${READELF} -S conftest | grep -e INIT_ARRAY > /dev/null; then
620 newlib_cv_initfinit_array=yes
622 newlib_cv_initfinit_array=no
625 newlib_cv_initfinit_array=no
628 if test $newlib_cv_initfinit_array = yes; then
629 AC_DEFINE(_HAVE_INITFINI_ARRAY, 1, [Define if the linker supports .preinit_array/.init_array/.fini_array sections.])
632 AC_CACHE_CHECK(if $CC accepts -fno-tree-loop-distribute-patterns with \
633 __attribute__ ((__optimize__)), newlib_cv_cc_loop_to_function, [dnl
634 cat > conftest.c <<EOF
636 __attribute__ ((__optimize__ ("-fno-tree-loop-distribute-patterns")))
639 newlib_cv_cc_loop_to_function=no
640 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c
641 -fno-tree-loop-distribute-patterns conftest.c])
643 newlib_cv_cc_loop_to_function=yes
646 if test $newlib_cv_cc_loop_to_function = yes; then
647 AC_DEFINE(_HAVE_CC_INHIBIT_LOOP_TO_LIBCALL, 1, [Define if compiler supports -fno-tree-loop-distribute-patterns.])
651 dnl Export the setting for our installed headers to check.
652 if test $ac_cv_type_long_double = yes; then
653 AC_DEFINE(_HAVE_LONG_DOUBLE, 1, [Define if the platform supports long double type.])
655 AM_CONDITIONAL(HAVE_LONG_DOUBLE, test x"$ac_cv_type_long_double" = x"yes")
657 AC_CACHE_CHECK(whether long double equals double,
658 newlib_cv_ldbl_eq_dbl, [dnl
659 cat > conftest.c <<EOF
661 #if DBL_MANT_DIG == LDBL_MANT_DIG && LDBL_MIN_EXP == DBL_MIN_EXP && \
662 LDBL_MAX_EXP == DBL_MAX_EXP
668 if AC_TRY_COMMAND([${CC} $CFLAGS $CPPFLAGS -c -o conftest.o conftest.c
669 1>&AS_MESSAGE_LOG_FD])
671 newlib_cv_ldbl_eq_dbl=yes;
673 newlib_cv_ldbl_eq_dbl=no;
676 if test $newlib_cv_ldbl_eq_dbl = yes; then
677 AC_DEFINE(_LDBL_EQ_DBL, 1, [Define if the platform long double type is equal to double.])
680 AC_CONFIG_FILES([Makefile])