Remove assert in get_def_bb_for_const
[official-gcc.git] / libcilkrts / configure.ac
blob39efeb4f532bcc1036f035b3fb0fbdb2cc9afece
1 #  Copyright (C) 2011-2016, Intel Corporation
2 #  All rights reserved.
3 #  
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 #  
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.
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.
45 AC_INIT([Cilk Runtime Library], [2.0], [cilk@intel.com])
46 AC_PREREQ([2.64])
48 # Needed to define ${target}.  Needs to be very early to avoid annoying
49 # warning about calling AC_ARG_PROGRAM before AC_CANONICAL_SYSTEM
50 AC_CANONICAL_SYSTEM
51 target_alias=${target_alias-$host_alias}
52 AC_SUBST(target_alias)
54 AM_INIT_AUTOMAKE(foreign no-dist)
56 AM_MAINTAINER_MODE
58 AM_ENABLE_MULTILIB(, ..)
60 # Test for GNU extensions. Will define _GNU_SOURCE if they're available
61 AC_USE_SYSTEM_EXTENSIONS
63 # Build a DLL on Windows
64 # AC_LIBTOOL_WIN32_DLL
65 AC_PROG_CC
66 AC_PROG_CXX
67 # AC_PROG_LIBTOOL
68 # AC_CONFIG_MACRO_DIR([..])
69 AC_CONFIG_FILES([Makefile libcilkrts.spec])
70 AC_FUNC_ALLOCA
72 # Check whether the target supports protected visibility.
73 save_CFLAGS="$CFLAGS"
74 CFLAGS="$CFLAGS -Werror"
75 AC_TRY_COMPILE([void __attribute__((visibility("protected"))) foo(void) { }],
76                [], libcilkrts_cv_have_attribute_visibility=yes,
77                libcilkrts_cv_have_attribute_visibility=no)
78 CFLAGS="$save_CFLAGS"
79 if test $libcilkrts_cv_have_attribute_visibility = yes; then
80   AC_DEFINE(HAVE_ATTRIBUTE_VISIBILITY, 1,
81     [Define to 1 if the target supports __attribute__((visibility(...))).])
84 # Get target configury.
85 . ${srcdir}/configure.tgt
86 if test -n "$UNSUPPORTED"; then
87    AC_MSG_ERROR([Configuration ${target} is unsupported.])
90 if test "${multilib}" = "yes"; then
91   multilib_arg="--enable-multilib"
92 else
93   multilib_arg=
96 AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
97 AC_ARG_ENABLE([version-specific-runtime-libs],
98   AC_HELP_STRING([--enable-version-specific-runtime-libs],
99                  [Specify that runtime libraries should be installed in a compi
100 ler-specific directory]),
101   [case "$enableval" in
102     yes) enable_version_specific_runtime_libs=yes ;;
103     no)  enable_version_specific_runtime_libs=no ;;
104     *)   AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs
105 ]);;
106    esac],
107   [enable_version_specific_runtime_libs=no])
108 AC_MSG_RESULT($enable_version_specific_runtime_libs)
111 # Calculate toolexeclibdir
112 # Also toolexecdir, though it's only used in toolexeclibdir
113 case ${enable_version_specific_runtime_libs} in
114   yes)
115     # Need the gcc compiler version to know where to install libraries
116     # and header files if --enable-version-specific-runtime-libs option
117     # is selected.
118     toolexecdir='$(libdir)/gcc/$(target_alias)'
119     toolexeclibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)'
120     ;;
121   no)
122     if test -n "$with_cross_host" &&
123        test x"$with_cross_host" != x"no"; then
124       # Install a library built with a cross compiler in tooldir, not libdir.
125       toolexecdir='$(exec_prefix)/$(target_alias)'
126       toolexeclibdir='$(toolexecdir)/lib'
127     else
128       toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
129       toolexeclibdir='$(libdir)'
130     fi
131     multi_os_directory=`$CC -print-multi-os-directory`
132     case $multi_os_directory in
133       .) ;; # Avoid trailing /.
134       *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
135     esac
136     ;;
137 esac
139 # Set config_dir based on the target.  config_dir specifies where to get
140 # target-specific files.  The generic implementation is incomplete, but
141 # contains information on what's needed
142 case "${target}" in
144   x86_64-*-*)
145     config_dir="x86"
146     ;;
148   i?86-*-*)
149     config_dir="x86"
150     ;;
152   arm-*-*)
153     config_dir="arm"
154     ;;
156   *)
157     config_dir="generic"
158     ;;
160 esac
161 AC_SUBST(config_dir)
163 # We have linker scripts for appropriate operating systems
164 linux_linker_script=no
165 case "${host}" in
166     *-*-linux*)
167         linux_linker_script=yes
168         ;;
169 esac
170 AM_CONDITIONAL(LINUX_LINKER_SCRIPT, test "$linux_linker_script" = "yes")
172 mac_linker_script=no
173 case "${host}" in
174     *-*-apple*)
175         mac_linker_script=yes
176         ;;
177 esac
178 AM_CONDITIONAL(MAC_LINKER_SCRIPT, test "$mac_linker_script" = "yes")
180 AC_LIBTOOL_DLOPEN
181 AM_PROG_LIBTOOL
182 AC_SUBST(toolexecdir)
183 AC_SUBST(toolexeclibdir)
185 AC_SUBST(lt_cv_dlopen_libs)
187 # Check to see if -pthread or -lpthread is needed.  Prefer the former.
188 # Note that the CILK_SELF_SPEC in gcc.c may force -pthread.
189 # In case the pthread.h system header is not found, this test will fail.
190 XCFLAGS=""
191 XLDFLAGS=""
192 CFLAGS="$CFLAGS -pthread"
193 AC_LINK_IFELSE(
194  [AC_LANG_PROGRAM(
195   [#include <pthread.h>
196    void *g(void *d) { return NULL; }],
197   [pthread_t t; pthread_create(&t,NULL,g,NULL);])],
198  [XCFLAGS=" -Wc,-pthread"],
199  [CFLAGS="$save_CFLAGS" LIBS="-lpthread $LIBS"
200   AC_LINK_IFELSE(
201    [AC_LANG_PROGRAM(
202     [#include <pthread.h>
203      void *g(void *d) { return NULL; }],
204     [pthread_t t; pthread_create(&t,NULL,g,NULL);])],
205    [],
206    [AC_MSG_ERROR([Pthreads are required to build libcilkrts])])])
208 # Check for pthread_{,attr_}[sg]etaffinity_np.
209 AC_LINK_IFELSE(
210  [AC_LANG_PROGRAM(
211   [#include <pthread.h>],
212   [cpu_set_t cpuset;
213    pthread_attr_t attr;
214    pthread_getaffinity_np (pthread_self (), sizeof (cpu_set_t), &cpuset);
215    if (CPU_ISSET (0, &cpuset))
216      CPU_SET (1, &cpuset);
217    else
218      CPU_ZERO (&cpuset);
219    pthread_setaffinity_np (pthread_self (), sizeof (cpu_set_t), &cpuset);
220    pthread_attr_init (&attr);
221    pthread_attr_getaffinity_np (&attr, sizeof (cpu_set_t), &cpuset);
222    pthread_attr_setaffinity_np (&attr, sizeof (cpu_set_t), &cpuset);])],
223   AC_DEFINE(HAVE_PTHREAD_AFFINITY_NP, 1,
224 [       Define if pthread_{,attr_}{g,s}etaffinity_np is supported.]))
226 # Every c++ lib is linking by default with -nostdlib, which leads to the
227 # fact, that proper pthread library will not be given at link time. We have
228 # to hard-code that.
229 case "${target}" in
231   *android*)
232     XLDFLAGS="$XLDFLAGS -lc"
233      ;;
234   *)
235     XLDFLAGS="$XLDFLAGS -lpthread"
236     ;;
238 esac
240 AC_SUBST(XCFLAGS)
241 AC_SUBST(XLDFLAGS)
243 CFLAGS="$save_CFLAGS"
245 if test $enable_shared = yes; then
246   link_cilkrts="-lcilkrts %{static: $LIBS}"
247 else
248   link_cilkrts="-lcilkrts $LIBS"
250 AC_SUBST(link_cilkrts)
253 # Must be last
254 AC_OUTPUT