blob: e04ee8741034631fe5c1214cf83a7e224816d8ac [file] [log] [blame]
Mike Dodd8cfa7022010-11-17 11:12:26 -08001dnl AX_CELL_SPU - check for needed binutils stuff for Cell BE SPU
2AC_DEFUN([AX_CELL_SPU],
3[
4# On Cell BE architecture, OProfile uses bfd_openr_iovec when processing some
5# SPU profiles. To parse embedded SPU ELF on Cell BE, OProfile requires a
6# version of bfd_openr_iovec that supports the elf32-spu target.
7# This version of the function also has a 7th parameter that's been added.
8# First, we check for existence of the base bfd_openr_iovec. If it exists,
9# we then use a temporary test program below that passes 7 arguments to
10# bfd_openr_iovec; if it compiles OK, we assume we have the right BFD
11# library to support Cell BE SPU profiling.
12
13AC_LANG_PUSH(C)
14
15AC_CHECK_LIB(bfd, bfd_openr_iovec,
16 [bfd_openr_iovec_exists="yes"],
17 [bfd_openr_iovec_exists="no"]
18)
19
20if test "$bfd_openr_iovec_exists" = "yes"; then
21 AC_MSG_CHECKING([whether bfd_openr_iovec has seven parameters])
22 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <bfd.h>
23 #include <stdlib.h>
24 ],
25 [[struct bfd *nbfd = bfd_openr_iovec("some-file", "elf32-spu",
26 NULL, NULL, NULL, NULL, NULL);
27 return 0;
28 ]])],
29 [AC_DEFINE([HAVE_BFD_OPENR_IOVEC_WITH_7PARMS],
30 [],
31 [Defined if you have the version of bfd_openr_iovec with 7 parameters])
32 bfd_open_iovec_7="yes"
33 AC_MSG_RESULT([yes])],
34 [AC_MSG_RESULT([no])]
35 )
36fi
37
38AC_LANG_POP(C)
39
40arch="unknown"
41AC_ARG_WITH(target,
42[ --with-target=cell-be Check BFD support for Cell Broadband Engine SPU profiling], arch=$withval)
43
44if test "$arch" = "cell-be"; then
45 if test "$bfd_open_iovec_7" = "yes"; then
46 AC_MSG_NOTICE([BFD library has support for Cell Broadband Engine SPU profiling])
47 else
48 AC_ERROR([BFD library does not support elf32-spu target; SPU profiling is unsupported])
49 fi
50fi
51]
52)