1 dnl This provides configure definitions used by all the newlib
2 dnl configure.in files.
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
9 AC_DEFUN(NEWLIB_CONFIGURE,
11 dnl Default to --enable-multilib
12 AC_ARG_ENABLE(multilib,
13 [ --enable-multilib build many library versions (default)],
14 [case "${enableval}" in
17 *) AC_MSG_ERROR(bad value ${enableval} for multilib option) ;;
18 esac], [multilib=yes])dnl
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
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
38 dnl Support --enable-newlib-mb
39 AC_ARG_ENABLE(newlib-mb,
40 [ --enable-newlib-mb enable multibyte support],
41 [case "${enableval}" in
44 *) AC_MSG_ERROR(bad value ${enableval} for newlib-mb option) ;;
45 esac], [newlib_mb=no])dnl
47 dnl We may get other options which we don't document:
48 dnl --with-target-subdir, --with-multisrctop, --with-multisubdir
50 test -z "[$]{with_target_subdir}" && with_target_subdir=.
52 if test "[$]{srcdir}" = "."; then
53 if test "[$]{with_target_subdir}" != "."; then
54 newlib_basedir="[$]{srcdir}/[$]{with_multisrctop}../$1"
56 newlib_basedir="[$]{srcdir}/[$]{with_multisrctop}$1"
59 newlib_basedir="[$]{srcdir}/$1"
61 AC_SUBST(newlib_basedir)
65 AM_INIT_AUTOMAKE(newlib, 1.9.0)
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
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])
83 if test $ac_cv_prog_gcc = yes; then
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"
92 if test "$ac_test_CFLAGS" = set; then
93 CFLAGS="$ac_save_CFLAGS"
94 elif test $ac_cv_prog_cc_g = yes; then
101 test "${CFLAGS+set}" = set || CFLAGS="-g"
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.
113 AC_CHECK_TOOL(AS, as)
114 AC_CHECK_TOOL(AR, ar)
115 AC_CHECK_TOOL(RANLIB, ranlib, :)
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
132 . [$]{newlib_basedir}/configure.host
134 case [$]{newlib_basedir} in
135 /* | [A-Za-z]:[/\\]*) newlib_flagbasedir=[$]{newlib_basedir} ;;
136 *) newlib_flagbasedir='[$](top_builddir)/'[$]{newlib_basedir} ;;
139 newlib_cflags="[$]{newlib_cflags} -I"'[$](top_builddir)'"/$1/targ-include -I[$]{newlib_flagbasedir}/libc/include"
142 newlib_cflags="[$]{newlib_cflags} -I[$]{newlib_flagbasedir}/../winsup/cygwin/include -I[$]{newlib_flagbasedir}/../winsup/w32api/include"
146 newlib_cflags="[$]{newlib_cflags} -fno-builtin"
148 NEWLIB_CFLAGS=${newlib_cflags}
149 AC_SUBST(NEWLIB_CFLAGS)
151 AC_SUBST(machine_dir)