]>
Commit | Line | Data |
---|---|---|
8a0efa53 CF |
1 | dnl This provides configure definitions used by all the newlib |
2 | dnl configure.in files. | |
3 | ||
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 | |
7 | dnl newlib directory. | |
8 | ||
34e66679 | 9 | AC_DEFUN([NEWLIB_CONFIGURE], |
8a0efa53 CF |
10 | [ |
11 | dnl Default to --enable-multilib | |
12 | AC_ARG_ENABLE(multilib, | |
13 | [ --enable-multilib build many library versions (default)], | |
14 | [case "${enableval}" in | |
15 | yes) multilib=yes ;; | |
16 | no) multilib=no ;; | |
17 | *) AC_MSG_ERROR(bad value ${enableval} for multilib option) ;; | |
18 | esac], [multilib=yes])dnl | |
19 | ||
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 | |
28 | ||
3ac6f3a7 JJ |
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 | |
37 | ||
0c048a9a TF |
38 | dnl Support --enable-newlib-multithread |
39 | AC_ARG_ENABLE(newlib-multithread, | |
40 | [ --enable-newlib-multithread enable support for multiple threads], | |
41 | [case "${enableval}" in | |
42 | yes) newlib_multithread=yes ;; | |
43 | no) newlib_multithread=no ;; | |
44 | *) AC_MSG_ERROR(bad value ${enableval} for newlib-multithread option) ;; | |
45 | esac], [newlib_multithread=yes])dnl | |
46 | ||
76ce12c3 JJ |
47 | dnl Support --enable-newlib-iconv |
48 | AC_ARG_ENABLE(newlib-iconv, | |
49 | [ --enable-newlib-iconv enable iconv library support], | |
50 | [if test "${newlib_iconv+set}" != set; then | |
51 | case "${enableval}" in | |
52 | yes) newlib_iconv=yes ;; | |
53 | no) newlib_iconv=no ;; | |
54 | *) AC_MSG_ERROR(bad value ${enableval} for newlib-iconv option) ;; | |
55 | esac | |
56 | fi], [newlib_iconv=${newlib_iconv}])dnl | |
57 | ||
90b65e2d JJ |
58 | dnl Support --enable-newlib-elix-level |
59 | AC_ARG_ENABLE(newlib-elix-level, | |
60 | [ --enable-newlib-elix-level supply desired elix library level (1-4)], | |
61 | [case "${enableval}" in | |
62 | 0) newlib_elix_level=0 ;; | |
63 | 1) newlib_elix_level=1 ;; | |
64 | 2) newlib_elix_level=2 ;; | |
65 | 3) newlib_elix_level=3 ;; | |
66 | 4) newlib_elix_level=4 ;; | |
67 | *) AC_MSG_ERROR(bad value ${enableval} for newlib-elix-level option) ;; | |
68 | esac], [newlib_elix_level=0])dnl | |
69 | ||
afecf2fa JJ |
70 | dnl Support --disable-newlib-io-float |
71 | AC_ARG_ENABLE(newlib-io-float, | |
72 | [ --disable-newlib-io-float disable printf/scanf family float support], | |
73 | [case "${enableval}" in | |
74 | yes) newlib_io_float=yes ;; | |
75 | no) newlib_io_float=no ;; | |
76 | *) AC_MSG_ERROR(bad value ${enableval} for newlib-io-float option) ;; | |
77 | esac], [newlib_io_float=yes])dnl | |
78 | ||
313f1349 JJ |
79 | dnl Support --disable-newlib-supplied-syscalls |
80 | AC_ARG_ENABLE(newlib-supplied-syscalls, | |
81 | [ --disable-newlib-supplied-syscalls disable newlib from supplying syscalls], | |
82 | [case "${enableval}" in | |
83 | yes) newlib_may_supply_syscalls=yes ;; | |
84 | no) newlib_may_supply_syscalls=no ;; | |
85 | *) AC_MSG_ERROR(bad value ${enableval} for newlib-supplied-syscalls option) ;; | |
86 | esac], [newlib_may_supply_syscalls=yes])dnl | |
87 | ||
88 | AM_CONDITIONAL(MAY_SUPPLY_SYSCALLS, test x[$]{newlib_may_supply_syscalls} = xyes) | |
afecf2fa | 89 | |
8a0efa53 CF |
90 | dnl We may get other options which we don't document: |
91 | dnl --with-target-subdir, --with-multisrctop, --with-multisubdir | |
92 | ||
93 | test -z "[$]{with_target_subdir}" && with_target_subdir=. | |
94 | ||
95 | if test "[$]{srcdir}" = "."; then | |
96 | if test "[$]{with_target_subdir}" != "."; then | |
97 | newlib_basedir="[$]{srcdir}/[$]{with_multisrctop}../$1" | |
98 | else | |
99 | newlib_basedir="[$]{srcdir}/[$]{with_multisrctop}$1" | |
100 | fi | |
101 | else | |
102 | newlib_basedir="[$]{srcdir}/$1" | |
103 | fi | |
104 | AC_SUBST(newlib_basedir) | |
105 | ||
eaa75b70 | 106 | AC_CANONICAL_SYSTEM |
8a0efa53 | 107 | |
3acaaf54 | 108 | AM_INIT_AUTOMAKE(newlib, 1.14.0, nodefine) |
8a0efa53 CF |
109 | |
110 | # FIXME: We temporarily define our own version of AC_PROG_CC. This is | |
111 | # copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We | |
112 | # are probably using a cross compiler, which will not be able to fully | |
113 | # link an executable. This should really be fixed in autoconf | |
114 | # itself. | |
115 | ||
34e66679 JJ |
116 | AC_DEFUN([LIB_AC_PROG_CC_GNU], |
117 | [AC_CACHE_CHECK(whether we are using GNU C, ac_cv_prog_gcc, | |
118 | [dnl The semicolon is to pacify NeXT's syntax-checking cpp. | |
119 | cat > conftest.c <<EOF | |
120 | #ifdef __GNUC__ | |
121 | yes; | |
122 | #endif | |
123 | EOF | |
124 | if AC_TRY_COMMAND(${CC-cc} -E conftest.c) | egrep yes >/dev/null 2>&1; then | |
125 | ac_cv_prog_gcc=yes | |
126 | else | |
127 | ac_cv_prog_gcc=no | |
128 | fi])]) | |
129 | ||
130 | AC_DEFUN([LIB_AM_PROG_AS], | |
131 | [# By default we simply use the C compiler to build assembly code. | |
132 | AC_REQUIRE([LIB_AC_PROG_CC]) | |
133 | test "${CCAS+set}" = set || CCAS=$CC | |
134 | test "${CCASFLAGS+set}" = set || CCASFLAGS=$CFLAGS | |
135 | AC_ARG_VAR([CCAS], [assembler compiler command (defaults to CC)]) | |
136 | AC_ARG_VAR([CCASFLAGS], [assembler compiler flags (defaults to CFLAGS)]) | |
137 | ]) | |
138 | ||
139 | AC_DEFUN([LIB_AC_PROG_CC], | |
8a0efa53 CF |
140 | [AC_BEFORE([$0], [AC_PROG_CPP])dnl |
141 | AC_CHECK_PROG(CC, gcc, gcc) | |
34e66679 | 142 | _AM_DEPENDENCIES(CC) |
8a0efa53 CF |
143 | if test -z "$CC"; then |
144 | AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc) | |
145 | test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH]) | |
146 | fi | |
147 | ||
34e66679 | 148 | LIB_AC_PROG_CC_GNU |
8a0efa53 CF |
149 | |
150 | if test $ac_cv_prog_gcc = yes; then | |
151 | GCC=yes | |
152 | dnl Check whether -g works, even if CFLAGS is set, in case the package | |
153 | dnl plays around with CFLAGS (such as to build both debugging and | |
154 | dnl normal versions of a library), tasteless as that idea is. | |
155 | ac_test_CFLAGS="${CFLAGS+set}" | |
156 | ac_save_CFLAGS="$CFLAGS" | |
157 | CFLAGS= | |
34e66679 | 158 | _AC_PROG_CC_G |
8a0efa53 CF |
159 | if test "$ac_test_CFLAGS" = set; then |
160 | CFLAGS="$ac_save_CFLAGS" | |
161 | elif test $ac_cv_prog_cc_g = yes; then | |
162 | CFLAGS="-g -O2" | |
163 | else | |
164 | CFLAGS="-O2" | |
165 | fi | |
166 | else | |
167 | GCC= | |
168 | test "${CFLAGS+set}" = set || CFLAGS="-g" | |
169 | fi | |
170 | ]) | |
171 | ||
172 | LIB_AC_PROG_CC | |
173 | ||
8a0efa53 CF |
174 | AC_CHECK_TOOL(AS, as) |
175 | AC_CHECK_TOOL(AR, ar) | |
176 | AC_CHECK_TOOL(RANLIB, ranlib, :) | |
177 | ||
178 | AC_PROG_INSTALL | |
179 | ||
33c9cfbd JJ |
180 | # Hack to ensure that INSTALL won't be set to "../" with autoconf 2.13. */ |
181 | ac_given_INSTALL=$INSTALL | |
182 | ||
8a0efa53 | 183 | AM_MAINTAINER_MODE |
34e66679 | 184 | LIB_AM_PROG_AS |
8a0efa53 CF |
185 | |
186 | # We need AC_EXEEXT to keep automake happy in cygnus mode. However, | |
187 | # at least currently, we never actually build a program, so we never | |
188 | # need to use $(EXEEXT). Moreover, the test for EXEEXT normally | |
189 | # fails, because we are probably configuring with a cross compiler | |
190 | # which can't create executables. So we include AC_EXEEXT to keep | |
191 | # automake happy, but we don't execute it, since we don't care about | |
192 | # the result. | |
193 | if false; then | |
194 | AC_EXEEXT | |
34e66679 | 195 | dummy_var=1 |
8a0efa53 CF |
196 | fi |
197 | ||
198 | . [$]{newlib_basedir}/configure.host | |
199 | ||
8a0efa53 CF |
200 | newlib_cflags="[$]{newlib_cflags} -fno-builtin" |
201 | ||
202 | NEWLIB_CFLAGS=${newlib_cflags} | |
203 | AC_SUBST(NEWLIB_CFLAGS) | |
204 | ||
2e1a7175 TF |
205 | LDFLAGS=${ldflags} |
206 | AC_SUBST(LDFLAGS) | |
207 | ||
90b65e2d JJ |
208 | AM_CONDITIONAL(ELIX_LEVEL_0, test x[$]{newlib_elix_level} = x0) |
209 | AM_CONDITIONAL(ELIX_LEVEL_1, test x[$]{newlib_elix_level} = x1) | |
210 | AM_CONDITIONAL(ELIX_LEVEL_2, test x[$]{newlib_elix_level} = x2) | |
211 | AM_CONDITIONAL(ELIX_LEVEL_3, test x[$]{newlib_elix_level} = x3) | |
212 | AM_CONDITIONAL(ELIX_LEVEL_4, test x[$]{newlib_elix_level} = x4) | |
213 | ||
2e1a7175 | 214 | AM_CONDITIONAL(USE_LIBTOOL, test x[$]{use_libtool} = xyes) |
0953fe64 TF |
215 | |
216 | # Hard-code OBJEXT. Normally it is set by AC_OBJEXT, but we | |
217 | # use oext, which is set in configure.host based on the target platform. | |
218 | OBJEXT=${oext} | |
219 | ||
220 | AC_SUBST(OBJEXT) | |
2e1a7175 TF |
221 | AC_SUBST(oext) |
222 | AC_SUBST(aext) | |
34e66679 | 223 | AC_SUBST(lpfx) |
2e1a7175 TF |
224 | |
225 | AC_SUBST(libm_machine_dir) | |
8a0efa53 CF |
226 | AC_SUBST(machine_dir) |
227 | AC_SUBST(sys_dir) | |
228 | ]) |