2 # Copyright (C) 2012-2013 Free Software Foundation, Inc.
3 # Contributed by Richard Henderson <rth@redhat.com>.
5 # This file is part of the GNU Atomic Library (libatomic).
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.
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
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.
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/>.
26 # Map the target cpu to an ARCH sub-directory. At the same time,
27 # work out any special compilation flags as necessary.
29 case "${target_cpu}" in
31 rs6000 | powerpc*) ARCH=powerpc ;;
36 # ??? Detect when -march=armv7 is already enabled.
41 case " ${CC} ${CFLAGS} " in
45 if test -z "$with_cpu"; then
46 XCFLAGS="${XCFLAGS} -mcpu=v9"
52 case " ${CC} ${CFLAGS} " in
54 XCFLAGS="${XCFLAGS} -mcpu=v9"
61 case " ${CC} ${CFLAGS} " in
62 *" -m64 "*|*" -mx32 "*)
65 if test -z "$with_arch"; then
66 XCFLAGS="${XCFLAGS} -march=i486 -mtune=${target_cpu}"
67 XCFLAGS="${XCFLAGS} -fomit-frame-pointer"
71 # ??? Detect when -march=i686 is already enabled.
75 case " ${CC} ${CFLAGS} " in
77 XCFLAGS="${XCFLAGS} -march=i486 -mtune=generic"
78 XCFLAGS="${XCFLAGS} -fomit-frame-pointer"
84 # ??? Detect when -mcx16 is already enabled.
88 *) ARCH="${target_cpu}" ;;
91 # The cpu configury is always most relevant.
92 if test -d ${srcdir}/config/$ARCH ; then
96 # Other system configury
99 # OS support for atomic primitives.
100 config_path="${config_path} linux/arm posix"
103 *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu \
104 | *-*-netbsd* | *-*-freebsd* | *-*-openbsd* \
105 | *-*-solaris2* | *-*-sysv4* | *-*-irix6* | *-*-osf* | *-*-hpux11* \
106 | *-*-darwin* | *-*-aix*)
107 # POSIX system. The OS is supported.
108 config_path="${config_path} posix"
112 # ??? No target OS. We could be targeting bare-metal kernel-mode,
113 # or user-mode for some custom OS. If the target supports TAS,
114 # we can build our own spinlocks, given there are no signals.
115 # If the target supports disabling interrupts, we can work in
116 # kernel-mode, given the system is not multi-processor.