| 1 | # ltmain.sh - Provide generalized library-building support services. |
|---|
| 2 | # NOTE: Changing this file will not affect anything until you rerun ltconfig. |
|---|
| 3 | # |
|---|
| 4 | # Copyright (C) 1996-1999 Free Software Foundation, Inc. |
|---|
| 5 | # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 |
|---|
| 6 | # |
|---|
| 7 | # This program is free software; you can redistribute it and/or modify |
|---|
| 8 | # it under the terms of the GNU General Public License as published by |
|---|
| 9 | # the Free Software Foundation; either version 2 of the License, or |
|---|
| 10 | # (at your option) any later version. |
|---|
| 11 | # |
|---|
| 12 | # This program is distributed in the hope that it will be useful, but |
|---|
| 13 | # WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|---|
| 15 | # General Public License for more details. |
|---|
| 16 | # |
|---|
| 17 | # You should have received a copy of the GNU General Public License |
|---|
| 18 | # along with this program; if not, write to the Free Software |
|---|
| 19 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|---|
| 20 | # |
|---|
| 21 | # As a special exception to the GNU General Public License, if you |
|---|
| 22 | # distribute this file as part of a program that contains a |
|---|
| 23 | # configuration script generated by Autoconf, you may include it under |
|---|
| 24 | # the same distribution terms that you use for the rest of that program. |
|---|
| 25 | |
|---|
| 26 | # Check that we have a working $echo. |
|---|
| 27 | if test "X$1" = X--no-reexec; then |
|---|
| 28 | Â # Discard the --no-reexec flag, and continue. |
|---|
| 29 | Â shift |
|---|
| 30 | elif test "X$1" = X--fallback-echo; then |
|---|
| 31 | Â # Avoid inline document here, it may be left over |
|---|
| 32 | Â : |
|---|
| 33 | elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then |
|---|
| 34 | Â # Yippee, $echo works! |
|---|
| 35 | Â : |
|---|
| 36 | else |
|---|
| 37 | Â # Restart under the correct shell, and then maybe $echo will work. |
|---|
| 38 | Â exec $SHELL "$0" --no-reexec ${1+"$@"} |
|---|
| 39 | fi |
|---|
| 40 | |
|---|
| 41 | if test "X$1" = X--fallback-echo; then |
|---|
| 42 | Â # used as fallback echo |
|---|
| 43 | Â shift |
|---|
| 44 | Â cat <<EOF |
|---|
| 45 | $* |
|---|
| 46 | EOF |
|---|
| 47 | Â exit 0 |
|---|
| 48 | fi |
|---|
| 49 | |
|---|
| 50 | # The name of this program. |
|---|
| 51 | progname=`$echo "$0" | sed 's%^.*/%%'` |
|---|
| 52 | modename="$progname" |
|---|
| 53 | |
|---|
| 54 | # Constants. |
|---|
| 55 | PROGRAM=ltmain.sh |
|---|
| 56 | PACKAGE=libtool |
|---|
| 57 | VERSION=1.3.5 |
|---|
| 58 | TIMESTAMP=" (1.385.2.206 2000/05/27 11:12:27)" |
|---|
| 59 | |
|---|
| 60 | default_mode= |
|---|
| 61 | help="Try \`$progname --help' for more information." |
|---|
| 62 | magic="%%%MAGIC variable%%%" |
|---|
| 63 | mkdir="mkdir" |
|---|
| 64 | mv="mv -f" |
|---|
| 65 | rm="rm -f" |
|---|
| 66 | |
|---|
| 67 | # Sed substitution that helps us do robust quoting. It backslashifies |
|---|
| 68 | # metacharacters that are still active within double-quoted strings. |
|---|
| 69 | Xsed='sed -e 1s/^X//' |
|---|
| 70 | sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g' |
|---|
| 71 | SP2NL='tr \040 \012' |
|---|
| 72 | NL2SP='tr \015\012 \040\040' |
|---|
| 73 | |
|---|
| 74 | # NLS nuisances. |
|---|
| 75 | # Only set LANG and LC_ALL to C if already set. |
|---|
| 76 | # These must not be set unconditionally because not all systems understand |
|---|
| 77 | # e.g. LANG=C (notably SCO). |
|---|
| 78 | # We save the old values to restore during execute mode. |
|---|
| 79 | if test "${LC_ALL+set}" = set; then |
|---|
| 80 | Â save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL |
|---|
| 81 | fi |
|---|
| 82 | if test "${LANG+set}" = set; then |
|---|
| 83 | Â save_LANG="$LANG"; LANG=C; export LANG |
|---|
| 84 | fi |
|---|
| 85 | |
|---|
| 86 | if test "$LTCONFIG_VERSION" != "$VERSION"; then |
|---|
| 87 | Â echo "$modename: ltconfig version \`$LTCONFIG_VERSION' does not match $PROGRAM version \`$VERSION'" 1>&2 |
|---|
| 88 |  echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 |
|---|
| 89 | Â exit 1 |
|---|
| 90 | fi |
|---|
| 91 | |
|---|
| 92 | if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then |
|---|
| 93 | Â echo "$modename: not configured to build any kind of library" 1>&2 |
|---|
| 94 |  echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 |
|---|
| 95 | Â exit 1 |
|---|
| 96 | fi |
|---|
| 97 | |
|---|
| 98 | # Global variables. |
|---|
| 99 | mode=$default_mode |
|---|
| 100 | nonopt= |
|---|
| 101 | prev= |
|---|
| 102 | prevopt= |
|---|
| 103 | run= |
|---|
| 104 | show="$echo" |
|---|
| 105 | show_help= |
|---|
| 106 | execute_dlfiles= |
|---|
| 107 | lo2o="s/\\.lo\$/.${objext}/" |
|---|
| 108 | o2lo="s/\\.${objext}\$/.lo/" |
|---|
| 109 | |
|---|
| 110 | # Parse our command line options once, thoroughly. |
|---|
| 111 | while test $# -gt 0 |
|---|
| 112 | do |
|---|
| 113 | Â arg="$1" |
|---|
| 114 | Â shift |
|---|
| 115 | |
|---|
| 116 | Â case "$arg" in |
|---|
| 117 | Â -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; |
|---|
| 118 | Â *) optarg= ;; |
|---|
| 119 | Â esac |
|---|
| 120 | |
|---|
| 121 | Â # If the previous option needs an argument, assign it. |
|---|
| 122 | Â if test -n "$prev"; then |
|---|
| 123 | Â Â case "$prev" in |
|---|
| 124 | Â Â execute_dlfiles) |
|---|
| 125 | Â Â Â eval "$prev=\"\$$prev \$arg\"" |
|---|
| 126 | Â Â Â ;; |
|---|
| 127 | Â Â *) |
|---|
| 128 | Â Â Â eval "$prev=\$arg" |
|---|
| 129 | Â Â Â ;; |
|---|
| 130 | Â Â esac |
|---|
| 131 | |
|---|
| 132 | Â Â prev= |
|---|
| 133 | Â Â prevopt= |
|---|
| 134 | Â Â continue |
|---|
| 135 | Â fi |
|---|
| 136 | |
|---|
| 137 | Â # Have we seen a non-optional argument yet? |
|---|
| 138 | Â case "$arg" in |
|---|
| 139 | Â --help) |
|---|
| 140 | Â Â show_help=yes |
|---|
| 141 | Â Â ;; |
|---|
| 142 | |
|---|
| 143 | Â --version) |
|---|
| 144 | Â Â echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" |
|---|
| 145 | Â Â exit 0 |
|---|
| 146 | Â Â ;; |
|---|
| 147 | |
|---|
| 148 | Â --config) |
|---|
| 149 | Â Â sed -e '1,/^### BEGIN LIBTOOL CONFIG/d' -e '/^### END LIBTOOL CONFIG/,$d' $0 |
|---|
| 150 | Â Â exit 0 |
|---|
| 151 | Â Â ;; |
|---|
| 152 | |
|---|
| 153 | Â --debug) |
|---|
| 154 | Â Â echo "$progname: enabling shell trace mode" |
|---|
| 155 | Â Â set -x |
|---|
| 156 | Â Â ;; |
|---|
| 157 | |
|---|
| 158 | Â --dry-run | -n) |
|---|
| 159 | Â Â run=: |
|---|
| 160 | Â Â ;; |
|---|
| 161 | |
|---|
| 162 | Â --features) |
|---|
| 163 | Â Â echo "host: $host" |
|---|
| 164 | Â Â if test "$build_libtool_libs" = yes; then |
|---|
| 165 | Â Â Â echo "enable shared libraries" |
|---|
| 166 | Â Â else |
|---|
| 167 | Â Â Â echo "disable shared libraries" |
|---|
| 168 | Â Â fi |
|---|
| 169 | Â Â if test "$build_old_libs" = yes; then |
|---|
| 170 | Â Â Â echo "enable static libraries" |
|---|
| 171 | Â Â else |
|---|
| 172 | Â Â Â echo "disable static libraries" |
|---|
| 173 | Â Â fi |
|---|
| 174 | Â Â exit 0 |
|---|
| 175 | Â Â ;; |
|---|
| 176 | |
|---|
| 177 | Â --finish) mode="finish" ;; |
|---|
| 178 | |
|---|
| 179 | Â --mode) prevopt="--mode" prev=mode ;; |
|---|
| 180 | Â --mode=*) mode="$optarg" ;; |
|---|
| 181 | |
|---|
| 182 | Â --quiet | --silent) |
|---|
| 183 | Â Â show=: |
|---|
| 184 | Â Â ;; |
|---|
| 185 | |
|---|
| 186 | Â -dlopen) |
|---|
| 187 | Â Â prevopt="-dlopen" |
|---|
| 188 | Â Â prev=execute_dlfiles |
|---|
| 189 | Â Â ;; |
|---|
| 190 | |
|---|
| 191 | Â -*) |
|---|
| 192 | Â Â $echo "$modename: unrecognized option \`$arg'" 1>&2 |
|---|
| 193 | Â Â $echo "$help" 1>&2 |
|---|
| 194 | Â Â exit 1 |
|---|
| 195 | Â Â ;; |
|---|
| 196 | |
|---|
| 197 | Â *) |
|---|
| 198 | Â Â nonopt="$arg" |
|---|
| 199 | Â Â break |
|---|
| 200 | Â Â ;; |
|---|
| 201 | Â esac |
|---|
| 202 | done |
|---|
| 203 | |
|---|
| 204 | if test -n "$prevopt"; then |
|---|
| 205 | Â $echo "$modename: option \`$prevopt' requires an argument" 1>&2 |
|---|
| 206 | Â $echo "$help" 1>&2 |
|---|
| 207 | Â exit 1 |
|---|
| 208 | fi |
|---|
| 209 | |
|---|
| 210 | if test -z "$show_help"; then |
|---|
| 211 | |
|---|
| 212 | Â # Infer the operation mode. |
|---|
| 213 | Â if test -z "$mode"; then |
|---|
| 214 | Â Â case "$nonopt" in |
|---|
| 215 | Â Â *cc | *++ | gcc* | *-gcc*) |
|---|
| 216 | Â Â Â mode=link |
|---|
| 217 | Â Â Â for arg |
|---|
| 218 | Â Â Â do |
|---|
| 219 | Â Â Â Â case "$arg" in |
|---|
| 220 | Â Â Â Â -c) |
|---|
| 221 | Â Â Â Â Â Â mode=compile |
|---|
| 222 | Â Â Â Â Â Â break |
|---|
| 223 | Â Â Â Â Â Â ;; |
|---|
| 224 | Â Â Â Â esac |
|---|
| 225 | Â Â Â done |
|---|
| 226 | Â Â Â ;; |
|---|
| 227 | Â Â *db | *dbx | *strace | *truss) |
|---|
| 228 | Â Â Â mode=execute |
|---|
| 229 | Â Â Â ;; |
|---|
| 230 | Â Â *install*|cp|mv) |
|---|
| 231 | Â Â Â mode=install |
|---|
| 232 | Â Â Â ;; |
|---|
| 233 | Â Â *rm) |
|---|
| 234 | Â Â Â mode=uninstall |
|---|
| 235 | Â Â Â ;; |
|---|
| 236 | Â Â *) |
|---|
| 237 | Â Â Â # If we have no mode, but dlfiles were specified, then do execute mode. |
|---|
| 238 | Â Â Â test -n "$execute_dlfiles" && mode=execute |
|---|
| 239 | |
|---|
| 240 | Â Â Â # Just use the default operation mode. |
|---|
| 241 | Â Â Â if test -z "$mode"; then |
|---|
| 242 | Â Â Â Â if test -n "$nonopt"; then |
|---|
| 243 | Â Â Â Â Â $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 |
|---|
| 244 | Â Â Â Â else |
|---|
| 245 | Â Â Â Â Â $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 |
|---|
| 246 | Â Â Â Â fi |
|---|
| 247 | Â Â Â fi |
|---|
| 248 | Â Â Â ;; |
|---|
| 249 | Â Â esac |
|---|
| 250 | Â fi |
|---|
| 251 | |
|---|
| 252 | Â # Only execute mode is allowed to have -dlopen flags. |
|---|
| 253 | Â if test -n "$execute_dlfiles" && test "$mode" != execute; then |
|---|
| 254 | Â Â $echo "$modename: unrecognized option \`-dlopen'" 1>&2 |
|---|
| 255 | Â Â $echo "$help" 1>&2 |
|---|
| 256 | Â Â exit 1 |
|---|
| 257 | Â fi |
|---|
| 258 | |
|---|
| 259 | Â # Change the help message to a mode-specific one. |
|---|
| 260 | Â generic_help="$help" |
|---|
| 261 | Â help="Try \`$modename --help --mode=$mode' for more information." |
|---|
| 262 | |
|---|
| 263 | Â # These modes are in order of execution frequency so that they run quickly. |
|---|
| 264 | Â case "$mode" in |
|---|
| 265 | Â # libtool compile mode |
|---|
| 266 | Â compile) |
|---|
| 267 | Â Â modename="$modename: compile" |
|---|
| 268 | Â Â # Get the compilation command and the source file. |
|---|
| 269 | Â Â base_compile= |
|---|
| 270 | Â Â lastarg= |
|---|
| 271 | Â Â srcfile="$nonopt" |
|---|
| 272 | Â Â suppress_output= |
|---|
| 273 | |
|---|
| 274 | Â Â user_target=no |
|---|
| 275 | Â Â for arg |
|---|
| 276 | Â Â do |
|---|
| 277 | Â Â Â # Accept any command-line options. |
|---|
| 278 | Â Â Â case "$arg" in |
|---|
| 279 | Â Â Â -o) |
|---|
| 280 | Â Â Â Â if test "$user_target" != "no"; then |
|---|
| 281 | Â Â Â Â Â $echo "$modename: you cannot specify \`-o' more than once" 1>&2 |
|---|
| 282 | Â Â Â Â Â exit 1 |
|---|
| 283 | Â Â Â Â fi |
|---|
| 284 | Â Â Â Â user_target=next |
|---|
| 285 | Â Â Â Â ;; |
|---|
| 286 | |
|---|
| 287 | Â Â Â -static) |
|---|
| 288 | Â Â Â Â build_old_libs=yes |
|---|
| 289 | Â Â Â Â continue |
|---|
| 290 | Â Â Â Â ;; |
|---|
| 291 | Â Â Â esac |
|---|
| 292 | |
|---|
| 293 | Â Â Â case "$user_target" in |
|---|
| 294 | Â Â Â next) |
|---|
| 295 | Â Â Â Â # The next one is the -o target name |
|---|
| 296 | Â Â Â Â user_target=yes |
|---|
| 297 | Â Â Â Â continue |
|---|
| 298 | Â Â Â Â ;; |
|---|
| 299 | Â Â Â yes) |
|---|
| 300 | Â Â Â Â # We got the output file |
|---|
| 301 | Â Â Â Â user_target=set |
|---|
| 302 | Â Â Â Â libobj="$arg" |
|---|
| 303 | Â Â Â Â continue |
|---|
| 304 | Â Â Â Â ;; |
|---|
| 305 | Â Â Â esac |
|---|
| 306 | |
|---|
| 307 | Â Â Â # Accept the current argument as the source file. |
|---|
| 308 | Â Â Â lastarg="$srcfile" |
|---|
| 309 | Â Â Â srcfile="$arg" |
|---|
| 310 | |
|---|
| 311 | Â Â Â # Aesthetically quote the previous argument. |
|---|
| 312 | |
|---|
| 313 | Â Â Â # Backslashify any backslashes, double quotes, and dollar signs. |
|---|
| 314 | Â Â Â # These are the only characters that are still specially |
|---|
| 315 | Â Â Â # interpreted inside of double-quoted scrings. |
|---|
| 316 | Â Â Â lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` |
|---|
| 317 | |
|---|
| 318 | Â Â Â # Double-quote args containing other shell metacharacters. |
|---|
| 319 | Â Â Â # Many Bourne shells cannot handle close brackets correctly in scan |
|---|
| 320 | Â Â Â # sets, so we specify it separately. |
|---|
| 321 | Â Â Â case "$lastarg" in |
|---|
| 322 | Â Â Â *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \Â Â Â ]*|*]*) |
|---|
| 323 | Â Â Â Â lastarg="\"$lastarg\"" |
|---|
| 324 | Â Â Â Â ;; |
|---|
| 325 | Â Â Â esac |
|---|
| 326 | |
|---|
| 327 | Â Â Â # Add the previous argument to base_compile. |
|---|
| 328 | Â Â Â if test -z "$base_compile"; then |
|---|
| 329 | Â Â Â Â base_compile="$lastarg" |
|---|
| 330 | Â Â Â else |
|---|
| 331 | Â Â Â Â base_compile="$base_compile $lastarg" |
|---|
| 332 | Â Â Â fi |
|---|
| 333 | Â Â done |
|---|
| 334 | |
|---|
| 335 | Â Â case "$user_target" in |
|---|
| 336 | Â Â set) |
|---|
| 337 | Â Â Â ;; |
|---|
| 338 | Â Â no) |
|---|
| 339 | Â Â Â # Get the name of the library object. |
|---|
| 340 | Â Â Â libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` |
|---|
| 341 | Â Â Â ;; |
|---|
| 342 | Â Â *) |
|---|
| 343 | Â Â Â $echo "$modename: you must specify a target with \`-o'" 1>&2 |
|---|
| 344 | Â Â Â exit 1 |
|---|
| 345 | Â Â Â ;; |
|---|
| 346 | Â Â esac |
|---|
| 347 | |
|---|
| 348 | Â Â # Recognize several different file suffixes. |
|---|
| 349 | Â Â # If the user specifies -o file.o, it is replaced with file.lo |
|---|
| 350 | Â Â xform='[cCFSfmso]' |
|---|
| 351 | Â Â case "$libobj" in |
|---|
| 352 | Â Â *.ada) xform=ada ;; |
|---|
| 353 | Â Â *.adb) xform=adb ;; |
|---|
| 354 | Â Â *.ads) xform=ads ;; |
|---|
| 355 | Â Â *.asm) xform=asm ;; |
|---|
| 356 | Â Â *.c++) xform=c++ ;; |
|---|
| 357 | Â Â *.cc) xform=cc ;; |
|---|
| 358 | Â Â *.cpp) xform=cpp ;; |
|---|
| 359 | Â Â *.cxx) xform=cxx ;; |
|---|
| 360 | Â Â *.f90) xform=f90 ;; |
|---|
| 361 | Â Â *.for) xform=for ;; |
|---|
| 362 | Â Â esac |
|---|
| 363 | |
|---|
| 364 | Â Â libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` |
|---|
| 365 | |
|---|
| 366 | Â Â case "$libobj" in |
|---|
| 367 | Â Â *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; |
|---|
| 368 | Â Â *) |
|---|
| 369 | Â Â Â $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 |
|---|
| 370 | Â Â Â exit 1 |
|---|
| 371 | Â Â Â ;; |
|---|
| 372 | Â Â esac |
|---|
| 373 | |
|---|
| 374 | Â Â if test -z "$base_compile"; then |
|---|
| 375 | Â Â Â $echo "$modename: you must specify a compilation command" 1>&2 |
|---|
| 376 | Â Â Â $echo "$help" 1>&2 |
|---|
| 377 | Â Â Â exit 1 |
|---|
| 378 | Â Â fi |
|---|
| 379 | |
|---|
| 380 | Â Â # Delete any leftover library objects. |
|---|
| 381 | Â Â if test "$build_old_libs" = yes; then |
|---|
| 382 | Â Â Â removelist="$obj $libobj" |
|---|
| 383 | Â Â else |
|---|
| 384 | Â Â Â removelist="$libobj" |
|---|
| 385 | Â Â fi |
|---|
| 386 | |
|---|
| 387 | Â Â $run $rm $removelist |
|---|
| 388 | Â Â trap "$run $rm $removelist; exit 1" 1 2 15 |
|---|
| 389 | |
|---|
| 390 | Â Â # Calculate the filename of the output object if compiler does |
|---|
| 391 | Â Â # not support -o with -c |
|---|
| 392 | Â Â if test "$compiler_c_o" = no; then |
|---|
| 393 | Â Â Â output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\..*$%%'`.${objext} |
|---|
| 394 | Â Â Â lockfile="$output_obj.lock" |
|---|
| 395 | Â Â Â removelist="$removelist $output_obj $lockfile" |
|---|
| 396 | Â Â Â trap "$run $rm $removelist; exit 1" 1 2 15 |
|---|
| 397 | Â Â else |
|---|
| 398 | Â Â Â need_locks=no |
|---|
| 399 | Â Â Â lockfile= |
|---|
| 400 | Â Â fi |
|---|
| 401 | |
|---|
| 402 | Â Â # Lock this critical section if it is needed |
|---|
| 403 | Â Â # We use this script file to make the link, it avoids creating a new file |
|---|
| 404 | Â Â if test "$need_locks" = yes; then |
|---|
| 405 | Â Â Â until ln "$0" "$lockfile" 2>/dev/null; do |
|---|
| 406 | Â Â Â Â $show "Waiting for $lockfile to be removed" |
|---|
| 407 | Â Â Â Â sleep 2 |
|---|
| 408 | Â Â Â done |
|---|
| 409 | Â Â elif test "$need_locks" = warn; then |
|---|
| 410 | Â Â Â if test -f "$lockfile"; then |
|---|
| 411 | Â Â Â Â echo "\ |
|---|
| 412 | *** ERROR, $lockfile exists and contains: |
|---|
| 413 | `cat $lockfile 2>/dev/null` |
|---|
| 414 | |
|---|
| 415 | This indicates that another process is trying to use the same |
|---|
| 416 | temporary object file, and libtool could not work around it because |
|---|
| 417 | your compiler does not support \`-c' and \`-o' together. If you |
|---|
| 418 | repeat this compilation, it may succeed, by chance, but you had better |
|---|
| 419 | avoid parallel builds (make -j) in this platform, or get a better |
|---|
| 420 | compiler." |
|---|
| 421 | |
|---|
| 422 | Â Â Â Â $run $rm $removelist |
|---|
| 423 | Â Â Â Â exit 1 |
|---|
| 424 | Â Â Â fi |
|---|
| 425 | Â Â Â echo $srcfile > "$lockfile" |
|---|
| 426 | Â Â fi |
|---|
| 427 | |
|---|
| 428 | Â Â if test -n "$fix_srcfile_path"; then |
|---|
| 429 | Â Â Â eval srcfile=\"$fix_srcfile_path\" |
|---|
| 430 | Â Â fi |
|---|
| 431 | |
|---|
| 432 | Â Â # Only build a PIC object if we are building libtool libraries. |
|---|
| 433 | Â Â if test "$build_libtool_libs" = yes; then |
|---|
| 434 | Â Â Â # Without this assignment, base_compile gets emptied. |
|---|
| 435 | Â Â Â fbsd_hideous_sh_bug=$base_compile |
|---|
| 436 | |
|---|
| 437 | Â Â Â # All platforms use -DPIC, to notify preprocessed assembler code. |
|---|
| 438 | Â Â Â command="$base_compile $srcfile $pic_flag -DPIC" |
|---|
| 439 | Â Â Â if test "$build_old_libs" = yes; then |
|---|
| 440 | Â Â Â Â lo_libobj="$libobj" |
|---|
| 441 | Â Â Â Â dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` |
|---|
| 442 | Â Â Â Â if test "X$dir" = "X$libobj"; then |
|---|
| 443 | Â Â Â Â Â dir="$objdir" |
|---|
| 444 | Â Â Â Â else |
|---|
| 445 | Â Â Â Â Â dir="$dir/$objdir" |
|---|
| 446 | Â Â Â Â fi |
|---|
| 447 | Â Â Â Â libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'` |
|---|
| 448 | |
|---|
| 449 | Â Â Â Â if test -d "$dir"; then |
|---|
| 450 | Â Â Â Â Â $show "$rm $libobj" |
|---|
| 451 | Â Â Â Â Â $run $rm $libobj |
|---|
| 452 | Â Â Â Â else |
|---|
| 453 | Â Â Â Â Â $show "$mkdir $dir" |
|---|
| 454 | Â Â Â Â Â $run $mkdir $dir |
|---|
| 455 | Â Â Â Â Â status=$? |
|---|
| 456 | Â Â Â Â Â if test $status -ne 0 && test ! -d $dir; then |
|---|
| 457 | Â Â Â Â Â Â exit $status |
|---|
| 458 | Â Â Â Â Â fi |
|---|
| 459 | Â Â Â Â fi |
|---|
| 460 | Â Â Â fi |
|---|
| 461 | Â Â Â if test "$compiler_o_lo" = yes; then |
|---|
| 462 | Â Â Â Â output_obj="$libobj" |
|---|
| 463 | Â Â Â Â command="$command -o $output_obj" |
|---|
| 464 | Â Â Â elif test "$compiler_c_o" = yes; then |
|---|
| 465 | Â Â Â Â output_obj="$obj" |
|---|
| 466 | Â Â Â Â command="$command -o $output_obj" |
|---|
| 467 | Â Â Â fi |
|---|
| 468 | |
|---|
| 469 | Â Â Â $run $rm "$output_obj" |
|---|
| 470 | Â Â Â $show "$command" |
|---|
| 471 | Â Â Â if $run eval "$command"; then : |
|---|
| 472 | Â Â Â else |
|---|
| 473 | Â Â Â Â test -n "$output_obj" && $run $rm $removelist |
|---|
| 474 | Â Â Â Â exit 1 |
|---|
| 475 | Â Â Â fi |
|---|
| 476 | |
|---|
| 477 | Â Â Â if test "$need_locks" = warn && |
|---|
| 478 | Â Â Â Â Â test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then |
|---|
| 479 | Â Â Â Â echo "\ |
|---|
| 480 | *** ERROR, $lockfile contains: |
|---|
| 481 | `cat $lockfile 2>/dev/null` |
|---|
| 482 | |
|---|
| 483 | but it should contain: |
|---|
| 484 | $srcfile |
|---|
| 485 | |
|---|
| 486 | This indicates that another process is trying to use the same |
|---|
| 487 | temporary object file, and libtool could not work around it because |
|---|
| 488 | your compiler does not support \`-c' and \`-o' together. If you |
|---|
| 489 | repeat this compilation, it may succeed, by chance, but you had better |
|---|
| 490 | avoid parallel builds (make -j) in this platform, or get a better |
|---|
| 491 | compiler." |
|---|
| 492 | |
|---|
| 493 | Â Â Â Â $run $rm $removelist |
|---|
| 494 | Â Â Â Â exit 1 |
|---|
| 495 | Â Â Â fi |
|---|
| 496 | |
|---|
| 497 | Â Â Â # Just move the object if needed, then go on to compile the next one |
|---|
| 498 | Â Â Â if test x"$output_obj" != x"$libobj"; then |
|---|
| 499 | Â Â Â Â $show "$mv $output_obj $libobj" |
|---|
| 500 | Â Â Â Â if $run $mv $output_obj $libobj; then : |
|---|
| 501 | Â Â Â Â else |
|---|
| 502 | Â Â Â Â Â error=$? |
|---|
| 503 | Â Â Â Â Â $run $rm $removelist |
|---|
| 504 | Â Â Â Â Â exit $error |
|---|
| 505 | Â Â Â Â fi |
|---|
| 506 | Â Â Â fi |
|---|
| 507 | |
|---|
| 508 | Â Â Â # If we have no pic_flag, then copy the object into place and finish. |
|---|
| 509 | Â Â Â if test -z "$pic_flag" && test "$build_old_libs" = yes; then |
|---|
| 510 | Â Â Â Â # Rename the .lo from within objdir to obj |
|---|
| 511 | Â Â Â Â if test -f $obj; then |
|---|
| 512 | Â Â Â Â Â $show $rm $obj |
|---|
| 513 | Â Â Â Â Â $run $rm $obj |
|---|
| 514 | Â Â Â Â fi |
|---|
| 515 | |
|---|
| 516 | Â Â Â Â $show "$mv $libobj $obj" |
|---|
| 517 | Â Â Â Â if $run $mv $libobj $obj; then : |
|---|
| 518 | Â Â Â Â else |
|---|
| 519 | Â Â Â Â Â error=$? |
|---|
| 520 | Â Â Â Â Â $run $rm $removelist |
|---|
| 521 | Â Â Â Â Â exit $error |
|---|
| 522 | Â Â Â Â fi |
|---|
| 523 | |
|---|
| 524 | Â Â Â Â xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` |
|---|
| 525 | Â Â Â Â if test "X$xdir" = "X$obj"; then |
|---|
| 526 | Â Â Â Â Â xdir="." |
|---|
| 527 | Â Â Â Â else |
|---|
| 528 | Â Â Â Â Â xdir="$xdir" |
|---|
| 529 | Â Â Â Â fi |
|---|
| 530 | Â Â Â Â baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"` |
|---|
| 531 | Â Â Â Â libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"` |
|---|
| 532 | Â Â Â Â # Now arrange that obj and lo_libobj become the same file |
|---|
| 533 | Â Â Â Â $show "(cd $xdir && $LN_S $baseobj $libobj)" |
|---|
| 534 | Â Â Â Â if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then |
|---|
| 535 | Â Â Â Â Â exit 0 |
|---|
| 536 | Â Â Â Â else |
|---|
| 537 | Â Â Â Â Â error=$? |
|---|
| 538 | Â Â Â Â Â $run $rm $removelist |
|---|
| 539 | Â Â Â Â Â exit $error |
|---|
| 540 | Â Â Â Â fi |
|---|
| 541 | Â Â Â fi |
|---|
| 542 | |
|---|
| 543 | Â Â Â # Allow error messages only from the first compilation. |
|---|
| 544 | Â Â Â suppress_output=' >/dev/null 2>&1' |
|---|
| 545 | Â Â fi |
|---|
| 546 | |
|---|
| 547 | Â Â # Only build a position-dependent object if we build old libraries. |
|---|
| 548 | Â Â if test "$build_old_libs" = yes; then |
|---|
| 549 | Â Â Â command="$base_compile $srcfile" |
|---|
| 550 | Â Â Â if test "$compiler_c_o" = yes; then |
|---|
| 551 | Â Â Â Â command="$command -o $obj" |
|---|
| 552 | Â Â Â Â output_obj="$obj" |
|---|
| 553 | Â Â Â fi |
|---|
| 554 | |
|---|
| 555 | Â Â Â # Suppress compiler output if we already did a PIC compilation. |
|---|
| 556 | Â Â Â command="$command$suppress_output" |
|---|
| 557 | Â Â Â $run $rm "$output_obj" |
|---|
| 558 | Â Â Â $show "$command" |
|---|
| 559 | Â Â Â if $run eval "$command"; then : |
|---|
| 560 | Â Â Â else |
|---|
| 561 | Â Â Â Â $run $rm $removelist |
|---|
| 562 | Â Â Â Â exit 1 |
|---|
| 563 | Â Â Â fi |
|---|
| 564 | |
|---|
| 565 | Â Â Â if test "$need_locks" = warn && |
|---|
| 566 | Â Â Â Â Â test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then |
|---|
| 567 | Â Â Â Â echo "\ |
|---|
| 568 | *** ERROR, $lockfile contains: |
|---|
| 569 | `cat $lockfile 2>/dev/null` |
|---|
| 570 | |
|---|
| 571 | but it should contain: |
|---|
| 572 | $srcfile |
|---|
| 573 | |
|---|
| 574 | This indicates that another process is trying to use the same |
|---|
| 575 | temporary object file, and libtool could not work around it because |
|---|
| 576 | your compiler does not support \`-c' and \`-o' together. If you |
|---|
| 577 | repeat this compilation, it may succeed, by chance, but you had better |
|---|
| 578 | avoid parallel builds (make -j) in this platform, or get a better |
|---|
| 579 | compiler." |
|---|
| 580 | |
|---|
| 581 | Â Â Â Â $run $rm $removelist |
|---|
| 582 | Â Â Â Â exit 1 |
|---|
| 583 | Â Â Â fi |
|---|
| 584 | |
|---|
| 585 | Â Â Â # Just move the object if needed |
|---|
| 586 | Â Â Â if test x"$output_obj" != x"$obj"; then |
|---|
| 587 | Â Â Â Â $show "$mv $output_obj $obj" |
|---|
| 588 | Â Â Â Â if $run $mv $output_obj $obj; then : |
|---|
| 589 | Â Â Â Â else |
|---|
| 590 | Â Â Â Â Â error=$? |
|---|
| 591 | Â Â Â Â Â $run $rm $removelist |
|---|
| 592 | Â Â Â Â Â exit $error |
|---|
| 593 | Â Â Â Â fi |
|---|
| 594 | Â Â Â fi |
|---|
| 595 | |
|---|
| 596 | Â Â Â # Create an invalid libtool object if no PIC, so that we do not |
|---|
| 597 | Â Â Â # accidentally link it into a program. |
|---|
| 598 | Â Â Â if test "$build_libtool_libs" != yes; then |
|---|
| 599 | Â Â Â Â $show "echo timestamp > $libobj" |
|---|
| 600 | Â Â Â Â $run eval "echo timestamp > \$libobj" || exit $? |
|---|
| 601 | Â Â Â else |
|---|
| 602 | Â Â Â Â # Move the .lo from within objdir |
|---|
| 603 | Â Â Â Â $show "$mv $libobj $lo_libobj" |
|---|
| 604 | Â Â Â Â if $run $mv $libobj $lo_libobj; then : |
|---|
| 605 | Â Â Â Â else |
|---|
| 606 | Â Â Â Â Â error=$? |
|---|
| 607 | Â Â Â Â Â $run $rm $removelist |
|---|
| 608 | Â Â Â Â Â exit $error |
|---|
| 609 | Â Â Â Â fi |
|---|
| 610 | Â Â Â fi |
|---|
| 611 | Â Â fi |
|---|
| 612 | |
|---|
| 613 | Â Â # Unlock the critical section if it was locked |
|---|
| 614 | Â Â if test "$need_locks" != no; then |
|---|
| 615 | Â Â Â $rm "$lockfile" |
|---|
| 616 | Â Â fi |
|---|
| 617 | |
|---|
| 618 | Â Â exit 0 |
|---|
| 619 | Â Â ;; |
|---|
| 620 | |
|---|
| 621 | Â # libtool link mode |
|---|
| 622 | Â link) |
|---|
| 623 | Â Â modename="$modename: link" |
|---|
| 624 | Â Â case "$host" in |
|---|
| 625 | Â Â *-*-cygwin* | *-*-mingw* | *-*-os2*) |
|---|
| 626 | Â Â Â # It is impossible to link a dll without this setting, and |
|---|
| 627 | Â Â Â # we shouldn't force the makefile maintainer to figure out |
|---|
| 628 | Â Â Â # which system we are compiling for in order to pass an extra |
|---|
| 629 | Â Â Â # flag for every libtool invokation. |
|---|
| 630 | Â Â Â # allow_undefined=no |
|---|
| 631 | |
|---|
| 632 | Â Â Â # FIXME: Unfortunately, there are problems with the above when trying |
|---|
| 633 | Â Â Â # to make a dll which has undefined symbols, in which case not |
|---|
| 634 |    # even a static library is built. For now, we need to specify |
|---|
| 635 | Â Â Â # -no-undefined on the libtool link line when we can be certain |
|---|
| 636 | Â Â Â # that all symbols are satisfied, otherwise we get a static library. |
|---|
| 637 | Â Â Â allow_undefined=yes |
|---|
| 638 | |
|---|
| 639 | Â Â Â # This is a source program that is used to create dlls on Windows |
|---|
| 640 | Â Â Â # Don't remove nor modify the starting and closing comments |
|---|
| 641 | # /* ltdll.c starts here */ |
|---|
| 642 | # #define WIN32_LEAN_AND_MEAN |
|---|
| 643 | # #include <windows.h> |
|---|
| 644 | # #undef WIN32_LEAN_AND_MEAN |
|---|
| 645 | # #include <stdio.h> |
|---|
| 646 | # |
|---|
| 647 | # #ifndef __CYGWIN__ |
|---|
| 648 | # #Â ifdef __CYGWIN32__ |
|---|
| 649 | # #Â Â define __CYGWIN__ __CYGWIN32__ |
|---|
| 650 | # #Â endif |
|---|
| 651 | # #endif |
|---|
| 652 | # |
|---|
| 653 | # #ifdef __cplusplus |
|---|
| 654 | # extern "C" { |
|---|
| 655 | # #endif |
|---|
| 656 | # BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); |
|---|
| 657 | # #ifdef __cplusplus |
|---|
| 658 | # } |
|---|
| 659 | # #endif |
|---|
| 660 | # |
|---|
| 661 | # #ifdef __CYGWIN__ |
|---|
| 662 | # #include <cygwin/cygwin_dll.h> |
|---|
| 663 | # DECLARE_CYGWIN_DLL( DllMain ); |
|---|
| 664 | # #endif |
|---|
| 665 | # HINSTANCE __hDllInstance_base; |
|---|
| 666 | # |
|---|
| 667 | # BOOL APIENTRY |
|---|
| 668 | # DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) |
|---|
| 669 | # { |
|---|
| 670 | #Â Â __hDllInstance_base = hInst; |
|---|
| 671 | #Â Â return TRUE; |
|---|
| 672 | # } |
|---|
| 673 | # /* ltdll.c ends here */ |
|---|
| 674 | Â Â Â # This is a source program that is used to create import libraries |
|---|
| 675 | Â Â Â # on Windows for dlls which lack them. Don't remove nor modify the |
|---|
| 676 | Â Â Â # starting and closing comments |
|---|
| 677 | # /* impgen.c starts here */ |
|---|
| 678 | # /*Â Â Copyright (C) 1999 Free Software Foundation, Inc. |
|---|
| 679 | # |
|---|
| 680 | #Â This file is part of GNU libtool. |
|---|
| 681 | # |
|---|
| 682 | #Â This program is free software; you can redistribute it and/or modify |
|---|
| 683 | #Â it under the terms of the GNU General Public License as published by |
|---|
| 684 | #Â the Free Software Foundation; either version 2 of the License, or |
|---|
| 685 | #Â (at your option) any later version. |
|---|
| 686 | # |
|---|
| 687 | #Â This program is distributed in the hope that it will be useful, |
|---|
| 688 | #Â but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 689 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 690 | #Â GNU General Public License for more details. |
|---|
| 691 | # |
|---|
| 692 | #Â You should have received a copy of the GNU General Public License |
|---|
| 693 | #Â along with this program; if not, write to the Free Software |
|---|
| 694 | #Â Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|---|
| 695 | #Â */ |
|---|
| 696 | # |
|---|
| 697 | #Â #include <stdio.h>Â Â Â Â Â Â /* for printf() */ |
|---|
| 698 | #Â #include <unistd.h>Â Â Â Â Â /* for open(), lseek(), read() */ |
|---|
| 699 | #Â #include <fcntl.h>Â Â Â Â Â Â /* for O_RDONLY, O_BINARY */ |
|---|
| 700 | #Â #include <string.h>Â Â Â Â Â /* for strdup() */ |
|---|
| 701 | # |
|---|
| 702 | #Â static unsigned int |
|---|
| 703 | #Â pe_get16 (fd, offset) |
|---|
| 704 | #Â Â Â Â int fd; |
|---|
| 705 | #Â Â Â Â int offset; |
|---|
| 706 | #Â { |
|---|
| 707 | #Â Â unsigned char b[2]; |
|---|
| 708 | #Â Â lseek (fd, offset, SEEK_SET); |
|---|
| 709 | #Â Â read (fd, b, 2); |
|---|
| 710 | #Â Â return b[0] + (b[1]<<8); |
|---|
| 711 | #Â } |
|---|
| 712 | # |
|---|
| 713 | #Â static unsigned int |
|---|
| 714 | #Â pe_get32 (fd, offset) |
|---|
| 715 | #Â Â Â int fd; |
|---|
| 716 | #Â Â Â int offset; |
|---|
| 717 | #Â { |
|---|
| 718 | #Â Â unsigned char b[4]; |
|---|
| 719 | #Â Â lseek (fd, offset, SEEK_SET); |
|---|
| 720 | #Â Â read (fd, b, 4); |
|---|
| 721 | #Â Â return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); |
|---|
| 722 | #Â } |
|---|
| 723 | # |
|---|
| 724 | #Â static unsigned int |
|---|
| 725 | #Â pe_as32 (ptr) |
|---|
| 726 | #Â Â Â Â void *ptr; |
|---|
| 727 | #Â { |
|---|
| 728 | #Â Â unsigned char *b = ptr; |
|---|
| 729 | #Â Â return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); |
|---|
| 730 | #Â } |
|---|
| 731 | # |
|---|
| 732 | #Â int |
|---|
| 733 | #Â main (argc, argv) |
|---|
| 734 | #Â Â Â int argc; |
|---|
| 735 | #Â Â Â char *argv[]; |
|---|
| 736 | #Â { |
|---|
| 737 | #Â Â Â int dll; |
|---|
| 738 | #Â Â Â unsigned long pe_header_offset, opthdr_ofs, num_entries, i; |
|---|
| 739 | #Â Â Â unsigned long export_rva, export_size, nsections, secptr, expptr; |
|---|
| 740 | #Â Â Â unsigned long name_rvas, nexp; |
|---|
| 741 | #Â Â Â unsigned char *expdata, *erva; |
|---|
| 742 | #Â Â Â char *filename, *dll_name; |
|---|
| 743 | # |
|---|
| 744 | #Â Â Â filename = argv[1]; |
|---|
| 745 | # |
|---|
| 746 | #Â Â Â dll = open(filename, O_RDONLY|O_BINARY); |
|---|
| 747 | #Â Â Â if (!dll) |
|---|
| 748 | #Â Â Â Â return 1; |
|---|
| 749 | # |
|---|
| 750 | #Â Â Â dll_name = filename; |
|---|
| 751 | #Â Â |
|---|
| 752 | #Â Â Â for (i=0; filename[i]; i++) |
|---|
| 753 | #Â Â Â Â if (filename[i] == '/' || filename[i] == '\\'Â || filename[i] == ':') |
|---|
| 754 | #Â Â Â Â Â Â dll_name = filename + i +1; |
|---|
| 755 | # |
|---|
| 756 | #Â Â Â pe_header_offset = pe_get32 (dll, 0x3c); |
|---|
| 757 | #Â Â Â opthdr_ofs = pe_header_offset + 4 + 20; |
|---|
| 758 | #Â Â Â num_entries = pe_get32 (dll, opthdr_ofs + 92); |
|---|
| 759 | # |
|---|
| 760 | #Â Â Â if (num_entries < 1) /* no exports */ |
|---|
| 761 | #Â Â Â Â return 1; |
|---|
| 762 | # |
|---|
| 763 | #Â Â Â export_rva = pe_get32 (dll, opthdr_ofs + 96); |
|---|
| 764 | #Â Â Â export_size = pe_get32 (dll, opthdr_ofs + 100); |
|---|
| 765 | #Â Â Â nsections = pe_get16 (dll, pe_header_offset + 4 +2); |
|---|
| 766 | #Â Â Â secptr = (pe_header_offset + 4 + 20 + |
|---|
| 767 | #Â Â Â Â Â Â Â pe_get16 (dll, pe_header_offset + 4 + 16)); |
|---|
| 768 | # |
|---|
| 769 | #Â Â Â expptr = 0; |
|---|
| 770 | #Â Â Â for (i = 0; i < nsections; i++) |
|---|
| 771 | #Â Â Â { |
|---|
| 772 | #Â Â Â Â char sname[8]; |
|---|
| 773 | #Â Â Â Â unsigned long secptr1 = secptr + 40 * i; |
|---|
| 774 | #Â Â Â Â unsigned long vaddr = pe_get32 (dll, secptr1 + 12); |
|---|
| 775 | #Â Â Â Â unsigned long vsize = pe_get32 (dll, secptr1 + 16); |
|---|
| 776 | #Â Â Â Â unsigned long fptr = pe_get32 (dll, secptr1 + 20); |
|---|
| 777 | #Â Â Â Â lseek(dll, secptr1, SEEK_SET); |
|---|
| 778 | #Â Â Â Â read(dll, sname, 8); |
|---|
| 779 | #Â Â Â Â if (vaddr <= export_rva && vaddr+vsize > export_rva) |
|---|
| 780 | #Â Â Â Â { |
|---|
| 781 | #Â Â Â Â Â Â expptr = fptr + (export_rva - vaddr); |
|---|
| 782 | #Â Â Â Â Â Â if (export_rva + export_size > vaddr + vsize) |
|---|
| 783 | #Â Â Â Â Â Â Â Â export_size = vsize - (export_rva - vaddr); |
|---|
| 784 | #Â Â Â Â Â Â break; |
|---|
| 785 | #Â Â Â Â } |
|---|
| 786 | #Â Â Â } |
|---|
| 787 | # |
|---|
| 788 | #Â Â Â expdata = (unsigned char*)malloc(export_size); |
|---|
| 789 | #Â Â Â lseek (dll, expptr, SEEK_SET); |
|---|
| 790 | #Â Â Â read (dll, expdata, export_size); |
|---|
| 791 | #Â Â Â erva = expdata - export_rva; |
|---|
| 792 | # |
|---|
| 793 | #Â Â Â nexp = pe_as32 (expdata+24); |
|---|
| 794 | #Â Â Â name_rvas = pe_as32 (expdata+32); |
|---|
| 795 | # |
|---|
| 796 | #Â Â Â printf ("EXPORTS\n"); |
|---|
| 797 | #Â Â Â for (i = 0; i<nexp; i++) |
|---|
| 798 | #Â Â Â { |
|---|
| 799 | #Â Â Â Â unsigned long name_rva = pe_as32 (erva+name_rvas+i*4); |
|---|
| 800 | #Â Â Â Â printf ("\t%s @ %ld ;\n", erva+name_rva, 1+ i); |
|---|
| 801 | #Â Â Â } |
|---|
| 802 | # |
|---|
| 803 | #Â Â Â return 0; |
|---|
| 804 | #Â } |
|---|
| 805 | # /* impgen.c ends here */ |
|---|
| 806 | Â Â Â ;; |
|---|
| 807 | Â Â *) |
|---|
| 808 | Â Â Â allow_undefined=yes |
|---|
| 809 | Â Â Â ;; |
|---|
| 810 | Â Â esac |
|---|
| 811 | Â Â compile_command="$nonopt" |
|---|
| 812 | Â Â finalize_command="$nonopt" |
|---|
| 813 | |
|---|
| 814 | Â Â compile_rpath= |
|---|
| 815 | Â Â finalize_rpath= |
|---|
| 816 | Â Â compile_shlibpath= |
|---|
| 817 | Â Â finalize_shlibpath= |
|---|
| 818 | Â Â convenience= |
|---|
| 819 | Â Â old_convenience= |
|---|
| 820 | Â Â deplibs= |
|---|
| 821 | Â Â linkopts= |
|---|
| 822 | |
|---|
| 823 | Â Â if test -n "$shlibpath_var"; then |
|---|
| 824 | Â Â Â # get the directories listed in $shlibpath_var |
|---|
| 825 | Â Â Â eval lib_search_path=\`\$echo \"X \${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` |
|---|
| 826 | Â Â else |
|---|
| 827 | Â Â Â lib_search_path= |
|---|
| 828 | Â Â fi |
|---|
| 829 | Â Â # now prepend the system-specific ones |
|---|
| 830 | Â Â eval lib_search_path=\"$sys_lib_search_path_spec\$lib_search_path\" |
|---|
| 831 | Â Â eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" |
|---|
| 832 | Â Â |
|---|
| 833 | Â Â avoid_version=no |
|---|
| 834 | Â Â dlfiles= |
|---|
| 835 | Â Â dlprefiles= |
|---|
| 836 | Â Â dlself=no |
|---|
| 837 | Â Â export_dynamic=no |
|---|
| 838 | Â Â export_symbols= |
|---|
| 839 | Â Â export_symbols_regex= |
|---|
| 840 | Â Â generated= |
|---|
| 841 | Â Â libobjs= |
|---|
| 842 | Â Â link_against_libtool_libs= |
|---|
| 843 | Â Â ltlibs= |
|---|
| 844 | Â Â module=no |
|---|
| 845 | Â Â objs= |
|---|
| 846 | Â Â prefer_static_libs=no |
|---|
| 847 | Â Â preload=no |
|---|
| 848 | Â Â prev= |
|---|
| 849 | Â Â prevarg= |
|---|
| 850 | Â Â release= |
|---|
| 851 | Â Â rpath= |
|---|
| 852 | Â Â xrpath= |
|---|
| 853 | Â Â perm_rpath= |
|---|
| 854 | Â Â temp_rpath= |
|---|
| 855 | Â Â thread_safe=no |
|---|
| 856 | Â Â vinfo= |
|---|
| 857 | |
|---|
| 858 | Â Â # We need to know -static, to get the right output filenames. |
|---|
| 859 | Â Â for arg |
|---|
| 860 | Â Â do |
|---|
| 861 | Â Â Â case "$arg" in |
|---|
| 862 | Â Â Â -all-static | -static) |
|---|
| 863 | Â Â Â Â if test "X$arg" = "X-all-static"; then |
|---|
| 864 | Â Â Â Â Â if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then |
|---|
| 865 | Â Â Â Â Â Â $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2 |
|---|
| 866 | Â Â Â Â Â fi |
|---|
| 867 | Â Â Â Â Â if test -n "$link_static_flag"; then |
|---|
| 868 | Â Â Â Â Â Â dlopen_self=$dlopen_self_static |
|---|
| 869 | Â Â Â Â Â fi |
|---|
| 870 | Â Â Â Â else |
|---|
| 871 | Â Â Â Â Â if test -z "$pic_flag" && test -n "$link_static_flag"; then |
|---|
| 872 | Â Â Â Â Â Â dlopen_self=$dlopen_self_static |
|---|
| 873 | Â Â Â Â Â fi |
|---|
| 874 | Â Â Â Â fi |
|---|
| 875 | Â Â Â Â build_libtool_libs=no |
|---|
| 876 | Â Â Â Â build_old_libs=yes |
|---|
| 877 | Â Â Â Â prefer_static_libs=yes |
|---|
| 878 | Â Â Â Â break |
|---|
| 879 | Â Â Â Â ;; |
|---|
| 880 | Â Â Â esac |
|---|
| 881 | Â Â done |
|---|
| 882 | |
|---|
| 883 | Â Â # See if our shared archives depend on static archives. |
|---|
| 884 | Â Â test -n "$old_archive_from_new_cmds" && build_old_libs=yes |
|---|
| 885 | |
|---|
| 886 | Â Â # Go through the arguments, transforming them on the way. |
|---|
| 887 | Â Â while test $# -gt 0; do |
|---|
| 888 | Â Â Â arg="$1" |
|---|
| 889 | Â Â Â shift |
|---|
| 890 | |
|---|
| 891 | Â Â Â # If the previous option needs an argument, assign it. |
|---|
| 892 | Â Â Â if test -n "$prev"; then |
|---|
| 893 | Â Â Â Â case "$prev" in |
|---|
| 894 | Â Â Â Â output) |
|---|
| 895 | Â Â Â Â Â compile_command="$compile_command @OUTPUT@" |
|---|
| 896 | Â Â Â Â Â finalize_command="$finalize_command @OUTPUT@" |
|---|
| 897 | Â Â Â Â Â ;; |
|---|
| 898 | Â Â Â Â esac |
|---|
| 899 | |
|---|
| 900 | Â Â Â Â case "$prev" in |
|---|
| 901 | Â Â Â Â dlfiles|dlprefiles) |
|---|
| 902 | Â Â Â Â Â if test "$preload" = no; then |
|---|
| 903 | Â Â Â Â Â Â # Add the symbol object into the linking commands. |
|---|
| 904 | Â Â Â Â Â Â compile_command="$compile_command @SYMFILE@" |
|---|
| 905 | Â Â Â Â Â Â finalize_command="$finalize_command @SYMFILE@" |
|---|
| 906 | Â Â Â Â Â Â preload=yes |
|---|
| 907 | Â Â Â Â Â fi |
|---|
| 908 | Â Â Â Â Â case "$arg" in |
|---|
| 909 | Â Â Â Â Â *.la | *.lo) ;;Â # We handle these cases below. |
|---|
| 910 | Â Â Â Â Â force) |
|---|
| 911 | Â Â Â Â Â Â if test "$dlself" = no; then |
|---|
| 912 | Â Â Â Â Â Â Â dlself=needless |
|---|
| 913 | Â Â Â Â Â Â Â export_dynamic=yes |
|---|
| 914 | Â Â Â Â Â Â fi |
|---|
| 915 | Â Â Â Â Â Â prev= |
|---|
| 916 | Â Â Â Â Â Â continue |
|---|
| 917 | Â Â Â Â Â Â ;; |
|---|
| 918 | Â Â Â Â Â self) |
|---|
| 919 | Â Â Â Â Â Â if test "$prev" = dlprefiles; then |
|---|
| 920 | Â Â Â Â Â Â Â dlself=yes |
|---|
| 921 | Â Â Â Â Â Â elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then |
|---|
| 922 | Â Â Â Â Â Â Â dlself=yes |
|---|
| 923 | Â Â Â Â Â Â else |
|---|
| 924 | Â Â Â Â Â Â Â dlself=needless |
|---|
| 925 | Â Â Â Â Â Â Â export_dynamic=yes |
|---|
| 926 | Â Â Â Â Â Â fi |
|---|
| 927 | Â Â Â Â Â Â prev= |
|---|
| 928 | Â Â Â Â Â Â continue |
|---|
| 929 | Â Â Â Â Â Â ;; |
|---|
| 930 | Â Â Â Â Â *) |
|---|
| 931 | Â Â Â Â Â Â if test "$prev" = dlfiles; then |
|---|
| 932 | Â Â Â Â Â Â Â dlfiles="$dlfiles $arg" |
|---|
| 933 | Â Â Â Â Â Â else |
|---|
| 934 | Â Â Â Â Â Â Â dlprefiles="$dlprefiles $arg" |
|---|
| 935 | Â Â Â Â Â Â fi |
|---|
| 936 | Â Â Â Â Â Â prev= |
|---|
| 937 | Â Â Â Â Â Â ;; |
|---|
| 938 | Â Â Â Â Â esac |
|---|
| 939 | Â Â Â Â Â ;; |
|---|
| 940 | Â Â Â Â expsyms) |
|---|
| 941 | Â Â Â Â Â export_symbols="$arg" |
|---|
| 942 | Â Â Â Â Â if test ! -f "$arg"; then |
|---|
| 943 | Â Â Â Â Â Â $echo "$modename: symbol file \`$arg' does not exist" |
|---|
| 944 | Â Â Â Â Â Â exit 1 |
|---|
| 945 | Â Â Â Â Â fi |
|---|
| 946 | Â Â Â Â Â prev= |
|---|
| 947 | Â Â Â Â Â continue |
|---|
| 948 | Â Â Â Â Â ;; |
|---|
| 949 | Â Â Â Â expsyms_regex) |
|---|
| 950 | Â Â Â Â Â export_symbols_regex="$arg" |
|---|
| 951 | Â Â Â Â Â prev= |
|---|
| 952 | Â Â Â Â Â continue |
|---|
| 953 | Â Â Â Â Â ;; |
|---|
| 954 | Â Â Â Â release) |
|---|
| 955 | Â Â Â Â Â release="-$arg" |
|---|
| 956 | Â Â Â Â Â prev= |
|---|
| 957 | Â Â Â Â Â continue |
|---|
| 958 | Â Â Â Â Â ;; |
|---|
| 959 | Â Â Â Â rpath | xrpath) |
|---|
| 960 | Â Â Â Â Â # We need an absolute path. |
|---|
| 961 | Â Â Â Â Â case "$arg" in |
|---|
| 962 | Â Â Â Â Â [\\/]* | [A-Za-z]:[\\/]*) ;; |
|---|
| 963 | Â Â Â Â Â *) |
|---|
| 964 | Â Â Â Â Â Â $echo "$modename: only absolute run-paths are allowed" 1>&2 |
|---|
| 965 | Â Â Â Â Â Â exit 1 |
|---|
| 966 | Â Â Â Â Â Â ;; |
|---|
| 967 | Â Â Â Â Â esac |
|---|
| 968 | Â Â Â Â Â if test "$prev" = rpath; then |
|---|
| 969 | Â Â Â Â Â Â case "$rpath " in |
|---|
| 970 | Â Â Â Â Â Â *" $arg "*) ;; |
|---|
| 971 | Â Â Â Â Â Â *) rpath="$rpath $arg" ;; |
|---|
| 972 | Â Â Â Â Â Â esac |
|---|
| 973 | Â Â Â Â Â else |
|---|
| 974 | Â Â Â Â Â Â case "$xrpath " in |
|---|
| 975 | Â Â Â Â Â Â *" $arg "*) ;; |
|---|
| 976 | Â Â Â Â Â Â *) xrpath="$xrpath $arg" ;; |
|---|
| 977 | Â Â Â Â Â Â esac |
|---|
| 978 | Â Â Â Â Â fi |
|---|
| 979 | Â Â Â Â Â prev= |
|---|
| 980 | Â Â Â Â Â continue |
|---|
| 981 | Â Â Â Â Â ;; |
|---|
| 982 | Â Â Â Â *) |
|---|
| 983 | Â Â Â Â Â eval "$prev=\"\$arg\"" |
|---|
| 984 | Â Â Â Â Â prev= |
|---|
| 985 | Â Â Â Â Â continue |
|---|
| 986 | Â Â Â Â Â ;; |
|---|
| 987 | Â Â Â Â esac |
|---|
| 988 | Â Â Â fi |
|---|
| 989 | |
|---|
| 990 | Â Â Â prevarg="$arg" |
|---|
| 991 | |
|---|
| 992 | Â Â Â case "$arg" in |
|---|
| 993 | Â Â Â -all-static) |
|---|
| 994 | Â Â Â Â if test -n "$link_static_flag"; then |
|---|
| 995 | Â Â Â Â Â compile_command="$compile_command $link_static_flag" |
|---|
| 996 | Â Â Â Â Â finalize_command="$finalize_command $link_static_flag" |
|---|
| 997 | Â Â Â Â fi |
|---|
| 998 | Â Â Â Â continue |
|---|
| 999 | Â Â Â Â ;; |
|---|
| 1000 | |
|---|
| 1001 | Â Â Â -allow-undefined) |
|---|
| 1002 | Â Â Â Â # FIXME: remove this flag sometime in the future. |
|---|
| 1003 | Â Â Â Â $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 |
|---|
| 1004 | Â Â Â Â continue |
|---|
| 1005 | Â Â Â Â ;; |
|---|
| 1006 | |
|---|
| 1007 | Â Â Â -avoid-version) |
|---|
| 1008 | Â Â Â Â avoid_version=yes |
|---|
| 1009 | Â Â Â Â continue |
|---|
| 1010 | Â Â Â Â ;; |
|---|
| 1011 | |
|---|
| 1012 | Â Â Â -dlopen) |
|---|
| 1013 | Â Â Â Â prev=dlfiles |
|---|
| 1014 | Â Â Â Â continue |
|---|
| 1015 | Â Â Â Â ;; |
|---|
| 1016 | |
|---|
| 1017 | Â Â Â -dlpreopen) |
|---|
| 1018 | Â Â Â Â prev=dlprefiles |
|---|
| 1019 | Â Â Â Â continue |
|---|
| 1020 | Â Â Â Â ;; |
|---|
| 1021 | |
|---|
| 1022 | Â Â Â -export-dynamic) |
|---|
| 1023 | Â Â Â Â export_dynamic=yes |
|---|
| 1024 | Â Â Â Â continue |
|---|
| 1025 | Â Â Â Â ;; |
|---|
| 1026 | |
|---|
| 1027 | Â Â Â -export-symbols | -export-symbols-regex) |
|---|
| 1028 | Â Â Â Â if test -n "$export_symbols" || test -n "$export_symbols_regex"; then |
|---|
| 1029 | Â Â Â Â Â $echo "$modename: not more than one -exported-symbols argument allowed" |
|---|
| 1030 | Â Â Â Â Â exit 1 |
|---|
| 1031 | Â Â Â Â fi |
|---|
| 1032 | Â Â Â Â if test "X$arg" = "X-export-symbols"; then |
|---|
| 1033 | Â Â Â Â Â prev=expsyms |
|---|
| 1034 | Â Â Â Â else |
|---|
| 1035 | Â Â Â Â Â prev=expsyms_regex |
|---|
| 1036 | Â Â Â Â fi |
|---|
| 1037 | Â Â Â Â continue |
|---|
| 1038 | Â Â Â Â ;; |
|---|
| 1039 | |
|---|
| 1040 | Â Â Â -L*) |
|---|
| 1041 | Â Â Â Â dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` |
|---|
| 1042 | Â Â Â Â # We need an absolute path. |
|---|
| 1043 | Â Â Â Â case "$dir" in |
|---|
| 1044 | Â Â Â Â [\\/]* | [A-Za-z]:[\\/]*) ;; |
|---|
| 1045 | Â Â Â Â *) |
|---|
| 1046 | Â Â Â Â Â absdir=`cd "$dir" && pwd` |
|---|
| 1047 | Â Â Â Â Â if test -z "$absdir"; then |
|---|
| 1048 | Â Â Â Â Â Â $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 |
|---|
| 1049 | Â Â Â Â Â Â $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 |
|---|
| 1050 | Â Â Â Â Â Â absdir="$dir" |
|---|
| 1051 | Â Â Â Â Â fi |
|---|
| 1052 | Â Â Â Â Â dir="$absdir" |
|---|
| 1053 | Â Â Â Â Â ;; |
|---|
| 1054 | Â Â Â Â esac |
|---|
| 1055 | Â Â Â Â case " $deplibs " in |
|---|
| 1056 | Â Â Â Â *" $arg "*) ;; |
|---|
| 1057 | Â Â Â Â *) deplibs="$deplibs $arg";; |
|---|
| 1058 | Â Â Â Â esac |
|---|
| 1059 | Â Â Â Â case " $lib_search_path " in |
|---|
| 1060 | Â Â Â Â *" $dir "*) ;; |
|---|
| 1061 | Â Â Â Â *) lib_search_path="$lib_search_path $dir";; |
|---|
| 1062 | Â Â Â Â esac |
|---|
| 1063 | Â Â Â Â case "$host" in |
|---|
| 1064 | Â Â Â Â *-*-cygwin* | *-*-mingw* | *-*-os2*) |
|---|
| 1065 | Â Â Â Â Â dllsearchdir=`cd "$dir" && pwd || echo "$dir"` |
|---|
| 1066 | Â Â Â Â Â case ":$dllsearchpath:" in |
|---|
| 1067 | Â Â Â Â Â ::) dllsearchpath="$dllsearchdir";; |
|---|
| 1068 | Â Â Â Â Â *":$dllsearchdir:"*) ;; |
|---|
| 1069 | Â Â Â Â Â *) dllsearchpath="$dllsearchpath:$dllsearchdir";; |
|---|
| 1070 | Â Â Â Â Â esac |
|---|
| 1071 | Â Â Â Â Â ;; |
|---|
| 1072 | Â Â Â Â esac |
|---|
| 1073 | Â Â Â Â ;; |
|---|
| 1074 | |
|---|
| 1075 | Â Â Â -l*) |
|---|
| 1076 | Â Â Â Â if test "$arg" = "-lc"; then |
|---|
| 1077 | Â Â Â Â Â case "$host" in |
|---|
| 1078 | Â Â Â Â Â *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*) |
|---|
| 1079 | Â Â Â Â Â Â # These systems don't actually have c library (as such) |
|---|
| 1080 | Â Â Â Â Â Â continue |
|---|
| 1081 | Â Â Â Â Â Â ;; |
|---|
| 1082 | Â Â Â Â Â *-*-rhapsody* | *-*-darwin1.[012]) |
|---|
| 1083 | Â Â Â Â Â Â # Rhapsody C library is in the System framework |
|---|
| 1084 | Â Â Â Â Â Â deplibs="$deplibs -framework System" |
|---|
| 1085 | Â Â Â Â Â Â continue |
|---|
| 1086 | Â Â Â Â Â Â ;; |
|---|
| 1087 | Â Â Â Â Â esac |
|---|
| 1088 | Â Â Â Â elif test "$arg" = "-lm"; then |
|---|
| 1089 | Â Â Â Â Â case "$host" in |
|---|
| 1090 | Â Â Â Â Â *-*-cygwin* | *-*-beos*) |
|---|
| 1091 | Â Â Â Â Â Â # These systems don't actually have math library (as such) |
|---|
| 1092 | Â Â Â Â Â Â continue |
|---|
| 1093 | Â Â Â Â Â Â ;; |
|---|
| 1094 | Â Â Â Â Â *-*-rhapsody* | *-*-darwin1.[012]) |
|---|
| 1095 | Â Â Â Â Â Â # Rhapsody math library is in the System framework |
|---|
| 1096 | Â Â Â Â Â Â deplibs="$deplibs -framework System" |
|---|
| 1097 | Â Â Â Â Â Â continue |
|---|
| 1098 | Â Â Â Â Â Â ;; |
|---|
| 1099 | Â Â Â Â Â esac |
|---|
| 1100 | Â Â Â Â fi |
|---|
| 1101 | Â Â Â Â deplibs="$deplibs $arg" |
|---|
| 1102 | Â Â Â Â ;; |
|---|
| 1103 | |
|---|
| 1104 | Â Â Â -module) |
|---|
| 1105 | Â Â Â Â module=yes |
|---|
| 1106 | Â Â Â Â continue |
|---|
| 1107 | Â Â Â Â ;; |
|---|
| 1108 | |
|---|
| 1109 | Â Â Â -no-undefined) |
|---|
| 1110 | Â Â Â Â allow_undefined=no |
|---|
| 1111 | Â Â Â Â continue |
|---|
| 1112 | Â Â Â Â ;; |
|---|
| 1113 | |
|---|
| 1114 | Â Â Â -o) prev=output ;; |
|---|
| 1115 | |
|---|
| 1116 | Â Â Â -release) |
|---|
| 1117 | Â Â Â Â prev=release |
|---|
| 1118 | Â Â Â Â continue |
|---|
| 1119 | Â Â Â Â ;; |
|---|
| 1120 | |
|---|
| 1121 | Â Â Â -rpath) |
|---|
| 1122 | Â Â Â Â prev=rpath |
|---|
| 1123 | Â Â Â Â continue |
|---|
| 1124 | Â Â Â Â ;; |
|---|
| 1125 | |
|---|
| 1126 | Â Â Â -R) |
|---|
| 1127 | Â Â Â Â prev=xrpath |
|---|
| 1128 | Â Â Â Â continue |
|---|
| 1129 | Â Â Â Â ;; |
|---|
| 1130 | |
|---|
| 1131 | Â Â Â -R*) |
|---|
| 1132 | Â Â Â Â dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` |
|---|
| 1133 | Â Â Â Â # We need an absolute path. |
|---|
| 1134 | Â Â Â Â case "$dir" in |
|---|
| 1135 | Â Â Â Â [\\/]* | [A-Za-z]:[\\/]*) ;; |
|---|
| 1136 | Â Â Â Â *) |
|---|
| 1137 | Â Â Â Â Â $echo "$modename: only absolute run-paths are allowed" 1>&2 |
|---|
| 1138 | Â Â Â Â Â exit 1 |
|---|
| 1139 | Â Â Â Â Â ;; |
|---|
| 1140 | Â Â Â Â esac |
|---|
| 1141 | Â Â Â Â case "$xrpath " in |
|---|
| 1142 | Â Â Â Â *" $dir "*) ;; |
|---|
| 1143 | Â Â Â Â *) xrpath="$xrpath $dir" ;; |
|---|
| 1144 | Â Â Â Â esac |
|---|
| 1145 | Â Â Â Â continue |
|---|
| 1146 | Â Â Â Â ;; |
|---|
| 1147 | |
|---|
| 1148 | Â Â Â -static) |
|---|
| 1149 | Â Â Â Â # If we have no pic_flag, then this is the same as -all-static. |
|---|
| 1150 | Â Â Â Â if test -z "$pic_flag" && test -n "$link_static_flag"; then |
|---|
| 1151 | Â Â Â Â Â compile_command="$compile_command $link_static_flag" |
|---|
| 1152 | Â Â Â Â Â finalize_command="$finalize_command $link_static_flag" |
|---|
| 1153 | Â Â Â Â fi |
|---|
| 1154 | Â Â Â Â continue |
|---|
| 1155 | Â Â Â Â ;; |
|---|
| 1156 | |
|---|
| 1157 | Â Â Â -thread-safe) |
|---|
| 1158 | Â Â Â Â thread_safe=yes |
|---|
| 1159 | Â Â Â Â continue |
|---|
| 1160 | Â Â Â Â ;; |
|---|
| 1161 | |
|---|
| 1162 | Â Â Â -version-info) |
|---|
| 1163 | Â Â Â Â prev=vinfo |
|---|
| 1164 | Â Â Â Â continue |
|---|
| 1165 | Â Â Â Â ;; |
|---|
| 1166 | |
|---|
| 1167 | Â Â Â # Some other compiler flag. |
|---|
| 1168 | Â Â Â -* | +*) |
|---|
| 1169 | Â Â Â Â # Unknown arguments in both finalize_command and compile_command need |
|---|
| 1170 | Â Â Â Â # to be aesthetically quoted because they are evaled later. |
|---|
| 1171 | Â Â Â Â arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` |
|---|
| 1172 | Â Â Â Â case "$arg" in |
|---|
| 1173 | Â Â Â Â *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \Â Â ]*|*]*) |
|---|
| 1174 | Â Â Â Â Â arg="\"$arg\"" |
|---|
| 1175 | Â Â Â Â Â ;; |
|---|
| 1176 | Â Â Â Â esac |
|---|
| 1177 | Â Â Â Â ;; |
|---|
| 1178 | |
|---|
| 1179 | Â Â Â *.o | *.obj | *.a | *.lib) |
|---|
| 1180 | Â Â Â Â # A standard object. |
|---|
| 1181 | Â Â Â Â objs="$objs $arg" |
|---|
| 1182 | Â Â Â Â ;; |
|---|
| 1183 | |
|---|
| 1184 | Â Â Â *.lo) |
|---|
| 1185 | Â Â Â Â # A library object. |
|---|
| 1186 | Â Â Â Â if test "$prev" = dlfiles; then |
|---|
| 1187 | Â Â Â Â Â dlfiles="$dlfiles $arg" |
|---|
| 1188 | Â Â Â Â Â if test "$build_libtool_libs" = yes && test "$dlopen" = yes; then |
|---|
| 1189 | Â Â Â Â Â Â prev= |
|---|
| 1190 | Â Â Â Â Â Â continue |
|---|
| 1191 | Â Â Â Â Â else |
|---|
| 1192 | Â Â Â Â Â Â # If libtool objects are unsupported, then we need to preload. |
|---|
| 1193 | Â Â Â Â Â Â prev=dlprefiles |
|---|
| 1194 | Â Â Â Â Â fi |
|---|
| 1195 | Â Â Â Â fi |
|---|
| 1196 | |
|---|
| 1197 | Â Â Â Â if test "$prev" = dlprefiles; then |
|---|
| 1198 | Â Â Â Â Â # Preload the old-style object. |
|---|
| 1199 | Â Â Â Â Â dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"` |
|---|
| 1200 | Â Â Â Â Â prev= |
|---|
| 1201 | Â Â Â Â fi |
|---|
| 1202 | Â Â Â Â libobjs="$libobjs $arg" |
|---|
| 1203 | Â Â Â Â ;; |
|---|
| 1204 | |
|---|
| 1205 | Â Â Â *.la) |
|---|
| 1206 | Â Â Â Â # A libtool-controlled library. |
|---|
| 1207 | |
|---|
| 1208 | Â Â Â Â dlname= |
|---|
| 1209 | Â Â Â Â libdir= |
|---|
| 1210 | Â Â Â Â library_names= |
|---|
| 1211 | Â Â Â Â old_library= |
|---|
| 1212 | |
|---|
| 1213 | Â Â Â Â # Check to see that this really is a libtool archive. |
|---|
| 1214 | Â Â Â Â if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : |
|---|
| 1215 | Â Â Â Â else |
|---|
| 1216 | Â Â Â Â Â $echo "$modename: \`$arg' is not a valid libtool archive" 1>&2 |
|---|
| 1217 | Â Â Â Â Â exit 1 |
|---|
| 1218 | Â Â Â Â fi |
|---|
| 1219 | |
|---|
| 1220 | Â Â Â Â # If the library was installed with an old release of libtool, |
|---|
| 1221 | Â Â Â Â # it will not redefine variable installed. |
|---|
| 1222 | Â Â Â Â installed=yes |
|---|
| 1223 | |
|---|
| 1224 | Â Â Â Â # Read the .la file |
|---|
| 1225 | Â Â Â Â # If there is no directory component, then add one. |
|---|
| 1226 | Â Â Â Â case "$arg" in |
|---|
| 1227 | Â Â Â Â */* | *\\*) . $arg ;; |
|---|
| 1228 | Â Â Â Â *) . ./$arg ;; |
|---|
| 1229 | Â Â Â Â esac |
|---|
| 1230 | |
|---|
| 1231 | Â Â Â Â # Get the name of the library we link against. |
|---|
| 1232 | Â Â Â Â linklib= |
|---|
| 1233 | Â Â Â Â for l in $old_library $library_names; do |
|---|
| 1234 | Â Â Â Â Â linklib="$l" |
|---|
| 1235 | Â Â Â Â done |
|---|
| 1236 | |
|---|
| 1237 | Â Â Â Â if test -z "$linklib"; then |
|---|
| 1238 | Â Â Â Â Â $echo "$modename: cannot find name of link library for \`$arg'" 1>&2 |
|---|
| 1239 | Â Â Â Â Â exit 1 |
|---|
| 1240 | Â Â Â Â fi |
|---|
| 1241 | |
|---|
| 1242 | Â Â Â Â # Find the relevant object directory and library name. |
|---|
| 1243 | Â Â Â Â name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'` |
|---|
| 1244 | |
|---|
| 1245 | Â Â Â Â if test "X$installed" = Xyes; then |
|---|
| 1246 | Â Â Â Â Â dir="$libdir" |
|---|
| 1247 | Â Â Â Â else |
|---|
| 1248 | Â Â Â Â Â dir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` |
|---|
| 1249 | Â Â Â Â Â if test "X$dir" = "X$arg"; then |
|---|
| 1250 | Â Â Â Â Â Â dir="$objdir" |
|---|
| 1251 | Â Â Â Â Â else |
|---|
| 1252 | Â Â Â Â Â Â dir="$dir/$objdir" |
|---|
| 1253 | Â Â Â Â Â fi |
|---|
| 1254 | Â Â Â Â fi |
|---|
| 1255 | |
|---|
| 1256 | Â Â Â Â if test -n "$dependency_libs"; then |
|---|
| 1257 | Â Â Â Â Â # Extract -R and -L from dependency_libs |
|---|
| 1258 | Â Â Â Â Â temp_deplibs= |
|---|
| 1259 | Â Â Â Â Â for deplib in $dependency_libs; do |
|---|
| 1260 | Â Â Â Â Â Â case "$deplib" in |
|---|
| 1261 | Â Â Â Â Â Â -R*) temp_xrpath=`$echo "X$deplib" | $Xsed -e 's/^-R//'` |
|---|
| 1262 | Â Â Â Â Â Â Â Â Â case " $rpath $xrpath " in |
|---|
| 1263 | Â Â Â Â Â Â Â Â Â *" $temp_xrpath "*) ;; |
|---|
| 1264 | Â Â Â Â Â Â Â Â Â *) xrpath="$xrpath $temp_xrpath";; |
|---|
| 1265 | Â Â Â Â Â Â Â Â Â esac;; |
|---|
| 1266 | Â Â Â Â Â Â -L*) case "$compile_command $temp_deplibs " in |
|---|
| 1267 | Â Â Â Â Â Â Â Â Â *" $deplib "*) ;; |
|---|
| 1268 | Â Â Â Â Â Â Â Â Â *) temp_deplibs="$temp_deplibs $deplib";; |
|---|
| 1269 | Â Â Â Â Â Â Â Â Â esac |
|---|
| 1270 | Â Â Â Â Â Â Â Â Â temp_dir=`$echo "X$deplib" | $Xsed -e 's/^-L//'` |
|---|
| 1271 | Â Â Â Â Â Â Â Â Â case " $lib_search_path " in |
|---|
| 1272 | Â Â |
|---|