source: trunk/libs/newlib/src/newlib/acinclude.m4 @ 444

Last change on this file since 444 was 444, checked in by satin@…, 6 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 7.5 KB
Line 
1dnl This provides configure definitions used by all the newlib
2dnl configure.in files.
3
4AC_DEFUN([DEF_NEWLIB_MAJOR_VERSION],m4_define([NEWLIB_MAJOR_VERSION],[3]))
5AC_DEFUN([DEF_NEWLIB_MINOR_VERSION],m4_define([NEWLIB_MINOR_VERSION],[0]))
6AC_DEFUN([DEF_NEWLIB_PATCHLEVEL_VERSION],m4_define([NEWLIB_PATCHLEVEL_VERSION],[0]))
7AC_DEFUN([DEF_NEWLIB_VERSION],m4_define([NEWLIB_VERSION],[NEWLIB_MAJOR_VERSION.NEWLIB_MINOR_VERSION.NEWLIB_PATCHLEVEL_VERSION]))
8
9dnl Basic newlib configury.  This calls basic introductory stuff,
10dnl including AM_INIT_AUTOMAKE and AC_CANONICAL_HOST.  It also runs
11dnl configure.host.  The only argument is the relative path to the top
12dnl newlib directory.
13
14AC_DEFUN([NEWLIB_CONFIGURE],
15[AC_REQUIRE([DEF_NEWLIB_VERSION])
16dnl Default to --enable-multilib
17AC_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
25dnl Support --enable-target-optspace
26AC_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
34dnl Support --enable-malloc-debugging - currently only supported for Cygwin
35AC_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
43dnl Support --enable-newlib-multithread
44AC_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
52dnl Support --enable-newlib-iconv
53AC_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
63dnl Support --enable-newlib-elix-level
64AC_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
75dnl Support --disable-newlib-io-float
76AC_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
84dnl Support --disable-newlib-supplied-syscalls
85AC_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
93AM_CONDITIONAL(MAY_SUPPLY_SYSCALLS, test x[$]{newlib_may_supply_syscalls} = xyes)
94
95dnl We may get other options which we don't document:
96dnl --with-target-subdir, --with-multisrctop, --with-multisubdir
97
98test -z "[$]{with_target_subdir}" && with_target_subdir=.
99
100if 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
106else
107  newlib_basedir="[$]{srcdir}/$1"
108fi
109AC_SUBST(newlib_basedir)
110
111AC_CANONICAL_HOST
112
113AM_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
121AC_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.
124cat > conftest.c <<EOF
125#ifdef __GNUC__
126  yes;
127#endif
128EOF
129if AC_TRY_COMMAND(${CC-cc} -E conftest.c) | egrep yes >/dev/null 2>&1; then
130  ac_cv_prog_gcc=yes
131else
132  ac_cv_prog_gcc=no
133fi])])
134
135AC_DEFUN([LIB_AM_PROG_AS],
136[# By default we simply use the C compiler to build assembly code.
137AC_REQUIRE([LIB_AC_PROG_CC])
138test "${CCAS+set}" = set || CCAS=$CC
139test "${CCASFLAGS+set}" = set || CCASFLAGS=$CFLAGS
140AC_ARG_VAR([CCAS],      [assembler compiler command (defaults to CC)])
141AC_ARG_VAR([CCASFLAGS], [assembler compiler flags (defaults to CFLAGS)])
142])
143
144AC_DEFUN([LIB_AC_PROG_CC],
145[AC_BEFORE([$0], [AC_PROG_CPP])dnl
146AC_CHECK_PROG(CC, gcc, gcc)
147_AM_DEPENDENCIES(CC)
148if 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])
151fi
152
153LIB_AC_PROG_CC_GNU
154
155if test $ac_cv_prog_gcc = yes; then
156  GCC=yes
157dnl Check whether -g works, even if CFLAGS is set, in case the package
158dnl plays around with CFLAGS (such as to build both debugging and
159dnl 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
170else
171  GCC=
172  test "${CFLAGS+set}" = set || CFLAGS="-g"
173fi
174])
175
176LIB_AC_PROG_CC
177
178AC_CHECK_TOOL(AS, as)
179AC_CHECK_TOOL(AR, ar)
180AC_CHECK_TOOL(RANLIB, ranlib, :)
181AC_CHECK_TOOL(READELF, readelf, :)
182
183AC_PROG_INSTALL
184
185# Hack to ensure that INSTALL won't be set to "../" with autoconf 2.13.  */
186ac_given_INSTALL=$INSTALL
187
188AM_MAINTAINER_MODE
189LIB_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.
198if false; then
199  AC_EXEEXT
200  dummy_var=1
201fi
202
203. [$]{newlib_basedir}/configure.host
204
205newlib_cflags="[$]{newlib_cflags} -fno-builtin"
206
207NEWLIB_CFLAGS=${newlib_cflags}
208AC_SUBST(NEWLIB_CFLAGS)
209
210NO_INCLUDE_LIST=${noinclude}
211AC_SUBST(NO_INCLUDE_LIST)
212
213LDFLAGS=${ldflags}
214AC_SUBST(LDFLAGS)
215
216AM_CONDITIONAL(ELIX_LEVEL_0, test x[$]{newlib_elix_level} = x0)
217AM_CONDITIONAL(ELIX_LEVEL_1, test x[$]{newlib_elix_level} = x1)
218AM_CONDITIONAL(ELIX_LEVEL_2, test x[$]{newlib_elix_level} = x2)
219AM_CONDITIONAL(ELIX_LEVEL_3, test x[$]{newlib_elix_level} = x3)
220AM_CONDITIONAL(ELIX_LEVEL_4, test x[$]{newlib_elix_level} = x4)
221
222AM_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.
226OBJEXT=${oext}
227
228AC_SUBST(OBJEXT)
229AC_SUBST(oext)
230AC_SUBST(aext)
231AC_SUBST(lpfx)
232
233AC_SUBST(libm_machine_dir)
234AC_SUBST(machine_dir)
235AC_SUBST(sys_dir)
236])
Note: See TracBrowser for help on using the repository browser.