This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Support official CLooG.org versions.


Changes to previous patch:
  * Refactored CLooG-Checks in their own .m4 file (config/cloog.m4).
  * Switched back from ${var+name} = name notation to "x${var}" != x.

Add support for official CLooG releases.
CLooG's configuration gets detected within 2 stages:

Stage 1: Detect the installed CLooG version.
  This is done by linking test programs against the various
  CLooG libraries. As CLooG's library sonames depend on the
  used backend, this is sufficient to detect the used backend.

  We only detect this backends, in order:
    1) CLooG-PPL (Legacy): The "old" CLooG.
    2) CLooG-ISL: The "new" CLooG.
    3) CLooG-Parma: An alternative backend, to compare it with
    CLooG-ISL.

  CLooG-Poly is not detected, as the PolyLib may conflict
  with GCC's license.

Stage 2: Version checks.
  After detecting the right configuration, we finally check
  if the installed version is usable. There are 2 different
  checks: One for CLooG-PPL (Legacy) and one for CLooG-ISL.

  * CLooG-ISL:
    As the "new" CLooG provides methods to check for its version at
    both compile and run time, we use this feature. First
    we check for the constants to verify the header's compatibility.
    Finally we verify the compatibility of our headers with
    the library that will get linked with GCC.
    As stated in autoconf's documentation, the run time check
    is not usable when cross-compiling, so we skip this check
    then.

  * CLooG-PPL (Legacy):
    This version check provides the same semantics as before.
    As CLooG-PPL (Legacy) provides the same constants as the
    official CLooG, we can use the same test program for the
    compile time check.

Tested with CLooG-ISL and CLooG-PPL (Legacy).
As for now, CLooG-Parma fails to build.

2010-08-11  Andreas Simbuerger  <simbuerg@fim.uni-passau.de>

	* configure.ac: Support official CLooG.org versions.
	* configure: Regenerate.
	* config/cloog.m4: New.
---
 ChangeLog.graphite |    6 +
 config/cloog.m4    |  189 +++++++++++++++++++++++++
 configure          |  392 ++++++++++++++++++++++++++++++++++++++++------------
 configure.ac       |   70 ++++------
 4 files changed, 530 insertions(+), 127 deletions(-)
 create mode 100644 config/cloog.m4

diff --git a/ChangeLog.graphite b/ChangeLog.graphite
index b9d0723..c797dd3 100644
--- a/ChangeLog.graphite
+++ b/ChangeLog.graphite
@@ -1,3 +1,9 @@
+2010-08-11  Andreas Simbuerger  <simbuerg@fim.uni-passau.de>
+
+	* configure.ac: Support official CLooG.org versions.
+	* configure: Regenerate.
+	* config/cloog.m4: New.
+
 2010-09-24  Sebastian Pop  <sebastian.pop@amd.com>
 
 	* Merge from mainline (163495:164578).
