annotate libatomic/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) 2012-2020 Free Software Foundation, Inc.
111
kono
parents:
diff changeset
3 #
kono
parents:
diff changeset
4 # This file is part of the GNU Atomic Library (libatomic).
kono
parents:
diff changeset
5 #
kono
parents:
diff changeset
6 # Libatomic is free software; you can redistribute it and/or modify it
kono
parents:
diff changeset
7 # under the terms of the GNU General Public License as published by
kono
parents:
diff changeset
8 # the Free Software Foundation; either version 3 of the License, or
kono
parents:
diff changeset
9 # (at your option) any later version.
kono
parents:
diff changeset
10 #
kono
parents:
diff changeset
11 # Libatomic is distributed in the hope that it will be useful, but WITHOUT ANY
kono
parents:
diff changeset
12 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
kono
parents:
diff changeset
13 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for
kono
parents:
diff changeset
14 # more details.
kono
parents:
diff changeset
15 #
kono
parents:
diff changeset
16 # Under Section 7 of GPL version 3, you are granted additional
kono
parents:
diff changeset
17 # permissions described in the GCC Runtime Library Exception, version
kono
parents:
diff changeset
18 # 3.1, as published by the Free Software Foundation.
kono
parents:
diff changeset
19 #
kono
parents:
diff changeset
20 # You should have received a copy of the GNU General Public License and
kono
parents:
diff changeset
21 # a copy of the GCC Runtime Library Exception along with this program;
kono
parents:
diff changeset
22 # see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
kono
parents:
diff changeset
23 # <http://www.gnu.org/licenses/>.
kono
parents:
diff changeset
24
kono
parents:
diff changeset
25 AC_INIT([GNU Atomic Library], 1.0,,[libatomic])
kono
parents:
diff changeset
26 AC_CONFIG_HEADER(auto-config.h)
kono
parents:
diff changeset
27
kono
parents:
diff changeset
28 # -------
kono
parents:
diff changeset
29 # Options
kono
parents:
diff changeset
30 # -------
kono
parents:
diff changeset
31
kono
parents:
diff changeset
32 AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
kono
parents:
diff changeset
33 LIBAT_ENABLE(version-specific-runtime-libs, no, ,
kono
parents:
diff changeset
34 [Specify that runtime libraries should be installed in a compiler-specific directory],
kono
parents:
diff changeset
35 permit yes|no)
kono
parents:
diff changeset
36 AC_MSG_RESULT($enable_version_specific_runtime_libs)
kono
parents:
diff changeset
37
kono
parents:
diff changeset
38 # We would like our source tree to be readonly. However when releases or
kono
parents:
diff changeset
39 # pre-releases are generated, the flex/bison generated files as well as the
kono
parents:
diff changeset
40 # various formats of manuals need to be included along with the rest of the
kono
parents:
diff changeset
41 # sources. Therefore we have --enable-generated-files-in-srcdir to do
kono
parents:
diff changeset
42 # just that.
kono
parents:
diff changeset
43 AC_MSG_CHECKING([for --enable-generated-files-in-srcdir])
kono
parents:
diff changeset
44 LIBAT_ENABLE(generated-files-in-srcdir, no, ,
kono
parents:
diff changeset
45 [put copies of generated files in source dir intended for creating source
kono
parents:
diff changeset
46 tarballs for users without texinfo bison or flex.],
kono
parents:
diff changeset
47 permit yes|no)
kono
parents:
diff changeset
48 AC_MSG_RESULT($enable_generated_files_in_srcdir)
kono
parents:
diff changeset
49 AM_CONDITIONAL(GENINSRC, test "$enable_generated_files_in_srcdir" = yes)
kono
parents:
diff changeset
50
kono
parents:
diff changeset
51
kono
parents:
diff changeset
52 # -------
kono
parents:
diff changeset
53
kono
parents:
diff changeset
54 # Gets build, host, target, *_vendor, *_cpu, *_os, etc.
kono
parents:
diff changeset
55 #
kono
parents:
diff changeset
56 # You will slowly go insane if you do not grok the following fact: when
kono
parents:
diff changeset
57 # building this library, the top-level /target/ becomes the library's /host/.
kono
parents:
diff changeset
58 #
kono
parents:
diff changeset
59 # configure then causes --target to default to --host, exactly like any
kono
parents:
diff changeset
60 # other package using autoconf. Therefore, 'target' and 'host' will
kono
parents:
diff changeset
61 # always be the same. This makes sense both for native and cross compilers
kono
parents:
diff changeset
62 # just think about it for a little while. :-)
kono
parents:
diff changeset
63 #
kono
parents:
diff changeset
64 # Also, if this library is being configured as part of a cross compiler, the
kono
parents:
diff changeset
65 # top-level configure script will pass the "real" host as $with_cross_host.
kono
parents:
diff changeset
66 #
kono
parents:
diff changeset
67 # Do not delete or change the following two lines. For why, see
kono
parents:
diff changeset
68 # http://gcc.gnu.org/ml/libstdc++/2003-07/msg00451.html
kono
parents:
diff changeset
69 AC_CANONICAL_SYSTEM
kono
parents:
diff changeset
70 target_alias=${target_alias-$host_alias}
kono
parents:
diff changeset
71
kono
parents:
diff changeset
72 # Sets up automake. Must come after AC_CANONICAL_SYSTEM. Each of the
kono
parents:
diff changeset
73 # following is magically included in AUTOMAKE_OPTIONS in each Makefile.am.
kono
parents:
diff changeset
74 # 1.9.0: minimum required version
kono
parents:
diff changeset
75 # no-define: PACKAGE and VERSION will not be #define'd in config.h (a bunch
kono
parents:
diff changeset
76 # of other PACKAGE_* variables will, however, and there's nothing
kono
parents:
diff changeset
77 # we can do about that; they come from AC_INIT).
kono
parents:
diff changeset
78 # no-dist: we don't want 'dist' and related rules.
kono
parents:
diff changeset
79 # foreign: we don't follow the normal rules for GNU packages (no COPYING
kono
parents:
diff changeset
80 # file in the top srcdir, etc, etc), so stop complaining.
kono
parents:
diff changeset
81 # -Wall: turns on all automake warnings...
kono
parents:
diff changeset
82 # -Wno-portability: ...except this one, since GNU make is required.
kono
parents:
diff changeset
83 # -Wno-override: ... and this one, since we do want this in testsuite.
kono
parents:
diff changeset
84 AM_INIT_AUTOMAKE([1.9.0 foreign no-dist -Wall -Wno-portability -Wno-override])
kono
parents:
diff changeset
85 AM_ENABLE_MULTILIB(, ..)
kono
parents:
diff changeset
86
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
87 GCC_WITH_TOOLEXECLIBDIR
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
88
111
kono
parents:
diff changeset
89 # Calculate toolexeclibdir
kono
parents:
diff changeset
90 # Also toolexecdir, though it's only used in toolexeclibdir
kono
parents:
diff changeset
91 case ${enable_version_specific_runtime_libs} in
kono
parents:
diff changeset
92 yes)
kono
parents:
diff changeset
93 # Need the gcc compiler version to know where to install libraries
kono
parents:
diff changeset
94 # and header files if --enable-version-specific-runtime-libs option
kono
parents:
diff changeset
95 # is selected.
kono
parents:
diff changeset
96 toolexecdir='$(libdir)/gcc/$(target_alias)'
kono
parents:
diff changeset
97 toolexeclibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)'
kono
parents:
diff changeset
98 ;;
kono
parents:
diff changeset
99 no)
kono
parents:
diff changeset
100 if test -n "$with_cross_host" &&
kono
parents:
diff changeset
101 test x"$with_cross_host" != x"no"; then
kono
parents:
diff changeset
102 # Install a library built with a cross compiler in tooldir, not libdir.
kono
parents:
diff changeset
103 toolexecdir='$(exec_prefix)/$(target_alias)'
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
104 case ${with_toolexeclibdir} in
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
105 no)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
106 toolexeclibdir='$(toolexecdir)/lib'
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
107 ;;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
108 *)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
109 toolexeclibdir=${with_toolexeclibdir}
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
110 ;;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
111 esac
111
kono
parents:
diff changeset
112 else
kono
parents:
diff changeset
113 toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
kono
parents:
diff changeset
114 toolexeclibdir='$(libdir)'
kono
parents:
diff changeset
115 fi
kono
parents:
diff changeset
116 multi_os_directory=`$CC -print-multi-os-directory`
kono
parents:
diff changeset
117 case $multi_os_directory in
kono
parents:
diff changeset
118 .) ;; # Avoid trailing /.
kono
parents:
diff changeset
119 *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
kono
parents:
diff changeset
120 esac
kono
parents:
diff changeset
121 ;;
kono
parents:
diff changeset
122 esac
kono
parents:
diff changeset
123 AC_SUBST(toolexecdir)
kono
parents:
diff changeset
124 AC_SUBST(toolexeclibdir)
kono
parents:
diff changeset
125
kono
parents:
diff changeset
126 # Check the compiler.
kono
parents:
diff changeset
127 # The same as in boehm-gc and libstdc++. Have to borrow it from there.
kono
parents:
diff changeset
128 # We must force CC to /not/ be precious variables; otherwise
kono
parents:
diff changeset
129 # the wrong, non-multilib-adjusted value will be used in multilibs.
kono
parents:
diff changeset
130 # As a side effect, we have to subst CFLAGS ourselves.
kono
parents:
diff changeset
131
kono
parents:
diff changeset
132 m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS])
kono
parents:
diff changeset
133 m4_define([_AC_ARG_VAR_PRECIOUS],[])
kono
parents:
diff changeset
134 AC_PROG_CC
kono
parents:
diff changeset
135 AM_PROG_AS
kono
parents:
diff changeset
136 m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
kono
parents:
diff changeset
137
kono
parents:
diff changeset
138 AC_SUBST(CFLAGS)
kono
parents:
diff changeset
139
kono
parents:
diff changeset
140 # In order to override CFLAGS_FOR_TARGET, all of our special flags go
kono
parents:
diff changeset
141 # in XCFLAGS. But we need them in CFLAGS during configury. So put them
kono
parents:
diff changeset
142 # in both places for now and restore CFLAGS at the end of config.
kono
parents:
diff changeset
143 save_CFLAGS="$CFLAGS"
kono
parents:
diff changeset
144
kono
parents:
diff changeset
145 # Find other programs we need.
kono
parents:
diff changeset
146 AC_CHECK_TOOL(AR, ar)
kono
parents:
diff changeset
147 AC_CHECK_TOOL(NM, nm)
kono
parents:
diff changeset
148 AC_CHECK_TOOL(RANLIB, ranlib, ranlib-not-found-in-path-error)
kono
parents:
diff changeset
149 AC_PATH_PROG(PERL, perl, perl-not-found-in-path-error)
kono
parents:
diff changeset
150 AC_PROG_INSTALL
kono
parents:
diff changeset
151
kono
parents:
diff changeset
152 # Configure libtool
kono
parents:
diff changeset
153 AM_PROG_LIBTOOL
kono
parents:
diff changeset
154 ACX_LT_HOST_FLAGS
kono
parents:
diff changeset
155 AC_SUBST(enable_shared)
kono
parents:
diff changeset
156 AC_SUBST(enable_static)
kono
parents:
diff changeset
157 AM_MAINTAINER_MODE
kono
parents:
diff changeset
158
kono
parents:
diff changeset
159 # For libtool versioning info, format is CURRENT:REVISION:AGE
kono
parents:
diff changeset
160 libtool_VERSION=3:0:2
kono
parents:
diff changeset
161 AC_SUBST(libtool_VERSION)
kono
parents:
diff changeset
162
kono
parents:
diff changeset
163 # Check for used threading-model
kono
parents:
diff changeset
164 AC_MSG_CHECKING([for thread model used by GCC])
kono
parents:
diff changeset
165 target_thread_file=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'`
kono
parents:
diff changeset
166 AC_MSG_RESULT([$target_thread_file])
kono
parents:
diff changeset
167
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
168 case "$target" in
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
169 *aarch64*)
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
170 ACX_PROG_CC_WARNING_OPTS([-march=armv8-a+lse],[enable_aarch64_lse])
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
171 ;;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
172 esac
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
173
111
kono
parents:
diff changeset
174 # Get target configury.
kono
parents:
diff changeset
175 . ${srcdir}/configure.tgt
kono
parents:
diff changeset
176 if test -n "$UNSUPPORTED"; then
kono
parents:
diff changeset
177 AC_MSG_ERROR([Configuration ${target} is unsupported.])
kono
parents:
diff changeset
178 fi
kono
parents:
diff changeset
179
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
180 # Write out the ifunc resolver arg type.
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
181 AC_DEFINE_UNQUOTED(IFUNC_RESOLVER_ARGS, $IFUNC_RESOLVER_ARGS,
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
182 [Define ifunc resolver function argument.])
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
183
111
kono
parents:
diff changeset
184 # Disable fallbacks to __sync routines from libgcc. Otherwise we'll
kono
parents:
diff changeset
185 # make silly decisions about what the cpu can do.
kono
parents:
diff changeset
186 CFLAGS="$save_CFLAGS -fno-sync-libcalls $XCFLAGS"
kono
parents:
diff changeset
187
kono
parents:
diff changeset
188 # Check header files.
kono
parents:
diff changeset
189 AC_STDC_HEADERS
kono
parents:
diff changeset
190 ACX_HEADER_STRING
kono
parents:
diff changeset
191 GCC_HEADER_STDINT(gstdint.h)
kono
parents:
diff changeset
192 AC_CHECK_HEADERS([fenv.h])
kono
parents:
diff changeset
193
kono
parents:
diff changeset
194 # Check for common type sizes
kono
parents:
diff changeset
195 LIBAT_FORALL_MODES([LIBAT_HAVE_INT_MODE])
kono
parents:
diff changeset
196
kono
parents:
diff changeset
197 # Check for compiler builtins of atomic operations.
kono
parents:
diff changeset
198 LIBAT_TEST_ATOMIC_INIT
kono
parents:
diff changeset
199 LIBAT_FORALL_MODES([LIBAT_HAVE_ATOMIC_LOADSTORE])
kono
parents:
diff changeset
200 LIBAT_FORALL_MODES([LIBAT_HAVE_ATOMIC_TAS])
kono
parents:
diff changeset
201 LIBAT_FORALL_MODES([LIBAT_HAVE_ATOMIC_EXCHANGE])
kono
parents:
diff changeset
202 LIBAT_FORALL_MODES([LIBAT_HAVE_ATOMIC_CAS])
kono
parents:
diff changeset
203 LIBAT_FORALL_MODES([LIBAT_HAVE_ATOMIC_FETCH_ADD])
kono
parents:
diff changeset
204 LIBAT_FORALL_MODES([LIBAT_HAVE_ATOMIC_FETCH_OP])
kono
parents:
diff changeset
205
kono
parents:
diff changeset
206 AC_C_BIGENDIAN
kono
parents:
diff changeset
207 # I don't like the default behaviour of WORDS_BIGENDIAN undefined for LE.
kono
parents:
diff changeset
208 AH_BOTTOM(
kono
parents:
diff changeset
209 [#ifndef WORDS_BIGENDIAN
kono
parents:
diff changeset
210 #define WORDS_BIGENDIAN 0
kono
parents:
diff changeset
211 #endif])
kono
parents:
diff changeset
212
kono
parents:
diff changeset
213 LIBAT_WORDSIZE
kono
parents:
diff changeset
214
kono
parents:
diff changeset
215 # Check to see if -pthread or -lpthread is needed. Prefer the former.
kono
parents:
diff changeset
216 # In case the pthread.h system header is not found, this test will fail.
kono
parents:
diff changeset
217 case " $config_path " in
kono
parents:
diff changeset
218 *" posix "*)
kono
parents:
diff changeset
219 XPCFLAGS=""
kono
parents:
diff changeset
220 CFLAGS="$CFLAGS -pthread"
kono
parents:
diff changeset
221 AC_LINK_IFELSE(
kono
parents:
diff changeset
222 [AC_LANG_PROGRAM(
kono
parents:
diff changeset
223 [#include <pthread.h>
kono
parents:
diff changeset
224 void *g(void *d) { return NULL; }],
kono
parents:
diff changeset
225 [pthread_t t; pthread_create(&t,NULL,g,NULL);])],
kono
parents:
diff changeset
226 [XPCFLAGS=" -pthread"],
kono
parents:
diff changeset
227 [CFLAGS="$save_CFLAGS $XCFLAGS" LIBS="-lpthread $LIBS"
kono
parents:
diff changeset
228 AC_LINK_IFELSE(
kono
parents:
diff changeset
229 [AC_LANG_PROGRAM(
kono
parents:
diff changeset
230 [#include <pthread.h>
kono
parents:
diff changeset
231 void *g(void *d) { return NULL; }],
kono
parents:
diff changeset
232 [pthread_t t; pthread_create(&t,NULL,g,NULL);])],
kono
parents:
diff changeset
233 [],
kono
parents:
diff changeset
234 [AC_MSG_ERROR([Pthreads are required to build libatomic])])])
kono
parents:
diff changeset
235 CFLAGS="$save_CFLAGS $XPCFLAGS"
kono
parents:
diff changeset
236 ;;
kono
parents:
diff changeset
237 esac
kono
parents:
diff changeset
238
kono
parents:
diff changeset
239 # See what sort of export controls are available.
kono
parents:
diff changeset
240 LIBAT_CHECK_ATTRIBUTE_VISIBILITY
kono
parents:
diff changeset
241 LIBAT_CHECK_ATTRIBUTE_DLLEXPORT
kono
parents:
diff changeset
242 LIBAT_CHECK_ATTRIBUTE_ALIAS
kono
parents:
diff changeset
243 if test x$try_ifunc = xyes; then
kono
parents:
diff changeset
244 LIBAT_CHECK_IFUNC
kono
parents:
diff changeset
245 fi
kono
parents:
diff changeset
246
kono
parents:
diff changeset
247 # Check linker support.
kono
parents:
diff changeset
248 LIBAT_ENABLE_SYMVERS
kono
parents:
diff changeset
249
kono
parents:
diff changeset
250 # Cleanup and exit.
kono
parents:
diff changeset
251 CFLAGS="$save_CFLAGS"
kono
parents:
diff changeset
252 AC_CACHE_SAVE
kono
parents:
diff changeset
253
kono
parents:
diff changeset
254 # Add -Wall -Werror if we are using GCC.
kono
parents:
diff changeset
255 if test "x$GCC" = "xyes"; then
kono
parents:
diff changeset
256 XCFLAGS="$XCFLAGS -Wall -Werror"
kono
parents:
diff changeset
257 fi
kono
parents:
diff changeset
258
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
259 # Add CET specific flags if CET is enabled
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
260 GCC_CET_FLAGS(CET_FLAGS)
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
261 XCFLAGS="$XCFLAGS $CET_FLAGS"
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
262
111
kono
parents:
diff changeset
263 XCFLAGS="$XCFLAGS $XPCFLAGS"
kono
parents:
diff changeset
264
kono
parents:
diff changeset
265 AC_SUBST(config_path)
kono
parents:
diff changeset
266 AC_SUBST(XCFLAGS)
kono
parents:
diff changeset
267 AC_SUBST(XLDFLAGS)
kono
parents:
diff changeset
268 AC_SUBST(LIBS)
kono
parents:
diff changeset
269 AC_SUBST(SIZES)
kono
parents:
diff changeset
270
kono
parents:
diff changeset
271 AM_CONDITIONAL(HAVE_IFUNC, test x$libat_cv_have_ifunc = xyes)
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
272 AM_CONDITIONAL(ARCH_AARCH64_LINUX,
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
273 [expr "$config_path" : ".* linux/aarch64 .*" > /dev/null])
111
kono
parents:
diff changeset
274 AM_CONDITIONAL(ARCH_ARM_LINUX,
kono
parents:
diff changeset
275 [expr "$config_path" : ".* linux/arm .*" > /dev/null])
kono
parents:
diff changeset
276 AM_CONDITIONAL(ARCH_I386,
kono
parents:
diff changeset
277 [test "$ARCH" = x86 && test x$libat_cv_wordsize = x4])
kono
parents:
diff changeset
278 AM_CONDITIONAL(ARCH_X86_64,
kono
parents:
diff changeset
279 [test "$ARCH" = x86 && test x$libat_cv_wordsize = x8])
kono
parents:
diff changeset
280
kono
parents:
diff changeset
281 # Determine what GCC version number to use in filesystem paths.
kono
parents:
diff changeset
282 GCC_BASE_VER
kono
parents:
diff changeset
283
kono
parents:
diff changeset
284 if test ${multilib} = yes; then
kono
parents:
diff changeset
285 multilib_arg="--enable-multilib"
kono
parents:
diff changeset
286 else
kono
parents:
diff changeset
287 multilib_arg=
kono
parents:
diff changeset
288 fi
kono
parents:
diff changeset
289
kono
parents:
diff changeset
290 AC_CONFIG_FILES(Makefile testsuite/Makefile)
kono
parents:
diff changeset
291 AC_OUTPUT