1# Plugin for offload execution on Intel MIC devices.
2#
3# Copyright (C) 2014 Free Software Foundation, Inc.
4#
5# Contributed by Andrey Turetskiy <andrey.turetskiy@intel.com>.
6#
7# This file is part of the GNU Offloading and Multi Processing Library
8# (libgomp).
9#
10# Libgomp is free software; you can redistribute it and/or modify it
11# under the terms of the GNU General Public License as published by
12# the Free Software Foundation; either version 3, or (at your option)
13# any later version.
14#
15# Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY
16# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
18# more details.
19#
20# Under Section 7 of GPL version 3, you are granted additional
21# permissions described in the GCC Runtime Library Exception, version
22# 3.1, as published by the Free Software Foundation.
23#
24# You should have received a copy of the GNU General Public License and
25# a copy of the GCC Runtime Library Exception along with this program;
26# see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
27# <http://www.gnu.org/licenses/>.
28
29# Process this file with autoconf to produce a configure script, like so:
30# aclocal -I ../.. -I ../../config && autoconf && automake
31
32AC_INIT([Intel MIC Offload Plugin], [1.0], ,[libgomp-plugin-intelmic])
33
34AC_CONFIG_AUX_DIR(../..)
35
36AC_CANONICAL_SYSTEM
37target_alias=${target_alias-$host_alias}
38AC_SUBST(target_alias)
39
40AM_INIT_AUTOMAKE([1.9.0 foreign no-dist])
41
42AM_MAINTAINER_MODE
43
44AC_PROG_CC
45AC_PROG_CXX
46AC_CONFIG_FILES([Makefile])
47AM_ENABLE_MULTILIB(, ../..)
48
49if test "${multilib}" = "yes"; then
50  multilib_arg="--enable-multilib"
51else
52  multilib_arg=
53fi
54
55# Make sure liboffloadmic is enabled
56case "$enable_liboffloadmic" in
57  host | target)
58    ;;
59  *)
60    AC_MSG_ERROR([Liboffloadmic is disabled]) ;;
61esac
62AM_CONDITIONAL(PLUGIN_HOST, [test x"$enable_liboffloadmic" = xhost])
63
64# Get accel target and path to build or install tree of accel compiler
65accel_search_dir=
66accel_target=
67if test x"$enable_liboffloadmic" = xhost; then
68  for accel in `echo $enable_offload_targets | sed -e 's#,# #g'`; do
69    accel_name=`echo $accel | sed 's/=.*//'`
70    accel_dir=`echo $accel | grep '=' | sed 's/.*=//'`
71    case "$accel_name" in
72      *-intelmic-* | *-intelmicemul-*)
73	accel_target=$accel_name
74	accel_search_dir=$accel_dir
75	;;
76    esac
77  done
78  if test x"$accel_target" = x; then
79    AC_MSG_ERROR([--enable-offload-targets does not contain intelmic target])
80  fi
81fi
82AC_SUBST(accel_search_dir)
83AC_SUBST(accel_target)
84
85AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
86AC_ARG_ENABLE([version-specific-runtime-libs],
87  AC_HELP_STRING([--enable-version-specific-runtime-libs],
88		 [Specify that runtime libraries should be installed in a compiler-specific directory]),
89  [case "$enableval" in
90    yes) enable_version_specific_runtime_libs=yes ;;
91    no)  enable_version_specific_runtime_libs=no ;;
92    *)   AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
93   esac],
94  [enable_version_specific_runtime_libs=no])
95AC_MSG_RESULT($enable_version_specific_runtime_libs)
96
97
98GCC_WITH_TOOLEXECLIBDIR
99
100# Calculate toolexeclibdir.
101# Also toolexecdir, though it's only used in toolexeclibdir.
102case ${enable_version_specific_runtime_libs} in
103  yes)
104    # Need the gcc compiler version to know where to install libraries
105    # and header files if --enable-version-specific-runtime-libs option
106    # is selected.
107    toolexecdir='$(libdir)/gcc/$(target_alias)'
108    toolexeclibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)'
109    ;;
110  no)
111    if test -n "$with_cross_host" &&
112       test x"$with_cross_host" != x"no"; then
113      # Install a library built with a cross compiler in tooldir, not libdir.
114      toolexecdir='$(exec_prefix)/$(target_alias)'
115      case ${with_toolexeclibdir} in
116	no)
117	  toolexeclibdir='$(toolexecdir)/lib'
118	  ;;
119	*)
120	  toolexeclibdir=${with_toolexeclibdir}
121	  ;;
122      esac
123    else
124      toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
125      toolexeclibdir='$(libdir)'
126    fi
127    multi_os_directory=`$CC -print-multi-os-directory`
128    case $multi_os_directory in
129      .) ;; # Avoid trailing /.
130      *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
131    esac
132    ;;
133esac
134
135AC_LIBTOOL_DLOPEN
136AM_PROG_LIBTOOL
137# Forbid libtool to hardcode RPATH, because we want to be able to specify
138# library search directory using LD_LIBRARY_PATH
139hardcode_into_libs=no
140AC_SUBST(toolexecdir)
141AC_SUBST(toolexeclibdir)
142
143# Determine what GCC version number to use in filesystem paths.
144GCC_BASE_VER
145
146# Must be last
147AC_OUTPUT
148