annotate libitm/configure.ac @ 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 # Process this file with autoreconf to produce a configure script.
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2 # Copyright (C) 2011-2020 Free Software Foundation, Inc.
111
kono
parents:
diff changeset
3
kono
parents:
diff changeset
4 # This program is free software; you can redistribute it and/or modify
kono
parents:
diff changeset
5 # it under the terms of the GNU General Public License as published by
kono
parents:
diff changeset
6 # the Free Software Foundation; either version 2 of the License, or
kono
parents:
diff changeset
7 # (at your option) any later version.
kono
parents:
diff changeset
8 #
kono
parents:
diff changeset
9 # This program is distributed in the hope that it will be useful,
kono
parents:
diff changeset
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
kono
parents:
diff changeset
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
kono
parents:
diff changeset
12 # GNU General Public License for more details.
kono
parents:
diff changeset
13 #
kono
parents:
diff changeset
14 # You should have received a copy of the GNU General Public License
kono
parents:
diff changeset
15 # along with this program; if not, write to the Free Software
kono
parents:
diff changeset
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
kono
parents:
diff changeset
17
kono
parents:
diff changeset
18 AC_INIT([GNU TM Runtime Library], 1.0,,[libitm])
kono
parents:
diff changeset
19 AC_CONFIG_HEADER(config.h)
kono
parents:
diff changeset
20
kono
parents:
diff changeset
21 # -------
kono
parents:
diff changeset
22 # Options
kono
parents:
diff changeset
23 # -------
kono
parents:
diff changeset
24
kono
parents:
diff changeset
25 AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
kono
parents:
diff changeset
26 LIBITM_ENABLE(version-specific-runtime-libs, no, ,
kono
parents:
diff changeset
27 [Specify that runtime libraries should be installed in a compiler-specific directory],
kono
parents:
diff changeset
28 permit yes|no)
kono
parents:
diff changeset
29 AC_MSG_RESULT($enable_version_specific_runtime_libs)
kono
parents:
diff changeset
30
kono
parents:
diff changeset
31 # We would like our source tree to be readonly. However when releases or
kono
parents:
diff changeset
32 # pre-releases are generated, the flex/bison generated files as well as the
kono
parents:
diff changeset
33 # various formats of manuals need to be included along with the rest of the
kono
parents:
diff changeset
34 # sources. Therefore we have --enable-generated-files-in-srcdir to do
kono
parents:
diff changeset
35 # just that.
kono
parents:
diff changeset
36 AC_MSG_CHECKING([for --enable-generated-files-in-srcdir])
kono
parents:
diff changeset
37 LIBITM_ENABLE(generated-files-in-srcdir, no, ,
kono
parents:
diff changeset
38 [put copies of generated files in source dir intended for creating source
kono
parents:
diff changeset
39 tarballs for users without texinfo bison or flex.],
kono
parents:
diff changeset
40 permit yes|no)
kono
parents:
diff changeset
41 AC_MSG_RESULT($enable_generated_files_in_srcdir)
kono
parents:
diff changeset
42 AM_CONDITIONAL(GENINSRC, test "$enable_generated_files_in_srcdir" = yes)
kono
parents:
diff changeset
43
kono
parents:
diff changeset
44
kono
parents:
diff changeset
45 # -------
kono
parents:
diff changeset
46 # -------
kono
parents:
diff changeset
47
kono
parents:
diff changeset
48 # Gets build, host, target, *_vendor, *_cpu, *_os, etc.
kono
parents:
diff changeset
49 #
kono
parents:
diff changeset
50 # You will slowly go insane if you do not grok the following fact: when
kono
parents:
diff changeset
51 # building this library, the top-level /target/ becomes the library's /host/.
kono
parents:
diff changeset
52 #
kono
parents:
diff changeset
53 # configure then causes --target to default to --host, exactly like any
kono
parents:
diff changeset
54 # other package using autoconf. Therefore, 'target' and 'host' will
kono
parents:
diff changeset
55 # always be the same. This makes sense both for native and cross compilers
kono
parents:
diff changeset
56 # just think about it for a little while. :-)
kono
parents:
diff changeset
57 #
kono
parents:
diff changeset
58 # Also, if this library is being configured as part of a cross compiler, the
kono
parents:
diff changeset
59 # top-level configure script will pass the "real" host as $with_cross_host.
kono
parents:
diff changeset
60 #
kono
parents:
diff changeset
61 # Do not delete or change the following two lines. For why, see
kono
parents:
diff changeset
62 # http://gcc.gnu.org/ml/libstdc++/2003-07/msg00451.html
kono
parents:
diff changeset
63 AC_CANONICAL_SYSTEM
kono
parents:
diff changeset
64 target_alias=${target_alias-$host_alias}
kono
parents:
diff changeset
65
kono
parents:
diff changeset
66 # Sets up automake. Must come after AC_CANONICAL_SYSTEM. Each of the
kono
parents:
diff changeset
67 # following is magically included in AUTOMAKE_OPTIONS in each Makefile.am.
kono
parents:
diff changeset
68 # 1.9.0: minimum required version
kono
parents:
diff changeset
69 # no-define: PACKAGE and VERSION will not be #define'd in config.h (a bunch
kono
parents:
diff changeset
70 # of other PACKAGE_* variables will, however, and there's nothing
kono
parents:
diff changeset
71 # we can do about that; they come from AC_INIT).
kono
parents:
diff changeset
72 # no-dist: we don't want 'dist' and related rules.
kono
parents:
diff changeset
73 # foreign: we don't follow the normal rules for GNU packages (no COPYING
kono
parents:
diff changeset
74 # file in the top srcdir, etc, etc), so stop complaining.
kono
parents:
diff changeset
75 # -Wall: turns on all automake warnings...
kono
parents:
diff changeset
76 # -Wno-portability: ...except this one, since GNU make is required.
kono
parents:
diff changeset
77 # -Wno-override: ... and this one, since we do want this in testsuite.
kono
parents:
diff changeset
78 AM_INIT_AUTOMAKE([1.9.0 foreign no-dist -Wall -Wno-portability -Wno-override])
kono
parents:
diff changeset
79 AM_ENABLE_MULTILIB(, ..)
kono
parents:
diff changeset
80
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
81 GCC_WITH_TOOLEXECLIBDIR
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
82
111
kono
parents:
diff changeset
83 # Calculate toolexeclibdir
kono
parents:
diff changeset
84 # Also toolexecdir, though it's only used in toolexeclibdir
kono
parents:
diff changeset
85 case ${enable_version_specific_runtime_libs} in
kono
parents:
diff changeset
86 yes)
kono
parents:
diff changeset
87 # Need the gcc compiler version to know where to install libraries
kono
parents:
diff changeset
88 # and header files if --enable-version-specific-runtime-libs option
kono
parents:
diff changeset
89 # is selected.
kono
parents:
diff changeset
90 toolexecdir='$(libdir)/gcc/$(target_alias)'
kono
parents:
diff changeset
91 toolexeclibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)'
kono
parents:
diff changeset
92 ;;
kono
parents:
diff changeset
93 no)
kono
parents:
diff changeset
94 if test -n "$with_cross_host" &&
kono
parents:
diff changeset
95 test x"$with_cross_host" != x"no"; then
kono
parents:
diff changeset
96 # Install a library built with a cross compiler in tooldir, not libdir.
kono
parents:
diff changeset
97 toolexecdir='$(exec_prefix)/$(target_alias)'
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
98 case ${with_toolexeclibdir} in
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
99 no)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
100 toolexeclibdir='$(toolexecdir)/lib'
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
101 ;;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
102 *)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
103 toolexeclibdir=${with_toolexeclibdir}
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
104 ;;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
105 esac
111
kono
parents:
diff changeset
106 else
kono
parents:
diff changeset
107 toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
kono
parents:
diff changeset
108 toolexeclibdir='$(libdir)'
kono
parents:
diff changeset
109 fi
kono
parents:
diff changeset
110 multi_os_directory=`$CC -print-multi-os-directory`
kono
parents:
diff changeset
111 case $multi_os_directory in
kono
parents:
diff changeset
112 .) ;; # Avoid trailing /.
kono
parents:
diff changeset
113 *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
kono
parents:
diff changeset
114 esac
kono
parents:
diff changeset
115 ;;
kono
parents:
diff changeset
116 esac
kono
parents:
diff changeset
117 AC_SUBST(toolexecdir)
kono
parents:
diff changeset
118 AC_SUBST(toolexeclibdir)
kono
parents:
diff changeset
119
kono
parents:
diff changeset
120 # Check the compiler.
kono
parents:
diff changeset
121 # The same as in boehm-gc and libstdc++. Have to borrow it from there.
kono
parents:
diff changeset
122 # We must force CC to /not/ be precious variables; otherwise
kono
parents:
diff changeset
123 # the wrong, non-multilib-adjusted value will be used in multilibs.
kono
parents:
diff changeset
124 # As a side effect, we have to subst CFLAGS ourselves.
kono
parents:
diff changeset
125
kono
parents:
diff changeset
126 m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS])
kono
parents:
diff changeset
127 m4_define([_AC_ARG_VAR_PRECIOUS],[])
kono
parents:
diff changeset
128 AC_PROG_CC
kono
parents:
diff changeset
129 AC_PROG_CXX
kono
parents:
diff changeset
130 AM_PROG_AS
kono
parents:
diff changeset
131 m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
kono
parents:
diff changeset
132
kono
parents:
diff changeset
133 AC_SUBST(CFLAGS)
kono
parents:
diff changeset
134
kono
parents:
diff changeset
135 # In order to override CFLAGS_FOR_TARGET, all of our special flags go
kono
parents:
diff changeset
136 # in XCFLAGS. But we need them in CFLAGS during configury. So put them
kono
parents:
diff changeset
137 # in both places for now and restore CFLAGS at the end of config.
kono
parents:
diff changeset
138 save_CFLAGS="$CFLAGS"
kono
parents:
diff changeset
139
kono
parents:
diff changeset
140 # Find other programs we need.
kono
parents:
diff changeset
141 AC_CHECK_TOOL(AR, ar)
kono
parents:
diff changeset
142 AC_CHECK_TOOL(NM, nm)
kono
parents:
diff changeset
143 AC_CHECK_TOOL(RANLIB, ranlib, ranlib-not-found-in-path-error)
kono
parents:
diff changeset
144 AC_PATH_PROG(PERL, perl, perl-not-found-in-path-error)
kono
parents:
diff changeset
145 AC_PROG_MAKE_SET
kono
parents:
diff changeset
146 AC_PROG_INSTALL
kono
parents:
diff changeset
147
kono
parents:
diff changeset
148 # See if makeinfo has been installed and is modern enough
kono
parents:
diff changeset
149 # that we can use it.
kono
parents:
diff changeset
150 ACX_CHECK_PROG_VER([MAKEINFO], [makeinfo], [--version],
kono
parents:
diff changeset
151 [GNU texinfo.* \([0-9][0-9.]*\)],
kono
parents:
diff changeset
152 [4.[4-9]*|4.[1-9][0-9]*|[5-9]*|[1-9][0-9]*])
kono
parents:
diff changeset
153 AM_CONDITIONAL(BUILD_INFO, test $gcc_cv_prog_makeinfo_modern = "yes")
kono
parents:
diff changeset
154
kono
parents:
diff changeset
155
kono
parents:
diff changeset
156 # Configure libtool
kono
parents:
diff changeset
157 AM_PROG_LIBTOOL
kono
parents:
diff changeset
158 AC_SUBST(enable_shared)
kono
parents:
diff changeset
159 AC_SUBST(enable_static)
kono
parents:
diff changeset
160
kono
parents:
diff changeset
161 AM_MAINTAINER_MODE
kono
parents:
diff changeset
162
kono
parents:
diff changeset
163 # For libtool versioning info, format is CURRENT:REVISION:AGE
kono
parents:
diff changeset
164 libtool_VERSION=1:0:0
kono
parents:
diff changeset
165 AC_SUBST(libtool_VERSION)
kono
parents:
diff changeset
166
kono
parents:
diff changeset
167 # Check header files.
kono
parents:
diff changeset
168 AC_STDC_HEADERS
kono
parents:
diff changeset
169 AC_HEADER_TIME
kono
parents:
diff changeset
170 ACX_HEADER_STRING
kono
parents:
diff changeset
171 AC_CHECK_HEADERS(unistd.h semaphore.h sys/time.h sys/auxv.h malloc.h)
kono
parents:
diff changeset
172
kono
parents:
diff changeset
173 GCC_HEADER_STDINT(gstdint.h)
kono
parents:
diff changeset
174
kono
parents:
diff changeset
175 GCC_AC_FUNC_MMAP_BLACKLIST
kono
parents:
diff changeset
176
kono
parents:
diff changeset
177 AC_C_BIGENDIAN
kono
parents:
diff changeset
178 # I don't like the default behaviour of WORDS_BIGENDIAN undefined for LE.
kono
parents:
diff changeset
179 AH_BOTTOM(
kono
parents:
diff changeset
180 [#ifndef WORDS_BIGENDIAN
kono
parents:
diff changeset
181 #define WORDS_BIGENDIAN 0
kono
parents:
diff changeset
182 #endif])
kono
parents:
diff changeset
183
kono
parents:
diff changeset
184 # Check to see if -pthread or -lpthread is needed. Prefer the former.
kono
parents:
diff changeset
185 # In case the pthread.h system header is not found, this test will fail.
kono
parents:
diff changeset
186 XPCFLAGS=""
kono
parents:
diff changeset
187 CFLAGS="$CFLAGS -pthread"
kono
parents:
diff changeset
188 AC_LINK_IFELSE(
kono
parents:
diff changeset
189 [AC_LANG_PROGRAM(
kono
parents:
diff changeset
190 [#include <pthread.h>
kono
parents:
diff changeset
191 void *g(void *d) { return NULL; }],
kono
parents:
diff changeset
192 [pthread_t t; pthread_create(&t,NULL,g,NULL);])],
kono
parents:
diff changeset
193 [XPCFLAGS=" -Wc,-pthread"],
kono
parents:
diff changeset
194 [CFLAGS="$save_CFLAGS" LIBS="-lpthread $LIBS"
kono
parents:
diff changeset
195 AC_LINK_IFELSE(
kono
parents:
diff changeset
196 [AC_LANG_PROGRAM(
kono
parents:
diff changeset
197 [#include <pthread.h>
kono
parents:
diff changeset
198 void *g(void *d) { return NULL; }],
kono
parents:
diff changeset
199 [pthread_t t; pthread_create(&t,NULL,g,NULL);])],
kono
parents:
diff changeset
200 [],
kono
parents:
diff changeset
201 [AC_MSG_ERROR([Pthreads are required to build libitm])])])
kono
parents:
diff changeset
202
kono
parents:
diff changeset
203 # Check for functions needed.
kono
parents:
diff changeset
204 AC_CHECK_FUNCS(strtoull memalign posix_memalign getauxval)
kono
parents:
diff changeset
205
kono
parents:
diff changeset
206 # Check for broken semaphore implementation on darwin.
kono
parents:
diff changeset
207 # sem_init returns: sem_init error: Function not implemented.
kono
parents:
diff changeset
208 case "$host" in
kono
parents:
diff changeset
209 *-darwin*)
kono
parents:
diff changeset
210 AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1,
kono
parents:
diff changeset
211 Define if the POSIX Semaphores do not work on your system.)
kono
parents:
diff changeset
212 ;;
kono
parents:
diff changeset
213 esac
kono
parents:
diff changeset
214
kono
parents:
diff changeset
215 GCC_LINUX_FUTEX(:)
kono
parents:
diff changeset
216
kono
parents:
diff changeset
217 # See if we support thread-local storage.
kono
parents:
diff changeset
218 GCC_CHECK_TLS
kono
parents:
diff changeset
219
kono
parents:
diff changeset
220 # See what sort of export controls are available.
kono
parents:
diff changeset
221 LIBITM_CHECK_ATTRIBUTE_VISIBILITY
kono
parents:
diff changeset
222 LIBITM_CHECK_ATTRIBUTE_DLLEXPORT
kono
parents:
diff changeset
223 LIBITM_CHECK_ATTRIBUTE_ALIAS
kono
parents:
diff changeset
224
kono
parents:
diff changeset
225 # Check linker hardware capability support.
kono
parents:
diff changeset
226 GCC_CHECK_LINKER_HWCAP
kono
parents:
diff changeset
227 # If defaulting to -mavx, don't clear hwcaps.
kono
parents:
diff changeset
228 AC_CHECK_DECL([__AVX__], [HWCAP_LDFLAGS=''])
kono
parents:
diff changeset
229
kono
parents:
diff changeset
230 LIBITM_ENABLE_SYMVERS
kono
parents:
diff changeset
231 if test $enable_symvers = gnu; then
kono
parents:
diff changeset
232 AC_DEFINE(LIBITM_GNU_SYMBOL_VERSIONING, 1,
kono
parents:
diff changeset
233 [Define to 1 if GNU symbol versioning is used for libitm.])
kono
parents:
diff changeset
234 fi
kono
parents:
diff changeset
235
kono
parents:
diff changeset
236 # See if we can emit unwind info in the sjlj stub.
kono
parents:
diff changeset
237 GCC_AS_CFI_PSEUDO_OP
kono
parents:
diff changeset
238
kono
parents:
diff changeset
239 # Determine the proper ABI type for size_t.
kono
parents:
diff changeset
240 LIBITM_CHECK_SIZE_T_MANGLING
kono
parents:
diff changeset
241
kono
parents:
diff changeset
242 # Get target configury.
kono
parents:
diff changeset
243 . ${srcdir}/configure.tgt
kono
parents:
diff changeset
244 if test -n "$UNSUPPORTED"; then
kono
parents:
diff changeset
245 AC_MSG_ERROR([Configuration ${target} is unsupported.])
kono
parents:
diff changeset
246 fi
kono
parents:
diff changeset
247
kono
parents:
diff changeset
248 CFLAGS="$save_CFLAGS $XCFLAGS"
kono
parents:
diff changeset
249
kono
parents:
diff changeset
250 # Check for __sync_val_compare_and_swap, but only after the target has
kono
parents:
diff changeset
251 # had a chance to set XCFLAGS.
kono
parents:
diff changeset
252 LIBITM_CHECK_SYNC_BUILTINS
kono
parents:
diff changeset
253 LIBITM_CHECK_64BIT_SYNC_BUILTINS
kono
parents:
diff changeset
254 LIBITM_CHECK_AS_AVX
kono
parents:
diff changeset
255 LIBITM_CHECK_AS_RTM
kono
parents:
diff changeset
256 LIBITM_CHECK_AS_HTM
kono
parents:
diff changeset
257
kono
parents:
diff changeset
258 GCC_CHECK_ELF_STYLE_WEAKREF
kono
parents:
diff changeset
259
kono
parents:
diff changeset
260 # Cleanup and exit.
kono
parents:
diff changeset
261 CFLAGS="$save_CFLAGS"
kono
parents:
diff changeset
262 AC_CACHE_SAVE
kono
parents:
diff changeset
263
kono
parents:
diff changeset
264 # Add -Wall -Werror if we are using GCC.
kono
parents:
diff changeset
265 if test "x$GCC" = "xyes"; then
kono
parents:
diff changeset
266 XCFLAGS="$XCFLAGS -Wall -Werror"
kono
parents:
diff changeset
267 fi
kono
parents:
diff changeset
268
kono
parents:
diff changeset
269 XCFLAGS="$XCFLAGS $XPCFLAGS"
kono
parents:
diff changeset
270
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
271 # Add CET specific flags if CET is enabled
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
272 GCC_CET_FLAGS(CET_FLAGS)
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
273 XCFLAGS="$XCFLAGS $CET_FLAGS"
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
274
111
kono
parents:
diff changeset
275 AC_SUBST(config_path)
kono
parents:
diff changeset
276 AC_SUBST(XCFLAGS)
kono
parents:
diff changeset
277 AC_SUBST(XLDFLAGS)
kono
parents:
diff changeset
278
kono
parents:
diff changeset
279 if test ${multilib} = yes; then
kono
parents:
diff changeset
280 multilib_arg="--enable-multilib"
kono
parents:
diff changeset
281 else
kono
parents:
diff changeset
282 multilib_arg=
kono
parents:
diff changeset
283 fi
kono
parents:
diff changeset
284
kono
parents:
diff changeset
285 # Set up the set of libraries that we need to link against for libitm.
kono
parents:
diff changeset
286 # Note that the GTM_SELF_SPECS in gcc.c will force -pthread for -fgnu-tm,
kono
parents:
diff changeset
287 # which will force linkage against -lpthread (or equivalent for the system).
kono
parents:
diff changeset
288 # That's not 100% ideal, but about the best we can do easily.
kono
parents:
diff changeset
289 if test $enable_shared = yes; then
kono
parents:
diff changeset
290 link_itm="-litm %{static: $LIBS}"
kono
parents:
diff changeset
291 else
kono
parents:
diff changeset
292 link_itm="-litm $LIBS"
kono
parents:
diff changeset
293 fi
kono
parents:
diff changeset
294 AC_SUBST(link_itm)
kono
parents:
diff changeset
295
kono
parents:
diff changeset
296 AM_CONDITIONAL([ARCH_ARM], [test "$ARCH" = arm])
kono
parents:
diff changeset
297 AM_CONDITIONAL([ARCH_X86], [test "$ARCH" = x86])
kono
parents:
diff changeset
298 AM_CONDITIONAL([ARCH_X86_AVX], [test "$libitm_cv_as_avx" = yes])
kono
parents:
diff changeset
299 AM_CONDITIONAL([ARCH_FUTEX], [test $enable_linux_futex = yes])
kono
parents:
diff changeset
300
kono
parents:
diff changeset
301 # Determine what GCC version number to use in filesystem paths.
kono
parents:
diff changeset
302 GCC_BASE_VER
kono
parents:
diff changeset
303
kono
parents:
diff changeset
304 AC_CONFIG_FILES(Makefile testsuite/Makefile libitm.spec)
kono
parents:
diff changeset
305 AC_OUTPUT