isl.m4 4.01 KB
Newer Older
Richard Biener committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
# 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
# <http://www.gnu.org/licenses/>.
#
# Contributed by Richard Guenther <rguenther@suse.de>
# Based on cloog.m4

# ISL_INIT_FLAGS ()
# -------------------------
22
# Provide configure switches for isl support.
Richard Biener committed
23 24 25 26 27 28
# Initialize isllibs/islinc according to the user input.
AC_DEFUN([ISL_INIT_FLAGS],
[
  AC_ARG_WITH([isl-include],
    [AS_HELP_STRING(
      [--with-isl-include=PATH],
29
      [Specify directory for installed isl include files])])
Richard Biener committed
30 31 32
  AC_ARG_WITH([isl-lib],
    [AS_HELP_STRING(
      [--with-isl-lib=PATH],
33
      [Specify the directory for the installed isl library])])
Richard Biener committed
34 35 36 37

  AC_ARG_ENABLE(isl-version-check,
    [AS_HELP_STRING(
      [--disable-isl-version-check],
38
      [disable check for isl version])],
Richard Biener committed
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
    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
61
  dnl If no --with-isl flag was specified and there is in-tree isl
Richard Biener committed
62
  dnl source, set up flags to use that and skip any version tests
63
  dnl as we cannot run them before building isl.
Richard Biener committed
64 65 66 67 68
  if test "x${islinc}" = x && test "x${isllibs}" = 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'
    ENABLE_ISL_CHECK=no
69
    AC_MSG_WARN([using in-tree isl, disabling version check])
Richard Biener committed
70
  fi
71 72

  isllibs="${isllibs} -lisl"
Richard Biener committed
73 74 75 76 77
]
)

# ISL_REQUESTED (ACTION-IF-REQUESTED, ACTION-IF-NOT)
# ----------------------------------------------------
78
# Provide actions for failed isl detection.
Richard Biener committed
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
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
]
)

95
# ISL_CHECK_VERSION ISL_CHECK_VERSION ()
Richard Biener committed
96
# ----------------------------------------------------------------
Sebastian Pop committed
97
# Test whether isl contains functionality added to the minimum expected version.
Richard Biener committed
98 99 100 101 102
AC_DEFUN([ISL_CHECK_VERSION],
[
  if test "${ENABLE_ISL_CHECK}" = yes ; then
    _isl_saved_CFLAGS=$CFLAGS
    _isl_saved_LDFLAGS=$LDFLAGS
103
    _isl_saved_LIBS=$LIBS
Richard Biener committed
104 105

    CFLAGS="${_isl_saved_CFLAGS} ${islinc} ${gmpinc}"
106 107
    LDFLAGS="${_isl_saved_LDFLAGS} ${isllibs} ${gmplibs}"
    LIBS="${_isl_saved_LIBS} -lisl -lgmp"
Richard Biener committed
108

109 110 111
    AC_MSG_CHECKING([for isl 0.15 or later])
    AC_TRY_LINK([#include <isl/schedule.h>],
                [isl_options_set_schedule_serialize_sccs (NULL, 0);],
112 113
                [gcc_cv_isl=yes],
                [gcc_cv_isl=no])
114
    AC_MSG_RESULT([$gcc_cv_isl])
Richard Biener committed
115

116
    if test "${gcc_cv_isl}" = no ; then
117
      AC_MSG_RESULT([required isl version is 0.15 or later])
118 119
    fi

Richard Biener committed
120 121
    CFLAGS=$_isl_saved_CFLAGS
    LDFLAGS=$_isl_saved_LDFLAGS
122
    LIBS=$_isl_saved_LIBS
Richard Biener committed
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146
  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
]
)