libtool: make relocatable, search resources relative to STAGING_DIR
[openwrt/openwrt.git] / tools / libtool / patches / 000-relocatable.patch
1 --- a/libltdl/config/general.m4sh
2 +++ b/libltdl/config/general.m4sh
3 @@ -53,7 +53,7 @@ test "${ECHO+set}" = set || ECHO=${as_ec
4 : ${MKDIR="mkdir"}
5 : ${MV="mv -f"}
6 : ${RM="rm -f"}
7 -: ${SED="@SED@"}
8 +test "${STAGING_DIR+set}" = set && ${SED="$STAGING_DIR/../host/bin/sed"} || ${SED="@SED@"}
9 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
10 : ${Xsed="$SED -e 1s/^X//"}
11
12 --- a/libtoolize.in
13 +++ b/libtoolize.in
14 @@ -334,7 +334,7 @@ test "${ECHO+set}" = set || ECHO=${as_ec
15 : ${MKDIR="mkdir"}
16 : ${MV="mv -f"}
17 : ${RM="rm -f"}
18 -: ${SED="@SED@"}
19 +test "${STAGING_DIR+set}" = set && ${SED="$STAGING_DIR/../host/bin/sed"} || ${SED="@SED@"}
20 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
21 : ${Xsed="$SED -e 1s/^X//"}
22
23 @@ -2476,10 +2476,17 @@ func_check_macros ()
24
25 # Locations for important files:
26 prefix=@prefix@
27 - datadir=@datadir@
28 - pkgdatadir=@pkgdatadir@
29 - pkgltdldir=@pkgdatadir@
30 - aclocaldir=@aclocaldir@
31 + if test -n "$STAGING_DIR"; then
32 + datadir="$STAGING_DIR/../host/share"
33 + pkgdatadir="$STAGING_DIR/../host/share/libtool"
34 + pkgltdldir="$STAGING_DIR/../host/share/libtool"
35 + aclocaldir="$STAGING_DIR/../host/share/aclocal"
36 + else
37 + datadir=@datadir@
38 + pkgdatadir=@pkgdatadir@
39 + pkgltdldir=@pkgdatadir@
40 + aclocaldir=@aclocaldir@
41 + fi
42 auxdir=
43 macrodir=
44 configure_ac=configure.in
45 --- a/libtoolize.m4sh
46 +++ b/libtoolize.m4sh
47 @@ -1450,10 +1450,17 @@ func_check_macros ()
48
49 # Locations for important files:
50 prefix=@prefix@
51 - datadir=@datadir@
52 - pkgdatadir=@pkgdatadir@
53 - pkgltdldir=@pkgdatadir@
54 - aclocaldir=@aclocaldir@
55 + if test -n "$STAGING_DIR"; then
56 + datadir="$STAGING_DIR/../host/share"
57 + pkgdatadir="$STAGING_DIR/../host/share/libtool"
58 + pkgltdldir="$STAGING_DIR/../host/share/libtool"
59 + aclocaldir="$STAGING_DIR/../host/share/aclocal"
60 + else
61 + datadir=@datadir@
62 + pkgdatadir=@pkgdatadir@
63 + pkgltdldir=@pkgdatadir@
64 + aclocaldir=@aclocaldir@
65 + fi
66 auxdir=
67 macrodir=
68 configure_ac=configure.in
69 --- a/libltdl/m4/libtool.m4
70 +++ b/libltdl/m4/libtool.m4
71 @@ -875,9 +875,8 @@ dnl AC_DEFUN([AC_LIBTOOL_RC], [])
72 # ----------------
73 m4_defun([_LT_TAG_COMPILER],
74 [AC_REQUIRE([AC_PROG_CC])dnl
75 -
76 _LT_DECL([LTCC], [CC], [1], [A C compiler])dnl
77 -_LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl
78 +_LT_DECL([LTCFLAGS], [CFLAGS], ["-O2 -I\${STAGING_DIR:-$STAGING_DIR}/../host/include"], [LTCC compiler flags])dnl
79 _LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl
80 _LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl
81
82 @@ -7544,9 +7543,8 @@ AC_SUBST([DLLTOOL])
83 # as few characters as possible. Prefer GNU sed if found.
84 m4_defun([_LT_DECL_SED],
85 [AC_PROG_SED
86 -test -z "$SED" && SED=sed
87 Xsed="$SED -e 1s/^X//"
88 -_LT_DECL([], [SED], [1], [A sed program that does not truncate output])
89 +_LT_DECL([], [SED], ["\${STAGING_DIR:-$STAGING_DIR}/../host/bin/sed"], [A sed program that does not truncate output])
90 _LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"],
91 [Sed that helps us avoid accidentally triggering echo(1) options like -n])
92 ])# _LT_DECL_SED