]> granicus.if.org Git - python/commitdiff
Merge issue #15819: additional fixes for out-of-tree builds from read-only src.
authorTrent Nelson <trent@trent.me>
Tue, 16 Oct 2012 12:51:24 +0000 (08:51 -0400)
committerTrent Nelson <trent@trent.me>
Tue, 16 Oct 2012 12:51:24 +0000 (08:51 -0400)
Specifically, make sure the 'Object', 'Python' and 'Include' directories
in the build directory take precedence over the source directory if we're
an out-of-tree build.

Fix typeslots.inc so that it gets generated into the build directory.

In addition, for 3.3, make sure importlib.h gets generated into the
build directory.

1  2 
Makefile.pre.in
configure
configure.ac

diff --cc Makefile.pre.in
index 10ad381be232c9c3decef5ef509df398f53addcd,1b6965592e862becf1dd29e0ddc8a67474a3187a..4ff801b9a8110ff633090be658c85920461a5af5
@@@ -720,16 -660,15 +723,16 @@@ Objects/setobject.o: $(srcdir)/Objects/
  $(OPCODETARGETS_H): $(OPCODETARGETGEN_FILES)
        $(OPCODETARGETGEN) $(OPCODETARGETS_H)
  
 -Python/ceval.o: $(OPCODETARGETS_H) Python/ceval_gil.h
 +Python/ceval.o: $(OPCODETARGETS_H) $(srcdir)/Python/ceval_gil.h
  
  Python/formatter_unicode.o: $(srcdir)/Python/formatter_unicode.c \
 -                              $(BYTESTR_DEPS) \
 -                              $(srcdir)/Objects/stringlib/formatter.h
 +                              $(BYTESTR_DEPS)
 +
- Python/frozen.o: $(srcdir)/Python/importlib.h
++Python/frozen.o: Python/importlib.h
  
- Objects/typeobject.o: $(srcdir)/Objects/typeslots.inc
$(srcdir)/Objects/typeslots.inc: $(srcdir)/Include/typeslots.h $(srcdir)/Objects/typeslots.py
-       $(PYTHON) $(srcdir)/Objects/typeslots.py < $(srcdir)/Include/typeslots.h > $(srcdir)/Objects/typeslots.inc
+ Objects/typeobject.o: Objects/typeslots.inc
+ Objects/typeslots.inc: $(srcdir)/Include/typeslots.h $(srcdir)/Objects/typeslots.py
+       $(PYTHON) $(srcdir)/Objects/typeslots.py < $(srcdir)/Include/typeslots.h > Objects/typeslots.inc
  
  ############################################################################
  # Header files
diff --cc configure
index 31fc3d6fbbb65a57aec2a869384867f95b4fd418,8ba3dec51fd20f9485c75e38c12c462b2334c4c7..843b141212b380613898e4af35a040f1f42956d5
+++ b/configure
@@@ -701,19 -704,6 +701,21 @@@ UNIVERSALSD
  CONFIG_ARGS
  SOVERSION
  VERSION
 +PYTHON_FOR_BUILD
 +host_os
 +host_vendor
 +host_cpu
 +host
 +build_os
 +build_vendor
 +build_cpu
 +build
 +HAS_HG
 +HGBRANCH
 +HGTAG
 +HGVERSION
++BASECPPFLAGS
++BUILDDIR
  target_alias
  host_alias
  build_alias
@@@ -2719,65 -2706,6 +2721,83 @@@ ac_compiler_gnu=$ac_cv_c_compiler_gn
  
  
  
