]> git.ipfire.org Git - thirdparty/gcc.git/blame - libcilkrts/configure.ac
[Patch AArch64] Fixup floating point division with -march=armv8-a+nosimd
[thirdparty/gcc.git] / libcilkrts / configure.ac
CommitLineData
2e01cda6 1# Copyright (C) 2011-2016, Intel Corporation
3038054c
BI
2# All rights reserved.
3#
3038054c
BI
4# Redistribution and use in source and binary forms, with or without
5# modification, are permitted provided that the following conditions
6# are met:
7#
8# * Redistributions of source code must retain the above copyright
9# notice, this list of conditions and the following disclaimer.
10# * Redistributions in binary form must reproduce the above copyright
11# notice, this list of conditions and the following disclaimer in
12# the documentation and/or other materials provided with the
13# distribution.
14# * Neither the name of Intel Corporation nor the names of its
15# contributors may be used to endorse or promote products derived
16# from this software without specific prior written permission.
17#
3038054c
BI
18# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
23# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
24# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
25# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
26# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
28# WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29# POSSIBILITY OF SUCH DAMAGE.
2e01cda6
IV
30#
31# *********************************************************************
32#
33# PLEASE NOTE: This file is a downstream copy of a file mainitained in
34# a repository at cilkplus.org. Changes made to this file that are not
35# submitted through the contribution process detailed at
36# http://www.cilkplus.org/submit-cilk-contribution will be lost the next
37# time that a new version is released. Changes only submitted to the
38# GNU compiler collection or posted to the git repository at
39# https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
40# not tracked.
41#
42# We welcome your contributions to this open source project. Thank you
43# for your assistance in helping us improve Cilk Plus.
3038054c
BI
44
45AC_INIT([Cilk Runtime Library], [2.0], [cilk@intel.com])
46AC_PREREQ([2.64])
47
48# Needed to define ${target}. Needs to be very early to avoid annoying
49# warning about calling AC_ARG_PROGRAM before AC_CANONICAL_SYSTEM
50AC_CANONICAL_SYSTEM
c1cb31a7
BI
51target_alias=${target_alias-$host_alias}
52AC_SUBST(target_alias)
2e01cda6 53
3038054c
BI
54AM_INIT_AUTOMAKE(foreign no-dist)
55
8a1a4544
TB
56AM_MAINTAINER_MODE
57
26570a9b
MK
58AM_ENABLE_MULTILIB(, ..)
59
61431953
MK
60# Test for GNU extensions. Will define _GNU_SOURCE if they're available
61AC_USE_SYSTEM_EXTENSIONS
62
3038054c
BI
63# Build a DLL on Windows
64# AC_LIBTOOL_WIN32_DLL
3038054c 65AC_PROG_CC
517854bc 66AC_PROG_CXX
3038054c
BI
67# AC_PROG_LIBTOOL
68# AC_CONFIG_MACRO_DIR([..])
b9487dd8 69AC_CONFIG_FILES([Makefile libcilkrts.spec])
fbdec791 70AC_FUNC_ALLOCA
3038054c 71
be5ddbb8
RO
72# Check for dl functions
73AC_CHECK_LIB(dl, dladdr,
74 [AC_DEFINE(HAVE_DLADDR, 1, [Define if you have dladdr()])])
75
954d4574
RO
76# Check whether the target supports protected visibility.
77save_CFLAGS="$CFLAGS"
78CFLAGS="$CFLAGS -Werror"
79AC_TRY_COMPILE([void __attribute__((visibility("protected"))) foo(void) { }],
80 [], libcilkrts_cv_have_attribute_visibility=yes,
81 libcilkrts_cv_have_attribute_visibility=no)
82CFLAGS="$save_CFLAGS"
83if test $libcilkrts_cv_have_attribute_visibility = yes; then
84 AC_DEFINE(HAVE_ATTRIBUTE_VISIBILITY, 1,
85 [Define to 1 if the target supports __attribute__((visibility(...))).])
86fi
87
3038054c
BI
88# Get target configury.
89. ${srcdir}/configure.tgt
90if test -n "$UNSUPPORTED"; then
91 AC_MSG_ERROR([Configuration ${target} is unsupported.])
92fi
93
94if test "${multilib}" = "yes"; then
95 multilib_arg="--enable-multilib"
96else
97 multilib_arg=
98fi
99
100AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
101AC_ARG_ENABLE([version-specific-runtime-libs],
102 AC_HELP_STRING([--enable-version-specific-runtime-libs],
103 [Specify that runtime libraries should be installed in a compi
104ler-specific directory]),
105 [case "$enableval" in
106 yes) enable_version_specific_runtime_libs=yes ;;
107 no) enable_version_specific_runtime_libs=no ;;
108 *) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs
109]);;
110 esac],
111 [enable_version_specific_runtime_libs=no])
112AC_MSG_RESULT($enable_version_specific_runtime_libs)
113
114
115# Calculate toolexeclibdir
116# Also toolexecdir, though it's only used in toolexeclibdir
117case ${enable_version_specific_runtime_libs} in
118 yes)
119 # Need the gcc compiler version to know where to install libraries
120 # and header files if --enable-version-specific-runtime-libs option
121 # is selected.
122 toolexecdir='$(libdir)/gcc/$(target_alias)'
c1cb31a7 123 toolexeclibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)'
3038054c
BI
124 ;;
125 no)
126 if test -n "$with_cross_host" &&
127 test x"$with_cross_host" != x"no"; then
128 # Install a library built with a cross compiler in tooldir, not libdir.
129 toolexecdir='$(exec_prefix)/$(target_alias)'
130 toolexeclibdir='$(toolexecdir)/lib'
131 else
132 toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
133 toolexeclibdir='$(libdir)'
134 fi
135 multi_os_directory=`$CC -print-multi-os-directory`
136 case $multi_os_directory in
137 .) ;; # Avoid trailing /.
138 *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
139 esac
140 ;;
141esac
142
143# Set config_dir based on the target. config_dir specifies where to get
144# target-specific files. The generic implementation is incomplete, but
145# contains information on what's needed
146case "${target}" in
147
be5ddbb8 148 i?86-*-* | x86_64-*-*)
3038054c
BI
149 config_dir="x86"
150 ;;
151
2e01cda6
IV
152 arm-*-*)
153 config_dir="arm"
154 ;;
155
be5ddbb8
RO
156 sparc*-*-*)
157 config_dir="sparc"
158 ;;
159
3038054c
BI
160 *)
161 config_dir="generic"
162 ;;
163
164esac
165AC_SUBST(config_dir)
166
167# We have linker scripts for appropriate operating systems
168linux_linker_script=no
169case "${host}" in
170 *-*-linux*)
171 linux_linker_script=yes
172 ;;
173esac
174AM_CONDITIONAL(LINUX_LINKER_SCRIPT, test "$linux_linker_script" = "yes")
175
176mac_linker_script=no
177case "${host}" in
178 *-*-apple*)
179 mac_linker_script=yes
180 ;;
181esac
182AM_CONDITIONAL(MAC_LINKER_SCRIPT, test "$mac_linker_script" = "yes")
183
f8ae0b2a 184AC_LIBTOOL_DLOPEN
3038054c
BI
185AM_PROG_LIBTOOL
186AC_SUBST(toolexecdir)
187AC_SUBST(toolexeclibdir)
188
f8ae0b2a
BI
189AC_SUBST(lt_cv_dlopen_libs)
190
7955b065
AI
191# Check to see if -pthread or -lpthread is needed. Prefer the former.
192# Note that the CILK_SELF_SPEC in gcc.c may force -pthread.
193# In case the pthread.h system header is not found, this test will fail.
194XCFLAGS=""
195XLDFLAGS=""
196CFLAGS="$CFLAGS -pthread"
197AC_LINK_IFELSE(
198 [AC_LANG_PROGRAM(
199 [#include <pthread.h>
200 void *g(void *d) { return NULL; }],
201 [pthread_t t; pthread_create(&t,NULL,g,NULL);])],
202 [XCFLAGS=" -Wc,-pthread"],
203 [CFLAGS="$save_CFLAGS" LIBS="-lpthread $LIBS"
204 AC_LINK_IFELSE(
205 [AC_LANG_PROGRAM(
206 [#include <pthread.h>
207 void *g(void *d) { return NULL; }],
208 [pthread_t t; pthread_create(&t,NULL,g,NULL);])],
209 [],
210 [AC_MSG_ERROR([Pthreads are required to build libcilkrts])])])
211
ef132d59
BI
212# Check for pthread_{,attr_}[sg]etaffinity_np.
213AC_LINK_IFELSE(
214 [AC_LANG_PROGRAM(
2e01cda6 215 [#include <pthread.h>],
ef132d59
BI
216 [cpu_set_t cpuset;
217 pthread_attr_t attr;
218 pthread_getaffinity_np (pthread_self (), sizeof (cpu_set_t), &cpuset);
219 if (CPU_ISSET (0, &cpuset))
220 CPU_SET (1, &cpuset);
221 else
222 CPU_ZERO (&cpuset);
223 pthread_setaffinity_np (pthread_self (), sizeof (cpu_set_t), &cpuset);
224 pthread_attr_init (&attr);
225 pthread_attr_getaffinity_np (&attr, sizeof (cpu_set_t), &cpuset);
226 pthread_attr_setaffinity_np (&attr, sizeof (cpu_set_t), &cpuset);])],
227 AC_DEFINE(HAVE_PTHREAD_AFFINITY_NP, 1,
228[ Define if pthread_{,attr_}{g,s}etaffinity_np is supported.]))
229
7955b065
AI
230# Every c++ lib is linking by default with -nostdlib, which leads to the
231# fact, that proper pthread library will not be given at link time. We have
232# to hard-code that.
233case "${target}" in
234
235 *android*)
236 XLDFLAGS="$XLDFLAGS -lc"
237 ;;
238 *)
239 XLDFLAGS="$XLDFLAGS -lpthread"
240 ;;
241
242esac
243
244AC_SUBST(XCFLAGS)
245AC_SUBST(XLDFLAGS)
246
247CFLAGS="$save_CFLAGS"
b9487dd8
TB
248
249if test $enable_shared = yes; then
250 link_cilkrts="-lcilkrts %{static: $LIBS}"
251else
252 link_cilkrts="-lcilkrts $LIBS"
253fi
254AC_SUBST(link_cilkrts)
255
3c36aa6b
JJ
256# Determine what GCC version number to use in filesystem paths.
257GCC_BASE_VER
ef132d59 258
3038054c
BI
259# Must be last
260AC_OUTPUT