[gomp4] Move libgomp plugins into subdirectory
diff mbox

Message ID 20141106202246.3aec17b3@octopus
State New
Headers show

Commit Message

Julian Brown Nov. 6, 2014, 8:22 p.m. UTC
On Thu, 6 Nov 2014 15:37:42 +0000
Julian Brown <julian@codesourcery.com> wrote:

> On Thu, 6 Nov 2014 11:11:42 +0100
> Jakub Jelinek <jakub@redhat.com> wrote:
> 
> > On Thu, Nov 06, 2014 at 10:06:00AM +0100, Thomas Schwinge wrote:
> > > Hmm.  And then we "cross-include" files in libgomp/ from
> > > libgomp/plugin/ as well as the other way round
> > > (libgomp/oacc-host.c including libgomp/plugin/plugin-host.c, for
> > > example) -- whilst these two "regimes" are configured by two
> > > separate Autoconf instances?  Is this really the intended scheme,
> > > or should we maybe rather have a top-level libgomp
> > > Autoconf/Automake system (as before), which is amended by
> > > libgomp/plugin/configfrag.ac and libgomp/plugin/Makefrag.am files
> > > that are included from libgomp/configure.ac and
> > > libgomp/Makefile.am?

> > I agree a plugin fragment into libgomp/configure.ac and/or
> > libgomp/Makefile* is better.
> 
> [...] work on refactoring those configury bits (which will revert some
> of the attached, including moving libgomp-test-support.exp.in back to
> its previous location, but never mind).

Does this look like what you had in mind? (I think liboffloadmic uses a
similar recursive autotools invocation for its libgomp plugin -- maybe
that wants refactoring too?).

Thanks,

Julian

ChangeLog

    * contrib/gcc_update (libgomp/aclocal.m4, libgomp/Makefile.in)
    (libgomp/configure, libgomp/config.h.in): Add depends for plugin
    config fragments.
    (libgomp/plugin/aclocal.m4, libgomp/plugin/Makefile.in)
    (libgomp/plugin/configure, libgomp/plugin/config.h.in): Remove.

    libgomp/
    * Makefile.am (SUBDIRS): Remove plugin subdir.
    (DIST_SUBDIRS): Delete.
    (search_path): Add ($top_srcdir)/../include.
    (AM_CPPFLAGS): Remove -I$(top_srcdir)/../include.
    (plugin/Makefrag.in): Include.
    * Makefile.in: Regenerate.
    * configure.ac (plugin): Remove from AC_CONFIG_SUBDIRS.
    (plugin/configfrag.ac): Include.
    (testsuite/libgomp-test-support.exp): Add to AC_CONFIG_FILES.
    * configure: Regenerate.
    * plugin/Makefile.am: Remove, refactor into...
    * plugin/Makefrag.am: ...this. New.
    * plugin/aclocal.m4: Remove.
    * plugin/config.h.in: Remove.
    * plugin/configure: Remove.
    * plugin/configure.ac: Remove, refactor into...
    * plugin/configfrag.ac: ...this. New.
    * plugin/libgomp-test-support-exp.in: Move back to...
    * testsuite/libgomp-test-support-exp.in: Here.
    * testsuite/lib/libgomp.exp (libgomp-test-support.exp): Include
    from current directory, not plugin dir.

Patch
diff mbox

commit ea1335fc5a4aed75ad0f299969520f10e2f27435
Author: Julian Brown <julian@codesourcery.com>
Date:   Thu Nov 6 11:54:25 2014 -0800

    Don't use recursive autoconf/automake for libgomp plugins

diff --git a/contrib/gcc_update b/contrib/gcc_update
index a50dc8c..2903d7a 100755
--- a/contrib/gcc_update
+++ b/contrib/gcc_update
@@ -138,15 +138,11 @@  libjava/libltdl/config-h.in: libjava/libltdl/configure.ac libjava/libltdl/acloca
 libcpp/aclocal.m4: libcpp/configure.ac
 libcpp/Makefile.in: libcpp/configure.ac libcpp/aclocal.m4
 libcpp/configure: libcpp/configure.ac libcpp/aclocal.m4