diff --git a/config/cloog.m4 b/config/cloog.m4
new file mode 100644
index 0000000..a435f8e
--- /dev/null
+++ b/config/cloog.m4
@@ -0,0 +1,189 @@
+dnl Copyright (C) 2010 Free Software Foundation, Inc.
+dnl This file is free software, distributed under the terms of the GNU
+dnl General Public License.  As a special exception to the GNU General
+dnl Public License, this file may be distributed as part of a program
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
+
+dnl From Andreas Simbuerger.
+
+dnl Test program for detecting CLooG.org's backend.
+m4_define([CLOOG_ORG_PROG],[AC_LANG_PROGRAM(
+  [#include <cloog/cloog.h>],
+  [cloog_version ()])])
+
+dnl Test program for detecting CLooG-Legacy (CLooG-PPL).
+m4_define([CLOOG_PPL_LEGACY_PROG], [AC_LANG_PROGRAM(
+  [#include <cloog/cloog.h>],
+  [ppl_version_major ()])])
+
+dnl Test CLooG's version (compile time).
+m4_define([CLOOG_CHECK_CT_PROG],[AC_LANG_PROGRAM(
+  [#include "cloog/cloog.h"],
+  [#if CLOOG_VERSION_MAJOR != $1 \
+    || CLOOG_VERSION_MINOR != $2 \
+    || CLOOG_VERSION_REVISION < $3
+    choke me
+   #endif])])
+
+dnl Test CLooG's version (run time).
+m4_define([CLOOG_CHECK_RT_PROG],[AC_LANG_PROGRAM(
+  [#include <stdlib.h>
+   #include "cloog/cloog.h"],
+  [if ((cloog_version_major () != CLOOG_VERSION_MAJOR)
+    && (cloog_version_minor () != CLOOG_VERSION_MINOR)
+    && (cloog_version_revision () != CLOOG_VERSION_REVISION))
+    {
+      exit (1);
+    }])])
+
+dnl Initialize clooglibs/clooginc according to the user input.
+AC_DEFUN([CLOOG_INIT_FLAGS],
+[
+  case $with_cloog in
+    no)
+      clooglibs=
+      clooginc=
+      ;;
+    "" | yes)
+      ;;
+    *)
+      clooglibs="-L$with_cloog/lib"
+      clooginc="-I$with_cloog/include"
+      ;;
+  esac
+  if test "x${with_cloog_include}" != x ; then
+    clooginc="-I$with_cloog_include"
+  fi
+  if test "x${with_cloog_lib}" != x; then
+    clooglibs="-L$with_cloog_lib"
+  fi
+  if test "x${with_cloog}" != x && test "x${with_cloog_include}" != x \
+    && test "x${with_cloog_lib}" != x && test -d ${srcdir}/cloog; then
+    clooglibs='-L$$r/$(HOST_SUBDIR)/cloog/'"$lt_cv_objdir"' '
+    clooginc='-I$$r/$(HOST_SUBDIR)/cloog/include -I$$s/cloog/include '
+    enable_cloog_version_check=no
+  fi
+]
+)
+
+dnl CLOOG_REQUESTED([ACTION-IF-REQUESTED], [ACTION-IF-NOT])
+AC_DEFUN([CLOOG_REQUESTED],
+[
+  if test "x${with_cloog}" != x \
+    || test "x${with_cloog_include}" != x \
+    || test "x${with_cloog_lib}" != x ; then
+    $1
+  else
+    $2
+  fi
+]
+)
+
+dnl Detect the used CLooG-backend and set clooginc/clooglibs/cloog_org.
+dnl Preference: CLooG-PPL (Legacy) > CLooG-ISL > CLooG-PPL
+AC_DEFUN([CLOOG_SET_FLAGS],
+[
+  clooglegacyinc="-DCLOOG_PPL_BACKEND"
+  cloogorginc="-DCLOOG_INT_GMP -DCLOOG_ORG"
+
+  CFLAGS="${CFLAGS} ${clooginc} ${cloogorginc} ${gmpinc} ${pplinc}"
+  LDFLAGS="${LDFLAGS} ${clooglibs}"
+
+  AC_CACHE_CHECK([for installed CLooG type],
+                 [gcc_cv_cloog_type],
+    [LIBS="-lcloog ${saved_libs}"
+     AC_LINK_IFELSE([CLOOG_PPL_LEGACY_PROG],
+      [gcc_cv_cloog_type="PPL Legacy"],
+      [LIBS="-lcloog-isl -lisl ${saved_libs}"
+       AC_LINK_IFELSE([CLOOG_ORG_PROG],
+        [gcc_cv_cloog_type=ISL],
+        [LIBS="-lcloog-ppl ${saved_libs}"
+         AC_LINK_IFELSE([CLOOG_ORG_PROG],
+          [gcc_cv_cloog_type=PPL],
+          [gcc_cv_cloog_type=no])])])])
+
+  case $gcc_cv_cloog_type in
+    "PPL Legacy")
+      clooginc="${clooginc} ${clooglegacyinc}"
+      clooglibs="${clooglibs} -lcloog"
+      cloog_org=no
+      ;;
+    "ISL")
+      clooginc="${clooginc} ${cloogorginc}"
+      clooglibs="${clooglibs} -lcloog-isl"
+      cloog_org=yes
+      ;;
+    "PPL")
+      clooginc="${clooginc} ${cloogorginc}"
+      clooglibs="${clooglibs} -lcloog-ppl"
+      cloog_org=yes
+      ;;
+    *)
+      clooglibs=
+      clooginc=
+      ;;
+  esac
+  
+  CFLAGS="${saved_cflags} ${clooginc} ${gmpinc} ${pplinc}"
+  LDFLAGS="${saved_ldflags} ${clooglibs}"
+]
+)
+
+dnl Version checks for CLooG.org
+dnl
+dnl CLOOG_CHECK_VERSION([MAJOR],[MINOR],[REVISION])
+AC_DEFUN([CLOOG_CHECK_VERSION],
+[
+  AC_CACHE_CHECK([for verison $1.$2.$3 of CLooG (compile time)],
+    [gcc_cv_cloog_ct_0_14_0],
+    [AC_COMPILE_IFELSE([CLOOG_CHECK_CT_PROG($1,$2,$3)],
+      [gcc_cv_cloog_ct_0_14_0=yes],
+      [gcc_cv_cloog_ct_0_14_0=no])])
+
+  AC_CACHE_CHECK([for version $1.$2.$3 of CLooG (run time)],
+    [gcc_cv_cloog_rt_0_14_0],
+    [AC_RUN_IFELSE([CLOOG_CHECK_RT_PROG],
+      [gcc_cv_cloog_rt_0_14_0=yes],
+      [gcc_cv_cloog_rt_0_14_0=no],
+      [gcc_cv_cloog_rt_0_14_0=guessing yes])])
+]
+)
+
+dnl Version checks for CLooG-Legacy (CLooG-PPL).
+dnl As this gets removed more sooner than later, don't bother
+dnl making it variable.
+AC_DEFUN([CLOOG_CHECK_VERSION_LEGACY],
+[
+  AC_CACHE_CHECK([for version 0.15.5 (or later revision) of CLooG],
+    [gcc_cv_cloog_ct_0_15_5],
+    [AC_COMPILE_IFELSE([CLOOG_CHECK_CT_PROG(0,15,5)],
+      [AC_COMPILE_IFELSE([CLOOG_CHECK_CT_PROG(0,15,9)],
+        [gcc_cv_cloog_ct_0_15_5=yes],
+        [gcc_cv_cloog_ct_0_15_5=buggy but acceptable])],
+      [gcc_cv_cloog_ct_0_15_5=no])])
+]
+)
+
+dnl Executes [ACTION-IF-FAILED], if GRAPHITE was requested and
+dnl the checks failed.
+dnl
+dnl CLOOG_IF_FAILED([ACTION-IF-FAILED])
+AC_DEFUN([CLOOG_IF_FAILED],
+[
+  CLOOG_REQUESTED([graphite_requested=yes], [graphite_requested=no])dnl
+  
+  if test "${gcc_cv_cloog_ct_0_14_0}" = no \
+    || test "${gcc_cv_cloog_rt_0_14_0}" = no \
+    || test "${gcc_cv_cloog_ct_0_15_5}" = no; then
+    clooglibs=
+    clooginc=
+  fi
+
+  if test "${graphite_requested}" = yes \
+    && test "x${clooglibs}" = x \
+    && test "x${clooginc}" = x ; then
+    $1
+  fi
+]
+)
diff --git a/configure b/configure
index 9e39867..bcbec16 100755
--- a/configure
+++ b/configure
@@ -833,6 +833,9 @@ LIBS
 CPPFLAGS
 CXX
 CXXFLAGS
+LDFLAGS
+LIBS
+CPPFLAGS
 CCC
 CPP
 AR
@@ -1816,6 +1819,48 @@ fi
 
 } # ac_fn_c_try_link
 
