sparc: Use existing macros to avoid code duplication
[glibc.git] / sysdeps / powerpc / preconfigure.ac
blob6c63bd8257b7e40a548a4de4cbb2fe26ce7d62bc
1 GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
2 # Local preconfigure fragment for sysdeps/powerpc
4 case "$machine" in
5 powerpc64le)
6   base_machine=powerpc machine=powerpc/powerpc64/le
7   ;;
8 powerpc64*)
9   base_machine=powerpc machine=powerpc/powerpc64/be
10   ;;
11 powerpc*)
12   base_machine=powerpc machine=powerpc/powerpc32
13   with_fp_cond="!defined __NO_FPRS__"
14   case "$host_os" in
15     *gnuspe*)
16       # SPE support was dropped in glibc 2.30.
17       AC_MSG_ERROR([Host system type $host is no longer supported.])
18     ;;
19   esac
20   ;;
21 esac
23 # Lets ask the compiler which Power processor we've got, in case the user did
24 # not choose a --with-cpu value.  Scan a trivial generated assembly program
25 # and scrape the first
26 #   .machine <machine>
27 # or
28 #   .ascii "-mcpu=<machine>"
29 # directive which shows up, and try using it.
30 case "${machine}:${submachine}" in
31 *powerpc*:)
32   archcpu=`echo "int foo () { return 0; }" \
33            | $CC $CFLAGS $CPPFLAGS -S -frecord-gcc-switches -xc -o - - \
34            | grep -E "mcpu=|[.]machine" -m 1 \
35            | sed -e "s/.*machine //" -e "s/.*mcpu=\(.*\)\"/\1/"`
36   # Note if you add patterns here you must ensure that an appropriate
37   # directory exists in sysdeps/powerpc.  Likewise, if we find a
38   # cpu, don't let the generic configure append extra compiler options.
39   case "$archcpu" in
40   405fp|440fp|464fp|476fp)
41     submachine=${archcpu%fp}
42     AC_CACHE_VAL(libc_cv_cc_submachine,libc_cv_cc_submachine="")
43     ;;
44   405|440|464|476)
45     submachine=${archcpu}
46     AC_CACHE_VAL(libc_cv_cc_submachine,libc_cv_cc_submachine="")
47     ;;
49   a2|970|power[[4-9]]|power5x|power6+|power10)
50     submachine=${archcpu}
51     AC_CACHE_VAL(libc_cv_cc_submachine,libc_cv_cc_submachine="")
52     ;;
53   *)
54     # We couldn't figure it out, assume none
55     ;;
56   esac
57   ;;
58 esac