]>
Commit | Line | Data |
---|---|---|
8a0efa53 CF |
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 | ||
3ac6f3a7 JJ |
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 | ||
8a0efa53 CF |
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=no])dnl | |
46 | ||
0c048a9a TF |
47 | dnl Support --enable-newlib-multithread |
48 | AC_ARG_ENABLE(newlib-multithread, | |
49 | [ --enable-newlib-multithread enable support for multiple threads], | |
50 | [case "${enableval}" in | |
51 | yes) newlib_multithread=yes ;; | |
52 | no) newlib_multithread=no ;; | |
53 | *) AC_MSG_ERROR(bad value ${enableval} for newlib-multithread option) ;; | |
54 | esac], [newlib_multithread=yes])dnl | |
55 | ||
afecf2fa JJ |
56 | dnl Support --disable-newlib-io-float |
57 | AC_ARG_ENABLE(newlib-io-float, | |
58 | [ --disable-newlib-io-float disable printf/scanf family float support], | |
59 | [case "${enableval}" in | |
60 | yes) newlib_io_float=yes ;; | |
61 | no) newlib_io_float=no ;; | |
62 | *) AC_MSG_ERROR(bad value ${enableval} for newlib-io-float option) ;; | |
63 | esac], [newlib_io_float=yes])dnl | |
64 | ||
65 | ||
8a0efa53 CF |
66 | dnl We may get other options which we don't document: |
67 | dnl --with-target-subdir, --with-multisrctop, --with-multisubdir | |
68 | ||
69 | test -z "[$]{with_target_subdir}" && with_target_subdir=. | |
70 | ||
71 | if test "[$]{srcdir}" = "."; then | |
72 | if test "[$]{with_target_subdir}" != "."; then | |
73 | newlib_basedir="[$]{srcdir}/[$]{with_multisrctop}../$1" | |
74 | else | |
75 | newlib_basedir="[$]{srcdir}/[$]{with_multisrctop}$1" | |
76 | fi | |
77 | else | |
78 | newlib_basedir="[$]{srcdir}/$1" | |
79 | fi | |
80 | AC_SUBST(newlib_basedir) | |
81 | ||
eaa75b70 | 82 | AC_CANONICAL_SYSTEM |
8a0efa53 | 83 | |
2e1a7175 | 84 | AM_INIT_AUTOMAKE(newlib, 1.10.0) |
8a0efa53 CF |
85 | |
86 | # FIXME: We temporarily define our own version of AC_PROG_CC. This is | |
87 | # copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We | |
88 | # are probably using a cross compiler, which will not be able to fully | |
89 | # link an executable. This should really be fixed in autoconf | |
90 | # itself. | |
91 | ||
92 | AC_DEFUN(LIB_AC_PROG_CC, | |
93 | [AC_BEFORE([$0], [AC_PROG_CPP])dnl | |
94 | AC_CHECK_PROG(CC, gcc, gcc) | |
95 | if test -z "$CC"; then | |
96 | AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc) | |
97 | test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH]) | |
98 | fi | |
99 | ||
100 | AC_PROG_CC_GNU | |
101 | ||
102 | if test $ac_cv_prog_gcc = yes; then | |
103 | GCC=yes | |
104 | dnl Check whether -g works, even if CFLAGS is set, in case the package | |
105 | dnl plays around with CFLAGS (such as to build both debugging and | |
106 | dnl normal versions of a library), tasteless as that idea is. | |
107 | ac_test_CFLAGS="${CFLAGS+set}" | |
108 | ac_save_CFLAGS="$CFLAGS" | |
109 | CFLAGS= | |
110 | AC_PROG_CC_G | |
111 | if test "$ac_test_CFLAGS" = set; then | |
112 | CFLAGS="$ac_save_CFLAGS" | |
113 | elif test $ac_cv_prog_cc_g = yes; then | |
114 | CFLAGS="-g -O2" | |
115 | else | |
116 | CFLAGS="-O2" | |
117 | fi | |
118 | else | |
119 | GCC= | |
120 | test "${CFLAGS+set}" = set || CFLAGS="-g" | |
121 | fi | |
122 | ]) | |
123 | ||
124 | LIB_AC_PROG_CC | |
125 | ||
8a0efa53 CF |
126 | AC_CHECK_TOOL(AS, as) |
127 | AC_CHECK_TOOL(AR, ar) | |
128 | AC_CHECK_TOOL(RANLIB, ranlib, :) | |
129 | ||
130 | AC_PROG_INSTALL | |
131 | ||
132 | AM_MAINTAINER_MODE | |
133 | ||
134 | # We need AC_EXEEXT to keep automake happy in cygnus mode. However, | |
135 | # at least currently, we never actually build a program, so we never | |
136 | # need to use $(EXEEXT). Moreover, the test for EXEEXT normally | |
137 | # fails, because we are probably configuring with a cross compiler | |
138 | # which can't create executables. So we include AC_EXEEXT to keep | |
139 | # automake happy, but we don't execute it, since we don't care about | |
140 | # the result. | |
141 | if false; then | |
142 | AC_EXEEXT | |
143 | fi | |
144 | ||
145 | . [$]{newlib_basedir}/configure.host | |
146 | ||
8a0efa53 CF |
147 | newlib_cflags="[$]{newlib_cflags} -fno-builtin" |
148 | ||
149 | NEWLIB_CFLAGS=${newlib_cflags} | |
150 | AC_SUBST(NEWLIB_CFLAGS) | |
151 | ||
2e1a7175 TF |
152 | LDFLAGS=${ldflags} |
153 | AC_SUBST(LDFLAGS) | |
154 | ||
155 | AM_CONDITIONAL(USE_LIBTOOL, test x[$]{use_libtool} = xyes) | |
0953fe64 TF |
156 | |
157 | # Hard-code OBJEXT. Normally it is set by AC_OBJEXT, but we | |
158 | # use oext, which is set in configure.host based on the target platform. | |
159 | OBJEXT=${oext} | |
160 | ||
161 | AC_SUBST(OBJEXT) | |
2e1a7175 TF |
162 | AC_SUBST(oext) |
163 | AC_SUBST(aext) | |
164 | ||
165 | AC_SUBST(libm_machine_dir) | |
8a0efa53 CF |
166 | AC_SUBST(machine_dir) |
167 | AC_SUBST(sys_dir) | |
168 | ]) |