xref: /netbsd-src/external/gpl3/binutils/dist/config/isl.m4 (revision fc4f42693f9b1c31f39f9cf50af1bf2010325808)
19573673dSchristos# This file is part of GCC.
29573673dSchristos#
39573673dSchristos# GCC is free software; you can redistribute it and/or modify it under
49573673dSchristos# the terms of the GNU General Public License as published by the Free
59573673dSchristos# Software Foundation; either version 3, or (at your option) any later
69573673dSchristos# version.
79573673dSchristos#
89573673dSchristos# GCC is distributed in the hope that it will be useful, but WITHOUT
99573673dSchristos# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
109573673dSchristos# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
119573673dSchristos# for more details.
129573673dSchristos#
139573673dSchristos# You should have received a copy of the GNU General Public License
149573673dSchristos# along with GCC; see the file COPYING3.  If not see
159573673dSchristos# <http://www.gnu.org/licenses/>.
169573673dSchristos#
179573673dSchristos# Contributed by Richard Guenther <rguenther@suse.de>
189573673dSchristos# Based on cloog.m4
199573673dSchristos
209573673dSchristos# ISL_INIT_FLAGS ()
219573673dSchristos# -------------------------
228cbf5cb7Schristos# Provide configure switches for isl support.
239573673dSchristos# Initialize isllibs/islinc according to the user input.
249573673dSchristosAC_DEFUN([ISL_INIT_FLAGS],
259573673dSchristos[
269573673dSchristos  AC_ARG_WITH([isl-include],
279573673dSchristos    [AS_HELP_STRING(
289573673dSchristos      [--with-isl-include=PATH],
298cbf5cb7Schristos      [Specify directory for installed isl include files])])
309573673dSchristos  AC_ARG_WITH([isl-lib],
319573673dSchristos    [AS_HELP_STRING(
329573673dSchristos      [--with-isl-lib=PATH],
338cbf5cb7Schristos      [Specify the directory for the installed isl library])])
349573673dSchristos
359573673dSchristos  AC_ARG_ENABLE(isl-version-check,
369573673dSchristos    [AS_HELP_STRING(
379573673dSchristos      [--disable-isl-version-check],
388cbf5cb7Schristos      [disable check for isl version])],
399573673dSchristos    ENABLE_ISL_CHECK=$enableval,
409573673dSchristos    ENABLE_ISL_CHECK=yes)
419573673dSchristos
429573673dSchristos  # Initialize isllibs and islinc.
439573673dSchristos  case $with_isl in
449573673dSchristos    no)
459573673dSchristos      isllibs=
469573673dSchristos      islinc=
479573673dSchristos      ;;
489573673dSchristos    "" | yes)
499573673dSchristos      ;;
509573673dSchristos    *)
519573673dSchristos      isllibs="-L$with_isl/lib"
529573673dSchristos      islinc="-I$with_isl/include"
539573673dSchristos      ;;
549573673dSchristos  esac
559573673dSchristos  if test "x${with_isl_include}" != x ; then
569573673dSchristos    islinc="-I$with_isl_include"
579573673dSchristos  fi
589573673dSchristos  if test "x${with_isl_lib}" != x; then
599573673dSchristos    isllibs="-L$with_isl_lib"
609573673dSchristos  fi
618cbf5cb7Schristos  dnl If no --with-isl flag was specified and there is in-tree isl
629573673dSchristos  dnl source, set up flags to use that and skip any version tests
638cbf5cb7Schristos  dnl as we cannot run them before building isl.
649573673dSchristos  if test "x${islinc}" = x && test "x${isllibs}" = x \
659573673dSchristos     && test -d ${srcdir}/isl; then
669573673dSchristos    isllibs='-L$$r/$(HOST_SUBDIR)/isl/'"$lt_cv_objdir"' '
679573673dSchristos    islinc='-I$$r/$(HOST_SUBDIR)/isl/include -I$$s/isl/include'
689573673dSchristos    ENABLE_ISL_CHECK=no
698cbf5cb7Schristos    AC_MSG_WARN([using in-tree isl, disabling version check])
709573673dSchristos  fi
719573673dSchristos
729573673dSchristos  isllibs="${isllibs} -lisl"
739573673dSchristos]
749573673dSchristos)
759573673dSchristos
769573673dSchristos# ISL_REQUESTED (ACTION-IF-REQUESTED, ACTION-IF-NOT)
779573673dSchristos# ----------------------------------------------------
788cbf5cb7Schristos# Provide actions for failed isl detection.
799573673dSchristosAC_DEFUN([ISL_REQUESTED],
809573673dSchristos[
819573673dSchristos  AC_REQUIRE([ISL_INIT_FLAGS])
829573673dSchristos
839573673dSchristos  if test "x${with_isl}" = xno; then
849573673dSchristos    $2
859573673dSchristos  elif test "x${with_isl}" != x \
869573673dSchristos    || test "x${with_isl_include}" != x \
879573673dSchristos    || test "x${with_isl_lib}" != x ; then
889573673dSchristos    $1
899573673dSchristos  else
909573673dSchristos    $2
919573673dSchristos  fi
929573673dSchristos]
939573673dSchristos)
949573673dSchristos
959573673dSchristos# ISL_CHECK_VERSION ISL_CHECK_VERSION ()
969573673dSchristos# ----------------------------------------------------------------
978cbf5cb7Schristos# Test whether isl contains functionality added to the minimum expected version.
989573673dSchristosAC_DEFUN([ISL_CHECK_VERSION],
999573673dSchristos[
1009573673dSchristos  if test "${ENABLE_ISL_CHECK}" = yes ; then
1019573673dSchristos    _isl_saved_CFLAGS=$CFLAGS
1029573673dSchristos    _isl_saved_LDFLAGS=$LDFLAGS
1039573673dSchristos    _isl_saved_LIBS=$LIBS
1049573673dSchristos
1059573673dSchristos    CFLAGS="${_isl_saved_CFLAGS} ${islinc} ${gmpinc}"
1068cbf5cb7Schristos    LDFLAGS="${_isl_saved_LDFLAGS} ${isllibs} ${gmplibs}"
1078cbf5cb7Schristos    LIBS="${_isl_saved_LIBS} -lisl -lgmp"
1089573673dSchristos
109*fc4f4269Schristos    AC_MSG_CHECKING([for isl 0.15 or later])
110*fc4f4269Schristos    AC_TRY_LINK([#include <isl/schedule.h>],
111*fc4f4269Schristos                [isl_options_set_schedule_serialize_sccs (NULL, 0);],
1129573673dSchristos                [gcc_cv_isl=yes],
1139573673dSchristos                [gcc_cv_isl=no])
1149573673dSchristos    AC_MSG_RESULT([$gcc_cv_isl])
1159573673dSchristos
1168cbf5cb7Schristos    if test "${gcc_cv_isl}" = no ; then
117*fc4f4269Schristos      AC_MSG_RESULT([required isl version is 0.15 or later])
1188cbf5cb7Schristos    fi
1198cbf5cb7Schristos
1209573673dSchristos    CFLAGS=$_isl_saved_CFLAGS
1219573673dSchristos    LDFLAGS=$_isl_saved_LDFLAGS
1229573673dSchristos    LIBS=$_isl_saved_LIBS
1239573673dSchristos  fi
1249573673dSchristos]
1259573673dSchristos)
1269573673dSchristos
1279573673dSchristos# ISL_IF_FAILED (ACTION-IF-FAILED)
1289573673dSchristos# ----------------------------------
1299573673dSchristos# Executes ACTION-IF-FAILED, if GRAPHITE was requested and
1309573673dSchristos# the checks failed.
1319573673dSchristosAC_DEFUN([ISL_IF_FAILED],
1329573673dSchristos[
1339573673dSchristos  ISL_REQUESTED([graphite_requested=yes], [graphite_requested=no])
1349573673dSchristos
1359573673dSchristos  if test "${gcc_cv_isl}" = no ; then
1369573673dSchristos    isllibs=
1379573673dSchristos    islinc=
1389573673dSchristos  fi
1399573673dSchristos
1409573673dSchristos  if test "${graphite_requested}" = yes \
1419573673dSchristos    && test "x${isllibs}" = x \
1429573673dSchristos    && test "x${islinc}" = x ; then
1439573673dSchristos    $1
1449573673dSchristos  fi
1459573673dSchristos]
1469573673dSchristos)
147