aboutsummaryrefslogtreecommitdiffstats
path: root/src/mkheader.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2018-09-21 12:20:29 +0000
committerWerner Koch <[email protected]>2018-09-21 12:25:19 +0000
commitb371e3ca906e6a4db31900d419ddc2b21bed1ea3 (patch)
tree6d376e3a2523355e87d7163290863346ed1b7bec /src/mkheader.c
parentcore: Simplify calling convention of mkheader. (diff)
downloadlibgpg-error-b371e3ca906e6a4db31900d419ddc2b21bed1ea3.tar.gz
libgpg-error-b371e3ca906e6a4db31900d419ddc2b21bed1ea3.zip
core: Make cross building in mkheader more explicit.
* src/mkheader.c (main): Add option --cross. (write_special): Don't use native in cross mode. * src/Makefile.am (mkheader_opts): New. (gpg-error.h): Add MKHEADER_OPTS. -- The old behaviour was that an existing lock-obj-oub.native.h was preferred over one from syscfg even in cross mode. The Makefile tried to get this right by deleting such a file first but when calling mkheader manually for testing this may have not been done. We now allow (and also use by the Makefile) an option --cross to make this explicit. Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to '')
-rw-r--r--src/mkheader.c12
1 files changed, 11 insertions, 1 deletions
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)
{