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