source: rtems/aclocal/prog-cc.m4 @ 9b8baa1

4.104.114.84.9
Last change on this file since 9b8baa1 was 2efdd08, checked in by Joel Sherrill <joel.sherrill@…>, on May 20, 1998 at 5:06:57 PM

Patch from Ralf Corseipus to fix latent configure problems suddenly triggered:

The breakdown:

  • CC_FOR_TARGET and CXX_FOR_TARGET were not correctly re-read from autoconf's configuration cache (config.cache)
  • If <target>-[gcc|g++] was not found while running configure, the config macros tried to use other (wrong) compilers (e.g. cc).

Changes:

  • New RTEMS_PROG_CC macro (aclocal/prog-cc.m4).
  • New RTEMS_PROG_CXX macro (aclocal/prog-cxx.m4)
  • Moved a shell script fragment from configure.in to a new m4-autoconf macro (New file: aclocal/tool-prefix.m4)
  • Minor changes to configure.in

I tested it with linux/posix (native gcc/primary libc) and
sh-rtems/gensh1 on a linux host and didn't notice any bugs
related to the problems mentioned above. There seem to be
more bugs with the posix bsp, but I consider them minor as
the build run completed successfully. It is just too late
for me to attempt to fix them now.

  • Property mode set to 100644
File size: 1.5 KB
Line 
1dnl
2dnl $Id$
3dnl
4dnl Check for target gcc
5dnl
6dnl 98/05/20 Ralf Corsepius     (corsepiu@faw.uni-ulm.de)
7dnl                             Completely reworked
8
9AC_DEFUN(RTEMS_PROG_CC,
10[
11AC_BEFORE([$0], [AC_PROG_CPP])dnl
12AC_BEFORE([$0], [AC_PROG_CC])dnl
13AC_REQUIRE([RTEMS_TOOL_PREFIX])dnl
14
15dnl Only accept gcc and cc
16dnl NOTE: This might be too restrictive for native compilation
17AC_PATH_PROGS(CC_FOR_TARGET, "$program_prefix"gcc "$program_prefix"cc )
18test -z "$CC_FOR_TARGET" \
19  && AC_MSG_ERROR([no acceptable cc found in \$PATH])
20
21dnl backup
22rtems_save_CC=$CC
23rtems_save_CFLAGS=$CFLAGS
24
25dnl temporarily set CC
26CC=$CC_FOR_TARGET
27
28AC_PROG_CC_WORKS
29AC_PROG_CC_GNU
30
31if test $ac_cv_prog_gcc = yes; then
32  GCC=yes
33dnl Check whether -g works, even if CFLAGS is set, in case the package
34dnl plays around with CFLAGS (such as to build both debugging and
35dnl normal versions of a library), tasteless as that idea is.
36  ac_test_CFLAGS="${CFLAGS+set}"
37  ac_save_CFLAGS="$CFLAGS"
38  CFLAGS=
39  AC_PROG_CC_G
40  if test "$ac_test_CFLAGS" = set; then
41    CFLAGS="$ac_save_CFLAGS"
42  elif test $ac_cv_prog_cc_g = yes; then
43    CFLAGS="-g -O2"
44  else
45    CFLAGS="-O2"
46  fi
47else
48  GCC=
49  test "${CFLAGS+set}" = set || CFLAGS="-g"
50fi
51
52rtems_cv_prog_gcc=$ac_cv_prog_gcc
53rtems_cv_prog_cc_g=$ac_cv_prog_cc_g
54rtems_cv_prog_cc_works=$ac_cv_prog_cc_works
55rtems_cv_prog_cc_cross=$ac_cv_prog_cc_cross
56
57dnl restore initial values
58CC=$rtems_save_CC
59CFLAGS=$rtems_save_CFLAGS
60
61unset ac_cv_prog_gcc
62unset ac_cv_prog_cc_g
63unset ac_cv_prog_cc_works
64unset ac_cv_prog_cc_cross
65])
Note: See TracBrowser for help on using the repository browser.