1From ac9d057895f1e61f63cbecafcc3e3820fdb10f84 Mon Sep 17 00:00:00 2001
2From: Luca Saiu <positron@gnu.org>
3Date: Fri, 30 Apr 2021 22:42:57 +0200
4Subject: [PATCH] tentatively change --cppflags to omit -I prefix on
5 cross-compilation
6
7The autoconf macros defined from jitter --cppflags get automatically changed, of
8course.
9
10* configure.ac (JITTER_CROSS_COMPILING): New substitution.
11
12* bin/jitter-config.in.m4sh (main loop) <--cppflags>: Introduce conditional on
13the new substitution.
14
15Suggested by Romain Naour, after his difficulties with building GNU poke with
16buildroot.
17
18(cherry picked from commit 428406c7b8d4c20f3472d41ed57c12c1a88ad37e)
19[Romain:
20  patch jitter-config.in instead of jitter-config.in.m4sh since
21  there is an issue while converting the M4sh m4sh script ( .in.m4sh )
22  into a portable shell script ( .in ) ready to be processed by aclocal
23  for @-substitutions.]
24
25Signed-off-by: Romain Naour <romain.naour@gmail.com>
26---
27 jitter/bin/jitter-config.in | 10 +++++++---
28 jitter/configure.ac         |  1 +
29 2 files changed, 8 insertions(+), 3 deletions(-)
30
31diff --git a/jitter/bin/jitter-config.in b/jitter/bin/jitter-config.in
32index 5e124f0..4bc508d 100644
33--- a/jitter/bin/jitter-config.in
34+++ b/jitter/bin/jitter-config.in
35@@ -999,10 +999,14 @@ while test "$#" != "0"; do
36         --cppflags)
37             no_option_argument
38             append_to_output cppflags
39-            # Append a -I argument.  This is defined separately from the rest,
40-            # as the installation prefix can be decided very late, at Jitter
41+            # Unless cross-compiling, append a -I argument referring the
42+            # installation path.  This is defined separately from the rest, as
43+            # the installation prefix can be decided very late, at Jitter
44             # installation time.
45-            output="$output -I $includedir";;
46+            # (When cross-compiling this would be difficult to do correctly.)
47+            if test "x@JITTER_CROSS_COMPILING@" != 'xyes'; then
48+              output="$output -I $includedir"
49+            fi;;
50         --ldadd)
51             no_option_argument
52             append_to_output ldadd;;
53diff --git a/jitter/configure.ac b/jitter/configure.ac
54index 21d6937..fb12349 100644
55--- a/jitter/configure.ac
56+++ b/jitter/configure.ac
57@@ -308,6 +308,7 @@ else
58    AC_MSG_RESULT([yes, cross-compiling from $build to $host .])
59    jitter_cross_compiling=yes
60 fi
61+AC_SUBST([JITTER_CROSS_COMPILING], [$jitter_cross_compiling])
62
63 # I never test on weird systems not supporting shebangs.
64 AC_SYS_INTERPRETER
65--
662.31.1
67
68