OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [config/] [cloog.m4] - Blame information for rev 860

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 722 jeremybenn
# 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}" = xno; then
92
    $2
93
  elif test "x${with_cloog}" != x \
94
    || test "x${with_cloog_include}" != x \
95
    || test "x${with_cloog_lib}" != x ; then
96
    $1
97
  else
98
    $2
99
  fi
100
]
101
)
102
 
103
# _CLOOG_ORG_PROG_ISL ()
104
# ------------------
105
# Helper for detecting CLooG.org's ISL backend.
106
m4_define([_CLOOG_ORG_PROG_ISL],[AC_LANG_PROGRAM(
107
  [#include "cloog/cloog.h" ],
108
  [cloog_version ()])])
109
 
110
# _CLOOG_ORG_PROG_PPL ()
111
# ------------------
112
# Helper for detecting CLooG.org's PPL backend.
113
m4_define([_CLOOG_ORG_PROG_PPL],[AC_LANG_PROGRAM(
114
  [#include "cloog/cloog.h"
115
   #include "cloog/ppl/cloog.h"],
116
  [cloog_version ()])])
117
 
118
# _CLOOG_PPL_LEGACY_PROG ()
119
# -------------------------
120
# Helper for detecting CLooG-Legacy (CLooG-PPL).
121
m4_define([_CLOOG_PPL_LEGACY_PROG], [AC_LANG_PROGRAM(
122
  [#include "cloog/cloog.h"],
123
  [#ifndef CLOOG_PPL_BACKEND
124
    choke me
125
   #endif ])])
126
 
127
# CLOOG_FIND_FLAGS ()
128
# ------------------
129
# Detect the used CLooG-backend and set clooginc/clooglibs/cloog_org.
130
# Only look for the CLooG backend type specified in --enable-cloog-backend
131
AC_DEFUN([CLOOG_FIND_FLAGS],
132
[
133
  AC_REQUIRE([CLOOG_INIT_FLAGS])
134
 
135
  _cloog_saved_CFLAGS=$CFLAGS
136
  _cloog_saved_CPPFLAGS=$CPPFLAGS
137
  _cloog_saved_LDFLAGS=$LDFLAGS
138
  _cloog_saved_LIBS=$LIBS
139
 
140
  _cloogorginc="-DCLOOG_INT_GMP -DCLOOG_ORG"
141
 
142
  dnl clooglibs & clooginc may have been initialized by CLOOG_INIT_FLAGS.
143
  CFLAGS="${CFLAGS} ${clooginc} ${gmpinc}"
144
  CPPFLAGS="${CPPFLAGS} ${_cloogorginc}"
145
  LDFLAGS="${LDFLAGS} ${clooglibs}"
146
 
147
  case $cloog_backend in
148
    "ppl-legacy")
149
    CFLAGS="${CFLAGS} ${pplinc}"
150
    LDFLAGS="${LDFLAGS} ${ppllibs}"
151
    AC_CACHE_CHECK([for installed CLooG PPL Legacy], [gcc_cv_cloog_type],
152
      [LIBS="-lcloog ${_cloog_saved_LIBS}"
153
      AC_LINK_IFELSE([_CLOOG_PPL_LEGACY_PROG], [gcc_cv_cloog_type="PPL Legacy"],
154
                     [gcc_cv_cloog_type=no])])
155
    ;;
156
    "isl")
157
    AC_CACHE_CHECK([for installed CLooG ISL], [gcc_cv_cloog_type],
158
      [LIBS="-lcloog-isl ${_cloog_saved_LIBS}"
159
      AC_LINK_IFELSE([_CLOOG_ORG_PROG_ISL], [gcc_cv_cloog_type="ISL"],
160
                     [gcc_cv_cloog_type=no])])
161
    ;;
162
    "ppl")
163
    CFLAGS="${CFLAGS} ${pplinc}"
164
    LDFLAGS="${LDFLAGS} ${ppllibs}"
165
    AC_CACHE_CHECK([for installed CLooG PPL], [gcc_cv_cloog_type],
166
      [LIBS="-lcloog-ppl ${_cloog_saved_LIBS}"
167
      AC_LINK_IFELSE([_CLOOG_ORG_PROG_PPL], [gcc_cv_cloog_type="PPL"],
168
                     [gcc_cv_cloog_type=no])])
169
    ;;
170
    *)
171
      gcc_cv_cloog_type=""
172
  esac
173
 
174
  case $gcc_cv_cloog_type in
175
    "PPL Legacy")
176
      clooginc="${clooginc}"
177
      clooglibs="${clooglibs} -lcloog"
178
      cloog_org=no
179
      ;;
180
    "ISL")
181
      clooginc="${clooginc} ${_cloogorginc}"
182
      clooglibs="${clooglibs} -lcloog-isl -lisl"
183
      cloog_org=yes
184
      ;;
185
    "PPL")
186
      clooginc="${clooginc} ${_cloogorginc}"
187
      clooglibs="${clooglibs} -lcloog-ppl"
188
      cloog_org=yes
189
      ;;
190
    *)
191
      clooglibs=
192
      clooginc=
193
      cloog_org=
194
      ;;
195
  esac
196
 
197
  LIBS=$_cloog_saved_LIBS
198
  CFLAGS=$_cloog_saved_CFLAGS
199
  CPPFLAGS=$_cloog_saved_CPPFLAGS
200
  LDFLAGS=$_cloog_saved_LDFLAGS
201
]
202
)
203
 
