1# This is the target specific configuration file.  This is invoked by the
2# autoconf generated configure script.  Putting it in a separate shell file
3# lets us skip running autoconf when modifying target specific information.
4
5# This file switches on the shell variable ${target}, and sets the
6# following shell variables:
7#  config_path		An ordered list of directories to search for
8#			sources and headers.  This is relative to the
9#			config subdirectory of the source tree.
10#  XCFLAGS		Add extra compile flags to use.
11#  XLDFLAGS		Add extra link flags to use.
12#  tmake_file		A list of machine-description-specific
13#			makefile fragments.
14
15# Optimize TLS usage by avoiding the overhead of dynamic allocation.
16if test $gcc_cv_have_tls = yes ; then
17  case "${target}" in
18
19    *-*-k*bsd*-gnu*)
20	;;
21
22    *-*-musl*)
23	;;
24
25    *-*-linux* | *-*-gnu*)
26	XCFLAGS="${XCFLAGS} -ftls-model=initial-exec -DUSING_INITIAL_EXEC_TLS"
27	;;
28
29    *-*-rtems*)
30	XCFLAGS="${XCFLAGS} -ftls-model=local-exec"
31	;;
32  esac
33fi
34
35tmake_file=
36# Since we require POSIX threads, assume a POSIX system by default.
37config_path="posix"
38
39# Check for futex enabled all at once.
40if test x$enable_linux_futex = xyes; then
41  case "${target}" in
42
43    aarch64*-*-linux*)
44	config_path="linux posix"
45	;;
46
47    alpha*-*-linux*)
48	config_path="linux/alpha linux posix"
49	;;
50
51    arm*-*-linux*)
52	config_path="linux posix"
53	;;
54
55    ia64*-*-linux*)
56	config_path="linux/ia64 linux posix"
57	;;
58
59    mips*-*-linux*)
60	config_path="linux/mips linux posix"
61	;;
62
63    powerpc*-*-linux*)
64	config_path="linux/powerpc linux posix"
65	;;
66
67    riscv64*-*-linux*)
68	config_path="linux posix"
69	;;
70
71    s390*-*-linux*)
72	config_path="linux/s390 linux posix"
73	;;
74
75    tile*-*-linux*)
76	config_path="linux/tile linux posix"
77	;;
78
79    # Note that bare i386 is not included here.  We need cmpxchg.
80    i[456]86-*-linux* | x86_64-*-linux*)
81	config_path="linux/x86 linux posix"
82	cat > conftestx.c <<EOF
83#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
84#error need -march=i486
85#endif
86EOF
87	if ${CC} ${CFLAGS} -E conftestx.c > /dev/null 2>&1; then
88	  :
89	else
90	  if test "${target_cpu}" = x86_64; then
91	    XCFLAGS="${XCFLAGS} -march=i486 -mtune=generic"
92	  else
93	    XCFLAGS="${XCFLAGS} -march=i486 -mtune=${target_cpu}"
94	  fi
95	fi
96	rm -f conftestx.c
97	;;
98
99    # Note that sparcv7 and sparcv8 is not included here.  We need cas.
100    sparcv9-*-linux* | sparc64-*-linux*)
101	echo "int i;" > conftestx.c
102	if ${CC} ${CFLAGS} -c -o conftestx.o conftestx.c > /dev/null 2>&1; then
103	  config_path="linux/sparc linux posix"
104	  case "`/usr/bin/file conftestx.o`" in
105	    *32-bit*)
106	      case " ${CC} ${CFLAGS}" in
107		*" -mcpu=ultrasparc"*)
108		  ;;
109		*)
110		  XCFLAGS="${XCFLAGS} -mcpu=v9"
111		  ;;
112	      esac
113	      ;;
114	  esac
115	fi
116	rm -f conftestx.c conftestx.o
117	;;
118  esac
119fi
120
121# Other system configury
122case "${target}" in
123
124  *-*-hpux*)
125	config_path="hpux posix"
126	case "${target}" in
127	  *-*-hpux11*)
128	     # HPUX v11.x requires -lrt to resolve sem_init in libgomp.la
129	     XLDFLAGS="${XLDFLAGS} -lrt"
130	     ;;
131	esac
132	case "${target}" in
133	  hppa[12]*-*-hpux*)
134	    # PA 32 HP-UX needs -frandom-seed for bootstrap compare.
135	    XCFLAGS="${XCFLAGS} -frandom-seed=fixed-seed"
136	    ;;
137	esac
138	;;
139
140  *-*-mingw32*)
141	config_path="mingw32 posix"
142	;;
143
144  *-*-darwin*)
145	config_path="bsd darwin posix"
146	;;
147
148  *-*-freebsd*)
149	# Need to link with -lpthread so libgomp.so is self-contained.
150	XLDFLAGS="${XLDFLAGS} -lpthread"
151	;;
152
153  *-*-aix*)
154	config_path="posix"
155	# Need to link with -lpthread so libgomp.so is self-contained.
156	XLDFLAGS="${XLDFLAGS} -lpthread"
157	# AIX needs -frandom-seed for bootstrap compare.
158	XCFLAGS="${XCFLAGS} -frandom-seed=\$@"
159	# Create AIX-style "FAT" libraries.
160	tmake_file="t-aix"
161	;;
162
163  nvptx*-*-*)
164	config_path="nvptx accel"
165	;;
166
167  *-*-rtems*)
168	# Use self-contained synchronization objects if provided by Newlib
169	if test "x$ac_cv_type_struct__Mutex_Control" = xyes ; then
170	    config_path="rtems posix"
171	fi
172	;;
173
174  amdgcn*-*-*)
175	config_path="gcn accel"
176
177	#TODO PR101484
178	XCFLAGS="$XCFLAGS -Wno-error=array-bounds"
179	;;
180
181  *)
182	;;
183
184esac
185