summaryrefslogtreecommitdiffstats
path: root/aclocal/check-newlib.m4
blob: f417c65726b386852b974a42d2357aefdca6f794 (plain) (blame)
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
dnl $Id$

AC_DEFUN(RTEMS_CHECK_NEWLIB,
[dnl
AC_REQUIRE([RTEMS_PROG_CC_FOR_TARGET])dnl
AC_REQUIRE([RTEMS_CANONICALIZE_TOOLS])dnl
AC_CACHE_CHECK([for newlib],
  rtems_cv_use_newlib,
  [
    rtems_save_CC=$CC
    CC=$CC_FOR_TARGET

dnl some versions of newlib provide not_required_by_rtems
    AC_TRY_LINK(
      [extern int not_required_by_rtems() ;],
      [not_required_by_rtems()],
      rtems_cv_use_newlib="yes")

dnl older versions of newlib provided rtems_provides_crt0
    if test -z "$rtems_cv_use_newlib"; then
      AC_TRY_LINK(
        [extern int rtems_provides_crt0 ;],
        [rtems_provides_crt0 = 0],
        rtems_cv_use_newlib="yes",
	rtems_cv_use_newlib="no")
    fi
  CC=$rtems_save_CC])
RTEMS_USE_NEWLIB="$rtems_cv_use_newlib"
AC_SUBST(RTEMS_USE_NEWLIB)
])