]>
Commit | Line | Data |
---|---|---|
8a0efa53 CF |
1 | dnl This provides configure definitions used by all the newlib |
2 | dnl configure.in files. | |
3 | ||
e1b888df | 4 | AC_DEFUN([DEF_NEWLIB_VERSION], |
26b84293 | 5 | m4_define([NEWLIB_VERSION],[1.16.0])) |
7ad96224 | 6 | |
8a0efa53 CF |
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 | ||
34e66679 | 12 | AC_DEFUN([NEWLIB_CONFIGURE], |
e1b888df | 13 | [AC_REQUIRE([DEF_NEWLIB_VERSION]) |
8a0efa53 CF |
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 | ||
3ac6f3a7 JJ |
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 | ||
0c048a9a TF |
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 | ||
76ce12c3 JJ |
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 | ||
90b65e2d JJ |
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 | ||
afecf2fa JJ |
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 | ||
313f1349 JJ |
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) | |
afecf2fa | 92 | |
8a0efa53 CF |
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 | ||
7ad96224 | 109 | AC_CANONICAL_HOST |
8a0efa53 | 110 | |
7ad96224 | 111 | AM_INIT_AUTOMAKE([cygnus no-define 1.9.5]) |
8a0efa53 CF |
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 | ||
34e66679 JJ |
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], | |
8a0efa53 CF |
143 | [AC_BEFORE([$0], [AC_PROG_CPP])dnl |
144 | AC_CHECK_PROG(CC, gcc, gcc) | |
34e66679 | 145 | _AM_DEPENDENCIES(CC) |
8a0efa53 CF |
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 | ||
34e66679 | 151 | LIB_AC_PROG_CC_GNU |
8a0efa53 CF |
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 | CFLAGS= | |
34e66679 | 161 | _AC_PROG_CC_G |
8a0efa53 CF |
162 | if test "$ac_test_CFLAGS" = set; then |
163 | CFLAGS="$ac_save_CFLAGS" | |
164 | elif test $ac_cv_prog_cc_g = yes; then | |
165 | CFLAGS="-g -O2" | |
166 | else | |
167 | CFLAGS="-O2" | |
168 | fi | |
169 | else | |
170 | GCC= | |
171 | test "${CFLAGS+set}" = set || CFLAGS="-g" | |
172 | fi | |
173 | ]) | |
174 | ||
175 | LIB_AC_PROG_CC | |
176 | ||
8a0efa53 CF |
177 | AC_CHECK_TOOL(AS, as) |
178 | AC_CHECK_TOOL(AR, ar) | |
179 | AC_CHECK_TOOL(RANLIB, ranlib, :) | |
0a85d87f | 180 | AC_CHECK_TOOL(READELF, readelf, :) |
8a0efa53 CF |
181 | |
182 | AC_PROG_INSTALL | |
183 | ||
33c9cfbd JJ |
184 | # Hack to ensure that INSTALL won't be set to "../" with autoconf 2.13. */ |
185 | ac_given_INSTALL=$INSTALL | |
186 | ||
8a0efa53 | 187 | AM_MAINTAINER_MODE |
34e66679 | 188 | LIB_AM_PROG_AS |
8a0efa53 CF |
189 | |
190 | # We need AC_EXEEXT to keep automake happy in cygnus mode. However, | |
191 | # at least currently, we never actually build a program, so we never | |
192 | # need to use $(EXEEXT). Moreover, the test for EXEEXT normally | |
193 | # fails, because we are probably configuring with a cross compiler | |
194 | # which can't create executables. So we include AC_EXEEXT to keep | |
195 | # automake happy, but we don't execute it, since we don't care about | |
196 | # the result. | |
197 | if false; then | |
198 | AC_EXEEXT | |
34e66679 | 199 | dummy_var=1 |
8a0efa53 CF |
200 | fi |
201 | ||
202 | . [$]{newlib_basedir}/configure.host | |
203 | ||
8a0efa53 CF |
204 | newlib_cflags="[$]{newlib_cflags} -fno-builtin" |
205 | ||
206 | NEWLIB_CFLAGS=${newlib_cflags} | |
207 | AC_SUBST(NEWLIB_CFLAGS) | |
208 | ||
2e1a7175 TF |
209 | LDFLAGS=${ldflags} |
210 | AC_SUBST(LDFLAGS) | |
211 | ||
90b65e2d JJ |
212 | AM_CONDITIONAL(ELIX_LEVEL_0, test x[$]{newlib_elix_level} = x0) |
213 | AM_CONDITIONAL(ELIX_LEVEL_1, test x[$]{newlib_elix_level} = x1) | |
214 | AM_CONDITIONAL(ELIX_LEVEL_2, test x[$]{newlib_elix_level} = x2) | |
215 | AM_CONDITIONAL(ELIX_LEVEL_3, test x[$]{newlib_elix_level} = x3) | |
216 | AM_CONDITIONAL(ELIX_LEVEL_4, test x[$]{newlib_elix_level} = x4) | |
217 | ||
2e1a7175 | 218 | AM_CONDITIONAL(USE_LIBTOOL, test x[$]{use_libtool} = xyes) |
0953fe64 TF |
219 | |
220 | # Hard-code OBJEXT. Normally it is set by AC_OBJEXT, but we | |
221 | # use oext, which is set in configure.host based on the target platform. | |
222 | OBJEXT=${oext} | |
223 | ||
224 | AC_SUBST(OBJEXT) | |
2e1a7175 TF |
225 | AC_SUBST(oext) |
226 | AC_SUBST(aext) | |
34e66679 | 227 | AC_SUBST(lpfx) |
2e1a7175 TF |
228 | |
229 | AC_SUBST(libm_machine_dir) | |
8a0efa53 CF |
230 | AC_SUBST(machine_dir) |
231 | AC_SUBST(sys_dir) | |
232 | ]) |