2017-12-07 Vladimir Makarov <vmakarov@redhat.com>
[official-gcc.git] / config / hwcaps.m4
blobff352fdd3a69537e72c3115228ba758c13b6a870
1 dnl
2 dnl Check if the assembler used supports disabling generation of hardware
3 dnl capabilities.  This is only supported by Solaris as at the moment.
4 dnl
5 dnl Defines:
6 dnl  HWCAP_CFLAGS='-Wa,-nH' if possible.
7 dnl
8 AC_DEFUN([GCC_CHECK_ASSEMBLER_HWCAP], [
9   test -z "$HWCAP_CFLAGS" && HWCAP_CFLAGS=''
11   # Restrict the test to Solaris, other assemblers (e.g. AIX as) have -nH
12   # with a different meaning.
13   case ${target_os} in
14     solaris2*)
15       ac_save_CFLAGS="$CFLAGS"
16       CFLAGS="$CFLAGS -Wa,-nH"
18       AC_MSG_CHECKING([for as that supports -Wa,-nH])
19       AC_TRY_COMPILE([], [return 0;], [ac_hwcap_flags=yes],[ac_hwcap_flags=no])
20       if test "$ac_hwcap_flags" = "yes"; then
21         HWCAP_CFLAGS="-Wa,-nH $HWCAP_CFLAGS"
22       fi
23       AC_MSG_RESULT($ac_hwcap_flags)
25       CFLAGS="$ac_save_CFLAGS"
26       ;;
27   esac
29   AC_SUBST(HWCAP_CFLAGS)
33 dnl
34 dnl Check if the linker used supports linker maps to clear hardware
35 dnl capabilities.  This is only supported on Solaris at the moment.
36 dnl
37 dnl Defines:
38 dnl  HWCAP_LDFLAGS=-mclear-hwcap if possible
39 dnl  LD (as a side effect of testing)
40 dnl
41 AC_DEFUN([GCC_CHECK_LINKER_HWCAP], [
42   test -z "$HWCAP_LDFLAGS" && HWCAP_LDFLAGS=''
43   AC_REQUIRE([AC_PROG_LD])
45   ac_save_LDFLAGS="$LDFLAGS"
46   LDFLAGS="$LFLAGS -mclear-hwcap"
48   AC_MSG_CHECKING([for -mclear-hwcap])
49   AC_TRY_LINK([], [return 0;], [ac_hwcap_ldflags=yes],[ac_hwcap_ldflags=no])
50   if test "$ac_hwcap_ldflags" = "yes"; then
51     HWCAP_LDFLAGS="-mclear-hwcap $HWCAP_LDFLAGS"
52   fi
53   AC_MSG_RESULT($ac_hwcap_ldflags)
55   LDFLAGS="$ac_save_LDFLAGS"
57   AC_SUBST(HWCAP_LDFLAGS)
59   AM_CONDITIONAL(HAVE_HWCAP, test $ac_hwcap_ldflags != no)