xref: /OK3568_Linux_fs/buildroot/package/apache/0001-cross-compile.patch (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1Fix cross-compilation
2
3Fetched httpd-2.4.x-cross_compile.diff from upstream bugtracker:
4https://issues.apache.org/bugzilla/show_bug.cgi?id=51257#c6
5
6which is a bundle of upstream revisions:
7    http://svn.apache.org/viewvc?view=revision&revision=1327907
8    http://svn.apache.org/viewvc?view=revision&revision=1328390
9    http://svn.apache.org/viewvc?view=revision&revision=1328714
10
11Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
12
13Index: server/Makefile.in
14===================================================================
15--- a/server/Makefile.in	(revision 1328714)
16+++ b/server/Makefile.in	(working copy)
17@@ -22,9 +22,14 @@
18 include $(top_builddir)/build/rules.mk
19 include $(top_srcdir)/build/library.mk
20
21+ifdef CC_FOR_BUILD
22+gen_test_char: gen_test_char.c
23+	$(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) -DCROSS_COMPILE -o $@ $<
24+else
25 gen_test_char_OBJECTS = gen_test_char.lo
26 gen_test_char: $(gen_test_char_OBJECTS)
27 	$(LINK) $(EXTRA_LDFLAGS) $(gen_test_char_OBJECTS) $(EXTRA_LIBS)
28+endif
29
30 test_char.h: gen_test_char
31 	./gen_test_char > test_char.h
32Index: configure.in
33===================================================================
34--- a/configure.in	(revision 1328714)
35+++ b/configure.in	(working copy)
36@@ -193,6 +193,14 @@
37 dnl Try to get c99 support for variadic macros
38 ifdef([AC_PROG_CC_C99], [AC_PROG_CC_C99])
39
40+dnl In case of cross compilation we set CC_FOR_BUILD to cc unless
41+dnl we got already CC_FOR_BUILD from environment.
42+if test "x${build_alias}" != "x${host_alias}"; then
43+  if test "x${CC_FOR_BUILD}" = "x"; then
44+    CC_FOR_BUILD=cc
45+  fi
46+fi
47+
48 if test "x${cache_file}" = "x/dev/null"; then
49   # Likewise, ensure that CC and CPP are passed through to the pcre
50   # configure script iff caching is disabled (the autoconf 2.5x default).
51Index: acinclude.m4
52===================================================================
53--- a/acinclude.m4	(revision 1328714)
54+++ ab/cinclude.m4	(working copy)
55@@ -53,6 +53,8 @@
56   APACHE_SUBST(CPPFLAGS)
57   APACHE_SUBST(CFLAGS)
58   APACHE_SUBST(CXXFLAGS)
59+  APACHE_SUBST(CC_FOR_BUILD)
60+  APACHE_SUBST(CFLAGS_FOR_BUILD)
61   APACHE_SUBST(LTFLAGS)
62   APACHE_SUBST(LDFLAGS)
63   APACHE_SUBST(LT_LDFLAGS)
64