source: rtems/aclocal/prog-cxx.m4 @ d53130be

4.104.114.84.95
Last change on this file since d53130be was d53130be, checked in by Joel Sherrill <joel.sherrill@…>, on 03/23/98 at 19:54:35

Updated now that the phony crt0.c in newlib defines all odd symbols
that gcc automatically generates references to.

  • Property mode set to 100644
File size: 2.0 KB
RevLine 
[51c195d5]1dnl
2dnl $Id$
3dnl
4dnl Check for target g++
5dnl
6dnl Adaptation of autoconf-2.12's AC_PROG_CXX to rtems
7dnl
8dnl 98/02/10 Ralf Corsepius (corsepiu@faw.uni-ulm.de)
9dnl
10 
11AC_DEFUN(RTEMS_PROG_CXX,
12[
13AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
14AC_BEFORE([$0], [AC_PROG_CXX])dnl
15AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++, gcc)
16
17RTEMS_PROG_CXX_WORKS
18AC_PROG_CXX_GNU
19
20if test $ac_cv_prog_gxx = yes; then
21  GXX=yes
22dnl Check whether -g works, even if CXXFLAGS is set, in case the package
23dnl plays around with CXXFLAGS (such as to build both debugging and
24dnl normal versions of a library), tasteless as that idea is.
25  ac_test_CXXFLAGS="${CXXFLAGS+set}"
26  ac_save_CXXFLAGS="$CXXFLAGS"
27  CXXFLAGS=
28  AC_PROG_CXX_G
29  if test "$ac_test_CXXFLAGS" = set; then
30    CXXFLAGS="$ac_save_CXXFLAGS"
31  elif test $ac_cv_prog_cxx_g = yes; then
32    CXXFLAGS="-g -O2"
33  else
34    CXXFLAGS="-O2"
35  fi
36else
37  GXX=
38  test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
39fi
40CXX_FOR_TARGET=$CXX
41
42dnl restore initial values
43unset CXX
44unset ac_cv_prog_gxx
45])
46
47
48dnl Almost identical to AC_PROG_CXX_WORKS
49dnl Additional handling of malloc
50dnl NOTE: using newlib with a native compiler is cross-compiling, indeed.
51AC_DEFUN(RTEMS_PROG_CXX_WORKS,
52[AC_MSG_CHECKING([whether the target C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works])
53AC_LANG_SAVE
54AC_LANG_CPLUSPLUS
55
56dnl this fails if rtems uses newlib, because rtems has its own malloc which
57dnl is not available at bootstrap
58AC_TRY_COMPILER(
59  [main(){return(0);}],
60  rtems_cv_prog_cxx_works, rtems_cv_prog_cxx_cross)
61if test "$rtems_cv_prog_cxx_works" = "no"; then
62  dnl now retry with our own version of malloc
63  AC_TRY_COMPILER(
[d53130be]64    [ main(){return(0);}],
[51c195d5]65    rtems_cv_prog_cxx_works, rtems_cv_prog_cxx_cross)
66fi
67AC_LANG_RESTORE
68AC_MSG_RESULT($rtems_cv_prog_cxx_works)
69if test $rtems_cv_prog_cxx_works = no; then
70  AC_MSG_ERROR([installation or configuration problem: target C++ compiler cannot create executables.])
71fi
72AC_MSG_CHECKING([whether the target C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler])
73AC_MSG_RESULT($rtems_cv_prog_cxx_cross)
74])
Note: See TracBrowser for help on using the repository browser.