OSDN Git Service

2004-01-23 Artem B. Bityuckiy <abitytsky@softminecorp.com>
[pf3gnuchains/pf3gnuchains3x.git] / newlib / acinclude.m4
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
9 AC_DEFUN(NEWLIB_CONFIGURE,
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
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
38 dnl Support --enable-newlib-mb
39 AC_ARG_ENABLE(newlib-mb,
40 [  --enable-newlib-mb        enable multibyte support],
41 [case "${enableval}" in
42   yes) newlib_mb=yes ;;
43   no)  newlib_mb=no ;;
44   *)   AC_MSG_ERROR(bad value ${enableval} for newlib-mb option) ;;
45  esac], [newlib_mb=])dnl
46
47 dnl Support --enable-newlib-iconv
48 AC_ARG_ENABLE(newlib-iconv,
49 [  --enable-newlib-iconv     enable iconv library support],
50 [case "${enableval}" in
51   yes) newlib_iconv=yes ;;
52   no)  newlib_iconv=no ;;
53   *)   AC_MSG_ERROR(bad value ${enableval} for newlib-iconv option) ;;
54  esac], [newlib_iconv=])dnl
55
56 dnl Support --enable-newlib-builtin-converters
57 AC_ARG_ENABLE(newlib-builtin-converters,
58 [  --enable-newlib-builtin-converters   enable specific comma-separated list of iconv converters to be built-in],
59 [if test x${enableval} = x; then
60    AC_MSG_ERROR(bad value ${enableval} for newlib-builtin-converters option - use comma-separated list)
61  fi
62  builtin_converters=${enableval}
63  ], [builtin_converters=])dnl
64
65 dnl Support --enable-newlib-multithread
66 AC_ARG_ENABLE(newlib-multithread,
67 [  --enable-newlib-multithread        enable support for multiple threads],
68 [case "${enableval}" in
69   yes) newlib_multithread=yes ;;
70   no)  newlib_multithread=no ;;
71   *)   AC_MSG_ERROR(bad value ${enableval} for newlib-multithread option) ;;
72  esac], [newlib_multithread=yes])dnl
73
74 dnl Support --enable-newlib-elix-level
75 AC_ARG_ENABLE(newlib-elix-level,
76 [  --enable-newlib-elix-level         supply desired elix library level (1-4)],
77 [case "${enableval}" in
78   0)   newlib_elix_level=0 ;;
79   1)   newlib_elix_level=1 ;;
80   2)   newlib_elix_level=2 ;;
81   3)   newlib_elix_level=3 ;;
82   4)   newlib_elix_level=4 ;;
83   *)   AC_MSG_ERROR(bad value ${enableval} for newlib-elix-level option) ;;
84  esac], [newlib_elix_level=0])dnl
85
86 dnl Support --disable-newlib-io-float
87 AC_ARG_ENABLE(newlib-io-float,
88 [  --disable-newlib-io-float disable printf/scanf family float support],
89 [case "${enableval}" in
90   yes) newlib_io_float=yes ;;
91   no)  newlib_io_float=no ;;
92   *)   AC_MSG_ERROR(bad value ${enableval} for newlib-io-float option) ;;
93  esac], [newlib_io_float=yes])dnl
94
95 dnl Support --disable-newlib-supplied-syscalls
96 AC_ARG_ENABLE(newlib-supplied-syscalls,
97 [  --disable-newlib-supplied-syscalls disable newlib from supplying syscalls],
98 [case "${enableval}" in
99   yes) newlib_may_supply_syscalls=yes ;;
100   no)  newlib_may_supply_syscalls=no ;;
101   *)   AC_MSG_ERROR(bad value ${enableval} for newlib-supplied-syscalls option) ;;
102  esac], [newlib_may_supply_syscalls=yes])dnl
103
104 AM_CONDITIONAL(MAY_SUPPLY_SYSCALLS, test x[$]{newlib_may_supply_syscalls} = xyes)
105
106 dnl We may get other options which we don't document:
107 dnl --with-target-subdir, --with-multisrctop, --with-multisubdir
108
109 test -z "[$]{with_target_subdir}" && with_target_subdir=.
110
111 if test "[$]{srcdir}" = "."; then
112   if test "[$]{with_target_subdir}" != "."; then
113     newlib_basedir="[$]{srcdir}/[$]{with_multisrctop}../$1"
114   else
115     newlib_basedir="[$]{srcdir}/[$]{with_multisrctop}$1"
116   fi
117 else
118   newlib_basedir="[$]{srcdir}/$1"
119 fi
120 AC_SUBST(newlib_basedir)
121
122 AC_CANONICAL_SYSTEM
123
124 AM_INIT_AUTOMAKE(newlib, 1.11.0)
125
126 # FIXME: We temporarily define our own version of AC_PROG_CC.  This is
127 # copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS.  We
128 # are probably using a cross compiler, which will not be able to fully
129 # link an executable.  This should really be fixed in autoconf
130 # itself.
131
132 AC_DEFUN(LIB_AC_PROG_CC,
133 [AC_BEFORE([$0], [AC_PROG_CPP])dnl
134 AC_CHECK_PROG(CC, gcc, gcc)
135 if test -z "$CC"; then
136   AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
137   test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
138 fi
139
140 AC_PROG_CC_GNU
141
142 if test $ac_cv_prog_gcc = yes; then
143   GCC=yes
144 dnl Check whether -g works, even if CFLAGS is set, in case the package
145 dnl plays around with CFLAGS (such as to build both debugging and
146 dnl normal versions of a library), tasteless as that idea is.
147   ac_test_CFLAGS="${CFLAGS+set}"
148   ac_save_CFLAGS="$CFLAGS"
149   CFLAGS=
150   AC_PROG_CC_G
151   if test "$ac_test_CFLAGS" = set; then
152     CFLAGS="$ac_save_CFLAGS"
153   elif test $ac_cv_prog_cc_g = yes; then
154     CFLAGS="-g -O2"
155   else
156     CFLAGS="-O2"
157   fi
158 else
159   GCC=
160   test "${CFLAGS+set}" = set || CFLAGS="-g"
161 fi
162 ])
163
164 LIB_AC_PROG_CC
165
166 AC_CHECK_TOOL(AS, as)
167 AC_CHECK_TOOL(AR, ar)
168 AC_CHECK_TOOL(RANLIB, ranlib, :)
169
170 AC_PROG_INSTALL
171
172 AM_MAINTAINER_MODE
173
174 # We need AC_EXEEXT to keep automake happy in cygnus mode.  However,
175 # at least currently, we never actually build a program, so we never
176 # need to use $(EXEEXT).  Moreover, the test for EXEEXT normally
177 # fails, because we are probably configuring with a cross compiler
178 # which can't create executables.  So we include AC_EXEEXT to keep
179 # automake happy, but we don't execute it, since we don't care about
180 # the result.
181 if false; then
182   AC_EXEEXT
183 fi
184
185 . [$]{newlib_basedir}/configure.host
186
187 newlib_cflags="[$]{newlib_cflags} -fno-builtin"
188
189 NEWLIB_CFLAGS=${newlib_cflags}
190 AC_SUBST(NEWLIB_CFLAGS)
191
192 LDFLAGS=${ldflags}
193 AC_SUBST(LDFLAGS)
194
195 AM_CONDITIONAL(ELIX_LEVEL_0, test x[$]{newlib_elix_level} = x0)
196 AM_CONDITIONAL(ELIX_LEVEL_1, test x[$]{newlib_elix_level} = x1)
197 AM_CONDITIONAL(ELIX_LEVEL_2, test x[$]{newlib_elix_level} = x2)
198 AM_CONDITIONAL(ELIX_LEVEL_3, test x[$]{newlib_elix_level} = x3)
199 AM_CONDITIONAL(ELIX_LEVEL_4, test x[$]{newlib_elix_level} = x4)
200
201 AM_CONDITIONAL(USE_LIBTOOL, test x[$]{use_libtool} = xyes)
202
203 # Hard-code OBJEXT.  Normally it is set by AC_OBJEXT, but we
204 # use oext, which is set in configure.host based on the target platform.
205 OBJEXT=${oext}
206
207 AC_SUBST(OBJEXT)
208 AC_SUBST(oext)
209 AC_SUBST(aext)
210
211 AC_SUBST(libm_machine_dir)
212 AC_SUBST(machine_dir)
213 AC_SUBST(sys_dir)
214 ])