annotate libitm/configure.ac @ 136:4627f235cf2a

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