1 | dnl |
---|
2 | dnl $Id$ |
---|
3 | dnl |
---|
4 | dnl Set target tools |
---|
5 | dnl |
---|
6 | dnl 98/06/23 Ralf Corsepius (corsepiu@faw.uni-ulm.de) |
---|
7 | dnl fixing cache/environment variable handling |
---|
8 | dnl adding checks for cygwin/egcs '\\'-bug |
---|
9 | dnl adding checks for ranlib/ar -s problem |
---|
10 | dnl |
---|
11 | dnl 98/02/12 Ralf Corsepius (corsepiu@faw.uni-ulm.de) |
---|
12 | dnl |
---|
13 | |
---|
14 | AC_DEFUN(RTEMS_GCC_PRINT, |
---|
15 | [ case $host_os in |
---|
16 | *cygwin32*) |
---|
17 | dnl FIXME: Hack for cygwin/egcs reporting mixed '\\' and '/' |
---|
18 | dnl Should be removed once cygwin/egcs reports '/' only |
---|
19 | $1=`$CC_FOR_TARGET --print-prog-name=$2 | sed -e 's%\\\\%/%g' ` |
---|
20 | ;; |
---|
21 | *) |
---|
22 | $1=`$CC_FOR_TARGET --print-prog-name=$2` |
---|
23 | ;; |
---|
24 | esac |
---|
25 | ]) |
---|
26 | |
---|
27 | AC_DEFUN(RTEMS_PATH_TOOL, |
---|
28 | [ |
---|
29 | AC_MSG_CHECKING([target's $2]) |
---|
30 | AC_CACHE_VAL(ac_cv_path_$1,:) |
---|
31 | AC_MSG_RESULT([$ac_cv_path_$1]) |
---|
32 | |
---|
33 | if test -n "$ac_cv_path_$1"; then |
---|
34 | dnl retrieve the value from the cache |
---|
35 | $1=$ac_cv_path_$1 |
---|
36 | else |
---|
37 | dnl the cache was not set |
---|
38 | if test -z "[$]$1" ; then |
---|
39 | if test "$rtems_cv_prog_gcc" = "yes"; then |
---|
40 | # We are using gcc, ask it about its tool |
---|
41 | # NOTE: Necessary if gcc was configured to use the target's |
---|
42 | # native tools or uses prefixes for gnutools (e.g. gas instead of as) |
---|
43 | RTEMS_GCC_PRINT($1,$2) |
---|
44 | fi |
---|
45 | else |
---|
46 | # The user set an environment variable. |
---|
47 | # Check whether it is an absolute path, otherwise AC_PATH_PROG |
---|
48 | # will override the environment variable, which isn't what the user |
---|
49 | # intends |
---|
50 | AC_MSG_CHECKING([whether environment variable $1 is an absolute path]) |
---|
51 | case "[$]$1" in |
---|
52 | /*) # valid |
---|
53 | AC_MSG_RESULT("yes") |
---|
54 | ;; |
---|
55 | *) # invalid for AC_PATH_PROG |
---|
56 | AC_MSG_RESULT("no") |
---|
57 | AC_MSG_ERROR([***] |
---|
58 | [Environment variable $1 should ether] |
---|
59 | [be unset (preferred) or contain an absolute path]) |
---|
60 | ;; |
---|
61 | esac |
---|
62 | fi |
---|
63 | |
---|
64 | AC_PATH_PROG($1,"$program_prefix"$2,$3) |
---|
65 | fi |
---|
66 | ]) |
---|
67 | |
---|
68 | AC_DEFUN(RTEMS_CANONICALIZE_TOOLS, |
---|
69 | [AC_REQUIRE([RTEMS_PROG_CC])dnl |
---|
70 | |
---|
71 | dnl FIXME: What shall be done if these tools are not available? |
---|
72 | RTEMS_PATH_TOOL(AR_FOR_TARGET,ar,no) |
---|
73 | RTEMS_PATH_TOOL(AS_FOR_TARGET,as,no) |
---|
74 | RTEMS_PATH_TOOL(LD_FOR_TARGET,ld,no) |
---|
75 | RTEMS_PATH_TOOL(NM_FOR_TARGET,nm,no) |
---|
76 | |
---|
77 | dnl special treatment of ranlib |
---|
78 | RTEMS_PATH_TOOL(RANLIB_FOR_TARGET,ranlib,no) |
---|
79 | if test "$RANLIB_FOR_TARGET" = "no"; then |
---|
80 | # ranlib wasn't found; check if ar -s is available |
---|
81 | RTEMS_AR_FOR_TARGET_S |
---|
82 | if test $rtems_cv_AR_FOR_TARGET_S = "yes" ; then |
---|
83 | dnl override RANLIB_FOR_TARGET's cache |
---|
84 | ac_cv_path_RANLIB_FOR_TARGET="$AR_FOR_TARGET -s" |
---|
85 | RANLIB_FOR_TARGET=$ac_cv_path_RANLIB_FOR_TARGET |
---|
86 | else |
---|
87 | AC_MSG_ERROR([***] |
---|
88 | [Can't figure out how to build a library index] |
---|
89 | [Nether ranlib nor ar -s seem to be available] ) |
---|
90 | fi |
---|
91 | fi |
---|
92 | |
---|
93 | dnl NOTE: These may not be available if not using gnutools |
---|
94 | RTEMS_PATH_TOOL(OBJCOPY_FOR_TARGET,objcopy,no) |
---|
95 | RTEMS_PATH_TOOL(SIZE_FOR_TARGET,size,no) |
---|
96 | ]) |
---|