xref: /OK3568_Linux_fs/buildroot/package/apr/0001-cross-compile.patch (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1Fix cross-compilation
2
3Patch was backported from Apache httpd:
4http://svn.apache.org/viewvc?view=revision&revision=1327907
5http://svn.apache.org/viewvc?view=revision&revision=1328390
6http://svn.apache.org/viewvc?view=revision&revision=1328714
7
8Patch submitted upstream:
9https://issues.apache.org/bugzilla/show_bug.cgi?id=57058
10
11Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
12
13diff -uNr apr-1.5.1.org/configure.in apr-1.5.1/configure.in
14--- apr-1.5.1.org/configure.in	2014-01-25 16:17:29.000000000 +0100
15+++ apr-1.5.1/configure.in	2014-10-05 11:20:40.080746760 +0200
16@@ -118,6 +118,16 @@
17 echo "Configuring APR library"
18 echo "Platform: $host"
19
20+dnl In case of cross compilation we set CC_FOR_BUILD to cc unless
21+dnl we got already CC_FOR_BUILD from environment.
22+if test "x${build_alias}" != "x${host_alias}"; then
23+  if test "x${CC_FOR_BUILD}" = "x"; then
24+    CC_FOR_BUILD=cc
25+  fi
26+fi
27+AC_SUBST(CC_FOR_BUILD)
28+AC_SUBST(CFLAGS_FOR_BUILD)
29+
30 dnl Some initial steps for configuration.  We setup the default directory
31 dnl and which files are to be configured.
32
33diff -uNr apr-1.5.1.org/Makefile.in apr-1.5.1/Makefile.in
34--- apr-1.5.1.org/Makefile.in	2014-03-17 16:10:26.000000000 +0100
35+++ apr-1.5.1/Makefile.in	2014-10-05 11:22:53.031070519 +0200
36@@ -8,6 +8,8 @@
37 # APR (Apache Portable Runtime) library Makefile.
38 #
39 CPP = @CPP@
40+CC_FOR_BUILD = @CC_FOR_BUILD@
41+CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
42
43 # get substituted into some targets
44 APR_MAJOR_VERSION=@APR_MAJOR_VERSION@
45@@ -134,8 +134,13 @@
46 	$(APR_MKDIR) tools
47 	$(LT_COMPILE)
48
49+ifdef CC_FOR_BUILD
50+tools/gen_test_char@EXEEXT@: tools/gen_test_char.c $(LOCAL_LIBS)
51+	$(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) -DCROSS_COMPILE -o $@ $<
52+else
53 tools/gen_test_char@EXEEXT@: $(OBJECTS_gen_test_char)
54 	$(LINK_PROG) $(OBJECTS_gen_test_char) $(ALL_LIBS)
55+endif
56
57 include/private/apr_escape_test_char.h: tools/gen_test_char@EXEEXT@
58 	$(APR_MKDIR) include/private
59