1 dnl This provides configure definitions used by all the newlib
2 dnl configure.in files.
4 AC_DEFUN([DEF_NEWLIB_MAJOR_VERSION],m4_define([NEWLIB_MAJOR_VERSION],[4]))
5 AC_DEFUN([DEF_NEWLIB_MINOR_VERSION],m4_define([NEWLIB_MINOR_VERSION],[4]))
6 AC_DEFUN([DEF_NEWLIB_PATCHLEVEL_VERSION],m4_define([NEWLIB_PATCHLEVEL_VERSION],[0]))
7 AC_DEFUN([DEF_NEWLIB_VERSION],m4_define([NEWLIB_VERSION],[NEWLIB_MAJOR_VERSION.NEWLIB_MINOR_VERSION.NEWLIB_PATCHLEVEL_VERSION]))
9 dnl Basic newlib configury. This calls basic introductory stuff,
10 dnl including AM_INIT_AUTOMAKE and AC_CANONICAL_HOST. It also runs
11 dnl configure.host. The only argument is the relative path to the top
14 AC_DEFUN([NEWLIB_CONFIGURE],
15 [AC_REQUIRE([DEF_NEWLIB_VERSION])
16 dnl Support --enable-target-optspace
17 AC_ARG_ENABLE(target-optspace,
18 [ --enable-target-optspace optimize for space],
19 [case "${enableval}" in
20 yes) target_optspace=yes ;;
21 no) target_optspace=no ;;
22 *) AC_MSG_ERROR(bad value ${enableval} for target-optspace option) ;;
23 esac], [target_optspace=])dnl
25 dnl Support --enable-malloc-debugging - currently only supported for Cygwin
26 AC_ARG_ENABLE(malloc-debugging,
27 [ --enable-malloc-debugging indicate malloc debugging requested],
28 [case "${enableval}" in
29 yes) malloc_debugging=yes ;;
30 no) malloc_debugging=no ;;
31 *) AC_MSG_ERROR(bad value ${enableval} for malloc-debugging option) ;;
32 esac], [malloc_debugging=])dnl
34 dnl Support --enable-newlib-multithread
35 AC_ARG_ENABLE(newlib-multithread,
36 [ --enable-newlib-multithread enable support for multiple threads],
37 [case "${enableval}" in
38 yes) newlib_multithread=yes ;;
39 no) newlib_multithread=no ;;
40 *) AC_MSG_ERROR(bad value ${enableval} for newlib-multithread option) ;;
41 esac], [newlib_multithread=yes])dnl
43 dnl Support --enable-newlib-iconv
44 AC_ARG_ENABLE(newlib-iconv,
45 [ --enable-newlib-iconv enable iconv library support],
46 [if test "${newlib_iconv+set}" != set; then
47 case "${enableval}" in
48 yes) newlib_iconv=yes ;;
49 no) newlib_iconv=no ;;
50 *) AC_MSG_ERROR(bad value ${enableval} for newlib-iconv option) ;;
52 fi], [newlib_iconv=${newlib_iconv}])dnl
54 dnl Support --enable-newlib-elix-level
55 AC_ARG_ENABLE(newlib-elix-level,
56 [ --enable-newlib-elix-level supply desired elix library level (1-4)],
57 [case "${enableval}" in
58 0) newlib_elix_level=0 ;;
59 1) newlib_elix_level=1 ;;
60 2) newlib_elix_level=2 ;;
61 3) newlib_elix_level=3 ;;
62 4) newlib_elix_level=4 ;;
63 *) AC_MSG_ERROR(bad value ${enableval} for newlib-elix-level option) ;;
64 esac], [newlib_elix_level=0])dnl
66 dnl Support --disable-newlib-io-float
67 AC_ARG_ENABLE(newlib-io-float,
68 [ --disable-newlib-io-float disable printf/scanf family float support],
69 [case "${enableval}" in
70 yes) newlib_io_float=yes ;;
71 no) newlib_io_float=no ;;
72 *) AC_MSG_ERROR(bad value ${enableval} for newlib-io-float option) ;;
73 esac], [newlib_io_float=yes])dnl
75 dnl Support --disable-newlib-supplied-syscalls
76 AC_ARG_ENABLE(newlib-supplied-syscalls,
77 [ --disable-newlib-supplied-syscalls disable newlib from supplying syscalls],
78 [case "${enableval}" in
79 yes) newlib_may_supply_syscalls=yes ;;
80 no) newlib_may_supply_syscalls=no ;;
81 *) AC_MSG_ERROR(bad value ${enableval} for newlib-supplied-syscalls option) ;;
82 esac], [newlib_may_supply_syscalls=yes])dnl
84 AM_CONDITIONAL(MAY_SUPPLY_SYSCALLS, test x[$]{newlib_may_supply_syscalls} = xyes)
86 dnl Support --disable-newlib-fno-builtin
87 AC_ARG_ENABLE(newlib-fno-builtin,
88 [ --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions],
89 [case "${enableval}" in
90 yes) newlib_fno_builtin=yes ;;
91 no) newlib_fno_builtin=no ;;
92 *) AC_MSG_ERROR(bad value ${enableval} for newlib-fno-builtin option) ;;
93 esac], [newlib_fno_builtin=])dnl
96 dnl We may get other options which we don't document:
97 dnl --with-target-subdir, --with-multisrctop, --with-multisubdir
99 test -z "[$]{with_target_subdir}" && with_target_subdir=.
101 if test "[$]{srcdir}" = "."; then
102 if test "[$]{with_target_subdir}" != "."; then
103 newlib_basedir="[$]{srcdir}/[$]{with_multisrctop}../$1"
105 newlib_basedir="[$]{srcdir}/[$]{with_multisrctop}$1"
108 newlib_basedir="[$]{srcdir}/$1"
110 AC_SUBST(newlib_basedir)
112 abs_newlib_basedir=`cd "${newlib_basedir}" && pwd`
113 AC_SUBST(abs_newlib_basedir)
117 AM_INIT_AUTOMAKE([foreign no-installinfo no-dist no-define subdir-objects 1.15.1])
123 AC_REQUIRE([AC_PROG_CC])dnl
124 AC_REQUIRE([AC_PROG_CPP])dnl
125 AC_REQUIRE([AM_PROG_AS])dnl
126 AC_REQUIRE([AM_PROG_AR])dnl
128 AC_CHECK_TOOL(READELF, readelf, :)
130 dnl We need these programs, but so does Automake. Require the macros to avoid
131 dnl expanding them multiple times.
132 AC_REQUIRE([AC_PROG_INSTALL])dnl
133 AC_REQUIRE([AC_PROG_AWK])dnl
135 . [$]{newlib_basedir}/configure.host
137 NEWLIB_CFLAGS=${newlib_cflags}
138 AC_SUBST(NEWLIB_CFLAGS)
140 NO_INCLUDE_LIST=${noinclude}
141 AC_SUBST(NO_INCLUDE_LIST)
143 AM_CONDITIONAL(ELIX_LEVEL_0, test x[$]{newlib_elix_level} = x0)
144 AM_CONDITIONAL(ELIX_LEVEL_1, test x[$]{newlib_elix_level} = x1)
145 AM_CONDITIONAL(ELIX_LEVEL_2, test x[$]{newlib_elix_level} = x2)
146 AM_CONDITIONAL(ELIX_LEVEL_3, test x[$]{newlib_elix_level} = x3)
147 AM_CONDITIONAL(ELIX_LEVEL_4, test x[$]{newlib_elix_level} = x4)
149 # Emit any target-specific warnings.
150 if test "x${newlib_msg_warn}" != "x"; then
151 AC_MSG_WARN([${newlib_msg_warn}])
154 # Hard-code OBJEXT. Normally it is set by AC_OBJEXT, but we
155 # use oext, which is set in configure.host based on the target platform.
161 AC_SUBST(libm_machine_dir)
162 AC_SUBST(machine_dir)
163 AC_SUBST(shared_machine_dir)