]>
Commit | Line | Data |
---|---|---|
e552509b ILT |
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 <[email protected]> | |
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 | [ | |
e552509b ILT |
25 | AC_ARG_WITH([cloog-include], |
26 | [AS_HELP_STRING( | |
27 | [--with-cloog-include=PATH], | |
28 | [Specify directory for installed CLooG include files])]) | |
29 | AC_ARG_WITH([cloog-lib], | |
30 | [AS_HELP_STRING( | |
31 | [--with-cloog-lib=PATH], | |
32 | [Specify the directory for the installed CLooG library])]) | |
33 | ||
e552509b ILT |
34 | AC_ARG_ENABLE(cloog-version-check, |
35 | [AS_HELP_STRING( | |
36 | [--disable-cloog-version-check], | |
37 | [disable check for CLooG version])], | |
38 | ENABLE_CLOOG_CHECK=$enableval, | |
39 | ENABLE_CLOOG_CHECK=yes) | |
40 | ||
41 | # Initialize clooglibs and clooginc. | |
42 | case $with_cloog in | |
43 | no) | |
44 | clooglibs= | |
45 | clooginc= | |
46 | ;; | |
47 | "" | yes) | |
48 | ;; | |
49 | *) | |
50 | clooglibs="-L$with_cloog/lib" | |
51 | clooginc="-I$with_cloog/include" | |
52 | ;; | |
53 | esac | |
54 | if test "x${with_cloog_include}" != x ; then | |
55 | clooginc="-I$with_cloog_include" | |
56 | fi | |
57 | if test "x${with_cloog_lib}" != x; then | |
58 | clooglibs="-L$with_cloog_lib" | |
59 | fi | |
3a98824c AM |
60 | dnl If no --with-cloog flag was specified and there is in-tree CLooG |
61 | dnl source, set up flags to use that and skip any version tests | |
62 | dnl as we cannot run them reliably before building CLooG | |
7ec59b9e L |
63 | if test "x${clooginc}" = x && test "x${clooglibs}" = x \ |
64 | && test -d ${srcdir}/cloog; then | |
65 | clooglibs='-L$$r/$(HOST_SUBDIR)/cloog/'"$lt_cv_objdir"' ' | |
66 | clooginc='-I$$r/$(HOST_SUBDIR)/cloog/include -I$$s/cloog/include -I'${srcdir}'/cloog/include ' | |
3a98824c AM |
67 | ENABLE_CLOOG_CHECK=no |
68 | AC_MSG_WARN([using in-tree CLooG, disabling version check]) | |
7ec59b9e L |
69 | fi |
70 | ||
71 | clooginc="-DCLOOG_INT_GMP ${clooginc}" | |
0dab2e31 | 72 | clooglibs="${clooglibs} -lcloog-isl ${isllibs} -lisl" |
e552509b ILT |
73 | ] |
74 | ) | |
75 | ||
76 | # CLOOG_REQUESTED (ACTION-IF-REQUESTED, ACTION-IF-NOT) | |
77 | # ---------------------------------------------------- | |
78 | # Provide actions for failed CLooG detection. | |
79 | AC_DEFUN([CLOOG_REQUESTED], | |
80 | [ | |
81 | AC_REQUIRE([CLOOG_INIT_FLAGS]) | |
82 | ||
8d8eef9a RW |
83 | if test "x${with_cloog}" = xno; then |
84 | $2 | |
85 | elif test "x${with_cloog}" != x \ | |
e552509b ILT |
86 | || test "x${with_cloog_include}" != x \ |
87 | || test "x${with_cloog_lib}" != x ; then | |
88 | $1 | |
89 | else | |
90 | $2 | |
91 | fi | |
92 | ] | |
93 | ) | |
94 | ||
e552509b ILT |
95 | # _CLOOG_CHECK_CT_PROG(MAJOR, MINOR, REVISION) |
96 | # -------------------------------------------- | |
97 | # Helper for verifying CLooG's compile time version. | |
98 | m4_define([_CLOOG_CHECK_CT_PROG],[AC_LANG_PROGRAM( | |
7ec59b9e | 99 | [#include "cloog/version.h"], |
e552509b ILT |
100 | [#if CLOOG_VERSION_MAJOR != $1 \ |
101 | || CLOOG_VERSION_MINOR != $2 \ | |
102 | || CLOOG_VERSION_REVISION < $3 | |
103 | choke me | |
104 | #endif])]) | |
105 | ||
e552509b ILT |
106 | # CLOOG_CHECK_VERSION CLOOG_CHECK_VERSION (MAJOR, MINOR, REVISION) |
107 | # ---------------------------------------------------------------- | |
108 | # Test the found CLooG to be exact of version MAJOR.MINOR and at least | |
109 | # REVISION. | |
e552509b ILT |
110 | AC_DEFUN([CLOOG_CHECK_VERSION], |
111 | [ | |
7ec59b9e | 112 | AC_REQUIRE([CLOOG_INIT_FLAGS]) |
e552509b ILT |
113 | |
114 | if test "${ENABLE_CLOOG_CHECK}" = yes ; then | |
115 | _cloog_saved_CFLAGS=$CFLAGS | |
116 | _cloog_saved_LDFLAGS=$LDFLAGS | |
117 | ||
7ec59b9e L |
118 | CFLAGS="${_cloog_saved_CFLAGS} ${clooginc} ${islinc} ${gmpinc}" |
119 | LDFLAGS="${_cloog_saved_LDFLAGS} ${clooglibs} ${isllibs} ${gmplib}" | |
e552509b | 120 | |
3a98824c AM |
121 | AC_MSG_CHECKING([for version $1.$2.$3 of CLooG]) |
122 | AC_COMPILE_IFELSE([_CLOOG_CHECK_CT_PROG($1,$2,$3)], | |
7ec59b9e | 123 | [gcc_cv_cloog=yes], |
3a98824c AM |
124 | [gcc_cv_cloog=no]) |
125 | AC_MSG_RESULT([$gcc_cv_cloog]) | |
e552509b ILT |
126 | |
127 | CFLAGS=$_cloog_saved_CFLAGS | |
128 | LDFLAGS=$_cloog_saved_LDFLAGS | |
129 | fi | |
130 | ] | |
131 | ) | |
132 | ||
133 | # CLOOG_IF_FAILED (ACTION-IF-FAILED) | |
134 | # ---------------------------------- | |
135 | # Executes ACTION-IF-FAILED, if GRAPHITE was requested and | |
136 | # the checks failed. | |
137 | AC_DEFUN([CLOOG_IF_FAILED], | |
138 | [ | |
139 | CLOOG_REQUESTED([graphite_requested=yes], [graphite_requested=no]) | |
140 | ||
7ec59b9e | 141 | if test "${gcc_cv_cloog}" = no ; then |
e552509b ILT |
142 | clooglibs= |
143 | clooginc= | |
144 | fi | |
145 | ||
146 | if test "${graphite_requested}" = yes \ | |
147 | && test "x${clooglibs}" = x \ | |
148 | && test "x${clooginc}" = x ; then | |
149 | $1 | |
150 | fi | |
151 | ] | |
152 | ) |