]> sourceware.org Git - newlib-cygwin.git/blame - newlib/configure.in
2008-07-17 Ken Werner <ken.werner@de.ibm.com>
[newlib-cygwin.git] / newlib / configure.in
CommitLineData
8a0efa53
CF
1dnl This is the newlib configure.in file.
2dnl Process this file with autoconf to produce a configure script.
3
7ad96224
JJ
4AC_PREREQ(2.59)
5AC_INIT([newlib],[NEWLIB_VERSION])
6AC_CONFIG_SRCDIR([libc])
7AC_CONFIG_HEADER(newlib.h:newlib.hin)
8a0efa53
CF
8
9dnl Can't be done in NEWLIB_CONFIGURE because that confuses automake.
10AC_CONFIG_AUX_DIR(..)
11
037240a2
JJ
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) ;;
227e6ef6 21 esac], [newlib_io_pos_args=])dnl
037240a2 22
0962fe91
EB
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
227e6ef6
JJ
32dnl Support --enable-newlib-io-long-long
33AC_ARG_ENABLE(newlib-io-long-long,
34[ --enable-newlib-io-long-long enable long long type support in IO functions like printf/scanf],
35[case "${enableval}" in
36 yes) newlib_io_long_long=yes;;
37 no) newlib_io_long_long=no ;;
38 *) AC_MSG_ERROR(bad value ${enableval} for newlib-io-long-long option) ;;
39 esac], [newlib_io_long_long=])dnl
40
41dnl Support --enable-newlib-io-long-double
42AC_ARG_ENABLE(newlib-io-long-double,
43[ --enable-newlib-io-long-double enable long double type support in IO functions printf/scanf],
44[case "${enableval}" in
45 yes) newlib_io_long_double=yes;;
46 no) newlib_io_long_double=no ;;
47 *) AC_MSG_ERROR(bad value ${enableval} for newlib-io-long-double option) ;;
48 esac], [newlib_io_long_double=])dnl
a8615092 49
660dade3
JJ
50dnl If multibyte support is enabled, iconv should be enabled too
51dnl Support --enable-newlib-mb
52AC_ARG_ENABLE(newlib-mb,
53[ --enable-newlib-mb enable multibyte support],
54[case "${enableval}" in
76ce12c3 55 yes) newlib_mb=yes;;
660dade3
JJ
56 no) newlib_mb=no ;;
57 *) AC_MSG_ERROR(bad value ${enableval} for newlib-mb option) ;;
58 esac], [newlib_mb=])dnl
59
660dade3
JJ
60dnl Support --enable-newlib-iconv-encodings
61AC_ARG_ENABLE(newlib-iconv-encodings,
62[ --enable-newlib-iconv-encodings enable specific comma-separated list of bidirectional iconv encodings to be built-in],
63[if test x${enableval} = x; then
64 AC_MSG_ERROR(bad value ${enableval} for newlib-iconv-encodings option - use comma-separated encodings list)
65 fi
66 iconv_encodings=${enableval}
67 ], [iconv_encodings=])dnl
68
69dnl Support --enable-newlib-iconv-from-encodings
70AC_ARG_ENABLE(newlib-iconv-from-encodings,
71[ --enable-newlib-iconv-from-encodings enable specific comma-separated list of \"from\" iconv encodings to be built-in],
72[if test x${enableval} = x; then
73 AC_MSG_ERROR(bad value ${enableval} for newlib-iconv-from-encodings option - use comma-separated encodings list)
74 fi
75 iconv_from_encodings=${enableval}
76 ], [iconv_from_encodings=])dnl
77
78dnl Support --enable-newlib-iconv-to-encodings
79AC_ARG_ENABLE(newlib-iconv-to-encodings,
80[ --enable-newlib-iconv-to-encodings enable specific comma-separated list of \"to\" iconv encodings to be built-in],
81[if test x${enableval} = x; then
82 AC_MSG_ERROR(bad value ${enableval} for newlib-iconv-to-encodings option - use comma-separated encodings list)
83 fi
84 iconv_to_encodings=${enableval}
85 ], [iconv_to_encodings=])dnl
86
87dnl Support --enable-newlib-iconv-external-ccs
88AC_ARG_ENABLE(newlib-iconv-external-ccs,
89[ --enable-newlib-iconv-external-ccs enable capabilities to load external CCS files for iconv],
90[if test "${newlib_iconv_external_ccs+set}" != set; then
91 case "${enableval}" in
92 yes) newlib_iconv_external_ccs=yes ;;
93 no) newlib_iconv_external_ccs=no ;;
94 *) AC_MSG_ERROR(bad value ${enableval} for newlib-iconv-external-ccs option) ;;
95 esac
96 fi], [newlib_iconv_external_ccs=${newlib_iconv_external_ccs}])dnl
97
3078fb4f
MM
98dnl Support --disable-newlib-atexit-dynamic-alloc
99AC_ARG_ENABLE(newlib-atexit-dynamic-alloc,
100[ --disable-newlib-atexit-alloc disable dynamic allocation of atexit entries],
101[if test "${newlib_atexit_dynamic_alloc+set}" != set; then
102 case "${enableval}" in
103 yes) newlib_atexit_dynamic_alloc=yes ;;
104 no) newlib_atexit_dynamic_alloc=no ;;
105 *) AC_MSG_ERROR(bad value ${enableval} for newlib-atexit-dynamic-alloc option) ;;
106 esac
ce93dfe4 107 fi], [newlib_atexit_dynamic_alloc=${newlib_atexit_dynamic_alloc}])dnl
3078fb4f 108
826b5591
JJ
109dnl Support --enable-newlib-reent-small
110AC_ARG_ENABLE(newlib-reent-small,
111[ --enable-newlib-reent-small enable small reentrant struct support],
112[case "${enableval}" in
113 yes) newlib_reent_small=yes;;
114 no) newlib_reent_small=no ;;
115 *) AC_MSG_ERROR(bad value ${enableval} for newlib-reent-small option) ;;
116 esac], [newlib_reent_small=])dnl
117
8a0efa53
CF
118NEWLIB_CONFIGURE(.)
119
2e1a7175
TF
120dnl We have to enable libtool after NEWLIB_CONFIGURE because if we try and
121dnl add it into NEWLIB_CONFIGURE, executable tests are made before the first
122dnl line of the macro which fail because appropriate LDFLAGS are not set.
d9a1ecc0
SE
123_LT_DECL_SED
124AC_PROG_AWK
2e1a7175
TF
125if test "${use_libtool}" = "yes"; then
126AC_LIBTOOL_WIN32_DLL
127AM_PROG_LIBTOOL
2e1a7175
TF
128fi
129
8a0efa53
CF
130AC_ARG_ENABLE(newlib_hw_fp,
131[ --enable-newlib-hw-fp Turn on hardware floating point math],
132[case "${enableval}" in
133 yes) newlib_hw_fp=true ;;
134 no) newlib_hw_fp=false ;;
135 *) AC_MSG_ERROR(bad value ${enableval} for --enable-newlib-hw-fp) ;;
136 esac],[newlib_hw_fp=false])
137AM_CONDITIONAL(NEWLIB_HW_FP, test x$newlib_hw_fp = xtrue)
138
34e66679
JJ
139# These get added in the top-level configure.in, except in the case where
140# newlib is being built natively.
141LIBC_INCLUDE_GREP=`echo ${CC} | grep \/libc\/include`
142abs_newlib_basedir=`cd ${newlib_basedir} && pwd`
143if test -z "${LIBC_INCLUDE_GREP}"; then
144 CC_FOR_NEWLIB="${CC} -I$PWD/targ-include -I${abs_newlib_basedir}/libc/include"
145else
146 CC_FOR_NEWLIB="${CC}"
147fi
148AC_SUBST(CC_FOR_NEWLIB)
149
150AC_CONFIG_SUBDIRS(libc)
151AC_CONFIG_SUBDIRS(libm)
152
8a0efa53 153if test -z "${with_multisubdir}"; then
34e66679 154 AC_CONFIG_SUBDIRS(doc)
8a0efa53
CF
155 have_doc=yes
156else
157 have_doc=
158fi
159AM_CONDITIONAL(HAVE_DOC, test x$have_doc = xyes)
160
d389acba 161EXTRA_DIRS=
b359e82c 162case $host in
102861c9 163 i[[34567]]86-pc-linux-*)
34e66679 164 AC_CONFIG_SUBDIRS(iconvdata)
b359e82c
JJ
165 EXTRA_DIRS=iconvdata
166 ;;
167esac
d389acba
JJ
168AC_SUBST(EXTRA_DIRS)
169
8a0efa53
CF
170CRT0=
171CRT0_DIR=
45c8bb8f 172if test "x${have_crt0}" = "xyes"; then
8a0efa53 173 CRT0=crt0.o
5f1c13c6 174 CRT0_DIR=libc/
8a0efa53
CF
175fi
176AC_SUBST(CRT0)
177AC_SUBST(CRT0_DIR)
178
6e6cd5bd 179CRT1=${crt1}
5f1c13c6
TF
180CRT1_DIR=
181if test -n "${crt1_dir}"; then
182 CRT1_DIR=${crt1_dir}/
183fi
6e6cd5bd
JJ
184AC_SUBST(CRT1)
185AC_SUBST(CRT1_DIR)
186
2e1a7175
TF
187if test -n "${libm_machine_dir}"; then
188 LIBM_MACHINE_OBJECTLIST=libm/machine/${libm_machine_dir}/objectlist.awk.in
189fi
190AC_SUBST(LIBM_MACHINE_OBJECTLIST)
191
192if test -n "${machine_dir}"; then
193 MACHINE_OBJECTLIST=libc/machine/${machine_dir}/objectlist.awk.in
194fi
195AC_SUBST(MACHINE_OBJECTLIST)
196
197if test -n "${sys_dir}"; then
198 SYS_OBJECTLIST=libc/sys/${sys_dir}/objectlist.awk.in
199fi
200AC_SUBST(SYS_OBJECTLIST)
201
fa4a16a1
JJ
202if test "${have_sys_mach_dir}" = "yes"; then
203 SYS_MACH_OBJECTLIST=libc/sys/${sys_dir}/machine/${machine_dir}/objectlist.awk.in
204fi
205AC_SUBST(SYS_MACH_OBJECTLIST)
206
2e1a7175
TF
207if test -n "${posix_dir}"; then
208 POSIX_OBJECTLIST=libc/${posix_dir}/objectlist.awk.in
209fi
210AC_SUBST(POSIX_OBJECTLIST)
211
212if test -n "${signal_dir}"; then
213 SIGNAL_OBJECTLIST=libc/${signal_dir}/objectlist.awk.in
214fi
215AC_SUBST(SIGNAL_OBJECTLIST)
216
217if test -n "${syscall_dir}"; then
218 SYSCALL_OBJECTLIST=libc/${syscall_dir}/objectlist.awk.in
219fi
220AC_SUBST(SYSCALL_OBJECTLIST)
8a0efa53 221
2e1a7175
TF
222if test -n "${unix_dir}"; then
223 UNIX_OBJECTLIST=libc/${unix_dir}/objectlist.awk.in
224fi
225AC_SUBST(UNIX_OBJECTLIST)
8a0efa53 226
90b65e2d
JJ
227if test -n "${stdio64_dir}"; then
228 STDIO64_OBJECTLIST=libc/${stdio64_dir}/objectlist.awk.in
229fi
230AC_SUBST(STDIO64_OBJECTLIST)
231
2e1a7175
TF
232# Put a plausible default for CC_FOR_BUILD in Makefile.
233if test -z "$CC_FOR_BUILD"; then
217ad4a0 234 CC_FOR_BUILD=gcc
2e1a7175
TF
235fi
236AC_SUBST(CC_FOR_BUILD)
8a0efa53 237
8da1639b
JJ
238if test "${newlib_elix_level}" -gt "0"; then
239AC_DEFINE_UNQUOTED(_ELIX_LEVEL,${newlib_elix_level})
240fi
241
0962fe91
EB
242if test "${newlib_io_c99_formats}" = "yes"; then
243AC_DEFINE_UNQUOTED(_WANT_IO_C99_FORMATS)
244fi
245
227e6ef6
JJ
246if test "${newlib_io_long_long}" = "yes"; then
247AC_DEFINE_UNQUOTED(_WANT_IO_LONG_LONG)
248fi
249
250if test "${newlib_io_long_double}" = "yes"; then
251AC_DEFINE_UNQUOTED(_WANT_IO_LONG_DOUBLE)
252fi
253
254if test "${newlib_io_pos_args}" = "yes"; then
255AC_DEFINE_UNQUOTED(_WANT_IO_POS_ARGS)
256fi
257
826b5591
JJ
258if test "${newlib_reent_small}" = "yes"; then
259AC_DEFINE_UNQUOTED(_WANT_REENT_SMALL)
260fi
261
a8615092 262if test "${newlib_mb}" = "yes"; then
f777e3a5 263AC_DEFINE_UNQUOTED(_MB_CAPABLE)
a8615092 264AC_DEFINE_UNQUOTED(_MB_LEN_MAX,8)
786ab12c
JJ
265else
266AC_DEFINE_UNQUOTED(_MB_LEN_MAX,1)
267fi
268
660dade3
JJ
269if test "${newlib_iconv_external_ccs}" = "yes"; then
270AC_DEFINE_UNQUOTED(_ICONV_ENABLE_EXTERNAL_CCS)
271fi
272
e1b888df 273AC_DEFINE_UNQUOTED(_NEWLIB_VERSION,"NEWLIB_VERSION")
217ad4a0 274
8a0efa53
CF
275if test "${multilib}" = "yes"; then
276 multilib_arg="--enable-multilib"
277else
278 multilib_arg=
279fi
280
1a4f1aef
JJ
281if test "${newlib_iconv}" = "yes"; then
282AC_DEFINE_UNQUOTED(_ICONV_ENABLED,1)
283fi
284
660dade3
JJ
285if test "x${newlib_iconv_external_ccs}" = "xyes"; then
286 if test "x${newlib_iconv}" = "x"; then
287 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.)
288 fi
289 AC_DEFINE_UNQUOTED(_ICONV_ENABLE_EXTERNAL_CCS,1)
290fi
291
34e66679
JJ
292if test "${newlib_atexit_dynamic_alloc}" = "yes"; then
293AC_DEFINE_UNQUOTED(_ATEXIT_DYNAMIC_ALLOC)
294fi
295
660dade3
JJ
296dnl
297dnl Parse --enable-newlib-iconv-encodings option argument
298dnl
34e66679 299
660dade3
JJ
300if test "x${iconv_encodings}" != "x" \
301 || test "x${iconv_to_encodings}" != "x" \
302 || test "x${iconv_from_encodings}" != "x"; then
660dade3 303 if test "x${newlib_iconv}" = "x"; then
34e66679 304 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.])
1a4f1aef
JJ
305 fi
306
660dade3
JJ
307 dnl Normalize encodings names and delete commas
308 iconv_encodings=`echo "${iconv_encodings}" | sed -e 's/,/ /g' -e 's/-/_/g' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
309 iconv_to_encodings=`echo "${iconv_to_encodings}" | sed -e 's/,/ /g' -e 's/-/_/g' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
310 iconv_from_encodings=`echo "${iconv_from_encodings}" | sed -e 's/,/ /g' -e 's/-/_/g' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
311
312 dnl Get the list of available encodings excluding comments
1a4f1aef 313 dnl Join line with previous if the first character is whitespace
660dade3
JJ
314 available_encodings=`cat "${srcdir}/libc/iconv/encoding.aliases" | sed -e '/^#.*/d'`
315
316 dnl Check if required encodings are supported
317 dnl Convert aliases to names
318
319 dnl iconv_encodings
320 iconv_encodings1="${iconv_encodings}"
321 iconv_encodings=""
322 for encoding in ${iconv_encodings1}; do
323 result=`echo "${available_encodings}" | grep -e "\(^\| \)${encoding}\( \|\$\)"`
324 if test $? != "0"; then
0962fe91 325 AC_MSG_ERROR(${encoding} is not supported - see ${srcdir}/libc/iconv/encoding.aliases file for the list of available encodings)
660dade3
JJ
326 fi
327 encoding1=`echo "${result}" | sed -e 's/\(^[[^ ]]*\).*$/\1/'`
328 iconv_encodings="${iconv_encodings} ${encoding1}"
329 done
330 dnl Enable appropriate option in newlib.h
331 for encoding in ${iconv_encodings}; do
332 opt=_ICONV_TO_ENCODING_`echo "${encoding}" | sed -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
333 AC_DEFINE_UNQUOTED($opt,1)
334 opt=_ICONV_FROM_ENCODING_`echo "${encoding}" | sed -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
335 AC_DEFINE_UNQUOTED($opt,1)
336 done
337
338 dnl iconv_to_encodings
339 iconv_encodings1="${iconv_to_encodings}"
340 iconv_to_encodings=""
341 for encoding in ${iconv_encodings1}; do
342 result=`echo "${available_encodings}" | grep -e "\(^\| \)${encoding}\( \|\$\)"`
1a4f1aef 343 if test $? != "0"; then
0962fe91 344 AC_MSG_ERROR(${encoding} is not supported - see ${srcdir}/libc/iconv/encoding.aliases file for the list of available encodings)
1a4f1aef 345 fi
660dade3
JJ
346 encoding1=`echo "${result}" | sed -e 's/\(^[[^ ]]*\).*$/\1/'`
347 iconv_to_encodings="${iconv_to_encodings} ${encoding1}"
348 done
349 dnl Enable appropriate option in newlib.h
350 for encoding in ${iconv_to_encodings}; do
351 opt=_ICONV_TO_ENCODING_`echo "${encoding}" | sed -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
352 AC_DEFINE_UNQUOTED($opt,1)
1a4f1aef
JJ
353 done
354
660dade3
JJ
355 dnl iconv_from_encodings
356 iconv_encodings1="${iconv_from_encodings}"
357 iconv_from_encodings=""
358 for encoding in ${iconv_encodings1}; do
359 result=`echo "${available_encodings}" | grep -e "\(^\| \)${encoding}\( \|\$\)"`
360 if test $? != "0"; then
0962fe91 361 AC_MSG_ERROR(${encoding} is not supported - see ${srcdir}/libc/iconv/encoding.aliases file for the list of available encodings)
660dade3
JJ
362 fi
363 encoding1=`echo "${result}" | sed -e 's/\(^[[^ ]]*\).*$/\1/'`
364 iconv_from_encodings="${iconv_from_encodings} ${encoding1}"
365 done
1a4f1aef 366 dnl Enable appropriate option in newlib.h
660dade3
JJ
367 for encoding in ${iconv_from_encodings}; do
368 opt=_ICONV_FROM_ENCODING_`echo "${encoding}" | sed -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
1a4f1aef
JJ
369 AC_DEFINE_UNQUOTED($opt,1)
370 done
371fi;
8a0efa53 372
f7a74742
JJ
373AC_CACHE_CHECK(for .preinit_array/.init_array/.fini_array support,
374 libc_cv_initfinit_array, [dnl
375cat > conftest.c <<EOF
376int _start (void) { return 0; }
377int __start (void) { return 0; }
378int foo (void) { return 1; }
379int (*fp) (void) __attribute__ ((section (".init_array"))) = foo;
380EOF
381if AC_TRY_COMMAND([${CC} $CFLAGS $CPPFLAGS $LDFLAGS -o conftest conftest.c
382 -static -nostartfiles -nostdlib 1>&AS_MESSAGE_LOG_FD])
383then
0a85d87f 384 if ${READELF} -S conftest | grep -e INIT_ARRAY > /dev/null; then
f7a74742
JJ
385 libc_cv_initfinit_array=yes
386 else
387 libc_cv_initfinit_array=no
388 fi
389else
390 libc_cv_initfinit_array=no
391fi
392rm -f conftest*])
393AC_SUBST(libc_cv_initfinit_array)
394if test $libc_cv_initfinit_array = yes; then
395 AC_DEFINE_UNQUOTED(HAVE_INITFINI_ARRAY)
396fi
397
dd801fda
JJ
398AC_CACHE_CHECK(for array aliasing support,
399 libc_cv_array_aliasing, [dnl
400cat > conftest.c <<EOF
401char x[3] = { 'a', 'b', 'c' };
402extern char y[2] __attribute__((alias ("x+1")));
403EOF
404if AC_TRY_COMMAND([${CC} $CFLAGS $CPPFLAGS -c conftest.c
405 1>&AS_MESSAGE_LOG_FD])
406then
407 libc_cv_array_aliasing=yes
408else
409 libc_cv_array_aliasing=no
410fi
411rm -f conftest*])
412AC_SUBST(libc_cv_array_aliasing)
413if test $libc_cv_array_aliasing = yes; then
414 AC_DEFINE_UNQUOTED(_HAVE_ARRAY_ALIASING)
415fi
416
7ad96224 417AC_CONFIG_FILES([Makefile],
8a0efa53 418[if test -n "$CONFIG_FILES"; then
8da1639b 419 unset ac_file
8a0efa53
CF
420 . ${newlib_basedir}/../config-ml.in
421fi],
422srcdir=${srcdir}
423host=${host}
8a0efa53
CF
424with_multisubdir=${with_multisubdir}
425ac_configure_args="${multilib_arg} ${ac_configure_args}"
426CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
427newlib_basedir=${newlib_basedir}
428CC="${CC}"
2e1a7175 429LDFLAGS="${LDFLAGS}"
8a0efa53 430)
7ad96224 431AC_OUTPUT
This page took 0.166698 seconds and 5 git commands to generate.