source: trunk/libs/newlib/src/libgloss/riscv/aclocal.m4 @ 650

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

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

File size: 2.0 KB
Line 
1#=========================================================================
2# aclocal.m4 for maven libgloss
3#=========================================================================
4# We cannot use the normal AC_PROG_CC since that macro will try and do a
5# link with the found compiler. Since we don't have all the startup
6# files setup yet (that's what we are compiling in libgloss!) we want to
7# find a compiler without actually doing a link. So the LIB_AC_PROG_CC
8# check is copied from xcc/src/libgloss/acinclude.m4
9 
10#-------------------------------------------------------------------------
11# LIB_AC_PROG_CC_GNU
12#-------------------------------------------------------------------------
13
14AC_DEFUN([LIB_AC_PROG_CC_GNU],
15[
16  AC_CACHE_CHECK(whether we are using GNU C, ac_cv_prog_gcc,
17  [dnl The semicolon is to pacify NeXT's syntax-checking cpp.
18
19cat > conftest.c <<EOF
20#ifdef __GNUC__
21  yes;
22#endif
23EOF
24
25if AC_TRY_COMMAND(${CC-cc} -E conftest.c) | egrep yes >/dev/null 2>&1; then
26  ac_cv_prog_gcc=yes
27else
28  ac_cv_prog_gcc=no
29fi
30
31  ])
32])
33
34#-------------------------------------------------------------------------
35# LIB_AC_PROG_CC
36#-------------------------------------------------------------------------
37
38AC_DEFUN([LIB_AC_PROG_CC],
39[
40  AC_BEFORE([$0],[AC_PROG_CPP])dnl
41  AC_CHECK_PROG(CC, gcc, gcc)
42
43if test -z "$CC"; then
44  AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
45  test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
46fi
47
48LIB_AC_PROG_CC_GNU
49
50if test $ac_cv_prog_gcc = yes; then
51  GCC=yes
52  dnl Check whether -g works, even if CFLAGS is set, in case the package
53  dnl plays around with CFLAGS (such as to build both debugging and
54  dnl normal versions of a library), tasteless as that idea is.
55  ac_test_CFLAGS="${CFLAGS+set}"
56  ac_save_CFLAGS="$CFLAGS"
57  CFLAGS=
58  _AC_PROG_CC_G
59  if test "$ac_test_CFLAGS" = set; then
60    CFLAGS="$ac_save_CFLAGS"
61  elif test $ac_cv_prog_cc_g = yes; then
62    CFLAGS="-g -O2"
63  else
64    CFLAGS="-O2"
65  fi
66else
67  GCC=
68  test "${CFLAGS+set}" = set || CFLAGS="-g"
69fi
70
71])
72
Note: See TracBrowser for help on using the repository browser.