1 # Plugins for offload execution, configure.ac fragment. -*- mode: autoconf -*-
3 # Copyright (C) 2014-2024 Free Software Foundation, Inc.
5 # Contributed by Mentor Embedded.
7 # This file is part of the GNU Offloading and Multi Processing Library
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)
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
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.
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/>.
32 AC_CHECK_LIB(dl, dlsym, [DL_LIBS=-ldl], [plugin_support=no])
33 if test x"$plugin_support" = xyes; then
34 AC_DEFINE(PLUGIN_SUPPORT, 1,
35 [Define if all infrastructure, needed for plugins, is supported.])
36 elif test "x${enable_offload_targets-no}" != xno; then
37 AC_MSG_ERROR([Can't support offloading without support for plugins])
39 AC_CHECK_HEADERS_ONCE(unistd.h)
40 AC_CHECK_FUNCS_ONCE(secure_getenv __secure_getenv getuid geteuid getgid getegid)
45 # Parse '--enable-offload-targets', figure out the corresponding libgomp
46 # plugins, and configure to find the corresponding offload compilers.
47 # 'offload_plugins' and 'offload_targets' will be populated in the same order.
50 AC_SUBST(offload_plugins)
51 AC_SUBST(offload_targets)
52 offload_additional_options=
53 offload_additional_lib_paths=
54 AC_SUBST(offload_additional_options)
55 AC_SUBST(offload_additional_lib_paths)
56 if test x"$enable_offload_targets" != x; then
57 for tgt in `echo $enable_offload_targets | sed -e 's#,# #g'`; do
58 tgt_dir=`echo $tgt | grep '=' | sed 's/.*=//'`
59 tgt=`echo $tgt | sed 's/=.*//'`
64 aarch64*-*-* | powerpc64le-*-* | x86_64-*-*)
65 case "$ac_cv_sizeof_void_p" in
67 # PR libgomp/65099: Currently, we only support offloading in
68 # 64-bit configurations.
78 # Target architecture not supported.
86 case "$ac_cv_sizeof_void_p" in
102 AC_MSG_ERROR([unknown offload target specified])
105 if test x"$tgt_plugin" = x; then
106 # Not configuring libgomp for this offload target if we're not building
107 # the corresponding offload plugin.
109 elif test x"$offload_plugins" = x; then
110 offload_plugins=$tgt_plugin
113 offload_plugins=$offload_plugins,$tgt_plugin
114 offload_targets=$offload_targets,$tgt
116 # Configure additional search paths.
117 if test x"$tgt_dir" != x; then
118 offload_additional_options="$offload_additional_options -B$tgt_dir/\$(libexecdir:\$(exec_prefix)/%=%)/gcc/\$(target_alias)/\$(gcc_version) -B$tgt_dir/bin"
119 offload_additional_lib_paths="$offload_additional_lib_paths:$tgt_dir/lib64:$tgt_dir/lib:$tgt_dir/lib32"
121 offload_additional_options="$offload_additional_options -B\$(libexecdir)/gcc/\$(target_alias)/\$(gcc_version) -B\$(bindir)"
122 offload_additional_lib_paths="$offload_additional_lib_paths:$toolexeclibdir"
126 AC_DEFINE_UNQUOTED(OFFLOAD_PLUGINS, "$offload_plugins",
127 [Define to offload plugins, separated by commas.])
128 AM_CONDITIONAL([PLUGIN_NVPTX], [test $PLUGIN_NVPTX = 1])
129 AM_CONDITIONAL([PLUGIN_GCN], [test $PLUGIN_GCN = 1])