1 | dnl |
---|
2 | dnl $Id$ |
---|
3 | dnl |
---|
4 | dnl Check for target gcc |
---|
5 | dnl |
---|
6 | |
---|
7 | AC_DEFUN(RTEMS_PROG_CC, |
---|
8 | [ |
---|
9 | AC_BEFORE([$0], [AC_PROG_CPP])dnl |
---|
10 | AC_BEFORE([$0], [AC_PROG_CC])dnl |
---|
11 | AC_BEFORE([$0], [RTEMS_CANONICALIZE_TOOLS])dnl |
---|
12 | AC_REQUIRE([RTEMS_TOOL_PREFIX])dnl |
---|
13 | AC_REQUIRE([RTEMS_ENABLE_LIBCDIR])dnl |
---|
14 | AC_REQUIRE([RTEMS_ENABLE_GCC28])dnl |
---|
15 | |
---|
16 | dnl Only accept gcc and cc |
---|
17 | dnl NOTE: This might be too restrictive for native compilation |
---|
18 | AC_PATH_PROGS(CC_FOR_TARGET, "$program_prefix"gcc "$program_prefix"cc ) |
---|
19 | test -z "$CC_FOR_TARGET" \ |
---|
20 | && AC_MSG_ERROR([no acceptable cc found in \$PATH]) |
---|
21 | |
---|
22 | dnl backup |
---|
23 | rtems_save_CC=$CC |
---|
24 | rtems_save_CFLAGS=$CFLAGS |
---|
25 | |
---|
26 | dnl temporarily set CC |
---|
27 | CC=$CC_FOR_TARGET |
---|
28 | |
---|
29 | AC_PROG_CC_WORKS |
---|
30 | AC_PROG_CC_GNU |
---|
31 | |
---|
32 | if test $ac_cv_prog_gcc = yes; then |
---|
33 | GCC=yes |
---|
34 | dnl Check whether -g works, even if CFLAGS is set, in case the package |
---|
35 | dnl plays around with CFLAGS (such as to build both debugging and |
---|
36 | dnl normal versions of a library), tasteless as that idea is. |
---|
37 | ac_test_CFLAGS="${CFLAGS+set}" |
---|
38 | ac_save_CFLAGS="$CFLAGS" |
---|
39 | CFLAGS= |
---|
40 | AC_PROG_CC_G |
---|
41 | if test "$ac_test_CFLAGS" = set; then |
---|
42 | CFLAGS="$ac_save_CFLAGS" |
---|
43 | elif test $ac_cv_prog_cc_g = yes; then |
---|
44 | CFLAGS="-g -O2" |
---|
45 | else |
---|
46 | CFLAGS="-O2" |
---|
47 | fi |
---|
48 | else |
---|
49 | GCC= |
---|
50 | test "${CFLAGS+set}" = set || CFLAGS="-g" |
---|
51 | fi |
---|
52 | |
---|
53 | rtems_cv_prog_gcc=$ac_cv_prog_gcc |
---|
54 | rtems_cv_prog_cc_g=$ac_cv_prog_cc_g |
---|
55 | rtems_cv_prog_cc_works=$ac_cv_prog_cc_works |
---|
56 | rtems_cv_prog_cc_cross=$ac_cv_prog_cc_cross |
---|
57 | |
---|
58 | dnl restore initial values |
---|
59 | CC=$rtems_save_CC |
---|
60 | CFLAGS=$rtems_save_CFLAGS |
---|
61 | |
---|
62 | unset ac_cv_prog_gcc |
---|
63 | unset ac_cv_prog_cc_g |
---|
64 | unset ac_cv_prog_cc_works |
---|
65 | unset ac_cv_prog_cc_cross |
---|
66 | |
---|
67 | AM_CONDITIONAL(RTEMS_USE_GCC,test x"$rtems_cv_prog_gcc" = x"yes") |
---|
68 | ]) |
---|
69 | |
---|
70 | AC_DEFUN(RTEMS_PROG_CC_FOR_TARGET, |
---|
71 | [ |
---|
72 | dnl check target cc |
---|
73 | RTEMS_PROG_CC |
---|
74 | dnl check if the compiler supports --specs |
---|
75 | RTEMS_GCC_SPECS |
---|
76 | dnl check if the target compiler may use --pipe |
---|
77 | RTEMS_GCC_PIPE |
---|
78 | dnl check if the compiler supports --specs if gcc28 is requested |
---|
79 | if test "$RTEMS_USE_GCC272" != "yes" ; then |
---|
80 | if test "$rtems_cv_gcc_specs" = "no"; then |
---|
81 | AC_MSG_WARN([*** disabling --enable-gcc28]) |
---|
82 | RTEMS_USE_GCC272=yes |
---|
83 | fi |
---|
84 | fi |
---|
85 | test "$rtems_cv_gcc_pipe" = "yes" && CC_FOR_TARGET="$CC_FOR_TARGET --pipe" |
---|
86 | |
---|
87 | ## Conditional for automake files |
---|
88 | AM_CONDITIONAL(RTEMS_USE_GCC272, test x"$RTEMS_USE_GCC272" = x"yes") |
---|
89 | ## Make variable for autoconf fragments (*.cfg) |
---|
90 | AC_SUBST(RTEMS_USE_GCC272) |
---|
91 | |
---|
92 | dnl FIXME: HACK for egcs/cygwin mixing '\\' and '/' in gcc -print-* |
---|
93 | case $host_os in |
---|
94 | *cygwin*) GCCSED="| sed 's%\\\\%/%g'" ;; |
---|
95 | *) ;; |
---|
96 | esac |
---|
97 | AC_SUBST(GCCSED) |
---|
98 | ]) |
---|