source: rtems/aclocal/prog-cc.m4 @ 5b3cf09

4.104.114.84.95
Last change on this file since 5b3cf09 was 5b3cf09, checked in by Joel Sherrill <joel.sherrill@…>, on Mar 21, 1998 at 3:25:47 PM

Added enough symbols to the conftest.c program to make sure it would
successfully link on both the powerpc and hppa1.1.

  • Property mode set to 100644
File size: 2.4 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[
67#if defined(__PPC__)
68  int __SDATA_START__;  int __SDATA2_START__;
69  int __GOT_START__;    int __GOT_END__;
70  int __GOT2_START__;   int __GOT2_END__;
71  int __SBSS_END__;     int __SBSS2_END__;
72  int __FIXUP_START__;  int __FIXUP_END__;
73  int __EXCEPT_START__; int __EXCEPT_END__;
74  int __init;           int __fini;
75#endif
76#if defined(__hppa__)
77  asm ( ".subspa \$GLOBAL\$,QUAD=1,ALIGN=8,ACCESS=0x1f,SORT=40");
78  asm ( ".export \$global\$" );
79  asm ( "\$global\$:");
80#endif
81 int atexit() { return 0; }
82 void *malloc() { return 0; }
83 main(){return(0);}],
84rtems_cv_prog_cc_works, rtems_cv_prog_cc_cross)
85AC_LANG_RESTORE
86AC_MSG_RESULT($rtems_cv_prog_cc_works)
87if test $rtems_cv_prog_cc_works = no; then
88  AC_MSG_ERROR([installation or configuration problem: target C compiler cannot create executables.])
89fi
90AC_MSG_CHECKING([whether the target C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler])
91AC_MSG_RESULT($rtems_cv_prog_cc_cross)
92])
Note: See TracBrowser for help on using the repository browser.