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