1 dnl This provides configure definitions used by all the newlib
2 dnl configure.in files.
4 AC_DEFUN([DEF_NEWLIB_VERSION],
5 m4_define([NEWLIB_VERSION],[1.18.0]))
7 dnl Basic newlib configury. This calls basic introductory stuff,
8 dnl including AM_INIT_AUTOMAKE and AC_CANONICAL_HOST. It also runs
9 dnl configure.host. The only argument is the relative path to the top
12 AC_DEFUN([NEWLIB_CONFIGURE],
13 [AC_REQUIRE([DEF_NEWLIB_VERSION])
14 dnl Default to --enable-multilib
15 AC_ARG_ENABLE(multilib,
16 [ --enable-multilib build many library versions (default)],
17 [case "${enableval}" in
20 *) AC_MSG_ERROR(bad value ${enableval} for multilib option) ;;
21 esac], [multilib=yes])dnl
23 dnl Support --enable-target-optspace
24 AC_ARG_ENABLE(target-optspace,
25 [ --enable-target-optspace optimize for space],
26 [case "${enableval}" in
27 yes) target_optspace=yes ;;
28 no) target_optspace=no ;;
29 *) AC_MSG_ERROR(bad value ${enableval} for target-optspace option) ;;
30 esac], [target_optspace=])dnl
32 dnl Support --enable-malloc-debugging - currently only supported for Cygwin
33 AC_ARG_ENABLE(malloc-debugging,
34 [ --enable-malloc-debugging indicate malloc debugging requested],
35 [case "${enableval}" in
36 yes) malloc_debugging=yes ;;
37 no) malloc_debugging=no ;;
38 *) AC_MSG_ERROR(bad value ${enableval} for malloc-debugging option) ;;
39 esac], [malloc_debugging=])dnl
41 dnl Support --enable-newlib-multithread
42 AC_ARG_ENABLE(newlib-multithread,
43 [ --enable-newlib-multithread enable support for multiple threads],
44 [case "${enableval}" in
45 yes) newlib_multithread=yes ;;
46 no) newlib_multithread=no ;;
47 *) AC_MSG_ERROR(bad value ${enableval} for newlib-multithread option) ;;
48 esac], [newlib_multithread=yes])dnl
50 dnl Support --enable-newlib-iconv
51 AC_ARG_ENABLE(newlib-iconv,
52 [ --enable-newlib-iconv enable iconv library support],
53 [if test "${newlib_iconv+set}" != set; then
54 case "${enableval}" in
55 yes) newlib_iconv=yes ;;
56 no) newlib_iconv=no ;;
57 *) AC_MSG_ERROR(bad value ${enableval} for newlib-iconv option) ;;
59 fi], [newlib_iconv=${newlib_iconv}])dnl
61 dnl Support --enable-newlib-elix-level
62 AC_ARG_ENABLE(newlib-elix-level,
63 [ --enable-newlib-elix-level supply desired elix library level (1-4)],
64 [case "${enableval}" in
65 0) newlib_elix_level=0 ;;
66 1) newlib_elix_level=1 ;;
67 2) newlib_elix_level=2 ;;
68 3) newlib_elix_level=3 ;;
69 4) newlib_elix_level=4 ;;
70 *) AC_MSG_ERROR(bad value ${enableval} for newlib-elix-level option) ;;
71 esac], [newlib_elix_level=0])dnl
73 dnl Support --disable-newlib-io-float
74 AC_ARG_ENABLE(newlib-io-float,
75 [ --disable-newlib-io-float disable printf/scanf family float support],
76 [case "${enableval}" in
77 yes) newlib_io_float=yes ;;
78 no) newlib_io_float=no ;;
79 *) AC_MSG_ERROR(bad value ${enableval} for newlib-io-float option) ;;
80 esac], [newlib_io_float=yes])dnl
82 dnl Support --disable-newlib-supplied-syscalls
83 AC_ARG_ENABLE(newlib-supplied-syscalls,
84 [ --disable-newlib-supplied-syscalls disable newlib from supplying syscalls],
85 [case "${enableval}" in
86 yes) newlib_may_supply_syscalls=yes ;;
87 no) newlib_may_supply_syscalls=no ;;
88 *) AC_MSG_ERROR(bad value ${enableval} for newlib-supplied-syscalls option) ;;
89 esac], [newlib_may_supply_syscalls=yes])dnl
91 AM_CONDITIONAL(MAY_SUPPLY_SYSCALLS, test x[$]{newlib_may_supply_syscalls} = xyes)
93 dnl We may get other options which we don't document:
94 dnl --with-target-subdir, --with-multisrctop, --with-multisubdir
96 test -z "[$]{with_target_subdir}" && with_target_subdir=.
98 if test "[$]{srcdir}" = "."; then
99 if test "[$]{with_target_subdir}" != "."; then
100 newlib_basedir="[$]{srcdir}/[$]{with_multisrctop}../$1"
102 newlib_basedir="[$]{srcdir}/[$]{with_multisrctop}$1"
105 newlib_basedir="[$]{srcdir}/$1"
107 AC_SUBST(newlib_basedir)
111 AM_INIT_AUTOMAKE([cygnus no-define 1.9.5])
113 # FIXME: We temporarily define our own version of AC_PROG_CC. This is
114 # copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
115 # are probably using a cross compiler, which will not be able to fully
116 # link an executable. This should really be fixed in autoconf
119 AC_DEFUN([LIB_AC_PROG_CC_GNU],
120 [AC_CACHE_CHECK(whether we are using GNU C, ac_cv_prog_gcc,
121 [dnl The semicolon is to pacify NeXT's syntax-checking cpp.
122 cat > conftest.c <<EOF
127 if AC_TRY_COMMAND(${CC-cc} -E conftest.c) | egrep yes >/dev/null 2>&1; then
133 AC_DEFUN([LIB_AM_PROG_AS],
134 [# By default we simply use the C compiler to build assembly code.
135 AC_REQUIRE([LIB_AC_PROG_CC])
136 test "${CCAS+set}" = set || CCAS=$CC
137 test "${CCASFLAGS+set}" = set || CCASFLAGS=$CFLAGS
138 AC_ARG_VAR([CCAS], [assembler compiler command (defaults to CC)])
139 AC_ARG_VAR([CCASFLAGS], [assembler compiler flags (defaults to CFLAGS)])
142 AC_DEFUN([LIB_AC_PROG_CC],
143 [AC_BEFORE([$0], [AC_PROG_CPP])dnl
144 AC_CHECK_PROG(CC, gcc, gcc)
146 if test -z "$CC"; then
147 AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
148 test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
153 if test $ac_cv_prog_gcc = yes; then
155 dnl Check whether -g works, even if CFLAGS is set, in case the package
156 dnl plays around with CFLAGS (such as to build both debugging and
157 dnl normal versions of a library), tasteless as that idea is.
158 ac_test_CFLAGS="${CFLAGS+set}"
159 ac_save_CFLAGS="$CFLAGS"
161 if test "$ac_test_CFLAGS" = set; then
162 CFLAGS="$ac_save_CFLAGS"
163 elif test $ac_cv_prog_cc_g = yes; then
170 test "${CFLAGS+set}" = set || CFLAGS="-g"
176 AC_CHECK_TOOL(AS, as)
177 AC_CHECK_TOOL(AR, ar)
178 AC_CHECK_TOOL(RANLIB, ranlib, :)
179 AC_CHECK_TOOL(READELF, readelf, :)
183 # Hack to ensure that INSTALL won't be set to "../" with autoconf 2.13. */
184 ac_given_INSTALL=$INSTALL
189 # We need AC_EXEEXT to keep automake happy in cygnus mode. However,
190 # at least currently, we never actually build a program, so we never
191 # need to use $(EXEEXT). Moreover, the test for EXEEXT normally
192 # fails, because we are probably configuring with a cross compiler
193 # which can't create executables. So we include AC_EXEEXT to keep
194 # automake happy, but we don't execute it, since we don't care about
201 . [$]{newlib_basedir}/configure.host
203 newlib_cflags="[$]{newlib_cflags} -fno-builtin"
205 NEWLIB_CFLAGS=${newlib_cflags}
206 AC_SUBST(NEWLIB_CFLAGS)
211 AM_CONDITIONAL(ELIX_LEVEL_0, test x[$]{newlib_elix_level} = x0)
212 AM_CONDITIONAL(ELIX_LEVEL_1, test x[$]{newlib_elix_level} = x1)
213 AM_CONDITIONAL(ELIX_LEVEL_2, test x[$]{newlib_elix_level} = x2)
214 AM_CONDITIONAL(ELIX_LEVEL_3, test x[$]{newlib_elix_level} = x3)
215 AM_CONDITIONAL(ELIX_LEVEL_4, test x[$]{newlib_elix_level} = x4)
217 AM_CONDITIONAL(USE_LIBTOOL, test x[$]{use_libtool} = xyes)
219 # Hard-code OBJEXT. Normally it is set by AC_OBJEXT, but we
220 # use oext, which is set in configure.host based on the target platform.
228 AC_SUBST(libm_machine_dir)
229 AC_SUBST(machine_dir)