blob: 4dd53bd8eb3cbe825facf07d2c0ddf25388d1d30 [file] [log] [blame]
Brad Bishop316dfdd2018-06-25 12:45:53 -04001From d5028c10f156c224475b340cfb1ba025d6797243 Mon Sep 17 00:00:00 2001
2From: Hongxu Jia <hongxu.jia@windriver.com>
3Date: Fri, 2 Feb 2018 15:51:42 +0800
4Subject: [PATCH 3/7] Makefile.in/configure.in: support cross compiling
5
6While cross compiling, the tools/gen_test_char could not
7be executed at build time, use AX_PROG_CC_FOR_BUILD to
8build native tools/gen_test_char
9
10Upstream-Status: Submitted [https://github.com/apache/apr/pull/8]
11
12Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
13---
14 Makefile.in | 10 +++-------
15 configure.in | 3 +++
16 2 files changed, 6 insertions(+), 7 deletions(-)
17
18diff --git a/Makefile.in b/Makefile.in
19index 5fb760e..8675f90 100644
20--- a/Makefile.in
21+++ b/Makefile.in
22@@ -46,7 +46,7 @@ LT_VERSION = @LT_VERSION@
23
24 CLEAN_TARGETS = apr-config.out apr.exp exports.c export_vars.c .make.dirs \
25 build/apr_rules.out tools/gen_test_char@EXEEXT@ \
26- tools/gen_test_char.o tools/gen_test_char.lo \
27+ tools/gen_test_char.o \
28 include/private/apr_escape_test_char.h
29 DISTCLEAN_TARGETS = config.cache config.log config.status \
30 include/apr.h include/arch/unix/apr_private.h \
31@@ -131,13 +131,9 @@ check: $(TARGET_LIB)
32 etags:
33 etags `find . -name '*.[ch]'`
34
35-OBJECTS_gen_test_char = tools/gen_test_char.lo $(LOCAL_LIBS)
36-tools/gen_test_char.lo: tools/gen_test_char.c
37+tools/gen_test_char@EXEEXT@: tools/gen_test_char.c
38 $(APR_MKDIR) tools
39- $(LT_COMPILE)
40-
41-tools/gen_test_char@EXEEXT@: $(OBJECTS_gen_test_char)
42- $(LINK_PROG) $(OBJECTS_gen_test_char) $(ALL_LIBS)
43+ $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $< -o $@
44
45 include/private/apr_escape_test_char.h: tools/gen_test_char@EXEEXT@
46 $(APR_MKDIR) include/private
47diff --git a/configure.in b/configure.in
48index 719f331..361120f 100644
49--- a/configure.in
50+++ b/configure.in
51@@ -183,6 +183,9 @@ dnl can only be used once within a configure script, so this prevents a
52 dnl preload section from invoking the macro to get compiler info.
53 AC_PROG_CC
54
55+dnl Check build CC for gen_test_char compiling which is executed at build time.
56+AX_PROG_CC_FOR_BUILD
57+
58 dnl AC_PROG_SED is only avaliable in recent autoconf versions.
59 dnl Use AC_CHECK_PROG instead if AC_PROG_SED is not present.
60 ifdef([AC_PROG_SED],
61--
621.8.3.1
63