source: trunk/libs/newlib/src/libgloss/acinclude.m4 @ 474

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

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

File size: 1.8 KB
Line 
1# FIXME: We temporarily define our own version of AC_PROG_CC.  This is
2# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS.  We
3# are probably using a cross compiler, which will not be able to fully
4# link an executable.  This should really be fixed in autoconf
5# itself.
6
7AC_DEFUN([LIB_AC_PROG_CC_GNU],
8[AC_CACHE_CHECK(whether we are using GNU C, ac_cv_prog_gcc,
9[dnl The semicolon is to pacify NeXT's syntax-checking cpp.
10cat > conftest.c <<EOF
11#ifdef __GNUC__
12  yes;
13#endif
14EOF
15if AC_TRY_COMMAND(${CC-cc} -E conftest.c) | egrep yes >/dev/null 2>&1; then
16  ac_cv_prog_gcc=yes
17else
18  ac_cv_prog_gcc=no
19fi])])
20
21AC_DEFUN([LIB_AM_PROG_AS],
22[# By default we simply use the C compiler to build assembly code.
23AC_REQUIRE([LIB_AC_PROG_CC])
24test "${CCAS+set}" = set || CCAS=$CC
25test "${CCASFLAGS+set}" = set || CCASFLAGS=$CFLAGS
26AC_ARG_VAR([CCAS],      [assembler compiler command (defaults to CC)])
27AC_ARG_VAR([CCASFLAGS], [assembler compiler flags (defaults to CFLAGS)])
28])
29
30AC_DEFUN([LIB_AC_PROG_CC],
31[AC_BEFORE([$0], [AC_PROG_CPP])dnl
32AC_CHECK_PROG(CC, gcc, gcc)
33_AM_DEPENDENCIES(CC)
34if test -z "$CC"; then
35  AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
36  test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
37fi
38
39LIB_AC_PROG_CC_GNU
40
41if test $ac_cv_prog_gcc = yes; then
42  GCC=yes
43dnl Check whether -g works, even if CFLAGS is set, in case the package
44dnl plays around with CFLAGS (such as to build both debugging and
45dnl normal versions of a library), tasteless as that idea is.
46  ac_test_CFLAGS="${CFLAGS+set}"
47  ac_save_CFLAGS="$CFLAGS"
48  CFLAGS=
49  _AC_PROG_CC_G
50  if test "$ac_test_CFLAGS" = set; then
51    CFLAGS="$ac_save_CFLAGS"
52  elif test $ac_cv_prog_cc_g = yes; then
53    CFLAGS="-g -O2"
54  else
55    CFLAGS="-O2"
56  fi
57else
58  GCC=
59  test "${CFLAGS+set}" = set || CFLAGS="-g"
60fi
61])
62
Note: See TracBrowser for help on using the repository browser.