diff mbox

[01/27] gcc: configure and Makefile changes needed by jit

Message ID 1414774977-25605-2-git-send-email-dmalcolm@redhat.com
State New
Headers show

Commit Message

David Malcolm Oct. 31, 2014, 5:02 p.m. UTC
An earlier version of this was posted as:
  "[PATCH 2/5] gcc: configure and Makefile changes needed by jit"
    https://gcc.gnu.org/ml/gcc-patches/2014-10/msg01169.html

Since then, I've eliminated the gcc_version, bindir, and pkgconfigdir
additions, and added the FULL_DRIVER_NAME variable and symlink, to
avoid the need to install when running the jit testsuite.

gcc/ChangeLog:
	* Makefile.in (doc_build_sys): New variable, set to "sphinx" if
	sphinx is installed, falling back to "texinfo" otherwise.
	(FULL_DRIVER_NAME): New variable, adapted from the
	install-driver target.  New target, a symlink within the builddir,
	linked to "xgcc", for use when running the JIT library from the
	builddir.
	(MOSTLYCLEANFILES): Add FULL_DRIVER_NAME.
	(install-driver): Use $(FULL_DRIVER_NAME) rather than spelling it
	out.

	* configure.ac (doc_build_sys): New variable, set to "sphinx" if
	sphinx is installed, falling back to "texinfo" otherwise.
	(GCC_DRIVER_NAME): Generate a gcc-driver-name.h file containing
	GCC_DRIVER_NAME for the benefit of jit/internal-api.c.

	* configure: Regenerate.
---
 gcc/Makefile.in  | 20 +++++++++++++++++---
 gcc/configure    | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++--
 gcc/configure.ac | 10 ++++++++++
 3 files changed, 77 insertions(+), 5 deletions(-)

Comments

Jeff Law Nov. 3, 2014, 9:36 p.m. UTC | #1
On 10/31/14 11:02, David Malcolm wrote:
> An earlier version of this was posted as:
>    "[PATCH 2/5] gcc: configure and Makefile changes needed by jit"
>      https://gcc.gnu.org/ml/gcc-patches/2014-10/msg01169.html
>
> Since then, I've eliminated the gcc_version, bindir, and pkgconfigdir
> additions, and added the FULL_DRIVER_NAME variable and symlink, to
> avoid the need to install when running the jit testsuite.
>
> gcc/ChangeLog:
> 	* Makefile.in (doc_build_sys): New variable, set to "sphinx" if
> 	sphinx is installed, falling back to "texinfo" otherwise.
> 	(FULL_DRIVER_NAME): New variable, adapted from the
> 	install-driver target.  New target, a symlink within the builddir,
> 	linked to "xgcc", for use when running the JIT library from the
> 	builddir.
> 	(MOSTLYCLEANFILES): Add FULL_DRIVER_NAME.
> 	(install-driver): Use $(FULL_DRIVER_NAME) rather than spelling it
> 	out.
>
> 	* configure.ac (doc_build_sys): New variable, set to "sphinx" if
> 	sphinx is installed, falling back to "texinfo" otherwise.
> 	(GCC_DRIVER_NAME): Generate a gcc-driver-name.h file containing
> 	GCC_DRIVER_NAME for the benefit of jit/internal-api.c.
>
> 	* configure: Regenerate.
OK.
jeff
Thomas Schwinge Nov. 13, 2014, 8:03 p.m. UTC | #2
Hi!

JIT/GCC as a shared library merged!  \o/

On Fri, 31 Oct 2014 13:02:34 -0400, David Malcolm <dmalcolm@redhat.com> wrote:
> An earlier version of this was posted as:
>   "[PATCH 2/5] gcc: configure and Makefile changes needed by jit"
>     https://gcc.gnu.org/ml/gcc-patches/2014-10/msg01169.html
> 
> Since then, I've eliminated the gcc_version, bindir, and pkgconfigdir
> additions, and added the FULL_DRIVER_NAME variable and symlink, to
> avoid the need to install when running the jit testsuite.

> --- a/gcc/Makefile.in
> +++ b/gcc/Makefile.in
> @@ -1504,6 +1509,9 @@ BACKEND = libbackend.a main.o @TREEBROWSER@ libcommon-target.a libcommon.a \
>  # front-end checking.
>  TREECHECKING = @TREECHECKING@
>  
> +# The full name of the driver on installation
> +FULL_DRIVER_NAME=$(target_noncanonical)-gcc-$(version)$(exeext)

May I suggest to remove $(exeext) here...

