| 1 | |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | |
|---|
| 14 | |
|---|
| 15 | |
|---|
| 16 | |
|---|
| 17 | |
|---|
| 18 | |
|---|
| 19 | |
|---|
| 20 | |
|---|
| 21 | |
|---|
| 22 | |
|---|
| 23 | |
|---|
| 24 | |
|---|
| 25 | |
|---|
| 26 | |
|---|
| 27 | |
|---|
| 28 | |
|---|
| 29 | |
|---|
| 30 | |
|---|
| 31 | |
|---|
| 32 | |
|---|
| 33 | |
|---|
| 34 | |
|---|
| 35 | |
|---|
| 36 | |
|---|
| 37 | |
|---|
| 38 | |
|---|
| 39 | |
|---|
| 40 | |
|---|
| 41 | |
|---|
| 42 | |
|---|
| 43 | |
|---|
| 44 | |
|---|
| 45 | |
|---|
| 46 | |
|---|
| 47 | |
|---|
| 48 | |
|---|
| 49 | |
|---|
| 50 | |
|---|
| 51 | |
|---|
| 52 | |
|---|
| 53 | |
|---|
| 54 | |
|---|
| 55 | |
|---|
| 56 | |
|---|
| 57 | |
|---|
| 58 | |
|---|
| 59 | |
|---|
| 60 | |
|---|
| 61 | |
|---|
| 62 | |
|---|
| 63 | |
|---|
| 64 | |
|---|
| 65 | |
|---|
| 66 | |
|---|
| 67 | |
|---|
| 68 | |
|---|
| 69 | |
|---|
| 70 | |
|---|
| 71 | |
|---|
| 72 | |
|---|
| 73 | |
|---|
| 74 | |
|---|
| 75 | |
|---|
| 76 | |
|---|
| 77 | |
|---|
| 78 | |
|---|
| 79 | PROGRAM=libtool |
|---|
| 80 | PACKAGE=libtool |
|---|
| 81 | VERSION=2.2.7a |
|---|
| 82 | TIMESTAMP=" 1.3130 2009-11-16" |
|---|
| 83 | package_revision=1.3130 |
|---|
| 84 | |
|---|
| 85 | |
|---|
| 86 | if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then |
|---|
| 87 | emulate sh |
|---|
| 88 | NULLCMD=: |
|---|
| 89 | |
|---|
| 90 | |
|---|
| 91 | alias -g '${1+"$@"}'='"$@"' |
|---|
| 92 | setopt NO_GLOB_SUBST |
|---|
| 93 | else |
|---|
| 94 | case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac |
|---|
| 95 | fi |
|---|
| 96 | BIN_SH=xpg4; export BIN_SH |
|---|
| 97 | DUALCASE=1; export DUALCASE |
|---|
| 98 | |
|---|
| 99 | |
|---|
| 100 | func_fallback_echo () |
|---|
| 101 | { |
|---|
| 102 | eval 'cat <<_LTECHO_EOF |
|---|
| 103 | $1 |
|---|
| 104 | _LTECHO_EOF' |
|---|
| 105 | } |
|---|
| 106 | |
|---|
| 107 | |
|---|
| 108 | |
|---|
| 109 | |
|---|
| 110 | |
|---|
| 111 | lt_user_locale= |
|---|
| 112 | lt_safe_locale= |
|---|
| 113 | for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES |
|---|
| 114 | do |
|---|
| 115 | eval "if test \"\${$lt_var+set}\" = set; then |
|---|
| 116 | save_$lt_var=\$$lt_var |
|---|
| 117 | $lt_var=C |
|---|
| 118 | export $lt_var |
|---|
| 119 | lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" |
|---|
| 120 | lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" |
|---|
| 121 | fi" |
|---|
| 122 | done |
|---|
| 123 | |
|---|
| 124 | $lt_unset CDPATH |
|---|
| 125 | |
|---|
| 126 | |
|---|
| 127 | |
|---|
| 128 | |
|---|
| 129 | |
|---|
| 130 | |
|---|
| 131 | |
|---|
| 132 | |
|---|
| 133 | |
|---|
| 134 | |
|---|
| 135 | |
|---|
| 136 | |
|---|
| 137 | progpath="$0" |
|---|
| 138 | |
|---|
| 139 | |
|---|
| 140 | |
|---|
| 141 | : ${CP="cp -f"} |
|---|
| 142 | : ${ECHO=$as_echo} |
|---|
| 143 | : ${EGREP="egrep"} |
|---|
| 144 | : ${FGREP="fgrep"} |
|---|
| 145 | : ${GREP="grep"} |
|---|
| 146 | : ${LN_S="ln -s"} |
|---|
| 147 | : ${MAKE="make"} |
|---|
| 148 | : ${MKDIR="mkdir"} |
|---|
| 149 | : ${MV="mv -f"} |
|---|
| 150 | : ${RM="rm -f"} |
|---|
| 151 | : ${SED="sed"} |
|---|
| 152 | : ${SHELL="${CONFIG_SHELL-/bin/sh}"} |
|---|
| 153 | : ${Xsed="$SED -e 1s/^X//"} |
|---|
| 154 | |
|---|
| 155 | |
|---|
| 156 | EXIT_SUCCESS=0 |
|---|
| 157 | EXIT_FAILURE=1 |
|---|
| 158 | EXIT_MISMATCH=63 |
|---|
| 159 | EXIT_SKIP=77 |
|---|
| 160 | |
|---|
| 161 | exit_status=$EXIT_SUCCESS |
|---|
| 162 | |
|---|
| 163 | |
|---|
| 164 | lt_nl=' |
|---|
| 165 | ' |
|---|
| 166 | IFS=" $lt_nl" |
|---|
| 167 | |
|---|
| 168 | dirname="s,/[^/]*$,," |
|---|
| 169 | basename="s,^.*/,," |
|---|
| 170 | |
|---|
| 171 | |
|---|
| 172 | |
|---|
| 173 | |
|---|
| 174 | |
|---|
| 175 | |
|---|
| 176 | |
|---|
| 177 | |
|---|
| 178 | |
|---|
| 179 | |
|---|
| 180 | |
|---|
| 181 | |
|---|
| 182 | |
|---|
| 183 | func_dirname_and_basename () |
|---|
| 184 | { |
|---|
| 185 | |
|---|
| 186 | func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"` |
|---|
| 187 | if test "X$func_dirname_result" = "X${1}"; then |
|---|
| 188 | func_dirname_result="${3}" |
|---|
| 189 | else |
|---|
| 190 | func_dirname_result="$func_dirname_result${2}" |
|---|
| 191 | fi |
|---|
| 192 | func_basename_result=`$ECHO "${1}" | $SED -e "$basename"` |
|---|
| 193 | } |
|---|
| 194 | |
|---|
| 195 | |
|---|
| 196 | |
|---|
| 197 | |
|---|
| 198 | pathcar='s,^/\([^/]*\).*$,\1,' |
|---|
| 199 | pathcdr='s,^/[^/]*,,' |
|---|
| 200 | removedotparts=':dotsl |
|---|
| 201 | s@/\./@/@g |
|---|
| 202 | t dotsl |
|---|
| 203 | s,/\.$,/,' |
|---|
| 204 | collapseslashes='s@/\{1,\}@/@g' |
|---|
| 205 | finalslash='s,/*$,/,' |
|---|
| 206 | |
|---|
| 207 | |
|---|
| 208 | |
|---|
| 209 | |
|---|
| 210 | |
|---|
| 211 | |
|---|
| 212 | func_normal_abspath () |
|---|
| 213 | { |
|---|
| 214 | |
|---|
| 215 | func_normal_abspath_result= |
|---|
| 216 | func_normal_abspath_tpath=$1 |
|---|
| 217 | func_normal_abspath_altnamespace= |
|---|
| 218 | case $func_normal_abspath_tpath in |
|---|
| 219 | "") |
|---|
| 220 | |
|---|
| 221 | func_stripname '' '/' "`pwd`" |
|---|
| 222 | func_normal_abspath_result=$func_stripname_result |
|---|
| 223 | return |
|---|
| 224 | ;; |
|---|
| 225 | |
|---|
| 226 | |
|---|
| 227 | |
|---|
| 228 | ///*) |
|---|
| 229 | |
|---|
| 230 | ;; |
|---|
| 231 | //*) |
|---|
| 232 | |
|---|
| 233 | |
|---|
| 234 | |
|---|
| 235 | func_normal_abspath_altnamespace=/ |
|---|
| 236 | ;; |
|---|
| 237 | /*) |
|---|
| 238 | |
|---|
| 239 | ;; |
|---|
| 240 | *) |
|---|
| 241 | |
|---|
| 242 | func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath |
|---|
| 243 | ;; |
|---|
| 244 | esac |
|---|
| 245 | |
|---|
| 246 | |
|---|
| 247 | |
|---|
| 248 | func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ |
|---|
| 249 | -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"` |
|---|
| 250 | while :; do |
|---|
| 251 | |
|---|
| 252 | if test "$func_normal_abspath_tpath" = / ; then |
|---|
| 253 | |
|---|
| 254 | if test -z "$func_normal_abspath_result" ; then |
|---|
| 255 | func_normal_abspath_result=/ |
|---|
| 256 | fi |
|---|
| 257 | break |
|---|
| 258 | fi |
|---|
| 259 | func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ |
|---|
| 260 | -e "$pathcar"` |
|---|
| 261 | func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ |
|---|
| 262 | -e "$pathcdr"` |
|---|
| 263 | |
|---|
| 264 | case $func_normal_abspath_tcomponent in |
|---|
| 265 | "") |
|---|
| 266 | |
|---|
| 267 | ;; |
|---|
| 268 | ..) |
|---|
| 269 | |
|---|
| 270 | func_dirname "$func_normal_abspath_result" |
|---|
| 271 | func_normal_abspath_result=$func_dirname_result |
|---|
| 272 | ;; |
|---|
| 273 | *) |
|---|
| 274 | |
|---|
| 275 | func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent |
|---|
| 276 | ;; |
|---|
| 277 | esac |
|---|
| 278 | done |
|---|
| 279 | |
|---|
| 280 | func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result |
|---|
| 281 | } |
|---|
| 282 | |
|---|
| 283 | |
|---|
| 284 | |
|---|
| 285 | |
|---|
| 286 | |
|---|
| 287 | |
|---|
| 288 | func_relative_path () |
|---|
| 289 | { |
|---|
| 290 | func_relative_path_result= |
|---|
| 291 | func_normal_abspath "$1" |
|---|
| 292 | func_relative_path_tlibdir=$func_normal_abspath_result |
|---|
| 293 | func_normal_abspath "$2" |
|---|
| 294 | func_relative_path_tbindir=$func_normal_abspath_result |
|---|
| 295 | |
|---|
| 296 | |
|---|
| 297 | while :; do |
|---|
| 298 | |
|---|
| 299 | case $func_relative_path_tbindir in |
|---|
| 300 | $func_relative_path_tlibdir) |
|---|
| 301 | |
|---|
| 302 | func_relative_path_tcancelled= |
|---|
| 303 | break |
|---|
| 304 | ;; |
|---|
| 305 | $func_relative_path_tlibdir*) |
|---|
| 306 | |
|---|
| 307 | func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" |
|---|
| 308 | func_relative_path_tcancelled=$func_stripname_result |
|---|
| 309 | if test -z "$func_relative_path_result"; then |
|---|
| 310 | func_relative_path_result=. |
|---|
| 311 | fi |
|---|
| 312 | break |
|---|
| 313 | ;; |
|---|
| 314 | *) |
|---|
| 315 | func_dirname $func_relative_path_tlibdir |
|---|
| 316 | func_relative_path_tlibdir=${func_dirname_result} |
|---|
| 317 | if test "x$func_relative_path_tlibdir" = x ; then |
|---|
| 318 | |
|---|
| 319 | func_relative_path_result=../$func_relative_path_result |
|---|
| 320 | func_relative_path_tcancelled=$func_relative_path_tbindir |
|---|
| 321 | break |
|---|
| 322 | fi |
|---|
| 323 | func_relative_path_result=../$func_relative_path_result |
|---|
| 324 | ;; |
|---|
| 325 | esac |
|---|
| 326 | done |
|---|
| 327 | |
|---|
| 328 | |
|---|
| 329 | func_stripname '' '/' "$func_relative_path_result" |
|---|
| 330 | func_relative_path_result=$func_stripname_result |
|---|
| 331 | func_stripname '/' '/' "$func_relative_path_tcancelled" |
|---|
| 332 | if test "x$func_stripname_result" != x ; then |
|---|
| 333 | func_relative_path_result=${func_relative_path_result}/${func_stripname_result} |
|---|
| 334 | fi |
|---|
| 335 | |
|---|
| 336 | |
|---|
| 337 | |
|---|
| 338 | |
|---|
| 339 | if test ! -z "$func_relative_path_result"; then |
|---|
| 340 | func_stripname './' '' "$func_relative_path_result/" |
|---|
| 341 | func_relative_path_result=$func_stripname_result |
|---|
| 342 | fi |
|---|
| 343 | } |
|---|
| 344 | |
|---|
| 345 | |
|---|
| 346 | func_dirname_and_basename "$progpath" |
|---|
| 347 | progname=$func_basename_result |
|---|
| 348 | |
|---|
| 349 | |
|---|
| 350 | case $progpath in |
|---|
| 351 | [\\/]*|[A-Za-z]:\\*) ;; |
|---|
| 352 | *[\\/]*) |
|---|
| 353 | progdir=$func_dirname_result |
|---|
| 354 | progdir=`cd "$progdir" && pwd` |
|---|
| 355 | progpath="$progdir/$progname" |
|---|
| 356 | ;; |
|---|
| 357 | *) |
|---|
| 358 | save_IFS="$IFS" |
|---|
| 359 | IFS=: |
|---|
| 360 | for progdir in $PATH; do |
|---|
| 361 | IFS="$save_IFS" |
|---|
| 362 | test -x "$progdir/$progname" && break |
|---|
| 363 | done |
|---|
| 364 | IFS="$save_IFS" |
|---|
| 365 | test -n "$progdir" || progdir=`pwd` |
|---|
| 366 | progpath="$progdir/$progname" |
|---|
| 367 | ;; |
|---|
| 368 | esac |
|---|
| 369 | |
|---|
| 370 | |
|---|
| 371 | |
|---|
| 372 | Xsed="${SED}"' -e 1s/^X//' |
|---|
| 373 | sed_quote_subst='s/\([`"$\\]\)/\\\1/g' |
|---|
| 374 | |
|---|
| 375 | # Same as above, but do not quote variable references. |
|---|
| 376 | double_quote_subst='s/\(["`\\]\)/\\\1/g' |
|---|
| 377 | |
|---|
| 378 | |
|---|
| 379 | |
|---|
| 380 | |
|---|
| 381 | |
|---|
| 382 | |
|---|
| 383 | bs='\\' |
|---|
| 384 | bs2='\\\\' |
|---|
| 385 | bs4='\\\\\\\\' |
|---|
| 386 | dollar='\$' |
|---|
| 387 | sed_double_backslash="\ |
|---|
| 388 | s/$bs4/&\\ |
|---|
| 389 | /g |
|---|
| 390 | s/^$bs2$dollar/$bs&/ |
|---|
| 391 | s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g |
|---|
| 392 | s/\n//g" |
|---|
| 393 | |
|---|
| 394 | |
|---|
| 395 | opt_dry_run=false |
|---|
| 396 | opt_help=false |
|---|
| 397 | opt_quiet=false |
|---|
| 398 | opt_verbose=false |
|---|
| 399 | opt_warning=: |
|---|
| 400 | |
|---|
| 401 | |
|---|
| 402 | |
|---|
| 403 | |
|---|
| 404 | func_echo () |
|---|
| 405 | { |
|---|
| 406 | $ECHO "$progname${mode+: }$mode: $*" |
|---|
| 407 | } |
|---|
| 408 | |
|---|
| 409 | |
|---|
| 410 | |
|---|
| 411 | func_verbose () |
|---|
| 412 | { |
|---|
| 413 | $opt_verbose && func_echo ${1+"$@"} |
|---|
| 414 | |
|---|
| 415 | |
|---|
| 416 | |
|---|
| 417 | |
|---|
| 418 | : |
|---|
| 419 | } |
|---|
| 420 | |
|---|
| 421 | |
|---|
| 422 | |
|---|
| 423 | func_echo_all () |
|---|
| 424 | { |
|---|
| 425 | $ECHO "$*" |
|---|
| 426 | } |
|---|
| 427 | |
|---|
| 428 | |
|---|
| 429 | |
|---|
| 430 | func_error () |
|---|
| 431 | { |
|---|
| 432 | $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2 |
|---|
| 433 | } |
|---|
| 434 | |
|---|
| 435 | |
|---|
| 436 | |
|---|
| 437 | func_warning () |
|---|
| 438 | { |
|---|
| 439 | $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2 |
|---|
| 440 | |
|---|
| 441 | |
|---|
| 442 | : |
|---|
| 443 | } |
|---|
| 444 | |
|---|
| 445 | |
|---|
| 446 | |
|---|
| 447 | func_fatal_error () |
|---|
| 448 | { |
|---|
| 449 | func_error ${1+"$@"} |
|---|
| 450 | exit $EXIT_FAILURE |
|---|
| 451 | } |
|---|
| 452 | |
|---|
| 453 | |
|---|
| 454 | |
|---|
| 455 | |
|---|
| 456 | func_fatal_help () |
|---|
| 457 | { |
|---|
| 458 | func_error ${1+"$@"} |
|---|
| 459 | func_fatal_error "$help" |
|---|
| 460 | } |
|---|
| 461 | help="Try \`$progname --help' for more information." |
|---|
| 462 | |
|---|
| 463 | |
|---|
| 464 | |
|---|
| 465 | |
|---|
| 466 | func_grep () |
|---|
| 467 | { |
|---|
| 468 | $GREP "$1" "$2" >/dev/null 2>&1 |
|---|
| 469 | } |
|---|
| 470 | |
|---|
| 471 | |
|---|
| 472 | |
|---|
| 473 | |
|---|
| 474 | func_mkdir_p () |
|---|
| 475 | { |
|---|
| 476 | my_directory_path="$1" |
|---|
| 477 | my_dir_list= |
|---|
| 478 | |
|---|
| 479 | if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then |
|---|
| 480 | |
|---|
| 481 | |
|---|
| 482 | case $my_directory_path in |
|---|
| 483 | -*) my_directory_path="./$my_directory_path" ;; |
|---|
| 484 | esac |
|---|
| 485 | |
|---|
| 486 | |
|---|
| 487 | while test ! -d "$my_directory_path"; do |
|---|
| 488 | |
|---|
| 489 | |
|---|
| 490 | my_dir_list="$my_directory_path:$my_dir_list" |
|---|
| 491 | |
|---|
| 492 | |
|---|
| 493 | case $my_directory_path in */*) ;; *) break ;; esac |
|---|
| 494 | |
|---|
| 495 | |
|---|
| 496 | my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"` |
|---|
| 497 | done |
|---|
| 498 | my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'` |
|---|
| 499 | |
|---|
| 500 | save_mkdir_p_IFS="$IFS"; IFS=':' |
|---|
| 501 | for my_dir in $my_dir_list; do |
|---|
| 502 | IFS="$save_mkdir_p_IFS" |
|---|
| 503 | |
|---|
| 504 | |
|---|
| 505 | |
|---|
| 506 | $MKDIR "$my_dir" 2>/dev/null || : |
|---|
| 507 | done |
|---|
| 508 | IFS="$save_mkdir_p_IFS" |
|---|
| 509 | |
|---|
| 510 | |
|---|
| 511 | test -d "$my_directory_path" || \ |
|---|
| 512 | func_fatal_error "Failed to create \`$1'" |
|---|
| 513 | fi |
|---|
| 514 | } |
|---|
| 515 | |
|---|
| 516 | |
|---|
| 517 | |
|---|
| 518 | |
|---|
| 519 | |
|---|
| 520 | |
|---|
| 521 | func_mktempdir () |
|---|
| 522 | { |
|---|
| 523 | my_template="${TMPDIR-/tmp}/${1-$progname}" |
|---|
| 524 | |
|---|
| 525 | if test "$opt_dry_run" = ":"; then |
|---|
| 526 | |
|---|
| 527 | my_tmpdir="${my_template}-$$" |
|---|
| 528 | else |
|---|
| 529 | |
|---|
| 530 | |
|---|
| 531 | my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` |
|---|
| 532 | |
|---|
| 533 | if test ! -d "$my_tmpdir"; then |
|---|
| 534 | |
|---|
| 535 | my_tmpdir="${my_template}-${RANDOM-0}$$" |
|---|
| 536 | |
|---|
| 537 | save_mktempdir_umask=`umask` |
|---|
| 538 | umask 0077 |
|---|
| 539 | $MKDIR "$my_tmpdir" |
|---|
| 540 | umask $save_mktempdir_umask |
|---|
| 541 | fi |
|---|
| 542 | |
|---|
| 543 | |
|---|
| 544 | test -d "$my_tmpdir" || \ |
|---|
| 545 | func_fatal_error "cannot create temporary directory \`$my_tmpdir'" |
|---|
| 546 | fi |
|---|
| 547 | |
|---|
| 548 | $ECHO "$my_tmpdir" |
|---|
| 549 | } |
|---|
| 550 | |
|---|
| 551 | |
|---|
| 552 | |
|---|
| 553 | |
|---|
| 554 | |
|---|
| 555 | |
|---|
| 556 | |
|---|
| 557 | |
|---|
| 558 | func_quote_for_eval () |
|---|
| 559 | { |
|---|
| 560 | case $1 in |
|---|
| 561 | *[\\\`\"\$]*) |
|---|
| 562 | func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;; |
|---|
| 563 | *) |
|---|
| 564 | func_quote_for_eval_unquoted_result="$1" ;; |
|---|
| 565 | esac |
|---|
| 566 | |
|---|
| 567 | case $func_quote_for_eval_unquoted_result in |
|---|
| 568 | # Double-quote args containing shell metacharacters to delay |
|---|
| 569 | # word splitting, command substitution and and variable |
|---|
| 570 | # expansion for a subsequent eval. |
|---|
| 571 | # Many Bourne shells cannot handle close brackets correctly |
|---|
| 572 | # in scan sets, so we specify it separately. |
|---|
| 573 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") |
|---|
| 574 | func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" |
|---|
| 575 | ;; |
|---|
| 576 | *) |
|---|
| 577 | func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" |
|---|
| 578 | esac |
|---|
| 579 | } |
|---|
| 580 | |
|---|
| 581 | |
|---|
| 582 | |
|---|
| 583 | |
|---|
| 584 | |
|---|
| 585 | func_quote_for_expand () |
|---|
| 586 | { |
|---|
| 587 | case $1 in |
|---|
| 588 | *[\\\`\"]*) |
|---|
| 589 | my_arg=`$ECHO "$1" | $SED \ |
|---|
| 590 | -e "$double_quote_subst" -e "$sed_double_backslash"` ;; |
|---|
| 591 | *) |
|---|
| 592 | my_arg="$1" ;; |
|---|
| 593 | esac |
|---|
| 594 | |
|---|
| 595 | case $my_arg in |
|---|
| 596 | # Double-quote args containing shell metacharacters to delay |
|---|
| 597 | # word splitting and command substitution for a subsequent eval. |
|---|
| 598 | # Many Bourne shells cannot handle close brackets correctly |
|---|
| 599 | # in scan sets, so we specify it separately. |
|---|
| 600 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") |
|---|
| 601 | my_arg="\"$my_arg\"" |
|---|
| 602 | ;; |
|---|
| 603 | esac |
|---|
| 604 | |
|---|
| 605 | func_quote_for_expand_result="$my_arg" |
|---|
| 606 | } |
|---|
| 607 | |
|---|
| 608 | |
|---|
| 609 | |
|---|
| 610 | |
|---|
| 611 | |
|---|
| 612 | |
|---|
| 613 | func_show_eval () |
|---|
| 614 | { |
|---|
| 615 | my_cmd="$1" |
|---|
| 616 | my_fail_exp="${2-:}" |
|---|
| 617 | |
|---|
| 618 | ${opt_silent-false} || { |
|---|
| 619 | func_quote_for_expand "$my_cmd" |
|---|
| 620 | eval "func_echo $func_quote_for_expand_result" |
|---|
| 621 | } |
|---|
| 622 | |
|---|
| 623 | if ${opt_dry_run-false}; then :; else |
|---|
| 624 | eval "$my_cmd" |
|---|
| 625 | my_status=$? |
|---|
| 626 | if test "$my_status" -eq 0; then :; else |
|---|
| 627 | eval "(exit $my_status); $my_fail_exp" |
|---|
| 628 | fi |
|---|
| 629 | fi |
|---|
| 630 | } |
|---|
| 631 | |
|---|
| 632 | |
|---|
| 633 | |
|---|
| 634 | |
|---|
| 635 | |
|---|
| 636 | |
|---|
| 637 | func_show_eval_locale () |
|---|
| 638 | { |
|---|
| 639 | my_cmd="$1" |
|---|
| 640 | my_fail_exp="${2-:}" |
|---|
| 641 | |
|---|
| 642 | ${opt_silent-false} || { |
|---|
| 643 | func_quote_for_expand "$my_cmd" |
|---|
| 644 | eval "func_echo $func_quote_for_expand_result" |
|---|
| 645 | } |
|---|
| 646 | |
|---|
| 647 | if ${opt_dry_run-false}; then :; else |
|---|
| 648 | eval "$lt_user_locale |
|---|
| 649 | $my_cmd" |
|---|
| 650 | my_status=$? |
|---|
| 651 | eval "$lt_safe_locale" |
|---|
| 652 | if test "$my_status" -eq 0; then :; else |
|---|
| 653 | eval "(exit $my_status); $my_fail_exp" |
|---|
| 654 | fi |
|---|
| 655 | fi |
|---|
| 656 | } |
|---|
| 657 | |
|---|
| 658 | |
|---|
| 659 | |
|---|
| 660 | |
|---|
| 661 | |
|---|
| 662 | |
|---|
| 663 | |
|---|
| 664 | func_version () |
|---|
| 665 | { |
|---|
| 666 | $SED -n '/(C)/!b go |
|---|
| 667 | :more |
|---|
| 668 | /\./!{ |
|---|
| 669 | N |
|---|
| 670 | s/\n |
|---|
| 671 | b more |
|---|
| 672 | } |
|---|
| 673 | :go |
|---|
| 674 | /^ |
|---|
| 675 | s/^ |
|---|
| 676 | s/^ |
|---|
| 677 | s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ |
|---|
| 678 | p |
|---|
| 679 | }' < "$progpath" |
|---|
| 680 | exit $? |
|---|
| 681 | } |
|---|
| 682 | |
|---|
| 683 | |
|---|
| 684 | |
|---|
| 685 | func_usage () |
|---|
| 686 | { |
|---|
| 687 | $SED -n '/^ |
|---|
| 688 | s/^ |
|---|
| 689 | s/^ |
|---|
| 690 | s/\$progname/'$progname'/ |
|---|
| 691 | p |
|---|
| 692 | }' < "$progpath" |
|---|
| 693 | echo |
|---|
| 694 | $ECHO "run \`$progname --help | more' for full usage" |
|---|
| 695 | exit $? |
|---|
| 696 | } |
|---|
| 697 | |
|---|
| 698 | |
|---|
| 699 | |
|---|
| 700 | |
|---|
| 701 | func_help () |
|---|
| 702 | { |
|---|
| 703 | $SED -n '/^ |
|---|
| 704 | s/^ |
|---|
| 705 | s/^ |
|---|
| 706 | s*\$progname*'$progname'* |
|---|
| 707 | s*\$host*'"$host"'* |
|---|
| 708 | s*\$SHELL*'"$SHELL"'* |
|---|
| 709 | s*\$LTCC*'"$LTCC"'* |
|---|
| 710 | s*\$LTCFLAGS*'"$LTCFLAGS"'* |
|---|
| 711 | s*\$LD*'"$LD"'* |
|---|
| 712 | s/\$with_gnu_ld/'"$with_gnu_ld"'/ |
|---|
| 713 | s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/ |
|---|
| 714 | s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/ |
|---|
| 715 | p |
|---|
| 716 | }' < "$progpath" |
|---|
| 717 | ret=$? |
|---|
| 718 | if test -z "$1"; then |
|---|
| 719 | exit $ret |
|---|
| 720 | fi |
|---|
| 721 | } |
|---|
| 722 | |
|---|
| 723 | |
|---|
| 724 | |
|---|
| 725 | |
|---|
| 726 | func_missing_arg () |
|---|
| 727 | { |
|---|
| 728 | func_error "missing argument for $1" |
|---|
| 729 | exit_cmd=exit |
|---|
| 730 | } |
|---|
| 731 | |
|---|
| 732 | exit_cmd=: |
|---|
| 733 | |
|---|
| 734 | |
|---|
| 735 | |
|---|
| 736 | |
|---|
| 737 | |
|---|
| 738 | |
|---|
| 739 | magic="%%%MAGIC variable%%%" |
|---|
| 740 | magic_exe="%%%MAGIC EXE variable%%%" |
|---|
| 741 | |
|---|
| 742 | |
|---|
| 743 | |
|---|
| 744 | nonopt= |
|---|
| 745 | execute_dlfiles= |
|---|
| 746 | preserve_args= |
|---|
| 747 | lo2o="s/\\.lo\$/.${objext}/" |
|---|
| 748 | o2lo="s/\\.${objext}\$/.lo/" |
|---|
| 749 | extracted_archives= |
|---|
| 750 | extracted_serial=0 |
|---|
| 751 | |
|---|
| 752 | opt_dry_run=false |
|---|
| 753 | opt_duplicate_deps=false |
|---|
| 754 | opt_silent=false |
|---|
| 755 | opt_debug=: |
|---|
| 756 | |
|---|
| 757 | |
|---|
| 758 | |
|---|
| 759 | |
|---|
| 760 | exec_cmd= |
|---|
| 761 | |
|---|
| 762 | |
|---|
| 763 | |
|---|
| 764 | |
|---|
| 765 | func_fatal_configuration () |
|---|
| 766 | { |
|---|
| 767 | func_error ${1+"$@"} |
|---|
| 768 | func_error "See the $PACKAGE documentation for more information." |
|---|
| 769 | func_fatal_error "Fatal configuration error." |
|---|
| 770 | } |
|---|
| 771 | |
|---|
| 772 | |
|---|
| 773 | |
|---|
| 774 | |
|---|
| 775 | func_config () |
|---|
| 776 | { |
|---|
| 777 | re_begincf='^ |
|---|
| 778 | re_endcf='^ |
|---|
| 779 | |
|---|
| 780 | |
|---|
| 781 | $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" |
|---|
| 782 | |
|---|
| 783 | |
|---|
| 784 | for tagname in $taglist; do |
|---|
| 785 | $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" |
|---|
| 786 | done |
|---|
| 787 | |
|---|
| 788 | exit $? |
|---|
| 789 | } |
|---|
| 790 | |
|---|
| 791 | |
|---|
| 792 | |
|---|
| 793 | func_features () |
|---|
| 794 | { |
|---|
| 795 | echo "host: $host" |
|---|
| 796 | if test "$build_libtool_libs" = yes; then |
|---|
| 797 | echo "enable shared libraries" |
|---|
| 798 | else |
|---|
| 799 | echo "disable shared libraries" |
|---|
| 800 | fi |
|---|
| 801 | if test "$build_old_libs" = yes; then |
|---|
| 802 | echo "enable static libraries" |
|---|
| 803 | else |
|---|
| 804 | echo "disable static libraries" |
|---|
| 805 | fi |
|---|
| 806 | |
|---|
| 807 | exit $? |
|---|
| 808 | } |
|---|
| 809 | |
|---|
| 810 | |
|---|
| 811 | |
|---|
| 812 | |
|---|
| 813 | |
|---|
| 814 | func_enable_tag () |
|---|
| 815 | { |
|---|
| 816 | |
|---|
| 817 | tagname="$1" |
|---|
| 818 | |
|---|
| 819 | re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" |
|---|
| 820 | re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" |
|---|
| 821 | sed_extractcf="/$re_begincf/,/$re_endcf/p" |
|---|
| 822 | |
|---|
| 823 | |
|---|
| 824 | case $tagname in |
|---|
| 825 | *[!-_A-Za-z0-9,/]*) |
|---|
| 826 | func_fatal_error "invalid tag name: $tagname" |
|---|
| 827 | ;; |
|---|
| 828 | esac |
|---|
| 829 | |
|---|
| 830 | |
|---|
| 831 | |
|---|
| 832 | case $tagname in |
|---|
| 833 | CC) ;; |
|---|
| 834 | *) |
|---|
| 835 | if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then |
|---|
| 836 | taglist="$taglist $tagname" |
|---|
| 837 | |
|---|
| 838 | |
|---|
| 839 | |
|---|
| 840 | |
|---|
| 841 | |
|---|
| 842 | extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` |
|---|
| 843 | eval "$extractedcf" |
|---|
| 844 | else |
|---|
| 845 | func_error "ignoring unknown tag $tagname" |
|---|
| 846 | fi |
|---|
| 847 | ;; |
|---|
| 848 | esac |
|---|
| 849 | } |
|---|
| 850 | |
|---|
| 851 | |
|---|
| 852 | |
|---|
| 853 | { |
|---|
| 854 | |
|---|
| 855 | |
|---|
| 856 | case $1 in |
|---|
| 857 | clean|clea|cle|cl) |
|---|
| 858 | shift; set dummy --mode clean ${1+"$@"}; shift |
|---|
| 859 | ;; |
|---|
| 860 | compile|compil|compi|comp|com|co|c) |
|---|
| 861 | shift; set dummy --mode compile ${1+"$@"}; shift |
|---|
| 862 | ;; |
|---|
| 863 | execute|execut|execu|exec|exe|ex|e) |
|---|
| 864 | shift; set dummy --mode execute ${1+"$@"}; shift |
|---|
| 865 | ;; |
|---|
| 866 | finish|finis|fini|fin|fi|f) |
|---|
| 867 | shift; set dummy --mode finish ${1+"$@"}; shift |
|---|
| 868 | ;; |
|---|
| 869 | install|instal|insta|inst|ins|in|i) |
|---|
| 870 | shift; set dummy --mode install ${1+"$@"}; shift |
|---|
| 871 | ;; |
|---|
| 872 | link|lin|li|l) |
|---|
| 873 | shift; set dummy --mode link ${1+"$@"}; shift |
|---|
| 874 | ;; |
|---|
| 875 | uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) |
|---|
| 876 | shift; set dummy --mode uninstall ${1+"$@"}; shift |
|---|
| 877 | ;; |
|---|
| 878 | esac |
|---|
| 879 | |
|---|
| 880 | |
|---|
| 881 | while test "$#" -gt 0; do |
|---|
| 882 | opt="$1" |
|---|
| 883 | shift |
|---|
| 884 | |
|---|
| 885 | case $opt in |
|---|
| 886 | --config) func_config ;; |
|---|
| 887 | |
|---|
| 888 | --debug) preserve_args="$preserve_args $opt" |
|---|
| 889 | func_echo "enabling shell trace mode" |
|---|
| 890 | opt_debug='set -x' |
|---|
| 891 | $opt_debug |
|---|
| 892 | ;; |
|---|
| 893 | |
|---|
| 894 | -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break |
|---|
| 895 | execute_dlfiles="$execute_dlfiles $1" |
|---|
| 896 | shift |
|---|
| 897 | ;; |
|---|
| 898 | |
|---|
| 899 | --dry-run | -n) opt_dry_run=: ;; |
|---|
| 900 | --features) func_features ;; |
|---|
| 901 | --finish) mode="finish" ;; |
|---|
| 902 | |
|---|
| 903 | --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break |
|---|
| 904 | case $1 in |
|---|
| 905 | |
|---|
| 906 | clean) ;; |
|---|
| 907 | compile) ;; |
|---|
| 908 | execute) ;; |
|---|
| 909 | finish) ;; |
|---|
| 910 | install) ;; |
|---|
| 911 | link) ;; |
|---|
| 912 | relink) ;; |
|---|
| 913 | uninstall) ;; |
|---|
| 914 | |
|---|
| 915 | |
|---|
| 916 | *) func_error "invalid argument for $opt" |
|---|
| 917 | exit_cmd=exit |
|---|
| 918 | break |
|---|
| 919 | ;; |
|---|
| 920 | esac |
|---|
| 921 | |
|---|
| 922 | mode="$1" |
|---|
| 923 | shift |
|---|
| 924 | ;; |
|---|
| 925 | |
|---|
| 926 | --preserve-dup-deps) |
|---|
| 927 | opt_duplicate_deps=: ;; |
|---|
| 928 | |
|---|
| 929 | --quiet|--silent) preserve_args="$preserve_args $opt" |
|---|
| 930 | opt_silent=: |
|---|
| 931 | opt_verbose=false |
|---|
| 932 | ;; |
|---|
| 933 | |
|---|
| 934 | --no-quiet|--no-silent) |
|---|
| 935 | preserve_args="$preserve_args $opt" |
|---|
| 936 | opt_silent=false |
|---|
| 937 | ;; |
|---|
| 938 | |
|---|
| 939 | --verbose| -v) preserve_args="$preserve_args $opt" |
|---|
| 940 | opt_silent=false |
|---|
| 941 | opt_verbose=: |
|---|
| 942 | ;; |
|---|
| 943 | |
|---|
| 944 | --no-verbose) preserve_args="$preserve_args $opt" |
|---|
| 945 | opt_verbose=false |
|---|
| 946 | ;; |
|---|
| 947 | |
|---|
| 948 | --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break |
|---|
| 949 | preserve_args="$preserve_args $opt $1" |
|---|
| 950 | func_enable_tag "$1" |
|---|
| 951 | shift |
|---|
| 952 | ;; |
|---|
| 953 | |
|---|
| 954 | |
|---|
| 955 | -dlopen=*|--mode=*|--tag=*) |
|---|
| 956 | func_opt_split "$opt" |
|---|
| 957 | set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"} |
|---|
| 958 | shift |
|---|
| 959 | ;; |
|---|
| 960 | |
|---|
| 961 | -\?|-h) func_usage ;; |
|---|
| 962 | --help) opt_help=: ;; |
|---|
| 963 | --help-all) opt_help=': help-all' ;; |
|---|
| 964 | --version) func_version ;; |
|---|
| 965 | |
|---|
| 966 | -*) func_fatal_help "unrecognized option \`$opt'" ;; |
|---|
| 967 | |
|---|
| 968 | *) nonopt="$opt" |
|---|
| 969 | break |
|---|
| 970 | ;; |
|---|
| 971 | esac |
|---|
| 972 | done |
|---|
| 973 | |
|---|
| 974 | |
|---|
| 975 | case $host in |
|---|
| 976 | *cygwin* | *mingw* | *pw32* | *cegcc*) |
|---|
| 977 | |
|---|
| 978 | opt_duplicate_compiler_generated_deps=: |
|---|
| 979 | ;; |
|---|
| 980 | *) |
|---|
| 981 | opt_duplicate_compiler_generated_deps=$opt_duplicate_deps |
|---|
| 982 | ;; |
|---|
| 983 | esac |
|---|
| 984 | |
|---|
| 985 | |
|---|
| 986 | |
|---|
| 987 | $exit_cmd $EXIT_FAILURE |
|---|
| 988 | } |
|---|
| 989 | |
|---|
| 990 | |
|---|
| 991 | |
|---|
| 992 | |
|---|
| 993 | func_check_version_match () |
|---|
| 994 | { |
|---|
| 995 | if test "$package_revision" != "$macro_revision"; then |
|---|
| 996 | if test "$VERSION" != "$macro_version"; then |
|---|
| 997 | if test -z "$macro_version"; then |
|---|
| 998 | cat >&2 <<_LT_EOF |
|---|
| 999 | $progname: Version mismatch error. This is $PACKAGE $VERSION, but the |
|---|
| 1000 | $progname: definition of this LT_INIT comes from an older release. |
|---|
| 1001 | $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION |
|---|
| 1002 | $progname: and run autoconf again. |
|---|
| 1003 | _LT_EOF |
|---|
| 1004 | else |
|---|
| 1005 | cat >&2 <<_LT_EOF |
|---|
| 1006 | $progname: Version mismatch error. This is $PACKAGE $VERSION, but the |
|---|
| 1007 | $progname: definition of this LT_INIT comes from $PACKAGE $macro_version. |
|---|
| 1008 | $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION |
|---|
| 1009 | $progname: and run autoconf again. |
|---|
| 1010 | _LT_EOF |
|---|
| 1011 | fi |
|---|
| 1012 | else |
|---|
| 1013 | cat >&2 <<_LT_EOF |
|---|
| 1014 | $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, |
|---|
| 1015 | $progname: but the definition of this LT_INIT comes from revision $macro_revision. |
|---|
| 1016 | $progname: You should recreate aclocal.m4 with macros from revision $package_revision |
|---|
| 1017 | $progname: of $PACKAGE $VERSION and run autoconf again. |
|---|
| 1018 | _LT_EOF |
|---|
| 1019 | fi |
|---|
| 1020 | |
|---|
| 1021 | exit $EXIT_MISMATCH |
|---|
| 1022 | fi |
|---|
| 1023 | } |
|---|
| 1024 | |
|---|
| 1025 | |
|---|
| 1026 | |
|---|
| 1027 | |
|---|
| 1028 | |
|---|
| 1029 | |
|---|
| 1030 | $opt_help || { |
|---|
| 1031 | |
|---|
| 1032 | func_check_version_match |
|---|
| 1033 | |
|---|
| 1034 | if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then |
|---|
| 1035 | func_fatal_configuration "not configured to build any kind of library" |
|---|
| 1036 | fi |
|---|
| 1037 | |
|---|
| 1038 | test -z "$mode" && func_fatal_error "error: you must specify a MODE." |
|---|
| 1039 | |
|---|
| 1040 | |
|---|
| 1041 | |
|---|
| 1042 | eval std_shrext=\"$shrext_cmds\" |
|---|
| 1043 | |
|---|
| 1044 | |
|---|
| 1045 | # Only execute mode is allowed to have -dlopen flags. |
|---|
| 1046 | if test -n "$execute_dlfiles" && test "$mode" != execute; then |
|---|
| 1047 | func_error "unrecognized option \`-dlopen'" |
|---|
| 1048 | $ECHO "$help" 1>&2 |
|---|
| 1049 | exit $EXIT_FAILURE |
|---|
| 1050 | fi |
|---|
| 1051 | |
|---|
| 1052 | # Change the help message to a mode-specific one. |
|---|
| 1053 | generic_help="$help" |
|---|
| 1054 | help="Try \`$progname --help --mode=$mode' for more information." |
|---|
| 1055 | } |
|---|
| 1056 | |
|---|
| 1057 | |
|---|
| 1058 | # func_lalib_p file |
|---|
| 1059 | # True iff FILE is a libtool `.la' library or `.lo' object file. |
|---|
| 1060 | # This function is only a basic sanity check; it will hardly flush out |
|---|
| 1061 | # determined imposters. |
|---|
| 1062 | func_lalib_p () |
|---|
| 1063 | { |
|---|
| 1064 | test -f "$1" && |
|---|
| 1065 | $SED -e 4q "$1" 2>/dev/null \ |
|---|
| 1066 | | $GREP "^ |
|---|
| 1067 | } |
|---|
| 1068 | |
|---|
| 1069 | |
|---|
| 1070 | |
|---|
| 1071 | |
|---|
| 1072 | |
|---|
| 1073 | |
|---|
| 1074 | |
|---|
| 1075 | |
|---|
| 1076 | func_lalib_unsafe_p () |
|---|
| 1077 | { |
|---|
| 1078 | lalib_p=no |
|---|
| 1079 | if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then |
|---|
| 1080 | for lalib_p_l in 1 2 3 4 |
|---|
| 1081 | do |
|---|
| 1082 | read lalib_p_line |
|---|
| 1083 | case "$lalib_p_line" in |
|---|
| 1084 | \ |
|---|
| 1085 | esac |
|---|
| 1086 | done |
|---|
| 1087 | exec 0<&5 5<&- |
|---|
| 1088 | fi |
|---|
| 1089 | test "$lalib_p" = yes |
|---|
| 1090 | } |
|---|
| 1091 | |
|---|
| 1092 | |
|---|
| 1093 | |
|---|
| 1094 | |
|---|
| 1095 | |
|---|
| 1096 | func_ltwrapper_script_p () |
|---|
| 1097 | { |
|---|
| 1098 | func_lalib_p "$1" |
|---|
| 1099 | } |
|---|
| 1100 | |
|---|
| 1101 | |
|---|
| 1102 | |
|---|
| 1103 | |
|---|
| 1104 | |
|---|
| 1105 | func_ltwrapper_executable_p () |
|---|
| 1106 | { |
|---|
| 1107 | func_ltwrapper_exec_suffix= |
|---|
| 1108 | case $1 in |
|---|
| 1109 | *.exe) ;; |
|---|
| 1110 | *) func_ltwrapper_exec_suffix=.exe ;; |
|---|
| 1111 | esac |
|---|
| 1112 | $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 |
|---|
| 1113 | } |
|---|
| 1114 | |
|---|
| 1115 | |
|---|
| 1116 | |
|---|
| 1117 | |
|---|
| 1118 | |
|---|
| 1119 | func_ltwrapper_scriptname () |
|---|
| 1120 | { |
|---|
| 1121 | func_ltwrapper_scriptname_result="" |
|---|
| 1122 | if func_ltwrapper_executable_p "$1"; then |
|---|
| 1123 | func_dirname_and_basename "$1" "" "." |
|---|
| 1124 | func_stripname '' '.exe' "$func_basename_result" |
|---|
| 1125 | func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" |
|---|
| 1126 | fi |
|---|
| 1127 | } |
|---|
| 1128 | |
|---|
| 1129 | |
|---|
| 1130 | |
|---|
| 1131 | |
|---|
| 1132 | |
|---|
| 1133 | func_ltwrapper_p () |
|---|
| 1134 | { |
|---|
| 1135 | func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" |
|---|
| 1136 | } |
|---|
| 1137 | |
|---|
| 1138 | |
|---|
| 1139 | |
|---|
| 1140 | |
|---|
| 1141 | |
|---|
| 1142 | |
|---|
| 1143 | func_execute_cmds () |
|---|
| 1144 | { |
|---|
| 1145 | $opt_debug |
|---|
| 1146 | save_ifs=$IFS; IFS='~' |
|---|
| 1147 | for cmd in $1; do |
|---|
| 1148 | IFS=$save_ifs |
|---|
| 1149 | eval cmd=\"$cmd\" |
|---|
| 1150 | func_show_eval "$cmd" "${2-:}" |
|---|
| 1151 | done |
|---|
| 1152 | IFS=$save_ifs |
|---|
| 1153 | } |
|---|
| 1154 | |
|---|
| 1155 | |
|---|
| 1156 | # func_source file |
|---|
| 1157 | # Source FILE, adding directory component if necessary. |
|---|
| 1158 | # Note that it is not necessary on cygwin/mingw to append a dot to |
|---|
| 1159 | # FILE even if both FILE and FILE.exe exist: automatic-append-.exe |
|---|
| 1160 | # behavior happens only for exec(3), not for open(2)! Also, sourcing |
|---|
| 1161 | # `FILE.' does not work on cygwin managed mounts. |
|---|
| 1162 | func_source () |
|---|
| 1163 | { |
|---|
| 1164 | $opt_debug |
|---|
| 1165 | case $1 in |
|---|
| 1166 | */* | *\\*) . "$1" ;; |
|---|
| 1167 | *) . "./$1" ;; |
|---|
| 1168 | esac |
|---|
| 1169 | } |
|---|
| 1170 | |
|---|
| 1171 | |
|---|
| 1172 | # func_infer_tag arg |
|---|
| 1173 | # Infer tagged configuration to use if any are available and |
|---|
| 1174 | # if one wasn't chosen via the "--tag" command line option. |
|---|
| 1175 | # Only attempt this if the compiler in the base compile |
|---|
| 1176 | # command doesn't match the default compiler. |
|---|
| 1177 | # arg is usually of the form 'gcc ...' |
|---|
| 1178 | func_infer_tag () |
|---|
| 1179 | { |
|---|
| 1180 | $opt_debug |
|---|
| 1181 | if test -n "$available_tags" && test -z "$tagname"; then |
|---|
| 1182 | CC_quoted= |
|---|
| 1183 | for arg in $CC; do |
|---|
| 1184 | func_quote_for_eval "$arg" |
|---|
| 1185 | CC_quoted="$CC_quoted $func_quote_for_eval_result" |
|---|
| 1186 | done |
|---|
| 1187 | CC_expanded=`func_echo_all $CC` |
|---|
| 1188 | CC_quoted_expanded=`func_echo_all $CC_quoted` |
|---|
| 1189 | case $@ in |
|---|
| 1190 | # Blanks in the command may have been stripped by the calling shell, |
|---|
| 1191 | # but not from the CC environment variable when configure was run. |
|---|
| 1192 | " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ |
|---|
| 1193 | " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; |
|---|
| 1194 | # Blanks at the start of $base_compile will cause this to fail |
|---|
| 1195 | # if we don't check for them as well. |
|---|
| 1196 | *) |
|---|
| 1197 | for z in $available_tags; do |
|---|
| 1198 | if $GREP "^ |
|---|
| 1199 | |
|---|
| 1200 | eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" |
|---|
| 1201 | CC_quoted= |
|---|
| 1202 | for arg in $CC; do |
|---|
| 1203 | |
|---|
| 1204 | func_quote_for_eval "$arg" |
|---|
| 1205 | CC_quoted="$CC_quoted $func_quote_for_eval_result" |
|---|
| 1206 | done |
|---|
| 1207 | CC_expanded=`func_echo_all $CC` |
|---|
| 1208 | CC_quoted_expanded=`func_echo_all $CC_quoted` |
|---|
| 1209 | case "$@ " in |
|---|
| 1210 | " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ |
|---|
| 1211 | " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) |
|---|
| 1212 | |
|---|
| 1213 | |
|---|
| 1214 | |
|---|
| 1215 | tagname=$z |
|---|
| 1216 | break |
|---|
| 1217 | ;; |
|---|
| 1218 | esac |
|---|
| 1219 | fi |
|---|
| 1220 | done |
|---|
| 1221 | |
|---|
| 1222 | |
|---|
| 1223 | |
|---|
| 1224 | if test -z "$tagname"; then |
|---|
| 1225 | func_echo "unable to infer tagged configuration" |
|---|
| 1226 | func_fatal_error "specify a tag with \`--tag'" |
|---|
| 1227 | |
|---|
| 1228 | |
|---|
| 1229 | fi |
|---|
| 1230 | ;; |
|---|
| 1231 | esac |
|---|
| 1232 | fi |
|---|
| 1233 | } |
|---|
| 1234 | |
|---|
| 1235 | |
|---|
| 1236 | |
|---|
| 1237 | |
|---|
| 1238 | |
|---|
| 1239 | |
|---|
| 1240 | func_write_libtool_object () |
|---|
| 1241 | { |
|---|
| 1242 | write_libobj=${1} |
|---|
| 1243 | if test "$build_libtool_libs" = yes; then |
|---|
| 1244 | write_lobj=\'${2}\' |
|---|
| 1245 | else |
|---|
| 1246 | write_lobj=none |
|---|
| 1247 | fi |
|---|
| 1248 | |
|---|
| 1249 | if test "$build_old_libs" = yes; then |
|---|
| 1250 | write_oldobj=\'${3}\' |
|---|
| 1251 | else |
|---|
| 1252 | write_oldobj=none |
|---|
| 1253 | fi |
|---|
| 1254 | |
|---|
| 1255 | $opt_dry_run || { |
|---|
| 1256 | cat >${write_libobj}T <<EOF |
|---|
| 1257 | |
|---|
| 1258 | |
|---|
| 1259 | |
|---|
| 1260 | |
|---|
| 1261 | |
|---|
| 1262 | |
|---|
| 1263 | |
|---|
| 1264 | pic_object=$write_lobj |
|---|
| 1265 | |
|---|
| 1266 | |
|---|
| 1267 | non_pic_object=$write_oldobj |
|---|
| 1268 | |
|---|
| 1269 | EOF |
|---|
| 1270 | $MV "${write_libobj}T" "${write_libobj}" |
|---|
| 1271 | } |
|---|
| 1272 | } |
|---|
| 1273 | |
|---|
| 1274 | |
|---|
| 1275 | func_mode_compile () |
|---|
| 1276 | { |
|---|
| 1277 | $opt_debug |
|---|
| 1278 | |
|---|
| 1279 | base_compile= |
|---|
| 1280 | srcfile="$nonopt" |
|---|
| 1281 | suppress_opt=yes |
|---|
| 1282 | suppress_output= |
|---|
| 1283 | arg_mode=normal |
|---|
| 1284 | libobj= |
|---|
| 1285 | later= |
|---|
| 1286 | pie_flag= |
|---|
| 1287 | |
|---|
| 1288 | for arg |
|---|
| 1289 | do |
|---|
| 1290 | case $arg_mode in |
|---|
| 1291 | arg ) |
|---|
| 1292 | |
|---|
| 1293 | lastarg="$arg" |
|---|
| 1294 | arg_mode=normal |
|---|
| 1295 | ;; |
|---|
| 1296 | |
|---|
| 1297 | target ) |
|---|
| 1298 | libobj="$arg" |
|---|
| 1299 | arg_mode=normal |
|---|
| 1300 | continue |
|---|
| 1301 | ;; |
|---|
| 1302 | |
|---|
| 1303 | normal ) |
|---|
| 1304 | |
|---|
| 1305 | case $arg in |
|---|
| 1306 | -o) |
|---|
| 1307 | test -n "$libobj" && \ |
|---|
| 1308 | func_fatal_error "you cannot specify \`-o' more than once" |
|---|
| 1309 | arg_mode=target |
|---|
| 1310 | continue |
|---|
| 1311 | ;; |
|---|
| 1312 | |
|---|
| 1313 | -pie | -fpie | -fPIE) |
|---|
| 1314 | pie_flag="$pie_flag $arg" |
|---|
| 1315 | continue |
|---|
| 1316 | ;; |
|---|
| 1317 | |
|---|
| 1318 | -shared | -static | -prefer-pic | -prefer-non-pic) |
|---|
| 1319 | later="$later $arg" |
|---|
| 1320 | continue |
|---|
| 1321 | ;; |
|---|
| 1322 | |
|---|
| 1323 | -no-suppress) |
|---|
| 1324 | suppress_opt=no |
|---|
| 1325 | continue |
|---|
| 1326 | ;; |
|---|
| 1327 | |
|---|
| 1328 | -Xcompiler) |
|---|
| 1329 | arg_mode=arg |
|---|
| 1330 | continue |
|---|
| 1331 | ;; |
|---|
| 1332 | |
|---|
| 1333 | -Wc,*) |
|---|
| 1334 | func_stripname '-Wc,' '' "$arg" |
|---|
| 1335 | args=$func_stripname_result |
|---|
| 1336 | lastarg= |
|---|
| 1337 | save_ifs="$IFS"; IFS=',' |
|---|
| 1338 | for arg in $args; do |
|---|
| 1339 | IFS="$save_ifs" |
|---|
| 1340 | func_quote_for_eval "$arg" |
|---|
| 1341 | lastarg="$lastarg $func_quote_for_eval_result" |
|---|
| 1342 | done |
|---|
| 1343 | IFS="$save_ifs" |
|---|
| 1344 | func_stripname ' ' '' "$lastarg" |
|---|
| 1345 | lastarg=$func_stripname_result |
|---|
| 1346 | |
|---|
| 1347 | |
|---|
| 1348 | base_compile="$base_compile $lastarg" |
|---|
| 1349 | continue |
|---|
| 1350 | ;; |
|---|
| 1351 | |
|---|
| 1352 | *) |
|---|
| 1353 | |
|---|
| 1354 | |
|---|
| 1355 | |
|---|
| 1356 | lastarg="$srcfile" |
|---|
| 1357 | srcfile="$arg" |
|---|
| 1358 | ;; |
|---|
| 1359 | esac |
|---|
| 1360 | ;; |
|---|
| 1361 | esac |
|---|
| 1362 | |
|---|
| 1363 | |
|---|
| 1364 | func_quote_for_eval "$lastarg" |
|---|
| 1365 | base_compile="$base_compile $func_quote_for_eval_result" |
|---|
| 1366 | done |
|---|
| 1367 | |
|---|
| 1368 | case $arg_mode in |
|---|
| 1369 | arg) |
|---|
| 1370 | func_fatal_error "you must specify an argument for -Xcompile" |
|---|
| 1371 | ;; |
|---|
| 1372 | target) |
|---|
| 1373 | func_fatal_error "you must specify a target with \`-o'" |
|---|
| 1374 | ;; |
|---|
| 1375 | *) |
|---|
| 1376 | |
|---|
| 1377 | test -z "$libobj" && { |
|---|
| 1378 | func_basename "$srcfile" |
|---|
| 1379 | libobj="$func_basename_result" |
|---|
| 1380 | } |
|---|
| 1381 | ;; |
|---|
| 1382 | esac |
|---|
| 1383 | |
|---|
| 1384 | |
|---|
| 1385 | |
|---|
| 1386 | case $libobj in |
|---|
| 1387 | *.[cCFSifmso] | \ |
|---|
| 1388 | *.ada | *.adb | *.ads | *.asm | \ |
|---|
| 1389 | *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ |
|---|
| 1390 | *.[fF][09]? | *.for | *.java | *.obj | *.sx | *.cu | *.cup) |
|---|
| 1391 | func_xform "$libobj" |
|---|
| 1392 | libobj=$func_xform_result |
|---|
| 1393 | ;; |
|---|
| 1394 | esac |
|---|
| 1395 | |
|---|
| 1396 | case $libobj in |
|---|
| 1397 | *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; |
|---|
| 1398 | *) |
|---|
| 1399 | func_fatal_error "cannot determine name of library object from \`$libobj'" |
|---|
| 1400 | ;; |
|---|
| 1401 | esac |
|---|
| 1402 | |
|---|
| 1403 | func_infer_tag $base_compile |
|---|
| 1404 | |
|---|
| 1405 | for arg in $later; do |
|---|
| 1406 | case $arg in |
|---|
| 1407 | -shared) |
|---|
| 1408 | test "$build_libtool_libs" != yes && \ |
|---|
| 1409 | func_fatal_configuration "can not build a shared library" |
|---|
| 1410 | build_old_libs=no |
|---|
| 1411 | continue |
|---|
| 1412 | ;; |
|---|
| 1413 | |
|---|
| 1414 | -static) |
|---|
| 1415 | build_libtool_libs=no |
|---|
| 1416 | build_old_libs=yes |
|---|
| 1417 | continue |
|---|
| 1418 | ;; |
|---|
| 1419 | |
|---|
| 1420 | -prefer-pic) |
|---|
| 1421 | pic_mode=yes |
|---|
| 1422 | continue |
|---|
| 1423 | ;; |
|---|
| 1424 | |
|---|
| 1425 | -prefer-non-pic) |
|---|
| 1426 | pic_mode=no |
|---|
| 1427 | continue |
|---|
| 1428 | ;; |
|---|
| 1429 | esac |
|---|
| 1430 | done |
|---|
| 1431 | |
|---|
| 1432 | func_quote_for_eval "$libobj" |
|---|
| 1433 | test "X$libobj" != "X$func_quote_for_eval_result" \ |
|---|
| 1434 | && $ECHO "X$libobj" | $GREP '[]~ |
|---|
| 1435 | && func_warning "libobj name \`$libobj' may not contain shell special characters." |
|---|
| 1436 | func_dirname_and_basename "$obj" "/" "" |
|---|
| 1437 | objname="$func_basename_result" |
|---|
| 1438 | xdir="$func_dirname_result" |
|---|
| 1439 | lobj=${xdir}$objdir/$objname |
|---|
| 1440 | |
|---|
| 1441 | test -z "$base_compile" && \ |
|---|
| 1442 | func_fatal_help "you must specify a compilation command" |
|---|
| 1443 | |
|---|
| 1444 | |
|---|
| 1445 | if test "$build_old_libs" = yes; then |
|---|
| 1446 | removelist="$obj $lobj $libobj ${libobj}T" |
|---|
| 1447 | else |
|---|
| 1448 | removelist="$lobj $libobj ${libobj}T" |
|---|
| 1449 | fi |
|---|
| 1450 | |
|---|
| 1451 | |
|---|
| 1452 | case $host_os in |
|---|
| 1453 | cygwin* | mingw* | pw32* | os2* | cegcc*) |
|---|
| 1454 | pic_mode=default |
|---|
| 1455 | ;; |
|---|
| 1456 | esac |
|---|
| 1457 | if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then |
|---|
| 1458 | |
|---|
| 1459 | pic_mode=default |
|---|
| 1460 | fi |
|---|
| 1461 | |
|---|
| 1462 | |
|---|
| 1463 | |
|---|
| 1464 | if test "$compiler_c_o" = no; then |
|---|
| 1465 | output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext} |
|---|
| 1466 | lockfile="$output_obj.lock" |
|---|
| 1467 | else |
|---|
| 1468 | output_obj= |
|---|
| 1469 | need_locks=no |
|---|
| 1470 | lockfile= |
|---|
| 1471 | fi |
|---|
| 1472 | |
|---|
| 1473 | |
|---|
| 1474 | |
|---|
| 1475 | if test "$need_locks" = yes; then |
|---|
| 1476 | until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do |
|---|
| 1477 | func_echo "Waiting for $lockfile to be removed" |
|---|
| 1478 | sleep 2 |
|---|
| 1479 | done |
|---|
| 1480 | elif test "$need_locks" = warn; then |
|---|
| 1481 | if test -f "$lockfile"; then |
|---|
| 1482 | $ECHO "\ |
|---|
| 1483 | *** ERROR, $lockfile exists and contains: |
|---|
| 1484 | `cat $lockfile 2>/dev/null` |
|---|
| 1485 | |
|---|
| 1486 | This indicates that another process is trying to use the same |
|---|
| 1487 | temporary object file, and libtool could not work around it because |
|---|
| 1488 | your compiler does not support \`-c' and \`-o' together. If you |
|---|
| 1489 | repeat this compilation, it may succeed, by chance, but you had better |
|---|
| 1490 | avoid parallel builds (make -j) in this platform, or get a better |
|---|
| 1491 | compiler." |
|---|
| 1492 | |
|---|
| 1493 | $opt_dry_run || $RM $removelist |
|---|
| 1494 | exit $EXIT_FAILURE |
|---|
| 1495 | fi |
|---|
| 1496 | removelist="$removelist $output_obj" |
|---|
| 1497 | $ECHO "$srcfile" > "$lockfile" |
|---|
| 1498 | fi |
|---|
| 1499 | |
|---|
| 1500 | $opt_dry_run || $RM $removelist |
|---|
| 1501 | removelist="$removelist $lockfile" |
|---|
| 1502 | trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 |
|---|
| 1503 | |
|---|
| 1504 | if test -n "$fix_srcfile_path"; then |
|---|
| 1505 | eval srcfile=\"$fix_srcfile_path\" |
|---|
| 1506 | fi |
|---|
| 1507 | func_quote_for_eval "$srcfile" |
|---|
| 1508 | qsrcfile=$func_quote_for_eval_result |
|---|
| 1509 | |
|---|
| 1510 | # Only build a PIC object if we are building libtool libraries. |
|---|
| 1511 | if test "$build_libtool_libs" = yes; then |
|---|
| 1512 | # Without this assignment, base_compile gets emptied. |
|---|
| 1513 | fbsd_hideous_sh_bug=$base_compile |
|---|
| 1514 | |
|---|
| 1515 | if test "$pic_mode" != no; then |
|---|
| 1516 | command="$base_compile $qsrcfile $pic_flag" |
|---|
| 1517 | else |
|---|
| 1518 | # Don't build PIC code |
|---|
| 1519 | command="$base_compile $qsrcfile" |
|---|
| 1520 | fi |
|---|
| 1521 | |
|---|
| 1522 | func_mkdir_p "$xdir$objdir" |
|---|
| 1523 | |
|---|
| 1524 | if test -z "$output_obj"; then |
|---|
| 1525 | # Place PIC objects in $objdir |
|---|
| 1526 | command="$command -o $lobj" |
|---|
| 1527 | fi |
|---|
| 1528 | |
|---|
| 1529 | func_show_eval_locale "$command" \ |
|---|
| 1530 | 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' |
|---|
| 1531 | |
|---|
| 1532 | if test "$need_locks" = warn && |
|---|
| 1533 | test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then |
|---|
| 1534 | $ECHO "\ |
|---|
| 1535 | *** ERROR, $lockfile contains: |
|---|
| 1536 | `cat $lockfile 2>/dev/null` |
|---|
| 1537 | |
|---|
| 1538 | but it should contain: |
|---|
| 1539 | $srcfile |
|---|
| 1540 | |
|---|
| 1541 | This indicates that another process is trying to use the same |
|---|
| 1542 | temporary object file, and libtool could not work around it because |
|---|
| 1543 | your compiler does not support \`-c' and \`-o' together. If you |
|---|
| 1544 | repeat this compilation, it may succeed, by chance, but you had better |
|---|
| 1545 | avoid parallel builds (make -j) in this platform, or get a better |
|---|
| 1546 | compiler." |
|---|
| 1547 | |
|---|
| 1548 | $opt_dry_run || $RM $removelist |
|---|
| 1549 | exit $EXIT_FAILURE |
|---|
| 1550 | fi |
|---|
| 1551 | |
|---|
| 1552 | # Just move the object if needed, then go on to compile the next one |
|---|
| 1553 | if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then |
|---|
| 1554 | func_show_eval '$MV "$output_obj" "$lobj"' \ |
|---|
| 1555 | 'error=$?; $opt_dry_run || $RM $removelist; exit $error' |
|---|
| 1556 | fi |
|---|
| 1557 | |
|---|
| 1558 | # Allow error messages only from the first compilation. |
|---|
| 1559 | if test "$suppress_opt" = yes; then |
|---|
| 1560 | suppress_output=' >/dev/null 2>&1' |
|---|
| 1561 | fi |
|---|
| 1562 | fi |
|---|
| 1563 | |
|---|
| 1564 | # Only build a position-dependent object if we build old libraries. |
|---|
| 1565 | if test "$build_old_libs" = yes; then |
|---|
| 1566 | if test "$pic_mode" != yes; then |
|---|
| 1567 | # Don't build PIC code |
|---|
| 1568 | command="$base_compile $qsrcfile$pie_flag" |
|---|
| 1569 | else |
|---|
| 1570 | command="$base_compile $qsrcfile $pic_flag" |
|---|
| 1571 | fi |
|---|
| 1572 | if test "$compiler_c_o" = yes; then |
|---|
| 1573 | command="$command -o $obj" |
|---|
| 1574 | fi |
|---|
| 1575 | |
|---|
| 1576 | # Suppress compiler output if we already did a PIC compilation. |
|---|
| 1577 | command="$command$suppress_output" |
|---|
| 1578 | func_show_eval_locale "$command" \ |
|---|
| 1579 | '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' |
|---|
| 1580 | |
|---|
| 1581 | if test "$need_locks" = warn && |
|---|
| 1582 | test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then |
|---|
| 1583 | $ECHO "\ |
|---|
| 1584 | *** ERROR, $lockfile contains: |
|---|
| 1585 | `cat $lockfile 2>/dev/null` |
|---|
| 1586 | |
|---|
| 1587 | but it should contain: |
|---|
| 1588 | $srcfile |
|---|
| 1589 | |
|---|
| 1590 | This indicates that another process is trying to use the same |
|---|
| 1591 | temporary object file, and libtool could not work around it because |
|---|
| 1592 | your compiler does not support \`-c' and \`-o' together. If you |
|---|
| 1593 | repeat this compilation, it may succeed, by chance, but you had better |
|---|
| 1594 | avoid parallel builds (make -j) in this platform, or get a better |
|---|
| 1595 | compiler." |
|---|
| 1596 | |
|---|
| 1597 | $opt_dry_run || $RM $removelist |
|---|
| 1598 | exit $EXIT_FAILURE |
|---|
| 1599 | fi |
|---|
| 1600 | |
|---|
| 1601 | # Just move the object if needed |
|---|
| 1602 | if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then |
|---|
| 1603 | func_show_eval '$MV "$output_obj" "$obj"' \ |
|---|
| 1604 | 'error=$?; $opt_dry_run || $RM $removelist; exit $error' |
|---|
| 1605 | fi |
|---|
| 1606 | fi |
|---|
| 1607 | |
|---|
| 1608 | $opt_dry_run || { |
|---|
| 1609 | func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" |
|---|
| 1610 | |
|---|
| 1611 | # Unlock the critical section if it was locked |
|---|
| 1612 | if test "$need_locks" != no; then |
|---|
| 1613 | removelist=$lockfile |
|---|
| 1614 | $RM "$lockfile" |
|---|
| 1615 | fi |
|---|
| 1616 | } |
|---|
| 1617 | |
|---|
| 1618 | exit $EXIT_SUCCESS |
|---|
| 1619 | } |
|---|
| 1620 | |
|---|
| 1621 | $opt_help || { |
|---|
| 1622 | test "$mode" = compile && func_mode_compile ${1+"$@"} |
|---|
| 1623 | } |
|---|
| 1624 | |
|---|
| 1625 | func_mode_help () |
|---|
| 1626 | { |
|---|
| 1627 | # We need to display help for each of the modes. |
|---|
| 1628 | case $mode in |
|---|
| 1629 | "") |
|---|
| 1630 | # Generic help is extracted from the usage comments |
|---|
| 1631 | # at the start of this file. |
|---|
| 1632 | func_help |
|---|
| 1633 | ;; |
|---|
| 1634 | |
|---|
| 1635 | clean) |
|---|
| 1636 | $ECHO \ |
|---|
| 1637 | "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... |
|---|
| 1638 | |
|---|
| 1639 | Remove files from the build directory. |
|---|
| 1640 | |
|---|
| 1641 | RM is the name of the program to use to delete files associated with each FILE |
|---|
| 1642 | (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed |
|---|
| 1643 | to RM. |
|---|
| 1644 | |
|---|
| 1645 | If FILE is a libtool library, object or program, all the files associated |
|---|
| 1646 | with it are deleted. Otherwise, only FILE itself is deleted using RM." |
|---|
| 1647 | ;; |
|---|
| 1648 | |
|---|
| 1649 | compile) |
|---|
| 1650 | $ECHO \ |
|---|
| 1651 | "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE |
|---|
| 1652 | |
|---|
| 1653 | Compile a source file into a libtool library object. |
|---|
| 1654 | |
|---|
| 1655 | This mode accepts the following additional options: |
|---|
| 1656 | |
|---|
| 1657 | -o OUTPUT-FILE set the output file name to OUTPUT-FILE |
|---|
| 1658 | -no-suppress do not suppress compiler output for multiple passes |
|---|
| 1659 | -prefer-pic try to building PIC objects only |
|---|
| 1660 | -prefer-non-pic try to building non-PIC objects only |
|---|
| 1661 | -shared do not build a \`.o' file suitable for static linking |
|---|
| 1662 | -static only build a \`.o' file suitable for static linking |
|---|
| 1663 | -Wc,FLAG pass FLAG directly to the compiler |
|---|
| 1664 | |
|---|
| 1665 | COMPILE-COMMAND is a command to be used in creating a \`standard' object file |
|---|
| 1666 | from the given SOURCEFILE. |
|---|
| 1667 | |
|---|
| 1668 | The output file name is determined by removing the directory component from |
|---|
| 1669 | SOURCEFILE, then substituting the C source code suffix \`.c' with the |
|---|
| 1670 | library object suffix, \`.lo'." |
|---|
| 1671 | ;; |
|---|
| 1672 | |
|---|
| 1673 | execute) |
|---|
| 1674 | $ECHO \ |
|---|
| 1675 | "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... |
|---|
| 1676 | |
|---|
| 1677 | Automatically set library path, then run a program. |
|---|
| 1678 | |
|---|
| 1679 | This mode accepts the following additional options: |
|---|
| 1680 | |
|---|
| 1681 | -dlopen FILE add the directory containing FILE to the library path |
|---|
| 1682 | |
|---|
| 1683 | This mode sets the library path environment variable according to \`-dlopen' |
|---|
| 1684 | flags. |
|---|
| 1685 | |
|---|
| 1686 | If any of the ARGS are libtool executable wrappers, then they are translated |
|---|
| 1687 | into their corresponding uninstalled binary, and any of their required library |
|---|
| 1688 | directories are added to the library path. |
|---|
| 1689 | |
|---|
| 1690 | Then, COMMAND is executed, with ARGS as arguments." |
|---|
| 1691 | ;; |
|---|
| 1692 | |
|---|
| 1693 | finish) |
|---|
| 1694 | $ECHO \ |
|---|
| 1695 | "Usage: $progname [OPTION]... --mode=finish [LIBDIR]... |
|---|
| 1696 | |
|---|
| 1697 | Complete the installation of libtool libraries. |
|---|
| 1698 | |
|---|
| 1699 | Each LIBDIR is a directory that contains libtool libraries. |
|---|
| 1700 | |
|---|
| 1701 | The commands that this mode executes may require superuser privileges. Use |
|---|
| 1702 | the \`--dry-run' option if you just want to see what would be executed." |
|---|
| 1703 | ;; |
|---|
| 1704 | |
|---|
| 1705 | install) |
|---|
| 1706 | $ECHO \ |
|---|
| 1707 | "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... |
|---|
| 1708 | |
|---|
| 1709 | Install executables or libraries. |
|---|
| 1710 | |
|---|
| 1711 | INSTALL-COMMAND is the installation command. The first component should be |
|---|
| 1712 | either the \`install' or \`cp' program. |
|---|
| 1713 | |
|---|
| 1714 | The following components of INSTALL-COMMAND are treated specially: |
|---|
| 1715 | |
|---|
| 1716 | -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation |
|---|
| 1717 | |
|---|
| 1718 | The rest of the components are interpreted as arguments to that command (only |
|---|
| 1719 | BSD-compatible install options are recognized)." |
|---|
| 1720 | ;; |
|---|
| 1721 | |
|---|
| 1722 | link) |
|---|
| 1723 | $ECHO \ |
|---|
| 1724 | "Usage: $progname [OPTION]... --mode=link LINK-COMMAND... |
|---|
| 1725 | |
|---|
| 1726 | Link object files or libraries together to form another library, or to |
|---|
| 1727 | create an executable program. |
|---|
| 1728 | |
|---|
| 1729 | LINK-COMMAND is a command using the C compiler that you would use to create |
|---|
| 1730 | a program from several object files. |
|---|
| 1731 | |
|---|
| 1732 | The following components of LINK-COMMAND are treated specially: |
|---|
| 1733 | |
|---|
| 1734 | -all-static do not do any dynamic linking at all |
|---|
| 1735 | -avoid-version do not add a version suffix if possible |
|---|
| 1736 | -bindir BINDIR specify path to binaries directory (for systems where |
|---|
| 1737 | libraries must be found in the PATH setting at runtime) |
|---|
| 1738 | -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime |
|---|
| 1739 | -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols |
|---|
| 1740 | -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) |
|---|
| 1741 | -export-symbols SYMFILE |
|---|
| 1742 | try to export only the symbols listed in SYMFILE |
|---|
| 1743 | -export-symbols-regex REGEX |
|---|
| 1744 | try to export only the symbols matching REGEX |
|---|
| 1745 | -LLIBDIR search LIBDIR for required installed libraries |
|---|
| 1746 | -lNAME OUTPUT-FILE requires the installed library libNAME |
|---|
| 1747 | -module build a library that can dlopened |
|---|
| 1748 | -no-fast-install disable the fast-install mode |
|---|
| 1749 | -no-install link a not-installable executable |
|---|
| 1750 | -no-undefined declare that a library does not refer to external symbols |
|---|
| 1751 | -o OUTPUT-FILE create OUTPUT-FILE from the specified objects |
|---|
| 1752 | -objectlist FILE Use a list of object files found in FILE to specify objects |
|---|
| 1753 | -precious-files-regex REGEX |
|---|
| 1754 | don't remove output files matching REGEX |
|---|
| 1755 | -release RELEASE specify package release information |
|---|
| 1756 | -rpath LIBDIR the created library will eventually be installed in LIBDIR |
|---|
| 1757 | -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries |
|---|
| 1758 | -shared only do dynamic linking of libtool libraries |
|---|
| 1759 | -shrext SUFFIX override the standard shared library file extension |
|---|
| 1760 | -static do not do any dynamic linking of uninstalled libtool libraries |
|---|
| 1761 | -static-libtool-libs |
|---|
| 1762 | do not do any dynamic linking of libtool libraries |
|---|
| 1763 | -version-info CURRENT[:REVISION[:AGE]] |
|---|
| 1764 | specify library version info [each variable defaults to 0] |
|---|
| 1765 | -weak LIBNAME declare that the target provides the LIBNAME interface |
|---|
| 1766 | -Wc,FLAG |
|---|
| 1767 | -Xcompiler FLAG pass linker-specific FLAG directly to the compiler |
|---|
| 1768 | -Wl,FLAG |
|---|
| 1769 | -Xlinker FLAG pass linker-specific FLAG directly to the linker |
|---|
| 1770 | -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) |
|---|
| 1771 | |
|---|
| 1772 | All other options (arguments beginning with \`-') are ignored. |
|---|
| 1773 | |
|---|
| 1774 | Every other argument is treated as a filename. Files ending in \`.la' are |
|---|
| 1775 | treated as uninstalled libtool libraries, other files are standard or library |
|---|
| 1776 | object files. |
|---|
| 1777 | |
|---|
| 1778 | If the OUTPUT-FILE ends in \`.la', then a libtool library is created, |
|---|
| 1779 | only library objects (\`.lo' files) may be specified, and \`-rpath' is |
|---|
| 1780 | required, except when creating a convenience library. |
|---|
| 1781 | |
|---|
| 1782 | If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created |
|---|
| 1783 | using \`ar' and \`ranlib', or on Windows using \`lib'. |
|---|
| 1784 | |
|---|
| 1785 | If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file |
|---|
| 1786 | is created, otherwise an executable program is created." |
|---|
| 1787 | ;; |
|---|
| 1788 | |
|---|
| 1789 | uninstall) |
|---|
| 1790 | $ECHO \ |
|---|
| 1791 | "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... |
|---|
| 1792 | |
|---|
| 1793 | Remove libraries from an installation directory. |
|---|
| 1794 | |
|---|
| 1795 | RM is the name of the program to use to delete files associated with each FILE |
|---|
| 1796 | (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed |
|---|
| 1797 | to RM. |
|---|
| 1798 | |
|---|
| 1799 | If FILE is a libtool library, all the files associated with it are deleted. |
|---|
| 1800 | Otherwise, only FILE itself is deleted using RM." |
|---|
| 1801 | ;; |
|---|
| 1802 | |
|---|
| 1803 | *) |
|---|
| 1804 | func_fatal_help "invalid operation mode \`$mode'" |
|---|
| 1805 | ;; |
|---|
| 1806 | esac |
|---|
| 1807 | |
|---|
| 1808 | echo |
|---|
| 1809 | $ECHO "Try \`$progname --help' for more information about other modes." |
|---|
| 1810 | } |
|---|
| 1811 | |
|---|
| 1812 | # Now that we've collected a possible --mode arg, show help if necessary |
|---|
| 1813 | if $opt_help; then |
|---|
| 1814 | if test "$opt_help" = :; then |
|---|
| 1815 | func_mode_help |
|---|
| 1816 | else |
|---|
| 1817 | { |
|---|
| 1818 | func_help noexit |
|---|
| 1819 | for mode in compile link execute install finish uninstall clean; do |
|---|
| 1820 | func_mode_help |
|---|
| 1821 | done |
|---|
| 1822 | } | sed -n '1p; 2,$s/^Usage:/ or: /p' |
|---|
| 1823 | { |
|---|
| 1824 | func_help noexit |
|---|
| 1825 | for mode in compile link execute install finish uninstall clean; do |
|---|
| 1826 | echo |
|---|
| 1827 | func_mode_help |
|---|
| 1828 | done |
|---|
| 1829 | } | |
|---|
| 1830 | sed '1d |
|---|
| 1831 | /^When reporting/,/^Report/{ |
|---|
| 1832 | H |
|---|
| 1833 | d |
|---|
| 1834 | } |
|---|
| 1835 | $x |
|---|
| 1836 | /information about other modes/d |
|---|
| 1837 | /more detailed .*MODE/d |
|---|
| 1838 | s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' |
|---|
| 1839 | fi |
|---|
| 1840 | exit $? |
|---|
| 1841 | fi |
|---|
| 1842 | |
|---|
| 1843 | |
|---|
| 1844 | # func_mode_execute arg... |
|---|
| 1845 | func_mode_execute () |
|---|
| 1846 | { |
|---|
| 1847 | $opt_debug |
|---|
| 1848 | # The first argument is the command name. |
|---|
| 1849 | cmd="$nonopt" |
|---|
| 1850 | test -z "$cmd" && \ |
|---|
| 1851 | func_fatal_help "you must specify a COMMAND" |
|---|
| 1852 | |
|---|
| 1853 | # Handle -dlopen flags immediately. |
|---|
| 1854 | for file in $execute_dlfiles; do |
|---|
| 1855 | test -f "$file" \ |
|---|
| 1856 | || func_fatal_help "\`$file' is not a file" |
|---|
| 1857 | |
|---|
| 1858 | dir= |
|---|
| 1859 | case $file in |
|---|
| 1860 | *.la) |
|---|
| 1861 | # Check to see that this really is a libtool archive. |
|---|
| 1862 | func_lalib_unsafe_p "$file" \ |
|---|
| 1863 | || func_fatal_help "\`$lib' is not a valid libtool archive" |
|---|
| 1864 | |
|---|
| 1865 | # Read the libtool library. |
|---|
| 1866 | dlname= |
|---|
| 1867 | library_names= |
|---|
| 1868 | func_source "$file" |
|---|
| 1869 | |
|---|
| 1870 | # Skip this library if it cannot be dlopened. |
|---|
| 1871 | if test -z "$dlname"; then |
|---|
| 1872 | # Warn if it was a shared library. |
|---|
| 1873 | test -n "$library_names" && \ |
|---|
| 1874 | func_warning "\`$file' was not linked with \`-export-dynamic'" |
|---|
| 1875 | continue |
|---|
| 1876 | fi |
|---|
| 1877 | |
|---|
| 1878 | func_dirname "$file" "" "." |
|---|
| 1879 | dir="$func_dirname_result" |
|---|
| 1880 | |
|---|
| 1881 | if test -f "$dir/$objdir/$dlname"; then |
|---|
| 1882 | dir="$dir/$objdir" |
|---|
| 1883 | else |
|---|
| 1884 | if test ! -f "$dir/$dlname"; then |
|---|
| 1885 | func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" |
|---|
| 1886 | fi |
|---|
| 1887 | fi |
|---|
| 1888 | ;; |
|---|
| 1889 | |
|---|
| 1890 | *.lo) |
|---|
| 1891 | # Just add the directory containing the .lo file. |
|---|
| 1892 | func_dirname "$file" "" "." |
|---|
| 1893 | dir="$func_dirname_result" |
|---|
| 1894 | ;; |
|---|
| 1895 | |
|---|
| 1896 | *) |
|---|
| 1897 | func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" |
|---|
| 1898 | continue |
|---|
| 1899 | ;; |
|---|
| 1900 | esac |
|---|
| 1901 | |
|---|
| 1902 | # Get the absolute pathname. |
|---|
| 1903 | absdir=`cd "$dir" && pwd` |
|---|
| 1904 | test -n "$absdir" && dir="$absdir" |
|---|
| 1905 | |
|---|
| 1906 | # Now add the directory to shlibpath_var. |
|---|
| 1907 | if eval "test -z \"\$$shlibpath_var\""; then |
|---|
| 1908 | eval "$shlibpath_var=\"\$dir\"" |
|---|
| 1909 | else |
|---|
| 1910 | eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" |
|---|
| 1911 | fi |
|---|
| 1912 | done |
|---|
| 1913 | |
|---|
| 1914 | |
|---|
| 1915 | |
|---|
| 1916 | libtool_execute_magic="$magic" |
|---|
| 1917 | |
|---|
| 1918 | |
|---|
| 1919 | args= |
|---|
| 1920 | for file |
|---|
| 1921 | do |
|---|
| 1922 | case $file in |
|---|
| 1923 | -* | *.la | *.lo ) ;; |
|---|
| 1924 | *) |
|---|
| 1925 | |
|---|
| 1926 | if func_ltwrapper_script_p "$file"; then |
|---|
| 1927 | func_source "$file" |
|---|
| 1928 | |
|---|
| 1929 | file="$progdir/$program" |
|---|
| 1930 | elif func_ltwrapper_executable_p "$file"; then |
|---|
| 1931 | func_ltwrapper_scriptname "$file" |
|---|
| 1932 | func_source "$func_ltwrapper_scriptname_result" |
|---|
| 1933 | |
|---|
| 1934 | file="$progdir/$program" |
|---|
| 1935 | fi |
|---|
| 1936 | ;; |
|---|
| 1937 | esac |
|---|
| 1938 | |
|---|
| 1939 | func_quote_for_eval "$file" |
|---|
| 1940 | args="$args $func_quote_for_eval_result" |
|---|
| 1941 | done |
|---|
| 1942 | |
|---|
| 1943 | if test "X$opt_dry_run" = Xfalse; then |
|---|
| 1944 | if test -n "$shlibpath_var"; then |
|---|
| 1945 | |
|---|
| 1946 | eval "export $shlibpath_var" |
|---|
| 1947 | fi |
|---|
| 1948 | |
|---|
| 1949 | |
|---|
| 1950 | for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES |
|---|
| 1951 | do |
|---|
| 1952 | eval "if test \"\${save_$lt_var+set}\" = set; then |
|---|
| 1953 | $lt_var=\$save_$lt_var; export $lt_var |
|---|
| 1954 | else |
|---|
| 1955 | $lt_unset $lt_var |
|---|
| 1956 | fi" |
|---|
| 1957 | done |
|---|
| 1958 | |
|---|
| 1959 | |
|---|
| 1960 | exec_cmd="\$cmd$args" |
|---|
| 1961 | else |
|---|
| 1962 | |
|---|
| 1963 | if test -n "$shlibpath_var"; then |
|---|
| 1964 | eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" |
|---|
| 1965 | echo "export $shlibpath_var" |
|---|
| 1966 | fi |
|---|
| 1967 | $ECHO "$cmd$args" |
|---|
| 1968 | exit $EXIT_SUCCESS |
|---|
| 1969 | fi |
|---|
| 1970 | } |
|---|
| 1971 | |
|---|
| 1972 | test "$mode" = execute && func_mode_execute ${1+"$@"} |
|---|
| 1973 | |
|---|
| 1974 | |
|---|
| 1975 | |
|---|
| 1976 | func_mode_finish () |
|---|
| 1977 | { |
|---|
| 1978 | $opt_debug |
|---|
| 1979 | libdirs="$nonopt" |
|---|
| 1980 | admincmds= |
|---|
| 1981 | |
|---|
| 1982 | if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then |
|---|
| 1983 | for dir |
|---|
| 1984 | do |
|---|
| 1985 | libdirs="$libdirs $dir" |
|---|
| 1986 | done |
|---|
| 1987 | |
|---|
| 1988 | for libdir in $libdirs; do |
|---|
| 1989 | if test -n "$finish_cmds"; then |
|---|
| 1990 | |
|---|
| 1991 | func_execute_cmds "$finish_cmds" 'admincmds="$admincmds |
|---|
| 1992 | '"$cmd"'"' |
|---|
| 1993 | fi |
|---|
| 1994 | if test -n "$finish_eval"; then |
|---|
| 1995 | |
|---|
| 1996 | eval cmds=\"$finish_eval\" |
|---|
| 1997 | $opt_dry_run || eval "$cmds" || admincmds="$admincmds |
|---|
| 1998 | $cmds" |
|---|
| 1999 | fi |
|---|
| 2000 | done |
|---|
| 2001 | fi |
|---|
| 2002 | |
|---|
| 2003 | # Exit here if they wanted silent mode. |
|---|
| 2004 | $opt_silent && exit $EXIT_SUCCESS |
|---|
| 2005 | |
|---|
| 2006 | echo "----------------------------------------------------------------------" |
|---|
| 2007 | echo "Libraries have been installed in:" |
|---|
| 2008 | for libdir in $libdirs; do |
|---|
| 2009 | $ECHO " $libdir" |
|---|
| 2010 | done |
|---|
| 2011 | echo |
|---|
| 2012 | echo "If you ever happen to want to link against installed libraries" |
|---|
| 2013 | echo "in a given directory, LIBDIR, you must either use libtool, and" |
|---|
| 2014 | echo "specify the full pathname of the library, or use the \`-LLIBDIR'" |
|---|
| 2015 | echo "flag during linking and do at least one of the following:" |
|---|
| 2016 | if test -n "$shlibpath_var"; then |
|---|
| 2017 | echo " - add LIBDIR to the \`$shlibpath_var' environment variable" |
|---|
| 2018 | echo " during execution" |
|---|
| 2019 | fi |
|---|
| 2020 | if test -n "$runpath_var"; then |
|---|
| 2021 | echo " - add LIBDIR to the \`$runpath_var' environment variable" |
|---|
| 2022 | echo " during linking" |
|---|
| 2023 | fi |
|---|
| 2024 | if test -n "$hardcode_libdir_flag_spec"; then |
|---|
| 2025 | libdir=LIBDIR |
|---|
| 2026 | eval flag=\"$hardcode_libdir_flag_spec\" |
|---|
| 2027 | |
|---|
| 2028 | $ECHO " - use the \`$flag' linker flag" |
|---|
| 2029 | fi |
|---|
| 2030 | if test -n "$admincmds"; then |
|---|
| 2031 | $ECHO " - have your system administrator run these commands:$admincmds" |
|---|
| 2032 | fi |
|---|
| 2033 | if test -f /etc/ld.so.conf; then |
|---|
| 2034 | echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" |
|---|
| 2035 | fi |
|---|
| 2036 | echo |
|---|
| 2037 | |
|---|
| 2038 | echo "See any operating system documentation about shared libraries for" |
|---|
| 2039 | case $host in |
|---|
| 2040 | solaris2.[6789]|solaris2.1[0-9]) |
|---|
| 2041 | echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" |
|---|
| 2042 | echo "pages." |
|---|
| 2043 | ;; |
|---|
| 2044 | *) |
|---|
| 2045 | echo "more information, such as the ld(1) and ld.so(8) manual pages." |
|---|
| 2046 | ;; |
|---|
| 2047 | esac |
|---|
| 2048 | echo "----------------------------------------------------------------------" |
|---|
| 2049 | exit $EXIT_SUCCESS |
|---|
| 2050 | } |
|---|
| 2051 | |
|---|
| 2052 | test "$mode" = finish && func_mode_finish ${1+"$@"} |
|---|
| 2053 | |
|---|
| 2054 | |
|---|
| 2055 | # func_mode_install arg... |
|---|
| 2056 | func_mode_install () |
|---|
| 2057 | { |
|---|
| 2058 | $opt_debug |
|---|
| 2059 | # There may be an optional sh(1) argument at the beginning of |
|---|
| 2060 | # install_prog (especially on Windows NT). |
|---|
| 2061 | if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || |
|---|
| 2062 | # Allow the use of GNU shtool's install command. |
|---|
| 2063 | case $nonopt in *shtool*) :;; *) false;; esac; then |
|---|
| 2064 | # Aesthetically quote it. |
|---|
| 2065 | func_quote_for_eval "$nonopt" |
|---|
| 2066 | install_prog="$func_quote_for_eval_result " |
|---|
| 2067 | arg=$1 |
|---|
| 2068 | shift |
|---|
| 2069 | else |
|---|
| 2070 | install_prog= |
|---|
| 2071 | arg=$nonopt |
|---|
| 2072 | fi |
|---|
| 2073 | |
|---|
| 2074 | # The real first argument should be the name of the installation program. |
|---|
| 2075 | # Aesthetically quote it. |
|---|
| 2076 | func_quote_for_eval "$arg" |
|---|
| 2077 | install_prog="$install_prog$func_quote_for_eval_result" |
|---|
| 2078 | install_shared_prog=$install_prog |
|---|
| 2079 | case " $install_prog " in |
|---|
| 2080 | *[\\\ /]cp\ *) install_cp=: ;; |
|---|
| 2081 | *) install_cp=false ;; |
|---|
| 2082 | esac |
|---|
| 2083 | |
|---|
| 2084 | # We need to accept at least all the BSD install flags. |
|---|
| 2085 | dest= |
|---|
| 2086 | files= |
|---|
| 2087 | opts= |
|---|
| 2088 | prev= |
|---|
| 2089 | install_type= |
|---|
| 2090 | isdir=no |
|---|
| 2091 | stripme= |
|---|
| 2092 | no_mode=: |
|---|
| 2093 | for arg |
|---|
| 2094 | do |
|---|
| 2095 | arg2= |
|---|
| 2096 | if test -n "$dest"; then |
|---|
| 2097 | files="$files $dest" |
|---|
| 2098 | dest=$arg |
|---|
| 2099 | continue |
|---|
| 2100 | fi |
|---|
| 2101 | |
|---|
| 2102 | case $arg in |
|---|
| 2103 | -d) isdir=yes ;; |
|---|
| 2104 | -f) |
|---|
| 2105 | if $install_cp; then :; else |
|---|
| 2106 | prev=$arg |
|---|
| 2107 | fi |
|---|
| 2108 | ;; |
|---|
| 2109 | -g | -m | -o) |
|---|
| 2110 | prev=$arg |
|---|
| 2111 | ;; |
|---|
| 2112 | -s) |
|---|
| 2113 | stripme=" -s" |
|---|
| 2114 | continue |
|---|
| 2115 | ;; |
|---|
| 2116 | -*) |
|---|
| 2117 | ;; |
|---|
| 2118 | *) |
|---|
| 2119 | # If the previous option needed an argument, then skip it. |
|---|
| 2120 | if test -n "$prev"; then |
|---|
| 2121 | if test "x$prev" = x-m && test -n "$install_override_mode"; then |
|---|
| 2122 | arg2=$install_override_mode |
|---|
| 2123 | no_mode=false |
|---|
| 2124 | fi |
|---|
| 2125 | prev= |
|---|
| 2126 | else |
|---|
| 2127 | dest=$arg |
|---|
| 2128 | continue |
|---|
| 2129 | fi |
|---|
| 2130 | ;; |
|---|
| 2131 | esac |
|---|
| 2132 | |
|---|
| 2133 | # Aesthetically quote the argument. |
|---|
| 2134 | func_quote_for_eval "$arg" |
|---|
| 2135 | install_prog="$install_prog $func_quote_for_eval_result" |
|---|
| 2136 | if test -n "$arg2"; then |
|---|
| 2137 | func_quote_for_eval "$arg2" |
|---|
| 2138 | fi |
|---|
| 2139 | install_shared_prog="$install_shared_prog $func_quote_for_eval_result" |
|---|
| 2140 | done |
|---|
| 2141 | |
|---|
| 2142 | test -z "$install_prog" && \ |
|---|
| 2143 | func_fatal_help "you must specify an install program" |
|---|
| 2144 | |
|---|
| 2145 | test -n "$prev" && \ |
|---|
| 2146 | func_fatal_help "the \`$prev' option requires an argument" |
|---|
| 2147 | |
|---|
| 2148 | if test -n "$install_override_mode" && $no_mode; then |
|---|
| 2149 | if $install_cp; then :; else |
|---|
| 2150 | func_quote_for_eval "$install_override_mode" |
|---|
| 2151 | install_shared_prog="$install_shared_prog -m $func_quote_for_eval_result" |
|---|
| 2152 | fi |
|---|
| 2153 | fi |
|---|
| 2154 | |
|---|
| 2155 | if test -z "$files"; then |
|---|
| 2156 | if test -z "$dest"; then |
|---|
| 2157 | func_fatal_help "no file or destination specified" |
|---|
| 2158 | else |
|---|
| 2159 | func_fatal_help "you must specify a destination" |
|---|
| 2160 | fi |
|---|
| 2161 | fi |
|---|
| 2162 | |
|---|
| 2163 | # Strip any trailing slash from the destination. |
|---|
| 2164 | func_stripname '' '/' "$dest" |
|---|
| 2165 | dest=$func_stripname_result |
|---|
| 2166 | |
|---|
| 2167 | # Check to see that the destination is a directory. |
|---|
| 2168 | test -d "$dest" && isdir=yes |
|---|
| 2169 | if test "$isdir" = yes; then |
|---|
| 2170 | destdir="$dest" |
|---|
| 2171 | destname= |
|---|
| 2172 | else |
|---|
| 2173 | func_dirname_and_basename "$dest" "" "." |
|---|
| 2174 | destdir="$func_dirname_result" |
|---|
| 2175 | destname="$func_basename_result" |
|---|
| 2176 | |
|---|
| 2177 | # Not a directory, so check to see that there is only one file specified. |
|---|
| 2178 | set dummy $files; shift |
|---|
| 2179 | test "$ |
|---|
| 2180 | func_fatal_help "\`$dest' is not a directory" |
|---|
| 2181 | fi |
|---|
| 2182 | case $destdir in |
|---|
| 2183 | [\\/]* | [A-Za-z]:[\\/]*) ;; |
|---|
| 2184 | *) |
|---|
| 2185 | for file in $files; do |
|---|
| 2186 | case $file in |
|---|
| 2187 | *.lo) ;; |
|---|
| 2188 | *) |
|---|
| 2189 | func_fatal_help "\`$destdir' must be an absolute directory name" |
|---|
| 2190 | ;; |
|---|
| 2191 | esac |
|---|
| 2192 | done |
|---|
| 2193 | ;; |
|---|
| 2194 | esac |
|---|
| 2195 | |
|---|
| 2196 | |
|---|
| 2197 | |
|---|
| 2198 | libtool_install_magic="$magic" |
|---|
| 2199 | |
|---|
| 2200 | staticlibs= |
|---|
| 2201 | future_libdirs= |
|---|
| 2202 | current_libdirs= |
|---|
| 2203 | for file in $files; do |
|---|
| 2204 | |
|---|
| 2205 | |
|---|
| 2206 | case $file in |
|---|
| 2207 | *.$libext) |
|---|
| 2208 | |
|---|
| 2209 | staticlibs="$staticlibs $file" |
|---|
| 2210 | ;; |
|---|
| 2211 | |
|---|
| 2212 | *.la) |
|---|
| 2213 | |
|---|
| 2214 | func_lalib_unsafe_p "$file" \ |
|---|
| 2215 | || func_fatal_help "\`$file' is not a valid libtool archive" |
|---|
| 2216 | |
|---|
| 2217 | library_names= |
|---|
| 2218 | old_library= |
|---|
| 2219 | relink_command= |
|---|
| 2220 | func_source "$file" |
|---|
| 2221 | |
|---|
| 2222 | |
|---|
| 2223 | if test "X$destdir" = "X$libdir"; then |
|---|
| 2224 | case "$current_libdirs " in |
|---|
| 2225 | *" $libdir "*) ;; |
|---|
| 2226 | *) current_libdirs="$current_libdirs $libdir" ;; |
|---|
| 2227 | esac |
|---|
| 2228 | else |
|---|
| 2229 | |
|---|
| 2230 | case "$future_libdirs " in |
|---|
| 2231 | *" $libdir "*) ;; |
|---|
| 2232 | *) future_libdirs="$future_libdirs $libdir" ;; |
|---|
| 2233 | esac |
|---|
| 2234 | fi |
|---|
| 2235 | |
|---|
| 2236 | func_dirname "$file" "/" "" |
|---|
| 2237 | dir="$func_dirname_result" |
|---|
| 2238 | dir="$dir$objdir" |
|---|
| 2239 | |
|---|
| 2240 | if test -n "$relink_command"; then |
|---|
| 2241 | |
|---|
| 2242 | inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` |
|---|
| 2243 | |
|---|
| 2244 | |
|---|
| 2245 | |
|---|
| 2246 | |
|---|
| 2247 | |
|---|
| 2248 | |
|---|
| 2249 | |
|---|
| 2250 | test "$inst_prefix_dir" = "$destdir" && \ |
|---|
| 2251 | func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" |
|---|
| 2252 | |
|---|
| 2253 | if test -n "$inst_prefix_dir"; then |
|---|
| 2254 | |
|---|
| 2255 | relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` |
|---|
| 2256 | else |
|---|
| 2257 | relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` |
|---|
| 2258 | fi |
|---|
| 2259 | |
|---|
| 2260 | func_warning "relinking \`$file'" |
|---|
| 2261 | func_show_eval "$relink_command" \ |
|---|
| 2262 | 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' |
|---|
| 2263 | fi |
|---|
| 2264 | |
|---|
| 2265 | |
|---|
| 2266 | set dummy $library_names; shift |
|---|
| 2267 | if test -n "$1"; then |
|---|
| 2268 | realname="$1" |
|---|
| 2269 | shift |
|---|
| 2270 | |
|---|
| 2271 | srcname="$realname" |
|---|
| 2272 | test -n "$relink_command" && srcname="$realname"T |
|---|
| 2273 | |
|---|
| 2274 | |
|---|
| 2275 | func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ |
|---|
| 2276 | 'exit $?' |
|---|
| 2277 | tstripme="$stripme" |
|---|
| 2278 | case $host_os in |
|---|
| 2279 | cygwin* | mingw* | pw32* | cegcc*) |
|---|
| 2280 | case $realname in |
|---|
| 2281 | *.dll.a) |
|---|
| 2282 | tstripme="" |
|---|
| 2283 | ;; |
|---|
| 2284 | esac |
|---|
| 2285 | ;; |
|---|
| 2286 | esac |
|---|
| 2287 | if test -n "$tstripme" && test -n "$striplib"; then |
|---|
| 2288 | func_show_eval "$striplib $destdir/$realname" 'exit $?' |
|---|
| 2289 | fi |
|---|
| 2290 | |
|---|
| 2291 | if test "$#" -gt 0; then |
|---|
| 2292 | |
|---|
| 2293 | |
|---|
| 2294 | |
|---|
| 2295 | |
|---|
| 2296 | for linkname |
|---|
| 2297 | do |
|---|
| 2298 | test "$linkname" != "$realname" \ |
|---|
| 2299 | && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" |
|---|
| 2300 | done |
|---|
| 2301 | fi |
|---|
| 2302 | |
|---|
| 2303 | |
|---|
| 2304 | lib="$destdir/$realname" |
|---|
| 2305 | func_execute_cmds "$postinstall_cmds" 'exit $?' |
|---|
| 2306 | fi |
|---|
| 2307 | |
|---|
| 2308 | |
|---|
| 2309 | func_basename "$file" |
|---|
| 2310 | name="$func_basename_result" |
|---|
| 2311 | instname="$dir/$name"i |
|---|
| 2312 | func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' |
|---|
| 2313 | |
|---|
| 2314 | |
|---|
| 2315 | test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" |
|---|
| 2316 | ;; |
|---|
| 2317 | |
|---|
| 2318 | *.lo) |
|---|
| 2319 | |
|---|
| 2320 | |
|---|
| 2321 | |
|---|
| 2322 | if test -n "$destname"; then |
|---|
| 2323 | destfile="$destdir/$destname" |
|---|
| 2324 | else |
|---|
| 2325 | func_basename "$file" |
|---|
| 2326 | destfile="$func_basename_result" |
|---|
| 2327 | destfile="$destdir/$destfile" |
|---|
| 2328 | fi |
|---|
| 2329 | |
|---|
| 2330 | |
|---|
| 2331 | case $destfile in |
|---|
| 2332 | *.lo) |
|---|
| 2333 | func_lo2o "$destfile" |
|---|
| 2334 | staticdest=$func_lo2o_result |
|---|
| 2335 | ;; |
|---|
| 2336 | *.$objext) |
|---|
| 2337 | staticdest="$destfile" |
|---|
| 2338 | destfile= |
|---|
| 2339 | ;; |
|---|
| 2340 | *) |
|---|
| 2341 | func_fatal_help "cannot copy a libtool object to \`$destfile'" |
|---|
| 2342 | ;; |
|---|
| 2343 | esac |
|---|
| 2344 | |
|---|
| 2345 | |
|---|
| 2346 | test -n "$destfile" && \ |
|---|
| 2347 | func_show_eval "$install_prog $file $destfile" 'exit $?' |
|---|
| 2348 | |
|---|
| 2349 | |
|---|
| 2350 | if test "$build_old_libs" = yes; then |
|---|
| 2351 | |
|---|
| 2352 | func_lo2o "$file" |
|---|
| 2353 | staticobj=$func_lo2o_result |
|---|
| 2354 | func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' |
|---|
| 2355 | fi |
|---|
| 2356 | exit $EXIT_SUCCESS |
|---|
| 2357 | ;; |
|---|
| 2358 | |
|---|
| 2359 | *) |
|---|
| 2360 | |
|---|
| 2361 | if test -n "$destname"; then |
|---|
| 2362 | destfile="$destdir/$destname" |
|---|
| 2363 | else |
|---|
| 2364 | func_basename "$file" |
|---|
| 2365 | destfile="$func_basename_result" |
|---|
| 2366 | destfile="$destdir/$destfile" |
|---|
| 2367 | fi |
|---|
| 2368 | |
|---|
| 2369 | |
|---|
| 2370 | |
|---|
| 2371 | |
|---|
| 2372 | stripped_ext="" |
|---|
| 2373 | case $file in |
|---|
| 2374 | *.exe) |
|---|
| 2375 | if test ! -f "$file"; then |
|---|
| 2376 | func_stripname '' '.exe' "$file" |
|---|
| 2377 | file=$func_stripname_result |
|---|
| 2378 | stripped_ext=".exe" |
|---|
| 2379 | fi |
|---|
| 2380 | ;; |
|---|
| 2381 | esac |
|---|
| 2382 | |
|---|
| 2383 | |
|---|
| 2384 | case $host in |
|---|
| 2385 | *cygwin* | *mingw*) |
|---|
| 2386 | if func_ltwrapper_executable_p "$file"; then |
|---|
| 2387 | func_ltwrapper_scriptname "$file" |
|---|
| 2388 | wrapper=$func_ltwrapper_scriptname_result |
|---|
| 2389 | else |
|---|
| 2390 | func_stripname '' '.exe' "$file" |
|---|
| 2391 | wrapper=$func_stripname_result |
|---|
| 2392 | fi |
|---|
| 2393 | ;; |
|---|
| 2394 | *) |
|---|
| 2395 | wrapper=$file |
|---|
| 2396 | ;; |
|---|
| 2397 | esac |
|---|
| 2398 | if func_ltwrapper_script_p "$wrapper"; then |
|---|
| 2399 | notinst_deplibs= |
|---|
| 2400 | relink_command= |
|---|
| 2401 | |
|---|
| 2402 | func_source "$wrapper" |
|---|
| 2403 | |
|---|
| 2404 | |
|---|
| 2405 | test -z "$generated_by_libtool_version" && \ |
|---|
| 2406 | func_fatal_error "invalid libtool wrapper script \`$wrapper'" |
|---|
| 2407 | |
|---|
| 2408 | finalize=yes |
|---|
| 2409 | for lib in $notinst_deplibs; do |
|---|
| 2410 | |
|---|
| 2411 | libdir= |
|---|
| 2412 | if test -f "$lib"; then |
|---|
| 2413 | func_source "$lib" |
|---|
| 2414 | fi |
|---|
| 2415 | libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` |
|---|
| 2416 | if test -n "$libdir" && test ! -f "$libfile"; then |
|---|
| 2417 | func_warning "\`$lib' has not been installed in \`$libdir'" |
|---|
| 2418 | finalize=no |
|---|
| 2419 | fi |
|---|
| 2420 | done |
|---|
| 2421 | |
|---|
| 2422 | relink_command= |
|---|
| 2423 | func_source "$wrapper" |
|---|
| 2424 | |
|---|
| 2425 | outputname= |
|---|
| 2426 | if test "$fast_install" = no && test -n "$relink_command"; then |
|---|
| 2427 | $opt_dry_run || { |
|---|
| 2428 | if test "$finalize" = yes; then |
|---|
| 2429 | tmpdir=`func_mktempdir` |
|---|
| 2430 | func_basename "$file$stripped_ext" |
|---|
| 2431 | file="$func_basename_result" |
|---|
| 2432 | outputname="$tmpdir/$file" |
|---|
| 2433 | |
|---|
| 2434 | relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` |
|---|
| 2435 | |
|---|
| 2436 | $opt_silent || { |
|---|
| 2437 | func_quote_for_expand "$relink_command" |
|---|
| 2438 | eval "func_echo $func_quote_for_expand_result" |
|---|
| 2439 | } |
|---|
| 2440 | if eval "$relink_command"; then : |
|---|
| 2441 | else |
|---|
| 2442 | func_error "error: relink \`$file' with the above command before installing it" |
|---|
| 2443 | $opt_dry_run || ${RM}r "$tmpdir" |
|---|
| 2444 | continue |
|---|
| 2445 | fi |
|---|
| 2446 | file="$outputname" |
|---|
| 2447 | else |
|---|
| 2448 | func_warning "cannot relink \`$file'" |
|---|
| 2449 | fi |
|---|
| 2450 | } |
|---|
| 2451 | else |
|---|
| 2452 | |
|---|
| 2453 | file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` |
|---|
| 2454 | fi |
|---|
| 2455 | fi |
|---|
| 2456 | |
|---|
| 2457 | |
|---|
| 2458 | |
|---|
| 2459 | case $install_prog,$host in |
|---|
| 2460 | */usr/bin/install*,*cygwin*) |
|---|
| 2461 | case $file:$destfile in |
|---|
| 2462 | *.exe:*.exe) |
|---|
| 2463 | |
|---|
| 2464 | ;; |
|---|
| 2465 | *.exe:*) |
|---|
| 2466 | destfile=$destfile.exe |
|---|
| 2467 | ;; |
|---|
| 2468 | *:*.exe) |
|---|
| 2469 | func_stripname '' '.exe' "$destfile" |
|---|
| 2470 | destfile=$func_stripname_result |
|---|
| 2471 | ;; |
|---|
| 2472 | esac |
|---|
| 2473 | ;; |
|---|
| 2474 | esac |
|---|
| 2475 | func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' |
|---|
| 2476 | $opt_dry_run || if test -n "$outputname"; then |
|---|
| 2477 | ${RM}r "$tmpdir" |
|---|
| 2478 | fi |
|---|
| 2479 | ;; |
|---|
| 2480 | esac |
|---|
| 2481 | done |
|---|
| 2482 | |
|---|
| 2483 | for file in $staticlibs; do |
|---|
| 2484 | func_basename "$file" |
|---|
| 2485 | name="$func_basename_result" |
|---|
| 2486 | |
|---|
| 2487 | |
|---|
| 2488 | oldlib="$destdir/$name" |
|---|
| 2489 | |
|---|
| 2490 | func_show_eval "$install_prog \$file \$oldlib" 'exit $?' |
|---|
| 2491 | |
|---|
| 2492 | if test -n "$stripme" && test -n "$old_striplib"; then |
|---|
| 2493 | func_show_eval "$old_striplib $oldlib" 'exit $?' |
|---|
| 2494 | fi |
|---|
| 2495 | |
|---|
| 2496 | |
|---|
| 2497 | func_execute_cmds "$old_postinstall_cmds" 'exit $?' |
|---|
| 2498 | done |
|---|
| 2499 | |
|---|
| 2500 | test -n "$future_libdirs" && \ |
|---|
| 2501 | func_warning "remember to run \`$progname --finish$future_libdirs'" |
|---|
| 2502 | |
|---|
| 2503 | if test -n "$current_libdirs"; then |
|---|
| 2504 | |
|---|
| 2505 | $opt_dry_run && current_libdirs=" -n$current_libdirs" |
|---|
| 2506 | exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' |
|---|
| 2507 | else |
|---|
| 2508 | exit $EXIT_SUCCESS |
|---|
| 2509 | fi |
|---|
| 2510 | } |
|---|
| 2511 | |
|---|
| 2512 | test "$mode" = install && func_mode_install ${1+"$@"} |
|---|
| 2513 | |
|---|
| 2514 | |
|---|
| 2515 | |
|---|
| 2516 | |
|---|
| 2517 | |
|---|
| 2518 | func_generate_dlsyms () |
|---|
| 2519 | { |
|---|
| 2520 | $opt_debug |
|---|
| 2521 | my_outputname="$1" |
|---|
| 2522 | my_originator="$2" |
|---|
| 2523 | my_pic_p="${3-no}" |
|---|
| 2524 | my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` |
|---|
| 2525 | my_dlsyms= |
|---|
| 2526 | |
|---|
| 2527 | if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then |
|---|
| 2528 | if test -n "$NM" && test -n "$global_symbol_pipe"; then |
|---|
| 2529 | my_dlsyms="${my_outputname}S.c" |
|---|
| 2530 | else |
|---|
| 2531 | func_error "not configured to extract global symbols from dlpreopened files" |
|---|
| 2532 | fi |
|---|
| 2533 | fi |
|---|
| 2534 | |
|---|
| 2535 | if test -n "$my_dlsyms"; then |
|---|
| 2536 | case $my_dlsyms in |
|---|
| 2537 | "") ;; |
|---|
| 2538 | *.c) |
|---|
| 2539 | |
|---|
| 2540 | nlist="$output_objdir/${my_outputname}.nm" |
|---|
| 2541 | |
|---|
| 2542 | func_show_eval "$RM $nlist ${nlist}S ${nlist}T" |
|---|
| 2543 | |
|---|
| 2544 | |
|---|
| 2545 | func_verbose "creating $output_objdir/$my_dlsyms" |
|---|
| 2546 | |
|---|
| 2547 | $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ |
|---|
| 2548 | /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ |
|---|
| 2549 | /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ |
|---|
| 2550 | |
|---|
| 2551 | #ifdef __cplusplus |
|---|
| 2552 | extern \"C\" { |
|---|
| 2553 | #endif |
|---|
| 2554 | |
|---|
| 2555 | #if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) |
|---|
| 2556 | #pragma GCC diagnostic ignored \"-Wstrict-prototypes\" |
|---|
| 2557 | #endif |
|---|
| 2558 | |
|---|
| 2559 | /* External symbol declarations for the compiler. */\ |
|---|
| 2560 | " |
|---|
| 2561 | |
|---|
| 2562 | if test "$dlself" = yes; then |
|---|
| 2563 | func_verbose "generating symbol list for \`$output'" |
|---|
| 2564 | |
|---|
| 2565 | $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" |
|---|
| 2566 | |
|---|
| 2567 | |
|---|
| 2568 | progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` |
|---|
| 2569 | for progfile in $progfiles; do |
|---|
| 2570 | func_verbose "extracting global C symbols from \`$progfile'" |
|---|
| 2571 | $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'" |
|---|
| 2572 | done |
|---|
| 2573 | |
|---|
| 2574 | if test -n "$exclude_expsyms"; then |
|---|
| 2575 | $opt_dry_run || { |
|---|
| 2576 | eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' |
|---|
| 2577 | eval '$MV "$nlist"T "$nlist"' |
|---|
| 2578 | } |
|---|
| 2579 | fi |
|---|
| 2580 | |
|---|
| 2581 | if test -n "$export_symbols_regex"; then |
|---|
| 2582 | $opt_dry_run || { |
|---|
| 2583 | eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' |
|---|
| 2584 | eval '$MV "$nlist"T "$nlist"' |
|---|
| 2585 | } |
|---|
| 2586 | fi |
|---|
| 2587 | |
|---|
| 2588 | |
|---|
| 2589 | if test -z "$export_symbols"; then |
|---|
| 2590 | export_symbols="$output_objdir/$outputname.exp" |
|---|
| 2591 | $opt_dry_run || { |
|---|
| 2592 | $RM $export_symbols |
|---|
| 2593 | eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' |
|---|
| 2594 | case $host in |
|---|
| 2595 | *cygwin* | *mingw* | *cegcc* ) |
|---|
| 2596 | eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' |
|---|
| 2597 | eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' |
|---|
| 2598 | ;; |
|---|
| 2599 | esac |
|---|
| 2600 | } |
|---|
| 2601 | else |
|---|
| 2602 | $opt_dry_run || { |
|---|
| 2603 | eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' |
|---|
| 2604 | eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' |
|---|
| 2605 | eval '$MV "$nlist"T "$nlist"' |
|---|
| 2606 | case $host in |
|---|
| 2607 | *cygwin* | *mingw* | *cegcc* ) |
|---|
| 2608 | eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' |
|---|
| 2609 | eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' |
|---|
| 2610 | ;; |
|---|
| 2611 | esac |
|---|
| 2612 | } |
|---|
| 2613 | fi |
|---|
| 2614 | fi |
|---|
| 2615 | |
|---|
| 2616 | for dlprefile in $dlprefiles; do |
|---|
| 2617 | func_verbose "extracting global C symbols from \`$dlprefile'" |
|---|
| 2618 | func_basename "$dlprefile" |
|---|
| 2619 | name="$func_basename_result" |
|---|
| 2620 | $opt_dry_run || { |
|---|
| 2621 | eval '$ECHO ": $name " >> "$nlist"' |
|---|
| 2622 | eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'" |
|---|
| 2623 | } |
|---|
| 2624 | done |
|---|
| 2625 | |
|---|
| 2626 | $opt_dry_run || { |
|---|
| 2627 | |
|---|
| 2628 | test -f "$nlist" || : > "$nlist" |
|---|
| 2629 | |
|---|
| 2630 | if test -n "$exclude_expsyms"; then |
|---|
| 2631 | $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T |
|---|
| 2632 | $MV "$nlist"T "$nlist" |
|---|
| 2633 | fi |
|---|
| 2634 | |
|---|
| 2635 | |
|---|
| 2636 | if $GREP -v "^: " < "$nlist" | |
|---|
| 2637 | if sort -k 3 </dev/null >/dev/null 2>&1; then |
|---|
| 2638 | sort -k 3 |
|---|
| 2639 | else |
|---|
| 2640 | sort +2 |
|---|
| 2641 | fi | |
|---|
| 2642 | uniq > "$nlist"S; then |
|---|
| 2643 | : |
|---|
| 2644 | else |
|---|
| 2645 | $GREP -v "^: " < "$nlist" > "$nlist"S |
|---|
| 2646 | fi |
|---|
| 2647 | |
|---|
| 2648 | if test -f "$nlist"S; then |
|---|
| 2649 | eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' |
|---|
| 2650 | else |
|---|
| 2651 | echo '/* NONE */' >> "$output_objdir/$my_dlsyms" |
|---|
| 2652 | fi |
|---|
| 2653 | |
|---|
| 2654 | echo >> "$output_objdir/$my_dlsyms" "\ |
|---|
| 2655 | |
|---|
| 2656 | /* The mapping between symbol names and symbols. */ |
|---|
| 2657 | typedef struct { |
|---|
| 2658 | const char *name; |
|---|
| 2659 | void *address; |
|---|
| 2660 | } lt_dlsymlist; |
|---|
| 2661 | " |
|---|
| 2662 | case $host in |
|---|
| 2663 | *cygwin* | *mingw* | *cegcc* ) |
|---|
| 2664 | echo >> "$output_objdir/$my_dlsyms" "\ |
|---|
| 2665 | /* DATA imports from DLLs on WIN32 con't be const, because |
|---|
| 2666 | runtime relocations are performed -- see ld's documentation |
|---|
| 2667 | on pseudo-relocs. */" |
|---|
| 2668 | lt_dlsym_const= ;; |
|---|
| 2669 | *osf5*) |
|---|
| 2670 | echo >> "$output_objdir/$my_dlsyms" "\ |
|---|
| 2671 | /* This system does not cope well with relocations in const data */" |
|---|
| 2672 | lt_dlsym_const= ;; |
|---|
| 2673 | *) |
|---|
| 2674 | lt_dlsym_const=const ;; |
|---|
| 2675 | esac |
|---|
| 2676 | |
|---|
| 2677 | echo >> "$output_objdir/$my_dlsyms" "\ |
|---|
| 2678 | extern $lt_dlsym_const lt_dlsymlist |
|---|
| 2679 | lt_${my_prefix}_LTX_preloaded_symbols[]; |
|---|
| 2680 | $lt_dlsym_const lt_dlsymlist |
|---|
| 2681 | lt_${my_prefix}_LTX_preloaded_symbols[] = |
|---|
| 2682 | {\ |
|---|
| 2683 | { \"$my_originator\", (void *) 0 }," |
|---|
| 2684 | |
|---|
| 2685 | case $need_lib_prefix in |
|---|
| 2686 | no) |
|---|
| 2687 | eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" |
|---|
| 2688 | ;; |
|---|
| 2689 | *) |
|---|
| 2690 | eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" |
|---|
| 2691 | ;; |
|---|
| 2692 | esac |
|---|
| 2693 | echo >> "$output_objdir/$my_dlsyms" "\ |
|---|
| 2694 | {0, (void *) 0} |
|---|
| 2695 | }; |
|---|
| 2696 | |
|---|
| 2697 | /* This works around a problem in FreeBSD linker */ |
|---|
| 2698 | #ifdef FREEBSD_WORKAROUND |
|---|
| 2699 | static const void *lt_preloaded_setup() { |
|---|
| 2700 | return lt_${my_prefix}_LTX_preloaded_symbols; |
|---|
| 2701 | } |
|---|
| 2702 | #endif |
|---|
| 2703 | |
|---|
| 2704 | #ifdef __cplusplus |
|---|
| 2705 | } |
|---|
| 2706 | #endif\ |
|---|
| 2707 | " |
|---|
| 2708 | } |
|---|
| 2709 | |
|---|
| 2710 | pic_flag_for_symtable= |
|---|
| 2711 | case "$compile_command " in |
|---|
| 2712 | *" -static "*) ;; |
|---|
| 2713 | *) |
|---|
| 2714 | case $host in |
|---|
| 2715 | |
|---|
| 2716 | |
|---|
| 2717 | |
|---|
| 2718 | |
|---|
| 2719 | |
|---|
| 2720 | *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) |
|---|
| 2721 | pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; |
|---|
| 2722 | *-*-hpux*) |
|---|
| 2723 | pic_flag_for_symtable=" $pic_flag" ;; |
|---|
| 2724 | *) |
|---|
| 2725 | if test "X$my_pic_p" != Xno; then |
|---|
| 2726 | pic_flag_for_symtable=" $pic_flag" |
|---|
| 2727 | fi |
|---|
| 2728 | ;; |
|---|
| 2729 | esac |
|---|
| 2730 | ;; |
|---|
| 2731 | esac |
|---|
| 2732 | symtab_cflags= |
|---|
| 2733 | for arg in $LTCFLAGS; do |
|---|
| 2734 | case $arg in |
|---|
| 2735 | -pie | -fpie | -fPIE) ;; |
|---|
| 2736 | *) symtab_cflags="$symtab_cflags $arg" ;; |
|---|
| 2737 | esac |
|---|
| 2738 | done |
|---|
| 2739 | |
|---|
| 2740 | |
|---|
| 2741 | func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' |
|---|
| 2742 | |
|---|
| 2743 | |
|---|
| 2744 | func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' |
|---|
| 2745 | |
|---|
| 2746 | |
|---|
| 2747 | symfileobj="$output_objdir/${my_outputname}S.$objext" |
|---|
| 2748 | case $host in |
|---|
| 2749 | *cygwin* | *mingw* | *cegcc* ) |
|---|
| 2750 | if test -f "$output_objdir/$my_outputname.def"; then |
|---|
| 2751 | compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` |
|---|
| 2752 | finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` |
|---|
| 2753 | else |
|---|
| 2754 | compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` |
|---|
| 2755 | finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` |
|---|
| 2756 | fi |
|---|
| 2757 | ;; |
|---|
| 2758 | *) |
|---|
| 2759 | compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` |
|---|
| 2760 | finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` |
|---|
| 2761 | ;; |
|---|
| 2762 | esac |
|---|
| 2763 | ;; |
|---|
| 2764 | *) |
|---|
| 2765 | func_fatal_error "unknown suffix for \`$my_dlsyms'" |
|---|
| 2766 | ;; |
|---|
| 2767 | esac |
|---|
| 2768 | else |
|---|
| 2769 | |
|---|
| 2770 | |
|---|
| 2771 | |
|---|
| 2772 | |
|---|
| 2773 | |
|---|
| 2774 | compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` |
|---|
| 2775 | finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` |
|---|
| 2776 | fi |
|---|
| 2777 | } |
|---|
| 2778 | |
|---|
| 2779 | |
|---|
| 2780 | |
|---|
| 2781 | |
|---|
| 2782 | |
|---|
| 2783 | |
|---|
| 2784 | |
|---|
| 2785 | |
|---|
| 2786 | func_win32_libid () |
|---|
| 2787 | { |
|---|
| 2788 | $opt_debug |
|---|
| 2789 | win32_libid_type="unknown" |
|---|
| 2790 | win32_fileres=`file -L $1 2>/dev/null` |
|---|
| 2791 | case $win32_fileres in |
|---|
| 2792 | *ar\ archive\ import\ library*) |
|---|
| 2793 | win32_libid_type="x86 archive import" |
|---|
| 2794 | ;; |
|---|
| 2795 | *ar\ archive*) |
|---|
| 2796 | if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | |
|---|
| 2797 | $EGREP 'file format (pe-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then |
|---|
| 2798 | win32_nmres=`eval $NM -f posix -A $1 | |
|---|
| 2799 | $SED -n -e ' |
|---|
| 2800 | 1,100{ |
|---|
| 2801 | / I /{ |
|---|
| 2802 | s,.*,import, |
|---|
| 2803 | p |
|---|
| 2804 | q |
|---|
| 2805 | } |
|---|
| 2806 | }'` |
|---|
| 2807 | case $win32_nmres in |
|---|
| 2808 | import*) win32_libid_type="x86 archive import";; |
|---|
| 2809 | *) win32_libid_type="x86 archive static";; |
|---|
| 2810 | esac |
|---|
| 2811 | fi |
|---|
| 2812 | ;; |
|---|
| 2813 | *DLL*) |
|---|
| 2814 | win32_libid_type="x86 DLL" |
|---|
| 2815 | ;; |
|---|
| 2816 | *executable*) |
|---|
| 2817 | case $win32_fileres in |
|---|
| 2818 | *MS\ Windows\ PE\ Intel*) |
|---|
| 2819 | win32_libid_type="x86 DLL" |
|---|
| 2820 | ;; |
|---|
| 2821 | esac |
|---|
| 2822 | ;; |
|---|
| 2823 | esac |
|---|
| 2824 | $ECHO "$win32_libid_type" |
|---|
| 2825 | } |
|---|
| 2826 | |
|---|
| 2827 | |
|---|
| 2828 | |
|---|
| 2829 | |
|---|
| 2830 | func_extract_an_archive () |
|---|
| 2831 | { |
|---|
| 2832 | $opt_debug |
|---|
| 2833 | f_ex_an_ar_dir="$1"; shift |
|---|
| 2834 | f_ex_an_ar_oldlib="$1" |
|---|
| 2835 | if test "$lock_old_archive_extraction" = yes; then |
|---|
| 2836 | lockfile=$f_ex_an_ar_oldlib.lock |
|---|
| 2837 | until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do |
|---|
| 2838 | func_echo "Waiting for $lockfile to be removed" |
|---|
| 2839 | sleep 2 |
|---|
| 2840 | done |
|---|
| 2841 | fi |
|---|
| 2842 | func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ |
|---|
| 2843 | 'stat=$?; rm -f "$lockfile"; exit $stat' |
|---|
| 2844 | if test "$lock_old_archive_extraction" = yes; then |
|---|
| 2845 | $opt_dry_run || rm -f "$lockfile" |
|---|
| 2846 | fi |
|---|
| 2847 | if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then |
|---|
| 2848 | : |
|---|
| 2849 | else |
|---|
| 2850 | func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" |
|---|
| 2851 | fi |
|---|
| 2852 | } |
|---|
| 2853 | |
|---|
| 2854 | |
|---|
| 2855 | |
|---|
| 2856 | func_extract_archives () |
|---|
| 2857 | { |
|---|
| 2858 | $opt_debug |
|---|
| 2859 | my_gentop="$1"; shift |
|---|
| 2860 | my_oldlibs=${1+"$@"} |
|---|
| 2861 | my_oldobjs="" |
|---|
| 2862 | my_xlib="" |
|---|
| 2863 | my_xabs="" |
|---|
| 2864 | my_xdir="" |
|---|
| 2865 | |
|---|
| 2866 | for my_xlib in $my_oldlibs; do |
|---|
| 2867 | |
|---|
| 2868 | case $my_xlib in |
|---|
| 2869 | [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; |
|---|
| 2870 | *) my_xabs=`pwd`"/$my_xlib" ;; |
|---|
| 2871 | esac |
|---|
| 2872 | func_basename "$my_xlib" |
|---|
| 2873 | my_xlib="$func_basename_result" |
|---|
| 2874 | my_xlib_u=$my_xlib |
|---|
| 2875 | while :; do |
|---|
| 2876 | case " $extracted_archives " in |
|---|
| 2877 | *" $my_xlib_u "*) |
|---|
| 2878 | func_arith $extracted_serial + 1 |
|---|
| 2879 | extracted_serial=$func_arith_result |
|---|
| 2880 | my_xlib_u=lt$extracted_serial-$my_xlib ;; |
|---|
| 2881 | *) break ;; |
|---|
| 2882 | esac |
|---|
| 2883 | done |
|---|
| 2884 | extracted_archives="$extracted_archives $my_xlib_u" |
|---|
| 2885 | my_xdir="$my_gentop/$my_xlib_u" |
|---|
| 2886 | |
|---|
| 2887 | func_mkdir_p "$my_xdir" |
|---|
| 2888 | |
|---|
| 2889 | case $host in |
|---|
| 2890 | *-darwin*) |
|---|
| 2891 | func_verbose "Extracting $my_xabs" |
|---|
| 2892 | |
|---|
| 2893 | $opt_dry_run || { |
|---|
| 2894 | darwin_orig_dir=`pwd` |
|---|
| 2895 | cd $my_xdir || exit $? |
|---|
| 2896 | darwin_archive=$my_xabs |
|---|
| 2897 | darwin_curdir=`pwd` |
|---|
| 2898 | darwin_base_archive=`basename "$darwin_archive"` |
|---|
| 2899 | darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` |
|---|
| 2900 | if test -n "$darwin_arches"; then |
|---|
| 2901 | darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` |
|---|
| 2902 | darwin_arch= |
|---|
| 2903 | func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" |
|---|
| 2904 | for darwin_arch in $darwin_arches ; do |
|---|
| 2905 | func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" |
|---|
| 2906 | $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" |
|---|
| 2907 | cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" |
|---|
| 2908 | func_extract_an_archive "`pwd`" "${darwin_base_archive}" |
|---|
| 2909 | cd "$darwin_curdir" |
|---|
| 2910 | $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" |
|---|
| 2911 | done |
|---|
| 2912 | |
|---|
| 2913 | darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` |
|---|
| 2914 | darwin_file= |
|---|
| 2915 | darwin_files= |
|---|
| 2916 | for darwin_file in $darwin_filelist; do |
|---|
| 2917 | darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` |
|---|
| 2918 | $LIPO -create -output "$darwin_file" $darwin_files |
|---|
| 2919 | done |
|---|
| 2920 | $RM -rf unfat-$$ |
|---|
| 2921 | cd "$darwin_orig_dir" |
|---|
| 2922 | else |
|---|
| 2923 | cd $darwin_orig_dir |
|---|
| 2924 | func_extract_an_archive "$my_xdir" "$my_xabs" |
|---|
| 2925 | fi |
|---|
| 2926 | } |
|---|
| 2927 | ;; |
|---|
| 2928 | *) |
|---|
| 2929 | func_extract_an_archive "$my_xdir" "$my_xabs" |
|---|
| 2930 | ;; |
|---|
| 2931 | esac |
|---|
| 2932 | my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` |
|---|
| 2933 | done |
|---|
| 2934 | |
|---|
| 2935 | func_extract_archives_result="$my_oldobjs" |
|---|
| 2936 | } |
|---|
| 2937 | |
|---|
| 2938 | |
|---|
| 2939 | |
|---|
| 2940 | |
|---|
| 2941 | |
|---|
| 2942 | |
|---|
| 2943 | |
|---|
| 2944 | |
|---|
| 2945 | |
|---|
| 2946 | |
|---|
| 2947 | |
|---|
| 2948 | |
|---|
| 2949 | |
|---|
| 2950 | |
|---|
| 2951 | |
|---|
| 2952 | |
|---|
| 2953 | func_emit_wrapper () |
|---|
| 2954 | { |
|---|
| 2955 | func_emit_wrapper_arg1=${1-no} |
|---|
| 2956 | |
|---|
| 2957 | $ECHO "\ |
|---|
| 2958 | #! $SHELL |
|---|
| 2959 | |
|---|
| 2960 | # $output - temporary wrapper script for $objdir/$outputname |
|---|
| 2961 | # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION |
|---|
| 2962 | # |
|---|
| 2963 | # The $output program cannot be directly executed until all the libtool |
|---|
| 2964 | # libraries that it depends on are installed. |
|---|
| 2965 | # |
|---|
| 2966 | # This wrapper script should never be moved out of the build directory. |
|---|
| 2967 | # If it is, it will not operate correctly. |
|---|
| 2968 | |
|---|
| 2969 | # Sed substitution that helps us do robust quoting. It backslashifies |
|---|
| 2970 | # metacharacters that are still active within double-quoted strings. |
|---|
| 2971 | sed_quote_subst='$sed_quote_subst' |
|---|
| 2972 | |
|---|
| 2973 | # Be Bourne compatible |
|---|
| 2974 | if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then |
|---|
| 2975 | emulate sh |
|---|
| 2976 | NULLCMD=: |
|---|
| 2977 | # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which |
|---|
| 2978 | # is contrary to our usage. Disable this feature. |
|---|
| 2979 | alias -g '\${1+\"\$@\"}'='\"\$@\"' |
|---|
| 2980 | setopt NO_GLOB_SUBST |
|---|
| 2981 | else |
|---|
| 2982 | case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac |
|---|
| 2983 | fi |
|---|
| 2984 | BIN_SH=xpg4; export BIN_SH # for Tru64 |
|---|
| 2985 | DUALCASE=1; export DUALCASE # for MKS sh |
|---|
| 2986 | |
|---|
| 2987 | # The HP-UX ksh and POSIX shell print the target directory to stdout |
|---|
| 2988 | # if CDPATH is set. |
|---|
| 2989 | (unset CDPATH) >/dev/null 2>&1 && unset CDPATH |
|---|
| 2990 | |
|---|
| 2991 | relink_command=\"$relink_command\" |
|---|
| 2992 | |
|---|
| 2993 | # This environment variable determines our operation mode. |
|---|
| 2994 | if test \"\$libtool_install_magic\" = \"$magic\"; then |
|---|
| 2995 | # install mode needs the following variables: |
|---|
| 2996 | generated_by_libtool_version='$macro_version' |
|---|
| 2997 | notinst_deplibs='$notinst_deplibs' |
|---|
| 2998 | else |
|---|
| 2999 | # When we are sourced in execute mode, \$file and \$ECHO are already set. |
|---|
| 3000 | if test \"\$libtool_execute_magic\" != \"$magic\"; then |
|---|
| 3001 | file=\"\$0\"" |
|---|
| 3002 | |
|---|
| 3003 | qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` |
|---|
| 3004 | $ECHO "\ |
|---|
| 3005 | |
|---|
| 3006 | # A function that is used when there is no print builtin or printf. |
|---|
| 3007 | func_fallback_echo () |
|---|
| 3008 | { |
|---|
| 3009 | eval 'cat <<_LTECHO_EOF |
|---|
| 3010 | \$1 |
|---|
| 3011 | _LTECHO_EOF' |
|---|
| 3012 | } |
|---|
| 3013 | ECHO=\"$qECHO\" |
|---|
| 3014 | fi\ |
|---|
| 3015 | |
|---|
| 3016 | # Find the directory that this script lives in. |
|---|
| 3017 | thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` |
|---|
| 3018 | test \"x\$thisdir\" = \"x\$file\" && thisdir=. |
|---|
| 3019 | |
|---|
| 3020 | # Follow symbolic links until we get to the real thisdir. |
|---|
| 3021 | file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` |
|---|
| 3022 | while test -n \"\$file\"; do |
|---|
| 3023 | destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` |
|---|
| 3024 | |
|---|
| 3025 | # If there was a directory component, then change thisdir. |
|---|
| 3026 | if test \"x\$destdir\" != \"x\$file\"; then |
|---|
| 3027 | case \"\$destdir\" in |
|---|
| 3028 | [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; |
|---|
| 3029 | *) thisdir=\"\$thisdir/\$destdir\" ;; |
|---|
| 3030 | esac |
|---|
| 3031 | fi |
|---|
| 3032 | |
|---|
| 3033 | file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` |
|---|
| 3034 | file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` |
|---|
| 3035 | done |
|---|
| 3036 | |
|---|
| 3037 | # Usually 'no', except on cygwin/mingw when embedded into |
|---|
| 3038 | # the cwrapper. |
|---|
| 3039 | WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 |
|---|
| 3040 | if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then |
|---|
| 3041 | # special case for '.' |
|---|
| 3042 | if test \"\$thisdir\" = \".\"; then |
|---|
| 3043 | thisdir=\`pwd\` |
|---|
| 3044 | fi |
|---|
| 3045 | # remove .libs from thisdir |
|---|
| 3046 | case \"\$thisdir\" in |
|---|
| 3047 | *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; |
|---|
| 3048 | $objdir ) thisdir=. ;; |
|---|
| 3049 | esac |
|---|
| 3050 | fi |
|---|
| 3051 | |
|---|
| 3052 | # Try to get the absolute directory name. |
|---|
| 3053 | absdir=\`cd \"\$thisdir\" && pwd\` |
|---|
| 3054 | test -n \"\$absdir\" && thisdir=\"\$absdir\" |
|---|
| 3055 | " |
|---|
| 3056 | |
|---|
| 3057 | if test "$fast_install" = yes; then |
|---|
| 3058 | $ECHO "\ |
|---|
| 3059 | program=lt-'$outputname'$exeext |
|---|
| 3060 | progdir=\"\$thisdir/$objdir\" |
|---|
| 3061 | |
|---|
| 3062 | if test ! -f \"\$progdir/\$program\" || |
|---|
| 3063 | { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ |
|---|
| 3064 | test \"X\$file\" != \"X\$progdir/\$program\"; }; then |
|---|
| 3065 | |
|---|
| 3066 | file=\"\$\$-\$program\" |
|---|
| 3067 | |
|---|
| 3068 | if test ! -d \"\$progdir\"; then |
|---|
| 3069 | $MKDIR \"\$progdir\" |
|---|
| 3070 | else |
|---|
| 3071 | $RM \"\$progdir/\$file\" |
|---|
| 3072 | fi" |
|---|
| 3073 | |
|---|
| 3074 | $ECHO "\ |
|---|
| 3075 | |
|---|
| 3076 | # relink executable if necessary |
|---|
| 3077 | if test -n \"\$relink_command\"; then |
|---|
| 3078 | if relink_command_output=\`eval \$relink_command 2>&1\`; then : |
|---|
| 3079 | else |
|---|
| 3080 | $ECHO \"\$relink_command_output\" >&2 |
|---|
| 3081 | $RM \"\$progdir/\$file\" |
|---|
| 3082 | exit 1 |
|---|
| 3083 | fi |
|---|
| 3084 | fi |
|---|
| 3085 | |
|---|
| 3086 | $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || |
|---|
| 3087 | { $RM \"\$progdir/\$program\"; |
|---|
| 3088 | $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } |
|---|
| 3089 | $RM \"\$progdir/\$file\" |
|---|
| 3090 | fi" |
|---|
| 3091 | else |
|---|
| 3092 | $ECHO "\ |
|---|
| 3093 | program='$outputname' |
|---|
| 3094 | progdir=\"\$thisdir/$objdir\" |
|---|
| 3095 | " |
|---|
| 3096 | fi |
|---|
| 3097 | |
|---|
| 3098 | $ECHO "\ |
|---|
| 3099 | |
|---|
| 3100 | if test -f \"\$progdir/\$program\"; then" |
|---|
| 3101 | |
|---|
| 3102 | |
|---|
| 3103 | if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then |
|---|
| 3104 | $ECHO "\ |
|---|
| 3105 | # Add our own library path to $shlibpath_var |
|---|
| 3106 | $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" |
|---|
| 3107 | |
|---|
| 3108 | # Some systems cannot cope with colon-terminated $shlibpath_var |
|---|
| 3109 | # The second colon is a workaround for a bug in BeOS R4 sed |
|---|
| 3110 | $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` |
|---|
| 3111 | |
|---|
| 3112 | export $shlibpath_var |
|---|
| 3113 | " |
|---|
| 3114 | fi |
|---|
| 3115 | |
|---|
| 3116 | |
|---|
| 3117 | if test -n "$dllsearchpath"; then |
|---|
| 3118 | $ECHO "\ |
|---|
| 3119 | # Add the dll search path components to the executable PATH |
|---|
| 3120 | PATH=$dllsearchpath:\$PATH |
|---|
| 3121 | " |
|---|
| 3122 | fi |
|---|
| 3123 | |
|---|
| 3124 | $ECHO "\ |
|---|
| 3125 | if test \"\$libtool_execute_magic\" != \"$magic\"; then |
|---|
| 3126 | # Run the actual program with our arguments. |
|---|
| 3127 | " |
|---|
| 3128 | case $host in |
|---|
| 3129 | |
|---|
| 3130 | *-*-mingw | *-*-os2* | *-cegcc*) |
|---|
| 3131 | $ECHO "\ |
|---|
| 3132 | exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} |
|---|
| 3133 | " |
|---|
| 3134 | ;; |
|---|
| 3135 | |
|---|
| 3136 | *) |
|---|
| 3137 | $ECHO "\ |
|---|
| 3138 | exec \"\$progdir/\$program\" \${1+\"\$@\"} |
|---|
| 3139 | " |
|---|
| 3140 | ;; |
|---|
| 3141 | esac |
|---|
| 3142 | $ECHO "\ |
|---|
| 3143 | \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 |
|---|
| 3144 | exit 1 |
|---|
| 3145 | fi |
|---|
| 3146 | else |
|---|
| 3147 | # The program doesn't exist. |
|---|
| 3148 | \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 |
|---|
| 3149 | \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 |
|---|
| 3150 | \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 |
|---|
| 3151 | exit 1 |
|---|
| 3152 | fi |
|---|
| 3153 | fi\ |
|---|
| 3154 | " |
|---|
| 3155 | } |
|---|
| 3156 | |
|---|
| 3157 | |
|---|
| 3158 | |
|---|
| 3159 | |
|---|
| 3160 | |
|---|
| 3161 | |
|---|
| 3162 | |
|---|
| 3163 | |
|---|
| 3164 | |
|---|
| 3165 | |
|---|
| 3166 | |
|---|
| 3167 | |
|---|
| 3168 | |
|---|
| 3169 | |
|---|
| 3170 | |
|---|
| 3171 | |
|---|
| 3172 | |
|---|
| 3173 | |
|---|
| 3174 | |
|---|
| 3175 | |
|---|
| 3176 | |
|---|
| 3177 | |
|---|
| 3178 | |
|---|
| 3179 | func_to_host_path () |
|---|
| 3180 | { |
|---|
| 3181 | func_to_host_path_result="$1" |
|---|
| 3182 | if test -n "$1"; then |
|---|
| 3183 | case $host in |
|---|
| 3184 | *mingw* ) |
|---|
| 3185 | lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' |
|---|
| 3186 | case $build in |
|---|
| 3187 | *mingw* ) |
|---|
| 3188 | |
|---|
| 3189 | func_to_host_path_result=`( cmd //c echo "$1" ) 2>/dev/null | |
|---|
| 3190 | $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` |
|---|
| 3191 | ;; |
|---|
| 3192 | *cygwin* ) |
|---|
| 3193 | func_to_host_path_result=`cygpath -w "$1" | |
|---|
| 3194 | $SED -e "$lt_sed_naive_backslashify"` |
|---|
| 3195 | ;; |
|---|
| 3196 | * ) |
|---|
| 3197 | |
|---|
| 3198 | |
|---|
| 3199 | |
|---|
| 3200 | |
|---|
| 3201 | |
|---|
| 3202 | |
|---|
| 3203 | |
|---|
| 3204 | func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null` |
|---|
| 3205 | if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then |
|---|
| 3206 | func_to_host_path_result=`$ECHO "$func_to_host_path_tmp1" | |
|---|
| 3207 | $SED -e "$lt_sed_naive_backslashify"` |
|---|
| 3208 | else |
|---|
| 3209 | |
|---|
| 3210 | func_to_host_path_result= |
|---|
| 3211 | fi |
|---|
| 3212 | ;; |
|---|
| 3213 | esac |
|---|
| 3214 | if test -z "$func_to_host_path_result" ; then |
|---|
| 3215 | func_error "Could not determine host path corresponding to" |
|---|
| 3216 | func_error " \`$1'" |
|---|
| 3217 | func_error "Continuing, but uninstalled executables may not work." |
|---|
| 3218 | |
|---|
| 3219 | func_to_host_path_result="$1" |
|---|
| 3220 | fi |
|---|
| 3221 | ;; |
|---|
| 3222 | esac |
|---|
| 3223 | fi |
|---|
| 3224 | } |
|---|
| 3225 | |
|---|
| 3226 | |
|---|
| 3227 | |
|---|
| 3228 | |
|---|
| 3229 | |
|---|
| 3230 | |
|---|
| 3231 | |
|---|
| 3232 | |
|---|
| 3233 | |
|---|
| 3234 | |
|---|
| 3235 | |
|---|
| 3236 | |
|---|
| 3237 | |
|---|
| 3238 | |
|---|
| 3239 | |
|---|
| 3240 | |
|---|
| 3241 | |
|---|
| 3242 | |
|---|
| 3243 | |
|---|
| 3244 | |
|---|
| 3245 | |
|---|
| 3246 | func_to_host_pathlist () |
|---|
| 3247 | { |
|---|
| 3248 | func_to_host_pathlist_result="$1" |
|---|
| 3249 | if test -n "$1"; then |
|---|
| 3250 | case $host in |
|---|
| 3251 | *mingw* ) |
|---|
| 3252 | lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' |
|---|
| 3253 | |
|---|
| 3254 | |
|---|
| 3255 | |
|---|
| 3256 | func_stripname : : "$1" |
|---|
| 3257 | func_to_host_pathlist_tmp1=$func_stripname_result |
|---|
| 3258 | case $build in |
|---|
| 3259 | *mingw* ) |
|---|
| 3260 | |
|---|
| 3261 | func_to_host_pathlist_result=` |
|---|
| 3262 | ( cmd //c echo "$func_to_host_pathlist_tmp1" ) 2>/dev/null | |
|---|
| 3263 | $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` |
|---|
| 3264 | ;; |
|---|
| 3265 | *cygwin* ) |
|---|
| 3266 | func_to_host_pathlist_result=`cygpath -w -p "$func_to_host_pathlist_tmp1" | |
|---|
| 3267 | $SED -e "$lt_sed_naive_backslashify"` |
|---|
| 3268 | ;; |
|---|
| 3269 | * ) |
|---|
| 3270 | |
|---|
| 3271 | func_to_host_pathlist_result="" |
|---|
| 3272 | func_to_host_pathlist_oldIFS=$IFS |
|---|
| 3273 | IFS=: |
|---|
| 3274 | for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do |
|---|
| 3275 | IFS=$func_to_host_pathlist_oldIFS |
|---|
| 3276 | if test -n "$func_to_host_pathlist_f" ; then |
|---|
| 3277 | func_to_host_path "$func_to_host_pathlist_f" |
|---|
| 3278 | if test -n "$func_to_host_path_result" ; then |
|---|
| 3279 | if test -z "$func_to_host_pathlist_result" ; then |
|---|
| 3280 | func_to_host_pathlist_result="$func_to_host_path_result" |
|---|
| 3281 | else |
|---|
| 3282 | func_append func_to_host_pathlist_result ";$func_to_host_path_result" |
|---|
| 3283 | fi |
|---|
| 3284 | fi |
|---|
| 3285 | fi |
|---|
| 3286 | done |
|---|
| 3287 | IFS=$func_to_host_pathlist_oldIFS |
|---|
| 3288 | ;; |
|---|
| 3289 | esac |
|---|
| 3290 | if test -z "$func_to_host_pathlist_result"; then |
|---|
| 3291 | func_error "Could not determine the host path(s) corresponding to" |
|---|
| 3292 | func_error " \`$1'" |
|---|
| 3293 | func_error "Continuing, but uninstalled executables may not work." |
|---|
| 3294 | |
|---|
| 3295 | |
|---|
| 3296 | |
|---|
| 3297 | |
|---|
| 3298 | |
|---|
| 3299 | lt_replace_pathsep_nix_to_dos="s|:|;|g" |
|---|
| 3300 | func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\ |
|---|
| 3301 | $SED -e "$lt_replace_pathsep_nix_to_dos"` |
|---|
| 3302 | fi |
|---|
| 3303 | |
|---|
| 3304 | case "$1" in |
|---|
| 3305 | :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result" |
|---|
| 3306 | ;; |
|---|
| 3307 | esac |
|---|
| 3308 | case "$1" in |
|---|
| 3309 | *: ) func_append func_to_host_pathlist_result ";" |
|---|
| 3310 | ;; |
|---|
| 3311 | esac |
|---|
| 3312 | ;; |
|---|
| 3313 | esac |
|---|
| 3314 | fi |
|---|
| 3315 | } |
|---|
| 3316 | |
|---|
| 3317 | |
|---|
| 3318 | |
|---|
| 3319 | |
|---|
| 3320 | |
|---|
| 3321 | |
|---|
| 3322 | func_emit_cwrapperexe_src () |
|---|
| 3323 | { |
|---|
| 3324 | cat <<EOF |
|---|
| 3325 | |
|---|
| 3326 | /* $cwrappersource - temporary wrapper executable for $objdir/$outputname |
|---|
| 3327 | Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION |
|---|
| 3328 | |
|---|
| 3329 | The $output program cannot be directly executed until all the libtool |
|---|
| 3330 | libraries that it depends on are installed. |
|---|
| 3331 | |
|---|
| 3332 | This wrapper executable should never be moved out of the build directory. |
|---|
| 3333 | If it is, it will not operate correctly. |
|---|
| 3334 | |
|---|
| 3335 | Currently, it simply execs the wrapper *script* "$SHELL $output", |
|---|
| 3336 | but could eventually absorb all of the scripts functionality and |
|---|
| 3337 | exec $objdir/$outputname directly. |
|---|
| 3338 | */ |
|---|
| 3339 | EOF |
|---|
| 3340 | cat <<"EOF" |
|---|
| 3341 | |
|---|
| 3342 | |
|---|
| 3343 | |
|---|
| 3344 | |
|---|
| 3345 | |
|---|
| 3346 | |
|---|
| 3347 | |
|---|
| 3348 | |
|---|
| 3349 | |
|---|
| 3350 | |
|---|
| 3351 | |
|---|
| 3352 | |
|---|
| 3353 | |
|---|
| 3354 | |
|---|
| 3355 | |
|---|
| 3356 | |
|---|
| 3357 | |
|---|
| 3358 | |
|---|
| 3359 | |
|---|
| 3360 | |
|---|
| 3361 | |
|---|
| 3362 | |
|---|
| 3363 | |
|---|
| 3364 | |
|---|
| 3365 | |
|---|
| 3366 | /* declarations of non-ANSI functions */ |
|---|
| 3367 | |
|---|
| 3368 | |
|---|
| 3369 | int _putenv (const char *); |
|---|
| 3370 | |
|---|
| 3371 | |
|---|
| 3372 | |
|---|
| 3373 | char *realpath (const char *, char *); |
|---|
| 3374 | int putenv (char *); |
|---|
| 3375 | int setenv (const char *, const char *, int); |
|---|
| 3376 | |
|---|
| 3377 | /* |
|---|
| 3378 | |
|---|
| 3379 | |
|---|
| 3380 | /* portability defines, excluding path handling macros */ |
|---|
| 3381 | |
|---|
| 3382 | |
|---|
| 3383 | |
|---|
| 3384 | |
|---|
| 3385 | |
|---|
| 3386 | |
|---|
| 3387 | |
|---|
| 3388 | |
|---|
| 3389 | |
|---|
| 3390 | |
|---|
| 3391 | |
|---|
| 3392 | |
|---|
| 3393 | |
|---|
| 3394 | |
|---|
| 3395 | |
|---|
| 3396 | |
|---|
| 3397 | |
|---|
| 3398 | |
|---|
| 3399 | |
|---|
| 3400 | |
|---|
| 3401 | /* |
|---|
| 3402 | |
|---|
| 3403 | |
|---|
| 3404 | |
|---|
| 3405 | |
|---|
| 3406 | |
|---|
| 3407 | |
|---|
| 3408 | |
|---|
| 3409 | |
|---|
| 3410 | |
|---|
| 3411 | |
|---|
| 3412 | |
|---|
| 3413 | |
|---|
| 3414 | |
|---|
| 3415 | |
|---|
| 3416 | |
|---|
| 3417 | |
|---|
| 3418 | |
|---|
| 3419 | /* path handling portability macros */ |
|---|
| 3420 | |
|---|
| 3421 | |
|---|
| 3422 | |
|---|
| 3423 | |
|---|
| 3424 | |
|---|
| 3425 | |
|---|
| 3426 | defined (__OS2__) |
|---|
| 3427 | |
|---|
| 3428 | |
|---|
| 3429 | |
|---|
| 3430 | |
|---|
| 3431 | |
|---|
| 3432 | |
|---|
| 3433 | |
|---|
| 3434 | |
|---|
| 3435 | |
|---|
| 3436 | |
|---|
| 3437 | |
|---|
| 3438 | |
|---|
| 3439 | |
|---|
| 3440 | |
|---|
| 3441 | (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) |
|---|
| 3442 | |
|---|
| 3443 | |
|---|
| 3444 | |
|---|
| 3445 | |
|---|
| 3446 | |
|---|
| 3447 | |
|---|
| 3448 | |
|---|
| 3449 | |
|---|
| 3450 | |
|---|
| 3451 | |
|---|
| 3452 | |
|---|
| 3453 | |
|---|
| 3454 | |
|---|
| 3455 | |
|---|
| 3456 | |
|---|
| 3457 | |
|---|
| 3458 | |
|---|
| 3459 | if (stale) { free ((void *) stale); stale = 0; } \ |
|---|
| 3460 | } while (0) |
|---|
| 3461 | |
|---|
| 3462 | |
|---|
| 3463 | |
|---|
| 3464 | |
|---|
| 3465 | static void |
|---|
| 3466 | ltwrapper_debugprintf (const char *fmt, ...) |
|---|
| 3467 | { |
|---|
| 3468 | va_list args; |
|---|
| 3469 | va_start (args, fmt); |
|---|
| 3470 | (void) vfprintf (stderr, fmt, args); |
|---|
| 3471 | va_end (args); |
|---|
| 3472 | } |
|---|
| 3473 | |
|---|
| 3474 | |
|---|
| 3475 | |
|---|
| 3476 | |
|---|
| 3477 | const char *program_name = NULL; |
|---|
| 3478 | |
|---|
| 3479 | void *xmalloc (size_t num); |
|---|
| 3480 | char *xstrdup (const char *string); |
|---|
| 3481 | const char *base_name (const char *name); |
|---|
| 3482 | char *find_executable (const char *wrapper); |
|---|
| 3483 | char *chase_symlinks (const char *pathspec); |
|---|
| 3484 | int make_executable (const char *path); |
|---|
| 3485 | int check_executable (const char *path); |
|---|
| 3486 | char *strendzap (char *str, const char *pat); |
|---|
| 3487 | void lt_fatal (const char *message, ...); |
|---|
| 3488 | void lt_setenv (const char *name, const char *value); |
|---|
| 3489 | char *lt_extend_str (const char *orig_value, const char *add, int to_end); |
|---|
| 3490 | void lt_update_exe_path (const char *name, const char *value); |
|---|
| 3491 | void lt_update_lib_path (const char *name, const char *value); |
|---|
| 3492 | char **prepare_spawn (char **argv); |
|---|
| 3493 | void lt_dump_script (FILE *f); |
|---|
| 3494 | EOF |
|---|
| 3495 | |
|---|
| 3496 | cat <<EOF |
|---|
| 3497 | const char * MAGIC_EXE = "$magic_exe"; |
|---|
| 3498 | const char * LIB_PATH_VARNAME = "$shlibpath_var"; |
|---|
| 3499 | EOF |
|---|
| 3500 | |
|---|
| 3501 | if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then |
|---|
| 3502 | func_to_host_pathlist "$temp_rpath" |
|---|
| 3503 | cat <<EOF |
|---|
| 3504 | const char * LIB_PATH_VALUE = "$func_to_host_pathlist_result"; |
|---|
| 3505 | EOF |
|---|
| 3506 | else |
|---|
| 3507 | cat <<"EOF" |
|---|
| 3508 | const char * LIB_PATH_VALUE = ""; |
|---|
| 3509 | EOF |
|---|
| 3510 | fi |
|---|
| 3511 | |
|---|
| 3512 | if test -n "$dllsearchpath"; then |
|---|
| 3513 | func_to_host_pathlist "$dllsearchpath:" |
|---|
| 3514 | cat <<EOF |
|---|
| 3515 | const char * EXE_PATH_VARNAME = "PATH"; |
|---|
| 3516 | const char * EXE_PATH_VALUE = "$func_to_host_pathlist_result"; |
|---|
| 3517 | EOF |
|---|
| 3518 | else |
|---|
| 3519 | cat <<"EOF" |
|---|
| 3520 | const char * EXE_PATH_VARNAME = ""; |
|---|
| 3521 | const char * EXE_PATH_VALUE = ""; |
|---|
| 3522 | EOF |
|---|
| 3523 | fi |
|---|
| 3524 | |
|---|
| 3525 | if test "$fast_install" = yes; then |
|---|
| 3526 | cat <<EOF |
|---|
| 3527 | const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */ |
|---|
| 3528 | EOF |
|---|
| 3529 | else |
|---|
| 3530 | cat <<EOF |
|---|
| 3531 | const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */ |
|---|
| 3532 | EOF |
|---|
| 3533 | fi |
|---|
| 3534 | |
|---|
| 3535 | |
|---|
| 3536 | cat <<"EOF" |
|---|
| 3537 | |
|---|
| 3538 | |
|---|
| 3539 | |
|---|
| 3540 | |
|---|
| 3541 | static const size_t opt_prefix_len = LTWRAPPER_OPTION_PREFIX_LENGTH; |
|---|
| 3542 | static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX; |
|---|
| 3543 | |
|---|
| 3544 | static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script"; |
|---|
| 3545 | |
|---|
| 3546 | int |
|---|
| 3547 | main (int argc, char *argv[]) |
|---|
| 3548 | { |
|---|
| 3549 | char **newargz; |
|---|
| 3550 | int newargc; |
|---|
| 3551 | char *tmp_pathspec; |
|---|
| 3552 | char *actual_cwrapper_path; |
|---|
| 3553 | char *actual_cwrapper_name; |
|---|
| 3554 | char *target_name; |
|---|
| 3555 | char *lt_argv_zero; |
|---|
| 3556 | intptr_t rval = 127; |
|---|
| 3557 | |
|---|
| 3558 | int i; |
|---|
| 3559 | |
|---|
| 3560 | program_name = (char *) xstrdup (base_name (argv[0])); |
|---|
| 3561 | LTWRAPPER_DEBUGPRINTF (("(main) argv[0] : %s\n", argv[0])); |
|---|
| 3562 | LTWRAPPER_DEBUGPRINTF (("(main) program_name : %s\n", program_name)); |
|---|
| 3563 | |
|---|
| 3564 | /* very simple arg parsing; don't want to rely on getopt */ |
|---|
| 3565 | for (i = 1; i < argc; i++) |
|---|
| 3566 | { |
|---|
| 3567 | if (strcmp (argv[i], dumpscript_opt) == 0) |
|---|
| 3568 | { |
|---|
| 3569 | EOF |
|---|
| 3570 | case "$host" in |
|---|
| 3571 | *mingw* | *cygwin* ) |
|---|
| 3572 | |
|---|
| 3573 | echo " setmode(1,_O_BINARY);" |
|---|
| 3574 | ;; |
|---|
| 3575 | esac |
|---|
| 3576 | |
|---|
| 3577 | cat <<"EOF" |
|---|
| 3578 | lt_dump_script (stdout); |
|---|
| 3579 | return 0; |
|---|
| 3580 | } |
|---|
| 3581 | } |
|---|
| 3582 | |
|---|
| 3583 | newargz = XMALLOC (char *, argc + 1); |
|---|
| 3584 | tmp_pathspec = find_executable (argv[0]); |
|---|
| 3585 | if (tmp_pathspec == NULL) |
|---|
| 3586 | lt_fatal ("Couldn't find %s", argv[0]); |
|---|
| 3587 | LTWRAPPER_DEBUGPRINTF (("(main) found exe (before symlink chase) at : %s\n", |
|---|
| 3588 | tmp_pathspec)); |
|---|
| 3589 | |
|---|
| 3590 | actual_cwrapper_path = chase_symlinks (tmp_pathspec); |
|---|
| 3591 | LTWRAPPER_DEBUGPRINTF (("(main) found exe (after symlink chase) at : %s\n", |
|---|
| 3592 | actual_cwrapper_path)); |
|---|
| 3593 | XFREE (tmp_pathspec); |
|---|
| 3594 | |
|---|
| 3595 | actual_cwrapper_name = xstrdup( base_name (actual_cwrapper_path)); |
|---|
| 3596 | strendzap (actual_cwrapper_path, actual_cwrapper_name); |
|---|
| 3597 | |
|---|
| 3598 | /* wrapper name transforms */ |
|---|
| 3599 | strendzap (actual_cwrapper_name, ".exe"); |
|---|
| 3600 | tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1); |
|---|
| 3601 | XFREE (actual_cwrapper_name); |
|---|
| 3602 | actual_cwrapper_name = tmp_pathspec; |
|---|
| 3603 | tmp_pathspec = 0; |
|---|
| 3604 | |
|---|
| 3605 | /* target_name transforms -- use actual target program name; might have lt- prefix */ |
|---|
| 3606 | target_name = xstrdup (base_name (TARGET_PROGRAM_NAME)); |
|---|
| 3607 | strendzap (target_name, ".exe"); |
|---|
| 3608 | tmp_pathspec = lt_extend_str (target_name, ".exe", 1); |
|---|
| 3609 | XFREE (target_name); |
|---|
| 3610 | target_name = tmp_pathspec; |
|---|
| 3611 | tmp_pathspec = 0; |
|---|
| 3612 | |
|---|
| 3613 | LTWRAPPER_DEBUGPRINTF (("(main) libtool target name: %s\n", |
|---|
| 3614 | target_name)); |
|---|
| 3615 | EOF |
|---|
| 3616 | |
|---|
| 3617 | cat <<EOF |
|---|
| 3618 | newargz[0] = |
|---|
| 3619 | XMALLOC (char, (strlen (actual_cwrapper_path) + |
|---|
| 3620 | strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1)); |
|---|
| 3621 | strcpy (newargz[0], actual_cwrapper_path); |
|---|
| 3622 | strcat (newargz[0], "$objdir"); |
|---|
| 3623 | strcat (newargz[0], "/"); |
|---|
| 3624 | EOF |
|---|
| 3625 | |
|---|
| 3626 | cat <<"EOF" |
|---|
| 3627 | /* stop here, and copy so we don't have to do this twice */ |
|---|
| 3628 | tmp_pathspec = xstrdup (newargz[0]); |
|---|
| 3629 | |
|---|
| 3630 | /* do NOT want the lt- prefix here, so use actual_cwrapper_name */ |
|---|
| 3631 | strcat (newargz[0], actual_cwrapper_name); |
|---|
| 3632 | |
|---|
| 3633 | /* DO want the lt- prefix here if it exists, so use target_name */ |
|---|
| 3634 | lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1); |
|---|
| 3635 | XFREE (tmp_pathspec); |
|---|
| 3636 | tmp_pathspec = NULL; |
|---|
| 3637 | EOF |
|---|
| 3638 | |
|---|
| 3639 | case $host_os in |
|---|
| 3640 | mingw*) |
|---|
| 3641 | cat <<"EOF" |
|---|
| 3642 | { |
|---|
| 3643 | char* p; |
|---|
| 3644 | while ((p = strchr (newargz[0], '\\')) != NULL) |
|---|
| 3645 | { |
|---|
| 3646 | *p = '/'; |
|---|
| 3647 | } |
|---|
| 3648 | while ((p = strchr (lt_argv_zero, '\\')) != NULL) |
|---|
| 3649 | { |
|---|
| 3650 | *p = '/'; |
|---|
| 3651 | } |
|---|
| 3652 | } |
|---|
| 3653 | EOF |
|---|
| 3654 | ;; |
|---|
| 3655 | esac |
|---|
| 3656 | |
|---|
| 3657 | cat <<"EOF" |
|---|
| 3658 | XFREE (target_name); |
|---|
| 3659 | XFREE (actual_cwrapper_path); |
|---|
| 3660 | XFREE (actual_cwrapper_name); |
|---|
| 3661 | |
|---|
| 3662 | lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */ |
|---|
| 3663 | lt_setenv ("DUALCASE", "1"); /* for MSK sh */ |
|---|
| 3664 | lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE); |
|---|
| 3665 | lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE); |
|---|
| 3666 | |
|---|
| 3667 | newargc=0; |
|---|
| 3668 | for (i = 1; i < argc; i++) |
|---|
| 3669 | { |
|---|
| 3670 | if (strncmp (argv[i], ltwrapper_option_prefix, opt_prefix_len) == 0) |
|---|
| 3671 | { |
|---|
| 3672 | /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX |
|---|
| 3673 | namespace, but it is not one of the ones we know about and |
|---|
| 3674 | have already dealt with, above (inluding dump-script), then |
|---|
| 3675 | report an error. Otherwise, targets might begin to believe |
|---|
| 3676 | they are allowed to use options in the LTWRAPPER_OPTION_PREFIX |
|---|
| 3677 | namespace. The first time any user complains about this, we'll |
|---|
| 3678 | need to make LTWRAPPER_OPTION_PREFIX a configure-time option |
|---|
| 3679 | or a configure.ac-settable value. |
|---|
| 3680 | */ |
|---|
| 3681 | lt_fatal ("Unrecognized option in %s namespace: '%s'", |
|---|
| 3682 | ltwrapper_option_prefix, argv[i]); |
|---|
| 3683 | } |
|---|
| 3684 | /* otherwise ... */ |
|---|
| 3685 | newargz[++newargc] = xstrdup (argv[i]); |
|---|
| 3686 | } |
|---|
| 3687 | newargz[++newargc] = NULL; |
|---|
| 3688 | |
|---|
| 3689 | LTWRAPPER_DEBUGPRINTF (("(main) lt_argv_zero : %s\n", (lt_argv_zero ? lt_argv_zero : "<NULL>"))); |
|---|
| 3690 | for (i = 0; i < newargc; i++) |
|---|
| 3691 | { |
|---|
| 3692 | LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d] : %s\n", i, (newargz[i] ? newargz[i] : "<NULL>"))); |
|---|
| 3693 | } |
|---|
| 3694 | |
|---|
| 3695 | EOF |
|---|
| 3696 | |
|---|
| 3697 | case $host_os in |
|---|
| 3698 | mingw*) |
|---|
| 3699 | cat <<"EOF" |
|---|
| 3700 | /* execv doesn't actually work on mingw as expected on unix */ |
|---|
| 3701 | newargz = prepare_spawn (newargz); |
|---|
| 3702 | rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz); |
|---|
| 3703 | if (rval == -1) |
|---|
| 3704 | { |
|---|
| 3705 | /* failed to start process */ |
|---|
| 3706 | LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"%s\": errno = %d\n", lt_argv_zero, errno)); |
|---|
| 3707 | return 127; |
|---|
| 3708 | } |
|---|
| 3709 | return rval; |
|---|
| 3710 | EOF |
|---|
| 3711 | ;; |
|---|
| 3712 | *) |
|---|
| 3713 | cat <<"EOF" |
|---|
| 3714 | execv (lt_argv_zero, newargz); |
|---|
| 3715 | return rval; /* =127, but avoids unused variable warning */ |
|---|
| 3716 | EOF |
|---|
| 3717 | ;; |
|---|
| 3718 | esac |
|---|
| 3719 | |
|---|
| 3720 | cat <<"EOF" |
|---|
| 3721 | } |
|---|
| 3722 | |
|---|
| 3723 | void * |
|---|
| 3724 | xmalloc (size_t num) |
|---|
| 3725 | { |
|---|
| 3726 | void *p = (void *) malloc (num); |
|---|
| 3727 | if (!p) |
|---|
| 3728 | lt_fatal ("Memory exhausted"); |
|---|
| 3729 | |
|---|
| 3730 | return p; |
|---|
| 3731 | } |
|---|
| 3732 | |
|---|