source: rtems/aclocal/prog-cc.m4 @ a7a0871

4.104.114.84.9
Last change on this file since a7a0871 was 51c195d5, checked in by Joel Sherrill <joel.sherrill@…>, on Feb 19, 1998 at 4:23:56 PM

New files missed in previous merge.

  • Property mode set to 100644
File size: 1.9 KB
Line 
1dnl
2dnl $Id$
3dnl
4dnl Check for target gcc
5dnl
6dnl Adaptation of autoconf-2.12's AC_PROG_CC to rtems
7dnl
8dnl 98/02/10 Ralf Corsepius     (corsepiu@faw.uni-ulm.de)
9dnl
10
11AC_DEFUN(RTEMS_PROG_CC,
12[
13AC_BEFORE([$0], [AC_PROG_CPP])dnl
14AC_BEFORE([$0], [AC_PROG_CC])dnl
15AC_CHECK_PROG(CC, gcc, gcc)
16if test -z "$CC"; then
17  AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
18  test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
19fi
20
21RTEMS_PROG_CC_WORKS
22AC_PROG_CC_GNU
23
24if test $ac_cv_prog_gcc = yes; then
25  GCC=yes
26dnl Check whether -g works, even if CFLAGS is set, in case the package
27dnl plays around with CFLAGS (such as to build both debugging and
28dnl normal versions of a library), tasteless as that idea is.
29  ac_test_CFLAGS="${CFLAGS+set}"
30  ac_save_CFLAGS="$CFLAGS"
31  CFLAGS=
32  AC_PROG_CC_G
33  if test "$ac_test_CFLAGS" = set; then
34    CFLAGS="$ac_save_CFLAGS"
35  elif test $ac_cv_prog_cc_g = yes; then
36    CFLAGS="-g -O2"
37  else
38    CFLAGS="-O2"
39  fi
40else
41  GCC=
42  test "${CFLAGS+set}" = set || CFLAGS="-g"
43fi
44
45CC_FOR_TARGET=$CC
46rtems_cv_prog_gcc=$ac_cv_prog_gcc
47rtems_cv_prog_cc_g=$ac_cv_prog_cc_g
48
49dnl restore initial values
50unset CC
51unset ac_cv_prog_gcc
52unset ac_cv_prog_cc_g
53unset ac_cv_prog_CC
54])
55
56
57dnl Almost identical to AC_PROG_CC_WORKS
58dnl added malloc to program fragment, because rtems has its own malloc
59dnl which is not available while bootstrapping rtems
60
61AC_DEFUN(RTEMS_PROG_CC_WORKS,
62[AC_MSG_CHECKING([whether the target C compiler ($CC $CFLAGS $LDFLAGS) works])
63AC_LANG_SAVE
64AC_LANG_C
65AC_TRY_COMPILER(
66[void *malloc() { return 0; }
67 main(){return(0);}],
68rtems_cv_prog_cc_works, rtems_cv_prog_cc_cross)
69AC_LANG_RESTORE
70AC_MSG_RESULT($rtems_cv_prog_cc_works)
71if test $rtems_cv_prog_cc_works = no; then
72  AC_MSG_ERROR([installation or configuration problem: target C compiler cannot create executables.])
73fi
74AC_MSG_CHECKING([whether the target C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler])
75AC_MSG_RESULT($rtems_cv_prog_cc_cross)
76])
Note: See TracBrowser for help on using the repository browser.