check functionality of isl version 0.12
[gcc.git] / config / isl.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 Richard Guenther <rguenther@suse.de>
18 # Based on cloog.m4
19
20 # ISL_INIT_FLAGS ()
21 # -------------------------
22 # Provide configure switches for ISL support.
23 # Initialize isllibs/islinc according to the user input.
24 AC_DEFUN([ISL_INIT_FLAGS],
25 [
26 AC_ARG_WITH([isl-include],
27 [AS_HELP_STRING(
28 [--with-isl-include=PATH],
29 [Specify directory for installed ISL include files])])
30 AC_ARG_WITH([isl-lib],
31 [AS_HELP_STRING(
32 [--with-isl-lib=PATH],
33 [Specify the directory for the installed ISL library])])
34
35 AC_ARG_ENABLE(isl-version-check,
36 [AS_HELP_STRING(
37 [--disable-isl-version-check],
38 [disable check for ISL version])],
39 ENABLE_ISL_CHECK=$enableval,
40 ENABLE_ISL_CHECK=yes)
41
42 # Initialize isllibs and islinc.
43 case $with_isl in
44 no)
45 isllibs=
46 islinc=
47 ;;
48 "" | yes)
49 ;;
50 *)
51 isllibs="-L$with_isl/lib"
52 islinc="-I$with_isl/include"
53 ;;
54 esac
55 if test "x${with_isl_include}" != x ; then
56 islinc="-I$with_isl_include"
57 fi
58 if test "x${with_isl_lib}" != x; then
59 isllibs="-L$with_isl_lib"
60 fi
61 dnl If no --with-isl flag was specified and there is in-tree ISL
62 dnl source, set up flags to use that and skip any version tests
63 dnl as we cannot run them before building ISL.
64 if test "x${islinc}" = x && test "x${isllibs}" = x \
65 && test -d ${srcdir}/isl; then
66 isllibs='-L$$r/$(HOST_SUBDIR)/isl/'"$lt_cv_objdir"' '
67 islinc='-I$$r/$(HOST_SUBDIR)/isl/include -I$$s/isl/include'
68 ENABLE_ISL_CHECK=no
69 AC_MSG_WARN([using in-tree ISL, disabling version check])
70 fi
71
72 islinc="-DCLOOG_INT_GMP ${islinc}"
73 isllibs="${isllibs} -lisl"
74 ]
75 )
76
77 # ISL_REQUESTED (ACTION-IF-REQUESTED, ACTION-IF-NOT)
78 # ----------------------------------------------------
79 # Provide actions for failed ISL detection.
80 AC_DEFUN([ISL_REQUESTED],
81 [
82 AC_REQUIRE([ISL_INIT_FLAGS])
83
84 if test "x${with_isl}" = xno; then
85 $2
86 elif test "x${with_isl}" != x \
87 || test "x${with_isl_include}" != x \
88 || test "x${with_isl_lib}" != x ; then
89 $1
90 else
91 $2
92 fi
93 ]
94 )
95
96 # ISL_CHECK_VERSION ISL_CHECK_VERSION ()
97 # ----------------------------------------------------------------
98 # Test that ISL contains functionality added to the minimum expected version.
99 AC_DEFUN([ISL_CHECK_VERSION],
100 [
101 if test "${ENABLE_ISL_CHECK}" = yes ; then
102 _isl_saved_CFLAGS=$CFLAGS
103 _isl_saved_LDFLAGS=$LDFLAGS
104 _isl_saved_LIBS=$LIBS
105
106 CFLAGS="${_isl_saved_CFLAGS} ${islinc} ${gmpinc}"
107 LDFLAGS="${_isl_saved_LDFLAGS} ${isllibs}"
108 LIBS="${_isl_saved_LIBS} -lisl"
109
110 AC_MSG_CHECKING([for compatible ISL])
111 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <isl/val.h>]], [[;]])],
112 [gcc_cv_isl=yes],
113 [gcc_cv_isl=no])
114 AC_MSG_RESULT([$gcc_cv_isl])
115
116 CFLAGS=$_isl_saved_CFLAGS
117 LDFLAGS=$_isl_saved_LDFLAGS
118 LIBS=$_isl_saved_LIBS
119 fi
120 ]
121 )
122
123 # ISL_IF_FAILED (ACTION-IF-FAILED)
124 # ----------------------------------
125 # Executes ACTION-IF-FAILED, if GRAPHITE was requested and
126 # the checks failed.
127 AC_DEFUN([ISL_IF_FAILED],
128 [
129 ISL_REQUESTED([graphite_requested=yes], [graphite_requested=no])
130
131 if test "${gcc_cv_isl}" = no ; then
132 isllibs=
133 islinc=
134 fi
135
136 if test "${graphite_requested}" = yes \
137 && test "x${isllibs}" = x \
138 && test "x${islinc}" = x ; then
139 $1
140 fi
141 ]
142 )