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 NB: newlib.h must be the first AC_CONFIG_HEADERS call for autoheader.
12 AC_CONFIG_HEADERS([newlib.h:newlib.hin], [sed -i.tmp -e '/^#define [^_]/d' -e '/^\/\* #undef [^_]/d' newlib.h && rm -f newlib.h.tmp])
13 AH_TOP([/* NB: The contents are filtered before being installed. */
16 #define __NEWLIB_H__ 1
19 #include <_newlib_version.h>])
20 AH_BOTTOM([#endif /* !__NEWLIB_H__ */])
22 AC_CONFIG_HEADERS([_newlib_version.h:_newlib_version.hin])
24 dnl Can't be done in NEWLIB_CONFIGURE because that confuses automake.
27 dnl Support --enable-newlib-io-pos-args
28 dnl This option is actually read in libc/configure.in. It is repeated
29 dnl here so that it shows up in the help text.
30 AC_ARG_ENABLE(newlib-io-pos-args,
31 [ --enable-newlib-io-pos-args enable printf-family positional arg support],
32 [case "${enableval}" in
33 yes) newlib_io_pos_args=yes ;;
34 no) newlib_io_pos_args=no ;;
35 *) AC_MSG_ERROR(bad value ${enableval} for newlib-io-pos-args option) ;;
36 esac], [newlib_io_pos_args=])dnl
38 dnl Support --enable-newlib-io-c99-formats
39 AC_ARG_ENABLE(newlib-io-c99-formats,
40 [ --enable-newlib-io-c99-formats enable C99 support in IO functions like printf/scanf],
41 [case "${enableval}" in
42 yes) newlib_io_c99_formats=yes;;
43 no) newlib_io_c99_formats=no ;;
44 *) AC_MSG_ERROR(bad value ${enableval} for newlib-io-c99-formats option) ;;
45 esac], [newlib_io_c99_formats=])dnl
47 dnl Support --enable-newlib-register-fini
48 AC_ARG_ENABLE(newlib-register-fini,
49 [ --enable-newlib-register-fini enable finalization function registration using atexit],
50 [case "${enableval}" in
51 yes) newlib_register_fini=yes;;
52 no) newlib_register_fini=no ;;
53 *) AC_MSG_ERROR(bad value ${enableval} for newlib-register-fini option) ;;
54 esac], [newlib_register_fini=])dnl
56 dnl Support --enable-newlib-io-long-long
57 AC_ARG_ENABLE(newlib-io-long-long,
58 [ --enable-newlib-io-long-long enable long long type support in IO functions like printf/scanf],
59 [case "${enableval}" in
60 yes) newlib_io_long_long=yes;;
61 no) newlib_io_long_long=no ;;
62 *) AC_MSG_ERROR(bad value ${enableval} for newlib-io-long-long option) ;;
63 esac], [newlib_io_long_long=])dnl
65 dnl Support --enable-newlib-io-long-double
66 AC_ARG_ENABLE(newlib-io-long-double,
67 [ --enable-newlib-io-long-double enable long double type support in IO functions printf/scanf],
68 [case "${enableval}" in
69 yes) newlib_io_long_double=yes;;
70 no) newlib_io_long_double=no ;;
71 *) AC_MSG_ERROR(bad value ${enableval} for newlib-io-long-double option) ;;
72 esac], [newlib_io_long_double=])dnl
74 dnl If multibyte support is enabled, iconv should be enabled too
75 dnl Support --enable-newlib-mb
76 AC_ARG_ENABLE(newlib-mb,
77 [ --enable-newlib-mb enable multibyte support],
78 [case "${enableval}" in
81 *) AC_MSG_ERROR(bad value ${enableval} for newlib-mb option) ;;
82 esac], [newlib_mb=])dnl
84 dnl Enable verification of successful memory allocation for _REENT_CHECK family of macros
85 dnl Support --disable-newlib-reent-check-verify
86 AC_ARG_ENABLE(newlib-reent-check-verify,
87 [ --disable-newlib-reent-check-verify disable checking of _REENT_CHECK memory allocation],
88 [case "${enableval}" in
89 yes) newlib_reent_check_verify=yes;;
90 no) newlib_reent_check_verify=no ;;
91 *) AC_MSG_ERROR(bad value ${enableval} for newlib-reent-check-verify option) ;;
92 esac], [newlib_reent_check_verify=])dnl
94 dnl Support --enable-newlib-iconv-encodings
95 AC_ARG_ENABLE(newlib-iconv-encodings,
96 [ --enable-newlib-iconv-encodings enable specific comma-separated list of bidirectional iconv encodings to be built-in],
97 [if test x${enableval} = x; then
98 AC_MSG_ERROR(bad value ${enableval} for newlib-iconv-encodings option - use comma-separated encodings list)
100 iconv_encodings=${enableval}
101 ], [iconv_encodings=])dnl
103 dnl Support --enable-newlib-iconv-from-encodings
104 AC_ARG_ENABLE(newlib-iconv-from-encodings,
105 [ --enable-newlib-iconv-from-encodings enable specific comma-separated list of \"from\" iconv encodings to be built-in],
106 [if test x${enableval} = x; then
107 AC_MSG_ERROR(bad value ${enableval} for newlib-iconv-from-encodings option - use comma-separated encodings list)
109 iconv_from_encodings=${enableval}
110 ], [iconv_from_encodings=])dnl
112 dnl Support --enable-newlib-iconv-to-encodings
113 AC_ARG_ENABLE(newlib-iconv-to-encodings,
114 [ --enable-newlib-iconv-to-encodings enable specific comma-separated list of \"to\" iconv encodings to be built-in],
115 [if test x${enableval} = x; then
116 AC_MSG_ERROR(bad value ${enableval} for newlib-iconv-to-encodings option - use comma-separated encodings list)
118 iconv_to_encodings=${enableval}
119 ], [iconv_to_encodings=])dnl
121 dnl Support --enable-newlib-iconv-external-ccs
122 AC_ARG_ENABLE(newlib-iconv-external-ccs,
123 [ --enable-newlib-iconv-external-ccs enable capabilities to load external CCS files for iconv],
124 [if test "${newlib_iconv_external_ccs+set}" != set; then
125 case "${enableval}" in
126 yes) newlib_iconv_external_ccs=yes ;;
127 no) newlib_iconv_external_ccs=no ;;
128 *) AC_MSG_ERROR(bad value ${enableval} for newlib-iconv-external-ccs option) ;;
130 fi], [newlib_iconv_external_ccs=${newlib_iconv_external_ccs}])dnl
132 dnl Support --disable-newlib-atexit-dynamic-alloc
133 AC_ARG_ENABLE(newlib-atexit-dynamic-alloc,
134 [ --disable-newlib-atexit-dynamic-alloc disable dynamic allocation of atexit entries],
135 [if test "${newlib_atexit_dynamic_alloc+set}" != set; then
136 case "${enableval}" in
137 yes) newlib_atexit_dynamic_alloc=yes ;;
138 no) newlib_atexit_dynamic_alloc=no ;;
139 *) AC_MSG_ERROR(bad value ${enableval} for newlib-atexit-dynamic-alloc option) ;;
141 fi], [newlib_atexit_dynamic_alloc=${newlib_atexit_dynamic_alloc}])dnl
143 dnl Support --enable-newlib-global-atexit
144 dnl Enable atexit data structure as global variables to save memory usage in
146 AC_ARG_ENABLE(newlib-global-atexit,
147 [ --enable-newlib-global-atexit enable atexit data structure as global],
148 [if test "${newlib_global_atexit+set}" != set; then
149 case "${enableval}" in
150 yes) newlib_global_atexit=yes ;;
151 no) newlib_global_atexit=no ;;
152 *) AC_MSG_ERROR(bad value ${enableval} for newlib-global-atexit option) ;;
154 fi], [newlib_global_atexit=no])dnl
156 dnl Support --enable-newlib-reent-small
157 AC_ARG_ENABLE(newlib-reent-small,
158 [ --enable-newlib-reent-small enable small reentrant struct support],
159 [case "${enableval}" in
160 yes) newlib_reent_small=yes;;
161 no) newlib_reent_small=no ;;
162 *) AC_MSG_ERROR(bad value ${enableval} for newlib-reent-small option) ;;
163 esac], [newlib_reent_small=])dnl
165 dnl Support --enable-newlib-global-stdio-streams
166 AC_ARG_ENABLE(newlib-global-stdio-streams,
167 [ --enable-newlib-global-stdio-streams enable global stdio streams],
168 [case "${enableval}" in
169 yes) newlib_global_stdio_streams=yes;;
170 no) newlib_global_stdio_streams=no ;;
171 *) AC_MSG_ERROR(bad value ${enableval} for newlib-global-stdio-streams option) ;;
172 esac], [newlib_global_stdio_streams=])dnl
174 dnl Support --disable-newlib-fvwrite-in-streamio
175 AC_ARG_ENABLE(newlib-fvwrite-in-streamio,
176 [ --disable-newlib-fvwrite-in-streamio disable iov in streamio],
177 [if test "${newlib_fvwrite_in_streamio+set}" != set; then
178 case "${enableval}" in
179 yes) newlib_fvwrite_in_streamio=yes ;;
180 no) newlib_fvwrite_in_streamio=no ;;
181 *) AC_MSG_ERROR(bad value ${enableval} for newlib-fvwrite-in-streamio option) ;;
183 fi], [newlib_fvwrite_in_streamio=yes])dnl
185 dnl Support --disable-newlib-fseek-optimization
186 AC_ARG_ENABLE(newlib-fseek-optimization,
187 [ --disable-newlib-fseek-optimization disable fseek optimization],
188 [if test "${newlib_fseek_optimization+set}" != set; then
189 case "${enableval}" in
190 yes) newlib_fseek_optimization=yes ;;
191 no) newlib_fseek_optimization=no ;;
192 *) AC_MSG_ERROR(bad value ${enableval} for newlib-fseek-optimization option) ;;
194 fi], [newlib_fseek_optimization=yes])dnl
196 dnl Support --enable-newlib-wide-orient
197 dnl This option is also read in libc/configure.in. It is repeated
198 dnl here so that it shows up in the help text.
199 AC_ARG_ENABLE(newlib_wide_orient,
200 [ --disable-newlib-wide-orient Turn off wide orientation in streamio],
201 [case "${enableval}" in
202 yes) newlib_wide_orient=yes ;;
203 no) newlib_wide_orient=no ;;
204 *) AC_MSG_ERROR(bad value ${enableval} for newlib-wide-orient) ;;
205 esac],[newlib_wide_orient=yes])
207 dnl Support --enable-newlib-nano-malloc
208 dnl This option is also read in libc/configure.in. It is repeated
209 dnl here so that it shows up in the help text.
210 AC_ARG_ENABLE(newlib-nano-malloc,
211 [ --enable-newlib-nano-malloc use small-footprint nano-malloc implementation],
212 [if test "${newlib_nano_malloc+set}" != set; then
213 case "${enableval}" in
214 yes) newlib_nano_malloc=yes ;;
215 no) newlib_nano_malloc=no ;;
216 *) AC_MSG_ERROR(bad value ${enableval} for newlib-nano-malloc option) ;;
218 fi], [newlib_nano_malloc=])dnl
219 AM_CONDITIONAL(NEWLIB_NANO_MALLOC, test x$newlib_nano_malloc = xyes)
221 dnl Support --disable-newlib-unbuf-stream-opt
222 AC_ARG_ENABLE(newlib-unbuf-stream-opt,
223 [ --disable-newlib-unbuf-stream-opt disable unbuffered stream optimization in streamio],
224 [if test "${newlib_unbuf_stream_opt+set}" != set; then
225 case "${enableval}" in
226 yes) newlib_unbuf_stream_opt=yes ;;
227 no) newlib_unbuf_stream_opt=no ;;
228 *) AC_MSG_ERROR(bad value ${enableval} for newlib-unbuf-stream-opt option) ;;
230 fi], [newlib_unbuf_stream_opt=yes])dnl
232 dnl Support --enable-lite-exit
233 dnl Lite exit is a size-reduced implementation of exit that doesn't invoke
234 dnl clean-up functions such as _fini or global destructors.
235 AC_ARG_ENABLE(lite-exit,
236 [ --enable-lite-exit enable light weight exit],
237 [if test "${lite_exit+set}" != set; then
238 case "${enableval}" in
239 yes) lite_exit=yes ;;
241 *) AC_MSG_ERROR(bad value ${enableval} for lite-exit option) ;;
243 fi], [lite_exit=no])dnl
245 dnl Support --enable-newlib-nano-formatted-io
246 dnl This option is also read in libc/configure.in. It is repeated
247 dnl here so that it shows up in the help text.
248 AC_ARG_ENABLE(newlib_nano_formatted_io,
249 [ --enable-newlib-nano-formatted-io Use small-footprint nano-formatted-IO implementation],
250 [case "${enableval}" in
251 yes) newlib_nano_formatted_io=yes ;;
252 no) newlib_nano_formatted_io=no ;;
253 *) AC_MSG_ERROR(bad value ${enableval} for newlib-nano-formatted-io) ;;
254 esac],[newlib_nano_formatted_io=no])
255 AM_CONDITIONAL(NEWLIB_NANO_FORMATTED_IO, test x$newlib_nano_formatted_io = xyes)
257 dnl Support --enable-retargetable-locking
258 dnl This option is also read in libc/configure.in. It is repeated
259 dnl here so that it shows up in the help text.
260 AC_ARG_ENABLE(newlib-retargetable-locking,
261 [ --enable-newlib-retargetable-locking Allow locking routines to be retargeted at link time],
262 [case "${enableval}" in
263 yes) newlib_retargetable_locking=yes ;;
264 no) newlib_retargetable_locking=no ;;
265 *) AC_MSG_ERROR(bad value ${enableval} for newlib-retargetable-locking) ;;
266 esac],[newlib_retargetable_locking=no])
267 AM_CONDITIONAL(NEWLIB_RETARGETABLE_LOCKING, test x$newlib_retargetable_locking = xyes)
269 dnl Support --enable-newlib-long-time_t
270 AC_ARG_ENABLE(newlib-long-time_t,
271 [ --enable-newlib-long-time_t define time_t to long],
272 [if test "${newlib_long_time_t+set}" != set; then
273 case "${enableval}" in
274 yes) newlib_long_time_t=yes ;;
275 no) newlib_long_time_t=no ;;
276 *) AC_MSG_ERROR(bad value ${enableval} for newlib-long-time_t option) ;;
278 fi], [newlib_long_time_t=no])dnl
280 dnl Support --enable-newlib-use-gdtoa
281 AC_ARG_ENABLE(newlib-use-gdtoa,
282 [ --enable-newlib-use-gdtoa Use gdtoa rather than legacy ldtoa],
283 [if test "${newlib_use_gdtoa+set}" != set; then
284 case "${enableval}" in
285 yes) newlib_use_gdtoa=yes ;;
286 no) newlib_use_gdtoa=no ;;
287 *) AC_MSG_ERROR(bad value ${enableval} for newlib-use-gdtoa option) ;;
289 fi], [newlib_use_gdtoa=yes])dnl
291 AM_ENABLE_MULTILIB(, ..)
294 dnl The following is being disabled because the mathfp library is
295 dnl not up to standard due to inaccuracies caused by some of the
296 dnl floating-point algorithms used. If you wish to work on this,
297 dnl comment out the following line and uncomment out the lines
298 dnl following it to re-enable the feature.
300 #AC_ARG_ENABLE(newlib_hw_fp,
301 #[ --enable-newlib-hw-fp Turn on hardware floating point math],
302 #[case "${enableval}" in
303 # yes) newlib_hw_fp=true ;;
304 # no) newlib_hw_fp=false ;;
305 # *) AC_MSG_ERROR(bad value ${enableval} for --enable-newlib-hw-fp) ;;
306 # esac],[newlib_hw_fp=false])
307 AM_CONDITIONAL(NEWLIB_HW_FP, test x$newlib_hw_fp = xtrue)
309 # These get added in the top-level configure.in, except in the case where
310 # newlib is being built natively.
311 LIBC_INCLUDE_GREP=`echo ${CC} | grep \/libc\/include`
312 if test -z "${LIBC_INCLUDE_GREP}"; then
313 CC_FOR_NEWLIB="${CC} -I$PWD/targ-include -I${abs_newlib_basedir}/libc/include"
315 CC_FOR_NEWLIB="${CC}"
317 AC_SUBST(CC_FOR_NEWLIB)
319 m4_include([libc/acinclude.m4])
320 m4_include([libm/acinclude.m4])
322 if test -z "${with_multisubdir}"; then
327 AM_CONDITIONAL(HAVE_DOC, test x$have_multisubdir = xno)
329 # Some run-time support libraries provided by GCC (e.g. libgomp) use configure
330 # checks to detect certain features, e.g. availability of thread-local storage.
331 # The configure script generates a test program and tries to compile and link
332 # it. It should use target libraries and startfiles of the build tree if
333 # available and not random ones from the installation prefix for this
334 # procedure. The search directories specified by -B are a bit special, see
335 # for_each_path() in gcc.c of the GCC sources. First a search is performed on
336 # all search paths with the multilib directory appended (if desired), then a
337 # second search is performed on demand with the base directory only. For each
338 # multilib there is a "newlib" subdirectory. This directory is specified by a
339 # -B option for the support libraries. In order to find the newlib artifacts
340 # (ctr0.o, libc.a, libg.a and libm.a) they must be located in a proper multilib
341 # subdirectory withing the build directory.
342 AM_CONDITIONAL(HAVE_MULTISUBDIR, test x$have_multisubdir = xyes)
346 if test "x${have_crt0}" = "xyes"; then
348 CRT0_DIR=libc/sys/${sys_dir}/
350 AM_CONDITIONAL(HAVE_CRT0, test x$have_crt0 = xyes)
356 if test -n "${crt1_dir}"; then
357 CRT1_DIR=${crt1_dir}/
362 # Put a plausible default for CC_FOR_BUILD in Makefile.
363 if test -z "$CC_FOR_BUILD"; then
364 if test "x$cross_compiling" = "xno"; then
370 AC_SUBST(CC_FOR_BUILD)
372 # Also set EXEEXT_FOR_BUILD.
373 if test "x$cross_compiling" = "xno"; then
374 EXEEXT_FOR_BUILD='$(EXEEXT)'
376 AC_CACHE_CHECK([for build system executable suffix], newlib_cv_build_exeext,
377 [cat > ac_c_test.c << 'EOF'
379 /* Nothing needed here */
382 ${CC_FOR_BUILD} -o ac_c_test am_c_test.c 1>&5 2>&5
383 newlib_cv_build_exeext=`echo ac_c_test.* | grep -v ac_c_test.c | sed -e s/ac_c_test//`
385 test x"${newlib_cv_build_exeext}" = x && newlib_cv_build_exeext=no])
387 test x"${newlib_cv_build_exeext}" != xno && EXEEXT_FOR_BUILD=${newlib_cv_build_exeext}
389 AC_SUBST(EXEEXT_FOR_BUILD)
391 if test "${newlib_elix_level}" -gt "0"; then
392 AC_DEFINE_UNQUOTED(_ELIX_LEVEL, ${newlib_elix_level}, [EL/IX level])
395 if test "${newlib_reent_check_verify}" = "yes"; then
396 AC_DEFINE(_REENT_CHECK_VERIFY, 1, [Verify _REENT_CHECK macros allocate memory successfully.])
399 if test "${newlib_io_c99_formats}" = "yes"; then
400 AC_DEFINE(_WANT_IO_C99_FORMATS, 1, [Enable C99 formats support (e.g. %a, %zu, ...) in IO functions like printf/scanf.])
403 if test "${newlib_register_fini}" = "yes"; then
404 AC_DEFINE(_WANT_REGISTER_FINI, 1, [Register application finalization function using atexit.])
407 if test "${newlib_io_long_long}" = "yes"; then
408 AC_DEFINE(_WANT_IO_LONG_LONG, 1, [Define to enable long long type support in IO functions like printf/scanf.])
411 if test "${newlib_io_long_double}" = "yes"; then
412 AC_DEFINE(_WANT_IO_LONG_DOUBLE, 1, [Define to enable long double type support in IO functions like printf/scanf.])
415 if test "${newlib_io_pos_args}" = "yes"; then
416 AC_DEFINE(_WANT_IO_POS_ARGS, 1, [Positional argument support in printf functions enabled.])
419 if test "${newlib_reent_small}" = "yes"; then
420 AC_DEFINE(_WANT_REENT_SMALL, 1, [Optional reentrant struct support. Used mostly on platforms with very restricted storage.])
423 if test "${newlib_global_stdio_streams}" = "yes"; then
424 AC_DEFINE(_WANT_REENT_GLOBAL_STDIO_STREAMS, 1,
425 [Define to move the stdio stream FILE objects out of struct _reent and make them global.
426 The stdio stream pointers of struct _reent are initialized to point to the global stdio FILE stream objects.])
430 if test "${newlib_mb}" = "yes"; then
431 AC_DEFINE(_MB_CAPABLE, 1, [Multibyte supported.])
434 AC_DEFINE_UNQUOTED(_MB_LEN_MAX, $_mb_len_max, [Multibyte max length.])
436 dnl These are AC_SUBST instead of AC_DEFINE as they're hand maintained in a
437 dnl dedicated _newlib_version.h, and we don't want them in newlib.h.
438 AC_SUBST([NEWLIB_VERSION])
439 AC_SUBST([NEWLIB_MAJOR_VERSION])
440 AC_SUBST([NEWLIB_MINOR_VERSION])
441 AC_SUBST([NEWLIB_PATCHLEVEL_VERSION])
443 if test "${newlib_iconv}" = "yes"; then
444 AC_DEFINE(_ICONV_ENABLED, 1, [ICONV enabled.])
447 if test "x${newlib_iconv_external_ccs}" = "xyes"; then
448 if test "x${newlib_iconv}" = "x"; then
449 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.)
451 AC_DEFINE(_ICONV_ENABLE_EXTERNAL_CCS, 1, [Enable ICONV external CCS files loading capabilities.])
454 if test "${newlib_atexit_dynamic_alloc}" = "yes"; then
455 AC_DEFINE(_ATEXIT_DYNAMIC_ALLOC, 1, [If atexit() may dynamically allocate space for cleanup functions.])
458 if test "${newlib_global_atexit}" = "yes"; then
459 AC_DEFINE(_REENT_GLOBAL_ATEXIT, 1, [Define if declare atexit data as global.])
462 if test "${newlib_fvwrite_in_streamio}" = "yes"; then
463 AC_DEFINE(_FVWRITE_IN_STREAMIO, 1, [Define if ivo supported in streamio.])
466 if test "${newlib_fseek_optimization}" = "yes"; then
467 AC_DEFINE(_FSEEK_OPTIMIZATION, 1, [Define if fseek functions support seek optimization.])
470 if test "${newlib_wide_orient}" = "yes"; then
471 AC_DEFINE(_WIDE_ORIENT, 1, [Define if wide char orientation is supported.])
474 if test "${newlib_nano_malloc}" = "yes"; then
475 AC_DEFINE(_NANO_MALLOC, 1, [nano version of malloc is used.])
478 if test "${newlib_unbuf_stream_opt}" = "yes"; then
479 AC_DEFINE(_UNBUF_STREAM_OPT, 1, [Define if unbuffered stream file optimization is supported.])
482 if test "${lite_exit}" = "yes"; then
483 AC_DEFINE(_LITE_EXIT, 1, [Define if lite version of exit supported.])
486 if test "${newlib_nano_formatted_io}" = "yes"; then
487 AC_DEFINE(_NANO_FORMATTED_IO, 1, [Define if small footprint nano-formatted-IO implementation used.])
490 if test "${newlib_retargetable_locking}" = "yes"; then
491 AC_DEFINE(_RETARGETABLE_LOCKING, 1, [Define if using retargetable functions for default lock routines.])
494 if test "${newlib_long_time_t}" = "yes"; then
495 AC_DEFINE(_WANT_USE_LONG_TIME_T, 1, [Define to use type long for time_t.])
498 if test "${newlib_use_gdtoa}" = "yes"; then
499 AC_DEFINE(_WANT_USE_GDTOA, 1, [Define if using gdtoa rather than legacy ldtoa.])
503 dnl Parse --enable-newlib-iconv-encodings option argument
506 if test "x${iconv_encodings}" != "x" \
507 || test "x${iconv_to_encodings}" != "x" \
508 || test "x${iconv_from_encodings}" != "x"; then
509 if test "x${newlib_iconv}" = "x"; then
510 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.])
513 dnl Normalize encodings names and delete commas
514 iconv_encodings=`echo "${iconv_encodings}" | sed -e 's/,/ /g' -e 's/-/_/g' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
515 iconv_to_encodings=`echo "${iconv_to_encodings}" | sed -e 's/,/ /g' -e 's/-/_/g' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
516 iconv_from_encodings=`echo "${iconv_from_encodings}" | sed -e 's/,/ /g' -e 's/-/_/g' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
518 dnl Get the list of available encodings excluding comments
519 dnl Join line with previous if the first character is whitespace
520 available_encodings=`cat "${srcdir}/libc/iconv/encoding.aliases" | sed -e '/^#.*/d'`
522 dnl Check if required encodings are supported
523 dnl Convert aliases to names
526 iconv_encodings1="${iconv_encodings}"
528 for encoding in ${iconv_encodings1}; do
529 result=`echo "${available_encodings}" | grep -e "\(^\| \)${encoding}\( \|\$\)"`
530 if test $? != "0"; then
531 AC_MSG_ERROR(${encoding} is not supported - see ${srcdir}/libc/iconv/encoding.aliases file for the list of available encodings)
533 encoding1=`echo "${result}" | sed -e 's/\(^[[^ ]]*\).*$/\1/'`
534 iconv_encodings="${iconv_encodings} ${encoding1}"
536 dnl Enable appropriate option in newlib.h
537 for encoding in ${iconv_encodings}; do
538 opt=_ICONV_TO_ENCODING_`echo "${encoding}" | sed -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
540 opt=_ICONV_FROM_ENCODING_`echo "${encoding}" | sed -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
544 dnl iconv_to_encodings
545 iconv_encodings1="${iconv_to_encodings}"
546 iconv_to_encodings=""
547 for encoding in ${iconv_encodings1}; do
548 result=`echo "${available_encodings}" | grep -e "\(^\| \)${encoding}\( \|\$\)"`
549 if test $? != "0"; then
550 AC_MSG_ERROR(${encoding} is not supported - see ${srcdir}/libc/iconv/encoding.aliases file for the list of available encodings)
552 encoding1=`echo "${result}" | sed -e 's/\(^[[^ ]]*\).*$/\1/'`
553 iconv_to_encodings="${iconv_to_encodings} ${encoding1}"
555 dnl Enable appropriate option in newlib.h
556 for encoding in ${iconv_to_encodings}; do
557 opt=_ICONV_TO_ENCODING_`echo "${encoding}" | sed -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
561 dnl iconv_from_encodings
562 iconv_encodings1="${iconv_from_encodings}"
563 iconv_from_encodings=""
564 for encoding in ${iconv_encodings1}; do
565 result=`echo "${available_encodings}" | grep -e "\(^\| \)${encoding}\( \|\$\)"`
566 if test $? != "0"; then
567 AC_MSG_ERROR(${encoding} is not supported - see ${srcdir}/libc/iconv/encoding.aliases file for the list of available encodings)
569 encoding1=`echo "${result}" | sed -e 's/\(^[[^ ]]*\).*$/\1/'`
570 iconv_from_encodings="${iconv_from_encodings} ${encoding1}"
572 dnl Enable appropriate option in newlib.h
573 for encoding in ${iconv_from_encodings}; do
574 opt=_ICONV_FROM_ENCODING_`echo "${encoding}" | sed -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
580 AC_CACHE_CHECK(for .preinit_array/.init_array/.fini_array support,
581 newlib_cv_initfinit_array, [dnl
582 cat > conftest.c <<EOF
583 int _start (void) { return 0; }
584 int __start (void) { return 0; }
585 int foo (void) { return 1; }
586 int (*fp) (void) __attribute__ ((section (".init_array"))) = foo;
588 if AC_TRY_COMMAND([${CC} $CFLAGS $CPPFLAGS -c -o conftest conftest.c
589 1>&AS_MESSAGE_LOG_FD])
591 if ${READELF} -S conftest | grep -e INIT_ARRAY > /dev/null; then
592 newlib_cv_initfinit_array=yes
594 newlib_cv_initfinit_array=no
597 newlib_cv_initfinit_array=no
600 if test $newlib_cv_initfinit_array = yes; then
601 AC_DEFINE(_HAVE_INITFINI_ARRAY, 1, [Define if the linker supports .preinit_array/.init_array/.fini_array sections.])
604 AC_CACHE_CHECK(if $CC accepts -fno-tree-loop-distribute-patterns with \
605 __attribute__ ((__optimize__)), newlib_cv_cc_loop_to_function, [dnl
606 cat > conftest.c <<EOF
608 __attribute__ ((__optimize__ ("-fno-tree-loop-distribute-patterns")))
611 newlib_cv_cc_loop_to_function=no
612 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c
613 -fno-tree-loop-distribute-patterns conftest.c])
615 newlib_cv_cc_loop_to_function=yes
618 if test $newlib_cv_cc_loop_to_function = yes; then
619 AC_DEFINE(_HAVE_CC_INHIBIT_LOOP_TO_LIBCALL, 1, [Define if compiler supports -fno-tree-loop-distribute-patterns.])
623 dnl Export the setting for our installed headers to check.
624 if test $ac_cv_type_long_double = yes; then
625 AC_DEFINE(_HAVE_LONG_DOUBLE, 1, [Define if the platform supports long double type.])
627 AM_CONDITIONAL(HAVE_LONG_DOUBLE, test x"$ac_cv_type_long_double" = x"yes")
629 AC_CACHE_CHECK(whether long double equals double,
630 newlib_cv_ldbl_eq_dbl, [dnl
631 cat > conftest.c <<EOF
633 #if DBL_MANT_DIG == LDBL_MANT_DIG && LDBL_MIN_EXP == DBL_MIN_EXP && \
634 LDBL_MAX_EXP == DBL_MAX_EXP
640 if AC_TRY_COMMAND([${CC} $CFLAGS $CPPFLAGS -c -o conftest.o conftest.c
641 1>&AS_MESSAGE_LOG_FD])
643 newlib_cv_ldbl_eq_dbl=yes;
645 newlib_cv_ldbl_eq_dbl=no;
648 if test $newlib_cv_ldbl_eq_dbl = yes; then
649 AC_DEFINE(_LDBL_EQ_DBL, 1, [Define if the platform long double type is equal to double.])
652 AC_CONFIG_FILES([Makefile])