Move VTV_SUPPORTED check after AC_CANONICAL_SYSTEM
[gcc.git] / libatomic / configure.tgt
1 # -*- shell-script -*-
2 # Copyright (C) 2012-2013 Free Software Foundation, Inc.
3 # Contributed by Richard Henderson <rth@redhat.com>.
4 #
5 # This file is part of the GNU Atomic Library (libatomic).
6 #
7 # Libatomic is free software; you can redistribute it and/or modify it
8 # under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 3 of the License, or
10 # (at your option) any later version.
11 #
12 # Libatomic is distributed in the hope that it will be useful, but WITHOUT ANY
13 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 # more details.
16 #
17 # Under Section 7 of GPL version 3, you are granted additional
18 # permissions described in the GCC Runtime Library Exception, version
19 # 3.1, as published by the Free Software Foundation.
20 #
21 # You should have received a copy of the GNU General Public License and
22 # a copy of the GCC Runtime Library Exception along with this program;
23 # see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
24 # <http://www.gnu.org/licenses/>.
25
26 # Map the target cpu to an ARCH sub-directory. At the same time,
27 # work out any special compilation flags as necessary.
28
29 case "${target_cpu}" in
30 alpha*) ARCH=alpha ;;
31 rs6000 | powerpc*) ARCH=powerpc ;;
32 sh*) ARCH=sh ;;
33
34 arm*)
35 ARCH=arm
36 # ??? Detect when -march=armv7 is already enabled.
37 try_ifunc=yes
38 ;;
39
40 sparc)
41 case " ${CC} ${CFLAGS} " in
42 *" -m64 "*)
43 ;;
44 *)
45 if test -z "$with_cpu"; then
46 XCFLAGS="${XCFLAGS} -mcpu=v9"
47 fi
48 esac
49 ARCH=sparc
50 ;;
51 sparc64|sparcv9)
52 case " ${CC} ${CFLAGS} " in
53 *" -m32 "*)
54 XCFLAGS="${XCFLAGS} -mcpu=v9"
55 ;;
56 esac
57 ARCH=sparc
58 ;;
59
60 i[3456]86)
61 case " ${CC} ${CFLAGS} " in
62 *" -m64 "*|*" -mx32 "*)
63 ;;
64 *)
65 if test -z "$with_arch"; then
66 XCFLAGS="${XCFLAGS} -march=i486 -mtune=${target_cpu}"
67 XCFLAGS="${XCFLAGS} -fomit-frame-pointer"
68 fi
69 esac
70 ARCH=x86
71 # ??? Detect when -march=i686 is already enabled.
72 try_ifunc=yes
73 ;;
74 x86_64)
75 case " ${CC} ${CFLAGS} " in
76 *" -m32 "*)
77 XCFLAGS="${XCFLAGS} -march=i486 -mtune=generic"
78 XCFLAGS="${XCFLAGS} -fomit-frame-pointer"
79 ;;
80 *)
81 ;;
82 esac
83 ARCH=x86
84 # ??? Detect when -mcx16 is already enabled.
85 try_ifunc=yes
86 ;;
87
88 *) ARCH="${target_cpu}" ;;
89 esac
90
91 # The cpu configury is always most relevant.
92 if test -d ${srcdir}/config/$ARCH ; then
93 config_path="$ARCH"
94 fi
95
96 # Other system configury
97 case "${target}" in
98 aarch64*)
99 # This is currently not supported in AArch64.
100 UNSUPPORTED=1
101 ;;
102
103 arm*-*-linux*)
104 # OS support for atomic primitives.
105 config_path="${config_path} linux/arm posix"
106 ;;
107
108 *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu \
109 | *-*-netbsd* | *-*-freebsd* | *-*-openbsd* \
110 | *-*-solaris2* | *-*-sysv4* | *-*-irix6* | *-*-osf* | *-*-hpux11* \
111 | *-*-darwin* | *-*-aix*)
112 # POSIX system. The OS is supported.
113 config_path="${config_path} posix"
114 ;;
115
116 *-*-elf*)
117 # ??? No target OS. We could be targeting bare-metal kernel-mode,
118 # or user-mode for some custom OS. If the target supports TAS,
119 # we can build our own spinlocks, given there are no signals.
120 # If the target supports disabling interrupts, we can work in
121 # kernel-mode, given the system is not multi-processor.
122 UNSUPPORTED=1
123 ;;
124
125 *)
126 # Who are you?
127 UNSUPPORTED=1
128 ;;
129 esac