++BUILDDIR="`pwd`"
++
++
++if test "$srcdir" != "$BUILDDIR"; then
++    # If we're building out-of-tree, we need to make sure the following
++    # resources get picked up before their $srcdir counterparts.
++    #   Objects/ -> typeslots.inc
++    #   Include/ -> Python-ast.h, graminit.h
++    #   Python/  -> importlib.h
++    # (A side effect of this is that these resources will automatically be
++    #  regenerated when building out-of-tree, regardless of whether or not
++    #  the $srcdir counterpart is up-to-date.  This is an acceptable trade
++    #  off.)
++    BASECPPFLAGS="-IObjects -IInclude -IPython"
++else
++    BASECPPFLAGS=""
++fi
++
 +
 +
 +
 +
 +if test -e $srcdir/.hg/dirstate
 +then
 +# Extract the first word of "hg", so it can be a program name with args.
 +set dummy hg; ac_word=$2
 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 +$as_echo_n "checking for $ac_word... " >&6; }
 +if ${ac_cv_prog_HAS_HG+:} false; then :
 +  $as_echo_n "(cached) " >&6
 +else
 +  if test -n "$HAS_HG"; then
 +  ac_cv_prog_HAS_HG="$HAS_HG" # 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_HAS_HG="found"
 +    $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_HAS_HG" && ac_cv_prog_HAS_HG="not-found"
 +fi
 +fi
 +HAS_HG=$ac_cv_prog_HAS_HG
 +if test -n "$HAS_HG"; then
 +  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $HAS_HG" >&5
 +$as_echo "$HAS_HG" >&6; }
 +else
 +  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 +$as_echo "no" >&6; }
 +fi
 +
 +
 +else
 +HAS_HG=no-repository
 +fi
 +if test $HAS_HG = found
 +then
 +    HGVERSION="hg id -i \$(srcdir)"
 +    HGTAG="hg id -t \$(srcdir)"
 +    HGBRANCH="hg id -b \$(srcdir)"
 +else
 +    HGVERSION=""
 +    HGTAG=""
 +    HGBRANCH=""
 +fi
 +
 +
  ac_config_headers="$ac_config_headers pyconfig.h"
  
  
diff --cc configure.ac
index e3f5b9696d4f7cca3a6e992749b4f07cab362cea,9222c887c30c7d47daa8bbbe03bda7178a9584f0..0633a97aea2f5303b6eb5f8d52789ab222f92989
@@@ -3,33 -3,19 +3,51 @@@ dnl * Please run autoreconf to test you
  dnl ***********************************************
  
  # Set VERSION so we only need to edit in one place (i.e., here)
 -m4_define(PYTHON_VERSION, 3.2)
 -
 -dnl Some m4 magic to ensure that the configure script is generated
 -dnl by the correct autoconf version.
 -m4_define([version_required],
 -[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]), [$1]), 0,
 -       [],
 -       [m4_fatal([Autoconf version $1 is required for Python], 63)])
 -])
 +m4_define(PYTHON_VERSION, 3.3)
 +
  AC_PREREQ(2.65)
  
 -AC_REVISION($Revision$)
  AC_INIT(python, PYTHON_VERSION, http://bugs.python.org/)
 +
++BUILDDIR="`pwd`"
++AC_SUBST(BUILDDIR)
++AC_SUBST(BASECPPFLAGS)
++if test "$srcdir" != "$BUILDDIR"; then
++    # If we're building out-of-tree, we need to make sure the following
++    # resources get picked up before their $srcdir counterparts.
++    #   Objects/ -> typeslots.inc
++    #   Include/ -> Python-ast.h, graminit.h
++    #   Python/  -> importlib.h
++    # (A side effect of this is that these resources will automatically be
++    #  regenerated when building out-of-tree, regardless of whether or not
++    #  the $srcdir counterpart is up-to-date.  This is an acceptable trade
++    #  off.)
++    BASECPPFLAGS="-IObjects -IInclude -IPython"
++else
++    BASECPPFLAGS=""
++fi
++
 +AC_SUBST(HGVERSION)
 +AC_SUBST(HGTAG)
 +AC_SUBST(HGBRANCH)
 +
 +if test -e $srcdir/.hg/dirstate
 +then
 +AC_CHECK_PROG(HAS_HG, hg, found, not-found)
 +else
 +HAS_HG=no-repository
 +fi
 +if test $HAS_HG = found
 +then
 +    HGVERSION="hg id -i \$(srcdir)"
 +    HGTAG="hg id -t \$(srcdir)"
 +    HGBRANCH="hg id -b \$(srcdir)"
 +else
 +    HGVERSION=""
 +    HGTAG=""
 +    HGBRANCH=""
 +fi
 +
  AC_CONFIG_SRCDIR([Include/object.h])
  AC_CONFIG_HEADER(pyconfig.h)