]> sourceware.org Git - newlib-cygwin.git/blame - newlib/acinclude.m4
* spawn.cc (spawn_guts): Move ch.set() call back to where it was supposed to
[newlib-cygwin.git] / newlib / acinclude.m4
CommitLineData
8a0efa53
CF
1dnl This provides configure definitions used by all the newlib
2dnl configure.in files.
3
4dnl Basic newlib configury. This calls basic introductory stuff,
5dnl including AM_INIT_AUTOMAKE and AC_CANONICAL_HOST. It also runs
6dnl configure.host. The only argument is the relative path to the top
7dnl newlib directory.
8
34e66679 9AC_DEFUN([NEWLIB_CONFIGURE],
8a0efa53
CF
10[
11dnl Default to --enable-multilib
12AC_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
20dnl Support --enable-target-optspace
21AC_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
29dnl Support --enable-malloc-debugging - currently only supported for Cygwin
30AC_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
38dnl Support --enable-newlib-multithread
39AC_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
47dnl Support --enable-newlib-iconv
48AC_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
58dnl Support --enable-newlib-elix-level
59AC_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
70dnl Support --disable-newlib-io-float
71AC_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
79dnl Support --disable-newlib-supplied-syscalls
80AC_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
88AM_CONDITIONAL(MAY_SUPPLY_SYSCALLS, test x[$]{newlib_may_supply_syscalls} = xyes)
afecf2fa 89
8a0efa53
CF
90dnl We may get other options which we don't document:
91dnl --with-target-subdir, --with-multisrctop, --with-multisubdir
92
93test -z "[$]{with_target_subdir}" && with_target_subdir=.
94
95if 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
101else
102 newlib_basedir="[$]{srcdir}/$1"
103fi
104AC_SUBST(newlib_basedir)
105
eaa75b70 106AC_CANONICAL_SYSTEM
8a0efa53 107
3acaaf54 108AM_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
116AC_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.
119cat > conftest.c <<EOF
120#ifdef __GNUC__
121 yes;
122#endif
123EOF
124if AC_TRY_COMMAND(${CC-cc} -E conftest.c) | egrep yes >/dev/null 2>&1; then
125 ac_cv_prog_gcc=yes
126else
127 ac_cv_prog_gcc=no
128fi])])
129
130AC_DEFUN([LIB_AM_PROG_AS],
131[# By default we simply use the C compiler to build assembly code.
132AC_REQUIRE([LIB_AC_PROG_CC])
133test "${CCAS+set}" = set || CCAS=$CC
134test "${CCASFLAGS+set}" = set || CCASFLAGS=$CFLAGS
135AC_ARG_VAR([CCAS], [assembler compiler command (defaults to CC)])
136AC_ARG_VAR([CCASFLAGS], [assembler compiler flags (defaults to CFLAGS)])
137])
138
139AC_DEFUN([LIB_AC_PROG_CC],
8a0efa53
CF
140[AC_BEFORE([$0], [AC_PROG_CPP])dnl
141AC_CHECK_PROG(CC, gcc, gcc)
34e66679 142_AM_DEPENDENCIES(CC)
8a0efa53
CF
143if 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])
146fi
147
34e66679 148LIB_AC_PROG_CC_GNU
8a0efa53
CF
149
150if test $ac_cv_prog_gcc = yes; then
151 GCC=yes
152dnl Check whether -g works, even if CFLAGS is set, in case the package
153dnl plays around with CFLAGS (such as to build both debugging and
154dnl 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
166else
167 GCC=
168 test "${CFLAGS+set}" = set || CFLAGS="-g"
169fi
170])
171
172LIB_AC_PROG_CC
173
8a0efa53
CF
174AC_CHECK_TOOL(AS, as)
175AC_CHECK_TOOL(AR, ar)
176AC_CHECK_TOOL(RANLIB, ranlib, :)
177
178AC_PROG_INSTALL
179
33c9cfbd
JJ
180# Hack to ensure that INSTALL won't be set to "../" with autoconf 2.13. */
181ac_given_INSTALL=$INSTALL
182
8a0efa53 183AM_MAINTAINER_MODE
34e66679 184LIB_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.
193if false; then
194 AC_EXEEXT
34e66679 195 dummy_var=1
8a0efa53
CF
196fi
197
198. [$]{newlib_basedir}/configure.host
199
8a0efa53
CF
200newlib_cflags="[$]{newlib_cflags} -fno-builtin"
201
202NEWLIB_CFLAGS=${newlib_cflags}
203AC_SUBST(NEWLIB_CFLAGS)
204
2e1a7175
TF
205LDFLAGS=${ldflags}
206AC_SUBST(LDFLAGS)
207
90b65e2d
JJ
208AM_CONDITIONAL(ELIX_LEVEL_0, test x[$]{newlib_elix_level} = x0)
209AM_CONDITIONAL(ELIX_LEVEL_1, test x[$]{newlib_elix_level} = x1)
210AM_CONDITIONAL(ELIX_LEVEL_2, test x[$]{newlib_elix_level} = x2)
211AM_CONDITIONAL(ELIX_LEVEL_3, test x[$]{newlib_elix_level} = x3)
212AM_CONDITIONAL(ELIX_LEVEL_4, test x[$]{newlib_elix_level} = x4)
213
2e1a7175 214AM_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.
218OBJEXT=${oext}
219
220AC_SUBST(OBJEXT)
2e1a7175
TF
221AC_SUBST(oext)
222AC_SUBST(aext)
34e66679 223AC_SUBST(lpfx)
2e1a7175
TF
224
225AC_SUBST(libm_machine_dir)
8a0efa53
CF
226AC_SUBST(machine_dir)
227AC_SUBST(sys_dir)
228])
This page took 0.144561 seconds and 5 git commands to generate.