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