1 dnl This provides configure definitions used by all the newlib
2 dnl configure.in files.
4 dnl Basic newlib configury. This calls basic introductory stuff,
5 dnl including AM_INIT_AUTOMAKE and AC_CANONICAL_HOST. It also runs
6 dnl configure.host. The only argument is the relative path to the top
9 AC_DEFUN(NEWLIB_CONFIGURE,
11 dnl Default to --enable-multilib
12 AC_ARG_ENABLE(multilib,
13 [ --enable-multilib build many library versions (default)],
14 [case "${enableval}" in
17 *) AC_MSG_ERROR(bad value ${enableval} for multilib option) ;;
18 esac], [multilib=yes])dnl
20 dnl Support --enable-target-optspace
21 AC_ARG_ENABLE(target-optspace,
22 [ --enable-target-optspace optimize for space],
23 [case "${enableval}" in
24 yes) target_optspace=yes ;;
25 no) target_optspace=no ;;
26 *) AC_MSG_ERROR(bad value ${enableval} for target-optspace option) ;;
27 esac], [target_optspace=])dnl
29 dnl Support --enable-malloc-debugging - currently only supported for Cygwin
30 AC_ARG_ENABLE(malloc-debugging,
31 [ --enable-malloc-debugging indicate malloc debugging requested],
32 [case "${enableval}" in
33 yes) malloc_debugging=yes ;;
34 no) malloc_debugging=no ;;
35 *) AC_MSG_ERROR(bad value ${enableval} for malloc-debugging option) ;;
36 esac], [malloc_debugging=])dnl
38 dnl Support --enable-newlib-mb
39 AC_ARG_ENABLE(newlib-mb,
40 [ --enable-newlib-mb enable multibyte support],
41 [case "${enableval}" in
44 *) AC_MSG_ERROR(bad value ${enableval} for newlib-mb option) ;;
45 esac], [newlib_mb=])dnl
47 dnl Support --enable-newlib-iconv
48 AC_ARG_ENABLE(newlib-iconv,
49 [ --enable-newlib-iconv enable iconv library support],
50 [case "${enableval}" in
51 yes) newlib_iconv=yes ;;
52 no) newlib_iconv=no ;;
53 *) AC_MSG_ERROR(bad value ${enableval} for newlib-iconv option) ;;
54 esac], [newlib_iconv=])dnl
56 dnl Support --enable-newlib-builtin-converters
57 AC_ARG_ENABLE(newlib-builtin-converters,
58 [ --enable-newlib-builtin-converters enable specific comma-separated list of iconv converters to be built-in],
59 [if test x${enableval} = x; then
60 AC_MSG_ERROR(bad value ${enableval} for newlib-builtin-converters option - use comma-separated list)
62 builtin_converters=${enableval}
63 ], [builtin_converters=])dnl
65 dnl Support --enable-newlib-multithread
66 AC_ARG_ENABLE(newlib-multithread,
67 [ --enable-newlib-multithread enable support for multiple threads],
68 [case "${enableval}" in
69 yes) newlib_multithread=yes ;;
70 no) newlib_multithread=no ;;
71 *) AC_MSG_ERROR(bad value ${enableval} for newlib-multithread option) ;;
72 esac], [newlib_multithread=yes])dnl
74 dnl Support --enable-newlib-elix-level
75 AC_ARG_ENABLE(newlib-elix-level,
76 [ --enable-newlib-elix-level supply desired elix library level (1-4)],
77 [case "${enableval}" in
78 0) newlib_elix_level=0 ;;
79 1) newlib_elix_level=1 ;;
80 2) newlib_elix_level=2 ;;
81 3) newlib_elix_level=3 ;;
82 4) newlib_elix_level=4 ;;
83 *) AC_MSG_ERROR(bad value ${enableval} for newlib-elix-level option) ;;
84 esac], [newlib_elix_level=0])dnl
86 dnl Support --disable-newlib-io-float
87 AC_ARG_ENABLE(newlib-io-float,
88 [ --disable-newlib-io-float disable printf/scanf family float support],
89 [case "${enableval}" in
90 yes) newlib_io_float=yes ;;
91 no) newlib_io_float=no ;;
92 *) AC_MSG_ERROR(bad value ${enableval} for newlib-io-float option) ;;
93 esac], [newlib_io_float=yes])dnl
95 dnl Support --disable-newlib-supplied-syscalls
96 AC_ARG_ENABLE(newlib-supplied-syscalls,
97 [ --disable-newlib-supplied-syscalls disable newlib from supplying syscalls],
98 [case "${enableval}" in
99 yes) newlib_may_supply_syscalls=yes ;;
100 no) newlib_may_supply_syscalls=no ;;
101 *) AC_MSG_ERROR(bad value ${enableval} for newlib-supplied-syscalls option) ;;
102 esac], [newlib_may_supply_syscalls=yes])dnl
104 AM_CONDITIONAL(MAY_SUPPLY_SYSCALLS, test x[$]{newlib_may_supply_syscalls} = xyes)
106 dnl We may get other options which we don't document:
107 dnl --with-target-subdir, --with-multisrctop, --with-multisubdir
109 test -z "[$]{with_target_subdir}" && with_target_subdir=.
111 if test "[$]{srcdir}" = "."; then
112 if test "[$]{with_target_subdir}" != "."; then
113 newlib_basedir="[$]{srcdir}/[$]{with_multisrctop}../$1"
115 newlib_basedir="[$]{srcdir}/[$]{with_multisrctop}$1"
118 newlib_basedir="[$]{srcdir}/$1"
120 AC_SUBST(newlib_basedir)
124 AM_INIT_AUTOMAKE(newlib, 1.12.0)
126 # FIXME: We temporarily define our own version of AC_PROG_CC. This is
127 # copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
128 # are probably using a cross compiler, which will not be able to fully
129 # link an executable. This should really be fixed in autoconf
132 AC_DEFUN(LIB_AC_PROG_CC,
133 [AC_BEFORE([$0], [AC_PROG_CPP])dnl
134 AC_CHECK_PROG(CC, gcc, gcc)
135 if test -z "$CC"; then
136 AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
137 test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
142 if test $ac_cv_prog_gcc = yes; then
144 dnl Check whether -g works, even if CFLAGS is set, in case the package
145 dnl plays around with CFLAGS (such as to build both debugging and
146 dnl normal versions of a library), tasteless as that idea is.
147 ac_test_CFLAGS="${CFLAGS+set}"
148 ac_save_CFLAGS="$CFLAGS"
151 if test "$ac_test_CFLAGS" = set; then
152 CFLAGS="$ac_save_CFLAGS"
153 elif test $ac_cv_prog_cc_g = yes; then
160 test "${CFLAGS+set}" = set || CFLAGS="-g"
166 AC_CHECK_TOOL(AS, as)
167 AC_CHECK_TOOL(AR, ar)
168 AC_CHECK_TOOL(RANLIB, ranlib, :)
174 # We need AC_EXEEXT to keep automake happy in cygnus mode. However,
175 # at least currently, we never actually build a program, so we never
176 # need to use $(EXEEXT). Moreover, the test for EXEEXT normally
177 # fails, because we are probably configuring with a cross compiler
178 # which can't create executables. So we include AC_EXEEXT to keep
179 # automake happy, but we don't execute it, since we don't care about
185 . [$]{newlib_basedir}/configure.host
187 newlib_cflags="[$]{newlib_cflags} -fno-builtin"
189 NEWLIB_CFLAGS=${newlib_cflags}
190 AC_SUBST(NEWLIB_CFLAGS)
195 AM_CONDITIONAL(ELIX_LEVEL_0, test x[$]{newlib_elix_level} = x0)
196 AM_CONDITIONAL(ELIX_LEVEL_1, test x[$]{newlib_elix_level} = x1)
197 AM_CONDITIONAL(ELIX_LEVEL_2, test x[$]{newlib_elix_level} = x2)
198 AM_CONDITIONAL(ELIX_LEVEL_3, test x[$]{newlib_elix_level} = x3)
199 AM_CONDITIONAL(ELIX_LEVEL_4, test x[$]{newlib_elix_level} = x4)
201 AM_CONDITIONAL(USE_LIBTOOL, test x[$]{use_libtool} = xyes)
203 # Hard-code OBJEXT. Normally it is set by AC_OBJEXT, but we
204 # use oext, which is set in configure.host based on the target platform.
211 AC_SUBST(libm_machine_dir)
212 AC_SUBST(machine_dir)