-libgomp/aclocal.m4: libgomp/configure.ac libgomp/acinclude.m4
-libgomp/Makefile.in: libgomp/Makefile.am libgomp/aclocal.m4
+libgomp/aclocal.m4: libgomp/configure.ac libgomp/acinclude.m4 libgomp/plugin/configfrag.ac
+libgomp/Makefile.in: libgomp/Makefile.am libgomp/aclocal.m4 libgomp/plugin/Makefrag.am
 libgomp/testsuite/Makefile.in: libgomp/testsuite/Makefile.am libgomp/aclocal.m4
-libgomp/configure: libgomp/configure.ac libgomp/aclocal.m4
-libgomp/config.h.in: libgomp/configure.ac libgomp/aclocal.m4
-libgomp/plugin/aclocal.m4: libgomp/plugin/configure.ac
-libgomp/plugin/Makefile.in: libgomp/plugin/Makefile.am libgomp/plugin/aclocal.m4
-libgomp/plugin/configure: libgomp/plugin/configure.ac libgomp/plugin/aclocal.m4
-libgomp/plugin/config.h.in: libgomp/plugin/configure.ac libgomp/plugin/aclocal.m4
+libgomp/configure: libgomp/configure.ac libgomp/aclocal.m4 libgomp/plugin/configfrag.ac
+libgomp/config.h.in: libgomp/configure.ac libgomp/aclocal.m4 libgomp/plugin/configfrag.ac
 libitm/aclocal.m4: libitm/configure.ac libitm/acinclude.m4
 libitm/Makefile.in: libitm/Makefile.am libitm/aclocal.m4
 libitm/testsuite/Makefile.in: libitm/testsuite/Makefile.am libitm/aclocal.m4
diff --git a/libgomp/Makefile.am b/libgomp/Makefile.am
index f265c5d..dc2f88a 100644
--- a/libgomp/Makefile.am
+++ b/libgomp/Makefile.am
@@ -1,21 +1,21 @@ 
 ## Process this file with automake to produce Makefile.in
 
 ACLOCAL_AMFLAGS = -I .. -I ../config
-SUBDIRS = testsuite plugin
-DIST_SUBDIRS = plugin
+SUBDIRS = testsuite
 
 ## May be used by toolexeclibdir.
 gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
 
 config_path = @config_path@
-search_path = $(addprefix $(top_srcdir)/config/, $(config_path)) $(top_srcdir)
+search_path = $(addprefix $(top_srcdir)/config/, $(config_path)) $(top_srcdir) \
+	      $(top_srcdir)/../include
 
 fincludedir = $(libdir)/gcc/$(target_alias)/$(gcc_version)/finclude
 libsubincludedir = $(libdir)/gcc/$(target_alias)/$(gcc_version)/include
 
 vpath % $(strip $(search_path))
 
-AM_CPPFLAGS = $(addprefix -I, $(search_path)) -I$(top_srcdir)/../include
+AM_CPPFLAGS = $(addprefix -I, $(search_path))
 AM_CFLAGS = $(XCFLAGS)
 AM_LDFLAGS = $(XLDFLAGS) $(SECTION_LDFLAGS) $(OPT_LDFLAGS)
 
@@ -65,6 +65,8 @@  libgomp_la_SOURCES = alloc.c barrier.c critical.c env.c error.c iter.c \
 	oacc-host.c oacc-init.c oacc-mem.c oacc-async.c \
 	oacc-plugin.c oacc-cuda.c libgomp-plugin.c
 
+include $(top_srcdir)/plugin/Makefrag.am
+
 if USE_FORTRAN
 libgomp_la_SOURCES += openacc.f90
 endif
