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