diff mbox

[3/3] Support official CLooG.org versions.

Message ID 1281551412-9101-4-git-send-email-simbuerg@googlemail.com
State New
Headers show

Commit Message

Andreas Simbürger Aug. 11, 2010, 6:30 p.m. UTC
2010-08-11  Andreas Simbuerger  <simbuerg@fim.uni-passau.de>

	* configure.ac: Support official CLooG.org versions.
	* configure: Regenerate.
---
 configure              |  156 +++++++++++++++++++++++++++++++++++++++++------
 configure.ac           |   90 +++++++++++++++++++++-------
 gcc/ChangeLog.graphite |    5 ++
 3 files changed, 208 insertions(+), 43 deletions(-)
diff mbox

Patch

diff --git a/configure b/configure
index 8edfde3..23b6cf1 100755
--- a/configure
+++ b/configure
@@ -5891,8 +5891,11 @@  fi
 
 
 # Check for CLOOG
-clooglibs=" -lcloog "
-clooginc=" -DCLOOG_PPL_BACKEND "
+
+clooglibs=
+clooginc=
+clooglegacyinc="-DCLOOG_PPL_BACKEND "
+cloogorginc="-DCLOOG_INT_GMP -DCLOOG_ORG "
 
 
 # Check whether --with-cloog was given.
@@ -5925,19 +5928,19 @@  case $with_cloog in
   "" | yes)
     ;;
   *)
-    clooglibs="-L$with_cloog/lib -lcloog"
-    clooginc="-I$with_cloog/include -DCLOOG_PPL_BACKEND "
+    clooglibs="-L$with_cloog/lib ${clooglibs} "
+    clooginc="-I$with_cloog/include ${clooginc} "
     ;;
 esac
 if test "x$with_cloog_include" != x; then
-  clooginc="-I$with_cloog_include -DCLOOG_PPL_BACKEND "
+  clooginc="-I$with_cloog_include ${clooginc}"
 fi
 if test "x$with_cloog_lib" != x; then
-  clooglibs="-L$with_cloog_lib -lcloog"
+  clooglibs="-L$with_cloog_lib ${clooglibs}"
 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 '
+  clooglibs='-L$$r/$(HOST_SUBDIR)/cloog/'"$lt_cv_objdir"' ${clooglibs} '
+  clooginc='-I$$r/$(HOST_SUBDIR)/cloog/include -I$$s/cloog/include ${clooginc} '
   enable_cloog_version_check=no
 fi
 
@@ -5949,21 +5952,133 @@  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
+  # Test for CLooG variant.
+  saved_cflags=$CFLAGS
+  saved_libs=$LIBS
+  saved_ldflags=$LDFLAGS
+  cloog_lib=
+  cloog_inc=
+
+
+  CFLAGS="${CFLAGS} ${gmpinc} ${pplinc} ${clooginc} ${cloogorginc} "
+  LDFLAGS="${LDFLAGS} ${clooglibs} "
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CLooG's backend" >&5
+$as_echo_n "checking for CLooG's backend... " >&6; }
+  cloog_lib="-lcloog";
+  cloog_inc=$clooglegacyinc;
+  LIBS=$cloog_lib
+  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 :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: PPL (Legacy)" >&5
+$as_echo "PPL (Legacy)" >&6; }
+else
+
+  cloog_lib="-lcloog-isl";
+  cloog_inc=$cloogorginc;
+  LIBS=$cloog_lib;
+  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 :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: ISL" >&5
+$as_echo "ISL" >&6; }
+else
+
+  cloog_lib="-lcloog-ppl";
+  cloog_inc=$cloogorginc;
+  LIBS=$cloog_lib;
+  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 :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: PPL" >&5
+$as_echo "PPL" >&6; }
+else
+
+  cloog_lib="-lcloog-polylib";
+  cloog_inc=$cloogorginc;
+  LIBS=$cloog_lib;
   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 :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: PolyLib" >&5
+$as_echo "PolyLib" >&6; }
+else
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5
+$as_echo "none" >&6; }
+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
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+
+  clooglibs=$clooglibs$cloog_lib
+  clooginc=$clooginc$cloog_inc
+  CFLAGS=$saved_cflags
+  LIBS=$saved_libs
+  LDFLAGS=$saved_ldflags
+
+  # Test for CLooG version
+  if test "${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; }
+    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
+    #if CLOOG_VERSION_MAJOR != 0 || CLOOG_VERSION_MINOR != 15 || CLOOG_VERSION_REVISION < 5
+    choke me
+    #endif
 
   ;
   return 0;
@@ -5977,9 +6092,9 @@  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;
@@ -5998,7 +6113,8 @@  else
 $as_echo "no" >&6; }; clooglibs= ; clooginc=
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  CFLAGS="$saved_CFLAGS"
+    CFLAGS="$saved_CFLAGS"
+  fi
 fi
 
 # Flags needed for CLOOG
