]> sourceware.org Git - newlib-cygwin.git/blame - newlib/acinclude.m4
2008-07-17 Ken Werner <ken.werner@de.ibm.com>
[newlib-cygwin.git] / newlib / acinclude.m4
CommitLineData
8a0efa53
CF
1dnl This provides configure definitions used by all the newlib
2dnl configure.in files.
3
e1b888df 4AC_DEFUN([DEF_NEWLIB_VERSION],
26b84293 5m4_define([NEWLIB_VERSION],[1.16.0]))
7ad96224 6
8a0efa53
CF
7dnl Basic newlib configury. This calls basic introductory stuff,
8dnl including AM_INIT_AUTOMAKE and AC_CANONICAL_HOST. It also runs
9dnl configure.host. The only argument is the relative path to the top
10dnl newlib directory.
11
34e66679 12AC_DEFUN([NEWLIB_CONFIGURE],
e1b888df 13[AC_REQUIRE([DEF_NEWLIB_VERSION])
8a0efa53
CF
14dnl Default to --enable-multilib
15AC_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
23dnl Support --enable-target-optspace
24AC_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
32dnl Support --enable-malloc-debugging - currently only supported for Cygwin
33AC_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
41dnl Support --enable-newlib-multithread
42AC_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
50dnl Support --enable-newlib-iconv
51AC_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
61dnl Support --enable-newlib-elix-level
62AC_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
73dnl Support --disable-newlib-io-float
74AC_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
82dnl Support --disable-newlib-supplied-syscalls
83AC_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
91AM_CONDITIONAL(MAY_SUPPLY_SYSCALLS, test x[$]{newlib_may_supply_syscalls} = xyes)
afecf2fa 92
8a0efa53
CF
93dnl We may get other options which we don't document:
94dnl --with-target-subdir, --with-multisrctop, --with-multisubdir
95
96test -z "[$]{with_target_subdir}" && with_target_subdir=.
97
98if 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
104else
105 newlib_basedir="[$]{srcdir}/$1"
106fi
107AC_SUBST(newlib_basedir)
108
7ad96224 109AC_CANONICAL_HOST
8a0efa53 110
7ad96224 111AM_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
119AC_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.
122cat > conftest.c <<EOF
123#ifdef __GNUC__
124 yes;
125#endif
126EOF
127if AC_TRY_COMMAND(${CC-cc} -E conftest.c) | egrep yes >/dev/null 2>&1; then
128 ac_cv_prog_gcc=yes
129else
130 ac_cv_prog_gcc=no
131fi])])
132
133AC_DEFUN([LIB_AM_PROG_AS],
134[# By default we simply use the C compiler to build assembly code.
135AC_REQUIRE([LIB_AC_PROG_CC])
136test "${CCAS+set}" = set || CCAS=$CC
137test "${CCASFLAGS+set}" = set || CCASFLAGS=$CFLAGS
138AC_ARG_VAR([CCAS], [assembler compiler command (defaults to CC)])
139AC_ARG_VAR([CCASFLAGS], [assembler compiler flags (defaults to CFLAGS)])
140])
141
142AC_DEFUN([LIB_AC_PROG_CC],
8a0efa53
CF
143[AC_BEFORE([$0], [AC_PROG_CPP])dnl
144AC_CHECK_PROG(CC, gcc, gcc)
34e66679 145_AM_DEPENDENCIES(CC)
8a0efa53
CF
146if 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])
149fi
150
34e66679 151LIB_AC_PROG_CC_GNU
8a0efa53
CF
152
153if test $ac_cv_prog_gcc = yes; then
154 GCC=yes
155dnl Check whether -g works, even if CFLAGS is set, in case the package
156dnl plays around with CFLAGS (such as to build both debugging and
157dnl 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
169else
170 GCC=
171 test "${CFLAGS+set}" = set || CFLAGS="-g"
172fi
173])
174
175LIB_AC_PROG_CC
176
8a0efa53
CF
177AC_CHECK_TOOL(AS, as)
178AC_CHECK_TOOL(AR, ar)
179AC_CHECK_TOOL(RANLIB, ranlib, :)
0a85d87f 180AC_CHECK_TOOL(READELF, readelf, :)
8a0efa53
CF
181
182AC_PROG_INSTALL
183
33c9cfbd
JJ
184# Hack to ensure that INSTALL won't be set to "../" with autoconf 2.13. */
185ac_given_INSTALL=$INSTALL
186
8a0efa53 187AM_MAINTAINER_MODE
34e66679 188LIB_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.
197if false; then
198 AC_EXEEXT
34e66679 199 dummy_var=1
8a0efa53
CF
200fi
201
202. [$]{newlib_basedir}/configure.host
203
8a0efa53
CF
204newlib_cflags="[$]{newlib_cflags} -fno-builtin"
205
206NEWLIB_CFLAGS=${newlib_cflags}
207AC_SUBST(NEWLIB_CFLAGS)
208
2e1a7175
TF
209LDFLAGS=${ldflags}
210AC_SUBST(LDFLAGS)
211
90b65e2d
JJ
212AM_CONDITIONAL(ELIX_LEVEL_0, test x[$]{newlib_elix_level} = x0)
213AM_CONDITIONAL(ELIX_LEVEL_1, test x[$]{newlib_elix_level} = x1)
214AM_CONDITIONAL(ELIX_LEVEL_2, test x[$]{newlib_elix_level} = x2)
215AM_CONDITIONAL(ELIX_LEVEL_3, test x[$]{newlib_elix_level} = x3)
216AM_CONDITIONAL(ELIX_LEVEL_4, test x[$]{newlib_elix_level} = x4)
217
2e1a7175 218AM_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.
222OBJEXT=${oext}
223
224AC_SUBST(OBJEXT)
2e1a7175
TF
225AC_SUBST(oext)
226AC_SUBST(aext)
34e66679 227AC_SUBST(lpfx)
2e1a7175
TF
228
229AC_SUBST(libm_machine_dir)
8a0efa53
CF
230AC_SUBST(machine_dir)
231AC_SUBST(sys_dir)
232])
This page took 0.172382 seconds and 5 git commands to generate.