blob: 9516caf51aa08d48076cd13c64b53cdb7f522bd8 [file] [log] [blame]
Brad Bishop6e60e8b2018-02-01 10:27:11 -05001Fix for cross compiling
2
3Fixed:
4| ./dftables src/pcre2_chartables.c
5| make: ./dftables: Command not found
6| make: *** [src/pcre2_chartables.c] Error 127
7
8Upstream-Status: Pending
9
10Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
11
12diff --git a/Makefile.am b/Makefile.am
13index 38f1d41..2bde083 100644
14--- a/Makefile.am
15+++ b/Makefile.am
16@@ -298,9 +298,21 @@ bin_SCRIPTS = pcre2-config
17 ## to copy a distributed set of tables that are defined for ASCII code. In this
18 ## case, dftables is not needed.
19
20+CC_FOR_BUILD = @CC_FOR_BUILD@
21+CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
22+CCLD_FOR_BUILD = @CCLD_FOR_BUILD@
23+LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@
24+
25 if WITH_REBUILD_CHARTABLES
26 noinst_PROGRAMS += dftables
27 dftables_SOURCES = src/dftables.c
28+
29+dftables_LINK = $(CCLD_FOR_BUILD) -o $@
30+dftables_LDFLAGS = $(LDFLAGS_FOR_BUILD)
31+
32+src/dftables.o: $(srcdir)/src/dftables.c
33+ $(CC_FOR_BUILD) -c $(CFLAGS_FOR_BUILD) -o $@ $(srcdir)/src/dftables.c
34+
35 src/pcre2_chartables.c: dftables$(EXEEXT)
36 rm -f $@
37 ./dftables$(EXEEXT) $@
38diff --git a/configure.ac b/configure.ac
39index d7c57aa..d6eb0aa 100644
40--- a/configure.ac
41+++ b/configure.ac
42@@ -59,6 +59,23 @@ then
43 fi
44 fi
45
46+if test x"$cross_compiling" = xyes; then
47+ CC_FOR_BUILD="${CC_FOR_BUILD-gcc}"
48+ CCLD_FOR_BUILD="${CCLD_FOR_BUILD-gcc}"
49+ CFLAGS_FOR_BUILD="${CFLAGS_FOR_BUILD}"
50+ LDFLAGS_FOR_BUILD="${LDFLAGS_FOR_BUILD}"
51+else
52+ CC_FOR_BUILD="${CC_FOR_BUILD-\$(CC)}"
53+ CCLD_FOR_BUILD="${CCLD_FOR_BUILD-\$(CCLD)}"
54+ CFLAGS_FOR_BUILD="${CFLAGS_FOR_BUILD-\$(CFLAGS)}"
55+ LDFLAGS_FOR_BUILD="${LDFLAGS_FOR_BUILD-\$(LDFLAGS)}"
56+fi
57+AC_ARG_VAR(CC_FOR_BUILD, [build system C compiler])
58+AC_ARG_VAR(CCLD_FOR_BUILD, [build system C linker frontend])
59+AC_ARG_VAR(CFLAGS_FOR_BUILD, [build system C compiler arguments])
60+AC_ARG_VAR(LDFLAGS_FOR_BUILD, [build system C linker frontend arguments])
61+
62+
63 # Check for a 64-bit integer type
64 AC_TYPE_INT64_T
65