1dnl This is the newlib configure.in file.
2dnl Process this file with autoconf to produce a configure script.
3
4AC_PREREQ(2.59)
5AC_INIT([newlib],[NEWLIB_VERSION])
6AC_CONFIG_SRCDIR([libc])
7AC_CONFIG_HEADERS([_newlib_version.h:_newlib_version.hin newlib.h:newlib.hin])
8
9dnl Can't be done in NEWLIB_CONFIGURE because that confuses automake.
10AC_CONFIG_AUX_DIR(..)
11
12dnl Support --enable-newlib-io-pos-args
13dnl This option is actually read in libc/configure.in.  It is repeated
14dnl here so that it shows up in the help text.
15AC_ARG_ENABLE(newlib-io-pos-args,
16[  --enable-newlib-io-pos-args enable printf-family positional arg support],
17[case "${enableval}" in
18  yes) newlib_io_pos_args=yes ;;
19  no)  newlib_io_pos_args=no ;;
20  *)   AC_MSG_ERROR(bad value ${enableval} for newlib-io-pos-args option) ;;
21 esac], [newlib_io_pos_args=])dnl
22
23dnl Support --enable-newlib-io-c99-formats
24AC_ARG_ENABLE(newlib-io-c99-formats,
25[  --enable-newlib-io-c99-formats   enable C99 support in IO functions like printf/scanf],
26[case "${enableval}" in
27  yes) newlib_io_c99_formats=yes;;
28  no)  newlib_io_c99_formats=no ;;
29  *)   AC_MSG_ERROR(bad value ${enableval} for newlib-io-c99-formats option) ;;
30 esac], [newlib_io_c99_formats=])dnl
31
32dnl Support --enable-newlib-register-fini
33AC_ARG_ENABLE(newlib-register-fini,
34[  --enable-newlib-register-fini   enable finalization function registration using atexit],
35[case "${enableval}" in
36  yes) newlib_register_fini=yes;;
37  no)  newlib_register_fini=no ;;
38  *)   AC_MSG_ERROR(bad value ${enableval} for newlib-register-fini option) ;;
39 esac], [newlib_register_fini=])dnl
40
41dnl Support --enable-newlib-io-long-long
42AC_ARG_ENABLE(newlib-io-long-long,
43[  --enable-newlib-io-long-long   enable long long type support in IO functions like printf/scanf],
44[case "${enableval}" in
45  yes) newlib_io_long_long=yes;;
46  no)  newlib_io_long_long=no ;;
47  *)   AC_MSG_ERROR(bad value ${enableval} for newlib-io-long-long option) ;;
48 esac], [newlib_io_long_long=])dnl
49
50dnl Support --enable-newlib-io-long-double
51AC_ARG_ENABLE(newlib-io-long-double,
52[  --enable-newlib-io-long-double   enable long double type support in IO functions printf/scanf],
53[case "${enableval}" in
54  yes) newlib_io_long_double=yes;;
55  no)  newlib_io_long_double=no ;;
56  *)   AC_MSG_ERROR(bad value ${enableval} for newlib-io-long-double option) ;;
57 esac], [newlib_io_long_double=])dnl
58
59dnl If multibyte support is enabled, iconv should be enabled too
60dnl Support --enable-newlib-mb
61AC_ARG_ENABLE(newlib-mb,
62[  --enable-newlib-mb        enable multibyte support],
63[case "${enableval}" in
64  yes) newlib_mb=yes;;
65  no)  newlib_mb=no ;;
66  *)   AC_MSG_ERROR(bad value ${enableval} for newlib-mb option) ;;
67 esac], [newlib_mb=])dnl
68
69dnl Support --enable-newlib-iconv-encodings
70AC_ARG_ENABLE(newlib-iconv-encodings,
71[  --enable-newlib-iconv-encodings   enable specific comma-separated list of bidirectional iconv encodings to be built-in],
72[if test x${enableval} = x; then
73   AC_MSG_ERROR(bad value ${enableval} for newlib-iconv-encodings option - use comma-separated encodings list)
74 fi
75 iconv_encodings=${enableval}
76 ], [iconv_encodings=])dnl
77
78dnl Support --enable-newlib-iconv-from-encodings
79AC_ARG_ENABLE(newlib-iconv-from-encodings,
80[  --enable-newlib-iconv-from-encodings   enable specific comma-separated list of \"from\" iconv encodings to be built-in],
81[if test x${enableval} = x; then
82   AC_MSG_ERROR(bad value ${enableval} for newlib-iconv-from-encodings option - use comma-separated encodings list)
83 fi
84 iconv_from_encodings=${enableval}
85 ], [iconv_from_encodings=])dnl
86
87dnl Support --enable-newlib-iconv-to-encodings
88AC_ARG_ENABLE(newlib-iconv-to-encodings,
89[  --enable-newlib-iconv-to-encodings   enable specific comma-separated list of \"to\" iconv encodings to be built-in],
90[if test x${enableval} = x; then
91   AC_MSG_ERROR(bad value ${enableval} for newlib-iconv-to-encodings option - use comma-separated encodings list)
92 fi
93 iconv_to_encodings=${enableval}
94 ], [iconv_to_encodings=])dnl
95
96dnl Support --enable-newlib-iconv-external-ccs
97AC_ARG_ENABLE(newlib-iconv-external-ccs,
98[  --enable-newlib-iconv-external-ccs     enable capabilities to load external CCS files for iconv],
99[if test "${newlib_iconv_external_ccs+set}" != set; then
100   case "${enableval}" in
101     yes) newlib_iconv_external_ccs=yes ;;
102     no)  newlib_iconv_external_ccs=no ;;
103     *)   AC_MSG_ERROR(bad value ${enableval} for newlib-iconv-external-ccs option) ;;
104   esac
105 fi], [newlib_iconv_external_ccs=${newlib_iconv_external_ccs}])dnl
106
107dnl Support --disable-newlib-atexit-dynamic-alloc
108AC_ARG_ENABLE(newlib-atexit-dynamic-alloc,
109[  --disable-newlib-atexit-dynamic-alloc    disable dynamic allocation of atexit entries],
110[if test "${newlib_atexit_dynamic_alloc+set}" != set; then
111  case "${enableval}" in
112    yes) newlib_atexit_dynamic_alloc=yes ;;
113    no)  newlib_atexit_dynamic_alloc=no  ;;
114    *)   AC_MSG_ERROR(bad value ${enableval} for newlib-atexit-dynamic-alloc option) ;;
115  esac
116 fi], [newlib_atexit_dynamic_alloc=${newlib_atexit_dynamic_alloc}])dnl
117
118dnl Support --enable-newlib-global-atexit
119dnl Enable atexit data structure as global variables to save memory usage in
120dnl _reent.
121AC_ARG_ENABLE(newlib-global-atexit,
122[  --enable-newlib-global-atexit	enable atexit data structure as global],
123[if test "${newlib_global_atexit+set}" != set; then
124  case "${enableval}" in
125    yes) newlib_global_atexit=yes ;;
126    no)  newlib_global_atexit=no  ;;
127    *)   AC_MSG_ERROR(bad value ${enableval} for newlib-global-atexit option) ;;
128  esac
129 fi], [newlib_global_atexit=no])dnl
130
131dnl Support --enable-newlib-reent-small
132AC_ARG_ENABLE(newlib-reent-small,
133[  --enable-newlib-reent-small   enable small reentrant struct support],
134[case "${enableval}" in
135  yes) newlib_reent_small=yes;;
136  no)  newlib_reent_small=no ;;
137  *)   AC_MSG_ERROR(bad value ${enableval} for newlib-reent-small option) ;;
138 esac], [newlib_reent_small=])dnl
139
140dnl Support --disable-newlib-fvwrite-in-streamio
141AC_ARG_ENABLE(newlib-fvwrite-in-streamio,
142[  --disable-newlib-fvwrite-in-streamio    disable iov in streamio],
143[if test "${newlib_fvwrite_in_streamio+set}" != set; then
144  case "${enableval}" in
145    yes) newlib_fvwrite_in_streamio=yes ;;
146    no)  newlib_fvwrite_in_streamio=no  ;;
147    *)   AC_MSG_ERROR(bad value ${enableval} for newlib-fvwrite-in-streamio option) ;;
148  esac
149 fi], [newlib_fvwrite_in_streamio=yes])dnl
150
151dnl Support --disable-newlib-fseek-optimization
152AC_ARG_ENABLE(newlib-fseek-optimization,
153[  --disable-newlib-fseek-optimization    disable fseek optimization],
154[if test "${newlib_fseek_optimization+set}" != set; then
155  case "${enableval}" in
156    yes) newlib_fseek_optimization=yes ;;
157    no)  newlib_fseek_optimization=no  ;;
158    *)   AC_MSG_ERROR(bad value ${enableval} for newlib-fseek-optimization option) ;;
159  esac
160 fi], [newlib_fseek_optimization=yes])dnl
161
162dnl Support --enable-newlib-wide-orient
163dnl This option is also read in libc/configure.in.  It is repeated
164dnl here so that it shows up in the help text.
165AC_ARG_ENABLE(newlib_wide_orient,
166[  --disable-newlib-wide-orient    Turn off wide orientation in streamio],
167[case "${enableval}" in
168   yes) newlib_wide_orient=yes ;;
169   no)  newlib_wide_orient=no ;;
170   *) AC_MSG_ERROR(bad value ${enableval} for newlib-wide-orient) ;;
171 esac],[newlib_wide_orient=yes])
172
173dnl Support --enable-newlib-nano-malloc
174dnl This option is also read in libc/configure.in.  It is repeated
175dnl here so that it shows up in the help text.
176AC_ARG_ENABLE(newlib-nano-malloc,
177[  --enable-newlib-nano-malloc    use small-footprint nano-malloc implementation],
178[if test "${newlib_nano_malloc+set}" != set; then
179  case "${enableval}" in
180    yes) newlib_nano_malloc=yes ;;
181    no)  newlib_nano_malloc=no  ;;
182    *)   AC_MSG_ERROR(bad value ${enableval} for newlib-nano-malloc option) ;;
183  esac
184 fi], [newlib_nano_malloc=])dnl
185
186dnl Support --disable-newlib-unbuf-stream-opt
187AC_ARG_ENABLE(newlib-unbuf-stream-opt,
188[  --disable-newlib-unbuf-stream-opt    disable unbuffered stream optimization in streamio],
189[if test "${newlib_unbuf_stream_opt+set}" != set; then
190  case "${enableval}" in
191    yes) newlib_unbuf_stream_opt=yes ;;
192    no)  newlib_unbuf_stream_opt=no  ;;
193    *)   AC_MSG_ERROR(bad value ${enableval} for newlib-unbuf-stream-opt option) ;;
194  esac
195 fi], [newlib_unbuf_stream_opt=yes])dnl
196
197dnl Support --enable-lite-exit
198dnl Lite exit is a size-reduced implementation of exit that doesn't invoke
199dnl clean-up functions such as _fini or global destructors.
200AC_ARG_ENABLE(lite-exit,
201[  --enable-lite-exit	enable light weight exit],
202[if test "${lite_exit+set}" != set; then
203  case "${enableval}" in
204    yes) lite_exit=yes ;;
205    no)  lite_exit=no  ;;
206    *)   AC_MSG_ERROR(bad value ${enableval} for lite-exit option) ;;
207  esac
208 fi], [lite_exit=no])dnl
209
210dnl Support --enable-newlib-nano-formatted-io
211dnl This option is also read in libc/configure.in.  It is repeated
212dnl here so that it shows up in the help text.
213AC_ARG_ENABLE(newlib_nano_formatted_io,
214[  --enable-newlib-nano-formatted-io    Use nano version formatted IO],
215[case "${enableval}" in
216   yes) newlib_nano_formatted_io=yes ;;
217   no)  newlib_nano_formatted_io=no ;;
218   *) AC_MSG_ERROR(bad value ${enableval} for newlib-nano-formatted-io) ;;
219 esac],[newlib_nano_formatted_io=no])
220
221NEWLIB_CONFIGURE(.)
222
223dnl We have to enable libtool after NEWLIB_CONFIGURE because if we try and
224dnl add it into NEWLIB_CONFIGURE, executable tests are made before the first
225dnl line of the macro which fail because appropriate LDFLAGS are not set.
226_LT_DECL_SED
227_LT_PROG_ECHO_BACKSLASH
228AC_PROG_AWK
229if test "${use_libtool}" = "yes"; then
230AC_LIBTOOL_WIN32_DLL
231AM_PROG_LIBTOOL
232fi
233
234dnl The following is being disabled because the mathfp library is
235dnl not up to standard due to inaccuracies caused by some of the
236dnl floating-point algorithms used.  If you wish to work on this,
237dnl comment out the following line and uncomment out the lines
238dnl following it to re-enable the feature.
239newlib_hw_fp=false
240#AC_ARG_ENABLE(newlib_hw_fp,
241#[  --enable-newlib-hw-fp    Turn on hardware floating point math],
242#[case "${enableval}" in
243#   yes) newlib_hw_fp=true ;;
244#   no)  newlib_hw_fp=false ;;
245#   *) AC_MSG_ERROR(bad value ${enableval} for --enable-newlib-hw-fp) ;;
246# esac],[newlib_hw_fp=false])
247AM_CONDITIONAL(NEWLIB_HW_FP, test x$newlib_hw_fp = xtrue)
248
249# These get added in the top-level configure.in, except in the case where
250# newlib is being built natively.
251LIBC_INCLUDE_GREP=`echo ${CC} | grep \/libc\/include`
252abs_newlib_basedir=`cd ${newlib_basedir} && pwd`
253if test -z "${LIBC_INCLUDE_GREP}"; then
254  CC_FOR_NEWLIB="${CC} -I$PWD/targ-include -I${abs_newlib_basedir}/libc/include"
255else
256  CC_FOR_NEWLIB="${CC}"
257fi
258AC_SUBST(CC_FOR_NEWLIB)
259
260AC_CONFIG_SUBDIRS(libc)
261AC_CONFIG_SUBDIRS(libm)
262
263if test -z "${with_multisubdir}"; then
264  AC_CONFIG_SUBDIRS(doc)
265  have_doc=yes
266else
267  have_doc=
268fi
269AM_CONDITIONAL(HAVE_DOC, test x$have_doc = xyes)
270
271EXTRA_DIRS=
272case $host in
273  i[[34567]]86-pc-linux-*)
274  	AC_CONFIG_SUBDIRS(iconvdata)
275	EXTRA_DIRS=iconvdata
276	;;
277esac
278AC_SUBST(EXTRA_DIRS)
279
280CRT0=
281CRT0_DIR=
282if test "x${have_crt0}" = "xyes"; then
283  CRT0=crt0.o
284  CRT0_DIR=libc/
285fi
286AC_SUBST(CRT0)
287AC_SUBST(CRT0_DIR)
288
289CRT1=${crt1}
290CRT1_DIR=
291if test -n "${crt1_dir}"; then
292  CRT1_DIR=${crt1_dir}/
293fi
294AC_SUBST(CRT1)
295AC_SUBST(CRT1_DIR)
296
297if test -n "${libm_machine_dir}"; then
298  LIBM_MACHINE_OBJECTLIST=libm/machine/${libm_machine_dir}/objectlist.awk.in
299fi
300AC_SUBST(LIBM_MACHINE_OBJECTLIST)
301
302if test -n "${machine_dir}"; then
303  MACHINE_OBJECTLIST=libc/machine/${machine_dir}/objectlist.awk.in
304fi
305AC_SUBST(MACHINE_OBJECTLIST)
306
307if test -n "${sys_dir}"; then
308  SYS_OBJECTLIST=libc/sys/${sys_dir}/objectlist.awk.in
309fi
310AC_SUBST(SYS_OBJECTLIST)
311
312if test "${have_sys_mach_dir}" = "yes"; then
313  SYS_MACH_OBJECTLIST=libc/sys/${sys_dir}/machine/${machine_dir}/objectlist.awk.in
314fi
315AC_SUBST(SYS_MACH_OBJECTLIST)
316
317if test -n "${posix_dir}"; then
318  POSIX_OBJECTLIST=libc/${posix_dir}/objectlist.awk.in
319fi
320AC_SUBST(POSIX_OBJECTLIST)
321
322if test -n "${signal_dir}"; then
323  SIGNAL_OBJECTLIST=libc/${signal_dir}/objectlist.awk.in
324fi
325AC_SUBST(SIGNAL_OBJECTLIST)
326
327if test -n "${syscall_dir}"; then
328  SYSCALL_OBJECTLIST=libc/${syscall_dir}/objectlist.awk.in
329fi
330AC_SUBST(SYSCALL_OBJECTLIST)
331
332if test -n "${unix_dir}"; then
333  UNIX_OBJECTLIST=libc/${unix_dir}/objectlist.awk.in
334fi
335AC_SUBST(UNIX_OBJECTLIST)
336
337if test -n "${stdio64_dir}"; then
338  STDIO64_OBJECTLIST=libc/${stdio64_dir}/objectlist.awk.in
339fi
340AC_SUBST(STDIO64_OBJECTLIST)
341
342# Put a plausible default for CC_FOR_BUILD in Makefile.
343if test -z "$CC_FOR_BUILD"; then
344  CC_FOR_BUILD=gcc
345fi
346AC_SUBST(CC_FOR_BUILD)
347
348if test "${newlib_elix_level}" -gt "0"; then
349AC_DEFINE_UNQUOTED(_ELIX_LEVEL,${newlib_elix_level})
350fi
351
352if test "${newlib_io_c99_formats}" = "yes"; then
353AC_DEFINE_UNQUOTED(_WANT_IO_C99_FORMATS)
354fi
355
356if test "${newlib_register_fini}" = "yes"; then
357AC_DEFINE_UNQUOTED(_WANT_REGISTER_FINI)
358fi
359
360if test "${newlib_io_long_long}" = "yes"; then
361AC_DEFINE_UNQUOTED(_WANT_IO_LONG_LONG)
362fi
363
364if test "${newlib_io_long_double}" = "yes"; then
365AC_DEFINE_UNQUOTED(_WANT_IO_LONG_DOUBLE)
366fi
367
368if test "${newlib_io_pos_args}" = "yes"; then
369AC_DEFINE_UNQUOTED(_WANT_IO_POS_ARGS)
370fi
371
372if test "${newlib_reent_small}" = "yes"; then
373AC_DEFINE_UNQUOTED(_WANT_REENT_SMALL)
374fi
375
376if test "${newlib_mb}" = "yes"; then
377AC_DEFINE_UNQUOTED(_MB_CAPABLE)
378AC_DEFINE_UNQUOTED(_MB_LEN_MAX,8)
379else
380AC_DEFINE_UNQUOTED(_MB_LEN_MAX,1)
381fi
382
383if test "${newlib_iconv_external_ccs}" = "yes"; then
384AC_DEFINE_UNQUOTED(_ICONV_ENABLE_EXTERNAL_CCS)
385fi
386
387AC_DEFINE(_NEWLIB_VERSION,"NEWLIB_VERSION","The newlib version in string format.")
388AC_DEFINE(__NEWLIB__,NEWLIB_MAJOR_VERSION,"The newlib major version number.")
389AC_DEFINE(__NEWLIB_MINOR__,NEWLIB_MINOR_VERSION,"The newlib minor version number.")
390AC_DEFINE(__NEWLIB_PATCHLEVEL__,NEWLIB_PATCHLEVEL_VERSION,"The newlib patch level.")
391
392if test "${multilib}" = "yes"; then
393  multilib_arg="--enable-multilib"
394else
395  multilib_arg=
396fi
397
398if test "${newlib_iconv}" = "yes"; then
399AC_DEFINE_UNQUOTED(_ICONV_ENABLED,1)
400fi
401
402if test "x${newlib_iconv_external_ccs}" = "xyes"; then
403  if test "x${newlib_iconv}" = "x"; then
404      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.)
405  fi
406  AC_DEFINE_UNQUOTED(_ICONV_ENABLE_EXTERNAL_CCS,1)
407fi
408
409if test "${newlib_atexit_dynamic_alloc}" = "yes"; then
410AC_DEFINE_UNQUOTED(_ATEXIT_DYNAMIC_ALLOC)
411fi
412
413if test "${newlib_global_atexit}" = "yes"; then
414AC_DEFINE_UNQUOTED(_REENT_GLOBAL_ATEXIT)
415fi
416
417if test "${newlib_fvwrite_in_streamio}" = "yes"; then
418AC_DEFINE_UNQUOTED(_FVWRITE_IN_STREAMIO)
419fi
420
421if test "${newlib_fseek_optimization}" = "yes"; then
422AC_DEFINE_UNQUOTED(_FSEEK_OPTIMIZATION)
423fi
424
425if test "${newlib_wide_orient}" = "yes"; then
426AC_DEFINE_UNQUOTED(_WIDE_ORIENT)
427fi
428
429if test "${newlib_nano_malloc}" = "yes"; then
430AC_DEFINE_UNQUOTED(_NANO_MALLOC)
431fi
432
433if test "${newlib_unbuf_stream_opt}" = "yes"; then
434AC_DEFINE_UNQUOTED(_UNBUF_STREAM_OPT)
435fi
436
437if test "${lite_exit}" = "yes"; then
438AC_DEFINE_UNQUOTED(_LITE_EXIT)
439fi
440
441if test "${newlib_nano_formatted_io}" = "yes"; then
442AC_DEFINE_UNQUOTED(_NANO_FORMATTED_IO)
443fi
444
445dnl
446dnl Parse --enable-newlib-iconv-encodings option argument
447dnl
448
449if test "x${iconv_encodings}" != "x" \
450   || test "x${iconv_to_encodings}" != "x" \
451   || test "x${iconv_from_encodings}" != "x"; then
452  if test "x${newlib_iconv}" = "x"; then
453      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.])
454  fi
455
456  dnl Normalize encodings names and delete commas
457  iconv_encodings=`echo "${iconv_encodings}" | sed -e 's/,/ /g' -e 's/-/_/g' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
458  iconv_to_encodings=`echo "${iconv_to_encodings}" | sed -e 's/,/ /g' -e 's/-/_/g' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
459  iconv_from_encodings=`echo "${iconv_from_encodings}" | sed -e 's/,/ /g' -e 's/-/_/g' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
460
461  dnl Get the list of available encodings excluding comments
462  dnl Join line with previous if the first character is whitespace
463  available_encodings=`cat "${srcdir}/libc/iconv/encoding.aliases" | sed -e '/^#.*/d'`
464
465  dnl Check if required encodings are supported
466  dnl Convert aliases to names
467
468  dnl iconv_encodings
469  iconv_encodings1="${iconv_encodings}"
470  iconv_encodings=""
471  for encoding in ${iconv_encodings1}; do
472      result=`echo "${available_encodings}" | grep -e "\(^\| \)${encoding}\( \|\$\)"`
473      if test $? != "0"; then
474	  AC_MSG_ERROR(${encoding} is not supported - see ${srcdir}/libc/iconv/encoding.aliases file for the list of available encodings)
475      fi
476      encoding1=`echo "${result}" | sed -e 's/\(^[[^ ]]*\).*$/\1/'`
477      iconv_encodings="${iconv_encodings} ${encoding1}"
478  done
479  dnl Enable appropriate option in newlib.h
480  for encoding in ${iconv_encodings}; do
481      opt=_ICONV_TO_ENCODING_`echo "${encoding}" | sed -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
482      AC_DEFINE_UNQUOTED($opt,1)
483      opt=_ICONV_FROM_ENCODING_`echo "${encoding}" | sed -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
484      AC_DEFINE_UNQUOTED($opt,1)
485  done
486
487  dnl iconv_to_encodings
488  iconv_encodings1="${iconv_to_encodings}"
489  iconv_to_encodings=""
490  for encoding in ${iconv_encodings1}; do
491      result=`echo "${available_encodings}" | grep -e "\(^\| \)${encoding}\( \|\$\)"`
492      if test $? != "0"; then
493	  AC_MSG_ERROR(${encoding} is not supported - see ${srcdir}/libc/iconv/encoding.aliases file for the list of available encodings)
494      fi
495      encoding1=`echo "${result}" | sed -e 's/\(^[[^ ]]*\).*$/\1/'`
496      iconv_to_encodings="${iconv_to_encodings} ${encoding1}"
497  done
498  dnl Enable appropriate option in newlib.h
499  for encoding in ${iconv_to_encodings}; do
500      opt=_ICONV_TO_ENCODING_`echo "${encoding}" | sed -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
501      AC_DEFINE_UNQUOTED($opt,1)
502  done
503
504  dnl iconv_from_encodings
505  iconv_encodings1="${iconv_from_encodings}"
506  iconv_from_encodings=""
507  for encoding in ${iconv_encodings1}; do
508      result=`echo "${available_encodings}" | grep -e "\(^\| \)${encoding}\( \|\$\)"`
509      if test $? != "0"; then
510	  AC_MSG_ERROR(${encoding} is not supported - see ${srcdir}/libc/iconv/encoding.aliases file for the list of available encodings)
511      fi
512      encoding1=`echo "${result}" | sed -e 's/\(^[[^ ]]*\).*$/\1/'`
513      iconv_from_encodings="${iconv_from_encodings} ${encoding1}"
514  done
515  dnl Enable appropriate option in newlib.h
516  for encoding in ${iconv_from_encodings}; do
517      opt=_ICONV_FROM_ENCODING_`echo "${encoding}" | sed -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
518      AC_DEFINE_UNQUOTED($opt,1)
519  done
520fi;
521
522AC_CACHE_CHECK(for .preinit_array/.init_array/.fini_array support,
523	       libc_cv_initfinit_array, [dnl
524cat > conftest.c <<EOF
525int _start (void) { return 0; }
526int __start (void) { return 0; }
527int foo (void) { return 1; }
528int (*fp) (void) __attribute__ ((section (".init_array"))) = foo;
529EOF
530if AC_TRY_COMMAND([${CC} $CFLAGS $CPPFLAGS -c -o conftest conftest.c
531							1>&AS_MESSAGE_LOG_FD])
532then
533  if ${READELF} -S conftest | grep -e INIT_ARRAY > /dev/null; then
534    libc_cv_initfinit_array=yes
535  else
536    libc_cv_initfinit_array=no
537  fi
538else
539  libc_cv_initfinit_array=no
540fi
541rm -f conftest*])
542AC_SUBST(libc_cv_initfinit_array)
543if test $libc_cv_initfinit_array = yes; then
544  AC_DEFINE_UNQUOTED(HAVE_INITFINI_ARRAY)
545fi
546
547AC_CACHE_CHECK(if $CC accepts -fno-tree-loop-distribute-patterns with \
548__attribute__ ((__optimize__)), libc_cv_cc_loop_to_function, [dnl
549cat > conftest.c <<EOF
550void
551__attribute__ ((__optimize__ ("-fno-tree-loop-distribute-patterns")))
552foo (void) {}
553EOF
554libc_cv_cc_loop_to_function=no
555if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c
556			    -fno-tree-loop-distribute-patterns conftest.c])
557then
558  libc_cv_cc_loop_to_function=yes
559fi
560rm -f conftest*])
561if test $libc_cv_cc_loop_to_function = yes; then
562  AC_DEFINE(_HAVE_CC_INHIBIT_LOOP_TO_LIBCALL)
563fi
564AC_SUBST(libc_cv_cc_loop_to_function)
565
566dnl Autoconf 2.59 doesn't support the AC_TYPE_LONG_DOUBLE macro. Instead of:
567dnl   AC_TYPE_LONG_DOUBLE
568dnl   AM_CONDITIONAL(HAVE_LONG_DOUBLE, test x"$ac_cv_type_long_double" = x"yes")
569dnl we specify our own long double test.
570dnl Additionally, ac_cv_objext is broken so that AC_COMPILE_IFELSE cannot be
571dnl used, so use AC_TRY_COMMAND instead.
572AC_CACHE_CHECK(whether long double type exists,
573	       acnewlib_cv_type_long_double, [dnl
574cat > conftest.c <<EOF
575/* Check two ways:  float.h defines and direct type declaration.  */
576#include <float.h>
577#if defined(LDBL_MANT_DIG)
578  #define _HAVE_LONG_DOUBLE
579 #else
580  #error "LDBL != DBL"
581#endif
582long double test() {
583long double ld = 0.0L;
584return ld;
585}
586EOF
587if AC_TRY_COMMAND([${CC} $CFLAGS $CPPFLAGS -c -o conftest.o conftest.c
588							1>&AS_MESSAGE_LOG_FD])
589then
590  acnewlib_cv_type_long_double=yes;
591else
592  acnewlib_cv_type_long_double=no;
593fi
594rm -f conftest*])
595if test $acnewlib_cv_type_long_double = yes; then
596  AC_DEFINE_UNQUOTED(_HAVE_LONG_DOUBLE)
597fi
598AM_CONDITIONAL(HAVE_LONG_DOUBLE, test x"$acnewlib_cv_type_long_double" = x"yes")
599
600AC_CACHE_CHECK(whether long double equals double,
601	       newlib_cv_ldbl_eq_dbl, [dnl
602cat > conftest.c <<EOF
603#include <float.h>
604#if DBL_MANT_DIG == LDBL_MANT_DIG  &&  LDBL_MIN_EXP == DBL_MIN_EXP  && \
605    LDBL_MAX_EXP == DBL_MAX_EXP
606  #define _LDBL_EQ_DBL
607 #else
608  #error "LDBL != DBL"
609#endif
610EOF
611if AC_TRY_COMMAND([${CC} $CFLAGS $CPPFLAGS -c -o conftest.o conftest.c
612							1>&AS_MESSAGE_LOG_FD])
613then
614  newlib_cv_ldbl_eq_dbl=yes;
615else
616  newlib_cv_ldbl_eq_dbl=no;
617fi
618rm -f conftest*])
619if test $newlib_cv_ldbl_eq_dbl = yes; then
620  AC_DEFINE_UNQUOTED(_LDBL_EQ_DBL)
621fi
622
623AC_SUBST(CFLAGS)
624
625AC_CONFIG_FILES([Makefile],
626[if test -n "$CONFIG_FILES"; then
627  unset ac_file
628  . ${newlib_basedir}/../config-ml.in
629fi],
630srcdir=${srcdir}
631host=${host}
632with_multisubdir=${with_multisubdir}
633ac_configure_args="${multilib_arg} ${ac_configure_args}"
634CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
635newlib_basedir=${newlib_basedir}
636CC="${CC}"
637LDFLAGS="${LDFLAGS}"
638)
639AC_OUTPUT
640