204
# _CLOOG_CHECK_CT_PROG(MAJOR, MINOR, REVISION)
205
# --------------------------------------------
206
# Helper for verifying CLooG's compile time version.
207
m4_define([_CLOOG_CHECK_CT_PROG],[AC_LANG_PROGRAM(
208
  [#include "cloog/cloog.h"],
209
  [#if CLOOG_VERSION_MAJOR != $1 \
210
    || CLOOG_VERSION_MINOR != $2 \
211
    || CLOOG_VERSION_REVISION < $3
212
    choke me
213
   #endif])])
214
 
215
# _CLOOG_CHECK_RT_PROG ()
216
# -----------------------
217
# Helper for verifying that CLooG's compile time version
218
# matches the run time version.
219
m4_define([_CLOOG_CHECK_RT_PROG],[AC_LANG_PROGRAM(
220
  [#include "cloog/cloog.h"],
221
  [if ((cloog_version_major () != CLOOG_VERSION_MAJOR)
222
    && (cloog_version_minor () != CLOOG_VERSION_MINOR)
223
    && (cloog_version_revision () != CLOOG_VERSION_REVISION))
224
    {
225
      return 1;
226
    }])])
227
 
228
# CLOOG_CHECK_VERSION CLOOG_CHECK_VERSION (MAJOR, MINOR, REVISION)
229
# ----------------------------------------------------------------
230
# Test the found CLooG to be exact of version MAJOR.MINOR and at least
231
# REVISION.
232
# If we're using the old CLooG-PPL (Legacy), the old version check will
233
# be executed (Ignores the provided version information).
234
AC_DEFUN([CLOOG_CHECK_VERSION],
235
[
236
  AC_REQUIRE([CLOOG_FIND_FLAGS])
237
 
238
  if test "${ENABLE_CLOOG_CHECK}" = yes ; then
239
    _cloog_saved_CFLAGS=$CFLAGS
240
    _cloog_saved_LDFLAGS=$LDFLAGS
241
 
242
    CFLAGS="${_cloog_saved_CFLAGS} ${clooginc} ${pplinc} ${gmpinc}"
243
    LDFLAGS="${_cloog_saved_LDFLAGS} ${clooglibs} ${ppllibs}"
244
 
245
    if test "${cloog_org}" = yes ; then
246
      AC_CACHE_CHECK([for version $1.$2.$3 of CLooG],
247
        [gcc_cv_cloog_ct_0_14_0],
248
        [AC_COMPILE_IFELSE([_CLOOG_CHECK_CT_PROG($1,$2,$3)],
249
          [gcc_cv_cloog_ct_0_14_0=yes],
250
          [gcc_cv_cloog_ct_0_14_0=no])])
251
    elif test "${cloog_org}" = no ; then
252
      AC_CACHE_CHECK([for version 0.15.5 (or later revision) of CLooG],
253
        [gcc_cv_cloog_ct_0_15_5],
254
        [AC_COMPILE_IFELSE([_CLOOG_CHECK_CT_PROG(0,15,5)],
255
          [AC_COMPILE_IFELSE([_CLOOG_CHECK_CT_PROG(0,15,9)],
256
           [gcc_cv_cloog_ct_0_15_5=yes],
257
            [gcc_cv_cloog_ct_0_15_5="buggy but acceptable"])],
258
          [gcc_cv_cloog_ct_0_15_5=no])])
259
    fi
260
 
261
    CFLAGS=$_cloog_saved_CFLAGS
262
    LDFLAGS=$_cloog_saved_LDFLAGS
263
  fi
264
]
265
)
266
 
267
# CLOOG_IF_FAILED (ACTION-IF-FAILED)
268
# ----------------------------------
269
# Executes ACTION-IF-FAILED, if GRAPHITE was requested and
270
# the checks failed.
271
AC_DEFUN([CLOOG_IF_FAILED],
272
[
273
  CLOOG_REQUESTED([graphite_requested=yes], [graphite_requested=no])
274
 
275
  if test "${gcc_cv_cloog_ct_0_14_0}" = no \
276
    || test "${gcc_cv_cloog_rt_0_14_0}" = no \
277
    || test "${gcc_cv_cloog_ct_0_15_5}" = no; then
278
    clooglibs=
279
    clooginc=
280
  fi
281
 
282
  if test "${graphite_requested}" = yes \
283
    && test "x${clooglibs}" = x \
284
    && test "x${clooginc}" = x ; then
285
    $1
286
  fi
287
]
288
)

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.