+# ac_fn_c_try_run LINENO
+# ----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
+# that executables *can* be run.
+ac_fn_c_try_run ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
+  { { case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: program exited with status $ac_status" >&5
+       $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_retval=$ac_status
+fi
+  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  return $ac_retval
+
+} # ac_fn_c_try_run
+
 # ac_fn_c_try_cpp LINENO
 # ----------------------
 # Try to preprocess conftest.$ac_ext, and return whether this succeeded.
@@ -1940,48 +1985,6 @@ fi
 
 } # ac_fn_c_check_header_mongrel
 
-# ac_fn_c_try_run LINENO
-# ----------------------
-# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
-# that executables *can* be run.
-ac_fn_c_try_run ()
-{
-  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  if { { ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
-  { { case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; }; then :
-  ac_retval=0
-else
-  $as_echo "$as_me: program exited with status $ac_status" >&5
-       $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_retval=$ac_status
-fi
-  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
-  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
-  return $ac_retval
-
-} # ac_fn_c_try_run
-
 # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
 # -------------------------------------------------------
 # Tests whether HEADER exists and can be compiled using the include files in
@@ -5885,8 +5888,6 @@ fi
 
 
 # Check for CLOOG
-clooglibs=" -lcloog "
-clooginc=" -DCLOOG_PPL_BACKEND "
 
 
 # Check whether --with-cloog was given.
@@ -5911,29 +5912,33 @@ if test "x$with_ppl" = "xno"; then
   with_cloog=no
 fi
 
-case $with_cloog in
-  no)
-    clooglibs=
-    clooginc=
-    ;;
-  "" | yes)
-    ;;
-  *)
-    clooglibs="-L$with_cloog/lib -lcloog"
-    clooginc="-I$with_cloog/include -DCLOOG_PPL_BACKEND "
-    ;;
-esac
-if test "x$with_cloog_include" != x; then
-  clooginc="-I$with_cloog_include -DCLOOG_PPL_BACKEND "
-fi
-if test "x$with_cloog_lib" != x; then
-  clooglibs="-L$with_cloog_lib -lcloog"
-fi
-if test "x$with_cloog$with_cloog_include$with_cloog_lib" = x && test -d ${srcdir}/cloog; then
-  clooglibs='-L$$r/$(HOST_SUBDIR)/cloog/'"$lt_cv_objdir"' -lcloog '
-  clooginc='-I$$r/$(HOST_SUBDIR)/cloog/include -I$$s/cloog/include -DCLOOG_PPL_BACKEND '
-  enable_cloog_version_check=no
-fi
+
+  case $with_cloog in
+    no)
+      clooglibs=
+      clooginc=
+      ;;
+    "" | yes)
+      ;;
+    *)
+      clooglibs="-L$with_cloog/lib"
+      clooginc="-I$with_cloog/include"
+      ;;
+  esac
+  if test "x${with_cloog_include}" != x ; then
+    clooginc="-I$with_cloog_include"
+  fi
+  if test "x${with_cloog_lib}" != x; then
+    clooglibs="-L$with_cloog_lib"
+  fi
+  if test "x${with_cloog}" != x && test "x${with_cloog_include}" != x \
+    && test "x${with_cloog_lib}" != x && test -d ${srcdir}/cloog; then
+    clooglibs='-L$$r/$(HOST_SUBDIR)/cloog/'"$lt_cv_objdir"' '
+    clooginc='-I$$r/$(HOST_SUBDIR)/cloog/include -I$$s/cloog/include '
+    enable_cloog_version_check=no
+  fi
+
+
 
 # Check whether --enable-cloog-version-check was given.
 if test "${enable_cloog_version_check+set}" = set; then :
@@ -5943,22 +5948,202 @@ else
 fi
 
 
-if test "x$with_cloog" != "xno" -a "${ENABLE_CLOOG_CHECK}" = "yes"; then
-  saved_CFLAGS="$CFLAGS"
-  CFLAGS="$CFLAGS $clooginc $gmpinc $pplinc"
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for version 0.15.5 (or later revision) of CLooG" >&5
-$as_echo_n "checking for version 0.15.5 (or later revision) of CLooG... " >&6; }
+if test "x$with_cloog" != "xno"; then
+  saved_cflags=$CFLAGS
+  saved_libs=$LIBS
+  saved_ldflags=$LDFLAGS
+
+
+  clooglegacyinc="-DCLOOG_PPL_BACKEND"
+  cloogorginc="-DCLOOG_INT_GMP -DCLOOG_ORG"
+
+  CFLAGS="${CFLAGS} ${clooginc} ${cloogorginc} ${gmpinc} ${pplinc}"
+  LDFLAGS="${LDFLAGS} ${clooglibs}"
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for installed CLooG type" >&5
+$as_echo_n "checking for installed CLooG type... " >&6; }
+if test "${gcc_cv_cloog_type+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  LIBS="-lcloog ${saved_libs}"
+     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <cloog/cloog.h>
+int
+main ()
+{
+ppl_version_major ()
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  gcc_cv_cloog_type="PPL Legacy"
+else
+  LIBS="-lcloog-isl -lisl ${saved_libs}"
+       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <cloog/cloog.h>
+int
+main ()
+{
+cloog_version ()
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  gcc_cv_cloog_type=ISL
+else
+  LIBS="-lcloog-ppl ${saved_libs}"
+         cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <cloog/cloog.h>
+int
+main ()
+{
+cloog_version ()
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  gcc_cv_cloog_type=PPL
+else
+  gcc_cv_cloog_type=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_cloog_type" >&5
+$as_echo "$gcc_cv_cloog_type" >&6; }
+
+  case $gcc_cv_cloog_type in
+    "PPL Legacy")
+      clooginc="${clooginc} ${clooglegacyinc}"
+      clooglibs="${clooglibs} -lcloog"
+      cloog_org=no
+      ;;
+    "ISL")
+      clooginc="${clooginc} ${cloogorginc}"
+      clooglibs="${clooglibs} -lcloog-isl"
+      cloog_org=yes
+      ;;
+    "PPL")
+      clooginc="${clooginc} ${cloogorginc}"
+      clooglibs="${clooglibs} -lcloog-ppl"
+      cloog_org=yes
+      ;;
+    *)
+      clooglibs=
+      clooginc=
+      ;;
+  esac
+
+  CFLAGS="${saved_cflags} ${clooginc} ${gmpinc} ${pplinc}"
+  LDFLAGS="${saved_ldflags} ${clooglibs}"
+
+
+
+    if test "${ENABLE_CLOOG_CHECK}" = yes \
+    && test "${cloog_org}" = yes ; then
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for verison 0.14.0 of CLooG (compile time)" >&5
+$as_echo_n "checking for verison 0.14.0 of CLooG (compile time)... " >&6; }
+if test "${gcc_cv_cloog_ct_0_14_0+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include "cloog/cloog.h"
 int
 main ()
 {
+#if CLOOG_VERSION_MAJOR != 0 \
+    || CLOOG_VERSION_MINOR != 14 \
+    || CLOOG_VERSION_REVISION < 0
+    choke me
+   #endif
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  gcc_cv_cloog_ct_0_14_0=yes
+else
+  gcc_cv_cloog_ct_0_14_0=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_cloog_ct_0_14_0" >&5
+$as_echo "$gcc_cv_cloog_ct_0_14_0" >&6; }
 
-  #if CLOOG_VERSION_MAJOR != 0 || CLOOG_VERSION_MINOR != 15 || CLOOG_VERSION_REVISION < 5
-  choke me
-  #endif
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for version 0.14.0 of CLooG (run time)" >&5
+$as_echo_n "checking for version 0.14.0 of CLooG (run time)... " >&6; }
+if test "${gcc_cv_cloog_rt_0_14_0+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test "$cross_compiling" = yes; then :
+  gcc_cv_cloog_rt_0_14_0=guessing yes
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdlib.h>
+   #include "cloog/cloog.h"
+int
+main ()
+{
+if ((cloog_version_major () != CLOOG_VERSION_MAJOR)
+    && (cloog_version_minor () != CLOOG_VERSION_MINOR)
+    && (cloog_version_revision () != CLOOG_VERSION_REVISION))
+    {
+      exit (1);
+    }
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+  gcc_cv_cloog_rt_0_14_0=yes
+else
+  gcc_cv_cloog_rt_0_14_0=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_cloog_rt_0_14_0" >&5
+$as_echo "$gcc_cv_cloog_rt_0_14_0" >&6; }
+
+
+  fi
 
+    if test "${ENABLE_CLOOG_CHECK}" = yes \
+    && test "${cloog_org}" = no ; then
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for version 0.15.5 (or later revision) of CLooG" >&5
+$as_echo_n "checking for version 0.15.5 (or later revision) of CLooG... " >&6; }
+if test "${gcc_cv_cloog_ct_0_15_5+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include "cloog/cloog.h"
+int
+main ()
+{
+#if CLOOG_VERSION_MAJOR != 0 \
+    || CLOOG_VERSION_MINOR != 15 \
+    || CLOOG_VERSION_REVISION < 5
+    choke me
+   #endif
   ;
   return 0;
 }
@@ -5970,29 +6155,62 @@ if ac_fn_c_try_compile "$LINENO"; then :
 int
 main ()
 {
-
-  #if CLOOG_VERSION_MAJOR != 0 || CLOOG_VERSION_MINOR != 15 || CLOOG_VERSION_REVISION < 9
-  choke me
-  #endif
-
+#if CLOOG_VERSION_MAJOR != 0 \
+    || CLOOG_VERSION_MINOR != 15 \
+    || CLOOG_VERSION_REVISION < 9
+    choke me
+   #endif
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
+  gcc_cv_cloog_ct_0_15_5=yes
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: buggy but acceptable" >&5
-$as_echo "buggy but acceptable" >&6; }
+  gcc_cv_cloog_ct_0_15_5=buggy but acceptable
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }; clooglibs= ; clooginc=
+  gcc_cv_cloog_ct_0_15_5=no
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  CFLAGS="$saved_CFLAGS"
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_cloog_ct_0_15_5" >&5
+$as_echo "$gcc_cv_cloog_ct_0_15_5" >&6; }
+
+
+  fi
+
+
+
+  if test "x${with_cloog}" != x \
+    || test "x${with_cloog_include}" != x \
+    || test "x${with_cloog_lib}" != x ; then
+    graphite_requested=yes
+  else
+    graphite_requested=no
+  fi
+
+
+  if test "${gcc_cv_cloog_ct_0_14_0}" = no \
+    || test "${gcc_cv_cloog_rt_0_14_0}" = no \
+    || test "${gcc_cv_cloog_ct_0_15_5}" = no; then
+    clooglibs=
+    clooginc=
+  fi
+
+  if test "${graphite_requested}" = yes \
+    && test "x${clooglibs}" = x \
+    && test "x${clooginc}" = x ; then
+
+    as_fn_error "Unable to find a usable CLooG. See config.log for details." "$LINENO" 5
+  fi
+
+
+
+  CFLAGS=$saved_cflags
+  LIBS=$saved_libs
+  LDFLAGS=$saved_ldflags
 fi
 
 # Flags needed for CLOOG
diff --git a/configure.ac b/configure.ac
index 67e79fe..2aa4e3b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -28,6 +28,7 @@ m4_include([ltoptions.m4])
 m4_include([ltsugar.m4])
 m4_include([ltversion.m4])
 m4_include([lt~obsolete.m4])
+m4_include([config/cloog.m4])
 
 AC_INIT(move-if-change)
 AC_PREREQ(2.64)
@@ -1580,8 +1581,6 @@ AC_SUBST(pplinc)
 
 
 # Check for CLOOG
