From patchwork Sat Oct 30 17:43:33 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Andreas_Simb=C3=BCrger?= X-Patchwork-Id: 69667 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 6A6A6B70CC for ; Sun, 31 Oct 2010 04:45:42 +1100 (EST) Received: (qmail 4294 invoked by alias); 30 Oct 2010 17:45:39 -0000 Received: (qmail 4281 invoked by uid 22791); 30 Oct 2010 17:45:34 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, TW_CX, T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-ew0-f47.google.com (HELO mail-ew0-f47.google.com) (209.85.215.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 30 Oct 2010 17:45:26 +0000 Received: by ewy2 with SMTP id 2so2272706ewy.20 for ; Sat, 30 Oct 2010 10:45:23 -0700 (PDT) Received: by 10.14.37.6 with SMTP id x6mr10994315eea.13.1288460722564; Sat, 30 Oct 2010 10:45:22 -0700 (PDT) Received: from simbuerg@googlemail.com (dslb-188-099-034-172.pools.arcor-ip.net [188.99.34.172]) by mx.google.com with ESMTPS id w20sm2731136eeh.12.2010.10.30.10.45.18 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 30 Oct 2010 10:45:20 -0700 (PDT) Received: by simbuerg@googlemail.com (sSMTP sendmail emulation); Sat, 30 Oct 2010 19:44:27 +0200 From: =?UTF-8?q?Andreas=20Simb=C3=BCrger?= To: gcc-patches@gcc.gnu.org Cc: gcc-graphite@googlegroups.com, ralph.wildenhues@gmx.de, dj@redhat.com, bonzini@gnu.org, neroden@gcc.gnu.org, =?UTF-8?q?Andreas=20Simb=C3=BCrger?= Subject: [PATCH] Support official CLooG.org versions. Date: Sat, 30 Oct 2010 19:43:33 +0200 Message-Id: <1288460613-14151-1-git-send-email-simbuerg@googlemail.com> In-Reply-To: <4CC953D8.4080108@fastmail.fm> References: <4CC953D8.4080108@fastmail.fm> X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org -------------------------- Changes to previous patch: * Cleaned up configure.ac. * Added correct GPL licensing header. * Changed dnl comments to # comments in config/cloog.m4. * CPPFLAGS are now used for the -D switches during checks. * CFLAGS/LDFLAGS/CPPFLAGS are now saved and restored between checks. * Run time checks removed for now. -------------------------- 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 the compile time check. We check for the constants to verify the header's compatibility. * 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 * configure.ac: Support official CLooG.org versions. * configure: Regenerate. * config/cloog.m4: New. --- ChangeLog.graphite | 6 + config/cloog.m4 | 252 ++++++++++++++++++++++++++++++++++++++++++ configure | 306 ++++++++++++++++++++++++++++++++++++++++++---------- configure.ac | 74 ++++--------- 4 files changed, 533 insertions(+), 105 deletions(-) create mode 100644 config/cloog.m4 diff --git a/ChangeLog.graphite b/ChangeLog.graphite index 46f1290..d067200 100644 --- a/ChangeLog.graphite +++ b/ChangeLog.graphite @@ -1,3 +1,9 @@ +2010-08-11 Andreas Simbuerger + + * configure.ac: Support official CLooG.org versions. + * configure: Regenerate. + * config/cloog.m4: New. + 2010-10-20 Sebastian Pop * Merge from mainline (164578:165734). diff --git a/config/cloog.m4 b/config/cloog.m4 new file mode 100644 index 0000000..d042bfa --- /dev/null +++ b/config/cloog.m4 @@ -0,0 +1,252 @@ +# This file is part of GCC. +# +# GCC is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 3, or (at your option) any later +# version. +# +# GCC is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# . +# +# Contributed by Andreas Simbuerger + +# CLOOG_INIT_FLAGS () +# ------------------------- +# Provide configure switches for CLooG support. +# Initialize clooglibs/clooginc according to the user input. +AC_DEFUN([CLOOG_INIT_FLAGS], +[ + AC_ARG_WITH(cloog, + [AS_HELP_STRING( + [--with-cloog=PATH], + [Specify prefix directory for the installed CLooG-PPL package. + Equivalent to --with-cloog-include=PATH/include + plus --with-cloog-lib=PATH/lib])]) + AC_ARG_WITH(cloog_include, + [AS_HELP_STRING( + [--with-cloog-include=PATH], + [Specify directory for installed CLooG include files])]) + AC_ARG_WITH(cloog_lib, + [AS_HELP_STRING( + [--with-cloog-lib=PATH], + [Specify the directory for the installed CLooG library])]) + + AC_ARG_ENABLE(cloog-version-check, + [AS_HELP_STRING( + [--disable-cloog-version-check], + [disable check for CLooG version])], + ENABLE_CLOOG_CHECK=$enableval, + ENABLE_CLOOG_CHECK=yes) + + # Initialize clooglibs and clooginc. + 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 +] +) + +# CLOOG_REQUESTED (ACTION-IF-REQUESTED, ACTION-IF-NOT) +# ---------------------------------------------------- +# Provide actions for failed CLooG detection. +AC_DEFUN([CLOOG_REQUESTED], +[ + AC_REQUIRE([CLOOG_INIT_FLAGS]) + + if test "x${with_cloog}" != x \ + || test "x${with_cloog_include}" != x \ + || test "x${with_cloog_lib}" != x ; then + $1 + else + $2 + fi +] +) + +# _CLOOG_ORG_PROG () +# ------------------ +# Helper for detecting CLooG.org's backend. +m4_define([_CLOOG_ORG_PROG],[AC_LANG_PROGRAM( + [#include ], + [cloog_version ()])]) + +# _CLOOG_PPL_LEGACY_PROG () +# ------------------------- +# Helper for detecting CLooG-Legacy (CLooG-PPL). +m4_define([_CLOOG_PPL_LEGACY_PROG], [AC_LANG_PROGRAM( + [#include ], + [ppl_version_major ()])]) + +# CLOOG_FIND_FLAGS () +# ------------------ +# Detect the used CLooG-backend and set clooginc/clooglibs/cloog_org. +# Preference: CLooG-PPL (Legacy) > CLooG-ISL > CLooG-PPL +AC_DEFUN([CLOOG_FIND_FLAGS], +[ + AC_REQUIRE([CLOOG_INIT_FLAGS]) + + _saved_cflags=$CFLAGS + _saved_cppflags=$CPPFLAGS + _saved_ldflags=$LDFLAGS + _saved_libs=$LIBS + + _clooglegacyinc="-DCLOOG_PPL_BACKEND" + _cloogorginc="-DCLOOG_INT_GMP -DCLOOG_ORG" + + dnl clooglibs & clooginc may have been initialized by CLOOG_INIT_FLAGS. + CFLAGS="${CFLAGS} ${clooginc} ${pplinc} ${gmpinc}" + CPPFLAGS="${CPPFLAGS} ${_clooglegacyinc} ${_cloogorginc}" + LDFLAGS="${LDFLAGS} ${clooglibs}" + + AC_CACHE_CHECK([for installed CLooG], + [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= + cloog_org= + ;; + esac + + LIBS=$_saved_libs + CFLAGS=$_saved_cflags + CPPFLAGS=$_saved_cppflags + LDFLAGS=$_saved_ldflags +] +) + +# _CLOOG_CHECK_CT_PROG(MAJOR, MINOR, REVISION) +# -------------------------------------------- +# Helper for verifying CLooG's compile time version. +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])]) + +# _CLOOG_CHECK_RT_PROG () +# ----------------------- +# Helper for verifying that CLooG's compile time version +# matches the run time version. +m4_define([_CLOOG_CHECK_RT_PROG],[AC_LANG_PROGRAM( + [#include "cloog/cloog.h"], + [if ((cloog_version_major () != CLOOG_VERSION_MAJOR) + && (cloog_version_minor () != CLOOG_VERSION_MINOR) + && (cloog_version_revision () != CLOOG_VERSION_REVISION)) + { + return 1; + }])]) + +# CLOOG_CHECK_VERSION CLOOG_CHECK_VERSION (MAJOR, MINOR, REVISION) +# ---------------------------------------------------------------- +# Test the found CLooG to be exact of version MAJOR.MINOR and at least +# REVISION. +# If we're using the old CLooG-PPL (Legacy), the old version check will +# be executed (Ignores the provided version information). +AC_DEFUN([CLOOG_CHECK_VERSION], +[ + AC_REQUIRE([CLOOG_FIND_FLAGS]) + + _saved_CFLAGS=$CFLAGS + _saved_LDFLAGS=$LDFLAGS + + CFLAGS="${saved_cflags} ${clooginc} ${pplinc} ${gmpinc}" + LDFLAGS="${saved_ldflags} ${clooglibs}" + + if test "${cloog_org}" = yes ; then + AC_CACHE_CHECK([for verison $1.$2.$3 of CLooG], + [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])]) + elif test "${cloog_org}" = no ; then + 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])]) + fi + + CFLAGS=$_saved_CFLAGS + LDFLAGS=$_saved_LDFLAGS +] +) + +# CLOOG_IF_FAILED (ACTION-IF-FAILED) +# ---------------------------------- +# Executes ACTION-IF-FAILED, if GRAPHITE was requested and +# the checks failed. +AC_DEFUN([CLOOG_IF_FAILED], +[ + CLOOG_REQUESTED([graphite_requested=yes], [graphite_requested=no]) + + 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 b1fbfaa..60ae15e 100755 --- a/configure +++ b/configure @@ -833,6 +833,9 @@ LIBS CPPFLAGS CXX CXXFLAGS +LDFLAGS +LIBS +CPPFLAGS CCC CPP build_configargs @@ -1491,7 +1494,8 @@ Optional Features: --enable-libssp build libssp directory --enable-build-with-cxx build with C++ compiler instead of C compiler --disable-ppl-version-check disable check for PPL version - --disable-cloog-version-check disable check for CLooG version + --disable-cloog-version-check + disable check for CLooG version --enable-lto enable link time optimization support --enable-stage1-languages[=all] choose additional languages to build during stage1. Mostly useful for compiler development. @@ -1542,11 +1546,14 @@ Optional Packages: plus --with-ppl-lib=PATH/lib --with-ppl-include=PATH Specify directory for installed PPL include files --with-ppl-lib=PATH Specify the directory for the installed PPL library - --with-cloog=PATH Specify prefix directory for the installed CLooG-PPL package - Equivalent to --with-cloog-include=PATH/include - plus --with-cloog-lib=PATH/lib - --with-cloog-include=PATH Specify directory for installed CLooG include files - --with-cloog-lib=PATH Specify the directory for the installed CLooG library + --with-cloog=PATH Specify prefix directory for the installed CLooG-PPL + package. Equivalent to + --with-cloog-include=PATH/include plus + --with-cloog-lib=PATH/lib + --with-cloog-include=PATH + Specify directory for installed CLooG include files + --with-cloog-lib=PATH Specify the directory for the installed CLooG + library --with-libelf=PATH Specify prefix directory for the installed libelf package Equivalent to --with-libelf-include=PATH/include plus --with-libelf-lib=PATH/lib @@ -5894,8 +5901,7 @@ fi # Check for CLOOG -clooglibs=" -lcloog " -clooginc=" -DCLOOG_PPL_BACKEND " + # Check whether --with-cloog was given. @@ -5916,58 +5922,212 @@ if test "${with_cloog_lib+set}" = set; then : fi + # Check whether --enable-cloog-version-check was given. +if test "${enable_cloog_version_check+set}" = set; then : + enableval=$enable_cloog_version_check; ENABLE_CLOOG_CHECK=$enableval +else + ENABLE_CLOOG_CHECK=yes +fi + + + # Initialize clooglibs and clooginc. + 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 + + + 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 " +if test "x$with_cloog" != "xno"; then + if test "${ENABLE_CLOOG_CHECK}" ; then + + + + _saved_cflags=$CFLAGS + _saved_cppflags=$CPPFLAGS + _saved_ldflags=$LDFLAGS + _saved_libs=$LIBS + + _clooglegacyinc="-DCLOOG_PPL_BACKEND" + _cloogorginc="-DCLOOG_INT_GMP -DCLOOG_ORG" + + CFLAGS="${CFLAGS} ${clooginc} ${pplinc} ${gmpinc}" + CPPFLAGS="${CPPFLAGS} ${_clooglegacyinc} ${_cloogorginc}" + LDFLAGS="${LDFLAGS} ${clooglibs}" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for installed CLooG" >&5 +$as_echo_n "checking for installed CLooG... " >&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 +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 +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 +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 -if test "x$with_cloog_lib" != x; then - clooglibs="-L$with_cloog_lib -lcloog" +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext 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 +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi - -# Check whether --enable-cloog-version-check was given. -if test "${enable_cloog_version_check+set}" = set; then : - enableval=$enable_cloog_version_check; ENABLE_CLOOG_CHECK=$enableval -else - ENABLE_CLOOG_CHECK=yes +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= + cloog_org= + ;; + esac -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 + LIBS=$_saved_libs + CFLAGS=$_saved_cflags + CPPFLAGS=$_saved_cppflags + LDFLAGS=$_saved_ldflags + + + + + + _saved_CFLAGS=$CFLAGS + _saved_LDFLAGS=$LDFLAGS + + CFLAGS="${saved_cflags} ${clooginc} ${pplinc} ${gmpinc}" + LDFLAGS="${saved_ldflags} ${clooglibs}" + + if test "${cloog_org}" = yes ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for verison 0.14.0 of CLooG" >&5 +$as_echo_n "checking for verison 0.14.0 of CLooG... " >&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; } + elif 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 - +#if CLOOG_VERSION_MAJOR != 0 \ + || CLOOG_VERSION_MINOR != 15 \ + || CLOOG_VERSION_REVISION < 5 + choke me + #endif ; return 0; } @@ -5979,29 +6139,65 @@ 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 + + CFLAGS=$_saved_CFLAGS + LDFLAGS=$_saved_LDFLAGS + + + 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 + + fi # Flags needed for CLOOG diff --git a/configure.ac b/configure.ac index bf5fe3a..5d7d0d7 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,63 +1581,36 @@ 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 - plus --with-cloog-lib=PATH/lib]) -AC_ARG_WITH(cloog_include, [ --with-cloog-include=PATH Specify directory for installed CLooG include files]) -AC_ARG_WITH(cloog_lib, [ --with-cloog-lib=PATH Specify the directory for the installed CLooG library]) +dnl Provide configure switches and initialize clooginc & clooglibs +dnl with user input. +CLOOG_INIT_FLAGS() 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 - -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"; then + dnl Version check for CLooG-Org + dnl As long as there is no new release of CLooG, + dnl we will check for 0.14.0. + dnl + dnl The first git revision that will work with + dnl GCC is: bd91b845a65805c290d43fc1bef8139864a163fb + dnl This is enforced implictly, as this is the commit that + dnl introduced the versioning information used within our + dnl checks. + dnl + dnl If we're using CLooG-Legacy, the provided version information + dnl will be ignored. + if test "${ENABLE_CLOOG_CHECK}" ; then + CLOOG_CHECK_VERSION(0,14,0) + fi -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" + dnl Only execute fail-action, if CLooG has been + dnl requested. + CLOOG_IF_FAILED([ + AC_MSG_ERROR([Unable to find a usable CLooG. See config.log for details.])]) fi # Flags needed for CLOOG