1 | #!/bin/sh |
---|
2 | # Prints information for maintaining config.rpath. |
---|
3 | |
---|
4 | # The caller should set the environment variables |
---|
5 | # top_srcdir, srcdir, CONFIG_SHELL, CC, GCC, LDFLAGS, LD, with_gnu_ld, host. |
---|
6 | |
---|
7 | echo "=============== rpathcfg for $host ===============" |
---|
8 | echo |
---|
9 | echo "--------------- config.rpath output ---------------" |
---|
10 | ${CONFIG_SHELL-/bin/sh} $srcdir/../config.rpath "$host" | sed -e 's/^acl_cv_//' |
---|
11 | echo "--------------- experimentally determined ---------------" |
---|
12 | builddir=`pwd` |
---|
13 | global_top_auxdir=`cd "$top_srcdir"/config && pwd` |
---|
14 | export global_top_auxdir |
---|
15 | |
---|
16 | test -d tstdir || mkdir tstdir |
---|
17 | |
---|
18 | rm -rf tstprefix tstdir/build tstlib |
---|
19 | |
---|
20 | eval `${CONFIG_SHELL-/bin/sh} $srcdir/../config.rpath "$host" | grep '^acl_cv_wl='` |
---|
21 | wl="$acl_cv_wl" |
---|
22 | |
---|
23 | # Static library suffix (normally "a"). |
---|
24 | mkdir tstprefix |
---|
25 | mkdir tstdir/build |
---|
26 | (cd $srcdir/rpathx && tar cf - *) | (cd tstdir/build && tar xf -) |
---|
27 | (cd tstdir/build |
---|
28 | ${CONFIG_SHELL-/bin/sh} ./configure --disable-shared --prefix=$builddir/tstprefix > configure.log 2>&1 |
---|
29 | make > make.log 2>&1 |
---|
30 | make install > install.log 2>&1 |
---|
31 | ) |
---|
32 | rm -rf tstdir/build |
---|
33 | libext= |
---|
34 | cd tstprefix/lib |
---|
35 | for f in *; do |
---|
36 | case $f in |
---|
37 | *.la) ;; |
---|
38 | *[0-9]) ;; |
---|
39 | *) libext=`echo $f | sed -e 's/^.*\.//'`;; |
---|
40 | esac |
---|
41 | if test -n "$libext"; then |
---|
42 | break |
---|
43 | fi |
---|
44 | done |
---|
45 | cd ../.. |
---|
46 | rm -rf tstprefix |
---|
47 | |
---|
48 | # Shared library suffix (normally "so"). |
---|
49 | mkdir tstprefix |
---|
50 | mkdir tstdir/build |
---|
51 | (cd $srcdir/rpathx && tar cf - *) | (cd tstdir/build && tar xf -) |
---|
52 | (cd tstdir/build |
---|
53 | ${CONFIG_SHELL-/bin/sh} ./configure --disable-static --prefix=$builddir/tstprefix > configure.log 2>&1 |
---|
54 | make > make.log 2>&1 |
---|
55 | make install > install.log 2>&1 |
---|
56 | ) |
---|
57 | rm -rf tstdir/build |
---|
58 | shlibext= |
---|
59 | cd tstprefix/lib || exit 1 |
---|
60 | for f in *; do |
---|
61 | case $f in |
---|
62 | *.la) ;; |
---|
63 | *[0-9]) ;; |
---|
64 | *) shlibext=`echo $f | sed -e 's/^.*\.//'`;; |
---|
65 | esac |
---|
66 | if test -n "$shlibext"; then |
---|
67 | break |
---|
68 | fi |
---|
69 | done |
---|
70 | cd ../.. |
---|
71 | rm -rf tstprefix |
---|
72 | |
---|
73 | # Prepare hardcoding tests. |
---|
74 | mkdir tstprefix |
---|
75 | mkdir tstdir/build |
---|
76 | (cd $srcdir/rpathx && tar cf - *) | (cd tstdir/build && tar xf -) |
---|
77 | (cd tstdir/build |
---|
78 | ${CONFIG_SHELL-/bin/sh} ./configure --disable-static --prefix=$builddir/tstprefix > configure.log 2>&1 |
---|
79 | make > make.log 2>&1 |
---|
80 | make install > install.log 2>&1 |
---|
81 | ) |
---|
82 | rm -rf tstdir/build |
---|
83 | |
---|
84 | # Flag to hardcode \$libdir into a binary during linking. |
---|
85 | # This must work even if \$libdir does not exist. |
---|
86 | hardcode_libdir_flag_spec= |
---|
87 | for spec in \ |
---|
88 | '-L$libdir' \ |
---|
89 | '-R$libdir' \ |
---|
90 | '-rpath $libdir' '${wl}-rpath ${wl}$libdir' \ |
---|
91 | '${wl}+b ${wl}$libdir' \ |
---|
92 | '${wl}-R $libdir:/usr/lib:/lib' \ |
---|
93 | '${wl}-blibpath:$libdir:/usr/lib:/lib' \ |
---|
94 | '${wl}-bnolibpath ${wl}-blibpath:$libdir:/usr/lib:/lib' \ |
---|
95 | ; do |
---|
96 | mv tstprefix/lib tstlib |
---|
97 | libdir=`pwd`/tstprefix/lib |
---|
98 | eval flag=\"$spec\" |
---|
99 | echo 1>&2 |
---|
100 | echo "$CC $LDFLAGS $srcdir/rpathlx/usex.c tstlib/librpathx.$shlibext $flag -o a.out" 1>&2 |
---|
101 | $CC $LDFLAGS $srcdir/rpathlx/usex.c tstlib/librpathx.$shlibext $flag -o a.out |
---|
102 | if test $? = 0; then |
---|
103 | mv tstlib tstprefix/lib |
---|
104 | echo "ok, running created a.out." 1>&2 |
---|
105 | if ./a.out; then |
---|
106 | hardcode_libdir_flag_spec="$hardcode_libdir_flag_spec$spec |
---|
107 | " |
---|
108 | fi |
---|
109 | else |
---|
110 | mv tstlib tstprefix/lib |
---|
111 | fi |
---|
112 | rm -f a.out |
---|
113 | done |
---|
114 | |
---|
115 | # Whether we need a single -rpath flag with a separated argument. |
---|
116 | hardcode_libdir_separator= |
---|
117 | if test -n "$hardcode_libdir_flag_spec"; then |
---|
118 | spec=`echo "$hardcode_libdir_flag_spec" | sed -e '2,$d'` |
---|
119 | # Try with multiple -rpath flags. |
---|
120 | mv tstprefix/lib tstlib |
---|
121 | libdir=`pwd`/tstprefix/lib |
---|
122 | eval flag1=\"$spec\" |
---|
123 | libdir=/tmp |
---|
124 | eval flag2=\"$spec\" |
---|
125 | echo 1>&2 |
---|
126 | echo "$CC $LDFLAGS $srcdir/rpathlx/usex.c tstlib/librpathx.$shlibext $flag1 $flag2 -o a.out" 1>&2 |
---|
127 | $CC $LDFLAGS $srcdir/rpathlx/usex.c tstlib/librpathx.$shlibext $flag1 $flag2 -o a.out |
---|
128 | if test $? = 0; then |
---|
129 | mv tstlib tstprefix/lib |
---|
130 | echo "ok, running created a.out." 1>&2 |
---|
131 | if ./a.out; then |
---|
132 | hardcode_libdir_separator=NONE |
---|
133 | fi |
---|
134 | else |
---|
135 | mv tstlib tstprefix/lib |
---|
136 | fi |
---|
137 | rm -f a.out |
---|
138 | if test -z "$hardcode_libdir_separator"; then |
---|
139 | # Try with a single -rpath flag. |
---|
140 | mv tstprefix/lib tstlib |
---|
141 | libdir=`pwd`/tstprefix/lib:/tmp |
---|
142 | eval flag=\"$spec\" |
---|
143 | echo 1>&2 |
---|
144 | echo "$CC $LDFLAGS $srcdir/rpathlx/usex.c tstlib/librpathx.$shlibext $flag -o a.out" 1>&2 |
---|
145 | $CC $LDFLAGS $srcdir/rpathlx/usex.c tstlib/librpathx.$shlibext $flag -o a.out |
---|
146 | if test $? = 0; then |
---|
147 | mv tstlib tstprefix/lib |
---|
148 | echo "ok, running created a.out." 1>&2 |
---|
149 | if ./a.out; then |
---|
150 | hardcode_libdir_separator=: |
---|
151 | fi |
---|
152 | else |
---|
153 | mv tstlib tstprefix/lib |
---|
154 | fi |
---|
155 | rm -f a.out |
---|
156 | fi |
---|
157 | if test -z "$hardcode_libdir_separator"; then |
---|
158 | echo "hardcode_libdir_separator test failed!" 1>&2 |
---|
159 | else |
---|
160 | if test "$hardcode_libdir_separator" = NONE; then |
---|
161 | hardcode_libdir_separator= |
---|
162 | fi |
---|
163 | fi |
---|
164 | fi |
---|
165 | |
---|
166 | # Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the |
---|
167 | # resulting binary. |
---|
168 | hardcode_direct=no |
---|
169 | echo 1>&2 |
---|
170 | echo "$CC $LDFLAGS $srcdir/rpathlx/usex.c tstprefix/lib/librpathx.$shlibext -o a.out" 1>&2 |
---|
171 | $CC $LDFLAGS $srcdir/rpathlx/usex.c tstprefix/lib/librpathx.$shlibext -o a.out |
---|
172 | if test $? = 0; then |
---|
173 | echo "ok, running created a.out." 1>&2 |
---|
174 | if ./a.out; then |
---|
175 | hardcode_direct=yes |
---|
176 | fi |
---|
177 | fi |
---|
178 | rm -f a.out |
---|
179 | |
---|
180 | # Set to yes if using the -LDIR flag during linking hardcodes DIR into the |
---|
181 | # resulting binary. |
---|
182 | hardcode_minus_L=no |
---|
183 | echo 1>&2 |
---|
184 | echo "$CC $LDFLAGS $srcdir/rpathlx/usex.c -Ltstprefix/lib -lrpathx -o a.out" 1>&2 |
---|
185 | $CC $LDFLAGS $srcdir/rpathlx/usex.c -Ltstprefix/lib -lrpathx -o a.out |
---|
186 | if test $? = 0; then |
---|
187 | echo "ok, running created a.out." 1>&2 |
---|
188 | if ./a.out; then |
---|
189 | hardcode_minus_L=yes |
---|
190 | fi |
---|
191 | fi |
---|
192 | rm -f a.out |
---|
193 | |
---|
194 | # Clean up. |
---|
195 | rm -rf tstprefix tstdir |
---|
196 | |
---|
197 | sed_quote_subst='s/\(["`$\\]\)/\\\1/g' |
---|
198 | escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` |
---|
199 | escaped_sys_lib_search_path_spec=`echo "X$sys_lib_search_path_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` |
---|
200 | escaped_sys_lib_dlsearch_path_spec=`echo "X$sys_lib_dlsearch_path_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` |
---|
201 | |
---|
202 | cat <<EOF |
---|
203 | |
---|
204 | # Static library suffix (normally "a"). |
---|
205 | libext="$libext" |
---|
206 | |
---|
207 | # Shared library suffix (normally "so"). |
---|
208 | shlibext="$shlibext" |
---|
209 | |
---|
210 | # Flag to hardcode \$libdir into a binary during linking. |
---|
211 | # This must work even if \$libdir does not exist. |
---|
212 | hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec" |
---|
213 | |
---|
214 | # Whether we need a single -rpath flag with a separated argument. |
---|
215 | hardcode_libdir_separator="$hardcode_libdir_separator" |
---|
216 | |
---|
217 | # Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the |
---|
218 | # resulting binary. |
---|
219 | hardcode_direct="$hardcode_direct" |
---|
220 | |
---|
221 | # Set to yes if using the -LDIR flag during linking hardcodes DIR into the |
---|
222 | # resulting binary. |
---|
223 | hardcode_minus_L="$hardcode_minus_L" |
---|
224 | |
---|
225 | EOF |
---|