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