Re: [PATCH v3 04/18] add configury

2013-09-16 Thread Paolo Bonzini
Il 20/08/2013 15:59, Tom Tromey ha scritto:
> This adds the configury needed for automatic dependency tracking.  It
> also adds some bits to the Makefile so we can begin converting
> (removing) explicit dependencies.
> 
>   * Makefile.in (CCDEPMODE, DEPDIR, depcomp, COMPILE.base)
>   (COMPILE, POSTCOMPILE): New variables.
>   (.cc.o .c.o): Use COMPILE, POSTCOMPILE.
>   (DEPFILES): New variable.
>   Include ".Po" files.
>   * configure.ac: Add checks for dependency checking.
>   * configure, aclocal.m4: Regenerate.
> ---
>  gcc/Makefile.in  |  28 ++-
>  gcc/aclocal.m4   |   2 +
>  gcc/configure| 148 
> ++-
>  gcc/configure.ac |  16 ++
>  4 files changed, 191 insertions(+), 3 deletions(-)
> 
> diff --git a/gcc/Makefile.in b/gcc/Makefile.in
> index 172ab4d..e1de7ba 100644
> --- a/gcc/Makefile.in
> +++ b/gcc/Makefile.in
> @@ -308,6 +308,11 @@ write_entries_to_file = $(shell rm -f $(2) || :) $(shell 
> touch $(2)) \
>  # UNSORTED
>  # 
>  
> +# Dependency tracking stuff.
> +CCDEPMODE = @CCDEPMODE@
> +DEPDIR = @DEPDIR@
> +depcomp = $(SHELL) $(srcdir)/../depcomp
> +
>  # Some compilers can't handle cc -c blah.c -o foo/blah.o.
>  # In stage2 and beyond, we force this to "-o $@" since we know we're using 
> gcc.
>  OUTPUT_OPTION = @OUTPUT_OPTION@
> @@ -1068,8 +1073,19 @@ INCLUDES = -I. -I$(@D) -I$(srcdir) -I$(srcdir)/$(@D) \
>  $(CPPINC) $(GMPINC) $(DECNUMINC) $(BACKTRACEINC) \
>  $(CLOOGINC) $(ISLINC)
>  
> +COMPILE.base = $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) -o $@
> +ifeq ($(CCDEPMODE),depmode=gcc3)
> +COMPILE = $(COMPILE.base) -MT $@ -MMD -MP -MF $(*D)/$(DEPDIR)/$(*F).TPo
> +POSTCOMPILE = @mv $(*D)/$(DEPDIR)/$(*F).TPo $(*D)/$(DEPDIR)/$(*F).Po
> +else
> +COMPILE = source='$<' object='$@' libtool=no \
> +DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) $(COMPILE.base)
> +POSTCOMPILE =
> +endif
> +
>  .cc.o .c.o:
> - $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $< $(OUTPUT_OPTION)
> + $(COMPILE) $<
> + $(POSTCOMPILE)
>  
>  #
>  # Support for additional languages (other than C).
> @@ -5378,7 +5394,17 @@ po/gcc.pot: force
>   AWK=$(AWK) $(SHELL) $(srcdir)/po/exgettext \
>   $(XGETTEXT) gcc $(srcdir)
>  
> +#
> +
> +# Dependency information.
> +
>  # In order for parallel make to really start compiling the expensive
>  # objects from $(OBJS) as early as possible, build all their
>  # prerequisites strictly before all objects.
>  $(ALL_HOST_OBJS) : | $(generated_files)
> +
> +# Include the auto-generated dependencies for all host objects.
> +DEPFILES = \
> +  $(foreach obj,$(ALL_HOST_OBJS),\
> +$(dir $(obj))$(DEPDIR)/$(patsubst %.o,%.Po,$(notdir $(obj
> +-include $(DEPFILES)
> diff --git a/gcc/aclocal.m4 b/gcc/aclocal.m4
> index 1f3ce9d..e7cfd7d 100644
> --- a/gcc/aclocal.m4
> +++ b/gcc/aclocal.m4
> @@ -101,10 +101,12 @@ m4_define([AC_PROG_CC],
>  
>  m4_include([../config/acx.m4])
>  m4_include([../config/codeset.m4])
> +m4_include([../config/depstand.m4])
>  m4_include([../config/dfp.m4])
>  m4_include([../config/gettext-sister.m4])
>  m4_include([../config/iconv.m4])
>  m4_include([../config/lcmessage.m4])
> +m4_include([../config/lead-dot.m4])
>  m4_include([../config/lib-ld.m4])
>  m4_include([../config/lib-link.m4])
>  m4_include([../config/lib-prefix.m4])
> diff --git a/gcc/configure b/gcc/configure
> index 1e9be8e..c53a930 100755
> --- a/gcc/configure
> +++ b/gcc/configure
> @@ -735,6 +735,9 @@ LDEXP_LIB
>  EXTRA_GCC_LIBS
>  GNAT_LIBEXC
>  COLLECT2_LIBS
> +CCDEPMODE
> +DEPDIR
> +am__leading_dot
>  CXXCPP
>  AR
>  NM
> @@ -8873,6 +8876,136 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
>  
>  
>  # 
> +# Dependency checking.
> +# 
> +
> +ac_ext=cpp
> +ac_cpp='$CXXCPP $CPPFLAGS'
> +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
> +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS 
> conftest.$ac_ext $LIBS >&5'
> +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
> +
> +rm -rf .tst 2>/dev/null
> +mkdir .tst 2>/dev/null
> +if test -d .tst; then
> +  am__leading_dot=.
> +else
> +  am__leading_dot=_
> +fi
> +rmdir .tst 2>/dev/null
> +
> +DEPDIR="${am__leading_dot}deps"
> +
> +ac_config_commands="$ac_config_commands depdir"
> +
> +
> +ac_config_commands="$ac_config_commands gccdepdir"
> +
> +
> +depcc="$CC"   am_compiler_list=
> +
> +am_depcomp=$ac_aux_dir/depcomp
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of 
> $depcc" >&5
> +$as_echo_n "checking dependency style of $depcc... " >&6; }
> +if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then :
> +  $as_echo_n "(cached) " >&6
> +else
> +  if test -f "$am_depcomp"; then
> +  # We make a subdir and do the tests there.  Otherwise we can end up
> +  # making bogus files that we don't know about and never remove.  For
> +  # instance it was reported that on HP-UX the gcc test will end up
> +  # making a dummy file named `D' -- becaus

[PATCH v3 04/18] add configury

2013-08-20 Thread Tom Tromey
This adds the configury needed for automatic dependency tracking.  It
also adds some bits to the Makefile so we can begin converting
(removing) explicit dependencies.

* Makefile.in (CCDEPMODE, DEPDIR, depcomp, COMPILE.base)
(COMPILE, POSTCOMPILE): New variables.
(.cc.o .c.o): Use COMPILE, POSTCOMPILE.
(DEPFILES): New variable.
Include ".Po" files.
* configure.ac: Add checks for dependency checking.
* configure, aclocal.m4: Regenerate.
---
 gcc/Makefile.in  |  28 ++-
 gcc/aclocal.m4   |   2 +
 gcc/configure| 148 ++-
 gcc/configure.ac |  16 ++
 4 files changed, 191 insertions(+), 3 deletions(-)

diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 172ab4d..e1de7ba 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -308,6 +308,11 @@ write_entries_to_file = $(shell rm -f $(2) || :) $(shell 
touch $(2)) \
 # UNSORTED
 # 
 
+# Dependency tracking stuff.
+CCDEPMODE = @CCDEPMODE@
+DEPDIR = @DEPDIR@
+depcomp = $(SHELL) $(srcdir)/../depcomp
+
 # Some compilers can't handle cc -c blah.c -o foo/blah.o.
 # In stage2 and beyond, we force this to "-o $@" since we know we're using gcc.
 OUTPUT_OPTION = @OUTPUT_OPTION@
@@ -1068,8 +1073,19 @@ INCLUDES = -I. -I$(@D) -I$(srcdir) -I$(srcdir)/$(@D) \
   $(CPPINC) $(GMPINC) $(DECNUMINC) $(BACKTRACEINC) \
   $(CLOOGINC) $(ISLINC)
 
+COMPILE.base = $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) -o $@
+ifeq ($(CCDEPMODE),depmode=gcc3)
+COMPILE = $(COMPILE.base) -MT $@ -MMD -MP -MF $(*D)/$(DEPDIR)/$(*F).TPo
+POSTCOMPILE = @mv $(*D)/$(DEPDIR)/$(*F).TPo $(*D)/$(DEPDIR)/$(*F).Po
+else
+COMPILE = source='$<' object='$@' libtool=no \
+DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) $(COMPILE.base)
+POSTCOMPILE =
+endif
+
 .cc.o .c.o:
-   $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $< $(OUTPUT_OPTION)
+   $(COMPILE) $<
+   $(POSTCOMPILE)
 
 #
 # Support for additional languages (other than C).
@@ -5378,7 +5394,17 @@ po/gcc.pot: force
AWK=$(AWK) $(SHELL) $(srcdir)/po/exgettext \
$(XGETTEXT) gcc $(srcdir)
 
+#
+
+# Dependency information.
+
 # In order for parallel make to really start compiling the expensive
 # objects from $(OBJS) as early as possible, build all their
 # prerequisites strictly before all objects.
 $(ALL_HOST_OBJS) : | $(generated_files)
+
+# Include the auto-generated dependencies for all host objects.
+DEPFILES = \
+  $(foreach obj,$(ALL_HOST_OBJS),\
+$(dir $(obj))$(DEPDIR)/$(patsubst %.o,%.Po,$(notdir $(obj
+-include $(DEPFILES)
diff --git a/gcc/aclocal.m4 b/gcc/aclocal.m4
index 1f3ce9d..e7cfd7d 100644
--- a/gcc/aclocal.m4
+++ b/gcc/aclocal.m4
@@ -101,10 +101,12 @@ m4_define([AC_PROG_CC],
 
 m4_include([../config/acx.m4])
 m4_include([../config/codeset.m4])
+m4_include([../config/depstand.m4])
 m4_include([../config/dfp.m4])
 m4_include([../config/gettext-sister.m4])
 m4_include([../config/iconv.m4])
 m4_include([../config/lcmessage.m4])
+m4_include([../config/lead-dot.m4])
 m4_include([../config/lib-ld.m4])
 m4_include([../config/lib-link.m4])
 m4_include([../config/lib-prefix.m4])
diff --git a/gcc/configure b/gcc/configure
index 1e9be8e..c53a930 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -735,6 +735,9 @@ LDEXP_LIB
 EXTRA_GCC_LIBS
 GNAT_LIBEXC
 COLLECT2_LIBS
+CCDEPMODE
+DEPDIR
+am__leading_dot
 CXXCPP
 AR
 NM
@@ -8873,6 +8876,136 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
 # 
+# Dependency checking.
+# 
+
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS 
conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+  am__leading_dot=.
+else
+  am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+
+DEPDIR="${am__leading_dot}deps"
+
+ac_config_commands="$ac_config_commands depdir"
+
+
+ac_config_commands="$ac_config_commands gccdepdir"
+
+
+depcc="$CC"   am_compiler_list=
+
+am_depcomp=$ac_aux_dir/depcomp
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" 
>&5
+$as_echo_n "checking dependency style of $depcc... " >&6; }
+if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named `D' -- because `-MD' means `put the output
+  # in D'.
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+  # We will build objects and dependencies in a subdirectory because
+  # it helps to detect inappli