diff options
-rw-r--r-- | src/Makefile.am | 5 | ||||
-rw-r--r-- | src/mkheader.c | 12 |
2 files changed, 15 insertions, 2 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index ca04262..c74baae 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -312,8 +312,10 @@ parts_of_gpg_error_h = \ if FORCE_USE_SYSCFG pre_mkheader_cmds = if test -f lock-obj-pub.native.h; \ then rm lock-obj-pub.native.h; fi +mkheader_opts = --cross else pre_mkheader_cmds = : +mkheader_opts = parts_of_gpg_error_h += ./lock-obj-pub.native.h ./lock-obj-pub.native.h: Makefile gen-posix-lock-obj$(EXEEXT) posix-lock-obj.h @@ -325,7 +327,8 @@ endif gpg-error.h: Makefile mkheader$(EXEEXT_FOR_BUILD) $(parts_of_gpg_error_h) \ versioninfo.rc ../config.h $(pre_mkheader_cmds) - ./mkheader$(EXEEXT_FOR_BUILD) $(host_triplet) $(srcdir)/gpg-error.h.in \ + ./mkheader$(EXEEXT_FOR_BUILD) $(mkheader_opts) \ + $(host_triplet) $(srcdir)/gpg-error.h.in \ ../config.h $(PACKAGE_VERSION) $(VERSION_NUMBER) >$@ gpgrt.h: gpg-error.h diff --git a/src/mkheader.c b/src/mkheader.c index 6071a20..9a96b84 100644 --- a/src/mkheader.c +++ b/src/mkheader.c @@ -27,6 +27,7 @@ static char *host_os; /* points into host_triplet. */ static char *srcdir; static const char *hdr_version; static const char *hdr_version_number; +static int cross_building; /* Command line flag. */ /* Values take from the supplied config.h. */ static int have_stdint_h; @@ -611,7 +612,11 @@ write_special (const char *fname, int lnr, const char *tag) } else if (!strcmp (tag, "include:lock-obj")) { - if (try_include_file (fname, lnr, "./lock-obj-pub.native.h", write_line)) + /* If we are not cross compiling and the native file exists we + * prefer that over one from syscfg. */ + if (cross_building + || try_include_file (fname, lnr, + "./lock-obj-pub.native.h", write_line)) include_file (fname, lnr, "syscfg/lock-obj-pub.&.h", write_line); } else @@ -636,6 +641,11 @@ main (int argc, char **argv) { argc--; argv++; } + if (argc && !strcmp (argv[0], "--cross")) + { + cross_building = 1; + argc--; argv++; + } if (argc == 1) { |