diff --git a/configure.ac b/configure.ac
index f78c527..4e7274e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1586,8 +1586,11 @@  AC_SUBST(pplinc)
 
 
 # Check for CLOOG
-clooglibs=" -lcloog "
-clooginc=" -DCLOOG_PPL_BACKEND "
+
+clooglibs=
+clooginc=
+clooglegacyinc="-DCLOOG_PPL_BACKEND "
+cloogorginc="-DCLOOG_INT_GMP -DCLOOG_ORG "
 
 AC_ARG_WITH(cloog, [  --with-cloog=PATH       Specify prefix directory for the installed CLooG-PPL package
                           Equivalent to --with-cloog-include=PATH/include
@@ -1607,19 +1610,19 @@  case $with_cloog in
   "" | yes)
     ;;
   *)
-    clooglibs="-L$with_cloog/lib -lcloog"
-    clooginc="-I$with_cloog/include -DCLOOG_PPL_BACKEND "
+    clooglibs="-L$with_cloog/lib ${clooglibs} "
+    clooginc="-I$with_cloog/include ${clooginc} "
     ;;
 esac
 if test "x$with_cloog_include" != x; then
-  clooginc="-I$with_cloog_include -DCLOOG_PPL_BACKEND "
+  clooginc="-I$with_cloog_include ${clooginc}"
 fi
 if test "x$with_cloog_lib" != x; then
-  clooglibs="-L$with_cloog_lib -lcloog"
+  clooglibs="-L$with_cloog_lib ${clooglibs}"
 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 '
+  clooglibs='-L$$r/$(HOST_SUBDIR)/cloog/'"$lt_cv_objdir"' ${clooglibs} '
+  clooginc='-I$$r/$(HOST_SUBDIR)/cloog/include -I$$s/cloog/include ${clooginc} '
   enable_cloog_version_check=no
 fi
 
@@ -1628,21 +1631,62 @@  AC_ARG_ENABLE(cloog-version-check,
 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
+  # Test for CLooG variant.
+  saved_cflags=$CFLAGS
+  saved_libs=$LIBS
+  saved_ldflags=$LDFLAGS
+  cloog_lib=
+  cloog_inc=
+  m4_define([CLOOG_BACKEND_PROG],[AC_LANG_PROGRAM(
+    [#include <cloog/cloog.h>],
+    [cloog_version ()])])
+
+  CFLAGS="${CFLAGS} ${gmpinc} ${pplinc} ${clooginc} ${cloogorginc} "
+  LDFLAGS="${LDFLAGS} ${clooglibs} "
+
+  AC_MSG_CHECKING(for CLooG's backend)
+  cloog_lib="-lcloog";
+  cloog_inc=$clooglegacyinc;
+  LIBS=$cloog_lib
+  AC_LINK_IFELSE([CLOOG_BACKEND_PROG], [AC_MSG_RESULT([PPL (Legacy)])],[
+  cloog_lib="-lcloog-isl";
+  cloog_inc=$cloogorginc;
+  LIBS=$cloog_lib;
+  AC_LINK_IFELSE([CLOOG_BACKEND_PROG], [AC_MSG_RESULT([ISL])],[
+  cloog_lib="-lcloog-ppl";
+  cloog_inc=$cloogorginc;
+  LIBS=$cloog_lib;
+  AC_LINK_IFELSE([CLOOG_BACKEND_PROG], [AC_MSG_RESULT([PPL])],[
+  cloog_lib="-lcloog-polylib";
+  cloog_inc=$cloogorginc;
+  LIBS=$cloog_lib;
+  AC_LINK_IFELSE([CLOOG_BACKEND_PROG], [AC_MSG_RESULT([PolyLib])],[
+  AC_MSG_RESULT([none])])])])])
+
+  clooglibs=$clooglibs$cloog_lib
+  clooginc=$clooginc$cloog_inc
+  CFLAGS=$saved_cflags
+  LIBS=$saved_libs
+  LDFLAGS=$saved_ldflags
+
+  # Test for CLooG version
+  if test "${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"
+  fi
 fi
 
 # Flags needed for CLOOG
diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite
index 54c33ef..5eaa47c 100644
--- a/gcc/ChangeLog.graphite
+++ b/gcc/ChangeLog.graphite
@@ -1,5 +1,10 @@ 
 2010-08-11  Andreas Simbuerger  <simbuerg@fim.uni-passau.de>
 
+	* configure.ac: Support official CLooG.org versions.
+	* configure: Regenerate.
+
+2010-08-11  Andreas Simbuerger  <simbuerg@fim.uni-passau.de>
+
 	* graphite-poly.c: Change include order.
 
 2010-08-11  Andreas Simbuerger  <simbuerg@fim.uni-passau.de>