xref: /netbsd-src/external/gpl3/binutils/dist/config/hwcaps.m4 (revision cb63e24e8d6aae7ddac1859a9015f48b1d8bd90e)
1dnl
2dnl Check if the assembler used supports disabling generation of hardware
3dnl capabilities.  This is only supported by Solaris as at the moment.
4dnl
5dnl Defines:
6dnl  HWCAP_CFLAGS='-Wa,-nH' if possible.
7dnl
8AC_DEFUN([GCC_CHECK_ASSEMBLER_HWCAP], [
9  test -z "$HWCAP_CFLAGS" && HWCAP_CFLAGS=''
10  AC_REQUIRE([AC_CANONICAL_TARGET])
11
12  # Restrict the test to Solaris, other assemblers (e.g. AIX as) have -nH
13  # with a different meaning.
14  case ${target_os} in
15    solaris2*)
16      ac_save_CFLAGS="$CFLAGS"
17      CFLAGS="$CFLAGS -Wa,-nH"
18
19      AC_MSG_CHECKING([for as that supports -Wa,-nH])
20      AC_TRY_COMPILE([], [return 0;], [ac_hwcap_flags=yes],[ac_hwcap_flags=no])
21      if test "$ac_hwcap_flags" = "yes"; then
22	HWCAP_CFLAGS="-Wa,-nH $HWCAP_CFLAGS"
23      fi
24      AC_MSG_RESULT($ac_hwcap_flags)
25
26      CFLAGS="$ac_save_CFLAGS"
27      ;;
28  esac
29
30  AC_SUBST(HWCAP_CFLAGS)
31])
32
33
34dnl
35dnl Check if the linker used supports linker maps to clear hardware
36dnl capabilities.  This is only supported on Solaris at the moment.
37dnl
38dnl Defines:
39dnl  HWCAP_LDFLAGS=-mclear-hwcap if possible
40dnl  LD (as a side effect of testing)
41dnl
42AC_DEFUN([GCC_CHECK_LINKER_HWCAP], [
43  test -z "$HWCAP_LDFLAGS" && HWCAP_LDFLAGS=''
44  AC_REQUIRE([AC_PROG_LD])
45
46  ac_save_LDFLAGS="$LDFLAGS"
47  LDFLAGS="$LFLAGS -mclear-hwcap"
48
49  AC_MSG_CHECKING([for -mclear-hwcap])
50  AC_TRY_LINK([], [return 0;], [ac_hwcap_ldflags=yes],[ac_hwcap_ldflags=no])
51  if test "$ac_hwcap_ldflags" = "yes"; then
52    HWCAP_LDFLAGS="-mclear-hwcap $HWCAP_LDFLAGS"
53  fi
54  AC_MSG_RESULT($ac_hwcap_ldflags)
55
56  LDFLAGS="$ac_save_LDFLAGS"
57
58  AC_SUBST(HWCAP_LDFLAGS)
59
60  AM_CONDITIONAL(HAVE_HWCAP, test $ac_hwcap_ldflags != no)
61])
62