| 1 |
207 |
jeremybenn |
dnl This provides configure definitions used by all the newlib
|
| 2 |
|
|
dnl configure.in files.
|
| 3 |
|
|
|
| 4 |
|
|
AC_DEFUN([DEF_NEWLIB_VERSION],
|
| 5 |
|
|
m4_define([NEWLIB_VERSION],[1.18.0]))
|
| 6 |
|
|
|
| 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
|
| 10 |
|
|
dnl newlib directory.
|
| 11 |
|
|
|
| 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
|
| 18 |
|
|
yes) multilib=yes ;;
|
| 19 |
|
|
no) multilib=no ;;
|
| 20 |
|
|
*) AC_MSG_ERROR(bad value ${enableval} for multilib option) ;;
|
| 21 |
|
|
esac], [multilib=yes])dnl
|
| 22 |
|
|
|
| 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
|
| 31 |
|
|
|
| 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
|
| 40 |
|
|
|
| 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
|
| 49 |
|
|
|
| 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) ;;
|
| 58 |
|
|
esac
|
| 59 |
|
|
fi], [newlib_iconv=${newlib_iconv}])dnl
|
| 60 |
|
|
|
| 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
|
| 72 |
|
|
|
| 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
|
| 81 |
|
|
|
| 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
|
| 90 |
|
|
|
| 91 |
|
|
AM_CONDITIONAL(MAY_SUPPLY_SYSCALLS, test x[$]{newlib_may_supply_syscalls} = xyes)
|
| 92 |
|
|
|
| 93 |
|
|
dnl We may get other options which we don't document:
|
| 94 |
|
|
dnl --with-target-subdir, --with-multisrctop, --with-multisubdir
|
| 95 |
|
|
|
| 96 |
|
|
test -z "[$]{with_target_subdir}" && with_target_subdir=.
|
| 97 |
|
|
|
| 98 |
|
|
if test "[$]{srcdir}" = "."; then
|
| 99 |
|
|
if test "[$]{with_target_subdir}" != "."; then
|
| 100 |
|
|
newlib_basedir="[$]{srcdir}/[$]{with_multisrctop}../$1"
|
| 101 |
|
|
else
|
| 102 |
|
|
newlib_basedir="[$]{srcdir}/[$]{with_multisrctop}$1"
|
| 103 |
|
|
fi
|
| 104 |
|
|
else
|
| 105 |
|
|
newlib_basedir="[$]{srcdir}/$1"
|
| 106 |
|
|
fi
|
| 107 |
|
|
AC_SUBST(newlib_basedir)
|
| 108 |
|
|
|
| 109 |
|
|
AC_CANONICAL_HOST
|
| 110 |
|
|
|
| 111 |
|
|
AM_INIT_AUTOMAKE([cygnus no-define 1.9.5])
|
| 112 |
|
|
|
| 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
|
| 117 |
|
|
# itself.
|
| 118 |
|
|
|
| 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
|
| 123 |
|
|
#ifdef __GNUC__
|
| 124 |
|
|
yes;
|
| 125 |
|
|
#endif
|
| 126 |
|
|
EOF
|
| 127 |
|
|
if AC_TRY_COMMAND(${CC-cc} -E conftest.c) | egrep yes >/dev/null 2>&1; then
|
| 128 |
|
|
ac_cv_prog_gcc=yes
|
| 129 |
|
|
else
|
| 130 |
|
|
ac_cv_prog_gcc=no
|
| 131 |
|
|
fi])])
|
| 132 |
|
|
|
| 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)])
|
| 140 |
|
|
])
|
| 141 |
|
|
|
| 142 |
|
|
AC_DEFUN([LIB_AC_PROG_CC],
|
| 143 |
|
|
[AC_BEFORE([$0], [AC_PROG_CPP])dnl
|
| 144 |
|
|
AC_CHECK_PROG(CC, gcc, gcc)
|
| 145 |
|
|
_AM_DEPENDENCIES(CC)
|
| 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])
|
| 149 |
|
|
fi
|
| 150 |
|
|
|
| 151 |
|
|
LIB_AC_PROG_CC_GNU
|
| 152 |
|
|
|
| 153 |
|
|
if test $ac_cv_prog_gcc = yes; then
|
| 154 |
|
|
GCC=yes
|
| 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"
|
| 160 |
|
|
_AC_PROG_CC_G
|
| 161 |
|
|
if test "$ac_test_CFLAGS" = set; then
|
| 162 |
|
|
CFLAGS="$ac_save_CFLAGS"
|
| 163 |
|
|
elif test $ac_cv_prog_cc_g = yes; then
|
| 164 |
|
|
CFLAGS="-g -O2"
|
| 165 |
|
|
else
|
| 166 |
|
|
CFLAGS="-O2"
|
| 167 |
|
|
fi
|
| 168 |
|
|
else
|
| 169 |
|
|
GCC=
|
| 170 |
|
|
test "${CFLAGS+set}" = set || CFLAGS="-g"
|
| 171 |
|
|
fi
|
| 172 |
|
|
])
|
| 173 |
|
|
|
| 174 |
|
|
LIB_AC_PROG_CC
|
| 175 |
|
|
|
| 176 |
|
|
AC_CHECK_TOOL(AS, as)
|
| 177 |
|
|
AC_CHECK_TOOL(AR, ar)
|
| 178 |
|
|
AC_CHECK_TOOL(RANLIB, ranlib, :)
|
| 179 |
|
|
AC_CHECK_TOOL(READELF, readelf, :)
|
| 180 |
|
|
|
| 181 |
|
|
AC_PROG_INSTALL
|
| 182 |
|
|
|
| 183 |
|
|
# Hack to ensure that INSTALL won't be set to "../" with autoconf 2.13. */
|
| 184 |
|
|
ac_given_INSTALL=$INSTALL
|
| 185 |
|
|
|
| 186 |
|
|
AM_MAINTAINER_MODE
|
| 187 |
|
|
LIB_AM_PROG_AS
|
| 188 |
|
|
|
| 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
|
| 195 |
|
|
# the result.
|
| 196 |
|
|
if false; then
|
| 197 |
|
|
AC_EXEEXT
|
| 198 |
|
|
dummy_var=1
|
| 199 |
|
|
fi
|
| 200 |
|
|
|
| 201 |
|
|
. [$]{newlib_basedir}/configure.host
|
| 202 |
|
|
|
| 203 |
|
|
newlib_cflags="[$]{newlib_cflags} -fno-builtin"
|
| 204 |
|
|
|
| 205 |
|
|
NEWLIB_CFLAGS=${newlib_cflags}
|
| 206 |
|
|
AC_SUBST(NEWLIB_CFLAGS)
|
| 207 |
|
|
|
| 208 |
|
|
LDFLAGS=${ldflags}
|
| 209 |
|
|
AC_SUBST(LDFLAGS)
|
| 210 |
|
|
|
| 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)
|
| 216 |
|
|
|
| 217 |
|
|
AM_CONDITIONAL(USE_LIBTOOL, test x[$]{use_libtool} = xyes)
|
| 218 |
|
|
|
| 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.
|
| 221 |
|
|
OBJEXT=${oext}
|
| 222 |
|
|
|
| 223 |
|
|
AC_SUBST(OBJEXT)
|
| 224 |
|
|
AC_SUBST(oext)
|
| 225 |
|
|
AC_SUBST(aext)
|
| 226 |
|
|
AC_SUBST(lpfx)
|
| 227 |
|
|
|
| 228 |
|
|
AC_SUBST(libm_machine_dir)
|
| 229 |
|
|
AC_SUBST(machine_dir)
|
| 230 |
|
|
AC_SUBST(sys_dir)
|
| 231 |
|
|
])
|