summaryrefslogtreecommitdiffstats
path: root/aclocal/canonicalize-tools.m4
blob: a3825cb746113fa3e9bbbaba8a392dd59316a70a (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
32
33
34
35
36
37
38
39
40
41
42
dnl $Id$
dnl
dnl Set target tools
dnl
dnl 98/02/12 Ralf Corsepius	(corsepiu@faw.uni-ulm.de)
dnl

AC_DEFUN(RTEMS_CANONICALIZE_TOOLS,
[AC_REQUIRE([RTEMS_PROG_CC])dnl
if test "$rtems_cv_prog_gcc" = "yes" ; then
  dnl We are using gcc, now ask it about its tools
  dnl Necessary if gcc was configured to use the target's native tools
  dnl or uses prefixes for gnutools (e.g. gas instead of as)
  AR_FOR_TARGET=`$CC_FOR_TARGET --print-prog-name=ar`
  AS_FOR_TARGET=`$CC_FOR_TARGET --print-prog-name=as`
  LD_FOR_TARGET=`$CC_FOR_TARGET --print-prog-name=ld`
  NM_FOR_TARGET=`$CC_FOR_TARGET --print-prog-name=nm`
  RANLIB_FOR_TARGET=`$CC_FOR_TARGET --print-prog-name=ranlib`
fi

dnl check whether the tools exist
dnl FIXME: What shall be done if they don't exist?

dnl NOTE: CC_FOR_TARGET should always be valid at this point, 
dnl       cf. RTEMS_PROG_CC  
AC_PATH_PROG(CC_FOR_TARGET,"$program_prefix"gcc,no)

dnl FIXME: This may fail if the compiler has not been recognized as gcc
dnl       and uses tools with different names
AC_PATH_PROG(AR_FOR_TARGET,"$program_prefix"ar,no)
AC_PATH_PROG(AS_FOR_TARGET,"$program_prefix"as,no)
AC_PATH_PROG(NM_FOR_TARGET,"$program_prefix"nm,no)
AC_PATH_PROG(LD_FOR_TARGET,"$program_prefix"ld,no)

dnl NOTE: This is doubtful, but should not disturb all current rtems'
dnl 	  targets (remark: solaris fakes ranlib!!)
AC_PATH_PROG(RANLIB_FOR_TARGET,"$program_prefix"ranlib,no)

dnl NOTE: These may not be available, if not using gnutools
AC_PATH_PROG(OBJCOPY_FOR_TARGET,"$program_prefix"objcopy,no)
AC_PATH_PROG(SIZE_FOR_TARGET,"$program_prefix"size,no)
])