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