> @@ -1511,7 +1519,7 @@ MOSTLYCLEANFILES = insn-flags.h insn-config.h insn-codes.h \
>   tm-preds.h tm-constrs.h checksum-options gimple-match.c generic-match.c \
>   tree-check.h min-insn-modes.c insn-modes.c insn-modes.h \
>   genrtl.h gt-*.h gtype-*.h gtype-desc.c gtyp-input.list \
> - xgcc$(exeext) cpp$(exeext) \
> + xgcc$(exeext) cpp$(exeext) $(FULL_DRIVER_NAME) \

..., and add it here...

> +# This symlink makes the full installation name of the driver be available
> +# from within the *build* directory, for use when running the JIT library
> +# from there (e.g. when running its testsuite).
> +$(FULL_DRIVER_NAME): ./xgcc
> +	$(LN) -s $< $@

..., and here...

> @@ -3280,9 +3294,9 @@ install-driver: installdirs xgcc$(exeext)
>  	-rm -f $(DESTDIR)$(bindir)/$(GCC_INSTALL_NAME)$(exeext)
>  	-$(INSTALL_PROGRAM) xgcc$(exeext) $(DESTDIR)$(bindir)/$(GCC_INSTALL_NAME)$(exeext)
>  	-if [ "$(GCC_INSTALL_NAME)" != "$(target_noncanonical)-gcc-$(version)" ]; then \
> -	  rm -f $(DESTDIR)$(bindir)/$(target_noncanonical)-gcc-$(version)$(exeext); \
> +	  rm -f $(DESTDIR)$(bindir)/$(FULL_DRIVER_NAME); \
>  	  ( cd $(DESTDIR)$(bindir) && \
> -	    $(LN) $(GCC_INSTALL_NAME)$(exeext) $(target_noncanonical)-gcc-$(version)$(exeext) ); \
> +	    $(LN) $(GCC_INSTALL_NAME)$(exeext) $(FULL_DRIVER_NAME) ); \

..., and here (also obviously also everywhere else where it is being
used, if applicable), and then also use $(FULL_DRIVER_NAME) in the if
statement just prior, comparing $(GCC_INSTALL_NAME) to what used to be
$(FULL_DRIVER_NAME) -- just without $(exeext)?  Alternatively, add
$(exeext) to $(GCC_INSTALL_NAME) in the if statement, but I think
generally variables such as $(FULL_DRIVER_NAME) are set up without
$(exeext).

That said, and I'll be quick to note that I have not yet looked what
you're using this for, don't you need to pass -B and similar flags to
xgcc when invoking it from the build directory?  Or is this not relevant
for your use case?  (I just stumbled over this, because we have a similar
case with "un-installed" offloading/accelerator xgcc builds that are to
be used for build-tree testing.


Another thing, just curious: why did you merge all the ChangeLog.jit
files into trunk?  I see that there are a few ChangeLog.* files from
development branch merges, but as this is not generally done, I wonder
when/why it is sometimes being done this way?


Grüße,
 Thomas
diff mbox

Patch

diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index e2100ff..ded7471 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -316,6 +316,11 @@  write_entries_to_file = $(shell rm -f $(2) || :) $(shell touch $(2)) \
 			  $(shell expr $(range) + $(write_entries_to_file_split) - 1), $(1))" \
 	     | tr ' ' '\012' >> $(2)))
 
+# The jit documentation looks better if built with sphinx, but can be
+# built with texinfo if sphinx is not available.
+# configure sets "doc_build_sys" to "sphinx" or "texinfo" accordingly
+doc_build_sys=@doc_build_sys@
+
 # --------
 # UNSORTED
 # --------
@@ -1504,6 +1509,9 @@  BACKEND = libbackend.a main.o @TREEBROWSER@ libcommon-target.a libcommon.a \
 # front-end checking.
 TREECHECKING = @TREECHECKING@
 
+# The full name of the driver on installation
+FULL_DRIVER_NAME=$(target_noncanonical)-gcc-$(version)$(exeext)
+
 MOSTLYCLEANFILES = insn-flags.h insn-config.h insn-codes.h \
  insn-output.c insn-recog.c insn-emit.c insn-extract.c insn-peep.c \
  insn-attr.h insn-attr-common.h insn-attrtab.c insn-dfatab.c \
@@ -1511,7 +1519,7 @@  MOSTLYCLEANFILES = insn-flags.h insn-config.h insn-codes.h \
  tm-preds.h tm-constrs.h checksum-options gimple-match.c generic-match.c \
  tree-check.h min-insn-modes.c insn-modes.c insn-modes.h \
  genrtl.h gt-*.h gtype-*.h gtype-desc.c gtyp-input.list \
- xgcc$(exeext) cpp$(exeext) \
+ xgcc$(exeext) cpp$(exeext) $(FULL_DRIVER_NAME) \
  $(EXTRA_PROGRAMS) gcc-cross$(exeext) \
  $(SPECS) collect2$(exeext) gcc-ar$(exeext) gcc-nm$(exeext) \
  gcc-ranlib$(exeext) \
