Index: configure.ac =================================================================== --- configure.ac (revision 169877) +++ configure.ac (working copy) @@ -267,6 +267,16 @@ done tmake_file="${tmake_file_}" AC_SUBST(tmake_file) +# Likewise export definitions for libgcc_tm.h +tm_file_= +for f in ${tm_file} +do + tm_file_="${tm_file_} \$(srcdir)/config/$f" +done +tm_file="${tm_file_}" +AC_SUBST(tm_file) +AC_SUBST(tm_defines) + # Substitute configuration variables AC_SUBST(extra_parts) AC_SUBST(asm_hidden_op) Index: Makefile.in =================================================================== --- Makefile.in (revision 169877) +++ Makefile.in (working copy) @@ -253,6 +253,16 @@ objects = $(filter %$(objext),$^) tmake_file = @tmake_file@ include $(srcdir)/empty.mk $(tmake_file) +# Collect target defines and headers from config.host. +libgcc_tm_defines = @tm_defines@ +libgcc_tm_file = @tm_file@ +libgcc_tm.h: libgcc_tm.stamp; @true +libgcc_tm.stamp: + DEFINES='$(libgcc_tm_defines)' HEADERS='$(libgcc_tm_file)' \ + $(srcdir)/mkheader.sh > tmp-libgcc_tm.h + $(SHELL) $(srcdir)/../move-if-change tmp-libgcc_tm.h libgcc_tm.h + echo timestamp > $@ + # Only handle shared libraries if both: # - the user requested them # - we know how to build them Index: config.host =================================================================== --- config.host (revision 169877) +++ config.host (working copy) @@ -57,6 +57,8 @@ asm_hidden_op=.hidden extra_parts= tmake_file= +tm_defines= +tm_file= # Set default cpu_type so it can be updated in each machine entry. cpu_type=`echo ${host} | sed 's/-.*$//'` Index: mkheader.sh =================================================================== --- mkheader.sh (revision 0) +++ mkheader.sh (revision 0) @@ -0,0 +1,41 @@ +#! /bin/sh + +# Copyright (C) 2001, 2002, 2006, 2007, 2010, 2011 Free Software Foundation, Inc. +# This file is part of GCC. + +# GCC 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. + +# GCC 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. + +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# . + + +# Print libgcc_tm.h to the standard output. +# DEFINES and HEADERS are expected to be set in the environment. + +# Add multiple inclusion protection guard, part one. +echo "#ifndef LIBGCC_TM_H" +echo "#define LIBGCC_TM_H" + +# Generate the body of the file +echo "/* Automatically generated by mkheader.sh. */" +for def in $DEFINES; do + echo "#ifndef $def" | sed 's/=.*//' + echo "# define $def" | sed 's/=/ /' + echo "#endif" +done + +for file in $HEADERS; do + echo "#include \"$file\"" +done + +# Add multiple inclusion protection guard, part two. +echo "#endif /* LIBGCC_TM_H"