source: trunk/libs/newlib/src/newlib/configure.in @ 444

Last change on this file since 444 was 444, checked in by satin@…, 6 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 24.3 KB
Line 
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 --enable-newlib-global-stdio-streams
141AC_ARG_ENABLE(newlib-global-stdio-streams,
142[  --enable-newlib-global-stdio-streams   enable global stdio streams],
143[case "${enableval}" in
144  yes) newlib_global_stdio_streams=yes;;
145  no)  newlib_global_stdio_streams=no ;;
146  *)   AC_MSG_ERROR(bad value ${enableval} for newlib-global-stdio-streams option) ;;
147 esac], [newlib_global_stdio_streams=])dnl
148 
149dnl Support --disable-newlib-fvwrite-in-streamio
150AC_ARG_ENABLE(newlib-fvwrite-in-streamio,
151[  --disable-newlib-fvwrite-in-streamio    disable iov in streamio],
152[if test "${newlib_fvwrite_in_streamio+set}" != set; then
153  case "${enableval}" in
154    yes) newlib_fvwrite_in_streamio=yes ;;
155    no)  newlib_fvwrite_in_streamio=no  ;;
156    *)   AC_MSG_ERROR(bad value ${enableval} for newlib-fvwrite-in-streamio option) ;;
157  esac
158 fi], [newlib_fvwrite_in_streamio=yes])dnl
159
160dnl Support --disable-newlib-fseek-optimization
161AC_ARG_ENABLE(newlib-fseek-optimization,
162[  --disable-newlib-fseek-optimization    disable fseek optimization],
163[if test "${newlib_fseek_optimization+set}" != set; then
164  case "${enableval}" in
165    yes) newlib_fseek_optimization=yes ;;
166    no)  newlib_fseek_optimization=no  ;;
167    *)   AC_MSG_ERROR(bad value ${enableval} for newlib-fseek-optimization option) ;;
168  esac
169 fi], [newlib_fseek_optimization=yes])dnl
170 
171dnl Support --enable-newlib-wide-orient
172dnl This option is also read in libc/configure.in.  It is repeated
173dnl here so that it shows up in the help text.
174AC_ARG_ENABLE(newlib_wide_orient,
175[  --disable-newlib-wide-orient    Turn off wide orientation in streamio],
176[case "${enableval}" in
177   yes) newlib_wide_orient=yes ;;
178   no)  newlib_wide_orient=no ;;
179   *) AC_MSG_ERROR(bad value ${enableval} for newlib-wide-orient) ;;
180 esac],[newlib_wide_orient=yes])
181
182dnl Support --enable-newlib-nano-malloc
183dnl This option is also read in libc/configure.in.  It is repeated
184dnl here so that it shows up in the help text.
185AC_ARG_ENABLE(newlib-nano-malloc,
186[  --enable-newlib-nano-malloc    use small-footprint nano-malloc implementation],
187[if test "${newlib_nano_malloc+set}" != set; then
188  case "${enableval}" in
189    yes) newlib_nano_malloc=yes ;;
190    no)  newlib_nano_malloc=no  ;;
191    *)   AC_MSG_ERROR(bad value ${enableval} for newlib-nano-malloc option) ;;
192  esac
193 fi], [newlib_nano_malloc=])dnl
194
195dnl Support --disable-newlib-unbuf-stream-opt
196AC_ARG_ENABLE(newlib-unbuf-stream-opt,
197[  --disable-newlib-unbuf-stream-opt    disable unbuffered stream optimization in streamio],
198[if test "${newlib_unbuf_stream_opt+set}" != set; then
199  case "${enableval}" in
200    yes) newlib_unbuf_stream_opt=yes ;;
201    no)  newlib_unbuf_stream_opt=no  ;;
202    *)   AC_MSG_ERROR(bad value ${enableval} for newlib-unbuf-stream-opt option) ;;
203  esac
204 fi], [newlib_unbuf_stream_opt=yes])dnl
205
206dnl Support --enable-lite-exit
207dnl Lite exit is a size-reduced implementation of exit that doesn't invoke
208dnl clean-up functions such as _fini or global destructors.
209AC_ARG_ENABLE(lite-exit,
210[  --enable-lite-exit   enable light weight exit],
211[if test "${lite_exit+set}" != set; then
212  case "${enableval}" in
213    yes) lite_exit=yes ;;
214    no)  lite_exit=no  ;;
215    *)   AC_MSG_ERROR(bad value ${enableval} for lite-exit option) ;;
216  esac
217 fi], [lite_exit=no])dnl
218
219dnl Support --enable-newlib-nano-formatted-io
220dnl This option is also read in libc/configure.in.  It is repeated
221dnl here so that it shows up in the help text.
222AC_ARG_ENABLE(newlib_nano_formatted_io,
223[  --enable-newlib-nano-formatted-io    Use nano version formatted IO],
224[case "${enableval}" in
225   yes) newlib_nano_formatted_io=yes ;;
226   no)  newlib_nano_formatted_io=no ;;
227   *) AC_MSG_ERROR(bad value ${enableval} for newlib-nano-formatted-io) ;;
228 esac],[newlib_nano_formatted_io=no])
229
230dnl Support --enable-retargetable-locking
231dnl This option is also read in libc/configure.in.  It is repeated
232dnl here so that it shows up in the help text.
233AC_ARG_ENABLE(newlib-retargetable-locking,
234[  --enable-newlib-retargetable-locking    Allow locking routines to be retargeted at link time],
235[case "${enableval}" in
236   yes) newlib_retargetable_locking=yes ;;
237   no)  newlib_retargetable_locking=no ;;
238   *) AC_MSG_ERROR(bad value ${enableval} for newlib-retargetable-locking) ;;
239 esac],[newlib_retargetable_locking=no])
240
241dnl Support --enable-newlib-long-time_t
242AC_ARG_ENABLE(newlib-long-time_t,
243[  --enable-newlib-long-time_t   define time_t to long],
244[if test "${newlib_long_time_t+set}" != set; then
245  case "${enableval}" in
246    yes) newlib_long_time_t=yes ;;
247    no)  newlib_long_time_t=no  ;;
248    *)   AC_MSG_ERROR(bad value ${enableval} for newlib-long-time_t option) ;;
249  esac
250 fi], [newlib_long_time_t=no])dnl
251
252NEWLIB_CONFIGURE(.)
253
254dnl We have to enable libtool after NEWLIB_CONFIGURE because if we try and
255dnl add it into NEWLIB_CONFIGURE, executable tests are made before the first
256dnl line of the macro which fail because appropriate LDFLAGS are not set.
257_LT_DECL_SED
258_LT_PROG_ECHO_BACKSLASH
259AC_PROG_AWK
260if test "${use_libtool}" = "yes"; then
261AC_LIBTOOL_WIN32_DLL
262AM_PROG_LIBTOOL
263fi
264
265dnl The following is being disabled because the mathfp library is
266dnl not up to standard due to inaccuracies caused by some of the
267dnl floating-point algorithms used.  If you wish to work on this,
268dnl comment out the following line and uncomment out the lines
269dnl following it to re-enable the feature.
270newlib_hw_fp=false
271#AC_ARG_ENABLE(newlib_hw_fp,
272#[  --enable-newlib-hw-fp    Turn on hardware floating point math],
273#[case "${enableval}" in
274#   yes) newlib_hw_fp=true ;;
275#   no)  newlib_hw_fp=false ;;
276#   *) AC_MSG_ERROR(bad value ${enableval} for --enable-newlib-hw-fp) ;;
277# esac],[newlib_hw_fp=false])
278AM_CONDITIONAL(NEWLIB_HW_FP, test x$newlib_hw_fp = xtrue)
279
280# These get added in the top-level configure.in, except in the case where
281# newlib is being built natively.
282LIBC_INCLUDE_GREP=`echo ${CC} | grep \/libc\/include`
283abs_newlib_basedir=`cd ${newlib_basedir} && pwd`
284if test -z "${LIBC_INCLUDE_GREP}"; then
285  CC_FOR_NEWLIB="${CC} -I$PWD/targ-include -I${abs_newlib_basedir}/libc/include"
286else
287  CC_FOR_NEWLIB="${CC}"
288fi
289AC_SUBST(CC_FOR_NEWLIB)
290
291AC_CONFIG_SUBDIRS(libc)
292AC_CONFIG_SUBDIRS(libm)
293
294if test -z "${with_multisubdir}"; then
295  have_multisubdir=no
296  AC_CONFIG_SUBDIRS(doc)
297else
298  have_multisubdir=yes
299fi
300AM_CONDITIONAL(HAVE_DOC, test x$have_multisubdir = xno)
301
302# Some run-time support libraries provided by GCC (e.g. libgomp) use configure
303# checks to detect certain features, e.g. availability of thread-local storage.
304# The configure script generates a test program and tries to compile and link
305# it.  It should use target libraries and startfiles of the build tree if
306# available and not random ones from the installation prefix for this
307# procedure.  The search directories specified by -B are a bit special, see
308# for_each_path() in gcc.c of the GCC sources.  First a search is performed on
309# all search paths with the multilib directory appended (if desired), then a
310# second search is performed on demand with the base directory only.  For each
311# multilib there is a "newlib" subdirectory.  This directory is specified by a
312# -B option for the support libraries.  In order to find the newlib artifacts
313# (ctr0.o, libc.a, libg.a and libm.a) they must be located in a proper multilib
314# subdirectory withing the build directory.
315AM_CONDITIONAL(HAVE_MULTISUBDIR, test x$have_multisubdir = xyes)
316
317EXTRA_DIRS=
318case $host in
319  i[[34567]]86-pc-linux-*)
320        AC_CONFIG_SUBDIRS(iconvdata)
321        EXTRA_DIRS=iconvdata
322        ;;
323esac
324AC_SUBST(EXTRA_DIRS)
325
326CRT0=
327CRT0_DIR=
328if test "x${have_crt0}" = "xyes"; then
329  CRT0=crt0.o
330  CRT0_DIR=libc/
331fi
332AM_CONDITIONAL(HAVE_CRT0, test x$have_crt0 = xyes)
333AC_SUBST(CRT0)
334AC_SUBST(CRT0_DIR)
335
336CRT1=${crt1}
337CRT1_DIR=
338if test -n "${crt1_dir}"; then
339  CRT1_DIR=${crt1_dir}/
340fi
341AC_SUBST(CRT1)
342AC_SUBST(CRT1_DIR)
343
344if test -n "${libm_machine_dir}"; then
345  LIBM_MACHINE_OBJECTLIST=libm/machine/${libm_machine_dir}/objectlist.awk.in
346fi
347AC_SUBST(LIBM_MACHINE_OBJECTLIST)
348
349if test -n "${machine_dir}"; then
350  MACHINE_OBJECTLIST=libc/machine/${machine_dir}/objectlist.awk.in
351fi
352AC_SUBST(MACHINE_OBJECTLIST)
353
354if test -n "${sys_dir}"; then
355  SYS_OBJECTLIST=libc/sys/${sys_dir}/objectlist.awk.in
356fi
357AC_SUBST(SYS_OBJECTLIST)
358
359if test "${have_sys_mach_dir}" = "yes"; then
360  SYS_MACH_OBJECTLIST=libc/sys/${sys_dir}/machine/${machine_dir}/objectlist.awk.in
361fi
362AC_SUBST(SYS_MACH_OBJECTLIST)
363
364if test -n "${posix_dir}"; then
365  POSIX_OBJECTLIST=libc/${posix_dir}/objectlist.awk.in
366fi
367AC_SUBST(POSIX_OBJECTLIST)
368
369if test -n "${signal_dir}"; then
370  SIGNAL_OBJECTLIST=libc/${signal_dir}/objectlist.awk.in
371fi
372AC_SUBST(SIGNAL_OBJECTLIST)
373
374if test -n "${syscall_dir}"; then
375  SYSCALL_OBJECTLIST=libc/${syscall_dir}/objectlist.awk.in
376fi
377AC_SUBST(SYSCALL_OBJECTLIST)
378
379if test -n "${unix_dir}"; then
380  UNIX_OBJECTLIST=libc/${unix_dir}/objectlist.awk.in
381fi
382AC_SUBST(UNIX_OBJECTLIST)
383
384if test -n "${stdio64_dir}"; then
385  STDIO64_OBJECTLIST=libc/${stdio64_dir}/objectlist.awk.in
386fi
387AC_SUBST(STDIO64_OBJECTLIST)
388
389# Put a plausible default for CC_FOR_BUILD in Makefile.
390if test -z "$CC_FOR_BUILD"; then
391  CC_FOR_BUILD=gcc
392fi
393AC_SUBST(CC_FOR_BUILD)
394
395if test "${newlib_elix_level}" -gt "0"; then
396AC_DEFINE_UNQUOTED(_ELIX_LEVEL,${newlib_elix_level})
397fi
398
399if test "${newlib_io_c99_formats}" = "yes"; then
400AC_DEFINE_UNQUOTED(_WANT_IO_C99_FORMATS)
401fi
402
403if test "${newlib_register_fini}" = "yes"; then
404AC_DEFINE_UNQUOTED(_WANT_REGISTER_FINI)
405fi
406
407if test "${newlib_io_long_long}" = "yes"; then
408AC_DEFINE_UNQUOTED(_WANT_IO_LONG_LONG)
409fi
410
411if test "${newlib_io_long_double}" = "yes"; then
412AC_DEFINE_UNQUOTED(_WANT_IO_LONG_DOUBLE)
413fi
414
415if test "${newlib_io_pos_args}" = "yes"; then
416AC_DEFINE_UNQUOTED(_WANT_IO_POS_ARGS)
417fi
418
419if test "${newlib_reent_small}" = "yes"; then
420AC_DEFINE_UNQUOTED(_WANT_REENT_SMALL)
421fi
422
423if test "${newlib_global_stdio_streams}" = "yes"; then
424AC_DEFINE_UNQUOTED(_WANT_REENT_GLOBAL_STDIO_STREAMS)
425fi
426
427if test "${newlib_mb}" = "yes"; then
428AC_DEFINE_UNQUOTED(_MB_CAPABLE)
429AC_DEFINE_UNQUOTED(_MB_LEN_MAX,8)
430else
431AC_DEFINE_UNQUOTED(_MB_LEN_MAX,1)
432fi
433
434if test "${newlib_iconv_external_ccs}" = "yes"; then
435AC_DEFINE_UNQUOTED(_ICONV_ENABLE_EXTERNAL_CCS)
436fi
437
438AC_DEFINE(_NEWLIB_VERSION,"NEWLIB_VERSION","The newlib version in string format.")
439AC_DEFINE(__NEWLIB__,NEWLIB_MAJOR_VERSION,"The newlib major version number.")
440AC_DEFINE(__NEWLIB_MINOR__,NEWLIB_MINOR_VERSION,"The newlib minor version number.")
441AC_DEFINE(__NEWLIB_PATCHLEVEL__,NEWLIB_PATCHLEVEL_VERSION,"The newlib patch level.")
442
443if test "${multilib}" = "yes"; then
444  multilib_arg="--enable-multilib"
445else
446  multilib_arg=
447fi
448
449if test "${newlib_iconv}" = "yes"; then
450AC_DEFINE_UNQUOTED(_ICONV_ENABLED,1)
451fi
452
453if test "x${newlib_iconv_external_ccs}" = "xyes"; then
454  if test "x${newlib_iconv}" = "x"; then
455      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.)
456  fi
457  AC_DEFINE_UNQUOTED(_ICONV_ENABLE_EXTERNAL_CCS,1)
458fi
459
460if test "${newlib_atexit_dynamic_alloc}" = "yes"; then
461AC_DEFINE_UNQUOTED(_ATEXIT_DYNAMIC_ALLOC)
462fi
463
464if test "${newlib_global_atexit}" = "yes"; then
465AC_DEFINE_UNQUOTED(_REENT_GLOBAL_ATEXIT)
466fi
467
468if test "${newlib_fvwrite_in_streamio}" = "yes"; then
469AC_DEFINE_UNQUOTED(_FVWRITE_IN_STREAMIO)
470fi
471
472if test "${newlib_fseek_optimization}" = "yes"; then
473AC_DEFINE_UNQUOTED(_FSEEK_OPTIMIZATION)
474fi
475
476if test "${newlib_wide_orient}" = "yes"; then
477AC_DEFINE_UNQUOTED(_WIDE_ORIENT)
478fi
479
480if test "${newlib_nano_malloc}" = "yes"; then
481AC_DEFINE_UNQUOTED(_NANO_MALLOC)
482fi
483
484if test "${newlib_unbuf_stream_opt}" = "yes"; then
485AC_DEFINE_UNQUOTED(_UNBUF_STREAM_OPT)
486fi
487
488if test "${lite_exit}" = "yes"; then
489AC_DEFINE_UNQUOTED(_LITE_EXIT)
490fi
491
492if test "${newlib_nano_formatted_io}" = "yes"; then
493AC_DEFINE_UNQUOTED(_NANO_FORMATTED_IO)
494fi
495
496if test "${newlib_retargetable_locking}" = "yes"; then
497AC_DEFINE_UNQUOTED(_RETARGETABLE_LOCKING)
498fi
499
500if test "${newlib_long_time_t}" = "yes"; then
501AC_DEFINE_UNQUOTED(_WANT_USE_LONG_TIME_T)
502fi
503
504dnl
505dnl Parse --enable-newlib-iconv-encodings option argument
506dnl
507
508if test "x${iconv_encodings}" != "x" \
509   || test "x${iconv_to_encodings}" != "x" \
510   || test "x${iconv_from_encodings}" != "x"; then
511  if test "x${newlib_iconv}" = "x"; then
512      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  fi
514 
515  dnl Normalize encodings names and delete commas
516  iconv_encodings=`echo "${iconv_encodings}" | sed -e 's/,/ /g' -e 's/-/_/g' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
517  iconv_to_encodings=`echo "${iconv_to_encodings}" | sed -e 's/,/ /g' -e 's/-/_/g' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
518  iconv_from_encodings=`echo "${iconv_from_encodings}" | sed -e 's/,/ /g' -e 's/-/_/g' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
519 
520  dnl Get the list of available encodings excluding comments
521  dnl Join line with previous if the first character is whitespace
522  available_encodings=`cat "${srcdir}/libc/iconv/encoding.aliases" | sed -e '/^#.*/d'`
523 
524  dnl Check if required encodings are supported
525  dnl Convert aliases to names
526 
527  dnl iconv_encodings
528  iconv_encodings1="${iconv_encodings}"
529  iconv_encodings=""
530  for encoding in ${iconv_encodings1}; do
531      result=`echo "${available_encodings}" | grep -e "\(^\| \)${encoding}\( \|\$\)"`
532      if test $? != "0"; then
533          AC_MSG_ERROR(${encoding} is not supported - see ${srcdir}/libc/iconv/encoding.aliases file for the list of available encodings)
534      fi
535      encoding1=`echo "${result}" | sed -e 's/\(^[[^ ]]*\).*$/\1/'`
536      iconv_encodings="${iconv_encodings} ${encoding1}"
537  done
538  dnl Enable appropriate option in newlib.h
539  for encoding in ${iconv_encodings}; do
540      opt=_ICONV_TO_ENCODING_`echo "${encoding}" | sed -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
541      AC_DEFINE_UNQUOTED($opt,1)
542      opt=_ICONV_FROM_ENCODING_`echo "${encoding}" | sed -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
543      AC_DEFINE_UNQUOTED($opt,1)
544  done
545
546  dnl iconv_to_encodings
547  iconv_encodings1="${iconv_to_encodings}"
548  iconv_to_encodings=""
549  for encoding in ${iconv_encodings1}; do
550      result=`echo "${available_encodings}" | grep -e "\(^\| \)${encoding}\( \|\$\)"`
551      if test $? != "0"; then
552          AC_MSG_ERROR(${encoding} is not supported - see ${srcdir}/libc/iconv/encoding.aliases file for the list of available encodings)
553      fi
554      encoding1=`echo "${result}" | sed -e 's/\(^[[^ ]]*\).*$/\1/'`
555      iconv_to_encodings="${iconv_to_encodings} ${encoding1}"
556  done
557  dnl Enable appropriate option in newlib.h
558  for encoding in ${iconv_to_encodings}; do
559      opt=_ICONV_TO_ENCODING_`echo "${encoding}" | sed -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
560      AC_DEFINE_UNQUOTED($opt,1)
561  done
562
563  dnl iconv_from_encodings
564  iconv_encodings1="${iconv_from_encodings}"
565  iconv_from_encodings=""
566  for encoding in ${iconv_encodings1}; do
567      result=`echo "${available_encodings}" | grep -e "\(^\| \)${encoding}\( \|\$\)"`
568      if test $? != "0"; then
569          AC_MSG_ERROR(${encoding} is not supported - see ${srcdir}/libc/iconv/encoding.aliases file for the list of available encodings)
570      fi
571      encoding1=`echo "${result}" | sed -e 's/\(^[[^ ]]*\).*$/\1/'`
572      iconv_from_encodings="${iconv_from_encodings} ${encoding1}"
573  done
574  dnl Enable appropriate option in newlib.h
575  for encoding in ${iconv_from_encodings}; do
576      opt=_ICONV_FROM_ENCODING_`echo "${encoding}" | sed -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
577      AC_DEFINE_UNQUOTED($opt,1)
578  done
579fi;
580
581AC_CACHE_CHECK(for .preinit_array/.init_array/.fini_array support,
582               libc_cv_initfinit_array, [dnl
583cat > conftest.c <<EOF
584int _start (void) { return 0; }
585int __start (void) { return 0; }
586int foo (void) { return 1; }
587int (*fp) (void) __attribute__ ((section (".init_array"))) = foo;
588EOF
589if AC_TRY_COMMAND([${CC} $CFLAGS $CPPFLAGS -c -o conftest conftest.c
590                                                        1>&AS_MESSAGE_LOG_FD])
591then
592  if ${READELF} -S conftest | grep -e INIT_ARRAY > /dev/null; then
593    libc_cv_initfinit_array=yes
594  else
595    libc_cv_initfinit_array=no
596  fi
597else
598  libc_cv_initfinit_array=no
599fi
600rm -f conftest*])
601AC_SUBST(libc_cv_initfinit_array)
602if test $libc_cv_initfinit_array = yes; then
603  AC_DEFINE_UNQUOTED(HAVE_INITFINI_ARRAY)
604fi
605
606AC_CACHE_CHECK(if $CC accepts -fno-tree-loop-distribute-patterns with \
607__attribute__ ((__optimize__)), libc_cv_cc_loop_to_function, [dnl
608cat > conftest.c <<EOF
609void
610__attribute__ ((__optimize__ ("-fno-tree-loop-distribute-patterns")))
611foo (void) {}
612EOF
613libc_cv_cc_loop_to_function=no
614if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c
615                            -fno-tree-loop-distribute-patterns conftest.c])
616then
617  libc_cv_cc_loop_to_function=yes
618fi
619rm -f conftest*])
620if test $libc_cv_cc_loop_to_function = yes; then
621  AC_DEFINE(_HAVE_CC_INHIBIT_LOOP_TO_LIBCALL)
622fi
623AC_SUBST(libc_cv_cc_loop_to_function)
624
625dnl Autoconf 2.59 doesn't support the AC_TYPE_LONG_DOUBLE macro. Instead of:
626dnl   AC_TYPE_LONG_DOUBLE
627dnl   AM_CONDITIONAL(HAVE_LONG_DOUBLE, test x"$ac_cv_type_long_double" = x"yes")
628dnl we specify our own long double test.
629dnl Additionally, ac_cv_objext is broken so that AC_COMPILE_IFELSE cannot be
630dnl used, so use AC_TRY_COMMAND instead.
631AC_CACHE_CHECK(whether long double type exists,
632               acnewlib_cv_type_long_double, [dnl
633cat > conftest.c <<EOF
634/* Check two ways:  float.h defines and direct type declaration.  */
635#include <float.h>
636#if defined(LDBL_MANT_DIG)
637  #define _HAVE_LONG_DOUBLE
638 #else
639  #error "LDBL != DBL"
640#endif
641long double test() {
642long double ld = 0.0L;
643return ld;
644}
645EOF
646if AC_TRY_COMMAND([${CC} $CFLAGS $CPPFLAGS -c -o conftest.o conftest.c
647                                                        1>&AS_MESSAGE_LOG_FD])
648then
649  acnewlib_cv_type_long_double=yes;
650else
651  acnewlib_cv_type_long_double=no;
652fi
653rm -f conftest*])
654if test $acnewlib_cv_type_long_double = yes; then
655  AC_DEFINE_UNQUOTED(_HAVE_LONG_DOUBLE)
656fi
657AM_CONDITIONAL(HAVE_LONG_DOUBLE, test x"$acnewlib_cv_type_long_double" = x"yes")
658
659AC_CACHE_CHECK(whether long double equals double,
660               newlib_cv_ldbl_eq_dbl, [dnl
661cat > conftest.c <<EOF
662#include <float.h>
663#if DBL_MANT_DIG == LDBL_MANT_DIG  &&  LDBL_MIN_EXP == DBL_MIN_EXP  && \
664    LDBL_MAX_EXP == DBL_MAX_EXP
665  #define _LDBL_EQ_DBL
666 #else
667  #error "LDBL != DBL"
668#endif
669EOF
670if AC_TRY_COMMAND([${CC} $CFLAGS $CPPFLAGS -c -o conftest.o conftest.c
671                                                        1>&AS_MESSAGE_LOG_FD])
672then
673  newlib_cv_ldbl_eq_dbl=yes;
674else
675  newlib_cv_ldbl_eq_dbl=no;
676fi
677rm -f conftest*])
678if test $newlib_cv_ldbl_eq_dbl = yes; then
679  AC_DEFINE_UNQUOTED(_LDBL_EQ_DBL)
680fi
681
682AC_SUBST(CFLAGS)
683
684AC_CONFIG_FILES([Makefile],
685[if test -n "$CONFIG_FILES"; then
686  unset ac_file
687  . ${newlib_basedir}/../config-ml.in
688fi],
689srcdir=${srcdir}
690host=${host}
691with_multisubdir=${with_multisubdir}
692ac_configure_args="${multilib_arg} ${ac_configure_args}"
693CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
694newlib_basedir=${newlib_basedir}
695CC="${CC}"
696LDFLAGS="${LDFLAGS}"
697)
698AC_OUTPUT
Note: See TracBrowser for help on using the repository browser.