-clooglibs=" -lcloog "
-clooginc=" -DCLOOG_PPL_BACKEND "
 
 AC_ARG_WITH(cloog, [  --with-cloog=PATH       Specify prefix directory for the installed CLooG-PPL package
                           Equivalent to --with-cloog-include=PATH/include
@@ -1593,50 +1592,41 @@ if test "x$with_ppl" = "xno"; then
   with_cloog=no
 fi
 
-case $with_cloog in 
-  no)
-    clooglibs=
-    clooginc=
-    ;;
-  "" | yes)
-    ;;
-  *)
-    clooglibs="-L$with_cloog/lib -lcloog"
-    clooginc="-I$with_cloog/include -DCLOOG_PPL_BACKEND "
-    ;;
-esac
-if test "x$with_cloog_include" != x; then
-  clooginc="-I$with_cloog_include -DCLOOG_PPL_BACKEND "
-fi
-if test "x$with_cloog_lib" != x; then
-  clooglibs="-L$with_cloog_lib -lcloog"
-fi
-if test "x$with_cloog$with_cloog_include$with_cloog_lib" = x && test -d ${srcdir}/cloog; then
-  clooglibs='-L$$r/$(HOST_SUBDIR)/cloog/'"$lt_cv_objdir"' -lcloog '
-  clooginc='-I$$r/$(HOST_SUBDIR)/cloog/include -I$$s/cloog/include -DCLOOG_PPL_BACKEND '
-  enable_cloog_version_check=no
-fi
+CLOOG_INIT_FLAGS()
 
 AC_ARG_ENABLE(cloog-version-check,
 [  --disable-cloog-version-check  disable check for CLooG version],
 ENABLE_CLOOG_CHECK=$enableval,
 ENABLE_CLOOG_CHECK=yes)
 
-if test "x$with_cloog" != "xno" -a "${ENABLE_CLOOG_CHECK}" = "yes"; then
-  saved_CFLAGS="$CFLAGS"
-  CFLAGS="$CFLAGS $clooginc $gmpinc $pplinc"
-  AC_MSG_CHECKING([for version 0.15.5 (or later revision) of CLooG])
-  AC_TRY_COMPILE([#include "cloog/cloog.h"],[
-  #if CLOOG_VERSION_MAJOR != 0 || CLOOG_VERSION_MINOR != 15 || CLOOG_VERSION_REVISION < 5
-  choke me
-  #endif
-  ], [AC_TRY_COMPILE([#include "cloog/cloog.h"],[
-  #if CLOOG_VERSION_MAJOR != 0 || CLOOG_VERSION_MINOR != 15 || CLOOG_VERSION_REVISION < 9
-  choke me
-  #endif
-  ], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([buggy but acceptable])])],
-  [AC_MSG_RESULT([no]); clooglibs= ; clooginc= ])
-  CFLAGS="$saved_CFLAGS"
+if test "x$with_cloog" != "xno"; then
+  saved_cflags=$CFLAGS
+  saved_libs=$LIBS
+  saved_ldflags=$LDFLAGS
+
+  dnl Detect and set clooginc/clooglibs.
+  dnl Preference: CLooG-PPL (Legacy) > CLooG-ISL > CLooG-PPL
+  CLOOG_SET_FLAGS()
+
+  dnl Version check for CLooG-Org
+  if test "${ENABLE_CLOOG_CHECK}" = yes \
+    && test "${cloog_org}" = yes ; then
+    CLOOG_CHECK_VERSION(0,14,0)
+  fi
+
+  dnl Version check for CLooG-PPL (Legacy).
+  if test "${ENABLE_CLOOG_CHECK}" = yes \
+    && test "${cloog_org}" = no ; then
+    CLOOG_CHECK_VERSION_LEGACY()
+  fi
+
+  dnl Only fails, if GRAPHITE was requested.
+  CLOOG_IF_FAILED([
+    AC_MSG_ERROR([Unable to find a usable CLooG. See config.log for details.])])
+
+  CFLAGS=$saved_cflags
+  LIBS=$saved_libs
+  LDFLAGS=$saved_ldflags
 fi
 
 # Flags needed for CLOOG
-- 
1.7.3.1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]