annotate libatomic/configure.ac @ 120:f93fa5091070

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