annotate libitm/acinclude.m4 @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 1830386684a0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 dnl ----------------------------------------------------------------------
kono
parents:
diff changeset
2 dnl This whole bit snagged from libgfortran.
kono
parents:
diff changeset
3
kono
parents:
diff changeset
4 dnl Check whether the target supports __sync_*_compare_and_swap.
kono
parents:
diff changeset
5 AC_DEFUN([LIBITM_CHECK_SYNC_BUILTINS], [
kono
parents:
diff changeset
6 AC_CACHE_CHECK([whether the target supports __sync_*_compare_and_swap],
kono
parents:
diff changeset
7 libitm_cv_have_sync_builtins, [
kono
parents:
diff changeset
8 AC_TRY_LINK([], [int foo, bar; bar = __sync_val_compare_and_swap(&foo, 0, 1);],
kono
parents:
diff changeset
9 libitm_cv_have_sync_builtins=yes, libitm_cv_have_sync_builtins=no)])
kono
parents:
diff changeset
10 if test $libitm_cv_have_sync_builtins = yes; then
kono
parents:
diff changeset
11 AC_DEFINE(HAVE_SYNC_BUILTINS, 1,
kono
parents:
diff changeset
12 [Define to 1 if the target supports __sync_*_compare_and_swap])
kono
parents:
diff changeset
13 fi])
kono
parents:
diff changeset
14
kono
parents:
diff changeset
15 dnl Check whether the target supports 64-bit __sync_*_compare_and_swap.
kono
parents:
diff changeset
16 AC_DEFUN([LIBITM_CHECK_64BIT_SYNC_BUILTINS], [
kono
parents:
diff changeset
17 AC_CACHE_CHECK([whether the target supports 64-bit __sync_*_compare_and_swap],
kono
parents:
diff changeset
18 libitm_cv_have_64bit_sync_builtins, [
kono
parents:
diff changeset
19 AC_TRY_LINK([#include <stdint.h>],
kono
parents:
diff changeset
20 [uint64_t foo, bar;
kono
parents:
diff changeset
21 bar = __sync_val_compare_and_swap(&foo, 0, 1);],
kono
parents:
diff changeset
22 libitm_cv_have_64bit_sync_builtins=yes,
kono
parents:
diff changeset
23 libitm_cv_have_64bit_sync_builtins=no)])
kono
parents:
diff changeset
24 if test $libitm_cv_have_64bit_sync_builtins = yes; then
kono
parents:
diff changeset
25 AC_DEFINE(HAVE_64BIT_SYNC_BUILTINS, 1,
kono
parents:
diff changeset
26 [Define to 1 if the target supports 64-bit __sync_*_compare_and_swap])
kono
parents:
diff changeset
27 fi])
kono
parents:
diff changeset
28
kono
parents:
diff changeset
29 dnl Check whether the target supports hidden visibility.
kono
parents:
diff changeset
30 AC_DEFUN([LIBITM_CHECK_ATTRIBUTE_VISIBILITY], [
kono
parents:
diff changeset
31 AC_CACHE_CHECK([whether the target supports hidden visibility],
kono
parents:
diff changeset
32 libitm_cv_have_attribute_visibility, [
kono
parents:
diff changeset
33 save_CFLAGS="$CFLAGS"
kono
parents:
diff changeset
34 CFLAGS="$CFLAGS -Werror"
kono
parents:
diff changeset
35 AC_TRY_COMPILE([void __attribute__((visibility("hidden"))) foo(void) { }],
kono
parents:
diff changeset
36 [], libitm_cv_have_attribute_visibility=yes,
kono
parents:
diff changeset
37 libitm_cv_have_attribute_visibility=no)
kono
parents:
diff changeset
38 CFLAGS="$save_CFLAGS"])
kono
parents:
diff changeset
39 if test $libitm_cv_have_attribute_visibility = yes; then
kono
parents:
diff changeset
40 AC_DEFINE(HAVE_ATTRIBUTE_VISIBILITY, 1,
kono
parents:
diff changeset
41 [Define to 1 if the target supports __attribute__((visibility(...))).])
kono
parents:
diff changeset
42 fi])
kono
parents:
diff changeset
43
kono
parents:
diff changeset
44 dnl Check whether the target supports dllexport
kono
parents:
diff changeset
45 AC_DEFUN([LIBITM_CHECK_ATTRIBUTE_DLLEXPORT], [
kono
parents:
diff changeset
46 AC_CACHE_CHECK([whether the target supports dllexport],
kono
parents:
diff changeset
47 libitm_cv_have_attribute_dllexport, [
kono
parents:
diff changeset
48 save_CFLAGS="$CFLAGS"
kono
parents:
diff changeset
49 CFLAGS="$CFLAGS -Werror"
kono
parents:
diff changeset
50 AC_TRY_COMPILE([void __attribute__((dllexport)) foo(void) { }],
kono
parents:
diff changeset
51 [], libitm_cv_have_attribute_dllexport=yes,
kono
parents:
diff changeset
52 libitm_cv_have_attribute_dllexport=no)
kono
parents:
diff changeset
53 CFLAGS="$save_CFLAGS"])
kono
parents:
diff changeset
54 if test $libitm_cv_have_attribute_dllexport = yes; then
kono
parents:
diff changeset
55 AC_DEFINE(HAVE_ATTRIBUTE_DLLEXPORT, 1,
kono
parents:
diff changeset
56 [Define to 1 if the target supports __attribute__((dllexport)).])
kono
parents:
diff changeset
57 fi])
kono
parents:
diff changeset
58
kono
parents:
diff changeset
59 dnl Check whether the target supports symbol aliases.
kono
parents:
diff changeset
60 AC_DEFUN([LIBITM_CHECK_ATTRIBUTE_ALIAS], [
kono
parents:
diff changeset
61 AC_CACHE_CHECK([whether the target supports symbol aliases],
kono
parents:
diff changeset
62 libitm_cv_have_attribute_alias, [
kono
parents:
diff changeset
63 AC_TRY_LINK([
kono
parents:
diff changeset
64 void foo(void) { }
kono
parents:
diff changeset
65 extern void bar(void) __attribute__((alias("foo")));],
kono
parents:
diff changeset
66 [bar();], libitm_cv_have_attribute_alias=yes, libitm_cv_have_attribute_alias=no)])
kono
parents:
diff changeset
67 if test $libitm_cv_have_attribute_alias = yes; then
kono
parents:
diff changeset
68 AC_DEFINE(HAVE_ATTRIBUTE_ALIAS, 1,
kono
parents:
diff changeset
69 [Define to 1 if the target supports __attribute__((alias(...))).])
kono
parents:
diff changeset
70 fi])
kono
parents:
diff changeset
71
kono
parents:
diff changeset
72 dnl Check how size_t is mangled.
kono
parents:
diff changeset
73 AC_DEFUN([LIBITM_CHECK_SIZE_T_MANGLING], [
kono
parents:
diff changeset
74 AC_CACHE_CHECK([how size_t is mangled],
kono
parents:
diff changeset
75 libitm_cv_size_t_mangling, [
kono
parents:
diff changeset
76 AC_TRY_COMPILE([], [extern __SIZE_TYPE__ x; extern unsigned long x;],
kono
parents:
diff changeset
77 [libitm_cv_size_t_mangling=m], [
kono
parents:
diff changeset
78 AC_TRY_COMPILE([], [extern __SIZE_TYPE__ x; extern unsigned int x;],
kono
parents:
diff changeset
79 [libitm_cv_size_t_mangling=j], [
kono
parents:
diff changeset
80 AC_TRY_COMPILE([],
kono
parents:
diff changeset
81 [extern __SIZE_TYPE__ x; extern unsigned long long x;],
kono
parents:
diff changeset
82 [libitm_cv_size_t_mangling=y], [
kono
parents:
diff changeset
83 AC_TRY_COMPILE([],
kono
parents:
diff changeset
84 [extern __SIZE_TYPE__ x; extern unsigned short x;],
kono
parents:
diff changeset
85 [libitm_cv_size_t_mangling=t],
kono
parents:
diff changeset
86 [libitm_cv_size_t_mangling=x])
kono
parents:
diff changeset
87 ])
kono
parents:
diff changeset
88 ])
kono
parents:
diff changeset
89 ])
kono
parents:
diff changeset
90 ])
kono
parents:
diff changeset
91 if test $libitm_cv_size_t_mangling = x; then
kono
parents:
diff changeset
92 AC_MSG_ERROR([Unknown underlying type for size_t])
kono
parents:
diff changeset
93 fi
kono
parents:
diff changeset
94 AC_DEFINE_UNQUOTED(MANGLE_SIZE_T, [$libitm_cv_size_t_mangling],
kono
parents:
diff changeset
95 [Define to the letter to which size_t is mangled.])
kono
parents:
diff changeset
96 ])
kono
parents:
diff changeset
97
kono
parents:
diff changeset
98 dnl Check if as supports AVX instructions.
kono
parents:
diff changeset
99 AC_DEFUN([LIBITM_CHECK_AS_AVX], [
kono
parents:
diff changeset
100 case "${target_cpu}" in
kono
parents:
diff changeset
101 i[[34567]]86 | x86_64)
kono
parents:
diff changeset
102 AC_CACHE_CHECK([if the assembler supports AVX], libitm_cv_as_avx, [
kono
parents:
diff changeset
103 AC_TRY_COMPILE([], [asm("vzeroupper");],
kono
parents:
diff changeset
104 [libitm_cv_as_avx=yes], [libitm_cv_as_avx=no])
kono
parents:
diff changeset
105 ])
kono
parents:
diff changeset
106 if test x$libitm_cv_as_avx = xyes; then
kono
parents:
diff changeset
107 AC_DEFINE(HAVE_AS_AVX, 1, [Define to 1 if the assembler supports AVX.])
kono
parents:
diff changeset
108 fi
kono
parents:
diff changeset
109 ;;
kono
parents:
diff changeset
110 esac])
kono
parents:
diff changeset
111
kono
parents:
diff changeset
112 dnl Check if as supports RTM instructions.
kono
parents:
diff changeset
113 AC_DEFUN([LIBITM_CHECK_AS_RTM], [
kono
parents:
diff changeset
114 case "${target_cpu}" in
kono
parents:
diff changeset
115 i[[34567]]86 | x86_64)
kono
parents:
diff changeset
116 AC_CACHE_CHECK([if the assembler supports RTM], libitm_cv_as_rtm, [
kono
parents:
diff changeset
117 AC_TRY_COMPILE([], [asm("1: xbegin 1b; xend");],
kono
parents:
diff changeset
118 [libitm_cv_as_rtm=yes], [libitm_cv_as_rtm=no])
kono
parents:
diff changeset
119 ])
kono
parents:
diff changeset
120 if test x$libitm_cv_as_rtm = xyes; then
kono
parents:
diff changeset
121 AC_DEFINE(HAVE_AS_RTM, 1, [Define to 1 if the assembler supports RTM.])
kono
parents:
diff changeset
122 fi
kono
parents:
diff changeset
123 ;;
kono
parents:
diff changeset
124 esac])
kono
parents:
diff changeset
125
kono
parents:
diff changeset
126 dnl Check if as supports HTM instructions.
kono
parents:
diff changeset
127 AC_DEFUN([LIBITM_CHECK_AS_HTM], [
kono
parents:
diff changeset
128 case "${target_cpu}" in
kono
parents:
diff changeset
129 powerpc*)
kono
parents:
diff changeset
130 AC_CACHE_CHECK([if the assembler supports HTM], libitm_cv_as_htm, [
kono
parents:
diff changeset
131 AC_TRY_COMPILE([], [asm("tbegin. 0; tend. 0");],
kono
parents:
diff changeset
132 [libitm_cv_as_htm=yes], [libitm_cv_as_htm=no])
kono
parents:
diff changeset
133 ])
kono
parents:
diff changeset
134 if test x$libitm_cv_as_htm = xyes; then
kono
parents:
diff changeset
135 AC_DEFINE(HAVE_AS_HTM, 1, [Define to 1 if the assembler supports HTM.])
kono
parents:
diff changeset
136 fi
kono
parents:
diff changeset
137 ;;
kono
parents:
diff changeset
138 s390*)
kono
parents:
diff changeset
139 AC_CACHE_CHECK([if the assembler supports HTM], libitm_cv_as_htm, [
kono
parents:
diff changeset
140 save_CFLAGS="$CFLAGS"
kono
parents:
diff changeset
141 CFLAGS="$CFLAGS -march=zEC12"
kono
parents:
diff changeset
142 AC_TRY_COMPILE([], [asm("tbegin 0,0; tend");],
kono
parents:
diff changeset
143 [libitm_cv_as_htm=yes], [libitm_cv_as_htm=no])
kono
parents:
diff changeset
144 CFLAGS="$save_CFLAGS"])
kono
parents:
diff changeset
145 if test x$libitm_cv_as_htm = xyes; then
kono
parents:
diff changeset
146 AC_DEFINE(HAVE_AS_HTM, 1, [Define to 1 if the assembler supports HTM.])
kono
parents:
diff changeset
147 fi
kono
parents:
diff changeset
148 ;;
kono
parents:
diff changeset
149 esac])
kono
parents:
diff changeset
150
kono
parents:
diff changeset
151 sinclude(../libtool.m4)
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
152 sinclude(../config/cet.m4)
111
kono
parents:
diff changeset
153 dnl The lines below arrange for aclocal not to bring an installed
kono
parents:
diff changeset
154 dnl libtool.m4 into aclocal.m4, while still arranging for automake to
kono
parents:
diff changeset
155 dnl add a definition of LIBTOOL to Makefile.in.
kono
parents:
diff changeset
156 ifelse(,,,[AC_SUBST(LIBTOOL)
kono
parents:
diff changeset
157 AC_DEFUN([AM_PROG_LIBTOOL])
kono
parents:
diff changeset
158 AC_DEFUN([AC_LIBTOOL_DLOPEN])
kono
parents:
diff changeset
159 AC_DEFUN([AC_PROG_LD])
kono
parents:
diff changeset
160 ])
kono
parents:
diff changeset
161
kono
parents:
diff changeset
162 dnl ----------------------------------------------------------------------
kono
parents:
diff changeset
163 dnl This whole bit snagged from libstdc++-v3.
kono
parents:
diff changeset
164
kono
parents:
diff changeset
165 dnl
kono
parents:
diff changeset
166 dnl LIBITM_ENABLE
kono
parents:
diff changeset
167 dnl (FEATURE, DEFAULT, HELP-ARG, HELP-STRING)
kono
parents:
diff changeset
168 dnl (FEATURE, DEFAULT, HELP-ARG, HELP-STRING, permit a|b|c)
kono
parents:
diff changeset
169 dnl (FEATURE, DEFAULT, HELP-ARG, HELP-STRING, SHELL-CODE-HANDLER)
kono
parents:
diff changeset
170 dnl
kono
parents:
diff changeset
171 dnl See docs/html/17_intro/configury.html#enable for documentation.
kono
parents:
diff changeset
172 dnl
kono
parents:
diff changeset
173 m4_define([LIBITM_ENABLE],[dnl
kono
parents:
diff changeset
174 m4_define([_g_switch],[--enable-$1])dnl
kono
parents:
diff changeset
175 m4_define([_g_help],[AC_HELP_STRING(_g_switch$3,[$4 @<:@default=$2@:>@])])dnl
kono
parents:
diff changeset
176 AC_ARG_ENABLE($1,_g_help,
kono
parents:
diff changeset
177 m4_bmatch([$5],
kono
parents:
diff changeset
178 [^permit ],
kono
parents:
diff changeset
179 [[
kono
parents:
diff changeset
180 case "$enableval" in
kono
parents:
diff changeset
181 m4_bpatsubst([$5],[permit ])) ;;
kono
parents:
diff changeset
182 *) AC_MSG_ERROR(Unknown argument to enable/disable $1) ;;
kono
parents:
diff changeset
183 dnl Idea for future: generate a URL pointing to
kono
parents:
diff changeset
184 dnl "onlinedocs/configopts.html#whatever"
kono
parents:
diff changeset
185 esac
kono
parents:
diff changeset
186 ]],
kono
parents:
diff changeset
187 [^$],
kono
parents:
diff changeset
188 [[
kono
parents:
diff changeset
189 case "$enableval" in
kono
parents:
diff changeset
190 yes|no) ;;
kono
parents:
diff changeset
191 *) AC_MSG_ERROR(Argument to enable/disable $1 must be yes or no) ;;
kono
parents:
diff changeset
192 esac
kono
parents:
diff changeset
193 ]],
kono
parents:
diff changeset
194 [[$5]]),
kono
parents:
diff changeset
195 [enable_]m4_bpatsubst([$1],-,_)[=][$2])
kono
parents:
diff changeset
196 m4_undefine([_g_switch])dnl
kono
parents:
diff changeset
197 m4_undefine([_g_help])dnl
kono
parents:
diff changeset
198 ])
kono
parents:
diff changeset
199
kono
parents:
diff changeset
200
kono
parents:
diff changeset
201 dnl
kono
parents:
diff changeset
202 dnl If GNU ld is in use, check to see if tricky linker opts can be used. If
kono
parents:
diff changeset
203 dnl the native linker is in use, all variables will be defined to something
kono
parents:
diff changeset
204 dnl safe (like an empty string).
kono
parents:
diff changeset
205 dnl
kono
parents:
diff changeset
206 dnl Defines:
kono
parents:
diff changeset
207 dnl SECTION_LDFLAGS='-Wl,--gc-sections' if possible
kono
parents:
diff changeset
208 dnl OPT_LDFLAGS='-Wl,-O1' if possible
kono
parents:
diff changeset
209 dnl LD (as a side effect of testing)
kono
parents:
diff changeset
210 dnl Sets:
kono
parents:
diff changeset
211 dnl with_gnu_ld
kono
parents:
diff changeset
212 dnl libitm_ld_is_gold (possibly)
kono
parents:
diff changeset
213 dnl libitm_gnu_ld_version (possibly)
kono
parents:
diff changeset
214 dnl
kono
parents:
diff changeset
215 dnl The last will be a single integer, e.g., version 1.23.45.0.67.89 will
kono
parents:
diff changeset
216 dnl set libitm_gnu_ld_version to 12345. Zeros cause problems.
kono
parents:
diff changeset
217 dnl
kono
parents:
diff changeset
218 AC_DEFUN([LIBITM_CHECK_LINKER_FEATURES], [
kono
parents:
diff changeset
219 # If we're not using GNU ld, then there's no point in even trying these
kono
parents:
diff changeset
220 # tests. Check for that first. We should have already tested for gld
kono
parents:
diff changeset
221 # by now (in libtool), but require it now just to be safe...
kono
parents:
diff changeset
222 test -z "$SECTION_LDFLAGS" && SECTION_LDFLAGS=''
kono
parents:
diff changeset
223 test -z "$OPT_LDFLAGS" && OPT_LDFLAGS=''
kono
parents:
diff changeset
224 AC_REQUIRE([AC_PROG_LD])
kono
parents:
diff changeset
225 AC_REQUIRE([AC_PROG_AWK])
kono
parents:
diff changeset
226
kono
parents:
diff changeset
227 # The name set by libtool depends on the version of libtool. Shame on us
kono
parents:
diff changeset
228 # for depending on an impl detail, but c'est la vie. Older versions used
kono
parents:
diff changeset
229 # ac_cv_prog_gnu_ld, but now it's lt_cv_prog_gnu_ld, and is copied back on
kono
parents:
diff changeset
230 # top of with_gnu_ld (which is also set by --with-gnu-ld, so that actually
kono
parents:
diff changeset
231 # makes sense). We'll test with_gnu_ld everywhere else, so if that isn't
kono
parents:
diff changeset
232 # set (hence we're using an older libtool), then set it.
kono
parents:
diff changeset
233 if test x${with_gnu_ld+set} != xset; then
kono
parents:
diff changeset
234 if test x${ac_cv_prog_gnu_ld+set} != xset; then
kono
parents:
diff changeset
235 # We got through "ac_require(ac_prog_ld)" and still not set? Huh?
kono
parents:
diff changeset
236 with_gnu_ld=no
kono
parents:
diff changeset
237 else
kono
parents:
diff changeset
238 with_gnu_ld=$ac_cv_prog_gnu_ld
kono
parents:
diff changeset
239 fi
kono
parents:
diff changeset
240 fi
kono
parents:
diff changeset
241
kono
parents:
diff changeset
242 # Start by getting the version number. I think the libtool test already
kono
parents:
diff changeset
243 # does some of this, but throws away the result.
kono
parents:
diff changeset
244 libitm_ld_is_gold=no
kono
parents:
diff changeset
245 if $LD --version 2>/dev/null | grep 'GNU gold'> /dev/null 2>&1; then
kono
parents:
diff changeset
246 libitm_ld_is_gold=yes
kono
parents:
diff changeset
247 fi
kono
parents:
diff changeset
248 changequote(,)
kono
parents:
diff changeset
249 ldver=`$LD --version 2>/dev/null |
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
250 sed -e 's/[. ][0-9]\{8\}$//;s/.* \([^ ]\{1,\}\)$/\1/; q'`
111
kono
parents:
diff changeset
251 changequote([,])
kono
parents:
diff changeset
252 libitm_gnu_ld_version=`echo $ldver | \
kono
parents:
diff changeset
253 $AWK -F. '{ if (NF<3) [$]3=0; print ([$]1*100+[$]2)*100+[$]3 }'`
kono
parents:
diff changeset
254
kono
parents:
diff changeset
255 # Set --gc-sections.
kono
parents:
diff changeset
256 if test "$with_gnu_ld" = "notbroken"; then
kono
parents:
diff changeset
257 # GNU ld it is! Joy and bunny rabbits!
kono
parents:
diff changeset
258
kono
parents:
diff changeset
259 # All these tests are for C++; save the language and the compiler flags.
kono
parents:
diff changeset
260 # Need to do this so that g++ won't try to link in libstdc++
kono
parents:
diff changeset
261 ac_test_CFLAGS="${CFLAGS+set}"
kono
parents:
diff changeset
262 ac_save_CFLAGS="$CFLAGS"
kono
parents:
diff changeset
263 CFLAGS='-x c++ -Wl,--gc-sections'
kono
parents:
diff changeset
264
kono
parents:
diff changeset
265 # Check for -Wl,--gc-sections
kono
parents:
diff changeset
266 # XXX This test is broken at the moment, as symbols required for linking
kono
parents:
diff changeset
267 # are now in libsupc++ (not built yet). In addition, this test has
kono
parents:
diff changeset
268 # cored on solaris in the past. In addition, --gc-sections doesn't
kono
parents:
diff changeset
269 # really work at the moment (keeps on discarding used sections, first
kono
parents:
diff changeset
270 # .eh_frame and now some of the glibc sections for iconv).
kono
parents:
diff changeset
271 # Bzzzzt. Thanks for playing, maybe next time.
kono
parents:
diff changeset
272 AC_MSG_CHECKING([for ld that supports -Wl,--gc-sections])
kono
parents:
diff changeset
273 AC_TRY_RUN([
kono
parents:
diff changeset
274 int main(void)
kono
parents:
diff changeset
275 {
kono
parents:
diff changeset
276 try { throw 1; }
kono
parents:
diff changeset
277 catch (...) { };
kono
parents:
diff changeset
278 return 0;
kono
parents:
diff changeset
279 }
kono
parents:
diff changeset
280 ], [ac_sectionLDflags=yes],[ac_sectionLDflags=no], [ac_sectionLDflags=yes])
kono
parents:
diff changeset
281 if test "$ac_test_CFLAGS" = set; then
kono
parents:
diff changeset
282 CFLAGS="$ac_save_CFLAGS"
kono
parents:
diff changeset
283 else
kono
parents:
diff changeset
284 # this is the suspicious part
kono
parents:
diff changeset
285 CFLAGS=''
kono
parents:
diff changeset
286 fi
kono
parents:
diff changeset
287 if test "$ac_sectionLDflags" = "yes"; then
kono
parents:
diff changeset
288 SECTION_LDFLAGS="-Wl,--gc-sections $SECTION_LDFLAGS"
kono
parents:
diff changeset
289 fi
kono
parents:
diff changeset
290 AC_MSG_RESULT($ac_sectionLDflags)
kono
parents:
diff changeset
291 fi
kono
parents:
diff changeset
292
kono
parents:
diff changeset
293 # Set linker optimization flags.
kono
parents:
diff changeset
294 if test x"$with_gnu_ld" = x"yes"; then
kono
parents:
diff changeset
295 OPT_LDFLAGS="-Wl,-O1 $OPT_LDFLAGS"
kono
parents:
diff changeset
296 fi
kono
parents:
diff changeset
297
kono
parents:
diff changeset
298 AC_SUBST(SECTION_LDFLAGS)
kono
parents:
diff changeset
299 AC_SUBST(OPT_LDFLAGS)
kono
parents:
diff changeset
300 ])
kono
parents:
diff changeset
301
kono
parents:
diff changeset
302
kono
parents:
diff changeset
303 dnl
kono
parents:
diff changeset
304 dnl Add version tags to symbols in shared library (or not), additionally
kono
parents:
diff changeset
305 dnl marking other symbols as private/local (or not).
kono
parents:
diff changeset
306 dnl
kono
parents:
diff changeset
307 dnl --enable-symvers=style adds a version script to the linker call when
kono
parents:
diff changeset
308 dnl creating the shared library. The choice of version script is
kono
parents:
diff changeset
309 dnl controlled by 'style'.
kono
parents:
diff changeset
310 dnl --disable-symvers does not.
kono
parents:
diff changeset
311 dnl + Usage: LIBITM_ENABLE_SYMVERS[(DEFAULT)]
kono
parents:
diff changeset
312 dnl Where DEFAULT is either 'yes' or 'no'. Passing `yes' tries to
kono
parents:
diff changeset
313 dnl choose a default style based on linker characteristics. Passing
kono
parents:
diff changeset
314 dnl 'no' disables versioning.
kono
parents:
diff changeset
315 dnl
kono
parents:
diff changeset
316 AC_DEFUN([LIBITM_ENABLE_SYMVERS], [
kono
parents:
diff changeset
317
kono
parents:
diff changeset
318 LIBITM_ENABLE(symvers,yes,[=STYLE],
kono
parents:
diff changeset
319 [enables symbol versioning of the shared library],
kono
parents:
diff changeset
320 [permit yes|no|gnu*|sun])
kono
parents:
diff changeset
321
kono
parents:
diff changeset
322 # If we never went through the LIBITM_CHECK_LINKER_FEATURES macro, then we
kono
parents:
diff changeset
323 # don't know enough about $LD to do tricks...
kono
parents:
diff changeset
324 AC_REQUIRE([LIBITM_CHECK_LINKER_FEATURES])
kono
parents:
diff changeset
325
kono
parents:
diff changeset
326 # Turn a 'yes' into a suitable default.
kono
parents:
diff changeset
327 if test x$enable_symvers = xyes ; then
kono
parents:
diff changeset
328 # FIXME The following test is too strict, in theory.
kono
parents:
diff changeset
329 if test $enable_shared = no || test "x$LD" = x; then
kono
parents:
diff changeset
330 enable_symvers=no
kono
parents:
diff changeset
331 else
kono
parents:
diff changeset
332 if test $with_gnu_ld = yes ; then
kono
parents:
diff changeset
333 enable_symvers=gnu
kono
parents:
diff changeset
334 else
kono
parents:
diff changeset
335 case ${target_os} in
kono
parents:
diff changeset
336 # Sun symbol versioning exists since Solaris 2.5.
kono
parents:
diff changeset
337 solaris2.[[5-9]]* | solaris2.1[[0-9]]*)
kono
parents:
diff changeset
338 enable_symvers=sun ;;
kono
parents:
diff changeset
339 *)
kono
parents:
diff changeset
340 enable_symvers=no ;;
kono
parents:
diff changeset
341 esac
kono
parents:
diff changeset
342 fi
kono
parents:
diff changeset
343 fi
kono
parents:
diff changeset
344 fi
kono
parents:
diff changeset
345
kono
parents:
diff changeset
346 # Check if 'sun' was requested on non-Solaris 2 platforms.
kono
parents:
diff changeset
347 if test x$enable_symvers = xsun ; then
kono
parents:
diff changeset
348 case ${target_os} in
kono
parents:
diff changeset
349 solaris2*)
kono
parents:
diff changeset
350 # All fine.
kono
parents:
diff changeset
351 ;;
kono
parents:
diff changeset
352 *)
kono
parents:
diff changeset
353 # Unlikely to work.
kono
parents:
diff changeset
354 AC_MSG_WARN([=== You have requested Sun symbol versioning, but])
kono
parents:
diff changeset
355 AC_MSG_WARN([=== you are not targetting Solaris 2.])
kono
parents:
diff changeset
356 AC_MSG_WARN([=== Symbol versioning will be disabled.])
kono
parents:
diff changeset
357 enable_symvers=no
kono
parents:
diff changeset
358 ;;
kono
parents:
diff changeset
359 esac
kono
parents:
diff changeset
360 fi
kono
parents:
diff changeset
361
kono
parents:
diff changeset
362 # Check to see if libgcc_s exists, indicating that shared libgcc is possible.
kono
parents:
diff changeset
363 if test $enable_symvers != no; then
kono
parents:
diff changeset
364 AC_MSG_CHECKING([for shared libgcc])
kono
parents:
diff changeset
365 ac_save_CFLAGS="$CFLAGS"
kono
parents:
diff changeset
366 CFLAGS=' -lgcc_s'
kono
parents:
diff changeset
367 AC_TRY_LINK(, [return 0;], libitm_shared_libgcc=yes, libitm_shared_libgcc=no)
kono
parents:
diff changeset
368 CFLAGS="$ac_save_CFLAGS"
kono
parents:
diff changeset
369 if test $libitm_shared_libgcc = no; then
kono
parents:
diff changeset
370 cat > conftest.c <<EOF
kono
parents:
diff changeset
371 int main (void) { return 0; }
kono
parents:
diff changeset
372 EOF
kono
parents:
diff changeset
373 changequote(,)dnl
kono
parents:
diff changeset
374 libitm_libgcc_s_suffix=`${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
kono
parents:
diff changeset
375 -shared -shared-libgcc -o conftest.so \
kono
parents:
diff changeset
376 conftest.c -v 2>&1 >/dev/null \
kono
parents:
diff changeset
377 | sed -n 's/^.* -lgcc_s\([^ ]*\) .*$/\1/p'`
kono
parents:
diff changeset
378 changequote([,])dnl
kono
parents:
diff changeset
379 rm -f conftest.c conftest.so
kono
parents:
diff changeset
380 if test x${libitm_libgcc_s_suffix+set} = xset; then
kono
parents:
diff changeset
381 CFLAGS=" -lgcc_s$libitm_libgcc_s_suffix"
kono
parents:
diff changeset
382 AC_TRY_LINK(, [return 0;], libitm_shared_libgcc=yes)
kono
parents:
diff changeset
383 CFLAGS="$ac_save_CFLAGS"
kono
parents:
diff changeset
384 fi
kono
parents:
diff changeset
385 fi
kono
parents:
diff changeset
386 AC_MSG_RESULT($libitm_shared_libgcc)
kono
parents:
diff changeset
387 fi
kono
parents:
diff changeset
388
kono
parents:
diff changeset
389 # For GNU ld, we need at least this version. The format is described in
kono
parents:
diff changeset
390 # LIBITM_CHECK_LINKER_FEATURES above.
kono
parents:
diff changeset
391 libitm_min_gnu_ld_version=21400
kono
parents:
diff changeset
392 # XXXXXXXXXXX libitm_gnu_ld_version=21390
kono
parents:
diff changeset
393
kono
parents:
diff changeset
394 # Check to see if unspecified "yes" value can win, given results above.
kono
parents:
diff changeset
395 # Change "yes" into either "no" or a style name.
kono
parents:
diff changeset
396 if test $enable_symvers != no && test $libitm_shared_libgcc = yes; then
kono
parents:
diff changeset
397 if test $with_gnu_ld = yes; then
kono
parents:
diff changeset
398 if test $libitm_gnu_ld_version -ge $libitm_min_gnu_ld_version ; then
kono
parents:
diff changeset
399 enable_symvers=gnu
kono
parents:
diff changeset
400 elif test $libitm_ld_is_gold = yes ; then
kono
parents:
diff changeset
401 enable_symvers=gnu
kono
parents:
diff changeset
402 else
kono
parents:
diff changeset
403 # The right tools, the right setup, but too old. Fallbacks?
kono
parents:
diff changeset
404 AC_MSG_WARN(=== Linker version $libitm_gnu_ld_version is too old for)
kono
parents:
diff changeset
405 AC_MSG_WARN(=== full symbol versioning support in this release of GCC.)
kono
parents:
diff changeset
406 AC_MSG_WARN(=== You would need to upgrade your binutils to version)
kono
parents:
diff changeset
407 AC_MSG_WARN(=== $libitm_min_gnu_ld_version or later and rebuild GCC.)
kono
parents:
diff changeset
408 if test $libitm_gnu_ld_version -ge 21200 ; then
kono
parents:
diff changeset
409 # Globbing fix is present, proper block support is not.
kono
parents:
diff changeset
410 dnl AC_MSG_WARN([=== Dude, you are soooo close. Maybe we can fake it.])
kono
parents:
diff changeset
411 dnl enable_symvers=???
kono
parents:
diff changeset
412 AC_MSG_WARN([=== Symbol versioning will be disabled.])
kono
parents:
diff changeset
413 enable_symvers=no
kono
parents:
diff changeset
414 else
kono
parents:
diff changeset
415 # 2.11 or older.
kono
parents:
diff changeset
416 AC_MSG_WARN([=== Symbol versioning will be disabled.])
kono
parents:
diff changeset
417 enable_symvers=no
kono
parents:
diff changeset
418 fi
kono
parents:
diff changeset
419 fi
kono
parents:
diff changeset
420 elif test $enable_symvers = sun; then
kono
parents:
diff changeset
421 : All interesting versions of Sun ld support sun style symbol versioning.
kono
parents:
diff changeset
422 else
kono
parents:
diff changeset
423 # just fail for now
kono
parents:
diff changeset
424 AC_MSG_WARN([=== You have requested some kind of symbol versioning, but])
kono
parents:
diff changeset
425 AC_MSG_WARN([=== either you are not using a supported linker, or you are])
kono
parents:
diff changeset
426 AC_MSG_WARN([=== not building a shared libgcc_s (which is required).])
kono
parents:
diff changeset
427 AC_MSG_WARN([=== Symbol versioning will be disabled.])
kono
parents:
diff changeset
428 enable_symvers=no
kono
parents:
diff changeset
429 fi
kono
parents:
diff changeset
430 fi
kono
parents:
diff changeset
431
kono
parents:
diff changeset
432 AM_CONDITIONAL(LIBITM_BUILD_VERSIONED_SHLIB, test $enable_symvers != no)
kono
parents:
diff changeset
433 AM_CONDITIONAL(LIBITM_BUILD_VERSIONED_SHLIB_GNU, test $enable_symvers = gnu)
kono
parents:
diff changeset
434 AM_CONDITIONAL(LIBITM_BUILD_VERSIONED_SHLIB_SUN, test $enable_symvers = sun)
kono
parents:
diff changeset
435 AC_MSG_NOTICE(versioning on shared library symbols is $enable_symvers)
kono
parents:
diff changeset
436 ])