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