This fixes PR gcov-profile/54487 where the gcda files were not locked
[official-gcc.git] / config / cloog.m4
bloba92ef2ea7bd7e615fd8e86e73eeb861ec8550e2c
1 # This file is part of GCC.
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.
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.
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/>.
17 # Contributed by Andreas Simbuerger <simbuerg@fim.uni-passau.de>
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],
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])])
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
60   dnl If no --with-cloog flag was specified and there is in-tree ClooG
61   dnl source, set up flags to use that.
62   if test "x${clooginc}" = x && test "x${clooglibs}" = x \
63      && test -d ${srcdir}/cloog; then
64      clooglibs='-L$$r/$(HOST_SUBDIR)/cloog/'"$lt_cv_objdir"' '
65      clooginc='-I$$r/$(HOST_SUBDIR)/cloog/include -I$$s/cloog/include -I'${srcdir}'/cloog/include '
66   fi
68   clooginc="-DCLOOG_INT_GMP ${clooginc}"
69   clooglibs="${clooglibs} -lcloog-isl ${isllibs} -lisl"
73 # CLOOG_REQUESTED (ACTION-IF-REQUESTED, ACTION-IF-NOT)
74 # ----------------------------------------------------
75 # Provide actions for failed CLooG detection.
76 AC_DEFUN([CLOOG_REQUESTED],
78   AC_REQUIRE([CLOOG_INIT_FLAGS])
80   if test "x${with_cloog}" = xno; then
81     $2
82   elif test "x${with_cloog}" != x \
83     || test "x${with_cloog_include}" != x \
84     || test "x${with_cloog_lib}" != x ; then
85     $1
86   else
87     $2
88   fi
92 # _CLOOG_CHECK_CT_PROG(MAJOR, MINOR, REVISION)
93 # --------------------------------------------
94 # Helper for verifying CLooG's compile time version.
95 m4_define([_CLOOG_CHECK_CT_PROG],[AC_LANG_PROGRAM(
96   [#include "cloog/version.h"],
97   [#if CLOOG_VERSION_MAJOR != $1 \
98     || CLOOG_VERSION_MINOR != $2 \
99     || CLOOG_VERSION_REVISION < $3
100     choke me
101    #endif])])
103 # CLOOG_CHECK_VERSION CLOOG_CHECK_VERSION (MAJOR, MINOR, REVISION)
104 # ----------------------------------------------------------------
105 # Test the found CLooG to be exact of version MAJOR.MINOR and at least
106 # REVISION.
107 AC_DEFUN([CLOOG_CHECK_VERSION],
109   AC_REQUIRE([CLOOG_INIT_FLAGS])
111   if test "${ENABLE_CLOOG_CHECK}" = yes ; then
112     _cloog_saved_CFLAGS=$CFLAGS
113     _cloog_saved_LDFLAGS=$LDFLAGS
115     CFLAGS="${_cloog_saved_CFLAGS} ${clooginc} ${islinc} ${gmpinc}"
116     LDFLAGS="${_cloog_saved_LDFLAGS} ${clooglibs} ${isllibs} ${gmplib}"
118     AC_CACHE_CHECK([for version $1.$2.$3 of CLooG],
119       [gcc_cv_cloog],
120       [AC_COMPILE_IFELSE([_CLOOG_CHECK_CT_PROG($1,$2,$3)],
121         [gcc_cv_cloog=yes],
122         [gcc_cv_cloog=no])])
124     CFLAGS=$_cloog_saved_CFLAGS
125     LDFLAGS=$_cloog_saved_LDFLAGS
126   fi
130 # CLOOG_IF_FAILED (ACTION-IF-FAILED)
131 # ----------------------------------
132 # Executes ACTION-IF-FAILED, if GRAPHITE was requested and
133 # the checks failed.
134 AC_DEFUN([CLOOG_IF_FAILED],
136   CLOOG_REQUESTED([graphite_requested=yes], [graphite_requested=no])
137   
138   if test "${gcc_cv_cloog}" = no ; then
139     clooglibs=
140     clooginc=
141   fi
143   if test "${graphite_requested}" = yes \
144     && test "x${clooglibs}" = x \
145     && test "x${clooginc}" = x ; then
146     $1
147   fi