@@ -1520,6 +1528,12 @@  MOSTLYCLEANFILES = insn-flags.h insn-config.h insn-codes.h \
  gengtype$(exeext) *.[0-9][0-9].* *.[si] *-checksum.c libbackend.a \
  libcommon-target.a libcommon.a libgcc.mk
 
+# This symlink makes the full installation name of the driver be available
+# from within the *build* directory, for use when running the JIT library
+# from there (e.g. when running its testsuite).
+$(FULL_DRIVER_NAME): ./xgcc
+	$(LN) -s $< $@
+
 #
 # Language makefile fragments.
 
@@ -3280,9 +3294,9 @@  install-driver: installdirs xgcc$(exeext)
 	-rm -f $(DESTDIR)$(bindir)/$(GCC_INSTALL_NAME)$(exeext)
 	-$(INSTALL_PROGRAM) xgcc$(exeext) $(DESTDIR)$(bindir)/$(GCC_INSTALL_NAME)$(exeext)
 	-if [ "$(GCC_INSTALL_NAME)" != "$(target_noncanonical)-gcc-$(version)" ]; then \
-	  rm -f $(DESTDIR)$(bindir)/$(target_noncanonical)-gcc-$(version)$(exeext); \
+	  rm -f $(DESTDIR)$(bindir)/$(FULL_DRIVER_NAME); \
 	  ( cd $(DESTDIR)$(bindir) && \
-	    $(LN) $(GCC_INSTALL_NAME)$(exeext) $(target_noncanonical)-gcc-$(version)$(exeext) ); \
+	    $(LN) $(GCC_INSTALL_NAME)$(exeext) $(FULL_DRIVER_NAME) ); \
 	fi
 	-if [ ! -f gcc-cross$(exeext) ] \
 	    && [ "$(GCC_INSTALL_NAME)" != "$(GCC_TARGET_INSTALL_NAME)" ]; then \
diff --git a/gcc/configure b/gcc/configure
index 16f128f..6779b2a 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -743,6 +743,7 @@  CXXDEPMODE
 DEPDIR
 am__leading_dot
 CXXCPP
+doc_build_sys
 AR
 NM
 BISON
@@ -8069,6 +8070,47 @@  fi
 
 fi
 
+# The jit documentation looks better if built with sphinx, but can be
+# built with texinfo if sphinx is not available.
+# Set "doc_build_sys" to "sphinx" or "texinfo" accordingly.
+# Extract the first word of "sphinx-build", so it can be a program name with args.
+set dummy sphinx-build; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_doc_build_sys+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$doc_build_sys"; then
+  ac_cv_prog_doc_build_sys="$doc_build_sys" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_doc_build_sys="sphinx"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_prog_doc_build_sys" && ac_cv_prog_doc_build_sys="texinfo"
+fi
+fi
+doc_build_sys=$ac_cv_prog_doc_build_sys
+if test -n "$doc_build_sys"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $doc_build_sys" >&5
+$as_echo "$doc_build_sys" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
 
 # --------------------
 # Checks for C headers
@@ -18058,7 +18100,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 18061 "configure"
+#line 18103 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -18164,7 +18206,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 18167 "configure"
+#line 18209 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -28175,6 +28217,12 @@  _ACEOF
 
 fi
 
+# Generate gcc-driver-name.h containing GCC_DRIVER_NAME for the benefit
+# of jit/jit-playback.c.
+cat > gcc-driver-name.h <<EOF
+#define GCC_DRIVER_NAME "${target_noncanonical}-gcc-${gcc_BASEVER}${exeext}"
+EOF
+
 # Configure the subdirectories
 # AC_CONFIG_SUBDIRS($subdirs)
 
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 35ce9ee..31b2e97 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -971,6 +971,10 @@  else
   AC_CHECK_PROG(AR, ar, ar, ${CONFIG_SHELL-/bin/sh} ${srcdir}/../missing ar)
 fi
 
+# The jit documentation looks better if built with sphinx, but can be
+# built with texinfo if sphinx is not available.
+# Set "doc_build_sys" to "sphinx" or "texinfo" accordingly.
+AC_CHECK_PROG(doc_build_sys, sphinx-build, sphinx, texinfo)
 
 # --------------------
 # Checks for C headers
@@ -5698,6 +5702,12 @@  if test x"${LINKER_HASH_STYLE}" != x; then
                                          [The linker hash style])
 fi
 
+# Generate gcc-driver-name.h containing GCC_DRIVER_NAME for the benefit
+# of jit/jit-playback.c.
+cat > gcc-driver-name.h <<EOF
+#define GCC_DRIVER_NAME "${target_noncanonical}-gcc-${gcc_BASEVER}${exeext}"
+EOF
+
 # Configure the subdirectories
 # AC_CONFIG_SUBDIRS($subdirs)