Use CC_FOR_BUILD to generate source files

Previously we were failing if CROSS_COMPILING and the generated headers
were not present.  It works just fine now.

One caveat: the fix is not fully correct since config.h is being
included in the files built with CC_FOR_BUILD, but config.h has config
for the host system, not the build system.  Should be fine though.
This commit is contained in:
Behdad Esfahbod 2013-01-02 17:49:41 -06:00
parent ec8a40d238
commit 558b3c65f9
5 changed files with 10 additions and 23 deletions

View File

@ -105,6 +105,7 @@ AC_SUBST(WARN_CFLAGS)
dnl ==========================================================================
AC_ARG_VAR(CC_FOR_BUILD, [build system C compiler])
AM_CONDITIONAL(CROSS_COMPILING, test $cross_compiling = yes)
AM_CONDITIONAL(ENABLE_SHARED, test "$enable_shared" = "yes")

View File

@ -118,6 +118,7 @@ noinst_PROGRAMS = \
edit_sgml_SOURCES = \
edit-sgml.c \
$(NULL)
edit_sgml_CC = $(CC_FOR_BUILD)
#
check_SCRIPTS = \
check-missing-doc \
@ -150,14 +151,9 @@ noinst_PROGRAMS += \
htmldoc_DATA += $(HTML_DIR)/*
##
if CROSS_COMPILING
.fncs.sgml:
@echo Warning: cannot rebuild $@ when cross-compiling
else
.fncs.sgml:
$(AM_V_GEN) $(RM) $@; \
$(builddir)/edit-sgml$(EXEEXT) $(srcdir)/func.sgml < '$(srcdir)/$*.fncs' > $*.sgml
endif
.sgml.txt:
$(AM_V_GEN) $(RM) $@; \
$(DOC2TXT) $*.sgml

View File

@ -33,18 +33,13 @@ noinst_PROGRAMS=fc-case
noinst_HEADERS=$(TARG)
fc_case_SOURCES= \
fc-case.c
fc_case_CC = $(CC_FOR_BUILD)
CASEFOLDING=CaseFolding.txt
SCASEFOLDING=${top_srcdir}/fc-case/CaseFolding.txt
EXTRA_DIST = $(TARG) $(TMPL) $(CASEFOLDING)
if CROSS_COMPILING
$(TARG): $(STMPL) fc-case.c $(SCASEFOLDING)
@echo Warning: cannot rebuild $(TARG) when cross-compiling
else
## BUILT_SOURCES doesn't effect to 'distcheck'
## so $(ALIAS_FILES) has to be appeared prior to fc-case$(EXEEXT)
## to make sure availability.
@ -52,7 +47,6 @@ $(TARG): $(STMPL) $(ALIAS_FILES) fc-case$(EXEEXT) $(SCASEFOLDING)
$(AM_V_GEN) $(RM) $(TARG); \
./fc-case$(EXEEXT) $(SCASEFOLDING) < $(STMPL) > $(TARG).tmp && \
mv $(TARG).tmp $(TARG)
endif
ALIAS_FILES = fcalias.h fcaliastail.h

View File

@ -31,15 +31,15 @@ TARG=fcglyphname.h
noinst_PROGRAMS=fc-glyphname
noinst_HEADERS=$(TARG)
fc_glyphname_CC = $(CC_FOR_BUILD)
GLYPHNAME=zapfdingbats.txt
SGLYPHNAME=${top_srcdir}/fc-glyphname/zapfdingbats.txt
EXTRA_DIST = $(TARG) $(TMPL) $(GLYPHNAME)
if CROSS_COMPILING
$(TARG): $(STMPL) fc-glyphname.c $(SGLYPHNAME)
@echo Warning: cannot rebuild $(TARG) when cross-compiling
else
## BUILT_SOURCES doesn't effect to 'distcheck'
## so $(ALIAS_FILES) has to be appeared prior to fc-glyphname$(EXEEXT)
## to make sure availability.
@ -47,7 +47,6 @@ $(TARG): $(STMPL) $(ALIAS_FILES) fc-glyphname$(EXEEXT) $(SGLYPHNAME)
$(AM_V_GEN) $(RM) $(TARG); \
./fc-glyphname$(EXEEXT) $(SGLYPHNAME) < $(STMPL) > $(TARG).tmp && \
mv $(TARG).tmp $(TARG)
endif
ALIAS_FILES = fcalias.h fcaliastail.h

View File

@ -31,14 +31,12 @@ TARG=fclang.h
noinst_PROGRAMS=fc-lang
noinst_MANS=fc-lang.man
noinst_HEADERS=$(TARG)
fc_lang_CC = $(CC_FOR_BUILD)
EXTRA_DIST = $(TARG) $(TMPL) $(ORTH)
if CROSS_COMPILING
$(TARG):$(ORTH) fc-lang.c $(STMPL)
@echo Warning: cannot rebuild $(TARG) when cross-compiling
else
## BUILT_SOURCES doesn't effect to 'distcheck'
## so $(ALIAS_FILES) has to be appeared prior to fc-lang$(EXEEXT)
## to make sure availability.
@ -46,7 +44,6 @@ $(TARG):$(ORTH) $(ALIAS_FILES) fc-lang${EXEEXT} $(STMPL)
$(AM_V_GEN) $(RM) $(TARG); \
./fc-lang${EXEEXT} -d ${srcdir} $(ORTH) < $(STMPL) > $(TARG).tmp && \
mv $(TARG).tmp $(TARG)
endif
ALIAS_FILES = fcalias.h fcaliastail.h