ltmain.sh 194 KB
Newer Older
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6001
	    $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6002
	    exit $EXIT_FAILURE
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
	  fi
	fi

	# See the names of the shared library.
	set dummy $library_names
	if test -n "$2"; then
	  realname="$2"
	  shift
	  shift

	  srcname="$realname"
	  test -n "$relink_command" && srcname="$realname"T

	  # Install the shared library and build the symlinks.
	  $show "$install_prog $dir/$srcname $destdir/$realname"
	  $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
	  if test -n "$stripme" && test -n "$striplib"; then
	    $show "$striplib $destdir/$realname"
	    $run eval "$striplib $destdir/$realname" || exit $?
	  fi

	  if test "$#" -gt 0; then
	    # Delete the old symlinks, and create new ones.
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6026
6027
6028
	    # Try `ln -sf' first, because the `ln' binary might depend on
	    # the symlink we replace!  Solaris /bin/ln does not understand -f,
	    # so we also need to try rm && ln -s.
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6029
6030
6031
	    for linkname
	    do
	      if test "$linkname" != "$realname"; then
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6032
6033
                $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
                $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6034
6035
6036
6037
6038
6039
	      fi
	    done
	  fi

	  # Do each command in the postinstall commands.
	  lib="$destdir/$realname"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6040
	  cmds=$postinstall_cmds
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6041
6042
6043
	  save_ifs="$IFS"; IFS='~'
	  for cmd in $cmds; do
	    IFS="$save_ifs"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6044
	    eval cmd=\"$cmd\"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6045
	    $show "$cmd"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
	    $run eval "$cmd" || {
	      lt_exit=$?

	      # Restore the uninstalled library and exit
	      if test "$mode" = relink; then
		$run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
	      fi

	      exit $lt_exit
	    }
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
	  done
	  IFS="$save_ifs"
	fi

	# Install the pseudo-library for information purposes.
	name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
	instname="$dir/$name"i
	$show "$install_prog $instname $destdir/$name"
	$run eval "$install_prog $instname $destdir/$name" || exit $?

	# Maybe install the static library, too.
	test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
	;;

      *.lo)
	# Install (i.e. copy) a libtool object.

	# Figure out destination file name, if it wasn't already specified.
	if test -n "$destname"; then
	  destfile="$destdir/$destname"
	else
	  destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
	  destfile="$destdir/$destfile"
	fi

	# Deduce the name of the destination old-style object file.
	case $destfile in
	*.lo)
	  staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
	  ;;
	*.$objext)
	  staticdest="$destfile"
	  destfile=
	  ;;
	*)
	  $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
	  $echo "$help" 1>&2
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6093
	  exit $EXIT_FAILURE
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
	  ;;
	esac

	# Install the libtool object if requested.
	if test -n "$destfile"; then
	  $show "$install_prog $file $destfile"
	  $run eval "$install_prog $file $destfile" || exit $?
	fi

	# Install the old object if enabled.
	if test "$build_old_libs" = yes; then
	  # Deduce the name of the old-style object file.
	  staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`

	  $show "$install_prog $staticobj $staticdest"
	  $run eval "$install_prog \$staticobj \$staticdest" || exit $?
	fi
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6111
	exit $EXIT_SUCCESS
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
	;;

      *)
	# Figure out destination file name, if it wasn't already specified.
	if test -n "$destname"; then
	  destfile="$destdir/$destname"
	else
	  destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
	  destfile="$destdir/$destfile"
	fi

Emmanuel Bertin's avatar
Emmanuel Bertin committed
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
	# If the file is missing, and there is a .exe on the end, strip it
	# because it is most likely a libtool script we actually want to
	# install
	stripped_ext=""
	case $file in
	  *.exe)
	    if test ! -f "$file"; then
	      file=`$echo $file|${SED} 's,.exe$,,'`
	      stripped_ext=".exe"
	    fi
	    ;;
	esac

Emmanuel Bertin's avatar
Emmanuel Bertin committed
6136
	# Do a test to see if this is really a libtool program.
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6137
6138
6139
6140
6141
6142
6143
6144
6145
	case $host in
	*cygwin*|*mingw*)
	    wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
	    ;;
	*)
	    wrapper=$file
	    ;;
	esac
	if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6146
6147
6148
	  notinst_deplibs=
	  relink_command=

Emmanuel Bertin's avatar
Emmanuel Bertin committed
6149
6150
6151
6152
6153
	  # Note that it is not necessary on cygwin/mingw to append a dot to
	  # foo even if both foo and FILE.exe exist: automatic-append-.exe
	  # behavior happens only for exec(3), not for open(2)!  Also, sourcing
	  # `FILE.' does not work on cygwin managed mounts.
	  #
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6154
	  # If there is no directory component, then add one.
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6155
6156
6157
	  case $wrapper in
	  */* | *\\*) . ${wrapper} ;;
	  *) . ./${wrapper} ;;
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6158
6159
6160
6161
	  esac

	  # Check the variables that should have been set.
	  if test -z "$notinst_deplibs"; then
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6162
6163
	    $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
	    exit $EXIT_FAILURE
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
	  fi

	  finalize=yes
	  for lib in $notinst_deplibs; do
	    # Check to see that each library is installed.
	    libdir=
	    if test -f "$lib"; then
	      # If there is no directory component, then add one.
	      case $lib in
	      */* | *\\*) . $lib ;;
	      *) . ./$lib ;;
	      esac
	    fi
	    libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
	    if test -n "$libdir" && test ! -f "$libfile"; then
	      $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
	      finalize=no
	    fi
	  done

	  relink_command=
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6185
6186
6187
6188
6189
	  # Note that it is not necessary on cygwin/mingw to append a dot to
	  # foo even if both foo and FILE.exe exist: automatic-append-.exe
	  # behavior happens only for exec(3), not for open(2)!  Also, sourcing
	  # `FILE.' does not work on cygwin managed mounts.
	  #
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6190
	  # If there is no directory component, then add one.
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6191
6192
6193
	  case $wrapper in
	  */* | *\\*) . ${wrapper} ;;
	  *) . ./${wrapper} ;;
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6194
6195
6196
6197
6198
	  esac

	  outputname=
	  if test "$fast_install" = no && test -n "$relink_command"; then
	    if test "$finalize" = yes && test -z "$run"; then
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6199
6200
	      tmpdir=`func_mktempdir`
	      file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6201
6202
	      outputname="$tmpdir/$file"
	      # Replace the output file specification.
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6203
	      relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP`
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217

	      $show "$relink_command"
	      if $run eval "$relink_command"; then :
	      else
		$echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
		${rm}r "$tmpdir"
		continue
	      fi
	      file="$outputname"
	    else
	      $echo "$modename: warning: cannot relink \`$file'" 1>&2
	    fi
	  else
	    # Install the binary that we compiled earlier.
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6218
	    file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6219
6220
6221
6222
	  fi
	fi

	# remove .exe since cygwin /usr/bin/install will append another
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6223
	# one anyway 
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6224
	case $install_prog,$host in
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6225
	*/usr/bin/install*,*cygwin*)
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6226
6227
6228
6229
6230
6231
6232
6233
	  case $file:$destfile in
	  *.exe:*.exe)
	    # this is ok
	    ;;
	  *.exe:*)
	    destfile=$destfile.exe
	    ;;
	  *:*.exe)
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6234
	    destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
	    ;;
	  esac
	  ;;
	esac
	$show "$install_prog$stripme $file $destfile"
	$run eval "$install_prog\$stripme \$file \$destfile" || exit $?
	test -n "$outputname" && ${rm}r "$tmpdir"
	;;
      esac
    done

    for file in $staticlibs; do
      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`

      # Set up the ranlib parameters.
      oldlib="$destdir/$name"

      $show "$install_prog $file $oldlib"
      $run eval "$install_prog \$file \$oldlib" || exit $?

Emmanuel Bertin's avatar
Emmanuel Bertin committed
6255
      if test -n "$stripme" && test -n "$old_striplib"; then
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6256
6257
6258
6259
6260
	$show "$old_striplib $oldlib"
	$run eval "$old_striplib $oldlib" || exit $?
      fi

      # Do each command in the postinstall commands.
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6261
      cmds=$old_postinstall_cmds
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6262
6263
6264
      save_ifs="$IFS"; IFS='~'
      for cmd in $cmds; do
	IFS="$save_ifs"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6265
	eval cmd=\"$cmd\"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
	$show "$cmd"
	$run eval "$cmd" || exit $?
      done
      IFS="$save_ifs"
    done

    if test -n "$future_libdirs"; then
      $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
    fi

    if test -n "$current_libdirs"; then
      # Maybe just do a dry run.
      test -n "$run" && current_libdirs=" -n$current_libdirs"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6279
      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6280
    else
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6281
      exit $EXIT_SUCCESS
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
    fi
    ;;

  # libtool finish mode
  finish)
    modename="$modename: finish"
    libdirs="$nonopt"
    admincmds=

    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
      for dir
      do
	libdirs="$libdirs $dir"
      done

      for libdir in $libdirs; do
	if test -n "$finish_cmds"; then
	  # Do each command in the finish commands.
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6300
	  cmds=$finish_cmds
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6301
6302
6303
	  save_ifs="$IFS"; IFS='~'
	  for cmd in $cmds; do
	    IFS="$save_ifs"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6304
	    eval cmd=\"$cmd\"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
	    $show "$cmd"
	    $run eval "$cmd" || admincmds="$admincmds
       $cmd"
	  done
	  IFS="$save_ifs"
	fi
	if test -n "$finish_eval"; then
	  # Do the single finish_eval.
	  eval cmds=\"$finish_eval\"
	  $run eval "$cmds" || admincmds="$admincmds
       $cmds"
	fi
      done
    fi

    # Exit here if they wanted silent mode.
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6321
    test "$show" = : && exit $EXIT_SUCCESS
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6322

Emmanuel Bertin's avatar
Emmanuel Bertin committed
6323
6324
    $echo "X----------------------------------------------------------------------" | $Xsed
    $echo "Libraries have been installed in:"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6325
    for libdir in $libdirs; do
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6326
      $echo "   $libdir"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6327
    done
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6328
6329
6330
6331
6332
    $echo
    $echo "If you ever happen to want to link against installed libraries"
    $echo "in a given directory, LIBDIR, you must either use libtool, and"
    $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
    $echo "flag during linking and do at least one of the following:"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6333
    if test -n "$shlibpath_var"; then
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6334
6335
      $echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
      $echo "     during execution"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6336
6337
    fi
    if test -n "$runpath_var"; then
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6338
6339
      $echo "   - add LIBDIR to the \`$runpath_var' environment variable"
      $echo "     during linking"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6340
6341
6342
6343
6344
    fi
    if test -n "$hardcode_libdir_flag_spec"; then
      libdir=LIBDIR
      eval flag=\"$hardcode_libdir_flag_spec\"

Emmanuel Bertin's avatar
Emmanuel Bertin committed
6345
      $echo "   - use the \`$flag' linker flag"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6346
6347
    fi
    if test -n "$admincmds"; then
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6348
      $echo "   - have your system administrator run these commands:$admincmds"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6349
6350
    fi
    if test -f /etc/ld.so.conf; then
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6351
      $echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6352
    fi
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6353
6354
6355
6356
6357
    $echo
    $echo "See any operating system documentation about shared libraries for"
    $echo "more information, such as the ld(1) and ld.so(8) manual pages."
    $echo "X----------------------------------------------------------------------" | $Xsed
    exit $EXIT_SUCCESS
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
    ;;

  # libtool execute mode
  execute)
    modename="$modename: execute"

    # The first argument is the command name.
    cmd="$nonopt"
    if test -z "$cmd"; then
      $echo "$modename: you must specify a COMMAND" 1>&2
      $echo "$help"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6369
      exit $EXIT_FAILURE
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6370
6371
6372
6373
6374
6375
6376
    fi

    # Handle -dlopen flags immediately.
    for file in $execute_dlfiles; do
      if test ! -f "$file"; then
	$echo "$modename: \`$file' is not a file" 1>&2
	$echo "$help" 1>&2
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6377
	exit $EXIT_FAILURE
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6378
6379
6380
6381
6382
6383
      fi

      dir=
      case $file in
      *.la)
	# Check to see that this really is a libtool archive.
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6384
	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6385
6386
6387
	else
	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
	  $echo "$help" 1>&2
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6388
	  exit $EXIT_FAILURE
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
	fi

	# Read the libtool library.
	dlname=
	library_names=

	# If there is no directory component, then add one.
	case $file in
	*/* | *\\*) . $file ;;
	*) . ./$file ;;
	esac

	# Skip this library if it cannot be dlopened.
	if test -z "$dlname"; then
	  # Warn if it was a shared library.
	  test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
	  continue
	fi

	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
	test "X$dir" = "X$file" && dir=.

	if test -f "$dir/$objdir/$dlname"; then
	  dir="$dir/$objdir"
	else
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6414
6415
6416
6417
	  if test ! -f "$dir/$dlname"; then
	    $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
	    exit $EXIT_FAILURE
	  fi
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
	fi
	;;

      *.lo)
	# Just add the directory containing the .lo file.
	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
	test "X$dir" = "X$file" && dir=.
	;;

      *)
	$echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
	continue
	;;
      esac

      # Get the absolute pathname.
      absdir=`cd "$dir" && pwd`
      test -n "$absdir" && dir="$absdir"

      # Now add the directory to shlibpath_var.
      if eval "test -z \"\$$shlibpath_var\""; then
	eval "$shlibpath_var=\"\$dir\""
      else
	eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
      fi
    done

    # This variable tells wrapper scripts just to set shlibpath_var
    # rather than running their programs.
    libtool_execute_magic="$magic"

    # Check if any of the arguments is a wrapper script.
    args=
    for file
    do
      case $file in
      -*) ;;
      *)
	# Do a test to see if this is really a libtool program.
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6457
	if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
	  # If there is no directory component, then add one.
	  case $file in
	  */* | *\\*) . $file ;;
	  *) . ./$file ;;
	  esac

	  # Transform arg to wrapped name.
	  file="$progdir/$program"
	fi
	;;
      esac
      # Quote arguments (to preserve shell metacharacters).
      file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
      args="$args \"$file\""
    done

    if test -z "$run"; then
      if test -n "$shlibpath_var"; then
	# Export the shlibpath_var.
	eval "export $shlibpath_var"
      fi

Emmanuel Bertin's avatar
Emmanuel Bertin committed
6480
6481
6482
6483
6484
6485
6486
      # Restore saved environment variables
      for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
      do
	eval "if test \"\${save_$lt_var+set}\" = set; then
		$lt_var=\$save_$lt_var; export $lt_var
	      fi"
      done
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496

      # Now prepare to actually exec the command.
      exec_cmd="\$cmd$args"
    else
      # Display what would be done.
      if test -n "$shlibpath_var"; then
	eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
	$echo "export $shlibpath_var"
      fi
      $echo "$cmd$args"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6497
      exit $EXIT_SUCCESS
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
    fi
    ;;

  # libtool clean and uninstall mode
  clean | uninstall)
    modename="$modename: $mode"
    rm="$nonopt"
    files=
    rmforce=
    exit_status=0

    # This variable tells wrapper scripts just to set variables rather
    # than running their programs.
    libtool_install_magic="$magic"

    for arg
    do
      case $arg in
      -f) rm="$rm $arg"; rmforce=yes ;;
      -*) rm="$rm $arg" ;;
      *) files="$files $arg" ;;
      esac
    done

    if test -z "$rm"; then
      $echo "$modename: you must specify an RM program" 1>&2
      $echo "$help" 1>&2
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6525
      exit $EXIT_FAILURE
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6526
6527
6528
6529
    fi

    rmdirs=

Emmanuel Bertin's avatar
Emmanuel Bertin committed
6530
    origobjdir="$objdir"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6531
6532
6533
6534
    for file in $files; do
      dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
      if test "X$dir" = "X$file"; then
	dir=.
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6535
	objdir="$origobjdir"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6536
      else
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6537
	objdir="$dir/$origobjdir"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
      fi
      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
      test "$mode" = uninstall && objdir="$dir"

      # Remember objdir for removal later, being careful to avoid duplicates
      if test "$mode" = clean; then
	case " $rmdirs " in
	  *" $objdir "*) ;;
	  *) rmdirs="$rmdirs $objdir" ;;
	esac
      fi

      # Don't error if the file doesn't exist and rm -f was used.
      if (test -L "$file") >/dev/null 2>&1 \
	|| (test -h "$file") >/dev/null 2>&1 \
	|| test -f "$file"; then
	:
      elif test -d "$file"; then
	exit_status=1
	continue
      elif test "$rmforce" = yes; then
	continue
      fi

      rmfiles="$file"

      case $name in
      *.la)
	# Possibly a libtool archive, so verify it.
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6567
	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6568
6569
6570
6571
6572
6573
6574
6575
	  . $dir/$name

	  # Delete the libtool libraries and symlinks.
	  for n in $library_names; do
	    rmfiles="$rmfiles $objdir/$n"
	  done
	  test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"

Emmanuel Bertin's avatar
Emmanuel Bertin committed
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
	  case "$mode" in
	  clean)
	    case "  $library_names " in
	    # "  " in the beginning catches empty $dlname
	    *" $dlname "*) ;;
	    *) rmfiles="$rmfiles $objdir/$dlname" ;;
	    esac
	     test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
	    ;;
	  uninstall)
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6586
6587
	    if test -n "$library_names"; then
	      # Do each command in the postuninstall commands.
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6588
	      cmds=$postuninstall_cmds
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6589
6590
6591
	      save_ifs="$IFS"; IFS='~'
	      for cmd in $cmds; do
		IFS="$save_ifs"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6592
		eval cmd=\"$cmd\"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
		$show "$cmd"
		$run eval "$cmd"
		if test "$?" -ne 0 && test "$rmforce" != yes; then
		  exit_status=1
		fi
	      done
	      IFS="$save_ifs"
	    fi

	    if test -n "$old_library"; then
	      # Do each command in the old_postuninstall commands.
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6604
	      cmds=$old_postuninstall_cmds
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6605
6606
6607
	      save_ifs="$IFS"; IFS='~'
	      for cmd in $cmds; do
		IFS="$save_ifs"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6608
		eval cmd=\"$cmd\"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6609
6610
6611
6612
6613
6614
6615
6616
6617
		$show "$cmd"
		$run eval "$cmd"
		if test "$?" -ne 0 && test "$rmforce" != yes; then
		  exit_status=1
		fi
	      done
	      IFS="$save_ifs"
	    fi
	    # FIXME: should reinstall the best remaining shared library.
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6618
6619
	    ;;
	  esac
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6620
6621
6622
6623
	fi
	;;

      *.lo)
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
	# Possibly a libtool object, so verify it.
	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then

	  # Read the .lo file
	  . $dir/$name

	  # Add PIC object to the list of files to remove.
	  if test -n "$pic_object" \
	     && test "$pic_object" != none; then
	    rmfiles="$rmfiles $dir/$pic_object"
	  fi

	  # Add non-PIC object to the list of files to remove.
	  if test -n "$non_pic_object" \
	     && test "$non_pic_object" != none; then
	    rmfiles="$rmfiles $dir/$non_pic_object"
	  fi
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6641
6642
6643
6644
	fi
	;;

      *)
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
	if test "$mode" = clean ; then
	  noexename=$name
	  case $file in
	  *.exe)
	    file=`$echo $file|${SED} 's,.exe$,,'`
	    noexename=`$echo $name|${SED} 's,.exe$,,'`
	    # $file with .exe has already been added to rmfiles,
	    # add $file without .exe
	    rmfiles="$rmfiles $file"
	    ;;
	  esac
	  # Do a test to see if this is a libtool program.
	  if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
	    relink_command=
	    . $dir/$noexename
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6660

Emmanuel Bertin's avatar
Emmanuel Bertin committed
6661
6662
6663
6664
6665
6666
6667
6668
6669
	    # note $name still contains .exe if it was in $file originally
	    # as does the version of $file that was added into $rmfiles
	    rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
	    if test "$fast_install" = yes && test -n "$relink_command"; then
	      rmfiles="$rmfiles $objdir/lt-$name"
	    fi
	    if test "X$noexename" != "X$name" ; then
	      rmfiles="$rmfiles $objdir/lt-${noexename}.c"
	    fi
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6670
6671
6672
6673
6674
6675
6676
	  fi
	fi
	;;
      esac
      $show "$rm $rmfiles"
      $run $rm $rmfiles || exit_status=1
    done
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6677
    objdir="$origobjdir"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692

    # Try to remove the ${objdir}s in the directories where we deleted files
    for dir in $rmdirs; do
      if test -d "$dir"; then
	$show "rmdir $dir"
	$run rmdir $dir >/dev/null 2>&1
      fi
    done

    exit $exit_status
    ;;

  "")
    $echo "$modename: you must specify a MODE" 1>&2
    $echo "$generic_help" 1>&2
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6693
    exit $EXIT_FAILURE
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6694
6695
6696
6697
6698
6699
    ;;
  esac

  if test -z "$exec_cmd"; then
    $echo "$modename: invalid operation mode \`$mode'" 1>&2
    $echo "$generic_help" 1>&2
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6700
    exit $EXIT_FAILURE
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6701
6702
6703
6704
6705
  fi
fi # test -z "$show_help"

if test -n "$exec_cmd"; then
  eval exec $exec_cmd
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6706
  exit $EXIT_FAILURE
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
fi

# We need to display help for each of the modes.
case $mode in
"") $echo \
"Usage: $modename [OPTION]... [MODE-ARG]...

Provide generalized library-building support services.

    --config          show all configuration variables
    --debug           enable verbose shell tracing
-n, --dry-run         display commands without modifying any files
    --features        display basic configuration information and exit
    --finish          same as \`--mode=finish'
    --help            display this help message and exit
    --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
    --quiet           same as \`--silent'
    --silent          don't print informational messages
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6725
    --tag=TAG         use configuration variables from tag TAG
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
    --version         print version information

MODE must be one of the following:

      clean           remove files from the build directory
      compile         compile a source file into a libtool object
      execute         automatically set library path, then run a program
      finish          complete the installation of libtool libraries
      install         install libraries or executables
      link            create a library or an executable
      uninstall       remove libraries from an installed directory

MODE-ARGS vary depending on the MODE.  Try \`$modename --help --mode=MODE' for
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6739
6740
6741
6742
a more detailed description of MODE.

Report bugs to <bug-libtool@gnu.org>."
  exit $EXIT_SUCCESS
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
  ;;

clean)
  $echo \
"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...

Remove files from the build directory.

RM is the name of the program to use to delete files associated with each FILE
(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
to RM.

If FILE is a libtool library, object or program, all the files associated
with it are deleted. Otherwise, only FILE itself is deleted using RM."
  ;;

compile)
  $echo \
"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE

Compile a source file into a libtool library object.

This mode accepts the following additional options:

  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
  -prefer-pic       try to building PIC objects only
  -prefer-non-pic   try to building non-PIC objects only
  -static           always build a \`.o' file suitable for static linking

COMPILE-COMMAND is a command to be used in creating a \`standard' object file
from the given SOURCEFILE.

The output file name is determined by removing the directory component from
SOURCEFILE, then substituting the C source code suffix \`.c' with the
library object suffix, \`.lo'."
  ;;

execute)
  $echo \
"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...

Automatically set library path, then run a program.

This mode accepts the following additional options:

  -dlopen FILE      add the directory containing FILE to the library path

This mode sets the library path environment variable according to \`-dlopen'
flags.

If any of the ARGS are libtool executable wrappers, then they are translated
into their corresponding uninstalled binary, and any of their required library
directories are added to the library path.

Then, COMMAND is executed, with ARGS as arguments."
  ;;

finish)
  $echo \
"Usage: $modename [OPTION]... --mode=finish [LIBDIR]...

Complete the installation of libtool libraries.

Each LIBDIR is a directory that contains libtool libraries.

The commands that this mode executes may require superuser privileges.  Use
the \`--dry-run' option if you just want to see what would be executed."
  ;;

install)
  $echo \
"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...

Install executables or libraries.

INSTALL-COMMAND is the installation command.  The first component should be
either the \`install' or \`cp' program.

The rest of the components are interpreted as arguments to that command (only
BSD-compatible install options are recognized)."
  ;;

link)
  $echo \
"Usage: $modename [OPTION]... --mode=link LINK-COMMAND...

Link object files or libraries together to form another library, or to
create an executable program.

LINK-COMMAND is a command using the C compiler that you would use to create
a program from several object files.

The following components of LINK-COMMAND are treated specially:

  -all-static       do not do any dynamic linking at all
  -avoid-version    do not add a version suffix if possible
  -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
  -export-symbols SYMFILE
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6843
                    try to export only the symbols listed in SYMFILE
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6844
  -export-symbols-regex REGEX
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6845
                    try to export only the symbols matching REGEX
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6846
6847
6848
6849
6850
6851
6852
  -LLIBDIR          search LIBDIR for required installed libraries
  -lNAME            OUTPUT-FILE requires the installed library libNAME
  -module           build a library that can dlopened
  -no-fast-install  disable the fast-install mode
  -no-install       link a not-installable executable
  -no-undefined     declare that a library does not refer to external symbols
  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6853
6854
6855
  -objectlist FILE  Use a list of object files found in FILE to specify objects
  -precious-files-regex REGEX
                    don't remove output files matching REGEX
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6856
6857
6858
  -release RELEASE  specify package release information
  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6859
6860
6861
  -static           do not do any dynamic linking of uninstalled libtool libraries
  -static-libtool-libs
                    do not do any dynamic linking of libtool libraries
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6862
  -version-info CURRENT[:REVISION[:AGE]]
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6863
                    specify library version info [each variable defaults to 0]
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898

All other options (arguments beginning with \`-') are ignored.

Every other argument is treated as a filename.  Files ending in \`.la' are
treated as uninstalled libtool libraries, other files are standard or library
object files.

If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
only library objects (\`.lo' files) may be specified, and \`-rpath' is
required, except when creating a convenience library.

If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
using \`ar' and \`ranlib', or on Windows using \`lib'.

If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
is created, otherwise an executable program is created."
  ;;

uninstall)
  $echo \
"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...

Remove libraries from an installation directory.

RM is the name of the program to use to delete files associated with each FILE
(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
to RM.

If FILE is a libtool library, all the files associated with it are deleted.
Otherwise, only FILE itself is deleted using RM."
  ;;

*)
  $echo "$modename: invalid operation mode \`$mode'" 1>&2
  $echo "$help" 1>&2
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6899
  exit $EXIT_FAILURE
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6900
6901
6902
  ;;
esac

Emmanuel Bertin's avatar
Emmanuel Bertin committed
6903
$echo
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6904
6905
$echo "Try \`$modename --help' for more information about other modes."

Emmanuel Bertin's avatar
Emmanuel Bertin committed
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
exit $?

# The TAGs below are defined such that we never get into a situation
# in which we disable both kinds of libraries.  Given conflicting
# choices, we go for a static library, that is the most portable,
# since we can't tell whether shared libraries were disabled because
# the user asked for that or because the platform doesn't support
# them.  This is particularly important on AIX, because we don't
# support having both static and shared libraries enabled at the same
# time on that platform, so we default to a shared-only configuration.
# If a disable-shared tag is given, we'll fallback to a static-only
# configuration.  But we'll never go from static-only to shared-only.

# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
disable_libs=shared
# ### END LIBTOOL TAG CONFIG: disable-shared

# ### BEGIN LIBTOOL TAG CONFIG: disable-static
disable_libs=static
# ### END LIBTOOL TAG CONFIG: disable-static
Emmanuel Bertin's avatar
Emmanuel Bertin committed
6926
6927
6928
6929
6930

# Local Variables:
# mode:shell-script
# sh-indentation:2
# End:
For faster browsing, not all history is shown. View entire blame