From patchwork Mon Aug 15 07:19:48 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Pop X-Patchwork-Id: 110011 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 7D0CEB6F7B for ; Mon, 15 Aug 2011 17:20:30 +1000 (EST) Received: (qmail 26949 invoked by alias); 15 Aug 2011 07:20:25 -0000 Received: (qmail 26940 invoked by uid 22791); 15 Aug 2011 07:20:22 -0000 X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-yi0-f47.google.com (HELO mail-yi0-f47.google.com) (209.85.218.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 15 Aug 2011 07:20:05 +0000 Received: by yia28 with SMTP id 28so3146889yia.20 for ; Mon, 15 Aug 2011 00:20:04 -0700 (PDT) Received: by 10.236.143.102 with SMTP id k66mr10957561yhj.36.1313392803784; Mon, 15 Aug 2011 00:20:03 -0700 (PDT) Received: from napoca (adsl-99-184-92-236.dsl.austtx.sbcglobal.net [99.184.92.236]) by mx.google.com with ESMTPS id y6sm3961227yhl.40.2011.08.15.00.20.01 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 15 Aug 2011 00:20:03 -0700 (PDT) Received: by napoca (sSMTP sendmail emulation); Mon, 15 Aug 2011 02:19:59 -0500 From: Sebastian Pop To: skimo@kotnet.org, tobias@grosser.es Cc: gcc-patches@gcc.gnu.org, Sebastian Pop Subject: [PATCH] add configure --with-isl Date: Mon, 15 Aug 2011 02:19:48 -0500 Message-Id: <1313392788-1854-1-git-send-email-sebpop@gmail.com> 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 Hi, This patch still needs some changes to ISL for the compile time version check to work: [#if ISL_VERSION_MAJOR != $1 \ || ISL_VERSION_MINOR != $2 \ || ISL_VERSION_REVISION < $3 I am providing this patch for reference, just in case ISL 0.08 will contain these defines. I have not tested this patch at all: I just followed what cloog was doing. Sebastian --- Makefile.tpl | 6 ++ config/isl.m4 | 149 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ configure.ac | 26 +++++++++- gcc/Makefile.in | 8 ++- gcc/configure.ac | 3 + 5 files changed, 188 insertions(+), 4 deletions(-) create mode 100644 config/isl.m4 diff --git a/Makefile.tpl b/Makefile.tpl index 4dd2391..f99c79f 100644 --- a/Makefile.tpl +++ b/Makefile.tpl @@ -222,6 +222,8 @@ HOST_EXPORTS = \ GMPINC="$(HOST_GMPINC)"; export GMPINC; \ PPLLIBS="$(HOST_PPLLIBS)"; export PPLLIBS; \ PPLINC="$(HOST_PPLINC)"; export PPLINC; \ + ISLLIBS="$(HOST_ISLLIBS)"; export ISLLIBS; \ + ISLINC="$(HOST_ISLINC)"; export ISLINC; \ CLOOGLIBS="$(HOST_CLOOGLIBS)"; export CLOOGLIBS; \ CLOOGINC="$(HOST_CLOOGINC)"; export CLOOGINC; \ LIBELFLIBS="$(HOST_LIBELFLIBS)" ; export LIBELFLIBS; \ @@ -314,6 +316,10 @@ HOST_GMPINC = @gmpinc@ HOST_PPLLIBS = @ppllibs@ HOST_PPLINC = @pplinc@ +# Where to find ISL +HOST_ISLLIBS = @isllibs@ +HOST_ISLINC = @islinc@ + # Where to find CLOOG HOST_CLOOGLIBS = @clooglibs@ HOST_CLOOGINC = @clooginc@ diff --git a/config/isl.m4 b/config/isl.m4 new file mode 100644 index 0000000..00ea0b2 --- /dev/null +++ b/config/isl.m4 @@ -0,0 +1,149 @@ +# 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 Sebastian Pop + +# ISL_INIT_FLAGS () +# ------------------------- +# Provide configure switches for ISL support. +# Initialize isllibs/islinc according to the user input. +AC_DEFUN([ISL_INIT_FLAGS], +[ + AC_ARG_WITH(isl, + [AS_HELP_STRING( + [--with-isl=PATH], + [Specify prefix directory for the installed ISL package. + Equivalent to --with-isl-include=PATH/include + plus --with-isl-lib=PATH/lib])]) + AC_ARG_WITH([isl-include], + [AS_HELP_STRING( + [--with-isl-include=PATH], + [Specify directory for installed ISL include files])]) + AC_ARG_WITH([isl-lib], + [AS_HELP_STRING( + [--with-isl-lib=PATH], + [Specify the directory for the installed ISL library])]) + + AC_ARG_ENABLE(isl-version-check, + [AS_HELP_STRING( + [--disable-isl-version-check], + [disable check for ISL version])], + ENABLE_ISL_CHECK=$enableval, + ENABLE_ISL_CHECK=yes) + + # Initialize isllibs and islinc. + case $with_isl in + no) + isllibs= + islinc= + ;; + "" | yes) + ;; + *) + isllibs="-L$with_isl/lib" + islinc="-I$with_isl/include" + ;; + esac + if test "x${with_isl_include}" != x ; then + islinc="-I$with_isl_include" + fi + if test "x${with_isl_lib}" != x; then + isllibs="-L$with_isl_lib" + fi + + dnl Flags needed for ISL + AC_SUBST(isllibs) + AC_SUBST(islinc) +] +) + +# ISL_REQUESTED (ACTION-IF-REQUESTED, ACTION-IF-NOT) +# ---------------------------------------------------- +# Provide actions for failed ISL detection. +AC_DEFUN([ISL_REQUESTED], +[ + AC_REQUIRE([ISL_INIT_FLAGS]) + + if test "x${with_isl}" = xno; then + $2 + elif test "x${with_isl}" != x \ + || test "x${with_isl_include}" != x \ + || test "x${with_isl_lib}" != x ; then + $1 + else + $2 + fi +] +) + +# _ISL_CHECK_CT_PROG(MAJOR, MINOR, REVISION) +# -------------------------------------------- +# Helper for verifying ISL's compile time version. +m4_define([_ISL_CHECK_CT_PROG],[AC_LANG_PROGRAM( + [#include "isl/version.h"], + [#if ISL_VERSION_MAJOR != $1 \ + || ISL_VERSION_MINOR != $2 \ + || ISL_VERSION_REVISION < $3 + choke me + #endif])]) + +# ISL_CHECK_VERSION ISL_CHECK_VERSION (MAJOR, MINOR, REVISION) +# ---------------------------------------------------------------- +# Test the found ISL to be exact of version MAJOR.MINOR and at least +# REVISION. +AC_DEFUN([ISL_CHECK_VERSION], +[ + AC_REQUIRE([ISL_FIND_FLAGS]) + + if test "${ENABLE_ISL_CHECK}" = yes ; then + _isl_saved_CFLAGS=$CFLAGS + _isl_saved_LDFLAGS=$LDFLAGS + + CFLAGS="${_isl_saved_CFLAGS} ${islinc} ${pplinc} ${gmpinc}" + LDFLAGS="${_isl_saved_LDFLAGS} ${isllibs} ${ppllibs}" + + AC_CACHE_CHECK([for version $1.$2.$3 of ISL], + [gcc_cv_isl], + [AC_COMPILE_IFELSE([_ISL_CHECK_CT_PROG($1,$2,$3)], + [gcc_cv_isl=yes], + [gcc_cv_isl=no])]) + + CFLAGS=$_isl_saved_CFLAGS + LDFLAGS=$_isl_saved_LDFLAGS + fi +] +) + +# ISL_IF_FAILED (ACTION-IF-FAILED) +# ---------------------------------- +# Executes ACTION-IF-FAILED, if GRAPHITE was requested and +# the checks failed. +AC_DEFUN([ISL_IF_FAILED], +[ + ISL_REQUESTED([graphite_requested=yes], [graphite_requested=no]) + + if test "${gcc_cv_isl}" = no ; then + isllibs= + islinc= + fi + + if test "${graphite_requested}" = yes \ + && test "x${isllibs}" = x \ + && test "x${islinc}" = x ; then + $1 + fi +] +) diff --git a/configure.ac b/configure.ac index 0ef2180..daf0e6a 100644 --- a/configure.ac +++ b/configure.ac @@ -132,7 +132,7 @@ build_tools="build-texinfo build-flex build-bison build-m4 build-fixincludes" # these libraries are used by various programs built for the host environment # -host_libs="intl libiberty opcodes bfd readline tcl tk itcl libgui zlib libcpp libdecnumber gmp mpfr mpc ppl cloog libelf libiconv" +host_libs="intl libiberty opcodes bfd readline tcl tk itcl libgui zlib libcpp libdecnumber gmp mpfr mpc ppl isl cloog libelf libiconv" # these tools are built for the host environment # Note, the powerpc-eabi build depends on sim occurring before gdb in order to @@ -1565,12 +1565,34 @@ fi AC_SUBST(ppllibs) AC_SUBST(pplinc) +# Check for ISL +ISL_INIT_FLAGS +if test "x${with_isl}" = x && test "x${with_isl_include}" = x \ + && test "x${with_isl_lib}" = x && test -d ${srcdir}/isl; then + isllibs='-L$$r/$(HOST_SUBDIR)/isl/'"$lt_cv_objdir"' ' + islinc='-I$$r/$(HOST_SUBDIR)/isl/include -I$$s/isl/include ' +fi +if test "x$with_isl" != "xno"; then + dnl The minimal version of ISL required for Graphite. + ISL_CHECK_VERSION(0,0,8) + + ISL_IF_FAILED([ + AC_MSG_ERROR([Unable to find a usable ISL. See config.log for details.])]) +fi # Check for CLOOG dnl Provide configure switches and initialize clooginc & clooglibs dnl with user input. CLOOG_INIT_FLAGS +if test "x$with_isl" = "xno"; then + dnl Only execute fail-action, if CLooG has been requested. + CLOOG_REQUESTED([graphite_requested=yes], [graphite_requested=no]) + if test "${graphite_requested}" = yes; then + AC_MSG_ERROR([Unable to find a usable ISL. See config.log for details.]) + fi + with_cloog=no +fi if test "x$with_ppl" = "xno"; then dnl Only execute fail-action, if CLooG has been requested. CLOOG_REQUESTED([graphite_requested=yes], [graphite_requested=no]) @@ -2655,7 +2677,7 @@ changequote(,) changequote([,]) case $lib in - mpc | mpfr | gmp | ppl | cloog) + mpc | mpfr | gmp | ppl | isl | cloog) # If we're processing --with-$lib, --with-$lib-include or # --with-$lib-lib, for one of the libs above, and target is # different from host, don't pass the current argument to any diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 2a9e877..34d2683 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -328,6 +328,10 @@ GMPINC = @GMPINC@ PPLLIBS = @PPLLIBS@ PPLINC = @PPLINC@ +# How to find ISL +ISLLIBS = @ISLLIBS@ +ISLINC = @ISLINC@ + # How to find CLOOG CLOOGLIBS = @CLOOGLIBS@ CLOOGINC = @CLOOGINC@ @@ -1068,7 +1072,7 @@ BUILD_LIBDEPS= $(BUILD_LIBIBERTY) # and the system's installed libraries. LIBS = @LIBS@ libcommon.a $(CPPLIB) $(LIBINTL) $(LIBICONV) $(LIBIBERTY) \ $(LIBDECNUMBER) $(HOST_LIBS) -BACKENDLIBS = $(CLOOGLIBS) $(PPLLIBS) $(GMPLIBS) $(PLUGINLIBS) $(HOST_LIBS) \ +BACKENDLIBS = $(CLOOGLIBS) $(PPLLIBS) $(ISLLIBS) $(GMPLIBS) $(PLUGINLIBS) $(HOST_LIBS) \ $(ZLIB) # Any system libraries needed just for GNAT. SYSLIBS = @GNAT_LIBEXC@ @@ -1100,7 +1104,7 @@ BUILD_ERRORS = build/errors.o INCLUDES = -I. -I$(@D) -I$(srcdir) -I$(srcdir)/$(@D) \ -I$(srcdir)/../include @INCINTL@ \ $(CPPINC) $(GMPINC) $(DECNUMINC) \ - $(PPLINC) $(CLOOGINC) + $(PPLINC) $(ISLINC) $(CLOOGINC) .c.o: $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $< $(OUTPUT_OPTION) diff --git a/gcc/configure.ac b/gcc/configure.ac index c71281c..faabfc0 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -4943,6 +4943,9 @@ AC_ARG_VAR(GMPINC,[How to find GMP include files]) AC_ARG_VAR(PPLLIBS,[How to link PPL]) AC_ARG_VAR(PPLINC,[How to find PPL include files]) +AC_ARG_VAR(ISLLIBS,[How to link ISL]) +AC_ARG_VAR(ISLINC,[How to find ISL include files]) + AC_ARG_VAR(CLOOGLIBS,[How to link CLOOG]) AC_ARG_VAR(CLOOGINC,[How to find CLOOG include files]) if test "x${CLOOGLIBS}" != "x" ; then