mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-29 19:30:36 +02:00
build: Don't include <config.h> in native programs when cross-compiling.
* libguile/Makefile.am (gen-scmconfig.$(OBJEXT)): When cross-compiling, pass -DCROSS_COMPILING=1. (c-tokenize.$(OBJEXT)): Likewise. * libguile/c-tokenize.lex (%top): Include <config.h> only when CROSS_COMPILING is undefined. * libguile/gen-scmconfig.c: Likewise.
This commit is contained in:
parent
da7e43a6e0
commit
8cb0d6d7fa
3 changed files with 25 additions and 16 deletions
|
@ -60,12 +60,13 @@ gen_scmconfig_SOURCES = gen-scmconfig.c
|
||||||
## the generated config.h and gen-scmconfig.h. Nothing else from Guile
|
## the generated config.h and gen-scmconfig.h. Nothing else from Guile
|
||||||
## is included by this code generator.
|
## is included by this code generator.
|
||||||
gen-scmconfig.$(OBJEXT): gen-scmconfig.c
|
gen-scmconfig.$(OBJEXT): gen-scmconfig.c
|
||||||
$(AM_V_GEN) \
|
$(AM_V_GEN) \
|
||||||
if [ "$(cross_compiling)" = "yes" ]; then \
|
if [ "$(cross_compiling)" = "yes" ]; then \
|
||||||
$(CC_FOR_BUILD) $(DEFS) $(DEFAULT_INCLUDES) -I$(top_builddir) \
|
$(CC_FOR_BUILD) -DCROSS_COMPILING=1 $(DEFS) \
|
||||||
-c -o $@ $<; \
|
$(DEFAULT_INCLUDES) -I$(top_builddir) \
|
||||||
else \
|
-c -o "$@" "$<"; \
|
||||||
$(COMPILE) -c -o $@ $<; \
|
else \
|
||||||
|
$(COMPILE) -c -o "$@" "$<"; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
## Override default rule; this should run on BUILD host.
|
## Override default rule; this should run on BUILD host.
|
||||||
|
@ -92,11 +93,12 @@ guile_filter_doc_snarfage_SOURCES = c-tokenize.c
|
||||||
## Override default rule; this should be compiled for BUILD host.
|
## Override default rule; this should be compiled for BUILD host.
|
||||||
## For some reason, OBJEXT does not include the dot
|
## For some reason, OBJEXT does not include the dot
|
||||||
c-tokenize.$(OBJEXT): c-tokenize.c
|
c-tokenize.$(OBJEXT): c-tokenize.c
|
||||||
$(AM_V_GEN) \
|
$(AM_V_GEN) \
|
||||||
if [ "$(cross_compiling)" = "yes" ]; then \
|
if [ "$(cross_compiling)" = "yes" ]; then \
|
||||||
$(CC_FOR_BUILD) -I$(top_builddir) -c -o $@ $<; \
|
$(CC_FOR_BUILD) -DCROSS_COMPILING=1 -I$(top_builddir) \
|
||||||
else \
|
-c -o "$@" "$<"; \
|
||||||
$(COMPILE) -c -o $@ $<; \
|
else \
|
||||||
|
$(COMPILE) -c -o "$@" "$<"; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
## Override default rule; this should run on BUILD host.
|
## Override default rule; this should run on BUILD host.
|
||||||
|
|
|
@ -1,7 +1,12 @@
|
||||||
%top{
|
%top{
|
||||||
/* Include <config.h> before anything else because Gnulib headers such
|
/* Include <config.h> before anything else because Gnulib headers such
|
||||||
as <stdio.h> rely on it. */
|
as <stdio.h> rely on it.
|
||||||
#include <config.h>
|
|
||||||
|
However, when cross-compiling, don't include <config.h> because it
|
||||||
|
contains information about the host, not about the build. */
|
||||||
|
#ifndef CROSS_COMPILING
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
%option noyywrap
|
%option noyywrap
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (C) 2003-2013 Free Software Foundation, Inc.
|
/* Copyright (C) 2003-2014 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public License
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
|
@ -132,8 +132,10 @@
|
||||||
|
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
/* Don't include <config.h> when cross-compiling because it contains
|
||||||
# include <config.h>
|
information about the host, not about the build machine. */
|
||||||
|
#ifndef CROSS_COMPILING
|
||||||
|
# include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <libguile/gen-scmconfig.h>
|
#include <libguile/gen-scmconfig.h>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue