1 dnl This is the newlib configure.in file.
2 dnl Process this file with autoconf to produce a configure script.
6 AM_CONFIG_HEADER(newlib.h:newlib.hin)
8 dnl Can't be done in NEWLIB_CONFIGURE because that confuses automake.
11 dnl Support --enable-newlib-io-pos-args
12 dnl This option is actually read in libc/configure.in. It is repeated
13 dnl here so that it shows up in the help text.
14 AC_ARG_ENABLE(newlib-io-pos-args,
15 [ --enable-newlib-io-pos-args enable printf-family positional arg support],
16 [case "${enableval}" in
17 yes) newlib_io_pos_args=yes ;;
18 no) newlib_io_pos_args=no ;;
19 *) AC_MSG_ERROR(bad value ${enableval} for newlib-io-pos-args option) ;;
20 esac], [newlib_io_pos_args=no])dnl
25 dnl We have to enable libtool after NEWLIB_CONFIGURE because if we try and
26 dnl add it into NEWLIB_CONFIGURE, executable tests are made before the first
27 dnl line of the macro which fail because appropriate LDFLAGS are not set.
28 if test "${use_libtool}" = "yes"; then
34 configdirs="libc libm"
36 AC_ARG_ENABLE(newlib_hw_fp,
37 [ --enable-newlib-hw-fp Turn on hardware floating point math],
38 [case "${enableval}" in
39 yes) newlib_hw_fp=true ;;
40 no) newlib_hw_fp=false ;;
41 *) AC_MSG_ERROR(bad value ${enableval} for --enable-newlib-hw-fp) ;;
42 esac],[newlib_hw_fp=false])
43 AM_CONDITIONAL(NEWLIB_HW_FP, test x$newlib_hw_fp = xtrue)
45 if test -z "${with_multisubdir}"; then
46 configdirs="${configdirs} doc"
51 AM_CONDITIONAL(HAVE_DOC, test x$have_doc = xyes)
55 i[[34567]]86-pc-linux-*)
56 configdirs="${configdirs} iconvdata"
62 # These get added in the top-level configure.in, except in the case where
63 # newlib is being built natively.
64 LIBC_INCLUDE_GREP=`echo ${CC} | grep \/libc\/include`
65 abs_newlib_basedir=`cd ${newlib_basedir} && pwd`
66 if test -z "${LIBC_INCLUDE_GREP}"; then
67 CC_FOR_NEWLIB="${CC} -I$PWD/targ-include -I${abs_newlib_basedir}/libc/include"
71 AC_SUBST(CC_FOR_NEWLIB)
73 AC_CONFIG_SUBDIRS(${configdirs})
77 if test -n "${sys_dir}"; then
86 if test -n "${crt1_dir}"; then
92 if test -n "${libm_machine_dir}"; then
93 LIBM_MACHINE_OBJECTLIST=libm/machine/${libm_machine_dir}/objectlist.awk.in
95 AC_SUBST(LIBM_MACHINE_OBJECTLIST)
97 if test -n "${machine_dir}"; then
98 MACHINE_OBJECTLIST=libc/machine/${machine_dir}/objectlist.awk.in
100 AC_SUBST(MACHINE_OBJECTLIST)
102 if test -n "${sys_dir}"; then
103 SYS_OBJECTLIST=libc/sys/${sys_dir}/objectlist.awk.in
105 AC_SUBST(SYS_OBJECTLIST)
107 if test "${have_sys_mach_dir}" = "yes"; then
108 SYS_MACH_OBJECTLIST=libc/sys/${sys_dir}/machine/${machine_dir}/objectlist.awk.in
110 AC_SUBST(SYS_MACH_OBJECTLIST)
112 if test -n "${posix_dir}"; then
113 POSIX_OBJECTLIST=libc/${posix_dir}/objectlist.awk.in
115 AC_SUBST(POSIX_OBJECTLIST)
117 if test -n "${signal_dir}"; then
118 SIGNAL_OBJECTLIST=libc/${signal_dir}/objectlist.awk.in
120 AC_SUBST(SIGNAL_OBJECTLIST)
122 if test -n "${syscall_dir}"; then
123 SYSCALL_OBJECTLIST=libc/${syscall_dir}/objectlist.awk.in
125 AC_SUBST(SYSCALL_OBJECTLIST)
127 if test -n "${unix_dir}"; then
128 UNIX_OBJECTLIST=libc/${unix_dir}/objectlist.awk.in
130 AC_SUBST(UNIX_OBJECTLIST)
132 if test -n "${stdio64_dir}"; then
133 STDIO64_OBJECTLIST=libc/${stdio64_dir}/objectlist.awk.in
135 AC_SUBST(STDIO64_OBJECTLIST)
137 # Put a plausible default for CC_FOR_BUILD in Makefile.
138 if test -z "$CC_FOR_BUILD"; then
141 AC_SUBST(CC_FOR_BUILD)
143 if test "${newlib_elix_level}" -gt "0"; then
144 AC_DEFINE_UNQUOTED(_ELIX_LEVEL,${newlib_elix_level})
147 if test "${newlib_mb}" = "yes"; then
148 AC_DEFINE_UNQUOTED(_MB_LEN_MAX,8)
150 AC_DEFINE_UNQUOTED(_MB_LEN_MAX,1)
153 AC_DEFINE_UNQUOTED(_NEWLIB_VERSION,"$VERSION")
155 if test "${multilib}" = "yes"; then
156 multilib_arg="--enable-multilib"
161 if test "${newlib_iconv}" = "yes"; then
162 AC_DEFINE_UNQUOTED(_ICONV_ENABLED,1)
165 dnl Parse --enable-newlib-builtin-converters option argument
166 if test "x${builtin_converters}" != "x"; then
168 dnl Check that --enable-newlib-iconv was enabled
169 if test x${newlib_iconv} = x; then
170 AC_MSG_ERROR(--enable-newlib-builtin-converters option can't be used if iconv library is disabled - use --enable-newlib-iconv to enable it)
173 dnl Normalize converter names and delete commas
174 builtin_converters=`echo "${builtin_converters}" | sed -e 's/,/ /g' -e 's/-/_/g' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
176 dnl Get the list of available converters excluding comments
177 dnl Join line with previous if the first character is whitespace
178 available_converters=`cat "${srcdir}/libc/iconv/charset.aliases" | sed -e '/#/d' | sed -e 'N; s/\n //;'`
180 dnl Check if required converters are supported
181 dnl Convert aliases to "official" names
182 builtin_converters1="${builtin_converters}"
183 builtin_converters=""
184 for converter in ${builtin_converters1}; do
185 result=`echo "${available_converters}" | grep -e "\(^\| \)${converter}\( \|\$\)"`
186 if test $? != "0"; then
187 AC_MSG_ERROR(${converter} is not supported - see ${srcdir}/libc/iconv/charset.aliases file for the list of available converters)
189 converter1=`echo "${result}" | sed -e 's/\(^[[^ ]]*\).*$/\1/'`
190 builtin_converters="${builtin_converters} ${converter1}"
193 dnl Enable appropriate option in newlib.h
194 for converter in ${builtin_converters}; do
195 opt=_ICONV_CONVERTER_`echo "${converter}" | sed -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
196 AC_DEFINE_UNQUOTED($opt,1)
201 [if test -n "$CONFIG_FILES"; then
203 . ${newlib_basedir}/../config-ml.in
208 with_multisubdir=${with_multisubdir}
209 ac_configure_args="${multilib_arg} ${ac_configure_args}"
210 CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
211 newlib_basedir=${newlib_basedir}