b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame^] | 1 | Fix cross-compilation |
| 2 | |
| 3 | Fetched httpd-2.4.x-cross_compile.diff from upstream bugtracker: |
| 4 | https://issues.apache.org/bugzilla/show_bug.cgi?id=51257#c6 |
| 5 | |
| 6 | which 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 | |
| 11 | Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de> |
| 12 | |
| 13 | --- a/server/Makefile.in |
| 14 | +++ b/server/Makefile.in |
| 15 | @@ -24,9 +24,14 @@ TARGETS = delete-exports $(LTLIBRARY_NAM |
| 16 | include $(top_builddir)/build/rules.mk |
| 17 | include $(top_srcdir)/build/library.mk |
| 18 | |
| 19 | +ifdef CC_FOR_BUILD |
| 20 | +gen_test_char: gen_test_char.c |
| 21 | + $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) -DCROSS_COMPILE -o $@ $< |
| 22 | +else |
| 23 | gen_test_char_OBJECTS = gen_test_char.lo |
| 24 | gen_test_char: $(gen_test_char_OBJECTS) |
| 25 | $(LINK) $(EXTRA_LDFLAGS) $(gen_test_char_OBJECTS) $(EXTRA_LIBS) |
| 26 | +endif |
| 27 | |
| 28 | test_char.h: gen_test_char |
| 29 | ./gen_test_char > test_char.h |
| 30 | --- a/configure.in |
| 31 | +++ b/configure.in |
| 32 | @@ -206,6 +206,14 @@ AC_PROG_CPP |
| 33 | dnl Try to get c99 support for variadic macros |
| 34 | ifdef([AC_PROG_CC_C99], [AC_PROG_CC_C99]) |
| 35 | |
| 36 | +dnl In case of cross compilation we set CC_FOR_BUILD to cc unless |
| 37 | +dnl we got already CC_FOR_BUILD from environment. |
| 38 | +if test "x${build_alias}" != "x${host_alias}"; then |
| 39 | + if test "x${CC_FOR_BUILD}" = "x"; then |
| 40 | + CC_FOR_BUILD=cc |
| 41 | + fi |
| 42 | +fi |
| 43 | + |
| 44 | if test "x${cache_file}" = "x/dev/null"; then |
| 45 | # Likewise, ensure that CC and CPP are passed through to the pcre |
| 46 | # configure script iff caching is disabled (the autoconf 2.5x default). |
| 47 | --- a/acinclude.m4 |
| 48 | +++ b/acinclude.m4 |
| 49 | @@ -55,6 +55,8 @@ AC_DEFUN([APACHE_GEN_CONFIG_VARS],[ |
| 50 | APACHE_SUBST(CPPFLAGS) |
| 51 | APACHE_SUBST(CFLAGS) |
| 52 | APACHE_SUBST(CXXFLAGS) |
| 53 | + APACHE_SUBST(CC_FOR_BUILD) |
| 54 | + APACHE_SUBST(CFLAGS_FOR_BUILD) |
| 55 | APACHE_SUBST(LTFLAGS) |
| 56 | APACHE_SUBST(LDFLAGS) |
| 57 | APACHE_SUBST(LT_LDFLAGS) |