diff --git a/libgomp/Makefile.in b/libgomp/Makefile.in
index ea3e1ca..6fd11f0 100644
diff --git a/libgomp/configure b/libgomp/configure
index 2a3e606..a3ebd7f 100755
diff --git a/libgomp/configure.ac b/libgomp/configure.ac
index 15cc3dc..f3baf28 100644
--- a/libgomp/configure.ac
+++ b/libgomp/configure.ac
@@ -205,7 +205,7 @@  elif test "x$enable_accelerator" != xno; then
   AC_MSG_ERROR([Can't have support for accelerators without support for plugins])
 fi
 
-AC_CONFIG_SUBDIRS([plugin])
+m4_include([plugin/configfrag.ac])
 
 # Check for functions needed.
 AC_CHECK_FUNCS(getloadavg clock_gettime strtoull)
@@ -361,5 +361,6 @@  CFLAGS="$save_CFLAGS"
 
 AC_CONFIG_FILES(omp.h omp_lib.h omp_lib.f90 libgomp_f.h)
 AC_CONFIG_FILES(Makefile testsuite/Makefile)
+AC_CONFIG_FILES([testsuite/libgomp-test-support.exp])
 AC_CONFIG_FILES(libgomp.spec)
 AC_OUTPUT
diff --git a/libgomp/plugin/Makefile.am b/libgomp/plugin/Makefile.am
deleted file mode 100644
index 59a5b95..0000000
--- a/libgomp/plugin/Makefile.am
+++ /dev/null
@@ -1,64 +0,0 @@ 
-# Plugins for offload execution.
-#
-# Copyright (C) 2014 Free Software Foundation, Inc.
-#
-# Contributed by Mentor Embedded.
-#
-# This file is part of the GNU OpenMP Library (libgomp).
-#
-# Libgomp 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.
-#
-# Libgomp 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.
-#
-# Under Section 7 of GPL version 3, you are granted additional
-# permissions described in the GCC Runtime Library Exception, version
-# 3.1, as published by the Free Software Foundation.
-#
-# You should have received a copy of the GNU General Public License and
-# a copy of the GCC Runtime Library Exception along with this program;
-# see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
-# <http://www.gnu.org/licenses/>.
-
-ACLOCAL_AMFLAGS = -I ../.. -I ../../config
-
-config_path = @config_path@
-search_path = .. $(addprefix $(top_srcdir)/../config/, $(config_path)) \
-	      $(top_srcdir) $(top_srcdir)/../../include $(top_srcdir)/..
-
-AM_CPPFLAGS = $(addprefix -I, $(search_path))
-AM_CFLAGS = $(XCFLAGS)
-AM_LDFLAGS = $(XLDFLAGS) $(SECTION_LDFLAGS) $(OPT_LDFLAGS)
-
-toolexeclib_LTLIBRARIES =
-
-if PLUGIN_NVPTX
-# Nvidia PTX OpenACC plugin.
-libgomp_plugin_nvptx_version_info = -version-info $(libtool_VERSION)
-toolexeclib_LTLIBRARIES += libgomp-plugin-nvptx.la
-libgomp_plugin_nvptx_la_SOURCES = plugin-nvptx.c
-libgomp_plugin_nvptx_la_CPPFLAGS = $(AM_CPPFLAGS) $(PLUGIN_NVPTX_CPPFLAGS)
-libgomp_plugin_nvptx_la_LDFLAGS = $(libgomp_plugin_nvptx_version_info) \
-	$(lt_host_flags)
-libgomp_plugin_nvptx_la_LDFLAGS += $(PLUGIN_NVPTX_LDFLAGS)
-libgomp_plugin_nvptx_la_LIBADD = $(PLUGIN_NVPTX_LIBS)
-libgomp_plugin_nvptx_la_LIBTOOLFLAGS = --tag=disable-static
-endif
-
-libgomp_plugin_host_nonshm_version_info = -version-info $(libtool_VERSION)
-toolexeclib_LTLIBRARIES += libgomp-plugin-host_nonshm.la
-libgomp_plugin_host_nonshm_la_SOURCES = plugin-host.c
-libgomp_plugin_host_nonshm_la_CPPFLAGS = $(AM_CPPFLAGS) -DHOST_NONSHM_PLUGIN
-libgomp_plugin_host_nonshm_la_LDFLAGS = \
-	$(libgomp_plugin_host_nonshm_version_info) $(lt_host_flags)
-libgomp_plugin_host_nonshm_la_LIBTOOLFLAGS = --tag=disable-static
-
-LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../../libtool-ldflags $(LDFLAGS))
-
-LINK = $(LIBTOOL) --tag CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \
-	$(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LTLDFLAGS) -o $@
diff --git a/libgomp/plugin/Makefile.in b/libgomp/plugin/Makefile.in
deleted file mode 100644
index 1e5cb9d..0000000
diff --git a/libgomp/plugin/Makefrag.am b/libgomp/plugin/Makefrag.am
new file mode 100644
index 0000000..d6642d9
--- /dev/null
+++ b/libgomp/plugin/Makefrag.am
@@ -0,0 +1,47 @@ 
+# Plugins for offload execution, Makefile.am fragment.
+#
+# Copyright (C) 2014 Free Software Foundation, Inc.
+#
+# Contributed by Mentor Embedded.
+#
+# This file is part of the GNU OpenMP Library (libgomp).
+#
+# Libgomp 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.
+#
+# Libgomp 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.
+#
+# Under Section 7 of GPL version 3, you are granted additional
+# permissions described in the GCC Runtime Library Exception, version
+# 3.1, as published by the Free Software Foundation.
+#
+# You should have received a copy of the GNU General Public License and
+# a copy of the GCC Runtime Library Exception along with this program;
+# see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+# <http://www.gnu.org/licenses/>.
+
+if PLUGIN_NVPTX
+# Nvidia PTX OpenACC plugin.
+libgomp_plugin_nvptx_version_info = -version-info $(libtool_VERSION)
+toolexeclib_LTLIBRARIES += libgomp-plugin-nvptx.la
+libgomp_plugin_nvptx_la_SOURCES = plugin/plugin-nvptx.c
+libgomp_plugin_nvptx_la_CPPFLAGS = $(AM_CPPFLAGS) $(PLUGIN_NVPTX_CPPFLAGS)
+libgomp_plugin_nvptx_la_LDFLAGS = $(libgomp_plugin_nvptx_version_info) \
+	$(lt_host_flags)
+libgomp_plugin_nvptx_la_LDFLAGS += $(PLUGIN_NVPTX_LDFLAGS)
+libgomp_plugin_nvptx_la_LIBADD = $(PLUGIN_NVPTX_LIBS)
+libgomp_plugin_nvptx_la_LIBTOOLFLAGS = --tag=disable-static
+endif
+
+libgomp_plugin_host_nonshm_version_info = -version-info $(libtool_VERSION)
+toolexeclib_LTLIBRARIES += libgomp-plugin-host_nonshm.la
+libgomp_plugin_host_nonshm_la_SOURCES = plugin/plugin-host.c
+libgomp_plugin_host_nonshm_la_CPPFLAGS = $(AM_CPPFLAGS) -DHOST_NONSHM_PLUGIN
+libgomp_plugin_host_nonshm_la_LDFLAGS = \
+	$(libgomp_plugin_host_nonshm_version_info) $(lt_host_flags)
+libgomp_plugin_host_nonshm_la_LIBTOOLFLAGS = --tag=disable-static
diff --git a/libgomp/plugin/aclocal.m4 b/libgomp/plugin/aclocal.m4
deleted file mode 100644
index 06820b7..0000000
diff --git a/libgomp/plugin/config.h.in b/libgomp/plugin/config.h.in
deleted file mode 100644
index d044b92..0000000
diff --git a/libgomp/plugin/configfrag.ac b/libgomp/plugin/configfrag.ac
new file mode 100644
index 0000000..68c7dc7
--- /dev/null
+++ b/libgomp/plugin/configfrag.ac
@@ -0,0 +1,107 @@ 
+# Plugins for offload execution, configure.ac fragment.
+#
+# Copyright (C) 2014 Free Software Foundation, Inc.
+#
+# Contributed by Mentor Embedded.
+#
+# This file is part of the GNU OpenMP Library (libgomp).
+#
+# Libgomp 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.
+#
+# Libgomp 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.
+#
+# Under Section 7 of GPL version 3, you are granted additional
+# permissions described in the GCC Runtime Library Exception, version
+# 3.1, as published by the Free Software Foundation.
+#
+# You should have received a copy of the GNU General Public License and
+# a copy of the GCC Runtime Library Exception along with this program;
+# see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+# <http://www.gnu.org/licenses/>.
+
+# Look for the CUDA driver package.
+CUDA_DRIVER_INCLUDE=
+CUDA_DRIVER_LIB=
+AC_SUBST(CUDA_DRIVER_INCLUDE)
+AC_SUBST(CUDA_DRIVER_LIB)
+CUDA_DRIVER_CPPFLAGS=
+CUDA_DRIVER_LDFLAGS=
+AC_ARG_WITH(cuda-driver,
+	[AS_HELP_STRING([--with-cuda-driver=PATH],
+		[specify prefix directory for installed CUDA driver package.
+		 Equivalent to --with-cuda-driver-include=PATH/include
+		 plus --with-cuda-driver-lib=PATH/lib])])
+AC_ARG_WITH(cuda-driver-include,
+	[AS_HELP_STRING([--with-cuda-driver-include=PATH],
+		[specify directory for installed CUDA driver include files])])
+AC_ARG_WITH(cuda-driver-lib,
+	[AS_HELP_STRING([--with-cuda-driver-lib=PATH],
+		[specify directory for the installed CUDA driver library])])
+if test "x$with_cuda_driver" != x; then
+  CUDA_DRIVER_INCLUDE=$with_cuda_driver/include
+  CUDA_DRIVER_LIB=$with_cuda_driver/lib
+fi
+if test "x$with_cuda_driver_include" != x; then
+  CUDA_DRIVER_INCLUDE=$with_cuda_driver_include
+fi
+if test "x$with_cuda_driver_lib" != x; then
+  CUDA_DRIVER_LIB=$with_cuda_driver_lib
+fi
+if test "x$CUDA_DRIVER_INCLUDE" != x; then
+  CUDA_DRIVER_CPPFLAGS=-I$CUDA_DRIVER_INCLUDE
+fi
+if test "x$CUDA_DRIVER_LIB" != x; then
+  CUDA_DRIVER_LDFLAGS=-L$CUDA_DRIVER_LIB
+fi
+
+PLUGIN_NVPTX=0
+PLUGIN_NVPTX_CPPFLAGS=
+PLUGIN_NVPTX_LDFLAGS=
+PLUGIN_NVPTX_LIBS=
+AC_SUBST(PLUGIN_NVPTX)
+AC_SUBST(PLUGIN_NVPTX_CPPFLAGS)
+AC_SUBST(PLUGIN_NVPTX_LDFLAGS)
+AC_SUBST(PLUGIN_NVPTX_LIBS)
+
+for accel in `echo $enable_offload_targets | sed -e 's#,# #g'`; do
+  case "$accel" in
+    nvptx*)
+      PLUGIN_NVPTX=$accel
+      PLUGIN_NVPTX_CPPFLAGS=$CUDA_DRIVER_CPPFLAGS
+      PLUGIN_NVPTX_LDFLAGS=$CUDA_DRIVER_LDFLAGS
+      PLUGIN_NVPTX_LIBS='-lcuda'
+
+      PLUGIN_NVPTX_save_CPPFLAGS=$CPPFLAGS
+      CPPFLAGS="$PLUGIN_NVPTX_CPPFLAGS $CPPFLAGS"
+      PLUGIN_NVPTX_save_LDFLAGS=$LDFLAGS
+      LDFLAGS="$PLUGIN_NVPTX_LDFLAGS $LDFLAGS"
+      PLUGIN_NVPTX_save_LIBS=$LIBS
+      LIBS="$PLUGIN_NVPTX_LIBS $LIBS"
+      AC_LINK_IFELSE(
+	[AC_LANG_PROGRAM(
+	  [#include "cuda.h"],
+	  [CUresult r = cuCtxPushCurrent (NULL);])],
+	[PLUGIN_NVPTX=1])
+      CPPFLAGS=$PLUGIN_NVPTX_save_CPPFLAGS
+      LDFLAGS=$PLUGIN_NVPTX_save_LDFLAGS
+      LIBS=$PLUGIN_NVPTX_save_LIBS
+      case $PLUGIN_NVPTX in
+	nvptx*)
+	  PLUGIN_NVPTX=0
+	  AC_MSG_ERROR([CUDA driver package required for nvptx support])
+	  ;;
+      esac
+      ;;
+  esac
+done
+AM_CONDITIONAL([PLUGIN_NVPTX], [test $PLUGIN_NVPTX = 1])
+AC_DEFINE_UNQUOTED([PLUGIN_NVPTX], [$PLUGIN_NVPTX],
+		  [Define to 1 if the NVIDIA plugin is built, 0 if not.])
+
+AC_OUTPUT
diff --git a/libgomp/plugin/configure b/libgomp/plugin/configure
deleted file mode 100644
index da64149..0000000
diff --git a/libgomp/plugin/configure.ac b/libgomp/plugin/configure.ac
deleted file mode 100644
index bc2565c..0000000
--- a/libgomp/plugin/configure.ac
+++ /dev/null
@@ -1,179 +0,0 @@ 
-# Plugins for offload execution.
-#
-# Copyright (C) 2014 Free Software Foundation, Inc.
-#
-# Contributed by Mentor Embedded.
-#
-# This file is part of the GNU OpenMP Library (libgomp).
-#
-# Libgomp 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.
-#
-# Libgomp 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.
-#
-# Under Section 7 of GPL version 3, you are granted additional
-# permissions described in the GCC Runtime Library Exception, version
-# 3.1, as published by the Free Software Foundation.
-#
-# You should have received a copy of the GNU General Public License and
-# a copy of the GCC Runtime Library Exception along with this program;
-# see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
-# <http://www.gnu.org/licenses/>.
-
-AC_PREREQ([2.64])
-AC_INIT([Plugins for GNU OpenMP Runtime Library], [1.0], ,[libgomp-plugins])
-AC_CONFIG_HEADER([config.h])
-
-AC_CANONICAL_SYSTEM
-target_alias=${target_alias-$host_alias}
-AC_SUBST(target_alias)
-
-AM_INIT_AUTOMAKE([1.9.0 foreign no-dist])
-
-AM_MAINTAINER_MODE
-
-AC_PROG_CC
-AC_PROG_CXX
-
-AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
-AC_ARG_ENABLE([version-specific-runtime-libs],
-  AC_HELP_STRING([--enable-version-specific-runtime-libs],
-		 [Specify that runtime libraries should be installed in a compiler-specific directory]),
-  [case "$enableval" in
-    yes) enable_version_specific_runtime_libs=yes ;;
-    no)  enable_version_specific_runtime_libs=no ;;
-    *)   AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
-   esac],
-  [enable_version_specific_runtime_libs=no])
-AC_MSG_RESULT($enable_version_specific_runtime_libs)
-
-# Calculate toolexeclibdir
-# Also toolexecdir, though it's only used in toolexeclibdir
-case ${enable_version_specific_runtime_libs} in
-  yes)
-    # Need the gcc compiler version to know where to install libraries
-    # and header files if --enable-version-specific-runtime-libs option
-    # is selected.
-    toolexecdir='$(libdir)/gcc/$(target_alias)'
-    toolexeclibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)'
-    ;;
-  no)
-    if test -n "$with_cross_host" &&
-       test x"$with_cross_host" != x"no"; then
-      # Install a library built with a cross compiler in tooldir, not libdir.
-      toolexecdir='$(exec_prefix)/$(target_alias)'
-      toolexeclibdir='$(toolexecdir)/lib'
-    else
-      toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
-      toolexeclibdir='$(libdir)'
-    fi
-    multi_os_directory=`$CC -print-multi-os-directory`
-    case $multi_os_directory in
-      .) ;; # Avoid trailing /.
-      *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
-    esac
-    ;;
-esac
-
-AC_LIBTOOL_DLOPEN
-AM_PROG_LIBTOOL
-# Forbid libtool to hardcode RPATH, because we want to be able to specify
-# library search directory using LD_LIBRARY_PATH
-hardcode_into_libs=no
-AC_SUBST(toolexecdir)
-AC_SUBST(toolexeclibdir)
-
-libtool_VERSION=1:0:0
-AC_SUBST(libtool_VERSION)
-
-# Look for the CUDA driver package.
-CUDA_DRIVER_INCLUDE=
-CUDA_DRIVER_LIB=
-AC_SUBST(CUDA_DRIVER_INCLUDE)
-AC_SUBST(CUDA_DRIVER_LIB)
-CUDA_DRIVER_CPPFLAGS=
-CUDA_DRIVER_LDFLAGS=
-AC_ARG_WITH(cuda-driver,
-	[AS_HELP_STRING([--with-cuda-driver=PATH],
-		[specify prefix directory for installed CUDA driver package.
-		 Equivalent to --with-cuda-driver-include=PATH/include
-		 plus --with-cuda-driver-lib=PATH/lib])])
-AC_ARG_WITH(cuda-driver-include,
-	[AS_HELP_STRING([--with-cuda-driver-include=PATH],
-		[specify directory for installed CUDA driver include files])])
-AC_ARG_WITH(cuda-driver-lib,
-	[AS_HELP_STRING([--with-cuda-driver-lib=PATH],
-		[specify directory for the installed CUDA driver library])])
-if test "x$with_cuda_driver" != x; then
-  CUDA_DRIVER_INCLUDE=$with_cuda_driver/include
-  CUDA_DRIVER_LIB=$with_cuda_driver/lib
-fi
-if test "x$with_cuda_driver_include" != x; then
-  CUDA_DRIVER_INCLUDE=$with_cuda_driver_include
-fi
-if test "x$with_cuda_driver_lib" != x; then
-  CUDA_DRIVER_LIB=$with_cuda_driver_lib
-fi
-if test "x$CUDA_DRIVER_INCLUDE" != x; then
-  CUDA_DRIVER_CPPFLAGS=-I$CUDA_DRIVER_INCLUDE
-fi
-if test "x$CUDA_DRIVER_LIB" != x; then
-  CUDA_DRIVER_LDFLAGS=-L$CUDA_DRIVER_LIB
-fi
-
-PLUGIN_NVPTX=0
-PLUGIN_NVPTX_CPPFLAGS=
-PLUGIN_NVPTX_LDFLAGS=
-PLUGIN_NVPTX_LIBS=
-AC_SUBST(PLUGIN_NVPTX)
-AC_SUBST(PLUGIN_NVPTX_CPPFLAGS)
-AC_SUBST(PLUGIN_NVPTX_LDFLAGS)
-AC_SUBST(PLUGIN_NVPTX_LIBS)
-
-for accel in `echo $enable_offload_targets | sed -e 's#,# #g'`; do
-  case "$accel" in
-    nvptx*)
-      PLUGIN_NVPTX=$accel
-      PLUGIN_NVPTX_CPPFLAGS=$CUDA_DRIVER_CPPFLAGS
-      PLUGIN_NVPTX_LDFLAGS=$CUDA_DRIVER_LDFLAGS
-      PLUGIN_NVPTX_LIBS='-lcuda'
-
-      PLUGIN_NVPTX_save_CPPFLAGS=$CPPFLAGS
-      CPPFLAGS="$PLUGIN_NVPTX_CPPFLAGS $CPPFLAGS"
-      PLUGIN_NVPTX_save_LDFLAGS=$LDFLAGS
-      LDFLAGS="$PLUGIN_NVPTX_LDFLAGS $LDFLAGS"
-      PLUGIN_NVPTX_save_LIBS=$LIBS
-      LIBS="$PLUGIN_NVPTX_LIBS $LIBS"
-      AC_LINK_IFELSE(
-	[AC_LANG_PROGRAM(
-	  [#include "cuda.h"],
-	  [CUresult r = cuCtxPushCurrent (NULL);])],
-	[PLUGIN_NVPTX=1])
-      CPPFLAGS=$PLUGIN_NVPTX_save_CPPFLAGS
-      LDFLAGS=$PLUGIN_NVPTX_save_LDFLAGS
-      LIBS=$PLUGIN_NVPTX_save_LIBS
-      case $PLUGIN_NVPTX in
-	nvptx*)
-	  PLUGIN_NVPTX=0
-	  AC_MSG_ERROR([CUDA driver package required for nvptx support])
-	  ;;
-      esac
-      ;;
-  esac
-done
-AM_CONDITIONAL([PLUGIN_NVPTX], [test $PLUGIN_NVPTX = 1])
-AC_DEFINE_UNQUOTED([PLUGIN_NVPTX], [$PLUGIN_NVPTX],
-		  [Define to 1 if the NVIDIA plugin is built, 0 if not.])
-
-. ${srcdir}/../configure.tgt
-
-AC_SUBST(config_path)
-
-AC_CONFIG_FILES([Makefile])
-AC_CONFIG_FILES([libgomp-test-support.exp])
-AC_OUTPUT
diff --git a/libgomp/plugin/libgomp-test-support.exp.in b/libgomp/plugin/libgomp-test-support.exp.in
deleted file mode 100644
index dcadad7..0000000
--- a/libgomp/plugin/libgomp-test-support.exp.in
+++ /dev/null
@@ -1,2 +0,0 @@ 
-set cuda_driver_include "@CUDA_DRIVER_INCLUDE@"
-set cuda_driver_lib "@CUDA_DRIVER_LIB@"
diff --git a/libgomp/testsuite/Makefile.in b/libgomp/testsuite/Makefile.in
index 73f58ca..634844c 100644
diff --git a/libgomp/testsuite/lib/libgomp.exp b/libgomp/testsuite/lib/libgomp.exp
index 398426f..eab97b6 100644
--- a/libgomp/testsuite/lib/libgomp.exp
+++ b/libgomp/testsuite/lib/libgomp.exp
@@ -32,7 +32,7 @@  load_gcc_lib torture-options.exp
 load_gcc_lib fortran-modules.exp
 
 # Try to load a test support file, built during libgomp configuration.
-load_file ../plugin/libgomp-test-support.exp
+load_file libgomp-test-support.exp
 
 set dg-do-what-default run
 
diff --git a/libgomp/testsuite/libgomp-test-support.exp.in b/libgomp/testsuite/libgomp-test-support.exp.in
new file mode 100644
index 0000000..dcadad7
--- /dev/null
+++ b/libgomp/testsuite/libgomp-test-support.exp.in
@@ -0,0 +1,2 @@ 
+set cuda_driver_include "@CUDA_DRIVER_INCLUDE@"
+set cuda_driver_lib "@CUDA_DRIVER_LIB@"