* bootstrap-lto.mk (BOOT_ADAFLAGS): Delete.
[deliverable/binutils-gdb.git] / config / cloog.m4
1 # This file is part of GCC.
2 #
3 # GCC is free software; you can redistribute it and/or modify it under
4 # the terms of the GNU General Public License as published by the Free
5 # Software Foundation; either version 3, or (at your option) any later
6 # version.
7 #
8 # GCC is distributed in the hope that it will be useful, but WITHOUT
9 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
11 # for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with GCC; see the file COPYING3. If not see
15 # <http://www.gnu.org/licenses/>.
16 #
17 # Contributed by Andreas Simbuerger <simbuerg@fim.uni-passau.de>
18
19 # CLOOG_INIT_FLAGS ()
20 # -------------------------
21 # Provide configure switches for CLooG support.
22 # Initialize clooglibs/clooginc according to the user input.
23 AC_DEFUN([CLOOG_INIT_FLAGS],
24 [
25 AC_ARG_WITH(cloog,
26 [AS_HELP_STRING(
27 [--with-cloog=PATH],
28 [Specify prefix directory for the installed CLooG-PPL package.
29 Equivalent to --with-cloog-include=PATH/include
30 plus --with-cloog-lib=PATH/lib])])
31 AC_ARG_WITH([cloog-include],
32 [AS_HELP_STRING(
33 [--with-cloog-include=PATH],
34 [Specify directory for installed CLooG include files])])
35 AC_ARG_WITH([cloog-lib],
36 [AS_HELP_STRING(
37 [--with-cloog-lib=PATH],
38 [Specify the directory for the installed CLooG library])])
39
40 AC_ARG_ENABLE(cloog-backend,
41 [AS_HELP_STRING(
42 [--enable-cloog-backend[[=BACKEND]]],
43 [set the CLooG BACKEND used to either isl, ppl or ppl-legacy (default)])],
44 [ if test "x${enableval}" = "xisl"; then
45 cloog_backend=isl
46 elif test "x${enableval}" = "xppl"; then
47 cloog_backend=ppl
48 else
49 cloog_backend=ppl-legacy
50 fi], cloog_backend=ppl-legacy)
51 AC_ARG_ENABLE(cloog-version-check,
52 [AS_HELP_STRING(
53 [--disable-cloog-version-check],
54 [disable check for CLooG version])],
55 ENABLE_CLOOG_CHECK=$enableval,
56 ENABLE_CLOOG_CHECK=yes)
57
58 # Initialize clooglibs and clooginc.
59 case $with_cloog in
60 no)
61 clooglibs=
62 clooginc=
63 ;;
64 "" | yes)
65 ;;
66 *)
67 clooglibs="-L$with_cloog/lib"
68 clooginc="-I$with_cloog/include"
69 ;;
70 esac
71 if test "x${with_cloog_include}" != x ; then
72 clooginc="-I$with_cloog_include"
73 fi
74 if test "x${with_cloog_lib}" != x; then
75 clooglibs="-L$with_cloog_lib"
76 fi
77
78 dnl Flags needed for CLOOG
79 AC_SUBST(clooglibs)
80 AC_SUBST(clooginc)
81 ]
82 )
83
84 # CLOOG_REQUESTED (ACTION-IF-REQUESTED, ACTION-IF-NOT)
85 # ----------------------------------------------------
86 # Provide actions for failed CLooG detection.
87 AC_DEFUN([CLOOG_REQUESTED],
88 [
89 AC_REQUIRE([CLOOG_INIT_FLAGS])
90
91 if test "x${with_cloog}" != x \
92 || test "x${with_cloog_include}" != x \
93 || test "x${with_cloog_lib}" != x ; then
94 $1
95 else
96 $2
97 fi
98 ]
99 )
100
101 # _CLOOG_ORG_PROG_ISL ()
102 # ------------------
103 # Helper for detecting CLooG.org's ISL backend.
104 m4_define([_CLOOG_ORG_PROG_ISL],[AC_LANG_PROGRAM(
105 [#include "cloog/cloog.h" ],
106 [cloog_version ()])])
107
108 # _CLOOG_ORG_PROG_PPL ()
109 # ------------------
110 # Helper for detecting CLooG.org's PPL backend.
111 m4_define([_CLOOG_ORG_PROG_PPL],[AC_LANG_PROGRAM(
112 [#include "cloog/cloog.h"
113 #include "cloog/ppl/cloog.h"],
114 [cloog_version ()])])
115
116 # _CLOOG_PPL_LEGACY_PROG ()
117 # -------------------------
118 # Helper for detecting CLooG-Legacy (CLooG-PPL).
119 m4_define([_CLOOG_PPL_LEGACY_PROG], [AC_LANG_PROGRAM(
120 [#include "cloog/cloog.h"],
121 [#ifndef CLOOG_PPL_BACKEND
122 choke me
123 #endif ])])
124
125 # CLOOG_FIND_FLAGS ()
126 # ------------------
127 # Detect the used CLooG-backend and set clooginc/clooglibs/cloog_org.
128 # Only look for the CLooG backend type specified in --enable-cloog-backend
129 AC_DEFUN([CLOOG_FIND_FLAGS],
130 [
131 AC_REQUIRE([CLOOG_INIT_FLAGS])
132
133 _cloog_saved_CFLAGS=$CFLAGS
134 _cloog_saved_CPPFLAGS=$CPPFLAGS
135 _cloog_saved_LDFLAGS=$LDFLAGS
136 _cloog_saved_LIBS=$LIBS
137
138 _cloogorginc="-DCLOOG_INT_GMP -DCLOOG_ORG"
139
140 dnl clooglibs & clooginc may have been initialized by CLOOG_INIT_FLAGS.
141 CFLAGS="${CFLAGS} ${clooginc} ${gmpinc}"
142 CPPFLAGS="${CPPFLAGS} ${_cloogorginc}"
143 LDFLAGS="${LDFLAGS} ${clooglibs}"
144
145 case $cloog_backend in
146 "ppl-legacy")
147 CFLAGS="${CFLAGS} ${pplinc}"
148 LDFLAGS="${LDFLAGS} ${ppllibs}"
149 AC_CACHE_CHECK([for installed CLooG PPL Legacy], [gcc_cv_cloog_type],
150 [LIBS="-lcloog ${_cloog_saved_LIBS}"
151 AC_LINK_IFELSE([_CLOOG_PPL_LEGACY_PROG], [gcc_cv_cloog_type="PPL Legacy"],
152 [gcc_cv_cloog_type=no])])
153 ;;
154 "isl")
155 AC_CACHE_CHECK([for installed CLooG ISL], [gcc_cv_cloog_type],
156 [LIBS="-lcloog-isl ${_cloog_saved_LIBS}"
157 AC_LINK_IFELSE([_CLOOG_ORG_PROG_ISL], [gcc_cv_cloog_type="ISL"],
158 [gcc_cv_cloog_type=no])])
159 ;;
160 "ppl")
161 CFLAGS="${CFLAGS} ${pplinc}"
162 LDFLAGS="${LDFLAGS} ${ppllibs}"
163 AC_CACHE_CHECK([for installed CLooG PPL], [gcc_cv_cloog_type],
164 [LIBS="-lcloog-ppl ${_cloog_saved_LIBS}"
165 AC_LINK_IFELSE([_CLOOG_ORG_PROG_PPL], [gcc_cv_cloog_type="PPL"],
166 [gcc_cv_cloog_type=no])])
167 ;;
168 *)
169 gcc_cv_cloog_type=""
170 esac
171
172 case $gcc_cv_cloog_type in
173 "PPL Legacy")
174 clooginc="${clooginc}"
175 clooglibs="${clooglibs} -lcloog"
176 cloog_org=no
177 ;;
178 "ISL")
179 clooginc="${clooginc} ${_cloogorginc}"
180 clooglibs="${clooglibs} -lcloog-isl"
181 cloog_org=yes
182 ;;
183 "PPL")
184 clooginc="${clooginc} ${_cloogorginc}"
185 clooglibs="${clooglibs} -lcloog-ppl"
186 cloog_org=yes
187 ;;
188 *)
189 clooglibs=
190 clooginc=
191 cloog_org=
192 ;;
193 esac
194
195 LIBS=$_cloog_saved_LIBS
196 CFLAGS=$_cloog_saved_CFLAGS
197 CPPFLAGS=$_cloog_saved_CPPFLAGS
198 LDFLAGS=$_cloog_saved_LDFLAGS
199 ]
200 )
201
202 # _CLOOG_CHECK_CT_PROG(MAJOR, MINOR, REVISION)
203 # --------------------------------------------
204 # Helper for verifying CLooG's compile time version.
205 m4_define([_CLOOG_CHECK_CT_PROG],[AC_LANG_PROGRAM(
206 [#include "cloog/cloog.h"],
207 [#if CLOOG_VERSION_MAJOR != $1 \
208 || CLOOG_VERSION_MINOR != $2 \
209 || CLOOG_VERSION_REVISION < $3
210 choke me
211 #endif])])
212
213 # _CLOOG_CHECK_RT_PROG ()
214 # -----------------------
215 # Helper for verifying that CLooG's compile time version
216 # matches the run time version.
217 m4_define([_CLOOG_CHECK_RT_PROG],[AC_LANG_PROGRAM(
218 [#include "cloog/cloog.h"],
219 [if ((cloog_version_major () != CLOOG_VERSION_MAJOR)
220 && (cloog_version_minor () != CLOOG_VERSION_MINOR)
221 && (cloog_version_revision () != CLOOG_VERSION_REVISION))
222 {
223 return 1;
224 }])])
225
226 # CLOOG_CHECK_VERSION CLOOG_CHECK_VERSION (MAJOR, MINOR, REVISION)
227 # ----------------------------------------------------------------
228 # Test the found CLooG to be exact of version MAJOR.MINOR and at least
229 # REVISION.
230 # If we're using the old CLooG-PPL (Legacy), the old version check will
231 # be executed (Ignores the provided version information).
232 AC_DEFUN([CLOOG_CHECK_VERSION],
233 [
234 AC_REQUIRE([CLOOG_FIND_FLAGS])
235
236 if test "${ENABLE_CLOOG_CHECK}" = yes ; then
237 _cloog_saved_CFLAGS=$CFLAGS
238 _cloog_saved_LDFLAGS=$LDFLAGS
239
240 CFLAGS="${_cloog_saved_CFLAGS} ${clooginc} ${pplinc} ${gmpinc}"
241 LDFLAGS="${_cloog_saved_LDFLAGS} ${clooglibs} ${ppllibs}"
242
243 if test "${cloog_org}" = yes ; then
244 AC_CACHE_CHECK([for version $1.$2.$3 of CLooG],
245 [gcc_cv_cloog_ct_0_14_0],
246 [AC_COMPILE_IFELSE([_CLOOG_CHECK_CT_PROG($1,$2,$3)],
247 [gcc_cv_cloog_ct_0_14_0=yes],
248 [gcc_cv_cloog_ct_0_14_0=no])])
249 elif test "${cloog_org}" = no ; then
250 AC_CACHE_CHECK([for version 0.15.5 (or later revision) of CLooG],
251 [gcc_cv_cloog_ct_0_15_5],
252 [AC_COMPILE_IFELSE([_CLOOG_CHECK_CT_PROG(0,15,5)],
253 [AC_COMPILE_IFELSE([_CLOOG_CHECK_CT_PROG(0,15,9)],
254 [gcc_cv_cloog_ct_0_15_5=yes],
255 [gcc_cv_cloog_ct_0_15_5="buggy but acceptable"])],
256 [gcc_cv_cloog_ct_0_15_5=no])])
257 fi
258
259 CFLAGS=$_cloog_saved_CFLAGS
260 LDFLAGS=$_cloog_saved_LDFLAGS
261 fi
262 ]
263 )
264
265 # CLOOG_IF_FAILED (ACTION-IF-FAILED)
266 # ----------------------------------
267 # Executes ACTION-IF-FAILED, if GRAPHITE was requested and
268 # the checks failed.
269 AC_DEFUN([CLOOG_IF_FAILED],
270 [
271 CLOOG_REQUESTED([graphite_requested=yes], [graphite_requested=no])
272
273 if test "${gcc_cv_cloog_ct_0_14_0}" = no \
274 || test "${gcc_cv_cloog_rt_0_14_0}" = no \
275 || test "${gcc_cv_cloog_ct_0_15_5}" = no; then
276 clooglibs=
277 clooginc=
278 fi
279
280 if test "${graphite_requested}" = yes \
281 && test "x${clooglibs}" = x \
282 && test "x${clooginc}" = x ; then
283 $1
284 fi
285 ]
286 )
This page took 0.041314 seconds and 4 git commands to generate.